tuxevil-rotator 4.4.7 → 4.4.8

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/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [4.4.8] - 2026-11-23
6
+
7
+ ### Fixed
8
+
9
+ - **Invalid-provider polling & kickstart flag loop**: Stop `pollAccountQuotaOnce()`, `kickstartAllFreshTimers()`, and `kickstartTimerForAccount()` from repeatedly hitting providers already marked invalid or disabled on an account, emit `reportQuotaPollFlag()` only on valid-to-invalid transitions, and clear `invalidProviders` across all providers when updated credentials are saved via `addOrUpdateAccount()`.
10
+ - **Telemetry receiver aggregation & live flag deduplication**: Fix double-counting of `flags.totalFlags` / `daily[].flags` (using `-flags.jsonl` as the canonical source), compute `totalRequestsAcrossAll` by summing each unique install's cumulative maximum instead of summing repeated hourly heartbeats, and deduplicate repeating flag loops within a 24-hour sliding window (`FLAG_DEDUP_WINDOW_MS`) with startup warm-up.
11
+
12
+ ### Changed
13
+
14
+ - **Telemetry receiver UX**: Redesign `/dashboard`, `/notifications`, and `/stats` in a unified cyberpunk/retro-console UI with tabbed views (`Overview`, `Flags & Forensics`, `Models & USD`, `Installs`), interactive incident/node inspector drawers, concentration alerts, semver notification targeting simulator, quick templates/expiry presets, shared token SSO, keyboard shortcuts, and enriched `/v1/stats` & `/v1/public-stats` payloads.
15
+
16
+ ### Security
17
+
18
+ - **Telemetry receiver hardening**: Fix unauthenticated Stored XSS in `/dashboard` (`proCount`/`freeCount`/`flaggedCount`/`disabledCount` validation + escaping), prevent `NaN` savings poisoning via prototype keys in `MODEL_PRICING` and `featuresCount`, enforce constant-time `timingSafeEqual` token comparison with `401` brute-force lockout, restrict `X-Forwarded-For` parsing to `TRUSTED_PROXIES` with bounded rate-limit maps and daily JSONL size caps, add CSP/XFO/nosniff/SRI headers and scoped CORS, add HTTP/body anti-Slowloris timeouts, enforce absolute `http(s)` notification URLs, write `notifications.json` atomically, and add incremental JSONL file caching.
19
+
5
20
  ## [4.4.7] - 2026-11-23
6
21
 
7
22
  ### Changed
package/README.md CHANGED
@@ -55,6 +55,7 @@ Originally built as a multi-account rotator for Google Antigravity. It now gener
55
55
 
56
56
  ## Current Model Update
57
57
 
