@cortexkit/opencode-anthropic-auth 1.9.2 → 1.9.4
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 +2 -1
- package/dist/cli.js +1 -1
- package/dist/index-9yjbmhf1.js +2 -0
- package/dist/index-agh52sak.js +2 -0
- package/dist/index-fvzta6xw.js +410 -0
- package/dist/index.js +8 -8
- package/dist/sidebar-state.d.ts +9 -0
- package/dist/sidebar-state.js +1 -1
- package/dist/tui-preferences.d.ts +41 -0
- package/dist/tui-preferences.js +6 -0
- package/package.json +11 -5
- package/src/sidebar-state.ts +54 -0
- package/src/tui-preferences.ts +331 -0
- package/src/tui.tsx +300 -78
- package/dist/index-99mvcpj7.js +0 -2
- package/dist/index-hjkkewsy.js +0 -409
package/README.md
CHANGED
|
@@ -492,8 +492,9 @@ ls "$(node -p 'require("node:os").tmpdir()')/opencode-anthropic-auth-dumps"
|
|
|
492
492
|
Each filename includes a sanitized session/affinity segment so dumps from different sessions are easier to find. Each request gets:
|
|
493
493
|
|
|
494
494
|
- `*.body.json` — final rewritten Anthropic request body.
|
|
495
|
-
- `*.relay.json` — redacted relay payload/frame metadata.
|
|
496
495
|
- `*.meta.json` — hashes, byte counts, diff ranges, model, `messages[0]` hash, later-message hash, and cache-relevant structure.
|
|
496
|
+
- `*.relay.json` — redacted relay payload/frame metadata for relay requests.
|
|
497
|
+
- `*.request.json` — redacted direct request URL, method, and headers for direct requests.
|
|
497
498
|
|
|
498
499
|
Dump state is persisted in the active sidecar config as `dump.enabled` (`~/.config/opencode/anthropic-auth.json` for OpenCode, `~/.pi/agent/anthropic-auth.json` for Pi). Dumps may contain prompt content and should be treated as sensitive local debugging artifacts.
|
|
499
500
|
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{Oa as I,Qa as $,m as w,n as k,p as A,r as R,t as d,u as l,v as p}from"./index-fvzta6xw.js";import"./index-agh52sak.js";import{stdin as E,stdout as U}from"node:process";import{createInterface as _}from"node:readline/promises";function g(){return{version:1,main:{type:"opencode",provider:"anthropic"},fallbackOn:[401,403,429],refresh:{enabled:!0,intervalMinutes:10,refreshBeforeExpiryMinutes:240},quota:{enabled:!0,checkIntervalMinutes:5,minimumRemaining:{five_hour:10,seven_day:20},failClosedOnUnknownQuota:!0},accounts:[]}}function y(){console.log(`Usage:
|
|
3
3
|
opencode-anthropic-auth login [label]
|
|
4
4
|
opencode-anthropic-auth api add [label]
|
|
5
5
|
opencode-anthropic-auth list
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{mkdir as R,readFile as g,writeFile as q}from"node:fs/promises";import{tmpdir as C}from"node:os";import{dirname as y,join as V}from"node:path";var H="OPENCODE_ANTHROPIC_AUTH_SIDEBAR_STATE_FILE",k=V(C(),"opencode-anthropic-auth"),O=V(k,"sidebar-state.json");function h(){return process.env[H]||O}var b={main:{quota:null},fallbacks:[],activeId:void 0,route:"main",relay:null,fastMode:!1,lastUpdated:0};async function I(){try{let z=await g(h(),"utf8");return JSON.parse(z)}catch{return b}}async function S(z){try{let x=h();await R(y(x),{recursive:!0}),await q(x,JSON.stringify(z),"utf8")}catch{}}function D(z){let x=z.activeId;if(x&&x!=="main"){let J=z.fallbacks.find((K)=>K.enabled&&K.id===x);if(J)return{id:J.id,name:J.label??J.id,quota:J.quota}}return{id:"main",name:"main",quota:z.main.quota}}function F(z){let x=z?.five_hour?.usedPercent??null,J=z?.seven_day?.usedPercent??null;if(x==null&&J==null)return{fiveHourUsedPercent:x,sevenDayUsedPercent:J,text:null};return{fiveHourUsedPercent:x,sevenDayUsedPercent:J,text:`5h: ${x==null?"—":`${Math.round(x)}%`} 7d: ${J==null?"—":`${Math.round(J)}%`}`}}var U=18000000,v=604800000,N=300000,L=0.01,m=1;function T(z,x,J){if(!z.resetsAt)return null;let K=new Date(z.resetsAt).getTime();if(!Number.isFinite(K))return null;let Y=K-x,Q=J-Y;if(Q<N)return null;if(Q<x*L)return null;if(Q>=x)return null;let W=z.usedPercent,Z=Math.min(Math.max(Q/x*100,0),100),X=W-Z,j=Math.abs(X)<m?"on-pace":X>0?"deficit":"reserve",$=null;if(W>0){let G=Q*100/W,B=Y+G;if(B<K)$=new Date(B).toISOString()}return{pacePercent:Z,deltaPercent:X,state:j,runsOutAt:$}}
|
|
2
|
+
export{h as Wa,b as Xa,I as Ya,S as Za,D as _a,F as $a,U as ab,v as bb,T as cb};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as q}from"node:module";var j=Object.create;var{getPrototypeOf:k,defineProperty:i,getOwnPropertyNames:l}=Object;var m=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,r=(a,b,d)=>{var f=a!=null&&typeof a==="object";if(f){var g=b?o??=new WeakMap:p??=new WeakMap,h=g.get(a);if(h)return h}d=a!=null?j(k(a)):{};let c=b||!a||!a.__esModule?i(d,"default",{value:a,enumerable:!0}):d;for(let e of l(a))if(!m.call(c,e))i(c,e,{get:n.bind(a,e),enumerable:!0});if(f)g.set(a,c);return c};var s=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var u=q(import.meta.url);
|
|
2
|
+
export{r as db,s as eb,u as fb};
|