@opencode-ai/ai 0.0.0-next-16255 → 0.0.0-next-16274

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 (42) hide show
  1. package/dist/llm.d.ts +60 -60
  2. package/dist/protocols/anthropic-messages.d.ts +303 -303
  3. package/dist/protocols/anthropic-messages.js +1 -0
  4. package/dist/protocols/bedrock-converse.d.ts +246 -242
  5. package/dist/protocols/gemini.d.ts +136 -132
  6. package/dist/protocols/gemini.js +1 -0
  7. package/dist/protocols/open-responses.d.ts +232 -232
  8. package/dist/protocols/openai-chat.d.ts +147 -141
  9. package/dist/protocols/openai-chat.js +1 -0
  10. package/dist/protocols/openai-compatible-chat.d.ts +48 -46
  11. package/dist/protocols/openai-compatible-responses.d.ts +56 -56
  12. package/dist/protocols/openai-responses.d.ts +388 -388
  13. package/dist/protocols/shared.d.ts +5 -4
  14. package/dist/protocols/shared.js +1 -0
  15. package/dist/protocols/utils/bedrock-media.d.ts +10 -10
  16. package/dist/protocols/utils/tool-stream.d.ts +180 -180
  17. package/dist/providers/amazon-bedrock.d.ts +109 -107
  18. package/dist/providers/anthropic-compatible.d.ts +145 -145
  19. package/dist/providers/anthropic.d.ts +145 -145
  20. package/dist/providers/azure.d.ts +112 -110
  21. package/dist/providers/cloudflare.d.ts +144 -138
  22. package/dist/providers/github-copilot.d.ts +112 -110
  23. package/dist/providers/google-vertex-chat.d.ts +48 -46
  24. package/dist/providers/google-vertex-messages.d.ts +145 -146
  25. package/dist/providers/google-vertex-responses.d.ts +56 -56
  26. package/dist/providers/google-vertex.d.ts +52 -50
  27. package/dist/providers/google.d.ts +52 -50
  28. package/dist/providers/openai-compatible-responses.d.ts +56 -56
  29. package/dist/providers/openai-compatible.d.ts +48 -46
  30. package/dist/providers/openai.d.ts +176 -174
  31. package/dist/providers/openrouter.d.ts +147 -141
  32. package/dist/providers/xai.d.ts +112 -110
  33. package/dist/route/client.d.ts +60 -60
  34. package/dist/schema/errors.d.ts +2 -6
  35. package/dist/schema/errors.js +2 -5
  36. package/dist/schema/events.d.ts +1117 -1115
  37. package/dist/schema/messages.d.ts +9 -9
  38. package/dist/schema/messages.js +3 -4
  39. package/dist/tool-runtime.js +1 -1
  40. package/dist/tool.d.ts +5 -4
  41. package/dist/tool.js +1 -0
  42. package/package.json +5 -5
