@expiren/opencode-antigravity-auth 1.6.18 → 1.6.19
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 +18 -23
- package/dist/index.js.map +2 -2
- package/dist/src/plugin/cli.d.ts +4 -3
- package/dist/src/plugin/cli.d.ts.map +1 -1
- package/dist/src/plugin/cli.js +5 -0
- package/dist/src/plugin/cli.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +1 -4
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/transform/claude.d.ts +1 -0
- package/dist/src/plugin/transform/claude.d.ts.map +1 -1
- package/dist/src/plugin/transform/claude.js +13 -0
- package/dist/src/plugin/transform/claude.js.map +1 -1
- package/dist/src/plugin/ui/auth-menu.d.ts +1 -1
- package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -1
- package/dist/src/plugin/ui/auth-menu.js +8 -3
- package/dist/src/plugin/ui/auth-menu.js.map +1 -1
- package/dist/src/plugin/ui/model-status.d.ts +28 -0
- package/dist/src/plugin/ui/model-status.d.ts.map +1 -0
- package/dist/src/plugin/ui/model-status.js +80 -0
- package/dist/src/plugin/ui/model-status.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { classifyGroupStatus, buildCooldownStatus, buildWaitStatus, } from "./quota-status";
|
|
2
|
+
/**
|
|
3
|
+
* Priority ranking for quota labels — higher is more available.
|
|
4
|
+
* Used to pick the best (most optimistic) status across accounts.
|
|
5
|
+
*/
|
|
6
|
+
const STATUS_PRIORITY = {
|
|
7
|
+
READY: 4,
|
|
8
|
+
LOW: 3,
|
|
9
|
+
WAIT: 2,
|
|
10
|
+
EXHAUSTED: 1,
|
|
11
|
+
COOLDOWN: 0,
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Determine per-model availability status by aggregating across accounts.
|
|
15
|
+
*
|
|
16
|
+
* Rules:
|
|
17
|
+
* 1. If ANY enabled account can serve the model → READY (or LOW if all
|
|
18
|
+
* available accounts have low quota).
|
|
19
|
+
* 2. If ALL accounts are blocked:
|
|
20
|
+
* - All cooling down → COOLDOWN with min cooldown time
|
|
21
|
+
* - Any rate-limited → WAIT with min wait time
|
|
22
|
+
* 3. Fail-open: returns READY when no accounts or no quota data exist.
|
|
23
|
+
*/
|
|
24
|
+
export function getModelStatusFromAccounts(accounts) {
|
|
25
|
+
if (accounts.length === 0) {
|
|
26
|
+
return { label: "READY" };
|
|
27
|
+
}
|
|
28
|
+
const available = [];
|
|
29
|
+
const blocked = [];
|
|
30
|
+
for (const account of accounts) {
|
|
31
|
+
if (!account.coolingDown && !account.rateLimited) {
|
|
32
|
+
available.push(account);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
blocked.push(account);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (available.length > 0) {
|
|
39
|
+
return resolveAvailableStatus(available);
|
|
40
|
+
}
|
|
41
|
+
return resolveBlockedStatus(blocked);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Among accounts that can serve right now, pick the best quota status.
|
|
45
|
+
* If none have quota data, fail-open to READY.
|
|
46
|
+
*/
|
|
47
|
+
function resolveAvailableStatus(accounts) {
|
|
48
|
+
let best = null;
|
|
49
|
+
for (const account of accounts) {
|
|
50
|
+
if (!account.quotaGroup)
|
|
51
|
+
continue;
|
|
52
|
+
const status = classifyGroupStatus(account.quotaGroup);
|
|
53
|
+
if (!best || STATUS_PRIORITY[status.label] > STATUS_PRIORITY[best.label]) {
|
|
54
|
+
best = status;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return best ?? { label: "READY" };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* All accounts are blocked — determine the dominant blocking reason and
|
|
61
|
+
* the soonest time any account becomes available.
|
|
62
|
+
*/
|
|
63
|
+
function resolveBlockedStatus(accounts) {
|
|
64
|
+
const allCooling = accounts.every((a) => a.coolingDown);
|
|
65
|
+
if (allCooling) {
|
|
66
|
+
const cooldownTimes = accounts
|
|
67
|
+
.map((a) => a.cooldownMs)
|
|
68
|
+
.filter((ms) => ms > 0);
|
|
69
|
+
const minMs = cooldownTimes.length > 0 ? Math.min(...cooldownTimes) : 0;
|
|
70
|
+
const reason = accounts[0]?.cooldownReason;
|
|
71
|
+
return buildCooldownStatus(minMs, reason);
|
|
72
|
+
}
|
|
73
|
+
// Mix of cooldown + rate-limited, or all rate-limited → WAIT
|
|
74
|
+
const waitTimes = accounts
|
|
75
|
+
.map((a) => (a.coolingDown ? a.cooldownMs : a.rateLimitWaitMs))
|
|
76
|
+
.filter((ms) => ms > 0);
|
|
77
|
+
const minMs = waitTimes.length > 0 ? Math.min(...waitTimes) : undefined;
|
|
78
|
+
return buildWaitStatus(minMs);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=model-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-status.js","sourceRoot":"","sources":["../../../../src/plugin/ui/model-status.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,GAChB,MAAM,gBAAgB,CAAA;AAgBvB;;;GAGG;AACH,MAAM,eAAe,GAA+B;IAClD,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,CAAC;CACZ,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,0BAA0B,CACxC,QAAuC;IAEvC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;IAC3B,CAAC;IAED,MAAM,SAAS,GAAyB,EAAE,CAAA;IAC1C,MAAM,OAAO,GAAyB,EAAE,CAAA;IAExC,KAAK,MAAM,OAAO,IAAI,QAAQ,EA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AC,EAAE,GAAG,CAAC,CAAC,CAAA;QACzB,MAAM,KAAK,GAAG,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACvE,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,cAAc,CAAA;QAC1C,OAAO,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAC3C,CAAC;IAED,6DAA6D;IAC7D,MAAM,SAAS,GAAG,QAAQ;SACvB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;SAC9D,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;IAEzB,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACvE,OAAO,eAAe,CAAC,KAAK,CAAC,CAAA;AAC/B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expiren/opencode-antigravity-auth",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.19",
|
|
4
4
|
"description": "Google Antigravity IDE OAuth auth plugin for Opencode - access Gemini 3 Pro and Claude 4.6 using Google credentials",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|