@testmuai/kane-cli 0.10.2 → 0.10.3

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 (249) hide show
  1. package/dist/{ChatSurface-FIYDTZSI.js → ChatSurface-Z26BOE5U.js} +1 -1
  2. package/dist/{ChromeProfilePicker-Q6FIGVYU.js → ChromeProfilePicker-ODRIAXL3.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-2NV2G65E.js → CliFeedbackPrompt-JWCTMIGI.js} +1 -1
  4. package/dist/{CliUploadProgress-JZ5FXODE.js → CliUploadProgress-XFRRFRL4.js} +1 -1
  5. package/dist/{ConfigView-TZ4YINOE.js → ConfigView-6JF4DOJN.js} +1 -1
  6. package/dist/{EvidenceViewOffer-LKPN5BHX.js → EvidenceViewOffer-6344EX74.js} +1 -1
  7. package/dist/FolderPicker-4PCYHE75.js +2 -0
  8. package/dist/InfoBox-NJ2DL7YC.js +2 -0
  9. package/dist/{LinksBox-32TZOANP.js → LinksBox-HNDNFVUT.js} +1 -1
  10. package/dist/{ProfilesView-UC4MPM54.js → ProfilesView-DEJKJOHY.js} +1 -1
  11. package/dist/ProjectPicker-DTWMWOH7.js +2 -0
  12. package/dist/SaveSessionPrompt-3GCLB3ZT.js +2 -0
  13. package/dist/SingleShotApp-HMOXO5DW.js +2 -0
  14. package/dist/{SummaryBox-XGFO5X76.js → SummaryBox-7PPDMSSM.js} +1 -1
  15. package/dist/TestMdRunView-QLKRUU4V.js +2 -0
  16. package/dist/TestrunEvidenceTable-T2JUB4TE.js +2 -0
  17. package/dist/{WhoamiView-4XIJXMTU.js → WhoamiView-H7JNLLCY.js} +1 -1
  18. package/dist/{app-download-XEDO3EMV.js → app-download-GKRF2EIM.js} +1 -1
  19. package/dist/{assurance-job-MD65GQLC.js → assurance-job-F4L3T4VJ.js} +1 -1
  20. package/dist/{binary-NVYLR36K.js → binary-K3XMILST.js} +1 -1
  21. package/dist/{bind-H3ALI2NG.js → bind-SSHAZAB3.js} +1 -1
  22. package/dist/{bootstrap-JEVSVPQ2.js → bootstrap-XGKU4WXB.js} +1 -1
  23. package/dist/{catalog-5UYBWA4W.js → catalog-YCU6OHNV.js} +1 -1
  24. package/dist/{catalog-client-VVKV4JKW.js → catalog-client-MVEEHTG2.js} +1 -1
  25. package/dist/{changelog-FPWJXERY.js → changelog-5UB3AQT6.js} +1 -1
  26. package/dist/{chunk-GJ7MO2FW.js → chunk-2JFRN62I.js} +2 -2
  27. package/dist/chunk-2RBMQTYS.js +26 -0
  28. package/dist/{chunk-44SIFDNY.js → chunk-2TK4MDF2.js} +1 -1
  29. package/dist/{chunk-P4VFC6HO.js → chunk-35WUYKGO.js} +1 -1
  30. package/dist/{chunk-XCUF5AVM.js → chunk-3MD2XLE7.js} +2 -2
  31. package/dist/{chunk-TMH4TPMB.js → chunk-3NWUXRSI.js} +1 -1
  32. package/dist/{chunk-NVD2MXHQ.js → chunk-3RO2YGKH.js} +1 -1
  33. package/dist/{chunk-QUNIY6NN.js → chunk-3ZC7GSMM.js} +1 -1
  34. package/dist/{chunk-LXCTV75T.js → chunk-4CJQ7XZP.js} +1 -1
  35. package/dist/{chunk-LWCP4GLY.js → chunk-4KL3TSTT.js} +5 -5
  36. package/dist/{chunk-2ULYGALF.js → chunk-4UX5N7YI.js} +1 -1
  37. package/dist/{chunk-5KJU4MG4.js → chunk-5YYCCM6K.js} +1 -1
  38. package/dist/{chunk-IT5JVCZN.js → chunk-6FFX4S7N.js} +1 -1
  39. package/dist/{chunk-HM6LZ2KM.js → chunk-6HRNG4CK.js} +1 -1
  40. package/dist/{chunk-OK6NLITG.js → chunk-6QCCTZO3.js} +1 -1
  41. package/dist/{chunk-ZZZGTDYE.js → chunk-6QH75BPJ.js} +1 -1
  42. package/dist/{chunk-6SWHEBPR.js → chunk-7RELCXRW.js} +1 -1
  43. package/dist/{chunk-S7XCOBYD.js → chunk-7SU53QGU.js} +1 -1
  44. package/dist/{chunk-6JUS2ULI.js → chunk-7Y55CO42.js} +1 -1
  45. package/dist/{chunk-B57ZRHEQ.js → chunk-7YV2FCN4.js} +1 -1
  46. package/dist/{chunk-PC22QRIY.js → chunk-A2DODRHG.js} +1 -1
  47. package/dist/{chunk-ABMM37L2.js → chunk-AHT2ORJT.js} +1 -1
  48. package/dist/{chunk-A7IMHUFY.js → chunk-AT7AT3AR.js} +2 -2
  49. package/dist/{chunk-5WLXAQ4H.js → chunk-AVLYSNEG.js} +1 -1
  50. package/dist/{chunk-ZO3ZAMUU.js → chunk-BBJAKSA7.js} +1 -1
  51. package/dist/{chunk-DLP5S3TO.js → chunk-BJO6J5X2.js} +1 -1
  52. package/dist/{chunk-EEOAU43D.js → chunk-BLVDV3QQ.js} +1 -1
  53. package/dist/{chunk-I52NWH4U.js → chunk-C4KAPGBS.js} +1 -1
  54. package/dist/{chunk-7O2FIZB7.js → chunk-CB2BWDHG.js} +2 -2
  55. package/dist/{chunk-HWPWCCEV.js → chunk-CNHKZE4F.js} +1 -1
  56. package/dist/{chunk-5F44KH3R.js → chunk-CTHUX7O4.js} +1 -1
  57. package/dist/{chunk-FYPIF3BE.js → chunk-DC5F2ADJ.js} +1 -1
  58. package/dist/chunk-DIOK3SER.js +34 -0
  59. package/dist/{chunk-NCP54AIQ.js → chunk-DQXQJJOP.js} +2 -2
  60. package/dist/{chunk-W2HRX3DR.js → chunk-EBJW6POT.js} +1 -1
  61. package/dist/{chunk-GZQAETB2.js → chunk-EJGCIGQY.js} +1 -1
  62. package/dist/{chunk-7ZR5CQY3.js → chunk-ERRIDBE7.js} +1 -1
  63. package/dist/chunk-F2F257PU.js +6 -0
  64. package/dist/{chunk-EAWU2TOG.js → chunk-GQAWZEA4.js} +1 -1
  65. package/dist/{chunk-2QKBXRLI.js → chunk-GXQYFOBD.js} +1 -1
  66. package/dist/{chunk-RRKYHUOD.js → chunk-HBLHKQR7.js} +1 -1
  67. package/dist/chunk-HC6VLPUB.js +5 -0
  68. package/dist/{chunk-JUVY6PHY.js → chunk-HRIDAK6Y.js} +1 -1
  69. package/dist/{chunk-5MFPQYW3.js → chunk-HV2CDY4K.js} +1 -1
  70. package/dist/{chunk-YO6SNXBJ.js → chunk-IEHJG6J4.js} +1 -1
  71. package/dist/{chunk-FAMQ4DHU.js → chunk-J4FIESTB.js} +1 -1
  72. package/dist/{chunk-UICJ2KLJ.js → chunk-JBKHX5ES.js} +1 -1
  73. package/dist/{chunk-6CS23F3E.js → chunk-KBGMQYMD.js} +1 -1
  74. package/dist/{chunk-ZDQYGLCZ.js → chunk-KCXLRR3Q.js} +1 -1
  75. package/dist/{chunk-KN7GZWKK.js → chunk-KL7XFNSD.js} +1 -1
  76. package/dist/{chunk-V3OZJO7Y.js → chunk-KQ4XKTIZ.js} +1 -1
  77. package/dist/{chunk-PR5EGLEI.js → chunk-LHJSIHLC.js} +1 -1
  78. package/dist/{chunk-75FF7J5R.js → chunk-LPJKNX6D.js} +1 -1
  79. package/dist/{chunk-3V4J65GN.js → chunk-LRNUGKYH.js} +1 -1
  80. package/dist/{chunk-POA336CU.js → chunk-LUA25RYS.js} +1 -1
  81. package/dist/{chunk-BHQIH2FE.js → chunk-LV7224DG.js} +1 -1
  82. package/dist/{chunk-73HMW2WA.js → chunk-LXK4B2FE.js} +1 -1
  83. package/dist/{chunk-PWNYTIVA.js → chunk-M2E5CPPV.js} +1 -1
  84. package/dist/{chunk-OVNTCBNS.js → chunk-M7A66MSK.js} +1 -1
  85. package/dist/{chunk-MP6NCJFE.js → chunk-MD3RABID.js} +1 -1
  86. package/dist/{chunk-AUSLHNXQ.js → chunk-MEBEVHGP.js} +1 -1
  87. package/dist/{chunk-C6P6YUCR.js → chunk-N7IWR45S.js} +1 -1
  88. package/dist/{chunk-M3TFOFUQ.js → chunk-ND6OP3O2.js} +1 -1
  89. package/dist/{chunk-226AGYHB.js → chunk-NHGPMYM3.js} +1 -1
  90. package/dist/{chunk-VE4HLIGA.js → chunk-NI3TIAD7.js} +1 -1
  91. package/dist/{chunk-GQARXS6F.js → chunk-NPAUSUNM.js} +1 -1
  92. package/dist/{chunk-HX5OLRKU.js → chunk-NRAPCFI2.js} +2 -2
  93. package/dist/{chunk-RAVAJZV2.js → chunk-NZJSGINB.js} +16 -16
  94. package/dist/{chunk-X3A4QPA3.js → chunk-OBNVGD5H.js} +1 -1
  95. package/dist/{chunk-Q5AKIQIE.js → chunk-OCMPWCKQ.js} +1 -1
  96. package/dist/{chunk-BJT6PZXL.js → chunk-OCVDMZWB.js} +1 -1
  97. package/dist/{chunk-XZ6J3Y2W.js → chunk-OHGL4GEJ.js} +1 -1
  98. package/dist/{chunk-54NJJVG5.js → chunk-OOGKX4Y6.js} +1 -1
  99. package/dist/{chunk-UMNCM4RJ.js → chunk-OTMHCHH6.js} +2 -2
  100. package/dist/{chunk-45NM23EQ.js → chunk-OZNYQONA.js} +1 -1
  101. package/dist/{chunk-D4QXYAYA.js → chunk-PB6RXDWQ.js} +2 -2
  102. package/dist/{chunk-2GEAKFAV.js → chunk-PCQK62MP.js} +1 -1
  103. package/dist/{chunk-HHOVANJ7.js → chunk-PTLOOVV4.js} +1 -1
  104. package/dist/{chunk-QB77LRF4.js → chunk-Q4ALB7SH.js} +1 -1
  105. package/dist/{chunk-A474TUCE.js → chunk-Q4SMITTV.js} +1 -1
  106. package/dist/{chunk-HNF3PWF3.js → chunk-QE4AWNOV.js} +3 -3
  107. package/dist/{chunk-6YBH3WUW.js → chunk-QEM5ZRDN.js} +1 -1
  108. package/dist/{chunk-MSYRAPDK.js → chunk-QHH42RH5.js} +1 -1
  109. package/dist/{chunk-IB5WG5YY.js → chunk-RNHSULQM.js} +1 -1
  110. package/dist/chunk-SB26HQO7.js +2 -0
  111. package/dist/{chunk-QVMXL675.js → chunk-SJQTTEXQ.js} +1 -1
  112. package/dist/{chunk-UCVP7ZY4.js → chunk-SMGRXKXX.js} +1 -1
  113. package/dist/{chunk-RDAIOJCR.js → chunk-SXBPUUQ5.js} +1 -1
  114. package/dist/{chunk-K75WIRI5.js → chunk-TM45NPWL.js} +1 -1
  115. package/dist/{chunk-7DLDADQR.js → chunk-TUSG7DIL.js} +1 -1
  116. package/dist/{chunk-K4K2BGQC.js → chunk-UJ37XGSP.js} +3 -3
  117. package/dist/{chunk-DXLZCJH5.js → chunk-ULIIYKZB.js} +1 -1
  118. package/dist/{chunk-7PCLHURF.js → chunk-UXGMKRS4.js} +61 -60
  119. package/dist/{chunk-IH73ZCBB.js → chunk-VCVEZEVS.js} +1 -1
  120. package/dist/{chunk-XNXJXGVB.js → chunk-VKVYT6KZ.js} +2 -2
  121. package/dist/{chunk-PEUIHME2.js → chunk-VO2NNXKR.js} +1 -1
  122. package/dist/{chunk-H4TIVILC.js → chunk-WE7HRAGO.js} +1 -1
  123. package/dist/{chunk-O5KTMDTH.js → chunk-WIVKLNIO.js} +1 -1
  124. package/dist/chunk-WLEWXE6L.js +2 -0
  125. package/dist/{chunk-3YIA3DSL.js → chunk-X2MDL6S4.js} +1 -1
  126. package/dist/{chunk-M7Y5GGVJ.js → chunk-X45RZIAJ.js} +1 -1
  127. package/dist/{chunk-4LGQHTXM.js → chunk-XKOVEMVZ.js} +1 -1
  128. package/dist/{chunk-4HARMERK.js → chunk-Y2HQMJGS.js} +1 -1
  129. package/dist/{chunk-B226SFOV.js → chunk-Y3RJHWNK.js} +1 -1
  130. package/dist/{chunk-4HYPMGDF.js → chunk-YCVEI7BT.js} +1 -1
  131. package/dist/{chunk-HG2ILWCE.js → chunk-YILRYMMG.js} +1 -1
  132. package/dist/{chunk-2COXO5LQ.js → chunk-YNDELIXL.js} +1 -1
  133. package/dist/{chunk-4NEPHIAO.js → chunk-YPGZ5E4I.js} +1 -1
  134. package/dist/{chunk-GT3JDX5H.js → chunk-YQZ736IQ.js} +1 -1
  135. package/dist/{chunk-XHFU5TGS.js → chunk-YVVFXBT5.js} +1 -1
  136. package/dist/{chunk-ET5EK2CM.js → chunk-YWWVF5OU.js} +1 -1
  137. package/dist/{chunk-OKA6FPJM.js → chunk-Z47ZEFH7.js} +1 -1
  138. package/dist/{chunk-FI2DVNRT.js → chunk-ZCBOHWN3.js} +1 -1
  139. package/dist/{chunk-7XJNYLQW.js → chunk-ZIHQ5JGB.js} +4 -4
  140. package/dist/{chunk-Z6SI7YNV.js → chunk-ZMIKNNO6.js} +1 -1
  141. package/dist/{chunk-O3TXAMFW.js → chunk-ZPU3WAC4.js} +1 -1
  142. package/dist/{commands-R5AYK6XM.js → commands-JBFLLT7A.js} +1 -1
  143. package/dist/{config-YMHI3H3Y.js → config-7WTZPMAH.js} +1 -1
  144. package/dist/{cover-cmd-DVQIGFDY.js → cover-cmd-DU6ZYJFL.js} +1 -1
  145. package/dist/{credentials-BCR73VGS.js → credentials-5WIFF5DG.js} +1 -1
  146. package/dist/{deps-bundle-6WLX44OA.js → deps-bundle-BLLJ2BQ4.js} +1 -1
  147. package/dist/{deps-resolve-DSAKPZ3T.js → deps-resolve-WQ6J6RLI.js} +1 -1
  148. package/dist/{design-chat-YUI2JPO6.js → design-chat-ZICGVYIH.js} +1 -1
  149. package/dist/{design-headless-KIP6R7UV.js → design-headless-HYWZIIDS.js} +1 -1
  150. package/dist/{design-remote-XMSHDDUX.js → design-remote-HPX4VZ63.js} +2 -2
  151. package/dist/device-env-4P4GUVBW.js +2 -0
  152. package/dist/{doctor-PGTNOMSP.js → doctor-Z2YQ2DBX.js} +1 -1
  153. package/dist/{evidence-RO3RDZXO.js → evidence-BJIID6VT.js} +1 -1
  154. package/dist/{evolve-cmd-U2ALVGMT.js → evolve-cmd-GZCUSCEK.js} +1 -1
  155. package/dist/{evolve-remote-K2MCCVMM.js → evolve-remote-LILOAHYH.js} +1 -1
  156. package/dist/{explain-cmd-UWK5YVXG.js → explain-cmd-LXIVHGN7.js} +1 -1
  157. package/dist/explore-SA2P3SGX.js +2 -0
  158. package/dist/{explore-context-tty-WJHUSP3A.js → explore-context-tty-PERKIWXD.js} +1 -1
  159. package/dist/{explore-entry-3EX2T3NS.js → explore-entry-E6EY3VV3.js} +4 -4
  160. package/dist/{explore-live-TRY5A2ME.js → explore-live-XIWWUV52.js} +1 -1
  161. package/dist/{explore-run-tty-ZV5XFKZA.js → explore-run-tty-M56I23IF.js} +2 -2
  162. package/dist/{extract-bind-TXUBMK3T.js → extract-bind-LZ22VFKB.js} +3 -3
  163. package/dist/{extract-chat-VPYDGQKO.js → extract-chat-Z64LEAJ5.js} +1 -1
  164. package/dist/{extract-cmd-YUOYMVF5.js → extract-cmd-46E2XDWZ.js} +2 -2
  165. package/dist/{extract-headless-UWTAPOET.js → extract-headless-XLS56LMN.js} +1 -1
  166. package/dist/{folder-flags-WV7UV3JG.js → folder-flags-ZIDJVDKX.js} +1 -1
  167. package/dist/{gaps-cmd-PFV3FZCM.js → gaps-cmd-XYOBJVTO.js} +1 -1
  168. package/dist/{gate-7ALXLCNB.js → gate-AK44VDHC.js} +1 -1
  169. package/dist/{generate-headless-KMBBZTLS.js → generate-headless-HXAVEAEZ.js} +2 -2
  170. package/dist/{impact-cmd-PW33L5RF.js → impact-cmd-TJTUFAFO.js} +2 -2
  171. package/dist/index.js +162 -157
  172. package/dist/{ingest-cmd-MXYILQLV.js → ingest-cmd-OJSKTSQK.js} +3 -3
  173. package/dist/{ingest-remote-2EEJP6ML.js → ingest-remote-2WM6PYUW.js} +1 -1
  174. package/dist/install-JBWBF3WX.js +2 -0
  175. package/dist/{interactive-bind-FDWJUTI6.js → interactive-bind-SOD7VTAY.js} +2 -2
  176. package/dist/{interactive-remote-O2Q2FNOH.js → interactive-remote-7ZSTI66T.js} +1 -1
  177. package/dist/{lattice-auth-TXNDLHM6.js → lattice-auth-UQPFQSG7.js} +1 -1
  178. package/dist/{lifecycle-cmd-GFHDBRXX.js → lifecycle-cmd-DGIO3VAO.js} +1 -1
  179. package/dist/{list-cmd-RR75PMPE.js → list-cmd-HQIN3HX4.js} +1 -1
  180. package/dist/{list-commands-3QGZWJ5P.js → list-commands-OFRRBU3D.js} +1 -1
  181. package/dist/{list-remote-AA3VSWOI.js → list-remote-EFCET42K.js} +1 -1
  182. package/dist/login-flow-SYKXXDLH.js +2 -0
  183. package/dist/{maintenance-cmd-OHGVARQ2.js → maintenance-cmd-X5247RSJ.js} +1 -1
  184. package/dist/{mobile-prompts-FZRKLLTN.js → mobile-prompts-I66ENBDW.js} +1 -1
  185. package/dist/{onboarding-NXGMV3VG.js → onboarding-6HIP3KW6.js} +1 -1
  186. package/dist/{persist-recorded-session-INFN4JZT.js → persist-recorded-session-RSSMTVF3.js} +1 -1
  187. package/dist/pipeline-NTJDH5TC.js +2 -0
  188. package/dist/{policy-commands-3YJ6YCDN.js → policy-commands-4PUGESCW.js} +1 -1
  189. package/dist/{prepare-target-DII5WZCX.js → prepare-target-AI3GGZF6.js} +1 -1
  190. package/dist/{pull-cmd-XZN53XFZ.js → pull-cmd-NRVB5ZN7.js} +1 -1
  191. package/dist/{pull-route-R33BVADE.js → pull-route-FWCZW76M.js} +1 -1
  192. package/dist/real-device-run-NQ7RNH7C.js +2 -0
  193. package/dist/{reconcile-cmd-KFPRCCJB.js → reconcile-cmd-7B7THAFJ.js} +4 -4
  194. package/dist/{reconcile-remote-6WISFGRG.js → reconcile-remote-3W6ZTO3G.js} +2 -2
  195. package/dist/{recording-banner-XOX2CDCF.js → recording-banner-WVDTWTSE.js} +1 -1
  196. package/dist/registry-PFOSXOIH.js +2 -0
  197. package/dist/remote-entry-BZU4NFNS.js +2 -0
  198. package/dist/{remote-mode-4HN27MD4.js → remote-mode-NXUKDUXG.js} +1 -1
  199. package/dist/{remote-words-LFDYKIZ7.js → remote-words-JRDDNOZ6.js} +1 -1
  200. package/dist/{require-project-folder-ZK4JJCDB.js → require-project-folder-3DTI2CVB.js} +1 -1
  201. package/dist/{resolve-run-intent-LYLVNNDZ.js → resolve-run-intent-QCL7QXIB.js} +1 -1
  202. package/dist/{resolver-RMHGGYRP.js → resolver-CDF7QKVD.js} +1 -1
  203. package/dist/{review-cmd-UGF2FC5Y.js → review-cmd-XBK3TGRE.js} +1 -1
  204. package/dist/{run-remote-BGKQDAOA.js → run-remote-SFR3F2T5.js} +1 -1
  205. package/dist/{run-startup-gate-4XE73OON.js → run-startup-gate-QSFJRYUY.js} +1 -1
  206. package/dist/run-test-md-ZSREINDQ.js +20 -0
  207. package/dist/session-worker.js +2 -2
  208. package/dist/{sessions-cmd-CABAX7BO.js → sessions-cmd-TLUITRG5.js} +1 -1
  209. package/dist/{sessions-remote-Y4FTZL7Y.js → sessions-remote-INO7AWKB.js} +1 -1
  210. package/dist/{skill-installer-FS2AV7GX.js → skill-installer-7JH5QCJF.js} +1 -1
  211. package/dist/{store-PLKJZTGC.js → store-X4UK4AP7.js} +1 -1
  212. package/dist/{store-choice-UAB6Z4AL.js → store-choice-27HDIFTU.js} +1 -1
  213. package/dist/{store-guard-DUN2X3SR.js → store-guard-ZXKB5DQH.js} +1 -1
  214. package/dist/{sync-cmd-AGTOGPYM.js → sync-cmd-2PCO7LZA.js} +1 -1
  215. package/dist/{sync-setup-4KIY3PDO.js → sync-setup-5WQO73Y5.js} +1 -1
  216. package/dist/tcg-generate-DGJD5KSM.js +2 -0
  217. package/dist/{testmd-actions-UD6PAWUX.js → testmd-actions-XE2JPQHB.js} +1 -1
  218. package/dist/{testmd-sync-EEJ7GPLR.js → testmd-sync-LYHEXWCT.js} +1 -1
  219. package/dist/{tms-client-XWCR7O7J.js → tms-client-J4OCD3EP.js} +1 -1
  220. package/dist/token-refresh-E4FTJVHY.js +2 -0
  221. package/dist/{validate-basic-3JZRZL45.js → validate-basic-66XDPA3S.js} +1 -1
  222. package/dist/{version-check-IY3YSQIP.js → version-check-SHNVYTMU.js} +1 -1
  223. package/dist/{view-cmd-WUIGTRFX.js → view-cmd-QOB3O6YW.js} +1 -1
  224. package/dist/{walk-session-EH7227WR.js → walk-session-WIEROYOT.js} +1 -1
  225. package/dist/{with-telemetry-7JMZUBUZ.js → with-telemetry-T2PWI5CY.js} +1 -1
  226. package/package.json +11 -11
  227. package/dist/FolderPicker-H5K74PCH.js +0 -2
  228. package/dist/InfoBox-DNSOAK5L.js +0 -2
  229. package/dist/ProjectPicker-ZJ5RW6XL.js +0 -2
  230. package/dist/SaveSessionPrompt-F327WC7A.js +0 -2
  231. package/dist/SingleShotApp-OMLRYOSI.js +0 -2
  232. package/dist/TestMdRunView-ZZ77QTAQ.js +0 -2
  233. package/dist/TestrunEvidenceTable-G7MPF55X.js +0 -2
  234. package/dist/chunk-6K5BEEAJ.js +0 -2
  235. package/dist/chunk-6LEHGRRG.js +0 -34
  236. package/dist/chunk-A4ZV2SHL.js +0 -5
  237. package/dist/chunk-O2Y46A3G.js +0 -26
  238. package/dist/chunk-Y6Y6RAY4.js +0 -2
  239. package/dist/device-env-K7J5NN66.js +0 -2
  240. package/dist/explore-S2BGQUIF.js +0 -2
  241. package/dist/install-7J34AYB6.js +0 -2
  242. package/dist/login-flow-ZQ6UFTS2.js +0 -2
  243. package/dist/pipeline-MVZRI6YZ.js +0 -2
  244. package/dist/real-device-run-DGENHGUV.js +0 -2
  245. package/dist/registry-NV3EMDMK.js +0 -2
  246. package/dist/remote-entry-BCTFT643.js +0 -2
  247. package/dist/run-test-md-G6U3RU2Q.js +0 -19
  248. package/dist/tcg-generate-CUY4AZ2V.js +0 -2
  249. package/dist/token-refresh-K6PVBBFE.js +0 -2
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as P}from"./chunk-4HYPMGDF.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a as c,b as l,i as X}from"./chunk-33DWJV67.js";import{a as Z}from"./chunk-6YGTRKDT.js";import{z as i}from"./chunk-FAMQ4DHU.js";import{e as O}from"./chunk-UR6MHSHU.js";var u=O(Z(),1);var e=O(Y(),1),d=5;function _(t,I){if(!I)return t;let a=I.toLowerCase();return t.filter(L=>L.label.toLowerCase().includes(a))}function U(t){let{title:I,items:a,loading:L=!1,loadingText:$,error:A=null,itemNoun:B="items",onSelect:k,onCancel:R,defaultActiveId:D,onTab:T,extraHint:w}=t,[b,s]=(0,u.useState)(0),[v,g]=(0,u.useState)(0),[f,M]=(0,u.useState)(""),[y,x]=(0,u.useState)(null),H=(0,u.useRef)(!1),N=!t.onSearch&&f!=="";(0,u.useEffect)(()=>{if(a.length===0||N)return;let n=D?a.findIndex(o=>o.id===D):a.findIndex(o=>o.isActive);if(t.preserveSelectionById&&!H.current&&n>=0&&a[n].id!==y){g(Math.floor(n/d)),s(n%d),x(a[n].id);return}if(t.preserveSelectionById&&y!==null){let o=a.findIndex(r=>r.id===y);if(o>=0){g(Math.floor(o/d)),s(o%d);return}}n>=0?(g(Math.floor(n/d)),s(n%d),t.preserveSelectionById&&x(a[n].id)):t.preserveSelectionById&&(g(0),s(0),x(a[0]?.id??null))},[a,D,t.preserveSelectionById,y,N]),(0,u.useEffect)(()=>{if(!t.onSearch)return;let n=setTimeout(()=>t.onSearch(f),t.searchDebounceMs??250);return()=>clearTimeout(n)},[f,t.onSearch,t.searchDebounceMs]);let m=t.onSearch?a:_(a,f),C=v*d,F=Math.min(C+d,m.length),E=Math.ceil(m.length/d),G=F-C,h=m.slice(C,F);return X((n,o)=>{if(H.current=!0,A){o.escape?R():o.tab&&T&&t.tabOnError&&T();return}if(o.escape){f?(M(""),s(0),g(0)):R();return}if(o.tab&&T){T();return}if(o.upArrow){if(b>0){let r=b-1;s(r),t.preserveSelectionById&&x(h[r]?.id??null)}else if(v>0){let r=v-1,S=d-1;g(r),s(S),t.preserveSelectionById&&x(m[r*d+S]?.id??null)}return}if(o.downArrow){if(b<G-1){let r=b+1;s(r),t.preserveSelectionById&&x(h[r]?.id??null)}else if(v<E-1){let r=v+1,S=0;g(r),s(S),t.preserveSelectionById&&x(m[r*d+S]?.id??null)}return}if(o.return&&h[b]){if(h[b].disabled)return;k(h[b]);return}if(o.backspace||o.delete){M(r=>r.slice(0,-1)),s(0),g(0);return}n&&!o.ctrl&&!o.meta&&(M(r=>r+n),s(0),g(0))},{isActive:!L}),L?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:i.orange,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(l,{color:i.secondary,children:$??`Loading ${B}\u2026`})})]}):A?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.red,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:i.red,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(l,{color:i.red,children:A})}),(0,e.jsx)(P,{bindings:t.tabOnError&&T&&w?[{keys:"tab",label:w}]:[],escBackLabel:t.escLabel??"back to chat"})]}):(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,e.jsxs)(c,{children:[(0,e.jsx)(l,{color:i.orange,bold:!0,children:I}),(0,e.jsxs)(l,{color:i.dim,children:[" (",m.length,!t.onSearch&&f?`/${a.length}`:""," ",B,t.loadingMore?" \xB7 loading more":"",")"]})]}),(0,e.jsxs)(c,{marginTop:1,children:[(0,e.jsx)(l,{color:i.secondary,children:f?"filter: ":""}),f?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{children:f}),(0,e.jsx)(l,{inverse:!0,children:" "})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(l,{color:i.dim,children:["Search ",B,"\u2026"]}),(0,e.jsx)(l,{inverse:!0,children:" "})]})]}),(0,e.jsx)(c,{flexDirection:"column",marginTop:1,children:t.searching?(0,e.jsxs)(l,{color:i.secondary,children:["Searching ",B,"\u2026"]}):m.length===0?(0,e.jsxs)(l,{color:i.dim,children:["No ",B,' match "',f,'"']}):h.map((n,o)=>{let r=o===b,S=r?"\u276F ":" ",K=n.disabled?i.muted:n.isActive?i.green:r?i.orange:void 0;return(0,e.jsxs)(c,{flexDirection:"column",children:[(0,e.jsxs)(l,{color:K,children:[S,n.label,n.isActive&&!n.disabled?" \u25CF selected":""]}),r&&n.disabled&&n.disabledHint&&(0,e.jsxs)(l,{color:i.red,children:[" ",n.disabledHint]})]},n.id)})}),!t.searching&&E>1&&(0,e.jsx)(c,{marginTop:1,children:(0,e.jsxs)(l,{color:i.dim,children:["Page ",v+1,"/",E]})}),t.footer&&(0,e.jsx)(c,{marginTop:1,flexDirection:"column",children:t.footer}),(0,e.jsx)(P,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"type",label:"to search"},...t.hideSelectOnDisabled&&h[b]?.disabled?[]:[{keys:"\u21B5",label:"select"}],...T&&w?[{keys:"tab",label:w}]:[]],escBackLabel:f?"clear":t.escLabel??"back to chat"})]})}export{U as a};
2
+ import{a as P}from"./chunk-YCVEI7BT.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a as c,b as l,i as X}from"./chunk-33DWJV67.js";import{a as Z}from"./chunk-6YGTRKDT.js";import{z as i}from"./chunk-J4FIESTB.js";import{e as O}from"./chunk-UR6MHSHU.js";var u=O(Z(),1);var e=O(Y(),1),d=5;function _(t,I){if(!I)return t;let a=I.toLowerCase();return t.filter(L=>L.label.toLowerCase().includes(a))}function U(t){let{title:I,items:a,loading:L=!1,loadingText:$,error:A=null,itemNoun:B="items",onSelect:k,onCancel:R,defaultActiveId:D,onTab:T,extraHint:w}=t,[b,s]=(0,u.useState)(0),[v,g]=(0,u.useState)(0),[f,M]=(0,u.useState)(""),[y,x]=(0,u.useState)(null),H=(0,u.useRef)(!1),N=!t.onSearch&&f!=="";(0,u.useEffect)(()=>{if(a.length===0||N)return;let n=D?a.findIndex(o=>o.id===D):a.findIndex(o=>o.isActive);if(t.preserveSelectionById&&!H.current&&n>=0&&a[n].id!==y){g(Math.floor(n/d)),s(n%d),x(a[n].id);return}if(t.preserveSelectionById&&y!==null){let o=a.findIndex(r=>r.id===y);if(o>=0){g(Math.floor(o/d)),s(o%d);return}}n>=0?(g(Math.floor(n/d)),s(n%d),t.preserveSelectionById&&x(a[n].id)):t.preserveSelectionById&&(g(0),s(0),x(a[0]?.id??null))},[a,D,t.preserveSelectionById,y,N]),(0,u.useEffect)(()=>{if(!t.onSearch)return;let n=setTimeout(()=>t.onSearch(f),t.searchDebounceMs??250);return()=>clearTimeout(n)},[f,t.onSearch,t.searchDebounceMs]);let m=t.onSearch?a:_(a,f),C=v*d,F=Math.min(C+d,m.length),E=Math.ceil(m.length/d),G=F-C,h=m.slice(C,F);return X((n,o)=>{if(H.current=!0,A){o.escape?R():o.tab&&T&&t.tabOnError&&T();return}if(o.escape){f?(M(""),s(0),g(0)):R();return}if(o.tab&&T){T();return}if(o.upArrow){if(b>0){let r=b-1;s(r),t.preserveSelectionById&&x(h[r]?.id??null)}else if(v>0){let r=v-1,S=d-1;g(r),s(S),t.preserveSelectionById&&x(m[r*d+S]?.id??null)}return}if(o.downArrow){if(b<G-1){let r=b+1;s(r),t.preserveSelectionById&&x(h[r]?.id??null)}else if(v<E-1){let r=v+1,S=0;g(r),s(S),t.preserveSelectionById&&x(m[r*d+S]?.id??null)}return}if(o.return&&h[b]){if(h[b].disabled)return;k(h[b]);return}if(o.backspace||o.delete){M(r=>r.slice(0,-1)),s(0),g(0);return}n&&!o.ctrl&&!o.meta&&(M(r=>r+n),s(0),g(0))},{isActive:!L}),L?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:i.orange,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(l,{color:i.secondary,children:$??`Loading ${B}\u2026`})})]}):A?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.red,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:i.red,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(l,{color:i.red,children:A})}),(0,e.jsx)(P,{bindings:t.tabOnError&&T&&w?[{keys:"tab",label:w}]:[],escBackLabel:t.escLabel??"back to chat"})]}):(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,e.jsxs)(c,{children:[(0,e.jsx)(l,{color:i.orange,bold:!0,children:I}),(0,e.jsxs)(l,{color:i.dim,children:[" (",m.length,!t.onSearch&&f?`/${a.length}`:""," ",B,t.loadingMore?" \xB7 loading more":"",")"]})]}),(0,e.jsxs)(c,{marginTop:1,children:[(0,e.jsx)(l,{color:i.secondary,children:f?"filter: ":""}),f?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{children:f}),(0,e.jsx)(l,{inverse:!0,children:" "})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(l,{color:i.dim,children:["Search ",B,"\u2026"]}),(0,e.jsx)(l,{inverse:!0,children:" "})]})]}),(0,e.jsx)(c,{flexDirection:"column",marginTop:1,children:t.searching?(0,e.jsxs)(l,{color:i.secondary,children:["Searching ",B,"\u2026"]}):m.length===0?(0,e.jsxs)(l,{color:i.dim,children:["No ",B,' match "',f,'"']}):h.map((n,o)=>{let r=o===b,S=r?"\u276F ":" ",K=n.disabled?i.muted:n.isActive?i.green:r?i.orange:void 0;return(0,e.jsxs)(c,{flexDirection:"column",children:[(0,e.jsxs)(l,{color:K,children:[S,n.label,n.isActive&&!n.disabled?" \u25CF selected":""]}),r&&n.disabled&&n.disabledHint&&(0,e.jsxs)(l,{color:i.red,children:[" ",n.disabledHint]})]},n.id)})}),!t.searching&&E>1&&(0,e.jsx)(c,{marginTop:1,children:(0,e.jsxs)(l,{color:i.dim,children:["Page ",v+1,"/",E]})}),t.footer&&(0,e.jsx)(c,{marginTop:1,flexDirection:"column",children:t.footer}),(0,e.jsx)(P,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"type",label:"to search"},...t.hideSelectOnDisabled&&h[b]?.disabled?[]:[{keys:"\u21B5",label:"select"}],...T&&w?[{keys:"tab",label:w}]:[]],escBackLabel:f?"clear":t.escLabel??"back to chat"})]})}export{U as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-4HYPMGDF.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-33DWJV67.js";import{a as b}from"./chunk-6YGTRKDT.js";import{z as t}from"./chunk-FAMQ4DHU.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
2
+ import{a as m}from"./chunk-YCVEI7BT.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-33DWJV67.js";import{a as b}from"./chunk-6YGTRKDT.js";import{z as t}from"./chunk-J4FIESTB.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as B}from"./chunk-S3DAAAE5.js";import{a as g}from"./chunk-XHFU5TGS.js";import{a as w}from"./chunk-HCBYKLMW.js";import{a as x,b as t,c as h,i as P,j as S}from"./chunk-33DWJV67.js";import{a as C}from"./chunk-6YGTRKDT.js";import{z as s}from"./chunk-FAMQ4DHU.js";import{e as T}from"./chunk-UR6MHSHU.js";var o=T(C(),1);var e=T(w(),1);function D({defaultName:i,onSubmit:c}){let[d,p]=(0,o.useState)("confirm"),[f,a]=(0,o.useState)(""),[m,u]=(0,o.useState)(null),l=(0,o.useMemo)(()=>f.trim()||i,[f,i]);return P((n,r)=>{if(d==="confirm"){if(n==="y"||n==="Y"){a(i),p("name");return}if(n==="n"||n==="N"||r.escape||r.ctrl&&n==="c"){c(null);return}if(r.return){c(i);return}return}if(r.return){if(!B(l)){u(`name "${l}" is invalid; allowed: letters, digits, underscore, hyphen`);return}c(l);return}if(r.escape||r.ctrl&&n==="c"){c(null);return}if(r.backspace||r.delete){a(v=>v.slice(0,-1)),u(null);return}n&&!r.ctrl&&!r.meta&&(a(v=>v+n),u(null))}),d==="confirm"?(0,e.jsx)(g,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsx)(t,{color:s.orange,children:i})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[(0,e.jsx)(t,{color:s.dim,children:"enter \u2014 save with this name"}),(0,e.jsx)(t,{color:s.dim,children:"Y \u2014 edit name"}),(0,e.jsx)(t,{color:s.dim,children:"N/esc \u2014 discard session"})]})}):(0,e.jsx)(g,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsxs)(x,{children:[(0,e.jsx)(t,{color:s.orange,children:f}),(0,e.jsx)(t,{inverse:!0,children:" "})]})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[m&&(0,e.jsx)(t,{color:s.red,children:m}),(0,e.jsx)(t,{color:s.dim,children:"enter \u2014 save \xB7 esc \u2014 discard"})]})})}function V(){return new Date().toISOString().slice(0,19).replace(/:/g,"-")}async function Y(i){return new Promise(c=>{function d(){let{exit:a}=S(),[m,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(m){let l=setTimeout(()=>a(),50);return()=>clearTimeout(l)}},[m,a]),(0,e.jsx)(D,{defaultName:i,onSubmit:l=>{c(l),u(!0)}})}let{waitUntilExit:p,unmount:f}=h((0,e.jsx)(d,{}),{stdout:process.stderr,exitOnCtrlC:!1});p().then(()=>{try{f()}catch{}})})}export{D as a,V as b,Y as c};
2
+ import{b as B}from"./chunk-S3DAAAE5.js";import{a as g}from"./chunk-YVVFXBT5.js";import{a as w}from"./chunk-HCBYKLMW.js";import{a as x,b as t,c as h,i as P,j as S}from"./chunk-33DWJV67.js";import{a as C}from"./chunk-6YGTRKDT.js";import{z as s}from"./chunk-J4FIESTB.js";import{e as T}from"./chunk-UR6MHSHU.js";var o=T(C(),1);var e=T(w(),1);function D({defaultName:i,onSubmit:c}){let[d,p]=(0,o.useState)("confirm"),[f,a]=(0,o.useState)(""),[m,u]=(0,o.useState)(null),l=(0,o.useMemo)(()=>f.trim()||i,[f,i]);return P((n,r)=>{if(d==="confirm"){if(n==="y"||n==="Y"){a(i),p("name");return}if(n==="n"||n==="N"||r.escape||r.ctrl&&n==="c"){c(null);return}if(r.return){c(i);return}return}if(r.return){if(!B(l)){u(`name "${l}" is invalid; allowed: letters, digits, underscore, hyphen`);return}c(l);return}if(r.escape||r.ctrl&&n==="c"){c(null);return}if(r.backspace||r.delete){a(v=>v.slice(0,-1)),u(null);return}n&&!r.ctrl&&!r.meta&&(a(v=>v+n),u(null))}),d==="confirm"?(0,e.jsx)(g,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsx)(t,{color:s.orange,children:i})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[(0,e.jsx)(t,{color:s.dim,children:"enter \u2014 save with this name"}),(0,e.jsx)(t,{color:s.dim,children:"Y \u2014 edit name"}),(0,e.jsx)(t,{color:s.dim,children:"N/esc \u2014 discard session"})]})}):(0,e.jsx)(g,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsxs)(x,{children:[(0,e.jsx)(t,{color:s.orange,children:f}),(0,e.jsx)(t,{inverse:!0,children:" "})]})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[m&&(0,e.jsx)(t,{color:s.red,children:m}),(0,e.jsx)(t,{color:s.dim,children:"enter \u2014 save \xB7 esc \u2014 discard"})]})})}function V(){return new Date().toISOString().slice(0,19).replace(/:/g,"-")}async function Y(i){return new Promise(c=>{function d(){let{exit:a}=S(),[m,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(m){let l=setTimeout(()=>a(),50);return()=>clearTimeout(l)}},[m,a]),(0,e.jsx)(D,{defaultName:i,onSubmit:l=>{c(l),u(!0)}})}let{waitUntilExit:p,unmount:f}=h((0,e.jsx)(d,{}),{stdout:process.stderr,exitOnCtrlC:!1});p().then(()=>{try{f()}catch{}})})}export{D as a,V as b,Y as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as g}from"./chunk-TZXXJWHA.js";import{a as C}from"./chunk-4HYPMGDF.js";import{d as b,j as x,k as T,n as S}from"./chunk-A7RJQJNT.js";import{a as v}from"./chunk-HCBYKLMW.js";import{a,b as l,i as f}from"./chunk-33DWJV67.js";import{a as B}from"./chunk-6YGTRKDT.js";import{z as s}from"./chunk-FAMQ4DHU.js";import{e as h}from"./chunk-UR6MHSHU.js";var y=h(B(),1);var o=h(v(),1);function k(i,d=g()){let n=S(d);return(i==="all"?n:i==="devices"?n.filter(e=>b(e)):["emulator","simulator"].filter(e=>n.includes(e))).map(e=>({value:e,label:x(e),hint:T(e)}))}function H({mode:i="all",hostSupportsMobile:d=g(),onSelect:n,onCancel:c}){let e=k(i,d),[m,u]=(0,y.useState)(0);return f((p,t)=>{if(t.escape&&c){c();return}t.upArrow&&u(r=>Math.max(0,r-1)),t.downArrow&&u(r=>Math.min(e.length-1,r+1)),t.return&&n(e[m].value)}),(0,o.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:s.orange,paddingX:2,paddingY:1,children:[(0,o.jsx)(l,{color:s.orange,bold:!0,children:i==="all"?"Where should tests run?":"Which kind of device?"}),(0,o.jsx)(a,{marginTop:1,flexDirection:"column",children:e.map((p,t)=>{let r=t===m;return(0,o.jsxs)(a,{children:[(0,o.jsxs)(l,{color:r?s.orange:void 0,children:[r?"\u276F ":" ",p.label]}),(0,o.jsxs)(l,{color:s.dim,children:[" ",p.hint]})]},p.value)})}),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(l,{color:s.dim,children:"You can change this any time with /desktop or /mobile."})}),(0,o.jsx)(C,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],suppressEscBack:!c,escBackLabel:"skip"})]})}export{H as a};
2
+ import{b as g}from"./chunk-TZXXJWHA.js";import{a as C}from"./chunk-YCVEI7BT.js";import{d as b,j as x,k as T,n as S}from"./chunk-A7RJQJNT.js";import{a as v}from"./chunk-HCBYKLMW.js";import{a,b as l,i as f}from"./chunk-33DWJV67.js";import{a as B}from"./chunk-6YGTRKDT.js";import{z as s}from"./chunk-J4FIESTB.js";import{e as h}from"./chunk-UR6MHSHU.js";var y=h(B(),1);var o=h(v(),1);function k(i,d=g()){let n=S(d);return(i==="all"?n:i==="devices"?n.filter(e=>b(e)):["emulator","simulator"].filter(e=>n.includes(e))).map(e=>({value:e,label:x(e),hint:T(e)}))}function H({mode:i="all",hostSupportsMobile:d=g(),onSelect:n,onCancel:c}){let e=k(i,d),[m,u]=(0,y.useState)(0);return f((p,t)=>{if(t.escape&&c){c();return}t.upArrow&&u(r=>Math.max(0,r-1)),t.downArrow&&u(r=>Math.min(e.length-1,r+1)),t.return&&n(e[m].value)}),(0,o.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:s.orange,paddingX:2,paddingY:1,children:[(0,o.jsx)(l,{color:s.orange,bold:!0,children:i==="all"?"Where should tests run?":"Which kind of device?"}),(0,o.jsx)(a,{marginTop:1,flexDirection:"column",children:e.map((p,t)=>{let r=t===m;return(0,o.jsxs)(a,{children:[(0,o.jsxs)(l,{color:r?s.orange:void 0,children:[r?"\u276F ":" ",p.label]}),(0,o.jsxs)(l,{color:s.dim,children:[" ",p.hint]})]},p.value)})}),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(l,{color:s.dim,children:"You can change this any time with /desktop or /mobile."})}),(0,o.jsx)(C,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],suppressEscBack:!c,escBackLabel:"skip"})]})}export{H as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as L}from"./chunk-3YIA3DSL.js";async function T(n,i,c){let[h,d,l,m,a]=await Promise.all([c.includes("source")?n.sources(i):Promise.resolve([]),c.includes("usecase")?n.nodes(i,"usecase"):Promise.resolve([]),c.includes("usecase")?n.stale(i):Promise.resolve([]),c.includes("scenario")?n.nodes(i,"scenario"):Promise.resolve([]),c.includes("test")?n.nodes(i,"test"):Promise.resolve([])]),o=new Set;for(let e of l.filter(s=>s.label==="scenario"&&(s.freshness==="stale"||s.freshness==="orphaned"))){let s=await n.mainNode(i,e.cid);for(let t of s.edgesOut)t.type==="belongs_to"&&t.other?.name&&(t.other.freshness==="superseded"||t.other.supersededBy)&&o.add(t.other.name)}let r=h.filter(e=>e.head!==null).map(e=>{let s=L(e.origin);return{id:e.sourceId,label:"source",title:e.sourceId,trust:"-",fresh:"fresh",upToDate:"yes",...s?{shown:s}:{}}}),R=d.map(e=>{let s=e.name??"-";if(e.trust==="archived")return{id:s,label:"usecase",title:e.title??"",trust:e.trust,fresh:"-",upToDate:"archived"};let t=e.name!==null&&o.has(e.name),u=e.freshness??"fresh",f=u==="stale"?"source_changed":u==="orphaned"?"source_removed":t?"tests_out_of_date":"yes";return{id:s,label:"usecase",title:e.title??"",trust:e.trust,fresh:u,...t?{testsFresh:"stale"}:{},upToDate:f}}),g=(e,s)=>e.map(t=>{let u=t.name??"-",f=t.title??"";if(t.trust==="archived")return{id:u,label:s,title:f,trust:t.trust,fresh:"-",upToDate:"archived"};let w=t.freshness??"fresh",b=w==="stale"?"designed_from_changed":w==="orphaned"?"source_removed":"yes";return{id:u,label:s,title:f,trust:t.trust,fresh:w,upToDate:b}}),y=g(m,"scenario"),_=g(a,"test"),v=e=>Number(/^[a-z]+-(\d+)$/i.exec(e.id)?.[1]??Number.MAX_SAFE_INTEGER),p=(e,s)=>v(e)-v(s)||e.title.localeCompare(s.title);return r.sort((e,s)=>e.id.localeCompare(s.id)),R.sort(p),y.sort(p),_.sort(p),[...r,...R,...y,..._]}async function P(n,i){let c=(await n.nodes(i,"test")).filter(a=>a.trust!=="archived"),h=new Set((await n.nodes(i,"scenario")).filter(a=>a.trust==="archived").map(a=>a.cid)),d=new Set;for(let a of c){let o=await n.mainNode(i,a.cid);for(let r of o.edgesOut)r.type==="automates"&&r.other!==null&&d.add(r.other.cid)}let l=new Set,m=new Set;for(let a of d){let o=await n.mainNode(i,a);for(let r=0;o.supersededBy!==null&&o.supersededBy!==""&&r<64;r++)o=await n.mainNode(i,o.supersededBy);if(!(o.supersededBy===""||m.has(o.cid))&&(m.add(o.cid),!h.has(o.cid)))for(let r of o.edgesOut)r.type==="belongs_to"&&r.other?.name&&l.add(r.other.name)}return l}export{T as a,P as b};
2
+ import{e as L}from"./chunk-X2MDL6S4.js";async function T(n,i,c){let[h,d,l,m,a]=await Promise.all([c.includes("source")?n.sources(i):Promise.resolve([]),c.includes("usecase")?n.nodes(i,"usecase"):Promise.resolve([]),c.includes("usecase")?n.stale(i):Promise.resolve([]),c.includes("scenario")?n.nodes(i,"scenario"):Promise.resolve([]),c.includes("test")?n.nodes(i,"test"):Promise.resolve([])]),o=new Set;for(let e of l.filter(s=>s.label==="scenario"&&(s.freshness==="stale"||s.freshness==="orphaned"))){let s=await n.mainNode(i,e.cid);for(let t of s.edgesOut)t.type==="belongs_to"&&t.other?.name&&(t.other.freshness==="superseded"||t.other.supersededBy)&&o.add(t.other.name)}let r=h.filter(e=>e.head!==null).map(e=>{let s=L(e.origin);return{id:e.sourceId,label:"source",title:e.sourceId,trust:"-",fresh:"fresh",upToDate:"yes",...s?{shown:s}:{}}}),R=d.map(e=>{let s=e.name??"-";if(e.trust==="archived")return{id:s,label:"usecase",title:e.title??"",trust:e.trust,fresh:"-",upToDate:"archived"};let t=e.name!==null&&o.has(e.name),u=e.freshness??"fresh",f=u==="stale"?"source_changed":u==="orphaned"?"source_removed":t?"tests_out_of_date":"yes";return{id:s,label:"usecase",title:e.title??"",trust:e.trust,fresh:u,...t?{testsFresh:"stale"}:{},upToDate:f}}),g=(e,s)=>e.map(t=>{let u=t.name??"-",f=t.title??"";if(t.trust==="archived")return{id:u,label:s,title:f,trust:t.trust,fresh:"-",upToDate:"archived"};let w=t.freshness??"fresh",b=w==="stale"?"designed_from_changed":w==="orphaned"?"source_removed":"yes";return{id:u,label:s,title:f,trust:t.trust,fresh:w,upToDate:b}}),y=g(m,"scenario"),_=g(a,"test"),v=e=>Number(/^[a-z]+-(\d+)$/i.exec(e.id)?.[1]??Number.MAX_SAFE_INTEGER),p=(e,s)=>v(e)-v(s)||e.title.localeCompare(s.title);return r.sort((e,s)=>e.id.localeCompare(s.id)),R.sort(p),y.sort(p),_.sort(p),[...r,...R,...y,..._]}async function P(n,i){let c=(await n.nodes(i,"test")).filter(a=>a.trust!=="archived"),h=new Set((await n.nodes(i,"scenario")).filter(a=>a.trust==="archived").map(a=>a.cid)),d=new Set;for(let a of c){let o=await n.mainNode(i,a.cid);for(let r of o.edgesOut)r.type==="automates"&&r.other!==null&&d.add(r.other.cid)}let l=new Set,m=new Set;for(let a of d){let o=await n.mainNode(i,a);for(let r=0;o.supersededBy!==null&&o.supersededBy!==""&&r<64;r++)o=await n.mainNode(i,o.supersededBy);if(!(o.supersededBy===""||m.has(o.cid))&&(m.add(o.cid),!h.has(o.cid)))for(let r of o.edgesOut)r.type==="belongs_to"&&r.other?.name&&l.add(r.other.name)}return l}export{T as a,P as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{h as m,i as h,j as _,o as w,p as E,q as l,r as f,s as u,t as d,u as x}from"./chunk-UMNCM4RJ.js";import{a as g,b as y}from"./chunk-KGNE5CIM.js";function C(t,e){let r=typeof t.body?.retry_after_s=="number"?t.body.retry_after_s:null;if(t.code==="TOO_SOON")return`${r!==null?`in ${Math.max(1,Math.ceil(r/60))} min, `:"later, "}kane-cli explore context sync ${e}`;if(t.code==="CONTEXT_OFF")return`kane-cli explore context on ${e}`}async function b(t,e,r){if(r.out&&!r.projectNames)return;let s=await new y({baseUrl:t.controllerBaseUrl,auth:t.basic,timeoutMs:w}).viewSummary(e),n=typeof s?.project_id=="string"?s.project_id:"";if(n)return(await E(r,t)([n]))[n]??n.slice(0,8)}function k(t){let e=typeof t.body?.retry_after_s=="number"?t.body.retry_after_s:null;return t.code==="TOO_SOON"&&e!==null?`TOO_SOON: the last cut was taken too recently (a run's end takes one too); the next can start in ${Math.max(1,Math.ceil(e/60))} min`:t.code==="CONTEXT_OFF"?`CONTEXT_OFF: assurance context is off for this exploration${typeof t.body?.off_reason=="string"?` (${t.body.off_reason})`:""}; turn it on with explore context on`:u(t)}async function N(t,e,r,s={}){let n=f(s,e,r),i=await l(r,`explore context ${t}`);if(!i.ok)return n.fail(i.error);let a=d(i);try{if(t==="sync"){let o=await a.syncContext(e);if(!n.tty)n.event({type:"explore_context_sync",exploration_id:e,state:o.state,job_id:o.job_id??null,cut:o.cut??null,trigger:o.trigger??null,running_job_id:o.running_job_id??null,hx_job_link:o.hx_job_link??null,...o.state==="failed"?{error:o.error??null}:{}});else if(o.state!=="failed")for(let O of h(e,o))n.out(O);return o.state==="failed"?n.fail(T(e,o),1,j(e,o)):n.ok()}let c=t==="status"?await a.getContext(e):await a.setContext(e,t==="on");if(!n.tty)n.event({type:"explore_context",exploration_id:e,action:t,context:c});else if(t==="status")for(let o of m(c,{project:await b(i,e,s)}))n.out(o);else for(let o of _(e,c,t,await b(i,e,s)))n.out(o);return n.ok()}catch(c){let o=A(c,t,e);return n.fail(o.message,o.code,o.next)}}function A(t,e,r){if(t instanceof g){if(t.code==="NO_ENDED_RUN")return{message:"NO_ENDED_RUN: no run of this exploration has ended yet; the first assurance job runs when one ends",code:1,next:"run it first: kane-cli explore run \u2026, then sync"};if(t.status===404)return{message:`exploration ${r} not found, or this service has no assurance context yet`,code:2};if(t.status===501)return{message:`this service has no assurance context yet (exploration ${r})`,code:2};if(t.code==="NOT_CONFIGURED")return{message:"NOT_CONFIGURED: assurance jobs are not set up on this service (no HyperExecute or report URL); context stays on and runs once they are",code:1};if(t.status===401||t.status===403)return{message:u(t),code:2};if(t.status<500){let s=C(t,r);return{message:k(t),code:1,...s?{next:s}:{}}}}return{message:`could not ${e==="status"?"read":e==="sync"?"sync":"change"} the assurance context: ${u(t)}`,code:1}}function T(t,e){return`${e.error?.code??"LAUNCH_FAILED"}: the assurance job could not launch${e.error?.message?` (${e.error.message})`:""}; explore context status ${t} shows it`}function j(t,e){let r=e.error?.code??"LAUNCH_FAILED";return`try again: kane-cli explore context sync ${t}${r==="HX_TRIGGER_FAILED"?"; or run with --local-orchestration":""}`}var $="usage: kane-cli explore context <status|on|off|sync> <exploration-id> (or explore context <exploration-id> on a terminal for the panel)";async function F(t,e,r={}){let s=f(r,t??null,e);if(!s.tty||!t)return s.fail($);let n=await l(e,"explore context");if(!n.ok)return s.fail(n.error);let{runContextPanel:i}=await import("./explore-context-tty-WJHUSP3A.js"),a=typeof e.env=="string"?e.env:"prod";return await i({client:d(n),explorationId:t,env:a})==="exit"?130:0}function p(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function U(t){let e=x(t.command("context").description("An exploration's assurance context (on by default): on, off, status, sync; with only the id, the panel on a terminal").argument("[exploration-id]","The exploration (no action: the context panel on a terminal)")).action(async(s,n)=>{process.exitCode=await F(s,p(n))}),r=[["status","Whether context is on, what is pending or running, and what the last assurance job did"],["on","Turn assurance context on (catches up from the newest ended run)"],["off","Turn assurance context off: the next cut is skipped; nothing already saved is deleted"],["sync","Ask for an assurance job now: launched, pending behind a running job, or up to date"]];for(let[s,n]of r)x(e.command(s).description(n).argument("<exploration-id>","The exploration")).action(async(i,a)=>{process.exitCode=await N(s,i,{...p(e.opts()),...p(a)})})}export{A as a,T as b,U as c};
2
+ import{h as m,i as h,j as _,o as w,p as E,q as l,r as f,s as u,t as d,u as x}from"./chunk-OTMHCHH6.js";import{a as g,b as y}from"./chunk-KGNE5CIM.js";function C(t,e){let r=typeof t.body?.retry_after_s=="number"?t.body.retry_after_s:null;if(t.code==="TOO_SOON")return`${r!==null?`in ${Math.max(1,Math.ceil(r/60))} min, `:"later, "}kane-cli explore context sync ${e}`;if(t.code==="CONTEXT_OFF")return`kane-cli explore context on ${e}`}async function b(t,e,r){if(r.out&&!r.projectNames)return;let s=await new y({baseUrl:t.controllerBaseUrl,auth:t.basic,timeoutMs:w}).viewSummary(e),n=typeof s?.project_id=="string"?s.project_id:"";if(n)return(await E(r,t)([n]))[n]??n.slice(0,8)}function k(t){let e=typeof t.body?.retry_after_s=="number"?t.body.retry_after_s:null;return t.code==="TOO_SOON"&&e!==null?`TOO_SOON: the last cut was taken too recently (a run's end takes one too); the next can start in ${Math.max(1,Math.ceil(e/60))} min`:t.code==="CONTEXT_OFF"?`CONTEXT_OFF: assurance context is off for this exploration${typeof t.body?.off_reason=="string"?` (${t.body.off_reason})`:""}; turn it on with explore context on`:u(t)}async function N(t,e,r,s={}){let n=f(s,e,r),i=await l(r,`explore context ${t}`);if(!i.ok)return n.fail(i.error);let a=d(i);try{if(t==="sync"){let o=await a.syncContext(e);if(!n.tty)n.event({type:"explore_context_sync",exploration_id:e,state:o.state,job_id:o.job_id??null,cut:o.cut??null,trigger:o.trigger??null,running_job_id:o.running_job_id??null,hx_job_link:o.hx_job_link??null,...o.state==="failed"?{error:o.error??null}:{}});else if(o.state!=="failed")for(let O of h(e,o))n.out(O);return o.state==="failed"?n.fail(T(e,o),1,j(e,o)):n.ok()}let c=t==="status"?await a.getContext(e):await a.setContext(e,t==="on");if(!n.tty)n.event({type:"explore_context",exploration_id:e,action:t,context:c});else if(t==="status")for(let o of m(c,{project:await b(i,e,s)}))n.out(o);else for(let o of _(e,c,t,await b(i,e,s)))n.out(o);return n.ok()}catch(c){let o=A(c,t,e);return n.fail(o.message,o.code,o.next)}}function A(t,e,r){if(t instanceof g){if(t.code==="NO_ENDED_RUN")return{message:"NO_ENDED_RUN: no run of this exploration has ended yet; the first assurance job runs when one ends",code:1,next:"run it first: kane-cli explore run \u2026, then sync"};if(t.status===404)return{message:`exploration ${r} not found, or this service has no assurance context yet`,code:2};if(t.status===501)return{message:`this service has no assurance context yet (exploration ${r})`,code:2};if(t.code==="NOT_CONFIGURED")return{message:"NOT_CONFIGURED: assurance jobs are not set up on this service (no HyperExecute or report URL); context stays on and runs once they are",code:1};if(t.status===401||t.status===403)return{message:u(t),code:2};if(t.status<500){let s=C(t,r);return{message:k(t),code:1,...s?{next:s}:{}}}}return{message:`could not ${e==="status"?"read":e==="sync"?"sync":"change"} the assurance context: ${u(t)}`,code:1}}function T(t,e){return`${e.error?.code??"LAUNCH_FAILED"}: the assurance job could not launch${e.error?.message?` (${e.error.message})`:""}; explore context status ${t} shows it`}function j(t,e){let r=e.error?.code??"LAUNCH_FAILED";return`try again: kane-cli explore context sync ${t}${r==="HX_TRIGGER_FAILED"?"; or run with --local-orchestration":""}`}var $="usage: kane-cli explore context <status|on|off|sync> <exploration-id> (or explore context <exploration-id> on a terminal for the panel)";async function F(t,e,r={}){let s=f(r,t??null,e);if(!s.tty||!t)return s.fail($);let n=await l(e,"explore context");if(!n.ok)return s.fail(n.error);let{runContextPanel:i}=await import("./explore-context-tty-PERKIWXD.js"),a=typeof e.env=="string"?e.env:"prod";return await i({client:d(n),explorationId:t,env:a})==="exit"?130:0}function p(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function U(t){let e=x(t.command("context").description("An exploration's assurance context (on by default): on, off, status, sync; with only the id, the panel on a terminal").argument("[exploration-id]","The exploration (no action: the context panel on a terminal)")).action(async(s,n)=>{process.exitCode=await F(s,p(n))}),r=[["status","Whether context is on, what is pending or running, and what the last assurance job did"],["on","Turn assurance context on (catches up from the newest ended run)"],["off","Turn assurance context off: the next cut is skipped; nothing already saved is deleted"],["sync","Ask for an assurance job now: launched, pending behind a running job, or up to date"]];for(let[s,n]of r)x(e.command(s).description(n).argument("<exploration-id>","The exploration")).action(async(i,a)=>{process.exitCode=await N(s,i,{...p(e.opts()),...p(a)})})}export{A as a,T as b,U as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-HCBYKLMW.js";import{a as o,b as i}from"./chunk-33DWJV67.js";import{z as e}from"./chunk-FAMQ4DHU.js";import{e as d}from"./chunk-UR6MHSHU.js";var r=d(m(),1),s={default:e.muted,error:e.red,success:e.green,info:e.orange,warning:e.orange};function h({title:t,titleColor:a,borderColor:l,variant:n="default",children:c,width:u,paddingX:x=2,paddingY:g=0,marginBottom:f=0}){let p=l??s[n],B=a??(n==="default"?e.orange:s[n]);return(0,r.jsxs)(o,{flexDirection:"column",marginBottom:f,children:[t&&(0,r.jsx)(o,{marginBottom:0,children:(0,r.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,r.jsx)(o,{borderStyle:"round",borderColor:p,flexDirection:"column",paddingX:x,paddingY:g,width:u,children:c})]})}function k({label:t,value:a,labelColor:l=e.dim,valueColor:n,labelWidth:c=14}){return(0,r.jsxs)(o,{children:[(0,r.jsx)(o,{width:c,flexShrink:0,children:(0,r.jsx)(i,{color:l,children:t})}),(0,r.jsx)(o,{flexShrink:1,children:(0,r.jsx)(i,{color:n,wrap:"wrap",children:a})})]})}function I({label:t}){return(0,r.jsx)(o,{marginTop:1,marginBottom:0,children:(0,r.jsx)(i,{bold:!0,children:t})})}export{h as a,k as b,I as c};
2
+ import{a as m}from"./chunk-HCBYKLMW.js";import{a as o,b as i}from"./chunk-33DWJV67.js";import{z as e}from"./chunk-J4FIESTB.js";import{e as d}from"./chunk-UR6MHSHU.js";var r=d(m(),1),s={default:e.muted,error:e.red,success:e.green,info:e.orange,warning:e.orange};function h({title:t,titleColor:a,borderColor:l,variant:n="default",children:c,width:u,paddingX:x=2,paddingY:g=0,marginBottom:f=0}){let p=l??s[n],B=a??(n==="default"?e.orange:s[n]);return(0,r.jsxs)(o,{flexDirection:"column",marginBottom:f,children:[t&&(0,r.jsx)(o,{marginBottom:0,children:(0,r.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,r.jsx)(o,{borderStyle:"round",borderColor:p,flexDirection:"column",paddingX:x,paddingY:g,width:u,children:c})]})}function k({label:t,value:a,labelColor:l=e.dim,valueColor:n,labelWidth:c=14}){return(0,r.jsxs)(o,{children:[(0,r.jsx)(o,{width:c,flexShrink:0,children:(0,r.jsx)(i,{color:l,children:t})}),(0,r.jsx)(o,{flexShrink:1,children:(0,r.jsx)(i,{color:n,wrap:"wrap",children:a})})]})}function I({label:t}){return(0,r.jsx)(o,{marginTop:1,marginBottom:0,children:(0,r.jsx)(i,{bold:!0,children:t})})}export{h as a,k as b,I as c};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as c,b as l,c as _}from"./chunk-VZ7KXRXB.js";import{a as y}from"./chunk-FI2DVNRT.js";import{a as v}from"./chunk-RZ4F3BHX.js";import{a as i,p as f}from"./chunk-FAMQ4DHU.js";import{createHash as x}from"crypto";import{promises as o,readFileSync as A,writeFileSync as S,renameSync as N,mkdirSync as F}from"fs";import{dirname as T,join as u}from"path";var w=`# kane-cli metric catalog, version 1.
2
+ import{a as c,b as l,c as _}from"./chunk-VZ7KXRXB.js";import{a as y}from"./chunk-ZCBOHWN3.js";import{a as v}from"./chunk-RZ4F3BHX.js";import{a as i,p as f}from"./chunk-J4FIESTB.js";import{createHash as x}from"crypto";import{promises as o,readFileSync as A,writeFileSync as S,renameSync as N,mkdirSync as F}from"fs";import{dirname as T,join as u}from"path";var w=`# kane-cli metric catalog, version 1.
3
3
  #
4
4
  # Policies reference these as metrics.<name>. \`where\` and \`value\` expressions
5
5
  # are CEL over \`test\` (one tests/*/result.yaml, parsed), \`file\` and \`run\`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{i as n}from"./chunk-XMPTFXPW.js";import{a,b as l}from"./chunk-W2HRX3DR.js";import{a as s}from"./chunk-PVN64537.js";import{Ha as t,f as o}from"./chunk-H4TIVILC.js";import{a as i}from"./chunk-4QTH7VYE.js";var d=null;function m(){return d??=a()}function w(){d=null}var x={...l,controller:m},c=e=>new n("CREDENTIALS_MISSING",e.message,e.remedy);async function u(){let e;try{e=await m()}catch(r){throw r instanceof s?c(t.credentialsMissing()):r}if(!e.basic)throw c(e.token?t.loginUnconfirmed():t.credentialsMissing());return e.basic}async function f(){let e=await u();return i(e.username,e.accessKey)}function R(e){return{project:async r=>o({url:e,basicAuth:await f()}).project(r)}}export{m as a,w as b,x as c,u as d,f as e,R as f};
2
+ import{i as n}from"./chunk-XMPTFXPW.js";import{a,b as l}from"./chunk-EBJW6POT.js";import{a as s}from"./chunk-PVN64537.js";import{Ha as t,f as o}from"./chunk-WE7HRAGO.js";import{a as i}from"./chunk-4QTH7VYE.js";var d=null;function m(){return d??=a()}function w(){d=null}var x={...l,controller:m},c=e=>new n("CREDENTIALS_MISSING",e.message,e.remedy);async function u(){let e;try{e=await m()}catch(r){throw r instanceof s?c(t.credentialsMissing()):r}if(!e.basic)throw c(e.token?t.loginUnconfirmed():t.credentialsMissing());return e.basic}async function f(){let e=await u();return i(e.username,e.accessKey)}function R(e){return{project:async r=>o({url:e,basicAuth:await f()}).project(r)}}export{m as a,w as b,x as c,u as d,f as e,R as f};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as l}from"./chunk-BHQIH2FE.js";var m="12.0";function Z(t,r=m){let n=u=>{let[g,_]=u.split(".");return[Number(g)||0,Number(_)||0]},s=`; this kane-cli needs >= ${r}. Upgrade the controller first`;if(!t)return`the controller speaks a wire older than ${r} (it reports none)${s}`;let[i,p]=n(t),[a,c]=n(r);return i>a||i===a&&p>=c?null:`the controller speaks wire ${t}${s}`}var f=["explore_start","lease_start","lease_end","map_delta","progress","skill_updated","browser_request","browser_release","explore_end","lease_step","session_held","session_released","explore_frame"],b=["browser_ready","browser_failed","delta_ack","commit_refused","targets_added","stop","frames_start","frames_stop","frames_ack"],S=["recon","verify","explore","target","land","session","end","recheck"],x=["completed","unreachable","blocked","unsettled","budget","aborted","cancelled"],o=["read_only","mutating"],y=["queued","running","stopped"],E=["completed","budget","user_stop","stopped_before_start","timeout","heartbeat_lost"],k=["secrets_missing","no_browsers","commit_refused","commit_failed","runner_error","recon_failed","setup_failed","unexpected_event","focus_unknown","focus_unreachable","controller_outdated","vm_never_started"];function ee(t,r){return{code:`failed:${t}`,...r?{message:r}:{}}}var R=["unverified","verified","stale","changed","broken","gone","superseded","verified_to_edge"],w=["direct","flow","instance","held"],F=["toggle","revert","could_not_revert","storage_restored","gating","pagination","chrome","confirm","slow","how_it_works"],A=["console","network","flow_break","ux","policy","screen_changed","session","coverage","app_error","broken_link","slow","accessibility"],T=["reproduced","not_reproduced","inconclusive"],L=["subject","screen"],N=["broken","ux","coverage","changed","safety","performance","accessibility"];var h=["needs_sign_in","needs_value","read_only","state","off_site","path_broken","budget"],I=["telemetry_blocked","post_allowed"],q=["target","blocker","field","write"],v=["seeding","replay","walking","settling","verifying"],D=["open","bug","discarded","resolving","resolved"],K=["opened","promoted","discarded","marked_resolving","resolved_verified","recheck_inconclusive","resolved_by_person","reopened_seen","resolved_reached","restored"],C=["info","low","medium","high"],O=["verified","verified_healed","assert_failed","diverged","blocked","unsettled","partial","unreachable","verified_to_edge","start_failed","end_failed","verified_adapted","adapted"],P=["adapted","exit_moved"],B=["jump","replay","continued"],V=["session","one_shot","pending"],U=["start","end"],M=["session","one_shot","read","pending"],j=["judge","deps"],H=["version","state","different"],W=["navigate","replay"],G=["finding","flow","junction","candidate","junction_note","skill_area","skill_journey"],Y=["label","note","verdict","do_not_touch","resolve"],$=["correct","incorrect"],J=["user","agent"],X=["finding","flow","junction"],te={ExploreEventName:f,ControlMessageName:b,LeaseKind:S,LeaseResult:x,LeasePolicy:o,RunState:y,RemarkCode:E,FailedReason:k,FlowStatus:R,ReachKind:w,JunctionNoteKind:F,FindingKind:A,FindingStatus:D,StatusTransition:K,FindingCategory:N,RecheckResult:T,SimilarBy:L,BlockedBy:h,AuditKind:I,AnnotationKind:q,LeaseStepPhase:v,StatefulVerdictKind:M,StatefulVerdictSource:j,PathSegmentKind:W,FeedbackTargetKind:G,FeedbackType:Y,FeedbackVerdict:$,FeedbackAuthorKind:J,LabelAppliesTo:X,Severity:C,ObservationOutcome:O,FlowChangeKind:P,ReachedVia:B,StatefulType:V,StatefulRole:U,VerdictRelation:H};function re(t,r){return JSON.stringify({command:t,...r})+`
2
+ import{b as l}from"./chunk-LV7224DG.js";var m="12.0";function Z(t,r=m){let n=u=>{let[g,_]=u.split(".");return[Number(g)||0,Number(_)||0]},s=`; this kane-cli needs >= ${r}. Upgrade the controller first`;if(!t)return`the controller speaks a wire older than ${r} (it reports none)${s}`;let[i,p]=n(t),[a,c]=n(r);return i>a||i===a&&p>=c?null:`the controller speaks wire ${t}${s}`}var f=["explore_start","lease_start","lease_end","map_delta","progress","skill_updated","browser_request","browser_release","explore_end","lease_step","session_held","session_released","explore_frame"],b=["browser_ready","browser_failed","delta_ack","commit_refused","targets_added","stop","frames_start","frames_stop","frames_ack"],S=["recon","verify","explore","target","land","session","end","recheck"],x=["completed","unreachable","blocked","unsettled","budget","aborted","cancelled"],o=["read_only","mutating"],y=["queued","running","stopped"],E=["completed","budget","user_stop","stopped_before_start","timeout","heartbeat_lost"],k=["secrets_missing","no_browsers","commit_refused","commit_failed","runner_error","recon_failed","setup_failed","unexpected_event","focus_unknown","focus_unreachable","controller_outdated","vm_never_started"];function ee(t,r){return{code:`failed:${t}`,...r?{message:r}:{}}}var R=["unverified","verified","stale","changed","broken","gone","superseded","verified_to_edge"],w=["direct","flow","instance","held"],F=["toggle","revert","could_not_revert","storage_restored","gating","pagination","chrome","confirm","slow","how_it_works"],A=["console","network","flow_break","ux","policy","screen_changed","session","coverage","app_error","broken_link","slow","accessibility"],T=["reproduced","not_reproduced","inconclusive"],L=["subject","screen"],N=["broken","ux","coverage","changed","safety","performance","accessibility"];var h=["needs_sign_in","needs_value","read_only","state","off_site","path_broken","budget"],I=["telemetry_blocked","post_allowed"],q=["target","blocker","field","write"],v=["seeding","replay","walking","settling","verifying"],D=["open","bug","discarded","resolving","resolved"],K=["opened","promoted","discarded","marked_resolving","resolved_verified","recheck_inconclusive","resolved_by_person","reopened_seen","resolved_reached","restored"],C=["info","low","medium","high"],O=["verified","verified_healed","assert_failed","diverged","blocked","unsettled","partial","unreachable","verified_to_edge","start_failed","end_failed","verified_adapted","adapted"],P=["adapted","exit_moved"],B=["jump","replay","continued"],V=["session","one_shot","pending"],U=["start","end"],M=["session","one_shot","read","pending"],j=["judge","deps"],H=["version","state","different"],W=["navigate","replay"],G=["finding","flow","junction","candidate","junction_note","skill_area","skill_journey"],Y=["label","note","verdict","do_not_touch","resolve"],$=["correct","incorrect"],J=["user","agent"],X=["finding","flow","junction"],te={ExploreEventName:f,ControlMessageName:b,LeaseKind:S,LeaseResult:x,LeasePolicy:o,RunState:y,RemarkCode:E,FailedReason:k,FlowStatus:R,ReachKind:w,JunctionNoteKind:F,FindingKind:A,FindingStatus:D,StatusTransition:K,FindingCategory:N,RecheckResult:T,SimilarBy:L,BlockedBy:h,AuditKind:I,AnnotationKind:q,LeaseStepPhase:v,StatefulVerdictKind:M,StatefulVerdictSource:j,PathSegmentKind:W,FeedbackTargetKind:G,FeedbackType:Y,FeedbackVerdict:$,FeedbackAuthorKind:J,LabelAppliesTo:X,Severity:C,ObservationOutcome:O,FlowChangeKind:P,ReachedVia:B,StatefulType:V,StatefulRole:U,VerdictRelation:H};function re(t,r){return JSON.stringify({command:t,...r})+`
3
3
  `}var e=t=>t,ne={FlowStateful:e({type:"req StatefulType",role:"opt StatefulRole",kind:"opt string",pairs_with:"opt string|null",end_control:"opt string|null"}),StatefulVerdict:e({key:"req string",verdict:"req StatefulVerdictKind",confidence:"opt number",reason:"opt string",end_control:"opt string|null",source:"opt StatefulVerdictSource",run_id:"opt string"}),Budget:e({actions:"opt integer",wall_clock_s:"opt integer",model_calls:"opt integer",max_leases:"opt integer|null"}),FlowDef:e({id:"req string",name:"req string",entry:"req string",description:"opt string",parent_id:"opt string|null",exit:"opt string|null",origin:"opt FlowOrigin",priority:"opt integer",assertions:"opt Assertion[]",annotations:"opt map<string>",owners:"opt map<Ownership>",current_observation:"opt string|null",status:"opt FlowStatus",steps_key:"opt string|null",supersedes:"opt string|null",superseded_by:"opt string|null",after_flow:"opt string|null",state:"opt boolean",in_state:"opt string|null",pending_landing:"opt PendingLanding|null",stateful:"opt FlowStateful|null",plan:"opt FlowPlanRevision|null",finding_ids:"opt string[]",feedback:"opt FeedbackRecord[]",changes:"opt FlowChange[]"}),FlowChange:e({run_id:"req string",observation_id:"req string",kind:"req FlowChangeKind",adapted_at:"req integer",from_exit:"opt string|null",to_exit:"opt string|null"}),Delta:e({seq:"req integer",attempt:"req integer",run_id:"req string",lease_id:"req string",junctions:"opt Junction[]",flows:"opt FlowDef[]",candidates:"opt Candidate[]",observations:"opt Observation[]",findings:"opt Finding[]",suggestions:"opt Suggestion[]",lease:"opt Lease|null",evidence:"opt EvidenceRef[]",aliases:"opt map<string>",entry:"opt string|null",verdicts:"opt MatchVerdict[]",stateful_verdicts:"opt StatefulVerdict[]",feedback:"opt FeedbackRecord[]",feedback_applied:"opt FeedbackApplied[]"}),Parallelism:e({max_parallel:"opt integer",peak:"opt integer",average:"opt number",opened:"opt integer"}),Focus:e({junction_id:"req string",name:"opt string",path_len:"opt integer|null"}),Remark:e({code:"req string",message:"opt string"}),CreditReport:e({total:"opt number",calls:"opt integer",by_node:"opt map<number>",by_phase:"opt map<number>",request_ids:"opt string[]"}),AuditNote:e({kind:"req AuditKind",text:"req string",count:"opt integer",first_lease:"opt string"}),RunRecord:e({run_id:"req string",locale:"opt string",complete:"opt boolean",started_at:"opt string",credits:"opt CreditReport|null",focus:"opt string|null",audit_notes:"opt AuditNote[]"}),Projection:e({exploration_id:"req string",project_id:"opt string|null",entry:"opt string|null",junctions:"opt Junction[]",flows:"opt FlowDef[]",candidates:"opt Candidate[]",observations:"opt Observation[]",findings:"opt Finding[]",aliases:"opt map<string>",rejected_pairs:"opt string[][]",runs:"opt RunRecord[]",last_seq:"opt integer",verdicts:"opt MatchVerdict[]",stateful_verdicts:"opt StatefulVerdict[]",labels:"opt ExplorationLabel[]",skill:"opt string|null",skill_run_id:"opt string|null"}),ExploreStart:e({run_id:"req string",exploration_id:"req string",attempt:"req integer",sessions:"req integer",policy:"req LeasePolicy",locale:"opt string",timezone:"opt string",accept_language:"opt string",focus:"opt Focus|null"}),LeaseStart:e({lease_id:"req string",kind:"req LeaseKind",worker_index:"req integer",target:"opt string|null",budget:"opt Budget",reach:"opt LeaseReach|null"}),ReachHop:e({kind:"req PathSegmentKind",flow_id:"opt string|null",to:"opt string|null",url_pattern:"opt string|null"}),LeaseReach:e({target:"opt string|null",path:"opt ReachHop[]"}),LeaseStep:e({lease_id:"req string",worker_index:"req integer",ordinal:"req integer",phase:"req LeaseStepPhase",junction_id:"opt string|null",known:"opt boolean",url_pattern:"opt string|null",flow_id:"opt string|null",intent:"opt string|null",navigated:"opt boolean",step_ordinal:"opt integer|null"}),SessionHeld:e({worker_index:"req integer",kind:"req string",start_flow:"opt string|null",junction_id:"opt string|null",url_pattern:"opt string|null"}),SessionReleased:e({worker_index:"req integer",reason:"opt string|null"}),LeaseEnd:e({lease_id:"req string",result:"req LeaseResult",reason:"opt string|null"}),MapDelta:e({delta:"req Delta"}),Progress:e({frontier:"req integer",visited:"req integer",active_workers:"req integer",elapsed_s:"req number",unacked:"req integer"}),SkillUpdated:e({version:"req integer",run_id:"req string",summary:"opt string",received:"opt string",dropped:"opt string[]"}),BrowserRequest:e({worker_index:"req integer"}),BrowserRelease:e({worker_index:"req integer"}),ExploreEnd:e({totals:"req map<integer>",stop_reason:"req string",unacked:"req integer",complete:"req boolean",remark:"req Remark",credits:"opt CreditReport",focus:"opt Focus|null",refused:"opt string|null",parallelism:"opt Parallelism|null",audit_notes:"opt AuditNote[]"}),BrowserReady:e({worker_index:"req integer",cdp_endpoint:"opt string|null",ws_endpoint:"opt string|null"}),BrowserFailed:e({worker_index:"req integer",reason:"req string"}),DeltaAck:e({seq:"req integer",committed:"req boolean"}),CommitRefused:e({seq:"req integer",reason:"req string"}),TargetsAdded:e({flows:"opt FlowDef[]"}),Stop:e({browsers_released:"opt boolean"}),FramesStart:e({worker_index:"req integer"}),FramesStop:e({worker_index:"req integer"}),FramesAck:e({worker_index:"req integer"}),ExploreFrame:e({worker_index:"req integer",data:"req string",at_ms:"req integer"})};var d="mutating";function z(t){return typeof t=="string"&&o.includes(t)}function ae(t){let r=t.policy;if(r==null||r==="")return{policy:d};let n=String(r).trim();return z(n)?{policy:n}:{error:`--policy ${JSON.stringify(n)}: one of ${o.join(", ")}`,next:`pass --policy read_only (only reads) or --policy mutating (may change data); the default is ${d}`}}function le(t){return t==="mutating"?"mutating":"read-only"}function de(t){return t==="mutating"?"mutating":"read_only"}var pe="--allow-post has no effect under --policy mutating";function Q(t){try{return new URL(t).host||t}catch{return t}}function ce(t){return`This run may change data on ${Q(t)} and any site it reaches (policy mutating). Nothing is blocked except controls named in --deny. Use --policy read_only to only read.`}function ue(t=new l){return{confirmed:r=>(t.load().explore_mutating_confirmed??[]).includes(r),remember:r=>{let n=t.load().explore_mutating_confirmed??[];n.includes(r)||t.set("explore_mutating_confirmed",[...n,r])}}}export{m as a,Z as b,o as c,k as d,ee as e,G as f,Y as g,$ as h,X as i,te as j,re as k,d as l,z as m,ae as n,le as o,de as p,pe as q,Q as r,ce as s,ue as t};
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as U,e as F}from"./chunk-4JOD47QI.js";import{d as W}from"./chunk-GMTHZUZ3.js";import{a as H}from"./chunk-FAMQ4DHU.js";import{createHash as Y}from"crypto";import{access as Q,mkdir as S,mkdtemp as Z,readdir as O,readFile as y,rename as N,rm as v,writeFile as x}from"fs/promises";import{homedir as tt}from"os";import{arch as et,platform as st}from"process";import{dirname as C,isAbsolute as nt,join as l,relative as X,resolve as rt,sep as it}from"path";var q=1,ot={emulator:"emulator",simulator:"simulator"};function Pt(i){return ot[i.kind]??null}var j=class extends Error{constructor(s,e,n){super([`Managed mobile dependencies for ${s} are not installed.`,`- kaneai-mobile-deps ${s} ${e.bundleVersion}: ${e.url} (${_(e.bytes)})`,`Destination: ${n}`,`Run \`kane-cli doctor --target ${s} --install\` to download it.`].join(`
3
- `));this.deviceClass=s;this.name="DepsInstallRequiredError"}};function _(i){return i>=1024*1024?`${Math.ceil(i/(1024*1024))} MB`:`${i} bytes`}function at(i){let t=i/1048576;return t>=10?`${Math.round(t)} MB/s`:t>=1?`${t.toFixed(1)} MB/s`:`${Math.max(1,Math.round(i/1024))} KB/s`}function lt(i){let t=Math.max(1,Math.round(i));return t<60?`~${t}s left`:`~${Math.floor(t/60)}m ${t%60}s left`}var K=8*1024*1024,ct=8;function ut(i){if(!Number.isFinite(i)||i<2*K)return null;let t=Math.min(ct,Math.floor(i/K)),s=Math.ceil(i/t),e=[];for(let n=0;n<i;n+=s)e.push({start:n,end:Math.min(n+s,i)-1});return e}async function L(i,t){let s=i.body;if(!s||typeof s.getReader!="function"){let c=new Uint8Array(await i.arrayBuffer());return t?.(c.length),c}let e=s.getReader(),n=[],r=0;for(;;){let{done:c,value:h}=await e.read();if(c)break;h&&(n.push(h),r+=h.length,t?.(h.length))}let o=new Uint8Array(r),a=0;for(let c of n)o.set(c,a),a+=c.length;return o}var z=3,dt=3e4,k=class extends Error{};async function pt(i,t,s,e,n,r=dt){let o=new Uint8Array(s),a=0,c=new AbortController,h=null,b=!1;try{await Promise.all(e.map(async(f,M)=>{let P=0,V=d=>{P+=d,a+=d,n?.(a)},T=()=>{a=Math.max(0,a-P),P=0},R=null;for(let d=0;d<z;d+=1){if(c.signal.aborted)return;let u=new AbortController,m=()=>u.abort();c.signal.addEventListener("abort",m,{once:!0});let w=!1,g=null,$=()=>{g&&clearTimeout(g),g=setTimeout(()=>{w=!0,u.abort()},r)};try{$();let p=await i(t,{headers:{Range:`bytes=${f.start}-${f.end}`},signal:u.signal});if(typeof p.body?.getReader!="function"&&g&&(clearTimeout(g),g=null),!p.ok)throw new k(`Could not download ${t}: HTTP ${p.status}`);if(p.status!==206){b=!0,M===0?h=await L(p,I=>{$(),V(I)}):await(p.body?.cancel().catch(()=>{})??Promise.resolve());return}let D=f.end-f.start+1,E=await L(p,I=>{$(),V(I)});if(E.length!==D)throw new Error(`range ${f.start}-${f.end} returned ${E.length} bytes (expected ${D})`);o.set(E,f.start);return}catch(p){if(p instanceof k)throw p;if(c.signal.aborted)return;T(),R=w?new Error(`no data for ${Math.round(r/1e3)}s`):p instanceof Error?p:new Error(String(p))}finally{g&&clearTimeout(g),c.signal.removeEventListener("abort",m)}}throw new Error(`Could not download ${t}: range ${f.start}-${f.end} failed after ${z} attempts (${R?.message??"unknown error"}) \u2014 check your network and rerun \`kane-cli doctor --target <emulator|simulator> --install\`.`)}))}catch(f){throw c.abort(),f}return h||(b?null:o)}async function ht(i,t,s,e,n){let r=ut(s);if(r){let c=await pt(i,t,s,r,e,n?.stallMs);if(c)return c}let o=await i(t);if(!o.ok)throw new Error(`Could not download ${t}: HTTP ${o.status}`);let a=0;return L(o,e&&(c=>{a+=c,e(a)}))}function ft(i){return Y("sha256").update(i).digest("hex")}function mt(i,t){let s=X(i,t);return s!==""&&!s.startsWith(`..${it}`)&&s!==".."&&!nt(s)}async function A(i){try{return await Q(i),!0}catch{return!1}}function wt(){return{home:tt(),os:st,arch:et,cliVersion:H,nodeModuleVersion:process.versions.modules,fetch,resolveBundle:async i=>(await import("./deps-resolve-DSAKPZ3T.js")).controllerResolveBundle()(i),exec:U,now:()=>new Date,wait:F,processAlive:i=>{try{return process.kill(i,0),!0}catch{return!1}}}}var B=class extends Error{constructor(s,e,n){super(`No managed mobile dependencies are published for ${s} (kane-cli ${e}).
2
+ import{d as U,e as F}from"./chunk-4JOD47QI.js";import{d as W}from"./chunk-GMTHZUZ3.js";import{a as H}from"./chunk-J4FIESTB.js";import{createHash as Y}from"crypto";import{access as Q,mkdir as S,mkdtemp as Z,readdir as O,readFile as y,rename as N,rm as v,writeFile as x}from"fs/promises";import{homedir as tt}from"os";import{arch as et,platform as st}from"process";import{dirname as C,isAbsolute as nt,join as l,relative as X,resolve as rt,sep as it}from"path";var q=1,ot={emulator:"emulator",simulator:"simulator"};function Pt(i){return ot[i.kind]??null}var j=class extends Error{constructor(s,e,n){super([`Managed mobile dependencies for ${s} are not installed.`,`- kaneai-mobile-deps ${s} ${e.bundleVersion}: ${e.url} (${_(e.bytes)})`,`Destination: ${n}`,`Run \`kane-cli doctor --target ${s} --install\` to download it.`].join(`
3
+ `));this.deviceClass=s;this.name="DepsInstallRequiredError"}};function _(i){return i>=1024*1024?`${Math.ceil(i/(1024*1024))} MB`:`${i} bytes`}function at(i){let t=i/1048576;return t>=10?`${Math.round(t)} MB/s`:t>=1?`${t.toFixed(1)} MB/s`:`${Math.max(1,Math.round(i/1024))} KB/s`}function lt(i){let t=Math.max(1,Math.round(i));return t<60?`~${t}s left`:`~${Math.floor(t/60)}m ${t%60}s left`}var K=8*1024*1024,ct=8;function ut(i){if(!Number.isFinite(i)||i<2*K)return null;let t=Math.min(ct,Math.floor(i/K)),s=Math.ceil(i/t),e=[];for(let n=0;n<i;n+=s)e.push({start:n,end:Math.min(n+s,i)-1});return e}async function L(i,t){let s=i.body;if(!s||typeof s.getReader!="function"){let c=new Uint8Array(await i.arrayBuffer());return t?.(c.length),c}let e=s.getReader(),n=[],r=0;for(;;){let{done:c,value:h}=await e.read();if(c)break;h&&(n.push(h),r+=h.length,t?.(h.length))}let o=new Uint8Array(r),a=0;for(let c of n)o.set(c,a),a+=c.length;return o}var z=3,dt=3e4,k=class extends Error{};async function pt(i,t,s,e,n,r=dt){let o=new Uint8Array(s),a=0,c=new AbortController,h=null,b=!1;try{await Promise.all(e.map(async(f,M)=>{let P=0,V=d=>{P+=d,a+=d,n?.(a)},T=()=>{a=Math.max(0,a-P),P=0},R=null;for(let d=0;d<z;d+=1){if(c.signal.aborted)return;let u=new AbortController,m=()=>u.abort();c.signal.addEventListener("abort",m,{once:!0});let w=!1,g=null,$=()=>{g&&clearTimeout(g),g=setTimeout(()=>{w=!0,u.abort()},r)};try{$();let p=await i(t,{headers:{Range:`bytes=${f.start}-${f.end}`},signal:u.signal});if(typeof p.body?.getReader!="function"&&g&&(clearTimeout(g),g=null),!p.ok)throw new k(`Could not download ${t}: HTTP ${p.status}`);if(p.status!==206){b=!0,M===0?h=await L(p,I=>{$(),V(I)}):await(p.body?.cancel().catch(()=>{})??Promise.resolve());return}let D=f.end-f.start+1,E=await L(p,I=>{$(),V(I)});if(E.length!==D)throw new Error(`range ${f.start}-${f.end} returned ${E.length} bytes (expected ${D})`);o.set(E,f.start);return}catch(p){if(p instanceof k)throw p;if(c.signal.aborted)return;T(),R=w?new Error(`no data for ${Math.round(r/1e3)}s`):p instanceof Error?p:new Error(String(p))}finally{g&&clearTimeout(g),c.signal.removeEventListener("abort",m)}}throw new Error(`Could not download ${t}: range ${f.start}-${f.end} failed after ${z} attempts (${R?.message??"unknown error"}) \u2014 check your network and rerun \`kane-cli doctor --target <emulator|simulator> --install\`.`)}))}catch(f){throw c.abort(),f}return h||(b?null:o)}async function ht(i,t,s,e,n){let r=ut(s);if(r){let c=await pt(i,t,s,r,e,n?.stallMs);if(c)return c}let o=await i(t);if(!o.ok)throw new Error(`Could not download ${t}: HTTP ${o.status}`);let a=0;return L(o,e&&(c=>{a+=c,e(a)}))}function ft(i){return Y("sha256").update(i).digest("hex")}function mt(i,t){let s=X(i,t);return s!==""&&!s.startsWith(`..${it}`)&&s!==".."&&!nt(s)}async function A(i){try{return await Q(i),!0}catch{return!1}}function wt(){return{home:tt(),os:st,arch:et,cliVersion:H,nodeModuleVersion:process.versions.modules,fetch,resolveBundle:async i=>(await import("./deps-resolve-WQ6J6RLI.js")).controllerResolveBundle()(i),exec:U,now:()=>new Date,wait:F,processAlive:i=>{try{return process.kill(i,0),!0}catch{return!1}}}}var B=class extends Error{constructor(s,e,n){super(`No managed mobile dependencies are published for ${s} (kane-cli ${e}).
4
4
  This is a packaging gap, not something to install locally \u2014 report it, or pass --appium-url to use an Appium server you manage yourself.`);this.coordinate=s;this.cause=n;this.name="NoPublishedBundleError"}},J=class i{deps;constructor(t={}){this.deps={...wt(),...t}}mobileRoot(){return l(this.deps.home,".testmuai","kaneai","mobile")}depsRoot(){return l(this.mobileRoot(),"deps")}classRoot(t,s){return l(this.depsRoot(),s,t)}resolveCacheFile(){return l(this.depsRoot(),"resolve-cache.json")}resolveCacheKey(t){return`${this.deps.cliVersion}|${this.deps.os}-${this.deps.arch}-${t}`}static RESOLVE_CACHE_TTL_MS=1440*60*1e3;async readCachedWantedVersion(t){try{let e=JSON.parse(await y(this.resolveCacheFile(),"utf8"))[this.resolveCacheKey(t)];if(!e?.bundleVersion||!e.fetchedAt)return null;let n=this.deps.now().getTime()-new Date(e.fetchedAt).getTime();return n>=0&&n<i.RESOLVE_CACHE_TTL_MS?e.bundleVersion:null}catch{return null}}async writeResolveCache(t,s){try{let e={};try{e=JSON.parse(await y(this.resolveCacheFile(),"utf8"))}catch{}e[this.resolveCacheKey(t)]={bundleVersion:s,fetchedAt:this.deps.now().toISOString()},await S(this.depsRoot(),{recursive:!0}),await x(this.resolveCacheFile(),`${JSON.stringify(e,null,2)}
5
5
  `)}catch{}}async warmResolveCache(t){if(await this.readCachedWantedVersion(t)===null)try{await this.resolveOrExplain(t)}catch{}}paths(t,s){let e=this.classRoot(t,s);return{root:e,appium:l(e,"appium"),appiumHome:l(e,"appium-home"),platformTools:l(e,"platform-tools"),wdaDir:l(e,"wda","Build","Products","Debug-iphonesimulator"),iwdpBinDir:l(e,"bin"),installManifest:l(e,"install-manifest.json")}}async status(t,s){s||(s=await this.readCachedWantedVersion(t)??void 0);let e=[];try{e=await O(this.depsRoot())}catch{}s&&(e=e.filter(c=>c===s));let n=null;for(let c of e){let h=this.classRoot(t,c),b=null;try{b=JSON.parse(await y(l(h,"install-manifest.json"),"utf8"))}catch{continue}b.schemaVersion===q&&(!s&&b.cliVersion!==this.deps.cliVersion||(!n||b.installedAt>n.manifest.installedAt)&&(n={manifest:b,root:h}))}if(!n)return{class:t,installed:!1};let r=this.paths(t,n.manifest.bundleVersion),o=[l(r.appium,"node_modules","appium","index.js")];t==="emulator"&&o.push(l(r.platformTools,this.deps.os==="win32"?"adb.exe":"adb")),t==="simulator"&&o.push(l(r.wdaDir,"WebDriverAgentRunner-Runner.app"));for(let c of o)if(!await A(c))return{class:t,installed:!1,version:n.manifest.bundleVersion,root:n.root,corrupt:`a bundle component is missing from disk (${X(n.root,c)})`};let a=await this.postInstallDrifted(r);return{class:t,installed:!0,version:n.manifest.bundleVersion,root:n.root,...a?{needsRepair:a}:{}}}async postInstallDrifted(t){let s=l(t.appiumHome,"node_modules",".cache","appium","extensions.yaml");if(!await A(s))return!1;let e=await y(s,"utf8");for(let n of e.split(`
6
6
  `)){let r=/^\s*installPath:\s*(.+?)\s*$/.exec(n);if(r&&!r[1].startsWith(t.appiumHome))return!0}return!1}async environment(t){let s=await this.status(t);if(!s.installed||!s.version)return{dirs:[]};let e=this.paths(t,s.version),n=[],r={dirs:n,appiumHome:e.appiumHome};return t!=="simulator"&&(n.push(e.platformTools),r.platformToolsDir=e.platformTools),n.push(l(e.appium,"node_modules",".bin")),t==="simulator"&&(n.push(e.iwdpBinDir),r.wdaDir=e.wdaDir,r.wdaRoot=l(e.root,"wda"),r.iwdpBinDir=e.iwdpBinDir),r}async ensure(t,s){let e,n;try{e=await this.resolveOrExplain(t)}catch(a){n=a}let r=await this.status(t,e?.bundleVersion);if(r.installed&&!r.needsRepair)return e&&r.version&&await this.adoptInstall(t,r.version),r;if(!e)throw n;if(r.installed&&r.needsRepair&&r.version){let a=this.paths(t,r.version);return await this.withInstallLock(async()=>{await this.postInstall(a.root,a,s.onProgress)}),await this.adoptInstall(t,r.version),this.status(t,e.bundleVersion)}let o=e;if(!s.automatic&&!s.approved)throw new j(t,o,this.classRoot(t,o.bundleVersion));return await this.withInstallLock(async()=>{(await this.status(t,o.bundleVersion)).installed||await this.install(t,o,s.onProgress)}),this.status(t,o.bundleVersion)}async adoptInstall(t,s){try{let e=this.paths(t,s).installManifest,n=JSON.parse(await y(e,"utf8"));if(n.cliVersion===this.deps.cliVersion)return;n.cliVersion=this.deps.cliVersion;let r=l(C(e),`install-manifest-${process.pid}.json`);await x(r,`${JSON.stringify(n,null,2)}
@@ -1,10 +1,10 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as Ut}from"./chunk-C6P6YUCR.js";import{a as lt,b as ut}from"./chunk-IH73ZCBB.js";import{b as xt,c as bt,d as yt,e as vt,f as _t}from"./chunk-7ZR5CQY3.js";import{a as wt,b as kt,c as Rt,d as Et,e as St}from"./chunk-QUNIY6NN.js";import{c as q,d as Ie,f as It,g as Lt,k as At,l as ce,m as pe,q as J,v as Ot}from"./chunk-UMNCM4RJ.js";import{b as Ee,d as se}from"./chunk-ZUZ6QJRA.js";import{b as Se,c as ct,d as pt,e as dt,f as ie,g as ae,h as mt,i as ft,j as gt,k as ht,m as h,n as X,o as $t,p as je,q as Te,r as Ce,s as Pe}from"./chunk-Z6SI7YNV.js";import{a as le,b as S}from"./chunk-KGNE5CIM.js";import{e as W,l as ue,n as Le,q as jt,r as Tt,s as Ct,t as Pt}from"./chunk-GQARXS6F.js";import{a as st,b as it}from"./chunk-DLP5S3TO.js";import{d as Re,f as H}from"./chunk-54NJJVG5.js";import{a as nt}from"./chunk-A474TUCE.js";import{l as at}from"./chunk-LXCTV75T.js";import{a as tt}from"./chunk-DREQ3RAA.js";import{a as ot}from"./chunk-UTM7D4PI.js";import{a as Ze,b as ke,d as et}from"./chunk-DXLZCJH5.js";import{b as Ye}from"./chunk-BHQIH2FE.js";import{e as ze}from"./chunk-BJT6PZXL.js";import{e as Qe}from"./chunk-6K5BEEAJ.js";import{a as qe}from"./chunk-FCD3NYOM.js";import{a as rt}from"./chunk-PVN64537.js";import{n as Xe,o as Je}from"./chunk-UJLULWSR.js";import{a as oe}from"./chunk-FI2DVNRT.js";import{a as K}from"./chunk-4QTH7VYE.js";import{a as F}from"./chunk-RZ4F3BHX.js";import{a as ne}from"./chunk-K75WIRI5.js";import{a as We}from"./chunk-FOJHSG5M.js";import{a as M,b as re,z as Ke}from"./chunk-FAMQ4DHU.js";import{join as Ne}from"path";import{appendFileSync as or,mkdirSync as sr}from"fs";import{dirname as ir}from"path";function Nt(e,t,n){if(t)try{sr(ir(t),{recursive:!0})}catch{}let r="",o=c=>{if(!(!t||!c))try{or(t,n(c))}catch{}};e.child.stderr?.on("data",c=>{r+=c.toString();let g=r.lastIndexOf(`
3
- `);g<0||(o(r.slice(0,g+1)),r=r.slice(g+1))}),e.child.stderr?.on("end",()=>{o(r),r=""});let i=e.getStderr.bind(e);return Object.assign(e,{getStderr:()=>n(i())})}var ar={seeding:"seeding",replay:"replaying",walking:"walking",settling:"settling",verifying:"verifying"},lr=8,ur=6,k=e=>typeof e=="string"&&e?e:null,V=e=>typeof e=="number"&&Number.isFinite(e)?e:null,de=class{s={run_id:null,exploration_id:null,status:"running",stop_reason:null,progress:null,browsers:[],version:0,updated_at:0};subs=new Set;now;constructor(t={}){this.now=t.now??Date.now}snapshot(){return structuredClone(this.s)}subscribe(t){return this.subs.add(t),()=>{this.subs.delete(t)}}end(t){this.s.status!=="ended"&&(this.s.status="ended",this.s.stop_reason=t,this.s.browsers=[],this.changed())}apply(t){this.reduce(t)&&this.changed()}changed(){if(this.s.version+=1,this.s.updated_at=this.now(),!this.subs.size)return;let t=this.snapshot();for(let n of this.subs)try{n(t)}catch{}}browser(t,n){let r=this.s.browsers.find(o=>o.worker===t)??null;return!r&&n&&(r={worker:t,state:"opening",since:this.now(),lease:null,step:null,steps:[],trail:[],held:null},this.s.browsers.push(r),this.s.browsers.sort((o,i)=>o.worker-i.worker)),r}setState(t,n){t.state!==n&&(t.state=n,t.since=this.now())}reduce(t){let n=V(t.worker_index);switch(t.type){case"explore_start":return this.s.run_id=k(t.run_id),this.s.exploration_id=k(t.exploration_id),this.s.status="running",!0;case"browser_request":return n===null?!1:(this.browser(n,!0),!0);case"browser_release":{if(n===null)return!1;let r=this.s.browsers.length;return this.s.browsers=this.s.browsers.filter(o=>o.worker!==n),this.s.browsers.length!==r}case"lease_start":{if(n===null||!k(t.lease_id))return!1;let r=this.browser(n,!0),o=t.reach&&typeof t.reach=="object"&&!Array.isArray(t.reach)?t.reach:null;return r.lease={id:String(t.lease_id),kind:String(t.kind??""),target:k(t.target),reach:o,started_at:this.now()},r.step=null,r.steps=[],this.setState(r,"starting"),!0}case"lease_step":{if(n===null)return!1;let r=this.browser(n,!1);if(!r||!r.lease||r.lease.id!==t.lease_id)return!1;let o={ordinal:V(t.ordinal)??r.steps.length,phase:String(t.phase??""),intent:k(t.intent),junction_id:k(t.junction_id),known:t.known===!0,url_pattern:k(t.url_pattern),flow_id:k(t.flow_id),navigated:t.navigated===!0,at:this.now()};return r.step=o,r.steps=[...r.steps,o].slice(-lr),o.junction_id&&r.trail[r.trail.length-1]!==o.junction_id&&(r.trail=[...r.trail,o.junction_id].slice(-ur)),this.setState(r,ar[o.phase]??"walking"),!0}case"lease_end":{let r=this.s.browsers.find(o=>o.lease?.id===t.lease_id);return r?(r.lease=null,r.step=null,r.steps=[],this.setState(r,r.held?"holding":"idle"),!0):!1}case"session_held":{if(n===null)return!1;let r=this.browser(n,!0);return r.held={kind:String(t.kind??""),start_flow:k(t.start_flow),junction_id:k(t.junction_id),url_pattern:k(t.url_pattern)},r.lease||this.setState(r,"holding"),!0}case"session_released":{if(n===null)return!1;let r=this.browser(n,!1);return!r||!r.held?!1:(r.held=null,r.lease||this.setState(r,"idle"),!0)}case"progress":return this.s.progress={frontier:V(t.frontier)??0,visited:V(t.visited)??0,active_workers:V(t.active_workers)??0,elapsed_s:V(t.elapsed_s)??0},!0;case"explore_control":return t.control!=="stop"||this.s.status!=="running"?!1:(this.s.status="paused",!0);case"explore_end":return this.s.status="ended",this.s.stop_reason=k(t.stop_reason),this.s.browsers=[],!0;default:return!1}}};var me=class{link=null;wanted=new Map;source=async(t,n)=>(this.wanted.set(t,n),this.link?.start(t),{stop:async()=>{this.wanted.get(t)===n&&(this.wanted.delete(t),this.link?.stop(t))}});attach(t){if(this.link=t,t)for(let n of this.wanted.keys())t.start(n)}frame(t,n){this.wanted.get(t)?.(n)}};var cr=500,pr=1e4,Bt=5e3,dr=async(e,t)=>{let n=new AbortController,r=()=>n.abort(),o=setTimeout(r,t.timeoutMs);t.signal.addEventListener("abort",r,{once:!0});try{let i=await F(e,{method:"POST",headers:t.headers,body:t.body,signal:n.signal}),c=null;try{c=await i.json()}catch{}return{status:i.status,body:c}}finally{clearTimeout(o),t.signal.removeEventListener("abort",r)}},fe=class{constructor(t){this.opts=t;this.post=t.post??dr,this.unsubscribeModel=t.model.subscribe(()=>this.stateChanged())}post;target=null;off=!1;framesOff=!1;abort=new AbortController;unsubscribeModel;stateInFlight=!1;stateDirty=!1;lastStateAt=0;stateTimer=null;heartbeat=null;watched=new Map;stopAsked=!1;waiting=new Map;sending=new Set;arm(t){this.off||(this.letAllGo(),this.abort.abort(),this.abort=new AbortController,this.stateInFlight=!1,this.target=t,this.framesOff=!1,this.stateDirty=!0,this.sendState())}async close(){this.off=!0,this.unsubscribeModel(),this.clearTimers(),this.letAllGo(),this.abort.abort()}url(t,n=""){let r=this.target;return`${r.baseUrl.replace(/\/+$/,"")}${n}/exploration/${encodeURIComponent(r.explorationId)}/runs/${encodeURIComponent(r.runId)}/live/${t}`}stateChanged(){if(this.off||!this.target||(this.stateDirty=!0,this.stateInFlight||this.stateTimer))return;let t=cr-(Date.now()-this.lastStateAt);t<=0?this.sendState():this.stateTimer=setTimeout(()=>{this.stateTimer=null,this.sendState()},t)}sendState(){if(this.off||!this.target||this.stateInFlight)return;let t=this.target;this.stateDirty=!1,this.stateInFlight=!0,this.lastStateAt=Date.now(),this.heartbeat&&clearTimeout(this.heartbeat),this.heartbeat=null;let n;try{n=JSON.stringify(this.opts.model.snapshot())}catch{this.stateInFlight=!1;return}this.post(this.url("state"),{headers:{Authorization:t.authHeader,"Content-Type":"application/json"},body:n,timeoutMs:Bt,signal:this.abort.signal}).then(r=>{if(this.target===t){if(r.status===404||r.status===403||r.status===401)return this.turnOff(r.status);r.status>=200&&r.status<300&&(this.stopIfAsked(r.body),this.follow(r.body))}},()=>{}).finally(()=>{this.target!==t||this.off||(this.stateInFlight=!1,this.heartbeat=setTimeout(()=>{this.heartbeat=null,this.stateDirty=!0,this.sendState()},pr),this.stateDirty&&this.stateChanged())})}turnOff(t){this.off||(this.off=!0,this.clearTimers(),this.letAllGo(),this.abort.abort(),this.opts.onWarn?.(`live view is off for this run: the controller has no live routes (HTTP ${t})`))}stopIfAsked(t){this.stopAsked||!t||typeof t!="object"||t.stop!==!0||(this.stopAsked=!0,this.opts.onStop?.())}follow(t){let n=t&&typeof t=="object"?t.watched:void 0;if(!Array.isArray(n)||this.framesOff)return;let r=new Set(n.filter(o=>Number.isInteger(o)&&o>=0));for(let o of[...this.watched.keys()])r.has(o)||this.letGo(o);for(let o of r)this.watched.has(o)||this.watched.set(o,this.opts.frames.subscribe(new Map([[o,Rt]]),i=>this.frame(i)))}frame(t){t.kind!=="frame"||this.off||!this.watched.has(t.worker)||(this.waiting.set(t.worker,{data:t.data,at:t.at}),this.sendFrame(t.worker))}sendFrame(t){if(this.sending.has(t)||!this.target)return;let n=this.waiting.get(t);if(n===void 0)return;this.waiting.delete(t);let r=this.target;this.sending.add(t);let o=Number.isFinite(n.at)?`&at=${Math.round(n.at)}`:"";this.post(`${this.url("frames","/public")}?worker=${t}${o}`,{headers:{"X-Live-Token":r.liveToken,"Content-Type":"image/jpeg"},body:Buffer.from(n.data,"base64"),timeoutMs:Bt,signal:this.abort.signal}).then(i=>{this.target===r&&(i.status===410?this.letGo(t):i.status===401&&!this.framesOff&&(this.framesOff=!0,this.letAllGo(),this.opts.onWarn?.("live frames are off for this run: the controller refused its live token (HTTP 401)")))},()=>{}).finally(()=>{this.target===r&&(this.sending.delete(t),!this.off&&this.watched.has(t)&&this.sendFrame(t))})}letGo(t){let n=this.watched.get(t);this.watched.delete(t),this.waiting.delete(t),n?.()}letAllGo(){for(let t of[...this.watched.keys()])this.letGo(t);this.sending.clear()}clearTimers(){this.stateTimer&&clearTimeout(this.stateTimer),this.heartbeat&&clearTimeout(this.heartbeat),this.stateTimer=this.heartbeat=null}};function ge(e,t){return`watch live: kane-cli explore view --exploration-id ${e}${t?` --env ${t}`:""}`}async function Mt(e){let t=new de,n=new me,r=new kt({start:e.startSource??n.source}),o=new fe({model:t,frames:r,post:e.post,onWarn:e.onWarn,onStop:e.onStop}),i=!1,c=!1,g=!1;return{model:t,frames:r,onBrowser(a){c||r.addBrowser(a)},offBrowser(a){r.removeBrowser(a)},attachRunner(a){n.attach(c?null:a)},runnerFrame(a,u){c||n.frame(a,u)},onEvent(a){t.apply(a),a.type==="explore_start"&&!i&&typeof a.exploration_id=="string"&&a.exploration_id&&(i=!0,e.onExploration?.(a.exploration_id))},armRun(a){if(!c){if(!a.liveToken){g||e.onWarn?.("live view is off for this run: the controller handed out no live token"),g=!0;return}o.arm({...e.controller,explorationId:a.explorationId,runId:a.runId,liveToken:a.liveToken})}},async close(a){c||(c=!0,await o.close(),n.attach(null),t.end(a),await r.close())}}}import{readFileSync as fr}from"fs";import{basename as gr}from"path";import{randomUUID as Kt}from"crypto";function $e(e){let t=[];for(let[n,r]of Object.entries(e)){if(r.type==="parameter")continue;let o=n.replace(/^(secrets\.user\.|global\.|environment\.)/,"");t.push({name:o,secret:!!r.secret,value:String(r.value??"")})}return t}async function Ht(e,t){if(t.activeRun){let u=null;try{u=await t.activeRun()}catch{u=null}if(u)return{ok:!1,error:`RUN_ACTIVE: run ${u.runId} is ${u.state} on exploration ${u.explorationId}; stop it or wait for it to end`}}let n=e.variables.filter(u=>u.secret),r=e.variables.filter(u=>!u.secret),o=[["LT_USERNAME",e.login.username],["LT_ACCESS_KEY",e.login.accessKey],...n.map(u=>[u.name,u.value])];for(let[u,l]of o){if(e.dev?.skipPush===u){e.onNote?.(`dev: not pushing secret ${u} (KANE_EXPLORE_DEV_SKIP_SECRET_PUSH)`);continue}try{await t.pushSecret(u,l)}catch(f){return{ok:!1,error:`could not push secret ${u} to HyperExecute Secrets: ${z(f)}`}}}for(let u of r)try{await t.upsertGlobal(u.name,u.value)}catch(l){return{ok:!1,error:`could not push variable ${u.name} to Test Manager: ${z(l)}`}}let i=o.map(([u])=>u);if(e.dev?.skipCheck)return e.onNote?.("dev: not checking the HyperExecute secrets list (KANE_EXPLORE_DEV_SKIP_SECRET_CHECK); the VM's check must refuse a missing secret"),a();let c;try{c=await t.hxSecretNames(i)}catch(u){return{ok:!1,error:`could not read your HyperExecute secrets to check them: ${z(u)}`}}let g=i.filter(u=>!c.includes(u));if(g.length)return{ok:!1,error:`HyperExecute Secrets does not list ${g.join(", ")} after the push; the VM would run without ${g.length===1?"it":"them"}`};return a();async function a(){let u=e.body;if(e.devBundle)try{let{kane_version:l,...f}=e.body;u={...f,dev:await e.devBundle()}}catch(l){return{ok:!1,error:`--dev-bundle: could not upload the bundle: ${z(l)}`}}try{return{ok:!0,reply:await t.remoteRun({...u,variables:e.variables.map(f=>({name:f.name,secret:f.secret}))})}}catch(l){if(l instanceof le&&l.code==="SECRETS_MISSING"){let f=l.body??{};return{ok:!1,secretsMissing:!0,error:typeof f.error=="string"&&f.error?f.error:"HyperExecute refused the job: a secret it names is missing",explorationId:typeof f.exploration_id=="string"?f.exploration_id:null,runId:typeof f.run_id=="string"?f.run_id:null}}return{ok:!1,error:`could not launch the remote run: ${z(l)}`}}}}async function Vt(e,t,n){let r={Authorization:K(t.username,t.accessKey),Accept:"application/json"},o=new URLSearchParams({username:t.username});for(let a of n)o.append("secretKey",a);let i=await F(`${e}/logistics/v1.0/all-secrets/list?${o}`,{method:"GET",headers:r});if(i.status===404&&(i=await F(`${e}/logistics/v1.0/secrets/list/${encodeURIComponent(t.username)}`,{method:"GET",headers:r})),!i.ok)throw new Error(`HTTP ${i.status}`);let c=null;try{c=await i.json()}catch{c=null}let g=mr(c);return n.filter(a=>g.has(a))}function mr(e){let t=new Set,n=e&&typeof e=="object"?e:{},r=Array.isArray(n.Data)?n.Data:Array.isArray(n.data)?n.data:Array.isArray(e)?e:[];for(let o of r)if(typeof o=="string")t.add(o);else if(o&&typeof o=="object"){let i=o,c=i.key??i.secretKey??i.Key??i.name;typeof c=="string"&&t.add(c)}return t}var Dt=["allowDomain","deny","allowPost","depthCaps","slowBudget","recheck","focus","hpsRegion","tunnel","tunnelName"];function Ae(e,t){let n={};t&&(n.deps=t);for(let r of Dt){let o=e[r];o===void 0||Array.isArray(o)&&!o.length||(n[r]=o)}return n}function Gt(e){let t=e.args&&typeof e.args=="object"?e.args:{},n={url:e.url,prompt:e.prompt,browser:"remote",headless:!0};typeof e.max_parallel=="number"&&e.max_parallel>0&&(n.maxParallel=e.max_parallel),typeof e.max_leases=="number"&&e.max_leases>0&&(n.maxLeases=e.max_leases),Array.isArray(e.allowed_domains)&&(n.allowDomain=e.allowed_domains),typeof e.policy=="string"&&e.policy&&(n.policy=e.policy);for(let r of Dt)t[r]!==void 0&&(n[r]=t[r]);return typeof t.deps=="string"&&t.deps&&(n.depsText=t.deps),n}function Ft(e,t){let n={},r=[];for(let o of e){if(!o.secret){n[o.name]={value:"",secret:!1};continue}let i=t[o.name];if(!i||i.includes("${{.secrets.")){r.push(o.name);continue}n[o.name]={value:i,secret:!0}}return r.length?{ok:!1,missing:r}:{ok:!0,variables:n}}function z(e){return e instanceof Error?e.message:String(e)}function Wt(e){let t=$e(e.variables).map(n=>({name:n.name,secret:n.secret}));return{url:e.url,prompt:e.prompt,policy:e.policy??ue,...t.length?{variables:t}:{},...e.maxParallel?{max_parallel:e.maxParallel}:{},...e.maxLeases?{max_leases:e.maxLeases}:{},args:Ae({...e.opts,allowDomain:e.allowedDomains},e.depsText)}}function hr(e){let t={},n=(e.KANE_EXPLORE_DEV_SKIP_SECRET_PUSH??"").trim();return n&&(t.skipPush=n),(e.KANE_EXPLORE_DEV_SKIP_SECRET_CHECK??"").trim()==="1"&&(t.skipCheck=!0),t}async function wr(e,t){let n=fr(t),r=new qe(e.controllerBaseUrl,{username:e.basic.username,accessKey:e.basic.access_key}),o=`${Kt()}-${gr(t)}`,c=(await r.getPresignedUrls("explore-dev",Kt(),[{key:"bundle",content_type:"application/gzip",filename:o}])).urls.bundle;if(!c)throw new Error("the presign reply named no URL for the bundle");return await ot(c.upload_url,n,"application/gzip"),c.blob_url}function xr(e){return{project_id:e.projectId,url:e.url,prompt:e.prompt,policy:e.policy??ue,...e.allowedDomains.length?{allowed_domains:e.allowedDomains}:{},...e.contextEnabled===!1?{context_enabled:!1}:{},...e.maxParallel?{max_parallel:e.maxParallel}:{},...e.maxLeases?{max_leases:e.maxLeases}:{},args:Ae(e.opts,e.depsText),kane_version:e.kaneVersion}}async function qt(e,t){let n=new S({baseUrl:e.controllerBaseUrl,auth:e.basic}),r=new st(e.secretsBaseUrl),o=new it(e.tmsBaseUrl,e.basic.username,e.basic.access_key),i={username:e.basic.username,accessKey:e.basic.access_key},c=xr(t),g=t.dev,a=await Ht({variables:$e(t.variables),login:i,body:c,...g?{dev:hr(process.env),onNote:u=>e.emit({type:"warning",message:u}),devBundle:async()=>({bundle_url:await wr(e,g.bundlePath),controller_url:g.controllerUrl})}:{}},{pushSecret:(u,l)=>r.pushSecret({secretKey:u,secretValue:l,username:i.username,accessKey:i.accessKey,orgId:e.orgId}),upsertGlobal:async(u,l)=>{await o.upsertVariable({name:u,value:l})},hxSecretNames:u=>Vt(e.secretsBaseUrl,i,u),remoteRun:u=>n.remoteRun(u),activeRun:async()=>{if(!t.projectId)return null;let l=(await n.listExplorations({state:"running",project:t.projectId,limit:1})).explorations.find(f=>f.project_id===t.projectId&&f.current_session);return l&&l.current_session?{explorationId:l.exploration_id,runId:l.current_session.run_id,state:l.current_session.state}:null}});if(!a.ok&&a.secretsMissing)return{ok:!1,error:a.error,exitCode:2,stopped:{explorationId:a.explorationId,runId:a.runId}};if(!a.ok){if(t.contextEnabled===!1&&vt(a.error))return{ok:!1,error:yt,exitCode:2};let u=/could not launch/.test(a.error)||a.error.startsWith("RUN_ACTIVE:");return{ok:!1,error:a.error,exitCode:u?1:2}}return e.emit({type:"explore_remote_started",exploration_id:a.reply.exploration_id,run_id:a.reply.run_id,state:a.reply.state,hx_job_id:a.reply.hx_job_id,job_link:a.reply.job_link,created:a.reply.created,policy:c.policy??ue}),t.contextEnabled===!1&&!a.reply.created&&e.emit({type:"warning",message:`exploration ${a.reply.exploration_id} already exists; its assurance context is unchanged \u2014 use \`kane-cli explore context off ${a.reply.exploration_id}\``}),e.terminal||(process.stderr.write(`exploration ${a.reply.exploration_id}, run ${a.reply.run_id}: queued on HyperExecute
2
+ import{c as Nt}from"./chunk-N7IWR45S.js";import{a as ut,b as ct}from"./chunk-VCVEZEVS.js";import{b as bt,c as yt,d as vt,e as _t,f as kt}from"./chunk-ERRIDBE7.js";import{a as xt,b as Rt,c as Et,d as St,e as It}from"./chunk-3ZC7GSMM.js";import{c as q,d as Ie,f as Lt,g as jt,k as Ot,l as ce,m as pe,q as J,v as Ut}from"./chunk-OTMHCHH6.js";import{b as Ee,d as se}from"./chunk-ZUZ6QJRA.js";import{b as Se,c as pt,d as dt,e as mt,f as ie,g as ae,h as ft,i as gt,j as ht,k as wt,m as h,n as X,o as At,p as je,q as Te,r as Ce,s as Pe}from"./chunk-ZMIKNNO6.js";import{a as le,b as S}from"./chunk-KGNE5CIM.js";import{e as W,l as ue,n as Le,q as Tt,r as Ct,s as Pt,t as $t}from"./chunk-NPAUSUNM.js";import{a as it,b as at}from"./chunk-BJO6J5X2.js";import{d as Re,f as H}from"./chunk-OOGKX4Y6.js";import{a as ot}from"./chunk-Q4SMITTV.js";import{l as lt}from"./chunk-4CJQ7XZP.js";import{a as rt}from"./chunk-DREQ3RAA.js";import{a as st}from"./chunk-UTM7D4PI.js";import{a as et,b as ke,d as tt}from"./chunk-ULIIYKZB.js";import{b as Ze}from"./chunk-LV7224DG.js";import{e as Qe}from"./chunk-OCVDMZWB.js";import{b as ze}from"./chunk-F2F257PU.js";import{e as Ye}from"./chunk-SB26HQO7.js";import{a as qe}from"./chunk-FCD3NYOM.js";import{a as nt}from"./chunk-PVN64537.js";import{n as Xe,o as Je}from"./chunk-UJLULWSR.js";import{a as oe}from"./chunk-ZCBOHWN3.js";import{a as K}from"./chunk-4QTH7VYE.js";import{a as F}from"./chunk-RZ4F3BHX.js";import{a as ne}from"./chunk-TM45NPWL.js";import{a as We}from"./chunk-FOJHSG5M.js";import{a as M,b as re,z as Ke}from"./chunk-J4FIESTB.js";import{join as Ne}from"path";import{appendFileSync as sr,mkdirSync as ir}from"fs";import{dirname as ar}from"path";function Bt(e,t,n){if(t)try{ir(ar(t),{recursive:!0})}catch{}let r="",o=c=>{if(!(!t||!c))try{sr(t,n(c))}catch{}};e.child.stderr?.on("data",c=>{r+=c.toString();let g=r.lastIndexOf(`
3
+ `);g<0||(o(r.slice(0,g+1)),r=r.slice(g+1))}),e.child.stderr?.on("end",()=>{o(r),r=""});let i=e.getStderr.bind(e);return Object.assign(e,{getStderr:()=>n(i())})}var lr={seeding:"seeding",replay:"replaying",walking:"walking",settling:"settling",verifying:"verifying"},ur=8,cr=6,k=e=>typeof e=="string"&&e?e:null,V=e=>typeof e=="number"&&Number.isFinite(e)?e:null,de=class{s={run_id:null,exploration_id:null,status:"running",stop_reason:null,progress:null,browsers:[],version:0,updated_at:0};subs=new Set;now;constructor(t={}){this.now=t.now??Date.now}snapshot(){return structuredClone(this.s)}subscribe(t){return this.subs.add(t),()=>{this.subs.delete(t)}}end(t){this.s.status!=="ended"&&(this.s.status="ended",this.s.stop_reason=t,this.s.browsers=[],this.changed())}apply(t){this.reduce(t)&&this.changed()}changed(){if(this.s.version+=1,this.s.updated_at=this.now(),!this.subs.size)return;let t=this.snapshot();for(let n of this.subs)try{n(t)}catch{}}browser(t,n){let r=this.s.browsers.find(o=>o.worker===t)??null;return!r&&n&&(r={worker:t,state:"opening",since:this.now(),lease:null,step:null,steps:[],trail:[],held:null},this.s.browsers.push(r),this.s.browsers.sort((o,i)=>o.worker-i.worker)),r}setState(t,n){t.state!==n&&(t.state=n,t.since=this.now())}reduce(t){let n=V(t.worker_index);switch(t.type){case"explore_start":return this.s.run_id=k(t.run_id),this.s.exploration_id=k(t.exploration_id),this.s.status="running",!0;case"browser_request":return n===null?!1:(this.browser(n,!0),!0);case"browser_release":{if(n===null)return!1;let r=this.s.browsers.length;return this.s.browsers=this.s.browsers.filter(o=>o.worker!==n),this.s.browsers.length!==r}case"lease_start":{if(n===null||!k(t.lease_id))return!1;let r=this.browser(n,!0),o=t.reach&&typeof t.reach=="object"&&!Array.isArray(t.reach)?t.reach:null;return r.lease={id:String(t.lease_id),kind:String(t.kind??""),target:k(t.target),reach:o,started_at:this.now()},r.step=null,r.steps=[],this.setState(r,"starting"),!0}case"lease_step":{if(n===null)return!1;let r=this.browser(n,!1);if(!r||!r.lease||r.lease.id!==t.lease_id)return!1;let o={ordinal:V(t.ordinal)??r.steps.length,phase:String(t.phase??""),intent:k(t.intent),junction_id:k(t.junction_id),known:t.known===!0,url_pattern:k(t.url_pattern),flow_id:k(t.flow_id),navigated:t.navigated===!0,at:this.now()};return r.step=o,r.steps=[...r.steps,o].slice(-ur),o.junction_id&&r.trail[r.trail.length-1]!==o.junction_id&&(r.trail=[...r.trail,o.junction_id].slice(-cr)),this.setState(r,lr[o.phase]??"walking"),!0}case"lease_end":{let r=this.s.browsers.find(o=>o.lease?.id===t.lease_id);return r?(r.lease=null,r.step=null,r.steps=[],this.setState(r,r.held?"holding":"idle"),!0):!1}case"session_held":{if(n===null)return!1;let r=this.browser(n,!0);return r.held={kind:String(t.kind??""),start_flow:k(t.start_flow),junction_id:k(t.junction_id),url_pattern:k(t.url_pattern)},r.lease||this.setState(r,"holding"),!0}case"session_released":{if(n===null)return!1;let r=this.browser(n,!1);return!r||!r.held?!1:(r.held=null,r.lease||this.setState(r,"idle"),!0)}case"progress":return this.s.progress={frontier:V(t.frontier)??0,visited:V(t.visited)??0,active_workers:V(t.active_workers)??0,elapsed_s:V(t.elapsed_s)??0},!0;case"explore_control":return t.control!=="stop"||this.s.status!=="running"?!1:(this.s.status="paused",!0);case"explore_end":return this.s.status="ended",this.s.stop_reason=k(t.stop_reason),this.s.browsers=[],!0;default:return!1}}};var me=class{link=null;wanted=new Map;source=async(t,n)=>(this.wanted.set(t,n),this.link?.start(t),{stop:async()=>{this.wanted.get(t)===n&&(this.wanted.delete(t),this.link?.stop(t))}});attach(t){if(this.link=t,t)for(let n of this.wanted.keys())t.start(n)}frame(t,n){this.wanted.get(t)?.(n)}};var pr=500,dr=1e4,Mt=5e3,mr=async(e,t)=>{let n=new AbortController,r=()=>n.abort(),o=setTimeout(r,t.timeoutMs);t.signal.addEventListener("abort",r,{once:!0});try{let i=await F(e,{method:"POST",headers:t.headers,body:t.body,signal:n.signal}),c=null;try{c=await i.json()}catch{}return{status:i.status,body:c}}finally{clearTimeout(o),t.signal.removeEventListener("abort",r)}},fe=class{constructor(t){this.opts=t;this.post=t.post??mr,this.unsubscribeModel=t.model.subscribe(()=>this.stateChanged())}post;target=null;off=!1;framesOff=!1;abort=new AbortController;unsubscribeModel;stateInFlight=!1;stateDirty=!1;lastStateAt=0;stateTimer=null;heartbeat=null;watched=new Map;stopAsked=!1;waiting=new Map;sending=new Set;arm(t){this.off||(this.letAllGo(),this.abort.abort(),this.abort=new AbortController,this.stateInFlight=!1,this.target=t,this.framesOff=!1,this.stateDirty=!0,this.sendState())}async close(){this.off=!0,this.unsubscribeModel(),this.clearTimers(),this.letAllGo(),this.abort.abort()}url(t,n=""){let r=this.target;return`${r.baseUrl.replace(/\/+$/,"")}${n}/exploration/${encodeURIComponent(r.explorationId)}/runs/${encodeURIComponent(r.runId)}/live/${t}`}stateChanged(){if(this.off||!this.target||(this.stateDirty=!0,this.stateInFlight||this.stateTimer))return;let t=pr-(Date.now()-this.lastStateAt);t<=0?this.sendState():this.stateTimer=setTimeout(()=>{this.stateTimer=null,this.sendState()},t)}sendState(){if(this.off||!this.target||this.stateInFlight)return;let t=this.target;this.stateDirty=!1,this.stateInFlight=!0,this.lastStateAt=Date.now(),this.heartbeat&&clearTimeout(this.heartbeat),this.heartbeat=null;let n;try{n=JSON.stringify(this.opts.model.snapshot())}catch{this.stateInFlight=!1;return}this.post(this.url("state"),{headers:{Authorization:t.authHeader,"Content-Type":"application/json"},body:n,timeoutMs:Mt,signal:this.abort.signal}).then(r=>{if(this.target===t){if(r.status===404||r.status===403||r.status===401)return this.turnOff(r.status);r.status>=200&&r.status<300&&(this.stopIfAsked(r.body),this.follow(r.body))}},()=>{}).finally(()=>{this.target!==t||this.off||(this.stateInFlight=!1,this.heartbeat=setTimeout(()=>{this.heartbeat=null,this.stateDirty=!0,this.sendState()},dr),this.stateDirty&&this.stateChanged())})}turnOff(t){this.off||(this.off=!0,this.clearTimers(),this.letAllGo(),this.abort.abort(),this.opts.onWarn?.(`live view is off for this run: the controller has no live routes (HTTP ${t})`))}stopIfAsked(t){this.stopAsked||!t||typeof t!="object"||t.stop!==!0||(this.stopAsked=!0,this.opts.onStop?.())}follow(t){let n=t&&typeof t=="object"?t.watched:void 0;if(!Array.isArray(n)||this.framesOff)return;let r=new Set(n.filter(o=>Number.isInteger(o)&&o>=0));for(let o of[...this.watched.keys()])r.has(o)||this.letGo(o);for(let o of r)this.watched.has(o)||this.watched.set(o,this.opts.frames.subscribe(new Map([[o,Et]]),i=>this.frame(i)))}frame(t){t.kind!=="frame"||this.off||!this.watched.has(t.worker)||(this.waiting.set(t.worker,{data:t.data,at:t.at}),this.sendFrame(t.worker))}sendFrame(t){if(this.sending.has(t)||!this.target)return;let n=this.waiting.get(t);if(n===void 0)return;this.waiting.delete(t);let r=this.target;this.sending.add(t);let o=Number.isFinite(n.at)?`&at=${Math.round(n.at)}`:"";this.post(`${this.url("frames","/public")}?worker=${t}${o}`,{headers:{"X-Live-Token":r.liveToken,"Content-Type":"image/jpeg"},body:Buffer.from(n.data,"base64"),timeoutMs:Mt,signal:this.abort.signal}).then(i=>{this.target===r&&(i.status===410?this.letGo(t):i.status===401&&!this.framesOff&&(this.framesOff=!0,this.letAllGo(),this.opts.onWarn?.("live frames are off for this run: the controller refused its live token (HTTP 401)")))},()=>{}).finally(()=>{this.target===r&&(this.sending.delete(t),!this.off&&this.watched.has(t)&&this.sendFrame(t))})}letGo(t){let n=this.watched.get(t);this.watched.delete(t),this.waiting.delete(t),n?.()}letAllGo(){for(let t of[...this.watched.keys()])this.letGo(t);this.sending.clear()}clearTimers(){this.stateTimer&&clearTimeout(this.stateTimer),this.heartbeat&&clearTimeout(this.heartbeat),this.stateTimer=this.heartbeat=null}};function ge(e,t){return`watch live: kane-cli explore view --exploration-id ${e}${t?` --env ${t}`:""}`}async function Ht(e){let t=new de,n=new me,r=new Rt({start:e.startSource??n.source}),o=new fe({model:t,frames:r,post:e.post,onWarn:e.onWarn,onStop:e.onStop}),i=!1,c=!1,g=!1;return{model:t,frames:r,onBrowser(a){c||r.addBrowser(a)},offBrowser(a){r.removeBrowser(a)},attachRunner(a){n.attach(c?null:a)},runnerFrame(a,u){c||n.frame(a,u)},onEvent(a){t.apply(a),a.type==="explore_start"&&!i&&typeof a.exploration_id=="string"&&a.exploration_id&&(i=!0,e.onExploration?.(a.exploration_id))},armRun(a){if(!c){if(!a.liveToken){g||e.onWarn?.("live view is off for this run: the controller handed out no live token"),g=!0;return}o.arm({...e.controller,explorationId:a.explorationId,runId:a.runId,liveToken:a.liveToken})}},async close(a){c||(c=!0,await o.close(),n.attach(null),t.end(a),await r.close())}}}import{readFileSync as gr}from"fs";import{basename as hr}from"path";import{randomUUID as Wt}from"crypto";function $e(e){let t=[];for(let[n,r]of Object.entries(e)){if(r.type==="parameter")continue;let o=n.replace(/^(secrets\.user\.|global\.|environment\.)/,"");t.push({name:o,secret:!!r.secret,value:String(r.value??"")})}return t}async function Vt(e,t){if(t.activeRun){let u=null;try{u=await t.activeRun()}catch{u=null}if(u)return{ok:!1,error:`RUN_ACTIVE: run ${u.runId} is ${u.state} on exploration ${u.explorationId}; stop it or wait for it to end`}}let n=e.variables.filter(u=>u.secret),r=e.variables.filter(u=>!u.secret),o=[["LT_USERNAME",e.login.username],["LT_ACCESS_KEY",e.login.accessKey],...n.map(u=>[u.name,u.value])];for(let[u,l]of o){if(e.dev?.skipPush===u){e.onNote?.(`dev: not pushing secret ${u} (KANE_EXPLORE_DEV_SKIP_SECRET_PUSH)`);continue}try{await t.pushSecret(u,l)}catch(f){return{ok:!1,error:`could not push secret ${u} to HyperExecute Secrets: ${z(f)}`}}}for(let u of r)try{await t.upsertGlobal(u.name,u.value)}catch(l){return{ok:!1,error:`could not push variable ${u.name} to Test Manager: ${z(l)}`}}let i=o.map(([u])=>u);if(e.dev?.skipCheck)return e.onNote?.("dev: not checking the HyperExecute secrets list (KANE_EXPLORE_DEV_SKIP_SECRET_CHECK); the VM's check must refuse a missing secret"),a();let c;try{c=await t.hxSecretNames(i)}catch(u){return{ok:!1,error:`could not read your HyperExecute secrets to check them: ${z(u)}`}}let g=i.filter(u=>!c.includes(u));if(g.length)return{ok:!1,error:`HyperExecute Secrets does not list ${g.join(", ")} after the push; the VM would run without ${g.length===1?"it":"them"}`};return a();async function a(){let u=e.body;if(e.devBundle)try{let{kane_version:l,...f}=e.body;u={...f,dev:await e.devBundle()}}catch(l){return{ok:!1,error:`--dev-bundle: could not upload the bundle: ${z(l)}`}}try{return{ok:!0,reply:await t.remoteRun({...u,variables:e.variables.map(f=>({name:f.name,secret:f.secret}))})}}catch(l){if(l instanceof le&&l.code==="SECRETS_MISSING"){let f=l.body??{};return{ok:!1,secretsMissing:!0,error:typeof f.error=="string"&&f.error?f.error:"HyperExecute refused the job: a secret it names is missing",explorationId:typeof f.exploration_id=="string"?f.exploration_id:null,runId:typeof f.run_id=="string"?f.run_id:null}}return{ok:!1,error:`could not launch the remote run: ${z(l)}`}}}}async function Dt(e,t,n){let r={Authorization:K(t.username,t.accessKey),Accept:"application/json"},o=new URLSearchParams({username:t.username});for(let a of n)o.append("secretKey",a);let i=await F(`${e}/logistics/v1.0/all-secrets/list?${o}`,{method:"GET",headers:r});if(i.status===404&&(i=await F(`${e}/logistics/v1.0/secrets/list/${encodeURIComponent(t.username)}`,{method:"GET",headers:r})),!i.ok)throw new Error(`HTTP ${i.status}`);let c=null;try{c=await i.json()}catch{c=null}let g=fr(c);return n.filter(a=>g.has(a))}function fr(e){let t=new Set,n=e&&typeof e=="object"?e:{},r=Array.isArray(n.Data)?n.Data:Array.isArray(n.data)?n.data:Array.isArray(e)?e:[];for(let o of r)if(typeof o=="string")t.add(o);else if(o&&typeof o=="object"){let i=o,c=i.key??i.secretKey??i.Key??i.name;typeof c=="string"&&t.add(c)}return t}var Gt=["allowDomain","deny","allowPost","depthCaps","slowBudget","recheck","focus","hpsRegion","tunnel","tunnelName"];function Ae(e,t){let n={};t&&(n.deps=t);for(let r of Gt){let o=e[r];o===void 0||Array.isArray(o)&&!o.length||(n[r]=o)}return n}function Ft(e){let t=e.args&&typeof e.args=="object"?e.args:{},n={url:e.url,prompt:e.prompt,browser:"remote",headless:!0};typeof e.max_parallel=="number"&&e.max_parallel>0&&(n.maxParallel=e.max_parallel),typeof e.max_leases=="number"&&e.max_leases>0&&(n.maxLeases=e.max_leases),Array.isArray(e.allowed_domains)&&(n.allowDomain=e.allowed_domains),typeof e.policy=="string"&&e.policy&&(n.policy=e.policy);for(let r of Gt)t[r]!==void 0&&(n[r]=t[r]);return typeof t.deps=="string"&&t.deps&&(n.depsText=t.deps),n}function Kt(e,t){let n={},r=[];for(let o of e){if(!o.secret){n[o.name]={value:"",secret:!1};continue}let i=t[o.name];if(!i||i.includes("${{.secrets.")){r.push(o.name);continue}n[o.name]={value:i,secret:!0}}return r.length?{ok:!1,missing:r}:{ok:!0,variables:n}}function z(e){return e instanceof Error?e.message:String(e)}function qt(e){let t=$e(e.variables).map(n=>({name:n.name,secret:n.secret}));return{url:e.url,prompt:e.prompt,policy:e.policy??ue,...t.length?{variables:t}:{},...e.maxParallel?{max_parallel:e.maxParallel}:{},...e.maxLeases?{max_leases:e.maxLeases}:{},args:Ae({...e.opts,allowDomain:e.allowedDomains},e.depsText)}}function wr(e){let t={},n=(e.KANE_EXPLORE_DEV_SKIP_SECRET_PUSH??"").trim();return n&&(t.skipPush=n),(e.KANE_EXPLORE_DEV_SKIP_SECRET_CHECK??"").trim()==="1"&&(t.skipCheck=!0),t}async function xr(e,t){let n=gr(t),r=new qe(e.controllerBaseUrl,{username:e.basic.username,accessKey:e.basic.access_key}),o=`${Wt()}-${hr(t)}`,c=(await r.getPresignedUrls("explore-dev",Wt(),[{key:"bundle",content_type:"application/gzip",filename:o}])).urls.bundle;if(!c)throw new Error("the presign reply named no URL for the bundle");return await st(c.upload_url,n,"application/gzip"),c.blob_url}function br(e){return{project_id:e.projectId,url:e.url,prompt:e.prompt,policy:e.policy??ue,...e.allowedDomains.length?{allowed_domains:e.allowedDomains}:{},...e.contextEnabled===!1?{context_enabled:!1}:{},...e.maxParallel?{max_parallel:e.maxParallel}:{},...e.maxLeases?{max_leases:e.maxLeases}:{},args:Ae(e.opts,e.depsText),kane_version:e.kaneVersion}}async function Xt(e,t){let n=new S({baseUrl:e.controllerBaseUrl,auth:e.basic}),r=new it(e.secretsBaseUrl),o=new at(e.tmsBaseUrl,e.basic.username,e.basic.access_key),i={username:e.basic.username,accessKey:e.basic.access_key},c=br(t),g=t.dev,a=await Vt({variables:$e(t.variables),login:i,body:c,...g?{dev:wr(process.env),onNote:u=>e.emit({type:"warning",message:u}),devBundle:async()=>({bundle_url:await xr(e,g.bundlePath),controller_url:g.controllerUrl})}:{}},{pushSecret:(u,l)=>r.pushSecret({secretKey:u,secretValue:l,username:i.username,accessKey:i.accessKey,orgId:e.orgId}),upsertGlobal:async(u,l)=>{await o.upsertVariable({name:u,value:l})},hxSecretNames:u=>Dt(e.secretsBaseUrl,i,u),remoteRun:u=>n.remoteRun(u),activeRun:async()=>{if(!t.projectId)return null;let l=(await n.listExplorations({state:"running",project:t.projectId,limit:1})).explorations.find(f=>f.project_id===t.projectId&&f.current_session);return l&&l.current_session?{explorationId:l.exploration_id,runId:l.current_session.run_id,state:l.current_session.state}:null}});if(!a.ok&&a.secretsMissing)return{ok:!1,error:a.error,exitCode:2,stopped:{explorationId:a.explorationId,runId:a.runId}};if(!a.ok){if(t.contextEnabled===!1&&_t(a.error))return{ok:!1,error:vt,exitCode:2};let u=/could not launch/.test(a.error)||a.error.startsWith("RUN_ACTIVE:");return{ok:!1,error:a.error,exitCode:u?1:2}}return e.emit({type:"explore_remote_started",exploration_id:a.reply.exploration_id,run_id:a.reply.run_id,state:a.reply.state,hx_job_id:a.reply.hx_job_id,job_link:a.reply.job_link,created:a.reply.created,policy:c.policy??ue}),t.contextEnabled===!1&&!a.reply.created&&e.emit({type:"warning",message:`exploration ${a.reply.exploration_id} already exists; its assurance context is unchanged \u2014 use \`kane-cli explore context off ${a.reply.exploration_id}\``}),e.terminal||(process.stderr.write(`exploration ${a.reply.exploration_id}, run ${a.reply.run_id}: queued on HyperExecute
4
4
  `),a.reply.job_link&&process.stderr.write(`job: ${a.reply.job_link}
5
5
  `),process.stderr.write(ge(a.reply.exploration_id,e.env)+`
6
- `)),{ok:!0,explorationId:a.reply.exploration_id,runId:a.reply.run_id}}async function Xt(e,t,n,r){let o=new S({baseUrl:e.controllerBaseUrl,auth:e.basic}),i;try{i=await o.runRequest(t,n)}catch(l){let f=l instanceof le?l.code:"";return{ok:!1,error:`could not read run ${n}'s request${f?` (${f})`:""}: ${l.message}`,exitCode:2,stopped:!1}}let c=i.requested&&typeof i.requested=="object"?i.requested:{},g=Array.isArray(c.variables)?c.variables:[],a=Ft(g,r);if(!a.ok){let l=`secret${a.missing.length===1?"":"s"} ${a.missing.join(", ")} not set on this machine (HyperExecute Secrets has no value for ${a.missing.length===1?"it":"them"})`,f=W("secrets_missing",l);try{let y=await o.startRun(t,{run_id:n,sessions:1,client_release:M});await o.endRun(t,n,{remark:f,stop_reason:"secrets_missing",last_seq:y.next_seq-1,complete:!1,totals:{},unacked:0})}catch(y){return{ok:!1,error:`${l}; stopping the run also failed: ${y.message}`,exitCode:1,stopped:!1}}return{ok:!1,error:l,exitCode:1,stopped:!0}}return{ok:!0,opts:{...Gt({...c,url:c.url??i.target_url,prompt:c.prompt??i.prompt}),explorationId:t,claimRunId:n,variables:JSON.stringify(a.variables)}}}import{existsSync as kr}from"fs";function he(e,t,n){let r=typeof e.explorationId=="string"?e.explorationId.trim():"";return r&&t?{explorationId:r}:n?{projectId:n}:null}function Jt(e){let t=e.trim();try{let n=new URL(t);return`${n.protocol}//${n.host}${n.pathname.replace(/\/+$/,"")}${n.search}${n.hash}`}catch{return t.replace(/\/+$/,"").toLowerCase()}}function br(e,t){return Jt(e)===Jt(t)}var yr=10;async function Oe(e,t){let n;for(let r=0;r<yr;r++){let o=await e.listExplorations({state:"all",limit:100,...n?{cursor:n}:{},..."projectId"in t?{project:t.projectId}:{}}),i=o.explorations.find(c=>"projectId"in t?c.project_id===t.projectId:c.exploration_id===t.explorationId);if(i)return i;if(!o.next_cursor)return null;n=o.next_cursor}return null}function vr(e){return`use a new --project for another site, or kane-cli explore delete ${e} first`}function Ue(e,t){let n=e.target_url??"";return!n||!t.trim()||br(n,t)?null:{error:`--url ${t.trim()} is not exploration ${e.exploration_id}'s URL (${n}): one exploration per project explores one URL`,next:vr(e.exploration_id)}}var _r=e=>We.hex(Ke.dim)(e),Rr=`error: --setup and --setup-check were replaced by --deps <plain language> (repeatable, or @file), which the recon runs once as its setup walk; see kane-cli explore run --help
7
- `,Er=`
6
+ `)),{ok:!0,explorationId:a.reply.exploration_id,runId:a.reply.run_id}}async function Jt(e,t,n,r){let o=new S({baseUrl:e.controllerBaseUrl,auth:e.basic}),i;try{i=await o.runRequest(t,n)}catch(l){let f=l instanceof le?l.code:"";return{ok:!1,error:`could not read run ${n}'s request${f?` (${f})`:""}: ${l.message}`,exitCode:2,stopped:!1}}let c=i.requested&&typeof i.requested=="object"?i.requested:{},g=Array.isArray(c.variables)?c.variables:[],a=Kt(g,r);if(!a.ok){let l=`secret${a.missing.length===1?"":"s"} ${a.missing.join(", ")} not set on this machine (HyperExecute Secrets has no value for ${a.missing.length===1?"it":"them"})`,f=W("secrets_missing",l);try{let y=await o.startRun(t,{run_id:n,sessions:1,client_release:M});await o.endRun(t,n,{remark:f,stop_reason:"secrets_missing",last_seq:y.next_seq-1,complete:!1,totals:{},unacked:0})}catch(y){return{ok:!1,error:`${l}; stopping the run also failed: ${y.message}`,exitCode:1,stopped:!1}}return{ok:!1,error:l,exitCode:1,stopped:!0}}return{ok:!0,opts:{...Ft({...c,url:c.url??i.target_url,prompt:c.prompt??i.prompt}),explorationId:t,claimRunId:n,variables:JSON.stringify(a.variables)}}}import{existsSync as Rr}from"fs";function he(e,t,n){let r=typeof e.explorationId=="string"?e.explorationId.trim():"";return r&&t?{explorationId:r}:n?{projectId:n}:null}function zt(e){let t=e.trim();try{let n=new URL(t);return`${n.protocol}//${n.host}${n.pathname.replace(/\/+$/,"")}${n.search}${n.hash}`}catch{return t.replace(/\/+$/,"").toLowerCase()}}function yr(e,t){return zt(e)===zt(t)}var vr=10;async function Oe(e,t){let n;for(let r=0;r<vr;r++){let o=await e.listExplorations({state:"all",limit:100,...n?{cursor:n}:{},..."projectId"in t?{project:t.projectId}:{}}),i=o.explorations.find(c=>"projectId"in t?c.project_id===t.projectId:c.exploration_id===t.explorationId);if(i)return i;if(!o.next_cursor)return null;n=o.next_cursor}return null}function _r(e){return`use a new --project for another site, or kane-cli explore delete ${e} first`}function Ue(e,t){let n=e.target_url??"";return!n||!t.trim()||yr(n,t)?null:{error:`--url ${t.trim()} is not exploration ${e.exploration_id}'s URL (${n}): one exploration per project explores one URL`,next:_r(e.exploration_id)}}var kr=e=>We.hex(Ke.dim)(e),Er=`error: --setup and --setup-check were replaced by --deps <plain language> (repeatable, or @file), which the recon runs once as its setup walk; see kane-cli explore run --help
7
+ `,Sr=`
8
8
  One project has one exploration, of one URL: a re-run takes the exploration's
9
9
  URL, and a different --url is refused (use a new --project for another site,
10
10
  or kane-cli explore delete <id> first).
@@ -20,28 +20,28 @@ Examples:
20
20
  # a local app, through your LT tunnel (start LT first)
21
21
  $ kane-cli explore run --project <id> --url http://localhost:3000 \\
22
22
  --tunnel-name dev
23
- `;function zt(e){let t=Number(e);if(!Number.isInteger(t)||t<1)throw new Ee("must be a positive integer");return t}function uo(e){let t=e.command("explore").description("Explore an app into a map of its screens and flows").enablePositionalOptions().option("--exploration-id <id>",X({purpose:"On a terminal: open this exploration's card",values:"an id from kane-cli explore list --all",dflt:"pick a project first"})).option("--env <name>",Te).option("--username <user>",Ce).option("--access-key <key>",Pe).option("--agent",je).configureHelp({sortSubcommands:!0,...pe([{title:"Target",flags:["--exploration-id"]},{title:"Output",flags:["--agent","--help"]},{title:"Account",flags:["--env","--username","--access-key"]}])}).addHelpText("after",`
23
+ `;function Qt(e){let t=Number(e);if(!Number.isInteger(t)||t<1)throw new Ee("must be a positive integer");return t}function co(e){let t=e.command("explore").description("Explore an app into a map of its screens and flows").enablePositionalOptions().option("--exploration-id <id>",X({purpose:"On a terminal: open this exploration's card",values:"an id from kane-cli explore list --all",dflt:"pick a project first"})).option("--env <name>",Te).option("--username <user>",Ce).option("--access-key <key>",Pe).option("--agent",je).configureHelp({sortSubcommands:!0,...pe([{title:"Target",flags:["--exploration-id"]},{title:"Output",flags:["--agent","--help"]},{title:"Account",flags:["--env","--username","--access-key"]}])}).addHelpText("after",`
24
24
  On a terminal, plain \`kane-cli explore\` opens the project picker, then the
25
25
  exploration's card (run again, watch, stop, map, sessions, context, delete);
26
26
  with --agent or a pipe it prints this help. Each command's --help lists its
27
27
  options, grouped, with their values, defaults and examples.
28
- `).action(async(n,r)=>{if(r.args.length>0&&r.error(`error: unknown command '${r.args[0]}'`,{exitCode:2}),ce(n,At()))return r.help();let{runExploreEntryAction:o}=await import("./explore-entry-3EX2T3NS.js");process.exitCode=await o(n)});t.command("run").description("Run one exploration of an app into its project's map: on HyperExecute by default (exits once the run is queued; stop it with explore stop), or on this machine with --local-orchestration. A terminal opens a setup form and a review first; --agent or a pipe gets NDJSON on stdout, done last").option("--url <url>",h("url")).option("--project <id>",h("project")).option("--exploration-id <id>",h("explorationId")).option("--prompt <text>",h("prompt"),"Explore the app").option("--max-leases <n>",h("maxLeases"),zt).option("--max-parallel <n>",h("maxParallel"),zt).option("--depth-caps <depth:cap,\u2026>",h("depthCaps")).option("--slow-budget <spec>",h("slowBudget")).option("--no-recheck",h("recheck")).option("--policy <policy>",h("policy")).option("--allow-domain <host>",h("allowDomain"),we,[]).option("--deny <name>",h("deny"),we,[]).option("--allow-post <host/path>",h("allowPost"),we,[]).option("--focus <screen>",h("focus")).option("--local-orchestration",h("localOrchestration")).option("--browser <where>",h("browser"),"local").option("--headless",h("headless")).option("--tunnel",h("tunnel")).option("--tunnel-name <name>",h("tunnelName")).option("--deps <text>",h("deps"),we,[]).option("--variables <json>",h("variables")).option("--variables-file <path>",h("variablesFile")).option("--no-context",h("context")).option("--agent",h("agent")).option("--env <name>",h("env")).option("--username <user>",h("username")).option("--access-key <key>",h("accessKey")).addOption(new se("--claim-run <run-id>","On a HyperExecute VM: take over this queued run (the job's own command; needs --exploration-id)").hideHelp()).addOption(new se("--dev-bundle <tgz>","Dev only: the VM installs this kane-cli bundle and talks to EXPLORE_DEV_CONTROLLER_URL").hideHelp()).addOption(new se("--hps-region <region>",`With remote browsers on prod: the regional host (${ae.join(", ")})`).hideHelp()).configureHelp(pe($t())).addHelpText("after",Er).configureOutput({outputError:(n,r)=>r(/\'--setup(?:-check)?(?:=|\')/.test(n)?Rr:n)}).action(async n=>{process.exitCode=await Or(n)}),t.command("view").description("Serve a live graph of an exploration's map on 127.0.0.1 (polls the service; Ctrl-C to stop)").option("--exploration-id <id>",X({purpose:"The exploration to view",values:"an id from kane-cli explore list --all"})).option("--project <id>",X({purpose:"View this project's exploration instead (a project has one)",values:"a project id"})).option("--port <n>",X({purpose:"The port on 127.0.0.1",values:"1-65535",dflt:"the first free of 7420-7429"}),Sr).option("--agent",je).option("--env <name>",Te).option("--username <user>",Ce).option("--access-key <key>",Pe).configureHelp(pe([{title:"Target",flags:["--exploration-id","--project"]},{title:"Server",flags:["--port"]},{title:"Output",flags:["--agent","--help"]},{title:"Account",flags:["--env","--username","--access-key"]}])).addHelpText("after",`
28
+ `).action(async(n,r)=>{if(r.args.length>0&&r.error(`error: unknown command '${r.args[0]}'`,{exitCode:2}),ce(n,Ot()))return r.help();let{runExploreEntryAction:o}=await import("./explore-entry-E6EY3VV3.js");process.exitCode=await o(n)});t.command("run").description("Run one exploration of an app into its project's map: on HyperExecute by default (exits once the run is queued; stop it with explore stop), or on this machine with --local-orchestration. A terminal opens a setup form and a review first; --agent or a pipe gets NDJSON on stdout, done last").option("--url <url>",h("url")).option("--project <id>",h("project")).option("--exploration-id <id>",h("explorationId")).option("--prompt <text>",h("prompt"),"Explore the app").option("--max-leases <n>",h("maxLeases"),Qt).option("--max-parallel <n>",h("maxParallel"),Qt).option("--depth-caps <depth:cap,\u2026>",h("depthCaps")).option("--slow-budget <spec>",h("slowBudget")).option("--no-recheck",h("recheck")).option("--policy <policy>",h("policy")).option("--allow-domain <host>",h("allowDomain"),we,[]).option("--deny <name>",h("deny"),we,[]).option("--allow-post <host/path>",h("allowPost"),we,[]).option("--focus <screen>",h("focus")).option("--local-orchestration",h("localOrchestration")).option("--browser <where>",h("browser"),"local").option("--headless",h("headless")).option("--tunnel",h("tunnel")).option("--tunnel-name <name>",h("tunnelName")).option("--deps <text>",h("deps"),we,[]).option("--variables <json>",h("variables")).option("--variables-file <path>",h("variablesFile")).option("--no-context",h("context")).option("--agent",h("agent")).option("--env <name>",h("env")).option("--username <user>",h("username")).option("--access-key <key>",h("accessKey")).addOption(new se("--claim-run <run-id>","On a HyperExecute VM: take over this queued run (the job's own command; needs --exploration-id)").hideHelp()).addOption(new se("--dev-bundle <tgz>","Dev only: the VM installs this kane-cli bundle and talks to EXPLORE_DEV_CONTROLLER_URL").hideHelp()).addOption(new se("--hps-region <region>",`With remote browsers on prod: the regional host (${ae.join(", ")})`).hideHelp()).configureHelp(pe(At())).addHelpText("after",Sr).configureOutput({outputError:(n,r)=>r(/\'--setup(?:-check)?(?:=|\')/.test(n)?Er:n)}).action(async n=>{process.exitCode=await Or(n)}),t.command("view").description("Serve a live graph of an exploration's map on 127.0.0.1 (polls the service; Ctrl-C to stop)").option("--exploration-id <id>",X({purpose:"The exploration to view",values:"an id from kane-cli explore list --all"})).option("--project <id>",X({purpose:"View this project's exploration instead (a project has one)",values:"a project id"})).option("--port <n>",X({purpose:"The port on 127.0.0.1",values:"1-65535",dflt:"the first free of 7420-7429"}),Ir).option("--agent",je).option("--env <name>",Te).option("--username <user>",Ce).option("--access-key <key>",Pe).configureHelp(pe([{title:"Target",flags:["--exploration-id","--project"]},{title:"Server",flags:["--port"]},{title:"Output",flags:["--agent","--help"]},{title:"Account",flags:["--env","--username","--access-key"]}])).addHelpText("after",`
29
29
  Name the exploration with --exploration-id or --project, not both.
30
30
 
31
31
  Examples:
32
32
  $ kane-cli explore view --project <id>
33
33
  $ kane-cli explore view --exploration-id <id> --port 7430
34
- `).action(async n=>{process.exitCode=await Nr(n)}),Ot(t),Ut(t),t.command("assurance-job",{hidden:!0}).description("One cut of an exploration into its project's assurance (the controller's job; input from the environment)").action(async()=>{let{runAssuranceJob:n}=await import("./assurance-job-MD65GQLC.js");process.exitCode=await n()})}function Sr(e){let t=Number(e);if(!Number.isInteger(t)||t<1||t>65535)throw new Ee("must be an integer 1-65535");return t}function we(e,t){return[...t,e]}function Qt(e){let t=new Set;for(let n of e){let r=n.trim().toLowerCase();if(r){try{r.includes("://")&&(r=new URL(r).hostname)}catch{}r=r.replace(/\/.*$/,"").replace(/^www\./,"").replace(/\.$/,""),r&&t.add(r)}}return[...t]}function Ir(e,t){if(e.some(r=>r.trim()==="*"))return{posts:["*"]};let n=new Set;for(let r of e){let o=r.trim();if(!o)continue;let i=y=>({error:`--allow-post ${JSON.stringify(o)}: ${y}; write it as host/path, e.g. api.example.com/v1/flags`});if(o.includes("://"))return i("no scheme");if(/[?#]/.test(o))return i("no query or fragment (the match is on host and path only)");if(o.includes("*"))return i("no partial wildcards (name the endpoint exactly, or pass a bare * for every POST)");if(/\s/.test(o))return i("no whitespace");let c=o.indexOf("/");if(c<=0)return i("a host followed by a path starting with /");let g=o.slice(0,c).toLowerCase(),a=o.slice(c),u=/^([^:]+?)\.?(?::(\d+))?$/.exec(g);if(!u)return i("an invalid host");let l=u[1],f=u[2]&&u[2]!=="80"&&u[2]!=="443"?`:${u[2]}`:"";if(g=l+f,!t.some(y=>l===y||l.endsWith(`.${y}`)))return i(`host ${l} is outside the run's domains (${t.join(", ")||"none"}); add it with --allow-domain first`);n.add(g+a)}return{posts:[...n]}}function Lr(e){if(e===void 0)return{caps:{}};let t={};for(let n of e.split(",").map(r=>r.trim()).filter(Boolean)){let r=/^(\d+):(\d+)$/.exec(n);if(!r)return{error:`--depth-caps "${e}": each entry is depth:cap with whole numbers, e.g. 0:0,1:3,2:1`};t[String(Number(r[1]))]=Number(r[2])}return Object.keys(t).length?{caps:t}:{error:`--depth-caps "${e}": give at least one depth:cap pair`}}var jr={response:"response_ms",page:"page_ready_ms",step:"step_ms"};function Tr(e){if(e===void 0)return{budgets:{}};let t={};for(let n of e.split(",").map(r=>r.trim()).filter(Boolean)){let r=/^(response|page|step)=(\d+(?:\.\d+)?)(s|ms)$/.exec(n);if(!r)return{error:`--slow-budget "${e}": each entry is response|page|step=<number>s or ms, e.g. response=3s,page=4s,step=2.5s`};let o=Math.round(Number(r[2])*(r[3]==="s"?1e3:1));if(o<1)return{error:`--slow-budget "${e}": a budget is more than 0`};t[jr[r[1]]]=o}return Object.keys(t).length?{budgets:t}:{error:`--slow-budget "${e}": give at least one budget`}}function Yt(e){return e.context===!1?{contextEnabled:!1}:{}}function Cr(e){let t=e.tunnelName;if(t!==void 0){let n=String(t).trim();return!n||/[\u0000-\u001f\u007f]/.test(n)?{error:"--tunnel-name: the name the LT tunnel was started with (--tunnelName)"}:{tunnel:{name:n}}}return{tunnel:e.tunnel===!0?{name:null}:null}}var Pr="--tunnel on a remote run: the remote browsers reach your apps through the LT tunnel on this machine; keep it (and this machine) up until the run ends, or its pages fail to load";function Be(e){return async t=>{let n=await J(e,"explore run");return n.ok?Oe(new S({baseUrl:n.controllerBaseUrl,auth:n.basic,timeoutMs:5e3}),t):null}}async function tr(e){let t=typeof e.project=="string"?e.project:"";if(!t)return null;try{let n=await J(e,"explore run");if(!n.ok)return null;let r=oe(e.env??new ne().getDefaultEnv()??"prod"),o=new Qe(r.tmsBaseUrl,n.basic.username,n.basic.access_key);return await wt((async()=>{try{let c=await o.getProject(t);if(c?.name)return c.name}catch{}return(await o.listProjects()).find(c=>String(c.project_id)===t)?.name??null})(),4e3,()=>null)}catch{return null}}var $r=async(e,t=Be(e))=>{let n=null,r=typeof e.project=="string"?e.project:"",o=he(e,!!e.localOrchestration,r||null),i=null;if(o)try{i=await t(o)}catch{i=null}if(i){let g=Ue(i,typeof e.url=="string"?e.url:"");if(g){for(let a of Ie(g.error,g.next))process.stderr.write(a+`
35
- `);return 2}n=i.target_url??null}let c=await(await import("./explore-run-tty-ZV5XFKZA.js")).setupRunOpts(e,n,await tr(e));return"opts"in c?c.opts:c.code};function Ar(e){if(e.startsWith("RUN_ACTIVE:"))return"watch it (kane-cli explore view) or stop it (kane-cli explore stop) first \u2014 one run per exploration";if(/HyperExecute Secrets does not list/.test(e))return"check the secret's name in HyperExecute Secrets and your variables files, then launch again; or run it here with --local-orchestration";if(/a secret it names is missing|SECRETS_MISSING/.test(e))return"add the missing secret to your variables files (secret: true) and launch again";if(/REMOTE_UNAVAILABLE|503|could not launch the remote run|could not read your HyperExecute secrets|could not push/.test(e))return"try again in a minute, or run it on this machine with --local-orchestration"}async function Or(e,t,n={}){let r=ce(e,t),o=r?Re("explore"):null,i=s=>s,c=null,g=s=>{o?o.emit(i(s)):c?.(i(s))},a=s=>{o?H(i(s)):process.stderr.write(`${s.type}: ${i(s).message}
36
- `)},u=s=>(g({...bt({state:s.state??null,remark:s.remark??null,exitCode:s.exitCode,explorationId:s.explorationId??null,runId:s.runId??null,committed:s.committed??0,pending:s.pending??0,lastSeq:s.lastSeq??0,stopReason:s.stopReason??null,complete:s.complete??!1,runDir:s.runDir??null,error:s.error}),...s.teardown?{teardown:s.teardown}:{},...s.credits?{credits:s.credits}:{},...typeof s.creditsConsumed=="number"?{credits_consumed:s.creditsConsumed}:{},...s.focus?{focus:s.focus}:{},...s.refused?{refused:s.refused}:{},...s.parallelism?{parallelism:s.parallelism}:typeof s.peakParallel=="number"?{peak_parallel:s.peakParallel}:{}}),s.exitCode),l=(s,p)=>(a({type:"error",message:s}),p&&!o&&process.stderr.write(`next: ${p}
37
- `),u({exitCode:2,error:s})),f=typeof e.claimRun=="string"&&e.claimRun?e.claimRun:null;if(f&&!r)return l("--claim-run is the HyperExecute VM's own mode; it never runs on a terminal");let y=Le(e);if("error"in y)return l(y.error,y.next);if(!r){let s=await(n.setup??(p=>$r(p,n.lookupExploration??Be(p))))(e);if(s===null)return 0;if(typeof s=="number")return s;e=s}if(!f&&!(typeof e.url=="string"&&e.url.trim())){let s=he(e,!!e.localOrchestration,typeof e.project=="string"&&e.project?e.project:null),p=null;if(s)try{p=await(n.lookupExploration??Be(e))(s)}catch{p=null}p?.target_url&&(e={...e,url:p.target_url})}if(!f&&!(typeof e.url=="string"&&e.url.trim()))return l("required option '--url <url>' not specified");let I=!!e.localOrchestration||!!f;if(f&&e.localOrchestration)return l("--claim-run is the VM's own mode; it takes no --local-orchestration");if(e.devBundle&&I)return l("--dev-bundle is for a remote run (the default), not --local-orchestration or --claim-run");if(f){let s=String(e.explorationId??"").trim();if(!s)return l("--claim-run needs --exploration-id");let p=await J(e,"explore run --claim-run");if(!p.ok)return l(p.error);let m=String(e.env??new ne().getDefaultEnv()??"prod"),d=await Xt(er(m,p.basic,"",A=>g(A)),s,f,process.env);if(!d.ok)return H(i({type:"error",message:d.error})),d.stopped?u({exitCode:d.exitCode,error:d.error,state:"stopped",remark:W("secrets_missing",d.error),explorationId:s,runId:f}):u({exitCode:d.exitCode,error:d.error,explorationId:s,runId:f});e={...e,...d.opts,env:e.env,username:e.username,accessKey:e.accessKey}}let _=Le(e);if("error"in _)return l(_.error,_.next);let x=_.policy,U={prompt:"",deps:""},R={},N="";try{let s=typeof e.depsText=="string"?e.depsText:lt(e.deps??[]);N=s;let p=ut({prompt:e.prompt??"Explore the app",deps:s},{globalDir:Ne(re,"variables"),localDir:Ne(process.cwd(),".testmuai","variables"),file:e.variablesFile,inline:e.variables,onLoadError:m=>a({type:"warning",message:m})});if("error"in p)return l(p.error);U={prompt:p.prompt,deps:p.deps},R=p.variables}catch(s){return l(`variables: ${s.message}`)}let w=Qt(e.allowDomain??[]);if(U.deps&&w.length===0)return l("--deps needs --allow-domain for every host the app signs in or writes on (e.g. --allow-domain testmuai.com --allow-domain lambdatest.com)");let L=[...new Set([...w,...Qt([String(e.url??"")])])],b=I?String(e.browser??"local"):"remote";if(!I&&e.browser!==void 0&&e.browser!=="local")return l("--browser applies to --local-orchestration; a remote run always uses remote browsers");if(b!=="local"&&b!=="remote")return l(`--browser ${b}: local or remote`);let j=e.hpsRegion;if(j!==void 0&&b!=="remote")return l("--hps-region needs --browser remote");if(j!==void 0&&!ae.includes(j))return l(`--hps-region ${j}: one of ${ae.join(", ")}`);let T=Cr(e);if("error"in T)return l(T.error);if(T.tunnel&&b!=="remote")return l("--tunnel needs remote browsers (a remote run, or --browser remote): a local Chrome already reaches this machine");let D=e.maxParallel??1;if(b==="local"&&D>Se)return l(`--max-parallel ${D}: at most ${Se} browsers run on this machine at once (--browser remote runs up to ${ie})`);if(b==="remote"&&D>ie)return l(`--max-parallel ${D}: at most ${ie} remote browsers at once`);let xe=Lr(e.depthCaps);if("error"in xe)return l(xe.error);let be=Tr(e.slowBudget);if("error"in be)return l(be.error);let Q=Ir(e.allowPost??[],L);if("error"in Q)return l(Q.error);x==="mutating"&&Q.posts.length&&a({type:"warning",code:"allow_post_ignored",message:jt});let Y=new ne,E=e.env??Y.getDefaultEnv()??"prod",O=oe(E),G=new Ye().load(),rr=Y.loadProfileConfig(Y.getActiveProfile()??"default",E)?.project_id??null,C=e.project??G.project_id??rr??null;if(x==="mutating"){let s=Tt(String(e.url??"")),p=Ct(String(e.url??""));o?H(i({type:"warning",code:"policy_mutating",policy:x,host:s,message:p})):process.stderr.write((process.stderr.columns?at(p,process.stderr.columns):p)+`
38
- `);let m=n.mutatingMemory??Pt();if(!r&&!(C&&m.confirmed(C))){let A=await(n.confirmMutating??(async B=>(await import("./explore-run-tty-ZV5XFKZA.js")).confirmMutatingRun({...B,projectName:B.projectName??(B.projectId?await tr({...e,project:B.projectId}):null)})))({host:s,projectId:C,projectName:C===G.project_id?G.project_name??null:null});if(A!==!0)return process.stderr.write(`setup discarded; nothing launched
34
+ `).action(async n=>{process.exitCode=await Nr(n)}),Ut(t),Nt(t),t.command("assurance-job",{hidden:!0}).description("One cut of an exploration into its project's assurance (the controller's job; input from the environment)").action(async()=>{let{runAssuranceJob:n}=await import("./assurance-job-F4L3T4VJ.js");process.exitCode=await n()})}function Ir(e){let t=Number(e);if(!Number.isInteger(t)||t<1||t>65535)throw new Ee("must be an integer 1-65535");return t}function we(e,t){return[...t,e]}function Yt(e){let t=new Set;for(let n of e){let r=n.trim().toLowerCase();if(r){try{r.includes("://")&&(r=new URL(r).hostname)}catch{}r=r.replace(/\/.*$/,"").replace(/^www\./,"").replace(/\.$/,""),r&&t.add(r)}}return[...t]}function Lr(e,t){if(e.some(r=>r.trim()==="*"))return{posts:["*"]};let n=new Set;for(let r of e){let o=r.trim();if(!o)continue;let i=y=>({error:`--allow-post ${JSON.stringify(o)}: ${y}; write it as host/path, e.g. api.example.com/v1/flags`});if(o.includes("://"))return i("no scheme");if(/[?#]/.test(o))return i("no query or fragment (the match is on host and path only)");if(o.includes("*"))return i("no partial wildcards (name the endpoint exactly, or pass a bare * for every POST)");if(/\s/.test(o))return i("no whitespace");let c=o.indexOf("/");if(c<=0)return i("a host followed by a path starting with /");let g=o.slice(0,c).toLowerCase(),a=o.slice(c),u=/^([^:]+?)\.?(?::(\d+))?$/.exec(g);if(!u)return i("an invalid host");let l=u[1],f=u[2]&&u[2]!=="80"&&u[2]!=="443"?`:${u[2]}`:"";if(g=l+f,!t.some(y=>l===y||l.endsWith(`.${y}`)))return i(`host ${l} is outside the run's domains (${t.join(", ")||"none"}); add it with --allow-domain first`);n.add(g+a)}return{posts:[...n]}}function jr(e){if(e===void 0)return{caps:{}};let t={};for(let n of e.split(",").map(r=>r.trim()).filter(Boolean)){let r=/^(\d+):(\d+)$/.exec(n);if(!r)return{error:`--depth-caps "${e}": each entry is depth:cap with whole numbers, e.g. 0:0,1:3,2:1`};t[String(Number(r[1]))]=Number(r[2])}return Object.keys(t).length?{caps:t}:{error:`--depth-caps "${e}": give at least one depth:cap pair`}}var Tr={response:"response_ms",page:"page_ready_ms",step:"step_ms"};function Cr(e){if(e===void 0)return{budgets:{}};let t={};for(let n of e.split(",").map(r=>r.trim()).filter(Boolean)){let r=/^(response|page|step)=(\d+(?:\.\d+)?)(s|ms)$/.exec(n);if(!r)return{error:`--slow-budget "${e}": each entry is response|page|step=<number>s or ms, e.g. response=3s,page=4s,step=2.5s`};let o=Math.round(Number(r[2])*(r[3]==="s"?1e3:1));if(o<1)return{error:`--slow-budget "${e}": a budget is more than 0`};t[Tr[r[1]]]=o}return Object.keys(t).length?{budgets:t}:{error:`--slow-budget "${e}": give at least one budget`}}function Zt(e){return e.context===!1?{contextEnabled:!1}:{}}var Pr="--tunnel on a remote run: the remote browsers reach your apps through the LT tunnel on this machine; keep it (and this machine) up until the run ends, or its pages fail to load";function Be(e){return async t=>{let n=await J(e,"explore run");return n.ok?Oe(new S({baseUrl:n.controllerBaseUrl,auth:n.basic,timeoutMs:5e3}),t):null}}async function rr(e){let t=typeof e.project=="string"?e.project:"";if(!t)return null;try{let n=await J(e,"explore run");if(!n.ok)return null;let r=oe(e.env??new ne().getDefaultEnv()??"prod"),o=new Ye(r.tmsBaseUrl,n.basic.username,n.basic.access_key);return await xt((async()=>{try{let c=await o.getProject(t);if(c?.name)return c.name}catch{}return(await o.listProjects()).find(c=>String(c.project_id)===t)?.name??null})(),4e3,()=>null)}catch{return null}}var $r=async(e,t=Be(e))=>{let n=null,r=typeof e.project=="string"?e.project:"",o=he(e,!!e.localOrchestration,r||null),i=null;if(o)try{i=await t(o)}catch{i=null}if(i){let g=Ue(i,typeof e.url=="string"?e.url:"");if(g){for(let a of Ie(g.error,g.next))process.stderr.write(a+`
35
+ `);return 2}n=i.target_url??null}let c=await(await import("./explore-run-tty-M56I23IF.js")).setupRunOpts(e,n,await rr(e));return"opts"in c?c.opts:c.code};function Ar(e){if(e.startsWith("RUN_ACTIVE:"))return"watch it (kane-cli explore view) or stop it (kane-cli explore stop) first \u2014 one run per exploration";if(/HyperExecute Secrets does not list/.test(e))return"check the secret's name in HyperExecute Secrets and your variables files, then launch again; or run it here with --local-orchestration";if(/a secret it names is missing|SECRETS_MISSING/.test(e))return"add the missing secret to your variables files (secret: true) and launch again";if(/REMOTE_UNAVAILABLE|503|could not launch the remote run|could not read your HyperExecute secrets|could not push/.test(e))return"try again in a minute, or run it on this machine with --local-orchestration"}async function Or(e,t,n={}){let r=ce(e,t),o=r?Re("explore"):null,i=s=>s,c=null,g=s=>{o?o.emit(i(s)):c?.(i(s))},a=s=>{o?H(i(s)):process.stderr.write(`${s.type}: ${i(s).message}
36
+ `)},u=s=>(g({...yt({state:s.state??null,remark:s.remark??null,exitCode:s.exitCode,explorationId:s.explorationId??null,runId:s.runId??null,committed:s.committed??0,pending:s.pending??0,lastSeq:s.lastSeq??0,stopReason:s.stopReason??null,complete:s.complete??!1,runDir:s.runDir??null,error:s.error}),...s.teardown?{teardown:s.teardown}:{},...s.credits?{credits:s.credits}:{},...typeof s.creditsConsumed=="number"?{credits_consumed:s.creditsConsumed}:{},...s.focus?{focus:s.focus}:{},...s.refused?{refused:s.refused}:{},...s.parallelism?{parallelism:s.parallelism}:typeof s.peakParallel=="number"?{peak_parallel:s.peakParallel}:{}}),s.exitCode),l=(s,p)=>(a({type:"error",message:s}),p&&!o&&process.stderr.write(`next: ${p}
37
+ `),u({exitCode:2,error:s})),f=typeof e.claimRun=="string"&&e.claimRun?e.claimRun:null;if(f&&!r)return l("--claim-run is the HyperExecute VM's own mode; it never runs on a terminal");let y=Le(e);if("error"in y)return l(y.error,y.next);if(!r){let s=await(n.setup??(p=>$r(p,n.lookupExploration??Be(p))))(e);if(s===null)return 0;if(typeof s=="number")return s;e=s}if(!f&&!(typeof e.url=="string"&&e.url.trim())){let s=he(e,!!e.localOrchestration,typeof e.project=="string"&&e.project?e.project:null),p=null;if(s)try{p=await(n.lookupExploration??Be(e))(s)}catch{p=null}p?.target_url&&(e={...e,url:p.target_url})}if(!f&&!(typeof e.url=="string"&&e.url.trim()))return l("required option '--url <url>' not specified");let I=!!e.localOrchestration||!!f;if(f&&e.localOrchestration)return l("--claim-run is the VM's own mode; it takes no --local-orchestration");if(e.devBundle&&I)return l("--dev-bundle is for a remote run (the default), not --local-orchestration or --claim-run");if(f){let s=String(e.explorationId??"").trim();if(!s)return l("--claim-run needs --exploration-id");let p=await J(e,"explore run --claim-run");if(!p.ok)return l(p.error);let m=String(e.env??new ne().getDefaultEnv()??"prod"),d=await Jt(tr(m,p.basic,"",A=>g(A)),s,f,process.env);if(!d.ok)return H(i({type:"error",message:d.error})),d.stopped?u({exitCode:d.exitCode,error:d.error,state:"stopped",remark:W("secrets_missing",d.error),explorationId:s,runId:f}):u({exitCode:d.exitCode,error:d.error,explorationId:s,runId:f});e={...e,...d.opts,env:e.env,username:e.username,accessKey:e.accessKey}}let _=Le(e);if("error"in _)return l(_.error,_.next);let x=_.policy,U={prompt:"",deps:""},R={},N="";try{let s=typeof e.depsText=="string"?e.depsText:ut(e.deps??[]);N=s;let p=ct({prompt:e.prompt??"Explore the app",deps:s},{globalDir:Ne(re,"variables"),localDir:Ne(process.cwd(),".testmuai","variables"),file:e.variablesFile,inline:e.variables,onLoadError:m=>a({type:"warning",message:m})});if("error"in p)return l(p.error);U={prompt:p.prompt,deps:p.deps},R=p.variables}catch(s){return l(`variables: ${s.message}`)}let w=Yt(e.allowDomain??[]);if(U.deps&&w.length===0)return l("--deps needs --allow-domain for every host the app signs in or writes on (e.g. --allow-domain testmuai.com --allow-domain lambdatest.com)");let L=[...new Set([...w,...Yt([String(e.url??"")])])],b=I?String(e.browser??"local"):"remote";if(!I&&e.browser!==void 0&&e.browser!=="local")return l("--browser applies to --local-orchestration; a remote run always uses remote browsers");if(b!=="local"&&b!=="remote")return l(`--browser ${b}: local or remote`);let j=e.hpsRegion;if(j!==void 0&&b!=="remote")return l("--hps-region needs --browser remote");if(j!==void 0&&!ae.includes(j))return l(`--hps-region ${j}: one of ${ae.join(", ")}`);let T=ze(e);if("error"in T)return l(T.error);if(T.tunnel&&b!=="remote")return l("--tunnel needs remote browsers (a remote run, or --browser remote): a local Chrome already reaches this machine");let D=e.maxParallel??1;if(b==="local"&&D>Se)return l(`--max-parallel ${D}: at most ${Se} browsers run on this machine at once (--browser remote runs up to ${ie})`);if(b==="remote"&&D>ie)return l(`--max-parallel ${D}: at most ${ie} remote browsers at once`);let xe=jr(e.depthCaps);if("error"in xe)return l(xe.error);let be=Cr(e.slowBudget);if("error"in be)return l(be.error);let Q=Lr(e.allowPost??[],L);if("error"in Q)return l(Q.error);x==="mutating"&&Q.posts.length&&a({type:"warning",code:"allow_post_ignored",message:Tt});let Y=new ne,E=e.env??Y.getDefaultEnv()??"prod",O=oe(E),G=new Ze().load(),nr=Y.loadProfileConfig(Y.getActiveProfile()??"default",E)?.project_id??null,C=e.project??G.project_id??nr??null;if(x==="mutating"){let s=Ct(String(e.url??"")),p=Pt(String(e.url??""));o?H(i({type:"warning",code:"policy_mutating",policy:x,host:s,message:p})):process.stderr.write((process.stderr.columns?lt(p,process.stderr.columns):p)+`
38
+ `);let m=n.mutatingMemory??$t();if(!r&&!(C&&m.confirmed(C))){let A=await(n.confirmMutating??(async B=>(await import("./explore-run-tty-M56I23IF.js")).confirmMutatingRun({...B,projectName:B.projectName??(B.projectId?await rr({...e,project:B.projectId}):null)})))({host:s,projectId:C,projectName:C===G.project_id?G.project_name??null:null});if(A!==!0)return process.stderr.write(`setup discarded; nothing launched
39
39
  `),A===null?130:0;C&&m.remember(C)}}if(!r&&n.afterChecks)return n.afterChecks();let Me=new Set;r||(c=s=>{s.type==="explore_remote_started"?process.stderr.write(q("queued on HyperExecute",` \xB7 run ${String(s.run_id).slice(0,8)}${s.job_link?` \xB7 ${String(s.job_link)}`:""}`,"done")+`
40
40
  `):(s.type==="warning"||s.type==="error")&&process.stderr.write(`${String(s.type)}: ${String(s.message)}
41
41
  `);for(let p of Me)p(s)});let He=(s,p)=>{if(o)H(i({type:"error",message:s}));else for(let m of Ie(i({message:s}).message,p??Ar(s)))process.stderr.write(m+`
42
- `)},v,Ve="";try{let s=await nt({creds:Y,env:E,usernameFlag:e.username,accessKeyFlag:e.accessKey,log:()=>{}});v=s.basicAuth,Ve=String(s.resolvedCreds?.org_id??"")}catch(s){return s instanceof rt&&s.code==="not_authenticated"?l("not authenticated: pass --username/--access-key or run 'kane-cli login'"):l(`auth resolution failed: ${s.message}`)}if(!v)return l("explore needs Basic credentials (username + access key); none resolved");if(!f){let s=he(e,I,C),p=null,m=v;if(s)try{p=await(n.lookupExploration??(A=>Oe(new S({baseUrl:O.controllerBaseUrl,auth:m,timeoutMs:5e3}),A)))(s)}catch{p=null}let d=p?Ue(p,String(e.url??"")):null;if(d)return He(d.error,d.next),u({exitCode:2,error:d.error})}if(n.afterUrlCheck)return n.afterUrlCheck();if(!I){T.tunnel&&g({type:"warning",message:Pr});let s={...er(E,v,Ve,te=>g(te)),terminal:!r},p;if(typeof e.devBundle=="string"&&e.devBundle){let te=(process.env.EXPLORE_DEV_CONTROLLER_URL??"").trim();if(!te)return l("--dev-bundle needs EXPLORE_DEV_CONTROLLER_URL (the controller the VM talks to: the tunnel URL)");if(!kr(e.devBundle))return l(`--dev-bundle ${e.devBundle}: no such file`);p={bundlePath:e.devBundle,controllerUrl:te}}let m=C;if(!m)return l("a remote run needs a project: pass --project <id> or set one (kane-cli config set-project); one project has one exploration");r||process.stderr.write(q("launching on HyperExecute")+`
43
- `);let d=await qt(s,{opts:e,variables:R,depsText:N,prompt:e.prompt??"Explore the app",url:String(e.url),projectId:m,allowedDomains:w,policy:x,...Yt(e),maxParallel:e.maxParallel,maxLeases:e.maxLeases,kaneVersion:M,...p?{dev:p}:{}});if(!d.ok)return He(d.error,d.stopped?"add the missing secret to your variables files (secret: true) or HyperExecute Secrets, then launch again":void 0),d.stopped?u({exitCode:d.exitCode,error:d.error,state:"stopped",remark:W("secrets_missing",d.error),explorationId:d.stopped.explorationId,runId:d.stopped.runId}):u({exitCode:d.exitCode,error:d.error});let A=u({exitCode:0,state:"queued",explorationId:d.explorationId,runId:d.runId});if(r)return A;let{runLiveView:B}=await import("./explore-live-TRY5A2ME.js");return(await B({client:new S({baseUrl:O.controllerBaseUrl,auth:v}),explorationId:d.explorationId,runId:d.runId,mode:"remote",env:E,policy:x})).exitCode}let ye=Ze();if(!ye)return l("v16-runner not found");let De=G.window_size?.width??1280,Ge=G.window_size?.height??800,Fe=C,$,Z={explorationId:null,runId:null};if(b==="remote"){if(E!=="stage"&&E!=="prod")return l(`--browser remote: no remote browsers for env ${E}`);let s;try{s=mt(E,j??null)}catch(m){return l(m.message)}let p=v;i=dt([p.access_key]),$=ht({hpsBase:s,auth:p,forge:ft(O.tmsBaseUrl,p,()=>({exploration_id:Z.explorationId,run_id:Z.runId,project_id:Fe,hx_job_id:tt().jobId??null,kane_version:M,region:j??null,tunnel:!!T.tunnel,tunnel_name:T.tunnel?.name??null})),tunnel:T.tunnel,releaseSync:m=>gt(O.tmsBaseUrl,p,m),onEvent:m=>g({type:"remote_browser",...m})})}else $=ct({launch:ze,width:De,height:Ge,headless:!!e.headless});Xe("explore-browsers",()=>$.releaseAllSync());let P=null,ve=null;try{P=await Mt({controller:{baseUrl:O.controllerBaseUrl,authHeader:K(v.username,v.access_key)},onWarn:s=>g({type:"warning",message:s}),onExploration:s=>{process.stderr.write(ge(s,e.env)+`
44
- `)},onStop:()=>{g({type:"warning",message:"explore stop: the run is stopping cleanly"}),ve?.()}})}catch(s){g({type:"warning",message:`live mode is off for this run: ${s.message}`})}let _e=()=>{},nr=new Promise(s=>{_e=s}),ee=null;r||Me.add(s=>{s.type!=="explore_run_started"||ee||(ee=import("./explore-live-TRY5A2ME.js").then(({runLiveView:p})=>p({client:new S({baseUrl:O.controllerBaseUrl,auth:v}),explorationId:String(s.exploration_id),runId:String(s.run_id),mode:"local",env:E,policy:x,ended:nr})))});try{let s=await _t({url:e.url,prompt:U.prompt,maxLeases:e.maxLeases,explorationId:e.explorationId,...typeof e.claimRunId=="string"?{claimRunId:e.claimRunId}:{requested:Wt({opts:e,url:String(e.url),prompt:e.prompt??"Explore the app",depsText:N,variables:R,allowedDomains:w,policy:x,maxParallel:e.maxParallel,maxLeases:e.maxLeases})},projectId:Fe,policy:x,context:U,variables:R,allowedDomains:w,...Yt(e),allowPosts:x==="read_only"?Q.posts:[],depthCaps:xe.caps,slowBudgets:be.budgets,recheck:e.recheck!==!1,maxParallel:D,...typeof e.focus=="string"?{focus:e.focus}:{},denyNames:(e.deny??[]).map(m=>m.trim()).filter(Boolean),headless:!!e.headless,width:De,height:Ge,auth:v,clientRelease:M},{client:new S({baseUrl:O.controllerBaseUrl,auth:v}),spawnRunner:m=>{let d=et({environment:E,username:v.username,accessKey:v.access_key,sessionId:m});return $.kind==="local"?ke({env:d,runner:ye,sessionId:m}):Nt(ke({env:d,runner:ye}),Ne(re,"sessions",m,"runner-stderr.log"),pt([v.access_key]))},acquireBrowser:async m=>{let d=await $.acquire(m);return P?.onBrowser(m),{cdpEndpoint:d.cdpEndpoint,release:()=>{P?.offBrowser(m),d.release()}}},releaseBrowsersOnInterrupt:$.kind==="remote",frameLink:m=>P?.attachRunner(m),onFrame:(m,d)=>P?.runnerFrame(m,d),onLiveRun:m=>{Z.explorationId=m.explorationId,Z.runId=m.runId,P?.armRun(m)},emit:m=>{let d=i(m);o?o.emit(d):c?.(d),P?.onEvent(d)},baseDir:re,onInterrupt:m=>{ve=m;let d=Mr(m);return()=>{ve=null,d()}}});await $.releaseAll(),await P?.close(s.stopReason??s.remark?.code??"stopped");let p=u(f?{...s,exitCode:xt(s)}:s);return _e(p),ee&&await ee,p}finally{_e(1),await P?.close("stopped"),await $.releaseAll(),Je("explore-browsers")}}var Ur=3e3;async function Nr(e,t={}){let n=t.tty??!ce(e),r=t.out??(w=>{process.stdout.write(w+`
42
+ `)},v,Ve="";try{let s=await ot({creds:Y,env:E,usernameFlag:e.username,accessKeyFlag:e.accessKey,log:()=>{}});v=s.basicAuth,Ve=String(s.resolvedCreds?.org_id??"")}catch(s){return s instanceof nt&&s.code==="not_authenticated"?l("not authenticated: pass --username/--access-key or run 'kane-cli login'"):l(`auth resolution failed: ${s.message}`)}if(!v)return l("explore needs Basic credentials (username + access key); none resolved");if(!f){let s=he(e,I,C),p=null,m=v;if(s)try{p=await(n.lookupExploration??(A=>Oe(new S({baseUrl:O.controllerBaseUrl,auth:m,timeoutMs:5e3}),A)))(s)}catch{p=null}let d=p?Ue(p,String(e.url??"")):null;if(d)return He(d.error,d.next),u({exitCode:2,error:d.error})}if(n.afterUrlCheck)return n.afterUrlCheck();if(!I){T.tunnel&&g({type:"warning",message:Pr});let s={...tr(E,v,Ve,te=>g(te)),terminal:!r},p;if(typeof e.devBundle=="string"&&e.devBundle){let te=(process.env.EXPLORE_DEV_CONTROLLER_URL??"").trim();if(!te)return l("--dev-bundle needs EXPLORE_DEV_CONTROLLER_URL (the controller the VM talks to: the tunnel URL)");if(!Rr(e.devBundle))return l(`--dev-bundle ${e.devBundle}: no such file`);p={bundlePath:e.devBundle,controllerUrl:te}}let m=C;if(!m)return l("a remote run needs a project: pass --project <id> or set one (kane-cli config set-project); one project has one exploration");r||process.stderr.write(q("launching on HyperExecute")+`
43
+ `);let d=await Xt(s,{opts:e,variables:R,depsText:N,prompt:e.prompt??"Explore the app",url:String(e.url),projectId:m,allowedDomains:w,policy:x,...Zt(e),maxParallel:e.maxParallel,maxLeases:e.maxLeases,kaneVersion:M,...p?{dev:p}:{}});if(!d.ok)return He(d.error,d.stopped?"add the missing secret to your variables files (secret: true) or HyperExecute Secrets, then launch again":void 0),d.stopped?u({exitCode:d.exitCode,error:d.error,state:"stopped",remark:W("secrets_missing",d.error),explorationId:d.stopped.explorationId,runId:d.stopped.runId}):u({exitCode:d.exitCode,error:d.error});let A=u({exitCode:0,state:"queued",explorationId:d.explorationId,runId:d.runId});if(r)return A;let{runLiveView:B}=await import("./explore-live-XIWWUV52.js");return(await B({client:new S({baseUrl:O.controllerBaseUrl,auth:v}),explorationId:d.explorationId,runId:d.runId,mode:"remote",env:E,policy:x})).exitCode}let ye=et();if(!ye)return l("v16-runner not found");let De=G.window_size?.width??1280,Ge=G.window_size?.height??800,Fe=C,$,Z={explorationId:null,runId:null};if(b==="remote"){if(E!=="stage"&&E!=="prod")return l(`--browser remote: no remote browsers for env ${E}`);let s;try{s=ft(E,j??null)}catch(m){return l(m.message)}let p=v;i=mt([p.access_key]),$=wt({hpsBase:s,auth:p,forge:gt(O.tmsBaseUrl,p,()=>({exploration_id:Z.explorationId,run_id:Z.runId,project_id:Fe,hx_job_id:rt().jobId??null,kane_version:M,region:j??null,tunnel:!!T.tunnel,tunnel_name:T.tunnel?.name??null})),tunnel:T.tunnel,releaseSync:m=>ht(O.tmsBaseUrl,p,m),onEvent:m=>g({type:"remote_browser",...m})})}else $=pt({launch:Qe,width:De,height:Ge,headless:!!e.headless});Xe("explore-browsers",()=>$.releaseAllSync());let P=null,ve=null;try{P=await Ht({controller:{baseUrl:O.controllerBaseUrl,authHeader:K(v.username,v.access_key)},onWarn:s=>g({type:"warning",message:s}),onExploration:s=>{process.stderr.write(ge(s,e.env)+`
44
+ `)},onStop:()=>{g({type:"warning",message:"explore stop: the run is stopping cleanly"}),ve?.()}})}catch(s){g({type:"warning",message:`live mode is off for this run: ${s.message}`})}let _e=()=>{},or=new Promise(s=>{_e=s}),ee=null;r||Me.add(s=>{s.type!=="explore_run_started"||ee||(ee=import("./explore-live-XIWWUV52.js").then(({runLiveView:p})=>p({client:new S({baseUrl:O.controllerBaseUrl,auth:v}),explorationId:String(s.exploration_id),runId:String(s.run_id),mode:"local",env:E,policy:x,ended:or})))});try{let s=await kt({url:e.url,prompt:U.prompt,maxLeases:e.maxLeases,explorationId:e.explorationId,...typeof e.claimRunId=="string"?{claimRunId:e.claimRunId}:{requested:qt({opts:e,url:String(e.url),prompt:e.prompt??"Explore the app",depsText:N,variables:R,allowedDomains:w,policy:x,maxParallel:e.maxParallel,maxLeases:e.maxLeases})},projectId:Fe,policy:x,context:U,variables:R,allowedDomains:w,...Zt(e),allowPosts:x==="read_only"?Q.posts:[],depthCaps:xe.caps,slowBudgets:be.budgets,recheck:e.recheck!==!1,maxParallel:D,...typeof e.focus=="string"?{focus:e.focus}:{},denyNames:(e.deny??[]).map(m=>m.trim()).filter(Boolean),headless:!!e.headless,width:De,height:Ge,auth:v,clientRelease:M},{client:new S({baseUrl:O.controllerBaseUrl,auth:v}),spawnRunner:m=>{let d=tt({environment:E,username:v.username,accessKey:v.access_key,sessionId:m});return $.kind==="local"?ke({env:d,runner:ye,sessionId:m}):Bt(ke({env:d,runner:ye}),Ne(re,"sessions",m,"runner-stderr.log"),dt([v.access_key]))},acquireBrowser:async m=>{let d=await $.acquire(m);return P?.onBrowser(m),{cdpEndpoint:d.cdpEndpoint,release:()=>{P?.offBrowser(m),d.release()}}},releaseBrowsersOnInterrupt:$.kind==="remote",frameLink:m=>P?.attachRunner(m),onFrame:(m,d)=>P?.runnerFrame(m,d),onLiveRun:m=>{Z.explorationId=m.explorationId,Z.runId=m.runId,P?.armRun(m)},emit:m=>{let d=i(m);o?o.emit(d):c?.(d),P?.onEvent(d)},baseDir:re,onInterrupt:m=>{ve=m;let d=Mr(m);return()=>{ve=null,d()}}});await $.releaseAll(),await P?.close(s.stopReason??s.remark?.code??"stopped");let p=u(f?{...s,exitCode:bt(s)}:s);return _e(p),ee&&await ee,p}finally{_e(1),await P?.close("stopped"),await $.releaseAll(),Je("explore-browsers")}}var Ur=3e3;async function Nr(e,t={}){let n=t.tty??!ce(e),r=t.out??(w=>{process.stdout.write(w+`
45
45
  `)}),o=n?null:Re("explore"),i=String(e.explorationId??"").trim(),c=String(e.project??"").trim(),g=(w,L,b)=>(o?.emit({type:"done",status:L,exit_code:w,exploration_id:i||null,...b?{error:b}:{}}),w),a=(w,L)=>{if(o)H({type:"error",message:w});else{let b=t.err??(j=>{process.stderr.write(j+`
46
- `)});b(`error: ${w}`),L&&b(`next: ${L}`)}return g(2,"error",w)};if(i&&c)return a("--exploration-id or --project, not both","kane-cli explore view --exploration-id <id>");if(!i&&!c)return a("name the exploration: --exploration-id or --project","kane-cli explore list --all names them (or plain kane-cli explore to pick one)");let u=await J(e,"explore view");if(!u.ok)return a(u.error,"kane-cli login");let l=u.basic,f={controllerBaseUrl:u.controllerBaseUrl};if(c){try{i=(await new S({baseUrl:f.controllerBaseUrl,auth:l}).listExplorations({state:"all",project:c})).explorations.find(L=>L.project_id===c)?.exploration_id??""}catch(w){return a(`could not find project ${c}'s exploration: ${w.message}`)}if(!i)return a(`project ${c} has no exploration`,`start one: kane-cli explore run --project ${c} --url <app>`)}let y=K(l.username,l.access_key),I={controllerBaseUrl:f.controllerBaseUrl,authHeader:y,explorationId:i,port:e.port,live:{controller:{baseUrl:f.controllerBaseUrl,authHeader:y}}},_=await Et(I);if(_.kind==="not_found")return a(`exploration ${i} not found`,"kane-cli explore list --all");if(_.kind==="error")return a(`could not read the map: ${_.message}`);let x;try{x=await St(I)}catch(w){return a(`could not bind 127.0.0.1${I.port?`:${I.port}`:""}: ${w.message}`,"pass another --port, or leave it out for the first free one")}let U=t.hold?null:Hr(),R=null;try{R=await new S({baseUrl:f.controllerBaseUrl,auth:l,timeoutMs:Ur}).getContext(i)}catch{}o&&o.emit({type:"explore_view_started",url:x.url,exploration_id:i,context:R});let N=null;if(!o){let w=!t.out&&!!process.stdin.isTTY&&!!process.stdout.isTTY;w&&Zt(x.url),r(q("map viewer ready",` \xB7 ${x.url}`)),r(_r(` ${w?"opened in your browser \xB7 ":""}live when a run is going`)),r("");let L=_.kind==="ok"&&_.body.counts&&typeof _.body.counts=="object"?_.body.counts:null,b=R?`context ${R.enabled?"on":"off"}${R.last_job?` \xB7 ${R.last_job.status}`:""}`:"";for(let j of It({status:q("serving"),meta:["explore",i.slice(0,8),u.environment??""],tallies:[...Lt(L).filter(T=>!T.endsWith("findings")&&!T.endsWith("finding")),...b?[b]:[]],keys:[...w?["o open again"]:[],"ctrl+c stop serving"]}))r(j);w&&!t.hold&&(N=Br(()=>{Zt(x.url)}))}t.onStarted?.(x);try{await(U??t.hold())}finally{N?.()}return await x.close(),g(0,"stopped")}async function Zt(e){try{let{default:t}=await import("./open-MQLQKFAW.js");await t(e)}catch{process.stderr.write(`could not open a browser: open ${e}
47
- `)}}function Br(e){let t=process.stdin;if(!t.isTTY)return()=>{};let n=r=>{let o=r.toString("utf8");o===""?process.kill(process.pid,"SIGINT"):(o==="o"||o==="O")&&e()};return t.setRawMode(!0),t.resume(),t.on("data",n),()=>{t.off("data",n);try{t.setRawMode(!1)}catch{}t.pause()}}function Mr(e){let t=process.listeners("SIGINT");for(let n of t)process.removeListener("SIGINT",n);return process.on("SIGINT",e),()=>{process.removeListener("SIGINT",e);for(let n of t)process.on("SIGINT",n)}}function Hr(){return new Promise(e=>{let t=process.listeners("SIGINT"),n=process.listeners("SIGTERM");process.removeAllListeners("SIGINT"),process.removeAllListeners("SIGTERM");let r=()=>{process.removeListener("SIGINT",r),process.removeListener("SIGTERM",r);for(let o of t)process.on("SIGINT",o);for(let o of n)process.on("SIGTERM",o);e()};process.once("SIGINT",r),process.once("SIGTERM",r)})}function er(e,t,n,r){let o=oe(e);return{env:e,controllerBaseUrl:o.controllerBaseUrl,secretsBaseUrl:o.secretsBaseUrl,tmsBaseUrl:o.tmsBaseUrl,basic:t,orgId:n,emit:r}}export{Rr as a,Er as b,uo as c,Qt as d,Ir as e,Lr as f,Tr as g,Yt as h,Cr as i,Pr as j,Or as k,Ur as l,Nr as m,Mr as n};
46
+ `)});b(`error: ${w}`),L&&b(`next: ${L}`)}return g(2,"error",w)};if(i&&c)return a("--exploration-id or --project, not both","kane-cli explore view --exploration-id <id>");if(!i&&!c)return a("name the exploration: --exploration-id or --project","kane-cli explore list --all names them (or plain kane-cli explore to pick one)");let u=await J(e,"explore view");if(!u.ok)return a(u.error,"kane-cli login");let l=u.basic,f={controllerBaseUrl:u.controllerBaseUrl};if(c){try{i=(await new S({baseUrl:f.controllerBaseUrl,auth:l}).listExplorations({state:"all",project:c})).explorations.find(L=>L.project_id===c)?.exploration_id??""}catch(w){return a(`could not find project ${c}'s exploration: ${w.message}`)}if(!i)return a(`project ${c} has no exploration`,`start one: kane-cli explore run --project ${c} --url <app>`)}let y=K(l.username,l.access_key),I={controllerBaseUrl:f.controllerBaseUrl,authHeader:y,explorationId:i,port:e.port,live:{controller:{baseUrl:f.controllerBaseUrl,authHeader:y}}},_=await St(I);if(_.kind==="not_found")return a(`exploration ${i} not found`,"kane-cli explore list --all");if(_.kind==="error")return a(`could not read the map: ${_.message}`);let x;try{x=await It(I)}catch(w){return a(`could not bind 127.0.0.1${I.port?`:${I.port}`:""}: ${w.message}`,"pass another --port, or leave it out for the first free one")}let U=t.hold?null:Hr(),R=null;try{R=await new S({baseUrl:f.controllerBaseUrl,auth:l,timeoutMs:Ur}).getContext(i)}catch{}o&&o.emit({type:"explore_view_started",url:x.url,exploration_id:i,context:R});let N=null;if(!o){let w=!t.out&&!!process.stdin.isTTY&&!!process.stdout.isTTY;w&&er(x.url),r(q("map viewer ready",` \xB7 ${x.url}`)),r(kr(` ${w?"opened in your browser \xB7 ":""}live when a run is going`)),r("");let L=_.kind==="ok"&&_.body.counts&&typeof _.body.counts=="object"?_.body.counts:null,b=R?`context ${R.enabled?"on":"off"}${R.last_job?` \xB7 ${R.last_job.status}`:""}`:"";for(let j of Lt({status:q("serving"),meta:["explore",i.slice(0,8),u.environment??""],tallies:[...jt(L).filter(T=>!T.endsWith("findings")&&!T.endsWith("finding")),...b?[b]:[]],keys:[...w?["o open again"]:[],"ctrl+c stop serving"]}))r(j);w&&!t.hold&&(N=Br(()=>{er(x.url)}))}t.onStarted?.(x);try{await(U??t.hold())}finally{N?.()}return await x.close(),g(0,"stopped")}async function er(e){try{let{default:t}=await import("./open-MQLQKFAW.js");await t(e)}catch{process.stderr.write(`could not open a browser: open ${e}
47
+ `)}}function Br(e){let t=process.stdin;if(!t.isTTY)return()=>{};let n=r=>{let o=r.toString("utf8");o===""?process.kill(process.pid,"SIGINT"):(o==="o"||o==="O")&&e()};return t.setRawMode(!0),t.resume(),t.on("data",n),()=>{t.off("data",n);try{t.setRawMode(!1)}catch{}t.pause()}}function Mr(e){let t=process.listeners("SIGINT");for(let n of t)process.removeListener("SIGINT",n);return process.on("SIGINT",e),()=>{process.removeListener("SIGINT",e);for(let n of t)process.on("SIGINT",n)}}function Hr(){return new Promise(e=>{let t=process.listeners("SIGINT"),n=process.listeners("SIGTERM");process.removeAllListeners("SIGINT"),process.removeAllListeners("SIGTERM");let r=()=>{process.removeListener("SIGINT",r),process.removeListener("SIGTERM",r);for(let o of t)process.on("SIGINT",o);for(let o of n)process.on("SIGTERM",o);e()};process.once("SIGINT",r),process.once("SIGTERM",r)})}function tr(e,t,n,r){let o=oe(e);return{env:e,controllerBaseUrl:o.controllerBaseUrl,secretsBaseUrl:o.secretsBaseUrl,tmsBaseUrl:o.tmsBaseUrl,basic:t,orgId:n,emit:r}}export{Er as a,Sr as b,co as c,Yt as d,Lr as e,jr as f,Cr as g,Zt as h,Pr as i,Or as j,Ur as k,Nr as l,Mr as m};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $}from"./chunk-7XJNYLQW.js";import{g as D}from"./chunk-DXLZCJH5.js";import{a as E}from"./chunk-4QTH7VYE.js";function U(e){return["completed","failed","ended","stopped"].includes(e.trim().toLowerCase())}function je(e){return["ended","stopped"].includes(e.trim().toLowerCase())}function q(e){return{requestId:e.requestId,objective:e.objective,status:"",turnActive:!1,scenarios:[],thinking:"",thinkingLog:[],chatLog:[],progress:0}}function Re(e){return e.pendingClarification===void 0?e:{...e,pendingClarification:void 0}}function Ce(e){return{...e,turnActive:!0,error:void 0,thinking:"",thinkingLog:[]}}function P(e,t){switch(t.type){case"thinking":return{...e,status:"thinking",thinking:e.thinking+t.delta};case"thinking_done":return{...e,thinkingLog:[...e.thinkingLog,{text:e.thinking,tookMs:t.tookMs}],thinking:""};case"progress":return{...e,progress:t.pct};case"snapshot":return{...e,scenarios:t.data.scenarios,status:t.data.status,headline:t.data.headline??e.headline};case"chat":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}]};case"clarification":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}],pendingClarification:t.text};case"limit":return{...e,limits:{scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit}};case"error":return{...e,error:t.message};case"done":return{...e,status:t.status,turnActive:!1,error:t.status==="failed"&&!e.error?"generation failed":e.error}}}function H(e,t){let n=[],i=e.type??"",d=e.status??"";if(i==="ping")return n;switch(i){case"thinking_token":typeof e.data=="string"&&n.push({type:"thinking",delta:e.data});break;case"thinking_stopped":{let r=e.data??{},o=se(r.time_taken);n.push({type:"thinking_done",text:typeof e.data=="string"?e.data:r.message??"",tookMs:o});break}case"progress":{let r=e.data??{};typeof r.progress=="number"&&n.push({type:"progress",pct:r.progress});break}case"clarification":{let r=e.data??{};typeof r.message=="string"&&n.push({type:"clarification",text:r.message});break}case"chatting_stopped":{let r=e.data??{};typeof r.message=="string"&&r.message.length>0&&n.push({type:"chat",text:r.message});break}case"limit_update":{let r=e.data??{},o=r.test_cases_limit??e.test_cases_limit,p=r.per_scenario_test_cases_limit??e.per_scenario_test_cases_limit;n.push({type:"limit",scenarioLimit:o,perScenarioLimit:p});break}case"error":{let r=typeof e.data=="string"?e.data:e.data?.message??"generation error";n.push({type:"error",message:r});break}case"request_cancelled":return n.push({type:"done",status:"stopped"}),n;case"session_ended":return n.push({type:"done",status:"ended"}),n;default:break}if(Array.isArray(e.scenarios)&&n.push({type:"snapshot",data:{requestId:t,status:d,headline:e.headline,scenarios:e.scenarios}}),d&&U(d)){let r=d.trim().toLowerCase();n.push({type:"done",status:r})}return n}function se(e){if(!e)return;let t=/^([\d.]+)(ms|s)?$/.exec(e.trim());if(!t)return;let n=Number(t[1]);if(Number.isFinite(n))return t[2]==="ms"?Math.round(n):Math.round(n*1e3)}var v=class extends Error{constructor(t){super(t),this.name="AuthError"}},M=class extends Error{constructor(t){super(t),this.name="ForbiddenError"}},I=class extends Error{constructor(t){super(t),this.name="InsufficientCreditsError"}},k=class extends Error{constructor(n,i){super(n);this.cause=i;this.name="TransportError"}};function x(e,t){let n=t?.message??t?.error??`HTTP ${e}`;return e===401?new v(n):e===403?t?.key==="insufficient_credits"?new I(n):new M(n):new k(n)}async function*J(e){let t=e.fetchImpl??fetch,n=e.maxRetries??5,i=e.maxBackoffMs??3e4,d=e.connectTimeoutMs??1e4,r=0,o=!1;for(;;){if(e.signal.aborted)return;let p=new AbortController,a=()=>p.abort();e.signal.addEventListener("abort",a,{once:!0});let c=setTimeout(()=>p.abort(),d),g;try{g=await t(e.url,{method:"GET",headers:{Authorization:await e.authHeader(),Accept:"text/event-stream"},signal:p.signal})}catch(w){if(clearTimeout(c),e.signal.removeEventListener("abort",a),e.signal.aborted)return;if(++r>n)throw new k("SSE connect failed",w);await O(F(r,i));continue}if(clearTimeout(c),!g.ok){e.signal.removeEventListener("abort",a);let w=await oe(g);if(g.status===401&&o){if(++r>n)throw x(401,w);await O(F(r,i));continue}throw x(g.status,w)}if(!g.body)throw e.signal.removeEventListener("abort",a),new k("SSE response had no body");o=!0,r=0;let m=g.body.getReader(),h=new TextDecoder("utf-8"),b="";try{for(;;){if(e.signal.aborted){await m.cancel().catch(()=>{});return}let{done:w,value:s}=await m.read();if(w)break;b+=h.decode(s,{stream:!0});let f;for(;(f=b.indexOf(`
2
+ import{a as $}from"./chunk-ZIHQ5JGB.js";import{g as D}from"./chunk-ULIIYKZB.js";import{a as E}from"./chunk-4QTH7VYE.js";function U(e){return["completed","failed","ended","stopped"].includes(e.trim().toLowerCase())}function je(e){return["ended","stopped"].includes(e.trim().toLowerCase())}function q(e){return{requestId:e.requestId,objective:e.objective,status:"",turnActive:!1,scenarios:[],thinking:"",thinkingLog:[],chatLog:[],progress:0}}function Re(e){return e.pendingClarification===void 0?e:{...e,pendingClarification:void 0}}function Ce(e){return{...e,turnActive:!0,error:void 0,thinking:"",thinkingLog:[]}}function P(e,t){switch(t.type){case"thinking":return{...e,status:"thinking",thinking:e.thinking+t.delta};case"thinking_done":return{...e,thinkingLog:[...e.thinkingLog,{text:e.thinking,tookMs:t.tookMs}],thinking:""};case"progress":return{...e,progress:t.pct};case"snapshot":return{...e,scenarios:t.data.scenarios,status:t.data.status,headline:t.data.headline??e.headline};case"chat":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}]};case"clarification":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}],pendingClarification:t.text};case"limit":return{...e,limits:{scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit}};case"error":return{...e,error:t.message};case"done":return{...e,status:t.status,turnActive:!1,error:t.status==="failed"&&!e.error?"generation failed":e.error}}}function H(e,t){let n=[],i=e.type??"",d=e.status??"";if(i==="ping")return n;switch(i){case"thinking_token":typeof e.data=="string"&&n.push({type:"thinking",delta:e.data});break;case"thinking_stopped":{let r=e.data??{},o=se(r.time_taken);n.push({type:"thinking_done",text:typeof e.data=="string"?e.data:r.message??"",tookMs:o});break}case"progress":{let r=e.data??{};typeof r.progress=="number"&&n.push({type:"progress",pct:r.progress});break}case"clarification":{let r=e.data??{};typeof r.message=="string"&&n.push({type:"clarification",text:r.message});break}case"chatting_stopped":{let r=e.data??{};typeof r.message=="string"&&r.message.length>0&&n.push({type:"chat",text:r.message});break}case"limit_update":{let r=e.data??{},o=r.test_cases_limit??e.test_cases_limit,p=r.per_scenario_test_cases_limit??e.per_scenario_test_cases_limit;n.push({type:"limit",scenarioLimit:o,perScenarioLimit:p});break}case"error":{let r=typeof e.data=="string"?e.data:e.data?.message??"generation error";n.push({type:"error",message:r});break}case"request_cancelled":return n.push({type:"done",status:"stopped"}),n;case"session_ended":return n.push({type:"done",status:"ended"}),n;default:break}if(Array.isArray(e.scenarios)&&n.push({type:"snapshot",data:{requestId:t,status:d,headline:e.headline,scenarios:e.scenarios}}),d&&U(d)){let r=d.trim().toLowerCase();n.push({type:"done",status:r})}return n}function se(e){if(!e)return;let t=/^([\d.]+)(ms|s)?$/.exec(e.trim());if(!t)return;let n=Number(t[1]);if(Number.isFinite(n))return t[2]==="ms"?Math.round(n):Math.round(n*1e3)}var v=class extends Error{constructor(t){super(t),this.name="AuthError"}},M=class extends Error{constructor(t){super(t),this.name="ForbiddenError"}},I=class extends Error{constructor(t){super(t),this.name="InsufficientCreditsError"}},k=class extends Error{constructor(n,i){super(n);this.cause=i;this.name="TransportError"}};function x(e,t){let n=t?.message??t?.error??`HTTP ${e}`;return e===401?new v(n):e===403?t?.key==="insufficient_credits"?new I(n):new M(n):new k(n)}async function*J(e){let t=e.fetchImpl??fetch,n=e.maxRetries??5,i=e.maxBackoffMs??3e4,d=e.connectTimeoutMs??1e4,r=0,o=!1;for(;;){if(e.signal.aborted)return;let p=new AbortController,a=()=>p.abort();e.signal.addEventListener("abort",a,{once:!0});let c=setTimeout(()=>p.abort(),d),g;try{g=await t(e.url,{method:"GET",headers:{Authorization:await e.authHeader(),Accept:"text/event-stream"},signal:p.signal})}catch(w){if(clearTimeout(c),e.signal.removeEventListener("abort",a),e.signal.aborted)return;if(++r>n)throw new k("SSE connect failed",w);await O(F(r,i));continue}if(clearTimeout(c),!g.ok){e.signal.removeEventListener("abort",a);let w=await oe(g);if(g.status===401&&o){if(++r>n)throw x(401,w);await O(F(r,i));continue}throw x(g.status,w)}if(!g.body)throw e.signal.removeEventListener("abort",a),new k("SSE response had no body");o=!0,r=0;let m=g.body.getReader(),h=new TextDecoder("utf-8"),b="";try{for(;;){if(e.signal.aborted){await m.cancel().catch(()=>{});return}let{done:w,value:s}=await m.read();if(w)break;b+=h.decode(s,{stream:!0});let f;for(;(f=b.indexOf(`
3
3
 
4
4
  `))>=0;){let u=b.slice(0,f);b=b.slice(f+2);let l=ie(u);l&&(yield l)}}}catch(w){if(e.signal.aborted)return;if(++r>n)throw new k("SSE stream dropped",w);await O(F(r,i));continue}finally{e.signal.removeEventListener("abort",a)}return}}function ie(e){let t="message",n="";for(let i of e.split(`
5
5
  `))i.startsWith("event:")?t=i.slice(6).trim():i.startsWith("data:")&&(n+=i.slice(5).trim());if(t!=="message"||!n)return null;try{let i=Buffer.from(n,"base64").toString("utf-8");return JSON.parse(i)}catch{return null}}function F(e,t){return Math.min(t,1e3*2**(e-1))}function O(e){return new Promise(t=>setTimeout(t,e))}async function oe(e){try{return await e.clone().json()}catch{return}}function W(e,t){t?.length&&(e.append("files",t.map(n=>n.fileKey).join(",")),e.append("gemini_metadata",JSON.stringify(t.map(n=>({fileData:{fileUri:n.geminiUri,mimeType:n.mimeType}})))))}function Ue(e,t={}){let n=t.fetchImpl??fetch,i=new Map,d=!0;async function r(){let s=await e.authResolver.resolve();if(!s)throw new v("unauthorized; run `kane-cli login`");return E(s.username,s.access_key)}function o(s){return`${e.baseUrl}${s}`}async function p(s){if(!s.ok){let f;try{f=await s.clone().json()}catch{f=void 0}throw x(s.status,f)}return s.json()}function a(s){let f=s?.data??s;return{request_id:f.request_id??f.id,status:f.status??""}}function c(s,f,u,l){let y=q({requestId:s,objective:f});l&&(y=P(y,{type:"snapshot",data:l}),l.status==="cleaned_up"&&(y={...y,error:"session was reaped (cleaned_up) \u2014 continuing will destructively regenerate"}));let S=new AbortController;u&&(u.aborted?S.abort():u.addEventListener("abort",()=>S.abort(),{once:!0})),i.set(s,S);let A={requestId:s,state:y,events:void 0};return A.events=(async function*(){try{let C=J({url:o(`/requests/${s}/sse`),authHeader:r,signal:S.signal,log:e.log,fetchImpl:n});for await(let L of C)for(let z of H(L,s))A.state=P(A.state,z),yield z}finally{i.delete(s)}})(),A}async function g(s,f){let u=new FormData;u.append("prompt",s.prompt),d=s.memoryEnhancement??!0,u.append("memory_enhancement",String(d)),s.scenarioLimit!==void 0&&u.append("test_scenario_limit",String(s.scenarioLimit)),s.perScenarioLimit!==void 0&&u.append("per_scenario_test_cases_limit",String(s.perScenarioLimit));let l=s.projectId??e.projectId,y=s.folderId??e.folderId;l&&u.append("project_id",l),y&&u.append("folder_id",y),W(u,s.attachments);let S=await n(o("/requests"),{method:"POST",headers:{Authorization:await r()},body:u}),A=await p(S),{request_id:C}=a(A),L=String(C);return c(L,s.prompt,f)}async function m(s,f){let u=await n(o(`/requests/${s}`),{method:"GET",headers:{Authorization:await r()}}),l=await p(u),y=l?.data??l,S={requestId:s,status:y.status??"",headline:y.headline,scenarios:Array.isArray(y.scenarios)?y.scenarios:[]};return c(s,"",f,S)}async function h(s,f,u){let l=new FormData;l.append("prompt",f),l.append("chat_enabled","true"),l.append("memory_enhancement",String(d)),u?.mappings&&l.append("mappings",JSON.stringify(u.mappings)),W(l,u?.attachments);let y=await n(o(`/requests/${s}`),{method:"PUT",headers:{Authorization:await r()},body:l});if(!y.ok){let S;try{S=await y.clone().json()}catch{}throw x(y.status,S)}}async function b(s){i.get(s)?.abort();let u=await n(o(`/requests/${s}/stop`),{method:"DELETE",headers:{Authorization:await r()}});if(!u.ok&&u.status!==404){let l;try{l=await u.clone().json()}catch{}throw x(u.status,l)}}async function w(s){i.get(s)?.abort();let u=await n(o(`/requests/${s}/end`),{method:"DELETE",headers:{Authorization:await r()}});if(!u.ok&&u.status!==404){let l;try{l=await u.clone().json()}catch{}throw x(u.status,l)}}return{start:g,attach:m,chat:h,cancel:b,end:w}}import{statSync as ae,realpathSync as G,existsSync as ce}from"fs";import{extname as ue,resolve as j,isAbsolute as pe}from"path";import{homedir as V}from"os";var de=new Set([".txt",".md",".json",".xml",".jpg",".jpeg",".png",".gif",".bmp",".webp",".pdf",".docx",".csv",".xlsx",".mp3",".wav",".m4a",".webm",".mpeg",".mpga",".mp4",".mov"]),le=50*1024*1024,X=10;function fe(e){return e==="~"?V():e.startsWith("~/")?j(V(),e.slice(2)):e}function Ge(e,t){let n=[],i=[],d=new Set,r=[],o=(()=>{try{return G(j(t))}catch{return j(t)}})(),p=o.endsWith("/")?o:o+"/";for(let a of e){let c=fe(a),g=pe(c)?c:j(t,c);if(!ce(g)){n.push(`Not found: ${a}`);continue}let m;try{m=G(g)}catch{n.push(`Cannot resolve: ${a}`);continue}if(d.has(m))continue;let h;try{h=ae(m)}catch{n.push(`Cannot read: ${a}`);continue}if(!h.isFile()){n.push(`Not a file: ${a}`);continue}if(h.size===0){n.push(`Empty file: ${a}`);continue}let b=ue(m).toLowerCase();if(!de.has(b)){n.push(`Unsupported type ${b||"(none)"}: ${a}`);continue}if(h.size>le){n.push(`Too large (>50MB): ${a}`);continue}m!==o&&!m.startsWith(p)&&i.push(`Outside working dir: ${a}`),d.add(m),r.push(m)}return r.length>X&&n.push(`Too many files: ${r.length} (max ${X})`),{ok:n.length?[]:r,errors:n,warnings:i}}var B=class extends Error{constructor(n){super(n.join("; "));this.errors=n;this.name="AttachmentValidationError"}};async function Xe(e){let{promptText:t,filePaths:n,cwd:i,scenarios:d,isRefine:r,conn:o,deps:p}=e,{ok:a,errors:c,warnings:g}=p.validate(n,i);if(c.length)throw new B(c);e.onValidated?.();let m=a.length?await p.upload(o,a,p.onUpload):[],h=r?p.buildMappings(t,d):void 0;return{promptText:t,mappings:h,attachments:m,warnings:g}}import{readFile as me}from"fs/promises";import{basename as K}from"path";async function ge(e){let t=await e.authResolver.resolve();if(!t)throw new v("unauthorized; run `kane-cli login`");return E(t.username,t.access_key)}async function he(e,t,n={}){let i=n.fetchImpl??fetch,d=await me(t),r=K(t),o=new FormData;o.append("file",new Blob([d]),r),o.append("source","omniBox"),o.append("geminiFileUpload","true");let p=await i(`${e.tmsBaseUrl}/v1/attachment`,{method:"POST",headers:{Authorization:await ge(e)},body:o,signal:n.signal});if(!p.ok){let h;try{h=await p.clone().json()}catch{}throw x(p.status,h)}let a=await p.json(),c=a?.data??a,g=c?.gemini_response?.uri,m=c?.gemini_response?.mimeType;if(!c?.file_key||!g){let h=c&&typeof c=="object"?Object.keys(c).join(","):typeof c,b=(()=>{try{return JSON.stringify(c).slice(0,500)}catch{return"<unserializable>"}})();throw new Error(`attachment upload for ${r} returned no file_key/gemini uri \u2014 status ${p.status}, body keys: [${h}], raw: ${b}`)}return{fileName:c.file_name??r,fileKey:c.file_key,geminiUri:g,mimeType:m??"application/octet-stream"}}async function tt(e,t,n,i={}){let d=[];for(let r=0;r<t.length;r++){if(i.signal?.aborted)throw Object.assign(new Error("upload aborted"),{name:"AbortError"});let o=K(t[r]);n?.({file:o,index:r+1,total:t.length,status:"uploading"});try{d.push(await he(e,t[r],i)),n?.({file:o,index:r+1,total:t.length,status:"done"})}catch(p){throw n?.({file:o,index:r+1,total:t.length,status:"failed"}),p}}return d}var ye=/@([sS])(\d+)\.([cC])(\d+)/g,be=/@([sS])(\d+)(?!\d)(?!\.[cC]\d)/g;function rt(e,t){let n={},i={};for(let d of e.matchAll(ye)){let r=Number(d[2]),o=Number(d[4]),p=t[r-1];if(!p)continue;n[`s${r}`]=String(p.id);let a=p.test_cases??[];if(a[o-1])for(let c=0;c<o;c++){let g=a[c];g&&(i[`s${r}.c${c+1}`]=String(g.id))}}for(let d of e.matchAll(be)){let r=Number(d[2]),o=t[r-1];o&&(n[`s${r}`]=String(o.id))}if(!(Object.keys(n).length===0&&Object.keys(i).length===0))return{scenario:n,testcase:i}}function R(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(n==null||typeof n!="object")return[];let i=n;if(typeof i.step!="string")return[];let d=typeof i.expected_result=="string"?i.expected_result:typeof i.outcome=="string"?i.outcome:"";t.push({step:i.step,expected:d})}return t}var we=30,Se=300;function Z(){return{mode:"testing",max_steps:we,timeout:Se,variables:{}}}function Q(e){return e.title??`Test case ${e.id}`}function ct(e,t){return $({frontmatter:Z(),heading:Q(t),steps:e.sub_objectives.map(n=>n.objective)})}function Y(e){let t=R(e.manual_steps).map(n=>n.step);return $({frontmatter:Z(),heading:Q(e),steps:t})}import{mkdtempSync as xe,mkdirSync as N,writeFileSync as ee,rmSync as te,renameSync as _e,existsSync as ne,readFileSync as ve}from"fs";import{join as _,resolve as ke}from"path";async function ft(e,t,n,i=Y){(n.redirectBareCwd??!0)&&ke(t)===process.cwd()&&(t=_(t,".testmuai","tests"));let d=T(e.objective)??e.headline,r=T(n.suiteName)??`${T(re(d,4))??"tcg"}-${e.requestId}`,o=r,p=_(t,r);ne(p)&&!Te(p,e.requestId)&&(o=`${r}-${e.requestId}`);let a=_(t,o),c=[],g=new Map;for(let h of e.scenarios){let b=(h.test_cases??[]).filter(Ae);if(b.length===0)continue;let w=T(Ee(h.scode))??T(h.sid)??`s${h.id}`,s=g.get(w)??new Set;g.set(w,s);for(let f of b){let u=T(re(f.title,5))??"case",l=`${u}_test.md`;for(let y=2;s.has(l);y++)l=`${u}-${y}_test.md`;s.add(l),c.push({dir:w,file:l,tc:f})}}if(c.length===0)return{suiteDir:a,paths:[],warning:"no functional test cases generated"};N(t,{recursive:!0});let m=xe(_(t,".tcg-tmp-"));try{N(_(m,"helpers"),{recursive:!0}),ee(_(m,".tcg-suite.json"),JSON.stringify({requestId:e.requestId,suiteName:o}));let h=[],b=new Set;for(let s of c){let f=_(m,s.dir);b.has(f)||(N(f,{recursive:!0}),b.add(f));let u=_(f,s.file);ee(u,i(s.tc)),h.push(u)}ne(a)&&te(a,{recursive:!0,force:!0}),_e(m,a);let w=h.map(s=>s.replace(m,a));return{suiteDir:a,paths:w}}catch(h){try{te(m,{recursive:!0,force:!0})}catch{}throw h}}function Ae(e){return(e.category??"").trim().toLowerCase()==="functional"}function Te(e,t){try{return JSON.parse(ve(_(e,".tcg-suite.json"),"utf-8"))?.requestId===t}catch{return!1}}function T(e){return e&&e.length>0?e:void 0}function re(e,t){return e?e.toLowerCase().replace(/[^a-z0-9]+/g," ").trim().split(/\s+/).filter(Boolean).slice(0,t).join("-"):""}function Ee(e){return e?e.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""):""}function ht(e){let t=[];e.title&&t.push(e.title),e.description&&t.push("",e.description);let n=R(e.manual_steps);return n.length>0&&(t.push("","Steps:"),n.forEach((i,d)=>{t.push(`${d+1}. ${i.step}`)})),t.join(`