@reason-machines/cli-linux-x64 0.2.503 → 0.2.505

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 (167) hide show
  1. package/THIRD_PARTY_NOTICES.txt +7 -8
  2. package/bin/reason +2 -2
  3. package/bin/runtime/srt/sandbox-runtime.mjs +52 -52
  4. package/bin/vm-hands/api-credentials-23k36ayh.js +2 -0
  5. package/bin/vm-hands/api-jd29p2kc.js +2 -0
  6. package/bin/vm-hands/ask-relay-zpp0rkhg.js +4 -0
  7. package/bin/vm-hands/connect-cli-xyxgcg6z.js +2 -0
  8. package/bin/vm-hands/credentials-byna24dv.js +2 -0
  9. package/bin/vm-hands/custom-endpoint-device-p2agcsk0.js +2 -0
  10. package/bin/vm-hands/desktop-account-z16mmkxg.js +2 -0
  11. package/bin/vm-hands/device-workspace-y0tk3ne8.js +2 -0
  12. package/bin/vm-hands/hands-worker-source-0qa16xzj.js +2 -0
  13. package/bin/vm-hands/index-h6xkz48h.js +12818 -0
  14. package/bin/vm-hands/install-receipt-nnragt7p.js +2 -0
  15. package/bin/vm-hands/local-automation-xbpca0f3.js +2 -0
  16. package/bin/vm-hands/local-capabilities-30m8pzpv.js +2 -0
  17. package/bin/vm-hands/local-desktop-users-gxfywsan.js +2 -0
  18. package/bin/vm-hands/local-display-mac-n236gkpe.js +2 -0
  19. package/bin/vm-hands/local-display-session-ddafdm8k.js +2 -0
  20. package/bin/vm-hands/local-display-video-gha54xwa.js +2 -0
  21. package/bin/vm-hands/local-managed-process-0zwxyqxd.js +2 -0
  22. package/bin/vm-hands/local-pty-session-w1yrmjm0.js +2 -0
  23. package/bin/vm-hands/managed-runtime-8y90twae.js +2 -0
  24. package/bin/vm-hands/network-contract-v0fkg94d.js +2 -0
  25. package/bin/vm-hands/network-sign-in-3dkdkh3a.js +34 -0
  26. package/bin/vm-hands/package-z2dk6xva.js +2 -0
  27. package/bin/vm-hands/permissions-ga1ax8wd.js +2 -0
  28. package/bin/vm-hands/reason-hands-protocol-vzgxd159.js +2 -0
  29. package/bin/vm-hands/serve-service-42nqanvr.js +2 -0
  30. package/bin/vm-hands/status-m0g7k47a.js +96 -0
  31. package/bin/vm-hands/version-ye6800p2.js +2 -0
  32. package/bin/vm-hands/vm-hands-entry-lite-00y3kn86.js +7 -0
  33. package/bin/vm-hands/vm-hands-entry-lite-0572m6cr.js +344 -0
  34. package/bin/vm-hands/vm-hands-entry-lite-07q2xvk1.js +5 -0
  35. package/bin/vm-hands/vm-hands-entry-lite-0a4cy8gw.js +5 -0
  36. package/bin/vm-hands/vm-hands-entry-lite-1nj03gbj.js +4 -0
  37. package/bin/vm-hands/vm-hands-entry-lite-26xb026c.js +3 -0
  38. package/bin/vm-hands/vm-hands-entry-lite-33h8294z.js +3 -0
  39. package/bin/vm-hands/vm-hands-entry-lite-3882raa5.js +3 -0
  40. package/bin/vm-hands/vm-hands-entry-lite-3rg3znp8.js +3 -0
  41. package/bin/vm-hands/vm-hands-entry-lite-4swa18qz.js +10 -0
  42. package/bin/vm-hands/vm-hands-entry-lite-56v9haps.js +3 -0
  43. package/bin/vm-hands/vm-hands-entry-lite-6x5pj2y0.js +4 -0
  44. package/bin/vm-hands/{vm-hands-entry-lite-fcvf8md1.js → vm-hands-entry-lite-8p8hz0j1.js} +2 -2
  45. package/bin/vm-hands/vm-hands-entry-lite-8twscwtw.js +112 -0
  46. package/bin/vm-hands/vm-hands-entry-lite-8xe0wzp9.js +3 -0
  47. package/bin/vm-hands/vm-hands-entry-lite-ah2ep922.js +4 -0
  48. package/bin/vm-hands/vm-hands-entry-lite-b0p8f295.js +52 -0
  49. package/bin/vm-hands/{vm-hands-entry-lite-3gztfxwt.js → vm-hands-entry-lite-b7wy89y0.js} +54 -54
  50. package/bin/vm-hands/vm-hands-entry-lite-c5gt0086.js +3 -0
  51. package/bin/vm-hands/{vm-hands-entry-lite-wrvz9jxy.js → vm-hands-entry-lite-c8bf82tx.js} +2 -2
  52. package/bin/vm-hands/vm-hands-entry-lite-dgmap6z4.js +5 -0
  53. package/bin/vm-hands/vm-hands-entry-lite-dhqmbqsh.js +9 -0
  54. package/bin/vm-hands/vm-hands-entry-lite-e1xjfj57.js +3 -0
  55. package/bin/vm-hands/vm-hands-entry-lite-e4hwb89r.js +66 -0
  56. package/bin/vm-hands/vm-hands-entry-lite-g6r5xrk0.js +105 -0
  57. package/bin/vm-hands/vm-hands-entry-lite-ghhpgt3v.js +3 -0
  58. package/bin/vm-hands/vm-hands-entry-lite-h5smacqn.js +3 -0
  59. package/bin/vm-hands/vm-hands-entry-lite-jd31as70.js +3 -0
  60. package/bin/vm-hands/vm-hands-entry-lite-k9n1pk42.js +4 -0
  61. package/bin/vm-hands/vm-hands-entry-lite-kqbats5n.js +3 -0
  62. package/bin/vm-hands/vm-hands-entry-lite-p9fwt68c.js +42 -0
  63. package/bin/vm-hands/vm-hands-entry-lite-pkk555dx.js +3 -0
  64. package/bin/vm-hands/vm-hands-entry-lite-pmw3ycgc.js +5 -0
  65. package/bin/vm-hands/vm-hands-entry-lite-q9g11dbj.js +3 -0
  66. package/bin/vm-hands/vm-hands-entry-lite-r374pchj.js +9 -0
  67. package/bin/vm-hands/vm-hands-entry-lite-r665z809.js +4 -0
  68. package/bin/vm-hands/vm-hands-entry-lite-rck5h8fr.js +3 -0
  69. package/bin/vm-hands/vm-hands-entry-lite-rj8yq6gp.js +3 -0
  70. package/bin/vm-hands/{vm-hands-entry-lite-w0hqa0d3.js → vm-hands-entry-lite-s8ty42st.js} +9 -5
  71. package/bin/vm-hands/vm-hands-entry-lite-s8zfzv0k.js +6 -0
  72. package/bin/vm-hands/vm-hands-entry-lite-tafgty5k.js +4 -0
  73. package/bin/vm-hands/vm-hands-entry-lite-tbdcmq09.js +3 -0
  74. package/bin/vm-hands/vm-hands-entry-lite-td309c1y.js +5 -0
  75. package/bin/vm-hands/vm-hands-entry-lite-v0bp1v66.js +128 -0
  76. package/bin/vm-hands/vm-hands-entry-lite-v0k8b768.js +452 -0
  77. package/bin/vm-hands/vm-hands-entry-lite-v4r1fggm.js +3 -0
  78. package/bin/vm-hands/vm-hands-entry-lite-vqr3zrqr.js +539 -0
  79. package/bin/vm-hands/vm-hands-entry-lite-wbfmc0xn.js +3 -0
  80. package/bin/vm-hands/vm-hands-entry-lite-x3pbyg92.js +3 -0
  81. package/bin/vm-hands/{vm-hands-entry-lite-rfz60hb3.js → vm-hands-entry-lite-xd2dn3n8.js} +2 -2
  82. package/bin/vm-hands/vm-hands-entry-lite-yqn8h1p0.js +3 -0
  83. package/bin/vm-hands/vm-hands-entry-lite-zj3hb5jk.js +127 -0
  84. package/bin/vm-hands/vm-hands-entry-lite-zz8tr0bm.js +12 -0
  85. package/bin/vm-hands/vm-hands-entry-lite.js +1 -3
  86. package/bin/vm-hands/vm-hands-executor-6tncheya.js +12 -0
  87. package/bin/vm-hands/vm-hands-op-runner-s1ghsym7.js +2 -0
  88. package/bin/vm-hands/vm-hands-runtime-k6egwk2t.js +4 -0
  89. package/bin/vm-hands/worker-preview-readiness-wh0yg1dz.js +2 -0
  90. package/bin/vm-hands/worker-sandbox-s054x4zw.js +2 -0
  91. package/package.json +1 -1
  92. package/bin/vm-hands/api-3khds2ds.js +0 -2
  93. package/bin/vm-hands/api-credentials-qm62bpjs.js +0 -2
  94. package/bin/vm-hands/connect-cli-aqjq32ax.js +0 -2
  95. package/bin/vm-hands/credentials-drj5ktpt.js +0 -2
  96. package/bin/vm-hands/custom-endpoint-device-389h3q6n.js +0 -2
  97. package/bin/vm-hands/desktop-account-tjf36aya.js +0 -2
  98. package/bin/vm-hands/device-workspace-pt07525s.js +0 -2
  99. package/bin/vm-hands/fsevents-s0cwdhcq.js +0 -2
  100. package/bin/vm-hands/hands-worker-source-wrj180b5.js +0 -2
  101. package/bin/vm-hands/index-w9sxzata.js +0 -12818
  102. package/bin/vm-hands/install-receipt-9bv4vth9.js +0 -2
  103. package/bin/vm-hands/local-automation-0h4gspef.js +0 -2
  104. package/bin/vm-hands/local-capabilities-bq62be6s.js +0 -2
  105. package/bin/vm-hands/local-desktop-users-tqagws7p.js +0 -2
  106. package/bin/vm-hands/local-display-mac-w792g9g3.js +0 -2
  107. package/bin/vm-hands/local-display-session-jdapy5nj.js +0 -2
  108. package/bin/vm-hands/local-display-video-zaahvqys.js +0 -2
  109. package/bin/vm-hands/local-managed-process-8xfcpy62.js +0 -2
  110. package/bin/vm-hands/local-pty-session-rdv5wv5g.js +0 -2
  111. package/bin/vm-hands/managed-runtime-b2c3ybmw.js +0 -2
  112. package/bin/vm-hands/network-contract-h6s7ptm5.js +0 -2
  113. package/bin/vm-hands/package-yy8qcwwn.js +0 -2
  114. package/bin/vm-hands/permissions-bkncrfej.js +0 -2
  115. package/bin/vm-hands/reason-hands-protocol-vw2dbdse.js +0 -2
  116. package/bin/vm-hands/serve-service-zq91vepg.js +0 -2
  117. package/bin/vm-hands/status-zqgrfjee.js +0 -10
  118. package/bin/vm-hands/version-p5nf1t3k.js +0 -2
  119. package/bin/vm-hands/vm-hands-entry-lite-13rapgf5.js +0 -3
  120. package/bin/vm-hands/vm-hands-entry-lite-1e1cmyyr.js +0 -4
  121. package/bin/vm-hands/vm-hands-entry-lite-1g1v87ky.js +0 -4
  122. package/bin/vm-hands/vm-hands-entry-lite-2dx4pnz7.js +0 -3
  123. package/bin/vm-hands/vm-hands-entry-lite-2jadtgms.js +0 -3
  124. package/bin/vm-hands/vm-hands-entry-lite-2k2b78mv.js +0 -2
  125. package/bin/vm-hands/vm-hands-entry-lite-38g65s5x.js +0 -3
  126. package/bin/vm-hands/vm-hands-entry-lite-3y7jrsta.js +0 -3
  127. package/bin/vm-hands/vm-hands-entry-lite-5fqjftez.js +0 -5
  128. package/bin/vm-hands/vm-hands-entry-lite-61yxnt1v.js +0 -128
  129. package/bin/vm-hands/vm-hands-entry-lite-64z2tjpg.js +0 -2
  130. package/bin/vm-hands/vm-hands-entry-lite-6x1an7es.js +0 -7
  131. package/bin/vm-hands/vm-hands-entry-lite-7777m86y.js +0 -3
  132. package/bin/vm-hands/vm-hands-entry-lite-87vmbt38.js +0 -3
  133. package/bin/vm-hands/vm-hands-entry-lite-88x7p823.js +0 -2
  134. package/bin/vm-hands/vm-hands-entry-lite-8e388a7s.js +0 -539
  135. package/bin/vm-hands/vm-hands-entry-lite-8qhz89mt.js +0 -4
  136. package/bin/vm-hands/vm-hands-entry-lite-9wa2y4x0.js +0 -42
  137. package/bin/vm-hands/vm-hands-entry-lite-a1xa7s06.js +0 -65
  138. package/bin/vm-hands/vm-hands-entry-lite-asvarhpz.js +0 -105
  139. package/bin/vm-hands/vm-hands-entry-lite-azpzxdzz.js +0 -3
  140. package/bin/vm-hands/vm-hands-entry-lite-dw558ggz.js +0 -2
  141. package/bin/vm-hands/vm-hands-entry-lite-e4c6z5t3.js +0 -2
  142. package/bin/vm-hands/vm-hands-entry-lite-f62fvme8.js +0 -5
  143. package/bin/vm-hands/vm-hands-entry-lite-f69t48dj.js +0 -4
  144. package/bin/vm-hands/vm-hands-entry-lite-gc7550c0.js +0 -5
  145. package/bin/vm-hands/vm-hands-entry-lite-hhhc7xx3.js +0 -9
  146. package/bin/vm-hands/vm-hands-entry-lite-krm8w7wp.js +0 -3
  147. package/bin/vm-hands/vm-hands-entry-lite-mcjca0ez.js +0 -3
  148. package/bin/vm-hands/vm-hands-entry-lite-n11hd729.js +0 -52
  149. package/bin/vm-hands/vm-hands-entry-lite-n4xgpgkw.js +0 -5
  150. package/bin/vm-hands/vm-hands-entry-lite-np07qyeq.js +0 -3
  151. package/bin/vm-hands/vm-hands-entry-lite-nqdstx24.js +0 -3
  152. package/bin/vm-hands/vm-hands-entry-lite-p7cqhtyg.js +0 -126
  153. package/bin/vm-hands/vm-hands-entry-lite-psywfz8m.js +0 -9
  154. package/bin/vm-hands/vm-hands-entry-lite-qy9xg6em.js +0 -3
  155. package/bin/vm-hands/vm-hands-entry-lite-r602gdfm.js +0 -14
  156. package/bin/vm-hands/vm-hands-entry-lite-swrymqj9.js +0 -3
  157. package/bin/vm-hands/vm-hands-entry-lite-tebh7dcm.js +0 -6
  158. package/bin/vm-hands/vm-hands-entry-lite-txd50spx.js +0 -3
  159. package/bin/vm-hands/vm-hands-entry-lite-w0pegc58.js +0 -112
  160. package/bin/vm-hands/vm-hands-entry-lite-yas2db7h.js +0 -452
  161. package/bin/vm-hands/vm-hands-entry-lite-yretc2th.js +0 -3
  162. package/bin/vm-hands/vm-hands-entry-lite-zce4hftk.js +0 -3
  163. package/bin/vm-hands/vm-hands-executor-seqvbxb7.js +0 -12
  164. package/bin/vm-hands/vm-hands-op-runner-mh0haxhr.js +0 -2
  165. package/bin/vm-hands/vm-hands-runtime-hg3yrdp9.js +0 -4
  166. package/bin/vm-hands/worker-preview-readiness-m2dn9mmn.js +0 -2
  167. package/bin/vm-hands/worker-sandbox-k4cfh0ya.js +0 -2
