@cortexkit/opencode-openai-auth 1.11.0 → 1.13.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 (53) hide show
  1. package/dist/bin.js +8 -8
  2. package/dist/{codex-request-DFeGDzpN.d.ts → codex-request-Bu2sjxQn.d.ts} +1 -0
  3. package/dist/{index-4rzatybc.js → index-0bh5fs56.js} +1 -1
  4. package/dist/{index-d5v2rn54.js → index-2ccfywax.js} +1 -1
  5. package/dist/index-2g95z7kb.js +64 -0
  6. package/dist/index-4s50rsec.js +8 -0
  7. package/dist/index-7s8g79dd.js +91 -0
  8. package/dist/{index-2p3st53v.js → index-cs0tey1r.js} +2 -2
  9. package/dist/index-khqwa7g2.js +76 -0
  10. package/dist/{index-dp68014q.js → index-p8v28mh9.js} +2 -2
  11. package/dist/{index-smzgsx6x.js → index-r8y79mzp.js} +1 -1
  12. package/dist/{index-7at0fc03.js → index-rhe4jm5t.js} +2 -2
  13. package/dist/{index-bxxjwt4q.js → index-th0bzvpn.js} +2 -2
  14. package/dist/{index-4daebegf.js → index-tzrf3ax2.js} +1 -1
  15. package/dist/{index-afpxnan1.js → index-zmerz2yv.js} +2 -2
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/rpc/port-file.js +1 -1
  19. package/dist/rpc/protocol.js +1 -1
  20. package/dist/rpc/rpc-client.js +1 -1
  21. package/dist/rpc/rpc-dir.js +1 -1
  22. package/dist/sidebar-state.js +1 -1
  23. package/dist/{token-wgntcjq1.js → token-2qht8n50.js} +1 -1
  24. package/dist/token-util-20g3fwxd.js +1 -0
  25. package/dist/tui-preferences.js +1 -1
  26. package/dist/v2/server.d.ts +1 -1
  27. package/dist/v2/server.js +3 -3
  28. package/package.json +4 -3
  29. package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +89 -31
  30. package/src/tui-compiled/raw/shared/4825e03209d6ae3e-with-lock.js +19 -13
  31. package/src/tui-compiled/raw/shared/549daf371622c304-index.tsx +49 -607
  32. package/src/tui-compiled/raw/shared/723b00f96290a097-lock-record.js +55 -0
  33. package/src/tui-compiled/raw/shared/94f53cfd572ba4bb-availability.js +9 -1
  34. package/src/tui-compiled/raw/shared/a75d0d866c227b3f-index.tsx +681 -0
  35. package/src/tui-compiled/raw/shared/b9588ad4725c1d10-enrollment.js +33 -2
  36. package/src/tui-compiled/raw/shared/c97089ed4243981c-host.js +11 -7
  37. package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +148 -92
  38. package/src/tui-compiled/raw/shared/e8d3c8da776ef9cd-index.js +1 -1
  39. package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +89 -31
  40. package/src/tui-compiled/runtime/shared/4825e03209d6ae3e-with-lock.js +19 -13
  41. package/src/tui-compiled/runtime/shared/549daf371622c304-index.js +36 -674
  42. package/src/tui-compiled/runtime/shared/723b00f96290a097-lock-record.js +55 -0
  43. package/src/tui-compiled/runtime/shared/94f53cfd572ba4bb-availability.js +9 -1
  44. package/src/tui-compiled/runtime/shared/a75d0d866c227b3f-index.js +678 -0
  45. package/src/tui-compiled/runtime/shared/b9588ad4725c1d10-enrollment.js +33 -2
  46. package/src/tui-compiled/runtime/shared/c97089ed4243981c-host.js +11 -7
  47. package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +148 -92
  48. package/src/tui-compiled/runtime/shared/e8d3c8da776ef9cd-index.js +1 -1
  49. package/dist/index-0kpq9310.js +0 -76
  50. package/dist/index-3x7q1rj8.js +0 -8
  51. package/dist/index-cy6km6cz.js +0 -64
  52. package/dist/index-h2z9jb3g.js +0 -91
  53. package/dist/token-util-e49kkftr.js +0 -1
