@expiren/opencode-antigravity-auth 1.6.21 → 1.6.23
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 +55 -1
- 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 +29 -2
- 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 +53 -1
- package/dist/src/plugin/ui/quota-status.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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 overall.maxResetMs ? `resets in ${formatWaitDuration(overall.maxResetMs)}` : void 0;
|
|
1714
|
+
}
|
|
1686
1715
|
const entries = [
|
|
1687
1716
|
{ key: "claude", label: "Claude" },
|
|
1688
1717
|
{ key: "gemini-pro", label: "Gemini Pro" },
|
|
@@ -1694,9 +1723,15 @@ function formatCachedQuotaWithStatus(cachedQuota) {
|
|
|
1694
1723
|
}
|
|
1695
1724
|
const pct = Math.round(Math.max(0, Math.min(1, value)) * 100);
|
|
1696
1725
|
const status = classifyGroupStatus(cachedQuota[key]);
|
|
1726
|
+
if (status.label === "READY" && pct >= 100) {
|
|
1727
|
+
return [];
|
|
1728
|
+
}
|
|
1697
1729
|
if (status.label === "READY") {
|
|
1698
1730
|
return [`${label} ${pct}%`];
|
|
1699
1731
|
}
|
|
1732
|
+
if (status.label === "EXHAUSTED") {
|
|
1733
|
+
return [`${label} ${formatQuotaStatusPlain(status)}`];
|
|
1734
|
+
}
|
|
1700
1735
|
return [`${label} ${formatQuotaStatusPlain(status)} ${pct}%`];
|
|
1701
1736
|
});
|
|
1702
1737
|
return entries.length > 0 ? entries.join(", ") : void 0;
|
|
@@ -1721,6 +1756,13 @@ function getStatusBadge(status, account) {
|
|
|
1721
1756
|
const cooldownStatus = buildCooldownStatus(account.cooldownMs, account.cooldownReason);
|
|
1722
1757
|
return ` ${formatQuotaStatusBadge(cooldownStatus)}`;
|
|
1723
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
|
+
}
|
|
1724
1766
|
switch (status) {
|
|
1725
1767
|
case "active":
|
|
1726
1768
|
return ` ${ANSI.green}[active]${ANSI.reset}`;
|
|
@@ -1747,7 +1789,19 @@ async function showAuthMenu(accounts) {
|
|
|
1747
1789
|
{ label: "Configure models in opencode.json", value: { type: "configure-models" }, color: "cyan" },
|
|
1748
1790
|
{ label: "", value: { type: "cancel" }, separator: true },
|
|
1749
1791
|
{ label: "Accounts", value: { type: "cancel" }, kind: "heading" },
|
|
1750
|
-
...accounts.
|
|
1792
|
+
...accounts.slice().sort((a, b) => {
|
|
1793
|
+
const statusOrder = (acc) => {
|
|
1794
|
+
if (acc.isCurrentAccount) return 0;
|
|
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;
|
|
1802
|
+
};
|
|
1803
|
+
return statusOrder(a) - statusOrder(b);
|
|
1804
|
+
}).map((account) => {
|
|
1751
1805
|
const statusBadge = getStatusBadge(account.status, account);
|
|
1752
1806
|
const currentBadge = account.isCurrentAccount ? ` ${ANSI.cyan}[current]${ANSI.reset}` : "";
|
|
1753
1807
|
const disabledBadge = account.enabled === false ? ` ${ANSI.red}[disabled]${ANSI.reset}` : "";
|