@smart-coders-hq/opencode-model-fallback 1.0.6 → 1.1.1

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/README.md CHANGED
@@ -227,7 +227,7 @@ To see the full event stream (including `event.received` and `retry.nomatch`), s
227
227
  ```bash
228
228
  bun install
229
229
  bun run lint # lint checks
230
- bun test # 137 tests across 11 files
230
+ bun test # 145 tests across 11 files
231
231
  bunx tsc --noEmit # type check
232
232
  bun run build # build to dist/
233
233
  ```
package/dist/index.js CHANGED
@@ -2861,13 +2861,16 @@ import { homedir as homedir2 } from "os";
2861
2861
  import { join as join2 } from "path";
2862
2862
  var DEFAULT_PATTERNS = [
2863
2863
  "rate limit",
2864
+ "ratelimit",
2864
2865
  "usage limit",
2865
2866
  "too many requests",
2866
2867
  "quota exceeded",
2867
2868
  "overloaded",
2868
2869
  "capacity exceeded",
2869
2870
  "credits exhausted",
2871
+ "insufficient credit",
2870
2872
  "billing limit",
2873
+ "resource exhausted",
2871
2874
  "429"
2872
2875
  ];
2873
2876
  var DEFAULT_LOG_PATH = join2(homedir2(), ".local/share/opencode/logs/model-fallback.log");
@@ -3201,13 +3204,23 @@ function matchesAnyPattern(text, patterns) {
3201
3204
  }
3202
3205
 
3203
3206
  // src/detection/classifier.ts
3204
- var RATE_LIMIT_PATTERNS = ["rate limit", "ratelimit", "too many requests", "usage limit", "429"];
3207
+ var RATE_LIMIT_PATTERNS = [
3208
+ "rate limit",
3209
+ "ratelimit",
3210
+ "too many requests",
3211
+ "usage limit",
3212
+ "resource exhausted",
3213
+ "resource_exhausted",
3214
+ "429"
3215
+ ];
3205
3216
  var QUOTA_PATTERNS = [
3206
3217
  "quota exceeded",
3207
3218
  "credits exhausted",
3208
3219
  "billing limit",
3209
3220
  "credit limit",
3210
3221
  "insufficient quota",
3222
+ "insufficient credit",
3223
+ "insufficient credits",
3211
3224
  "out of credits"
3212
3225
  ];
3213
3226
  var OVERLOADED_PATTERNS = [
@@ -3232,10 +3245,10 @@ function classifyError(message, statusCode) {
3232
3245
  if (statusCode === 429 || matchesAnyPattern(text, RATE_LIMIT_PATTERNS)) {
3233
3246
  return "rate_limit";
3234
3247
  }
3235
- if (matchesAnyPattern(text, QUOTA_PATTERNS)) {
3248
+ if (statusCode === 402 || matchesAnyPattern(text, QUOTA_PATTERNS)) {
3236
3249
  return "quota_exceeded";
3237
3250
  }
3238
- if (matchesAnyPattern(text, OVERLOADED_PATTERNS)) {
3251
+ if (statusCode === 529 || matchesAnyPattern(text, OVERLOADED_PATTERNS)) {
3239
3252
  return "overloaded";
3240
3253
  }
3241
3254
  if (matchesAnyPattern(text, TIMEOUT_PATTERNS)) {
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/config/defaults.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,gBAAgB,UAU5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAmE,CAAC;AAEjG,eAAO,MAAM,cAAc,EAAE,YAkB5B,CAAC"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/config/defaults.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,gBAAgB,UAa5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAmE,CAAC;AAEjG,eAAO,MAAM,cAAc,EAAE,YAkB5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"classifier.d.ts","sourceRoot":"","sources":["../../../src/detection/classifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAkCjD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,aAAa,CAsBjF"}
1
+ {"version":3,"file":"classifier.d.ts","sourceRoot":"","sources":["../../../src/detection/classifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA4CjD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,aAAa,CAsBjF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart-coders-hq/opencode-model-fallback",
3
- "version": "1.0.6",
3
+ "version": "1.1.1",
4
4
  "description": "Ordered model fallback chains with health tracking for OpenCode",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/plugin.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "id": "opencode-model-fallback",
4
4
  "name": "Model Fallback",
5
5
  "description": "Ordered model fallback chains with health tracking and preemptive redirects for OpenCode",
6
- "version": "1.0.6",
6
+ "version": "1.1.1",
7
7
  "entry": "dist/index.js",
8
8
  "links": [
9
9
  {