@cortexkit/opencode-openai-auth 1.14.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +9 -9
- package/dist/{codex-request-Cl6zEfsR.d.ts → codex-request-DYqSE0ti.d.ts} +373 -2
- package/dist/{index-3c9pk6zn.js → index-14x5shtc.js} +2 -2
- package/dist/index-1wcg7g9d.js +2 -0
- package/dist/index-50p400eg.js +8 -0
- package/dist/index-98q3mydm.js +64 -0
- package/dist/{index-a9tzfpxy.js → index-bhkycxbm.js} +1 -1
- package/dist/{index-f7t7cc9b.js → index-dzpjz8hv.js} +2 -2
- package/dist/{index-1abcvt9p.js → index-f7kmsdfk.js} +1 -1
- package/dist/{index-4tpttpjw.js → index-hnfqppx9.js} +1 -1
- package/dist/{index-nfbmjq6g.js → index-m8m7rakq.js} +2 -2
- package/dist/index-mjsmvmt4.js +76 -0
- package/dist/{index-xxmaf5ks.js → index-s8ghhc9z.js} +2 -2
- package/dist/{index-q111b2h5.js → index-t65axpta.js} +1 -1
- package/dist/index-xjtbg7sx.js +101 -0
- package/dist/index.d.ts +1 -372
- package/dist/index.js +1 -1
- package/dist/openai-auth.schema.json +400 -0
- 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-6x4q5r2r.js → token-j34j1zhm.js} +1 -1
- package/dist/token-util-bf619nmg.js +1 -0
- package/dist/tui-preferences.js +3 -3
- package/dist/v2/server.d.ts +1 -1
- package/dist/v2/server.js +2 -2
- package/package.json +3 -3
- package/src/tui-compiled/raw/logger.js +8 -1
- package/src/tui-compiled/raw/shared/061e741c052de9c1-paths.js +48 -0
- package/src/tui-compiled/raw/shared/0766d78c6f481f18-watcher.js +41 -18
- package/src/tui-compiled/raw/shared/23300c068d0b2ffc-parse.js +65 -0
- package/src/tui-compiled/raw/shared/3000be4f79f20eb6-write.js +88 -0
- package/src/tui-compiled/raw/shared/44449e891fab9fbc-edit.js +229 -0
- package/src/tui-compiled/raw/shared/4825e03209d6ae3e-with-lock.js +1 -1
- package/src/tui-compiled/raw/shared/5803fadb30af0ec0-descriptors.js +81 -0
- package/src/tui-compiled/raw/shared/58bc35a3cd459085-define.js +52 -0
- package/src/tui-compiled/raw/shared/5f4bc45522ab9bc6-update.js +139 -0
- package/src/tui-compiled/raw/shared/6948d70969aa7a55-fs.js +19 -0
- package/src/tui-compiled/raw/shared/754d6017f8e419cf-builtins.js +28 -12
- package/src/tui-compiled/raw/shared/81758f9fe7c2a576-handle.js +228 -0
- package/src/tui-compiled/raw/shared/87f6e22d4fc34918-resolve.js +51 -0
- package/src/tui-compiled/raw/shared/8a18abe4fa2977c8-menu.js +1 -0
- package/src/tui-compiled/raw/shared/8ab1f5794e677151-move.js +351 -0
- package/src/tui-compiled/raw/shared/92e38944b51b2405-file-read-cache.js +9 -5
- package/src/tui-compiled/raw/shared/9865a4fa45882c6f-settings-decisions.js +13 -0
- package/src/tui-compiled/raw/shared/cc0f2d1963547799-index.js +7 -0
- package/src/tui-compiled/raw/shared/dbc61cd405941828-accounts.js +48 -5
- package/src/tui-compiled/raw/shared/e0ed4a490e4eaa4f-schema.js +81 -0
- package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +146 -2
- package/src/tui-compiled/raw/shared/eac0bed49f3d4110-lock-errors.js +15 -0
- package/src/tui-compiled/raw/shared/facfd8afc431d68a-refusal.js +15 -0
- package/src/tui-compiled/raw/shared/fc7db0c5aa764565-settings-install.js +85 -0
- package/src/tui-compiled/raw/shared/fcd26e77bc538838-snapshot.js +150 -0
- package/src/tui-compiled/runtime/logger.js +8 -1
- package/src/tui-compiled/runtime/shared/061e741c052de9c1-paths.js +48 -0
- package/src/tui-compiled/runtime/shared/0766d78c6f481f18-watcher.js +41 -18
- package/src/tui-compiled/runtime/shared/23300c068d0b2ffc-parse.js +65 -0
- package/src/tui-compiled/runtime/shared/3000be4f79f20eb6-write.js +88 -0
- package/src/tui-compiled/runtime/shared/44449e891fab9fbc-edit.js +229 -0
- package/src/tui-compiled/runtime/shared/4825e03209d6ae3e-with-lock.js +1 -1
- package/src/tui-compiled/runtime/shared/5803fadb30af0ec0-descriptors.js +81 -0
- package/src/tui-compiled/runtime/shared/58bc35a3cd459085-define.js +52 -0
- package/src/tui-compiled/runtime/shared/5f4bc45522ab9bc6-update.js +139 -0
- package/src/tui-compiled/runtime/shared/6948d70969aa7a55-fs.js +19 -0
- package/src/tui-compiled/runtime/shared/754d6017f8e419cf-builtins.js +28 -12
- package/src/tui-compiled/runtime/shared/81758f9fe7c2a576-handle.js +228 -0
- package/src/tui-compiled/runtime/shared/87f6e22d4fc34918-resolve.js +51 -0
- package/src/tui-compiled/runtime/shared/8a18abe4fa2977c8-menu.js +1 -0
- package/src/tui-compiled/runtime/shared/8ab1f5794e677151-move.js +351 -0
- package/src/tui-compiled/runtime/shared/92e38944b51b2405-file-read-cache.js +9 -5
- package/src/tui-compiled/runtime/shared/9865a4fa45882c6f-settings-decisions.js +13 -0
- package/src/tui-compiled/runtime/shared/cc0f2d1963547799-index.js +7 -0
- package/src/tui-compiled/runtime/shared/dbc61cd405941828-accounts.js +48 -5
- package/src/tui-compiled/runtime/shared/e0ed4a490e4eaa4f-schema.js +81 -0
- package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +146 -2
- package/src/tui-compiled/runtime/shared/eac0bed49f3d4110-lock-errors.js +15 -0
- package/src/tui-compiled/runtime/shared/facfd8afc431d68a-refusal.js +15 -0
- package/src/tui-compiled/runtime/shared/fc7db0c5aa764565-settings-install.js +85 -0
- package/src/tui-compiled/runtime/shared/fcd26e77bc538838-snapshot.js +150 -0
- package/dist/index-4zpxwh8y.js +0 -91
- package/dist/index-bc2d4vma.js +0 -64
- package/dist/index-wap9mf5f.js +0 -2
- package/dist/index-yew3mp47.js +0 -76
- package/dist/index-zcpher1w.js +0 -8
- package/dist/token-util-54mhq85x.js +0 -1
package/dist/index-zcpher1w.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as a}from"./index-4tpttpjw.js";import"./index-1abcvt9p.js";export default a();
|