@opencode-ai/ai 0.0.0-next-17018 → 0.0.0-next-17020
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 +9 -3
- package/package.json +3 -3
package/dist/route/executor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cause, Context, Effect, Layer } from "effect";
|
|
1
|
+
import { Cause, Context, Effect, Layer, Option, Schema } from "effect";
|
|
2
2
|
import { FetchHttpClient, Headers, HttpClient, HttpClientError, HttpClientRequest, HttpClientResponse, } from "effect/unstable/http";
|
|
3
3
|
import { HttpContext, HttpRateLimitDetails, HttpRequestDetails, HttpResponseDetails, AIError, TransportReason, } from "../schema";
|
|
4
4
|
import { classifyProviderFailure } from "../provider-error";
|
|
@@ -143,9 +143,15 @@ const responseBody = (body, request) => {
|
|
|
143
143
|
return { body: redacted };
|
|
144
144
|
return { body: redacted.slice(0, BODY_LIMIT), bodyTruncated: true };
|
|
145
145
|
};
|
|
146
|
+
const decodeProviderBody = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Struct({
|
|
147
|
+
message: Schema.optionalKey(Schema.String),
|
|
148
|
+
error: Schema.optionalKey(Schema.Struct({ message: Schema.optionalKey(Schema.String) })),
|
|
149
|
+
})));
|
|
146
150
|
const providerMessage = (status, body) => {
|
|
147
|
-
if (body.body && body.body.length <= 500)
|
|
148
|
-
|
|
151
|
+
if (body.body && body.body.length <= 500) {
|
|
152
|
+
const decoded = Option.getOrUndefined(decodeProviderBody(body.body));
|
|
153
|
+
return `Provider request failed with HTTP ${status}: ${decoded?.error?.message ?? decoded?.message ?? body.body}`;
|
|
154
|
+
}
|
|
149
155
|
return `Provider request failed with HTTP ${status}`;
|
|
150
156
|
};
|
|
151
157
|
const responseHttp = (input) => new HttpContext({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-17020",
|
|
4
4
|
"name": "@opencode-ai/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-beta.101",
|
|
33
|
-
"@opencode-ai/http-recorder": "0.0.0-next-
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-next-17020",
|
|
34
34
|
"@tsconfig/bun": "1.0.9",
|
|
35
35
|
"@types/bun": "1.3.13",
|
|
36
36
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@smithy/eventstream-codec": "4.2.14",
|
|
41
41
|
"@smithy/util-utf8": "4.2.2",
|
|
42
|
-
"@opencode-ai/schema": "0.0.0-next-
|
|
42
|
+
"@opencode-ai/schema": "0.0.0-next-17020",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-beta.101",
|
|
45
45
|
"google-auth-library": "10.5.0"
|