@@ -1,8 +0,0 @@
1
- import{$f as i,Vf as $,Wf as C,Xf as y,Yf as S0,_f as A,ag as f,bg as n,cg as A0,eg as k}from"./index-dp68014q.js";import{randomUUID as g}from"node:crypto";import{link as O0,lstat as T,mkdir as x0,open as t,readFile as F0,rename as j0,rm as R,stat as b}from"node:fs/promises";import{dirname as s,join as q0}from"node:path";import{join as L0,resolve as b0}from"node:path";function d(z,H){return`${z}.${H}.lock`}class D0 extends Error{details;constructor(z){super(`Timed out acquiring ${z.name} lock for ${z.target}`);this.name="LockContentionError",this.details=z}}class L extends Error{details;constructor(z){super(`Lost ${z.name} lock for ${z.target}`);this.name="LockOwnershipError",this.details=z}}function g0(z,H,Y){if(!y(z)||z.stage!=="read"&&z.stage!=="verify")return!1;let Z=b0(d(H,Y));return z.path===Z||z.path===L0(Z,"owner.json")}async function s0(z,H,Y){let Z=performance.now();for(;;){H.signal?.throwIfAborted();let J,W;try{J=await V0({path:z,name:H.name,ttlMs:H.ttlMs,renew:H.renew??!1,...H.onStep?{onStep:H.onStep}:{},...H.onRenewalTimer?{onRenewalTimer:H.onRenewalTimer}:{}})}catch(V){if(!g0(V,z,H.name))throw V;J=null,W=V}if(J)try{return H.signal?.throwIfAborted(),await Y(J)}finally{await J.release(H.signal)}let X=H.timeoutMs-(performance.now()-Z);if(X<=0){if(W)throw W;throw new D0({target:z,name:H.name,timeoutMs:H.timeoutMs})}await new Promise((V)=>setTimeout(V,Math.min(25,Math.ceil(X))))}}var M;async function E0(z,H){let Y=`${z}.${g()}.tmp`,Z;try{Z=await t(Y,"wx",384);try{if(M?.beforeWrite)await M.beforeWrite(Y);await Z.writeFile(H,"utf8")}finally{await Z.close()}try{if(M?.beforeLink)await M.beforeLink(Y,z);await O0(Y,z)}catch(J){let W=J.code;if(W!=="EPERM"&&W!=="ENOTSUP"&&W!=="EOPNOTSUPP"&&W!=="EXDEV")throw J;await I0(z,H)}}finally{if(Z)await R(Y,{force:!0}).catch(()=>{})}}async function I0(z,H){let Y=await t(z,"wx",384),Z;try{Z=await Y.stat()}catch{Z=void 0}try{if(M?.beforeWrite)await M.beforeWrite(z);await Y.writeFile(H,"utf8")}catch(J){try{let W=await T(z).catch(()=>{return});if(Z&&W&&W.dev===Z.dev&&W.ino===Z.ino)await R(z,{force:!0}).catch(()=>{})}catch{}throw J}finally{await Y.close()}}var y0=globalThis.setTimeout.bind(globalThis),k0=globalThis.clearTimeout.bind(globalThis);function P0(z){let H=z?.code;return H==="ENOENT"||!$&&(H==="EINVAL"||H==="ENOTDIR")}var C0;function a(z,H){if(z.dev!==H.dev||z.ino!==H.ino)return!1;if(z.ino===0&&z.birthtimeMs!==H.birthtimeMs)return!1;return!0}var u0=1000;function V0(z){return m0({...z,now:Date.now})}async function m0(z){let H=d(z.path,z.name),Y=q0(H,"owner.json"),Z=g(),J=z.now??Date.now,W=null,X=!1,V=!1,D,e,T0=new Promise((N)=>{e=N});function z0(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 N0(){if(!W)return;k0(W),W=null,z0("cancelled")}function j(N,B){if(D||X)return;D=Object.freeze({reason:N,expectedOwnerId:Z,...typeof B?.ownerId==="string"?{observedOwnerId:B.ownerId}:{},...typeof B?.expiresAt==="number"?{observedExpiresAt:B.expiresAt}:{}}),N0(),e(D)}let u,O=null,U=`${H}.evicting`,q=q0(U,"owner.json"),B0=g(),m=5000,G0=8;async function F(){if($)try{return JSON.parse(await f(H,!0))}catch(N){if(N.code!=="EISDIR"&&N.reason!=="wrong-kind")throw N;return await A(H,"directory",!0),JSON.parse(await f(Y,!0))}try{return JSON.parse(await F0(H,"utf8"))}catch(N){if(N.code!=="EISDIR")throw N;return JSON.parse(await F0(Y,"utf8"))}}async function R0(){if($){let K=await F(),Q=Number(K?.expiresAt)-J();await k(H,`${JSON.stringify({ownerId:Z,expiresAt:J()+z.ttlMs})}
2
- `,{deadline:performance.now()+Math.max(0,Q),beforeRename:async()=>{let _=await F();if(_?.ownerId!==Z||!(Number(_?.expiresAt)>J())||!await x())throw new L({target:z.path,name:z.name})}});return}let N=`${H}.${g()}.tmp`,B,G=!1;try{B=await t(N,"wx",384),G=!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 F();if(K?.ownerId!==Z||!(Number(K?.expiresAt)>J())||!await x())throw new L({target:z.path,name:z.name});await j0(N,H),G=!1}finally{if(await B?.close().catch(()=>{}),G)await R(N,{force:!0}).catch(()=>{})}}async function H0(){let N=`${JSON.stringify({ownerId:Z,expiresAt:J()+z.ttlMs})}
4
- `;if($)await n(H,N);else await E0(H,N)}async function K0(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 A(H,"directory",!0),await f(Y,!0);else await F()}catch(G){if(G.code!=="ENOENT")throw G}}return!0}async function w(){if($)await i(s(H));try{return await H0(),!0}catch(N){let B=N.code;if(await K0(N))return!1;if(B==="ENOENT"){if($)await i(s(H));else await x0(s(H),{recursive:!0});try{return await H0(),!0}catch(G){if(await K0(G))return!1;throw G}}throw N}}async function v(){await new Promise((N)=>setTimeout(N,Math.floor(Math.random()*4)))}async function h(N=!0){if(N&&z.onStep)await z.onStep("lock-read-ready");let B;try{B=await F()}catch(K){if($&&K.code!=="ENOENT")throw K}let G=Number(B?.expiresAt);if(Number.isFinite(G)&&G>J())return{status:"live"};if(typeof B?.ownerId==="string"&&Number.isFinite(G))return{status:"stale",identity:{kind:"owner",ownerId:B.ownerId,expiresAt:G}};try{let K=await b(H),Q=Number.isFinite(G)?G:K.mtimeMs+z.ttlMs;if(Q>J())return{status:"live"};return{status:"stale",identity:{kind:"stat",dev:K.dev,ino:K.ino,mtimeMs:K.mtimeMs,expiresAt:Q}}}catch(K){if(K.code==="ENOENT"){if(z.onStep)await z.onStep("lock-missing");return{status:"missing"}}throw K}}function Q0(N,B){if(B.status!=="stale")return!1;let G=B.identity;if(N.kind==="owner"&&G.kind==="owner")return N.ownerId===G.ownerId&&N.expiresAt===G.expiresAt;return N.kind==="stat"&&G.kind==="stat"&&N.dev===G.dev&&N.ino===G.ino&&N.mtimeMs===G.mtimeMs&&N.expiresAt===G.expiresAt}async function x(){try{return JSON.parse(await f(q,$))?.ownerId===B0}catch(N){if($&&N.code!=="ENOENT")throw N;return!1}}async function p(N){if($)await S0(N,"remove",()=>R(N,{recursive:!0,force:!0}));else await R(N,{recursive:!0,force:!0}).catch(()=>{})}function E(N,B){if(!$||!(N instanceof C)||N.stage!=="remove"||N.path!==B)return!1;return y(N)||N.win32Code===void 0&&N.reason===void 0&&(N.code==="EBUSY"||N.code==="EPERM")}async function c(N,B,G=performance.now()+m+1000){let K,Q=5;while(await B()){try{await p(N);return}catch(I){if(!E(I,N))throw I;K??=I}let _=G-performance.now();if(_<=0)throw K;if(await new Promise((I)=>setTimeout(I,Math.min(Q,_))),performance.now()>=G)throw K;Q=Math.min(Q*2,50)}}async function l(N){let B;await c(U,async()=>{if(!$)return x();let G=await T(U).catch((K)=>{if(K.code!=="ENOENT")throw K;return});if(!G||B&&!a(B,G))return!1;if(await x())return B=G,!0;if(!B)return!1;try{return await b(q),!1}catch(K){if(K.code!=="ENOENT")throw K;return!0}},N)}async function M0(N,B){if(!N)return!1;let G=!1;try{await c(U,async()=>{G=!1;let K=await T(U).catch(()=>{return});if(!K||!a(N,K))return!1;G=!0;try{return await b(q),!1}catch(Q){return Q.code==="ENOENT"}},B)}catch{}return G}async function Y0(N){if($)await A0(U);else await x0(U);let B;try{let G=await T(U);B={dev:G.dev,ino:G.ino,birthtimeMs:G.birthtimeMs}}catch{B=void 0}try{await C0?.beforeOwnerWrite?.(U,q);let G=await C0?.failOwnerWrite?.(U,q);if(G!==void 0)throw G;let K=`${JSON.stringify({ownerId:B0,createdAt:J()})}
5
- `;if($)await n(q,K);else await I0(q,K)}catch(G){let K=await M0(B,N);if(P0(G)&&!K)return!1;try{await l(N)}catch{}throw G}if(z.onStep)await z.onStep("eviction-marker-acquired");return!0}async function Z0(N){let B;try{B=await b(U)}catch(Q){if(Q.code==="ENOENT")return"missing";throw Q}if($)try{await A(U,"directory",!0)}catch(Q){if(Q.code==="ENOENT")return"missing";throw Q}if(B.mtimeMs+m>J()){let Q=!0;try{await b(q)}catch(_){if(_.code==="ENOENT")Q=!1;else return"fresh"}if(Q)return"fresh";if(B.mtimeMs+u0>J())return"fresh"}if(z.onStep)await z.onStep("stale-marker-stat");let G=`${U}.${g()}`;try{await j0(U,G)}catch(Q){if(Q.code==="ENOENT")return"missing";throw Q}if(z.onStep)await z.onStep("stale-marker-claimed");let K=$?await T(G):void 0;return await c(G,async()=>{if(!K)return!0;let Q=await T(G).catch((_)=>{if(_.code!=="ENOENT")throw _;return});return!!Q&&a(K,Q)},N),"recovered"}async function $0(N,B){try{if(!await Y0(B))return!1}catch(Q){if(Q.code==="EEXIST"){if($)try{await A(U,"directory",!0),await f(q,!0)}catch(_){if(_.code!=="ENOENT")throw _}return!1}throw Q}let G=!1,K;try{await N()}catch(Q){G=!0,K=Q}try{await l(B)}catch(Q){if(E(K,H)&&E(Q,U))throw K;throw Q}if(G)throw K;return!0}async function J0(){for(let N=0;N<G0;N++){if(z.onStep)await z.onStep("relinquish-read");let B;try{B=await F()}catch(G){if($)throw G;return}if(B?.ownerId!==Z)return;try{await R(H,{recursive:!0,force:!0});return}catch(G){if($)throw G;await v()}}}function W0(){if(!z.renew||X||D)return;let N=z.renewIntervalMs??Math.max(1000,Math.floor(z.ttlMs/3));if(W=y0(()=>{W=null;let B=(async()=>{let G=!X;try{if(!await $0(async()=>{let Q=await F(),_=J();if(X||D){G=!1;return}if(Q?.ownerId!==Z){j("taken-over",Q),G=!1;return}if(!(Number(Q?.expiresAt)>_)){j("expired",Q),G=!1;return}if(z.onStep)await z.onStep("renewal-owner-confirmed");if(X||D){G=!1;return}if(!await x())return;if(z.onStep)await z.onStep("renewal-write-fenced");if(X||D){G=!1;return}if(!await x())return;if(z.onStep)await z.onStep("renewal-write-ready");if(X||D){G=!1;return}if(await R0(),z.onStep)await z.onStep("renewal-write-finished");if(!await x()){j("marker-lost"),G=!1,await J0();return}})&&z.onStep)await z.onStep("renewal-marker-unavailable")}catch(K){if($&&K instanceof C)u=K,j("renewal-failed"),G=!1;try{let Q=await F();if(Q?.ownerId!==Z)j("taken-over",Q);else if(!(Number(Q?.expiresAt)>J()))j("expired",Q)}catch{j("renewal-failed")}}finally{if(z.onStep)try{await z.onStep("renewal-finished")}catch{}if(G&&!X&&!D)W0()}})();O=B,B.finally(()=>{if(O===B)O=null})},N),"unref"in W)W.unref();z0("scheduled")}function _0(){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 S=await w();if(!S)for(let N=0;N<G0;N++){if(S=await w(),S)break;let B=await h();if(B.status==="live")return _0();if(B.status==="missing")continue;if(z.onStep)await z.onStep("stale-lock-observed");try{if(!await Y0()){await v();continue}}catch(G){if(G.code!=="EEXIST")throw G;if(await Z0()==="fresh")return null;await v();continue}try{let G=await h();if(G.status==="live")return _0();if(!Q0(B.identity,G))continue;if(!await x())return null;if(z.onStep)await z.onStep("stale-lock-confirmed");if(!await x())return null;let K=await h(!1);if(!Q0(B.identity,K))continue;if(await p(H),!await x())return null;if(z.onStep)await z.onStep("stale-lock-removed");if(S=await w(),!S)return null;if(z.onStep)await z.onStep("stale-lock-recreated");if(!await x())return await J0(),S=!1,null;break}finally{await l()}}if(!S)return null;return W0(),{ownerId:Z,whenLost:()=>T0,hasLost:()=>D!==void 0,assertOwned:async()=>{if(u)throw u;let N;try{let B=await F();if(N=B,!X&&!D&&B?.ownerId===Z&&Number(B?.expiresAt)>J())return;j(B?.ownerId!==Z?"taken-over":"expired",B)}catch(B){if(j("unreadable"),$&&B instanceof C)throw B}throw new L({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($&&V)return;X=!0,N0(),await O;let B=performance.now()+m+1000,G=5,K;for(;;){try{let _=!1;if(await $0(async()=>{let X0;try{X0=await F()}catch(U0){if($&&U0.code==="ENOENT"){_=!0;return}throw U0}if(X0?.ownerId!==Z){_=!0;return}if(z.onStep)await z.onStep("release-owner-confirmed");if(!await x())return;await p(H),_=!0},B)){if($&&!_)throw new C(H,"release-not-confirmed",{code:"EIO"});V=_;return}if(N?.aborted)return;await Z0(B)}catch(_){if(!E(_,H)){if($)throw _;return}K??=_}let Q=B-performance.now();if(Q<=0)break;if(await new Promise((_)=>setTimeout(_,Math.min(G,Q))),$&&performance.now()>=B)break;G=Math.min(G*2,50)}if($)throw K??new C(H,"release-not-confirmed",{code:"ETIMEDOUT"})}}}import{randomUUID as f0}from"node:crypto";import{mkdir as w0,open as P,rename as v0,rm as h0}from"node:fs/promises";import{dirname as o}from"node:path";class r extends Error{constructor(z){super("file or directory sync failed",{cause:z});this.name="AtomicSyncError"}}async function Hz(z,H,Y={}){await p0(z,H,Y)}async function p0(z,H,Y,Z){if($)return k(z,Y.serialize?Y.serialize(H):`${JSON.stringify(H,null,2)}
6
- `,{beforeRename:Y.beforeRename,stagePath:`${z}.${(Y.stageName??f0)()}.tmp`,onRenamed:Z,durable:Y.durable,durability:Y.durability,onOutcome:Y.onOutcome});await w0(o(z),{recursive:!0});let J=`${z}.${(Y.stageName??f0)()}.tmp`,W,X=!1;try{if(W=await P(J,"wx",384),X=!0,await W.writeFile(Y.serialize?Y.serialize(H):`${JSON.stringify(H,null,2)}
7
- `,"utf8"),await W.chmod(384),Y.durable)try{await W.sync()}catch(V){throw new r(V)}if(await W.close(),W=void 0,await Y.beforeRename?.(),await v0(J,z),X=!1,Z?.(),Y.durable){let V=await P(o(z),"r");try{await V.sync()}catch(D){throw new r(D)}finally{await V.close()}}}finally{if(await W?.close().catch(()=>{}),X)await h0(J,{force:!0}).catch(()=>{})}}async function Kz(z){if($){await A(z,"file");let Z=new C(z,"directory-sync-unsupported",{code:"ENOTSUP"});throw Z.published=!0,Z}let H=await P(z,"r");try{await H.sync()}finally{await H.close()}let Y=await P(o(z),"r");try{await Y.sync()}finally{await Y.close()}}var Yz=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{r as kf,Hz as lf,p0 as mf,Kz as nf,V0 as of,d as pf,D0 as qf,L as rf,s0 as sf,Yz as tf};