@reason-machines/cli-linux-x64 0.2.523 → 0.2.525

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.
Files changed (38) hide show
  1. package/bin/reason +1 -1
  2. package/bin/vm-hands/{api-jec93cnj.js → api-468skzhq.js} +1 -1
  3. package/bin/vm-hands/{api-credentials-e57krknv.js → api-credentials-9f82kd61.js} +1 -1
  4. package/bin/vm-hands/{connect-cli-yzezydnr.js → connect-cli-4t15y12x.js} +1 -1
  5. package/bin/vm-hands/{local-automation-rmedb06z.js → local-automation-wjsbhagn.js} +1 -1
  6. package/bin/vm-hands/{local-capabilities-mvnm7kc8.js → local-capabilities-45tqt3q6.js} +1 -1
  7. package/bin/vm-hands/{local-display-session-e662q50r.js → local-display-session-efjd2gvs.js} +1 -1
  8. package/bin/vm-hands/local-display-video-bdmm490z.js +2 -0
  9. package/bin/vm-hands/{local-managed-process-s90s65vr.js → local-managed-process-z5jpvttg.js} +1 -1
  10. package/bin/vm-hands/{managed-runtime-cc93epas.js → managed-runtime-ze7n8w7x.js} +1 -1
  11. package/bin/vm-hands/{permissions-tjhfq2b6.js → permissions-k1tnx28f.js} +1 -1
  12. package/bin/vm-hands/{serve-service-qhsnbxmy.js → serve-service-3kj6xp04.js} +1 -1
  13. package/bin/vm-hands/{status-h7fq0xa9.js → status-nvm1fe9h.js} +1 -1
  14. package/bin/vm-hands/version-qxsa289q.js +2 -0
  15. package/bin/vm-hands/{vm-hands-entry-lite-nercg1yz.js → vm-hands-entry-lite-0zby1r00.js} +1 -1
  16. package/bin/vm-hands/{vm-hands-entry-lite-xjpb3g9t.js → vm-hands-entry-lite-11dq75hb.js} +1 -1
  17. package/bin/vm-hands/{vm-hands-entry-lite-z35nbedn.js → vm-hands-entry-lite-413em054.js} +1 -1
  18. package/bin/vm-hands/{vm-hands-entry-lite-0bp8kbe3.js → vm-hands-entry-lite-5qanp33p.js} +1 -1
  19. package/bin/vm-hands/{vm-hands-entry-lite-06mdg33e.js → vm-hands-entry-lite-60t7x9vw.js} +1 -1
  20. package/bin/vm-hands/{vm-hands-entry-lite-mxyry9da.js → vm-hands-entry-lite-89ahrw19.js} +1 -1
  21. package/bin/vm-hands/{vm-hands-entry-lite-j1qppwnx.js → vm-hands-entry-lite-9knf91et.js} +1 -1
  22. package/bin/vm-hands/vm-hands-entry-lite-9y3dvyfj.js +2 -0
  23. package/bin/vm-hands/{vm-hands-entry-lite-wc730qz7.js → vm-hands-entry-lite-dhb4fwrv.js} +1 -1
  24. package/bin/vm-hands/{vm-hands-entry-lite-z4jrseer.js → vm-hands-entry-lite-h0s6n13f.js} +1 -1
  25. package/bin/vm-hands/{vm-hands-entry-lite-baxqey3h.js → vm-hands-entry-lite-nj4kjex8.js} +1 -1
  26. package/bin/vm-hands/{vm-hands-entry-lite-nb0n1vy1.js → vm-hands-entry-lite-r31yba20.js} +1 -1
  27. package/bin/vm-hands/{vm-hands-entry-lite-h33trj58.js → vm-hands-entry-lite-scvg31ds.js} +1 -1
  28. package/bin/vm-hands/{vm-hands-entry-lite-zrs8h4rf.js → vm-hands-entry-lite-vf02kfyy.js} +1 -1
  29. package/bin/vm-hands/{vm-hands-entry-lite-3a8ra8ah.js → vm-hands-entry-lite-x1vm200a.js} +1 -1
  30. package/bin/vm-hands/{vm-hands-entry-lite-06mges91.js → vm-hands-entry-lite-x5048q8d.js} +1 -1
  31. package/bin/vm-hands/vm-hands-entry-lite.js +1 -1
  32. package/bin/vm-hands/{vm-hands-executor-5n4k8t53.js → vm-hands-executor-ftg1qx7c.js} +1 -1
  33. package/bin/vm-hands/{vm-hands-op-runner-mzyesbyf.js → vm-hands-op-runner-agy05x0c.js} +1 -1
  34. package/bin/vm-hands/{vm-hands-runtime-zhsw99cm.js → vm-hands-runtime-kbdb0rj5.js} +3 -3
  35. package/package.json +1 -1
  36. package/bin/vm-hands/local-display-video-0pb76z1k.js +0 -2
  37. package/bin/vm-hands/version-whw9wgya.js +0 -2
  38. package/bin/vm-hands/vm-hands-entry-lite-ghva8qrf.js +0 -2
package/bin/reason CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/reason
3
3
  size: 90453472 bytes
