@expiren/opencode-antigravity-auth 1.6.22 → 1.6.24
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 +51 -10
- package/dist/index.js.map +2 -2
- package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -1
- package/dist/src/plugin/ui/auth-menu.js +24 -8
- package/dist/src/plugin/ui/auth-menu.js.map +1 -1
- package/dist/src/plugin/ui/quota-status.d.ts +16 -1
- package/dist/src/plugin/ui/quota-status.d.ts.map +1 -1
- package/dist/src/plugin/ui/quota-status.js +48 -5
- package/dist/src/plugin/ui/quota-status.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1638,7 +1638,7 @@ function formatQuotaStatusBadge(status) {
|
|
|
1638
1638
|
return `${ANSI.yellow}[WAIT${suffix}]${ANSI.reset}`;
|
|
1639
1639
|
}
|
|
1640
1640
|
case "EXHAUSTED": {
|
|
1641
|
-
const suffix = status.waitMs ? ` resets in ${formatWaitDuration(status.waitMs)}` : "
|
|
1641
|
+
const suffix = status.waitMs ? ` resets in ${formatWaitDuration(status.waitMs)}` : "";
|
|
1642
1642
|
return `${ANSI.red}[EXHAUSTED${suffix}]${ANSI.reset}`;
|
|
1643
1643
|
}
|
|
1644
1644
|
case "COOLDOWN": {
|
|
@@ -1664,7 +1664,7 @@ function formatQuotaStatusPlain(status) {
|
|
|
1664
1664
|
return `WAIT${suffix}`;
|
|
1665
1665
|
}
|
|
1666
1666
|
case "EXHAUSTED": {
|
|
1667
|
-
const suffix = status.waitMs ? ` resets in ${formatWaitDuration(status.waitMs)}` : "
|
|
1667
|
+
const suffix = status.waitMs ? ` resets in ${formatWaitDuration(status.waitMs)}` : "";
|
|
1668
1668
|
return `EXHAUSTED${suffix}`;
|
|
1669
1669
|
}
|
|
1670
1670
|
case "COOLDOWN": {
|
|
@@ -1679,10 +1679,39 @@ function formatQuotaStatusPlain(status) {
|
|
|
1679
1679
|
}
|
|
1680
1680
|
}
|
|
1681
1681
|
}
|
|
1682
|
+
function classifyOverallQuotaHealth(cachedQuota) {
|
|
1683
|
+
if (!cachedQuota) {
|
|
1684
|
+
return { health: "unknown" };
|
|
1685
|
+
}
|
|
1686
|
+
const QUOTA_KEYS = ["claude", "gemini-pro", "gemini-flash"];
|
|
1687
|
+
let groupsWithData = 0;
|
|
1688
|
+
let exhaustedCount = 0;
|
|
1689
|
+
let maxResetMs;
|
|
1690
|
+
for (const key of QUOTA_KEYS) {
|
|
1691
|
+
const value = cachedQuota[key]?.remainingFraction;
|
|
1692
|
+
if (typeof value !== "number" || !Number.isFinite(value)) continue;
|
|
1693
|
+
groupsWithData++;
|
|
1694
|
+
if (value <= 0) {
|
|
1695
|
+
exhaustedCount++;
|
|
1696
|
+
const resetMs = parseResetTimeToMs(cachedQuota[key]?.resetTime);
|
|
1697
|
+
if (resetMs !== null && (maxResetMs === void 0 || resetMs > maxResetMs)) {
|
|
1698
|
+
maxResetMs = resetMs;
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
if (groupsWithData === 0) return { health: "unknown" };
|
|
1703
|
+
if (exhaustedCount === groupsWithData) return { health: "exhausted", maxResetMs };
|
|
1704
|
+
if (exhaustedCount > 0) return { health: "partial", maxResetMs };
|
|
1705
|
+
return { health: "available" };
|
|
1706
|
+
}
|
|
1682
1707
|
function formatCachedQuotaWithStatus(cachedQuota) {
|
|
1683
1708
|
if (!cachedQuota) {
|
|
1684
1709
|
return void 0;
|
|
1685
1710
|
}
|
|
1711
|
+
const overall = classifyOverallQuotaHealth(cachedQuota);
|
|
1712
|
+
if (overall.health === "exhausted") {
|
|
1713
|
+
return void 0;
|
|
1714
|
+
}
|
|
1686
1715
|
const entries = [
|
|
1687
1716
|
{ key: "claude", label: "Claude" },
|
|
1688
1717
|
{ key: "gemini-pro", label: "Gemini Pro" },
|
|
@@ -1701,9 +1730,9 @@ function formatCachedQuotaWithStatus(cachedQuota) {
|
|
|
1701
1730
|
return [`${label} ${pct}%`];
|
|
1702
1731
|
}
|
|
1703
1732
|
if (status.label === "EXHAUSTED") {
|
|
1704
|
-
return [`${label} ${formatQuotaStatusPlain(status)}`];
|
|
1733
|
+
return [`${label} ${formatQuotaStatusPlain(status).toLowerCase()}`];
|
|
1705
1734
|
}
|
|
1706
|
-
return [`${label} ${formatQuotaStatusPlain(status)} ${pct}%`];
|
|
1735
|
+
return [`${label} ${formatQuotaStatusPlain(status).toLowerCase()} ${pct}%`];
|
|
1707
1736
|
});
|
|
1708
1737
|
return entries.length > 0 ? entries.join(", ") : void 0;
|
|
1709
1738
|
}
|
|
@@ -1727,6 +1756,13 @@ function getStatusBadge(status, account) {
|
|
|
1727
1756
|
const cooldownStatus = buildCooldownStatus(account.cooldownMs, account.cooldownReason);
|
|
1728
1757
|
return ` ${formatQuotaStatusBadge(cooldownStatus)}`;
|
|
1729
1758
|
}
|
|
1759
|
+
if (status === "active" && account?.cachedQuota) {
|
|
1760
|
+
const overall = classifyOverallQuotaHealth(account.cachedQuota);
|
|
1761
|
+
if (overall.health === "exhausted") {
|
|
1762
|
+
const suffix = overall.maxResetMs ? ` resets in ${formatWaitDuration(overall.maxResetMs)}` : "";
|
|
1763
|
+
return ` ${ANSI.red}[exhausted${suffix}]${ANSI.reset}`;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1730
1766
|
switch (status) {
|
|
1731
1767
|
case "active":
|
|
1732
1768
|
return ` ${ANSI.green}[active]${ANSI.reset}`;
|
|
@@ -1756,17 +1792,22 @@ async function showAuthMenu(accounts) {
|
|
|
1756
1792
|
...accounts.slice().sort((a, b) => {
|
|
1757
1793
|
const statusOrder = (acc) => {
|
|
1758
1794
|
if (acc.isCurrentAccount) return 0;
|
|
1759
|
-
if (acc.status === "active")
|
|
1760
|
-
|
|
1761
|
-
|
|
1795
|
+
if (acc.status === "active") {
|
|
1796
|
+
const overall = classifyOverallQuotaHealth(acc.cachedQuota);
|
|
1797
|
+
if (overall.health === "exhausted") return 2;
|
|
1798
|
+
return 1;
|
|
1799
|
+
}
|
|
1800
|
+
if (acc.status === "rate-limited") return 3;
|
|
1801
|
+
return 4;
|
|
1762
1802
|
};
|
|
1763
1803
|
return statusOrder(a) - statusOrder(b);
|
|
1764
|
-
}).map((account) => {
|
|
1804
|
+
}).map((account, displayIndex) => {
|
|
1805
|
+
const displayNum = displayIndex + 1;
|
|
1765
1806
|
const statusBadge = getStatusBadge(account.status, account);
|
|
1766
1807
|
const currentBadge = account.isCurrentAccount ? ` ${ANSI.cyan}[current]${ANSI.reset}` : "";
|
|
1767
1808
|
const disabledBadge = account.enabled === false ? ` ${ANSI.red}[disabled]${ANSI.reset}` : "";
|
|
1768
|
-
const baseLabel = account.email || `Account ${
|
|
1769
|
-
const numbered = `${
|
|
1809
|
+
const baseLabel = account.email || `Account ${displayNum}`;
|
|
1810
|
+
const numbered = `${displayNum}. ${baseLabel}`;
|
|
1770
1811
|
const fullLabel = `${numbered}${currentBadge}${statusBadge}${disabledBadge}`;
|
|
1771
1812
|
return {
|
|
1772
1813
|
label: fullLabel,
|