@cortexkit/opencode-antigravity-auth 3.0.14 → 3.0.15

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.
Files changed (50) hide show
  1. package/dist/cli.js.map +2 -2
  2. package/dist/cli.meta.json +4 -4
  3. package/dist/index.js +211 -33
  4. package/dist/index.js.map +2 -2
  5. package/dist/index.meta.json +8 -8
  6. package/dist/server.js +242 -38
  7. package/dist/server.js.map +3 -3
  8. package/dist/server.meta.json +1 -1
  9. package/dist/src/ga/tui/host-ga.d.ts +55 -2
  10. package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
  11. package/dist/src/ga/tui/host-ga.js +73 -43
  12. package/dist/src/ga/tui/host-ga.js.map +1 -1
  13. package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
  14. package/dist/src/plugin/ga-location-services.js +49 -5
  15. package/dist/src/plugin/ga-location-services.js.map +1 -1
  16. package/dist/src/plugin/shared/vault-request-credentials.d.ts +33 -13
  17. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  18. package/dist/src/plugin/shared/vault-request-credentials.js +97 -44
  19. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
  20. package/dist/src/tui/quota-layout.d.ts +1 -1
  21. package/dist/src/tui/quota-layout.js +1 -1
  22. package/dist/src/tui/sidebar-frame.d.ts +109 -0
  23. package/dist/src/tui/sidebar-frame.d.ts.map +1 -0
  24. package/dist/src/tui/sidebar-frame.js +244 -0
  25. package/dist/src/tui/sidebar-frame.js.map +1 -0
  26. package/dist/src/tui.d.ts.map +1 -1
  27. package/dist/src/tui.js +11 -251
  28. package/dist/src/tui.js.map +1 -1
  29. package/dist/tui-build-map.json +120 -92
  30. package/dist/tui-ga-build-map.json +22 -8
  31. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
  32. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +33 -13
  33. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  34. package/package.json +2 -2
  35. package/src/tui/entry.mjs +19 -1
  36. package/src/tui-compiled/sidebar-projection.js +119 -0
  37. package/src/tui-compiled/tui/quota-layout.js +1 -1
  38. package/src/tui-compiled/tui/sidebar-frame.js +657 -0
  39. package/src/tui-compiled/tui.js +25 -606
  40. package/src/tui-ga-compiled/host-ga.js +116 -124
  41. package/src/tui-ga-compiled/shared/ced204104a639c9c-sidebar-frame.js +657 -0
  42. package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +1 -1
  43. package/src/tui-ga-raw/host-ga.tsx +157 -95
  44. package/src/tui-ga-raw/shared/ced204104a639c9c-sidebar-frame.tsx +603 -0
  45. package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +1 -1
  46. package/src/tui-raw/sidebar-projection.js +119 -0
  47. package/src/tui-raw/tui/quota-layout.tsx +1 -1
  48. package/src/tui-raw/tui/sidebar-frame.tsx +603 -0
  49. package/src/tui-raw/tui.tsx +25 -523
  50. package/src/tui.tsx +25 -523
package/src/tui/entry.mjs CHANGED
@@ -22,6 +22,23 @@ function loadV1() {
22
22
  return v1Root
23
23
  }
24
24
 
25
+ // The plugin version for the OpenCode 2 sidebar header, passed to the GA
26
+ // setup. The GA root may use no Node built-in (the TUI build refuses one),
27
+ // so it cannot read package.json; this entry can. Read lazily on setup, so
28
+ // importing the entry stays inert, and never fatal: without a version the
29
+ // header just leaves it out.
30
+ async function packageVersion() {
31
+ try {
32
+ const manifest = await import('../../package.json', {
33
+ with: { type: 'json' },
34
+ })
35
+ const version = manifest.default?.version
36
+ return typeof version === 'string' ? version : ''
37
+ } catch {
38
+ return ''
39
+ }
40
+ }
41
+
25
42
  function loadGa() {
26
43
  gaRoot ??= loadTui({
27
44
  rawEntry: new URL('../tui-ga-raw/host-ga.tsx', import.meta.url).href,
@@ -37,6 +54,7 @@ export default {
37
54
  return (await loadV1()).tui(api, options, meta)
38
55
  },
39
56
  async setup(context) {
40
- return (await loadGa()).setup(context)
57
+ const [root, version] = await Promise.all([loadGa(), packageVersion()])
58
+ return root.setup(context, { version })
41
59
  },
42
60
  }
@@ -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` render after the quota rows (the OpenCode 2 health line).
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());