pi-antigravity-rotator 1.3.3 → 1.3.4

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
@@ -134,7 +134,7 @@ Each model maintains its own active account. When the proxy needs to rotate a mo
134
134
  | 2 | `7d` | Long reset window is already active for this model | Already ticking, so it is still worth using |
135
135
  | 3 (last) | `fresh` | No active reset window is known for this model yet | Save untouched quota for later if other timed pools exist |
136
136
 
137
- Within the same priority tier, the account with the most remaining quota for that model wins.
137
+ Within the same priority tier, the account with the most remaining quota for that model wins. If multiple accounts tie on priority and quota, rotation advances circularly from the current account so equal candidates share traffic instead of always favoring the first configured match.
138
138
 
139
139
  Timer meanings:
140
140
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-antigravity-rotator",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Multi-account rotation proxy for Google Antigravity with per-model routing, real-time quota tracking, and infringement detection",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/rotator.ts CHANGED
@@ -340,6 +340,7 @@ export class AccountRotator {
340
340
  let best: AccountRuntime | null = null;
341
341
  let bestPriority = Infinity;
342
342
  let bestQuota = -2;
343
+ let bestDistance = Infinity;
343
344
 
344
345
  for (let i = 0; i < this.accounts.length; i++) {
345
346
  if (i === excludeIdx) continue;
@@ -351,10 +352,17 @@ export class AccountRotator {
351
352
  if (!this.isFreshWindowAllowed(account, modelKey)) continue;
352
353
 
353
354
  const priority = this.getModelTimerPriority(account, modelKey);
354
- if (priority < bestPriority || (priority === bestPriority && quota > bestQuota)) {
355
+ const distance =
356
+ excludeIdx >= 0 ? (i - excludeIdx + this.accounts.length) % this.accounts.length : i + 1;
357
+ if (
358
+ priority < bestPriority ||
359
+ (priority === bestPriority && quota > bestQuota) ||
360
+ (priority === bestPriority && quota === bestQuota && distance < bestDistance)
361
+ ) {
355
362
  best = account;
356
363
  bestPriority = priority;
357
364
  bestQuota = quota;
365
+ bestDistance = distance;
358
366
  }
359
367
  }
360
368