@reason-machines/cli-linux-x64 0.2.459 → 0.2.463
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 +2 -2
- package/bin/reason +1 -1
- package/bin/runtime/srt/sandbox-runtime.mjs +40 -40
- package/bin/runtime/srt/vendor/seccomp/x64/apply-seccomp +0 -0
- package/bin/vm-hands/api-7xy672j8.js +2 -0
- package/bin/vm-hands/api-credentials-bbmmmkwx.js +2 -0
- package/bin/vm-hands/connect-cli-2rvwbw01.js +2 -0
- package/bin/vm-hands/credentials-gr9jn270.js +2 -0
- package/bin/vm-hands/custom-endpoint-device-r2nn1xj9.js +2 -0
- package/bin/vm-hands/desktop-account-3cc0bhw8.js +2 -0
- package/bin/vm-hands/device-workspace-s50q53sz.js +2 -0
- package/bin/vm-hands/{fsevents-5c1c8fc6.js → fsevents-sxsgn7s9.js} +1 -1
- package/bin/vm-hands/hands-worker-source-k8v5kmmw.js +2 -0
- package/bin/vm-hands/{index-0dp6x9h4.js → index-d5n50g8b.js} +19 -19
- package/bin/vm-hands/install-receipt-gvdzhm17.js +2 -0
- package/bin/vm-hands/local-automation-34vdgq8d.js +2 -0
- package/bin/vm-hands/local-capabilities-41n0pspr.js +2 -0
- package/bin/vm-hands/local-desktop-users-qskbh51j.js +2 -0
- package/bin/vm-hands/local-display-mac-m77mftqy.js +2 -0
- package/bin/vm-hands/local-display-session-g81fwns5.js +2 -0
- package/bin/vm-hands/local-display-video-1xd1fqch.js +2 -0
- package/bin/vm-hands/local-managed-process-30k1x92d.js +2 -0
- package/bin/vm-hands/local-pty-session-k6kab3tc.js +2 -0
- package/bin/vm-hands/managed-runtime-hk53v8j5.js +2 -0
- package/bin/vm-hands/network-contract-y2eybfhn.js +2 -0
- package/bin/vm-hands/package-8v6gpwas.js +2 -0
- package/bin/vm-hands/permissions-t3e7bp9x.js +2 -0
- package/bin/vm-hands/reason-hands-protocol-r3wtcjed.js +2 -0
- package/bin/vm-hands/serve-service-hr1x43p8.js +2 -0
- package/bin/vm-hands/status-h3bk00m3.js +10 -0
- package/bin/vm-hands/version-qja79041.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-03d1fhxv.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-eycfxb2c.js → vm-hands-entry-lite-0yj63trb.js} +12 -12
- package/bin/vm-hands/{vm-hands-entry-lite-njs8k65s.js → vm-hands-entry-lite-1f0v3jb4.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-4g9k69a7.js → vm-hands-entry-lite-1k16ct2y.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-hc5ccj2h.js → vm-hands-entry-lite-1y629eqh.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-r7zs4ce2.js → vm-hands-entry-lite-3krzmhkk.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-3pxmmb7z.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-gcjjhsm2.js → vm-hands-entry-lite-44qha2rt.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-2ctydt7v.js → vm-hands-entry-lite-4x8j1xp9.js} +9 -9
- package/bin/vm-hands/{vm-hands-entry-lite-t5q30ne0.js → vm-hands-entry-lite-52x189kf.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-ba3qq0bs.js → vm-hands-entry-lite-5agyspqp.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-j4kapgvr.js → vm-hands-entry-lite-5zdybh8s.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-g9z467dk.js → vm-hands-entry-lite-7ja63pfz.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-1f2cam25.js → vm-hands-entry-lite-8qvsnkvv.js} +4 -4
- package/bin/vm-hands/vm-hands-entry-lite-9fzydv1p.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-etbsze1k.js → vm-hands-entry-lite-9vv5knh4.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-3pnjdh8m.js → vm-hands-entry-lite-abfb6nms.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-3rwtqr28.js → vm-hands-entry-lite-arrmd8qx.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-b139fhbg.js +5 -0
- package/bin/vm-hands/{vm-hands-entry-lite-tqc2ezda.js → vm-hands-entry-lite-b8yapqfn.js} +5 -5
- package/bin/vm-hands/vm-hands-entry-lite-bvb4nvxr.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-mv9nkj11.js → vm-hands-entry-lite-c7ka2d1c.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-9sa1knn7.js → vm-hands-entry-lite-cf1x5cbr.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-07vak0wy.js → vm-hands-entry-lite-d2fveq6h.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-2j7he8gn.js → vm-hands-entry-lite-eay4tbg0.js} +33 -33
- package/bin/vm-hands/{vm-hands-entry-lite-4fwf7wgb.js → vm-hands-entry-lite-egax7vw4.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-dh8f2h2d.js → vm-hands-entry-lite-h6rhk6h1.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-a3w8m8nb.js → vm-hands-entry-lite-hzh8fdxx.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-jcf61cb4.js → vm-hands-entry-lite-jyvmw8b7.js} +5 -5
- package/bin/vm-hands/vm-hands-entry-lite-k83rkcys.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-b8k78r34.js → vm-hands-entry-lite-kz48x6p0.js} +32 -32
- package/bin/vm-hands/{vm-hands-entry-lite-n68srzhw.js → vm-hands-entry-lite-m753n72c.js} +16 -16
- package/bin/vm-hands/{vm-hands-entry-lite-5rx9b5rg.js → vm-hands-entry-lite-me5w88km.js} +14 -9
- package/bin/vm-hands/{vm-hands-entry-lite-9z3v15d2.js → vm-hands-entry-lite-mmrdd8gk.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-n4x7reax.js → vm-hands-entry-lite-n1k1njzh.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-2yz6b0n3.js → vm-hands-entry-lite-np07qyeq.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-d9g1pzzx.js → vm-hands-entry-lite-r3yp6cr9.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-em7mk9tn.js → vm-hands-entry-lite-rfz60hb3.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-9z0skx2w.js → vm-hands-entry-lite-rzhqftyg.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-2sx9smm8.js → vm-hands-entry-lite-t0exw1jk.js} +20 -20
- package/bin/vm-hands/{vm-hands-entry-lite-dcxvxpne.js → vm-hands-entry-lite-tn8v3yfj.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-qyp2a4c3.js → vm-hands-entry-lite-txd50spx.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-8j7p91hr.js → vm-hands-entry-lite-vdhgwmmp.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-12rzrd95.js → vm-hands-entry-lite-wrvz9jxy.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-vrp0t24n.js → vm-hands-entry-lite-x9wy77vd.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite.js +2 -2
- package/bin/vm-hands/{vm-hands-executor-81e32jtv.js → vm-hands-executor-ksf4ragj.js} +3 -3
- package/bin/vm-hands/vm-hands-op-runner-q5x9gpmt.js +2 -0
- package/bin/vm-hands/{vm-hands-runtime-w8j74jv4.js → vm-hands-runtime-dg696564.js} +3 -3
- package/bin/vm-hands/worker-preview-readiness-6hzzjnk7.js +2 -0
- package/bin/vm-hands/worker-sandbox-1g7jheqm.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/api-credentials-skdwhmrz.js +0 -2
- package/bin/vm-hands/api-s23qevwq.js +0 -2
- package/bin/vm-hands/connect-cli-3t4w2fht.js +0 -2
- package/bin/vm-hands/custom-endpoint-device-2s9qxe6t.js +0 -2
- package/bin/vm-hands/desktop-account-nb7g2ek5.js +0 -2
- package/bin/vm-hands/device-workspace-6av4wa2e.js +0 -2
- package/bin/vm-hands/hands-worker-source-v7ds6vp1.js +0 -2
- package/bin/vm-hands/install-receipt-4sjr0jhg.js +0 -2
- package/bin/vm-hands/local-automation-16beqqtc.js +0 -2
- package/bin/vm-hands/local-capabilities-5prfxmwj.js +0 -2
- package/bin/vm-hands/local-desktop-users-2azpqr2m.js +0 -2
- package/bin/vm-hands/local-display-mac-1ddx6s3j.js +0 -2
- package/bin/vm-hands/local-display-session-9mkfnt2c.js +0 -2
- package/bin/vm-hands/local-display-video-pg5tzfwz.js +0 -2
- package/bin/vm-hands/local-managed-process-0ay1z599.js +0 -2
- package/bin/vm-hands/local-pty-session-gvnfgrxt.js +0 -2
- package/bin/vm-hands/managed-runtime-wr322d0v.js +0 -2
- package/bin/vm-hands/network-contract-8fkzm0t0.js +0 -2
- package/bin/vm-hands/package-k6jdrvn6.js +0 -2
- package/bin/vm-hands/permissions-q60sq4a3.js +0 -2
- package/bin/vm-hands/reason-hands-protocol-nkj7481a.js +0 -2
- package/bin/vm-hands/serve-service-vk54esde.js +0 -2
- package/bin/vm-hands/status-dyaae8hz.js +0 -10
- package/bin/vm-hands/version-x56y54v3.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-04b2bmem.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-9jgf223h.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-cm497v4t.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-hw26gewc.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-t7pnq2e5.js +0 -3
- package/bin/vm-hands/vm-hands-op-runner-xdmre6dn.js +0 -2
- package/bin/vm-hands/worker-preview-readiness-kmwcrttt.js +0 -2
- package/bin/vm-hands/worker-sandbox-epre0fnv.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Kr,Yn,Jr,Qn}from"./vm-hands-entry-lite-abfb6nms.js";import"./vm-hands-entry-lite-k83rkcys.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-cf1x5cbr.js";import"./vm-hands-entry-lite-3krzmhkk.js";export{Kr as installationReceiptPath,Jr as installerReasonAlias,Yn as installerReceiptLauncher,Qn as loadInstallationReceipt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Pn,Os,Is,Ds,Ns,Tn}from"./vm-hands-entry-lite-me5w88km.js";import"./vm-hands-entry-lite-0yj63trb.js";import"./vm-hands-entry-lite-4x8j1xp9.js";import"./vm-hands-entry-lite-x9wy77vd.js";import"./vm-hands-entry-lite-jyvmw8b7.js";import"./vm-hands-entry-lite-44qha2rt.js";import"./vm-hands-entry-lite-8qvsnkvv.js";import"./vm-hands-entry-lite-wrvz9jxy.js";import"./vm-hands-entry-lite-5zdybh8s.js";import"./vm-hands-entry-lite-r3yp6cr9.js";import"./vm-hands-entry-lite-m753n72c.js";import"./vm-hands-entry-lite-1y629eqh.js";import"./vm-hands-entry-lite-9fzydv1p.js";import"./vm-hands-entry-lite-abfb6nms.js";import"./vm-hands-entry-lite-k83rkcys.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-cf1x5cbr.js";import"./vm-hands-entry-lite-3krzmhkk.js";import"./vm-hands-entry-lite-b8yapqfn.js";import"./vm-hands-entry-lite-7ja63pfz.js";import"./vm-hands-entry-lite-vdhgwmmp.js";import"./vm-hands-entry-lite-rfz60hb3.js";export{Is as ensureLocalBrowser,Pn as localAutomationAvailable,Ds as localBrowserProfile,Os as localUserChromeHost,Ns as runAutomationCallLocally,Tn as runLocalAutomation};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Go,Fi,pn,Ko,Jo,Zo,Xo,ks,Cs,As,Ps}from"./vm-hands-entry-lite-eay4tbg0.js";import"./vm-hands-entry-lite-1f0v3jb4.js";import"./vm-hands-entry-lite-c7ka2d1c.js";import"./vm-hands-entry-lite-t0exw1jk.js";import"./vm-hands-entry-lite-hzh8fdxx.js";import"./vm-hands-entry-lite-kz48x6p0.js";import"./vm-hands-entry-lite-h6rhk6h1.js";import"./vm-hands-entry-lite-52x189kf.js";import"./vm-hands-entry-lite-tn8v3yfj.js";import"./vm-hands-entry-lite-me5w88km.js";import"./vm-hands-entry-lite-0yj63trb.js";import"./vm-hands-entry-lite-4x8j1xp9.js";import"./vm-hands-entry-lite-x9wy77vd.js";import"./vm-hands-entry-lite-jyvmw8b7.js";import"./vm-hands-entry-lite-44qha2rt.js";import"./vm-hands-entry-lite-8qvsnkvv.js";import"./vm-hands-entry-lite-wrvz9jxy.js";import"./vm-hands-entry-lite-5zdybh8s.js";import"./vm-hands-entry-lite-r3yp6cr9.js";import"./vm-hands-entry-lite-m753n72c.js";import"./vm-hands-entry-lite-1y629eqh.js";import"./vm-hands-entry-lite-9fzydv1p.js";import"./vm-hands-entry-lite-abfb6nms.js";import"./vm-hands-entry-lite-k83rkcys.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-cf1x5cbr.js";import"./vm-hands-entry-lite-3krzmhkk.js";import"./vm-hands-entry-lite-b8yapqfn.js";import"./vm-hands-entry-lite-7ja63pfz.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import"./vm-hands-entry-lite-vdhgwmmp.js";import"./vm-hands-entry-lite-rfz60hb3.js";export{r as LocalCapabilityError,Go as SHORT_REQUEST_CAPABILITIES,ks as capabilityInventoryForRoots,Fi as confinedExecutionShell,Ko as defaultLocalCommandRunner,Cs as deliverLocalHandsEnvironment,Xo as enrolledRootPaths,Ps as executeLocalOperation,As as rebindLocalHandsControl,Jo as runFileCapability,Zo as runTransferCapability,pn as spawnCaptured};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{xt,da,pa,Ni,Li}from"./vm-hands-entry-lite-7ja63pfz.js";import"./vm-hands-entry-lite-vdhgwmmp.js";import"./vm-hands-entry-lite-rfz60hb3.js";export{da as forgetLocalDesktopUse,Li as holdLocalDesktop,xt as noteLocalDesktopUse,pa as releaseLocalDesktop,Ni as trackDesktopRun};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$t,Ls,G,qe,Bt}from"./vm-hands-entry-lite-0yj63trb.js";import"./vm-hands-entry-lite-4x8j1xp9.js";import"./vm-hands-entry-lite-x9wy77vd.js";import"./vm-hands-entry-lite-jyvmw8b7.js";import"./vm-hands-entry-lite-44qha2rt.js";import"./vm-hands-entry-lite-8qvsnkvv.js";import"./vm-hands-entry-lite-wrvz9jxy.js";import"./vm-hands-entry-lite-5zdybh8s.js";import"./vm-hands-entry-lite-r3yp6cr9.js";import"./vm-hands-entry-lite-1y629eqh.js";import"./vm-hands-entry-lite-9fzydv1p.js";import"./vm-hands-entry-lite-k83rkcys.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-cf1x5cbr.js";import"./vm-hands-entry-lite-3krzmhkk.js";import"./vm-hands-entry-lite-7ja63pfz.js";import"./vm-hands-entry-lite-vdhgwmmp.js";import"./vm-hands-entry-lite-rfz60hb3.js";export{qe as ensureLinuxDesktop,$t as localDisplayAvailable,Ls as localDisplayReady,G as privateDirectory,Bt as runLocalDisplayStream};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{On,In,Dn,Nn,Pr}from"./vm-hands-entry-lite-4x8j1xp9.js";import"./vm-hands-entry-lite-x9wy77vd.js";import"./vm-hands-entry-lite-jyvmw8b7.js";import"./vm-hands-entry-lite-r3yp6cr9.js";import"./vm-hands-entry-lite-1y629eqh.js";import"./vm-hands-entry-lite-9fzydv1p.js";import"./vm-hands-entry-lite-cf1x5cbr.js";import"./vm-hands-entry-lite-3krzmhkk.js";export{On as MAC_SCREEN,In as WINDOWS_SCREEN,Dn as createDisplayVideoLane,Pr as localDisplayVideoAvailable,Nn as simulatorVideoFfmpeg};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{nt,dr,Ts,Rs}from"./vm-hands-entry-lite-c7ka2d1c.js";import"./vm-hands-entry-lite-t0exw1jk.js";import"./vm-hands-entry-lite-hzh8fdxx.js";import"./vm-hands-entry-lite-kz48x6p0.js";import"./vm-hands-entry-lite-h6rhk6h1.js";import"./vm-hands-entry-lite-52x189kf.js";import"./vm-hands-entry-lite-8qvsnkvv.js";import"./vm-hands-entry-lite-wrvz9jxy.js";import"./vm-hands-entry-lite-5zdybh8s.js";import"./vm-hands-entry-lite-r3yp6cr9.js";import"./vm-hands-entry-lite-k83rkcys.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-cf1x5cbr.js";import"./vm-hands-entry-lite-3krzmhkk.js";import"./vm-hands-entry-lite-b8yapqfn.js";import"./vm-hands-entry-lite-7ja63pfz.js";import"./vm-hands-entry-lite-vdhgwmmp.js";import"./vm-hands-entry-lite-rfz60hb3.js";export{nt as ManagedProcessStoppedError,Ts as controlManagedDeviceProcess,Rs as retireManagedDeviceProcess,dr as runManagedDeviceProcess};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Or,qt,Ir,ts,Fn,Dr,jn}from"./vm-hands-entry-lite-44qha2rt.js";import"./vm-hands-entry-lite-8qvsnkvv.js";import"./vm-hands-entry-lite-wrvz9jxy.js";import"./vm-hands-entry-lite-5zdybh8s.js";import"./vm-hands-entry-lite-k83rkcys.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-cf1x5cbr.js";import"./vm-hands-entry-lite-3krzmhkk.js";export{qt as LOCAL_PTY_MAX_BUFFERED_OUTPUT_BYTES,Ir as LOCAL_PTY_MAX_SESSIONS,Or as LOCAL_PTY_MAX_SESSION_MS,Dr as defaultConnect,ts as defaultLoginShell,Fn as ptyRuntimeSupported,jn as runLocalPtySession};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{_s,ys,bs,vs,Ss,Es,xs}from"./vm-hands-entry-lite-9vv5knh4.js";import"./vm-hands-entry-lite-52x189kf.js";import"./vm-hands-entry-lite-1y629eqh.js";import"./vm-hands-entry-lite-9fzydv1p.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-cf1x5cbr.js";import"./vm-hands-entry-lite-3krzmhkk.js";import"./vm-hands-entry-lite-vdhgwmmp.js";import"./vm-hands-entry-lite-rfz60hb3.js";export{Ss as acquireManagedRuntimeDirectoryLock,bs as currentManagedRuntimeVersion,xs as flushManagedRuntimeLifecycleEvents,vs as isManagedRuntimeVersionExecutable,ys as legacyManagedRuntimePaths,_s as managedRuntimePaths,Es as recordManagedRuntimeLifecycle};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{tt,Te,Ws,Vs,Gs,ri,Ks,rn,ni,bt,ii,oi,si,ai,ci,li,ui,di,pi,hi,fi,mi,gi,_i,yi,wi,pe,Y,Re,q,bi,vi,Si,Q,Ei,xi,ki,Ci,Ai,vt,Pi,Js,or,Ti,Zs,ns,Xs,Ys,Qs,ea,ta,ra,na,ia,oa,sa,aa,ca,la,ua}from"./vm-hands-entry-lite-b8yapqfn.js";export{Pi as AUTOMATION_CLOUD_SESSIONS,vt as AUTOMATION_USER_CHROME,fi as HANDS_CLOUD_ACCESS,mi as HANDS_CLOUD_ACCESS_KEY,pe as HANDS_CONFINEMENT,Y as HANDS_CONFINEMENT_KEY,ai as HANDS_ENVIRONMENT_AT_CLAIM,ci as HANDS_ENVIRONMENT_AT_CLAIM_KEY,ni as HANDS_ENVIRONMENT_DELIVERY,bt as HANDS_ENVIRONMENT_DELIVER_CONTROL,gi as HANDS_HEADLESS_BROWSER,_i as HANDS_HEADLESS_BROWSER_KEY,bi as HANDS_JOBS_USER,vi as HANDS_JOBS_USER_KEY,yi as HANDS_LARGE_ENVIRONMENT,wi as HANDS_LARGE_ENVIRONMENT_KEY,Re as HANDS_MODEL_JOBS_EGRESS,q as HANDS_MODEL_JOBS_EGRESS_KEY,di as HANDS_REBIND,hi as HANDS_REBIND_CONTROL,pi as HANDS_REBIND_KEY,Ei as HANDS_SESSION_CAP_KEY,xi as HANDS_SESSION_CAP_NONE,Si as HANDS_SESSION_GROUP,Q as HANDS_SESSION_GROUP_KEY,li as HANDS_WORKSPACE_CHECK,ui as HANDS_WORKSPACE_CHECK_KEY,Ci as JOBS_START_WAIT,Ai as JOBS_START_WAIT_KEY,Te as LOCAL_OPERATION_MAX_BYTES,tt as LOCAL_RUNTIME_PROTOCOL_VERSION,Gs as LOCAL_RUNTIME_ROUTES,rn as LOCAL_RUNTIME_SESSION_CLAIM_WAIT_MAX_MS,ri as LOCAL_RUNTIME_SESSION_PATH,or as LOCAL_RUNTIME_WORKER_STARTUP_MAX_MS,Ws as RELAY_HOST_ALIAS_HEADER,Vs as RELAY_HOST_ALIAS_VERSION,si as VM_HANDS_UNBIND_UNVERIFIED_EVENT,ii as VM_HANDS_WORKSPACE_DEFERRED_KEY,oi as VM_HANDS_WORKSPACE_GRANT_CONTROL,ki as WORKER_PREVIEW_CARRIED_JOBS,Js as WORKER_STARTUP_TIMING_STAGES,Ti as buildLocalRuntimeDeviceProofBytes,Ks as localRuntimeSessionRoutable,na as parseLocalRuntimeDisconnectResponse,Ys as parseLocalRuntimeEnrollmentResponse,Zs as parseLocalRuntimeErrorEnvelope,ea as parseLocalRuntimeFirstHeartbeat,Qs as parseLocalRuntimeHeartbeatResponse,ra as parseLocalRuntimeIdentityResponse,oa as parseLocalRuntimeLifecycleResponse,ia as parseLocalRuntimeLocalSubscriptionResponse,sa as parseLocalRuntimeOperationClaim,ua as parseLocalRuntimeOperationCompletionResponse,la as parseLocalRuntimeOperationEnvironmentResponse,ca as parseLocalRuntimeOperationEventsResponse,aa as parseLocalRuntimeOperationHeartbeatResponse,ns as parseLocalRuntimeProofChallenge,Xs as parseLocalRuntimeRegistrationResponse,ta as parseLocalRuntimeRootsSyncResponse};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Qo,es,Ms,$s}from"./vm-hands-entry-lite-x9wy77vd.js";import"./vm-hands-entry-lite-jyvmw8b7.js";import"./vm-hands-entry-lite-1y629eqh.js";import"./vm-hands-entry-lite-9fzydv1p.js";import"./vm-hands-entry-lite-cf1x5cbr.js";import"./vm-hands-entry-lite-3krzmhkk.js";export{$s as allowMacPermissions,Ms as permissionsSummary,es as readMacPermissions,Qo as reasonIdentity};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{P,$r,Br,Un,pt,Hn,Fr,Je,Se,zn,Ze,Jt,ne,Xe,qn,Ee,Zt,jr,Xt,Ur,Wn,ae,U,N,ce,Hr,zr,Vn}from"./vm-hands-entry-lite-5zdybh8s.js";import"./vm-hands-entry-lite-3krzmhkk.js";export{Ur as REASON_HANDS_CLOSE_CODES,Ze as REASON_HANDS_JOB_CONTROL_MAX_FRAME_BYTES,Fr as REASON_HANDS_JOB_MAX_INPUT_CHARS,Je as REASON_HANDS_JOB_MAX_OUTPUT_CHARS,Se as REASON_HANDS_JOB_MAX_OUTPUT_CHUNKS,zn as REASON_HANDS_JOB_MAX_RECORDS,Hn as REASON_HANDS_MAX_ERROR_CHARS,$r as REASON_HANDS_MAX_FRAME_BYTES,Br as REASON_HANDS_MAX_INPUT_CHARS,pt as REASON_HANDS_MAX_OUTPUT_CHARS,Un as REASON_HANDS_MAX_STRUCTURED_INPUT_CHARS,P as REASON_HANDS_PROTOCOL_VERSION,jr as REASON_HANDS_PTY_ANCHOR_EXIT_MS,Xt as REASON_HANDS_PTY_CLEANUP_RECEIPT_MS,Zt as REASON_HANDS_PTY_CLEANUP_SWEEP_MS,Ee as REASON_HANDS_PTY_MAX_DIMENSION,ne as REASON_HANDS_PTY_MAX_INPUT_BYTES,Xe as REASON_HANDS_PTY_MAX_OUTPUT_BYTES,qn as REASON_HANDS_PTY_MAX_PENDING_INPUT_BYTES,Jt as REASON_HANDS_PTY_PROTOCOL_VERSION,Wn as REASON_HANDS_WORKSPACE_BEFORE_MAX_OUTPUT_CHARS,U as isReasonHandsGeneration,ce as isReasonHandsPtyJobId,ae as isReasonHandsRequestId,N as isReasonHandsUuid,Hr as parseReasonHandsJobRequest,zr as parseReasonHandsJobResult,Vn as parseReasonHandsPtyReceipt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qr,xe,J,Kn,Fs,ko,js,Ye,rs,Jn,Us,Hs,Wr,zs,qs}from"./vm-hands-entry-lite-m753n72c.js";import"./vm-hands-entry-lite-1y629eqh.js";import"./vm-hands-entry-lite-9fzydv1p.js";import"./vm-hands-entry-lite-abfb6nms.js";import"./vm-hands-entry-lite-k83rkcys.js";import"./vm-hands-entry-lite-fcvf8md1.js";import"./vm-hands-entry-lite-cf1x5cbr.js";import"./vm-hands-entry-lite-3krzmhkk.js";import"./vm-hands-entry-lite-vdhgwmmp.js";import"./vm-hands-entry-lite-rfz60hb3.js";export{qr as WORKER_SERVICE_ENV,J as WorkerServiceError,ko as connectServiceLabel,xe as defaultWorkerServiceHost,Hs as installWorkerService,Ye as installedWorkerService,js as isConnectServiceLabel,qs as removeWorkerService,Wr as restartWorkerService,zs as retargetWorkerServiceLogs,rs as retireLegacyWorkerService,Us as workerServiceDefinitionCurrent,Kn as workerServiceLauncher,Jn as workerServiceProcessRunning,Fs as workerServiceRetargetPending};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./vm-hands-entry-lite-3pxmmb7z.js";import"./vm-hands-entry-lite-fcvf8md1.js";import{_}from"./vm-hands-entry-lite-k83rkcys.js";import"./vm-hands-entry-lite-3krzmhkk.js";import"./vm-hands-entry-lite-b139fhbg.js";import"./vm-hands-entry-lite-rfz60hb3.js";import"./vm-hands-entry-lite-n1k1njzh.js";import{Vt,dt}from"./vm-hands-entry-lite-8qvsnkvv.js";import{w,M,lr,Be,rt}from"./vm-hands-entry-lite-1k16ct2y.js";import"./vm-hands-entry-lite-b8yapqfn.js";import"./vm-hands-entry-lite-eay4tbg0.js";import"./vm-hands-entry-lite-t0exw1jk.js";import"./vm-hands-entry-lite-9fzydv1p.js";import"./vm-hands-entry-lite-hzh8fdxx.js";import"./vm-hands-entry-lite-1f0v3jb4.js";import"./vm-hands-entry-lite-03d1fhxv.js";import"./vm-hands-entry-lite-4x8j1xp9.js";import"./vm-hands-entry-lite-jyvmw8b7.js";import"./vm-hands-entry-lite-1y629eqh.js";import"./vm-hands-entry-lite-x9wy77vd.js";import"./vm-hands-entry-lite-r3yp6cr9.js";import"./vm-hands-entry-lite-9vv5knh4.js";import"./vm-hands-entry-lite-abfb6nms.js";import"./vm-hands-entry-lite-m753n72c.js";import"./vm-hands-entry-lite-tn8v3yfj.js";import"./vm-hands-entry-lite-5zdybh8s.js";import"./vm-hands-entry-lite-kz48x6p0.js";import"./vm-hands-entry-lite-wrvz9jxy.js";import"./vm-hands-entry-lite-c7ka2d1c.js";import"./vm-hands-entry-lite-7ja63pfz.js";import"./vm-hands-entry-lite-44qha2rt.js";import"./vm-hands-entry-lite-0yj63trb.js";import"./vm-hands-entry-lite-me5w88km.js";import"./vm-hands-entry-lite-egax7vw4.js";import"./vm-hands-entry-lite-h6rhk6h1.js";import"./vm-hands-entry-lite-52x189kf.js";import{a}from"./vm-hands-entry-lite-cf1x5cbr.js";import{t,o,u,i,s,n}from"./vm-hands-entry-lite-5agyspqp.js";import"./vm-hands-entry-lite-vdhgwmmp.js";import{readFileSync as me,realpathSync as k,renameSync as ge,unlinkSync as fe,writeFileSync as he}from"fs";import{dirname as ye,join as I}from"path";function f(e){return`claude mcp add --transport http reason ${e}`}function h(e){return`codex mcp add reason --url ${e}
|
|
3
|
+
codex mcp login reason`}var F=f("https://mcp.reasonmachines.com/mcp"),z=h("https://mcp.reasonmachines.com/mcp"),B=`https://claude.ai/settings/connectors?add=custom&url=${encodeURIComponent("https://mcp.reasonmachines.com/mcp")}`,H=`https://cursor.com/install-mcp?name=reason&config=${encodeURIComponent(btoa(JSON.stringify({url:"https://mcp.reasonmachines.com/mcp"})))}`;var b="https://github.com/reason-machines/reason-plugins",X=`Connect a coding agent to Reason over MCP
|
|
4
|
+
|
|
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"]),C=i({status:P,checkedAt:o().finite(),executablePath:t().min(1)});var Oe=i({version:n(1),key:t(),at:o(),self:i({principal_type:t(),user_id:t().optional(),user_name:t().nullish(),email:t().nullish(),org_id:t(),organization_name:t().nullish(),organization_slug:t().nullish(),mcp_connections:u(i({client_id:t(),client_name:t(),last_used_at:t().nullable()})).optional()})});var x=30000;function L(e,c=Date.now(),y=null){let r=dt(e),d=(()=>{if(r?.state!=="connected"&&r?.state!=="starting")return!1;try{return process.kill(r.pid,0),!0}catch{return!1}})(),R=d&&r?.state==="connected",p=(g)=>R&&c-g>=0&&c-g<x,l=C.safeParse(r?.fullDiskAccess),m=Vt(r,y,c);return{...m?{permission_recovery:m}:{},full_disk_access:l.success&&p(l.data.checkedAt)?l.data.status:"unknown",keep_awake:{enabled:lr(e)==="battery_and_ac",holding:r?.idleSleepHold===!0&&p(Date.parse(r.lastHeartbeatAt??""))},executable:d&&l.success?l.data.executablePath:null}}function De(e=_()){if(process.platform!=="darwin")return null;let c=Be(I(rt(k(a()),e),"worker.json"));return c?L(w(c).daemon,Date.now(),M(c)):null}export{De as connectionMacState};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ln,vo,zt}from"./vm-hands-entry-lite-jyvmw8b7.js";import{Rn,Ve,lo,On,In,Dn,Pr,x}from"./vm-hands-entry-lite-4x8j1xp9.js";import{xt}from"./vm-hands-entry-lite-7ja63pfz.js";import{Dr}from"./vm-hands-entry-lite-44qha2rt.js";import{j}from"./vm-hands-entry-lite-8qvsnkvv.js";import{a}from"./vm-hands-entry-lite-cf1x5cbr.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as z,spawn as H}from"child_process";import{randomBytes as Qe}from"crypto";import{chmodSync as _e,existsSync as I,lstatSync as De,mkdirSync as we,readFileSync as Re,rmSync as ee,writeFileSync as U}from"fs";import{connect as de}from"net";import{join as y}from"path";var P=32,w=76;var B="./desktop-wallpaper-0pjhgyfk.jpg";var O="./dock-browser-afp005mt.png";var F="./dock-files-rywdm96b.png";var k="./dock-terminal-s41cj1jp.png";var K=`# Sets the X root window background and _XROOTPMAP_ID, as feh --bg-fill does.
|
|
3
3
|
# The native Blaxel image ships no feh, hsetroot or compositor, but it does ship
|
|
4
4
|
# python3-gi and libX11. tint2 reads _XROOTPMAP_ID to draw its transparent panel.
|
|
5
5
|
# Usage: DISPLAY=:99 python3 set-root-wallpaper.py IMAGE
|
|
@@ -100,29 +100,29 @@ fading = false;
|
|
|
100
100
|
vsync = false;
|
|
101
101
|
inactive-opacity = 1.0;
|
|
102
102
|
active-opacity = 1.0;
|
|
103
|
-
`,
|
|
103
|
+
`,Pe="/tmp/ara-dock-browser.png",Se=`[Desktop Entry]
|
|
104
104
|
Name=Chrome
|
|
105
105
|
Exec=chromium --no-sandbox %U
|
|
106
|
-
Icon=${
|
|
106
|
+
Icon=${Pe}
|
|
107
107
|
Type=Application
|
|
108
108
|
Categories=Network;WebBrowser;
|
|
109
|
-
`,
|
|
109
|
+
`,Xe=`[Desktop Entry]
|
|
110
110
|
Name=Terminal
|
|
111
111
|
Exec=bash -c "DISPLAY=:99 xterm -fa DejaVuSansMono -fs 11 -bg black -fg white"
|
|
112
112
|
Icon=/tmp/ara-dock-terminal.png
|
|
113
113
|
Type=Application
|
|
114
114
|
Categories=System;TerminalEmulator;
|
|
115
|
-
`,
|
|
115
|
+
`,fe=`[Desktop Entry]
|
|
116
116
|
Name=Files
|
|
117
117
|
Exec=bash -c "DISPLAY=:99 pcmanfm --no-desktop"
|
|
118
118
|
Icon=/tmp/ara-dock-files.png
|
|
119
119
|
Type=Application
|
|
120
120
|
Categories=System;FileManager;
|
|
121
|
-
`;var V={"wallpaper.jpg":B,"dock-browser.png":O,"dock-terminal.png":k,"dock-files.png":F},
|
|
121
|
+
`;var V={"wallpaper.jpg":B,"dock-browser.png":O,"dock-terminal.png":k,"dock-files.png":F},Te=K,he='set_wallpaper() { if command -v feh >/dev/null 2>&1; then feh --bg-fill "$1"; else python3 "$2" "$1"; fi; }';function v(e){let s=(i)=>i.replaceAll("DISPLAY=:99",`DISPLAY=${e.display}`).replaceAll("/tmp/ara-",`${e.root}/ara-`),p=new Set(e.absent??[]),n=le.split(`
|
|
122
122
|
`).filter((i)=>!(p.has("terminal")&&i.endsWith("/ara-terminal.desktop"))&&!(p.has("files")&&i.endsWith("/ara-files.desktop"))).join(`
|
|
123
|
-
`),t={"openbox/rc.xml":ye(e.screen),"tint2/tint2rc":s(n),"picom/picom.conf":ue,...p.has("terminal")?{}:{"ara-terminal.desktop":s(
|
|
124
|
-
`).flatMap((n)=>{let t=n.indexOf("=");return t>0?[[n.slice(0,t),n.slice(t+1)]]:[]})))}catch{return{}}}var Z=new Set;async function
|
|
125
|
-
`),null}function te(e,s,p){let n=`chromium --no-first-run --no-default-browser-check${process.geteuid?.()===0?" --no-sandbox":""} %U`,t=[["terminal","xterm"],["files","pcmanfm"]].filter(([,i])=>!I(`/usr/bin/${i}`)).map(([i])=>i),o=v({root:e,display:s,screen:p,browserExec:n,absent:t});for(let i of["","openbox","tint2","picom"])G(y(e,i));for(let[i,c]of Object.entries(o.files))U(y(e,i),c,{mode:384});for(let[i,c]of Object.entries(V))U(y(e,`ara-${i}`),
|
|
126
|
-
`);return new Promise((t)=>{let o=H("/bin/sh",["-c",n],{stdio:"ignore",env:{...p,PATH:"/usr/bin:/bin"}}),i=setTimeout(()=>{o.kill(),t()},D);o.once("error",()=>{clearTimeout(i),t()}),o.once("exit",()=>{clearTimeout(i),t()})})}var
|
|
127
|
-
`),n=p.findIndex((o)=>/^\S+ connected/.test(o));if(!s||n<0)return null;let t=[];for(let o of p.slice(n+1)){let i=/^\s+(\d+x\d+)\s/.exec(o);if(!i)break;t.push(i[1])}return{current:{width:Number(s[1]),height:Number(s[2])},maximum:{width:Number(s[3]),height:Number(s[4])},output:p[n].split(" ")[0],modes:t}}async function Fe(e,s,p){if(e.display!==_)return null;let n={PATH:"/usr/bin:/bin",DISPLAY:e.display,XAUTHORITY:e.xauthority},t=(T)=>oe("xrandr",T,n),o=Oe(await t(["--query"])??"");if(!o||o.maximum.width<=o.current.width&&o.maximum.height<=o.current.height)return null;let i=Be(s,o.maximum);if(i.width===o.current.width&&i.height===o.current.height)return{size:i,changed:!1};let c=`${i.width}x${i.height}`;if(!o.modes.includes(c)){if(await t(["--newmode",c,"60",...[i.width,i.width,i.width,i.width,i.height,i.height,i.height,i.height].map(String)]),await t(["--addmode",o.output,c])===null)return null}return p(),await t(["--output",o.output,"--mode",c])===null?null:{size:i,changed:!0}}async function ke(e,s){let p=x({home:a()});if(!p)return;let n=y(p.root,"display"),t=re(n,e,p.pulseaudio);await ne(te(y(n,"theme"),e.display,s),t);let o=s.width-P*2,i=s.height-P-w;await oe("xdotool",["search","--onlyvisible","--class","Chromium","windowsize","%@",String(o),String(i),"windowmove","%@",String(P),String(P)],{...t,PATH:"/usr/bin:/bin"})}var Y=Promise.resolve();function Ge(e,s,p=()=>{}){let n=Y.then(()=>Fe(e,s,p));return Y=n.then((t)=>t?.changed?ke(e,t.size):void 0).catch(()=>{}),n.then((t)=>t?.size??null,()=>null)}async function
|
|
128
|
-
export{
|
|
123
|
+
`),t={"openbox/rc.xml":ye(e.screen),"tint2/tint2rc":s(n),"picom/picom.conf":ue,...p.has("terminal")?{}:{"ara-terminal.desktop":s(Xe)},...p.has("files")?{}:{"ara-files.desktop":s(fe)},"ara-chromium.desktop":s(Se).replace("chromium --no-sandbox %U",e.browserExec),"ara-set-root-wallpaper.py":Te},o=[...R.slice(0,3),he,'[ ! -f "$ROOT/ara-wallpaper.jpg" ] || set_wallpaper "$ROOT/ara-wallpaper.jpg" "$ROOT/ara-set-root-wallpaper.py" || true',...R.slice(3)];return{files:t,start:o}}var R=['ticks() { line=$(cat "/proc/$1/stat" 2>/dev/null) || return 1; rest=${line##*) }; case $rest in Z*|X*) return 1;; esac; printf "%s" "$rest" | cut -d " " -f20; }','alive() { [ -f "$ROOT/$1.pid" ] || return 1; read -r pid start <"$ROOT/$1.pid"; current=$(ticks "$pid") || return 1; [ "$current" = "$start" ] && kill -0 "$pid" 2>/dev/null; }','launch() { name=$1; shift; "$@" 9>&- >"$ROOT/$name.log" 2>&1 & pid=$!; start=$(ticks "$pid"); printf "%s %s\\n" "$pid" "$start" >"$ROOT/$name.pid"; }','if [ -f "$ROOT/tint2/tint2rc" ] && ! alive tint2 && command -v tint2 >/dev/null 2>&1; then launch tint2 tint2 -c "$ROOT/tint2/tint2rc"; fi','if [ -f "$ROOT/picom/picom.conf" ] && ! alive picom && command -v picom >/dev/null 2>&1; then launch picom picom --config "$ROOT/picom/picom.conf"; fi'];var Ae=43200000,_=":99",Ee=60000,D=15000,J={width:1280,height:800},Ne=/^[A-Za-z0-9._:-]{1,160}$/;function Le(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}var Je=["video","viewer","viewer_same_network","viewer_network"];function Ce(e,s=Date.now()){let p=["relay_url","session_id","expires_at"];if(!Le(e)||p.some((c)=>!(c in e))||Object.keys(e).some((c)=>!p.includes(c)&&!Je.includes(c)))throw new r("invalid_display_request","Reason desktop request is malformed.");let n="video"in e?vo(e.video):void 0,t="viewer"in e?Ln(e.viewer):null;if(n===null)throw new r("invalid_display_request","Reason desktop video request is invalid.");let o=null;try{o=typeof e.relay_url==="string"?new URL(e.relay_url):null}catch{}if(!o||o.protocol!=="wss:"&&o.protocol!=="ws:"||o.username||o.password)throw new r("invalid_display_request","Reason desktop relay URL is invalid.");if(typeof e.session_id!=="string"||!Ne.test(e.session_id))throw new r("invalid_display_request","Reason desktop session identity is invalid.");let i=typeof e.expires_at==="string"?Date.parse(e.expires_at):Number.NaN;if(!Number.isFinite(i)||i<=s)throw new r("invalid_display_request","Reason desktop session has already expired.");return{relay_url:e.relay_url,session_id:e.session_id,expires_at:new Date(Math.min(i,s+Ae)).toISOString(),...n?{video:n}:{},...t?{viewer:t}:{},...n&&e.viewer_same_network===!0?{viewer_same_network:!0}:{}}}function $t(e=process.platform){return(e==="linux"||e==="darwin"||e==="win32")&&x()?.features.display===!0}async function Ls(){if(process.platform==="win32")return $t()&&await Pr();if(process.platform!=="darwin")return $t();return await Pr()}function G(e){we(e,{recursive:!0,mode:448});let s=De(e);if(!s.isDirectory()||s.isSymbolicLink()||process.getuid&&s.uid!==process.getuid())throw new r("display_unavailable","Reason desktop state directory is not private.");_e(e,448)}function Ue(e,s){let p=(t)=>{let o=Buffer.alloc(2);return o.writeUInt16BE(t.length),Buffer.concat([o,t])},n=Buffer.from([255,255]);return Buffer.concat([n,p(Buffer.alloc(0)),p(Buffer.from(e)),p(Buffer.from("MIT-MAGIC-COOKIE-1")),p(s)])}function f(e,s,p=2000){return new Promise((n)=>{let t=de(e),o="",i=(c)=>{t.destroy(),n(c)};t.setTimeout(p,()=>i(!1)),t.once("error",()=>i(!1)),t.once("close",()=>i(!1)),t.once("connect",()=>{if(!s)i(!0)}),t.on("data",(c)=>{if(o+=c.toString("latin1"),o.length>=4)i(o.startsWith("RFB "))})})}async function g(e,s){let p=Date.now()+s;while(Date.now()<p){if(await e())return!0;await new Promise((n)=>setTimeout(n,100))}return!1}function d(e,s,p){return new Promise((n)=>{let t=H(e,s,{detached:!0,stdio:"ignore",env:p});t.once("error",()=>n(-1)),t.once("exit",(o)=>n(o)),t.unref(),setTimeout(()=>n(null),D).unref()})}var C=null;function qe(e=a()){return C??=ge(e).finally(()=>{C=null}),C}async function ge(e){let s=x({home:e});if(!s?.xvfb||!s.x11vnc||!s.openbox)throw new r("display_unavailable","Run `reason desktop install` on this machine to enable its desktop.");xt({root:s.root,automation:s.automation,extensionDir:s.extensionDir});let p=y(s.root,"display");G(p);let n=await Me(e,p,s.x11vnc);if(n)return n;let t={display:_,xauthority:y(p,"Xauthority"),rfbSocket:y(p,"rfb.sock")},o=y(p,"pulse"),i=(async()=>{try{G(o)}catch{return null}return await lo(o,s.pulseaudio)})();G(y(p,"home"));let c=re(p,t,s.pulseaudio),T=async()=>({...t,sound:await i});if(await f({path:t.rfbSocket},!0))return pe(y(p,"theme"),R,c),await T();if(!I(t.xauthority))U(t.xauthority,Ue(_.slice(1),Qe(16)),{mode:384,flag:"wx"});let l=te(y(p,"theme"),t.display,J),S={path:`/tmp/.X11-unix/X${_.slice(1)}`};if(!await f(S,!1)){let u=`${J.width}x${J.height}`;if(s.xvnc)ee(t.rfbSocket,{force:!0}),d(s.xvnc,[t.display,"-geometry",u,"-depth","24","-nolisten","tcp","-auth",t.xauthority,"-rfbport","-1","-rfbunixpath",t.rfbSocket,"-SecurityTypes","None","-AlwaysShared","-desktop","Reason"],c);else d(s.xvfb,[t.display,"-screen","0",`${u}x24`,"-nolisten","tcp","-auth",t.xauthority],c);if(!await g(()=>f(S,!1),D)||s.xvnc&&!await g(()=>f({path:t.rfbSocket},!0),D))throw new r("display_unavailable","Reason could not start the virtual display.");d(s.openbox,["--config-file",l.openboxConfig],c)}if(await ne(l,c),!await se(s.x11vnc,t,p,"x11vnc.log",c))throw new r("display_unavailable","Reason could not start the desktop server.");return await T()}function re(e,s,p){let n={HOME:y(e,"home"),PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:s.display,XAUTHORITY:s.xauthority};if(p)n.PULSE_SERVER=Ve(Rn(y(e,"pulse")));return n}async function se(e,s,p,n,t){if(await f({path:s.rfbSocket},!0))return!0;ee(s.rfbSocket,{force:!0});let o=await d(e,["-display",s.display,"-auth",s.xauthority,"-rfbport","0","-rfbportv6","-1","-unixsock",s.rfbSocket,"-nopw","-forever","-shared","-noxdamage","-sb","0","-rfbversion","3.7","-quiet","-bg","-o",y(p,n)],t);if(o!==null&&o!==0)return!1;return await g(()=>f({path:s.rfbSocket},!0),D)}async function me(){let e=["DISPLAY","XAUTHORITY","WAYLAND_DISPLAY","XDG_SESSION_TYPE"],s=(p)=>Object.fromEntries(e.flatMap((n)=>p[n]?[[n,p[n]]]:[]));if(process.env.DISPLAY)return s(process.env);try{let p=await new Promise((n,t)=>z("systemctl",["--user","show-environment"],{encoding:"utf8",timeout:2000},(o,i)=>o?t(o):n(i)));return s(Object.fromEntries(p.split(`
|
|
124
|
+
`).flatMap((n)=>{let t=n.indexOf("=");return t>0?[[n.slice(0,t),n.slice(t+1)]]:[]})))}catch{return{}}}var Z=new Set;async function Me(e,s,p){let n=await me(),t=/^:(\d+)(?:\.\d+)?$/.exec(n.DISPLAY??"")?.[1];if(!t||`:${t}`===_||n.WAYLAND_DISPLAY||n.XDG_SESSION_TYPE==="wayland")return null;let o={display:`:${t}`,xauthority:n.XAUTHORITY??y(e,".Xauthority"),rfbSocket:y(s,`rfb-${t}.sock`)},i=`${o.display} ${o.xauthority}`;if(Z.has(i)||!await f({path:`/tmp/.X11-unix/X${t}`},!1))return null;let c={HOME:e,PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:o.display,XAUTHORITY:o.xauthority};if(await se(p,o,s,`x11vnc-${t}.log`,c))return{...o,sound:null};return Z.add(i),process.stderr.write(`Reason worker: your screen ${o.display} could not be served; using the virtual desktop
|
|
125
|
+
`),null}function te(e,s,p){let n=`chromium --no-first-run --no-default-browser-check${process.geteuid?.()===0?" --no-sandbox":""} %U`,t=[["terminal","xterm"],["files","pcmanfm"]].filter(([,i])=>!I(`/usr/bin/${i}`)).map(([i])=>i),o=v({root:e,display:s,screen:p,browserExec:n,absent:t});for(let i of["","openbox","tint2","picom"])G(y(e,i));for(let[i,c]of Object.entries(o.files))U(y(e,i),c,{mode:384});for(let[i,c]of Object.entries(V))U(y(e,`ara-${i}`),Re(c),{mode:384});return{root:e,openboxConfig:y(e,"openbox","rc.xml"),start:o.start}}function ne(e,s){return pe(e.root,[...e.start,"openbox --reconfigure >/dev/null 2>&1 || true"],s)}function pe(e,s,p){let n=[`ROOT=${JSON.stringify(e)}`,...s].join(`
|
|
126
|
+
`);return new Promise((t)=>{let o=H("/bin/sh",["-c",n],{stdio:"ignore",env:{...p,PATH:"/usr/bin:/bin"}}),i=setTimeout(()=>{o.kill(),t()},D);o.once("error",()=>{clearTimeout(i),t()}),o.once("exit",()=>{clearTimeout(i),t()})})}var We=2073600,je=320;function Be(e,s){let p=Math.min(1,Math.sqrt(We/(e.width*e.height))),n=(t,o)=>Math.min(Math.floor(o/8)*8,Math.max(je,Math.round(t*p/8)*8));return{width:n(e.width,s.width),height:n(e.height,s.height)}}function oe(e,s,p){return new Promise((n)=>z(e,s,{env:p,encoding:"utf8",timeout:5000},(t,o)=>n(t?null:o)))}function Oe(e){let s=/current (\d+) x (\d+), maximum (\d+) x (\d+)/.exec(e),p=e.split(`
|
|
127
|
+
`),n=p.findIndex((o)=>/^\S+ connected/.test(o));if(!s||n<0)return null;let t=[];for(let o of p.slice(n+1)){let i=/^\s+(\d+x\d+)\s/.exec(o);if(!i)break;t.push(i[1])}return{current:{width:Number(s[1]),height:Number(s[2])},maximum:{width:Number(s[3]),height:Number(s[4])},output:p[n].split(" ")[0],modes:t}}async function Fe(e,s,p){if(e.display!==_)return null;let n={PATH:"/usr/bin:/bin",DISPLAY:e.display,XAUTHORITY:e.xauthority},t=(T)=>oe("xrandr",T,n),o=Oe(await t(["--query"])??"");if(!o||o.maximum.width<=o.current.width&&o.maximum.height<=o.current.height)return null;let i=Be(s,o.maximum);if(i.width===o.current.width&&i.height===o.current.height)return{size:i,changed:!1};let c=`${i.width}x${i.height}`;if(!o.modes.includes(c)){if(await t(["--newmode",c,"60",...[i.width,i.width,i.width,i.width,i.height,i.height,i.height,i.height].map(String)]),await t(["--addmode",o.output,c])===null)return null}return p(),await t(["--output",o.output,"--mode",c])===null?null:{size:i,changed:!0}}async function ke(e,s){let p=x({home:a()});if(!p)return;let n=y(p.root,"display"),t=re(n,e,p.pulseaudio);await ne(te(y(n,"theme"),e.display,s),t);let o=s.width-P*2,i=s.height-P-w;await oe("xdotool",["search","--onlyvisible","--class","Chromium","windowsize","%@",String(o),String(i),"windowmove","%@",String(P),String(P)],{...t,PATH:"/usr/bin:/bin"})}var Y=Promise.resolve();function Ge(e,s,p=()=>{}){let n=Y.then(()=>Fe(e,s,p));return Y=n.then((t)=>t?.changed?ke(e,t.size):void 0).catch(()=>{}),n.then((t)=>t?.size??null,()=>null)}async function Bt(e,s={}){let p=s.now??Date.now,n=Ce(e.payload,p());if(e.signal.throwIfAborted(),!n.video)throw new r("display_video_required","Reason desktops stream as video now; this request came without it.");let t=s.platform??process.platform;if(t!=="linux"&&t!=="darwin"&&t!=="win32")throw new r("display_video_unsupported","This machine does not serve desktop video.");let o=n.video,i=(s.video?.desktop??(t==="darwin"?async()=>On:t==="win32"?async()=>In:qe))();return await Ke(e.signal,n,s,p,(c)=>Dn(c,{request:o,desktop:i,...n.viewer?{viewer:n.viewer}:{},viewerSameNetwork:n.viewer_same_network===!0},{resizeDesktop:Ge,...s.video}),(c)=>zt({type:"error",code:c}))}function Ke(e,s,p,n,t,o){let i=n();return new Promise((c,T)=>{let l=null,S=!1,u=!1,m,A,h,M=!1,q=null,X=(b)=>{if(u)return;if(q)b=q;u=!0,clearTimeout(m),clearTimeout(A),e.removeEventListener("abort",N),h?.close();try{l?.close(1000,"display_session_over")}catch{}if("error"in b){T(b.error);return}c({reason:b.reason,...h?.summary(),duration_ms:Math.max(0,n()-i)})},E=()=>X({error:new r("display_relay_unavailable","Reason could not reach the desktop relay.")}),N=()=>{let b=e.reason;X({error:b instanceof r?b:new r("cancelled","Reason closed the desktop session.")})},W=()=>{if(!q||!l)return;let b=q.error;try{l.send(o(b instanceof r?b.code:"display_unavailable"))}catch{}X(q)};if(h=t({get done(){return u||q!==null},get open(){return S&&!u&&q===null},get bufferedAmount(){return l?.bufferedAmount??0},send(b){if(u||q||!S||!l)return;try{l.send(b)}catch{X({reason:"relay_closed"})}},end:(b)=>{if(u||q)return;if(!("error"in b)){X(b);return}if(q=b,M&&S)W()}}),u){h.close();return}if(e.aborted){N();return}e.addEventListener("abort",N,{once:!0}),m=setTimeout(()=>X({reason:"session_expired"}),Math.max(1,Date.parse(s.expires_at)-n())),A=setTimeout(()=>X({reason:"viewer_absent"}),p.viewerWaitMs??Ee);try{l=(p.connect??Dr)(s.relay_url,(p.loadProxy??j)()?.url)}catch{E();return}l.binaryType="arraybuffer",l.onopen=()=>{if(u||!l)return;S=!0,h?.opened()},l.onmessage=(b)=>{if(u)return;let Q=b.data,L=Q instanceof ArrayBuffer?new Uint8Array(Q):ArrayBuffer.isView(Q)?new Uint8Array(Q.buffer,Q.byteOffset,Q.byteLength):null;if(!L||L.byteLength===0)return;if(clearTimeout(A),M=!0,q){W();return}h?.received(L)},l.onclose=()=>{if(u)return;if(!S){E();return}X({reason:"relay_closed"})},l.onerror=()=>{if(u||S)return;E()}})}
|
|
128
|
+
export{$t,Ls,G,qe,Bt};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`);p=e}function
|
|
2
|
+
import{Nt}from"./vm-hands-entry-lite-np07qyeq.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{fe,se,C}from"./vm-hands-entry-lite-vdhgwmmp.js";import{spawn as J,spawnSync as ee}from"child_process";import{existsSync as h,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 A,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(A(A(ae(import.meta.url))),"packages","sandbox-runtime"),pe=c(X,"src","index.ts"),z=!1;function ji(){z=!0}function j(){return z?c(A(re(process.execPath)),"runtime","srt"):void 0}function y(){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"&&!h(c(e,"vendor","seccomp",process.arch,"apply-seccomp")))throw Error("packaged_sandbox_runtime_vendor_missing");if(e&&process.platform==="win32"&&!h(y()))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??h,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??h;if(t==="win32")return(e.bash??fe)()&&o(y())?m??"strict":null;if(t!=="linux")return null;let n=e.hasExecutable??Nt;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,M=!1,p=null,F=null;var m=null,P=null,_=null,E=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 Ui(e){if(m!==null&&m!==e||M&&S!==null&&S!==e||P!==null&&P!==e)D();m=e}function b(e){if(!p)process.stderr.write(`Reason worker: confined commands are off (${e})
|
|
3
|
+
`);p=e}function ur(e){if(p)return!1;if(!M){if(S=xe(e??{}),M=!0,S&&!e)Ce()}return S!==null}function he(){return ur()?S:null}var R=null,x=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(P&&P!==o)D();return P=o,R??=(async()=>{let{SandboxManager:n}=await(e.loadSandboxRuntime??Y)();return await n.initialize(Ne(o,t)),n})().catch((n)=>{if(R=null,t)_=null,process.stderr.write(`Reason worker: the Windows sandbox did not start for this folder (${String(n).slice(0,500)})
|
|
4
4
|
`);else b(`initialize_failed: ${String(n)}`);throw n instanceof r?n:new r("sandbox_unavailable","The confined execution sandbox failed to start.")}),R.then((n)=>{if(p)throw new r("sandbox_unavailable","Confined execution became unavailable during sandbox initialization.");return n})}function O(){if(x-=1,x===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(E){await E;continue}let d=g.keys().next().value;if(_??=d??a,_===a&&(d===void 0||d===a))break;if(!l){l=!0,g.set(a,(g.get(a)??0)+1);continue}if(x===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 x+=1,!0}finally{if(l&&x===0)for(let d of v.splice(0))d();u()}}function Pe(){return E??=Me().finally(()=>{E=null}),E}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=y()){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(C("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
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=y()){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=R;if(R=null,_=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(!
|
|
7
|
-
export{
|
|
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=R;if(R=null,_=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(!ur())return!1;return F??=B(Y),F}async function B(e){try{let{SandboxManager:t}=await e();if(process.platform==="win32"){if(!h(y()))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 hn(e=h,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:y()}}};return{network:{allowedDomains:[],deniedDomains:[]},filesystem:{denyRead:[],allowRead:[],allowWrite:[],denyWrite:[]},...e==="weak"?{enableWeakerNestedSandbox:!0}:{}}}function Hi(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),x+=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??hn(),{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{ji,Ui,ur,hn,Hi};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
${e}`).digest("hex");return new
|
|
4
|
-
${r?.directory??m(e)}`).digest("hex")}var
|
|
5
|
-
`)),E.on("data",(A)=>{if(C+=A.toString(),Buffer.byteLength(C)>16384)E.destroy(Error("worker_control_oversize"))}),E.on("error",(A)=>{if("code"in A&&["ECONNREFUSED","ENOENT"].includes(String(A.code)))x(null);else x(null,A.message==="worker_control_timeout"?A:Error("worker_control_unavailable"))}),E.on("end",()=>{try{let A=cr.parse(JSON.parse(C));if(A.instanceId!==b.nonce)throw Error("worker_instance_changed");x(A)}catch{x(null,Error("worker_control_invalid_response"))}}),E.once("close",()=>x(null,Error("worker_control_unavailable")))})}import{realpathSync as wr}from"fs";import{constants as Se}from"fs";import{open as pr}from"fs/promises";var oa={platform:process.platform,home:a,async openFile(e){let r=await pr(e,Se.O_RDONLY|Se.O_NOFOLLOW|Se.O_NONBLOCK);return{isFile:async()=>(await r.stat()).isFile(),close:()=>r.close()}}};var Ha=Po(wr(process.execPath));var ms=Buffer.from([0,255,3,4]);import{execFile as Zr}from"child_process";import{promisify as Qr}from"util";var vr=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 Sr=new Set(["png","jpg","jpeg","gif","webp"]),Rr=new Set(["webm","mp4"]);function Er(e){if(!e)return null;try{return new URL(e).origin}catch{return null}}function at(e,r){let p;try{p=new URL(e)}catch{return null}let b=Er(r),R=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:"||!R&&p.origin!==b||p.username||p.password||p.port||p.search||p.hash)return null;let S=vr.exec(p.pathname);if(!S)return null;let P=S[1]?.toLowerCase(),E=S[2]?.toLowerCase(),C=S[3]?.toLowerCase(),L=S[4]?.toLowerCase();if(!P||!E||!C||!L)return null;let x=Sr.has(L)?"image":Rr.has(L)?"video":null;if(!x)return null;let A=/^(before|after)[\s:_-]+/.exec(C),D=p.pathname.replace(/^\/media\//,"");return{url:p.toString(),storagePath:D,runId:P,artifactId:E,fileName:`${C}.${L}`,kind:x,phase:A?.[1]==="before"||A?.[1]==="after"?A[1]:null}}var Pr=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,st=(e)=>Boolean(e&&typeof e==="object"&&!Array.isArray(e)),K=()=>{throw Error("cloud_browser_media_request_invalid")};function Pe(e){if(!st(e)||Object.keys(e).some((S)=>!["runId","configuredMediaOrigin","media"].includes(S))||typeof e.runId!=="string"||!Pr.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||!je(r.origin,{mode:"public_web"}).allowed)return K();let p=e.runId.toLowerCase(),b=new Set,R=e.media.map((S)=>{if(!st(S)||Object.keys(S).some((E)=>!["url","sourceUrl","kind"].includes(E))||typeof S.url!=="string"||S.url.length>2048||typeof S.sourceUrl!=="string"||S.sourceUrl.length>8192||!["image","video"].includes(String(S.kind)))return K();let P=at(S.url,r.origin);if(!P||new URL(P.url).origin!==r.origin||P.runId!==p||P.kind!==S.kind||P.url!==S.url||b.has(S.url))return K();if(b.add(S.url),S.sourceUrl!==S.url){let E;try{E=new URL(S.sourceUrl)}catch{return K()}let C=/^\/(?:[a-f0-9]{40}|[a-f0-9]{64})\/([a-f0-9]+)$/.exec(E.pathname)?.[1];if(S.kind!=="image"||E.origin!=="https://camo.githubusercontent.com"||E.username||E.password||E.search||E.hash||!C||C.length%2!==0||Buffer.from(C,"hex").toString("utf8")!==S.url)return K()}return{url:S.url,sourceUrl:S.sourceUrl,kind:S.kind}});return{runId:e.runId,configuredMediaOrigin:r.origin,media:R}}var I=t().uuid(),X=t().regex(/^[a-f0-9]{64}$/),V=y.datetime({precision:3}),Ce=t().regex(/^[a-zA-Z0-9_-]{1,160}$/),ut=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:Ce,userId:Ce,sessionId:Ce,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),Cr=rn().transform((e,r)=>{try{return an(e)}catch{return r.addIssue({code:"custom",message:"proof_visual_contract_invalid"}),Lo}}),ue=i({version:n(1),owner:U,contextId:I,preparedAt:V,expiresAt:V,prUrl:ut,headSha:t().regex(/^[a-f0-9]{40}$/),skillDigest:X,evidenceKind:s(["image","video"]),visualPlan:Cr.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),Ar=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),b=Date.parse(e.finishedAt);if(p<Date.parse(e.context.preparedAt)||b<p||b>Date.parse(e.context.expiresAt)||b-p>30000||e.media.contentType==="video/webm"&&(e.media.receivedFrameCount<e.media.frameCount||Math.abs((b-p)/1000-e.media.durationSeconds)>0.1))r.addIssue({code:"custom",message:"mac_pr_proof_capture_chronology_invalid"})}),dc=_("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(),Ir=["browser_unavailable","github_page_unavailable","identity_check_failed","operation_incomplete","attachment_unavailable"],xr=_("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(Ir).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:ut,repositoryId:ce,headSha:t().regex(/^[a-f0-9]{40}$/),sha256:X,sizeBytes:o().int().min(128).max(10485760),contentType:n("video/webm")}).strict(),ft=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}$/),Lr=_("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:ft,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:ft,observedActor:fe,bodySha256:X}),Mr=_("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)),Tr=rn().transform((e,r)=>{try{let p=Pe(e);if(p.media.some((b)=>b.kind!=="image"))throw Error();return p}catch{return r.addIssue({code:"custom",message:"proof_media_request_invalid"}),Lo}}),Wr=_("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:Tr}).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 Nr=i({requestId:I,command:Wr}).strict();var $r={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},lt={type:"string",format:"uuid",description:"capture_context_id from tools.pr.prepareProof."},dt={type:"integer",minimum:1,description:"An already-owned tab's id."},uc={...$r,oneOf:[{type:"object",required:["action","context_id","tab_id"],additionalProperties:!1,properties:{action:{type:"string",const:"screenshot"},context_id:lt,tab_id:dt}},{type:"object",required:["action","context_id","tab_id","seconds"],additionalProperties:!1,properties:{action:{type:"string",const:"start_video"},context_id:lt,tab_id:dt,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 gc=i({operationId:t().uuid(),attemptId:t().uuid(),contextId:t().uuid(),tabId:o().int().positive()}).strict();var Br=String.raw`async (media) => {
|
|
2
|
+
import{_,Io,ke}from"./vm-hands-entry-lite-k83rkcys.js";import{l,Wt,Ke,Nr,Vt,Mr,dt}from"./vm-hands-entry-lite-8qvsnkvv.js";import{wt,or}from"./vm-hands-entry-lite-b8yapqfn.js";import{dn}from"./vm-hands-entry-lite-eay4tbg0.js";import{B,m,te,Ue}from"./vm-hands-entry-lite-t0exw1jk.js";import{F}from"./vm-hands-entry-lite-4x8j1xp9.js";import{To}from"./vm-hands-entry-lite-1y629eqh.js";import{xe,Ye,Jn,Wr}from"./vm-hands-entry-lite-m753n72c.js";import{f,v,h}from"./vm-hands-entry-lite-52x189kf.js";import{a}from"./vm-hands-entry-lite-cf1x5cbr.js";import{Fo,nn,y,t,k,Et,o,d,Oe,u,i,c,g,ss,s,n,on}from"./vm-hands-entry-lite-5agyspqp.js";import{closeSync as Lh,existsSync as Mh,mkdirSync as Dh,openSync as Th,readdirSync as Wh,realpathSync as pe,rmSync as Nh}from"fs";import{dirname as $h,join as J,resolve as Bh}from"path";import{createHash as Ct}from"crypto";import{platform as At}from"os";import{join as It}from"path";var xt=g("store",[c({version:n(1),store:n("keychain")}),c({version:n(1),store:n("file"),api_key:t().min(1).max(4096)})]),We=(e)=>It(e,"api-key.json");function Ne(e){let r=Ct("sha256").update(`reason-connect-api-key
|
|
3
|
+
${e}`).digest("hex");return new Ke(Wt(),At(),r)}function we(e,r=Ne(e)){if(!f(We(e)))return null;let p=xt.parse(JSON.parse(h(We(e))));if(p.store==="file")return p.api_key;try{let b=r.loadBinding();return b?new TextDecoder().decode(b):null}catch(b){if(!(b instanceof l))throw b;throw Error("worker_api_key_unreadable")}}import{readdirSync as Gt,renameSync as Fn,rmSync as jn}from"fs";import{join as ee}from"path";import{createHash as Mt}from"crypto";import{platform as Dt}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 rn=i({version:n(1),device_id:t().min(1).max(160),offer:Oe().optional(),enrollment_ms:o().int().nonnegative().max(or).optional()});function z(e,r=!1){v(m(e),r);let p=["local-device.key","local-device.binding","device.json"].filter((b)=>{let R=N(m(e),b);if(!f(R))return!1;return h(R),!0});return e.lifetime==="persistent"&&p.join()==="device.json"?Tt(e):new Nr(m(e))}function Tt(e){return new Ke(Wt(),Dt(),Nt(e))}function Nt(e){let r=Bt(e);return Mt("sha256").update(`reason-worker
|
|
4
|
+
${r?.directory??m(e)}`).digest("hex")}var Ht="keychain-scope.json";var $t=c({version:n(1),directory:t().min(1),devicePublicKey:t().min(1)});function Bt(e){let r=N(m(e),Ht);if(!f(r))return null;let p=$t.safeParse(JSON.parse(h(r))),b=w(e).state;if(!p.success||!f(b))return null;return JSON.parse(h(b))?.devicePublicKey===p.data.devicePublicKey?p.data:null}function M(e){if(!f(m(e)))return null;let r=Mr(w(e).state,{proofStore:z(e),repair:!1}),p=r!==null&&Io(e.apiOrigin,r.apiOrigin),b=p?[te(e),te({...e,apiOrigin:r.apiOrigin})]:[te(e)];if(r&&(!b.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 Ut=c({version:n(1),drained:d(),revoked:d()});function H(e){let r=w(e).control;return f(r)?Ut.parse(JSON.parse(h(r))):{version:1,drained:!1,revoked:!1}}var jt=c({read:d(),write:d(),execute:d(),discover_environment:d(),expose_mcp:n(!1)}),qt=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:jt,execution_mode:s(["confined","host"]).default("confined")}),folders:u(c({path_fingerprint:t().regex(/^[a-f0-9]{64}$/)})).min(1).max(31).optional()}),_n=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:Oe().optional()});var Nn=c({version:n(1),install_id:k(),fingerprint_key:t().regex(/^[a-f0-9]{64}$/)}),Hn=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 $n=i({credentialKind:s(["oauth","api_key"]).optional(),apiOrigin:Et(),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 je=8;var Yt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,_e=(e)=>ee(m(e),"workspaces"),Xt="account.json",Zt=(e)=>f(ee(e,Xt));function Se(e){let r;try{r=Gt(_e(e))}catch{return[]}return r.filter((p)=>Yt.test(p)).sort().map((p)=>{let b=ee(_e(e),p),R=ee(b,"worker.json"),S=null;try{let P=B.safeParse(JSON.parse(h(R)));if(P.success&&P.data.stateDirectory===b)S=P.data}catch{}return{organizationId:p,directory:b,configPath:R,config:S,account:Zt(b)}})}var Qt=(e)=>ee(_e(e),"listed.json");function er(e){try{let r=JSON.parse(h(Qt(e))),p=r.names&&typeof r.names==="object"&&!Array.isArray(r.names)?Object.fromEntries(Object.entries(r.names).filter((R)=>typeof R[1]==="string")):{},b=r.refused&&typeof r.refused==="object"?r.refused:null;return{listed:r.listed===!0,reason:r.reason==="sign_in"?"sign_in":null,blocked:Array.isArray(r.blocked)?r.blocked.filter((R)=>typeof R==="string"):[],names:p,...b&&typeof b.device==="string"&&typeof b.roots==="string"&&typeof b.at==="number"&&Number.isFinite(b.at)&&typeof b.count==="number"&&Number.isInteger(b.count)&&b.count>=1?{refused:{device:b.device,roots:b.roots,at:b.at,count:b.count}}:{}}}catch{return null}}function qe(e,r){let p=Se(e),b=p.filter((C)=>C.account),R=p.filter((C)=>!C.account),S=er(e),P=S&&!S.listed?S.reason:null,E=P||R.length===0&&S&&!S.listed?[]:R;if(b.length===0&&E.length===0&&(P||S&&!S.listed))return{workspaces:null,off:P};return{off:P,workspaces:[...b,...E].map(({organizationId:C,config:L,account:x})=>{let A=!1,D=null,T=!1,he=null;try{A=L?H(L).revoked:!1,D=L&&!A?M(L):null;let Te=L?dt(w(L).daemon):null;T=r&&!!D&&Te?.state==="connected",he=T?Vt(Te,D):null}catch{}return{...he?{permission_recovery:he}:{},organization_id:C,device_id:D?.deviceId??null,name:S?.names?.[C]??null,root:D?.roots[0]?{id:D.roots[0].id,permissions:D.roots[0].permissions}:null,state:A?"removed":T?"connected":"not_running",blocked:!x&&!A&&!T&&(S?.blocked.includes(C)??!1),...x?{account:!0}:{}}})}}import{readFileSync as rr}from"fs";function lr(e){try{let r=JSON.parse(rr(`${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 Ni,lstatSync as Ze,mkdtempSync as Hi,realpathSync as nr,rmdirSync as $i,rmSync as Bi,unlinkSync as Ui}from"fs";import{createConnection as ir,createServer as ji}from"net";import{basename as Je,dirname as Ge,join as oe}from"path";var ar=s(["status","drain","resume","stop","reload_roots"]),sr=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(wt)).max(wt.length).optional(),capabilityReadiness:ss(s(wt),d()).optional(),lastHeartbeat:t().nullable(),expiresAt:t()}),Gi=c({nonce:t(),action:ar}),cr=i({nonce:k()}),dr=c({version:n(1),nonce:k(),socketPath:t().max(100)});function ur(e){return oe(w(e).lock,"control.json")}function Qe(e){return v(w(e).lock),cr.parse(JSON.parse(h(oe(w(e).lock,"owner.json"))))}function Xe(e){if(!f(e))return!1;let r=Ze(e);if(!r.isSocket()||r.uid!==process.getuid?.()||(r.mode&63)!==0)throw Error("worker_control_socket_not_private");return!0}function et(e,r){let p=ur(e);if(!f(p)){let S=w(e).socket;if(!f(S)||!Ze(S).isSocket())return null;return Xe(S)?S:null}let b=dr.parse(JSON.parse(h(p)));if(b.nonce!==r)throw Error("worker_instance_changed");if(process.platform==="win32"){if(!fr.test(b.socketPath))throw Error("worker_control_endpoint_invalid");return b.socketPath}let R=Ge(b.socketPath);if(Ge(R)!==nr("/tmp")||!/^(?:reason|ara)-worker-[A-Za-z0-9]{6}$/.test(Je(R))||Je(b.socketPath)!=="control.sock"||Buffer.byteLength(b.socketPath)>100)throw Error("worker_control_endpoint_invalid");if(!f(R))return null;return v(R),Xe(b.socketPath)?b.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"))),b=p&&typeof p==="object"?p[r]:void 0;return typeof b==="string"?b:null}catch{return null}}function tt(e){return mr(e,"runtime_version")}function ot(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 et(e,Qe(e).nonce)?"socket_refused":"no_socket"}catch{return"bad_reply"}}var Yi=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 b=Qe(e),R=et(e,b.nonce);if(!R)return null;return new Promise((S,P)=>{let E=ir(R),C="",L=!1,x=(A,D)=>{if(L)return;if(L=!0,E.destroy(),D)P(D);else S(A)};E.setTimeout(2000,()=>E.destroy(Error("worker_control_timeout"))),E.on("connect",()=>E.write(JSON.stringify({nonce:b.nonce,action:r})+`
|
|
5
|
+
`)),E.on("data",(A)=>{if(C+=A.toString(),Buffer.byteLength(C)>16384)E.destroy(Error("worker_control_oversize"))}),E.on("error",(A)=>{if("code"in A&&["ECONNREFUSED","ENOENT"].includes(String(A.code)))x(null);else x(null,A.message==="worker_control_timeout"?A:Error("worker_control_unavailable"))}),E.on("end",()=>{try{let A=sr.parse(JSON.parse(C));if(A.instanceId!==b.nonce)throw Error("worker_instance_changed");x(A)}catch{x(null,Error("worker_control_invalid_response"))}}),E.once("close",()=>x(null,Error("worker_control_unavailable")))})}import{realpathSync as wr}from"fs";import{constants as Re}from"fs";import{open as pr}from"fs/promises";var oa={platform:process.platform,home:a,async openFile(e){let r=await pr(e,Re.O_RDONLY|Re.O_NOFOLLOW|Re.O_NONBLOCK);return{isFile:async()=>(await r.stat()).isFile(),close:()=>r.close()}}};var Ha=To(wr(process.execPath));var fs=Buffer.from([0,255,3,4]);import{execFile as Zr}from"child_process";import{promisify as Qr}from"util";var vr=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 Sr=new Set(["png","jpg","jpeg","gif","webp"]),Rr=new Set(["webm","mp4"]);function Er(e){if(!e)return null;try{return new URL(e).origin}catch{return null}}function at(e,r){let p;try{p=new URL(e)}catch{return null}let b=Er(r),R=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:"||!R&&p.origin!==b||p.username||p.password||p.port||p.search||p.hash)return null;let S=vr.exec(p.pathname);if(!S)return null;let P=S[1]?.toLowerCase(),E=S[2]?.toLowerCase(),C=S[3]?.toLowerCase(),L=S[4]?.toLowerCase();if(!P||!E||!C||!L)return null;let x=Sr.has(L)?"image":Rr.has(L)?"video":null;if(!x)return null;let A=/^(before|after)[\s:_-]+/.exec(C),D=p.pathname.replace(/^\/media\//,"");return{url:p.toString(),storagePath:D,runId:P,artifactId:E,fileName:`${C}.${L}`,kind:x,phase:A?.[1]==="before"||A?.[1]==="after"?A[1]:null}}var Pr=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,st=(e)=>Boolean(e&&typeof e==="object"&&!Array.isArray(e)),K=()=>{throw Error("cloud_browser_media_request_invalid")};function Pe(e){if(!st(e)||Object.keys(e).some((S)=>!["runId","configuredMediaOrigin","media"].includes(S))||typeof e.runId!=="string"||!Pr.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||!Ue(r.origin,{mode:"public_web"}).allowed)return K();let p=e.runId.toLowerCase(),b=new Set,R=e.media.map((S)=>{if(!st(S)||Object.keys(S).some((E)=>!["url","sourceUrl","kind"].includes(E))||typeof S.url!=="string"||S.url.length>2048||typeof S.sourceUrl!=="string"||S.sourceUrl.length>8192||!["image","video"].includes(String(S.kind)))return K();let P=at(S.url,r.origin);if(!P||new URL(P.url).origin!==r.origin||P.runId!==p||P.kind!==S.kind||P.url!==S.url||b.has(S.url))return K();if(b.add(S.url),S.sourceUrl!==S.url){let E;try{E=new URL(S.sourceUrl)}catch{return K()}let C=/^\/(?:[a-f0-9]{40}|[a-f0-9]{64})\/([a-f0-9]+)$/.exec(E.pathname)?.[1];if(S.kind!=="image"||E.origin!=="https://camo.githubusercontent.com"||E.username||E.password||E.search||E.hash||!C||C.length%2!==0||Buffer.from(C,"hex").toString("utf8")!==S.url)return K()}return{url:S.url,sourceUrl:S.sourceUrl,kind:S.kind}});return{runId:e.runId,configuredMediaOrigin:r.origin,media:R}}var I=t().uuid(),X=t().regex(/^[a-f0-9]{64}$/),V=y.datetime({precision:3}),Ce=t().regex(/^[a-zA-Z0-9_-]{1,160}$/),ut=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:Ce,userId:Ce,sessionId:Ce,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),Cr=on().transform((e,r)=>{try{return dn(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:ut,headSha:t().regex(/^[a-f0-9]{40}$/),skillDigest:X,evidenceKind:s(["image","video"]),visualPlan:Cr.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),Ar=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:g("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),b=Date.parse(e.finishedAt);if(p<Date.parse(e.context.preparedAt)||b<p||b>Date.parse(e.context.expiresAt)||b-p>30000||e.media.contentType==="video/webm"&&(e.media.receivedFrameCount<e.media.frameCount||Math.abs((b-p)/1000-e.media.durationSeconds)>0.1))r.addIssue({code:"custom",message:"mac_pr_proof_capture_chronology_invalid"})}),dc=g("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(),Ir=["browser_unavailable","github_page_unavailable","identity_check_failed","operation_incomplete","attachment_unavailable"],xr=g("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(Ir).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:ut,repositoryId:ce,headSha:t().regex(/^[a-f0-9]{40}$/),sha256:X,sizeBytes:o().int().min(128).max(10485760),contentType:n("video/webm")}).strict(),ft=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}$/),Or=g("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:ft,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:ft,observedActor:fe,bodySha256:X}),Lr=g("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)),Dr=on().transform((e,r)=>{try{let p=Pe(e);if(p.media.some((b)=>b.kind!=="image"))throw Error();return p}catch{return r.addIssue({code:"custom",message:"proof_media_request_invalid"}),Fo}}),Tr=g("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:Dr}).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 Hr=i({requestId:I,command:Tr}).strict();var $r={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},ct={type:"string",format:"uuid",description:"capture_context_id from tools.pr.prepareProof."},lt={type:"integer",minimum:1,description:"An already-owned tab's id."},uc={...$r,oneOf:[{type:"object",required:["action","context_id","tab_id"],additionalProperties:!1,properties:{action:{type:"string",const:"screenshot"},context_id:ct,tab_id:lt}},{type:"object",required:["action","context_id","tab_id","seconds"],additionalProperties:!1,properties:{action:{type:"string",const:"start_video"},context_id:ct,tab_id:lt,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 gc=i({operationId:t().uuid(),attemptId:t().uuid(),contextId:t().uuid(),tabId:o().int().positive()}).strict();var Br=String.raw`async (media) => {
|
|
6
6
|
const deadline = (promise) => {
|
|
7
7
|
let timer;
|
|
8
8
|
return Promise.race([promise, new Promise((_, reject) => {
|
|
@@ -49,4 +49,4 @@ ${r?.directory??m(e)}`).digest("hex")}var Nt="keychain-scope.json";var Ht=c({ver
|
|
|
49
49
|
}
|
|
50
50
|
}));
|
|
51
51
|
return { verified: true, items };
|
|
52
|
-
}`;import{execFile as Ur}from"child_process";import{promisify as Fr}from"util";var vc=Fr(Ur);var $c=
|
|
52
|
+
}`;import{execFile as Ur}from"child_process";import{promisify as Fr}from"util";var vc=Fr(Ur);var $c=g("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()]),Bc=i({version:n("0.1.42"),metadata:i({extensionId:t(),extensionInstanceId:t(),nativeHostName:t()})});var jc=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(),mt=i({action:n("inspect"),recording_operation_id:t().uuid()}).strict(),qc=g("action",[me,mt]),pt=i({recording_operation_id:t().uuid()}).strict(),Ie={device_id:t().uuid(),root_id:t().uuid()},qr=g("action",[me.extend(Ie),mt.extend(Ie),pt.extend({...Ie,action:n("stop")})]),zc=nn(qr),Kc=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 rl=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 zr}from"child_process";import{promisify as Kr}from"util";var al=Kr(zr);var Vr=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),ht=i({path:j,sha256:t().regex(/^[a-f0-9]{64}$/)}).strict(),Jr=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:ht,ffprobe:ht}).strict()}).strict();var Cl=i({version:n("0.1.42"),metadata:i({extensionId:t(),extensionInstanceId:t(),nativeHostName:t()})});var $l=i({operationId:t().uuid()}).strict();var nd=Qr(Zr);var id=i({version:n("0.1.42"),metadata:i({extensionId:n(F),extensionInstanceId:t().min(1).max(1024)})});var Le=1;var Cf=c({type:n("configure"),protocol:n(Le),version:t(),config:B}),Af=c({type:n("ticket"),organizationId:t().min(1).max(160),receipt:Oe()}),If=c({type:s(["ping","stop"])});var zf=c({type:n("hello"),protocol:n(Le),version:t(),platform:s(["linux","darwin"]),architecture:s(["arm64","x64"]),enrolled:d()}),Kf=c({type:n("ticket-request"),request:c({install_id:k(),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)})}),Vf=g("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 go=1;var Z=k(),wo=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)}),yo=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 b=p.pathname.split("/");if(b.length!==4||b[1]!=="device"||!Z.safeParse(b[2]).success||!/^[a-f0-9]{64}$/.test(b[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 Yf=c({protocol:n(go),type:n("ssh_install_relay"),authorityToken:t().regex(/^(?:reason|ara)_ssh_install_[A-Za-z0-9_-]{43}$/),authority:wo,relayUrl:yo,endpoint:c({host:n("127.0.0.1"),port:n(22)})});class Rt extends Error{}function Be(e){if(!f(e))return null;let r=new Rt(`${e} is not a valid worker config. Remove it to start over.`),p;try{p=JSON.parse(h(e))}catch(R){if(R instanceof SyntaxError)throw r;throw R}let b=B.safeParse(p);if(!b.success)throw r;return b.data}var Co=200;var qp=c({version:n(1),session_ids:u(t().min(1).max(200)).max(Co)});function rt(e,r,p=!1){let b=Ao(e,r,p);return b.length===1?b[0]:J(ke(J(e,".config")),...Pt(r,p))}var Pt=(e,r)=>[...e==="production"?[]:[e],r?"connect-once":"connect"];function Ao(e,r,p=!1){let b=e;try{b=pe(e)}catch{}return["ara","reason"].map((R)=>J(b,".config",R,...Pt(r,p))).filter(xo)}function xo(e){try{if(pe(e)!==e)return!1;return Be(J(e,"worker.json"))?.stateDirectory===e}catch{return!1}}var Oo="disconnected.json";function us(e,r){return f(J(rt(e,r),Oo))}function Lo(e,r){return r==="darwin"&&e.userChrome!==!1}var _g=i({root:i({id:t().min(1).max(160),label:t().max(160),path_fingerprint:t()})});var bg=Symbol("serve here");async function ds(e={}){let r=pe(e.home??a()),p=Be(J(rt(r,e.channel??_()),"worker.json"));if(!p)return null;let b,R=await(e.controlWorker??G)(p,"status").catch((T)=>(b=T instanceof Error?T:Error(String(T)),null)),S=R?tt(p):null,P=e.serviceHost??xe(r),E=Ye(p,P,"connect"),C=H(p).revoked,L=!C&&!R,x=(()=>{try{return M(p)}catch{return null}})(),{workspaces:A,off:D}=C||we(p.stateDirectory)!==null?{workspaces:null,off:null}:qe(p,R?.phase==="running");return{workspaces:A,workspaces_off:D,workspaces_max:je+(A?.filter((T)=>T.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:Lo(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((T)=>({id:T.id,folder:T.path,permissions:T.permissions}))??[],state:C?"removed":R?R.phase==="running"?"connected":R.phase:"not_running",not_running_reason:L?ot(p,b):null,worker_alive:L&&E?Jn(E,P):null,sessions_running:R?.activeSessions??null,version:S,service:E?{label:E.label,logs:E.logs}:null}}function ps(e={}){let r=pe(e.home??a()),p=Be(J(rt(r,e.channel??_()),"worker.json"));if(!p)return null;return Wr(p,e.serviceHost??xe(r),"connect")?.label??null}export{w,M,lr,Be,rt,us,ds,ps};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{mt}from"./vm-hands-entry-lite-9fzydv1p.js";import{a}from"./vm-hands-entry-lite-cf1x5cbr.js";import{randomUUID as L}from"crypto";import{spawnSync as b}from"child_process";import{chmodSync as ee,cpSync as te,existsSync as x,lstatSync as A,mkdirSync as Y,readdirSync as ne,readFileSync as w,readlinkSync as re,realpathSync as T,renameSync as E,rmdirSync as ie,rmSync as g,symlinkSync as M,writeFileSync as oe}from"fs";import{dirname as I,join as u,relative as se,resolve as ce}from"path";var Zn="so.ara.cli",k=[Zn,"com.reasonmachines.cli"],F="5LJFSBRY2F";function Vr(e){return`(${e.map((t)=>`identifier "${t}"`).join(" or ")}) and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and certificate leaf[subject.OU] = "${F}"`}var G="ReasonBackgroundIdentity",Ao="Contents/Helpers/ReasonPermissionTile",ae="so.ara.cli.permission-tile",Ne=Vr([ae,"com.reasonmachines.cli.permission-tile"]),v="AraBackgroundIdentity",ue="Reason",Ce=Vr(k),de=`anchor apple generic and (${k.map((e)=>`identifier "${e}"`).join(" or ")}) and certificate leaf[subject.OU] = "${F}"`;class h extends Error{code;constructor(e,t){super(t);this.code=e;this.name="MacOSBackgroundIdentityError"}}var R="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister";function le(e=a()){return u(e,"Library","Application Support","Reason","Background","Reason.app")}function O(e=a()){return u(e,"Library","Application Support","Ara","Background","Ara.app")}function fe(e){try{return A(e).isFile()}catch{return!1}}function D(e){return[G,v].map((t)=>u(e,"Contents","MacOS",t)).find(fe)??null}function d(e){try{if(!A(e).isDirectory())return!1;let t=w(u(e,"Contents","Info.plist"),"utf8");return k.some((n)=>t.includes(`<string>${n}</string>`))&&(t.includes(`<string>${ue}</string>`)||t.includes("<string>Ara</string>"))&&D(e)!==null}catch{return!1}}function Gr(e=a()){let t=le(e);if(!d(t))return null;try{let n=w(u(t,"Contents","Info.plist"),"utf8");return/<key>CFBundleVersion<\/key>\s*<string>(\d+\.\d+\.\d+)<\/string>/.exec(n)?.[1]??null}catch{return null}}function pe(e,t=a()){let n=Gr(t);return n===null||j(N(n.split(".")),N(e.split(/[.-]/).slice(0,3)))}var ge=1e4;function K(e,t){return b(e,[...t],{stdio:"ignore",timeout:ge}).status??1}var W=new Set;function H(e){if(process.env.REASON_TEST_REFUSE_REAL_IDENTITY!=="1")return;let t=(n)=>{try{return T(n)}catch{return ce(n)}};if(e!==void 0&&t(e)!==t(a()))return;throw Error("A test tried to change this computer's real Reason background identity; pass a temporary home. Refused by scripts/test-env.ts.")}var V=/\/(?:runtime|CLI)\/versions\/(\d+)\.(\d+)\.(\d+)[^/]*\/[^/]+$|\/\.(?:ara|reason)(?:-staging)?-worker-(\d+)\.(\d+)\.(\d+)[^/]*\/[^/]+$/,J=new Set(["ara","ara.exe","reason","reason.exe"]);function N(e){return e.map((t)=>Number(t))}function j(e,t){for(let n=0;n<3;n+=1)if(e[n]!==t[n])return e[n]<t[n];return!1}var ye=[0,2,161];function me(e){if(e===null)return!0;let t=ye,n=null;try{n=T(process.execPath)}catch{}return e.some((r)=>{let i=V.exec(r);if(i){let f=i[1]===void 0?i.slice(4,7):i.slice(1,4);return j(N(f),t)}let o=r.slice(r.lastIndexOf("/")+1);return J.has(o)&&r!==n&&r!==process.execPath})}function Ee(){let e=b("/bin/ps",["-xo","pid=,comm="],{encoding:"utf8",timeout:5000});if(e.status!==0)return null;let t=[];for(let n of e.stdout.split(`
|
|
3
3
|
`)){let r=/^\s*(\d+)\s+(\S.*)$/.exec(n);if(!r||Number(r[1])===process.pid)continue;let i=r[2].trimEnd(),o=i.slice(i.lastIndexOf("/")+1);if(!V.test(i)&&J.has(o)){let c=b("/usr/sbin/lsof",["-a","-p",r[1],"-d","txt","-Fn"],{encoding:"utf8",timeout:5000}).stdout?.split(`
|
|
4
4
|
`).find((l)=>l.startsWith("n/"));if(c)i=c.slice(1)}t.push(i)}return t}function _e(e){if(H(e.home),!d(e.sourceApp))throw new h("identity_invalid","The packaged Reason background identity is missing or invalid.");let t=e.command??K,n=le(e.home),r=I(n);Y(r,{recursive:!0,mode:448}),ee(r,448);let i=T(e.sourceApp),o=null;try{o=T(n)}catch{}if(i!==o){let f=`${process.pid}.${L()}`,c=u(r,`.Reason.app.${f}.tmp`),l=u(r,`.Reason.app.${f}.old`),y=!1;try{if(te(i,c,{recursive:!0,errorOnExist:!0,preserveTimestamps:!0}),!d(c))throw new h("identity_invalid","The copied Reason background identity is invalid.");let _=e.releaseSigned?["--test-requirement",`=${de}`]:[];if(t("/usr/bin/codesign",["--verify","--strict",..._,c])!==0)throw new h("identity_invalid_signature","The installed Reason background identity has an invalid signature.");let S=!1;for(let p=0;p<4;p+=1){let m=!1;try{E(n,l),m=!0,y=!0}catch(s){if(s.code!=="ENOENT")throw s}if(p===0)e.beforePublish?.();try{E(c,n),S=!0}catch(s){let Z=s.code;if(!["EEXIST","ENOTEMPTY"].includes(Z??""))throw s;if(m)g(l,{recursive:!0,force:!0}),y=!1;if(p===3)throw s;continue}if(m)g(l,{recursive:!0,force:!0}),y=!1;break}if(!S)throw Error("Could not publish Reason's background identity.")}catch(_){if(y&&!x(n)&&x(l))E(l,n);throw _}finally{g(c,{recursive:!0,force:!0}),g(l,{recursive:!0,force:!0})}}return z(n,e,{verified:i!==o}),n}function X(e){return u(I(e),".Reason.app.registered")}function q(e){try{let t=A(e);return t.isDirectory()?`${t.ino}:${t.birthtimeMs}`:null}catch{return null}}function C(e){let t=q(e);try{return t!==null&&w(X(e),"utf8")===t}catch{return!1}}function Q(e){if(d(e))return"bundle";try{if(A(u(e,"Contents","Info.plist"),{throwIfNoEntry:!1}))return null;return A(u(e,"Contents","MacOS",v)).isSymbolicLink()?"retired":null}catch{return null}}function z(e,t,n={}){let r=t.command??K;if(!n.verified&&r("/usr/bin/codesign",["--verify","--strict",e])!==0)throw new h("identity_invalid_signature","The installed Reason background identity has an invalid signature.");if(r(R,["-f",e])!==0)throw new h("identity_register_failed","Could not register Reason's macOS background identity.");let i=q(e);try{if(i)oe(X(e),i,{mode:384})}catch{}try{Se(e,t.home,r,t.runningExecutables??Ee)}catch(o){let f=o.code??"unknown";process.stderr.write(`Reason background identity: legacy_identity_retire_failed (${f})
|
|
5
|
-
`)}}function Se(e,t,n,r){let i=D(e);if(!i)return;let o=O(t),f=I(o),c=(s)=>u(s,"Contents","MacOS",v),l=se(I(c(o)),i),y=`${process.pid}.${L()}`,_=Q(o);if(_===null)return;let S=_==="bundle";if(S)n(R,["-u",o]);let p=u(f,`.Ara.app.${y}.old`);if(!W.has(o)&&!me(r())){if(!S)n(R,["-u",o]);try{E(o,p)}catch(s){if(s.code==="ENOENT")return;throw s}g(p,{recursive:!0,force:!0}),Ie(f);return}if(!S){if(re(c(o))===l)return;let s=`${c(o)}.${y}`;M(l,s);try{E(s,c(o))}finally{g(s,{force:!0})}return}let m=u(f,`.Ara.app.${y}.shim`);Y(I(c(m)),{recursive:!0}),M(l,c(m));try{try{E(o,p)}catch(s){if(s.code==="ENOENT")return;throw s}try{E(m,o)}catch(s){if(x(o))return;throw E(p,o),s}}finally{g(m,{recursive:!0,force:!0}),g(p,{recursive:!0,force:!0})}}function Ie(e){try{if(ne(e).some((n)=>n!==".DS_Store"))return;g(u(e,".DS_Store"),{force:!0}),ie(e)}catch{}}var B=new Map;function
|
|
6
|
-
`?[i,"--spawn"]:[]}var P=new Map;function
|
|
7
|
-
`,P.set(n,r)}return r?t:[]}function
|
|
5
|
+
`)}}function Se(e,t,n,r){let i=D(e);if(!i)return;let o=O(t),f=I(o),c=(s)=>u(s,"Contents","MacOS",v),l=se(I(c(o)),i),y=`${process.pid}.${L()}`,_=Q(o);if(_===null)return;let S=_==="bundle";if(S)n(R,["-u",o]);let p=u(f,`.Ara.app.${y}.old`);if(!W.has(o)&&!me(r())){if(!S)n(R,["-u",o]);try{E(o,p)}catch(s){if(s.code==="ENOENT")return;throw s}g(p,{recursive:!0,force:!0}),Ie(f);return}if(!S){if(re(c(o))===l)return;let s=`${c(o)}.${y}`;M(l,s);try{E(s,c(o))}finally{g(s,{force:!0})}return}let m=u(f,`.Ara.app.${y}.shim`);Y(I(c(m)),{recursive:!0}),M(l,c(m));try{try{E(o,p)}catch(s){if(s.code==="ENOENT")return;throw s}try{E(m,o)}catch(s){if(x(o))return;throw E(p,o),s}}finally{g(m,{recursive:!0,force:!0}),g(p,{recursive:!0,force:!0})}}function Ie(e){try{if(ne(e).some((n)=>n!==".DS_Store"))return;g(u(e,".DS_Store"),{force:!0}),ie(e)}catch{}}var B=new Map;function Xn(e=a()){let t=B.get(e);if(t)return t;if(process.platform!=="darwin")return[];let n=U(e);if(n===null&&x(I(le(e))))Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,100),n=U(e);if(n===null)return[];return B.set(e,n),n}function U(e){let t=le(e),n=O(e);if(!d(t)||!C(t))try{he({home:e,skipWhenSettled:!0})}catch{}let r=d(t)&&(C(t)||!d(n))?t:d(n)?n:null,i=r?D(r):null;if(!i)return null;if(r===n)W.add(n);let o=b(i,["--can-spawn"],{env:{},timeout:2000,encoding:"utf8"});return o.status===0&&o.stdout===`spawn
|
|
6
|
+
`?[i,"--spawn"]:[]}var P=new Map;function ft(e=a()){let t=Xn(e),n=t[0];if(!n)return[];let r=P.get(n);if(r===void 0){let i=b(n,["--can-spawn-computer-use"],{env:{},timeout:2000,encoding:"utf8"});r=i.status===0&&i.stdout===`spawn
|
|
7
|
+
`,P.set(n,r)}return r?t:[]}function Po(e=ft(),t=a()){if(e.length>0)return null;if(Gr(t)===null)return"computer_use_identity_missing";return pe(mt,t)?"computer_use_identity_outdated":"computer_use_identity_unavailable"}function he(e={}){H(e.home);let t=le(e.home);if(e.skipWhenSettled&&d(t)&&C(t)&&Q(O(e.home))===null)return!0;if(!d(t)){let n=O(e.home);if(!d(n))return!1;try{return _e({...e,sourceApp:n}),!0}catch(r){if(!d(t))throw r}}return z(t,e),!0}var Yt="REASON_WORKER_IDENTITY_APP";function To(e,t=process.env,n=a()){let r=t[Yt];return r&&r===le(n)?r:e}function Ro(e,t){if(process.platform!=="darwin")return null;let n=le(e),r=u(n,"Contents","MacOS",G),i=b(r,["--can-run-worker",t],{env:{},timeout:2000,encoding:"utf8"});return i.status===0&&i.stdout===`run-worker
|
|
8
8
|
`?{app:n,executable:r}:null}
|
|
9
|
-
export{
|
|
9
|
+
export{Zn,Vr,Ao,le,Gr,Xn,ft,Po,Yt,To,Ro};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var ue=".reason/workspace",Ce="workspace_base",Z="sessions",Ae="workspace_layout",de=".reason/workspace/sessions",
|
|
3
|
-
export{ue,Ce,Z,Ae,de,
|
|
2
|
+
var ue=".reason/workspace",Ce="workspace_base",Z="sessions",Ae="workspace_layout",de=".reason/workspace/sessions",rr=/^[0-9a-f]{8}$/;function Qe(t){if(!X(t))return!1;let e=".reason/workspace/sessions/";if(!t.startsWith(e))return!1;let n=t.slice(e.length).split("/");return n.length===2&&rr.test(n[0])}var i=4096,S="workspaces/pi";function X(t){if(typeof t!=="string"||!t||t.length>i)return!1;if(t.startsWith("/")||t.includes("\x00")||t.includes("\\"))return!1;return t.split("/").every((e)=>e!==""&&e!=="."&&e!=="..")}function O(t){if(t.kind==="root"){if(t.path===void 0)return".";if(!X(t.path))throw Error("invalid_device_workspace_identity");return t.path}if(!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$/.test(t.workspaceId)||t.workspaceId==="."||t.workspaceId==="..")throw Error("invalid_device_workspace_identity");let e=t.layout==="sessions"?"sessions":S;return`${t.base?`${t.base}/`:""}${e}/${t.workspaceId}/repo`}function H(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t;if(e.kind==="root"&&Object.keys(e).length===1)return{kind:"root"};if(e.kind==="root"&&Object.keys(e).length===2&&X(e.path))return{kind:"root",path:e.path};if(e.kind!=="managed"||typeof e.workspaceId!=="string"||Object.keys(e).length!==2+(e.base===void 0?0:1)+(e.layout===void 0?0:1)||e.base!==void 0&&e.base!==".reason/workspace"||e.layout!==void 0&&e.layout!=="sessions")return null;let n={kind:"managed",workspaceId:e.workspaceId,...e.base===".reason/workspace"?{base:".reason/workspace"}:{},...e.layout==="sessions"?{layout:"sessions"}:{}};try{return O(n),n}catch{return null}}var c="/home/runner";var Yr="/run/reason/sessions",a=/^(?:\/[A-Za-z0-9._-]+)+$/,Qr=/-sidechat-([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/,en=/^(.+)-repository-[a-z0-9][a-z0-9._-]*-[0-9a-f]{12}$/;function _(t){return Qr.exec(t)?.[1]??en.exec(t)?.[1]??t}var nr=/^((?:\/[A-Za-z0-9._-]+)+)\/\.reason\/workspace\/(workspaces\/pi|sessions)\/([^/]+)$/;function E(t,e=c,n="sessions"){if(!a.test(e)||e.split("/").some((s)=>s==="."||s===".."))throw Error("invalid_cloud_payload_home");let r=`${e}/${O({kind:"managed",workspaceId:t,base:".reason/workspace",...n?{layout:n}:{}})}`,o=`${Yr}/${_(t)}`;return{home:e,root:r.slice(0,-5),checkout:r,control:o,jobEnv:`${o}/job.env`,cloudAccess:`${o}/cloud-access`,logs:`${o}/logs`,pin:`${o}/ws`}}function A(t){return nr.exec(t.replace(/\/+$/,""))?.[2]==="sessions"?"sessions":null}function tn(t){let e=nr.exec(t.replace(/\/+$/,""));if(!e)return null;try{let n=E(e[3],e[1],A(t));return n.root===t.replace(/\/+$/,"")?n:null}catch{return null}}
|
|
3
|
+
export{ue,Ce,Z,Ae,de,rr,Qe,X,O,H,Yr,Qr,en,nr,tn};
|