@opencode/ai 2.0.31 → 2.1.0

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.
Files changed (152) hide show
  1. package/dist/ai-client.d.ts +2 -2
  2. package/dist/experimental/evaluation-client.d.ts +1 -1
  3. package/dist/experimental/evaluation.d.ts +20 -20
  4. package/dist/experimental/realtime.d.ts +47 -0
  5. package/dist/experimental/realtime.js +99 -0
  6. package/dist/experimental/system-one.d.ts +1 -1
  7. package/dist/experimental.d.ts +2 -0
  8. package/dist/experimental.js +1 -0
  9. package/dist/image-client.d.ts +8 -8
  10. package/dist/image.d.ts +593 -437
  11. package/dist/llm.d.ts +51 -51
  12. package/dist/media-client.d.ts +1 -1
  13. package/dist/media.d.ts +4 -4
  14. package/dist/promise.d.ts +199 -198
  15. package/dist/protocols/alibaba-chat.d.ts +81 -82
  16. package/dist/protocols/alibaba-chat.js +0 -1
  17. package/dist/protocols/alibaba-messages.d.ts +99 -99
  18. package/dist/protocols/alibaba-responses.d.ts +120 -120
  19. package/dist/protocols/anthropic-messages.d.ts +187 -187
  20. package/dist/protocols/anthropic-messages.js +3 -2
  21. package/dist/protocols/assemblyai-transcription.d.ts +1 -1
  22. package/dist/protocols/bedrock-converse.d.ts +75 -79
  23. package/dist/protocols/bfl-images.d.ts +1 -1
  24. package/dist/protocols/cartesia-speech.d.ts +17 -17
  25. package/dist/protocols/cohere-chat.d.ts +26 -23
  26. package/dist/protocols/cohere-chat.js +22 -1
  27. package/dist/protocols/deepgram-speech.d.ts +17 -17
  28. package/dist/protocols/deepgram-transcription.d.ts +1 -1
  29. package/dist/protocols/elevenlabs-speech.d.ts +17 -17
  30. package/dist/protocols/elevenlabs-transcription.d.ts +1 -1
  31. package/dist/protocols/fal-images.d.ts +1 -1
  32. package/dist/protocols/fal-video.d.ts +1 -1
  33. package/dist/protocols/gemini.d.ts +55 -55
  34. package/dist/protocols/gemini.js +11 -1
  35. package/dist/protocols/google-images.d.ts +1 -1
  36. package/dist/protocols/google-interactions.d.ts +64 -62
  37. package/dist/protocols/google-interactions.js +19 -1
  38. package/dist/protocols/google-speech.d.ts +17 -17
  39. package/dist/protocols/google-transcription.d.ts +47 -47
  40. package/dist/protocols/google-video.d.ts +1 -1
  41. package/dist/protocols/meta-messages.d.ts +121 -121
  42. package/dist/protocols/meta-responses.d.ts +201 -201
  43. package/dist/protocols/mistral-chat.d.ts +45 -45
  44. package/dist/protocols/open-responses-channel.d.ts +1 -1
  45. package/dist/protocols/open-responses.d.ts +584 -450
  46. package/dist/protocols/open-responses.js +27 -35
  47. package/dist/protocols/openai-chat.d.ts +248 -248
  48. package/dist/protocols/openai-chat.js +11 -42
  49. package/dist/protocols/openai-compatible-chat.d.ts +32 -32
  50. package/dist/protocols/openai-compatible-responses.d.ts +88 -88
  51. package/dist/protocols/openai-images.d.ts +17 -17
  52. package/dist/protocols/openai-responses.d.ts +567 -567
  53. package/dist/protocols/openai-responses.js +1 -1
  54. package/dist/protocols/openai-speech.d.ts +17 -17
  55. package/dist/protocols/openai-transcription.d.ts +47 -47
  56. package/dist/protocols/replicate-images.d.ts +1 -1
  57. package/dist/protocols/runway-video.d.ts +1 -1
  58. package/dist/protocols/shared.d.ts +12 -1
  59. package/dist/protocols/shared.js +17 -1
  60. package/dist/protocols/stability-images.d.ts +2 -2
  61. package/dist/protocols/utils/bedrock-cache.d.ts +2 -2
  62. package/dist/protocols/utils/bedrock-media.d.ts +4 -4
  63. package/dist/protocols/utils/openai-options.d.ts +1 -1
  64. package/dist/protocols/utils/speech-stream.d.ts +1 -1
  65. package/dist/protocols/utils/tool-schema.d.ts +10 -5
  66. package/dist/protocols/utils/tool-stream.d.ts +152 -152
  67. package/dist/protocols/venice-chat.d.ts +109 -110
  68. package/dist/protocols/venice-chat.js +0 -1
  69. package/dist/protocols/xai-images.d.ts +1 -1
  70. package/dist/protocols/xai-responses.d.ts +79 -79
  71. package/dist/protocols/xai-video.d.ts +1 -1
  72. package/dist/protocols/zai-chat.d.ts +77 -78
  73. package/dist/protocols/zai-chat.js +0 -1
  74. package/dist/protocols/zai-images.d.ts +1 -1
  75. package/dist/protocols/zai-messages.d.ts +97 -97
  76. package/dist/providers/alibaba.d.ts +222 -283
  77. package/dist/providers/amazon-bedrock-mantle.d.ts +291 -298
  78. package/dist/providers/amazon-bedrock.d.ts +22 -28
  79. package/dist/providers/anthropic-compatible.d.ts +86 -90
  80. package/dist/providers/anthropic.d.ts +86 -90
  81. package/dist/providers/assemblyai.d.ts +2 -6
  82. package/dist/providers/azure.d.ts +228 -238
  83. package/dist/providers/baseten.d.ts +66 -70
  84. package/dist/providers/black-forest-labs.d.ts +2 -6
  85. package/dist/providers/cartesia.d.ts +2 -6
  86. package/dist/providers/cerebras.d.ts +66 -70
  87. package/dist/providers/cerebras.js +0 -1
  88. package/dist/providers/cloudflare-ai-gateway.d.ts +352 -356
  89. package/dist/providers/cloudflare-workers-ai.d.ts +66 -70
  90. package/dist/providers/cohere.d.ts +122 -132
  91. package/dist/providers/cohere.js +0 -2
  92. package/dist/providers/deepgram.d.ts +2 -7
  93. package/dist/providers/deepinfra.d.ts +66 -70
  94. package/dist/providers/deepinfra.js +0 -1
  95. package/dist/providers/deepseek.d.ts +66 -70
  96. package/dist/providers/deepseek.js +1 -1
  97. package/dist/providers/digitalocean.d.ts +137 -141
  98. package/dist/providers/elevenlabs.d.ts +2 -7
  99. package/dist/providers/fal.d.ts +2 -7
  100. package/dist/providers/fireworks.d.ts +66 -70
  101. package/dist/providers/google-vertex-chat.d.ts +34 -38
  102. package/dist/providers/google-vertex-interactions.d.ts +31 -41
  103. package/dist/providers/google-vertex-messages.d.ts +81 -85
  104. package/dist/providers/google-vertex-mistral.d.ts +23 -27
  105. package/dist/providers/google-vertex-responses.d.ts +90 -94
  106. package/dist/providers/google-vertex.d.ts +26 -30
  107. package/dist/providers/google.d.ts +94 -109
  108. package/dist/providers/groq.d.ts +111 -115
  109. package/dist/providers/groq.js +0 -1
  110. package/dist/providers/meta.d.ts +309 -317
  111. package/dist/providers/meta.js +1 -1
  112. package/dist/providers/minimax.d.ts +296 -303
  113. package/dist/providers/minimax.js +1 -1
  114. package/dist/providers/mistral.d.ts +22 -26
  115. package/dist/providers/moonshot.d.ts +296 -303
  116. package/dist/providers/moonshot.js +0 -1
  117. package/dist/providers/openai-compatible-responses.d.ts +90 -94
  118. package/dist/providers/openai-compatible.d.ts +34 -38
  119. package/dist/providers/openai.d.ts +93 -108
  120. package/dist/providers/opencode.d.ts +2 -8
  121. package/dist/providers/openrouter.d.ts +137 -144
  122. package/dist/providers/replicate.d.ts +2 -6
  123. package/dist/providers/runway.d.ts +2 -6
  124. package/dist/providers/stability.d.ts +2 -7
  125. package/dist/providers/togetherai.d.ts +66 -70
  126. package/dist/providers/togetherai.js +1 -1
  127. package/dist/providers/typesafe-ai.d.ts +2 -8
  128. package/dist/providers/venice.d.ts +58 -63
  129. package/dist/providers/vercel-ai-gateway.d.ts +2 -12
  130. package/dist/providers/xai.d.ts +38 -50
  131. package/dist/providers/zai-coding-plan.d.ts +206 -213
  132. package/dist/providers/zai.d.ts +40 -46
  133. package/dist/route/client.d.ts +51 -51
  134. package/dist/route/media-protocol.d.ts +1 -1
  135. package/dist/route/transport/http.d.ts +1 -1
  136. package/dist/route/transport/websocket.d.ts +8 -8
  137. package/dist/schema/errors.d.ts +19 -19
  138. package/dist/schema/events.d.ts +3090 -3288
  139. package/dist/schema/messages.d.ts +8 -7
  140. package/dist/schema/options.d.ts +2 -1
  141. package/dist/schema/options.js +2 -1
  142. package/dist/speech-client.d.ts +8 -8
  143. package/dist/speech.d.ts +434 -398
  144. package/dist/testing.d.ts +338 -338
  145. package/dist/tool-runtime.d.ts +1 -1
  146. package/dist/transcription-client.d.ts +23 -23
  147. package/dist/transcription.d.ts +562 -646
  148. package/dist/utils/sanitize.d.ts +4 -0
  149. package/dist/utils/sanitize.js +23 -6
  150. package/dist/video-client.d.ts +8 -8
  151. package/dist/video.d.ts +416 -372
  152. package/package.json +6 -6
