@reason-machines/cli-linux-arm64-musl 0.2.358 → 0.2.359

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.
Files changed (96) hide show
  1. package/bin/ara +1 -1
  2. package/bin/vm-hands/api-credentials-axffq0pk.js +2 -0
  3. package/bin/vm-hands/api-texm6ayv.js +2 -0
  4. package/bin/vm-hands/ask-relay-fkb3bj30.js +8 -0
  5. package/bin/vm-hands/connect-cli-ev4xex04.js +2 -0
  6. package/bin/vm-hands/{custom-endpoint-device-j3e3zjd5.js → custom-endpoint-device-bsanzqj2.js} +1 -1
  7. package/bin/vm-hands/desktop-account-jxfva4m1.js +2 -0
  8. package/bin/vm-hands/{device-workspace-7yg5x68n.js → device-workspace-fhbpenda.js} +1 -1
  9. package/bin/vm-hands/hands-worker-source-ze6q6h8b.js +2 -0
  10. package/bin/vm-hands/{index-swa20ch8.js → index-tv4kcb2a.js} +1 -1
  11. package/bin/vm-hands/install-receipt-3s9amwp3.js +2 -0
  12. package/bin/vm-hands/local-automation-f8f33qpp.js +2 -0
  13. package/bin/vm-hands/local-capabilities-ya6yzxh5.js +2 -0
  14. package/bin/vm-hands/local-desktop-users-3th2aaac.js +2 -0
  15. package/bin/vm-hands/local-display-mac-neweyjpa.js +2 -0
  16. package/bin/vm-hands/local-display-session-v00nv1fm.js +2 -0
  17. package/bin/vm-hands/local-pty-session-2crsy5td.js +2 -0
  18. package/bin/vm-hands/managed-runtime-mg7kmckn.js +2 -0
  19. package/bin/vm-hands/{network-contract-rm9x646s.js → network-contract-gq8x3ehk.js} +1 -1
  20. package/bin/vm-hands/package-s3eg9zrd.js +2 -0
  21. package/bin/vm-hands/permissions-3kjdp3ge.js +2 -0
  22. package/bin/vm-hands/{reason-hands-protocol-3z7bas06.js → reason-hands-protocol-67d4b6fm.js} +1 -1
  23. package/bin/vm-hands/serve-service-nqshfese.js +2 -0
  24. package/bin/vm-hands/{status-psxtsknj.js → status-f146chye.js} +2 -2
  25. package/bin/vm-hands/version-ss25ccvh.js +2 -0
  26. package/bin/vm-hands/{vm-hands-entry-lite-he2z2137.js → vm-hands-entry-lite-07er2w8q.js} +2 -2
  27. package/bin/vm-hands/{vm-hands-entry-lite-5b29hq7h.js → vm-hands-entry-lite-1j9r1fca.js} +2 -2
  28. package/bin/vm-hands/vm-hands-entry-lite-22we2jrv.js +3 -0
  29. package/bin/vm-hands/{vm-hands-entry-lite-xhjbc3e4.js → vm-hands-entry-lite-3ew5ftk0.js} +2 -2
  30. package/bin/vm-hands/vm-hands-entry-lite-463aheya.js +3 -0
  31. package/bin/vm-hands/vm-hands-entry-lite-5kgvss4p.js +3 -0
  32. package/bin/vm-hands/vm-hands-entry-lite-5xtkyx25.js +3 -0
  33. package/bin/vm-hands/{vm-hands-entry-lite-jfwz0br7.js → vm-hands-entry-lite-9z6k7898.js} +2 -2
  34. package/bin/vm-hands/vm-hands-entry-lite-bybpy28m.js +5 -0
  35. package/bin/vm-hands/vm-hands-entry-lite-c0m2jewa.js +11 -0
  36. package/bin/vm-hands/{vm-hands-entry-lite-3zxjyj62.js → vm-hands-entry-lite-c7krpmd8.js} +3 -3
  37. package/bin/vm-hands/{vm-hands-entry-lite-dys7am1h.js → vm-hands-entry-lite-d2hbz0r4.js} +2 -2
  38. package/bin/vm-hands/{vm-hands-entry-lite-nvhzj5b0.js → vm-hands-entry-lite-f4gvypnx.js} +1 -1
  39. package/bin/vm-hands/{vm-hands-entry-lite-wpx6sg6d.js → vm-hands-entry-lite-gxjxx1r2.js} +2 -2
  40. package/bin/vm-hands/vm-hands-entry-lite-gzxxsjmr.js +62 -0
  41. package/bin/vm-hands/{vm-hands-entry-lite-nd1k2jz9.js → vm-hands-entry-lite-h2xemq1f.js} +1 -1
  42. package/bin/vm-hands/{vm-hands-entry-lite-c9wp99nr.js → vm-hands-entry-lite-ha1ej910.js} +2 -2
  43. package/bin/vm-hands/{vm-hands-entry-lite-nbtpm59m.js → vm-hands-entry-lite-j05685sg.js} +2 -2
  44. package/bin/vm-hands/{vm-hands-entry-lite-6f5eypjm.js → vm-hands-entry-lite-jn95s3j4.js} +2 -2
  45. package/bin/vm-hands/vm-hands-entry-lite-kt4831mq.js +340 -0
  46. package/bin/vm-hands/{vm-hands-entry-lite-k17ntg9v.js → vm-hands-entry-lite-kv0qat0x.js} +2 -2
  47. package/bin/vm-hands/vm-hands-entry-lite-kxdw4myj.js +3 -0
  48. package/bin/vm-hands/{vm-hands-entry-lite-0hv9ek0t.js → vm-hands-entry-lite-n867d88m.js} +9 -68
  49. package/bin/vm-hands/{vm-hands-entry-lite-c8hfat7y.js → vm-hands-entry-lite-p8662x7z.js} +2 -2
  50. package/bin/vm-hands/vm-hands-entry-lite-pf1gagky.js +37 -0
  51. package/bin/vm-hands/{vm-hands-entry-lite-rr0hhz7g.js → vm-hands-entry-lite-qbnz4h30.js} +3 -3
  52. package/bin/vm-hands/{vm-hands-entry-lite-8jmwhybq.js → vm-hands-entry-lite-qhgfnhjt.js} +2 -2
  53. package/bin/vm-hands/{vm-hands-entry-lite-trcg4jv7.js → vm-hands-entry-lite-qm18wqgz.js} +2 -2
  54. package/bin/vm-hands/{vm-hands-entry-lite-beannz0s.js → vm-hands-entry-lite-r5y08n0q.js} +2 -2
  55. package/bin/vm-hands/vm-hands-entry-lite-r6pap1kh.js +3 -0
  56. package/bin/vm-hands/vm-hands-entry-lite-s98hjhz3.js +5 -0
  57. package/bin/vm-hands/{vm-hands-entry-lite-zrvaqawr.js → vm-hands-entry-lite-sx2gpbap.js} +2 -2
  58. package/bin/vm-hands/{vm-hands-entry-lite-qf01e5f1.js → vm-hands-entry-lite-szfy3kx7.js} +2 -2
  59. package/bin/vm-hands/{vm-hands-entry-lite-95k4g3jj.js → vm-hands-entry-lite-taw01cp4.js} +1 -1
  60. package/bin/vm-hands/{vm-hands-entry-lite-0tdpjsxc.js → vm-hands-entry-lite-tg2bkah3.js} +2 -2
  61. package/bin/vm-hands/{vm-hands-entry-lite-mybm2kyz.js → vm-hands-entry-lite-v08mjs3f.js} +2 -2
  62. package/bin/vm-hands/{vm-hands-entry-lite-84d59wrf.js → vm-hands-entry-lite-w88zkzhr.js} +1 -1
  63. package/bin/vm-hands/vm-hands-entry-lite-wej1p1ry.js +3 -0
  64. package/bin/vm-hands/{vm-hands-entry-lite-gcn3rmz6.js → vm-hands-entry-lite-wry37am5.js} +1 -1
  65. package/bin/vm-hands/vm-hands-entry-lite-x4j4058x.js +9 -0
  66. package/bin/vm-hands/{vm-hands-entry-lite-tj1y61bg.js → vm-hands-entry-lite-ygx9kj92.js} +1 -1
  67. package/bin/vm-hands/vm-hands-entry-lite.js +1 -1
  68. package/bin/vm-hands/{vm-hands-executor-dqqdgtqq.js → vm-hands-executor-5nqmf61x.js} +1 -1
  69. package/bin/vm-hands/vm-hands-op-runner-zedtdcmk.js +2 -0
  70. package/bin/vm-hands/{vm-hands-runtime-y89fmev1.js → vm-hands-runtime-hnpk8xmf.js} +3 -3
  71. package/bin/vm-hands/worker-sandbox-vmp22sk6.js +2 -0
  72. package/package.json +1 -1
  73. package/bin/vm-hands/api-credentials-emdf5nm5.js +0 -2
  74. package/bin/vm-hands/api-js29ghm5.js +0 -2
  75. package/bin/vm-hands/ask-relay-qv9ddzr1.js +0 -8
  76. package/bin/vm-hands/connect-cli-8nxph9td.js +0 -2
  77. package/bin/vm-hands/desktop-account-gcysz0m3.js +0 -2
  78. package/bin/vm-hands/hands-worker-source-hbp5n31r.js +0 -2
  79. package/bin/vm-hands/local-automation-nw3bj9b5.js +0 -2
  80. package/bin/vm-hands/local-capabilities-7m54wthn.js +0 -2
  81. package/bin/vm-hands/local-desktop-users-pccz3sz9.js +0 -2
  82. package/bin/vm-hands/local-display-mac-gj72gkfb.js +0 -2
  83. package/bin/vm-hands/local-display-session-5ajajxtg.js +0 -2
  84. package/bin/vm-hands/local-pty-session-zen80k1k.js +0 -2
  85. package/bin/vm-hands/package-1e3w44ve.js +0 -2
  86. package/bin/vm-hands/permissions-0ej6xgrj.js +0 -2
  87. package/bin/vm-hands/version-fw3dwa12.js +0 -2
  88. package/bin/vm-hands/vm-hands-entry-lite-33ttamma.js +0 -5
  89. package/bin/vm-hands/vm-hands-entry-lite-3ms5bb0b.js +0 -43
  90. package/bin/vm-hands/vm-hands-entry-lite-6qfax5p2.js +0 -3
  91. package/bin/vm-hands/vm-hands-entry-lite-d9k3dzaq.js +0 -3
  92. package/bin/vm-hands/vm-hands-entry-lite-dyy62gt3.js +0 -3
  93. package/bin/vm-hands/vm-hands-entry-lite-pm0j47qj.js +0 -343
  94. package/bin/vm-hands/vm-hands-entry-lite-tdgbgcer.js +0 -3
  95. package/bin/vm-hands/vm-hands-op-runner-msdteb31.js +0 -2
  96. package/bin/vm-hands/worker-sandbox-yw24sxyp.js +0 -2
