@reason-machines/cli-linux-x64 0.2.517 → 0.2.518
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 +1 -1
- package/bin/vm-hands/{api-383vq85h.js → api-apavfrnk.js} +1 -1
- package/bin/vm-hands/{api-credentials-vgwmvese.js → api-credentials-s1jn2jfp.js} +1 -1
- package/bin/vm-hands/connect-cli-15fpx2j9.js +2 -0
- package/bin/vm-hands/{credentials-pgsb4v9j.js → credentials-yf556ykn.js} +1 -1
- package/bin/vm-hands/{custom-endpoint-device-57hkdy1z.js → custom-endpoint-device-vbct7bj9.js} +1 -1
- package/bin/vm-hands/{hands-worker-source-xjbrgfar.js → hands-worker-source-h0qmr1jt.js} +1 -1
- package/bin/vm-hands/{install-receipt-y7exc4wh.js → install-receipt-gwv1qv2m.js} +1 -1
- package/bin/vm-hands/local-automation-5e3cmtqd.js +2 -0
- package/bin/vm-hands/local-capabilities-pmm1ghsh.js +2 -0
- package/bin/vm-hands/{local-desktop-users-q0391ha1.js → local-desktop-users-4hc6jysa.js} +1 -1
- package/bin/vm-hands/local-display-mac-fjeyb4h9.js +2 -0
- package/bin/vm-hands/local-display-session-g7s5xwc9.js +2 -0
- package/bin/vm-hands/local-display-video-qcht7g9p.js +2 -0
- package/bin/vm-hands/local-managed-process-qkagbzkt.js +2 -0
- package/bin/vm-hands/{local-pty-session-q06ff8yk.js → local-pty-session-4h4ekakp.js} +1 -1
- package/bin/vm-hands/{managed-runtime-dr9f7vhq.js → managed-runtime-awrj7d2k.js} +1 -1
- package/bin/vm-hands/{network-contract-6mkf58vs.js → network-contract-4wew8f21.js} +1 -1
- package/bin/vm-hands/permissions-derwytwg.js +2 -0
- package/bin/vm-hands/{reason-hands-protocol-zf7bpqwe.js → reason-hands-protocol-6fxcbhzd.js} +1 -1
- package/bin/vm-hands/{serve-service-t4pqj1sr.js → serve-service-1wbw4rh3.js} +1 -1
- package/bin/vm-hands/{status-6s5f56hk.js → status-6n9wbsps.js} +2 -2
- package/bin/vm-hands/version-yp27t0ew.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-024t90qh.js → vm-hands-entry-lite-148nz8be.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-vs47bs09.js → vm-hands-entry-lite-19dpjtpb.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-k1wghndy.js → vm-hands-entry-lite-1nrxnm0y.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-k9sekkb8.js → vm-hands-entry-lite-2r36xj58.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-wp0d65yx.js → vm-hands-entry-lite-5eg3tgdq.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-tz7a7s9b.js → vm-hands-entry-lite-5jvnyk8s.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-tqyq1mxn.js → vm-hands-entry-lite-66tve5yn.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-vqdsqcwr.js → vm-hands-entry-lite-6en938c0.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-qzcac2mf.js → vm-hands-entry-lite-70x16hkx.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-ecpw35ja.js → vm-hands-entry-lite-8hqx9acp.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-psjcmgj8.js → vm-hands-entry-lite-90y6pf98.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-qkcs9aeg.js → vm-hands-entry-lite-9nsyy6zm.js} +1 -1
- package/bin/vm-hands/vm-hands-entry-lite-a8bacdvh.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-dj0mgwbh.js → vm-hands-entry-lite-bqdjvwgc.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-p2zrb900.js → vm-hands-entry-lite-exgpf39d.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-1ek3r3w9.js → vm-hands-entry-lite-fgppp6x9.js} +1 -1
- package/bin/vm-hands/vm-hands-entry-lite-g87ma08p.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-eed0esxe.js → vm-hands-entry-lite-gd692vfb.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-3p7zk3yt.js → vm-hands-entry-lite-gh0yjzye.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-kwcyzhvd.js → vm-hands-entry-lite-j93dy26a.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-64b6nx6h.js → vm-hands-entry-lite-mma9qt5r.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-f558n9yv.js → vm-hands-entry-lite-mxdqbds1.js} +12 -12
- package/bin/vm-hands/{vm-hands-entry-lite-0gj3p9tg.js → vm-hands-entry-lite-ndhspax6.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-1zd088yv.js → vm-hands-entry-lite-q80xmhrx.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-m7pkmatv.js → vm-hands-entry-lite-qxeegp2n.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-kc2y7q8f.js → vm-hands-entry-lite-r27j00db.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-pwmvq53c.js → vm-hands-entry-lite-v0zva5nj.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-rsr3f75h.js → vm-hands-entry-lite-wbtkvxs6.js} +17 -17
- package/bin/vm-hands/{vm-hands-entry-lite-7p4qsm5s.js → vm-hands-entry-lite-wzq3qsh1.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-k11ns9qs.js → vm-hands-entry-lite-y1p3s68r.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-vwxg4fhe.js → vm-hands-entry-lite-ydgedg8n.js} +4 -4
- package/bin/vm-hands/vm-hands-entry-lite.js +2 -2
- package/bin/vm-hands/{vm-hands-executor-1k2mys87.js → vm-hands-executor-nhnq0d9p.js} +3 -3
- package/bin/vm-hands/vm-hands-op-runner-3k3hs6mn.js +2 -0
- package/bin/vm-hands/{vm-hands-runtime-cvkyeepf.js → vm-hands-runtime-2reypgfn.js} +3 -3
- package/bin/vm-hands/worker-preview-readiness-ye6cvg3k.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/connect-cli-9d1rygxb.js +0 -2
- package/bin/vm-hands/local-automation-m6sft3re.js +0 -2
- package/bin/vm-hands/local-capabilities-p9q439fd.js +0 -2
- package/bin/vm-hands/local-display-mac-7pg0n3zs.js +0 -2
- package/bin/vm-hands/local-display-session-vpb49cqa.js +0 -2
- package/bin/vm-hands/local-display-video-hwyrvtgb.js +0 -2
- package/bin/vm-hands/local-managed-process-wrs4aaxd.js +0 -2
- package/bin/vm-hands/permissions-5y8cvehe.js +0 -2
- package/bin/vm-hands/version-c4rfp8yd.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-82cys43x.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-xb73ps42.js +0 -3
- package/bin/vm-hands/vm-hands-op-runner-z9vf56kj.js +0 -2
- package/bin/vm-hands/worker-preview-readiness-6kk98y4k.js +0 -2
package/bin/reason
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{I,ks,Qo}from"./vm-hands-entry-lite-
|
|
2
|
+
import{I,ks,Qo}from"./vm-hands-entry-lite-g87ma08p.js";import"./vm-hands-entry-lite-v0zva5nj.js";import"./vm-hands-entry-lite-a8bacdvh.js";import"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-qz74j563.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{I as ApiError,Qo as ReasonApi,ks as createMachineEnrollmentTicketWithToken};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ui,Xo,Yo,xs}from"./vm-hands-entry-lite-
|
|
2
|
+
import{Ui,Xo,Yo,xs}from"./vm-hands-entry-lite-9nsyy6zm.js";import"./vm-hands-entry-lite-g87ma08p.js";import"./vm-hands-entry-lite-v0zva5nj.js";import"./vm-hands-entry-lite-a8bacdvh.js";import"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-qz74j563.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Ui as apiOriginFromEnvironment,Yo as environmentApiKey,Xo as explicitApiOrigin,xs as resolveApiCredentials};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{it,ys,bs,vs}from"./vm-hands-entry-lite-exgpf39d.js";import"./vm-hands-entry-lite-60pnam39.js";import"./vm-hands-entry-lite-wzq3qsh1.js";import"./vm-hands-entry-lite-9nsyy6zm.js";import"./vm-hands-entry-lite-g87ma08p.js";import"./vm-hands-entry-lite-v0zva5nj.js";import"./vm-hands-entry-lite-bqdjvwgc.js";import"./vm-hands-entry-lite-wbtkvxs6.js";import"./vm-hands-entry-lite-5np5k3wb.js";import"./vm-hands-entry-lite-gd692vfb.js";import"./vm-hands-entry-lite-mxdqbds1.js";import"./vm-hands-entry-lite-dcrz19xf.js";import"./vm-hands-entry-lite-q80xmhrx.js";import"./vm-hands-entry-lite-90y6pf98.js";import"./vm-hands-entry-lite-ymqb2927.js";import"./vm-hands-entry-lite-5jvnyk8s.js";import"./vm-hands-entry-lite-r27j00db.js";import"./vm-hands-entry-lite-j93dy26a.js";import"./vm-hands-entry-lite-wx1fmrbs.js";import"./vm-hands-entry-lite-66tve5yn.js";import"./vm-hands-entry-lite-1nrxnm0y.js";import"./vm-hands-entry-lite-qxeegp2n.js";import"./vm-hands-entry-lite-gh0yjzye.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-fgppp6x9.js";import"./vm-hands-entry-lite-8hqx9acp.js";import"./vm-hands-entry-lite-y1p3s68r.js";import"./vm-hands-entry-lite-a8bacdvh.js";import"./vm-hands-entry-lite-19dpjtpb.js";import"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-ydgedg8n.js";import"./vm-hands-entry-lite-mma9qt5r.js";import"./vm-hands-entry-lite-148nz8be.js";import"./vm-hands-entry-lite-qz74j563.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{ys as computerDisconnected,it as connectionDirectory,bs as connectionReport,vs as restartConnection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fe,un,It,dn}from"./vm-hands-entry-lite-
|
|
2
|
+
import{Fe,un,It,dn}from"./vm-hands-entry-lite-v0zva5nj.js";import"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{Fe as credentialsPath,dn as deleteCredentials,It as loadCredentials,un as saveCredentials};
|
package/bin/vm-hands/{custom-endpoint-device-57hkdy1z.js → custom-endpoint-device-vbct7bj9.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{nt,
|
|
2
|
+
import{nt,Et,cr,on,xt,kt,Oi,sn,Ii,Di,Ni}from"./vm-hands-entry-lite-mma9qt5r.js";export{nt as CUSTOM_ENDPOINT_DEVICE_CAPABILITY,Et as CUSTOM_ENDPOINT_DEVICE_CHUNK_BYTES,xt as CUSTOM_ENDPOINT_DEVICE_MAX_BODY_BYTES,on as CUSTOM_ENDPOINT_DEVICE_MAX_CHUNKS,kt as CUSTOM_ENDPOINT_DEVICE_MAX_PAYLOAD_BYTES,cr as CUSTOM_ENDPOINT_DEVICE_MAX_RESPONSE_BYTES,Oi as CUSTOM_ENDPOINT_DEVICE_TIMEOUT_MS,Di as CustomEndpointDeviceCredentialSchema,Ii as CustomEndpointDeviceRequestSchema,sn as customEndpointRequestMatchesConfig,Ni as isCustomEndpointDeviceFailureCode};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{D,R,os,b,Cn}from"./vm-hands-entry-lite-
|
|
2
|
+
import{D,R,os,b,Cn}from"./vm-hands-entry-lite-q80xmhrx.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-fgppp6x9.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{b as REASON_HANDS_WORKER_ARTIFACT_SHA256,R as REASON_HANDS_WORKER_ENTRYPOINT,os as REASON_HANDS_WORKER_SOURCE,Cn as REASON_HANDS_WORKER_STARTUP_REFUSALS,D as REASON_HANDS_WORKER_VERSION};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{us,Jr,Qn,Zr,ei}from"./vm-hands-entry-lite-
|
|
2
|
+
import{us,Jr,Qn,Zr,ei}from"./vm-hands-entry-lite-19dpjtpb.js";import"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{us as FUTURE_DEVICE_CONSENT_SCOPE,Jr as installationReceiptPath,Zr as installerReasonAlias,Qn as installerReceiptLauncher,ei as loadInstallationReceipt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Pn,Fs,js,Us,Hs,Tn}from"./vm-hands-entry-lite-5jvnyk8s.js";import"./vm-hands-entry-lite-r27j00db.js";import"./vm-hands-entry-lite-j93dy26a.js";import"./vm-hands-entry-lite-wx1fmrbs.js";import"./vm-hands-entry-lite-66tve5yn.js";import"./vm-hands-entry-lite-1nrxnm0y.js";import"./vm-hands-entry-lite-qxeegp2n.js";import"./vm-hands-entry-lite-gh0yjzye.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-fgppp6x9.js";import"./vm-hands-entry-lite-8hqx9acp.js";import"./vm-hands-entry-lite-y1p3s68r.js";import"./vm-hands-entry-lite-a8bacdvh.js";import"./vm-hands-entry-lite-19dpjtpb.js";import"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-ydgedg8n.js";import"./vm-hands-entry-lite-mma9qt5r.js";import"./vm-hands-entry-lite-148nz8be.js";import"./vm-hands-entry-lite-qz74j563.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{js as ensureLocalBrowser,Pn as localAutomationAvailable,Us as localBrowserProfile,Fs as localUserChromeHost,Hs as runAutomationCallLocally,Tn as runLocalAutomation};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{es,qi,mn,ts,rs,ns,is,Ds,Ns,Ls,Ms}from"./vm-hands-entry-lite-wbtkvxs6.js";import"./vm-hands-entry-lite-5np5k3wb.js";import"./vm-hands-entry-lite-gd692vfb.js";import"./vm-hands-entry-lite-mxdqbds1.js";import"./vm-hands-entry-lite-dcrz19xf.js";import"./vm-hands-entry-lite-q80xmhrx.js";import"./vm-hands-entry-lite-90y6pf98.js";import"./vm-hands-entry-lite-ymqb2927.js";import"./vm-hands-entry-lite-5jvnyk8s.js";import"./vm-hands-entry-lite-r27j00db.js";import"./vm-hands-entry-lite-j93dy26a.js";import"./vm-hands-entry-lite-wx1fmrbs.js";import"./vm-hands-entry-lite-66tve5yn.js";import"./vm-hands-entry-lite-1nrxnm0y.js";import"./vm-hands-entry-lite-qxeegp2n.js";import"./vm-hands-entry-lite-gh0yjzye.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-fgppp6x9.js";import"./vm-hands-entry-lite-8hqx9acp.js";import"./vm-hands-entry-lite-y1p3s68r.js";import"./vm-hands-entry-lite-a8bacdvh.js";import"./vm-hands-entry-lite-19dpjtpb.js";import"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-ydgedg8n.js";import"./vm-hands-entry-lite-mma9qt5r.js";import"./vm-hands-entry-lite-148nz8be.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import"./vm-hands-entry-lite-qz74j563.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{r as LocalCapabilityError,es as SHORT_REQUEST_CAPABILITIES,Ds as capabilityInventoryForRoots,qi as confinedExecutionShell,ts as defaultLocalCommandRunner,Ns as deliverLocalHandsEnvironment,is as enrolledRootPaths,Ms as executeLocalOperation,Ls as rebindLocalHandsControl,rs as runFileCapability,ns as runTransferCapability,mn as spawnCaptured};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Pt,wa,ba,Fi,ji}from"./vm-hands-entry-lite-148nz8be.js";import"./vm-hands-entry-lite-qz74j563.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{wa as forgetLocalDesktopUse,ji as holdLocalDesktop,Pt as noteLocalDesktopUse,ba as releaseLocalDesktop,Fi as trackDesktopRun};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ft,zs,G,qe,jt}from"./vm-hands-entry-lite-r27j00db.js";import"./vm-hands-entry-lite-j93dy26a.js";import"./vm-hands-entry-lite-wx1fmrbs.js";import"./vm-hands-entry-lite-66tve5yn.js";import"./vm-hands-entry-lite-1nrxnm0y.js";import"./vm-hands-entry-lite-qxeegp2n.js";import"./vm-hands-entry-lite-gh0yjzye.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-fgppp6x9.js";import"./vm-hands-entry-lite-y1p3s68r.js";import"./vm-hands-entry-lite-a8bacdvh.js";import"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-148nz8be.js";import"./vm-hands-entry-lite-qz74j563.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{qe as ensureLinuxDesktop,Ft as localDisplayAvailable,zs as localDisplayReady,G as privateDirectory,jt as runLocalDisplayStream};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{On,In,Dn,Nn,Tr}from"./vm-hands-entry-lite-j93dy26a.js";import"./vm-hands-entry-lite-wx1fmrbs.js";import"./vm-hands-entry-lite-66tve5yn.js";import"./vm-hands-entry-lite-1nrxnm0y.js";import"./vm-hands-entry-lite-y1p3s68r.js";import"./vm-hands-entry-lite-a8bacdvh.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{On as MAC_SCREEN,In as WINDOWS_SCREEN,Dn as createDisplayVideoLane,Tr as localDisplayVideoAvailable,Nn as simulatorVideoFfmpeg};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{st,fr,$s,Bs}from"./vm-hands-entry-lite-gd692vfb.js";import"./vm-hands-entry-lite-mxdqbds1.js";import"./vm-hands-entry-lite-dcrz19xf.js";import"./vm-hands-entry-lite-q80xmhrx.js";import"./vm-hands-entry-lite-90y6pf98.js";import"./vm-hands-entry-lite-ymqb2927.js";import"./vm-hands-entry-lite-wx1fmrbs.js";import"./vm-hands-entry-lite-gh0yjzye.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-fgppp6x9.js";import"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-ydgedg8n.js";import"./vm-hands-entry-lite-mma9qt5r.js";import"./vm-hands-entry-lite-148nz8be.js";import"./vm-hands-entry-lite-qz74j563.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{st as ManagedProcessStoppedError,$s as controlManagedDeviceProcess,Bs as retireManagedDeviceProcess,fr as runManagedDeviceProcess};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ir,Vt,Dr,cs,jn,Nr,Un}from"./vm-hands-entry-lite-
|
|
2
|
+
import{Ir,Vt,Dr,cs,jn,Nr,Un}from"./vm-hands-entry-lite-qxeegp2n.js";import"./vm-hands-entry-lite-gh0yjzye.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-fgppp6x9.js";import"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{Vt as LOCAL_PTY_MAX_BUFFERED_OUTPUT_BYTES,Dr as LOCAL_PTY_MAX_SESSIONS,Ir as LOCAL_PTY_MAX_SESSION_MS,Nr as defaultConnect,cs as defaultLoginShell,jn as ptyRuntimeSupported,Un as runLocalPtySession};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Cs,As,Ps,Ts,Rs,Os,Is}from"./vm-hands-entry-lite-
|
|
2
|
+
import{Cs,As,Ps,Ts,Rs,Os,Is}from"./vm-hands-entry-lite-bqdjvwgc.js";import"./vm-hands-entry-lite-ymqb2927.js";import"./vm-hands-entry-lite-y1p3s68r.js";import"./vm-hands-entry-lite-a8bacdvh.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-qz74j563.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Rs as acquireManagedRuntimeDirectoryLock,Ps as currentManagedRuntimeVersion,Is as flushManagedRuntimeLifecycleEvents,Ts as isManagedRuntimeVersionExecutable,As as legacyManagedRuntimePaths,Cs as managedRuntimePaths,Os as recordManagedRuntimeLifecycle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rt,Te,Qs,ea,ta,ni,ra,nn,ii,
|
|
2
|
+
import{rt,Te,Qs,ea,ta,ni,ra,nn,ii,vt,oi,si,ai,ci,li,ui,di,pi,hi,fi,mi,gi,_i,yi,wi,bi,pe,Y,Re,q,vi,Si,Ei,Q,xi,ki,Ci,Ai,Pi,St,Ti,na,ar,Ri,ia,ds,oa,sa,aa,ca,la,ua,da,pa,ha,fa,ma,ga,_a,ya}from"./vm-hands-entry-lite-ydgedg8n.js";import"./vm-hands-entry-lite-mma9qt5r.js";export{Ti as AUTOMATION_CLOUD_SESSIONS,St as AUTOMATION_USER_CHROME,mi as HANDS_CLOUD_ACCESS,gi as HANDS_CLOUD_ACCESS_KEY,pe as HANDS_CONFINEMENT,Y as HANDS_CONFINEMENT_KEY,ci as HANDS_ENVIRONMENT_AT_CLAIM,li as HANDS_ENVIRONMENT_AT_CLAIM_KEY,ii as HANDS_ENVIRONMENT_DELIVERY,vt as HANDS_ENVIRONMENT_DELIVER_CONTROL,_i as HANDS_HEADLESS_BROWSER,yi as HANDS_HEADLESS_BROWSER_KEY,vi as HANDS_JOBS_USER,Si as HANDS_JOBS_USER_KEY,wi as HANDS_LARGE_ENVIRONMENT,bi as HANDS_LARGE_ENVIRONMENT_KEY,Re as HANDS_MODEL_JOBS_EGRESS,q as HANDS_MODEL_JOBS_EGRESS_KEY,pi as HANDS_REBIND,fi as HANDS_REBIND_CONTROL,hi as HANDS_REBIND_KEY,xi as HANDS_SESSION_CAP_KEY,ki as HANDS_SESSION_CAP_NONE,Ei as HANDS_SESSION_GROUP,Q as HANDS_SESSION_GROUP_KEY,ui as HANDS_WORKSPACE_CHECK,di as HANDS_WORKSPACE_CHECK_KEY,Ai as JOBS_START_WAIT,Pi as JOBS_START_WAIT_KEY,Te as LOCAL_OPERATION_MAX_BYTES,rt as LOCAL_RUNTIME_PROTOCOL_VERSION,ta as LOCAL_RUNTIME_ROUTES,nn as LOCAL_RUNTIME_SESSION_CLAIM_WAIT_MAX_MS,ni as LOCAL_RUNTIME_SESSION_PATH,ar as LOCAL_RUNTIME_WORKER_STARTUP_MAX_MS,Qs as RELAY_HOST_ALIAS_HEADER,ea as RELAY_HOST_ALIAS_VERSION,ai as VM_HANDS_UNBIND_UNVERIFIED_EVENT,oi as VM_HANDS_WORKSPACE_DEFERRED_KEY,si as VM_HANDS_WORKSPACE_GRANT_CONTROL,Ci as WORKER_PREVIEW_CARRIED_JOBS,na as WORKER_STARTUP_TIMING_STAGES,Ri as buildLocalRuntimeDeviceProofBytes,ra as localRuntimeSessionRoutable,da as parseLocalRuntimeDisconnectResponse,sa as parseLocalRuntimeEnrollmentResponse,ia as parseLocalRuntimeErrorEnvelope,ca as parseLocalRuntimeFirstHeartbeat,aa as parseLocalRuntimeHeartbeatResponse,ua as parseLocalRuntimeIdentityResponse,ha as parseLocalRuntimeLifecycleResponse,pa as parseLocalRuntimeLocalSubscriptionResponse,fa as parseLocalRuntimeOperationClaim,ya as parseLocalRuntimeOperationCompletionResponse,_a as parseLocalRuntimeOperationEnvironmentResponse,ga as parseLocalRuntimeOperationEventsResponse,ma as parseLocalRuntimeOperationHeartbeatResponse,ds as parseLocalRuntimeProofChallenge,oa as parseLocalRuntimeRegistrationResponse,la as parseLocalRuntimeRootsSyncResponse};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ss,as,Ws,Vs}from"./vm-hands-entry-lite-66tve5yn.js";import"./vm-hands-entry-lite-1nrxnm0y.js";import"./vm-hands-entry-lite-y1p3s68r.js";import"./vm-hands-entry-lite-a8bacdvh.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{Vs as allowMacPermissions,Ws as permissionsSummary,as as readMacPermissions,ss as reasonIdentity};
|
package/bin/vm-hands/{reason-hands-protocol-zf7bpqwe.js → reason-hands-protocol-6fxcbhzd.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{P,Br,Fr,Hn,
|
|
2
|
+
import{P,Br,Fr,Hn,ft,zn,jr,Je,Se,qn,Ze,Xt,ne,Xe,Wn,Ee,Yt,Ur,Qt,Hr,Vn,ae,U,N,ce,zr,qr,Gn}from"./vm-hands-entry-lite-fgppp6x9.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{Hr as REASON_HANDS_CLOSE_CODES,Ze as REASON_HANDS_JOB_CONTROL_MAX_FRAME_BYTES,jr as REASON_HANDS_JOB_MAX_INPUT_CHARS,Je as REASON_HANDS_JOB_MAX_OUTPUT_CHARS,Se as REASON_HANDS_JOB_MAX_OUTPUT_CHUNKS,qn as REASON_HANDS_JOB_MAX_RECORDS,zn as REASON_HANDS_MAX_ERROR_CHARS,Br as REASON_HANDS_MAX_FRAME_BYTES,Fr as REASON_HANDS_MAX_INPUT_CHARS,ft as REASON_HANDS_MAX_OUTPUT_CHARS,Hn as REASON_HANDS_MAX_STRUCTURED_INPUT_CHARS,P as REASON_HANDS_PROTOCOL_VERSION,Ur as REASON_HANDS_PTY_ANCHOR_EXIT_MS,Qt as REASON_HANDS_PTY_CLEANUP_RECEIPT_MS,Yt as REASON_HANDS_PTY_CLEANUP_SWEEP_MS,Ee as REASON_HANDS_PTY_MAX_DIMENSION,ne as REASON_HANDS_PTY_MAX_INPUT_BYTES,Xe as REASON_HANDS_PTY_MAX_OUTPUT_BYTES,Wn as REASON_HANDS_PTY_MAX_PENDING_INPUT_BYTES,Xt as REASON_HANDS_PTY_PROTOCOL_VERSION,Vn as REASON_HANDS_WORKSPACE_BEFORE_MAX_OUTPUT_CHARS,U as isReasonHandsGeneration,ce as isReasonHandsPtyJobId,ae as isReasonHandsRequestId,N as isReasonHandsUuid,zr as parseReasonHandsJobRequest,qr as parseReasonHandsJobResult,Gn as parseReasonHandsPtyReceipt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Wr,xe,J,Kn,Gs,Ro,Ks,Ye,ls,Jn,Js,Zs,Vr,Xs,Ys}from"./vm-hands-entry-lite-
|
|
2
|
+
import{Wr,xe,J,Kn,Gs,Ro,Ks,Ye,ls,Jn,Js,Zs,Vr,Xs,Ys}from"./vm-hands-entry-lite-8hqx9acp.js";import"./vm-hands-entry-lite-y1p3s68r.js";import"./vm-hands-entry-lite-a8bacdvh.js";import"./vm-hands-entry-lite-19dpjtpb.js";import"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-0sh835na.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-qz74j563.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Wr as WORKER_SERVICE_ENV,J as WorkerServiceError,Ro as connectServiceLabel,xe as defaultWorkerServiceHost,Zs as installWorkerService,Ye as installedWorkerService,Ks as isConnectServiceLabel,Ys as removeWorkerService,Vr as restartWorkerService,Xs as retargetWorkerServiceLogs,ls as retireLegacyWorkerService,Js as workerServiceDefinitionCurrent,Kn as workerServiceLauncher,Jn as workerServiceProcessRunning,Gs as workerServiceRetargetPending};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./vm-hands-entry-lite-
|
|
2
|
+
import"./vm-hands-entry-lite-g87ma08p.js";import"./vm-hands-entry-lite-fcvf8md1.js";import{_}from"./vm-hands-entry-lite-5eg3tgdq.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-v0zva5nj.js";import"./vm-hands-entry-lite-s85p7tqp.js";import"./vm-hands-entry-lite-a8bacdvh.js";import"./vm-hands-entry-lite-9nsyy6zm.js";import{Kt,ht}from"./vm-hands-entry-lite-gh0yjzye.js";import{w,M,pr,Be,it}from"./vm-hands-entry-lite-exgpf39d.js";import"./vm-hands-entry-lite-ydgedg8n.js";import"./vm-hands-entry-lite-mma9qt5r.js";import"./vm-hands-entry-lite-wbtkvxs6.js";import"./vm-hands-entry-lite-mxdqbds1.js";import"./vm-hands-entry-lite-dcrz19xf.js";import"./vm-hands-entry-lite-5np5k3wb.js";import"./vm-hands-entry-lite-60pnam39.js";import"./vm-hands-entry-lite-j93dy26a.js";import"./vm-hands-entry-lite-1nrxnm0y.js";import"./vm-hands-entry-lite-y1p3s68r.js";import"./vm-hands-entry-lite-66tve5yn.js";import"./vm-hands-entry-lite-wx1fmrbs.js";import"./vm-hands-entry-lite-bqdjvwgc.js";import"./vm-hands-entry-lite-19dpjtpb.js";import"./vm-hands-entry-lite-8hqx9acp.js";import"./vm-hands-entry-lite-fgppp6x9.js";import"./vm-hands-entry-lite-q80xmhrx.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-gd692vfb.js";import"./vm-hands-entry-lite-148nz8be.js";import"./vm-hands-entry-lite-qxeegp2n.js";import"./vm-hands-entry-lite-r27j00db.js";import"./vm-hands-entry-lite-5jvnyk8s.js";import"./vm-hands-entry-lite-wzq3qsh1.js";import"./vm-hands-entry-lite-90y6pf98.js";import"./vm-hands-entry-lite-ymqb2927.js";import{a}from"./vm-hands-entry-lite-0sh835na.js";import{t,o,u,i,s,n}from"./vm-hands-entry-lite-70x16hkx.js";import"./vm-hands-entry-lite-qz74j563.js";import{readFileSync as me,realpathSync as k,renameSync as ge,unlinkSync as fe,writeFileSync as he}from"fs";import{dirname as ye,join as I}from"path";function f(e){return`claude mcp add --transport http reason ${e}`}function h(e){return`codex mcp add reason --url ${e}
|
|
3
3
|
codex mcp login reason`}var F=f("https://mcp.reasonmachines.com/mcp"),z=h("https://mcp.reasonmachines.com/mcp"),B=`https://claude.ai/settings/connectors?add=custom&url=${encodeURIComponent("https://mcp.reasonmachines.com/mcp")}`,H=`https://cursor.com/install-mcp?name=reason&config=${encodeURIComponent(btoa(JSON.stringify({url:"https://mcp.reasonmachines.com/mcp"})))}`;var b="https://github.com/reason-machines/reason-plugins",X=`Connect a coding agent to Reason over MCP
|
|
4
4
|
|
|
5
5
|
Usage:
|
|
@@ -7,4 +7,4 @@ Usage:
|
|
|
7
7
|
reason mcp uninstall Remove only this machine's registrations of the earlier, retired server
|
|
8
8
|
|
|
9
9
|
Plugins for Claude Code and Codex: ${b}
|
|
10
|
-
`;var P=s(["granted","not_granted","unknown"]),C=i({status:P,checkedAt:o().finite(),executablePath:t().min(1)});var Oe=i({version:n(1),key:t(),at:o(),self:i({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:u(i({client_id:t(),client_name:t(),last_used_at:t().nullable()})).optional()})});var x=30000;function L(e,c=Date.now(),y=null){let r=
|
|
10
|
+
`;var P=s(["granted","not_granted","unknown"]),C=i({status:P,checkedAt:o().finite(),executablePath:t().min(1)});var Oe=i({version:n(1),key:t(),at:o(),self:i({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:u(i({client_id:t(),client_name:t(),last_used_at:t().nullable()})).optional()})});var x=30000;function L(e,c=Date.now(),y=null){let r=ht(e),d=(()=>{if(r?.state!=="connected"&&r?.state!=="starting")return!1;try{return process.kill(r.pid,0),!0}catch{return!1}})(),R=d&&r?.state==="connected",p=(g)=>R&&c-g>=0&&c-g<x,l=C.safeParse(r?.fullDiskAccess),m=Kt(r,y,c);return{...m?{permission_recovery:m}:{},full_disk_access:l.success&&p(l.data.checkedAt)?l.data.status:"unknown",keep_awake:{enabled:pr(e)==="battery_and_ac",holding:r?.idleSleepHold===!0&&p(Date.parse(r.lastHeartbeatAt??""))},executable:d&&l.success?l.data.executablePath:null}}function De(e=_()){if(process.platform!=="darwin")return null;let c=Be(I(it(k(a()),e),"worker.json"));return c?L(w(c).daemon,Date.now(),M(c)):null}export{De as connectionMacState};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{C}from"./vm-hands-entry-lite-qz74j563.js";import{execFileSync as h}from"child_process";import{mkdirSync as k,readdirSync as D,readFileSync as w,rmSync as g,statSync as x,writeFileSync as L}from"fs";import{join as p,sep as y}from"path";import{setTimeout as _}from"timers/promises";var P=3000,u=null;function S(e){return p(e,"users")}function
|
|
2
|
+
import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{C}from"./vm-hands-entry-lite-qz74j563.js";import{execFileSync as h}from"child_process";import{mkdirSync as k,readdirSync as D,readFileSync as w,rmSync as g,statSync as x,writeFileSync as L}from"fs";import{join as p,sep as y}from"path";import{setTimeout as _}from"timers/promises";var P=3000,u=null;function S(e){return p(e,"users")}function Pt(e){if(u?.root===e.root)return;let o=S(e.root);k(o,{recursive:!0,mode:448}),L(p(o,String(process.pid)),"",{mode:384}),u=e}function wa(){if(!u)return;g(p(S(u.root),String(process.pid)),{force:!0}),u=null}function m(e){try{return process.kill(e,0),!0}catch(o){return o instanceof Error&&"code"in o&&o.code==="EPERM"}}function E(){let e=process.getuid?.();if(process.platform==="linux")return D("/proc").flatMap((n)=>{if(!/^\d+$/.test(n))return[];try{if(x(`/proc/${n}`).uid!==e)return[];let s=w(`/proc/${n}/cmdline`).toString("utf8").split("\x00").join(" ").trim();return s?[{pid:Number(n),command:s}]:[]}catch{return[]}});if(process.platform==="win32")return h(C("powershell.exe"),["-NoLogo","-NoProfile","-NonInteractive","-Command",'Get-CimInstance Win32_Process | ForEach-Object { "$($_.ProcessId) $($_.CommandLine)" }'],{encoding:"utf8",maxBuffer:16777216,windowsHide:!0}).split(/\r?\n/).flatMap((s)=>{let l=/^(\d+) (.+)$/.exec(s.trim());return l?[{pid:Number(l[1]),command:l[2]}]:[]});return h("/bin/ps",["-axww","-o","pid=,uid=,command="],{encoding:"utf8",maxBuffer:16777216}).split(`
|
|
3
3
|
`).flatMap((n)=>{let s=/^\s*(\d+)\s+(\d+)\s+(.+)$/.exec(n);return s&&Number(s[2])===e?[{pid:Number(s[1]),command:s[3]}]:[]})}async function ba(){let e=u;if(!e)return{released:"unused",stopped:0};let o=S(e.root);g(p(o,String(process.pid)),{force:!0}),u=null;let n=!1;for(let t of D(o)){let c=Number(t);if(Number.isSafeInteger(c)&&c>0&&m(c))n=!0;else g(p(o,t),{force:!0})}if(n)return{released:"shared",stopped:0};let s=E().filter((t)=>t.pid!==process.pid&&(t.command.includes(`${e.root}${y}`)||t.command.includes(`${e.automation}${y}`)||t.command.includes(e.extensionDir))),l=(t,c)=>{try{process.kill(t,c)}catch{}};for(let t of s)l(t.pid,"SIGTERM");for(let t=Date.now()+P;Date.now()<t&&s.some((c)=>m(c.pid));)await new Promise((c)=>setTimeout(c,100));for(let t of s)if(m(t.pid))l(t.pid,"SIGKILL");return{released:"stopped",stopped:s.length}}var M=20000,N=30000,O=100,a=new Map,i=null,b=0,f=[];function Fi(e){a.set(e,(a.get(e)??0)+1);let o=!1;return()=>{if(o)return;o=!0;let n=(a.get(e)??1)-1;if(n>0){a.set(e,n);return}if(a.delete(e),i?.run===e)i.idleUntil=0}}function T(){return new r("automation_desktop_busy","Another Session, or another agent of this Session, is using this worker's desktop. Retry after it finishes.")}function U(e,o){return i!==null&&i.run!==e&&(i.calls>0||o<i.idleUntil)}async function ji(e,o,n=Date.now,s="run"){let l=Symbol(e);f.push(l);try{let d=n()+N;for(;;){if(b===0&&!U(e,n())&&(i?.run===e||f[0]===l))break;if(n()>=d)throw T();await _(O,void 0,{signal:o}).catch(()=>o.throwIfAborted())}}finally{f.splice(f.indexOf(l),1)}if(s==="call"&&!(i?.run===e&&(i.calls>0||n()<i.idleUntil))){b+=1;let d=!1;return()=>{if(d)return;d=!0,b-=1}}if(i?.run!==e)i={run:e,calls:0,idleUntil:0};let t=i;t.calls+=1;let c=!1;return()=>{if(c)return;c=!0,t.calls-=1,t.idleUntil=n()+M}}
|
|
4
|
-
export{
|
|
4
|
+
export{Pt,wa,ba,Fi,ji};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{_t,_,yt}from"./vm-hands-entry-lite-5eg3tgdq.js";import{chmodSync as X,existsSync as C,mkdirSync as Q,readlinkSync as S,readFileSync as b,renameSync as Z,unlinkSync as nn,writeFileSync as tn}from"fs";import{homedir as u}from"os";import{basename as h,dirname as p,isAbsolute as f,join as o,normalize as A,relative as O,resolve as N}from"path";var c=3,P=1,D=2,x=1,T=1,L="Reason may read and write files and run commands in this signed-in OS account, subject to saved restrictions and operating system permissions.",us="Reason may later execute on this computer inside a Reason sandbox, limited to folders explicitly attached by the user.",M=[us,"Ara may later execute on this computer inside an Ara sandbox, limited to folders explicitly attached by the user."];function F(n){return typeof n==="string"&&M.includes(n)}var B=["future_device","updates_only","cli_only"];function y(n){return typeof n==="string"&&B.some((t)=>t===n)}function U(n=process.env,t=u()){return n.XDG_CONFIG_HOME?.trim()||o(t,".config")}function Jr(n=process.env,t=u()){let r=_({env:n}),e=U(n,t);return o(e,yt(e).state==="kept"?"ara":"reason",...r==="staging"?["staging"]:[],"installation.json")}function a(n){return typeof n==="string"&&n.trim().length>0}var V=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function K(n){return typeof n==="string"&&V.test(n)}function l(n){return a(n)&&f(n)&&A(n)===n}function g(n){if(!n||typeof n!=="object"||Array.isArray(n))return!1;let t=n;return l(t.path)&&(t.role==="launcher"&&(t.kind==="file"||t.kind==="symlink")||t.role==="worker_root"&&t.kind==="directory"||t.role==="alias"&&t.kind==="symlink"&&l(t.target))}function m(n){return n==="staging"?["reason-staging","ara-staging"]:["reason","ara"]}function Qn(n){let t=n.owned_paths.filter((e)=>e.role==="launcher").map((e)=>e.path),[r]=m(n.channel);return t.find((e)=>h(e)===r)??t[0]??null}function I(n){let[t,r]=m(n.channel==="staging"?"staging":"production"),e=[[t,r],[r,t]];return n.owned_paths?.every((i)=>i.role!=="alias"||n.installer==="shell"&&e.some(([s,R])=>i.path===o(n.install_dir,s)&&i.target===o(n.install_dir,R))&&n.owned_paths?.some((s)=>s.role==="launcher"&&s.path===i.target))??!1}function d(n,t){try{return N(p(n),S(n))===t}catch{return!1}}function Zr(n){let t=h(n),r=t==="ara"?"reason":t==="ara-staging"?"reason-staging":null;if(!r)return n;let e=o(p(n),r);return d(e,n)||d(n,e)?e:n}function w(n,t){let r=O(n,t);return r.length>0&&!r.startsWith("..")&&!f(r)}function E(n){if(n===null)return!0;if(!n||typeof n!=="object"||Array.isArray(n))return!1;let t=n;return(t.kind==="shell_profile"||t.kind==="windows_user_path")&&a(t.location)&&a(t.value)&&(typeof t.added_by_installer==="boolean"||typeof t.added_by_ara==="boolean")&&(t.added_by_installer===void 0||typeof t.added_by_installer==="boolean")&&(t.added_by_ara===void 0||typeof t.added_by_ara==="boolean")}function k(n,t){if(t===null)return n==="cli_only";if(!t||typeof t!=="object"||Array.isArray(t))return!1;let r=t;if(r.version!==x||!a(r.recorded_at))return!1;if(n==="future_device")return r.decision==="authorized"&&F(r.scope);return r.scope===null&&r.decision===(n==="updates_only"?"ask":"disabled")}function z(n){if(!n||typeof n!=="object"||Array.isArray(n))return null;let t=n;if(t.schema_version!==P||!_t.includes(t.channel)||t.install_method!=="curl"||t.installer!=="shell"&&t.installer!=="powershell"||!a(t.installed_at)||!a(t.version)||!a(t.target)||!l(t.install_dir)||!Array.isArray(t.owned_paths)||!t.owned_paths.every(g)||!t.owned_paths.every((r)=>w(t.install_dir,r.path))||!I(t)||!E(t.path_entry))return null;return{...t,schema_version:c,installation_id:null,background_mode:"cli_only",device_consent:null}}function G(n){if(!n||typeof n!=="object"||Array.isArray(n))return null;let t=n;if(t.schema_version!==D||!v(t)||!y(t.background_mode)||!k(t.background_mode,t.device_consent))return null;return{...t,schema_version:c,installation_id:null}}function v(n){return _t.includes(n.channel)&&(n.install_method==="curl"&&(n.installer==="shell"||n.installer==="powershell")||n.install_method==="desktop"&&n.installer==="desktop"&&Array.isArray(n.owned_paths)&&n.owned_paths.length===0&&n.path_entry===null)&&a(n.installed_at)&&a(n.version)&&a(n.target)&&l(n.install_dir)&&Array.isArray(n.owned_paths)&&n.owned_paths.every(g)&&n.owned_paths.every((t)=>w(n.install_dir,t.path))&&I(n)&&E(n.path_entry)}function j(n){let t=z(n);if(t)return t;let r=G(n);if(r)return r;if(!n||typeof n!=="object"||Array.isArray(n))return null;let e=n;if(e.schema_version!==c||!K(e.installation_id)||!v(e)||!y(e.background_mode)||!k(e.background_mode,e.device_consent)||e.desktop_account_access!==void 0&&(e.desktop_account_access===null||typeof e.desktop_account_access!=="object"||Array.isArray(e.desktop_account_access)||e.desktop_account_access.version!==T||e.desktop_account_access.scope!==L||!a(e.desktop_account_access.recorded_at)||!Number.isFinite(Date.parse(e.desktop_account_access.recorded_at))))return null;return e}function ei(n=Jr()){if(!C(n))return null;try{return j(JSON.parse(b(n,"utf8")))}catch{return null}}export{us,Jr,Qn,Zr,ei};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as ie,spawn as E}from"child_process";var wo="h264_ws_v1",bo="video",
|
|
2
|
+
import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as ie,spawn as E}from"child_process";var wo="h264_ws_v1",bo="video",dt=["smooth","sharp","data_saver","balanced"];var vo="video_presets";var L=8388608,S=65536,So="control",Eo="v1",X=200;function Mn(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t,n=(i)=>typeof i==="string"&&i.length>0&&i.length<=X;if(Object.keys(e).length!==2||!n(e.user_id)||!n(e.name))return null;return{user_id:e.user_id,name:e.name}}var xo="windows",ko="v1",D=200,J=(t)=>typeof t==="string"&&dt.includes(t);function Co(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t;if(Object.keys(e).length!==2||e.format!=="h264_ws_v1"||!J(e.preset))return null;return{format:"h264_ws_v1",preset:e.preset}}var o={hello:1,frame:2,stats:3,pong:4,serverClipboard:5,error:6,audioHello:7,audio:8,control:9,windows:10,pointer:16,key:17,config:18,ping:19,clientClipboard:20,keyframeRequest:21,ack:22,audioEnable:23,resize:24};class l extends Error{constructor(t){super(t);this.name="DisplayVideoProtocolError"}}var Z=new TextEncoder,Q=new TextDecoder("utf-8",{fatal:!0});function p(t,e){if(e.byteLength+1>L)throw new l("message_too_large");let n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,e.byteLength+1),i.setUint8(4,t),n.set(e,5),n}function w(t){let e=Z.encode(t);if(e.byteLength>S)throw new l("text_too_large");return e}function _(t,e){if(!Number.isInteger(t)||t<0||t>65535)throw new l(`invalid_${e}`);return t}function ee(t){if(!Number.isFinite(t))throw new l("invalid_window");return Math.max(-2147483648,Math.min(2147483647,Math.round(t)))}function Wt(t){switch(t.type){case"hello":{let e=w(t.codec),n=new Uint8Array(6+e.byteLength),i=new DataView(n.buffer);return i.setUint16(0,_(t.width,"width")),i.setUint16(2,_(t.height,"height")),i.setUint8(4,Math.max(1,Math.min(240,Math.round(t.fps)))),i.setUint8(5,dt.indexOf(t.preset)),n.set(e,6),p(o.hello,n)}case"frame":{let e=new Uint8Array(13+t.data.byteLength),n=new DataView(e.buffer);return n.setUint8(0,t.key?1:0),n.setUint32(1,t.seq>>>0),n.setBigUint64(5,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,13),p(o.frame,e)}case"stats":return p(o.stats,w(JSON.stringify(t.stats)));case"pong":case"ping":{let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,t.token),p(t.type==="ping"?o.ping:o.pong,e)}case"serverClipboard":return p(o.serverClipboard,w(t.text));case"clientClipboard":return p(o.clientClipboard,w(t.text));case"error":return p(o.error,w(t.code));case"pointer":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint16(0,_(t.x,"x")),n.setUint16(2,_(t.y,"y")),n.setUint8(4,t.buttons&255),p(o.pointer,e)}case"key":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint8(0,t.down?1:0),n.setUint32(1,t.keysym>>>0),p(o.key,e)}case"config":return p(o.config,Uint8Array.of(dt.indexOf(t.preset)));case"keyframeRequest":return p(o.keyframeRequest,new Uint8Array(0));case"audioHello":{let e=w(t.codec),n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,t.sampleRate>>>0),i.setUint8(4,t.channels&255),n.set(e,5),p(o.audioHello,n)}case"audio":{let e=new Uint8Array(8+t.data.byteLength);return new DataView(e.buffer).setBigUint64(0,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,8),p(o.audio,e)}case"control":return p(o.control,w(JSON.stringify(t.control)));case"windows":{let e=t.bounds.slice(0,D),n=new Uint8Array(e.length*16),i=new DataView(n.buffer);return e.forEach((s,a)=>{[s.x,s.y,s.width,s.height].forEach((c,d)=>i.setInt32(a*16+d*4,ee(c)))}),p(o.windows,n)}case"audioEnable":return p(o.audioEnable,Uint8Array.of(t.on?1:0));case"resize":{let e=new Uint8Array(4),n=new DataView(e.buffer);return n.setUint16(0,_(t.width,"width")),n.setUint16(2,_(t.height,"height")),p(o.resize,e)}case"ack":{let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t.seq>>>0),p(o.ack,e)}}}function M(t){let e=dt[t];if(!e)throw new l("invalid_preset");return e}function y(t,e){if(t.byteLength!==e)throw new l("invalid_length")}function x(t){if(t.byteLength>S)throw new l("text_too_large");try{return Q.decode(t)}catch{throw new l("invalid_text")}}function te(t){let e;try{e=JSON.parse(x(t))}catch{throw new l("invalid_stats")}let n=e;if(!n||typeof n!=="object"||["fps","kbps","dropped","restarts","queued_bytes"].some((s)=>typeof n[s]!=="number"||!Number.isFinite(n[s])))throw new l("invalid_stats");return{fps:n.fps,kbps:n.kbps,dropped:n.dropped,restarts:n.restarts,queued_bytes:n.queued_bytes}}function ne(t){let e;try{e=JSON.parse(x(t))}catch{throw new l("invalid_control")}let n=e;if(!n||typeof n!=="object"||typeof n.you!=="boolean"||typeof n.same_user!=="boolean")throw new l("invalid_control");let i=n.holder===null?null:Mn(n.holder);if(i===null&&n.holder!==null)throw new l("invalid_control");return{holder:i,you:n.you,same_user:n.same_user}}function re(t,e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(t){case o.hello:if(e.byteLength<6)throw new l("invalid_length");return{type:"hello",width:n.getUint16(0),height:n.getUint16(2),fps:n.getUint8(4),preset:M(n.getUint8(5)),codec:x(e.subarray(6))};case o.frame:if(e.byteLength<14)throw new l("invalid_length");if(n.getUint8(0)>1)throw new l("invalid_frame_flags");return{type:"frame",key:n.getUint8(0)===1,seq:n.getUint32(1),captureMicros:Number(n.getBigUint64(5)),data:e.subarray(13)};case o.stats:return{type:"stats",stats:te(e)};case o.ping:case o.pong:return y(e,8),{type:t===o.ping?"ping":"pong",token:n.getFloat64(0)};case o.serverClipboard:return{type:"serverClipboard",text:x(e)};case o.clientClipboard:return{type:"clientClipboard",text:x(e)};case o.error:return{type:"error",code:x(e)};case o.pointer:return y(e,5),{type:"pointer",x:n.getUint16(0),y:n.getUint16(2),buttons:n.getUint8(4)};case o.key:if(y(e,5),n.getUint8(0)>1)throw new l("invalid_key_flags");return{type:"key",down:n.getUint8(0)===1,keysym:n.getUint32(1)};case o.config:return y(e,1),{type:"config",preset:M(n.getUint8(0))};case o.keyframeRequest:return y(e,0),{type:"keyframeRequest"};case o.audioHello:if(e.byteLength<5)throw new l("invalid_length");return{type:"audioHello",sampleRate:n.getUint32(0),channels:n.getUint8(4),codec:x(e.subarray(5))};case o.audio:if(e.byteLength<9)throw new l("invalid_length");return{type:"audio",captureMicros:Number(n.getBigUint64(0)),data:e.subarray(8)};case o.audioEnable:if(y(e,1),n.getUint8(0)>1)throw new l("invalid_audio_flags");return{type:"audioEnable",on:n.getUint8(0)===1};case o.resize:return y(e,4),{type:"resize",width:n.getUint16(0),height:n.getUint16(2)};case o.control:return{type:"control",control:ne(e)};case o.windows:{if(e.byteLength%16!==0||e.byteLength>D*16)throw new l("invalid_length");let i=[];for(let s=0;s<e.byteLength;s+=16)i.push({x:n.getInt32(s),y:n.getInt32(s+4),width:n.getInt32(s+8),height:n.getInt32(s+12)});return{type:"windows",bounds:i}}case o.ack:return y(e,4),{type:"ack",seq:n.getUint32(0)};default:return null}}class $n{buffer=new Uint8Array(0);push(t){let e=new Uint8Array(this.buffer.byteLength+t.byteLength);e.set(this.buffer),e.set(t,this.buffer.byteLength);let n=[],i=0;while(e.byteLength-i>=4){let s=new DataView(e.buffer,e.byteOffset+i,4).getUint32(0);if(s<1||s>L)throw new l("invalid_message_length");if(e.byteLength-i-4<s)break;let a=e[i+4],c=e.slice(i+5,i+4+s),d=re(a,c);if(d)n.push(d);i+=4+s}return this.buffer=e.slice(i),n}}var Y="/usr/bin/osascript",se=5000,oe=1048576,ae=String.raw`
|
|
3
3
|
ObjC.import("CoreGraphics");
|
|
4
4
|
ObjC.import("ApplicationServices");
|
|
5
5
|
ObjC.import("AppKit");
|
|
@@ -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 k(t,...e){let[n,...i]=[...t,Y,"-l","JavaScript","-e",ae,...e];return[n,i]}function H(t,...e){return new Promise((n)=>{ie(...k(t,...e),{env:{},timeout:se,killSignal:"SIGKILL",maxBuffer:65536,encoding:"utf8"},(i,s)=>n(i?null:q(s.split(`
|
|
73
|
-
`)[0]??"")))})}function Ge(t=[]){return H(t,"probe")}function
|
|
73
|
+
`)[0]??"")))})}function Ge(t=[]){return H(t,"probe")}function pt(t,e){return H(t,"request",...e?[e]:[])}var N=2,ce=8,ue=String.raw`
|
|
74
74
|
ObjC.import("CoreGraphics");
|
|
75
75
|
ObjC.import("Foundation");
|
|
76
76
|
ObjC.bindFunction("getppid", ["int", []]);
|
|
@@ -109,4 +109,4 @@ function run() {
|
|
|
109
109
|
`);h>=0;h=f.indexOf(`
|
|
110
110
|
`)){let U=f.slice(0,h);if(f=f.slice(h+1),!U.startsWith("c "))continue;let A=U.slice(2);if(A.length>Math.ceil(S/3)*4||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(A)){u({reason:"display_protocol"});return}let C=Buffer.from(A,"base64");if(C.byteLength<=S)t.clipboard(C.toString("utf8"));if(a)return}if(f.length>Math.ceil(S/3)*4+2)u({reason:"display_protocol"})}),c.once("error",()=>b("Reason could not watch this Mac's desktop clipboard.")),c.once("exit",()=>{if(!a)b("Reason could not watch this Mac's desktop clipboard.")})};return n.stdout.on("data",(f)=>{if(a||s===null)return;s+=f.toString("utf8");let g=s.indexOf(`
|
|
111
111
|
`);if(g<0){if(s.length>4096)u({reason:"display_protocol"});return}let h=q(s.slice(0,g));if(s=null,!h)u({reason:"display_protocol"});else if(!h.screen||!h.accessibility)b(e.length>0?"Reason's background worker needs Screen Recording and Accessibility on this Mac (its own Reason entry in System Settings > Privacy & Security, not the Reason app's): run `reason permissions allow` on this Mac.":"Allow Screen Recording and Accessibility for this Mac's Reason worker, then restart it.");else z(),t.ready({width:h.width,height:h.height})}),n.stdin.on("error",()=>{return}),n.once("error",()=>b("Reason could not start this Mac's desktop input.")),n.once("exit",()=>{if(s!==null)b("Reason could not start this Mac's desktop input.");else u({reason:"display_closed"})}),{pointer:(f,g,h)=>m(i.pointer(f,g,h)),key:(f,g)=>m(i.key(f,g)),clipboard:(f)=>m([`c ${Buffer.from(f,"utf8").toString("base64")}`]),close(){a=!0,d()}}}
|
|
112
|
-
export{wo,bo,
|
|
112
|
+
export{wo,bo,dt,vo,S,So,Eo,Mn,xo,ko,Co,Wt,$n,Ge,pt,Bn,Fn};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{readdirSync as b,readFileSync as P}from"fs";import{userInfo as k}from"os";var ur="--vm-hands-op-runner-kind=person",dr="--vm-hands-op-runner-kind=surface",
|
|
3
|
-
export{ur,dr,
|
|
2
|
+
import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{readdirSync as b,readFileSync as P}from"fs";import{userInfo as k}from"os";var ur="--vm-hands-op-runner-kind=person",dr="--vm-hands-op-runner-kind=surface",Tt="--vm-hands-surface-uid=",Rt="--vm-hands-surface-dir=",Ot=new Set(["automation.call.v1","display.stream.v1","preview.serve.v1"]);function R(t){let c=new Set([t]),l=[];try{l=b("/proc")}catch{}for(let o of l){if(!/^\d+$/.test(o))continue;try{let d=P(`/proc/${o}/stat`,"utf8");if(Number(d.slice(d.lastIndexOf(")")+2).split(" ")[3])===t)c.add(Number(o))}catch{}}for(let o of c)try{process.kill(o,"SIGKILL")}catch{}}var A=(t)=>{let c=globalThis.Bun;if(!c)throw new r("pty_unavailable","Reason terminals require the Bun runtime.");let l=c.spawn({cmd:[t.shell,...t.args],cwd:t.cwd,env:{...t.environment,TERM:"xterm-256color"},terminal:{cols:t.cols,rows:t.rows,data:(i,s)=>t.onData(s)}}),o=l.terminal,d=()=>{R(l.pid);try{o?.close()}catch{}};if(!o)throw d(),new r("pty_unavailable","Reason could not allocate a pseudo-terminal.");return{write:(i)=>o.write(i),resize:(i,s)=>o.resize(i,s),kill:d,exited:l.exited.then((i)=>typeof i==="number"?i:null,()=>null)}};function x(){let t=(()=>{try{return k().username}catch{return}})();return{PATH:process.env.PATH,HOME:process.env.HOME,SHELL:process.env.SHELL,LANG:"C.UTF-8",...t?{USER:t,LOGNAME:t}:{}}}async function E(t){let[{localAutomationAvailable:c},{localDisplayReady:l},{localDisplayVideoAvailable:o},{probeWorkerPreview:d},y]=await Promise.all([import("./local-automation-5e3cmtqd.js"),import("./local-display-session-g7s5xwc9.js"),import("./local-display-video-qcht7g9p.js"),import("./worker-preview-readiness-ye6cvg3k.js"),import("fs")]),i=AbortSignal.timeout(15000),s=null;try{y.mkdirSync(t,{recursive:!0,mode:448}),s=y.mkdtempSync(`${t}/probe-`);let[g,p,m]=await Promise.all([Promise.resolve().then(()=>c()).catch(()=>!1),l().catch(()=>!1),d(s,i).catch(()=>!1)]);return{t:"readiness",display_video:p&&await o().catch(()=>!1),lanes:{"automation.call.v1":g,"display.stream.v1":p,"preview.serve.v1":m,"tunnel.open":m,"tunnel.close":m}}}finally{if(s)y.rmSync(s,{recursive:!0,force:!0})}}async function _s(){let[{executeLocalOperation:t,spawnCaptured:c},{runLocalPtySession:l},{configureDesktopAccount:o,desktopAccount:d},{configureWorkerSandbox:y}]=await Promise.all([import("./local-capabilities-pmm1ghsh.js"),import("./local-pty-session-4h4ekakp.js"),import("./desktop-account-j6fjngt1.js"),import("./worker-sandbox-j6cmex8e.js")]);y();let i=process.argv.includes(ur),s=process.argv.includes(dr),g=(a,e,u)=>c(a,e[0]==="-lic"?["-lc",...e.slice(1)]:e,u),p=(process.geteuid?.()??0)!==0;if(s){p=!1;let a=process.argv.find((e)=>e.startsWith(Tt))?.slice(Tt.length);if((process.geteuid?.()??-1)===0&&a)try{p=o({value:a})!==null&&d()!==null}catch{p=!1}}let m=new Map,v=new Map,f=(a)=>{try{process.send?.(a)}catch{}};if(process.on("message",(a)=>{let e=a;if(e?.t==="cancel"){m.get(e.id)?.abort();return}if(e?.t==="control"){let n=v.get(e.id);if(s&&n&&e.control&&typeof e.control.kind==="string")import("./local-managed-process-qkagbzkt.js").then(({controlManagedDeviceProcess:_})=>_(n,{kind:e.control.kind,payload:e.control.payload??{}})).catch(()=>!1);return}if(e?.t==="retire"){if(s&&typeof e.operation_id==="string"&&typeof e.status==="string")import("./local-managed-process-qkagbzkt.js").then(({retireManagedDeviceProcess:n})=>n(e.operation_id,e.status)).catch(()=>!1);return}if(e?.t!=="op")return;if(!p){f({t:"done",id:e.id,completion:{status:"failed",error_code:"vm_hands_payload_account_unavailable"}});return}let u=e.claim.capability;if(u==="pty.start"&&!i){f({t:"done",id:e.id,completion:{status:"failed",error_code:"capability_not_granted"}});return}if(Ot.has(u)!==s){f({t:"done",id:e.id,completion:{status:"failed",error_code:"capability_not_granted"}});return}let w=new AbortController;m.set(e.id,w),v.set(e.id,e.claim);let S=u==="pty.start"?{runPtySession:(n)=>l(n,{spawnPty:A,environment:x(),loadProxy:()=>null})}:{worker:e.worker,...u==="exec.full"?{spawnFullControl:g}:{}};t(e.state,e.claim,{...S,signal:w.signal,emit:(n)=>{let{deliverySignal:_,...h}=n;f({t:"event",id:e.id,event:h})}}).then((n)=>f({t:"done",id:e.id,completion:n}),(n)=>f({t:"done",id:e.id,completion:{status:"failed",error_code:n&&typeof n==="object"&&"code"in n&&typeof n.code==="string"?n.code:"vm_hands_op_failed"}})).finally(()=>{m.delete(e.id),v.delete(e.id)})}),process.on("disconnect",()=>process.exit(0)),s){let a=process.argv.find((u)=>u.startsWith(Rt))?.slice(Rt.length),e={t:"readiness",display_video:!1,lanes:{}};f(p&&a?await E(a).catch(()=>e):e)}await new Promise(()=>{})}
|
|
3
|
+
export{ur,dr,Tt,Rt,Ot,_s};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{T}from"./vm-hands-entry-lite-fcvf8md1.js";import{basename as ln}from"path";var
|
|
3
|
-
export{
|
|
2
|
+
import{T}from"./vm-hands-entry-lite-fcvf8md1.js";import{basename as ln}from"path";var _t=["production","staging"],un="https://api.reasonmachines.com",fn="https://staging-api.reasonmachines.com";var A={production:{api:"https://api.reasonmachines.ai",app:"https://reasonmachines.ai"},staging:{api:"https://staging-api.reasonmachines.ai",app:"https://staging.reasonmachines.ai"}},gn=new Set(["ara-staging","ara-staging.exe","reason-staging","reason-staging.exe"]);function _(n={}){let e=T(n.env??process.env,"REASON_CLI_CHANNEL")?.trim().toLowerCase();if(e){if(_t.includes(e))return e;throw Error(`Unknown Reason CLI channel: ${e}`)}let r=ln(n.executablePath??process.execPath).toLowerCase();return gn.has(r)?"staging":"production"}function rr(n){return n==="staging"?fn:un}var U={production:["https://api.ara.so",A.production.api],staging:["https://api-staging.ara.so",A.staging.api]};function Xr(n){let e;try{e=new URL(n).origin}catch{return n}let r=_t.find((t)=>U[t].includes(e));return r?rr(r):e}function Mo(n,e){return n===e||Xr(n)===Xr(e)}function $o(n,e){return _t.some((r)=>U[r].includes(n)&&e===rr(r))}function Bo(n,e){try{let r=new URL(e);return!r.username&&!r.password&&(r.origin===rr(n)||r.origin===A[n].api)}catch{return!1}}function ti(n){try{let e=new URL(n).hostname.replace(/^\[|\]$/g,"").toLowerCase();return e==="localhost"||e==="127.0.0.1"||e==="::1"}catch{return!1}}import{randomBytes as J}from"crypto";import{chmodSync as q,closeSync as B,constants as bn,linkSync as V,lstatSync as w,mkdirSync as z,openSync as En,readdirSync as L,readFileSync as Wn,readlinkSync as v,renameSync as S,rmdirSync as Q,symlinkSync as N,unlinkSync as d}from"fs";import{createRequire as Nn}from"module";import{constants as Sn}from"os";import{basename as R,join as l,sep as kn}from"path";import{existsSync as O,lstatSync as j,readdirSync as pn,readFileSync as mn,readlinkSync as dn,realpathSync as yn}from"fs";import{join as m,sep as hn}from"path";function G(n,...e){let r=m(n,"ara"),t=m(n,"reason");if(!Yr(r))return m(t,...e);if(!O(t))return m(r,...e);return O(m(r,...e))&&!O(m(t,...e))?m(r,...e):m(t,...e)}function Yr(n){try{let e=j(n);if(!e.isSymbolicLink())return e.isDirectory();return dn(n)!=="reason"&&O(n)}catch{return!1}}function X(n,e=[]){if(!Yr(n))return!1;let r;try{r=[n,...pn(n,{withFileTypes:!0}).filter((t)=>t.isDirectory()).map((t)=>m(n,t.name))]}catch{return!1}return r.some((t)=>["connect","connect-once"].filter((i)=>!e.includes(m(t,i))).some((i)=>{let s=m(t,i,"worker.json");try{j(s)}catch{return!1}try{let a=JSON.parse(mn(s,"utf8"))?.stateDirectory;if(typeof a!=="string")return!0;let c=(o,u)=>o===u||o.startsWith(u+hn);return c(a,n)||c(M(a),M(n))}catch{return!0}}))}function M(n){try{return yn(n)}catch{return n}}var P=new Set(["credentials.json","local-device.json","local-device.revoked.json","local-device.auth-migration.json","local-device.json.registration-pending.json","local-daemon.json","local-daemon.json.workspaces.json","local-root-fingerprint-key.json","instances","workspaces"]),Z=new Set(["local-device.proxy.json"]),Cn=new Set(["local-device.key","local-device.binding"]),W=new Map;function yt(n,e,r){let t=l(n,"ara");if(process.platform==="win32"||/[/\\]\.reason-ssh[/\\][^/\\]+[/\\]installer-home[/\\]\.config$/.test(n))return{state:p(t)?.isDirectory()?"kept":"absent"};return vn(t,l(n,"reason"),{linkAlways:!0,kept:(i)=>X(i,r??[]),native:e===void 0?An:()=>e},r!==void 0)}function ke(n,...e){return yt(n),G(n,...e)}var nn="config_rename_unavailable:busy";function vn(n,e,r,t=!1){let i=t?void 0:W.get(n);if(i)return i;let s;try{s=_n(n,e,r)}catch(a){let c=`config_rename_unavailable:${b(a)??"failed"}`;try{return{state:p(n)?.isDirectory()?"kept":"absent",problem:c}}catch{return{state:"kept",problem:c}}}if(!(s.state==="absent"&&r.linkAlways)&&s.problem!==nn&&!(s.state==="kept"&&!s.problem))W.set(n,s);return s}function _n(n,e,r){wn(e,r.native);let t=!1;for(let i=0;i<8;i+=1){let s=p(n);if(s?.isSymbolicLink())return v(n)===R(e)?{state:t?"renamed":"linked"}:{state:"kept"};if(!s){if(D(e))f(()=>d(e),"ENOENT");if(!(t||r.linkAlways)||!x(e))return{state:"absent"};let o=C(e,"link");N(R(e),o);try{f(()=>S(o,n),"EISDIR","ENOTEMPTY","EEXIST","ENOTDIR")}finally{f(()=>d(o),"ENOENT")}continue}if(!s.isDirectory())return{state:"absent"};if(r.kept(n))return K(e),{state:"kept"};let a=r.native();if(!a)return K(e),{state:"kept",problem:"config_rename_unavailable:no_native"};let c=In(a,n);if(!c)return{state:"kept",problem:nn};try{if(w(n).isSymbolicLink())continue;let o=Rn(a,n,e);if(o)return{state:"kept",problem:o};t=!0}finally{c()}}throw Object.assign(Error("legacy directory rename did not settle"),{code:"unsettled"})}function Rn(n,e,r){let t=p(r);if(!t||D(r)){if(!t)N(R(r),r);try{n.exchange(e,r)}catch(o){if(D(r))f(()=>d(r),"ENOENT");return`config_rename_unavailable:${b(o)??"exchange_failed"}`}return null}if(!t.isDirectory())return"config_rename_unavailable:ENOTDIR";if(t.dev!==w(e).dev)return"config_rename_unavailable:EXDEV";let i=[C(r,"probe"),C(r,"probe")];try{N("a",i[0]),N("b",i[1]),n.exchange(i[0],i[1])}catch(o){return`config_rename_unavailable:${b(o)??"exchange_failed"}`}finally{for(let o of i)f(()=>d(o),"ENOENT")}let s=cn(r);for(let o of Cn){let u=p(l(r,o)),g=p(l(e,o));if(u&&g&&u.ino!==g.ino)z(`${s}-replaced`,{mode:448,recursive:!0}),S(l(r,o),l(`${s}-replaced`,o))}let a={linked:new Map,unitsKept:new Set};rn(e,r,"",a);let c=C(r,"rename");N(R(r),c);try{n.exchange(e,c)}catch(o){return f(()=>d(c),"ENOENT"),`config_rename_unavailable:${b(o)??"exchange_failed"}`}return tn(c,r,a,s),null}function en(n){return n===""||!n.includes(kn)}function rn(n,e,r,t){let i=en(r)&&sn(l(e,r),l(n,r));if(i)t.unitsKept.add(r);for(let s of L(l(n,r))){if(i&&(P.has(s)||Z.has(s)))continue;let a=l(r,s),c=l(n,a),o=l(e,a),u=p(c);if(!u)continue;let g=p(o);if(u.isDirectory()){if(!g)f(()=>z(o,{mode:u.mode&4095}),"EEXIST"),q(o,u.mode&4095);if(x(o))rn(n,e,a,t)}else if(!g){if(u.isSymbolicLink())f(()=>N(v(c),o),"EEXIST");else if(f(()=>V(c,o),"EEXIST","ENOENT"))t.linked.set(a,u.ino)}}}function wn(n,e){let r;try{if(!x(n))return;r=L(n)}catch{return}for(let t of r){let i=/^\.(rename|link|probe|claim)-(\d+)-[0-9a-f]+$/.exec(t);if(!i)continue;let s=l(n,t),a=p(s);if(!a)continue;if(!a.isDirectory()){if(!Y(Number(i[2])))f(()=>d(s),"ENOENT");continue}let c=e(),o=null;if(c){try{o=c.lock(s)}catch{continue}if(!o)continue}else if(Y(Number(i[2])))continue;try{let u=C(n,"claim");if(f(()=>S(s,u),"ENOENT"))tn(u,n,null,cn(n))}finally{o?.()}}}function tn(n,e,r,t){for(let[i,s]of r?.linked??[])if(!p(l(n,i))&&p(l(e,i))?.ino===s)f(()=>d(l(e,i)),"ENOENT");if(on(n,e,"",r),f(()=>Q(n),"ENOTEMPTY","EEXIST"))return;S(n,t),q(t,448)}function on(n,e,r,t){let i=en(r)&&(t?t.unitsKept.has(r):sn(l(e,r),l(n,r)));for(let s of L(l(n,r))){let a=l(r,s),c=l(n,a),o=l(e,a),u=w(c),g=p(o);if(g&&u.ino===g.ino&&u.dev===g.dev){d(c);continue}if(u.isFile()&&g?.isFile()&&t?.linked.get(a)===g.ino){S(c,o);continue}if(i&&(P.has(s)||Z.has(s)))continue;if(!g){if(u.isFile()){if(f(()=>V(c,o),"EEXIST"))d(c)}else f(()=>S(c,o),"EEXIST","ENOTEMPTY");continue}if(u.isDirectory()&&g.isDirectory())on(n,e,a,t),f(()=>Q(c),"ENOTEMPTY","EEXIST")}}function sn(n,e){for(let r of P)if(an(l(n,r),l(e,r)))return!0;return!1}function an(n,e){let r=p(n);if(!r)return!1;let t=p(e);if(!t)return!0;if(r.isDirectory()){if(!t.isDirectory())return!0;return L(n).some((i)=>an(l(n,i),l(e,i)))}if(r.isSymbolicLink())return!t.isSymbolicLink()||v(n)!==v(e);return r.ino!==t.ino||r.dev!==t.dev}function K(n){if(D(n))f(()=>d(n),"ENOENT")}function cn(n){return l(n,`.pre-rename-${new Date().toISOString().replace(/[:.]/g,"-")}-${J(3).toString("hex")}`)}function D(n){try{return w(n).isSymbolicLink()&&v(n)===R(n)}catch{return!1}}function x(n){let e=p(n);return e!==null&&e.isDirectory()}function In(n,e){for(let r=0;r<40;r+=1){let t=n.lock(e);if(t)return t;Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,50)}return null}function C(n,e){return l(n,`.${e}-${process.pid}-${J(6).toString("hex")}`)}function Y(n){if(n===process.pid)return!1;try{return process.kill(n,0),!0}catch(e){return b(e)==="EPERM"}}function p(n){try{return w(n)}catch(e){if(b(e)==="ENOENT"||b(e)==="ENOTDIR")return null;throw e}}function f(n,...e){try{return n(),!0}catch(r){if(e.includes(b(r)??""))return!1;throw r}}function b(n){return n instanceof Error&&"code"in n&&typeof n.code==="string"?n.code:void 0}var k,On=2,Dn=4,Ln=2,Tn=2,H=-100;function An(){if(k!==void 0)return k;if(k=null,process.platform!=="linux"&&process.platform!=="darwin")return null;let n;try{n=Nn(import.meta.url)("bun:ffi")}catch{return null}let e=process.platform==="darwin",r=e?"__error":"__errno_location",t=e?["/usr/lib/libSystem.B.dylib"]:["libc.so.6",`libc.musl-${process.arch==="arm64"?"aarch64":"x86_64"}.so.1`],{FFIType:i}=n;for(let s of t)try{let a=e?"renamex_np":"renameat2",o=n.dlopen(s,{flock:{args:[i.i32,i.i32],returns:i.i32},[r]:{args:[],returns:i.ptr},[a]:e?{args:[i.ptr,i.ptr,i.u32],returns:i.i32}:{args:[i.i32,i.ptr,i.i32,i.ptr,i.u32],returns:i.i32}}).symbols,u=o[r]();if(u===null)continue;let g=(E)=>{let h=n.read.i32(u),y=Object.entries(Sn.errno).find(([,I])=>I===h)?.[0]??`errno_${h}`;return Object.assign(Error(`${E} failed: ${y}`),{code:y})},F=(E)=>Buffer.from(`${E}\x00`,"utf8");return k={exchange(E,h){let y=F(E),I=F(h);if((e?o[a](n.ptr(y),n.ptr(I),Ln):o[a](H,n.ptr(y),H,n.ptr(I),Tn))!==0)throw g("exchange")},lock(E){let h=En(E,bn.O_RDONLY);if(o.flock(h,On|Dn)===0)return()=>B(h);let y=g("lock");if(B(h),y.code==="EWOULDBLOCK"||y.code==="EAGAIN")return null;throw y}},k}catch{}return null}
|
|
3
|
+
export{_t,_,rr,Xr,Mo,$o,Bo,ti,Yr,yt,ke};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{We,fo,F,Ve,Ut,Rr,x}from"./vm-hands-entry-lite-
|
|
2
|
+
import{We,fo,F,Ve,Ut,Rr,x}from"./vm-hands-entry-lite-j93dy26a.js";import{K}from"./vm-hands-entry-lite-wx1fmrbs.js";import{pt}from"./vm-hands-entry-lite-1nrxnm0y.js";import{gt}from"./vm-hands-entry-lite-y1p3s68r.js";import{Or}from"./vm-hands-entry-lite-66tve5yn.js";import{Pt,ji}from"./vm-hands-entry-lite-148nz8be.js";import{G,qe}from"./vm-hands-entry-lite-r27j00db.js";import{xe,Kn}from"./vm-hands-entry-lite-8hqx9acp.js";import{St}from"./vm-hands-entry-lite-ydgedg8n.js";import{a}from"./vm-hands-entry-lite-0sh835na.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{C}from"./vm-hands-entry-lite-qz74j563.js";import{spawn as R,spawnSync as st}from"child_process";import{createHash as it,randomUUID as ge}from"crypto";import{closeSync as at,copyFileSync as ae,existsSync as M,fstatSync as ct,mkdirSync as ce,openSync as lt,readdirSync as U,readFileSync as X,readlinkSync as ut,renameSync as he,rmSync as dt,statSync as mt,writeFileSync as ft}from"fs";import{connect as ht}from"net";import{tmpdir as L,userInfo as we}from"os";import{basename as le,delimiter as wt,dirname as B,join as f}from"path";var z=`import { spawn, execFileSync } from "node:child_process";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { readFileSync, readlinkSync, lstatSync, realpathSync, statSync, mkdtempSync, mkdirSync, chmodSync, writeFileSync, readdirSync, rmSync, openSync, readSync, closeSync, renameSync } from "node:fs";
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
@@ -856,5 +856,5 @@ if(process.env.REASON_CLOUD_GATEWAY_EXEC === "1") {
|
|
|
856
856
|
}
|
|
857
857
|
`;import{spawn as Te}from"child_process";import{lstatSync as V,readFileSync as Z,rmSync as Ne}from"fs";import{basename as Pe}from"path";var De="__desktop-call",Me="/usr/bin/setpriv",Ue=27262976,Le=8192,$e=2000;function W(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function Be(e){try{return JSON.parse(e)}catch{return null}}function Fe(){return[process.execPath,...Pe(process.execPath).startsWith("bun")&&process.argv[1]?[process.argv[1]]:[],De]}function Ge(e){let o=(i)=>{try{return V(i).uid}catch{return null}},t=V("/tmp/.X11-unix",{throwIfNoEntry:!1});if(!t?.isDirectory()||t.uid!==0)return;let n=["/tmp/.X99-lock","/tmp/.X11-unix/X99"].filter((i)=>{let u=o(i);return u!==null&&u!==e.uid});if(!n.length)return;let s="";try{let i=Z("/tmp/.X99-lock","utf8").trim();if(/^\d+$/.test(i))s=Z(`/proc/${i}/comm`,"utf8").trim()}catch{}if(/^X/.test(s))return;for(let i of n)Ne(i,{force:!0})}function Bt(e,o,t,n={}){if(t.throwIfAborted(),(o.op==="display"||o.op==="automation")&&process.platform==="linux"&&process.getuid?.()===0)try{Ge(e)}catch{}let s=n.command??Fe();return new Promise((i,u)=>{let c=(n.spawnProcess??Te)(Me,[`--reuid=${e.uid}`,`--regid=${e.gid}`,"--clear-groups","--no-new-privs","--",...s],{cwd:e.home,detached:!0,stdio:["pipe","pipe","pipe"],env:{HOME:e.home,USER:e.username,LOGNAME:e.username,PATH:"/usr/local/bin:/usr/bin:/bin"}}),d=[],m=0,l="",p=null,g=!1,w,h=(y)=>{try{process.kill(-c.pid,y)}catch{c.kill(y)}},I=(y)=>{p??=y,h("SIGTERM"),w??=setTimeout(()=>h("SIGKILL"),$e)},S=()=>I(new r("cancelled","Reason cancelled the desktop operation."));t.addEventListener("abort",S,{once:!0});let _=(y)=>{if(g)return;g=!0,clearTimeout(w),t.removeEventListener("abort",S),y()};if(c.stdout.on("data",(y)=>{if(m+=y.byteLength,m>Ue)I(new r("desktop_delegate_failed","Reason's desktop reply is too large."));else d.push(y)}),c.stderr.setEncoding("utf8").on("data",(y)=>{l=(l+y).slice(-Le)}),c.stdin.on("error",()=>{}),c.once("error",()=>_(()=>u(p??new r("desktop_delegate_unavailable","Reason could not start its desktop as the desktop account.")))),c.once("close",(y,Ee)=>_(()=>{if(p)return u(p);let b=Be(Buffer.concat(d).toString("utf8"));if(W(b)&&b.ok===!0&&W(b.result))return i(b.result);let O=W(b)&&b.ok===!1&&typeof b.code==="string"&&typeof b.message==="string"?new r(b.code.slice(0,120),b.message.slice(0,2000)):null,J=`exited ${y??Ee}${O?"":" with no reply"}`,Y=l.trim().split(`
|
|
858
858
|
`).at(-1)?.slice(-300)??"";if(!O||O.code==="desktop_delegate_failed")process.stderr.write(`Reason worker: desktop call ${J}${l?`: ${l.trim().slice(-500)}`:""}
|
|
859
|
-
`);if(O)return u(O);u(new r("desktop_delegate_failed",`Reason's desktop operation failed (${J}${Y?`: ${Y}`:""}).`))})),t.aborted)S();c.stdin.end(JSON.stringify(o))})}async function Q(e,o,t,n={}){let s=await Bt(e,{op:"automation",call:o},t,n);if(!Number.isSafeInteger(s.code)||typeof s.stdout!=="string"||typeof s.stderr!=="string")throw new r("desktop_delegate_failed","Reason's desktop reply is malformed.");return{code:s.code,stdout:Buffer.from(s.stdout,"base64"),stderr:s.stderr}}import{execFile as He,spawn as je}from"child_process";import{closeSync as Xe,mkdirSync as Ke,openSync as Je}from"fs";import{dirname as E,join as Ye}from"path";import{promisify as ze}from"util";var Ze=ze(He),ee="x-apple.systempreferences:com.apple.preference.security",Qe={accessibility:`${ee}?Privacy_Accessibility`,screen:`${ee}?Privacy_ScreenCapture`},et=64,A=new Map;function T(e,o){let t=A.get(e);if(t?.has(o))return!1;if(!t){if(A.size>=et)A.delete(A.keys().next().value);t=new Set,A.set(e,t)}return t.add(o),!0}function tt(){let e=a(),o=Kn(xe(e),process.env),t=Ye(e,".local","share","reason","desktop-install.log");Ke(E(t),{recursive:!0,mode:448});let n=Je(t,"a",384);try{let s=je(o,["desktop","install"],{detached:!0,stdio:["ignore",n,n],env:{...process.env,REASON_DESKTOP_BACKGROUND:"1"}});s.on("error",()=>{return}),s.unref()}finally{Xe(n)}}var N={open:async(e,o)=>{await Ze("/usr/bin/open",e,{signal:o,timeout:1e4,maxBuffer:8192})},request:(e,o)=>dt(e,o),tile:Or,installDesktop:tt},te=!1;async function oe(e,o,t){try{await o.open(["-a","Google Chrome",e],t)}catch{t.throwIfAborted(),await o.open([e],t)}}async function ne(e,o,t,n){if(await t.open([Qe[o]],n).catch(()=>{}),e[0]&&!n.aborted)t.tile(E(E(E(e[0]))),o)}async function ot(e,o,t,n,s){for(let i of t){if(!T(e,`grant:${i}`))continue;s.throwIfAborted(),await n.request(o,i).catch(()=>null),await ne(o,i,n,s)}}var rt={name:"open_tab",description:"Open a web page in the user's own Chrome on this Mac. Reason cannot read, screenshot or click in that tab, and no tab_id is returned: browser control needs Reason's Chrome extension. An actual browser call opens its setup page.",inputSchema:{type:"object",properties:{url:{type:"string",description:"An http or https URL."}},required:["url"],additionalProperties:!1}};function re(e){return{code:0,stderr:"",stdout:Buffer.from(JSON.stringify({ok:!0,...e}))}}function nt(e){if(typeof e!=="string")return null;try{let o=new URL(e);return o.protocol==="https:"||o.protocol==="http:"?o.href:null}catch{return null}}async function se(e,o=N){let{call:t,runId:n,signal:s}=e;if(t.kind==="browser"){if(t.operation==="discover")return re({result:{tools:[rt]}});if(t.operation!=="call")throw new r("automation_browser_setup_required","Browser control is not set up on this Mac yet. Request a browser operation or connect Chrome from Reason to set it up.")}if(e.desktopMissing&&!te){te=!0;try{o.installDesktop()}catch{}}if(t.kind==="computer"){if(e.identity.length>0&&T(n,"grant:probe")){let c=await o.request(e.identity).catch(()=>null),d=c?[...c.accessibility?[]:["accessibility"],...c.screen?[]:["screen"]]:[];for(let m of d)T(n,`grant:${m}`);for(let m of d)await ne(e.identity,m,o,s)}throw new r("automation_computer_setup_required","Computer use is not set up on this Mac yet; Reason asked macOS for any missing permission.")}if(T(n,"page:chrome-extension"))await oe(fo,o,s).catch(()=>{});let i=t.arguments,u=t.operation==="call"&&t.tool==="open_tab"&&i&&typeof i==="object"&&!Array.isArray(i)?nt(i.url):null;if(!u)throw new r("automation_browser_setup_required","Browser control is not set up on this Mac yet; Reason opened its Chrome Web Store page. open_tab still opens pages.");return await oe(u,o,s),re({result:{content:[{type:"text",text:JSON.stringify({opened:u,browser:"the user's Chrome",controllable:!1,note:"Opened for the user to see. Reason cannot read or act in this tab until Reason's Chrome extension is added (its Chrome Web Store page is open)."})}]}})}async function ie(e,o=N){if(e.call.kind!=="computer"||e.call.operation!=="permission_status"||e.output.code!==0||e.identity.length===0)return e.output;let t;try{t=JSON.parse(e.output.stdout.toString("utf8"))}catch{return e.output}if(!t||typeof t!=="object"||Array.isArray(t))return e.output;let n=t.permissions;if(!n||typeof n!=="object")return e.output;let s=n,i=[...s.accessibility==="missing"?["accessibility"]:[],...s.screenRecording==="missing"?["screen"]:[]];if(i.length===0)return e.output;return await ot(e.runId,e.identity,i,o,e.signal),{...e.output,stdout:Buffer.from(JSON.stringify({...t,requested:i}))}}var j=172032,_t=18874368,yt=8192,bt=65536,St=55000,xt=60000,kt=4,Rt=40000,It=/^[0-9a-f-]{36}$/,ue=z,Ot=ge();function P(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function D(){throw new r("invalid_automation_request","Reason automation request is malformed.")}function _e(e){let o=Object.keys(e).sort().join(",");if(o==="call"||o==="browser,call"){let t=e.call,n=o==="browser,call";if(!P(t)||t.version!==1||t.kind!=="computer"&&t.kind!=="browser"||n&&(e.browser!==vt||t.kind!=="browser")||JSON.stringify(t).length>bt)D();return{call:t,userChrome:n}}if(o==="offset,output_id"){if(typeof e.output_id!=="string"||!It.test(e.output_id)||!Number.isSafeInteger(e.offset)||e.offset<0)D();return{output_id:e.output_id,offset:e.offset}}return D()}function Pn(e=process.platform,o=x){if(e==="darwin")return!0;return(e==="linux"||e==="win32")&&o()?.features.computer===!0}var Et="__computer-use";function Fs(e=x){return e()?.userChrome??{code:"user_chrome_browser_use_missing"}}function ye(e,o,t,n){return new Promise((s)=>{let i=R(e,o,{env:t,stdio:"ignore",windowsHide:!0}),u=setTimeout(()=>{i.kill("SIGKILL"),s(-1)},n);i.once("error",()=>{clearTimeout(u),s(-1)}),i.once("exit",(c)=>{clearTimeout(u),s(c??-1)})})}function Ct(e,o,t,n){return new Promise((s)=>{let i=R(e,o,{env:t,stdio:["ignore","pipe","ignore"],windowsHide:!0}),u="";i.stdout.setEncoding("utf8").on("data",(d)=>{u+=d});let c=setTimeout(()=>{i.kill("SIGKILL"),s(null)},n);i.once("error",()=>{clearTimeout(c),s(null)}),i.once("close",(d)=>{clearTimeout(c),s(d===0?u:null)})})}function Tt(e){return v(e)?f(L(),"open-browser-use"):"/tmp/open-browser-use"}function v(e){return e.platform==="win32-x64"||e.platform==="win32-arm64"}var Nt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,Pt=33554432;function Dt(e,o){let t;try{t=e===null?null:JSON.parse(e)}catch{return null}let n=P(t)&&P(t.result)?t.result.metadata:null;if(!P(n)||n.extensionId!==o)return null;return typeof n.extensionInstanceId==="string"&&Nt.test(n.extensionInstanceId)?n.extensionInstanceId:null}async function be(e,o,t){let n=t.storages.map((c)=>{try{return U(c).filter((d)=>d.endsWith(".log")||d.endsWith(".ldb")).map((d)=>f(c,d))}catch{return[]}}),s;try{s=n.some((c)=>c.length>0)?U(t.socketDir).filter((c)=>c.endsWith(".sock")):[]}catch{return[]}let i=[];for(let c of s){let d=f(t.socketDir,c),m=Dt(await Ct(e,["info","--socket",d,"--timeout","2s"],o,5000),t.extensionId);if(m)i.push({instance:m,socket:d})}let u=[];for(let[c,d]of(i.length>0?n:[]).entries())for(let m of d)try{if(ft(m).size>Pt)continue;let l=X(m),p=i.find((g)=>l.includes(g.instance));if(p){u.push({storage:t.storages[c],...p});break}}catch{}return u}async function Mt(e,o,t){return(await be(e,o,t))[0]?.instance??null}function Se(e,o,t){return Mt(e.nativeHost,o,{socketDir:Tt(e),extensionId:F,storages:[f(t,"browser-profile","Default","Local Extension Settings",F)]})}var de=/^(Default|Profile ([0-9]+))$/;async function Lt(e,o,t=a(),n=Ut){let s=f(t,"Library","Application Support","Google","Chrome"),i=[];try{i=U(s)}catch(l){if(l.code==="EPERM")throw new r("browser_use_chrome_access_denied","macOS blocked Reason from reading Chrome's profiles. Allow Full Disk Access for Reason on this Mac and try again.")}let u=(l)=>Number(de.exec(l)?.[2]??-1),c=i.filter((l)=>de.test(l)&&M(f(s,l,"Extensions",We))).sort((l,p)=>u(l)-u(p)),d=(l)=>f(s,l,"Local Extension Settings",We);return(await be(e,o,{socketDir:n,extensionId:We,storages:c.map(d)})).map(({storage:l,instance:p,socket:g})=>({profile:c.find((w)=>d(w)===l),instance:p,socket:g}))}async function $t(e,o,t=a(),n=Ut){let s=(await Lt(e,o,t,n))[0]?.instance;if(!s)throw new r("automation_user_chrome_not_connected","No Chrome profile on this Mac is connected to Reason. Open Chrome with the Reason extension, then try again.");return s}function pe(e){return new Promise((o)=>{let t=ht({path:e}),n=(s)=>{t.destroy(),o(s)};t.setTimeout(1000,()=>n(!1)),t.once("error",()=>n(!1)),t.once("connect",()=>n(!0))})}async function ke(e,o){let t=Date.now()+o;while(Date.now()<t){if(await e())return!0;await new Promise((n)=>setTimeout(n,200))}return!1}var q=new Map;function H(e,o){let t=q.get(e);if(!t)t=o().finally(()=>q.delete(e)),q.set(e,t);return t}async function Wt(e,o){if(await pe(e))return;if(pt(e,{force:!0}),await ye("dbus-daemon",["--session",`--address=unix:path=${e}`,"--fork"],o,1e4)!==0||!await ke(()=>pe(e),5000))throw new r("automation_unavailable","Reason could not start the desktop session bus.")}async function me(e,o,t){let n=e.platform==="darwin-arm64"||v(e)?async()=>await Se(e,o,t)!==null:async()=>await ye(e.nativeHost,["info"],o,5000)===0;if(await n())return;let s=["--profile-directory=Default",`--load-extension=${e.extensionDir}`,"--no-first-run","--no-default-browser-check","--window-size=1280,800","about:blank"],i,u=null,c=0;if(e.platform==="darwin-arm64"){let l=f(t,"browser-profile");G(l);let p=f(l,"NativeMessagingHosts");ce(p,{recursive:!0,mode:448});let g=Rr(e.platform).nativeHostManifests[0];ae(g,f(p,le(g)));let w=e.browser.slice(0,e.browser.indexOf(".app/")+4),h=s.filter((I)=>I!=="about:blank").concat("--no-startup-window","--use-mock-keychain");i=R("/usr/bin/open",["-g","-n","-a",w,"--args",`--user-data-dir=${l}`,...h],{env:o,stdio:"ignore"})}else if(v(e)){let l=f(t,"browser-profile");G(l),st(C("icacls"),[B(e.browser),"/grant","*S-1-15-2-1:(OI)(CI)(RX)","*S-1-15-2-2:(OI)(CI)(RX)"],{stdio:"ignore",windowsHide:!0,timeout:60000});let p=s.filter((g)=>g!=="about:blank").concat("--no-startup-window","--keep-alive-for-test");i=R(e.browser,[`--user-data-dir=${l}`,...p],{detached:!0,stdio:"ignore",env:o})}else{let l=f(o.HOME,".config","google-chrome"),p=f(l,"NativeMessagingHosts");ce(p,{recursive:!0,mode:448});let g=Rr(e.platform).nativeHostManifests[0];ae(g,f(p,le(g)));let w=process.geteuid?.()===0?["--no-sandbox"]:[];u=f(t,"browser.log");let h=lt(u,"a",384);c=ct(h).size,i=R(e.browser,[`--user-data-dir=${l}`,...s,...w,"--force-renderer-accessibility"],{detached:!0,stdio:["ignore",h,h],env:{...o,ACCESSIBILITY_ENABLED:"1"}}),at(h)}let d=!1;i.once("error",()=>{d=!0}),i.once("exit",(l)=>{d||=l!==0}),i.unref();let m=!1;if(await ke(async()=>d||(m=await n()),Rt),!m){if(u&&X(u).subarray(c).toString("utf8").includes("No usable sandbox"))throw new r("automation_browser_sandbox_unavailable","Chromium found no usable sandbox on this machine. Run the worker as a non-root user with unprivileged user namespaces enabled, or in a container with seccomp unconfined.");throw new r("automation_browser_unavailable","Reason could not connect the desktop browser.")}}async function js(e){await ve(e,!0)}function Us(e){return Re(e,Ie(e))}function Re(e,o){return e.platform==="darwin-arm64"||v(e)?f(o,"browser-profile"):f(o,"home",".config","google-chrome")}function Ie(e){let o=f(e.root,"automation");if(!M(o)||!qt(e.automation))return e.automation;if(!Ft(Re(e,o)))try{he(o,e.automation)}catch{}return M(o)?o:e.automation}function qt(e){try{return U(e).length===0}catch(o){return o.code==="ENOENT"}}function Ft(e){let o;try{o=ut(f(e,"SingletonLock"))}catch{return!1}let t=Number(o.slice(o.lastIndexOf("-")+1));if(!Number.isSafeInteger(t)||t<=0)return!0;try{return process.kill(t,0),!0}catch(n){return n.code==="EPERM"}}async function ve(e,o){At({root:e.root,automation:e.automation,extensionDir:e.extensionDir});let t=Ie(e);G(t);let n=we().username,s={USER:n,LOGNAME:n,REASON_AUTOMATION_OCU:e.ocu,REASON_AUTOMATION_OBU:e.nativeHost};if(e.platform==="darwin-arm64"||v(e)){let l=v(e)?{...s,...Gt(),HOME:a()}:{...s,HOME:a(),PATH:`${B(e.node)}:/usr/bin:/bin:/usr/sbin:/sbin`,REASON_AUTOMATION_OCU:process.execPath,REASON_AUTOMATION_OCU_SUBCOMMAND:Et};if(!o)return l;await H("browser",()=>me(e,l,t));let p=await Se(e,l,t);if(!p)throw new r("automation_browser_unavailable","Reason could not connect the desktop browser.");return{...l,REASON_AUTOMATION_OBU_INSTANCE:p,REASON_AUTOMATION_BACKGROUND_TABS:"1"}}let i=await qe(),u=f(t,"home"),c=f(t,"runtime");G(u),G(c);let d=f(t,"bus"),m={...s,HOME:u,PATH:`${B(e.node)}:/usr/bin:/bin`,DISPLAY:i.display,XAUTHORITY:i.xauthority,XDG_RUNTIME_DIR:c,DBUS_SESSION_BUS_ADDRESS:`unix:path=${d}`,...i.sound?{PULSE_SERVER:Ve(i.sound)}:{}};if(await H("bus",()=>Wt(d,m)),o)await H("browser",()=>me(e,m,t));return m}function Gt(){let e=process.env.SystemRoot??"C:\\Windows",o=Object.fromEntries(["SystemDrive","USERPROFILE","LOCALAPPDATA","APPDATA","ProgramData","ProgramFiles","PATHEXT","ComSpec","USERNAME","USERDOMAIN","COMPUTERNAME","NUMBER_OF_PROCESSORS","PROCESSOR_ARCHITECTURE","PSModuleAnalysisCachePath"].flatMap((n)=>process.env[n]?[[n,process.env[n]]]:[])),t=f(e,"System32");return{...o,SystemRoot:e,windir:e,TEMP:L(),TMP:L(),PATH:[t,f(t,"WindowsPowerShell","v1.0"),e].join(wt)}}async function Ht(e,o,t){let n=we().username,s={USER:n,LOGNAME:n,HOME:a(),PATH:`${B(e.node)}:/usr/bin:/bin:/usr/sbin:/sbin`,REASON_AUTOMATION_OBU:o,REASON_AUTOMATION_BACKGROUND_TABS:"1"},i=await $t(o,s);return t.throwIfAborted(),{...s,REASON_AUTOMATION_OBU_INSTANCE:i}}function jt(e){if(process.platform!=="win32")return["--input-type=module","--eval",e];let o=f(L(),`reason-automation-${it("sha256").update(e).digest("hex").slice(0,16)}.mjs`);if(!M(o)||X(o,"utf8")!==e){let t=`${o}.${process.pid}.tmp`;gt(t,e,{mode:384}),he(t,o)}return[o]}function Oe(e,o,t,n){if(typeof ue!=="string")return Promise.reject(new r("automation_unavailable","This Reason build has no automation runtime."));let s=ue;return new Promise((i,u)=>{let c=R(e,jt(s),{env:{...o,REASON_CLOUD_GATEWAY_EXEC:"1",REASON_AUTOMATION_INLINE_RESULT:"1"},stdio:["pipe","pipe","pipe"],detached:process.platform!=="win32",windowsHide:!0}),d=[],m=0,l="",p=null,g=!1,w=(_)=>{if(p??=_,process.platform==="win32"&&c.pid){R(f(process.env.SystemRoot??"C:\\Windows","System32","taskkill.exe"),["/pid",String(c.pid),"/t","/f"],{stdio:"ignore",windowsHide:!0}).once("error",()=>c.kill("SIGKILL"));return}try{process.kill(-c.pid,"SIGKILL")}catch{c.kill("SIGKILL")}},h=(_)=>{if(g)return;g=!0,clearTimeout(I),n.removeEventListener("abort",S),_()},I=setTimeout(()=>w(new r("automation_timed_out","Reason automation did not finish in time.")),St),S=()=>w(new r("cancelled","Reason cancelled the automation call."));if(n.addEventListener("abort",S,{once:!0}),c.stdout.on("data",(_)=>{if(m+=_.byteLength,m>_t)w(new r("automation_output_too_large","Reason automation output is too large."));else d.push(_)}),c.stderr.setEncoding("utf8").on("data",(_)=>{l=(l+_).slice(-yt)}),c.stdin.on("error",()=>{}),c.once("error",()=>h(()=>u(p??new r("automation_unavailable","Reason could not start the automation runtime.")))),c.once("close",(_)=>h(()=>{if(p)u(p);else i({code:_??1,stdout:Buffer.concat(d),stderr:l})})),n.aborted)S();c.stdin.end(t)})}var k=new Map;function Xt(e,o,t){for(let[s,i]of k)if(i.expiresAt<=t)k.delete(s);while(k.size>=kt)k.delete(k.keys().next().value);let n=ge();return k.set(n,{runId:e,bytes:o,expiresAt:t+xt}),n}async function Ae(e,o,t,n={}){let s=await(n.environment??ve)(e,o.kind==="browser");return t.throwIfAborted(),await(n.runtime??Oe)(e.node,s,JSON.stringify(o),t)}async function Hs(e,o){let t=_e({call:e});if(!("call"in t))D();let n=x();if(!n?.features.computer||t.call.kind==="browser"&&!n.features.browser)throw new r("automation_unavailable","Run `reason desktop install` on this machine to enable computer and browser use.");return await Ae(n,t.call,o)}function fe(e,o,t){let n=e.stdout.byteLength>j?Xt(o,e.stdout,t):void 0;return{code:e.code,stderr:e.stderr,instance_id:Ot,output_bytes:e.stdout.byteLength,chunk:e.stdout.subarray(0,j).toString("base64"),...n?{output_id:n}:{}}}async function Tn(e,o={}){let t=_e(e.payload),n=(o.now??Date.now)();if("output_id"in t){let h=k.get(t.output_id);if(!h||h.runId!==e.runId||h.expiresAt<=n||t.offset>h.bytes.byteLength)throw new r("automation_output_unavailable","Reason automation output expired.");return{chunk:h.bytes.subarray(t.offset,t.offset+j).toString("base64")}}let s=(o.components??x)(),i=(o.platform??process.platform)==="darwin",u=i?(o.macIdentity??mt)():[],c=o.macSetup??N,d=!s?.features.computer||t.call.kind==="browser"&&!t.userChrome&&!s.features.browser;if(i&&(d||u.length===0||t.call.kind==="browser"&&t.userChrome&&!e.userChrome))return fe(await se({runId:e.runId,call:t.call,identity:u,desktopMissing:d,signal:e.signal},c),e.runId,n);if(!s?.features.computer)throw new r("automation_unavailable","Run `reason desktop install` on this machine to enable computer and browser use.");let m=t.userChrome?e.userChrome:void 0;if(t.userChrome&&!m)throw new r("automation_user_chrome_unavailable","Your own Chrome is not enabled on this computer: run `reason desktop install` on this Mac (and `reason connect --user-chrome on` if you turned it off).");if(t.call.kind==="browser"&&!m&&!s.features.browser)throw new r("automation_browser_not_installed",!s.platform.startsWith("linux")?"Browser use is unavailable on this machine: re-run `reason desktop install`.":"Browser use is unavailable on this machine: install a non-snap Chromium at /usr/bin/chromium, then re-run `reason desktop install`.");e.signal.throwIfAborted();let l=t.call.kind==="browser"&&t.call.operation!=="record_start"&&t.call.operation!=="record_stop",p=await ji(e.runId,e.signal,o.now,l?"call":"run"),g="account"in o?o.account??null:K(),w;try{if(m){let h=await(o.userChromeEnvironment??Ht)(s,m,e.signal);e.signal.throwIfAborted(),w=await(o.runtime??Oe)(s.node,h,JSON.stringify(t.call),e.signal)}else if(g)w=await(o.delegate??Q)(g,t.call,e.signal);else w=await Ae(s,t.call,e.signal,o)}finally{p()}if(i)w=await ie({runId:e.runId,call:t.call,identity:u,output:w,signal:e.signal},c);return fe(w,e.runId,n)}
|
|
859
|
+
`);if(O)return u(O);u(new r("desktop_delegate_failed",`Reason's desktop operation failed (${J}${Y?`: ${Y}`:""}).`))})),t.aborted)S();c.stdin.end(JSON.stringify(o))})}async function Q(e,o,t,n={}){let s=await Bt(e,{op:"automation",call:o},t,n);if(!Number.isSafeInteger(s.code)||typeof s.stdout!=="string"||typeof s.stderr!=="string")throw new r("desktop_delegate_failed","Reason's desktop reply is malformed.");return{code:s.code,stdout:Buffer.from(s.stdout,"base64"),stderr:s.stderr}}import{execFile as He,spawn as je}from"child_process";import{closeSync as Xe,mkdirSync as Ke,openSync as Je}from"fs";import{dirname as E,join as Ye}from"path";import{promisify as ze}from"util";var Ze=ze(He),ee="x-apple.systempreferences:com.apple.preference.security",Qe={accessibility:`${ee}?Privacy_Accessibility`,screen:`${ee}?Privacy_ScreenCapture`},et=64,A=new Map;function T(e,o){let t=A.get(e);if(t?.has(o))return!1;if(!t){if(A.size>=et)A.delete(A.keys().next().value);t=new Set,A.set(e,t)}return t.add(o),!0}function tt(){let e=a(),o=Kn(xe(e),process.env),t=Ye(e,".local","share","reason","desktop-install.log");Ke(E(t),{recursive:!0,mode:448});let n=Je(t,"a",384);try{let s=je(o,["desktop","install"],{detached:!0,stdio:["ignore",n,n],env:{...process.env,REASON_DESKTOP_BACKGROUND:"1"}});s.on("error",()=>{return}),s.unref()}finally{Xe(n)}}var N={open:async(e,o)=>{await Ze("/usr/bin/open",e,{signal:o,timeout:1e4,maxBuffer:8192})},request:(e,o)=>pt(e,o),tile:Or,installDesktop:tt},te=!1;async function oe(e,o,t){try{await o.open(["-a","Google Chrome",e],t)}catch{t.throwIfAborted(),await o.open([e],t)}}async function ne(e,o,t,n){if(await t.open([Qe[o]],n).catch(()=>{}),e[0]&&!n.aborted)t.tile(E(E(E(e[0]))),o)}async function ot(e,o,t,n,s){for(let i of t){if(!T(e,`grant:${i}`))continue;s.throwIfAborted(),await n.request(o,i).catch(()=>null),await ne(o,i,n,s)}}var rt={name:"open_tab",description:"Open a web page in the user's own Chrome on this Mac. Reason cannot read, screenshot or click in that tab, and no tab_id is returned: browser control needs Reason's Chrome extension. An actual browser call opens its setup page.",inputSchema:{type:"object",properties:{url:{type:"string",description:"An http or https URL."}},required:["url"],additionalProperties:!1}};function re(e){return{code:0,stderr:"",stdout:Buffer.from(JSON.stringify({ok:!0,...e}))}}function nt(e){if(typeof e!=="string")return null;try{let o=new URL(e);return o.protocol==="https:"||o.protocol==="http:"?o.href:null}catch{return null}}async function se(e,o=N){let{call:t,runId:n,signal:s}=e;if(t.kind==="browser"){if(t.operation==="discover")return re({result:{tools:[rt]}});if(t.operation!=="call")throw new r("automation_browser_setup_required","Browser control is not set up on this Mac yet. Request a browser operation or connect Chrome from Reason to set it up.")}if(e.desktopMissing&&!te){te=!0;try{o.installDesktop()}catch{}}if(t.kind==="computer"){if(e.identity.length>0&&T(n,"grant:probe")){let c=await o.request(e.identity).catch(()=>null),d=c?[...c.accessibility?[]:["accessibility"],...c.screen?[]:["screen"]]:[];for(let m of d)T(n,`grant:${m}`);for(let m of d)await ne(e.identity,m,o,s)}throw new r("automation_computer_setup_required","Computer use is not set up on this Mac yet; Reason asked macOS for any missing permission.")}if(T(n,"page:chrome-extension"))await oe(fo,o,s).catch(()=>{});let i=t.arguments,u=t.operation==="call"&&t.tool==="open_tab"&&i&&typeof i==="object"&&!Array.isArray(i)?nt(i.url):null;if(!u)throw new r("automation_browser_setup_required","Browser control is not set up on this Mac yet; Reason opened its Chrome Web Store page. open_tab still opens pages.");return await oe(u,o,s),re({result:{content:[{type:"text",text:JSON.stringify({opened:u,browser:"the user's Chrome",controllable:!1,note:"Opened for the user to see. Reason cannot read or act in this tab until Reason's Chrome extension is added (its Chrome Web Store page is open)."})}]}})}async function ie(e,o=N){if(e.call.kind!=="computer"||e.call.operation!=="permission_status"||e.output.code!==0||e.identity.length===0)return e.output;let t;try{t=JSON.parse(e.output.stdout.toString("utf8"))}catch{return e.output}if(!t||typeof t!=="object"||Array.isArray(t))return e.output;let n=t.permissions;if(!n||typeof n!=="object")return e.output;let s=n,i=[...s.accessibility==="missing"?["accessibility"]:[],...s.screenRecording==="missing"?["screen"]:[]];if(i.length===0)return e.output;return await ot(e.runId,e.identity,i,o,e.signal),{...e.output,stdout:Buffer.from(JSON.stringify({...t,requested:i}))}}var j=172032,_t=18874368,yt=8192,bt=65536,xt=55000,kt=60000,Rt=4,It=40000,vt=/^[0-9a-f-]{36}$/,ue=z,Ot=ge();function P(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function D(){throw new r("invalid_automation_request","Reason automation request is malformed.")}function _e(e){let o=Object.keys(e).sort().join(",");if(o==="call"||o==="browser,call"){let t=e.call,n=o==="browser,call";if(!P(t)||t.version!==1||t.kind!=="computer"&&t.kind!=="browser"||n&&(e.browser!==St||t.kind!=="browser")||JSON.stringify(t).length>bt)D();return{call:t,userChrome:n}}if(o==="offset,output_id"){if(typeof e.output_id!=="string"||!vt.test(e.output_id)||!Number.isSafeInteger(e.offset)||e.offset<0)D();return{output_id:e.output_id,offset:e.offset}}return D()}function Pn(e=process.platform,o=x){if(e==="darwin")return!0;return(e==="linux"||e==="win32")&&o()?.features.computer===!0}var At="__computer-use";function Fs(e=x){return e()?.userChrome??{code:"user_chrome_browser_use_missing"}}function ye(e,o,t,n){return new Promise((s)=>{let i=R(e,o,{env:t,stdio:"ignore",windowsHide:!0}),u=setTimeout(()=>{i.kill("SIGKILL"),s(-1)},n);i.once("error",()=>{clearTimeout(u),s(-1)}),i.once("exit",(c)=>{clearTimeout(u),s(c??-1)})})}function Et(e,o,t,n){return new Promise((s)=>{let i=R(e,o,{env:t,stdio:["ignore","pipe","ignore"],windowsHide:!0}),u="";i.stdout.setEncoding("utf8").on("data",(d)=>{u+=d});let c=setTimeout(()=>{i.kill("SIGKILL"),s(null)},n);i.once("error",()=>{clearTimeout(c),s(null)}),i.once("close",(d)=>{clearTimeout(c),s(d===0?u:null)})})}function Ct(e){return v(e)?f(L(),"open-browser-use"):"/tmp/open-browser-use"}function v(e){return e.platform==="win32-x64"||e.platform==="win32-arm64"}var Tt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,Nt=33554432;function Dt(e,o){let t;try{t=e===null?null:JSON.parse(e)}catch{return null}let n=P(t)&&P(t.result)?t.result.metadata:null;if(!P(n)||n.extensionId!==o)return null;return typeof n.extensionInstanceId==="string"&&Tt.test(n.extensionInstanceId)?n.extensionInstanceId:null}async function be(e,o,t){let n=t.storages.map((c)=>{try{return U(c).filter((d)=>d.endsWith(".log")||d.endsWith(".ldb")).map((d)=>f(c,d))}catch{return[]}}),s;try{s=n.some((c)=>c.length>0)?U(t.socketDir).filter((c)=>c.endsWith(".sock")):[]}catch{return[]}let i=[];for(let c of s){let d=f(t.socketDir,c),m=Dt(await Et(e,["info","--socket",d,"--timeout","2s"],o,5000),t.extensionId);if(m)i.push({instance:m,socket:d})}let u=[];for(let[c,d]of(i.length>0?n:[]).entries())for(let m of d)try{if(mt(m).size>Nt)continue;let l=X(m),p=i.find((g)=>l.includes(g.instance));if(p){u.push({storage:t.storages[c],...p});break}}catch{}return u}async function Mt(e,o,t){return(await be(e,o,t))[0]?.instance??null}function Se(e,o,t){return Mt(e.nativeHost,o,{socketDir:Ct(e),extensionId:F,storages:[f(t,"browser-profile","Default","Local Extension Settings",F)]})}var de=/^(Default|Profile ([0-9]+))$/;async function Lt(e,o,t=a(),n=Ut){let s=f(t,"Library","Application Support","Google","Chrome"),i=[];try{i=U(s)}catch(l){if(l.code==="EPERM")throw new r("browser_use_chrome_access_denied","macOS blocked Reason from reading Chrome's profiles. Allow Full Disk Access for Reason on this Mac and try again.")}let u=(l)=>Number(de.exec(l)?.[2]??-1),c=i.filter((l)=>de.test(l)&&M(f(s,l,"Extensions",We))).sort((l,p)=>u(l)-u(p)),d=(l)=>f(s,l,"Local Extension Settings",We);return(await be(e,o,{socketDir:n,extensionId:We,storages:c.map(d)})).map(({storage:l,instance:p,socket:g})=>({profile:c.find((w)=>d(w)===l),instance:p,socket:g}))}async function $t(e,o,t=a(),n=Ut){let s=(await Lt(e,o,t,n))[0]?.instance;if(!s)throw new r("automation_user_chrome_not_connected","No Chrome profile on this Mac is connected to Reason. Open Chrome with the Reason extension, then try again.");return s}function pe(e){return new Promise((o)=>{let t=ht({path:e}),n=(s)=>{t.destroy(),o(s)};t.setTimeout(1000,()=>n(!1)),t.once("error",()=>n(!1)),t.once("connect",()=>n(!0))})}async function ke(e,o){let t=Date.now()+o;while(Date.now()<t){if(await e())return!0;await new Promise((n)=>setTimeout(n,200))}return!1}var q=new Map;function H(e,o){let t=q.get(e);if(!t)t=o().finally(()=>q.delete(e)),q.set(e,t);return t}async function Wt(e,o){if(await pe(e))return;if(dt(e,{force:!0}),await ye("dbus-daemon",["--session",`--address=unix:path=${e}`,"--fork"],o,1e4)!==0||!await ke(()=>pe(e),5000))throw new r("automation_unavailable","Reason could not start the desktop session bus.")}async function me(e,o,t){let n=e.platform==="darwin-arm64"||v(e)?async()=>await Se(e,o,t)!==null:async()=>await ye(e.nativeHost,["info"],o,5000)===0;if(await n())return;let s=["--profile-directory=Default",`--load-extension=${e.extensionDir}`,"--no-first-run","--no-default-browser-check","--window-size=1280,800","about:blank"],i,u=null,c=0;if(e.platform==="darwin-arm64"){let l=f(t,"browser-profile");G(l);let p=f(l,"NativeMessagingHosts");ce(p,{recursive:!0,mode:448});let g=Rr(e.platform).nativeHostManifests[0];ae(g,f(p,le(g)));let w=e.browser.slice(0,e.browser.indexOf(".app/")+4),h=s.filter((I)=>I!=="about:blank").concat("--no-startup-window","--use-mock-keychain");i=R("/usr/bin/open",["-g","-n","-a",w,"--args",`--user-data-dir=${l}`,...h],{env:o,stdio:"ignore"})}else if(v(e)){let l=f(t,"browser-profile");G(l),st(C("icacls"),[B(e.browser),"/grant","*S-1-15-2-1:(OI)(CI)(RX)","*S-1-15-2-2:(OI)(CI)(RX)"],{stdio:"ignore",windowsHide:!0,timeout:60000});let p=s.filter((g)=>g!=="about:blank").concat("--no-startup-window","--keep-alive-for-test");i=R(e.browser,[`--user-data-dir=${l}`,...p],{detached:!0,stdio:"ignore",env:o})}else{let l=f(o.HOME,".config","google-chrome"),p=f(l,"NativeMessagingHosts");ce(p,{recursive:!0,mode:448});let g=Rr(e.platform).nativeHostManifests[0];ae(g,f(p,le(g)));let w=process.geteuid?.()===0?["--no-sandbox"]:[];u=f(t,"browser.log");let h=lt(u,"a",384);c=ct(h).size,i=R(e.browser,[`--user-data-dir=${l}`,...s,...w,"--force-renderer-accessibility"],{detached:!0,stdio:["ignore",h,h],env:{...o,ACCESSIBILITY_ENABLED:"1"}}),at(h)}let d=!1;i.once("error",()=>{d=!0}),i.once("exit",(l)=>{d||=l!==0}),i.unref();let m=!1;if(await ke(async()=>d||(m=await n()),It),!m){if(u&&X(u).subarray(c).toString("utf8").includes("No usable sandbox"))throw new r("automation_browser_sandbox_unavailable","Chromium found no usable sandbox on this machine. Run the worker as a non-root user with unprivileged user namespaces enabled, or in a container with seccomp unconfined.");throw new r("automation_browser_unavailable","Reason could not connect the desktop browser.")}}async function js(e){await ve(e,!0)}function Us(e){return Re(e,Ie(e))}function Re(e,o){return e.platform==="darwin-arm64"||v(e)?f(o,"browser-profile"):f(o,"home",".config","google-chrome")}function Ie(e){let o=f(e.root,"automation");if(!M(o)||!qt(e.automation))return e.automation;if(!Ft(Re(e,o)))try{he(o,e.automation)}catch{}return M(o)?o:e.automation}function qt(e){try{return U(e).length===0}catch(o){return o.code==="ENOENT"}}function Ft(e){let o;try{o=ut(f(e,"SingletonLock"))}catch{return!1}let t=Number(o.slice(o.lastIndexOf("-")+1));if(!Number.isSafeInteger(t)||t<=0)return!0;try{return process.kill(t,0),!0}catch(n){return n.code==="EPERM"}}async function ve(e,o){Pt({root:e.root,automation:e.automation,extensionDir:e.extensionDir});let t=Ie(e);G(t);let n=we().username,s={USER:n,LOGNAME:n,REASON_AUTOMATION_OCU:e.ocu,REASON_AUTOMATION_OBU:e.nativeHost};if(e.platform==="darwin-arm64"||v(e)){let l=v(e)?{...s,...Gt(),HOME:a()}:{...s,HOME:a(),PATH:`${B(e.node)}:/usr/bin:/bin:/usr/sbin:/sbin`,REASON_AUTOMATION_OCU:process.execPath,REASON_AUTOMATION_OCU_SUBCOMMAND:At};if(!o)return l;await H("browser",()=>me(e,l,t));let p=await Se(e,l,t);if(!p)throw new r("automation_browser_unavailable","Reason could not connect the desktop browser.");return{...l,REASON_AUTOMATION_OBU_INSTANCE:p,REASON_AUTOMATION_BACKGROUND_TABS:"1"}}let i=await qe(),u=f(t,"home"),c=f(t,"runtime");G(u),G(c);let d=f(t,"bus"),m={...s,HOME:u,PATH:`${B(e.node)}:/usr/bin:/bin`,DISPLAY:i.display,XAUTHORITY:i.xauthority,XDG_RUNTIME_DIR:c,DBUS_SESSION_BUS_ADDRESS:`unix:path=${d}`,...i.sound?{PULSE_SERVER:Ve(i.sound)}:{}};if(await H("bus",()=>Wt(d,m)),o)await H("browser",()=>me(e,m,t));return m}function Gt(){let e=process.env.SystemRoot??"C:\\Windows",o=Object.fromEntries(["SystemDrive","USERPROFILE","LOCALAPPDATA","APPDATA","ProgramData","ProgramFiles","PATHEXT","ComSpec","USERNAME","USERDOMAIN","COMPUTERNAME","NUMBER_OF_PROCESSORS","PROCESSOR_ARCHITECTURE","PSModuleAnalysisCachePath"].flatMap((n)=>process.env[n]?[[n,process.env[n]]]:[])),t=f(e,"System32");return{...o,SystemRoot:e,windir:e,TEMP:L(),TMP:L(),PATH:[t,f(t,"WindowsPowerShell","v1.0"),e].join(wt)}}async function Ht(e,o,t){let n=we().username,s={USER:n,LOGNAME:n,HOME:a(),PATH:`${B(e.node)}:/usr/bin:/bin:/usr/sbin:/sbin`,REASON_AUTOMATION_OBU:o,REASON_AUTOMATION_BACKGROUND_TABS:"1"},i=await $t(o,s);return t.throwIfAborted(),{...s,REASON_AUTOMATION_OBU_INSTANCE:i}}function jt(e){if(process.platform!=="win32")return["--input-type=module","--eval",e];let o=f(L(),`reason-automation-${it("sha256").update(e).digest("hex").slice(0,16)}.mjs`);if(!M(o)||X(o,"utf8")!==e){let t=`${o}.${process.pid}.tmp`;ft(t,e,{mode:384}),he(t,o)}return[o]}function Oe(e,o,t,n){if(typeof ue!=="string")return Promise.reject(new r("automation_unavailable","This Reason build has no automation runtime."));let s=ue;return new Promise((i,u)=>{let c=R(e,jt(s),{env:{...o,REASON_CLOUD_GATEWAY_EXEC:"1",REASON_AUTOMATION_INLINE_RESULT:"1"},stdio:["pipe","pipe","pipe"],detached:process.platform!=="win32",windowsHide:!0}),d=[],m=0,l="",p=null,g=!1,w=(_)=>{if(p??=_,process.platform==="win32"&&c.pid){R(f(process.env.SystemRoot??"C:\\Windows","System32","taskkill.exe"),["/pid",String(c.pid),"/t","/f"],{stdio:"ignore",windowsHide:!0}).once("error",()=>c.kill("SIGKILL"));return}try{process.kill(-c.pid,"SIGKILL")}catch{c.kill("SIGKILL")}},h=(_)=>{if(g)return;g=!0,clearTimeout(I),n.removeEventListener("abort",S),_()},I=setTimeout(()=>w(new r("automation_timed_out","Reason automation did not finish in time.")),xt),S=()=>w(new r("cancelled","Reason cancelled the automation call."));if(n.addEventListener("abort",S,{once:!0}),c.stdout.on("data",(_)=>{if(m+=_.byteLength,m>_t)w(new r("automation_output_too_large","Reason automation output is too large."));else d.push(_)}),c.stderr.setEncoding("utf8").on("data",(_)=>{l=(l+_).slice(-yt)}),c.stdin.on("error",()=>{}),c.once("error",()=>h(()=>u(p??new r("automation_unavailable","Reason could not start the automation runtime.")))),c.once("close",(_)=>h(()=>{if(p)u(p);else i({code:_??1,stdout:Buffer.concat(d),stderr:l})})),n.aborted)S();c.stdin.end(t)})}var k=new Map;function Xt(e,o,t){for(let[s,i]of k)if(i.expiresAt<=t)k.delete(s);while(k.size>=Rt)k.delete(k.keys().next().value);let n=ge();return k.set(n,{runId:e,bytes:o,expiresAt:t+kt}),n}async function Ae(e,o,t,n={}){let s=await(n.environment??ve)(e,o.kind==="browser");return t.throwIfAborted(),await(n.runtime??Oe)(e.node,s,JSON.stringify(o),t)}async function Hs(e,o){let t=_e({call:e});if(!("call"in t))D();let n=x();if(!n?.features.computer||t.call.kind==="browser"&&!n.features.browser)throw new r("automation_unavailable","Run `reason desktop install` on this machine to enable computer and browser use.");return await Ae(n,t.call,o)}function fe(e,o,t){let n=e.stdout.byteLength>j?Xt(o,e.stdout,t):void 0;return{code:e.code,stderr:e.stderr,instance_id:Ot,output_bytes:e.stdout.byteLength,chunk:e.stdout.subarray(0,j).toString("base64"),...n?{output_id:n}:{}}}async function Tn(e,o={}){let t=_e(e.payload),n=(o.now??Date.now)();if("output_id"in t){let h=k.get(t.output_id);if(!h||h.runId!==e.runId||h.expiresAt<=n||t.offset>h.bytes.byteLength)throw new r("automation_output_unavailable","Reason automation output expired.");return{chunk:h.bytes.subarray(t.offset,t.offset+j).toString("base64")}}let s=(o.components??x)(),i=(o.platform??process.platform)==="darwin",u=i?(o.macIdentity??gt)():[],c=o.macSetup??N,d=!s?.features.computer||t.call.kind==="browser"&&!t.userChrome&&!s.features.browser;if(i&&(d||u.length===0||t.call.kind==="browser"&&t.userChrome&&!e.userChrome))return fe(await se({runId:e.runId,call:t.call,identity:u,desktopMissing:d,signal:e.signal},c),e.runId,n);if(!s?.features.computer)throw new r("automation_unavailable","Run `reason desktop install` on this machine to enable computer and browser use.");let m=t.userChrome?e.userChrome:void 0;if(t.userChrome&&!m)throw new r("automation_user_chrome_unavailable","Your own Chrome is not enabled on this computer: run `reason desktop install` on this Mac (and `reason connect --user-chrome on` if you turned it off).");if(t.call.kind==="browser"&&!m&&!s.features.browser)throw new r("automation_browser_not_installed",!s.platform.startsWith("linux")?"Browser use is unavailable on this machine: re-run `reason desktop install`.":"Browser use is unavailable on this machine: install a non-snap Chromium at /usr/bin/chromium, then re-run `reason desktop install`.");e.signal.throwIfAborted();let l=t.call.kind==="browser"&&t.call.operation!=="record_start"&&t.call.operation!=="record_stop",p=await ji(e.runId,e.signal,o.now,l?"call":"run"),g="account"in o?o.account??null:K(),w;try{if(m){let h=await(o.userChromeEnvironment??Ht)(s,m,e.signal);e.signal.throwIfAborted(),w=await(o.runtime??Oe)(s.node,h,JSON.stringify(t.call),e.signal)}else if(g)w=await(o.delegate??Q)(g,t.call,e.signal);else w=await Ae(s,t.call,e.signal,o)}finally{p()}if(i)w=await ie({runId:e.runId,call:t.call,identity:u,output:w,signal:e.signal},c);return fe(w,e.runId,n)}
|
|
860
860
|
export{Bt,Pn,Fs,js,Us,Hs,Tn};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ge,
|
|
2
|
+
import{Ge,pt}from"./vm-hands-entry-lite-1nrxnm0y.js";import{Qe}from"./vm-hands-entry-lite-a8bacdvh.js";import{Io,le,Kr,gt,Do}from"./vm-hands-entry-lite-y1p3s68r.js";import{E}from"./vm-hands-entry-lite-70hq7mrs.js";import{a,nr}from"./vm-hands-entry-lite-0sh835na.js";import{spawnSync as H}from"child_process";import{dirname as w}from"path";import{spawn as A}from"child_process";import{accessSync as _,constants as v}from"fs";import{basename as C,join as O}from"path";var l=null;function S(e){if(l===e)l=null;if(e.exitCode===null&&e.signalCode===null)e.kill("SIGTERM")}var Or=(e,t)=>{if(l)S(l);let s=O(e,Io);try{_(s,v.X_OK)}catch{return()=>{}}let n;try{n=A(s,["--app",e,"--name",C(e,".app"),"--permission",t==="screen"?"screen_recording":"accessibility"],{detached:!0,stdio:"ignore"})}catch{return()=>{}}return n.on("error",()=>{if(l===n)l=null}),n.once("exit",()=>{if(l===n)l=null}),n.unref(),l=n,()=>S(n)};import{chmodSync as ne,existsSync as se,mkdirSync as re,readFileSync as D,realpathSync as ie,renameSync as oe,statSync as j,writeFileSync as ae}from"fs";import{dirname as de,isAbsolute as G,join as N,resolve as T,sep as b}from"path";function F(e=a()){return N(nr(e),"reason","protected-path-grants.json")}var f=null;function L(e){let t=JSON.parse(e);if(!Array.isArray(t?.grants))return[];return t.grants.flatMap((s)=>{let n=s;return n&&typeof n.path==="string"&&G(n.path)&&(n.kind==="file"||n.kind==="folder")&&typeof n.grantedAt==="number"?[{path:n.path,kind:n.kind,grantedAt:n.grantedAt}]:[]})}function y(e=F()){try{let{mtimeMs:t}=j(e);if(f&&f.file===e&&f.mtimeMs===t)return f.grants;let s=L(D(e,"utf8"));return f={file:e,mtimeMs:t,grants:s},s}catch{return[]}}function W(e,t){return e.kind==="file"?t===e.path:t===e.path||t.startsWith(`${e.path}${b}`)}function U(e,t){let s=T(e);return y(t).some((n)=>W(n,s))}function _o(e,t){return E(e)&&!U(e,t)}function yo(e,t,s){let n=t?"file-read* file-write*":"file-read*";return y(s).filter((r)=>r.path===e||r.path.startsWith(`${e}${b}`)).map((r)=>`(allow ${n} (${r.kind==="file"?"literal":"subpath"} ${JSON.stringify(r.path)}))`)}var P="x-apple.systempreferences:com.apple.preference.security",J="curl -fsSL https://reasonmachines.com/install.sh | bash",q=180000,B=2000;var k={screen:{label:"Screen & System Audio Recording",purpose:"desktop video, computer-use screenshots",level:"required",pane:`${P}?Privacy_ScreenCapture`},accessibility:{label:"Accessibility",purpose:"computer-use clicks and typing, desktop input",level:"required",pane:`${P}?Privacy_Accessibility`},disk:{label:"Full Disk Access",purpose:"Sessions in Desktop, Documents, Downloads, iCloud Drive and Mail",level:"recommended",pane:`${P}?Privacy_AllFiles`}};function R(e){return e.executable}function K(e,t){if(e==="computer_use_identity_missing")return`Reason's background identity is not installed (${e}); reinstall Reason: ${J}`;if(e==="computer_use_identity_outdated")return`Reason's background identity is outdated (${Kr(t)??"unknown"}; this CLI is ${Qe}) (${e}); \`reason update\` installs this release's`;return`Reason's background identity cannot run computer use for this CLI (${e}); run the installed \`reason\``}function ss(e=a()){let t=gt(e);if(t.length>0)return{state:"ready",path:w(w(w(t[0]))),prefix:t};let s=Do(t,e)??"computer_use_identity_unavailable";return{state:s,path:le(e),detail:K(s,e)}}function V(){return{identity:()=>ss(),grants:(e)=>Ge(e),request:(e,t)=>pt(e,t),worker:async()=>(await import("./status-6n9wbsps.js")).connectionMacState(),open:(e)=>{H("/usr/bin/open",e,{stdio:"ignore",timeout:1e4})},tile:Or,restartConnection:async()=>(await import("./connect-cli-15fpx2j9.js")).restartConnection(),sleep:(e)=>new Promise((t)=>setTimeout(t,e)),now:()=>Date.now()}}function M(e,t,s){if(e.state!=="ready"||!t)return"unknown";return t[s]?"granted":"missing"}async function as(e){let t=e.identity(),s=t.state==="ready"?await e.grants(t.prefix):null,n=await e.worker(),r=n?R(n):null,i=!r||n?.full_disk_access==="unknown"?"unknown":n?.full_disk_access==="granted"?"granted":"missing",c=(u,d,o)=>{let{label:p,purpose:h,level:m}=k[u];return{id:u,label:p,purpose:h,level:m,state:d,holder:o}};return{identity:{state:t.state,path:t.path,detail:t.state==="ready"?null:t.detail},worker_detail:r?null:"Full Disk Access is read from this computer's running worker; `reason connect` starts it.",permissions:[c("screen",M(t,s,"screen"),t.path),c("accessibility",M(t,s,"accessibility"),t.path),c("disk",i,r)]}}function Ws(e){let t=e.identity.state==="ready"?null:e.identity.state,s=e.permissions.filter((i)=>i.state==="granted").length,n=[...t?[t]:[],...e.permissions.filter((i)=>i.state!=="granted"&&!(t&&i.id!=="disk")).map((i)=>`${i.label} ${i.state}`)],r=!t&&e.permissions.some((i)=>i.state==="missing");return`Permissions: ${s} of ${e.permissions.length}${n.length>0?` (${n.join(", ")})`:""}`+(r?" \u2014 reason permissions allow":n.length>0?" \u2014 reason permissions":"")}async function x(e,t){let s=t.now()+q;for(;;){if(await e())return!0;if(t.now()>=s)return!1;await t.sleep(B)}}async function Vs(e,t){let s=t.host??V(),{io:n}=t,r=await as(s),i=r.permissions.filter((o)=>e.includes(o.id)&&o.state!=="granted");if(i.length===0)return n.stdout.write(`Reason permissions: ${e.map((o)=>k[o].label).join(", ")} already allowed.
|
|
3
3
|
`),0;let c=!1,u=!1,d=s.identity();for(let o of i){let{label:p,pane:h}=k[o.id];if(o.id!=="disk"){if(d.state!=="ready"){if(!c)n.stderr.write(`Reason permissions: ${d.detail}
|
|
4
4
|
`);c=!0;continue}let g=o.id;await s.request(d.prefix,g),s.open([h]);let I=s.tile(d.path,g);if(n.stdout.write(`Allow Reason in System Settings > Privacy & Security > ${p}.
|
|
5
5
|
`),!t.wait)continue;if(n.stdout.write(`Waiting for it (Ctrl-C to stop)\u2026
|