@expiren/opencode-antigravity-auth 1.6.25 → 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
|
@@ -1779,6 +1779,75 @@ function getStatusBadge(status, account) {
|
|
|
1779
1779
|
return "";
|
|
1780
1780
|
}
|
|
1781
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
|
+
}
|
|
1782
1851
|
async function showAuthMenu(accounts) {
|
|
1783
1852
|
const items = [
|
|
1784
1853
|
{ label: "Actions", value: { type: "cancel" }, kind: "heading" },
|
|
@@ -1791,34 +1860,8 @@ async function showAuthMenu(accounts) {
|
|
|
1791
1860
|
{ label: "Verify all accounts", value: { type: "verify-all" }, color: "cyan" },
|
|
1792
1861
|
{ label: "Configure models in opencode.json", value: { type: "configure-models" }, color: "cyan" },
|
|
1793
1862
|
{ label: "", value: { type: "cancel" }, separator: true },
|
|
1794
|
-
{ label:
|
|
1795
|
-
...accounts
|
|
1796
|
-
const statusOrder = (acc) => {
|
|
1797
|
-
if (acc.isCurrentAccount) return 0;
|
|
1798
|
-
if (acc.status === "active") {
|
|
1799
|
-
const overall = classifyOverallQuotaHealth(acc.cachedQuota);
|
|
1800
|
-
if (overall.health === "exhausted") return 3;
|
|
1801
|
-
if (overall.health === "partial") return 2;
|
|
1802
|
-
return 1;
|
|
1803
|
-
}
|
|
1804
|
-
if (acc.status === "rate-limited") return 4;
|
|
1805
|
-
return 5;
|
|
1806
|
-
};
|
|
1807
|
-
return statusOrder(a) - statusOrder(b);
|
|
1808
|
-
}).map((account, displayIndex) => {
|
|
1809
|
-
const displayNum = displayIndex + 1;
|
|
1810
|
-
const statusBadge = getStatusBadge(account.status, account);
|
|
1811
|
-
const currentBadge = account.isCurrentAccount ? ` ${ANSI.cyan}[current]${ANSI.reset}` : "";
|
|
1812
|
-
const disabledBadge = account.enabled === false ? ` ${ANSI.red}[disabled]${ANSI.reset}` : "";
|
|
1813
|
-
const baseLabel = account.email || `Account ${displayNum}`;
|
|
1814
|
-
const numbered = `${displayNum}. ${baseLabel}`;
|
|
1815
|
-
const fullLabel = `${numbered}${currentBadge}${statusBadge}${disabledBadge}`;
|
|
1816
|
-
return {
|
|
1817
|
-
label: fullLabel,
|
|
1818
|
-
hint: account.quotaSummary ?? (account.lastUsed ? `used ${formatRelativeTime(account.lastUsed)}` : ""),
|
|
1819
|
-
value: { type: "select-account", account }
|
|
1820
|
-
};
|
|
1821
|
-
}),
|
|
1863
|
+
{ label: buildAccountSummary(accounts), value: { type: "cancel" }, kind: "heading" },
|
|
1864
|
+
...buildAccountMenuItems(accounts),
|
|
1822
1865
|
{ label: "", value: { type: "cancel" }, separator: true },
|
|
1823
1866
|
{ label: "Danger zone", value: { type: "cancel" }, kind: "heading" },
|
|
1824
1867
|
{ label: "Delete all accounts", value: { type: "delete-all" }, color: "red" }
|