@linzumi/cli 1.0.95 → 1.0.97
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/README.md +1 -1
- package/dist/index.js +349 -349
- package/dist/mcp-server.mjs +1 -1
- package/package.json +1 -1
- package/scripts/build-auth-parity-oracle.mjs +708 -0
- package/scripts/build-config-identity-parity-oracle.mjs +520 -0
package/dist/mcp-server.mjs
CHANGED
|
@@ -145,7 +145,7 @@ ${o}
|
|
|
145
145
|
</main>
|
|
146
146
|
</body>
|
|
147
147
|
</html>`}function cl(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}function ST(e){return e.replace(/[&^|<>()%"]/g,t=>`^${t}`)}function $T(e){let t=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open",r=process.platform==="win32"?["/c","start","",ST(e)]:[e];return new Promise(n=>{il("process.spawn",{command:t,args:r,purpose:"oauth.open_browser"});let o=lT(t,r,{stdio:"ignore",detached:!0});il("process.spawned",{command:t,args:r,pid:o.pid,purpose:"oauth.open_browser"}),o.on("error",()=>n()),o.on("spawn",()=>{o.unref(),n()})})}function Fy(){return jT(ET(),".linzumi","auth.json")}function xi(e,t=Fy()){if(!dl(t))return;let r=pl(ll(t,"utf8")),n=Ve(e),o=r.local_codex_runner?.[n];if(!(o===void 0||o.access_token.trim()==="")&&!(o.expires_at!==void 0&&Date.parse(o.expires_at)<=Date.now()))return{accessToken:o.access_token,kandanBaseUrl:n,issuedAt:o.issued_at,expiresAt:o.expires_at}}function Vy(e){if(!dl(e))throw new Error(`missing personal-agent delegation auth file: ${e}`);let r=pl(ll(e,"utf8")).personal_agent_delegation;if(r===void 0||r.access_token.trim()==="")throw new Error("personal-agent delegation auth file is missing access_token");if(r.expires_at!==void 0&&Date.parse(r.expires_at)<=Date.now())throw new Error("personal-agent delegation auth file token is expired");return{accessToken:r.access_token,issuedAt:r.issued_at,expiresAt:r.expires_at}}function By(e){let t=e.authFilePath??Fy(),r=dl(t)?pl(ll(t,"utf8")):{version:1},n=Ve(e.kandanUrl),o=new Date,s=e.expiresInSeconds===void 0?void 0:new Date(o.getTime()+e.expiresInSeconds*1e3).toISOString(),i={...r,version:1,local_codex_runner:{...r.local_codex_runner??{},[n]:{access_token:e.accessToken,issued_at:o.toISOString(),expires_at:s}}};PT(OT(t),{recursive:!0});let a=`${t}.tmp.${process.pid}.${zT(6).toString("hex")}`;try{IT(a,`${JSON.stringify(i,null,2)}
|
|
148
|
-
`,"utf8"),TT(a,t)}catch(c){try{RT(a,{force:!0})}catch{}throw c}return{accessToken:e.accessToken,kandanBaseUrl:n,issuedAt:o.toISOString(),expiresAt:s}}function pl(e){let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))throw new Error("Kandan auth cache must contain a JSON object");let r=t,n=r.local_codex_runner,o=r.personal_agent_delegation;if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))throw new Error("Kandan auth cache local_codex_runner must be an object");if(o!==void 0&&(typeof o!="object"||o===null||Array.isArray(o)))throw new Error("Kandan auth cache personal_agent_delegation must be an object");return{version:1,local_codex_runner:AT(n),personal_agent_delegation:CT(o)}}function CT(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e.access_token,r=e.issued_at,n=e.expires_at;if(!(typeof t!="string"||typeof r!="string"))return{access_token:t,issued_at:r,expires_at:typeof n=="string"?n:void 0}}function AT(e){if(!(typeof e!="object"||e===null||Array.isArray(e)))return Object.fromEntries(Object.entries(e).flatMap(([t,r])=>{if(typeof r!="object"||r===null||Array.isArray(r))return[];let n=r.access_token,o=r.issued_at,s=r.expires_at;return typeof n!="string"||typeof o!="string"?[]:[[t,{access_token:n,issued_at:o,expires_at:typeof s=="string"?s:void 0}]]}))}var MT=3,NT=3600*1e3,LT=5e3,DT=5e3,ZT=6e4;function UT(e){return e.cycle<=MT?"prompt":e.lastLoudPromptAtMs===void 0||e.nowMs-e.lastLoudPromptAtMs>=NT?"summary":e.isInteractive?"refresh_line":"silent"}function qT(e){switch(e.kind){case"prompt":return`${e.cycle===1?"":`The previous code expired; here is a fresh one (no restart needed - this prompt stays alive).
|
|
148
|
+
`,{encoding:"utf8",mode:384}),TT(a,t)}catch(c){try{RT(a,{force:!0})}catch{}throw c}return{accessToken:e.accessToken,kandanBaseUrl:n,issuedAt:o.toISOString(),expiresAt:s}}function pl(e){let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))throw new Error("Kandan auth cache must contain a JSON object");let r=t,n=r.local_codex_runner,o=r.personal_agent_delegation;if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))throw new Error("Kandan auth cache local_codex_runner must be an object");if(o!==void 0&&(typeof o!="object"||o===null||Array.isArray(o)))throw new Error("Kandan auth cache personal_agent_delegation must be an object");return{version:1,local_codex_runner:AT(n),personal_agent_delegation:CT(o)}}function CT(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e.access_token,r=e.issued_at,n=e.expires_at;if(!(typeof t!="string"||typeof r!="string"))return{access_token:t,issued_at:r,expires_at:typeof n=="string"?n:void 0}}function AT(e){if(!(typeof e!="object"||e===null||Array.isArray(e)))return Object.fromEntries(Object.entries(e).flatMap(([t,r])=>{if(typeof r!="object"||r===null||Array.isArray(r))return[];let n=r.access_token,o=r.issued_at,s=r.expires_at;return typeof n!="string"||typeof o!="string"?[]:[[t,{access_token:n,issued_at:o,expires_at:typeof s=="string"?s:void 0}]]}))}var MT=3,NT=3600*1e3,LT=5e3,DT=5e3,ZT=6e4;function UT(e){return e.cycle<=MT?"prompt":e.lastLoudPromptAtMs===void 0||e.nowMs-e.lastLoudPromptAtMs>=NT?"summary":e.isInteractive?"refresh_line":"silent"}function qT(e){switch(e.kind){case"prompt":return`${e.cycle===1?"":`The previous code expired; here is a fresh one (no restart needed - this prompt stays alive).
|
|
149
149
|
`}Authorize this computer:
|
|
150
150
|
Code: ${e.userCode}
|
|
151
151
|
Open: ${e.verificationUri}
|
package/package.json
CHANGED