@cortexkit/opencode-anthropic-auth 1.13.0 → 1.15.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 -0
- package/dist/cli.js +1 -1
- package/dist/fable-fallback.d.ts +34 -0
- package/dist/{index-se4sd5kz.js → index-6gdd6e4s.js} +1 -1
- package/dist/index-bxs26mw4.js +2 -0
- package/dist/{index-ha0gz07d.js → index-jkbar3k3.js} +1 -1
- package/dist/{index-97vmbv5w.js → index-qejbx8c9.js} +1 -1
- package/dist/{index-1gc9eney.js → index-qsaph2g4.js} +1 -1
- package/dist/index-z03wayzs.js +417 -0
- package/dist/index.js +21 -12
- package/dist/{logger-sg9wxpvj.js → logger-vxnb5hjr.js} +1 -1
- package/dist/rpc/port-file.js +1 -1
- package/dist/rpc/rpc-client.js +1 -1
- package/dist/rpc/rpc-dir.js +1 -1
- package/dist/sidebar-state.d.ts +8 -0
- package/dist/sidebar-state.js +1 -1
- package/dist/transform.d.ts +16 -0
- package/dist/tui-preferences.js +1 -1
- package/package.json +3 -3
- package/src/sidebar-state.ts +65 -9
- package/src/tui.tsx +38 -2
- package/dist/index-9053h96k.js +0 -417
- package/dist/index-bk5avdcz.js +0 -2
package/dist/index-bk5avdcz.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{mkdir as q,readFile as M,writeFile as b}from"node:fs/promises";import{tmpdir as L}from"node:os";import{dirname as k,join as H}from"node:path";var R="OPENCODE_ANTHROPIC_AUTH_SIDEBAR_STATE_FILE",f=H(L(),"opencode-anthropic-auth"),I=H(f,"sidebar-state.json");function N(){return process.env[R]||I}var K={main:{quota:null},fallbacks:[],activeId:void 0,route:"main",relay:null,fastMode:!1,lastUpdated:0};function V(J){return J!==null&&typeof J==="object"&&!Array.isArray(J)}function g(J){if(!V(J))return;let X=Number(J.usedPercent),Y=Number(J.remainingPercent);if(!Number.isFinite(X)||!Number.isFinite(Y))return;return{usedPercent:X,remainingPercent:Y,resetsAt:typeof J.resetsAt==="string"?J.resetsAt:void 0}}function Q(J){if(!V(J))return null;let X={},Y=g(J.five_hour),Z=g(J.seven_day);if(Y)X.five_hour=Y;if(Z)X.seven_day=Z;if(Array.isArray(J.scoped)){let $=J.scoped.map((x)=>{if(!V(x))return;let j=g(x);if(!j)return;if(typeof x.id!=="string"||!x.id.trim())return;if(typeof x.title!=="string"||!x.title.trim())return;if(typeof x.modelName!=="string"||!x.modelName.trim())return;let G=typeof x.modelId==="string"&&x.modelId.trim()?x.modelId.trim():void 0;return{...j,id:x.id.trim(),title:x.title.trim(),...G&&{modelId:G},modelName:x.modelName.trim()}}).filter((x)=>x!=null);if($.length)X.scoped=$}return Object.keys(X).length?X:null}function F(J){if(!V(J))return{...K};let X={quota:null};if(V(J.main)){let x=J.main;if(X.quota=Q(x.quota),typeof x.quotaBackedOff==="boolean")X.quotaBackedOff=x.quotaBackedOff;if(typeof x.quotaBackoffUntil==="number")X.quotaBackoffUntil=x.quotaBackoffUntil;if(typeof x.refreshBackedOff==="boolean")X.refreshBackedOff=x.refreshBackedOff;if(typeof x.refreshBackoffUntil==="number")X.refreshBackoffUntil=x.refreshBackoffUntil}let Y=Array.isArray(J.fallbacks)?J.fallbacks.filter(V).filter((x)=>typeof x.id==="string").map((x)=>({id:x.id,label:typeof x.label==="string"?x.label:void 0,quota:Q(x.quota),enabled:typeof x.enabled==="boolean"?x.enabled:!1,needsReauth:typeof x.needsReauth==="boolean"?x.needsReauth:!1})):[],Z=null;if(V(J.relay)){let x=J.relay;if(typeof x.enabled==="boolean"&&typeof x.transport==="string")Z={enabled:x.enabled,transport:x.transport}}let $;if(V(J.cacheKeep)){let x=J.cacheKeep;if(typeof x.enabled==="boolean")$={enabled:x.enabled,window:typeof x.window==="string"?x.window:void 0,trackedSessions:typeof x.trackedSessions==="number"?x.trackedSessions:void 0}}return{main:X,fallbacks:Y,activeId:typeof J.activeId==="string"?J.activeId:void 0,route:typeof J.route==="string"?J.route:K.route,relay:Z,fastMode:typeof J.fastMode==="boolean"?J.fastMode:K.fastMode,cacheKeep:$,lastUpdated:typeof J.lastUpdated==="number"?J.lastUpdated:0}}var W=Promise.resolve();async function P(){try{let J=await M(N(),"utf8");return F(JSON.parse(J))}catch{return K}}async function A(J,X=N()){return W=W.then(async()=>{await q(k(X),{recursive:!0}),await b(X,JSON.stringify(J),"utf8")}).catch(()=>{}),W}async function m(){return W}function v(J){let X=J.activeId;if(X&&X!=="main"){let Y=J.fallbacks?.find((Z)=>Z.enabled&&Z.id===X);if(Y)return{id:Y.id,name:Y.label??Y.id,quota:Y.quota}}return{id:"main",name:"main",quota:J.main?.quota??null}}function U(J){let X=J.replace(/\s+only$/i,"").trim();return/^fable$/i.test(X)?"Fa":X}function y(J){let X=J?.five_hour?.usedPercent??null,Y=J?.seven_day?.usedPercent??null,Z=J?.scoped??[],$=Z.map((x)=>x.usedPercent);if(X==null&&Y==null&&Z.length===0)return{fiveHourUsedPercent:X,sevenDayUsedPercent:Y,scopedUsedPercents:$,text:null};return{fiveHourUsedPercent:X,sevenDayUsedPercent:Y,scopedUsedPercents:$,text:[`5h: ${X==null?"—":`${Math.round(X)}%`}`,`7d: ${Y==null?"—":`${Math.round(Y)}%`}`,...Z.map((x)=>`${U(x.title)}: ${Math.round(x.usedPercent)}%`)].join(" ")}}var u=18000000,c=604800000,D=300000,S=0.01,p=1;function l(J,X,Y){if(!J.resetsAt)return null;let Z=new Date(J.resetsAt).getTime();if(!Number.isFinite(Z))return null;let $=Z-X,x=Y-$;if(x<D)return null;if(x<X*S)return null;if(x>=X)return null;let j=J.usedPercent,G=Math.min(Math.max(x/X*100,0),100),B=j-G,h=Math.abs(B)<p?"on-pace":B>0?"deficit":"reserve",z=null;if(j>0){let C=x*100/j,O=$+C;if(O<Z)z=new Date(O).toISOString()}return{pacePercent:G,deltaPercent:B,state:h,runsOutAt:z}}
|
|
2
|
-
export{N as Db,K as Eb,F as Fb,P as Gb,A as Hb,m as Ib,v as Jb,U as Kb,y as Lb,u as Mb,c as Nb,l as Ob};
|