@cortexkit/opencode-openai-auth 1.3.0 → 1.4.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 (85) hide show
  1. package/dist/bin.js +8 -8
  2. package/dist/{codex-request-B9D0e97Q.d.ts → codex-request-hw0XcldE.d.ts} +27 -27
  3. package/dist/index-1eq2s1cp.js +2 -0
  4. package/dist/{index-m3ctrabv.js → index-1tdnrt68.js} +1 -1
  5. package/dist/{index-8x1aj7q3.js → index-5230x6s8.js} +2 -2
  6. package/dist/{index-gn2b097f.js → index-ag04nyv7.js} +7 -7
  7. package/dist/index-brbqqer5.js +90 -0
  8. package/dist/{index-xwvze96g.js → index-d98f1xdp.js} +1 -1
  9. package/dist/index-jcyrm58f.js +65 -0
  10. package/dist/{index-2pgkrebq.js → index-rsvnabbe.js} +2 -2
  11. package/dist/{index-ftkhhr6d.js → index-s88n2bjn.js} +1 -1
  12. package/dist/{index-bc89akak.js → index-t5m0dhmq.js} +1 -1
  13. package/dist/index-vy729a0b.js +69 -0
  14. package/dist/index-wgwze391.js +2 -0
  15. package/dist/{index-tddr876f.js → index-yhw3hnsh.js} +2 -2
  16. package/dist/index.d.ts +11 -3
  17. package/dist/index.js +1 -1
  18. package/dist/{model-BdITTmeb.d.ts → model-DphbMQce.d.ts} +1 -1
  19. package/dist/{port-file-DbHIVC9a.d.ts → port-file-Cx-wwe5Q.d.ts} +1 -1
  20. package/dist/{protocol-MysYPAho.d.ts → protocol-CDqdjh74.d.ts} +1 -1
  21. package/dist/rpc/port-file.d.ts +1 -1
  22. package/dist/rpc/port-file.js +1 -1
  23. package/dist/rpc/protocol.d.ts +1 -1
  24. package/dist/rpc/protocol.js +1 -1
  25. package/dist/rpc/rpc-client.d.ts +3 -3
  26. package/dist/rpc/rpc-client.js +1 -1
  27. package/dist/rpc/rpc-dir.js +1 -1
  28. package/dist/{sidebar-state-CVSok7zv.d.ts → sidebar-state-pTd9gg9W.d.ts} +55 -7
  29. package/dist/sidebar-state.d.ts +2 -2
  30. package/dist/sidebar-state.js +1 -1
  31. package/dist/{token-z6qq7a1d.js → token-0z5g59p8.js} +1 -1
  32. package/dist/token-util-jf9g6stk.js +1 -0
  33. package/dist/tui-preferences.js +1 -1
  34. package/dist/tui.d.ts +30 -3
  35. package/dist/v2/server.d.ts +2 -2
  36. package/dist/v2/server.js +2 -2
  37. package/package.json +4 -4
  38. package/src/tui-compiled/raw/shared/0332701351b3eeec-format.js +50 -5
  39. package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +70 -1
  40. package/src/tui-compiled/raw/shared/169b2b4bf30909bc-consumer.js +88 -61
  41. package/src/tui-compiled/raw/shared/2577ec69f9973ae9-quota-normalize.js +45 -1
  42. package/src/tui-compiled/raw/shared/30f5bc480f31f51c-roster.js +100 -43
  43. package/src/tui-compiled/raw/shared/39c3cb05738fcf6d-projection.js +3 -1
  44. package/src/tui-compiled/raw/shared/42ae93ab554fcec2-open-url.js +7 -9
  45. package/src/tui-compiled/raw/shared/4825e03209d6ae3e-with-lock.js +2 -0
  46. package/src/tui-compiled/raw/shared/4f36d333d081d040-merge.js +17 -3
  47. package/src/tui-compiled/raw/shared/81dddd203f1b92a3-quota-writer.js +253 -0
  48. package/src/tui-compiled/raw/shared/905bffc0220f43d0-map.js +31 -6
  49. package/src/tui-compiled/raw/shared/abd062d633e29fd2-pool-routing.js +116 -12
  50. package/src/tui-compiled/raw/shared/bfbdd0f9aae56b47-pool-quota.js +15 -3
  51. package/src/tui-compiled/raw/shared/d0f0b6be200311af-insula.js +64 -2
  52. package/src/tui-compiled/raw/shared/d5a8f1061ee2f114-index.js +2 -2
  53. package/src/tui-compiled/raw/shared/dbc61cd405941828-accounts.js +5 -4
  54. package/src/tui-compiled/raw/shared/dc9290c2a7552ba6-watch.js +2 -1
  55. package/src/tui-compiled/raw/shared/e8d3c8da776ef9cd-index.js +1 -0
  56. package/src/tui-compiled/raw/sidebar-state.js +32 -3
  57. package/src/tui-compiled/raw/tui/v2-dialog.js +2 -1
  58. package/src/tui-compiled/raw/tui.tsx +170 -26
  59. package/src/tui-compiled/runtime/shared/0332701351b3eeec-format.js +50 -5
  60. package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +70 -1
  61. package/src/tui-compiled/runtime/shared/169b2b4bf30909bc-consumer.js +88 -61
  62. package/src/tui-compiled/runtime/shared/2577ec69f9973ae9-quota-normalize.js +45 -1
  63. package/src/tui-compiled/runtime/shared/30f5bc480f31f51c-roster.js +100 -43
  64. package/src/tui-compiled/runtime/shared/39c3cb05738fcf6d-projection.js +3 -1
  65. package/src/tui-compiled/runtime/shared/42ae93ab554fcec2-open-url.js +7 -9
  66. package/src/tui-compiled/runtime/shared/4825e03209d6ae3e-with-lock.js +2 -0
  67. package/src/tui-compiled/runtime/shared/4f36d333d081d040-merge.js +17 -3
  68. package/src/tui-compiled/runtime/shared/81dddd203f1b92a3-quota-writer.js +253 -0
  69. package/src/tui-compiled/runtime/shared/905bffc0220f43d0-map.js +31 -6
  70. package/src/tui-compiled/runtime/shared/abd062d633e29fd2-pool-routing.js +116 -12
  71. package/src/tui-compiled/runtime/shared/bfbdd0f9aae56b47-pool-quota.js +15 -3
  72. package/src/tui-compiled/runtime/shared/d0f0b6be200311af-insula.js +64 -2
  73. package/src/tui-compiled/runtime/shared/d5a8f1061ee2f114-index.js +2 -2
  74. package/src/tui-compiled/runtime/shared/dbc61cd405941828-accounts.js +5 -4
  75. package/src/tui-compiled/runtime/shared/dc9290c2a7552ba6-watch.js +2 -1
  76. package/src/tui-compiled/runtime/shared/e8d3c8da776ef9cd-index.js +1 -0
  77. package/src/tui-compiled/runtime/sidebar-state.js +32 -3
  78. package/src/tui-compiled/runtime/tui/v2-dialog.js +2 -1
  79. package/src/tui-compiled/runtime/tui.js +350 -219
  80. package/dist/index-1mbgsxsr.js +0 -2
  81. package/dist/index-4v2fs42x.js +0 -65
  82. package/dist/index-ex6nx3mq.js +0 -2
  83. package/dist/index-psjyexj3.js +0 -69
  84. package/dist/index-tn8x5tz8.js +0 -90
  85. package/dist/token-util-cf0nyh7n.js +0 -1