@@ -0,0 +1,62 @@
1
+ // @bun
2
+ import{ce as p,ee as V,he as f}from"./vm-hands-entry-lite-bybpy28m.js";import{Zh as E}from"./vm-hands-entry-lite-5kgvss4p.js";import{ni as y}from"./vm-hands-entry-lite-r6pap1kh.js";import{Ai as m,Oi as w,Qi as u}from"./vm-hands-entry-lite-x4j4058x.js";import{spawnSync as F}from"child_process";import{createHash as e,randomUUID as zz}from"crypto";import{chmodSync as Hz,existsSync as P,mkdirSync as Jz,readdirSync as Mz,readFileSync as L,renameSync as Qz,rmSync as T,statSync as Zz,writeFileSync as $z}from"fs";import{dirname as Bz,isAbsolute as v,join as A}from"path";var W="REASON_WORKER_SERVICE",jz="worker_identity_unavailable";function Iz(H){return{platform:process.platform,home:H,uid:process.getuid?.(),command:(z,M)=>F(z,[...M],{stdio:"ignore"}).status??1,read:(z,M)=>{let J=F(z,[...M],{stdio:["ignore","pipe","ignore"],encoding:"utf8",timeout:1e4});return J.status===0?J.stdout:null},sleep:(z)=>Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,z),workerIdentity:(z)=>u(H,z),insideService:(z)=>qz(z,process.platform,process.getuid?.())}}function qz(H,z,M){if(process.env[W]===H||process.env.XPC_SERVICE_NAME===H)return!0;if(z==="linux")try{return L("/proc/self/cgroup","utf8").includes(`/${H}.service`)}catch{return!0}if(z!=="darwin")return!1;if(typeof M!=="number")return!0;let J=F("/bin/launchctl",["print",`gui/${M}/${H}`],{encoding:"utf8",timeout:5000});if(J.status===Tz)return!1;if(J.error||J.status!==0)return!0;let Q=Number(/^\s*pid = (\d+)$/m.exec(J.stdout??"")?.[1]??0);if(!Q)return!1;let Z=process.pid;for(let B=0;B<64&&Z>1;B+=1){if(Z===Q)return!0;let $=F("/bin/ps",["-o","ppid=","-p",String(Z)],{encoding:"utf8",timeout:5000}),j=Number($.stdout?.trim());if($.error||$.status!==0||!Number.isSafeInteger(j)||j<=0)return!0;if(j===Z)return!1;Z=j}return Z>1}var Tz=113;class q extends Error{code;constructor(H,z){super(H);this.code=z}}function bz(H,z){if(H.platform!=="darwin"&&H.platform!=="linux")throw new q("A background service needs macOS (launchd) or Linux (systemd --user).");if(H.platform==="darwin")U(H);let J=[f(p(z,H.home))?.owned_paths.find((Q)=>Q.role==="launcher")?.path,y(z,"REASON_CLI_LAUNCHER_PATH")?.trim(),A(H.home,".local","bin",E({env:z})==="staging"?"ara-staging":"ara")];for(let Q of J)try{if(Q&&v(Q)&&Zz(Q).isFile())return V(Q)}catch{}throw new q("A background service runs the installed Reason launcher, which was not found. Install Reason with: curl -fsSL https://reasonmachines.com/install | sh","worker_launcher_missing")}var I=/(<key>ProgramArguments<\/key>\s*<array>\n)((?:\s*<string>[^<]*<\/string>\n)*)(\s*<\/array>)/,X=new RegExp(`(\\n\\s*<key>${w}</key>\\s*<string>)[^<]*(</string>)`),Gz=/(<key>EnvironmentVariables<\/key>\s*<dict>[\s\S]*?)(\n\s*<\/dict>)/;function Yz(H){return H.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&quot;",'"').replaceAll("&apos;","'").replaceAll("&amp;","&")}function b(H){let z=[...(I.exec(H)?.[2]??"").matchAll(/<string>([^<]*)<\/string>/g)].map((J)=>Yz(J[1])),M=z[1]==="--run-worker"?z.slice(2):z;return M[0]?{launcher:M[0],args:M.slice(1)}:null}function Sz(H,z){if(!Az(z))return null;try{return b(L(A(H,"Library","LaunchAgents",`${z}.plist`),"utf8"))?.launcher??null}catch{return null}}function d(H,z,M){let J=M.workerIdentity?.(H)??null;return{program:J?[J.executable,"--run-worker",H,...z]:[H,...z],identity:J}}function S(H){return H.map((z)=>` <string>${G(z)}</string>`).join(`
3
+ `)}function g(H,z){let M;try{M=L(H,"utf8")}catch{return null}let J=b(M);if(!J)return null;let Q=v(J.launcher)?V(J.launcher):J.launcher,{program:Z,identity:B}=d(Q,J.args,z),$=M.replace(I,(j,Y,N,R)=>`${Y}${S(Z)}
4
+ ${R}`);if(!B)$=$.replace(X,"");else if(X.test($))$=$.replace(X,(j,Y,N)=>`${Y}${G(B.app)}${N}`);else $=$.replace(Gz,(j,Y,N)=>`${Y}
5
+ <key>${w}</key>
6
+ <string>${G(B.app)}</string>${N}`);return $===M?null:$}function Nz(H,z){let M=g(H,z);if(M!==null)C(H,M)}function _z(H,z,M){if(z.platform!=="darwin")return!1;let J=x(H,z,M);return J!==null&&g(J.definition,z)!==null}var K="com.reasonmachines.worker.",_="so.reason.worker.",O=[K,_];function Az(H){return O.some((z)=>H.startsWith(z)&&/^[A-Za-z0-9._-]+$/.test(H.slice(z.length)))}function l(H,z=K){return`${z}connect${H==="production"?"":`.${H}`}`}function xz(H,z){return O.some((M)=>H===l(z,M))}function Dz(H,z,M){if(z==="connect")return l(H.channel,M);let J=e("sha256").update(H.workspaceRoot).digest("hex").slice(0,8);return`${M}${H.name.toLowerCase()}.${J}`}function a(H,z){if(z==="darwin")return{directory:A(H,"Library","LaunchAgents"),suffix:".plist"};if(z==="linux")return{directory:A(H,".config","systemd","user"),suffix:".service"};return null}function D(H,z,M,J=K){let Q=Dz(H,M,J),Z=a(z.home,z.platform);if(!Z)return null;return{label:Q,definition:A(Z.directory,`${Q}${Z.suffix}`),logs:z.platform==="darwin"?A(H.stateDirectory,"service.log"):`journalctl --user -u ${Q}.service`}}function Rz(H,z){let M=a(H,z);if(!M)return[];try{return Mz(M.directory).filter((J)=>O.some((Q)=>J.startsWith(Q))&&J.endsWith(M.suffix)).sort().map((J)=>A(M.directory,J))}catch{return[]}}function x(H,z,M="serve"){return h(H,z,M)[0]??null}function h(H,z,M){return O.map((J)=>D(H,z,M,J)).filter((J)=>J!==null&&P(J.definition))}function c(H,z,M){let J=D(H,z,M,_);return J&&P(J.definition)?J:null}function Lz(H,z,M){let J=D(H,z,M),Q=c(H,z,M);if(!J||!Q||!P(J.definition)||z.insideService?.(Q.label))return null;if(!Uz(J,z))return"current_not_running";if(z.platform==="darwin"){if(typeof z.uid==="number"&&z.uid>0)z.command("/bin/launchctl",["bootout",`gui/${z.uid}/${Q.label}`]);return T(Q.definition,{force:!0}),"retired"}return z.command("systemctl",["--user","disable","--now",`${Q.label}.service`]),T(Q.definition,{force:!0}),z.command("systemctl",["--user","daemon-reload"]),"retired"}function Uz(H,z){if(z.platform==="darwin")return typeof z.uid==="number"&&z.uid>0&&z.command("/bin/launchctl",["print",`gui/${z.uid}/${H.label}`])===0;let M=`${H.label}.service`;return z.command("systemctl",["--user","is-enabled","--quiet",M])===0&&Xz.has(z.read("systemctl",["--user","show","--property=ActiveState","--value",M])?.trim()??"")}var Xz=new Set(["active","activating","reloading"]);function kz(H,z){if(z.platform==="darwin"){if(typeof z.uid!=="number"||z.uid<=0)return!1;let M=z.read("/bin/launchctl",["print",`gui/${z.uid}/${H.label}`]);return Number(/^\s*pid = (\d+)$/m.exec(M??"")?.[1]??0)>0}return Number(z.read("systemctl",["--user","show","--property=MainPID","--value",`${H.label}.service`])?.trim()??0)>0}function yz(H){let{config:z,launcher:M,host:J,kind:Q}=H,Z=D(z,J,Q);if(!Z)return!1;let B;try{B=L(Z.definition,"utf8")}catch{return!1}if(J.platform!=="darwin")return B===s(z,Q,Z,M,J.home,H.path);let $=b(B);return B.replace(X,"").replace(I,(Y,N,R,o)=>`${N}${$?`${S([$.launcher,...$.args])}
7
+ `:""}${o}`)===r(z,Q,Z,M,{...J,workerIdentity:()=>null},H.path).plist}function n(H,z){if(z==="connect")return{args:["connect"],environment:{REASON_CLI_CHANNEL:H.channel},description:"Reason connection of this computer"};return{args:["serve",H.name,"--dir",H.workspaceRoot,...H.executionMode==="confined"?["--sandbox"]:[]],environment:{},description:`Reason machine ${H.name} worker`}}function G(H){return H.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function k(H,z=!1){if(/[\0-\x1f\x7f]/.test(H))throw new q("A background service cannot use a path with control characters.");let M=H.replaceAll("\\","\\\\").replaceAll('"',"\\\"").replaceAll("%","%%");return`"${z?M.replaceAll("$","$$$$"):M}"`}function r(H,z,M,J,Q,Z){let B=n(H,z),$=d(J,B.args,Q),j={HOME:Q.home,PATH:Z,[W]:M.label,...B.environment,...$.identity?{[w]:$.identity.app}:{}};return{identity:$.identity,plist:`<?xml version="1.0" encoding="UTF-8"?>
8
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
9
+ <plist version="1.0">
10
+ <dict>
11
+ <key>Label</key>
12
+ <string>${G(M.label)}</string>
13
+ <key>AssociatedBundleIdentifiers</key>
14
+ <array>
15
+ <string>${m}</string>
16
+ </array>
17
+ <key>ProgramArguments</key>
18
+ <array>
19
+ ${S($.program)}
20
+ </array>
21
+ <key>EnvironmentVariables</key>
22
+ <dict>
23
+ ${Object.entries(j).map(([Y,N])=>` <key>${Y}</key>
24
+ <string>${G(N)}</string>`).join(`
25
+ `)}
26
+ </dict>
27
+ <key>RunAtLoad</key>
28
+ <true/>
29
+ <key>KeepAlive</key>
30
+ <dict>
31
+ <key>SuccessfulExit</key>
32
+ <false/>
33
+ </dict>
34
+ <key>ThrottleInterval</key>
35
+ <integer>10</integer>
36
+ <key>ExitTimeOut</key>
37
+ <integer>${Math.ceil(H.shutdownGraceMs/1000)+10}</integer>
38
+ <key>ProcessType</key>
39
+ <string>Standard</string>
40
+ <key>Umask</key>
41
+ <integer>63</integer>
42
+ <key>StandardOutPath</key>
43
+ <string>${G(M.logs)}</string>
44
+ <key>StandardErrorPath</key>
45
+ <string>${G(M.logs)}</string>
46
+ </dict>
47
+ </plist>
48
+ `}}function s(H,z,M,J,Q,Z){let B=n(H,z);return`[Unit]
49
+ Description=${B.description}
50
+
51
+ [Service]
52
+ ExecStart=${[J,...B.args].map(($)=>k($,!0)).join(" ")}
53
+ Environment=${[`HOME=${Q}`,`PATH=${Z}`,`${W}=${M.label}`,...Object.entries(B.environment).map(([$,j])=>`${$}=${j}`)].map(($)=>k($)).join(" ")}
54
+ Restart=on-failure
55
+ RestartSec=10
56
+ TimeoutStopSec=${Math.ceil(H.shutdownGraceMs/1000)+10}
57
+ UMask=0077
58
+
59
+ [Install]
60
+ WantedBy=default.target
61
+ `}function C(H,z){Jz(Bz(H),{recursive:!0,mode:448});let M=`${H}.${zz()}.tmp`;try{$z(M,z,{mode:384,flag:"wx"}),Hz(M,384),Qz(M,H)}finally{T(M,{force:!0})}}function U(H){if(typeof H.uid!=="number"||!Number.isSafeInteger(H.uid)||H.uid<=0)throw new q("Set up a background service as your own user, not with sudo.","worker_service_root_user");return`gui/${H.uid}`}function Ez(H){let{config:z,launcher:M,host:J}=H,Q=H.kind??"serve",Z=c(z,J,Q),B=Z!==null&&J.insideService?.(Z.label)===!0,$=D(z,J,Q,B?_:K);if(!$)throw new q("A background service needs macOS (launchd) or Linux (systemd --user).");if(J.platform==="darwin")U(J);if(J.platform==="linux"&&J.command("systemctl",["--user","show-environment"])!==0)throw new q("No background service here: this computer has no systemd user session.","worker_service_manager_missing");let j=J.platform==="darwin"?r(z,Q,$,M,J,H.path):null;if(C($.definition,j?j.plist:s(z,Q,$,M,J.home,H.path)),i(z,J,$,B?null:Z),j)return j.identity?$:{...$,identityProblem:jz};return{...$,lingering:J.command("loginctl",["enable-linger"])===0}}function i(H,z,M,J){if(z.platform==="darwin"){let B=U(z);if(J)z.command("/bin/launchctl",["bootout",`${B}/${J.label}`]);if(t(H,M,z)){if(J)T(J.definition,{force:!0});return}if(T(M.definition,{force:!0}),J)z.command("/bin/launchctl",["bootstrap",B,J.definition]);throw new q("Could not start the background service (launchctl bootstrap failed).","worker_service_start_failed")}let Q=`${M.label}.service`,Z=J?`${J.label}.service`:null;if(z.command("systemctl",["--user","daemon-reload"])!==0||Z!==null&&z.command("systemctl",["--user","disable","--now",Z])!==0||z.command("systemctl",["--user","enable",Q])!==0||z.command("systemctl",["--user","restart",Q])!==0){if(z.command("systemctl",["--user","disable",Q]),T(M.definition,{force:!0}),z.command("systemctl",["--user","daemon-reload"]),Z)z.command("systemctl",["--user","enable","--now",Z]);throw new q("Could not start the background service (systemctl --user failed).","worker_service_start_failed")}if(J)T(J.definition,{force:!0}),z.command("systemctl",["--user","daemon-reload"])}function t(H,z,M){let J=U(M);M.command("/bin/launchctl",["bootout",`${J}/${z.label}`]);let Q=(Math.ceil(H.shutdownGraceMs/1000)+10)*1000;for(let Z=0,B=100;;B=Math.min(B*2,2000)){if(M.command("/bin/launchctl",["bootstrap",J,z.definition])===0)return!0;if(Z>=Q)return!1;M.sleep(B),Z+=B}}function mz(H,z,M){let J=x(H,z,M);if(!J)return null;let Q=z.insideService?.(J.label)===!0;if(z.platform==="darwin"&&!Q)Nz(J.definition,z);let Z=D(H,z,M);if(Z&&J.label!==Z.label&&!Q)return C(Z.definition,L(J.definition,"utf8").replaceAll(J.label,Z.label)),i(H,z,Z,J),Z;let B=z.platform==="darwin"&&Q,$;if(B)$=z.command("/bin/launchctl",["kickstart","-k",`${U(z)}/${J.label}`])===0;else if(z.platform==="darwin")$=t(H,J,z);else z.command("systemctl",["--user","enable",`${J.label}.service`]),$=z.command("systemctl",["--user","restart",`${J.label}.service`])===0;if(!$)throw new q(`Could not restart the background service ${J.label}.`,"worker_service_restart_failed");if(Z&&J.label===Z.label)Lz(H,z,M);return J}function uz(H,z,M,J){let Q=x(H,M,J),Z=D(z,M,J);if(M.platform!=="darwin"||!Q||!Z)return;let B=`<string>${G(Q.logs)}</string>`,$=L(Q.definition,"utf8");if($.includes(B))C(Q.definition,$.replaceAll(B,`<string>${G(Z.logs)}</string>`))}function pz(H,z,M="serve"){let J=h(H,z,M);for(let Q of J){if(z.platform==="darwin"){if(typeof z.uid==="number"&&z.uid>0)z.command("/bin/launchctl",["bootout",`gui/${z.uid}/${Q.label}`]);T(Q.definition,{force:!0});continue}z.command("systemctl",["--user","disable","--now",`${Q.label}.service`]),T(Q.definition,{force:!0}),z.command("systemctl",["--user","daemon-reload"])}return J[0]??null}
62
+ export{W as Fd,jz as Gd,Iz as Hd,q as Id,bz as Jd,Sz as Kd,_z as Ld,l as Md,xz as Nd,Rz as Od,x as Pd,Lz as Qd,kz as Rd,yz as Sd,Ez as Td,mz as Ud,uz as Vd,pz as Wd};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  var n=Object.create;var{getPrototypeOf:o,defineProperty:e,getOwnPropertyNames:k,getOwnPropertyDescriptor:p}=Object,l=Object.prototype.hasOwnProperty;function m(a){return this[a]}var q,r,u=(a,b,c)=>{var d=a!=null&&typeof a==="object";if(d){var h=b?q??=new WeakMap:r??=new WeakMap,i=h.get(a);if(i)return i}c=a!=null?n(o(a)):{};let f=b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:!0}):c;for(let g of k(a))if(!l.call(f,g))e(f,g,{get:m.bind(a,g),enumerable:!0});if(d)h.set(a,f);return f},v=(a)=>{var b=(j??=new WeakMap).get(a),c;if(b)return b;if(b=e({},"__esModule",{value:!0}),a&&typeof a==="object"||typeof a==="function"){for(var d of k(a))if(!l.call(b,d))e(b,d,{get:m.bind(a,d),enumerable:!(c=p(a,d))||c.enumerable})}return j.set(a,b),b},j,w=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var s=(a)=>a;function t(a,b){this[a]=s.bind(null,b)}var x=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0,configurable:!0,set:t.bind(b,c)})};var y=(a,b)=>()=>(a&&(b=a(a=0)),b);var z=import.meta.require;
3
- export{u as ri,v as si,w as ti,x as ui,y as vi,z as wi};
3
+ export{u as Xj,v as Yj,w as Zj,x as _j,y as $j,z as ak};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{qi as l}from"./vm-hands-entry-lite-tj1y61bg.js";import{execFile as zj,spawn as I}from"child_process";var Cj="h264_ws_v1",kj="video",h=["smooth","sharp","data_saver","balanced"];var Yj="video_presets";var V=8388608,Y=65536,Lj="control",Aj="v1",d=200;function s(q){if(!q||typeof q!=="object"||Array.isArray(q))return null;let j=q,J=(Q)=>typeof Q==="string"&&Q.length>0&&Q.length<=d;if(Object.keys(j).length!==2||!J(j.user_id)||!J(j.name))return null;return{user_id:j.user_id,name:j.name}}var xj="windows",Mj="v1",A=200,o=(q)=>typeof q==="string"&&h.includes(q);function fj(q){if(!q||typeof q!=="object"||Array.isArray(q))return null;let j=q;if(Object.keys(j).length!==2||j.format!=="h264_ws_v1"||!o(j.preset))return null;return{format:"h264_ws_v1",preset:j.preset}}var $={hello:1,frame:2,stats:3,pong:4,serverClipboard:5,error:6,audioHello:7,audio:8,control:9,windows:10,pointer:16,key:17,config:18,ping:19,clientClipboard:20,keyframeRequest:21,ack:22,audioEnable:23};class U extends Error{constructor(q){super(q);this.name="DisplayVideoProtocolError"}}var e=new TextEncoder,jj=new TextDecoder("utf-8",{fatal:!0});function H(q,j){if(j.byteLength+1>V)throw new U("message_too_large");let J=new Uint8Array(5+j.byteLength),Q=new DataView(J.buffer);return Q.setUint32(0,j.byteLength+1),Q.setUint8(4,q),J.set(j,5),J}function R(q){let j=e.encode(q);if(j.byteLength>Y)throw new U("text_too_large");return j}function f(q,j){if(!Number.isInteger(q)||q<0||q>65535)throw new U(`invalid_${j}`);return q}function qj(q){if(!Number.isFinite(q))throw new U("invalid_window");return Math.max(-2147483648,Math.min(2147483647,Math.round(q)))}function hj(q){switch(q.type){case"hello":{let j=R(q.codec),J=new Uint8Array(6+j.byteLength),Q=new DataView(J.buffer);return Q.setUint16(0,f(q.width,"width")),Q.setUint16(2,f(q.height,"height")),Q.setUint8(4,Math.max(1,Math.min(240,Math.round(q.fps)))),Q.setUint8(5,h.indexOf(q.preset)),J.set(j,6),H($.hello,J)}case"frame":{let j=new Uint8Array(13+q.data.byteLength),J=new DataView(j.buffer);return J.setUint8(0,q.key?1:0),J.setUint32(1,q.seq>>>0),J.setBigUint64(5,BigInt(Math.max(0,Math.floor(q.captureMicros)))),j.set(q.data,13),H($.frame,j)}case"stats":return H($.stats,R(JSON.stringify(q.stats)));case"pong":case"ping":{let j=new Uint8Array(8);return new DataView(j.buffer).setFloat64(0,q.token),H(q.type==="ping"?$.ping:$.pong,j)}case"serverClipboard":return H($.serverClipboard,R(q.text));case"clientClipboard":return H($.clientClipboard,R(q.text));case"error":return H($.error,R(q.code));case"pointer":{let j=new Uint8Array(5),J=new DataView(j.buffer);return J.setUint16(0,f(q.x,"x")),J.setUint16(2,f(q.y,"y")),J.setUint8(4,q.buttons&255),H($.pointer,j)}case"key":{let j=new Uint8Array(5),J=new DataView(j.buffer);return J.setUint8(0,q.down?1:0),J.setUint32(1,q.keysym>>>0),H($.key,j)}case"config":return H($.config,Uint8Array.of(h.indexOf(q.preset)));case"keyframeRequest":return H($.keyframeRequest,new Uint8Array(0));case"audioHello":{let j=R(q.codec),J=new Uint8Array(5+j.byteLength),Q=new DataView(J.buffer);return Q.setUint32(0,q.sampleRate>>>0),Q.setUint8(4,q.channels&255),J.set(j,5),H($.audioHello,J)}case"audio":{let j=new Uint8Array(8+q.data.byteLength);return new DataView(j.buffer).setBigUint64(0,BigInt(Math.max(0,Math.floor(q.captureMicros)))),j.set(q.data,8),H($.audio,j)}case"control":return H($.control,R(JSON.stringify(q.control)));case"windows":{let j=q.bounds.slice(0,A),J=new Uint8Array(j.length*16),Q=new DataView(J.buffer);return j.forEach((Z,z)=>{[Z.x,Z.y,Z.width,Z.height].forEach((G,F)=>Q.setInt32(z*16+F*4,qj(G)))}),H($.windows,J)}case"audioEnable":return H($.audioEnable,Uint8Array.of(q.on?1:0));case"ack":{let j=new Uint8Array(4);return new DataView(j.buffer).setUint32(0,q.seq>>>0),H($.ack,j)}}}function T(q){let j=h[q];if(!j)throw new U("invalid_preset");return j}function C(q,j){if(q.byteLength!==j)throw new U("invalid_length")}function k(q){if(q.byteLength>Y)throw new U("text_too_large");try{return jj.decode(q)}catch{throw new U("invalid_text")}}function Jj(q){let j;try{j=JSON.parse(k(q))}catch{throw new U("invalid_stats")}let J=j;if(!J||typeof J!=="object"||["fps","kbps","dropped","restarts","queued_bytes"].some((Z)=>typeof J[Z]!=="number"||!Number.isFinite(J[Z])))throw new U("invalid_stats");return{fps:J.fps,kbps:J.kbps,dropped:J.dropped,restarts:J.restarts,queued_bytes:J.queued_bytes}}function Qj(q){let j;try{j=JSON.parse(k(q))}catch{throw new U("invalid_control")}let J=j;if(!J||typeof J!=="object"||typeof J.you!=="boolean"||typeof J.same_user!=="boolean")throw new U("invalid_control");let Q=J.holder===null?null:s(J.holder);if(Q===null&&J.holder!==null)throw new U("invalid_control");return{holder:Q,you:J.you,same_user:J.same_user}}function Zj(q,j){let J=new DataView(j.buffer,j.byteOffset,j.byteLength);switch(q){case $.hello:if(j.byteLength<6)throw new U("invalid_length");return{type:"hello",width:J.getUint16(0),height:J.getUint16(2),fps:J.getUint8(4),preset:T(J.getUint8(5)),codec:k(j.subarray(6))};case $.frame:if(j.byteLength<14)throw new U("invalid_length");if(J.getUint8(0)>1)throw new U("invalid_frame_flags");return{type:"frame",key:J.getUint8(0)===1,seq:J.getUint32(1),captureMicros:Number(J.getBigUint64(5)),data:j.subarray(13)};case $.stats:return{type:"stats",stats:Jj(j)};case $.ping:case $.pong:return C(j,8),{type:q===$.ping?"ping":"pong",token:J.getFloat64(0)};case $.serverClipboard:return{type:"serverClipboard",text:k(j)};case $.clientClipboard:return{type:"clientClipboard",text:k(j)};case $.error:return{type:"error",code:k(j)};case $.pointer:return C(j,5),{type:"pointer",x:J.getUint16(0),y:J.getUint16(2),buttons:J.getUint8(4)};case $.key:if(C(j,5),J.getUint8(0)>1)throw new U("invalid_key_flags");return{type:"key",down:J.getUint8(0)===1,keysym:J.getUint32(1)};case $.config:return C(j,1),{type:"config",preset:T(J.getUint8(0))};case $.keyframeRequest:return C(j,0),{type:"keyframeRequest"};case $.audioHello:if(j.byteLength<5)throw new U("invalid_length");return{type:"audioHello",sampleRate:J.getUint32(0),channels:J.getUint8(4),codec:k(j.subarray(5))};case $.audio:if(j.byteLength<9)throw new U("invalid_length");return{type:"audio",captureMicros:Number(J.getBigUint64(0)),data:j.subarray(8)};case $.audioEnable:if(C(j,1),J.getUint8(0)>1)throw new U("invalid_audio_flags");return{type:"audioEnable",on:J.getUint8(0)===1};case $.control:return{type:"control",control:Qj(j)};case $.windows:{if(j.byteLength%16!==0||j.byteLength>A*16)throw new U("invalid_length");let Q=[];for(let Z=0;Z<j.byteLength;Z+=16)Q.push({x:J.getInt32(Z),y:J.getInt32(Z+4),width:J.getInt32(Z+8),height:J.getInt32(Z+12)});return{type:"windows",bounds:Q}}case $.ack:return C(j,4),{type:"ack",seq:J.getUint32(0)};default:return null}}class $j{buffer=new Uint8Array(0);push(q){let j=new Uint8Array(this.buffer.byteLength+q.byteLength);j.set(this.buffer),j.set(q,this.buffer.byteLength);let J=[],Q=0;while(j.byteLength-Q>=4){let Z=new DataView(j.buffer,j.byteOffset+Q,4).getUint32(0);if(Z<1||Z>V)throw new U("invalid_message_length");if(j.byteLength-Q-4<Z)break;let z=j[Q+4],G=j.slice(Q+5,Q+4+Z),F=Zj(z,G);if(F)J.push(F);Q+=4+Z}return this.buffer=j.slice(Q),J}}var t="/usr/bin/osascript",Gj=5000,Kj=1048576,Uj=String.raw`
2
+ import{Wj as l}from"./vm-hands-entry-lite-ygx9kj92.js";import{execFile as zj,spawn as I}from"child_process";var Cj="h264_ws_v1",kj="video",h=["smooth","sharp","data_saver","balanced"];var Yj="video_presets";var V=8388608,Y=65536,Lj="control",Aj="v1",d=200;function s(q){if(!q||typeof q!=="object"||Array.isArray(q))return null;let j=q,J=(Q)=>typeof Q==="string"&&Q.length>0&&Q.length<=d;if(Object.keys(j).length!==2||!J(j.user_id)||!J(j.name))return null;return{user_id:j.user_id,name:j.name}}var xj="windows",Mj="v1",A=200,o=(q)=>typeof q==="string"&&h.includes(q);function fj(q){if(!q||typeof q!=="object"||Array.isArray(q))return null;let j=q;if(Object.keys(j).length!==2||j.format!=="h264_ws_v1"||!o(j.preset))return null;return{format:"h264_ws_v1",preset:j.preset}}var $={hello:1,frame:2,stats:3,pong:4,serverClipboard:5,error:6,audioHello:7,audio:8,control:9,windows:10,pointer:16,key:17,config:18,ping:19,clientClipboard:20,keyframeRequest:21,ack:22,audioEnable:23};class U extends Error{constructor(q){super(q);this.name="DisplayVideoProtocolError"}}var e=new TextEncoder,jj=new TextDecoder("utf-8",{fatal:!0});function H(q,j){if(j.byteLength+1>V)throw new U("message_too_large");let J=new Uint8Array(5+j.byteLength),Q=new DataView(J.buffer);return Q.setUint32(0,j.byteLength+1),Q.setUint8(4,q),J.set(j,5),J}function R(q){let j=e.encode(q);if(j.byteLength>Y)throw new U("text_too_large");return j}function f(q,j){if(!Number.isInteger(q)||q<0||q>65535)throw new U(`invalid_${j}`);return q}function qj(q){if(!Number.isFinite(q))throw new U("invalid_window");return Math.max(-2147483648,Math.min(2147483647,Math.round(q)))}function hj(q){switch(q.type){case"hello":{let j=R(q.codec),J=new Uint8Array(6+j.byteLength),Q=new DataView(J.buffer);return Q.setUint16(0,f(q.width,"width")),Q.setUint16(2,f(q.height,"height")),Q.setUint8(4,Math.max(1,Math.min(240,Math.round(q.fps)))),Q.setUint8(5,h.indexOf(q.preset)),J.set(j,6),H($.hello,J)}case"frame":{let j=new Uint8Array(13+q.data.byteLength),J=new DataView(j.buffer);return J.setUint8(0,q.key?1:0),J.setUint32(1,q.seq>>>0),J.setBigUint64(5,BigInt(Math.max(0,Math.floor(q.captureMicros)))),j.set(q.data,13),H($.frame,j)}case"stats":return H($.stats,R(JSON.stringify(q.stats)));case"pong":case"ping":{let j=new Uint8Array(8);return new DataView(j.buffer).setFloat64(0,q.token),H(q.type==="ping"?$.ping:$.pong,j)}case"serverClipboard":return H($.serverClipboard,R(q.text));case"clientClipboard":return H($.clientClipboard,R(q.text));case"error":return H($.error,R(q.code));case"pointer":{let j=new Uint8Array(5),J=new DataView(j.buffer);return J.setUint16(0,f(q.x,"x")),J.setUint16(2,f(q.y,"y")),J.setUint8(4,q.buttons&255),H($.pointer,j)}case"key":{let j=new Uint8Array(5),J=new DataView(j.buffer);return J.setUint8(0,q.down?1:0),J.setUint32(1,q.keysym>>>0),H($.key,j)}case"config":return H($.config,Uint8Array.of(h.indexOf(q.preset)));case"keyframeRequest":return H($.keyframeRequest,new Uint8Array(0));case"audioHello":{let j=R(q.codec),J=new Uint8Array(5+j.byteLength),Q=new DataView(J.buffer);return Q.setUint32(0,q.sampleRate>>>0),Q.setUint8(4,q.channels&255),J.set(j,5),H($.audioHello,J)}case"audio":{let j=new Uint8Array(8+q.data.byteLength);return new DataView(j.buffer).setBigUint64(0,BigInt(Math.max(0,Math.floor(q.captureMicros)))),j.set(q.data,8),H($.audio,j)}case"control":return H($.control,R(JSON.stringify(q.control)));case"windows":{let j=q.bounds.slice(0,A),J=new Uint8Array(j.length*16),Q=new DataView(J.buffer);return j.forEach((Z,z)=>{[Z.x,Z.y,Z.width,Z.height].forEach((G,F)=>Q.setInt32(z*16+F*4,qj(G)))}),H($.windows,J)}case"audioEnable":return H($.audioEnable,Uint8Array.of(q.on?1:0));case"ack":{let j=new Uint8Array(4);return new DataView(j.buffer).setUint32(0,q.seq>>>0),H($.ack,j)}}}function T(q){let j=h[q];if(!j)throw new U("invalid_preset");return j}function C(q,j){if(q.byteLength!==j)throw new U("invalid_length")}function k(q){if(q.byteLength>Y)throw new U("text_too_large");try{return jj.decode(q)}catch{throw new U("invalid_text")}}function Jj(q){let j;try{j=JSON.parse(k(q))}catch{throw new U("invalid_stats")}let J=j;if(!J||typeof J!=="object"||["fps","kbps","dropped","restarts","queued_bytes"].some((Z)=>typeof J[Z]!=="number"||!Number.isFinite(J[Z])))throw new U("invalid_stats");return{fps:J.fps,kbps:J.kbps,dropped:J.dropped,restarts:J.restarts,queued_bytes:J.queued_bytes}}function Qj(q){let j;try{j=JSON.parse(k(q))}catch{throw new U("invalid_control")}let J=j;if(!J||typeof J!=="object"||typeof J.you!=="boolean"||typeof J.same_user!=="boolean")throw new U("invalid_control");let Q=J.holder===null?null:s(J.holder);if(Q===null&&J.holder!==null)throw new U("invalid_control");return{holder:Q,you:J.you,same_user:J.same_user}}function Zj(q,j){let J=new DataView(j.buffer,j.byteOffset,j.byteLength);switch(q){case $.hello:if(j.byteLength<6)throw new U("invalid_length");return{type:"hello",width:J.getUint16(0),height:J.getUint16(2),fps:J.getUint8(4),preset:T(J.getUint8(5)),codec:k(j.subarray(6))};case $.frame:if(j.byteLength<14)throw new U("invalid_length");if(J.getUint8(0)>1)throw new U("invalid_frame_flags");return{type:"frame",key:J.getUint8(0)===1,seq:J.getUint32(1),captureMicros:Number(J.getBigUint64(5)),data:j.subarray(13)};case $.stats:return{type:"stats",stats:Jj(j)};case $.ping:case $.pong:return C(j,8),{type:q===$.ping?"ping":"pong",token:J.getFloat64(0)};case $.serverClipboard:return{type:"serverClipboard",text:k(j)};case $.clientClipboard:return{type:"clientClipboard",text:k(j)};case $.error:return{type:"error",code:k(j)};case $.pointer:return C(j,5),{type:"pointer",x:J.getUint16(0),y:J.getUint16(2),buttons:J.getUint8(4)};case $.key:if(C(j,5),J.getUint8(0)>1)throw new U("invalid_key_flags");return{type:"key",down:J.getUint8(0)===1,keysym:J.getUint32(1)};case $.config:return C(j,1),{type:"config",preset:T(J.getUint8(0))};case $.keyframeRequest:return C(j,0),{type:"keyframeRequest"};case $.audioHello:if(j.byteLength<5)throw new U("invalid_length");return{type:"audioHello",sampleRate:J.getUint32(0),channels:J.getUint8(4),codec:k(j.subarray(5))};case $.audio:if(j.byteLength<9)throw new U("invalid_length");return{type:"audio",captureMicros:Number(J.getBigUint64(0)),data:j.subarray(8)};case $.audioEnable:if(C(j,1),J.getUint8(0)>1)throw new U("invalid_audio_flags");return{type:"audioEnable",on:J.getUint8(0)===1};case $.control:return{type:"control",control:Qj(j)};case $.windows:{if(j.byteLength%16!==0||j.byteLength>A*16)throw new U("invalid_length");let Q=[];for(let Z=0;Z<j.byteLength;Z+=16)Q.push({x:J.getInt32(Z),y:J.getInt32(Z+4),width:J.getInt32(Z+8),height:J.getInt32(Z+12)});return{type:"windows",bounds:Q}}case $.ack:return C(j,4),{type:"ack",seq:J.getUint32(0)};default:return null}}class $j{buffer=new Uint8Array(0);push(q){let j=new Uint8Array(this.buffer.byteLength+q.byteLength);j.set(this.buffer),j.set(q,this.buffer.byteLength);let J=[],Q=0;while(j.byteLength-Q>=4){let Z=new DataView(j.buffer,j.byteOffset+Q,4).getUint32(0);if(Z<1||Z>V)throw new U("invalid_message_length");if(j.byteLength-Q-4<Z)break;let z=j[Q+4],G=j.slice(Q+5,Q+4+Z),F=Zj(z,G);if(F)J.push(F);Q+=4+Z}return this.buffer=j.slice(Q),J}}var t="/usr/bin/osascript",Gj=5000,Kj=1048576,Uj=String.raw`
3
3
  ObjC.import("CoreGraphics");
4
4
  ObjC.import("ApplicationServices");
5
5
  ObjC.import("AppKit");
@@ -109,4 +109,4 @@ function run() {
109
109
  `);X>=0;X=B.indexOf(`
110
110
  `)){let S=B.slice(0,X);if(B=B.slice(X+1),!S.startsWith("c "))continue;let O=S.slice(2);if(O.length>Math.ceil(Y/3)*4||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(O)){K({reason:"display_protocol"});return}let _=Buffer.from(O,"base64");if(_.byteLength<=Y)q.clipboard(_.toString("utf8"));if(z)return}if(B.length>Math.ceil(Y/3)*4+2)K({reason:"display_protocol"})}),G.once("error",()=>W("Reason could not watch this Mac's desktop clipboard.")),G.once("exit",()=>{if(!z)W("Reason could not watch this Mac's desktop clipboard.")})};return J.stdout.on("data",(B)=>{if(z||Z===null)return;Z+=B.toString("utf8");let N=Z.indexOf(`
111
111
  `);if(N<0){if(Z.length>4096)K({reason:"display_protocol"});return}let X=y(Z.slice(0,N));if(Z=null,!X)K({reason:"display_protocol"});else if(!X.screen||!X.accessibility)W(j.length>0?"Reason's background worker needs Screen Recording and Accessibility on this Mac (its own Reason entry in System Settings > Privacy & Security, not the Reason app's): run `reason permissions allow` on this Mac.":"Allow Screen Recording and Accessibility for this Mac's Reason worker, then restart it.");else i(),q.ready({width:X.width,height:X.height})}),J.stdin.on("error",()=>{return}),J.once("error",()=>W("Reason could not start this Mac's desktop input.")),J.once("exit",()=>{if(Z!==null)W("Reason could not start this Mac's desktop input.");else K({reason:"display_closed"})}),{pointer:(B,N,X)=>L(Q.pointer(B,N,X)),key:(B,N)=>L(Q.key(B,N)),clipboard:(B)=>L([`c ${Buffer.from(B,"utf8").toString("base64")}`]),close(){z=!0,F()}}}
