@cortexkit/opencode-openai-auth 1.12.0 → 1.14.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/dist/bin.js +9 -9
- package/dist/{codex-request-DFeGDzpN.d.ts → codex-request-Cl6zEfsR.d.ts} +21 -3
- package/dist/{index-5p6vw484.js → index-1abcvt9p.js} +1 -1
- package/dist/{index-2xsz3z63.js → index-3c9pk6zn.js} +2 -2
- package/dist/{index-dcvxs9xj.js → index-4tpttpjw.js} +1 -1
- package/dist/index-4zpxwh8y.js +91 -0
- package/dist/{index-7p1s64b4.js → index-a9tzfpxy.js} +1 -1
- package/dist/index-bc2d4vma.js +64 -0
- package/dist/{index-wtmxk263.js → index-f7t7cc9b.js} +2 -2
- package/dist/{index-7qztyb1b.js → index-nfbmjq6g.js} +2 -2
- package/dist/{index-3pm1cvhy.js → index-q111b2h5.js} +1 -1
- package/dist/{index-3nwj0h10.js → index-wap9mf5f.js} +2 -2
- package/dist/{index-p4qaa85r.js → index-xxmaf5ks.js} +2 -2
- package/dist/index-yew3mp47.js +76 -0
- package/dist/index-zcpher1w.js +8 -0
- 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-dr80qm6g.js → token-6x4q5r2r.js} +1 -1
- package/dist/token-util-54mhq85x.js +1 -0
- package/dist/tui-preferences.js +1 -1
- package/dist/v2/server.d.ts +1 -1
- package/dist/v2/server.js +3 -3
- package/package.json +8 -7
- package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +89 -31
- package/src/tui-compiled/raw/shared/4825e03209d6ae3e-with-lock.js +19 -13
- package/src/tui-compiled/raw/shared/549daf371622c304-index.tsx +49 -607
- package/src/tui-compiled/raw/shared/723b00f96290a097-lock-record.js +55 -0
- package/src/tui-compiled/raw/shared/94f53cfd572ba4bb-availability.js +9 -1
- package/src/tui-compiled/raw/shared/a75d0d866c227b3f-index.tsx +681 -0
- package/src/tui-compiled/raw/shared/abd062d633e29fd2-pool-routing.js +21 -15
- package/src/tui-compiled/raw/shared/b9588ad4725c1d10-enrollment.js +110 -2
- package/src/tui-compiled/raw/shared/c97089ed4243981c-host.js +11 -7
- package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +148 -92
- package/src/tui-compiled/raw/shared/e8d3c8da776ef9cd-index.js +1 -1
- package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +89 -31
- package/src/tui-compiled/runtime/shared/4825e03209d6ae3e-with-lock.js +19 -13
- package/src/tui-compiled/runtime/shared/549daf371622c304-index.js +36 -674
- package/src/tui-compiled/runtime/shared/723b00f96290a097-lock-record.js +55 -0
- package/src/tui-compiled/runtime/shared/94f53cfd572ba4bb-availability.js +9 -1
- package/src/tui-compiled/runtime/shared/a75d0d866c227b3f-index.js +678 -0
- package/src/tui-compiled/runtime/shared/abd062d633e29fd2-pool-routing.js +21 -15
- package/src/tui-compiled/runtime/shared/b9588ad4725c1d10-enrollment.js +110 -2
- package/src/tui-compiled/runtime/shared/c97089ed4243981c-host.js +11 -7
- package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +148 -92
- package/src/tui-compiled/runtime/shared/e8d3c8da776ef9cd-index.js +1 -1
- package/dist/index-2egbrywb.js +0 -8
- package/dist/index-dqk0c7wr.js +0 -64
- package/dist/index-n5jtwtrs.js +0 -76
- package/dist/index-phgm1zwn.js +0 -91
- package/dist/token-util-97td5ex3.js +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{dg as $,eg as D,fg as h,gg as L0,ig as C,jg as N0,kg as b,lg as B0,mg as O0,og as l}from"./index-nfbmjq6g.js";import{randomUUID as k}from"node:crypto";import{link as v0,lstat as R,mkdir as f0,open as G0,readFile as C0,rename as M0,rm as L,stat as g}from"node:fs/promises";import{dirname as r,join as b0}from"node:path";import{resolve as I0}from"node:path";class y extends Error{path;code="ENOENT";constructor(z,G){super(`Lock record disappeared: ${z}`,{cause:G});this.path=z}}function f(z,G){return z instanceof D&&z.reason==="io-error"&&z.win32Code===5&&(z.stage==="read"||z.stage==="verify")&&G.some((Q)=>I0(Q)===z.path)}function M(z,G,Q){return z instanceof D&&z.reason==="io-error"&&z.win32Code===5&&z.stage===Q&&G.some((Z)=>I0(Z)===z.path)}async function I(z,G){try{return await G()}catch(Q){if(!f(Q,[z]))throw Q;try{return await G()}catch(Z){if(Z.code==="ENOENT")throw new y(z,Q);throw Q}}}import{join as u0,resolve as P0}from"node:path";function e(z,G){return`${z}.${G}.lock`}class A0 extends Error{details;constructor(z){super(`Timed out acquiring ${z.name} lock for ${z.target}`);this.name="LockContentionError",this.details=z}}class E extends Error{details;constructor(z){super(`Lost ${z.name} lock for ${z.target}`);this.name="LockOwnershipError",this.details=z}}function w0(z,G,Q){let Z=P0(e(G,Q)),J=[Z,u0(Z,"owner.json")];return(h(z)||f(z,J))&&(z.stage==="read"||z.stage==="verify")&&J.includes(z.path)||$&&(M(z,[Z],"create")||M(z,[`${Z}.evicting`],"directory-create"))}async function Hz(z,G,Q){let Z=performance.now(),J;for(;;){G.signal?.throwIfAborted();let _;try{_=await T0({path:z,name:G.name,ttlMs:G.ttlMs,renew:G.renew??!1,...G.onStep?{onStep:G.onStep}:{},...G.onRenewalTimer?{onRenewalTimer:G.onRenewalTimer}:{}}),J=void 0}catch(j){if(!w0(j,z,G.name))throw j;_=null,J??=j}if(_)try{return G.signal?.throwIfAborted(),await Q(_)}finally{await _.release(G.signal)}let W=G.timeoutMs-(performance.now()-Z);if(W<=0){if(J)throw J;throw new A0({target:z,name:G.name,timeoutMs:G.timeoutMs})}await new Promise((j)=>setTimeout(j,Math.min(25,Math.ceil(W))))}}var O;async function p0(z,G){let Q=`${z}.${k()}.tmp`,Z;try{Z=await G0(Q,"wx",384);try{if(O?.beforeWrite)await O.beforeWrite(Q);await Z.writeFile(G,"utf8")}finally{await Z.close()}try{if(O?.beforeLink)await O.beforeLink(Q,z);await v0(Q,z)}catch(J){let _=J.code;if(_!=="EPERM"&&_!=="ENOTSUP"&&_!=="EOPNOTSUPP"&&_!=="EXDEV")throw J;await y0(z,G)}}finally{if(Z)await L(Q,{force:!0}).catch(()=>{})}}async function y0(z,G){let Q=await G0(z,"wx",384),Z;try{Z=await Q.stat()}catch{Z=void 0}try{if(O?.beforeWrite)await O.beforeWrite(z);await Q.writeFile(G,"utf8")}catch(J){try{let _=await R(z).catch(()=>{return});if(Z&&_&&_.dev===Z.dev&&_.ino===Z.ino)await L(z,{force:!0}).catch(()=>{})}catch{}throw J}finally{await Q.close()}}var h0=globalThis.setTimeout.bind(globalThis),l0=globalThis.clearTimeout.bind(globalThis);function c0(z){let G=z?.code;return G==="ENOENT"||!$&&(G==="EINVAL"||G==="ENOTDIR")}var R0;function z0(z,G){if(z.dev!==G.dev||z.ino!==G.ino)return!1;if(z.ino===0&&z.birthtimeMs!==G.birthtimeMs)return!1;return!0}var d0=1000;function T0(z){return s0({...z,now:Date.now})}async function s0(z){let G=e(z.path,z.name),Q=b0(G,"owner.json"),Z=k(),J=z.now??Date.now,_=null,W=!1,j=!1,F,Q0,g0=new Promise((N)=>{Q0=N});function Y0(N){try{let B=z.onRenewalTimer?.(N);if(B&&(typeof B==="object"||typeof B==="function")&&"then"in B&&typeof B.then==="function")Promise.resolve(B).catch(()=>{})}catch{}}function Z0(){if(!_)return;l0(_),_=null,Y0("cancelled")}function T(N,B){if(F||W)return;F=Object.freeze({reason:N,expectedOwnerId:Z,...typeof B?.ownerId==="string"?{observedOwnerId:B.ownerId}:{},...typeof B?.expiresAt==="number"?{observedExpiresAt:B.expiresAt}:{}}),Z0(),Q0(F)}let d,m=null,X=`${G}.evicting`,x=b0(X,"owner.json"),$0=k(),s=5000,J0=8;function u(N){return $&&(M(N,[G],"create")||M(N,[X],"directory-create"))}async function S(){if($)try{return JSON.parse(await I(G,()=>b(G,!0)))}catch(N){if(N.code!=="EISDIR"&&N.reason!=="wrong-kind")throw N;return await I(G,()=>C(G,"directory",!0)),JSON.parse(await I(Q,()=>b(Q,!0)))}try{return JSON.parse(await C0(G,"utf8"))}catch(N){if(N.code!=="EISDIR")throw N;return JSON.parse(await C0(Q,"utf8"))}}async function k0(){if($){let K=await S(),Y=Number(K?.expiresAt)-J();await l(G,`${JSON.stringify({ownerId:Z,expiresAt:J()+z.ttlMs})}
|
|
2
|
+
`,{deadline:performance.now()+Math.max(0,Y),beforeRename:async()=>{let V=await S();if(V?.ownerId!==Z||!(Number(V?.expiresAt)>J())||!await q())throw new E({target:z.path,name:z.name})}});return}let N=`${G}.${k()}.tmp`,B,H=!1;try{B=await G0(N,"wx",384),H=!0,await B.writeFile(`${JSON.stringify({ownerId:Z,expiresAt:J()+z.ttlMs})}
|
|
3
|
+
`,"utf8"),await B.chmod(384),await B.close(),B=void 0;let K=await S();if(K?.ownerId!==Z||!(Number(K?.expiresAt)>J())||!await q())throw new E({target:z.path,name:z.name});await M0(N,G),H=!1}finally{if(await B?.close().catch(()=>{}),H)await L(N,{force:!0}).catch(()=>{})}}async function _0(){let N=`${JSON.stringify({ownerId:Z,expiresAt:J()+z.ttlMs})}
|
|
4
|
+
`;if($)await B0(G,N);else await p0(G,N)}async function X0(N){let B=N.code;if(B!=="EEXIST"&&B!=="EISDIR")return!1;if($){if(z.onStep)await z.onStep("lease-contention-read-ready");try{if(B==="EISDIR")await I(G,()=>C(G,"directory",!0)),await I(Q,()=>b(Q,!0));else await S()}catch(H){if(H.code!=="ENOENT")throw H}}return!0}async function i(){if($)await N0(r(G));try{return await _0(),!0}catch(N){let B=N.code;if(await X0(N))return!1;if(B==="ENOENT"){if($)await N0(r(G));else await f0(r(G),{recursive:!0});try{return await _0(),!0}catch(H){if(await X0(H))return!1;throw H}}throw N}}async function P(){await new Promise((N)=>setTimeout(N,Math.floor(Math.random()*4)))}async function n(N=!0){if(N&&z.onStep)await z.onStep("lock-read-ready");let B;try{B=await S()}catch(K){if(K instanceof y)return{status:"missing"};if($&&K.code!=="ENOENT")throw K}let H=Number(B?.expiresAt);if(Number.isFinite(H)&&H>J())return{status:"live"};if(typeof B?.ownerId==="string"&&Number.isFinite(H))return{status:"stale",identity:{kind:"owner",ownerId:B.ownerId,expiresAt:H}};try{let K=await g(G),Y=Number.isFinite(H)?H:K.mtimeMs+z.ttlMs;if(Y>J())return{status:"live"};return{status:"stale",identity:{kind:"stat",dev:K.dev,ino:K.ino,mtimeMs:K.mtimeMs,expiresAt:Y}}}catch(K){if(K.code==="ENOENT"){if(z.onStep)await z.onStep("lock-missing");return{status:"missing"}}throw K}}function U0(N,B){if(B.status!=="stale")return!1;let H=B.identity;if(N.kind==="owner"&&H.kind==="owner")return N.ownerId===H.ownerId&&N.expiresAt===H.expiresAt;return N.kind==="stat"&&H.kind==="stat"&&N.dev===H.dev&&N.ino===H.ino&&N.mtimeMs===H.mtimeMs&&N.expiresAt===H.expiresAt}async function q(){try{return JSON.parse(await I(x,()=>b(x,$)))?.ownerId===$0}catch(N){if($&&N.code!=="ENOENT")throw N;return!1}}async function a(N){if($)await L0(N,"remove",()=>L(N,{recursive:!0,force:!0}));else await L(N,{recursive:!0,force:!0}).catch(()=>{})}function w(N,B){if(!$||!(N instanceof D)||N.stage!=="remove"||N.path!==B)return!1;return h(N)||N.win32Code===void 0&&N.reason===void 0&&(N.code==="EBUSY"||N.code==="EPERM")}async function t(N,B,H=performance.now()+s+1000){let K,Y=5;while(await B()){try{await a(N);return}catch(U){if(!w(U,N))throw U;K??=U}let V=H-performance.now();if(V<=0)throw K;if(await new Promise((U)=>setTimeout(U,Math.min(Y,V))),performance.now()>=H)throw K;Y=Math.min(Y*2,50)}}async function o(N){let B;await t(X,async()=>{if(!$)return q();let H=await R(X).catch((K)=>{if(K.code!=="ENOENT")throw K;return});if(!H||B&&!z0(B,H))return!1;if(await q())return B=H,!0;if(!B)return!1;try{return await g(x),!1}catch(K){if(K.code!=="ENOENT")throw K;return!0}},N)}async function m0(N,B){if(!N)return!1;let H=!1;try{await t(X,async()=>{H=!1;let K=await R(X).catch(()=>{return});if(!K||!z0(N,K))return!1;H=!0;try{return await g(x),!1}catch(Y){return Y.code==="ENOENT"}},B)}catch{}return H}async function V0(N){if($)await O0(X);else await f0(X);let B;try{let H=await R(X);B={dev:H.dev,ino:H.ino,birthtimeMs:H.birthtimeMs}}catch{B=void 0}try{await R0?.beforeOwnerWrite?.(X,x);let H=await R0?.failOwnerWrite?.(X,x);if(H!==void 0)throw H;let K=`${JSON.stringify({ownerId:$0,createdAt:J()})}
|
|
5
|
+
`;if($)await B0(x,K);else await y0(x,K)}catch(H){let K=await m0(B,N);if(c0(H)&&!K)return!1;try{await o(N)}catch{}throw H}if(z.onStep)await z.onStep("eviction-marker-acquired");return!0}async function W0(N){let B;try{B=await g(X)}catch(Y){if(Y.code==="ENOENT")return"missing";throw Y}if($)try{await I(X,()=>C(X,"directory",!0))}catch(Y){if(Y.code==="ENOENT")return"missing";throw Y}if(B.mtimeMs+s>J()){let Y=!0;try{await g(x)}catch(V){if(V.code==="ENOENT")Y=!1;else return"fresh"}if(Y)return"fresh";if(B.mtimeMs+d0>J())return"fresh"}if(z.onStep)await z.onStep("stale-marker-stat");let H=`${X}.${k()}`;try{await M0(X,H)}catch(Y){if(Y.code==="ENOENT")return"missing";throw Y}if(z.onStep)await z.onStep("stale-marker-claimed");let K=$?await R(H):void 0;return await t(H,async()=>{if(!K)return!0;let Y=await R(H).catch((V)=>{if(V.code!=="ENOENT")throw V;return});return!!Y&&z0(K,Y)},N),"recovered"}async function x0(N,B){try{if(!await V0(B))return!1}catch(Y){if(Y.code==="EEXIST"){if($)try{await I(X,()=>C(X,"directory",!0)),await I(x,()=>b(x,!0))}catch(V){if(V.code!=="ENOENT")throw V}return!1}throw Y}let H=!1,K;try{await N()}catch(Y){H=!0,K=Y}try{await o(B)}catch(Y){if((w(K,G)||f(K,[G,Q,x]))&&(w(Y,X)||f(Y,[x])))throw K;throw Y}if(H)throw K;return!0}async function j0(){for(let N=0;N<J0;N++){if(z.onStep)await z.onStep("relinquish-read");let B;try{B=await S()}catch(H){if($&&!(H instanceof y))throw H;return}if(B?.ownerId!==Z)return;try{await L(G,{recursive:!0,force:!0});return}catch(H){if($)throw H;await P()}}}function F0(){if(!z.renew||W||F)return;let N=z.renewIntervalMs??Math.max(1000,Math.floor(z.ttlMs/3));if(_=h0(()=>{_=null;let B=(async()=>{let H=!W;try{if(!await x0(async()=>{let Y=await S(),V=J();if(W||F){H=!1;return}if(Y?.ownerId!==Z){T("taken-over",Y),H=!1;return}if(!(Number(Y?.expiresAt)>V)){T("expired",Y),H=!1;return}if(z.onStep)await z.onStep("renewal-owner-confirmed");if(W||F){H=!1;return}if(!await q())return;if(z.onStep)await z.onStep("renewal-write-fenced");if(W||F){H=!1;return}if(!await q())return;if(z.onStep)await z.onStep("renewal-write-ready");if(W||F){H=!1;return}if(await k0(),z.onStep)await z.onStep("renewal-write-finished");if(!await q()){T("marker-lost"),H=!1,await j0();return}})&&z.onStep)await z.onStep("renewal-marker-unavailable")}catch(K){if($&&K instanceof D&&!u(K))d=K,T("renewal-failed"),H=!1;try{let Y=await S();if(Y?.ownerId!==Z)T("taken-over",Y);else if(!(Number(Y?.expiresAt)>J()))T("expired",Y)}catch{T("renewal-failed")}}finally{if(z.onStep)try{await z.onStep("renewal-finished")}catch{}if(H&&!W&&!F)F0()}})();m=B,B.finally(()=>{if(m===B)m=null})},N),"unref"in _)_.unref();Y0("scheduled")}function q0(){try{let N=z.onContended?.();if(N&&(typeof N==="object"||typeof N==="function")&&"then"in N&&typeof N.then==="function")Promise.resolve(N).catch(()=>{})}catch{}return null}let A=!1,v;try{A=await i()}catch(N){if(!u(N))throw N;v=N}if(!A)for(let N=0;N<J0;N++)try{if(A=await i(),A)break;let B=await n();if(B.status==="live")return q0();if(B.status==="missing")continue;if(z.onStep)await z.onStep("stale-lock-observed");try{if(!await V0()){await P();continue}}catch(H){if(H.code!=="EEXIST")throw H;if(await W0()==="fresh")return null;await P();continue}try{let H=await n();if(H.status==="live")return q0();if(!U0(B.identity,H))continue;if(!await q())return null;if(z.onStep)await z.onStep("stale-lock-confirmed");if(!await q())return null;let K=await n(!1);if(!U0(B.identity,K))continue;if(await a(G),!await q())return null;if(z.onStep)await z.onStep("stale-lock-removed");if(A=await i(),!A)return null;if(z.onStep)await z.onStep("stale-lock-recreated");if(!await q())return await j0(),A=!1,null;break}finally{await o()}}catch(B){if(!u(B))throw B;v??=B,await P()}if(!A){if(v)throw v;return null}return F0(),{ownerId:Z,whenLost:()=>g0,hasLost:()=>F!==void 0,assertOwned:async()=>{if(d)throw d;let N;try{let B=await S();if(N=B,!W&&!F&&B?.ownerId===Z&&Number(B?.expiresAt)>J())return;T(B?.ownerId!==Z?"taken-over":"expired",B)}catch(B){if(T("unreadable"),$&&B instanceof D)throw B}throw new E({target:z.path,name:z.name,expectedOwnerId:Z,...typeof N?.ownerId==="string"?{observedOwnerId:N.ownerId}:{},...typeof N?.expiresAt==="number"?{observedExpiresAt:N.expiresAt}:{}})},release:async(N)=>{if($&&j)return;W=!0,Z0(),await m;let B=performance.now()+s+1000,H=5,K,Y;for(;;){try{let U=!1,p=await x0(async()=>{let D0;try{D0=await S()}catch(S0){if($&&S0.code==="ENOENT"){U=!0;return}throw S0}if(D0?.ownerId!==Z){U=!0;return}if(z.onStep)await z.onStep("release-owner-confirmed");if(!await q())return;await a(G),U=!0},B);if(Y=void 0,p){if($&&!U)throw new D(G,"release-not-confirmed",{code:"EIO"});j=U;return}if(N?.aborted)return;await W0(B)}catch(U){let p=$&&(u(U)||f(U,[G,Q,X,x]));if(!w(U,G)&&!p){if($)throw U;return}if(p)Y??=U;else K??=U}let V=B-performance.now();if(V<=0)break;if(await new Promise((U)=>setTimeout(U,Math.min(H,V))),$&&performance.now()>=B)break;H=Math.min(H*2,50)}if($)throw Y??K??new D(G,"release-not-confirmed",{code:"ETIMEDOUT"})}}}import{randomUUID as E0}from"node:crypto";import{mkdir as i0,open as c,rename as n0,rm as a0}from"node:fs/promises";import{dirname as H0}from"node:path";class K0 extends Error{constructor(z){super("file or directory sync failed",{cause:z});this.name="AtomicSyncError"}}async function jz(z,G,Q={}){await t0(z,G,Q)}async function t0(z,G,Q,Z){if($)return l(z,Q.serialize?Q.serialize(G):`${JSON.stringify(G,null,2)}
|
|
6
|
+
`,{beforeRename:Q.beforeRename,stagePath:`${z}.${(Q.stageName??E0)()}.tmp`,onRenamed:Z,durable:Q.durable,durability:Q.durability,onOutcome:Q.onOutcome});await i0(H0(z),{recursive:!0});let J=`${z}.${(Q.stageName??E0)()}.tmp`,_,W=!1;try{if(_=await c(J,"wx",384),W=!0,await _.writeFile(Q.serialize?Q.serialize(G):`${JSON.stringify(G,null,2)}
|
|
7
|
+
`,"utf8"),await _.chmod(384),Q.durable)try{await _.sync()}catch(j){throw new K0(j)}if(await _.close(),_=void 0,await Q.beforeRename?.(),await n0(J,z),W=!1,Z?.(),Q.durable){let j=await c(H0(z),"r");try{await j.sync()}catch(F){throw new K0(F)}finally{await j.close()}}}finally{if(await _?.close().catch(()=>{}),W)await a0(J,{force:!0}).catch(()=>{})}}async function Fz(z){if($){await C(z,"file");let Z=new D(z,"directory-sync-unsupported",{code:"ENOTSUP"});throw Z.published=!0,Z}let G=await c(z,"r");try{await G.sync()}finally{await G.close()}let Q=await c(H0(z),"r");try{await Q.sync()}finally{await Q.close()}}var Dz=Object.freeze({sidebar:Object.freeze({name:"sidebar-write",ttlMs:1e4,timeoutMs:15000,renew:!0}),preferences:Object.freeze({name:"preferences",ttlMs:1e4,timeoutMs:2000,renew:!0})});
|
|
8
|
+
export{K0 as uf,jz as vf,t0 as wf,Fz as xf,T0 as yf,e as zf,A0 as Af,E as Bf,Hz as Cf,Dz as Df};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as parseJwtClaims, a as RESPONSES_LITE_MODELS, g as extractAccountIdFromClaims, h as TokenResponse, l as ResetTargetIdentity, m as IdTokenClaims, n as CODEX_VERSION, o as RuntimeLayoutOptions, s as PoolLifecycleDeps, t as CODEX_USER_AGENT, u as OpenAiVault, v as AccountPaths } from "./codex-request-
|
|
1
|
+
import { _ as parseJwtClaims, a as RESPONSES_LITE_MODELS, g as extractAccountIdFromClaims, h as TokenResponse, l as ResetTargetIdentity, m as IdTokenClaims, n as CODEX_VERSION, o as RuntimeLayoutOptions, s as PoolLifecycleDeps, t as CODEX_USER_AGENT, u as OpenAiVault, v as AccountPaths } from "./codex-request-Cl6zEfsR.js";
|
|
2
2
|
import { S as SidebarState, y as SidebarMachineState } from "./sidebar-state-CrRiE9hw.js";
|
|
3
3
|
import { Hooks, Plugin, PluginInput } from "@opencode-ai/plugin";
|
|
4
4
|
type QuotaWindowName = string;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as w,K as f,L as g,M as h,N as i,O as j,P as k,Q as l,R as m,S as n,T as o,U as p,V as q,W as r,X as s,Y as t,Z as u,_ as v,aa as x,ba as y,ca as z,da as A,ea as B,fa as C,ga as D,ha as E,ia as F,j as c,ja as G,k as d,l as e}from"./index-
|
|
1
|
+
import{$ as w,K as f,L as g,M as h,N as i,O as j,P as k,Q as l,R as m,S as n,T as o,U as p,V as q,W as r,X as s,Y as t,Z as u,_ as v,aa as x,ba as y,ca as z,da as A,ea as B,fa as C,ga as D,ha as E,ia as F,j as c,ja as G,k as d,l as e}from"./index-bc2d4vma.js";import"./index-yew3mp47.js";import"./index-f7t7cc9b.js";import{le as a,me as b}from"./index-4zpxwh8y.js";import"./index-zcpher1w.js";import"./index-xxmaf5ks.js";import"./index-3c9pk6zn.js";import"./index-wap9mf5f.js";import"./index-nfbmjq6g.js";import"./index-q111b2h5.js";import"./index-1abcvt9p.js";export{D as rewriteResponsesLiteBody,B as resolveSidebarSessionId,s as poolResetTarget,a as parseJwtClaims,y as mergePushedQuotaMetadata,l as getMainRefreshLockName,x as findCachekeepFallbackAccount,b as extractAccountIdFromClaims,G as default,t as createResetTargetResolver,j as codexOAuthModelVariantSource,h as codexOAuthModelListed,i as codexOAuthModelLimit,A as buildSidebarState,z as buildSidebarMachineState,u as buildResetRedemptionDeps,p as __resetBootQuotaSeedForTest,v as __menuContextForTest,o as __bootQuotaSeedPromiseForTest,r as ResetTargetResolutionError,c as RESPONSES_LITE_MODELS,w as POOL_MIGRATION_ENABLED,F as OpenAIAuthPlugin,C as MID_CONVERSATION_EFFORT_MODELS,m as MAIN_REFRESH_LOCK_TTL_MS,n as MAIN_REFRESH_LEASE_TTL_MS,k as EMPTY_BEARER_MESSAGE,g as DISALLOWED_MODELS,E as CodexAuthPlugin,d as CODEX_VERSION,e as CODEX_USER_AGENT,q as AuthPersistError,f as ALLOWED_MODELS};
|
package/dist/rpc/port-file.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Kf as b,Lf as c}from"../index-xxmaf5ks.js";import{Pf as a}from"../index-3c9pk6zn.js";import"../index-nfbmjq6g.js";import"../index-q111b2h5.js";import"../index-1abcvt9p.js";export{b as writePortFile,c as isOpenaiRpcStateDir,a as discoverPortFile};
|
package/dist/rpc/protocol.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bg as b}from"../index-wap9mf5f.js";import"../index-nfbmjq6g.js";import"../index-1abcvt9p.js";export{b as isNotifyPayload};
|
package/dist/rpc/rpc-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Qf as F,Rf as f}from"../index-3c9pk6zn.js";import"../index-nfbmjq6g.js";import"../index-1abcvt9p.js";function y(r,s,v){return f(r,s,v)}export{y as createRpcClient,F as DEFAULT_RPC_TIMEOUT_MS};
|
package/dist/rpc/rpc-dir.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{pg as a,qg as b,rg as c,sg as d}from"../index-q111b2h5.js";import"../index-1abcvt9p.js";export{a as tmpdir,d as resolveRpcDir,c as getRpcDir,b as RPC_DIRECTORY_PREFIX};
|
package/dist/sidebar-state.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$c as
|
|
1
|
+
import{$c as D,Ac as c,Bc as d,Cc as e,Dc as f,Ec as g,Fc as h,Gc as i,Hc as j,Ic as k,Jc as l,Kc as m,Lc as n,Mc as o,Nc as p,Oc as q,Pc as r,Qc as s,Rc as t,Sc as u,Tc as v,Uc as w,Vc as x,Wc as y,Xc as z,Yc as A,Zc as B,_c as C,ad as E,bd as F,cd as G,dd as H,ed as I,fd as J,gd as K,hd as L,id as M,jd as N,kd as O,ld as P,md as Q,nd as R,od as S,pd as T,yc as a,zc as b}from"./index-f7t7cc9b.js";import"./index-4zpxwh8y.js";import"./index-zcpher1w.js";import"./index-wap9mf5f.js";import"./index-nfbmjq6g.js";import"./index-1abcvt9p.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-
|
|
1
|
+
import{a as U,b as V}from"./index-4tpttpjw.js";import{tg as R}from"./index-1abcvt9p.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-4tpttpjw.js";import"./index-1abcvt9p.js";export default a();
|
package/dist/tui-preferences.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Cf as u,Df as P,vf as h}from"./index-zcpher1w.js";import{dg as M,eg as R,kg as S}from"./index-nfbmjq6g.js";import"./index-1abcvt9p.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/v2/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as HostSlotAdapter, d as OpenAiVaultOptions, f as BeginAccountLoginOptions, i as CodexSessionMetadata, o as RuntimeLayoutOptions, p as BeginAccountLoginResult, r as CodexRequestRuntime, s as PoolLifecycleDeps, v as AccountPaths } from "../codex-request-
|
|
1
|
+
import { c as HostSlotAdapter, d as OpenAiVaultOptions, f as BeginAccountLoginOptions, i as CodexSessionMetadata, o as RuntimeLayoutOptions, p as BeginAccountLoginResult, r as CodexRequestRuntime, s as PoolLifecycleDeps, v as AccountPaths } from "../codex-request-Cl6zEfsR.js";
|
|
2
2
|
import { i as OpenDialogPayload, n as ApplyResult } from "../protocol-BZZtDn5h.js";
|
|
3
3
|
import { Plugin } from "@opencode/plugin";
|
|
4
4
|
import "@opencode/plugin/promise/integration";
|