@@ -563,20 +563,9 @@ interface LoweringOptions {
563
563
  export declare const fromRequest: (request: LLMRequest<import("../schema/options.js").LanguageModel<{
564
564
  readonly [x: string]: unknown;
565
565
  }, import("../route/client.js").CompactionOperations | undefined>>, options?: LoweringOptions | undefined) => Effect.Effect<{
566
- reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
567
- prompt_cache_key?: string | undefined;
568
566
  store?: boolean | undefined;
569
- temperature: number | undefined;
570
- top_p: number | undefined;
571
- frequency_penalty: number | undefined;
572
- presence_penalty: number | undefined;
573
- seed: number | undefined;
574
- stop: readonly string[] | undefined;
575
- max_completion_tokens: number | undefined;
576
- tool_stream?: boolean | undefined;
577
- stream_options?: {
578
- include_usage: boolean;
579
- } | undefined;
567
+ prompt_cache_key?: string | undefined;
568
+ reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
580
569
  model: string & import("effect/Brand").Brand<"AI.ModelID">;
581
570
  messages: ({
582
571
  readonly role: "system";
@@ -620,8 +609,20 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
620
609
  readonly file_data: string;
621
610
  };
622
611
  })[];
612
+ } | {
613
+ readonly role: "tool";
614
+ readonly tool_call_id: string;
615
+ readonly content: string | readonly {
616
+ readonly type: "text";
617
+ readonly text: string;
618
+ readonly cache_control?: {
619
+ readonly type: "ephemeral";
620
+ readonly ttl?: string | undefined;
621
+ } | undefined;
622
+ }[];
623
623
  } | {
624
624
  readonly [x: string]: unknown;
625
+ readonly role: "assistant";
625
626
  readonly content: string | readonly {
626
627
  readonly type: "text";
627
628
  readonly text: string;
@@ -630,73 +631,61 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
630
631
  readonly ttl?: string | undefined;
631
632
  } | undefined;
632
633
  }[] | null;
