@cortexkit/opencode-antigravity-auth 3.0.20 → 3.0.21

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 (55) hide show
  1. package/dist/cli.js +75 -32
  2. package/dist/cli.js.map +3 -3
  3. package/dist/cli.meta.json +31 -11
  4. package/dist/index.js +75 -32
  5. package/dist/index.js.map +3 -3
  6. package/dist/index.meta.json +31 -11
  7. package/dist/server.js +75 -32
  8. package/dist/server.js.map +3 -3
  9. package/dist/server.meta.json +1 -1
  10. package/dist/src/common-auth-embedded/claustrum/custody.js +25 -0
  11. package/dist/src/common-auth-embedded/claustrum/hub.js +20 -1
  12. package/dist/src/common-auth-embedded/claustrum/insula.js +6 -0
  13. package/dist/src/common-auth-embedded/quota-sidebar/index.d.ts +86 -0
  14. package/dist/src/common-auth-embedded/quota-sidebar/index.tsx +630 -0
  15. package/dist/src/common-auth-embedded/source-output.json +37 -17
  16. package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
  17. package/dist/src/ga/tui/host-ga.js +2 -2
  18. package/dist/src/ga/tui/host-ga.js.map +1 -1
  19. package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
  20. package/dist/src/tui/quota-layout.d.ts +4 -58
  21. package/dist/src/tui/quota-layout.d.ts.map +1 -1
  22. package/dist/src/tui/quota-layout.js +4 -90
  23. package/dist/src/tui/quota-layout.js.map +1 -1
  24. package/dist/src/tui/sidebar-frame.d.ts +4 -34
  25. package/dist/src/tui/sidebar-frame.d.ts.map +1 -1
  26. package/dist/src/tui/sidebar-frame.js +91 -167
  27. package/dist/src/tui/sidebar-frame.js.map +1 -1
  28. package/dist/src/tui.js +2 -2
  29. package/dist/src/tui.js.map +1 -1
  30. package/dist/tui-build-map.json +27 -13
  31. package/dist/tui-ga-build-map.json +28 -13
  32. package/package.json +2 -2
  33. package/src/common-auth-embedded/claustrum/custody.js +25 -0
  34. package/src/common-auth-embedded/claustrum/hub.js +20 -1
  35. package/src/common-auth-embedded/claustrum/insula.js +6 -0
  36. package/src/common-auth-embedded/quota-sidebar/index.d.ts +86 -0
  37. package/src/common-auth-embedded/quota-sidebar/index.tsx +630 -0
  38. package/src/common-auth-embedded/source-output.json +37 -17
  39. package/src/tui-compiled/common-auth-embedded/quota-sidebar/index.js +666 -0
  40. package/src/tui-compiled/tui/quota-layout.js +5 -330
  41. package/src/tui-compiled/tui/sidebar-frame.js +241 -466
  42. package/src/tui-compiled/tui.js +2 -2
  43. package/src/tui-ga-compiled/host-ga.js +2 -2
  44. package/src/tui-ga-compiled/shared/ced204104a639c9c-sidebar-frame.js +241 -466
  45. package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +5 -330
  46. package/src/tui-ga-compiled/shared/e4ec36f367492969-index.js +666 -0
  47. package/src/tui-ga-raw/host-ga.tsx +2 -2
  48. package/src/tui-ga-raw/shared/ced204104a639c9c-sidebar-frame.tsx +211 -399
  49. package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +10 -301
  50. package/src/tui-ga-raw/shared/e4ec36f367492969-index.tsx +630 -0
  51. package/src/tui-raw/common-auth-embedded/quota-sidebar/index.tsx +630 -0
  52. package/src/tui-raw/tui/quota-layout.tsx +10 -301
  53. package/src/tui-raw/tui/sidebar-frame.tsx +211 -399
  54. package/src/tui-raw/tui.tsx +2 -2
  55. package/src/tui.tsx +2 -2
