@expiren/opencode-antigravity-auth 1.6.15 → 1.6.18
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 +583 -68
- package/dist/index.js.map +7 -1
- package/dist/src/constants.d.ts +13 -0
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +19 -1
- package/dist/src/constants.js.map +1 -1
- package/dist/src/plugin/auth-doctor.d.ts +30 -0
- package/dist/src/plugin/auth-doctor.d.ts.map +1 -0
- package/dist/src/plugin/auth-doctor.js +144 -0
- package/dist/src/plugin/auth-doctor.js.map +1 -0
- package/dist/src/plugin/auth-drift.d.ts +13 -0
- package/dist/src/plugin/auth-drift.d.ts.map +1 -0
- package/dist/src/plugin/auth-drift.js +70 -0
- package/dist/src/plugin/auth-drift.js.map +1 -0
- package/dist/src/plugin/cli.d.ts +11 -2
- package/dist/src/plugin/cli.d.ts.map +1 -1
- package/dist/src/plugin/cli.js +31 -3
- package/dist/src/plugin/cli.js.map +1 -1
- package/dist/src/plugin/config/models.d.ts +2 -32
- package/dist/src/plugin/config/models.d.ts.map +1 -1
- package/dist/src/plugin/config/models.js +1 -122
- package/dist/src/plugin/config/models.js.map +1 -1
- package/dist/src/plugin/config/schema.js +2 -2
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin/model-registry.d.ts +46 -0
- package/dist/src/plugin/model-registry.d.ts.map +1 -0
- package/dist/src/plugin/model-registry.js +180 -0
- package/dist/src/plugin/model-registry.js.map +1 -0
- package/dist/src/plugin/quota.d.ts +1 -0
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +8 -5
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +8 -5
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -1
- package/dist/src/plugin/transform/model-resolver.js +4 -26
- package/dist/src/plugin/transform/model-resolver.js.map +1 -1
- package/dist/src/plugin/ui/auth-menu.d.ts +25 -1
- package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -1
- package/dist/src/plugin/ui/auth-menu.js +64 -13
- package/dist/src/plugin/ui/auth-menu.js.map +1 -1
- package/dist/src/plugin/ui/quota-status.d.ts +67 -0
- package/dist/src/plugin/ui/quota-status.d.ts.map +1 -0
- package/dist/src/plugin/ui/quota-status.js +194 -0
- package/dist/src/plugin/ui/quota-status.js.map +1 -0
- package/dist/src/plugin/version.d.ts +8 -1
- package/dist/src/plugin/version.d.ts.map +1 -1
- package/dist/src/plugin/version.js +8 -1
- package/dist/src/plugin/version.js.map +1 -1
- package/dist/src/plugin.d.ts.map +1 -1
- package/dist/src/plugin.js +66 -5
- package/dist/src/plugin.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { QuotaGroupSummary } from "../quota";
|
|
2
|
+
import type { CooldownReason } from "../accounts";
|
|
3
|
+
/**
|
|
4
|
+
* Quota-aware status labels for models and accounts.
|
|
5
|
+
*
|
|
6
|
+
* Labels:
|
|
7
|
+
* [READY] — quota available, no rate limits
|
|
8
|
+
* [WAIT Xm] — rate-limited, resets in X minutes
|
|
9
|
+
* [EXHAUSTED] — quota fully consumed (0%), reset time known
|
|
10
|
+
* [COOLDOWN] — account cooling down (auth failure, network error, etc.)
|
|
11
|
+
* [LOW] — quota below 20% but still available
|
|
12
|
+
*/
|
|
13
|
+
export type QuotaLabel = "READY" | "WAIT" | "EXHAUSTED" | "COOLDOWN" | "LOW";
|
|
14
|
+
export interface QuotaStatusInfo {
|
|
15
|
+
label: QuotaLabel;
|
|
16
|
+
waitMs?: number;
|
|
17
|
+
cooldownReason?: CooldownReason;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Format a duration in milliseconds to a compact human-readable string.
|
|
21
|
+
* Used for wait/cooldown labels.
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatWaitDuration(ms: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* Classify a quota group's status based on remaining fraction and reset time.
|
|
26
|
+
*/
|
|
27
|
+
export declare function classifyGroupStatus(group: QuotaGroupSummary | undefined): QuotaStatusInfo;
|
|
28
|
+
/**
|
|
29
|
+
* Build a cooldown status for an account that is cooling down.
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildCooldownStatus(cooldownMs: number, reason?: CooldownReason): QuotaStatusInfo;
|
|
32
|
+
/**
|
|
33
|
+
* Build a rate-limited (WAIT) status with optional wait time.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildWaitStatus(waitMs?: number): QuotaStatusInfo;
|
|
36
|
+
/**
|
|
37
|
+
* Format a QuotaStatusInfo into a colored ANSI badge string.
|
|
38
|
+
*
|
|
39
|
+
* Examples:
|
|
40
|
+
* [READY]
|
|
41
|
+
* [WAIT 3m 20s]
|
|
42
|
+
* [EXHAUSTED resets in 2h 15m]
|
|
43
|
+
* [COOLDOWN auth-failure]
|
|
44
|
+
* [LOW]
|
|
45
|
+
*/
|
|
46
|
+
export declare function formatQuotaStatusBadge(status: QuotaStatusInfo): string;
|
|
47
|
+
/**
|
|
48
|
+
* Format a plain-text (no ANSI) quota status label.
|
|
49
|
+
* Suitable for hints and non-colored contexts.
|
|
50
|
+
*/
|
|
51
|
+
export declare function formatQuotaStatusPlain(status: QuotaStatusInfo): string;
|
|
52
|
+
/**
|
|
53
|
+
* Build a quota summary string with status labels for cached quota data.
|
|
54
|
+
* Used in auth menu account hints.
|
|
55
|
+
*
|
|
56
|
+
* Example: "Claude READY 80%, Gemini Pro LOW 15%, Gemini Flash EXHAUSTED"
|
|
57
|
+
*/
|
|
58
|
+
export declare function formatCachedQuotaWithStatus(cachedQuota: Partial<Record<string, {
|
|
59
|
+
remainingFraction?: number;
|
|
60
|
+
resetTime?: string;
|
|
61
|
+
}>> | undefined): string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Format a per-group quota status badge for the "Check quotas" output.
|
|
64
|
+
* Combines the progress bar with a status label.
|
|
65
|
+
*/
|
|
66
|
+
export declare function formatGroupQuotaBadge(remaining?: number, resetTime?: string): string;
|
|
67
|
+
//# sourceMappingURL=quota-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-status.d.ts","sourceRoot":"","sources":["../../../../src/plugin/ui/quota-status.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;GASG;AAEH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,KAAK,CAAA;AAE5E,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,UAAU,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,cAAc,CAAA;CAChC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAYrD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,GAAG,SAAS,GACnC,eAAe,CA2BjB;AAcD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,cAAc,GACtB,eAAe,CAMjB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe,CAKhE;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAiCtE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAiCtE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,GAAG,SAAS,GACnG,MAAM,GAAG,SAAS,CAuBpB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAQR"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { ANSI } from "./ansi";
|
|
2
|
+
/**
|
|
3
|
+
* Format a duration in milliseconds to a compact human-readable string.
|
|
4
|
+
* Used for wait/cooldown labels.
|
|
5
|
+
*/
|
|
6
|
+
export function formatWaitDuration(ms) {
|
|
7
|
+
if (ms < 1000)
|
|
8
|
+
return `${ms}ms`;
|
|
9
|
+
const seconds = Math.ceil(ms / 1000);
|
|
10
|
+
if (seconds < 60)
|
|
11
|
+
return `${seconds}s`;
|
|
12
|
+
const minutes = Math.floor(seconds / 60);
|
|
13
|
+
const remainingSeconds = seconds % 60;
|
|
14
|
+
if (minutes < 60) {
|
|
15
|
+
return remainingSeconds > 0 ? `${minutes}m ${remainingSeconds}s` : `${minutes}m`;
|
|
16
|
+
}
|
|
17
|
+
const hours = Math.floor(minutes / 60);
|
|
18
|
+
const remainingMinutes = minutes % 60;
|
|
19
|
+
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Classify a quota group's status based on remaining fraction and reset time.
|
|
23
|
+
*/
|
|
24
|
+
export function classifyGroupStatus(group) {
|
|
25
|
+
if (!group) {
|
|
26
|
+
return { label: "READY" };
|
|
27
|
+
}
|
|
28
|
+
const remaining = group.remainingFraction;
|
|
29
|
+
// No remaining fraction data — treat as ready (fail-open)
|
|
30
|
+
if (typeof remaining !== "number" || !Number.isFinite(remaining)) {
|
|
31
|
+
return { label: "READY" };
|
|
32
|
+
}
|
|
33
|
+
// Exhausted: 0% remaining
|
|
34
|
+
if (remaining <= 0) {
|
|
35
|
+
const waitMs = parseResetTimeToMs(group.resetTime);
|
|
36
|
+
if (waitMs !== null && waitMs > 0) {
|
|
37
|
+
return { label: "EXHAUSTED", waitMs };
|
|
38
|
+
}
|
|
39
|
+
return { label: "EXHAUSTED" };
|
|
40
|
+
}
|
|
41
|
+
// Low: below 20%
|
|
42
|
+
if (remaining < 0.2) {
|
|
43
|
+
return { label: "LOW" };
|
|
44
|
+
}
|
|
45
|
+
return { label: "READY" };
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Parse an ISO reset time string to milliseconds-until-reset.
|
|
49
|
+
* Returns null if the time is invalid or already past.
|
|
50
|
+
*/
|
|
51
|
+
function parseResetTimeToMs(resetTime) {
|
|
52
|
+
if (!resetTime)
|
|
53
|
+
return null;
|
|
54
|
+
const timestamp = Date.parse(resetTime);
|
|
55
|
+
if (!Number.isFinite(timestamp))
|
|
56
|
+
return null;
|
|
57
|
+
const ms = timestamp - Date.now();
|
|
58
|
+
return ms > 0 ? ms : null;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Build a cooldown status for an account that is cooling down.
|
|
62
|
+
*/
|
|
63
|
+
export function buildCooldownStatus(cooldownMs, reason) {
|
|
64
|
+
return {
|
|
65
|
+
label: "COOLDOWN",
|
|
66
|
+
waitMs: cooldownMs > 0 ? cooldownMs : undefined,
|
|
67
|
+
cooldownReason: reason,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Build a rate-limited (WAIT) status with optional wait time.
|
|
72
|
+
*/
|
|
73
|
+
export function buildWaitStatus(waitMs) {
|
|
74
|
+
if (waitMs !== undefined && waitMs > 0) {
|
|
75
|
+
return { label: "WAIT", waitMs };
|
|
76
|
+
}
|
|
77
|
+
return { label: "WAIT" };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Format a QuotaStatusInfo into a colored ANSI badge string.
|
|
81
|
+
*
|
|
82
|
+
* Examples:
|
|
83
|
+
* [READY]
|
|
84
|
+
* [WAIT 3m 20s]
|
|
85
|
+
* [EXHAUSTED resets in 2h 15m]
|
|
86
|
+
* [COOLDOWN auth-failure]
|
|
87
|
+
* [LOW]
|
|
88
|
+
*/
|
|
89
|
+
export function formatQuotaStatusBadge(status) {
|
|
90
|
+
switch (status.label) {
|
|
91
|
+
case "READY":
|
|
92
|
+
return `${ANSI.green}[READY]${ANSI.reset}`;
|
|
93
|
+
case "LOW":
|
|
94
|
+
return `${ANSI.yellow}[LOW]${ANSI.reset}`;
|
|
95
|
+
case "WAIT": {
|
|
96
|
+
const suffix = status.waitMs
|
|
97
|
+
? ` ${formatWaitDuration(status.waitMs)}`
|
|
98
|
+
: "";
|
|
99
|
+
return `${ANSI.yellow}[WAIT${suffix}]${ANSI.reset}`;
|
|
100
|
+
}
|
|
101
|
+
case "EXHAUSTED": {
|
|
102
|
+
const suffix = status.waitMs
|
|
103
|
+
? ` resets in ${formatWaitDuration(status.waitMs)}`
|
|
104
|
+
: "";
|
|
105
|
+
return `${ANSI.red}[EXHAUSTED${suffix}]${ANSI.reset}`;
|
|
106
|
+
}
|
|
107
|
+
case "COOLDOWN": {
|
|
108
|
+
const parts = ["COOLDOWN"];
|
|
109
|
+
if (status.cooldownReason) {
|
|
110
|
+
parts.push(status.cooldownReason);
|
|
111
|
+
}
|
|
112
|
+
if (status.waitMs) {
|
|
113
|
+
parts.push(formatWaitDuration(status.waitMs));
|
|
114
|
+
}
|
|
115
|
+
return `${ANSI.red}[${parts.join(" ")}]${ANSI.reset}`;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Format a plain-text (no ANSI) quota status label.
|
|
121
|
+
* Suitable for hints and non-colored contexts.
|
|
122
|
+
*/
|
|
123
|
+
export function formatQuotaStatusPlain(status) {
|
|
124
|
+
switch (status.label) {
|
|
125
|
+
case "READY":
|
|
126
|
+
return "READY";
|
|
127
|
+
case "LOW":
|
|
128
|
+
return "LOW";
|
|
129
|
+
case "WAIT": {
|
|
130
|
+
const suffix = status.waitMs
|
|
131
|
+
? ` ${formatWaitDuration(status.waitMs)}`
|
|
132
|
+
: "";
|
|
133
|
+
return `WAIT${suffix}`;
|
|
134
|
+
}
|
|
135
|
+
case "EXHAUSTED": {
|
|
136
|
+
const suffix = status.waitMs
|
|
137
|
+
? ` resets in ${formatWaitDuration(status.waitMs)}`
|
|
138
|
+
: "";
|
|
139
|
+
return `EXHAUSTED${suffix}`;
|
|
140
|
+
}
|
|
141
|
+
case "COOLDOWN": {
|
|
142
|
+
const parts = ["COOLDOWN"];
|
|
143
|
+
if (status.cooldownReason) {
|
|
144
|
+
parts.push(status.cooldownReason);
|
|
145
|
+
}
|
|
146
|
+
if (status.waitMs) {
|
|
147
|
+
parts.push(formatWaitDuration(status.waitMs));
|
|
148
|
+
}
|
|
149
|
+
return parts.join(" ");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Build a quota summary string with status labels for cached quota data.
|
|
155
|
+
* Used in auth menu account hints.
|
|
156
|
+
*
|
|
157
|
+
* Example: "Claude READY 80%, Gemini Pro LOW 15%, Gemini Flash EXHAUSTED"
|
|
158
|
+
*/
|
|
159
|
+
export function formatCachedQuotaWithStatus(cachedQuota) {
|
|
160
|
+
if (!cachedQuota) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
const entries = [
|
|
164
|
+
{ key: "claude", label: "Claude" },
|
|
165
|
+
{ key: "gemini-pro", label: "Gemini Pro" },
|
|
166
|
+
{ key: "gemini-flash", label: "Gemini Flash" },
|
|
167
|
+
].flatMap(({ key, label }) => {
|
|
168
|
+
const value = cachedQuota[key]?.remainingFraction;
|
|
169
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
170
|
+
return [];
|
|
171
|
+
}
|
|
172
|
+
const pct = Math.round(Math.max(0, Math.min(1, value)) * 100);
|
|
173
|
+
const status = classifyGroupStatus(cachedQuota[key]);
|
|
174
|
+
if (status.label === "READY") {
|
|
175
|
+
return [`${label} ${pct}%`];
|
|
176
|
+
}
|
|
177
|
+
return [`${label} ${formatQuotaStatusPlain(status)} ${pct}%`];
|
|
178
|
+
});
|
|
179
|
+
return entries.length > 0 ? entries.join(", ") : undefined;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Format a per-group quota status badge for the "Check quotas" output.
|
|
183
|
+
* Combines the progress bar with a status label.
|
|
184
|
+
*/
|
|
185
|
+
export function formatGroupQuotaBadge(remaining, resetTime) {
|
|
186
|
+
const group = {
|
|
187
|
+
remainingFraction: remaining,
|
|
188
|
+
resetTime,
|
|
189
|
+
modelCount: 1,
|
|
190
|
+
};
|
|
191
|
+
const status = classifyGroupStatus(group);
|
|
192
|
+
return formatQuotaStatusBadge(status);
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=quota-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-status.js","sourceRoot":"","sources":["../../../../src/plugin/ui/quota-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAuB7B;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAU;IAC3C,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,GAAG,EAAE,IAAI,CAAA;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,CAAA;IACpC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,OAAO,GAAG,CAAA;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAA;IACxC,MAAM,gBAAgB,GAAG,OAAO,GAAG,EAAE,CAAA;IACrC,IAAI,OAAO,GAAG,EAAE,EAAE,CAAC;QACjB,OAAO,gBAAgB,GAAG,CAAC,CAA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elog" | "fallback";
|
|
15
|
+
export interface AntigravityVersionResolution {
|
|
16
|
+
version: string;
|
|
17
|
+
source: VersionSource;
|
|
18
|
+
}
|
|
14
19
|
/**
|
|
15
20
|
* Fetch the latest Antigravity version and update the global constant.
|
|
16
21
|
* Safe to call before logger is initialized (will silently skip logging).
|
|
17
22
|
*/
|
|
18
|
-
export declare function
|
|
23
|
+
export declare function getAntigravityVersionResolution(): AntigravityVersionResolution;
|
|
24
|
+
export declare function initAntigravityVersion(): Promise<AntigravityVersionResolution>;
|
|
25
|
+
export {};
|
|
19
26
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/plugin/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/plugin/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAWH,KAAK,aAAa,GAAG,KAAK,GAAG,WAAW,GAAG,UAAU,CAAC;AAEtD,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;CACvB;AAyBD;;;GAGG;AACH,wBAAgB,+BAA+B,IAAI,4BAA4B,CAE9E;AAED,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAiCpF"}
|
|
@@ -18,6 +18,7 @@ const CHANGELOG_URL = "https://antigravity.google/changelog";
|
|
|
18
18
|
const FETCH_TIMEOUT_MS = 5000;
|
|
19
19
|
const CHANGELOG_SCAN_CHARS = 5000;
|
|
20
20
|
const VERSION_REGEX = /\d+\.\d+\.\d+/;
|
|
21
|
+
let lastResolution = null;
|
|
21
22
|
function parseVersion(text) {
|
|
22
23
|
const match = text.match(VERSION_REGEX);
|
|
23
24
|
return match ? match[0] : null;
|
|
@@ -45,6 +46,9 @@ async function tryFetchVersion(url, maxChars) {
|
|
|
45
46
|
* Fetch the latest Antigravity version and update the global constant.
|
|
46
47
|
* Safe to call before logger is initialized (will silently skip logging).
|
|
47
48
|
*/
|
|
49
|
+
export function getAntigravityVersionResolution() {
|
|
50
|
+
return lastResolution ?? { version: getAntigravityVersion(), source: "fallback" };
|
|
51
|
+
}
|
|
48
52
|
export async function initAntigravityVersion() {
|
|
49
53
|
const log = createLogger("version");
|
|
50
54
|
const fallback = getAntigravityVersion();
|
|
@@ -66,7 +70,8 @@ export async function initAntigravityVersion() {
|
|
|
66
70
|
source = "fallback";
|
|
67
71
|
setAntigravityVersion(fallback);
|
|
68
72
|
log.info("version-fetch-failed", { fallback });
|
|
69
|
-
|
|
73
|
+
lastResolution = { version: fallback, source };
|
|
74
|
+
return lastResolution;
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
if (version !== fallback) {
|
|
@@ -76,5 +81,7 @@ export async function initAntigravityVersion() {
|
|
|
76
81
|
log.debug("version-unchanged", { version, source });
|
|
77
82
|
}
|
|
78
83
|
setAntigravityVersion(version);
|
|
84
|
+
lastResolution = { version, source };
|
|
85
|
+
return lastResolution;
|
|
79
86
|
}
|
|
80
87
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/plugin/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,GAAG,mEAAmE,CAAC;AACxF,MAAM,aAAa,GAAG,sCAAsC,CAAC;AAC7D,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,aAAa,GAAG,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/plugin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,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAC/B,cAAc,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACrC,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
package/dist/src/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAiCrB,OAAO,EAAkB,KAAK,WAAW,EAAwE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAiCrB,OAAO,EAAkB,KAAK,WAAW,EAAwE,MAAM,mBAAmB,CAAC;AAI3I,OAAO,EAAiC,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AASxF,OAAO,KAAK,EAIV,aAAa,EACb,YAAY,EAGb,MAAM,gBAAgB,CAAC;AAsoCxB;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,YAAY,MAAM,MACxD,uBAAuB,aAAa,KACnC,OAAO,CAAC,YAAY,CAmnEtB,CAAC;AAEF,eAAO,MAAM,yBAAyB,0BAtnEb,aAAa,KACnC,OAAO,CAAC,YAAY,CAqnEkE,CAAC;AAC1F,eAAO,MAAM,iBAAiB,0BAvnEL,aAAa,KACnC,OAAO,CAAC,YAAY,CAsnEmC,CAAC;AAiD3D,iBAAS,+BAA+B,CAAC,KAAK,EAAE;IAC9C,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,EAAE,WAAW,GAAG,IAAI,CAAC;CACpC,GAAG,WAAW,GAAG,IAAI,CAQrB;AAED,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,oBAAoB,EAAE,WAAW,CAAC;IAClC,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,iBAAS,4BAA4B,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,iBAAiB,GACxB,qBAAqB,CAUvB;AAMD,iBAAS,qBAAqB,CAC5B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EACnB,QAAQ,GAAE,OAAe,GACxB,WAAW,CAUb;AAWD,eAAO,MAAM,aAAa;;;;CAIzB,CAAC"}
|
package/dist/src/plugin.js
CHANGED
|
@@ -15,14 +15,17 @@ import { startOAuthListener } from "./plugin/server";
|
|
|
15
15
|
import { clearAccounts, loadAccounts, saveAccounts, saveAccountsReplace } from "./plugin/storage";
|
|
16
16
|
import { AccountManager, parseRateLimitReason, calculateBackoffMs, computeSoftQuotaCacheTtlMs } from "./plugin/accounts";
|
|
17
17
|
import { createAutoUpdateCheckerHook } from "./hooks/auto-update-checker";
|
|
18
|
+
import { buildAuthFromStoredAccount, detectAuthStorageDrift } from "./plugin/auth-drift";
|
|
19
|
+
import { createAuthDoctorReport, formatAuthDoctorReport } from "./plugin/auth-doctor";
|
|
18
20
|
import { loadConfig, initRuntimeConfig } from "./plugin/config";
|
|
19
21
|
import { createSessionRecoveryHook, getRecoverySuccessToast } from "./plugin/recovery";
|
|
20
22
|
import { checkAccountsQuota } from "./plugin/quota";
|
|
23
|
+
import { formatCachedQuotaWithStatus, classifyGroupStatus, formatQuotaStatusBadge } from "./plugin/ui/quota-status";
|
|
21
24
|
import { initDiskSignatureCache } from "./plugin/cache";
|
|
22
25
|
import { createProactiveRefreshQueue } from "./plugin/refresh-queue";
|
|
23
26
|
import { initLogger, createLogger } from "./plugin/logger";
|
|
24
27
|
import { initHealthTracker, getHealthTracker, initTokenTracker, getTokenTracker } from "./plugin/rotation";
|
|
25
|
-
import { initAntigravityVersion } from "./plugin/version";
|
|
28
|
+
import { getAntigravityVersionResolution, initAntigravityVersion } from "./plugin/version";
|
|
26
29
|
import { executeSearch } from "./plugin/search";
|
|
27
30
|
const MAX_OAUTH_ACCOUNTS = 10;
|
|
28
31
|
const MAX_WARMUP_SESSIONS = 1000;
|
|
@@ -704,6 +707,14 @@ function buildAuthSuccessFromStoredAccount(account) {
|
|
|
704
707
|
projectId: account.projectId ?? "",
|
|
705
708
|
};
|
|
706
709
|
}
|
|
710
|
+
function formatCachedQuotaSummary(account) {
|
|
711
|
+
const quota = account.cachedQuota;
|
|
712
|
+
if (!quota) {
|
|
713
|
+
return undefined;
|
|
714
|
+
}
|
|
715
|
+
// Use the quota-status module for status-aware formatting
|
|
716
|
+
return formatCachedQuotaWithStatus(quota);
|
|
717
|
+
}
|
|
707
718
|
function retryAfterMsFromResponse(response, defaultRetryMs = 60_000) {
|
|
708
719
|
const retryAfterMsHeader = response.headers.get("retry-after-ms");
|
|
709
720
|
if (retryAfterMsHeader) {
|
|
@@ -1144,8 +1155,39 @@ export const createAntigravityPlugin = (providerId) => async ({ client, director
|
|
|
1144
1155
|
loader: async (getAuth, provider) => {
|
|
1145
1156
|
// Cache getAuth for tool access
|
|
1146
1157
|
cachedGetAuth = getAuth;
|
|
1147
|
-
|
|
1148
|
-
// If OpenCode
|
|
1158
|
+
let auth = await getAuth();
|
|
1159
|
+
// If OpenCode lost its OAuth auth but account storage is still usable,
|
|
1160
|
+
// restore auth.json from the active stored account instead of deleting
|
|
1161
|
+
// the account pool. This repairs Desktop/TUI auth drift without network I/O.
|
|
1162
|
+
if (!isOAuthAuth(auth)) {
|
|
1163
|
+
const storedAccounts = await loadAccounts();
|
|
1164
|
+
const drift = detectAuthStorageDrift(auth, storedAccounts);
|
|
1165
|
+
if (drift.status === "restorable" && drift.account) {
|
|
1166
|
+
auth = buildAuthFromStoredAccount(drift.account);
|
|
1167
|
+
try {
|
|
1168
|
+
await client.auth.set({
|
|
1169
|
+
path: { id: providerId },
|
|
1170
|
+
body: {
|
|
1171
|
+
type: "oauth",
|
|
1172
|
+
refresh: auth.refresh,
|
|
1173
|
+
access: auth.access ?? "",
|
|
1174
|
+
expires: auth.expires ?? 0,
|
|
1175
|
+
},
|
|
1176
|
+
});
|
|
1177
|
+
log.info("Restored Antigravity OAuth auth from account storage", {
|
|
1178
|
+
reason: drift.reason,
|
|
1179
|
+
email: drift.account.email,
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
catch (storeError) {
|
|
1183
|
+
log.warn("Failed to restore Antigravity OAuth auth from account storage", {
|
|
1184
|
+
error: String(storeError),
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
// If OpenCode has no valid OAuth auth and no stored account can restore it,
|
|
1190
|
+
// clear stale account storage and let OpenCode fall back to normal auth setup.
|
|
1149
1191
|
if (!isOAuthAuth(auth)) {
|
|
1150
1192
|
try {
|
|
1151
1193
|
await clearAccounts();
|
|
@@ -2013,6 +2055,7 @@ export const createAntigravityPlugin = (providerId) => async ({ client, director
|
|
|
2013
2055
|
status,
|
|
2014
2056
|
isCurrentAccount: idx === (existingStorage.activeIndex ?? 0),
|
|
2015
2057
|
enabled: acc.enabled !== false,
|
|
2058
|
+
quotaSummary: formatCachedQuotaSummary(acc),
|
|
2016
2059
|
};
|
|
2017
2060
|
});
|
|
2018
2061
|
menuResult = await promptLoginMode(existingAccounts);
|
|
@@ -2090,8 +2133,10 @@ export const createAntigravityPlugin = (providerId) => async ({ client, director
|
|
|
2090
2133
|
const connector = isLast ? "└─" : "├─";
|
|
2091
2134
|
const bar = createProgressBar(model.remainingFraction);
|
|
2092
2135
|
const reset = formatReset(model.resetTime);
|
|
2136
|
+
const status = classifyGroupStatus({ remainingFraction: model.remainingFraction, resetTime: model.resetTime, modelCount: 1 });
|
|
2137
|
+
const badge = formatQuotaStatusBadge(status);
|
|
2093
2138
|
const modelName = model.modelId.padEnd(29);
|
|
2094
|
-
console.log(` │ ${connector} ${modelName} ${bar}${reset}`);
|
|
2139
|
+
console.log(` │ ${connector} ${modelName} ${bar} ${badge}${reset}`);
|
|
2095
2140
|
});
|
|
2096
2141
|
}
|
|
2097
2142
|
// Display Antigravity Quota second
|
|
@@ -2114,8 +2159,10 @@ export const createAntigravityPlugin = (providerId) => async ({ client, director
|
|
|
2114
2159
|
const connector = isLast ? "└─" : "├─";
|
|
2115
2160
|
const bar = createProgressBar(g.data.remainingFraction);
|
|
2116
2161
|
const reset = formatReset(g.data.resetTime);
|
|
2162
|
+
const status = classifyGroupStatus(g.data);
|
|
2163
|
+
const badge = formatQuotaStatusBadge(status);
|
|
2117
2164
|
const modelName = g.name.padEnd(29);
|
|
2118
|
-
console.log(` ${connector} ${modelName} ${bar}${reset}`);
|
|
2165
|
+
console.log(` ${connector} ${modelName} ${bar} ${badge}${reset}`);
|
|
2119
2166
|
});
|
|
2120
2167
|
}
|
|
2121
2168
|
console.log("");
|
|
@@ -2143,6 +2190,20 @@ export const createAntigravityPlugin = (providerId) => async ({ client, director
|
|
|
2143
2190
|
console.log("");
|
|
2144
2191
|
continue;
|
|
2145
2192
|
}
|
|
2193
|
+
if (menuResult.mode === "doctor") {
|
|
2194
|
+
const auth = cachedGetAuth ? await cachedGetAuth().catch(() => undefined) : undefined;
|
|
2195
|
+
const versionResolution = getAntigravityVersionResolution();
|
|
2196
|
+
const report = createAuthDoctorReport({
|
|
2197
|
+
auth,
|
|
2198
|
+
storage: existingStorage,
|
|
2199
|
+
runtime: {
|
|
2200
|
+
antigravityVersion: versionResolution.version,
|
|
2201
|
+
antigravityVersionSource: versionResolution.source,
|
|
2202
|
+
},
|
|
2203
|
+
});
|
|
2204
|
+
console.log(`\n${formatAuthDoctorReport(report)}\n`);
|
|
2205
|
+
continue;
|
|
2206
|
+
}
|
|
2146
2207
|
if (menuResult.mode === "manage") {
|
|
2147
2208
|
if (menuResult.toggleAccountIndex !== undefined) {
|
|
2148
2209
|
const acc = existingStorage.accounts[menuResult.toggleAccountIndex];
|