@cortexkit/opencode-openai-auth 1.8.6 → 1.9.0

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 (37) hide show
  1. package/dist/bin.js +2 -2
  2. package/dist/index-0vvxnhd3.js +76 -0
  3. package/dist/{index-byz2j6hz.js → index-2f9w48sc.js} +1 -1
  4. package/dist/{index-jh90fx7y.js → index-2sb7q9wr.js} +2 -2
  5. package/dist/{index-zf649dj2.js → index-7bgst9rd.js} +2 -2
  6. package/dist/{index-kphzmgq6.js → index-96971sba.js} +1 -1
  7. package/dist/{index-5wgxt362.js → index-bvswyxpt.js} +1 -1
  8. package/dist/{index-25p8t63g.js → index-e32hgdk4.js} +2 -2
  9. package/dist/index-ececstzk.js +91 -0
  10. package/dist/{index-95s2mw9w.js → index-jenb51ww.js} +2 -2
  11. package/dist/{index-zah8t2d2.js → index-v0y4hv4r.js} +2 -2
  12. package/dist/{index-pnvp8hvs.js → index-vkg5pw57.js} +1 -1
  13. package/dist/{index-n12zjwh9.js → index-wkn4d21h.js} +2 -2
  14. package/dist/index-yw0wnqjq.js +63 -0
  15. package/dist/index.js +1 -1
  16. package/dist/rpc/port-file.js +1 -1
  17. package/dist/rpc/protocol.js +1 -1
  18. package/dist/rpc/rpc-client.js +1 -1
  19. package/dist/rpc/rpc-dir.js +1 -1
  20. package/dist/sidebar-state.js +1 -1
  21. package/dist/token-util-ybe08zph.js +1 -0
  22. package/dist/{token-j2jmx8k7.js → token-y2zkdr5m.js} +1 -1
  23. package/dist/tui-preferences.js +1 -1
  24. package/dist/v2/server.js +2 -2
  25. package/package.json +2 -2
  26. package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +25 -0
  27. package/src/tui-compiled/raw/shared/352d228be2832bd4-hub.js +20 -1
  28. package/src/tui-compiled/raw/shared/549daf371622c304-index.tsx +262 -129
  29. package/src/tui-compiled/raw/shared/d0f0b6be200311af-insula.js +6 -0
  30. package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +25 -0
  31. package/src/tui-compiled/runtime/shared/352d228be2832bd4-hub.js +20 -1
  32. package/src/tui-compiled/runtime/shared/549daf371622c304-index.js +338 -222
  33. package/src/tui-compiled/runtime/shared/d0f0b6be200311af-insula.js +6 -0
  34. package/dist/index-a8wbqm6a.js +0 -74
  35. package/dist/index-v6jcz0hz.js +0 -63
  36. package/dist/index-zne9tzy9.js +0 -91
  37. package/dist/token-util-7n2nfbyc.js +0 -1
@@ -5,6 +5,8 @@ import {
5
5
  createMemo,
6
6
  createSignal,
7
7
  For,
8
+ Index,
9
+ mergeProps,
8
10
  Show,
9
11
  useContext,
10
12
  } from "solid-js"
@@ -21,7 +23,9 @@ export type Tone =
21
23
  | 'error'
22
24
 
23
25
  export type SidebarTheme = Readonly<
24
- Record<Tone | 'background' | 'borderActive', RGBA>
26
+ Partial<
27
+ Record<Tone | 'background' | 'borderActive', RGBA | string | undefined>
28
+ >
25
29
  >
26
30
 
