@cortexkit/opencode-openai-auth 1.18.0 → 1.19.1
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 +2 -2
- package/dist/{codex-request-CTIOw2EZ.d.ts → codex-request-Bj3F3fFg.d.ts} +2 -2
- package/dist/{index-9sh2xnwr.js → index-1ttg64ny.js} +2 -2
- package/dist/index-34r6y4jf.js +64 -0
- package/dist/{index-nkgxq9a6.js → index-3wr1ebxp.js} +2 -2
- package/dist/{index-hrv1msdb.js → index-62xhtkv8.js} +1 -1
- package/dist/{index-raj3tyyz.js → index-663p60em.js} +1 -1
- package/dist/index-8km6f9bq.js +2 -0
- package/dist/{index-smekt6zv.js → index-977gx5br.js} +2 -2
- package/dist/{index-2ecf254a.js → index-ckkhe4r4.js} +19 -19
- package/dist/{index-5vh4jgb7.js → index-hsrx1pkq.js} +2 -2
- package/dist/{index-5czcaan0.js → index-jk0zyyny.js} +2 -2
- package/dist/{index-1r7zznds.js → index-kgzevj7y.js} +1 -1
- package/dist/{index-rs8z3per.js → index-mbxq1g4n.js} +1 -1
- package/dist/{index-m6sq5g7q.js → index-nrkvrvpw.js} +2 -2
- package/dist/{index-h7xxfm12.js → index-r6k6hh93.js} +1 -1
- package/dist/index.d.ts +1 -1
- 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.js +1 -1
- package/dist/token-util-kwahm03g.js +1 -0
- package/dist/{token-kdjmv82a.js → token-y3kre94n.js} +1 -1
- package/dist/tui-preferences.js +1 -1
- package/dist/v2/server.d.ts +1 -1
- package/dist/v2/server.js +4 -4
- package/package.json +8 -8
- package/src/tui-compiled/raw/shared/375d9cca2def037d-private-files.js +3 -1
- package/src/tui-compiled/raw/shared/a75d0d866c227b3f-index.tsx +129 -18
- package/src/tui-compiled/runtime/shared/375d9cca2def037d-private-files.js +3 -1
- package/src/tui-compiled/runtime/shared/a75d0d866c227b3f-index.js +324 -187
- package/dist/index-177kc3f1.js +0 -64
- package/dist/index-96p0myg1.js +0 -2
- package/dist/token-util-71r7z2vr.js +0 -1
|
@@ -94,13 +94,14 @@ export interface AccountView {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export interface SidebarFrameProps {
|
|
97
|
-
header: { badge: string; version?: string }
|
|
97
|
+
header: { badge: string; version?: string; afterBadge?: () => JSX.Element }
|
|
98
98
|
accounts: readonly AccountView[]
|
|
99
99
|
theme?: SidebarTheme
|
|
100
100
|
appearance: SidebarAppearance
|
|
101
101
|
showQuota: boolean
|
|
102
102
|
now: number
|
|
103
103
|
collapsed: boolean
|
|
104
|
+
collapsible?: boolean
|
|
104
105
|
onToggle: () => void
|
|
105
106
|
beforeQuota?: (account: AccountView) => JSX.Element
|
|
106
107
|
afterQuota?: (account: AccountView) => JSX.Element
|
|
@@ -253,6 +254,107 @@ function barSegments(
|
|
|
253
254
|
]
|
|
254
255
|
}
|
|
255
256
|
|
|
257
|
+
export interface SidebarGaugeRowProps {
|
|
258
|
+
label: string
|
|
259
|
+
used?: number
|
|
260
|
+
value?: string
|
|
261
|
+
warnAt?: number
|
|
262
|
+
errorAt?: number
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export function SidebarGaugeRow(props: SidebarGaugeRowProps) {
|
|
266
|
+
const context = frameContext()
|
|
267
|
+
const [columns, setColumns] = createSignal(0)
|
|
268
|
+
let row: { width: number } | undefined
|
|
269
|
+
const known = () => props.used !== undefined && Number.isFinite(props.used)
|
|
270
|
+
const used = () => Math.max(0, Math.min(100, props.used ?? 0))
|
|
271
|
+
const figure = () =>
|
|
272
|
+
known() ? `${Math.round(100 - used())}% left` : 'no reading'
|
|
273
|
+
const appearance = () => ({
|
|
274
|
+
...context.appearance,
|
|
275
|
+
warnThreshold: props.warnAt ?? context.appearance.warnThreshold,
|
|
276
|
+
errorThreshold: props.errorAt ?? context.appearance.errorThreshold,
|
|
277
|
+
})
|
|
278
|
+
const label = () =>
|
|
279
|
+
columns() <= 0
|
|
280
|
+
? props.label
|
|
281
|
+
: fitText(props.label, columns() - displayWidth(figure()) - 1)
|
|
282
|
+
const barCells = () => {
|
|
283
|
+
if (!known()) return 0
|
|
284
|
+
const desired = context.appearance.barWidth
|
|
285
|
+
if (columns() <= 0) return desired
|
|
286
|
+
const room =
|
|
287
|
+
columns() - displayWidth(label()) - 1 - displayWidth(figure()) - 1
|
|
288
|
+
return room >= Math.min(4, desired) ? Math.min(desired, room) : 0
|
|
289
|
+
}
|
|
290
|
+
const segments = createMemo(
|
|
291
|
+
() => barSegments(used(), { ...appearance(), barWidth: barCells() }),
|
|
292
|
+
undefined,
|
|
293
|
+
{
|
|
294
|
+
equals: (previous, next) =>
|
|
295
|
+
previous.every(
|
|
296
|
+
(segment, index) =>
|
|
297
|
+
segment.text === next[index]?.text &&
|
|
298
|
+
segment.tone === next[index]?.tone,
|
|
299
|
+
),
|
|
300
|
+
},
|
|
301
|
+
)
|
|
302
|
+
const value = () => {
|
|
303
|
+
if (!props.value) return ''
|
|
304
|
+
if (columns() <= 0) return props.value
|
|
305
|
+
const room =
|
|
306
|
+
columns() -
|
|
307
|
+
displayWidth(label()) -
|
|
308
|
+
1 -
|
|
309
|
+
displayWidth(figure()) -
|
|
310
|
+
(barCells() > 0 ? barCells() + 1 : 0) -
|
|
311
|
+
1
|
|
312
|
+
return room >= 2 ? fitText(props.value, room) : ''
|
|
313
|
+
}
|
|
314
|
+
const tone = () => (known() ? usageTone(used(), appearance()) : 'textMuted')
|
|
315
|
+
return (
|
|
316
|
+
<box
|
|
317
|
+
ref={(element: { width: number }) => {
|
|
318
|
+
row = element
|
|
319
|
+
}}
|
|
320
|
+
onSizeChange={() => setColumns(row?.width ?? 0)}
|
|
321
|
+
width='100%'
|
|
322
|
+
flexDirection='row'
|
|
323
|
+
justifyContent='space-between'
|
|
324
|
+
>
|
|
325
|
+
<box flexDirection='row' flexShrink={0}>
|
|
326
|
+
<text fg={context.theme.textMuted} wrapMode='none'>
|
|
327
|
+
{label()}{' '}
|
|
328
|
+
</text>
|
|
329
|
+
<Show when={barCells() > 0}>
|
|
330
|
+
{/* Explicit widths let empty slots grow on OpenTUI 0.4.5 and 0.5.11. */}
|
|
331
|
+
<Index each={segments()}>
|
|
332
|
+
{(segment) => (
|
|
333
|
+
<text
|
|
334
|
+
fg={context.theme[segment().tone]}
|
|
335
|
+
wrapMode='none'
|
|
336
|
+
width={displayWidth(segment().text)}
|
|
337
|
+
>
|
|
338
|
+
{segment().text}
|
|
339
|
+
</text>
|
|
340
|
+
)}
|
|
341
|
+
</Index>
|
|
342
|
+
<text wrapMode='none'> </text>
|
|
343
|
+
</Show>
|
|
344
|
+
<text fg={context.theme[tone()]} wrapMode='none'>
|
|
345
|
+
{figure()}
|
|
346
|
+
</text>
|
|
347
|
+
</box>
|
|
348
|
+
<Show when={value()}>
|
|
349
|
+
{/* The right-hand value reads like a stat row's: normal text, bold. */}
|
|
350
|
+
<text fg={context.theme.text} wrapMode='none'>
|
|
351
|
+
<b>{value()}</b>
|
|
352
|
+
</text>
|
|
353
|
+
</Show>
|
|
354
|
+
</box>
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
|
|
256
358
|
function QuotaRow(props: {
|
|
257
359
|
part: SidebarWindowPart
|
|
258
360
|
pace?: PaceView
|
|
@@ -602,8 +704,9 @@ function AccountBlock(props: { account: AccountView; marginTop: number }) {
|
|
|
602
704
|
/** Borderless, controlled presentation; host registration and provider policy stay in the plugin. */
|
|
603
705
|
export function SidebarFrame(props: SidebarFrameProps) {
|
|
604
706
|
const hasData = () => props.accounts.length > 0
|
|
707
|
+
const canCollapse = () => props.collapsible ?? hasData()
|
|
605
708
|
const headerLabel = () =>
|
|
606
|
-
!
|
|
709
|
+
!canCollapse()
|
|
607
710
|
? props.header.badge
|
|
608
711
|
: `${props.collapsed ? '\u25b6' : '\u25bc'} ${props.header.badge}`
|
|
609
712
|
// Missing semantic colors inherit normal text; an unset palette uses terminal defaults.
|
|
@@ -623,6 +726,21 @@ export function SidebarFrame(props: SidebarFrameProps) {
|
|
|
623
726
|
// Inverting an incomplete badge palette can put light text on a light background.
|
|
624
727
|
const invertBadge = () =>
|
|
625
728
|
props.theme?.accent !== undefined && props.theme?.background !== undefined
|
|
729
|
+
function HeaderBadge() {
|
|
730
|
+
return (
|
|
731
|
+
<box
|
|
732
|
+
paddingLeft={1}
|
|
733
|
+
paddingRight={1}
|
|
734
|
+
backgroundColor={invertBadge() ? props.theme?.accent : undefined}
|
|
735
|
+
>
|
|
736
|
+
<text
|
|
737
|
+
fg={invertBadge() ? props.theme?.background : context.theme.accent}
|
|
738
|
+
>
|
|
739
|
+
<b>{headerLabel()}</b>
|
|
740
|
+
</text>
|
|
741
|
+
</box>
|
|
742
|
+
)
|
|
743
|
+
}
|
|
626
744
|
return (
|
|
627
745
|
<FrameContext.Provider value={context}>
|
|
628
746
|
<box width='100%' flexDirection='column'>
|
|
@@ -634,33 +752,26 @@ export function SidebarFrame(props: SidebarFrameProps) {
|
|
|
634
752
|
justifyContent='space-between'
|
|
635
753
|
alignItems='center'
|
|
636
754
|
onMouseDown={() => {
|
|
637
|
-
if (
|
|
755
|
+
if (canCollapse()) props.onToggle()
|
|
638
756
|
}}
|
|
639
757
|
>
|
|
640
|
-
<
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
fg={
|
|
647
|
-
invertBadge() ? props.theme?.background : context.theme.accent
|
|
648
|
-
}
|
|
649
|
-
>
|
|
650
|
-
<b>{headerLabel()}</b>
|
|
651
|
-
</text>
|
|
652
|
-
</box>
|
|
758
|
+
<Show when={props.header.afterBadge} fallback={<HeaderBadge />}>
|
|
759
|
+
<box flexDirection='row' alignItems='center'>
|
|
760
|
+
<HeaderBadge />
|
|
761
|
+
{props.header.afterBadge?.()}
|
|
762
|
+
</box>
|
|
763
|
+
</Show>
|
|
653
764
|
<Show when={props.header.version}>
|
|
654
765
|
<text fg={context.theme.textMuted}>{props.header.version}</text>
|
|
655
766
|
</Show>
|
|
656
767
|
</box>
|
|
657
|
-
<Show when={props.collapsed &&
|
|
768
|
+
<Show when={props.collapsed && canCollapse()}>
|
|
658
769
|
<For each={props.accounts}>
|
|
659
770
|
{(account) => <CollapsedAccountRow account={account} />}
|
|
660
771
|
</For>
|
|
661
772
|
{props.collapsedSections?.()}
|
|
662
773
|
</Show>
|
|
663
|
-
<Show when={!props.collapsed || !
|
|
774
|
+
<Show when={!props.collapsed || !canCollapse()}>
|
|
664
775
|
<Show when={props.showQuota && hasData()}>
|
|
665
776
|
<SidebarSection title='Quota'>
|
|
666
777
|
<For each={props.accounts}>
|
|
@@ -85,7 +85,9 @@ export class PrivateFileError extends Error {
|
|
|
85
85
|
constructor(path, stage, cause) {
|
|
86
86
|
const detail = cause;
|
|
87
87
|
super(detail?.code === 'ERR_PRIVATE_FILES_UNAVAILABLE'
|
|
88
|
-
?
|
|
88
|
+
? // The reason stays on `.reason`: its word "unavailable" would make
|
|
89
|
+
// OpenCode 1 retry a plain error carrying this message.
|
|
90
|
+
`Private file refused at ${stage}: ${path}. The Windows native addon of @cortexkit/private-files could not be loaded, so owner-only access cannot be enforced and nothing was read or written. Reinstall the plugin so the private-files Windows prebuild for this architecture is present; Windows has no safe fallback to permission bits.`
|
|
89
91
|
: `Private file refused at ${stage}: ${path} (${detail?.reason ?? detail?.code ?? 'io-error'}). Keep this file in a folder that only you, the system or administrators can change, such as a folder in your home directory. If other users could read the file before, sign in again to replace the credentials it held. On Windows the file must also be on a local drive that keeps Windows file permissions, such as NTFS.`, { cause });
|
|
90
92
|
this.path = path;
|
|
91
93
|
this.stage = stage;
|