@opencode/ai 0.0.0-dev-20579 → 0.0.0-dev-20583
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/dist/protocols/alibaba-messages.d.ts +3 -0
- package/dist/protocols/alibaba-responses.d.ts +3 -0
- package/dist/protocols/anthropic-messages.d.ts +3 -0
- package/dist/protocols/anthropic-messages.js +9 -9
- package/dist/protocols/meta-messages.d.ts +3 -0
- package/dist/protocols/meta-responses.d.ts +3 -0
- package/dist/protocols/open-responses.d.ts +18 -12
- package/dist/protocols/open-responses.js +5 -5
- package/dist/protocols/openai-responses.d.ts +3 -0
- package/dist/protocols/xai-responses.d.ts +3 -0
- package/dist/protocols/zai-messages.d.ts +3 -0
- package/package.json +3 -3
|
@@ -272,8 +272,10 @@ export declare const protocol: Protocol<{
|
|
|
272
272
|
readonly top_k?: number | undefined;
|
|
273
273
|
readonly stop_sequences?: readonly string[] | undefined;
|
|
274
274
|
}, string, {
|
|
275
|
+
readonly [x: string]: unknown;
|
|
275
276
|
readonly type: string;
|
|
276
277
|
readonly message?: {
|
|
278
|
+
readonly [x: string]: unknown;
|
|
277
279
|
readonly usage?: {
|
|
278
280
|
readonly [x: string]: unknown;
|
|
279
281
|
readonly input_tokens?: number | null | undefined;
|
|
@@ -306,6 +308,7 @@ export declare const protocol: Protocol<{
|
|
|
306
308
|
} | undefined;
|
|
307
309
|
} | undefined;
|
|
308
310
|
readonly error?: {
|
|
311
|
+
readonly [x: string]: unknown;
|
|
309
312
|
readonly type?: string | undefined;
|
|
310
313
|
readonly message?: string | undefined;
|
|
311
314
|
} | undefined;
|
|
@@ -213,13 +213,16 @@ export declare const protocol: Protocol<{
|
|
|
213
213
|
}[] | undefined;
|
|
214
214
|
readonly error?: unknown;
|
|
215
215
|
readonly usage?: {
|
|
216
|
+
readonly [x: string]: unknown;
|
|
216
217
|
readonly input_tokens?: number | undefined;
|
|
217
218
|
readonly output_tokens?: number | undefined;
|
|
218
219
|
readonly output_tokens_details?: {
|
|
220
|
+
readonly [x: string]: unknown;
|
|
219
221
|
readonly reasoning_tokens?: number | undefined;
|
|
220
222
|
} | null | undefined;
|
|
221
223
|
readonly total_tokens?: number | undefined;
|
|
222
224
|
readonly input_tokens_details?: {
|
|
225
|
+
readonly [x: string]: unknown;
|
|
223
226
|
readonly cached_tokens?: number | undefined;
|
|
224
227
|
readonly cache_write_tokens?: number | undefined;
|
|
225
228
|
} | null | undefined;
|
|
@@ -684,8 +684,10 @@ export declare const protocol: Protocol<{
|
|
|
684
684
|
readonly top_k?: number | undefined;
|
|
685
685
|
readonly stop_sequences?: readonly string[] | undefined;
|
|
686
686
|
}, string, {
|
|
687
|
+
readonly [x: string]: unknown;
|
|
687
688
|
readonly type: string;
|
|
688
689
|
readonly message?: {
|
|
690
|
+
readonly [x: string]: unknown;
|
|
689
691
|
readonly usage?: {
|
|
690
692
|
readonly [x: string]: unknown;
|
|
691
693
|
readonly input_tokens?: number | null | undefined;
|
|
@@ -718,6 +720,7 @@ export declare const protocol: Protocol<{
|
|
|
718
720
|
} | undefined;
|
|
719
721
|
} | undefined;
|
|
720
722
|
readonly error?: {
|
|
723
|
+
readonly [x: string]: unknown;
|
|
721
724
|
readonly type?: string | undefined;
|
|
722
725
|
readonly message?: string | undefined;
|
|
723
726
|
} | undefined;
|
|
@@ -332,7 +332,7 @@ const AnthropicUsage = Schema.StructWithRest(Schema.Struct({
|
|
|
332
332
|
...AnthropicIterationUsage.schema.fields,
|
|
333
333
|
iterations: Schema.optional(Schema.Array(AnthropicIterationUsage)),
|
|
334
334
|
}), [JsonObject]);
|
|
335
|
-
const AnthropicStreamBlock = Schema.Struct({
|
|
335
|
+
const AnthropicStreamBlock = Schema.StructWithRest(Schema.Struct({
|
|
336
336
|
type: Schema.String,
|
|
337
337
|
id: Schema.optional(Schema.String),
|
|
338
338
|
name: Schema.optional(Schema.String),
|
|
@@ -348,9 +348,9 @@ const AnthropicStreamBlock = Schema.Struct({
|
|
|
348
348
|
// server_tool_use id in `tool_use_id`.
|
|
349
349
|
tool_use_id: Schema.optional(Schema.String),
|
|
350
350
|
content: Schema.optional(Schema.Unknown),
|
|
351
|
-
});
|
|
351
|
+
}), [JsonObject]);
|
|
352
352
|
const decodeAnthropicStreamBlock = Schema.decodeUnknownOption(AnthropicStreamBlock);
|
|
353
|
-
const AnthropicStreamDelta = Schema.Struct({
|
|
353
|
+
const AnthropicStreamDelta = Schema.StructWithRest(Schema.Struct({
|
|
354
354
|
content: optionalNull(Schema.String),
|
|
355
355
|
type: Schema.optional(Schema.String),
|
|
356
356
|
text: Schema.optional(Schema.String),
|
|
@@ -359,13 +359,13 @@ const AnthropicStreamDelta = Schema.Struct({
|
|
|
359
359
|
signature: Schema.optional(Schema.String),
|
|
360
360
|
stop_reason: optionalNull(Schema.String),
|
|
361
361
|
stop_sequence: optionalNull(Schema.String),
|
|
362
|
-
stop_details: optionalNull(Schema.Struct({ category: optionalNull(Schema.String), explanation: optionalNull(Schema.String) })),
|
|
363
|
-
});
|
|
362
|
+
stop_details: optionalNull(Schema.StructWithRest(Schema.Struct({ category: optionalNull(Schema.String), explanation: optionalNull(Schema.String) }), [JsonObject])),
|
|
363
|
+
}), [JsonObject]);
|
|
364
364
|
const decodeAnthropicStreamDelta = Schema.decodeUnknownOption(AnthropicStreamDelta);
|
|
365
|
-
const AnthropicEvent = Schema.Struct({
|
|
365
|
+
const AnthropicEvent = Schema.StructWithRest(Schema.Struct({
|
|
366
366
|
type: Schema.String,
|
|
367
367
|
index: Schema.optional(Schema.Number),
|
|
368
|
-
message: Schema.optional(Schema.Struct({ usage: Schema.optional(AnthropicUsage) })),
|
|
368
|
+
message: Schema.optional(Schema.StructWithRest(Schema.Struct({ usage: Schema.optional(AnthropicUsage) }), [JsonObject])),
|
|
369
369
|
content_block: Schema.optional(Schema.Unknown),
|
|
370
370
|
delta: Schema.optional(Schema.Unknown),
|
|
371
371
|
usage: Schema.optional(AnthropicUsage),
|
|
@@ -373,8 +373,8 @@ const AnthropicEvent = Schema.Struct({
|
|
|
373
373
|
// OpenAI-compatible proxies and gateway translations occasionally drop one
|
|
374
374
|
// or the other; mark them optional so a partial payload still parses and
|
|
375
375
|
// the parser can fall back to whichever field is populated.
|
|
376
|
-
error: Schema.optional(Schema.Struct({ type: Schema.optional(Schema.String), message: Schema.optional(Schema.String) })),
|
|
377
|
-
});
|
|
376
|
+
error: Schema.optional(Schema.StructWithRest(Schema.Struct({ type: Schema.optional(Schema.String), message: Schema.optional(Schema.String) }), [JsonObject])),
|
|
377
|
+
}), [JsonObject]);
|
|
378
378
|
const invalid = ProviderShared.invalidRequest;
|
|
379
379
|
// =============================================================================
|
|
380
380
|
// Request Lowering
|
|
@@ -282,8 +282,10 @@ export declare const protocol: Protocol<{
|
|
|
282
282
|
readonly top_k?: number | undefined;
|
|
283
283
|
readonly stop_sequences?: readonly string[] | undefined;
|
|
284
284
|
}, string, {
|
|
285
|
+
readonly [x: string]: unknown;
|
|
285
286
|
readonly type: string;
|
|
286
287
|
readonly message?: {
|
|
288
|
+
readonly [x: string]: unknown;
|
|
287
289
|
readonly usage?: {
|
|
288
290
|
readonly [x: string]: unknown;
|
|
289
291
|
readonly input_tokens?: number | null | undefined;
|
|
@@ -316,6 +318,7 @@ export declare const protocol: Protocol<{
|
|
|
316
318
|
} | undefined;
|
|
317
319
|
} | undefined;
|
|
318
320
|
readonly error?: {
|
|
321
|
+
readonly [x: string]: unknown;
|
|
319
322
|
readonly type?: string | undefined;
|
|
320
323
|
readonly message?: string | undefined;
|
|
321
324
|
} | undefined;
|
|
@@ -224,13 +224,16 @@ export declare const protocol: Protocol<{
|
|
|
224
224
|
}[] | undefined;
|
|
225
225
|
readonly error?: unknown;
|
|
226
226
|
readonly usage?: {
|
|
227
|
+
readonly [x: string]: unknown;
|
|
227
228
|
readonly input_tokens?: number | undefined;
|
|
228
229
|
readonly output_tokens?: number | undefined;
|
|
229
230
|
readonly output_tokens_details?: {
|
|
231
|
+
readonly [x: string]: unknown;
|
|
230
232
|
readonly reasoning_tokens?: number | undefined;
|
|
231
233
|
} | null | undefined;
|
|
232
234
|
readonly total_tokens?: number | undefined;
|
|
233
235
|
readonly input_tokens_details?: {
|
|
236
|
+
readonly [x: string]: unknown;
|
|
234
237
|
readonly cached_tokens?: number | undefined;
|
|
235
238
|
readonly cache_write_tokens?: number | undefined;
|
|
236
239
|
} | null | undefined;
|
|
@@ -559,18 +559,18 @@ export declare const OpenResponsesBody: Schema.Struct<{
|
|
|
559
559
|
readonly frequency_penalty: Schema.optional<Schema.Number>;
|
|
560
560
|
}>;
|
|
561
561
|
export type OpenResponsesBody = Schema.Schema.Type<typeof OpenResponsesBody>;
|
|
562
|
-
export declare const OpenResponsesUsage: Schema.Struct<{
|
|
562
|
+
export declare const OpenResponsesUsage: Schema.StructWithRest<Schema.Struct<{
|
|
563
563
|
readonly input_tokens: Schema.optional<Schema.Number>;
|
|
564
|
-
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
564
|
+
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
565
565
|
readonly cached_tokens: Schema.optional<Schema.Number>;
|
|
566
566
|
readonly cache_write_tokens: Schema.optional<Schema.Number>;
|
|
567
|
-
}>>>;
|
|
567
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
568
568
|
readonly output_tokens: Schema.optional<Schema.Number>;
|
|
569
|
-
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
569
|
+
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
570
570
|
readonly reasoning_tokens: Schema.optional<Schema.Number>;
|
|
571
|
-
}>>>;
|
|
571
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
572
572
|
readonly total_tokens: Schema.optional<Schema.Number>;
|
|
573
|
-
}>;
|
|
573
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
|
|
574
574
|
type OpenResponsesUsage = Schema.Schema.Type<typeof OpenResponsesUsage>;
|
|
575
575
|
export declare const StreamItem: Schema.StructWithRest<Schema.Struct<{
|
|
576
576
|
readonly type: Schema.String;
|
|
@@ -617,18 +617,18 @@ export declare const Event: Schema.StructWithRest<Schema.Struct<{
|
|
|
617
617
|
readonly arguments: Schema.optional<Schema.String>;
|
|
618
618
|
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
619
619
|
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
620
|
-
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
620
|
+
readonly usage: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
621
621
|
readonly input_tokens: Schema.optional<Schema.Number>;
|
|
622
|
-
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
622
|
+
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
623
623
|
readonly cached_tokens: Schema.optional<Schema.Number>;
|
|
624
624
|
readonly cache_write_tokens: Schema.optional<Schema.Number>;
|
|
625
|
-
}>>>;
|
|
625
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
626
626
|
readonly output_tokens: Schema.optional<Schema.Number>;
|
|
627
|
-
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
627
|
+
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
628
628
|
readonly reasoning_tokens: Schema.optional<Schema.Number>;
|
|
629
|
-
}>>>;
|
|
629
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
630
630
|
readonly total_tokens: Schema.optional<Schema.Number>;
|
|
631
|
-
}>>>;
|
|
631
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
632
632
|
readonly error: Schema.optional<Schema.Unknown>;
|
|
633
633
|
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
|
|
634
634
|
readonly code: Schema.optional<Schema.Unknown>;
|
|
@@ -669,13 +669,16 @@ export declare const decodeChannelEvent: (frame: string) => Effect.Effect<{
|
|
|
669
669
|
}[] | undefined;
|
|
670
670
|
readonly error?: unknown;
|
|
671
671
|
readonly usage?: {
|
|
672
|
+
readonly [x: string]: unknown;
|
|
672
673
|
readonly input_tokens?: number | undefined;
|
|
673
674
|
readonly output_tokens?: number | undefined;
|
|
674
675
|
readonly output_tokens_details?: {
|
|
676
|
+
readonly [x: string]: unknown;
|
|
675
677
|
readonly reasoning_tokens?: number | undefined;
|
|
676
678
|
} | null | undefined;
|
|
677
679
|
readonly total_tokens?: number | undefined;
|
|
678
680
|
readonly input_tokens_details?: {
|
|
681
|
+
readonly [x: string]: unknown;
|
|
679
682
|
readonly cached_tokens?: number | undefined;
|
|
680
683
|
readonly cache_write_tokens?: number | undefined;
|
|
681
684
|
} | null | undefined;
|
|
@@ -1721,13 +1724,16 @@ export declare const protocol: Protocol<{
|
|
|
1721
1724
|
}[] | undefined;
|
|
1722
1725
|
readonly error?: unknown;
|
|
1723
1726
|
readonly usage?: {
|
|
1727
|
+
readonly [x: string]: unknown;
|
|
1724
1728
|
readonly input_tokens?: number | undefined;
|
|
1725
1729
|
readonly output_tokens?: number | undefined;
|
|
1726
1730
|
readonly output_tokens_details?: {
|
|
1731
|
+
readonly [x: string]: unknown;
|
|
1727
1732
|
readonly reasoning_tokens?: number | undefined;
|
|
1728
1733
|
} | null | undefined;
|
|
1729
1734
|
readonly total_tokens?: number | undefined;
|
|
1730
1735
|
readonly input_tokens_details?: {
|
|
1736
|
+
readonly [x: string]: unknown;
|
|
1731
1737
|
readonly cached_tokens?: number | undefined;
|
|
1732
1738
|
readonly cache_write_tokens?: number | undefined;
|
|
1733
1739
|
} | null | undefined;
|
|
@@ -221,16 +221,16 @@ export const OpenResponsesBody = Schema.Struct({
|
|
|
221
221
|
...coreFields,
|
|
222
222
|
stream: Schema.Literal(true),
|
|
223
223
|
});
|
|
224
|
-
export const OpenResponsesUsage = Schema.Struct({
|
|
224
|
+
export const OpenResponsesUsage = Schema.StructWithRest(Schema.Struct({
|
|
225
225
|
input_tokens: Schema.optional(Schema.Number),
|
|
226
|
-
input_tokens_details: optionalNull(Schema.Struct({
|
|
226
|
+
input_tokens_details: optionalNull(Schema.StructWithRest(Schema.Struct({
|
|
227
227
|
cached_tokens: Schema.optional(Schema.Number),
|
|
228
228
|
cache_write_tokens: Schema.optional(Schema.Number),
|
|
229
|
-
})),
|
|
229
|
+
}), [JsonObject])),
|
|
230
230
|
output_tokens: Schema.optional(Schema.Number),
|
|
231
|
-
output_tokens_details: optionalNull(Schema.Struct({ reasoning_tokens: Schema.optional(Schema.Number) })),
|
|
231
|
+
output_tokens_details: optionalNull(Schema.StructWithRest(Schema.Struct({ reasoning_tokens: Schema.optional(Schema.Number) }), [JsonObject])),
|
|
232
232
|
total_tokens: Schema.optional(Schema.Number),
|
|
233
|
-
});
|
|
233
|
+
}), [JsonObject]);
|
|
234
234
|
// The spec requires `id` on every output item, but some gateways drop it from
|
|
235
235
|
// later item events (Bedrock Mantle renames it to `item_id` on
|
|
236
236
|
// `output_item.done` and `response.completed.output`). Decode it as optional
|
|
@@ -429,13 +429,16 @@ export declare const protocol: Protocol<{
|
|
|
429
429
|
}[] | undefined;
|
|
430
430
|
readonly error?: unknown;
|
|
431
431
|
readonly usage?: {
|
|
432
|
+
readonly [x: string]: unknown;
|
|
432
433
|
readonly input_tokens?: number | undefined;
|
|
433
434
|
readonly output_tokens?: number | undefined;
|
|
434
435
|
readonly output_tokens_details?: {
|
|
436
|
+
readonly [x: string]: unknown;
|
|
435
437
|
readonly reasoning_tokens?: number | undefined;
|
|
436
438
|
} | null | undefined;
|
|
437
439
|
readonly total_tokens?: number | undefined;
|
|
438
440
|
readonly input_tokens_details?: {
|
|
441
|
+
readonly [x: string]: unknown;
|
|
439
442
|
readonly cached_tokens?: number | undefined;
|
|
440
443
|
readonly cache_write_tokens?: number | undefined;
|
|
441
444
|
} | null | undefined;
|
|
@@ -200,13 +200,16 @@ export declare const protocol: Protocol<{
|
|
|
200
200
|
}[] | undefined;
|
|
201
201
|
readonly error?: unknown;
|
|
202
202
|
readonly usage?: {
|
|
203
|
+
readonly [x: string]: unknown;
|
|
203
204
|
readonly input_tokens?: number | undefined;
|
|
204
205
|
readonly output_tokens?: number | undefined;
|
|
205
206
|
readonly output_tokens_details?: {
|
|
207
|
+
readonly [x: string]: unknown;
|
|
206
208
|
readonly reasoning_tokens?: number | undefined;
|
|
207
209
|
} | null | undefined;
|
|
208
210
|
readonly total_tokens?: number | undefined;
|
|
209
211
|
readonly input_tokens_details?: {
|
|
212
|
+
readonly [x: string]: unknown;
|
|
210
213
|
readonly cached_tokens?: number | undefined;
|
|
211
214
|
readonly cache_write_tokens?: number | undefined;
|
|
212
215
|
} | null | undefined;
|
|
@@ -266,8 +266,10 @@ export declare const protocol: Protocol<{
|
|
|
266
266
|
readonly top_k?: number | undefined;
|
|
267
267
|
readonly stop_sequences?: readonly string[] | undefined;
|
|
268
268
|
}, string, {
|
|
269
|
+
readonly [x: string]: unknown;
|
|
269
270
|
readonly type: string;
|
|
270
271
|
readonly message?: {
|
|
272
|
+
readonly [x: string]: unknown;
|
|
271
273
|
readonly usage?: {
|
|
272
274
|
readonly [x: string]: unknown;
|
|
273
275
|
readonly input_tokens?: number | null | undefined;
|
|
@@ -300,6 +302,7 @@ export declare const protocol: Protocol<{
|
|
|
300
302
|
} | undefined;
|
|
301
303
|
} | undefined;
|
|
302
304
|
readonly error?: {
|
|
305
|
+
readonly [x: string]: unknown;
|
|
303
306
|
readonly type?: string | undefined;
|
|
304
307
|
readonly message?: string | undefined;
|
|
305
308
|
} | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20583",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
36
36
|
"@effect/platform-node": "4.0.0-rc.112",
|
|
37
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
37
|
+
"@opencode/http-recorder": "0.0.0-dev-20583",
|
|
38
38
|
"@tsconfig/bun": "1.0.9",
|
|
39
39
|
"@types/bun": "1.4.0",
|
|
40
40
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
45
45
|
"@smithy/eventstream-codec": "4.2.14",
|
|
46
46
|
"@smithy/util-utf8": "4.2.2",
|
|
47
|
-
"@opencode/schema": "0.0.0-dev-
|
|
47
|
+
"@opencode/schema": "0.0.0-dev-20583",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.0-rc.112",
|
|
50
50
|
"google-auth-library": "10.5.0"
|