@@ -1,4 +1,4 @@
1
- import{Pe as O,Qe as U,Te as b,Ue as m,Ve as L,Ze as y}from"./index-8x1aj7q3.js";import{createHash as Zz,randomUUID as v}from"node:crypto";import{chmod as t,mkdir as r,open as e,readdir as j,rename as zz,rmdir as Gz,stat as Jz,unlink as S}from"node:fs/promises";import{join as R,resolve as D}from"node:path";function l(z){return typeof z==="number"&&Number.isSafeInteger(z)&&z>0}function F(z){if(!l(z))return!1;try{return process.kill(z,0),!0}catch(J){return J.code==="EPERM"}}function Cz(z){return(J)=>Kz(J,z)}function Kz(z,J){if(/^[0-9a-f]{16}$/.test(z))return!0;return z.startsWith(J)&&/^[0-9a-f]{16}$/.test(z.slice(J.length))}function Nz(z){let J=/^port-(\d+)\.json$/.exec(z);return J?Number(J[1]):void 0}function p(z,J){if(z===null||typeof z!=="object"||Array.isArray(z))return!1;let{pid:V,port:Q,token:K}=z;return l(V)&&Nz(J)===V&&typeof Q==="number"&&Number.isInteger(Q)&&Q>=1&&Q<=65535&&typeof K==="string"&&K.length>0}async function h(z,J){J?.debug("rpc corrupt port file",{pid:process.pid,portFile:z}),await S(z).catch(()=>{})}async function Az(z,J,V={}){let Q=async()=>{let K=R(z,`port-${J.pid}.json`);if(O)return await m(z,V.secureDir??!1),await V.beforeWrite?.(),await y(K,JSON.stringify({...J,startedAt:Date.now()}),{stagePath:`${K}.${(V.stageName??v)()}.tmp`}),K;if(await r(z,{recursive:!0,mode:V.secureDir?448:void 0}),V.secureDir)await t(z,448);await V.beforeWrite?.();let W={...J,startedAt:Date.now()},Y=`${K}.${(V.stageName??v)()}.tmp`,N,G=!1;try{N=await e(Y,"wx",384),G=!0,await N.writeFile(JSON.stringify(W),"utf8"),await N.chmod(384),await N.close(),N=void 0,await zz(Y,K),G=!1}finally{if(await N?.close().catch(()=>{}),G)await S(Y).catch(()=>{})}return K};try{return await Q()}catch(K){if(K.code==="ENOENT")return await Q();throw K}}async function Oz(z,J,V,Q){let K;try{K=await j(z,{withFileTypes:!0})}catch(Y){if(Y.code==="ENOENT")return;throw Y}let W=D(J);for(let Y of K){if(!Y.isDirectory()||!V(Y.name))continue;let N=R(z,Y.name),G;try{G=await j(N)}catch(X){if(X.code==="ENOENT")continue;throw X}for(let X of G){if(!X.startsWith("port-")||!X.endsWith(".json"))continue;let $=R(N,X),Z;try{Z=await L($)}catch(H){if(H instanceof U&&H.code!=="ENOENT")throw H;continue}if(Z===void 0)continue;let q;try{q=JSON.parse(Z)}catch{await h($,Q);continue}if(!p(q,X)){await h($,Q);continue}if(!F(q.pid))await S($).catch(()=>{})}if(D(N)!==W)await Gz(N).catch(()=>{})}}async function c(z,J){if(!F(J.pid))return null;let V=R(D(z),`port-${J.pid}.json`);try{if(O)await b(V,"file");let Q=await Jz(V);return`${V}:${Q.dev}:${Q.ino}:${Q.mtimeMs}:${Q.size}`}catch(Q){if(Q instanceof U&&Q.code!=="ENOENT")throw Q;return null}}async function a(z,J,V={}){let Q;try{if(O)await b(z,"directory");Q=await j(z)}catch(G){if(G instanceof U&&G.code!=="ENOENT")throw G;return null}let K=[];for(let G of Q){if(!G.startsWith("port-")||!G.endsWith(".json"))continue;try{let X=JSON.parse(await L(R(z,G)));if(p(X,G))if(F(X.pid))K.push(X);else await S(R(z,G)).catch(()=>{})}catch(X){if(X instanceof U&&X.code!=="ENOENT")throw X}}if(K.length===0)return null;let W=J!==void 0&&J>=1?K.filter((G)=>G.pid===J):[];if(V.exactPid===!0&&W.length===0)return null;let Y=W.length>0?W:K,N=(G)=>typeof G.startedAt==="number"&&Number.isFinite(G.startedAt)?G.startedAt:-1/0;return Y.sort((G,X)=>N(X)-N(G))[0]??null}import{open as Qz}from"node:fs/promises";import{connect as Vz}from"node:net";import{join as Wz,resolve as o}from"node:path";var i=2000,A=new Map,T=new Map;async function Xz(z,J){let V=Wz(o(z),`port-${J.pid}.json`);if(O){let K=JSON.parse(await L(V));if(K.pid!==J.pid||K.port!==J.port||K.token!==J.token)return null;return null}let Q;try{Q=await Qz(V,"r");let K=await Q.stat(),W=JSON.parse(await Q.readFile("utf8"));if(W.pid!==J.pid||W.port!==J.port||W.token!==J.token)return null;return`${V}:${K.dev}:${K.ino}:${K.mtimeMs}:${K.size}`}catch{return null}finally{await Q?.close().catch(()=>{})}}async function s(z,J,V,Q){let K=A.get(z);if(!O&&K&&await c(J,K.entry)===K.identity)return K;A.delete(z);let W=T.get(z);if(W)return W;let Y=(async()=>{let N=await(Q.discover??a)(J,V,Q);if(!N)return null;let G=await Xz(J,N);if(!G)return{entry:N,identity:""};let X={entry:N,identity:G};return A.set(z,X),X})();T.set(z,Y);try{return await Y}finally{if(T.get(z)===Y)T.delete(z)}}async function d(z,J,V,Q=i){return new Promise((K)=>{let W,Y=!1,N=!1,G=($,Z=!1)=>{if(Y)return;Y=!0,clearTimeout(X),W?.destroy(),K({value:$,stale:Z})},X=setTimeout(()=>G(null),Q);try{let $=JSON.stringify(V);W=Vz({host:"127.0.0.1",port:z.port}),W.on("connect",()=>{N=!0,W?.write(`POST /rpc/${J} HTTP/1.0\r
1
+ import{Ue as O,Ve as U,Ye as b,Ze as m,_e as L,cf as y}from"./index-5230x6s8.js";import{createHash as Zz,randomUUID as v}from"node:crypto";import{chmod as t,mkdir as r,open as e,readdir as j,rename as zz,rmdir as Gz,stat as Jz,unlink as S}from"node:fs/promises";import{join as R,resolve as D}from"node:path";function l(z){return typeof z==="number"&&Number.isSafeInteger(z)&&z>0}function F(z){if(!l(z))return!1;try{return process.kill(z,0),!0}catch(J){return J.code==="EPERM"}}function Cz(z){return(J)=>Kz(J,z)}function Kz(z,J){if(/^[0-9a-f]{16}$/.test(z))return!0;return z.startsWith(J)&&/^[0-9a-f]{16}$/.test(z.slice(J.length))}function Nz(z){let J=/^port-(\d+)\.json$/.exec(z);return J?Number(J[1]):void 0}function p(z,J){if(z===null||typeof z!=="object"||Array.isArray(z))return!1;let{pid:V,port:Q,token:K}=z;return l(V)&&Nz(J)===V&&typeof Q==="number"&&Number.isInteger(Q)&&Q>=1&&Q<=65535&&typeof K==="string"&&K.length>0}async function h(z,J){J?.debug("rpc corrupt port file",{pid:process.pid,portFile:z}),await S(z).catch(()=>{})}async function Az(z,J,V={}){let Q=async()=>{let K=R(z,`port-${J.pid}.json`);if(O)return await m(z,V.secureDir??!1),await V.beforeWrite?.(),await y(K,JSON.stringify({...J,startedAt:Date.now()}),{stagePath:`${K}.${(V.stageName??v)()}.tmp`}),K;if(await r(z,{recursive:!0,mode:V.secureDir?448:void 0}),V.secureDir)await t(z,448);await V.beforeWrite?.();let W={...J,startedAt:Date.now()},Y=`${K}.${(V.stageName??v)()}.tmp`,N,G=!1;try{N=await e(Y,"wx",384),G=!0,await N.writeFile(JSON.stringify(W),"utf8"),await N.chmod(384),await N.close(),N=void 0,await zz(Y,K),G=!1}finally{if(await N?.close().catch(()=>{}),G)await S(Y).catch(()=>{})}return K};try{return await Q()}catch(K){if(K.code==="ENOENT")return await Q();throw K}}async function Oz(z,J,V,Q){let K;try{K=await j(z,{withFileTypes:!0})}catch(Y){if(Y.code==="ENOENT")return;throw Y}let W=D(J);for(let Y of K){if(!Y.isDirectory()||!V(Y.name))continue;let N=R(z,Y.name),G;try{G=await j(N)}catch(X){if(X.code==="ENOENT")continue;throw X}for(let X of G){if(!X.startsWith("port-")||!X.endsWith(".json"))continue;let $=R(N,X),Z;try{Z=await L($)}catch(H){if(H instanceof U&&H.code!=="ENOENT")throw H;continue}if(Z===void 0)continue;let q;try{q=JSON.parse(Z)}catch{await h($,Q);continue}if(!p(q,X)){await h($,Q);continue}if(!F(q.pid))await S($).catch(()=>{})}if(D(N)!==W)await Gz(N).catch(()=>{})}}async function c(z,J){if(!F(J.pid))return null;let V=R(D(z),`port-${J.pid}.json`);try{if(O)await b(V,"file");let Q=await Jz(V);return`${V}:${Q.dev}:${Q.ino}:${Q.mtimeMs}:${Q.size}`}catch(Q){if(Q instanceof U&&Q.code!=="ENOENT")throw Q;return null}}async function a(z,J,V={}){let Q;try{if(O)await b(z,"directory");Q=await j(z)}catch(G){if(G instanceof U&&G.code!=="ENOENT")throw G;return null}let K=[];for(let G of Q){if(!G.startsWith("port-")||!G.endsWith(".json"))continue;try{let X=JSON.parse(await L(R(z,G)));if(p(X,G))if(F(X.pid))K.push(X);else await S(R(z,G)).catch(()=>{})}catch(X){if(X instanceof U&&X.code!=="ENOENT")throw X}}if(K.length===0)return null;let W=J!==void 0&&J>=1?K.filter((G)=>G.pid===J):[];if(V.exactPid===!0&&W.length===0)return null;let Y=W.length>0?W:K,N=(G)=>typeof G.startedAt==="number"&&Number.isFinite(G.startedAt)?G.startedAt:-1/0;return Y.sort((G,X)=>N(X)-N(G))[0]??null}import{open as Qz}from"node:fs/promises";import{connect as Vz}from"node:net";import{join as Wz,resolve as o}from"node:path";var i=2000,A=new Map,T=new Map;async function Xz(z,J){let V=Wz(o(z),`port-${J.pid}.json`);if(O){let K=JSON.parse(await L(V));if(K.pid!==J.pid||K.port!==J.port||K.token!==J.token)return null;return null}let Q;try{Q=await Qz(V,"r");let K=await Q.stat(),W=JSON.parse(await Q.readFile("utf8"));if(W.pid!==J.pid||W.port!==J.port||W.token!==J.token)return null;return`${V}:${K.dev}:${K.ino}:${K.mtimeMs}:${K.size}`}catch{return null}finally{await Q?.close().catch(()=>{})}}async function s(z,J,V,Q){let K=A.get(z);if(!O&&K&&await c(J,K.entry)===K.identity)return K;A.delete(z);let W=T.get(z);if(W)return W;let Y=(async()=>{let N=await(Q.discover??a)(J,V,Q);if(!N)return null;let G=await Xz(J,N);if(!G)return{entry:N,identity:""};let X={entry:N,identity:G};return A.set(z,X),X})();T.set(z,Y);try{return await Y}finally{if(T.get(z)===Y)T.delete(z)}}async function d(z,J,V,Q=i){return new Promise((K)=>{let W,Y=!1,N=!1,G=($,Z=!1)=>{if(Y)return;Y=!0,clearTimeout(X),W?.destroy(),K({value:$,stale:Z})},X=setTimeout(()=>G(null),Q);try{let $=JSON.stringify(V);W=Vz({host:"127.0.0.1",port:z.port}),W.on("connect",()=>{N=!0,W?.write(`POST /rpc/${J} HTTP/1.0\r
2
2
  Host: 127.0.0.1:${z.port}\r
3
3
  Connection: close\r
4
4
  Content-Type: application/json\r
@@ -9,4 +9,4 @@ Authorization: Bearer ${z.token}\r
9
9
  \r
10
10
  `);if(B>=0)C=B+4;if((C??_.length)>16384)return G(null);if(C!==void 0){let x=_.subarray(0,B).toString("latin1").split(`\r
11
11
  `),f=/^HTTP\/1\.[01] (\d{3})(?: |$)/.exec(x[0]??"");if(!f)return G(null);let w=Number(f[1]);if(w<200||w>=300)return G(null,[401,403,404,410].includes(w));for(let M of x.slice(1)){let k=M.indexOf(":"),u=M.slice(0,k).toLowerCase(),P=M.slice(k+1).trim();if(u==="transfer-encoding")return G(null);if(u==="content-length"){if(H!==void 0||!/^\d+$/.test(P))return G(null);if(H=Number(P),!Number.isSafeInteger(H)||H>8388608)return G(null)}}_=Buffer.alloc(0)}}let I=q-(C??q);if(I>8388608)return G(null);if(H!==void 0){if(I>H)return G(null);if(I===H)g()}}),W.on("end",()=>{if(H!==void 0&&q-(C??0)!==H)return G(null);g()}),W.on("error",()=>G(null,!N)),W.on("close",()=>G(null))}catch{G(null,!N)}})}async function n(z,J,V,Q,K,W,Y=i){let N=JSON.stringify([o(z),J??null,V.exactPid===!0]),G=await s(N,z,J,V);if(Q(G?.entry??null),!G)return null;let X=Date.now()+Y,$=await d(G.entry,K,W,Y);if(!$.stale)return $.value;if(A.get(N)===G)A.delete(N);let Z=await s(N,z,J,V);if(!Z||Date.now()>=X)return null;if(Z.entry.port===G.entry.port&&Z.entry.pid===G.entry.pid&&Z.entry.token===G.entry.token){if(A.get(N)===Z)A.delete(N);return null}let q=await d(Z.entry,K,W,X-Date.now());if(q.stale&&A.get(N)===Z)A.delete(N);return q.value}function Tz(z,J,V,Q={}){let K={exactPid:Q.exactPid,discover:Q.discover},W=!1,Y=(N)=>{if(W)return;V?.(N),W=!0};return{async pending(N,G,X){return(await n(z,J,K,Y,"pending-notifications",{lastReceivedId:N,sessionId:G},X))?.messages??[]},async apply(N,G){return await n(z,J,K,Y,"apply",{...N},G)??{text:"apply failed",knobs:{}}}}}
12
- export{Cz as xe,Az as ye,Oz as ze,a as Ae,i as Be,Tz as Ce};
12
+ export{Cz as Ce,Az as De,Oz as Ee,a as Fe,i as Ge,Tz as He};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as PoolStore, _ as TokenResponse, a as RESPONSES_LITE_MODELS, b as parseJwtClaims, c as CacheKeepManager, d as ResetTargetIdentity, f as OpenAiVault, g as IdTokenClaims, l as MenuMigrationState, n as CODEX_VERSION, o as PoolLifecycleDeps, t as CODEX_USER_AGENT, u as OpenAiMenuOptions, v as beginAccountLogin, x as AccountPaths, y as extractAccountIdFromClaims } from "./codex-request-B9D0e97Q.js";
2
- import { v as SidebarMachineState, x as SidebarState } from "./sidebar-state-CVSok7zv.js";
1
+ import { S as PoolStore, _ as TokenResponse, a as RESPONSES_LITE_MODELS, b as parseJwtClaims, c as CacheKeepManager, d as ResetTargetIdentity, f as OpenAiVault, g as IdTokenClaims, l as MenuMigrationState, n as CODEX_VERSION, o as PoolLifecycleDeps, t as CODEX_USER_AGENT, u as OpenAiMenuOptions, v as beginAccountLogin, x as AccountPaths, y as extractAccountIdFromClaims } from "./codex-request-hw0XcldE.js";
2
+ import { S as SidebarState, y as SidebarMachineState } from "./sidebar-state-pTd9gg9W.js";
3
3
  import { Hooks, Plugin, PluginInput } from "@opencode-ai/plugin";
4
4
  //#region ../core/dist/provider.d.ts
5
5
  type QuotaWindowName = string;
@@ -216,11 +216,19 @@ interface OAuthSpendControlReading {
216
216
  source?: string;
217
217
  reached: boolean;
218
218
  }
219
+ /**
220
+ * Prepaid workspace credits as the Codex backend reports them, in the usage
221
+ * poll's `credits` object or the `x-codex-credits-*` response headers. The
222
+ * headers carry no overage verdict, so `overageLimitReached` is optional.
223
+ * `checkedAt` is when the source was read. It is optional because accounts
224
+ * files written by older versions hold credits without it.
225
+ */
219
226
  interface OAuthCredits {
220
227
  hasCredits: boolean;
221
228
  unlimited: boolean;
222
- overageLimitReached: boolean;
229
+ overageLimitReached?: boolean;
223
230
  balance?: number;
231
+ checkedAt?: number;
224
232
  }
225
233
  type AccountBase = {
226
234
  id: string;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{$ as q,Q as f,R as g,S as h,T as i,U as j,V as k,W as l,X as m,Y as n,Z as o,_ as p,aa as r,ba as s,ca as t,da as u,ea as v,fa as w,ga as x,ha as y,ia as z,ja as A,ka as B,la as C,m as c,ma as D,n as d,na as E,o as e,oa as F}from"./index-4v2fs42x.js";import"./index-psjyexj3.js";import"./index-ex6nx3mq.js";import{Sc as a,Tc as b}from"./index-tn8x5tz8.js";import"./index-gn2b097f.js";import"./index-2pgkrebq.js";import"./index-tddr876f.js";import"./index-1mbgsxsr.js";import"./index-8x1aj7q3.js";import"./index-bc89akak.js";import"./index-xwvze96g.js";export{C as rewriteResponsesLiteBody,A as resolveSidebarSessionId,r as poolResetTarget,a as parseJwtClaims,x as mergePushedQuotaMetadata,k as getMainRefreshLockName,w as findCachekeepFallbackAccount,b as extractAccountIdFromClaims,F as default,s as createResetTargetResolver,h as codexOAuthModelListed,i as codexOAuthModelLimit,z as buildSidebarState,y as buildSidebarMachineState,t as buildResetRedemptionDeps,o as __resetBootQuotaSeedForTest,u as __menuContextForTest,n as __bootQuotaSeedPromiseForTest,q as ResetTargetResolutionError,c as RESPONSES_LITE_MODELS,v as POOL_MIGRATION_ENABLED,E as OpenAIAuthPlugin,B as MID_CONVERSATION_EFFORT_MODELS,l as MAIN_REFRESH_LOCK_TTL_MS,m as MAIN_REFRESH_LEASE_TTL_MS,j as EMPTY_BEARER_MESSAGE,g as DISALLOWED_MODELS,D as CodexAuthPlugin,d as CODEX_VERSION,e as CODEX_USER_AGENT,p as AuthPersistError,f as ALLOWED_MODELS};
1
+ import{$ as q,Q as f,R as g,S as h,T as i,U as j,V as k,W as l,X as m,Y as n,Z as o,_ as p,aa as r,ba as s,ca as t,da as u,ea as v,fa as w,ga as x,ha as y,ia as z,ja as A,ka as B,la as C,m as c,ma as D,n as d,na as E,o as e,oa as F}from"./index-jcyrm58f.js";import"./index-vy729a0b.js";import"./index-1eq2s1cp.js";import{Vc as a,Wc as b}from"./index-brbqqer5.js";import"./index-ag04nyv7.js";import"./index-rsvnabbe.js";import"./index-yhw3hnsh.js";import"./index-wgwze391.js";import"./index-5230x6s8.js";import"./index-t5m0dhmq.js";import"./index-d98f1xdp.js";export{C as rewriteResponsesLiteBody,A as resolveSidebarSessionId,r as poolResetTarget,a as parseJwtClaims,x as mergePushedQuotaMetadata,k as getMainRefreshLockName,w as findCachekeepFallbackAccount,b as extractAccountIdFromClaims,F as default,s as createResetTargetResolver,h as codexOAuthModelListed,i as codexOAuthModelLimit,z as buildSidebarState,y as buildSidebarMachineState,t as buildResetRedemptionDeps,o as __resetBootQuotaSeedForTest,u as __menuContextForTest,n as __bootQuotaSeedPromiseForTest,q as ResetTargetResolutionError,c as RESPONSES_LITE_MODELS,v as POOL_MIGRATION_ENABLED,E as OpenAIAuthPlugin,B as MID_CONVERSATION_EFFORT_MODELS,l as MAIN_REFRESH_LOCK_TTL_MS,m as MAIN_REFRESH_LEASE_TTL_MS,j as EMPTY_BEARER_MESSAGE,g as DISALLOWED_MODELS,D as CodexAuthPlugin,d as CODEX_VERSION,e as CODEX_USER_AGENT,p as AuthPersistError,f as ALLOWED_MODELS};
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.21.0+ceea0b545671e3e4/node_modules/@cortexkit/common-auth/dist/commands/model.d.ts
1
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/commands/model.d.ts
2
2
  /** The section slots, in the one order every renderer shows them. */
3
3
  declare const SECTION_SLOTS: readonly ['accounts', 'quota', 'routing', 'limits', 'cache', 'diagnostics', 'extra'];
4
4
  type SectionSlot = (typeof SECTION_SLOTS)[number];
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.21.0+ceea0b545671e3e4/node_modules/@cortexkit/common-auth/dist/rpc/port-file.d.ts
1
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/rpc/port-file.d.ts
2
2
  interface PortFileEntry {
3
3
  port: number;
4
4
  token: string;
@@ -1,4 +1,4 @@
1
- import { n as CommandApplyResult, r as CommandDialogPayload, s as NotifyKind, t as CommandApplyRequest } from "./model-BdITTmeb.js";
1
+ import { n as CommandApplyResult, r as CommandDialogPayload, s as NotifyKind, t as CommandApplyRequest } from "./model-DphbMQce.js";
2
2
  //#region ../core/dist/protocol.d.ts
3
3
  /** The menu, as the slash command opens it in the TUI. */
4
4
  type OpenDialogPayload = CommandDialogPayload;
@@ -1,4 +1,4 @@
1
- import { n as discoverPortFile, r as writePortFile, t as PortFileEntry } from "../port-file-DbHIVC9a.js";
1
+ import { n as discoverPortFile, r as writePortFile, t as PortFileEntry } from "../port-file-Cx-wwe5Q.js";
2
2
  //#region src/rpc/port-file.d.ts
3
3
  export declare const isOpenaiRpcStateDir: (name: string) => boolean;
4
4
  //#endregion
@@ -1 +1 @@
1
- import{we as c}from"../index-2pgkrebq.js";import{Ae as b,ye as a}from"../index-tddr876f.js";import"../index-8x1aj7q3.js";import"../index-bc89akak.js";import"../index-xwvze96g.js";export{a as writePortFile,c as isOpenaiRpcStateDir,b as discoverPortFile};
1
+ import{Be as c}from"../index-rsvnabbe.js";import{De as a,Fe as b}from"../index-yhw3hnsh.js";import"../index-5230x6s8.js";import"../index-t5m0dhmq.js";import"../index-d98f1xdp.js";export{a as writePortFile,c as isOpenaiRpcStateDir,b as discoverPortFile};
@@ -1,2 +1,2 @@
1
- import { a as RpcNotification, i as OpenDialogPayload, n as ApplyResult, o as isNotifyPayload, r as NotifyPayload, t as ApplyRequest } from "../protocol-MysYPAho.js";
1
+ import { a as RpcNotification, i as OpenDialogPayload, n as ApplyResult, o as isNotifyPayload, r as NotifyPayload, t as ApplyRequest } from "../protocol-CDqdjh74.js";
2
2
  export { type ApplyRequest, type ApplyResult, type NotifyPayload, type OpenDialogPayload, type RpcNotification, isNotifyPayload };
@@ -1 +1 @@
1
- import{Ne as b}from"../index-1mbgsxsr.js";import"../index-8x1aj7q3.js";import"../index-xwvze96g.js";export{b as isNotifyPayload};
1
+ import{Se as b}from"../index-wgwze391.js";import"../index-5230x6s8.js";import"../index-d98f1xdp.js";export{b as isNotifyPayload};
@@ -1,6 +1,6 @@
1
- import { a as RpcNotification, n as ApplyResult, t as ApplyRequest } from "../protocol-MysYPAho.js";
2
- import { t as PortFileEntry } from "../port-file-DbHIVC9a.js";
3
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.21.0+ceea0b545671e3e4/node_modules/@cortexkit/common-auth/dist/rpc/rpc-client.d.ts
1
+ import { a as RpcNotification, n as ApplyResult, t as ApplyRequest } from "../protocol-CDqdjh74.js";
2
+ import { t as PortFileEntry } from "../port-file-Cx-wwe5Q.js";
3
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/rpc/rpc-client.d.ts
4
4
  export declare const DEFAULT_RPC_TIMEOUT_MS = 2000;
5
5
  //#endregion
6
6
  //#region src/rpc/rpc-client.d.ts
@@ -1 +1 @@
1
- import{Be as F,Ce as f}from"../index-tddr876f.js";import"../index-8x1aj7q3.js";import"../index-xwvze96g.js";function y(r,s,v){return f(r,s,v)}export{y as createRpcClient,F as DEFAULT_RPC_TIMEOUT_MS};
1
+ import{Ge as F,He as f}from"../index-yhw3hnsh.js";import"../index-5230x6s8.js";import"../index-d98f1xdp.js";function y(r,s,v){return f(r,s,v)}export{y as createRpcClient,F as DEFAULT_RPC_TIMEOUT_MS};
@@ -1 +1 @@
1
- import{$e as b,_e as a,af as c,bf as d}from"../index-bc89akak.js";import"../index-xwvze96g.js";export{a as tmpdir,d as resolveRpcDir,c as getRpcDir,b as RPC_DIRECTORY_PREFIX};
1
+ import{df as a,ef as b,ff as c,gf as d}from"../index-t5m0dhmq.js";import"../index-d98f1xdp.js";export{a as tmpdir,d as resolveRpcDir,c as getRpcDir,b as RPC_DIRECTORY_PREFIX};
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.21.0+ceea0b545671e3e4/node_modules/@cortexkit/common-auth/dist/logger/engine.d.ts
1
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/logger/engine.d.ts
2
2
  interface ChannelLogger {
3
3
  error(message: string, data?: unknown): void;
4
4
  warn(message: string, data?: unknown): void;
@@ -8,7 +8,7 @@ interface ChannelLogger {
8
8
  }
9
9
  declare function createLogger(channel: string): ChannelLogger;
10
10
  //#endregion
11
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.21.0+ceea0b545671e3e4/node_modules/@cortexkit/common-auth/dist/quota/map.d.ts
11
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/quota/map.d.ts
12
12
  interface QuotaReadingEntry {
13
13
  scope: string;
14
14
  label: string;
@@ -55,15 +55,33 @@ interface QuotaCounter {
55
55
  value: number;
56
56
  checkedAt: number;
57
57
  }
58
+ /**
59
+ * Prepaid credits a provider account holds beside its rate-limit windows (for
60
+ * example a ChatGPT workspace's credits, which keep requests working after a
61
+ * window is used up). This is a state, not a count or the spend budget: the
62
+ * account has credits or not, they may be unlimited, and the provider may
63
+ * report a balance. It carries its own observation time.
64
+ */
65
+ interface QuotaCredits {
66
+ hasCredits: boolean;
67
+ unlimited: boolean;
68
+ /** The balance the provider reported, when it reported one. */
69
+ balance?: number;
70
+ /** The provider's verdict that the overage allowance is used up. */
71
+ overageLimitReached?: boolean;
72
+ checkedAt: number;
73
+ }
58
74
  interface QuotaMap {
59
75
  limits: QuotaEntry[];
60
76
  /** Absent means no observation has reported on the budget yet. */
61
77
  budget?: CreditBudgetEntry;
62
78
  /** Provider-named counts, each with its own observation time. */
63
79
  counters?: Record<string, QuotaCounter>;
80
+ /** Absent means no observation has reported on prepaid credits yet. */
81
+ credits?: QuotaCredits;
64
82
  }
65
83
  //#endregion
66
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.21.0+ceea0b545671e3e4/node_modules/@cortexkit/common-auth/dist/quota/projection.d.ts
84
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/quota/projection.d.ts
67
85
  interface ProjectedLimit {
68
86
  scope: string;
69
87
  label: string;
@@ -105,6 +123,8 @@ interface ProjectedQuota {
105
123
  /** Present only when the stored budget is a reading, not cleared. */
106
124
  budget?: ProjectedBudget;
107
125
  counters?: Record<string, QuotaCounter>;
126
+ /** The stored prepaid credits, unchanged in every scope. */
127
+ credits?: QuotaCredits;
108
128
  /**
109
129
  * The named groups the windows belong to, in the order the plugin lists
110
130
  * them. Set only by a plugin whose windows all belong to such groups; the
@@ -114,7 +134,7 @@ interface ProjectedQuota {
114
134
  groups?: readonly QuotaGroup[];
115
135
  }
116
136
  //#endregion
117
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.21.0+ceea0b545671e3e4/node_modules/@cortexkit/common-auth/dist/sidebar-file/sidebar-file.d.ts
137
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/sidebar-file/sidebar-file.d.ts
118
138
  interface SidebarFileHooks {
119
139
  /** Runs on the first merge attempt, before checking for older, unlocked writers. */
120
140
  beforeRecheck?: () => void | Promise<void>;
@@ -150,7 +170,36 @@ interface AccountQuota {
150
170
  spendControl?: SpendControlReading;
151
171
  spendControlCleared?: true;
152
172
  resetCreditsAvailable?: number;
173
+ /**
174
+ * Prepaid workspace credits, absent when no reading reported any. Separate
175
+ * from `spendControl`, the budget a workspace sets on the account.
176
+ */
177
+ credits?: AccountCredits;
153
178
  }
179
+ /** Prepaid credits as the last reading that reported them saw them. */
180
+ interface AccountCredits {
181
+ hasCredits: boolean;
182
+ unlimited: boolean;
183
+ balance?: number;
184
+ overageLimitReached?: boolean;
185
+ /** When that reading was taken, when the writer recorded it. */
186
+ checkedAt?: number;
187
+ }
188
+ /**
189
+ * The prepaid-credits text for an account (`Unlimited`, `<n> credits` or
190
+ * `Available`), or undefined when it has none or the file holds no
191
+ * well-formed credits record. The file is read unchecked, so the record's
192
+ * fields are checked here before the shared wording is applied.
193
+ */
194
+ declare function accountCreditsText(quota: AccountQuota | null | undefined): string | undefined;
195
+ /**
196
+ * Whether an account can serve only on its prepaid credits: one of its
197
+ * windows reads used up with the reset still ahead, the workspace's spending
198
+ * cap is not reached, and its credits are usable by the rule routing applies
199
+ * (`creditsUsable`). The sidebar uses it to mark the account a session is
200
+ * using as serving on credits.
201
+ */
202
+ declare function accountServesOnCredits(quota: AccountQuota | null | undefined, now?: number): boolean;
154
203
  type QuotaWindowKey = 'primary' | 'secondary';
155
204
  declare function formatWindowLabel(windowMinutes: number | undefined, fallbackKey: QuotaWindowKey): string;
156
205
  interface PresentQuotaWindow {
@@ -224,7 +273,6 @@ interface SidebarState {
224
273
  activeRouting?: ActiveRoutingMap;
225
274
  stickyAssignments?: StickyAssignmentMap;
226
275
  planType?: string;
227
- credits?: number;
228
276
  lastUpdated: number;
229
277
  /**
230
278
  * True when the accounts come from the shared account pool (a migrated
@@ -302,7 +350,7 @@ type SidebarMergeHooks = Pick<SidebarFileHooks, 'beforeRecheck'> & {
302
350
  * Defaults to getSidebarStateFile() (per-call resolution).
303
351
  */
304
352
  declare function setSidebarState(state: SidebarState, file?: string): Promise<void>;
305
- type SidebarMachineState = Pick<SidebarState, 'main' | 'fallbacks' | 'planType' | 'credits' | 'lastUpdated' | 'accountPool' | 'vaultAccounts'> & {
353
+ type SidebarMachineState = Pick<SidebarState, 'main' | 'fallbacks' | 'planType' | 'lastUpdated' | 'accountPool' | 'vaultAccounts'> & {
306
354
  route: string;
307
355
  };
308
356
  declare function setSidebarMachineState(machineState: SidebarMachineState, file?: string, hooks?: SidebarMergeHooks): Promise<void>;
@@ -499,4 +547,4 @@ interface QuotaPacing {
499
547
  }
500
548
  declare function computeQuotaPacing(window: QuotaWindow, windowMs: number, now: number): QuotaPacing | null;
501
549
  //#endregion
502
- export { pruneStickyAssignments as $, applyStickyPinOverlay as A, getCollapsedAccountLines as B, SpendControlReading as C, StickyAssignmentPlan as D, StickyAssignmentMap as E, displayWidth as F, hashSidebarSessionId as G, getPresentQuotaWindows as H, drainSidebarWrites as I, normalizeSidebarState as J, isQuotaExhausted as K, exhaustedQuotaResetAt as L, computeQuotaPacing as M, createSidebarBookkeepingQueue as N, StickyPinOverlay as O, createSidebarStateCache as P, pruneActiveRouting as Q, fitCollapsedLabel as R, SidebarStateCache as S, StickyAssignmentChoice as T, getSidebarState as U, getCollapsedQuotaSummary as V, getSidebarStateFile as W, planSidebarStickyAssignment as X, persistSidebarStickyAssignment as Y, planSidebarStickyAssignmentFromSnapshot as Z, SidebarBookkeepingQueue as _, ActiveRoutingMap as a, resolveSidebarStickyAssignment as at, SidebarSnapshot as b, HOT_PATH_READ_BUDGET_MS as c, setSidebarMachineState as ct, QuotaWindow as d, sidebarQuotaProjection as dt, rememberStickyPin as et, QuotaWindowKey as f, spendControlExhaustedResetAt as ft, SidebarAccountState as g, STICKY_ASSIGNMENT_MAX_ENTRIES as h, ActiveRoutingEntry as i, resolveSessionStickyAccount as it, clearSidebarStickyAssignment as j, StickyPinOverlayEntry as k, PresentQuotaWindow as l, setSidebarState as lt, STICKY_ASSIGNMENT_MAX_AGE_MS as m, QuotaMap as mt, ACTIVE_ROUTING_MAX_ENTRIES as n, resolveActiveAccount as nt, CollapsedAccountLine as o, setLegacySidebarStateFileForTest as ot, ResolveStickyAssignmentInput as p, upsertSidebarActiveRouting as pt, isUsableRoutingEntry as q, AccountQuota as r, resolveSessionSidebarRouting as rt, DEFAULT_SIDEBAR_STATE as s, setSidebarLegacyRouting as st, ACTIVE_ROUTING_MAX_AGE_MS as t, removeSidebarActiveRouting as tt, QuotaPacing as u, settleWithinBudget as ut, SidebarMachineState as v, StickyAssignment as w, SidebarState as x, SidebarRoutingAccount as y, formatWindowLabel as z };
550
+ export { planSidebarStickyAssignment as $, StickyPinOverlayEntry as A, exhaustedQuotaResetAt as B, SidebarStateCache as C, StickyAssignmentMap as D, StickyAssignmentChoice as E, computeQuotaPacing as F, getPresentQuotaWindows as G, formatWindowLabel as H, createSidebarBookkeepingQueue as I, hashSidebarSessionId as J, getSidebarState as K, createSidebarStateCache as L, accountServesOnCredits as M, applyStickyPinOverlay as N, StickyAssignmentPlan as O, clearSidebarStickyAssignment as P, persistSidebarStickyAssignment as Q, displayWidth as R, SidebarState as S, StickyAssignment as T, getCollapsedAccountLines as U, fitCollapsedLabel as V, getCollapsedQuotaSummary as W, isUsableRoutingEntry as X, isQuotaExhausted as Y, normalizeSidebarState as Z, SidebarAccountState as _, QuotaMap as _t, ActiveRoutingEntry as a, resolveActiveAccount as at, SidebarRoutingAccount as b, DEFAULT_SIDEBAR_STATE as c, resolveSidebarStickyAssignment as ct, QuotaPacing as d, setSidebarMachineState as dt, planSidebarStickyAssignmentFromSnapshot as et, QuotaWindow as f, setSidebarState as ft, STICKY_ASSIGNMENT_MAX_ENTRIES as g, upsertSidebarActiveRouting as gt, STICKY_ASSIGNMENT_MAX_AGE_MS as h, spendControlExhaustedResetAt as ht, AccountQuota as i, removeSidebarActiveRouting as it, accountCreditsText as j, StickyPinOverlay as k, HOT_PATH_READ_BUDGET_MS as l, setLegacySidebarStateFileForTest as lt, ResolveStickyAssignmentInput as m, sidebarQuotaProjection as mt, ACTIVE_ROUTING_MAX_ENTRIES as n, pruneStickyAssignments as nt, ActiveRoutingMap as o, resolveSessionSidebarRouting as ot, QuotaWindowKey as p, settleWithinBudget as pt, getSidebarStateFile as q, AccountCredits as r, rememberStickyPin as rt, CollapsedAccountLine as s, resolveSessionStickyAccount as st, ACTIVE_ROUTING_MAX_AGE_MS as t, pruneActiveRouting as tt, PresentQuotaWindow as u, setSidebarLegacyRouting as ut, SidebarBookkeepingQueue as v, SpendControlReading as w, SidebarSnapshot as x, SidebarMachineState as y, drainSidebarWrites as z };
@@ -1,2 +1,2 @@
1
- import { $ as pruneStickyAssignments, A as applyStickyPinOverlay, B as getCollapsedAccountLines, C as SpendControlReading, D as StickyAssignmentPlan, E as StickyAssignmentMap, F as displayWidth, G as hashSidebarSessionId, H as getPresentQuotaWindows, I as drainSidebarWrites, J as normalizeSidebarState, K as isQuotaExhausted, L as exhaustedQuotaResetAt, M as computeQuotaPacing, N as createSidebarBookkeepingQueue, O as StickyPinOverlay, P as createSidebarStateCache, Q as pruneActiveRouting, R as fitCollapsedLabel, S as SidebarStateCache, T as StickyAssignmentChoice, U as getSidebarState, V as getCollapsedQuotaSummary, W as getSidebarStateFile, X as planSidebarStickyAssignment, Y as persistSidebarStickyAssignment, Z as planSidebarStickyAssignmentFromSnapshot, _ as SidebarBookkeepingQueue, a as ActiveRoutingMap, at as resolveSidebarStickyAssignment, b as SidebarSnapshot, c as HOT_PATH_READ_BUDGET_MS, ct as setSidebarMachineState, d as QuotaWindow, dt as sidebarQuotaProjection, et as rememberStickyPin, f as QuotaWindowKey, ft as spendControlExhaustedResetAt, g as SidebarAccountState, h as STICKY_ASSIGNMENT_MAX_ENTRIES, i as ActiveRoutingEntry, it as resolveSessionStickyAccount, j as clearSidebarStickyAssignment, k as StickyPinOverlayEntry, l as PresentQuotaWindow, lt as setSidebarState, m as STICKY_ASSIGNMENT_MAX_AGE_MS, n as ACTIVE_ROUTING_MAX_ENTRIES, nt as resolveActiveAccount, o as CollapsedAccountLine, ot as setLegacySidebarStateFileForTest, p as ResolveStickyAssignmentInput, pt as upsertSidebarActiveRouting, q as isUsableRoutingEntry, r as AccountQuota, rt as resolveSessionSidebarRouting, s as DEFAULT_SIDEBAR_STATE, st as setSidebarLegacyRouting, t as ACTIVE_ROUTING_MAX_AGE_MS, tt as removeSidebarActiveRouting, u as QuotaPacing, ut as settleWithinBudget, v as SidebarMachineState, w as StickyAssignment, x as SidebarState, y as SidebarRoutingAccount, z as formatWindowLabel } from "./sidebar-state-CVSok7zv.js";
2
- export { ACTIVE_ROUTING_MAX_AGE_MS, ACTIVE_ROUTING_MAX_ENTRIES, AccountQuota, ActiveRoutingEntry, ActiveRoutingMap, CollapsedAccountLine, DEFAULT_SIDEBAR_STATE, HOT_PATH_READ_BUDGET_MS, PresentQuotaWindow, QuotaPacing, QuotaWindow, QuotaWindowKey, ResolveStickyAssignmentInput, STICKY_ASSIGNMENT_MAX_AGE_MS, STICKY_ASSIGNMENT_MAX_ENTRIES, SidebarAccountState, SidebarBookkeepingQueue, SidebarMachineState, SidebarRoutingAccount, SidebarSnapshot, SidebarState, SidebarStateCache, SpendControlReading, StickyAssignment, StickyAssignmentChoice, StickyAssignmentMap, StickyAssignmentPlan, StickyPinOverlay, StickyPinOverlayEntry, applyStickyPinOverlay, clearSidebarStickyAssignment, computeQuotaPacing, createSidebarBookkeepingQueue, createSidebarStateCache, displayWidth, drainSidebarWrites, exhaustedQuotaResetAt, fitCollapsedLabel, formatWindowLabel, getCollapsedAccountLines, getCollapsedQuotaSummary, getPresentQuotaWindows, getSidebarState, getSidebarStateFile, hashSidebarSessionId, isQuotaExhausted, isUsableRoutingEntry, normalizeSidebarState, persistSidebarStickyAssignment, planSidebarStickyAssignment, planSidebarStickyAssignmentFromSnapshot, pruneActiveRouting, pruneStickyAssignments, rememberStickyPin, removeSidebarActiveRouting, resolveActiveAccount, resolveSessionSidebarRouting, resolveSessionStickyAccount, resolveSidebarStickyAssignment, setLegacySidebarStateFileForTest, setSidebarLegacyRouting, setSidebarMachineState, setSidebarState, settleWithinBudget, sidebarQuotaProjection, spendControlExhaustedResetAt, upsertSidebarActiveRouting };
1
+ import { $ as planSidebarStickyAssignment, A as StickyPinOverlayEntry, B as exhaustedQuotaResetAt, C as SidebarStateCache, D as StickyAssignmentMap, E as StickyAssignmentChoice, F as computeQuotaPacing, G as getPresentQuotaWindows, H as formatWindowLabel, I as createSidebarBookkeepingQueue, J as hashSidebarSessionId, K as getSidebarState, L as createSidebarStateCache, M as accountServesOnCredits, N as applyStickyPinOverlay, O as StickyAssignmentPlan, P as clearSidebarStickyAssignment, Q as persistSidebarStickyAssignment, R as displayWidth, S as SidebarState, T as StickyAssignment, U as getCollapsedAccountLines, V as fitCollapsedLabel, W as getCollapsedQuotaSummary, X as isUsableRoutingEntry, Y as isQuotaExhausted, Z as normalizeSidebarState, _ as SidebarAccountState, a as ActiveRoutingEntry, at as resolveActiveAccount, b as SidebarRoutingAccount, c as DEFAULT_SIDEBAR_STATE, ct as resolveSidebarStickyAssignment, d as QuotaPacing, dt as setSidebarMachineState, et as planSidebarStickyAssignmentFromSnapshot, f as QuotaWindow, ft as setSidebarState, g as STICKY_ASSIGNMENT_MAX_ENTRIES, gt as upsertSidebarActiveRouting, h as STICKY_ASSIGNMENT_MAX_AGE_MS, ht as spendControlExhaustedResetAt, i as AccountQuota, it as removeSidebarActiveRouting, j as accountCreditsText, k as StickyPinOverlay, l as HOT_PATH_READ_BUDGET_MS, lt as setLegacySidebarStateFileForTest, m as ResolveStickyAssignmentInput, mt as sidebarQuotaProjection, n as ACTIVE_ROUTING_MAX_ENTRIES, nt as pruneStickyAssignments, o as ActiveRoutingMap, ot as resolveSessionSidebarRouting, p as QuotaWindowKey, pt as settleWithinBudget, q as getSidebarStateFile, r as AccountCredits, rt as rememberStickyPin, s as CollapsedAccountLine, st as resolveSessionStickyAccount, t as ACTIVE_ROUTING_MAX_AGE_MS, tt as pruneActiveRouting, u as PresentQuotaWindow, ut as setSidebarLegacyRouting, v as SidebarBookkeepingQueue, w as SpendControlReading, x as SidebarSnapshot, y as SidebarMachineState, z as drainSidebarWrites } from "./sidebar-state-pTd9gg9W.js";
2
+ export { ACTIVE_ROUTING_MAX_AGE_MS, ACTIVE_ROUTING_MAX_ENTRIES, AccountCredits, AccountQuota, ActiveRoutingEntry, ActiveRoutingMap, CollapsedAccountLine, DEFAULT_SIDEBAR_STATE, HOT_PATH_READ_BUDGET_MS, PresentQuotaWindow, QuotaPacing, QuotaWindow, QuotaWindowKey, ResolveStickyAssignmentInput, STICKY_ASSIGNMENT_MAX_AGE_MS, STICKY_ASSIGNMENT_MAX_ENTRIES, SidebarAccountState, SidebarBookkeepingQueue, SidebarMachineState, SidebarRoutingAccount, SidebarSnapshot, SidebarState, SidebarStateCache, SpendControlReading, StickyAssignment, StickyAssignmentChoice, StickyAssignmentMap, StickyAssignmentPlan, StickyPinOverlay, StickyPinOverlayEntry, accountCreditsText, accountServesOnCredits, applyStickyPinOverlay, clearSidebarStickyAssignment, computeQuotaPacing, createSidebarBookkeepingQueue, createSidebarStateCache, displayWidth, drainSidebarWrites, exhaustedQuotaResetAt, fitCollapsedLabel, formatWindowLabel, getCollapsedAccountLines, getCollapsedQuotaSummary, getPresentQuotaWindows, getSidebarState, getSidebarStateFile, hashSidebarSessionId, isQuotaExhausted, isUsableRoutingEntry, normalizeSidebarState, persistSidebarStickyAssignment, planSidebarStickyAssignment, planSidebarStickyAssignmentFromSnapshot, pruneActiveRouting, pruneStickyAssignments, rememberStickyPin, removeSidebarActiveRouting, resolveActiveAccount, resolveSessionSidebarRouting, resolveSessionStickyAccount, resolveSidebarStickyAssignment, setLegacySidebarStateFileForTest, setSidebarLegacyRouting, setSidebarMachineState, setSidebarState, settleWithinBudget, sidebarQuotaProjection, spendControlExhaustedResetAt, upsertSidebarActiveRouting };
@@ -1 +1 @@
1
- import{$b as w,Fb as a,Gb as b,Hb as c,Ib as d,Jb as e,Kb as f,Lb as g,Mb as h,Nb as i,Ob as j,Pb as k,Qb as l,Rb as m,Sb as n,Tb as o,Ub as p,Vb as q,Wb as r,Xb as s,Yb as t,Zb as u,_b as v,ac as x,bc as y,cc as z,dc as A,ec as B,fc as C,gc as D,hc as E,ic as F,jc as G,kc as H,lc as I,mc as J,nc as K,oc as L,pc as M,qc as N,rc as O,sc as P,tc as Q,uc as R}from"./index-ex6nx3mq.js";import"./index-tn8x5tz8.js";import"./index-gn2b097f.js";import"./index-1mbgsxsr.js";import"./index-8x1aj7q3.js";import"./index-xwvze96g.js";export{w as upsertSidebarActiveRouting,n as spendControlExhaustedResetAt,M as sidebarQuotaProjection,G as settleWithinBudget,u as setSidebarState,v as setSidebarMachineState,x as setSidebarLegacyRouting,c as setLegacySidebarStateFileForTest,A as resolveSidebarStickyAssignment,q as resolveSessionStickyAccount,r as resolveSessionSidebarRouting,L as resolveActiveAccount,y as removeSidebarActiveRouting,I as rememberStickyPin,t as pruneStickyAssignments,s as pruneActiveRouting,B as planSidebarStickyAssignmentFromSnapshot,z as planSidebarStickyAssignment,C as persistSidebarStickyAssignment,i as normalizeSidebarState,m as isUsableRoutingEntry,p as isQuotaExhausted,f as hashSidebarSessionId,g as getSidebarStateFile,j as getSidebarState,b as getPresentQuotaWindows,N as getCollapsedQuotaSummary,O as getCollapsedAccountLines,a as formatWindowLabel,Q as fitCollapsedLabel,o as exhaustedQuotaResetAt,E as drainSidebarWrites,P as displayWidth,H as createSidebarStateCache,K as createSidebarBookkeepingQueue,R as computeQuotaPacing,D as clearSidebarStickyAssignment,J as applyStickyPinOverlay,e as STICKY_ASSIGNMENT_MAX_ENTRIES,d as STICKY_ASSIGNMENT_MAX_AGE_MS,F as HOT_PATH_READ_BUDGET_MS,h as DEFAULT_SIDEBAR_STATE,l as ACTIVE_ROUTING_MAX_ENTRIES,k as ACTIVE_ROUTING_MAX_AGE_MS};
1
+ import{$b as w,Fb as a,Gb as b,Hb as c,Ib as d,Jb as e,Kb as f,Lb as g,Mb as h,Nb as i,Ob as j,Pb as k,Qb as l,Rb as m,Sb as n,Tb as o,Ub as p,Vb as q,Wb as r,Xb as s,Yb as t,Zb as u,_b as v,ac as x,bc as y,cc as z,dc as A,ec as B,fc as C,gc as D,hc as E,ic as F,jc as G,kc as H,lc as I,mc as J,nc as K,oc as L,pc as M,qc as N,rc as O,sc as P,tc as Q,uc as R,vc as S,wc as T}from"./index-1eq2s1cp.js";import"./index-brbqqer5.js";import"./index-ag04nyv7.js";import"./index-wgwze391.js";import"./index-5230x6s8.js";import"./index-d98f1xdp.js";export{y as upsertSidebarActiveRouting,p as spendControlExhaustedResetAt,O as sidebarQuotaProjection,I as settleWithinBudget,w as setSidebarState,x as setSidebarMachineState,z as setSidebarLegacyRouting,e as setLegacySidebarStateFileForTest,C as resolveSidebarStickyAssignment,s as resolveSessionStickyAccount,t as resolveSessionSidebarRouting,N as resolveActiveAccount,A as removeSidebarActiveRouting,K as rememberStickyPin,v as pruneStickyAssignments,u as pruneActiveRouting,D as planSidebarStickyAssignmentFromSnapshot,B as planSidebarStickyAssignment,E as persistSidebarStickyAssignment,k as normalizeSidebarState,o as isUsableRoutingEntry,r as isQuotaExhausted,h as hashSidebarSessionId,i as getSidebarStateFile,l as getSidebarState,d as getPresentQuotaWindows,P as getCollapsedQuotaSummary,Q as getCollapsedAccountLines,c as formatWindowLabel,S as fitCollapsedLabel,q as exhaustedQuotaResetAt,G as drainSidebarWrites,R as displayWidth,J as createSidebarStateCache,M as createSidebarBookkeepingQueue,T as computeQuotaPacing,F as clearSidebarStickyAssignment,L as applyStickyPinOverlay,b as accountServesOnCredits,a as accountCreditsText,g as STICKY_ASSIGNMENT_MAX_ENTRIES,f as STICKY_ASSIGNMENT_MAX_AGE_MS,H as HOT_PATH_READ_BUDGET_MS,j as DEFAULT_SIDEBAR_STATE,n as ACTIVE_ROUTING_MAX_ENTRIES,m as ACTIVE_ROUTING_MAX_AGE_MS};
@@ -1 +1 @@
1
- import{a as U,b as V}from"./index-ftkhhr6d.js";import{cf as R}from"./index-xwvze96g.js";var E=R((M,Q)=>{var{defineProperty:H,getOwnPropertyDescriptor:W,getOwnPropertyNames:X}=Object,Y=Object.prototype.hasOwnProperty,Z=(z,q)=>{for(var B in q)H(z,B,{get:q[B],enumerable:!0})},$=(z,q,B,F)=>{if(q&&typeof q==="object"||typeof q==="function"){for(let v of X(q))if(!Y.call(z,v)&&v!==B)H(z,v,{get:()=>q[v],enumerable:!(F=W(q,v))||F.enumerable})}return z},A=(z)=>$(H({},"__esModule",{value:!0}),z),L={};Z(L,{refreshToken:()=>D});Q.exports=A(L);var K=U(),G=V();async function D(z){let q=z?.project,B=z?.team;if(!q&&!B){let v=(0,G.findProjectInfo)();q=v.projectId,B=v.teamId}else if(!q||!B){let v=(0,G.findProjectInfo)();q=q??v.projectId,B=B??v.teamId}if(!q)throw new K.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let F=(0,G.loadToken)(q);if(!F||(0,G.isExpired)((0,G.getTokenPayload)(F.token),z?.expirationBufferMs)){let v=await(0,G.getVercelToken)({expirationBufferMs:z?.expirationBufferMs});if(F=await(0,G.getVercelOidcToken)(v,q,B),!F)throw new K.VercelOidcTokenError("Failed to refresh OIDC token");(0,G.saveToken)(F,q)}process.env.VERCEL_OIDC_TOKEN=F.token;return}});export default E();
1
+ import{a as U,b as V}from"./index-s88n2bjn.js";import{hf as R}from"./index-d98f1xdp.js";var E=R((M,Q)=>{var{defineProperty:H,getOwnPropertyDescriptor:W,getOwnPropertyNames:X}=Object,Y=Object.prototype.hasOwnProperty,Z=(z,q)=>{for(var B in q)H(z,B,{get:q[B],enumerable:!0})},$=(z,q,B,F)=>{if(q&&typeof q==="object"||typeof q==="function"){for(let v of X(q))if(!Y.call(z,v)&&v!==B)H(z,v,{get:()=>q[v],enumerable:!(F=W(q,v))||F.enumerable})}return z},A=(z)=>$(H({},"__esModule",{value:!0}),z),L={};Z(L,{refreshToken:()=>D});Q.exports=A(L);var K=U(),G=V();async function D(z){let q=z?.project,B=z?.team;if(!q&&!B){let v=(0,G.findProjectInfo)();q=v.projectId,B=v.teamId}else if(!q||!B){let v=(0,G.findProjectInfo)();q=q??v.projectId,B=B??v.teamId}if(!q)throw new K.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let F=(0,G.loadToken)(q);if(!F||(0,G.isExpired)((0,G.getTokenPayload)(F.token),z?.expirationBufferMs)){let v=await(0,G.getVercelToken)({expirationBufferMs:z?.expirationBufferMs});if(F=await(0,G.getVercelOidcToken)(v,q,B),!F)throw new K.VercelOidcTokenError("Failed to refresh OIDC token");(0,G.saveToken)(F,q)}process.env.VERCEL_OIDC_TOKEN=F.token;return}});export default E();
@@ -0,0 +1 @@
1
+ import{b as a}from"./index-s88n2bjn.js";import"./index-d98f1xdp.js";export default a();
@@ -1,4 +1,4 @@
1
- import{je as h,pe as u,qe as P}from"./index-gn2b097f.js";import{Pe as M,Qe as R,Ve as S}from"./index-8x1aj7q3.js";import"./index-xwvze96g.js";import{mkdir as Yq,writeFile as Vq}from"node:fs/promises";import{homedir as Wq}from"node:os";import{dirname as Dq,join as b}from"node:path";import{applyEdits as t,modify as r,parse as e}from"jsonc-parser";function qq(z){return z!==null&&typeof z==="object"&&!Array.isArray(z)}async function k(z){try{let q=[],H=e(await S(z,M),q,{allowTrailingComma:!0});return q.length===0&&qq(H)?H:{}}catch(q){if(q instanceof R&&q.code!=="ENOENT")throw q;return{}}}var zq=`// Shared preferences for TUI plugins.
1
+ import{oe as h,ue as u,ve as P}from"./index-ag04nyv7.js";import{Ue as M,Ve as R,_e as S}from"./index-5230x6s8.js";import"./index-d98f1xdp.js";import{mkdir as Yq,writeFile as Vq}from"node:fs/promises";import{homedir as Wq}from"node:os";import{dirname as Dq,join as b}from"node:path";import{applyEdits as t,modify as r,parse as e}from"jsonc-parser";function qq(z){return z!==null&&typeof z==="object"&&!Array.isArray(z)}async function k(z){try{let q=[],H=e(await S(z,M),q,{allowTrailingComma:!0});return q.length===0&&qq(H)?H:{}}catch(q){if(q instanceof R&&q.code!=="ENOENT")throw q;return{}}}var zq=`// Shared preferences for TUI plugins.
2
2
  // Plugins update individual keys in place and preserve comments.
3
3
  {}
4
4
  `;function g(z){let{file:q,pluginKey:H,beforeCommit:Q}=z,$={...P.preferences,timeoutMs:z.timeoutMs??P.preferences.timeoutMs},Z=Promise.resolve();async function X(U,j){await u(q,$,async(K)=>{let J;try{J=await S(q,M)}catch(G){if(G.code!=="ENOENT")throw G;J=""}if(J.trim()==="")J=zq;let B=t(J,r(J,[H,...U],j,{formattingOptions:{insertSpaces:!0,tabSize:2}}));await h(q,B,{serialize:(G)=>String(G),beforeRename:async()=>{await Q?.(),await K.assertOwned()}})})}return{queueTuiPreferenceUpdate(U,j){let K=[...U],J=structuredClone(j),B=Z.then(()=>X(K,J));return Z=B.catch(()=>{}),B}}}import{readFileSync as Hq,realpathSync as Qq,statSync as Xq,watch as Zq}from"node:fs";import{readFile as $q,stat as Bq}from"node:fs/promises";import{basename as p,dirname as s,join as Gq,resolve as Jq}from"node:path";import{clearTimeout as w,setTimeout as c}from"node:timers";function n(z){let q=Jq(z);if(M)return q;try{return Qq(q)}catch{let H=s(q);return H===q?q:Gq(n(H),p(q))}}function d(z){return z&&`${z.dev}:${z.ino}:${z.mtimeMs}:${z.size}`}function T(z,q,H={}){let Q=globalThis,$=Symbol.for("cortexkit.common-auth.tui-prefs.watchers.v1"),Z=Q[$]??new Map;Q[$]=Z;let X=n(z),U=Z.get(X);if(U)return U.subscribe(q);let j=p(X),K=M?(Y)=>S(Y):H.fs?.readFile??((Y)=>$q(Y,"utf8")),J=H.fs?.stat??Bq,B=null,G=null,x=null,C=null;if(!M)try{let Y=d((H.fs?.statSync??Xq)(X));C=(H.fs?.readFileSync??((V)=>Hq(V,"utf8")))(X),x=Y}catch{}let N=!1,L=new Set,E=Promise.resolve(),v=(Y)=>{return E=E.then(async()=>{if(N)return;let V=d(await J(X).catch(()=>null));if(!Y&&V===x)return;if(V===null){x=null;return}let I=await K(X).catch((W)=>{if(W instanceof R&&W.code!=="ENOENT")if(H.onError)H.onError(W);else process.emitWarning(W.message,W.name);return null});if(N)return;if(I===null)return;if(x=V,I===C)return;C=I;for(let W of[...L]){if(!L.has(W))continue;try{W.notify()}catch{}}}),E},i=()=>{if(N)return;if(B)w(B);B=c(()=>{B=null,v(!0)},150)},O=null;try{O=(H.watchDirectory??Zq)(s(X),(Y,V)=>{let I=V?.toString(),W=I===j||I?.startsWith(`${j}.`)&&I.endsWith(".tmp");if(I!=null&&!W)return;i()}),O.on("error",()=>{O?.close(),O=null})}catch{}let f=()=>{if(N||G)return;G=c(()=>{if(G=null,N)return;v(!1).finally(f)},1000),G.unref()},F={subscribe:(Y)=>{let V={notify:Y};return L.add(V),()=>{if(!L.delete(V)||L.size>0)return;if(N=!0,B)w(B);if(G)w(G);if(O?.close(),Z.get(X)===F)Z.delete(X)}}};return Z.set(X,F),f(),F.subscribe(q)}var Uq="OPENCODE_TUI_PREFERENCES_FILE",Iq="tui-preferences.jsonc";function m(){let z=process.env[Uq];if(z)return z;let q=process.env.OPENCODE_CONFIG_DIR||b(process.env.XDG_CONFIG_HOME||b(Wq(),".config"),"opencode");return b(q,Iq)}function _(z){return typeof z==="object"&&z!==null&&!Array.isArray(z)}function dq(){return k(m())}var Mq="openai-auth",Aq=160,l={forceToTop:!1,order:Aq,startCollapsed:!1,rememberCollapsed:!0,collapsed:null,pollMs:1500,refreshDebounceMs:200,header:{label:"OPENAI",showVersion:!0},sections:{quota:!0,fallbackAccounts:!0,routing:!0,health:!0,pacing:!0},appearance:{barWidth:10,barFilledChar:"█",barEmptyChar:"░",warnThreshold:50,errorThreshold:80}};function D(z,q){return typeof z==="boolean"?z:q}function A(z,q,H,Q){if(typeof z!=="number"||!Number.isFinite(z))return q;return Math.min(Math.max(Math.round(z),H),Q)}function jq(z,q,H){if(typeof z!=="string"||z.length===0)return q;return z.slice(0,H)}function o(z,q){if(typeof z!=="string")return q;return[...z][0]??q}function pq(z){let q=z[Mq];if(!_(q))return structuredClone(l);let H=l,Q=_(q.header)?q.header:{},$=_(q.sections)?q.sections:{},Z=_(q.appearance)?q.appearance:{},X=A(Z.warnThreshold,H.appearance.warnThreshold,0,99),U=Math.max(A(Z.errorThreshold,H.appearance.errorThreshold,0,100),Math.min(X+1,100));return{forceToTop:D(q.forceToTop,H.forceToTop),order:A(q.order,H.order,-1e4,1e4),startCollapsed:D(q.startCollapsed,H.startCollapsed),rememberCollapsed:D(q.rememberCollapsed,H.rememberCollapsed),collapsed:typeof q.collapsed==="boolean"?q.collapsed:null,pollMs:A(q.pollMs,H.pollMs,500,30000),refreshDebounceMs:A(q.refreshDebounceMs,H.refreshDebounceMs,50,5000),header:{label:jq(Q.label,H.header.label,20),showVersion:D(Q.showVersion,H.header.showVersion)},sections:{quota:D($.quota,H.sections.quota),fallbackAccounts:D($.fallbackAccounts,H.sections.fallbackAccounts),routing:D($.routing,H.sections.routing),health:D($.health,H.sections.health),pacing:D($.pacing,H.sections.pacing)},appearance:{barWidth:A(Z.barWidth,H.appearance.barWidth,4,40),barFilledChar:o(Z.barFilledChar,H.appearance.barFilledChar),barEmptyChar:o(Z.barEmptyChar,H.appearance.barEmptyChar),warnThreshold:X,errorThreshold:U}}}var Nq=-1e5;function sq(z,q,H){let Q=z[q];if(!_(Q))return H;if(Q.forceToTop===!0)return Nq+Object.keys(z).indexOf(q);return A(Q.order,H,-1e4,1e4)}var Kq=`// Shared preferences for opencode TUI plugins.
package/dist/tui.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as SpendControlReading, d as QuotaWindow, r as AccountQuota, u as QuotaPacing, x as SidebarState } from "./sidebar-state-CVSok7zv.js";
2
- import { i as OpenDialogPayload, n as ApplyResult, t as ApplyRequest } from "./protocol-MysYPAho.js";
1
+ import { S as SidebarState, d as QuotaPacing, f as QuotaWindow, i as AccountQuota, w as SpendControlReading } from "./sidebar-state-pTd9gg9W.js";
2
+ import { i as OpenDialogPayload, n as ApplyResult, t as ApplyRequest } from "./protocol-CDqdjh74.js";
3
3
  import { Plugin } from "@opencode/plugin/tui";
4
4
  import { TuiPluginModule } from "@opencode-ai/plugin/tui";
5
5
  import { JSX } from "solid-js";
@@ -60,10 +60,37 @@ export declare function getQuotaMetadataRows(state: SidebarState): Array<{
60
60
  value: string;
61
61
  }>;
62
62
  export declare function formatSpendControlAmounts(spendControl: SpendControlReading): string;
63
- export declare function getAccountMetadataRows(resetCredits: number | undefined, spendControl?: SpendControlReading): Array<{
63
+ /**
64
+ * The account's own rows under its quota bars: the workspace budget's amounts
65
+ * (`credits`), the prepaid credits (`prepaid`, worded by `accountCreditsText`)
66
+ * and the reset-credit count (`resets`), each only when known. While the
67
+ * account is serving the session on its prepaid credits (its free quota is
68
+ * used up), the prepaid row says so in place of its `prepaid` label.
69
+ */
70
+ export declare function getAccountMetadataRows(resetCredits: number | undefined, spendControl?: SpendControlReading, prepaidCredits?: string, servingOnCredits?: boolean): Array<{
64
71
  label: string;
65
72
  value: string;
66
73
  }>;
74
+ export interface QuotaRowFit {
75
+ /** Cells of usage bar to draw; 0 draws no bar. */
76
+ barCells: number;
77
+ showReset: boolean;
78
+ }
79
+ /**
80
+ * How an expanded quota row fits on one line `columns` cells wide. The row is
81
+ * the padded label, the bar, the " N% left" figure and, at the right edge, the
82
+ * reset time. When it does not fit, the reset time goes first, then the bar
83
+ * shrinks (to no fewer than MIN_QUOTA_BAR_CELLS cells, else it is dropped).
84
+ * The label and the figure are never cut. `columns` of 0 means the row has not
85
+ * been measured yet, and everything is drawn.
86
+ */
87
+ export declare function fitQuotaRow(input: {
88
+ columns: number;
89
+ label: string;
90
+ barWidth: number;
91
+ figure: string;
92
+ resetText?: string;
93
+ }): QuotaRowFit;
67
94
  export declare function readStateFromFile(): Promise<SidebarState>;
68
95
  export declare function resolveQuotaDialogActiveId(state: SidebarState, sessionId: string | undefined, now?: number): string | undefined;
69
96
  export interface RoutingDisplayRow {
@@ -1,5 +1,5 @@
1
- import { h as BeginAccountLoginResult, i as CodexSessionMetadata, m as BeginAccountLoginOptions, o as PoolLifecycleDeps, p as OpenAiVaultOptions, r as CodexRequestRuntime, s as HostSlotAdapter, x as AccountPaths } from "../codex-request-B9D0e97Q.js";
2
- import { i as OpenDialogPayload, n as ApplyResult } from "../protocol-MysYPAho.js";
1
+ import { h as BeginAccountLoginResult, i as CodexSessionMetadata, m as BeginAccountLoginOptions, o as PoolLifecycleDeps, p as OpenAiVaultOptions, r as CodexRequestRuntime, s as HostSlotAdapter, x as AccountPaths } from "../codex-request-hw0XcldE.js";
2
+ import { i as OpenDialogPayload, n as ApplyResult } from "../protocol-CDqdjh74.js";
3
3
  import { Plugin } from "@opencode/plugin";
4
4
  import "@opencode/plugin/promise/session";
5
5
  import "@opencode/plugin/promise/integration";