@expiren/opencode-antigravity-auth 1.6.32 → 1.6.33

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
@@ -9089,6 +9089,7 @@ var AccountManager = class _AccountManager {
9089
9089
  fingerprintHistory: acc.fingerprintHistory ?? [],
9090
9090
  cachedQuota: acc.cachedQuota,
9091
9091
  cachedQuotaUpdatedAt: acc.cachedQuotaUpdatedAt,
9092
+ dailyRequestCounts: acc.dailyRequestCounts,
9092
9093
  verificationRequired: acc.verificationRequired,
9093
9094
  verificationRequiredAt: acc.verificationRequiredAt,
9094
9095
  verificationRequiredReason: acc.verificationRequiredReason,
@@ -9579,6 +9580,7 @@ var AccountManager = class _AccountManager {
9579
9580
  fingerprintHistory: a.fingerprintHistory?.length ? a.fingerprintHistory : void 0,
9580
9581
  cachedQuota: a.cachedQuota && Object.keys(a.cachedQuota).length > 0 ? a.cachedQuota : void 0,
9581
9582
  cachedQuotaUpdatedAt: a.cachedQuotaUpdatedAt,
9583
+ dailyRequestCounts: a.dailyRequestCounts,
9582
9584
  verificationRequired: a.verificationRequired,
9583
9585
  verificationRequiredAt: a.verificationRequiredAt,
9584
9586
  verificationRequiredReason: a.verificationRequiredReason,
@@ -9701,6 +9703,58 @@ var AccountManager = class _AccountManager {
9701
9703
  account.cachedQuotaUpdatedAt = nowMs();
9702
9704
  }
9703
9705
  }
9706
+ /**
9707
+ * Record a successful API request for an account.
9708
+ * Tracks per model family with daily reset.
9709
+ */
9710
+ recordRequest(accountIndex, family) {
9711
+ const account = this.accounts[accountIndex];
9712
+ if (!account) return;
9713
+ const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
9714
+ if (!account.dailyRequestCounts || account.dailyRequestCounts.date !== today) {
9715
+ account.dailyRequestCounts = { date: today, claude: 0, gemini: 0 };
9716
+ }
9717
+ account.dailyRequestCounts[family]++;
9718
+ account.lastUsed = nowMs();
9719
+ }
9720
+ /**
9721
+ * Get request counts for an account for today.
9722
+ */
9723
+ getDailyRequestCounts(accountIndex) {
9724
+ const account = this.accounts[accountIndex];
9725
+ if (!account?.dailyRequestCounts) return null;
9726
+ const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
9727
+ if (account.dailyRequestCounts.date !== today) return null;
9728
+ return { ...account.dailyRequestCounts };
9729
+ }
9730
+ /**
9731
+ * Get total daily request counts across all accounts for a model family.
9732
+ */
9733
+ getTotalDailyRequests(family) {
9734
+ const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
9735
+ let total = 0;
9736
+ for (const account of this.accounts) {
9737
+ if (account.dailyRequestCounts?.date === today) {
9738
+ total += account.dailyRequestCounts[family];
9739
+ }
9740
+ }
9741
+ return total;
9742
+ }
9743
+ /**
9744
+ * Get a summary of daily request distribution across accounts.
9745
+ * Returns accounts sorted by request count (descending).
9746
+ */
9747
+ getDailyRequestSummary(family) {
9748
+ const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
9749
+ const result = [];
9750
+ for (const account of this.accounts) {
9751
+ const count = account.dailyRequestCounts?.date === today ? account.dailyRequestCounts[family] : 0;
9752
+ if (count > 0) {
9753
+ result.push({ index: account.index, email: account.email, count });
9754
+ }
9755
+ }
9756
+ return result.sort((a, b) => b.count - a.count);
9757
+ }
9704
9758
  isAccountOverSoftQuota(account, family, thresholdPercent, cacheTtlMs, model) {
9705
9759
  return isOverSoftQuotaThreshold(account, family, thresholdPercent, cacheTtlMs, model);
9706
9760
  }
@@ -12592,6 +12646,11 @@ var createAntigravityPlugin = (providerId) => async ({ client, directory }) => {
12592
12646
  }
12593
12647
  const response = await fetch(prepared.request, prepared.init);
12594
12648
  apiRequestCount++;
12649
+ accountManager.recordRequest(account.index, family);
12650
+ const requestCounts = accountManager.getDailyRequestCounts(account.index);
12651
+ if (requestCounts) {
12652
+ pushDebug(`[Quota] account=${account.index} ${family}_today=${requestCounts[family]} total_${family}_today=${accountManager.getTotalDailyRequests(family)}`);
12653
+ }
12595
12654
  pushDebug(`status=${response.status} ${response.statusText} (api_request #${apiRequestCount})`);
12596
12655
  if (response.status === 429 || response.status === 503 || response.status === 529) {
12597
12656
  if (tokenConsumed) {
@@ -12877,6 +12936,12 @@ Alternatively, you can:
12877
12936
  if (apiRequestCount > 1) {
12878
12937
  pushDebug(`[Quota] Total API requests for this user message: ${apiRequestCount} (${apiRequestCount - 1} retries)`);
12879
12938
  }
12939
+ const dailyCounts = accountManager.getDailyRequestCounts(account.index);
12940
+ if (dailyCounts) {
12941
+ pushDebug(`[Quota] Account ${account.index} (${account.email ?? "unknown"}) today: claude=${dailyCounts.claude} gemini=${dailyCounts.gemini}`);
12942
+ }
12943
+ const totalToday = accountManager.getTotalDailyRequests(family);
12944
+ pushDebug(`[Quota] Total ${family} requests today (all accounts): ${totalToday}`);
12880
12945
  return transformedResponse;
12881
12946
  } catch (error) {
12882
12947
  if (tokenConsumed) {