4
- sha256: feb01dd15100b51b9ff2b466fb2e081d6bd0b22b5419ed5cb7a2a6cb25dc94e3
4
+ sha256: 1c67950c58d093a7cd8f89ddf8ae4e44e08dff5653e20c019708aeb87f0fff29
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{I,Ps,rs}from"./vm-hands-entry-lite-j1qppwnx.js";import"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-ghva8qrf.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{I as ApiError,rs as ReasonApi,Ps as createMachineEnrollmentTicketWithToken};
2
+ import{I,Ps,rs}from"./vm-hands-entry-lite-9knf91et.js";import"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-9y3dvyfj.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{I as ApiError,rs as ReasonApi,Ps as createMachineEnrollmentTicketWithToken};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Hi,es,ts,As}from"./vm-hands-entry-lite-0bp8kbe3.js";import"./vm-hands-entry-lite-j1qppwnx.js";import"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-ghva8qrf.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Hi as apiOriginFromEnvironment,ts as environmentApiKey,es as explicitApiOrigin,As as resolveApiCredentials};
2
+ import{Hi,es,ts,As}from"./vm-hands-entry-lite-5qanp33p.js";import"./vm-hands-entry-lite-9knf91et.js";import"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-9y3dvyfj.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Hi as apiOriginFromEnvironment,ts as environmentApiKey,es as explicitApiOrigin,As as resolveApiCredentials};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{it,Ss,Es,xs}from"./vm-hands-entry-lite-06mges91.js";import"./vm-hands-entry-lite-f8ts9y2q.js";import"./vm-hands-entry-lite-0tavq3p4.js";import"./vm-hands-entry-lite-0bp8kbe3.js";import"./vm-hands-entry-lite-j1qppwnx.js";import"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-3a8ra8ah.js";import"./vm-hands-entry-lite-baxqey3h.js";import"./vm-hands-entry-lite-wfc0agnt.js";import"./vm-hands-entry-lite-wc730qz7.js";import"./vm-hands-entry-lite-nercg1yz.js";import"./vm-hands-entry-lite-a6w60nv9.js";import"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-kwmjn9y3.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-xjpb3g9t.js";import"./vm-hands-entry-lite-z35nbedn.js";import"./vm-hands-entry-lite-06mdg33e.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-mxyry9da.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-h33trj58.js";import"./vm-hands-entry-lite-zrs8h4rf.js";import"./vm-hands-entry-lite-ghva8qrf.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Ss as computerDisconnected,it as connectionDirectory,Es as connectionReport,xs as restartConnection};
2
+ import{it,Ss,Es,xs}from"./vm-hands-entry-lite-x5048q8d.js";import"./vm-hands-entry-lite-f8ts9y2q.js";import"./vm-hands-entry-lite-0tavq3p4.js";import"./vm-hands-entry-lite-5qanp33p.js";import"./vm-hands-entry-lite-9knf91et.js";import"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-x1vm200a.js";import"./vm-hands-entry-lite-nj4kjex8.js";import"./vm-hands-entry-lite-wfc0agnt.js";import"./vm-hands-entry-lite-dhb4fwrv.js";import"./vm-hands-entry-lite-0zby1r00.js";import"./vm-hands-entry-lite-a6w60nv9.js";import"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-kwmjn9y3.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-11dq75hb.js";import"./vm-hands-entry-lite-413em054.js";import"./vm-hands-entry-lite-60t7x9vw.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-89ahrw19.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-scvg31ds.js";import"./vm-hands-entry-lite-vf02kfyy.js";import"./vm-hands-entry-lite-9y3dvyfj.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Ss as computerDisconnected,it as connectionDirectory,Es as connectionReport,xs as restartConnection};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Pn,Hs,zs,qs,Ws,Rn}from"./vm-hands-entry-lite-xjpb3g9t.js";import"./vm-hands-entry-lite-z35nbedn.js";import"./vm-hands-entry-lite-06mdg33e.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-mxyry9da.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-h33trj58.js";import"./vm-hands-entry-lite-zrs8h4rf.js";import"./vm-hands-entry-lite-ghva8qrf.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{zs as ensureLocalBrowser,Pn as localAutomationAvailable,qs as localBrowserProfile,Hs as localUserChromeHost,Ws as runAutomationCallLocally,Rn as runLocalAutomation};
2
+ import{Pn,Hs,zs,qs,Ws,Rn}from"./vm-hands-entry-lite-11dq75hb.js";import"./vm-hands-entry-lite-413em054.js";import"./vm-hands-entry-lite-60t7x9vw.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-89ahrw19.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-scvg31ds.js";import"./vm-hands-entry-lite-vf02kfyy.js";import"./vm-hands-entry-lite-9y3dvyfj.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{zs as ensureLocalBrowser,Pn as localAutomationAvailable,qs as localBrowserProfile,Hs as localUserChromeHost,Ws as runAutomationCallLocally,Rn as runLocalAutomation};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ns,Wi,mn,is,os,ss,as,Ms,$s,Bs,Fs}from"./vm-hands-entry-lite-baxqey3h.js";import"./vm-hands-entry-lite-wfc0agnt.js";import"./vm-hands-entry-lite-wc730qz7.js";import"./vm-hands-entry-lite-nercg1yz.js";import"./vm-hands-entry-lite-a6w60nv9.js";import"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-kwmjn9y3.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-xjpb3g9t.js";import"./vm-hands-entry-lite-z35nbedn.js";import"./vm-hands-entry-lite-06mdg33e.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-mxyry9da.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-h33trj58.js";import"./vm-hands-entry-lite-zrs8h4rf.js";import"./vm-hands-entry-lite-ghva8qrf.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{r as LocalCapabilityError,ns as SHORT_REQUEST_CAPABILITIES,Ms as capabilityInventoryForRoots,Wi as confinedExecutionShell,is as defaultLocalCommandRunner,$s as deliverLocalHandsEnvironment,as as enrolledRootPaths,Fs as executeLocalOperation,Bs as rebindLocalHandsControl,os as runFileCapability,ss as runTransferCapability,mn as spawnCaptured};
2
+ import{ns,Wi,mn,is,os,ss,as,Ms,$s,Bs,Fs}from"./vm-hands-entry-lite-nj4kjex8.js";import"./vm-hands-entry-lite-wfc0agnt.js";import"./vm-hands-entry-lite-dhb4fwrv.js";import"./vm-hands-entry-lite-0zby1r00.js";import"./vm-hands-entry-lite-a6w60nv9.js";import"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-kwmjn9y3.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-11dq75hb.js";import"./vm-hands-entry-lite-413em054.js";import"./vm-hands-entry-lite-60t7x9vw.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-89ahrw19.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-scvg31ds.js";import"./vm-hands-entry-lite-vf02kfyy.js";import"./vm-hands-entry-lite-9y3dvyfj.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{r as LocalCapabilityError,ns as SHORT_REQUEST_CAPABILITIES,Ms as capabilityInventoryForRoots,Wi as confinedExecutionShell,is as defaultLocalCommandRunner,$s as deliverLocalHandsEnvironment,as as enrolledRootPaths,Fs as executeLocalOperation,Bs as rebindLocalHandsControl,os as runFileCapability,ss as runTransferCapability,mn as spawnCaptured};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ft,Vs,G,qe,jt}from"./vm-hands-entry-lite-z35nbedn.js";import"./vm-hands-entry-lite-06mdg33e.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-mxyry9da.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-zrs8h4rf.js";import"./vm-hands-entry-lite-ghva8qrf.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{qe as ensureLinuxDesktop,Ft as localDisplayAvailable,Vs as localDisplayReady,G as privateDirectory,jt as runLocalDisplayStream};
2
+ import{Ft,Vs,G,qe,jt}from"./vm-hands-entry-lite-413em054.js";import"./vm-hands-entry-lite-60t7x9vw.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-89ahrw19.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-vf02kfyy.js";import"./vm-hands-entry-lite-9y3dvyfj.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{qe as ensureLinuxDesktop,Ft as localDisplayAvailable,Vs as localDisplayReady,G as privateDirectory,jt as runLocalDisplayStream};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{On,In,Dn,Nn,Rr}from"./vm-hands-entry-lite-60t7x9vw.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-89ahrw19.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-vf02kfyy.js";import"./vm-hands-entry-lite-9y3dvyfj.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{On as MAC_SCREEN,In as WINDOWS_SCREEN,Dn as createDisplayVideoLane,Rr as localDisplayVideoAvailable,Nn as simulatorVideoFfmpeg};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{st,fr,js,Us}from"./vm-hands-entry-lite-wc730qz7.js";import"./vm-hands-entry-lite-nercg1yz.js";import"./vm-hands-entry-lite-a6w60nv9.js";import"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-kwmjn9y3.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{st as ManagedProcessStoppedError,js as controlManagedDeviceProcess,Us as retireManagedDeviceProcess,fr as runManagedDeviceProcess};
2
+ import{st,fr,js,Us}from"./vm-hands-entry-lite-dhb4fwrv.js";import"./vm-hands-entry-lite-0zby1r00.js";import"./vm-hands-entry-lite-a6w60nv9.js";import"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-kwmjn9y3.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-hc11hecd.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{st as ManagedProcessStoppedError,js as controlManagedDeviceProcess,Us as retireManagedDeviceProcess,fr as runManagedDeviceProcess};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Rs,Ts,Os,Is,Ds,Ns,Ls}from"./vm-hands-entry-lite-3a8ra8ah.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-zrs8h4rf.js";import"./vm-hands-entry-lite-ghva8qrf.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Ds as acquireManagedRuntimeDirectoryLock,Os as currentManagedRuntimeVersion,Ls as flushManagedRuntimeLifecycleEvents,Is as isManagedRuntimeVersionExecutable,Ts as legacyManagedRuntimePaths,Rs as managedRuntimePaths,Ns as recordManagedRuntimeLifecycle};
2
+ import{Rs,Ts,Os,Is,Ds,Ns,Ls}from"./vm-hands-entry-lite-x1vm200a.js";import"./vm-hands-entry-lite-c4959xva.js";import"./vm-hands-entry-lite-vf02kfyy.js";import"./vm-hands-entry-lite-9y3dvyfj.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Ds as acquireManagedRuntimeDirectoryLock,Os as currentManagedRuntimeVersion,Ls as flushManagedRuntimeLifecycleEvents,Is as isManagedRuntimeVersionExecutable,Ts as legacyManagedRuntimePaths,Rs as managedRuntimePaths,Ns as recordManagedRuntimeLifecycle};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ls,us,Ks,Js}from"./vm-hands-entry-lite-mxyry9da.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-zrs8h4rf.js";import"./vm-hands-entry-lite-ghva8qrf.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{Js as allowMacPermissions,Ks as permissionsSummary,us as readMacPermissions,ls as reasonIdentity};
2
+ import{ls,us,Ks,Js}from"./vm-hands-entry-lite-89ahrw19.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-vf02kfyy.js";import"./vm-hands-entry-lite-9y3dvyfj.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";export{Js as allowMacPermissions,Ks as permissionsSummary,us as readMacPermissions,ls as reasonIdentity};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Wr,xe,J,Jn,Zs,Do,Xs,Ye,ps,Zn,Ys,Qs,Vr,ea,ta}from"./vm-hands-entry-lite-h33trj58.js";import"./vm-hands-entry-lite-zrs8h4rf.js";import"./vm-hands-entry-lite-ghva8qrf.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Wr as WORKER_SERVICE_ENV,J as WorkerServiceError,Do as connectServiceLabel,xe as defaultWorkerServiceHost,Qs as installWorkerService,Ye as installedWorkerService,Xs as isConnectServiceLabel,ta as removeWorkerService,Vr as restartWorkerService,ea as retargetWorkerServiceLogs,ps as retireLegacyWorkerService,Ys as workerServiceDefinitionCurrent,Jn as workerServiceLauncher,Zn as workerServiceProcessRunning,Zs as workerServiceRetargetPending};
2
+ import{Wr,xe,J,Jn,Zs,Do,Xs,Ye,ps,Zn,Ys,Qs,Vr,ea,ta}from"./vm-hands-entry-lite-scvg31ds.js";import"./vm-hands-entry-lite-vf02kfyy.js";import"./vm-hands-entry-lite-9y3dvyfj.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-a3p6xz53.js";import"./vm-hands-entry-lite-haws181e.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-1kt82jes.js";import"./vm-hands-entry-lite-s85p7tqp.js";export{Wr as WORKER_SERVICE_ENV,J as WorkerServiceError,Do as connectServiceLabel,xe as defaultWorkerServiceHost,Qs as installWorkerService,Ye as installedWorkerService,Xs as isConnectServiceLabel,ta as removeWorkerService,Vr as restartWorkerService,ea as retargetWorkerServiceLogs,ps as retireLegacyWorkerService,Ys as workerServiceDefinitionCurrent,Jn as workerServiceLauncher,Zn as workerServiceProcessRunning,Zs as workerServiceRetargetPending};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./vm-hands-entry-lite-j1qppwnx.js";import"./vm-hands-entry-lite-a3p6xz53.js";import{_}from"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-s85p7tqp.js";import"./vm-hands-entry-lite-ghva8qrf.js";import"./vm-hands-entry-lite-0bp8kbe3.js";import{Kt,ht}from"./vm-hands-entry-lite-hc11hecd.js";import{w,M,pr,Be,it}from"./vm-hands-entry-lite-06mges91.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-baxqey3h.js";import"./vm-hands-entry-lite-nercg1yz.js";import"./vm-hands-entry-lite-a6w60nv9.js";import"./vm-hands-entry-lite-wfc0agnt.js";import"./vm-hands-entry-lite-f8ts9y2q.js";import"./vm-hands-entry-lite-06mdg33e.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-zrs8h4rf.js";import"./vm-hands-entry-lite-mxyry9da.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-3a8ra8ah.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-h33trj58.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-wc730qz7.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-z35nbedn.js";import"./vm-hands-entry-lite-xjpb3g9t.js";import"./vm-hands-entry-lite-0tavq3p4.js";import"./vm-hands-entry-lite-kwmjn9y3.js";import"./vm-hands-entry-lite-c4959xva.js";import{a}from"./vm-hands-entry-lite-haws181e.js";import{t,o,u,i,s,n}from"./vm-hands-entry-lite-4cdn822w.js";import"./vm-hands-entry-lite-1kt82jes.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}
2
+ import"./vm-hands-entry-lite-9knf91et.js";import"./vm-hands-entry-lite-a3p6xz53.js";import{_}from"./vm-hands-entry-lite-t82dzcxb.js";import"./vm-hands-entry-lite-39qv4sqt.js";import"./vm-hands-entry-lite-krnvgf71.js";import"./vm-hands-entry-lite-s85p7tqp.js";import"./vm-hands-entry-lite-9y3dvyfj.js";import"./vm-hands-entry-lite-5qanp33p.js";import{Kt,ht}from"./vm-hands-entry-lite-hc11hecd.js";import{w,M,pr,Be,it}from"./vm-hands-entry-lite-x5048q8d.js";import"./vm-hands-entry-lite-88yjxxvf.js";import"./vm-hands-entry-lite-mfvtp7py.js";import"./vm-hands-entry-lite-nj4kjex8.js";import"./vm-hands-entry-lite-0zby1r00.js";import"./vm-hands-entry-lite-a6w60nv9.js";import"./vm-hands-entry-lite-wfc0agnt.js";import"./vm-hands-entry-lite-f8ts9y2q.js";import"./vm-hands-entry-lite-60t7x9vw.js";import"./vm-hands-entry-lite-sfmeafdm.js";import"./vm-hands-entry-lite-vf02kfyy.js";import"./vm-hands-entry-lite-89ahrw19.js";import"./vm-hands-entry-lite-bvqwsd3b.js";import"./vm-hands-entry-lite-x1vm200a.js";import"./vm-hands-entry-lite-n3274tws.js";import"./vm-hands-entry-lite-scvg31ds.js";import"./vm-hands-entry-lite-c0t5xpzh.js";import"./vm-hands-entry-lite-tash5m18.js";import"./vm-hands-entry-lite-td73npv3.js";import"./vm-hands-entry-lite-dhb4fwrv.js";import"./vm-hands-entry-lite-9x81cr3a.js";import"./vm-hands-entry-lite-5wsygx6n.js";import"./vm-hands-entry-lite-413em054.js";import"./vm-hands-entry-lite-11dq75hb.js";import"./vm-hands-entry-lite-0tavq3p4.js";import"./vm-hands-entry-lite-kwmjn9y3.js";import"./vm-hands-entry-lite-c4959xva.js";import{a}from"./vm-hands-entry-lite-haws181e.js";import{t,o,u,i,s,n}from"./vm-hands-entry-lite-4cdn822w.js";import"./vm-hands-entry-lite-1kt82jes.js";import{readFileSync as me,realpathSync as k,renameSync as ge,unlinkSync as fe,writeFileSync as he}from"fs";import{dirname as ye,join as I}from"path";function f(e){return`claude mcp add --transport http reason ${e}`}function h(e){return`codex mcp add reason --url ${e}
3
3
  codex mcp login reason`}var F=f("https://mcp.reasonmachines.com/mcp"),z=h("https://mcp.reasonmachines.com/mcp"),B=`https://claude.ai/settings/connectors?add=custom&url=${encodeURIComponent("https://mcp.reasonmachines.com/mcp")}`,H=`https://cursor.com/install-mcp?name=reason&config=${encodeURIComponent(btoa(JSON.stringify({url:"https://mcp.reasonmachines.com/mcp"})))}`;var b="https://github.com/reason-machines/reason-plugins",X=`Connect a coding agent to Reason over MCP
4
4
 
5
5
  Usage:
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Qe,Qn}from"./vm-hands-entry-lite-9y3dvyfj.js";export{Qn as CLI_USER_AGENT,Qe as CLI_VERSION};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Jt,j}from"./vm-hands-entry-lite-hc11hecd.js";import{ue,Ce,Z,Ae,de,ir,et,X,O,H,rn}from"./vm-hands-entry-lite-39qv4sqt.js";import{Uo,ri}from"./vm-hands-entry-lite-t82dzcxb.js";import{To,P,Je,Se,Ze,ne,Xe,Vn,Ee,Qt,ae,U,N,ce,zr,qr,Kn}from"./vm-hands-entry-lite-c0t5xpzh.js";import{Pe,oe,pe,Y,Te,q,Q}from"./vm-hands-entry-lite-88yjxxvf.js";import{Lt,Pr,lt,V,D,T,b,Cn}from"./vm-hands-entry-lite-tash5m18.js";import{Cr,Ar,xn,lo,He,kn}from"./vm-hands-entry-lite-a6w60nv9.js";import{K}from"./vm-hands-entry-lite-bvqwsd3b.js";import{ji}from"./vm-hands-entry-lite-9x81cr3a.js";import{p,ze,Mt,ut,uo,_e,we}from"./vm-hands-entry-lite-kwmjn9y3.js";import{v,h,fo}from"./vm-hands-entry-lite-c4959xva.js";import{E}from"./vm-hands-entry-lite-70hq7mrs.js";import{tr}from"./vm-hands-entry-lite-z4jrseer.js";import{a,Ho,zo,ie,Wo}from"./vm-hands-entry-lite-haws181e.js";import{L,Mi,$i,Zo,y,t,k,At,o,d,u,i,c,g,ee,s,n}from"./vm-hands-entry-lite-4cdn822w.js";import{Fi}from"./vm-hands-entry-lite-pzj5s203.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{Yo,se,Qo,C,De,Me,A}from"./vm-hands-entry-lite-1kt82jes.js";var Si=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function l(w){return e[w]??null}let f={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(w)=>{switch(w.code){case"invalid_type":{let S=_[w.expected]??w.expected,x=Zo(w.input),W=_[x]??x;return`Invalid input: expected ${S}, received ${W}`}case"invalid_value":if(w.values.length===1)return`Invalid input: expected ${$i(w.values[0])}`;return`Invalid option: expected one of ${Mi(w.values,"|")}`;case"too_big":{let S=w.inclusive?"<=":"<",x=l(w.origin);if(x)return`Too big: expected ${w.origin??"value"} to have ${S}${w.maximum.toString()} ${x.unit??"elements"}`;return`Too big: expected ${w.origin??"value"} to be ${S}${w.maximum.toString()}`}case"too_small":{let S=w.inclusive?">=":">",x=l(w.origin);if(x)return`Too small: expected ${w.origin} to have ${S}${w.minimum.toString()} ${x.unit}`;return`Too small: expected ${w.origin} to be ${S}${w.minimum.toString()}`}case"invalid_format":{let S=w;if(S.format==="starts_with")return`Invalid string: must start with "${S.prefix}"`;if(S.format==="ends_with")return`Invalid string: must end with "${S.suffix}"`;if(S.format==="includes")return`Invalid string: must include "${S.includes}"`;if(S.format==="regex")return`Invalid string: must match pattern ${S.pattern}`;return`Invalid ${f[S.format]??w.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${w.divisor}`;case"unrecognized_keys":return`Unrecognized key${w.keys.length>1?"s":""}: ${Mi(w.keys,", ")}`;case"invalid_key":return`Invalid key in ${w.origin}`;case"invalid_union":if(w.options&&Array.isArray(w.options)&&w.options.length>0)return`Invalid discriminator value. Expected ${w.options.map((x)=>`'${x}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${w.origin}`;default:return"Invalid input"}}};function gn(){return{localeError:Si()}}L(gn());class _t extends Error{}function Co(e){let l;try{l=new URL(e)}catch{throw new _t("The proxy must be a URL like https://proxy.example.com:3128.")}if(l.protocol!=="https:"&&l.protocol!=="http:")throw new _t("The proxy URL must use the https or http scheme.");if(!l.hostname)throw new _t("The proxy URL must name a host.");if(l.port!==""&&Number(l.port)<1)throw new _t("The proxy URL must use a port between 1 and 65535.");if(l.pathname!==""&&l.pathname!=="/"||l.search||l.hash)throw new _t("The proxy URL must not carry a path, query, or fragment.");return l.toString()}import{createHash as Ei}from"crypto";import{isAbsolute as Lo,join as Bo,relative as jo,resolve as qt,sep as Mo}from"path";var Vt=t().min(1).refine(Lo,"absolute path required"),No=c({version:n(1),apiOrigin:At(),channel:s(["staging","production"]),stateDirectory:Vt,workspaceRoot:Vt,lifetime:s(["persistent","ephemeral"]),executionMode:s(["confined","host"]).default("confined"),name:t().min(1).max(160).default("Reason headless worker"),slots:o().int().min(1).max(4).default(1),shutdownGraceMs:o().int().min(0).max(300000).default(30000),proxy:c({version:n(Jt),url:t().refine((e)=>{try{return Co(e)===e}catch{return!1}},"invalid proxy URL"),caFile:Vt.optional()}).optional(),userChrome:d().optional(),cloudSessions:n(!0).optional(),localLogins:d().optional(),folders:u(Vt).min(1).max(31).optional()}),Ri=/^https:\/\/[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.trycloudflare\.com$/,B=g("channel",[No,No.extend({channel:n("local-qa"),apiOrigin:t()})]).superRefine((e,l)=>{if(e.channel==="local-qa"){if(!Ri.test(e.apiOrigin))l.addIssue({code:"custom",message:"local QA worker requires an exact HTTPS trycloudflare.com quick-tunnel origin"})}else{let _=new URL(e.apiOrigin);if(_.origin!==e.apiOrigin||_.username||_.password||_.protocol!=="https:"&&!(_.protocol==="http:"&&ri(_.origin))||!ri(_.origin)&&!Uo(e.channel,_.origin))l.addIssue({code:"custom",message:"API origin must match channel (or loopback)"})}if(!je(e.workspaceRoot,e.stateDirectory))l.addIssue({code:"custom",message:"state and workspace must be disjoint"});let f=e.folders??[];if(new Set([e.workspaceRoot,...f]).size!==f.length+1||f.some((_)=>!je(_,e.stateDirectory)))l.addIssue({code:"custom",message:"folders must be distinct and disjoint from state"})});function m(e){return Bo(e.stateDirectory,`headless-${e.channel}`)}function je(e,l){if(Fr(l,e))return!1;return!Fr(e,l)||E(Bo(Mo,jo(qt(e),qt(l))))}function Fr(e,l){let f=jo(qt(e),qt(l));return f===""||f!==".."&&!f.startsWith(`..${Mo}`)&&!Lo(f)}function te(e){let{proxy:l,userChrome:f,cloudSessions:_,localLogins:w,folders:S,...x}=e;return Ei("sha256").update(JSON.stringify(x)).digest("hex")}var Oi=4,xi=[2375,2376,9222,9229];function mr(e){let l=new Set(xi);for(let f of e){let _=new URL(f);l.add(Number(_.port||(["https:","wss:"].includes(_.protocol)?443:80)))}return l}function Gr(){throw new r("preview_unavailable","The live Hands preview binding is unavailable or stale.")}var Pi=60000;function Fo(e){let l=new AbortController,f=new Map,_=(R)=>JSON.stringify([R.jobId,R.port]);function w(R){let M=e.authority.owner;if(l.signal.aborted||!e.isCurrent()||e.expiresAtMs<=Date.now()||R.organization_id!==M.organization_id||R.user_id!==M.user_id||R.device_id!==M.device_id)Gr()}function S(R){let M;try{M=e.environment.current()}catch{return null}return M.binding.target_generation===R.generation&&M.binding.target_fence_id===R.fenceId&&M.run_id===e.runId&&M.device_id===e.authority.owner.device_id&&M.root_id===e.authority.rootId?M:null}async function x(R,M,G){let F=await W(R,M,G);if(F!=="moved")return F;let I=await W(R,M,G);return I==="moved"?null:I}async function W(R,M,G){try{w(e.authority.owner);let F=e.identity();if(!F||G.aborted||R.expiresAtMs<=Date.now()||R.expiresAtMs>e.expiresAtMs)return null;let I=M.opened,re=I!==void 0&&F.generation>I.generation,J=S(F);if(re){if(J){if(J.revision<=I.revision||R.expiresAtMs>Date.parse(J.expires_at)||J.binding.target_revision!==I.attachmentRevision||J.binding.root_grant_revision!==I.grantRevision)return null;M.recoveringSinceMs=void 0}else if(Date.now()-(M.recoveringSinceMs??=Date.now())>Pi)return null}else if(!J||R.expiresAtMs>Date.parse(J.expires_at)||I&&(F.generation!==I.generation||F.fenceId!==I.fenceId))return null;let z=await e.inspect(R.jobId,G),fe=e.identity(),ve=fe&&S(fe);w(e.authority.owner);let be=J&&{generation:F.generation,fenceId:F.fenceId,snapshotId:J.snapshot_id,revision:J.revision,attachmentRevision:J.binding.target_revision,grantRevision:J.binding.root_grant_revision},Re=re?I:be;if(G.aborted||!fe)return null;if(fe.generation!==F.generation||fe.fenceId!==F.fenceId||ve?.snapshot_id!==J?.snapshot_id||ve?.revision!==J?.revision)return"moved";let $e=z.ok&&z.job.environmentSnapshotId!==void 0&&z.job.environmentRevision!==void 0?{snapshotId:z.job.environmentSnapshotId,revision:z.job.environmentRevision}:null;if(!z.ok||z.generation!==F.generation||!Re||!$e)return null;if(($e.snapshotId!==Re.snapshotId||$e.revision!==Re.revision)&&(re||!e.environment.carried($e.snapshotId,$e.revision)))return null;if(!I&&F.generation===R.generation&&F.fenceId===R.fenceId)M.opened={...Re,...$e};return{executorLaunchId:e.executorLaunchId,job:z.job,binding:{organizationId:e.authority.owner.organization_id,userId:e.authority.owner.user_id,deviceId:e.authority.owner.device_id,rootId:e.authority.rootId,runId:e.runId,attachmentRevision:Re.attachmentRevision,grantRevision:Re.grantRevision,generation:Re.generation,fenceId:Re.fenceId,jobId:z.job.jobId,port:R.port,expiresAtMs:R.expiresAtMs}}}catch{return null}}return{async open(R,M,G){w(M);let{binding:F,deviceRelayUrl:I}=ut(R);if(G.aborted||F.expiresAtMs<=Date.now()||F.expiresAtMs>Date.now()+p.lifetimeMs||new URL(I).origin!==e.authority.relayOrigin)Gr();let re=_(F),J=f.get(re);if(J){if(!ze(J.binding,F)||J.relay!==I)Gr();if(await J.opened,!await Mt(()=>J.port.check())||G.aborted||J.abort.signal.aborted)Gr();return{opened:!0,binding:F}}if(f.size>=Oi)Gr();let z=new AbortController,fe={},ve=we({binding:F,deniedPorts:e.authority.deniedPorts,readCurrentJob:()=>x(F,fe,z.signal)}),be=()=>z.abort();if(G.addEventListener("abort",be,{once:!0}),l.signal.addEventListener("abort",be,{once:!0}),G.aborted||l.signal.aborted)be();let Re=_e({binding:F,deviceRelayUrl:I,port:ve,signal:z.signal}),$e={binding:F,relay:I,abort:z,port:ve,opened:Re};f.set(re,$e);let qe=()=>{if(G.removeEventListener("abort",be),l.signal.removeEventListener("abort",be),f.get(re)===$e)f.delete(re)};try{if((await Re).closed.then(qe),G.removeEventListener("abort",be),w(M),z.signal.aborted||!await Mt(()=>ve.check()))Gr();return{opened:!0,binding:F}}catch{z.abort(),qe(),Gr()}},async close(R,M){w(M);let{binding:G}=uo(R),F=f.get(_(G));if(!F||!ze(F.binding,G))Gr();return F.abort.abort(),await F.opened.then((I)=>I.closed,()=>{return}),{closed:!0,binding:G}},dispose(){l.abort();for(let R of f.values())R.abort.abort();f.clear()}}}import{WebSocket as Rn}from"ws";var $o=(e)=>("data"in e)?e.data.length:e.bytes,Ko=2*Xe;function ar(e){throw new r(e,"The bound Hands terminal is unavailable or its outcome is unconfirmed.")}var mt=(e)=>!["starting","running"].includes(e.state);function Qi(e,l,f=Date.now()){let _=["relay_url","session_id","expires_at","cols","rows","pty","workspace"];if(Object.keys(e).length!==_.length||Object.keys(e).some((M)=>!_.includes(M))||!ae(l)||!ae(e.session_id)||typeof e.expires_at!=="string"||typeof e.relay_url!=="string"||e.relay_url.length>4096||![e.cols,e.rows].every((M)=>Number.isSafeInteger(M)&&Number(M)>=1&&Number(M)<=Ee))ar("invalid_pty_request");let w=e.pty;if(!w||typeof w!=="object"||Array.isArray(w))ar("invalid_pty_request");let S=w;if(Object.keys(S).length!==2||S.version!==1||!ce(S.jobId))ar("invalid_pty_request");let x;try{x=new URL(e.relay_url)}catch{return ar("invalid_pty_request")}if(!["ws:","wss:"].includes(x.protocol)||x.username||x.password||x.hash||x.protocol==="ws:"&&!["127.0.0.1","[::1]","localhost"].includes(x.hostname))ar("invalid_pty_request");let W=Date.parse(e.expires_at);if(!Number.isSafeInteger(W)||W<=f)ar("invalid_pty_request");return{workspace:H(e.workspace)??ar("invalid_pty_request"),session:{jobId:S.jobId,sessionId:e.session_id,operationId:l,relayUrl:x.href,cols:Number(e.cols),rows:Number(e.rows),leaseExpiresAtMs:Math.min(W,f+43200000)}}}async function Go(e){let{session:l,binding:f}=e;if(f.assertCurrent(),e.signal.aborted||Date.now()>=l.leaseExpiresAtMs)ar("cancelled");let _=new Rn(l.relayUrl,{followRedirects:!1,perMessageDeflate:!1,maxPayload:ne}),w=new AbortController,S=()=>{},x=()=>{w.abort(),S()};e.signal.addEventListener("abort",x,{once:!0});let W=setTimeout(x,Math.max(1,l.leaseExpiresAtMs-Date.now())),R=[],M=0,G=0,F=0,I=!1,re=!1,J=!1,z,fe,ve,be=(le)=>{ve=new r(le,"Bound terminal input was refused."),x()};_.on("error",()=>be("pty_relay_unavailable")),_.on("close",x),_.on("message",(le,he)=>{if(w.signal.aborted)return;if(!re){be("pty_not_ready");return}let Oe=Array.isArray(le)?Buffer.concat(le):le instanceof ArrayBuffer?Buffer.from(le):le;if(Oe.length===0)return;let Ke=R.at(-1),Le=he&&Ke!==void 0&&"data"in Ke&&Ke.data.length+Oe.length<=ne;if(Oe.length>ne||M+Oe.length>Vn){be("pty_input_backpressure");return}if(Le)Ke.data=Buffer.concat([Ke.data,Oe]);else if(he)R.push({data:Buffer.from(Oe)});else try{let Be=JSON.parse(Oe.toString("utf8"));if(Be&&Be.t==="close"&&Object.keys(Be).length===1){J=!0,x();return}if(!Be||Be.t!=="resize"||Object.keys(Be).length!==3||![Be.cols,Be.rows].every((ke)=>Number.isSafeInteger(ke)&&ke>=1&&ke<=Ee))throw Error("invalid_control");R.push({cols:Be.cols,rows:Be.rows,bytes:Oe.length})}catch{be("invalid_pty_control");return}M+=Oe.length,S()});function Re(le){return Kn(JSON.stringify({...f.scope,version:1,sessionId:l.sessionId,operationId:l.operationId,job:{...le,output:[],pty:le.pty?{...le.pty,output:[]}:void 0}}))}function $e(le){if(!le.ok)ar(le.error);let he=le.job;if(le.generation!==f.scope.generation||he.jobId!==l.jobId||!he.pty||he.leaseExpiresAtMs>l.leaseExpiresAtMs||he.process&&he.process.executorLaunchId!==f.scope.executorLaunchId||he.process&&fe&&(he.process.pid!==fe.pid||he.process.processGroupId!==fe.processGroupId)||he.state!=="starting"&&(he.environmentRevision!==f.environment.revision||he.environmentSnapshotId!==f.environment.snapshotId))ar("pty_binding_changed");if(Re(he),he.process)fe??={...he.process};return he}async function qe(le){f.assertCurrent();let he=await f.request(le,w.signal);if(f.assertCurrent(),w.signal.aborted)ar("cancelled");let Oe=$e(he);if(Oe.inputSequence!==G)ar("job_input_sequence");if(!mt(Oe)&&Oe.leaseExpiresAtMs<=Date.now())ar("pty_binding_changed");return Oe}function ye(le){if(f.assertCurrent(),w.signal.aborted||_.readyState!==Rn.OPEN||_.bufferedAmount+Buffer.byteLength(le)>Ko)ar("pty_output_backpressure");_.send(le)}function Fe(le){if(le.firstCursor>F+1)F=le.firstCursor-1;for(let he of le.pty.output){if(he.cursor<=F)continue;if(he.cursor!==F+1)ar("pty_output_gap");let Oe=Buffer.from(he.dataBase64,"base64");if(_.bufferedAmount+Oe.length>Ko)return!1;ye(Oe),F=he.cursor}if(F!==le.nextCursor)ar("pty_output_gap");return!0}async function Ve(le,he){let Oe;try{await Promise.race([e.emit(le,he),new Promise((Ke,Le)=>{Oe=setTimeout(()=>Le(new r("pty_event_unavailable","Terminal metadata delivery timed out.")),2000)})])}finally{clearTimeout(Oe)}}async function Ie(){let le=AbortSignal.timeout(Qt),he=f.request({jobId:l.jobId,action:"cancel",input:{}},le),Oe,Ke=new Promise((Le,Be)=>{if(Oe=()=>Be(new r("pty_cleanup_unconfirmed","Terminal cleanup acknowledgement was not observed within authority.")),le.addEventListener("abort",Oe,{once:!0}),le.aborted)Oe()});try{let Le=await Promise.race([he,Ke]);if(le.aborted)ar("pty_cleanup_unconfirmed");return $e(Le)}finally{le.removeEventListener("abort",Oe)}}try{await new Promise((Le,Be)=>{let ke=setTimeout(()=>{x(),Be(new r("pty_relay_unavailable","Terminal pairing timed out."))},5000),We=()=>{clearTimeout(ke),Be(new r("cancelled","Terminal pairing was cancelled."))};if(w.signal.addEventListener("abort",We,{once:!0}),_.once("open",()=>{clearTimeout(ke),w.signal.removeEventListener("abort",We),Le()}),w.signal.aborted)We()}),f.assertCurrent(),I=!0,z=await qe({jobId:l.jobId,action:"start",input:{mode:"pty",cols:l.cols,rows:l.rows,leaseExpiresAtMs:l.leaseExpiresAtMs}});let le=Date.now()+5000;while(z.state==="starting"){if(Date.now()>=le)ar("pty_not_ready");await new Promise((Le)=>setTimeout(Le,25)),z=await qe({jobId:l.jobId,action:"inspect",input:{after:F}})}if(z.state!=="running"||z.inputSequence!==0||z.leaseExpiresAtMs<=Date.now())ar("pty_not_ready");await Ve("pty.ready",Re(z)),re=!0,ye(JSON.stringify({t:"open",cols:z.pty.cols,rows:z.pty.rows,receipt:Re(z)}));let he=!1,Oe=0,Ke=!1;while(!w.signal.aborted){let Le=z.firstCursor>F+1,Be=Fe(z);if(mt(z)){if(Be)break}else if(Le)he=!0;else if(he&&Be&&Date.now()>=Oe){he=!1,Oe=Date.now()+1000;let{cols:We,rows:rr}=z.pty;for(let nr of[{cols:We,rows:rr>1?rr-1:2},{cols:We,rows:rr}]){if(mt(z))break;let Rr=++G;if(z=await qe({jobId:l.jobId,action:"resize",input:{sequence:Rr,...nr}}),z.inputSequence!==Rr)ar("job_input_sequence")}continue}let ke=mt(z)||Ke?void 0:R.shift();if(ke){M-=$o(ke);let We=++G;try{z=await qe("data"in ke?{jobId:l.jobId,action:"input",input:{sequence:We,dataBase64:ke.data.toString("base64")}}:{jobId:l.jobId,action:"resize",input:{sequence:We,cols:ke.cols,rows:ke.rows}})}catch(rr){if(!(rr instanceof r)||rr.code!=="job_input_backpressure")throw rr;G-=1,R.unshift(ke),M+=$o(ke),Ke=!0;continue}if(z.inputSequence!==We)ar("job_input_sequence")}else if(await new Promise((We)=>{let rr=setTimeout(We,Ke||!Be?10:50);if(S=()=>{clearTimeout(rr),We()},w.signal.aborted||!Ke&&R.length)S()}),Ke=!1,S=()=>{},!w.signal.aborted&&Be)try{z=await qe({jobId:l.jobId,action:"inspect",input:{after:F}})}catch(We){if(!J||!(We instanceof r)||We.code!=="cancelled")throw We}}}catch(le){ve??=le}finally{if(re=!1,R.length=0,clearTimeout(W),e.signal.removeEventListener("abort",x),x(),I&&(!z||!mt(z)))try{z=await Ie()}catch{z=void 0}try{if(!z||!mt(z)||z.pty?.cleanup!=="confirmed")ar("pty_cleanup_unconfirmed");let le=Re(z);if(_.readyState===Rn.OPEN)await new Promise((he)=>{let Oe=setTimeout(he,500);_.send(JSON.stringify({t:"exit",code:z.exitCode,receipt:le}),()=>{clearTimeout(Oe),he()})});await Ve("pty.stopped",le)}catch(le){ve??=le}_.terminate()}if(ve)throw ve;if(e.signal.aborted)ar("cancelled");if(!z)ar("pty_cleanup_unconfirmed");return{receipt:Re(z)}}import{createHash as Ii,randomUUID as In}from"crypto";import{spawnSync as Xo}from"child_process";import{closeSync as Jo,constants as On,fstatSync as Ai,fsyncSync as Ti,lstatSync as Ht,mkdirSync as Di,mkdtempSync as es,openSync as Vo,readFileSync as Ci,readdirSync as rs,realpathSync as Ct,rmSync as Pn,unlinkSync as Hi}from"fs";import{createConnection as Ni}from"net";import{dirname as Li,join as nt,sep as Bi}from"path";import{tmpdir as Wi}from"os";var hr=new Map,Jr=new Map;function Ur(e,l){return Ii("sha256").update(JSON.stringify([e,l])).digest("hex")}function ht(e){try{Di(e,{mode:448})}catch(f){if(!(f instanceof Error&&("code"in f)&&f.code==="EEXIST"))throw f}let l=Ht(e);if(!l.isDirectory()||l.isSymbolicLink()||!A(l)||Ct(e)!==e)throw new r("hands_jobs_unavailable","Hands job state must be a private canonical directory.")}function Ui(e){let l;try{l=Ht(e)}catch(f){if(f instanceof Error&&"code"in f&&f.code==="ENOENT")return!1;throw f}return!l.isDirectory()||l.isSymbolicLink()||rs(e).length>0}function gr(e){let l=Ur(e.root,e.runId),f=e.previousRuntimeDirectories?.find((x)=>Ui(nt(x,"jobs",l.slice(0,16))))??e.runtimeDirectory;ht(f);let _=nt(f,"jobs");ht(_);let w=nt(_,l.slice(0,16));if(e.maxScopes!==void 0){let x=rs(_);if(!Number.isSafeInteger(e.maxScopes)||e.maxScopes<1||x.length>e.maxScopes||!x.includes(l.slice(0,16))&&x.length>=e.maxScopes)throw new r("process_journal_capacity","Managed process receipt capacity is full; preserve uncertain jobs and reconcile their existing receipts before starting more work.")}ht(w);let S=es(nt(Qo(),"reason-j-"));try{return ht(S),{journalDirectory:w,scopeId:l,launchDirectory:S,socketPath:process.platform==="win32"?`\\\\.\\pipe\\reason-jobs-${In()}`:nt(S,"control.sock"),disposeSocket:()=>Pn(S,{recursive:!0,force:!0})}}catch(x){throw Pn(S,{recursive:!0,force:!0}),x}}var zi=60000,Ki=5000;function Gi(e){if(process.platform==="win32")return Ji(e);let l=Xo("ps",["-o","lstart=","-p",String(e)],{encoding:"utf8",timeout:2000,env:{...process.env,LC_ALL:"C",LANG:"C"}}),f=l.status===0?/^\w{3} (\w{3}) +(\d{1,2}) (\d{2}):(\d{2}):(\d{2}) (\d{4})$/.exec(l.stdout.trim()):null,_=f?"JanFebMarAprMayJunJulAugSepOctNovDec".indexOf(f[1]):-1;if(!f||_<0||_%3!==0)return null;let w=new Date(Number(f[6]),_/3,Number(f[2]),Number(f[3]),Number(f[4]),Number(f[5])).getTime();return Number.isFinite(w)?w:null}function Ji(e){let l=Xo(C("powershell"),["-NoProfile","-NonInteractive","-Command",`(Get-Process -Id ${e}).StartTime.ToUniversalTime().ToString('o')`],{encoding:"utf8",timeout:5000,windowsHide:!0,env:De()}),f=l.status===0?Date.parse(l.stdout.trim()):Number.NaN;return Number.isFinite(f)?f:null}function ts(e,l={}){let f=nt(e.journalDirectory,"owner.lock"),_;try{_=Vo(f,On.O_RDONLY|On.O_NOFOLLOW)}catch{return null}try{let w=Ai(_);if(!w.isFile()||w.nlink!==1||!A(w)||w.size>4096)return null;let S=null;try{S=JSON.parse(Ci(_,"utf8"))}catch{}let x;if(S===null){if((l.now??Date.now)()-w.mtimeMs<zi)return null;x={reason:"never_written",executorLaunchId:null}}else{let{version:M,scopeId:G,pid:F,createdAtMs:I,executorLaunchId:re}=S;if(M!==1||G!==e.scopeId||typeof re!=="string"||typeof F!=="number"||!Number.isSafeInteger(F)||F<1||F===process.pid||typeof I!=="number"||!Number.isSafeInteger(I))return null;if(!(l.exists??((z)=>{try{return process.kill(z,0),!0}catch(fe){return!(fe instanceof Error&&("code"in fe)&&fe.code==="ESRCH")}}))(F))x={reason:"owner_exited",executorLaunchId:re};else{let z=(l.startedAtMs??Gi)(F);if(z===null||z<=I+Ki)return null;x={reason:"pid_reused",executorLaunchId:re}}}let W=Ht(f);if(W.dev!==w.dev||W.ino!==w.ino)return null;Hi(f);let R=Vo(e.journalDirectory,On.O_RDONLY);try{Ti(R)}finally{Jo(R)}return x}catch{return null}finally{Jo(_)}}function ns(e){let l={...e,workspace:e.workspace&&Object.freeze({...e.workspace}),previewAuthority:e.previewAuthority&&Object.freeze({...e.previewAuthority,owner:Object.freeze({...e.previewAuthority.owner}),deniedPorts:new Set(e.previewAuthority.deniedPorts)})},f=Ur(l.root,l.runId);if(hr.has(f)||l.operationId!==void 0&&Jr.has(l.operationId))throw new r("hands_jobs_busy","The Session already has a live Hands job supervisor.");let _={binding:l,key:f,terminals:new Map};if(l.previewAuthority&&l.environment)_.previews=Fo({authority:l.previewAuthority,runId:l.runId,expiresAtMs:l.expiresAtMs,executorLaunchId:l.executorLaunchId,environment:l.environment,isCurrent:()=>hr.get(_.key)===_,identity:()=>{try{return gt(l)}catch{return null}},inspect:(w,S)=>{if(hr.get(_.key)!==_)throw new r("preview_unavailable","The Hands supervisor is no longer current.");return os(l,{jobId:w,action:"inspect",input:{after:0}},S)}});if(hr.set(f,_),l.operationId!==void 0)Jr.set(l.operationId,_);return()=>{if(hr.get(_.key)===_)hr.delete(_.key);if(l.operationId!==void 0&&Jr.get(l.operationId)===_)Jr.delete(l.operationId);_.previews?.dispose();for(let w of _.terminals.values())w.abort()}}var Vi=5000,qi=20;async function eo(e){let l=(w)=>{throw new r("hands_rebind_unavailable",w)};if(!N(e.operationId)||!N(e.runId)||!N(e.fenceId)||!U(e.targetGeneration))l("Reason sent an invalid Hands rebind.");let f=Jr.get(e.operationId);if(!f||f.binding.root!==e.root)return l("No live Hands supervisor owns this operation.");for(let w=Date.now()+Vi;;){if(e.signal?.aborted)l("The Hands rebind was cancelled.");if(Jr.get(e.operationId)!==f)l("The Hands supervisor is no longer current.");let S=null;try{S=gt(f.binding)}catch{}if(S&&S.generation===e.targetGeneration&&S.fenceId===e.fenceId)break;if(S&&S.generation>e.targetGeneration||Date.now()>=w)l("The executor did not adopt this take.");await new Promise((x)=>setTimeout(x,qi))}if(Jr.get(e.operationId)!==f||hr.get(f.key)!==f)l("The Hands supervisor is no longer current.");let _=Ur(e.root,e.runId);if(f.key===_)return;if(hr.has(_))l("The taking run already has a live Hands job supervisor.");hr.delete(f.key);for(let w of f.terminals.values())w.abort();f.key=_,hr.set(_,f)}function at(e){let l="operationId"in e?Jr.get(e.operationId):hr.get(Ur(e.root,e.runId)),f=l&&l.binding.root===e.root?l.binding:void 0;if(!f?.environment||f.expiresAtMs<=Date.now())throw new r("environment_unavailable","No live Hands supervisor owns this environment.");return f.environment.install(e.payload)}async function to(e){let l=hr.get(Ur(e.root,e.runId));if(!l?.previews||!e.owner)throw new r("preview_unavailable","No authenticated Hands supervisor owns this preview.");return l.previews.open(e.payload,e.owner,e.signal)}async function ro(e){let l=hr.get(Ur(e.root,e.runId));if(!l?.previews||!e.owner||e.signal.aborted)throw new r("preview_unavailable","No authenticated Hands supervisor owns this preview.");return l.previews.close(e.payload,e.owner)}async function no(e){let l=Ur(e.root,e.runId),f=hr.get(l),_=f?.binding,w=_?.runId,S=_?.previewAuthority,x=_?.environment,W=e.owner&&{...e.owner},R=e.authority&&{...e.authority},M=()=>{throw new r("pty_binding_unavailable","No current authenticated Hands scope owns this terminal.")};if(!f||!_||!S||!x||!W||!R||!_.workspace)return M();let G=Object.freeze({..._.workspace}),F=gt(_),I=x.current(),re=()=>{if(hr.get(l)!==f||W.organization_id!==S.owner.organization_id||W.user_id!==S.owner.user_id||W.device_id!==S.owner.device_id||e.deviceId!==S.owner.device_id||e.rootId!==S.rootId||O(e.workspace)!==O(G))M();let z=gt(_),fe=x.current();if(z.generation!==F.generation||z.fenceId!==F.fenceId||fe.run_id!==w||fe.device_id!==e.deviceId||fe.root_id!==e.rootId||fe.snapshot_id!==I.snapshot_id||fe.revision!==I.revision||fe.binding.target_generation!==F.generation||fe.binding.target_fence_id!==F.fenceId||R.device_id!==e.deviceId||R.binding!==fe.binding.kind||R.target_revision!==fe.binding.target_revision||R.root_grant_revision!==fe.binding.root_grant_revision||R.target_generation!==F.generation||R.target_fence_id!==F.fenceId)M()};if(re(),new URL(e.session.relayUrl).origin!==S.relayOrigin||f.terminals.has(e.session.jobId)||f.terminals.size>=4)return M();let J=new AbortController;f.terminals.set(e.session.jobId,J);try{return await Go({session:{...e.session,leaseExpiresAtMs:Math.min(e.session.leaseExpiresAtMs,F.expiresAtMs,Date.parse(I.expires_at))},signal:AbortSignal.any([e.signal,J.signal]),emit:e.emit,binding:{assertCurrent:re,environment:{revision:I.revision,snapshotId:I.snapshot_id},scope:{runId:e.runId,deviceId:e.deviceId,rootId:e.rootId,workspace:G,binding:I.binding.kind,targetRevision:I.binding.target_revision,rootGrantRevision:I.binding.root_grant_revision,generation:F.generation,fenceId:F.fenceId,executorLaunchId:F.executorLaunchId},request:(z,fe)=>_r(F,zr(JSON.stringify({...z,type:"job",version:2,generation:F.generation,id:In()})),fe)}})}finally{if(f.terminals.get(e.session.jobId)===J)f.terminals.delete(e.session.jobId)}}async function io(e){if(ce(e.payload.jobId))throw new r("pty_binding_required","PTY jobs require the bound terminal capability.");let l=hr.get(Ur(e.root,e.runId))?.binding;if(!l||l.expiresAtMs<=Date.now())throw new r("hands_jobs_unavailable","No live Hands supervisor owns this Session and root.");return os(l,e.payload,e.signal)}var Yi=1e4,Xi=20,Zi=Se/2,ea=Je/2,ra=(e)=>e.output.reduce((l,f)=>l+f.text.length,0);async function os(e,l,f){if(Object.keys(l).some((M)=>!["jobId","action","input","waitForExitMs"].includes(M)))throw new r("invalid_payload","Unexpected job control field.");let{waitForExitMs:_,...w}=l;if(_!==void 0&&(w.action!=="start"||typeof w.input!=="object"||w.input===null||!("script"in w.input)||typeof _!=="number"||!Number.isSafeInteger(_)||_<1||_>Yi))throw new r("invalid_payload","Only a script start may wait for its job, within its bound.");let S=(M)=>{let G=gt(e);return _r(G,zr(JSON.stringify({...M,type:"job",version:2,generation:G.generation,id:In()})),f)},x=await S(w);if(_===void 0)return x;let W=Date.now()+_,R=x;while(R.ok&&["starting","running"].includes(R.job.state)&&R.job.output.length<Zi&&ra(R.job)<ea&&!f.aborted&&Date.now()<W){if(await new Promise((M)=>setTimeout(M,Math.min(Xi,W-Date.now()))),f.aborted)break;try{let M=await S({jobId:w.jobId,action:"inspect",input:{after:0}});if(!M.ok)break;R=M}catch{break}}return R}function gt(e){if(e.expiresAtMs<=Date.now())throw new r("hands_jobs_unavailable","Hands authority expired.");let l=e.readIdentity?e.readIdentity():e;if(!l||!U(l.generation)||!N(l.fenceId)||l.generation<e.generation||l.generation===e.generation&&l.fenceId!==e.fenceId)throw new r("hands_jobs_unavailable","The live Hands fencing identity could not be verified.");return e.generation=l.generation,e.fenceId=l.fenceId,{...e}}function _r(e,l,f){if(f.aborted)return Promise.reject(new r("cancelled","Job control was cancelled."));return new Promise((_,w)=>{let S=Ni(e.socketPath),x="",W=!1,R,M=(F,I)=>{if(W)return;if(W=!0,clearTimeout(R),f.removeEventListener("abort",G),S.destroy(),F)w(F);else _(I)},G=()=>M(new r("cancelled","Job control waiter cancelled; inspect before retrying mutations."));f.addEventListener("abort",G,{once:!0}),S.setEncoding("utf8"),R=setTimeout(()=>M(new r("hands_job_result_unknown","Job control timed out; inspect before retrying mutations.")),Math.min(1e4,Math.max(1,e.expiresAtMs-Date.now()))),S.on("error",()=>M(new r("hands_job_result_unknown","Hands job control connection failed."))),S.once("connect",()=>S.write(JSON.stringify({version:1,scopeId:e.scopeId,fenceId:e.fenceId,executorLaunchId:e.executorLaunchId,request:l})+`
2
+ import{Jt,j}from"./vm-hands-entry-lite-hc11hecd.js";import{ue,Ce,Z,Ae,de,ir,et,X,O,H,rn}from"./vm-hands-entry-lite-39qv4sqt.js";import{Uo,ri}from"./vm-hands-entry-lite-t82dzcxb.js";import{To,P,Je,Se,Ze,ne,Xe,Vn,Ee,Qt,ae,U,N,ce,zr,qr,Kn}from"./vm-hands-entry-lite-c0t5xpzh.js";import{Pe,oe,pe,Y,Te,q,Q}from"./vm-hands-entry-lite-88yjxxvf.js";import{Lt,Pr,lt,V,D,T,b,Cn}from"./vm-hands-entry-lite-tash5m18.js";import{Cr,Ar,xn,lo,He,kn}from"./vm-hands-entry-lite-a6w60nv9.js";import{K}from"./vm-hands-entry-lite-bvqwsd3b.js";import{ji}from"./vm-hands-entry-lite-9x81cr3a.js";import{p,ze,Mt,ut,uo,_e,we}from"./vm-hands-entry-lite-kwmjn9y3.js";import{v,h,fo}from"./vm-hands-entry-lite-c4959xva.js";import{E}from"./vm-hands-entry-lite-70hq7mrs.js";import{tr}from"./vm-hands-entry-lite-h0s6n13f.js";import{a,Ho,zo,ie,Wo}from"./vm-hands-entry-lite-haws181e.js";import{L,Mi,$i,Zo,y,t,k,At,o,d,u,i,c,g,ee,s,n}from"./vm-hands-entry-lite-4cdn822w.js";import{Fi}from"./vm-hands-entry-lite-pzj5s203.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{Yo,se,Qo,C,De,Me,A}from"./vm-hands-entry-lite-1kt82jes.js";var Si=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function l(w){return e[w]??null}let f={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(w)=>{switch(w.code){case"invalid_type":{let S=_[w.expected]??w.expected,x=Zo(w.input),W=_[x]??x;return`Invalid input: expected ${S}, received ${W}`}case"invalid_value":if(w.values.length===1)return`Invalid input: expected ${$i(w.values[0])}`;return`Invalid option: expected one of ${Mi(w.values,"|")}`;case"too_big":{let S=w.inclusive?"<=":"<",x=l(w.origin);if(x)return`Too big: expected ${w.origin??"value"} to have ${S}${w.maximum.toString()} ${x.unit??"elements"}`;return`Too big: expected ${w.origin??"value"} to be ${S}${w.maximum.toString()}`}case"too_small":{let S=w.inclusive?">=":">",x=l(w.origin);if(x)return`Too small: expected ${w.origin} to have ${S}${w.minimum.toString()} ${x.unit}`;return`Too small: expected ${w.origin} to be ${S}${w.minimum.toString()}`}case"invalid_format":{let S=w;if(S.format==="starts_with")return`Invalid string: must start with "${S.prefix}"`;if(S.format==="ends_with")return`Invalid string: must end with "${S.suffix}"`;if(S.format==="includes")return`Invalid string: must include "${S.includes}"`;if(S.format==="regex")return`Invalid string: must match pattern ${S.pattern}`;return`Invalid ${f[S.format]??w.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${w.divisor}`;case"unrecognized_keys":return`Unrecognized key${w.keys.length>1?"s":""}: ${Mi(w.keys,", ")}`;case"invalid_key":return`Invalid key in ${w.origin}`;case"invalid_union":if(w.options&&Array.isArray(w.options)&&w.options.length>0)return`Invalid discriminator value. Expected ${w.options.map((x)=>`'${x}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${w.origin}`;default:return"Invalid input"}}};function gn(){return{localeError:Si()}}L(gn());class _t extends Error{}function Co(e){let l;try{l=new URL(e)}catch{throw new _t("The proxy must be a URL like https://proxy.example.com:3128.")}if(l.protocol!=="https:"&&l.protocol!=="http:")throw new _t("The proxy URL must use the https or http scheme.");if(!l.hostname)throw new _t("The proxy URL must name a host.");if(l.port!==""&&Number(l.port)<1)throw new _t("The proxy URL must use a port between 1 and 65535.");if(l.pathname!==""&&l.pathname!=="/"||l.search||l.hash)throw new _t("The proxy URL must not carry a path, query, or fragment.");return l.toString()}import{createHash as Ei}from"crypto";import{isAbsolute as Lo,join as Bo,relative as jo,resolve as qt,sep as Mo}from"path";var Vt=t().min(1).refine(Lo,"absolute path required"),No=c({version:n(1),apiOrigin:At(),channel:s(["staging","production"]),stateDirectory:Vt,workspaceRoot:Vt,lifetime:s(["persistent","ephemeral"]),executionMode:s(["confined","host"]).default("confined"),name:t().min(1).max(160).default("Reason headless worker"),slots:o().int().min(1).max(4).default(1),shutdownGraceMs:o().int().min(0).max(300000).default(30000),proxy:c({version:n(Jt),url:t().refine((e)=>{try{return Co(e)===e}catch{return!1}},"invalid proxy URL"),caFile:Vt.optional()}).optional(),userChrome:d().optional(),cloudSessions:n(!0).optional(),localLogins:d().optional(),folders:u(Vt).min(1).max(31).optional()}),Ri=/^https:\/\/[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.trycloudflare\.com$/,B=g("channel",[No,No.extend({channel:n("local-qa"),apiOrigin:t()})]).superRefine((e,l)=>{if(e.channel==="local-qa"){if(!Ri.test(e.apiOrigin))l.addIssue({code:"custom",message:"local QA worker requires an exact HTTPS trycloudflare.com quick-tunnel origin"})}else{let _=new URL(e.apiOrigin);if(_.origin!==e.apiOrigin||_.username||_.password||_.protocol!=="https:"&&!(_.protocol==="http:"&&ri(_.origin))||!ri(_.origin)&&!Uo(e.channel,_.origin))l.addIssue({code:"custom",message:"API origin must match channel (or loopback)"})}if(!je(e.workspaceRoot,e.stateDirectory))l.addIssue({code:"custom",message:"state and workspace must be disjoint"});let f=e.folders??[];if(new Set([e.workspaceRoot,...f]).size!==f.length+1||f.some((_)=>!je(_,e.stateDirectory)))l.addIssue({code:"custom",message:"folders must be distinct and disjoint from state"})});function m(e){return Bo(e.stateDirectory,`headless-${e.channel}`)}function je(e,l){if(Fr(l,e))return!1;return!Fr(e,l)||E(Bo(Mo,jo(qt(e),qt(l))))}function Fr(e,l){let f=jo(qt(e),qt(l));return f===""||f!==".."&&!f.startsWith(`..${Mo}`)&&!Lo(f)}function te(e){let{proxy:l,userChrome:f,cloudSessions:_,localLogins:w,folders:S,...x}=e;return Ei("sha256").update(JSON.stringify(x)).digest("hex")}var Oi=4,xi=[2375,2376,9222,9229];function mr(e){let l=new Set(xi);for(let f of e){let _=new URL(f);l.add(Number(_.port||(["https:","wss:"].includes(_.protocol)?443:80)))}return l}function Gr(){throw new r("preview_unavailable","The live Hands preview binding is unavailable or stale.")}var Pi=60000;function Fo(e){let l=new AbortController,f=new Map,_=(R)=>JSON.stringify([R.jobId,R.port]);function w(R){let M=e.authority.owner;if(l.signal.aborted||!e.isCurrent()||e.expiresAtMs<=Date.now()||R.organization_id!==M.organization_id||R.user_id!==M.user_id||R.device_id!==M.device_id)Gr()}function S(R){let M;try{M=e.environment.current()}catch{return null}return M.binding.target_generation===R.generation&&M.binding.target_fence_id===R.fenceId&&M.run_id===e.runId&&M.device_id===e.authority.owner.device_id&&M.root_id===e.authority.rootId?M:null}async function x(R,M,G){let F=await W(R,M,G);if(F!=="moved")return F;let I=await W(R,M,G);return I==="moved"?null:I}async function W(R,M,G){try{w(e.authority.owner);let F=e.identity();if(!F||G.aborted||R.expiresAtMs<=Date.now()||R.expiresAtMs>e.expiresAtMs)return null;let I=M.opened,re=I!==void 0&&F.generation>I.generation,J=S(F);if(re){if(J){if(J.revision<=I.revision||R.expiresAtMs>Date.parse(J.expires_at)||J.binding.target_revision!==I.attachmentRevision||J.binding.root_grant_revision!==I.grantRevision)return null;M.recoveringSinceMs=void 0}else if(Date.now()-(M.recoveringSinceMs??=Date.now())>Pi)return null}else if(!J||R.expiresAtMs>Date.parse(J.expires_at)||I&&(F.generation!==I.generation||F.fenceId!==I.fenceId))return null;let z=await e.inspect(R.jobId,G),fe=e.identity(),ve=fe&&S(fe);w(e.authority.owner);let be=J&&{generation:F.generation,fenceId:F.fenceId,snapshotId:J.snapshot_id,revision:J.revision,attachmentRevision:J.binding.target_revision,grantRevision:J.binding.root_grant_revision},Re=re?I:be;if(G.aborted||!fe)return null;if(fe.generation!==F.generation||fe.fenceId!==F.fenceId||ve?.snapshot_id!==J?.snapshot_id||ve?.revision!==J?.revision)return"moved";let $e=z.ok&&z.job.environmentSnapshotId!==void 0&&z.job.environmentRevision!==void 0?{snapshotId:z.job.environmentSnapshotId,revision:z.job.environmentRevision}:null;if(!z.ok||z.generation!==F.generation||!Re||!$e)return null;if(($e.snapshotId!==Re.snapshotId||$e.revision!==Re.revision)&&(re||!e.environment.carried($e.snapshotId,$e.revision)))return null;if(!I&&F.generation===R.generation&&F.fenceId===R.fenceId)M.opened={...Re,...$e};return{executorLaunchId:e.executorLaunchId,job:z.job,binding:{organizationId:e.authority.owner.organization_id,userId:e.authority.owner.user_id,deviceId:e.authority.owner.device_id,rootId:e.authority.rootId,runId:e.runId,attachmentRevision:Re.attachmentRevision,grantRevision:Re.grantRevision,generation:Re.generation,fenceId:Re.fenceId,jobId:z.job.jobId,port:R.port,expiresAtMs:R.expiresAtMs}}}catch{return null}}return{async open(R,M,G){w(M);let{binding:F,deviceRelayUrl:I}=ut(R);if(G.aborted||F.expiresAtMs<=Date.now()||F.expiresAtMs>Date.now()+p.lifetimeMs||new URL(I).origin!==e.authority.relayOrigin)Gr();let re=_(F),J=f.get(re);if(J){if(!ze(J.binding,F)||J.relay!==I)Gr();if(await J.opened,!await Mt(()=>J.port.check())||G.aborted||J.abort.signal.aborted)Gr();return{opened:!0,binding:F}}if(f.size>=Oi)Gr();let z=new AbortController,fe={},ve=we({binding:F,deniedPorts:e.authority.deniedPorts,readCurrentJob:()=>x(F,fe,z.signal)}),be=()=>z.abort();if(G.addEventListener("abort",be,{once:!0}),l.signal.addEventListener("abort",be,{once:!0}),G.aborted||l.signal.aborted)be();let Re=_e({binding:F,deviceRelayUrl:I,port:ve,signal:z.signal}),$e={binding:F,relay:I,abort:z,port:ve,opened:Re};f.set(re,$e);let qe=()=>{if(G.removeEventListener("abort",be),l.signal.removeEventListener("abort",be),f.get(re)===$e)f.delete(re)};try{if((await Re).closed.then(qe),G.removeEventListener("abort",be),w(M),z.signal.aborted||!await Mt(()=>ve.check()))Gr();return{opened:!0,binding:F}}catch{z.abort(),qe(),Gr()}},async close(R,M){w(M);let{binding:G}=uo(R),F=f.get(_(G));if(!F||!ze(F.binding,G))Gr();return F.abort.abort(),await F.opened.then((I)=>I.closed,()=>{return}),{closed:!0,binding:G}},dispose(){l.abort();for(let R of f.values())R.abort.abort();f.clear()}}}import{WebSocket as Rn}from"ws";var $o=(e)=>("data"in e)?e.data.length:e.bytes,Ko=2*Xe;function ar(e){throw new r(e,"The bound Hands terminal is unavailable or its outcome is unconfirmed.")}var mt=(e)=>!["starting","running"].includes(e.state);function Qi(e,l,f=Date.now()){let _=["relay_url","session_id","expires_at","cols","rows","pty","workspace"];if(Object.keys(e).length!==_.length||Object.keys(e).some((M)=>!_.includes(M))||!ae(l)||!ae(e.session_id)||typeof e.expires_at!=="string"||typeof e.relay_url!=="string"||e.relay_url.length>4096||![e.cols,e.rows].every((M)=>Number.isSafeInteger(M)&&Number(M)>=1&&Number(M)<=Ee))ar("invalid_pty_request");let w=e.pty;if(!w||typeof w!=="object"||Array.isArray(w))ar("invalid_pty_request");let S=w;if(Object.keys(S).length!==2||S.version!==1||!ce(S.jobId))ar("invalid_pty_request");let x;try{x=new URL(e.relay_url)}catch{return ar("invalid_pty_request")}if(!["ws:","wss:"].includes(x.protocol)||x.username||x.password||x.hash||x.protocol==="ws:"&&!["127.0.0.1","[::1]","localhost"].includes(x.hostname))ar("invalid_pty_request");let W=Date.parse(e.expires_at);if(!Number.isSafeInteger(W)||W<=f)ar("invalid_pty_request");return{workspace:H(e.workspace)??ar("invalid_pty_request"),session:{jobId:S.jobId,sessionId:e.session_id,operationId:l,relayUrl:x.href,cols:Number(e.cols),rows:Number(e.rows),leaseExpiresAtMs:Math.min(W,f+43200000)}}}async function Go(e){let{session:l,binding:f}=e;if(f.assertCurrent(),e.signal.aborted||Date.now()>=l.leaseExpiresAtMs)ar("cancelled");let _=new Rn(l.relayUrl,{followRedirects:!1,perMessageDeflate:!1,maxPayload:ne}),w=new AbortController,S=()=>{},x=()=>{w.abort(),S()};e.signal.addEventListener("abort",x,{once:!0});let W=setTimeout(x,Math.max(1,l.leaseExpiresAtMs-Date.now())),R=[],M=0,G=0,F=0,I=!1,re=!1,J=!1,z,fe,ve,be=(le)=>{ve=new r(le,"Bound terminal input was refused."),x()};_.on("error",()=>be("pty_relay_unavailable")),_.on("close",x),_.on("message",(le,he)=>{if(w.signal.aborted)return;if(!re){be("pty_not_ready");return}let Oe=Array.isArray(le)?Buffer.concat(le):le instanceof ArrayBuffer?Buffer.from(le):le;if(Oe.length===0)return;let Ke=R.at(-1),Le=he&&Ke!==void 0&&"data"in Ke&&Ke.data.length+Oe.length<=ne;if(Oe.length>ne||M+Oe.length>Vn){be("pty_input_backpressure");return}if(Le)Ke.data=Buffer.concat([Ke.data,Oe]);else if(he)R.push({data:Buffer.from(Oe)});else try{let Be=JSON.parse(Oe.toString("utf8"));if(Be&&Be.t==="close"&&Object.keys(Be).length===1){J=!0,x();return}if(!Be||Be.t!=="resize"||Object.keys(Be).length!==3||![Be.cols,Be.rows].every((ke)=>Number.isSafeInteger(ke)&&ke>=1&&ke<=Ee))throw Error("invalid_control");R.push({cols:Be.cols,rows:Be.rows,bytes:Oe.length})}catch{be("invalid_pty_control");return}M+=Oe.length,S()});function Re(le){return Kn(JSON.stringify({...f.scope,version:1,sessionId:l.sessionId,operationId:l.operationId,job:{...le,output:[],pty:le.pty?{...le.pty,output:[]}:void 0}}))}function $e(le){if(!le.ok)ar(le.error);let he=le.job;if(le.generation!==f.scope.generation||he.jobId!==l.jobId||!he.pty||he.leaseExpiresAtMs>l.leaseExpiresAtMs||he.process&&he.process.executorLaunchId!==f.scope.executorLaunchId||he.process&&fe&&(he.process.pid!==fe.pid||he.process.processGroupId!==fe.processGroupId)||he.state!=="starting"&&(he.environmentRevision!==f.environment.revision||he.environmentSnapshotId!==f.environment.snapshotId))ar("pty_binding_changed");if(Re(he),he.process)fe??={...he.process};return he}async function qe(le){f.assertCurrent();let he=await f.request(le,w.signal);if(f.assertCurrent(),w.signal.aborted)ar("cancelled");let Oe=$e(he);if(Oe.inputSequence!==G)ar("job_input_sequence");if(!mt(Oe)&&Oe.leaseExpiresAtMs<=Date.now())ar("pty_binding_changed");return Oe}function ye(le){if(f.assertCurrent(),w.signal.aborted||_.readyState!==Rn.OPEN||_.bufferedAmount+Buffer.byteLength(le)>Ko)ar("pty_output_backpressure");_.send(le)}function Fe(le){if(le.firstCursor>F+1)F=le.firstCursor-1;for(let he of le.pty.output){if(he.cursor<=F)continue;if(he.cursor!==F+1)ar("pty_output_gap");let Oe=Buffer.from(he.dataBase64,"base64");if(_.bufferedAmount+Oe.length>Ko)return!1;ye(Oe),F=he.cursor}if(F!==le.nextCursor)ar("pty_output_gap");return!0}async function Ve(le,he){let Oe;try{await Promise.race([e.emit(le,he),new Promise((Ke,Le)=>{Oe=setTimeout(()=>Le(new r("pty_event_unavailable","Terminal metadata delivery timed out.")),2000)})])}finally{clearTimeout(Oe)}}async function Ie(){let le=AbortSignal.timeout(Qt),he=f.request({jobId:l.jobId,action:"cancel",input:{}},le),Oe,Ke=new Promise((Le,Be)=>{if(Oe=()=>Be(new r("pty_cleanup_unconfirmed","Terminal cleanup acknowledgement was not observed within authority.")),le.addEventListener("abort",Oe,{once:!0}),le.aborted)Oe()});try{let Le=await Promise.race([he,Ke]);if(le.aborted)ar("pty_cleanup_unconfirmed");return $e(Le)}finally{le.removeEventListener("abort",Oe)}}try{await new Promise((Le,Be)=>{let ke=setTimeout(()=>{x(),Be(new r("pty_relay_unavailable","Terminal pairing timed out."))},5000),We=()=>{clearTimeout(ke),Be(new r("cancelled","Terminal pairing was cancelled."))};if(w.signal.addEventListener("abort",We,{once:!0}),_.once("open",()=>{clearTimeout(ke),w.signal.removeEventListener("abort",We),Le()}),w.signal.aborted)We()}),f.assertCurrent(),I=!0,z=await qe({jobId:l.jobId,action:"start",input:{mode:"pty",cols:l.cols,rows:l.rows,leaseExpiresAtMs:l.leaseExpiresAtMs}});let le=Date.now()+5000;while(z.state==="starting"){if(Date.now()>=le)ar("pty_not_ready");await new Promise((Le)=>setTimeout(Le,25)),z=await qe({jobId:l.jobId,action:"inspect",input:{after:F}})}if(z.state!=="running"||z.inputSequence!==0||z.leaseExpiresAtMs<=Date.now())ar("pty_not_ready");await Ve("pty.ready",Re(z)),re=!0,ye(JSON.stringify({t:"open",cols:z.pty.cols,rows:z.pty.rows,receipt:Re(z)}));let he=!1,Oe=0,Ke=!1;while(!w.signal.aborted){let Le=z.firstCursor>F+1,Be=Fe(z);if(mt(z)){if(Be)break}else if(Le)he=!0;else if(he&&Be&&Date.now()>=Oe){he=!1,Oe=Date.now()+1000;let{cols:We,rows:rr}=z.pty;for(let nr of[{cols:We,rows:rr>1?rr-1:2},{cols:We,rows:rr}]){if(mt(z))break;let Rr=++G;if(z=await qe({jobId:l.jobId,action:"resize",input:{sequence:Rr,...nr}}),z.inputSequence!==Rr)ar("job_input_sequence")}continue}let ke=mt(z)||Ke?void 0:R.shift();if(ke){M-=$o(ke);let We=++G;try{z=await qe("data"in ke?{jobId:l.jobId,action:"input",input:{sequence:We,dataBase64:ke.data.toString("base64")}}:{jobId:l.jobId,action:"resize",input:{sequence:We,cols:ke.cols,rows:ke.rows}})}catch(rr){if(!(rr instanceof r)||rr.code!=="job_input_backpressure")throw rr;G-=1,R.unshift(ke),M+=$o(ke),Ke=!0;continue}if(z.inputSequence!==We)ar("job_input_sequence")}else if(await new Promise((We)=>{let rr=setTimeout(We,Ke||!Be?10:50);if(S=()=>{clearTimeout(rr),We()},w.signal.aborted||!Ke&&R.length)S()}),Ke=!1,S=()=>{},!w.signal.aborted&&Be)try{z=await qe({jobId:l.jobId,action:"inspect",input:{after:F}})}catch(We){if(!J||!(We instanceof r)||We.code!=="cancelled")throw We}}}catch(le){ve??=le}finally{if(re=!1,R.length=0,clearTimeout(W),e.signal.removeEventListener("abort",x),x(),I&&(!z||!mt(z)))try{z=await Ie()}catch{z=void 0}try{if(!z||!mt(z)||z.pty?.cleanup!=="confirmed")ar("pty_cleanup_unconfirmed");let le=Re(z);if(_.readyState===Rn.OPEN)await new Promise((he)=>{let Oe=setTimeout(he,500);_.send(JSON.stringify({t:"exit",code:z.exitCode,receipt:le}),()=>{clearTimeout(Oe),he()})});await Ve("pty.stopped",le)}catch(le){ve??=le}_.terminate()}if(ve)throw ve;if(e.signal.aborted)ar("cancelled");if(!z)ar("pty_cleanup_unconfirmed");return{receipt:Re(z)}}import{createHash as Ii,randomUUID as In}from"crypto";import{spawnSync as Xo}from"child_process";import{closeSync as Jo,constants as On,fstatSync as Ai,fsyncSync as Ti,lstatSync as Ht,mkdirSync as Di,mkdtempSync as es,openSync as Vo,readFileSync as Ci,readdirSync as rs,realpathSync as Ct,rmSync as Pn,unlinkSync as Hi}from"fs";import{createConnection as Ni}from"net";import{dirname as Li,join as nt,sep as Bi}from"path";import{tmpdir as Wi}from"os";var hr=new Map,Jr=new Map;function Ur(e,l){return Ii("sha256").update(JSON.stringify([e,l])).digest("hex")}function ht(e){try{Di(e,{mode:448})}catch(f){if(!(f instanceof Error&&("code"in f)&&f.code==="EEXIST"))throw f}let l=Ht(e);if(!l.isDirectory()||l.isSymbolicLink()||!A(l)||Ct(e)!==e)throw new r("hands_jobs_unavailable","Hands job state must be a private canonical directory.")}function Ui(e){let l;try{l=Ht(e)}catch(f){if(f instanceof Error&&"code"in f&&f.code==="ENOENT")return!1;throw f}return!l.isDirectory()||l.isSymbolicLink()||rs(e).length>0}function gr(e){let l=Ur(e.root,e.runId),f=e.previousRuntimeDirectories?.find((x)=>Ui(nt(x,"jobs",l.slice(0,16))))??e.runtimeDirectory;ht(f);let _=nt(f,"jobs");ht(_);let w=nt(_,l.slice(0,16));if(e.maxScopes!==void 0){let x=rs(_);if(!Number.isSafeInteger(e.maxScopes)||e.maxScopes<1||x.length>e.maxScopes||!x.includes(l.slice(0,16))&&x.length>=e.maxScopes)throw new r("process_journal_capacity","Managed process receipt capacity is full; preserve uncertain jobs and reconcile their existing receipts before starting more work.")}ht(w);let S=es(nt(Qo(),"reason-j-"));try{return ht(S),{journalDirectory:w,scopeId:l,launchDirectory:S,socketPath:process.platform==="win32"?`\\\\.\\pipe\\reason-jobs-${In()}`:nt(S,"control.sock"),disposeSocket:()=>Pn(S,{recursive:!0,force:!0})}}catch(x){throw Pn(S,{recursive:!0,force:!0}),x}}var zi=60000,Ki=5000;function Gi(e){if(process.platform==="win32")return Ji(e);let l=Xo("ps",["-o","lstart=","-p",String(e)],{encoding:"utf8",timeout:2000,env:{...process.env,LC_ALL:"C",LANG:"C"}}),f=l.status===0?/^\w{3} (\w{3}) +(\d{1,2}) (\d{2}):(\d{2}):(\d{2}) (\d{4})$/.exec(l.stdout.trim()):null,_=f?"JanFebMarAprMayJunJulAugSepOctNovDec".indexOf(f[1]):-1;if(!f||_<0||_%3!==0)return null;let w=new Date(Number(f[6]),_/3,Number(f[2]),Number(f[3]),Number(f[4]),Number(f[5])).getTime();return Number.isFinite(w)?w:null}function Ji(e){let l=Xo(C("powershell"),["-NoProfile","-NonInteractive","-Command",`(Get-Process -Id ${e}).StartTime.ToUniversalTime().ToString('o')`],{encoding:"utf8",timeout:5000,windowsHide:!0,env:De()}),f=l.status===0?Date.parse(l.stdout.trim()):Number.NaN;return Number.isFinite(f)?f:null}function ts(e,l={}){let f=nt(e.journalDirectory,"owner.lock"),_;try{_=Vo(f,On.O_RDONLY|On.O_NOFOLLOW)}catch{return null}try{let w=Ai(_);if(!w.isFile()||w.nlink!==1||!A(w)||w.size>4096)return null;let S=null;try{S=JSON.parse(Ci(_,"utf8"))}catch{}let x;if(S===null){if((l.now??Date.now)()-w.mtimeMs<zi)return null;x={reason:"never_written",executorLaunchId:null}}else{let{version:M,scopeId:G,pid:F,createdAtMs:I,executorLaunchId:re}=S;if(M!==1||G!==e.scopeId||typeof re!=="string"||typeof F!=="number"||!Number.isSafeInteger(F)||F<1||F===process.pid||typeof I!=="number"||!Number.isSafeInteger(I))return null;if(!(l.exists??((z)=>{try{return process.kill(z,0),!0}catch(fe){return!(fe instanceof Error&&("code"in fe)&&fe.code==="ESRCH")}}))(F))x={reason:"owner_exited",executorLaunchId:re};else{let z=(l.startedAtMs??Gi)(F);if(z===null||z<=I+Ki)return null;x={reason:"pid_reused",executorLaunchId:re}}}let W=Ht(f);if(W.dev!==w.dev||W.ino!==w.ino)return null;Hi(f);let R=Vo(e.journalDirectory,On.O_RDONLY);try{Ti(R)}finally{Jo(R)}return x}catch{return null}finally{Jo(_)}}function ns(e){let l={...e,workspace:e.workspace&&Object.freeze({...e.workspace}),previewAuthority:e.previewAuthority&&Object.freeze({...e.previewAuthority,owner:Object.freeze({...e.previewAuthority.owner}),deniedPorts:new Set(e.previewAuthority.deniedPorts)})},f=Ur(l.root,l.runId);if(hr.has(f)||l.operationId!==void 0&&Jr.has(l.operationId))throw new r("hands_jobs_busy","The Session already has a live Hands job supervisor.");let _={binding:l,key:f,terminals:new Map};if(l.previewAuthority&&l.environment)_.previews=Fo({authority:l.previewAuthority,runId:l.runId,expiresAtMs:l.expiresAtMs,executorLaunchId:l.executorLaunchId,environment:l.environment,isCurrent:()=>hr.get(_.key)===_,identity:()=>{try{return gt(l)}catch{return null}},inspect:(w,S)=>{if(hr.get(_.key)!==_)throw new r("preview_unavailable","The Hands supervisor is no longer current.");return os(l,{jobId:w,action:"inspect",input:{after:0}},S)}});if(hr.set(f,_),l.operationId!==void 0)Jr.set(l.operationId,_);return()=>{if(hr.get(_.key)===_)hr.delete(_.key);if(l.operationId!==void 0&&Jr.get(l.operationId)===_)Jr.delete(l.operationId);_.previews?.dispose();for(let w of _.terminals.values())w.abort()}}var Vi=5000,qi=20;async function eo(e){let l=(w)=>{throw new r("hands_rebind_unavailable",w)};if(!N(e.operationId)||!N(e.runId)||!N(e.fenceId)||!U(e.targetGeneration))l("Reason sent an invalid Hands rebind.");let f=Jr.get(e.operationId);if(!f||f.binding.root!==e.root)return l("No live Hands supervisor owns this operation.");for(let w=Date.now()+Vi;;){if(e.signal?.aborted)l("The Hands rebind was cancelled.");if(Jr.get(e.operationId)!==f)l("The Hands supervisor is no longer current.");let S=null;try{S=gt(f.binding)}catch{}if(S&&S.generation===e.targetGeneration&&S.fenceId===e.fenceId)break;if(S&&S.generation>e.targetGeneration||Date.now()>=w)l("The executor did not adopt this take.");await new Promise((x)=>setTimeout(x,qi))}if(Jr.get(e.operationId)!==f||hr.get(f.key)!==f)l("The Hands supervisor is no longer current.");let _=Ur(e.root,e.runId);if(f.key===_)return;if(hr.has(_))l("The taking run already has a live Hands job supervisor.");hr.delete(f.key);for(let w of f.terminals.values())w.abort();f.key=_,hr.set(_,f)}function at(e){let l="operationId"in e?Jr.get(e.operationId):hr.get(Ur(e.root,e.runId)),f=l&&l.binding.root===e.root?l.binding:void 0;if(!f?.environment||f.expiresAtMs<=Date.now())throw new r("environment_unavailable","No live Hands supervisor owns this environment.");return f.environment.install(e.payload)}async function to(e){let l=hr.get(Ur(e.root,e.runId));if(!l?.previews||!e.owner)throw new r("preview_unavailable","No authenticated Hands supervisor owns this preview.");return l.previews.open(e.payload,e.owner,e.signal)}async function ro(e){let l=hr.get(Ur(e.root,e.runId));if(!l?.previews||!e.owner||e.signal.aborted)throw new r("preview_unavailable","No authenticated Hands supervisor owns this preview.");return l.previews.close(e.payload,e.owner)}async function no(e){let l=Ur(e.root,e.runId),f=hr.get(l),_=f?.binding,w=_?.runId,S=_?.previewAuthority,x=_?.environment,W=e.owner&&{...e.owner},R=e.authority&&{...e.authority},M=()=>{throw new r("pty_binding_unavailable","No current authenticated Hands scope owns this terminal.")};if(!f||!_||!S||!x||!W||!R||!_.workspace)return M();let G=Object.freeze({..._.workspace}),F=gt(_),I=x.current(),re=()=>{if(hr.get(l)!==f||W.organization_id!==S.owner.organization_id||W.user_id!==S.owner.user_id||W.device_id!==S.owner.device_id||e.deviceId!==S.owner.device_id||e.rootId!==S.rootId||O(e.workspace)!==O(G))M();let z=gt(_),fe=x.current();if(z.generation!==F.generation||z.fenceId!==F.fenceId||fe.run_id!==w||fe.device_id!==e.deviceId||fe.root_id!==e.rootId||fe.snapshot_id!==I.snapshot_id||fe.revision!==I.revision||fe.binding.target_generation!==F.generation||fe.binding.target_fence_id!==F.fenceId||R.device_id!==e.deviceId||R.binding!==fe.binding.kind||R.target_revision!==fe.binding.target_revision||R.root_grant_revision!==fe.binding.root_grant_revision||R.target_generation!==F.generation||R.target_fence_id!==F.fenceId)M()};if(re(),new URL(e.session.relayUrl).origin!==S.relayOrigin||f.terminals.has(e.session.jobId)||f.terminals.size>=4)return M();let J=new AbortController;f.terminals.set(e.session.jobId,J);try{return await Go({session:{...e.session,leaseExpiresAtMs:Math.min(e.session.leaseExpiresAtMs,F.expiresAtMs,Date.parse(I.expires_at))},signal:AbortSignal.any([e.signal,J.signal]),emit:e.emit,binding:{assertCurrent:re,environment:{revision:I.revision,snapshotId:I.snapshot_id},scope:{runId:e.runId,deviceId:e.deviceId,rootId:e.rootId,workspace:G,binding:I.binding.kind,targetRevision:I.binding.target_revision,rootGrantRevision:I.binding.root_grant_revision,generation:F.generation,fenceId:F.fenceId,executorLaunchId:F.executorLaunchId},request:(z,fe)=>_r(F,zr(JSON.stringify({...z,type:"job",version:2,generation:F.generation,id:In()})),fe)}})}finally{if(f.terminals.get(e.session.jobId)===J)f.terminals.delete(e.session.jobId)}}async function io(e){if(ce(e.payload.jobId))throw new r("pty_binding_required","PTY jobs require the bound terminal capability.");let l=hr.get(Ur(e.root,e.runId))?.binding;if(!l||l.expiresAtMs<=Date.now())throw new r("hands_jobs_unavailable","No live Hands supervisor owns this Session and root.");return os(l,e.payload,e.signal)}var Yi=1e4,Xi=20,Zi=Se/2,ea=Je/2,ra=(e)=>e.output.reduce((l,f)=>l+f.text.length,0);async function os(e,l,f){if(Object.keys(l).some((M)=>!["jobId","action","input","waitForExitMs"].includes(M)))throw new r("invalid_payload","Unexpected job control field.");let{waitForExitMs:_,...w}=l;if(_!==void 0&&(w.action!=="start"||typeof w.input!=="object"||w.input===null||!("script"in w.input)||typeof _!=="number"||!Number.isSafeInteger(_)||_<1||_>Yi))throw new r("invalid_payload","Only a script start may wait for its job, within its bound.");let S=(M)=>{let G=gt(e);return _r(G,zr(JSON.stringify({...M,type:"job",version:2,generation:G.generation,id:In()})),f)},x=await S(w);if(_===void 0)return x;let W=Date.now()+_,R=x;while(R.ok&&["starting","running"].includes(R.job.state)&&R.job.output.length<Zi&&ra(R.job)<ea&&!f.aborted&&Date.now()<W){if(await new Promise((M)=>setTimeout(M,Math.min(Xi,W-Date.now()))),f.aborted)break;try{let M=await S({jobId:w.jobId,action:"inspect",input:{after:0}});if(!M.ok)break;R=M}catch{break}}return R}function gt(e){if(e.expiresAtMs<=Date.now())throw new r("hands_jobs_unavailable","Hands authority expired.");let l=e.readIdentity?e.readIdentity():e;if(!l||!U(l.generation)||!N(l.fenceId)||l.generation<e.generation||l.generation===e.generation&&l.fenceId!==e.fenceId)throw new r("hands_jobs_unavailable","The live Hands fencing identity could not be verified.");return e.generation=l.generation,e.fenceId=l.fenceId,{...e}}function _r(e,l,f){if(f.aborted)return Promise.reject(new r("cancelled","Job control was cancelled."));return new Promise((_,w)=>{let S=Ni(e.socketPath),x="",W=!1,R,M=(F,I)=>{if(W)return;if(W=!0,clearTimeout(R),f.removeEventListener("abort",G),S.destroy(),F)w(F);else _(I)},G=()=>M(new r("cancelled","Job control waiter cancelled; inspect before retrying mutations."));f.addEventListener("abort",G,{once:!0}),S.setEncoding("utf8"),R=setTimeout(()=>M(new r("hands_job_result_unknown","Job control timed out; inspect before retrying mutations.")),Math.min(1e4,Math.max(1,e.expiresAtMs-Date.now()))),S.on("error",()=>M(new r("hands_job_result_unknown","Hands job control connection failed."))),S.once("connect",()=>S.write(JSON.stringify({version:1,scopeId:e.scopeId,fenceId:e.fenceId,executorLaunchId:e.executorLaunchId,request:l})+`
3
3
  `)),S.on("data",(F)=>{if(x+=F,Buffer.byteLength(x)>Ze)M(new r("hands_job_result_unknown","Hands job result exceeded its bound."))}),S.once("end",()=>{if(Date.now()>=e.expiresAtMs){M(new r("hands_job_result_unknown","Hands authority expired before the result was acknowledged."));return}try{let F=qr(x.trim());if(F.id!==l.id||F.generation!==e.generation||F.ok&&F.job.jobId!==l.jobId)throw Error("identity");M(void 0,F)}catch{M(new r("hands_job_result_unknown","Hands job response identity or shape was invalid."))}}),S.once("close",()=>{if(!W)M(new r("hands_job_result_unknown","Hands job control closed before an acknowledged result."))})})}function qo(e){let l=Ct(e.root),f=e.authority,_=Date.parse(e.leaseUntil),w=()=>{if(e.signal.throwIfAborted(),!Number.isFinite(_)||_<=Date.now())throw Error("local_device_gh_lease_expired")};if(w(),f.readOnly&&f.generation===null)return{root:l,readOnly:!0,signal:e.signal,deadlineMs:_,assertCurrent:w};let S=Ur(l,e.runId),x=hr.get(S),W=x?.binding;if(!W?.environment||!W.workspace||W.localGithubConfinement!==!0)throw Error("local_device_gh_confinement_unavailable");let R=W.environment.current(),M=()=>{w();let F=W.environment.current(),I=gt(W);if(hr.get(S)!==x||F.github_auth!=="local_gh"||F.run_id!==W.runId||f.runId!==e.runId||F.device_id!==f.deviceId||F.root_id!==f.rootId||String(F.binding.root_grant_revision)!==f.rootRevision||F.binding.target_generation!==f.generation||F.binding.target_fence_id!==f.fenceId||I.generation!==f.generation||I.fenceId!==f.fenceId||F.snapshot_id!==R.snapshot_id||F.revision!==R.revision)throw Error("local_device_gh_authority_changed")};M();let G=ie(l,W.workspace);return{root:G.boundary,signal:e.signal,deadlineMs:_,privateDirectory:Li(W.environment.path),repoPath:G.path,readOnly:f.readOnly,forbiddenSecretValues:Object.values(R.variables),secretNames:(F)=>Object.entries(R.variables).filter(([,I])=>I.trim()===F.trim()).map(([I])=>`variable ${I}`),assertCurrent:M}}async function oo(e,l){let f=Pe.parse(e.request),_=oe.parse(e.authority);if(_.contributorRefresh&&f.kind==="read"&&_.readOnly)return l(qo(e));let w=Boolean(_.contributorRefresh);if(w&&(_.merge||f.kind!=="pr_mutation"||f.mutation.action!=="edit"||typeof f.mutation.body!=="string"||f.mutation.title!==void 0||f.mutation.base!==void 0||_.readOnly||_.runId!==e.runId||_.repoFullName!==f.repoFullName))throw Error("local_device_gh_contributor_refresh_authority_invalid");if(f.kind!=="pr_merge"&&!w){if(_.merge)throw Error("local_device_gh_merge_authority_invalid");return l(qo(e))}if(!w&&(!_.merge||_.readOnly||_.runId!==e.runId||_.repoFullName!==f.repoFullName||_.merge.source==="agent"&&(_.generation===null||_.fenceId===null)))throw Error("local_device_gh_merge_authority_invalid");let S=Ct(e.root),x=Ht(S),W=Date.parse(e.leaseUntil);if(!Number.isFinite(W)||W<=Date.now())throw Error("local_device_gh_lease_expired");let R=Ct(Wi());if(R===S||R.startsWith(S+Bi))throw Error("local_device_gh_private_scope_unavailable");let M=es(nt(R,"reason-gh-merge-"));try{ht(M);let G=()=>{if(e.signal.throwIfAborted(),Date.now()>=W)throw Error("local_device_gh_lease_expired");let F=Ht(e.root);if(F.isSymbolicLink()||F.dev!==x.dev||F.ino!==x.ino||Ct(e.root)!==S)throw Error("local_device_gh_authority_changed");ht(M)};return G(),await l({root:S,readOnly:!1,privateDirectory:M,forbiddenSecretValues:[],signal:e.signal,deadlineMs:W,assertCurrent:G})}finally{Pn(M,{recursive:!0,force:!0})}}var as=43200000;function bt(e){return Number.isSafeInteger(e)&&Math.abs(e)<=8640000000000000?e:null}function ss(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function is(e,l){return Object.keys(e).length===l.length&&l.every((f)=>Object.hasOwn(e,f))}function so(e){if(!ss(e)||!is(e,["version","outcome","clock_source","validation_now_ms","expiry_ms","remaining_ms","maximum_lifetime_ms","cli_artifact"])||e.version!==1||e.maximum_lifetime_ms!==43200000||typeof e.outcome!=="string"||!["accepted","parse","noncanonical","expired","over_cap"].includes(e.outcome)||typeof e.clock_source!=="string"||!["date_now","injected"].includes(e.clock_source))return null;for(let _ of["validation_now_ms","expiry_ms"]){let w=e[_];if(w!==null&&(typeof w!=="number"||bt(w)===null))return null}if(e.remaining_ms!==null&&(typeof e.remaining_ms!=="number"||!Number.isSafeInteger(e.remaining_ms)))return null;let l=typeof e.expiry_ms==="number"&&typeof e.validation_now_ms==="number"?e.expiry_ms-e.validation_now_ms:null;if(e.remaining_ms!==(l!==null&&Number.isSafeInteger(l)?l:null))return null;if(e.outcome==="parse"&&e.expiry_ms!==null)return null;if(e.outcome!=="parse"&&e.expiry_ms===null)return null;if(e.outcome==="expired"&&!(typeof l==="number"&&l<=0))return null;if(e.outcome==="over_cap"&&!(typeof l==="number"&&l>43200000))return null;if(e.outcome==="accepted"&&!(typeof l==="number"&&l>0&&l<=43200000))return null;let f=e.cli_artifact;if(!ss(f)||!is(f,["kind","status","sha256","observed_at_ms"])||f.observed_at_ms!==null&&(typeof f.observed_at_ms!=="number"||bt(f.observed_at_ms)===null))return null;if(f.kind==="entrypoint_file"){if(f.status!=="observed"||typeof f.sha256!=="string"||!/^[a-f0-9]{64}$/.test(f.sha256)||f.observed_at_ms===null)return null}else if(f.kind!=="unavailable"||f.sha256!==null||typeof f.status!=="string"||!["unsupported_entrypoint","read_failed","file_changed","size_limit","time_limit"].includes(f.status))return null;return e}var An=c({kind:s(["workspace_source","mcp_control"]),target_revision:o().int().nonnegative(),root_grant_revision:o().int().positive()}),cs=new RegExp(lt.tokenPattern),ta=c({token_url:At().max(2048),request_token:t().min(1).max(8192).regex(cs),aws_credentials_url:At().max(2048).nullable()});function ds(e,l){let f=(_,w)=>{try{let S=new URL(_);return S.origin===new URL(l).origin&&S.pathname===w&&!S.username&&!S.password&&!S.search&&!S.hash}catch{return!1}};if(!cs.test(e.request_token)||!f(e.token_url,lt.tokenPath)||e.aws_credentials_url!==null&&!f(e.aws_credentials_url,lt.awsPath))return null;return{REASON_OIDC_TOKEN_URL:e.token_url,REASON_OIDC_REQUEST_TOKEN:e.request_token,...e.aws_credentials_url!==null?{AWS_CONTAINER_CREDENTIALS_FULL_URI:e.aws_credentials_url,AWS_CONTAINER_AUTHORIZATION_TOKEN:e.request_token}:{}}}function ls(e){return new TextEncoder().encode(e).byteLength}function na(e){return ls(JSON.stringify(e)+`
4
4
  `)}var yr=c({version:n(1),snapshot_id:k(),revision:o().int().positive(),run_id:t().min(1).max(160),device_id:k(),root_id:k(),binding:An.extend({target_generation:o().int().positive(),target_fence_id:k()}),expires_at:y.datetime({offset:!0}),variables:ee(t().max(128).regex(Lt),t().refine((e)=>!e.includes("\x00")&&ls(e)<=V.valueBytes)).refine((e)=>Object.keys(e).length<=V.variables),github_auth:n("local_gh").optional(),git:c({base_url:At().max(2048),token:t().min(1).max(4096).regex(/^[A-Za-z0-9._~-]+$/),expires_at:y.datetime({offset:!0})}).nullable(),cloud_access:ta.optional()}).refine((e)=>e.github_auth!=="local_gh"||e.git===null,"conflicting git authority").refine((e)=>na(e)<=V.snapshotBytes,"snapshot too large");import{spawn as oa}from"child_process";import{basename as sa,isAbsolute as Pu}from"path";var ia=0,us=120000,fs=15000,aa=65536;function Tn(e=process.execPath,l=process.argv[1]){let f=sa(e),_=(f.startsWith("bun")||f.startsWith("node"))&&typeof l==="string"&&l.length>0;return{command:e,prefix:_?[l]:[]}}function ao(e={}){let{command:l,prefix:f}=Tn(e.executablePath,e.sourceEntrypoint),_=e.spawnProcess??oa,w=e.now??Date.now,S=null,x=0,W=!1,R=(G)=>{try{G.kill("SIGKILL")}catch{}},M=()=>{if(W)return;if(S&&w()-x<us-fs)return;if(S){let F=S;S=null,R(F)}let G;try{G=_(l,[...f,"__device","__hands-worker","--handoff-fd",String(ia)],{cwd:"/",env:{PATH:process.env.PATH??"/usr/local/bin:/usr/bin:/bin"},shell:!1,stdio:["pipe","ignore","pipe"]})}catch{return}S=G,x=w(),G.on("error",()=>{if(S===G)S=null}),G.once("exit",(F,I)=>{if(S!==G)return;S=null,e.log?.("hands.worker_prespawn_exited",{exit_code:F,exit_signal:I})}),e.log?.("hands.worker_prespawned",{pid:G.pid??null})};return{arm:M,take(G){let F=S;if(!F||W)return null;let I=G.args.at(-1),re=G.options.env,J=G.options.cwd,z=[...f,"__device","__hands-worker","--config"];if(G.command!==l||G.args.length!==z.length+1||z.some((Re,$e)=>G.args[$e]!==Re)||typeof I!=="string"||!re||typeof J!=="string"||G.options.shell||JSON.stringify(G.options.stdio)!==JSON.stringify(["ignore","ignore","pipe"]))return null;S=null;let fe=F.stdin,ve={configPath:I,cwd:J,env:Object.fromEntries(Object.entries(re).filter((Re)=>typeof Re[1]==="string"))},be=JSON.stringify(ve);if(F.exitCode!==null||F.signalCode!==null||!fe||fe.destroyed||w()-x>=us-fs||Buffer.byteLength(be,"utf8")>aa)return R(F),null;return fe.on("error",()=>{return}),fe.end(be),F.once("exit",()=>{M()}),e.log?.("hands.worker_prespawn_taken",{pid:F.pid??null}),F},adopt(G){G.once("exit",()=>{M()})},close(){if(W=!0,S)R(S);S=null}}}import{accessSync as pa,constants as _a,statSync as ma}from"fs";import{homedir as ha,tmpdir as ga,userInfo as ba}from"os";import{delimiter as wa,win32 as ya}from"path";var ca=new Set(["ALL_PROXY","BUN_BE_BUN","BUN_OPTIONS","CURL_CA_BUNDLE","GIT_SSL_CAINFO","GRPC_DEFAULT_SSL_ROOTS_FILE_PATH","HTTPS_PROXY","HTTP_PROXY","NO_PROXY","NODE_EXTRA_CA_CERTS","NODE_OPTIONS","NODE_TLS_REJECT_UNAUTHORIZED","REQUESTS_CA_BUNDLE","SSLKEYLOGFILE","SSL_CERT_DIR","SSL_CERT_FILE","all_proxy","http_proxy","https_proxy","no_proxy"]);var da=["BUN_CONFIG_","BUN_INSPECT","DYLD_","NODE_DEBUG"],la=new Set(["BUN_INSTALL"]);var ua=/^--(?:max-old-space-size|max-semi-space-size|stack-size)=\d{1,9}$/;function fa(e){return(e??"").split(/\s+/).filter(Boolean).every((l)=>ua.test(l.replaceAll("_","-")))}function ps(e){return Object.keys(e).filter((l)=>ca.has(l)&&!(l==="NODE_OPTIONS"&&fa(e[l]))||da.some((f)=>l.startsWith(f))||l.startsWith("BUN_")&&!la.has(l)).sort()}var va=new Set(["HOME","PATH","PWD","OLDPWD","SHLVL","_","TMPDIR","TMP","TEMP","SHELL","BASH_ENV","ENV","ZDOTDIR","PROMPT_COMMAND","IFS","CDPATH","GLOBIGNORE","SHELLOPTS","BASHOPTS","NODE_PATH"]),ka=/^(?:ARA_|REASON_|PI_|GIT_|GH_|GITHUB_|LD_|DYLD_|BUN_|BASH_FUNC_|SSH_)/,Sa=/TOKEN|SECRET|PASSW|PASSPHRASE|CREDENTIAL|API_?KEY|ACCESS_?KEY|PRIVATE_?KEY|AUTH/i,Ea=/^[A-Za-z_][A-Za-z0-9_]*$/;function wr(e=process.env){let l=(w)=>{if(!(process.platform==="win32"?ya.isAbsolute(w):w.startsWith("/"))||/[\0\r\n]/.test(w)||w.length>32768)throw Error("invalid_host_execution_environment");return w};if(e.PATH!==void 0&&(/[\0\r\n]/.test(e.PATH)||e.PATH.length>32768))throw Error("invalid_host_execution_environment");let f=new Set(ps(e)),_=Object.fromEntries(Object.entries(e).filter((w)=>{let[S,x]=w;return typeof x==="string"&&x.length<=32768&&!x.includes("\x00")&&S.length<=128&&Ea.test(S)&&!f.has(S)&&!va.has(S)&&!ka.test(S)&&!Sa.test(S)}).sort(([w],[S])=>w.localeCompare(S)).slice(0,512));return{home:l(e.HOME||(process.platform==="win32"?e.USERPROFILE:void 0)||ha()),path:((w)=>process.platform==="win32"?kn(w):w)(Ar(e.PATH??"").join(wa)||Cr),temporaryDirectory:l(e.TMPDIR||e.TMP||e.TEMP||ga()),variables:_}}function br(e=process.env,l=()=>ba().shell){if(process.platform==="win32")return se();let f=(w)=>{if(!w||!/^\/[A-Za-z0-9._/-]*\/(?:bash|zsh)$/.test(w))return!1;try{return pa(w,_a.X_OK),ma(w).isFile()}catch{return!1}};if(f(e.SHELL))return e.SHELL;let _;try{_=l()}catch{_=void 0}return f(_)?_:"/bin/zsh"}import{readdir as Ra}from"fs/promises";var Oa=15000;function wn(e){let l=e instanceof Error&&"code"in e?e.code:null;return l==="EPERM"||l==="EACCES"}function bn(e){return new r("folder_access_denied",`macOS blocked Reason from opening ${e}. Allow Reason in System Settings \u203A Privacy & Security \u203A Files and Folders `+"(or Full Disk Access), then restart the Reason app or worker on this Mac and try again: until it restarts it keeps the earlier refusal.")}async function _s(e,{timeoutMs:l=Oa,open:f=(_)=>Ra(_)}={}){let _,w=new Promise((S)=>{_=setTimeout(()=>S("pending"),l)});try{if(await Promise.race([f(e).then(()=>"open"),w])==="pending")throw new r("folder_access_pending",`macOS is asking whether Reason may open ${e}. Answer the prompt on this Mac, then try again.`)}catch(S){if(wn(S))throw bn(e);if(S instanceof r)throw S}finally{clearTimeout(_)}}import{chmodSync as oc,closeSync as sc,constants as Un,fstatSync as ic,lstatSync as Cs,openSync as ac,readSync as cc,realpathSync as zn,unlinkSync as dc}from"fs";import{lookup as lc}from"dns/promises";import{createRequire as uc}from"module";import{request as fc}from"http";import{request as pc}from"https";import st from"net";import{platform as js}from"os";import{basename as _c,extname as mc,isAbsolute as Hs,relative as $n,resolve as vt,sep as Gn}from"path";var ms=String.raw`
5
5
  async (roots) => {
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{We,mo,F,Ve,Ut,Tr,x}from"./vm-hands-entry-lite-06mdg33e.js";import{K}from"./vm-hands-entry-lite-bvqwsd3b.js";import{pt}from"./vm-hands-entry-lite-sfmeafdm.js";import{gt}from"./vm-hands-entry-lite-zrs8h4rf.js";import{Or}from"./vm-hands-entry-lite-mxyry9da.js";import{Pt,Ui}from"./vm-hands-entry-lite-9x81cr3a.js";import{G,qe}from"./vm-hands-entry-lite-z35nbedn.js";import{xe,Jn}from"./vm-hands-entry-lite-h33trj58.js";import{St}from"./vm-hands-entry-lite-88yjxxvf.js";import{a}from"./vm-hands-entry-lite-haws181e.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{C}from"./vm-hands-entry-lite-1kt82jes.js";import{spawn as R,spawnSync as st}from"child_process";import{createHash as it,randomUUID as ge}from"crypto";import{closeSync as at,copyFileSync as ae,existsSync as M,fstatSync as ct,mkdirSync as ce,openSync as lt,readdirSync as U,readFileSync as X,readlinkSync as ut,renameSync as he,rmSync as dt,statSync as mt,writeFileSync as ft}from"fs";import{connect as ht}from"net";import{tmpdir as L,userInfo as we}from"os";import{basename as le,delimiter as wt,dirname as B,join as f}from"path";var z=`import { spawn, execFileSync } from "node:child_process";
2
+ import{We,mo,F,Ve,Ut,Tr,x}from"./vm-hands-entry-lite-60t7x9vw.js";import{K}from"./vm-hands-entry-lite-bvqwsd3b.js";import{pt}from"./vm-hands-entry-lite-sfmeafdm.js";import{gt}from"./vm-hands-entry-lite-vf02kfyy.js";import{Or}from"./vm-hands-entry-lite-89ahrw19.js";import{Pt,Ui}from"./vm-hands-entry-lite-9x81cr3a.js";import{G,qe}from"./vm-hands-entry-lite-413em054.js";import{xe,Jn}from"./vm-hands-entry-lite-scvg31ds.js";import{St}from"./vm-hands-entry-lite-88yjxxvf.js";import{a}from"./vm-hands-entry-lite-haws181e.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{C}from"./vm-hands-entry-lite-1kt82jes.js";import{spawn as R,spawnSync as st}from"child_process";import{createHash as it,randomUUID as ge}from"crypto";import{closeSync as at,copyFileSync as ae,existsSync as M,fstatSync as ct,mkdirSync as ce,openSync as lt,readdirSync as U,readFileSync as X,readlinkSync as ut,renameSync as he,rmSync as dt,statSync as mt,writeFileSync as ft}from"fs";import{connect as ht}from"net";import{tmpdir as L,userInfo as we}from"os";import{basename as le,delimiter as wt,dirname as B,join as f}from"path";var z=`import { spawn, execFileSync } from "node:child_process";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import { readFileSync, readlinkSync, lstatSync, realpathSync, statSync, mkdtempSync, mkdirSync, chmodSync, writeFileSync, readdirSync, rmSync, openSync, readSync, closeSync, renameSync } from "node:fs";
5
5
  import { tmpdir } from "node:os";
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Mn,$n,Ro,Wt}from"./vm-hands-entry-lite-sfmeafdm.js";import{Tn,Ve,go,On,In,Dn,Rr,x}from"./vm-hands-entry-lite-06mdg33e.js";import{Pt}from"./vm-hands-entry-lite-9x81cr3a.js";import{Nr}from"./vm-hands-entry-lite-5wsygx6n.js";import{j}from"./vm-hands-entry-lite-hc11hecd.js";import{a}from"./vm-hands-entry-lite-haws181e.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as oe,spawn as ae}from"child_process";import{randomBytes as ge}from"crypto";import{chmodSync as Me,existsSync as ce,lstatSync as Ce,mkdirSync as Ke,readFileSync as be,rmSync as xe,writeFileSync as T}from"fs";import{connect as Ie}from"net";import{join as P}from"path";var u=32,R=76;var W="./desktop-wallpaper-0pjhgyfk.jpg";var Y="./dock-browser-afp005mt.png";var v="./dock-files-rywdm96b.png";var Z="./dock-terminal-s41cj1jp.png";var H="./grok-wallpaper-71zwn2pj.jpg";var z="./grok-dock-browser-pzw59wnd.png";var V="./grok-dock-files-eckq444x.png";var ee="./grok-dock-terminal-hcpz3e43.png";var re=`# Sets the X root window background and _XROOTPMAP_ID, as feh --bg-fill does.
2
+ import{Mn,$n,Ro,Wt}from"./vm-hands-entry-lite-sfmeafdm.js";import{Tn,Ve,go,On,In,Dn,Rr,x}from"./vm-hands-entry-lite-60t7x9vw.js";import{Pt}from"./vm-hands-entry-lite-9x81cr3a.js";import{Nr}from"./vm-hands-entry-lite-5wsygx6n.js";import{j}from"./vm-hands-entry-lite-hc11hecd.js";import{a}from"./vm-hands-entry-lite-haws181e.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as oe,spawn as ae}from"child_process";import{randomBytes as ge}from"crypto";import{chmodSync as Me,existsSync as ce,lstatSync as Ce,mkdirSync as Ke,readFileSync as be,rmSync as xe,writeFileSync as T}from"fs";import{connect as Ie}from"net";import{join as P}from"path";var u=32,R=76;var W="./desktop-wallpaper-0pjhgyfk.jpg";var Y="./dock-browser-afp005mt.png";var v="./dock-files-rywdm96b.png";var Z="./dock-terminal-s41cj1jp.png";var H="./grok-wallpaper-71zwn2pj.jpg";var z="./grok-dock-browser-pzw59wnd.png";var V="./grok-dock-files-eckq444x.png";var ee="./grok-dock-terminal-hcpz3e43.png";var re=`# 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
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ot,I}from"./vm-hands-entry-lite-j1qppwnx.js";import{R}from"./vm-hands-entry-lite-a3p6xz53.js";import{_,rr}from"./vm-hands-entry-lite-t82dzcxb.js";import{be}from"./vm-hands-entry-lite-yretc2th.js";function Hi(e,i){let t=R(e,"REASON_API_URL")?.trim();if(!t)return rr(i);let n=new URL(t);if(n.protocol!=="https:"&&!(n.protocol==="http:"&&["127.0.0.1","localhost","::1"].includes(n.hostname)))throw Error("REASON_API_URL must use HTTPS (HTTP is allowed only for loopback development).");return n.origin}function es(e){return R(e,"REASON_API_URL")?.trim()?Hi(e,"production"):void 0}function ts(e){return R(e,"REASON_API_KEY")?.trim()||void 0}async function As(e,i){let t=e.env??process.env,n=ts(t);if(!n)return(e.getCredentials??ot)({apiOrigin:es(t),signal:i});let a=Hi(t,e.channel??_({env:t})),o=await(e.fetchImpl??fetch)(a+"/v3/self",{redirect:"error",headers:{authorization:"Bearer "+n,accept:"application/json"},signal:i}),p=await o.json().catch(()=>({})),r=be(p)?p:{};if(!o.ok){let s=typeof r.detail==="string"?r.detail:typeof r.message==="string"?r.message:"API key authentication failed ("+o.status+")";throw new I(o.status,typeof r.error==="string"?r.error:"api_key_auth_failed",s)}if(typeof r.org_id!=="string"||!r.org_id)throw Error("The API key in the environment did not resolve to a Workspace.");let l=Array.isArray(r.scopes)?r.scopes.filter((s)=>typeof s==="string"):[];return{credentialKind:"api_key",apiOrigin:a,accessToken:n,orgId:r.org_id,clientId:"api-key",refreshToken:"",expiresAt:"",scopes:l}}export{Hi,es,ts,As};
2
+ import{ot,I}from"./vm-hands-entry-lite-9knf91et.js";import{R}from"./vm-hands-entry-lite-a3p6xz53.js";import{_,rr}from"./vm-hands-entry-lite-t82dzcxb.js";import{be}from"./vm-hands-entry-lite-yretc2th.js";function Hi(e,i){let t=R(e,"REASON_API_URL")?.trim();if(!t)return rr(i);let n=new URL(t);if(n.protocol!=="https:"&&!(n.protocol==="http:"&&["127.0.0.1","localhost","::1"].includes(n.hostname)))throw Error("REASON_API_URL must use HTTPS (HTTP is allowed only for loopback development).");return n.origin}function es(e){return R(e,"REASON_API_URL")?.trim()?Hi(e,"production"):void 0}function ts(e){return R(e,"REASON_API_KEY")?.trim()||void 0}async function As(e,i){let t=e.env??process.env,n=ts(t);if(!n)return(e.getCredentials??ot)({apiOrigin:es(t),signal:i});let a=Hi(t,e.channel??_({env:t})),o=await(e.fetchImpl??fetch)(a+"/v3/self",{redirect:"error",headers:{authorization:"Bearer "+n,accept:"application/json"},signal:i}),p=await o.json().catch(()=>({})),r=be(p)?p:{};if(!o.ok){let s=typeof r.detail==="string"?r.detail:typeof r.message==="string"?r.message:"API key authentication failed ("+o.status+")";throw new I(o.status,typeof r.error==="string"?r.error:"api_key_auth_failed",s)}if(typeof r.org_id!=="string"||!r.org_id)throw Error("The API key in the environment did not resolve to a Workspace.");let l=Array.isArray(r.scopes)?r.scopes.filter((s)=>typeof s==="string"):[];return{credentialKind:"api_key",apiOrigin:a,accessToken:n,orgId:r.org_id,clientId:"api-key",refreshToken:"",expiresAt:"",scopes:l}}export{Hi,es,ts,As};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{S,Wt,Bn,Ge,Fn,jn}from"./vm-hands-entry-lite-sfmeafdm.js";import{Yn}from"./vm-hands-entry-lite-zrs8h4rf.js";import{Ln}from"./vm-hands-entry-lite-bvqwsd3b.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as ys,spawn as qe}from"child_process";import{existsSync as ws}from"fs";import{connect as xs}from"net";function pn(){let e=new Set,t=null,n=(s)=>({holder:t?.viewer??null,you:t===s,same_user:Boolean(t?.viewer&&s.viewer&&t.viewer.user_id===s.viewer.user_id)}),o=()=>{for(let s of e)s.notify(n(s))};return{join(s){return e.add(s),s.notify(n(s)),()=>{if(!e.delete(s))return;if(t!==s)return;t=null,o()}},claim(s){if(t===s||!e.has(s))return;t=s,o()}}}var ut=pn();import{createHash as St}from"crypto";import{once as Sn}from"events";import{createWriteStream as vn,existsSync as mr,mkdirSync as gr,mkdtempSync as hr,readFileSync as le,readdirSync as br,renameSync as yr,realpathSync as En,rmSync as Pn,statSync as Ne,writeFileSync as wr}from"fs";import{delimiter as _r,dirname as vt,join as b}from"path";import{finished as Cn}from"stream/promises";var We="omljlfpmafedpplnpkkahegadhkimdje",mo="https://chromewebstore.google.com/detail/reason/omljlfpmafedpplnpkkahegadhkimdje";var O={ocu:{repository:"https://github.com/iFurySt/open-codex-computer-use.git",revision:"386a260d1ab8b690adbbb27f7471595cf0c2b752",version:"0.3.5"},obu:{repository:"https://github.com/iFurySt/open-browser-use.git",revision:"ac015846df75928fbcf0f3a0f3ba3a210ce1a507",version:"0.1.42"}},H={version:"155.0.8059.84",macArm64Sha256:"13b9e98ce56f5ce18e100a009f455c9285f399e7c9dc8a76fdf2f3a9755bb5f2",linux64Sha256:"cf0f049892dea22e6a6db26d47ed0d7776b7158edcbec4634086633df8bafcbc",win64Sha256:"507f2a031441d10c62b5e3d4e863f09ac1198a571c1419976cbd8387f639afde"};var J={ocu:{url:`https://registry.npmjs.org/open-computer-use/-/open-computer-use-${O.ocu.version}.tgz`,sha256:"7c16a87c8cd357787b02c0ebd040dd5f93880c1fb51c1901caa2e0c05d063130",size_bytes:5844280},obu:{url:`https://registry.npmjs.org/open-browser-use/-/open-browser-use-${O.obu.version}.tgz`,sha256:"9386d8ce0a147b3f55e1807b68edf736836378807541c457c9b5f6ca2cabaa4e",size_bytes:21372018},extension:{url:`https://github.com/iFurySt/open-browser-use/releases/download/v${O.obu.version}/open-browser-use-chrome-extension-${O.obu.version}.zip`,sha256:"c9c07bec1175e12ea6985b0e7784a5ef01fd03f014b958224a1e17dcd838a241",size_bytes:31070}},F="pnbmoicbkopffjjgfgfglopechaiemkp";import{spawn as Me}from"child_process";import{createRequire as fn}from"module";import{join as mn}from"path";var gn=30000,hn=1048576;function Te(){return process.env.SystemRoot??"C:\\Windows"}function bn(){return mn(Te(),"System32","WindowsPowerShell","v1.0","powershell.exe")}var yn=String.raw`
2
+ import{S,Wt,Bn,Ge,Fn,jn}from"./vm-hands-entry-lite-sfmeafdm.js";import{Yn}from"./vm-hands-entry-lite-vf02kfyy.js";import{Ln}from"./vm-hands-entry-lite-bvqwsd3b.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as ys,spawn as qe}from"child_process";import{existsSync as ws}from"fs";import{connect as xs}from"net";function pn(){let e=new Set,t=null,n=(s)=>({holder:t?.viewer??null,you:t===s,same_user:Boolean(t?.viewer&&s.viewer&&t.viewer.user_id===s.viewer.user_id)}),o=()=>{for(let s of e)s.notify(n(s))};return{join(s){return e.add(s),s.notify(n(s)),()=>{if(!e.delete(s))return;if(t!==s)return;t=null,o()}},claim(s){if(t===s||!e.has(s))return;t=s,o()}}}var ut=pn();import{createHash as St}from"crypto";import{once as Sn}from"events";import{createWriteStream as vn,existsSync as mr,mkdirSync as gr,mkdtempSync as hr,readFileSync as le,readdirSync as br,renameSync as yr,realpathSync as En,rmSync as Pn,statSync as Ne,writeFileSync as wr}from"fs";import{delimiter as _r,dirname as vt,join as b}from"path";import{finished as Cn}from"stream/promises";var We="omljlfpmafedpplnpkkahegadhkimdje",mo="https://chromewebstore.google.com/detail/reason/omljlfpmafedpplnpkkahegadhkimdje";var O={ocu:{repository:"https://github.com/iFurySt/open-codex-computer-use.git",revision:"386a260d1ab8b690adbbb27f7471595cf0c2b752",version:"0.3.5"},obu:{repository:"https://github.com/iFurySt/open-browser-use.git",revision:"ac015846df75928fbcf0f3a0f3ba3a210ce1a507",version:"0.1.42"}},H={version:"155.0.8059.84",macArm64Sha256:"13b9e98ce56f5ce18e100a009f455c9285f399e7c9dc8a76fdf2f3a9755bb5f2",linux64Sha256:"cf0f049892dea22e6a6db26d47ed0d7776b7158edcbec4634086633df8bafcbc",win64Sha256:"507f2a031441d10c62b5e3d4e863f09ac1198a571c1419976cbd8387f639afde"};var J={ocu:{url:`https://registry.npmjs.org/open-computer-use/-/open-computer-use-${O.ocu.version}.tgz`,sha256:"7c16a87c8cd357787b02c0ebd040dd5f93880c1fb51c1901caa2e0c05d063130",size_bytes:5844280},obu:{url:`https://registry.npmjs.org/open-browser-use/-/open-browser-use-${O.obu.version}.tgz`,sha256:"9386d8ce0a147b3f55e1807b68edf736836378807541c457c9b5f6ca2cabaa4e",size_bytes:21372018},extension:{url:`https://github.com/iFurySt/open-browser-use/releases/download/v${O.obu.version}/open-browser-use-chrome-extension-${O.obu.version}.zip`,sha256:"c9c07bec1175e12ea6985b0e7784a5ef01fd03f014b958224a1e17dcd838a241",size_bytes:31070}},F="pnbmoicbkopffjjgfgfglopechaiemkp";import{spawn as Me}from"child_process";import{createRequire as fn}from"module";import{join as mn}from"path";var gn=30000,hn=1048576;function Te(){return process.env.SystemRoot??"C:\\Windows"}function bn(){return mn(Te(),"System32","WindowsPowerShell","v1.0","powershell.exe")}var yn=String.raw`
3
3
  $ErrorActionPreference = "Stop"
4
4
  Add-Type -TypeDefinition @"
5
5
  using System;
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ge,pt}from"./vm-hands-entry-lite-sfmeafdm.js";import{Qe}from"./vm-hands-entry-lite-ghva8qrf.js";import{Lo,le,Kr,gt,Mo}from"./vm-hands-entry-lite-zrs8h4rf.js";import{E}from"./vm-hands-entry-lite-70hq7mrs.js";import{a,nr}from"./vm-hands-entry-lite-haws181e.js";import{spawnSync as H}from"child_process";import{dirname as w}from"path";import{spawn as A}from"child_process";import{accessSync as _,constants as v}from"fs";import{basename as C,join as O}from"path";var l=null;function S(e){if(l===e)l=null;if(e.exitCode===null&&e.signalCode===null)e.kill("SIGTERM")}var Or=(e,t)=>{if(l)S(l);let s=O(e,Lo);try{_(s,v.X_OK)}catch{return()=>{}}let n;try{n=A(s,["--app",e,"--name",C(e,".app"),"--permission",t==="screen"?"screen_recording":"accessibility"],{detached:!0,stdio:"ignore"})}catch{return()=>{}}return n.on("error",()=>{if(l===n)l=null}),n.once("exit",()=>{if(l===n)l=null}),n.unref(),l=n,()=>S(n)};import{chmodSync as ne,existsSync as se,mkdirSync as re,readFileSync as D,realpathSync as ie,renameSync as oe,statSync as j,writeFileSync as ae}from"fs";import{dirname as de,isAbsolute as G,join as N,resolve as T,sep as b}from"path";function F(e=a()){return N(nr(e),"reason","protected-path-grants.json")}var f=null;function L(e){let t=JSON.parse(e);if(!Array.isArray(t?.grants))return[];return t.grants.flatMap((s)=>{let n=s;return n&&typeof n.path==="string"&&G(n.path)&&(n.kind==="file"||n.kind==="folder")&&typeof n.grantedAt==="number"?[{path:n.path,kind:n.kind,grantedAt:n.grantedAt}]:[]})}function y(e=F()){try{let{mtimeMs:t}=j(e);if(f&&f.file===e&&f.mtimeMs===t)return f.grants;let s=L(D(e,"utf8"));return f={file:e,mtimeMs:t,grants:s},s}catch{return[]}}function W(e,t){return e.kind==="file"?t===e.path:t===e.path||t.startsWith(`${e.path}${b}`)}function U(e,t){let s=T(e);return y(t).some((n)=>W(n,s))}function yo(e,t){return E(e)&&!U(e,t)}function wo(e,t,s){let n=t?"file-read* file-write*":"file-read*";return y(s).filter((r)=>r.path===e||r.path.startsWith(`${e}${b}`)).map((r)=>`(allow ${n} (${r.kind==="file"?"literal":"subpath"} ${JSON.stringify(r.path)}))`)}var P="x-apple.systempreferences:com.apple.preference.security",J="curl -fsSL https://reasonmachines.com/install.sh | bash",q=180000,B=2000;var k={screen:{label:"Screen & System Audio Recording",purpose:"desktop video, computer-use screenshots",level:"required",pane:`${P}?Privacy_ScreenCapture`},accessibility:{label:"Accessibility",purpose:"computer-use clicks and typing, desktop input",level:"required",pane:`${P}?Privacy_Accessibility`},disk:{label:"Full Disk Access",purpose:"Sessions in Desktop, Documents, Downloads, iCloud Drive and Mail",level:"recommended",pane:`${P}?Privacy_AllFiles`}};function R(e){return e.executable}function K(e,t){if(e==="computer_use_identity_missing")return`Reason's background identity is not installed (${e}); reinstall Reason: ${J}`;if(e==="computer_use_identity_outdated")return`Reason's background identity is outdated (${Kr(t)??"unknown"}; this CLI is ${Qe}) (${e}); \`reason update\` installs this release's`;return`Reason's background identity cannot run computer use for this CLI (${e}); run the installed \`reason\``}function ls(e=a()){let t=gt(e);if(t.length>0)return{state:"ready",path:w(w(w(t[0]))),prefix:t};let s=Mo(t,e)??"computer_use_identity_unavailable";return{state:s,path:le(e),detail:K(s,e)}}function V(){return{identity:()=>ls(),grants:(e)=>Ge(e),request:(e,t)=>pt(e,t),worker:async()=>(await import("./status-h7fq0xa9.js")).connectionMacState(),open:(e)=>{H("/usr/bin/open",e,{stdio:"ignore",timeout:1e4})},tile:Or,restartConnection:async()=>(await import("./connect-cli-yzezydnr.js")).restartConnection(),sleep:(e)=>new Promise((t)=>setTimeout(t,e)),now:()=>Date.now()}}function M(e,t,s){if(e.state!=="ready"||!t)return"unknown";return t[s]?"granted":"missing"}async function us(e){let t=e.identity(),s=t.state==="ready"?await e.grants(t.prefix):null,n=await e.worker(),r=n?R(n):null,i=!r||n?.full_disk_access==="unknown"?"unknown":n?.full_disk_access==="granted"?"granted":"missing",c=(u,d,o)=>{let{label:p,purpose:h,level:m}=k[u];return{id:u,label:p,purpose:h,level:m,state:d,holder:o}};return{identity:{state:t.state,path:t.path,detail:t.state==="ready"?null:t.detail},worker_detail:r?null:"Full Disk Access is read from this computer's running worker; `reason connect` starts it.",permissions:[c("screen",M(t,s,"screen"),t.path),c("accessibility",M(t,s,"accessibility"),t.path),c("disk",i,r)]}}function Ks(e){let t=e.identity.state==="ready"?null:e.identity.state,s=e.permissions.filter((i)=>i.state==="granted").length,n=[...t?[t]:[],...e.permissions.filter((i)=>i.state!=="granted"&&!(t&&i.id!=="disk")).map((i)=>`${i.label} ${i.state}`)],r=!t&&e.permissions.some((i)=>i.state==="missing");return`Permissions: ${s} of ${e.permissions.length}${n.length>0?` (${n.join(", ")})`:""}`+(r?" \u2014 reason permissions allow":n.length>0?" \u2014 reason permissions":"")}async function x(e,t){let s=t.now()+q;for(;;){if(await e())return!0;if(t.now()>=s)return!1;await t.sleep(B)}}async function Js(e,t){let s=t.host??V(),{io:n}=t,r=await us(s),i=r.permissions.filter((o)=>e.includes(o.id)&&o.state!=="granted");if(i.length===0)return n.stdout.write(`Reason permissions: ${e.map((o)=>k[o].label).join(", ")} already allowed.
2
+ import{Ge,pt}from"./vm-hands-entry-lite-sfmeafdm.js";import{Qe}from"./vm-hands-entry-lite-9y3dvyfj.js";import{Lo,le,Kr,gt,Mo}from"./vm-hands-entry-lite-vf02kfyy.js";import{E}from"./vm-hands-entry-lite-70hq7mrs.js";import{a,nr}from"./vm-hands-entry-lite-haws181e.js";import{spawnSync as H}from"child_process";import{dirname as w}from"path";import{spawn as A}from"child_process";import{accessSync as _,constants as v}from"fs";import{basename as C,join as O}from"path";var l=null;function S(e){if(l===e)l=null;if(e.exitCode===null&&e.signalCode===null)e.kill("SIGTERM")}var Or=(e,t)=>{if(l)S(l);let s=O(e,Lo);try{_(s,v.X_OK)}catch{return()=>{}}let n;try{n=A(s,["--app",e,"--name",C(e,".app"),"--permission",t==="screen"?"screen_recording":"accessibility"],{detached:!0,stdio:"ignore"})}catch{return()=>{}}return n.on("error",()=>{if(l===n)l=null}),n.once("exit",()=>{if(l===n)l=null}),n.unref(),l=n,()=>S(n)};import{chmodSync as ne,existsSync as se,mkdirSync as re,readFileSync as D,realpathSync as ie,renameSync as oe,statSync as j,writeFileSync as ae}from"fs";import{dirname as de,isAbsolute as G,join as N,resolve as T,sep as b}from"path";function F(e=a()){return N(nr(e),"reason","protected-path-grants.json")}var f=null;function L(e){let t=JSON.parse(e);if(!Array.isArray(t?.grants))return[];return t.grants.flatMap((s)=>{let n=s;return n&&typeof n.path==="string"&&G(n.path)&&(n.kind==="file"||n.kind==="folder")&&typeof n.grantedAt==="number"?[{path:n.path,kind:n.kind,grantedAt:n.grantedAt}]:[]})}function y(e=F()){try{let{mtimeMs:t}=j(e);if(f&&f.file===e&&f.mtimeMs===t)return f.grants;let s=L(D(e,"utf8"));return f={file:e,mtimeMs:t,grants:s},s}catch{return[]}}function W(e,t){return e.kind==="file"?t===e.path:t===e.path||t.startsWith(`${e.path}${b}`)}function U(e,t){let s=T(e);return y(t).some((n)=>W(n,s))}function yo(e,t){return E(e)&&!U(e,t)}function wo(e,t,s){let n=t?"file-read* file-write*":"file-read*";return y(s).filter((r)=>r.path===e||r.path.startsWith(`${e}${b}`)).map((r)=>`(allow ${n} (${r.kind==="file"?"literal":"subpath"} ${JSON.stringify(r.path)}))`)}var P="x-apple.systempreferences:com.apple.preference.security",J="curl -fsSL https://reasonmachines.com/install.sh | bash",q=180000,B=2000;var k={screen:{label:"Screen & System Audio Recording",purpose:"desktop video, computer-use screenshots",level:"required",pane:`${P}?Privacy_ScreenCapture`},accessibility:{label:"Accessibility",purpose:"computer-use clicks and typing, desktop input",level:"required",pane:`${P}?Privacy_Accessibility`},disk:{label:"Full Disk Access",purpose:"Sessions in Desktop, Documents, Downloads, iCloud Drive and Mail",level:"recommended",pane:`${P}?Privacy_AllFiles`}};function R(e){return e.executable}function K(e,t){if(e==="computer_use_identity_missing")return`Reason's background identity is not installed (${e}); reinstall Reason: ${J}`;if(e==="computer_use_identity_outdated")return`Reason's background identity is outdated (${Kr(t)??"unknown"}; this CLI is ${Qe}) (${e}); \`reason update\` installs this release's`;return`Reason's background identity cannot run computer use for this CLI (${e}); run the installed \`reason\``}function ls(e=a()){let t=gt(e);if(t.length>0)return{state:"ready",path:w(w(w(t[0]))),prefix:t};let s=Mo(t,e)??"computer_use_identity_unavailable";return{state:s,path:le(e),detail:K(s,e)}}function V(){return{identity:()=>ls(),grants:(e)=>Ge(e),request:(e,t)=>pt(e,t),worker:async()=>(await import("./status-nvm1fe9h.js")).connectionMacState(),open:(e)=>{H("/usr/bin/open",e,{stdio:"ignore",timeout:1e4})},tile:Or,restartConnection:async()=>(await import("./connect-cli-4t15y12x.js")).restartConnection(),sleep:(e)=>new Promise((t)=>setTimeout(t,e)),now:()=>Date.now()}}function M(e,t,s){if(e.state!=="ready"||!t)return"unknown";return t[s]?"granted":"missing"}async function us(e){let t=e.identity(),s=t.state==="ready"?await e.grants(t.prefix):null,n=await e.worker(),r=n?R(n):null,i=!r||n?.full_disk_access==="unknown"?"unknown":n?.full_disk_access==="granted"?"granted":"missing",c=(u,d,o)=>{let{label:p,purpose:h,level:m}=k[u];return{id:u,label:p,purpose:h,level:m,state:d,holder:o}};return{identity:{state:t.state,path:t.path,detail:t.state==="ready"?null:t.detail},worker_detail:r?null:"Full Disk Access is read from this computer's running worker; `reason connect` starts it.",permissions:[c("screen",M(t,s,"screen"),t.path),c("accessibility",M(t,s,"accessibility"),t.path),c("disk",i,r)]}}function Ks(e){let t=e.identity.state==="ready"?null:e.identity.state,s=e.permissions.filter((i)=>i.state==="granted").length,n=[...t?[t]:[],...e.permissions.filter((i)=>i.state!=="granted"&&!(t&&i.id!=="disk")).map((i)=>`${i.label} ${i.state}`)],r=!t&&e.permissions.some((i)=>i.state==="missing");return`Permissions: ${s} of ${e.permissions.length}${n.length>0?` (${n.join(", ")})`:""}`+(r?" \u2014 reason permissions allow":n.length>0?" \u2014 reason permissions":"")}async function x(e,t){let s=t.now()+q;for(;;){if(await e())return!0;if(t.now()>=s)return!1;await t.sleep(B)}}async function Js(e,t){let s=t.host??V(),{io:n}=t,r=await us(s),i=r.permissions.filter((o)=>e.includes(o.id)&&o.state!=="granted");if(i.length===0)return n.stdout.write(`Reason permissions: ${e.map((o)=>k[o].label).join(", ")} already allowed.
3
3
  `),0;let c=!1,u=!1,d=s.identity();for(let o of i){let{label:p,pane:h}=k[o.id];if(o.id!=="disk"){if(d.state!=="ready"){if(!c)n.stderr.write(`Reason permissions: ${d.detail}
4
4
  `);c=!0;continue}let g=o.id;await s.request(d.prefix,g),s.open([h]);let I=s.tile(d.path,g);if(n.stdout.write(`Allow Reason in System Settings > Privacy & Security > ${p}.
5
5
  `),!t.wait)continue;if(n.stdout.write(`Waiting for it (Ctrl-C to stop)\u2026