@cortexkit/opencode-openai-auth 1.20.2 → 1.21.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 (50) hide show
  1. package/dist/bin.js +2 -2
  2. package/dist/{codex-request-Dvj28zFK.d.ts → codex-request-NjUd_A0U.d.ts} +19 -3
  3. package/dist/{index-z4tfv40j.js → index-14m8qtpx.js} +2 -2
  4. package/dist/{index-jky7c65x.js → index-1arphj0y.js} +2 -2
  5. package/dist/{index-qtaqp1bf.js → index-4vgtvqfc.js} +1 -1
  6. package/dist/{index-8ge0as5s.js → index-4xa80px1.js} +2 -2
  7. package/dist/index-60v2qzqm.js +75 -0
  8. package/dist/{index-xcsz00nr.js → index-8kg9h2zj.js} +2 -2
  9. package/dist/{index-0mf78d7s.js → index-cqmzvf2k.js} +1 -1
  10. package/dist/index-ewbggf3b.js +101 -0
  11. package/dist/{index-c4h4t3wg.js → index-h41zc747.js} +2 -2
  12. package/dist/index-ksfxd8p5.js +64 -0
  13. package/dist/{index-dsytdx0r.js → index-qx3zz6dw.js} +1 -1
  14. package/dist/{index-t15pb3n2.js → index-rvphtptz.js} +1 -1
  15. package/dist/{index-38xyx9nd.js → index-vhn0n16s.js} +1 -1
  16. package/dist/{index-a1zh72v8.js → index-zd0hham5.js} +2 -2
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/openai-auth.schema.json +22 -0
  20. package/dist/rpc/port-file.js +1 -1
  21. package/dist/rpc/protocol.js +1 -1
  22. package/dist/rpc/rpc-client.js +1 -1
  23. package/dist/rpc/rpc-dir.js +1 -1
  24. package/dist/sidebar-state.js +1 -1
  25. package/dist/{token-y8xp4cbz.js → token-01hgthyy.js} +1 -1
  26. package/dist/token-util-29yt43da.js +1 -0
  27. package/dist/tui-preferences.js +1 -1
  28. package/dist/v2/server.d.ts +1 -1
  29. package/dist/v2/server.js +4 -4
  30. package/package.json +4 -4
  31. package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +145 -8
  32. package/src/tui-compiled/raw/shared/169b2b4bf30909bc-consumer.js +32 -0
  33. package/src/tui-compiled/raw/shared/29d709188b920a92-client-options.js +18 -0
  34. package/src/tui-compiled/raw/shared/352d228be2832bd4-hub.js +10 -0
  35. package/src/tui-compiled/raw/shared/b9588ad4725c1d10-enrollment.js +2 -1
  36. package/src/tui-compiled/raw/shared/c97089ed4243981c-host.js +8 -0
  37. package/src/tui-compiled/raw/shared/d0f0b6be200311af-insula.js +4 -5
  38. package/src/tui-compiled/raw/shared/e8d3c8da776ef9cd-index.js +3 -2
  39. package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +145 -8
  40. package/src/tui-compiled/runtime/shared/169b2b4bf30909bc-consumer.js +32 -0
  41. package/src/tui-compiled/runtime/shared/29d709188b920a92-client-options.js +18 -0
  42. package/src/tui-compiled/runtime/shared/352d228be2832bd4-hub.js +10 -0
  43. package/src/tui-compiled/runtime/shared/b9588ad4725c1d10-enrollment.js +2 -1
  44. package/src/tui-compiled/runtime/shared/c97089ed4243981c-host.js +8 -0
  45. package/src/tui-compiled/runtime/shared/d0f0b6be200311af-insula.js +4 -5
  46. package/src/tui-compiled/runtime/shared/e8d3c8da776ef9cd-index.js +3 -2
  47. package/dist/index-ah9yt0zm.js +0 -64
  48. package/dist/index-rbc7cfbv.js +0 -75
  49. package/dist/index-x3q449sn.js +0 -101
  50. package/dist/token-util-qgycqbjw.js +0 -1
