@reason-machines/cli-linux-x64 0.2.561 → 0.2.565
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-mnv1fm1c.js +2 -0
- package/bin/vm-hands/api-credentials-082cnpn9.js +2 -0
- package/bin/vm-hands/api-sq672f51.js +2 -0
- package/bin/vm-hands/{ask-relay-xx0rzpch.js → ask-relay-v5btnjvb.js} +2 -2
- package/bin/vm-hands/connect-cli-rxb3qtra.js +2 -0
- package/bin/vm-hands/credentials-sk4sag42.js +2 -0
- package/bin/vm-hands/custom-endpoint-device-3jscber1.js +2 -0
- package/bin/vm-hands/desktop-account-xma0330a.js +2 -0
- package/bin/vm-hands/desktop-components-099xyxmz.js +2 -0
- package/bin/vm-hands/desktop-delegate-tch2qzx0.js +2 -0
- package/bin/vm-hands/device-workspace-4bj43nxq.js +2 -0
- package/bin/vm-hands/{fsevents-vxv56sp5.js → fsevents-ezcg3e40.js} +1 -1
- package/bin/vm-hands/hands-worker-source-8pe7yv0m.js +2 -0
- package/bin/vm-hands/{index-03p9c17x.js → index-w92ys6ra.js} +16 -16
- package/bin/vm-hands/install-receipt-68xxg7hn.js +2 -0
- package/bin/vm-hands/local-automation-7pjd5nc1.js +2 -0
- package/bin/vm-hands/local-capabilities-ha0ey4zh.js +2 -0
- package/bin/vm-hands/local-desktop-users-jpf0resr.js +2 -0
- package/bin/vm-hands/local-display-mac-h5yz0ydd.js +2 -0
- package/bin/vm-hands/local-display-session-0mkswxgk.js +2 -0
- package/bin/vm-hands/local-display-video-c3fk87c5.js +2 -0
- package/bin/vm-hands/local-managed-process-ahr2jync.js +2 -0
- package/bin/vm-hands/local-pty-session-tqn2xmph.js +2 -0
- package/bin/vm-hands/managed-runtime-shzb3tr3.js +2 -0
- package/bin/vm-hands/network-auto-update-3m94436w.js +3 -0
- package/bin/vm-hands/network-contract-nkwcf4r9.js +2 -0
- package/bin/vm-hands/{network-sign-in-61gmpmaa.js → network-sign-in-xm79s170.js} +2 -2
- package/bin/vm-hands/package-9w0mmxb5.js +2 -0
- package/bin/vm-hands/permissions-scffy1px.js +2 -0
- package/bin/vm-hands/reason-hands-protocol-pck5har9.js +2 -0
- package/bin/vm-hands/serve-service-grp91ybk.js +2 -0
- package/bin/vm-hands/{status-khqk4cjw.js → status-89999mdn.js} +7 -7
- package/bin/vm-hands/version-wyshazh7.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-zawytz09.js → vm-hands-entry-lite-12ck5swp.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-j10cw3d9.js → vm-hands-entry-lite-13nx02p7.js} +7 -7
- package/bin/vm-hands/{vm-hands-entry-lite-vdv4nm5f.js → vm-hands-entry-lite-1b21avcs.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-1eyg750p.js +48 -0
- package/bin/vm-hands/{vm-hands-entry-lite-2dak7e1h.js → vm-hands-entry-lite-1xhpn3hw.js} +3 -5
- package/bin/vm-hands/{vm-hands-entry-lite-ms99mzp0.js → vm-hands-entry-lite-284z7ct8.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-a7bf7xr7.js → vm-hands-entry-lite-2qfmabqn.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-q9s1e2y1.js → vm-hands-entry-lite-33at6g06.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-jgk5z8zc.js → vm-hands-entry-lite-34b4tws6.js} +6 -6
- package/bin/vm-hands/{vm-hands-entry-lite-e3fn8ys2.js → vm-hands-entry-lite-3gc2bn5a.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-hxfxs7r9.js → vm-hands-entry-lite-3q2ng4e9.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-432khjd5.js +150 -0
- package/bin/vm-hands/vm-hands-entry-lite-6vnjgy77.js +81 -0
- package/bin/vm-hands/{vm-hands-entry-lite-ht6hzkgj.js → vm-hands-entry-lite-7r27208j.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-hs6sdn60.js → vm-hands-entry-lite-88dxn9b5.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-997y1m1r.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-zh6ncdjn.js → vm-hands-entry-lite-a3gq377t.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-m1we91g4.js → vm-hands-entry-lite-af45ma9p.js} +10 -10
- package/bin/vm-hands/{vm-hands-entry-lite-0wb1n769.js → vm-hands-entry-lite-b1vanmtv.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-5y4phfv1.js → vm-hands-entry-lite-bsk184m7.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-q9djb28r.js → vm-hands-entry-lite-cc8hwgxc.js} +3 -3
- package/bin/vm-hands/vm-hands-entry-lite-chq0qx9f.js +12 -0
- package/bin/vm-hands/{vm-hands-entry-lite-84mc1f7h.js → vm-hands-entry-lite-cmmb9k3g.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-gxpw14jv.js → vm-hands-entry-lite-dy204qh4.js} +7 -7
- package/bin/vm-hands/{vm-hands-entry-lite-ptycjmkc.js → vm-hands-entry-lite-fccn6s4j.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-qf990rxw.js → vm-hands-entry-lite-fn2805g8.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-71ebge0c.js → vm-hands-entry-lite-fxptf351.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-vkhacd00.js → vm-hands-entry-lite-gcqqnnze.js} +19 -19
- package/bin/vm-hands/{vm-hands-entry-lite-57ajjwmh.js → vm-hands-entry-lite-gxf2r5en.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-hjjbjpd7.js → vm-hands-entry-lite-jj7873n8.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-9g52kxyj.js → vm-hands-entry-lite-kbnxk71q.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-ncyrz48z.js +4 -0
- package/bin/vm-hands/{vm-hands-entry-lite-y3nz20wb.js → vm-hands-entry-lite-ngn4tafr.js} +105 -105
- package/bin/vm-hands/{vm-hands-entry-lite-52qz0n30.js → vm-hands-entry-lite-ngry8nkq.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-8xv6c0rm.js → vm-hands-entry-lite-pg7nnyc6.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-h7nk2848.js → vm-hands-entry-lite-pt19vacn.js} +42 -42
- package/bin/vm-hands/{vm-hands-entry-lite-tcmye5ny.js → vm-hands-entry-lite-q62g6sx0.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-v4hr9x9h.js → vm-hands-entry-lite-qjrgvdbj.js} +34 -34
- package/bin/vm-hands/{vm-hands-entry-lite-bj3w2ven.js → vm-hands-entry-lite-rqfhfp09.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-krpqqx12.js → vm-hands-entry-lite-rxydyqke.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-weqam12f.js → vm-hands-entry-lite-s93f3pbv.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-z0ht62s4.js → vm-hands-entry-lite-sh4mqy93.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-xvccy3z4.js → vm-hands-entry-lite-sz7z1qby.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-wcgm41jq.js → vm-hands-entry-lite-t43bz0ey.js} +7 -7
- package/bin/vm-hands/{vm-hands-entry-lite-6jxshhps.js → vm-hands-entry-lite-t86kt9jz.js} +6 -6
- package/bin/vm-hands/{vm-hands-entry-lite-7pfhwxn5.js → vm-hands-entry-lite-tnj3483k.js} +1 -1
- package/bin/vm-hands/vm-hands-entry-lite-wnqqjsew.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-pxtycfdv.js → vm-hands-entry-lite-xfak34av.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-sy7dcccg.js → vm-hands-entry-lite-y0jtj8zz.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-yvws5zpx.js → vm-hands-entry-lite-yg4dk99m.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-2rgf8866.js → vm-hands-entry-lite-z65xva21.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-jpvmkce5.js → vm-hands-entry-lite-zp7chzcc.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-k5ytpgzz.js → vm-hands-entry-lite-zpvr7wc6.js} +19 -19
- package/bin/vm-hands/vm-hands-entry-lite.js +2 -2
- package/bin/vm-hands/vm-hands-executor-kyb5t371.js +12 -0
- package/bin/vm-hands/vm-hands-op-runner-gkt79hcp.js +2 -0
- package/bin/vm-hands/{vm-hands-runtime-1qxf96z7.js → vm-hands-runtime-tdr6j55n.js} +3 -3
- package/bin/vm-hands/worker-preview-readiness-h96yr4wf.js +2 -0
- package/bin/vm-hands/worker-sandbox-6kkhvryn.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/agent-network-kk36zca7.js +0 -2
- package/bin/vm-hands/api-credentials-mtfdk175.js +0 -2
- package/bin/vm-hands/api-w6w7vfp3.js +0 -2
- package/bin/vm-hands/connect-cli-dmwph620.js +0 -2
- package/bin/vm-hands/credentials-s7ps7y6s.js +0 -2
- package/bin/vm-hands/custom-endpoint-device-3xnrp33e.js +0 -2
- package/bin/vm-hands/desktop-account-eg8thn79.js +0 -2
- package/bin/vm-hands/device-workspace-h5rsecq8.js +0 -2
- package/bin/vm-hands/hands-worker-source-vk664w8p.js +0 -2
- package/bin/vm-hands/install-receipt-j04hdw1k.js +0 -2
- package/bin/vm-hands/local-automation-vvt9d9xb.js +0 -2
- package/bin/vm-hands/local-capabilities-pwv76ns5.js +0 -2
- package/bin/vm-hands/local-desktop-users-sq4trh07.js +0 -2
- package/bin/vm-hands/local-display-mac-yxcxvg2z.js +0 -2
- package/bin/vm-hands/local-display-session-axh9mfdk.js +0 -2
- package/bin/vm-hands/local-display-video-pxhztqk7.js +0 -2
- package/bin/vm-hands/local-managed-process-4mgqn7tg.js +0 -2
- package/bin/vm-hands/local-pty-session-edd8ttf9.js +0 -2
- package/bin/vm-hands/managed-runtime-pcagtyfz.js +0 -2
- package/bin/vm-hands/network-auto-update-wkzb91qz.js +0 -3
- package/bin/vm-hands/network-contract-8mxtma3w.js +0 -2
- package/bin/vm-hands/package-vwvzjtn0.js +0 -2
- package/bin/vm-hands/permissions-348prrcx.js +0 -2
- package/bin/vm-hands/reason-hands-protocol-1nkpw1v3.js +0 -2
- package/bin/vm-hands/serve-service-3dkyznay.js +0 -2
- package/bin/vm-hands/version-c1hen0wn.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-9yfmkd1f.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-ab1pq3xg.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-hn9pq7zj.js +0 -127
- package/bin/vm-hands/vm-hands-entry-lite-nn6zcvmp.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-z213y4pj.js +0 -150
- package/bin/vm-hands/vm-hands-executor-csdtg7kj.js +0 -12
- package/bin/vm-hands/vm-hands-op-runner-z7tsd84c.js +0 -2
- package/bin/vm-hands/worker-preview-readiness-06tygyjs.js +0 -2
- package/bin/vm-hands/worker-sandbox-e1cpkzfz.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ol,ot,vc,Pl,as,$i,We}from"./vm-hands-entry-lite-y0jtj8zz.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";export{ol as FUTURE_DEVICE_CONSENT_SCOPE,Pl as INSTALLER_WORKER_EXECUTABLES,ot as installationReceiptPath,vc as installerLauncherNames,$i as installerReasonAlias,as as installerReceiptLauncher,We as loadInstallationReceipt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{hr,Oo,No,Lo,Cl,$o}from"./vm-hands-entry-lite-1xhpn3hw.js";import"./vm-hands-entry-lite-432khjd5.js";import"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-1eyg750p.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-6vnjgy77.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-af45ma9p.js";import"./vm-hands-entry-lite-y0jtj8zz.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-t43bz0ey.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-t86kt9jz.js";import"./vm-hands-entry-lite-rqfhfp09.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{No as ensureLocalBrowser,hr as localAutomationAvailable,Lo as localBrowserProfile,Oo as localUserChromeHost,Cl as runAutomationCallLocally,$o as runLocalAutomation};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Qr,en,ho,Gn,tl,rl,Kn,fo,mo,go,Jn}from"./vm-hands-entry-lite-pt19vacn.js";import"./vm-hands-entry-lite-ngry8nkq.js";import"./vm-hands-entry-lite-bsk184m7.js";import"./vm-hands-entry-lite-gcqqnnze.js";import"./vm-hands-entry-lite-qjrgvdbj.js";import"./vm-hands-entry-lite-b1vanmtv.js";import"./vm-hands-entry-lite-s93f3pbv.js";import"./vm-hands-entry-lite-yg4dk99m.js";import"./vm-hands-entry-lite-1xhpn3hw.js";import"./vm-hands-entry-lite-432khjd5.js";import"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-1eyg750p.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-6vnjgy77.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-af45ma9p.js";import"./vm-hands-entry-lite-y0jtj8zz.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-t43bz0ey.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-t86kt9jz.js";import"./vm-hands-entry-lite-rqfhfp09.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";export{r as LocalCapabilityError,Qr as SHORT_REQUEST_CAPABILITIES,fo as capabilityInventoryForRoots,en as confinedExecutionShell,Gn as defaultLocalCommandRunner,mo as deliverLocalHandsEnvironment,Kn as enrolledRootPaths,Jn as executeLocalOperation,go as rebindLocalHandsControl,tl as runFileCapability,rl as runTransferCapability,ho as spawnCaptured};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qr,Dl,ya,wa,ba}from"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{Dl as forgetLocalDesktopUse,ba as holdLocalDesktop,qr as noteLocalDesktopUse,ya as releaseLocalDesktop,wa as trackDesktopRun};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{un,Mo,Te,jt,dn}from"./vm-hands-entry-lite-432khjd5.js";import"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-1eyg750p.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-6vnjgy77.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-t43bz0ey.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-t86kt9jz.js";import"./vm-hands-entry-lite-rqfhfp09.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{jt as ensureLinuxDesktop,un as localDisplayAvailable,Mo as localDisplayReady,Te as privateDirectory,dn as runLocalDisplayStream};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Go,Ko,Jo,Xo,Jt}from"./vm-hands-entry-lite-1eyg750p.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-6vnjgy77.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-t43bz0ey.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-t86kt9jz.js";import"./vm-hands-entry-lite-rqfhfp09.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";export{Go as MAC_SCREEN,Ko as WINDOWS_SCREEN,Jo as createDisplayVideoLane,Jt as localDisplayVideoAvailable,Xo as simulatorVideoFfmpeg};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{lr,Qn,wo,ei}from"./vm-hands-entry-lite-bsk184m7.js";import"./vm-hands-entry-lite-gcqqnnze.js";import"./vm-hands-entry-lite-qjrgvdbj.js";import"./vm-hands-entry-lite-b1vanmtv.js";import"./vm-hands-entry-lite-s93f3pbv.js";import"./vm-hands-entry-lite-yg4dk99m.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{lr as ManagedProcessStoppedError,wo as controlManagedDeviceProcess,ei as retireManagedDeviceProcess,Qn as runManagedDeviceProcess};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{yi,pn,wi,il,Bo,bi,Fo}from"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";export{pn as LOCAL_PTY_MAX_BUFFERED_OUTPUT_BYTES,wi as LOCAL_PTY_MAX_SESSIONS,yi as LOCAL_PTY_MAX_SESSION_MS,bi as defaultConnect,il as defaultLoginShell,Bo as ptyRuntimeSupported,Fo as runLocalPtySession};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Qc,Lt,bl,Yr,vl,Sl,Ze,El,kl,ie,xl,N,ro}from"./vm-hands-entry-lite-dy204qh4.js";import"./vm-hands-entry-lite-yg4dk99m.js";import{bn,Di}from"./vm-hands-entry-lite-1b21avcs.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-t86kt9jz.js";import"./vm-hands-entry-lite-rqfhfp09.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{Qc as MANAGED_RUNTIME_MANIFEST_URL,bn as MANAGED_RUNTIME_MAX_MANIFEST_BYTES,ie as acquireManagedRuntimeDirectoryLock,xl as acquireManagedRuntimeLock,Ze as currentManagedRuntimeVersion,Yr as fetchManagedRuntimeBytes,ro as flushManagedRuntimeLifecycleEvents,Sl as installManagedRuntimeLauncher,El as isManagedRuntimeVersionExecutable,bl as legacyManagedRuntimePaths,kl as managedRuntimeExecutableVersion,Lt as managedRuntimePaths,Di as parseAndVerifyManagedRuntimeManifest,N as recordManagedRuntimeLifecycle,vl as updateManagedRuntime};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{R}from"./vm-hands-entry-lite-z65xva21.js";import{w}from"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-rxydyqke.js";import"./vm-hands-entry-lite-kbnxk71q.js";import{ot,We}from"./vm-hands-entry-lite-y0jtj8zz.js";import{ys}from"./vm-hands-entry-lite-rqfhfp09.js";import"./vm-hands-entry-lite-t86kt9jz.js";import"./vm-hands-entry-lite-dy204qh4.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-6vnjgy77.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-t43bz0ey.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-cmmb9k3g.js";import"./vm-hands-entry-lite-2qfmabqn.js";import"./vm-hands-entry-lite-7r27208j.js";import"./vm-hands-entry-lite-tnj3483k.js";import"./vm-hands-entry-lite-af45ma9p.js";import"./vm-hands-entry-lite-gcqqnnze.js";import"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";import"./vm-hands-entry-lite-ngn4tafr.js";import"./vm-hands-entry-lite-s93f3pbv.js";import"./vm-hands-entry-lite-ngry8nkq.js";import"./vm-hands-entry-lite-997y1m1r.js";import"./vm-hands-entry-lite-pt19vacn.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-qjrgvdbj.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-bsk184m7.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-432khjd5.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-1eyg750p.js";import"./vm-hands-entry-lite-1xhpn3hw.js";import"./vm-hands-entry-lite-284z7ct8.js";import"./vm-hands-entry-lite-b1vanmtv.js";import"./vm-hands-entry-lite-yg4dk99m.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-12ck5swp.js";import{Me,Be}from"./vm-hands-entry-lite-pg7nnyc6.js";import{spawn as I}from"child_process";import{randomUUID as A}from"crypto";import{closeSync as M,existsSync as T,mkdirSync as y,openSync as N,readFileSync as U,renameSync as O,rmSync as V,writeFileSync as F}from"fs";import{homedir as u}from"os";import{dirname as p,join as h}from"path";var L=["curl","npm","bun","brew"];function x(e){return L.includes(e)}function v(e,n=process.env){let r=R(n,"REASON_INSTALL_METHOD");if(x(r))return r;let t=e.replaceAll("\\","/").toLowerCase();if(t.includes("/.bun/install/global/"))return"bun";if(t.includes("/node_modules/"))return"npm";if(t.includes("/cellar/")||t.includes("/homebrew/"))return"brew";return"curl"}var f=86400000,_=7200000,W=900000,q=900000,J=30000,B=3600000,j=43200000,G="network-update-check.json",K="automatic-updates-declined.json",H="network-update.log";function g(e,n){return p(ot(e,n))}function S(e=process.env,n=u()){return T(h(g(e,n),K))}function b(e){if(!e||e.channel!=="production"||e.install_method!=="curl")return"no_receipt";return e.background_mode==="cli_only"?null:"background_updater"}function Y(e={}){let n=e.env??process.env,r=e.home??u(),t=e.executablePath??process.execPath;if(!(e.compiled??ys(e.main)))return"source_checkout";if(w({env:n,executablePath:t})!=="production")return"not_production";if(v(t,n)!=="curl")return"package_manager";let o=e.receipt===void 0?We(ot(n,r)):e.receipt,s=b(o);if(s)return s;if(S(n,r))return"declined";return"eligible"}async function jt(e,n=process.env,r=u()){if(e.background_mode!=="cli_only")return"background_updater";if(S(n,r))return"declined";if(b(e)!==null)return"none";let{installedEngineVersion:t}=await import("./agent-network-mnv1fm1c.js");return t(r)===null?"none":"reason_network"}function X(e){try{let n=JSON.parse(U(e,"utf8"));return n?.schema_version===1&&typeof n.next_at==="string"&&Number.isFinite(Date.parse(n.next_at))?n:null}catch{return null}}function z(e,n){y(p(e),{recursive:!0,mode:448});let r=`${e}.${process.pid}.${A()}.tmp`;try{F(r,`${JSON.stringify(n)}
|
|
3
|
+
`,{mode:384,flag:"wx"}),O(r,e)}finally{V(r,{force:!0})}}function Q(e={}){let n=h(g(e.env??process.env,e.home??u()),G),r=(e.now??new Date).getTime(),t=()=>{let i=(e.random??Math.random)();return Number.isFinite(i)?Math.min(Math.max(i,0),1):0},o=(i)=>z(n,{schema_version:1,next_at:new Date(i).toISOString()}),s=X(n),c=s?Date.parse(s.next_at):NaN;if(!s||c>r+f+_)return o(r+Math.floor(t()*f)),!1;if(r<c)return!1;return o(r+f+Math.round((t()*2-1)*_)),!0}function Z(e,n={}){let r=n.platform??process.platform,t=n.kill??Be,o=(c)=>{try{t(e,c,r)}catch{}};if(o("SIGTERM"),r==="win32")return;setTimeout(()=>o("SIGKILL"),n.graceMs??J).unref?.()}function ee(e={}){let n=e.env??process.env,r=e.platform??process.platform,t=h(g(n,e.home??u()),H);y(p(t),{recursive:!0,mode:448});let o=N(t,"w",384);return new Promise((s)=>{let c=!1,i=(d)=>{if(c)return;c=!0,clearTimeout(a),s(d)},l=I(e.executablePath??process.execPath,["update","--quiet"],{env:n,stdio:["ignore",o,o],windowsHide:!0,...Me(r)});M(o);let a=setTimeout(()=>{if(l.pid)Z(l.pid,{platform:r,...e.killGraceMs===void 0?{}:{graceMs:e.killGraceMs},...e.kill?{kill:e.kill}:{}});i(124)},e.timeoutMs??q);a.unref?.(),l.once("error",()=>i(127)),l.once("exit",(d,m)=>i(m?128:d??1))})}function te(e,n){return new Promise((r)=>{if(n.aborted)return r();let t=setTimeout(r,e);n.addEventListener("abort",()=>{clearTimeout(t),r()},{once:!0})})}function ne(e,n=()=>new Date){let r=-1/0,t="";return(o)=>{let s=n().getTime();if(s-r<B||o===t&&s-r<j)return;r=s,t=o,e(o)}}async function Gt(e,n,r,t={}){let o=t.env??process.env,s=t.home??u(),c=t.sleep??te,i=t.now??(()=>new Date);if(o.REASON_NETWORK_NO_UPDATE||o.TINCAN_NO_UPDATE)return;let l=ne(n,i);try{let a=t.refreshEngine??(async(m)=>(await import("./agent-network-mnv1fm1c.js")).refreshEngine({home:s,env:o,beforeRestart:m})),d=()=>l("moved the network engine to this release's pin; its daemon restarts on it");if(await a(d)){d();return}}catch(a){l(`couldn't move the network engine to this release's pin: ${a instanceof Error?a.message:String(a)}`)}while(!e.aborted){try{if(Y({env:o,home:s,...t.executablePath?{executablePath:t.executablePath}:{},...t.compiled===void 0?{}:{compiled:t.compiled}})==="eligible"&&Q({env:o,home:s,now:i(),...t.random?{random:t.random}:{}})){let d=await(t.update??(()=>ee({env:o,home:s,...t.executablePath?{executablePath:t.executablePath}:{}})))();if(d===0)await r();else l(`reason update failed (exit ${d}); the next try is in about a day`)}}catch(a){l(`automatic update: ${a instanceof Error?a.message:String(a)}`)}await c(t.tickMs??W,e)}}export{jt as automaticUpdatesFor,Gt as keepNetworkComputerCurrent};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{er,Xe,vs,Ss,M,At,Es,Fn,ks,Lr,xs,Cs,As,Ps,Rs,Ts,Is,Ds,Os,Ns,Ls,$s,Ms,Bs,Fs,js,ct,Le,Pt,xe,Hs,Us,zs,pe,qs,Ws,Vs,Gs,Ks,$r,Js,Xs,tr,Mr,Ys,Vi,Zs,Qs,ea,jn,ta,ra,na,ia,oa,sa,aa,ca,la,ua}from"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";export{Js as AUTOMATION_CLOUD_SESSIONS,$r as AUTOMATION_USER_CHROME,Ls as HANDS_CLOUD_ACCESS,$s as HANDS_CLOUD_ACCESS_KEY,ct as HANDS_CONFINEMENT,Le as HANDS_CONFINEMENT_KEY,Ps as HANDS_ENVIRONMENT_AT_CLAIM,Rs as HANDS_ENVIRONMENT_AT_CLAIM_KEY,ks as HANDS_ENVIRONMENT_DELIVERY,Lr as HANDS_ENVIRONMENT_DELIVER_CONTROL,Ms as HANDS_HEADLESS_BROWSER,Bs as HANDS_HEADLESS_BROWSER_KEY,Hs as HANDS_JOBS_USER,Us as HANDS_JOBS_USER_KEY,Fs as HANDS_LARGE_ENVIRONMENT,js as HANDS_LARGE_ENVIRONMENT_KEY,Pt as HANDS_MODEL_JOBS_EGRESS,xe as HANDS_MODEL_JOBS_EGRESS_KEY,Ds as HANDS_REBIND,Ns as HANDS_REBIND_CONTROL,Os as HANDS_REBIND_KEY,qs as HANDS_SESSION_CAP_KEY,Ws as HANDS_SESSION_CAP_NONE,zs as HANDS_SESSION_GROUP,pe as HANDS_SESSION_GROUP_KEY,Ts as HANDS_WORKSPACE_CHECK,Is as HANDS_WORKSPACE_CHECK_KEY,Gs as JOBS_START_WAIT,Ks as JOBS_START_WAIT_KEY,Xe as LOCAL_OPERATION_MAX_BYTES,er as LOCAL_RUNTIME_PROTOCOL_VERSION,M as LOCAL_RUNTIME_ROUTES,Fn as LOCAL_RUNTIME_SESSION_CLAIM_WAIT_MAX_MS,At as LOCAL_RUNTIME_SESSION_PATH,tr as LOCAL_RUNTIME_WORKER_STARTUP_MAX_MS,vs as RELAY_HOST_ALIAS_HEADER,Ss as RELAY_HOST_ALIAS_VERSION,As as VM_HANDS_UNBIND_UNVERIFIED_EVENT,xs as VM_HANDS_WORKSPACE_DEFERRED_KEY,Cs as VM_HANDS_WORKSPACE_GRANT_CONTROL,Vs as WORKER_PREVIEW_CARRIED_JOBS,Xs as WORKER_STARTUP_TIMING_STAGES,Mr as buildLocalRuntimeDeviceProofBytes,Es as localRuntimeSessionRoutable,na as parseLocalRuntimeDisconnectResponse,Qs as parseLocalRuntimeEnrollmentResponse,Ys as parseLocalRuntimeErrorEnvelope,jn as parseLocalRuntimeFirstHeartbeat,ea as parseLocalRuntimeHeartbeatResponse,ra as parseLocalRuntimeIdentityResponse,oa as parseLocalRuntimeLifecycleResponse,ia as parseLocalRuntimeLocalSubscriptionResponse,sa as parseLocalRuntimeOperationClaim,ua as parseLocalRuntimeOperationCompletionResponse,la as parseLocalRuntimeOperationEnvironmentResponse,ca as parseLocalRuntimeOperationEventsResponse,aa as parseLocalRuntimeOperationHeartbeatResponse,Vi as parseLocalRuntimeProofChallenge,Zs as parseLocalRuntimeRegistrationResponse,ta as parseLocalRuntimeRootsSyncResponse};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./vm-hands-entry-lite-
|
|
3
|
-
`),!1}var S=300000,R=21600000;async function xe(r,e,t,o){let i=
|
|
2
|
+
import"./vm-hands-entry-lite-cmmb9k3g.js";import{Fe}from"./vm-hands-entry-lite-34b4tws6.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-kbnxk71q.js";import{ve}from"./vm-hands-entry-lite-2qfmabqn.js";import"./vm-hands-entry-lite-rxydyqke.js";import{be}from"./vm-hands-entry-lite-7r27208j.js";import{Ir}from"./vm-hands-entry-lite-rqfhfp09.js";import"./vm-hands-entry-lite-tnj3483k.js";import"./vm-hands-entry-lite-y0jtj8zz.js";import{Ea,ka,xa,Kr,Jr}from"./vm-hands-entry-lite-jj7873n8.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import{createHash as k}from"crypto";var _={start:"/network/auth/start",poll:"/network/auth/poll",key:"/network/auth/key",teams:"/v3/network/teams",leave:"/v3/network/teams/leave",proof:"/v3/network/proof"};async function I(r,e,t={}){let o=AbortSignal.timeout(t.timeoutMs??30000),i=await fetch(r,{method:"POST",redirect:"error",signal:t.signal?AbortSignal.any([t.signal,o]):o,headers:{"content-type":"application/json","user-agent":Ir,...t.token?{authorization:`Bearer ${t.token}`}:{}},body:JSON.stringify(e)}),n=await i.json().catch(()=>({}));return{status:i.status,body:n&&typeof n==="object"?n:{}}}var u=(r)=>k("sha256").update(r).digest("hex");async function b(r,e,t,o,i=!1){let n={team_id:t.teamId,team_name:t.teamName,link:o,...i?{own_copy:!0}:{}},s=await I(`${r}${_.teams}`,n,{token:e}).catch(()=>null);return s!==null&&s.status>=200&&s.status<300}async function v(r,e,t,o,i={}){let n=Jr(t);if(!n||!i.ownCopy&&e.registered===u(n.secret))return!0;let s=Ea(i.home),a=ve(s)?await be({path:s}).catch(()=>null):null,c=(await r.team())?.name??e.team;if(a&&await b(a.apiOrigin,a.accessToken,{teamId:n.teamId,teamName:c},t,i.ownCopy)){if(!i.ownCopy&&e.registered!==u(n.secret))xa({...e,registered:u(n.secret)},i.home);return!0}return o?.stderr.write(T(`Your Reason account still lists ${Fe(c)}'s old link; signing in for this network refreshes it: reason network join '${t}'`)+`
|
|
3
|
+
`),!1}var S=300000,R=21600000;async function xe(r,e,t,o){let i=ka(t),n=o?await r.team():null;if(i&&(!o||i.team===n?.name)){let{url:l}=await r.link(),d=Jr(l);if(!d||u(d.secret)===e.sent)return e;return await v(r,i,l,null,{ownCopy:!0,...t?{home:t}:{}})?{...e,sent:u(d.secret)}:e}if(!o||!n?.teamId||Kr(t)?.team===n.name)return e;let{url:s}=await r.link(),a=Jr(s);if(!a||a.teamId!==n.teamId.toLowerCase())return e;let c=u(a.secret);if(c===e.sent||e.refused?.link===c&&Date.now()<e.refused.until)return e;if(await(async()=>{let l=await o.agentNetwork();if(l.team===n.name||l.link&&Jr(l.link)?.teamId===a.teamId)return!1;return await o.registerNetworkTeam({team_id:a.teamId,team_name:n.name,link:s,own_copy:!0}),!0})().catch(()=>!1))return{sent:c,refused:null};let g=e.refused?.link===c?e.refused.tries+1:1;return{...e,refused:{link:c,tries:g,until:Date.now()+Math.min(R,S*2**Math.min(g-1,10))}}}var T=(r)=>process.stdout.isTTY?`\x1B[2m${r}\x1B[22m`:r;export{xe as sendTeamLink};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{sl,Ac,Rl,al,Tl}from"./vm-hands-entry-lite-t43bz0ey.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-t86kt9jz.js";import"./vm-hands-entry-lite-rqfhfp09.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";export{al as allowMacPermissions,Rl as permissionsSummary,Ac as readMacPermissions,sl as reasonIdentity,Tl as runPermissionsCli};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{F,Ei,ki,jo,_r,Ho,xi,qt,_t,Uo,Wt,_n,He,Vt,zo,yt,yn,Ci,wn,Ai,qo,nt,Ee,ce,it,Pi,Ri,Wo}from"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-kbnxk71q.js";export{Ai as REASON_HANDS_CLOSE_CODES,Wt as REASON_HANDS_JOB_CONTROL_MAX_FRAME_BYTES,xi as REASON_HANDS_JOB_MAX_INPUT_CHARS,qt as REASON_HANDS_JOB_MAX_OUTPUT_CHARS,_t as REASON_HANDS_JOB_MAX_OUTPUT_CHUNKS,Uo as REASON_HANDS_JOB_MAX_RECORDS,Ho as REASON_HANDS_MAX_ERROR_CHARS,Ei as REASON_HANDS_MAX_FRAME_BYTES,ki as REASON_HANDS_MAX_INPUT_CHARS,_r as REASON_HANDS_MAX_OUTPUT_CHARS,jo as REASON_HANDS_MAX_STRUCTURED_INPUT_CHARS,F as REASON_HANDS_PROTOCOL_VERSION,Ci as REASON_HANDS_PTY_ANCHOR_EXIT_MS,wn as REASON_HANDS_PTY_CLEANUP_RECEIPT_MS,yn as REASON_HANDS_PTY_CLEANUP_SWEEP_MS,yt as REASON_HANDS_PTY_MAX_DIMENSION,He as REASON_HANDS_PTY_MAX_INPUT_BYTES,Vt as REASON_HANDS_PTY_MAX_OUTPUT_BYTES,zo as REASON_HANDS_PTY_MAX_PENDING_INPUT_BYTES,_n as REASON_HANDS_PTY_PROTOCOL_VERSION,qo as REASON_HANDS_WORKSPACE_BEFORE_MAX_OUTPUT_CHARS,Ee as isReasonHandsGeneration,it as isReasonHandsPtyJobId,nt as isReasonHandsRequestId,ce as isReasonHandsUuid,Pi as parseReasonHandsJobRequest,Ri as parseReasonHandsJobResult,Wo as parseReasonHandsPtyReceipt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ke,de,j,ze,ns,En,is,qe,Ni,Li,os,kn,Ie,ss,xn}from"./vm-hands-entry-lite-af45ma9p.js";import"./vm-hands-entry-lite-y0jtj8zz.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-t86kt9jz.js";import"./vm-hands-entry-lite-rqfhfp09.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{ke as WORKER_SERVICE_ENV,j as WorkerServiceError,En as connectServiceLabel,de as defaultWorkerServiceHost,kn as installWorkerService,qe as installedWorkerService,is as isConnectServiceLabel,xn as removeWorkerService,Ie as restartWorkerService,ss as retargetWorkerServiceLogs,Ni as retireLegacyWorkerService,os as workerServiceDefinitionCurrent,ze as workerServiceLauncher,Li as workerServiceProcessRunning,ns as workerServiceRetargetPending};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./vm-hands-entry-lite-
|
|
2
|
+
import"./vm-hands-entry-lite-cmmb9k3g.js";import"./vm-hands-entry-lite-z65xva21.js";import{w,Ve,kc}from"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-kbnxk71q.js";import{Q}from"./vm-hands-entry-lite-2qfmabqn.js";import"./vm-hands-entry-lite-rxydyqke.js";import{me}from"./vm-hands-entry-lite-7r27208j.js";import{g}from"./vm-hands-entry-lite-rqfhfp09.js";import{ir}from"./vm-hands-entry-lite-tnj3483k.js";import{mn,rt}from"./vm-hands-entry-lite-xfak34av.js";import{f,S,nr,Z,fe,Qi,eo}from"./vm-hands-entry-lite-ngn4tafr.js";import"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";import"./vm-hands-entry-lite-pt19vacn.js";import"./vm-hands-entry-lite-gcqqnnze.js";import"./vm-hands-entry-lite-s93f3pbv.js";import"./vm-hands-entry-lite-ngry8nkq.js";import"./vm-hands-entry-lite-997y1m1r.js";import"./vm-hands-entry-lite-6vnjgy77.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-t86kt9jz.js";import"./vm-hands-entry-lite-t43bz0ey.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-dy204qh4.js";import{We}from"./vm-hands-entry-lite-y0jtj8zz.js";import"./vm-hands-entry-lite-af45ma9p.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-qjrgvdbj.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-bsk184m7.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-432khjd5.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-1eyg750p.js";import"./vm-hands-entry-lite-1xhpn3hw.js";import"./vm-hands-entry-lite-284z7ct8.js";import"./vm-hands-entry-lite-b1vanmtv.js";import"./vm-hands-entry-lite-yg4dk99m.js";import"./vm-hands-entry-lite-88dxn9b5.js";import{s}from"./vm-hands-entry-lite-12ck5swp.js";import{t,o,d,n,c,i}from"./vm-hands-entry-lite-zpvr7wc6.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import{createHash as Ye,randomBytes as Qe}from"crypto";import{readFileSync as Ze,realpathSync as ye,renameSync as en,unlinkSync as nn,writeFileSync as tn}from"fs";import{dirname as rn,join as we}from"path";import{spawnSync as xe}from"child_process";import{accessSync as $e,constants as Ue,existsSync as J,mkdirSync as Le,readFileSync as Te,renameSync as Ee,writeFileSync as Oe}from"fs";import{homedir as De}from"os";import{delimiter as Ne,dirname as Fe,join as D}from"path";import{existsSync as Me,readFileSync as Ae}from"fs";import{join as Pe}from"path";var Ie=`---
|
|
3
3
|
name: reason
|
|
4
4
|
description: Integrate software with Reason's public REST API using a scoped API key. Use for API clients, CI, service integrations, or cloud coding-session automation.
|
|
5
5
|
---
|
|
@@ -43,7 +43,7 @@ Base URL: \`https://api.reasonmachines.com/v3\`
|
|
|
43
43
|
authority from a repository name or an untrusted task payload.
|
|
44
44
|
`;function V(e){return Pe(e,".agents","skills","ara","SKILL.md")}function re(e){let r=V(e);return Me(r)&&Ae(r,"utf8")===Ie}var Y=["codex","claude","cursor"],oe={codex:"Codex",claude:"Claude Code",cursor:"Cursor"};function je(e,r=process.env){let a=r.PATH??"",u=process.platform==="win32"?(r.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";"):[""];for(let l of a.split(Ne)){if(!l)continue;for(let m of u)try{return $e(D(l,`${e}${m}`),Ue.X_OK),!0}catch{}}return!1}function ze(){return{exists:je,run(e,r,a={}){let u=a.interactive===!0,l=xe(e,r,{encoding:"utf8",env:process.env,stdio:u?"inherit":"pipe"});return{status:l.status??1,stdout:u?"":l.stdout??"",stderr:u?l.error?.message??"":`${l.stderr??""}${l.error?`${l.error.message}
|
|
45
45
|
`:""}`}}}}function O(e){return`${e.stdout}
|
|
46
|
-
${e.stderr}`}function A(e){return e.status===0}function E(e,r,a,u={}){let l=e.run(r,a,u);if(A(l))return l;let m=O(l).trim();throw Error(`${r} ${a.join(" ")} failed${m?`: ${m}`:` with exit code ${l.status}`}`)}function Be(e=process.env){return
|
|
46
|
+
${e.stderr}`}function A(e){return e.status===0}function E(e,r,a,u={}){let l=e.run(r,a,u);if(A(l))return l;let m=O(l).trim();throw Error(`${r} ${a.join(" ")} failed${m?`: ${m}`:` with exit code ${l.status}`}`)}function Be(e=process.env){return kc(w({env:e}))}function ee(e,r){return e.split(/\s+/).some((a)=>ae(a,r))}function H(e){return D(e,".cursor","mcp.json")}function se(e){if(!J(e))return{};try{let r=JSON.parse(Te(e,"utf8"));if(!r||typeof r!=="object"||Array.isArray(r))throw Error("top-level value must be an object");return r}catch(r){let a=r instanceof Error?r.message:String(r);throw Error(`Cursor MCP config at ${e} is invalid; refusing to overwrite it (${a})`)}}function He(e,r){Le(Fe(e),{recursive:!0,mode:448});let a=`${e}.ara-${process.pid}.tmp`;Oe(a,`${JSON.stringify(r,null,2)}
|
|
47
47
|
`,{mode:384}),Ee(a,e)}function ae(e,r){if(typeof e!=="string")return!1;if(e===r)return!0;try{let a=new URL(e);return["https://api.ara.so","https://api-staging.ara.so","https://api.reasonmachines.ai","https://staging-api.reasonmachines.ai","https://api.reasonmachines.com","https://staging-api.reasonmachines.com"].includes(a.origin)&&!a.username&&!a.password&&a.pathname==="/mcp/ara"&&!a.search&&!a.hash}catch{return!1}}function Je(e,r){let a=e.mcpServers?.ara;return Boolean(a&&typeof a==="object"&&!Array.isArray(a)&&ae(a.url,r))}class K{runner;home;mcpUrl;constructor(e=ze(),r=De(),a=Be()){this.runner=e;this.home=r;this.mcpUrl=a}isAvailable(e){if(e==="codex")return this.runner.exists("codex");if(e==="claude")return this.runner.exists("claude");return this.runner.exists("cursor")||J("/Applications/Cursor.app")||J(D(this.home,"Applications","Cursor.app"))||J(H(this.home))}availableClients(){return Y.filter((e)=>this.isAvailable(e))}installationPath(e){if(e==="cursor")return H(this.home);if(e==="codex")return D(this.home,".codex","plugins","cache","ara");return D(this.home,".claude","plugins","cache","ara")}sharedSkillStatus(){return{installed:re(this.home),path:V(this.home)}}status(e){let r=oe[e];if(!this.isAvailable(e))return{id:e,label:r,available:!1,installed:!1,connection:null,detail:"Client not detected",legacyInstallations:[]};if(e==="cursor"){let C=H(this.home),M=Je(se(C),this.mcpUrl);return{id:e,label:r,available:!0,installed:M,connection:M?"configured":null,detail:M?`Retired Reason MCP configuration in ${C}`:`No retired Reason MCP configuration in ${C}`,legacyInstallations:[]}}if(e==="codex"){let C=this.runner.run("codex",["plugin","list"]);if(!(A(C)&&O(C).includes("ara@ara")))return{id:e,label:r,available:!0,installed:!1,connection:null,detail:"No retired Reason plugin installed",legacyInstallations:[]};let x=this.runner.run("codex",["mcp","list"]),h=O(x).split(/\r?\n/).find((j)=>j.trimStart().startsWith("ara ")&&ee(j,this.mcpUrl)),W=A(x)&&Boolean(h),F=!A(x)?"error":h?.includes("Not logged in")?"not_logged_in":h?.includes("OAuth")?"oauth":h?"configured":"unknown";return{id:e,label:r,available:!0,installed:W,connection:F,detail:h?.trim()||"The retired Reason plugin is installed but has no verified retired MCP registration",legacyInstallations:[]}}let a=this.runner.run("claude",["plugin","list"]),u=O(a),l=A(a)&&u.includes("ara@ara"),m=A(a)&&u.includes("ara-handoff@ara");if(!l&&!m)return{id:e,label:r,available:!0,installed:!1,connection:null,detail:"No retired Reason plugin installed",legacyInstallations:[]};let R=this.runner.run("claude",["mcp","list"]),v=O(R),_=v.split(/\r?\n/).find((C)=>C.includes("plugin:ara:ara")&&ee(C,this.mcpUrl)),k=v.split(/\r?\n/).find((C)=>C.includes("plugin:ara-handoff:ara")&&ee(C,this.mcpUrl)),N=A(R)&&Boolean(_),b=A(R)&&k?["ara-handoff@ara"]:[],q=!A(R)?"error":_?.includes("Connected")?"connected":_?.includes("Failed")?"error":_?"configured":"unknown";return{id:e,label:r,available:!0,installed:N,connection:q,detail:_?.trim()||"The retired Reason plugin is installed but has no verified retired MCP registration",legacyInstallations:b}}statuses(){return Y.map((e)=>this.status(e))}logout(e){let r=this.status(e);if(!r.available||!r.installed)return`${r.label}: not connected`;if(e==="cursor")return this.uninstall("cursor").replace("removed retired Reason","signed out and removed retired Reason");if(e==="codex")return E(this.runner,"codex",["mcp","logout","ara"]),"Codex: signed out of Reason";return E(this.runner,"claude",["mcp","logout","plugin:ara:ara"]),"Claude Code: signed out of Reason"}uninstall(e){let r=this.status(e);if(!r.available||!r.installed)return`${r.label}: Reason is not installed`;if(e==="cursor"){let a=H(this.home),u=se(a),l={...u.mcpServers??{}};return delete l.ara,u.mcpServers=l,He(a,u),`Cursor: removed retired Reason MCP from ${a}`}if(e==="codex")return E(this.runner,"codex",["plugin","remove","ara@ara"]),"Codex: removed retired ara@ara";return E(this.runner,"claude",["plugin","uninstall","ara@ara","--scope","user"]),"Claude Code: removed retired ara@ara"}removeLegacyClaudePlugin(){if(!this.runner.exists("claude"))return"Claude Code: not installed";if(!this.status("claude").legacyInstallations.includes("ara-handoff@ara"))return"Claude Code: no legacy Reason plugin found";return E(this.runner,"claude",["plugin","uninstall","ara-handoff@ara","--scope","user"]),"Claude Code: removed obsolete ara-handoff@ara"}removeRetiredInstallations(){let e=[],r=[];for(let a of Y){let u;try{u=this.status(a)}catch(l){r.push(`${oe[a]}: ${l instanceof Error?l.message:String(l)}`);continue}if(u.installed){if(a!=="cursor")try{e.push(this.logout(a))}catch(l){r.push(`${u.label}: ${l instanceof Error?l.message:String(l)}`)}try{e.push(this.uninstall(a))}catch(l){r.push(`${u.label}: ${l instanceof Error?l.message:String(l)}`)}}if(a==="claude"&&u.legacyInstallations.includes("ara-handoff@ara"))try{e.push(this.removeLegacyClaudePlugin())}catch(l){r.push(`${u.label}: ${l instanceof Error?l.message:String(l)}`)}}if(e.length===0&&r.length===0)e.push("No retired Reason MCP configuration found.");return{messages:e,failures:r}}}function ie(e){return`claude mcp add --transport http reason ${e}`}function ce(e){return`codex mcp add reason --url ${e}
|
|
48
48
|
codex mcp login reason`}var Mn=ie("https://mcp.reasonmachines.com/mcp"),An=ce("https://mcp.reasonmachines.com/mcp"),Pn=`https://claude.ai/settings/connectors?add=custom&url=${encodeURIComponent("https://mcp.reasonmachines.com/mcp")}`,In=`https://cursor.com/install-mcp?name=reason&config=${encodeURIComponent(btoa(JSON.stringify({url:"https://mcp.reasonmachines.com/mcp"})))}`;var Ke="https://github.com/reason-machines/reason-plugins",En=`Connect a coding agent to Reason over MCP
|
|
49
49
|
|
|
@@ -52,7 +52,7 @@ Usage:
|
|
|
52
52
|
reason mcp uninstall Remove only this machine's registrations of the earlier, retired server
|
|
53
53
|
|
|
54
54
|
Plugins for Claude Code and Codex: ${Ke}
|
|
55
|
-
`;function le(e){if(!e.available)return"not detected";if(e.installed||e.legacyInstallations.length>0)return"retired configuration";return"not installed"}function
|
|
55
|
+
`;function le(e){if(!e.available)return"not detected";if(e.installed||e.legacyInstallations.length>0)return"retired configuration";return"not installed"}function qe(e,r){let a=r.toLowerCase();if(e==="codex")return a.includes("codex");if(e==="claude")return a.includes("claude");return a.includes("cursor")}function ue(e,r){return(r.mcp_connections??[]).filter((u)=>qe(e.id,u.client_name)).flatMap((u)=>u.last_used_at?[u.last_used_at]:[]).sort().at(-1)??null}function de(e,r=new Date){if(!e)return"never";let a=Date.parse(e);if(!Number.isFinite(a))return"never";let u=Math.max(0,Math.floor((r.getTime()-a)/1000));if(u<45)return"just now";let l=Math.floor(u/60);if(l<60)return`${l} ${l===1?"minute":"minutes"} ago`;let m=Math.floor(l/60);if(m<24)return`${m} ${m===1?"hour":"hours"} ago`;let R=Math.floor(m/24);return`${R} ${R===1?"day":"days"} ago`}function pe(e){let r=e.name?.trim(),a=e.email?.trim();if(r&&a)return`${r} (${a})`;return r||a||e.id||"Reason user"}function ge(e){let r=e.name?.trim(),a=e.slug?.trim();if(r&&a)return`${r} (${a})`;return r||a||e.id}var Xe=c(["granted","not_granted","unknown"]),he=n({status:Xe,checkedAt:o().finite(),executablePath:t().min(1)});var on=`Reason status
|
|
56
56
|
|
|
57
57
|
Usage:
|
|
58
58
|
reason status [--json]
|
|
@@ -61,9 +61,9 @@ Show the installed version, signed-in account and organization, this
|
|
|
61
61
|
computer's connection (\`reason connect\`) and the workspaces it serves, any
|
|
62
62
|
retired MCP configuration that can be cleaned up, and automatic updates.
|
|
63
63
|
`,sn=5000,an=300000,cn=n({version:i(1),key:t(),at:o(),self:n({principal_type:t(),user_id:t().optional(),user_name:t().nullish(),email:t().nullish(),org_id:t(),organization_name:t().nullish(),organization_slug:t().nullish(),mcp_connections:d(n({client_id:t(),client_name:t(),last_used_at:t().nullable()})).optional()})}),Re=(e)=>`${e.apiOrigin}
|
|
64
|
-
${Ye("sha256").update(e.accessToken).digest("hex")}`;function ln(e,r,a){try{let u=cn.safeParse(JSON.parse(Ze(e,"utf8")));if(!u.success||u.data.key!==Re(r))return null;let l=a-u.data.at;return l>=0&&l<an?u.data.self:null}catch{return null}}function
|
|
65
|
-
`,{mode:384,flag:"wx"}),en(l,e)}catch{try{nn(l)}catch{}}}var
|
|
66
|
-
`),1;let u=new AbortController,l=setTimeout(()=>u.abort(Error("timed out reading the account")),sn);try{let m=r.now?.()??new Date,R=performance.now(),v=R,_=()=>{let p=performance.now(),P=Math.round(p-v);return v=p,P},k=null,N=(p)=>(k=p instanceof Error?p.message:String(p),null),b=await ir(r,u.signal).catch(N),q=_(),C=b?.credentialKind==="api_key",M=b&&!C?we(rn(Q(r.env??process.env)),"status-account.json"):null,x=b&&M&&e.includes("--json")?ln(M,b,m.getTime()):null,h=x??(b?await(r.getSelf??((p,P)=>new me(p).self(P)))(b,u.signal).catch(N):null);if(b&&h&&!x&&M)
|
|
64
|
+
${Ye("sha256").update(e.accessToken).digest("hex")}`;function ln(e,r,a){try{let u=cn.safeParse(JSON.parse(Ze(e,"utf8")));if(!u.success||u.data.key!==Re(r))return null;let l=a-u.data.at;return l>=0&&l<an?u.data.self:null}catch{return null}}function un(e,r,a,u){let l=`${e}.${process.pid}.${Qe(6).toString("hex")}.tmp`;try{let m={version:1,key:Re(r),at:u,self:a};tn(l,`${JSON.stringify(m)}
|
|
65
|
+
`,{mode:384,flag:"wx"}),en(l,e)}catch{try{nn(l)}catch{}}}var dn=30000;function pn(e,r=Date.now(),a=null){let u=rt(e),l=(()=>{if(u?.state!=="connected"&&u?.state!=="starting")return!1;try{return process.kill(u.pid,0),!0}catch{return!1}})(),m=l&&u?.state==="connected",R=(k)=>m&&r-k>=0&&r-k<dn,v=he.safeParse(u?.fullDiskAccess),_=mn(u,a,r);return{..._?{permission_recovery:_}:{},full_disk_access:v.success&&R(v.data.checkedAt)?v.data.status:"unknown",keep_awake:{enabled:nr(e)==="battery_and_ac",holding:u?.idleSleepHold===!0&&R(Date.parse(u.lastHeartbeatAt??""))},executable:l&&v.success?v.data.executablePath:null}}function gn(e=w()){if(process.platform!=="darwin")return null;let r=Z(we(fe(ye(s()),e),"worker.json"));return r?pn(f(r).daemon,Date.now(),S(r)):null}var fn={background_updater:"enabled",reason_network:"enabled, daily by Reason Network",declined:"disabled (installed with --background-mode cli_only)",none:"disabled"},Ce={connected:"connected",starting:"starting",reconnecting:"reconnecting",stopping:"stopping",not_running:"not running",removed:"removed from Reason (run `reason connect` to connect it again)"};async function it(e,r={}){let a=r.io??{stdout:process.stdout,stderr:process.stderr};if(e.includes("--help")||e.includes("-h"))return a.stdout.write(on),0;if(e.some((m)=>m!=="--json"))return a.stderr.write(`Usage: reason status [--json]
|
|
66
|
+
`),1;let u=new AbortController,l=setTimeout(()=>u.abort(Error("timed out reading the account")),sn);try{let m=r.now?.()??new Date,R=performance.now(),v=R,_=()=>{let p=performance.now(),P=Math.round(p-v);return v=p,P},k=null,N=(p)=>(k=p instanceof Error?p.message:String(p),null),b=await ir(r,u.signal).catch(N),q=_(),C=b?.credentialKind==="api_key",M=b&&!C?we(rn(Q(r.env??process.env)),"status-account.json"):null,x=b&&M&&e.includes("--json")?ln(M,b,m.getTime()):null,h=x??(b?await(r.getSelf??((p,P)=>new me(p).self(P)))(b,u.signal).catch(N):null);if(b&&h&&!x&&M)un(M,b,h,m.getTime());let W=_(),F=r.manager??new K,j=e.includes("--json")?[]:F.statuses(),U=(r.loadReceipt??We)(),z=U?await(r.automaticUpdates??(async(p)=>p.background_mode==="cli_only"?(await import("./network-auto-update-3m94436w.js")).automaticUpdatesFor(p,r.env??process.env,r.home):"background_updater"))(U).catch(()=>U.background_mode==="cli_only"?"none":"background_updater"):null,B=await(r.readConnection??(()=>eo({channel:r.channel})))().catch(()=>null),I=null;try{if(B)I=(r.readConnectionMacState??(()=>gn(r.channel??w())))()}catch{}let y=B&&I?{...B,...I}:B,G=(()=>{try{return(r.readDisconnected??(()=>Qi(ye(s()),r.channel??w())))()}catch{return!1}})(),_e=_(),ne=h?{id:h.org_id,name:h.organization_name??null,slug:h.organization_slug??null}:null,T=h?{id:h.user_id??null,name:(C?h.service_user_name:h.user_name)??null,email:h.email??null,credential:C?"api_key":"login"}:null,X=r.channel??w(),L={version:g,channel:X,api_origin:b?.apiOrigin??Ve(X),account:T,account_error:k,organization:ne,mcp:j.map((p)=>({client:p.id,label:p.label,status:le(p),installed_at:p.installed?F.installationPath(p.id):null,last_used_at:h?ue(p,h):null})),connection:y,disconnected:G,installation:U&&z?{background_mode:U.background_mode,automatic_updates:z==="background_updater"||z==="reason_network",automatic_updates_by:z,future_device_consent:U.device_consent?.decision??"disabled"}:null,timings_ms:{process:Math.round(R),credentials:q,account:W,local:_e,total:Math.round(performance.now()-R)}};if(e.includes("--json"))return a.stdout.write(`${JSON.stringify(L,null,2)}
|
|
67
67
|
`),0;if(X==="staging")a.stdout.write(`Reason ${g} \xB7 channel: STAGING
|
|
68
68
|
`),a.stdout.write(`API: ${L.api_origin}
|
|
69
69
|
`);else a.stdout.write(`Reason ${g}
|
|
@@ -79,7 +79,7 @@ This computer
|
|
|
79
79
|
`),y.version)a.stdout.write(`Version: ${y.version}${y.version===g?"":` (${g} is installed; \`reason connect\` restarts it on that)`}
|
|
80
80
|
`);if(a.stdout.write(`Folder: ${y.folder}
|
|
81
81
|
`),a.stdout.write(`Sessions: ${y.sessions_running===null?"":`${y.sessions_running} running, `}${y.sessions_max===null?"every Session you start":y.sessions_max===1?"one at a time":`up to ${y.sessions_max} at once`}
|
|
82
|
-
`),I){let p=I,P=await(r.readPermissionsSummary??(async()=>{let{permissionsSummary:Se,readMacPermissions:ve,reasonIdentity:be}=await import("./permissions-
|
|
82
|
+
`),I){let p=I,P=await(r.readPermissionsSummary??(async()=>{let{permissionsSummary:Se,readMacPermissions:ve,reasonIdentity:be}=await import("./permissions-scffy1px.js"),{macScreenStatus:ke}=await import("./local-display-mac-h5yz0ydd.js");return Se(await ve({identity:()=>be(),grants:ke,worker:async()=>p}))}))().catch(()=>null);if(P)a.stdout.write(`${P}
|
|
83
83
|
`);a.stdout.write(`Keep awake: ${I.keep_awake.enabled?"on":"off"}${I.keep_awake.holding?" (holding)":""}
|
|
84
84
|
`)}if(y.service)a.stdout.write(`Logs: ${y.service.logs}
|
|
85
85
|
`);for(let p of y.workspaces??[]){let P=p.state==="removed"?"removed from that workspace":p.blocked?"offline (this computer is outside that workspace's allowed networks)":p.device_id?Ce[p.state]:"connecting";a.stdout.write(`Also in workspace ${p.name??p.organization_id}${p.account?" (another Reason account's)":""}: ${P}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{s,
|
|
2
|
+
import{Ke,Zt,X}from"./vm-hands-entry-lite-kbnxk71q.js";import{execFileSync as l}from"child_process";import{existsSync as c,realpathSync as a}from"fs";import{userInfo as f}from"os";import{isAbsolute as u,join as t,normalize as d,parse as p}from"path";function s(){let r=d(f().homedir);if(!u(r)||r===p(r).root)throw Error("Could not resolve the canonical user home.");return r}function Uc(r){return p(r).root===r}var zc=(r)=>`Reason can't work in ${r}, the top of a drive: use a folder inside it, such as a project folder`;function Ge(r,n,e=s()){let i=X(n);if(n.kind==="managed"&&n.base){let o=a(e);return{anchor:o,boundary:t(o,n.base),path:t(o,i)}}if(n.kind==="root"&&Zt(n.path)){let o=a(e);return{anchor:o,boundary:t(o,Ke),path:t(o,i)}}return{anchor:r,boundary:r,path:t(r,i)}}function Et(r=s()){return t(r,".config")}function qc(){if(process.platform!=="darwin")return null;try{let r=l("/usr/bin/getconf",["DARWIN_USER_DIR"],{encoding:"utf8",timeout:5000}).trim();return u(r)?a(r):null}catch{return null}}function Wc(r=s()){let n=t(r,"Library","Application Support","Ara"),e=t(r,"Library","Application Support","Reason");return c(n)&&!c(e)?n:e}
|
|
3
|
+
export{s,Uc,zc,Ge,Et,qc,Wc};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as se,spawn as E}from"child_process";var
|
|
2
|
+
import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as se,spawn as E}from"child_process";var Pc="h264_ws_v1",Rc="video",Ar=["smooth","sharp","data_saver","balanced"];var Tc="video_presets";var M=8388608,D=65536,Ic="control",Dc="v1",X=200;function ls(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t,n=(i)=>typeof i==="string"&&i.length>0&&i.length<=X;if(Object.keys(e).length!==2||!n(e.user_id)||!n(e.name))return null;return{user_id:e.user_id,name:e.name}}var Oc="windows",Nc="v1",Lc="look",$c="v1",J=["reason","grok"];function us(t){return typeof t==="string"&&J.includes(t)?t:null}var _=200,Z=(t)=>typeof t==="string"&&Ar.includes(t);function Mc(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t;if(Object.keys(e).length!==2||e.format!=="h264_ws_v1"||!Z(e.preset))return null;return{format:"h264_ws_v1",preset:e.preset}}var o={hello:1,frame:2,stats:3,pong:4,serverClipboard:5,error:6,audioHello:7,audio:8,control:9,windows:10,pointer:16,key:17,config:18,ping:19,clientClipboard:20,keyframeRequest:21,ack:22,audioEnable:23,resize:24};class l extends Error{constructor(t){super(t);this.name="DisplayVideoProtocolError"}}var Q=new TextEncoder,ee=new TextDecoder("utf-8",{fatal:!0});function p(t,e){if(e.byteLength+1>M)throw new l("message_too_large");let n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,e.byteLength+1),i.setUint8(4,t),n.set(e,5),n}function w(t){let e=Q.encode(t);if(e.byteLength>D)throw new l("text_too_large");return e}function m(t,e){if(!Number.isInteger(t)||t<0||t>65535)throw new l(`invalid_${e}`);return t}function te(t){if(!Number.isFinite(t))throw new l("invalid_window");return Math.max(-2147483648,Math.min(2147483647,Math.round(t)))}function Dn(t){switch(t.type){case"hello":{let e=w(t.codec),n=new Uint8Array(6+e.byteLength),i=new DataView(n.buffer);return i.setUint16(0,m(t.width,"width")),i.setUint16(2,m(t.height,"height")),i.setUint8(4,Math.max(1,Math.min(240,Math.round(t.fps)))),i.setUint8(5,Ar.indexOf(t.preset)),n.set(e,6),p(o.hello,n)}case"frame":{let e=new Uint8Array(13+t.data.byteLength),n=new DataView(e.buffer);return n.setUint8(0,t.key?1:0),n.setUint32(1,t.seq>>>0),n.setBigUint64(5,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,13),p(o.frame,e)}case"stats":return p(o.stats,w(JSON.stringify(t.stats)));case"pong":case"ping":{let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,t.token),p(t.type==="ping"?o.ping:o.pong,e)}case"serverClipboard":return p(o.serverClipboard,w(t.text));case"clientClipboard":return p(o.clientClipboard,w(t.text));case"error":return p(o.error,w(t.code));case"pointer":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint16(0,m(t.x,"x")),n.setUint16(2,m(t.y,"y")),n.setUint8(4,t.buttons&255),p(o.pointer,e)}case"key":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint8(0,t.down?1:0),n.setUint32(1,t.keysym>>>0),p(o.key,e)}case"config":return p(o.config,Uint8Array.of(Ar.indexOf(t.preset)));case"keyframeRequest":return p(o.keyframeRequest,new Uint8Array(0));case"audioHello":{let e=w(t.codec),n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,t.sampleRate>>>0),i.setUint8(4,t.channels&255),n.set(e,5),p(o.audioHello,n)}case"audio":{let e=new Uint8Array(8+t.data.byteLength);return new DataView(e.buffer).setBigUint64(0,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,8),p(o.audio,e)}case"control":return p(o.control,w(JSON.stringify(t.control)));case"windows":{let e=t.bounds.slice(0,_),n=new Uint8Array(e.length*16),i=new DataView(n.buffer);return e.forEach((s,a)=>{[s.x,s.y,s.width,s.height].forEach((c,d)=>i.setInt32(a*16+d*4,te(c)))}),p(o.windows,n)}case"audioEnable":return p(o.audioEnable,Uint8Array.of(t.on?1:0));case"resize":{let e=new Uint8Array(4),n=new DataView(e.buffer);return n.setUint16(0,m(t.width,"width")),n.setUint16(2,m(t.height,"height")),p(o.resize,e)}case"ack":{let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t.seq>>>0),p(o.ack,e)}}}function L(t){let e=Ar[t];if(!e)throw new l("invalid_preset");return e}function y(t,e){if(t.byteLength!==e)throw new l("invalid_length")}function S(t){if(t.byteLength>D)throw new l("text_too_large");try{return ee.decode(t)}catch{throw new l("invalid_text")}}function ne(t){let e;try{e=JSON.parse(S(t))}catch{throw new l("invalid_stats")}let n=e;if(!n||typeof n!=="object"||["fps","kbps","dropped","restarts","queued_bytes"].some((s)=>typeof n[s]!=="number"||!Number.isFinite(n[s])))throw new l("invalid_stats");return{fps:n.fps,kbps:n.kbps,dropped:n.dropped,restarts:n.restarts,queued_bytes:n.queued_bytes}}function re(t){let e;try{e=JSON.parse(S(t))}catch{throw new l("invalid_control")}let n=e;if(!n||typeof n!=="object"||typeof n.you!=="boolean"||typeof n.same_user!=="boolean")throw new l("invalid_control");let i=n.holder===null?null:ls(n.holder);if(i===null&&n.holder!==null)throw new l("invalid_control");return{holder:i,you:n.you,same_user:n.same_user}}function ie(t,e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(t){case o.hello:if(e.byteLength<6)throw new l("invalid_length");return{type:"hello",width:n.getUint16(0),height:n.getUint16(2),fps:n.getUint8(4),preset:L(n.getUint8(5)),codec:S(e.subarray(6))};case o.frame:if(e.byteLength<14)throw new l("invalid_length");if(n.getUint8(0)>1)throw new l("invalid_frame_flags");return{type:"frame",key:n.getUint8(0)===1,seq:n.getUint32(1),captureMicros:Number(n.getBigUint64(5)),data:e.subarray(13)};case o.stats:return{type:"stats",stats:ne(e)};case o.ping:case o.pong:return y(e,8),{type:t===o.ping?"ping":"pong",token:n.getFloat64(0)};case o.serverClipboard:return{type:"serverClipboard",text:S(e)};case o.clientClipboard:return{type:"clientClipboard",text:S(e)};case o.error:return{type:"error",code:S(e)};case o.pointer:return y(e,5),{type:"pointer",x:n.getUint16(0),y:n.getUint16(2),buttons:n.getUint8(4)};case o.key:if(y(e,5),n.getUint8(0)>1)throw new l("invalid_key_flags");return{type:"key",down:n.getUint8(0)===1,keysym:n.getUint32(1)};case o.config:return y(e,1),{type:"config",preset:L(n.getUint8(0))};case o.keyframeRequest:return y(e,0),{type:"keyframeRequest"};case o.audioHello:if(e.byteLength<5)throw new l("invalid_length");return{type:"audioHello",sampleRate:n.getUint32(0),channels:n.getUint8(4),codec:S(e.subarray(5))};case o.audio:if(e.byteLength<9)throw new l("invalid_length");return{type:"audio",captureMicros:Number(n.getBigUint64(0)),data:e.subarray(8)};case o.audioEnable:if(y(e,1),n.getUint8(0)>1)throw new l("invalid_audio_flags");return{type:"audioEnable",on:n.getUint8(0)===1};case o.resize:return y(e,4),{type:"resize",width:n.getUint16(0),height:n.getUint16(2)};case o.control:return{type:"control",control:re(e)};case o.windows:{if(e.byteLength%16!==0||e.byteLength>_*16)throw new l("invalid_length");let i=[];for(let s=0;s<e.byteLength;s+=16)i.push({x:n.getInt32(s),y:n.getInt32(s+4),width:n.getInt32(s+8),height:n.getInt32(s+12)});return{type:"windows",bounds:i}}case o.ack:return y(e,4),{type:"ack",seq:n.getUint32(0)};default:return null}}class ds{buffer=new Uint8Array(0);push(t){let e=new Uint8Array(this.buffer.byteLength+t.byteLength);e.set(this.buffer),e.set(t,this.buffer.byteLength);let n=[],i=0;while(e.byteLength-i>=4){let s=new DataView(e.buffer,e.byteOffset+i,4).getUint32(0);if(s<1||s>M)throw new l("invalid_message_length");if(e.byteLength-i-4<s)break;let a=e[i+4],c=e.slice(i+5,i+4+s),d=ie(a,c);if(d)n.push(d);i+=4+s}return this.buffer=e.slice(i),n}}var j="/usr/bin/osascript",oe=5000,ae=1048576,ce=String.raw`
|
|
3
3
|
ObjC.import("CoreGraphics");
|
|
4
4
|
ObjC.import("ApplicationServices");
|
|
5
5
|
ObjC.import("AppKit");
|
|
@@ -29,7 +29,7 @@ function run(argv) {
|
|
|
29
29
|
const text = clipboard.stringForType($.NSPasteboardTypeString);
|
|
30
30
|
if (!text) continue;
|
|
31
31
|
const bytes = text.dataUsingEncoding($.NSUTF8StringEncoding);
|
|
32
|
-
if (Number(bytes.length) > ${
|
|
32
|
+
if (Number(bytes.length) > ${D}) continue;
|
|
33
33
|
stdout.writeData($("c " + bytes.base64EncodedStringWithOptions(0).js + "\n").dataUsingEncoding($.NSUTF8StringEncoding));
|
|
34
34
|
}
|
|
35
35
|
return;
|
|
@@ -70,7 +70,7 @@ function run(argv) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
`;function q(t){let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!=="object")return null;let n=e,i=(c)=>typeof c==="number"&&Number.isFinite(c)?Math.min(65535,Math.round(c)):0;if(typeof n.screen!=="boolean"||typeof n.accessibility!=="boolean")return null;let s=i(n.width),a=i(n.height);return s>0&&a>0?{screen:n.screen,accessibility:n.accessibility,width:s,height:a}:null}function v(t,...e){let[n,...i]=[...t,j,"-l","JavaScript","-e",ce,...e];return[n,i]}function H(t,...e){return new Promise((n)=>{se(...v(t,...e),{env:{},timeout:oe,killSignal:"SIGKILL",maxBuffer:65536,encoding:"utf8"},(i,s)=>n(i?null:q(s.split(`
|
|
73
|
-
`)[0]??"")))})}function
|
|
73
|
+
`)[0]??"")))})}function Pr(t=[]){return H(t,"probe")}function Rr(t,e){return H(t,"request",...e?[e]:[])}var N=2,ue=8,le=String.raw`
|
|
74
74
|
ObjC.import("CoreGraphics");
|
|
75
75
|
ObjC.import("Foundation");
|
|
76
76
|
ObjC.bindFunction("getppid", ["int", []]);
|
|
@@ -101,12 +101,12 @@ function run() {
|
|
|
101
101
|
$.NSThread.sleepForTimeInterval(wait);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
`;function de(t){let e;try{e=JSON.parse(t)}catch{return null}if(!Array.isArray(e))return null;let n=[];for(let i of e.slice(0,_)){if(!Array.isArray(i)||i.length!==4||!i.every((u)=>typeof u==="number"&&Number.isFinite(u)))return null;let[s,a,c,d]=i.map(Math.round);if(c>0&&d>0)n.push({x:s,y:a,width:c,height:d})}return n}function
|
|
104
|
+
`;function de(t){let e;try{e=JSON.parse(t)}catch{return null}if(!Array.isArray(e))return null;let n=[];for(let i of e.slice(0,_)){if(!Array.isArray(i)||i.length!==4||!i.every((u)=>typeof u==="number"&&Number.isFinite(u)))return null;let[s,a,c,d]=i.map(Math.round);if(c>0&&d>0)n.push({x:s,y:a,width:c,height:d})}return n}function ps(t){let e=Date.now(),n=0,i=!1,s=(u,b={})=>{try{process.stderr.write(`${JSON.stringify({event:"display.windows_helper",state:u,...b})}
|
|
105
105
|
`)}catch{}},a=(u,b={})=>{if(i)return;i=!0,s(u,{updates:n,duration_ms:Date.now()-e,...b})},c=E(j,["-l","JavaScript","-e",le],{env:{},stdio:["ignore","pipe","ignore"]});s("started");let d="";return c.stdout.on("data",(u)=>{if(i)return;d+=u.toString("utf8");for(let b=d.indexOf(`
|
|
106
106
|
`);b>=0;b=d.indexOf(`
|
|
107
|
-
`)){let x=de(d.slice(0,b));if(d=d.slice(b+1),x)n++,t(x)}if(d.length>65536)d=""}),c.once("error",(u)=>a("failed",{code:u.code??"spawn_failed"})),c.once("exit",(u,b)=>a("failed",{code:"exited",exit_code:u,signal:b})),{close(){a("stopped"),c.kill("SIGKILL")}}}var T=5,R=[{bit:1,button:0,down:1,up:2,drag:6},{bit:4,button:1,down:3,up:4,drag:7},{bit:2,button:2,down:25,up:26,drag:27}],fe=[[8,1,0],[16,-1,0],[32,0,1],[64,0,-1]],P=50,pe=500,V=4,I=131072,W=262144,
|
|
107
|
+
`)){let x=de(d.slice(0,b));if(d=d.slice(b+1),x)n++,t(x)}if(d.length>65536)d=""}),c.once("error",(u)=>a("failed",{code:u.code??"spawn_failed"})),c.once("exit",(u,b)=>a("failed",{code:"exited",exit_code:u,signal:b})),{close(){a("stopped"),c.kill("SIGKILL")}}}var T=5,R=[{bit:1,button:0,down:1,up:2,drag:6},{bit:4,button:1,down:3,up:4,drag:7},{bit:2,button:2,down:25,up:26,drag:27}],fe=[[8,1,0],[16,-1,0],[32,0,1],[64,0,-1]],P=50,pe=500,V=4,I=131072,W=262144,O=524288,F=1048576,B=new Map([[65505,[56,I]],[65506,[60,I]],[65507,[59,W]],[65508,[62,W]],[65511,[58,O]],[65512,[61,O]],[65513,[58,O]],[65514,[61,O]],[65027,[61,O]],[65515,[55,F]],[65516,[54,F]]]),be=new Map([[65288,51],[65289,48],[65056,48],[65293,36],[65307,53],[65535,117],[65509,57],[65360,115],[65361,123],[65362,126],[65363,124],[65364,125],[65365,116],[65366,121],[65367,119],[65379,114],[65386,114],[65291,71],[65408,49],[65421,76],[65429,115],[65430,123],[65431,126],[65432,124],[65433,125],[65434,116],[65435,121],[65436,119],[65437,71],[65438,114],[65439,117],[65450,67],[65451,69],[65452,65],[65453,78],[65454,65],[65455,75],[65469,81],...[82,83,84,85,86,87,88,89,91,92].map((t,e)=>[65456+e,t]),...[122,120,99,118,96,97,98,100,101,109,103,111,105,107,113,106,64,79,80,90].map((t,e)=>[65470+e,t])]),G="asdfhgzxcv\x00bqweryt123465=97-80]ou[ip\x00lj'k;\\,/nm.\x00 `",Y='~!@#$%^&*()_+{}|:"<>?',he="`1234567890-=[]\\;',./",k=new Map;for(let t=0;t<G.length;t++){let e=G[t];if(e==="\x00")continue;if(k.set(e.charCodeAt(0),[t,!1]),e>="a"&&e<="z")k.set(e.toUpperCase().charCodeAt(0),[t,!0])}for(let t=0;t<Y.length;t++)k.set(Y.charCodeAt(t),[k.get(he.charCodeAt(t))[0],!0]);class K{now;x=-1;y=-1;mask=0;clicks=0;lastDown=null;held=new Set;constructor(t=()=>performance.now()){this.now=t}flags(){let t=0;for(let e of this.held)t|=B.get(e)[1];return t}mouse(t,e){return`m ${t} ${this.x} ${this.y} ${e} ${t===T?0:this.clicks} ${this.flags()}`}pointer(t,e,n){let i=[];if(t!==this.x||e!==this.y){this.x=t,this.y=e;let s=R.find((a)=>this.mask&a.bit);i.push(s?this.mouse(s.drag,s.button):this.mouse(T,0))}for(let s of R){let a=(this.mask&s.bit)!==0,c=(n&s.bit)!==0;if(!a&&c){let d=this.now(),u=this.lastDown;this.clicks=u&&u.button===s.button&&d-u.at<=pe&&Math.abs(t-u.x)<=V&&Math.abs(e-u.y)<=V?this.clicks+1:1,this.lastDown={button:s.button,at:d,x:t,y:e},i.push(this.mouse(s.down,s.button))}else if(a&&!c)i.push(this.mouse(s.up,s.button))}for(let[s,a,c]of fe)if(!(this.mask&s)&&n&s)i.push(`w ${a*P} ${c*P} ${this.flags()}`);return this.mask=n,i}key(t,e){let n=t?1:0,i=B.get(e);if(i){if(t)this.held.add(e);else this.held.delete(e);return[`k ${i[0]} ${n} ${this.flags()}`]}let s=be.get(e);if(s!==void 0)return[`k ${s} ${n} ${this.flags()}`];let a=e<256?e:(e&4278190080)===16777216?e&16777215:0,c=k.get(a);if(c)return[`k ${c[0]} ${n} ${this.flags()|(c[1]?I:0)}`];if(a<160||a>65535||a>=55296&&a<57344)return[];return[`u ${n} ${a} ${this.flags()}`]}}function hs(t,e=[]){let n=E(...v(e),{env:{},stdio:["pipe","pipe","ignore"]}),i=new K,s="",a=!1,c=null,d=()=>{n.kill("SIGKILL"),c?.kill("SIGKILL")},u=(f)=>{if(a)return;a=!0,d(),t.end(f)},b=(f)=>u({error:new r("display_unavailable",f)}),x=(f)=>{if(a||f.length===0)return;if(n.stdin.write(f.map((g)=>`${g}
|
|
108
108
|
`).join("")),n.stdin.writableLength>ae)u({reason:"input_backpressure"})},z=()=>{c=E(...v(e,"clipboard"),{env:{},stdio:["ignore","pipe","ignore"]});let f="";c.stdout?.on("data",(g)=>{if(a)return;f+=g.toString("ascii");for(let h=f.indexOf(`
|
|
109
109
|
`);h>=0;h=f.indexOf(`
|
|
110
|
-
`)){let U=f.slice(0,h);if(f=f.slice(h+1),!U.startsWith("c "))continue;let A=U.slice(2);if(A.length>Math.ceil(
|
|
110
|
+
`)){let U=f.slice(0,h);if(f=f.slice(h+1),!U.startsWith("c "))continue;let A=U.slice(2);if(A.length>Math.ceil(D/3)*4||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(A)){u({reason:"display_protocol"});return}let C=Buffer.from(A,"base64");if(C.byteLength<=D)t.clipboard(C.toString("utf8"));if(a)return}if(f.length>Math.ceil(D/3)*4+2)u({reason:"display_protocol"})}),c.once("error",()=>b("Reason could not watch this Mac's desktop clipboard.")),c.once("exit",()=>{if(!a)b("Reason could not watch this Mac's desktop clipboard.")})};return n.stdout.on("data",(f)=>{if(a||s===null)return;s+=f.toString("utf8");let g=s.indexOf(`
|
|
111
111
|
`);if(g<0){if(s.length>4096)u({reason:"display_protocol"});return}let h=q(s.slice(0,g));if(s=null,!h)u({reason:"display_protocol"});else if(!h.screen||!h.accessibility)b(e.length>0?"Reason's background worker needs Screen Recording and Accessibility on this Mac (its own Reason entry in System Settings > Privacy & Security, not the Reason app's): run `reason permissions allow` on this Mac.":"Allow Screen Recording and Accessibility for this Mac's Reason worker, then restart it.");else z(),t.ready({width:h.width,height:h.height})}),n.stdin.on("error",()=>{return}),n.once("error",()=>b("Reason could not start this Mac's desktop input.")),n.once("exit",()=>{if(s!==null)b("Reason could not start this Mac's desktop input.");else u({reason:"display_closed"})}),{pointer:(f,g,h)=>x(i.pointer(f,g,h)),key:(f,g)=>x(i.key(f,g)),clipboard:(f)=>x([`c ${Buffer.from(f,"utf8").toString("base64")}`]),close(){a=!0,d()}}}
|
|
112
|
-
export{
|
|
112
|
+
export{Pc,Rc,Ar,Tc,D,Ic,Dc,ls,Oc,Nc,Lc,$c,us,Mc,Dn,ds,Pr,Rr,ps,hs};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{createHash as M,createPublicKey as y,verify as _}from"crypto";var
|
|
3
|
-
export{
|
|
2
|
+
import{createHash as M,createPublicKey as y,verify as _}from"crypto";var Ti="libara_device_keychain.dylib",Ii="libreason_device_keychain.dylib";var g=2,b=536870912,bn=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 mc="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 Di(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 gc(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 vn(t){return M("sha256").update(t).digest("hex")}function Gt(t,n){if(t.byteLength!==n.size_bytes)throw new l("artifact_size_mismatch","Runtime artifact size did not match its manifest.");if(vn(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 Sn(t){let n=R(t,Ii);return S(n)?n:R(t,Ti)}
|
|
3
|
+
export{Ti,Ii,bn,yr,l,mc,Di,gc,vn,Gt,Sn};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{D,Dn,ds,Pr,ps,hs}from"./vm-hands-entry-lite-13nx02p7.js";import{wc,bc,A,Zo}from"./vm-hands-entry-lite-6vnjgy77.js";import{Ue}from"./vm-hands-entry-lite-chq0qx9f.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as xt,spawn as _e}from"child_process";import{existsSync as vt}from"fs";import{connect as Et}from"net";function dt(){let e=new Set,t=null,s=(n)=>({holder:t?.viewer??null,you:t===n,same_user:Boolean(t?.viewer&&n.viewer&&t.viewer.user_id===n.viewer.user_id)}),i=()=>{for(let n of e)n.notify(s(n))};return{join(n){return e.add(n),n.notify(s(n)),()=>{if(!e.delete(n))return;if(t!==n)return;t=null,i()}},claim(n){if(t===n||!e.has(n))return;t=n,i()}}}var Ce=dt();import{spawn as pt}from"child_process";import{existsSync as ft}from"fs";import{connect as mt}from"net";import{join as j}from"path";var ze="reason_desktop",N={sampleRate:48000,channels:2,codec:"opus"},ht=5000,yt=107,gt=262144,Vo=(e)=>j(e,"native"),Kt=(e)=>`unix:${e}`;function he(e,t=1000){if(!ft(e))return Promise.resolve(!1);return new Promise((s)=>{let i=mt({path:e}),n=(l)=>{i.destroy(),s(l)};i.setTimeout(t,()=>n(!1)),i.once("error",()=>n(!1)),i.once("close",()=>n(!1)),i.once("connect",()=>n(!0))})}async function _c(e,t){if(!t)return null;let s=Vo(e);if(Buffer.byteLength(s)>yt||/["'\\\s]/.test(s))return null;try{if(await he(s))return s;let i=pt(t,["--daemonize=no","--system=no","--use-pid-file=no","--exit-idle-time=-1","--disallow-exit=yes","--realtime=no","--high-priority=no","--disallow-module-loading=yes","--log-level=warning",`--log-target=file:${j(e,"pulseaudio.log")}`,"-n",`--load=module-native-protocol-unix socket="${s}" auth-anonymous=1 auth-cookie-enabled=0`,`--load=module-null-sink sink_name=${ze} rate=${N.sampleRate} channels=${N.channels} sink_properties=device.description=Reason_desktop`],{detached:!0,stdio:"ignore",env:{HOME:e,PATH:"/usr/bin:/bin",XDG_RUNTIME_DIR:e,PULSE_RUNTIME_PATH:j(e,"runtime"),PULSE_STATE_PATH:j(e,"state")}});Ue(i.pid);let n=!1;i.once("error",()=>{n=!0}),i.once("exit",()=>{n=!0}),i.unref();let l=Date.now()+ht;while(Date.now()<l){if(await he(s))return s;if(n)return await he(s)?s:null;await new Promise((c)=>setTimeout(c,50))}if(!n)i.kill("SIGKILL");return null}catch{return null}}function Oe(){let{sampleRate:e,channels:t}=N;return["-hide_banner","-loglevel","error","-nostdin","-fflags","nobuffer","-f","pulse","-sample_rate",String(e),"-channels",String(t),"-fragment_size",String(e*t*2/50),"-i",`${ze}.monitor`,"-vn","-ac",String(t),"-ar",String(e),"-c:a","libopus","-b:a","64k","-application","lowdelay","-frame_duration","20","-flush_packets","1","-page_duration","20000","-f","ogg","pipe:1"]}var bt=[79,103,103,83],wt=Buffer.from("OpusHead"),_t=Buffer.from("OpusTags"),Be=(e,t)=>e.byteLength>=t.byteLength&&t.every((s,i)=>e[i]===s);class ye extends Error{constructor(e){super(e);this.name="OggProtocolError"}}class ge{buffer=new Uint8Array(0);partial=[];partialBytes=0;push(e){let t=new Uint8Array(this.buffer.byteLength+e.byteLength);t.set(this.buffer),t.set(e,this.buffer.byteLength);let s=[],i=0;while(t.byteLength-i>=27){if(bt.some((b,f)=>t[i+f]!==b)||t[i+4]!==0)throw new ye("invalid_page");let n=(t[i+5]&1)!==0,l=t[i+26];if(t.byteLength-i<27+l)break;let c=t.subarray(i+27,i+27+l),h=c.reduce((b,f)=>b+f,0),g=27+l+h;if(t.byteLength-i<g)break;if(!n&&this.partialBytes>0)this.resetPartial();let m=n&&this.partialBytes===0,p=i+27+l,w=p;for(let b of c){if(p+=b,b===255)continue;if(this.appendPartial(t.subarray(w,p),m),w=p,!m){let f=this.takePartial();if(f.byteLength>0&&!Be(f,wt)&&!Be(f,_t))s.push(f)}m=!1,this.resetPartial()}if(w<p)this.appendPartial(t.subarray(w,p),m);i+=g}return this.buffer=t.slice(i),s}appendPartial(e,t){if(t||e.byteLength===0)return;if(this.partialBytes+=e.byteLength,this.partialBytes>gt)throw new ye("packet_too_large");this.partial.push(e.slice())}takePartial(){if(this.partial.length===1)return this.partial[0];let e=new Uint8Array(this.partialBytes),t=0;for(let s of this.partial)e.set(s,t),t+=s.byteLength;return e}resetPartial(){this.partial=[],this.partialBytes=0}}import{spawn as kt}from"child_process";var Ve=1048576,St=String.raw`
|
|
3
|
+
import gi, json, os, sys
|
|
4
|
+
gi.require_version("Gtk", "3.0")
|
|
5
|
+
from gi.repository import Gtk, Gdk, GLib
|
|
6
|
+
if not Gtk.init_check()[0]:
|
|
7
|
+
sys.exit(1)
|
|
8
|
+
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
|
|
9
|
+
pending = b""
|
|
10
|
+
generation = 0
|
|
11
|
+
def send(value):
|
|
12
|
+
print(json.dumps(value, ensure_ascii=True), flush=True)
|
|
13
|
+
def changed(clipboard, event):
|
|
14
|
+
global generation
|
|
15
|
+
generation += 1
|
|
16
|
+
current = generation
|
|
17
|
+
def received(clipboard, text, unused):
|
|
18
|
+
if current == generation and text is not None and len(text.encode("utf-8")) <= ${D}:
|
|
19
|
+
send({"text": text})
|
|
20
|
+
clipboard.request_text(received, None)
|
|
21
|
+
# No request_text on startup: never share the pre-existing clipboard.
|
|
22
|
+
clipboard.connect("owner-change", changed)
|
|
23
|
+
def input_ready(fd, condition):
|
|
24
|
+
global pending
|
|
25
|
+
chunk = os.read(fd, 65536)
|
|
26
|
+
if not chunk:
|
|
27
|
+
Gtk.main_quit()
|
|
28
|
+
return False
|
|
29
|
+
pending += chunk
|
|
30
|
+
while b"\n" in pending:
|
|
31
|
+
line, pending = pending.split(b"\n", 1)
|
|
32
|
+
text = json.loads(line)
|
|
33
|
+
if not isinstance(text, str) or len(text.encode("utf-8")) > ${D} or "\x00" in text:
|
|
34
|
+
sys.exit(1)
|
|
35
|
+
clipboard.set_text(text, -1)
|
|
36
|
+
send("ack")
|
|
37
|
+
if len(pending) > ${D*6+2}:
|
|
38
|
+
sys.exit(1)
|
|
39
|
+
return True
|
|
40
|
+
GLib.io_add_watch(0, GLib.IO_IN | GLib.IO_HUP, input_ready)
|
|
41
|
+
send("ready")
|
|
42
|
+
Gtk.main()
|
|
43
|
+
`;function Ne(e,t){let s=kt("/usr/bin/python3",["-I","-u","-c",St],{env:{DISPLAY:e.display,XAUTHORITY:e.xauthority},stdio:["pipe","pipe","ignore"]}),i=!1,n=!0,l="",c=0,h=[],g=setTimeout(()=>p(),5000),m=()=>{i=!0,clearTimeout(g),h.length=0,s.kill("SIGKILL")},p=()=>{if(i)return;m(),t.end({error:new r("display_unavailable","Reason could not start this Linux desktop's UTF-8 clipboard.")})},w=(b,f=32)=>{if(i)return;if(!n){b();return}if(c+=f,c>Ve)m(),t.end({reason:"input_backpressure"});else h.push({apply:b,bytes:f})};return s.stdout.on("data",(b)=>{if(i)return;l+=b.toString("ascii");for(let f=l.indexOf(`
|
|
44
|
+
`);f>=0;f=l.indexOf(`
|
|
45
|
+
`)){let T=l.slice(0,f);l=l.slice(f+1);let x;try{x=JSON.parse(T)}catch{p();return}if(x==="ready"||x==="ack"){clearTimeout(g),n=!1;while(!n&&!i&&h.length){let d=h.shift();c-=d.bytes,d.apply()}}else if(x&&typeof x==="object"&&"text"in x&&typeof x.text==="string"&&Buffer.byteLength(x.text)<=D)t.clipboard(x.text);else{p();return}if(i)return}if(l.length>D*6+32)p()}),s.stdin.on("error",p),s.once("error",p),s.once("exit",p),{apply:w,write(b){if(Buffer.byteLength(b)>D||b.includes("\x00")){p();return}let f=`${JSON.stringify(b)}
|
|
46
|
+
`;w(()=>{if(n=!0,g=setTimeout(()=>p(),5000),s.stdin.write(f),s.stdin.writableLength>Ve)m(),t.end({reason:"input_backpressure"})},Buffer.byteLength(f))},close:m}}var z={smooth:{fps:60,crf:23,kbps:8000,x264Preset:"ultrafast",threads:2,scale:1},sharp:{fps:30,crf:19,kbps:1e4,x264Preset:"superfast",scale:1},data_saver:{fps:20,crf:28,kbps:2000,x264Preset:"ultrafast",scale:0.75},balanced:{fps:30,crf:23,kbps:4000,x264Preset:"ultrafast",threads:2,scale:1}},Dt="avc1.4D002A",Ge={width:1920,height:1080},Mt=262144,Pt=0.2,It=250,Lt=1e4,At=1024,be=1e4,Rt=500,Tt=60,Ct=1e4,Bt=1000,Fe=1048576,Ut=-223,zt=-308,Go={kind:"mac_screen",sound:null},Ko={kind:"windows_screen",sound:null},Ot,He=()=>Ot??=A()?.ffmpeg??null,Z=(e,t,s)=>_e(e,t,{env:s,stdio:["ignore","pipe","ignore"],windowsHide:!0}),Vt,ke=()=>Vt??=Zo(A()),$e=(e,t,s)=>{let[i,...n]=[...ke(),e];return Z(i,[...n,...t],s)},Ke=()=>nt?.videotoolbox?"h264_videotoolbox":"libx264",Nt=()=>Math.round(performance.now()*1000),we=new Set,qe=!1;function Je(e){if(we.add(e),e.once("exit",()=>we.delete(e)),qe)return;qe=!0,process.once("exit",()=>{for(let t of we)try{t.kill("SIGKILL")}catch{}})}function Ze(e){try{e.stdout?.destroy()}catch{}if(e.exitCode!==null||e.signalCode!==null)return;try{e.kill("SIGTERM")}catch{return}let t=setTimeout(()=>{if(e.exitCode===null&&e.signalCode===null)try{e.kill("SIGKILL")}catch{}},Rt);e.once("exit",()=>clearTimeout(t))}function Gt(e,t,s){return{args:["-f","x11grab","-draw_mouse","1","-framerate",String(e),"-video_size",`${t.width}x${t.height}`,"-i",s],size:t}}function Ft(e){return{args:["-f","avfoundation","-capture_cursor","1","-pixel_format","nv12","-framerate",String(e),"-i","Capture screen 0:none"],size:null}}function Ht(e,t){return{args:["-f","gdigrab","-draw_mouse","1","-framerate",String(e),"-offset_x","0","-offset_y","0","-video_size",`${t.width}x${t.height}`,"-i","desktop"],size:t}}function $t(e){return{args:["-probesize","32","-analyzeduration","0","-f","image2pipe","-c:v","mjpeg","-framerate",String(e),"-i","pipe:0"],size:null}}var Qe=1700000;function et(e){return Math.min(1,Math.round(Math.sqrt(Qe/(e.width*e.height))*100)/100)}function qt(e,t,s){let i=_e(s.axe,["stream-video","--udid",s.udid,"--format","ffmpeg","--fps","30","--quality","85","--scale",String(Math.min(0.99,et(s.size)))],{stdio:["ignore","pipe","ignore"]}),n=_e(e,t,{env:{},stdio:["pipe","pipe","ignore"]});i.stdout.pipe(n.stdin),n.stdin.on("error",()=>{});let l=()=>{if(i.exitCode===null&&i.signalCode===null)i.kill("SIGTERM")};return n.once("exit",l),n.once("error",l),i.once("exit",()=>{if(n.exitCode===null&&n.signalCode===null)n.kill("SIGTERM")}),i.once("error",()=>{if(n.exitCode===null&&n.signalCode===null)n.kill("SIGTERM")}),n}function We(e){let t=Math.min(1,Ge.width/e.width,Ge.height/e.height);return{width:Math.round(e.width*t),height:Math.round(e.height*t)}}function J(e,t,s,i="libx264"){let n=z[e],l=(w)=>Math.max(2,Math.floor(w/2)*2),c={width:l(s.width*n.scale),height:l(s.height*n.scale)},h=c.width!==t.size?.width||c.height!==t.size.height,g=Math.max(1,Math.round(n.kbps*2/n.fps)),m=["-g",String(n.fps*Tt)],p=i==="h264_videotoolbox"?["-c:v","h264_videotoolbox","-realtime","1","-prio_speed","1","-allow_sw","1","-profile:v","main","-level","4.2","-bf","0","-pix_fmt","nv12",...m,"-b:v",`${n.kbps}k`,"-maxrate",`${n.kbps}k`,"-bufsize",`${g}k`,"-bsf:v","h264_metadata=aud=insert"]:["-c:v","libx264","-preset",n.x264Preset,"-tune","zerolatency","-profile:v","main","-level","4.2","-bf","0","-pix_fmt","yuv420p",...n.threads?["-threads",String(n.threads)]:[],"-x264-params","aud=1:repeat-headers=1",...m,"-crf",String(n.crf),"-maxrate",`${n.kbps}k`,"-bufsize",`${g}k`];return["-hide_banner","-loglevel","error","-nostdin","-fflags","nobuffer",...t.args,"-an",...h?["-vf",`scale=${c.width}:${c.height}:flags=fast_bilinear`]:[],...p,"-flush_packets","1","-f","h264","pipe:1"]}class tt{buffer=new Uint8Array(0);scanned=0;key=!1;micros=0;push(e,t){if(this.buffer.byteLength===0)this.micros=t;let s=new Uint8Array(this.buffer.byteLength+e.byteLength);s.set(this.buffer),s.set(e,this.buffer.byteLength),this.buffer=s;let i=[],n=this.scanned;while(n+3<this.buffer.byteLength){if(this.buffer[n]!==0||this.buffer[n+1]!==0||this.buffer[n+2]!==1){n++;continue}let l=this.buffer[n+3]&31,c=n>0&&this.buffer[n-1]===0?n-1:n;if(l===9&&c>0)i.push({data:this.buffer.slice(0,c),key:this.key,micros:this.micros}),this.buffer=this.buffer.subarray(c),this.key=!1,this.micros=t,n-=c;if(l===5)this.key=!0;n+=3}return this.scanned=n,i}}function Wt(e,t){let s=Et({path:e}),i=Buffer.alloc(0),n="version",l=0,c=!1,h=[],g=0,m=!1,p=(d)=>{if(m)return;m=!0,s.destroy(),t.end(d)},w=()=>p({reason:"display_protocol"}),b=(d)=>{if(m)return;if(!c){if(g+=d.byteLength,g>Fe)p({reason:"input_backpressure"});else h.push(d);return}if(s.write(d),s.writableLength>Fe)p({reason:"input_backpressure"})},f=(d)=>{i=i.subarray(d)},T=()=>{switch(n){case"version":{if(i.byteLength<12)return!1;let d=/^RFB (\d{3})\.(\d{3})\n$/.exec(i.subarray(0,12).toString("latin1"));if(!d||Number(d[1])*1000+Number(d[2])<3007)return w(),!1;return f(12),s.write(`RFB 003.007
|
|
47
|
+
`),n="security",!0}case"security":{if(i.byteLength<1)return!1;let d=i[0];if(d===0)return w(),!1;if(i.byteLength<1+d)return!1;if(!i.subarray(1,1+d).includes(1))return w(),!1;return f(1+d),s.write(Buffer.from([1,1])),n="init",!0}case"init":{if(i.byteLength<24)return!1;let d=i.readUInt32BE(20);if(d>65536)return w(),!1;if(i.byteLength<24+d)return!1;let S={width:i.readUInt16BE(0),height:i.readUInt16BE(2)};if(f(24+d),S.width===0||S.height===0)return w(),!1;n="messages";let _=Buffer.alloc(12);_.writeUInt8(2,0),_.writeUInt16BE(2,2),_.writeInt32BE(zt,4),_.writeInt32BE(Ut,8),s.write(_),c=!0;for(let v of h)s.write(v);return h=[],g=0,t.ready(S),!m}case"skip":{let d=Math.min(l,i.byteLength);if(f(d),l-=d,l>0)return!1;return n="messages",!0}case"messages":{if(i.byteLength<1)return!1;switch(i[0]){case 1:{if(i.byteLength<6)return!1;let d=6+i.readUInt16BE(4)*6;if(i.byteLength<d)return!1;return f(d),!0}case 2:return f(1),!0;case 3:{if(i.byteLength<8)return!1;let d=i.readUInt32BE(4);if(d>D/2)return f(8),n="skip",l=d,!0;if(i.byteLength<8+d)return!1;let S=i.subarray(8,8+d).toString("latin1");return f(8+d),t.clipboard(S),!m}default:return w(),!1}}}},x=!1;return s.once("connect",()=>{x=!0}),s.on("data",(d)=>{if(m)return;i=i.byteLength?Buffer.concat([i,d]):d;while(!m&&T());}),s.once("error",()=>{if(!x)p({error:new r("display_unavailable","Reason could not reach this machine's desktop server.")})}),s.once("close",()=>p({reason:"display_closed"})),{pointer(d,S,_){let v=Buffer.alloc(6);v.writeUInt8(5,0),v.writeUInt8(_&255,1),v.writeUInt16BE(d,2),v.writeUInt16BE(S,4),b(v)},key(d,S){let _=Buffer.alloc(8);_.writeUInt8(4,0),_.writeUInt8(d?1:0,1),_.writeUInt32BE(S>>>0,4),b(_)},clipboard(d){if(Array.from(d).some((v)=>v.codePointAt(0)>255)){p({reason:"clipboard_unicode_unsupported"});return}let S=Buffer.from(d,"latin1"),_=Buffer.alloc(8);_.writeUInt8(6,0),_.writeUInt32BE(S.byteLength,4),b(Buffer.concat([_,S]))},close(){m=!0,s.destroy()}}}class Se{run=null;viewers=new Set;get running(){return this.run!==null}start(e,t,s,i){this.viewers.add(e),this.stop();let n;try{n=s()}catch{this.fail();return}Je(n);let l={child:n,splitter:new tt};this.run=l;for(let h of[...this.viewers])h.started(t);n.stdout?.on("data",(h)=>{if(this.run!==l)return;for(let g of l.splitter.push(h,i()))for(let m of[...this.viewers])m.unit(g)});let c=()=>{if(this.run!==l)return;this.run=null,this.fail()};n.once("exit",c),n.once("error",c)}leave(e){if(!this.viewers.delete(e))return;if(this.viewers.size===0)this.stop()}stop(){if(!this.run)return;Ze(this.run.child),this.run=null}fail(){for(let e of[...this.viewers])e.failed()}}var Xe=new WeakMap;function Xt(e){let t=Xe.get(e);if(!t)Xe.set(e,t=new Se);return t}var G=new Map;function Jo(e,t,s={}){let i=s.micros??Nt,n=new ds,l=t.request.preset,c=null,h=null,g=null,m=!1,p=null,w=!1,b=!1,f=null,T=0,x=0,d=!1,S=null,_=null,v=0,Q=null,I=[],F=0,L=[],xe=new Uint32Array(be+1),ee=0,te=null,ne=0,O=0,re=0,ve=0,Ee=0,H=null,ie=0,C={frames:0,bytes:0,since:i()},B=[],V=0,se,oe=!1,it=i(),M={},U=()=>Math.round((i()-it)/1000),De=s.control??Ce,ae=null,le=null,Me=0,ue=!1,Pe={pause(){if(!p?.running)return;p.stop(),ue=!0},adopt(o){let a=o!==null&&(o.width!==h?.width||o.height!==h?.height);if(a)h=o;if(!a&&!ue)return;if(ue=!1,p)Y();else pe()}},st=(o)=>{if(!s.resizeDesktop||!c||"kind"in c||e.done)return;let a=c.display,u=()=>[...G.get(a)??[]];Me++,s.resizeDesktop(c,o,()=>{for(let y of u())y.pause()}).then((y)=>{for(let k of u())k.adopt(y)})},P=(o)=>{let a=Dn(o);return e.send(a),ve+=a.byteLength,a.byteLength},K=(o)=>{if(e.done)return;if(e.open)P({type:"error",code:o});e.end({reason:o})},q=()=>Math.max(Mt,z[l].kbps*1000/8*Pt),W=()=>i()/1000,ot=()=>{while(L.length>1&&L[0].atMs<W()-Lt)L.shift();return L[0]?.rttMs??null},Ie=(o)=>{let a=ot();if(a===null||I.length===0)return!1;let u=(a+It)*o;return W()-I[0].sentMs>u||F>u/1000*z[l].kbps*1000/8},at=(o)=>{if(v===0)return;let a=Math.min(o,v-1);if(Q!==null&&a<=Q)return;Q=a;let u=W();while(I.length&&I[0].seq<=a){let y=I.shift();if(F-=y.bytes,y.seq!==a)continue;let k=Math.max(0,u-y.sentMs);while(L.length&&L.at(-1).rttMs>=k)L.pop();L.push({atMs:u,rttMs:k}),xe[Math.min(be,Math.round(k))]++,ee++,te=Math.min(te??k,k)}},lt=()=>{let o=0;for(let a=0;a<=be;a++)if(o+=xe[a],o*2>=ee)return a;return 0},ut=()=>e.bufferedAmount<=q()/2&&!Ie(0.5),Le=()=>{oe=!0,B=[],V=0,p?.leave(ce),p=null},Ae=(o)=>{if(e.done)return;if(o.key)M.first_key_ms??=U();if(!m){if(!p||B.length===0&&!o.key)return;if(B.push(o),V+=o.data.byteLength,V>q())Le();return}if(d){O++;return}if(e.bufferedAmount>q()||Ie(1)){d=!0,O++,S=setInterval(()=>{if(e.done||!ut())return;if(S)clearInterval(S);S=null,d=!1,Y()},s.drainPollMs??25);return}if(!w){if(!o.key){O++;return}if(P({type:"hello",width:h.width,height:h.height,fps:z[l].fps,preset:l,codec:Dt}),w=!0,M.first_frame_ms??=U(),!b&&c?.sound)P({type:"audioHello",...N}),b=!0}let a=P({type:"frame",key:o.key,seq:v,captureMicros:o.micros,data:o.data});if(I.push({seq:v,sentMs:W(),bytes:a}),F+=a,I.length>At)F-=I.shift().bytes;v++,ne++,H??=o.micros,ie=o.micros,C.frames++,C.bytes+=a},ce={started(o){l=o,w=!1,B=[],V=0},unit:Ae,failed:()=>K("encoder_failed")},de=()=>{let o=(s.ffmpeg??He)();if(!c||!h){K("encoder_failed");return}let[a,u]=[c,h],y="kind"in a&&a.kind==="simulator"?a.stream:null;if(!o&&!y){K("encoder_failed");return}if(p??="kind"in a&&a.kind==="mac_screen"?Xt(s.spawn??$e):new Se,M.encoder_ms===void 0)M.encoder_ms=U(),M.encoder_shared=p.running;p.start(ce,l,()=>{let k=z[l].fps;if(y)return y(k,z[l].kbps,Qe);if("kind"in a&&a.kind==="simulator"){let E=Math.min(0.99,et(a.size)),R={width:a.size.width*E,height:a.size.height*E};return qt(o,J(l,$t(Math.min(k,30)),R,(s.macEncoder??Ke)()),a)}if("kind"in a&&a.kind==="windows_screen")return(s.spawn??Z)(o,J(l,Ht(k,u),We(u)),{SystemRoot:process.env.SystemRoot??"C:\\Windows"});return"kind"in a?(s.spawn??$e)(o,J(l,Ft(k),We(u),(s.macEncoder??Ke)()),{}):(s.spawn??Z)(o,J(l,Gt(k,u,a.display),u),{DISPLAY:a.display,XAUTHORITY:a.xauthority})},i)},X=()=>{if(!f)return;Ze(f.child),f=null},ct=()=>{let o=(s.ffmpeg??He)();if(f||e.done||!b||!c?.sound||!o)return;let a;try{a=(s.spawn??Z)(o,Oe(),{PULSE_SERVER:Kt(c.sound)})}catch{return}Je(a);let u={child:a,reader:new ge};f=u,a.stdout?.on("data",(k)=>{if(f!==u||e.done)return;let E;try{E=u.reader.push(k)}catch{X();return}let R=i();for(let me of E){if(e.bufferedAmount>q()){x++;continue}P({type:"audio",captureMicros:R,data:me}),T++}});let y=()=>{if(f===u)X()};a.once("exit",y),a.once("error",y)},Y=()=>{if(!p||e.done)return;re++,de()},pe=()=>{if(e.done||!h)return;if(!m){if(p||oe)return;de(),se=setTimeout(()=>{if(!m)Le()},Ct);return}if(clearTimeout(se),M.encoder_early===void 0){if(M.encoder_early=p!==null,oe)M.hold_lapsed=!0}if(!p)de();let o=B;B=[],V=0;for(let a of o)Ae(a);_??=setInterval(()=>{let a=i(),u=Math.max(0.001,(a-C.since)/1e6);P({type:"stats",stats:{fps:Math.round(C.frames/u*10)/10,kbps:Math.round(C.bytes*8/1000/u),dropped:O,restarts:re,queued_bytes:e.bufferedAmount}}),C={frames:0,bytes:0,since:a}},Bt)};t.desktop.then((o)=>{if(e.done)return;c=o;let a={ready(u){h=u,M.desktop_ms??=U(),pe()},clipboard(u){if(e.open&&Buffer.byteLength(u)<=D)P({type:"serverClipboard",text:u})},end(u){if("reason"in u&&e.open)P({type:"error",code:u.reason});e.end(u)}};if("kind"in o&&o.kind==="simulator")g=o.input,a.ready(o.points);else if("kind"in o&&o.kind==="windows_screen")g=(s.windowsInput??bc)(a);else if("kind"in o)g=(s.macInput??((u)=>hs(u,ke())))(a);else{let u=G.get(o.display);if(!u)G.set(o.display,u=new Set);u.add(Pe);let y=(s.linuxClipboard??Ne)(o,a),k=Wt(o.rfbSocket,{...a,clipboard:(E)=>{if(!y)a.clipboard(E)}});g=y?{pointer:(E,R,me)=>y.apply(()=>k.pointer(E,R,me)),key:(E,R)=>y.apply(()=>k.key(E,R)),clipboard:(E)=>y.write(E),close(){y.close(),k.close()}}:k}Re()},(o)=>e.end({error:o}));function Re(){if(le||!t.viewerSameNetwork||!m||e.done||!c||!("kind"in c)||c.kind!=="mac_screen")return;le=(s.macWindows??ps)((o)=>{if(e.open)P({type:"windows",bounds:o})})}let Te={viewer:t.viewer??null,notify(o){if(e.open)P({type:"control",control:o})}},fe=(o)=>{if(!g)return;if(!c||!("kind"in c)||c.kind!=="simulator")De.claim(Te);o(g)};return{opened(){M.relay_ms??=U()},received(o){Ee+=o.byteLength;let a;try{a=n.push(o)}catch{K("viewer_protocol");return}for(let u of a){if(e.done)return;switch(u.type){case"ping":P({type:"pong",token:u.token});break;case"pointer":fe((y)=>y.pointer(u.x,u.y,u.buttons));break;case"key":fe((y)=>y.key(u.down,u.keysym));break;case"clientClipboard":fe((y)=>y.clipboard(u.text));break;case"config":if(u.preset!==l)l=u.preset,Y();break;case"keyframeRequest":if(w&&!d)Y();break;case"ack":at(u.seq);break;case"audioEnable":if(u.on)ct();else X();break;case"resize":st({width:u.width,height:u.height});break;default:break}}if(!m&&!e.done){if(m=!0,M.viewer_ms=U(),t.viewer)ae=De.join(Te);pe(),Re()}},close(){if(c&&!("kind"in c)){let o=G.get(c.display);if(o?.delete(Pe),o?.size===0)G.delete(c.display)}if(ae?.(),ae=null,le?.close(),S)clearInterval(S);if(_)clearInterval(_);clearTimeout(se),p?.leave(ce),X(),g?.close()},summary:()=>({output_bytes:ve,input_bytes:Ee,video:{preset:l,frames:ne,dropped:O,restarts:re,avg_fps:H!==null&&ie>H?Math.round((ne-1)/((ie-H)/1e6)*10)/10:0,min_rtt_ms:Math.round(te??0),p50_rtt_ms:ee?lt():0,audio_packets:T,audio_dropped:x,resizes:Me,connect:M}})}}var Ye=null,nt=null,Yt=null,jt=null;function Zt(){let e=A();return e?.features.display?e.ffmpeg:null}function rt(e){return Ye??=new Promise((t)=>{xt(e,["-hide_banner","-encoders"],{env:{},timeout:5000,killSignal:"SIGKILL",maxBuffer:1048576,encoding:"utf8"},(s,i)=>{let n=(l)=>!s&&new RegExp(`^\\s*V\\S*\\s+${l}\\s`,"m").test(i);t(nt={x264:n("libx264"),videotoolbox:n("h264_videotoolbox")})})}),Ye}var je=null;function Xo(){return je??=(async()=>{let e=[A()?.ffmpeg,"/opt/homebrew/bin/ffmpeg","/usr/local/bin/ffmpeg"].find((s)=>Boolean(s&&vt(s)));if(!e)return null;let t=await rt(e);return t.videotoolbox||t.x264?e:null})(),je}function Jt(e=process.platform,t={}){if(e!=="linux"&&e!=="darwin"&&e!=="win32")return Promise.resolve(!1);let s=(t.ffmpeg??Zt)();if(!s)return Promise.resolve(!1);let i=(t.encoders??rt)(s);if(e==="linux")return i.then((l)=>l.x264);if(e==="win32"){let l=t.windowsScreen?t.windowsScreen():jt??=wc();return Promise.all([i,l]).then(([c,h])=>c.x264&&(h?.session??0)>0)}let n=t.macScreen?t.macScreen():Yt??=Pr(ke());return Promise.all([i,n]).then(([l,c])=>(l.x264||l.videotoolbox)&&c?.screen===!0&&c.accessibility)}
|
|
48
|
+
export{Vo,Kt,_c,Go,Ko,Jo,Xo,Jt};
|