633
- readonly role: "assistant";
634
- readonly reasoning?: string | undefined;
635
- readonly reasoning_content?: string | undefined;
636
- readonly reasoning_text?: string | undefined;
637
634
  readonly tool_calls?: readonly {
635
+ readonly id: string;
636
+ readonly type: "function";
638
637
  readonly function: {
639
638
  readonly name: string;
640
639
  readonly arguments: string;
641
640
  };
642
- readonly id: string;
643
- readonly type: "function";
644
641
  readonly extra_content?: {
645
642
  readonly google: {
646
643
  readonly thought_signature: string;
647
644
  };
648
645
  } | undefined;
649
646
  }[] | undefined;
647
+ readonly reasoning_content?: string | undefined;
648
+ readonly reasoning?: string | undefined;
649
+ readonly reasoning_text?: string | undefined;
650
650
  readonly reasoning_details?: unknown;
651
- } | {
652
- readonly role: "tool";
653
- readonly tool_call_id: string;
654
- readonly content: string | readonly {
655
- readonly type: "text";
656
- readonly text: string;
657
- readonly cache_control?: {
658
- readonly type: "ephemeral";
659
- readonly ttl?: string | undefined;
660
- } | undefined;
661
- }[];
662
651
  })[];
663
652
  tools: {
653
+ readonly type: "function";
664
654
  readonly function: {
665
- readonly description: string;
666
655
  readonly name: string;
656
+ readonly description: string;
667
657
  readonly parameters: {
668
658
  readonly [x: string]: unknown;
669
659
  };
670
660
  readonly strict?: boolean | undefined;
671
661
  };
672
- readonly type: "function";
673
662
  readonly cache_control?: {
674
663
  readonly type: "ephemeral";
675
664
  readonly ttl?: string | undefined;
676
665
  } | undefined;
677
666
  }[] | undefined;
678
- tool_choice: "required" | "auto" | "none" | {
667
+ tool_choice: "auto" | "none" | "required" | {
679
668
  type: "function";
680
669
  function: {
681
670
  name: string;
682
671
  };
683
672
  } | undefined;
684
673
  stream: true;
685
- } | {
686
- reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
687
- prompt_cache_key?: string | undefined;
688
- store?: boolean | undefined;
674
+ stream_options?: {
675
+ include_usage: boolean;
676
+ } | undefined;
677
+ tool_stream?: boolean | undefined;
678
+ max_completion_tokens: number | undefined;
689
679
  temperature: number | undefined;
690
680
  top_p: number | undefined;
691
681
  frequency_penalty: number | undefined;
692
682
  presence_penalty: number | undefined;
693
683
  seed: number | undefined;
694
684
  stop: readonly string[] | undefined;
695
- max_tokens: number | undefined;
696
- tool_stream?: boolean | undefined;
697
- stream_options?: {
698
- include_usage: boolean;
699
- } | undefined;
685
+ } | {
686
+ store?: boolean | undefined;
687
+ prompt_cache_key?: string | undefined;
688
+ reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
700
689
  model: string & import("effect/Brand").Brand<"AI.ModelID">;
701
690
  messages: ({
702
691
  readonly role: "system";
@@ -740,8 +729,20 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
740
729
  readonly file_data: string;
741
730
  };
742
731
  })[];
732
+ } | {
733
+ readonly role: "tool";
734
+ readonly tool_call_id: string;
735
+ readonly content: string | readonly {
736
+ readonly type: "text";
737
+ readonly text: string;
738
+ readonly cache_control?: {
739
+ readonly type: "ephemeral";
740
+ readonly ttl?: string | undefined;
741
+ } | undefined;
742
+ }[];
743
743
  } | {
744
744
  readonly [x: string]: unknown;
745
+ readonly role: "assistant";
745
746
  readonly content: string | readonly {
746
747
  readonly type: "text";
747
748
  readonly text: string;
@@ -750,85 +751,72 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
750
751
  readonly ttl?: string | undefined;
751
752
  } | undefined;
752
753
  }[] | null;
753
- readonly role: "assistant";
754
- readonly reasoning?: string | undefined;
755
- readonly reasoning_content?: string | undefined;
756
- readonly reasoning_text?: string | undefined;
757
754
  readonly tool_calls?: readonly {
755
+ readonly id: string;
756
+ readonly type: "function";
758
757
  readonly function: {
759
758
  readonly name: string;
760
759
  readonly arguments: string;
761
760
  };
762
- readonly id: string;
763
- readonly type: "function";
764
761
  readonly extra_content?: {
765
762
  readonly google: {
766
763
  readonly thought_signature: string;
767
764
  };
768
765
  } | undefined;
769
766
  }[] | undefined;
767
+ readonly reasoning_content?: string | undefined;
768
+ readonly reasoning?: string | undefined;
769
+ readonly reasoning_text?: string | undefined;
770
770
  readonly reasoning_details?: unknown;
771
- } | {
772
- readonly role: "tool";
773
- readonly tool_call_id: string;
774
- readonly content: string | readonly {
775
- readonly type: "text";
776
- readonly text: string;
777
- readonly cache_control?: {
778
- readonly type: "ephemeral";
779
- readonly ttl?: string | undefined;
780
- } | undefined;
781
- }[];
782
771
  })[];
783
772
  tools: {
773
+ readonly type: "function";
784
774
  readonly function: {
785
- readonly description: string;
786
775
  readonly name: string;
776
+ readonly description: string;
787
777
  readonly parameters: {
788
778
  readonly [x: string]: unknown;
789
779
  };
790
780
  readonly strict?: boolean | undefined;
791
781
  };
792
- readonly type: "function";
793
782
  readonly cache_control?: {
794
783
  readonly type: "ephemeral";
795
784
  readonly ttl?: string | undefined;
796
785
  } | undefined;
797
786
  }[] | undefined;
798
- tool_choice: "required" | "auto" | "none" | {
787
+ tool_choice: "auto" | "none" | "required" | {
799
788
  type: "function";
800
789
  function: {
801
790
  name: string;
802
791
  };
803
792
  } | undefined;
804
793
  stream: true;
794
+ stream_options?: {
795
+ include_usage: boolean;
796
+ } | undefined;
797
+ tool_stream?: boolean | undefined;
798
+ max_tokens: number | undefined;
799
+ temperature: number | undefined;
800
+ top_p: number | undefined;
801
+ frequency_penalty: number | undefined;
802
+ presence_penalty: number | undefined;
803
+ seed: number | undefined;
804
+ stop: readonly string[] | undefined;
805
805
  }, AIError, never>;