@@ -146,92 +146,92 @@ export declare function make<Body, Frame, Event, State>(input: MakeInput<Body, F
146
146
  export declare const prepare: <Body = unknown>(request: LLMRequest) => Effect.Effect<PreparedRequestOf<Body>, LLMError>;
147
147
  export declare function stream(request: LLMRequest): Stream.Stream<LLMEvent, LLMError>;
148
148
  export declare function generate(request: LLMRequest): Effect.Effect<LLMResponse, LLMError>;
149
- export declare const streamRequest: (request: LLMRequest) => Stream.Stream<Schema.Struct.ReadonlySide<{
150
- readonly type: Schema.tag<"step-start">;
151
- readonly index: Schema.Number;
152
- }, "Type"> | {
153
- readonly type: "text-start";
149
+ export declare const streamRequest: (request: LLMRequest) => Stream.Stream<{
150
+ readonly type: "step-start";
151
+ readonly index: number;
152
+ } | {
154
153
  readonly id: string;
154
+ readonly type: "text-start";
155
155
  readonly providerMetadata?: {
156
156
  readonly [x: string]: {
157
157
  readonly [x: string]: unknown;
158
158
  };
159
159
  } | undefined;
160
160
  } | {
161
+ readonly id: string;
161
162
  readonly type: "text-delta";
162
163
  readonly text: string;
163
- readonly id: string;
164
164
  readonly providerMetadata?: {
165
165
  readonly [x: string]: {
166
166
  readonly [x: string]: unknown;
167
167
  };
168
168
  } | undefined;
169
169
  } | {
170
- readonly type: "text-end";
171
170
  readonly id: string;
171
+ readonly type: "text-end";
172
172
  readonly providerMetadata?: {
173
173
  readonly [x: string]: {
174
174
  readonly [x: string]: unknown;
175
175
  };
176
176
  } | undefined;
177
177
  } | {
178
- readonly type: "reasoning-start";
179
178
  readonly id: string;
179
+ readonly type: "reasoning-start";
180
180
  readonly providerMetadata?: {
181
181
  readonly [x: string]: {
182
182
  readonly [x: string]: unknown;
183
183
  };
184
184
  } | undefined;
185
185
  } | {
186
+ readonly id: string;
186
187
  readonly type: "reasoning-delta";
187
188
  readonly text: string;
188
- readonly id: string;
189
189
  readonly providerMetadata?: {
190
190
  readonly [x: string]: {
191
191
  readonly [x: string]: unknown;
192
192
  };
193
193
  } | undefined;
194
194
  } | {
195
- readonly type: "reasoning-end";
196
195
  readonly id: string;
196
+ readonly type: "reasoning-end";
197
197
  readonly providerMetadata?: {
198
198
  readonly [x: string]: {
199
199
  readonly [x: string]: unknown;
200
200
  };
201
201
  } | undefined;
202
202
  } | {
203
+ readonly id: string;
203
204
  readonly type: "tool-input-start";
204
205
  readonly name: string;
205
- readonly id: string;
206
206
  readonly providerMetadata?: {
207
207
  readonly [x: string]: {
208
208
  readonly [x: string]: unknown;
209
209
  };
210
210
  } | undefined;
211
211
  readonly providerExecuted?: boolean | undefined;
212
- } | Schema.Struct.ReadonlySide<{
213
- readonly type: Schema.tag<"tool-input-delta">;
214
- readonly id: Schema.String;
215
- readonly name: Schema.String;
216
- readonly text: Schema.String;
217
- }, "Type"> | {
218
- readonly type: "tool-input-end";
212
+ } | {
213
+ readonly type: "tool-input-delta";
214
+ readonly id: string;
219
215
  readonly name: string;
216
+ readonly text: string;
217
+ } | {
220
218
  readonly id: string;
219
+ readonly type: "tool-input-end";
220
+ readonly name: string;
221
221
  readonly providerMetadata?: {
222
222
  readonly [x: string]: {
223
223
  readonly [x: string]: unknown;
224
224
  };
225
225
  } | undefined;
226
- } | Schema.Struct.ReadonlySide<{
227
- readonly type: Schema.tag<"tool-input-error">;
228
- readonly id: Schema.String;
229
- readonly name: Schema.String;
230
- readonly raw: Schema.String;
231
- }, "Type"> | {
232
- readonly type: "tool-call";
226
+ } | {
227
+ readonly type: "tool-input-error";
228
+ readonly id: string;
233
229
  readonly name: string;
230
+ readonly raw: string;
231
+ } | {
234
232
  readonly id: string;
233
+ readonly type: "tool-call";
234
+ readonly name: string;
235
235
  readonly input: unknown;
236
236
  readonly providerMetadata?: {
237
237
  readonly [x: string]: {
@@ -240,52 +240,52 @@ export declare const streamRequest: (request: LLMRequest) => Stream.Stream<Schem
240
240
  } | undefined;
241
241
  readonly providerExecuted?: boolean | undefined;
242
242
  } | {
243
+ readonly id: string;
243
244
  readonly type: "tool-result";
244
245
  readonly name: string;
245
- readonly id: string;
246
- readonly result: Schema.Struct.ReadonlySide<{
247
- readonly type: Schema.Literal<"json">;
248
- readonly value: Schema.Unknown;
249
- }, "Type"> | Schema.Struct.ReadonlySide<{
250
- readonly type: Schema.Literal<"text">;
251
- readonly value: Schema.Unknown;
252
- }, "Type"> | Schema.Struct.ReadonlySide<{
253
- readonly type: Schema.Literal<"error">;
254
- readonly value: Schema.Unknown;
255
- }, "Type"> | Schema.Struct.ReadonlySide<{
256
- readonly type: Schema.Literal<"content">;
257
- readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
258
- readonly type: Schema.Literal<"text">;
259
- readonly text: Schema.String;
260
- }>, Schema.Struct<{
261
- readonly type: Schema.Literal<"file">;
262
- readonly uri: Schema.String;
263
- readonly mime: Schema.String;
264
- readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
265
- }>]>>;
266
- }, "Type">;
246
+ readonly result: {
247
+ readonly type: "json";
248
+ readonly value: unknown;
249
+ } | {
250
+ readonly type: "text";
251
+ readonly value: unknown;
252
+ } | {
253
+ readonly type: "error";
254
+ readonly value: unknown;
255
+ } | {
256
+ readonly type: "content";
257
+ readonly value: readonly ({
258
+ readonly type: "text";
259
+ readonly text: string;
260
+ } | {
261
+ readonly type: "file";
262
+ readonly uri: string;
263
+ readonly mime: string;
264
+ readonly name?: string | undefined;
265
+ })[];
266
+ };
267
+ readonly output?: {
268
+ readonly structured: unknown;
269
+ readonly content: readonly ({
270
+ readonly type: "text";
271
+ readonly text: string;
272
+ } | {
273
+ readonly type: "file";
274
+ readonly uri: string;
275
+ readonly mime: string;
276
+ readonly name?: string | undefined;
277
+ })[];
278
+ } | undefined;
267
279
  readonly providerMetadata?: {
268
280
  readonly [x: string]: {
269
281
  readonly [x: string]: unknown;
270
282
  };
271
283
  } | undefined;
272
284
  readonly providerExecuted?: boolean | undefined;
273
- readonly output?: Schema.Struct.ReadonlySide<{
274
- readonly structured: Schema.Unknown;
275
- readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
276
- readonly type: Schema.Literal<"text">;
277
- readonly text: Schema.String;
278
- }>, Schema.Struct<{
279
- readonly type: Schema.Literal<"file">;
280
- readonly uri: Schema.String;
281
- readonly mime: Schema.String;
282
- readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
283
- }>]>>;
284
- }, "Type"> | undefined;
285
285
  } | {
286
+ readonly id: string;
286
287
  readonly type: "tool-error";
287
288
  readonly name: string;
288
- readonly id: string;
289
289
  readonly message: string;
290
290
  readonly error?: unknown;
291
291
  readonly providerMetadata?: {
@@ -1,4 +1,5 @@
1
1
  import { Schema } from "effect";
2
+ import { Tool } from "@opencode-ai/schema/tool";
2
3
  export declare const ProviderFailureClassification: Schema.Literal<"context-overflow">;
3
4
  export type ProviderFailureClassification = typeof ProviderFailureClassification.Type;
4
5
  declare const HttpRequestDetails_base: Schema.Class<HttpRequestDetails, Schema.Struct<{
@@ -134,11 +135,6 @@ export declare class LLMError extends LLMError_base {
134
135
  readonly cause: InvalidRequestReason | NoRouteReason | AuthenticationReason | RateLimitReason | QuotaExceededReason | ContentPolicyReason | ProviderInternalReason | TransportReason | InvalidProviderOutputReason | UnknownProviderReason;
135
136
  get message(): string;
136
137
  }
137
- declare const ToolFailure_base: Schema.Class<ToolFailure, Schema.TaggedStruct<"LLM.ToolFailure", {
138
- readonly message: Schema.String;
139
- readonly error: Schema.optional<Schema.Defect>;
140
- readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
141
- }>, import("effect/Cause").YieldableError>;
142
138
  /**
143
139
  * Failure type for tool execute handlers. Handlers must map their internal
144
140
  * errors to this shape; the runtime catches `ToolFailure`s and surfaces them
@@ -148,6 +144,6 @@ declare const ToolFailure_base: Schema.Class<ToolFailure, Schema.TaggedStruct<"L
148
144
  * Anything thrown or yielded by a handler that is not a `ToolFailure` is
149
145
  * treated as a defect and fails the stream.
150
146
  */
151
- export declare class ToolFailure extends ToolFailure_base {
147
+ export declare class ToolFailure extends Tool.Error {
152
148
  }
153
149
  export {};
@@ -1,4 +1,5 @@
1
1
  import { Schema } from "effect";
2
+ import { Tool } from "@opencode-ai/schema/tool";
2
3
  import { ModelID, ProviderID, ProviderMetadata, RouteID } from "./ids";
3
4
  export const ProviderFailureClassification = Schema.Literal("context-overflow");
4
5
  export class HttpRequestDetails extends Schema.Class("LLM.HttpRequestDetails")({
@@ -142,9 +143,5 @@ export class LLMError extends Schema.TaggedErrorClass()("LLM.Error", {
142
143
  * Anything thrown or yielded by a handler that is not a `ToolFailure` is
143
144
  * treated as a defect and fails the stream.
144
145
  */
145
- export class ToolFailure extends Schema.TaggedErrorClass()("LLM.ToolFailure", {
146
- message: Schema.String,
147
- error: Schema.optional(Schema.Defect()),
148
- metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
149
- }) {
146
+ export class ToolFailure extends Tool.Error {
150
147
  }