@opencode/ai 0.0.0-dev-20279 → 0.0.0-dev-20281
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/route/executor.js +12 -3
- package/package.json +3 -3
package/dist/route/executor.js
CHANGED
|
@@ -69,10 +69,19 @@ const decodeProviderBody = Schema.decodeUnknownOption(Schema.fromJsonString(Sche
|
|
|
69
69
|
message: Schema.optionalKey(Schema.String),
|
|
70
70
|
error: Schema.optionalKey(Schema.Struct({ message: Schema.optionalKey(Schema.String) })),
|
|
71
71
|
})));
|
|
72
|
+
const MAX_BODY_CHARS = 2000;
|
|
73
|
+
// Without a recognized message, show the raw body so the provider's explanation is never dropped.
|
|
72
74
|
const providerMessage = (status, body) => {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
const fallback = `Provider request failed with HTTP ${status}`;
|
|
76
|
+
const text = body?.trim() ?? "";
|
|
77
|
+
const decoded = Option.getOrUndefined(decodeProviderBody(text));
|
|
78
|
+
const message = [decoded?.error?.message, decoded?.message].find((message) => message?.trim());
|
|
79
|
+
if (message)
|
|
80
|
+
return message;
|
|
81
|
+
// Gateway and proxy HTML error pages are markup, not an explanation.
|
|
82
|
+
if (!text || /^<(?:!doctype|html)/i.test(text))
|
|
83
|
+
return fallback;
|
|
84
|
+
return `${fallback}: ${text.length > MAX_BODY_CHARS ? `${text.slice(0, MAX_BODY_CHARS)}…` : text}`;
|
|
76
85
|
};
|
|
77
86
|
const statusError = (response) => Effect.gen(function* () {
|
|
78
87
|
if (response.status < 400)
|
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-20281",
|
|
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-20281",
|
|
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-20281",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.0-rc.112",
|
|
50
50
|
"google-auth-library": "10.5.0"
|