27
31
  export interface SidebarAppearance {
@@ -61,7 +65,7 @@ export interface AccountView {
61
65
  export interface SidebarFrameProps {
62
66
  header: { badge: string; version?: string }
63
67
  accounts: readonly AccountView[]
64
- theme: SidebarTheme
68
+ theme?: SidebarTheme
65
69
  appearance: SidebarAppearance
66
70
  showQuota: boolean
67
71
  now: number
@@ -70,11 +74,16 @@ export interface SidebarFrameProps {
70
74
  beforeQuota?: (account: AccountView) => JSX.Element
71
75
  afterQuota?: (account: AccountView) => JSX.Element
72
76
  sections?: () => JSX.Element
77
+ collapsedSections?: () => JSX.Element
78
+ }
79
+
80
+ type FrameContextProps = Omit<SidebarFrameProps, 'theme'> & {
81
+ theme: SidebarTheme
73
82
  }
74
83
 
75
- const FrameContext = createContext<SidebarFrameProps>()
84
+ const FrameContext = createContext<FrameContextProps>()
76
85
 
77
- function frameContext(): SidebarFrameProps {
86
+ function frameContext(): FrameContextProps {
78
87
  const context = useContext(FrameContext)
79
88
  if (!context)
80
89
  throw new Error('Sidebar primitives must be inside SidebarFrame')
@@ -158,9 +167,20 @@ export function SidebarStatRow(props: {
158
167
  )
159
168
  }
160
169
 
161
- export function SidebarTextRow(props: { text: string; tone?: Tone }) {
170
+ export function SidebarTextRow(props: {
171
+ text: string
172
+ tone?: Tone
173
+ wrapMode?: JSX.IntrinsicElements['text']['wrapMode']
174
+ }) {
162
175
  const context = frameContext()
163
- return <text fg={context.theme[props.tone ?? 'textMuted']}>{props.text}</text>
176
+ return (
177
+ <text
178
+ fg={context.theme[props.tone ?? 'textMuted']}
179
+ wrapMode={props.wrapMode}
180
+ >
181
+ {props.text}
182
+ </text>
183
+ )
164
184
  }
165
185
 
166
186
  function usageTone(used: number, appearance: SidebarAppearance): Tone {
@@ -179,16 +199,18 @@ function barSegments(
179
199
  Math.max(0, Math.min(Math.round((pct / 100) * width), width))
180
200
  const usedCells = cells(used)
181
201
  const tone = usageTone(used, appearance)
202
+ // Keep the overlay's slot even when empty so live pacing changes reuse nodes.
182
203
  const plain = [
183
204
  { text: appearance.barFilledChar.repeat(usedCells), tone },
205
+ { text: '', tone },
184
206
  { text: appearance.barEmptyChar.repeat(width - usedCells), tone },
185
207
  ]
186
208
  const overlay = pace?.overlay
187
- if (!overlay) return plain.filter((segment) => segment.text.length > 0)
209
+ if (!overlay) return plain
188
210
  const paceCells = cells(overlay.percent)
189
211
  const lo = Math.min(usedCells, paceCells)
190
212
  const hi = Math.max(usedCells, paceCells)
191
- if (lo === hi) return plain.filter((segment) => segment.text.length > 0)
213
+ if (lo === hi) return plain
192
214
  return [
193
215
  { text: appearance.barFilledChar.repeat(lo), tone },
194
216
  {
@@ -197,39 +219,47 @@ function barSegments(
197
219
  overlay.kind === 'deficit' ? ('error' as const) : ('success' as const),
198
220
  },
199
221
  { text: appearance.barEmptyChar.repeat(width - hi), tone },
200
- ].filter((segment) => segment.text.length > 0)
222
+ ]
201
223
  }
202
224
 
203
225
  function QuotaRow(props: {
204
226
  part: QuotaWindowPart
205
227
  pace?: PaceView
206
228
  labelWidth: number
229
+ barCells: number
230
+ resetWidth: number
231
+ showReset: boolean
207
232
  }) {
208
233
  const context = frameContext()
209
234
  const [columns, setColumns] = createSignal(0)
210
235
  let row: { width: number } | undefined
211
- const label = () => props.part.name.padEnd(props.labelWidth)
236
+ const label = () =>
237
+ props.part.name +
238
+ ' '.repeat(Math.max(0, props.labelWidth - displayWidth(props.part.name)))
212
239
  const figure = () =>
213
240
  ` ${props.part.kind === 'budget' && props.part.figure.startsWith(`${props.part.name} `) ? props.part.figure.slice(props.part.name.length + 1) : props.part.figure}`
214
- const reset = () =>
215
- props.part.resetIn ?? (props.part.resetSinceReading ? 'reset' : undefined)
216
241
  const used = () => 100 - (props.part.remainingPercent ?? 100)
217
- const fit = () => {
218
- const barWidth = context.appearance.barWidth
219
- const resetWidth = displayWidth(reset() ?? '')
220
- if (columns() <= 0) return { barCells: barWidth, showReset: resetWidth > 0 }
221
- const fixed = displayWidth(label()) + displayWidth(figure())
222
- if (resetWidth > 0 && fixed + barWidth + 1 + resetWidth <= columns())
223
- return { barCells: barWidth, showReset: true }
224
- const room = columns() - fixed
225
- return {
226
- barCells: room >= barWidth ? barWidth : room >= 3 ? room : 0,
227
- showReset: false,
228
- }
229
- }
230
- // Stable fits keep existing bar nodes alive through the first measurement.
231
- const barCells = createMemo(() => fit().barCells)
232
- const showReset = createMemo(() => fit().showReset)
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
+ )
233
263
  const paceLine = () => {
234
264
  const text = props.pace?.text
235
265
  if (!text || columns() <= 0) return text
@@ -246,43 +276,69 @@ function QuotaRow(props: {
246
276
  flexDirection='row'
247
277
  justifyContent='space-between'
248
278
  >
249
- <box flexDirection='row' flexShrink={0}>
250
- <text fg={context.theme.textMuted} wrapMode='none'>
251
- {label()}
252
- </text>
253
- <For
254
- each={barSegments(
255
- used(),
256
- { ...context.appearance, barWidth: barCells() },
257
- props.pace,
258
- )}
259
- >
260
- {(segment) => (
261
- <text fg={context.theme[segment.tone]} wrapMode='none'>
262
- {segment.text}
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
263
293
  </text>
264
- )}
265
- </For>
266
- <text
267
- fg={context.theme[usageTone(used(), context.appearance)]}
268
- wrapMode='none'
294
+ }
269
295
  >
270
- {figure()}
271
- </text>
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>
272
317
  </box>
273
- <Show when={showReset()}>
274
- <text fg={context.theme.textMuted} wrapMode='none' flexShrink={0}>
275
- {reset()}
276
- </text>
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>
277
331
  </Show>
278
332
  </box>
279
333
  {/* A changed fitted line needs a fresh text node to draw at its new width. */}
280
- <Show when={paceLine()} keyed>
334
+ <Show when={!props.part.resetSinceReading && paceLine()} keyed>
281
335
  {(line: string) => (
282
336
  <box width='100%' flexDirection='row'>
283
- <text fg={context.theme.textMuted}>
284
- {''.padEnd(props.labelWidth)}
285
- </text>
337
+ <Show when={props.labelWidth > 0}>
338
+ <text fg={context.theme.textMuted}>
339
+ {''.padEnd(props.labelWidth)}
340
+ </text>
341
+ </Show>
286
342
  <text
287
343
  fg={context.theme[props.pace?.tone ?? 'textMuted']}
288
344
  wrapMode='none'
@@ -306,14 +362,15 @@ function CollapsedAccountRow(props: { account: AccountView }) {
306
362
  const text = () =>
307
363
  hasQuota()
308
364
  ? formatQuota(props.account.quota, { now: context.now, form: 'narrow' })
309
- : null
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()
310
368
  const label = () => {
311
369
  if (width() <= 0) return props.account.label
312
- const value =
313
- text() === null
314
- ? displayWidth(props.account.emptyQuotaText?.collapsed ?? '\u2014')
315
- : displayWidth(text() ?? '') + 2
316
- return fitText(props.account.label, width() - value - 1)
370
+ return fitText(
371
+ props.account.label,
372
+ width() - (showQuota() ? displayWidth(text()) + 3 : 2),
373
+ )
317
374
  }
318
375
  const muted = () => props.account.collapsed?.muted ?? false
319
376
  const quotaTone = () =>
@@ -327,60 +384,117 @@ function CollapsedAccountRow(props: { account: AccountView }) {
327
384
  width='100%'
328
385
  flexDirection='row'
329
386
  justifyContent='space-between'
387
+ columnGap={label() ? 1 : 0}
330
388
  >
331
- <text
332
- fg={context.theme[muted() ? 'textMuted' : 'text']}
333
- wrapMode='none'
334
- flexShrink={1}
335
- >
336
- {label()}
337
- </text>
338
- <Show
339
- when={text() !== null}
340
- fallback={
341
- <text fg={context.theme.textMuted}>
342
- {props.account.emptyQuotaText?.collapsed ?? '\u2014'}
343
- </text>
344
- }
345
- >
346
- <box flexDirection='row' flexShrink={0}>
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()}>
347
400
  <Show
348
- when={!muted()}
401
+ when={hasQuota() && !muted()}
349
402
  fallback={<text fg={context.theme.textMuted}>{text()}</text>}
350
403
  >
351
404
  <text fg={context.theme[quotaTone()]}>
352
405
  <b>{text()}</b>
353
406
  </text>
354
407
  </Show>
355
- <text fg={context.theme[props.account.indicatorTone]}>
356
- {props.account.blocked ? ' \u2298' : ' \u25cf'}
357
- </text>
358
- </box>
359
- </Show>
408
+ </Show>
409
+ <text fg={context.theme[props.account.indicatorTone]}>
410
+ {showQuota() ? ' ' : ''}
411
+ {props.account.blocked ? '\u2298' : '\u25cf'}
412
+ </text>
413
+ </box>
360
414
  </box>
361
415
  )
362
416
  }
363
417
 
364
- function AccountBlock(props: {
365
- account: AccountView
366
- labelWidth: number
367
- marginTop: number
368
- }) {
418
+ function AccountBlock(props: { account: AccountView; marginTop: number }) {
369
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
+ }
370
470
  const age = () =>
371
471
  quotaWindowParts(props.account.quota, { now: context.now }).age
372
472
  const hasRows = () =>
373
473
  props.account.groups.some((group) => group.rows.length > 0)
374
474
  return (
375
- <box width='100%' flexDirection='column' marginTop={props.marginTop}>
376
- <box width='100%' flexDirection='row' justifyContent='space-between'>
377
- <text fg={context.theme.text}>
378
- <b>
379
- {props.account.label}
380
- {props.account.titleSuffix ? ` · ${props.account.titleSuffix}` : ''}
381
- </b>
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>
382
492
  </text>
383
- <text fg={context.theme[props.account.status.tone]}>
493
+ <text
494
+ fg={context.theme[props.account.status.tone]}
495
+ wrapMode='none'
496
+ flexShrink={0}
497
+ >
384
498
  <b>{props.account.status.text}</b>
385
499
  </text>
386
500
  </box>
@@ -390,6 +504,7 @@ function AccountBlock(props: {
390
504
  fallback={
391
505
  <SidebarTextRow
392
506
  text={props.account.emptyQuotaText?.expanded ?? '\u2014'}
507
+ wrapMode='none'
393
508
  />
394
509
  }
395
510
  >
@@ -397,23 +512,36 @@ function AccountBlock(props: {
397
512
  {(group) => (
398
513
  <>
399
514
  <Show when={group.title}>
400
- <SidebarTextRow text={group.title ?? ''} tone='text' />
515
+ <SidebarTextRow
516
+ text={group.title ?? ''}
517
+ tone='text'
518
+ wrapMode='none'
519
+ />
401
520
  </Show>
402
521
  <For each={group.rows}>
403
- {(row) => (
404
- <QuotaRow
405
- part={row.part}
406
- pace={row.pace}
407
- labelWidth={props.labelWidth}
408
- />
409
- )}
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
+ }}
410
536
  </For>
411
537
  </>
412
538
  )}
413
539
  </For>
414
540
  </Show>
415
541
  <Show when={age()}>
416
- {(text: () => string) => <SidebarTextRow text={text()} />}
542
+ {(text: () => string) => (
543
+ <SidebarTextRow text={text()} wrapMode='none' />
544
+ )}
417
545
  </Show>
418
546
  {context.afterQuota?.(props.account)}
419
547
  </box>
@@ -427,25 +555,26 @@ export function SidebarFrame(props: SidebarFrameProps) {
427
555
  !hasData()
428
556
  ? props.header.badge
429
557
  : `${props.collapsed ? '\u25b6' : '\u25bc'} ${props.header.badge}`
430
- const labelWidth = () =>
431
- Math.max(
432
- 3,
433
- ...props.accounts.flatMap((account) =>
434
- account.groups.flatMap((group) =>
435
- group.rows.map((row) => row.part.name.length + 1),
436
- ),
437
- ),
438
- )
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
439
575
  return (
440
- <FrameContext.Provider value={props}>
441
- <box
442
- width='100%'
443
- flexDirection='column'
444
- paddingTop={1}
445
- paddingBottom={1}
446
- paddingLeft={1}
447
- paddingRight={1}
448
- >
576
+ <FrameContext.Provider value={context}>
577
+ <box width='100%' flexDirection='column'>
449
578
  {/* Blocked accounts retain their own indicators; the header always keeps its version. */}
450
579
  {/* biome-ignore lint/a11y/noStaticElementInteractions: OpenTUI terminal widgets do not have DOM roles */}
451
580
  <box
@@ -460,20 +589,25 @@ export function SidebarFrame(props: SidebarFrameProps) {
460
589
  <box
461
590
  paddingLeft={1}
462
591
  paddingRight={1}
463
- backgroundColor={props.theme.accent}
592
+ backgroundColor={invertBadge() ? props.theme?.accent : undefined}
464
593
  >
465
- <text fg={props.theme.background}>
594
+ <text
595
+ fg={
596
+ invertBadge() ? props.theme?.background : context.theme.accent
597
+ }
598
+ >
466
599
  <b>{headerLabel()}</b>
467
600
  </text>
468
601
  </box>
469
602
  <Show when={props.header.version}>
470
- <text fg={props.theme.textMuted}>{props.header.version}</text>
603
+ <text fg={context.theme.textMuted}>{props.header.version}</text>
471
604
  </Show>
472
605
  </box>
473
606
  <Show when={props.collapsed && hasData()}>
474
607
  <For each={props.accounts}>
475
608
  {(account) => <CollapsedAccountRow account={account} />}
476
609
  </For>
610
+ {props.collapsedSections?.()}
477
611
  </Show>
478
612
  <Show when={!props.collapsed || !hasData()}>
479
613
  <Show when={props.showQuota && hasData()}>
@@ -482,7 +616,6 @@ export function SidebarFrame(props: SidebarFrameProps) {
482
616
  {(account, index) => (
483
617
  <AccountBlock
484
618
  account={account}
485
- labelWidth={labelWidth()}
486
619
  marginTop={index() === 0 ? 0 : 1}
487
620
  />
488
621
  )}
@@ -443,6 +443,12 @@ export class InsulaQuotaSource {
443
443
  ...(typeof entry.source === 'string' && { source: entry.source }),
444
444
  },
445
445
  };
446
+ // Kept usage must not trigger a provider poll after a non-local failure.
447
+ // Only an explicitly local failure permits fallback; unknown causes do not.
448
+ if (entry.stale !== undefined &&
449
+ (!record(entry.stale) ||
450
+ entry.stale.class !== 'local_source_unavailable'))
451
+ return { miss: 'upstream-failed', reading };
446
452
  return now >= fetchedAt + MAX_AGE || entry.stale !== undefined
447
453
  ? { miss: 'stale', reading }
448
454
  : { reading };
@@ -1,3 +1,4 @@
1
+ import { channel } from "node:diagnostics_channel";
1
2
  import { ClaustrumCredentialError, } from "@cortexkit/claustrum-client";
2
3
  import { createLogger } from "./cc9e0702a752cea7-index.js";
3
4
  import { ClaustrumUnreachableError, classifyVaultFailure, } from "./94f53cfd572ba4bb-availability.js";
@@ -27,6 +28,8 @@ function scopedRetryReason(served, current) {
27
28
  return 'rotated';
28
29
  }
29
30
  const defaultLogger = createLogger('claustrum');
31
+ // Opt-in diagnostics let tests retain wait phases without logging each vault read.
32
+ const phaseDiagnostics = channel('common-auth.claustrum.phases');
30
33
  /**
31
34
  * Decide whether a request that got a 401 should retry with the freshly
32
35
  * re-authorized receipt, and log the decision. The vault can refresh a
@@ -280,6 +283,11 @@ export class ClaustrumScopedCustody {
280
283
  }
281
284
  async #token(signal) {
282
285
  this.#check(signal);
286
+ if (phaseDiagnostics.hasSubscribers)
287
+ phaseDiagnostics.publish({
288
+ logger: this.#logger,
289
+ phase: 'token read begin',
290
+ });
283
291
  const pending = this.#readToken();
284
292
  this.#tokenReads.add(pending);
285
293
  let value;
@@ -288,6 +296,11 @@ export class ClaustrumScopedCustody {
288
296
  }
289
297
  finally {
290
298
  this.#tokenReads.delete(pending);
299
+ if (phaseDiagnostics.hasSubscribers)
300
+ phaseDiagnostics.publish({
301
+ logger: this.#logger,
302
+ phase: 'token read end',
303
+ });
291
304
  }
292
305
  this.#check(signal);
293
306
  if (!/^[0-9a-f]{64}$/.test(value.token) ||
@@ -359,6 +372,11 @@ export class ClaustrumScopedCustody {
359
372
  this.#kept.clear();
360
373
  throw error;
361
374
  }
375
+ if (phaseDiagnostics.hasSubscribers)
376
+ phaseDiagnostics.publish({
377
+ logger: this.#logger,
378
+ phase: 'list scoped begin',
379
+ });
362
380
  try {
363
381
  inventory = await this.#call(() => this.#client.listScoped(token), signal);
364
382
  }
@@ -366,6 +384,13 @@ export class ClaustrumScopedCustody {
366
384
  this.listFailed(error);
367
385
  throw error;
368
386
  }
387
+ finally {
388
+ if (phaseDiagnostics.hasSubscribers)
389
+ phaseDiagnostics.publish({
390
+ logger: this.#logger,
391
+ phase: 'list scoped end',
392
+ });
393
+ }
369
394
  const skipped = [];
370
395
  const refused = [];
371
396
  let notMine = 0;
@@ -11,6 +11,7 @@
11
11
  // different processes already share, plus the base-view rule, so a commit
12
12
  // never replaces a view another process committed after this hub listed.
13
13
  import { createHash } from "node:crypto";
14
+ import { channel } from "node:diagnostics_channel";
14
15
  import { readdir, stat } from "node:fs/promises";
15
16
  import { dirname, join, resolve } from "node:path";
16
17
  import { createLogger } from "./cc9e0702a752cea7-index.js";
@@ -766,7 +767,25 @@ export class ClaustrumDiscoveryHub {
766
767
  throw base;
767
768
  // A member's first roster under this key carries the declines and
768
769
  // order of its newest roster under an older key.
769
- const seed = base.file ? undefined : await this.#seed(entry);
770
+ let seed;
771
+ if (!base.file) {
772
+ const phaseDiagnostics = channel('common-auth.claustrum.phases');
773
+ if (phaseDiagnostics.hasSubscribers)
774
+ phaseDiagnostics.publish({
775
+ logger: this.#logger,
776
+ phase: `seed read ${entry.provider} begin`,
777
+ });
778
+ try {
779
+ seed = await this.#seed(entry);
780
+ }
781
+ finally {
782
+ if (phaseDiagnostics.hasSubscribers)
783
+ phaseDiagnostics.publish({
784
+ logger: this.#logger,
785
+ phase: `seed read ${entry.provider} end`,
786
+ });
787
+ }
788
+ }
770
789
  const roster = await refreshVaultRoster({
771
790
  path: entry.path,
772
791
  custody: { discover: async () => share },