@reason-machines/cli-linux-x64 0.2.561 → 0.2.563

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 (129) hide show
  1. package/bin/reason +2 -2
  2. package/bin/vm-hands/agent-network-3stvmqsj.js +2 -0
  3. package/bin/vm-hands/api-9xm5e4g9.js +2 -0
  4. package/bin/vm-hands/api-credentials-3wwkpts2.js +2 -0
  5. package/bin/vm-hands/{ask-relay-xx0rzpch.js → ask-relay-5f92e4c5.js} +2 -2
  6. package/bin/vm-hands/connect-cli-d3dp0r1t.js +2 -0
  7. package/bin/vm-hands/credentials-sk4sag42.js +2 -0
  8. package/bin/vm-hands/custom-endpoint-device-3jscber1.js +2 -0
  9. package/bin/vm-hands/desktop-account-xma0330a.js +2 -0
  10. package/bin/vm-hands/desktop-components-p0zx6qxg.js +2 -0
  11. package/bin/vm-hands/desktop-delegate-tch2qzx0.js +2 -0
  12. package/bin/vm-hands/device-workspace-4bj43nxq.js +2 -0
  13. package/bin/vm-hands/{fsevents-vxv56sp5.js → fsevents-ezcg3e40.js} +1 -1
  14. package/bin/vm-hands/hands-worker-source-8pe7yv0m.js +2 -0
  15. package/bin/vm-hands/{index-03p9c17x.js → index-w92ys6ra.js} +16 -16
  16. package/bin/vm-hands/install-receipt-68xxg7hn.js +2 -0
  17. package/bin/vm-hands/local-automation-0a7enct8.js +2 -0
  18. package/bin/vm-hands/local-capabilities-d3ycjdyg.js +2 -0
  19. package/bin/vm-hands/local-desktop-users-jpf0resr.js +2 -0
  20. package/bin/vm-hands/local-display-mac-h5yz0ydd.js +2 -0
  21. package/bin/vm-hands/local-display-session-pc85z6mg.js +2 -0
  22. package/bin/vm-hands/local-display-video-40avbg94.js +2 -0
  23. package/bin/vm-hands/local-managed-process-ka331rcr.js +2 -0
  24. package/bin/vm-hands/local-pty-session-tqn2xmph.js +2 -0
  25. package/bin/vm-hands/managed-runtime-nwj7cn7c.js +2 -0
  26. package/bin/vm-hands/network-auto-update-tk104maa.js +3 -0
  27. package/bin/vm-hands/network-contract-nkwcf4r9.js +2 -0
  28. package/bin/vm-hands/{network-sign-in-61gmpmaa.js → network-sign-in-t9ng36rs.js} +2 -2
  29. package/bin/vm-hands/package-9w0mmxb5.js +2 -0
  30. package/bin/vm-hands/permissions-ywh8x4dq.js +2 -0
  31. package/bin/vm-hands/reason-hands-protocol-pck5har9.js +2 -0
  32. package/bin/vm-hands/serve-service-43kmwskj.js +2 -0
  33. package/bin/vm-hands/{status-khqk4cjw.js → status-ec366bs8.js} +7 -7
  34. package/bin/vm-hands/version-6ys9zwbj.js +2 -0
  35. package/bin/vm-hands/{vm-hands-entry-lite-ht6hzkgj.js → vm-hands-entry-lite-0jy8mv4a.js} +2 -2
  36. package/bin/vm-hands/{vm-hands-entry-lite-zawytz09.js → vm-hands-entry-lite-12ck5swp.js} +2 -2
  37. package/bin/vm-hands/{vm-hands-entry-lite-j10cw3d9.js → vm-hands-entry-lite-13nx02p7.js} +7 -7
  38. package/bin/vm-hands/{vm-hands-entry-lite-vdv4nm5f.js → vm-hands-entry-lite-1b21avcs.js} +2 -2
  39. package/bin/vm-hands/{vm-hands-entry-lite-bj3w2ven.js → vm-hands-entry-lite-1w39j6vz.js} +2 -2
  40. package/bin/vm-hands/{vm-hands-entry-lite-gxpw14jv.js → vm-hands-entry-lite-1wxwsb3f.js} +7 -7
  41. package/bin/vm-hands/{vm-hands-entry-lite-ms99mzp0.js → vm-hands-entry-lite-284z7ct8.js} +3 -3
  42. package/bin/vm-hands/{vm-hands-entry-lite-a7bf7xr7.js → vm-hands-entry-lite-2qfmabqn.js} +3 -3
  43. package/bin/vm-hands/{vm-hands-entry-lite-q9s1e2y1.js → vm-hands-entry-lite-33at6g06.js} +2 -2
  44. package/bin/vm-hands/{vm-hands-entry-lite-e3fn8ys2.js → vm-hands-entry-lite-3gc2bn5a.js} +2 -2
  45. package/bin/vm-hands/{vm-hands-entry-lite-hxfxs7r9.js → vm-hands-entry-lite-3q2ng4e9.js} +2 -2
  46. package/bin/vm-hands/vm-hands-entry-lite-41nn0vbf.js +150 -0
  47. package/bin/vm-hands/{vm-hands-entry-lite-5y4phfv1.js → vm-hands-entry-lite-43bv9hf0.js} +3 -3
  48. package/bin/vm-hands/{vm-hands-entry-lite-vkhacd00.js → vm-hands-entry-lite-61p78r72.js} +19 -19
  49. package/bin/vm-hands/{vm-hands-entry-lite-hs6sdn60.js → vm-hands-entry-lite-88dxn9b5.js} +2 -2
  50. package/bin/vm-hands/vm-hands-entry-lite-997y1m1r.js +3 -0
  51. package/bin/vm-hands/{vm-hands-entry-lite-zh6ncdjn.js → vm-hands-entry-lite-a3gq377t.js} +2 -2
  52. package/bin/vm-hands/{vm-hands-entry-lite-0wb1n769.js → vm-hands-entry-lite-b1vanmtv.js} +5 -5
  53. package/bin/vm-hands/{vm-hands-entry-lite-q9djb28r.js → vm-hands-entry-lite-cc8hwgxc.js} +3 -3
  54. package/bin/vm-hands/vm-hands-entry-lite-chq0qx9f.js +12 -0
  55. package/bin/vm-hands/{vm-hands-entry-lite-84mc1f7h.js → vm-hands-entry-lite-cmmb9k3g.js} +2 -2
  56. package/bin/vm-hands/{vm-hands-entry-lite-jgk5z8zc.js → vm-hands-entry-lite-d12hx1dk.js} +6 -6
  57. package/bin/vm-hands/{vm-hands-entry-lite-7pfhwxn5.js → vm-hands-entry-lite-d431ffz0.js} +1 -1
  58. package/bin/vm-hands/{vm-hands-entry-lite-ptycjmkc.js → vm-hands-entry-lite-fccn6s4j.js} +2 -2
  59. package/bin/vm-hands/{vm-hands-entry-lite-qf990rxw.js → vm-hands-entry-lite-fn2805g8.js} +2 -2
  60. package/bin/vm-hands/{vm-hands-entry-lite-y3nz20wb.js → vm-hands-entry-lite-frg1b1rg.js} +105 -105
  61. package/bin/vm-hands/{vm-hands-entry-lite-71ebge0c.js → vm-hands-entry-lite-fxptf351.js} +5 -5
  62. package/bin/vm-hands/{vm-hands-entry-lite-57ajjwmh.js → vm-hands-entry-lite-gxf2r5en.js} +1 -1
  63. package/bin/vm-hands/{vm-hands-entry-lite-h7nk2848.js → vm-hands-entry-lite-j8s2vqpf.js} +42 -42
  64. package/bin/vm-hands/{vm-hands-entry-lite-2dak7e1h.js → vm-hands-entry-lite-jgwjt10t.js} +3 -5
  65. package/bin/vm-hands/{vm-hands-entry-lite-hjjbjpd7.js → vm-hands-entry-lite-jj7873n8.js} +3 -3
  66. package/bin/vm-hands/{vm-hands-entry-lite-xvccy3z4.js → vm-hands-entry-lite-k4d5rhpw.js} +2 -2
  67. package/bin/vm-hands/{vm-hands-entry-lite-9g52kxyj.js → vm-hands-entry-lite-kbnxk71q.js} +2 -2
  68. package/bin/vm-hands/{vm-hands-entry-lite-m1we91g4.js → vm-hands-entry-lite-mn8rjpxq.js} +10 -10
  69. package/bin/vm-hands/{vm-hands-entry-lite-52qz0n30.js → vm-hands-entry-lite-ngry8nkq.js} +4 -4
  70. package/bin/vm-hands/vm-hands-entry-lite-pe374cn6.js +81 -0
  71. package/bin/vm-hands/{vm-hands-entry-lite-8xv6c0rm.js → vm-hands-entry-lite-pg7nnyc6.js} +2 -2
  72. package/bin/vm-hands/{vm-hands-entry-lite-tcmye5ny.js → vm-hands-entry-lite-q62g6sx0.js} +2 -2
  73. package/bin/vm-hands/{vm-hands-entry-lite-v4hr9x9h.js → vm-hands-entry-lite-qjrgvdbj.js} +34 -34
  74. package/bin/vm-hands/{vm-hands-entry-lite-krpqqx12.js → vm-hands-entry-lite-rxydyqke.js} +2 -2
  75. package/bin/vm-hands/{vm-hands-entry-lite-weqam12f.js → vm-hands-entry-lite-s93f3pbv.js} +3 -3
  76. package/bin/vm-hands/{vm-hands-entry-lite-z0ht62s4.js → vm-hands-entry-lite-sh4mqy93.js} +3 -3
  77. package/bin/vm-hands/vm-hands-entry-lite-srtqjjqb.js +48 -0
  78. package/bin/vm-hands/{vm-hands-entry-lite-6jxshhps.js → vm-hands-entry-lite-thstg177.js} +6 -6
  79. package/bin/vm-hands/vm-hands-entry-lite-vbqfmsd3.js +4 -0
  80. package/bin/vm-hands/vm-hands-entry-lite-wnqqjsew.js +3 -0
  81. package/bin/vm-hands/{vm-hands-entry-lite-pxtycfdv.js → vm-hands-entry-lite-xfak34av.js} +4 -4
  82. package/bin/vm-hands/{vm-hands-entry-lite-sy7dcccg.js → vm-hands-entry-lite-y0jtj8zz.js} +1 -1
  83. package/bin/vm-hands/{vm-hands-entry-lite-yvws5zpx.js → vm-hands-entry-lite-yg4dk99m.js} +1 -1
  84. package/bin/vm-hands/{vm-hands-entry-lite-2rgf8866.js → vm-hands-entry-lite-z65xva21.js} +2 -2
  85. package/bin/vm-hands/{vm-hands-entry-lite-wcgm41jq.js → vm-hands-entry-lite-zj9esd2g.js} +7 -7
  86. package/bin/vm-hands/{vm-hands-entry-lite-jpvmkce5.js → vm-hands-entry-lite-zp7chzcc.js} +1 -1
  87. package/bin/vm-hands/{vm-hands-entry-lite-k5ytpgzz.js → vm-hands-entry-lite-zpvr7wc6.js} +19 -19
  88. package/bin/vm-hands/vm-hands-entry-lite.js +2 -2
  89. package/bin/vm-hands/vm-hands-executor-2ngwj96m.js +12 -0
  90. package/bin/vm-hands/vm-hands-op-runner-te2ze1e7.js +2 -0
  91. package/bin/vm-hands/{vm-hands-runtime-1qxf96z7.js → vm-hands-runtime-09ehkm3c.js} +3 -3
  92. package/bin/vm-hands/worker-preview-readiness-h96yr4wf.js +2 -0
  93. package/bin/vm-hands/worker-sandbox-6kkhvryn.js +2 -0
  94. package/package.json +1 -1
  95. package/bin/vm-hands/agent-network-kk36zca7.js +0 -2
  96. package/bin/vm-hands/api-credentials-mtfdk175.js +0 -2
  97. package/bin/vm-hands/api-w6w7vfp3.js +0 -2
  98. package/bin/vm-hands/connect-cli-dmwph620.js +0 -2
  99. package/bin/vm-hands/credentials-s7ps7y6s.js +0 -2
  100. package/bin/vm-hands/custom-endpoint-device-3xnrp33e.js +0 -2
  101. package/bin/vm-hands/desktop-account-eg8thn79.js +0 -2
  102. package/bin/vm-hands/device-workspace-h5rsecq8.js +0 -2
  103. package/bin/vm-hands/hands-worker-source-vk664w8p.js +0 -2
  104. package/bin/vm-hands/install-receipt-j04hdw1k.js +0 -2
  105. package/bin/vm-hands/local-automation-vvt9d9xb.js +0 -2
  106. package/bin/vm-hands/local-capabilities-pwv76ns5.js +0 -2
  107. package/bin/vm-hands/local-desktop-users-sq4trh07.js +0 -2
  108. package/bin/vm-hands/local-display-mac-yxcxvg2z.js +0 -2
  109. package/bin/vm-hands/local-display-session-axh9mfdk.js +0 -2
  110. package/bin/vm-hands/local-display-video-pxhztqk7.js +0 -2
  111. package/bin/vm-hands/local-managed-process-4mgqn7tg.js +0 -2
  112. package/bin/vm-hands/local-pty-session-edd8ttf9.js +0 -2
  113. package/bin/vm-hands/managed-runtime-pcagtyfz.js +0 -2
  114. package/bin/vm-hands/network-auto-update-wkzb91qz.js +0 -3
  115. package/bin/vm-hands/network-contract-8mxtma3w.js +0 -2
  116. package/bin/vm-hands/package-vwvzjtn0.js +0 -2
  117. package/bin/vm-hands/permissions-348prrcx.js +0 -2
  118. package/bin/vm-hands/reason-hands-protocol-1nkpw1v3.js +0 -2
  119. package/bin/vm-hands/serve-service-3dkyznay.js +0 -2
  120. package/bin/vm-hands/version-c1hen0wn.js +0 -2
  121. package/bin/vm-hands/vm-hands-entry-lite-9yfmkd1f.js +0 -3
  122. package/bin/vm-hands/vm-hands-entry-lite-ab1pq3xg.js +0 -3
  123. package/bin/vm-hands/vm-hands-entry-lite-hn9pq7zj.js +0 -127
  124. package/bin/vm-hands/vm-hands-entry-lite-nn6zcvmp.js +0 -3
  125. package/bin/vm-hands/vm-hands-entry-lite-z213y4pj.js +0 -150
  126. package/bin/vm-hands/vm-hands-executor-csdtg7kj.js +0 -12
  127. package/bin/vm-hands/vm-hands-op-runner-z7tsd84c.js +0 -2
  128. package/bin/vm-hands/worker-preview-readiness-06tygyjs.js +0 -2
  129. package/bin/vm-hands/worker-sandbox-e1cpkzfz.js +0 -2
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ol,ot,vc,Pl,as,$i,We}from"./vm-hands-entry-lite-y0jtj8zz.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";export{ol as FUTURE_DEVICE_CONSENT_SCOPE,Pl as INSTALLER_WORKER_EXECUTABLES,ot as installationReceiptPath,vc as installerLauncherNames,$i as installerReasonAlias,as as installerReceiptLauncher,We as loadInstallationReceipt};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{hr,Oo,No,Lo,Cl,$o}from"./vm-hands-entry-lite-jgwjt10t.js";import"./vm-hands-entry-lite-41nn0vbf.js";import"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-srtqjjqb.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-pe374cn6.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-mn8rjpxq.js";import"./vm-hands-entry-lite-y0jtj8zz.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-zj9esd2g.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-thstg177.js";import"./vm-hands-entry-lite-1w39j6vz.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{No as ensureLocalBrowser,hr as localAutomationAvailable,Lo as localBrowserProfile,Oo as localUserChromeHost,Cl as runAutomationCallLocally,$o as runLocalAutomation};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Qr,en,ho,Gn,tl,rl,Kn,fo,mo,go,Jn}from"./vm-hands-entry-lite-j8s2vqpf.js";import"./vm-hands-entry-lite-ngry8nkq.js";import"./vm-hands-entry-lite-43bv9hf0.js";import"./vm-hands-entry-lite-61p78r72.js";import"./vm-hands-entry-lite-qjrgvdbj.js";import"./vm-hands-entry-lite-b1vanmtv.js";import"./vm-hands-entry-lite-s93f3pbv.js";import"./vm-hands-entry-lite-yg4dk99m.js";import"./vm-hands-entry-lite-jgwjt10t.js";import"./vm-hands-entry-lite-41nn0vbf.js";import"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-srtqjjqb.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-pe374cn6.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-mn8rjpxq.js";import"./vm-hands-entry-lite-y0jtj8zz.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-zj9esd2g.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-thstg177.js";import"./vm-hands-entry-lite-1w39j6vz.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";export{r as LocalCapabilityError,Qr as SHORT_REQUEST_CAPABILITIES,fo as capabilityInventoryForRoots,en as confinedExecutionShell,Gn as defaultLocalCommandRunner,mo as deliverLocalHandsEnvironment,Kn as enrolledRootPaths,Jn as executeLocalOperation,go as rebindLocalHandsControl,tl as runFileCapability,rl as runTransferCapability,ho as spawnCaptured};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{qr,Dl,ya,wa,ba}from"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{Dl as forgetLocalDesktopUse,ba as holdLocalDesktop,qr as noteLocalDesktopUse,ya as releaseLocalDesktop,wa as trackDesktopRun};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pr,Rr,ps,hs}from"./vm-hands-entry-lite-13nx02p7.js";export{Pr as macScreenStatus,hs as openMacInput,ps as openMacWindowBounds,Rr as requestMacScreenAccess};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{un,Mo,Te,jt,dn}from"./vm-hands-entry-lite-41nn0vbf.js";import"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-srtqjjqb.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-pe374cn6.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-zj9esd2g.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-thstg177.js";import"./vm-hands-entry-lite-1w39j6vz.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{jt as ensureLinuxDesktop,un as localDisplayAvailable,Mo as localDisplayReady,Te as privateDirectory,dn as runLocalDisplayStream};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Go,Ko,Jo,Xo,Jt}from"./vm-hands-entry-lite-srtqjjqb.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-pe374cn6.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-zj9esd2g.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-thstg177.js";import"./vm-hands-entry-lite-1w39j6vz.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";export{Go as MAC_SCREEN,Ko as WINDOWS_SCREEN,Jo as createDisplayVideoLane,Jt as localDisplayVideoAvailable,Xo as simulatorVideoFfmpeg};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{lr,Qn,wo,ei}from"./vm-hands-entry-lite-43bv9hf0.js";import"./vm-hands-entry-lite-61p78r72.js";import"./vm-hands-entry-lite-qjrgvdbj.js";import"./vm-hands-entry-lite-b1vanmtv.js";import"./vm-hands-entry-lite-s93f3pbv.js";import"./vm-hands-entry-lite-yg4dk99m.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{lr as ManagedProcessStoppedError,wo as controlManagedDeviceProcess,ei as retireManagedDeviceProcess,Qn as runManagedDeviceProcess};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{yi,pn,wi,il,Bo,bi,Fo}from"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";export{pn as LOCAL_PTY_MAX_BUFFERED_OUTPUT_BYTES,wi as LOCAL_PTY_MAX_SESSIONS,yi as LOCAL_PTY_MAX_SESSION_MS,bi as defaultConnect,il as defaultLoginShell,Bo as ptyRuntimeSupported,Fo as runLocalPtySession};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Qc,Lt,bl,Yr,vl,Sl,Ze,El,kl,ie,xl,N,ro}from"./vm-hands-entry-lite-1wxwsb3f.js";import"./vm-hands-entry-lite-yg4dk99m.js";import{bn,Di}from"./vm-hands-entry-lite-1b21avcs.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-thstg177.js";import"./vm-hands-entry-lite-1w39j6vz.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{Qc as MANAGED_RUNTIME_MANIFEST_URL,bn as MANAGED_RUNTIME_MAX_MANIFEST_BYTES,ie as acquireManagedRuntimeDirectoryLock,xl as acquireManagedRuntimeLock,Ze as currentManagedRuntimeVersion,Yr as fetchManagedRuntimeBytes,ro as flushManagedRuntimeLifecycleEvents,Sl as installManagedRuntimeLauncher,El as isManagedRuntimeVersionExecutable,bl as legacyManagedRuntimePaths,kl as managedRuntimeExecutableVersion,Lt as managedRuntimePaths,Di as parseAndVerifyManagedRuntimeManifest,N as recordManagedRuntimeLifecycle,vl as updateManagedRuntime};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{R}from"./vm-hands-entry-lite-z65xva21.js";import{w}from"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-rxydyqke.js";import"./vm-hands-entry-lite-kbnxk71q.js";import{ot,We}from"./vm-hands-entry-lite-y0jtj8zz.js";import{ys}from"./vm-hands-entry-lite-1w39j6vz.js";import"./vm-hands-entry-lite-thstg177.js";import"./vm-hands-entry-lite-1wxwsb3f.js";import"./vm-hands-entry-lite-xfak34av.js";import"./vm-hands-entry-lite-pe374cn6.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-zj9esd2g.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-cmmb9k3g.js";import"./vm-hands-entry-lite-2qfmabqn.js";import"./vm-hands-entry-lite-0jy8mv4a.js";import"./vm-hands-entry-lite-d431ffz0.js";import"./vm-hands-entry-lite-mn8rjpxq.js";import"./vm-hands-entry-lite-61p78r72.js";import"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";import"./vm-hands-entry-lite-frg1b1rg.js";import"./vm-hands-entry-lite-s93f3pbv.js";import"./vm-hands-entry-lite-ngry8nkq.js";import"./vm-hands-entry-lite-997y1m1r.js";import"./vm-hands-entry-lite-j8s2vqpf.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-qjrgvdbj.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-43bv9hf0.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-41nn0vbf.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-srtqjjqb.js";import"./vm-hands-entry-lite-jgwjt10t.js";import"./vm-hands-entry-lite-284z7ct8.js";import"./vm-hands-entry-lite-b1vanmtv.js";import"./vm-hands-entry-lite-yg4dk99m.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-12ck5swp.js";import{Me,Be}from"./vm-hands-entry-lite-pg7nnyc6.js";import{spawn as I}from"child_process";import{randomUUID as A}from"crypto";import{closeSync as M,existsSync as T,mkdirSync as y,openSync as N,readFileSync as U,renameSync as O,rmSync as V,writeFileSync as F}from"fs";import{homedir as u}from"os";import{dirname as p,join as h}from"path";var L=["curl","npm","bun","brew"];function x(e){return L.includes(e)}function v(e,n=process.env){let r=R(n,"REASON_INSTALL_METHOD");if(x(r))return r;let t=e.replaceAll("\\","/").toLowerCase();if(t.includes("/.bun/install/global/"))return"bun";if(t.includes("/node_modules/"))return"npm";if(t.includes("/cellar/")||t.includes("/homebrew/"))return"brew";return"curl"}var f=86400000,_=7200000,W=900000,q=900000,J=30000,B=3600000,j=43200000,G="network-update-check.json",K="automatic-updates-declined.json",H="network-update.log";function g(e,n){return p(ot(e,n))}function S(e=process.env,n=u()){return T(h(g(e,n),K))}function b(e){if(!e||e.channel!=="production"||e.install_method!=="curl")return"no_receipt";return e.background_mode==="cli_only"?null:"background_updater"}function Y(e={}){let n=e.env??process.env,r=e.home??u(),t=e.executablePath??process.execPath;if(!(e.compiled??ys(e.main)))return"source_checkout";if(w({env:n,executablePath:t})!=="production")return"not_production";if(v(t,n)!=="curl")return"package_manager";let o=e.receipt===void 0?We(ot(n,r)):e.receipt,s=b(o);if(s)return s;if(S(n,r))return"declined";return"eligible"}async function jt(e,n=process.env,r=u()){if(e.background_mode!=="cli_only")return"background_updater";if(S(n,r))return"declined";if(b(e)!==null)return"none";let{installedEngineVersion:t}=await import("./agent-network-3stvmqsj.js");return t(r)===null?"none":"reason_network"}function X(e){try{let n=JSON.parse(U(e,"utf8"));return n?.schema_version===1&&typeof n.next_at==="string"&&Number.isFinite(Date.parse(n.next_at))?n:null}catch{return null}}function z(e,n){y(p(e),{recursive:!0,mode:448});let r=`${e}.${process.pid}.${A()}.tmp`;try{F(r,`${JSON.stringify(n)}
3
+ `,{mode:384,flag:"wx"}),O(r,e)}finally{V(r,{force:!0})}}function Q(e={}){let n=h(g(e.env??process.env,e.home??u()),G),r=(e.now??new Date).getTime(),t=()=>{let i=(e.random??Math.random)();return Number.isFinite(i)?Math.min(Math.max(i,0),1):0},o=(i)=>z(n,{schema_version:1,next_at:new Date(i).toISOString()}),s=X(n),c=s?Date.parse(s.next_at):NaN;if(!s||c>r+f+_)return o(r+Math.floor(t()*f)),!1;if(r<c)return!1;return o(r+f+Math.round((t()*2-1)*_)),!0}function Z(e,n={}){let r=n.platform??process.platform,t=n.kill??Be,o=(c)=>{try{t(e,c,r)}catch{}};if(o("SIGTERM"),r==="win32")return;setTimeout(()=>o("SIGKILL"),n.graceMs??J).unref?.()}function ee(e={}){let n=e.env??process.env,r=e.platform??process.platform,t=h(g(n,e.home??u()),H);y(p(t),{recursive:!0,mode:448});let o=N(t,"w",384);return new Promise((s)=>{let c=!1,i=(d)=>{if(c)return;c=!0,clearTimeout(a),s(d)},l=I(e.executablePath??process.execPath,["update","--quiet"],{env:n,stdio:["ignore",o,o],windowsHide:!0,...Me(r)});M(o);let a=setTimeout(()=>{if(l.pid)Z(l.pid,{platform:r,...e.killGraceMs===void 0?{}:{graceMs:e.killGraceMs},...e.kill?{kill:e.kill}:{}});i(124)},e.timeoutMs??q);a.unref?.(),l.once("error",()=>i(127)),l.once("exit",(d,m)=>i(m?128:d??1))})}function te(e,n){return new Promise((r)=>{if(n.aborted)return r();let t=setTimeout(r,e);n.addEventListener("abort",()=>{clearTimeout(t),r()},{once:!0})})}function ne(e,n=()=>new Date){let r=-1/0,t="";return(o)=>{let s=n().getTime();if(s-r<B||o===t&&s-r<j)return;r=s,t=o,e(o)}}async function Gt(e,n,r,t={}){let o=t.env??process.env,s=t.home??u(),c=t.sleep??te,i=t.now??(()=>new Date);if(o.REASON_NETWORK_NO_UPDATE||o.TINCAN_NO_UPDATE)return;let l=ne(n,i);try{let a=t.refreshEngine??(async(m)=>(await import("./agent-network-3stvmqsj.js")).refreshEngine({home:s,env:o,beforeRestart:m})),d=()=>l("moved the network engine to this release's pin; its daemon restarts on it");if(await a(d)){d();return}}catch(a){l(`couldn't move the network engine to this release's pin: ${a instanceof Error?a.message:String(a)}`)}while(!e.aborted){try{if(Y({env:o,home:s,...t.executablePath?{executablePath:t.executablePath}:{},...t.compiled===void 0?{}:{compiled:t.compiled}})==="eligible"&&Q({env:o,home:s,now:i(),...t.random?{random:t.random}:{}})){let d=await(t.update??(()=>ee({env:o,home:s,...t.executablePath?{executablePath:t.executablePath}:{}})))();if(d===0)await r();else l(`reason update failed (exit ${d}); the next try is in about a day`)}}catch(a){l(`automatic update: ${a instanceof Error?a.message:String(a)}`)}await c(t.tickMs??W,e)}}export{jt as automaticUpdatesFor,Gt as keepNetworkComputerCurrent};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{er,Xe,vs,Ss,M,At,Es,Fn,ks,Lr,xs,Cs,As,Ps,Rs,Ts,Is,Ds,Os,Ns,Ls,$s,Ms,Bs,Fs,js,ct,Le,Pt,xe,Hs,Us,zs,pe,qs,Ws,Vs,Gs,Ks,$r,Js,Xs,tr,Mr,Ys,Vi,Zs,Qs,ea,jn,ta,ra,na,ia,oa,sa,aa,ca,la,ua}from"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";export{Js as AUTOMATION_CLOUD_SESSIONS,$r as AUTOMATION_USER_CHROME,Ls as HANDS_CLOUD_ACCESS,$s as HANDS_CLOUD_ACCESS_KEY,ct as HANDS_CONFINEMENT,Le as HANDS_CONFINEMENT_KEY,Ps as HANDS_ENVIRONMENT_AT_CLAIM,Rs as HANDS_ENVIRONMENT_AT_CLAIM_KEY,ks as HANDS_ENVIRONMENT_DELIVERY,Lr as HANDS_ENVIRONMENT_DELIVER_CONTROL,Ms as HANDS_HEADLESS_BROWSER,Bs as HANDS_HEADLESS_BROWSER_KEY,Hs as HANDS_JOBS_USER,Us as HANDS_JOBS_USER_KEY,Fs as HANDS_LARGE_ENVIRONMENT,js as HANDS_LARGE_ENVIRONMENT_KEY,Pt as HANDS_MODEL_JOBS_EGRESS,xe as HANDS_MODEL_JOBS_EGRESS_KEY,Ds as HANDS_REBIND,Ns as HANDS_REBIND_CONTROL,Os as HANDS_REBIND_KEY,qs as HANDS_SESSION_CAP_KEY,Ws as HANDS_SESSION_CAP_NONE,zs as HANDS_SESSION_GROUP,pe as HANDS_SESSION_GROUP_KEY,Ts as HANDS_WORKSPACE_CHECK,Is as HANDS_WORKSPACE_CHECK_KEY,Gs as JOBS_START_WAIT,Ks as JOBS_START_WAIT_KEY,Xe as LOCAL_OPERATION_MAX_BYTES,er as LOCAL_RUNTIME_PROTOCOL_VERSION,M as LOCAL_RUNTIME_ROUTES,Fn as LOCAL_RUNTIME_SESSION_CLAIM_WAIT_MAX_MS,At as LOCAL_RUNTIME_SESSION_PATH,tr as LOCAL_RUNTIME_WORKER_STARTUP_MAX_MS,vs as RELAY_HOST_ALIAS_HEADER,Ss as RELAY_HOST_ALIAS_VERSION,As as VM_HANDS_UNBIND_UNVERIFIED_EVENT,xs as VM_HANDS_WORKSPACE_DEFERRED_KEY,Cs as VM_HANDS_WORKSPACE_GRANT_CONTROL,Vs as WORKER_PREVIEW_CARRIED_JOBS,Xs as WORKER_STARTUP_TIMING_STAGES,Mr as buildLocalRuntimeDeviceProofBytes,Es as localRuntimeSessionRoutable,na as parseLocalRuntimeDisconnectResponse,Qs as parseLocalRuntimeEnrollmentResponse,Ys as parseLocalRuntimeErrorEnvelope,jn as parseLocalRuntimeFirstHeartbeat,ea as parseLocalRuntimeHeartbeatResponse,ra as parseLocalRuntimeIdentityResponse,oa as parseLocalRuntimeLifecycleResponse,ia as parseLocalRuntimeLocalSubscriptionResponse,sa as parseLocalRuntimeOperationClaim,ua as parseLocalRuntimeOperationCompletionResponse,la as parseLocalRuntimeOperationEnvironmentResponse,ca as parseLocalRuntimeOperationEventsResponse,aa as parseLocalRuntimeOperationHeartbeatResponse,Vi as parseLocalRuntimeProofChallenge,Zs as parseLocalRuntimeRegistrationResponse,ta as parseLocalRuntimeRootsSyncResponse};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./vm-hands-entry-lite-84mc1f7h.js";import{Fe}from"./vm-hands-entry-lite-jgk5z8zc.js";import"./vm-hands-entry-lite-2rgf8866.js";import"./vm-hands-entry-lite-q9s1e2y1.js";import"./vm-hands-entry-lite-9g52kxyj.js";import{ve}from"./vm-hands-entry-lite-a7bf7xr7.js";import"./vm-hands-entry-lite-krpqqx12.js";import{be}from"./vm-hands-entry-lite-ht6hzkgj.js";import{xr}from"./vm-hands-entry-lite-bj3w2ven.js";import"./vm-hands-entry-lite-7pfhwxn5.js";import"./vm-hands-entry-lite-sy7dcccg.js";import{ma,ga,_a,Ur,zr}from"./vm-hands-entry-lite-hjjbjpd7.js";import"./vm-hands-entry-lite-hs6sdn60.js";import"./vm-hands-entry-lite-zawytz09.js";import"./vm-hands-entry-lite-8xv6c0rm.js";import{createHash as y}from"crypto";var _={start:"/network/auth/start",poll:"/network/auth/poll",key:"/network/auth/key",teams:"/v3/network/teams",leave:"/v3/network/teams/leave",proof:"/v3/network/proof"};async function I(r,e,t={}){let o=AbortSignal.timeout(t.timeoutMs??30000),i=await fetch(r,{method:"POST",redirect:"error",signal:t.signal?AbortSignal.any([t.signal,o]):o,headers:{"content-type":"application/json","user-agent":xr,...t.token?{authorization:`Bearer ${t.token}`}:{}},body:JSON.stringify(e)}),n=await i.json().catch(()=>({}));return{status:i.status,body:n&&typeof n==="object"?n:{}}}var d=(r)=>y("sha256").update(r).digest("hex");async function b(r,e,t,o,i=!1){let n={team_id:t.teamId,team_name:t.teamName,link:o,...i?{own_copy:!0}:{}},s=await I(`${r}${_.teams}`,n,{token:e}).catch(()=>null);return s!==null&&s.status>=200&&s.status<300}async function v(r,e,t,o,i={}){let n=zr(t);if(!n||!i.ownCopy&&e.registered===d(n.secret))return!0;let s=ma(i.home),a=ve(s)?await be({path:s}).catch(()=>null):null,c=(await r.team())?.name??e.team;if(a&&await b(a.apiOrigin,a.accessToken,{teamId:n.teamId,teamName:c},t,i.ownCopy)){if(!i.ownCopy&&e.registered!==d(n.secret))_a({...e,registered:d(n.secret)},i.home);return!0}return o?.stderr.write(T(`Your Reason account still lists ${Fe(c)}'s old link; signing in for this network refreshes it: reason network join '${t}'`)+`
3
- `),!1}var S=300000,R=21600000;async function xe(r,e,t,o){let i=ga(t),n=o?await r.team():null;if(i&&(!o||i.team===n?.name)){let{url:l}=await r.link(),u=zr(l);if(!u||d(u.secret)===e.sent)return e;return await v(r,i,l,null,{ownCopy:!0,...t?{home:t}:{}})?{...e,sent:d(u.secret)}:e}if(!o||!n?.teamId||Ur(t)?.team===n.name)return e;let{url:s}=await r.link(),a=zr(s);if(!a||a.teamId!==n.teamId.toLowerCase())return e;let c=d(a.secret);if(c===e.sent||e.refused?.link===c&&Date.now()<e.refused.until)return e;if(await(async()=>{let l=await o.agentNetwork();if(l.team===n.name||l.link&&zr(l.link)?.teamId===a.teamId)return!1;return await o.registerNetworkTeam({team_id:a.teamId,team_name:n.name,link:s,own_copy:!0}),!0})().catch(()=>!1))return{sent:c,refused:null};let g=e.refused?.link===c?e.refused.tries+1:1;return{...e,refused:{link:c,tries:g,until:Date.now()+Math.min(R,S*2**Math.min(g-1,10))}}}var T=(r)=>process.stdout.isTTY?`\x1B[2m${r}\x1B[22m`:r;export{xe as sendTeamLink};
2
+ import"./vm-hands-entry-lite-cmmb9k3g.js";import{Fe}from"./vm-hands-entry-lite-d12hx1dk.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-kbnxk71q.js";import{ve}from"./vm-hands-entry-lite-2qfmabqn.js";import"./vm-hands-entry-lite-rxydyqke.js";import{be}from"./vm-hands-entry-lite-0jy8mv4a.js";import{Ir}from"./vm-hands-entry-lite-1w39j6vz.js";import"./vm-hands-entry-lite-d431ffz0.js";import"./vm-hands-entry-lite-y0jtj8zz.js";import{Ea,ka,xa,Kr,Jr}from"./vm-hands-entry-lite-jj7873n8.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import{createHash as y}from"crypto";var _={start:"/network/auth/start",poll:"/network/auth/poll",key:"/network/auth/key",teams:"/v3/network/teams",leave:"/v3/network/teams/leave",proof:"/v3/network/proof"};async function I(r,e,t={}){let o=AbortSignal.timeout(t.timeoutMs??30000),i=await fetch(r,{method:"POST",redirect:"error",signal:t.signal?AbortSignal.any([t.signal,o]):o,headers:{"content-type":"application/json","user-agent":Ir,...t.token?{authorization:`Bearer ${t.token}`}:{}},body:JSON.stringify(e)}),n=await i.json().catch(()=>({}));return{status:i.status,body:n&&typeof n==="object"?n:{}}}var d=(r)=>y("sha256").update(r).digest("hex");async function b(r,e,t,o,i=!1){let n={team_id:t.teamId,team_name:t.teamName,link:o,...i?{own_copy:!0}:{}},s=await I(`${r}${_.teams}`,n,{token:e}).catch(()=>null);return s!==null&&s.status>=200&&s.status<300}async function v(r,e,t,o,i={}){let n=Jr(t);if(!n||!i.ownCopy&&e.registered===d(n.secret))return!0;let s=Ea(i.home),a=ve(s)?await be({path:s}).catch(()=>null):null,c=(await r.team())?.name??e.team;if(a&&await b(a.apiOrigin,a.accessToken,{teamId:n.teamId,teamName:c},t,i.ownCopy)){if(!i.ownCopy&&e.registered!==d(n.secret))xa({...e,registered:d(n.secret)},i.home);return!0}return o?.stderr.write(T(`Your Reason account still lists ${Fe(c)}'s old link; signing in for this network refreshes it: reason network join '${t}'`)+`
3
+ `),!1}var S=300000,R=21600000;async function xe(r,e,t,o){let i=ka(t),n=o?await r.team():null;if(i&&(!o||i.team===n?.name)){let{url:l}=await r.link(),u=Jr(l);if(!u||d(u.secret)===e.sent)return e;return await v(r,i,l,null,{ownCopy:!0,...t?{home:t}:{}})?{...e,sent:d(u.secret)}:e}if(!o||!n?.teamId||Kr(t)?.team===n.name)return e;let{url:s}=await r.link(),a=Jr(s);if(!a||a.teamId!==n.teamId.toLowerCase())return e;let c=d(a.secret);if(c===e.sent||e.refused?.link===c&&Date.now()<e.refused.until)return e;if(await(async()=>{let l=await o.agentNetwork();if(l.team===n.name||l.link&&Jr(l.link)?.teamId===a.teamId)return!1;return await o.registerNetworkTeam({team_id:a.teamId,team_name:n.name,link:s,own_copy:!0}),!0})().catch(()=>!1))return{sent:c,refused:null};let g=e.refused?.link===c?e.refused.tries+1:1;return{...e,refused:{link:c,tries:g,until:Date.now()+Math.min(R,S*2**Math.min(g-1,10))}}}var T=(r)=>process.stdout.isTTY?`\x1B[2m${r}\x1B[22m`:r;export{xe as sendTeamLink};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{co}from"./vm-hands-entry-lite-3gc2bn5a.js";export default co();
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{sl,Ac,Rl,al,Tl}from"./vm-hands-entry-lite-zj9esd2g.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-thstg177.js";import"./vm-hands-entry-lite-1w39j6vz.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";export{al as allowMacPermissions,Rl as permissionsSummary,Ac as readMacPermissions,sl as reasonIdentity,Tl as runPermissionsCli};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{F,Ei,ki,jo,_r,Ho,xi,qt,_t,Uo,Wt,_n,He,Vt,zo,yt,yn,Ci,wn,Ai,qo,nt,Ee,ce,it,Pi,Ri,Wo}from"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-kbnxk71q.js";export{Ai as REASON_HANDS_CLOSE_CODES,Wt as REASON_HANDS_JOB_CONTROL_MAX_FRAME_BYTES,xi as REASON_HANDS_JOB_MAX_INPUT_CHARS,qt as REASON_HANDS_JOB_MAX_OUTPUT_CHARS,_t as REASON_HANDS_JOB_MAX_OUTPUT_CHUNKS,Uo as REASON_HANDS_JOB_MAX_RECORDS,Ho as REASON_HANDS_MAX_ERROR_CHARS,Ei as REASON_HANDS_MAX_FRAME_BYTES,ki as REASON_HANDS_MAX_INPUT_CHARS,_r as REASON_HANDS_MAX_OUTPUT_CHARS,jo as REASON_HANDS_MAX_STRUCTURED_INPUT_CHARS,F as REASON_HANDS_PROTOCOL_VERSION,Ci as REASON_HANDS_PTY_ANCHOR_EXIT_MS,wn as REASON_HANDS_PTY_CLEANUP_RECEIPT_MS,yn as REASON_HANDS_PTY_CLEANUP_SWEEP_MS,yt as REASON_HANDS_PTY_MAX_DIMENSION,He as REASON_HANDS_PTY_MAX_INPUT_BYTES,Vt as REASON_HANDS_PTY_MAX_OUTPUT_BYTES,zo as REASON_HANDS_PTY_MAX_PENDING_INPUT_BYTES,_n as REASON_HANDS_PTY_PROTOCOL_VERSION,qo as REASON_HANDS_WORKSPACE_BEFORE_MAX_OUTPUT_CHARS,Ee as isReasonHandsGeneration,it as isReasonHandsPtyJobId,nt as isReasonHandsRequestId,ce as isReasonHandsUuid,Pi as parseReasonHandsJobRequest,Ri as parseReasonHandsJobResult,Wo as parseReasonHandsPtyReceipt};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ke,de,j,ze,ns,En,is,qe,Ni,Li,os,kn,Ie,ss,xn}from"./vm-hands-entry-lite-mn8rjpxq.js";import"./vm-hands-entry-lite-y0jtj8zz.js";import"./vm-hands-entry-lite-88dxn9b5.js";import"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-z65xva21.js";import"./vm-hands-entry-lite-thstg177.js";import"./vm-hands-entry-lite-1w39j6vz.js";import"./vm-hands-entry-lite-12ck5swp.js";import"./vm-hands-entry-lite-kbnxk71q.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import"./vm-hands-entry-lite-rxydyqke.js";export{ke as WORKER_SERVICE_ENV,j as WorkerServiceError,En as connectServiceLabel,de as defaultWorkerServiceHost,kn as installWorkerService,qe as installedWorkerService,is as isConnectServiceLabel,xn as removeWorkerService,Ie as restartWorkerService,ss as retargetWorkerServiceLogs,Ni as retireLegacyWorkerService,os as workerServiceDefinitionCurrent,ze as workerServiceLauncher,Li as workerServiceProcessRunning,ns as workerServiceRetargetPending};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./vm-hands-entry-lite-84mc1f7h.js";import"./vm-hands-entry-lite-2rgf8866.js";import{w,We,_c}from"./vm-hands-entry-lite-q9s1e2y1.js";import"./vm-hands-entry-lite-9g52kxyj.js";import{Q}from"./vm-hands-entry-lite-a7bf7xr7.js";import"./vm-hands-entry-lite-krpqqx12.js";import{me}from"./vm-hands-entry-lite-ht6hzkgj.js";import{g}from"./vm-hands-entry-lite-bj3w2ven.js";import{ir}from"./vm-hands-entry-lite-7pfhwxn5.js";import{un,tt}from"./vm-hands-entry-lite-pxtycfdv.js";import{f,S,nr,Z,fe,Xi,Yi}from"./vm-hands-entry-lite-y3nz20wb.js";import"./vm-hands-entry-lite-71ebge0c.js";import"./vm-hands-entry-lite-57ajjwmh.js";import"./vm-hands-entry-lite-h7nk2848.js";import"./vm-hands-entry-lite-vkhacd00.js";import"./vm-hands-entry-lite-weqam12f.js";import"./vm-hands-entry-lite-52qz0n30.js";import"./vm-hands-entry-lite-nn6zcvmp.js";import"./vm-hands-entry-lite-hn9pq7zj.js";import"./vm-hands-entry-lite-j10cw3d9.js";import"./vm-hands-entry-lite-6jxshhps.js";import"./vm-hands-entry-lite-wcgm41jq.js";import"./vm-hands-entry-lite-q9djb28r.js";import"./vm-hands-entry-lite-gxpw14jv.js";import{qe}from"./vm-hands-entry-lite-sy7dcccg.js";import"./vm-hands-entry-lite-m1we91g4.js";import"./vm-hands-entry-lite-jpvmkce5.js";import"./vm-hands-entry-lite-v4hr9x9h.js";import"./vm-hands-entry-lite-zh6ncdjn.js";import"./vm-hands-entry-lite-5y4phfv1.js";import"./vm-hands-entry-lite-z0ht62s4.js";import"./vm-hands-entry-lite-hxfxs7r9.js";import"./vm-hands-entry-lite-z213y4pj.js";import"./vm-hands-entry-lite-2dak7e1h.js";import"./vm-hands-entry-lite-ms99mzp0.js";import"./vm-hands-entry-lite-0wb1n769.js";import"./vm-hands-entry-lite-yvws5zpx.js";import"./vm-hands-entry-lite-hs6sdn60.js";import{s}from"./vm-hands-entry-lite-zawytz09.js";import{t,o,d,n,c,i}from"./vm-hands-entry-lite-k5ytpgzz.js";import"./vm-hands-entry-lite-8xv6c0rm.js";import{createHash as Ye,randomBytes as Qe}from"crypto";import{readFileSync as Ze,realpathSync as ye,renameSync as en,unlinkSync as nn,writeFileSync as tn}from"fs";import{dirname as rn,join as we}from"path";import{spawnSync as xe}from"child_process";import{accessSync as $e,constants as Ue,existsSync as J,mkdirSync as Le,readFileSync as Te,renameSync as Ee,writeFileSync as Oe}from"fs";import{homedir as De}from"os";import{delimiter as Ne,dirname as Fe,join as D}from"path";import{existsSync as Me,readFileSync as Ae}from"fs";import{join as Pe}from"path";var Ie=`---
2
+ import"./vm-hands-entry-lite-cmmb9k3g.js";import"./vm-hands-entry-lite-z65xva21.js";import{w,Ve,kc}from"./vm-hands-entry-lite-33at6g06.js";import"./vm-hands-entry-lite-kbnxk71q.js";import{Q}from"./vm-hands-entry-lite-2qfmabqn.js";import"./vm-hands-entry-lite-rxydyqke.js";import{me}from"./vm-hands-entry-lite-0jy8mv4a.js";import{g}from"./vm-hands-entry-lite-1w39j6vz.js";import{ir}from"./vm-hands-entry-lite-d431ffz0.js";import{mn,rt}from"./vm-hands-entry-lite-xfak34av.js";import{f,S,nr,Z,fe,Qi,eo}from"./vm-hands-entry-lite-frg1b1rg.js";import"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";import"./vm-hands-entry-lite-j8s2vqpf.js";import"./vm-hands-entry-lite-61p78r72.js";import"./vm-hands-entry-lite-s93f3pbv.js";import"./vm-hands-entry-lite-ngry8nkq.js";import"./vm-hands-entry-lite-997y1m1r.js";import"./vm-hands-entry-lite-pe374cn6.js";import"./vm-hands-entry-lite-13nx02p7.js";import"./vm-hands-entry-lite-thstg177.js";import"./vm-hands-entry-lite-zj9esd2g.js";import"./vm-hands-entry-lite-cc8hwgxc.js";import"./vm-hands-entry-lite-1wxwsb3f.js";import{We}from"./vm-hands-entry-lite-y0jtj8zz.js";import"./vm-hands-entry-lite-mn8rjpxq.js";import"./vm-hands-entry-lite-zp7chzcc.js";import"./vm-hands-entry-lite-qjrgvdbj.js";import"./vm-hands-entry-lite-a3gq377t.js";import"./vm-hands-entry-lite-43bv9hf0.js";import"./vm-hands-entry-lite-sh4mqy93.js";import"./vm-hands-entry-lite-3q2ng4e9.js";import"./vm-hands-entry-lite-41nn0vbf.js";import"./vm-hands-entry-lite-chq0qx9f.js";import"./vm-hands-entry-lite-srtqjjqb.js";import"./vm-hands-entry-lite-jgwjt10t.js";import"./vm-hands-entry-lite-284z7ct8.js";import"./vm-hands-entry-lite-b1vanmtv.js";import"./vm-hands-entry-lite-yg4dk99m.js";import"./vm-hands-entry-lite-88dxn9b5.js";import{s}from"./vm-hands-entry-lite-12ck5swp.js";import{t,o,d,n,c,i}from"./vm-hands-entry-lite-zpvr7wc6.js";import"./vm-hands-entry-lite-pg7nnyc6.js";import{createHash as Ye,randomBytes as Qe}from"crypto";import{readFileSync as Ze,realpathSync as ye,renameSync as en,unlinkSync as nn,writeFileSync as tn}from"fs";import{dirname as rn,join as we}from"path";import{spawnSync as xe}from"child_process";import{accessSync as $e,constants as Ue,existsSync as J,mkdirSync as Le,readFileSync as Te,renameSync as Ee,writeFileSync as Oe}from"fs";import{homedir as De}from"os";import{delimiter as Ne,dirname as Fe,join as D}from"path";import{existsSync as Me,readFileSync as Ae}from"fs";import{join as Pe}from"path";var Ie=`---
3
3
  name: reason
4
4
  description: Integrate software with Reason's public REST API using a scoped API key. Use for API clients, CI, service integrations, or cloud coding-session automation.
5
5
  ---
@@ -43,7 +43,7 @@ Base URL: \`https://api.reasonmachines.com/v3\`
43
43
  authority from a repository name or an untrusted task payload.
44
44
  `;function V(e){return Pe(e,".agents","skills","ara","SKILL.md")}function re(e){let r=V(e);return Me(r)&&Ae(r,"utf8")===Ie}var Y=["codex","claude","cursor"],oe={codex:"Codex",claude:"Claude Code",cursor:"Cursor"};function je(e,r=process.env){let a=r.PATH??"",u=process.platform==="win32"?(r.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";"):[""];for(let l of a.split(Ne)){if(!l)continue;for(let m of u)try{return $e(D(l,`${e}${m}`),Ue.X_OK),!0}catch{}}return!1}function ze(){return{exists:je,run(e,r,a={}){let u=a.interactive===!0,l=xe(e,r,{encoding:"utf8",env:process.env,stdio:u?"inherit":"pipe"});return{status:l.status??1,stdout:u?"":l.stdout??"",stderr:u?l.error?.message??"":`${l.stderr??""}${l.error?`${l.error.message}
45
45
  `:""}`}}}}function O(e){return`${e.stdout}
46
- ${e.stderr}`}function A(e){return e.status===0}function E(e,r,a,u={}){let l=e.run(r,a,u);if(A(l))return l;let m=O(l).trim();throw Error(`${r} ${a.join(" ")} failed${m?`: ${m}`:` with exit code ${l.status}`}`)}function Be(e=process.env){return _c(w({env:e}))}function ee(e,r){return e.split(/\s+/).some((a)=>ae(a,r))}function H(e){return D(e,".cursor","mcp.json")}function se(e){if(!J(e))return{};try{let r=JSON.parse(Te(e,"utf8"));if(!r||typeof r!=="object"||Array.isArray(r))throw Error("top-level value must be an object");return r}catch(r){let a=r instanceof Error?r.message:String(r);throw Error(`Cursor MCP config at ${e} is invalid; refusing to overwrite it (${a})`)}}function He(e,r){Le(Fe(e),{recursive:!0,mode:448});let a=`${e}.ara-${process.pid}.tmp`;Oe(a,`${JSON.stringify(r,null,2)}
46
+ ${e.stderr}`}function A(e){return e.status===0}function E(e,r,a,u={}){let l=e.run(r,a,u);if(A(l))return l;let m=O(l).trim();throw Error(`${r} ${a.join(" ")} failed${m?`: ${m}`:` with exit code ${l.status}`}`)}function Be(e=process.env){return kc(w({env:e}))}function ee(e,r){return e.split(/\s+/).some((a)=>ae(a,r))}function H(e){return D(e,".cursor","mcp.json")}function se(e){if(!J(e))return{};try{let r=JSON.parse(Te(e,"utf8"));if(!r||typeof r!=="object"||Array.isArray(r))throw Error("top-level value must be an object");return r}catch(r){let a=r instanceof Error?r.message:String(r);throw Error(`Cursor MCP config at ${e} is invalid; refusing to overwrite it (${a})`)}}function He(e,r){Le(Fe(e),{recursive:!0,mode:448});let a=`${e}.ara-${process.pid}.tmp`;Oe(a,`${JSON.stringify(r,null,2)}
47
47
  `,{mode:384}),Ee(a,e)}function ae(e,r){if(typeof e!=="string")return!1;if(e===r)return!0;try{let a=new URL(e);return["https://api.ara.so","https://api-staging.ara.so","https://api.reasonmachines.ai","https://staging-api.reasonmachines.ai","https://api.reasonmachines.com","https://staging-api.reasonmachines.com"].includes(a.origin)&&!a.username&&!a.password&&a.pathname==="/mcp/ara"&&!a.search&&!a.hash}catch{return!1}}function Je(e,r){let a=e.mcpServers?.ara;return Boolean(a&&typeof a==="object"&&!Array.isArray(a)&&ae(a.url,r))}class K{runner;home;mcpUrl;constructor(e=ze(),r=De(),a=Be()){this.runner=e;this.home=r;this.mcpUrl=a}isAvailable(e){if(e==="codex")return this.runner.exists("codex");if(e==="claude")return this.runner.exists("claude");return this.runner.exists("cursor")||J("/Applications/Cursor.app")||J(D(this.home,"Applications","Cursor.app"))||J(H(this.home))}availableClients(){return Y.filter((e)=>this.isAvailable(e))}installationPath(e){if(e==="cursor")return H(this.home);if(e==="codex")return D(this.home,".codex","plugins","cache","ara");return D(this.home,".claude","plugins","cache","ara")}sharedSkillStatus(){return{installed:re(this.home),path:V(this.home)}}status(e){let r=oe[e];if(!this.isAvailable(e))return{id:e,label:r,available:!1,installed:!1,connection:null,detail:"Client not detected",legacyInstallations:[]};if(e==="cursor"){let C=H(this.home),M=Je(se(C),this.mcpUrl);return{id:e,label:r,available:!0,installed:M,connection:M?"configured":null,detail:M?`Retired Reason MCP configuration in ${C}`:`No retired Reason MCP configuration in ${C}`,legacyInstallations:[]}}if(e==="codex"){let C=this.runner.run("codex",["plugin","list"]);if(!(A(C)&&O(C).includes("ara@ara")))return{id:e,label:r,available:!0,installed:!1,connection:null,detail:"No retired Reason plugin installed",legacyInstallations:[]};let x=this.runner.run("codex",["mcp","list"]),h=O(x).split(/\r?\n/).find((j)=>j.trimStart().startsWith("ara ")&&ee(j,this.mcpUrl)),W=A(x)&&Boolean(h),F=!A(x)?"error":h?.includes("Not logged in")?"not_logged_in":h?.includes("OAuth")?"oauth":h?"configured":"unknown";return{id:e,label:r,available:!0,installed:W,connection:F,detail:h?.trim()||"The retired Reason plugin is installed but has no verified retired MCP registration",legacyInstallations:[]}}let a=this.runner.run("claude",["plugin","list"]),u=O(a),l=A(a)&&u.includes("ara@ara"),m=A(a)&&u.includes("ara-handoff@ara");if(!l&&!m)return{id:e,label:r,available:!0,installed:!1,connection:null,detail:"No retired Reason plugin installed",legacyInstallations:[]};let R=this.runner.run("claude",["mcp","list"]),v=O(R),_=v.split(/\r?\n/).find((C)=>C.includes("plugin:ara:ara")&&ee(C,this.mcpUrl)),k=v.split(/\r?\n/).find((C)=>C.includes("plugin:ara-handoff:ara")&&ee(C,this.mcpUrl)),N=A(R)&&Boolean(_),b=A(R)&&k?["ara-handoff@ara"]:[],q=!A(R)?"error":_?.includes("Connected")?"connected":_?.includes("Failed")?"error":_?"configured":"unknown";return{id:e,label:r,available:!0,installed:N,connection:q,detail:_?.trim()||"The retired Reason plugin is installed but has no verified retired MCP registration",legacyInstallations:b}}statuses(){return Y.map((e)=>this.status(e))}logout(e){let r=this.status(e);if(!r.available||!r.installed)return`${r.label}: not connected`;if(e==="cursor")return this.uninstall("cursor").replace("removed retired Reason","signed out and removed retired Reason");if(e==="codex")return E(this.runner,"codex",["mcp","logout","ara"]),"Codex: signed out of Reason";return E(this.runner,"claude",["mcp","logout","plugin:ara:ara"]),"Claude Code: signed out of Reason"}uninstall(e){let r=this.status(e);if(!r.available||!r.installed)return`${r.label}: Reason is not installed`;if(e==="cursor"){let a=H(this.home),u=se(a),l={...u.mcpServers??{}};return delete l.ara,u.mcpServers=l,He(a,u),`Cursor: removed retired Reason MCP from ${a}`}if(e==="codex")return E(this.runner,"codex",["plugin","remove","ara@ara"]),"Codex: removed retired ara@ara";return E(this.runner,"claude",["plugin","uninstall","ara@ara","--scope","user"]),"Claude Code: removed retired ara@ara"}removeLegacyClaudePlugin(){if(!this.runner.exists("claude"))return"Claude Code: not installed";if(!this.status("claude").legacyInstallations.includes("ara-handoff@ara"))return"Claude Code: no legacy Reason plugin found";return E(this.runner,"claude",["plugin","uninstall","ara-handoff@ara","--scope","user"]),"Claude Code: removed obsolete ara-handoff@ara"}removeRetiredInstallations(){let e=[],r=[];for(let a of Y){let u;try{u=this.status(a)}catch(l){r.push(`${oe[a]}: ${l instanceof Error?l.message:String(l)}`);continue}if(u.installed){if(a!=="cursor")try{e.push(this.logout(a))}catch(l){r.push(`${u.label}: ${l instanceof Error?l.message:String(l)}`)}try{e.push(this.uninstall(a))}catch(l){r.push(`${u.label}: ${l instanceof Error?l.message:String(l)}`)}}if(a==="claude"&&u.legacyInstallations.includes("ara-handoff@ara"))try{e.push(this.removeLegacyClaudePlugin())}catch(l){r.push(`${u.label}: ${l instanceof Error?l.message:String(l)}`)}}if(e.length===0&&r.length===0)e.push("No retired Reason MCP configuration found.");return{messages:e,failures:r}}}function ie(e){return`claude mcp add --transport http reason ${e}`}function ce(e){return`codex mcp add reason --url ${e}
48
48
  codex mcp login reason`}var Mn=ie("https://mcp.reasonmachines.com/mcp"),An=ce("https://mcp.reasonmachines.com/mcp"),Pn=`https://claude.ai/settings/connectors?add=custom&url=${encodeURIComponent("https://mcp.reasonmachines.com/mcp")}`,In=`https://cursor.com/install-mcp?name=reason&config=${encodeURIComponent(btoa(JSON.stringify({url:"https://mcp.reasonmachines.com/mcp"})))}`;var Ke="https://github.com/reason-machines/reason-plugins",En=`Connect a coding agent to Reason over MCP
49
49
 
@@ -52,7 +52,7 @@ Usage:
52
52
  reason mcp uninstall Remove only this machine's registrations of the earlier, retired server
53
53
 
54
54
  Plugins for Claude Code and Codex: ${Ke}
55
- `;function le(e){if(!e.available)return"not detected";if(e.installed||e.legacyInstallations.length>0)return"retired configuration";return"not installed"}function Ge(e,r){let a=r.toLowerCase();if(e==="codex")return a.includes("codex");if(e==="claude")return a.includes("claude");return a.includes("cursor")}function ue(e,r){return(r.mcp_connections??[]).filter((u)=>Ge(e.id,u.client_name)).flatMap((u)=>u.last_used_at?[u.last_used_at]:[]).sort().at(-1)??null}function de(e,r=new Date){if(!e)return"never";let a=Date.parse(e);if(!Number.isFinite(a))return"never";let u=Math.max(0,Math.floor((r.getTime()-a)/1000));if(u<45)return"just now";let l=Math.floor(u/60);if(l<60)return`${l} ${l===1?"minute":"minutes"} ago`;let m=Math.floor(l/60);if(m<24)return`${m} ${m===1?"hour":"hours"} ago`;let R=Math.floor(m/24);return`${R} ${R===1?"day":"days"} ago`}function pe(e){let r=e.name?.trim(),a=e.email?.trim();if(r&&a)return`${r} (${a})`;return r||a||e.id||"Reason user"}function ge(e){let r=e.name?.trim(),a=e.slug?.trim();if(r&&a)return`${r} (${a})`;return r||a||e.id}var Ve=c(["granted","not_granted","unknown"]),he=n({status:Ve,checkedAt:o().finite(),executablePath:t().min(1)});var on=`Reason status
55
+ `;function le(e){if(!e.available)return"not detected";if(e.installed||e.legacyInstallations.length>0)return"retired configuration";return"not installed"}function qe(e,r){let a=r.toLowerCase();if(e==="codex")return a.includes("codex");if(e==="claude")return a.includes("claude");return a.includes("cursor")}function ue(e,r){return(r.mcp_connections??[]).filter((u)=>qe(e.id,u.client_name)).flatMap((u)=>u.last_used_at?[u.last_used_at]:[]).sort().at(-1)??null}function de(e,r=new Date){if(!e)return"never";let a=Date.parse(e);if(!Number.isFinite(a))return"never";let u=Math.max(0,Math.floor((r.getTime()-a)/1000));if(u<45)return"just now";let l=Math.floor(u/60);if(l<60)return`${l} ${l===1?"minute":"minutes"} ago`;let m=Math.floor(l/60);if(m<24)return`${m} ${m===1?"hour":"hours"} ago`;let R=Math.floor(m/24);return`${R} ${R===1?"day":"days"} ago`}function pe(e){let r=e.name?.trim(),a=e.email?.trim();if(r&&a)return`${r} (${a})`;return r||a||e.id||"Reason user"}function ge(e){let r=e.name?.trim(),a=e.slug?.trim();if(r&&a)return`${r} (${a})`;return r||a||e.id}var Xe=c(["granted","not_granted","unknown"]),he=n({status:Xe,checkedAt:o().finite(),executablePath:t().min(1)});var on=`Reason status
56
56
 
57
57
  Usage:
58
58
  reason status [--json]
@@ -61,9 +61,9 @@ Show the installed version, signed-in account and organization, this
61
61
  computer's connection (\`reason connect\`) and the workspaces it serves, any
62
62
  retired MCP configuration that can be cleaned up, and automatic updates.
63
63
  `,sn=5000,an=300000,cn=n({version:i(1),key:t(),at:o(),self:n({principal_type:t(),user_id:t().optional(),user_name:t().nullish(),email:t().nullish(),org_id:t(),organization_name:t().nullish(),organization_slug:t().nullish(),mcp_connections:d(n({client_id:t(),client_name:t(),last_used_at:t().nullable()})).optional()})}),Re=(e)=>`${e.apiOrigin}
64
- ${Ye("sha256").update(e.accessToken).digest("hex")}`;function ln(e,r,a){try{let u=cn.safeParse(JSON.parse(Ze(e,"utf8")));if(!u.success||u.data.key!==Re(r))return null;let l=a-u.data.at;return l>=0&&l<an?u.data.self:null}catch{return null}}function dn(e,r,a,u){let l=`${e}.${process.pid}.${Qe(6).toString("hex")}.tmp`;try{let m={version:1,key:Re(r),at:u,self:a};tn(l,`${JSON.stringify(m)}
65
- `,{mode:384,flag:"wx"}),en(l,e)}catch{try{nn(l)}catch{}}}var pn=30000;function mn(e,r=Date.now(),a=null){let u=tt(e),l=(()=>{if(u?.state!=="connected"&&u?.state!=="starting")return!1;try{return process.kill(u.pid,0),!0}catch{return!1}})(),m=l&&u?.state==="connected",R=(k)=>m&&r-k>=0&&r-k<pn,v=he.safeParse(u?.fullDiskAccess),_=un(u,a,r);return{..._?{permission_recovery:_}:{},full_disk_access:v.success&&R(v.data.checkedAt)?v.data.status:"unknown",keep_awake:{enabled:nr(e)==="battery_and_ac",holding:u?.idleSleepHold===!0&&R(Date.parse(u.lastHeartbeatAt??""))},executable:l&&v.success?v.data.executablePath:null}}function gn(e=w()){if(process.platform!=="darwin")return null;let r=Z(we(fe(ye(s()),e),"worker.json"));return r?mn(f(r).daemon,Date.now(),S(r)):null}var fn={background_updater:"enabled",reason_network:"enabled, daily by Reason Network",declined:"disabled (installed with --background-mode cli_only)",none:"disabled"},Ce={connected:"connected",starting:"starting",reconnecting:"reconnecting",stopping:"stopping",not_running:"not running",removed:"removed from Reason (run `reason connect` to connect it again)"};async function it(e,r={}){let a=r.io??{stdout:process.stdout,stderr:process.stderr};if(e.includes("--help")||e.includes("-h"))return a.stdout.write(on),0;if(e.some((m)=>m!=="--json"))return a.stderr.write(`Usage: reason status [--json]
66
- `),1;let u=new AbortController,l=setTimeout(()=>u.abort(Error("timed out reading the account")),sn);try{let m=r.now?.()??new Date,R=performance.now(),v=R,_=()=>{let p=performance.now(),P=Math.round(p-v);return v=p,P},k=null,N=(p)=>(k=p instanceof Error?p.message:String(p),null),b=await ir(r,u.signal).catch(N),q=_(),C=b?.credentialKind==="api_key",M=b&&!C?we(rn(Q(r.env??process.env)),"status-account.json"):null,x=b&&M&&e.includes("--json")?ln(M,b,m.getTime()):null,h=x??(b?await(r.getSelf??((p,P)=>new me(p).self(P)))(b,u.signal).catch(N):null);if(b&&h&&!x&&M)dn(M,b,h,m.getTime());let W=_(),F=r.manager??new K,j=e.includes("--json")?[]:F.statuses(),U=(r.loadReceipt??qe)(),z=U?await(r.automaticUpdates??(async(p)=>p.background_mode==="cli_only"?(await import("./network-auto-update-wkzb91qz.js")).automaticUpdatesFor(p,r.env??process.env,r.home):"background_updater"))(U).catch(()=>U.background_mode==="cli_only"?"none":"background_updater"):null,B=await(r.readConnection??(()=>Yi({channel:r.channel})))().catch(()=>null),I=null;try{if(B)I=(r.readConnectionMacState??(()=>gn(r.channel??w())))()}catch{}let y=B&&I?{...B,...I}:B,G=(()=>{try{return(r.readDisconnected??(()=>Xi(ye(s()),r.channel??w())))()}catch{return!1}})(),_e=_(),ne=h?{id:h.org_id,name:h.organization_name??null,slug:h.organization_slug??null}:null,T=h?{id:h.user_id??null,name:(C?h.service_user_name:h.user_name)??null,email:h.email??null,credential:C?"api_key":"login"}:null,X=r.channel??w(),L={version:g,channel:X,api_origin:b?.apiOrigin??We(X),account:T,account_error:k,organization:ne,mcp:j.map((p)=>({client:p.id,label:p.label,status:le(p),installed_at:p.installed?F.installationPath(p.id):null,last_used_at:h?ue(p,h):null})),connection:y,disconnected:G,installation:U&&z?{background_mode:U.background_mode,automatic_updates:z==="background_updater"||z==="reason_network",automatic_updates_by:z,future_device_consent:U.device_consent?.decision??"disabled"}:null,timings_ms:{process:Math.round(R),credentials:q,account:W,local:_e,total:Math.round(performance.now()-R)}};if(e.includes("--json"))return a.stdout.write(`${JSON.stringify(L,null,2)}
64
+ ${Ye("sha256").update(e.accessToken).digest("hex")}`;function ln(e,r,a){try{let u=cn.safeParse(JSON.parse(Ze(e,"utf8")));if(!u.success||u.data.key!==Re(r))return null;let l=a-u.data.at;return l>=0&&l<an?u.data.self:null}catch{return null}}function un(e,r,a,u){let l=`${e}.${process.pid}.${Qe(6).toString("hex")}.tmp`;try{let m={version:1,key:Re(r),at:u,self:a};tn(l,`${JSON.stringify(m)}
65
+ `,{mode:384,flag:"wx"}),en(l,e)}catch{try{nn(l)}catch{}}}var dn=30000;function pn(e,r=Date.now(),a=null){let u=rt(e),l=(()=>{if(u?.state!=="connected"&&u?.state!=="starting")return!1;try{return process.kill(u.pid,0),!0}catch{return!1}})(),m=l&&u?.state==="connected",R=(k)=>m&&r-k>=0&&r-k<dn,v=he.safeParse(u?.fullDiskAccess),_=mn(u,a,r);return{..._?{permission_recovery:_}:{},full_disk_access:v.success&&R(v.data.checkedAt)?v.data.status:"unknown",keep_awake:{enabled:nr(e)==="battery_and_ac",holding:u?.idleSleepHold===!0&&R(Date.parse(u.lastHeartbeatAt??""))},executable:l&&v.success?v.data.executablePath:null}}function gn(e=w()){if(process.platform!=="darwin")return null;let r=Z(we(fe(ye(s()),e),"worker.json"));return r?pn(f(r).daemon,Date.now(),S(r)):null}var fn={background_updater:"enabled",reason_network:"enabled, daily by Reason Network",declined:"disabled (installed with --background-mode cli_only)",none:"disabled"},Ce={connected:"connected",starting:"starting",reconnecting:"reconnecting",stopping:"stopping",not_running:"not running",removed:"removed from Reason (run `reason connect` to connect it again)"};async function it(e,r={}){let a=r.io??{stdout:process.stdout,stderr:process.stderr};if(e.includes("--help")||e.includes("-h"))return a.stdout.write(on),0;if(e.some((m)=>m!=="--json"))return a.stderr.write(`Usage: reason status [--json]
66
+ `),1;let u=new AbortController,l=setTimeout(()=>u.abort(Error("timed out reading the account")),sn);try{let m=r.now?.()??new Date,R=performance.now(),v=R,_=()=>{let p=performance.now(),P=Math.round(p-v);return v=p,P},k=null,N=(p)=>(k=p instanceof Error?p.message:String(p),null),b=await ir(r,u.signal).catch(N),q=_(),C=b?.credentialKind==="api_key",M=b&&!C?we(rn(Q(r.env??process.env)),"status-account.json"):null,x=b&&M&&e.includes("--json")?ln(M,b,m.getTime()):null,h=x??(b?await(r.getSelf??((p,P)=>new me(p).self(P)))(b,u.signal).catch(N):null);if(b&&h&&!x&&M)un(M,b,h,m.getTime());let W=_(),F=r.manager??new K,j=e.includes("--json")?[]:F.statuses(),U=(r.loadReceipt??We)(),z=U?await(r.automaticUpdates??(async(p)=>p.background_mode==="cli_only"?(await import("./network-auto-update-tk104maa.js")).automaticUpdatesFor(p,r.env??process.env,r.home):"background_updater"))(U).catch(()=>U.background_mode==="cli_only"?"none":"background_updater"):null,B=await(r.readConnection??(()=>eo({channel:r.channel})))().catch(()=>null),I=null;try{if(B)I=(r.readConnectionMacState??(()=>gn(r.channel??w())))()}catch{}let y=B&&I?{...B,...I}:B,G=(()=>{try{return(r.readDisconnected??(()=>Qi(ye(s()),r.channel??w())))()}catch{return!1}})(),_e=_(),ne=h?{id:h.org_id,name:h.organization_name??null,slug:h.organization_slug??null}:null,T=h?{id:h.user_id??null,name:(C?h.service_user_name:h.user_name)??null,email:h.email??null,credential:C?"api_key":"login"}:null,X=r.channel??w(),L={version:g,channel:X,api_origin:b?.apiOrigin??Ve(X),account:T,account_error:k,organization:ne,mcp:j.map((p)=>({client:p.id,label:p.label,status:le(p),installed_at:p.installed?F.installationPath(p.id):null,last_used_at:h?ue(p,h):null})),connection:y,disconnected:G,installation:U&&z?{background_mode:U.background_mode,automatic_updates:z==="background_updater"||z==="reason_network",automatic_updates_by:z,future_device_consent:U.device_consent?.decision??"disabled"}:null,timings_ms:{process:Math.round(R),credentials:q,account:W,local:_e,total:Math.round(performance.now()-R)}};if(e.includes("--json"))return a.stdout.write(`${JSON.stringify(L,null,2)}
67
67
  `),0;if(X==="staging")a.stdout.write(`Reason ${g} \xB7 channel: STAGING
68
68
  `),a.stdout.write(`API: ${L.api_origin}
69
69
  `);else a.stdout.write(`Reason ${g}
@@ -79,7 +79,7 @@ This computer
79
79
  `),y.version)a.stdout.write(`Version: ${y.version}${y.version===g?"":` (${g} is installed; \`reason connect\` restarts it on that)`}
80
80
  `);if(a.stdout.write(`Folder: ${y.folder}
81
81
  `),a.stdout.write(`Sessions: ${y.sessions_running===null?"":`${y.sessions_running} running, `}${y.sessions_max===null?"every Session you start":y.sessions_max===1?"one at a time":`up to ${y.sessions_max} at once`}
82
- `),I){let p=I,P=await(r.readPermissionsSummary??(async()=>{let{permissionsSummary:Se,readMacPermissions:ve,reasonIdentity:be}=await import("./permissions-348prrcx.js"),{macScreenStatus:ke}=await import("./local-display-mac-yxcxvg2z.js");return Se(await ve({identity:()=>be(),grants:ke,worker:async()=>p}))}))().catch(()=>null);if(P)a.stdout.write(`${P}
82
+ `),I){let p=I,P=await(r.readPermissionsSummary??(async()=>{let{permissionsSummary:Se,readMacPermissions:ve,reasonIdentity:be}=await import("./permissions-ywh8x4dq.js"),{macScreenStatus:ke}=await import("./local-display-mac-h5yz0ydd.js");return Se(await ve({identity:()=>be(),grants:ke,worker:async()=>p}))}))().catch(()=>null);if(P)a.stdout.write(`${P}
83
83
  `);a.stdout.write(`Keep awake: ${I.keep_awake.enabled?"on":"off"}${I.keep_awake.holding?" (holding)":""}
84
84
  `)}if(y.service)a.stdout.write(`Logs: ${y.service.logs}
85
85
  `);for(let p of y.workspaces??[]){let P=p.state==="removed"?"removed from that workspace":p.blocked?"offline (this computer is outside that workspace's allowed networks)":p.device_id?Ce[p.state]:"connecting";a.stdout.write(`Also in workspace ${p.name??p.organization_id}${p.account?" (another Reason account's)":""}: ${P}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{g,Ir,Hc,Il,ys}from"./vm-hands-entry-lite-1w39j6vz.js";export{Ir as CLI_USER_AGENT,g as CLI_VERSION,Hc as CLI_VERSION_PATTERN,Il as compareCliVersions,ys as isCompiledRelease};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{ba}from"./vm-hands-entry-lite-84mc1f7h.js";import{P}from"./vm-hands-entry-lite-2rgf8866.js";import{W}from"./vm-hands-entry-lite-q9s1e2y1.js";import{Q,ro,ve,no}from"./vm-hands-entry-lite-a7bf7xr7.js";import{xr}from"./vm-hands-entry-lite-bj3w2ven.js";import{t,o,_,d,n,rl,we,c,i}from"./vm-hands-entry-lite-k5ytpgzz.js";var E=/^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$/;function S(e){let s=typeof e==="string"?E.exec(e):null;return s?{major:Number(s[1]),minor:Number(s[2])}:null}import{createHash as q,randomBytes as v}from"crypto";import{createInterface as M}from"readline";var k=["run","mcp:read","mcp:write","secrets:read","secrets:write","sessions:read","sessions:debug","devices:read","devices:write","devices:use","ssh:write","knowledge:read","memory:read","memory:write","skills:read","skills:write","repos:read","repos:write","reviews:read","reviews:write","deployment:read","analytics:read","org:read","org:write","attachments:read","attachments:write","guardrails:read","guardrails:write","network:read","network:write","automations:read","automations:write","agent_auth:read"];var Ge=k.filter((e)=>e!=="network:read"&&e!=="network:write");class y extends Error{oauthCode;constructor(e,s=null){super(e);this.oauthCode=s;this.name="LoginError"}}function ya(){let e=v(48).toString("base64url"),s=q("sha256").update(e).digest("base64url");return{verifier:e,challenge:s,state:v(32).toString("base64url")}}function z(e,s){let r=typeof e.error==="string"?e.error:null,a=typeof e.error_description==="string"?e.error_description:r?r:s;return new y(a,r)}async function L(e,s,r,a){let l=await r(`${e}/mcp/oauth/token`,{method:"POST",redirect:"error",headers:{"content-type":"application/x-www-form-urlencoded"},body:s,signal:a}),u=await l.json().catch(()=>({}));if(!l.ok)throw z(u,`OAuth token request failed (${l.status})`);return u}var j=1e4;async function D(e,s={}){let r=s.fetchImpl??fetch,a=await L(e.apiOrigin,new URLSearchParams({grant_type:"refresh_token",client_id:e.clientId,refresh_token:e.refreshToken}),r,AbortSignal.timeout(j)).catch((u)=>{if(u instanceof Error&&u.name==="TimeoutError")throw new y("Reason did not answer the login refresh in time. Check the network and retry.");throw u});if(typeof a.access_token!=="string"||typeof a.refresh_token!=="string"||typeof a.expires_in!=="number")throw new y("Reason returned an incomplete refreshed login.");let l={...e,accessToken:a.access_token,refreshToken:a.refresh_token,expiresAt:new Date(Date.now()+a.expires_in*1000).toISOString(),scopes:typeof a.scope==="string"?a.scope.split(/\s+/).filter(Boolean):e.scopes};return ro(l,s.path??Q()),l}var R=new Map,N=2000,H=100;function I(e,s){if(!s)return e;if(s.aborted)return Promise.reject(s.reason);return new Promise((r,a)=>{let l=()=>a(s.reason);s.addEventListener("abort",l,{once:!0}),e.then(r,a).finally(()=>s.removeEventListener("abort",l))})}async function be(e={}){let s=e.path??Q(),r=ve(s);if(!r)return null;let a=e.apiOrigin??P(process.env,"REASON_API_URL")?.trim();if(a&&!W(r.apiOrigin,new URL(a).origin))return null;if(!(Date.parse(r.expiresAt)<=Date.now()+60000)&&(!e.forceRefresh||e.refused!==void 0&&r.accessToken!==e.refused))return r;let u=[s,r.apiOrigin,r.clientId,r.refreshToken].join("\x00"),g=R.get(u);if(g)return I(g,e.signal);let h;return h=D(r,{fetchImpl:e.fetchImpl,path:s}).catch(async(p)=>{if(!(p instanceof y)||p.oauthCode!=="invalid_grant"&&p.oauthCode!=="invalid_client")throw p;let b=(f)=>f!==null&&(p.oauthCode==="invalid_client"?f.clientId!==r.clientId:f.refreshToken!==r.refreshToken),O=Date.now()+N;while(!b(ve(s))&&Date.now()<O)await new Promise((f)=>setTimeout(f,H));if(b(ve(s)))return be({fetchImpl:e.fetchImpl,path:s});return no(s),null}).finally(()=>{if(R.get(u)===h)R.delete(u)}),R.set(u,h),I(h,e.signal)}function wa(e,s){return new Promise((r)=>{let a=M({input:e}),l=!1,u=(h)=>{if(l)return;l=!0,s.removeEventListener("abort",g),a.close(),e.pause(),r(h)},g=()=>u(null);s.addEventListener("abort",g,{once:!0}),a.once("line",(h)=>u(h)),a.once("close",()=>u(null))})}var F=n({label:t(),used_percent:o().min(0).max(100).nullable(),resets_at:t().nullable(),exhausted:_().nullable()}),B=n({groups:d(n({selectable:_().optional(),accounts:d(n({source_id:t().min(1),model_ids:d(t().min(1)).optional()}))}))});function G(e){let s=B.safeParse(e);if(!s.success)return;return s.data.groups.some((r)=>r.selectable!==!1&&r.accounts.some((a)=>a.model_ids===void 0||a.model_ids.length>0))}class C extends Error{status;code;suggestedModel;retryAfterMs;resolutionReason;refusal;constructor(e,s,r,a,l,u,g){super(r);this.status=e;this.code=s;this.suggestedModel=a;this.retryAfterMs=l;this.resolutionReason=u;this.refusal=g;this.name="ApiError"}static rateLimitDelayMs(e,s){if(!(e instanceof C)||e.status!==429)return null;return Math.min(60000,Math.max(s,e.retryAfterMs??0))}}var J=["minimal","low","medium","high","xhigh","max"],K=n({id:t().min(1),kind:t(),name:t(),custom_name:t().nullish(),status:t(),online:_(),compatible:_().optional(),compatibility_reason:t().nullish(),folder_lane_of:t().nullish(),roots:d(n({id:t().min(1),label:t()}))}),V=n({devices:d(K),end_cursor:t().nullish(),has_next_page:_().optional()}),Y=n({id:t().min(1),name:t()}),Z=n({items:d(Y)}),X=n({id:t().min(1),name:t(),main:_(),mine:_(),session_id:t().nullish(),appearance:n({color:t().nullish()}).nullish().catch(null)}),ee=n({items:d(X)}),ne=n({skill_id:t().min(1),name:t(),description:t().nullish(),activation_keywords:d(t()).default([]),is_enabled:_().default(!0)}),te=n({items:d(ne).default([])}),se=n({id:t().min(1),kind:t(),enabled:_(),schedule:n({expression:t().nullish(),every_seconds:o().nullish(),next_run_at:t().nullish()}).nullish(),github:n({event:t().nullish(),action:t().nullish(),repo:t().nullish()}).nullish(),last_fired_at:t().nullish()}),A=n({id:t().min(1),name:t().nullish(),instructions:t().nullish(),enabled:_(),triggers:d(se).default([])}),oe=n({items:d(A).default([]),end_cursor:t().nullish(),has_next_page:_().optional()}),re=n({id:t().min(1),slug:t().nullish(),name:t(),description:t().nullish(),transport:t().nullish(),url:t().nullish(),enabled:_()}),ie=n({items:d(re).default([])}),ae=n({status:t(),summary:t().nullish(),category:t().nullish(),outcome:t().nullish(),message_count:o().nullish(),pr_url:t().nullish(),cost_usd:o().nullish(),generated_at:t().nullish()}),x=n({tags:d(t()).default([])}),le=c(["linux","macos"]),T=n({id:t().min(1),name:t().min(1),platform:le.nullable(),workers:n({total:o().int(),online:o().int(),busy:o().int(),idle:o().int()}),sessions:n({queued:o().int(),running:o().int()})}),ce=n({machines:d(T)}),de=n({machine:T}),ue=n({deleted:i(!0),revoked_workers:o().int(),revoked_tokens:o().int()}),ge=n({token:n({id:t().min(1),machine_id:t().min(1),token_prefix:t()}),secret:t().startsWith("rmt_")}),U=rl({machine_id:t().min(1),machine_name:t().min(1)}),he=U.extend({organization_id:t().min(1)}),tn=n({id:t().min(1),name:t().min(1),state:c(["waiting","placed"]),queue_position:o().int().nullable()});var sn=we([n({kind:i("cloud")}),n({kind:c(["mac","headless"]),device_id:t().min(1),root_id:t().min(1)})]);function m(e,s,r){let a=e.safeParse(s);if(!a.success)throw new C(502,r,"Reason returned an unexpected response.");return a.data}var pe=n({error:n({type:t(),message:t()})});function w(e,s,r){let a=pe.safeParse(s),l=typeof s.error==="string"?s.error:a.success?a.data.error.type:`http_${e}`,u=typeof s.detail==="string"?s.detail:typeof s.message==="string"?s.message:a.success?a.data.error.message:`Reason request failed (${e}${typeof s.error==="string"?` ${s.error}`:""})`,g=l==="github_connection_required"&&typeof s.connect_url==="string"&&/^https?:\/\//.test(s.connect_url)?` Connect it at ${s.connect_url}`:"",h=r===null||r.trim()===""?NaN:Number(r);return new C(e,l,`${u}${g}`,typeof s.suggested_model==="string"?s.suggested_model:void 0,Number.isFinite(h)&&h>=0?h*1000:void 0,typeof s.resolution_reason==="string"?s.resolution_reason:void 0,typeof s.code==="string"?{code:s.code,...typeof s.billing_path==="string"&&/^\/(?![/\\])/.test(s.billing_path)?{billingPath:s.billing_path}:{}}:void 0)}async function eo(e){let s=await(e.fetchImpl??fetch)(`${e.apiOrigin}/v3/machines/enrollment-tickets`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,accept:"application/json","content-type":"application/json"},body:JSON.stringify(e.body),signal:AbortSignal.timeout(30000),redirect:"error"}),r=await s.json().catch(()=>({}));if(!s.ok)throw w(s.status,r,s.headers.get("retry-after"));return m(he,r,"invalid_machine_ticket")}var fe=n({items:d(n({name:t()}))}),_e=n({name:t(),scope:t(),result:c(["created","updated"]).optional(),warning:n({message:t()}).optional()});class me{options;credentials;constructor(e,s={}){this.options=s;this.credentials=e}trackEvent(e,s={}){}async request(e,s={}){let{status:r,headers:a,json:l}=await this.exchange(e,s);if(r<200||r>299)throw w(r,l,a.get("retry-after"));return l}async exchange(e,s={},r=!1){let a=this.options.fetchImpl??fetch;if(!r&&s.retryUnauthorized!==!1)await this.renewBeforeExpiry(a,s.signal);let l=await a(`${this.credentials.apiOrigin}/v3${e}`,{method:s.method??"GET",headers:{authorization:`Bearer ${this.credentials.accessToken}`,accept:"application/json","user-agent":xr,"x-reason-agent":"Reason CLI","x-client-surface":this.options.clientSurface??"direct_cli",...s.raw?{"content-type":s.raw.contentType}:s.body===void 0?{}:{"content-type":"application/json"},...s.headers,...s.ifNoneMatch?{"if-none-match":s.ifNoneMatch}:{}},body:s.raw?s.raw.bytes:s.body===void 0?void 0:JSON.stringify(s.body),signal:s.signal,redirect:s.ifNoneMatch?"manual":"error"}),u=await l.json().catch(()=>({}));if(l.status===401&&!r&&s.retryUnauthorized!==!1&&this.credentials.credentialKind!=="api_key"){let g=await be({fetchImpl:a,path:this.options.credentialsPath,forceRefresh:!0,refused:this.credentials.accessToken,signal:s.signal});if(g)return this.credentials=g,this.exchange(e,s,!0)}return{status:l.status,headers:l.headers,json:u}}async renewBeforeExpiry(e,s){let r=this.credentials;if(r.credentialKind==="api_key"||!(Date.parse(r.expiresAt)<=Date.now()+60000))return;let a=await be({fetchImpl:e,path:this.options.credentialsPath,signal:s}).catch(()=>null);if(a&&a.apiOrigin===r.apiOrigin&&a.orgId===r.orgId&&a.clientId===r.clientId)this.credentials=a}createHeadlessDeviceEnrollmentTicket(e){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/enrollment-tickets`,{method:"POST",body:e,signal:AbortSignal.timeout(30000),retryUnauthorized:!1})}async enrollHeadlessDevice(e){try{return await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/enrollments`,{method:"POST",body:e,signal:AbortSignal.timeout(30000),retryUnauthorized:!1})}catch(s){if(s instanceof C&&(s.status===404||s.status===405||s.status===403&&s.code==="endpoint_not_available"))return null;throw s}}addDeviceRoot(e,s){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/${encodeURIComponent(e)}/roots`,{method:"POST",body:s,signal:AbortSignal.timeout(30000)})}removeDeviceRoot(e,s){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/${encodeURIComponent(e)}/roots/${encodeURIComponent(s)}`,{method:"DELETE",signal:AbortSignal.timeout(30000)})}machinePath(e,s=""){let r=`/organizations/${encodeURIComponent(this.credentials.orgId)}/machines`;return e===void 0?r:`${r}/${encodeURIComponent(e)}${s}`}async listMachines(){return m(ce,await this.request(this.machinePath()),"invalid_machine_list").machines}async createMachine(e){let s=await this.request(this.machinePath(),{method:"POST",body:{name:e.name,...e.platform?{platform:e.platform}:{}}});return m(de,s,"invalid_machine").machine}async deleteMachine(e){let s=await this.request(this.machinePath(e),{method:"DELETE"});return m(ue,s,"invalid_machine_deletion")}async listSecretNames(e){let s=await this.request(`${this.secretsPath()}?scope=${e}`);return m(fe,s,"invalid_secret_list").items.map((r)=>r.name)}async setSecret(e){let s=await this.request(this.secretsPath(),{method:"POST",body:e});return m(_e,s,"invalid_secret_write")}secretsPath(){return`/organizations/${encodeURIComponent(this.credentials.orgId)}/secrets`}async createMachineToken(e){let s=await this.request(this.machinePath(e,"/tokens"),{method:"POST",body:{}});return m(ge,s,"invalid_machine_token")}async createMachineEnrollmentTicket(e,s){let r=await this.request(this.machinePath(e,"/enrollment-tickets"),{method:"POST",body:s,signal:AbortSignal.timeout(30000),retryUnauthorized:!1});return m(U,r,"invalid_machine_ticket")}self(e){return this.request("/self",{signal:e})}submitFeedback(e){return this.request("/feedback",{method:"POST",body:e,signal:AbortSignal.timeout(30000)})}agentNetwork(e=AbortSignal.timeout(30000)){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network`,{signal:e})}startAgentNetwork(e){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network`,{method:"POST",body:e,signal:AbortSignal.timeout(30000)})}rotateAgentNetwork(e){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network`,{method:"PUT",body:e,signal:AbortSignal.timeout(30000)})}async registerNetworkTeam(e){await this.request("/network/teams",{method:"POST",body:e,signal:AbortSignal.timeout(30000)})}async claimAgentNetworkRelayJob(e,s){let r=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network/relay/claim`,{method:"POST",body:e,signal:s});return m(ba,r,"invalid_agent_network_job")}async completeAgentNetworkRelayJob(e,s){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network/relay/jobs/${encodeURIComponent(e)}`,{method:"POST",body:s,signal:AbortSignal.timeout(30000)})}async recordAgentNetworkRelayReplies(e){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network/relay/replies`,{method:"POST",body:e,signal:AbortSignal.timeout(30000)})}async workspaceMembers(){return((await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/members/users`,{signal:AbortSignal.timeout(30000)})).items??[]).flatMap((s)=>typeof s.email==="string"?[{email:s.email,role:typeof s.role==="string"?s.role:"member"}]:[])}claimExistingCliPairing(e){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/onboarding/import/pairing/claim-existing`,{method:"POST",body:{pairing_code:e}})}async claudeCodeSignIn(e){return(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/provider-credentials`,{retryUnauthorized:!1,signal:e?AbortSignal.any([e,AbortSignal.timeout(15000)]):AbortSignal.timeout(15000)})).claude_code_sign_in===!0}connectAnthropicProvider(e,s,r={}){let a=e.kind==="setup_token"?{setup_token:e.token}:{access_token:e.credential.access,refresh_token:e.credential.refresh,expires_at:new Date(e.credential.expires).toISOString()};return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/provider-credentials/anthropic`,{method:"POST",retryUnauthorized:r.retryUnauthorized,signal:r.signal,body:{...a,...s?{account_key:s}:{}}})}async listRepositories(){return((await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/repositories`)).items??[]).flatMap((s)=>{let r=typeof s.full_name==="string"?s.full_name:typeof s.repo_full_name==="string"?s.repo_full_name:null;if(!r)return[];return[{repo_id:typeof s.repo_id==="string"?s.repo_id:void 0,full_name:r,provider:s.provider==="gitlab"?"gitlab":"github",default_branch:typeof s.default_branch==="string"?s.default_branch:null,private:typeof s.private==="boolean"?s.private:void 0}]})}async listProjects(){let e=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/projects`),s=Z.safeParse(e);if(!s.success)throw new C(502,"invalid_project_list","Reason returned an unexpected project list.");return s.data.items}async listReasons(){let e=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/reasons`);return m(ee,e,"invalid_reason_list").items}async openReasonConversation(e){let s=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/reasons/${encodeURIComponent(e)}/conversation`,{method:"POST"});return m(n({session_id:t().min(1)}),s,"invalid_reason_conversation").session_id}async listSkills(){try{let e=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/skills`);return m(te,e,"invalid_skill_list").items}catch(e){if(e instanceof C&&(e.status===403||e.status===404))return[];throw e}}async listDevices(){let e=[],s=null;for(let r=0;r<50;r+=1){let a=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices${s?`?after=${encodeURIComponent(s)}`:""}`),l=V.safeParse(a);if(!l.success)throw new C(502,"invalid_device_list","Reason returned an unexpected machine list.");if(e.push(...l.data.devices),s=l.data.has_next_page?l.data.end_cursor??null:null,!s)break}return e}async listModels(){try{let s=((await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-auth/models`)).models??[]).filter((l)=>l.hidden!==!0),r=s.filter((l)=>l.available!==!1).map(({reasoning_efforts:l,hidden:u,available:g,...h})=>({...h,...Array.isArray(l)?{reasoning_efforts:J.filter((p)=>l.includes(p))}:{}})),a=new Set(r.map((l)=>l.detail));return{models:r.length>1&&a.size===1?r.map(({detail:l,...u})=>u):r,runnable:r.length>0||s.length===0}}catch(e){if(e instanceof C&&(e.status===403||e.status===404))return{models:[],runnable:!0};throw e}}async getAgentVersion(e){try{let s=await this.request("/deployment",{signal:e,retryUnauthorized:!1});return S(s.reason_version)?s.reason_version:null}catch{return null}}async getUsageQuota(){try{let e=F.safeParse(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/usage/quota`));if(!e.success)return null;let s;try{s=G(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-auth/models`))}catch{}return{...e.data,own_inference:s}}catch(e){if(e instanceof C&&(e.status===403||e.status===404))return null;throw e}}async listSessionFields(e){let s=new URLSearchParams({first:String(Math.min(Math.max(e.first,1),200)),status:e.status??"active"});if(e.origin)s.set("origin",e.origin);s.set("fields",e.fields.join(","));let r=`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions?${s.toString()}`,{status:a,headers:l,json:u}=await this.exchange(r,e.etag?{ifNoneMatch:e.etag}:{});if(a===304)return null;if(a<200||a>299)throw w(a,u,l.get("retry-after"));return{items:Array.isArray(u.items)?u.items:[],etag:l.get("etag")}}async listSessions(e=50,s,r={}){let a=new URLSearchParams({first:String(Math.min(Math.max(e,1),200)),status:r.status??"active"});if(s)a.set("project_id",s);if(r.origin)a.set("origin",r.origin);return(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions?${a.toString()}`)).items??[]}getSession(e,s){let r=s?.fields.length?`?fields=${encodeURIComponent(s.fields.join(","))}`:"";return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}${r}`)}async prestartSession(e){let s=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/prestart`,{method:"POST",body:{client_session_id:e}});return s?.status==="starting"||s?.status==="ready"}async createSession(e){let s=e.mode==="ephemeral"||e.workspaceOwnership==="externally-managed";if(e.attachments?.length)await this.requireSessionAttachments();if(s||e.runtimeProfile){let l=await this.request("/deployment");if(s&&(!Array.isArray(l.session_modes)||!l.session_modes.includes(e.mode??"standard")||!Array.isArray(l.workspace_ownerships)||!l.workspace_ownerships.includes(e.workspaceOwnership??"managed")))throw Error("Deployment does not support the requested Session policy; refusing to create a Session.");if(e.runtimeProfile&&(!Array.isArray(l.experimental_runtime_profiles)||!l.experimental_runtime_profiles.includes(e.runtimeProfile)))throw Error("Deployment does not support the requested runtime profile; refusing to create a Session.")}let r=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions`,{method:"POST",body:{prompt:e.prompt,...e.attachments?.length?{attachments:e.attachments}:{},...e.mode?{mode:e.mode}:{},...e.workspaceOwnership?{workspace_ownership:e.workspaceOwnership}:{},...e.target?{target:e.target}:{},...e.repo?{repo:e.repo}:{},...e.provider?{provider:e.provider}:{},...e.model?{model:e.model}:{},...e.reasoningEffort?{reasoning_effort:e.reasoningEffort}:{},...e.runtimeProfile?{experimental_runtime_profile:e.runtimeProfile}:{},...e.ref?{ref:e.ref}:{},...e.branch?{branch:e.branch}:{},...e.completionMode?{completion_mode:e.completionMode}:{},...e.env&&Object.keys(e.env).length>0?{env:e.env}:{},...e.clientSessionId?{client_session_id:e.clientSessionId}:{},...e.longRunning?{long_running:{enabled:!0}}:{},...e.spendLimitRcu?{spend_limit_rcu:e.spendLimitRcu}:{},idempotency_key:`cli-${crypto.randomUUID()}`}}),a=await this.getSession(r.session_id);if(s){let l=a.session_policy,u=["memoryRead","memoryWrite","skills","inheritedInstructions","integrations","secretInjection"];if(!l||l.version!==1||l.mode!==(e.mode??"standard")||l.workspaceOwnership!==(e.workspaceOwnership??"managed")||!l.components||u.some((g)=>l.components[g]!==!0))throw await this.cancelSession(r.session_id),Error("Server did not attest the requested Session policy; cancellation requested.")}if(e.runtimeProfile&&a.experimental_runtime_profile!==e.runtimeProfile)throw await this.cancelSession(r.session_id),Error("Server did not attest the requested runtime profile; cancellation requested.");return a}async getEvents(e,s=-1,r={}){try{return await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/events?after_seq=${s}&limit=500${r.waitMs?`&wait_ms=${r.waitMs}`:""}`,r.signal?{signal:r.signal}:{})}catch(a){if(!(a instanceof C)||a.status!==403&&a.status!==404)throw a;return{session:await this.getSession(e),items:[],next_seq:s}}}async getMessages(e,s){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/messages?first=500${s===void 0?"":`&after_seq=${s}`}`)}async getAttachments(e,s){try{return(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/attachments${s?`?view=${s}`:""}`)).items??[]}catch(r){if(r instanceof C&&(r.status===403||r.status===404))return[];throw r}}async requireSessionAttachments(){let e=await this.request("/deployment",{headers:{"cache-control":"no-cache"}});if(e.session_attachments!==!0){let s=typeof e.reason_version==="string"&&/^\d+\.\d+(?:\.\d+)?$/.test(e.reason_version)?`Agent ${e.reason_version}`:null,r=typeof e.commit_sha==="string"&&/^[a-f0-9]{40,64}$/i.test(e.commit_sha)?`server ${e.commit_sha.slice(0,12)}`:null,a=[s,r].filter(Boolean).join(", ");throw Error(`This server does not support Session image attachments: ${new URL(this.credentials.apiOrigin).host}${a?` (${a})`:""}. The API server needs an attachment-capable deployment; updating the Agent version alone is not enough. Your image was not sent; retry after the server update.`)}}async sendMessage(e,s,r={}){if(r.attachments?.length)await this.requireSessionAttachments();return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:{message:s,...r.attachments?.length?{attachments:r.attachments}:{},...r.model?{model:r.model}:{},...r.reasoningEffort?{reasoning_effort:r.reasoningEffort}:{},...r.target?{target:r.target}:{},...r.delivery?{delivery:r.delivery}:{}}})}async steerQueuedMessage(e,s){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/messages/${encodeURIComponent(s)}/steer`,{method:"POST",body:{}})}async withdrawQueuedMessage(e,s){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/messages/${encodeURIComponent(s)}/queued`,{method:"DELETE"})}async getConversation(e){let s=[],r=null;for(let a=0;a<50;a+=1){let l=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/conversation${r?`?after=${encodeURIComponent(r)}`:""}`);if(s.push(...l.items??[]),!l.has_next_page||!l.end_cursor)break;r=l.end_cursor}return s}createSharedLink(e,s){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/shared-links`,{method:"POST",body:{url:s.url,...s.label?{label:s.label}:{},...s.expiresInSeconds!==void 0?{expires_in_seconds:s.expiresInSeconds}:{}}})}sessionAction(e,s,r={}){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/${s}`,{method:"POST",body:r})}renameSession(e,s){return this.sessionAction(e,"rename",{title:s||null})}moveSessionToProject(e,s){return this.sessionAction(e,"project",{project_id:s})}compactSession(e){return this.sessionAction(e,"compact")}retrySession(e){return this.sessionAction(e,"retry")}rewindSession(e,s){return this.sessionAction(e,"rewind",{message_id:s.messageId,content:s.content,request_id:s.requestId})}forkSession(e,s){return this.sessionAction(e,"fork",{...s.message?{message:s.message}:{},client_session_id:s.clientSessionId})}cancelSession(e,s={}){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/cancel`,{method:"POST",body:s.mode==="hard"?{mode:"hard"}:{}})}sessionPath(e,s=""){return`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}${s}`}async archiveSession(e){await this.request(this.sessionPath(e,"/archive"),{method:"POST",body:{}})}async unarchiveSession(e){await this.request(this.sessionPath(e,"/unarchive"),{method:"POST",body:{}})}async deleteSession(e){await this.request(this.sessionPath(e),{method:"DELETE"})}async listSessionTags(e){return m(x,await this.request(this.sessionPath(e,"/tags")),"invalid_session_tags").tags}async appendSessionTags(e,s){let r=await this.request(this.sessionPath(e,"/tags"),{method:"POST",body:{tags:s}});return m(x,r,"invalid_session_tags").tags}async sessionInsight(e,s=!1){let r=await this.request(this.sessionPath(e,s?"/insights/generate":"/insights"),s?{method:"POST",body:{}}:{});return m(ae,r,"invalid_session_insight")}async listAutomations(){let e=[],s=null;for(let r=0;r<20;r+=1){let a=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/automations?first=100${s?`&after=${encodeURIComponent(s)}`:""}`),l=m(oe,a,"invalid_automation_list");if(e.push(...l.items),s=l.has_next_page?l.end_cursor??null:null,!s)break}return e}async createScheduledAutomation(e,s){let r=`/organizations/${encodeURIComponent(this.credentials.orgId)}/automations`,a=m(A,await this.request(r,{method:"POST",body:{name:e.name,instructions:e.instructions,...e.repo?{repo:e.repo.full_name,provider:e.repo.provider}:{}}}),"invalid_automation");try{await this.request(`${r}/${encodeURIComponent(a.id)}/triggers`,{method:"POST",body:s})}catch(l){throw await this.deleteAutomation(a.id).catch(()=>{return}),l}return a}async setAutomationEnabled(e,s){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/automations/${encodeURIComponent(e)}`,{method:"PATCH",body:{enabled:s}})}async deleteAutomation(e){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/automations/${encodeURIComponent(e)}`,{method:"DELETE"})}async transcribe(e,s){let r=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/transcribe`,{method:"POST",raw:{bytes:e,contentType:s}});return m(n({transcript:t()}),r,"invalid_transcript").transcript}async listMcpServers(){let e=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/mcp-servers`);return m(ie,e,"invalid_mcp_server_list").items}async setSkillEnabled(e,s){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/skills/${encodeURIComponent(e)}`,{method:"PUT",body:{is_enabled:s}})}}
3
- export{ya,be,wa,C,eo,me};
2
+ import{Pa}from"./vm-hands-entry-lite-cmmb9k3g.js";import{R}from"./vm-hands-entry-lite-z65xva21.js";import{W}from"./vm-hands-entry-lite-33at6g06.js";import{Q,oo,ve,so}from"./vm-hands-entry-lite-2qfmabqn.js";import{Ir}from"./vm-hands-entry-lite-1w39j6vz.js";import{t,o,_,d,n,ll,we,c,i}from"./vm-hands-entry-lite-zpvr7wc6.js";var E=/^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$/;function k(e){let s=typeof e==="string"?E.exec(e):null;return s?{major:Number(s[1]),minor:Number(s[2])}:null}import{createHash as q,randomBytes as P}from"crypto";import{createInterface as M}from"readline";var v=["run","mcp:read","mcp:write","secrets:read","secrets:write","sessions:read","sessions:debug","devices:read","devices:write","devices:use","ssh:write","knowledge:read","memory:read","memory:write","skills:read","skills:write","repos:read","repos:write","reviews:read","reviews:write","deployment:read","analytics:read","org:read","org:write","attachments:read","attachments:write","guardrails:read","guardrails:write","network:read","network:write","automations:read","automations:write","agent_auth:read"];var Ge=v.filter((e)=>e!=="network:read"&&e!=="network:write");class y extends Error{oauthCode;constructor(e,s=null){super(e);this.oauthCode=s;this.name="LoginError"}}function Ca(){let e=P(48).toString("base64url"),s=q("sha256").update(e).digest("base64url");return{verifier:e,challenge:s,state:P(32).toString("base64url")}}function z(e,s){let r=typeof e.error==="string"?e.error:null,a=typeof e.error_description==="string"?e.error_description:r?r:s;return new y(a,r)}async function L(e,s,r,a){let l=await r(`${e}/mcp/oauth/token`,{method:"POST",redirect:"error",headers:{"content-type":"application/x-www-form-urlencoded"},body:s,signal:a}),u=await l.json().catch(()=>({}));if(!l.ok)throw z(u,`OAuth token request failed (${l.status})`);return u}var j=1e4;async function D(e,s={}){let r=s.fetchImpl??fetch,a=await L(e.apiOrigin,new URLSearchParams({grant_type:"refresh_token",client_id:e.clientId,refresh_token:e.refreshToken}),r,AbortSignal.timeout(j)).catch((u)=>{if(u instanceof Error&&u.name==="TimeoutError")throw new y("Reason did not answer the login refresh in time. Check the network and retry.");throw u});if(typeof a.access_token!=="string"||typeof a.refresh_token!=="string"||typeof a.expires_in!=="number")throw new y("Reason returned an incomplete refreshed login.");let l={...e,accessToken:a.access_token,refreshToken:a.refresh_token,expiresAt:new Date(Date.now()+a.expires_in*1000).toISOString(),scopes:typeof a.scope==="string"?a.scope.split(/\s+/).filter(Boolean):e.scopes};return oo(l,s.path??Q()),l}var w=new Map,N=2000,H=100;function I(e,s){if(!s)return e;if(s.aborted)return Promise.reject(s.reason);return new Promise((r,a)=>{let l=()=>a(s.reason);s.addEventListener("abort",l,{once:!0}),e.then(r,a).finally(()=>s.removeEventListener("abort",l))})}async function be(e={}){let s=e.path??Q(),r=ve(s);if(!r)return null;let a=e.apiOrigin??R(process.env,"REASON_API_URL")?.trim();if(a&&!W(r.apiOrigin,new URL(a).origin))return null;if(!(Date.parse(r.expiresAt)<=Date.now()+60000)&&(!e.forceRefresh||e.refused!==void 0&&r.accessToken!==e.refused))return r;let u=[s,r.apiOrigin,r.clientId,r.refreshToken].join("\x00"),g=w.get(u);if(g)return I(g,e.signal);let h;return h=D(r,{fetchImpl:e.fetchImpl,path:s}).catch(async(p)=>{if(!(p instanceof y)||p.oauthCode!=="invalid_grant"&&p.oauthCode!=="invalid_client")throw p;let S=(f)=>f!==null&&(p.oauthCode==="invalid_client"?f.clientId!==r.clientId:f.refreshToken!==r.refreshToken),O=Date.now()+N;while(!S(ve(s))&&Date.now()<O)await new Promise((f)=>setTimeout(f,H));if(S(ve(s)))return be({fetchImpl:e.fetchImpl,path:s});return so(s),null}).finally(()=>{if(w.get(u)===h)w.delete(u)}),w.set(u,h),I(h,e.signal)}function Aa(e,s){return new Promise((r)=>{let a=M({input:e}),l=!1,u=(h)=>{if(l)return;l=!0,s.removeEventListener("abort",g),a.close(),e.pause(),r(h)},g=()=>u(null);s.addEventListener("abort",g,{once:!0}),a.once("line",(h)=>u(h)),a.once("close",()=>u(null))})}var F=n({label:t(),used_percent:o().min(0).max(100).nullable(),resets_at:t().nullable(),exhausted:_().nullable()}),B=n({groups:d(n({selectable:_().optional(),accounts:d(n({source_id:t().min(1),model_ids:d(t().min(1)).optional()}))}))});function G(e){let s=B.safeParse(e);if(!s.success)return;return s.data.groups.some((r)=>r.selectable!==!1&&r.accounts.some((a)=>a.model_ids===void 0||a.model_ids.length>0))}class C extends Error{status;code;suggestedModel;retryAfterMs;resolutionReason;refusal;constructor(e,s,r,a,l,u,g){super(r);this.status=e;this.code=s;this.suggestedModel=a;this.retryAfterMs=l;this.resolutionReason=u;this.refusal=g;this.name="ApiError"}static rateLimitDelayMs(e,s){if(!(e instanceof C)||e.status!==429)return null;return Math.min(60000,Math.max(s,e.retryAfterMs??0))}}var J=["minimal","low","medium","high","xhigh","max"],K=n({id:t().min(1),kind:t(),name:t(),custom_name:t().nullish(),status:t(),online:_(),compatible:_().optional(),compatibility_reason:t().nullish(),folder_lane_of:t().nullish(),roots:d(n({id:t().min(1),label:t()}))}),V=n({devices:d(K),end_cursor:t().nullish(),has_next_page:_().optional()}),Y=n({id:t().min(1),name:t()}),Z=n({items:d(Y)}),X=n({id:t().min(1),name:t(),main:_(),mine:_(),session_id:t().nullish(),appearance:n({color:t().nullish()}).nullish().catch(null)}),ee=n({items:d(X)}),ne=n({skill_id:t().min(1),name:t(),description:t().nullish(),activation_keywords:d(t()).default([]),is_enabled:_().default(!0)}),te=n({items:d(ne).default([])}),se=n({id:t().min(1),kind:t(),enabled:_(),schedule:n({expression:t().nullish(),every_seconds:o().nullish(),next_run_at:t().nullish()}).nullish(),github:n({event:t().nullish(),action:t().nullish(),repo:t().nullish()}).nullish(),last_fired_at:t().nullish()}),A=n({id:t().min(1),name:t().nullish(),instructions:t().nullish(),enabled:_(),triggers:d(se).default([])}),oe=n({items:d(A).default([]),end_cursor:t().nullish(),has_next_page:_().optional()}),re=n({id:t().min(1),slug:t().nullish(),name:t(),description:t().nullish(),transport:t().nullish(),url:t().nullish(),enabled:_()}),ie=n({items:d(re).default([])}),ae=n({status:t(),summary:t().nullish(),category:t().nullish(),outcome:t().nullish(),message_count:o().nullish(),pr_url:t().nullish(),cost_usd:o().nullish(),generated_at:t().nullish()}),x=n({tags:d(t()).default([])}),le=c(["linux","macos"]),T=n({id:t().min(1),name:t().min(1),platform:le.nullable(),workers:n({total:o().int(),online:o().int(),busy:o().int(),idle:o().int()}),sessions:n({queued:o().int(),running:o().int()})}),ce=n({machines:d(T)}),de=n({machine:T}),ue=n({deleted:i(!0),revoked_workers:o().int(),revoked_tokens:o().int()}),ge=n({token:n({id:t().min(1),machine_id:t().min(1),token_prefix:t()}),secret:t().startsWith("rmt_")}),U=ll({machine_id:t().min(1),machine_name:t().min(1)}),he=U.extend({organization_id:t().min(1)}),tn=n({id:t().min(1),name:t().min(1),state:c(["waiting","placed"]),queue_position:o().int().nullable()});var sn=we([n({kind:i("cloud")}),n({kind:c(["mac","headless"]),device_id:t().min(1),root_id:t().min(1)})]);function m(e,s,r){let a=e.safeParse(s);if(!a.success)throw new C(502,r,"Reason returned an unexpected response.");return a.data}var pe=n({error:n({type:t(),message:t()})});function b(e,s,r){let a=pe.safeParse(s),l=typeof s.error==="string"?s.error:a.success?a.data.error.type:`http_${e}`,u=typeof s.detail==="string"?s.detail:typeof s.message==="string"?s.message:a.success?a.data.error.message:`Reason request failed (${e}${typeof s.error==="string"?` ${s.error}`:""})`,g=l==="github_connection_required"&&typeof s.connect_url==="string"&&/^https?:\/\//.test(s.connect_url)?` Connect it at ${s.connect_url}`:"",h=r===null||r.trim()===""?NaN:Number(r);return new C(e,l,`${u}${g}`,typeof s.suggested_model==="string"?s.suggested_model:void 0,Number.isFinite(h)&&h>=0?h*1000:void 0,typeof s.resolution_reason==="string"?s.resolution_reason:void 0,typeof s.code==="string"?{code:s.code,...typeof s.billing_path==="string"&&/^\/(?![/\\])/.test(s.billing_path)?{billingPath:s.billing_path}:{}}:void 0)}async function no(e){let s=await(e.fetchImpl??fetch)(`${e.apiOrigin}/v3/machines/enrollment-tickets`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,accept:"application/json","content-type":"application/json"},body:JSON.stringify(e.body),signal:AbortSignal.timeout(30000),redirect:"error"}),r=await s.json().catch(()=>({}));if(!s.ok)throw b(s.status,r,s.headers.get("retry-after"));return m(he,r,"invalid_machine_ticket")}var fe=n({items:d(n({name:t()}))}),_e=n({name:t(),scope:t(),result:c(["created","updated"]).optional(),warning:n({message:t()}).optional()});class me{options;credentials;constructor(e,s={}){this.options=s;this.credentials=e}trackEvent(e,s={}){}async request(e,s={}){let{status:r,headers:a,json:l}=await this.exchange(e,s);if(r<200||r>299)throw b(r,l,a.get("retry-after"));return l}async exchange(e,s={},r=!1){let a=this.options.fetchImpl??fetch;if(!r&&s.retryUnauthorized!==!1)await this.renewBeforeExpiry(a,s.signal);let l=await a(`${this.credentials.apiOrigin}/v3${e}`,{method:s.method??"GET",headers:{authorization:`Bearer ${this.credentials.accessToken}`,accept:"application/json","user-agent":Ir,"x-reason-agent":"Reason CLI","x-client-surface":this.options.clientSurface??"direct_cli",...s.raw?{"content-type":s.raw.contentType}:s.body===void 0?{}:{"content-type":"application/json"},...s.headers,...s.ifNoneMatch?{"if-none-match":s.ifNoneMatch}:{}},body:s.raw?s.raw.bytes:s.body===void 0?void 0:JSON.stringify(s.body),signal:s.signal,redirect:s.ifNoneMatch?"manual":"error"}),u=await l.json().catch(()=>({}));if(l.status===401&&!r&&s.retryUnauthorized!==!1&&this.credentials.credentialKind!=="api_key"){let g=await be({fetchImpl:a,path:this.options.credentialsPath,forceRefresh:!0,refused:this.credentials.accessToken,signal:s.signal});if(g)return this.credentials=g,this.exchange(e,s,!0)}return{status:l.status,headers:l.headers,json:u}}async renewBeforeExpiry(e,s){let r=this.credentials;if(r.credentialKind==="api_key"||!(Date.parse(r.expiresAt)<=Date.now()+60000))return;let a=await be({fetchImpl:e,path:this.options.credentialsPath,signal:s}).catch(()=>null);if(a&&a.apiOrigin===r.apiOrigin&&a.orgId===r.orgId&&a.clientId===r.clientId)this.credentials=a}createHeadlessDeviceEnrollmentTicket(e){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/enrollment-tickets`,{method:"POST",body:e,signal:AbortSignal.timeout(30000),retryUnauthorized:!1})}async enrollHeadlessDevice(e){try{return await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/enrollments`,{method:"POST",body:e,signal:AbortSignal.timeout(30000),retryUnauthorized:!1})}catch(s){if(s instanceof C&&(s.status===404||s.status===405||s.status===403&&s.code==="endpoint_not_available"))return null;throw s}}addDeviceRoot(e,s){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/${encodeURIComponent(e)}/roots`,{method:"POST",body:s,signal:AbortSignal.timeout(30000)})}removeDeviceRoot(e,s){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/${encodeURIComponent(e)}/roots/${encodeURIComponent(s)}`,{method:"DELETE",signal:AbortSignal.timeout(30000)})}machinePath(e,s=""){let r=`/organizations/${encodeURIComponent(this.credentials.orgId)}/machines`;return e===void 0?r:`${r}/${encodeURIComponent(e)}${s}`}async listMachines(){return m(ce,await this.request(this.machinePath()),"invalid_machine_list").machines}async createMachine(e){let s=await this.request(this.machinePath(),{method:"POST",body:{name:e.name,...e.platform?{platform:e.platform}:{}}});return m(de,s,"invalid_machine").machine}async deleteMachine(e){let s=await this.request(this.machinePath(e),{method:"DELETE"});return m(ue,s,"invalid_machine_deletion")}async listSecretNames(e){let s=await this.request(`${this.secretsPath()}?scope=${e}`);return m(fe,s,"invalid_secret_list").items.map((r)=>r.name)}async setSecret(e){let s=await this.request(this.secretsPath(),{method:"POST",body:e});return m(_e,s,"invalid_secret_write")}secretsPath(){return`/organizations/${encodeURIComponent(this.credentials.orgId)}/secrets`}async createMachineToken(e){let s=await this.request(this.machinePath(e,"/tokens"),{method:"POST",body:{}});return m(ge,s,"invalid_machine_token")}async createMachineEnrollmentTicket(e,s){let r=await this.request(this.machinePath(e,"/enrollment-tickets"),{method:"POST",body:s,signal:AbortSignal.timeout(30000),retryUnauthorized:!1});return m(U,r,"invalid_machine_ticket")}self(e){return this.request("/self",{signal:e})}submitFeedback(e){return this.request("/feedback",{method:"POST",body:e,signal:AbortSignal.timeout(30000)})}agentNetwork(e=AbortSignal.timeout(30000)){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network`,{signal:e})}startAgentNetwork(e){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network`,{method:"POST",body:e,signal:AbortSignal.timeout(30000)})}rotateAgentNetwork(e){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network`,{method:"PUT",body:e,signal:AbortSignal.timeout(30000)})}async registerNetworkTeam(e){await this.request("/network/teams",{method:"POST",body:e,signal:AbortSignal.timeout(30000)})}async claimAgentNetworkRelayJob(e,s){let r=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network/relay/claim`,{method:"POST",body:e,signal:s});return m(Pa,r,"invalid_agent_network_job")}async completeAgentNetworkRelayJob(e,s){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network/relay/jobs/${encodeURIComponent(e)}`,{method:"POST",body:s,signal:AbortSignal.timeout(30000)})}async recordAgentNetworkRelayReplies(e){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-network/relay/replies`,{method:"POST",body:e,signal:AbortSignal.timeout(30000)})}async workspaceMembers(){return((await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/members/users`,{signal:AbortSignal.timeout(30000)})).items??[]).flatMap((s)=>typeof s.email==="string"?[{email:s.email,role:typeof s.role==="string"?s.role:"member"}]:[])}claimExistingCliPairing(e){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/onboarding/import/pairing/claim-existing`,{method:"POST",body:{pairing_code:e}})}async claudeCodeSignIn(e){return(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/provider-credentials`,{retryUnauthorized:!1,signal:e?AbortSignal.any([e,AbortSignal.timeout(15000)]):AbortSignal.timeout(15000)})).claude_code_sign_in===!0}connectAnthropicProvider(e,s,r={}){let a=e.kind==="setup_token"?{setup_token:e.token}:{access_token:e.credential.access,refresh_token:e.credential.refresh,expires_at:new Date(e.credential.expires).toISOString()};return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/provider-credentials/anthropic`,{method:"POST",retryUnauthorized:r.retryUnauthorized,signal:r.signal,body:{...a,...s?{account_key:s}:{}}})}async listRepositories(){return((await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/repositories`)).items??[]).flatMap((s)=>{let r=typeof s.full_name==="string"?s.full_name:typeof s.repo_full_name==="string"?s.repo_full_name:null;if(!r)return[];return[{repo_id:typeof s.repo_id==="string"?s.repo_id:void 0,full_name:r,provider:s.provider==="gitlab"?"gitlab":"github",default_branch:typeof s.default_branch==="string"?s.default_branch:null,private:typeof s.private==="boolean"?s.private:void 0}]})}async listProjects(){let e=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/projects`),s=Z.safeParse(e);if(!s.success)throw new C(502,"invalid_project_list","Reason returned an unexpected project list.");return s.data.items}async listReasons(){let e=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/reasons`);return m(ee,e,"invalid_reason_list").items}async openReasonConversation(e){let s=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/reasons/${encodeURIComponent(e)}/conversation`,{method:"POST"});return m(n({session_id:t().min(1)}),s,"invalid_reason_conversation").session_id}async listSkills(){try{let e=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/skills`);return m(te,e,"invalid_skill_list").items}catch(e){if(e instanceof C&&(e.status===403||e.status===404))return[];throw e}}async listDevices(){let e=[],s=null;for(let r=0;r<50;r+=1){let a=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices${s?`?after=${encodeURIComponent(s)}`:""}`),l=V.safeParse(a);if(!l.success)throw new C(502,"invalid_device_list","Reason returned an unexpected machine list.");if(e.push(...l.data.devices),s=l.data.has_next_page?l.data.end_cursor??null:null,!s)break}return e}async listModels(){try{let s=((await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-auth/models`)).models??[]).filter((l)=>l.hidden!==!0),r=s.filter((l)=>l.available!==!1).map(({reasoning_efforts:l,hidden:u,available:g,...h})=>({...h,...Array.isArray(l)?{reasoning_efforts:J.filter((p)=>l.includes(p))}:{}})),a=new Set(r.map((l)=>l.detail));return{models:r.length>1&&a.size===1?r.map(({detail:l,...u})=>u):r,runnable:r.length>0||s.length===0}}catch(e){if(e instanceof C&&(e.status===403||e.status===404))return{models:[],runnable:!0};throw e}}async getAgentVersion(e){try{let s=await this.request("/deployment",{signal:e,retryUnauthorized:!1});return k(s.reason_version)?s.reason_version:null}catch{return null}}async getUsageQuota(){try{let e=F.safeParse(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/usage/quota`));if(!e.success)return null;let s;try{s=G(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-auth/models`))}catch{}return{...e.data,own_inference:s}}catch(e){if(e instanceof C&&(e.status===403||e.status===404))return null;throw e}}async listSessionFields(e){let s=new URLSearchParams({first:String(Math.min(Math.max(e.first,1),200)),status:e.status??"active"});if(e.origin)s.set("origin",e.origin);s.set("fields",e.fields.join(","));let r=`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions?${s.toString()}`,{status:a,headers:l,json:u}=await this.exchange(r,e.etag?{ifNoneMatch:e.etag}:{});if(a===304)return null;if(a<200||a>299)throw b(a,u,l.get("retry-after"));return{items:Array.isArray(u.items)?u.items:[],etag:l.get("etag")}}async listSessions(e=50,s,r={}){let a=new URLSearchParams({first:String(Math.min(Math.max(e,1),200)),status:r.status??"active"});if(s)a.set("project_id",s);if(r.origin)a.set("origin",r.origin);return(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions?${a.toString()}`)).items??[]}getSession(e,s){let r=s?.fields.length?`?fields=${encodeURIComponent(s.fields.join(","))}`:"";return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}${r}`)}async prestartSession(e){let s=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/prestart`,{method:"POST",body:{client_session_id:e}});return s?.status==="starting"||s?.status==="ready"}async createSession(e){let s=e.mode==="ephemeral"||e.workspaceOwnership==="externally-managed";if(e.attachments?.length)await this.requireSessionAttachments();if(s||e.runtimeProfile){let l=await this.request("/deployment");if(s&&(!Array.isArray(l.session_modes)||!l.session_modes.includes(e.mode??"standard")||!Array.isArray(l.workspace_ownerships)||!l.workspace_ownerships.includes(e.workspaceOwnership??"managed")))throw Error("Deployment does not support the requested Session policy; refusing to create a Session.");if(e.runtimeProfile&&(!Array.isArray(l.experimental_runtime_profiles)||!l.experimental_runtime_profiles.includes(e.runtimeProfile)))throw Error("Deployment does not support the requested runtime profile; refusing to create a Session.")}let r=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions`,{method:"POST",body:{prompt:e.prompt,...e.attachments?.length?{attachments:e.attachments}:{},...e.mode?{mode:e.mode}:{},...e.workspaceOwnership?{workspace_ownership:e.workspaceOwnership}:{},...e.target?{target:e.target}:{},...e.repo?{repo:e.repo}:{},...e.provider?{provider:e.provider}:{},...e.model?{model:e.model}:{},...e.reasoningEffort?{reasoning_effort:e.reasoningEffort}:{},...e.runtimeProfile?{experimental_runtime_profile:e.runtimeProfile}:{},...e.ref?{ref:e.ref}:{},...e.branch?{branch:e.branch}:{},...e.completionMode?{completion_mode:e.completionMode}:{},...e.env&&Object.keys(e.env).length>0?{env:e.env}:{},...e.clientSessionId?{client_session_id:e.clientSessionId}:{},...e.longRunning?{long_running:{enabled:!0}}:{},...e.spendLimitRcu?{spend_limit_rcu:e.spendLimitRcu}:{},idempotency_key:`cli-${crypto.randomUUID()}`}}),a=await this.getSession(r.session_id);if(s){let l=a.session_policy,u=["memoryRead","memoryWrite","skills","inheritedInstructions","integrations","secretInjection"];if(!l||l.version!==1||l.mode!==(e.mode??"standard")||l.workspaceOwnership!==(e.workspaceOwnership??"managed")||!l.components||u.some((g)=>l.components[g]!==!0))throw await this.cancelSession(r.session_id),Error("Server did not attest the requested Session policy; cancellation requested.")}if(e.runtimeProfile&&a.experimental_runtime_profile!==e.runtimeProfile)throw await this.cancelSession(r.session_id),Error("Server did not attest the requested runtime profile; cancellation requested.");return a}async getEvents(e,s=-1,r={}){try{return await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/events?after_seq=${s}&limit=500${r.waitMs?`&wait_ms=${r.waitMs}`:""}`,r.signal?{signal:r.signal}:{})}catch(a){if(!(a instanceof C)||a.status!==403&&a.status!==404)throw a;return{session:await this.getSession(e),items:[],next_seq:s}}}async getMessages(e,s){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/messages?first=500${s===void 0?"":`&after_seq=${s}`}`)}async getAttachments(e,s){try{return(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/attachments${s?`?view=${s}`:""}`)).items??[]}catch(r){if(r instanceof C&&(r.status===403||r.status===404))return[];throw r}}async requireSessionAttachments(){let e=await this.request("/deployment",{headers:{"cache-control":"no-cache"}});if(e.session_attachments!==!0){let s=typeof e.reason_version==="string"&&/^\d+\.\d+(?:\.\d+)?$/.test(e.reason_version)?`Agent ${e.reason_version}`:null,r=typeof e.commit_sha==="string"&&/^[a-f0-9]{40,64}$/i.test(e.commit_sha)?`server ${e.commit_sha.slice(0,12)}`:null,a=[s,r].filter(Boolean).join(", ");throw Error(`This server does not support Session image attachments: ${new URL(this.credentials.apiOrigin).host}${a?` (${a})`:""}. The API server needs an attachment-capable deployment; updating the Agent version alone is not enough. Your image was not sent; retry after the server update.`)}}async sendMessage(e,s,r={}){if(r.attachments?.length)await this.requireSessionAttachments();return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:{message:s,...r.attachments?.length?{attachments:r.attachments}:{},...r.model?{model:r.model}:{},...r.reasoningEffort?{reasoning_effort:r.reasoningEffort}:{},...r.target?{target:r.target}:{},...r.delivery?{delivery:r.delivery}:{}}})}async steerQueuedMessage(e,s){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/messages/${encodeURIComponent(s)}/steer`,{method:"POST",body:{}})}async withdrawQueuedMessage(e,s){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/messages/${encodeURIComponent(s)}/queued`,{method:"DELETE"})}async getConversation(e){let s=[],r=null;for(let a=0;a<50;a+=1){let l=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/conversation${r?`?after=${encodeURIComponent(r)}`:""}`);if(s.push(...l.items??[]),!l.has_next_page||!l.end_cursor)break;r=l.end_cursor}return s}createSharedLink(e,s){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/shared-links`,{method:"POST",body:{url:s.url,...s.label?{label:s.label}:{},...s.expiresInSeconds!==void 0?{expires_in_seconds:s.expiresInSeconds}:{}}})}sessionAction(e,s,r={}){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/${s}`,{method:"POST",body:r})}renameSession(e,s){return this.sessionAction(e,"rename",{title:s||null})}moveSessionToProject(e,s){return this.sessionAction(e,"project",{project_id:s})}compactSession(e){return this.sessionAction(e,"compact")}retrySession(e){return this.sessionAction(e,"retry")}rewindSession(e,s){return this.sessionAction(e,"rewind",{message_id:s.messageId,content:s.content,request_id:s.requestId})}forkSession(e,s){return this.sessionAction(e,"fork",{...s.message?{message:s.message}:{},client_session_id:s.clientSessionId})}cancelSession(e,s={}){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}/cancel`,{method:"POST",body:s.mode==="hard"?{mode:"hard"}:{}})}sessionPath(e,s=""){return`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent(e)}${s}`}async archiveSession(e){await this.request(this.sessionPath(e,"/archive"),{method:"POST",body:{}})}async unarchiveSession(e){await this.request(this.sessionPath(e,"/unarchive"),{method:"POST",body:{}})}async deleteSession(e){await this.request(this.sessionPath(e),{method:"DELETE"})}async listSessionTags(e){return m(x,await this.request(this.sessionPath(e,"/tags")),"invalid_session_tags").tags}async appendSessionTags(e,s){let r=await this.request(this.sessionPath(e,"/tags"),{method:"POST",body:{tags:s}});return m(x,r,"invalid_session_tags").tags}async sessionInsight(e,s=!1){let r=await this.request(this.sessionPath(e,s?"/insights/generate":"/insights"),s?{method:"POST",body:{}}:{});return m(ae,r,"invalid_session_insight")}async listAutomations(){let e=[],s=null;for(let r=0;r<20;r+=1){let a=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/automations?first=100${s?`&after=${encodeURIComponent(s)}`:""}`),l=m(oe,a,"invalid_automation_list");if(e.push(...l.items),s=l.has_next_page?l.end_cursor??null:null,!s)break}return e}async createScheduledAutomation(e,s){let r=`/organizations/${encodeURIComponent(this.credentials.orgId)}/automations`,a=m(A,await this.request(r,{method:"POST",body:{name:e.name,instructions:e.instructions,...e.repo?{repo:e.repo.full_name,provider:e.repo.provider}:{}}}),"invalid_automation");try{await this.request(`${r}/${encodeURIComponent(a.id)}/triggers`,{method:"POST",body:s})}catch(l){throw await this.deleteAutomation(a.id).catch(()=>{return}),l}return a}async setAutomationEnabled(e,s){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/automations/${encodeURIComponent(e)}`,{method:"PATCH",body:{enabled:s}})}async deleteAutomation(e){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/automations/${encodeURIComponent(e)}`,{method:"DELETE"})}async transcribe(e,s){let r=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/transcribe`,{method:"POST",raw:{bytes:e,contentType:s}});return m(n({transcript:t()}),r,"invalid_transcript").transcript}async listMcpServers(){let e=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/mcp-servers`);return m(ie,e,"invalid_mcp_server_list").items}async setSkillEnabled(e,s){await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/skills/${encodeURIComponent(e)}`,{method:"PUT",body:{is_enabled:s}})}}
3
+ export{Ca,be,Aa,C,no,me};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Ge,Zt,X}from"./vm-hands-entry-lite-9g52kxyj.js";import{execFileSync as l}from"child_process";import{existsSync as c,realpathSync as a}from"fs";import{userInfo as f}from"os";import{isAbsolute as u,join as t,normalize as d,parse as p}from"path";function s(){let r=d(f().homedir);if(!u(r)||r===p(r).root)throw Error("Could not resolve the canonical user home.");return r}function Lc(r){return p(r).root===r}var $c=(r)=>`Reason can't work in ${r}, the top of a drive: use a folder inside it, such as a project folder`;function Ve(r,n,e=s()){let i=X(n);if(n.kind==="managed"&&n.base){let o=a(e);return{anchor:o,boundary:t(o,n.base),path:t(o,i)}}if(n.kind==="root"&&Zt(n.path)){let o=a(e);return{anchor:o,boundary:t(o,Ge),path:t(o,i)}}return{anchor:r,boundary:r,path:t(r,i)}}function St(r=s()){return t(r,".config")}function Mc(){if(process.platform!=="darwin")return null;try{let r=l("/usr/bin/getconf",["DARWIN_USER_DIR"],{encoding:"utf8",timeout:5000}).trim();return u(r)?a(r):null}catch{return null}}function Bc(r=s()){let n=t(r,"Library","Application Support","Ara"),e=t(r,"Library","Application Support","Reason");return c(n)&&!c(e)?n:e}
3
- export{s,Lc,$c,Ve,St,Mc,Bc};
2
+ import{Ke,Zt,X}from"./vm-hands-entry-lite-kbnxk71q.js";import{execFileSync as l}from"child_process";import{existsSync as c,realpathSync as a}from"fs";import{userInfo as f}from"os";import{isAbsolute as u,join as t,normalize as d,parse as p}from"path";function s(){let r=d(f().homedir);if(!u(r)||r===p(r).root)throw Error("Could not resolve the canonical user home.");return r}function Uc(r){return p(r).root===r}var zc=(r)=>`Reason can't work in ${r}, the top of a drive: use a folder inside it, such as a project folder`;function Ge(r,n,e=s()){let i=X(n);if(n.kind==="managed"&&n.base){let o=a(e);return{anchor:o,boundary:t(o,n.base),path:t(o,i)}}if(n.kind==="root"&&Zt(n.path)){let o=a(e);return{anchor:o,boundary:t(o,Ke),path:t(o,i)}}return{anchor:r,boundary:r,path:t(r,i)}}function Et(r=s()){return t(r,".config")}function qc(){if(process.platform!=="darwin")return null;try{let r=l("/usr/bin/getconf",["DARWIN_USER_DIR"],{encoding:"utf8",timeout:5000}).trim();return u(r)?a(r):null}catch{return null}}function Wc(r=s()){let n=t(r,"Library","Application Support","Ara"),e=t(r,"Library","Application Support","Reason");return c(n)&&!c(e)?n:e}
3
+ export{s,Uc,zc,Ge,Et,qc,Wc};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as se,spawn as E}from"child_process";var vc="h264_ws_v1",Sc="video",Sr=["smooth","sharp","data_saver","balanced"];var Ec="video_presets";var M=8388608,O=65536,kc="control",xc="v1",X=200;function ts(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t,n=(i)=>typeof i==="string"&&i.length>0&&i.length<=X;if(Object.keys(e).length!==2||!n(e.user_id)||!n(e.name))return null;return{user_id:e.user_id,name:e.name}}var Cc="windows",Ac="v1",Pc="look",Rc="v1",J=["reason","grok"];function rs(t){return typeof t==="string"&&J.includes(t)?t:null}var _=200,Z=(t)=>typeof t==="string"&&Sr.includes(t);function Tc(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t;if(Object.keys(e).length!==2||e.format!=="h264_ws_v1"||!Z(e.preset))return null;return{format:"h264_ws_v1",preset:e.preset}}var o={hello:1,frame:2,stats:3,pong:4,serverClipboard:5,error:6,audioHello:7,audio:8,control:9,windows:10,pointer:16,key:17,config:18,ping:19,clientClipboard:20,keyframeRequest:21,ack:22,audioEnable:23,resize:24};class l extends Error{constructor(t){super(t);this.name="DisplayVideoProtocolError"}}var Q=new TextEncoder,ee=new TextDecoder("utf-8",{fatal:!0});function p(t,e){if(e.byteLength+1>M)throw new l("message_too_large");let n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,e.byteLength+1),i.setUint8(4,t),n.set(e,5),n}function w(t){let e=Q.encode(t);if(e.byteLength>O)throw new l("text_too_large");return e}function m(t,e){if(!Number.isInteger(t)||t<0||t>65535)throw new l(`invalid_${e}`);return t}function te(t){if(!Number.isFinite(t))throw new l("invalid_window");return Math.max(-2147483648,Math.min(2147483647,Math.round(t)))}function Rn(t){switch(t.type){case"hello":{let e=w(t.codec),n=new Uint8Array(6+e.byteLength),i=new DataView(n.buffer);return i.setUint16(0,m(t.width,"width")),i.setUint16(2,m(t.height,"height")),i.setUint8(4,Math.max(1,Math.min(240,Math.round(t.fps)))),i.setUint8(5,Sr.indexOf(t.preset)),n.set(e,6),p(o.hello,n)}case"frame":{let e=new Uint8Array(13+t.data.byteLength),n=new DataView(e.buffer);return n.setUint8(0,t.key?1:0),n.setUint32(1,t.seq>>>0),n.setBigUint64(5,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,13),p(o.frame,e)}case"stats":return p(o.stats,w(JSON.stringify(t.stats)));case"pong":case"ping":{let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,t.token),p(t.type==="ping"?o.ping:o.pong,e)}case"serverClipboard":return p(o.serverClipboard,w(t.text));case"clientClipboard":return p(o.clientClipboard,w(t.text));case"error":return p(o.error,w(t.code));case"pointer":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint16(0,m(t.x,"x")),n.setUint16(2,m(t.y,"y")),n.setUint8(4,t.buttons&255),p(o.pointer,e)}case"key":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint8(0,t.down?1:0),n.setUint32(1,t.keysym>>>0),p(o.key,e)}case"config":return p(o.config,Uint8Array.of(Sr.indexOf(t.preset)));case"keyframeRequest":return p(o.keyframeRequest,new Uint8Array(0));case"audioHello":{let e=w(t.codec),n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,t.sampleRate>>>0),i.setUint8(4,t.channels&255),n.set(e,5),p(o.audioHello,n)}case"audio":{let e=new Uint8Array(8+t.data.byteLength);return new DataView(e.buffer).setBigUint64(0,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,8),p(o.audio,e)}case"control":return p(o.control,w(JSON.stringify(t.control)));case"windows":{let e=t.bounds.slice(0,_),n=new Uint8Array(e.length*16),i=new DataView(n.buffer);return e.forEach((s,a)=>{[s.x,s.y,s.width,s.height].forEach((c,d)=>i.setInt32(a*16+d*4,te(c)))}),p(o.windows,n)}case"audioEnable":return p(o.audioEnable,Uint8Array.of(t.on?1:0));case"resize":{let e=new Uint8Array(4),n=new DataView(e.buffer);return n.setUint16(0,m(t.width,"width")),n.setUint16(2,m(t.height,"height")),p(o.resize,e)}case"ack":{let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t.seq>>>0),p(o.ack,e)}}}function L(t){let e=Sr[t];if(!e)throw new l("invalid_preset");return e}function y(t,e){if(t.byteLength!==e)throw new l("invalid_length")}function S(t){if(t.byteLength>O)throw new l("text_too_large");try{return ee.decode(t)}catch{throw new l("invalid_text")}}function ne(t){let e;try{e=JSON.parse(S(t))}catch{throw new l("invalid_stats")}let n=e;if(!n||typeof n!=="object"||["fps","kbps","dropped","restarts","queued_bytes"].some((s)=>typeof n[s]!=="number"||!Number.isFinite(n[s])))throw new l("invalid_stats");return{fps:n.fps,kbps:n.kbps,dropped:n.dropped,restarts:n.restarts,queued_bytes:n.queued_bytes}}function re(t){let e;try{e=JSON.parse(S(t))}catch{throw new l("invalid_control")}let n=e;if(!n||typeof n!=="object"||typeof n.you!=="boolean"||typeof n.same_user!=="boolean")throw new l("invalid_control");let i=n.holder===null?null:ts(n.holder);if(i===null&&n.holder!==null)throw new l("invalid_control");return{holder:i,you:n.you,same_user:n.same_user}}function ie(t,e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(t){case o.hello:if(e.byteLength<6)throw new l("invalid_length");return{type:"hello",width:n.getUint16(0),height:n.getUint16(2),fps:n.getUint8(4),preset:L(n.getUint8(5)),codec:S(e.subarray(6))};case o.frame:if(e.byteLength<14)throw new l("invalid_length");if(n.getUint8(0)>1)throw new l("invalid_frame_flags");return{type:"frame",key:n.getUint8(0)===1,seq:n.getUint32(1),captureMicros:Number(n.getBigUint64(5)),data:e.subarray(13)};case o.stats:return{type:"stats",stats:ne(e)};case o.ping:case o.pong:return y(e,8),{type:t===o.ping?"ping":"pong",token:n.getFloat64(0)};case o.serverClipboard:return{type:"serverClipboard",text:S(e)};case o.clientClipboard:return{type:"clientClipboard",text:S(e)};case o.error:return{type:"error",code:S(e)};case o.pointer:return y(e,5),{type:"pointer",x:n.getUint16(0),y:n.getUint16(2),buttons:n.getUint8(4)};case o.key:if(y(e,5),n.getUint8(0)>1)throw new l("invalid_key_flags");return{type:"key",down:n.getUint8(0)===1,keysym:n.getUint32(1)};case o.config:return y(e,1),{type:"config",preset:L(n.getUint8(0))};case o.keyframeRequest:return y(e,0),{type:"keyframeRequest"};case o.audioHello:if(e.byteLength<5)throw new l("invalid_length");return{type:"audioHello",sampleRate:n.getUint32(0),channels:n.getUint8(4),codec:S(e.subarray(5))};case o.audio:if(e.byteLength<9)throw new l("invalid_length");return{type:"audio",captureMicros:Number(n.getBigUint64(0)),data:e.subarray(8)};case o.audioEnable:if(y(e,1),n.getUint8(0)>1)throw new l("invalid_audio_flags");return{type:"audioEnable",on:n.getUint8(0)===1};case o.resize:return y(e,4),{type:"resize",width:n.getUint16(0),height:n.getUint16(2)};case o.control:return{type:"control",control:re(e)};case o.windows:{if(e.byteLength%16!==0||e.byteLength>_*16)throw new l("invalid_length");let i=[];for(let s=0;s<e.byteLength;s+=16)i.push({x:n.getInt32(s),y:n.getInt32(s+4),width:n.getInt32(s+8),height:n.getInt32(s+12)});return{type:"windows",bounds:i}}case o.ack:return y(e,4),{type:"ack",seq:n.getUint32(0)};default:return null}}class ns{buffer=new Uint8Array(0);push(t){let e=new Uint8Array(this.buffer.byteLength+t.byteLength);e.set(this.buffer),e.set(t,this.buffer.byteLength);let n=[],i=0;while(e.byteLength-i>=4){let s=new DataView(e.buffer,e.byteOffset+i,4).getUint32(0);if(s<1||s>M)throw new l("invalid_message_length");if(e.byteLength-i-4<s)break;let a=e[i+4],c=e.slice(i+5,i+4+s),d=ie(a,c);if(d)n.push(d);i+=4+s}return this.buffer=e.slice(i),n}}var j="/usr/bin/osascript",oe=5000,ae=1048576,ce=String.raw`
2
+ import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as se,spawn as E}from"child_process";var Pc="h264_ws_v1",Rc="video",Ar=["smooth","sharp","data_saver","balanced"];var Tc="video_presets";var M=8388608,D=65536,Ic="control",Dc="v1",X=200;function ls(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t,n=(i)=>typeof i==="string"&&i.length>0&&i.length<=X;if(Object.keys(e).length!==2||!n(e.user_id)||!n(e.name))return null;return{user_id:e.user_id,name:e.name}}var Oc="windows",Nc="v1",Lc="look",$c="v1",J=["reason","grok"];function us(t){return typeof t==="string"&&J.includes(t)?t:null}var _=200,Z=(t)=>typeof t==="string"&&Ar.includes(t);function Mc(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t;if(Object.keys(e).length!==2||e.format!=="h264_ws_v1"||!Z(e.preset))return null;return{format:"h264_ws_v1",preset:e.preset}}var o={hello:1,frame:2,stats:3,pong:4,serverClipboard:5,error:6,audioHello:7,audio:8,control:9,windows:10,pointer:16,key:17,config:18,ping:19,clientClipboard:20,keyframeRequest:21,ack:22,audioEnable:23,resize:24};class l extends Error{constructor(t){super(t);this.name="DisplayVideoProtocolError"}}var Q=new TextEncoder,ee=new TextDecoder("utf-8",{fatal:!0});function p(t,e){if(e.byteLength+1>M)throw new l("message_too_large");let n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,e.byteLength+1),i.setUint8(4,t),n.set(e,5),n}function w(t){let e=Q.encode(t);if(e.byteLength>D)throw new l("text_too_large");return e}function m(t,e){if(!Number.isInteger(t)||t<0||t>65535)throw new l(`invalid_${e}`);return t}function te(t){if(!Number.isFinite(t))throw new l("invalid_window");return Math.max(-2147483648,Math.min(2147483647,Math.round(t)))}function Dn(t){switch(t.type){case"hello":{let e=w(t.codec),n=new Uint8Array(6+e.byteLength),i=new DataView(n.buffer);return i.setUint16(0,m(t.width,"width")),i.setUint16(2,m(t.height,"height")),i.setUint8(4,Math.max(1,Math.min(240,Math.round(t.fps)))),i.setUint8(5,Ar.indexOf(t.preset)),n.set(e,6),p(o.hello,n)}case"frame":{let e=new Uint8Array(13+t.data.byteLength),n=new DataView(e.buffer);return n.setUint8(0,t.key?1:0),n.setUint32(1,t.seq>>>0),n.setBigUint64(5,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,13),p(o.frame,e)}case"stats":return p(o.stats,w(JSON.stringify(t.stats)));case"pong":case"ping":{let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,t.token),p(t.type==="ping"?o.ping:o.pong,e)}case"serverClipboard":return p(o.serverClipboard,w(t.text));case"clientClipboard":return p(o.clientClipboard,w(t.text));case"error":return p(o.error,w(t.code));case"pointer":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint16(0,m(t.x,"x")),n.setUint16(2,m(t.y,"y")),n.setUint8(4,t.buttons&255),p(o.pointer,e)}case"key":{let e=new Uint8Array(5),n=new DataView(e.buffer);return n.setUint8(0,t.down?1:0),n.setUint32(1,t.keysym>>>0),p(o.key,e)}case"config":return p(o.config,Uint8Array.of(Ar.indexOf(t.preset)));case"keyframeRequest":return p(o.keyframeRequest,new Uint8Array(0));case"audioHello":{let e=w(t.codec),n=new Uint8Array(5+e.byteLength),i=new DataView(n.buffer);return i.setUint32(0,t.sampleRate>>>0),i.setUint8(4,t.channels&255),n.set(e,5),p(o.audioHello,n)}case"audio":{let e=new Uint8Array(8+t.data.byteLength);return new DataView(e.buffer).setBigUint64(0,BigInt(Math.max(0,Math.floor(t.captureMicros)))),e.set(t.data,8),p(o.audio,e)}case"control":return p(o.control,w(JSON.stringify(t.control)));case"windows":{let e=t.bounds.slice(0,_),n=new Uint8Array(e.length*16),i=new DataView(n.buffer);return e.forEach((s,a)=>{[s.x,s.y,s.width,s.height].forEach((c,d)=>i.setInt32(a*16+d*4,te(c)))}),p(o.windows,n)}case"audioEnable":return p(o.audioEnable,Uint8Array.of(t.on?1:0));case"resize":{let e=new Uint8Array(4),n=new DataView(e.buffer);return n.setUint16(0,m(t.width,"width")),n.setUint16(2,m(t.height,"height")),p(o.resize,e)}case"ack":{let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t.seq>>>0),p(o.ack,e)}}}function L(t){let e=Ar[t];if(!e)throw new l("invalid_preset");return e}function y(t,e){if(t.byteLength!==e)throw new l("invalid_length")}function S(t){if(t.byteLength>D)throw new l("text_too_large");try{return ee.decode(t)}catch{throw new l("invalid_text")}}function ne(t){let e;try{e=JSON.parse(S(t))}catch{throw new l("invalid_stats")}let n=e;if(!n||typeof n!=="object"||["fps","kbps","dropped","restarts","queued_bytes"].some((s)=>typeof n[s]!=="number"||!Number.isFinite(n[s])))throw new l("invalid_stats");return{fps:n.fps,kbps:n.kbps,dropped:n.dropped,restarts:n.restarts,queued_bytes:n.queued_bytes}}function re(t){let e;try{e=JSON.parse(S(t))}catch{throw new l("invalid_control")}let n=e;if(!n||typeof n!=="object"||typeof n.you!=="boolean"||typeof n.same_user!=="boolean")throw new l("invalid_control");let i=n.holder===null?null:ls(n.holder);if(i===null&&n.holder!==null)throw new l("invalid_control");return{holder:i,you:n.you,same_user:n.same_user}}function ie(t,e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(t){case o.hello:if(e.byteLength<6)throw new l("invalid_length");return{type:"hello",width:n.getUint16(0),height:n.getUint16(2),fps:n.getUint8(4),preset:L(n.getUint8(5)),codec:S(e.subarray(6))};case o.frame:if(e.byteLength<14)throw new l("invalid_length");if(n.getUint8(0)>1)throw new l("invalid_frame_flags");return{type:"frame",key:n.getUint8(0)===1,seq:n.getUint32(1),captureMicros:Number(n.getBigUint64(5)),data:e.subarray(13)};case o.stats:return{type:"stats",stats:ne(e)};case o.ping:case o.pong:return y(e,8),{type:t===o.ping?"ping":"pong",token:n.getFloat64(0)};case o.serverClipboard:return{type:"serverClipboard",text:S(e)};case o.clientClipboard:return{type:"clientClipboard",text:S(e)};case o.error:return{type:"error",code:S(e)};case o.pointer:return y(e,5),{type:"pointer",x:n.getUint16(0),y:n.getUint16(2),buttons:n.getUint8(4)};case o.key:if(y(e,5),n.getUint8(0)>1)throw new l("invalid_key_flags");return{type:"key",down:n.getUint8(0)===1,keysym:n.getUint32(1)};case o.config:return y(e,1),{type:"config",preset:L(n.getUint8(0))};case o.keyframeRequest:return y(e,0),{type:"keyframeRequest"};case o.audioHello:if(e.byteLength<5)throw new l("invalid_length");return{type:"audioHello",sampleRate:n.getUint32(0),channels:n.getUint8(4),codec:S(e.subarray(5))};case o.audio:if(e.byteLength<9)throw new l("invalid_length");return{type:"audio",captureMicros:Number(n.getBigUint64(0)),data:e.subarray(8)};case o.audioEnable:if(y(e,1),n.getUint8(0)>1)throw new l("invalid_audio_flags");return{type:"audioEnable",on:n.getUint8(0)===1};case o.resize:return y(e,4),{type:"resize",width:n.getUint16(0),height:n.getUint16(2)};case o.control:return{type:"control",control:re(e)};case o.windows:{if(e.byteLength%16!==0||e.byteLength>_*16)throw new l("invalid_length");let i=[];for(let s=0;s<e.byteLength;s+=16)i.push({x:n.getInt32(s),y:n.getInt32(s+4),width:n.getInt32(s+8),height:n.getInt32(s+12)});return{type:"windows",bounds:i}}case o.ack:return y(e,4),{type:"ack",seq:n.getUint32(0)};default:return null}}class ds{buffer=new Uint8Array(0);push(t){let e=new Uint8Array(this.buffer.byteLength+t.byteLength);e.set(this.buffer),e.set(t,this.buffer.byteLength);let n=[],i=0;while(e.byteLength-i>=4){let s=new DataView(e.buffer,e.byteOffset+i,4).getUint32(0);if(s<1||s>M)throw new l("invalid_message_length");if(e.byteLength-i-4<s)break;let a=e[i+4],c=e.slice(i+5,i+4+s),d=ie(a,c);if(d)n.push(d);i+=4+s}return this.buffer=e.slice(i),n}}var j="/usr/bin/osascript",oe=5000,ae=1048576,ce=String.raw`
3
3
  ObjC.import("CoreGraphics");
4
4
  ObjC.import("ApplicationServices");
5
5
  ObjC.import("AppKit");
@@ -29,7 +29,7 @@ function run(argv) {
29
29
  const text = clipboard.stringForType($.NSPasteboardTypeString);
30
30
  if (!text) continue;
31
31
  const bytes = text.dataUsingEncoding($.NSUTF8StringEncoding);
32
- if (Number(bytes.length) > ${O}) continue;
32
+ if (Number(bytes.length) > ${D}) continue;
33
33
  stdout.writeData($("c " + bytes.base64EncodedStringWithOptions(0).js + "\n").dataUsingEncoding($.NSUTF8StringEncoding));
34
34
  }
35
35
  return;
@@ -70,7 +70,7 @@ function run(argv) {
70
70
  }
71
71
  }
72
72
  `;function q(t){let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!=="object")return null;let n=e,i=(c)=>typeof c==="number"&&Number.isFinite(c)?Math.min(65535,Math.round(c)):0;if(typeof n.screen!=="boolean"||typeof n.accessibility!=="boolean")return null;let s=i(n.width),a=i(n.height);return s>0&&a>0?{screen:n.screen,accessibility:n.accessibility,width:s,height:a}:null}function v(t,...e){let[n,...i]=[...t,j,"-l","JavaScript","-e",ce,...e];return[n,i]}function H(t,...e){return new Promise((n)=>{se(...v(t,...e),{env:{},timeout:oe,killSignal:"SIGKILL",maxBuffer:65536,encoding:"utf8"},(i,s)=>n(i?null:q(s.split(`
73
- `)[0]??"")))})}function Xt(t=[]){return H(t,"probe")}function Er(t,e){return H(t,"request",...e?[e]:[])}var N=2,ue=8,le=String.raw`
73
+ `)[0]??"")))})}function Pr(t=[]){return H(t,"probe")}function Rr(t,e){return H(t,"request",...e?[e]:[])}var N=2,ue=8,le=String.raw`
74
74
  ObjC.import("CoreGraphics");
75
75
  ObjC.import("Foundation");
76
76
  ObjC.bindFunction("getppid", ["int", []]);
@@ -101,12 +101,12 @@ function run() {
101
101
  $.NSThread.sleepForTimeInterval(wait);
102
102
  }
103
103
  }
104
- `;function de(t){let e;try{e=JSON.parse(t)}catch{return null}if(!Array.isArray(e))return null;let n=[];for(let i of e.slice(0,_)){if(!Array.isArray(i)||i.length!==4||!i.every((u)=>typeof u==="number"&&Number.isFinite(u)))return null;let[s,a,c,d]=i.map(Math.round);if(c>0&&d>0)n.push({x:s,y:a,width:c,height:d})}return n}function is(t){let e=Date.now(),n=0,i=!1,s=(u,b={})=>{try{process.stderr.write(`${JSON.stringify({event:"display.windows_helper",state:u,...b})}
104
+ `;function de(t){let e;try{e=JSON.parse(t)}catch{return null}if(!Array.isArray(e))return null;let n=[];for(let i of e.slice(0,_)){if(!Array.isArray(i)||i.length!==4||!i.every((u)=>typeof u==="number"&&Number.isFinite(u)))return null;let[s,a,c,d]=i.map(Math.round);if(c>0&&d>0)n.push({x:s,y:a,width:c,height:d})}return n}function ps(t){let e=Date.now(),n=0,i=!1,s=(u,b={})=>{try{process.stderr.write(`${JSON.stringify({event:"display.windows_helper",state:u,...b})}
105
105
  `)}catch{}},a=(u,b={})=>{if(i)return;i=!0,s(u,{updates:n,duration_ms:Date.now()-e,...b})},c=E(j,["-l","JavaScript","-e",le],{env:{},stdio:["ignore","pipe","ignore"]});s("started");let d="";return c.stdout.on("data",(u)=>{if(i)return;d+=u.toString("utf8");for(let b=d.indexOf(`
106
106
  `);b>=0;b=d.indexOf(`
107
- `)){let x=de(d.slice(0,b));if(d=d.slice(b+1),x)n++,t(x)}if(d.length>65536)d=""}),c.once("error",(u)=>a("failed",{code:u.code??"spawn_failed"})),c.once("exit",(u,b)=>a("failed",{code:"exited",exit_code:u,signal:b})),{close(){a("stopped"),c.kill("SIGKILL")}}}var T=5,R=[{bit:1,button:0,down:1,up:2,drag:6},{bit:4,button:1,down:3,up:4,drag:7},{bit:2,button:2,down:25,up:26,drag:27}],fe=[[8,1,0],[16,-1,0],[32,0,1],[64,0,-1]],P=50,pe=500,V=4,I=131072,W=262144,D=524288,F=1048576,B=new Map([[65505,[56,I]],[65506,[60,I]],[65507,[59,W]],[65508,[62,W]],[65511,[58,D]],[65512,[61,D]],[65513,[58,D]],[65514,[61,D]],[65027,[61,D]],[65515,[55,F]],[65516,[54,F]]]),be=new Map([[65288,51],[65289,48],[65056,48],[65293,36],[65307,53],[65535,117],[65509,57],[65360,115],[65361,123],[65362,126],[65363,124],[65364,125],[65365,116],[65366,121],[65367,119],[65379,114],[65386,114],[65291,71],[65408,49],[65421,76],[65429,115],[65430,123],[65431,126],[65432,124],[65433,125],[65434,116],[65435,121],[65436,119],[65437,71],[65438,114],[65439,117],[65450,67],[65451,69],[65452,65],[65453,78],[65454,65],[65455,75],[65469,81],...[82,83,84,85,86,87,88,89,91,92].map((t,e)=>[65456+e,t]),...[122,120,99,118,96,97,98,100,101,109,103,111,105,107,113,106,64,79,80,90].map((t,e)=>[65470+e,t])]),G="asdfhgzxcv\x00bqweryt123465=97-80]ou[ip\x00lj'k;\\,/nm.\x00 `",Y='~!@#$%^&*()_+{}|:"<>?',he="`1234567890-=[]\\;',./",k=new Map;for(let t=0;t<G.length;t++){let e=G[t];if(e==="\x00")continue;if(k.set(e.charCodeAt(0),[t,!1]),e>="a"&&e<="z")k.set(e.toUpperCase().charCodeAt(0),[t,!0])}for(let t=0;t<Y.length;t++)k.set(Y.charCodeAt(t),[k.get(he.charCodeAt(t))[0],!0]);class K{now;x=-1;y=-1;mask=0;clicks=0;lastDown=null;held=new Set;constructor(t=()=>performance.now()){this.now=t}flags(){let t=0;for(let e of this.held)t|=B.get(e)[1];return t}mouse(t,e){return`m ${t} ${this.x} ${this.y} ${e} ${t===T?0:this.clicks} ${this.flags()}`}pointer(t,e,n){let i=[];if(t!==this.x||e!==this.y){this.x=t,this.y=e;let s=R.find((a)=>this.mask&a.bit);i.push(s?this.mouse(s.drag,s.button):this.mouse(T,0))}for(let s of R){let a=(this.mask&s.bit)!==0,c=(n&s.bit)!==0;if(!a&&c){let d=this.now(),u=this.lastDown;this.clicks=u&&u.button===s.button&&d-u.at<=pe&&Math.abs(t-u.x)<=V&&Math.abs(e-u.y)<=V?this.clicks+1:1,this.lastDown={button:s.button,at:d,x:t,y:e},i.push(this.mouse(s.down,s.button))}else if(a&&!c)i.push(this.mouse(s.up,s.button))}for(let[s,a,c]of fe)if(!(this.mask&s)&&n&s)i.push(`w ${a*P} ${c*P} ${this.flags()}`);return this.mask=n,i}key(t,e){let n=t?1:0,i=B.get(e);if(i){if(t)this.held.add(e);else this.held.delete(e);return[`k ${i[0]} ${n} ${this.flags()}`]}let s=be.get(e);if(s!==void 0)return[`k ${s} ${n} ${this.flags()}`];let a=e<256?e:(e&4278190080)===16777216?e&16777215:0,c=k.get(a);if(c)return[`k ${c[0]} ${n} ${this.flags()|(c[1]?I:0)}`];if(a<160||a>65535||a>=55296&&a<57344)return[];return[`u ${n} ${a} ${this.flags()}`]}}function os(t,e=[]){let n=E(...v(e),{env:{},stdio:["pipe","pipe","ignore"]}),i=new K,s="",a=!1,c=null,d=()=>{n.kill("SIGKILL"),c?.kill("SIGKILL")},u=(f)=>{if(a)return;a=!0,d(),t.end(f)},b=(f)=>u({error:new r("display_unavailable",f)}),x=(f)=>{if(a||f.length===0)return;if(n.stdin.write(f.map((g)=>`${g}
107
+ `)){let x=de(d.slice(0,b));if(d=d.slice(b+1),x)n++,t(x)}if(d.length>65536)d=""}),c.once("error",(u)=>a("failed",{code:u.code??"spawn_failed"})),c.once("exit",(u,b)=>a("failed",{code:"exited",exit_code:u,signal:b})),{close(){a("stopped"),c.kill("SIGKILL")}}}var T=5,R=[{bit:1,button:0,down:1,up:2,drag:6},{bit:4,button:1,down:3,up:4,drag:7},{bit:2,button:2,down:25,up:26,drag:27}],fe=[[8,1,0],[16,-1,0],[32,0,1],[64,0,-1]],P=50,pe=500,V=4,I=131072,W=262144,O=524288,F=1048576,B=new Map([[65505,[56,I]],[65506,[60,I]],[65507,[59,W]],[65508,[62,W]],[65511,[58,O]],[65512,[61,O]],[65513,[58,O]],[65514,[61,O]],[65027,[61,O]],[65515,[55,F]],[65516,[54,F]]]),be=new Map([[65288,51],[65289,48],[65056,48],[65293,36],[65307,53],[65535,117],[65509,57],[65360,115],[65361,123],[65362,126],[65363,124],[65364,125],[65365,116],[65366,121],[65367,119],[65379,114],[65386,114],[65291,71],[65408,49],[65421,76],[65429,115],[65430,123],[65431,126],[65432,124],[65433,125],[65434,116],[65435,121],[65436,119],[65437,71],[65438,114],[65439,117],[65450,67],[65451,69],[65452,65],[65453,78],[65454,65],[65455,75],[65469,81],...[82,83,84,85,86,87,88,89,91,92].map((t,e)=>[65456+e,t]),...[122,120,99,118,96,97,98,100,101,109,103,111,105,107,113,106,64,79,80,90].map((t,e)=>[65470+e,t])]),G="asdfhgzxcv\x00bqweryt123465=97-80]ou[ip\x00lj'k;\\,/nm.\x00 `",Y='~!@#$%^&*()_+{}|:"<>?',he="`1234567890-=[]\\;',./",k=new Map;for(let t=0;t<G.length;t++){let e=G[t];if(e==="\x00")continue;if(k.set(e.charCodeAt(0),[t,!1]),e>="a"&&e<="z")k.set(e.toUpperCase().charCodeAt(0),[t,!0])}for(let t=0;t<Y.length;t++)k.set(Y.charCodeAt(t),[k.get(he.charCodeAt(t))[0],!0]);class K{now;x=-1;y=-1;mask=0;clicks=0;lastDown=null;held=new Set;constructor(t=()=>performance.now()){this.now=t}flags(){let t=0;for(let e of this.held)t|=B.get(e)[1];return t}mouse(t,e){return`m ${t} ${this.x} ${this.y} ${e} ${t===T?0:this.clicks} ${this.flags()}`}pointer(t,e,n){let i=[];if(t!==this.x||e!==this.y){this.x=t,this.y=e;let s=R.find((a)=>this.mask&a.bit);i.push(s?this.mouse(s.drag,s.button):this.mouse(T,0))}for(let s of R){let a=(this.mask&s.bit)!==0,c=(n&s.bit)!==0;if(!a&&c){let d=this.now(),u=this.lastDown;this.clicks=u&&u.button===s.button&&d-u.at<=pe&&Math.abs(t-u.x)<=V&&Math.abs(e-u.y)<=V?this.clicks+1:1,this.lastDown={button:s.button,at:d,x:t,y:e},i.push(this.mouse(s.down,s.button))}else if(a&&!c)i.push(this.mouse(s.up,s.button))}for(let[s,a,c]of fe)if(!(this.mask&s)&&n&s)i.push(`w ${a*P} ${c*P} ${this.flags()}`);return this.mask=n,i}key(t,e){let n=t?1:0,i=B.get(e);if(i){if(t)this.held.add(e);else this.held.delete(e);return[`k ${i[0]} ${n} ${this.flags()}`]}let s=be.get(e);if(s!==void 0)return[`k ${s} ${n} ${this.flags()}`];let a=e<256?e:(e&4278190080)===16777216?e&16777215:0,c=k.get(a);if(c)return[`k ${c[0]} ${n} ${this.flags()|(c[1]?I:0)}`];if(a<160||a>65535||a>=55296&&a<57344)return[];return[`u ${n} ${a} ${this.flags()}`]}}function hs(t,e=[]){let n=E(...v(e),{env:{},stdio:["pipe","pipe","ignore"]}),i=new K,s="",a=!1,c=null,d=()=>{n.kill("SIGKILL"),c?.kill("SIGKILL")},u=(f)=>{if(a)return;a=!0,d(),t.end(f)},b=(f)=>u({error:new r("display_unavailable",f)}),x=(f)=>{if(a||f.length===0)return;if(n.stdin.write(f.map((g)=>`${g}
108
108
  `).join("")),n.stdin.writableLength>ae)u({reason:"input_backpressure"})},z=()=>{c=E(...v(e,"clipboard"),{env:{},stdio:["ignore","pipe","ignore"]});let f="";c.stdout?.on("data",(g)=>{if(a)return;f+=g.toString("ascii");for(let h=f.indexOf(`
109
109
  `);h>=0;h=f.indexOf(`
110
- `)){let U=f.slice(0,h);if(f=f.slice(h+1),!U.startsWith("c "))continue;let A=U.slice(2);if(A.length>Math.ceil(O/3)*4||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(A)){u({reason:"display_protocol"});return}let C=Buffer.from(A,"base64");if(C.byteLength<=O)t.clipboard(C.toString("utf8"));if(a)return}if(f.length>Math.ceil(O/3)*4+2)u({reason:"display_protocol"})}),c.once("error",()=>b("Reason could not watch this Mac's desktop clipboard.")),c.once("exit",()=>{if(!a)b("Reason could not watch this Mac's desktop clipboard.")})};return n.stdout.on("data",(f)=>{if(a||s===null)return;s+=f.toString("utf8");let g=s.indexOf(`
110
+ `)){let U=f.slice(0,h);if(f=f.slice(h+1),!U.startsWith("c "))continue;let A=U.slice(2);if(A.length>Math.ceil(D/3)*4||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(A)){u({reason:"display_protocol"});return}let C=Buffer.from(A,"base64");if(C.byteLength<=D)t.clipboard(C.toString("utf8"));if(a)return}if(f.length>Math.ceil(D/3)*4+2)u({reason:"display_protocol"})}),c.once("error",()=>b("Reason could not watch this Mac's desktop clipboard.")),c.once("exit",()=>{if(!a)b("Reason could not watch this Mac's desktop clipboard.")})};return n.stdout.on("data",(f)=>{if(a||s===null)return;s+=f.toString("utf8");let g=s.indexOf(`
111
111
  `);if(g<0){if(s.length>4096)u({reason:"display_protocol"});return}let h=q(s.slice(0,g));if(s=null,!h)u({reason:"display_protocol"});else if(!h.screen||!h.accessibility)b(e.length>0?"Reason's background worker needs Screen Recording and Accessibility on this Mac (its own Reason entry in System Settings > Privacy & Security, not the Reason app's): run `reason permissions allow` on this Mac.":"Allow Screen Recording and Accessibility for this Mac's Reason worker, then restart it.");else z(),t.ready({width:h.width,height:h.height})}),n.stdin.on("error",()=>{return}),n.once("error",()=>b("Reason could not start this Mac's desktop input.")),n.once("exit",()=>{if(s!==null)b("Reason could not start this Mac's desktop input.");else u({reason:"display_closed"})}),{pointer:(f,g,h)=>x(i.pointer(f,g,h)),key:(f,g)=>x(i.key(f,g)),clipboard:(f)=>x([`c ${Buffer.from(f,"utf8").toString("base64")}`]),close(){a=!0,d()}}}
112
- export{vc,Sc,Sr,Ec,O,kc,xc,ts,Cc,Ac,Pc,Rc,rs,Tc,Rn,ns,Xt,Er,is,os};
112
+ export{Pc,Rc,Ar,Tc,D,Ic,Dc,ls,Oc,Nc,Lc,$c,us,Mc,Dn,ds,Pr,Rr,ps,hs};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{createHash as M,createPublicKey as y,verify as _}from"crypto";var Ai="libara_device_keychain.dylib",Pi="libreason_device_keychain.dylib";var g=2,b=536870912,mn=262144;var yr=["darwin-arm64","darwin-x64"];class l extends Error{code;constructor(t,n){super(n);this.code=t;this.name="ManagedRuntimeError"}}var N=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,k=/^[a-f0-9]{64}$/;function a(t){return Boolean(t)&&typeof t==="object"&&!Array.isArray(t)}function r(t,n,i=[]){let s=new Set([...n,...i]);return n.every((e)=>(e in t))&&Object.keys(t).every((e)=>s.has(e))}function p(t){return typeof t==="string"&&N.test(t)}function w(t){return typeof t==="string"&&!Number.isNaN(Date.parse(t))&&new Date(t).toISOString()===t}var ac="managed-runtime-identity.json",m="reason-macos-background-identity-v1";function f(t){if(t===null)return"null";if(typeof t==="string"||typeof t==="boolean")return JSON.stringify(t);if(typeof t==="number"){if(!Number.isFinite(t))throw new l("invalid_manifest","Manifest numbers must be finite.");return JSON.stringify(t)}if(Array.isArray(t))return`[${t.map((n)=>f(n)).join(",")}]`;if(a(t))return`{${Object.keys(t).sort().map((n)=>`${JSON.stringify(n)}:${f(t[n])}`).join(",")}}`;throw new l("invalid_manifest","Manifest contains an unsupported value.")}function d(t){if(!a(t)||!r(t,["url","sha256","size_bytes"])||typeof t.url!=="string"||typeof t.sha256!=="string"||!k.test(t.sha256)||typeof t.size_bytes!=="number"||!Number.isSafeInteger(t.size_bytes)||t.size_bytes<=0||t.size_bytes>b)throw new l("invalid_manifest","Manifest contains an invalid runtime artifact.");let n;try{n=new URL(t.url)}catch{throw new l("invalid_manifest","Runtime artifact URL is invalid.")}if(n.protocol!=="https:"||n.username||n.password||n.hash)throw new l("invalid_manifest","Runtime artifact URL must be an HTTPS URL without credentials or a fragment.");return{url:n.toString(),sha256:t.sha256,size_bytes:t.size_bytes}}function u(t){if(!a(t)||!r(t,["broker","credential_library"]))throw new l("invalid_manifest","Manifest must bind the broker and credential library as one runtime.");return{broker:d(t.broker),credential_library:d(t.credential_library)}}function I(t){if(!a(t)||!r(t,["schema_version","version","published_at","artifacts"])||t.schema_version!==g||!p(t.version)||!w(t.published_at)||!a(t.artifacts)||!r(t.artifacts,[...yr]))throw new l("invalid_manifest","Managed Reason runtime manifest is invalid.");return{schema_version:g,version:t.version,published_at:t.published_at,artifacts:{"darwin-arm64":u(t.artifacts["darwin-arm64"]),"darwin-x64":u(t.artifacts["darwin-x64"])}}}function T(t){if(!a(t)||!r(t,["schema","version","published_at","artifacts"])||t.schema!==m||!p(t.version)||!w(t.published_at)||!a(t.artifacts)||!r(t.artifacts,[...yr]))throw new l("invalid_manifest","Reason background identity manifest is invalid.");return{schema:m,version:t.version,published_at:t.published_at,artifacts:{"darwin-arm64":d(t.artifacts["darwin-arm64"]),"darwin-x64":d(t.artifacts["darwin-x64"])}}}function h(t){if(typeof t!=="string"||!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new l("invalid_signature","Runtime manifest signature is invalid.");let n=Buffer.from(t,"base64");if(n.length!==64||n.toString("base64")!==t)throw new l("invalid_signature","Runtime manifest signature is invalid.");return n}function A(t){let n=t;if(typeof t==="string")try{n=JSON.parse(t)}catch{throw new l("invalid_manifest","Managed Reason runtime manifest is not valid JSON.")}if(!a(n)||!r(n,["key_id","manifest","signature"])||typeof n.key_id!=="string"||!/^[A-Za-z0-9._-]{1,80}$/.test(n.key_id)||typeof n.signature!=="string")throw new l("invalid_manifest","Signed managed Reason runtime manifest is invalid.");return n}function Ri(t,n){let i=A(t),s=n[i.key_id];if(!s)throw new l("untrusted_key","Runtime manifest was signed by an unknown key.");let e=I(i.manifest),c=h(i.signature),o=!1;try{o=_(null,Buffer.from(f(e)),y(s),c)}catch{throw new l("invalid_signature","Runtime manifest signature could not be verified.")}if(!o)throw new l("invalid_signature","Runtime manifest signature did not match.");return{key_id:i.key_id,manifest:e,signature:i.signature}}function cc(t,n){let i=A(t),s=n[i.key_id];if(!s)throw new l("untrusted_key","Background identity manifest was signed by an unknown key.");let e=T(i.manifest),c=h(i.signature),o=!1;try{o=_(null,Buffer.from(f(e)),y(s),c)}catch{throw new l("invalid_signature","Background identity manifest signature could not be verified.")}if(!o)throw new l("invalid_signature","Background identity manifest signature did not match.");return{key_id:i.key_id,manifest:e,signature:i.signature}}function gn(t){return M("sha256").update(t).digest("hex")}function Vt(t,n){if(t.byteLength!==n.size_bytes)throw new l("artifact_size_mismatch","Runtime artifact size did not match its manifest.");if(gn(t)!==n.sha256)throw new l("artifact_checksum_mismatch","Runtime artifact checksum did not match its manifest.")}import{existsSync as S}from"fs";import{join as R}from"path";function _n(t){let n=R(t,Pi);return S(n)?n:R(t,Ai)}
3
- export{Ai,Pi,mn,yr,l,ac,Ri,cc,gn,Vt,_n};
2
+ import{createHash as M,createPublicKey as y,verify as _}from"crypto";var Ti="libara_device_keychain.dylib",Ii="libreason_device_keychain.dylib";var g=2,b=536870912,bn=262144;var yr=["darwin-arm64","darwin-x64"];class l extends Error{code;constructor(t,n){super(n);this.code=t;this.name="ManagedRuntimeError"}}var N=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,k=/^[a-f0-9]{64}$/;function a(t){return Boolean(t)&&typeof t==="object"&&!Array.isArray(t)}function r(t,n,i=[]){let s=new Set([...n,...i]);return n.every((e)=>(e in t))&&Object.keys(t).every((e)=>s.has(e))}function p(t){return typeof t==="string"&&N.test(t)}function w(t){return typeof t==="string"&&!Number.isNaN(Date.parse(t))&&new Date(t).toISOString()===t}var mc="managed-runtime-identity.json",m="reason-macos-background-identity-v1";function f(t){if(t===null)return"null";if(typeof t==="string"||typeof t==="boolean")return JSON.stringify(t);if(typeof t==="number"){if(!Number.isFinite(t))throw new l("invalid_manifest","Manifest numbers must be finite.");return JSON.stringify(t)}if(Array.isArray(t))return`[${t.map((n)=>f(n)).join(",")}]`;if(a(t))return`{${Object.keys(t).sort().map((n)=>`${JSON.stringify(n)}:${f(t[n])}`).join(",")}}`;throw new l("invalid_manifest","Manifest contains an unsupported value.")}function d(t){if(!a(t)||!r(t,["url","sha256","size_bytes"])||typeof t.url!=="string"||typeof t.sha256!=="string"||!k.test(t.sha256)||typeof t.size_bytes!=="number"||!Number.isSafeInteger(t.size_bytes)||t.size_bytes<=0||t.size_bytes>b)throw new l("invalid_manifest","Manifest contains an invalid runtime artifact.");let n;try{n=new URL(t.url)}catch{throw new l("invalid_manifest","Runtime artifact URL is invalid.")}if(n.protocol!=="https:"||n.username||n.password||n.hash)throw new l("invalid_manifest","Runtime artifact URL must be an HTTPS URL without credentials or a fragment.");return{url:n.toString(),sha256:t.sha256,size_bytes:t.size_bytes}}function u(t){if(!a(t)||!r(t,["broker","credential_library"]))throw new l("invalid_manifest","Manifest must bind the broker and credential library as one runtime.");return{broker:d(t.broker),credential_library:d(t.credential_library)}}function I(t){if(!a(t)||!r(t,["schema_version","version","published_at","artifacts"])||t.schema_version!==g||!p(t.version)||!w(t.published_at)||!a(t.artifacts)||!r(t.artifacts,[...yr]))throw new l("invalid_manifest","Managed Reason runtime manifest is invalid.");return{schema_version:g,version:t.version,published_at:t.published_at,artifacts:{"darwin-arm64":u(t.artifacts["darwin-arm64"]),"darwin-x64":u(t.artifacts["darwin-x64"])}}}function T(t){if(!a(t)||!r(t,["schema","version","published_at","artifacts"])||t.schema!==m||!p(t.version)||!w(t.published_at)||!a(t.artifacts)||!r(t.artifacts,[...yr]))throw new l("invalid_manifest","Reason background identity manifest is invalid.");return{schema:m,version:t.version,published_at:t.published_at,artifacts:{"darwin-arm64":d(t.artifacts["darwin-arm64"]),"darwin-x64":d(t.artifacts["darwin-x64"])}}}function h(t){if(typeof t!=="string"||!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new l("invalid_signature","Runtime manifest signature is invalid.");let n=Buffer.from(t,"base64");if(n.length!==64||n.toString("base64")!==t)throw new l("invalid_signature","Runtime manifest signature is invalid.");return n}function A(t){let n=t;if(typeof t==="string")try{n=JSON.parse(t)}catch{throw new l("invalid_manifest","Managed Reason runtime manifest is not valid JSON.")}if(!a(n)||!r(n,["key_id","manifest","signature"])||typeof n.key_id!=="string"||!/^[A-Za-z0-9._-]{1,80}$/.test(n.key_id)||typeof n.signature!=="string")throw new l("invalid_manifest","Signed managed Reason runtime manifest is invalid.");return n}function Di(t,n){let i=A(t),s=n[i.key_id];if(!s)throw new l("untrusted_key","Runtime manifest was signed by an unknown key.");let e=I(i.manifest),c=h(i.signature),o=!1;try{o=_(null,Buffer.from(f(e)),y(s),c)}catch{throw new l("invalid_signature","Runtime manifest signature could not be verified.")}if(!o)throw new l("invalid_signature","Runtime manifest signature did not match.");return{key_id:i.key_id,manifest:e,signature:i.signature}}function gc(t,n){let i=A(t),s=n[i.key_id];if(!s)throw new l("untrusted_key","Background identity manifest was signed by an unknown key.");let e=T(i.manifest),c=h(i.signature),o=!1;try{o=_(null,Buffer.from(f(e)),y(s),c)}catch{throw new l("invalid_signature","Background identity manifest signature could not be verified.")}if(!o)throw new l("invalid_signature","Background identity manifest signature did not match.");return{key_id:i.key_id,manifest:e,signature:i.signature}}function vn(t){return M("sha256").update(t).digest("hex")}function Gt(t,n){if(t.byteLength!==n.size_bytes)throw new l("artifact_size_mismatch","Runtime artifact size did not match its manifest.");if(vn(t)!==n.sha256)throw new l("artifact_checksum_mismatch","Runtime artifact checksum did not match its manifest.")}import{existsSync as S}from"fs";import{join as R}from"path";function Sn(t){let n=R(t,Ii);return S(n)?n:R(t,Ti)}
3
+ export{Ti,Ii,bn,yr,l,mc,Di,gc,vn,Gt,Sn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{On}from"./vm-hands-entry-lite-xvccy3z4.js";var g=On.version,xr=`reason-cli/${g}`,Nc=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;function El(r,c){if(!Nc.test(r)||!Nc.test(c))throw Error("cannot compare invalid CLI versions");let f=(t)=>{let e=t.indexOf("-");return e===-1?[t,void 0]:[t.slice(0,e),t.slice(e+1)]},[h,i]=f(r),[x,s]=f(c),u=h.split(".").map(BigInt),d=x.split(".").map(BigInt);for(let t=0;t<3;t+=1){if(u[t]===d[t])continue;return u[t]<d[t]?-1:1}if(i===void 0||s===void 0){if(i===s)return 0;return i===void 0?1:-1}let l=i.split("."),a=s.split("."),C=Math.max(l.length,a.length);for(let t=0;t<C;t+=1){let e=l[t],n=a[t];if(e===void 0||n===void 0){if(e===n)return 0;return e===void 0?-1:1}if(e===n)continue;let o=/^\d+$/.test(e),p=/^\d+$/.test(n);if(o&&p){let I=BigInt(e),m=BigInt(n);if(I===m)continue;return I<m?-1:1}if(o!==p)return o?-1:1;return e<n?-1:1}return 0}function us(r=Bun.main){return r.startsWith("/$bunfs/")||/^B:[\\/]~BUN[\\/]/i.test(r)}
3
- export{g,xr,Nc,El,us};
2
+ import{$n}from"./vm-hands-entry-lite-k4d5rhpw.js";var g=$n.version,Ir=`reason-cli/${g}`,Hc=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;function Il(r,c){if(!Hc.test(r)||!Hc.test(c))throw Error("cannot compare invalid CLI versions");let f=(t)=>{let e=t.indexOf("-");return e===-1?[t,void 0]:[t.slice(0,e),t.slice(e+1)]},[h,i]=f(r),[x,s]=f(c),u=h.split(".").map(BigInt),d=x.split(".").map(BigInt);for(let t=0;t<3;t+=1){if(u[t]===d[t])continue;return u[t]<d[t]?-1:1}if(i===void 0||s===void 0){if(i===s)return 0;return i===void 0?1:-1}let l=i.split("."),a=s.split("."),C=Math.max(l.length,a.length);for(let t=0;t<C;t+=1){let e=l[t],n=a[t];if(e===void 0||n===void 0){if(e===n)return 0;return e===void 0?-1:1}if(e===n)continue;let o=/^\d+$/.test(e),p=/^\d+$/.test(n);if(o&&p){let I=BigInt(e),m=BigInt(n);if(I===m)continue;return I<m?-1:1}if(o!==p)return o?-1:1;return e<n?-1:1}return 0}function ys(r=Bun.main){return r.startsWith("/$bunfs/")||/^B:[\\/]~BUN[\\/]/i.test(r)}
3
+ export{g,Ir,Hc,Il,ys};