@@ -0,0 +1,630 @@
1
+ import type { RGBA } from "@opentui/core"
2
+ import type { JSX } from "@opentui/solid"
3
+ import {
4
+ createContext,
5
+ createMemo,
6
+ createSignal,
7
+ For,
8
+ Index,
9
+ mergeProps,
10
+ Show,
11
+ useContext,
12
+ } from "solid-js"
13
+ import type { QuotaWindowPart } from "./aef2402f8fc342f0-format.js"
14
+ import { formatQuota, quotaWindowParts } from "./aef2402f8fc342f0-format.js"
15
+ import type { ProjectedQuota } from "./1ff34afa7c42d196-projection.js"
16
+
17
+ export type Tone =
18
+ | 'text'
19
+ | 'textMuted'
20
+ | 'accent'
21
+ | 'success'
22
+ | 'warning'
23
+ | 'error'
24
+
25
+ export type SidebarTheme = Readonly<
26
+ Partial<
27
+ Record<Tone | 'background' | 'borderActive', RGBA | string | undefined>
28
+ >
29
+ >
30
+
31
+ export interface SidebarAppearance {
32
+ barWidth: number
33
+ barFilledChar: string
34
+ barEmptyChar: string
35
+ warnThreshold: number
36
+ errorThreshold: number
37
+ }
38
+
39
+ export interface PaceView {
40
+ text: string
41
+ tone: Tone
42
+ /** The elapsed-window percentage, not the difference from usage. */
43
+ overlay?: { kind: 'reserve' | 'deficit'; percent: number }
44
+ }
45
+
46
+ export interface QuotaGroupView {
47
+ title?: string
48
+ rows: readonly { part: QuotaWindowPart; pace?: PaceView }[]
49
+ }
50
+
51
+ export interface AccountView {
52
+ id: string
53
+ label: string
54
+ titleSuffix?: string
55
+ status: { text: string; tone: Tone }
56
+ blocked: boolean
57
+ indicatorTone: Tone
58
+ quota: ProjectedQuota | undefined
59
+ groups: readonly QuotaGroupView[]
60
+ emptyQuotaText?: { expanded: string; collapsed: string }
61
+ /** Presentation decided by the plugin, never inferred from status or freshness. */
62
+ collapsed?: { quotaTone?: Tone; muted?: boolean }
63
+ }
64
+
65
+ export interface SidebarFrameProps {
66
+ header: { badge: string; version?: string }
67
+ accounts: readonly AccountView[]
68
+ theme?: SidebarTheme
69
+ appearance: SidebarAppearance
70
+ showQuota: boolean
71
+ now: number
72
+ collapsed: boolean
73
+ onToggle: () => void
74
+ beforeQuota?: (account: AccountView) => JSX.Element
75
+ afterQuota?: (account: AccountView) => JSX.Element
76
+ sections?: () => JSX.Element
77
+ collapsedSections?: () => JSX.Element
78
+ }
79
+
80
+ type FrameContextProps = Omit<SidebarFrameProps, 'theme'> & {
81
+ theme: SidebarTheme
82
+ }
83
+
84
+ const FrameContext = createContext<FrameContextProps>()
85
+
86
+ function frameContext(): FrameContextProps {
87
+ const context = useContext(FrameContext)
88
+ if (!context)
89
+ throw new Error('Sidebar primitives must be inside SidebarFrame')
90
+ return context
91
+ }
92
+
93
+ function displayWidth(text: string): number {
94
+ const bun = (
95
+ globalThis as { Bun?: { stringWidth?: (text: string) => number } }
96
+ ).Bun
97
+ return bun?.stringWidth ? bun.stringWidth(text) : Array.from(text).length
98
+ }
99
+
100
+ function fitText(text: string, columns: number): string {
101
+ if (displayWidth(text) <= columns) return text
102
+ if (columns < 1) return ''
103
+ let kept = ''
104
+ let used = 0
105
+ for (const char of text) {
106
+ const width = displayWidth(char)
107
+ if (used + width > columns - 1) break
108
+ kept += char
109
+ used += width
110
+ }
111
+ return `${kept}\u2026`
112
+ }
113
+
114
+ /** A heading and its plugin-owned rows, with the frame's section spacing. */
115
+ export function SidebarSection(props: {
116
+ title: string
117
+ children?: JSX.Element
118
+ }) {
119
+ const context = frameContext()
120
+ return (
121
+ <>
122
+ <box width='100%' marginTop={1}>
123
+ <text fg={context.theme.text}>
124
+ <b>{props.title}</b>
125
+ </text>
126
+ </box>
127
+ {props.children}
128
+ </>
129
+ )
130
+ }
131
+
132
+ /** Keep labels whole and reserve one blank cell before an ellipsized value. */
133
+ export function SidebarStatRow(props: {
134
+ label: string
135
+ value: string
136
+ tone?: Tone
137
+ }) {
138
+ const context = frameContext()
139
+ const [width, setWidth] = createSignal(0)
140
+ let row: { width: number } | undefined
141
+ const value = () =>
142
+ width() <= 0
143
+ ? props.value
144
+ : fitText(props.value, width() - displayWidth(props.label) - 1)
145
+ return (
146
+ <box
147
+ ref={(element: { width: number }) => {
148
+ row = element
149
+ }}
150
+ onSizeChange={() => setWidth(row?.width ?? 0)}
151
+ width='100%'
152
+ flexDirection='row'
153
+ justifyContent='space-between'
154
+ columnGap={1}
155
+ >
156
+ <text fg={context.theme.textMuted} wrapMode='none' flexShrink={0}>
157
+ {props.label}
158
+ </text>
159
+ <text
160
+ fg={context.theme[props.tone ?? 'text']}
161
+ wrapMode='none'
162
+ flexShrink={1}
163
+ >
164
+ <b>{value()}</b>
165
+ </text>
166
+ </box>
167
+ )
168
+ }
169
+
170
+ export function SidebarTextRow(props: {
171
+ text: string
172
+ tone?: Tone
173
+ wrapMode?: JSX.IntrinsicElements['text']['wrapMode']
174
+ }) {
175
+ const context = frameContext()
176
+ return (
177
+ <text
178
+ fg={context.theme[props.tone ?? 'textMuted']}
179
+ wrapMode={props.wrapMode}
180
+ >
181
+ {props.text}
182
+ </text>
183
+ )
184
+ }
185
+
186
+ function usageTone(used: number, appearance: SidebarAppearance): Tone {
187
+ if (used >= appearance.errorThreshold) return 'error'
188
+ if (used >= appearance.warnThreshold) return 'warning'
189
+ return 'success'
190
+ }
191
+
192
+ function barSegments(
193
+ used: number,
194
+ appearance: SidebarAppearance,
195
+ pace?: PaceView,
196
+ ) {
197
+ const width = appearance.barWidth
198
+ const cells = (pct: number) =>
199
+ Math.max(0, Math.min(Math.round((pct / 100) * width), width))
200
+ const usedCells = cells(used)
201
+ const tone = usageTone(used, appearance)
202
+ // Keep the overlay's slot even when empty so live pacing changes reuse nodes.
203
+ const plain = [
204
+ { text: appearance.barFilledChar.repeat(usedCells), tone },
205
+ { text: '', tone },
206
+ { text: appearance.barEmptyChar.repeat(width - usedCells), tone },
207
+ ]
208
+ const overlay = pace?.overlay
209
+ if (!overlay) return plain
210
+ const paceCells = cells(overlay.percent)
211
+ const lo = Math.min(usedCells, paceCells)
212
+ const hi = Math.max(usedCells, paceCells)
213
+ if (lo === hi) return plain
214
+ return [
215
+ { text: appearance.barFilledChar.repeat(lo), tone },
216
+ {
217
+ text: (overlay.kind === 'deficit' ? '\u2593' : '\u2592').repeat(hi - lo),
218
+ tone:
219
+ overlay.kind === 'deficit' ? ('error' as const) : ('success' as const),
220
+ },
221
+ { text: appearance.barEmptyChar.repeat(width - hi), tone },
222
+ ]
223
+ }
224
+
225
+ function QuotaRow(props: {
226
+ part: QuotaWindowPart
227
+ pace?: PaceView
228
+ labelWidth: number
229
+ barCells: number
230
+ resetWidth: number
231
+ showReset: boolean
232
+ }) {
233
+ const context = frameContext()
234
+ const [columns, setColumns] = createSignal(0)
235
+ let row: { width: number } | undefined
236
+ const label = () =>
237
+ props.part.name +
238
+ ' '.repeat(Math.max(0, props.labelWidth - displayWidth(props.part.name)))
239
+ const figure = () =>
240
+ ` ${props.part.kind === 'budget' && props.part.figure.startsWith(`${props.part.name} `) ? props.part.figure.slice(props.part.name.length + 1) : props.part.figure}`
241
+ const used = () => 100 - (props.part.remainingPercent ?? 100)
242
+ // Size notifications can recompute an unchanged fit after text has been flushed
243
+ // for the frame. Keep equal segments, and update fixed slots in place when the
244
+ // bar changes, rather than replacing text nodes during layout.
245
+ const segments = createMemo(
246
+ () =>
247
+ barSegments(
248
+ used(),
249
+ { ...context.appearance, barWidth: props.barCells },
250
+ props.pace,
251
+ ),
252
+ undefined,
253
+ {
254
+ equals: (previous, next) =>
255
+ previous.length === next.length &&
256
+ previous.every(
257
+ (segment, index) =>
258
+ segment.text === next[index]?.text &&
259
+ segment.tone === next[index]?.tone,
260
+ ),
261
+ },
262
+ )
263
+ const paceLine = () => {
264
+ const text = props.pace?.text
265
+ if (!text || columns() <= 0) return text
266
+ return fitText(text, columns() - props.labelWidth)
267
+ }
268
+ return (
269
+ <>
270
+ <box
271
+ ref={(element: { width: number }) => {
272
+ row = element
273
+ }}
274
+ onSizeChange={() => setColumns(row?.width ?? 0)}
275
+ width='100%'
276
+ flexDirection='row'
277
+ justifyContent='space-between'
278
+ >
279
+ <box
280
+ flexDirection='row'
281
+ flexShrink={props.part.resetSinceReading ? 1 : 0}
282
+ >
283
+ <Show when={props.labelWidth > 0}>
284
+ <text fg={context.theme.textMuted} wrapMode='none' flexShrink={0}>
285
+ {label()}
286
+ </text>
287
+ </Show>
288
+ <Show
289
+ when={!props.part.resetSinceReading}
290
+ fallback={
291
+ <text fg={context.theme.textMuted} wrapMode='none'>
292
+ reset since last check
293
+ </text>
294
+ }
295
+ >
296
+ <Show when={props.barCells > 0}>
297
+ {/* Text nodes clear omitted theme colours; empty slots must not reserve a cell. */}
298
+ <Index each={segments()}>
299
+ {(segment) => (
300
+ <text
301
+ fg={context.theme[segment().tone]}
302
+ wrapMode='none'
303
+ width={segment().text ? undefined : 0}
304
+ >
305
+ {segment().text}
306
+ </text>
307
+ )}
308
+ </Index>
309
+ </Show>
310
+ <text
311
+ fg={context.theme[usageTone(used(), context.appearance)]}
312
+ wrapMode='none'
313
+ >
314
+ {figure()}
315
+ </text>
316
+ </Show>
317
+ </box>
318
+ <Show when={props.showReset && !props.part.resetSinceReading}>
319
+ <box
320
+ width={props.resetWidth}
321
+ flexShrink={0}
322
+ flexDirection='row'
323
+ justifyContent='flex-end'
324
+ >
325
+ <Show when={props.part.resetIn}>
326
+ <text fg={context.theme.textMuted} wrapMode='none'>
327
+ {props.part.resetIn}
328
+ </text>
329
+ </Show>
330
+ </box>
331
+ </Show>
332
+ </box>
333
+ {/* A changed fitted line needs a fresh text node to draw at its new width. */}
334
+ <Show when={!props.part.resetSinceReading && paceLine()} keyed>
335
+ {(line: string) => (
336
+ <box width='100%' flexDirection='row'>
337
+ <Show when={props.labelWidth > 0}>
338
+ <text fg={context.theme.textMuted}>
339
+ {''.padEnd(props.labelWidth)}
340
+ </text>
341
+ </Show>
342
+ <text
343
+ fg={context.theme[props.pace?.tone ?? 'textMuted']}
344
+ wrapMode='none'
345
+ >
346
+ {line}
347
+ </text>
348
+ </box>
349
+ )}
350
+ </Show>
351
+ </>
352
+ )
353
+ }
354
+
355
+ function CollapsedAccountRow(props: { account: AccountView }) {
356
+ const context = frameContext()
357
+ const [width, setWidth] = createSignal(0)
358
+ let row: { width: number } | undefined
359
+ const hasQuota = () =>
360
+ quotaWindowParts(props.account.quota, { now: context.now }).windows.length >
361
+ 0
362
+ const text = () =>
363
+ hasQuota()
364
+ ? formatQuota(props.account.quota, { now: context.now, form: 'narrow' })
365
+ : (props.account.emptyQuotaText?.collapsed ?? '\u2014')
366
+ // Reserve an ellipsis, a separator and the trailing indicator before keeping quota.
367
+ const showQuota = () => width() <= 0 || displayWidth(text()) + 4 <= width()
368
+ const label = () => {
369
+ if (width() <= 0) return props.account.label
370
+ return fitText(
371
+ props.account.label,
372
+ width() - (showQuota() ? displayWidth(text()) + 3 : 2),
373
+ )
374
+ }
375
+ const muted = () => props.account.collapsed?.muted ?? false
376
+ const quotaTone = () =>
377
+ muted() ? 'textMuted' : (props.account.collapsed?.quotaTone ?? 'success')
378
+ return (
379
+ <box
380
+ ref={(element: { width: number }) => {
381
+ row = element
382
+ }}
383
+ onSizeChange={() => setWidth(row?.width ?? 0)}
384
+ width='100%'
385
+ flexDirection='row'
386
+ justifyContent='space-between'
387
+ columnGap={label() ? 1 : 0}
388
+ >
389
+ <Show when={label()}>
390
+ <text
391
+ fg={context.theme[muted() ? 'textMuted' : 'text']}
392
+ wrapMode='none'
393
+ flexShrink={1}
394
+ >
395
+ {label()}
396
+ </text>
397
+ </Show>
398
+ <box flexDirection='row' flexShrink={0}>
399
+ <Show when={showQuota()}>
400
+ <Show
401
+ when={hasQuota() && !muted()}
402
+ fallback={<text fg={context.theme.textMuted}>{text()}</text>}
403
+ >
404
+ <text fg={context.theme[quotaTone()]}>
405
+ <b>{text()}</b>
406
+ </text>
407
+ </Show>
408
+ </Show>
409
+ <text fg={context.theme[props.account.indicatorTone]}>
410
+ {showQuota() ? ' ' : ''}
411
+ {props.account.blocked ? '\u2298' : '\u25cf'}
412
+ </text>
413
+ </box>
414
+ </box>
415
+ )
416
+ }
417
+
418
+ function AccountBlock(props: { account: AccountView; marginTop: number }) {
419
+ const context = frameContext()
420
+ const [columns, setColumns] = createSignal(0)
421
+ let block: { width: number } | undefined
422
+ const rows = () => props.account.groups.flatMap((group) => group.rows)
423
+ const labelWidth = () =>
424
+ Math.max(
425
+ 0,
426
+ ...rows().map(({ part }) =>
427
+ part.name ? Math.max(3, displayWidth(part.name) + 1) : 0,
428
+ ),
429
+ )
430
+ const resetWidth = () =>
431
+ Math.max(
432
+ 0,
433
+ ...rows().map(({ part }) =>
434
+ part.resetSinceReading ? 0 : displayWidth(part.resetIn ?? ''),
435
+ ),
436
+ )
437
+ const figureWidth = createMemo(() =>
438
+ Math.max(
439
+ 10,
440
+ ...rows()
441
+ .filter(({ part }) => !part.resetSinceReading)
442
+ .map(({ part }) =>
443
+ displayWidth(
444
+ ` ${part.kind === 'budget' && part.figure.startsWith(`${part.name} `) ? part.figure.slice(part.name.length + 1) : part.figure}`,
445
+ ),
446
+ ),
447
+ ),
448
+ )
449
+ const fit = (rowLabelWidth: number) => {
450
+ const desired = context.appearance.barWidth
451
+ // Four cells still distinguish quarters of a window without sacrificing its reset.
452
+ const minimum = Math.min(4, desired)
453
+ if (columns() <= 0)
454
+ return { barCells: desired, showReset: resetWidth() > 0 }
455
+ const room = columns() - rowLabelWidth - figureWidth()
456
+ const withReset = room - resetWidth() - 1
457
+ const showReset = resetWidth() > 0 && withReset >= minimum
458
+ const available = showReset ? withReset : room
459
+ return {
460
+ barCells: available >= minimum ? Math.min(desired, available) : 0,
461
+ showReset,
462
+ }
463
+ }
464
+ const label = () => {
465
+ const full = `${props.account.label}${props.account.titleSuffix ? ` · ${props.account.titleSuffix}` : ''}`
466
+ return columns() <= 0
467
+ ? full
468
+ : fitText(full, columns() - displayWidth(props.account.status.text) - 1)
469
+ }
470
+ const age = () =>
471
+ quotaWindowParts(props.account.quota, { now: context.now }).age
472
+ const hasRows = () =>
473
+ props.account.groups.some((group) => group.rows.length > 0)
474
+ return (
475
+ <box
476
+ ref={(element: { width: number }) => {
477
+ block = element
478
+ }}
479
+ onSizeChange={() => setColumns(block?.width ?? 0)}
480
+ width='100%'
481
+ flexDirection='column'
482
+ marginTop={props.marginTop}
483
+ >
484
+ <box
485
+ width='100%'
486
+ flexDirection='row'
487
+ justifyContent='space-between'
488
+ columnGap={1}
489
+ >
490
+ <text fg={context.theme.text} wrapMode='none' flexShrink={1}>
491
+ <b>{label()}</b>
492
+ </text>
493
+ <text
494
+ fg={context.theme[props.account.status.tone]}
495
+ wrapMode='none'
496
+ flexShrink={0}
497
+ >
498
+ <b>{props.account.status.text}</b>
499
+ </text>
500
+ </box>
501
+ {context.beforeQuota?.(props.account)}
502
+ <Show
503
+ when={hasRows()}
504
+ fallback={
505
+ <SidebarTextRow
506
+ text={props.account.emptyQuotaText?.expanded ?? '\u2014'}
507
+ wrapMode='none'
508
+ />
509
+ }
510
+ >
511
+ <For each={props.account.groups}>
512
+ {(group) => (
513
+ <>
514
+ <Show when={group.title}>
515
+ <SidebarTextRow
516
+ text={group.title ?? ''}
517
+ tone='text'
518
+ wrapMode='none'
519
+ />
520
+ </Show>
521
+ <For each={group.rows}>
522
+ {(row) => {
523
+ const rowLabelWidth = () => (row.part.name ? labelWidth() : 0)
524
+ const rowFit = createMemo(() => fit(rowLabelWidth()))
525
+ return (
526
+ <QuotaRow
527
+ part={row.part}
528
+ pace={row.pace}
529
+ labelWidth={rowLabelWidth()}
530
+ barCells={rowFit().barCells}
531
+ resetWidth={resetWidth()}
532
+ showReset={rowFit().showReset}
533
+ />
534
+ )
535
+ }}
536
+ </For>
537
+ </>
538
+ )}
539
+ </For>
540
+ </Show>
541
+ <Show when={age()}>
542
+ {(text: () => string) => (
543
+ <SidebarTextRow text={text()} wrapMode='none' />
544
+ )}
545
+ </Show>
546
+ {context.afterQuota?.(props.account)}
547
+ </box>
548
+ )
549
+ }
550
+
551
+ /** Borderless, controlled presentation; host registration and provider policy stay in the plugin. */
552
+ export function SidebarFrame(props: SidebarFrameProps) {
553
+ const hasData = () => props.accounts.length > 0
554
+ const headerLabel = () =>
555
+ !hasData()
556
+ ? props.header.badge
557
+ : `${props.collapsed ? '\u25b6' : '\u25bc'} ${props.header.badge}`
558
+ // Missing semantic colors inherit normal text; an unset palette uses terminal defaults.
559
+ const context = mergeProps(props, {
560
+ get theme(): SidebarTheme {
561
+ const theme = props.theme
562
+ return {
563
+ ...theme,
564
+ textMuted: theme?.textMuted ?? theme?.text,
565
+ accent: theme?.accent ?? theme?.text,
566
+ success: theme?.success ?? theme?.text,
567
+ warning: theme?.warning ?? theme?.text,
568
+ error: theme?.error ?? theme?.text,
569
+ }
570
+ },
571
+ })
572
+ // Inverting an incomplete badge palette can put light text on a light background.
573
+ const invertBadge = () =>
574
+ props.theme?.accent !== undefined && props.theme?.background !== undefined
575
+ return (
576
+ <FrameContext.Provider value={context}>
577
+ <box width='100%' flexDirection='column'>
578
+ {/* Blocked accounts retain their own indicators; the header always keeps its version. */}
579
+ {/* biome-ignore lint/a11y/noStaticElementInteractions: OpenTUI terminal widgets do not have DOM roles */}
580
+ <box
581
+ width='100%'
582
+ flexDirection='row'
583
+ justifyContent='space-between'
584
+ alignItems='center'
585
+ onMouseDown={() => {
586
+ if (hasData()) props.onToggle()
587
+ }}
588
+ >
589
+ <box
590
+ paddingLeft={1}
591
+ paddingRight={1}
592
+ backgroundColor={invertBadge() ? props.theme?.accent : undefined}
593
+ >
594
+ <text
595
+ fg={
596
+ invertBadge() ? props.theme?.background : context.theme.accent
597
+ }
598
+ >
599
+ <b>{headerLabel()}</b>
600
+ </text>
601
+ </box>
602
+ <Show when={props.header.version}>
603
+ <text fg={context.theme.textMuted}>{props.header.version}</text>
604
+ </Show>
605
+ </box>
606
+ <Show when={props.collapsed && hasData()}>
607
+ <For each={props.accounts}>
608
+ {(account) => <CollapsedAccountRow account={account} />}
609
+ </For>
610
+ {props.collapsedSections?.()}
611
+ </Show>
612
+ <Show when={!props.collapsed || !hasData()}>
613
+ <Show when={props.showQuota && hasData()}>
614
+ <SidebarSection title='Quota'>
615
+ <For each={props.accounts}>
616
+ {(account, index) => (
617
+ <AccountBlock
618
+ account={account}
619
+ marginTop={index() === 0 ? 0 : 1}
620
+ />
621
+ )}
622
+ </For>
623
+ </SidebarSection>
624
+ </Show>
625
+ {props.sections?.()}
626
+ </Show>
627
+ </box>
628
+ </FrameContext.Provider>
629
+ )
630
+ }