@reason-machines/cli-linux-arm64 0.2.406 → 0.2.408
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/THIRD_PARTY_NOTICES.txt +8 -7
- package/bin/reason +2 -2
- package/bin/runtime/srt/sandbox-runtime.mjs +52 -52
- package/bin/vm-hands/api-8d760ppa.js +2 -0
- package/bin/vm-hands/api-credentials-eea1g4aw.js +2 -0
- package/bin/vm-hands/connect-cli-m8xafyn5.js +2 -0
- package/bin/vm-hands/custom-endpoint-device-nfjhs9fv.js +2 -0
- package/bin/vm-hands/desktop-account-rx4ajy2j.js +2 -0
- package/bin/vm-hands/device-workspace-n9tn4bzw.js +2 -0
- package/bin/vm-hands/fsevents-vgg0dny6.js +2 -0
- package/bin/vm-hands/hands-worker-source-yxsap3qk.js +2 -0
- package/bin/vm-hands/index-kx10kwyx.js +12818 -0
- package/bin/vm-hands/install-receipt-rmsjtfqy.js +2 -0
- package/bin/vm-hands/local-automation-7qcnytj6.js +2 -0
- package/bin/vm-hands/local-capabilities-hchsc804.js +2 -0
- package/bin/vm-hands/local-desktop-users-c6858avg.js +2 -0
- package/bin/vm-hands/local-display-mac-zmbp9z4c.js +2 -0
- package/bin/vm-hands/local-display-session-7bgp7gvf.js +2 -0
- package/bin/vm-hands/local-pty-session-8m175hqx.js +2 -0
- package/bin/vm-hands/managed-runtime-nkmg5s5h.js +2 -0
- package/bin/vm-hands/network-contract-qt2s82ap.js +2 -0
- package/bin/vm-hands/package-11mkdcmn.js +2 -0
- package/bin/vm-hands/permissions-67xv16a5.js +2 -0
- package/bin/vm-hands/reason-hands-protocol-r356wr4t.js +2 -0
- package/bin/vm-hands/serve-service-4n7e0b08.js +2 -0
- package/bin/vm-hands/status-e7r62q4e.js +10 -0
- package/bin/vm-hands/version-vdev7tyq.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-0n2f3kx7.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-4aejamqr.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-4geps3jz.js +5 -0
- package/bin/vm-hands/{vm-hands-entry-lite-xqve205b.js → vm-hands-entry-lite-51qvfk93.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-5p5h1eng.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-6p9c8nhf.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-6whxyzz2.js +52 -0
- package/bin/vm-hands/vm-hands-entry-lite-762fbns7.js +14 -0
- package/bin/vm-hands/vm-hands-entry-lite-79s23abx.js +7 -0
- package/bin/vm-hands/vm-hands-entry-lite-8bzqc4xa.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-8evzzh7v.js +112 -0
- package/bin/vm-hands/vm-hands-entry-lite-8gtgr399.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-9ym3sx81.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-dkcm3hyn.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-dq1m5ykp.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-e5hbehqn.js +250 -0
- package/bin/vm-hands/vm-hands-entry-lite-et2bh990.js +458 -0
- package/bin/vm-hands/vm-hands-entry-lite-fyjzrvj5.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-g3ja0c3y.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-gc7c22pq.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-wer0qzxg.js → vm-hands-entry-lite-hcw5tk5d.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-hee1h411.js +105 -0
- package/bin/vm-hands/{vm-hands-entry-lite-dsh32j5a.js → vm-hands-entry-lite-hfmydph9.js} +5 -9
- package/bin/vm-hands/vm-hands-entry-lite-hzn1hf0p.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-mvx29q2q.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-mw0gzbds.js +6 -0
- package/bin/vm-hands/vm-hands-entry-lite-pmcz7j7t.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-pn92kh7b.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-ppytc9k7.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-qffs74x1.js +540 -0
- package/bin/vm-hands/vm-hands-entry-lite-qy9xg6em.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-rwr09j4w.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-saqdrc2w.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-snmxxhza.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-fbpxs065.js → vm-hands-entry-lite-t7an5zg2.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-v3xznxcw.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-w8kc4jtb.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-w9ckj5k4.js +5 -0
- package/bin/vm-hands/{vm-hands-entry-lite-jcd21jpm.js → vm-hands-entry-lite-wd576mgy.js} +54 -54
- package/bin/vm-hands/vm-hands-entry-lite-wf7ksh4e.js +9 -0
- package/bin/vm-hands/vm-hands-entry-lite-wyh6dp1t.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-ym1djztp.js +42 -0
- package/bin/vm-hands/vm-hands-entry-lite-zg3b0c08.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-zn0v259d.js +65 -0
- package/bin/vm-hands/vm-hands-entry-lite.js +3 -1
- package/bin/vm-hands/vm-hands-executor-79av9nam.js +11 -0
- package/bin/vm-hands/vm-hands-op-runner-kh1myd15.js +2 -0
- package/bin/vm-hands/vm-hands-runtime-yacvv937.js +4 -0
- package/bin/vm-hands/worker-sandbox-x8dsz324.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/api-credentials-4e2gypqj.js +0 -2
- package/bin/vm-hands/api-f48wa4ym.js +0 -2
- package/bin/vm-hands/ask-relay-nydkgmvq.js +0 -8
- package/bin/vm-hands/connect-cli-10axcfnk.js +0 -2
- package/bin/vm-hands/custom-endpoint-device-8h95wy87.js +0 -2
- package/bin/vm-hands/desktop-account-2kkxwv1y.js +0 -2
- package/bin/vm-hands/device-workspace-nzz3kd5t.js +0 -2
- package/bin/vm-hands/hands-worker-source-as5wepvk.js +0 -2
- package/bin/vm-hands/index-2kk983b8.js +0 -12818
- package/bin/vm-hands/install-receipt-e6s355j1.js +0 -2
- package/bin/vm-hands/local-automation-nr2dg0t3.js +0 -2
- package/bin/vm-hands/local-capabilities-ep1d24ne.js +0 -2
- package/bin/vm-hands/local-desktop-users-sevkfkye.js +0 -2
- package/bin/vm-hands/local-display-mac-jzc0g5ge.js +0 -2
- package/bin/vm-hands/local-display-session-0vyd74rj.js +0 -2
- package/bin/vm-hands/local-pty-session-fe6jz2zy.js +0 -2
- package/bin/vm-hands/managed-runtime-5zrdx8xk.js +0 -2
- package/bin/vm-hands/network-contract-9smga6kn.js +0 -2
- package/bin/vm-hands/package-qjr5q0bp.js +0 -2
- package/bin/vm-hands/permissions-04sm9aq9.js +0 -2
- package/bin/vm-hands/reason-hands-protocol-5fhd49en.js +0 -2
- package/bin/vm-hands/serve-service-hd0k7s2x.js +0 -2
- package/bin/vm-hands/status-n3x94yjb.js +0 -96
- package/bin/vm-hands/version-aec5t9wd.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-0c4nxpza.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-159860ns.js +0 -52
- package/bin/vm-hands/vm-hands-entry-lite-1sc3wc94.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-2nec0vk1.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-40nkzw38.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-5rkakg10.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-5tgm1m3h.js +0 -458
- package/bin/vm-hands/vm-hands-entry-lite-69ray4x8.js +0 -6
- package/bin/vm-hands/vm-hands-entry-lite-6berk108.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-72nn2b4n.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-8f3px72v.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-8gjrr6hg.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-8tcnbfnm.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-9vf97byd.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-ac8sdh78.js +0 -105
- package/bin/vm-hands/vm-hands-entry-lite-bmywbwj4.js +0 -9
- package/bin/vm-hands/vm-hands-entry-lite-c60v3v0v.js +0 -540
- package/bin/vm-hands/vm-hands-entry-lite-er3nrbb9.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-g1wjmmr9.js +0 -346
- package/bin/vm-hands/vm-hands-entry-lite-g5c9ec33.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-h0y0xv5f.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-h9t84ekh.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-hd4a0a6f.js +0 -112
- package/bin/vm-hands/vm-hands-entry-lite-hepppjp0.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-hye6r7dy.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-jw5y1aa5.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-ky0w7t09.js +0 -42
- package/bin/vm-hands/vm-hands-entry-lite-mapxp682.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-np1fcr2t.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-nqvb7a2m.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-q4tcfj61.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-qpba4sxt.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-r2xmr627.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-swwb5mp2.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-vr38bh6k.js +0 -66
- package/bin/vm-hands/vm-hands-entry-lite-vwpraybq.js +0 -251
- package/bin/vm-hands/vm-hands-entry-lite-wa261sf8.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-wn4gvb8w.js +0 -11
- package/bin/vm-hands/vm-hands-entry-lite-yg5h9mhm.js +0 -7
- package/bin/vm-hands/vm-hands-entry-lite-yqrmr2c8.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-z5912r1q.js +0 -3
- package/bin/vm-hands/vm-hands-executor-m1jwswd0.js +0 -11
- package/bin/vm-hands/vm-hands-op-runner-6amaw4zn.js +0 -2
- package/bin/vm-hands/vm-hands-runtime-jt4j6362.js +0 -4
- package/bin/vm-hands/worker-sandbox-p242st5d.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ir,Cn,Dr,An}from"./vm-hands-entry-lite-gc7c22pq.js";import"./vm-hands-entry-lite-5p5h1eng.js";import"./vm-hands-entry-lite-t7an5zg2.js";import"./vm-hands-entry-lite-dkcm3hyn.js";import"./vm-hands-entry-lite-mvx29q2q.js";export{Ir as installationReceiptPath,Dr as installerReasonAlias,Cn as installerReceiptLauncher,An as loadInstallationReceipt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{hn,rs,ns,is,os,fn}from"./vm-hands-entry-lite-hfmydph9.js";import"./vm-hands-entry-lite-e5hbehqn.js";import"./vm-hands-entry-lite-pn92kh7b.js";import"./vm-hands-entry-lite-dq1m5ykp.js";import"./vm-hands-entry-lite-51qvfk93.js";import"./vm-hands-entry-lite-g3ja0c3y.js";import"./vm-hands-entry-lite-v3xznxcw.js";import"./vm-hands-entry-lite-hee1h411.js";import"./vm-hands-entry-lite-gc7c22pq.js";import"./vm-hands-entry-lite-5p5h1eng.js";import"./vm-hands-entry-lite-t7an5zg2.js";import"./vm-hands-entry-lite-762fbns7.js";import"./vm-hands-entry-lite-8evzzh7v.js";import"./vm-hands-entry-lite-wf7ksh4e.js";import"./vm-hands-entry-lite-8bzqc4xa.js";import"./vm-hands-entry-lite-dkcm3hyn.js";import"./vm-hands-entry-lite-mvx29q2q.js";import"./vm-hands-entry-lite-ym1djztp.js";import"./vm-hands-entry-lite-8gtgr399.js";import"./vm-hands-entry-lite-zg3b0c08.js";import"./vm-hands-entry-lite-hcw5tk5d.js";export{ns as ensureLocalBrowser,hn as localAutomationAvailable,is as localBrowserProfile,rs as localUserChromeHost,os as runAutomationCallLocally,fn as runLocalAutomation};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{So,wi,Yr,Eo,xo,ko,Co,Yo,Qo,es,ts}from"./vm-hands-entry-lite-qffs74x1.js";import"./vm-hands-entry-lite-et2bh990.js";import"./vm-hands-entry-lite-wd576mgy.js";import"./vm-hands-entry-lite-79s23abx.js";import"./vm-hands-entry-lite-mw0gzbds.js";import"./vm-hands-entry-lite-wyh6dp1t.js";import"./vm-hands-entry-lite-9ym3sx81.js";import"./vm-hands-entry-lite-hfmydph9.js";import"./vm-hands-entry-lite-e5hbehqn.js";import"./vm-hands-entry-lite-pn92kh7b.js";import"./vm-hands-entry-lite-dq1m5ykp.js";import"./vm-hands-entry-lite-51qvfk93.js";import"./vm-hands-entry-lite-g3ja0c3y.js";import"./vm-hands-entry-lite-v3xznxcw.js";import"./vm-hands-entry-lite-hee1h411.js";import"./vm-hands-entry-lite-gc7c22pq.js";import"./vm-hands-entry-lite-5p5h1eng.js";import"./vm-hands-entry-lite-t7an5zg2.js";import"./vm-hands-entry-lite-762fbns7.js";import"./vm-hands-entry-lite-8evzzh7v.js";import"./vm-hands-entry-lite-wf7ksh4e.js";import"./vm-hands-entry-lite-8bzqc4xa.js";import"./vm-hands-entry-lite-dkcm3hyn.js";import"./vm-hands-entry-lite-mvx29q2q.js";import"./vm-hands-entry-lite-ym1djztp.js";import"./vm-hands-entry-lite-8gtgr399.js";import"./vm-hands-entry-lite-zg3b0c08.js";import"./vm-hands-entry-lite-hcw5tk5d.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";export{r as LocalCapabilityError,So as SHORT_REQUEST_CAPABILITIES,Yo as capabilityInventoryForRoots,wi as confinedExecutionShell,Eo as defaultLocalCommandRunner,Qo as deliverLocalHandsEnvironment,Co as enrolledRootPaths,ts as executeLocalOperation,es as rebindLocalHandsControl,xo as runFileCapability,ko as runTransferCapability,Yr as spawnCaptured};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ft,$s,Bs,fi,mi}from"./vm-hands-entry-lite-8gtgr399.js";import"./vm-hands-entry-lite-zg3b0c08.js";import"./vm-hands-entry-lite-hcw5tk5d.js";export{$s as forgetLocalDesktopUse,mi as holdLocalDesktop,ft as noteLocalDesktopUse,Bs as releaseLocalDesktop,fi as trackDesktopRun};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{kt,ss,V,$e,Ct}from"./vm-hands-entry-lite-e5hbehqn.js";import"./vm-hands-entry-lite-pn92kh7b.js";import"./vm-hands-entry-lite-dq1m5ykp.js";import"./vm-hands-entry-lite-51qvfk93.js";import"./vm-hands-entry-lite-g3ja0c3y.js";import"./vm-hands-entry-lite-v3xznxcw.js";import"./vm-hands-entry-lite-5p5h1eng.js";import"./vm-hands-entry-lite-t7an5zg2.js";import"./vm-hands-entry-lite-762fbns7.js";import"./vm-hands-entry-lite-8evzzh7v.js";import"./vm-hands-entry-lite-wf7ksh4e.js";import"./vm-hands-entry-lite-8bzqc4xa.js";import"./vm-hands-entry-lite-dkcm3hyn.js";import"./vm-hands-entry-lite-mvx29q2q.js";import"./vm-hands-entry-lite-8gtgr399.js";import"./vm-hands-entry-lite-zg3b0c08.js";import"./vm-hands-entry-lite-hcw5tk5d.js";export{$e as ensureLinuxDesktop,kt as localDisplayAvailable,ss as localDisplayReady,V as privateDirectory,Ct as runLocalDisplayStream};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{_r,At,yr,Po,mn,wr,gn}from"./vm-hands-entry-lite-pn92kh7b.js";import"./vm-hands-entry-lite-dq1m5ykp.js";import"./vm-hands-entry-lite-51qvfk93.js";import"./vm-hands-entry-lite-g3ja0c3y.js";import"./vm-hands-entry-lite-5p5h1eng.js";import"./vm-hands-entry-lite-t7an5zg2.js";import"./vm-hands-entry-lite-dkcm3hyn.js";import"./vm-hands-entry-lite-mvx29q2q.js";export{At as LOCAL_PTY_MAX_BUFFERED_OUTPUT_BYTES,yr as LOCAL_PTY_MAX_SESSIONS,_r as LOCAL_PTY_MAX_SESSION_MS,wr as defaultConnect,Po as defaultLoginShell,mn as ptyRuntimeSupported,gn as runLocalPtySession};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Wo,Vo,Go,Ko,Jo,Zo,Xo}from"./vm-hands-entry-lite-4geps3jz.js";import"./vm-hands-entry-lite-wyh6dp1t.js";import"./vm-hands-entry-lite-t7an5zg2.js";import"./vm-hands-entry-lite-wf7ksh4e.js";import"./vm-hands-entry-lite-8bzqc4xa.js";import"./vm-hands-entry-lite-dkcm3hyn.js";import"./vm-hands-entry-lite-mvx29q2q.js";import"./vm-hands-entry-lite-zg3b0c08.js";import"./vm-hands-entry-lite-hcw5tk5d.js";export{Jo as acquireManagedRuntimeDirectoryLock,Go as currentManagedRuntimeVersion,Xo as flushManagedRuntimeLifecycleEvents,Ko as isManagedRuntimeVersionExecutable,Vo as legacyManagedRuntimePaths,Wo as managedRuntimePaths,Zo as recordManagedRuntimeLifecycle};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ve,Ce,gs,_s,ys,Mn,bs,zr,$n,ut,Bn,Fn,jn,Un,Hn,qn,zn,Wn,Vn,Gn,Kn,Jn,Zn,Xn,Yn,Qn,pe,X,Ae,q,ei,ti,ri,Y,ni,ii,oi,si,ai,dt,ci,vs,Wt,li,Ss,Io,Es,xs,ks,Cs,As,Ps,Ts,Rs,Os,Is,Ds,Ns,Ls,Ms}from"./vm-hands-entry-lite-ym1djztp.js";export{ci as AUTOMATION_CLOUD_SESSIONS,dt as AUTOMATION_USER_CHROME,Kn as HANDS_CLOUD_ACCESS,Jn as HANDS_CLOUD_ACCESS_KEY,pe as HANDS_CONFINEMENT,X as HANDS_CONFINEMENT_KEY,Un as HANDS_ENVIRONMENT_AT_CLAIM,Hn as HANDS_ENVIRONMENT_AT_CLAIM_KEY,$n as HANDS_ENVIRONMENT_DELIVERY,ut as HANDS_ENVIRONMENT_DELIVER_CONTROL,Zn as HANDS_HEADLESS_BROWSER,Xn as HANDS_HEADLESS_BROWSER_KEY,ei as HANDS_JOBS_USER,ti as HANDS_JOBS_USER_KEY,Yn as HANDS_LARGE_ENVIRONMENT,Qn as HANDS_LARGE_ENVIRONMENT_KEY,Ae as HANDS_MODEL_JOBS_EGRESS,q as HANDS_MODEL_JOBS_EGRESS_KEY,Wn as HANDS_REBIND,Gn as HANDS_REBIND_CONTROL,Vn as HANDS_REBIND_KEY,ni as HANDS_SESSION_CAP_KEY,ii as HANDS_SESSION_CAP_NONE,ri as HANDS_SESSION_GROUP,Y as HANDS_SESSION_GROUP_KEY,qn as HANDS_WORKSPACE_CHECK,zn as HANDS_WORKSPACE_CHECK_KEY,si as JOBS_START_WAIT,ai as JOBS_START_WAIT_KEY,Ce as LOCAL_OPERATION_MAX_BYTES,Ve as LOCAL_RUNTIME_PROTOCOL_VERSION,ys as LOCAL_RUNTIME_ROUTES,zr as LOCAL_RUNTIME_SESSION_CLAIM_WAIT_MAX_MS,Mn as LOCAL_RUNTIME_SESSION_PATH,Wt as LOCAL_RUNTIME_WORKER_STARTUP_MAX_MS,gs as RELAY_HOST_ALIAS_HEADER,_s as RELAY_HOST_ALIAS_VERSION,jn as VM_HANDS_UNBIND_UNVERIFIED_EVENT,Bn as VM_HANDS_WORKSPACE_DEFERRED_KEY,Fn as VM_HANDS_WORKSPACE_GRANT_CONTROL,oi as WORKER_PREVIEW_CARRIED_JOBS,vs as WORKER_STARTUP_TIMING_STAGES,li as buildLocalRuntimeDeviceProofBytes,bs as localRuntimeSessionRoutable,Ts as parseLocalRuntimeDisconnectResponse,xs as parseLocalRuntimeEnrollmentResponse,Ss as parseLocalRuntimeErrorEnvelope,Cs as parseLocalRuntimeFirstHeartbeat,ks as parseLocalRuntimeHeartbeatResponse,Ps as parseLocalRuntimeIdentityResponse,Os as parseLocalRuntimeLifecycleResponse,Rs as parseLocalRuntimeLocalSubscriptionResponse,Is as parseLocalRuntimeOperationClaim,Ms as parseLocalRuntimeOperationCompletionResponse,Ls as parseLocalRuntimeOperationEnvironmentResponse,Ns as parseLocalRuntimeOperationEventsResponse,Ds as parseLocalRuntimeOperationHeartbeatResponse,Io as parseLocalRuntimeProofChallenge,Es as parseLocalRuntimeRegistrationResponse,As as parseLocalRuntimeRootsSyncResponse};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ro,Oo,fs,ms}from"./vm-hands-entry-lite-762fbns7.js";import"./vm-hands-entry-lite-8evzzh7v.js";import"./vm-hands-entry-lite-wf7ksh4e.js";import"./vm-hands-entry-lite-8bzqc4xa.js";import"./vm-hands-entry-lite-dkcm3hyn.js";import"./vm-hands-entry-lite-mvx29q2q.js";export{ms as allowMacPermissions,fs as permissionsSummary,Oo as readMacPermissions,Ro as reasonIdentity};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{k,Er,xr,_n,et,yn,kr,Fe,ye,wn,je,It,te,Ue,bn,we,Dt,Cr,Nt,Ar,vn,ae,U,N,ce,Pr,Tr,Sn}from"./vm-hands-entry-lite-g3ja0c3y.js";import"./vm-hands-entry-lite-mvx29q2q.js";export{Ar as REASON_HANDS_CLOSE_CODES,je as REASON_HANDS_JOB_CONTROL_MAX_FRAME_BYTES,kr as REASON_HANDS_JOB_MAX_INPUT_CHARS,Fe as REASON_HANDS_JOB_MAX_OUTPUT_CHARS,ye as REASON_HANDS_JOB_MAX_OUTPUT_CHUNKS,wn as REASON_HANDS_JOB_MAX_RECORDS,yn as REASON_HANDS_MAX_ERROR_CHARS,Er as REASON_HANDS_MAX_FRAME_BYTES,xr as REASON_HANDS_MAX_INPUT_CHARS,et as REASON_HANDS_MAX_OUTPUT_CHARS,_n as REASON_HANDS_MAX_STRUCTURED_INPUT_CHARS,k as REASON_HANDS_PROTOCOL_VERSION,Cr as REASON_HANDS_PTY_ANCHOR_EXIT_MS,Nt as REASON_HANDS_PTY_CLEANUP_RECEIPT_MS,Dt as REASON_HANDS_PTY_CLEANUP_SWEEP_MS,we as REASON_HANDS_PTY_MAX_DIMENSION,te as REASON_HANDS_PTY_MAX_INPUT_BYTES,Ue as REASON_HANDS_PTY_MAX_OUTPUT_BYTES,bn as REASON_HANDS_PTY_MAX_PENDING_INPUT_BYTES,It 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,Pr as parseReasonHandsJobRequest,Tr as parseReasonHandsJobResult,Sn as parseReasonHandsPtyReceipt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Rr,be,K,xn,cs,qi,ls,He,To,kn,us,ds,Or,ps,hs}from"./vm-hands-entry-lite-hee1h411.js";import"./vm-hands-entry-lite-gc7c22pq.js";import"./vm-hands-entry-lite-5p5h1eng.js";import"./vm-hands-entry-lite-t7an5zg2.js";import"./vm-hands-entry-lite-wf7ksh4e.js";import"./vm-hands-entry-lite-8bzqc4xa.js";import"./vm-hands-entry-lite-dkcm3hyn.js";import"./vm-hands-entry-lite-mvx29q2q.js";import"./vm-hands-entry-lite-zg3b0c08.js";import"./vm-hands-entry-lite-hcw5tk5d.js";export{Rr as WORKER_SERVICE_ENV,K as WorkerServiceError,qi as connectServiceLabel,be as defaultWorkerServiceHost,ds as installWorkerService,He as installedWorkerService,ls as isConnectServiceLabel,hs as removeWorkerService,Or as restartWorkerService,ps as retargetWorkerServiceLogs,To as retireLegacyWorkerService,us as workerServiceDefinitionCurrent,xn as workerServiceLauncher,kn as workerServiceProcessRunning,cs as workerServiceRetargetPending};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./vm-hands-entry-lite-w9ckj5k4.js";import"./vm-hands-entry-lite-t7an5zg2.js";import{g}from"./vm-hands-entry-lite-5p5h1eng.js";import"./vm-hands-entry-lite-mvx29q2q.js";import"./vm-hands-entry-lite-hcw5tk5d.js";import"./vm-hands-entry-lite-fyjzrvj5.js";import{Tt,Qe}from"./vm-hands-entry-lite-dq1m5ykp.js";import{w,M,Jt,Ie,Ge}from"./vm-hands-entry-lite-6whxyzz2.js";import"./vm-hands-entry-lite-ym1djztp.js";import"./vm-hands-entry-lite-qffs74x1.js";import"./vm-hands-entry-lite-et2bh990.js";import"./vm-hands-entry-lite-8bzqc4xa.js";import"./vm-hands-entry-lite-mw0gzbds.js";import"./vm-hands-entry-lite-79s23abx.js";import"./vm-hands-entry-lite-w8kc4jtb.js";import"./vm-hands-entry-lite-e5hbehqn.js";import"./vm-hands-entry-lite-8evzzh7v.js";import"./vm-hands-entry-lite-wf7ksh4e.js";import"./vm-hands-entry-lite-762fbns7.js";import"./vm-hands-entry-lite-v3xznxcw.js";import"./vm-hands-entry-lite-4geps3jz.js";import"./vm-hands-entry-lite-gc7c22pq.js";import"./vm-hands-entry-lite-hee1h411.js";import"./vm-hands-entry-lite-9ym3sx81.js";import"./vm-hands-entry-lite-g3ja0c3y.js";import"./vm-hands-entry-lite-wd576mgy.js";import"./vm-hands-entry-lite-51qvfk93.js";import"./vm-hands-entry-lite-8gtgr399.js";import"./vm-hands-entry-lite-pn92kh7b.js";import"./vm-hands-entry-lite-hfmydph9.js";import"./vm-hands-entry-lite-wyh6dp1t.js";import{a}from"./vm-hands-entry-lite-dkcm3hyn.js";import{t,o,u,i,s,n}from"./vm-hands-entry-lite-zn0v259d.js";import"./vm-hands-entry-lite-zg3b0c08.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 h(e){return`claude mcp add --transport http reason ${e}`}function C(e){return`codex mcp add reason --url ${e}
|
|
3
|
+
codex mcp login reason`}var F=h("https://mcp.reasonmachines.com/mcp"),z=C("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
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
reason mcp Show how to connect Claude Code, Codex, or another MCP client
|
|
7
|
+
reason mcp uninstall Remove only this machine's registrations of the earlier, retired server
|
|
8
|
+
|
|
9
|
+
Plugins for Claude Code and Codex: ${b}
|
|
10
|
+
`;var P=s(["granted","not_granted","unknown"]),y=i({status:P,checkedAt:o().finite(),executablePath:t().min(1)});var De=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(),R=null){let r=Qe(e),d=(()=>{if(r?.state!=="connected"&&r?.state!=="starting")return!1;try{return process.kill(r.pid,0),!0}catch{return!1}})(),S=d&&r?.state==="connected",p=(f)=>S&&c-f>=0&&c-f<x,l=y.safeParse(r?.fullDiskAccess),m=Tt(r,R,c);return{...m?{permission_recovery:m}:{},full_disk_access:l.success&&p(l.data.checkedAt)?l.data.status:"unknown",keep_awake:{enabled:Jt(e)==="battery_and_ac",holding:r?.idleSleepHold===!0&&p(Date.parse(r.lastHeartbeatAt??""))},executable:d&&l.success?l.data.executablePath:null}}function Ne(e=g()){if(process.platform!=="darwin")return null;let c=Ie(I(Ge(k(a()),e),"worker.json"));return c?L(w(c).daemon,Date.now(),M(c)):null}export{Ne as connectionMacState};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{resolve as s,sep as i}from"path";var Se=[[".ssh"],[".gnupg"],[".aws"],[".azure"],[".kube"],[".docker"],[".infisical"],[".password-store"],[".terraform.d"],[".config","ara"],[".config","reason"],[".config","gh"],[".config","gcloud"],[".config","infisical"],[".config","op"],[".config","1password"],[".config","pass"],[".local","share","keyrings"],["library","keychains"],["library","application support","so.ara.desktop"],["appdata","roaming","github cli"],["appdata","roaming","gcloud"],["appdata","roaming","microsoft","credentials"],["appdata","local","microsoft","credentials"],["appdata","roaming","microsoft","protect"],["appdata","roaming","1password"],["appdata","local","1password"],["appdata","roaming","microsoft","windows","start menu","programs","startup"],["documents","windowspowershell"],["documents","powershell"],["appdata","local","reason"]],Mt=[[".codex","config.toml"],[".cursor","mcp.json"],[".claude","settings.json"],[".claude","settings.local.json"],[".cargo","credentials"],[".cargo","credentials.toml"],[".gem","credentials"],[".config","git","config"],[".config","git","credentials"],[".config","pip","pip.conf"]],$t=new Set([".bash_login",".bash_profile",".bashrc",".bunfig.toml",".claude.json",".env",".envrc",".git-credentials",".gitconfig",".mcp.json",".netrc",".npmrc",".profile",".pypirc",".terraformrc",".yarnrc",".yarnrc.yml",".zlogin",".zlogout",".zprofile",".zshenv",".zshrc","auth.json","credentials.json","credentials.tfrc.json","local-daemon.json","local-device.json","mcp.json"]),Bt=[".key",".p12",".pfx",".pem"];function t(n,a){if(n.length<a.length)return!1;for(let r=0;r<=n.length-a.length;r+=1)if(a.every((o,e)=>n[r+e]===o))return!0;return!1}function E(n){let a=s(n).split(i).filter(Boolean).map((o)=>o.toLowerCase());if(Se.some((o)=>t(a,o)))return!0;if(Mt.some((o)=>t(a,o)))return!0;let r=a.at(-1)??"";return $t.has(r)||r.startsWith(".env.")||Bt.some((o)=>r.endsWith(o))}
|
|
3
|
+
export{Se,Mt,$t,Bt,E};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var l=Object.create;var{getPrototypeOf:m,defineProperty:h,getOwnPropertyNames:n}=Object;var k=Object.prototype.hasOwnProperty;function o(a){return this[a]}var p,q,hi=(a,b,c)=>{var d=a!=null&&typeof a==="object";if(d){var i=b?p??=new WeakMap:q??=new WeakMap,j=i.get(a);if(j)return j}c=a!=null?l(m(a)):{};let f=b||!a||!a.__esModule||!k.call(a,"default")?h(c,"default",{value:a,enumerable:!0}):c;if(a&&typeof a==="object"||typeof a==="function"){for(let g of n(a))if(!k.call(f,g))h(f,g,{get:o.bind(a,g),enumerable:!0})}if(d)i.set(a,f);return f};var he=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var r=(a)=>a;function s(a,b){this[a]=r.bind(null,b)}var Mo=(a,b)=>{for(var c in b)h(a,c,{get:b[c],enumerable:!0,configurable:!0,set:s.bind(b,c)})};var $o=(a,b,c)=>()=>{if(a)try{b=a(a=0)}catch(d){c=[d]}if(c)throw c[0];return b};var e=import.meta.require;
|
|
3
|
+
export{hi,he,Mo,$o,e};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{C}from"./vm-hands-entry-lite-t7an5zg2.js";import{Br}from"./vm-hands-entry-lite-wf7ksh4e.js";import{tt}from"./vm-hands-entry-lite-ppytc9k7.js";import{a}from"./vm-hands-entry-lite-dkcm3hyn.js";import{I}from"./vm-hands-entry-lite-zg3b0c08.js";import{randomUUID as f}from"crypto";import{chmodSync as U,closeSync as h,constants as g,existsSync as me,fstatSync as F,lstatSync as R,mkdirSync as B,openSync as G,readFileSync as Y,readdirSync as z,readlinkSync as J,realpathSync as x,renameSync as _,rmSync as p,statSync as K,symlinkSync as _t,unlinkSync as M,writeFileSync as L}from"fs";import{basename as vt,dirname as N,isAbsolute as fe,join as c,relative as ge,resolve as b,sep as _e}from"path";import{createRequire as H}from"module";var q=1,j=1,ye=128,ve=65536;var he=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;var P=/^[a-z0-9_.-]{1,80}$/,be=64,Ee="so.ara.device-broker",Me=[Ee,"com.reasonmachines.device-broker"],Pt=Br(Me);var we=["service.install_started","service.install_completed","service.install_failed","service.launcher_adopted","service.launcher_conflict","service.started","service.reconnecting","service.reconnected","service.idle_sleep_held","service.idle_sleep_released","service.idle_sleep_failed","service.start_failed","service.stopped","service.exit_failed","service.singleton_rejected","credential.migration_started","credential.migration_completed","credential.migration_failed","credential.store_started","credential.store_completed","credential.store_failed","credential.delete_started","credential.delete_completed","credential.delete_failed","update.check_started","update.not_available","update.download_started","update.downloaded","update.verified","update.activated","update.rollback","update.failed","executor.update.check_started","executor.update.not_available","executor.update.download_started","executor.update.downloaded","executor.update.verified","executor.update.activated","executor.update.rollback","executor.update.failed","identity.refresh_completed","identity.refresh_failed","update.device_moved","update.components_installed","update.deferred","update.deferral_expired","worker.previous_exit","worker.capabilities_withheld","identity.computer_use_unavailable"];function X(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function W(e,t,n=[]){let r=new Set([...t,...n]);return t.every((i)=>(i in e))&&Object.keys(e).every((i)=>r.has(i))}function E(e){return typeof e==="string"&&he.test(e)}function Z(e){return typeof e==="string"&&!Number.isNaN(Date.parse(e))&&new Date(e).toISOString()===e}function S(e){B(e,{recursive:!0,mode:448}),U(e,448)}function Re(e,t){S(N(e));let n=`${e}.${process.pid}.${f()}.tmp`;try{L(n,t,{mode:384,flag:"wx"}),U(n,384),_(n,e)}finally{if(me(n))M(n)}}function Wo(e={}){if((e.platform??process.platform)!=="darwin")throw new tt("unsupported_platform","The managed Reason runtime is currently available only on macOS.");let n=e.environment??process.env,r=C(n,"REASON_CLI_CHANNEL")==="staging",i=r?C(n,"REASON_MANAGED_RUNTIME_ROOT")?.trim():void 0,o=e.root!==void 0||Boolean(i&&fe(i))?null:c(e.home??a(),"Library","Application Support"),d=e.root??(o?c(o,r?"Reason Staging":"Reason","CLI"):i);return{executableName:"reason",root:d,...o?{legacyRoot:c(o,"Ara",...r?["staging","runtime"]:["runtime"])}:{},versions:c(d,"versions"),current:c(d,"current"),previous:c(d,"previous"),brokerLock:c(d,"broker.lock"),transitionLock:c(d,"transition.lock"),lifecycleEvents:c(d,"lifecycle-events")}}function Vo(e){let t=e.legacyRoot;if(!t)return null;return{root:t,versions:c(t,"versions"),current:c(t,"current"),previous:c(t,"previous"),brokerLock:c(t,"broker.lock"),transitionLock:c(t,"transition.lock"),lifecycleEvents:c(t,"lifecycle-events")}}function pe(e,t){let n;try{if(!R(e).isSymbolicLink())return null;n=J(e)}catch{return null}let r=n.match(/^versions\/(\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?)\/(ara|Reason|reason)$/);return r&&(r[2]==="ara"||r[2]===t)?r[1]:null}function Go(e){return pe(e.current,e.executableName)}function D(e,t,n){let i=ge(t,e).split(_e);return i.length===2&&E(i[0])&&(i[1]==="ara"||n!==void 0&&i[1]===n)?i[0]:null}function Le(e,t){try{return R(t).isSymbolicLink()&&b(N(t),J(t))===b(e.current)}catch{return!1}}function Ko(e,t=process.execPath){try{return D(x(t),x(e.versions),e.executableName)!==null}catch{let n=b(t);return n===b(e.current)||Le(e,n)||D(n,b(e.versions),e.executableName)!==null}}function Ae(e){return X(e)&&W(e,["schema_version","pid","nonce","started_at","runtime_version"])&&e.schema_version===q&&typeof e.pid==="number"&&Number.isSafeInteger(e.pid)&&e.pid>0&&typeof e.nonce==="string"&&/^[0-9a-f-]{36}$/.test(e.nonce)&&Z(e.started_at)&&E(e.runtime_version)}function Q(e,t){try{let n=R(e);if(!n.isDirectory()||!I(n))return null;let r=G(c(e,t),g.O_RDONLY|g.O_NOFOLLOW|g.O_NONBLOCK);try{let i=F(r);if(!i.isFile()||i.nlink!==1||!I(i)||i.size>4096)return null;return Y(r,"utf8")}finally{h(r)}}catch{return null}}function A(e){try{let t=JSON.parse(Q(e,"owner.json")??"null");return Ae(t)?t:null}catch{return null}}function ee(e){try{return process.kill(e,0),!0}catch(t){return!(t instanceof Error&&("code"in t)&&t.code==="ESRCH")}}var O="lease",Ne=2,Se=4,y;function ke(){if(y!==void 0)return y;if(y=null,process.platform!=="linux"&&process.platform!=="darwin")return null;let e;try{e=H(import.meta.url)("bun:ffi")}catch{return null}let t=process.platform==="darwin"?"__error":"__errno_location",n=process.platform==="darwin"?["/usr/lib/libSystem.B.dylib"]:["libc.so.6",`libc.musl-${process.arch==="arm64"?"aarch64":"x86_64"}.so.1`];for(let r of n)try{let i=e.dlopen(r,{flock:{args:[e.FFIType.i32,e.FFIType.i32],returns:e.FFIType.i32},[t]:{args:[],returns:e.FFIType.ptr}}),s=i.symbols[t]();if(s===null)continue;return y={flock:(o,d)=>i.symbols.flock(o,d),errno:()=>e.read.i32(s),wouldBlock:process.platform==="darwin"?35:11},y}catch{}return null}var v,Ie=3221225472,Te=4,xe=128,Pe=32;function De(e){if(v===void 0){v=null;try{let s=H(import.meta.url)("bun:ffi"),{FFIType:o}=s;v={kernel:s.dlopen("kernel32.dll",{CreateFileW:{args:[o.ptr,o.u32,o.u32,o.ptr,o.u32,o.u32,o.ptr],returns:o.i64_fast},CloseHandle:{args:[o.i64_fast],returns:o.i32},GetLastError:{args:[],returns:o.u32}}).symbols,ptr:(l)=>s.ptr(l)}}catch{return null}}if(!v)return null;let{kernel:t,ptr:n}=v,r=Buffer.from(`${e}\x00`,"utf16le"),i=t.CreateFileW(n(r),Ie,0,null,Te,xe,null);if(Number(i)===-1)return t.GetLastError()===Pe?"busy":null;return{release:()=>{t.CloseHandle(i)}}}function Oe(e){if(process.platform==="win32")return De(`${e}.lease`);let t=ke();if(!t)return null;let n=G(`${e}.lease`,g.O_RDWR|g.O_CREAT|g.O_NOFOLLOW,384);try{let r=F(n);if(!r.isFile()||r.nlink!==1||!I(r))return h(n),"busy";if(t.flock(n,Ne|Se)===0)return{release:()=>h(n)};let i=t.errno();return h(n),i===t.wouldBlock?"busy":null}catch(r){throw h(n),r}}function Jo(e){S(N(e.path));let t=Oe(e.path);if(t==="busy")return{acquired:!1,owner:A(e.path),recoveredStaleOwner:!1};let n=t!==null;try{let r=Ce(e,t);if(r.acquired)n=!1;return r}finally{if(n)t.release()}}function Ce(e,t){let n=e.alive??ee,r=!1;for(let i=0;i<4;i+=1){let s={schema_version:q,pid:e.pid??process.pid,nonce:e.nonce?.()??f(),started_at:(e.now?.()??new Date).toISOString(),runtime_version:e.runtimeVersion},o=`${e.path}.init-${process.pid}-${f()}`,d=!1;try{if(B(o,{mode:448}),L(c(o,"owner.json"),`${JSON.stringify(s)}
|
|
3
|
+
`,{mode:384,flag:"wx"}),t!==null)L(c(o,O),`flock
|
|
4
|
+
`,{mode:384,flag:"wx"});e.beforePublish?.();try{throw R(e.path),Object.assign(Error("Managed runtime lock exists."),{code:"EEXIST"})}catch(m){if(m.code!=="ENOENT")throw m}_(o,e.path),d=!0;let l=!1;return{acquired:!0,owner:s,recoveredStaleOwner:r,release(){if(l)return;if(l=!0,A(e.path)?.nonce===s.nonce)p(e.path,{recursive:!0,force:!0});t?.release()}}}catch(l){let m=l.code;if(!["EEXIST","ENOTEMPTY"].includes(m??""))throw l;let u=A(e.path),re=(e.now?.()??new Date).getTime(),ie=u&&e.staleAfterMs!==void 0?re-Date.parse(u.started_at)<e.staleAfterMs:!1,ae=u!==null&&!(t!==null&&Q(e.path,O)!==null)&&n(u.pid);if(!u||ae||ie)return{acquired:!1,owner:u,recoveredStaleOwner:!1};let k=`${e.path}.stale-${process.pid}-${f()}`;try{_(e.path,k),p(k,{recursive:!0,force:!0}),r=!0}catch(T){let oe=T.code;if(!["ENOENT","EEXIST"].includes(oe??""))throw T}}finally{if(!d)p(o,{recursive:!0,force:!0})}}throw new tt("lock_unavailable","Could not acquire the managed Reason runtime lock.")}function te(e){return X(e)&&W(e,["schema_version","event_id","occurred_at","event","runtime_version"],["from_version","to_version","reason_code","duration_ms","attempt_count","retry_in_ms","capabilities"])&&e.schema_version===j&&typeof e.event_id==="string"&&/^[0-9a-f-]{36}$/.test(e.event_id)&&Z(e.occurred_at)&&typeof e.event==="string"&&we.includes(e.event)&&E(e.runtime_version)&&(e.from_version===void 0||E(e.from_version))&&(e.to_version===void 0||E(e.to_version))&&(e.reason_code===void 0||typeof e.reason_code==="string"&&P.test(e.reason_code))&&(e.duration_ms===void 0||typeof e.duration_ms==="number"&&Number.isSafeInteger(e.duration_ms)&&e.duration_ms>=0&&e.duration_ms<=86400000)&&(e.attempt_count===void 0||typeof e.attempt_count==="number"&&Number.isSafeInteger(e.attempt_count)&&e.attempt_count>=1&&e.attempt_count<=1e5)&&(e.retry_in_ms===void 0||typeof e.retry_in_ms==="number"&&Number.isSafeInteger(e.retry_in_ms)&&e.retry_in_ms>=0&&e.retry_in_ms<=30000)&&(e.capabilities===void 0||Array.isArray(e.capabilities)&&e.capabilities.length<=be&&e.capabilities.every((t)=>typeof t==="string"&&P.test(t)))}var Ve=/^(\d{22}-[0-9a-f-]{36}\.json)$/,Ue=/^(\d{22}-[0-9a-f-]{36}\.json)\.sending-(\d+)-[0-9a-f-]{36}$/,Fe=300000,w=0n;function Be(e){let t=BigInt(new Date(e.occurred_at).getTime())*1000000n;return w=t>w?t:w+1n,`${String(w).padStart(22,"0")}-${e.event_id}.json`}function ne(e){try{return z(e.lifecycleEvents).filter((t)=>Ve.test(t)).sort()}catch{return[]}}function V(e){try{let t=JSON.parse(Y(e,"utf8"));return te(t)?t:null}catch{return null}}function $e(e,t=ee,n=Date.now()){let r;try{r=z(e.lifecycleEvents)}catch{return}for(let i of r){let s=i.match(Ue);if(!s)continue;let o=c(e.lifecycleEvents,i),d=c(e.lifecycleEvents,s[1]),l=!t(Number(s[2]));if(!l)try{l=n-K(o).mtimeMs>=Fe}catch{continue}if(!l)continue;try{_(o,d)}catch(m){let u=m.code;if(u==="EEXIST")M(o);else if(u!=="ENOENT")throw m}}}function Ge(e){let n=ne(e).flatMap((i)=>{try{return[{name:i,size:K(c(e.lifecycleEvents,i)).size}]}catch{return[]}}),r=n.reduce((i,s)=>i+s.size,0);while(n.length>ye||r>ve){let i=n.shift();if(!i)break;try{M(c(e.lifecycleEvents,i.name)),r-=i.size}catch(s){if(s.code!=="ENOENT")throw s}}}function Zo(e,t,n={}){let r={schema_version:j,event_id:n.eventId?.()??f(),occurred_at:(n.now?.()??new Date).toISOString(),...t};if(!te(r))throw new tt("invalid_lifecycle_event","Managed runtime lifecycle event is invalid.");return S(e.lifecycleEvents),Re(c(e.lifecycleEvents,Be(r)),`${JSON.stringify(r)}
|
|
5
|
+
`),Ge(e),r}async function Xo(e,t,n){$e(e);let r=0;for(let i of ne(e)){let s=c(e.lifecycleEvents,i);if(n){let l=V(s);if(!l||!n(l))continue}let o=`${s}.sending-${process.pid}-${f()}`;try{_(s,o)}catch(l){if(l.code==="ENOENT")continue;throw l}let d=V(o);if(!d){M(o);continue}try{await t(d),M(o),r+=1}catch{try{_(o,s)}catch(l){if(l.code!=="ENOENT")throw l}break}}return r}export{Wo,Vo,Go,Ko,Jo,Zo,Xo};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var Ot=String.raw`(function(loadFfi, existsSync) {
|
|
3
3
|
const STARTF_USESTDHANDLES = 0x100;
|
|
4
4
|
const CREATE_SUSPENDED = 0x4;
|
|
5
5
|
const CREATE_UNICODE_ENVIRONMENT = 0x400;
|
|
@@ -242,4 +242,4 @@ var e=String.raw`(function(loadFfi, existsSync) {
|
|
|
242
242
|
}
|
|
243
243
|
return { available, unavailableReason, defaultShell, shellArgs, quoteArg, environmentBlock, spawn };
|
|
244
244
|
})`;
|
|
245
|
-
export{
|
|
245
|
+
export{Ot};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{C}from"./vm-hands-entry-lite-t7an5zg2.js";import{basename as ln}from"path";var rt=["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 g(n={}){let e=C(n.env??process.env,"REASON_CLI_CHANNEL")?.trim().toLowerCase();if(e){if(rt.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 Lt(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 Nr(n){let e;try{e=new URL(n).origin}catch{return n}let r=rt.find((t)=>U[t].includes(e));return r?Lt(r):e}function Wi(n,e){return n===e||Nr(n)===Nr(e)}function Vi(n,e){return rt.some((r)=>U[r].includes(n)&&e===Lt(r))}function Gi(n,e){try{let r=new URL(e);return!r.username&&!r.password&&(r.origin===Lt(n)||r.origin===A[n].api)}catch{return!1}}function Pn(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 I,mkdirSync as z,openSync as En,readdirSync as T,readFileSync as Kn,readlinkSync as R,renameSync as k,rmdirSync as Q,symlinkSync as S,unlinkSync as y}from"fs";import{createRequire as Nn}from"module";import{constants as Sn}from"os";import{basename as w,join as l,sep as kn}from"path";import{existsSync as D,lstatSync as j,readdirSync as pn,readFileSync as mn,readlinkSync as dn,realpathSync as yn}from"fs";import{join as d,sep as hn}from"path";function G(n,...e){let r=d(n,"ara"),t=d(n,"reason");if(!Lr(r))return d(t,...e);if(!D(t))return d(r,...e);return D(d(r,...e))&&!D(d(t,...e))?d(r,...e):d(t,...e)}function Lr(n){try{let e=j(n);if(!e.isSymbolicLink())return e.isDirectory();return dn(n)!=="reason"&&D(n)}catch{return!1}}function X(n,e=[]){if(!Lr(n))return!1;let r;try{r=[n,...pn(n,{withFileTypes:!0}).filter((t)=>t.isDirectory()).map((t)=>d(n,t.name))]}catch{return!1}return r.some((t)=>["connect","connect-once"].filter((i)=>!e.includes(d(t,i))).some((i)=>{let s=d(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 nt(n,e,r){let t=l(n,"ara");if(process.platform==="win32"||/[/\\]\.reason-ssh[/\\][^/\\]+[/\\]installer-home[/\\]\.config$/.test(n))return{state:m(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 ve(n,...e){return nt(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:${E(a)??"failed"}`;try{return{state:m(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=m(n);if(s?.isSymbolicLink())return R(n)===w(e)?{state:t?"renamed":"linked"}:{state:"kept"};if(!s){if(L(e))f(()=>y(e),"ENOENT");if(!(t||r.linkAlways)||!x(e))return{state:"absent"};let o=_(e,"link");S(w(e),o);try{f(()=>k(o,n),"EISDIR","ENOTEMPTY","EEXIST","ENOTDIR")}finally{f(()=>y(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(I(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=m(r);if(!t||L(r)){if(!t)S(w(r),r);try{n.exchange(e,r)}catch(o){if(L(r))f(()=>y(r),"ENOENT");return`config_rename_unavailable:${E(o)??"exchange_failed"}`}return null}if(!t.isDirectory())return"config_rename_unavailable:ENOTDIR";if(t.dev!==I(e).dev)return"config_rename_unavailable:EXDEV";let i=[_(r,"probe"),_(r,"probe")];try{S("a",i[0]),S("b",i[1]),n.exchange(i[0],i[1])}catch(o){return`config_rename_unavailable:${E(o)??"exchange_failed"}`}finally{for(let o of i)f(()=>y(o),"ENOENT")}let s=cn(r);for(let o of Cn){let u=m(l(r,o)),p=m(l(e,o));if(u&&p&&u.ino!==p.ino)z(`${s}-replaced`,{mode:448,recursive:!0}),k(l(r,o),l(`${s}-replaced`,o))}let a={linked:new Map,unitsKept:new Set};rn(e,r,"",a);let c=_(r,"rename");S(w(r),c);try{n.exchange(e,c)}catch(o){return f(()=>y(c),"ENOENT"),`config_rename_unavailable:${E(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 T(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=m(c);if(!u)continue;let p=m(o);if(u.isDirectory()){if(!p)f(()=>z(o,{mode:u.mode&4095}),"EEXIST"),q(o,u.mode&4095);if(x(o))rn(n,e,a,t)}else if(!p){if(u.isSymbolicLink())f(()=>S(R(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=T(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=m(s);if(!a)continue;if(!a.isDirectory()){if(!Y(Number(i[2])))f(()=>y(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=_(n,"claim");if(f(()=>k(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(!m(l(n,i))&&m(l(e,i))?.ino===s)f(()=>y(l(e,i)),"ENOENT");if(on(n,e,"",r),f(()=>Q(n),"ENOTEMPTY","EEXIST"))return;k(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 T(l(n,r))){let a=l(r,s),c=l(n,a),o=l(e,a),u=I(c),p=m(o);if(p&&u.ino===p.ino&&u.dev===p.dev){y(c);continue}if(u.isFile()&&p?.isFile()&&t?.linked.get(a)===p.ino){k(c,o);continue}if(i&&(P.has(s)||Z.has(s)))continue;if(!p){if(u.isFile()){if(f(()=>V(c,o),"EEXIST"))y(c)}else f(()=>k(c,o),"EEXIST","ENOTEMPTY");continue}if(u.isDirectory()&&p.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=m(n);if(!r)return!1;let t=m(e);if(!t)return!0;if(r.isDirectory()){if(!t.isDirectory())return!0;return T(n).some((i)=>an(l(n,i),l(e,i)))}if(r.isSymbolicLink())return!t.isSymbolicLink()||R(n)!==R(e);return r.ino!==t.ino||r.dev!==t.dev}function K(n){if(L(n))f(()=>y(n),"ENOENT")}function cn(n){return l(n,`.pre-rename-${new Date().toISOString().replace(/[:.]/g,"-")}-${J(3).toString("hex")}`)}function L(n){try{return I(n).isSymbolicLink()&&R(n)===w(n)}catch{return!1}}function x(n){let e=m(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 _(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 E(e)==="EPERM"}}function m(n){try{return I(n)}catch(e){if(E(e)==="ENOENT"||E(e)==="ENOTDIR")return null;throw e}}function f(n,...e){try{return n(),!0}catch(r){if(e.includes(E(r)??""))return!1;throw r}}function E(n){return n instanceof Error&&"code"in n&&typeof n.code==="string"?n.code:void 0}var v,On=2,Dn=4,Ln=2,Tn=2,H=-100;function An(){if(v!==void 0)return v;if(v=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 p=(N)=>{let b=n.read.i32(u),h=Object.entries(Sn.errno).find(([,O])=>O===b)?.[0]??`errno_${b}`;return Object.assign(Error(`${N} failed: ${h}`),{code:h})},F=(N)=>Buffer.from(`${N}\x00`,"utf8");return v={exchange(N,b){let h=F(N),O=F(b);if((e?o[a](n.ptr(h),n.ptr(O),Ln):o[a](H,n.ptr(h),H,n.ptr(O),Tn))!==0)throw p("exchange")},lock(N){let b=En(N,bn.O_RDONLY);if(o.flock(b,On|Dn)===0)return()=>B(b);let h=p("lock");if(B(b),h.code==="EWOULDBLOCK"||h.code==="EAGAIN")return null;throw h}},v}catch{}return null}
|
|
3
|
+
export{rt,g,Lt,Nr,Wi,Vi,Gi,Pn,Lr,nt,ve};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{statSync as f}from"fs";import{delimiter as l,join as d}from"path";function vt(e,o=process.env.PATH??"",i=process.env,u=process.platform){let r=u==="win32",a=e.includes("/")||r&&e.includes("\\");if(!e||a||e.includes("\x00"))return!1;let c=r?["",...(i.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";")]:[""];return o.split(l).some((t)=>{if(!t)return!1;return c.some((n)=>{if(n===void 0)return!1;try{let s=f(d(t,`${e}${n}`));if(!s.isFile())return!1;return r||(s.mode&73)!==0}catch{return!1}})})}
|
|
3
|
+
export{vt};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{g,Vi,ve}from"./vm-hands-entry-lite-5p5h1eng.js";import{l,Pt,Be,br,Tt,Sr,Qe}from"./vm-hands-entry-lite-dq1m5ykp.js";import{lt,Wt}from"./vm-hands-entry-lite-ym1djztp.js";import{Xr}from"./vm-hands-entry-lite-qffs74x1.js";import{B,m,ee,Ne}from"./vm-hands-entry-lite-et2bh990.js";import{F}from"./vm-hands-entry-lite-e5hbehqn.js";import{so}from"./vm-hands-entry-lite-wf7ksh4e.js";import{be,He,kn,Or}from"./vm-hands-entry-lite-hee1h411.js";import{f,b,h}from"./vm-hands-entry-lite-wyh6dp1t.js";import{a}from"./vm-hands-entry-lite-dkcm3hyn.js";import{fo,Wr,y,t,A,ht,o,d,Pe,u,i,c,_,Lo,s,n,Vr}from"./vm-hands-entry-lite-zn0v259d.js";import{closeSync as qh,existsSync as zh,mkdirSync as Kh,openSync as Vh,readdirSync as Jh,realpathSync as pe,rmSync as Gh}from"fs";import{dirname as Xh,join as J,resolve as Zh}from"path";import{createHash as At}from"crypto";import{platform as It}from"os";import{join as xt}from"path";var Ot=_("store",[c({version:n(1),store:n("keychain")}),c({version:n(1),store:n("file"),api_key:t().min(1).max(4096)})]),$e=(e)=>xt(e,"api-key.json");function Ue(e){let r=At("sha256").update(`reason-connect-api-key
|
|
3
|
+
${e}`).digest("hex");return new Be(Pt(),It(),r)}function ge(e,r=Ue(e)){if(!f($e(e)))return null;let p=Ot.parse(JSON.parse(h($e(e))));if(p.store==="file")return p.api_key;try{let k=r.loadBinding();return k?new TextDecoder().decode(k):null}catch(k){if(!(k instanceof l))throw k;throw Error("worker_api_key_unreadable")}}import{readdirSync as Xt,renameSync as Kn,rmSync as Vn}from"fs";import{join as te}from"path";import{createHash as Dt}from"crypto";import{platform as Nt}from"os";import{join as N}from"path";function w(e){return{state:N(m(e),"device.json"),control:N(m(e),"control.json"),lock:N(m(e),"lifecycle.lock"),socket:N(m(e),"control.sock"),daemon:N(m(e),"daemon.json"),releaseCheck:N(m(e),"release-check.json"),updateDeferral:N(m(e),"update-deferral.json"),firstHeartbeat:N(m(e),"first-heartbeat.json")}}var ln=i({version:n(1),device_id:t().min(1).max(160),offer:Pe().optional(),enrollment_ms:o().int().nonnegative().max(Wt).optional()});function z(e,r=!1){b(m(e),r);let p=["local-device.key","local-device.binding","device.json"].filter((k)=>{let S=N(m(e),k);if(!f(S))return!1;return h(S),!0});return e.lifetime==="persistent"&&p.join()==="device.json"?Ht(e):new br(m(e))}function Ht(e){return new Be(Pt(),Nt(),$t(e))}function $t(e){let r=Ft(e);return Dt("sha256").update(`reason-worker
|
|
4
|
+
${r?.directory??m(e)}`).digest("hex")}var Bt="keychain-scope.json";var Ut=c({version:n(1),directory:t().min(1),devicePublicKey:t().min(1)});function Ft(e){let r=N(m(e),Bt);if(!f(r))return null;let p=Ut.safeParse(JSON.parse(h(r))),k=w(e).state;if(!p.success||!f(k))return null;return JSON.parse(h(k))?.devicePublicKey===p.data.devicePublicKey?p.data:null}function M(e){if(!f(m(e)))return null;let r=Sr(w(e).state,{proofStore:z(e),repair:!1}),p=r!==null&&Vi(e.apiOrigin,r.apiOrigin),k=p?[ee(e),ee({...e,apiOrigin:r.apiOrigin})]:[ee(e)];if(r&&(!k.includes(r.worker?.configDigest??"")||r.worker.lifetime!==e.lifetime||r.apiOrigin!==e.apiOrigin&&!p||r.roots.length>32||r.roots[0]?.path!==e.workspaceRoot||r.handsSlots!==e.slots))throw Error("worker_config_binding_mismatch");return r}var jt=c({version:n(1),drained:d(),revoked:d()});function H(e){let r=w(e).control;return f(r)?jt.parse(JSON.parse(h(r))):{version:1,drained:!1,revoked:!1}}var zt=c({read:d(),write:d(),execute:d(),discover_environment:d(),expose_mcp:n(!1)}),Kt=c({version:n(1),organization_id:t().min(1).max(160),enrollment_ticket:t().min(1).max(4096),code_verifier:t().regex(/^[A-Za-z0-9._~-]{43,128}$/),root_fingerprint_key:t().regex(/^[a-f0-9]{64}$/),root:c({path_fingerprint:t().regex(/^[a-f0-9]{64}$/),permissions:zt,execution_mode:s(["confined","host"]).default("confined")}),folders:u(c({path_fingerprint:t().regex(/^[a-f0-9]{64}$/)})).min(1).max(31).optional()}),Sn=i({device_id:t().min(1).max(160),organization_id:t().min(1).max(160),auth_scheme:n("p256"),protocol_version:n(2),roots:u(i({id:t().min(1),label:t(),path_fingerprint:t()})).min(1).max(32),headless:i({lifecycle:s(["persistent","ephemeral"]),expires_at:y.datetime({offset:!0})}),first_heartbeat:Pe().optional()});var Un=c({version:n(1),install_id:A(),fingerprint_key:t().regex(/^[a-f0-9]{64}$/)}),Fn=i({enrollment_ticket:t().min(1).max(4096),expires_at:y.datetime({offset:!0}),device_kind:n("headless"),lifecycle:s(["persistent","ephemeral"]),device_expires_at:y.datetime({offset:!0})});var jn=i({credentialKind:s(["oauth","api_key"]).optional(),apiOrigin:ht(),clientId:t(),accessToken:t().min(1).max(32768),refreshToken:t().max(32768),expiresAt:y.datetime({offset:!0}),scopes:u(t().max(128)).max(128),orgId:t().min(1).max(160)});var ze=8;var Zt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,_e=(e)=>te(m(e),"workspaces"),Qt="account.json",er=(e)=>f(te(e,Qt));function Re(e){let r;try{r=Xt(_e(e))}catch{return[]}return r.filter((p)=>Zt.test(p)).sort().map((p)=>{let k=te(_e(e),p),S=te(k,"worker.json"),v=null;try{let P=B.safeParse(JSON.parse(h(S)));if(P.success&&P.data.stateDirectory===k)v=P.data}catch{}return{organizationId:p,directory:k,configPath:S,config:v,account:er(k)}})}var tr=(e)=>te(_e(e),"listed.json");function rr(e){try{let r=JSON.parse(h(tr(e))),p=r.names&&typeof r.names==="object"&&!Array.isArray(r.names)?Object.fromEntries(Object.entries(r.names).filter((k)=>typeof k[1]==="string")):{};return{listed:r.listed===!0,reason:r.reason==="sign_in"?"sign_in":null,blocked:Array.isArray(r.blocked)?r.blocked.filter((k)=>typeof k==="string"):[],names:p}}catch{return null}}function Ke(e,r){let p=Re(e),k=p.filter((E)=>E.account),S=p.filter((E)=>!E.account),v=rr(e),P=v&&!v.listed?v.reason:null,R=P||S.length===0&&v&&!v.listed?[]:S;if(k.length===0&&R.length===0&&(P||v&&!v.listed))return{workspaces:null,off:P};return{off:P,workspaces:[...k,...R].map(({organizationId:E,config:L,account:x})=>{let C=!1,T=null,D=!1,he=null;try{C=L?H(L).revoked:!1,T=L&&!C?M(L):null;let We=L?Qe(w(L).daemon):null;D=r&&!!T&&We?.state==="connected",he=D?Tt(We,T):null}catch{}return{...he?{permission_recovery:he}:{},organization_id:E,device_id:T?.deviceId??null,name:v?.names?.[E]??null,root:T?.roots[0]?{id:T.roots[0].id,permissions:T.roots[0].permissions}:null,state:C?"removed":D?"connected":"not_running",blocked:!x&&!C&&!D&&(v?.blocked.includes(E)??!1),...x?{account:!0}:{}}})}}import{readFileSync as nr}from"fs";function Jt(e){try{let r=JSON.parse(nr(`${e}.keep-awake.json`,"utf8"));return r!==null&&typeof r==="object"&&"version"in r&&r.version===1&&"enabled"in r&&r.enabled===!0?"battery_and_ac":void 0}catch(r){return r.code==="ENOENT"?"battery_and_ac":void 0}}import{chmodSync as Bi,lstatSync as et,mkdtempSync as Ui,realpathSync as ir,rmdirSync as Fi,rmSync as ji,unlinkSync as qi}from"fs";import{createConnection as ar,createServer as Ki}from"net";import{basename as Ye,dirname as Xe,join as oe}from"path";var sr=s(["status","drain","resume","stop","reload_roots"]),cr=c({version:n(1),instanceId:t(),deviceId:t(),phase:s(["starting","running","reconnecting","stopping"]),drained:d(),activeClaims:o().int().nonnegative(),activeSessions:o().int().nonnegative().optional(),executionEligible:d(),supportedOperations:u(s(lt)).max(lt.length).optional(),capabilityReadiness:Lo(s(lt),d()).optional(),lastHeartbeat:t().nullable(),expiresAt:t()}),Qi=c({nonce:t(),action:sr}),lr=i({nonce:A()}),dr=c({version:n(1),nonce:A(),socketPath:t().max(100)});function ur(e){return oe(w(e).lock,"control.json")}function tt(e){return b(w(e).lock),lr.parse(JSON.parse(h(oe(w(e).lock,"owner.json"))))}function Ze(e){if(!f(e))return!1;let r=et(e);if(!r.isSocket()||r.uid!==process.getuid?.()||(r.mode&63)!==0)throw Error("worker_control_socket_not_private");return!0}function rt(e,r){let p=ur(e);if(!f(p)){let v=w(e).socket;if(!f(v)||!et(v).isSocket())return null;return Ze(v)?v:null}let k=dr.parse(JSON.parse(h(p)));if(k.nonce!==r)throw Error("worker_instance_changed");if(process.platform==="win32"){if(!fr.test(k.socketPath))throw Error("worker_control_endpoint_invalid");return k.socketPath}let S=Xe(k.socketPath);if(Xe(S)!==ir("/tmp")||!/^(?:reason|ara)-worker-[A-Za-z0-9]{6}$/.test(Ye(S))||Ye(k.socketPath)!=="control.sock"||Buffer.byteLength(k.socketPath)>100)throw Error("worker_control_endpoint_invalid");if(!f(S))return null;return b(S),Ze(k.socketPath)?k.socketPath:null}var fr=/^\\\\\.\\pipe\\reason-worker-[0-9a-f-]{36}$/;function mr(e,r){try{let p=JSON.parse(h(oe(w(e).lock,"owner.json"))),k=p&&typeof p==="object"?p[r]:void 0;return typeof k==="string"?k:null}catch{return null}}function ot(e){return mr(e,"runtime_version")}function nt(e,r){if(r)return r.message==="worker_control_timeout"?"socket_timeout":"bad_reply";try{if(!f(oe(w(e).lock,"owner.json")))return"no_lock";return rt(e,tt(e).nonce)?"socket_refused":"no_socket"}catch{return"bad_reply"}}var ea=c({instance:t().nullable(),since:o().int().nonnegative()});async function G(e,r){let p=w(e);if(!f(oe(p.lock,"owner.json")))return null;let k=tt(e),S=rt(e,k.nonce);if(!S)return null;return new Promise((v,P)=>{let R=ar(S),E="",L=!1,x=(C,T)=>{if(L)return;if(L=!0,R.destroy(),T)P(T);else v(C)};R.setTimeout(2000,()=>R.destroy(Error("worker_control_timeout"))),R.on("connect",()=>R.write(JSON.stringify({nonce:k.nonce,action:r})+`
|
|
5
|
+
`)),R.on("data",(C)=>{if(E+=C.toString(),Buffer.byteLength(E)>16384)R.destroy(Error("worker_control_oversize"))}),R.on("error",(C)=>{if("code"in C&&["ECONNREFUSED","ENOENT"].includes(String(C.code)))x(null);else x(null,C.message==="worker_control_timeout"?C:Error("worker_control_unavailable"))}),R.on("end",()=>{try{let C=cr.parse(JSON.parse(E));if(C.instanceId!==k.nonce)throw Error("worker_instance_changed");x(C)}catch{x(null,Error("worker_control_invalid_response"))}}),R.once("close",()=>x(null,Error("worker_control_unavailable")))})}import{realpathSync as gr}from"fs";import{constants as Ee}from"fs";import{open as pr}from"fs/promises";var sa={platform:process.platform,home:a,async openFile(e){let r=await pr(e,Ee.O_RDONLY|Ee.O_NOFOLLOW|Ee.O_NONBLOCK);return{isFile:async()=>(await r.stat()).isFile(),close:()=>r.close()}}};var Fa=so(gr(process.execPath));var Ps=Buffer.from([0,255,3,4]);import{execFile as to}from"child_process";import{promisify as ro}from"util";var Rr=new RegExp("^/media/pr-screenshots/([0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})/([0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})/([a-z0-9][a-z0-9._-]*)\\.(png|jpe?g|gif|webp|webm|mp4)$","i");var Pr=new Set(["png","jpg","jpeg","gif","webp"]),Er=new Set(["webm","mp4"]);function Cr(e){if(!e)return null;try{return new URL(e).origin}catch{return null}}function st(e,r){let p;try{p=new URL(e)}catch{return null}let k=Cr(r),S=p.hostname==="ara.so"||p.hostname.endsWith(".ara.so")||p.hostname==="reasonmachines.ai"||p.hostname.endsWith(".reasonmachines.ai")||p.hostname==="reasonmachines.com"||p.hostname.endsWith(".reasonmachines.com");if(p.protocol!=="https:"||!S&&p.origin!==k||p.username||p.password||p.port||p.search||p.hash)return null;let v=Rr.exec(p.pathname);if(!v)return null;let P=v[1]?.toLowerCase(),R=v[2]?.toLowerCase(),E=v[3]?.toLowerCase(),L=v[4]?.toLowerCase();if(!P||!R||!E||!L)return null;let x=Pr.has(L)?"image":Er.has(L)?"video":null;if(!x)return null;let C=/^(before|after)[\s:_-]+/.exec(E),T=p.pathname.replace(/^\/media\//,"");return{url:p.toString(),storagePath:T,runId:P,artifactId:R,fileName:`${E}.${L}`,kind:x,phase:C?.[1]==="before"||C?.[1]==="after"?C[1]:null}}var Ar=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,ct=(e)=>Boolean(e&&typeof e==="object"&&!Array.isArray(e)),K=()=>{throw Error("cloud_browser_media_request_invalid")};function Ae(e){if(!ct(e)||Object.keys(e).some((v)=>!["runId","configuredMediaOrigin","media"].includes(v))||typeof e.runId!=="string"||!Ar.test(e.runId)||typeof e.configuredMediaOrigin!=="string"||e.configuredMediaOrigin.length>2048||!Array.isArray(e.media)||e.media.length<1||e.media.length>8)return K();let r;try{r=new URL(e.configuredMediaOrigin)}catch{return K()}if(r.protocol!=="https:"||r.username||r.password||r.port||!Ne(r.origin,{mode:"public_web"}).allowed)return K();let p=e.runId.toLowerCase(),k=new Set,S=e.media.map((v)=>{if(!ct(v)||Object.keys(v).some((R)=>!["url","sourceUrl","kind"].includes(R))||typeof v.url!=="string"||v.url.length>2048||typeof v.sourceUrl!=="string"||v.sourceUrl.length>8192||!["image","video"].includes(String(v.kind)))return K();let P=st(v.url,r.origin);if(!P||new URL(P.url).origin!==r.origin||P.runId!==p||P.kind!==v.kind||P.url!==v.url||k.has(v.url))return K();if(k.add(v.url),v.sourceUrl!==v.url){let R;try{R=new URL(v.sourceUrl)}catch{return K()}let E=/^\/(?:[a-f0-9]{40}|[a-f0-9]{64})\/([a-f0-9]+)$/.exec(R.pathname)?.[1];if(v.kind!=="image"||R.origin!=="https://camo.githubusercontent.com"||R.username||R.password||R.search||R.hash||!E||E.length%2!==0||Buffer.from(E,"hex").toString("utf8")!==v.url)return K()}return{url:v.url,sourceUrl:v.sourceUrl,kind:v.kind}});return{runId:e.runId,configuredMediaOrigin:r.origin,media:S}}var I=t().uuid(),X=t().regex(/^[a-f0-9]{64}$/),V=y.datetime({precision:3}),xe=t().regex(/^[a-zA-Z0-9_-]{1,160}$/),ft=t().max(2048).regex(/^https:\/\/github\.com\/[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+\/pull\/[1-9][0-9]*$/).refine((e)=>![".",".."].includes(e.split("/")[4])),U=i({kind:n("primary_mac"),version:n(1),organizationId:xe,userId:xe,sessionId:xe,runId:I,deviceId:I,rootId:I,rootRevision:t().min(1).max(64),binding:s(["workspace_source","mcp_control"]),targetRevision:o().int().nonnegative(),generation:I,profile:t().regex(/^(Default|Profile [0-9]+)$/),extensionInstanceId:t().min(1).max(1024)}).strict().refine((e)=>e.binding!=="workspace_source"||e.targetRevision===0),Ir=Vr().transform((e,r)=>{try{return Xr(e)}catch{return r.addIssue({code:"custom",message:"proof_visual_contract_invalid"}),fo}}),ue=i({version:n(1),owner:U,contextId:I,preparedAt:V,expiresAt:V,prUrl:ft,headSha:t().regex(/^[a-f0-9]{40}$/),skillDigest:X,evidenceKind:s(["image","video"]),visualPlan:Ir.optional(),uploadOrigin:t().url().refine((e)=>{let r=new URL(e);return r.protocol==="https:"&&r.origin===e&&!r.username&&!r.password}).optional()}).strict().refine((e)=>Date.parse(e.expiresAt)>Date.parse(e.preparedAt)&&Date.parse(e.expiresAt)-Date.parse(e.preparedAt)<=300000),xr=i({version:n(1),producer:n("primary_mac"),context:ue,captureId:I,operationId:I,attemptId:I,tabId:o().int().positive(),startedAt:V,finishedAt:V,sha256:X,media:_("contentType",[i({contentType:n("image/png"),sizeBytes:o().int().min(24).max(8388608),width:o().int().min(1).max(4096),height:o().int().min(1).max(4096)}).strict(),i({contentType:n("video/webm"),sizeBytes:o().int().min(128).max(10485760),durationSeconds:o().min(0.05).max(15),frameCount:o().int().min(1).max(450),receivedFrameCount:o().int().min(1).max(2000)}).strict()])}).strict().superRefine((e,r)=>{let p=Date.parse(e.startedAt),k=Date.parse(e.finishedAt);if(p<Date.parse(e.context.preparedAt)||k<p||k>Date.parse(e.context.expiresAt)||k-p>30000||e.media.contentType==="video/webm"&&(e.media.receivedFrameCount<e.media.frameCount||Math.abs((k-p)/1000-e.media.durationSeconds)>0.1))r.addIssue({code:"custom",message:"mac_pr_proof_capture_chronology_invalid"})}),vc=_("action",[i({action:n("screenshot"),context_id:I,tab_id:o().int().positive()}).strict(),i({action:n("start_video"),context_id:I,tab_id:o().int().positive(),seconds:o().int().min(1).max(15)}).strict(),i({action:n("stop_video"),recording_operation_id:I}).strict()]),fe=i({login:t().regex(/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,37}[a-zA-Z0-9])?$/),id:t().regex(/^[1-9][0-9]{0,19}$/).nullable()}).strict(),ce=t().regex(/^[1-9][0-9]{0,19}$/),le=i({version:n(1),owner:U,expectedActorId:ce.nullable(),repositoryId:ce,repositoryFullName:t().max(200).regex(/^[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+$/).refine((e)=>![".",".."].includes(e.split("/")[1]))}).strict(),Lr=["browser_unavailable","github_page_unavailable","identity_check_failed","operation_incomplete","attachment_unavailable"],Mr=_("status",[le.extend({status:n("ready"),observedActor:fe,checkedAt:V}),le.extend({status:n("not_ready"),reason:s(["authentication_required","identity_mismatch","authority_lost","unavailable"]),cause:s(Lr).optional()})]).refine((e)=>e.status!=="ready"||e.expectedActorId===null||e.observedActor.id===e.expectedActorId),Y=i({version:n(1),owner:U,expectedActorId:ce.nullable(),authenticatedActor:fe,attemptId:I,captureId:I,prUrl:ft,repositoryId:ce,headSha:t().regex(/^[a-f0-9]{40}$/),sha256:X,sizeBytes:o().int().min(128).max(10485760),contentType:n("video/webm")}).strict(),mt=t().regex(/^https:\/\/github\.com\/user-attachments\/assets\/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),Tr=_("status",[Y.extend({status:n("not_attempted"),reason:s(["authentication_required","attachment_unavailable","identity_mismatch","capture_invalid","authority_lost"])}),Y.extend({status:n("uncertain"),reason:n("upload_outcome_unknown")}),Y.extend({status:n("uploaded"),observedActor:fe,nativeUrl:mt,uploadedAt:V})]).refine((e)=>(e.expectedActorId===null||e.authenticatedActor.id===e.expectedActorId)&&(e.status!=="uploaded"||e.observedActor.id===e.authenticatedActor.id&&e.observedActor.login===e.authenticatedActor.login)),de=Y.extend({nativeUrl:mt,observedActor:fe,bodySha256:X}),Dr=_("status",[de.extend({status:n("incomplete"),reason:s(["authentication_required","identity_mismatch","playback_unverified","authority_lost"])}),de.extend({status:n("verified"),sourceSha256:X,width:o().int().min(1).max(4096),height:o().int().min(1).max(4096),durationSeconds:o().positive().max(30),advancedSeconds:o().min(0.05).max(10),advancedFrames:o().int().positive(),playbackRestored:n(!0),verifiedAt:V})]).refine((e)=>(e.expectedActorId===null||e.authenticatedActor.id===e.expectedActorId)&&e.observedActor.id===e.authenticatedActor.id&&e.observedActor.login===e.authenticatedActor.login&&(e.status!=="verified"||e.sourceSha256===e.sha256)),Nr=Vr().transform((e,r)=>{try{let p=Ae(e);if(p.media.some((k)=>k.kind!=="image"))throw Error();return p}catch{return r.addIssue({code:"custom",message:"proof_media_request_invalid"}),fo}}),Hr=_("action",[i({action:n("auth_check"),input:le}).strict(),i({action:n("prepare"),context:ue}).strict(),i({action:n("capture_png"),owner:U,contextId:I,tabId:o().int().positive()}).strict(),i({action:n("start_video"),owner:U,contextId:I,tabId:o().int().positive(),seconds:o().int().min(1).max(15)}).strict(),i({action:n("inspect_capture"),owner:U,captureId:I}).strict(),i({action:n("publish_video"),input:Y}).strict(),i({action:n("verify_png_media"),owner:U,media:Nr}).strict().refine((e)=>e.media.runId===e.owner.runId),i({action:n("verify_saved_media"),input:de}).strict(),i({action:n("publish_png"),owner:U,attemptId:I,captureId:I,sha256:X,sizeBytes:o().int().min(24).max(8388608),storagePath:t().max(512),uploadUrl:t().url().max(8192)}).strict()]);var $r=i({requestId:I,command:Hr}).strict();var Br={type:"object",required:["action"],properties:{action:{type:"string",enum:["screenshot","start_video","stop_video"]},context_id:{type:"string",format:"uuid"},tab_id:{type:"integer",minimum:1},seconds:{type:"integer",minimum:1,maximum:15},recording_operation_id:{type:"string",format:"uuid"}},additionalProperties:!1},dt={type:"string",format:"uuid",description:"capture_context_id from tools.pr.prepareProof."},ut={type:"integer",minimum:1,description:"An already-owned tab's id."},Sc={...Br,oneOf:[{type:"object",required:["action","context_id","tab_id"],additionalProperties:!1,properties:{action:{type:"string",const:"screenshot"},context_id:dt,tab_id:ut}},{type:"object",required:["action","context_id","tab_id","seconds"],additionalProperties:!1,properties:{action:{type:"string",const:"start_video"},context_id:dt,tab_id:ut,seconds:{type:"integer",minimum:1,maximum:15}}},{type:"object",required:["action","recording_operation_id"],additionalProperties:!1,properties:{action:{type:"string",const:"stop_video"},recording_operation_id:{type:"string",format:"uuid",description:"The recording_operation_id start_video returned."}}}]};var Ac=i({operationId:t().uuid(),attemptId:t().uuid(),contextId:t().uuid(),tabId:o().int().positive()}).strict();var Ur=String.raw`async (media) => {
|
|
6
|
+
const deadline = (promise) => {
|
|
7
|
+
let timer;
|
|
8
|
+
return Promise.race([promise, new Promise((_, reject) => {
|
|
9
|
+
timer = setTimeout(() => reject(new Error("media_decode_timeout")), 12000);
|
|
10
|
+
})]).finally(() => clearTimeout(timer));
|
|
11
|
+
};
|
|
12
|
+
const items = await Promise.all(media.map(async (item) => {
|
|
13
|
+
const element = document.createElement(item.kind === "image" ? "img" : "video");
|
|
14
|
+
document.body.append(element);
|
|
15
|
+
try {
|
|
16
|
+
if (item.kind === "image") {
|
|
17
|
+
element.src = item.sourceUrl;
|
|
18
|
+
await deadline(element.decode());
|
|
19
|
+
if (!element.complete || !element.naturalWidth || !element.naturalHeight) throw new Error("media_image_not_decoded");
|
|
20
|
+
return { ...item, width: element.naturalWidth, height: element.naturalHeight };
|
|
21
|
+
}
|
|
22
|
+
element.muted = true;
|
|
23
|
+
element.playsInline = true;
|
|
24
|
+
element.preload = "auto";
|
|
25
|
+
const loaded = new Promise((resolve, reject) => {
|
|
26
|
+
element.addEventListener("loadeddata", resolve, { once: true });
|
|
27
|
+
element.addEventListener("error", () => reject(new Error("media_video_not_decoded")), { once: true });
|
|
28
|
+
});
|
|
29
|
+
element.src = item.sourceUrl;
|
|
30
|
+
await deadline(loaded);
|
|
31
|
+
if (!element.videoWidth || !element.videoHeight || !Number.isFinite(element.duration) || element.duration <= 0) throw new Error("media_video_not_decoded");
|
|
32
|
+
const initial = element.currentTime;
|
|
33
|
+
await deadline(element.play());
|
|
34
|
+
await deadline(new Promise((resolve, reject) => {
|
|
35
|
+
let timer;
|
|
36
|
+
const check = () => {
|
|
37
|
+
if (element.error) { clearTimeout(timer); reject(new Error("media_video_not_decoded")); return; }
|
|
38
|
+
if (element.currentTime - initial >= 0.05) { clearTimeout(timer); resolve(); return; }
|
|
39
|
+
timer = setTimeout(check, 25);
|
|
40
|
+
};
|
|
41
|
+
element.addEventListener("pause", () => { clearTimeout(timer); reject(new Error("media_video_not_advancing")); }, { once: true });
|
|
42
|
+
check();
|
|
43
|
+
}));
|
|
44
|
+
return { ...item, width: element.videoWidth, height: element.videoHeight, advancedSeconds: element.currentTime - initial };
|
|
45
|
+
} finally {
|
|
46
|
+
if (item.kind === "video") element.pause();
|
|
47
|
+
element.removeAttribute("src");
|
|
48
|
+
element.remove();
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
return { verified: true, items };
|
|
52
|
+
}`;import{execFile as Fr}from"child_process";import{promisify as jr}from"util";var Tc=jr(Fr);var Xc=_("ok",[i({ok:n(!0),actor:i({login:t(),id:t().nullable()}).strict()}).strict(),i({ok:n(!1),reason:s(["authentication_required","identity_mismatch","attachment_unavailable"])}).strict()]),Zc=i({version:n("0.1.42"),metadata:i({extensionId:t(),extensionInstanceId:t(),nativeHostName:t()})});var tl=i({version:n(1),recording_operation_id:t().uuid(),proof_ready:n(!1),acknowledged_at:y.datetime()}).strict(),me=i({action:n("start"),request_id:t().uuid(),profile:t().regex(/^(Default|Profile [0-9]+)$/),tab_id:o().int().positive(),seconds:o().int().min(1).max(15)}).strict(),pt=i({action:n("inspect"),recording_operation_id:t().uuid()}).strict(),rl=_("action",[me,pt]),wt=i({recording_operation_id:t().uuid()}).strict(),Le={device_id:t().uuid(),root_id:t().uuid()},zr=_("action",[me.extend(Le),pt.extend(Le),wt.extend({...Le,action:n("stop")})]),ol=Wr(zr),nl=i({version:n(1),recordingId:t().uuid(),proofReady:n(!1),capture:i({captureId:t().uuid(),contentType:n("video/webm"),sha256:t().regex(/^[a-f0-9]{64}$/),sizeBytes:o().int().min(128).max(10485760),startedAt:y.datetime(),finishedAt:y.datetime(),durationSeconds:o().min(0.05).max(15),frameCount:o().int().min(1).max(450),receivedFrameCount:o().int().min(1).max(2000),owner:i({runId:t().uuid(),deviceId:t().uuid(),rootId:t().uuid(),rootRevision:t().max(64),profile:t().regex(/^(Default|Profile [0-9]+)$/),extensionInstanceId:t().min(1).max(1024),generation:t().uuid(),browserScope:t().max(128),tabId:o().int().positive()}).strict()}).strict().refine((e)=>e.receivedFrameCount>=e.frameCount&&Math.abs((Date.parse(e.finishedAt)-Date.parse(e.startedAt))/1000-e.durationSeconds)<=0.1)}).strict();var pl=me.extend({action:s(["start","inspect"]),recording_boot_generation:t().uuid(),recording_operation_id:t().uuid().optional(),recording_attempt_id:t().uuid().optional()}).strict();import{execFile as Kr}from"child_process";import{promisify as Jr}from"util";var yl=Jr(Kr);var Gr=s(["recording_failed","authority_lost","browser_timeout","cleanup_failed","no_frames","encoding_invalid","frame_invalid","timestamp_invalid","capture_bound","ack_failed","cancelled","detached","browser_changed","tab_not_owned","encoding_frames_failed","encoding_encode_failed","encoding_output_failed","encoding_probe_failed","encoding_probe_streams_failed","encoding_probe_dimensions_failed","encoding_probe_duration_failed","encoding_probe_frames_failed","encoding_probe_format_failed","encoding_decode_failed","encoding_pin_failed"]);var j=t().min(1).max(1024),gt=i({path:j,sha256:t().regex(/^[a-f0-9]{64}$/)}).strict(),Yr=i({owner:i({runId:j,deviceId:j,rootId:j,rootRevision:j,profile:t().regex(/^(Default|Profile [0-9]+)$/),extensionInstanceId:j,generation:j,browserScope:j,tabId:o().int().positive()}).strict(),socketPath:j,extensionId:t().regex(/^[a-p]{32}$/),nativeHostName:j,seconds:o().int().min(1).max(15),encoder:i({ffmpeg:gt,ffprobe:gt}).strict()}).strict();var $l=i({version:n("0.1.42"),metadata:i({extensionId:t(),extensionInstanceId:t(),nativeHostName:t()})});var Xl=i({operationId:t().uuid()}).strict();var yd=ro(to);var _d=i({version:n("0.1.42"),metadata:i({extensionId:n(F),extensionInstanceId:t().min(1).max(1024)})});var Me=1;var $f=c({type:n("configure"),protocol:n(Me),version:t(),config:B}),Bf=c({type:n("ticket"),organizationId:t().min(1).max(160),receipt:Pe()}),Uf=c({type:s(["ping","stop"])});var om=c({type:n("hello"),protocol:n(Me),version:t(),platform:s(["linux","darwin"]),architecture:s(["arm64","x64"]),enrolled:d()}),nm=c({type:n("ticket-request"),request:c({install_id:A(),code_challenge:t().regex(/^[A-Za-z0-9_-]{43}$/),lifecycle:s(["persistent","ephemeral"]),roots:u(c({path_fingerprint:t().regex(/^[a-f0-9]{64}$/),execution_mode:s(["confined","host"]),permissions:c({read:n(!0),write:n(!0),execute:n(!0),discover_environment:n(!0),expose_mcp:n(!1)})})).length(1)})}),im=_("type",[c({type:n("running"),deviceId:t().min(1).max(160),expiresAt:y.datetime({offset:!0}),lifetime:s(["persistent","ephemeral"]),supervision:n("ssh-foreground")}),c({type:n("pong")}),c({type:n("stopped")})]);var ko=1;var Z=A(),vo=c({kind:n("install_only"),authorityId:Z,organizationId:Z,userId:Z,connectionId:Z,attemptId:Z,purpose:n("install"),generation:o().int().positive(),transport:n("reverse_ssh"),expiresAt:y.datetime({offset:!0}),maxDurationMs:n(300000),maxChannels:n(1),allowTcpForwarding:n(!1),allowPty:n(!1)}),So=t().max(2048).superRefine((e,r)=>{let p;try{p=new URL(e)}catch{r.addIssue({code:"custom",message:"invalid relay url"});return}if(p.protocol!=="ws:"&&p.protocol!=="wss:"){r.addIssue({code:"custom",message:"invalid relay protocol"});return}if(p.username||p.password||p.search||p.hash){r.addIssue({code:"custom",message:"relay credentials or modifiers are not allowed"});return}let k=p.pathname.split("/");if(k.length!==4||k[1]!=="device"||!Z.safeParse(k[2]).success||!/^[a-f0-9]{64}$/.test(k[3]??""))r.addIssue({code:"custom",message:"invalid device relay path"});if(p.protocol==="ws:"&&!["127.0.0.1","[::1]"].includes(p.hostname))r.addIssue({code:"custom",message:"plaintext relay must be loopback"})});var cm=c({protocol:n(ko),type:n("ssh_install_relay"),authorityToken:t().regex(/^(?:reason|ara)_ssh_install_[A-Za-z0-9_-]{43}$/),authority:vo,relayUrl:So,endpoint:c({host:n("127.0.0.1"),port:n(22)})});class Et extends Error{}function Ie(e){if(!f(e))return null;let r=new Et(`${e} is not a valid worker config. Remove it to start over.`),p;try{p=JSON.parse(h(e))}catch(S){if(S instanceof SyntaxError)throw r;throw S}let k=B.safeParse(p);if(!k.success)throw r;return k.data}var Mo=200;var rh=c({version:n(1),session_ids:u(t().min(1).max(200)).max(Mo)});function Ge(e,r,p=!1){let k=To(e,r,p);return k.length===1?k[0]:J(ve(J(e,".config")),...Ct(r,p))}var Ct=(e,r)=>[...e==="production"?[]:[e],r?"connect-once":"connect"];function To(e,r,p=!1){let k=e;try{k=pe(e)}catch{}return["ara","reason"].map((S)=>J(k,".config",S,...Ct(r,p))).filter(Do)}function Do(e){try{if(pe(e)!==e)return!1;return Ie(J(e,"worker.json"))?.stateDirectory===e}catch{return!1}}var Wo="disconnected.json";function Bo(e,r){return f(J(Ge(e,r),Wo))}function No(e,r){return r==="darwin"&&e.userChrome!==!1}var Ow=i({root:i({id:t().min(1).max(160),label:t().max(160),path_fingerprint:t()})});var Lw=Symbol("serve here");async function Fo(e={}){let r=pe(e.home??a()),p=Ie(J(Ge(r,e.channel??g()),"worker.json"));if(!p)return null;let k,S=await(e.controlWorker??G)(p,"status").catch((D)=>(k=D instanceof Error?D:Error(String(D)),null)),v=S?ot(p):null,P=e.serviceHost??be(r),R=He(p,P,"connect"),E=H(p).revoked,L=!E&&!S,x=(()=>{try{return M(p)}catch{return null}})(),{workspaces:C,off:T}=E||ge(p.stateDirectory)!==null?{workspaces:null,off:null}:Ke(p,S?.phase==="running");return{workspaces:C,workspaces_off:T,workspaces_max:ze+(C?.filter((D)=>D.account).length??0),name:p.name,device_id:x?.deviceId??null,organization_id:x?.orgId??null,folder:p.workspaceRoot,mode:p.executionMode,sessions_max:null,user_chrome:No(p,P.platform),cloud_sessions:p.cloudSessions===!0,root:x?.roots[0]?{id:x.roots[0].id,permissions:x.roots[0].permissions}:null,roots:x?.roots.map((D)=>({id:D.id,folder:D.path,permissions:D.permissions}))??[],state:E?"removed":S?S.phase==="running"?"connected":S.phase:"not_running",not_running_reason:L?nt(p,k):null,worker_alive:L&&R?kn(R,P):null,sessions_running:S?.activeSessions??null,version:v,service:R?{label:R.label,logs:R.logs}:null}}function jo(e={}){let r=pe(e.home??a()),p=Ie(J(Ge(r,e.channel??g()),"worker.json"));if(!p)return null;return Or(p,e.serviceHost??be(r),"connect")?.label??null}export{w,M,Jt,Ie,Ge,Bo,Fo,jo};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qe,ot}from"./vm-hands-entry-lite-8evzzh7v.js";import{at}from"./vm-hands-entry-lite-8bzqc4xa.js";import{io,le,Fr,st,oo}from"./vm-hands-entry-lite-wf7ksh4e.js";import{E}from"./vm-hands-entry-lite-0n2f3kx7.js";import{a,Ut}from"./vm-hands-entry-lite-dkcm3hyn.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 Mr=(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(Ut(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 Ki(e,t){return E(e)&&!U(e,t)}function Ji(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 (${Fr(t)??"unknown"}; this CLI is ${at}) (${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 Ro(e=a()){let t=st(e);if(t.length>0)return{state:"ready",path:w(w(w(t[0]))),prefix:t};let s=oo(t,e)??"computer_use_identity_unavailable";return{state:s,path:le(e),detail:K(s,e)}}function V(){return{identity:()=>Ro(),grants:(e)=>qe(e),request:(e,t)=>ot(e,t),worker:async()=>(await import("./status-e7r62q4e.js")).connectionMacState(),open:(e)=>{H("/usr/bin/open",e,{stdio:"ignore",timeout:1e4})},tile:Mr,restartConnection:async()=>(await import("./connect-cli-m8xafyn5.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 Oo(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 fs(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 ms(e,t){let s=t.host??V(),{io:n}=t,r=await Oo(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
|
+
`),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
|
+
`);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
|
+
`),!t.wait)continue;if(n.stdout.write(`Waiting for it (Ctrl-C to stop)\u2026
|
|
6
|
+
`),await x(async()=>(await s.grants(d.prefix))?.[g]===!0,s).finally(I))n.stdout.write(`${p}: granted.
|
|
7
|
+
`),u=!0;else n.stderr.write(`${p} is not allowed yet; turn on Reason there, then run \`reason permissions\`.
|
|
8
|
+
`),c=!0;continue}let m=R(await s.worker()??{executable:null});if(!m){n.stderr.write(`Reason permissions: ${r.worker_detail} Then run \`reason permissions allow disk\`.
|
|
9
|
+
`),c=!0;continue}if(s.open([h]),s.open(["-R",m]),n.stdout.write(`Full Disk Access: click + and choose ${m} (shown in Finder), or drag it into the list.
|
|
10
|
+
`),!t.wait)continue;if(n.stdout.write(`Waiting for the worker to report it (Ctrl-C to stop)\u2026
|
|
11
|
+
`),await x(async()=>(await s.worker())?.full_disk_access==="granted",s))n.stdout.write(`Full Disk Access: granted.
|
|
12
|
+
`);else n.stderr.write("Full Disk Access is not reported yet. If you allowed it, `reason connect` restarts the worker with it.\n"),c=!0}if(u)try{if(await s.restartConnection())n.stdout.write(`This computer's Reason connection restarted to use them.
|
|
13
|
+
`)}catch(o){n.stderr.write(`This computer's Reason connection uses them after it restarts (\`reason connect\`): ${o instanceof Error?o.message:String(o)}
|
|
14
|
+
`)}return c?1:0}export{Ki,Ji,Mr,Ro,Oo,fs,ms};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{vt}from"./vm-hands-entry-lite-6p9c8nhf.js";import{fe,se,x}from"./vm-hands-entry-lite-zg3b0c08.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{spawn as J,spawnSync as ee}from"child_process";import{existsSync as y,mkdtempSync as ne,readFileSync as K,readdirSync as te,realpathSync as re,rmSync as oe,statSync as G}from"fs";import{platform as T,tmpdir as ie}from"os";import{dirname as M,join as c,win32 as w}from"path";import{fileURLToPath as ae,pathToFileURL as W}from"url";var le=["bwrap","socat","rg"],de=2000;var ce=3,L=4000,ue=new Set([".git",".hg",".svn","node_modules"]),me=["runAsHostUid","sysrq-trigger"],X=c(M(M(ae(import.meta.url))),"packages","sandbox-runtime"),pe=c(X,"src","index.ts"),z=!1;function Ii(){z=!0}function j(){return z?c(M(re(process.execPath)),"runtime","srt"):void 0}function P(){let e=c(j()??X,"vendor","srt-win");return c(e,process.arch,"srt-win.exe")}async function Y(){let e=j();if(e&&process.platform==="linux"&&!y(c(e,"vendor","seccomp",process.arch,"apply-seccomp")))throw Error("packaged_sandbox_runtime_vendor_missing");if(e&&process.platform==="win32"&&!y(P()))throw Error("packaged_sandbox_runtime_vendor_missing");if(e){let i=K(c(e,"sandbox-runtime.mjs"),"utf8");for(let s of me)if(!i.includes(s))throw Error(`packaged_sandbox_runtime_fork_missing:${s}`)}let n=(await import(e?W(c(e,"sandbox-runtime.mjs")).href:W(pe).href)).SandboxManager;if(!n||typeof n.initialize!=="function"||typeof n.wrapWithSandboxArgv!=="function")throw Error("sandbox-runtime does not expose the expected SandboxManager API.");return{SandboxManager:n}}function ge(e={}){if((e.platformName??T())!=="linux")return!1;let o=e.fileExists??y,n=e.readFile??((i)=>K(i,"utf8"));for(let i of["/.dockerenv","/run/.containerenv"])try{if(o(i))return!0}catch{}try{return/docker|containerd|kubepods|lxc|libpod/.test(n("/proc/1/cgroup"))}catch{return!1}}function we(e){return["/bin/true","/usr/bin/true"].find((t)=>e(t))??null}function Se(e,t){return e==="strict"?["--ro-bind","/","/","--unshare-pid","--unshare-user","--cap-drop","ALL","--proc","/proc","--",t]:["--ro-bind","/","/","--unshare-pid","--unshare-user","--bind","/proc","/proc","--",t]}function be(e,t){try{let o=ee("bwrap",Se(e,t),{stdio:"ignore",timeout:de});return!o.error&&o.status===0}catch{return!1}}function xe(e){let t=e.platformName??T(),o=e.fileExists??y;if(t==="win32")return(e.bash??fe)()&&o(P())?m??"strict":null;if(t!=="linux")return null;let n=e.hasExecutable??vt;if(!le.every((l)=>n(l)))return null;let i=we(o);if(!i)return null;let s=m??(e.containerized??ge({platformName:t})?"weak":"strict");return(e.probeNamespaces??((l)=>be(l,i)))(s)?s:null}var S=null,C=!1,p=null,F=null;var m=null,E=null,A=null,R=null,v=[],g=new Map;function D(){throw b("sandbox_mode_conflict"),new r("sandbox_unavailable","Sandbox process policy conflicts with an existing probe or session. Restart the worker.")}function Di(e){if(m!==null&&m!==e||C&&S!==null&&S!==e||E!==null&&E!==e)D();m=e}function b(e){if(!p)process.stderr.write(`Reason worker: confined commands are off (${e})
|
|
3
|
+
`);p=e}function dr(e){if(p)return!1;if(!C){if(S=xe(e??{}),C=!0,S&&!e)Ce()}return S!==null}function he(){return dr()?S:null}var _=null,h=0;function I(e,t){if(p)throw new r("sandbox_unavailable","Confined execution is unavailable in this worker process.");if(m&&e.sandboxMode&&m!==e.sandboxMode)D();let o=m??e.sandboxMode??he();if(!o)throw new r("sandbox_unavailable","Confined command execution is unavailable on this operating system.");if(E&&E!==o)D();return E=o,_??=(async()=>{let{SandboxManager:n}=await(e.loadSandboxRuntime??Y)();return await n.initialize(Ne(o,t)),n})().catch((n)=>{if(_=null,t)A=null,process.stderr.write(`Reason worker: the Windows sandbox did not start for this folder (${String(n).slice(0,500)})
|
|
4
|
+
`);else b(`initialize_failed: ${String(n)}`);throw n instanceof r?n:new r("sandbox_unavailable","The confined execution sandbox failed to start.")}),_.then((n)=>{if(p)throw new r("sandbox_unavailable","Confined execution became unavailable during sandbox initialization.");return n})}function O(){if(h-=1,h===0)for(let e of v.splice(0))e()}async function ye(e,t=!0,o,n){let i=n===void 0?1/0:Date.now()+n;await Q();let s=_e();if(t)await s;let a=JSON.stringify(e),l=!1,u=()=>{if(!l)return;l=!1;let d=(g.get(a)??1)-1;if(d>0)g.set(a,d);else g.delete(a)};try{for(;;){if(o?.aborted)throw new r("cancelled","Operation was cancelled.");if(Date.now()>=i)return!1;if(R){await R;continue}let d=g.keys().next().value;if(A??=d??a,A===a&&(d===void 0||d===a))break;if(!l){l=!0,g.set(a,(g.get(a)??0)+1);continue}if(h===0&&d===a){Pe();continue}await new Promise((f)=>{if(v.push(f),o?.addEventListener("abort",()=>f(),{once:!0}),i!==1/0)setTimeout(f,Math.max(0,i-Date.now())).unref?.()})}return h+=1,!0}finally{if(l&&h===0)for(let d of v.splice(0))d();u()}}function Pe(){return R??=Me().finally(()=>{R=null}),R}function Ee(e,t,o=process.env){let n=o.USERPROFILE?w.resolve(o.USERPROFILE).toLowerCase():null,i=w.resolve(e).toLowerCase(),s=n!==null&&i.startsWith(`${n}\\`),a=t?q(o).filter((l)=>l.toLowerCase()===i||l.toLowerCase().startsWith(`${i}\\`)):[];return{denyRead:[],allowRead:[e],allowWrite:t?[e]:[],denyWrite:t?a:s?[]:[e]}}function q(e,t=process.execPath){let o=new Map;for(let n of[...(e.PATH??e.Path??"").split(";"),w.dirname(t)]){if(!n||!w.isAbsolute(n))continue;let i=w.resolve(n);if(!o.has(i.toLowerCase()))o.set(i.toLowerCase(),i)}return[...o.values()]}function Re(e=process.env,t=process.execPath){let o=[e.SystemRoot,e.ProgramFiles,e["ProgramFiles(x86)"],e.ProgramW6432,e.ProgramData,e.USERPROFILE].filter((n)=>!!n).map((n)=>w.resolve(n).toLowerCase());return q(e,t).filter((n)=>{let i=n.toLowerCase();return!o.some((s)=>i===s||i.startsWith(`${s}\\`))})}var U=null,H=null;function Q(e=P()){return H??=(async()=>{let t;try{t=JSON.parse((await V(e,["status"])).stdout).user?.user?.sid}catch{return null}if(typeof t!=="string"||!/^S-1-[0-9-]+$/.test(t))return null;if(!await new Promise((n)=>{let i=J(x("icacls"),[e,"/grant",`*${t}:(RX)`],{stdio:"ignore",windowsHide:!0,timeout:30000});i.on("error",()=>n(!1)),i.on("close",(s)=>n(s===0))}))process.stderr.write(`Reason worker: could not let the Windows sandbox user run srt-win.exe
|
|
5
|
+
`);return t})(),H}function V(e,t,o){return new Promise((n)=>{let i=J(e,t,{stdio:["pipe","pipe","ignore"],windowsHide:!0,timeout:120000}),s="";i.stdout?.setEncoding("utf8").on("data",(a)=>{s+=a}),i.on("error",()=>n({status:null,stdout:s})),i.on("close",(a)=>n({status:a,stdout:s})),i.stdin?.end(o??"")})}function _e(e=P()){return U??=(async()=>{let t=Re();if(t.length===0)return;let o=await Q(e),n=o?await V(e,["acl","stamp","--holder-pid",String(process.ppid),"--sandbox-user-sid",o],JSON.stringify({denyRead:[],denyWrite:t})):null;if(!n||n.status!==0&&n.status!==2)b(`program_folder_deny_failed: ${n?`exit ${n.status}`:"no sandbox user"}`),process.stderr.write(`Reason worker: could not deny the Windows sandbox writes to PATH folders (${n?`exit ${n.status}`:"no sandbox user"}); confined commands are off
|
|
6
|
+
`)})(),U}var Ae=`h=$(mktemp -d) || exit 125; trap 'rm -rf "$h"' EXIT; mkdir -p "$h/AppData/Roaming" "$h/AppData/Local"; w=$(cygpath -w "$h"); export HOME="$h" USERPROFILE="$w" APPDATA="$w\\AppData\\Roaming" LOCALAPPDATA="$w\\AppData\\Local" TEMP="$w" TMP="$w"; `;async function Me(){let e=_;if(_=null,A=null,!e)return;try{await(await e).reset()}catch{}}async function Ce(e={}){if(p)return!1;if(e.loadSandboxRuntime)return B(e.loadSandboxRuntime);if(!dr())return!1;return F??=B(Y),F}async function B(e){try{let{SandboxManager:t}=await e();if(process.platform==="win32"){if(!y(P()))b("dependencies_missing: srt-win.exe");return!p}let o=t.checkDependencies().errors;if(o.length>0)return b(`dependencies_missing: ${o.join(", ")}`),!1;return!p}catch(t){return b(`load_failed: ${String(t)}`),!1}}function sn(e=y,t=T()){if(t==="win32")return se("win32");return["/bin/bash","/bin/sh"].find((o)=>e(o))??"/bin/sh"}function ve(e){return e.map((t)=>`'${t.replaceAll("'","'\\''")}'`).join(" ")}function De(e,t,o=(n)=>te(n,{withFileTypes:!0}).filter((i)=>i.isDirectory()||i.isFile()).map((i)=>i.name)){let n=[],i=[{path:e,depth:0}],s=0;while(i.length>0&&s<L){let a=i.pop(),l;try{l=o(a.path)}catch{continue}for(let u of l){if(s+=1,s>L)break;let d=c(a.path,u);if(t(d)){n.push(d);continue}if(a.depth+1<ce&&!ue.has(u))i.push({path:d,depth:a.depth+1})}}return n}function Te(e){let t=c(e.root,".git"),o=[];try{if(G(t).isDirectory())o=[c(t,"config"),c(t,"hooks")]}catch{}return{denyRead:["/home","/root","/tmp","/tmp/.X11-unix",...e.protectedPaths],allowRead:[e.root,e.temporaryDirectory],allowWrite:[...e.allowWrite?[e.root]:[],e.temporaryDirectory],denyWrite:[...e.protectedPaths,...o]}}function ke(e,t){let o=c(t,".git"),n=[];try{if(G(o).isDirectory())n=[c(o,"config"),c(o,"hooks")]}catch{}return{denyRead:[...e],allowRead:[],allowWrite:[],denyWrite:[...e,...n]}}function Ne(e,t){if(t)return{network:{allowedDomains:[],deniedDomains:[]},filesystem:t,windows:{srtWin:{path:P()}}};return{network:{allowedDomains:[],deniedDomains:[]},filesystem:{denyRead:[],allowRead:[],allowWrite:[],denyWrite:[]},...e==="weak"?{enableWeakerNestedSandbox:!0}:{}}}function Ni(e){let t=e.createTemporaryDirectory??(()=>ne(c(ie(),"reason-device-"))),o=e.removeTemporaryDirectory??((n)=>oe(n,{recursive:!0,force:!0}));return async(n,i,s)=>{let a=process.platform==="win32",l;if(a){let d=Ee(s.root,s.allowWrite);if(!await ye(d,!s.workerProbe,s.signal,s.timeoutMs))return{exitCode:null,signal:null,stdout:"",stderr:"",timedOut:!0,truncated:!1};try{l=await I(e,d)}catch(f){throw O(),f}}else l=await I(e),h+=1;let u;try{u=t();let d=De(s.root,e.isProtectedPath),f;try{f=await l.wrapWithSandboxArgv((a?Ae:"")+ve([n,...i]),e.shell??sn(),{filesystem:a?ke(d,s.root):Te({root:s.root,allowWrite:s.allowWrite,temporaryDirectory:u,protectedPaths:d})},s.signal,s.cwd)}catch(N){throw N instanceof r?N:new r("sandbox_unavailable","The confined execution sandbox could not wrap the command.")}let[k,...Z]=f.argv;if(!k)throw new r("sandbox_unavailable","The confined execution sandbox produced no command.");return await e.spawnCaptured(k,Z,{cwd:s.cwd,timeoutMs:s.timeoutMs,signal:s.signal,env:a?f.env:e.scrubEnvironment(s.root,u)})}finally{O();try{l.cleanupAfterCommand()}catch{}if(u!==void 0)o(u)}}}
|
|
7
|
+
export{Ii,Di,dr,sn,Ni};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as ie,spawn as E}from"child_process";var Zi="h264_ws_v1",Xi="video",it=["smooth","sharp","data_saver","balanced"];var Yi="video_presets";var L=8388608,v=65536,Qi="control",eo="v1",J=200;function Tn(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t,n=(i)=>typeof i==="string"&&i.length>0&&i.length<=J;if(Object.keys(e).length!==2||!n(e.user_id)||!n(e.name))return null;return{user_id:e.user_id,name:e.name}}var to="windows",ro="v1",m=200,z=(t)=>typeof t==="string"&&it.includes(t);function no(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t;if(Object.keys(e).length!==2||e.format!=="h264_ws_v1"||!z(e.preset))return null;return{format:"h264_ws_v1",preset:e.preset}}var o={hello:1,frame:2,stats:3,pong:4,serverClipboard:5,error:6,audioHello:7,audio:8,control:9,windows:10,pointer:16,key:17,config:18,ping:19,clientClipboard:20,keyframeRequest:21,ack:22,audioEnable:23};class l extends Error{constructor(t){super(t);this.name="DisplayVideoProtocolError"}}var Z=new TextEncoder,Q=new TextDecoder("utf-8",{fatal:!0});function p(t,e){if(e.byteLength+1>L)throw new l("message_too_large");let n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,e.byteLength+1),i.setUint8(4,t),n.set(e,5),n}function y(t){let e=Z.encode(t);if(e.byteLength>v)throw new l("text_too_large");return e}function O(t,e){if(!Number.isInteger(t)||t<0||t>65535)throw new l(`invalid_${e}`);return t}function ee(t){if(!Number.isFinite(t))throw new l("invalid_window");return Math.max(-2147483648,Math.min(2147483647,Math.round(t)))}function $r(t){switch(t.type){case"hello":{let e=y(t.codec),n=new Uint8Array(6+e.byteLength),i=new DataView(n.buffer);return i.setUint16(0,O(t.width,"width")),i.setUint16(2,O(t.height,"height")),i.setUint8(4,Math.max(1,Math.min(240,Math.round(t.fps)))),i.setUint8(5,it.indexOf(t.preset)),n.set(e,6),p(o.hello,n)}case"frame":{let e=new Uint8Array(13+t.data.byteLength),n=new DataView(e.buffer);return n.setUint8(0,t.key?1:0),n.setUint32(1,t.seq>>>0),n.setBigUint64(5,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,13),p(o.frame,e)}case"stats":return p(o.stats,y(JSON.stringify(t.stats)));case"pong":case"ping":{let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,t.token),p(t.type==="ping"?o.ping:o.pong,e)}case"serverClipboard":return p(o.serverClipboard,y(t.text));case"clientClipboard":return p(o.clientClipboard,y(t.text));case"error":return p(o.error,y(t.code));case"pointer":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint16(0,O(t.x,"x")),n.setUint16(2,O(t.y,"y")),n.setUint8(4,t.buttons&255),p(o.pointer,e)}case"key":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint8(0,t.down?1:0),n.setUint32(1,t.keysym>>>0),p(o.key,e)}case"config":return p(o.config,Uint8Array.of(it.indexOf(t.preset)));case"keyframeRequest":return p(o.keyframeRequest,new Uint8Array(0));case"audioHello":{let e=y(t.codec),n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,t.sampleRate>>>0),i.setUint8(4,t.channels&255),n.set(e,5),p(o.audioHello,n)}case"audio":{let e=new Uint8Array(8+t.data.byteLength);return new DataView(e.buffer).setBigUint64(0,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,8),p(o.audio,e)}case"control":return p(o.control,y(JSON.stringify(t.control)));case"windows":{let e=t.bounds.slice(0,m),n=new Uint8Array(e.length*16),i=new DataView(n.buffer);return e.forEach((s,a)=>{[s.x,s.y,s.width,s.height].forEach((c,d)=>i.setInt32(a*16+d*4,ee(c)))}),p(o.windows,n)}case"audioEnable":return p(o.audioEnable,Uint8Array.of(t.on?1:0));case"ack":{let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t.seq>>>0),p(o.ack,e)}}}function M(t){let e=it[t];if(!e)throw new l("invalid_preset");return e}function w(t,e){if(t.byteLength!==e)throw new l("invalid_length")}function S(t){if(t.byteLength>v)throw new l("text_too_large");try{return Q.decode(t)}catch{throw new l("invalid_text")}}function te(t){let e;try{e=JSON.parse(S(t))}catch{throw new l("invalid_stats")}let n=e;if(!n||typeof n!=="object"||["fps","kbps","dropped","restarts","queued_bytes"].some((s)=>typeof n[s]!=="number"||!Number.isFinite(n[s])))throw new l("invalid_stats");return{fps:n.fps,kbps:n.kbps,dropped:n.dropped,restarts:n.restarts,queued_bytes:n.queued_bytes}}function ne(t){let e;try{e=JSON.parse(S(t))}catch{throw new l("invalid_control")}let n=e;if(!n||typeof n!=="object"||typeof n.you!=="boolean"||typeof n.same_user!=="boolean")throw new l("invalid_control");let i=n.holder===null?null:Tn(n.holder);if(i===null&&n.holder!==null)throw new l("invalid_control");return{holder:i,you:n.you,same_user:n.same_user}}function re(t,e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(t){case o.hello:if(e.byteLength<6)throw new l("invalid_length");return{type:"hello",width:n.getUint16(0),height:n.getUint16(2),fps:n.getUint8(4),preset:M(n.getUint8(5)),codec:S(e.subarray(6))};case o.frame:if(e.byteLength<14)throw new l("invalid_length");if(n.getUint8(0)>1)throw new l("invalid_frame_flags");return{type:"frame",key:n.getUint8(0)===1,seq:n.getUint32(1),captureMicros:Number(n.getBigUint64(5)),data:e.subarray(13)};case o.stats:return{type:"stats",stats:te(e)};case o.ping:case o.pong:return w(e,8),{type:t===o.ping?"ping":"pong",token:n.getFloat64(0)};case o.serverClipboard:return{type:"serverClipboard",text:S(e)};case o.clientClipboard:return{type:"clientClipboard",text:S(e)};case o.error:return{type:"error",code:S(e)};case o.pointer:return w(e,5),{type:"pointer",x:n.getUint16(0),y:n.getUint16(2),buttons:n.getUint8(4)};case o.key:if(w(e,5),n.getUint8(0)>1)throw new l("invalid_key_flags");return{type:"key",down:n.getUint8(0)===1,keysym:n.getUint32(1)};case o.config:return w(e,1),{type:"config",preset:M(n.getUint8(0))};case o.keyframeRequest:return w(e,0),{type:"keyframeRequest"};case o.audioHello:if(e.byteLength<5)throw new l("invalid_length");return{type:"audioHello",sampleRate:n.getUint32(0),channels:n.getUint8(4),codec:S(e.subarray(5))};case o.audio:if(e.byteLength<9)throw new l("invalid_length");return{type:"audio",captureMicros:Number(n.getBigUint64(0)),data:e.subarray(8)};case o.audioEnable:if(w(e,1),n.getUint8(0)>1)throw new l("invalid_audio_flags");return{type:"audioEnable",on:n.getUint8(0)===1};case o.control:return{type:"control",control:ne(e)};case o.windows:{if(e.byteLength%16!==0||e.byteLength>m*16)throw new l("invalid_length");let i=[];for(let s=0;s<e.byteLength;s+=16)i.push({x:n.getInt32(s),y:n.getInt32(s+4),width:n.getInt32(s+8),height:n.getInt32(s+12)});return{type:"windows",bounds:i}}case o.ack:return w(e,4),{type:"ack",seq:n.getUint32(0)};default:return null}}class Rn{buffer=new Uint8Array(0);push(t){let e=new Uint8Array(this.buffer.byteLength+t.byteLength);e.set(this.buffer),e.set(t,this.buffer.byteLength);let n=[],i=0;while(e.byteLength-i>=4){let s=new DataView(e.buffer,e.byteOffset+i,4).getUint32(0);if(s<1||s>L)throw new l("invalid_message_length");if(e.byteLength-i-4<s)break;let a=e[i+4],c=e.slice(i+5,i+4+s),d=re(a,c);if(d)n.push(d);i+=4+s}return this.buffer=e.slice(i),n}}var Y="/usr/bin/osascript",se=5000,oe=1048576,ae=String.raw`
|
|
3
|
+
ObjC.import("CoreGraphics");
|
|
4
|
+
ObjC.import("ApplicationServices");
|
|
5
|
+
ObjC.import("AppKit");
|
|
6
|
+
ObjC.bindFunction("CGPreflightScreenCaptureAccess", ["bool", []]);
|
|
7
|
+
ObjC.bindFunction("CGRequestScreenCaptureAccess", ["bool", []]);
|
|
8
|
+
ObjC.bindFunction("getppid", ["int", []]);
|
|
9
|
+
function run(argv) {
|
|
10
|
+
const bounds = $.CGDisplayBounds($.CGMainDisplayID());
|
|
11
|
+
const stdout = $.NSFileHandle.fileHandleWithStandardOutput;
|
|
12
|
+
const screen = $.CGPreflightScreenCaptureAccess(), accessibility = $.AXIsProcessTrusted();
|
|
13
|
+
stdout.writeData($(JSON.stringify({ screen, accessibility,
|
|
14
|
+
width: bounds.size.width, height: bounds.size.height }) + "\n").dataUsingEncoding($.NSUTF8StringEncoding));
|
|
15
|
+
if (argv[0] === "request") {
|
|
16
|
+
if (!screen && argv[1] !== "accessibility") $.CGRequestScreenCaptureAccess();
|
|
17
|
+
if (!accessibility && argv[1] !== "screen") $.AXIsProcessTrustedWithOptions($({ AXTrustedCheckOptionPrompt: true }));
|
|
18
|
+
}
|
|
19
|
+
if (argv[0] === "probe" || argv[0] === "request") return;
|
|
20
|
+
if (argv[0] === "clipboard") {
|
|
21
|
+
const parent = $.getppid(), clipboard = $.NSPasteboard.generalPasteboard;
|
|
22
|
+
// Only changes made during this pairing: never export the initial pasteboard.
|
|
23
|
+
let last = Number(clipboard.changeCount);
|
|
24
|
+
while ($.getppid() === parent) {
|
|
25
|
+
$.NSThread.sleepForTimeInterval(0.1);
|
|
26
|
+
const count = Number(clipboard.changeCount);
|
|
27
|
+
if (count === last) continue;
|
|
28
|
+
last = count;
|
|
29
|
+
const text = clipboard.stringForType($.NSPasteboardTypeString);
|
|
30
|
+
if (!text) continue;
|
|
31
|
+
const bytes = text.dataUsingEncoding($.NSUTF8StringEncoding);
|
|
32
|
+
if (Number(bytes.length) > ${v}) continue;
|
|
33
|
+
stdout.writeData($("c " + bytes.base64EncodedStringWithOptions(0).js + "\n").dataUsingEncoding($.NSUTF8StringEncoding));
|
|
34
|
+
}
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const stdin = $.NSFileHandle.fileHandleWithStandardInput;
|
|
38
|
+
let pending = "";
|
|
39
|
+
for (;;) {
|
|
40
|
+
const data = stdin.availableData;
|
|
41
|
+
if (Number(data.length) === 0) return;
|
|
42
|
+
pending += $.NSString.alloc.initWithDataEncoding(data, $.NSUTF8StringEncoding).js;
|
|
43
|
+
for (let end = pending.indexOf("\n"); end >= 0; end = pending.indexOf("\n")) {
|
|
44
|
+
const [kind, ...rest] = pending.slice(0, end).split(" ");
|
|
45
|
+
pending = pending.slice(end + 1);
|
|
46
|
+
const n = rest.map(Number);
|
|
47
|
+
let event = null;
|
|
48
|
+
if (kind === "m") {
|
|
49
|
+
event = $.CGEventCreateMouseEvent($(), n[0], { x: n[1], y: n[2] }, n[3]);
|
|
50
|
+
$.CGEventSetIntegerValueField(event, $.kCGMouseEventClickState, n[4]);
|
|
51
|
+
} else if (kind === "w") {
|
|
52
|
+
event = $.CGEventCreateScrollWheelEvent($(), $.kCGScrollEventUnitPixel, 2, n[0], n[1]);
|
|
53
|
+
} else if (kind === "k") {
|
|
54
|
+
event = $.CGEventCreateKeyboardEvent($(), n[0], n[1] === 1);
|
|
55
|
+
} else if (kind === "u") {
|
|
56
|
+
event = $.CGEventCreateKeyboardEvent($(), 0, n[0] === 1);
|
|
57
|
+
const unit = Ref("unsigned short");
|
|
58
|
+
unit[0] = n[1];
|
|
59
|
+
$.CGEventKeyboardSetUnicodeString(event, 1, unit);
|
|
60
|
+
} else if (kind === "c") {
|
|
61
|
+
const bytes = $.NSData.alloc.initWithBase64EncodedStringOptions($(rest[0] || ""), 0);
|
|
62
|
+
$.NSPasteboard.generalPasteboard.clearContents;
|
|
63
|
+
$.NSPasteboard.generalPasteboard.setStringForType($.NSString.alloc.initWithDataEncoding(bytes, $.NSUTF8StringEncoding), $.NSPasteboardTypeString);
|
|
64
|
+
}
|
|
65
|
+
if (event) {
|
|
66
|
+
$.CGEventSetFlags(event, n[n.length - 1]);
|
|
67
|
+
$.CGEventPost($.kCGHIDEventTap, event);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`;function q(t){let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!=="object")return null;let n=e,i=(c)=>typeof c==="number"&&Number.isFinite(c)?Math.min(65535,Math.round(c)):0;if(typeof n.screen!=="boolean"||typeof n.accessibility!=="boolean")return null;let s=i(n.width),a=i(n.height);return s>0&&a>0?{screen:n.screen,accessibility:n.accessibility,width:s,height:a}:null}function k(t,...e){let[n,...i]=[...t,Y,"-l","JavaScript","-e",ae,...e];return[n,i]}function H(t,...e){return new Promise((n)=>{ie(...k(t,...e),{env:{},timeout:se,killSignal:"SIGKILL",maxBuffer:65536,encoding:"utf8"},(i,s)=>n(i?null:q(s.split(`
|
|
73
|
+
`)[0]??"")))})}function qe(t=[]){return H(t,"probe")}function ot(t,e){return H(t,"request",...e?[e]:[])}var N=2,ce=8,ue=String.raw`
|
|
74
|
+
ObjC.import("CoreGraphics");
|
|
75
|
+
ObjC.import("Foundation");
|
|
76
|
+
ObjC.bindFunction("getppid", ["int", []]);
|
|
77
|
+
function run() {
|
|
78
|
+
const stdout = $.NSFileHandle.fileHandleWithStandardOutput;
|
|
79
|
+
const parent = $.getppid();
|
|
80
|
+
let last = "";
|
|
81
|
+
let wait = ${N};
|
|
82
|
+
// Ends with the worker that started it, even one that never got to kill it.
|
|
83
|
+
while ($.getppid() === parent) {
|
|
84
|
+
const list = ObjC.castRefToObject($.CGWindowListCopyWindowInfo($.kCGWindowListOptionOnScreenOnly | $.kCGWindowListExcludeDesktopElements, 0));
|
|
85
|
+
const bounds = [];
|
|
86
|
+
const count = Number(list.count);
|
|
87
|
+
for (let i = 0; i < count && bounds.length < ${m}; i++) {
|
|
88
|
+
const window = list.objectAtIndex(i);
|
|
89
|
+
if (Number(window.objectForKey("kCGWindowLayer").js) !== 0) continue;
|
|
90
|
+
const b = window.objectForKey("kCGWindowBounds");
|
|
91
|
+
bounds.push(["X", "Y", "Width", "Height"].map((key) => Math.round(Number(b.objectForKey(key).js))));
|
|
92
|
+
}
|
|
93
|
+
const line = JSON.stringify(bounds);
|
|
94
|
+
if (line !== last) {
|
|
95
|
+
last = line;
|
|
96
|
+
wait = ${N};
|
|
97
|
+
stdout.writeData($(line + "\n").dataUsingEncoding($.NSUTF8StringEncoding));
|
|
98
|
+
} else {
|
|
99
|
+
wait = Math.min(wait * 2, ${ce});
|
|
100
|
+
}
|
|
101
|
+
$.NSThread.sleepForTimeInterval(wait);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`;function le(t){let e;try{e=JSON.parse(t)}catch{return null}if(!Array.isArray(e))return null;let n=[];for(let i of e.slice(0,m)){if(!Array.isArray(i)||i.length!==4||!i.every((u)=>typeof u==="number"&&Number.isFinite(u)))return null;let[s,a,c,d]=i.map(Math.round);if(c>0&&d>0)n.push({x:s,y:a,width:c,height:d})}return n}function On(t){let e=Date.now(),n=0,i=!1,s=(u,b={})=>{try{process.stderr.write(`${JSON.stringify({event:"display.windows_helper",state:u,...b})}
|
|
105
|
+
`)}catch{}},a=(u,b={})=>{if(i)return;i=!0,s(u,{updates:n,duration_ms:Date.now()-e,...b})},c=E(Y,["-l","JavaScript","-e",ue],{env:{},stdio:["ignore","pipe","ignore"]});s("started");let d="";return c.stdout.on("data",(u)=>{if(i)return;d+=u.toString("utf8");for(let b=d.indexOf(`
|
|
106
|
+
`);b>=0;b=d.indexOf(`
|
|
107
|
+
`)){let x=le(d.slice(0,b));if(d=d.slice(b+1),x)n++,t(x)}if(d.length>65536)d=""}),c.once("error",(u)=>a("failed",{code:u.code??"spawn_failed"})),c.once("exit",(u,b)=>a("failed",{code:"exited",exit_code:u,signal:b})),{close(){a("stopped"),c.kill("SIGKILL")}}}var T=5,R=[{bit:1,button:0,down:1,up:2,drag:6},{bit:4,button:1,down:3,up:4,drag:7},{bit:2,button:2,down:25,up:26,drag:27}],de=[[8,1,0],[16,-1,0],[32,0,1],[64,0,-1]],P=50,fe=500,V=4,I=131072,W=262144,_=524288,F=1048576,B=new Map([[65505,[56,I]],[65506,[60,I]],[65507,[59,W]],[65508,[62,W]],[65511,[58,_]],[65512,[61,_]],[65513,[58,_]],[65514,[61,_]],[65027,[61,_]],[65515,[55,F]],[65516,[54,F]]]),pe=new Map([[65288,51],[65289,48],[65056,48],[65293,36],[65307,53],[65535,117],[65509,57],[65360,115],[65361,123],[65362,126],[65363,124],[65364,125],[65365,116],[65366,121],[65367,119],[65379,114],[65386,114],[65291,71],[65408,49],[65421,76],[65429,115],[65430,123],[65431,126],[65432,124],[65433,125],[65434,116],[65435,121],[65436,119],[65437,71],[65438,114],[65439,117],[65450,67],[65451,69],[65452,65],[65453,78],[65454,65],[65455,75],[65469,81],...[82,83,84,85,86,87,88,89,91,92].map((t,e)=>[65456+e,t]),...[122,120,99,118,96,97,98,100,101,109,103,111,105,107,113,106,64,79,80,90].map((t,e)=>[65470+e,t])]),G="asdfhgzxcv\x00bqweryt123465=97-80]ou[ip\x00lj'k;\\,/nm.\x00 `",j='~!@#$%^&*()_+{}|:"<>?',be="`1234567890-=[]\\;',./",D=new Map;for(let t=0;t<G.length;t++){let e=G[t];if(e==="\x00")continue;if(D.set(e.charCodeAt(0),[t,!1]),e>="a"&&e<="z")D.set(e.toUpperCase().charCodeAt(0),[t,!0])}for(let t=0;t<j.length;t++)D.set(j.charCodeAt(t),[D.get(be.charCodeAt(t))[0],!0]);class K{now;x=-1;y=-1;mask=0;clicks=0;lastDown=null;held=new Set;constructor(t=()=>performance.now()){this.now=t}flags(){let t=0;for(let e of this.held)t|=B.get(e)[1];return t}mouse(t,e){return`m ${t} ${this.x} ${this.y} ${e} ${t===T?0:this.clicks} ${this.flags()}`}pointer(t,e,n){let i=[];if(t!==this.x||e!==this.y){this.x=t,this.y=e;let s=R.find((a)=>this.mask&a.bit);i.push(s?this.mouse(s.drag,s.button):this.mouse(T,0))}for(let s of R){let a=(this.mask&s.bit)!==0,c=(n&s.bit)!==0;if(!a&&c){let d=this.now(),u=this.lastDown;this.clicks=u&&u.button===s.button&&d-u.at<=fe&&Math.abs(t-u.x)<=V&&Math.abs(e-u.y)<=V?this.clicks+1:1,this.lastDown={button:s.button,at:d,x:t,y:e},i.push(this.mouse(s.down,s.button))}else if(a&&!c)i.push(this.mouse(s.up,s.button))}for(let[s,a,c]of de)if(!(this.mask&s)&&n&s)i.push(`w ${a*P} ${c*P} ${this.flags()}`);return this.mask=n,i}key(t,e){let n=t?1:0,i=B.get(e);if(i){if(t)this.held.add(e);else this.held.delete(e);return[`k ${i[0]} ${n} ${this.flags()}`]}let s=pe.get(e);if(s!==void 0)return[`k ${s} ${n} ${this.flags()}`];let a=e<256?e:(e&4278190080)===16777216?e&16777215:0,c=D.get(a);if(c)return[`k ${c[0]} ${n} ${this.flags()|(c[1]?I:0)}`];if(a<160||a>65535||a>=55296&&a<57344)return[];return[`u ${n} ${a} ${this.flags()}`]}}function In(t,e=[]){let n=E(...k(e),{env:{},stdio:["pipe","pipe","ignore"]}),i=new K,s="",a=!1,c=null,d=()=>{n.kill("SIGKILL"),c?.kill("SIGKILL")},u=(f)=>{if(a)return;a=!0,d(),t.end(f)},b=(f)=>u({error:new r("display_unavailable",f)}),x=(f)=>{if(a||f.length===0)return;if(n.stdin.write(f.map((g)=>`${g}
|
|
108
|
+
`).join("")),n.stdin.writableLength>oe)u({reason:"input_backpressure"})},X=()=>{c=E(...k(e,"clipboard"),{env:{},stdio:["ignore","pipe","ignore"]});let f="";c.stdout?.on("data",(g)=>{if(a)return;f+=g.toString("ascii");for(let h=f.indexOf(`
|
|
109
|
+
`);h>=0;h=f.indexOf(`
|
|
110
|
+
`)){let C=f.slice(0,h);if(f=f.slice(h+1),!C.startsWith("c "))continue;let A=C.slice(2);if(A.length>Math.ceil(v/3)*4||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(A)){u({reason:"display_protocol"});return}let U=Buffer.from(A,"base64");if(U.byteLength<=v)t.clipboard(U.toString("utf8"));if(a)return}if(f.length>Math.ceil(v/3)*4+2)u({reason:"display_protocol"})}),c.once("error",()=>b("Reason could not watch this Mac's desktop clipboard.")),c.once("exit",()=>{if(!a)b("Reason could not watch this Mac's desktop clipboard.")})};return n.stdout.on("data",(f)=>{if(a||s===null)return;s+=f.toString("utf8");let g=s.indexOf(`
|
|
111
|
+
`);if(g<0){if(s.length>4096)u({reason:"display_protocol"});return}let h=q(s.slice(0,g));if(s=null,!h)u({reason:"display_protocol"});else if(!h.screen||!h.accessibility)b(e.length>0?"Reason's background worker needs Screen Recording and Accessibility on this Mac (its own Reason entry in System Settings > Privacy & Security, not the Reason app's): run `reason permissions allow` on this Mac.":"Allow Screen Recording and Accessibility for this Mac's Reason worker, then restart it.");else X(),t.ready({width:h.width,height:h.height})}),n.stdin.on("error",()=>{return}),n.once("error",()=>b("Reason could not start this Mac's desktop input.")),n.once("exit",()=>{if(s!==null)b("Reason could not start this Mac's desktop input.");else u({reason:"display_closed"})}),{pointer:(f,g,h)=>x(i.pointer(f,g,h)),key:(f,g)=>x(i.key(f,g)),clipboard:(f)=>x([`c ${Buffer.from(f,"utf8").toString("base64")}`]),close(){a=!0,d()}}}
|
|
112
|
+
export{Zi,Xi,it,Yi,v,Qi,eo,Tn,to,ro,no,$r,Rn,qe,ot,On,In};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{x}from"./vm-hands-entry-lite-zg3b0c08.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFileSync as b}from"child_process";import{mkdirSync as y,readdirSync as h,readFileSync as D,rmSync as f,statSync as k,writeFileSync as w}from"fs";import{join as p,sep as S}from"path";import{setTimeout as L}from"timers/promises";var _=3000,u=null;function g(e){return p(e,"users")}function ft(e){if(u?.root===e.root)return;let t=g(e.root);y(t,{recursive:!0,mode:448}),w(p(t,String(process.pid)),"",{mode:384}),u=e}function $s(){if(!u)return;f(p(g(u.root),String(process.pid)),{force:!0}),u=null}function m(e){try{return process.kill(e,0),!0}catch(t){return t instanceof Error&&"code"in t&&t.code==="EPERM"}}function P(){let e=process.getuid?.();if(process.platform==="linux")return h("/proc").flatMap((n)=>{if(!/^\d+$/.test(n))return[];try{if(k(`/proc/${n}`).uid!==e)return[];let s=D(`/proc/${n}/cmdline`).toString("utf8").split("\x00").join(" ").trim();return s?[{pid:Number(n),command:s}]:[]}catch{return[]}});if(process.platform==="win32")return b(x("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 c=/^(\d+) (.+)$/.exec(s.trim());return c?[{pid:Number(c[1]),command:c[2]}]:[]});return b("/bin/ps",["-axww","-o","pid=,uid=,command="],{encoding:"utf8",maxBuffer:16777216}).split(`
|
|
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 Bs(){let e=u;if(!e)return{released:"unused",stopped:0};let t=g(e.root);f(p(t,String(process.pid)),{force:!0}),u=null;let n=!1;for(let o of h(t)){let i=Number(o);if(Number.isSafeInteger(i)&&i>0&&m(i))n=!0;else f(p(t,o),{force:!0})}if(n)return{released:"shared",stopped:0};let s=P().filter((o)=>o.pid!==process.pid&&(o.command.includes(`${e.root}${S}`)||o.command.includes(`${e.automation}${S}`)||o.command.includes(e.extensionDir))),c=(o,i)=>{try{process.kill(o,i)}catch{}};for(let o of s)c(o.pid,"SIGTERM");for(let o=Date.now()+_;Date.now()<o&&s.some((i)=>m(i.pid));)await new Promise((i)=>setTimeout(i,100));for(let o of s)if(m(o.pid))c(o.pid,"SIGKILL");return{released:"stopped",stopped:s.length}}var E=20000,M=30000,N=100,a=new Map,l=null,d=[];function fi(e){a.set(e,(a.get(e)??0)+1);let t=!1;return()=>{if(t)return;t=!0;let n=(a.get(e)??1)-1;if(n>0){a.set(e,n);return}if(a.delete(e),l?.run===e)l.idleUntil=0}}function O(){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 T(e,t){return l!==null&&l.run!==e&&(l.calls>0||t<l.idleUntil)}async function mi(e,t,n=Date.now){let s=Symbol(e);d.push(s);try{let i=n()+M;for(;;){if(!T(e,n())&&(l?.run===e||d[0]===s))break;if(n()>=i)throw O();await L(N,void 0,{signal:t}).catch(()=>t.throwIfAborted())}}finally{d.splice(d.indexOf(s),1)}if(l?.run!==e)l={run:e,calls:0,idleUntil:0};let c=l;c.calls+=1;let o=!1;return()=>{if(o)return;o=!0,c.calls-=1,c.idleUntil=n()+E}}
|
|
4
|
+
export{ft,$s,Bs,fi,mi};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{t,o,i,Q,oe,s,n}from"./vm-hands-entry-lite-zn0v259d.js";var Xe=32768,St=67108864,fr=16384,E=204800,ln=600000,_=["content-type","anthropic-version","user-agent"],m=s(["openai-completions","openai-responses","anthropic-messages"]),f=new Set(_),C=oe(t(),t().max(2048)).refine((e)=>Object.keys(e).every((r)=>f.has(r))&&Object.values(e).every((r)=>!/[\r\n\0]/.test(r)),"Only non-secret custom endpoint request headers are permitted");function u(e){try{let r=new URL(e);return["http:","https:"].includes(r.protocol)&&!r.username&&!r.password&&!r.search&&!r.hash?r:null}catch{return null}}function mr(e,r){let c=u(e.baseUrl),l=u(r.baseUrl),a=u(e.url);if(!c||!l||!a||e.method!=="POST"||r.execution!=="device")return!1;let d=(p)=>p.origin+p.pathname.replace(/\/+$/,"");if(d(c)!==d(l)||a.origin!==c.origin)return!1;let h=r.api==="openai-completions"?"/chat/completions":r.api==="openai-responses"?"/responses":"/v1/messages";return a.pathname===c.pathname.replace(/\/+$/,"")+h}var un=i({baseUrl:t().max(2048),url:t().max(4096),method:n("POST"),body:t().refine((e)=>new TextEncoder().encode(e).byteLength<=E).optional(),headers:C,credentialOrganizationId:t().uuid(),accountKey:t().min(1).max(256).optional()}).strict().refine((e)=>m.options.some((r)=>mr(e,{baseUrl:e.baseUrl,api:r,execution:"device"})),"Invalid custom endpoint inference URL"),x=i({status:o().int().min(200).max(599),statusText:t().max(256).refine((e)=>!/[\r\n\0]/.test(e)),headers:oe(t(),t().max(4096)).refine((e)=>Object.keys(e).every((r)=>["content-type","retry-after","x-request-id","request-id"].includes(r))&&Object.values(e).every((r)=>!/[\r\n\0]/.test(r)))}).strict(),D=Q([i({eof:n(!0)}).strict(),i({eof:n(!1),data:t().max(Math.ceil(Xe/3)*4).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/).refine((e)=>e.length>0&&e.length*3/4-(e.endsWith("==")?2:e.endsWith("=")?1:0)<=Xe)}).strict()]),y=i({bytes:o().int().min(0).max(St),chunks:o().int().min(0).max(fr)}).strict(),dn=i({apiKey:t().min(1).max(16384).refine((e)=>!/[\r\n\0]/.test(e)),api:m}).strict(),S=["custom_endpoint_host_not_found","custom_endpoint_connection_failed","custom_endpoint_tls_failed"];function pn(e){return typeof e==="string"&&S.includes(e)}var g="Ollama listens only on 127.0.0.1 unless it is started with OLLAMA_HOST=0.0.0.0.",T={custom_endpoint_host_not_found:"Your computer couldn't resolve your model server's hostname. Check the hostname in the Base URL, and that this computer is on the network or tailnet that resolves it.",custom_endpoint_connection_failed:`Your computer's connection to your model server was refused or timed out. Check that the server is running and listening on the Base URL's address and port. ${g}`,custom_endpoint_tls_failed:"Your computer couldn't make a secure (TLS) connection to your model server. Check the server's https certificate, or use an http:// Base URL for a server on your computer or private network.",401:"Your model server refused the request (HTTP 401). Check the API key saved for it in Models.",403:"Your model server refused the request (HTTP 403). Ollama refuses requests addressed to a hostname other than localhost, such as a *.ts.net name from tailscale serve or funnel: restart it with OLLAMA_HOST=0.0.0.0, or use http://localhost:11434/v1 when it runs on the session's computer. For another server, check the API key and its access rules.",404:"Your model server answered HTTP 404 (not found). Check that the Base URL is the API root (for Ollama, http://localhost:11434/v1) and that each model ID is one the server lists."};var I=new Set(Object.values(T));export{Xe,St,fr,ln,mr,un,dn,pn};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{de,ze,T}from"./vm-hands-entry-lite-mvx29q2q.js";import{execFileSync as p}from"child_process";import{existsSync as s,realpathSync as c}from"fs";import{userInfo as l}from"os";import{isAbsolute as u,join as t,normalize as f,parse as d}from"path";function a(){let r=f(l().homedir);if(!u(r)||r===d(r).root)throw Error("Could not resolve the canonical user home.");return r}function ne(r,n,e=a()){let i=T(n);if(n.kind==="managed"&&n.base){let o=c(e);return{anchor:o,boundary:t(o,n.base),path:t(o,i)}}if(n.kind==="root"&&ze(n.path)){let o=c(e);return{anchor:o,boundary:t(o,de),path:t(o,i)}}return{anchor:r,boundary:r,path:t(r,i)}}function Ut(r=a()){return t(r,".config")}function co(){if(process.platform!=="darwin")return null;try{let r=p("/usr/bin/getconf",["DARWIN_USER_DIR"],{encoding:"utf8",timeout:5000}).trim();return u(r)?c(r):null}catch{return null}}function lo(r=a()){let n=t(r,"Library","Application Support","Ara"),e=t(r,"Library","Application Support","Reason");return s(n)&&!s(e)?n:e}
|
|
3
|
+
export{a,ne,Ut,co,lo};
|