@opencode/ai 2.0.21 → 2.0.23

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 (113) hide show
  1. package/README.md +61 -1
  2. package/dist/cache-policy.js +10 -2
  3. package/dist/llm.d.ts +4 -0
  4. package/dist/promise.d.ts +8 -0
  5. package/dist/protocols/alibaba-chat.d.ts +7 -3
  6. package/dist/protocols/alibaba-chat.js +2 -1
  7. package/dist/protocols/alibaba-responses.d.ts +16 -12
  8. package/dist/protocols/alibaba-responses.js +3 -5
  9. package/dist/protocols/anthropic-messages.js +58 -51
  10. package/dist/protocols/bedrock-converse.js +33 -4
  11. package/dist/protocols/cartesia-speech.js +3 -3
  12. package/dist/protocols/cohere-chat.d.ts +178 -0
  13. package/dist/protocols/cohere-chat.js +299 -0
  14. package/dist/protocols/elevenlabs-speech.js +3 -3
  15. package/dist/protocols/gemini.d.ts +2 -2
  16. package/dist/protocols/gemini.js +3 -3
  17. package/dist/protocols/google-interactions.d.ts +236 -0
  18. package/dist/protocols/google-interactions.js +478 -0
  19. package/dist/protocols/google-speech.js +1 -1
  20. package/dist/protocols/google-transcription.js +1 -1
  21. package/dist/protocols/index.d.ts +2 -0
  22. package/dist/protocols/index.js +2 -0
  23. package/dist/protocols/meta-responses.d.ts +31 -58
  24. package/dist/protocols/meta-responses.js +8 -27
  25. package/dist/protocols/mistral-chat.d.ts +24 -9
  26. package/dist/protocols/mistral-chat.js +22 -10
  27. package/dist/protocols/open-responses.d.ts +410 -91
  28. package/dist/protocols/open-responses.js +25 -15
  29. package/dist/protocols/openai-chat.d.ts +409 -5
  30. package/dist/protocols/openai-chat.js +27 -26
  31. package/dist/protocols/openai-compatible-chat.d.ts +1 -1
  32. package/dist/protocols/openai-compatible-responses.d.ts +16 -4
  33. package/dist/protocols/openai-images.js +2 -2
  34. package/dist/protocols/openai-responses.d.ts +87 -223
  35. package/dist/protocols/openai-responses.js +10 -16
  36. package/dist/protocols/openai-speech.js +1 -1
  37. package/dist/protocols/openai-transcription.js +1 -1
  38. package/dist/protocols/shared.js +2 -2
  39. package/dist/protocols/stability-images.js +1 -1
  40. package/dist/protocols/utils/bedrock-media.js +2 -2
  41. package/dist/protocols/utils/cache.d.ts +5 -0
  42. package/dist/protocols/utils/cache.js +9 -1
  43. package/dist/protocols/utils/responses-checkpoint.js +2 -2
  44. package/dist/protocols/utils/responses-hosted-tools.js +1 -1
  45. package/dist/protocols/utils/tool-stream.d.ts +12 -0
  46. package/dist/protocols/utils/tool-stream.js +15 -7
  47. package/dist/protocols/venice-chat.d.ts +280 -0
  48. package/dist/protocols/venice-chat.js +283 -0
  49. package/dist/protocols/xai-responses.d.ts +18 -21
  50. package/dist/protocols/xai-responses.js +2 -8
  51. package/dist/protocols/zai-chat.d.ts +7 -3
  52. package/dist/protocols/zai-chat.js +6 -3
  53. package/dist/provider-error.js +27 -7
  54. package/dist/providers/alibaba.d.ts +17 -13
  55. package/dist/providers/amazon-bedrock/mantle/messages.d.ts +2 -0
  56. package/dist/providers/amazon-bedrock/mantle/messages.js +1 -0
  57. package/dist/providers/amazon-bedrock-mantle.d.ts +301 -9
  58. package/dist/providers/amazon-bedrock-mantle.js +28 -3
  59. package/dist/providers/azure.d.ts +13 -61
  60. package/dist/providers/baseten.d.ts +2 -2
  61. package/dist/providers/cerebras.d.ts +2 -2
  62. package/dist/providers/cloudflare-ai-gateway.d.ts +14 -62
  63. package/dist/providers/cloudflare-workers-ai.d.ts +2 -2
  64. package/dist/providers/cohere/chat.d.ts +4 -0
  65. package/dist/providers/cohere/chat.js +8 -0
  66. package/dist/providers/cohere.d.ts +395 -0
  67. package/dist/providers/cohere.js +48 -0
  68. package/dist/providers/deepinfra.d.ts +2 -2
  69. package/dist/providers/deepseek.d.ts +2 -2
  70. package/dist/providers/digitalocean.d.ts +469 -0
  71. package/dist/providers/digitalocean.js +53 -0
  72. package/dist/providers/fireworks.d.ts +2 -2
  73. package/dist/providers/google/interactions.d.ts +7 -0
  74. package/dist/providers/google/interactions.js +8 -0
  75. package/dist/providers/google-vertex-chat.d.ts +1 -1
  76. package/dist/providers/google-vertex-messages.js +1 -1
  77. package/dist/providers/google-vertex-responses.d.ts +16 -4
  78. package/dist/providers/google-vertex.d.ts +1 -1
  79. package/dist/providers/google.d.ts +95 -4
  80. package/dist/providers/google.js +8 -1
  81. package/dist/providers/groq.d.ts +8 -4
  82. package/dist/providers/groq.js +1 -1
  83. package/dist/providers/index.d.ts +3 -0
  84. package/dist/providers/index.js +3 -0
  85. package/dist/providers/meta.d.ts +15 -28
  86. package/dist/providers/minimax.d.ts +17 -5
  87. package/dist/providers/mistral.d.ts +10 -4
  88. package/dist/providers/moonshot.d.ts +17 -5
  89. package/dist/providers/openai-compatible-responses.d.ts +16 -4
  90. package/dist/providers/openai-compatible.d.ts +1 -1
  91. package/dist/providers/openai-options.d.ts +1 -1
  92. package/dist/providers/openai.d.ts +7 -31
  93. package/dist/providers/openrouter.d.ts +9 -5
  94. package/dist/providers/openrouter.js +1 -13
  95. package/dist/providers/togetherai.d.ts +2 -2
  96. package/dist/providers/venice.d.ts +183 -0
  97. package/dist/providers/venice.js +38 -0
  98. package/dist/providers/xai.d.ts +1 -1
  99. package/dist/providers/zai-coding-plan.d.ts +17 -5
  100. package/dist/providers/zai.d.ts +1 -1
  101. package/dist/route/client.d.ts +4 -0
  102. package/dist/route/client.js +2 -5
  103. package/dist/route/executor.js +13 -6
  104. package/dist/route/framing.js +23 -23
  105. package/dist/route/transport/http.d.ts +2 -1
  106. package/dist/route/transport/http.js +28 -6
  107. package/dist/schema/events.d.ts +176 -0
  108. package/dist/schema/events.js +4 -0
  109. package/dist/schema/options.d.ts +11 -0
  110. package/dist/schema/options.js +15 -2
  111. package/dist/testing.d.ts +32 -0
  112. package/dist/tool-history.js +17 -3
  113. package/package.json +3 -3
