@cortexkit/opencode-anthropic-auth 2.0.3 → 2.1.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.
- package/README.md +1 -1
- package/dist/cli-failure.d.ts +32 -2
- package/dist/cli.js +46 -52
- package/dist/fable-fallback.d.ts +6 -2
- package/dist/{index-kd89hcr3.js → index-0kxy8k2c.js} +1 -1
- package/dist/index-1nwcnxp8.js +42 -0
- package/dist/index-53nnxq39.js +2 -0
- package/dist/{index-2arfb1y3.js → index-6chd6jnr.js} +1 -1
- package/dist/{index-5hyennzm.js → index-ah5s0bew.js} +1 -1
- package/dist/{index-jmjevtm1.js → index-b1dvkp15.js} +1 -1
- package/dist/{index-rftced5v.js → index-f2ne65w4.js} +1 -1
- package/dist/{index-rqync0pc.js → index-hazrk5c3.js} +1 -1
- package/dist/{index-1jkyhgyr.js → index-jexctf5w.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/request-class.d.ts +10 -0
- 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/setup/native-activation.d.ts +7 -2
- package/dist/setup/native-enrollment.d.ts +6 -0
- package/dist/setup/native-login.d.ts +12 -1
- package/dist/sidebar-state.js +1 -1
- package/dist/transform.d.ts +2 -8
- package/dist/tui-preferences.js +1 -1
- package/dist/v2/adapter.d.ts +6 -1
- package/dist/v2/server.js +4 -4
- package/dist/v2/tui.js +1 -1
- package/package.json +10 -6
- package/src/sidebar-state.ts +10 -71
- package/src/tui-compiled/sidebar-state.ts +10 -71
- package/src/tui-compiled/tui.tsx +119 -89
- package/src/tui.tsx +58 -18
- package/dist/index-fncp6r0j.js +0 -3
- package/dist/index-mdpyfkv3.js +0 -464
- package/dist/index-nfcp0m1t.js +0 -42
- package/dist/index-qttfa42y.js +0 -2
- package/dist/index-vjehtqnb.js +0 -1
package/src/tui.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { readFileSync } from 'node:fs'
|
|
|
4
4
|
import { dirname, join } from 'node:path'
|
|
5
5
|
import { fileURLToPath } from 'node:url'
|
|
6
6
|
import {
|
|
7
|
+
formatCreditAmounts,
|
|
7
8
|
type QuotaWindowPart,
|
|
8
9
|
quotaDisplayProjection,
|
|
9
10
|
quotaWindowParts,
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
createEffect,
|
|
19
20
|
createSignal,
|
|
20
21
|
For,
|
|
22
|
+
Index,
|
|
21
23
|
type JSX,
|
|
22
24
|
onCleanup,
|
|
23
25
|
Show,
|
|
@@ -369,6 +371,22 @@ function QuotaRow(props: {
|
|
|
369
371
|
)
|
|
370
372
|
}
|
|
371
373
|
|
|
374
|
+
// The shared credit figure followed by the spent and limit amounts:
|
|
375
|
+
// `credits 75% left · $25.00/$100.00`. When that line is wider than the
|
|
376
|
+
// measured width, the amounts drop their cents (`$1,250/$5,000`) instead of
|
|
377
|
+
// wrapping onto a second line.
|
|
378
|
+
function creditLine(
|
|
379
|
+
figure: string,
|
|
380
|
+
extraUsage: AccountQuota['extraUsage'],
|
|
381
|
+
width: number | undefined,
|
|
382
|
+
) {
|
|
383
|
+
const amounts = formatCreditAmounts(extraUsage)
|
|
384
|
+
if (!amounts) return figure
|
|
385
|
+
const line = `${figure} · ${amounts}`
|
|
386
|
+
if (width === undefined || Bun.stringWidth(line) <= width) return line
|
|
387
|
+
return `${figure} · ${formatCreditAmounts(extraUsage, { wholeUnits: true })}`
|
|
388
|
+
}
|
|
389
|
+
|
|
372
390
|
// Account block: header row (name + status word) then per-window quota rows.
|
|
373
391
|
// Pacing is computed here — per window, against the wall clock at render time
|
|
374
392
|
// (re-evaluated on every state poll) — and disabled by passing false.
|
|
@@ -466,21 +484,40 @@ function AccountBlock(props: {
|
|
|
466
484
|
)}
|
|
467
485
|
</For>
|
|
468
486
|
<Show when={partFor('credits')}>
|
|
469
|
-
{(budget: () => QuotaWindowPart) =>
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
487
|
+
{(budget: () => QuotaWindowPart) => {
|
|
488
|
+
// The line box's laid-out width, read when it mounts and on each
|
|
489
|
+
// resize. It is undefined (amounts keep their cents) until layout.
|
|
490
|
+
const [width, setWidth] = createSignal<number>()
|
|
491
|
+
let line: BoxRenderable | undefined
|
|
492
|
+
return (
|
|
493
|
+
<box
|
|
494
|
+
width='100%'
|
|
495
|
+
ref={(element: BoxRenderable) => {
|
|
496
|
+
line = element
|
|
497
|
+
setWidth(element.width || undefined)
|
|
498
|
+
}}
|
|
499
|
+
onSizeChange={() => setWidth(line?.width || undefined)}
|
|
500
|
+
>
|
|
501
|
+
<text
|
|
502
|
+
fg={toneColor(
|
|
503
|
+
props.theme,
|
|
504
|
+
props.quota?.extraUsage?.severity === 'critical'
|
|
505
|
+
? 'err'
|
|
506
|
+
: props.quota?.extraUsage?.severity === 'warning' ||
|
|
507
|
+
props.quota?.extraUsage?.exhausted
|
|
508
|
+
? 'warn'
|
|
509
|
+
: 'muted',
|
|
510
|
+
)}
|
|
511
|
+
>
|
|
512
|
+
{creditLine(
|
|
513
|
+
budget().figure,
|
|
514
|
+
props.quota?.extraUsage,
|
|
515
|
+
width(),
|
|
516
|
+
)}
|
|
517
|
+
</text>
|
|
518
|
+
</box>
|
|
519
|
+
)
|
|
520
|
+
}}
|
|
484
521
|
</Show>
|
|
485
522
|
<Show when={parts().age}>
|
|
486
523
|
<text fg={props.theme.textMuted}>{parts().age}</text>
|
|
@@ -819,7 +856,10 @@ function QuotaSidebar(props: {
|
|
|
819
856
|
|
|
820
857
|
{/* Collapsed accounts keep placement order; only a fresh active row is emphasized. */}
|
|
821
858
|
<Show when={collapsed() && hasData()}>
|
|
822
|
-
|
|
859
|
+
{/* Index keys rows by position: each state update builds new account
|
|
860
|
+
objects, so For would rebuild every row and its measured width.
|
|
861
|
+
Passing the accessor's value as a prop keeps the row reactive. */}
|
|
862
|
+
<Index
|
|
823
863
|
each={getCollapsedAccounts(
|
|
824
864
|
state(),
|
|
825
865
|
prefs().sections.fallbackAccounts,
|
|
@@ -828,11 +868,11 @@ function QuotaSidebar(props: {
|
|
|
828
868
|
{(account) => (
|
|
829
869
|
<CollapsedAccountRow
|
|
830
870
|
theme={theme()}
|
|
831
|
-
account={account}
|
|
871
|
+
account={account()}
|
|
832
872
|
tone={activeQuotaTone()}
|
|
833
873
|
/>
|
|
834
874
|
)}
|
|
835
|
-
</
|
|
875
|
+
</Index>
|
|
836
876
|
<Show when={state().fastMode}>
|
|
837
877
|
<CollapsedRow theme={theme()} label='Mode'>
|
|
838
878
|
<text fg={toneColor(theme(), 'accent')}>
|
package/dist/index-fncp6r0j.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{constants as X}from"node:fs";import{chmod as y,lstat as G,mkdir as v,open as N}from"node:fs/promises";import{createRequire as j}from"node:module";class H extends Error{code="ERR_PRIVATE_FILES_UNAVAILABLE"}function x(_,T){if(_!=="x64"&&_!=="arm64")throw new H(`Windows private files do not support ${_}; use x64 or ARM64 Node 24. No mode-only fallback is safe.`);if(_==="arm64"&&T&&!F(T))throw new H("Windows ARM64 requires Bun >= 1.3.10 with native ARM64 support; use ARM64 Node 24 or upgrade Bun. No mode-only fallback is safe.");return`private-files-win32-${_}.node`}function F(_){let T=/^(\d+)\.(\d+)\.(\d+)$/.exec(_);if(!T)return!1;let L=Number(T[1]),A=Number(T[2]),S=Number(T[3]);return L>1||L===1&&(A>3||A===3&&S>=10)}var z;function M(){if(z)return z;let _=x(process.arch,process.versions.bun);try{if(z=j(import.meta.url)(`../prebuilds/${_}`),!z||["create","read","verify","secure","verifySafeParent"].some((T)=>typeof z?.[T]!=="function"))throw Error("Invalid private-files N-API interface");return z}catch(T){throw new H(`Cannot load ${_}. Install @cortexkit/private-files with the matching Windows N-API v8 prebuild, or rebuild private-files/native with MSVC. Use local NTFS. No mode-only fallback is safe. Cause: ${String(T)}`)}}import*as O from"node:fs";import*as W from"node:fs/promises";import{posix as Q}from"node:path";function*P(_){return yield{kind:"realpath",path:_}}function*J(_,T){return yield{kind:_,path:T}}function*g(_){return yield{kind:"readFile",path:_}}function C(_,T){return{ok:!1,reason:T,path:_}}function $(_){return _?.code==="ENOENT"}function*f(_,T){if(!_||_.includes("\x00"))throw Error("invalid path");let L=T.isAbsolute(_)?_:`${process.cwd()}${T.sep}${_}`,A=[];for(;;)try{let S=yield*P(L);if(A.length&&!(yield*J("stat",S)).isDirectory())throw Error("nearest existing ancestor is not a directory");return{resolved:T.join(S,...A),existing:S,missing:A.length>0}}catch(S){if(!$(S))throw S;try{yield*J("lstat",L)}catch(R){if(!$(R))throw R;let E=T.dirname(L);if(E===L)throw S;A.unshift(T.basename(L)),L=E;continue}throw S}}function b(_,T){let L=new TextDecoder("utf-8",{fatal:!0}).decode(_),A=(S)=>S!==void 0&&/^\d+$/.test(S)&&Number.isSafeInteger(Number(S))&&Number(S)<=4294967295;return L.split(`
|
|
2
|
-
`).filter((S)=>S.trim()!==""&&!S.trimStart().startsWith("#")).map((S)=>{let R=S.split(":");if(R.length!==T||!R[0]||/\s/.test(R[0])||!A(R[2])||T===7&&!A(R[3]))throw Error("malformed account record");if(T===4&&R[3]!==""&&R[3].split(",").some((E)=>!E||/\s/.test(E)))throw Error("malformed group members");return R})}function*k(_,T){let L=[];for(let[D,K]of[["/etc/passwd",7],["/etc/group",4]]){let I;try{I=yield*g(D)}catch{return`could not read ${D} to establish a user-private group`}try{L.push(b(I,K))}catch{return`could not parse ${D} to establish a user-private group`}}let[A,S]=L,R=A.filter((D)=>Number(D[2])===_),E=S.filter((D)=>Number(D[2])===T);if(R.length!==1||E.length!==1)return"group-writable ancestor (effective user or group is absent or ambiguous in account files)";let Y=R[0][0];if(E[0][3]!==""&&E[0][3].split(",").some((D)=>D!==Y))return"group-writable ancestor (other group members)";if(A.some((D)=>Number(D[2])!==_&&Number(D[3])===T))return"group-writable ancestor (another user's primary group)";return}function*m(_,T,L,A=!1){if(T==null)return C(_,"could not determine effective uid");let S;try{let D=yield*f(_,Q);if(A&&(D.missing||!(yield*J("stat",D.existing)).isDirectory()))return C(_,"ancestor is not a directory");S=D.missing||(yield*J("stat",D.existing)).isDirectory()?D.existing:Q.dirname(D.existing)}catch{return C(_,"could not resolve target or its nearest existing ancestor")}let R,E,Y=!1;for(;;){let D;try{D=[yield*J("lstat",S),yield*J("stat",S)]}catch{return C(S,"could not inspect ancestor")}for(let I of D){if(!I.isDirectory())return C(S,"ancestor is not a directory");if(I.uid!==T&&I.uid!==0)return C(S,"foreign owner");if((I.mode&18)===0)continue;if(I.uid===0&&(I.mode&512)!==0){if(R?.every((Z)=>Z.uid===T&&(Z.mode&18)===0))continue;return C(S,"sticky ancestor without an owner-only child")}if((I.mode&2)!==0)return C(S,"world-writable ancestor");if((I.mode&512)!==0||I.uid!==T||L==null||I.gid!==L)return C(S,"group-writable ancestor (not a non-sticky user-private group)");if(!Y)E=yield*k(T,L),Y=!0;if(E)return C(S,E)}let K=Q.dirname(S);if(K===S)return{ok:!0};R=D,S=K}}function q(_,T){return m(_,T.euid===void 0?process.geteuid?.():T.euid,T.egid===void 0?process.getegid?.():T.egid,T.directoryOnly)}function w(_,T={}){let L={realpathSync:O.realpathSync.native,lstatSync:O.lstatSync,statSync:O.statSync,readFileSync:O.readFileSync,...T.fs},A=q(_,T),S=A.next();while(!S.done){let{kind:R,path:E}=S.value,Y;try{switch(R){case"realpath":Y=L.realpathSync(E);break;case"lstat":Y=L.lstatSync(E);break;case"stat":Y=L.statSync(E);break;case"readFile":Y=L.readFileSync(E);break}}catch(D){S=A.throw(D);continue}S=A.next(Y)}return S.value}async function B(_,T={}){let L={realpath:W.realpath,lstat:W.lstat,stat:W.stat,readFile:W.readFile,...T.fs},A=q(_,T),S=A.next();while(!S.done){let{kind:R,path:E}=S.value,Y;try{Y=await L[R](E)}catch(D){S=A.throw(D);continue}S=A.next(Y)}return S.value}function U(_,T){let L=_.aces?.[0];return(_.owner===_.currentUser||_.owner==="S-1-5-32-544"||_.owner==="S-1-5-18")&&_.kind===T&&!_.reparse&&_.daclPresent&&(_.daclProtected&&L?.flags===(T==="directory"?3:0)||T==="file"&&!_.daclProtected&&L?.flags===16&&!!_.parent&&_.parent.currentUser===_.currentUser&&U(_.parent,"directory"))&&_.aces?.length===1&&L?.type===0&&L.mask===2032127&&L.sid===_.currentUser}var n="wrong-owner",r="extra-ace",i="not-protected",a="null-dacl",t="empty-dacl",e="reparse-point",__="unsupported-filesystem",T_="mode",L_="writable-by-others";function V(_,T){if(T.ok)return T;return{ok:!1,reason:/writable|sticky|user-private group/.test(T.reason)?"writable-by-others":T.reason==="foreign owner"?"wrong-owner":T.reason==="ancestor is not a directory"?"wrong-kind":"io-error",path:_,level:T.path}}function Y_(_,T={}){if(process.platform==="win32")return{ok:!1,reason:"unsupported-filesystem",path:_};return V(_,w(_,{...T,directoryOnly:!0}))}async function I_(_,T={}){if(process.platform!=="win32")return V(_,await B(_,{...T,directoryOnly:!0}));try{return await M().verifySafeParent(_),{ok:!0}}catch(L){if(L instanceof H)return{ok:!1,reason:"unsupported-filesystem",path:_};let A=L;if(A.code!=="ERR_PRIVATE_FILES_SECURITY")throw L;return{ok:!1,reason:A.reason??"io-error",path:_,...A.level?{level:A.level}:{},...A.sid||A.ownerSid?{sid:A.sid??A.ownerSid}:{},...A.mask!==void 0?{mask:A.mask}:{}}}}async function c(_,T=""){if(process.platform==="win32")return M().create(_,"file",typeof T==="string"?Buffer.from(T):T);let L=await N(_,"wx",384);try{await L.writeFile(T)}finally{await L.close()}}async function l(_){if(process.platform==="win32")return M().create(_,"directory",Buffer.alloc(0));await v(_,{mode:448})}async function C_(_,T){if(process.platform==="win32")return M().verify(_,T);let L=await G(_);if((T==="file"?!L.isFile():!L.isDirectory())||(L.mode&511)!==(T==="file"?384:448)||L.uid!==process.getuid?.())throw Error(`Private ${T} requires current-user ownership and ${T==="file"?"0600":"0700"}: ${_}`)}async function h(_){if(process.platform==="win32")return M().read(_);let T=await N(_,X.O_RDONLY|X.O_NOFOLLOW|X.O_NONBLOCK);try{let L=await T.stat();if(!L.isFile()||(L.mode&511)!==384||L.uid!==process.getuid?.())throw Error(`Private file requires current-user ownership and 0600: ${_}`);return await T.readFile()}finally{await T.close()}}async function H_(_,T){if(process.platform==="win32")return M().secure(_,T);await y(_,T==="file"?384:448)}async function M_(_,T){if(T.kind==="dir")return l(_);return c(_)}async function O_(_){if(process.platform!=="win32"){let T=await G(_),L=T.isDirectory()?448:384;if(!T.isFile()&&!T.isDirectory())return{ok:!1,refusal:{reason:"wrong-kind",message:"Expected a regular file or directory"}};if(T.uid!==process.getuid?.())return{ok:!1,refusal:{reason:"wrong-owner",ownerSid:`uid:${T.uid}`}};let A=T.mode&511;return A===L?{ok:!0}:{ok:!1,refusal:{reason:"mode",actual:A,expected:L}}}try{return await M().verify(_,"auto"),{ok:!0}}catch(T){if(T instanceof H)return{ok:!1,refusal:{reason:"unsupported-filesystem",message:T.message}};let L=T;if(L.code!=="ERR_PRIVATE_FILES_SECURITY")throw T;if(L.reason==="wrong-owner")return{ok:!1,refusal:{reason:"wrong-owner",ownerSid:L.ownerSid??"unknown"}};if(L.reason==="extra-ace")return{ok:!1,refusal:{reason:"extra-ace",sid:L.sid??"unknown",mask:L.mask??0}};return{ok:!1,refusal:{reason:L.reason&&L.reason!=="mode"?L.reason:"io-error",message:L.message}}}}var W_=h;
|
|
3
|
-
export{H as Qe,w as Re,B as Se,U as Te,n as Ue,r as Ve,i as We,a as Xe,t as Ye,e as Ze,__ as _e,T_ as $e,L_ as af,Y_ as bf,I_ as cf,c as df,l as ef,C_ as ff,h as gf,H_ as hf,M_ as if,O_ as jf,W_ as kf};
|