58
+ - **v4.4.8: Invalid-provider flag loop fix & telemetry receiver overhaul**: Stop quota polling and auto-warmup kickstarts from looping every 5 minutes on already-invalidated or disabled providers (emitting flag telemetry only on transitions and clearing invalidation across all providers on re-auth). Overhaul the standalone telemetry receiver with a cyberpunk/retro-console UX across `/dashboard`, `/notifications`, and `/stats`, fix flag double-counting and request inflation, add 24h sliding-window flag-loop deduplication, and harden security (Stored XSS fix, prototype-safe pricing, constant-time auth + brute-force lockout, trusted-proxy rate limiting, CSP/SRI, scoped CORS, and HTTP timeouts). ([Release notes](https://github.com/tuxevil/tuxevil-rotator/releases/tag/v4.4.8))
58
59
  - **v4.4.7: Artificial Analysis scores, static specs, and dashboard colors**: Refresh the Artificial Analysis Intelligence Index routing-quality snapshot (`2026-11-23`) with exact per-effort scores for Gemini 4 (`neon`, `hydrogen`, `carbon`, `argon`), Gemini 3.8 Flash, Claude 5.5, and OpenAI `gpt-6.1`/`gpt-6.2`, and add static model specs, context windows, and distinct dashboard chart colors for Gemini 4, Claude 5.5, GPT-6.1/6.2, and newer Ollama Cloud models. ([Release notes](https://github.com/tuxevil/tuxevil-rotator/releases/tag/v4.4.7))
59
60
  - **v4.4.6: Model pricing refresh**: Add official November 2026 pricing and family fallbacks for Gemini 4 (`neon`, `hydrogen`, `carbon`, `argon`), Claude 5.5 (`opus`, `sonnet`), OpenAI `gpt-6.1`/`gpt-6.2`, and newly published Ollama Cloud models in both the rotator and standalone telemetry receiver. ([Release notes](https://github.com/tuxevil/tuxevil-rotator/releases/tag/v4.4.6))
60
61
  - **v4.4.5: Antigravity reasoning effort metadata**: Publish `meta.reasoning_efforts` and `meta.default_reasoning_effort` for Antigravity `effortRouting` aliases and adaptive `-tiered` Gemini models in `GET /v1/models`, and merge discovered effort controls in the OpenCode discovery plugin so Gemini and Claude models expose effort variants. ([Release notes](https://github.com/tuxevil/tuxevil-rotator/releases/tag/v4.4.5))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuxevil-rotator",
3
- "version": "4.4.7",
3
+ "version": "4.4.8",
4
4
  "description": "Multi-provider, multi-account AI proxy rotator with per-model routing, real-time quota tracking, and infringement detection (Google Antigravity, Ollama Cloud)",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/rotator.ts CHANGED
@@ -1091,16 +1091,23 @@ export class AccountRotator {
1091
1091
  setProviderCooldown: (acc, providerId, durationMs) =>
1092
1092
  this.setProviderCooldown(acc, providerId, durationMs),
1093
1093
  };
1094
- // Parent-account model: poll quota for every provider credential
1094
+ // Parent-account model: poll quota for every active, valid provider credential
1095
1095
  // the account holds (Google OAuth pools + Ollama usage pools).
1096
1096
  const providerIds = new Set<string>(
1097
1097
  (account.config.credentials ?? []).map((c) => c.provider),
1098
1098
  );
1099
1099
  if (providerIds.size === 0) providerIds.add(primaryProviderId(account.config));
1100
1100
  for (const pid of providerIds) {
1101
+ if (account.invalidProviders?.[pid]) continue;
1102
+ if (this.isProviderOffForAccount(account, pid)) continue;
1103
+ const providerQuotaCtx: QuotaFetchContext = {
1104
+ ...quotaCtx,
1105
+ reportQuotaPollFlag: (acc, statusCode, errorText) =>
1106
+ this.reportQuotaPollFlag(acc, statusCode, errorText, "quota-poll", pid),
1107
+ };
1101
1108
  try {
1102
1109
  await this.ensureValidTokenForProvider(account, pid);
1103
- await getProviderAdapter(pid).fetchQuota(account, quotaCtx);
1110
+ await getProviderAdapter(pid).fetchQuota(account, providerQuotaCtx);
1104
1111
  if (pid === DEFAULT_PROVIDER) {
1105
1112
  this.migratePersistedQuotaStateKeys();
1106
1113
  }
@@ -1233,7 +1240,11 @@ export class AccountRotator {
1233
1240
  statusCode: number,
1234
1241
  errorText: string,
1235
1242
  model = "quota-poll",
1243
+ providerId?: string,
1236
1244
  ): void {
1245
+ // Only emit flag telemetry on the transition into an invalid state; never
1246
+ // re-emit on repeated polls/kickstarts for an already-invalidated provider.
1247
+ if (providerId && account.invalidProviders?.[providerId]) return;
1237
1248
  const modelKey = model === "quota-poll" ? account.quota[0]?.modelKey ?? model : model;
1238
1249
  const ctx = this.getFlagContext(account, modelKey);
1239
1250
  const lower = errorText.toLowerCase();
@@ -4696,15 +4707,20 @@ export class AccountRotator {
4696
4707
  existing.consecutiveErrors = 0;
4697
4708
  existing.accessToken = null;
4698
4709
  existing.tokenExpires = 0;
4699
- if (receivesCodexCredential) {
4710
+ const updatedProviders = new Set<string>(
4711
+ (accountConfig.credentials ?? []).map((credential) => credential.provider),
4712
+ );
4713
+ if (accountConfig.refreshToken) updatedProviders.add(DEFAULT_PROVIDER);
4714
+ if (receivesCodexCredential) updatedProviders.add("openai-codex");
4715
+ for (const pid of updatedProviders) {
4700
4716
  if (existing.invalidProviders) {
4701
- delete existing.invalidProviders["openai-codex"];
4717
+ delete existing.invalidProviders[pid];
4702
4718
  if (Object.keys(existing.invalidProviders).length === 0) {
4703
4719
  delete existing.invalidProviders;
4704
4720
  }
4705
4721
  }
4706
4722
  if (existing.providerTokens) {
4707
- delete existing.providerTokens["openai-codex"];
4723
+ delete existing.providerTokens[pid];
4708
4724
  if (Object.keys(existing.providerTokens).length === 0) {
4709
4725
  delete existing.providerTokens;
4710
4726
  }
@@ -5089,6 +5105,14 @@ export class AccountRotator {
5089
5105
  error: "provider turned off on the Models page",
5090
5106
  };
5091
5107
  }
5108
+ if (account.invalidProviders?.[target.providerId]) {
5109
+ return {
5110
+ ok: false,
5111
+ status: 409,
5112
+ upstreamModel: target.upstreamModel,
5113
+ error: `${target.providerId} credential requires re-authentication`,
5114
+ };
5115
+ }
5092
5116
  if (isProviderModelOff(this, target.providerId, target.upstreamModel)) {
5093
5117
  return {
5094
5118
  ok: false,
@@ -5278,7 +5302,7 @@ export class AccountRotator {
5278
5302
  // Provider-scoped invalidation: even with account-enforcement language
5279
5303
  // in the response, only the specific provider credential is invalidated.
5280
5304
  // Sibling providers on the same account remain routable.
5281
- this.reportQuotaPollFlag(account, response.status, errorText, upstreamModel);
5305
+ this.reportQuotaPollFlag(account, response.status, errorText, upstreamModel, target.providerId);
5282
5306
  this.markProviderInvalid(account, target.providerId, failure.description);
5283
5307
  } else {
5284
5308
  account.lastError = failure.description;
@@ -5333,11 +5357,14 @@ export class AccountRotator {
5333
5357
  return { ok: false, error: "account not found", results: [] };
5334
5358
  }
5335
5359
 
5336
- const idlePools = account.quota.filter(
5337
- (q) =>
5338
- this.isQuotaIdleForKickstart(q) &&
5339
- this.getKickstartTarget(account, q.modelKey) !== null,
5340
- );
5360
+ const idlePools = account.quota.filter((q) => {
5361
+ if (!this.isQuotaIdleForKickstart(q)) return false;
5362
+ const target = this.getKickstartTarget(account, q.modelKey);
5363
+ if (!target) return false;
5364
+ if (account.invalidProviders?.[target.providerId]) return false;
5365
+ if (this.isProviderOffForAccount(account, target.providerId)) return false;
5366
+ return true;
5367
+ });
5341
5368
  if (idlePools.length === 0) {
5342
5369
  return { ok: true, results: [] };
5343
5370
  }