@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
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ts,rs,Tc,Rn}from"./vm-hands-entry-lite-j10cw3d9.js";import{zo,Kt,uc,qo,Wo,Vo,Jt,T}from"./vm-hands-entry-lite-bnpdn6fw.js";import{Br}from"./vm-hands-entry-lite-z0ht62s4.js";import{_i}from"./vm-hands-entry-lite-hxfxs7r9.js";import{Se}from"./vm-hands-entry-lite-pxtycfdv.js";import{s}from"./vm-hands-entry-lite-zawytz09.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as de,spawn as se}from"child_process";import{randomBytes as qe}from"crypto";import{chmodSync as Ce,existsSync as ce,lstatSync as Ge,mkdirSync as Oe,readFileSync as ne,rmSync as ae,writeFileSync as N}from"fs";import{connect as he}from"net";import{join as I}from"path";var B=32,P=76;var M="./desktop-wallpaper-fd8f2wb2.jpg";var m="./dock-browser-y53t41cx.png";var v="./dock-files-cp52htdw.png";var Z="./dock-terminal-1es514yq.png";var V="./grok-wallpaper-71zwn2pj.jpg";var z="./grok-dock-browser-pzw59wnd.png";var W="./grok-dock-files-eckq444x.png";var j="./grok-dock-terminal-hcpz3e43.png";var U=`# 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 Ae(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-P}</height></size>
|
|
68
|
+
</application>
|
|
69
|
+
</applications>
|
|
70
|
+
</openbox_config>`}var Pe=`# 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
|
+
`,ee=32,Ye=`# Remote sandbox dock (grok look) \u2014 small launcher icons only, centred, no panel fill
|
|
92
|
+
panel_items = L
|
|
93
|
+
panel_size = 100% ${ee+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 = ${ee}
|
|
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
|
+
`,Ne=`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
|
+
`,ue="/tmp/ara-dock-browser.png",Re=`[Desktop Entry]
|
|
125
|
+
Name=Chrome
|
|
126
|
+
Exec=chromium --no-sandbox %U
|
|
127
|
+
Icon=${ue}
|
|
128
|
+
Type=Application
|
|
129
|
+
Categories=Network;WebBrowser;
|
|
130
|
+
`,ge=`[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
|
+
`,re=`[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 De={"wallpaper.jpg":M,"dock-browser.png":m,"dock-terminal.png":Z,"dock-files.png":v,"grok-wallpaper.jpg":V,"grok-dock-browser.png":z,"grok-dock-terminal.png":j,"grok-dock-files.png":W},Ke=U,Fe='set_wallpaper() { if command -v feh >/dev/null 2>&1; then feh --bg-fill "$1"; else python3 "$2" "$1"; fi; }';function $e(e){let D=(p)=>p.replaceAll("DISPLAY=:99",`DISPLAY=${e.display}`).replaceAll("/tmp/ara-",`${e.root}/ara-`),c=e.look==="grok",d=new Set(e.absent??[]),t=d.has("files")&&e.filesViewerExec?e.filesViewerExec:null;if(t)d.delete("files");let n=(c?Ye:Pe).split(`
|
|
143
|
+
`).filter((p)=>!(d.has("terminal")&&p.endsWith("/ara-terminal.desktop"))&&!(d.has("files")&&p.endsWith("/ara-files.desktop"))).join(`
|
|
144
|
+
`),a=(p)=>c?p.replace("/tmp/ara-dock-","/tmp/ara-grok-dock-"):p,o=t?re.replace(/^Exec=.*$/m,`Exec=${t}`).replace("Categories=System;FileManager;","Categories=Utility;Viewer;"):re,f=c?"ara-grok-wallpaper.jpg":"ara-wallpaper.jpg",i={"openbox/rc.xml":Ae(e.screen),"tint2/tint2rc":D(n),"picom/picom.conf":Ne,...d.has("terminal")?{}:{"ara-terminal.desktop":D(a(ge))},...d.has("files")?{}:{"ara-files.desktop":D(a(o))},"ara-chromium.desktop":D(a(Re)).replace("chromium --no-sandbox %U",e.browserExec),"ara-set-root-wallpaper.py":Ke},X=[...Y.slice(0,3),Fe,`[ ! -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',...Y.slice(3)];return{files:i,start:X}}var Y=['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 Je=43200000,L=":99",Qe=60000,A=15000,u={width:1280,height:800},ke=/^[A-Za-z0-9._:-]{1,160}$/;function _e(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}var we=["video","viewer","viewer_same_network","viewer_network","look"];function Me(e,D=Date.now()){let c=["relay_url","session_id","expires_at"];if(!_e(e)||c.some((f)=>!(f in e))||Object.keys(e).some((f)=>!c.includes(f)&&!we.includes(f)))throw new r("invalid_display_request","Reason desktop request is malformed.");let d="video"in e?Tc(e.video):void 0,t="viewer"in e?ts(e.viewer):null,n="look"in e?rs(e.look):null;if(d===null)throw new r("invalid_display_request","Reason desktop video request is invalid.");let a=null;try{a=typeof e.relay_url==="string"?new URL(e.relay_url):null}catch{}if(!a||a.protocol!=="wss:"&&a.protocol!=="ws:"||a.username||a.password)throw new r("invalid_display_request","Reason desktop relay URL is invalid.");if(typeof e.session_id!=="string"||!ke.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+Je)).toISOString(),...d?{video:d}:{},...t?{viewer:t}:{},...d&&e.viewer_same_network===!0?{viewer_same_network:!0}:{},...n?{look:n}:{}}}function on(e=process.platform){return(e==="linux"||e==="darwin"||e==="win32")&&T()?.features.display===!0}async function No(){if(process.platform==="win32")return on()&&await Jt();if(process.platform!=="darwin")return on();return await Jt()}function Te(e){Oe(e,{recursive:!0,mode:448});let D=Ge(e);if(!D.isDirectory()||D.isSymbolicLink()||process.getuid&&D.uid!==process.getuid())throw new r("display_unavailable","Reason desktop state directory is not private.");Ce(e,448)}function me(e,D){let c=(t)=>{let n=Buffer.alloc(2);return n.writeUInt16BE(t.length),Buffer.concat([n,t])},d=Buffer.from([255,255]);return Buffer.concat([d,c(Buffer.alloc(0)),c(Buffer.from(e)),c(Buffer.from("MIT-MAGIC-COOKIE-1")),c(D)])}function x(e,D,c=2000){return new Promise((d)=>{let t=he(e),n="",a=(o)=>{t.destroy(),d(o)};t.setTimeout(c,()=>a(!1)),t.once("error",()=>a(!1)),t.once("close",()=>a(!1)),t.once("connect",()=>{if(!D)a(!0)}),t.on("data",(o)=>{if(n+=o.toString("latin1"),n.length>=4)a(n.startsWith("RFB "))})})}async function h(e,D){let c=Date.now()+D;while(Date.now()<c){if(await e())return!0;await new Promise((d)=>setTimeout(d,100))}return!1}function R(e,D,c){return new Promise((d)=>{let t=se(e,D,{detached:!0,stdio:"ignore",env:c});t.once("error",()=>d(-1)),t.once("exit",(n)=>d(n)),t.unref(),setTimeout(()=>d(null),A).unref()})}var O=null;function Ft(e=s()){return O??=ve(e).finally(()=>{O=null}),O}async function ve(e){let D=T({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.");Br({root:D.root,automation:D.automation,extensionDir:D.extensionDir});let c=I(D.root,"display");Te(c);let d=await Ve(e,c,D.x11vnc);if(d)return d;let t={display:L,xauthority:I(c,"Xauthority"),rfbSocket:I(c,"rfb.sock")},n=I(c,"pulse"),a=(async()=>{try{Te(n)}catch{return null}return await uc(n,D.pulseaudio)})();Te(I(c,"home"));let o=J(c,t,D.pulseaudio),f=async()=>({...t,sound:await a});if(await x({path:t.rfbSocket},!0))return Ie(I(c,"theme"),Y,o),await f();if(!ce(t.xauthority))N(t.xauthority,me(L.slice(1),qe(16)),{mode:384,flag:"wx"});let i=Q(I(c,"theme"),t.display,u,e),X={path:`/tmp/.X11-unix/X${L.slice(1)}`};if(!await x(X,!1)){let p=`${u.width}x${u.height}`;if(D.xvnc)ae(t.rfbSocket,{force:!0}),R(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 R(D.xvfb,[t.display,"-screen","0",`${p}x24`,"-nolisten","tcp","-auth",t.xauthority],o);if(!await h(()=>x(X,!1),A)||D.xvnc&&!await h(()=>x({path:t.rfbSocket},!0),A))throw new r("display_unavailable","Reason could not start the virtual display.");R(D.openbox,["--config-file",i.openboxConfig],o)}if(await S(i,o),!await oe(D.x11vnc,t,c,"x11vnc.log",o))throw new r("display_unavailable","Reason could not start the desktop server.");return await f()}function J(e,D,c){let d={HOME:I(e,"home"),PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:D.display,XAUTHORITY:D.xauthority};if(c)d.PULSE_SERVER=Kt(zo(I(e,"pulse")));return d}async function oe(e,D,c,d,t){if(await x({path:D.rfbSocket},!0))return!0;ae(D.rfbSocket,{force:!0});let n=await R(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(c,d)],t);if(n!==null&&n!==0)return!1;return await h(()=>x({path:D.rfbSocket},!0),A)}async function Ze(){let e=["DISPLAY","XAUTHORITY","WAYLAND_DISPLAY","XDG_SESSION_TYPE"],D=(c)=>Object.fromEntries(e.flatMap((d)=>c[d]?[[d,c[d]]]:[]));if(process.env.DISPLAY)return D(process.env);try{let c=await new Promise((d,t)=>de("systemctl",["--user","show-environment"],{encoding:"utf8",timeout:2000},(n,a)=>n?t(n):d(a)));return D(Object.fromEntries(c.split(`
|
|
145
|
+
`).flatMap((d)=>{let t=d.indexOf("=");return t>0?[[d.slice(0,t),d.slice(t+1)]]:[]})))}catch{return{}}}var te=new Set;async function Ve(e,D,c){let d=await Ze(),t=/^:(\d+)(?:\.\d+)?$/.exec(d.DISPLAY??"")?.[1];if(!t||`:${t}`===L||d.WAYLAND_DISPLAY||d.XDG_SESSION_TYPE==="wayland")return null;let n={display:`:${t}`,xauthority:d.XAUTHORITY??I(e,".Xauthority"),rfbSocket:I(D,`rfb-${t}.sock`)},a=`${n.display} ${n.xauthority}`;if(te.has(a)||!await x({path:`/tmp/.X11-unix/X${t}`},!1))return null;let o={HOME:e,PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:n.display,XAUTHORITY:n.xauthority};if(await oe(c,n,D,`x11vnc-${t}.log`,o))return{...n,sound:null};return te.add(a),process.stderr.write(`Reason worker: your screen ${n.display} could not be served; using the virtual desktop
|
|
146
|
+
`),null}var ie="look";function fe(e){try{return rs(ne(I(e,ie),"utf8").trim())??"reason"}catch{return"reason"}}function Q(e,D,c,d,t=fe(e)){let n=`chromium --no-first-run --no-default-browser-check${process.geteuid?.()===0?" --no-sandbox":""} %U`,a=[["terminal","xterm"],["files","pcmanfm"]].filter(([,i])=>!ce(`/usr/bin/${i}`)).map(([i])=>i),o=`${n.replace(/ %U$/,"")} --app=file://${I(d,".reason","workspace")}/`,f=$e({root:e,display:D,screen:c,browserExec:n,absent:a,look:t,filesViewerExec:o});for(let i of["","openbox","tint2","picom"])Te(I(e,i));N(I(e,ie),`${t}
|
|
147
|
+
`,{mode:384});for(let[i,X]of Object.entries(f.files))N(I(e,i),X,{mode:384});for(let[i,X]of Object.entries(De))N(I(e,`ara-${i}`),ne(X),{mode:384});return{root:e,openboxConfig:I(e,"openbox","rc.xml"),start:f.start}}function S(e,D){return Ie(e.root,[...e.start,"openbox --reconfigure >/dev/null 2>&1 || true"],D)}function Ie(e,D,c){let d=[`ROOT=${JSON.stringify(e)}`,...D].join(`
|
|
148
|
+
`);return new Promise((t)=>{let n=se("/bin/sh",["-c",d],{stdio:"ignore",env:{...c,PATH:"/usr/bin:/bin"}}),a=setTimeout(()=>{n.kill(),t()},A);n.once("error",()=>{clearTimeout(a),t()}),n.once("exit",()=>{clearTimeout(a),t()})})}var ze=2073600,We=320;function je(e,D){let c=Math.min(1,Math.sqrt(ze/(e.width*e.height))),d=(t,n)=>Math.min(Math.floor(n/8)*8,Math.max(We,Math.round(t*c/8)*8));return{width:d(e.width,D.width),height:d(e.height,D.height)}}function k(e,D,c){return new Promise((d)=>de(e,D,{env:c,encoding:"utf8",timeout:5000},(t,n)=>d(t?null:n)))}function pe(e){let D=/current (\d+) x (\d+), maximum (\d+) x (\d+)/.exec(e),c=e.split(`
|
|
149
|
+
`),d=c.findIndex((n)=>/^\S+ connected/.test(n));if(!D||d<0)return null;let t=[];for(let n of c.slice(d+1)){let a=/^\s+(\d+x\d+)\s/.exec(n);if(!a)break;t.push(a[1])}return{current:{width:Number(D[1]),height:Number(D[2])},maximum:{width:Number(D[3]),height:Number(D[4])},output:c[d].split(" ")[0],modes:t}}async function Ue(e,D,c){if(e.display!==L)return null;let d={PATH:"/usr/bin:/bin",DISPLAY:e.display,XAUTHORITY:e.xauthority},t=(f)=>k("xrandr",f,d),n=pe(await t(["--query"])??"");if(!n||n.maximum.width<=n.current.width&&n.maximum.height<=n.current.height)return null;let a=je(D,n.maximum);if(a.width===n.current.width&&a.height===n.current.height)return{size:a,changed:!1};let o=`${a.width}x${a.height}`;if(!n.modes.includes(o)){if(await t(["--newmode",o,"60",...[a.width,a.width,a.width,a.width,a.height,a.height,a.height,a.height].map(String)]),await t(["--addmode",n.output,o])===null)return null}return c(),await t(["--output",n.output,"--mode",o])===null?null:{size:a,changed:!0}}async function er(e,D){let c=s(),d=T({home:c});if(!d)return;let t=I(d.root,"display"),n=J(t,e,d.pulseaudio);await S(Q(I(t,"theme"),e.display,D,c),n);let a=D.width-B*2,o=D.height-B-P;await k("xdotool",["search","--onlyvisible","--class","Chromium","windowsize","%@",String(a),String(o),"windowmove","%@",String(B),String(B)],{...n,PATH:"/usr/bin:/bin"})}var g=Promise.resolve();function rr(e,D,c=()=>{}){let d=g.then(()=>Ue(e,D,c));return g=d.then((t)=>t?.changed?er(e,t.size):void 0).catch(()=>{}),d.then((t)=>t?.size??null,()=>null)}function Dr(e,D){if(e.display!==L)return Promise.resolve();let c=g.then(async()=>{let d=s(),t=T({home:d});if(!t)return;let n=I(t.root,"display"),a=I(n,"theme");if(fe(a)===D)return;let o=J(n,e,t.pulseaudio),f=pe(await k("xrandr",["--query"],{PATH:"/usr/bin:/bin",DISPLAY:e.display,XAUTHORITY:e.xauthority})??"");await S(Q(a,e.display,f?.current??u,d,D),o)});return g=c.catch(()=>{}),c.catch(()=>{})}async function sn(e,D={}){let c=D.now??Date.now,d=Me(e.payload,c());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:n,look:a}=d,o=(D.video?.desktop??(t==="darwin"?async()=>qo:t==="win32"?async()=>Wo:async()=>{let f=await Ft();if(a)await Dr(f,a);return f}))();return await $r(e.signal,d,D,c,(f)=>Vo(f,{request:n,desktop:o,...d.viewer?{viewer:d.viewer}:{},viewerSameNetwork:d.viewer_same_network===!0},{resizeDesktop:rr,...D.video}),(f)=>Rn({type:"error",code:f}))}function $r(e,D,c,d,t,n){let a=d();return new Promise((o,f)=>{let i=null,X=!1,p=!1,_,K,y,F=!1,l=null,E=(b)=>{if(p)return;if(l)b=l.outcome;p=!0,clearTimeout(_),clearTimeout(K),e.removeEventListener("abort",C),y?.close();try{i?.close(1000,"display_session_over")}catch{}if("error"in b){f(b.error);return}o({reason:b.reason,...y?.summary(),duration_ms:Math.max(0,d()-a)})},q=()=>E({error:new r("display_relay_unavailable","Reason could not reach the desktop relay.")}),C=()=>{let b=e.reason;E({error:b instanceof r?b:new r("cancelled","Reason closed the desktop session.")})},w=()=>{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(n(H))}catch{}E(b)};if(y=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)&&F&&X){E(b);return}if(l={outcome:b,told:!("error"in b)&&X},F&&X)w()}}),p){y.close();return}if(e.aborted){C();return}e.addEventListener("abort",C,{once:!0}),_=setTimeout(()=>E({reason:"session_expired"}),Math.max(1,Date.parse(D.expires_at)-d())),K=setTimeout(()=>E({reason:"viewer_absent"}),c.viewerWaitMs??Qe);try{i=(c.connect??_i)(D.relay_url,(c.loadProxy??Se)()?.url)}catch{q();return}i.binaryType="arraybuffer",i.onopen=()=>{if(p||!i)return;X=!0,y?.opened()},i.onmessage=(b)=>{if(p)return;let H=b.data,G=H instanceof ArrayBuffer?new Uint8Array(H):ArrayBuffer.isView(H)?new Uint8Array(H.buffer,H.byteOffset,H.byteLength):null;if(!G||G.byteLength===0)return;if(clearTimeout(K),F=!0,l){w();return}y?.received(G)},i.onclose=()=>{if(p)return;if(!X){q();return}E({reason:"relay_closed"})},i.onerror=()=>{if(p||X)return;q()}})}
|
|
150
|
+
export{on,No,Te,Ft,sn};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Fi,ji,Hi,Nn}from"./vm-hands-entry-lite-9g52kxyj.js";import{oc,sc,F,bi,vi,Mo,_r,Bo,Si,zt,gt,Fo,qt,He,Wt,_t,hn,Ei,ki,Ho}from"./vm-hands-entry-lite-jpvmkce5.js";import{Fn}from"./vm-hands-entry-lite-krpqqx12.js";import{dn}from"./vm-hands-entry-lite-zh6ncdjn.js";import{bt}from"./vm-hands-entry-lite-ptycjmkc.js";var r=["cgroup_membership_read_failed","cgroup_v2_membership_absent","cgroup_scope_invalid","cgroup_root_unavailable","cgroup_directory_unavailable","cgroup_limit_read_failed","cgroup_events_read_failed","cgroup_current_read_failed","cgroup_stat_read_failed","boot_id_read_failed","boot_id_invalid","guest_meminfo_read_failed","guest_vmstat_read_failed","memory_counter_invalid","memory_field_missing","memory_capacity_invalid"];var o=String.raw`(function(fs, path) {
|
|
3
3
|
const fail = (message, reasonCode) => { throw Object.assign(Error(message), {reasonCode}); };
|
|
4
4
|
const read = (p, reasonCode, trim=true) => { try { const text=fs.readFileSync(p, "utf8"); return trim?text.trim():text; }
|
|
5
5
|
catch { fail("memory_read", reasonCode); } };
|
|
@@ -309,7 +309,7 @@ function fileOperation(request) {
|
|
|
309
309
|
});
|
|
310
310
|
return { promise, cancel() {} };
|
|
311
311
|
}
|
|
312
|
-
`;var s="a3e39eb55160acfc116fa9871ccc594c68be7a642d2331b24baa707c8f601ec0";import{createHash as
|
|
312
|
+
`;var s="a3e39eb55160acfc116fa9871ccc594c68be7a642d2331b24baa707c8f601ec0";import{createHash as O}from"crypto";var q=Object.freeze({"api.ara.so":"api.reasonmachines.com","api.reasonmachines.ai":"api.reasonmachines.com","api-staging.ara.so":"staging-api.reasonmachines.com","staging-api.reasonmachines.ai":"staging-api.reasonmachines.com"});var a=Object.freeze({trailingSlashPattern:/\/+$/.source,keyPrefix:"http.",keySuffix:"/.extraheader",valuePrefix:"Authorization: Bearer "});var l=Object.freeze({tokenEnv:"ARA_GIT_BROKER_TOKEN",reasonTokenEnv:"REASON_GIT_BROKER_TOKEN",urlEnv:"ARA_GIT_BROKER_URL",keyPrefix:"credential.",keySuffix:"/.helper",value:'!f(){ printf "username=%s\\npassword=%s\\n" "ara-run" "${REASON_GIT_BROKER_TOKEN:-$ARA_GIT_BROKER_TOKEN}"; };f'});var tn=/^[A-Za-z_][A-Za-z0-9_]*$/;var h=new Set(["ARA_INFERENCE_TOKEN","AI_GATEWAY_API_KEY","CLOUD_AGENT_AI_GATEWAY_API_KEY","INFERENCE_V2_GATEWAY_API_KEY","VERCEL_AI_GATEWAY_API_KEY","INFERENCE_V2_CONCENTRATE_API_KEY","INFERENCE_V2_OPENAI_API_KEY","INFERENCE_V2_ANTHROPIC_API_KEY","INFERENCE_V2_FINGERPRINT_SECRET","OPENAI_API_KEY","OPENROUTER_API_KEY","ANTHROPIC_API_KEY","CODEX_ACCESS_TOKEN","GITHUB_COPILOT_API_KEY","AZURE_OPENAI_API_KEY","AZURE_OPENAI_CLIENT_SECRET"]),m=new Set(["ARA_OPERATOR_KEY","BL_API_KEY","BLAXEL_API_KEY","NSC_TOKEN","NSC_TOKEN_FILE","NAMESPACE_API_KEY","NAMESPACE_ACCESS_TOKEN","NAMESPACE_TOKEN","NAMESPACE_TOKEN_JSON","NAMESPACE_SANDBOX_TOKEN_JSON","ARA_LOCAL_QA_NAMESPACE_WORKLOAD_TOKEN_FILE","NAMESPACE_SANDBOX_USE_LOCAL_USER_TOKEN","COMPUTE_SERVICE_TOKEN"]),g=["INFISICAL_","NSC_"],_=new Set(["ARA_JOB_ENV","ARA_DELIVERY_BASE_SHA","WORK_ROOT","REPO_DIR","ARA_CONTROL_DIR","ARA_PRESERVE_WORKSPACE","ARA_PINNED_CHECKOUT_REUSE","FOLLOWUP_BRANCH","REPO_URL","TOKENLESS_URL","REPOSITORY_IDENTITY_URL","DEFAULT_BRANCH","BRANCH","BRANCH_GENERATED","BASE_REF","REPO_EMPTY","REPO_WRITABLE","ARA_DELIVERY_BASE_BRANCH","ARA_SERVER_GIT_PUBLICATION","ARA_EMPTY_REPOSITORY_COMMIT","REASON_MODEL","REASON_DELIVERY_BASE_BRANCH","REASON_DELIVERY_BASE_SHA","REASON_EMPTY_REPOSITORY_COMMIT","REASON_SCRATCH_SESSION_ID","REASON_SERVER_GIT_PUBLICATION","REASON_ALLOW_INSTALL_SCRIPTS","SCM_TOKEN","SCM_TOKEN_USER","REASON_OIDC_TOKEN_URL","REASON_OIDC_REQUEST_TOKEN","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE","BASH_ENV","ENV","BASHOPTS","SHELLOPTS","PS4","IFS","CDPATH","GLOBIGNORE","PROMPT_COMMAND","PATH","HOME","TMPDIR","TMP","TEMP","XDG_CONFIG_HOME","GIT_DIR","GIT_WORK_TREE","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_COMMON_DIR","GIT_NAMESPACE","GIT_CEILING_DIRECTORIES","GIT_DISCOVERY_ACROSS_FILESYSTEM","GIT_SHALLOW_FILE","GIT_ALLOW_PROTOCOL","GIT_PROTOCOL_FROM_USER","GIT_REPLACE_REF_BASE","NODE_OPTIONS","NODE_PATH","NODE_REPL_EXTERNAL_MODULES","CLASSPATH","PYTHONPATH","PYTHONSTARTUP","PYTHONHOME","RUBYOPT","RUBYLIB","PERL5LIB","PERL5OPT","JAVA_TOOL_OPTIONS","_JAVA_OPTIONS","JDK_JAVA_OPTIONS","GEM_PATH","GEM_HOME","GIT_SSH","GIT_SSH_COMMAND","GIT_EXEC_PATH","GIT_TEMPLATE_DIR","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_PROXY_COMMAND","GIT_EXTERNAL_DIFF","GIT_PAGER","GIT_EDITOR","GIT_ASKPASS","SSH_ASKPASS","PAGER","EDITOR","TAR_OPTIONS","CURL_HOME","WGETRC","APT_CONFIG","PERLLIB","GIT_GRAFT_FILE","POSIXLY_CORRECT"]),y=["GIT_TRACE","CONTEXT_REPO_","ARA_CHECKPOINT_BOOTSTRAP_","_","ARA_HANDS_","ARA_DEVICE_","ARA_GIT_BROKER_","REASON_HANDS_","REASON_DEVICE_","REASON_GIT_BROKER_","LD_","DYLD_","GIT_CONFIG","BASH_FUNC_"];var t="^(?!(?:"+[...h,...m,..._].join("|")+")$)(?!(?:"+[...g,...y].join("|")+"))"+tn.source.slice(1),W=new RegExp(t);var v=["HOME","PWD","OLDPWD","TMPDIR","TMP","TEMP","SHELL","USER","LOGNAME","SCM_TOKEN","SCM_TOKEN_USER","GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","GITLAB_TOKEN"],b=["ARA_HANDS_","ARA_DEVICE_","ARA_GIT_BROKER_","REASON_HANDS_","REASON_DEVICE_","REASON_GIT_BROKER_","BUN_"],E="^(?!(?:"+v.join("|")+")$)(?!(?:"+b.join("|")+"))"+t.slice(1),S="ARA_DELIVERY_BASE_SHA|WORK_ROOT|FOLLOWUP_BRANCH|ARA_PRESERVE_WORKSPACE|ARA_PINNED_CHECKOUT_REUSE|CONTEXT_REPO_[A-Z0-9_]+|REPO_URL|TOKENLESS_URL|REPOSITORY_IDENTITY_URL|DEFAULT_BRANCH|BRANCH|BRANCH_GENERATED|BASE_REF|REPO_EMPTY|REPO_WRITABLE|ARA_DELIVERY_BASE_BRANCH|ARA_SERVER_GIT_PUBLICATION|ARA_EMPTY_REPOSITORY_COMMIT|REASON_MODEL|REASON_DELIVERY_BASE_BRANCH|REASON_DELIVERY_BASE_SHA|REASON_EMPTY_REPOSITORY_COMMIT|REASON_SCRATCH_SESSION_ID|REASON_SERVER_GIT_PUBLICATION|REASON_ALLOW_INSTALL_SCRIPTS",n="^(?:"+S+"|"+E.slice(1,-1)+")$",w=new RegExp(n);function hi(u){return w.test(u)}var pr=Object.freeze({tokenPath:"/identity/token",awsPath:"/identity/aws",tokenPattern:/^[A-Za-z0-9_.~-]+$/.source}),Re=Object.freeze({variables:256,valueBytes:130816,snapshotBytes:1048576}),z=Object.freeze({valueChars:16384,snapshotBytes:65536});var c=["set -g history-limit 50000","set -g status off","set -g window-size smallest","set -gq fill-character ' '","set -g escape-time 10","set -g prefix None","set -g prefix2 None","set -g terminal-overrides ',*:smcup@:rmcup@'"];var U=2,H="ara-hands-worker.cjs",d=["/usr/local/go/bin","/opt/node/bin","/usr/local/bin","/usr/sbin","/usr/bin","/sbin","/bin","/usr/local/cargo/bin"],I=d.join(":"),A=["/opt/homebrew/bin",...d].join(":"),T='(platform, linuxPath, macosPath) => platform === "darwin" ? macosPath : linuxPath';var P=String.raw`(function(anchor, pid, native) {
|
|
313
313
|
const token = native.identity(pid);
|
|
314
314
|
const session = native.session(pid);
|
|
315
315
|
if (!native.same(anchor)) throw new Error("pty_session_identity_lost");
|
|
@@ -317,7 +317,7 @@ function fileOperation(request) {
|
|
|
317
317
|
if (session.id !== anchor[5]) throw new Error("pty_member_session_changed");
|
|
318
318
|
if (!token) return { retry: true, token: null };
|
|
319
319
|
return { retry: false, token };
|
|
320
|
-
})`,
|
|
320
|
+
})`,k=String.raw`(function(native) {
|
|
321
321
|
let probe;
|
|
322
322
|
try {
|
|
323
323
|
try {
|
|
@@ -327,7 +327,7 @@ function fileOperation(request) {
|
|
|
327
327
|
native.signal(probe);
|
|
328
328
|
} finally { if (probe) native.release(probe); }
|
|
329
329
|
} catch (error) { native.close(); throw error; }
|
|
330
|
-
})`,
|
|
330
|
+
})`,N=String.raw`(function(bootstrap) {
|
|
331
331
|
const { dlopen, ptr } = require("bun:ffi");
|
|
332
332
|
const api = dlopen("libc.so.6", {
|
|
333
333
|
prctl: { args: ["i32", "u64", "u64", "u64", "u64"], returns: "i32" },
|
|
@@ -348,7 +348,7 @@ function fileOperation(request) {
|
|
|
348
348
|
require("node:fs").writeSync(3, "subreaper\n");
|
|
349
349
|
api.execve(ptr(args[0]), ptr(argv), ptr(envp));
|
|
350
350
|
throw new Error("pty_exec_failed");
|
|
351
|
-
})`,
|
|
351
|
+
})`,Xc=String.raw`
|
|
352
352
|
"use strict";
|
|
353
353
|
const crypto = require("node:crypto");
|
|
354
354
|
const fs = require("node:fs");
|
|
@@ -359,43 +359,43 @@ const { StringDecoder } = require("node:string_decoder");
|
|
|
359
359
|
const GIT_BROKER_HTTP_HEADER_POLICY = ${JSON.stringify(a)};
|
|
360
360
|
const GIT_BROKER_CREDENTIAL_HELPER_POLICY = ${JSON.stringify(l)};
|
|
361
361
|
const DEVICE_ENVIRONMENT_NAME_RE = new RegExp(${JSON.stringify(n)});
|
|
362
|
-
const DEVICE_CLOUD_ACCESS_POLICY = ${JSON.stringify(
|
|
363
|
-
const DEVICE_ENVIRONMENT_LIMITS = ${JSON.stringify(
|
|
362
|
+
const DEVICE_CLOUD_ACCESS_POLICY = ${JSON.stringify(pr)};
|
|
363
|
+
const DEVICE_ENVIRONMENT_LIMITS = ${JSON.stringify(Re)};
|
|
364
364
|
|
|
365
|
-
const VERSION = ${
|
|
366
|
-
const WORKER_VERSION = ${
|
|
367
|
-
const WORKER_ENTRYPOINT = ${JSON.stringify(
|
|
365
|
+
const VERSION = ${F};
|
|
366
|
+
const WORKER_VERSION = ${U};
|
|
367
|
+
const WORKER_ENTRYPOINT = ${JSON.stringify(H)};
|
|
368
368
|
const GUEST_MEMORY_UNAVAILABLE_REASONS = ${JSON.stringify(r)};
|
|
369
369
|
const sampleGuestMemory = ${o};
|
|
370
|
-
const inspectMacPtyMember = ${
|
|
371
|
-
const probeLinuxPtyLibrary = ${
|
|
372
|
-
const windowsPtyApi = ${
|
|
373
|
-
const LINUX_PTY_EXEC_SOURCE = ${JSON.stringify(
|
|
374
|
-
const CLOSE_CODES = ${JSON.stringify(
|
|
370
|
+
const inspectMacPtyMember = ${P};
|
|
371
|
+
const probeLinuxPtyLibrary = ${k};
|
|
372
|
+
const windowsPtyApi = ${dn};
|
|
373
|
+
const LINUX_PTY_EXEC_SOURCE = ${JSON.stringify(N)};
|
|
374
|
+
const CLOSE_CODES = ${JSON.stringify(ki)};
|
|
375
375
|
const SHA256_RE = /^[0-9a-f]{64}$/;
|
|
376
|
-
const MAX_FRAME_BYTES = ${
|
|
377
|
-
const MAX_INPUT_CHARS = ${
|
|
378
|
-
const MAX_STRUCTURED_INPUT_CHARS = ${
|
|
379
|
-
const MAX_OUTPUT_CHARS = ${
|
|
380
|
-
const WORKSPACE_BEFORE_MAX_OUTPUT_CHARS = ${
|
|
381
|
-
const MAX_ERROR_CHARS = ${
|
|
376
|
+
const MAX_FRAME_BYTES = ${bi};
|
|
377
|
+
const MAX_INPUT_CHARS = ${vi};
|
|
378
|
+
const MAX_STRUCTURED_INPUT_CHARS = ${Mo};
|
|
379
|
+
const MAX_OUTPUT_CHARS = ${_r};
|
|
380
|
+
const WORKSPACE_BEFORE_MAX_OUTPUT_CHARS = ${Ho};
|
|
381
|
+
const MAX_ERROR_CHARS = ${Bo};
|
|
382
382
|
const MAX_LEDGER_IDS = 16384;
|
|
383
383
|
const MAX_CACHED_RESULTS = 256;
|
|
384
|
-
const MAX_JOB_INPUT_CHARS = ${
|
|
385
|
-
const MAX_JOB_OUTPUT_CHARS = ${
|
|
386
|
-
const MAX_JOB_OUTPUT_CHUNKS = ${
|
|
387
|
-
const MAX_JOBS = ${
|
|
384
|
+
const MAX_JOB_INPUT_CHARS = ${Si};
|
|
385
|
+
const MAX_JOB_OUTPUT_CHARS = ${zt};
|
|
386
|
+
const MAX_JOB_OUTPUT_CHUNKS = ${gt};
|
|
387
|
+
const MAX_JOBS = ${Fo};
|
|
388
388
|
const MAX_JOB_RECORD_BYTES = 262144;
|
|
389
389
|
const MAX_JOB_JOURNAL_BYTES = MAX_JOBS * MAX_JOB_RECORD_BYTES;
|
|
390
|
-
const MAX_JOB_CONTROL_FRAME_BYTES = ${
|
|
391
|
-
const MAX_PTY_INPUT_BYTES = ${
|
|
392
|
-
const MAX_PTY_OUTPUT_BYTES = ${
|
|
393
|
-
const MAX_PTY_DIMENSION = ${
|
|
390
|
+
const MAX_JOB_CONTROL_FRAME_BYTES = ${qt};
|
|
391
|
+
const MAX_PTY_INPUT_BYTES = ${He};
|
|
392
|
+
const MAX_PTY_OUTPUT_BYTES = ${Wt};
|
|
393
|
+
const MAX_PTY_DIMENSION = ${_t};
|
|
394
394
|
const ID_RE = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,199}$/;
|
|
395
395
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
396
396
|
const WINDOWS = process.platform === "win32";
|
|
397
397
|
// Each Bash leader's tree on Windows, children that outlive it included (shared/windows-job-object.ts).
|
|
398
|
-
const windowsJobs = WINDOWS ? ${
|
|
398
|
+
const windowsJobs = WINDOWS ? ${Fn}(require) : null;
|
|
399
399
|
/** Windows has no POSIX owner or mode bits: the user's own profile folders are
|
|
400
400
|
* private by their ACLs, and the worker runs as that ordinary user. */
|
|
401
401
|
function ownedPrivately(stat, mask = 0o077) {
|
|
@@ -492,9 +492,9 @@ function jobsUserPrefix(model) {
|
|
|
492
492
|
return user ? ["/usr/bin/setpriv", "--reuid=" + user.uid, "--regid=" + gid, "--clear-groups", "--no-new-privs", "--",
|
|
493
493
|
"/usr/bin/env", "HOME=" + user.home, "USER=" + user.username, "LOGNAME=" + user.username] : [];
|
|
494
494
|
}
|
|
495
|
-
const FIXED_CLOUD_CHILD_PATH = ${JSON.stringify(
|
|
496
|
-
const FIXED_MACOS_CLOUD_CHILD_PATH = ${JSON.stringify(
|
|
497
|
-
const selectCloudChildPath = ${
|
|
495
|
+
const FIXED_CLOUD_CHILD_PATH = ${JSON.stringify(I)};
|
|
496
|
+
const FIXED_MACOS_CLOUD_CHILD_PATH = ${JSON.stringify(A)};
|
|
497
|
+
const selectCloudChildPath = ${T};
|
|
498
498
|
const config = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
499
499
|
const FIXED_BASH = WINDOWS ? config.bashExecutable : "/bin/bash";
|
|
500
500
|
const allowedTools = config.allowedTools === undefined
|
|
@@ -577,12 +577,12 @@ function validJobEnvSourcePath() {
|
|
|
577
577
|
if (config.jobEnvSourcePath === undefined || config.jobEnvSourcePath === path.join(config.workRoot, "job.env")) return true;
|
|
578
578
|
// A cloud workspace's job.env is in its Session's root-only control
|
|
579
579
|
// directory (shared/device-workspace.ts), derived from the root alone.
|
|
580
|
-
const cloud = new RegExp(${JSON.stringify(
|
|
580
|
+
const cloud = new RegExp(${JSON.stringify(Nn.source)}).exec(config.workRoot);
|
|
581
581
|
if (process.platform === "linux" && cloud) {
|
|
582
582
|
const workspaceId = cloud[3];
|
|
583
|
-
const owner = (new RegExp(${JSON.stringify(
|
|
584
|
-
?? (new RegExp(${JSON.stringify(
|
|
585
|
-
return config.jobEnvSourcePath === ${JSON.stringify(
|
|
583
|
+
const owner = (new RegExp(${JSON.stringify(ji.source)}).exec(workspaceId) || [])[1]
|
|
584
|
+
?? (new RegExp(${JSON.stringify(Hi.source)}).exec(workspaceId) || [])[1] ?? workspaceId;
|
|
585
|
+
return config.jobEnvSourcePath === ${JSON.stringify(Fi)} + "/" + owner + "/job.env";
|
|
586
586
|
}
|
|
587
587
|
// Personal Cloud controls are root-owned and outside the writable grant.
|
|
588
588
|
// Admit only the same canonical session, never a caller-selected private path.
|
|
@@ -1027,7 +1027,7 @@ function initializeJobs() {
|
|
|
1027
1027
|
// (shared/local-protected-paths.ts) that the file tools and every confinement
|
|
1028
1028
|
// refuse. A home-folder worker keeps it in ~/.config/reason, so its Session may
|
|
1029
1029
|
// work in the home folder itself, as a Mac's home grant does.
|
|
1030
|
-
const PROTECTED_STATE_DIRECTORIES = ${JSON.stringify(
|
|
1030
|
+
const PROTECTED_STATE_DIRECTORIES = ${JSON.stringify(bt)};
|
|
1031
1031
|
function stateOverlapsWorkspace(state, root) {
|
|
1032
1032
|
if (pathWithin(root, state)) return true;
|
|
1033
1033
|
if (!pathWithin(state, root)) return false;
|
|
@@ -2347,7 +2347,7 @@ function windowsPtyOperation(request, managed) {
|
|
|
2347
2347
|
try {
|
|
2348
2348
|
if (pty.activeProcesses() > 0) pty.terminate();
|
|
2349
2349
|
for (const startedAt = Date.now(); pty.activeProcesses() > 0;) {
|
|
2350
|
-
if (Date.now() - startedAt > ${
|
|
2350
|
+
if (Date.now() - startedAt > ${hn}) throw new Error("pty_cleanup_timeout");
|
|
2351
2351
|
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
2352
2352
|
}
|
|
2353
2353
|
pty.close();
|
|
@@ -2795,7 +2795,7 @@ function ptyOperation(request, managed, program = TERMINAL_SHELL) {
|
|
|
2795
2795
|
const { members, empty } = native.session(anchor, device);
|
|
2796
2796
|
try {
|
|
2797
2797
|
if (empty && exitCode !== null && subreaper) break;
|
|
2798
|
-
if (Date.now() - startedAt > ${
|
|
2798
|
+
if (Date.now() - startedAt > ${hn}) throw new Error("pty_cleanup_timeout");
|
|
2799
2799
|
for (const token of members) {
|
|
2800
2800
|
if (!native.same(anchor)) throw new Error("pty_session_identity_lost");
|
|
2801
2801
|
const id = native.identityKey(token);
|
|
@@ -2811,7 +2811,7 @@ function ptyOperation(request, managed, program = TERMINAL_SHELL) {
|
|
|
2811
2811
|
controlReleased = true;
|
|
2812
2812
|
let exitTimer;
|
|
2813
2813
|
try { await Promise.race([child.exited, new Promise((_, reject) => {
|
|
2814
|
-
exitTimer = setTimeout(() => reject(new Error("pty_anchor_exit_unconfirmed")), ${
|
|
2814
|
+
exitTimer = setTimeout(() => reject(new Error("pty_anchor_exit_unconfirmed")), ${Ei});
|
|
2815
2815
|
})]); } finally { clearTimeout(exitTimer); }
|
|
2816
2816
|
if (timedOut) finish("timeout", 124);
|
|
2817
2817
|
else if (cancelled) finish("cancelled", 130);
|
|
@@ -3362,10 +3362,10 @@ const PI_EXIT_STDIO_GRACE_MS = 100;
|
|
|
3362
3362
|
// the token once under quoteDepth layers of single quoting, so the confined
|
|
3363
3363
|
// script is byte-identical to what the Brain's confineBashPayload gives the
|
|
3364
3364
|
// bash tool: srt/bwrap, the payload uid, the network allowlist and allowWrite.
|
|
3365
|
-
const PI_TOOL_CONFINEMENT_TOKEN = "${
|
|
3365
|
+
const PI_TOOL_CONFINEMENT_TOKEN = "${oc}";
|
|
3366
3366
|
function validPiToolConfinement(value) {
|
|
3367
3367
|
return hasOnlyKeys(value, ["template", "quoteDepth"]) && typeof value.template === "string"
|
|
3368
|
-
&& value.template.length <= ${
|
|
3368
|
+
&& value.template.length <= ${sc} && !value.template.includes("\0")
|
|
3369
3369
|
&& value.template.split(PI_TOOL_CONFINEMENT_TOKEN).length === 2 && [1, 2, 3].includes(value.quoteDepth);
|
|
3370
3370
|
}
|
|
3371
3371
|
// The script T when this command is exactly this policy's confineBashPayload(T)
|
|
@@ -4176,5 +4176,5 @@ void startJobControl().then(() => {
|
|
|
4176
4176
|
try { loadJobs(); prepareRequestJournal(); } catch { process.exit(44); }
|
|
4177
4177
|
if (validPrivateJob) markReady(); else connect();
|
|
4178
4178
|
}, () => process.exit(45));
|
|
4179
|
-
`.trimStart();var
|
|
4180
|
-
export{
|
|
4179
|
+
`.trimStart();var R=O("sha256").update(Xc,"utf8").digest("hex"),Ro={42:"worker_config_invalid",43:"workspace_alias_failed",44:"job_journal_unavailable",45:"job_control_failed",46:"job_journal_owned"};
|
|
4180
|
+
export{tn,hi,pr,Re,U,H,Xc,R,Ro};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{createHash as M,createPublicKey as y,verify as _}from"crypto";var Ai="libara_device_keychain.dylib",Pi="libreason_device_keychain.dylib";var g=2,b=536870912,mn=262144;var yr=["darwin-arm64","darwin-x64"];class l extends Error{code;constructor(t,n){super(n);this.code=t;this.name="ManagedRuntimeError"}}var N=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,k=/^[a-f0-9]{64}$/;function a(t){return Boolean(t)&&typeof t==="object"&&!Array.isArray(t)}function r(t,n,i=[]){let s=new Set([...n,...i]);return n.every((e)=>(e in t))&&Object.keys(t).every((e)=>s.has(e))}function p(t){return typeof t==="string"&&N.test(t)}function w(t){return typeof t==="string"&&!Number.isNaN(Date.parse(t))&&new Date(t).toISOString()===t}var ac="managed-runtime-identity.json",m="reason-macos-background-identity-v1";function f(t){if(t===null)return"null";if(typeof t==="string"||typeof t==="boolean")return JSON.stringify(t);if(typeof t==="number"){if(!Number.isFinite(t))throw new l("invalid_manifest","Manifest numbers must be finite.");return JSON.stringify(t)}if(Array.isArray(t))return`[${t.map((n)=>f(n)).join(",")}]`;if(a(t))return`{${Object.keys(t).sort().map((n)=>`${JSON.stringify(n)}:${f(t[n])}`).join(",")}}`;throw new l("invalid_manifest","Manifest contains an unsupported value.")}function d(t){if(!a(t)||!r(t,["url","sha256","size_bytes"])||typeof t.url!=="string"||typeof t.sha256!=="string"||!k.test(t.sha256)||typeof t.size_bytes!=="number"||!Number.isSafeInteger(t.size_bytes)||t.size_bytes<=0||t.size_bytes>b)throw new l("invalid_manifest","Manifest contains an invalid runtime artifact.");let n;try{n=new URL(t.url)}catch{throw new l("invalid_manifest","Runtime artifact URL is invalid.")}if(n.protocol!=="https:"||n.username||n.password||n.hash)throw new l("invalid_manifest","Runtime artifact URL must be an HTTPS URL without credentials or a fragment.");return{url:n.toString(),sha256:t.sha256,size_bytes:t.size_bytes}}function u(t){if(!a(t)||!r(t,["broker","credential_library"]))throw new l("invalid_manifest","Manifest must bind the broker and credential library as one runtime.");return{broker:d(t.broker),credential_library:d(t.credential_library)}}function I(t){if(!a(t)||!r(t,["schema_version","version","published_at","artifacts"])||t.schema_version!==g||!p(t.version)||!w(t.published_at)||!a(t.artifacts)||!r(t.artifacts,[...yr]))throw new l("invalid_manifest","Managed Reason runtime manifest is invalid.");return{schema_version:g,version:t.version,published_at:t.published_at,artifacts:{"darwin-arm64":u(t.artifacts["darwin-arm64"]),"darwin-x64":u(t.artifacts["darwin-x64"])}}}function T(t){if(!a(t)||!r(t,["schema","version","published_at","artifacts"])||t.schema!==m||!p(t.version)||!w(t.published_at)||!a(t.artifacts)||!r(t.artifacts,[...yr]))throw new l("invalid_manifest","Reason background identity manifest is invalid.");return{schema:m,version:t.version,published_at:t.published_at,artifacts:{"darwin-arm64":d(t.artifacts["darwin-arm64"]),"darwin-x64":d(t.artifacts["darwin-x64"])}}}function h(t){if(typeof t!=="string"||!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new l("invalid_signature","Runtime manifest signature is invalid.");let n=Buffer.from(t,"base64");if(n.length!==64||n.toString("base64")!==t)throw new l("invalid_signature","Runtime manifest signature is invalid.");return n}function A(t){let n=t;if(typeof t==="string")try{n=JSON.parse(t)}catch{throw new l("invalid_manifest","Managed Reason runtime manifest is not valid JSON.")}if(!a(n)||!r(n,["key_id","manifest","signature"])||typeof n.key_id!=="string"||!/^[A-Za-z0-9._-]{1,80}$/.test(n.key_id)||typeof n.signature!=="string")throw new l("invalid_manifest","Signed managed Reason runtime manifest is invalid.");return n}function Ri(t,n){let i=A(t),s=n[i.key_id];if(!s)throw new l("untrusted_key","Runtime manifest was signed by an unknown key.");let e=I(i.manifest),c=h(i.signature),o=!1;try{o=_(null,Buffer.from(f(e)),y(s),c)}catch{throw new l("invalid_signature","Runtime manifest signature could not be verified.")}if(!o)throw new l("invalid_signature","Runtime manifest signature did not match.");return{key_id:i.key_id,manifest:e,signature:i.signature}}function cc(t,n){let i=A(t),s=n[i.key_id];if(!s)throw new l("untrusted_key","Background identity manifest was signed by an unknown key.");let e=T(i.manifest),c=h(i.signature),o=!1;try{o=_(null,Buffer.from(f(e)),y(s),c)}catch{throw new l("invalid_signature","Background identity manifest signature could not be verified.")}if(!o)throw new l("invalid_signature","Background identity manifest signature did not match.");return{key_id:i.key_id,manifest:e,signature:i.signature}}function gn(t){return M("sha256").update(t).digest("hex")}function Vt(t,n){if(t.byteLength!==n.size_bytes)throw new l("artifact_size_mismatch","Runtime artifact size did not match its manifest.");if(gn(t)!==n.sha256)throw new l("artifact_checksum_mismatch","Runtime artifact checksum did not match its manifest.")}import{existsSync as S}from"fs";import{join as R}from"path";function _n(t){let n=R(t,Pi);return S(n)?n:R(t,Ai)}
|
|
3
|
+
export{Ai,Pi,mn,yr,l,ac,Ri,cc,gn,Vt,_n};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{L}from"./vm-hands-entry-lite-ptycjmkc.js";import{Y,Rt,Me,It,Be}from"./vm-hands-entry-lite-8xv6c0rm.js";import{spawn as y}from"child_process";import{existsSync as p,mkdirSync as T,readFileSync as _,writeFileSync as A}from"fs";import{homedir as g}from"os";import{basename as H,delimiter as E,join as f,win32 as u}from"path";var Bt=process.platform==="win32"?Rt("win32"):"/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",P=Bt.split(E),R=5000,S=65536,O=new Set(["zsh","bash"]),b=[[".local","bin"],[".bun","bin"],[".cargo","bin"],["go","bin"]],x=(t,e)=>new Promise((n,r)=>{let o;try{o=y(t,[...e],{...Me(),stdio:["ignore","pipe","ignore"]}),It(o)}catch(c){r(c);return}let i=[],s=0,a=null,d=(c)=>{a??=Error(c);try{if(o.pid!==void 0)Be(o.pid,"SIGKILL")}catch{}},m=setTimeout(()=>d("login_shell_timeout"),R);o.stdout?.on("data",(c)=>{if(s+=c.length,s>S)d("login_shell_output_too_large");else i.push(c)}),o.once("error",(c)=>{clearTimeout(m),r(c)}),o.once("close",(c)=>{if(clearTimeout(m),a)r(a);else if(c!==0)r(Error("login_shell_exit_nonzero"));else n(Buffer.concat(i).toString("utf8"))})});function w(t){return typeof t==="string"&&t.startsWith("/")&&!t.includes("\x00")&&O.has(H(t))}function h(t){let e=new Set,n=[];for(let r of t){if(e.has(r))continue;e.add(r),n.push(r)}return n}function pi(t,e=process.platform){let n=e==="win32",r=t.split(`
|
|
3
|
+
`).at(-1)??"",o=[];for(let i of r.split(n?";":":")){let s=i.trim();if(n?!u.isAbsolute(s):!s.startsWith("/"))continue;if(s.includes("\x00"))continue;if(L(s))continue;o.push(s)}return h(o)}function Ao(t){let e=t?.home??g(),n=t?.directoryExists??p,r=b.map((o)=>f(e,...o)).filter((o)=>{try{return n(o)}catch{return!1}});return h([...r,...process.platform==="win32"?pi(process.env.PATH??process.env.Path??""):[],...P]).join(E)}async function C(t){let e=t?.shell??process.env.SHELL,n=()=>({path:Ao({home:t?.home,directoryExists:t?.directoryExists}),source:"fallback"});if(process.platform==="win32"||!w(e))return n();let r;try{r=await(t?.runLoginShell??x)(e,["-lic",'printf %s "$PATH"'])}catch{return n()}if(Buffer.byteLength(r,"utf8")>S)return n();let o=pi(r);if(o.length===0)return n();return{path:h([...o,...P]).join(":"),source:"login_shell"}}function tc(t){let e=null;return()=>(e??=C(t),e)}function l(t){if(t===void 0||t.includes("\x00")||Buffer.byteLength(t,"utf8")>32768)return;return t}function je(t){let e=t.source??process.env,n={HOME:t.home,PATH:t.path??Bt,TMPDIR:t.temporaryDirectory,SHELL:l(e.SHELL)??"/bin/zsh",LANG:l(e.LANG)??"C.UTF-8",LC_ALL:l(e.LC_ALL)??l(e.LANG)??"C.UTF-8"},r=l(e.LC_CTYPE),o=l(e.TERM),i=l(e.COLORTERM);if(r)n.LC_CTYPE=r;if(o)n.TERM=o;if(i)n.COLORTERM=i;if(process.platform==="win32"){for(let s of I){let a=l(e[s]);if(a)n[s]=a}n.TEMP=n.TMP=t.temporaryDirectory,n.SHELL=Y()??n.SHELL,n.PATH=Po(n.PATH)}return n}function Po(t,e=f(g(),".reason","python3")){let n=(i)=>t.split(u.delimiter).filter((s)=>s&&!/[\\/]WindowsApps[\\/]?$/i.test(s)).map((s)=>u.join(s,i)).find((s)=>p(s)),r=n("python.exe");if(n("python3.exe")||!r)return t;let o=`#!/bin/sh
|
|
4
|
+
exec "${r.replaceAll("\\","/")}" "$@"
|
|
5
|
+
`;try{let i=f(e,"python3");if(!p(i)||_(i,"utf8")!==o)T(e,{recursive:!0}),A(i,o)}catch{return t}return[e,t].join(u.delimiter)}var I=["SystemRoot","SystemDrive","windir","ComSpec","PATHEXT","USERPROFILE","USERNAME","USERDOMAIN","APPDATA","LOCALAPPDATA","ProgramData","ProgramFiles","ProgramFiles(x86)","ProgramW6432","CommonProgramFiles","NUMBER_OF_PROCESSORS","PROCESSOR_ARCHITECTURE","OS"];
|
|
6
|
+
export{Bt,pi,Ao,tc,je,Po};
|