@reason-machines/cli-linux-x64 0.2.415 → 0.2.419

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 (153) 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-s4897qxy.js +2 -0
  5. package/bin/vm-hands/api-m73x3da5.js +2 -0
  6. package/bin/vm-hands/ask-relay-4kwcx2b7.js +8 -0
  7. package/bin/vm-hands/connect-cli-34b18gjs.js +2 -0
  8. package/bin/vm-hands/custom-endpoint-device-j012b4bd.js +2 -0
  9. package/bin/vm-hands/desktop-account-0q0arpzk.js +2 -0
  10. package/bin/vm-hands/device-workspace-3jxhs54b.js +2 -0
  11. package/bin/vm-hands/hands-worker-source-y64axsw3.js +2 -0
  12. package/bin/vm-hands/index-194s4vz0.js +12818 -0
  13. package/bin/vm-hands/install-receipt-1g68b446.js +2 -0
  14. package/bin/vm-hands/local-automation-k2w46hn2.js +2 -0
  15. package/bin/vm-hands/local-capabilities-tdzbqmrb.js +2 -0
  16. package/bin/vm-hands/local-desktop-users-6thzvydd.js +2 -0
  17. package/bin/vm-hands/local-display-mac-59ma7sxa.js +2 -0
  18. package/bin/vm-hands/local-display-session-4833qq7h.js +2 -0
  19. package/bin/vm-hands/local-display-video-c1143mz6.js +2 -0
  20. package/bin/vm-hands/local-managed-process-mr0zpk7c.js +2 -0
  21. package/bin/vm-hands/local-pty-session-bwarwpsd.js +2 -0
  22. package/bin/vm-hands/managed-runtime-vz1wqwwg.js +2 -0
  23. package/bin/vm-hands/network-contract-gprc37sw.js +2 -0
  24. package/bin/vm-hands/package-ej9snd47.js +2 -0
  25. package/bin/vm-hands/permissions-7sfghef4.js +2 -0
  26. package/bin/vm-hands/reason-hands-protocol-jsrkawe2.js +2 -0
  27. package/bin/vm-hands/serve-service-kngyzh74.js +2 -0
  28. package/bin/vm-hands/status-jz29fb95.js +96 -0
  29. package/bin/vm-hands/version-g29vt13t.js +2 -0
  30. package/bin/vm-hands/vm-hands-entry-lite-0h4qmgm2.js +9 -0
  31. package/bin/vm-hands/vm-hands-entry-lite-0k13wmzm.js +3 -0
  32. package/bin/vm-hands/vm-hands-entry-lite-1exfjv79.js +52 -0
  33. package/bin/vm-hands/vm-hands-entry-lite-26q3hbdc.js +3 -0
  34. package/bin/vm-hands/vm-hands-entry-lite-28s7v15d.js +4 -0
  35. package/bin/vm-hands/vm-hands-entry-lite-2m5dwrdf.js +6 -0
  36. package/bin/vm-hands/vm-hands-entry-lite-37hvds7z.js +5 -0
  37. package/bin/vm-hands/vm-hands-entry-lite-3rqdzqhk.js +112 -0
  38. package/bin/vm-hands/vm-hands-entry-lite-4gh5kfr4.js +3 -0
  39. package/bin/vm-hands/{vm-hands-entry-lite-t7an5zg2.js → vm-hands-entry-lite-4k4h9rcq.js} +2 -2
  40. package/bin/vm-hands/vm-hands-entry-lite-6nwbqg37.js +3 -0
  41. package/bin/vm-hands/{vm-hands-entry-lite-m11j0f9q.js → vm-hands-entry-lite-6y6pz2yw.js} +2 -2
  42. package/bin/vm-hands/vm-hands-entry-lite-714wspqb.js +3 -0
  43. package/bin/vm-hands/vm-hands-entry-lite-7zk0r3p9.js +5 -0
  44. package/bin/vm-hands/vm-hands-entry-lite-9qep7pka.js +4 -0
  45. package/bin/vm-hands/{vm-hands-entry-lite-bdhjpv7g.js → vm-hands-entry-lite-agsp101y.js} +2 -2
  46. package/bin/vm-hands/vm-hands-entry-lite-am6kj1n1.js +3 -0
  47. package/bin/vm-hands/vm-hands-entry-lite-as1tkffn.js +5 -0
  48. package/bin/vm-hands/vm-hands-entry-lite-bxt4n1nj.js +3 -0
  49. package/bin/vm-hands/vm-hands-entry-lite-c2g3wmkp.js +3 -0
  50. package/bin/vm-hands/vm-hands-entry-lite-d2w8tghq.js +3 -0
  51. package/bin/vm-hands/vm-hands-entry-lite-d98m00b8.js +3 -0
  52. package/bin/vm-hands/vm-hands-entry-lite-daxcxjze.js +344 -0
  53. package/bin/vm-hands/vm-hands-entry-lite-dcnyve97.js +3 -0
  54. package/bin/vm-hands/vm-hands-entry-lite-e1b89x66.js +3 -0
  55. package/bin/vm-hands/vm-hands-entry-lite-ej5ffjck.js +105 -0
  56. package/bin/vm-hands/vm-hands-entry-lite-ejkba2nk.js +3 -0
  57. package/bin/vm-hands/vm-hands-entry-lite-f3wh0dza.js +5 -0
  58. package/bin/vm-hands/vm-hands-entry-lite-f5xb489y.js +4 -0
  59. package/bin/vm-hands/vm-hands-entry-lite-feybcq63.js +3 -0
  60. package/bin/vm-hands/vm-hands-entry-lite-fpp2bs9y.js +452 -0
  61. package/bin/vm-hands/{vm-hands-entry-lite-qxchbbew.js → vm-hands-entry-lite-fzkfajew.js} +9 -5
  62. package/bin/vm-hands/vm-hands-entry-lite-gt497d5x.js +3 -0
  63. package/bin/vm-hands/vm-hands-entry-lite-gxper06w.js +3 -0
  64. package/bin/vm-hands/vm-hands-entry-lite-j2ng164q.js +9 -0
  65. package/bin/vm-hands/vm-hands-entry-lite-jp9q2vsx.js +127 -0
  66. package/bin/vm-hands/vm-hands-entry-lite-magmzx9c.js +3 -0
  67. package/bin/vm-hands/vm-hands-entry-lite-ntx8fdyq.js +5 -0
  68. package/bin/vm-hands/vm-hands-entry-lite-pfzczmaa.js +4 -0
  69. package/bin/vm-hands/vm-hands-entry-lite-pkc4ry5x.js +539 -0
  70. package/bin/vm-hands/vm-hands-entry-lite-pp7jfqzr.js +3 -0
  71. package/bin/vm-hands/vm-hands-entry-lite-q8wkrzer.js +66 -0
  72. package/bin/vm-hands/vm-hands-entry-lite-s823n1q9.js +3 -0
  73. package/bin/vm-hands/vm-hands-entry-lite-s9xf5z69.js +7 -0
  74. package/bin/vm-hands/vm-hands-entry-lite-tchc7z17.js +128 -0
  75. package/bin/vm-hands/vm-hands-entry-lite-tytfs183.js +42 -0
  76. package/bin/vm-hands/vm-hands-entry-lite-v4jtxgaj.js +4 -0
  77. package/bin/vm-hands/vm-hands-entry-lite-vgpt2n1v.js +11 -0
  78. package/bin/vm-hands/{vm-hands-entry-lite-9c95p6n9.js → vm-hands-entry-lite-vsa7t6m9.js} +54 -54
  79. package/bin/vm-hands/vm-hands-entry-lite-xp3qzxk5.js +3 -0
  80. package/bin/vm-hands/vm-hands-entry-lite.js +1 -3
  81. package/bin/vm-hands/vm-hands-executor-epyhpjv3.js +11 -0
  82. package/bin/vm-hands/vm-hands-op-runner-fn1qph82.js +2 -0
  83. package/bin/vm-hands/vm-hands-runtime-8vt9etvv.js +4 -0
  84. package/bin/vm-hands/worker-preview-readiness-yfjgban2.js +2 -0
  85. package/bin/vm-hands/worker-sandbox-z0t69av8.js +2 -0
  86. package/package.json +1 -1
  87. package/bin/vm-hands/api-cjv8m2zy.js +0 -2
  88. package/bin/vm-hands/api-credentials-m5akr9fv.js +0 -2
  89. package/bin/vm-hands/connect-cli-d60gmgnx.js +0 -2
  90. package/bin/vm-hands/custom-endpoint-device-dkqb4rqy.js +0 -2
  91. package/bin/vm-hands/desktop-account-5v7x0ajx.js +0 -2
  92. package/bin/vm-hands/device-workspace-p9q9dckg.js +0 -2
  93. package/bin/vm-hands/fsevents-ekt70rcc.js +0 -2
  94. package/bin/vm-hands/hands-worker-source-cgrpm21b.js +0 -2
  95. package/bin/vm-hands/index-k8kcz8a3.js +0 -12818
  96. package/bin/vm-hands/install-receipt-7vt2y2vh.js +0 -2
  97. package/bin/vm-hands/local-automation-4htjhv65.js +0 -2
  98. package/bin/vm-hands/local-capabilities-c04tbapa.js +0 -2
  99. package/bin/vm-hands/local-desktop-users-q886k0mm.js +0 -2
  100. package/bin/vm-hands/local-display-mac-w85956f1.js +0 -2
  101. package/bin/vm-hands/local-display-session-pkz7a5q9.js +0 -2
  102. package/bin/vm-hands/local-pty-session-5f50sqq0.js +0 -2
  103. package/bin/vm-hands/managed-runtime-ppypxbh9.js +0 -2
  104. package/bin/vm-hands/network-contract-9x9kc5vv.js +0 -2
  105. package/bin/vm-hands/package-78fkast4.js +0 -2
  106. package/bin/vm-hands/permissions-xt02c6dh.js +0 -2
  107. package/bin/vm-hands/reason-hands-protocol-2tnghj3b.js +0 -2
  108. package/bin/vm-hands/serve-service-wanptaqv.js +0 -2
  109. package/bin/vm-hands/status-gt7c4ke0.js +0 -10
  110. package/bin/vm-hands/version-bq5j7cqg.js +0 -2
  111. package/bin/vm-hands/vm-hands-entry-lite-09m2cdkw.js +0 -4
  112. package/bin/vm-hands/vm-hands-entry-lite-0xrsph3r.js +0 -3
  113. package/bin/vm-hands/vm-hands-entry-lite-1cwqa4jr.js +0 -3
  114. package/bin/vm-hands/vm-hands-entry-lite-1rrb66r9.js +0 -3
  115. package/bin/vm-hands/vm-hands-entry-lite-1rtkf2xm.js +0 -3
  116. package/bin/vm-hands/vm-hands-entry-lite-22kfyvnk.js +0 -2
  117. package/bin/vm-hands/vm-hands-entry-lite-2hvbgp1n.js +0 -9
  118. package/bin/vm-hands/vm-hands-entry-lite-2wgdvb15.js +0 -14
  119. package/bin/vm-hands/vm-hands-entry-lite-2wvsyggd.js +0 -540
  120. package/bin/vm-hands/vm-hands-entry-lite-463m6ejk.js +0 -458
  121. package/bin/vm-hands/vm-hands-entry-lite-6aeea05q.js +0 -3
  122. package/bin/vm-hands/vm-hands-entry-lite-88swf2qr.js +0 -6
  123. package/bin/vm-hands/vm-hands-entry-lite-89z488gz.js +0 -3
  124. package/bin/vm-hands/vm-hands-entry-lite-8ns59paz.js +0 -3
  125. package/bin/vm-hands/vm-hands-entry-lite-8t9xssf9.js +0 -3
  126. package/bin/vm-hands/vm-hands-entry-lite-907pa7f9.js +0 -65
  127. package/bin/vm-hands/vm-hands-entry-lite-9ay6f56v.js +0 -3
  128. package/bin/vm-hands/vm-hands-entry-lite-ab2m9erf.js +0 -2
  129. package/bin/vm-hands/vm-hands-entry-lite-b885gwfh.js +0 -7
  130. package/bin/vm-hands/vm-hands-entry-lite-cc2tgsqp.js +0 -105
  131. package/bin/vm-hands/vm-hands-entry-lite-ckv17tn8.js +0 -3
  132. package/bin/vm-hands/vm-hands-entry-lite-eqgj4acy.js +0 -112
  133. package/bin/vm-hands/vm-hands-entry-lite-ewwx4fr3.js +0 -250
  134. package/bin/vm-hands/vm-hands-entry-lite-f5e3dbgk.js +0 -4
  135. package/bin/vm-hands/vm-hands-entry-lite-grtycq6y.js +0 -52
  136. package/bin/vm-hands/vm-hands-entry-lite-gvwdy3rf.js +0 -4
  137. package/bin/vm-hands/vm-hands-entry-lite-hj8n59y9.js +0 -3
  138. package/bin/vm-hands/vm-hands-entry-lite-k278g9kj.js +0 -42
  139. package/bin/vm-hands/vm-hands-entry-lite-kq0qmsw8.js +0 -5
  140. package/bin/vm-hands/vm-hands-entry-lite-pgb514h0.js +0 -3
  141. package/bin/vm-hands/vm-hands-entry-lite-pmcz7j7t.js +0 -3
  142. package/bin/vm-hands/vm-hands-entry-lite-q0k6kx6d.js +0 -5
  143. package/bin/vm-hands/vm-hands-entry-lite-qq9w7wq6.js +0 -3
  144. package/bin/vm-hands/vm-hands-entry-lite-qy9xg6em.js +0 -3
  145. package/bin/vm-hands/vm-hands-entry-lite-qysyf65v.js +0 -2
  146. package/bin/vm-hands/vm-hands-entry-lite-rwxbhwky.js +0 -2
  147. package/bin/vm-hands/vm-hands-entry-lite-txn44020.js +0 -3
  148. package/bin/vm-hands/vm-hands-entry-lite-vrqzr15t.js +0 -3
  149. package/bin/vm-hands/vm-hands-entry-lite-zg36myyf.js +0 -5
  150. package/bin/vm-hands/vm-hands-executor-7k9z9988.js +0 -11
  151. package/bin/vm-hands/vm-hands-op-runner-n8p81rwm.js +0 -2
  152. package/bin/vm-hands/vm-hands-runtime-bqsz7h0h.js +0 -4
  153. package/bin/vm-hands/worker-sandbox-smqj3mbe.js +0 -2
