@reason-machines/cli-linux-x64 0.2.422 → 0.2.426
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/reason +2 -2
- package/bin/vm-hands/api-credentials-skdwhmrz.js +2 -0
- package/bin/vm-hands/api-s23qevwq.js +2 -0
- package/bin/vm-hands/connect-cli-whwb2ma1.js +2 -0
- package/bin/vm-hands/custom-endpoint-device-46deqrq5.js +2 -0
- package/bin/vm-hands/desktop-account-nb7g2ek5.js +2 -0
- package/bin/vm-hands/device-workspace-6av4wa2e.js +2 -0
- package/bin/vm-hands/{fsevents-p3d8kd0p.js → fsevents-5c1c8fc6.js} +1 -1
- package/bin/vm-hands/hands-worker-source-wjsjw77t.js +2 -0
- package/bin/vm-hands/{index-wrw65904.js → index-0dp6x9h4.js} +18 -18
- package/bin/vm-hands/install-receipt-4sjr0jhg.js +2 -0
- package/bin/vm-hands/local-automation-2tct0vrq.js +2 -0
- package/bin/vm-hands/local-capabilities-19ak31z6.js +2 -0
- package/bin/vm-hands/local-desktop-users-2azpqr2m.js +2 -0
- package/bin/vm-hands/local-display-mac-1ddx6s3j.js +2 -0
- package/bin/vm-hands/local-display-session-5bxyaz4y.js +2 -0
- package/bin/vm-hands/local-display-video-v95az7me.js +2 -0
- package/bin/vm-hands/local-managed-process-c4g4ys6m.js +2 -0
- package/bin/vm-hands/local-pty-session-7hps89vj.js +2 -0
- package/bin/vm-hands/managed-runtime-2pftkrdr.js +2 -0
- package/bin/vm-hands/network-contract-8fkzm0t0.js +2 -0
- package/bin/vm-hands/package-k6jdrvn6.js +2 -0
- package/bin/vm-hands/permissions-4xfekazh.js +2 -0
- package/bin/vm-hands/reason-hands-protocol-45dm5s53.js +2 -0
- package/bin/vm-hands/serve-service-315ycb43.js +2 -0
- package/bin/vm-hands/status-pxdvwv94.js +10 -0
- package/bin/vm-hands/version-0pnbb3ga.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-hbs3tpdg.js → vm-hands-entry-lite-07vak0wy.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-0mzpwxh9.js +539 -0
- package/bin/vm-hands/{vm-hands-entry-lite-21qpxvt8.js → vm-hands-entry-lite-12rzrd95.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-pf5qtbj5.js → vm-hands-entry-lite-1f2cam25.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-94bm9vgk.js → vm-hands-entry-lite-2qf7adyk.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-np07qyeq.js → vm-hands-entry-lite-2yz6b0n3.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-nzmkyezg.js → vm-hands-entry-lite-3adw9jw3.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-2e15739v.js → vm-hands-entry-lite-3dfk9rq1.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-g4zd2d5n.js → vm-hands-entry-lite-3pnjdh8m.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-5dtfehjv.js → vm-hands-entry-lite-3rwtqr28.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-tdgtpx8e.js → vm-hands-entry-lite-3vmhs921.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-beyyy1gz.js → vm-hands-entry-lite-499mywh7.js} +29 -29
- package/bin/vm-hands/{vm-hands-entry-lite-ec9jemny.js → vm-hands-entry-lite-4fwf7wgb.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-kz0b5h2f.js → vm-hands-entry-lite-86bfv5kw.js} +9 -9
- package/bin/vm-hands/{vm-hands-entry-lite-6c67a3jc.js → vm-hands-entry-lite-8j7p91hr.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-8r31b0ps.js → vm-hands-entry-lite-9jgf223h.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-jev771b3.js → vm-hands-entry-lite-9sa1knn7.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-60pg3wxj.js → vm-hands-entry-lite-9z3v15d2.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-s5qkb1fk.js → vm-hands-entry-lite-a3w8m8nb.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-avc65bd7.js → vm-hands-entry-lite-ba3qq0bs.js} +4 -4
- package/bin/vm-hands/vm-hands-entry-lite-cm497v4t.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-hk6trmwa.js → vm-hands-entry-lite-d9g1pzzx.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-s4bharcb.js → vm-hands-entry-lite-dh8f2h2d.js} +6 -6
- package/bin/vm-hands/{vm-hands-entry-lite-rfz60hb3.js → vm-hands-entry-lite-em7mk9tn.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-1qpwpdcc.js → vm-hands-entry-lite-f51qqcj7.js} +10 -10
- package/bin/vm-hands/{vm-hands-entry-lite-fbhqfzbq.js → vm-hands-entry-lite-g9z467dk.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-aj139v8j.js → vm-hands-entry-lite-hw26gewc.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-xvmeb9e8.js → vm-hands-entry-lite-hy7krmhy.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-jzz73e3f.js → vm-hands-entry-lite-jcf61cb4.js} +5 -5
- package/bin/vm-hands/vm-hands-entry-lite-kqj8ykp6.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-jjwcsywg.js → vm-hands-entry-lite-m4g595j3.js} +4 -4
- package/bin/vm-hands/vm-hands-entry-lite-mcjca0ez.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-50zbqwkv.js → vm-hands-entry-lite-n4x7reax.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-bknthqy2.js → vm-hands-entry-lite-ng993z5m.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-vpz54vwj.js → vm-hands-entry-lite-njs8k65s.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-aapdds5x.js → vm-hands-entry-lite-p1680dtx.js} +18 -18
- package/bin/vm-hands/{vm-hands-entry-lite-dk79tnax.js → vm-hands-entry-lite-qyp2a4c3.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-3krzmhkk.js → vm-hands-entry-lite-r7zs4ce2.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-bx5zy5bd.js → vm-hands-entry-lite-t3qf6qrj.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-wx4ax7wg.js → vm-hands-entry-lite-t5q30ne0.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-4vks5phw.js → vm-hands-entry-lite-tqc2ezda.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-3tx0tkeq.js → vm-hands-entry-lite-vse1a0rr.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-dzv12jpj.js → vm-hands-entry-lite-x0ya08r5.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-6gv0d400.js → vm-hands-entry-lite-z89a4e12.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-dht2p1vj.js → vm-hands-entry-lite-zkgqn7rd.js} +12 -12
- package/bin/vm-hands/vm-hands-entry-lite.js +2 -2
- package/bin/vm-hands/vm-hands-executor-epps6bxx.js +11 -0
- package/bin/vm-hands/vm-hands-op-runner-tebkt2kz.js +2 -0
- package/bin/vm-hands/{vm-hands-runtime-h0trw0xr.js → vm-hands-runtime-fpvqkg1k.js} +3 -3
- package/bin/vm-hands/worker-preview-readiness-kmwcrttt.js +2 -0
- package/bin/vm-hands/worker-sandbox-epre0fnv.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/api-18d75dfn.js +0 -2
- package/bin/vm-hands/api-credentials-3vhge1ap.js +0 -2
- package/bin/vm-hands/connect-cli-qtbe4v66.js +0 -2
- package/bin/vm-hands/custom-endpoint-device-17t4efc4.js +0 -2
- package/bin/vm-hands/desktop-account-6sjrxy69.js +0 -2
- package/bin/vm-hands/device-workspace-s50q53sz.js +0 -2
- package/bin/vm-hands/hands-worker-source-kddz4y15.js +0 -2
- package/bin/vm-hands/install-receipt-ysa70fvh.js +0 -2
- package/bin/vm-hands/local-automation-0gmnztwx.js +0 -2
- package/bin/vm-hands/local-capabilities-vfteeg61.js +0 -2
- package/bin/vm-hands/local-desktop-users-cppjjr81.js +0 -2
- package/bin/vm-hands/local-display-mac-0qz3b627.js +0 -2
- package/bin/vm-hands/local-display-session-bnc6whgt.js +0 -2
- package/bin/vm-hands/local-display-video-mtd0gnyg.js +0 -2
- package/bin/vm-hands/local-managed-process-khhmd6pe.js +0 -2
- package/bin/vm-hands/local-pty-session-rpk05ap5.js +0 -2
- package/bin/vm-hands/managed-runtime-hv0hwf1j.js +0 -2
- package/bin/vm-hands/network-contract-trkxqc0w.js +0 -2
- package/bin/vm-hands/package-xqbhdf15.js +0 -2
- package/bin/vm-hands/permissions-rr3e1yd5.js +0 -2
- package/bin/vm-hands/reason-hands-protocol-xn3ddz70.js +0 -2
- package/bin/vm-hands/serve-service-pb0ch11d.js +0 -2
- package/bin/vm-hands/status-4pmpra54.js +0 -10
- package/bin/vm-hands/version-8z9rdrb0.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-1pabvq5q.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-7m9dr2mg.js +0 -539
- package/bin/vm-hands/vm-hands-entry-lite-z76nfb19.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-zp6naptr.js +0 -3
- package/bin/vm-hands/vm-hands-executor-z222kmvg.js +0 -11
- package/bin/vm-hands/vm-hands-op-runner-34d38g9f.js +0 -2
- package/bin/vm-hands/worker-preview-readiness-w62n91kr.js +0 -2
- package/bin/vm-hands/worker-sandbox-2r5nseff.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{readdirSync as b,readFileSync as P}from"fs";import{userInfo as k}from"os";var
|
|
3
|
-
export{
|
|
2
|
+
import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{readdirSync as b,readFileSync as P}from"fs";import{userInfo as k}from"os";var or="--vm-hands-op-runner-kind=person",sr="--vm-hands-op-runner-kind=surface",xt="--vm-hands-surface-uid=",kt="--vm-hands-surface-dir=",Ct=new Set(["automation.call.v1","display.stream.v1","preview.serve.v1"]);function R(t){let c=new Set([t]),l=[];try{l=b("/proc")}catch{}for(let o of l){if(!/^\d+$/.test(o))continue;try{let d=P(`/proc/${o}/stat`,"utf8");if(Number(d.slice(d.lastIndexOf(")")+2).split(" ")[3])===t)c.add(Number(o))}catch{}}for(let o of c)try{process.kill(o,"SIGKILL")}catch{}}var A=(t)=>{let c=globalThis.Bun;if(!c)throw new r("pty_unavailable","Reason terminals require the Bun runtime.");let l=c.spawn({cmd:[t.shell,...t.args],cwd:t.cwd,env:{...t.environment,TERM:"xterm-256color"},terminal:{cols:t.cols,rows:t.rows,data:(i,s)=>t.onData(s)}}),o=l.terminal,d=()=>{R(l.pid);try{o?.close()}catch{}};if(!o)throw d(),new r("pty_unavailable","Reason could not allocate a pseudo-terminal.");return{write:(i)=>o.write(i),resize:(i,s)=>o.resize(i,s),kill:d,exited:l.exited.then((i)=>typeof i==="number"?i:null,()=>null)}};function x(){let t=(()=>{try{return k().username}catch{return}})();return{PATH:process.env.PATH,HOME:process.env.HOME,SHELL:process.env.SHELL,LANG:"C.UTF-8",...t?{USER:t,LOGNAME:t}:{}}}async function E(t){let[{localAutomationAvailable:c},{localDisplayReady:l},{localDisplayVideoAvailable:o},{probeWorkerPreview:d},y]=await Promise.all([import("./local-automation-2tct0vrq.js"),import("./local-display-session-5bxyaz4y.js"),import("./local-display-video-v95az7me.js"),import("./worker-preview-readiness-kmwcrttt.js"),import("fs")]),i=AbortSignal.timeout(15000),s=null;try{y.mkdirSync(t,{recursive:!0,mode:448}),s=y.mkdtempSync(`${t}/probe-`);let[g,p,m]=await Promise.all([Promise.resolve().then(()=>c()).catch(()=>!1),l().catch(()=>!1),d(s,i).catch(()=>!1)]);return{t:"readiness",display_video:p&&await o().catch(()=>!1),lanes:{"automation.call.v1":g,"display.stream.v1":p,"preview.serve.v1":m,"tunnel.open":m,"tunnel.close":m}}}finally{if(s)y.rmSync(s,{recursive:!0,force:!0})}}async function os(){let[{executeLocalOperation:t,spawnCaptured:c},{runLocalPtySession:l},{configureDesktopAccount:o,desktopAccount:d},{configureWorkerSandbox:y}]=await Promise.all([import("./local-capabilities-19ak31z6.js"),import("./local-pty-session-7hps89vj.js"),import("./desktop-account-nb7g2ek5.js"),import("./worker-sandbox-epre0fnv.js")]);y();let i=process.argv.includes(or),s=process.argv.includes(sr),g=(a,e,u)=>c(a,e[0]==="-lic"?["-lc",...e.slice(1)]:e,u),p=(process.geteuid?.()??0)!==0;if(s){p=!1;let a=process.argv.find((e)=>e.startsWith(xt))?.slice(xt.length);if((process.geteuid?.()??-1)===0&&a)try{p=o({value:a})!==null&&d()!==null}catch{p=!1}}let m=new Map,v=new Map,f=(a)=>{try{process.send?.(a)}catch{}};if(process.on("message",(a)=>{let e=a;if(e?.t==="cancel"){m.get(e.id)?.abort();return}if(e?.t==="control"){let n=v.get(e.id);if(s&&n&&e.control&&typeof e.control.kind==="string")import("./local-managed-process-c4g4ys6m.js").then(({controlManagedDeviceProcess:_})=>_(n,{kind:e.control.kind,payload:e.control.payload??{}})).catch(()=>!1);return}if(e?.t==="retire"){if(s&&typeof e.operation_id==="string"&&typeof e.status==="string")import("./local-managed-process-c4g4ys6m.js").then(({retireManagedDeviceProcess:n})=>n(e.operation_id,e.status)).catch(()=>!1);return}if(e?.t!=="op")return;if(!p){f({t:"done",id:e.id,completion:{status:"failed",error_code:"vm_hands_payload_account_unavailable"}});return}let u=e.claim.capability;if(u==="pty.start"&&!i){f({t:"done",id:e.id,completion:{status:"failed",error_code:"capability_not_granted"}});return}if(Ct.has(u)!==s){f({t:"done",id:e.id,completion:{status:"failed",error_code:"capability_not_granted"}});return}let w=new AbortController;m.set(e.id,w),v.set(e.id,e.claim);let S=u==="pty.start"?{runPtySession:(n)=>l(n,{spawnPty:A,environment:x(),loadProxy:()=>null})}:{worker:e.worker,...u==="exec.full"?{spawnFullControl:g}:{}};t(e.state,e.claim,{...S,signal:w.signal,emit:(n)=>{let{deliverySignal:_,...h}=n;f({t:"event",id:e.id,event:h})}}).then((n)=>f({t:"done",id:e.id,completion:n}),(n)=>f({t:"done",id:e.id,completion:{status:"failed",error_code:n&&typeof n==="object"&&"code"in n&&typeof n.code==="string"?n.code:"vm_hands_op_failed"}})).finally(()=>{m.delete(e.id),v.delete(e.id)})}),process.on("disconnect",()=>process.exit(0)),s){let a=process.argv.find((u)=>u.startsWith(kt))?.slice(kt.length),e={t:"readiness",display_video:!1,lanes:{}};f(p&&a?await E(a).catch(()=>e):e)}await new Promise(()=>{})}
|
|
3
|
+
export{or,sr,xt,kt,Ct,os};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`);p=e}function
|
|
2
|
+
import{It}from"./vm-hands-entry-lite-2yz6b0n3.js";import{fe,se,C}from"./vm-hands-entry-lite-8j7p91hr.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{spawn as J,spawnSync as ee}from"child_process";import{existsSync as h,mkdtempSync as ne,readFileSync as K,readdirSync as te,realpathSync as re,rmSync as oe,statSync as G}from"fs";import{platform as T,tmpdir as ie}from"os";import{dirname as A,join as c,win32 as w}from"path";import{fileURLToPath as ae,pathToFileURL as W}from"url";var le=["bwrap","socat","rg"],de=2000;var ce=3,L=4000,ue=new Set([".git",".hg",".svn","node_modules"]),me=["runAsHostUid","sysrq-trigger"],X=c(A(A(ae(import.meta.url))),"packages","sandbox-runtime"),pe=c(X,"src","index.ts"),z=!1;function Qi(){z=!0}function j(){return z?c(A(re(process.execPath)),"runtime","srt"):void 0}function y(){let e=c(j()??X,"vendor","srt-win");return c(e,process.arch,"srt-win.exe")}async function Y(){let e=j();if(e&&process.platform==="linux"&&!h(c(e,"vendor","seccomp",process.arch,"apply-seccomp")))throw Error("packaged_sandbox_runtime_vendor_missing");if(e&&process.platform==="win32"&&!h(y()))throw Error("packaged_sandbox_runtime_vendor_missing");if(e){let i=K(c(e,"sandbox-runtime.mjs"),"utf8");for(let s of me)if(!i.includes(s))throw Error(`packaged_sandbox_runtime_fork_missing:${s}`)}let n=(await import(e?W(c(e,"sandbox-runtime.mjs")).href:W(pe).href)).SandboxManager;if(!n||typeof n.initialize!=="function"||typeof n.wrapWithSandboxArgv!=="function")throw Error("sandbox-runtime does not expose the expected SandboxManager API.");return{SandboxManager:n}}function ge(e={}){if((e.platformName??T())!=="linux")return!1;let o=e.fileExists??h,n=e.readFile??((i)=>K(i,"utf8"));for(let i of["/.dockerenv","/run/.containerenv"])try{if(o(i))return!0}catch{}try{return/docker|containerd|kubepods|lxc|libpod/.test(n("/proc/1/cgroup"))}catch{return!1}}function we(e){return["/bin/true","/usr/bin/true"].find((t)=>e(t))??null}function Se(e,t){return e==="strict"?["--ro-bind","/","/","--unshare-pid","--unshare-user","--cap-drop","ALL","--proc","/proc","--",t]:["--ro-bind","/","/","--unshare-pid","--unshare-user","--bind","/proc","/proc","--",t]}function be(e,t){try{let o=ee("bwrap",Se(e,t),{stdio:"ignore",timeout:de});return!o.error&&o.status===0}catch{return!1}}function xe(e){let t=e.platformName??T(),o=e.fileExists??h;if(t==="win32")return(e.bash??fe)()&&o(y())?m??"strict":null;if(t!=="linux")return null;let n=e.hasExecutable??It;if(!le.every((l)=>n(l)))return null;let i=we(o);if(!i)return null;let s=m??(e.containerized??ge({platformName:t})?"weak":"strict");return(e.probeNamespaces??((l)=>be(l,i)))(s)?s:null}var S=null,M=!1,p=null,F=null;var m=null,P=null,_=null,E=null,v=[],g=new Map;function D(){throw b("sandbox_mode_conflict"),new r("sandbox_unavailable","Sandbox process policy conflicts with an existing probe or session. Restart the worker.")}function eo(e){if(m!==null&&m!==e||M&&S!==null&&S!==e||P!==null&&P!==e)D();m=e}function b(e){if(!p)process.stderr.write(`Reason worker: confined commands are off (${e})
|
|
3
|
+
`);p=e}function vr(e){if(p)return!1;if(!M){if(S=xe(e??{}),M=!0,S&&!e)Ce()}return S!==null}function he(){return vr()?S:null}var R=null,x=0;function I(e,t){if(p)throw new r("sandbox_unavailable","Confined execution is unavailable in this worker process.");if(m&&e.sandboxMode&&m!==e.sandboxMode)D();let o=m??e.sandboxMode??he();if(!o)throw new r("sandbox_unavailable","Confined command execution is unavailable on this operating system.");if(P&&P!==o)D();return P=o,R??=(async()=>{let{SandboxManager:n}=await(e.loadSandboxRuntime??Y)();return await n.initialize(Ne(o,t)),n})().catch((n)=>{if(R=null,t)_=null,process.stderr.write(`Reason worker: the Windows sandbox did not start for this folder (${String(n).slice(0,500)})
|
|
4
4
|
`);else b(`initialize_failed: ${String(n)}`);throw n instanceof r?n:new r("sandbox_unavailable","The confined execution sandbox failed to start.")}),R.then((n)=>{if(p)throw new r("sandbox_unavailable","Confined execution became unavailable during sandbox initialization.");return n})}function O(){if(x-=1,x===0)for(let e of v.splice(0))e()}async function ye(e,t=!0,o,n){let i=n===void 0?1/0:Date.now()+n;await Q();let s=_e();if(t)await s;let a=JSON.stringify(e),l=!1,u=()=>{if(!l)return;l=!1;let d=(g.get(a)??1)-1;if(d>0)g.set(a,d);else g.delete(a)};try{for(;;){if(o?.aborted)throw new r("cancelled","Operation was cancelled.");if(Date.now()>=i)return!1;if(E){await E;continue}let d=g.keys().next().value;if(_??=d??a,_===a&&(d===void 0||d===a))break;if(!l){l=!0,g.set(a,(g.get(a)??0)+1);continue}if(x===0&&d===a){Pe();continue}await new Promise((f)=>{if(v.push(f),o?.addEventListener("abort",()=>f(),{once:!0}),i!==1/0)setTimeout(f,Math.max(0,i-Date.now())).unref?.()})}return x+=1,!0}finally{if(l&&x===0)for(let d of v.splice(0))d();u()}}function Pe(){return E??=Me().finally(()=>{E=null}),E}function Ee(e,t,o=process.env){let n=o.USERPROFILE?w.resolve(o.USERPROFILE).toLowerCase():null,i=w.resolve(e).toLowerCase(),s=n!==null&&i.startsWith(`${n}\\`),a=t?q(o).filter((l)=>l.toLowerCase()===i||l.toLowerCase().startsWith(`${i}\\`)):[];return{denyRead:[],allowRead:[e],allowWrite:t?[e]:[],denyWrite:t?a:s?[]:[e]}}function q(e,t=process.execPath){let o=new Map;for(let n of[...(e.PATH??e.Path??"").split(";"),w.dirname(t)]){if(!n||!w.isAbsolute(n))continue;let i=w.resolve(n);if(!o.has(i.toLowerCase()))o.set(i.toLowerCase(),i)}return[...o.values()]}function Re(e=process.env,t=process.execPath){let o=[e.SystemRoot,e.ProgramFiles,e["ProgramFiles(x86)"],e.ProgramW6432,e.ProgramData,e.USERPROFILE].filter((n)=>!!n).map((n)=>w.resolve(n).toLowerCase());return q(e,t).filter((n)=>{let i=n.toLowerCase();return!o.some((s)=>i===s||i.startsWith(`${s}\\`))})}var U=null,H=null;function Q(e=y()){return H??=(async()=>{let t;try{t=JSON.parse((await V(e,["status"])).stdout).user?.user?.sid}catch{return null}if(typeof t!=="string"||!/^S-1-[0-9-]+$/.test(t))return null;if(!await new Promise((n)=>{let i=J(C("icacls"),[e,"/grant",`*${t}:(RX)`],{stdio:"ignore",windowsHide:!0,timeout:30000});i.on("error",()=>n(!1)),i.on("close",(s)=>n(s===0))}))process.stderr.write(`Reason worker: could not let the Windows sandbox user run srt-win.exe
|
|
5
5
|
`);return t})(),H}function V(e,t,o){return new Promise((n)=>{let i=J(e,t,{stdio:["pipe","pipe","ignore"],windowsHide:!0,timeout:120000}),s="";i.stdout?.setEncoding("utf8").on("data",(a)=>{s+=a}),i.on("error",()=>n({status:null,stdout:s})),i.on("close",(a)=>n({status:a,stdout:s})),i.stdin?.end(o??"")})}function _e(e=y()){return U??=(async()=>{let t=Re();if(t.length===0)return;let o=await Q(e),n=o?await V(e,["acl","stamp","--holder-pid",String(process.ppid),"--sandbox-user-sid",o],JSON.stringify({denyRead:[],denyWrite:t})):null;if(!n||n.status!==0&&n.status!==2)b(`program_folder_deny_failed: ${n?`exit ${n.status}`:"no sandbox user"}`),process.stderr.write(`Reason worker: could not deny the Windows sandbox writes to PATH folders (${n?`exit ${n.status}`:"no sandbox user"}); confined commands are off
|
|
6
|
-
`)})(),U}var Ae=`h=$(mktemp -d) || exit 125; trap 'rm -rf "$h"' EXIT; mkdir -p "$h/AppData/Roaming" "$h/AppData/Local"; w=$(cygpath -w "$h"); export HOME="$h" USERPROFILE="$w" APPDATA="$w\\AppData\\Roaming" LOCALAPPDATA="$w\\AppData\\Local" TEMP="$w" TMP="$w"; `;async function Me(){let e=R;if(R=null,_=null,!e)return;try{await(await e).reset()}catch{}}async function Ce(e={}){if(p)return!1;if(e.loadSandboxRuntime)return B(e.loadSandboxRuntime);if(!
|
|
7
|
-
export{
|
|
6
|
+
`)})(),U}var Ae=`h=$(mktemp -d) || exit 125; trap 'rm -rf "$h"' EXIT; mkdir -p "$h/AppData/Roaming" "$h/AppData/Local"; w=$(cygpath -w "$h"); export HOME="$h" USERPROFILE="$w" APPDATA="$w\\AppData\\Roaming" LOCALAPPDATA="$w\\AppData\\Local" TEMP="$w" TMP="$w"; `;async function Me(){let e=R;if(R=null,_=null,!e)return;try{await(await e).reset()}catch{}}async function Ce(e={}){if(p)return!1;if(e.loadSandboxRuntime)return B(e.loadSandboxRuntime);if(!vr())return!1;return F??=B(Y),F}async function B(e){try{let{SandboxManager:t}=await e();if(process.platform==="win32"){if(!h(y()))b("dependencies_missing: srt-win.exe");return!p}let o=t.checkDependencies().errors;if(o.length>0)return b(`dependencies_missing: ${o.join(", ")}`),!1;return!p}catch(t){return b(`load_failed: ${String(t)}`),!1}}function _n(e=h,t=T()){if(t==="win32")return se("win32");return["/bin/bash","/bin/sh"].find((o)=>e(o))??"/bin/sh"}function ve(e){return e.map((t)=>`'${t.replaceAll("'","'\\''")}'`).join(" ")}function De(e,t,o=(n)=>te(n,{withFileTypes:!0}).filter((i)=>i.isDirectory()||i.isFile()).map((i)=>i.name)){let n=[],i=[{path:e,depth:0}],s=0;while(i.length>0&&s<L){let a=i.pop(),l;try{l=o(a.path)}catch{continue}for(let u of l){if(s+=1,s>L)break;let d=c(a.path,u);if(t(d)){n.push(d);continue}if(a.depth+1<ce&&!ue.has(u))i.push({path:d,depth:a.depth+1})}}return n}function Te(e){let t=c(e.root,".git"),o=[];try{if(G(t).isDirectory())o=[c(t,"config"),c(t,"hooks")]}catch{}return{denyRead:["/home","/root","/tmp","/tmp/.X11-unix",...e.protectedPaths],allowRead:[e.root,e.temporaryDirectory],allowWrite:[...e.allowWrite?[e.root]:[],e.temporaryDirectory],denyWrite:[...e.protectedPaths,...o]}}function ke(e,t){let o=c(t,".git"),n=[];try{if(G(o).isDirectory())n=[c(o,"config"),c(o,"hooks")]}catch{}return{denyRead:[...e],allowRead:[],allowWrite:[],denyWrite:[...e,...n]}}function Ne(e,t){if(t)return{network:{allowedDomains:[],deniedDomains:[]},filesystem:t,windows:{srtWin:{path:y()}}};return{network:{allowedDomains:[],deniedDomains:[]},filesystem:{denyRead:[],allowRead:[],allowWrite:[],denyWrite:[]},...e==="weak"?{enableWeakerNestedSandbox:!0}:{}}}function to(e){let t=e.createTemporaryDirectory??(()=>ne(c(ie(),"reason-device-"))),o=e.removeTemporaryDirectory??((n)=>oe(n,{recursive:!0,force:!0}));return async(n,i,s)=>{let a=process.platform==="win32",l;if(a){let d=Ee(s.root,s.allowWrite);if(!await ye(d,!s.workerProbe,s.signal,s.timeoutMs))return{exitCode:null,signal:null,stdout:"",stderr:"",timedOut:!0,truncated:!1};try{l=await I(e,d)}catch(f){throw O(),f}}else l=await I(e),x+=1;let u;try{u=t();let d=De(s.root,e.isProtectedPath),f;try{f=await l.wrapWithSandboxArgv((a?Ae:"")+ve([n,...i]),e.shell??_n(),{filesystem:a?ke(d,s.root):Te({root:s.root,allowWrite:s.allowWrite,temporaryDirectory:u,protectedPaths:d})},s.signal,s.cwd)}catch(N){throw N instanceof r?N:new r("sandbox_unavailable","The confined execution sandbox could not wrap the command.")}let[k,...Z]=f.argv;if(!k)throw new r("sandbox_unavailable","The confined execution sandbox produced no command.");return await e.spawnCaptured(k,Z,{cwd:s.cwd,timeoutMs:s.timeoutMs,signal:s.signal,env:a?f.env:e.scrubEnvironment(s.root,u)})}finally{O();try{l.cleanupAfterCommand()}catch{}if(u!==void 0)o(u)}}}
|
|
7
|
+
export{Qi,eo,vr,_n,to};
|