@expiren/opencode-antigravity-auth 1.6.26 → 1.6.28
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 +64 -7
- package/dist/index.js.map +3 -3
- package/dist/src/plugin/cli.d.ts +3 -2
- package/dist/src/plugin/cli.d.ts.map +1 -1
- package/dist/src/plugin/cli.js.map +1 -1
- package/dist/src/plugin/ui/auth-menu.d.ts +3 -8
- package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -1
- package/dist/src/plugin/ui/auth-menu.js +67 -6
- package/dist/src/plugin/ui/auth-menu.js.map +1 -1
- package/dist/src/plugin.d.ts.map +1 -1
- package/dist/src/plugin.js +7 -0
- package/dist/src/plugin.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1683,11 +1683,11 @@ function classifyOverallQuotaHealth(cachedQuota) {
|
|
|
1683
1683
|
if (!cachedQuota) {
|
|
1684
1684
|
return { health: "unknown" };
|
|
1685
1685
|
}
|
|
1686
|
-
const
|
|
1686
|
+
const QUOTA_KEYS2 = ["claude", "gemini-pro", "gemini-flash"];
|
|
1687
1687
|
let groupsWithData = 0;
|
|
1688
1688
|
let exhaustedCount = 0;
|
|
1689
1689
|
let maxResetMs;
|
|
1690
|
-
for (const key of
|
|
1690
|
+
for (const key of QUOTA_KEYS2) {
|
|
1691
1691
|
const value = cachedQuota[key]?.remainingFraction;
|
|
1692
1692
|
if (typeof value !== "number" || !Number.isFinite(value)) continue;
|
|
1693
1693
|
groupsWithData++;
|
|
@@ -1803,6 +1803,42 @@ function getHealthLabel(acc) {
|
|
|
1803
1803
|
if (acc.status === "expired") return "expired";
|
|
1804
1804
|
return "other";
|
|
1805
1805
|
}
|
|
1806
|
+
var QUOTA_KEYS = [
|
|
1807
|
+
{ key: "claude", label: "Claude" },
|
|
1808
|
+
{ key: "gemini-pro", label: "Gemini Pro" },
|
|
1809
|
+
{ key: "gemini-flash", label: "Gemini Flash" }
|
|
1810
|
+
];
|
|
1811
|
+
function parseResetTimeToMs2(resetTime) {
|
|
1812
|
+
if (!resetTime) return null;
|
|
1813
|
+
const timestamp = Date.parse(resetTime);
|
|
1814
|
+
if (!Number.isFinite(timestamp)) return null;
|
|
1815
|
+
const ms = timestamp - Date.now();
|
|
1816
|
+
return ms > 0 ? ms : null;
|
|
1817
|
+
}
|
|
1818
|
+
function buildModelBreakdown(accounts) {
|
|
1819
|
+
const results = [];
|
|
1820
|
+
for (const { key, label } of QUOTA_KEYS) {
|
|
1821
|
+
let exhaustedCount = 0;
|
|
1822
|
+
let maxResetMs;
|
|
1823
|
+
for (const acc of accounts) {
|
|
1824
|
+
if (acc.enabled === false) continue;
|
|
1825
|
+
const group = acc.cachedQuota?.[key];
|
|
1826
|
+
if (!group || typeof group.remainingFraction !== "number") continue;
|
|
1827
|
+
if (group.remainingFraction <= 0) {
|
|
1828
|
+
exhaustedCount++;
|
|
1829
|
+
const resetMs = parseResetTimeToMs2(group.resetTime);
|
|
1830
|
+
if (resetMs !== null && (maxResetMs === void 0 || resetMs > maxResetMs)) {
|
|
1831
|
+
maxResetMs = resetMs;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
if (exhaustedCount > 0) {
|
|
1836
|
+
const resetSuffix = maxResetMs !== void 0 ? ` ~${formatWaitDuration(maxResetMs)}` : "";
|
|
1837
|
+
results.push(`${label}: ${exhaustedCount} exhausted${resetSuffix}`);
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
return results;
|
|
1841
|
+
}
|
|
1806
1842
|
function buildAccountSummary(accounts) {
|
|
1807
1843
|
const counts = {};
|
|
1808
1844
|
for (const acc of accounts) {
|
|
@@ -1811,10 +1847,17 @@ function buildAccountSummary(accounts) {
|
|
|
1811
1847
|
}
|
|
1812
1848
|
const order = ["active", "limited", "exhausted", "rate-limited", "expired", "disabled", "other"];
|
|
1813
1849
|
const parts = order.filter((label) => (counts[label] ?? 0) > 0).map((label) => `${counts[label]} ${label}`);
|
|
1814
|
-
|
|
1850
|
+
const modelBreakdown = buildModelBreakdown(accounts);
|
|
1851
|
+
const countsLine = parts.length > 0 ? `Accounts (${parts.join(", ")})` : "Accounts";
|
|
1852
|
+
const modelLine = modelBreakdown.length > 0 ? modelBreakdown.join(", ") : "";
|
|
1853
|
+
return { countsLine, modelLine };
|
|
1815
1854
|
}
|
|
1816
1855
|
function buildAccountHint(account) {
|
|
1817
1856
|
if (account.quotaSummary) {
|
|
1857
|
+
const overall = classifyOverallQuotaHealth(account.cachedQuota);
|
|
1858
|
+
if (overall.health === "partial") {
|
|
1859
|
+
return account.quotaSummary.replace(/\s*resets in \S+/g, "");
|
|
1860
|
+
}
|
|
1818
1861
|
return account.quotaSummary;
|
|
1819
1862
|
}
|
|
1820
1863
|
if (account.lastUsed) {
|
|
@@ -1834,7 +1877,7 @@ function buildAccountMenuItems(accounts) {
|
|
|
1834
1877
|
}
|
|
1835
1878
|
prevTier = tier;
|
|
1836
1879
|
const displayNum = i + 1;
|
|
1837
|
-
const statusBadge = getStatusBadge(account.status, account);
|
|
1880
|
+
const statusBadge = account.isCurrentAccount ? "" : getStatusBadge(account.status, account);
|
|
1838
1881
|
const currentBadge = account.isCurrentAccount ? ` ${ANSI.cyan}[current]${ANSI.reset}` : "";
|
|
1839
1882
|
const disabledBadge = account.enabled === false ? ` ${ANSI.red}[disabled]${ANSI.reset}` : "";
|
|
1840
1883
|
const baseLabel = account.email || `Account ${displayNum}`;
|
|
@@ -1860,7 +1903,16 @@ async function showAuthMenu(accounts) {
|
|
|
1860
1903
|
{ label: "Verify all accounts", value: { type: "verify-all" }, color: "cyan" },
|
|
1861
1904
|
{ label: "Configure models in opencode.json", value: { type: "configure-models" }, color: "cyan" },
|
|
1862
1905
|
{ label: "", value: { type: "cancel" }, separator: true },
|
|
1863
|
-
|
|
1906
|
+
...(() => {
|
|
1907
|
+
const { countsLine, modelLine } = buildAccountSummary(accounts);
|
|
1908
|
+
const lines = [
|
|
1909
|
+
{ label: countsLine, value: { type: "cancel" }, kind: "heading" }
|
|
1910
|
+
];
|
|
1911
|
+
if (modelLine) {
|
|
1912
|
+
lines.push({ label: modelLine, value: { type: "cancel" }, kind: "heading" });
|
|
1913
|
+
}
|
|
1914
|
+
return lines;
|
|
1915
|
+
})(),
|
|
1864
1916
|
...buildAccountMenuItems(accounts),
|
|
1865
1917
|
{ label: "", value: { type: "cancel" }, separator: true },
|
|
1866
1918
|
{ label: "Danger zone", value: { type: "cancel" }, kind: "heading" },
|
|
@@ -1896,7 +1948,7 @@ async function showFingerprintHistory(history, accountLabel) {
|
|
|
1896
1948
|
{ label: "", value: null, separator: true },
|
|
1897
1949
|
{ label: "Fingerprint history", value: null, kind: "heading" },
|
|
1898
1950
|
...history.map((entry, index) => {
|
|
1899
|
-
const deviceShort = entry.deviceId.slice(0, 8);
|
|
1951
|
+
const deviceShort = entry.fingerprint.deviceId.slice(0, 8);
|
|
1900
1952
|
const reasonBadge = `${ANSI.dim}[${formatFingerprintReason(entry.reason)}]${ANSI.reset}`;
|
|
1901
1953
|
const label = `${index + 1}. ${deviceShort}... ${reasonBadge}`;
|
|
1902
1954
|
const hint = formatRelativeTime(entry.timestamp);
|
|
@@ -12890,6 +12942,7 @@ Alternatively, you can:
|
|
|
12890
12942
|
status = "rate-limited";
|
|
12891
12943
|
}
|
|
12892
12944
|
}
|
|
12945
|
+
const cooldownMs = acc.coolingDownUntil && acc.coolingDownUntil > now ? acc.coolingDownUntil - now : void 0;
|
|
12893
12946
|
return {
|
|
12894
12947
|
email: acc.email,
|
|
12895
12948
|
index: idx,
|
|
@@ -12898,7 +12951,11 @@ Alternatively, you can:
|
|
|
12898
12951
|
status,
|
|
12899
12952
|
isCurrentAccount: idx === (existingStorage2.activeIndex ?? 0),
|
|
12900
12953
|
enabled: acc.enabled !== false,
|
|
12901
|
-
quotaSummary: formatCachedQuotaSummary(acc)
|
|
12954
|
+
quotaSummary: formatCachedQuotaSummary(acc),
|
|
12955
|
+
cooldownMs,
|
|
12956
|
+
cooldownReason: cooldownMs ? acc.cooldownReason : void 0,
|
|
12957
|
+
cachedQuota: acc.cachedQuota,
|
|
12958
|
+
fingerprintHistory: acc.fingerprintHistory
|
|
12902
12959
|
};
|
|
12903
12960
|
});
|
|
12904
12961
|
menuResult = await promptLoginMode(existingAccounts);
|