@@ -0,0 +1,236 @@
1
+ import { Schema } from "effect";
2
+ import { Route } from "../route/client.js";
3
+ import { Protocol } from "../route/protocol.js";
4
+ import { Lifecycle } from "./utils/lifecycle.js";
5
+ import { ToolStream } from "./utils/tool-stream.js";
6
+ export declare const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
7
+ declare const Options: Schema.Struct<{
8
+ readonly previousInteractionId: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.String>, never>>;
9
+ readonly store: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.Boolean>, never>>;
10
+ readonly thinkingLevel: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.declare<import("../schema/options.js").OpenString<"minimal" | "low" | "medium" | "high">, import("../schema/options.js").OpenString<"minimal" | "low" | "medium" | "high">>>, never>>;
11
+ readonly thinkingSummaries: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.declare<import("../schema/options.js").OpenString<"auto" | "none">, import("../schema/options.js").OpenString<"auto" | "none">>>, never>>;
12
+ readonly serviceTier: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.declare<import("../schema/options.js").OpenString<"standard" | "flex" | "priority">, import("../schema/options.js").OpenString<"standard" | "flex" | "priority">>>, never>>;
13
+ }>;
14
+ export type OptionsInput = typeof Options.Encoded;
15
+ export type ProviderOptionsInput = OptionsInput;
16
+ declare const OutputStep: Schema.Struct<{
17
+ readonly type: Schema.String;
18
+ readonly id: Schema.optional<Schema.String>;
19
+ readonly name: Schema.optional<Schema.String>;
20
+ readonly arguments: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
21
+ readonly signature: Schema.optional<Schema.String>;
22
+ readonly summary: Schema.optional<Schema.$Array<Schema.Struct<{
23
+ readonly type: Schema.Literal<"text">;
24
+ readonly text: Schema.String;
25
+ }>>>;
26
+ readonly content: Schema.optional<Schema.$Array<Schema.Struct<{
27
+ readonly type: Schema.String;
28
+ readonly text: Schema.optional<Schema.String>;
29
+ }>>>;
30
+ }>;
31
+ type OutputStep = typeof OutputStep.Type;
32
+ interface ParserState {
33
+ readonly route: string;
34
+ readonly metadataKey: string;
35
+ readonly lifecycle: Lifecycle.State;
36
+ readonly steps: Partial<Record<number, OutputStep>>;
37
+ readonly tools: ToolStream.State<number>;
38
+ readonly completed: boolean;
39
+ }
40
+ export declare const protocol: Protocol<{
41
+ readonly input: readonly ({
42
+ readonly type: "user_input" | "model_output";
43
+ readonly content: readonly ({
44
+ readonly type: "text";
45
+ readonly text: string;
46
+ } | {
47
+ readonly type: "image" | "document" | "video" | "audio";
48
+ readonly mime_type: string;
49
+ readonly data?: string | undefined;
50
+ readonly uri?: string | undefined;
51
+ })[];
52
+ } | {
53
+ readonly type: "thought";
54
+ readonly summary?: readonly {
55
+ readonly type: "text";
56
+ readonly text: string;
57
+ }[] | undefined;
58
+ readonly signature?: string | undefined;
59
+ } | {
60
+ readonly id: string;
61
+ readonly type: "function_call";
62
+ readonly name: string;
63
+ readonly arguments: unknown;
64
+ readonly signature?: string | undefined;
65
+ } | {
66
+ readonly type: "function_result";
67
+ readonly name: string;
68
+ readonly result: unknown;
69
+ readonly call_id: string;
70
+ readonly is_error?: boolean | undefined;
71
+ })[];
72
+ readonly model: string;
73
+ readonly stream: true;
74
+ readonly store: boolean;
75
+ readonly generation_config: {
76
+ readonly temperature?: number | undefined;
77
+ readonly seed?: number | undefined;
78
+ readonly tool_choice?: "auto" | "none" | "any" | {
79
+ readonly allowed_tools: {
80
+ readonly mode: "any";
81
+ readonly tools: readonly string[];
82
+ };
83
+ } | undefined;
84
+ readonly top_p?: number | undefined;
85
+ readonly stop_sequences?: readonly string[] | undefined;
86
+ readonly max_output_tokens?: number | undefined;
87
+ readonly thinking_level?: import("../schema/options.js").OpenString<"minimal" | "low" | "medium" | "high"> | undefined;
88
+ readonly thinking_summaries?: string | undefined;
89
+ };
90
+ readonly tools?: readonly {
91
+ readonly type: "function";
92
+ readonly name: string;
93
+ readonly description: string;
94
+ readonly parameters: {
95
+ readonly [x: string]: unknown;
96
+ };
97
+ }[] | undefined;
98
+ readonly service_tier?: string | undefined;
99
+ readonly previous_interaction_id?: string | undefined;
100
+ readonly system_instruction?: string | undefined;
101
+ }, string, {
102
+ readonly event_type: "step.start";
103
+ readonly index: number;
104
+ readonly step: {
105
+ readonly type: string;
106
+ readonly id?: string | undefined;
107
+ readonly name?: string | undefined;
108
+ readonly summary?: readonly {
109
+ readonly type: "text";
110
+ readonly text: string;
111
+ }[] | undefined;
112
+ readonly content?: readonly {
113
+ readonly type: string;
114
+ readonly text?: string | undefined;
115
+ }[] | undefined;
116
+ readonly signature?: string | undefined;
117
+ readonly arguments?: {
118
+ readonly [x: string]: unknown;
119
+ } | undefined;
120
+ };
121
+ } | {
122
+ readonly event_type: "step.delta";
123
+ readonly index: number;
124
+ readonly delta: {
125
+ readonly type: "text";
126
+ readonly text: string;
127
+ } | {
128
+ readonly type: "arguments_delta";
129
+ readonly arguments: string;
130
+ } | {
131
+ readonly type: "thought_signature";
132
+ readonly signature: string;
133
+ } | {
134
+ readonly type: "thought_summary";
135
+ readonly content: {
136
+ readonly type: "text";
137
+ readonly text: string;
138
+ };
139
+ } | {
140
+ readonly type: string;
141
+ };
142
+ } | {
143
+ readonly event_type: "step.stop";
144
+ readonly index: number;
145
+ } | {
146
+ readonly event_type: "interaction.created";
147
+ readonly interaction: {
148
+ readonly id?: string | undefined;
149
+ };
150
+ } | {
151
+ readonly status: string;
152
+ readonly event_type: "interaction.status_update";
153
+ readonly interaction_id?: string | undefined;
154
+ } | {
155
+ readonly event_type: "interaction.completed";
156
+ readonly interaction: {
157
+ readonly [x: string]: unknown;
158
+ readonly status: string;
159
+ readonly id?: string | undefined;
160
+ readonly usage?: {
161
+ readonly [x: string]: unknown;
162
+ readonly total_input_tokens?: number | null | undefined;
163
+ readonly total_cached_tokens?: number | null | undefined;
164
+ readonly total_output_tokens?: number | null | undefined;
165
+ readonly total_thought_tokens?: number | null | undefined;
166
+ readonly total_tokens?: number | null | undefined;
167
+ readonly raw_prompt_token?: number | null | undefined;
168
+ } | undefined;
169
+ };
170
+ } | {
171
+ readonly event_type: "error";
172
+ readonly error: unknown;
173
+ }, ParserState>;
174
+ export declare const route: Route<{
175
+ readonly input: readonly ({
176
+ readonly type: "user_input" | "model_output";
177
+ readonly content: readonly ({
178
+ readonly type: "text";
179
+ readonly text: string;
180
+ } | {
181
+ readonly type: "image" | "document" | "video" | "audio";
182
+ readonly mime_type: string;
183
+ readonly data?: string | undefined;
184
+ readonly uri?: string | undefined;
185
+ })[];
186
+ } | {
187
+ readonly type: "thought";
188
+ readonly summary?: readonly {
189
+ readonly type: "text";
190
+ readonly text: string;
191
+ }[] | undefined;
192
+ readonly signature?: string | undefined;
193
+ } | {
194
+ readonly id: string;
195
+ readonly type: "function_call";
196
+ readonly name: string;
197
+ readonly arguments: unknown;
198
+ readonly signature?: string | undefined;
199
+ } | {
200
+ readonly type: "function_result";
201
+ readonly name: string;
202
+ readonly result: unknown;
203
+ readonly call_id: string;
204
+ readonly is_error?: boolean | undefined;
205
+ })[];
206
+ readonly model: string;
207
+ readonly stream: true;
208
+ readonly store: boolean;
209
+ readonly generation_config: {
210
+ readonly temperature?: number | undefined;
211
+ readonly seed?: number | undefined;
212
+ readonly tool_choice?: "auto" | "none" | "any" | {
213
+ readonly allowed_tools: {
214
+ readonly mode: "any";
215
+ readonly tools: readonly string[];
216
+ };
217
+ } | undefined;
218
+ readonly top_p?: number | undefined;
219
+ readonly stop_sequences?: readonly string[] | undefined;
220
+ readonly max_output_tokens?: number | undefined;
221
+ readonly thinking_level?: import("../schema/options.js").OpenString<"minimal" | "low" | "medium" | "high"> | undefined;
222
+ readonly thinking_summaries?: string | undefined;
223
+ };
224
+ readonly tools?: readonly {
225
+ readonly type: "function";
226
+ readonly name: string;
227
+ readonly description: string;
228
+ readonly parameters: {
229
+ readonly [x: string]: unknown;
230
+ };
231
+ }[] | undefined;
232
+ readonly service_tier?: string | undefined;
233
+ readonly previous_interaction_id?: string | undefined;
234
+ readonly system_instruction?: string | undefined;
235
+ }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
236
+ export * as GoogleInteractions from "./google-interactions.js";