@opencode/ai 0.0.0-dev-19454 → 0.0.0-dev-19457
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.
|
@@ -585,7 +585,7 @@ export declare const decodeKnownErrorEvent: (event: Event) => Effect.Effect<{
|
|
|
585
585
|
readonly param?: string | null | undefined;
|
|
586
586
|
readonly status_code?: number | undefined;
|
|
587
587
|
}, Schema.SchemaError, never>;
|
|
588
|
-
export declare const Event: Schema.StructWithRest<Schema.Struct<{
|
|
588
|
+
export declare const Event: Schema.decodeTo<Schema.toType<Schema.StructWithRest<Schema.Struct<{
|
|
589
589
|
readonly type: Schema.String;
|
|
590
590
|
readonly delta: Schema.optional<Schema.String>;
|
|
591
591
|
readonly arguments: Schema.optional<Schema.String>;
|
|
@@ -648,7 +648,70 @@ export declare const Event: Schema.StructWithRest<Schema.Struct<{
|
|
|
648
648
|
readonly status: Schema.optional<Schema.Unknown>;
|
|
649
649
|
readonly status_code: Schema.optional<Schema.Unknown>;
|
|
650
650
|
readonly headers: Schema.optional<Schema.Unknown>;
|
|
651
|
-
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]
|
|
651
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>, Schema.StructWithRest<Schema.Struct<{
|
|
652
|
+
readonly type: Schema.String;
|
|
653
|
+
readonly delta: Schema.optional<Schema.String>;
|
|
654
|
+
readonly arguments: Schema.optional<Schema.String>;
|
|
655
|
+
readonly text: Schema.optional<Schema.String>;
|
|
656
|
+
readonly item_id: Schema.optional<Schema.String>;
|
|
657
|
+
readonly output_index: Schema.optional<Schema.Number>;
|
|
658
|
+
readonly summary_index: Schema.optional<Schema.Number>;
|
|
659
|
+
readonly item: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
660
|
+
readonly type: Schema.String;
|
|
661
|
+
readonly id: Schema.optional<Schema.String>;
|
|
662
|
+
readonly call_id: Schema.optional<Schema.String>;
|
|
663
|
+
readonly name: Schema.optional<Schema.String>;
|
|
664
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
665
|
+
readonly arguments: Schema.optional<Schema.String>;
|
|
666
|
+
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
667
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
668
|
+
readonly response: Schema.optional<Schema.StructWithRest<Schema.Struct<{
|
|
669
|
+
readonly id: Schema.optional<Schema.String>;
|
|
670
|
+
readonly service_tier: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
671
|
+
readonly incomplete_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
672
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
673
|
+
}>>>;
|
|
674
|
+
readonly output: Schema.optional<Schema.$Array<Schema.StructWithRest<Schema.Struct<{
|
|
675
|
+
readonly type: Schema.String;
|
|
676
|
+
readonly id: Schema.optional<Schema.String>;
|
|
677
|
+
readonly call_id: Schema.optional<Schema.String>;
|
|
678
|
+
readonly name: Schema.optional<Schema.String>;
|
|
679
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
680
|
+
readonly arguments: Schema.optional<Schema.String>;
|
|
681
|
+
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
682
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
683
|
+
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
684
|
+
readonly input_tokens: Schema.optional<Schema.Number>;
|
|
685
|
+
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
686
|
+
readonly cached_tokens: Schema.optional<Schema.Number>;
|
|
687
|
+
readonly cache_write_tokens: Schema.optional<Schema.Number>;
|
|
688
|
+
}>>>;
|
|
689
|
+
readonly output_tokens: Schema.optional<Schema.Number>;
|
|
690
|
+
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
691
|
+
readonly reasoning_tokens: Schema.optional<Schema.Number>;
|
|
692
|
+
}>>>;
|
|
693
|
+
readonly total_tokens: Schema.optional<Schema.Number>;
|
|
694
|
+
}>>>;
|
|
695
|
+
readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
696
|
+
readonly type: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
697
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
698
|
+
readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
699
|
+
readonly param: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
700
|
+
}>>>;
|
|
701
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
|
|
702
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
703
|
+
readonly message: Schema.optional<Schema.String>;
|
|
704
|
+
readonly param: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
705
|
+
readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
706
|
+
readonly type: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
707
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
708
|
+
readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
709
|
+
readonly param: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
710
|
+
}>>>;
|
|
711
|
+
readonly status: Schema.optional<Schema.Unknown>;
|
|
712
|
+
readonly status_code: Schema.optional<Schema.Unknown>;
|
|
713
|
+
readonly headers: Schema.optional<Schema.Unknown>;
|
|
714
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, never, never>;
|
|
652
715
|
export type Event = Schema.Schema.Type<typeof Event>;
|
|
653
716
|
export type NormalizedEvent = Event & {
|
|
654
717
|
readonly item?: OutputItem | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Effect, Option, Schema } from "effect";
|
|
1
|
+
import { Effect, Option, Schema, SchemaGetter } from "effect";
|
|
2
2
|
import { HttpTransport } from "../route/transport/index.js";
|
|
3
3
|
import { Protocol } from "../route/protocol.js";
|
|
4
4
|
import { AIError, LLMEvent, ProviderInternalError, Usage, } from "../schema/index.js";
|
|
@@ -232,9 +232,8 @@ export const StreamItem = Schema.StructWithRest(Schema.Struct({
|
|
|
232
232
|
arguments: Schema.optional(Schema.String),
|
|
233
233
|
encrypted_content: optionalNull(Schema.String),
|
|
234
234
|
}), [Schema.Record(Schema.String, Schema.Unknown)]);
|
|
235
|
-
//
|
|
236
|
-
// response failures under `response.error`.
|
|
237
|
-
// event-level `error` envelope, so accept all three shapes here.
|
|
235
|
+
// Responses-compatible providers put streaming error details at the top level or
|
|
236
|
+
// under `error`, and response failures under `response.error`. Accept all three shapes.
|
|
238
237
|
// https://www.openresponses.org/specification
|
|
239
238
|
const OpenResponsesErrorPayload = Schema.Struct({
|
|
240
239
|
type: optionalNull(Schema.String),
|
|
@@ -287,7 +286,18 @@ export const Event = Schema.StructWithRest(Schema.Struct({
|
|
|
287
286
|
status: Schema.optional(Schema.Unknown),
|
|
288
287
|
status_code: Schema.optional(Schema.Unknown),
|
|
289
288
|
headers: Schema.optional(Schema.Unknown),
|
|
290
|
-
}), [Schema.Record(Schema.String, Schema.Unknown)])
|
|
289
|
+
}), [Schema.Record(Schema.String, Schema.Unknown)]).pipe(Schema.decode({
|
|
290
|
+
decode: SchemaGetter.transform((event) => {
|
|
291
|
+
if (event.type !== "error" || event.error != null)
|
|
292
|
+
return event;
|
|
293
|
+
const { code, message, param, ...rest } = event;
|
|
294
|
+
if (code === undefined && message === undefined && param === undefined)
|
|
295
|
+
return event;
|
|
296
|
+
// Flat errors (for example, Meta's) can also arrive through generic Responses endpoints.
|
|
297
|
+
return { ...rest, error: { code, message, param } };
|
|
298
|
+
}),
|
|
299
|
+
encode: SchemaGetter.passthrough(),
|
|
300
|
+
}));
|
|
291
301
|
const decodeEventValue = Schema.decodeUnknownEffect(Event);
|
|
292
302
|
const decodeFrame = Schema.decodeUnknownEffect(ProviderShared.Json);
|
|
293
303
|
/**
|
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-19457",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
32
32
|
"@effect/platform-node": "4.0.0-rc.112",
|
|
33
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
33
|
+
"@opencode/http-recorder": "0.0.0-dev-19457",
|
|
34
34
|
"@tsconfig/bun": "1.0.9",
|
|
35
35
|
"@types/bun": "1.4.0",
|
|
36
36
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
41
41
|
"@smithy/eventstream-codec": "4.2.14",
|
|
42
42
|
"@smithy/util-utf8": "4.2.2",
|
|
43
|
-
"@opencode/schema": "0.0.0-dev-
|
|
43
|
+
"@opencode/schema": "0.0.0-dev-19457",
|
|
44
44
|
"aws4fetch": "1.0.20",
|
|
45
45
|
"effect": "4.0.0-rc.112",
|
|
46
46
|
"google-auth-library": "10.5.0"
|