@@ -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 Yi="h264_ws_v1",Qi="video",ot=["smooth","sharp","data_saver","balanced"];var eo="video_presets";var L=8388608,v=65536,to="control",ro="v1",J=200;function On(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t,n=(i)=>typeof i==="string"&&i.length>0&&i.length<=J;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 no="windows",io="v1",m=200,z=(t)=>typeof t==="string"&&ot.includes(t);function oo(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"||!z(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};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 y(t){let e=Z.encode(t);if(e.byteLength>v)throw new l("text_too_large");return e}function O(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 Fr(t){switch(t.type){case"hello":{let e=y(t.codec),n=new Uint8Array(6+e.byteLength),i=new DataView(n.buffer);return i.setUint16(0,O(t.width,"width")),i.setUint16(2,O(t.height,"height")),i.setUint8(4,Math.max(1,Math.min(240,Math.round(t.fps)))),i.setUint8(5,ot.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,y(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,y(t.text));case"clientClipboard":return p(o.clientClipboard,y(t.text));case"error":return p(o.error,y(t.code));case"pointer":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint16(0,O(t.x,"x")),n.setUint16(2,O(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(ot.indexOf(t.preset)));case"keyframeRequest":return p(o.keyframeRequest,new Uint8Array(0));case"audioHello":{let e=y(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,y(JSON.stringify(t.control)));case"windows":{let e=t.bounds.slice(0,m),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"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=ot[t];if(!e)throw new l("invalid_preset");return e}function w(t,e){if(t.byteLength!==e)throw new l("invalid_length")}function S(t){if(t.byteLength>v)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(S(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(S(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:On(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:S(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 w(e,8),{type:t===o.ping?"ping":"pong",token:n.getFloat64(0)};case o.serverClipboard:return{type:"serverClipboard",text:S(e)};case o.clientClipboard:return{type:"clientClipboard",text:S(e)};case o.error:return{type:"error",code:S(e)};case o.pointer:return w(e,5),{type:"pointer",x:n.getUint16(0),y:n.getUint16(2),buttons:n.getUint8(4)};case o.key:if(w(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 w(e,1),{type:"config",preset:M(n.getUint8(0))};case o.keyframeRequest:return w(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:S(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(w(e,1),n.getUint8(0)>1)throw new l("invalid_audio_flags");return{type:"audioEnable",on:n.getUint8(0)===1};case o.control:return{type:"control",control:ne(e)};case o.windows:{if(e.byteLength%16!==0||e.byteLength>m*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 w(e,4),{type:"ack",seq:n.getUint32(0)};default:return null}}class In{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) > ${v}) 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 ze(t=[]){return H(t,"probe")}function st(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 < ${m}; 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,m)){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 Dn(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 x=le(d.slice(0,b));if(d=d.slice(b+1),x)n++,t(x)}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,_=524288,F=1048576,B=new Map([[65505,[56,I]],[65506,[60,I]],[65507,[59,W]],[65508,[62,W]],[65511,[58,_]],[65512,[61,_]],[65513,[58,_]],[65514,[61,_]],[65027,[61,_]],[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-=[]\\;',./",D=new Map;for(let t=0;t<G.length;t++){let e=G[t];if(e==="\x00")continue;if(D.set(e.charCodeAt(0),[t,!1]),e>="a"&&e<="z")D.set(e.toUpperCase().charCodeAt(0),[t,!0])}for(let t=0;t<j.length;t++)D.set(j.charCodeAt(t),[D.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=D.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 Nn(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)}),x=(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"})},X=()=>{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 C=f.slice(0,h);if(f=f.slice(h+1),!C.startsWith("c "))continue;let A=C.slice(2);if(A.length>Math.ceil(v/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 U=Buffer.from(A,"base64");if(U.byteLength<=v)t.clipboard(U.toString("utf8"));if(a)return}if(f.length>Math.ceil(v/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 X(),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)=>x(i.pointer(f,g,h)),key:(f,g)=>x(i.key(f,g)),clipboard:(f)=>x([`c ${Buffer.from(f,"utf8").toString("base64")}`]),close(){a=!0,d()}}}
112
- export{Yi,Qi,ot,eo,v,to,ro,On,no,io,oo,Fr,In,ze,st,Dn,Nn};
@@ -1,250 +0,0 @@
1
- // @bun
2
- import{v,On,oo,Fr,In,ze,Dn,Nn}from"./vm-hands-entry-lite-eqgj4acy.js";import{Mn}from"./vm-hands-entry-lite-2hvbgp1n.js";import{kn}from"./vm-hands-entry-lite-f5e3dbgk.js";import{gt}from"./vm-hands-entry-lite-gvwdy3rf.js";import{vr}from"./vm-hands-entry-lite-1rtkf2xm.js";import{j}from"./vm-hands-entry-lite-q0k6kx6d.js";import{a}from"./vm-hands-entry-lite-89z488gz.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as Cs,spawn as Ar}from"child_process";import{randomBytes as Ns}from"crypto";import{chmodSync as vs,existsSync as kr,lstatSync as Ls,mkdirSync as Ms,readFileSync as Qs,rmSync as Us,writeFileSync as at}from"fs";import{connect as Os}from"net";import{join as X}from"path";var St="./desktop-wallpaper-0pjhgyfk.jpg";var _t="./dock-browser-afp005mt.png";var wt="./dock-files-rywdm96b.png";var qt="./dock-terminal-s41cj1jp.png";var Et=`# 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
- `;var oe=32,Dt=76;function Vr(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>${oe}</x><y>${oe}</y></position>
67
- <size><width>${e.width-oe*2}</width><height>${e.height-oe-Dt}</height></size>
68
- </application>
69
- </applications>
70
- </openbox_config>`}var Kr=`# 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
- `,Ir=`corner-radius = 12;
92
- rounded-corners-exclude = [
93
- "class_g = 'tint2'",
94
- "window_type = 'dock'",
95
- "window_type = 'desktop'"
96
- ];
97
- backend = "xrender";
98
- shadow = false;
99
- fading = false;
100
- vsync = false;
101
- inactive-opacity = 1.0;
102
- active-opacity = 1.0;
103
- `,Zr="/tmp/ara-dock-browser.png",Yr=`[Desktop Entry]
104
- Name=Chrome
105
- Exec=chromium --no-sandbox %U
106
- Icon=${Zr}
107
- Type=Application
108
- Categories=Network;WebBrowser;
109
- `,zr=`[Desktop Entry]
110
- Name=Terminal
111
- Exec=bash -c "DISPLAY=:99 xterm -fa DejaVuSansMono -fs 11 -bg black -fg white"
112
- Icon=/tmp/ara-dock-terminal.png
113
- Type=Application
114
- Categories=System;TerminalEmulator;
115
- `,Hr=`[Desktop Entry]
116
- Name=Files
117
- Exec=bash -c "DISPLAY=:99 pcmanfm --no-desktop"
118
- Icon=/tmp/ara-dock-files.png
119
- Type=Application
120
- Categories=System;FileManager;
121
- `;var Tt={"wallpaper.jpg":St,"dock-browser.png":_t,"dock-terminal.png":qt,"dock-files.png":wt},en=Et,tn='set_wallpaper() { if command -v feh >/dev/null 2>&1; then feh --bg-fill "$1"; else python3 "$2" "$1"; fi; }';function Rt(e){let t=(p)=>p.replaceAll("DISPLAY=:99",`DISPLAY=${e.display}`).replaceAll("/tmp/ara-",`${e.root}/ara-`),n=new Set(e.absent??[]),o=Kr.split(`
122
- `).filter((p)=>!(n.has("terminal")&&p.endsWith("/ara-terminal.desktop"))&&!(n.has("files")&&p.endsWith("/ara-files.desktop"))).join(`
123
- `);return{files:{"openbox/rc.xml":Vr(e.screen),"tint2/tint2rc":t(o),"picom/picom.conf":Ir,...n.has("terminal")?{}:{"ara-terminal.desktop":t(zr)},...n.has("files")?{}:{"ara-files.desktop":t(Hr)},"ara-chromium.desktop":t(Yr).replace("chromium --no-sandbox %U",e.browserExec),"ara-set-root-wallpaper.py":en},start:['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"; }',tn,'[ ! -f "$ROOT/ara-wallpaper.jpg" ] || set_wallpaper "$ROOT/ara-wallpaper.jpg" "$ROOT/ara-set-root-wallpaper.py" || true','if ! alive tint2 && command -v tint2 >/dev/null 2>&1; then launch tint2 tint2 -c "$ROOT/tint2/tint2rc"; fi','if ! alive picom && command -v picom >/dev/null 2>&1; then launch picom picom --config "$ROOT/picom/picom.conf"; fi']}}import{createHash as Ft}from"crypto";import{once as dn}from"events";import{createWriteStream as bn,existsSync as vo,mkdirSync as Lo,mkdtempSync as Mo,readFileSync as ye,readdirSync as Qo,renameSync as Uo,realpathSync as xn,rmSync as yn,statSync as Fe,writeFileSync as Oo}from"fs";import{delimiter as Jo,dirname as $t,join as g}from"path";import{finished as mn}from"stream/promises";var $e="omljlfpmafedpplnpkkahegadhkimdje",Fi="https://chromewebstore.google.com/detail/reason/omljlfpmafedpplnpkkahegadhkimdje";var U={ocu:{repository:"https://github.com/iFurySt/open-codex-computer-use.git",revision:"386a260d1ab8b690adbbb27f7471595cf0c2b752",version:"0.3.5"},obu:{repository:"https://github.com/iFurySt/open-browser-use.git",revision:"ac015846df75928fbcf0f3a0f3ba3a210ce1a507",version:"0.1.42"}},J={version:"155.0.8059.84",macArm64Sha256:"13b9e98ce56f5ce18e100a009f455c9285f399e7c9dc8a76fdf2f3a9755bb5f2",linux64Sha256:"cf0f049892dea22e6a6db26d47ed0d7776b7158edcbec4634086633df8bafcbc",win64Sha256:"507f2a031441d10c62b5e3d4e863f09ac1198a571c1419976cbd8387f639afde"};var ie={ocu:{url:`https://registry.npmjs.org/open-computer-use/-/open-computer-use-${U.ocu.version}.tgz`,sha256:"7c16a87c8cd357787b02c0ebd040dd5f93880c1fb51c1901caa2e0c05d063130",size_bytes:5844280},obu:{url:`https://registry.npmjs.org/open-browser-use/-/open-browser-use-${U.obu.version}.tgz`,sha256:"9386d8ce0a147b3f55e1807b68edf736836378807541c457c9b5f6ca2cabaa4e",size_bytes:21372018},extension:{url:`https://github.com/iFurySt/open-browser-use/releases/download/v${U.obu.version}/open-browser-use-chrome-extension-${U.obu.version}.zip`,sha256:"c9c07bec1175e12ea6985b0e7784a5ef01fd03f014b958224a1e17dcd838a241",size_bytes:31070}},F="pnbmoicbkopffjjgfgfglopechaiemkp";import{spawn as Me}from"child_process";import{createRequire as rn}from"module";import{join as nn}from"path";var sn=30000,on=1048576;function Ue(){return process.env.SystemRoot??"C:\\Windows"}function an(){return nn(Ue(),"System32","WindowsPowerShell","v1.0","powershell.exe")}var pn=String.raw`
124
- $ErrorActionPreference = "Stop"
125
- Add-Type -TypeDefinition @"
126
- using System;
127
- using System.Runtime.InteropServices;
128
- public static class ReasonInput {
129
- [StructLayout(LayoutKind.Sequential)] public struct MOUSEINPUT { public int dx; public int dy; public int mouseData; public uint dwFlags; public uint time; public IntPtr dwExtraInfo; }
130
- [StructLayout(LayoutKind.Sequential)] public struct KEYBDINPUT { public ushort wVk; public ushort wScan; public uint dwFlags; public uint time; public IntPtr dwExtraInfo; }
131
- [StructLayout(LayoutKind.Explicit)] public struct UNION { [FieldOffset(0)] public MOUSEINPUT mi; [FieldOffset(0)] public KEYBDINPUT ki; }
132
- [StructLayout(LayoutKind.Sequential)] public struct INPUT { public uint type; public UNION u; }
133
- [DllImport("user32.dll")] static extern uint SendInput(uint count, INPUT[] inputs, int size);
134
- [DllImport("user32.dll")] public static extern bool SetProcessDPIAware();
135
- [DllImport("user32.dll")] public static extern int GetSystemMetrics(int index);
136
- [DllImport("user32.dll")] static extern uint MapVirtualKey(uint code, uint type);
137
- [DllImport("user32.dll")] public static extern uint GetClipboardSequenceNumber();
138
- static void Send(INPUT input) { SendInput(1, new INPUT[] { input }, Marshal.SizeOf(typeof(INPUT))); }
139
- public static void Mouse(uint flags, int x, int y, int data) {
140
- INPUT input = new INPUT(); input.type = 0;
141
- input.u.mi.dx = x; input.u.mi.dy = y; input.u.mi.mouseData = data; input.u.mi.dwFlags = flags; Send(input);
142
- }
143
- public static void Key(ushort vk, ushort unit, uint flags) {
144
- INPUT input = new INPUT(); input.type = 1;
145
- input.u.ki.wVk = vk; input.u.ki.wScan = vk != 0 ? (ushort)MapVirtualKey(vk, 0) : unit; input.u.ki.dwFlags = flags; Send(input);
146
- }
147
- }
148
- "@
149
- [void][ReasonInput]::SetProcessDPIAware()
150
- $width = [ReasonInput]::GetSystemMetrics(0)
151
- $height = [ReasonInput]::GetSystemMetrics(1)
152
- $session = [Diagnostics.Process]::GetCurrentProcess().SessionId
153
- [Console]::Out.WriteLine('{"session":' + $session + ',"width":' + $width + ',"height":' + $height + '}')
154
- [Console]::Out.Flush()
155
- $mode = "__MODE__"
156
- if ($mode -eq "probe") { exit 0 }
157
- if ($mode -eq "clipboard") {
158
- # Only changes made during this pairing: never export the initial clipboard.
159
- $parent = Get-Process -Id __PARENT__
160
- $last = [ReasonInput]::GetClipboardSequenceNumber()
161
- while (-not $parent.HasExited) {
162
- Start-Sleep -Milliseconds 100
163
- $count = [ReasonInput]::GetClipboardSequenceNumber()
164
- if ($count -eq $last) { continue }
165
- $last = $count
166
- try { $text = Get-Clipboard -Raw } catch { continue }
167
- if (-not $text) { continue }
168
- $bytes = [Text.Encoding]::UTF8.GetBytes($text)
169
- if ($bytes.Length -gt __MAX_TEXT_BYTES__) { continue }
170
- [Console]::Out.WriteLine("c " + [Convert]::ToBase64String($bytes))
171
- [Console]::Out.Flush()
172
- }
173
- exit 0
174
- }
175
- $scaleX = 65535.0 / [Math]::Max(1, $width - 1)
176
- $scaleY = 65535.0 / [Math]::Max(1, $height - 1)
177
- while ($null -ne ($line = [Console]::In.ReadLine())) {
178
- $n = $line.Split(" ")
179
- try {
180
- switch ($n[0]) {
181
- "p" { [ReasonInput]::Mouse(0x8001, [int]([int]$n[1] * $scaleX), [int]([int]$n[2] * $scaleY), 0) }
182
- "b" { [ReasonInput]::Mouse([uint32]$n[1], 0, 0, [int]$n[2]) }
183
- "k" { [ReasonInput]::Key([uint16]$n[1], [uint16]$n[2], [uint32]$n[3]) }
184
- "c" { Set-Clipboard -Value ([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($n[1]))) }
185
- }
186
- } catch { [Console]::Error.WriteLine("input: $_") }
187
- }
188
- `;function Oe(e){let t=pn.replace("__MODE__",e).replace("__PARENT__",String(process.pid)).replace("__MAX_TEXT_BYTES__",String(v));return[an(),["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",Buffer.from(t,"utf16le").toString("base64")]]}var cn=["USERPROFILE","LOCALAPPDATA","APPDATA","TEMP","TMP","PSModuleAnalysisCachePath"];function Je(){let e=cn.flatMap((t)=>process.env[t]?[[t,process.env[t]]]:[]);return{...Object.fromEntries(e),SystemRoot:Ue(),windir:Ue()}}function Qt(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=="object")return null;let n=t,o=(s,i)=>typeof s==="number"&&Number.isSafeInteger(s)&&s>=i;return o(n.session,0)&&o(n.width,1)&&o(n.height,1)?{session:n.session,width:n.width,height:n.height}:null}function Ut(){return new Promise((e)=>{let t=Me(...Oe("probe"),{env:Je(),stdio:["ignore","pipe","ignore"],windowsHide:!0}),n="",o=setTimeout(()=>{t.kill("SIGKILL"),e(null)},sn);t.stdout.setEncoding("utf8").on("data",(s)=>{n+=s}),t.once("error",()=>{clearTimeout(o),e(null)}),t.once("close",()=>{clearTimeout(o),e(Qt(n.split(/\r?\n/)[0]??""))})})}var ae;function Ot(){if(ae!==void 0)return ae;if(process.platform!=="win32")return ae=!1;try{let e=rn(import.meta.url)("bun:ffi"),{symbols:t}=e.dlopen("kernel32.dll",{GetCurrentProcessId:{args:[],returns:e.FFIType.u32},ProcessIdToSessionId:{args:[e.FFIType.u32,e.FFIType.ptr],returns:e.FFIType.i32}}),n=new Uint32Array(1);return ae=t.ProcessIdToSessionId(t.GetCurrentProcessId(),n)!==0&&n[0]>0}catch{return ae=!1}}var kt=[{bit:1,down:2,up:4},{bit:2,down:32,up:64},{bit:4,down:8,up:16}],Xt=2048,Nt=4096,ln=[[8,Xt,120],[16,Xt,-120],[32,Nt,-120],[64,Nt,120]],vt=1,Le=2,un=4,fn=new Set([65505,65506]),Lt=new Set([65507,65508,65511,65512,65513,65514,65027,65515,65516]),Mt=new Map([[65505,[160,!1]],[65506,[161,!1]],[65507,[162,!1]],[65508,[163,!0]],[65511,[164,!1]],[65512,[165,!0]],[65513,[164,!1]],[65514,[165,!0]],[65027,[165,!0]],[65515,[91,!0]],[65516,[92,!0]],[65288,[8,!1]],[65289,[9,!1]],[65056,[9,!1]],[65293,[13,!1]],[65307,[27,!1]],[65535,[46,!0]],[65379,[45,!0]],[65360,[36,!0]],[65367,[35,!0]],[65365,[33,!0]],[65366,[34,!0]],[65361,[37,!0]],[65362,[38,!0]],[65363,[39,!0]],[65364,[40,!0]],[65383,[93,!0]],[65509,[20,!1]],[65299,[19,!1]],[65300,[145,!1]],[65377,[44,!0]],[65407,[144,!0]],[32,[32,!1]],[65421,[13,!0]],[65408,[32,!1]],[65450,[106,!1]],[65451,[107,!1]],[65452,[108,!1]],[65453,[109,!1]],[65454,[110,!1]],[65455,[111,!0]],[65429,[36,!1]],[65430,[37,!1]],[65431,[38,!1]],[65432,[39,!1]],[65433,[40,!1]],[65434,[33,!1]],[65435,[34,!1]],[65436,[35,!1]],[65438,[45,!1]],[65439,[46,!1]],...Array.from({length:10},(e,t)=>[65456+t,[96+t,!1]]),...Array.from({length:24},(e,t)=>[65470+t,[112+t,!1]])]);class Bt{x=-1;y=-1;mask=0;held=new Set;pressed=new Set;pointer(e,t,n){let o=[];if(e!==this.x||t!==this.y)this.x=e,this.y=t,o.push(`p ${e} ${t}`);for(let s of kt){let i=(this.mask&s.bit)!==0,p=(n&s.bit)!==0;if(i!==p)o.push(`b ${p?s.down:s.up} 0`)}for(let[s,i,p]of ln)if(!(this.mask&s)&&n&s)o.push(`b ${i} ${p}`);return this.mask=n,o}key(e,t){let n=e?0:Le;if(fn.has(t)||Lt.has(t))if(e)this.held.add(t);else this.held.delete(t);let o=Mt.get(t);if(o)return[`k ${o[0]} 0 ${n|(o[1]?vt:0)}`];let s=t<256?t:(t&4278190080)===16777216?t&16777215:0,i=String.fromCharCode(s),p=[...this.held].some((h)=>Lt.has(h)),l=/^[A-Za-z0-9]$/.test(i)?i.toUpperCase().charCodeAt(0):0;if(l&&(e?p:this.pressed.has(l))){if(e)this.pressed.add(l);else this.pressed.delete(l);return[`k ${l} 0 ${n}`]}if(s<33||s>=127&&s<160||s>65535||s>=55296&&s<57344)return[];return[`k 0 ${s} ${n|un}`]}release(){let e=kt.filter((t)=>this.mask&t.bit).map((t)=>`b ${t.up} 0`);for(let t of this.pressed)e.push(`k ${t} 0 ${Le}`);for(let t of this.held){let[n,o]=Mt.get(t);e.push(`k ${n} 0 ${Le|(o?vt:0)}`)}return this.mask=0,this.pressed.clear(),this.held.clear(),e}}function Jt(e){let t=Me(...Oe("input"),{env:Je(),stdio:["pipe","pipe","ignore"],windowsHide:!0}),n=new Bt,o="",s=!1,i=null,p=()=>{if(i?.kill("SIGKILL"),t.exitCode!==null||t.signalCode!==null)return;t.stdin.end(n.release().map((u)=>`${u}
189
- `).join("")),setTimeout(()=>t.kill("SIGKILL"),2000).unref()},l=(u)=>{if(s)return;s=!0,p(),e.end(u)},h=(u)=>l({error:new r("display_unavailable",u)}),f=(u)=>{if(s||u.length===0)return;if(t.stdin.write(u.map((S)=>`${S}
190
- `).join("")),t.stdin.writableLength>on)l({reason:"input_backpressure"})},x=()=>{i=Me(...Oe("clipboard"),{env:Je(),stdio:["ignore","pipe","ignore"],windowsHide:!0});let u="";i.stdout?.on("data",(S)=>{if(s)return;u+=S.toString("ascii");for(let y=u.indexOf(`
191
- `);y>=0;y=u.indexOf(`
192
- `)){let A=u.slice(0,y).replace(/\r$/,"");if(u=u.slice(y+1),!A.startsWith("c "))continue;let q=A.slice(2);if(q.length>Math.ceil(v/3)*4||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(q)){l({reason:"display_protocol"});return}let c=Buffer.from(q,"base64");if(c.byteLength<=v)e.clipboard(c.toString("utf8"));if(s)return}if(u.length>Math.ceil(v/3)*4+4)l({reason:"display_protocol"})}),i.once("error",()=>h("Reason could not watch this computer's desktop clipboard.")),i.once("exit",()=>{if(!s)h("Reason could not watch this computer's desktop clipboard.")})};return t.stdout.on("data",(u)=>{if(s||o===null)return;o+=u.toString("utf8");let S=o.indexOf(`
193
- `);if(S<0){if(o.length>4096)l({reason:"display_protocol"});return}let y=Qt(o.slice(0,S).trim());if(o=null,!y)l({reason:"display_protocol"});else if(y.session===0)h("This Windows worker runs as a service, which has no desktop: run it in the signed-in desktop session.");else x(),e.ready({width:y.width,height:y.height})}),t.stdin.on("error",()=>{return}),t.once("error",()=>h("Reason could not start this computer's desktop input.")),t.once("exit",()=>{if(o!==null)h("Reason could not start this computer's desktop input.");else l({reason:"display_closed"})}),{pointer:(u,S,y)=>f(n.pointer(u,S,y)),key:(u,S)=>f(n.key(u,S)),clipboard:(u)=>f([`c ${Buffer.from(u,"utf8").toString("base64")}`]),close(){s=!0,p()}}}var hn=["none","standard","all"],xe="22.23.3",gn={"linux-x64":"1084aa36196bba4c3a5e69a1ee388a6e4ff729dad09445fbcd434b28fe3c24af","linux-arm64":"5ced2d48d1d7198739b7f86804de0171aefb6823b684b12341d3321afc3cb0b2","darwin-arm64":"23b25245dcfb9af7262f8ff142e9e2e0af025368117329e7a7458a51e5922f53","win32-x64":"2b0ff57b049cda1bbcea2240eec20467018713c1efe1f7360c2681859b90ed71","win32-arm64":"33dad22e4cef5ee8f9fbb1b0d037fdacd0e56d12a4580f0d63f68b894deab535"},je={"linux-x64":{ocu:"dist/linux/amd64/open-computer-use",obu:"native/linux-amd64/open-browser-use"},"linux-arm64":{ocu:"dist/linux/arm64/open-computer-use",obu:"native/linux-arm64/open-browser-use"},"darwin-arm64":{ocu:"dist/Open Computer Use.app/Contents/MacOS/OpenComputerUse",obu:"native/darwin-arm64/open-browser-use"},"win32-x64":{ocu:"dist/windows/amd64/open-computer-use.exe",obu:"native/windows-amd64/open-browser-use.exe"},"win32-arm64":{ocu:"dist/windows/arm64/open-computer-use.exe",obu:"native/windows-arm64/open-browser-use.exe"}},Gt="chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing",Vt="chrome-win64/chrome.exe",Y={version:"9.0.2",url:"https://ffmpeg.martin-riedl.de/download/macos/arm64/1789931890_9.0.2/ffmpeg.zip",sha256:"c8ed4c4e6978a03c485edbfe4e0a5dc2380f8a30bba5150531b31b094492d924"},Sn={version:Y.version,url:"https://ffmpeg.martin-riedl.de/download/macos/arm64/1789931890_9.0.2/ffprobe.zip",sha256:"fcbe839537485eaee7a7a8bc5cbc0f90d53617e80943e8a5b2e31cb851197ea6"},We={version:Y.version,url:`https://github.com/GyanD/codexffmpeg/releases/download/${Y.version}/ffmpeg-${Y.version}-essentials_build.zip`,sha256:"60f467265b1e312373dbcd92200c2618a74850f98d3d078e94296bb3fa2047ba"},jt=`ffmpeg-${We.version}-essentials_build/bin`,G="com.ifuryst.open_browser_use.extension",Kt="com.reasonmachines.browser_use.extension",Ct="/tmp/reason-browser-use",Ge=["tint2","picom","xterm","pcmanfm"],It=["fonts-droid-fallback"],Zt=["pulseaudio"],_n=["xvfb","openbox","x11vnc","x11-utils","x11-xserver-utils","xdotool","dbus-x11","at-spi2-core","python3","python3-gi","gir1.2-atspi-2.0","gir1.2-gtk-3.0","fonts-dejavu-core",...It,"galculator","chromium","ffmpeg","tmux",...Zt,...Ge],wn=new Set([...Ge,...It,...Zt]),Wt=_n.filter((e)=>e!=="chromium"&&!wn.has(e)),Pn=["Xvfb","openbox","x11vnc","xdotool","dbus-launch","python3","ffmpeg","tmux"],be="/usr/bin/chromium",qn=["/usr/local/bin","/usr/bin","/bin","/opt/homebrew/bin"];function En(e=process.platform,t=process.arch){let n=`${e}-${t}`;return n==="linux-x64"||n==="linux-arm64"||n==="darwin-arm64"||n==="win32-x64"||n==="win32-arm64"?n:null}function z(e){return e==="win32-x64"||e==="win32-arm64"}function Ve(e){return z(e)?`node-v${xe}-${e.replace("win32","win")}`:`node-v${xe}-${e}`}function me(e){return{node:{version:xe,url:`https://nodejs.org/dist/v${xe}/${Ve(e)}${z(e)?".zip":".tar.gz"}`,sha256:gn[e]},open_computer_use:{version:U.ocu.version,url:ie.ocu.url,sha256:ie.ocu.sha256},open_browser_use:{version:U.obu.version,url:ie.obu.url,sha256:ie.obu.sha256},...e==="darwin-arm64"?{chrome_for_testing:{version:J.version,url:`https://storage.googleapis.com/chrome-for-testing-public/${J.version}/mac-arm64/chrome-mac-arm64.zip`,sha256:J.macArm64Sha256}}:z(e)?{chrome_for_testing:{version:J.version,url:`https://storage.googleapis.com/chrome-for-testing-public/${J.version}/win64/chrome-win64.zip`,sha256:J.win64Sha256}}:{}}}function Tn(e){let t={extension:F};for(let[n,o]of Object.entries(me(e)))t[n]=`${o.version}@${o.sha256}`;return t}function Yt(e){return g(e,".local","share","reason","desktop")}function yr(e,t=kn()){let n=Yt(t),o=(u)=>g(n,u,me(e)[u]?.version??""),s=o("open_computer_use"),i=o("open_browser_use"),p=e==="darwin-arm64",l=z(e),h=g(t,"Library","Application Support"),f=g(process.platform==="win32"&&process.env.LOCALAPPDATA?process.env.LOCALAPPDATA:g(t,"AppData","Local"),"OpenBrowserUse"),x=p?g(h,"Google","Chrome","NativeMessagingHosts",`${G}.json`):l?g(f,"NativeMessagingHosts",`${G}.json`):g(t,".config","google-chrome","NativeMessagingHosts",`${G}.json`);return{root:n,automation:g($t(n),"automation"),receipt:g(n,"receipt.json"),minimal:$n(t),node:l?g(o("node"),Ve(e),"node.exe"):g(o("node"),"bin","node"),ocuDir:s,ocu:g(s,je[e].ocu),ocuApp:p?g(s,"dist","Open Computer Use.app"):null,obuDir:i,obu:g(i,"cli","open-browser-use.js"),nativeHost:g(i,je[e].obu),extensionDir:p?g(h,"OpenBrowserUse","chrome-extension","release"):l?g(f,"chrome-extension","release"):g(t,".local","share","open-browser-use","chrome-extension","release"),setupNativeHostManifest:x,nativeHostManifests:p?[x,g(h,"Google","ChromeForTesting","NativeMessagingHosts",`${G}.json`)]:l?[x]:[g(t,".config","chromium","NativeMessagingHosts",`${G}.json`),g(t,".config","google-chrome-for-testing","NativeMessagingHosts",`${G}.json`)],browser:p?g(o("chrome_for_testing"),Gt):l?g(o("chrome_for_testing"),Vt):be,userChromeHost:p?g(n,"user-chrome","reason-browser-use"):null,userChromeRegistration:p?g(h,"Google","Chrome","NativeMessagingHosts",`${Kt}.json`):null,ffmpegDir:g(n,"ffmpeg"),ffmpeg:p?g(n,"ffmpeg",Y.version,"ffmpeg"):l?g(n,"ffmpeg",We.version,jt,"ffmpeg.exe"):null,ffprobe:p?g(n,"ffprobe",Sn.version,"ffprobe"):l?g(n,"ffmpeg",We.version,jt,"ffprobe.exe"):null}}function Rn(e){try{let t=JSON.parse(ye(e,"utf8"));if(typeof t!=="object"||t===null)return null;let n=t,o=n.pins;if(n.schema_version!==1||typeof n.platform!=="string"||typeof o!=="object"||o===null||!Object.values(o).every((s)=>typeof s==="string")||!hn.includes(n.permissions)||!Array.isArray(n.missing_system_packages)||!n.missing_system_packages.every((s)=>typeof s==="string")||typeof n.updated_at!=="string")return null;return{schema_version:1,platform:n.platform,pins:o,permissions:n.permissions,missing_system_packages:n.missing_system_packages,updated_at:n.updated_at}}catch{return null}}function O(e){try{return Fe(e).isFile()}catch{return!1}}function zt(e){try{let t=Fe(e);return t.isFile()&&(t.mode&73)!==0}catch{return!1}}function An(e){try{return ye(e,"utf8")}catch{return null}}function W(e){for(let t of qn){let n=g(t,e);try{let o=Fe(n);if(o.isFile()&&(o.mode&73)!==0)return n}catch{}}return null}function Xn(e){try{let t=JSON.parse(ye(g(e,"package.json"),"utf8"));return typeof t==="object"&&t!==null&&typeof t.version==="string"?t.version:null}catch{return null}}function Cn(e,t,n){let o=me(n)[e];if(!o)return!1;let s=z(n);if(e==="node")return O(s?g(t,Ve(n),"node.exe"):g(t,"bin","node"));if(e==="chrome_for_testing")return O(g(t,s?Vt:Gt));let i=je[n][e==="open_computer_use"?"ocu":"obu"];return Xn(t)===o.version&&O(g(t,i))&&(e==="open_computer_use"||O(g(t,"cli","open-browser-use.js")))}function vn(e){return Ft("sha256").update(Buffer.from(e,"base64")).digest("hex").slice(0,32).replace(/./g,(t)=>String.fromCharCode(97+Number.parseInt(t,16)))}function Ke(e){try{let t=JSON.parse(ye(e,"utf8"));return typeof t==="object"&&t!==null&&!Array.isArray(t)?t:null}catch{return null}}function Ln(e){let t=Ke(g(e.extensionDir,"manifest.json"));return t!==null&&t.version===U.obu.version&&typeof t.key==="string"&&vn(t.key)===F}function Qn(e,t){let n=e?.allowed_origins;return e!==null&&e.name===G&&Array.isArray(n)&&n.length===1&&n[0]===`chrome-extension://${F}/`&&(t===void 0||e.path===t)}function Un(e){return Ln(e)&&O(e.nativeHost)&&e.nativeHostManifests.every((t)=>Qn(Ke(t),e.nativeHost))}function Bn(e){return`#!/bin/sh
194
- # Reason's Chrome extension host (reason desktop install): Open Browser Use on Reason's socket directory.
195
- obu=${`'${e.replaceAll("'","'\\''")}'`}
196
- case "$1" in
197
- chrome-extension://*) exec "$obu" host --socket-dir ${Ct} ;;
198
- mcp) shift; exec "$obu" mcp --socket-dir ${Ct} "$@" ;;
199
- esac
200
- exec "$obu" "$@"
201
- `}function Jn(e){let t=Ke(e),n=t?.allowed_origins;return t!==null&&t.name===Kt&&t.type==="stdio"&&Array.isArray(n)&&n.includes(`chrome-extension://${$e}/`)&&typeof t.path==="string"&&zt(t.path)}function jn(e,t){if(!e.userChromeHost||!e.userChromeRegistration)return null;if(!t||An(e.userChromeHost)!==Bn(e.nativeHost)||!zt(e.userChromeHost))return{code:"user_chrome_browser_use_missing"};return Jn(e.userChromeRegistration)?{host:e.userChromeHost}:{code:"user_chrome_native_host_unregistered"}}var Wn={display:["display","desktop_session","desktop_video"],computer:["display","desktop_session","system_packages","node","open_computer_use"],browser:["display","desktop_session","system_packages","node","open_computer_use","open_browser_use","browser_extension","browser","chrome_for_testing"]};function P(e={}){let t=e.platform===void 0?En():e.platform;if(!t)return null;let n=yr(t,e.home),o=Rn(n.receipt),s=Tn(t),i=o!==null&&o.platform===t&&JSON.stringify(Object.entries(o.pins).sort())===JSON.stringify(Object.entries(s).sort()),p=[],l=me(t);for(let c of["node","open_computer_use","open_browser_use","chrome_for_testing"]){let _=l[c];if(!_)continue;let E=Cn(c,g(n.root,c,_.version),t),D=o?.pins[c],N=E&&D===s[c]?"ready":D!==void 0&&D!==s[c]?"outdated":"missing";p.push({name:c,state:N,detail:_.version})}let h=o?.pins.extension===F&&Un(n);p.push({name:"browser_extension",state:h?"ready":"missing",detail:F});let f=W("Xvfb"),x=W("x11vnc"),u=W("openbox");if(z(t))p.push(Ot()?{name:"desktop_session",state:"ready",detail:"signed-in desktop session"}:{name:"desktop_session",state:"missing",detail:"run the worker in the signed-in desktop session, not as a service"}),p.push(n.ffmpeg&&O(n.ffmpeg)?{name:"desktop_video",state:"ready",detail:n.ffmpeg}:{name:"desktop_video",state:"missing",detail:"run `reason desktop install` for desktop video"});else if(t!=="darwin-arm64"){p.push(O(be)?{name:"browser",state:"ready",detail:be}:{name:"browser",state:"missing",detail:`non-snap Chromium at ${be}`});let c=f!==null&&x!==null&&u!==null;p.push({name:"display",state:c?"ready":"missing",detail:"Xvfb + openbox + x11vnc"});let _=Pn.filter((k)=>W(k)===null),E=(o?.missing_system_packages??Wt).filter((k)=>Wt.includes(k)),D=_.length===0&&E.length===0;p.push(D?{name:"system_packages",state:"ready"}:{name:"system_packages",state:"missing",detail:[...new Set([...E,..._])].join(" ")});let N=Ge.filter((k)=>W(k)===null);p.push(N.length===0?{name:"desktop_look",state:"ready"}:{name:"desktop_look",state:"missing",detail:N.join(" ")})}let S=n.ffmpeg&&O(n.ffmpeg)?n.ffmpeg:W("ffmpeg"),y=!S?null:S===n.ffmpeg?n.ffprobe:g($t(xn(S)),"ffprobe"),A=i&&p.every((c)=>c.state==="ready"),q=(c)=>i&&p.every((_)=>!Wn[c].includes(_.name)||_.state==="ready");return{platform:t,root:n.root,automation:n.automation,ready:A,features:{display:q("display"),computer:q("computer"),browser:q("browser")},node:n.node,ocu:n.ocu,obu:n.obu,nativeHost:n.nativeHost,extensionDir:n.extensionDir,browser:n.browser,ffmpeg:S,ffprobe:y&&O(y)?y:null,userChrome:jn(n,i&&["node","open_browser_use"].every((c)=>p.find((_)=>_.name===c)?.state==="ready")),pulseaudio:W("pulseaudio"),xvfb:f,x11vnc:x,openbox:u,components:p}}function Ht(e){return Fn(e)?Mn():[]}function Fn(e){return e?.platform==="darwin-arm64"&&e.ffmpeg===g(e.root,"ffmpeg",Y.version,"ffmpeg")}async function Ui(e,t,n,o=fetch){try{let s=await o(e,{redirect:"follow"});if(!s.ok||!s.body)throw Error(`download failed (HTTP ${s.status}): ${e}`);let i=Ft("sha256"),p=bn(n,{mode:384});try{let h=s.body.getReader();for(let f=await h.read();!f.done;f=await h.read())if(i.update(f.value),!p.write(f.value))await dn(p,"drain")}finally{p.end(),await mn(p)}let l=i.digest("hex");if(l!==t)throw Error(`digest mismatch for ${e}: expected ${t}, got ${l}`)}catch(s){throw yn(n,{force:!0}),s}}function $n(e){return g(Yt(e),"minimal.json")}import{execFile as os,spawn as rt}from"child_process";import{existsSync as is}from"fs";import{connect as as}from"net";function Gn(){let e=new Set,t=null,n=(s)=>({holder:t?.viewer??null,you:t===s,same_user:Boolean(t?.viewer&&s.viewer&&t.viewer.user_id===s.viewer.user_id)}),o=()=>{for(let s of e)s.notify(n(s))};return{join(s){return e.add(s),s.notify(n(s)),()=>{if(!e.delete(s))return;if(t!==s)return;t=null,o()}},claim(s){if(t===s||!e.has(s))return;t=s,o()}}}var er=Gn();import{spawn as Vn}from"child_process";import{existsSync as Kn}from"fs";import{connect as Zn}from"net";import{join as he}from"path";var rr="reason_desktop",pe={sampleRate:48000,channels:2,codec:"opus"},Yn=5000,zn=107,Hn=262144,Ye=(e)=>he(e,"native"),Qe=(e)=>`unix:${e}`;function Ie(e,t=1000){if(!Kn(e))return Promise.resolve(!1);return new Promise((n)=>{let o=Zn({path:e}),s=(i)=>{o.destroy(),n(i)};o.setTimeout(t,()=>s(!1)),o.once("error",()=>s(!1)),o.once("close",()=>s(!1)),o.once("connect",()=>s(!0))})}async function nr(e,t){if(!t)return null;let n=Ye(e);if(Buffer.byteLength(n)>zn||/["'\\\s]/.test(n))return null;try{if(await Ie(n))return n;let o=Vn(t,["--daemonize=no","--system=no","--use-pid-file=no","--exit-idle-time=-1","--disallow-exit=yes","--realtime=no","--high-priority=no","--disallow-module-loading=yes","--log-level=warning",`--log-target=file:${he(e,"pulseaudio.log")}`,"-n",`--load=module-native-protocol-unix socket="${n}" auth-anonymous=1 auth-cookie-enabled=0`,`--load=module-null-sink sink_name=${rr} rate=${pe.sampleRate} channels=${pe.channels} sink_properties=device.description=Reason_desktop`],{detached:!0,stdio:"ignore",env:{HOME:e,PATH:"/usr/bin:/bin",XDG_RUNTIME_DIR:e,PULSE_RUNTIME_PATH:he(e,"runtime"),PULSE_STATE_PATH:he(e,"state")}}),s=!1;o.once("error",()=>{s=!0}),o.once("exit",()=>{s=!0}),o.unref();let i=Date.now()+Yn;while(Date.now()<i){if(await Ie(n))return n;if(s)return await Ie(n)?n:null;await new Promise((p)=>setTimeout(p,50))}if(!s)o.kill("SIGKILL");return null}catch{return null}}function sr(){let{sampleRate:e,channels:t}=pe;return["-hide_banner","-loglevel","error","-nostdin","-fflags","nobuffer","-f","pulse","-sample_rate",String(e),"-channels",String(t),"-fragment_size",String(e*t*2/50),"-i",`${rr}.monitor`,"-vn","-ac",String(t),"-ar",String(e),"-c:a","libopus","-b:a","64k","-application","lowdelay","-frame_duration","20","-flush_packets","1","-page_duration","20000","-f","ogg","pipe:1"]}var es=[79,103,103,83],ts=Buffer.from("OpusHead"),rs=Buffer.from("OpusTags"),tr=(e,t)=>e.byteLength>=t.byteLength&&t.every((n,o)=>e[o]===n);class Ze extends Error{constructor(e){super(e);this.name="OggProtocolError"}}class He{buffer=new Uint8Array(0);partial=[];partialBytes=0;push(e){let t=new Uint8Array(this.buffer.byteLength+e.byteLength);t.set(this.buffer),t.set(e,this.buffer.byteLength);let n=[],o=0;while(t.byteLength-o>=27){if(es.some((S,y)=>t[o+y]!==S)||t[o+4]!==0)throw new Ze("invalid_page");let s=(t[o+5]&1)!==0,i=t[o+26];if(t.byteLength-o<27+i)break;let p=t.subarray(o+27,o+27+i),l=p.reduce((S,y)=>S+y,0),h=27+i+l;if(t.byteLength-o<h)break;if(!s&&this.partialBytes>0)this.resetPartial();let f=s&&this.partialBytes===0,x=o+27+i,u=x;for(let S of p){if(x+=S,S===255)continue;if(this.appendPartial(t.subarray(u,x),f),u=x,!f){let y=this.takePartial();if(y.byteLength>0&&!tr(y,ts)&&!tr(y,rs))n.push(y)}f=!1,this.resetPartial()}if(u<x)this.appendPartial(t.subarray(u,x),f);o+=h}return this.buffer=t.slice(o),n}appendPartial(e,t){if(t||e.byteLength===0)return;if(this.partialBytes+=e.byteLength,this.partialBytes>Hn)throw new Ze("packet_too_large");this.partial.push(e.slice())}takePartial(){if(this.partial.length===1)return this.partial[0];let e=new Uint8Array(this.partialBytes),t=0;for(let n of this.partial)e.set(n,t),t+=n.byteLength;return e}resetPartial(){this.partial=[],this.partialBytes=0}}import{spawn as ns}from"child_process";var or=1048576,ss=String.raw`
202
- import gi, json, os, sys
203
- gi.require_version("Gtk", "3.0")
204
- from gi.repository import Gtk, Gdk, GLib
205
- if not Gtk.init_check()[0]:
206
- sys.exit(1)
207
- clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
208
- pending = b""
209
- generation = 0
210
- def send(value):
211
- print(json.dumps(value, ensure_ascii=True), flush=True)
212
- def changed(clipboard, event):
213
- global generation
214
- generation += 1
215
- current = generation
216
- def received(clipboard, text, unused):
217
- if current == generation and text is not None and len(text.encode("utf-8")) <= ${v}:
218
- send({"text": text})
219
- clipboard.request_text(received, None)
220
- # No request_text on startup: never share the pre-existing clipboard.
221
- clipboard.connect("owner-change", changed)
222
- def input_ready(fd, condition):
223
- global pending
224
- chunk = os.read(fd, 65536)
225
- if not chunk:
226
- Gtk.main_quit()
227
- return False
228
- pending += chunk
229
- while b"\n" in pending:
230
- line, pending = pending.split(b"\n", 1)
231
- text = json.loads(line)
232
- if not isinstance(text, str) or len(text.encode("utf-8")) > ${v} or "\x00" in text:
233
- sys.exit(1)
234
- clipboard.set_text(text, -1)
235
- send("ack")
236
- if len(pending) > ${v*6+2}:
237
- sys.exit(1)
238
- return True
239
- GLib.io_add_watch(0, GLib.IO_IN | GLib.IO_HUP, input_ready)
240
- send("ready")
241
- Gtk.main()
242
- `;function ir(e,t){let n=ns("/usr/bin/python3",["-I","-u","-c",ss],{env:{DISPLAY:e.display,XAUTHORITY:e.xauthority},stdio:["pipe","pipe","ignore"]}),o=!1,s=!0,i="",p=0,l=[],h=setTimeout(()=>x(),5000),f=()=>{o=!0,clearTimeout(h),l.length=0,n.kill("SIGKILL")},x=()=>{if(o)return;f(),t.end({error:new r("display_unavailable","Reason could not start this Linux desktop's UTF-8 clipboard.")})},u=(S,y=32)=>{if(o)return;if(!s){S();return}if(p+=y,p>or)f(),t.end({reason:"input_backpressure"});else l.push({apply:S,bytes:y})};return n.stdout.on("data",(S)=>{if(o)return;i+=S.toString("ascii");for(let y=i.indexOf(`
243
- `);y>=0;y=i.indexOf(`
244
- `)){let A=i.slice(0,y);i=i.slice(y+1);let q;try{q=JSON.parse(A)}catch{x();return}if(q==="ready"||q==="ack"){clearTimeout(h),s=!1;while(!s&&!o&&l.length){let c=l.shift();p-=c.bytes,c.apply()}}else if(q&&typeof q==="object"&&"text"in q&&typeof q.text==="string"&&Buffer.byteLength(q.text)<=v)t.clipboard(q.text);else{x();return}if(o)return}if(i.length>v*6+32)x()}),n.stdin.on("error",x),n.once("error",x),n.once("exit",x),{apply:u,write(S){if(Buffer.byteLength(S)>v||S.includes("\x00")){x();return}let y=`${JSON.stringify(S)}
245
- `;u(()=>{if(s=!0,h=setTimeout(()=>x(),5000),n.stdin.write(y),n.stdin.writableLength>or)f(),t.end({reason:"input_backpressure"})},Buffer.byteLength(y))},close:f}}var H={smooth:{fps:60,crf:23,kbps:8000,x264Preset:"ultrafast",threads:2,scale:1},sharp:{fps:30,crf:19,kbps:1e4,x264Preset:"superfast",scale:1},data_saver:{fps:20,crf:28,kbps:2000,x264Preset:"ultrafast",scale:0.75},balanced:{fps:30,crf:23,kbps:4000,x264Preset:"ultrafast",threads:2,scale:1}},ps="avc1.4D002A",ar={width:1920,height:1080},cs=262144,ls=0.2,fs=250,ds=1e4,bs=1024,et=1e4,xs=500,ys=60,ms=1e4,hs=1000,pr=1048576,hr={kind:"mac_screen",sound:null},gr={kind:"windows_screen",sound:null},gs,cr=()=>gs??=P()?.ffmpeg??null,Se=(e,t,n)=>rt(e,t,{env:n,stdio:["ignore","pipe","ignore"],windowsHide:!0}),Ss,nt=()=>Ss??=Ht(P()),lr=(e,t,n)=>{let[o,...s]=[...nt(),e];return Se(o,[...s,...t],n)},ur=()=>Dr?.videotoolbox?"h264_videotoolbox":"libx264",_s=()=>Math.round(performance.now()*1000),tt=new Set,fr=!1;function Sr(e){if(tt.add(e),e.once("exit",()=>tt.delete(e)),fr)return;fr=!0,process.once("exit",()=>{for(let t of tt)try{t.kill("SIGKILL")}catch{}})}function _r(e){try{e.stdout?.destroy()}catch{}if(e.exitCode!==null||e.signalCode!==null)return;try{e.kill("SIGTERM")}catch{return}let t=setTimeout(()=>{if(e.exitCode===null&&e.signalCode===null)try{e.kill("SIGKILL")}catch{}},xs);e.once("exit",()=>clearTimeout(t))}function ws(e,t,n){return{args:["-f","x11grab","-draw_mouse","1","-framerate",String(e),"-video_size",`${t.width}x${t.height}`,"-i",n],size:t}}function Ps(e){return{args:["-f","avfoundation","-capture_cursor","1","-pixel_format","nv12","-framerate",String(e),"-i","Capture screen 0:none"],size:null}}function qs(e,t){return{args:["-f","gdigrab","-draw_mouse","1","-framerate",String(e),"-offset_x","0","-offset_y","0","-video_size",`${t.width}x${t.height}`,"-i","desktop"],size:t}}function Es(e){return{args:["-probesize","32","-analyzeduration","0","-f","image2pipe","-c:v","mjpeg","-framerate",String(e),"-i","pipe:0"],size:null}}var wr=1700000;function Pr(e){return Math.min(1,Math.round(Math.sqrt(wr/(e.width*e.height))*100)/100)}function Ds(e,t,n){let o=rt(n.axe,["stream-video","--udid",n.udid,"--format","ffmpeg","--fps","30","--quality","85","--scale",String(Math.min(0.99,Pr(n.size)))],{stdio:["ignore","pipe","ignore"]}),s=rt(e,t,{env:{},stdio:["pipe","pipe","ignore"]});o.stdout.pipe(s.stdin),s.stdin.on("error",()=>{});let i=()=>{if(o.exitCode===null&&o.signalCode===null)o.kill("SIGTERM")};return s.once("exit",i),s.once("error",i),o.once("exit",()=>{if(s.exitCode===null&&s.signalCode===null)s.kill("SIGTERM")}),o.once("error",()=>{if(s.exitCode===null&&s.signalCode===null)s.kill("SIGTERM")}),s}function dr(e){let t=Math.min(1,ar.width/e.width,ar.height/e.height);return{width:Math.round(e.width*t),height:Math.round(e.height*t)}}function ge(e,t,n,o="libx264"){let s=H[e],i=(u)=>Math.max(2,Math.floor(u/2)*2),p={width:i(n.width*s.scale),height:i(n.height*s.scale)},l=p.width!==t.size?.width||p.height!==t.size.height,h=Math.max(1,Math.round(s.kbps*2/s.fps)),f=["-g",String(s.fps*ys)],x=o==="h264_videotoolbox"?["-c:v","h264_videotoolbox","-realtime","1","-prio_speed","1","-allow_sw","1","-profile:v","main","-level","4.2","-bf","0","-pix_fmt","nv12",...f,"-b:v",`${s.kbps}k`,"-maxrate",`${s.kbps}k`,"-bufsize",`${h}k`,"-bsf:v","h264_metadata=aud=insert"]:["-c:v","libx264","-preset",s.x264Preset,"-tune","zerolatency","-profile:v","main","-level","4.2","-bf","0","-pix_fmt","yuv420p",...s.threads?["-threads",String(s.threads)]:[],"-x264-params","aud=1:repeat-headers=1",...f,"-crf",String(s.crf),"-maxrate",`${s.kbps}k`,"-bufsize",`${h}k`];return["-hide_banner","-loglevel","error","-nostdin","-fflags","nobuffer",...t.args,"-an",...l?["-vf",`scale=${p.width}:${p.height}:flags=fast_bilinear`]:[],...x,"-flush_packets","1","-f","h264","pipe:1"]}class qr{buffer=new Uint8Array(0);scanned=0;key=!1;micros=0;push(e,t){if(this.buffer.byteLength===0)this.micros=t;let n=new Uint8Array(this.buffer.byteLength+e.byteLength);n.set(this.buffer),n.set(e,this.buffer.byteLength),this.buffer=n;let o=[],s=this.scanned;while(s+3<this.buffer.byteLength){if(this.buffer[s]!==0||this.buffer[s+1]!==0||this.buffer[s+2]!==1){s++;continue}let i=this.buffer[s+3]&31,p=s>0&&this.buffer[s-1]===0?s-1:s;if(i===9&&p>0)o.push({data:this.buffer.slice(0,p),key:this.key,micros:this.micros}),this.buffer=this.buffer.subarray(p),this.key=!1,this.micros=t,s-=p;if(i===5)this.key=!0;s+=3}return this.scanned=s,o}}function Ts(e,t){let n=as({path:e}),o=Buffer.alloc(0),s="version",i=0,p=!1,l=[],h=0,f=!1,x=(c)=>{if(f)return;f=!0,n.destroy(),t.end(c)},u=()=>x({reason:"display_protocol"}),S=(c)=>{if(f)return;if(!p){if(h+=c.byteLength,h>pr)x({reason:"input_backpressure"});else l.push(c);return}if(n.write(c),n.writableLength>pr)x({reason:"input_backpressure"})},y=(c)=>{o=o.subarray(c)},A=()=>{switch(s){case"version":{if(o.byteLength<12)return!1;let c=/^RFB (\d{3})\.(\d{3})\n$/.exec(o.subarray(0,12).toString("latin1"));if(!c||Number(c[1])*1000+Number(c[2])<3007)return u(),!1;return y(12),n.write(`RFB 003.007
246
- `),s="security",!0}case"security":{if(o.byteLength<1)return!1;let c=o[0];if(c===0)return u(),!1;if(o.byteLength<1+c)return!1;if(!o.subarray(1,1+c).includes(1))return u(),!1;return y(1+c),n.write(Buffer.from([1,1])),s="init",!0}case"init":{if(o.byteLength<24)return!1;let c=o.readUInt32BE(20);if(c>65536)return u(),!1;if(o.byteLength<24+c)return!1;let _={width:o.readUInt16BE(0),height:o.readUInt16BE(2)};if(y(24+c),_.width===0||_.height===0)return u(),!1;s="messages",p=!0;for(let E of l)n.write(E);return l=[],h=0,t.ready(_),!f}case"skip":{let c=Math.min(i,o.byteLength);if(y(c),i-=c,i>0)return!1;return s="messages",!0}case"messages":{if(o.byteLength<1)return!1;switch(o[0]){case 1:{if(o.byteLength<6)return!1;let c=6+o.readUInt16BE(4)*6;if(o.byteLength<c)return!1;return y(c),!0}case 2:return y(1),!0;case 3:{if(o.byteLength<8)return!1;let c=o.readUInt32BE(4);if(c>v/2)return y(8),s="skip",i=c,!0;if(o.byteLength<8+c)return!1;let _=o.subarray(8,8+c).toString("latin1");return y(8+c),t.clipboard(_),!f}default:return u(),!1}}}},q=!1;return n.once("connect",()=>{q=!0}),n.on("data",(c)=>{if(f)return;o=o.byteLength?Buffer.concat([o,c]):c;while(!f&&A());}),n.once("error",()=>{if(!q)x({error:new r("display_unavailable","Reason could not reach this machine's desktop server.")})}),n.once("close",()=>x({reason:"display_closed"})),{pointer(c,_,E){let D=Buffer.alloc(6);D.writeUInt8(5,0),D.writeUInt8(E&255,1),D.writeUInt16BE(c,2),D.writeUInt16BE(_,4),S(D)},key(c,_){let E=Buffer.alloc(8);E.writeUInt8(4,0),E.writeUInt8(c?1:0,1),E.writeUInt32BE(_>>>0,4),S(E)},clipboard(c){if(Array.from(c).some((D)=>D.codePointAt(0)>255)){x({reason:"clipboard_unicode_unsupported"});return}let _=Buffer.from(c,"latin1"),E=Buffer.alloc(8);E.writeUInt8(6,0),E.writeUInt32BE(_.byteLength,4),S(Buffer.concat([E,_]))},close(){f=!0,n.destroy()}}}class st{run=null;viewers=new Set;get running(){return this.run!==null}start(e,t,n,o){this.viewers.add(e),this.stop();let s;try{s=n()}catch{this.fail();return}Sr(s);let i={child:s,splitter:new qr};this.run=i;for(let l of[...this.viewers])l.started(t);s.stdout?.on("data",(l)=>{if(this.run!==i)return;for(let h of i.splitter.push(l,o()))for(let f of[...this.viewers])f.unit(h)});let p=()=>{if(this.run!==i)return;this.run=null,this.fail()};s.once("exit",p),s.once("error",p)}leave(e){if(!this.viewers.delete(e))return;if(this.viewers.size===0)this.stop()}stop(){if(!this.run)return;_r(this.run.child),this.run=null}fail(){for(let e of[...this.viewers])e.failed()}}var br=new WeakMap;function Rs(e){let t=br.get(e);if(!t)br.set(e,t=new st);return t}function Er(e,t,n={}){let o=n.micros??_s,s=new In,i=t.request.preset,p=null,l=null,h=null,f=!1,x=null,u=!1,S=!1,y=null,A=0,q=0,c=!1,_=null,E=null,D=0,N=null,k=[],te=0,w=[],M=new Uint32Array(et+1),B=0,Pe=null,qe=0,re=0,Ee=0,lt=0,ut=0,ce=null,De=0,K={frames:0,bytes:0,since:o()},I=[],ne=0,Te,Re=!1,Nr=o(),C={},Z=()=>Math.round((o()-Nr)/1000),ft=n.control??er,Ae=null,ke=null,L=(b)=>{let d=Fr(b);return e.send(d),lt+=d.byteLength,d.byteLength},le=(b)=>{if(e.done)return;if(e.open)L({type:"error",code:b});e.end({reason:b})},ue=()=>Math.max(cs,H[i].kbps*1000/8*ls),fe=()=>o()/1000,Lr=()=>{while(w.length>1&&w[0].atMs<fe()-ds)w.shift();return w[0]?.rttMs??null},dt=(b)=>{let d=Lr();if(d===null||k.length===0)return!1;let m=(d+fs)*b;return fe()-k[0].sentMs>m||te>m/1000*H[i].kbps*1000/8},Mr=(b)=>{if(D===0)return;let d=Math.min(b,D-1);if(N!==null&&d<=N)return;N=d;let m=fe();while(k.length&&k[0].seq<=d){let T=k.shift();if(te-=T.bytes,T.seq!==d)continue;let R=Math.max(0,m-T.sentMs);while(w.length&&w.at(-1).rttMs>=R)w.pop();w.push({atMs:m,rttMs:R}),M[Math.min(et,Math.round(R))]++,B++,Pe=Math.min(Pe??R,R)}},Qr=()=>{let b=0;for(let d=0;d<=et;d++)if(b+=M[d],b*2>=B)return d;return 0},Ur=()=>e.bufferedAmount<=ue()/2&&!dt(0.5),bt=()=>{Re=!0,I=[],ne=0,x?.leave(Xe),x=null},xt=(b)=>{if(e.done)return;if(b.key)C.first_key_ms??=Z();if(!f){if(!x||I.length===0&&!b.key)return;if(I.push(b),ne+=b.data.byteLength,ne>ue())bt();return}if(c){re++;return}if(e.bufferedAmount>ue()||dt(1)){c=!0,re++,_=setInterval(()=>{if(e.done||!Ur())return;if(_)clearInterval(_);_=null,c=!1,Ne()},n.drainPollMs??25);return}if(!u){if(!b.key){re++;return}if(L({type:"hello",width:l.width,height:l.height,fps:H[i].fps,preset:i,codec:ps}),u=!0,C.first_frame_ms??=Z(),!S&&p?.sound)L({type:"audioHello",...pe}),S=!0}let d=L({type:"frame",key:b.key,seq:D,captureMicros:b.micros,data:b.data});if(k.push({seq:D,sentMs:fe(),bytes:d}),te+=d,k.length>bs)te-=k.shift().bytes;D++,qe++,ce??=b.micros,De=b.micros,K.frames++,K.bytes+=d},Xe={started(b){i=b,u=!1,I=[],ne=0},unit:xt,failed:()=>le("encoder_failed")},Ce=()=>{let b=(n.ffmpeg??cr)();if(!p||!l){le("encoder_failed");return}let[d,m]=[p,l],T="kind"in d&&d.kind==="simulator"?d.stream:null;if(!b&&!T){le("encoder_failed");return}if(x??="kind"in d&&d.kind==="mac_screen"?Rs(n.spawn??lr):new st,C.encoder_ms===void 0)C.encoder_ms=Z(),C.encoder_shared=x.running;x.start(Xe,i,()=>{let R=H[i].fps;if(T)return T(R,H[i].kbps,wr);if("kind"in d&&d.kind==="simulator"){let Q=Math.min(0.99,Pr(d.size)),se={width:d.size.width*Q,height:d.size.height*Q};return Ds(b,ge(i,Es(Math.min(R,30)),se,(n.macEncoder??ur)()),d)}if("kind"in d&&d.kind==="windows_screen")return(n.spawn??Se)(b,ge(i,qs(R,m),dr(m)),{SystemRoot:process.env.SystemRoot??"C:\\Windows"});return"kind"in d?(n.spawn??lr)(b,ge(i,Ps(R),dr(m),(n.macEncoder??ur)()),{}):(n.spawn??Se)(b,ge(i,ws(R,m,d.display),m),{DISPLAY:d.display,XAUTHORITY:d.xauthority})},o)},de=()=>{if(!y)return;_r(y.child),y=null},Or=()=>{let b=(n.ffmpeg??cr)();if(y||e.done||!S||!p?.sound||!b)return;let d;try{d=(n.spawn??Se)(b,sr(),{PULSE_SERVER:Qe(p.sound)})}catch{return}Sr(d);let m={child:d,reader:new He};y=m,d.stdout?.on("data",(R)=>{if(y!==m||e.done)return;let Q;try{Q=m.reader.push(R)}catch{de();return}let se=o();for(let Br of Q){if(e.bufferedAmount>ue()){q++;continue}L({type:"audio",captureMicros:se,data:Br}),A++}});let T=()=>{if(y===m)de()};d.once("exit",T),d.once("error",T)},Ne=()=>{if(!x||e.done)return;Ee++,Ce()},yt=()=>{if(e.done||!l)return;if(!f){if(x||Re)return;Ce(),Te=setTimeout(()=>{if(!f)bt()},ms);return}if(clearTimeout(Te),C.encoder_early===void 0){if(C.encoder_early=x!==null,Re)C.hold_lapsed=!0}if(!x)Ce();let b=I;I=[],ne=0;for(let d of b)xt(d);E??=setInterval(()=>{let d=o(),m=Math.max(0.001,(d-K.since)/1e6);L({type:"stats",stats:{fps:Math.round(K.frames/m*10)/10,kbps:Math.round(K.bytes*8/1000/m),dropped:re,restarts:Ee,queued_bytes:e.bufferedAmount}}),K={frames:0,bytes:0,since:d}},hs)};t.desktop.then((b)=>{if(e.done)return;p=b;let d={ready(m){l=m,C.desktop_ms??=Z(),yt()},clipboard(m){if(e.open&&Buffer.byteLength(m)<=v)L({type:"serverClipboard",text:m})},end(m){if("reason"in m&&e.open)L({type:"error",code:m.reason});e.end(m)}};if("kind"in b&&b.kind==="simulator")h=b.input,d.ready(b.points);else if("kind"in b&&b.kind==="windows_screen")h=(n.windowsInput??Jt)(d);else if("kind"in b)h=(n.macInput??((m)=>Nn(m,nt())))(d);else{let m=(n.linuxClipboard??ir)(b,d),T=Ts(b.rfbSocket,{...d,clipboard:(R)=>{if(!m)d.clipboard(R)}});h=m?{pointer:(R,Q,se)=>m.apply(()=>T.pointer(R,Q,se)),key:(R,Q)=>m.apply(()=>T.key(R,Q)),clipboard:(R)=>m.write(R),close(){m.close(),T.close()}}:T}mt()},(b)=>e.end({error:b}));function mt(){if(ke||!t.viewerSameNetwork||!f||e.done||!p||!("kind"in p)||p.kind!=="mac_screen")return;ke=(n.macWindows??Dn)((b)=>{if(e.open)L({type:"windows",bounds:b})})}let ht={viewer:t.viewer??null,notify(b){if(e.open)L({type:"control",control:b})}},ve=(b)=>{if(!h)return;if(!p||!("kind"in p)||p.kind!=="simulator")ft.claim(ht);b(h)};return{opened(){C.relay_ms??=Z()},received(b){ut+=b.byteLength;let d;try{d=s.push(b)}catch{le("viewer_protocol");return}for(let m of d){if(e.done)return;switch(m.type){case"ping":L({type:"pong",token:m.token});break;case"pointer":ve((T)=>T.pointer(m.x,m.y,m.buttons));break;case"key":ve((T)=>T.key(m.down,m.keysym));break;case"clientClipboard":ve((T)=>T.clipboard(m.text));break;case"config":if(m.preset!==i)i=m.preset,Ne();break;case"keyframeRequest":if(u&&!c)Ne();break;case"ack":Mr(m.seq);break;case"audioEnable":if(m.on)Or();else de();break;default:break}}if(!f&&!e.done){if(f=!0,C.viewer_ms=Z(),t.viewer)Ae=ft.join(ht);yt(),mt()}},close(){if(Ae?.(),Ae=null,ke?.close(),_)clearInterval(_);if(E)clearInterval(E);clearTimeout(Te),x?.leave(Xe),de(),h?.close()},summary:()=>({output_bytes:lt,input_bytes:ut,video:{preset:i,frames:qe,dropped:re,restarts:Ee,avg_fps:ce!==null&&De>ce?Math.round((qe-1)/((De-ce)/1e6)*10)/10:0,min_rtt_ms:Math.round(Pe??0),p50_rtt_ms:B?Qr():0,audio_packets:A,audio_dropped:q,connect:C}})}}var xr=null,Dr=null,As=null,ks=null;function Xs(){let e=P();return e?.features.display?e.ffmpeg:null}function Tr(e){return xr??=new Promise((t)=>{os(e,["-hide_banner","-encoders"],{env:{},timeout:5000,killSignal:"SIGKILL",maxBuffer:1048576,encoding:"utf8"},(n,o)=>{let s=(i)=>!n&&new RegExp(`^\\s*V\\S*\\s+${i}\\s`,"m").test(o);t(Dr={x264:s("libx264"),videotoolbox:s("h264_videotoolbox")})})}),xr}var mr=null;function ji(){return mr??=(async()=>{let e=[P()?.ffmpeg,"/opt/homebrew/bin/ffmpeg","/usr/local/bin/ffmpeg"].find((n)=>Boolean(n&&is(n)));if(!e)return null;let t=await Tr(e);return t.videotoolbox||t.x264?e:null})(),mr}function ot(e=process.platform,t={}){if(e!=="linux"&&e!=="darwin"&&e!=="win32")return Promise.resolve(!1);let n=(t.ffmpeg??Xs)();if(!n)return Promise.resolve(!1);let o=(t.encoders??Tr)(n);if(e==="linux")return o.then((i)=>i.x264);if(e==="win32"){let i=t.windowsScreen?t.windowsScreen():ks??=Ut();return Promise.all([o,i]).then(([p,l])=>p.x264&&(l?.session??0)>0)}let s=t.macScreen?t.macScreen():As??=ze(nt());return Promise.all([o,s]).then(([i,p])=>(i.x264||i.videotoolbox)&&p?.screen===!0&&p.accessibility)}var Bs=43200000,_e=":99",Js=60000,we=15000,pt={width:1280,height:800},js=/^[A-Za-z0-9._:-]{1,160}$/;function Ws(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}var Fs=["video","viewer","viewer_same_network","viewer_network"];function $s(e,t=Date.now()){let n=["relay_url","session_id","expires_at"];if(!Ws(e)||n.some((l)=>!(l in e))||Object.keys(e).some((l)=>!n.includes(l)&&!Fs.includes(l)))throw new r("invalid_display_request","Reason desktop request is malformed.");let o="video"in e?oo(e.video):void 0,s="viewer"in e?On(e.viewer):null;if(o===null)throw new r("invalid_display_request","Reason desktop video request is invalid.");let i=null;try{i=typeof e.relay_url==="string"?new URL(e.relay_url):null}catch{}if(!i||i.protocol!=="wss:"&&i.protocol!=="ws:"||i.username||i.password)throw new r("invalid_display_request","Reason desktop relay URL is invalid.");if(typeof e.session_id!=="string"||!js.test(e.session_id))throw new r("invalid_display_request","Reason desktop session identity is invalid.");let p=typeof e.expires_at==="string"?Date.parse(e.expires_at):Number.NaN;if(!Number.isFinite(p)||p<=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(p,t+Bs)).toISOString(),...o?{video:o}:{},...s?{viewer:s}:{},...o&&e.viewer_same_network===!0?{viewer_same_network:!0}:{}}}function At(e=process.platform){return(e==="linux"||e==="darwin"||e==="win32")&&P()?.features.display===!0}async function us(){if(process.platform==="win32")return At()&&await ot();if(process.platform!=="darwin")return At();return await ot()}function V(e){Ms(e,{recursive:!0,mode:448});let t=Ls(e);if(!t.isDirectory()||t.isSymbolicLink()||process.getuid&&t.uid!==process.getuid())throw new r("display_unavailable","Reason desktop state directory is not private.");vs(e,448)}function Gs(e,t){let n=(s)=>{let i=Buffer.alloc(2);return i.writeUInt16BE(s.length),Buffer.concat([i,s])},o=Buffer.from([255,255]);return Buffer.concat([o,n(Buffer.alloc(0)),n(Buffer.from(e)),n(Buffer.from("MIT-MAGIC-COOKIE-1")),n(t)])}function ee(e,t,n=2000){return new Promise((o)=>{let s=Os(e),i="",p=(l)=>{s.destroy(),o(l)};s.setTimeout(n,()=>p(!1)),s.once("error",()=>p(!1)),s.once("close",()=>p(!1)),s.once("connect",()=>{if(!t)p(!0)}),s.on("data",(l)=>{if(i+=l.toString("latin1"),i.length>=4)p(i.startsWith("RFB "))})})}async function Xr(e,t){let n=Date.now()+t;while(Date.now()<n){if(await e())return!0;await new Promise((o)=>setTimeout(o,100))}return!1}function ct(e,t,n){return new Promise((o)=>{let s=Ar(e,t,{detached:!0,stdio:"ignore",env:n});s.once("error",()=>o(-1)),s.once("exit",(i)=>o(i)),s.unref(),setTimeout(()=>o(null),we).unref()})}var it=null;function Be(e=a()){return it??=Vs(e).finally(()=>{it=null}),it}async function Vs(e){let t=P({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.");gt({root:t.root,automation:t.automation,extensionDir:t.extensionDir});let n=X(t.root,"display");V(n);let o=await Is(e,n,t.x11vnc);if(o)return o;let s={display:_e,xauthority:X(n,"Xauthority"),rfbSocket:X(n,"rfb.sock")},i=X(n,"pulse"),p=(async()=>{try{V(i)}catch{return null}return await nr(i,t.pulseaudio)})(),l=X(n,"home");V(l);let h={HOME:l,PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:s.display,XAUTHORITY:s.xauthority};if(t.pulseaudio)h.PULSE_SERVER=Qe(Ye(i));let f=async()=>({...s,sound:await p});if(await ee({path:s.rfbSocket},!0))return await f();if(!kr(s.xauthority))at(s.xauthority,Gs(_e.slice(1),Ns(16)),{mode:384,flag:"wx"});let x=Zs(X(n,"theme"),s.display),u={path:`/tmp/.X11-unix/X${_e.slice(1)}`};if(!await ee(u,!1)){if(ct(t.xvfb,[s.display,"-screen","0",`${pt.width}x${pt.height}x24`,"-nolisten","tcp","-auth",s.xauthority],h),!await Xr(()=>ee(u,!1),we))throw new r("display_unavailable","Reason could not start the virtual display.");ct(t.openbox,["--config-file",x.openboxConfig],h)}if(await Ys(x,h),!await Cr(t.x11vnc,s,n,"x11vnc.log",h))throw new r("display_unavailable","Reason could not start the desktop server.");return await f()}async function Cr(e,t,n,o,s){if(await ee({path:t.rfbSocket},!0))return!0;Us(t.rfbSocket,{force:!0});let i=await ct(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",X(n,o)],s);if(i!==null&&i!==0)return!1;return await Xr(()=>ee({path:t.rfbSocket},!0),we)}async function Ks(){let e=["DISPLAY","XAUTHORITY","WAYLAND_DISPLAY","XDG_SESSION_TYPE"],t=(n)=>Object.fromEntries(e.flatMap((o)=>n[o]?[[o,n[o]]]:[]));if(process.env.DISPLAY)return t(process.env);try{let n=await new Promise((o,s)=>Cs("systemctl",["--user","show-environment"],{encoding:"utf8",timeout:2000},(i,p)=>i?s(i):o(p)));return t(Object.fromEntries(n.split(`
247
- `).flatMap((o)=>{let s=o.indexOf("=");return s>0?[[o.slice(0,s),o.slice(s+1)]]:[]})))}catch{return{}}}var Rr=new Set;async function Is(e,t,n){let o=await Ks(),s=/^:(\d+)(?:\.\d+)?$/.exec(o.DISPLAY??"")?.[1];if(!s||`:${s}`===_e||o.WAYLAND_DISPLAY||o.XDG_SESSION_TYPE==="wayland")return null;let i={display:`:${s}`,xauthority:o.XAUTHORITY??X(e,".Xauthority"),rfbSocket:X(t,`rfb-${s}.sock`)},p=`${i.display} ${i.xauthority}`;if(Rr.has(p)||!await ee({path:`/tmp/.X11-unix/X${s}`},!1))return null;let l={HOME:e,PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:i.display,XAUTHORITY:i.xauthority};if(await Cr(n,i,t,`x11vnc-${s}.log`,l))return{...i,sound:null};return Rr.add(p),process.stderr.write(`Reason worker: your screen ${i.display} could not be served; using the virtual desktop
248
- `),null}function Zs(e,t){let n=`chromium --no-first-run --no-default-browser-check${process.geteuid?.()===0?" --no-sandbox":""} %U`,o=[["terminal","xterm"],["files","pcmanfm"]].filter(([,i])=>!kr(`/usr/bin/${i}`)).map(([i])=>i),s=Rt({root:e,display:t,screen:pt,browserExec:n,absent:o});for(let i of["","openbox","tint2","picom"])V(X(e,i));for(let[i,p]of Object.entries(s.files))at(X(e,i),p,{mode:384});for(let[i,p]of Object.entries(Tt))at(X(e,`ara-${i}`),Qs(p),{mode:384});return{root:e,openboxConfig:X(e,"openbox","rc.xml"),start:s.start}}async function Ys(e,t){let n=[`ROOT=${JSON.stringify(e.root)}`,...e.start,"openbox --reconfigure >/dev/null 2>&1 || true"].join(`
249
- `);await new Promise((o)=>{let s=Ar("/bin/sh",["-c",n],{stdio:"ignore",env:{...t,PATH:"/usr/bin:/bin"}}),i=setTimeout(()=>{s.kill(),o()},we);s.once("error",()=>{clearTimeout(i),o()}),s.once("exit",()=>{clearTimeout(i),o()})})}async function Pt(e,t={}){let n=t.now??Date.now,o=$s(e.payload,n());if(e.signal.throwIfAborted(),!o.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 i=o.video,p=(t.video?.desktop??(s==="darwin"?async()=>hr:s==="win32"?async()=>gr:Be))();return await zs(e.signal,o,t,n,(l)=>Er(l,{request:i,desktop:p,...o.viewer?{viewer:o.viewer}:{},viewerSameNetwork:o.viewer_same_network===!0},t.video),(l)=>Fr({type:"error",code:l}))}function zs(e,t,n,o,s,i){let p=o();return new Promise((l,h)=>{let f=null,x=!1,u=!1,S,y,A,q=!1,c=null,_=(w)=>{if(u)return;if(c)w=c;u=!0,clearTimeout(S),clearTimeout(y),e.removeEventListener("abort",D),A?.close();try{f?.close(1000,"display_session_over")}catch{}if("error"in w){h(w.error);return}l({reason:w.reason,...A?.summary(),duration_ms:Math.max(0,o()-p)})},E=()=>_({error:new r("display_relay_unavailable","Reason could not reach the desktop relay.")}),D=()=>{let w=e.reason;_({error:w instanceof r?w:new r("cancelled","Reason closed the desktop session.")})},N=()=>{if(!c||!f)return;let w=c.error;try{f.send(i(w instanceof r?w.code:"display_unavailable"))}catch{}_(c)};if(A=s({get done(){return u||c!==null},get open(){return x&&!u&&c===null},get bufferedAmount(){return f?.bufferedAmount??0},send(w){if(u||c||!x||!f)return;try{f.send(w)}catch{_({reason:"relay_closed"})}},end:(w)=>{if(u||c)return;if(!("error"in w)){_(w);return}if(c=w,q&&x)N()}}),u){A.close();return}if(e.aborted){D();return}e.addEventListener("abort",D,{once:!0}),S=setTimeout(()=>_({reason:"session_expired"}),Math.max(1,Date.parse(t.expires_at)-o())),y=setTimeout(()=>_({reason:"viewer_absent"}),n.viewerWaitMs??Js);try{f=(n.connect??vr)(t.relay_url,(n.loadProxy??j)()?.url)}catch{E();return}f.binaryType="arraybuffer",f.onopen=()=>{if(u||!f)return;x=!0,A?.opened()},f.onmessage=(w)=>{if(u)return;let M=w.data,B=M instanceof ArrayBuffer?new Uint8Array(M):ArrayBuffer.isView(M)?new Uint8Array(M.buffer,M.byteOffset,M.byteLength):null;if(!B||B.byteLength===0)return;if(clearTimeout(y),q=!0,c){N();return}A?.received(B)},f.onclose=()=>{if(u)return;if(!x){E();return}_({reason:"relay_closed"})},f.onerror=()=>{if(u||x)return;E()}})}
250
- export{$e,Fi,F,Qe,ji,Ct,yr,P,Ui,At,us,V,Be,Pt};
@@ -1,4 +0,0 @@
1
- // @bun
2
- import{a}from"./vm-hands-entry-lite-89z488gz.js";import{readFileSync as c}from"fs";import{isAbsolute as l,normalize as i}from"path";var m="REASON_WORKER_DESKTOP_USER",u=null;function p(t,o){for(let s of o.split(`
3
- `)){let e=s.split(":");if(e.length<7||Number(e[2])!==t||!/^\d+$/.test(e[2])||!/^\d+$/.test(e[3]))continue;let n=e[5];if(!/^[a-z_][a-z0-9_-]*$/i.test(e[0])||!l(n)||i(n)!==n||n==="/")return null;return{username:e[0],uid:t,gid:Number(e[3]),home:n}}return null}function ds(t={}){let o="value"in t?t.value:process.env[m];if(u=null,o===void 0||o==="")return null;let s=t.platform??process.platform,e="euid"in t?t.euid:process.geteuid?.(),n=/^[1-9]\d{0,9}$/.test(o)?Number(o):NaN,r=s==="linux"&&e===0&&Number.isSafeInteger(n)?p(n,(t.passwd??(()=>c("/etc/passwd","utf8")))()):null;if(!r||r.gid===0)throw Error("worker_desktop_user_invalid");return u=r,r}function G(){return u}function kn(){return u?.home??a()}
4
- export{ds,G,kn};