@reason-machines/cli-linux-x64 0.2.524 → 0.2.527
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-rwy5ys03.js +2 -0
- package/bin/vm-hands/api-rjgpedvk.js +2 -0
- package/bin/vm-hands/connect-cli-p72wek72.js +2 -0
- package/bin/vm-hands/credentials-6mbx2mke.js +2 -0
- package/bin/vm-hands/{custom-endpoint-device-hzgdnyx2.js → custom-endpoint-device-6d759gkr.js} +1 -1
- package/bin/vm-hands/desktop-account-fpf13hm4.js +2 -0
- package/bin/vm-hands/desktop-wallpaper-fd8f2wb2.jpg +0 -0
- package/bin/vm-hands/device-workspace-rxqaw78v.js +2 -0
- package/bin/vm-hands/dock-browser-y53t41cx.png +0 -0
- package/bin/vm-hands/dock-files-cp52htdw.png +0 -0
- package/bin/vm-hands/dock-terminal-1es514yq.png +0 -0
- package/bin/vm-hands/hands-worker-source-hytk3v4n.js +2 -0
- package/bin/vm-hands/install-receipt-g15a9v84.js +2 -0
- package/bin/vm-hands/local-automation-pdhkw5de.js +2 -0
- package/bin/vm-hands/local-capabilities-pmks6jpv.js +2 -0
- package/bin/vm-hands/local-desktop-users-wkvb4dpg.js +2 -0
- package/bin/vm-hands/{local-display-mac-4654wqzs.js → local-display-mac-d1t1qve5.js} +1 -1
- package/bin/vm-hands/local-display-session-m8469h63.js +2 -0
- package/bin/vm-hands/local-display-video-6xq6fjtm.js +2 -0
- package/bin/vm-hands/local-managed-process-2tx1h7cb.js +2 -0
- package/bin/vm-hands/local-pty-session-p60ha91y.js +2 -0
- package/bin/vm-hands/managed-runtime-533929j6.js +2 -0
- package/bin/vm-hands/{network-contract-5wc6wbn2.js → network-contract-84vs9gfz.js} +1 -1
- package/bin/vm-hands/permissions-4myxznfs.js +2 -0
- package/bin/vm-hands/{reason-hands-protocol-zffy7kc8.js → reason-hands-protocol-t51p2jgn.js} +1 -1
- package/bin/vm-hands/serve-service-mjnye8vs.js +2 -0
- package/bin/vm-hands/{status-zd0m0308.js → status-m8cfgr58.js} +1 -1
- package/bin/vm-hands/version-gszhe6py.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-tash5m18.js → vm-hands-entry-lite-06e9xm3v.js} +22 -22
- package/bin/vm-hands/{vm-hands-entry-lite-3v5e9dnv.js → vm-hands-entry-lite-2egd9wr5.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-3gbf905c.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-9x81cr3a.js → vm-hands-entry-lite-3thdz953.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-5wsygx6n.js → vm-hands-entry-lite-4pm82ns4.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-88yjxxvf.js → vm-hands-entry-lite-5n4ay2gs.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-sfmeafdm.js → vm-hands-entry-lite-5nhmye0y.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-70hq7mrs.js → vm-hands-entry-lite-72nj66ab.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-765bds5b.js → vm-hands-entry-lite-7mntg1rq.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-c25055kf.js → vm-hands-entry-lite-8b6qfv1c.js} +9 -9
- package/bin/vm-hands/{vm-hands-entry-lite-ha0vh3dx.js → vm-hands-entry-lite-8n2hetqw.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-39qv4sqt.js → vm-hands-entry-lite-a0g6c3wr.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-f8ts9y2q.js → vm-hands-entry-lite-b48eyd09.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-4cdn822w.js → vm-hands-entry-lite-bjtcy8n6.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-a6w60nv9.js → vm-hands-entry-lite-c5pyaaax.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-ytbp79a3.js → vm-hands-entry-lite-c6m5n5gh.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-n3274tws.js → vm-hands-entry-lite-dxaa88rs.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-g2fpf867.js → vm-hands-entry-lite-ep1bq0xq.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-haws181e.js → vm-hands-entry-lite-gmxfz6k2.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-j1hddtjs.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-xvhr3w5q.js → vm-hands-entry-lite-jvvk1gjx.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-krnvgf71.js → vm-hands-entry-lite-jzmrhjkz.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-c4959xva.js → vm-hands-entry-lite-k2kx2ex0.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-bmcb94mq.js → vm-hands-entry-lite-kpahnwm7.js} +16 -16
- package/bin/vm-hands/{vm-hands-entry-lite-t82dzcxb.js → vm-hands-entry-lite-mc5y3xr9.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-wbxzshfw.js → vm-hands-entry-lite-mhw459y7.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-c0t5xpzh.js → vm-hands-entry-lite-mpy0j95a.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-wfc0agnt.js → vm-hands-entry-lite-msb3z9nq.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-tgj92a44.js → vm-hands-entry-lite-pd34mbnm.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-1kt82jes.js → vm-hands-entry-lite-q13ekwev.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-6jjyzq8k.js → vm-hands-entry-lite-q9spnspj.js} +28 -28
- package/bin/vm-hands/{vm-hands-entry-lite-v1btx3nd.js → vm-hands-entry-lite-r2100wsz.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-6brrr51c.js → vm-hands-entry-lite-rxfxd2hs.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-mfvtp7py.js → vm-hands-entry-lite-x342zztg.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-td73npv3.js → vm-hands-entry-lite-y9jarm7q.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-0tavq3p4.js → vm-hands-entry-lite-yfc1w62e.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-bvqwsd3b.js → vm-hands-entry-lite-yfvz7s4m.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-vnhd82px.js → vm-hands-entry-lite-ygymhgk8.js} +7 -7
- package/bin/vm-hands/{vm-hands-entry-lite-kwmjn9y3.js → vm-hands-entry-lite-yj9hbtm1.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-ckezse0f.js → vm-hands-entry-lite-yptpy066.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-zea60aw2.js +150 -0
- package/bin/vm-hands/{vm-hands-entry-lite-hc11hecd.js → vm-hands-entry-lite-zwnevt4c.js} +4 -4
- package/bin/vm-hands/vm-hands-entry-lite.js +2 -2
- package/bin/vm-hands/{vm-hands-executor-fbdagq20.js → vm-hands-executor-mx3j751y.js} +1 -1
- package/bin/vm-hands/{vm-hands-op-runner-ervm2ejw.js → vm-hands-op-runner-bpv5sz6e.js} +1 -1
- package/bin/vm-hands/{vm-hands-runtime-06vnnxs7.js → vm-hands-runtime-z81qbpbr.js} +3 -3
- package/bin/vm-hands/worker-preview-readiness-afw3ezwg.js +2 -0
- package/bin/vm-hands/worker-sandbox-egdjwgcp.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/api-credentials-h5pvsyv6.js +0 -2
- package/bin/vm-hands/api-y3wddcbr.js +0 -2
- package/bin/vm-hands/connect-cli-qq0wyze3.js +0 -2
- package/bin/vm-hands/credentials-md79hkqh.js +0 -2
- package/bin/vm-hands/desktop-account-gm7m5bwr.js +0 -2
- package/bin/vm-hands/desktop-wallpaper-0pjhgyfk.jpg +0 -0
- package/bin/vm-hands/device-workspace-qjyzphga.js +0 -2
- package/bin/vm-hands/dock-browser-afp005mt.png +0 -0
- package/bin/vm-hands/dock-files-rywdm96b.png +0 -0
- package/bin/vm-hands/dock-terminal-s41cj1jp.png +0 -0
- package/bin/vm-hands/hands-worker-source-hzkacxxz.js +0 -2
- package/bin/vm-hands/install-receipt-qtwtzafq.js +0 -2
- package/bin/vm-hands/local-automation-0mscbcpv.js +0 -2
- package/bin/vm-hands/local-capabilities-a6kkx72b.js +0 -2
- package/bin/vm-hands/local-desktop-users-qdpbfh6s.js +0 -2
- package/bin/vm-hands/local-display-session-6psj7n2e.js +0 -2
- package/bin/vm-hands/local-display-video-3x8y54at.js +0 -2
- package/bin/vm-hands/local-managed-process-5gxffbj0.js +0 -2
- package/bin/vm-hands/local-pty-session-s60ca00y.js +0 -2
- package/bin/vm-hands/managed-runtime-7scceabc.js +0 -2
- package/bin/vm-hands/permissions-1ryfrbh1.js +0 -2
- package/bin/vm-hands/serve-service-p4txnmab.js +0 -2
- package/bin/vm-hands/version-brfsnc99.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-59ptspg7.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-mcjca0ez.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-q6rfab8y.js +0 -150
- package/bin/vm-hands/worker-preview-readiness-8ftb3nbw.js +0 -2
- package/bin/vm-hands/worker-sandbox-k0vx97tx.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rt}from"./vm-hands-entry-lite-
|
|
3
|
-
`,{mode:420}),r("srt_base_keyed",{})}catch{r("srt_base_keyed_skipped",{reason:"error"})}}function B(r,n){let t=(u)=>(n("srt_warm_skipped",{reason:u}),Promise.resolve());if(typeof r.srt_base_settings!=="string")return t("no_settings");let s=Buffer.from(r.srt_base_settings,"base64");if(s.length===0||s.length>se||s.toString("base64")!==r.srt_base_settings)return t("settings_invalid");let a;try{let u=N(U);if(!u.isDirectory()||u.uid!==0||(u.mode&18)!==0)return t("cgroup_unsafe");let f=oe.find((y)=>N(y,{throwIfNoEntry:!1})!==void 0);if(!f)return t("cgroup_or_exec_missing");a=f;for(let[y,m]of[[a,!1],["/usr/local/bin",!0]]){let _=N(y);if((m?!_.isDirectory():!_.isFile())||_.uid!==0||(_.mode&18)!==0)return t("srt_exec_unsafe")}}catch{return t("cgroup_or_exec_missing")}if((process.getuid?.()??-1)!==0)return t("not_root");let l=performance.now(),g=ne("sha256").update(s).digest("hex"),c=`${O}/srt-base-settings.json`;try{z(c,s,{mode:384,flag:"w"})}catch{return t("settings_write")}let v=ee("/bin/sh",["-c",`echo $$ > ${U}/cgroup.procs || exit 125; exec "$@"`,"vm-hands-srt",a,"--settings",c,"--idle-ms",String(ae),"--","/bin/true"],{cwd:"/",env:{PATH:"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"},stdio:"ignore"});return new Promise((u)=>{v.once("error",()=>{n("srt_warm_failed",{reason:"spawn"}),u()}),v.once("close",(f)=>{n(f===0?"srt_warm_done":"srt_warm_failed",{exit_code:f,warm_ms:Math.round(performance.now()-l),settings_sha256:g}),u()})})}var Y=3000;function Re(r){if(!r||typeof r!=="object"||Array.isArray(r))return null;let n=r,{layout:t,device_key:s,credential:a}=n;return typeof n.workspace_id==="string"&&Number.isSafeInteger(n.instance_generation)&&typeof n.api_origin==="string"&&re.test(n.api_origin)&&typeof n.manifest_digest==="string"&&!!a&&typeof a.key_id==="string"&&Number.isSafeInteger(a.expires_at_ms)&&typeof a.signature==="string"&&!!t&&typeof t.session_root==="string"&&typeof t.alias==="string"&&Number.isSafeInteger(t.payload_uid)&&typeof t.kind==="string"&&!!s&&typeof s.pkcs8==="string"&&typeof s.spki==="string"?n:null}function D(r){j(r,{recursive:!0,mode:448});let n=te(r);if(!n.isDirectory()||(n.mode&63)!==0||n.uid!==(process.getuid?.()??-1))throw Error(`vm_hands_runtime_directory_unsafe: ${r}`)}async function ce(r){let[{CLI_VERSION:n},t,s,a]=await Promise.all([import("./version-
|
|
4
|
-
`)){let t=n.split(":");if(t.length>=4&&Number(t[2])===r&&/^\d+$/.test(t[3]??"")&&Number(t[3])>0)return Number(t[3])}throw Error("vm_hands_payload_account_unavailable")}function fe(r,n){let t=n.owner;if(!t||typeof t.organization_id!=="string"||typeof t.device_id!=="string"||typeof n.root_id!=="string")return null;return{version:4,apiOrigin:r.api_origin,orgId:t.organization_id,deviceId:t.device_id,devicePublicKey:"",displayName:"vm-hands",registeredAt:new Date(0).toISOString(),handsSlots:1,roots:[{id:n.root_id,label:"workspace",path:V,pathFingerprint:"0".repeat(64),permissions:{read:!0,write:!0,execute:!0,discover_environment:!0,expose_mcp:!1}}]}}function we(r=process.platform,n="/proc/self/oom_score_adj"){if(r!=="linux")return null;let t;try{t=G(n,"utf8").trim()}catch{return{value:"unreadable"}}if(!/^-?\d+$/.test(t))return{value:"unreadable"};let s=Number(t);return s<0?{value:s}:null}async function ke(r,n){let t=we();if(t)n("vm_hands.oom_protected",{code:"vm_hands_oom_protected",value:t.value}),await new Promise(()=>{setInterval(()=>{return},1073741824)});D(O),D(W),D(A),ie(n);let s=B(r,n),a=!1,l=async()=>{if(!await Promise.race([s.then(()=>!0),new Promise((o)=>setTimeout(()=>o(!1),Y).unref?.())]))a=!0,n("srt_warm_late",{wait_ms:Y})},[{configureDesktopAccount:g},{configureWorkerSandbox:c}]=await Promise.all([import("./desktop-account-
|
|
2
|
+
import{rt}from"./vm-hands-entry-lite-5n4ay2gs.js";import"./vm-hands-entry-lite-x342zztg.js";import{It}from"./vm-hands-entry-lite-pd34mbnm.js";import{zi,pn,qi}from"./vm-hands-entry-lite.js";import{spawn as ee}from"child_process";import{createHash as ne}from"crypto";import{lstatSync as N,mkdirSync as j,readFileSync as G,statSync as te,writeFileSync as z}from"fs";var O="/run/reason-vm-hands",W="/run/reason-vm-hands/env",A="/run/reason-vm-hands/surface",V="/home/runner/.reason/workspace",re=/^https:\/\/[a-z0-9.-]+(?::\d{1,5})?$/,U="/sys/fs/cgroup/reason-srt",oe=["/usr/local/bin/reason-srt-exec","/usr/local/bin/ara-srt-exec"],se=65536,ae=21600000;function ie(r,n="/run/ara-srt"){try{if((process.getuid?.()??-1)!==0)return;j(n,{recursive:!0,mode:448});let t=N(n);if(!t.isDirectory()||t.uid!==0||(t.mode&63)!==0){r("srt_base_keyed_skipped",{reason:"socket_dir_unsafe"});return}z(`${n}/base-keyed`,`1
|
|
3
|
+
`,{mode:420}),r("srt_base_keyed",{})}catch{r("srt_base_keyed_skipped",{reason:"error"})}}function B(r,n){let t=(u)=>(n("srt_warm_skipped",{reason:u}),Promise.resolve());if(typeof r.srt_base_settings!=="string")return t("no_settings");let s=Buffer.from(r.srt_base_settings,"base64");if(s.length===0||s.length>se||s.toString("base64")!==r.srt_base_settings)return t("settings_invalid");let a;try{let u=N(U);if(!u.isDirectory()||u.uid!==0||(u.mode&18)!==0)return t("cgroup_unsafe");let f=oe.find((y)=>N(y,{throwIfNoEntry:!1})!==void 0);if(!f)return t("cgroup_or_exec_missing");a=f;for(let[y,m]of[[a,!1],["/usr/local/bin",!0]]){let _=N(y);if((m?!_.isDirectory():!_.isFile())||_.uid!==0||(_.mode&18)!==0)return t("srt_exec_unsafe")}}catch{return t("cgroup_or_exec_missing")}if((process.getuid?.()??-1)!==0)return t("not_root");let l=performance.now(),g=ne("sha256").update(s).digest("hex"),c=`${O}/srt-base-settings.json`;try{z(c,s,{mode:384,flag:"w"})}catch{return t("settings_write")}let v=ee("/bin/sh",["-c",`echo $$ > ${U}/cgroup.procs || exit 125; exec "$@"`,"vm-hands-srt",a,"--settings",c,"--idle-ms",String(ae),"--","/bin/true"],{cwd:"/",env:{PATH:"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"},stdio:"ignore"});return new Promise((u)=>{v.once("error",()=>{n("srt_warm_failed",{reason:"spawn"}),u()}),v.once("close",(f)=>{n(f===0?"srt_warm_done":"srt_warm_failed",{exit_code:f,warm_ms:Math.round(performance.now()-l),settings_sha256:g}),u()})})}var Y=3000;function Re(r){if(!r||typeof r!=="object"||Array.isArray(r))return null;let n=r,{layout:t,device_key:s,credential:a}=n;return typeof n.workspace_id==="string"&&Number.isSafeInteger(n.instance_generation)&&typeof n.api_origin==="string"&&re.test(n.api_origin)&&typeof n.manifest_digest==="string"&&!!a&&typeof a.key_id==="string"&&Number.isSafeInteger(a.expires_at_ms)&&typeof a.signature==="string"&&!!t&&typeof t.session_root==="string"&&typeof t.alias==="string"&&Number.isSafeInteger(t.payload_uid)&&typeof t.kind==="string"&&!!s&&typeof s.pkcs8==="string"&&typeof s.spki==="string"?n:null}function D(r){j(r,{recursive:!0,mode:448});let n=te(r);if(!n.isDirectory()||(n.mode&63)!==0||n.uid!==(process.getuid?.()??-1))throw Error(`vm_hands_runtime_directory_unsafe: ${r}`)}async function ce(r){let[{CLI_VERSION:n},t,s,a]=await Promise.all([import("./version-gszhe6py.js"),import("./hands-worker-source-hytk3v4n.js"),import("./network-contract-84vs9gfz.js"),import("./device-workspace-rxqaw78v.js")]),{REASON_HANDS_PROTOCOL_VERSION:l}=await import("./reason-hands-protocol-t51p2jgn.js");return{reason_runtime_version:n,bridge_version:n,protocol_version:rt,execution_eligible:!0,instance_generation:r.instance_generation,capabilities:{supported_operations:["hands.connect"],hands_worker_artifact_sha256:t.REASON_HANDS_WORKER_ARTIFACT_SHA256,hands_worker_entrypoint:t.REASON_HANDS_WORKER_ENTRYPOINT,hands_slots:1,max_payload_bytes:s.LOCAL_OPERATION_MAX_BYTES,max_result_bytes:s.LOCAL_OPERATION_MAX_BYTES,operation_constraints:{"hands.connect":{ready:!0,execution_mode:"host",transport:"wss_relay",worker:"ara_hands",slots:1,session_group:s.HANDS_SESSION_GROUP,worker_version:t.REASON_HANDS_WORKER_VERSION,protocol_version:l,worker_artifact_sha256:t.REASON_HANDS_WORKER_ARTIFACT_SHA256,worker_entrypoint:t.REASON_HANDS_WORKER_ENTRYPOINT,policy_mode:"full_access",policy_version:1,workspace_base:a.REASON_WORKSPACE_BASE,workspace_layout:a.SESSION_WORKSPACE_LAYOUT,browser_state:"optional_headless",desktop:!1,max_session_ms:43200000,environment_delivery:s.HANDS_ENVIRONMENT_DELIVERY,[s.HANDS_ENVIRONMENT_AT_CLAIM_KEY]:s.HANDS_ENVIRONMENT_AT_CLAIM,[s.HANDS_CLOUD_ACCESS_KEY]:s.HANDS_CLOUD_ACCESS,[s.HANDS_LARGE_ENVIRONMENT_KEY]:s.HANDS_LARGE_ENVIRONMENT,[s.HANDS_CONFINEMENT_KEY]:s.HANDS_CONFINEMENT,[s.HANDS_JOBS_USER_KEY]:s.HANDS_JOBS_USER,vm_hands:"v1"}}}}}var I=["fs.read","fs.write","fs.export","fs.import","exec.run","exec.full","process.list","ports.list","pty.start","jobs.control"],X=["automation.call.v1","display.stream.v1","preview.serve.v1","tunnel.open","tunnel.close"],de=new Set(["pty.start","jobs.control","tunnel.open","tunnel.close"]),ue=60000,le=30000;function J(r,n){return{executionMode:"unsandboxed",runtimeDirectory:n,readiness:{...Object.fromEntries(I.map((t)=>[t,!0])),...r.lanes},...r.probing?{probing:X.filter((t)=>r.lanes[t]!==!0)}:{},...r.displayVideo?{displayVideo:!0}:{}}}function _e(r,n,t){let s=n([{id:"vm-hands",label:"workspace",path:V,pathFingerprint:"0".repeat(64),permissions:{read:!0,write:!0,execute:!0,discover_environment:!0,expose_mcp:!1}}],{worker:J(t,A)}),a=r.capabilities,l={...a.operation_constraints};for(let c of I)l[c]={...s.operation_constraints?.[c]??{},ready:!0,execution_mode:s.operation_constraints?.[c]?.execution_mode??"host"};let g=X.filter((c)=>s.operation_constraints?.[c]!==void 0);for(let c of g)l[c]=s.operation_constraints[c];return{...r,capabilities:{...a,supported_operations:["hands.connect",...I,...g],operation_constraints:l}}}function pe(r){for(let n of G("/etc/passwd","utf8").split(`
|
|
4
|
+
`)){let t=n.split(":");if(t.length>=4&&Number(t[2])===r&&/^\d+$/.test(t[3]??"")&&Number(t[3])>0)return Number(t[3])}throw Error("vm_hands_payload_account_unavailable")}function fe(r,n){let t=n.owner;if(!t||typeof t.organization_id!=="string"||typeof t.device_id!=="string"||typeof n.root_id!=="string")return null;return{version:4,apiOrigin:r.api_origin,orgId:t.organization_id,deviceId:t.device_id,devicePublicKey:"",displayName:"vm-hands",registeredAt:new Date(0).toISOString(),handsSlots:1,roots:[{id:n.root_id,label:"workspace",path:V,pathFingerprint:"0".repeat(64),permissions:{read:!0,write:!0,execute:!0,discover_environment:!0,expose_mcp:!1}}]}}function we(r=process.platform,n="/proc/self/oom_score_adj"){if(r!=="linux")return null;let t;try{t=G(n,"utf8").trim()}catch{return{value:"unreadable"}}if(!/^-?\d+$/.test(t))return{value:"unreadable"};let s=Number(t);return s<0?{value:s}:null}async function ke(r,n){let t=we();if(t)n("vm_hands.oom_protected",{code:"vm_hands_oom_protected",value:t.value}),await new Promise(()=>{setInterval(()=>{return},1073741824)});D(O),D(W),D(A),ie(n);let s=B(r,n),a=!1,l=async()=>{if(!await Promise.race([s.then(()=>!0),new Promise((o)=>setTimeout(()=>o(!1),Y).unref?.())]))a=!0,n("srt_warm_late",{wait_ms:Y})},[{configureDesktopAccount:g},{configureWorkerSandbox:c}]=await Promise.all([import("./desktop-account-fpf13hm4.js"),import("./worker-sandbox-egdjwgcp.js")]);c();try{g({value:String(r.layout.payload_uid)})}catch{n("payload_account_unavailable"),await new Promise(()=>{setInterval(()=>{return},1073741824)})}let v=new AbortController;for(let e of["SIGTERM","SIGINT"])process.on(e,()=>v.abort());let u=new Map,f,y=new Promise((e)=>{f=e}),m=y.then(()=>import("./vm-hands-executor-mx3j751y.js")).then(({createVmHandsExecutor:e})=>{let o=e({init:r,root:V,runtimeDirectory:O,apiOrigin:r.api_origin,prespawn:!0,onSrtReset:()=>{a=!1,s=B(r,n)},srtWarmLate:()=>a,forward:(d,i,E)=>u.get(d)?.(i,E)??Promise.reject(Error("vm_hands_not_bound")),log:(d,i)=>n(d,i)});return n("executor_loaded"),o}),_=(e)=>async(...o)=>(await m)[e](...o),x=null;m.then((e)=>{x=(o)=>e.executorExited(o)});let S={startExecutor:async(...e)=>(await l(),_("startExecutor")(...e)),killAndVerifyPayload:_("killAndVerifyPayload"),killProbe:_("killProbe"),runProbe:async(...e)=>(await l(),_("runProbe")(...e)),restatLayout:(e)=>{throw Error("replaced below")},verifyMounts:(e)=>{throw Error("replaced below")},installEnvironment:()=>{throw Error("replaced below")},executorExited:(e)=>x?x(e):new Promise(()=>{}),takeSrtFallbacks:()=>null};m.then((e)=>{S.restatLayout=(o)=>e.restatLayout(o),S.verifyMounts=(o)=>e.verifyMounts(o),S.installEnvironment=(o,d)=>e.installEnvironment(o,d),S.freezeBind=(o)=>e.freezeBind(o),S.takeSrtFallbacks=()=>e.takeSrtFallbacks?.()??null});let q=await zi(r),C=new pn(r,q,S,{envRoot:W}),M=ce(r),w={probing:!0,lanes:{},displayVideo:!1},L=null,K=null,Q=Promise.all([M,import("./local-capabilities-pmks6jpv.js")]).then(([e,o])=>{K=()=>_e(e,o.capabilityInventoryForRoots,w),n("device_ops_loaded")}).catch((e)=>n("device_ops_unavailable",{error:e instanceof Error?e.name:"error"})),H,R=(e)=>{clearTimeout(H),w=e,L?.()},b=y.then(()=>import("./vm-hands-executor-mx3j751y.js")).then(({createVmHandsOpRunners:e,vmHandsBindCgroup:o,VM_HANDS_PAYLOAD_CGROUP:d})=>e({payloadUid:r.layout.payload_uid,payloadGid:pe(r.layout.payload_uid),bindCgroup:(i)=>o(d,i),surfaceDirectory:A,onSurfaceReadiness:(i)=>{if(i)R({probing:!1,lanes:i.lanes??{},displayVideo:i.display_video===!0});else if(w.probing)R({probing:!1,lanes:{},displayVideo:!1})},log:(i,E)=>n(i,E)})).catch(()=>null);b.then((e)=>e?.warm("person")),b.then(async(e)=>{if(!e){R({probing:!1,lanes:{},displayVideo:!1});return}let o=Date.now()+le;while(C.settingUp&&Date.now()<o)await new Promise((d)=>setTimeout(d,250));H=setTimeout(()=>{if(w.probing)R({probing:!1,lanes:{},displayVideo:!1})},ue),H.unref?.(),e.warm("surface")}),n("agent_ready"),await qi({apiOrigin:r.api_origin,agent:C,signal:v.signal,heartbeat:async()=>K?.()??await M,onHeartbeatNow:(e)=>{L=e},executeOp:async({kind:e,claim:o,bindId:d,signal:i,emit:E})=>{let k=fe(r,o);if(!k)return{status:"failed",error_code:"vm_hands_bind_invalid"};let F={executionMode:"unsandboxed",runtimeDirectory:O,readiness:{...Object.fromEntries(I.map((p)=>[p,!0])),"tunnel.open":w.lanes["tunnel.open"]===!0,"tunnel.close":w.lanes["tunnel.close"]===!0}},T=(p)=>{let h=typeof p.kind==="string"?p.kind:"";if(h)E({kind:h,...p.data&&typeof p.data==="object"?{data:p.data}:{}})};if(o.capability==="exec.full"&&e!=="person")return{status:"failed",error_code:"capability_not_granted"};if(o.capability==="automation.call.v1"&&e!=="model")return{status:"failed",error_code:"capability_not_granted"};let Z=o.capability==="pty.start"&&e==="person"&&!o.authority;if(de.has(String(o.capability))&&!Z){let{executeLocalOperation:p}=await import("./local-capabilities-pmks6jpv.js");return p(k,o,{worker:F,signal:i,emit:(h)=>T(h)})}let P=await b;if(!P)return{status:"failed",error_code:"vm_hands_payload_account_unavailable"};if(It.has(String(o.capability))){if(w.lanes[String(o.capability)]!==!0)return{status:"failed",error_code:"capability_unavailable"};return P.run("surface",{id:String(o.attempt_id),claim:o,state:k,worker:J(w,A)},T,i)}return P.run(e,{id:String(o.attempt_id),claim:o,state:k,worker:F},T,i,d)},controlOp:async({claim:e,control:o})=>It.has(String(e.capability))&&((await b)?.notify("surface",{t:"control",id:String(e.attempt_id),control:{kind:o.kind,payload:o.payload??{}}})??!1),opCompleted:({claim:e,status:o,acknowledged:d})=>{if(d&&e.capability==="preview.serve.v1")b.then((i)=>i?.notify("surface",{t:"retire",operation_id:String(e.operation_id),status:o}))},readyData:({launchId:e})=>({executor_launch_id:e}),log:(e,o)=>{if(e==="vm_hands.registered"||e==="vm_hands.reconnected")f();n(e,o)},onTurn:(e,o)=>{if(o)u.set(e,o);else u.delete(e)}}),await(await m).stop(),(await b)?.stop()}export{Re as parseVmHandsInit,ke as runVmHands};
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Hi,es,ts,As}from"./vm-hands-entry-lite-6brrr51c.js";import"./vm-hands-entry-lite-3v5e9dnv.js";import"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-59ptspg7.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Hi as apiOriginFromEnvironment,ts as environmentApiKey,es as explicitApiOrigin,As as resolveApiCredentials};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{I,Ps,rs}from"./vm-hands-entry-lite-3v5e9dnv.js";import"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-59ptspg7.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{I as ApiError,rs as ReasonApi,Ps as createMachineEnrollmentTicketWithToken};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{it,Ss,Es,xs}from"./vm-hands-entry-lite-ytbp79a3.js";import"./vm-hands-entry-lite-f8ts9y2q.js";import"./vm-hands-entry-lite-0tavq3p4.js";import"./vm-hands-entry-lite-6brrr51c.js";import"./vm-hands-entry-lite-3v5e9dnv.js";import"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-xvhr3w5q.js";import"./vm-hands-entry-lite-6jjyzq8k.js";import"./vm-hands-entry-lite-wfc0agnt.js";import"./vm-hands-entry-lite-v1btx3nd.js";import"./vm-hands-entry-lite-bmcb94mq.js";import"./vm-hands-entry-lite-a6w60nv9.js";import"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-kwmjn9y3.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-765bds5b.js";import"./vm-hands-entry-lite-q6rfab8y.js";import"./vm-hands-entry-lite-c25055kf.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-g2fpf867.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-vnhd82px.js";import"./vm-hands-entry-lite-wbxzshfw.js";import"./vm-hands-entry-lite-59ptspg7.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Ss as computerDisconnected,it as connectionDirectory,Es as connectionReport,xs as restartConnection};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Fe,un,It,dn}from"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{Fe as credentialsPath,dn as deleteCredentials,It as loadCredentials,un as saveCredentials};
|
|
Binary file
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ue,Ce,Z,Ae,de,ir,et,X,O,H,Qr,en,tn,or,rn}from"./vm-hands-entry-lite-39qv4sqt.js";export{tn as CLOUD_REPOSITORY_WORKSPACE_ID,Qr as CLOUD_SESSION_CONTROL_BASE,or as CLOUD_SESSION_ROOT,Ce as HANDS_WORKSPACE_BASE_KEY,Ae as HANDS_WORKSPACE_LAYOUT_KEY,ue as REASON_WORKSPACE_BASE,Z as SESSION_WORKSPACE_LAYOUT,de as SESSION_WORKTREES,ir as SESSION_WORKTREE_ID,en as SIDECHAT_WORKSPACE_ID,rn as cloudSessionLayoutOfRoot,O as deviceWorkspaceRootRelative,X as isDeviceWorkspacePath,et as isSessionWorktreePath,H as parseDeviceWorkspace};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{D,T,cs,b,Cn}from"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{b as REASON_HANDS_WORKER_ARTIFACT_SHA256,T as REASON_HANDS_WORKER_ENTRYPOINT,cs as REASON_HANDS_WORKER_SOURCE,Cn as REASON_HANDS_WORKER_STARTUP_REFUSALS,D as REASON_HANDS_WORKER_VERSION};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{hs,Jr,ei,Zr,ti}from"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{hs as FUTURE_DEVICE_CONSENT_SCOPE,Jr as installationReceiptPath,Zr as installerReasonAlias,ei as installerReceiptLauncher,ti as loadInstallationReceipt};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Pn,Hs,zs,qs,Ws,Rn}from"./vm-hands-entry-lite-765bds5b.js";import"./vm-hands-entry-lite-q6rfab8y.js";import"./vm-hands-entry-lite-c25055kf.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-g2fpf867.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-vnhd82px.js";import"./vm-hands-entry-lite-wbxzshfw.js";import"./vm-hands-entry-lite-59ptspg7.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{zs as ensureLocalBrowser,Pn as localAutomationAvailable,qs as localBrowserProfile,Hs as localUserChromeHost,Ws as runAutomationCallLocally,Rn as runLocalAutomation};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ns,Wi,mn,is,os,ss,as,Ms,$s,Bs,Fs}from"./vm-hands-entry-lite-6jjyzq8k.js";import"./vm-hands-entry-lite-wfc0agnt.js";import"./vm-hands-entry-lite-v1btx3nd.js";import"./vm-hands-entry-lite-bmcb94mq.js";import"./vm-hands-entry-lite-a6w60nv9.js";import"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-kwmjn9y3.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-765bds5b.js";import"./vm-hands-entry-lite-q6rfab8y.js";import"./vm-hands-entry-lite-c25055kf.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-g2fpf867.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-vnhd82px.js";import"./vm-hands-entry-lite-wbxzshfw.js";import"./vm-hands-entry-lite-59ptspg7.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{r as LocalCapabilityError,ns as SHORT_REQUEST_CAPABILITIES,Ms as capabilityInventoryForRoots,Wi as confinedExecutionShell,is as defaultLocalCommandRunner,$s as deliverLocalHandsEnvironment,as as enrolledRootPaths,Fs as executeLocalOperation,Bs as rebindLocalHandsControl,os as runFileCapability,ss as runTransferCapability,mn as spawnCaptured};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Pt,Sa,Ea,ji,Ui}from"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Sa as forgetLocalDesktopUse,Ui as holdLocalDesktop,Pt as noteLocalDesktopUse,Ea as releaseLocalDesktop,ji as trackDesktopRun};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ft,Vs,G,qe,jt}from"./vm-hands-entry-lite-q6rfab8y.js";import"./vm-hands-entry-lite-c25055kf.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-g2fpf867.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-wbxzshfw.js";import"./vm-hands-entry-lite-59ptspg7.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{qe as ensureLinuxDesktop,Ft as localDisplayAvailable,Vs as localDisplayReady,G as privateDirectory,jt as runLocalDisplayStream};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{On,In,Dn,Nn,Rr}from"./vm-hands-entry-lite-c25055kf.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-g2fpf867.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-wbxzshfw.js";import"./vm-hands-entry-lite-59ptspg7.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{On as MAC_SCREEN,In as WINDOWS_SCREEN,Dn as createDisplayVideoLane,Rr as localDisplayVideoAvailable,Nn as simulatorVideoFfmpeg};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{st,fr,js,Us}from"./vm-hands-entry-lite-v1btx3nd.js";import"./vm-hands-entry-lite-bmcb94mq.js";import"./vm-hands-entry-lite-a6w60nv9.js";import"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-kwmjn9y3.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{st as ManagedProcessStoppedError,js as controlManagedDeviceProcess,Us as retireManagedDeviceProcess,fr as runManagedDeviceProcess};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ir,Vt,Dr,ds,Un,Nr,Hn}from"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{Vt as LOCAL_PTY_MAX_BUFFERED_OUTPUT_BYTES,Dr as LOCAL_PTY_MAX_SESSIONS,Ir as LOCAL_PTY_MAX_SESSION_MS,Nr as defaultConnect,ds as defaultLoginShell,Un as ptyRuntimeSupported,Hn as runLocalPtySession};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Rs,Ts,Os,Is,Ds,Ns,Ls}from"./vm-hands-entry-lite-xvhr3w5q.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-wbxzshfw.js";import"./vm-hands-entry-lite-59ptspg7.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Ds as acquireManagedRuntimeDirectoryLock,Os as currentManagedRuntimeVersion,Ls as flushManagedRuntimeLifecycleEvents,Is as isManagedRuntimeVersionExecutable,Ts as legacyManagedRuntimePaths,Rs as managedRuntimePaths,Ns as recordManagedRuntimeLifecycle};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ls,us,Ks,Js}from"./vm-hands-entry-lite-g2fpf867.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-wbxzshfw.js";import"./vm-hands-entry-lite-59ptspg7.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{Js as allowMacPermissions,Ks as permissionsSummary,us as readMacPermissions,ls as reasonIdentity};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Wr,xe,J,Jn,Zs,Do,Xs,Ye,ps,Zn,Ys,Qs,Vr,ea,ta}from"./vm-hands-entry-lite-vnhd82px.js";import"./vm-hands-entry-lite-wbxzshfw.js";import"./vm-hands-entry-lite-59ptspg7.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Wr as WORKER_SERVICE_ENV,J as WorkerServiceError,Do as connectServiceLabel,xe as defaultWorkerServiceHost,Qs as installWorkerService,Ye as installedWorkerService,Xs as isConnectServiceLabel,ta as removeWorkerService,Vr as restartWorkerService,ea as retargetWorkerServiceLogs,ps as retireLegacyWorkerService,Ys as workerServiceDefinitionCurrent,Jn as workerServiceLauncher,Zn as workerServiceProcessRunning,Zs as workerServiceRetargetPending};
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Mn,$n,Ro,Wt}from"./vm-hands-entry-lite-sfmeafdm.js";import{Tn,Ve,go,On,In,Dn,Rr,x}from"./vm-hands-entry-lite-c25055kf.js";import{Pt}from"./vm-hands-entry-lite-9x81cr3a.js";import{Nr}from"./vm-hands-entry-lite-5wsygx6n.js";import{j}from"./vm-hands-entry-lite-hc11hecd.js";import{a}from"./vm-hands-entry-lite-haws181e.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as oe,spawn as ae}from"child_process";import{randomBytes as ge}from"crypto";import{chmodSync as Me,existsSync as ce,lstatSync as Ce,mkdirSync as Ke,readFileSync as be,rmSync as xe,writeFileSync as T}from"fs";import{connect as Ie}from"net";import{join as P}from"path";var u=32,R=76;var W="./desktop-wallpaper-0pjhgyfk.jpg";var Y="./dock-browser-afp005mt.png";var v="./dock-files-rywdm96b.png";var Z="./dock-terminal-s41cj1jp.png";var H="./grok-wallpaper-71zwn2pj.jpg";var z="./grok-dock-browser-pzw59wnd.png";var V="./grok-dock-files-eckq444x.png";var ee="./grok-dock-terminal-hcpz3e43.png";var re=`# Sets the X root window background and _XROOTPMAP_ID, as feh --bg-fill does.
|
|
3
|
-
# The native Blaxel image ships no feh, hsetroot or compositor, but it does ship
|
|
4
|
-
# python3-gi and libX11. tint2 reads _XROOTPMAP_ID to draw its transparent panel.
|
|
5
|
-
# Usage: DISPLAY=:99 python3 set-root-wallpaper.py IMAGE
|
|
6
|
-
import ctypes, sys
|
|
7
|
-
import gi
|
|
8
|
-
gi.require_version("GdkPixbuf", "2.0")
|
|
9
|
-
from gi.repository import GdkPixbuf
|
|
10
|
-
x = ctypes.cdll.LoadLibrary("libX11.so.6")
|
|
11
|
-
x.XOpenDisplay.restype = ctypes.c_void_p
|
|
12
|
-
x.XOpenDisplay.argtypes = [ctypes.c_char_p]
|
|
13
|
-
d = x.XOpenDisplay(None)
|
|
14
|
-
if not d: sys.exit("no display")
|
|
15
|
-
for name, res, args in [
|
|
16
|
-
("XDefaultScreen", ctypes.c_int, [ctypes.c_void_p]),
|
|
17
|
-
("XRootWindow", ctypes.c_ulong, [ctypes.c_void_p, ctypes.c_int]),
|
|
18
|
-
("XDisplayWidth", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
|
|
19
|
-
("XDisplayHeight", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
|
|
20
|
-
("XDefaultDepth", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
|
|
21
|
-
("XDefaultVisual", ctypes.c_void_p, [ctypes.c_void_p, ctypes.c_int]),
|
|
22
|
-
("XDefaultGC", ctypes.c_void_p, [ctypes.c_void_p, ctypes.c_int]),
|
|
23
|
-
("XCreatePixmap", ctypes.c_ulong, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint]),
|
|
24
|
-
("XCreateImage", ctypes.c_void_p, [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint, ctypes.c_int, ctypes.c_int]),
|
|
25
|
-
("XPutImage", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_uint, ctypes.c_uint]),
|
|
26
|
-
("XInternAtom", ctypes.c_ulong, [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int]),
|
|
27
|
-
("XChangeProperty", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_int, ctypes.c_int, ctypes.c_void_p, ctypes.c_int]),
|
|
28
|
-
("XSetWindowBackgroundPixmap", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_ulong]),
|
|
29
|
-
("XClearWindow", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong]),
|
|
30
|
-
("XSetCloseDownMode", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
|
|
31
|
-
("XCloseDisplay", ctypes.c_int, [ctypes.c_void_p]),
|
|
32
|
-
]:
|
|
33
|
-
f = getattr(x, name); f.restype = res; f.argtypes = args
|
|
34
|
-
s = x.XDefaultScreen(d); root = x.XRootWindow(d, s)
|
|
35
|
-
w, h = x.XDisplayWidth(d, s), x.XDisplayHeight(d, s)
|
|
36
|
-
if x.XDefaultDepth(d, s) != 24: sys.exit("unsupported depth")
|
|
37
|
-
# Scale to cover the screen, then crop the centre.
|
|
38
|
-
src = GdkPixbuf.Pixbuf.new_from_file(sys.argv[1])
|
|
39
|
-
k = max(w / src.get_width(), h / src.get_height())
|
|
40
|
-
sw, sh = max(w, round(src.get_width() * k)), max(h, round(src.get_height() * k))
|
|
41
|
-
pb = src.scale_simple(sw, sh, GdkPixbuf.InterpType.BILINEAR).new_subpixbuf((sw - w) // 2, (sh - h) // 2, w, h).copy()
|
|
42
|
-
if pb.get_has_alpha(): pb = pb.composite_color_simple(w, h, GdkPixbuf.InterpType.NEAREST, 255, 1, 0, 0)
|
|
43
|
-
rgb, stride = pb.get_pixels(), pb.get_rowstride()
|
|
44
|
-
bgrx = bytearray(w * h * 4)
|
|
45
|
-
for y in range(h):
|
|
46
|
-
row = rgb[y * stride:y * stride + w * 3]; o = y * w * 4
|
|
47
|
-
bgrx[o:o + w * 4:4] = row[2::3]; bgrx[o + 1:o + w * 4:4] = row[1::3]; bgrx[o + 2:o + w * 4:4] = row[0::3]
|
|
48
|
-
buf = ctypes.create_string_buffer(bytes(bgrx), len(bgrx))
|
|
49
|
-
pix = x.XCreatePixmap(d, root, w, h, 24)
|
|
50
|
-
img = x.XCreateImage(d, x.XDefaultVisual(d, s), 24, 2, 0, buf, w, h, 32, 0) # ZPixmap
|
|
51
|
-
x.XPutImage(d, pix, x.XDefaultGC(d, s), img, 0, 0, 0, 0, w, h)
|
|
52
|
-
ref = ctypes.c_ulong(pix)
|
|
53
|
-
for atom in (b"_XROOTPMAP_ID", b"ESETROOT_PMAP_ID"):
|
|
54
|
-
x.XChangeProperty(d, root, x.XInternAtom(d, atom, 0), 20, 32, 0, ctypes.byref(ref), 1) # XA_PIXMAP, PropModeReplace
|
|
55
|
-
x.XSetWindowBackgroundPixmap(d, root, pix)
|
|
56
|
-
x.XClearWindow(d, root)
|
|
57
|
-
x.XSetCloseDownMode(d, 1) # RetainPermanent: the pixmap outlives this process
|
|
58
|
-
x.XCloseDisplay(d)
|
|
59
|
-
`;function Ne(e){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
60
|
-
<openbox_config xmlns="http://openbox.org/3.4/rc">
|
|
61
|
-
<theme><keepBorder>no</keepBorder></theme>
|
|
62
|
-
<applications>
|
|
63
|
-
<!-- Debian Chromium is "Chromium"; Chrome for Testing is "Chromium-browser". -->
|
|
64
|
-
<application class="Chromium*">
|
|
65
|
-
<decor>no</decor>
|
|
66
|
-
<position force="yes"><x>${u}</x><y>${u}</y></position>
|
|
67
|
-
<size><width>${e.width-u*2}</width><height>${e.height-u-R}</height></size>
|
|
68
|
-
</application>
|
|
69
|
-
</applications>
|
|
70
|
-
</openbox_config>`}var Te=`# Remote sandbox dock \u2014 launcher icons only, centred, no panel fill
|
|
71
|
-
panel_items = L
|
|
72
|
-
panel_size = 100% 46
|
|
73
|
-
panel_margin = 0 10
|
|
74
|
-
panel_padding = 0 0 10
|
|
75
|
-
panel_position = bottom center horizontal
|
|
76
|
-
panel_shrink = 1
|
|
77
|
-
panel_background_id = 0
|
|
78
|
-
panel_layer = top
|
|
79
|
-
mouse_effects = 1
|
|
80
|
-
mouse_hover_icon_asb = 100 0 12
|
|
81
|
-
mouse_pressed_icon_asb = 100 0 -12
|
|
82
|
-
|
|
83
|
-
launcher_icon_size = 46
|
|
84
|
-
launcher_padding = 0 0 10
|
|
85
|
-
launcher_background_id = 0
|
|
86
|
-
launcher_tooltip = 1
|
|
87
|
-
|
|
88
|
-
launcher_item_app = /tmp/ara-chromium.desktop
|
|
89
|
-
launcher_item_app = /tmp/ara-terminal.desktop
|
|
90
|
-
launcher_item_app = /tmp/ara-files.desktop
|
|
91
|
-
`,te=32,Ae=`# Remote sandbox dock (grok look) \u2014 small launcher icons only, centred, no panel fill
|
|
92
|
-
panel_items = L
|
|
93
|
-
panel_size = 100% ${te+16}
|
|
94
|
-
panel_margin = 0 0
|
|
95
|
-
panel_padding = 0 0 8
|
|
96
|
-
panel_position = bottom center horizontal
|
|
97
|
-
panel_shrink = 1
|
|
98
|
-
panel_background_id = 0
|
|
99
|
-
panel_layer = top
|
|
100
|
-
mouse_effects = 1
|
|
101
|
-
mouse_hover_icon_asb = 100 0 10
|
|
102
|
-
mouse_pressed_icon_asb = 100 0 -10
|
|
103
|
-
|
|
104
|
-
launcher_icon_size = ${te}
|
|
105
|
-
launcher_padding = 0 0 8
|
|
106
|
-
launcher_background_id = 0
|
|
107
|
-
launcher_tooltip = 1
|
|
108
|
-
|
|
109
|
-
launcher_item_app = /tmp/ara-chromium.desktop
|
|
110
|
-
launcher_item_app = /tmp/ara-files.desktop
|
|
111
|
-
launcher_item_app = /tmp/ara-terminal.desktop
|
|
112
|
-
`,Le=`corner-radius = 12;
|
|
113
|
-
rounded-corners-exclude = [
|
|
114
|
-
"class_g = 'tint2'",
|
|
115
|
-
"window_type = 'dock'",
|
|
116
|
-
"window_type = 'desktop'"
|
|
117
|
-
];
|
|
118
|
-
backend = "xrender";
|
|
119
|
-
shadow = false;
|
|
120
|
-
fading = false;
|
|
121
|
-
vsync = false;
|
|
122
|
-
inactive-opacity = 1.0;
|
|
123
|
-
active-opacity = 1.0;
|
|
124
|
-
`,_e="/tmp/ara-dock-browser.png",Oe=`[Desktop Entry]
|
|
125
|
-
Name=Chrome
|
|
126
|
-
Exec=chromium --no-sandbox %U
|
|
127
|
-
Icon=${_e}
|
|
128
|
-
Type=Application
|
|
129
|
-
Categories=Network;WebBrowser;
|
|
130
|
-
`,Be=`[Desktop Entry]
|
|
131
|
-
Name=Terminal
|
|
132
|
-
Exec=bash -c "DISPLAY=:99 xterm -fa DejaVuSansMono -fs 11 -bg black -fg white"
|
|
133
|
-
Icon=/tmp/ara-dock-terminal.png
|
|
134
|
-
Type=Application
|
|
135
|
-
Categories=System;TerminalEmulator;
|
|
136
|
-
`,se=`[Desktop Entry]
|
|
137
|
-
Name=Files
|
|
138
|
-
Exec=bash -c "DISPLAY=:99 pcmanfm --no-desktop"
|
|
139
|
-
Icon=/tmp/ara-dock-files.png
|
|
140
|
-
Type=Application
|
|
141
|
-
Categories=System;FileManager;
|
|
142
|
-
`;var ne={"wallpaper.jpg":W,"dock-browser.png":Y,"dock-terminal.png":Z,"dock-files.png":v,"grok-wallpaper.jpg":H,"grok-dock-browser.png":z,"grok-dock-terminal.png":ee,"grok-dock-files.png":V},Je=re,we='set_wallpaper() { if command -v feh >/dev/null 2>&1; then feh --bg-fill "$1"; else python3 "$2" "$1"; fi; }';function pe(e){let t=(y)=>y.replaceAll("DISPLAY=:99",`DISPLAY=${e.display}`).replaceAll("/tmp/ara-",`${e.root}/ara-`),p=e.look==="grok",n=new Set(e.absent??[]),s=p&&n.has("files")&&e.filesViewerExec?e.filesViewerExec:null;if(s)n.delete("files");let i=(p?Ae:Te).split(`
|
|
143
|
-
`).filter((y)=>!(n.has("terminal")&&y.endsWith("/ara-terminal.desktop"))&&!(n.has("files")&&y.endsWith("/ara-files.desktop"))).join(`
|
|
144
|
-
`),o=(y)=>p?y.replace("/tmp/ara-dock-","/tmp/ara-grok-dock-"):y,c=s?se.replace(/^Exec=.*$/m,`Exec=${s}`).replace("Categories=System;FileManager;","Categories=Utility;Viewer;"):se,l=p?"ara-grok-wallpaper.jpg":"ara-wallpaper.jpg",b={"openbox/rc.xml":Ne(e.screen),"tint2/tint2rc":t(i),"picom/picom.conf":Le,...n.has("terminal")?{}:{"ara-terminal.desktop":t(o(Be))},...n.has("files")?{}:{"ara-files.desktop":t(o(c))},"ara-chromium.desktop":t(o(Oe)).replace("chromium --no-sandbox %U",e.browserExec),"ara-set-root-wallpaper.py":Je},q=[...N.slice(0,3),we,`[ ! -f "$ROOT/${l}" ] || set_wallpaper "$ROOT/${l}" "$ROOT/ara-set-root-wallpaper.py" || true`,'if alive tint2 && ! cmp -s "$ROOT/tint2/tint2rc" "$ROOT/tint2/applied"; then read -r pid _ <"$ROOT/tint2.pid"; kill -USR1 "$pid" 2>/dev/null || true; fi','cp "$ROOT/tint2/tint2rc" "$ROOT/tint2/applied" 2>/dev/null || true',...N.slice(3)];return{files:b,start:q}}var N=['ticks() { line=$(cat "/proc/$1/stat" 2>/dev/null) || return 1; rest=${line##*) }; case $rest in Z*|X*) return 1;; esac; printf "%s" "$rest" | cut -d " " -f20; }','alive() { [ -f "$ROOT/$1.pid" ] || return 1; read -r pid start <"$ROOT/$1.pid"; current=$(ticks "$pid") || return 1; [ "$current" = "$start" ] && kill -0 "$pid" 2>/dev/null; }','launch() { name=$1; shift; "$@" 9>&- >"$ROOT/$name.log" 2>&1 & pid=$!; start=$(ticks "$pid"); printf "%s %s\\n" "$pid" "$start" >"$ROOT/$name.pid"; }','if [ -f "$ROOT/tint2/tint2rc" ] && ! alive tint2 && command -v tint2 >/dev/null 2>&1; then launch tint2 tint2 -c "$ROOT/tint2/tint2rc"; fi','if [ -f "$ROOT/picom/picom.conf" ] && ! alive picom && command -v picom >/dev/null 2>&1; then launch picom picom --config "$ROOT/picom/picom.conf"; fi'];var me=43200000,h=":99",Fe=60000,Q=15000,A={width:1280,height:800},Ge=/^[A-Za-z0-9._:-]{1,160}$/;function ke(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}var je=["video","viewer","viewer_same_network","viewer_network","look"];function Ue(e,t=Date.now()){let p=["relay_url","session_id","expires_at"];if(!ke(e)||p.some((l)=>!(l in e))||Object.keys(e).some((l)=>!p.includes(l)&&!je.includes(l)))throw new r("invalid_display_request","Reason desktop request is malformed.");let n="video"in e?Ro(e.video):void 0,s="viewer"in e?Mn(e.viewer):null,i="look"in e?$n(e.look):null;if(n===null)throw new r("invalid_display_request","Reason desktop video request is invalid.");let o=null;try{o=typeof e.relay_url==="string"?new URL(e.relay_url):null}catch{}if(!o||o.protocol!=="wss:"&&o.protocol!=="ws:"||o.username||o.password)throw new r("invalid_display_request","Reason desktop relay URL is invalid.");if(typeof e.session_id!=="string"||!Ge.test(e.session_id))throw new r("invalid_display_request","Reason desktop session identity is invalid.");let c=typeof e.expires_at==="string"?Date.parse(e.expires_at):Number.NaN;if(!Number.isFinite(c)||c<=t)throw new r("invalid_display_request","Reason desktop session has already expired.");return{relay_url:e.relay_url,session_id:e.session_id,expires_at:new Date(Math.min(c,t+me)).toISOString(),...n?{video:n}:{},...s?{viewer:s}:{},...n&&e.viewer_same_network===!0?{viewer_same_network:!0}:{},...i?{look:i}:{}}}function Ft(e=process.platform){return(e==="linux"||e==="darwin"||e==="win32")&&x()?.features.display===!0}async function Vs(){if(process.platform==="win32")return Ft()&&await Rr();if(process.platform!=="darwin")return Ft();return await Rr()}function G(e){Ke(e,{recursive:!0,mode:448});let t=Ce(e);if(!t.isDirectory()||t.isSymbolicLink()||process.getuid&&t.uid!==process.getuid())throw new r("display_unavailable","Reason desktop state directory is not private.");Me(e,448)}function We(e,t){let p=(s)=>{let i=Buffer.alloc(2);return i.writeUInt16BE(s.length),Buffer.concat([i,s])},n=Buffer.from([255,255]);return Buffer.concat([n,p(Buffer.alloc(0)),p(Buffer.from(e)),p(Buffer.from("MIT-MAGIC-COOKIE-1")),p(t)])}function d(e,t,p=2000){return new Promise((n)=>{let s=Ie(e),i="",o=(c)=>{s.destroy(),n(c)};s.setTimeout(p,()=>o(!1)),s.once("error",()=>o(!1)),s.once("close",()=>o(!1)),s.once("connect",()=>{if(!t)o(!0)}),s.on("data",(c)=>{if(i+=c.toString("latin1"),i.length>=4)o(i.startsWith("RFB "))})})}async function C(e,t){let p=Date.now()+t;while(Date.now()<p){if(await e())return!0;await new Promise((n)=>setTimeout(n,100))}return!1}function L(e,t,p){return new Promise((n)=>{let s=ae(e,t,{detached:!0,stdio:"ignore",env:p});s.once("error",()=>n(-1)),s.once("exit",(i)=>n(i)),s.unref(),setTimeout(()=>n(null),Q).unref()})}var M=null;function qe(e=a()){return M??=Ye(e).finally(()=>{M=null}),M}async function Ye(e){let t=x({home:e});if(!t?.xvfb||!t.x11vnc||!t.openbox)throw new r("display_unavailable","Run `reason desktop install` on this machine to enable its desktop.");Pt({root:t.root,automation:t.automation,extensionDir:t.extensionDir});let p=P(t.root,"display");G(p);let n=await Ze(e,p,t.x11vnc);if(n)return n;let s={display:h,xauthority:P(p,"Xauthority"),rfbSocket:P(p,"rfb.sock")},i=P(p,"pulse"),o=(async()=>{try{G(i)}catch{return null}return await go(i,t.pulseaudio)})();G(P(p,"home"));let c=K(p,s,t.pulseaudio),l=async()=>({...s,sound:await o});if(await d({path:s.rfbSocket},!0))return De(P(p,"theme"),N,c),await l();if(!ce(s.xauthority))T(s.xauthority,We(h.slice(1),ge(16)),{mode:384,flag:"wx"});let b=I(P(p,"theme"),s.display,A,e),q={path:`/tmp/.X11-unix/X${h.slice(1)}`};if(!await d(q,!1)){let y=`${A.width}x${A.height}`;if(t.xvnc)xe(s.rfbSocket,{force:!0}),L(t.xvnc,[s.display,"-geometry",y,"-depth","24","-nolisten","tcp","-auth",s.xauthority,"-rfbport","-1","-rfbunixpath",s.rfbSocket,"-SecurityTypes","None","-UseBlacklist=0","-AlwaysShared","-desktop","Reason"],c);else L(t.xvfb,[s.display,"-screen","0",`${y}x24`,"-nolisten","tcp","-auth",s.xauthority],c);if(!await C(()=>d(q,!1),Q)||t.xvnc&&!await C(()=>d({path:s.rfbSocket},!0),Q))throw new r("display_unavailable","Reason could not start the virtual display.");L(t.openbox,["--config-file",b.openboxConfig],c)}if(await m(b,c),!await le(t.x11vnc,s,p,"x11vnc.log",c))throw new r("display_unavailable","Reason could not start the desktop server.");return await l()}function K(e,t,p){let n={HOME:P(e,"home"),PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:t.display,XAUTHORITY:t.xauthority};if(p)n.PULSE_SERVER=Ve(Tn(P(e,"pulse")));return n}async function le(e,t,p,n,s){if(await d({path:t.rfbSocket},!0))return!0;xe(t.rfbSocket,{force:!0});let i=await L(e,["-display",t.display,"-auth",t.xauthority,"-rfbport","0","-rfbportv6","-1","-unixsock",t.rfbSocket,"-nopw","-forever","-shared","-noxdamage","-sb","0","-rfbversion","3.7","-quiet","-bg","-o",P(p,n)],s);if(i!==null&&i!==0)return!1;return await C(()=>d({path:t.rfbSocket},!0),Q)}async function ve(){let e=["DISPLAY","XAUTHORITY","WAYLAND_DISPLAY","XDG_SESSION_TYPE"],t=(p)=>Object.fromEntries(e.flatMap((n)=>p[n]?[[n,p[n]]]:[]));if(process.env.DISPLAY)return t(process.env);try{let p=await new Promise((n,s)=>oe("systemctl",["--user","show-environment"],{encoding:"utf8",timeout:2000},(i,o)=>i?s(i):n(o)));return t(Object.fromEntries(p.split(`
|
|
145
|
-
`).flatMap((n)=>{let s=n.indexOf("=");return s>0?[[n.slice(0,s),n.slice(s+1)]]:[]})))}catch{return{}}}var ie=new Set;async function Ze(e,t,p){let n=await ve(),s=/^:(\d+)(?:\.\d+)?$/.exec(n.DISPLAY??"")?.[1];if(!s||`:${s}`===h||n.WAYLAND_DISPLAY||n.XDG_SESSION_TYPE==="wayland")return null;let i={display:`:${s}`,xauthority:n.XAUTHORITY??P(e,".Xauthority"),rfbSocket:P(t,`rfb-${s}.sock`)},o=`${i.display} ${i.xauthority}`;if(ie.has(o)||!await d({path:`/tmp/.X11-unix/X${s}`},!1))return null;let c={HOME:e,PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:i.display,XAUTHORITY:i.xauthority};if(await le(p,i,t,`x11vnc-${s}.log`,c))return{...i,sound:null};return ie.add(o),process.stderr.write(`Reason worker: your screen ${i.display} could not be served; using the virtual desktop
|
|
146
|
-
`),null}var Pe="look";function ye(e){try{return $n(be(P(e,Pe),"utf8").trim())??"reason"}catch{return"reason"}}function I(e,t,p,n,s=ye(e)){let i=`chromium --no-first-run --no-default-browser-check${process.geteuid?.()===0?" --no-sandbox":""} %U`,o=[["terminal","xterm"],["files","pcmanfm"]].filter(([,b])=>!ce(`/usr/bin/${b}`)).map(([b])=>b),c=`${i.replace(/ %U$/,"")} --app=file://${P(n,".reason","workspace")}/`,l=pe({root:e,display:t,screen:p,browserExec:i,absent:o,look:s,filesViewerExec:c});for(let b of["","openbox","tint2","picom"])G(P(e,b));T(P(e,Pe),`${s}
|
|
147
|
-
`,{mode:384});for(let[b,q]of Object.entries(l.files))T(P(e,b),q,{mode:384});for(let[b,q]of Object.entries(ne))T(P(e,`ara-${b}`),be(q),{mode:384});return{root:e,openboxConfig:P(e,"openbox","rc.xml"),start:l.start}}function m(e,t){return De(e.root,[...e.start,"openbox --reconfigure >/dev/null 2>&1 || true"],t)}function De(e,t,p){let n=[`ROOT=${JSON.stringify(e)}`,...t].join(`
|
|
148
|
-
`);return new Promise((s)=>{let i=ae("/bin/sh",["-c",n],{stdio:"ignore",env:{...p,PATH:"/usr/bin:/bin"}}),o=setTimeout(()=>{i.kill(),s()},Q);i.once("error",()=>{clearTimeout(o),s()}),i.once("exit",()=>{clearTimeout(o),s()})})}var He=2073600,ze=320;function er(e,t){let p=Math.min(1,Math.sqrt(He/(e.width*e.height))),n=(s,i)=>Math.min(Math.floor(i/8)*8,Math.max(ze,Math.round(s*p/8)*8));return{width:n(e.width,t.width),height:n(e.height,t.height)}}function F(e,t,p){return new Promise((n)=>oe(e,t,{env:p,encoding:"utf8",timeout:5000},(s,i)=>n(s?null:i)))}function fe(e){let t=/current (\d+) x (\d+), maximum (\d+) x (\d+)/.exec(e),p=e.split(`
|
|
149
|
-
`),n=p.findIndex((i)=>/^\S+ connected/.test(i));if(!t||n<0)return null;let s=[];for(let i of p.slice(n+1)){let o=/^\s+(\d+x\d+)\s/.exec(i);if(!o)break;s.push(o[1])}return{current:{width:Number(t[1]),height:Number(t[2])},maximum:{width:Number(t[3]),height:Number(t[4])},output:p[n].split(" ")[0],modes:s}}async function rr(e,t,p){if(e.display!==h)return null;let n={PATH:"/usr/bin:/bin",DISPLAY:e.display,XAUTHORITY:e.xauthority},s=(l)=>F("xrandr",l,n),i=fe(await s(["--query"])??"");if(!i||i.maximum.width<=i.current.width&&i.maximum.height<=i.current.height)return null;let o=er(t,i.maximum);if(o.width===i.current.width&&o.height===i.current.height)return{size:o,changed:!1};let c=`${o.width}x${o.height}`;if(!i.modes.includes(c)){if(await s(["--newmode",c,"60",...[o.width,o.width,o.width,o.width,o.height,o.height,o.height,o.height].map(String)]),await s(["--addmode",i.output,c])===null)return null}return p(),await s(["--output",i.output,"--mode",c])===null?null:{size:o,changed:!0}}async function tr(e,t){let p=a(),n=x({home:p});if(!n)return;let s=P(n.root,"display"),i=K(s,e,n.pulseaudio);await m(I(P(s,"theme"),e.display,t,p),i);let o=t.width-u*2,c=t.height-u-R;await F("xdotool",["search","--onlyvisible","--class","Chromium","windowsize","%@",String(o),String(c),"windowmove","%@",String(u),String(u)],{...i,PATH:"/usr/bin:/bin"})}var _=Promise.resolve();function sr(e,t,p=()=>{}){let n=_.then(()=>rr(e,t,p));return _=n.then((s)=>s?.changed?tr(e,s.size):void 0).catch(()=>{}),n.then((s)=>s?.size??null,()=>null)}function nr(e,t){if(e.display!==h)return Promise.resolve();let p=_.then(async()=>{let n=a(),s=x({home:n});if(!s)return;let i=P(s.root,"display"),o=P(i,"theme");if(ye(o)===t)return;let c=K(i,e,s.pulseaudio),l=fe(await F("xrandr",["--query"],{PATH:"/usr/bin:/bin",DISPLAY:e.display,XAUTHORITY:e.xauthority})??"");await m(I(o,e.display,l?.current??A,n,t),c)});return _=p.catch(()=>{}),p.catch(()=>{})}async function jt(e,t={}){let p=t.now??Date.now,n=Ue(e.payload,p());if(e.signal.throwIfAborted(),!n.video)throw new r("display_video_required","Reason desktops stream as video now; this request came without it.");let s=t.platform??process.platform;if(s!=="linux"&&s!=="darwin"&&s!=="win32")throw new r("display_video_unsupported","This machine does not serve desktop video.");let{video:i,look:o}=n,c=(t.video?.desktop??(s==="darwin"?async()=>On:s==="win32"?async()=>In:async()=>{let l=await qe();if(o)await nr(l,o);return l}))();return await pr(e.signal,n,t,p,(l)=>Dn(l,{request:i,desktop:c,...n.viewer?{viewer:n.viewer}:{},viewerSameNetwork:n.viewer_same_network===!0},{resizeDesktop:sr,...t.video}),(l)=>Wt({type:"error",code:l}))}function pr(e,t,p,n,s,i){let o=n();return new Promise((c,l)=>{let b=null,q=!1,y=!1,k,O,S,B=!1,f=null,X=(D)=>{if(y)return;if(f)D=f.outcome;y=!0,clearTimeout(k),clearTimeout(O),e.removeEventListener("abort",w),S?.close();try{b?.close(1000,"display_session_over")}catch{}if("error"in D){l(D.error);return}c({reason:D.reason,...S?.summary(),duration_ms:Math.max(0,n()-o)})},J=()=>X({error:new r("display_relay_unavailable","Reason could not reach the desktop relay.")}),w=()=>{let D=e.reason;X({error:D instanceof r?D:new r("cancelled","Reason closed the desktop session.")})},U=()=>{if(!f||!b)return;let{outcome:D}=f,E=!("error"in D)?D.reason:D.error instanceof r?D.error.code:"display_unavailable";if(!f.told)try{b.send(i(E))}catch{}X(D)};if(S=s({get done(){return y||f!==null},get open(){return q&&!y&&f===null},get bufferedAmount(){return b?.bufferedAmount??0},send(D){if(y||f||!q||!b)return;try{b.send(D)}catch{X({reason:"relay_closed"})}},end:(D)=>{if(y||f)return;if(!("error"in D)&&B&&q){X(D);return}if(f={outcome:D,told:!("error"in D)&&q},B&&q)U()}}),y){S.close();return}if(e.aborted){w();return}e.addEventListener("abort",w,{once:!0}),k=setTimeout(()=>X({reason:"session_expired"}),Math.max(1,Date.parse(t.expires_at)-n())),O=setTimeout(()=>X({reason:"viewer_absent"}),p.viewerWaitMs??Fe);try{b=(p.connect??Nr)(t.relay_url,(p.loadProxy??j)()?.url)}catch{J();return}b.binaryType="arraybuffer",b.onopen=()=>{if(y||!b)return;q=!0,S?.opened()},b.onmessage=(D)=>{if(y)return;let E=D.data,g=E instanceof ArrayBuffer?new Uint8Array(E):ArrayBuffer.isView(E)?new Uint8Array(E.buffer,E.byteOffset,E.byteLength):null;if(!g||g.byteLength===0)return;if(clearTimeout(O),B=!0,f){U();return}S?.received(g)},b.onclose=()=>{if(y)return;if(!q){J();return}X({reason:"relay_closed"})},b.onerror=()=>{if(y||q)return;J()}})}
|
|
150
|
-
export{Ft,Vs,G,qe,jt};
|