@expiren/opencode-antigravity-auth 1.6.24 → 1.6.26

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
@@ -1762,6 +1762,9 @@ function getStatusBadge(status, account) {
1762
1762
  const suffix = overall.maxResetMs ? ` resets in ${formatWaitDuration(overall.maxResetMs)}` : "";
1763
1763
  return ` ${ANSI.red}[exhausted${suffix}]${ANSI.reset}`;
1764
1764
  }
1765
+ if (overall.health === "partial") {
1766
+ return ` ${ANSI.yellow}[limited]${ANSI.reset}`;
1767
+ }
1765
1768
  }
1766
1769
  switch (status) {
1767
1770
  case "active":
@@ -1776,6 +1779,75 @@ function getStatusBadge(status, account) {
1776
1779
  return "";
1777
1780
  }
1778
1781
  }
1782
+ function getAccountTier(acc) {
1783
+ if (acc.isCurrentAccount) return 0;
1784
+ if (acc.enabled === false) return 6;
1785
+ if (acc.status === "active") {
1786
+ const overall = classifyOverallQuotaHealth(acc.cachedQuota);
1787
+ if (overall.health === "exhausted") return 3;
1788
+ if (overall.health === "partial") return 2;
1789
+ return 1;
1790
+ }
1791
+ if (acc.status === "rate-limited") return 4;
1792
+ return 5;
1793
+ }
1794
+ function getHealthLabel(acc) {
1795
+ if (acc.enabled === false) return "disabled";
1796
+ if (acc.status === "active") {
1797
+ const overall = classifyOverallQuotaHealth(acc.cachedQuota);
1798
+ if (overall.health === "exhausted") return "exhausted";
1799
+ if (overall.health === "partial") return "limited";
1800
+ return "active";
1801
+ }
1802
+ if (acc.status === "rate-limited") return "rate-limited";
1803
+ if (acc.status === "expired") return "expired";
1804
+ return "other";
1805
+ }
1806
+ function buildAccountSummary(accounts) {
1807
+ const counts = {};
1808
+ for (const acc of accounts) {
1809
+ const label = getHealthLabel(acc);
1810
+ counts[label] = (counts[label] ?? 0) + 1;
1811
+ }
1812
+ const order = ["active", "limited", "exhausted", "rate-limited", "expired", "disabled", "other"];
1813
+ const parts = order.filter((label) => (counts[label] ?? 0) > 0).map((label) => `${counts[label]} ${label}`);
1814
+ return parts.length > 0 ? `Accounts (${parts.join(", ")})` : "Accounts";
1815
+ }
1816
+ function buildAccountHint(account) {
1817
+ if (account.quotaSummary) {
1818
+ return account.quotaSummary;
1819
+ }
1820
+ if (account.lastUsed) {
1821
+ return `used ${formatRelativeTime(account.lastUsed)}`;
1822
+ }
1823
+ return "";
1824
+ }
1825
+ function buildAccountMenuItems(accounts) {
1826
+ const sorted = accounts.slice().sort((a, b) => getAccountTier(a) - getAccountTier(b));
1827
+ const items = [];
1828
+ let prevTier = -1;
1829
+ for (let i = 0; i < sorted.length; i++) {
1830
+ const account = sorted[i];
1831
+ const tier = getAccountTier(account);
1832
+ if (prevTier !== -1 && tier !== prevTier) {
1833
+ items.push({ label: "", value: { type: "cancel" }, separator: true });
1834
+ }
1835
+ prevTier = tier;
1836
+ const displayNum = i + 1;
1837
+ const statusBadge = getStatusBadge(account.status, account);
1838
+ const currentBadge = account.isCurrentAccount ? ` ${ANSI.cyan}[current]${ANSI.reset}` : "";
1839
+ const disabledBadge = account.enabled === false ? ` ${ANSI.red}[disabled]${ANSI.reset}` : "";
1840
+ const baseLabel = account.email || `Account ${displayNum}`;
1841
+ const numbered = `${displayNum}. ${baseLabel}`;
1842
+ const fullLabel = `${numbered}${currentBadge}${statusBadge}${disabledBadge}`;
1843
+ items.push({
1844
+ label: fullLabel,
1845
+ hint: buildAccountHint(account),
1846
+ value: { type: "select-account", account }
1847
+ });
1848
+ }
1849
+ return items;
1850
+ }
1779
1851
  async function showAuthMenu(accounts) {
1780
1852
  const items = [
1781
1853
  { label: "Actions", value: { type: "cancel" }, kind: "heading" },
@@ -1788,33 +1860,8 @@ async function showAuthMenu(accounts) {
1788
1860
  { label: "Verify all accounts", value: { type: "verify-all" }, color: "cyan" },
1789
1861
  { label: "Configure models in opencode.json", value: { type: "configure-models" }, color: "cyan" },
1790
1862
  { label: "", value: { type: "cancel" }, separator: true },
1791
- { label: "Accounts", value: { type: "cancel" }, kind: "heading" },
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, displayIndex) => {
1805
- const displayNum = displayIndex + 1;
1806
- const statusBadge = getStatusBadge(account.status, account);
1807
- const currentBadge = account.isCurrentAccount ? ` ${ANSI.cyan}[current]${ANSI.reset}` : "";
1808
- const disabledBadge = account.enabled === false ? ` ${ANSI.red}[disabled]${ANSI.reset}` : "";
1809
- const baseLabel = account.email || `Account ${displayNum}`;
1810
- const numbered = `${displayNum}. ${baseLabel}`;
1811
- const fullLabel = `${numbered}${currentBadge}${statusBadge}${disabledBadge}`;
1812
- return {
1813
- label: fullLabel,
1814
- hint: account.quotaSummary ?? (account.lastUsed ? `used ${formatRelativeTime(account.lastUsed)}` : ""),
1815
- value: { type: "select-account", account }
1816
- };
1817
- }),
1863
+ { label: buildAccountSummary(accounts), value: { type: "cancel" }, kind: "heading" },
1864
+ ...buildAccountMenuItems(accounts),
1818
1865
  { label: "", value: { type: "cancel" }, separator: true },
1819
1866
  { label: "Danger zone", value: { type: "cancel" }, kind: "heading" },
1820
1867
  { label: "Delete all accounts", value: { type: "delete-all" }, color: "red" }