@expiren/opencode-antigravity-auth 1.6.41 → 1.6.42

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/dist/index.js CHANGED
@@ -9127,6 +9127,7 @@ var AccountManager = class _AccountManager {
9127
9127
  savePromiseResolvers = [];
9128
9128
  sessionStartTime = Date.now();
9129
9129
  sessionRequestCounts = /* @__PURE__ */ new Map();
9130
+ sessionUsedAccounts = /* @__PURE__ */ new Set();
9130
9131
  static async loadFromDisk(authFallback) {
9131
9132
  const stored = await loadAccounts();
9132
9133
  return new _AccountManager(authFallback, stored);
@@ -9352,7 +9353,9 @@ var AccountManager = class _AccountManager {
9352
9353
  if (available.length === 0) {
9353
9354
  return null;
9354
9355
  }
9355
- const account = available[this.cursor % available.length];
9356
+ const sessionUsed = available.filter((a) => this.sessionUsedAccounts.has(a.index));
9357
+ const candidates = sessionUsed.length > 0 ? sessionUsed : available;
9358
+ const account = candidates[this.cursor % candidates.length];
9356
9359
  if (!account) {
9357
9360
  return null;
9358
9361
  }
@@ -9374,6 +9377,12 @@ var AccountManager = class _AccountManager {
9374
9377
  account.lastUsed = nowMs();
9375
9378
  }
9376
9379
  }
9380
+ recordSessionUsage(accountIndex) {
9381
+ this.sessionUsedAccounts.add(accountIndex);
9382
+ }
9383
+ wasUsedInSession(accountIndex) {
9384
+ return this.sessionUsedAccounts.has(accountIndex);
9385
+ }
9377
9386
  markRateLimitedWithReason(account, family, headerStyle, model, reason, retryAfterMs, failureTtlMs = 36e5) {
9378
9387
  const now = nowMs();
9379
9388
  if (account.lastFailureTime !== void 0 && now - account.lastFailureTime > failureTtlMs) {
@@ -12494,6 +12503,7 @@ var createAntigravityPlugin = (providerId) => async ({ client, directory }) => {
12494
12503
  pushDebug(`account-switch: ${previousAccountIndex} \u2192 ${account.index}, warmup=${needsCacheWarmup}`);
12495
12504
  }
12496
12505
  previousAccountIndex = account.index;
12506
+ accountManager.recordSessionUsage(account.index);
12497
12507
  if (isDebugEnabled()) {
12498
12508
  logAccountContext("Selected", {
12499
12509
  index: account.index,