@cortexkit/opencode-antigravity-auth 3.0.14 → 3.0.16
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/cli.js +257 -57
- package/dist/cli.js.map +3 -3
- package/dist/cli.meta.json +11 -11
- package/dist/index.js +468 -90
- package/dist/index.js.map +3 -3
- package/dist/index.meta.json +14 -14
- package/dist/server.js +499 -95
- package/dist/server.js.map +3 -3
- package/dist/server.meta.json +1 -1
- package/dist/src/ga/tui/host-ga.d.ts +55 -2
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +73 -43
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +49 -5
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +33 -13
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +97 -44
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/src/plugin/storage.d.ts +17 -0
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +44 -10
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/runtime-paths.d.ts +2 -1
- package/dist/src/runtime-paths.d.ts.map +1 -1
- package/dist/src/runtime-paths.js +5 -5
- package/dist/src/runtime-paths.js.map +1 -1
- package/dist/src/tui/quota-layout.d.ts +1 -1
- package/dist/src/tui/quota-layout.js +1 -1
- package/dist/src/tui/sidebar-frame.d.ts +109 -0
- package/dist/src/tui/sidebar-frame.d.ts.map +1 -0
- package/dist/src/tui/sidebar-frame.js +244 -0
- package/dist/src/tui/sidebar-frame.js.map +1 -0
- package/dist/src/tui.d.ts.map +1 -1
- package/dist/src/tui.js +11 -251
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +120 -92
- package/dist/tui-ga-build-map.json +22 -8
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +33 -13
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/types/src/plugin/storage.d.ts +17 -0
- package/dist/types/src/plugin/storage.d.ts.map +1 -1
- package/dist/types/src/runtime-paths.d.ts +2 -1
- package/dist/types/src/runtime-paths.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/tui/entry.mjs +19 -1
- package/src/tui-compiled/sidebar-projection.js +119 -0
- package/src/tui-compiled/tui/quota-layout.js +1 -1
- package/src/tui-compiled/tui/sidebar-frame.js +657 -0
- package/src/tui-compiled/tui.js +25 -606
- package/src/tui-ga-compiled/host-ga.js +116 -124
- package/src/tui-ga-compiled/shared/ced204104a639c9c-sidebar-frame.js +657 -0
- package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +1 -1
- package/src/tui-ga-raw/host-ga.tsx +157 -95
- package/src/tui-ga-raw/shared/ced204104a639c9c-sidebar-frame.tsx +603 -0
- package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +1 -1
- package/src/tui-raw/sidebar-projection.js +119 -0
- package/src/tui-raw/tui/quota-layout.tsx +1 -1
- package/src/tui-raw/tui/sidebar-frame.tsx +603 -0
- package/src/tui-raw/tui.tsx +25 -523
- package/src/tui.tsx +25 -523
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { quotaReadingParts } from "./quota-presentation.js";
|
|
2
|
+
export const QUOTA_POOL_LABELS = {
|
|
3
|
+
gemini: "Gemini",
|
|
4
|
+
"non-gemini": "Other models",
|
|
5
|
+
"gemini-argon": "Argon"
|
|
6
|
+
};
|
|
7
|
+
const POOL_ORDER = [
|
|
8
|
+
"gemini",
|
|
9
|
+
"non-gemini",
|
|
10
|
+
"gemini-argon"
|
|
11
|
+
];
|
|
12
|
+
function clamp(value) {
|
|
13
|
+
if (!Number.isFinite(value))
|
|
14
|
+
return 0;
|
|
15
|
+
return Math.min(100, Math.max(0, value));
|
|
16
|
+
}
|
|
17
|
+
export function remainingTone(remaining) {
|
|
18
|
+
if (remaining === null)
|
|
19
|
+
return "muted";
|
|
20
|
+
if (remaining <= 10)
|
|
21
|
+
return "err";
|
|
22
|
+
if (remaining <= 30)
|
|
23
|
+
return "warn";
|
|
24
|
+
return "ok";
|
|
25
|
+
}
|
|
26
|
+
export function formatResetIn(resetAt, now) {
|
|
27
|
+
if (!resetAt)
|
|
28
|
+
return "";
|
|
29
|
+
const ms = resetAt - now;
|
|
30
|
+
if (ms <= 0)
|
|
31
|
+
return "now";
|
|
32
|
+
const mins = Math.floor(ms / 60000);
|
|
33
|
+
if (mins < 60)
|
|
34
|
+
return `${mins}m`;
|
|
35
|
+
const hrs = Math.floor(mins / 60);
|
|
36
|
+
if (hrs < 24) {
|
|
37
|
+
const rm = mins % 60;
|
|
38
|
+
return rm > 0 ? `${hrs}h${rm}m` : `${hrs}h`;
|
|
39
|
+
}
|
|
40
|
+
const days = Math.floor(hrs / 24), rh = hrs % 24;
|
|
41
|
+
return rh > 0 ? `${days}d${rh}h` : `${days}d`;
|
|
42
|
+
}
|
|
43
|
+
export function formatWait(ms) {
|
|
44
|
+
const seconds = Math.ceil(ms / 1000);
|
|
45
|
+
if (seconds < 60)
|
|
46
|
+
return `${seconds}s`;
|
|
47
|
+
const minutes = Math.floor(seconds / 60), remaining = seconds % 60;
|
|
48
|
+
return remaining > 0 ? `${minutes}m ${remaining}s` : `${minutes}m`;
|
|
49
|
+
}
|
|
50
|
+
function quotaRows(account, now) {
|
|
51
|
+
const rows = [];
|
|
52
|
+
for (const key of POOL_ORDER) {
|
|
53
|
+
const entry = account.quota[key], label = QUOTA_POOL_LABELS[key];
|
|
54
|
+
if (!entry) {
|
|
55
|
+
if (key === "gemini-argon")
|
|
56
|
+
continue;
|
|
57
|
+
rows.push({
|
|
58
|
+
label,
|
|
59
|
+
remaining: null,
|
|
60
|
+
figure: quotaReadingParts(label, void 0, now).figure,
|
|
61
|
+
tone: "muted",
|
|
62
|
+
reset: ""
|
|
63
|
+
});
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const windows = entry.windows ?? [];
|
|
67
|
+
if (windows.length === 0) {
|
|
68
|
+
const parts = quotaReadingParts(label, entry, now);
|
|
69
|
+
rows.push({
|
|
70
|
+
label,
|
|
71
|
+
remaining: parts.remaining,
|
|
72
|
+
figure: parts.figure,
|
|
73
|
+
tone: remainingTone(parts.remaining),
|
|
74
|
+
reset: parts.detail
|
|
75
|
+
});
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
for (const window of windows) {
|
|
79
|
+
const parts = quotaReadingParts(label, window, now);
|
|
80
|
+
rows.push({
|
|
81
|
+
label: `${label} ${parts.name}`,
|
|
82
|
+
remaining: parts.remaining,
|
|
83
|
+
figure: parts.figure,
|
|
84
|
+
tone: remainingTone(parts.remaining),
|
|
85
|
+
reset: parts.detail
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return rows;
|
|
90
|
+
}
|
|
91
|
+
export function projectAccount(account, now) {
|
|
92
|
+
const cooling = typeof account.cooldownUntil === "number" && account.cooldownUntil > now, status = !account.enabled ? "off" : cooling ? "cooling" : account.current ? "active" : "idle", statusTone = status === "off" ? "muted" : status === "cooling" ? "warn" : status === "active" ? "ok" : "muted", base = `health ${Math.round(clamp(account.health))}`, health = cooling ? `${base} \xB7 cooling ${formatWait(account.cooldownUntil - now)}` : base;
|
|
93
|
+
return {
|
|
94
|
+
id: account.id,
|
|
95
|
+
label: account.label,
|
|
96
|
+
status,
|
|
97
|
+
statusTone,
|
|
98
|
+
quota: quotaRows(account, now),
|
|
99
|
+
health
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function projectSidebar(input) {
|
|
103
|
+
const accounts = input.accounts.map((account) => projectAccount(account, input.now));
|
|
104
|
+
let route = null;
|
|
105
|
+
if (input.route)
|
|
106
|
+
route = [
|
|
107
|
+
input.accounts.find((account) => account.id === input.route?.accountId)?.label ?? "unknown account",
|
|
108
|
+
input.route.modelFamily,
|
|
109
|
+
input.route.headerStyle
|
|
110
|
+
].join(" \xB7 ");
|
|
111
|
+
const notices = [];
|
|
112
|
+
if (input.status.quotaBackoffUntil !== null && input.status.quotaBackoffUntil > input.now)
|
|
113
|
+
notices.push(`quota checks paused ${formatWait(input.status.quotaBackoffUntil - input.now)}`);
|
|
114
|
+
if (input.status.checkedAt === null)
|
|
115
|
+
notices.push("quota not checked yet");
|
|
116
|
+
if (accounts.length === 0)
|
|
117
|
+
notices.push("no accounts");
|
|
118
|
+
return { accounts, route, notices };
|
|
119
|
+
}
|
|
@@ -252,7 +252,7 @@ function WindowRow(props) {
|
|
|
252
252
|
* right-aligned; the age moves to its own dim line when the three do not
|
|
253
253
|
* fit. Below it each quota group present gets a plain-word header and one
|
|
254
254
|
* row per window, or a single dim line when there is no reading at all.
|
|
255
|
-
* `children
|
|
255
|
+
* `children`, when given, render after the quota rows.
|
|
256
256
|
*/
|
|
257
257
|
export function QuotaAccountBlock(props) {
|
|
258
258
|
const windows = () => accountWindows(props.account, props.now());
|