@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
package/dist/llm.d.ts CHANGED
@@ -24,32 +24,20 @@ export declare class GenerateObjectResponse<T> {
24
24
  readonly object: T;
25
25
  readonly response: LLMResponse;
26
26
  constructor(object: T, response: LLMResponse);
27
- get events(): readonly (({
28
- readonly type: "compaction";
29
- readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
30
- readonly id?: string | undefined;
31
- readonly text?: string | null | undefined;
32
- readonly encrypted?: string | undefined;
33
- } & ({
34
- readonly encrypted: string;
35
- readonly text?: never;
36
- } | {
37
- readonly text: string | null;
38
- readonly encrypted?: never;
39
- })) | {
27
+ get events(): readonly ({
40
28
  readonly type: "step-start";
41
29
  readonly index: number;
42
30
  } | {
43
- readonly id: string;
44
31
  readonly type: "text-start";
32
+ readonly id: string;
45
33
  readonly providerMetadata?: {
46
34
  readonly [x: string]: {
47
35
  readonly [x: string]: unknown;
48
36
  };
49
37
  } | undefined;
50
38
  } | {
51
- readonly id: string;
52
39
  readonly type: "text-delta";
40
+ readonly id: string;
53
41
  readonly text: string;
54
42
  readonly providerMetadata?: {
55
43
  readonly [x: string]: {
@@ -57,8 +45,8 @@ export declare class GenerateObjectResponse<T> {
57
45
  };
58
46
  } | undefined;
59
47
  } | {
60
- readonly id: string;
61
48
  readonly type: "text-end";
49
+ readonly id: string;
62
50
  readonly text?: string | undefined;
63
51
  readonly providerMetadata?: {
64
52
  readonly [x: string]: {
@@ -66,16 +54,16 @@ export declare class GenerateObjectResponse<T> {
66
54
  };
67
55
  } | undefined;
68
56
  } | {
69
- readonly id: string;
70
57
  readonly type: "reasoning-start";
58
+ readonly id: string;
71
59
  readonly providerMetadata?: {
72
60
  readonly [x: string]: {
73
61
  readonly [x: string]: unknown;
74
62
  };
75
63
  } | undefined;
76
64
  } | {
77
- readonly id: string;
78
65
  readonly type: "reasoning-delta";
66
+ readonly id: string;
79
67
  readonly text: string;
80
68
  readonly providerMetadata?: {
81
69
  readonly [x: string]: {
@@ -83,8 +71,8 @@ export declare class GenerateObjectResponse<T> {
83
71
  };
84
72
  } | undefined;
85
73
  } | {
86
- readonly id: string;
87
74
  readonly type: "reasoning-end";
75
+ readonly id: string;
88
76
  readonly text?: string | undefined;
89
77
  readonly providerMetadata?: {
90
78
  readonly [x: string]: {
@@ -92,55 +80,56 @@ export declare class GenerateObjectResponse<T> {
92
80
  };
93
81
  } | undefined;
94
82
  } | {
95
- readonly id: string;
96
83
  readonly type: "tool-input-start";
84
+ readonly id: string;
97
85
  readonly name: string;
86
+ readonly namespace?: string | undefined;
87
+ readonly providerExecuted?: boolean | undefined;
98
88
  readonly providerMetadata?: {
99
89
  readonly [x: string]: {
100
90
  readonly [x: string]: unknown;
101
91
  };
102
92
  } | undefined;
103
- readonly namespace?: string | undefined;
104
- readonly providerExecuted?: boolean | undefined;
105
93
  } | {
106
- readonly id: string;
107
94
  readonly type: "tool-input-delta";
95
+ readonly id: string;
108
96
  readonly name: string;
97
+ readonly namespace?: string | undefined;
109
98
  readonly text: string;
110
99
  readonly input?: unknown;
111
- readonly namespace?: string | undefined;
112
100
  } | {
113
- readonly id: string;
114
101
  readonly type: "tool-input-end";
102
+ readonly id: string;
115
103
  readonly name: string;
104
+ readonly namespace?: string | undefined;
116
105
  readonly providerMetadata?: {
117
106
  readonly [x: string]: {
118
107
  readonly [x: string]: unknown;
119
108
  };
120
109
  } | undefined;
121
- readonly namespace?: string | undefined;
122
110
  } | {
123
- readonly id: string;
124
111
  readonly type: "tool-input-error";
112
+ readonly id: string;
125
113
  readonly name: string;
126
- readonly raw: string;
127
114
  readonly namespace?: string | undefined;
115
+ readonly raw: string;
128
116
  } | {
129
- readonly id: string;
130
117
  readonly type: "tool-call";
118
+ readonly id: string;
131
119
  readonly name: string;
120
+ readonly namespace?: string | undefined;
132
121
  readonly input: unknown;
122
+ readonly providerExecuted?: boolean | undefined;
133
123
  readonly providerMetadata?: {
134
124
  readonly [x: string]: {
135
125
  readonly [x: string]: unknown;
136
126
  };
137
127
  } | undefined;
138
- readonly namespace?: string | undefined;
139
- readonly providerExecuted?: boolean | undefined;
140
128
  } | {
141
- readonly id: string;
142
129
  readonly type: "tool-result";
130
+ readonly id: string;
143
131
  readonly name: string;
132
+ readonly namespace?: string | undefined;
144
133
  readonly result: {
145
134
  readonly type: "json";
146
135
  readonly value: unknown;
@@ -174,28 +163,19 @@ export declare class GenerateObjectResponse<T> {
174
163
  readonly name?: string | undefined;
175
164
  })[];
176
165
  } | undefined;
166
+ readonly providerExecuted?: boolean | undefined;
177
167
  readonly providerMetadata?: {
178
168
  readonly [x: string]: {
179
169
  readonly [x: string]: unknown;
180
170
  };
181
171
  } | undefined;
182
- readonly namespace?: string | undefined;
183
- readonly providerExecuted?: boolean | undefined;
184
172
  } | {
185
- readonly id: string;
186
173
  readonly type: "tool-error";
187
- readonly message: string;
174
+ readonly id: string;
188
175
  readonly name: string;
189
- readonly error?: unknown;
190
- readonly providerMetadata?: {
191
- readonly [x: string]: {
192
- readonly [x: string]: unknown;
193
- };
194
- } | undefined;
195
176
  readonly namespace?: string | undefined;
196
- } | {
197
- readonly type: "media";
198
- readonly media: import("./media.js").Asset;
177
+ readonly message: string;
178
+ readonly error?: unknown;
199
179
  readonly providerMetadata?: {
200
180
  readonly [x: string]: {
201
181
  readonly [x: string]: unknown;
@@ -203,33 +183,41 @@ export declare class GenerateObjectResponse<T> {
203
183
  } | undefined;
204
184
  } | {
205
185
  readonly type: "step-finish";
186
+ readonly index: number;
206
187
  readonly reason: {
207
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
188
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
208
189
  readonly raw?: string | undefined;
209
190
  readonly category?: string | undefined;
210
191
  readonly explanation?: string | undefined;
211
192
  };
212
- readonly index: number;
193
+ readonly usage?: import("./schema/events.js").Usage | undefined;
213
194
  readonly providerMetadata?: {
214
195
  readonly [x: string]: {
215
196
  readonly [x: string]: unknown;
216
197
  };
217
198
  } | undefined;
218
- readonly usage?: import("./schema/events.js").Usage | undefined;
219
199
  } | {
220
200
  readonly type: "finish";
221
201
  readonly reason: {
222
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
202
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
223
203
  readonly raw?: string | undefined;
224
204
  readonly category?: string | undefined;
225
205
  readonly explanation?: string | undefined;
226
206
  };
207
+ readonly usage?: import("./schema/events.js").Usage | undefined;
208
+ readonly providerMetadata?: {
209
+ readonly [x: string]: {
210
+ readonly [x: string]: unknown;
211
+ };
212
+ } | undefined;
213
+ } | {
214
+ readonly type: "media";
215
+ readonly media: import("./media.js").Asset;
227
216
  readonly providerMetadata?: {
228
217
  readonly [x: string]: {
229
218
  readonly [x: string]: unknown;
230
219
  };
231
220
  } | undefined;
232
- readonly usage?: import("./schema/events.js").Usage | undefined;
233
221
  } | {
234
222
  readonly type: "provider-error";
235
223
  readonly message: string;
@@ -239,7 +227,19 @@ export declare class GenerateObjectResponse<T> {
239
227
  readonly [x: string]: unknown;
240
228
  };
241
229
  } | undefined;
242
- })[];
230
+ } | ({
231
+ readonly type: "compaction";
232
+ readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
233
+ readonly id?: string | undefined;
234
+ readonly encrypted?: string | undefined;
235
+ readonly text?: string | null | undefined;
236
+ } & ({
237
+ readonly encrypted: string;
238
+ readonly text?: never;
239
+ } | {
240
+ readonly text: string | null;
241
+ readonly encrypted?: never;
242
+ })))[];
243
243
  get usage(): import("./schema/events.js").Usage | undefined;
244
244
  }
245
245
  export interface GenerateObjectOptions<S extends ToolSchema<any>, SelectedLanguageModel extends LanguageModel = LanguageModel> extends GenerateObjectBase<SelectedLanguageModel> {
@@ -23,7 +23,7 @@ export declare const make: <Self, Req extends RoutedRequest<Req, Event, Response
23
23
  }) => {
24
24
  layer: Layer.Layer<Self, never, import("./route/executor-service.js").RequestExecutorService>;
25
25
  generate: (request: Req, options?: AwaitOptions) => Effect.Effect<Response, AIError, Self>;
26
- stream: (request: Req, options?: AwaitOptions) => Stream.Stream<Observation | Event, AIError, Exclude<Self, import("effect/Scope").Scope>>;
26
+ stream: (request: Req, options?: AwaitOptions) => Stream.Stream<Event | Observation, AIError, Exclude<Self, import("effect/Scope").Scope>>;
27
27
  start: (request: Req) => Effect.Effect<Generation<Response>, AIError, Self>;
28
28
  resume: (model: Req["model"], token: unknown) => Effect.Effect<Generation<Response>, AIError, Self>;
29
29
  };
package/dist/media.d.ts CHANGED
@@ -89,23 +89,23 @@ export declare class Asset {
89
89
  readonly mediaType?: string | undefined;
90
90
  readonly expiresAt?: number | undefined;
91
91
  } | {
92
- readonly id: string;
93
92
  readonly type: "ref";
94
93
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
94
+ readonly id: string;
95
95
  readonly mediaType?: string | undefined;
96
96
  } | {
97
- data: string;
98
97
  type: "bytes";
99
98
  mediaType: string;
99
+ data: string;
100
100
  };
101
101
  info: {
102
- readonly format?: string | undefined;
103
- readonly encoding?: string | undefined;
104
102
  readonly width?: number | undefined;
105
103
  readonly height?: number | undefined;
106
104
  readonly durationSeconds?: number | undefined;
107
105
  readonly sampleRate?: number | undefined;
108
106
  readonly channels?: number | undefined;
107
+ readonly encoding?: string | undefined;
108
+ readonly format?: string | undefined;
109
109
  } | undefined;
110
110
  providerMetadata: {
111
111
  readonly [x: string]: {