@@ -1,2 +1,2 @@
1
- import{gh as F}from"./index-t15pb3n2.js";import{randomUUID as D}from"node:crypto";import{lstat as N,readFile as k,rename as y,unlink as S}from"node:fs/promises";import{tmpdir as P}from"node:os";import{dirname as W,join as E,resolve as K}from"node:path";var B=process.platform==="win32",_=new Set;function I(j){if(j?.reason==="io-error"){if(j.win32Code===2||j.win32Code===3)return"ENOENT";if(j.win32Code===80||j.win32Code===183)return"EEXIST"}return j?.code??"ERR_PRIVATE_FILE"}var A;var m="native-addon-unavailable";function f(j){return Object.assign(Error("Windows private-files native addon could not be loaded",{cause:j}),{code:"ERR_PRIVATE_FILES_UNAVAILABLE",reason:m})}function c(j,x){return x instanceof j.PrivateFilesUnavailableError||x?.code==="ERR_PRIVATE_FILES_UNAVAILABLE"}async function g(j){try{await j.verifyPrivatePath(E(P(),`.common-auth-private-files-probe-${D()}`),"file")}catch(x){if(c(j,x))throw f(x)}}function $(){return A??=import("@cortexkit/private-files").then(async(j)=>{if(B)await g(j);return j},(j)=>{throw B?f(j):j}),A}function b(j){return j?.reason==="io-error"&&(j.win32Code===32||j.win32Code===303)}class Q extends Error{path;stage;code;win32Code;reason;published=!1;durabilityConfirmed=!1;fileDurable=!1;attempts=0;elapsedMs=0;orphanPath;constructor(j,x,z){let q=z;super(q?.code==="ERR_PRIVATE_FILES_UNAVAILABLE"?`Private file refused at ${x}: ${j}. The Windows native addon of @cortexkit/private-files could not be loaded, so owner-only access cannot be enforced and nothing was read or written. Reinstall the plugin so the private-files Windows prebuild for this architecture is present; Windows has no safe fallback to permission bits.`:b(q)?`Private file busy at ${x}: ${j}. Another process was replacing or deleting this file at the same moment (Windows error ${q.win32Code}).`:`Private file refused at ${x}: ${j} (${q?.reason??q?.code??"io-error"}). Keep this file in a folder that only you, the system or administrators can change, such as a folder in your home directory. If other users could read the file before, sign in again to replace the credentials it held. On Windows the file must also be on a local drive that keeps Windows file permissions, such as NTFS.`,{cause:z});this.path=j,this.stage=x,this.name="PrivateFileError",this.code=I(q),this.win32Code=q?.win32Code,this.reason=q?.reason}}function r(j){return B&&j instanceof Q&&b(j)}async function T(j,x,z){try{return await z()}catch(q){if(q instanceof Q)throw q;throw new Q(j,x,q)}}var u;async function Y(j,x){j=K(j),x??=u,await T(j,"safe-parent",async()=>{let z=await(await $()).verifySafeParent(j,x);if(z.ok===!1){if(z.reason==="io-error"||z.reason==="wrong-kind")await N(j);throw new Q(z.level??z.path,"safe-parent",{...z,code:"ERR_PRIVATE_FILES_SECURITY"})}})}async function L(j,x,z=!1){if(j=K(j),x==="directory")return Y(j);await T(j,"verify",async()=>{let q=await $(),H=await q.verifyOwnerOnly(j),C=!1;if(!H.ok){let{reason:J}=H.refusal;if(J==="io-error")await q.verifyPrivatePath(j,x);if(z&&[q.EXTRA_ACE,q.NOT_PROTECTED,q.NULL_DACL,q.EMPTY_DACL].includes(J))await Y(W(j)),await q.securePrivatePath(j,x),C=!0;else throw Object.assign(Error("Owner-only verification refused"),{reason:J,code:"ERR_PRIVATE_FILES_SECURITY"})}if(await q.verifyPrivatePath(j,x),C&&!_.has(j))_.add(j),process.emitWarning(`Private permissions tightened: ${j}. This object may have been readable before; rotate credentials if needed.`,"PrivateFileMigration")})}async function v(j,x=!1,z){j=K(j),await T(j,"directory",async()=>{let q=await $();try{return await N(j),await Y(j,z)}catch(C){if(I(C)!=="ENOENT")throw C}let H=W(j);if(H===j)throw Object.assign(Error("Missing root"),{code:"ENOENT"});await v(H,!1,z);try{await q.createOwnerOnly(j,{kind:"dir"})}catch(C){if(I(C)!=="EEXIST")throw C}await Y(j,z)})}async function e(j,x=!1){if(!B)return k(j,"utf8");return(await d(j,x)).toString("utf8")}async function d(j,x=!1){if(!B)return k(j);if(j=K(j),x)await Y(W(j)),await L(j,"file",!0);return T(j,"read",async()=>(await $()).readOwnerOnly(j))}async function l(j,x){await Y(W(K(j))),await T(j,"create",async()=>{await(await $()).createPrivateFile(K(j),x)})}async function a(j){await Y(W(K(j))),await T(j,"directory-create",async()=>{await(await $()).createOwnerOnly(K(j),{kind:"dir"})})}async function n(j,x,z={}){j=K(j),x=K(x);let q=z.now??(()=>performance.now()),H=q(),C=z.deadline??1/0,J,Z=[0,10,20,40,80,100],U,G=0;for(let O of Z){let V=Math.min(J??1/0,C);if(q()>=V)break;if(O)await(z.sleep??((R)=>new Promise((X)=>setTimeout(X,R))))(Math.min(O,Math.max(0,V-q())));if(q()>=V)break;let w=q();if(await z.beforeRename?.(),J!==void 0)J+=q()-w;if(q()>=C)break;G++;try{return await(z.rename??y)(j,x),{attempts:G,elapsedMs:q()-H}}catch(R){U??=R;let X=R;if(!(X.win32Code!==void 0?X.win32Code===32||X.win32Code===33:["EBUSY","EPERM","EACCES"].includes(X.code??"")&&!X.reason))break;J??=q()+500}}let M=new Q(x,"rename",U??Object.assign(Error("Publication deadline expired"),{code:"ETIMEDOUT"}));throw M.attempts=G,M.elapsedMs=q()-H,M}async function t(j,x,z={}){j=K(j),await v(W(j));try{await L(j,"file",!0)}catch(G){if(G.code!=="ENOENT")throw G}let q=K(z.stagePath??`${j}.${D()}.tmp`);if(W(q)!==W(j))throw new Q(j,"stage-directory",{code:"EXDEV"});let H=!1,C=!1,J={attempts:0,elapsedMs:0},Z="stage-create",U=(G)=>{try{z.onOutcome?.({path:j,stage:G?.stage??"published",published:C,fileDurable:C,durabilityConfirmed:!1,attempts:G?.attempts??J.attempts,elapsedMs:G?.elapsedMs??J.elapsedMs,...G&&{code:G.code,win32Code:G.win32Code}})}catch{}};try{if(await l(q,x),H=!0,Z="before-rename",J=await n(q,j,z),H=!1,C=!0,Z="published-callback",z.onRenamed?.(),Z="published-verify",await L(j,"file"),z.durable&&z.durability!=="file-only-on-windows")throw new Q(j,"directory-sync-unsupported",{code:"ENOTSUP"});U()}catch(G){let M=G instanceof Q?G:new Q(j,Z,G);if(M.published=C,M.fileDurable=C,C)Object.assign(M,J);if(H){try{await S(q)}catch{M.orphanPath=q}H=!1}throw U(M),M}finally{if(H)await S(q).catch(()=>{})}}
2
- export{B as Qg,Q as Rg,r as Sg,T as Tg,Y as Ug,L as Vg,v as Wg,e as Xg,l as Yg,a as Zg,n as _g,t as $g};
1
+ import{ih as F}from"./index-rvphtptz.js";import{randomUUID as D}from"node:crypto";import{lstat as N,readFile as k,rename as y,unlink as S}from"node:fs/promises";import{tmpdir as P}from"node:os";import{dirname as W,join as E,resolve as K}from"node:path";var B=process.platform==="win32",_=new Set;function I(j){if(j?.reason==="io-error"){if(j.win32Code===2||j.win32Code===3)return"ENOENT";if(j.win32Code===80||j.win32Code===183)return"EEXIST"}return j?.code??"ERR_PRIVATE_FILE"}var A;var m="native-addon-unavailable";function f(j){return Object.assign(Error("Windows private-files native addon could not be loaded",{cause:j}),{code:"ERR_PRIVATE_FILES_UNAVAILABLE",reason:m})}function c(j,x){return x instanceof j.PrivateFilesUnavailableError||x?.code==="ERR_PRIVATE_FILES_UNAVAILABLE"}async function g(j){try{await j.verifyPrivatePath(E(P(),`.common-auth-private-files-probe-${D()}`),"file")}catch(x){if(c(j,x))throw f(x)}}function $(){return A??=import("@cortexkit/private-files").then(async(j)=>{if(B)await g(j);return j},(j)=>{throw B?f(j):j}),A}function b(j){return j?.reason==="io-error"&&(j.win32Code===32||j.win32Code===303)}class Q extends Error{path;stage;code;win32Code;reason;published=!1;durabilityConfirmed=!1;fileDurable=!1;attempts=0;elapsedMs=0;orphanPath;constructor(j,x,z){let q=z;super(q?.code==="ERR_PRIVATE_FILES_UNAVAILABLE"?`Private file refused at ${x}: ${j}. The Windows native addon of @cortexkit/private-files could not be loaded, so owner-only access cannot be enforced and nothing was read or written. Reinstall the plugin so the private-files Windows prebuild for this architecture is present; Windows has no safe fallback to permission bits.`:b(q)?`Private file busy at ${x}: ${j}. Another process was replacing or deleting this file at the same moment (Windows error ${q.win32Code}).`:`Private file refused at ${x}: ${j} (${q?.reason??q?.code??"io-error"}). Keep this file in a folder that only you, the system or administrators can change, such as a folder in your home directory. If other users could read the file before, sign in again to replace the credentials it held. On Windows the file must also be on a local drive that keeps Windows file permissions, such as NTFS.`,{cause:z});this.path=j,this.stage=x,this.name="PrivateFileError",this.code=I(q),this.win32Code=q?.win32Code,this.reason=q?.reason}}function r(j){return B&&j instanceof Q&&b(j)}async function T(j,x,z){try{return await z()}catch(q){if(q instanceof Q)throw q;throw new Q(j,x,q)}}var u;async function Y(j,x){j=K(j),x??=u,await T(j,"safe-parent",async()=>{let z=await(await $()).verifySafeParent(j,x);if(z.ok===!1){if(z.reason==="io-error"||z.reason==="wrong-kind")await N(j);throw new Q(z.level??z.path,"safe-parent",{...z,code:"ERR_PRIVATE_FILES_SECURITY"})}})}async function L(j,x,z=!1){if(j=K(j),x==="directory")return Y(j);await T(j,"verify",async()=>{let q=await $(),H=await q.verifyOwnerOnly(j),C=!1;if(!H.ok){let{reason:J}=H.refusal;if(J==="io-error")await q.verifyPrivatePath(j,x);if(z&&[q.EXTRA_ACE,q.NOT_PROTECTED,q.NULL_DACL,q.EMPTY_DACL].includes(J))await Y(W(j)),await q.securePrivatePath(j,x),C=!0;else throw Object.assign(Error("Owner-only verification refused"),{reason:J,code:"ERR_PRIVATE_FILES_SECURITY"})}if(await q.verifyPrivatePath(j,x),C&&!_.has(j))_.add(j),process.emitWarning(`Private permissions tightened: ${j}. This object may have been readable before; rotate credentials if needed.`,"PrivateFileMigration")})}async function v(j,x=!1,z){j=K(j),await T(j,"directory",async()=>{let q=await $();try{return await N(j),await Y(j,z)}catch(C){if(I(C)!=="ENOENT")throw C}let H=W(j);if(H===j)throw Object.assign(Error("Missing root"),{code:"ENOENT"});await v(H,!1,z);try{await q.createOwnerOnly(j,{kind:"dir"})}catch(C){if(I(C)!=="EEXIST")throw C}await Y(j,z)})}async function e(j,x=!1){if(!B)return k(j,"utf8");return(await d(j,x)).toString("utf8")}async function d(j,x=!1){if(!B)return k(j);if(j=K(j),x)await Y(W(j)),await L(j,"file",!0);return T(j,"read",async()=>(await $()).readOwnerOnly(j))}async function l(j,x){await Y(W(K(j))),await T(j,"create",async()=>{await(await $()).createPrivateFile(K(j),x)})}async function a(j){await Y(W(K(j))),await T(j,"directory-create",async()=>{await(await $()).createOwnerOnly(K(j),{kind:"dir"})})}async function n(j,x,z={}){j=K(j),x=K(x);let q=z.now??(()=>performance.now()),H=q(),C=z.deadline??1/0,J,Z=[0,10,20,40,80,100],U,G=0;for(let O of Z){let V=Math.min(J??1/0,C);if(q()>=V)break;if(O)await(z.sleep??((R)=>new Promise((X)=>setTimeout(X,R))))(Math.min(O,Math.max(0,V-q())));if(q()>=V)break;let w=q();if(await z.beforeRename?.(),J!==void 0)J+=q()-w;if(q()>=C)break;G++;try{return await(z.rename??y)(j,x),{attempts:G,elapsedMs:q()-H}}catch(R){U??=R;let X=R;if(!(X.win32Code!==void 0?X.win32Code===32||X.win32Code===33:["EBUSY","EPERM","EACCES"].includes(X.code??"")&&!X.reason))break;J??=q()+500}}let M=new Q(x,"rename",U??Object.assign(Error("Publication deadline expired"),{code:"ETIMEDOUT"}));throw M.attempts=G,M.elapsedMs=q()-H,M}async function t(j,x,z={}){j=K(j),await v(W(j));try{await L(j,"file",!0)}catch(G){if(G.code!=="ENOENT")throw G}let q=K(z.stagePath??`${j}.${D()}.tmp`);if(W(q)!==W(j))throw new Q(j,"stage-directory",{code:"EXDEV"});let H=!1,C=!1,J={attempts:0,elapsedMs:0},Z="stage-create",U=(G)=>{try{z.onOutcome?.({path:j,stage:G?.stage??"published",published:C,fileDurable:C,durabilityConfirmed:!1,attempts:G?.attempts??J.attempts,elapsedMs:G?.elapsedMs??J.elapsedMs,...G&&{code:G.code,win32Code:G.win32Code}})}catch{}};try{if(await l(q,x),H=!0,Z="before-rename",J=await n(q,j,z),H=!1,C=!0,Z="published-callback",z.onRenamed?.(),Z="published-verify",await L(j,"file"),z.durable&&z.durability!=="file-only-on-windows")throw new Q(j,"directory-sync-unsupported",{code:"ENOTSUP"});U()}catch(G){let M=G instanceof Q?G:new Q(j,Z,G);if(M.published=C,M.fileDurable=C,C)Object.assign(M,J);if(H){try{await S(q)}catch{M.orphanPath=q}H=!1}throw U(M),M}finally{if(H)await S(q).catch(()=>{})}}
2
+ export{B as Sg,Q as Tg,r as Ug,T as Vg,Y as Wg,L as Xg,v as Yg,e as Zg,l as _g,a as $g,n as ah,t as bh};