806
- export declare const finishEvents: (state: ParserState) => Effect.Effect<(({
807
- readonly type: "compaction";
808
- readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
809
- readonly id?: string | undefined;
810
- readonly text?: string | null | undefined;
811
- readonly encrypted?: string | undefined;
812
- } & ({
813
- readonly encrypted: string;
814
- readonly text?: never;
815
- } | {
816
- readonly text: string | null;
817
- readonly encrypted?: never;
818
- })) | {
806
+ export declare const finishEvents: (state: ParserState) => Effect.Effect<({
819
807
  readonly type: "step-start";
820
808
  readonly index: number;
821
809
  } | {
822
- readonly id: string;
823
810
  readonly type: "text-start";
811
+ readonly id: string;
824
812
  readonly providerMetadata?: {
825
813
  readonly [x: string]: {
826
814
  readonly [x: string]: unknown;
827
815
  };
828
816
  } | undefined;
829
817
  } | {
830
- readonly id: string;
831
818
  readonly type: "text-delta";
819
+ readonly id: string;
832
820
  readonly text: string;
833
821
  readonly providerMetadata?: {
834
822
  readonly [x: string]: {
@@ -836,8 +824,8 @@ export declare const finishEvents: (state: ParserState) => Effect.Effect<(({
836
824
  };
837
825
  } | undefined;
838
826
  } | {
839
- readonly id: string;
840
827
  readonly type: "text-end";
828
+ readonly id: string;
841
829
  readonly text?: string | undefined;
842
830
  readonly providerMetadata?: {
843
831
  readonly [x: string]: {
@@ -845,16 +833,16 @@ export declare const finishEvents: (state: ParserState) => Effect.Effect<(({
845
833
  };
846
834
  } | undefined;
847
835
  } | {
848
- readonly id: string;
849
836
  readonly type: "reasoning-start";
837
+ readonly id: string;
850
838
  readonly providerMetadata?: {
851
839
  readonly [x: string]: {
852
840
  readonly [x: string]: unknown;
853
841
  };
854
842
  } | undefined;
855
843
  } | {
856
- readonly id: string;
857
844
  readonly type: "reasoning-delta";
845
+ readonly id: string;
858
846
  readonly text: string;
859
847
  readonly providerMetadata?: {
860
848
  readonly [x: string]: {
@@ -862,8 +850,8 @@ export declare const finishEvents: (state: ParserState) => Effect.Effect<(({
862
850
  };
863
851
  } | undefined;
864
852
  } | {
865
- readonly id: string;
866
853
  readonly type: "reasoning-end";
854
+ readonly id: string;
867
855
  readonly text?: string | undefined;
868
856
  readonly providerMetadata?: {
869
857
  readonly [x: string]: {
@@ -871,55 +859,56 @@ export declare const finishEvents: (state: ParserState) => Effect.Effect<(({
871
859
  };
872
860
  } | undefined;
873
861
  } | {
874
- readonly id: string;
875
862
  readonly type: "tool-input-start";
863
+ readonly id: string;
876
864
  readonly name: string;
865
+ readonly namespace?: string | undefined;
866
+ readonly providerExecuted?: boolean | undefined;
877
867
  readonly providerMetadata?: {
878
868
  readonly [x: string]: {
879
869
  readonly [x: string]: unknown;
880
870
  };
881
871
  } | undefined;
882
- readonly namespace?: string | undefined;
883
- readonly providerExecuted?: boolean | undefined;
884
872
  } | {
885
- readonly id: string;
886
873
  readonly type: "tool-input-delta";
874
+ readonly id: string;
887
875
  readonly name: string;
876
+ readonly namespace?: string | undefined;
888
877
  readonly text: string;
889
878
  readonly input?: unknown;
890
- readonly namespace?: string | undefined;
891
879
  } | {
892
- readonly id: string;
893
880
  readonly type: "tool-input-end";
881
+ readonly id: string;
894
882
  readonly name: string;
883
+ readonly namespace?: string | undefined;
895
884
  readonly providerMetadata?: {
896
885
  readonly [x: string]: {
897
886
  readonly [x: string]: unknown;
898
887
  };
899
888
  } | undefined;
900
- readonly namespace?: string | undefined;
901
889
  } | {
902
- readonly id: string;
903
890
  readonly type: "tool-input-error";
891
+ readonly id: string;
904
892
  readonly name: string;
905
- readonly raw: string;
906
893
  readonly namespace?: string | undefined;
894
+ readonly raw: string;
907
895
  } | {
908
- readonly id: string;
909
896
  readonly type: "tool-call";
897
+ readonly id: string;
910
898
  readonly name: string;
899
+ readonly namespace?: string | undefined;
911
900
  readonly input: unknown;
901
+ readonly providerExecuted?: boolean | undefined;
912
902
  readonly providerMetadata?: {
913
903
  readonly [x: string]: {
914
904
  readonly [x: string]: unknown;
915
905
  };
916
906
  } | undefined;
917
- readonly namespace?: string | undefined;
918
- readonly providerExecuted?: boolean | undefined;
919
907
  } | {
920
- readonly id: string;
921
908
  readonly type: "tool-result";
909
+ readonly id: string;
922
910
  readonly name: string;
911
+ readonly namespace?: string | undefined;
923
912
  readonly result: {
924
913
  readonly type: "json";
925
914
  readonly value: unknown;
@@ -953,28 +942,19 @@ export declare const finishEvents: (state: ParserState) => Effect.Effect<(({
953
942
  readonly name?: string | undefined;
954
943
  })[];
955
944
  } | undefined;
945
+ readonly providerExecuted?: boolean | undefined;
956
946
  readonly providerMetadata?: {
957
947
  readonly [x: string]: {
958
948
  readonly [x: string]: unknown;
959
949
  };
960
950
  } | undefined;
961
- readonly namespace?: string | undefined;
962
- readonly providerExecuted?: boolean | undefined;
963
951
  } | {
964
- readonly id: string;
965
952
  readonly type: "tool-error";
966
- readonly message: string;
953
+ readonly id: string;
967
954
  readonly name: string;
968
- readonly error?: unknown;
969
- readonly providerMetadata?: {
970
- readonly [x: string]: {
971
- readonly [x: string]: unknown;
972
- };
973
- } | undefined;
974
955
  readonly namespace?: string | undefined;
975
- } | {
976
- readonly type: "media";
977
- readonly media: import("../media.js").Asset;
956
+ readonly message: string;
957
+ readonly error?: unknown;
978
958
  readonly providerMetadata?: {
979
959
  readonly [x: string]: {
980
960
  readonly [x: string]: unknown;
@@ -982,33 +962,41 @@ export declare const finishEvents: (state: ParserState) => Effect.Effect<(({
982
962
  } | undefined;
983
963
  } | {
984
964
  readonly type: "step-finish";
965
+ readonly index: number;
985
966
  readonly reason: {
986
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
967
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
987
968
  readonly raw?: string | undefined;
988
969
  readonly category?: string | undefined;
989
970
  readonly explanation?: string | undefined;
990
971
  };
991
- readonly index: number;
972
+ readonly usage?: Usage | undefined;
992
973
  readonly providerMetadata?: {
993
974
  readonly [x: string]: {
994
975
  readonly [x: string]: unknown;
995
976
  };
996
977
  } | undefined;
997
- readonly usage?: Usage | undefined;
998
978
  } | {
999
979
  readonly type: "finish";
1000
980
  readonly reason: {
1001
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
981
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
1002
982
  readonly raw?: string | undefined;
1003
983
  readonly category?: string | undefined;
1004
984
  readonly explanation?: string | undefined;
1005
985
  };
986
+ readonly usage?: Usage | undefined;
987
+ readonly providerMetadata?: {
988
+ readonly [x: string]: {
989
+ readonly [x: string]: unknown;
990
+ };
991
+ } | undefined;
992
+ } | {
993
+ readonly type: "media";
994
+ readonly media: import("../media.js").Asset;
1006
995
  readonly providerMetadata?: {
1007
996
  readonly [x: string]: {
1008
997
  readonly [x: string]: unknown;
1009
998
  };
1010
999
  } | undefined;
1011
- readonly usage?: Usage | undefined;
1012
1000
  } | {
1013
1001
  readonly type: "provider-error";
1014
1002
  readonly message: string;
@@ -1018,7 +1006,19 @@ export declare const finishEvents: (state: ParserState) => Effect.Effect<(({
1018
1006
  readonly [x: string]: unknown;
1019
1007
  };
1020
1008
  } | undefined;
1021
- })[], AIError, never>;
1009
+ } | ({
1010
+ readonly type: "compaction";
1011
+ readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
1012
+ readonly id?: string | undefined;
1013
+ readonly encrypted?: string | undefined;
1014
+ readonly text?: string | null | undefined;
1015
+ } & ({
1016
+ readonly encrypted: string;
1017
+ readonly text?: never;
1018
+ } | {
1019
+ readonly text: string | null;
1020
+ readonly encrypted?: never;
1021
+ })))[], AIError, never>;
1022
1022
  /**
1023
1023
  * The OpenAI Chat protocol — request body construction, body schema, and the
1024
1024
  * streaming-event state machine. Reused by every route that speaks OpenAI Chat
@@ -1069,8 +1069,20 @@ export declare const protocol: Protocol<{
1069
1069
  readonly file_data: string;
1070
1070
  };
1071
1071
  })[];
1072
+ } | {
1073
+ readonly role: "tool";
1074
+ readonly tool_call_id: string;
1075
+ readonly content: string | readonly {
1076
+ readonly type: "text";
1077
+ readonly text: string;
1078
+ readonly cache_control?: {
1079
+ readonly type: "ephemeral";
1080
+ readonly ttl?: string | undefined;
1081
+ } | undefined;
1082
+ }[];
1072
1083
  } | {
1073
1084
  readonly [x: string]: unknown;
1085
+ readonly role: "assistant";
1074
1086
  readonly content: string | readonly {
1075
1087
  readonly type: "text";
1076
1088
  readonly text: string;
@@ -1079,135 +1091,99 @@ export declare const protocol: Protocol<{
1079
1091
  readonly ttl?: string | undefined;
1080
1092
  } | undefined;
1081
1093
  }[] | null;
1082
- readonly role: "assistant";
1083
- readonly reasoning?: string | undefined;
1084
- readonly reasoning_content?: string | undefined;
1085
- readonly reasoning_text?: string | undefined;
1086
1094
  readonly tool_calls?: readonly {
1095
+ readonly id: string;
1096
+ readonly type: "function";
1087
1097
  readonly function: {
1088
1098
  readonly name: string;
1089
1099
  readonly arguments: string;
1090
1100
  };
1091
- readonly id: string;
1092
- readonly type: "function";
1093
1101
  readonly extra_content?: {
1094
1102
  readonly google: {
1095
1103
  readonly thought_signature: string;
1096
1104
  };
1097
1105
  } | undefined;
1098
1106
  }[] | undefined;
1107
+ readonly reasoning_content?: string | undefined;
1108
+ readonly reasoning?: string | undefined;
1109
+ readonly reasoning_text?: string | undefined;
1099
1110
  readonly reasoning_details?: unknown;
1100
- } | {
1101
- readonly role: "tool";
1102
- readonly tool_call_id: string;
1103
- readonly content: string | readonly {
1104
- readonly type: "text";
1105
- readonly text: string;
1106
- readonly cache_control?: {
1107
- readonly type: "ephemeral";
1108
- readonly ttl?: string | undefined;
1109
- } | undefined;
1110
- }[];
1111
1111
  })[];
1112
- readonly stream: true;
1113
- readonly max_completion_tokens?: number | undefined;
1114
- readonly max_tokens?: number | undefined;
1115
- readonly temperature?: number | undefined;
1116
1112
  readonly tools?: readonly {
1113
+ readonly type: "function";
1117
1114
  readonly function: {
1118
- readonly description: string;
1119
1115
  readonly name: string;
1116
+ readonly description: string;
1120
1117
  readonly parameters: {
1121
1118
  readonly [x: string]: unknown;
1122
1119
  };
1123
1120
  readonly strict?: boolean | undefined;
1124
1121
  };
1125
- readonly type: "function";
1126
1122
  readonly cache_control?: {
1127
1123
  readonly type: "ephemeral";
1128
1124
  readonly ttl?: string | undefined;
1129
1125
  } | undefined;
1130
1126
  }[] | undefined;
1131
- readonly stop?: readonly string[] | undefined;
1132
- readonly seed?: number | undefined;
1133
- readonly tool_choice?: "required" | "auto" | "none" | {
1127
+ readonly tool_choice?: "auto" | "none" | "required" | {
1134
1128
  readonly type: "function";
1135
1129
  readonly function: {
1136
1130
  readonly name: string;
1137
1131
  };
1138
1132
  } | undefined;
1139
- readonly top_p?: number | undefined;
1140
- readonly frequency_penalty?: number | undefined;
1141
- readonly presence_penalty?: number | undefined;
1142
- readonly store?: boolean | undefined;
1143
- readonly prompt_cache_key?: string | undefined;
1144
- readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
1133
+ readonly stream: true;
1145
1134
  readonly stream_options?: {
1146
1135
  readonly include_usage: boolean;
1147
1136
  } | undefined;
1137
+ readonly store?: boolean | undefined;
1138
+ readonly prompt_cache_key?: string | undefined;
1139
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
1148
1140
  readonly tool_stream?: boolean | undefined;
1141
+ readonly max_completion_tokens?: number | undefined;
1142
+ readonly max_tokens?: number | undefined;
1143
+ readonly temperature?: number | undefined;
1144
+ readonly top_p?: number | undefined;
1145
+ readonly frequency_penalty?: number | undefined;
1146
+ readonly presence_penalty?: number | undefined;
1147
+ readonly seed?: number | undefined;
1148
+ readonly stop?: readonly string[] | undefined;
1149
1149
  }, string, "[DONE]" | {
1150
1150
  readonly [x: string]: unknown;
1151
- readonly error?: {
1152
- readonly [x: string]: unknown;
1153
- readonly message: string;
1154
- readonly code?: string | number | null | undefined;
1155
- } | null | undefined;
1156
- readonly usage?: {
1157
- readonly [x: string]: unknown;
1158
- readonly cache_read_input_tokens?: number | null | undefined;
1159
- readonly cached_tokens?: number | null | undefined;
1160
- readonly total_tokens?: number | null | undefined;
1161
- readonly prompt_tokens?: number | null | undefined;
1162
- readonly completion_tokens?: number | null | undefined;
1163
- readonly prompt_tokens_details?: {
1164
- readonly [x: string]: unknown;
1165
- readonly cached_tokens?: number | null | undefined;
1166
- readonly cache_write_tokens?: number | null | undefined;
1167
- } | null | undefined;
1168
- readonly prompt_cache_hit_tokens?: number | null | undefined;
1169
- readonly cache_created_input_tokens?: number | null | undefined;
1170
- readonly completion_tokens_details?: {
1171
- readonly [x: string]: unknown;
1172
- readonly reasoning_tokens?: number | null | undefined;
1173
- readonly accepted_prediction_tokens?: number | null | undefined;
1174
- readonly rejected_prediction_tokens?: number | null | undefined;
1175
- } | null | undefined;
1176
- } | null | undefined;
1177
1151
  readonly choices?: readonly {
1178
1152
  readonly [x: string]: unknown;
1179
1153
  readonly delta?: {
1180
1154
  readonly [x: string]: unknown;
1181
- readonly reasoning?: string | null | undefined;
1182
- readonly reasoning_content?: string | null | undefined;
1183
- readonly reasoning_text?: string | null | undefined;
1184
1155
  readonly content?: string | null | undefined;
1185
1156
  readonly refusal?: string | null | undefined;
1157
+ readonly reasoning_content?: string | null | undefined;
1158
+ readonly reasoning?: string | null | undefined;
1159
+ readonly reasoning_text?: string | null | undefined;
1160
+ readonly reasoning_details?: unknown;
1186
1161
  readonly tool_calls?: readonly {
1162
+ readonly index?: number | null | undefined;
1163
+ readonly id?: string | null | undefined;
1187
1164
  readonly function?: {
1188
1165
  readonly name?: string | null | undefined;
1189
1166
  readonly arguments?: string | null | undefined;
1190
1167
  } | null | undefined;
1191
- readonly id?: string | null | undefined;
1192
- readonly index?: number | null | undefined;
1193
1168
  readonly extra_content?: unknown;
1194
1169
  }[] | null | undefined;
1195
- readonly reasoning_details?: unknown;
1196
1170
  } | null | undefined;
1171
+ readonly finish_reason?: string | null | undefined;
1172
+ readonly native_finish_reason?: string | null | undefined;
1197
1173
  readonly usage?: {
1198
1174
  readonly [x: string]: unknown;
1199
- readonly cache_read_input_tokens?: number | null | undefined;
1200
- readonly cached_tokens?: number | null | undefined;
1201
- readonly total_tokens?: number | null | undefined;
1202
1175
  readonly prompt_tokens?: number | null | undefined;
1203
1176
  readonly completion_tokens?: number | null | undefined;
1177
+ readonly total_tokens?: number | null | undefined;
1178
+ readonly cached_tokens?: number | null | undefined;
1179
+ readonly prompt_cache_hit_tokens?: number | null | undefined;
1180
+ readonly cache_read_input_tokens?: number | null | undefined;
1181
+ readonly cache_created_input_tokens?: number | null | undefined;
1204
1182
  readonly prompt_tokens_details?: {
1205
1183
  readonly [x: string]: unknown;
1206
1184
  readonly cached_tokens?: number | null | undefined;
1207
1185
  readonly cache_write_tokens?: number | null | undefined;
1208
1186
  } | null | undefined;
1209
- readonly prompt_cache_hit_tokens?: number | null | undefined;
1210
- readonly cache_created_input_tokens?: number | null | undefined;
1211
1187
  readonly completion_tokens_details?: {
1212
1188
  readonly [x: string]: unknown;
1213
1189
  readonly reasoning_tokens?: number | null | undefined;
@@ -1215,9 +1191,33 @@ export declare const protocol: Protocol<{
1215
1191
  readonly rejected_prediction_tokens?: number | null | undefined;
1216
1192
  } | null | undefined;
1217
1193
  } | null | undefined;
1218
- readonly finish_reason?: string | null | undefined;
1219
- readonly native_finish_reason?: string | null | undefined;
1220
1194
  }[] | null | undefined;
1195
+ readonly usage?: {
1196
+ readonly [x: string]: unknown;
1197
+ readonly prompt_tokens?: number | null | undefined;
1198
+ readonly completion_tokens?: number | null | undefined;
1199
+ readonly total_tokens?: number | null | undefined;
1200
+ readonly cached_tokens?: number | null | undefined;
1201
+ readonly prompt_cache_hit_tokens?: number | null | undefined;
1202
+ readonly cache_read_input_tokens?: number | null | undefined;
1203
+ readonly cache_created_input_tokens?: number | null | undefined;
1204
+ readonly prompt_tokens_details?: {
1205
+ readonly [x: string]: unknown;
1206
+ readonly cached_tokens?: number | null | undefined;
1207
+ readonly cache_write_tokens?: number | null | undefined;
1208
+ } | null | undefined;
1209
+ readonly completion_tokens_details?: {
1210
+ readonly [x: string]: unknown;
1211
+ readonly reasoning_tokens?: number | null | undefined;
1212
+ readonly accepted_prediction_tokens?: number | null | undefined;
1213
+ readonly rejected_prediction_tokens?: number | null | undefined;
1214
+ } | null | undefined;
1215
+ } | null | undefined;
1216
+ readonly error?: {
1217
+ readonly [x: string]: unknown;
1218
+ readonly code?: string | number | null | undefined;
1219
+ readonly message: string;
1220
+ } | null | undefined;
1221
1221
  }, ParserState>;
1222
1222
  export declare const framing: Framing.Definition<string>;
1223
1223
  export declare const httpTransport: HttpTransport.HttpJsonTransport<{
@@ -1264,8 +1264,20 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
1264
1264
  readonly file_data: string;
1265
1265
  };
1266
1266
  })[];
1267
+ } | {
1268
+ readonly role: "tool";
1269
+ readonly tool_call_id: string;
1270
+ readonly content: string | readonly {
1271
+ readonly type: "text";
1272
+ readonly text: string;
1273
+ readonly cache_control?: {
1274
+ readonly type: "ephemeral";
1275
+ readonly ttl?: string | undefined;
1276
+ } | undefined;
1277
+ }[];
1267
1278
  } | {
1268
1279
  readonly [x: string]: unknown;
1280
+ readonly role: "assistant";
1269
1281
  readonly content: string | readonly {
1270
1282
  readonly type: "text";
1271
1283
  readonly text: string;
@@ -1274,73 +1286,61 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
1274
1286
  readonly ttl?: string | undefined;
1275
1287
  } | undefined;
1276
1288
  }[] | null;
1277
- readonly role: "assistant";
1278
- readonly reasoning?: string | undefined;
1279
- readonly reasoning_content?: string | undefined;
1280
- readonly reasoning_text?: string | undefined;
1281
1289
  readonly tool_calls?: readonly {
1290
+ readonly id: string;
1291
+ readonly type: "function";
1282
1292
  readonly function: {
1283
1293
  readonly name: string;
1284
1294
  readonly arguments: string;
1285
1295
  };
1286
- readonly id: string;
1287
- readonly type: "function";
1288
1296
  readonly extra_content?: {
1289
1297
  readonly google: {
1290
1298
  readonly thought_signature: string;
1291
1299
  };
1292
1300
  } | undefined;
1293
1301
  }[] | undefined;
1302
+ readonly reasoning_content?: string | undefined;
1303
+ readonly reasoning?: string | undefined;
1304
+ readonly reasoning_text?: string | undefined;
1294
1305
  readonly reasoning_details?: unknown;
1295
- } | {
1296
- readonly role: "tool";
1297
- readonly tool_call_id: string;
1298
- readonly content: string | readonly {
1299
- readonly type: "text";
1300
- readonly text: string;
1301
- readonly cache_control?: {
1302
- readonly type: "ephemeral";
1303
- readonly ttl?: string | undefined;
1304
- } | undefined;
1305
- }[];
1306
1306
  })[];
1307
- readonly stream: true;
1308
- readonly max_completion_tokens?: number | undefined;
1309
- readonly max_tokens?: number | undefined;
1310
- readonly temperature?: number | undefined;
1311
1307
  readonly tools?: readonly {
1308
+ readonly type: "function";
1312
1309
  readonly function: {
1313
- readonly description: string;
1314
1310
  readonly name: string;
1311
+ readonly description: string;
1315
1312
  readonly parameters: {
1316
1313
  readonly [x: string]: unknown;
1317
1314
  };
1318
1315
  readonly strict?: boolean | undefined;
1319
1316
  };
1320
- readonly type: "function";
1321
1317
  readonly cache_control?: {
1322
1318
  readonly type: "ephemeral";
1323
1319
  readonly ttl?: string | undefined;
1324
1320
  } | undefined;
1325
1321
  }[] | undefined;
1326
- readonly stop?: readonly string[] | undefined;
1327
- readonly seed?: number | undefined;
1328
- readonly tool_choice?: "required" | "auto" | "none" | {
1322
+ readonly tool_choice?: "auto" | "none" | "required" | {
1329
1323
  readonly type: "function";
1330
1324
  readonly function: {
1331
1325
  readonly name: string;
1332
1326
  };
1333
1327
  } | undefined;
1334
- readonly top_p?: number | undefined;
1335
- readonly frequency_penalty?: number | undefined;
1336
- readonly presence_penalty?: number | undefined;
1337
- readonly store?: boolean | undefined;
1338
- readonly prompt_cache_key?: string | undefined;
1339
- readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
1328
+ readonly stream: true;
1340
1329
  readonly stream_options?: {
1341
1330
  readonly include_usage: boolean;
1342
1331
  } | undefined;
1332
+ readonly store?: boolean | undefined;
1333
+ readonly prompt_cache_key?: string | undefined;
1334
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
1343
1335
  readonly tool_stream?: boolean | undefined;
1336
+ readonly max_completion_tokens?: number | undefined;
1337
+ readonly max_tokens?: number | undefined;
1338
+ readonly temperature?: number | undefined;
1339
+ readonly top_p?: number | undefined;
1340
+ readonly frequency_penalty?: number | undefined;
1341
+ readonly presence_penalty?: number | undefined;
1342
+ readonly seed?: number | undefined;
1343
+ readonly stop?: readonly string[] | undefined;
1344
1344
  }, string>;
1345
1345
  export declare const route: Route<{
1346
1346
  readonly model: string;
@@ -1386,8 +1386,20 @@ export declare const route: Route<{
1386
1386
  readonly file_data: string;
1387
1387
  };
1388
1388
  })[];
1389
+ } | {
1390
+ readonly role: "tool";
1391
+ readonly tool_call_id: string;
1392
+ readonly content: string | readonly {
1393
+ readonly type: "text";
1394
+ readonly text: string;
1395
+ readonly cache_control?: {
1396
+ readonly type: "ephemeral";
1397
+ readonly ttl?: string | undefined;
1398
+ } | undefined;
1399
+ }[];
1389
1400
  } | {
1390
1401
  readonly [x: string]: unknown;
1402
+ readonly role: "assistant";
1391
1403
  readonly content: string | readonly {
1392
1404
  readonly type: "text";
1393
1405
  readonly text: string;
@@ -1396,72 +1408,60 @@ export declare const route: Route<{
1396
1408
  readonly ttl?: string | undefined;
1397
1409
  } | undefined;
1398
1410
  }[] | null;
1399
- readonly role: "assistant";
1400
- readonly reasoning?: string | undefined;
1401
- readonly reasoning_content?: string | undefined;
1402
- readonly reasoning_text?: string | undefined;
1403
1411
  readonly tool_calls?: readonly {
1412
+ readonly id: string;
1413
+ readonly type: "function";
1404
1414
  readonly function: {
1405
1415
  readonly name: string;
1406
1416
  readonly arguments: string;
1407
1417
  };
1408
- readonly id: string;
1409
- readonly type: "function";
1410
1418
  readonly extra_content?: {
1411
1419
  readonly google: {
1412
1420
  readonly thought_signature: string;
1413
1421
  };
1414
1422
  } | undefined;
1415
1423
  }[] | undefined;
1424
+ readonly reasoning_content?: string | undefined;
1425
+ readonly reasoning?: string | undefined;
1426
+ readonly reasoning_text?: string | undefined;
1416
1427
  readonly reasoning_details?: unknown;
1417
- } | {
1418
- readonly role: "tool";
1419
- readonly tool_call_id: string;
1420
- readonly content: string | readonly {
1421
- readonly type: "text";
1422
- readonly text: string;
1423
- readonly cache_control?: {
1424
- readonly type: "ephemeral";
1425
- readonly ttl?: string | undefined;
1426
- } | undefined;
1427
- }[];
1428
1428
  })[];
1429
- readonly stream: true;
1430
- readonly max_completion_tokens?: number | undefined;
1431
- readonly max_tokens?: number | undefined;
1432
- readonly temperature?: number | undefined;
1433
1429
  readonly tools?: readonly {
1430
+ readonly type: "function";
1434
1431
  readonly function: {
1435
- readonly description: string;
1436
1432
  readonly name: string;
1433
+ readonly description: string;
1437
1434
  readonly parameters: {
1438
1435
  readonly [x: string]: unknown;
1439
1436
  };
1440
1437
  readonly strict?: boolean | undefined;
1441
1438
  };
1442
- readonly type: "function";
1443
1439
  readonly cache_control?: {
1444
1440
  readonly type: "ephemeral";
1445
1441
  readonly ttl?: string | undefined;
1446
1442
  } | undefined;
1447
1443
  }[] | undefined;
1448
- readonly stop?: readonly string[] | undefined;
1449
- readonly seed?: number | undefined;
1450
- readonly tool_choice?: "required" | "auto" | "none" | {
1444
+ readonly tool_choice?: "auto" | "none" | "required" | {
1451
1445
  readonly type: "function";
1452
1446
  readonly function: {
1453
1447
  readonly name: string;
1454
1448
  };
1455
1449
  } | undefined;
1456
- readonly top_p?: number | undefined;
1457
- readonly frequency_penalty?: number | undefined;
1458
- readonly presence_penalty?: number | undefined;
1459
- readonly store?: boolean | undefined;
1460
- readonly prompt_cache_key?: string | undefined;
1461
- readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
1450
+ readonly stream: true;
1462
1451
  readonly stream_options?: {
1463
1452
  readonly include_usage: boolean;
1464
1453
  } | undefined;
1454
+ readonly store?: boolean | undefined;
1455
+ readonly prompt_cache_key?: string | undefined;
1456
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
1465
1457
  readonly tool_stream?: boolean | undefined;
1458
+ readonly max_completion_tokens?: number | undefined;
1459
+ readonly max_tokens?: number | undefined;
1460
+ readonly temperature?: number | undefined;
1461
+ readonly top_p?: number | undefined;
1462
+ readonly frequency_penalty?: number | undefined;
1463
+ readonly presence_penalty?: number | undefined;
1464
+ readonly seed?: number | undefined;
1465
+ readonly stop?: readonly string[] | undefined;
1466
1466
  }, HttpTransport.HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
1467
1467
  export * as OpenAIChat from "./openai-chat.js";