112
- export{Cj as xf,kj as yf,h as zf,Yj as Af,Y as Bf,Lj as Cf,Aj as Df,s as Ef,xj as Ff,Mj as Gf,fj as Hf,hj as If,$j as Jf,y as Kf,Sj as Lf,_j as Mf,Hj as Nf,Tj as Of,a as Pf,Vj as Qf};
112
+ export{Cj as uj,kj as vj,h as wj,Yj as xj,Y as yj,Lj as zj,Aj,s as Bj,xj as Cj,Mj as Dj,fj as Ej,hj as Fj,$j as Gj,y as Hj,Sj as Ij,_j as Jj,Hj as Kj,Tj as Lj,a as Mj,Vj as Nj};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{hc as h}from"./vm-hands-entry-lite-nvhzj5b0.js";import{Ag as Q,Cg as j,Dg as k,Eg as J,Fg as z,Gg as Z,Ig as K,Jg as $,Lg as _,Mg as G,Ng as S,Pg as M,Sg as X,sg as w,tg as m,ug as q,vg as B,wg as L,xg as W,yg as F}from"./vm-hands-entry-lite-mybm2kyz.js";import{$h as y,ai as p,bi as x,ci as b}from"./vm-hands-entry-lite-84d59wrf.js";var s=["cgroup_membership_read_failed","cgroup_v2_membership_absent","cgroup_scope_invalid","cgroup_root_unavailable","cgroup_directory_unavailable","cgroup_limit_read_failed","cgroup_events_read_failed","cgroup_current_read_failed","cgroup_stat_read_failed","boot_id_read_failed","boot_id_invalid","guest_meminfo_read_failed","guest_vmstat_read_failed","memory_counter_invalid","memory_field_missing","memory_capacity_invalid"];var o=String.raw`(function(fs, path) {
2
+ import{Sc as h}from"./vm-hands-entry-lite-f4gvypnx.js";import{$g as S,Gg as w,Hg as m,Ig as q,Jg as B,Kg as L,Lg as W,Mg as F,Og as Q,Qg as j,Rg as k,Sg as J,Tg as z,Ug as Z,Wg as K,Xg as $,Zg as _,_g as G,bh as M,eh as X}from"./vm-hands-entry-lite-v08mjs3f.js";import{gj as y,hj as p,ij as x,jj as b}from"./vm-hands-entry-lite-w88zkzhr.js";var s=["cgroup_membership_read_failed","cgroup_v2_membership_absent","cgroup_scope_invalid","cgroup_root_unavailable","cgroup_directory_unavailable","cgroup_limit_read_failed","cgroup_events_read_failed","cgroup_current_read_failed","cgroup_stat_read_failed","boot_id_read_failed","boot_id_invalid","guest_meminfo_read_failed","guest_vmstat_read_failed","memory_counter_invalid","memory_field_missing","memory_capacity_invalid"];var o=String.raw`(function(fs, path) {
3
3
  const fail = (message, reasonCode) => { throw Object.assign(Error(message), {reasonCode}); };
4
4
  const read = (p, reasonCode, trim=true) => { try { const text=fs.readFileSync(p, "utf8"); return trim?text.trim():text; }
5
5
  catch { fail("memory_read", reasonCode); } };
@@ -3995,4 +3995,4 @@ void startJobControl().then(() => {
3995
3995
  if (validPrivateJob) markReady(); else connect();
3996
3996
  }, () => process.exit(45));
3997
3997
  `.trimStart(),Pt=tt("sha256").update(at,"utf8").digest("hex");
3998
- export{r as Wb,Wt as Xb,f as Yb,l as Zb,et as _b,rt as $b,nt as ac,it as bc,Ht as cc,ot as dc,ct as ec,at as fc,Pt as gc};
3998
+ export{r as Fc,Wt as Gc,f as Hc,l as Ic,et as Jc,rt as Kc,nt as Lc,it as Mc,Ht as Nc,ot as Oc,ct as Pc,at as Qc,Pt as Rc};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{qi as C}from"./vm-hands-entry-lite-tj1y61bg.js";import{execFileSync as W}from"child_process";import{mkdirSync as b,readdirSync as R,readFileSync as F,rmSync as B,statSync as K,writeFileSync as f}from"fs";import{join as $}from"path";import{setTimeout as k}from"timers/promises";var A=3000,X=null;function G(z){return $(z,"users")}function m(z){if(X?.root===z.root)return;let H=G(z.root);b(H,{recursive:!0,mode:448}),f($(H,String(process.pid)),"",{mode:384}),X=z}function S(){if(!X)return;B($(G(X.root),String(process.pid)),{force:!0}),X=null}function x(z){try{return process.kill(z,0),!0}catch(H){return H instanceof Error&&"code"in H&&H.code==="EPERM"}}function L(){let z=process.getuid?.();if(process.platform==="linux")return R("/proc").flatMap((N)=>{if(!/^\d+$/.test(N))return[];try{if(K(`/proc/${N}`).uid!==z)return[];let Q=F(`/proc/${N}/cmdline`).toString("utf8").split("\x00").join(" ").trim();return Q?[{pid:Number(N),command:Q}]:[]}catch{return[]}});return W("/bin/ps",["-axww","-o","pid=,uid=,command="],{encoding:"utf8",maxBuffer:16777216}).split(`
2
+ import{Wj as C}from"./vm-hands-entry-lite-ygx9kj92.js";import{execFileSync as W}from"child_process";import{mkdirSync as b,readdirSync as R,readFileSync as F,rmSync as B,statSync as K,writeFileSync as f}from"fs";import{join as $}from"path";import{setTimeout as k}from"timers/promises";var A=3000,X=null;function G(z){return $(z,"users")}function m(z){if(X?.root===z.root)return;let H=G(z.root);b(H,{recursive:!0,mode:448}),f($(H,String(process.pid)),"",{mode:384}),X=z}function S(){if(!X)return;B($(G(X.root),String(process.pid)),{force:!0}),X=null}function x(z){try{return process.kill(z,0),!0}catch(H){return H instanceof Error&&"code"in H&&H.code==="EPERM"}}function L(){let z=process.getuid?.();if(process.platform==="linux")return R("/proc").flatMap((N)=>{if(!/^\d+$/.test(N))return[];try{if(K(`/proc/${N}`).uid!==z)return[];let Q=F(`/proc/${N}/cmdline`).toString("utf8").split("\x00").join(" ").trim();return Q?[{pid:Number(N),command:Q}]:[]}catch{return[]}});return W("/bin/ps",["-axww","-o","pid=,uid=,command="],{encoding:"utf8",maxBuffer:16777216}).split(`
3
3
  `).flatMap((N)=>{let Q=/^\s*(\d+)\s+(\d+)\s+(.+)$/.exec(N);return Q&&Number(Q[2])===z?[{pid:Number(Q[1]),command:Q[3]}]:[]})}async function p(){let z=X;if(!z)return{released:"unused",stopped:0};let H=G(z.root);B($(H,String(process.pid)),{force:!0}),X=null;let N=!1;for(let J of R(H)){let U=Number(J);if(Number.isSafeInteger(U)&&U>0&&x(U))N=!0;else B($(H,J),{force:!0})}if(N)return{released:"shared",stopped:0};let Q=L().filter((J)=>J.pid!==process.pid&&(J.command.includes(`${z.root}/`)||J.command.includes(`${z.automation}/`)||J.command.includes(z.extensionDir))),Y=(J,U)=>{try{process.kill(J,U)}catch{}};for(let J of Q)Y(J.pid,"SIGTERM");for(let J=Date.now()+A;Date.now()<J&&Q.some((U)=>x(U.pid));)await new Promise((U)=>setTimeout(U,100));for(let J of Q)if(x(J.pid))Y(J.pid,"SIGKILL");return{released:"stopped",stopped:Q.length}}var O=20000,j=30000,v=100,Z=new Map,V=null,q=[];function h(z){Z.set(z,(Z.get(z)??0)+1);let H=!1;return()=>{if(H)return;H=!0;let N=(Z.get(z)??1)-1;if(N>0){Z.set(z,N);return}if(Z.delete(z),V?.run===z)V.idleUntil=0}}function M(){return new C("automation_desktop_busy","Another Session, or another agent of this Session, is using this worker's desktop. Retry after it finishes.")}function P(z,H){return V!==null&&V.run!==z&&(V.calls>0||H<V.idleUntil)}async function I(z,H,N=Date.now){let Q=Symbol(z);q.push(Q);try{let U=N()+j;for(;;){if(!P(z,N())&&(V?.run===z||q[0]===Q))break;if(N()>=U)throw M();await k(v,void 0,{signal:H}).catch(()=>H.throwIfAborted())}}finally{q.splice(q.indexOf(Q),1)}if(V?.run!==z)V={run:z,calls:0,idleUntil:0};let Y=V;Y.calls+=1;let J=!1;return()=>{if(J)return;J=!0,Y.calls-=1,Y.idleUntil=N()+O}}
4
- export{m as ji,S as ki,p as li,O as mi,j as ni,h as oi,I as pi};
4
+ export{m as Pj,S as Qj,p as Rj,O as Sj,j as Tj,h as Uj,I as Vj};