@opencode/ai 0.0.0-dev-20356 → 0.0.0-dev-20358

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.
@@ -130,6 +130,8 @@ const CONTENT_POLICY_CODES = new Set([
130
130
  // OpenCode Zen replaces upstream codes outside its allow-list but keeps the original
131
131
  // as a `[code]` label at the start of the rewritten message.
132
132
  const GATEWAY_CODE_LABEL = /^[^:\n]+: \[([A-Za-z0-9_.-]+)\]/;
133
+ // xAI reports an invalid API key as HTTP 400 with the generic `invalid-argument` code.
134
+ const AUTH_TEXT = /incorrect api key provided/i;
133
135
  const RATE_LIMIT_TEXT = /rate increased too quickly|rate[-_\s]?limit|too[_\s]?many[_\s]?requests/i;
134
136
  // Only consulted on 429, where throttles and account caps share a status.
135
137
  const QUOTA_TEXT = /insufficient[-_\s]?quota|quota[-_\s]?exceeded|budget exceeded|usage limit/i;
@@ -190,7 +192,10 @@ export function classifyProviderFailure(input) {
190
192
  codes.some((code) => QUOTA_CODES.has(code)) ||
191
193
  (input.status === 429 && QUOTA_TEXT.test(text)))
192
194
  return new QuotaExceededError(details);
193
- if (input.status === 401 || input.status === 403 || codes.some((code) => AUTH_CODES.has(code)))
195
+ if (input.status === 401 ||
196
+ input.status === 403 ||
197
+ codes.some((code) => AUTH_CODES.has(code)) ||
198
+ (input.status === 400 && AUTH_TEXT.test(text)))
194
199
  return new AuthenticationError(details);
195
200
  if (input.status === 429 ||
196
201
  codes.some((code) => code.includes("rate_limit") || code === "too_many_requests" || code === "throttlingexception") ||
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-20356",
3
+ "version": "0.0.0-dev-20358",
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-20356",
37
+ "@opencode/http-recorder": "0.0.0-dev-20358",
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-20356",
47
+ "@opencode/schema": "0.0.0-dev-20358",
48
48
  "aws4fetch": "1.0.20",
49
49
  "effect": "4.0.0-rc.112",
50
50
  "google-auth-library": "10.5.0"