@reason-machines/cli-linux-x64 0.2.407 → 0.2.410
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/THIRD_PARTY_NOTICES.txt +8 -7
- package/bin/reason +2 -2
- package/bin/runtime/srt/sandbox-runtime.mjs +52 -52
- package/bin/vm-hands/api-cjv8m2zy.js +2 -0
- package/bin/vm-hands/api-credentials-m5akr9fv.js +2 -0
- package/bin/vm-hands/connect-cli-nydbj6ae.js +2 -0
- package/bin/vm-hands/custom-endpoint-device-dkqb4rqy.js +2 -0
- package/bin/vm-hands/desktop-account-5v7x0ajx.js +2 -0
- package/bin/vm-hands/device-workspace-p9q9dckg.js +2 -0
- package/bin/vm-hands/fsevents-ekt70rcc.js +2 -0
- package/bin/vm-hands/hands-worker-source-cgrpm21b.js +2 -0
- package/bin/vm-hands/index-k8kcz8a3.js +12818 -0
- package/bin/vm-hands/install-receipt-7vt2y2vh.js +2 -0
- package/bin/vm-hands/local-automation-y9kx76wa.js +2 -0
- package/bin/vm-hands/local-capabilities-j6h63m79.js +2 -0
- package/bin/vm-hands/local-desktop-users-q886k0mm.js +2 -0
- package/bin/vm-hands/local-display-mac-w85956f1.js +2 -0
- package/bin/vm-hands/local-display-session-ftt74eb3.js +2 -0
- package/bin/vm-hands/local-pty-session-5f50sqq0.js +2 -0
- package/bin/vm-hands/managed-runtime-tjwpypgf.js +2 -0
- package/bin/vm-hands/network-contract-9x9kc5vv.js +2 -0
- package/bin/vm-hands/package-78fkast4.js +2 -0
- package/bin/vm-hands/permissions-byngw8v0.js +2 -0
- package/bin/vm-hands/reason-hands-protocol-2tnghj3b.js +2 -0
- package/bin/vm-hands/serve-service-j5wnq4bg.js +2 -0
- package/bin/vm-hands/status-8tjada6n.js +10 -0
- package/bin/vm-hands/version-5hrs2hvb.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-05rrh8yg.js +250 -0
- package/bin/vm-hands/vm-hands-entry-lite-09m2cdkw.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-0g9xvgdy.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-0xrsph3r.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-10sbjfzx.js +9 -0
- package/bin/vm-hands/vm-hands-entry-lite-1cwqa4jr.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-1rrb66r9.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-1rtkf2xm.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-1sg8sdw5.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-22kfyvnk.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-46fkv5sp.js +105 -0
- package/bin/vm-hands/vm-hands-entry-lite-66ctbcym.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-6aeea05q.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-70ba2bqj.js +458 -0
- package/bin/vm-hands/{vm-hands-entry-lite-vr4sva78.js → vm-hands-entry-lite-80y72d0e.js} +5 -9
- package/bin/vm-hands/vm-hands-entry-lite-88swf2qr.js +6 -0
- package/bin/vm-hands/vm-hands-entry-lite-89z488gz.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-8ns59paz.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-8t9xssf9.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-907pa7f9.js +65 -0
- package/bin/vm-hands/vm-hands-entry-lite-9ay6f56v.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-jcd21jpm.js → vm-hands-entry-lite-9c95p6n9.js} +54 -54
- package/bin/vm-hands/vm-hands-entry-lite-ab2m9erf.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-b885gwfh.js +7 -0
- package/bin/vm-hands/{vm-hands-entry-lite-xqve205b.js → vm-hands-entry-lite-bdhjpv7g.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-bk6akkdt.js +540 -0
- package/bin/vm-hands/vm-hands-entry-lite-ckv17tn8.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-eqgj4acy.js +112 -0
- package/bin/vm-hands/vm-hands-entry-lite-f5e3dbgk.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-grm1tqs7.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-gvwdy3rf.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-hj8n59y9.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-k278g9kj.js +42 -0
- package/bin/vm-hands/{vm-hands-entry-lite-wer0qzxg.js → vm-hands-entry-lite-m11j0f9q.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-pgb514h0.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-pmcz7j7t.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-q0k6kx6d.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-qy9xg6em.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-qysyf65v.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-r29k28kb.js +14 -0
- package/bin/vm-hands/{vm-hands-entry-lite-fbpxs065.js → vm-hands-entry-lite-t7an5zg2.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-vrqzr15t.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-w59z67hf.js +52 -0
- package/bin/vm-hands/vm-hands-entry-lite-zg36myyf.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite.js +3 -1
- package/bin/vm-hands/vm-hands-executor-rdmj1wv4.js +11 -0
- package/bin/vm-hands/vm-hands-op-runner-f2bjvb7v.js +2 -0
- package/bin/vm-hands/vm-hands-runtime-aa4p4pqz.js +4 -0
- package/bin/vm-hands/worker-sandbox-smqj3mbe.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/api-credentials-4e2gypqj.js +0 -2
- package/bin/vm-hands/api-f48wa4ym.js +0 -2
- package/bin/vm-hands/ask-relay-jatz6zdz.js +0 -8
- package/bin/vm-hands/connect-cli-7jc6q164.js +0 -2
- package/bin/vm-hands/custom-endpoint-device-8h95wy87.js +0 -2
- package/bin/vm-hands/desktop-account-2kkxwv1y.js +0 -2
- package/bin/vm-hands/device-workspace-nzz3kd5t.js +0 -2
- package/bin/vm-hands/hands-worker-source-as5wepvk.js +0 -2
- package/bin/vm-hands/index-2kk983b8.js +0 -12818
- package/bin/vm-hands/install-receipt-e6s355j1.js +0 -2
- package/bin/vm-hands/local-automation-c7sk21zn.js +0 -2
- package/bin/vm-hands/local-capabilities-dgaqqaw9.js +0 -2
- package/bin/vm-hands/local-desktop-users-sevkfkye.js +0 -2
- package/bin/vm-hands/local-display-mac-jzc0g5ge.js +0 -2
- package/bin/vm-hands/local-display-session-gcndscvj.js +0 -2
- package/bin/vm-hands/local-pty-session-fe6jz2zy.js +0 -2
- package/bin/vm-hands/managed-runtime-pveke48y.js +0 -2
- package/bin/vm-hands/network-contract-9smga6kn.js +0 -2
- package/bin/vm-hands/package-qjr5q0bp.js +0 -2
- package/bin/vm-hands/permissions-92a6yh7t.js +0 -2
- package/bin/vm-hands/reason-hands-protocol-5fhd49en.js +0 -2
- package/bin/vm-hands/serve-service-rjbca0dj.js +0 -2
- package/bin/vm-hands/status-1tqes7gw.js +0 -96
- package/bin/vm-hands/version-8qryvrwt.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-05qq23fw.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-1sc3wc94.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-2nec0vk1.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-2s9the7x.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-32ch1nr1.js +0 -346
- package/bin/vm-hands/vm-hands-entry-lite-40nkzw38.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-4bgxq9ps.js +0 -9
- package/bin/vm-hands/vm-hands-entry-lite-5rkakg10.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-69ray4x8.js +0 -6
- package/bin/vm-hands/vm-hands-entry-lite-6berk108.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-72nn2b4n.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-7k3vp3fe.js +0 -52
- package/bin/vm-hands/vm-hands-entry-lite-8f3px72v.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-8gjrr6hg.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-8tcnbfnm.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-9vf97byd.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-er3nrbb9.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-f6714myc.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-g5c9ec33.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-h0y0xv5f.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-h9t84ekh.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-hd4a0a6f.js +0 -112
- package/bin/vm-hands/vm-hands-entry-lite-hepppjp0.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-hye6r7dy.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-jw5y1aa5.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-ky0w7t09.js +0 -42
- package/bin/vm-hands/vm-hands-entry-lite-mapxp682.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-mxdztdmq.js +0 -11
- package/bin/vm-hands/vm-hands-entry-lite-np1fcr2t.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-nqvb7a2m.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-q4tcfj61.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-q590arx5.js +0 -251
- package/bin/vm-hands/vm-hands-entry-lite-r2xmr627.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-r6f6qkw6.js +0 -105
- package/bin/vm-hands/vm-hands-entry-lite-swwb5mp2.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-tkb2b6x8.js +0 -540
- package/bin/vm-hands/vm-hands-entry-lite-va3vbvsk.js +0 -458
- package/bin/vm-hands/vm-hands-entry-lite-vr38bh6k.js +0 -66
- package/bin/vm-hands/vm-hands-entry-lite-wa261sf8.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-yg5h9mhm.js +0 -7
- package/bin/vm-hands/vm-hands-entry-lite-yqrmr2c8.js +0 -5
- package/bin/vm-hands/vm-hands-executor-etthkykm.js +0 -11
- package/bin/vm-hands/vm-hands-op-runner-bbp6fzn2.js +0 -2
- package/bin/vm-hands/vm-hands-runtime-2x1ryrxr.js +0 -4
- package/bin/vm-hands/worker-sandbox-p242st5d.js +0 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{C}from"./vm-hands-entry-lite-t7an5zg2.js";import{jr}from"./vm-hands-entry-lite-10sbjfzx.js";import{rt}from"./vm-hands-entry-lite-1rrb66r9.js";import{a}from"./vm-hands-entry-lite-89z488gz.js";import{I}from"./vm-hands-entry-lite-9ay6f56v.js";import{randomUUID as f}from"crypto";import{chmodSync as U,closeSync as h,constants as g,existsSync as me,fstatSync as F,lstatSync as R,mkdirSync as B,openSync as G,readFileSync as Y,readdirSync as z,readlinkSync as J,realpathSync as x,renameSync as _,rmSync as p,statSync as K,symlinkSync as _t,unlinkSync as M,writeFileSync as L}from"fs";import{basename as vt,dirname as N,isAbsolute as fe,join as c,relative as ge,resolve as b,sep as _e}from"path";import{createRequire as H}from"module";var q=1,j=1,ye=128,ve=65536;var he=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;var P=/^[a-z0-9_.-]{1,80}$/,be=64,Ee="so.ara.device-broker",Me=[Ee,"com.reasonmachines.device-broker"],Pt=jr(Me);var we=["service.install_started","service.install_completed","service.install_failed","service.launcher_adopted","service.launcher_conflict","service.started","service.reconnecting","service.reconnected","service.idle_sleep_held","service.idle_sleep_released","service.idle_sleep_failed","service.start_failed","service.stopped","service.exit_failed","service.singleton_rejected","credential.migration_started","credential.migration_completed","credential.migration_failed","credential.store_started","credential.store_completed","credential.store_failed","credential.delete_started","credential.delete_completed","credential.delete_failed","update.check_started","update.not_available","update.download_started","update.downloaded","update.verified","update.activated","update.rollback","update.failed","executor.update.check_started","executor.update.not_available","executor.update.download_started","executor.update.downloaded","executor.update.verified","executor.update.activated","executor.update.rollback","executor.update.failed","identity.refresh_completed","identity.refresh_failed","update.device_moved","update.components_installed","update.deferred","update.deferral_expired","worker.previous_exit","worker.capabilities_withheld","identity.computer_use_unavailable"];function X(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function W(e,t,n=[]){let r=new Set([...t,...n]);return t.every((i)=>(i in e))&&Object.keys(e).every((i)=>r.has(i))}function E(e){return typeof e==="string"&&he.test(e)}function Z(e){return typeof e==="string"&&!Number.isNaN(Date.parse(e))&&new Date(e).toISOString()===e}function S(e){B(e,{recursive:!0,mode:448}),U(e,448)}function Re(e,t){S(N(e));let n=`${e}.${process.pid}.${f()}.tmp`;try{L(n,t,{mode:384,flag:"wx"}),U(n,384),_(n,e)}finally{if(me(n))M(n)}}function Go(e={}){if((e.platform??process.platform)!=="darwin")throw new rt("unsupported_platform","The managed Reason runtime is currently available only on macOS.");let n=e.environment??process.env,r=C(n,"REASON_CLI_CHANNEL")==="staging",i=r?C(n,"REASON_MANAGED_RUNTIME_ROOT")?.trim():void 0,o=e.root!==void 0||Boolean(i&&fe(i))?null:c(e.home??a(),"Library","Application Support"),d=e.root??(o?c(o,r?"Reason Staging":"Reason","CLI"):i);return{executableName:"reason",root:d,...o?{legacyRoot:c(o,"Ara",...r?["staging","runtime"]:["runtime"])}:{},versions:c(d,"versions"),current:c(d,"current"),previous:c(d,"previous"),brokerLock:c(d,"broker.lock"),transitionLock:c(d,"transition.lock"),lifecycleEvents:c(d,"lifecycle-events")}}function Ko(e){let t=e.legacyRoot;if(!t)return null;return{root:t,versions:c(t,"versions"),current:c(t,"current"),previous:c(t,"previous"),brokerLock:c(t,"broker.lock"),transitionLock:c(t,"transition.lock"),lifecycleEvents:c(t,"lifecycle-events")}}function pe(e,t){let n;try{if(!R(e).isSymbolicLink())return null;n=J(e)}catch{return null}let r=n.match(/^versions\/(\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?)\/(ara|Reason|reason)$/);return r&&(r[2]==="ara"||r[2]===t)?r[1]:null}function Jo(e){return pe(e.current,e.executableName)}function D(e,t,n){let i=ge(t,e).split(_e);return i.length===2&&E(i[0])&&(i[1]==="ara"||n!==void 0&&i[1]===n)?i[0]:null}function Le(e,t){try{return R(t).isSymbolicLink()&&b(N(t),J(t))===b(e.current)}catch{return!1}}function Zo(e,t=process.execPath){try{return D(x(t),x(e.versions),e.executableName)!==null}catch{let n=b(t);return n===b(e.current)||Le(e,n)||D(n,b(e.versions),e.executableName)!==null}}function Ae(e){return X(e)&&W(e,["schema_version","pid","nonce","started_at","runtime_version"])&&e.schema_version===q&&typeof e.pid==="number"&&Number.isSafeInteger(e.pid)&&e.pid>0&&typeof e.nonce==="string"&&/^[0-9a-f-]{36}$/.test(e.nonce)&&Z(e.started_at)&&E(e.runtime_version)}function Q(e,t){try{let n=R(e);if(!n.isDirectory()||!I(n))return null;let r=G(c(e,t),g.O_RDONLY|g.O_NOFOLLOW|g.O_NONBLOCK);try{let i=F(r);if(!i.isFile()||i.nlink!==1||!I(i)||i.size>4096)return null;return Y(r,"utf8")}finally{h(r)}}catch{return null}}function A(e){try{let t=JSON.parse(Q(e,"owner.json")??"null");return Ae(t)?t:null}catch{return null}}function ee(e){try{return process.kill(e,0),!0}catch(t){return!(t instanceof Error&&("code"in t)&&t.code==="ESRCH")}}var O="lease",Ne=2,Se=4,y;function ke(){if(y!==void 0)return y;if(y=null,process.platform!=="linux"&&process.platform!=="darwin")return null;let e;try{e=H(import.meta.url)("bun:ffi")}catch{return null}let t=process.platform==="darwin"?"__error":"__errno_location",n=process.platform==="darwin"?["/usr/lib/libSystem.B.dylib"]:["libc.so.6",`libc.musl-${process.arch==="arm64"?"aarch64":"x86_64"}.so.1`];for(let r of n)try{let i=e.dlopen(r,{flock:{args:[e.FFIType.i32,e.FFIType.i32],returns:e.FFIType.i32},[t]:{args:[],returns:e.FFIType.ptr}}),s=i.symbols[t]();if(s===null)continue;return y={flock:(o,d)=>i.symbols.flock(o,d),errno:()=>e.read.i32(s),wouldBlock:process.platform==="darwin"?35:11},y}catch{}return null}var v,Ie=3221225472,Te=4,xe=128,Pe=32;function De(e){if(v===void 0){v=null;try{let s=H(import.meta.url)("bun:ffi"),{FFIType:o}=s;v={kernel:s.dlopen("kernel32.dll",{CreateFileW:{args:[o.ptr,o.u32,o.u32,o.ptr,o.u32,o.u32,o.ptr],returns:o.i64_fast},CloseHandle:{args:[o.i64_fast],returns:o.i32},GetLastError:{args:[],returns:o.u32}}).symbols,ptr:(l)=>s.ptr(l)}}catch{return null}}if(!v)return null;let{kernel:t,ptr:n}=v,r=Buffer.from(`${e}\x00`,"utf16le"),i=t.CreateFileW(n(r),Ie,0,null,Te,xe,null);if(Number(i)===-1)return t.GetLastError()===Pe?"busy":null;return{release:()=>{t.CloseHandle(i)}}}function Oe(e){if(process.platform==="win32")return De(`${e}.lease`);let t=ke();if(!t)return null;let n=G(`${e}.lease`,g.O_RDWR|g.O_CREAT|g.O_NOFOLLOW,384);try{let r=F(n);if(!r.isFile()||r.nlink!==1||!I(r))return h(n),"busy";if(t.flock(n,Ne|Se)===0)return{release:()=>h(n)};let i=t.errno();return h(n),i===t.wouldBlock?"busy":null}catch(r){throw h(n),r}}function Xo(e){S(N(e.path));let t=Oe(e.path);if(t==="busy")return{acquired:!1,owner:A(e.path),recoveredStaleOwner:!1};let n=t!==null;try{let r=Ce(e,t);if(r.acquired)n=!1;return r}finally{if(n)t.release()}}function Ce(e,t){let n=e.alive??ee,r=!1;for(let i=0;i<4;i+=1){let s={schema_version:q,pid:e.pid??process.pid,nonce:e.nonce?.()??f(),started_at:(e.now?.()??new Date).toISOString(),runtime_version:e.runtimeVersion},o=`${e.path}.init-${process.pid}-${f()}`,d=!1;try{if(B(o,{mode:448}),L(c(o,"owner.json"),`${JSON.stringify(s)}
|
|
3
|
+
`,{mode:384,flag:"wx"}),t!==null)L(c(o,O),`flock
|
|
4
|
+
`,{mode:384,flag:"wx"});e.beforePublish?.();try{throw R(e.path),Object.assign(Error("Managed runtime lock exists."),{code:"EEXIST"})}catch(m){if(m.code!=="ENOENT")throw m}_(o,e.path),d=!0;let l=!1;return{acquired:!0,owner:s,recoveredStaleOwner:r,release(){if(l)return;if(l=!0,A(e.path)?.nonce===s.nonce)p(e.path,{recursive:!0,force:!0});t?.release()}}}catch(l){let m=l.code;if(!["EEXIST","ENOTEMPTY"].includes(m??""))throw l;let u=A(e.path),re=(e.now?.()??new Date).getTime(),ie=u&&e.staleAfterMs!==void 0?re-Date.parse(u.started_at)<e.staleAfterMs:!1,ae=u!==null&&!(t!==null&&Q(e.path,O)!==null)&&n(u.pid);if(!u||ae||ie)return{acquired:!1,owner:u,recoveredStaleOwner:!1};let k=`${e.path}.stale-${process.pid}-${f()}`;try{_(e.path,k),p(k,{recursive:!0,force:!0}),r=!0}catch(T){let oe=T.code;if(!["ENOENT","EEXIST"].includes(oe??""))throw T}}finally{if(!d)p(o,{recursive:!0,force:!0})}}throw new rt("lock_unavailable","Could not acquire the managed Reason runtime lock.")}function te(e){return X(e)&&W(e,["schema_version","event_id","occurred_at","event","runtime_version"],["from_version","to_version","reason_code","duration_ms","attempt_count","retry_in_ms","capabilities"])&&e.schema_version===j&&typeof e.event_id==="string"&&/^[0-9a-f-]{36}$/.test(e.event_id)&&Z(e.occurred_at)&&typeof e.event==="string"&&we.includes(e.event)&&E(e.runtime_version)&&(e.from_version===void 0||E(e.from_version))&&(e.to_version===void 0||E(e.to_version))&&(e.reason_code===void 0||typeof e.reason_code==="string"&&P.test(e.reason_code))&&(e.duration_ms===void 0||typeof e.duration_ms==="number"&&Number.isSafeInteger(e.duration_ms)&&e.duration_ms>=0&&e.duration_ms<=86400000)&&(e.attempt_count===void 0||typeof e.attempt_count==="number"&&Number.isSafeInteger(e.attempt_count)&&e.attempt_count>=1&&e.attempt_count<=1e5)&&(e.retry_in_ms===void 0||typeof e.retry_in_ms==="number"&&Number.isSafeInteger(e.retry_in_ms)&&e.retry_in_ms>=0&&e.retry_in_ms<=30000)&&(e.capabilities===void 0||Array.isArray(e.capabilities)&&e.capabilities.length<=be&&e.capabilities.every((t)=>typeof t==="string"&&P.test(t)))}var Ve=/^(\d{22}-[0-9a-f-]{36}\.json)$/,Ue=/^(\d{22}-[0-9a-f-]{36}\.json)\.sending-(\d+)-[0-9a-f-]{36}$/,Fe=300000,w=0n;function Be(e){let t=BigInt(new Date(e.occurred_at).getTime())*1000000n;return w=t>w?t:w+1n,`${String(w).padStart(22,"0")}-${e.event_id}.json`}function ne(e){try{return z(e.lifecycleEvents).filter((t)=>Ve.test(t)).sort()}catch{return[]}}function V(e){try{let t=JSON.parse(Y(e,"utf8"));return te(t)?t:null}catch{return null}}function $e(e,t=ee,n=Date.now()){let r;try{r=z(e.lifecycleEvents)}catch{return}for(let i of r){let s=i.match(Ue);if(!s)continue;let o=c(e.lifecycleEvents,i),d=c(e.lifecycleEvents,s[1]),l=!t(Number(s[2]));if(!l)try{l=n-K(o).mtimeMs>=Fe}catch{continue}if(!l)continue;try{_(o,d)}catch(m){let u=m.code;if(u==="EEXIST")M(o);else if(u!=="ENOENT")throw m}}}function Ge(e){let n=ne(e).flatMap((i)=>{try{return[{name:i,size:K(c(e.lifecycleEvents,i)).size}]}catch{return[]}}),r=n.reduce((i,s)=>i+s.size,0);while(n.length>ye||r>ve){let i=n.shift();if(!i)break;try{M(c(e.lifecycleEvents,i.name)),r-=i.size}catch(s){if(s.code!=="ENOENT")throw s}}}function Yo(e,t,n={}){let r={schema_version:j,event_id:n.eventId?.()??f(),occurred_at:(n.now?.()??new Date).toISOString(),...t};if(!te(r))throw new rt("invalid_lifecycle_event","Managed runtime lifecycle event is invalid.");return S(e.lifecycleEvents),Re(c(e.lifecycleEvents,Be(r)),`${JSON.stringify(r)}
|
|
5
|
+
`),Ge(e),r}async function Qo(e,t,n){$e(e);let r=0;for(let i of ne(e)){let s=c(e.lifecycleEvents,i);if(n){let l=V(s);if(!l||!n(l))continue}let o=`${s}.sending-${process.pid}-${f()}`;try{_(s,o)}catch(l){if(l.code==="ENOENT")continue;throw l}let d=V(o);if(!d){M(o);continue}try{await t(d),M(o),r+=1}catch{try{_(o,s)}catch(l){if(l.code!=="ENOENT")throw l}break}}return r}export{Go,Ko,Jo,Zo,Xo,Yo,Qo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{H}from"./vm-hands-entry-lite-8t9xssf9.js";var Hi=32;var qi="__ARA_PI_TOOL_CONFINED_SCRIPT_5f0c9e2a__",zi=262144;var k=2,kr=33554432,Cr=200000,wn=4000000,tt=240000;var bn=2000;var Ar=16384,je=32768,ye=128,vn=64,Ue=2097152,Nt=1,te=16384,He=32768,Sn=8388608,we=1000,Lt=2500,Pr=2000,Mt=Lt+Pr,R=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,199}$/,y=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Tr={text_only:4430,invalid_json:4431,invalid_cancel_request:4432,invalid_sdk_response:4433,claim_required:4434,invalid_claim:4435,executor_mismatch:4436,stale_generation:4437,fence_conflict:4438,frame_too_large:4439,result_too_large:4440,progress_too_large:4441,terminal_cleanup_started:4442,job_journal_unavailable:4443},I=new Map(Object.entries(Tr).map(([t,n])=>[n,t]));var h=["cancelled","command_failed","duplicate_request_id","duplicate_result_evicted","invalid_repl_response","invalid_request","process_group_cleanup_unconfirmed","repl_failed","result_too_large","repl_response_too_large","repl_transport_failed","request_ledger_full","request_journal_unavailable","request_outcome_uncertain","maintenance_held","request_not_found","resume_digest_mismatch","spawn_failed","stale_generation","timeout"],E=new Set(h),En=16384;var S=["maintenance_held","invalid_job_request","jobs_disabled","job_not_found","job_conflict","job_capacity","job_journal_unavailable","job_not_running","job_lease_expired","job_input_sequence","job_input_backpressure","stale_generation","pty_unsupported","job_mode_mismatch"];class o extends Error{code;constructor(t){super(t);this.name="HandsProtocolError",this.code=t}}function m(t){return new TextEncoder().encode(t).byteLength}function a(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}function s(t,n){let e=new Set(n);return Object.keys(t).every((i)=>e.has(i))}function ae(t){return typeof t==="string"&&R.test(t)}function U(t){return Number.isSafeInteger(t)&&Number(t)>=1}function N(t){return typeof t==="string"&&y.test(t)}function ce(t){return typeof t==="string"&&t.startsWith("pty-")&&N(t.slice(4))}function p(t){return[t.cols,t.rows].every((n)=>Number.isSafeInteger(n)&&Number(n)>=1&&Number(n)<=we)}function _(t){if(typeof t!=="string"||t.length>Math.ceil(te/3)*4||t.length%4!==0||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t))return-1;let n=t.endsWith("==")?2:t.endsWith("=")?1:0;if(n&&"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(t[t.length-n-1])&(n===2?15:3))return-1;let i=t.length/4*3-n;return i<=te?i:-1}function l(t){if(m(t)>kr)throw new o("frame_too_large");try{return JSON.parse(t)}catch{throw new o("invalid_json")}}function Rr(t){let n=l(t);if(!a(n)||!s(n,["type","version","generation","id","jobId","action","input"])||n.type!=="job"||n.version!==k||!U(n.generation)||!ae(n.id)||!ae(n.jobId)||!a(n.input))throw new o("invalid_job_request");let e=n.input,i=Number.isSafeInteger(e.leaseExpiresAtMs)&&Number(e.leaseExpiresAtMs)>0,d=Number.isSafeInteger(e.sequence)&&Number(e.sequence)>=1;if(!(n.action==="start"?e.mode==="pty"?s(e,["mode","cols","rows","leaseExpiresAtMs"])&&ce(n.jobId)&&p(e)&&i:s(e,["script","leaseExpiresAtMs"])&&typeof e.script==="string"&&e.script.length<=Cr&&i:n.action==="inspect"?s(e,["after"])&&Number.isSafeInteger(e.after)&&Number(e.after)>=0:n.action==="input"?"dataBase64"in e?s(e,["sequence","dataBase64"])&&ce(n.jobId)&&d&&_(e.dataBase64)>0:s(e,["sequence","data","eof"])&&d&&typeof e.data==="string"&&e.data.length<=Ar&&typeof e.eof==="boolean":n.action==="resize"?s(e,["sequence","cols","rows"])&&ce(n.jobId)&&d&&p(e):n.action==="renew"?s(e,["leaseExpiresAtMs"])&&i:n.action==="cancel"&&s(e,[])))throw new o("invalid_job_request");return n}function Or(t){let n=l(t);if(!a(n)||!s(n,["type","version","generation","id","ok","job","error"])||n.type!=="job_result"||n.version!==k||!U(n.generation)||!ae(n.id))throw new o("invalid_job_result");if(n.ok===!1&&n.job===void 0&&typeof n.error==="string"&&S.some((r)=>r===n.error))return n;let e=n.job;if(n.ok!==!0||n.error!==void 0||!a(e)||!s(e,["jobId","state","startedAtMs","finishedAtMs","leaseExpiresAtMs","exitCode","inputSequence","output","firstCursor","nextCursor","truncated","process","environmentRevision","environmentSnapshotId","pty"])||!ae(e.jobId)||!["starting","running","exited","cancelled","expired","uncertain"].includes(String(e.state))||!Number.isSafeInteger(e.startedAtMs)||Number(e.startedAtMs)<1||!Number.isSafeInteger(e.leaseExpiresAtMs)||Number(e.leaseExpiresAtMs)<1||e.finishedAtMs!==null&&(!Number.isSafeInteger(e.finishedAtMs)||Number(e.finishedAtMs)<Number(e.startedAtMs))||e.exitCode!==null&&(!Number.isSafeInteger(e.exitCode)||Number(e.exitCode)<0||Number(e.exitCode)>255)||!Number.isSafeInteger(e.inputSequence)||Number(e.inputSequence)<0||!Number.isSafeInteger(e.firstCursor)||Number(e.firstCursor)<1||!Number.isSafeInteger(e.nextCursor)||Number(e.nextCursor)<Number(e.firstCursor)-1||typeof e.truncated!=="boolean"||!Array.isArray(e.output)||e.output.length>ye)throw new o("invalid_job_result");if(e.environmentRevision===void 0!==(e.environmentSnapshotId===void 0)||e.environmentRevision!==void 0&&(!Number.isSafeInteger(e.environmentRevision)||Number(e.environmentRevision)<1||!N(e.environmentSnapshotId)))throw new o("invalid_job_result");let i=Number(e.firstCursor)-1,d=0;for(let r of e.output){if(!a(r)||!s(r,["cursor","stream","text"])||!Number.isSafeInteger(r.cursor)||Number(r.cursor)<=i||Number(r.cursor)>Number(e.nextCursor)||!["stdout","stderr"].includes(String(r.stream))||typeof r.text!=="string")throw new o("invalid_job_result");d+=r.text.length,i=Number(r.cursor)}if(d>je)throw new o("invalid_job_result");let c=e.state==="starting"||e.state==="running";if(c&&(e.finishedAtMs!==null||e.exitCode!==null)||!c&&e.finishedAtMs===null||e.state==="uncertain"&&e.exitCode!==null||e.state==="exited"&&e.exitCode===null||e.state==="cancelled"&&e.exitCode!==130||e.state==="expired"&&e.exitCode!==124)throw new o("invalid_job_result");if(e.process!==void 0){let r=e.process;if(!a(r)||!s(r,["pid","processGroupId","executorLaunchId"])||!Number.isSafeInteger(r.pid)||Number(r.pid)<1||r.processGroupId!==r.pid||!N(r.executorLaunchId)||!["starting","running"].includes(String(e.state)))throw new o("invalid_job_result")}if(e.pty!==void 0){let r=e.pty;if(!a(r)||!s(r,["version","cols","rows","output","cleanup"])||r.version!==Nt||!ce(e.jobId)||!p(r)||e.output.length!==0||!Array.isArray(r.output)||r.output.length>ye||(c?r.cleanup!=="pending":e.state==="uncertain"?r.cleanup!=="unconfirmed":r.cleanup!=="confirmed")||e.state==="running"&&(e.process===void 0||e.environmentRevision===void 0))throw new o("invalid_job_result");let g=Number(e.firstCursor)-1,b=0;for(let u of r.output){if(!a(u)||!s(u,["cursor","dataBase64"])||!Number.isSafeInteger(u.cursor)||Number(u.cursor)<=g||Number(u.cursor)>Number(e.nextCursor))throw new o("invalid_job_result");let f=_(u.dataBase64);if(f<=0||(b+=f)>He)throw new o("invalid_job_result");g=Number(u.cursor)}}return n}function xn(t){if(m(t)>Ue)throw new o("frame_too_large");let n=l(t);if(!a(n)||!s(n,["version","sessionId","operationId","runId","deviceId","rootId","workspace","binding","targetRevision","rootGrantRevision","generation","fenceId","executorLaunchId","job"])||n.version!==Nt||![n.sessionId,n.operationId,n.runId].every(ae)||![n.deviceId,n.rootId,n.fenceId,n.executorLaunchId].every(N)||!U(n.generation)||!Number.isSafeInteger(n.rootGrantRevision)||Number(n.rootGrantRevision)<1||!["workspace_source","mcp_control"].includes(String(n.binding))||!Number.isSafeInteger(n.targetRevision)||Number(n.targetRevision)<0||n.binding==="workspace_source"&&n.targetRevision!==0||!a(n.workspace))throw new o("invalid_pty_receipt");if(!H(n.workspace))throw new o("invalid_pty_receipt");let e=Or(JSON.stringify({type:"job_result",version:k,generation:n.generation,id:n.operationId,ok:!0,job:n.job}));if(!e.ok||!e.job.pty||e.job.pty.output.length!==0||e.job.process&&e.job.process.executorLaunchId!==n.executorLaunchId)throw new o("invalid_pty_receipt");return n}export{Hi,qi,zi,k,kr,Cr,wn,tt,bn,Ar,je,ye,vn,Ue,Nt,te,He,Sn,we,Lt,Pr,Mt,Tr,En,ae,U,N,ce,Rr,Or,xn};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{C}from"./vm-hands-entry-lite-t7an5zg2.js";import{g}from"./vm-hands-entry-lite-ckv17tn8.js";import{Nr,Pn,Lr,Tn}from"./vm-hands-entry-lite-qysyf65v.js";import{Ln,Ut,lo}from"./vm-hands-entry-lite-10sbjfzx.js";import{x}from"./vm-hands-entry-lite-9ay6f56v.js";import{spawnSync as v}from"child_process";import{createHash as ke,randomUUID as Se}from"crypto";import{chmodSync as we,existsSync as P,mkdirSync as $e,readdirSync as Ve,readFileSync as k,renameSync as ye,rmSync as u,statSync as ve,writeFileSync as We}from"fs";import{dirname as Ae,isAbsolute as Y,join as p}from"path";import{spawnSync as de}from"child_process";import{readFileSync as me}from"fs";import{userInfo as D}from"os";import{join as fe}from"path";var ge="REASON_SCHEDULED_TASK";function H(r){return fe(r,"AppData","Local","Reason","Tasks")}function w(r){if(/[\0-\x1f\x7f"%]/.test(r))throw Error(`A background task cannot use a value with a double quote, percent sign or control character: ${r}`);return`'${r.replace(/['\u2018\u2019\u201a\u201b]/g,"$&$&")}'`}function M(r){if(!/^[A-Za-z0-9._-]+$/.test(r))throw Error(`Invalid Windows Scheduled Task name: ${r}`);return`$env:${ge}=${w(r)};`}function U(r){let e=Object.entries(r.environment).map(([t,i])=>{if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(t))throw Error(`Invalid Windows Scheduled Task environment name: ${t}`);return`$env:${t}=${w(i)};`}),n=`$global:LASTEXITCODE=1; & ${[r.program,...r.args].map(w).join(" ")} 2>&1 | ForEach-Object { Add-Content -LiteralPath ${w(r.log)} -Value $_.ToString() -Encoding UTF8 }; $c=$LASTEXITCODE;`;return[M(r.name),...e,"$ErrorActionPreference='Continue';",r.keepAlive?`do { ${n} if ($c) { Start-Sleep -Seconds 10 } } while ($c)`:`${n} exit $c`].join(" ")}function I(r){return r.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function pe(){let r=process.env.USERDOMAIN?.trim();return r?`${r}\\${D().username}`:D().username}function B(r){let e=I(r.user??pe()),n=r.schedule==="logon",t=r.schedule==="logon"?`<LogonTrigger><Enabled>true</Enabled><UserId>${e}</UserId></LogonTrigger>`:`<TimeTrigger><Repetition><Interval>PT${r.schedule.everyMinutes}M</Interval><StopAtDurationEnd>false</StopAtDurationEnd></Repetition><StartBoundary>2026-01-01T00:00:00</StartBoundary><Enabled>true</Enabled></TimeTrigger>`,i=`-NoProfile -NonInteractive -ExecutionPolicy Bypass -WindowStyle Hidden -Command "${r.script}"`;return`<?xml version="1.0" encoding="UTF-16"?>
|
|
3
|
+
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
4
|
+
<RegistrationInfo>
|
|
5
|
+
<Description>${I(r.description)}</Description>
|
|
6
|
+
</RegistrationInfo>
|
|
7
|
+
<Triggers>
|
|
8
|
+
${t}
|
|
9
|
+
</Triggers>
|
|
10
|
+
<Principals>
|
|
11
|
+
<Principal id="Author">
|
|
12
|
+
<UserId>${e}</UserId>
|
|
13
|
+
<LogonType>InteractiveToken</LogonType>
|
|
14
|
+
<RunLevel>LeastPrivilege</RunLevel>
|
|
15
|
+
</Principal>
|
|
16
|
+
</Principals>
|
|
17
|
+
<Settings>
|
|
18
|
+
<MultipleInstancesPolicy>${n?"StopExisting":"IgnoreNew"}</MultipleInstancesPolicy>
|
|
19
|
+
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
20
|
+
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
|
21
|
+
<StartWhenAvailable>true</StartWhenAvailable>
|
|
22
|
+
<IdleSettings>
|
|
23
|
+
<StopOnIdleEnd>false</StopOnIdleEnd>
|
|
24
|
+
<RestartOnIdle>false</RestartOnIdle>
|
|
25
|
+
</IdleSettings>
|
|
26
|
+
<ExecutionTimeLimit>${n?"PT0S":"PT1H"}</ExecutionTimeLimit>
|
|
27
|
+
<Priority>${n?5:7}</Priority>
|
|
28
|
+
</Settings>
|
|
29
|
+
<Actions Context="Author">
|
|
30
|
+
<Exec>
|
|
31
|
+
<Command>%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe</Command>
|
|
32
|
+
<Arguments>${I(i)}</Arguments>
|
|
33
|
+
</Exec>
|
|
34
|
+
</Actions>
|
|
35
|
+
</Task>
|
|
36
|
+
`}function V(r){return Buffer.concat([Buffer.from([255,254]),Buffer.from(r.replaceAll(`\r
|
|
37
|
+
`,`
|
|
38
|
+
`).replaceAll(`
|
|
39
|
+
`,`\r
|
|
40
|
+
`),"utf16le")])}function j(r){let e=me(r);return(e[0]===255&&e[1]===254?e.subarray(2).toString("utf16le"):e.toString("utf8")).replaceAll(`\r
|
|
41
|
+
`,`
|
|
42
|
+
`)}function F(r,e){return["/Create","/TN",r,"/XML",e,"/F"]}function E(r){return["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",Buffer.from(r,"utf16le").toString("base64")]}function _(r){return`'*${M(r).replaceAll("'","''")}*'`}function T(r,e){return E(["$all = @(Get-CimInstance Win32_Process)",`$wrappers = @($all | ? { $_.ProcessId -ne $PID -and $_.CommandLine -like ${_(r)} })`,...e.keepWrapper?[]:["foreach ($w in $wrappers) { Stop-Process -Id $w.ProcessId -Force -ErrorAction SilentlyContinue }"],`foreach ($w in $wrappers) { $all | ? { $_.ParentProcessId -eq $w.ProcessId } | % { taskkill.exe /F ${e.tree?"/T ":""}/PID $_.ProcessId | Out-Null } }`].join(`
|
|
43
|
+
`))}function X(r){return E(["$all = @(Get-CimInstance Win32_Process)",`$wrappers = @($all | ? { $_.ProcessId -ne $PID -and $_.CommandLine -like ${_(r)} })`,"foreach ($w in $wrappers) { if ($all | ? { $_.ParentProcessId -eq $w.ProcessId -and $_.Name -ne 'conhost.exe' }) { 'running'; exit 0 } }","exit 1"].join(`
|
|
44
|
+
`))}function G(r,e=process.pid){let n=de(x("powershell.exe"),E(["$all = @{}; Get-CimInstance Win32_Process | % { $all[[int]$_.ProcessId] = $_ }",`$p = $all[${Math.trunc(e)}]`,"for ($i = 0; $p -and $i -lt 64; $i++) {",` if ($p.CommandLine -like ${_(r)}) { exit 10 }`," $n = $all[[int]$p.ParentProcessId]"," if (-not $n -or $n.ProcessId -eq $p.ProcessId -or $n.CreationDate -gt $p.CreationDate) { exit 11 }"," $p = $n","}","exit 11"].join(`
|
|
45
|
+
`)),{stdio:"ignore",timeout:15000,windowsHide:!0});return n.status===10?!0:n.status===11?!1:null}var Ir="REASON_WORKER_SERVICE",Ie="worker_identity_unavailable";function be(r){return{platform:process.platform,home:r,uid:process.getuid?.(),command:(e,n)=>v(x(e),[...n],{stdio:"ignore"}).status??1,read:(e,n)=>{let t=v(x(e),[...n],{stdio:["ignore","pipe","ignore"],encoding:"utf8",timeout:1e4});return t.status===0?t.stdout:null},sleep:(e)=>Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e),workerIdentity:(e)=>lo(r,e),insideService:(e,n)=>xe(e,process.platform,process.getuid?.(),n)}}function xe(r,e,n,t=!0){if(process.env[Ir]===r||process.env.XPC_SERVICE_NAME===r)return!0;if(e==="linux")try{return k("/proc/self/cgroup","utf8").includes(`/${r}.service`)}catch{return!0}if(e==="win32")return G(r)??t;if(e!=="darwin")return!1;if(typeof n!=="number")return!0;let i=v("/bin/launchctl",["print",`gui/${n}/${r}`],{encoding:"utf8",timeout:5000});if(i.status===Ee)return!1;if(i.error||i.status!==0)return!0;let s=Number(/^\s*pid = (\d+)$/m.exec(i.stdout??"")?.[1]??0);if(!s)return!1;let a=process.pid;for(let o=0;o<64&&a>1;o+=1){if(a===s)return!0;let l=v("/bin/ps",["-o","ppid=","-p",String(a)],{encoding:"utf8",timeout:5000}),c=Number(l.stdout?.trim());if(l.error||l.status!==0||!Number.isSafeInteger(c)||c<=0)return!0;if(c===a)return!1;a=c}return a>1}var Ee=113;class K extends Error{code;constructor(r,e){super(r);this.code=e}}function Cn(r,e){if(!re(r.home,r.platform))throw new K(ee);if(r.platform==="darwin")S(r);let n=Tn(Nr(e,r.home)),t=g({env:e})==="staging",i=t?"ara-staging":"ara",s=[n?Pn(n):null,C(e,"REASON_CLI_LAUNCHER_PATH")?.trim(),r.platform==="win32"?p(r.home,"AppData","Local","Reason",...t?["staging"]:[],"bin",t?"reason-staging.exe":"reason.exe"):p(r.home,".local","bin",i)];for(let a of s)try{if(a&&Y(a)&&ve(a).isFile())return Lr(a)}catch{}throw new K(`A background service runs the installed Reason launcher, which was not found. Install Reason with: ${r.platform==="win32"?"irm https://reasonmachines.com/install.ps1 | iex":"curl -fsSL https://reasonmachines.com/install | sh"}`,"worker_launcher_missing")}var R=/(<key>ProgramArguments<\/key>\s*<array>\n)((?:\s*<string>[^<]*<\/string>\n)*)(\s*<\/array>)/,y=new RegExp(`(\\n\\s*<key>${Ut}</key>\\s*<string>)[^<]*(</string>)`),_e=/(<key>EnvironmentVariables<\/key>\s*<dict>[\s\S]*?)(\n\s*<\/dict>)/;function Te(r){return r.replaceAll("<","<").replaceAll(">",">").replaceAll(""",'"').replaceAll("'","'").replaceAll("&","&")}function J(r){let e=[...(R.exec(r)?.[2]??"").matchAll(/<string>([^<]*)<\/string>/g)].map((t)=>Te(t[1])),n=e[1]==="--run-worker"?e.slice(2):e;return n[0]?{launcher:n[0],args:n.slice(1)}:null}function z(r,e,n){let t=n.workerIdentity?.(r)??null;return{program:t?[t.executable,"--run-worker",r,...e]:[r,...e],identity:t}}function h(r){return r.map((e)=>` <string>${d(e)}</string>`).join(`
|
|
46
|
+
`)}function Z(r,e){let n;try{n=k(r,"utf8")}catch{return null}let t=J(n);if(!t)return null;let i=Y(t.launcher)?Lr(t.launcher):t.launcher,{program:s,identity:a}=z(i,t.args,e),o=n.replace(R,(l,c,m,O)=>`${c}${h(s)}
|
|
47
|
+
${O}`);if(!a)o=o.replace(y,"");else if(y.test(o))o=o.replace(y,(l,c,m)=>`${c}${d(a.app)}${m}`);else o=o.replace(_e,(l,c,m)=>`${c}
|
|
48
|
+
<key>${Ut}</key>
|
|
49
|
+
<string>${d(a.app)}</string>${m}`);return o===n?null:o}function Pe(r,e){let n=Z(r,e);if(n!==null)A(r,n)}function ps(r,e,n){if(e.platform!=="darwin")return!1;let t=qe(r,e,n);return t!==null&&Z(t.definition,e)!==null}var W="com.reasonmachines.worker.",N="so.reason.worker.",Q=[W,N];function Wi(r,e=W){return`${e}connect${r==="production"?"":`.${r}`}`}function hs(r,e){return Q.some((n)=>r===Wi(e,n))}function Re(r,e,n){if(e==="connect")return Wi(r.channel,n);let t=ke("sha256").update(r.workspaceRoot).digest("hex").slice(0,8);return`${n}${r.name.toLowerCase()}.${t}`}var ee="A background service needs macOS (launchd), Linux (systemd --user) or Windows (Task Scheduler).";function re(r,e){if(e==="darwin")return{directory:p(r,"Library","LaunchAgents"),suffix:".plist"};if(e==="linux")return{directory:p(r,".config","systemd","user"),suffix:".service"};if(e==="win32")return{directory:H(r),suffix:".xml"};return null}function f(r,e,n,t=W){let i=Re(r,n,t),s=re(e.home,e.platform);if(!s)return null;return{label:i,definition:p(s.directory,`${i}${s.suffix}`),logs:e.platform==="linux"?`journalctl --user -u ${i}.service`:p(r.stateDirectory,"service.log")}}function qe(r,e,n="serve"){return ne(r,e,n)[0]??null}function ne(r,e,n){return Q.map((t)=>f(r,e,n,t)).filter((t)=>t!==null&&P(t.definition))}function te(r,e,n){let t=f(r,e,n,N);return t&&P(t.definition)?t:null}function Oo(r,e,n){let t=f(r,e,n),i=te(r,e,n);if(!t||!i||!P(t.definition)||e.insideService?.(i.label))return null;if(!Ce(t,e))return"current_not_running";if(e.platform==="darwin"){if(typeof e.uid==="number"&&e.uid>0)e.command("/bin/launchctl",["bootout",`gui/${e.uid}/${i.label}`]);return u(i.definition,{force:!0}),"retired"}if(e.platform==="win32")return b(i,e,!0),"retired";return e.command("systemctl",["--user","disable","--now",`${i.label}.service`]),u(i.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"]),"retired"}function Ce(r,e){if(e.platform==="darwin")return typeof e.uid==="number"&&e.uid>0&&e.command("/bin/launchctl",["print",`gui/${e.uid}/${r.label}`])===0;if(e.platform==="win32")return e.command("schtasks",["/Query","/TN",r.label])===0;let n=`${r.label}.service`;return e.command("systemctl",["--user","is-enabled","--quiet",n])===0&&he.has(e.read("systemctl",["--user","show","--property=ActiveState","--value",n])?.trim()??"")}var he=new Set(["active","activating","reloading"]);function An(r,e){if(e.platform==="darwin"){if(typeof e.uid!=="number"||e.uid<=0)return!1;let n=e.read("/bin/launchctl",["print",`gui/${e.uid}/${r.label}`]);return Number(/^\s*pid = (\d+)$/m.exec(n??"")?.[1]??0)>0}if(e.platform==="win32")return e.read("powershell.exe",X(r.label))?.trim()==="running";return Number(e.read("systemctl",["--user","show","--property=MainPID","--value",`${r.label}.service`])?.trim()??0)>0}function fs(r){let{config:e,launcher:n,host:t,kind:i}=r,s=f(e,t,i);if(!s)return!1;let a;try{a=t.platform==="win32"?j(s.definition):k(s.definition,"utf8")}catch{return!1}if(t.platform==="win32")return a===se(e,i,s,n);if(t.platform!=="darwin")return a===oe(e,i,s,n,t.home,r.path);let o=J(a);return a.replace(y,"").replace(R,(c,m,O,ue)=>`${m}${o?`${h([o.launcher,...o.args])}
|
|
50
|
+
`:""}${ue}`)===ie(e,i,s,n,{...t,workerIdentity:()=>null},r.path).plist}function L(r,e){if(e==="connect")return{args:["connect"],environment:{REASON_CLI_CHANNEL:r.channel},description:"Reason connection of this computer"};return{args:["serve",r.name,"--dir",r.workspaceRoot,...r.executionMode==="confined"?["--sandbox"]:[]],environment:{},description:`Reason machine ${r.name} worker`}}function d(r){return r.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function q(r,e=!1){if(/[\0-\x1f\x7f]/.test(r))throw new K("A background service cannot use a path with control characters.");let n=r.replaceAll("\\","\\\\").replaceAll('"',"\\\"").replaceAll("%","%%");return`"${e?n.replaceAll("$","$$$$"):n}"`}function ie(r,e,n,t,i,s){let a=L(r,e),o=z(t,a.args,i),l={HOME:i.home,PATH:s,[Ir]:n.label,...a.environment,...o.identity?{[Ut]:o.identity.app}:{}};return{identity:o.identity,plist:`<?xml version="1.0" encoding="UTF-8"?>
|
|
51
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
52
|
+
<plist version="1.0">
|
|
53
|
+
<dict>
|
|
54
|
+
<key>Label</key>
|
|
55
|
+
<string>${d(n.label)}</string>
|
|
56
|
+
<key>AssociatedBundleIdentifiers</key>
|
|
57
|
+
<array>
|
|
58
|
+
<string>${Ln}</string>
|
|
59
|
+
</array>
|
|
60
|
+
<key>ProgramArguments</key>
|
|
61
|
+
<array>
|
|
62
|
+
${h(o.program)}
|
|
63
|
+
</array>
|
|
64
|
+
<key>EnvironmentVariables</key>
|
|
65
|
+
<dict>
|
|
66
|
+
${Object.entries(l).map(([c,m])=>` <key>${c}</key>
|
|
67
|
+
<string>${d(m)}</string>`).join(`
|
|
68
|
+
`)}
|
|
69
|
+
</dict>
|
|
70
|
+
<key>RunAtLoad</key>
|
|
71
|
+
<true/>
|
|
72
|
+
<key>KeepAlive</key>
|
|
73
|
+
<dict>
|
|
74
|
+
<key>SuccessfulExit</key>
|
|
75
|
+
<false/>
|
|
76
|
+
</dict>
|
|
77
|
+
<key>ThrottleInterval</key>
|
|
78
|
+
<integer>10</integer>
|
|
79
|
+
<key>ExitTimeOut</key>
|
|
80
|
+
<integer>${Math.ceil(r.shutdownGraceMs/1000)+10}</integer>
|
|
81
|
+
<key>ProcessType</key>
|
|
82
|
+
<string>Standard</string>
|
|
83
|
+
<key>Umask</key>
|
|
84
|
+
<integer>63</integer>
|
|
85
|
+
<key>StandardOutPath</key>
|
|
86
|
+
<string>${d(n.logs)}</string>
|
|
87
|
+
<key>StandardErrorPath</key>
|
|
88
|
+
<string>${d(n.logs)}</string>
|
|
89
|
+
</dict>
|
|
90
|
+
</plist>
|
|
91
|
+
`}}function oe(r,e,n,t,i,s){let a=L(r,e);return`[Unit]
|
|
92
|
+
Description=${a.description}
|
|
93
|
+
|
|
94
|
+
[Service]
|
|
95
|
+
ExecStart=${[t,...a.args].map((o)=>q(o,!0)).join(" ")}
|
|
96
|
+
Environment=${[`HOME=${i}`,`PATH=${s}`,`${Ir}=${n.label}`,...Object.entries(a.environment).map(([o,l])=>`${o}=${l}`)].map((o)=>q(o)).join(" ")}
|
|
97
|
+
Restart=on-failure
|
|
98
|
+
RestartSec=10
|
|
99
|
+
TimeoutStopSec=${Math.ceil(r.shutdownGraceMs/1000)+10}
|
|
100
|
+
UMask=0077
|
|
101
|
+
|
|
102
|
+
[Install]
|
|
103
|
+
WantedBy=default.target
|
|
104
|
+
`}function se(r,e,n,t){let i=L(r,e);return B({description:i.description,schedule:"logon",script:U({name:n.label,program:t,args:i.args,environment:{[Ir]:n.label,...i.environment},log:n.logs,keepAlive:!0})})}function ae(r,e,n){e.command("powershell.exe",T(r.label,{tree:n,keepWrapper:!n}))}function b(r,e,n){e.command("schtasks",["/Delete","/F","/TN",r.label]),e.command("powershell.exe",T(r.label,{tree:n,keepWrapper:!1})),u(r.definition,{force:!0})}function A(r,e){$e(Ae(r),{recursive:!0,mode:448});let n=`${r}.${Se()}.tmp`;try{We(n,e,{mode:384,flag:"wx"}),we(n,384),ye(n,r)}finally{u(n,{force:!0})}}function S(r){if(typeof r.uid!=="number"||!Number.isSafeInteger(r.uid)||r.uid<=0)throw new K("Set up a background service as your own user, not with sudo.","worker_service_root_user");return`gui/${r.uid}`}function ms(r){let{config:e,launcher:n,host:t}=r,i=r.kind??"serve",s=te(e,t,i),a=s!==null&&t.insideService?.(s.label)===!0,o=f(e,t,i,a?N:W);if(!o)throw new K(ee);if(t.platform==="darwin")S(t);if(t.platform==="linux"&&t.command("systemctl",["--user","show-environment"])!==0)throw new K("No background service here: this computer has no systemd user session.","worker_service_manager_missing");let l=t.platform==="darwin"?ie(e,i,o,n,t,r.path):null;if(A(o.definition,l?l.plist:t.platform==="win32"?V(se(e,i,o,n)):oe(e,i,o,n,t.home,r.path)),le(e,t,o,a?null:s),l)return l.identity?o:{...o,identityProblem:Ie};if(t.platform==="win32")return o;return{...o,lingering:t.command("loginctl",["enable-linger"])===0}}function le(r,e,n,t){if(e.platform==="darwin"){let a=S(e);if(t)e.command("/bin/launchctl",["bootout",`${a}/${t.label}`]);if(ce(r,n,e)){if(t)u(t.definition,{force:!0});return}if(u(n.definition,{force:!0}),t)e.command("/bin/launchctl",["bootstrap",a,t.definition]);throw new K("Could not start the background service (launchctl bootstrap failed).","worker_service_start_failed")}if(e.platform==="win32"){if(t)b(t,e,!0);if(e.command("schtasks",F(n.label,n.definition))===0){if(ae(n,e,e.insideService?.(n.label)!==!0),e.command("schtasks",["/Run","/TN",n.label])===0)return}throw b(n,e,!0),new K("Could not start the background service (schtasks failed).")}let i=`${n.label}.service`,s=t?`${t.label}.service`:null;if(e.command("systemctl",["--user","daemon-reload"])!==0||s!==null&&e.command("systemctl",["--user","disable","--now",s])!==0||e.command("systemctl",["--user","enable",i])!==0||e.command("systemctl",["--user","restart",i])!==0){if(e.command("systemctl",["--user","disable",i]),u(n.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"]),s)e.command("systemctl",["--user","enable","--now",s]);throw new K("Could not start the background service (systemctl --user failed).","worker_service_start_failed")}if(t)u(t.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"])}function ce(r,e,n){let t=S(n);n.command("/bin/launchctl",["bootout",`${t}/${e.label}`]);let i=(Math.ceil(r.shutdownGraceMs/1000)+10)*1000;for(let s=0,a=100;;a=Math.min(a*2,2000)){if(n.command("/bin/launchctl",["bootstrap",t,e.definition])===0)return!0;if(s>=i)return!1;n.sleep(a),s+=a}}function Dr(r,e,n){let t=qe(r,e,n);if(!t)return null;let i=e.insideService?.(t.label)===!0;if(e.platform==="darwin"&&!i)Pe(t.definition,e);let s=f(r,e,n);if(s&&t.label!==s.label&&!i)return A(s.definition,k(t.definition,"utf8").replaceAll(t.label,s.label)),le(r,e,s,t),s;let a=e.platform==="darwin"&&i,o;if(e.platform==="win32")ae(t,e,!i),o=e.command("schtasks",["/Run","/TN",t.label])===0;else if(a)o=e.command("/bin/launchctl",["kickstart","-k",`${S(e)}/${t.label}`])===0;else if(e.platform==="darwin")o=ce(r,t,e);else e.command("systemctl",["--user","enable",`${t.label}.service`]),o=e.command("systemctl",["--user","restart",`${t.label}.service`])===0;if(!o)throw new K(`Could not restart the background service ${t.label}.`,"worker_service_restart_failed");if(s&&t.label===s.label)Oo(r,e,n);return t}function gs(r,e,n,t){let i=qe(r,n,t),s=f(e,n,t);if(n.platform!=="darwin"||!i||!s)return;let a=`<string>${d(i.logs)}</string>`,o=k(i.definition,"utf8");if(o.includes(a))A(i.definition,o.replaceAll(a,`<string>${d(s.logs)}</string>`))}function _s(r,e,n="serve"){let t=ne(r,e,n);for(let i of t){if(e.platform==="win32"){b(i,e,e.insideService?.(i.label,!1)!==!0);continue}if(e.platform==="darwin"){if(typeof e.uid==="number"&&e.uid>0)e.command("/bin/launchctl",["bootout",`gui/${e.uid}/${i.label}`]);u(i.definition,{force:!0});continue}e.command("systemctl",["--user","disable","--now",`${i.label}.service`]),u(i.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"])}return t[0]??null}
|
|
105
|
+
export{Ir,be,K,Cn,ps,Wi,hs,qe,Oo,An,fs,ms,Dr,gs,_s};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var Ht={name:"github-native-engineer-device-worker-production",version:"0.2.410",private:!0,type:"module",engines:{node:">=22",bun:">=1.3.0"},workspaces:["../../packages/runtime-distribution"],dependencies:{"@anthropic-ai/sandbox-runtime":"^0.0.73","@earendil-works/pi-tui":"1.0.0","@modelcontextprotocol/sdk":"^1.29.0","@reason/runtime-distribution":"workspace:*","playwright-core":"1.60.0",zod:"^4.4.3"},overrides:{"@hono/node-server":"^1.19.15","@earendil-works/pi-agent-core":"1.0.0","@earendil-works/pi-ai":"1.0.0","@earendil-works/pi-coding-agent":"1.0.0","@earendil-works/chord":"1.0.0","@earendil-works/pi-codemode":"1.0.0","@earendil-works/pi-mcp":"1.0.0","@earendil-works/pi-telemetry":"1.0.0","@earendil-works/pi-tui":"1.0.0","brace-expansion":"2.1.7",axios:"^1.20.0","basic-ftp":"^6.2.1","@grpc/grpc-js":"^1.14.5",browserslist:"^4.28.8","engine.io":"^6.6.7","fast-uri":"^3.1.8",hono:"^4.13.7","ip-address":"^10.7.1",nanoid:"^3.3.18",dompurify:"^3.4.17",postcss:"^8.5.23",qs:"^6.16.0","shell-quote":"^1.11.0","socket.io-parser":"^4.2.7",tmp:"^0.2.7",toml:"^4.2.0",undici:"^8.10.2",ws:"^8.21.0","js-yaml":"^4.3.2","@modelcontextprotocol/sdk":"^1.31.0","proxy-addr":"^2.0.8","source-map-js":"^1.2.2"}};
|
|
3
|
+
export{Ht};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{he}from"./vm-hands-entry-lite-0xrsph3r.js";var Yr=he(function(t,e){e.exports={name:"playwright-core",version:"1.60.0",description:"A high-level API to automate web browsers",repository:{type:"git",url:"git+https://github.com/microsoft/playwright.git"},homepage:"https://playwright.dev",engines:{node:">=18"},author:{name:"Microsoft Corporation"},license:"Apache-2.0",exports:{".":{types:"./index.d.ts",import:"./index.mjs",require:"./index.js",default:"./index.js"},"./package.json":"./package.json","./lib/bootstrap":"./lib/bootstrap.js","./lib/coreBundle":"./lib/coreBundle.js","./lib/utilsBundle":"./lib/utilsBundle.js","./lib/tools/cli-client/program":"./lib/tools/cli-client/program.js"},bin:{"playwright-core":"cli.js"},types:"types/types.d.ts"}});
|
|
3
|
+
export{Yr};
|