@@ -1,14 +0,0 @@
1
- // @bun
2
- import{Ge,dt}from"./vm-hands-entry-lite-w0pegc58.js";import{Qe}from"./vm-hands-entry-lite-2k2b78mv.js";import{To,le,Gr,mt,Ro}from"./vm-hands-entry-lite-hhhc7xx3.js";import{E}from"./vm-hands-entry-lite-txd50spx.js";import{a,tr}from"./vm-hands-entry-lite-swrymqj9.js";import{spawnSync as H}from"child_process";import{dirname as w}from"path";import{spawn as A}from"child_process";import{accessSync as _,constants as v}from"fs";import{basename as C,join as O}from"path";var l=null;function S(e){if(l===e)l=null;if(e.exitCode===null&&e.signalCode===null)e.kill("SIGTERM")}var Rr=(e,t)=>{if(l)S(l);let s=O(e,To);try{_(s,v.X_OK)}catch{return()=>{}}let n;try{n=A(s,["--app",e,"--name",C(e,".app"),"--permission",t==="screen"?"screen_recording":"accessibility"],{detached:!0,stdio:"ignore"})}catch{return()=>{}}return n.on("error",()=>{if(l===n)l=null}),n.once("exit",()=>{if(l===n)l=null}),n.unref(),l=n,()=>S(n)};import{chmodSync as ne,existsSync as se,mkdirSync as re,readFileSync as D,realpathSync as ie,renameSync as oe,statSync as j,writeFileSync as ae}from"fs";import{dirname as de,isAbsolute as G,join as N,resolve as T,sep as b}from"path";function F(e=a()){return N(tr(e),"reason","protected-path-grants.json")}var f=null;function L(e){let t=JSON.parse(e);if(!Array.isArray(t?.grants))return[];return t.grants.flatMap((s)=>{let n=s;return n&&typeof n.path==="string"&&G(n.path)&&(n.kind==="file"||n.kind==="folder")&&typeof n.grantedAt==="number"?[{path:n.path,kind:n.kind,grantedAt:n.grantedAt}]:[]})}function y(e=F()){try{let{mtimeMs:t}=j(e);if(f&&f.file===e&&f.mtimeMs===t)return f.grants;let s=L(D(e,"utf8"));return f={file:e,mtimeMs:t,grants:s},s}catch{return[]}}function W(e,t){return e.kind==="file"?t===e.path:t===e.path||t.startsWith(`${e.path}${b}`)}function U(e,t){let s=T(e);return y(t).some((n)=>W(n,s))}function fo(e,t){return E(e)&&!U(e,t)}function mo(e,t,s){let n=t?"file-read* file-write*":"file-read*";return y(s).filter((r)=>r.path===e||r.path.startsWith(`${e}${b}`)).map((r)=>`(allow ${n} (${r.kind==="file"?"literal":"subpath"} ${JSON.stringify(r.path)}))`)}var P="x-apple.systempreferences:com.apple.preference.security",J="curl -fsSL https://reasonmachines.com/install.sh | bash",q=180000,B=2000;var k={screen:{label:"Screen & System Audio Recording",purpose:"desktop video, computer-use screenshots",level:"required",pane:`${P}?Privacy_ScreenCapture`},accessibility:{label:"Accessibility",purpose:"computer-use clicks and typing, desktop input",level:"required",pane:`${P}?Privacy_Accessibility`},disk:{label:"Full Disk Access",purpose:"Sessions in Desktop, Documents, Downloads, iCloud Drive and Mail",level:"recommended",pane:`${P}?Privacy_AllFiles`}};function R(e){return e.executable}function K(e,t){if(e==="computer_use_identity_missing")return`Reason's background identity is not installed (${e}); reinstall Reason: ${J}`;if(e==="computer_use_identity_outdated")return`Reason's background identity is outdated (${Gr(t)??"unknown"}; this CLI is ${Qe}) (${e}); \`reason update\` installs this release's`;return`Reason's background identity cannot run computer use for this CLI (${e}); run the installed \`reason\``}function es(e=a()){let t=mt(e);if(t.length>0)return{state:"ready",path:w(w(w(t[0]))),prefix:t};let s=Ro(t,e)??"computer_use_identity_unavailable";return{state:s,path:le(e),detail:K(s,e)}}function V(){return{identity:()=>es(),grants:(e)=>Ge(e),request:(e,t)=>dt(e,t),worker:async()=>(await import("./status-zqgrfjee.js")).connectionMacState(),open:(e)=>{H("/usr/bin/open",e,{stdio:"ignore",timeout:1e4})},tile:Rr,restartConnection:async()=>(await import("./connect-cli-aqjq32ax.js")).restartConnection(),sleep:(e)=>new Promise((t)=>setTimeout(t,e)),now:()=>Date.now()}}function M(e,t,s){if(e.state!=="ready"||!t)return"unknown";return t[s]?"granted":"missing"}async function ts(e){let t=e.identity(),s=t.state==="ready"?await e.grants(t.prefix):null,n=await e.worker(),r=n?R(n):null,i=!r||n?.full_disk_access==="unknown"?"unknown":n?.full_disk_access==="granted"?"granted":"missing",c=(u,d,o)=>{let{label:p,purpose:h,level:m}=k[u];return{id:u,label:p,purpose:h,level:m,state:d,holder:o}};return{identity:{state:t.state,path:t.path,detail:t.state==="ready"?null:t.detail},worker_detail:r?null:"Full Disk Access is read from this computer's running worker; `reason connect` starts it.",permissions:[c("screen",M(t,s,"screen"),t.path),c("accessibility",M(t,s,"accessibility"),t.path),c("disk",i,r)]}}function $s(e){let t=e.identity.state==="ready"?null:e.identity.state,s=e.permissions.filter((i)=>i.state==="granted").length,n=[...t?[t]:[],...e.permissions.filter((i)=>i.state!=="granted"&&!(t&&i.id!=="disk")).map((i)=>`${i.label} ${i.state}`)],r=!t&&e.permissions.some((i)=>i.state==="missing");return`Permissions: ${s} of ${e.permissions.length}${n.length>0?` (${n.join(", ")})`:""}`+(r?" \u2014 reason permissions allow":n.length>0?" \u2014 reason permissions":"")}async function x(e,t){let s=t.now()+q;for(;;){if(await e())return!0;if(t.now()>=s)return!1;await t.sleep(B)}}async function Bs(e,t){let s=t.host??V(),{io:n}=t,r=await ts(s),i=r.permissions.filter((o)=>e.includes(o.id)&&o.state!=="granted");if(i.length===0)return n.stdout.write(`Reason permissions: ${e.map((o)=>k[o].label).join(", ")} already allowed.
3
- `),0;let c=!1,u=!1,d=s.identity();for(let o of i){let{label:p,pane:h}=k[o.id];if(o.id!=="disk"){if(d.state!=="ready"){if(!c)n.stderr.write(`Reason permissions: ${d.detail}
4
- `);c=!0;continue}let g=o.id;await s.request(d.prefix,g),s.open([h]);let I=s.tile(d.path,g);if(n.stdout.write(`Allow Reason in System Settings > Privacy & Security > ${p}.
5
- `),!t.wait)continue;if(n.stdout.write(`Waiting for it (Ctrl-C to stop)\u2026
6
- `),await x(async()=>(await s.grants(d.prefix))?.[g]===!0,s).finally(I))n.stdout.write(`${p}: granted.
7
- `),u=!0;else n.stderr.write(`${p} is not allowed yet; turn on Reason there, then run \`reason permissions\`.
8
- `),c=!0;continue}let m=R(await s.worker()??{executable:null});if(!m){n.stderr.write(`Reason permissions: ${r.worker_detail} Then run \`reason permissions allow disk\`.
9
- `),c=!0;continue}if(s.open([h]),s.open(["-R",m]),n.stdout.write(`Full Disk Access: click + and choose ${m} (shown in Finder), or drag it into the list.
10
- `),!t.wait)continue;if(n.stdout.write(`Waiting for the worker to report it (Ctrl-C to stop)\u2026
11
- `),await x(async()=>(await s.worker())?.full_disk_access==="granted",s))n.stdout.write(`Full Disk Access: granted.
12
- `);else n.stderr.write("Full Disk Access is not reported yet. If you allowed it, `reason connect` restarts the worker with it.\n"),c=!0}if(u)try{if(await s.restartConnection())n.stdout.write(`This computer's Reason connection restarted to use them.
13
- `)}catch(o){n.stderr.write(`This computer's Reason connection uses them after it restarts (\`reason connect\`): ${o instanceof Error?o.message:String(o)}
14
- `)}return c?1:0}export{Rr,fo,mo,es,ts,$s,Bs};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{de,et,O}from"./vm-hands-entry-lite-38g65s5x.js";import{execFileSync as p}from"child_process";import{existsSync as s,realpathSync as c}from"fs";import{userInfo as l}from"os";import{isAbsolute as u,join as t,normalize as f,parse as d}from"path";function a(){let r=f(l().homedir);if(!u(r)||r===d(r).root)throw Error("Could not resolve the canonical user home.");return r}function ie(r,n,e=a()){let i=O(n);if(n.kind==="managed"&&n.base){let o=c(e);return{anchor:o,boundary:t(o,n.base),path:t(o,i)}}if(n.kind==="root"&&et(n.path)){let o=c(e);return{anchor:o,boundary:t(o,de),path:t(o,i)}}return{anchor:r,boundary:r,path:t(r,i)}}function tr(r=a()){return t(r,".config")}function Mo(){if(process.platform!=="darwin")return null;try{let r=p("/usr/bin/getconf",["DARWIN_USER_DIR"],{encoding:"utf8",timeout:5000}).trim();return u(r)?c(r):null}catch{return null}}function $o(r=a()){let n=t(r,"Library","Application Support","Ara"),e=t(r,"Library","Application Support","Reason");return s(n)&&!s(e)?n:e}
3
- export{a,ie,tr,Mo,$o};
@@ -1,6 +0,0 @@
1
- // @bun
2
- import{E}from"./vm-hands-entry-lite-txd50spx.js";import{fe,Ie,Ne,Le,Me}from"./vm-hands-entry-lite-87vmbt38.js";import{spawn as y}from"child_process";import{existsSync as p,mkdirSync as T,readFileSync as _,writeFileSync as A}from"fs";import{homedir as m}from"os";import{basename as H,delimiter as g,join as f,win32 as u}from"path";var Er=process.platform==="win32"?Ie("win32"):"/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",P=Er.split(g),R=5000,S=65536,O=new Set(["zsh","bash"]),b=[[".local","bin"],[".bun","bin"],[".cargo","bin"],["go","bin"]],x=(t,e)=>new Promise((n,r)=>{let o;try{o=y(t,[...e],{...Ne(),stdio:["ignore","pipe","ignore"]}),Le(o)}catch(c){r(c);return}let i=[],s=0,a=null,L=(c)=>{a??=Error(c);try{if(o.pid!==void 0)Me(o.pid,"SIGKILL")}catch{}},d=setTimeout(()=>L("login_shell_timeout"),R);o.stdout?.on("data",(c)=>{if(s+=c.length,s>S)L("login_shell_output_too_large");else i.push(c)}),o.once("error",(c)=>{clearTimeout(d),r(c)}),o.once("close",(c)=>{if(clearTimeout(d),a)r(a);else if(c!==0)r(Error("login_shell_exit_nonzero"));else n(Buffer.concat(i).toString("utf8"))})});function w(t){return typeof t==="string"&&t.startsWith("/")&&!t.includes("\x00")&&O.has(H(t))}function h(t){let e=new Set,n=[];for(let r of t){if(e.has(r))continue;e.add(r),n.push(r)}return n}function xr(t,e=process.platform){let n=e==="win32",r=t.split(`
3
- `).at(-1)??"",o=[];for(let i of r.split(n?";":":")){let s=i.trim();if(n?!u.isAbsolute(s):!s.startsWith("/"))continue;if(s.includes("\x00"))continue;if(E(s))continue;o.push(s)}return h(o)}function vn(t){let e=t?.home??m(),n=t?.directoryExists??p,r=b.map((o)=>f(e,...o)).filter((o)=>{try{return n(o)}catch{return!1}});return h([...r,...process.platform==="win32"?xr(process.env.PATH??process.env.Path??""):[],...P]).join(g)}async function C(t){let e=t?.shell??process.env.SHELL,n=()=>({path:vn({home:t?.home,directoryExists:t?.directoryExists}),source:"fallback"});if(process.platform==="win32"||!w(e))return n();let r;try{r=await(t?.runLoginShell??x)(e,["-lic",'printf %s "$PATH"'])}catch{return n()}if(Buffer.byteLength(r,"utf8")>S)return n();let o=xr(r);if(o.length===0)return n();return{path:h([...o,...P]).join(":"),source:"login_shell"}}function oo(t){let e=null;return()=>(e??=C(t),e)}function l(t){if(t===void 0||t.includes("\x00")||Buffer.byteLength(t,"utf8")>32768)return;return t}function He(t){let e=t.source??process.env,n={HOME:t.home,PATH:t.path??Er,TMPDIR:t.temporaryDirectory,SHELL:l(e.SHELL)??"/bin/zsh",LANG:l(e.LANG)??"C.UTF-8",LC_ALL:l(e.LC_ALL)??l(e.LANG)??"C.UTF-8"},r=l(e.LC_CTYPE),o=l(e.TERM),i=l(e.COLORTERM);if(r)n.LC_CTYPE=r;if(o)n.TERM=o;if(i)n.COLORTERM=i;if(process.platform==="win32"){for(let s of I){let a=l(e[s]);if(a)n[s]=a}n.TEMP=n.TMP=t.temporaryDirectory,n.SHELL=fe()??n.SHELL,n.PATH=Sn(n.PATH)}return n}function Sn(t,e=f(m(),".reason","python3")){let n=(i)=>t.split(u.delimiter).filter((s)=>s&&!/[\\/]WindowsApps[\\/]?$/i.test(s)).map((s)=>u.join(s,i)).find((s)=>p(s)),r=n("python.exe");if(n("python3.exe")||!r)return t;let o=`#!/bin/sh
4
- exec "${r.replaceAll("\\","/")}" "$@"
5
- `;try{let i=f(e,"python3");if(!p(i)||_(i,"utf8")!==o)T(e,{recursive:!0}),A(i,o)}catch{return t}return[e,t].join(u.delimiter)}var I=["SystemRoot","SystemDrive","windir","ComSpec","PATHEXT","USERPROFILE","USERNAME","USERDOMAIN","APPDATA","LOCALAPPDATA","ProgramData","ProgramFiles","ProgramFiles(x86)","ProgramW6432","CommonProgramFiles","NUMBER_OF_PROCESSORS","PROCESSOR_ARCHITECTURE","OS"];
6
- export{Er,xr,vn,oo,He,Sn};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{resolve as s,sep as i}from"path";var ve=[[".ssh"],[".gnupg"],[".aws"],[".azure"],[".kube"],[".docker"],[".infisical"],[".password-store"],[".terraform.d"],[".config","ara"],[".config","reason"],[".config","gh"],[".config","gcloud"],[".config","infisical"],[".config","op"],[".config","1password"],[".config","pass"],[".local","share","keyrings"],["library","keychains"],["library","application support","so.ara.desktop"],["appdata","roaming","github cli"],["appdata","roaming","gcloud"],["appdata","roaming","microsoft","credentials"],["appdata","local","microsoft","credentials"],["appdata","roaming","microsoft","protect"],["appdata","roaming","1password"],["appdata","local","1password"],["appdata","roaming","microsoft","windows","start menu","programs","startup"],["documents","windowspowershell"],["documents","powershell"],["appdata","local","reason"]],jt=[[".codex","config.toml"],[".cursor","mcp.json"],[".claude","settings.json"],[".claude","settings.local.json"],[".cargo","credentials"],[".cargo","credentials.toml"],[".gem","credentials"],[".config","git","config"],[".config","git","credentials"],[".config","pip","pip.conf"]],Ut=new Set([".bash_login",".bash_profile",".bashrc",".bunfig.toml",".claude.json",".env",".envrc",".git-credentials",".gitconfig",".mcp.json",".netrc",".npmrc",".profile",".pypirc",".terraformrc",".yarnrc",".yarnrc.yml",".zlogin",".zlogout",".zprofile",".zshenv",".zshrc","auth.json","credentials.json","credentials.tfrc.json","local-daemon.json","local-device.json","mcp.json"]),Ht=[".key",".p12",".pfx",".pem"];function t(n,a){if(n.length<a.length)return!1;for(let r=0;r<=n.length-a.length;r+=1)if(a.every((o,e)=>n[r+e]===o))return!0;return!1}function E(n){let a=s(n).split(i).filter(Boolean).map((o)=>o.toLowerCase());if(ve.some((o)=>t(a,o)))return!0;if(jt.some((o)=>t(a,o)))return!0;let r=a.at(-1)??"";return Ut.has(r)||r.startsWith(".env.")||Ht.some((o)=>r.endsWith(o))}
3
- export{ve,jt,Ut,Ht,E};
@@ -1,112 +0,0 @@
1
- // @bun
2
- import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as ie,spawn as E}from"child_process";var go="h264_ws_v1",_o="video",ut=["smooth","sharp","data_saver","balanced"];var yo="video_presets";var L=8388608,S=65536,wo="control",bo="v1",X=200;function Mn(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t,n=(i)=>typeof i==="string"&&i.length>0&&i.length<=X;if(Object.keys(e).length!==2||!n(e.user_id)||!n(e.name))return null;return{user_id:e.user_id,name:e.name}}var vo="windows",So="v1",D=200,J=(t)=>typeof t==="string"&&ut.includes(t);function Eo(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t;if(Object.keys(e).length!==2||e.format!=="h264_ws_v1"||!J(e.preset))return null;return{format:"h264_ws_v1",preset:e.preset}}var o={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,resize:24};class l extends Error{constructor(t){super(t);this.name="DisplayVideoProtocolError"}}var Z=new TextEncoder,Q=new TextDecoder("utf-8",{fatal:!0});function p(t,e){if(e.byteLength+1>L)throw new l("message_too_large");let n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,e.byteLength+1),i.setUint8(4,t),n.set(e,5),n}function w(t){let e=Z.encode(t);if(e.byteLength>S)throw new l("text_too_large");return e}function _(t,e){if(!Number.isInteger(t)||t<0||t>65535)throw new l(`invalid_${e}`);return t}function ee(t){if(!Number.isFinite(t))throw new l("invalid_window");return Math.max(-2147483648,Math.min(2147483647,Math.round(t)))}function zt(t){switch(t.type){case"hello":{let e=w(t.codec),n=new Uint8Array(6+e.byteLength),i=new DataView(n.buffer);return i.setUint16(0,_(t.width,"width")),i.setUint16(2,_(t.height,"height")),i.setUint8(4,Math.max(1,Math.min(240,Math.round(t.fps)))),i.setUint8(5,ut.indexOf(t.preset)),n.set(e,6),p(o.hello,n)}case"frame":{let e=new Uint8Array(13+t.data.byteLength),n=new DataView(e.buffer);return n.setUint8(0,t.key?1:0),n.setUint32(1,t.seq>>>0),n.setBigUint64(5,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,13),p(o.frame,e)}case"stats":return p(o.stats,w(JSON.stringify(t.stats)));case"pong":case"ping":{let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,t.token),p(t.type==="ping"?o.ping:o.pong,e)}case"serverClipboard":return p(o.serverClipboard,w(t.text));case"clientClipboard":return p(o.clientClipboard,w(t.text));case"error":return p(o.error,w(t.code));case"pointer":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint16(0,_(t.x,"x")),n.setUint16(2,_(t.y,"y")),n.setUint8(4,t.buttons&255),p(o.pointer,e)}case"key":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint8(0,t.down?1:0),n.setUint32(1,t.keysym>>>0),p(o.key,e)}case"config":return p(o.config,Uint8Array.of(ut.indexOf(t.preset)));case"keyframeRequest":return p(o.keyframeRequest,new Uint8Array(0));case"audioHello":{let e=w(t.codec),n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,t.sampleRate>>>0),i.setUint8(4,t.channels&255),n.set(e,5),p(o.audioHello,n)}case"audio":{let e=new Uint8Array(8+t.data.byteLength);return new DataView(e.buffer).setBigUint64(0,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,8),p(o.audio,e)}case"control":return p(o.control,w(JSON.stringify(t.control)));case"windows":{let e=t.bounds.slice(0,D),n=new Uint8Array(e.length*16),i=new DataView(n.buffer);return e.forEach((s,a)=>{[s.x,s.y,s.width,s.height].forEach((c,d)=>i.setInt32(a*16+d*4,ee(c)))}),p(o.windows,n)}case"audioEnable":return p(o.audioEnable,Uint8Array.of(t.on?1:0));case"resize":{let e=new Uint8Array(4),n=new DataView(e.buffer);return n.setUint16(0,_(t.width,"width")),n.setUint16(2,_(t.height,"height")),p(o.resize,e)}case"ack":{let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t.seq>>>0),p(o.ack,e)}}}function M(t){let e=ut[t];if(!e)throw new l("invalid_preset");return e}function y(t,e){if(t.byteLength!==e)throw new l("invalid_length")}function x(t){if(t.byteLength>S)throw new l("text_too_large");try{return Q.decode(t)}catch{throw new l("invalid_text")}}function te(t){let e;try{e=JSON.parse(x(t))}catch{throw new l("invalid_stats")}let n=e;if(!n||typeof n!=="object"||["fps","kbps","dropped","restarts","queued_bytes"].some((s)=>typeof n[s]!=="number"||!Number.isFinite(n[s])))throw new l("invalid_stats");return{fps:n.fps,kbps:n.kbps,dropped:n.dropped,restarts:n.restarts,queued_bytes:n.queued_bytes}}function ne(t){let e;try{e=JSON.parse(x(t))}catch{throw new l("invalid_control")}let n=e;if(!n||typeof n!=="object"||typeof n.you!=="boolean"||typeof n.same_user!=="boolean")throw new l("invalid_control");let i=n.holder===null?null:Mn(n.holder);if(i===null&&n.holder!==null)throw new l("invalid_control");return{holder:i,you:n.you,same_user:n.same_user}}function re(t,e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(t){case o.hello:if(e.byteLength<6)throw new l("invalid_length");return{type:"hello",width:n.getUint16(0),height:n.getUint16(2),fps:n.getUint8(4),preset:M(n.getUint8(5)),codec:x(e.subarray(6))};case o.frame:if(e.byteLength<14)throw new l("invalid_length");if(n.getUint8(0)>1)throw new l("invalid_frame_flags");return{type:"frame",key:n.getUint8(0)===1,seq:n.getUint32(1),captureMicros:Number(n.getBigUint64(5)),data:e.subarray(13)};case o.stats:return{type:"stats",stats:te(e)};case o.ping:case o.pong:return y(e,8),{type:t===o.ping?"ping":"pong",token:n.getFloat64(0)};case o.serverClipboard:return{type:"serverClipboard",text:x(e)};case o.clientClipboard:return{type:"clientClipboard",text:x(e)};case o.error:return{type:"error",code:x(e)};case o.pointer:return y(e,5),{type:"pointer",x:n.getUint16(0),y:n.getUint16(2),buttons:n.getUint8(4)};case o.key:if(y(e,5),n.getUint8(0)>1)throw new l("invalid_key_flags");return{type:"key",down:n.getUint8(0)===1,keysym:n.getUint32(1)};case o.config:return y(e,1),{type:"config",preset:M(n.getUint8(0))};case o.keyframeRequest:return y(e,0),{type:"keyframeRequest"};case o.audioHello:if(e.byteLength<5)throw new l("invalid_length");return{type:"audioHello",sampleRate:n.getUint32(0),channels:n.getUint8(4),codec:x(e.subarray(5))};case o.audio:if(e.byteLength<9)throw new l("invalid_length");return{type:"audio",captureMicros:Number(n.getBigUint64(0)),data:e.subarray(8)};case o.audioEnable:if(y(e,1),n.getUint8(0)>1)throw new l("invalid_audio_flags");return{type:"audioEnable",on:n.getUint8(0)===1};case o.resize:return y(e,4),{type:"resize",width:n.getUint16(0),height:n.getUint16(2)};case o.control:return{type:"control",control:ne(e)};case o.windows:{if(e.byteLength%16!==0||e.byteLength>D*16)throw new l("invalid_length");let i=[];for(let s=0;s<e.byteLength;s+=16)i.push({x:n.getInt32(s),y:n.getInt32(s+4),width:n.getInt32(s+8),height:n.getInt32(s+12)});return{type:"windows",bounds:i}}case o.ack:return y(e,4),{type:"ack",seq:n.getUint32(0)};default:return null}}class $n{buffer=new Uint8Array(0);push(t){let e=new Uint8Array(this.buffer.byteLength+t.byteLength);e.set(this.buffer),e.set(t,this.buffer.byteLength);let n=[],i=0;while(e.byteLength-i>=4){let s=new DataView(e.buffer,e.byteOffset+i,4).getUint32(0);if(s<1||s>L)throw new l("invalid_message_length");if(e.byteLength-i-4<s)break;let a=e[i+4],c=e.slice(i+5,i+4+s),d=re(a,c);if(d)n.push(d);i+=4+s}return this.buffer=e.slice(i),n}}var Y="/usr/bin/osascript",se=5000,oe=1048576,ae=String.raw`
3
- ObjC.import("CoreGraphics");
4
- ObjC.import("ApplicationServices");
5
- ObjC.import("AppKit");
6
- ObjC.bindFunction("CGPreflightScreenCaptureAccess", ["bool", []]);
7
- ObjC.bindFunction("CGRequestScreenCaptureAccess", ["bool", []]);
8
- ObjC.bindFunction("getppid", ["int", []]);
9
- function run(argv) {
10
- const bounds = $.CGDisplayBounds($.CGMainDisplayID());
11
- const stdout = $.NSFileHandle.fileHandleWithStandardOutput;
12
- const screen = $.CGPreflightScreenCaptureAccess(), accessibility = $.AXIsProcessTrusted();
13
- stdout.writeData($(JSON.stringify({ screen, accessibility,
14
- width: bounds.size.width, height: bounds.size.height }) + "\n").dataUsingEncoding($.NSUTF8StringEncoding));
15
- if (argv[0] === "request") {
16
- if (!screen && argv[1] !== "accessibility") $.CGRequestScreenCaptureAccess();
17
- if (!accessibility && argv[1] !== "screen") $.AXIsProcessTrustedWithOptions($({ AXTrustedCheckOptionPrompt: true }));
18
- }
19
- if (argv[0] === "probe" || argv[0] === "request") return;
20
- if (argv[0] === "clipboard") {
21
- const parent = $.getppid(), clipboard = $.NSPasteboard.generalPasteboard;
22
- // Only changes made during this pairing: never export the initial pasteboard.
23
- let last = Number(clipboard.changeCount);
24
- while ($.getppid() === parent) {
25
- $.NSThread.sleepForTimeInterval(0.1);
26
- const count = Number(clipboard.changeCount);
27
- if (count === last) continue;
28
- last = count;
29
- const text = clipboard.stringForType($.NSPasteboardTypeString);
30
- if (!text) continue;
31
- const bytes = text.dataUsingEncoding($.NSUTF8StringEncoding);
32
- if (Number(bytes.length) > ${S}) continue;
33
- stdout.writeData($("c " + bytes.base64EncodedStringWithOptions(0).js + "\n").dataUsingEncoding($.NSUTF8StringEncoding));
34
- }
35
- return;
36
- }
37
- const stdin = $.NSFileHandle.fileHandleWithStandardInput;
38
- let pending = "";
39
- for (;;) {
40
- const data = stdin.availableData;
41
- if (Number(data.length) === 0) return;
42
- pending += $.NSString.alloc.initWithDataEncoding(data, $.NSUTF8StringEncoding).js;
43
- for (let end = pending.indexOf("\n"); end >= 0; end = pending.indexOf("\n")) {
44
- const [kind, ...rest] = pending.slice(0, end).split(" ");
45
- pending = pending.slice(end + 1);
46
- const n = rest.map(Number);
47
- let event = null;
48
- if (kind === "m") {
49
- event = $.CGEventCreateMouseEvent($(), n[0], { x: n[1], y: n[2] }, n[3]);
50
- $.CGEventSetIntegerValueField(event, $.kCGMouseEventClickState, n[4]);
51
- } else if (kind === "w") {
52
- event = $.CGEventCreateScrollWheelEvent($(), $.kCGScrollEventUnitPixel, 2, n[0], n[1]);
53
- } else if (kind === "k") {
54
- event = $.CGEventCreateKeyboardEvent($(), n[0], n[1] === 1);
55
- } else if (kind === "u") {
56
- event = $.CGEventCreateKeyboardEvent($(), 0, n[0] === 1);
57
- const unit = Ref("unsigned short");
58
- unit[0] = n[1];
59
- $.CGEventKeyboardSetUnicodeString(event, 1, unit);
60
- } else if (kind === "c") {
61
- const bytes = $.NSData.alloc.initWithBase64EncodedStringOptions($(rest[0] || ""), 0);
62
- $.NSPasteboard.generalPasteboard.clearContents;
63
- $.NSPasteboard.generalPasteboard.setStringForType($.NSString.alloc.initWithDataEncoding(bytes, $.NSUTF8StringEncoding), $.NSPasteboardTypeString);
64
- }
65
- if (event) {
66
- $.CGEventSetFlags(event, n[n.length - 1]);
67
- $.CGEventPost($.kCGHIDEventTap, event);
68
- }
69
- }
70
- }
71
- }
72
- `;function q(t){let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!=="object")return null;let n=e,i=(c)=>typeof c==="number"&&Number.isFinite(c)?Math.min(65535,Math.round(c)):0;if(typeof n.screen!=="boolean"||typeof n.accessibility!=="boolean")return null;let s=i(n.width),a=i(n.height);return s>0&&a>0?{screen:n.screen,accessibility:n.accessibility,width:s,height:a}:null}function k(t,...e){let[n,...i]=[...t,Y,"-l","JavaScript","-e",ae,...e];return[n,i]}function H(t,...e){return new Promise((n)=>{ie(...k(t,...e),{env:{},timeout:se,killSignal:"SIGKILL",maxBuffer:65536,encoding:"utf8"},(i,s)=>n(i?null:q(s.split(`
73
- `)[0]??"")))})}function Ge(t=[]){return H(t,"probe")}function dt(t,e){return H(t,"request",...e?[e]:[])}var N=2,ce=8,ue=String.raw`
74
- ObjC.import("CoreGraphics");
75
- ObjC.import("Foundation");
76
- ObjC.bindFunction("getppid", ["int", []]);
77
- function run() {
78
- const stdout = $.NSFileHandle.fileHandleWithStandardOutput;
79
- const parent = $.getppid();
80
- let last = "";
81
- let wait = ${N};
82
- // Ends with the worker that started it, even one that never got to kill it.
83
- while ($.getppid() === parent) {
84
- const list = ObjC.castRefToObject($.CGWindowListCopyWindowInfo($.kCGWindowListOptionOnScreenOnly | $.kCGWindowListExcludeDesktopElements, 0));
85
- const bounds = [];
86
- const count = Number(list.count);
87
- for (let i = 0; i < count && bounds.length < ${D}; i++) {
88
- const window = list.objectAtIndex(i);
89
- if (Number(window.objectForKey("kCGWindowLayer").js) !== 0) continue;
90
- const b = window.objectForKey("kCGWindowBounds");
91
- bounds.push(["X", "Y", "Width", "Height"].map((key) => Math.round(Number(b.objectForKey(key).js))));
92
- }
93
- const line = JSON.stringify(bounds);
94
- if (line !== last) {
95
- last = line;
96
- wait = ${N};
97
- stdout.writeData($(line + "\n").dataUsingEncoding($.NSUTF8StringEncoding));
98
- } else {
99
- wait = Math.min(wait * 2, ${ce});
100
- }
101
- $.NSThread.sleepForTimeInterval(wait);
102
- }
103
- }
104
- `;function le(t){let e;try{e=JSON.parse(t)}catch{return null}if(!Array.isArray(e))return null;let n=[];for(let i of e.slice(0,D)){if(!Array.isArray(i)||i.length!==4||!i.every((u)=>typeof u==="number"&&Number.isFinite(u)))return null;let[s,a,c,d]=i.map(Math.round);if(c>0&&d>0)n.push({x:s,y:a,width:c,height:d})}return n}function Bn(t){let e=Date.now(),n=0,i=!1,s=(u,b={})=>{try{process.stderr.write(`${JSON.stringify({event:"display.windows_helper",state:u,...b})}
105
- `)}catch{}},a=(u,b={})=>{if(i)return;i=!0,s(u,{updates:n,duration_ms:Date.now()-e,...b})},c=E(Y,["-l","JavaScript","-e",ue],{env:{},stdio:["ignore","pipe","ignore"]});s("started");let d="";return c.stdout.on("data",(u)=>{if(i)return;d+=u.toString("utf8");for(let b=d.indexOf(`
106
- `);b>=0;b=d.indexOf(`
107
- `)){let m=le(d.slice(0,b));if(d=d.slice(b+1),m)n++,t(m)}if(d.length>65536)d=""}),c.once("error",(u)=>a("failed",{code:u.code??"spawn_failed"})),c.once("exit",(u,b)=>a("failed",{code:"exited",exit_code:u,signal:b})),{close(){a("stopped"),c.kill("SIGKILL")}}}var T=5,R=[{bit:1,button:0,down:1,up:2,drag:6},{bit:4,button:1,down:3,up:4,drag:7},{bit:2,button:2,down:25,up:26,drag:27}],de=[[8,1,0],[16,-1,0],[32,0,1],[64,0,-1]],P=50,fe=500,V=4,I=131072,W=262144,O=524288,F=1048576,B=new Map([[65505,[56,I]],[65506,[60,I]],[65507,[59,W]],[65508,[62,W]],[65511,[58,O]],[65512,[61,O]],[65513,[58,O]],[65514,[61,O]],[65027,[61,O]],[65515,[55,F]],[65516,[54,F]]]),pe=new Map([[65288,51],[65289,48],[65056,48],[65293,36],[65307,53],[65535,117],[65509,57],[65360,115],[65361,123],[65362,126],[65363,124],[65364,125],[65365,116],[65366,121],[65367,119],[65379,114],[65386,114],[65291,71],[65408,49],[65421,76],[65429,115],[65430,123],[65431,126],[65432,124],[65433,125],[65434,116],[65435,121],[65436,119],[65437,71],[65438,114],[65439,117],[65450,67],[65451,69],[65452,65],[65453,78],[65454,65],[65455,75],[65469,81],...[82,83,84,85,86,87,88,89,91,92].map((t,e)=>[65456+e,t]),...[122,120,99,118,96,97,98,100,101,109,103,111,105,107,113,106,64,79,80,90].map((t,e)=>[65470+e,t])]),G="asdfhgzxcv\x00bqweryt123465=97-80]ou[ip\x00lj'k;\\,/nm.\x00 `",j='~!@#$%^&*()_+{}|:"<>?',be="`1234567890-=[]\\;',./",v=new Map;for(let t=0;t<G.length;t++){let e=G[t];if(e==="\x00")continue;if(v.set(e.charCodeAt(0),[t,!1]),e>="a"&&e<="z")v.set(e.toUpperCase().charCodeAt(0),[t,!0])}for(let t=0;t<j.length;t++)v.set(j.charCodeAt(t),[v.get(be.charCodeAt(t))[0],!0]);class K{now;x=-1;y=-1;mask=0;clicks=0;lastDown=null;held=new Set;constructor(t=()=>performance.now()){this.now=t}flags(){let t=0;for(let e of this.held)t|=B.get(e)[1];return t}mouse(t,e){return`m ${t} ${this.x} ${this.y} ${e} ${t===T?0:this.clicks} ${this.flags()}`}pointer(t,e,n){let i=[];if(t!==this.x||e!==this.y){this.x=t,this.y=e;let s=R.find((a)=>this.mask&a.bit);i.push(s?this.mouse(s.drag,s.button):this.mouse(T,0))}for(let s of R){let a=(this.mask&s.bit)!==0,c=(n&s.bit)!==0;if(!a&&c){let d=this.now(),u=this.lastDown;this.clicks=u&&u.button===s.button&&d-u.at<=fe&&Math.abs(t-u.x)<=V&&Math.abs(e-u.y)<=V?this.clicks+1:1,this.lastDown={button:s.button,at:d,x:t,y:e},i.push(this.mouse(s.down,s.button))}else if(a&&!c)i.push(this.mouse(s.up,s.button))}for(let[s,a,c]of de)if(!(this.mask&s)&&n&s)i.push(`w ${a*P} ${c*P} ${this.flags()}`);return this.mask=n,i}key(t,e){let n=t?1:0,i=B.get(e);if(i){if(t)this.held.add(e);else this.held.delete(e);return[`k ${i[0]} ${n} ${this.flags()}`]}let s=pe.get(e);if(s!==void 0)return[`k ${s} ${n} ${this.flags()}`];let a=e<256?e:(e&4278190080)===16777216?e&16777215:0,c=v.get(a);if(c)return[`k ${c[0]} ${n} ${this.flags()|(c[1]?I:0)}`];if(a<160||a>65535||a>=55296&&a<57344)return[];return[`u ${n} ${a} ${this.flags()}`]}}function Fn(t,e=[]){let n=E(...k(e),{env:{},stdio:["pipe","pipe","ignore"]}),i=new K,s="",a=!1,c=null,d=()=>{n.kill("SIGKILL"),c?.kill("SIGKILL")},u=(f)=>{if(a)return;a=!0,d(),t.end(f)},b=(f)=>u({error:new r("display_unavailable",f)}),m=(f)=>{if(a||f.length===0)return;if(n.stdin.write(f.map((g)=>`${g}
108
- `).join("")),n.stdin.writableLength>oe)u({reason:"input_backpressure"})},z=()=>{c=E(...k(e,"clipboard"),{env:{},stdio:["ignore","pipe","ignore"]});let f="";c.stdout?.on("data",(g)=>{if(a)return;f+=g.toString("ascii");for(let h=f.indexOf(`
109
- `);h>=0;h=f.indexOf(`
110
- `)){let U=f.slice(0,h);if(f=f.slice(h+1),!U.startsWith("c "))continue;let A=U.slice(2);if(A.length>Math.ceil(S/3)*4||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(A)){u({reason:"display_protocol"});return}let C=Buffer.from(A,"base64");if(C.byteLength<=S)t.clipboard(C.toString("utf8"));if(a)return}if(f.length>Math.ceil(S/3)*4+2)u({reason:"display_protocol"})}),c.once("error",()=>b("Reason could not watch this Mac's desktop clipboard.")),c.once("exit",()=>{if(!a)b("Reason could not watch this Mac's desktop clipboard.")})};return n.stdout.on("data",(f)=>{if(a||s===null)return;s+=f.toString("utf8");let g=s.indexOf(`
111
- `);if(g<0){if(s.length>4096)u({reason:"display_protocol"});return}let h=q(s.slice(0,g));if(s=null,!h)u({reason:"display_protocol"});else if(!h.screen||!h.accessibility)b(e.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 z(),t.ready({width:h.width,height:h.height})}),n.stdin.on("error",()=>{return}),n.once("error",()=>b("Reason could not start this Mac's desktop input.")),n.once("exit",()=>{if(s!==null)b("Reason could not start this Mac's desktop input.");else u({reason:"display_closed"})}),{pointer:(f,g,h)=>m(i.pointer(f,g,h)),key:(f,g)=>m(i.key(f,g)),clipboard:(f)=>m([`c ${Buffer.from(f,"utf8").toString("base64")}`]),close(){a=!0,d()}}}
112
- export{go,_o,ut,yo,S,wo,bo,Mn,vo,So,Eo,zt,$n,Ge,dt,Bn,Fn};