@cortexkit/opencode-antigravity-auth 3.0.6 → 3.0.7
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 +620 -120
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +128 -44
- package/dist/index.js +1469 -675
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +154 -73
- package/dist/server.js +1075 -280
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +11 -1
- package/dist/src/common-auth-embedded/claustrum/consumer.js +38 -1
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +29 -0
- package/dist/src/common-auth-embedded/claustrum/custody.js +17 -0
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +6 -1
- package/dist/src/common-auth-embedded/pi-slot/lock.js +7 -3
- package/dist/src/common-auth-embedded/quota/format.d.ts +14 -3
- package/dist/src/common-auth-embedded/quota/format.js +135 -18
- package/dist/src/common-auth-embedded/quota/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/quota/index.js +1 -1
- package/dist/src/common-auth-embedded/setup/command-error.d.ts +32 -0
- package/dist/src/common-auth-embedded/setup/command-error.js +79 -0
- package/dist/src/common-auth-embedded/setup/command-runner.js +118 -24
- package/dist/src/common-auth-embedded/setup/command.js +75 -19
- package/dist/src/common-auth-embedded/setup/enroll.js +17 -5
- package/dist/src/common-auth-embedded/setup/index.d.ts +2 -1
- package/dist/src/common-auth-embedded/setup/index.js +1 -0
- package/dist/src/common-auth-embedded/setup/register.js +8 -2
- package/dist/src/common-auth-embedded/setup/types.d.ts +14 -0
- package/dist/src/common-auth-embedded/source-output.json +92 -76
- package/dist/src/common-auth-embedded/store/pool.d.ts +1 -1
- package/dist/src/common-auth-embedded/store/pool.js +0 -1
- package/dist/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
- package/dist/src/common-auth-embedded/store/refresh-lock.js +0 -1
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +4 -2
- package/dist/src/ga/server/index.js.map +1 -1
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +37 -3
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/src/plugin/config/schema.js +2 -1
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +4 -3
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/src/plugin/gemini-dump.js +2 -5
- package/dist/src/plugin/gemini-dump.js.map +1 -1
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +3 -3
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/logging-utils.d.ts.map +1 -1
- package/dist/src/plugin/logging-utils.js +2 -5
- package/dist/src/plugin/logging-utils.js.map +1 -1
- package/dist/src/plugin/request.d.ts +1 -2
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +8 -12
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/shared/request-services.d.ts +8 -1
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +140 -58
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +12 -3
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +3 -0
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/src/plugin/vault-custody.d.ts +14 -1
- package/dist/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/src/plugin/vault-custody.js +57 -10
- package/dist/src/plugin/vault-custody.js.map +1 -1
- package/dist/src/sidebar-projection.d.ts +4 -0
- package/dist/src/sidebar-projection.d.ts.map +1 -1
- package/dist/src/sidebar-projection.js +6 -2
- package/dist/src/sidebar-projection.js.map +1 -1
- package/dist/src/tui/quota-layout.d.ts +94 -0
- package/dist/src/tui/quota-layout.d.ts.map +1 -0
- package/dist/src/tui/quota-layout.js +139 -0
- package/dist/src/tui/quota-layout.js.map +1 -0
- package/dist/src/tui/route-layout.d.ts +8 -0
- package/dist/src/tui/route-layout.d.ts.map +1 -0
- package/dist/src/tui/route-layout.js +36 -0
- package/dist/src/tui/route-layout.js.map +1 -0
- package/dist/src/tui.d.ts.map +1 -1
- package/dist/src/tui.js +26 -128
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +42 -13
- package/dist/tui-ga-build-map.json +46 -17
- package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +11 -1
- package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +29 -0
- package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
- package/dist/types/src/common-auth-embedded/quota/format.d.ts +14 -3
- package/dist/types/src/common-auth-embedded/quota/index.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/setup/command-error.d.ts +32 -0
- package/dist/types/src/common-auth-embedded/setup/index.d.ts +2 -1
- package/dist/types/src/common-auth-embedded/setup/types.d.ts +14 -0
- package/dist/types/src/common-auth-embedded/store/pool.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/dist/types/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/types/src/plugin/index.d.ts.map +1 -1
- package/dist/types/src/plugin/logging-utils.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts +1 -2
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/request-services.d.ts +8 -1
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +12 -3
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-custody.d.ts +14 -1
- package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/common-auth-embedded/claustrum/consumer.d.ts +11 -1
- package/src/common-auth-embedded/claustrum/consumer.js +38 -1
- package/src/common-auth-embedded/claustrum/custody.d.ts +29 -0
- package/src/common-auth-embedded/claustrum/custody.js +17 -0
- package/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
- package/src/common-auth-embedded/fs/refresh-file-lock.js +6 -1
- package/src/common-auth-embedded/pi-slot/lock.js +7 -3
- package/src/common-auth-embedded/quota/format.d.ts +14 -3
- package/src/common-auth-embedded/quota/format.js +135 -18
- package/src/common-auth-embedded/quota/index.d.ts +1 -1
- package/src/common-auth-embedded/quota/index.js +1 -1
- package/src/common-auth-embedded/setup/command-error.d.ts +32 -0
- package/src/common-auth-embedded/setup/command-error.js +79 -0
- package/src/common-auth-embedded/setup/command-runner.js +118 -24
- package/src/common-auth-embedded/setup/command.js +75 -19
- package/src/common-auth-embedded/setup/enroll.js +17 -5
- package/src/common-auth-embedded/setup/index.d.ts +2 -1
- package/src/common-auth-embedded/setup/index.js +1 -0
- package/src/common-auth-embedded/setup/register.js +8 -2
- package/src/common-auth-embedded/setup/types.d.ts +14 -0
- package/src/common-auth-embedded/source-output.json +92 -76
- package/src/common-auth-embedded/store/pool.d.ts +1 -1
- package/src/common-auth-embedded/store/pool.js +0 -1
- package/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
- package/src/common-auth-embedded/store/refresh-lock.js +0 -1
- package/src/tui-compiled/common-auth-embedded/quota/format.js +135 -18
- package/src/tui-compiled/common-auth-embedded/quota/index.js +1 -1
- package/src/tui-compiled/tui/quota-layout.js +378 -0
- package/src/tui-compiled/tui/route-layout.js +30 -0
- package/src/tui-compiled/tui.js +145 -427
- package/src/tui-ga-compiled/host-ga.js +82 -52
- package/src/tui-ga-compiled/shared/6ca47cd4ec33fe72-route-layout.js +30 -0
- package/src/tui-ga-compiled/shared/8ae1927e5910ea81-sidebar-projection.js +2 -2
- package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +135 -18
- package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +1 -1
- package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +378 -0
- package/src/tui-ga-raw/host-ga.tsx +71 -30
- package/src/tui-ga-raw/shared/6ca47cd4ec33fe72-route-layout.js +30 -0
- package/src/tui-ga-raw/shared/8ae1927e5910ea81-sidebar-projection.js +2 -2
- package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +135 -18
- package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +1 -1
- package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +391 -0
- package/src/tui-raw/common-auth-embedded/quota/format.js +135 -18
- package/src/tui-raw/common-auth-embedded/quota/index.js +1 -1
- package/src/tui-raw/tui/quota-layout.tsx +391 -0
- package/src/tui-raw/tui/route-layout.js +30 -0
- package/src/tui-raw/tui.tsx +50 -309
- package/src/tui.tsx +50 -309
package/src/tui-raw/tui.tsx
CHANGED
|
@@ -13,14 +13,16 @@
|
|
|
13
13
|
* score, and per-session routing decisions), so the fleet components are
|
|
14
14
|
* adapted rather than copied verbatim:
|
|
15
15
|
*
|
|
16
|
-
* -
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* - The quota rows come from `tui/quota-layout.tsx`, shared with the
|
|
17
|
+
* OpenCode 2 sidebar: each window reads `remainingPercent + resetAt` from
|
|
18
|
+
* the Antigravity `SidebarQuotaEntry` shape, is colored via `quotaTone`
|
|
19
|
+
* (remaining threshold) instead of `usageTone` (used threshold), and is
|
|
20
|
+
* one line sized from the measured sidebar width.
|
|
20
21
|
* - `AccountBlock` derives its status word (`active` / `idle` /
|
|
21
|
-
* `cooling` / `off`) from the Antigravity account state
|
|
22
|
-
* reading age once per account
|
|
23
|
-
* `Other models` headers. The routing health score is not
|
|
22
|
+
* `cooling` / `off`) from the Antigravity account state; the shared block
|
|
23
|
+
* shows the reading age once per account and groups windows under
|
|
24
|
+
* `Gemini` and `Other models` headers. The routing health score is not
|
|
25
|
+
* shown.
|
|
24
26
|
* - `Routing` shows the mounted session's most recent `activeRouting`
|
|
25
27
|
* entry, or `No request yet` before the session's first request, since
|
|
26
28
|
* Antigravity does not maintain a per-session sidebar state alongside the
|
|
@@ -47,13 +49,7 @@ import type {
|
|
|
47
49
|
} from "@opencode-ai/plugin/tui"
|
|
48
50
|
import { createSlot } from "@opentui/solid"
|
|
49
51
|
import { createSignal, For, type JSX, onCleanup, onMount, Show } from "solid-js"
|
|
50
|
-
import {
|
|
51
|
-
NO_QUOTA_READING,
|
|
52
|
-
type QuotaReading,
|
|
53
|
-
type QuotaWindowText,
|
|
54
|
-
quotaReadingAge,
|
|
55
|
-
quotaWindowText,
|
|
56
|
-
} from "./quota-presentation.js"
|
|
52
|
+
import { NO_QUOTA_READING } from "./quota-presentation.js"
|
|
57
53
|
import { getRpcDir } from "./rpc/rpc-dir.js"
|
|
58
54
|
import {
|
|
59
55
|
readSidebarState,
|
|
@@ -67,6 +63,19 @@ import {
|
|
|
67
63
|
dispatchV1Notification,
|
|
68
64
|
type V1Notification,
|
|
69
65
|
} from "./tui/host-v1.tsx"
|
|
66
|
+
import {
|
|
67
|
+
type AccountWindow,
|
|
68
|
+
ASSUMED_CONTENT_WIDTH,
|
|
69
|
+
accountWindows,
|
|
70
|
+
fitLabel,
|
|
71
|
+
QuotaAccountBlock,
|
|
72
|
+
type QuotaPalette,
|
|
73
|
+
type QuotaTone,
|
|
74
|
+
quotaTone,
|
|
75
|
+
RESET_SINCE_READING,
|
|
76
|
+
showsFigure,
|
|
77
|
+
} from "./tui/quota-layout.tsx"
|
|
78
|
+
import { routeLineFits } from "./tui/route-layout.js"
|
|
70
79
|
import {
|
|
71
80
|
type AntigravityAuthTuiPrefs,
|
|
72
81
|
type AppearancePrefs,
|
|
@@ -128,36 +137,11 @@ let rpcInFlight = false
|
|
|
128
137
|
const GLOBAL_NOTIFICATION_CURSOR = '__global__'
|
|
129
138
|
const MAX_NOTIFICATION_CURSORS = 256
|
|
130
139
|
|
|
131
|
-
// Group headers name each quota pool in plain words.
|
|
132
|
-
const GROUP_NAMES: Record<SidebarQuotaKey, string> = {
|
|
133
|
-
gemini: 'Gemini',
|
|
134
|
-
'non-gemini': 'Other models',
|
|
135
|
-
}
|
|
136
|
-
|
|
137
140
|
// The collapsed row has room for one word before the window name.
|
|
138
141
|
const COLLAPSED_GROUP_NAMES: Record<SidebarQuotaKey, string> = {
|
|
139
142
|
gemini: 'Gemini',
|
|
140
143
|
'non-gemini': 'Other',
|
|
141
144
|
}
|
|
142
|
-
|
|
143
|
-
const QUOTA_ORDER: readonly SidebarQuotaKey[] = ['gemini', 'non-gemini']
|
|
144
|
-
|
|
145
|
-
// Shown instead of a stored figure once the window has reset since it was
|
|
146
|
-
// read: the stored figure describes the window before the reset.
|
|
147
|
-
const RESET_SINCE_READING = 'reset since last check'
|
|
148
|
-
|
|
149
|
-
// Content width (the panel's width inside its padding) used until the first
|
|
150
|
-
// layout pass reports the real one. It fits the narrowest OpenCode sidebar.
|
|
151
|
-
const ASSUMED_CONTENT_WIDTH = 28
|
|
152
|
-
|
|
153
|
-
// A window row is `<name> <bar> <figure> <reset>`. The bar shrinks to this
|
|
154
|
-
// before the reset column is dropped; below it the bar is dropped too.
|
|
155
|
-
const MIN_BAR_WIDTH = 4
|
|
156
|
-
// The widest figure the formatter writes: `100% left`.
|
|
157
|
-
const FIGURE_WIDTH = 9
|
|
158
|
-
// A window name (`5h`, `7d`) and the space after it.
|
|
159
|
-
const NAME_WIDTH = 3
|
|
160
|
-
|
|
161
145
|
// --- Theme tokens ----------------------------------------------------------
|
|
162
146
|
//
|
|
163
147
|
// The sidebar pulls its colors from the live host theme (`api.theme.current`
|
|
@@ -171,7 +155,7 @@ const NAME_WIDTH = 3
|
|
|
171
155
|
// uses are populated; the rest of the TuiThemeCurrent fields are left
|
|
172
156
|
// undefined and the `??` chain in `toneColor` falls through cleanly.
|
|
173
157
|
|
|
174
|
-
type Tone =
|
|
158
|
+
type Tone = QuotaTone
|
|
175
159
|
type Theme = TuiThemeCurrent
|
|
176
160
|
type ThemeColor = Theme['text']
|
|
177
161
|
|
|
@@ -250,31 +234,15 @@ function toneColor(theme: Theme, tone: Tone): ThemeColor {
|
|
|
250
234
|
}
|
|
251
235
|
}
|
|
252
236
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
function quotaBarSegments(
|
|
265
|
-
remainingPct: number,
|
|
266
|
-
width: number,
|
|
267
|
-
appearance: AppearancePrefs,
|
|
268
|
-
): BarSegment[] {
|
|
269
|
-
const usedCells = Math.max(
|
|
270
|
-
0,
|
|
271
|
-
Math.min(Math.round((remainingPct / 100) * width), width),
|
|
272
|
-
)
|
|
273
|
-
const tone = quotaTone(100 - remainingPct, appearance)
|
|
274
|
-
return [
|
|
275
|
-
{ text: appearance.barFilledChar.repeat(usedCells), tone },
|
|
276
|
-
{ text: appearance.barEmptyChar.repeat(width - usedCells), tone },
|
|
277
|
-
].filter((segment) => segment.text.length > 0)
|
|
237
|
+
// The shared quota layout reads its colors through this palette. Muted text
|
|
238
|
+
// and the account label read `textMuted` and `text` straight from the theme,
|
|
239
|
+
// without the `toneColor` fallback chain.
|
|
240
|
+
function themePalette(theme: () => Theme): QuotaPalette {
|
|
241
|
+
return {
|
|
242
|
+
text: () => theme().text,
|
|
243
|
+
muted: () => theme().textMuted,
|
|
244
|
+
tone: (tone) => toneColor(theme(), tone),
|
|
245
|
+
}
|
|
278
246
|
}
|
|
279
247
|
|
|
280
248
|
export interface SidebarPanelProps {
|
|
@@ -505,161 +473,8 @@ function CollapsedRow(props: {
|
|
|
505
473
|
)
|
|
506
474
|
}
|
|
507
475
|
|
|
508
|
-
//
|
|
509
|
-
//
|
|
510
|
-
// The OpenCode 1 sidebar is about 32 to 48 columns wide. Every quota line is
|
|
511
|
-
// sized from the measured content width so that it fits on one line: text is
|
|
512
|
-
// never left to the renderer's wrapping, which breaks a row mid-word or down
|
|
513
|
-
// to one character per line once the right-hand column runs out of room.
|
|
514
|
-
|
|
515
|
-
interface AccountWindow {
|
|
516
|
-
key: SidebarQuotaKey
|
|
517
|
-
reading: QuotaReading
|
|
518
|
-
text: QuotaWindowText
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
// One entry per stored window, in group order. A pool stored before
|
|
522
|
-
// per-window readings existed contributes one window without a name.
|
|
523
|
-
function accountWindows(
|
|
524
|
-
account: SidebarAccountState,
|
|
525
|
-
now: number,
|
|
526
|
-
): AccountWindow[] {
|
|
527
|
-
const result: AccountWindow[] = []
|
|
528
|
-
for (const key of QUOTA_ORDER) {
|
|
529
|
-
const entry = account.quota[key]
|
|
530
|
-
if (!entry) continue
|
|
531
|
-
const readings: QuotaReading[] =
|
|
532
|
-
entry.windows && entry.windows.length > 0
|
|
533
|
-
? entry.windows.map((window) => ({
|
|
534
|
-
window: window.window,
|
|
535
|
-
remainingPercent: window.remainingPercent,
|
|
536
|
-
resetAt: window.resetAt,
|
|
537
|
-
checkedAt: window.checkedAt,
|
|
538
|
-
}))
|
|
539
|
-
: [
|
|
540
|
-
{
|
|
541
|
-
remainingPercent: entry.remainingPercent,
|
|
542
|
-
resetAt: entry.resetAt,
|
|
543
|
-
checkedAt: entry.checkedAt,
|
|
544
|
-
},
|
|
545
|
-
]
|
|
546
|
-
for (const reading of readings)
|
|
547
|
-
result.push({ key, reading, text: quotaWindowText(reading, now) })
|
|
548
|
-
}
|
|
549
|
-
return result
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
// A window shows its figure only while no reset has happened since it was
|
|
553
|
-
// read and it has a read time at all.
|
|
554
|
-
function showsFigure(window: AccountWindow): boolean {
|
|
555
|
-
return window.text.remaining != null && !window.text.resetSinceReading
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
interface WindowRowLayout {
|
|
559
|
-
bar: number
|
|
560
|
-
reset: boolean
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
// Column widths for one `<name> <bar> <figure> <reset>` row within `width`
|
|
564
|
-
// cells. The bar shrinks first, down to MIN_BAR_WIDTH; then the reset column
|
|
565
|
-
// is dropped; then the bar.
|
|
566
|
-
function windowRowLayout(
|
|
567
|
-
width: number,
|
|
568
|
-
named: boolean,
|
|
569
|
-
resetWidth: number,
|
|
570
|
-
maxBar: number,
|
|
571
|
-
): WindowRowLayout {
|
|
572
|
-
const room = width - (named ? NAME_WIDTH : 0) - FIGURE_WIDTH
|
|
573
|
-
if (resetWidth > 0) {
|
|
574
|
-
const bar = Math.min(maxBar, room - resetWidth - 2)
|
|
575
|
-
if (bar >= MIN_BAR_WIDTH) return { bar, reset: true }
|
|
576
|
-
}
|
|
577
|
-
const bar = Math.min(maxBar, room - 1)
|
|
578
|
-
return { bar: bar >= MIN_BAR_WIDTH ? bar : 0, reset: false }
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
// Shorten a label to `max` cells, marking the cut with an ellipsis.
|
|
582
|
-
function fitLabel(label: string, max: number): string {
|
|
583
|
-
if (label.length <= max) return label
|
|
584
|
-
if (max <= 0) return ''
|
|
585
|
-
if (max === 1) return '…'
|
|
586
|
-
return `${label.slice(0, max - 1)}…`
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
// One quota window on one line. The bar fills with remaining quota; the
|
|
590
|
-
// figure and reset come from the shared formatter. A window that reset since
|
|
591
|
-
// its reading shows that fact, dim, in place of the stale figure.
|
|
592
|
-
function WindowRow(props: {
|
|
593
|
-
theme: () => Theme
|
|
594
|
-
appearance: AppearancePrefs
|
|
595
|
-
window: AccountWindow
|
|
596
|
-
layout: WindowRowLayout
|
|
597
|
-
}): JSX.Element {
|
|
598
|
-
const text = () => props.window.text
|
|
599
|
-
const tone = () => quotaTone(100 - (text().remaining ?? 0), props.appearance)
|
|
600
|
-
return (
|
|
601
|
-
<box width='100%' flexDirection='row'>
|
|
602
|
-
<Show when={text().name !== ''}>
|
|
603
|
-
<text
|
|
604
|
-
width={NAME_WIDTH}
|
|
605
|
-
flexShrink={0}
|
|
606
|
-
wrapMode='none'
|
|
607
|
-
fg={props.theme().textMuted}
|
|
608
|
-
>
|
|
609
|
-
{text().name}
|
|
610
|
-
</text>
|
|
611
|
-
</Show>
|
|
612
|
-
<Show
|
|
613
|
-
when={showsFigure(props.window)}
|
|
614
|
-
fallback={
|
|
615
|
-
<text flexShrink={1} wrapMode='none' fg={props.theme().textMuted}>
|
|
616
|
-
{text().resetSinceReading ? RESET_SINCE_READING : text().figure}
|
|
617
|
-
</text>
|
|
618
|
-
}
|
|
619
|
-
>
|
|
620
|
-
<Show when={props.layout.bar > 0}>
|
|
621
|
-
<box width={props.layout.bar + 1} flexShrink={0} flexDirection='row'>
|
|
622
|
-
<For
|
|
623
|
-
each={quotaBarSegments(
|
|
624
|
-
text().remaining ?? 0,
|
|
625
|
-
props.layout.bar,
|
|
626
|
-
props.appearance,
|
|
627
|
-
)}
|
|
628
|
-
>
|
|
629
|
-
{(segment) => (
|
|
630
|
-
<text
|
|
631
|
-
wrapMode='none'
|
|
632
|
-
fg={toneColor(props.theme(), segment.tone)}
|
|
633
|
-
>
|
|
634
|
-
{segment.text}
|
|
635
|
-
</text>
|
|
636
|
-
)}
|
|
637
|
-
</For>
|
|
638
|
-
</box>
|
|
639
|
-
</Show>
|
|
640
|
-
<text
|
|
641
|
-
flexShrink={0}
|
|
642
|
-
wrapMode='none'
|
|
643
|
-
fg={toneColor(props.theme(), tone())}
|
|
644
|
-
>
|
|
645
|
-
{text().figure}
|
|
646
|
-
</text>
|
|
647
|
-
<box flexGrow={1} />
|
|
648
|
-
<Show when={props.layout.reset && text().reset !== ''}>
|
|
649
|
-
<text flexShrink={0} wrapMode='none' fg={props.theme().textMuted}>
|
|
650
|
-
{text().reset}
|
|
651
|
-
</text>
|
|
652
|
-
</Show>
|
|
653
|
-
</Show>
|
|
654
|
-
</box>
|
|
655
|
-
)
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
// Fleet AccountBlock, adapted to Antigravity's per-account data. The header
|
|
659
|
-
// line is the account label, the reading age when the oldest reading is
|
|
660
|
-
// stale, and the status word right-aligned; the age moves to its own dim
|
|
661
|
-
// line when the three do not fit. Below it each quota group present gets a
|
|
662
|
-
// plain-word header and one WindowRow per window. Status word priorities
|
|
476
|
+
// One account in the Quota section: the shared quota block, with the status
|
|
477
|
+
// word computed from the sidebar file's account state. Status word priorities
|
|
663
478
|
// (first match wins):
|
|
664
479
|
// - `off` when the account is disabled
|
|
665
480
|
// - `cooling <wait>` when cooldownUntil is still in the future
|
|
@@ -690,92 +505,17 @@ function AccountBlock(props: {
|
|
|
690
505
|
if (cooldownMs() > 0) return 'warn'
|
|
691
506
|
return active() ? 'ok' : 'muted'
|
|
692
507
|
}
|
|
693
|
-
const windows = () => accountWindows(props.account, props.now())
|
|
694
|
-
const age = () =>
|
|
695
|
-
quotaReadingAge(
|
|
696
|
-
windows().map((window) => window.reading),
|
|
697
|
-
props.now(),
|
|
698
|
-
)
|
|
699
|
-
const ageInline = () =>
|
|
700
|
-
age() !== '' &&
|
|
701
|
-
props.account.label.length + 3 + age().length + 1 + statusWord().length <=
|
|
702
|
-
props.width()
|
|
703
|
-
const label = () =>
|
|
704
|
-
fitLabel(props.account.label, props.width() - 1 - statusWord().length)
|
|
705
|
-
// One reset column width per account, so bars line up across its rows.
|
|
706
|
-
const resetWidth = () =>
|
|
707
|
-
Math.max(
|
|
708
|
-
0,
|
|
709
|
-
...windows()
|
|
710
|
-
.filter(showsFigure)
|
|
711
|
-
.map((window) => window.text.reset.length),
|
|
712
|
-
)
|
|
713
|
-
const layoutFor = (window: AccountWindow) =>
|
|
714
|
-
windowRowLayout(
|
|
715
|
-
props.width(),
|
|
716
|
-
window.text.name !== '',
|
|
717
|
-
resetWidth(),
|
|
718
|
-
props.appearance.barWidth,
|
|
719
|
-
)
|
|
720
|
-
const groups = () =>
|
|
721
|
-
QUOTA_ORDER.map((key) => ({
|
|
722
|
-
key,
|
|
723
|
-
windows: windows().filter((window) => window.key === key),
|
|
724
|
-
})).filter((group) => group.windows.length > 0)
|
|
725
508
|
return (
|
|
726
|
-
<
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
<box flexGrow={1} />
|
|
737
|
-
<text
|
|
738
|
-
flexShrink={0}
|
|
739
|
-
wrapMode='none'
|
|
740
|
-
fg={toneColor(props.theme(), statusTone())}
|
|
741
|
-
>
|
|
742
|
-
<b>{statusWord()}</b>
|
|
743
|
-
</text>
|
|
744
|
-
</box>
|
|
745
|
-
<Show when={age() !== '' && !ageInline()}>
|
|
746
|
-
<text wrapMode='none' fg={props.theme().textMuted}>
|
|
747
|
-
{age()}
|
|
748
|
-
</text>
|
|
749
|
-
</Show>
|
|
750
|
-
<Show
|
|
751
|
-
when={groups().length > 0}
|
|
752
|
-
fallback={
|
|
753
|
-
<text wrapMode='none' fg={props.theme().textMuted}>
|
|
754
|
-
{NO_QUOTA_READING}
|
|
755
|
-
</text>
|
|
756
|
-
}
|
|
757
|
-
>
|
|
758
|
-
<For each={groups()}>
|
|
759
|
-
{(group) => (
|
|
760
|
-
<>
|
|
761
|
-
<text wrapMode='none' fg={props.theme().textMuted}>
|
|
762
|
-
{GROUP_NAMES[group.key]}
|
|
763
|
-
</text>
|
|
764
|
-
<For each={group.windows}>
|
|
765
|
-
{(window) => (
|
|
766
|
-
<WindowRow
|
|
767
|
-
theme={props.theme}
|
|
768
|
-
appearance={props.appearance}
|
|
769
|
-
window={window}
|
|
770
|
-
layout={layoutFor(window)}
|
|
771
|
-
/>
|
|
772
|
-
)}
|
|
773
|
-
</For>
|
|
774
|
-
</>
|
|
775
|
-
)}
|
|
776
|
-
</For>
|
|
777
|
-
</Show>
|
|
778
|
-
</box>
|
|
509
|
+
<QuotaAccountBlock
|
|
510
|
+
palette={themePalette(props.theme)}
|
|
511
|
+
appearance={props.appearance}
|
|
512
|
+
account={props.account}
|
|
513
|
+
status={statusWord()}
|
|
514
|
+
statusTone={statusTone()}
|
|
515
|
+
now={props.now}
|
|
516
|
+
width={props.width}
|
|
517
|
+
marginTop={props.marginTop}
|
|
518
|
+
/>
|
|
779
519
|
)
|
|
780
520
|
}
|
|
781
521
|
|
|
@@ -1105,10 +845,11 @@ export function SidebarPanel(props: SidebarPanelProps): JSX.Element {
|
|
|
1105
845
|
>
|
|
1106
846
|
{(route) => (
|
|
1107
847
|
<Show
|
|
1108
|
-
when={
|
|
1109
|
-
'Route'
|
|
1110
|
-
|
|
1111
|
-
|
|
848
|
+
when={routeLineFits(
|
|
849
|
+
'Route',
|
|
850
|
+
routeValue(route()),
|
|
851
|
+
contentWidth(),
|
|
852
|
+
)}
|
|
1112
853
|
fallback={
|
|
1113
854
|
<For each={routeLines(route())}>
|
|
1114
855
|
{(line) => (
|