@reason-machines/cli-linux-x64 0.2.559 → 0.2.560
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/reason +2 -2
- package/bin/vm-hands/agent-network-j5f603sy.js +2 -0
- package/bin/vm-hands/api-credentials-7rhpwe7n.js +2 -0
- package/bin/vm-hands/api-vkgf7wma.js +2 -0
- package/bin/vm-hands/ask-relay-2vf6fa2t.js +5 -0
- package/bin/vm-hands/connect-cli-06x1wfgv.js +2 -0
- package/bin/vm-hands/credentials-s7ps7y6s.js +2 -0
- package/bin/vm-hands/custom-endpoint-device-3xnrp33e.js +2 -0
- package/bin/vm-hands/desktop-account-eg8thn79.js +2 -0
- package/bin/vm-hands/device-workspace-h5rsecq8.js +2 -0
- package/bin/vm-hands/{fsevents-fev1pxw2.js → fsevents-vxv56sp5.js} +1 -1
- package/bin/vm-hands/hands-worker-source-vk664w8p.js +2 -0
- package/bin/vm-hands/{index-j6wffzfd.js → index-03p9c17x.js} +106 -106
- package/bin/vm-hands/install-receipt-j04hdw1k.js +2 -0
- package/bin/vm-hands/local-automation-8b1znx0p.js +2 -0
- package/bin/vm-hands/local-capabilities-m6pzcc94.js +2 -0
- package/bin/vm-hands/local-desktop-users-sq4trh07.js +2 -0
- package/bin/vm-hands/local-display-mac-yxcxvg2z.js +2 -0
- package/bin/vm-hands/local-display-session-zyd8s6n6.js +2 -0
- package/bin/vm-hands/local-display-video-rk680vwg.js +2 -0
- package/bin/vm-hands/local-managed-process-w26jhyfg.js +2 -0
- package/bin/vm-hands/local-pty-session-edd8ttf9.js +2 -0
- package/bin/vm-hands/managed-runtime-ykv5nyva.js +2 -0
- package/bin/vm-hands/network-auto-update-mrjz964a.js +3 -0
- package/bin/vm-hands/network-contract-8mxtma3w.js +2 -0
- package/bin/vm-hands/network-sign-in-8yvdx5rm.js +3 -0
- package/bin/vm-hands/package-vwvzjtn0.js +2 -0
- package/bin/vm-hands/permissions-nmxr8238.js +2 -0
- package/bin/vm-hands/reason-hands-protocol-1nkpw1v3.js +2 -0
- package/bin/vm-hands/serve-service-det934tz.js +2 -0
- package/bin/vm-hands/status-fr7192eh.js +96 -0
- package/bin/vm-hands/version-5d6gbmrd.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-0as6nsks.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-0ex2twm5.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-0wb1n769.js +9 -0
- package/bin/vm-hands/{vm-hands-entry-lite-a3p6xz53.js → vm-hands-entry-lite-2rgf8866.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-4jgykvd3.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-52qz0n30.js +7 -0
- package/bin/vm-hands/vm-hands-entry-lite-57ajjwmh.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-71ebge0c.js +42 -0
- package/bin/vm-hands/vm-hands-entry-lite-84mc1f7h.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-8pcs85ak.js +105 -0
- package/bin/vm-hands/vm-hands-entry-lite-8w0ah5j9.js +11 -0
- package/bin/vm-hands/vm-hands-entry-lite-8xv6c0rm.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-9g52kxyj.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-a6ss0ges.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-a7bf7xr7.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-ab1pq3xg.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-bnpdn6fw.js +127 -0
- package/bin/vm-hands/vm-hands-entry-lite-cspd38hc.js +539 -0
- package/bin/vm-hands/{vm-hands-entry-lite-q1yvw4xz.js → vm-hands-entry-lite-e3fn8ys2.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-f8p11q6h.js +452 -0
- package/bin/vm-hands/{vm-hands-entry-lite-jrce7v4r.js → vm-hands-entry-lite-f95mg81d.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-fhx46jny.js +10 -0
- package/bin/vm-hands/{vm-hands-entry-lite-506b6pcz.js → vm-hands-entry-lite-fk2s50nc.js} +5 -5
- package/bin/vm-hands/vm-hands-entry-lite-hjjbjpd7.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-hs6sdn60.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-hxfxs7r9.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-2v4zh9ze.js → vm-hands-entry-lite-j10cw3d9.js} +9 -9
- package/bin/vm-hands/{vm-hands-entry-lite-8rmbdm6c.js → vm-hands-entry-lite-jhsa4av7.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-jpvmkce5.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-k5ytpgzz.js +65 -0
- package/bin/vm-hands/{vm-hands-entry-lite-s85p7tqp.js → vm-hands-entry-lite-krpqqx12.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-q2h781jg.js → vm-hands-entry-lite-ms99mzp0.js} +3 -3
- package/bin/vm-hands/vm-hands-entry-lite-nn6zcvmp.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-46pwqvpf.js → vm-hands-entry-lite-ptycjmkc.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-pxtycfdv.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-q3er9m6y.js +9 -0
- package/bin/vm-hands/vm-hands-entry-lite-q9djb28r.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-q9s1e2y1.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-qegwyvyz.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-pzj5s203.js → vm-hands-entry-lite-qf990rxw.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-rhx6adbr.js +52 -0
- package/bin/vm-hands/vm-hands-entry-lite-sy7dcccg.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-tcmye5ny.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-tvnfm4xg.js +150 -0
- package/bin/vm-hands/{vm-hands-entry-lite-1yv5qqew.js → vm-hands-entry-lite-v4hr9x9h.js} +45 -45
- package/bin/vm-hands/vm-hands-entry-lite-vdv4nm5f.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-weqam12f.js +6 -0
- package/bin/vm-hands/vm-hands-entry-lite-y4df9n3f.js +345 -0
- package/bin/vm-hands/vm-hands-entry-lite-yvws5zpx.js +4 -0
- package/bin/vm-hands/{vm-hands-entry-lite-qd46yhvz.js → vm-hands-entry-lite-z0ht62s4.js} +3 -3
- package/bin/vm-hands/vm-hands-entry-lite-zawytz09.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-h2rq71rj.js → vm-hands-entry-lite-zh6ncdjn.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite.js +2 -2
- package/bin/vm-hands/{vm-hands-executor-p2jvbq5w.js → vm-hands-executor-qny3mx8f.js} +8 -8
- package/bin/vm-hands/vm-hands-op-runner-5q01rhkc.js +2 -0
- package/bin/vm-hands/{vm-hands-runtime-889hfy4p.js → vm-hands-runtime-gjjm5fzd.js} +3 -3
- package/bin/vm-hands/worker-preview-readiness-06tygyjs.js +2 -0
- package/bin/vm-hands/worker-sandbox-e1cpkzfz.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/api-credentials-x30e4ezb.js +0 -2
- package/bin/vm-hands/api-y6v8wdsq.js +0 -2
- package/bin/vm-hands/connect-cli-32wrv6sw.js +0 -2
- package/bin/vm-hands/credentials-sbza33ac.js +0 -2
- package/bin/vm-hands/custom-endpoint-device-mydksbg8.js +0 -2
- package/bin/vm-hands/desktop-account-t0afsge2.js +0 -2
- package/bin/vm-hands/device-workspace-b534qy2c.js +0 -2
- package/bin/vm-hands/hands-worker-source-qj7s9dk5.js +0 -2
- package/bin/vm-hands/install-receipt-zv1bjbgh.js +0 -2
- package/bin/vm-hands/local-automation-pwwqrnt7.js +0 -2
- package/bin/vm-hands/local-capabilities-scnpxe96.js +0 -2
- package/bin/vm-hands/local-desktop-users-5scb9930.js +0 -2
- package/bin/vm-hands/local-display-mac-pft73te9.js +0 -2
- package/bin/vm-hands/local-display-session-9362hqsn.js +0 -2
- package/bin/vm-hands/local-display-video-dndhr5v1.js +0 -2
- package/bin/vm-hands/local-managed-process-zm639p1g.js +0 -2
- package/bin/vm-hands/local-pty-session-njd0tprg.js +0 -2
- package/bin/vm-hands/managed-runtime-cqkw2mtn.js +0 -2
- package/bin/vm-hands/network-contract-kx0hz3wt.js +0 -2
- package/bin/vm-hands/package-way7qesn.js +0 -2
- package/bin/vm-hands/permissions-jxycbgay.js +0 -2
- package/bin/vm-hands/reason-hands-protocol-g54rtrhd.js +0 -2
- package/bin/vm-hands/serve-service-byvya1ym.js +0 -2
- package/bin/vm-hands/status-f1k1qmck.js +0 -10
- package/bin/vm-hands/version-czwf27v3.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-04x5xjt6.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-07apxfh8.js +0 -42
- package/bin/vm-hands/vm-hands-entry-lite-0wsr8edk.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-1tgxze8w.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-2twtpxmp.js +0 -9
- package/bin/vm-hands/vm-hands-entry-lite-3gbf905c.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-48rphbjm.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-4anjdcth.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-73f4cgkf.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-8dfw96ym.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-ak0hd94p.js +0 -7
- package/bin/vm-hands/vm-hands-entry-lite-bpamn7ny.js +0 -9
- package/bin/vm-hands/vm-hands-entry-lite-dgfx0rbn.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-ecz6fzds.js +0 -126
- package/bin/vm-hands/vm-hands-entry-lite-frd7e74y.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-fxzadxz4.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-gje7xvy9.js +0 -6
- package/bin/vm-hands/vm-hands-entry-lite-h1qjggz0.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-j3fw7x65.js +0 -14
- package/bin/vm-hands/vm-hands-entry-lite-jydpev8e.js +0 -452
- package/bin/vm-hands/vm-hands-entry-lite-k84zsash.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-kf2jgke1.js +0 -150
- package/bin/vm-hands/vm-hands-entry-lite-m0gsez4t.js +0 -539
- package/bin/vm-hands/vm-hands-entry-lite-n7bd44rm.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-p5ny1pw4.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-qcktp8d9.js +0 -52
- package/bin/vm-hands/vm-hands-entry-lite-ravxhygk.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-s0rx4fm8.js +0 -105
- package/bin/vm-hands/vm-hands-entry-lite-tyem93c1.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-vj7xzb3y.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-wghmyfba.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-wzv13c8k.js +0 -65
- package/bin/vm-hands/vm-hands-entry-lite-yptpy066.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-yretc2th.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-zf0h0qjy.js +0 -2
- package/bin/vm-hands/vm-hands-op-runner-2bfbyj4e.js +0 -2
- package/bin/vm-hands/worker-preview-readiness-gy36ejp9.js +0 -2
- package/bin/vm-hands/worker-sandbox-f1tfb3y0.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ot,D}from"./vm-hands-entry-lite-1tgxze8w.js";import{R}from"./vm-hands-entry-lite-a3p6xz53.js";import{_,rr}from"./vm-hands-entry-lite-4anjdcth.js";import{be}from"./vm-hands-entry-lite-yretc2th.js";function zi(e,i){let t=R(e,"REASON_API_URL")?.trim();if(!t)return rr(i);let n=new URL(t);if(n.protocol!=="https:"&&!(n.protocol==="http:"&&["127.0.0.1","localhost","::1"].includes(n.hostname)))throw Error("REASON_API_URL must use HTTPS (HTTP is allowed only for loopback development).");return n.origin}function es(e){return R(e,"REASON_API_URL")?.trim()?zi(e,"production"):void 0}function ts(e){return R(e,"REASON_API_KEY")?.trim()||void 0}async function As(e,i){let t=e.env??process.env,n=ts(t);if(!n)return(e.getCredentials??ot)({apiOrigin:es(t),signal:i});let a=zi(t,e.channel??_({env:t})),o=await(e.fetchImpl??fetch)(a+"/v3/self",{redirect:"error",headers:{authorization:"Bearer "+n,accept:"application/json"},signal:i}),p=await o.json().catch(()=>({})),r=be(p)?p:{};if(!o.ok){let s=typeof r.detail==="string"?r.detail:typeof r.message==="string"?r.message:"API key authentication failed ("+o.status+")";throw new D(o.status,typeof r.error==="string"?r.error:"api_key_auth_failed",s)}if(typeof r.org_id!=="string"||!r.org_id)throw Error("The API key in the environment did not resolve to a Workspace.");let l=Array.isArray(r.scopes)?r.scopes.filter((s)=>typeof s==="string"):[];return{credentialKind:"api_key",apiOrigin:a,accessToken:n,orgId:r.org_id,clientId:"api-key",refreshToken:"",expiresAt:"",scopes:l}}export{zi,es,ts,As};
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{qn,Wn,Oo,Qt}from"./vm-hands-entry-lite-2v4zh9ze.js";import{Bn,Xe,bo,Fn,jn,Hn,Ur,x}from"./vm-hands-entry-lite-ecz6fzds.js";import{Pt}from"./vm-hands-entry-lite-qd46yhvz.js";import{Ir}from"./vm-hands-entry-lite-0wsr8edk.js";import{j}from"./vm-hands-entry-lite-dgfx0rbn.js";import{a}from"./vm-hands-entry-lite-8dfw96ym.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as ce,spawn as ne}from"child_process";import{randomBytes as he}from"crypto";import{chmodSync as Je,existsSync as ae,lstatSync as Qe,mkdirSync as Se,readFileSync as oe,rmSync as ie,writeFileSync as u}from"fs";import{connect as Te}from"net";import{join as I}from"path";var B=32,Y=76;var m="./desktop-wallpaper-fd8f2wb2.jpg";var v="./dock-browser-y53t41cx.png";var Z="./dock-files-cp52htdw.png";var V="./dock-terminal-1es514yq.png";var z="./grok-wallpaper-71zwn2pj.jpg";var W="./grok-dock-browser-pzw59wnd.png";var U="./grok-dock-files-eckq444x.png";var ee="./grok-dock-terminal-hcpz3e43.png";var re=`# Sets the X root window background and _XROOTPMAP_ID, as feh --bg-fill does.
|
|
3
|
-
# The native Blaxel image ships no feh, hsetroot or compositor, but it does ship
|
|
4
|
-
# python3-gi and libX11. tint2 reads _XROOTPMAP_ID to draw its transparent panel.
|
|
5
|
-
# Usage: DISPLAY=:99 python3 set-root-wallpaper.py IMAGE
|
|
6
|
-
import ctypes, sys
|
|
7
|
-
import gi
|
|
8
|
-
gi.require_version("GdkPixbuf", "2.0")
|
|
9
|
-
from gi.repository import GdkPixbuf
|
|
10
|
-
x = ctypes.cdll.LoadLibrary("libX11.so.6")
|
|
11
|
-
x.XOpenDisplay.restype = ctypes.c_void_p
|
|
12
|
-
x.XOpenDisplay.argtypes = [ctypes.c_char_p]
|
|
13
|
-
d = x.XOpenDisplay(None)
|
|
14
|
-
if not d: sys.exit("no display")
|
|
15
|
-
for name, res, args in [
|
|
16
|
-
("XDefaultScreen", ctypes.c_int, [ctypes.c_void_p]),
|
|
17
|
-
("XRootWindow", ctypes.c_ulong, [ctypes.c_void_p, ctypes.c_int]),
|
|
18
|
-
("XDisplayWidth", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
|
|
19
|
-
("XDisplayHeight", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
|
|
20
|
-
("XDefaultDepth", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
|
|
21
|
-
("XDefaultVisual", ctypes.c_void_p, [ctypes.c_void_p, ctypes.c_int]),
|
|
22
|
-
("XDefaultGC", ctypes.c_void_p, [ctypes.c_void_p, ctypes.c_int]),
|
|
23
|
-
("XCreatePixmap", ctypes.c_ulong, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint]),
|
|
24
|
-
("XCreateImage", ctypes.c_void_p, [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint, ctypes.c_int, ctypes.c_int]),
|
|
25
|
-
("XPutImage", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_uint, ctypes.c_uint]),
|
|
26
|
-
("XInternAtom", ctypes.c_ulong, [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int]),
|
|
27
|
-
("XChangeProperty", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_int, ctypes.c_int, ctypes.c_void_p, ctypes.c_int]),
|
|
28
|
-
("XSetWindowBackgroundPixmap", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_ulong]),
|
|
29
|
-
("XClearWindow", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong]),
|
|
30
|
-
("XSetCloseDownMode", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
|
|
31
|
-
("XCloseDisplay", ctypes.c_int, [ctypes.c_void_p]),
|
|
32
|
-
]:
|
|
33
|
-
f = getattr(x, name); f.restype = res; f.argtypes = args
|
|
34
|
-
s = x.XDefaultScreen(d); root = x.XRootWindow(d, s)
|
|
35
|
-
w, h = x.XDisplayWidth(d, s), x.XDisplayHeight(d, s)
|
|
36
|
-
if x.XDefaultDepth(d, s) != 24: sys.exit("unsupported depth")
|
|
37
|
-
# Scale to cover the screen, then crop the centre.
|
|
38
|
-
src = GdkPixbuf.Pixbuf.new_from_file(sys.argv[1])
|
|
39
|
-
k = max(w / src.get_width(), h / src.get_height())
|
|
40
|
-
sw, sh = max(w, round(src.get_width() * k)), max(h, round(src.get_height() * k))
|
|
41
|
-
pb = src.scale_simple(sw, sh, GdkPixbuf.InterpType.BILINEAR).new_subpixbuf((sw - w) // 2, (sh - h) // 2, w, h).copy()
|
|
42
|
-
if pb.get_has_alpha(): pb = pb.composite_color_simple(w, h, GdkPixbuf.InterpType.NEAREST, 255, 1, 0, 0)
|
|
43
|
-
rgb, stride = pb.get_pixels(), pb.get_rowstride()
|
|
44
|
-
bgrx = bytearray(w * h * 4)
|
|
45
|
-
for y in range(h):
|
|
46
|
-
row = rgb[y * stride:y * stride + w * 3]; o = y * w * 4
|
|
47
|
-
bgrx[o:o + w * 4:4] = row[2::3]; bgrx[o + 1:o + w * 4:4] = row[1::3]; bgrx[o + 2:o + w * 4:4] = row[0::3]
|
|
48
|
-
buf = ctypes.create_string_buffer(bytes(bgrx), len(bgrx))
|
|
49
|
-
pix = x.XCreatePixmap(d, root, w, h, 24)
|
|
50
|
-
img = x.XCreateImage(d, x.XDefaultVisual(d, s), 24, 2, 0, buf, w, h, 32, 0) # ZPixmap
|
|
51
|
-
x.XPutImage(d, pix, x.XDefaultGC(d, s), img, 0, 0, 0, 0, w, h)
|
|
52
|
-
ref = ctypes.c_ulong(pix)
|
|
53
|
-
for atom in (b"_XROOTPMAP_ID", b"ESETROOT_PMAP_ID"):
|
|
54
|
-
x.XChangeProperty(d, root, x.XInternAtom(d, atom, 0), 20, 32, 0, ctypes.byref(ref), 1) # XA_PIXMAP, PropModeReplace
|
|
55
|
-
x.XSetWindowBackgroundPixmap(d, root, pix)
|
|
56
|
-
x.XClearWindow(d, root)
|
|
57
|
-
x.XSetCloseDownMode(d, 1) # RetainPermanent: the pixmap outlives this process
|
|
58
|
-
x.XCloseDisplay(d)
|
|
59
|
-
`;function Ne(e){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
60
|
-
<openbox_config xmlns="http://openbox.org/3.4/rc">
|
|
61
|
-
<theme><keepBorder>no</keepBorder></theme>
|
|
62
|
-
<applications>
|
|
63
|
-
<!-- Debian Chromium is "Chromium"; Chrome for Testing is "Chromium-browser". -->
|
|
64
|
-
<application class="Chromium*">
|
|
65
|
-
<decor>no</decor>
|
|
66
|
-
<position force="yes"><x>${B}</x><y>${B}</y></position>
|
|
67
|
-
<size><width>${e.width-B*2}</width><height>${e.height-B-Y}</height></size>
|
|
68
|
-
</application>
|
|
69
|
-
</applications>
|
|
70
|
-
</openbox_config>`}var ue=`# 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-files.desktop
|
|
90
|
-
launcher_item_app = /tmp/ara-terminal.desktop
|
|
91
|
-
`,De=32,Re=`# Remote sandbox dock (grok look) \u2014 small launcher icons only, centred, no panel fill
|
|
92
|
-
panel_items = L
|
|
93
|
-
panel_size = 100% ${De+16}
|
|
94
|
-
panel_margin = 0 0
|
|
95
|
-
panel_padding = 0 0 8
|
|
96
|
-
panel_position = bottom center horizontal
|
|
97
|
-
panel_shrink = 1
|
|
98
|
-
panel_background_id = 0
|
|
99
|
-
panel_layer = top
|
|
100
|
-
mouse_effects = 1
|
|
101
|
-
mouse_hover_icon_asb = 100 0 10
|
|
102
|
-
mouse_pressed_icon_asb = 100 0 -10
|
|
103
|
-
|
|
104
|
-
launcher_icon_size = ${De}
|
|
105
|
-
launcher_padding = 0 0 8
|
|
106
|
-
launcher_background_id = 0
|
|
107
|
-
launcher_tooltip = 1
|
|
108
|
-
|
|
109
|
-
launcher_item_app = /tmp/ara-chromium.desktop
|
|
110
|
-
launcher_item_app = /tmp/ara-files.desktop
|
|
111
|
-
launcher_item_app = /tmp/ara-terminal.desktop
|
|
112
|
-
`,ge=`corner-radius = 12;
|
|
113
|
-
rounded-corners-exclude = [
|
|
114
|
-
"class_g = 'tint2'",
|
|
115
|
-
"window_type = 'dock'",
|
|
116
|
-
"window_type = 'desktop'"
|
|
117
|
-
];
|
|
118
|
-
backend = "xrender";
|
|
119
|
-
shadow = false;
|
|
120
|
-
fading = false;
|
|
121
|
-
vsync = false;
|
|
122
|
-
inactive-opacity = 1.0;
|
|
123
|
-
active-opacity = 1.0;
|
|
124
|
-
`,Ke="/tmp/ara-dock-browser.png",Fe=`[Desktop Entry]
|
|
125
|
-
Name=Chrome
|
|
126
|
-
Exec=chromium --no-sandbox %U
|
|
127
|
-
Icon=${Ke}
|
|
128
|
-
Type=Application
|
|
129
|
-
Categories=Network;WebBrowser;
|
|
130
|
-
`,Ce=`[Desktop Entry]
|
|
131
|
-
Name=Terminal
|
|
132
|
-
Exec=bash -c "DISPLAY=:99 xterm -fa DejaVuSansMono -fs 11 -bg black -fg white"
|
|
133
|
-
Icon=/tmp/ara-dock-terminal.png
|
|
134
|
-
Type=Application
|
|
135
|
-
Categories=System;TerminalEmulator;
|
|
136
|
-
`,$e=`[Desktop Entry]
|
|
137
|
-
Name=Files
|
|
138
|
-
Exec=bash -c "DISPLAY=:99 pcmanfm --no-desktop"
|
|
139
|
-
Icon=/tmp/ara-dock-files.png
|
|
140
|
-
Type=Application
|
|
141
|
-
Categories=System;FileManager;
|
|
142
|
-
`;var te={"wallpaper.jpg":m,"dock-browser.png":v,"dock-terminal.png":V,"dock-files.png":Z,"grok-wallpaper.jpg":z,"grok-dock-browser.png":W,"grok-dock-terminal.png":ee,"grok-dock-files.png":U},Ge=re,Oe='set_wallpaper() { if command -v feh >/dev/null 2>&1; then feh --bg-fill "$1"; else python3 "$2" "$1"; fi; }';function de(e){let D=(p)=>p.replaceAll("DISPLAY=:99",`DISPLAY=${e.display}`).replaceAll("/tmp/ara-",`${e.root}/ara-`),s=e.look==="grok",d=new Set(e.absent??[]),t=d.has("files")&&e.filesViewerExec?e.filesViewerExec:null;if(t)d.delete("files");let c=(s?Re:ue).split(`
|
|
143
|
-
`).filter((p)=>!(d.has("terminal")&&p.endsWith("/ara-terminal.desktop"))&&!(d.has("files")&&p.endsWith("/ara-files.desktop"))).join(`
|
|
144
|
-
`),n=(p)=>s?p.replace("/tmp/ara-dock-","/tmp/ara-grok-dock-"):p,o=t?$e.replace(/^Exec=.*$/m,`Exec=${t}`).replace("Categories=System;FileManager;","Categories=Utility;Viewer;"):$e,f=s?"ara-grok-wallpaper.jpg":"ara-wallpaper.jpg",i={"openbox/rc.xml":Ne(e.screen),"tint2/tint2rc":D(c),"picom/picom.conf":ge,...d.has("terminal")?{}:{"ara-terminal.desktop":D(n(Ce))},...d.has("files")?{}:{"ara-files.desktop":D(n(o))},"ara-chromium.desktop":D(n(Fe)).replace("chromium --no-sandbox %U",e.browserExec),"ara-set-root-wallpaper.py":Ge},X=[...N.slice(0,3),Oe,`[ ! -f "$ROOT/${f}" ] || set_wallpaper "$ROOT/${f}" "$ROOT/ara-set-root-wallpaper.py" || true`,'if alive tint2 && ! cmp -s "$ROOT/tint2/tint2rc" "$ROOT/tint2/applied"; then read -r pid _ <"$ROOT/tint2.pid"; kill -USR1 "$pid" 2>/dev/null || true; fi','cp "$ROOT/tint2/tint2rc" "$ROOT/tint2/applied" 2>/dev/null || true',...N.slice(3)];return{files:i,start:X}}var N=['ticks() { line=$(cat "/proc/$1/stat" 2>/dev/null) || return 1; rest=${line##*) }; case $rest in Z*|X*) return 1;; esac; printf "%s" "$rest" | cut -d " " -f20; }','alive() { [ -f "$ROOT/$1.pid" ] || return 1; read -r pid start <"$ROOT/$1.pid"; current=$(ticks "$pid") || return 1; [ "$current" = "$start" ] && kill -0 "$pid" 2>/dev/null; }','launch() { name=$1; shift; "$@" 9>&- >"$ROOT/$name.log" 2>&1 & pid=$!; start=$(ticks "$pid"); printf "%s %s\\n" "$pid" "$start" >"$ROOT/$name.pid"; }','if [ -f "$ROOT/tint2/tint2rc" ] && ! alive tint2 && command -v tint2 >/dev/null 2>&1; then launch tint2 tint2 -c "$ROOT/tint2/tint2rc"; fi','if [ -f "$ROOT/picom/picom.conf" ] && ! alive picom && command -v picom >/dev/null 2>&1; then launch picom picom --config "$ROOT/picom/picom.conf"; fi'];var ke=43200000,A=":99",_e=60000,P=15000,R={width:1280,height:800},we=/^[A-Za-z0-9._:-]{1,160}$/;function Me(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}var me=["video","viewer","viewer_same_network","viewer_network","look"];function ve(e,D=Date.now()){let s=["relay_url","session_id","expires_at"];if(!Me(e)||s.some((f)=>!(f in e))||Object.keys(e).some((f)=>!s.includes(f)&&!me.includes(f)))throw new r("invalid_display_request","Reason desktop request is malformed.");let d="video"in e?Oo(e.video):void 0,t="viewer"in e?qn(e.viewer):null,c="look"in e?Wn(e.look):null;if(d===null)throw new r("invalid_display_request","Reason desktop video request is invalid.");let n=null;try{n=typeof e.relay_url==="string"?new URL(e.relay_url):null}catch{}if(!n||n.protocol!=="wss:"&&n.protocol!=="ws:"||n.username||n.password)throw new r("invalid_display_request","Reason desktop relay URL is invalid.");if(typeof e.session_id!=="string"||!we.test(e.session_id))throw new r("invalid_display_request","Reason desktop session identity is invalid.");let o=typeof e.expires_at==="string"?Date.parse(e.expires_at):Number.NaN;if(!Number.isFinite(o)||o<=D)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(o,D+ke)).toISOString(),...d?{video:d}:{},...t?{viewer:t}:{},...d&&e.viewer_same_network===!0?{viewer_same_network:!0}:{},...c?{look:c}:{}}}function Ft(e=process.platform){return(e==="linux"||e==="darwin"||e==="win32")&&x()?.features.display===!0}async function Vs(){if(process.platform==="win32")return Ft()&&await Ur();if(process.platform!=="darwin")return Ft();return await Ur()}function G(e){Se(e,{recursive:!0,mode:448});let D=Qe(e);if(!D.isDirectory()||D.isSymbolicLink()||process.getuid&&D.uid!==process.getuid())throw new r("display_unavailable","Reason desktop state directory is not private.");Je(e,448)}function Ze(e,D){let s=(t)=>{let c=Buffer.alloc(2);return c.writeUInt16BE(t.length),Buffer.concat([c,t])},d=Buffer.from([255,255]);return Buffer.concat([d,s(Buffer.alloc(0)),s(Buffer.from(e)),s(Buffer.from("MIT-MAGIC-COOKIE-1")),s(D)])}function y(e,D,s=2000){return new Promise((d)=>{let t=Te(e),c="",n=(o)=>{t.destroy(),d(o)};t.setTimeout(s,()=>n(!1)),t.once("error",()=>n(!1)),t.once("close",()=>n(!1)),t.once("connect",()=>{if(!D)n(!0)}),t.on("data",(o)=>{if(c+=o.toString("latin1"),c.length>=4)n(c.startsWith("RFB "))})})}async function Q(e,D){let s=Date.now()+D;while(Date.now()<s){if(await e())return!0;await new Promise((d)=>setTimeout(d,100))}return!1}function g(e,D,s){return new Promise((d)=>{let t=ne(e,D,{detached:!0,stdio:"ignore",env:s});t.once("error",()=>d(-1)),t.once("exit",(c)=>d(c)),t.unref(),setTimeout(()=>d(null),P).unref()})}var J=null;function qe(e=a()){return J??=Ve(e).finally(()=>{J=null}),J}async function Ve(e){let D=x({home:e});if(!D?.xvfb||!D.x11vnc||!D.openbox)throw new r("display_unavailable","Run `reason desktop install` on this machine to enable its desktop.");Pt({root:D.root,automation:D.automation,extensionDir:D.extensionDir});let s=I(D.root,"display");G(s);let d=await We(e,s,D.x11vnc);if(d)return d;let t={display:A,xauthority:I(s,"Xauthority"),rfbSocket:I(s,"rfb.sock")},c=I(s,"pulse"),n=(async()=>{try{G(c)}catch{return null}return await bo(c,D.pulseaudio)})();G(I(s,"home"));let o=S(s,t,D.pulseaudio),f=async()=>({...t,sound:await n});if(await y({path:t.rfbSocket},!0))return be(I(s,"theme"),N,o),await f();if(!ae(t.xauthority))u(t.xauthority,Ze(A.slice(1),he(16)),{mode:384,flag:"wx"});let i=T(I(s,"theme"),t.display,R,e),X={path:`/tmp/.X11-unix/X${A.slice(1)}`};if(!await y(X,!1)){let p=`${R.width}x${R.height}`;if(D.xvnc)ie(t.rfbSocket,{force:!0}),g(D.xvnc,[t.display,"-geometry",p,"-depth","24","-nolisten","tcp","-auth",t.xauthority,"-rfbport","-1","-rfbunixpath",t.rfbSocket,"-SecurityTypes","None","-UseBlacklist=0","-AlwaysShared","-desktop","Reason"],o);else g(D.xvfb,[t.display,"-screen","0",`${p}x24`,"-nolisten","tcp","-auth",t.xauthority],o);if(!await Q(()=>y(X,!1),P)||D.xvnc&&!await Q(()=>y({path:t.rfbSocket},!0),P))throw new r("display_unavailable","Reason could not start the virtual display.");g(D.openbox,["--config-file",i.openboxConfig],o)}if(await k(i,o),!await fe(D.x11vnc,t,s,"x11vnc.log",o))throw new r("display_unavailable","Reason could not start the desktop server.");return await f()}function S(e,D,s){let d={HOME:I(e,"home"),PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:D.display,XAUTHORITY:D.xauthority};if(s)d.PULSE_SERVER=Xe(Bn(I(e,"pulse")));return d}async function fe(e,D,s,d,t){if(await y({path:D.rfbSocket},!0))return!0;ie(D.rfbSocket,{force:!0});let c=await g(e,["-display",D.display,"-auth",D.xauthority,"-rfbport","0","-rfbportv6","-1","-unixsock",D.rfbSocket,"-nopw","-forever","-shared","-noxdamage","-sb","0","-rfbversion","3.7","-quiet","-bg","-o",I(s,d)],t);if(c!==null&&c!==0)return!1;return await Q(()=>y({path:D.rfbSocket},!0),P)}async function ze(){let e=["DISPLAY","XAUTHORITY","WAYLAND_DISPLAY","XDG_SESSION_TYPE"],D=(s)=>Object.fromEntries(e.flatMap((d)=>s[d]?[[d,s[d]]]:[]));if(process.env.DISPLAY)return D(process.env);try{let s=await new Promise((d,t)=>ce("systemctl",["--user","show-environment"],{encoding:"utf8",timeout:2000},(c,n)=>c?t(c):d(n)));return D(Object.fromEntries(s.split(`
|
|
145
|
-
`).flatMap((d)=>{let t=d.indexOf("=");return t>0?[[d.slice(0,t),d.slice(t+1)]]:[]})))}catch{return{}}}var se=new Set;async function We(e,D,s){let d=await ze(),t=/^:(\d+)(?:\.\d+)?$/.exec(d.DISPLAY??"")?.[1];if(!t||`:${t}`===A||d.WAYLAND_DISPLAY||d.XDG_SESSION_TYPE==="wayland")return null;let c={display:`:${t}`,xauthority:d.XAUTHORITY??I(e,".Xauthority"),rfbSocket:I(D,`rfb-${t}.sock`)},n=`${c.display} ${c.xauthority}`;if(se.has(n)||!await y({path:`/tmp/.X11-unix/X${t}`},!1))return null;let o={HOME:e,PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:c.display,XAUTHORITY:c.xauthority};if(await fe(s,c,D,`x11vnc-${t}.log`,o))return{...c,sound:null};return se.add(n),process.stderr.write(`Reason worker: your screen ${c.display} could not be served; using the virtual desktop
|
|
146
|
-
`),null}var Ie="look";function pe(e){try{return Wn(oe(I(e,Ie),"utf8").trim())??"reason"}catch{return"reason"}}function T(e,D,s,d,t=pe(e)){let c=`chromium --no-first-run --no-default-browser-check${process.geteuid?.()===0?" --no-sandbox":""} %U`,n=[["terminal","xterm"],["files","pcmanfm"]].filter(([,i])=>!ae(`/usr/bin/${i}`)).map(([i])=>i),o=`${c.replace(/ %U$/,"")} --app=file://${I(d,".reason","workspace")}/`,f=de({root:e,display:D,screen:s,browserExec:c,absent:n,look:t,filesViewerExec:o});for(let i of["","openbox","tint2","picom"])G(I(e,i));u(I(e,Ie),`${t}
|
|
147
|
-
`,{mode:384});for(let[i,X]of Object.entries(f.files))u(I(e,i),X,{mode:384});for(let[i,X]of Object.entries(te))u(I(e,`ara-${i}`),oe(X),{mode:384});return{root:e,openboxConfig:I(e,"openbox","rc.xml"),start:f.start}}function k(e,D){return be(e.root,[...e.start,"openbox --reconfigure >/dev/null 2>&1 || true"],D)}function be(e,D,s){let d=[`ROOT=${JSON.stringify(e)}`,...D].join(`
|
|
148
|
-
`);return new Promise((t)=>{let c=ne("/bin/sh",["-c",d],{stdio:"ignore",env:{...s,PATH:"/usr/bin:/bin"}}),n=setTimeout(()=>{c.kill(),t()},P);c.once("error",()=>{clearTimeout(n),t()}),c.once("exit",()=>{clearTimeout(n),t()})})}var je=2073600,Ue=320;function er(e,D){let s=Math.min(1,Math.sqrt(je/(e.width*e.height))),d=(t,c)=>Math.min(Math.floor(c/8)*8,Math.max(Ue,Math.round(t*s/8)*8));return{width:d(e.width,D.width),height:d(e.height,D.height)}}function _(e,D,s){return new Promise((d)=>ce(e,D,{env:s,encoding:"utf8",timeout:5000},(t,c)=>d(t?null:c)))}function le(e){let D=/current (\d+) x (\d+), maximum (\d+) x (\d+)/.exec(e),s=e.split(`
|
|
149
|
-
`),d=s.findIndex((c)=>/^\S+ connected/.test(c));if(!D||d<0)return null;let t=[];for(let c of s.slice(d+1)){let n=/^\s+(\d+x\d+)\s/.exec(c);if(!n)break;t.push(n[1])}return{current:{width:Number(D[1]),height:Number(D[2])},maximum:{width:Number(D[3]),height:Number(D[4])},output:s[d].split(" ")[0],modes:t}}async function rr(e,D,s){if(e.display!==A)return null;let d={PATH:"/usr/bin:/bin",DISPLAY:e.display,XAUTHORITY:e.xauthority},t=(f)=>_("xrandr",f,d),c=le(await t(["--query"])??"");if(!c||c.maximum.width<=c.current.width&&c.maximum.height<=c.current.height)return null;let n=er(D,c.maximum);if(n.width===c.current.width&&n.height===c.current.height)return{size:n,changed:!1};let o=`${n.width}x${n.height}`;if(!c.modes.includes(o)){if(await t(["--newmode",o,"60",...[n.width,n.width,n.width,n.width,n.height,n.height,n.height,n.height].map(String)]),await t(["--addmode",c.output,o])===null)return null}return s(),await t(["--output",c.output,"--mode",o])===null?null:{size:n,changed:!0}}async function Dr(e,D){let s=a(),d=x({home:s});if(!d)return;let t=I(d.root,"display"),c=S(t,e,d.pulseaudio);await k(T(I(t,"theme"),e.display,D,s),c);let n=D.width-B*2,o=D.height-B-Y;await _("xdotool",["search","--onlyvisible","--class","Chromium","windowsize","%@",String(n),String(o),"windowmove","%@",String(B),String(B)],{...c,PATH:"/usr/bin:/bin"})}var K=Promise.resolve();function $r(e,D,s=()=>{}){let d=K.then(()=>rr(e,D,s));return K=d.then((t)=>t?.changed?Dr(e,t.size):void 0).catch(()=>{}),d.then((t)=>t?.size??null,()=>null)}function tr(e,D){if(e.display!==A)return Promise.resolve();let s=K.then(async()=>{let d=a(),t=x({home:d});if(!t)return;let c=I(t.root,"display"),n=I(c,"theme");if(pe(n)===D)return;let o=S(c,e,t.pulseaudio),f=le(await _("xrandr",["--query"],{PATH:"/usr/bin:/bin",DISPLAY:e.display,XAUTHORITY:e.xauthority})??"");await k(T(n,e.display,f?.current??R,d,D),o)});return K=s.catch(()=>{}),s.catch(()=>{})}async function jt(e,D={}){let s=D.now??Date.now,d=ve(e.payload,s());if(e.signal.throwIfAborted(),!d.video)throw new r("display_video_required","Reason desktops stream as video now; this request came without it.");let t=D.platform??process.platform;if(t!=="linux"&&t!=="darwin"&&t!=="win32")throw new r("display_video_unsupported","This machine does not serve desktop video.");let{video:c,look:n}=d,o=(D.video?.desktop??(t==="darwin"?async()=>Fn:t==="win32"?async()=>jn:async()=>{let f=await qe();if(n)await tr(f,n);return f}))();return await dr(e.signal,d,D,s,(f)=>Hn(f,{request:c,desktop:o,...d.viewer?{viewer:d.viewer}:{},viewerSameNetwork:d.viewer_same_network===!0},{resizeDesktop:$r,...D.video}),(f)=>Qt({type:"error",code:f}))}function dr(e,D,s,d,t,c){let n=d();return new Promise((o,f)=>{let i=null,X=!1,p=!1,w,F,L,q=!1,l=null,E=(b)=>{if(p)return;if(l)b=l.outcome;p=!0,clearTimeout(w),clearTimeout(F),e.removeEventListener("abort",O),L?.close();try{i?.close(1000,"display_session_over")}catch{}if("error"in b){f(b.error);return}o({reason:b.reason,...L?.summary(),duration_ms:Math.max(0,d()-n)})},C=()=>E({error:new r("display_relay_unavailable","Reason could not reach the desktop relay.")}),O=()=>{let b=e.reason;E({error:b instanceof r?b:new r("cancelled","Reason closed the desktop session.")})},M=()=>{if(!l||!i)return;let{outcome:b}=l,H=!("error"in b)?b.reason:b.error instanceof r?b.error.code:"display_unavailable";if(!l.told)try{i.send(c(H))}catch{}E(b)};if(L=t({get done(){return p||l!==null},get open(){return X&&!p&&l===null},get bufferedAmount(){return i?.bufferedAmount??0},send(b){if(p||l||!X||!i)return;try{i.send(b)}catch{E({reason:"relay_closed"})}},end:(b)=>{if(p||l)return;if(!("error"in b)&&q&&X){E(b);return}if(l={outcome:b,told:!("error"in b)&&X},q&&X)M()}}),p){L.close();return}if(e.aborted){O();return}e.addEventListener("abort",O,{once:!0}),w=setTimeout(()=>E({reason:"session_expired"}),Math.max(1,Date.parse(D.expires_at)-d())),F=setTimeout(()=>E({reason:"viewer_absent"}),s.viewerWaitMs??_e);try{i=(s.connect??Ir)(D.relay_url,(s.loadProxy??j)()?.url)}catch{C();return}i.binaryType="arraybuffer",i.onopen=()=>{if(p||!i)return;X=!0,L?.opened()},i.onmessage=(b)=>{if(p)return;let H=b.data,h=H instanceof ArrayBuffer?new Uint8Array(H):ArrayBuffer.isView(H)?new Uint8Array(H.buffer,H.byteOffset,H.byteLength):null;if(!h||h.byteLength===0)return;if(clearTimeout(F),q=!0,l){M();return}L?.received(h)},i.onclose=()=>{if(p)return;if(!X){C();return}E({reason:"relay_closed"})},i.onerror=()=>{if(p||X)return;C()}})}
|
|
150
|
-
export{Ft,Vs,G,qe,jt};
|