@reason-machines/cli-linux-arm64-musl 0.2.358 → 0.2.360
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/bin/ara +1 -1
- package/bin/vm-hands/api-credentials-vtpssnm1.js +2 -0
- package/bin/vm-hands/api-dvwzjwmh.js +2 -0
- package/bin/vm-hands/ask-relay-0y716ck6.js +8 -0
- package/bin/vm-hands/connect-cli-sbczes1h.js +2 -0
- package/bin/vm-hands/custom-endpoint-device-8v87dhjx.js +2 -0
- package/bin/vm-hands/desktop-account-q57958y1.js +2 -0
- package/bin/vm-hands/{device-workspace-7yg5x68n.js → device-workspace-c05vq771.js} +1 -1
- package/bin/vm-hands/hands-worker-source-wfv9csj2.js +2 -0
- package/bin/vm-hands/{index-swa20ch8.js → index-80ep9259.js} +1 -1
- package/bin/vm-hands/install-receipt-pbfhgaxc.js +2 -0
- package/bin/vm-hands/local-automation-j8402b7e.js +2 -0
- package/bin/vm-hands/local-capabilities-yekmdbpc.js +2 -0
- package/bin/vm-hands/local-desktop-users-m7rexsex.js +2 -0
- package/bin/vm-hands/local-display-mac-9de01n3r.js +2 -0
- package/bin/vm-hands/local-display-session-d3hvgjqs.js +2 -0
- package/bin/vm-hands/local-pty-session-e7j0kj19.js +2 -0
- package/bin/vm-hands/managed-runtime-r1138kvq.js +2 -0
- package/bin/vm-hands/{network-contract-rm9x646s.js → network-contract-zjq3w2n3.js} +1 -1
- package/bin/vm-hands/package-44a3p8yk.js +2 -0
- package/bin/vm-hands/permissions-g0asz6w1.js +2 -0
- package/bin/vm-hands/{reason-hands-protocol-3z7bas06.js → reason-hands-protocol-aj1zwpk0.js} +1 -1
- package/bin/vm-hands/serve-service-9jd2zcmb.js +2 -0
- package/bin/vm-hands/{status-psxtsknj.js → status-7v31d0ab.js} +2 -2
- package/bin/vm-hands/version-2fvzdbmj.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-0763vz5v.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-1hv536wk.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-0hv9ek0t.js → vm-hands-entry-lite-2j67g42s.js} +9 -68
- package/bin/vm-hands/{vm-hands-entry-lite-0tdpjsxc.js → vm-hands-entry-lite-3qxye8en.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-3tf5zyba.js +9 -0
- package/bin/vm-hands/{vm-hands-entry-lite-rr0hhz7g.js → vm-hands-entry-lite-4rd6b2ra.js} +3 -3
- package/bin/vm-hands/vm-hands-entry-lite-4xfs7y6w.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-xhjbc3e4.js → vm-hands-entry-lite-5y2kfnv2.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-trcg4jv7.js → vm-hands-entry-lite-6fvjbwqq.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-dys7am1h.js → vm-hands-entry-lite-7nk0873d.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-zrvaqawr.js → vm-hands-entry-lite-97zxda1y.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-c9wp99nr.js → vm-hands-entry-lite-avstvbbc.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-cety9pka.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-cwf21py1.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-84d59wrf.js → vm-hands-entry-lite-dqnhebfx.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-nvhzj5b0.js → vm-hands-entry-lite-f4gvypnx.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-qf01e5f1.js → vm-hands-entry-lite-fr2k6eah.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-wpx6sg6d.js → vm-hands-entry-lite-gxjxx1r2.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-hfq6jjnh.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-nd1k2jz9.js → vm-hands-entry-lite-hw8vgsmm.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-8jmwhybq.js → vm-hands-entry-lite-jc229h5p.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-6f5eypjm.js → vm-hands-entry-lite-jjkkee8q.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-beannz0s.js → vm-hands-entry-lite-jpkf3569.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-k17ntg9v.js → vm-hands-entry-lite-k7fkfytm.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-tj1y61bg.js → vm-hands-entry-lite-kxtjkzzh.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-he2z2137.js → vm-hands-entry-lite-ne0nrjkn.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-3zxjyj62.js → vm-hands-entry-lite-nnvyvx1n.js} +3 -3
- package/bin/vm-hands/vm-hands-entry-lite-npqaxsmx.js +11 -0
- package/bin/vm-hands/vm-hands-entry-lite-p1nb6n3r.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-qqyrwyfz.js +37 -0
- package/bin/vm-hands/{vm-hands-entry-lite-jfwz0br7.js → vm-hands-entry-lite-qy9xzp2m.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-c8hfat7y.js → vm-hands-entry-lite-rkt48xf4.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-5b29hq7h.js → vm-hands-entry-lite-tbps80f1.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-v1amz3pq.js +62 -0
- package/bin/vm-hands/{vm-hands-entry-lite-mybm2kyz.js → vm-hands-entry-lite-vcm4389c.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-wej1p1ry.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-gcn3rmz6.js → vm-hands-entry-lite-wry37am5.js} +1 -1
- package/bin/vm-hands/vm-hands-entry-lite-x7204pcv.js +340 -0
- package/bin/vm-hands/{vm-hands-entry-lite-nbtpm59m.js → vm-hands-entry-lite-xhr0m9r0.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-xj0p1ax7.js +5 -0
- package/bin/vm-hands/{vm-hands-entry-lite-95k4g3jj.js → vm-hands-entry-lite-zn303jrg.js} +1 -1
- package/bin/vm-hands/vm-hands-entry-lite.js +1 -1
- package/bin/vm-hands/{vm-hands-executor-dqqdgtqq.js → vm-hands-executor-xcscxb3s.js} +1 -1
- package/bin/vm-hands/vm-hands-op-runner-tm0sh7y6.js +2 -0
- package/bin/vm-hands/{vm-hands-runtime-y89fmev1.js → vm-hands-runtime-3yg846f8.js} +3 -3
- package/bin/vm-hands/worker-sandbox-wb5thd4n.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/api-credentials-emdf5nm5.js +0 -2
- package/bin/vm-hands/api-js29ghm5.js +0 -2
- package/bin/vm-hands/ask-relay-qv9ddzr1.js +0 -8
- package/bin/vm-hands/connect-cli-8nxph9td.js +0 -2
- package/bin/vm-hands/custom-endpoint-device-j3e3zjd5.js +0 -2
- package/bin/vm-hands/desktop-account-gcysz0m3.js +0 -2
- package/bin/vm-hands/hands-worker-source-hbp5n31r.js +0 -2
- package/bin/vm-hands/local-automation-nw3bj9b5.js +0 -2
- package/bin/vm-hands/local-capabilities-7m54wthn.js +0 -2
- package/bin/vm-hands/local-desktop-users-pccz3sz9.js +0 -2
- package/bin/vm-hands/local-display-mac-gj72gkfb.js +0 -2
- package/bin/vm-hands/local-display-session-5ajajxtg.js +0 -2
- package/bin/vm-hands/local-pty-session-zen80k1k.js +0 -2
- package/bin/vm-hands/package-1e3w44ve.js +0 -2
- package/bin/vm-hands/permissions-0ej6xgrj.js +0 -2
- package/bin/vm-hands/version-fw3dwa12.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-33ttamma.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-3ms5bb0b.js +0 -43
- package/bin/vm-hands/vm-hands-entry-lite-6qfax5p2.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-d9k3dzaq.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-dyy62gt3.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-pm0j47qj.js +0 -343
- package/bin/vm-hands/vm-hands-entry-lite-tdgbgcer.js +0 -3
- package/bin/vm-hands/vm-hands-op-runner-msdteb31.js +0 -2
- package/bin/vm-hands/worker-sandbox-yw24sxyp.js +0 -2
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var j={REASON_API_KEY:"ARA_API_KEY",REASON_API_URL:"ARA_API_URL",REASON_CLI_CHANNEL:"ARA_CLI_CHANNEL",REASON_CLI_LAUNCHER_PATH:"ARA_CLI_LAUNCHER_PATH",REASON_MANAGED_RUNTIME_ROOT:"ARA_MANAGED_RUNTIME_ROOT",REASON_INSTALL_ALIAS_PATH:"ARA_INSTALL_ALIAS_PATH",REASON_INSTALL_DIR:"ARA_INSTALL_DIR",REASON_INSTALL_METHOD:"ARA_INSTALL_METHOD",REASON_INSTALL_PINNED_VERSION:"ARA_INSTALL_PINNED_VERSION",REASON_INSTALL_UPGRADE:"ARA_INSTALL_UPGRADE"},mJ=Object.values(j),UJ=new Set;function m(J,Q){let V=J[Q];if(V?.trim())return V;let Z=J[j[Q]];if(Z?.trim())UJ.add(j[Q]);return Z}function DJ(J,Q){return{[J]:Q,[j[J]]:Q}}import{basename as PJ}from"path";var x=["production","staging"],GJ="https://api.reasonmachines.com",HJ="https://staging-api.reasonmachines.com";var f={production:{api:"https://api.reasonmachines.ai",app:"https://reasonmachines.ai"},staging:{api:"https://staging-api.reasonmachines.ai",app:"https://staging.reasonmachines.ai"}},RJ=new Set(["ara-staging","reason-staging"]);function lJ(J={}){let Q=m(J.env??process.env,"REASON_CLI_CHANNEL")?.trim().toLowerCase();if(Q){if(x.includes(Q))return Q;throw Error(`Unknown Reason CLI channel: ${Q}`)}let V=PJ(J.executablePath??process.execPath).toLowerCase();return RJ.has(V)?"staging":"production"}function I(J){return J==="staging"?HJ:GJ}function iJ(J){return`${I(J)}/mcp/ara`}var s={production:["https://api.ara.so",f.production.api],staging:["https://api-staging.ara.so",f.staging.api]};function y(J){let Q;try{Q=new URL(J).origin}catch{return J}let V=x.find((Z)=>s[Z].includes(Q));return V?I(V):Q}function rJ(J,Q){return J===Q||y(J)===y(Q)}function oJ(J,Q){return x.some((V)=>s[V].includes(J)&&Q===I(V))}function aJ(J,Q){try{let V=new URL(Q);return!V.username&&!V.password&&(V.origin===I(J)||V.origin===f[J].api)}catch{return!1}}function tJ(J){try{let Q=new URL(J).hostname.replace(/^\[|\]$/g,"").toLowerCase();return Q==="localhost"||Q==="127.0.0.1"||Q==="::1"}catch{return!1}}import{randomBytes as VJ}from"crypto";import{chmodSync as ZJ,closeSync as a,constants as FJ,linkSync as $J,lstatSync as A,mkdirSync as XJ,openSync as CJ,readdirSync as H,readFileSync as t,readlinkSync as E,renameSync as _,rmdirSync as KJ,symlinkSync as k,unlinkSync as U}from"fs";import{createRequire as OJ}from"module";import{constants as bJ}from"os";import{basename as O,join as K,sep as jJ}from"path";import{existsSync as N,lstatSync as l,readdirSync as EJ,readFileSync as TJ,readlinkSync as kJ,realpathSync as _J}from"fs";import{join as L,sep as AJ}from"path";function i(J,...Q){let V=L(J,"ara"),Z=L(J,"reason");if(!r(V))return L(Z,...Q);if(!N(Z))return L(V,...Q);return N(L(V,...Q))&&!N(L(Z,...Q))?L(V,...Q):L(Z,...Q)}function r(J){try{let Q=l(J);if(!Q.isSymbolicLink())return Q.isDirectory();return kJ(J)!=="reason"&&N(J)}catch{return!1}}function o(J,Q=[]){if(!r(J))return!1;let V;try{V=[J,...EJ(J,{withFileTypes:!0}).filter((Z)=>Z.isDirectory()).map((Z)=>L(J,Z.name))]}catch{return!1}return V.some((Z)=>["connect","connect-once"].filter(($)=>!Q.includes(L(Z,$))).some(($)=>{let z=L(Z,$,"worker.json");try{l(z)}catch{return!1}try{let q=JSON.parse(TJ(z,"utf8"))?.stateDirectory;if(typeof q!=="string")return!0;let M=(X,B)=>X===B||X.startsWith(B+AJ);return M(q,J)||M(c(q),c(J))}catch{return!0}}))}function c(J){try{return _J(J)}catch{return J}}var v=new Set(["credentials.json","local-device.json","local-device.revoked.json","local-device.auth-migration.json","local-device.json.registration-pending.json","local-daemon.json","local-daemon.json.workspaces.json","local-root-fingerprint-key.json","instances","workspaces"]),g=new Set(["local-device.proxy.json"]),IJ=new Set(["local-device.key","local-device.binding"]),n=new Map;function NJ(J,Q,V){let Z=K(J,"ara");if(/[/\\]\.reason-ssh[/\\][^/\\]+[/\\]installer-home[/\\]\.config$/.test(J))return{state:W(Z)?.isDirectory()?"kept":"absent"};return qJ(Z,K(J,"reason"),{linkAlways:!0,kept:($)=>o($,V??[]),native:Q===void 0?LJ:()=>Q},V!==void 0)}function YQ(J,...Q){return NJ(J),i(J,...Q)}function wQ(J,Q=process.platform){let V=K(J,"Library","Logs");if(Q==="darwin")for(let Z of[""," Staging"," Development"])qJ(K(V,`Ara${Z}`),K(V,`Reason${Z}`),{linkAlways:!1,kept:()=>!1,native:LJ});return K(V,"Reason")}var zJ="config_rename_unavailable:busy";function qJ(J,Q,V,Z=!1){let $=Z?void 0:n.get(J);if($)return $;let z;try{z=SJ(J,Q,V)}catch(q){let M=`config_rename_unavailable:${G(q)??"failed"}`;try{return{state:W(J)?.isDirectory()?"kept":"absent",problem:M}}catch{return{state:"kept",problem:M}}}if(!(z.state==="absent"&&V.linkAlways)&&z.problem!==zJ&&!(z.state==="kept"&&!z.problem))n.set(J,z);return z}function SJ(J,Q,V){vJ(Q,V.native);let Z=!1;for(let $=0;$<8;$+=1){let z=W(J);if(z?.isSymbolicLink())return E(J)===O(Q)?{state:Z?"renamed":"linked"}:{state:"kept"};if(!z){if(u(Q))Y(()=>U(Q),"ENOENT");if(!(Z||V.linkAlways)||!T(Q))return{state:"absent"};let X=C(Q,"link");k(O(Q),X);try{Y(()=>_(X,J),"EISDIR","ENOTEMPTY","EEXIST","ENOTDIR")}finally{Y(()=>U(X),"ENOENT")}continue}if(!z.isDirectory())return{state:"absent"};if(V.kept(J))return e(Q),{state:"kept"};let q=V.native();if(!q)return e(Q),{state:"kept",problem:"config_rename_unavailable:no_native"};let M=fJ(q,J);if(!M)return{state:"kept",problem:zJ};try{if(A(J).isSymbolicLink())continue;let X=uJ(q,J,Q);if(X)return{state:"kept",problem:X};Z=!0}finally{M()}}throw Object.assign(Error("legacy directory rename did not settle"),{code:"unsettled"})}function uJ(J,Q,V){let Z=W(V);if(!Z||u(V)){if(!Z)k(O(V),V);try{J.exchange(Q,V)}catch(X){if(u(V))Y(()=>U(V),"ENOENT");return`config_rename_unavailable:${G(X)??"exchange_failed"}`}return null}if(!Z.isDirectory())return"config_rename_unavailable:ENOTDIR";if(Z.dev!==A(Q).dev)return"config_rename_unavailable:EXDEV";let $=[C(V,"probe"),C(V,"probe")];try{k("a",$[0]),k("b",$[1]),J.exchange($[0],$[1])}catch(X){return`config_rename_unavailable:${G(X)??"exchange_failed"}`}finally{for(let X of $)Y(()=>U(X),"ENOENT")}let z=wJ(V);for(let X of IJ){let B=W(K(V,X)),w=W(K(Q,X));if(B&&w&&B.ino!==w.ino)XJ(`${z}-replaced`,{mode:448,recursive:!0}),_(K(V,X),K(`${z}-replaced`,X))}let q={linked:new Map,unitsKept:new Set};MJ(Q,V,"",q);let M=C(V,"rename");k(O(V),M);try{J.exchange(Q,M)}catch(X){return Y(()=>U(M),"ENOENT"),`config_rename_unavailable:${G(X)??"exchange_failed"}`}return BJ(M,V,q,z),null}function h(J){return J===""||!J.includes(jJ)}function MJ(J,Q,V,Z){let $=h(V)&&S(K(Q,V),K(J,V));if($)Z.unitsKept.add(V);for(let z of H(K(J,V))){if($&&(v.has(z)||g.has(z)))continue;let q=K(V,z),M=K(J,q),X=K(Q,q),B=W(M);if(!B)continue;let w=W(X);if(B.isDirectory()){if(!w)Y(()=>XJ(X,{mode:B.mode&4095}),"EEXIST"),ZJ(X,B.mode&4095);if(T(X))MJ(J,Q,q,Z)}else if(!w){if(B.isSymbolicLink())Y(()=>k(E(M),X),"EEXIST");else if(Y(()=>$J(M,X),"EEXIST","ENOENT"))Z.linked.set(q,B.ino)}}}function vJ(J,Q){let V;try{if(!T(J))return;V=H(J)}catch{return}for(let Z of V){let $=/^\.(rename|link|probe|claim)-(\d+)-[0-9a-f]+$/.exec(Z);if(!$)continue;let z=K(J,Z),q=W(z);if(!q)continue;if(!q.isDirectory()){if(!JJ(Number($[2])))Y(()=>U(z),"ENOENT");continue}let M=Q(),X=null;if(M){try{X=M.lock(z)}catch{continue}if(!X)continue}else if(JJ(Number($[2])))continue;try{let B=C(J,"claim");if(Y(()=>_(z,B),"ENOENT"))BJ(B,J,null,wJ(J))}finally{X?.()}}}function BJ(J,Q,V,Z){for(let[$,z]of V?.linked??[])if(!W(K(J,$))&&W(K(Q,$))?.ino===z)Y(()=>U(K(Q,$)),"ENOENT");if(WJ(J,Q,"",V),Y(()=>KJ(J),"ENOTEMPTY","EEXIST"))return;_(J,Z),ZJ(Z,448)}function WJ(J,Q,V,Z){let $=h(V)&&(Z?Z.unitsKept.has(V):S(K(Q,V),K(J,V)));for(let z of H(K(J,V))){let q=K(V,z),M=K(J,q),X=K(Q,q),B=A(M),w=W(X);if(w&&B.ino===w.ino&&B.dev===w.dev){U(M);continue}if(B.isFile()&&w?.isFile()&&Z?.linked.get(q)===w.ino){_(M,X);continue}if($&&(v.has(z)||g.has(z)))continue;if(!w){if(B.isFile()){if(Y(()=>$J(M,X),"EEXIST"))U(M)}else Y(()=>_(M,X),"EEXIST","ENOTEMPTY");continue}if(B.isDirectory()&&w.isDirectory())WJ(J,Q,q,Z),Y(()=>KJ(M),"ENOTEMPTY","EEXIST")}}function LQ(J){let Q=K(J,"ara"),V=K(J,"reason");if(!T(Q)||!T(V))return null;let Z=["",...H(Q,{withFileTypes:!0}).filter(($)=>$.isDirectory()&&!$.name.startsWith(".")).map(($)=>$.name)];for(let $ of Z){let z=K(Q,$),q=K(V,$);if(!S(z,q)||!S(q,z))continue;if([...v,...g].some((X)=>d(K(z,X),K(q,X))===!1))return $}return null}function UQ(J){let Q=K(J,"ara"),V=K(J,"reason");if(!T(Q)||!T(V))return null;let Z=($)=>{for(let z of H(K(Q,$))){let q=K($,z);if(h($)&&(z==="connect"||z==="connect-once"))continue;let M=A(K(Q,q)),X=W(K(V,q));if(!X||M.ino===X.ino&&M.dev===X.dev)continue;if(M.isDirectory()&&X.isDirectory()&&!X.isSymbolicLink()){let B=Z(q);if(B!==null)return B}else if(M.isSymbolicLink()||X.isSymbolicLink()){if(!(M.isSymbolicLink()&&X.isSymbolicLink()&&E(K(Q,q))===E(K(V,q))))return q}else if(d(K(Q,q),K(V,q))!==!0)return q}return null};return Z("")}function d(J,Q){let V=W(J),Z=W(Q);if(!V&&!Z)return null;if(!V||!Z||V.isDirectory()!==Z.isDirectory())return!1;if(V.ino===Z.ino&&V.dev===Z.dev)return!0;if(V.isDirectory())return[...new Set([...H(J),...H(Q)])].every((z)=>d(K(J,z),K(Q,z))===!0);try{return t(J).equals(t(Q))}catch{return!1}}function S(J,Q){for(let V of v)if(YJ(K(J,V),K(Q,V)))return!0;return!1}function YJ(J,Q){let V=W(J);if(!V)return!1;let Z=W(Q);if(!Z)return!0;if(V.isDirectory()){if(!Z.isDirectory())return!0;return H(J).some(($)=>YJ(K(J,$),K(Q,$)))}if(V.isSymbolicLink())return!Z.isSymbolicLink()||E(J)!==E(Q);return V.ino!==Z.ino||V.dev!==Z.dev}function e(J){if(u(J))Y(()=>U(J),"ENOENT")}function wJ(J){return K(J,`.pre-rename-${new Date().toISOString().replace(/[:.]/g,"-")}-${VJ(3).toString("hex")}`)}function u(J){try{return A(J).isSymbolicLink()&&E(J)===O(J)}catch{return!1}}function T(J){let Q=W(J);return Q!==null&&Q.isDirectory()}function fJ(J,Q){for(let V=0;V<40;V+=1){let Z=J.lock(Q);if(Z)return Z;Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,50)}return null}function C(J,Q){return K(J,`.${Q}-${process.pid}-${VJ(6).toString("hex")}`)}function JJ(J){if(J===process.pid)return!1;try{return process.kill(J,0),!0}catch(Q){return G(Q)==="EPERM"}}function W(J){try{return A(J)}catch(Q){if(G(Q)==="ENOENT"||G(Q)==="ENOTDIR")return null;throw Q}}function Y(J,...Q){try{return J(),!0}catch(V){if(Q.includes(G(V)??""))return!1;throw V}}function G(J){return J instanceof Error&&"code"in J&&typeof J.code==="string"?J.code:void 0}var F,xJ=2,gJ=4,hJ=2,dJ=2,QJ=-100;function LJ(){if(F!==void 0)return F;if(F=null,process.platform!=="linux"&&process.platform!=="darwin")return null;let J;try{J=OJ(import.meta.url)("bun:ffi")}catch{return null}let Q=process.platform==="darwin",V=Q?"__error":"__errno_location",Z=Q?["/usr/lib/libSystem.B.dylib"]:["libc.so.6",`libc.musl-${process.arch==="arm64"?"aarch64":"x86_64"}.so.1`],{FFIType:$}=J;for(let z of Z)try{let q=Q?"renamex_np":"renameat2",X=J.dlopen(z,{flock:{args:[$.i32,$.i32],returns:$.i32},[V]:{args:[],returns:$.ptr},[q]:Q?{args:[$.ptr,$.ptr,$.u32],returns:$.i32}:{args:[$.i32,$.ptr,$.i32,$.ptr,$.u32],returns:$.i32}}).symbols,B=X[V]();if(B===null)continue;let w=(R)=>{let P=J.read.i32(B),D=Object.entries(bJ.errno).find(([,b])=>b===P)?.[0]??`errno_${P}`;return Object.assign(Error(`${R} failed: ${D}`),{code:D})},p=(R)=>Buffer.from(`${R}\x00`,"utf8");return F={exchange(R,P){let D=p(R),b=p(P);if((Q?X[q](J.ptr(D),J.ptr(b),hJ):X[q](QJ,J.ptr(D),QJ,J.ptr(b),dJ))!==0)throw w("exchange")},lock(R){let P=CJ(R,FJ.O_RDONLY);if(X.flock(P,xJ|gJ)===0)return()=>a(P);let D=w("lock");if(a(P),D.code==="EWOULDBLOCK"||D.code==="EAGAIN")return null;throw D}},F}catch{}return null}
|
|
3
|
-
export{m as sh,DJ as th,x as uh,lJ as vh,I as wh,iJ as xh,y as yh,rJ as zh,oJ as Ah,aJ as Bh,tJ as Ch,r as Dh,NJ as Eh,YQ as Fh,wQ as Gh,LQ as Hh,UQ as Ih,LJ as Jh};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{D as T,F as U}from"./vm-hands-entry-lite-95k4g3jj.js";import{mc as V}from"./vm-hands-entry-lite-gcn3rmz6.js";import{sh as G,vh as M,wh as Q}from"./vm-hands-entry-lite-6qfax5p2.js";function W(j,B){let k=G(j,"REASON_API_URL")?.trim();if(!k)return Q(B);let z=new URL(k);if(z.protocol!=="https:"&&!(z.protocol==="http:"&&["127.0.0.1","localhost","::1"].includes(z.hostname)))throw Error("REASON_API_URL must use HTTPS (HTTP is allowed only for loopback development).");return z.origin}function X(j){return G(j,"REASON_API_URL")?.trim()?W(j,"production"):void 0}function $(j){return G(j,"REASON_API_KEY")?.trim()||void 0}async function N(j,B){let k=j.env??process.env,z=$(k);if(!z)return(j.getCredentials??T)({apiOrigin:X(k),signal:B});let J=W(k,j.channel??M({env:k})),D=await(j.fetchImpl??fetch)(J+"/v3/self",{redirect:"error",headers:{authorization:"Bearer "+z,accept:"application/json"},signal:B}),L=await D.json().catch(()=>({})),w=V(L)?L:{};if(!D.ok){let H=typeof w.detail==="string"?w.detail:typeof w.message==="string"?w.message:"API key authentication failed ("+D.status+")";throw new U(D.status,typeof w.error==="string"?w.error:"api_key_auth_failed",H)}if(typeof w.org_id!=="string"||!w.org_id)throw Error("The API key in the environment did not resolve to a Workspace.");let Z=Array.isArray(w.scopes)?w.scopes.filter((H)=>typeof H==="string"):[];return{credentialKind:"api_key",apiOrigin:J,accessToken:z,orgId:w.org_id,clientId:"api-key",refreshToken:"",expiresAt:"",scopes:Z}}async function P(j){let B=await N(j),k=X(j.env??process.env);if(!B)throw Error(k?`Not signed in to ${k}. Set REASON_API_KEY, or run \`reason login --api-url ${k}\`.`:"Not signed in. Run `reason login`, or set REASON_API_KEY.");return B}
|
|
3
|
-
export{W as v,X as w,$ as x,N as y,P as z};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Rb as D}from"./vm-hands-entry-lite-wpx6sg6d.js";import{qi as j}from"./vm-hands-entry-lite-tj1y61bg.js";import{statSync as i}from"fs";import{delimiter as n,join as t}from"path";function _(q,z=process.env.PATH??""){if(!q||q.includes("/")||q.includes("\x00"))return!1;return z.split(n).some((G)=>{if(!G)return!1;try{let Q=i(t(G,q));return Q.isFile()&&(Q.mode&73)!==0}catch{return!1}})}import{spawn as r,spawnSync as e}from"child_process";import{existsSync as k,mkdtempSync as E,readFileSync as O,readdirSync as o,realpathSync as qq,rmSync as b,statSync as zq}from"fs";import{platform as y,tmpdir as g}from"os";import{dirname as A,join as Z}from"path";import{fileURLToPath as Gq,pathToFileURL as T}from"url";var Hq=["bwrap","socat","rg"],Jq=2000,v=20000,Qq=3,P=4000,Vq=new Set([".git",".hg",".svn","node_modules"]),Wq=["runAsHostUid","sysrq-trigger"],Yq=Z(A(A(Gq(import.meta.url))),"packages/sandbox-runtime/src/index.ts"),h=!1;function fq(){h=!0}async function u(){let z=h?Z(A(qq(process.execPath)),"runtime","srt"):void 0;if(z&&process.platform==="linux"&&!k(Z(z,"vendor","seccomp",process.arch,"apply-seccomp")))throw Error("packaged_sandbox_runtime_vendor_missing");if(z){let J=O(Z(z,"sandbox-runtime.mjs"),"utf8");for(let Y of Wq)if(!J.includes(Y))throw Error(`packaged_sandbox_runtime_fork_missing:${Y}`)}let H=(await import(z?T(Z(z,"sandbox-runtime.mjs")).href:T(Yq).href)).SandboxManager;if(!H||typeof H.initialize!=="function"||typeof H.wrapWithSandboxArgv!=="function")throw Error("sandbox-runtime does not expose the expected SandboxManager API.");return{SandboxManager:H}}function Zq(q={}){if((q.platformName??y())!=="linux")return!1;let G=q.fileExists??k,Q=q.readFile??((H)=>O(H,"utf8"));for(let H of["/.dockerenv","/run/.containerenv"])try{if(G(H))return!0}catch{}try{return/docker|containerd|kubepods|lxc|libpod/.test(Q("/proc/1/cgroup"))}catch{return!1}}function l(q){return["/bin/true","/usr/bin/true"].find((z)=>q(z))??null}function $q(q,z){return q==="strict"?["--ro-bind","/","/","--unshare-pid","--unshare-user","--cap-drop","ALL","--proc","/proc","--",z]:["--ro-bind","/","/","--unshare-pid","--unshare-user","--bind","/proc","/proc","--",z]}function jq(q,z){try{let G=e("bwrap",$q(q,z),{stdio:"ignore",timeout:Jq});return!G.error&&G.status===0}catch{return!1}}function Bq(q){let z=q.platformName??y();if(z!=="linux")return null;let G=q.hasExecutable??_;if(!Hq.every((V)=>G(V)))return null;let Q=q.fileExists??k,H=l(Q);if(!H)return null;let J=B??(q.containerized??Zq({platformName:z})?"weak":"strict");return(q.probeNamespaces??((V)=>jq(V,H)))(J)?J:null}var L=null,C=!1,K=null,S=null,f=null,B=null,F=null;function M(){throw I("sandbox_mode_conflict"),new j("sandbox_unavailable","Sandbox process policy conflicts with an existing probe or session. Restart the worker.")}function xq(q){if(B!==null&&B!==q||C&&L!==null&&L!==q||F!==null&&F!==q)M();B=q}function I(q){K=q}function c(q){if(K)return!1;if(!C){if(L=Bq(q??{}),C=!0,L&&!q)d()}return L!==null}function Lq(){return c()?L:null}var U=null,w=0;function m(q){if(K)throw new j("sandbox_unavailable","Confined execution is unavailable in this worker process.");if(B&&q.sandboxMode&&B!==q.sandboxMode)M();let z=B??q.sandboxMode??Lq();if(!z)throw new j("sandbox_unavailable","Confined command execution is unavailable on this operating system.");if(F&&F!==z)M();return F=z,U??=(async()=>{let{SandboxManager:G}=await(q.loadSandboxRuntime??u)();return await G.initialize(Iq(z)),G})().catch((G)=>{throw U=null,I(`initialize_failed: ${String(G)}`),G instanceof j?G:new j("sandbox_unavailable","The confined execution sandbox failed to start.")}),U.then((G)=>{if(K)throw new j("sandbox_unavailable","Confined execution became unavailable during sandbox initialization.");return G})}async function Kq(){let q=U;if(U=null,!q)return;try{await(await q).reset()}catch{}}async function d(q={}){if(K)return!1;if(q.loadSandboxRuntime)return x(q.loadSandboxRuntime);if(!c())return!1;return S??=x(u),S}async function x(q){try{let{SandboxManager:z}=await q(),G=z.checkDependencies().errors;if(G.length>0)return I(`dependencies_missing: ${G.join(", ")}`),!1;return!K}catch(z){return I(`load_failed: ${String(z)}`),!1}}async function Rq(q={}){if(!q.loadSandboxRuntime&&!q.sandboxMode){if(!await d())return!1;return f??=R({}),f}return R(q)}async function R(q){let z;try{z=await m(q)}catch{return!1}let G=await Xq(z);if(!G)I("confined_command_failed");if(w===0)await Kq();return G}async function Xq(q){let z=l(k);if(!z)return!1;let G=E(Z(g(),"reason-device-probe-"));try{let{argv:Q}=await q.wrapWithSandboxArgv(a([z]),p(),{filesystem:s({root:G,allowWrite:!1,temporaryDirectory:G,protectedPaths:[]})},void 0,G),[H,...J]=Q;if(!H)return!1;return await Fq(H,J,G)}catch{return!1}finally{try{q.cleanupAfterCommand()}catch{}b(G,{recursive:!0,force:!0})}}function Fq(q,z,G,Q={}){return new Promise((H)=>{let J=!1,Y,V=(X)=>{if(J)return;J=!0,clearTimeout(Y),H(X)},W;try{W=(Q.spawnChild??r)(q,z,{cwd:G,env:{PATH:D,HOME:G,TMPDIR:G},stdio:"ignore"})}catch{V(!1);return}W.once("error",()=>V(!1));let $=(X,N)=>V(X===0&&N===null);if(W.once("exit",$),W.once("close",$),W.exitCode!==null||W.signalCode!==null)$(W.exitCode,W.signalCode);if(J)return;Y=setTimeout(()=>{V(!1);try{W.kill("SIGKILL")}catch{}},Math.min(Q.timeoutMs??v,v))})}function p(q=k){return["/bin/bash","/bin/sh"].find((z)=>q(z))??"/bin/sh"}function a(q){return q.map((z)=>`'${z.replaceAll("'","'\\''")}'`).join(" ")}function Uq(q,z,G=(Q)=>o(Q,{withFileTypes:!0}).filter((H)=>H.isDirectory()||H.isFile()).map((H)=>H.name)){let Q=[],H=[{path:q,depth:0}],J=0;while(H.length>0&&J<P){let Y=H.pop(),V;try{V=G(Y.path)}catch{continue}for(let W of V){if(J+=1,J>P)break;let $=Z(Y.path,W);if(z($)){Q.push($);continue}if(Y.depth+1<Qq&&!Vq.has(W))H.push({path:$,depth:Y.depth+1})}}return Q}function s(q){let z=Z(q.root,".git"),G=[];try{if(zq(z).isDirectory())G=[Z(z,"config"),Z(z,"hooks")]}catch{}return{denyRead:["/home","/root","/tmp","/tmp/.X11-unix",...q.protectedPaths],allowRead:[q.root,q.temporaryDirectory],allowWrite:[...q.allowWrite?[q.root]:[],q.temporaryDirectory],denyWrite:[...q.protectedPaths,...G]}}function Iq(q){return{network:{allowedDomains:[],deniedDomains:[]},filesystem:{denyRead:[],allowRead:[],allowWrite:[],denyWrite:[]},...q==="weak"?{enableWeakerNestedSandbox:!0}:{}}}function Dq(q){let z=q.createTemporaryDirectory??(()=>E(Z(g(),"reason-device-"))),G=q.removeTemporaryDirectory??((Q)=>b(Q,{recursive:!0,force:!0}));return async(Q,H,J)=>{let Y=await m(q),V=z();w+=1;try{let W;try{W=await Y.wrapWithSandboxArgv(a([Q,...H]),q.shell??p(),{filesystem:s({root:J.root,allowWrite:J.allowWrite,temporaryDirectory:V,protectedPaths:Uq(J.root,q.isProtectedPath)})},J.signal,J.cwd)}catch(N){throw N instanceof j?N:new j("sandbox_unavailable","The confined execution sandbox could not wrap the command.")}let[$,...X]=W.argv;if(!$)throw new j("sandbox_unavailable","The confined execution sandbox produced no command.");return await q.spawnCaptured($,X,{cwd:J.cwd,timeoutMs:J.timeoutMs,signal:J.signal,env:q.scrubEnvironment(J.root,V)})}finally{w-=1;try{Y.cleanupAfterCommand()}catch{}G(V)}}}
|
|
3
|
-
export{_ as Kb,fq as Lb,xq as Mb,c as Nb,Rq as Ob,p as Pb,Dq as Qb};
|