@opencode/ai 0.0.0-dev-439 → 0.0.0-dev-440

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.
@@ -175,12 +175,7 @@ export declare const protocol: Protocol<{
175
175
  readonly status: string;
176
176
  } | {
177
177
  readonly event_type: "error";
178
- readonly error?: {
179
- readonly [x: string]: unknown;
180
- readonly code?: string | undefined;
181
- readonly error_type?: string | undefined;
182
- readonly message?: string | undefined;
183
- } | undefined;
178
+ readonly error?: unknown;
184
179
  }, ParserState>;
185
180
  export declare const route: Route<{
186
181
  readonly model: string;
@@ -1,4 +1,4 @@
1
- import { Effect, Schema, SchemaGetter } from "effect";
1
+ import { Effect, Option, Schema, SchemaGetter } from "effect";
2
2
  import { Route } from "../route/client.js";
3
3
  import { Auth } from "../route/auth.js";
4
4
  import { Endpoint } from "../route/endpoint.js";
@@ -166,7 +166,7 @@ const Event = Schema.Union([
166
166
  status: Schema.String,
167
167
  }),
168
168
  Schema.Struct({ event_type: Schema.Literal("interaction.completed"), interaction: Interaction }),
169
- Schema.Struct({ event_type: Schema.Literal("error"), error: lenient(ErrorDetail) }),
169
+ Schema.Struct({ event_type: Schema.Literal("error"), error: Schema.optionalKey(Schema.Unknown) }),
170
170
  UnknownEvent,
171
171
  ]);
172
172
  // =============================================================================
@@ -463,8 +463,9 @@ const step = Effect.fnUntraced(function* (state, event) {
463
463
  return [state, []];
464
464
  case "error": {
465
465
  const rawBody = encodeJson(event);
466
+ const detail = Option.getOrUndefined(Schema.decodeUnknownOption(ErrorDetail)(event.error));
466
467
  return yield* new AIError({
467
- reason: failureReason(state.route, event.error?.code ?? event.error?.error_type, event.error?.message?.trim() || providerErrorMessage(rawBody) || "Google Interactions stream error", event.error, rawBody),
468
+ reason: failureReason(state.route, detail?.code ?? detail?.error_type, detail?.message?.trim() || providerErrorMessage(rawBody) || "Google Interactions stream error", event.error, rawBody),
468
469
  });
469
470
  }
470
471
  case "interaction.completed": {
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-439",
3
+ "version": "0.0.0-dev-440",
4
4
  "name": "@opencode/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -516,7 +516,7 @@
516
516
  "devDependencies": {
517
517
  "@clack/prompts": "1.0.0-alpha.1",
518
518
  "@effect/platform-node": "4.1.0",
519
- "@opencode/http-recorder": "0.0.0-dev-439",
519
+ "@opencode/http-recorder": "0.0.0-dev-440",
520
520
  "@tsconfig/bun": "1.0.9",
521
521
  "@types/bun": "1.4.3",
522
522
  "@typescript/native": "npm:typescript@7.1.0-beta",
@@ -526,7 +526,7 @@
526
526
  "@aws-sdk/credential-providers": "3.1057.0",
527
527
  "@smithy/eventstream-codec": "4.2.14",
528
528
  "@smithy/util-utf8": "4.2.2",
529
- "@opencode/schema": "0.0.0-dev-439",
529
+ "@opencode/schema": "0.0.0-dev-440",
530
530
  "aws4fetch": "1.0.20",
531
531
  "effect": "4.1.0",
532
532
  "google-auth-library": "10.5.0"