@opencode/ai 2.2.3 → 2.2.4
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.
- package/README.md +75 -76
- package/dist/effect.d.ts +45 -3
- package/dist/effect.js +24 -3
- package/dist/index.d.ts +468 -1158
- package/dist/index.js +22 -20
- package/dist/llm.d.ts +2 -1
- package/dist/llm.js +2 -0
- package/dist/protocols/xai-responses.js +1 -1
- package/dist/route/client.d.ts +0 -2
- package/dist/route/client.js +1 -5
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AIClient } from "./ai-client.js";
|
|
|
3
3
|
import { type DecisionModel, type DecisionQuestions, type DecisionRequestInput } from "./decision.js";
|
|
4
4
|
import type { AwaitOptions, Event, Snapshot } from "./generation.js";
|
|
5
5
|
import { type ImageModel, type ImageRequest, type ImageRequestInput } from "./image.js";
|
|
6
|
-
import { LLM } from "./
|
|
6
|
+
import { LLM } from "./llm.js";
|
|
7
7
|
import { Media } from "./media.js";
|
|
8
8
|
import { type CheckpointRequest, type CompactionRequest, type EndpointCompactOptions, type StreamOptions, type TriggerCompactOptions } from "./route/client.js";
|
|
9
9
|
import { RequestExecutor } from "./route/executor.js";
|
|
@@ -56,1168 +56,462 @@ export declare const make: <R = never>(options?: Options<R>) => {
|
|
|
56
56
|
file: (path: string, options?: Media.AssetOptions & RunOptions) => Promise<Media.Asset>;
|
|
57
57
|
/** Write an asset's bytes like `Media.write`, downloading `url` sources through the executor. */
|
|
58
58
|
write: (asset: Media.Asset, path: string, options?: RunOptions) => Promise<void>;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
readonly
|
|
72
|
-
readonly [x: string]:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
readonly
|
|
81
|
-
readonly [x: string]:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
readonly
|
|
90
|
-
readonly [x: string]:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
readonly
|
|
98
|
-
readonly [x: string]:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
readonly
|
|
107
|
-
readonly [x: string]:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
readonly
|
|
116
|
-
readonly [x: string]:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
readonly
|
|
127
|
-
readonly [x: string]:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
readonly
|
|
144
|
-
readonly [x: string]:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
readonly
|
|
162
|
-
readonly [x: string]:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
readonly
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
readonly value: readonly ({
|
|
183
|
-
readonly type: "text";
|
|
184
|
-
readonly text: string;
|
|
185
|
-
} | {
|
|
186
|
-
readonly type: "file";
|
|
187
|
-
readonly uri: string;
|
|
188
|
-
readonly mime: string;
|
|
189
|
-
readonly name?: string | undefined;
|
|
190
|
-
})[];
|
|
191
|
-
};
|
|
192
|
-
readonly output?: {
|
|
193
|
-
readonly structured: unknown;
|
|
194
|
-
readonly content: readonly ({
|
|
195
|
-
readonly type: "text";
|
|
196
|
-
readonly text: string;
|
|
197
|
-
} | {
|
|
198
|
-
readonly type: "file";
|
|
199
|
-
readonly uri: string;
|
|
200
|
-
readonly mime: string;
|
|
201
|
-
readonly name?: string | undefined;
|
|
202
|
-
})[];
|
|
203
|
-
} | undefined;
|
|
204
|
-
readonly providerExecuted?: boolean | undefined;
|
|
205
|
-
readonly providerMetadata?: {
|
|
206
|
-
readonly [x: string]: {
|
|
207
|
-
readonly [x: string]: unknown;
|
|
208
|
-
};
|
|
209
|
-
} | undefined;
|
|
210
|
-
} | {
|
|
211
|
-
readonly type: "tool-error";
|
|
212
|
-
readonly id: string;
|
|
213
|
-
readonly name: string;
|
|
214
|
-
readonly namespace?: string | undefined;
|
|
215
|
-
readonly message: string;
|
|
216
|
-
readonly error?: unknown;
|
|
217
|
-
readonly providerMetadata?: {
|
|
218
|
-
readonly [x: string]: {
|
|
219
|
-
readonly [x: string]: unknown;
|
|
220
|
-
};
|
|
221
|
-
} | undefined;
|
|
222
|
-
} | {
|
|
223
|
-
readonly type: "step-finish";
|
|
224
|
-
readonly index: number;
|
|
225
|
-
readonly reason: {
|
|
226
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
227
|
-
readonly raw?: string | undefined;
|
|
228
|
-
readonly category?: string | undefined;
|
|
229
|
-
readonly explanation?: string | undefined;
|
|
230
|
-
};
|
|
231
|
-
readonly usage?: import("./effect.js").Usage | undefined;
|
|
232
|
-
readonly providerMetadata?: {
|
|
233
|
-
readonly [x: string]: {
|
|
234
|
-
readonly [x: string]: unknown;
|
|
235
|
-
};
|
|
236
|
-
} | undefined;
|
|
237
|
-
} | {
|
|
238
|
-
readonly type: "finish";
|
|
239
|
-
readonly reason: {
|
|
240
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
241
|
-
readonly raw?: string | undefined;
|
|
242
|
-
readonly category?: string | undefined;
|
|
243
|
-
readonly explanation?: string | undefined;
|
|
244
|
-
};
|
|
245
|
-
readonly usage?: import("./effect.js").Usage | undefined;
|
|
246
|
-
readonly providerMetadata?: {
|
|
247
|
-
readonly [x: string]: {
|
|
248
|
-
readonly [x: string]: unknown;
|
|
249
|
-
};
|
|
250
|
-
} | undefined;
|
|
251
|
-
} | {
|
|
252
|
-
readonly type: "media";
|
|
253
|
-
readonly media: Media.Asset;
|
|
254
|
-
readonly providerMetadata?: {
|
|
255
|
-
readonly [x: string]: {
|
|
256
|
-
readonly [x: string]: unknown;
|
|
257
|
-
};
|
|
258
|
-
} | undefined;
|
|
259
|
-
} | {
|
|
260
|
-
readonly type: "provider-error";
|
|
261
|
-
readonly message: string;
|
|
262
|
-
readonly classification?: "context-overflow" | "payload-too-large" | undefined;
|
|
263
|
-
readonly providerMetadata?: {
|
|
264
|
-
readonly [x: string]: {
|
|
265
|
-
readonly [x: string]: unknown;
|
|
266
|
-
};
|
|
267
|
-
} | undefined;
|
|
268
|
-
} | ({
|
|
269
|
-
readonly type: "compaction";
|
|
270
|
-
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
271
|
-
readonly id?: string | undefined;
|
|
272
|
-
readonly encrypted?: string | undefined;
|
|
273
|
-
readonly text?: string | null | undefined;
|
|
274
|
-
} & ({
|
|
275
|
-
readonly encrypted: string;
|
|
276
|
-
readonly text?: never;
|
|
277
|
-
} | {
|
|
278
|
-
readonly text: string | null;
|
|
279
|
-
readonly encrypted?: never;
|
|
280
|
-
}))>;
|
|
281
|
-
/** Stream model calls, running their tool calls, until the model stops calling tools or `until` is true. */
|
|
282
|
-
loop: <const Model extends LanguageModel>(input: LoopInput<Model>, options?: StreamOptions & RunOptions) => AsyncIterable<{
|
|
283
|
-
readonly type: "step-start";
|
|
284
|
-
readonly index: number;
|
|
285
|
-
} | {
|
|
286
|
-
readonly type: "raw";
|
|
287
|
-
readonly data: unknown;
|
|
288
|
-
} | {
|
|
289
|
-
readonly type: "text-start";
|
|
290
|
-
readonly id: string;
|
|
291
|
-
readonly providerMetadata?: {
|
|
292
|
-
readonly [x: string]: {
|
|
293
|
-
readonly [x: string]: unknown;
|
|
294
|
-
};
|
|
295
|
-
} | undefined;
|
|
296
|
-
} | {
|
|
297
|
-
readonly type: "text-delta";
|
|
298
|
-
readonly id: string;
|
|
299
|
-
readonly text: string;
|
|
300
|
-
readonly providerMetadata?: {
|
|
301
|
-
readonly [x: string]: {
|
|
302
|
-
readonly [x: string]: unknown;
|
|
303
|
-
};
|
|
304
|
-
} | undefined;
|
|
305
|
-
} | {
|
|
306
|
-
readonly type: "text-end";
|
|
307
|
-
readonly id: string;
|
|
308
|
-
readonly text?: string | undefined;
|
|
309
|
-
readonly providerMetadata?: {
|
|
310
|
-
readonly [x: string]: {
|
|
311
|
-
readonly [x: string]: unknown;
|
|
312
|
-
};
|
|
313
|
-
} | undefined;
|
|
314
|
-
} | {
|
|
315
|
-
readonly type: "reasoning-start";
|
|
316
|
-
readonly id: string;
|
|
317
|
-
readonly providerMetadata?: {
|
|
318
|
-
readonly [x: string]: {
|
|
319
|
-
readonly [x: string]: unknown;
|
|
320
|
-
};
|
|
321
|
-
} | undefined;
|
|
322
|
-
} | {
|
|
323
|
-
readonly type: "reasoning-delta";
|
|
324
|
-
readonly id: string;
|
|
325
|
-
readonly text: string;
|
|
326
|
-
readonly providerMetadata?: {
|
|
327
|
-
readonly [x: string]: {
|
|
328
|
-
readonly [x: string]: unknown;
|
|
329
|
-
};
|
|
330
|
-
} | undefined;
|
|
331
|
-
} | {
|
|
332
|
-
readonly type: "reasoning-end";
|
|
333
|
-
readonly id: string;
|
|
334
|
-
readonly text?: string | undefined;
|
|
335
|
-
readonly providerMetadata?: {
|
|
336
|
-
readonly [x: string]: {
|
|
337
|
-
readonly [x: string]: unknown;
|
|
338
|
-
};
|
|
339
|
-
} | undefined;
|
|
340
|
-
} | {
|
|
341
|
-
readonly type: "tool-input-start";
|
|
342
|
-
readonly id: string;
|
|
343
|
-
readonly name: string;
|
|
344
|
-
readonly namespace?: string | undefined;
|
|
345
|
-
readonly providerExecuted?: boolean | undefined;
|
|
346
|
-
readonly providerMetadata?: {
|
|
347
|
-
readonly [x: string]: {
|
|
348
|
-
readonly [x: string]: unknown;
|
|
349
|
-
};
|
|
350
|
-
} | undefined;
|
|
351
|
-
} | {
|
|
352
|
-
readonly type: "tool-input-delta";
|
|
353
|
-
readonly id: string;
|
|
354
|
-
readonly name: string;
|
|
355
|
-
readonly namespace?: string | undefined;
|
|
356
|
-
readonly text: string;
|
|
357
|
-
readonly input?: unknown;
|
|
358
|
-
} | {
|
|
359
|
-
readonly type: "tool-input-end";
|
|
360
|
-
readonly id: string;
|
|
361
|
-
readonly name: string;
|
|
362
|
-
readonly namespace?: string | undefined;
|
|
363
|
-
readonly providerMetadata?: {
|
|
364
|
-
readonly [x: string]: {
|
|
365
|
-
readonly [x: string]: unknown;
|
|
366
|
-
};
|
|
367
|
-
} | undefined;
|
|
368
|
-
} | {
|
|
369
|
-
readonly type: "tool-input-error";
|
|
370
|
-
readonly id: string;
|
|
371
|
-
readonly name: string;
|
|
372
|
-
readonly namespace?: string | undefined;
|
|
373
|
-
readonly raw: string;
|
|
374
|
-
} | {
|
|
375
|
-
readonly type: "tool-call";
|
|
376
|
-
readonly id: string;
|
|
377
|
-
readonly name: string;
|
|
378
|
-
readonly namespace?: string | undefined;
|
|
379
|
-
readonly input: unknown;
|
|
380
|
-
readonly providerExecuted?: boolean | undefined;
|
|
381
|
-
readonly providerMetadata?: {
|
|
382
|
-
readonly [x: string]: {
|
|
383
|
-
readonly [x: string]: unknown;
|
|
384
|
-
};
|
|
385
|
-
} | undefined;
|
|
386
|
-
} | {
|
|
387
|
-
readonly type: "tool-result";
|
|
388
|
-
readonly id: string;
|
|
389
|
-
readonly name: string;
|
|
390
|
-
readonly namespace?: string | undefined;
|
|
391
|
-
readonly result: {
|
|
392
|
-
readonly type: "json";
|
|
393
|
-
readonly value: unknown;
|
|
394
|
-
} | {
|
|
395
|
-
readonly type: "text";
|
|
396
|
-
readonly value: unknown;
|
|
397
|
-
} | {
|
|
398
|
-
readonly type: "error";
|
|
399
|
-
readonly value: unknown;
|
|
400
|
-
} | {
|
|
401
|
-
readonly type: "content";
|
|
402
|
-
readonly value: readonly ({
|
|
403
|
-
readonly type: "text";
|
|
404
|
-
readonly text: string;
|
|
405
|
-
} | {
|
|
406
|
-
readonly type: "file";
|
|
407
|
-
readonly uri: string;
|
|
408
|
-
readonly mime: string;
|
|
409
|
-
readonly name?: string | undefined;
|
|
410
|
-
})[];
|
|
411
|
-
};
|
|
412
|
-
readonly output?: {
|
|
413
|
-
readonly structured: unknown;
|
|
414
|
-
readonly content: readonly ({
|
|
415
|
-
readonly type: "text";
|
|
416
|
-
readonly text: string;
|
|
417
|
-
} | {
|
|
418
|
-
readonly type: "file";
|
|
419
|
-
readonly uri: string;
|
|
420
|
-
readonly mime: string;
|
|
421
|
-
readonly name?: string | undefined;
|
|
422
|
-
})[];
|
|
423
|
-
} | undefined;
|
|
424
|
-
readonly providerExecuted?: boolean | undefined;
|
|
425
|
-
readonly providerMetadata?: {
|
|
426
|
-
readonly [x: string]: {
|
|
427
|
-
readonly [x: string]: unknown;
|
|
428
|
-
};
|
|
429
|
-
} | undefined;
|
|
430
|
-
} | {
|
|
431
|
-
readonly type: "tool-error";
|
|
432
|
-
readonly id: string;
|
|
433
|
-
readonly name: string;
|
|
434
|
-
readonly namespace?: string | undefined;
|
|
435
|
-
readonly message: string;
|
|
436
|
-
readonly error?: unknown;
|
|
437
|
-
readonly providerMetadata?: {
|
|
438
|
-
readonly [x: string]: {
|
|
439
|
-
readonly [x: string]: unknown;
|
|
440
|
-
};
|
|
441
|
-
} | undefined;
|
|
442
|
-
} | {
|
|
443
|
-
readonly type: "step-finish";
|
|
444
|
-
readonly index: number;
|
|
445
|
-
readonly reason: {
|
|
446
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
447
|
-
readonly raw?: string | undefined;
|
|
448
|
-
readonly category?: string | undefined;
|
|
449
|
-
readonly explanation?: string | undefined;
|
|
450
|
-
};
|
|
451
|
-
readonly usage?: import("./effect.js").Usage | undefined;
|
|
452
|
-
readonly providerMetadata?: {
|
|
453
|
-
readonly [x: string]: {
|
|
454
|
-
readonly [x: string]: unknown;
|
|
455
|
-
};
|
|
456
|
-
} | undefined;
|
|
457
|
-
} | {
|
|
458
|
-
readonly type: "finish";
|
|
459
|
-
readonly reason: {
|
|
460
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
461
|
-
readonly raw?: string | undefined;
|
|
462
|
-
readonly category?: string | undefined;
|
|
463
|
-
readonly explanation?: string | undefined;
|
|
464
|
-
};
|
|
465
|
-
readonly usage?: import("./effect.js").Usage | undefined;
|
|
466
|
-
readonly providerMetadata?: {
|
|
467
|
-
readonly [x: string]: {
|
|
468
|
-
readonly [x: string]: unknown;
|
|
469
|
-
};
|
|
470
|
-
} | undefined;
|
|
471
|
-
} | {
|
|
472
|
-
readonly type: "media";
|
|
473
|
-
readonly media: Media.Asset;
|
|
474
|
-
readonly providerMetadata?: {
|
|
475
|
-
readonly [x: string]: {
|
|
476
|
-
readonly [x: string]: unknown;
|
|
477
|
-
};
|
|
478
|
-
} | undefined;
|
|
479
|
-
} | {
|
|
480
|
-
readonly type: "provider-error";
|
|
481
|
-
readonly message: string;
|
|
482
|
-
readonly classification?: "context-overflow" | "payload-too-large" | undefined;
|
|
483
|
-
readonly providerMetadata?: {
|
|
484
|
-
readonly [x: string]: {
|
|
485
|
-
readonly [x: string]: unknown;
|
|
486
|
-
};
|
|
487
|
-
} | undefined;
|
|
488
|
-
} | ({
|
|
489
|
-
readonly type: "compaction";
|
|
490
|
-
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
491
|
-
readonly id?: string | undefined;
|
|
492
|
-
readonly encrypted?: string | undefined;
|
|
493
|
-
readonly text?: string | null | undefined;
|
|
494
|
-
} & ({
|
|
495
|
-
readonly encrypted: string;
|
|
496
|
-
readonly text?: never;
|
|
497
|
-
} | {
|
|
498
|
-
readonly text: string | null;
|
|
499
|
-
readonly encrypted?: never;
|
|
500
|
-
}))>;
|
|
501
|
-
/** Decode the model's output against `schema` (or `jsonSchema`, unvalidated) like `LLM.generateObject`. */
|
|
502
|
-
generateObject: {
|
|
503
|
-
<const Model extends LanguageModel, S extends ToolSchema<any>>(input: GenerateObjectOptions<S, Model>, options?: RunOptions): Promise<GenerateObjectResponse<Schema.Schema.Type<S>>>;
|
|
504
|
-
<const Model extends LanguageModel>(input: GenerateObjectDynamicOptions<Model>, options?: RunOptions): Promise<GenerateObjectResponse<unknown>>;
|
|
505
|
-
};
|
|
506
|
-
/** Compact a Responses request like `LLMClient.compact`: a replacement window, or a checkpoint with `mechanism: "trigger"`. */
|
|
507
|
-
compact: {
|
|
508
|
-
(request: CheckpointRequest, options: TriggerCompactOptions & RunOptions): Promise<CompactionCheckpointResponse>;
|
|
509
|
-
(request: CompactionRequest, options?: EndpointCompactOptions & RunOptions): Promise<CompactionResponse>;
|
|
510
|
-
};
|
|
511
|
-
canCompact: typeof import("./route/client.js").canCompact;
|
|
512
|
-
};
|
|
513
|
-
image: {
|
|
514
|
-
request: typeof import("./image.js").request;
|
|
515
|
-
generate: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: AwaitOptions & RunOptions) => Promise<import("./image.js").ImageResponse>;
|
|
516
|
-
stream: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
|
|
517
|
-
readonly type: "image-partial";
|
|
518
|
-
readonly index: number;
|
|
519
|
-
readonly image: Media.Asset;
|
|
520
|
-
} | {
|
|
521
|
-
readonly type: "image";
|
|
522
|
-
readonly index: number;
|
|
523
|
-
readonly image: Media.Asset;
|
|
524
|
-
} | {
|
|
525
|
-
readonly type: "generation-queued";
|
|
526
|
-
readonly id: string;
|
|
527
|
-
readonly position?: number | undefined;
|
|
528
|
-
} | {
|
|
529
|
-
readonly type: "generation-progress";
|
|
530
|
-
readonly id: string;
|
|
531
|
-
readonly progress?: number | undefined;
|
|
532
|
-
} | {
|
|
533
|
-
readonly type: "finish";
|
|
534
|
-
readonly usage?: {
|
|
535
|
-
readonly type: "seconds";
|
|
536
|
-
readonly seconds: number;
|
|
537
|
-
} | {
|
|
538
|
-
readonly type: "characters";
|
|
539
|
-
readonly characters: number;
|
|
540
|
-
} | {
|
|
541
|
-
readonly type: "credits";
|
|
542
|
-
readonly credits: number;
|
|
543
|
-
} | {
|
|
544
|
-
readonly type: "compute";
|
|
545
|
-
readonly seconds: number;
|
|
546
|
-
} | {
|
|
547
|
-
readonly type: "tokens";
|
|
548
|
-
readonly input?: number | undefined;
|
|
549
|
-
readonly output?: number | undefined;
|
|
550
|
-
readonly total?: number | undefined;
|
|
551
|
-
readonly details?: {
|
|
552
|
-
readonly [x: string]: unknown;
|
|
553
|
-
} | undefined;
|
|
554
|
-
} | undefined;
|
|
555
|
-
readonly providerMetadata?: {
|
|
556
|
-
readonly [x: string]: {
|
|
557
|
-
readonly [x: string]: unknown;
|
|
558
|
-
};
|
|
559
|
-
} | undefined;
|
|
560
|
-
}>;
|
|
561
|
-
start: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: RunOptions) => Promise<GenerationHandle<import("./image.js").ImageResponse>>;
|
|
562
|
-
resume: (model: ImageModel, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./image.js").ImageResponse>>;
|
|
563
|
-
};
|
|
564
|
-
decision: {
|
|
565
|
-
request: typeof import("./decision.js").request;
|
|
566
|
-
generate: <const Model extends DecisionModel, const Questions extends DecisionQuestions>(input: DecisionRequestInput<Model, Questions>, options?: RunOptions) => Promise<import("./decision.js").DecisionResponseFor<Questions>>;
|
|
567
|
-
};
|
|
568
|
-
/** Experimental: may change without compatibility guarantees. */
|
|
569
|
-
experimental: {
|
|
570
|
-
speech: {
|
|
571
|
-
request: typeof import("./speech.js").request;
|
|
572
|
-
generate: <const Model extends SpeechModel>(input: SpeechRequestInput<Model> | SpeechRequest, options?: RunOptions) => Promise<import("./speech.js").SpeechResponse>;
|
|
573
|
-
stream: <const Model extends SpeechModel>(input: SpeechRequestInput<Model> | SpeechRequest, options?: RunOptions) => AsyncIterable<{
|
|
574
|
-
readonly type: "audio-delta";
|
|
575
|
-
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
576
|
-
} | {
|
|
577
|
-
readonly type: "timestamps";
|
|
578
|
-
readonly items: readonly {
|
|
579
|
-
readonly text: string;
|
|
580
|
-
readonly startSeconds: number;
|
|
581
|
-
readonly endSeconds: number;
|
|
582
|
-
}[];
|
|
583
|
-
} | {
|
|
584
|
-
readonly type: "generation-queued";
|
|
585
|
-
readonly id: string;
|
|
586
|
-
readonly position?: number | undefined;
|
|
587
|
-
} | {
|
|
588
|
-
readonly type: "generation-progress";
|
|
589
|
-
readonly id: string;
|
|
590
|
-
readonly progress?: number | undefined;
|
|
591
|
-
} | {
|
|
592
|
-
readonly type: "finish";
|
|
593
|
-
readonly audio: Media.Asset;
|
|
594
|
-
readonly usage?: {
|
|
595
|
-
readonly type: "seconds";
|
|
596
|
-
readonly seconds: number;
|
|
597
|
-
} | {
|
|
598
|
-
readonly type: "characters";
|
|
599
|
-
readonly characters: number;
|
|
600
|
-
} | {
|
|
601
|
-
readonly type: "credits";
|
|
602
|
-
readonly credits: number;
|
|
603
|
-
} | {
|
|
604
|
-
readonly type: "compute";
|
|
605
|
-
readonly seconds: number;
|
|
606
|
-
} | {
|
|
607
|
-
readonly type: "tokens";
|
|
608
|
-
readonly input?: number | undefined;
|
|
609
|
-
readonly output?: number | undefined;
|
|
610
|
-
readonly total?: number | undefined;
|
|
611
|
-
readonly details?: {
|
|
612
|
-
readonly [x: string]: unknown;
|
|
613
|
-
} | undefined;
|
|
614
|
-
} | undefined;
|
|
615
|
-
readonly providerMetadata?: {
|
|
616
|
-
readonly [x: string]: {
|
|
617
|
-
readonly [x: string]: unknown;
|
|
618
|
-
};
|
|
619
|
-
} | undefined;
|
|
620
|
-
}>;
|
|
621
|
-
};
|
|
622
|
-
transcription: {
|
|
623
|
-
request: typeof import("./transcription.js").request;
|
|
624
|
-
generate: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: AwaitOptions & RunOptions) => Promise<import("./transcription.js").TranscriptionResponse>;
|
|
625
|
-
stream: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
|
|
626
|
-
readonly type: "text-delta";
|
|
627
|
-
readonly delta: string;
|
|
628
|
-
} | {
|
|
629
|
-
readonly type: "segment";
|
|
630
|
-
readonly segment: {
|
|
631
|
-
readonly text: string;
|
|
632
|
-
readonly startSeconds: number;
|
|
633
|
-
readonly endSeconds: number;
|
|
634
|
-
readonly speaker?: string | undefined;
|
|
635
|
-
};
|
|
636
|
-
} | {
|
|
637
|
-
readonly type: "generation-queued";
|
|
638
|
-
readonly id: string;
|
|
639
|
-
readonly position?: number | undefined;
|
|
640
|
-
} | {
|
|
641
|
-
readonly type: "generation-progress";
|
|
642
|
-
readonly id: string;
|
|
643
|
-
readonly progress?: number | undefined;
|
|
644
|
-
} | {
|
|
645
|
-
readonly text: string;
|
|
646
|
-
readonly segments?: readonly {
|
|
647
|
-
readonly text: string;
|
|
648
|
-
readonly startSeconds: number;
|
|
649
|
-
readonly endSeconds: number;
|
|
650
|
-
readonly speaker?: string | undefined;
|
|
651
|
-
}[] | undefined;
|
|
652
|
-
readonly words?: readonly {
|
|
653
|
-
readonly text: string;
|
|
654
|
-
readonly startSeconds: number;
|
|
655
|
-
readonly endSeconds: number;
|
|
656
|
-
readonly speaker?: string | undefined;
|
|
657
|
-
readonly confidence?: number | undefined;
|
|
658
|
-
}[] | undefined;
|
|
659
|
-
readonly language?: string | undefined;
|
|
660
|
-
readonly durationSeconds?: number | undefined;
|
|
661
|
-
readonly usage?: {
|
|
662
|
-
readonly type: "seconds";
|
|
663
|
-
readonly seconds: number;
|
|
664
|
-
} | {
|
|
665
|
-
readonly type: "characters";
|
|
666
|
-
readonly characters: number;
|
|
667
|
-
} | {
|
|
668
|
-
readonly type: "credits";
|
|
669
|
-
readonly credits: number;
|
|
670
|
-
} | {
|
|
671
|
-
readonly type: "compute";
|
|
672
|
-
readonly seconds: number;
|
|
673
|
-
} | {
|
|
674
|
-
readonly type: "tokens";
|
|
675
|
-
readonly input?: number | undefined;
|
|
676
|
-
readonly output?: number | undefined;
|
|
677
|
-
readonly total?: number | undefined;
|
|
678
|
-
readonly details?: {
|
|
679
|
-
readonly [x: string]: unknown;
|
|
680
|
-
} | undefined;
|
|
681
|
-
} | undefined;
|
|
682
|
-
readonly providerMetadata?: {
|
|
683
|
-
readonly [x: string]: {
|
|
684
|
-
readonly [x: string]: unknown;
|
|
685
|
-
};
|
|
686
|
-
} | undefined;
|
|
687
|
-
readonly type: "finish";
|
|
688
|
-
}>;
|
|
689
|
-
start: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: RunOptions) => Promise<GenerationHandle<import("./transcription.js").TranscriptionResponse>>;
|
|
690
|
-
resume: (model: TranscriptionModel, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./transcription.js").TranscriptionResponse>>;
|
|
691
|
-
};
|
|
692
|
-
video: {
|
|
693
|
-
request: typeof import("./video.js").request;
|
|
694
|
-
start: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: RunOptions) => Promise<GenerationHandle<import("./video.js").VideoResponse>>;
|
|
695
|
-
generate: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: AwaitOptions & RunOptions) => Promise<import("./video.js").VideoResponse>;
|
|
696
|
-
resume: (model: VideoModel, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./video.js").VideoResponse>>;
|
|
697
|
-
stream: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
|
|
698
|
-
readonly type: "video";
|
|
699
|
-
readonly index: number;
|
|
700
|
-
readonly video: Media.Asset;
|
|
701
|
-
} | {
|
|
702
|
-
readonly type: "generation-queued";
|
|
703
|
-
readonly id: string;
|
|
704
|
-
readonly position?: number | undefined;
|
|
705
|
-
} | {
|
|
706
|
-
readonly type: "generation-progress";
|
|
707
|
-
readonly id: string;
|
|
708
|
-
readonly progress?: number | undefined;
|
|
709
|
-
} | {
|
|
710
|
-
readonly type: "finish";
|
|
711
|
-
readonly usage?: {
|
|
712
|
-
readonly type: "seconds";
|
|
713
|
-
readonly seconds: number;
|
|
714
|
-
} | {
|
|
715
|
-
readonly type: "characters";
|
|
716
|
-
readonly characters: number;
|
|
717
|
-
} | {
|
|
718
|
-
readonly type: "credits";
|
|
719
|
-
readonly credits: number;
|
|
720
|
-
} | {
|
|
721
|
-
readonly type: "compute";
|
|
722
|
-
readonly seconds: number;
|
|
723
|
-
} | {
|
|
724
|
-
readonly type: "tokens";
|
|
725
|
-
readonly input?: number | undefined;
|
|
726
|
-
readonly output?: number | undefined;
|
|
727
|
-
readonly total?: number | undefined;
|
|
728
|
-
readonly details?: {
|
|
729
|
-
readonly [x: string]: unknown;
|
|
730
|
-
} | undefined;
|
|
731
|
-
} | undefined;
|
|
732
|
-
readonly providerMetadata?: {
|
|
733
|
-
readonly [x: string]: {
|
|
734
|
-
readonly [x: string]: unknown;
|
|
735
|
-
};
|
|
736
|
-
} | undefined;
|
|
737
|
-
}>;
|
|
738
|
-
};
|
|
739
|
-
};
|
|
740
|
-
dispose: () => Promise<void>;
|
|
741
|
-
};
|
|
742
|
-
export type Client<R = never> = ReturnType<typeof make<R>>;
|
|
743
|
-
/** `tool` from `@opencode/ai/effect`, with an `execute` that returns a value or a Promise and throws to fail. */
|
|
744
|
-
export declare const tool: <Parameters extends ToolSchema<any> = typeof Schema.Unknown, Success extends ToolSchema<any> = typeof Schema.Unknown, Result extends Schema.Schema.Type<Success> | PromiseLike<Schema.Schema.Type<Success>> | NoExecute = NoExecute>(config: ToolOptions<Parameters, Success, (params: Schema.Schema.Type<Parameters>, context: Partial<ToolExecuteContext> & {
|
|
745
|
-
signal: AbortSignal;
|
|
746
|
-
}) => Result>) => 0 extends 1 & Result ? import("./tool.js").ExecutableTool<Parameters, Success> : [Result, NoExecute] extends [NoExecute, Result] ? import("./tool.js").Tool<Parameters, Success> : import("./tool.js").ExecutableTool<Parameters, Success>;
|
|
747
|
-
/** Default client over `RequestExecutor.fetchLayer` for scripts; the runtime builds its layer on first use. */
|
|
748
|
-
export declare const ai: {
|
|
749
|
-
run: <A, E>(effect: Effect.Effect<A, E, import("./image-client.js").ImageClientService | import("./effect.js").LLMClientService | RequestExecutor.RequestExecutorService | import("./decision-client.js").Service | import("./speech-client.js").SpeechClientService | import("./transcription-client.js").TranscriptionClientService | import("./video-client.js").VideoClientService>, options?: RunOptions) => Promise<A>;
|
|
750
|
-
/** Decoded asset bytes, downloading `url` sources through the executor. */
|
|
751
|
-
bytes: (asset: Media.Asset, options?: RunOptions) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
752
|
-
base64: (asset: Media.Asset, options?: RunOptions) => Promise<string>;
|
|
753
|
-
/** Pull a `url` asset into owned bytes before the provider URL expires. */
|
|
754
|
-
materialize: (asset: Media.Asset, options?: RunOptions) => Promise<Media.Asset>;
|
|
755
|
-
/** Read a file into an asset like `Media.file`: sniffed media type, then the extension's. */
|
|
756
|
-
file: (path: string, options?: Media.AssetOptions & RunOptions) => Promise<Media.Asset>;
|
|
757
|
-
/** Write an asset's bytes like `Media.write`, downloading `url` sources through the executor. */
|
|
758
|
-
write: (asset: Media.Asset, path: string, options?: RunOptions) => Promise<void>;
|
|
759
|
-
llm: {
|
|
760
|
-
request: typeof LLM.request;
|
|
761
|
-
generate: <const Model extends LanguageModel>(input: LLMRequest<LanguageModel<{
|
|
762
|
-
readonly [x: string]: unknown;
|
|
763
|
-
}, import("./route/client.js").CompactionOperations | undefined>> | RequestInput<Model>, options?: StreamOptions & RunOptions) => Promise<import("./effect.js").LLMResponse>;
|
|
764
|
-
stream: <const Model extends LanguageModel>(input: LLMRequest<LanguageModel<{
|
|
765
|
-
readonly [x: string]: unknown;
|
|
766
|
-
}, import("./route/client.js").CompactionOperations | undefined>> | RequestInput<Model>, options?: StreamOptions & RunOptions) => AsyncIterable<{
|
|
767
|
-
readonly type: "step-start";
|
|
768
|
-
readonly index: number;
|
|
769
|
-
} | {
|
|
770
|
-
readonly type: "raw";
|
|
771
|
-
readonly data: unknown;
|
|
772
|
-
} | {
|
|
773
|
-
readonly type: "text-start";
|
|
774
|
-
readonly id: string;
|
|
775
|
-
readonly providerMetadata?: {
|
|
776
|
-
readonly [x: string]: {
|
|
777
|
-
readonly [x: string]: unknown;
|
|
778
|
-
};
|
|
779
|
-
} | undefined;
|
|
780
|
-
} | {
|
|
781
|
-
readonly type: "text-delta";
|
|
782
|
-
readonly id: string;
|
|
783
|
-
readonly text: string;
|
|
784
|
-
readonly providerMetadata?: {
|
|
785
|
-
readonly [x: string]: {
|
|
786
|
-
readonly [x: string]: unknown;
|
|
787
|
-
};
|
|
788
|
-
} | undefined;
|
|
789
|
-
} | {
|
|
790
|
-
readonly type: "text-end";
|
|
791
|
-
readonly id: string;
|
|
792
|
-
readonly text?: string | undefined;
|
|
793
|
-
readonly providerMetadata?: {
|
|
794
|
-
readonly [x: string]: {
|
|
795
|
-
readonly [x: string]: unknown;
|
|
796
|
-
};
|
|
797
|
-
} | undefined;
|
|
798
|
-
} | {
|
|
799
|
-
readonly type: "reasoning-start";
|
|
800
|
-
readonly id: string;
|
|
801
|
-
readonly providerMetadata?: {
|
|
802
|
-
readonly [x: string]: {
|
|
803
|
-
readonly [x: string]: unknown;
|
|
804
|
-
};
|
|
805
|
-
} | undefined;
|
|
806
|
-
} | {
|
|
807
|
-
readonly type: "reasoning-delta";
|
|
808
|
-
readonly id: string;
|
|
809
|
-
readonly text: string;
|
|
810
|
-
readonly providerMetadata?: {
|
|
811
|
-
readonly [x: string]: {
|
|
812
|
-
readonly [x: string]: unknown;
|
|
813
|
-
};
|
|
814
|
-
} | undefined;
|
|
815
|
-
} | {
|
|
816
|
-
readonly type: "reasoning-end";
|
|
817
|
-
readonly id: string;
|
|
818
|
-
readonly text?: string | undefined;
|
|
819
|
-
readonly providerMetadata?: {
|
|
820
|
-
readonly [x: string]: {
|
|
821
|
-
readonly [x: string]: unknown;
|
|
822
|
-
};
|
|
823
|
-
} | undefined;
|
|
824
|
-
} | {
|
|
825
|
-
readonly type: "tool-input-start";
|
|
826
|
-
readonly id: string;
|
|
827
|
-
readonly name: string;
|
|
828
|
-
readonly namespace?: string | undefined;
|
|
829
|
-
readonly providerExecuted?: boolean | undefined;
|
|
830
|
-
readonly providerMetadata?: {
|
|
831
|
-
readonly [x: string]: {
|
|
832
|
-
readonly [x: string]: unknown;
|
|
833
|
-
};
|
|
834
|
-
} | undefined;
|
|
835
|
-
} | {
|
|
836
|
-
readonly type: "tool-input-delta";
|
|
837
|
-
readonly id: string;
|
|
838
|
-
readonly name: string;
|
|
839
|
-
readonly namespace?: string | undefined;
|
|
840
|
-
readonly text: string;
|
|
841
|
-
readonly input?: unknown;
|
|
842
|
-
} | {
|
|
843
|
-
readonly type: "tool-input-end";
|
|
844
|
-
readonly id: string;
|
|
845
|
-
readonly name: string;
|
|
846
|
-
readonly namespace?: string | undefined;
|
|
847
|
-
readonly providerMetadata?: {
|
|
848
|
-
readonly [x: string]: {
|
|
849
|
-
readonly [x: string]: unknown;
|
|
850
|
-
};
|
|
851
|
-
} | undefined;
|
|
852
|
-
} | {
|
|
853
|
-
readonly type: "tool-input-error";
|
|
854
|
-
readonly id: string;
|
|
855
|
-
readonly name: string;
|
|
856
|
-
readonly namespace?: string | undefined;
|
|
857
|
-
readonly raw: string;
|
|
858
|
-
} | {
|
|
859
|
-
readonly type: "tool-call";
|
|
860
|
-
readonly id: string;
|
|
861
|
-
readonly name: string;
|
|
862
|
-
readonly namespace?: string | undefined;
|
|
863
|
-
readonly input: unknown;
|
|
864
|
-
readonly providerExecuted?: boolean | undefined;
|
|
865
|
-
readonly providerMetadata?: {
|
|
866
|
-
readonly [x: string]: {
|
|
867
|
-
readonly [x: string]: unknown;
|
|
868
|
-
};
|
|
869
|
-
} | undefined;
|
|
870
|
-
} | {
|
|
871
|
-
readonly type: "tool-result";
|
|
872
|
-
readonly id: string;
|
|
873
|
-
readonly name: string;
|
|
874
|
-
readonly namespace?: string | undefined;
|
|
875
|
-
readonly result: {
|
|
876
|
-
readonly type: "json";
|
|
877
|
-
readonly value: unknown;
|
|
878
|
-
} | {
|
|
59
|
+
request: typeof LLM.request;
|
|
60
|
+
generate: <const Model extends LanguageModel>(input: RequestInput<Model> | LLMRequest, options?: StreamOptions & RunOptions) => Promise<import("./index.js").LLMResponse>;
|
|
61
|
+
stream: <const Model extends LanguageModel>(input: RequestInput<Model> | LLMRequest, options?: StreamOptions & RunOptions) => AsyncIterable<{
|
|
62
|
+
readonly type: "step-start";
|
|
63
|
+
readonly index: number;
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: "raw";
|
|
66
|
+
readonly data: unknown;
|
|
67
|
+
} | {
|
|
68
|
+
readonly type: "text-start";
|
|
69
|
+
readonly id: string;
|
|
70
|
+
readonly providerMetadata?: {
|
|
71
|
+
readonly [x: string]: {
|
|
72
|
+
readonly [x: string]: unknown;
|
|
73
|
+
};
|
|
74
|
+
} | undefined;
|
|
75
|
+
} | {
|
|
76
|
+
readonly type: "text-delta";
|
|
77
|
+
readonly id: string;
|
|
78
|
+
readonly text: string;
|
|
79
|
+
readonly providerMetadata?: {
|
|
80
|
+
readonly [x: string]: {
|
|
81
|
+
readonly [x: string]: unknown;
|
|
82
|
+
};
|
|
83
|
+
} | undefined;
|
|
84
|
+
} | {
|
|
85
|
+
readonly type: "text-end";
|
|
86
|
+
readonly id: string;
|
|
87
|
+
readonly text?: string | undefined;
|
|
88
|
+
readonly providerMetadata?: {
|
|
89
|
+
readonly [x: string]: {
|
|
90
|
+
readonly [x: string]: unknown;
|
|
91
|
+
};
|
|
92
|
+
} | undefined;
|
|
93
|
+
} | {
|
|
94
|
+
readonly type: "reasoning-start";
|
|
95
|
+
readonly id: string;
|
|
96
|
+
readonly providerMetadata?: {
|
|
97
|
+
readonly [x: string]: {
|
|
98
|
+
readonly [x: string]: unknown;
|
|
99
|
+
};
|
|
100
|
+
} | undefined;
|
|
101
|
+
} | {
|
|
102
|
+
readonly type: "reasoning-delta";
|
|
103
|
+
readonly id: string;
|
|
104
|
+
readonly text: string;
|
|
105
|
+
readonly providerMetadata?: {
|
|
106
|
+
readonly [x: string]: {
|
|
107
|
+
readonly [x: string]: unknown;
|
|
108
|
+
};
|
|
109
|
+
} | undefined;
|
|
110
|
+
} | {
|
|
111
|
+
readonly type: "reasoning-end";
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly text?: string | undefined;
|
|
114
|
+
readonly providerMetadata?: {
|
|
115
|
+
readonly [x: string]: {
|
|
116
|
+
readonly [x: string]: unknown;
|
|
117
|
+
};
|
|
118
|
+
} | undefined;
|
|
119
|
+
} | {
|
|
120
|
+
readonly type: "tool-input-start";
|
|
121
|
+
readonly id: string;
|
|
122
|
+
readonly name: string;
|
|
123
|
+
readonly namespace?: string | undefined;
|
|
124
|
+
readonly providerExecuted?: boolean | undefined;
|
|
125
|
+
readonly providerMetadata?: {
|
|
126
|
+
readonly [x: string]: {
|
|
127
|
+
readonly [x: string]: unknown;
|
|
128
|
+
};
|
|
129
|
+
} | undefined;
|
|
130
|
+
} | {
|
|
131
|
+
readonly type: "tool-input-delta";
|
|
132
|
+
readonly id: string;
|
|
133
|
+
readonly name: string;
|
|
134
|
+
readonly namespace?: string | undefined;
|
|
135
|
+
readonly text: string;
|
|
136
|
+
readonly input?: unknown;
|
|
137
|
+
} | {
|
|
138
|
+
readonly type: "tool-input-end";
|
|
139
|
+
readonly id: string;
|
|
140
|
+
readonly name: string;
|
|
141
|
+
readonly namespace?: string | undefined;
|
|
142
|
+
readonly providerMetadata?: {
|
|
143
|
+
readonly [x: string]: {
|
|
144
|
+
readonly [x: string]: unknown;
|
|
145
|
+
};
|
|
146
|
+
} | undefined;
|
|
147
|
+
} | {
|
|
148
|
+
readonly type: "tool-input-error";
|
|
149
|
+
readonly id: string;
|
|
150
|
+
readonly name: string;
|
|
151
|
+
readonly namespace?: string | undefined;
|
|
152
|
+
readonly raw: string;
|
|
153
|
+
} | {
|
|
154
|
+
readonly type: "tool-call";
|
|
155
|
+
readonly id: string;
|
|
156
|
+
readonly name: string;
|
|
157
|
+
readonly namespace?: string | undefined;
|
|
158
|
+
readonly input: unknown;
|
|
159
|
+
readonly providerExecuted?: boolean | undefined;
|
|
160
|
+
readonly providerMetadata?: {
|
|
161
|
+
readonly [x: string]: {
|
|
162
|
+
readonly [x: string]: unknown;
|
|
163
|
+
};
|
|
164
|
+
} | undefined;
|
|
165
|
+
} | {
|
|
166
|
+
readonly type: "tool-result";
|
|
167
|
+
readonly id: string;
|
|
168
|
+
readonly name: string;
|
|
169
|
+
readonly namespace?: string | undefined;
|
|
170
|
+
readonly result: {
|
|
171
|
+
readonly type: "json";
|
|
172
|
+
readonly value: unknown;
|
|
173
|
+
} | {
|
|
174
|
+
readonly type: "text";
|
|
175
|
+
readonly value: unknown;
|
|
176
|
+
} | {
|
|
177
|
+
readonly type: "error";
|
|
178
|
+
readonly value: unknown;
|
|
179
|
+
} | {
|
|
180
|
+
readonly type: "content";
|
|
181
|
+
readonly value: readonly ({
|
|
879
182
|
readonly type: "text";
|
|
880
|
-
readonly
|
|
183
|
+
readonly text: string;
|
|
881
184
|
} | {
|
|
882
|
-
readonly type: "
|
|
883
|
-
readonly
|
|
185
|
+
readonly type: "file";
|
|
186
|
+
readonly uri: string;
|
|
187
|
+
readonly mime: string;
|
|
188
|
+
readonly name?: string | undefined;
|
|
189
|
+
})[];
|
|
190
|
+
};
|
|
191
|
+
readonly output?: {
|
|
192
|
+
readonly structured: unknown;
|
|
193
|
+
readonly content: readonly ({
|
|
194
|
+
readonly type: "text";
|
|
195
|
+
readonly text: string;
|
|
884
196
|
} | {
|
|
885
|
-
readonly type: "
|
|
886
|
-
readonly
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
197
|
+
readonly type: "file";
|
|
198
|
+
readonly uri: string;
|
|
199
|
+
readonly mime: string;
|
|
200
|
+
readonly name?: string | undefined;
|
|
201
|
+
})[];
|
|
202
|
+
} | undefined;
|
|
203
|
+
readonly providerExecuted?: boolean | undefined;
|
|
204
|
+
readonly providerMetadata?: {
|
|
205
|
+
readonly [x: string]: {
|
|
206
|
+
readonly [x: string]: unknown;
|
|
895
207
|
};
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
} | undefined;
|
|
908
|
-
readonly providerExecuted?: boolean | undefined;
|
|
909
|
-
readonly providerMetadata?: {
|
|
910
|
-
readonly [x: string]: {
|
|
911
|
-
readonly [x: string]: unknown;
|
|
912
|
-
};
|
|
913
|
-
} | undefined;
|
|
914
|
-
} | {
|
|
915
|
-
readonly type: "tool-error";
|
|
916
|
-
readonly id: string;
|
|
917
|
-
readonly name: string;
|
|
918
|
-
readonly namespace?: string | undefined;
|
|
919
|
-
readonly message: string;
|
|
920
|
-
readonly error?: unknown;
|
|
921
|
-
readonly providerMetadata?: {
|
|
922
|
-
readonly [x: string]: {
|
|
923
|
-
readonly [x: string]: unknown;
|
|
924
|
-
};
|
|
925
|
-
} | undefined;
|
|
926
|
-
} | {
|
|
927
|
-
readonly type: "step-finish";
|
|
928
|
-
readonly index: number;
|
|
929
|
-
readonly reason: {
|
|
930
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
931
|
-
readonly raw?: string | undefined;
|
|
932
|
-
readonly category?: string | undefined;
|
|
933
|
-
readonly explanation?: string | undefined;
|
|
208
|
+
} | undefined;
|
|
209
|
+
} | {
|
|
210
|
+
readonly type: "tool-error";
|
|
211
|
+
readonly id: string;
|
|
212
|
+
readonly name: string;
|
|
213
|
+
readonly namespace?: string | undefined;
|
|
214
|
+
readonly message: string;
|
|
215
|
+
readonly error?: unknown;
|
|
216
|
+
readonly providerMetadata?: {
|
|
217
|
+
readonly [x: string]: {
|
|
218
|
+
readonly [x: string]: unknown;
|
|
934
219
|
};
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
readonly
|
|
943
|
-
readonly
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
220
|
+
} | undefined;
|
|
221
|
+
} | {
|
|
222
|
+
readonly type: "step-finish";
|
|
223
|
+
readonly index: number;
|
|
224
|
+
readonly reason: {
|
|
225
|
+
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
226
|
+
readonly raw?: string | undefined;
|
|
227
|
+
readonly category?: string | undefined;
|
|
228
|
+
readonly explanation?: string | undefined;
|
|
229
|
+
};
|
|
230
|
+
readonly usage?: import("./index.js").Usage | undefined;
|
|
231
|
+
readonly providerMetadata?: {
|
|
232
|
+
readonly [x: string]: {
|
|
233
|
+
readonly [x: string]: unknown;
|
|
948
234
|
};
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
readonly
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
}
|
|
963
|
-
} |
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
readonly
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
}
|
|
1026
|
-
} |
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
readonly
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
readonly
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
readonly
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
readonly
|
|
1096
|
-
readonly
|
|
1097
|
-
|
|
1098
|
-
|
|
235
|
+
} | undefined;
|
|
236
|
+
} | {
|
|
237
|
+
readonly type: "finish";
|
|
238
|
+
readonly reason: {
|
|
239
|
+
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
240
|
+
readonly raw?: string | undefined;
|
|
241
|
+
readonly category?: string | undefined;
|
|
242
|
+
readonly explanation?: string | undefined;
|
|
243
|
+
};
|
|
244
|
+
readonly usage?: import("./index.js").Usage | undefined;
|
|
245
|
+
readonly providerMetadata?: {
|
|
246
|
+
readonly [x: string]: {
|
|
247
|
+
readonly [x: string]: unknown;
|
|
248
|
+
};
|
|
249
|
+
} | undefined;
|
|
250
|
+
} | {
|
|
251
|
+
readonly type: "media";
|
|
252
|
+
readonly media: Media.Asset;
|
|
253
|
+
readonly providerMetadata?: {
|
|
254
|
+
readonly [x: string]: {
|
|
255
|
+
readonly [x: string]: unknown;
|
|
256
|
+
};
|
|
257
|
+
} | undefined;
|
|
258
|
+
} | {
|
|
259
|
+
readonly type: "provider-error";
|
|
260
|
+
readonly message: string;
|
|
261
|
+
readonly classification?: "context-overflow" | "payload-too-large" | undefined;
|
|
262
|
+
readonly providerMetadata?: {
|
|
263
|
+
readonly [x: string]: {
|
|
264
|
+
readonly [x: string]: unknown;
|
|
265
|
+
};
|
|
266
|
+
} | undefined;
|
|
267
|
+
} | ({
|
|
268
|
+
readonly type: "compaction";
|
|
269
|
+
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
270
|
+
readonly id?: string | undefined;
|
|
271
|
+
readonly encrypted?: string | undefined;
|
|
272
|
+
readonly text?: string | null | undefined;
|
|
273
|
+
} & ({
|
|
274
|
+
readonly encrypted: string;
|
|
275
|
+
readonly text?: never;
|
|
276
|
+
} | {
|
|
277
|
+
readonly text: string | null;
|
|
278
|
+
readonly encrypted?: never;
|
|
279
|
+
}))>;
|
|
280
|
+
/** Stream model calls, running their tool calls, until the model stops calling tools or `until` is true. */
|
|
281
|
+
loop: <const Model extends LanguageModel>(input: LoopInput<Model>, options?: StreamOptions & RunOptions) => AsyncIterable<{
|
|
282
|
+
readonly type: "step-start";
|
|
283
|
+
readonly index: number;
|
|
284
|
+
} | {
|
|
285
|
+
readonly type: "raw";
|
|
286
|
+
readonly data: unknown;
|
|
287
|
+
} | {
|
|
288
|
+
readonly type: "text-start";
|
|
289
|
+
readonly id: string;
|
|
290
|
+
readonly providerMetadata?: {
|
|
291
|
+
readonly [x: string]: {
|
|
292
|
+
readonly [x: string]: unknown;
|
|
293
|
+
};
|
|
294
|
+
} | undefined;
|
|
295
|
+
} | {
|
|
296
|
+
readonly type: "text-delta";
|
|
297
|
+
readonly id: string;
|
|
298
|
+
readonly text: string;
|
|
299
|
+
readonly providerMetadata?: {
|
|
300
|
+
readonly [x: string]: {
|
|
301
|
+
readonly [x: string]: unknown;
|
|
302
|
+
};
|
|
303
|
+
} | undefined;
|
|
304
|
+
} | {
|
|
305
|
+
readonly type: "text-end";
|
|
306
|
+
readonly id: string;
|
|
307
|
+
readonly text?: string | undefined;
|
|
308
|
+
readonly providerMetadata?: {
|
|
309
|
+
readonly [x: string]: {
|
|
310
|
+
readonly [x: string]: unknown;
|
|
311
|
+
};
|
|
312
|
+
} | undefined;
|
|
313
|
+
} | {
|
|
314
|
+
readonly type: "reasoning-start";
|
|
315
|
+
readonly id: string;
|
|
316
|
+
readonly providerMetadata?: {
|
|
317
|
+
readonly [x: string]: {
|
|
318
|
+
readonly [x: string]: unknown;
|
|
319
|
+
};
|
|
320
|
+
} | undefined;
|
|
321
|
+
} | {
|
|
322
|
+
readonly type: "reasoning-delta";
|
|
323
|
+
readonly id: string;
|
|
324
|
+
readonly text: string;
|
|
325
|
+
readonly providerMetadata?: {
|
|
326
|
+
readonly [x: string]: {
|
|
327
|
+
readonly [x: string]: unknown;
|
|
328
|
+
};
|
|
329
|
+
} | undefined;
|
|
330
|
+
} | {
|
|
331
|
+
readonly type: "reasoning-end";
|
|
332
|
+
readonly id: string;
|
|
333
|
+
readonly text?: string | undefined;
|
|
334
|
+
readonly providerMetadata?: {
|
|
335
|
+
readonly [x: string]: {
|
|
336
|
+
readonly [x: string]: unknown;
|
|
337
|
+
};
|
|
338
|
+
} | undefined;
|
|
339
|
+
} | {
|
|
340
|
+
readonly type: "tool-input-start";
|
|
341
|
+
readonly id: string;
|
|
342
|
+
readonly name: string;
|
|
343
|
+
readonly namespace?: string | undefined;
|
|
344
|
+
readonly providerExecuted?: boolean | undefined;
|
|
345
|
+
readonly providerMetadata?: {
|
|
346
|
+
readonly [x: string]: {
|
|
347
|
+
readonly [x: string]: unknown;
|
|
348
|
+
};
|
|
349
|
+
} | undefined;
|
|
350
|
+
} | {
|
|
351
|
+
readonly type: "tool-input-delta";
|
|
352
|
+
readonly id: string;
|
|
353
|
+
readonly name: string;
|
|
354
|
+
readonly namespace?: string | undefined;
|
|
355
|
+
readonly text: string;
|
|
356
|
+
readonly input?: unknown;
|
|
357
|
+
} | {
|
|
358
|
+
readonly type: "tool-input-end";
|
|
359
|
+
readonly id: string;
|
|
360
|
+
readonly name: string;
|
|
361
|
+
readonly namespace?: string | undefined;
|
|
362
|
+
readonly providerMetadata?: {
|
|
363
|
+
readonly [x: string]: {
|
|
364
|
+
readonly [x: string]: unknown;
|
|
365
|
+
};
|
|
366
|
+
} | undefined;
|
|
367
|
+
} | {
|
|
368
|
+
readonly type: "tool-input-error";
|
|
369
|
+
readonly id: string;
|
|
370
|
+
readonly name: string;
|
|
371
|
+
readonly namespace?: string | undefined;
|
|
372
|
+
readonly raw: string;
|
|
373
|
+
} | {
|
|
374
|
+
readonly type: "tool-call";
|
|
375
|
+
readonly id: string;
|
|
376
|
+
readonly name: string;
|
|
377
|
+
readonly namespace?: string | undefined;
|
|
378
|
+
readonly input: unknown;
|
|
379
|
+
readonly providerExecuted?: boolean | undefined;
|
|
380
|
+
readonly providerMetadata?: {
|
|
381
|
+
readonly [x: string]: {
|
|
382
|
+
readonly [x: string]: unknown;
|
|
383
|
+
};
|
|
384
|
+
} | undefined;
|
|
385
|
+
} | {
|
|
386
|
+
readonly type: "tool-result";
|
|
387
|
+
readonly id: string;
|
|
388
|
+
readonly name: string;
|
|
389
|
+
readonly namespace?: string | undefined;
|
|
390
|
+
readonly result: {
|
|
391
|
+
readonly type: "json";
|
|
392
|
+
readonly value: unknown;
|
|
393
|
+
} | {
|
|
394
|
+
readonly type: "text";
|
|
395
|
+
readonly value: unknown;
|
|
396
|
+
} | {
|
|
397
|
+
readonly type: "error";
|
|
398
|
+
readonly value: unknown;
|
|
399
|
+
} | {
|
|
400
|
+
readonly type: "content";
|
|
401
|
+
readonly value: readonly ({
|
|
1099
402
|
readonly type: "text";
|
|
1100
|
-
readonly
|
|
403
|
+
readonly text: string;
|
|
1101
404
|
} | {
|
|
1102
|
-
readonly type: "
|
|
1103
|
-
readonly
|
|
405
|
+
readonly type: "file";
|
|
406
|
+
readonly uri: string;
|
|
407
|
+
readonly mime: string;
|
|
408
|
+
readonly name?: string | undefined;
|
|
409
|
+
})[];
|
|
410
|
+
};
|
|
411
|
+
readonly output?: {
|
|
412
|
+
readonly structured: unknown;
|
|
413
|
+
readonly content: readonly ({
|
|
414
|
+
readonly type: "text";
|
|
415
|
+
readonly text: string;
|
|
1104
416
|
} | {
|
|
1105
|
-
readonly type: "
|
|
1106
|
-
readonly
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
417
|
+
readonly type: "file";
|
|
418
|
+
readonly uri: string;
|
|
419
|
+
readonly mime: string;
|
|
420
|
+
readonly name?: string | undefined;
|
|
421
|
+
})[];
|
|
422
|
+
} | undefined;
|
|
423
|
+
readonly providerExecuted?: boolean | undefined;
|
|
424
|
+
readonly providerMetadata?: {
|
|
425
|
+
readonly [x: string]: {
|
|
426
|
+
readonly [x: string]: unknown;
|
|
1115
427
|
};
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
} | undefined;
|
|
1128
|
-
readonly providerExecuted?: boolean | undefined;
|
|
1129
|
-
readonly providerMetadata?: {
|
|
1130
|
-
readonly [x: string]: {
|
|
1131
|
-
readonly [x: string]: unknown;
|
|
1132
|
-
};
|
|
1133
|
-
} | undefined;
|
|
1134
|
-
} | {
|
|
1135
|
-
readonly type: "tool-error";
|
|
1136
|
-
readonly id: string;
|
|
1137
|
-
readonly name: string;
|
|
1138
|
-
readonly namespace?: string | undefined;
|
|
1139
|
-
readonly message: string;
|
|
1140
|
-
readonly error?: unknown;
|
|
1141
|
-
readonly providerMetadata?: {
|
|
1142
|
-
readonly [x: string]: {
|
|
1143
|
-
readonly [x: string]: unknown;
|
|
1144
|
-
};
|
|
1145
|
-
} | undefined;
|
|
1146
|
-
} | {
|
|
1147
|
-
readonly type: "step-finish";
|
|
1148
|
-
readonly index: number;
|
|
1149
|
-
readonly reason: {
|
|
1150
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
1151
|
-
readonly raw?: string | undefined;
|
|
1152
|
-
readonly category?: string | undefined;
|
|
1153
|
-
readonly explanation?: string | undefined;
|
|
1154
|
-
};
|
|
1155
|
-
readonly usage?: import("./effect.js").Usage | undefined;
|
|
1156
|
-
readonly providerMetadata?: {
|
|
1157
|
-
readonly [x: string]: {
|
|
1158
|
-
readonly [x: string]: unknown;
|
|
1159
|
-
};
|
|
1160
|
-
} | undefined;
|
|
1161
|
-
} | {
|
|
1162
|
-
readonly type: "finish";
|
|
1163
|
-
readonly reason: {
|
|
1164
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
1165
|
-
readonly raw?: string | undefined;
|
|
1166
|
-
readonly category?: string | undefined;
|
|
1167
|
-
readonly explanation?: string | undefined;
|
|
428
|
+
} | undefined;
|
|
429
|
+
} | {
|
|
430
|
+
readonly type: "tool-error";
|
|
431
|
+
readonly id: string;
|
|
432
|
+
readonly name: string;
|
|
433
|
+
readonly namespace?: string | undefined;
|
|
434
|
+
readonly message: string;
|
|
435
|
+
readonly error?: unknown;
|
|
436
|
+
readonly providerMetadata?: {
|
|
437
|
+
readonly [x: string]: {
|
|
438
|
+
readonly [x: string]: unknown;
|
|
1168
439
|
};
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
readonly
|
|
1177
|
-
readonly
|
|
1178
|
-
readonly providerMetadata?: {
|
|
1179
|
-
readonly [x: string]: {
|
|
1180
|
-
readonly [x: string]: unknown;
|
|
1181
|
-
};
|
|
1182
|
-
} | undefined;
|
|
1183
|
-
} | {
|
|
1184
|
-
readonly type: "provider-error";
|
|
1185
|
-
readonly message: string;
|
|
1186
|
-
readonly classification?: "context-overflow" | "payload-too-large" | undefined;
|
|
1187
|
-
readonly providerMetadata?: {
|
|
1188
|
-
readonly [x: string]: {
|
|
1189
|
-
readonly [x: string]: unknown;
|
|
1190
|
-
};
|
|
1191
|
-
} | undefined;
|
|
1192
|
-
} | ({
|
|
1193
|
-
readonly type: "compaction";
|
|
1194
|
-
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
1195
|
-
readonly id?: string | undefined;
|
|
1196
|
-
readonly encrypted?: string | undefined;
|
|
1197
|
-
readonly text?: string | null | undefined;
|
|
1198
|
-
} & ({
|
|
1199
|
-
readonly encrypted: string;
|
|
1200
|
-
readonly text?: never;
|
|
1201
|
-
} | {
|
|
1202
|
-
readonly text: string | null;
|
|
1203
|
-
readonly encrypted?: never;
|
|
1204
|
-
}))>;
|
|
1205
|
-
/** Decode the model's output against `schema` (or `jsonSchema`, unvalidated) like `LLM.generateObject`. */
|
|
1206
|
-
generateObject: {
|
|
1207
|
-
<const Model extends LanguageModel, S extends ToolSchema<any>>(input: GenerateObjectOptions<S, Model>, options?: RunOptions): Promise<GenerateObjectResponse<Schema.Schema.Type<S>>>;
|
|
1208
|
-
<const Model extends LanguageModel>(input: GenerateObjectDynamicOptions<Model>, options?: RunOptions): Promise<GenerateObjectResponse<unknown>>;
|
|
440
|
+
} | undefined;
|
|
441
|
+
} | {
|
|
442
|
+
readonly type: "step-finish";
|
|
443
|
+
readonly index: number;
|
|
444
|
+
readonly reason: {
|
|
445
|
+
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
446
|
+
readonly raw?: string | undefined;
|
|
447
|
+
readonly category?: string | undefined;
|
|
448
|
+
readonly explanation?: string | undefined;
|
|
1209
449
|
};
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
450
|
+
readonly usage?: import("./index.js").Usage | undefined;
|
|
451
|
+
readonly providerMetadata?: {
|
|
452
|
+
readonly [x: string]: {
|
|
453
|
+
readonly [x: string]: unknown;
|
|
454
|
+
};
|
|
455
|
+
} | undefined;
|
|
456
|
+
} | {
|
|
457
|
+
readonly type: "finish";
|
|
458
|
+
readonly reason: {
|
|
459
|
+
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
460
|
+
readonly raw?: string | undefined;
|
|
461
|
+
readonly category?: string | undefined;
|
|
462
|
+
readonly explanation?: string | undefined;
|
|
1214
463
|
};
|
|
1215
|
-
|
|
464
|
+
readonly usage?: import("./index.js").Usage | undefined;
|
|
465
|
+
readonly providerMetadata?: {
|
|
466
|
+
readonly [x: string]: {
|
|
467
|
+
readonly [x: string]: unknown;
|
|
468
|
+
};
|
|
469
|
+
} | undefined;
|
|
470
|
+
} | {
|
|
471
|
+
readonly type: "media";
|
|
472
|
+
readonly media: Media.Asset;
|
|
473
|
+
readonly providerMetadata?: {
|
|
474
|
+
readonly [x: string]: {
|
|
475
|
+
readonly [x: string]: unknown;
|
|
476
|
+
};
|
|
477
|
+
} | undefined;
|
|
478
|
+
} | {
|
|
479
|
+
readonly type: "provider-error";
|
|
480
|
+
readonly message: string;
|
|
481
|
+
readonly classification?: "context-overflow" | "payload-too-large" | undefined;
|
|
482
|
+
readonly providerMetadata?: {
|
|
483
|
+
readonly [x: string]: {
|
|
484
|
+
readonly [x: string]: unknown;
|
|
485
|
+
};
|
|
486
|
+
} | undefined;
|
|
487
|
+
} | ({
|
|
488
|
+
readonly type: "compaction";
|
|
489
|
+
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
490
|
+
readonly id?: string | undefined;
|
|
491
|
+
readonly encrypted?: string | undefined;
|
|
492
|
+
readonly text?: string | null | undefined;
|
|
493
|
+
} & ({
|
|
494
|
+
readonly encrypted: string;
|
|
495
|
+
readonly text?: never;
|
|
496
|
+
} | {
|
|
497
|
+
readonly text: string | null;
|
|
498
|
+
readonly encrypted?: never;
|
|
499
|
+
}))>;
|
|
500
|
+
/** Decode the model's output against `schema` (or `jsonSchema`, unvalidated). */
|
|
501
|
+
generateObject: {
|
|
502
|
+
<const Model extends LanguageModel, S extends ToolSchema<any>>(input: GenerateObjectOptions<S, Model>, options?: RunOptions): Promise<GenerateObjectResponse<Schema.Schema.Type<S>>>;
|
|
503
|
+
<const Model extends LanguageModel>(input: GenerateObjectDynamicOptions<Model>, options?: RunOptions): Promise<GenerateObjectResponse<unknown>>;
|
|
504
|
+
};
|
|
505
|
+
/** Compact a Responses request: a replacement window, or a checkpoint with `mechanism: "trigger"`. */
|
|
506
|
+
compact: {
|
|
507
|
+
(request: CheckpointRequest, options: TriggerCompactOptions & RunOptions): Promise<CompactionCheckpointResponse>;
|
|
508
|
+
(request: CompactionRequest, options?: EndpointCompactOptions & RunOptions): Promise<CompactionResponse>;
|
|
1216
509
|
};
|
|
510
|
+
canCompact: typeof LLM.canCompact;
|
|
1217
511
|
image: {
|
|
1218
512
|
request: typeof import("./image.js").request;
|
|
1219
|
-
generate: <const Model extends ImageModel>(input:
|
|
1220
|
-
stream: <const Model extends ImageModel>(input:
|
|
513
|
+
generate: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: AwaitOptions & RunOptions) => Promise<import("./image.js").ImageResponse>;
|
|
514
|
+
stream: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
|
|
1221
515
|
readonly type: "image-partial";
|
|
1222
516
|
readonly index: number;
|
|
1223
517
|
readonly image: Media.Asset;
|
|
@@ -1262,7 +556,7 @@ export declare const ai: {
|
|
|
1262
556
|
};
|
|
1263
557
|
} | undefined;
|
|
1264
558
|
}>;
|
|
1265
|
-
start: <const Model extends ImageModel>(input:
|
|
559
|
+
start: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: RunOptions) => Promise<GenerationHandle<import("./image.js").ImageResponse>>;
|
|
1266
560
|
resume: (model: ImageModel, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./image.js").ImageResponse>>;
|
|
1267
561
|
};
|
|
1268
562
|
decision: {
|
|
@@ -1273,8 +567,8 @@ export declare const ai: {
|
|
|
1273
567
|
experimental: {
|
|
1274
568
|
speech: {
|
|
1275
569
|
request: typeof import("./speech.js").request;
|
|
1276
|
-
generate: <const Model extends SpeechModel>(input:
|
|
1277
|
-
stream: <const Model extends SpeechModel>(input:
|
|
570
|
+
generate: <const Model extends SpeechModel>(input: SpeechRequestInput<Model> | SpeechRequest, options?: RunOptions) => Promise<import("./speech.js").SpeechResponse>;
|
|
571
|
+
stream: <const Model extends SpeechModel>(input: SpeechRequestInput<Model> | SpeechRequest, options?: RunOptions) => AsyncIterable<{
|
|
1278
572
|
readonly type: "audio-delta";
|
|
1279
573
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
1280
574
|
} | {
|
|
@@ -1325,8 +619,8 @@ export declare const ai: {
|
|
|
1325
619
|
};
|
|
1326
620
|
transcription: {
|
|
1327
621
|
request: typeof import("./transcription.js").request;
|
|
1328
|
-
generate: <const Model extends TranscriptionModel>(input:
|
|
1329
|
-
stream: <const Model extends TranscriptionModel>(input:
|
|
622
|
+
generate: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: AwaitOptions & RunOptions) => Promise<import("./transcription.js").TranscriptionResponse>;
|
|
623
|
+
stream: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
|
|
1330
624
|
readonly type: "text-delta";
|
|
1331
625
|
readonly delta: string;
|
|
1332
626
|
} | {
|
|
@@ -1390,15 +684,15 @@ export declare const ai: {
|
|
|
1390
684
|
} | undefined;
|
|
1391
685
|
readonly type: "finish";
|
|
1392
686
|
}>;
|
|
1393
|
-
start: <const Model extends TranscriptionModel>(input:
|
|
687
|
+
start: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: RunOptions) => Promise<GenerationHandle<import("./transcription.js").TranscriptionResponse>>;
|
|
1394
688
|
resume: (model: TranscriptionModel, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./transcription.js").TranscriptionResponse>>;
|
|
1395
689
|
};
|
|
1396
690
|
video: {
|
|
1397
691
|
request: typeof import("./video.js").request;
|
|
1398
|
-
start: <const Model extends VideoModel>(input:
|
|
1399
|
-
generate: <const Model extends VideoModel>(input:
|
|
692
|
+
start: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: RunOptions) => Promise<GenerationHandle<import("./video.js").VideoResponse>>;
|
|
693
|
+
generate: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: AwaitOptions & RunOptions) => Promise<import("./video.js").VideoResponse>;
|
|
1400
694
|
resume: (model: VideoModel, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./video.js").VideoResponse>>;
|
|
1401
|
-
stream: <const Model extends VideoModel>(input:
|
|
695
|
+
stream: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
|
|
1402
696
|
readonly type: "video";
|
|
1403
697
|
readonly index: number;
|
|
1404
698
|
readonly video: Media.Asset;
|
|
@@ -1443,6 +737,22 @@ export declare const ai: {
|
|
|
1443
737
|
};
|
|
1444
738
|
dispose: () => Promise<void>;
|
|
1445
739
|
};
|
|
1446
|
-
export
|
|
740
|
+
export type Client<R = never> = ReturnType<typeof make<R>>;
|
|
741
|
+
/** `tool` from `@opencode/ai/effect`, with an `execute` that returns a value or a Promise and throws to fail. */
|
|
742
|
+
export declare const tool: <Parameters extends ToolSchema<any> = typeof Schema.Unknown, Success extends ToolSchema<any> = typeof Schema.Unknown, Result extends Schema.Schema.Type<Success> | PromiseLike<Schema.Schema.Type<Success>> | NoExecute = NoExecute>(config: ToolOptions<Parameters, Success, (params: Schema.Schema.Type<Parameters>, context: Partial<ToolExecuteContext> & {
|
|
743
|
+
signal: AbortSignal;
|
|
744
|
+
}) => Result>) => 0 extends 1 & Result ? import("./tool.js").ExecutableTool<Parameters, Success> : [Result, NoExecute] extends [NoExecute, Result] ? import("./tool.js").Tool<Parameters, Success> : import("./tool.js").ExecutableTool<Parameters, Success>;
|
|
745
|
+
/** Default client over `RequestExecutor.fetchLayer`; the runtime builds its layer on first use and holds nothing to dispose. */
|
|
746
|
+
export declare const ai: Omit<Client, "dispose">;
|
|
1447
747
|
export * as AI from "./index.js";
|
|
1448
|
-
export
|
|
748
|
+
export { isContextOverflow, isContextOverflowFailure, isRetryable } from "./provider-error.js";
|
|
749
|
+
export { ProtocolID, RouteID, ModelID, ProviderID, ResponseID, ContentBlockID, ToolCallID, JsonSchema, ProviderOptions, ProviderMetadata, HttpTimeout, RequestEncoding, HttpOptions, GenerationOptions, LanguageModelDefaults, ReasoningEfforts, ReasoningEffort, LanguageModelCompatibility, LanguageModel, LanguageModelSchema, CacheTTL, CacheHint, CachePolicyObject, CachePolicy, MessageRole, SystemPart, TextPart, MediaPart, ToolResultValue, ToolOutput, ToolCallPart, ToolResultPart, ReasoningPart, CompactionPart, EffortPart, ContentPart, Message, Freeform, ToolDefinition, ToolNamespace, ToolEntry, ToolChoice, LLMRequest, FinishReason, Usage, MediaUsage, CompactionResponse, CompactionCheckpointResponse, StepStart, TextStart, TextDelta, TextEnd, ReasoningStart, ReasoningDelta, ReasoningEnd, ToolInputStart, ToolInputDelta, ToolInputEnd, ToolInputError, ToolCall, ToolResult, ToolError, FinishReasonDetails, StepFinish, Finish, MediaEvent, ProviderErrorEvent, LLMEvent, LLMResponse, HttpContext, HttpRateLimitDetails, InvalidRequestError, UnsupportedOperationError, ProviderConfigurationError, NoRouteError, AuthenticationError, RateLimitError, QuotaExceededError, ContentPolicyError, ProviderInternalError, TransportType, TransportOperation, TransportError, InvalidProviderOutputError, UnknownProviderError, TimeoutError, AIErrorReason, AIError, } from "./schema/index.js";
|
|
750
|
+
export type { GenerationOptionsFields, GenerationOptionsInput, LanguageModelInput, LanguageModelProviderOptions, ToolDefinitionInput, ToolNamespaceInput, ToolNamespaceEntryInput, ToolEntryInput, UsageInput, } from "./schema/index.js";
|
|
751
|
+
export { ImageAspectRatio, ImageEvent, ImageModel, ImageModelSchema, ImageRequest, ImageResponse } from "./image.js";
|
|
752
|
+
export type { ImageModelOptions, ImageOptions, ImageRequestFor, ImageRequestInput, ImageResolution, ImageRoute, } from "./image.js";
|
|
753
|
+
export { ChoiceAnswer, ChoiceQuestion, ChoiceValue, DecisionAnswer, DecisionJsonPart, DecisionMediaPart, DecisionModel, DecisionModelCompatibility, DecisionModelSchema, DecisionPart, DecisionQuestion, DecisionRequest, DecisionResponse, DecisionTextPart, DecisionUsage, ErrorAnswer, ErrorReason, PredicateAnswer, PredicateQuestion, ScoreAnswer, ScoreQuestion, } from "./decision.js";
|
|
754
|
+
export type { AnswerFor, AnswersFor, DecisionInput, DecisionModelOptions, DecisionOptions, DecisionQuestions, DecisionRequestFor, DecisionRequestInput, DecisionResponseFor, DecisionModelRoute, } from "./decision.js";
|
|
755
|
+
export { Media } from "./media.js";
|
|
756
|
+
export type { AwaitOptions as GenerationAwaitOptions, Event as GenerationEvent, Poll, Route as GenerationRoute, Snapshot as GenerationSnapshot, Status as GenerationStatus, } from "./generation.js";
|
|
757
|
+
export type { ExecutableTool, Tool, ToolExecute, ToolExecuteContext, ToolModelOutputInput, ToolOptions, Tools, ToolSchema, ToolToModelOutput, } from "./tool.js";
|
|
758
|
+
export type { LLM } from "./llm.js";
|