@opencode/ai 0.0.0-dev-20357 → 0.0.0-dev-20359

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.
@@ -27,7 +27,8 @@ const patterns = [
27
27
  /context[_ ]length[_ ]exceeded/i,
28
28
  /context length is only \d+ tokens/i,
29
29
  /input length.*exceeds.*context length/i,
30
- /prompt too long; exceeded (?:max )?context length/i,
30
+ // Z.ai code 1261 arrives as `Prompt too long` or `Prompt 超长`.
31
+ /prompt (?:too long|超长)/i,
31
32
  /too large for model with \d+ maximum context length/i,
32
33
  /prompt has [\d,]+ tokens?, but the configured context size is [\d,]+ tokens?/i,
33
34
  /model_context_window_exceeded/i,
@@ -134,12 +135,13 @@ const GATEWAY_CODE_LABEL = /^[^:\n]+: \[([A-Za-z0-9_.-]+)\]/;
134
135
  const AUTH_TEXT = /incorrect api key provided/i;
135
136
  const RATE_LIMIT_TEXT = /rate increased too quickly|rate[-_\s]?limit|too[_\s]?many[_\s]?requests/i;
136
137
  // Only consulted on 429, where throttles and account caps share a status.
137
- const QUOTA_TEXT = /insufficient[-_\s]?quota|quota[-_\s]?exceeded|budget exceeded|usage limit/i;
138
+ // Z.ai reports balance, plan expiry, plan limits, and plan model access on 429.
139
+ const QUOTA_TEXT = /insufficient[-_\s]?(?:quota|balance)|quota[-_\s]?exceeded|budget exceeded|usage limit|limit exhausted|package has expired|plan does not yet include/i;
138
140
  // Policy rejections without a dedicated code, matched against the provider's own
139
141
  // explanation only. OpenAI reuses `invalid_prompt` for usage-policy rejections while
140
142
  // Bedrock Mantle reuses it for schema validation; Anthropic reports blocked output
141
143
  // under `invalid_request_error`.
142
- const CONTENT_POLICY_TEXT = /violating our usage policy|blocked by content filtering policy|content[-_\s]?policy|rejected as a result of our safety system/i;
144
+ const CONTENT_POLICY_TEXT = /violating our usage policy|blocked by content filtering policy|content[-_\s]?policy|rejected as a result of our safety system|detected potentially unsafe or sensitive content/i;
143
145
  const SERVER_ERROR_TEXT = /\b(?:try again|(?:please |you can )?retry (?:the |this |your )?request|try (?:the |this |your )?request again|(?:currently |temporarily )?at capacity|overloaded|temporarily unavailable|service[-_\s]?unavailable|(?:server|internal)[-_\s]?error|server (?:is )?busy|provider returned (?:an )?error|resource[-_\s]?exhausted|upstream (?:connect|connection|request)|request buffer limit while retrying upstream)\b/i;
144
146
  const Message = Schema.String.check(Schema.isPattern(/\S/));
145
147
  const messageAt = (fields, message) => Schema.Struct(fields).pipe(Schema.decodeTo(Schema.String, {
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-20357",
3
+ "version": "0.0.0-dev-20359",
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-20357",
37
+ "@opencode/http-recorder": "0.0.0-dev-20359",
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-20357",
47
+ "@opencode/schema": "0.0.0-dev-20359",
48
48
  "aws4fetch": "1.0.20",
49
49
  "effect": "4.0.0-rc.112",
50
50
  "google-auth-library": "10.5.0"