@cortexkit/opencode-openai-auth 1.8.3 → 1.8.5
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/bin.js +8 -8
- package/dist/{codex-request-GJkvxv4S.d.ts → codex-request-By530v1D.d.ts} +3 -2
- package/dist/{index-c50p5mem.js → index-5wgxt362.js} +1 -1
- package/dist/{index-rw932qm9.js → index-8x42xzxb.js} +20 -20
- package/dist/{index-g556s1mz.js → index-95s2mw9w.js} +2 -2
- package/dist/{index-bej7x30p.js → index-a7xv52hy.js} +7 -7
- package/dist/{index-hpnj460b.js → index-byz2j6hz.js} +1 -1
- package/dist/{index-z81cged1.js → index-g5hv0tda.js} +2 -2
- package/dist/{index-yt52fztj.js → index-jh90fx7y.js} +2 -2
- package/dist/{index-p8m4yh73.js → index-kphzmgq6.js} +1 -1
- package/dist/index-n12zjwh9.js +8 -0
- package/dist/{index-0v7ar02e.js → index-rmc6hwg6.js} +1 -1
- package/dist/index-zah8t2d2.js +2 -0
- package/dist/{index-dw6yd976.js → index-zf649dj2.js} +2 -2
- package/dist/index-zne9tzy9.js +91 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/rpc/port-file.js +1 -1
- package/dist/rpc/protocol.js +1 -1
- package/dist/rpc/rpc-client.js +1 -1
- package/dist/rpc/rpc-dir.js +1 -1
- package/dist/{sidebar-state-DkNebAiC.d.ts → sidebar-state-CrRiE9hw.d.ts} +3 -1
- package/dist/sidebar-state.d.ts +1 -1
- package/dist/sidebar-state.js +1 -1
- package/dist/{token-3vtr29vt.js → token-j2jmx8k7.js} +1 -1
- package/dist/token-util-7n2nfbyc.js +1 -0
- package/dist/tui-preferences.js +1 -1
- package/dist/tui.d.ts +2 -21
- package/dist/v2/server.d.ts +1 -1
- package/dist/v2/server.js +2 -2
- package/package.json +2 -2
- package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +20 -6
- package/src/tui-compiled/raw/shared/169b2b4bf30909bc-consumer.js +25 -0
- package/src/tui-compiled/raw/shared/30f5bc480f31f51c-roster.js +1 -1
- package/src/tui-compiled/raw/shared/352d228be2832bd4-hub.js +55 -5
- package/src/tui-compiled/raw/shared/4825e03209d6ae3e-with-lock.js +1 -1
- package/src/tui-compiled/raw/shared/549daf371622c304-index.tsx +497 -0
- package/src/tui-compiled/raw/shared/7c97ac0cec074ae7-format.js +208 -0
- package/src/tui-compiled/raw/shared/b4ad0d49429f0096-map.js +98 -0
- package/src/tui-compiled/raw/shared/b717cdcce3966455-projection.js +90 -0
- package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +3 -1
- package/src/tui-compiled/raw/sidebar-state.js +10 -6
- package/src/tui-compiled/raw/tui.tsx +232 -623
- package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +20 -6
- package/src/tui-compiled/runtime/shared/169b2b4bf30909bc-consumer.js +25 -0
- package/src/tui-compiled/runtime/shared/30f5bc480f31f51c-roster.js +1 -1
- package/src/tui-compiled/runtime/shared/352d228be2832bd4-hub.js +55 -5
- package/src/tui-compiled/runtime/shared/4825e03209d6ae3e-with-lock.js +1 -1
- package/src/tui-compiled/runtime/shared/549daf371622c304-index.js +550 -0
- package/src/tui-compiled/runtime/shared/7c97ac0cec074ae7-format.js +208 -0
- package/src/tui-compiled/runtime/shared/b4ad0d49429f0096-map.js +98 -0
- package/src/tui-compiled/runtime/shared/b717cdcce3966455-projection.js +90 -0
- package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +3 -1
- package/src/tui-compiled/runtime/sidebar-state.js +10 -6
- package/src/tui-compiled/runtime/tui.js +256 -893
- package/dist/index-03hs0rq7.js +0 -2
- package/dist/index-b0s5cty6.js +0 -91
- package/dist/index-fyrgwfx3.js +0 -8
- package/dist/token-util-erhrf24m.js +0 -1
|
@@ -8,6 +8,15 @@ import {
|
|
|
8
8
|
quotaTextParts,
|
|
9
9
|
quotaWindowParts,
|
|
10
10
|
} from "./shared/d5a8f1061ee2f114-index.js"
|
|
11
|
+
import {
|
|
12
|
+
type AccountView,
|
|
13
|
+
type Tone as FrameTone,
|
|
14
|
+
type PaceView,
|
|
15
|
+
SidebarFrame,
|
|
16
|
+
SidebarSection,
|
|
17
|
+
SidebarStatRow,
|
|
18
|
+
SidebarTextRow,
|
|
19
|
+
} from "./shared/549daf371622c304-index.tsx"
|
|
11
20
|
import type { Plugin } from "@opencode/plugin/tui"
|
|
12
21
|
import type {
|
|
13
22
|
TuiPlugin,
|
|
@@ -15,15 +24,7 @@ import type {
|
|
|
15
24
|
TuiPluginModule,
|
|
16
25
|
} from "@opencode-ai/plugin/tui"
|
|
17
26
|
import { RGBA } from "@opentui/core"
|
|
18
|
-
import {
|
|
19
|
-
createEffect,
|
|
20
|
-
createMemo,
|
|
21
|
-
createSignal,
|
|
22
|
-
For,
|
|
23
|
-
Index,
|
|
24
|
-
onCleanup,
|
|
25
|
-
Show,
|
|
26
|
-
} from "solid-js"
|
|
27
|
+
import { createEffect, createSignal, For, onCleanup, Show } from "solid-js"
|
|
27
28
|
import { createLogger } from "./logger.js"
|
|
28
29
|
import { type ApplyRequest, isNotifyPayload } from "./rpc/protocol.js"
|
|
29
30
|
import { createRpcClient, DEFAULT_RPC_TIMEOUT_MS } from "./rpc/rpc-client.js"
|
|
@@ -32,7 +33,6 @@ import {
|
|
|
32
33
|
type AccountQuota,
|
|
33
34
|
accountCreditsText,
|
|
34
35
|
accountServesOnCredits,
|
|
35
|
-
type CollapsedAccountLine,
|
|
36
36
|
computeQuotaPacing,
|
|
37
37
|
DEFAULT_SIDEBAR_STATE,
|
|
38
38
|
displayWidth,
|
|
@@ -112,9 +112,6 @@ const PLUGIN_VERSION: string = (() => {
|
|
|
112
112
|
return ''
|
|
113
113
|
})()
|
|
114
114
|
|
|
115
|
-
// biome-ignore lint/suspicious/noExplicitAny: opentui border prop not typed in plugin tui surface
|
|
116
|
-
const SINGLE_BORDER = { type: 'single' } as any
|
|
117
|
-
|
|
118
115
|
type Tone = 'ok' | 'warn' | 'err' | 'muted' | 'accent' | 'text'
|
|
119
116
|
type ThemeCurrent = Pick<
|
|
120
117
|
TuiPluginApi['theme']['current'],
|
|
@@ -174,80 +171,46 @@ export function sidebarThemeFromHost(theme: SidebarHostTheme): ThemeCurrent {
|
|
|
174
171
|
}
|
|
175
172
|
}
|
|
176
173
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
function usageTone(usedPct: number, appearance: AppearancePrefs): Tone {
|
|
175
|
+
if (usedPct < appearance.warnThreshold) return 'ok'
|
|
176
|
+
if (usedPct < appearance.errorThreshold) return 'warn'
|
|
177
|
+
return 'err'
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function frameTone(tone: Tone): FrameTone {
|
|
180
181
|
switch (tone) {
|
|
181
182
|
case 'ok':
|
|
182
|
-
return
|
|
183
|
+
return 'success'
|
|
183
184
|
case 'warn':
|
|
184
|
-
return
|
|
185
|
+
return 'warning'
|
|
185
186
|
case 'err':
|
|
186
|
-
return
|
|
187
|
+
return 'error'
|
|
187
188
|
case 'muted':
|
|
188
|
-
return
|
|
189
|
-
case 'accent':
|
|
190
|
-
return theme.accent ?? theme.text
|
|
189
|
+
return 'textMuted'
|
|
191
190
|
default:
|
|
192
|
-
return
|
|
191
|
+
return tone
|
|
193
192
|
}
|
|
194
193
|
}
|
|
195
194
|
|
|
196
|
-
function
|
|
197
|
-
if (
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
// bar renders as a single fill+empty pair, identical to the pre-pacing look.
|
|
214
|
-
// Empty text nodes still occupy a phantom cell in the opentui flex row, so
|
|
215
|
-
// zero-length segments are dropped from every return path (plain and pacing).
|
|
216
|
-
function quotaBarSegments(
|
|
217
|
-
usedPct: number,
|
|
218
|
-
appearance: AppearancePrefs,
|
|
219
|
-
pacing: QuotaPacing | null,
|
|
220
|
-
): BarSegment[] {
|
|
221
|
-
const width = appearance.barWidth
|
|
222
|
-
const cells = (pct: number) =>
|
|
223
|
-
Math.max(0, Math.min(Math.round((pct / 100) * width), width))
|
|
224
|
-
const usedCells = cells(usedPct)
|
|
225
|
-
const fillTone = usageTone(usedPct, appearance)
|
|
226
|
-
const plain: BarSegment[] = [
|
|
227
|
-
{ text: appearance.barFilledChar.repeat(usedCells), tone: fillTone },
|
|
228
|
-
{
|
|
229
|
-
text: appearance.barEmptyChar.repeat(width - usedCells),
|
|
230
|
-
tone: fillTone,
|
|
195
|
+
function paceView(pacing: QuotaPacing | null): PaceView | undefined {
|
|
196
|
+
if (!pacing) return undefined
|
|
197
|
+
const pct = Math.round(Math.abs(pacing.deltaPercent))
|
|
198
|
+
const text =
|
|
199
|
+
pacing.state === 'on-pace'
|
|
200
|
+
? ''
|
|
201
|
+
: pacing.state === 'reserve'
|
|
202
|
+
? `reserve ${pct}% \u00b7 lasts`
|
|
203
|
+
: pacing.runsOutAt
|
|
204
|
+
? `deficit ${pct}% \u00b7 out in ${formatResetIn(pacing.runsOutAt)}`
|
|
205
|
+
: `deficit ${pct}% \u00b7 lasts`
|
|
206
|
+
return {
|
|
207
|
+
text,
|
|
208
|
+
tone: pacing.state === 'deficit' ? 'warning' : 'textMuted',
|
|
209
|
+
overlay: {
|
|
210
|
+
kind: pacing.deltaPercent > 0 ? 'deficit' : 'reserve',
|
|
211
|
+
percent: pacing.pacePercent,
|
|
231
212
|
},
|
|
232
|
-
|
|
233
|
-
if (!pacing) return plain.filter((segment) => segment.text.length > 0)
|
|
234
|
-
const paceCells = cells(pacing.pacePercent)
|
|
235
|
-
const lo = Math.min(usedCells, paceCells)
|
|
236
|
-
const hi = Math.max(usedCells, paceCells)
|
|
237
|
-
if (hi === lo) return plain.filter((segment) => segment.text.length > 0)
|
|
238
|
-
const overspent = usedCells > paceCells
|
|
239
|
-
return (
|
|
240
|
-
[
|
|
241
|
-
{ text: appearance.barFilledChar.repeat(lo), tone: fillTone },
|
|
242
|
-
{
|
|
243
|
-
text: (overspent ? PACE_DEFICIT_CHAR : PACE_RESERVE_CHAR).repeat(
|
|
244
|
-
hi - lo,
|
|
245
|
-
),
|
|
246
|
-
tone: overspent ? 'err' : 'ok',
|
|
247
|
-
},
|
|
248
|
-
{ text: appearance.barEmptyChar.repeat(width - hi), tone: fillTone },
|
|
249
|
-
] as BarSegment[]
|
|
250
|
-
).filter((segment) => segment.text.length > 0)
|
|
213
|
+
}
|
|
251
214
|
}
|
|
252
215
|
|
|
253
216
|
export function formatResetIn(resetsAt: string | undefined): string {
|
|
@@ -278,38 +241,6 @@ function formatUntil(until: number | undefined): string {
|
|
|
278
241
|
return rm > 0 ? `${hrs}h${rm}m` : `${hrs}h`
|
|
279
242
|
}
|
|
280
243
|
|
|
281
|
-
// --- Reusable components (aft-style) ---------------------------------------
|
|
282
|
-
|
|
283
|
-
function SectionHeader(props: {
|
|
284
|
-
theme: ThemeCurrent
|
|
285
|
-
title: string
|
|
286
|
-
marginTop?: number
|
|
287
|
-
}) {
|
|
288
|
-
return (
|
|
289
|
-
<box width='100%' marginTop={props.marginTop ?? 1}>
|
|
290
|
-
<text fg={props.theme.text}>
|
|
291
|
-
<b>{props.title}</b>
|
|
292
|
-
</text>
|
|
293
|
-
</box>
|
|
294
|
-
)
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
function StatRow(props: {
|
|
298
|
-
theme: ThemeCurrent
|
|
299
|
-
label: string
|
|
300
|
-
value: string
|
|
301
|
-
tone?: Tone
|
|
302
|
-
}) {
|
|
303
|
-
return (
|
|
304
|
-
<box width='100%' flexDirection='row' justifyContent='space-between'>
|
|
305
|
-
<text fg={props.theme.textMuted}>{props.label}</text>
|
|
306
|
-
<text fg={toneColor(props.theme, props.tone ?? 'text')}>
|
|
307
|
-
<b>{props.value}</b>
|
|
308
|
-
</text>
|
|
309
|
-
</box>
|
|
310
|
-
)
|
|
311
|
-
}
|
|
312
|
-
|
|
313
244
|
// One of an account's own rows under its quota bars (budget amounts, prepaid
|
|
314
245
|
// credits, reset credits): muted label left, value right. Like the quota rows
|
|
315
246
|
// it stays on one line: it measures its own width and, when both do not fit,
|
|
@@ -349,76 +280,6 @@ function AccountMetaRow(props: {
|
|
|
349
280
|
)
|
|
350
281
|
}
|
|
351
282
|
|
|
352
|
-
// One account in the collapsed view: label left; narrow quota text and the
|
|
353
|
-
// status dot right (red ⊘ when killed). The session's account keeps the
|
|
354
|
-
// usage tone; other accounts, and any account whose reading is stale, are
|
|
355
|
-
// drawn muted. The row measures its own width so only the label is cut (with
|
|
356
|
-
// …) when the line does not fit; the quota text is never cut.
|
|
357
|
-
function CollapsedAccountRow(props: {
|
|
358
|
-
theme: ThemeCurrent
|
|
359
|
-
line: CollapsedAccountLine
|
|
360
|
-
tone: Tone
|
|
361
|
-
}) {
|
|
362
|
-
const [width, setWidth] = createSignal(0)
|
|
363
|
-
let row: { width: number } | undefined
|
|
364
|
-
const dim = () => props.line.stale || !props.line.active
|
|
365
|
-
const label = () => {
|
|
366
|
-
const columns = width()
|
|
367
|
-
if (columns <= 0) return props.line.name
|
|
368
|
-
// The value side is the text plus ` ●`, or a lone `—`; one column
|
|
369
|
-
// separates it from the label.
|
|
370
|
-
const value =
|
|
371
|
-
props.line.text === null ? 1 : displayWidth(props.line.text) + 2
|
|
372
|
-
return fitCollapsedLabel(props.line.name, columns - value - 1)
|
|
373
|
-
}
|
|
374
|
-
return (
|
|
375
|
-
<box
|
|
376
|
-
ref={(element: { width: number }) => {
|
|
377
|
-
row = element
|
|
378
|
-
}}
|
|
379
|
-
onSizeChange={() => setWidth(row?.width ?? 0)}
|
|
380
|
-
width='100%'
|
|
381
|
-
flexDirection='row'
|
|
382
|
-
justifyContent='space-between'
|
|
383
|
-
>
|
|
384
|
-
<text
|
|
385
|
-
fg={toneColor(props.theme, dim() ? 'muted' : 'text')}
|
|
386
|
-
wrapMode='none'
|
|
387
|
-
flexShrink={1}
|
|
388
|
-
>
|
|
389
|
-
{label()}
|
|
390
|
-
</text>
|
|
391
|
-
<Show
|
|
392
|
-
when={props.line.text !== null}
|
|
393
|
-
fallback={<text fg={props.theme.textMuted}>{'\u2014'}</text>}
|
|
394
|
-
>
|
|
395
|
-
<box flexDirection='row' flexShrink={0}>
|
|
396
|
-
<Show
|
|
397
|
-
when={!dim()}
|
|
398
|
-
fallback={
|
|
399
|
-
<text fg={toneColor(props.theme, 'muted')}>
|
|
400
|
-
{props.line.text}
|
|
401
|
-
</text>
|
|
402
|
-
}
|
|
403
|
-
>
|
|
404
|
-
<text fg={toneColor(props.theme, props.tone)}>
|
|
405
|
-
<b>{props.line.text}</b>
|
|
406
|
-
</text>
|
|
407
|
-
</Show>
|
|
408
|
-
<text
|
|
409
|
-
fg={toneColor(
|
|
410
|
-
props.theme,
|
|
411
|
-
props.line.killed ? 'err' : dim() ? 'muted' : props.tone,
|
|
412
|
-
)}
|
|
413
|
-
>
|
|
414
|
-
{props.line.killed ? ' \u2298' : ' \u25cf'}
|
|
415
|
-
</text>
|
|
416
|
-
</box>
|
|
417
|
-
</Show>
|
|
418
|
-
</box>
|
|
419
|
-
)
|
|
420
|
-
}
|
|
421
|
-
|
|
422
283
|
export interface QuotaDisplayRow {
|
|
423
284
|
key: 'primary' | 'secondary' | 'spendControl'
|
|
424
285
|
label: string
|
|
@@ -624,266 +485,6 @@ export function getAccountMetadataRows(
|
|
|
624
485
|
}
|
|
625
486
|
|
|
626
487
|
/** The fewest cells a shortened quota bar keeps; below this it is dropped. */
|
|
627
|
-
const MIN_QUOTA_BAR_CELLS = 3
|
|
628
|
-
|
|
629
|
-
export interface QuotaRowFit {
|
|
630
|
-
/** Cells of usage bar to draw; 0 draws no bar. */
|
|
631
|
-
barCells: number
|
|
632
|
-
showReset: boolean
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* How an expanded quota row fits on one line `columns` cells wide. The row is
|
|
637
|
-
* the padded label, the bar, the " N% left" figure and, at the right edge, the
|
|
638
|
-
* reset time. When it does not fit, the reset time goes first, then the bar
|
|
639
|
-
* shrinks (to no fewer than MIN_QUOTA_BAR_CELLS cells, else it is dropped).
|
|
640
|
-
* The label and the figure are never cut. `columns` of 0 means the row has not
|
|
641
|
-
* been measured yet, and everything is drawn.
|
|
642
|
-
*/
|
|
643
|
-
export function fitQuotaRow(input: {
|
|
644
|
-
columns: number
|
|
645
|
-
label: string
|
|
646
|
-
barWidth: number
|
|
647
|
-
figure: string
|
|
648
|
-
resetText?: string
|
|
649
|
-
}): QuotaRowFit {
|
|
650
|
-
const { columns, barWidth } = input
|
|
651
|
-
const reset = input.resetText ? displayWidth(input.resetText) : 0
|
|
652
|
-
if (columns <= 0) return { barCells: barWidth, showReset: reset > 0 }
|
|
653
|
-
const fixed = displayWidth(input.label) + displayWidth(input.figure)
|
|
654
|
-
// The reset sits at the right edge with at least one blank cell before it,
|
|
655
|
-
// so it never runs into the figure.
|
|
656
|
-
if (reset > 0 && fixed + barWidth + 1 + reset <= columns)
|
|
657
|
-
return { barCells: barWidth, showReset: true }
|
|
658
|
-
const room = columns - fixed
|
|
659
|
-
if (room >= barWidth) return { barCells: barWidth, showReset: false }
|
|
660
|
-
return {
|
|
661
|
-
barCells: room >= MIN_QUOTA_BAR_CELLS ? room : 0,
|
|
662
|
-
showReset: false,
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
// Quota window row: muted label left, tone-colored usage bar and shared quota text.
|
|
667
|
-
// When pacing data is present, the bar
|
|
668
|
-
// gains a pace segment and an off-pace window adds a muted subline with the
|
|
669
|
-
// reserve/deficit delta and the projected runout.
|
|
670
|
-
// The row measures its own width and never wraps: fitQuotaRow decides what is
|
|
671
|
-
// left out when it is too narrow, and the pacing subline is cut with ….
|
|
672
|
-
function QuotaRow(props: {
|
|
673
|
-
theme: ThemeCurrent
|
|
674
|
-
appearance: AppearancePrefs
|
|
675
|
-
label: string
|
|
676
|
-
labelWidth: number
|
|
677
|
-
text: string
|
|
678
|
-
resetText?: string
|
|
679
|
-
window: { usedPercent: number; resetsAt?: string } | undefined
|
|
680
|
-
pacing: QuotaPacing | null
|
|
681
|
-
}) {
|
|
682
|
-
const used = () => props.window?.usedPercent ?? 0
|
|
683
|
-
const [columns, setColumns] = createSignal(0)
|
|
684
|
-
let row: { width: number } | undefined
|
|
685
|
-
const label = () => props.label.padEnd(props.labelWidth)
|
|
686
|
-
const figure = () => ` ${props.text.slice(props.label.length + 1)}`
|
|
687
|
-
const fit = () =>
|
|
688
|
-
fitQuotaRow({
|
|
689
|
-
columns: columns(),
|
|
690
|
-
label: label(),
|
|
691
|
-
barWidth: props.appearance.barWidth,
|
|
692
|
-
figure: figure(),
|
|
693
|
-
resetText: props.resetText,
|
|
694
|
-
})
|
|
695
|
-
// Memos, so a new measured width that leaves the fit unchanged (as the
|
|
696
|
-
// first measurement usually does) does not rebuild the bar's text nodes:
|
|
697
|
-
// rebuilt nodes are blank until the next frame is drawn.
|
|
698
|
-
const barCells = createMemo(() => fit().barCells)
|
|
699
|
-
const showReset = createMemo(() => fit().showReset)
|
|
700
|
-
const fittedPaceLine = () => {
|
|
701
|
-
const line = paceLine()
|
|
702
|
-
if (line === null || columns() <= 0) return line
|
|
703
|
-
// The subline is indented by the label column; cut it to the rest.
|
|
704
|
-
return fitCollapsedLabel(line, columns() - props.labelWidth)
|
|
705
|
-
}
|
|
706
|
-
const paceLine = () => {
|
|
707
|
-
const pacing = props.pacing
|
|
708
|
-
if (!pacing || pacing.state === 'on-pace') return null
|
|
709
|
-
const pct = Math.round(Math.abs(pacing.deltaPercent))
|
|
710
|
-
if (pacing.state === 'reserve') return `reserve ${pct}% \u00b7 lasts`
|
|
711
|
-
return pacing.runsOutAt
|
|
712
|
-
? `deficit ${pct}% \u00b7 out in ${formatResetIn(pacing.runsOutAt)}`
|
|
713
|
-
: `deficit ${pct}% \u00b7 lasts`
|
|
714
|
-
}
|
|
715
|
-
return (
|
|
716
|
-
<Show
|
|
717
|
-
when={props.window}
|
|
718
|
-
fallback={
|
|
719
|
-
<box width='100%' flexDirection='row'>
|
|
720
|
-
<text fg={props.theme.textMuted}>
|
|
721
|
-
{props.label.padEnd(props.labelWidth)}
|
|
722
|
-
</text>
|
|
723
|
-
<text fg={props.theme.textMuted}>{'\u2014'}</text>
|
|
724
|
-
</box>
|
|
725
|
-
}
|
|
726
|
-
>
|
|
727
|
-
{/* Bars show usage; the adjacent figure shows quota left, as in the dialog. */}
|
|
728
|
-
<box
|
|
729
|
-
ref={(element: { width: number }) => {
|
|
730
|
-
row = element
|
|
731
|
-
}}
|
|
732
|
-
onSizeChange={() => setColumns(row?.width ?? 0)}
|
|
733
|
-
width='100%'
|
|
734
|
-
flexDirection='row'
|
|
735
|
-
justifyContent='space-between'
|
|
736
|
-
>
|
|
737
|
-
<box flexDirection='row' flexShrink={0}>
|
|
738
|
-
<text fg={props.theme.textMuted} wrapMode='none'>
|
|
739
|
-
{label()}
|
|
740
|
-
</text>
|
|
741
|
-
<For
|
|
742
|
-
each={quotaBarSegments(
|
|
743
|
-
used(),
|
|
744
|
-
{ ...props.appearance, barWidth: barCells() },
|
|
745
|
-
props.pacing,
|
|
746
|
-
)}
|
|
747
|
-
>
|
|
748
|
-
{(segment) => (
|
|
749
|
-
<text fg={toneColor(props.theme, segment.tone)} wrapMode='none'>
|
|
750
|
-
{segment.text}
|
|
751
|
-
</text>
|
|
752
|
-
)}
|
|
753
|
-
</For>
|
|
754
|
-
<text
|
|
755
|
-
fg={toneColor(props.theme, usageTone(used(), props.appearance))}
|
|
756
|
-
wrapMode='none'
|
|
757
|
-
>
|
|
758
|
-
{figure()}
|
|
759
|
-
</text>
|
|
760
|
-
</box>
|
|
761
|
-
<Show when={showReset()}>
|
|
762
|
-
<text fg={props.theme.textMuted} wrapMode='none' flexShrink={0}>
|
|
763
|
-
{props.resetText}
|
|
764
|
-
</text>
|
|
765
|
-
</Show>
|
|
766
|
-
</box>
|
|
767
|
-
{/* Keyed, so a cut to a new width draws a new text node: on Bun 1.3
|
|
768
|
-
an existing node kept drawing the text it was created with. */}
|
|
769
|
-
<Show when={fittedPaceLine()} keyed>
|
|
770
|
-
{(line) => (
|
|
771
|
-
<box width='100%' flexDirection='row'>
|
|
772
|
-
<text fg={props.theme.textMuted}>
|
|
773
|
-
{''.padEnd(props.labelWidth)}
|
|
774
|
-
</text>
|
|
775
|
-
<text
|
|
776
|
-
fg={toneColor(
|
|
777
|
-
props.theme,
|
|
778
|
-
props.pacing?.state === 'deficit' ? 'warn' : 'muted',
|
|
779
|
-
)}
|
|
780
|
-
wrapMode='none'
|
|
781
|
-
>
|
|
782
|
-
{line}
|
|
783
|
-
</text>
|
|
784
|
-
</box>
|
|
785
|
-
)}
|
|
786
|
-
</Show>
|
|
787
|
-
</Show>
|
|
788
|
-
)
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
// Account block: header row (name + status word) then per-window quota rows.
|
|
792
|
-
// Pacing is computed here — per window, against the wall clock at render time
|
|
793
|
-
// (re-evaluated on every state poll) — and disabled by passing false.
|
|
794
|
-
function AccountBlock(props: {
|
|
795
|
-
theme: ThemeCurrent
|
|
796
|
-
appearance: AppearancePrefs
|
|
797
|
-
name: string
|
|
798
|
-
quota: AccountQuota | null
|
|
799
|
-
killed: boolean
|
|
800
|
-
vaultState?: string
|
|
801
|
-
hostDisabled?: boolean
|
|
802
|
-
active: boolean
|
|
803
|
-
pacingEnabled: boolean
|
|
804
|
-
labelWidth: number
|
|
805
|
-
resetCredits?: number
|
|
806
|
-
marginTop?: number
|
|
807
|
-
}) {
|
|
808
|
-
const statusWord = () =>
|
|
809
|
-
props.killed ? 'blocked' : props.active ? 'active' : 'idle'
|
|
810
|
-
const statusTone = (): Tone =>
|
|
811
|
-
props.killed ? 'err' : props.active ? 'ok' : 'muted'
|
|
812
|
-
const rows = () =>
|
|
813
|
-
buildQuotaRowsForDisplay(
|
|
814
|
-
props.quota,
|
|
815
|
-
Date.now(),
|
|
816
|
-
props.pacingEnabled,
|
|
817
|
-
props.labelWidth,
|
|
818
|
-
)
|
|
819
|
-
return (
|
|
820
|
-
<box width='100%' flexDirection='column' marginTop={props.marginTop ?? 0}>
|
|
821
|
-
<box width='100%' flexDirection='row' justifyContent='space-between'>
|
|
822
|
-
<text fg={props.theme.text}>
|
|
823
|
-
<b>{props.name}</b>
|
|
824
|
-
</text>
|
|
825
|
-
<text fg={toneColor(props.theme, statusTone())}>
|
|
826
|
-
<b>{statusWord()}</b>
|
|
827
|
-
</text>
|
|
828
|
-
</box>
|
|
829
|
-
<Show when={props.vaultState}>
|
|
830
|
-
<text fg={props.theme.warning}>{props.vaultState}</text>
|
|
831
|
-
</Show>
|
|
832
|
-
<Show when={props.hostDisabled}>
|
|
833
|
-
<text fg={props.theme.textMuted}>off in /openai</text>
|
|
834
|
-
</Show>
|
|
835
|
-
<Show
|
|
836
|
-
when={isQuotaLoaded(props.quota)}
|
|
837
|
-
fallback={<text fg={props.theme.textMuted}>{'checking\u2026'}</text>}
|
|
838
|
-
>
|
|
839
|
-
<Show
|
|
840
|
-
when={rows().length > 0}
|
|
841
|
-
fallback={<text fg={props.theme.textMuted}>{'\u2014'}</text>}
|
|
842
|
-
>
|
|
843
|
-
<For each={rows()}>
|
|
844
|
-
{(row) => (
|
|
845
|
-
<QuotaRow
|
|
846
|
-
theme={props.theme}
|
|
847
|
-
appearance={props.appearance}
|
|
848
|
-
label={row.label}
|
|
849
|
-
labelWidth={row.labelWidth}
|
|
850
|
-
text={row.text}
|
|
851
|
-
resetText={row.resetText}
|
|
852
|
-
window={row.window}
|
|
853
|
-
pacing={row.pacing}
|
|
854
|
-
/>
|
|
855
|
-
)}
|
|
856
|
-
</For>
|
|
857
|
-
</Show>
|
|
858
|
-
</Show>
|
|
859
|
-
<For
|
|
860
|
-
each={quotaTextParts(sidebarQuotaProjection(props.quota, Date.now()), {
|
|
861
|
-
now: Date.now(),
|
|
862
|
-
form: 'compact',
|
|
863
|
-
}).filter((part) => part.startsWith('checked '))}
|
|
864
|
-
>
|
|
865
|
-
{(age) => <text fg={props.theme.textMuted}>{age}</text>}
|
|
866
|
-
</For>
|
|
867
|
-
<For
|
|
868
|
-
each={getAccountMetadataRows(
|
|
869
|
-
props.resetCredits,
|
|
870
|
-
props.quota?.spendControl,
|
|
871
|
-
accountCreditsText(props.quota),
|
|
872
|
-
props.active && accountServesOnCredits(props.quota, Date.now()),
|
|
873
|
-
)}
|
|
874
|
-
>
|
|
875
|
-
{(row) => (
|
|
876
|
-
<AccountMetaRow
|
|
877
|
-
theme={props.theme}
|
|
878
|
-
label={row.label}
|
|
879
|
-
value={row.value}
|
|
880
|
-
/>
|
|
881
|
-
)}
|
|
882
|
-
</For>
|
|
883
|
-
</box>
|
|
884
|
-
)
|
|
885
|
-
}
|
|
886
|
-
|
|
887
488
|
// --- State plumbing ---------------------------------------------------------
|
|
888
489
|
|
|
889
490
|
export async function readStateFromFile(): Promise<SidebarState> {
|
|
@@ -1067,10 +668,6 @@ function QuotaSidebar(props: {
|
|
|
1067
668
|
? vaultAccounts().length > 0
|
|
1068
669
|
: state().main?.quota != null || enabledFallbacks().length > 0
|
|
1069
670
|
|
|
1070
|
-
const headerLabel = () => {
|
|
1071
|
-
const name = prefs().header.label
|
|
1072
|
-
return !hasData() ? name : collapsed() ? `\u25b6 ${name}` : `\u25bc ${name}`
|
|
1073
|
-
}
|
|
1074
671
|
const sessionRouting = () =>
|
|
1075
672
|
resolveSessionSidebarRouting(state(), props.sessionId)
|
|
1076
673
|
const sessionState = (): SidebarState => ({
|
|
@@ -1123,199 +720,211 @@ function QuotaSidebar(props: {
|
|
|
1123
720
|
const degraded = () =>
|
|
1124
721
|
killedNames().length > 0 || quotaBackedOff() || refreshBackedOff()
|
|
1125
722
|
|
|
723
|
+
const allAccounts = () =>
|
|
724
|
+
vaultMode()
|
|
725
|
+
? vaultAccounts().map((account) => ({
|
|
726
|
+
...account,
|
|
727
|
+
label: account.label ?? account.id,
|
|
728
|
+
hostDisabled: !account.enabled,
|
|
729
|
+
}))
|
|
730
|
+
: [
|
|
731
|
+
{
|
|
732
|
+
id: 'main',
|
|
733
|
+
label: 'main',
|
|
734
|
+
quota: state().main?.quota ?? null,
|
|
735
|
+
killed: state().main?.killed ?? false,
|
|
736
|
+
resetCredits: state().main?.resetCredits,
|
|
737
|
+
vaultState: undefined,
|
|
738
|
+
hostDisabled: false,
|
|
739
|
+
},
|
|
740
|
+
...enabledFallbacks().map((account) => ({
|
|
741
|
+
...account,
|
|
742
|
+
label: account.label ?? account.id,
|
|
743
|
+
hostDisabled: false,
|
|
744
|
+
})),
|
|
745
|
+
]
|
|
746
|
+
const accounts = (): AccountView[] => {
|
|
747
|
+
if (!hasData()) return []
|
|
748
|
+
const rawAccounts = allAccounts()
|
|
749
|
+
const selected = collapsed()
|
|
750
|
+
? collapsedLines().flatMap((line) => {
|
|
751
|
+
const raw = rawAccounts.find((account) => account.id === line.id)
|
|
752
|
+
return raw ? [{ raw, muted: line.stale || !line.active }] : []
|
|
753
|
+
})
|
|
754
|
+
: rawAccounts
|
|
755
|
+
.filter(
|
|
756
|
+
(account) =>
|
|
757
|
+
vaultMode() ||
|
|
758
|
+
account.id === 'main' ||
|
|
759
|
+
prefs().sections.fallbackAccounts,
|
|
760
|
+
)
|
|
761
|
+
.map((raw) => ({ raw, muted: false }))
|
|
762
|
+
return selected.map(({ raw, muted }) => {
|
|
763
|
+
const active = sessionRouting().activeId === raw.id
|
|
764
|
+
const quota = sidebarQuotaProjection(raw.quota, Date.now())
|
|
765
|
+
const parts = quotaWindowParts(quota, {
|
|
766
|
+
now: Date.now(),
|
|
767
|
+
staleAfterMs: Number.POSITIVE_INFINITY,
|
|
768
|
+
}).windows
|
|
769
|
+
return {
|
|
770
|
+
id: raw.id,
|
|
771
|
+
label: raw.label,
|
|
772
|
+
status: {
|
|
773
|
+
text: raw.killed ? 'blocked' : active ? 'active' : 'idle',
|
|
774
|
+
tone: raw.killed ? 'error' : active ? 'success' : 'textMuted',
|
|
775
|
+
},
|
|
776
|
+
blocked: raw.killed,
|
|
777
|
+
indicatorTone: raw.killed
|
|
778
|
+
? 'error'
|
|
779
|
+
: muted
|
|
780
|
+
? 'textMuted'
|
|
781
|
+
: frameTone(activeQuotaTone()),
|
|
782
|
+
collapsed: { quotaTone: frameTone(activeQuotaTone()), muted },
|
|
783
|
+
quota,
|
|
784
|
+
groups: [
|
|
785
|
+
{
|
|
786
|
+
rows: buildQuotaRowsForDisplay(
|
|
787
|
+
raw.quota,
|
|
788
|
+
Date.now(),
|
|
789
|
+
prefs().sections.pacing,
|
|
790
|
+
).flatMap((row) => {
|
|
791
|
+
const part = parts.find((part) => part.name === row.label)
|
|
792
|
+
if (!part) return []
|
|
793
|
+
return [
|
|
794
|
+
{
|
|
795
|
+
part: {
|
|
796
|
+
...part,
|
|
797
|
+
// Hidden fallback rows still reserve their label column.
|
|
798
|
+
name: row.label.padEnd(quotaLabelWidth() - 1),
|
|
799
|
+
figure: row.text.slice(row.label.length + 1),
|
|
800
|
+
remainingPercent: 100 - row.window.usedPercent,
|
|
801
|
+
},
|
|
802
|
+
pace: paceView(row.pacing),
|
|
803
|
+
},
|
|
804
|
+
]
|
|
805
|
+
}),
|
|
806
|
+
},
|
|
807
|
+
],
|
|
808
|
+
emptyQuotaText: {
|
|
809
|
+
expanded: isQuotaLoaded(raw.quota) ? '\u2014' : 'checking\u2026',
|
|
810
|
+
collapsed: '\u2014',
|
|
811
|
+
},
|
|
812
|
+
}
|
|
813
|
+
})
|
|
814
|
+
}
|
|
815
|
+
|
|
1126
816
|
return (
|
|
1127
|
-
<
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
{
|
|
1138
|
-
{
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
<box paddingLeft={1} paddingRight={1} backgroundColor={theme().accent}>
|
|
1149
|
-
<text fg={theme().background}>
|
|
1150
|
-
<b>{headerLabel()}</b>
|
|
1151
|
-
</text>
|
|
1152
|
-
</box>
|
|
1153
|
-
<Show
|
|
1154
|
-
when={degraded()}
|
|
1155
|
-
fallback={
|
|
1156
|
-
<Show when={prefs().header.showVersion && PLUGIN_VERSION !== ''}>
|
|
1157
|
-
<text fg={theme().textMuted}>{`v${PLUGIN_VERSION}`}</text>
|
|
817
|
+
<SidebarFrame
|
|
818
|
+
header={{
|
|
819
|
+
badge: prefs().header.label,
|
|
820
|
+
version:
|
|
821
|
+
prefs().header.showVersion && PLUGIN_VERSION !== ''
|
|
822
|
+
? `v${PLUGIN_VERSION}`
|
|
823
|
+
: undefined,
|
|
824
|
+
}}
|
|
825
|
+
accounts={accounts()}
|
|
826
|
+
theme={theme()}
|
|
827
|
+
appearance={prefs().appearance}
|
|
828
|
+
showQuota={prefs().sections.quota}
|
|
829
|
+
now={Date.now()}
|
|
830
|
+
collapsed={collapsed()}
|
|
831
|
+
onToggle={props.controller.toggleCollapsed}
|
|
832
|
+
beforeQuota={(account) => {
|
|
833
|
+
const raw = allAccounts().find((raw) => raw.id === account.id)
|
|
834
|
+
return (
|
|
835
|
+
<>
|
|
836
|
+
<Show when={raw?.vaultState}>
|
|
837
|
+
<SidebarTextRow text={raw?.vaultState ?? ''} tone='warning' />
|
|
1158
838
|
</Show>
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
<box
|
|
1162
|
-
paddingLeft={1}
|
|
1163
|
-
paddingRight={1}
|
|
1164
|
-
backgroundColor={theme().warning}
|
|
1165
|
-
>
|
|
1166
|
-
<text fg={theme().background}>
|
|
1167
|
-
<b>{'LIMITED'}</b>
|
|
1168
|
-
</text>
|
|
1169
|
-
</box>
|
|
1170
|
-
</Show>
|
|
1171
|
-
</box>
|
|
1172
|
-
|
|
1173
|
-
{/* Collapsed: one line per account, narrow quota text + dot (red ⊘ when killed) */}
|
|
1174
|
-
<Show when={collapsed() && hasData()}>
|
|
1175
|
-
<Index each={collapsedLines()}>
|
|
1176
|
-
{(line) => (
|
|
1177
|
-
<CollapsedAccountRow
|
|
1178
|
-
theme={theme()}
|
|
1179
|
-
line={line()}
|
|
1180
|
-
tone={activeQuotaTone()}
|
|
1181
|
-
/>
|
|
1182
|
-
)}
|
|
1183
|
-
</Index>
|
|
1184
|
-
</Show>
|
|
1185
|
-
|
|
1186
|
-
{/* Expanded: full sections. Also render when there's no data so the
|
|
1187
|
-
sidebar can never go blank if data clears while collapsed. */}
|
|
1188
|
-
<Show when={!collapsed() || !hasData()}>
|
|
1189
|
-
<Show
|
|
1190
|
-
when={hasData()}
|
|
1191
|
-
fallback={
|
|
1192
|
-
<box marginTop={1} width='100%'>
|
|
1193
|
-
<text fg={theme().textMuted}>
|
|
1194
|
-
{vaultMode()
|
|
1195
|
-
? state().vaultDiscovered === true
|
|
1196
|
-
? 'No vault accounts'
|
|
1197
|
-
: "Waiting for the vault's first answer"
|
|
1198
|
-
: 'Waiting for quota\u2026'}
|
|
1199
|
-
</text>
|
|
1200
|
-
</box>
|
|
1201
|
-
}
|
|
1202
|
-
>
|
|
1203
|
-
{/* Quota */}
|
|
1204
|
-
<Show when={prefs().sections.quota}>
|
|
1205
|
-
<SectionHeader theme={theme()} title='Quota' />
|
|
1206
|
-
<Show
|
|
1207
|
-
when={!vaultMode()}
|
|
1208
|
-
fallback={
|
|
1209
|
-
<For each={vaultAccounts()}>
|
|
1210
|
-
{(account, index) => (
|
|
1211
|
-
<AccountBlock
|
|
1212
|
-
theme={theme()}
|
|
1213
|
-
appearance={prefs().appearance}
|
|
1214
|
-
name={account.label ?? account.id}
|
|
1215
|
-
quota={account.quota}
|
|
1216
|
-
killed={account.killed}
|
|
1217
|
-
vaultState={account.vaultState}
|
|
1218
|
-
hostDisabled={!account.enabled}
|
|
1219
|
-
active={sessionRouting().activeId === account.id}
|
|
1220
|
-
pacingEnabled={prefs().sections.pacing}
|
|
1221
|
-
labelWidth={quotaLabelWidth()}
|
|
1222
|
-
resetCredits={account.resetCredits}
|
|
1223
|
-
marginTop={index() === 0 ? 0 : 1}
|
|
1224
|
-
/>
|
|
1225
|
-
)}
|
|
1226
|
-
</For>
|
|
1227
|
-
}
|
|
1228
|
-
>
|
|
1229
|
-
<AccountBlock
|
|
1230
|
-
theme={theme()}
|
|
1231
|
-
appearance={prefs().appearance}
|
|
1232
|
-
name='main'
|
|
1233
|
-
quota={state().main?.quota ?? null}
|
|
1234
|
-
killed={state().main?.killed ?? false}
|
|
1235
|
-
active={sessionRouting().activeId === 'main'}
|
|
1236
|
-
pacingEnabled={prefs().sections.pacing}
|
|
1237
|
-
labelWidth={quotaLabelWidth()}
|
|
1238
|
-
resetCredits={state().main?.resetCredits}
|
|
1239
|
-
/>
|
|
1240
|
-
<Show when={prefs().sections.fallbackAccounts}>
|
|
1241
|
-
<For each={enabledFallbacks()}>
|
|
1242
|
-
{(fb) => (
|
|
1243
|
-
<AccountBlock
|
|
1244
|
-
theme={theme()}
|
|
1245
|
-
appearance={prefs().appearance}
|
|
1246
|
-
name={fb.label ?? fb.id}
|
|
1247
|
-
quota={fb.quota}
|
|
1248
|
-
killed={fb.killed}
|
|
1249
|
-
active={sessionRouting().activeId === fb.id}
|
|
1250
|
-
pacingEnabled={prefs().sections.pacing}
|
|
1251
|
-
labelWidth={quotaLabelWidth()}
|
|
1252
|
-
resetCredits={fb.resetCredits}
|
|
1253
|
-
marginTop={1}
|
|
1254
|
-
/>
|
|
1255
|
-
)}
|
|
1256
|
-
</For>
|
|
1257
|
-
</Show>
|
|
839
|
+
<Show when={raw?.hostDisabled}>
|
|
840
|
+
<SidebarTextRow text='off in /openai' />
|
|
1258
841
|
</Show>
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
<For
|
|
842
|
+
</>
|
|
843
|
+
)
|
|
844
|
+
}}
|
|
845
|
+
afterQuota={(account) => {
|
|
846
|
+
const raw = allAccounts().find((raw) => raw.id === account.id)
|
|
847
|
+
return (
|
|
848
|
+
<For
|
|
849
|
+
each={getAccountMetadataRows(
|
|
850
|
+
raw?.resetCredits,
|
|
851
|
+
raw?.quota?.spendControl,
|
|
852
|
+
accountCreditsText(raw?.quota ?? null),
|
|
853
|
+
sessionRouting().activeId === account.id &&
|
|
854
|
+
accountServesOnCredits(raw?.quota ?? null, Date.now()),
|
|
855
|
+
)}
|
|
856
|
+
>
|
|
1266
857
|
{(row) => (
|
|
1267
|
-
<
|
|
858
|
+
<AccountMetaRow
|
|
1268
859
|
theme={theme()}
|
|
1269
860
|
label={row.label}
|
|
1270
861
|
value={row.value}
|
|
1271
|
-
tone={row.tone}
|
|
1272
862
|
/>
|
|
1273
863
|
)}
|
|
1274
864
|
</For>
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
{(
|
|
1280
|
-
<
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
<Show when={
|
|
1293
|
-
<
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
865
|
+
)
|
|
866
|
+
}}
|
|
867
|
+
sections={() => (
|
|
868
|
+
<>
|
|
869
|
+
<Show when={!hasData()}>
|
|
870
|
+
<box marginTop={1} width='100%'>
|
|
871
|
+
<SidebarTextRow
|
|
872
|
+
text={
|
|
873
|
+
vaultMode()
|
|
874
|
+
? state().vaultDiscovered === true
|
|
875
|
+
? 'No vault accounts'
|
|
876
|
+
: "Waiting for the vault's first answer"
|
|
877
|
+
: 'Waiting for quota\u2026'
|
|
878
|
+
}
|
|
879
|
+
/>
|
|
880
|
+
</box>
|
|
881
|
+
</Show>
|
|
882
|
+
<Show when={prefs().sections.routing}>
|
|
883
|
+
<SidebarSection title='Routing'>
|
|
884
|
+
<For each={buildRoutingRowsForDisplay(state(), props.sessionId)}>
|
|
885
|
+
{(row) => (
|
|
886
|
+
<SidebarStatRow
|
|
887
|
+
label={row.label}
|
|
888
|
+
value={row.value}
|
|
889
|
+
tone={frameTone(row.tone)}
|
|
890
|
+
/>
|
|
891
|
+
)}
|
|
892
|
+
</For>
|
|
893
|
+
</SidebarSection>
|
|
1299
894
|
</Show>
|
|
1300
|
-
<
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
895
|
+
<For each={getQuotaMetadataRows(state())}>
|
|
896
|
+
{(row) => (
|
|
897
|
+
<SidebarStatRow label={row.label} value={row.value} tone='text' />
|
|
898
|
+
)}
|
|
899
|
+
</For>
|
|
900
|
+
<Show when={degraded() && prefs().sections.health}>
|
|
901
|
+
<SidebarSection title='Health'>
|
|
902
|
+
<Show when={quotaBackedOff()}>
|
|
903
|
+
<SidebarStatRow
|
|
904
|
+
label='Quota API'
|
|
905
|
+
value={`backoff ${formatUntil(state().main?.quotaBackoffUntil)}`}
|
|
906
|
+
tone='warning'
|
|
907
|
+
/>
|
|
908
|
+
</Show>
|
|
909
|
+
<Show when={refreshBackedOff()}>
|
|
910
|
+
<SidebarStatRow
|
|
911
|
+
label='Token refresh'
|
|
912
|
+
value={`backoff ${formatUntil(state().main?.refreshBackoffUntil)}`}
|
|
913
|
+
tone='warning'
|
|
914
|
+
/>
|
|
915
|
+
</Show>
|
|
916
|
+
</SidebarSection>
|
|
917
|
+
</Show>
|
|
918
|
+
<Show when={killedNames().length > 0}>
|
|
919
|
+
<SidebarStatRow
|
|
920
|
+
label='Killswitch'
|
|
921
|
+
value={`${killedNames().join(', ')} blocked`}
|
|
922
|
+
tone='error'
|
|
1306
923
|
/>
|
|
1307
924
|
</Show>
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
theme={theme()}
|
|
1312
|
-
label='Killswitch'
|
|
1313
|
-
value={`${killedNames().join(', ')} blocked`}
|
|
1314
|
-
tone='err'
|
|
1315
|
-
/>
|
|
1316
|
-
</Show>
|
|
1317
|
-
</Show>
|
|
1318
|
-
</box>
|
|
925
|
+
</>
|
|
926
|
+
)}
|
|
927
|
+
/>
|
|
1319
928
|
)
|
|
1320
929
|
}
|
|
1321
930
|
|