@testmuai/kane-cli 0.10.3 → 0.10.5

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 (425) hide show
  1. package/dist/ChatSurface-WKYH5MYP.js +2 -0
  2. package/dist/ChromeProfilePicker-ROQIRMWR.js +2 -0
  3. package/dist/{CliFeedbackPrompt-JWCTMIGI.js → CliFeedbackPrompt-55OKAT4W.js} +1 -1
  4. package/dist/{CliUploadProgress-XFRRFRL4.js → CliUploadProgress-NK2U3CKQ.js} +1 -1
  5. package/dist/{ConfigView-6JF4DOJN.js → ConfigView-7A5JTKLF.js} +1 -1
  6. package/dist/EvidenceViewOffer-U7J5ZRVK.js +2 -0
  7. package/dist/FolderPicker-R4QDIFTW.js +2 -0
  8. package/dist/InfoBox-SRQ4TSUT.js +2 -0
  9. package/dist/LinksBox-7BWLLQVR.js +2 -0
  10. package/dist/ProfilesView-TQTJR4WQ.js +2 -0
  11. package/dist/ProjectPicker-A5SXNDUL.js +2 -0
  12. package/dist/SaveSessionPrompt-IECYZMXW.js +2 -0
  13. package/dist/SingleShotApp-MN5IE6EU.js +2 -0
  14. package/dist/SummaryBox-WFOS6GON.js +2 -0
  15. package/dist/TestMdRunView-URNSXIVC.js +2 -0
  16. package/dist/TestrunEvidenceTable-SZPZMW3J.js +2 -0
  17. package/dist/{WhoamiView-H7JNLLCY.js → WhoamiView-G6QP4SID.js} +1 -1
  18. package/dist/{app-client-U2YYF65L.js → app-client-2RR5ATI6.js} +1 -1
  19. package/dist/app-download-UGLDWWTX.js +2 -0
  20. package/dist/{assurance-job-F4L3T4VJ.js → assurance-job-V5QB36WJ.js} +1 -1
  21. package/dist/{binary-K3XMILST.js → binary-32FXH6PQ.js} +1 -1
  22. package/dist/bind-3PB77PWJ.js +2 -0
  23. package/dist/bootstrap-A2O4UZUJ.js +2 -0
  24. package/dist/{bridge-2UHJOVLX.js → bridge-SPGIYAAG.js} +1 -1
  25. package/dist/{catalog-YCU6OHNV.js → catalog-P5IOIVYP.js} +1 -1
  26. package/dist/{catalog-client-MVEEHTG2.js → catalog-client-LR2KPSU7.js} +1 -1
  27. package/dist/{changelog-5UB3AQT6.js → changelog-GKIKDJ32.js} +1 -1
  28. package/dist/chat-committer-7E3TRZ6P.js +2 -0
  29. package/dist/chat-controller-5ZBG23L6.js +2 -0
  30. package/dist/child-MNLSG77W.js +2 -0
  31. package/dist/{chunk-5YYCCM6K.js → chunk-2AHQ3D3D.js} +1 -1
  32. package/dist/{chunk-UWPG5MWM.js → chunk-2EKLTUY2.js} +1 -1
  33. package/dist/{chunk-KL7XFNSD.js → chunk-2G7UYQOW.js} +1 -1
  34. package/dist/{chunk-GXQYFOBD.js → chunk-2MBNAW2G.js} +1 -1
  35. package/dist/{chunk-Y2HQMJGS.js → chunk-2NP3THOE.js} +1 -1
  36. package/dist/chunk-37KFCYHG.js +18 -0
  37. package/dist/{chunk-ZHAMVLQZ.js → chunk-3A4KK22B.js} +1 -1
  38. package/dist/{chunk-L3BUPFAQ.js → chunk-3CFAE36M.js} +1 -1
  39. package/dist/{chunk-TU2KPOW2.js → chunk-3DFBFYTD.js} +2 -2
  40. package/dist/{chunk-QE4AWNOV.js → chunk-3RJRCAUX.js} +6 -6
  41. package/dist/chunk-3UY4WPMQ.js +8 -0
  42. package/dist/{chunk-3NWUXRSI.js → chunk-4DM5EWEV.js} +1 -1
  43. package/dist/{chunk-ZMWTRXFH.js → chunk-4DRFMDAW.js} +1 -1
  44. package/dist/{chunk-PI7OXS62.js → chunk-5EAJO372.js} +1 -1
  45. package/dist/{chunk-4KL3TSTT.js → chunk-5K7PCSTP.js} +4 -4
  46. package/dist/{chunk-HV2CDY4K.js → chunk-5LKDOE3P.js} +1 -1
  47. package/dist/{chunk-AT7AT3AR.js → chunk-5OFHMBZC.js} +5 -5
  48. package/dist/{chunk-CQDCNP7V.js → chunk-5ORBAYTU.js} +1 -1
  49. package/dist/{chunk-2TK4MDF2.js → chunk-63BFLTJI.js} +1 -1
  50. package/dist/{chunk-BBJAKSA7.js → chunk-642GD7E6.js} +2 -2
  51. package/dist/{chunk-KKLCXRW6.js → chunk-642LB5R2.js} +1 -1
  52. package/dist/{chunk-Q4SMITTV.js → chunk-66C5A2F5.js} +1 -1
  53. package/dist/{chunk-X6FCXBXU.js → chunk-6FVGPKVX.js} +1 -1
  54. package/dist/{chunk-32HED7X2.js → chunk-6KUUSONE.js} +1 -1
  55. package/dist/{chunk-6FFX4S7N.js → chunk-6OL5EVRC.js} +1 -1
  56. package/dist/{chunk-SXBPUUQ5.js → chunk-6PZ3SVWE.js} +1 -1
  57. package/dist/{chunk-SJQTTEXQ.js → chunk-6VG2FG67.js} +1 -1
  58. package/dist/chunk-6WN4WSXR.js +2 -0
  59. package/dist/{chunk-CB2BWDHG.js → chunk-76MKY7FG.js} +4 -4
  60. package/dist/{chunk-LRNUGKYH.js → chunk-77BZTEHJ.js} +1 -1
  61. package/dist/chunk-7TSM2FCL.js +5 -0
  62. package/dist/{chunk-KQ4XKTIZ.js → chunk-A5C7HIAH.js} +1 -1
  63. package/dist/{chunk-ENRFXGID.js → chunk-ABAUIIPD.js} +1 -1
  64. package/dist/{chunk-JTNEF5ZP.js → chunk-AL6IAMYV.js} +1 -1
  65. package/dist/{chunk-4CJQ7XZP.js → chunk-AXOSLGQ4.js} +1 -1
  66. package/dist/{chunk-CNHKZE4F.js → chunk-BDZWRJAL.js} +1 -1
  67. package/dist/{chunk-VCVEZEVS.js → chunk-BFRWZPIK.js} +1 -1
  68. package/dist/{chunk-IZ66FKPC.js → chunk-BIGOLVK6.js} +1 -1
  69. package/dist/{chunk-Q4ALB7SH.js → chunk-BLHFNL5K.js} +1 -1
  70. package/dist/chunk-BRWCWZE3.js +2 -0
  71. package/dist/{chunk-X7S7IGCV.js → chunk-BXJNL22L.js} +1 -1
  72. package/dist/chunk-BZEW7CSM.js +3 -0
  73. package/dist/{chunk-Z24SD2EJ.js → chunk-C3DMMAFP.js} +1 -1
  74. package/dist/{chunk-DQXQJJOP.js → chunk-C466XER3.js} +2 -2
  75. package/dist/{chunk-BLVDV3QQ.js → chunk-C4UME2PA.js} +1 -1
  76. package/dist/chunk-CBEMXSWF.js +2 -0
  77. package/dist/{chunk-6QCCTZO3.js → chunk-CBPACEYQ.js} +1 -1
  78. package/dist/{chunk-MD3RABID.js → chunk-CJGQFKLJ.js} +1 -1
  79. package/dist/{chunk-YVVFXBT5.js → chunk-CQBLJTDU.js} +1 -1
  80. package/dist/{chunk-X2MDL6S4.js → chunk-CVVUBCB7.js} +1 -1
  81. package/dist/{chunk-35BG2EMW.js → chunk-E3C4OWSD.js} +1 -1
  82. package/dist/{chunk-ERRIDBE7.js → chunk-EIQSXD7B.js} +1 -1
  83. package/dist/{chunk-YPGZ5E4I.js → chunk-EP4WGGMY.js} +1 -1
  84. package/dist/{chunk-GAKBHNC4.js → chunk-EUGFABAS.js} +1 -1
  85. package/dist/{chunk-HBLHKQR7.js → chunk-F4GWIX66.js} +1 -1
  86. package/dist/{chunk-SALZ6WSF.js → chunk-F4XCCOWC.js} +1 -1
  87. package/dist/{chunk-NHGPMYM3.js → chunk-FHULYIG3.js} +1 -1
  88. package/dist/{chunk-7RELCXRW.js → chunk-FKA5SWWF.js} +1 -1
  89. package/dist/{chunk-OCVDMZWB.js → chunk-FLGOQ6Q6.js} +1 -1
  90. package/dist/{chunk-YILRYMMG.js → chunk-FNBHP75S.js} +1 -1
  91. package/dist/{chunk-JBKHX5ES.js → chunk-FOURJ24E.js} +1 -1
  92. package/dist/{chunk-DC5F2ADJ.js → chunk-FOUUD3LI.js} +1 -1
  93. package/dist/{chunk-IEHJG6J4.js → chunk-FP6JCXOS.js} +1 -1
  94. package/dist/{chunk-ZDCXWEQG.js → chunk-GRQKMOKE.js} +1 -1
  95. package/dist/{chunk-XKOVEMVZ.js → chunk-H23ZMHHC.js} +1 -1
  96. package/dist/{chunk-E4GIGM5V.js → chunk-H6IPGZTP.js} +1 -1
  97. package/dist/{chunk-MINDIQET.js → chunk-HBGYEA3O.js} +1 -1
  98. package/dist/{chunk-KBGMQYMD.js → chunk-HHF7AM3D.js} +1 -1
  99. package/dist/{chunk-PCQK62MP.js → chunk-HTJDMLZS.js} +1 -1
  100. package/dist/{chunk-ZPU3WAC4.js → chunk-HY5BBSYX.js} +1 -1
  101. package/dist/{chunk-TM6VLC6V.js → chunk-IPIARGHE.js} +1 -1
  102. package/dist/{chunk-M2E5CPPV.js → chunk-IPXITNFD.js} +1 -1
  103. package/dist/{chunk-NI3TIAD7.js → chunk-IT6M7OMG.js} +1 -1
  104. package/dist/{chunk-Y3RJHWNK.js → chunk-ITG5WMQG.js} +1 -1
  105. package/dist/{chunk-WEJR2V7R.js → chunk-J3XOEMKO.js} +1 -1
  106. package/dist/{chunk-OHGL4GEJ.js → chunk-J3YID4A5.js} +1 -1
  107. package/dist/{chunk-OCMPWCKQ.js → chunk-J44FV6CH.js} +1 -1
  108. package/dist/{chunk-3MD2XLE7.js → chunk-J5D4IGAM.js} +9 -8
  109. package/dist/{chunk-6QH75BPJ.js → chunk-J5QFO7LW.js} +1 -1
  110. package/dist/{chunk-GJXO6FF7.js → chunk-JBUKEIYL.js} +1 -1
  111. package/dist/{chunk-EJGCIGQY.js → chunk-JGQ3VB44.js} +1 -1
  112. package/dist/{chunk-GEZVC4S3.js → chunk-JM6AKCN4.js} +1 -1
  113. package/dist/{chunk-3KY7HHQU.js → chunk-JSSM2TWY.js} +1 -1
  114. package/dist/{chunk-3ZC7GSMM.js → chunk-JVXEAO62.js} +1 -1
  115. package/dist/{chunk-TM45NPWL.js → chunk-JYH7CTF7.js} +1 -1
  116. package/dist/{chunk-YNDELIXL.js → chunk-JZ7GFPKZ.js} +1 -1
  117. package/dist/{chunk-CTHUX7O4.js → chunk-KUSHV5SR.js} +1 -1
  118. package/dist/{chunk-LTPOMMAB.js → chunk-LB5NIDW6.js} +1 -1
  119. package/dist/{chunk-SIHX5FW5.js → chunk-LJKTIKZY.js} +1 -1
  120. package/dist/{chunk-LPJKNX6D.js → chunk-LMOW4NM5.js} +1 -1
  121. package/dist/{chunk-WIVKLNIO.js → chunk-LPJX5L3F.js} +1 -1
  122. package/dist/{chunk-HRIDAK6Y.js → chunk-LWP7E5FU.js} +1 -1
  123. package/dist/{chunk-YWWVF5OU.js → chunk-LXYXCANZ.js} +1 -1
  124. package/dist/{chunk-35WUYKGO.js → chunk-MAQVRBUQ.js} +1 -1
  125. package/dist/{chunk-NPAUSUNM.js → chunk-MBNSCXVK.js} +1 -1
  126. package/dist/{chunk-ZMIKNNO6.js → chunk-MIQ6J5YG.js} +1 -1
  127. package/dist/chunk-MTMHB5LF.js +2 -0
  128. package/dist/{chunk-RNHSULQM.js → chunk-MUL2QFG2.js} +1 -1
  129. package/dist/{chunk-MEBEVHGP.js → chunk-N4XUGIAK.js} +1 -1
  130. package/dist/{chunk-GQAWZEA4.js → chunk-NAUIJF72.js} +1 -1
  131. package/dist/{chunk-PB6RXDWQ.js → chunk-NFDVDEOH.js} +2 -2
  132. package/dist/{chunk-LHJSIHLC.js → chunk-NGBXXBHP.js} +1 -1
  133. package/dist/{chunk-YCVEI7BT.js → chunk-NIBNVPAE.js} +1 -1
  134. package/dist/chunk-NKJRAQ6L.js +6 -0
  135. package/dist/{chunk-OZNYQONA.js → chunk-NNVHWFLI.js} +3 -3
  136. package/dist/{chunk-7SU53QGU.js → chunk-NZ7UCAN6.js} +1 -1
  137. package/dist/{chunk-7V34ZMMS.js → chunk-OKCVG7AG.js} +1 -1
  138. package/dist/{chunk-LZGAFKYH.js → chunk-OMCJD4LH.js} +1 -1
  139. package/dist/{chunk-VO2NNXKR.js → chunk-OPR5XIPT.js} +1 -1
  140. package/dist/{chunk-EZMRWXRT.js → chunk-OVB5GVRB.js} +1 -1
  141. package/dist/{chunk-LV7224DG.js → chunk-PCL2FYPE.js} +1 -1
  142. package/dist/{chunk-AVLYSNEG.js → chunk-PE3CEG6E.js} +1 -1
  143. package/dist/{chunk-MEMXFTLD.js → chunk-PEHVBCXM.js} +1 -1
  144. package/dist/{chunk-6HRNG4CK.js → chunk-PKXWYYVK.js} +1 -1
  145. package/dist/{chunk-YQZ736IQ.js → chunk-PSBR2LVL.js} +1 -1
  146. package/dist/{chunk-R6TFRAMZ.js → chunk-PUNFWBRW.js} +1 -1
  147. package/dist/{chunk-7Y55CO42.js → chunk-PZOQ2IQK.js} +1 -1
  148. package/dist/{chunk-SMGRXKXX.js → chunk-Q4QCSO6Y.js} +1 -1
  149. package/dist/{chunk-TUSG7DIL.js → chunk-QJ5XHVS5.js} +1 -1
  150. package/dist/{chunk-TAY7J5VS.js → chunk-QLGQDNA3.js} +1 -1
  151. package/dist/{chunk-QEM5ZRDN.js → chunk-QRUAI2ST.js} +1 -1
  152. package/dist/{chunk-C4KAPGBS.js → chunk-QWEQ742S.js} +3 -3
  153. package/dist/{chunk-Z47ZEFH7.js → chunk-R6S4EJ5R.js} +1 -1
  154. package/dist/{chunk-WE7HRAGO.js → chunk-RHQLDNZL.js} +1 -1
  155. package/dist/{chunk-3RO2YGKH.js → chunk-RM5ZVDVR.js} +1 -1
  156. package/dist/{chunk-N7IWR45S.js → chunk-RU3SWHRE.js} +1 -1
  157. package/dist/{chunk-OBNVGD5H.js → chunk-S5UITUBB.js} +1 -1
  158. package/dist/chunk-SACFQNUH.js +47 -0
  159. package/dist/{chunk-X45RZIAJ.js → chunk-SDIHDYWT.js} +1 -1
  160. package/dist/{chunk-AHT2ORJT.js → chunk-SFHDRKUX.js} +1 -1
  161. package/dist/{chunk-OTMHCHH6.js → chunk-SLISNOG6.js} +1 -1
  162. package/dist/{chunk-T77LTLAD.js → chunk-SULRMI2J.js} +1 -1
  163. package/dist/{chunk-OOGKX4Y6.js → chunk-TC2PHBPH.js} +1 -1
  164. package/dist/{chunk-HVOXMCKE.js → chunk-TCK7WR3M.js} +1 -1
  165. package/dist/{chunk-FOLUB336.js → chunk-TFSWG7AS.js} +1 -1
  166. package/dist/{chunk-PRBWZXFA.js → chunk-TOOJTCON.js} +6 -6
  167. package/dist/chunk-TPCW5OU5.js +3 -0
  168. package/dist/chunk-U5V3L5QH.js +2 -0
  169. package/dist/{chunk-LXK4B2FE.js → chunk-UJYC2XDD.js} +1 -1
  170. package/dist/chunk-UV7FPIBL.js +2 -0
  171. package/dist/{chunk-23DKB2MT.js → chunk-UVL6XQHU.js} +1 -1
  172. package/dist/{chunk-M7A66MSK.js → chunk-UWEBI76C.js} +1 -1
  173. package/dist/{chunk-PTLOOVV4.js → chunk-UWQ4KXLB.js} +1 -1
  174. package/dist/{chunk-ZCBOHWN3.js → chunk-V24LUINK.js} +1 -1
  175. package/dist/{chunk-ND6OP3O2.js → chunk-V3IWCGZT.js} +1 -1
  176. package/dist/{chunk-YDB72F4K.js → chunk-V4SL74TK.js} +1 -1
  177. package/dist/chunk-VEE2O524.js +34 -0
  178. package/dist/{chunk-VKVYT6KZ.js → chunk-VJRXJJML.js} +2 -2
  179. package/dist/{chunk-NRAPCFI2.js → chunk-VKIUHHNT.js} +2 -2
  180. package/dist/{chunk-QHH42RH5.js → chunk-W3PQMIXE.js} +1 -1
  181. package/dist/{chunk-LLQWEGXD.js → chunk-W5EDS4DF.js} +1 -1
  182. package/dist/{chunk-LUA25RYS.js → chunk-WAC5WISH.js} +1 -1
  183. package/dist/{chunk-W54BX6HC.js → chunk-WCIRLITM.js} +1 -1
  184. package/dist/chunk-WMXBRC4B.js +21 -0
  185. package/dist/{chunk-RQKMSNEU.js → chunk-WTMCDYR3.js} +1 -1
  186. package/dist/{chunk-DXIQVBMI.js → chunk-WZ3FE5MT.js} +1 -1
  187. package/dist/{chunk-GLM5UGTF.js → chunk-X66NIHT4.js} +1 -1
  188. package/dist/{chunk-B7ZX5HEN.js → chunk-XDAFRUAJ.js} +1 -1
  189. package/dist/{chunk-JNPFEBUR.js → chunk-XDAHKZ4J.js} +1 -1
  190. package/dist/chunk-XJV5SF3X.js +26 -0
  191. package/dist/{chunk-ZCL7XIVS.js → chunk-XKJZG4GR.js} +1 -1
  192. package/dist/{chunk-EBJW6POT.js → chunk-XRJH4UF3.js} +1 -1
  193. package/dist/chunk-XTQUCCJH.js +2 -0
  194. package/dist/chunk-Y3RDLUH5.js +7 -0
  195. package/dist/{chunk-SVIIUKJ2.js → chunk-Y7GSOKXS.js} +1 -1
  196. package/dist/{chunk-UJ37XGSP.js → chunk-YF22VTR5.js} +3 -3
  197. package/dist/chunk-YIBLZIXF.js +13 -0
  198. package/dist/{chunk-2JFRN62I.js → chunk-YLI7DQMJ.js} +2 -2
  199. package/dist/chunk-YQXOD7SV.js +102 -0
  200. package/dist/{chunk-4UX5N7YI.js → chunk-YTWBNACA.js} +1 -1
  201. package/dist/{chunk-KCXLRR3Q.js → chunk-YUFXE6WU.js} +1 -1
  202. package/dist/{chunk-SSOUYKVG.js → chunk-ZIRSTOEV.js} +1 -1
  203. package/dist/command-span-HZSKIZH7.js +2 -0
  204. package/dist/commands-TRAUFCRZ.js +2 -0
  205. package/dist/{committer-UO3B3S5Y.js → committer-L2HXEODA.js} +1 -1
  206. package/dist/{config-7WTZPMAH.js → config-O3BWQUP4.js} +1 -1
  207. package/dist/cover-cmd-SAWVP7TL.js +2 -0
  208. package/dist/{credentials-5WIFF5DG.js → credentials-NNNODDXF.js} +1 -1
  209. package/dist/{deps-bundle-BLLJ2BQ4.js → deps-bundle-CXKBCA7W.js} +1 -1
  210. package/dist/{deps-resolve-WQ6J6RLI.js → deps-resolve-K7XNTRZX.js} +1 -1
  211. package/dist/design-chat-S4KYE6PP.js +2 -0
  212. package/dist/{design-committer-7YIPFKMO.js → design-committer-ZKNW5LUS.js} +1 -1
  213. package/dist/design-headless-DDAFAJNR.js +2 -0
  214. package/dist/design-remote-UITWJ72Q.js +3 -0
  215. package/dist/device-env-SBTHFSVK.js +2 -0
  216. package/dist/dispatch-BGH5PVZ4.js +2 -0
  217. package/dist/doctor-SRMLENYN.js +2 -0
  218. package/dist/{docx-convert-DO5AQYD3.js → docx-convert-PA5S2S7P.js} +1 -1
  219. package/dist/{dossier-5XKNAK6Q.js → dossier-B6KBSRJY.js} +1 -1
  220. package/dist/evidence-FOWW3MOS.js +2 -0
  221. package/dist/evolve-cmd-MDK2H4JY.js +2 -0
  222. package/dist/evolve-remote-4G7YFC5H.js +2 -0
  223. package/dist/exit-manager-UZ7DGXS4.js +2 -0
  224. package/dist/{explain-cmd-KNDORU2D.js → explain-cmd-A5YMPXAJ.js} +1 -1
  225. package/dist/explain-cmd-Q4NLNJFB.js +12 -0
  226. package/dist/explore-MWUMVGRM.js +2 -0
  227. package/dist/explore-context-tty-QLMZGYBX.js +2 -0
  228. package/dist/explore-entry-QMCVGRP4.js +6 -0
  229. package/dist/{explore-live-XIWWUV52.js → explore-live-QIET6WO4.js} +1 -1
  230. package/dist/{explore-run-tty-M56I23IF.js → explore-run-tty-6UTBRCEF.js} +2 -2
  231. package/dist/{extract-bind-LZ22VFKB.js → extract-bind-UTERWZMW.js} +3 -3
  232. package/dist/extract-chat-4WBNRVPG.js +2 -0
  233. package/dist/{extract-cmd-46E2XDWZ.js → extract-cmd-SYZX6CML.js} +2 -2
  234. package/dist/extract-headless-QBF77JWP.js +2 -0
  235. package/dist/{feeder-NGWIPZ26.js → feeder-VAY4NYBX.js} +1 -1
  236. package/dist/folder-flags-IJ556UET.js +2 -0
  237. package/dist/gaps-cmd-E55OGZ7P.js +3 -0
  238. package/dist/gate-5UIJVMHL.js +2 -0
  239. package/dist/gate-VJ7W5QIH.js +2 -0
  240. package/dist/{generate-headless-HXAVEAEZ.js → generate-headless-VYD2QIUO.js} +3 -3
  241. package/dist/hold-passthrough-ZHOC2Q26.js +2 -0
  242. package/dist/identity-66TGWITQ.js +2 -0
  243. package/dist/{impact-cmd-TJTUFAFO.js → impact-cmd-3P6SKFJC.js} +2 -2
  244. package/dist/index.js +185 -184
  245. package/dist/ingest-6UQGSQYU.js +2 -0
  246. package/dist/ingest-cmd-HMTLO5MB.js +8 -0
  247. package/dist/ingest-remote-NIW5VAGW.js +2 -0
  248. package/dist/install-KJDAGU2R.js +2 -0
  249. package/dist/{interactive-bind-SOD7VTAY.js → interactive-bind-K3ZQFHLH.js} +4 -4
  250. package/dist/{interactive-remote-7ZSTI66T.js → interactive-remote-SGM76D6M.js} +2 -2
  251. package/dist/lane-EHU4JRRU.js +2 -0
  252. package/dist/lattice-auth-DCAVEQKY.js +2 -0
  253. package/dist/lifecycle-cmd-Y5DH2PL5.js +2 -0
  254. package/dist/list-cmd-RYHICCUV.js +3 -0
  255. package/dist/list-commands-QFTIQE6Q.js +2 -0
  256. package/dist/{list-remote-EFCET42K.js → list-remote-PWAQBF57.js} +1 -1
  257. package/dist/{locks-cmd-AZKCSGHI.js → locks-cmd-76IU4JB7.js} +1 -1
  258. package/dist/{logical-ids-74PLU3VR.js → logical-ids-YMNV2MDB.js} +1 -1
  259. package/dist/login-flow-W7RAVXSD.js +2 -0
  260. package/dist/maintenance-cmd-JNP2KCSI.js +2 -0
  261. package/dist/mobile-prompts-SP2RULD7.js +2 -0
  262. package/dist/onboarding-YPIKXNYA.js +5 -0
  263. package/dist/open-provider-LXCPVNUU.js +2 -0
  264. package/dist/{pdf-convert-YB6PJFMI.js → pdf-convert-N2C3KB4Q.js} +1 -1
  265. package/dist/persist-recorded-session-BWGA7WXR.js +3 -0
  266. package/dist/phase-seed-G5JSYKSL.js +2 -0
  267. package/dist/pipeline-YE4IRKQX.js +2 -0
  268. package/dist/{policy-commands-4PUGESCW.js → policy-commands-MSJIPHDB.js} +1 -1
  269. package/dist/prepare-target-G7LU4LYX.js +2 -0
  270. package/dist/pull-cmd-G3PVSSFP.js +2 -0
  271. package/dist/pull-route-5JQUUSU7.js +2 -0
  272. package/dist/readmodel-FARAAPUU.js +2 -0
  273. package/dist/real-device-run-425XK527.js +2 -0
  274. package/dist/reconcile-cmd-QJBYZVUB.js +5 -0
  275. package/dist/reconcile-deps-TILDRCHG.js +2 -0
  276. package/dist/{reconcile-remote-3W6ZTO3G.js → reconcile-remote-JMV26DLX.js} +2 -2
  277. package/dist/recording-banner-VZ67EWWQ.js +2 -0
  278. package/dist/registry-3YMKU5GC.js +2 -0
  279. package/dist/remote-entry-6LQRYR5F.js +2 -0
  280. package/dist/remote-mode-35BQUMEL.js +4 -0
  281. package/dist/remote-words-QXVFVHOB.js +2 -0
  282. package/dist/{require-project-folder-3DTI2CVB.js → require-project-folder-O2XCXDRE.js} +1 -1
  283. package/dist/resolve-run-intent-QCRZPYXM.js +2 -0
  284. package/dist/{resolver-CDF7QKVD.js → resolver-LWXOB7PH.js} +1 -1
  285. package/dist/revert-F6MKJ73M.js +2 -0
  286. package/dist/review-cmd-PYU7YCAC.js +5 -0
  287. package/dist/run-EABFRFOF.js +2 -0
  288. package/dist/run-LX3ARF53.js +2 -0
  289. package/dist/run-remote-PS45MTHW.js +2 -0
  290. package/dist/run-startup-gate-YBQB2JLF.js +2 -0
  291. package/dist/run-test-md-XYOCVA6F.js +20 -0
  292. package/dist/session-worker.js +2 -2
  293. package/dist/{sessions-cmd-TLUITRG5.js → sessions-cmd-WUWZYZJW.js} +2 -2
  294. package/dist/{sessions-remote-INO7AWKB.js → sessions-remote-4J7ITZB4.js} +1 -1
  295. package/dist/{skill-installer-7JH5QCJF.js → skill-installer-54ZAFNOB.js} +1 -1
  296. package/dist/store-2F26FIUS.js +2 -0
  297. package/dist/store-choice-ZE7AZMRC.js +2 -0
  298. package/dist/store-guard-X5FIEZWZ.js +2 -0
  299. package/dist/{store-site-K5NHLI7D.js → store-site-AFXB6SBW.js} +1 -1
  300. package/dist/{stream-warnings-GM7YEOVG.js → stream-warnings-I5LUWVFU.js} +1 -1
  301. package/dist/support-id-RISKXA53.js +2 -0
  302. package/dist/sync-cmd-TAVE44DU.js +2 -0
  303. package/dist/sync-setup-M65RX34Y.js +2 -0
  304. package/dist/tcg-generate-OXZF7TNQ.js +2 -0
  305. package/dist/{test-definition-53XNBEDE.js → test-definition-GXEKFRRB.js} +1 -1
  306. package/dist/testmd-actions-4OHRME2Z.js +2 -0
  307. package/dist/{testmd-sync-LYHEXWCT.js → testmd-sync-HM24JCS7.js} +1 -1
  308. package/dist/token-refresh-3SEDPIXO.js +2 -0
  309. package/dist/{use-case-ref-44BPIP4N.js → use-case-ref-E3PJDHQB.js} +1 -1
  310. package/dist/{validate-basic-66XDPA3S.js → validate-basic-HWDR665U.js} +1 -1
  311. package/dist/verdicts-KB6YTIY6.js +2 -0
  312. package/dist/{version-check-SHNVYTMU.js → version-check-DRE5KT7F.js} +1 -1
  313. package/dist/{view-cmd-QOB3O6YW.js → view-cmd-3UKV3YEX.js} +1 -1
  314. package/dist/walk-session-W6OLG5NT.js +2 -0
  315. package/dist/with-telemetry-BF4BGK5S.js +2 -0
  316. package/package.json +11 -11
  317. package/dist/ChatSurface-Z26BOE5U.js +0 -2
  318. package/dist/ChromeProfilePicker-ODRIAXL3.js +0 -2
  319. package/dist/EvidenceViewOffer-6344EX74.js +0 -2
  320. package/dist/FolderPicker-4PCYHE75.js +0 -2
  321. package/dist/InfoBox-NJ2DL7YC.js +0 -2
  322. package/dist/LinksBox-HNDNFVUT.js +0 -2
  323. package/dist/ProfilesView-DEJKJOHY.js +0 -2
  324. package/dist/ProjectPicker-DTWMWOH7.js +0 -2
  325. package/dist/SaveSessionPrompt-3GCLB3ZT.js +0 -2
  326. package/dist/SingleShotApp-HMOXO5DW.js +0 -2
  327. package/dist/SummaryBox-7PPDMSSM.js +0 -2
  328. package/dist/TestMdRunView-QLKRUU4V.js +0 -2
  329. package/dist/TestrunEvidenceTable-T2JUB4TE.js +0 -2
  330. package/dist/app-download-GKRF2EIM.js +0 -2
  331. package/dist/bind-SSHAZAB3.js +0 -2
  332. package/dist/bootstrap-XGKU4WXB.js +0 -2
  333. package/dist/chat-committer-ZKEKJA2R.js +0 -2
  334. package/dist/chat-controller-FXRJXUG3.js +0 -2
  335. package/dist/child-JHYENXE7.js +0 -2
  336. package/dist/chunk-2RBMQTYS.js +0 -26
  337. package/dist/chunk-5F5IVART.js +0 -8
  338. package/dist/chunk-6SD4XTYC.js +0 -6
  339. package/dist/chunk-7YV2FCN4.js +0 -3
  340. package/dist/chunk-A2DODRHG.js +0 -2
  341. package/dist/chunk-BJO6J5X2.js +0 -3
  342. package/dist/chunk-DIOK3SER.js +0 -34
  343. package/dist/chunk-DREQ3RAA.js +0 -2
  344. package/dist/chunk-HC6VLPUB.js +0 -5
  345. package/dist/chunk-J4FIESTB.js +0 -2
  346. package/dist/chunk-NZJSGINB.js +0 -47
  347. package/dist/chunk-SXRHKXSE.js +0 -2
  348. package/dist/chunk-UJLULWSR.js +0 -21
  349. package/dist/chunk-ULIIYKZB.js +0 -7
  350. package/dist/chunk-UXGMKRS4.js +0 -102
  351. package/dist/chunk-VO66KP2W.js +0 -2
  352. package/dist/chunk-X52YIWGG.js +0 -13
  353. package/dist/chunk-ZIHQ5JGB.js +0 -18
  354. package/dist/commands-JBFLLT7A.js +0 -2
  355. package/dist/cover-cmd-DU6ZYJFL.js +0 -2
  356. package/dist/design-chat-ZICGVYIH.js +0 -2
  357. package/dist/design-headless-HYWZIIDS.js +0 -2
  358. package/dist/design-remote-HPX4VZ63.js +0 -3
  359. package/dist/device-env-4P4GUVBW.js +0 -2
  360. package/dist/dispatch-BV6XMCN3.js +0 -2
  361. package/dist/doctor-Z2YQ2DBX.js +0 -2
  362. package/dist/evidence-BJIID6VT.js +0 -2
  363. package/dist/evolve-cmd-GZCUSCEK.js +0 -2
  364. package/dist/evolve-remote-LILOAHYH.js +0 -2
  365. package/dist/exit-manager-EGWAZHCR.js +0 -2
  366. package/dist/explain-cmd-LXIVHGN7.js +0 -12
  367. package/dist/explore-SA2P3SGX.js +0 -2
  368. package/dist/explore-context-tty-PERKIWXD.js +0 -2
  369. package/dist/explore-entry-E6EY3VV3.js +0 -6
  370. package/dist/extract-chat-Z64LEAJ5.js +0 -2
  371. package/dist/extract-headless-XLS56LMN.js +0 -2
  372. package/dist/folder-flags-ZIDJVDKX.js +0 -2
  373. package/dist/gaps-cmd-XYOBJVTO.js +0 -3
  374. package/dist/gate-AK44VDHC.js +0 -2
  375. package/dist/gate-NB5CJMTN.js +0 -2
  376. package/dist/hold-passthrough-JGHWMYDM.js +0 -2
  377. package/dist/identity-HL5CJJXR.js +0 -2
  378. package/dist/ingest-ZHHHBUXR.js +0 -2
  379. package/dist/ingest-cmd-OJSKTSQK.js +0 -8
  380. package/dist/ingest-remote-2WM6PYUW.js +0 -2
  381. package/dist/install-JBWBF3WX.js +0 -2
  382. package/dist/lane-CNGO7LH5.js +0 -2
  383. package/dist/lattice-auth-UQPFQSG7.js +0 -2
  384. package/dist/lifecycle-cmd-DGIO3VAO.js +0 -2
  385. package/dist/list-cmd-HQIN3HX4.js +0 -3
  386. package/dist/list-commands-OFRRBU3D.js +0 -2
  387. package/dist/login-flow-SYKXXDLH.js +0 -2
  388. package/dist/maintenance-cmd-X5247RSJ.js +0 -2
  389. package/dist/mobile-prompts-I66ENBDW.js +0 -2
  390. package/dist/onboarding-6HIP3KW6.js +0 -5
  391. package/dist/open-provider-XDJKT3W3.js +0 -2
  392. package/dist/persist-recorded-session-RSSMTVF3.js +0 -3
  393. package/dist/phase-seed-ZZSJME7M.js +0 -2
  394. package/dist/pipeline-NTJDH5TC.js +0 -2
  395. package/dist/prepare-target-AI3GGZF6.js +0 -2
  396. package/dist/pull-cmd-NRVB5ZN7.js +0 -2
  397. package/dist/pull-route-FWCZW76M.js +0 -2
  398. package/dist/readmodel-TRV4E3MW.js +0 -2
  399. package/dist/real-device-run-NQ7RNH7C.js +0 -2
  400. package/dist/reconcile-cmd-7B7THAFJ.js +0 -5
  401. package/dist/reconcile-deps-UDQBWSLE.js +0 -2
  402. package/dist/recording-banner-WVDTWTSE.js +0 -2
  403. package/dist/registry-PFOSXOIH.js +0 -2
  404. package/dist/remote-entry-BZU4NFNS.js +0 -2
  405. package/dist/remote-mode-NXUKDUXG.js +0 -4
  406. package/dist/remote-words-JRDDNOZ6.js +0 -2
  407. package/dist/resolve-run-intent-QCL7QXIB.js +0 -2
  408. package/dist/revert-QKHPCRT6.js +0 -2
  409. package/dist/review-cmd-XBK3TGRE.js +0 -5
  410. package/dist/run-CSYGVV3D.js +0 -2
  411. package/dist/run-YUHHD54J.js +0 -2
  412. package/dist/run-remote-SFR3F2T5.js +0 -2
  413. package/dist/run-startup-gate-QSFJRYUY.js +0 -2
  414. package/dist/run-test-md-ZSREINDQ.js +0 -20
  415. package/dist/store-X4UK4AP7.js +0 -2
  416. package/dist/store-choice-27HDIFTU.js +0 -2
  417. package/dist/store-guard-ZXKB5DQH.js +0 -2
  418. package/dist/sync-cmd-2PCO7LZA.js +0 -2
  419. package/dist/sync-setup-5WQO73Y5.js +0 -2
  420. package/dist/tcg-generate-DGJD5KSM.js +0 -2
  421. package/dist/testmd-actions-XE2JPQHB.js +0 -2
  422. package/dist/token-refresh-E4FTJVHY.js +0 -2
  423. package/dist/verdicts-PVB7TV5S.js +0 -2
  424. package/dist/walk-session-WIEROYOT.js +0 -2
  425. package/dist/with-telemetry-T2PWI5CY.js +0 -2
@@ -0,0 +1,47 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as kr,c as Rr,d as Er,e as Sr,f as Ir}from"./chunk-EIQSXD7B.js";import{a as _r,b as Lr,c as jr,d as Tr,e as Cr}from"./chunk-JVXEAO62.js";import{c as Vr}from"./chunk-RU3SWHRE.js";import{c as z,d as Pe,f as Pr,g as $r,k as Mr,l as me,m as fe,q as Y,v as Hr}from"./chunk-SLISNOG6.js";import{b as Te,d as le}from"./chunk-ZUZ6QJRA.js";import{a as de,b as L}from"./chunk-KGNE5CIM.js";import{a as mr,b as fr}from"./chunk-BFRWZPIK.js";import{b as Ce,c as gr,d as hr,e as xr,f as ue,g as ce,h as wr,i as br,j as yr,k as vr,m as w,n as Q,o as Br,p as Ae,q as Oe,r as Ue,s as Ne}from"./chunk-MIQ6J5YG.js";import{e as J,l as pe,n as $e,q as Ar,r as Or,s as Ur,t as Nr}from"./chunk-MBNSCXVK.js";import{d as je,f as D}from"./chunk-TC2PHBPH.js";import{a as cr,b as dr}from"./chunk-TPCW5OU5.js";import{a as lr}from"./chunk-66C5A2F5.js";import{l as pr}from"./chunk-AXOSLGQ4.js";import{a as ur}from"./chunk-UTM7D4PI.js";import{a as sr,b as Le,d as ir}from"./chunk-Y3RDLUH5.js";import{b as or}from"./chunk-PCL2FYPE.js";import{e as tr}from"./chunk-FLGOQ6Q6.js";import{b as rr}from"./chunk-F2F257PU.js";import{e as nr}from"./chunk-SB26HQO7.js";import{a as er}from"./chunk-FCD3NYOM.js";import{a as ar}from"./chunk-PVN64537.js";import{b as Se}from"./chunk-BZEW7CSM.js";import{g as Ie}from"./chunk-CBEMXSWF.js";import{a as X}from"./chunk-4QTH7VYE.js";import{a as ae}from"./chunk-V24LUINK.js";import{a as ie}from"./chunk-JYH7CTF7.js";import{A as ze,a as V,b as se}from"./chunk-BRWCWZE3.js";import{m as Qe,n as Ye}from"./chunk-WMXBRC4B.js";import{a as q}from"./chunk-RZ4F3BHX.js";import{a as Ze}from"./chunk-FOJHSG5M.js";import{join as De}from"path";function Dr(e){let r=e.now??Date.now,n=r(),t=!1,o=null,i=null,u=e.hxJobId,h=0,a=null,c=l=>({exploration_id:l?.explorationId??o,run_id:l?.runId??i});return{observe:l=>{switch(l.type){case"explore_run_started":typeof l.exploration_id=="string"&&(o=l.exploration_id),typeof l.run_id=="string"&&(i=l.run_id);return;case"explore_remote_started":typeof l.run_id=="string"&&(i=l.run_id),typeof l.hx_job_id=="string"&&(u=l.hx_job_id);return;case"lease_end":h++;return;case"explore_end":l.totals&&typeof l.totals=="object"&&(a=l.totals);return;default:return}},started:()=>t,markStarted:()=>{t=!0},startFields:()=>({...c(),remote:e.remote,on_vm:e.onVm,hx_job_id:u,policy:e.policy,max_parallel:e.maxParallel,max_leases:e.maxLeases}),endFields:l=>({...c(l),remote:e.remote,on_vm:e.onVm,hx_job_id:u,outcome:l.state==="queued"?"queued":l.remark?.code??(l.exitCode===0?"completed":"error"),stop_reason:l.stopReason??null,exit_code:l.exitCode,duration_ms:r()-n,leases:typeof a?.leases=="number"?a.leases:h,findings:typeof a?.findings=="number"?a.findings:null,committed:l.committed??0,pending:l.pending??0,complete:l.complete??!1,credits_total:l.credits?.total??null,peak_parallel:l.peakParallel??null}),errorFields:l=>{if(l.exitCode===0||l.exitCode===3&&!l.error)return null;let f=l.remark?.code?.startsWith("failed:")?l.remark.code:l.exitCode===2?"usage":l.stopReason??"explore_error";return{...c(l),error_code:f,exit_code:l.exitCode,stage:t?"run":"setup",...l.error?{error:l.error}:{}}}}}import{appendFileSync as dt,mkdirSync as pt}from"fs";import{dirname as mt}from"path";function Fr(e,r,n){if(r)try{pt(mt(r),{recursive:!0})}catch{}let t="",o=u=>{if(!(!r||!u))try{dt(r,n(u))}catch{}};e.child.stderr?.on("data",u=>{t+=u.toString();let h=t.lastIndexOf(`
3
+ `);h<0||(o(t.slice(0,h+1)),t=t.slice(h+1))}),e.child.stderr?.on("end",()=>{o(t),t=""});let i=e.getStderr.bind(e);return Object.assign(e,{getStderr:()=>n(i())})}var ft={seeding:"seeding",replay:"replaying",walking:"walking",settling:"settling",verifying:"verifying"},gt=8,ht=6,S=e=>typeof e=="string"&&e?e:null,F=e=>typeof e=="number"&&Number.isFinite(e)?e:null,ge=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(r={}){this.now=r.now??Date.now}snapshot(){return structuredClone(this.s)}subscribe(r){return this.subs.add(r),()=>{this.subs.delete(r)}}end(r){this.s.status!=="ended"&&(this.s.status="ended",this.s.stop_reason=r,this.s.browsers=[],this.changed())}apply(r){this.reduce(r)&&this.changed()}changed(){if(this.s.version+=1,this.s.updated_at=this.now(),!this.subs.size)return;let r=this.snapshot();for(let n of this.subs)try{n(r)}catch{}}browser(r,n){let t=this.s.browsers.find(o=>o.worker===r)??null;return!t&&n&&(t={worker:r,state:"opening",since:this.now(),lease:null,step:null,steps:[],trail:[],held:null},this.s.browsers.push(t),this.s.browsers.sort((o,i)=>o.worker-i.worker)),t}setState(r,n){r.state!==n&&(r.state=n,r.since=this.now())}reduce(r){let n=F(r.worker_index);switch(r.type){case"explore_start":return this.s.run_id=S(r.run_id),this.s.exploration_id=S(r.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 t=this.s.browsers.length;return this.s.browsers=this.s.browsers.filter(o=>o.worker!==n),this.s.browsers.length!==t}case"lease_start":{if(n===null||!S(r.lease_id))return!1;let t=this.browser(n,!0),o=r.reach&&typeof r.reach=="object"&&!Array.isArray(r.reach)?r.reach:null;return t.lease={id:String(r.lease_id),kind:String(r.kind??""),target:S(r.target),reach:o,started_at:this.now()},t.step=null,t.steps=[],this.setState(t,"starting"),!0}case"lease_step":{if(n===null)return!1;let t=this.browser(n,!1);if(!t||!t.lease||t.lease.id!==r.lease_id)return!1;let o={ordinal:F(r.ordinal)??t.steps.length,phase:String(r.phase??""),intent:S(r.intent),junction_id:S(r.junction_id),known:r.known===!0,url_pattern:S(r.url_pattern),flow_id:S(r.flow_id),navigated:r.navigated===!0,at:this.now()};return t.step=o,t.steps=[...t.steps,o].slice(-gt),o.junction_id&&t.trail[t.trail.length-1]!==o.junction_id&&(t.trail=[...t.trail,o.junction_id].slice(-ht)),this.setState(t,ft[o.phase]??"walking"),!0}case"lease_end":{let t=this.s.browsers.find(o=>o.lease?.id===r.lease_id);return t?(t.lease=null,t.step=null,t.steps=[],this.setState(t,t.held?"holding":"idle"),!0):!1}case"session_held":{if(n===null)return!1;let t=this.browser(n,!0);return t.held={kind:String(r.kind??""),start_flow:S(r.start_flow),junction_id:S(r.junction_id),url_pattern:S(r.url_pattern)},t.lease||this.setState(t,"holding"),!0}case"session_released":{if(n===null)return!1;let t=this.browser(n,!1);return!t||!t.held?!1:(t.held=null,t.lease||this.setState(t,"idle"),!0)}case"progress":return this.s.progress={frontier:F(r.frontier)??0,visited:F(r.visited)??0,active_workers:F(r.active_workers)??0,elapsed_s:F(r.elapsed_s)??0},!0;case"explore_control":return r.control!=="stop"||this.s.status!=="running"?!1:(this.s.status="paused",!0);case"explore_end":return this.s.status="ended",this.s.stop_reason=S(r.stop_reason),this.s.browsers=[],!0;default:return!1}}};var he=class{link=null;wanted=new Map;source=async(r,n)=>(this.wanted.set(r,n),this.link?.start(r),{stop:async()=>{this.wanted.get(r)===n&&(this.wanted.delete(r),this.link?.stop(r))}});attach(r){if(this.link=r,r)for(let n of this.wanted.keys())r.start(n)}frame(r,n){this.wanted.get(r)?.(n)}};var xt=500,wt=1e4,Gr=5e3,bt=async(e,r)=>{let n=new AbortController,t=()=>n.abort(),o=setTimeout(t,r.timeoutMs);r.signal.addEventListener("abort",t,{once:!0});try{let i=await q(e,{method:"POST",headers:r.headers,body:r.body,signal:n.signal}),u=null;try{u=await i.json()}catch{}return{status:i.status,body:u}}finally{clearTimeout(o),r.signal.removeEventListener("abort",t)}},xe=class{constructor(r){this.opts=r;this.post=r.post??bt,this.unsubscribeModel=r.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(r){this.off||(this.letAllGo(),this.abort.abort(),this.abort=new AbortController,this.stateInFlight=!1,this.target=r,this.framesOff=!1,this.stateDirty=!0,this.sendState())}async close(){this.off=!0,this.unsubscribeModel(),this.clearTimers(),this.letAllGo(),this.abort.abort()}url(r,n=""){let t=this.target;return`${t.baseUrl.replace(/\/+$/,"")}${n}/exploration/${encodeURIComponent(t.explorationId)}/runs/${encodeURIComponent(t.runId)}/live/${r}`}stateChanged(){if(this.off||!this.target||(this.stateDirty=!0,this.stateInFlight||this.stateTimer))return;let r=xt-(Date.now()-this.lastStateAt);r<=0?this.sendState():this.stateTimer=setTimeout(()=>{this.stateTimer=null,this.sendState()},r)}sendState(){if(this.off||!this.target||this.stateInFlight)return;let r=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:r.authHeader,"Content-Type":"application/json"},body:n,timeoutMs:Gr,signal:this.abort.signal}).then(t=>{if(this.target===r){if(t.status===404||t.status===403||t.status===401)return this.turnOff(t.status);t.status>=200&&t.status<300&&(this.stopIfAsked(t.body),this.follow(t.body))}},()=>{}).finally(()=>{this.target!==r||this.off||(this.stateInFlight=!1,this.heartbeat=setTimeout(()=>{this.heartbeat=null,this.stateDirty=!0,this.sendState()},wt),this.stateDirty&&this.stateChanged())})}turnOff(r){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 ${r})`))}stopIfAsked(r){this.stopAsked||!r||typeof r!="object"||r.stop!==!0||(this.stopAsked=!0,this.opts.onStop?.())}follow(r){let n=r&&typeof r=="object"?r.watched:void 0;if(!Array.isArray(n)||this.framesOff)return;let t=new Set(n.filter(o=>Number.isInteger(o)&&o>=0));for(let o of[...this.watched.keys()])t.has(o)||this.letGo(o);for(let o of t)this.watched.has(o)||this.watched.set(o,this.opts.frames.subscribe(new Map([[o,jr]]),i=>this.frame(i)))}frame(r){r.kind!=="frame"||this.off||!this.watched.has(r.worker)||(this.waiting.set(r.worker,{data:r.data,at:r.at}),this.sendFrame(r.worker))}sendFrame(r){if(this.sending.has(r)||!this.target)return;let n=this.waiting.get(r);if(n===void 0)return;this.waiting.delete(r);let t=this.target;this.sending.add(r);let o=Number.isFinite(n.at)?`&at=${Math.round(n.at)}`:"";this.post(`${this.url("frames","/public")}?worker=${r}${o}`,{headers:{"X-Live-Token":t.liveToken,"Content-Type":"image/jpeg"},body:Buffer.from(n.data,"base64"),timeoutMs:Gr,signal:this.abort.signal}).then(i=>{this.target===t&&(i.status===410?this.letGo(r):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===t&&(this.sending.delete(r),!this.off&&this.watched.has(r)&&this.sendFrame(r))})}letGo(r){let n=this.watched.get(r);this.watched.delete(r),this.waiting.delete(r),n?.()}letAllGo(){for(let r of[...this.watched.keys()])this.letGo(r);this.sending.clear()}clearTimers(){this.stateTimer&&clearTimeout(this.stateTimer),this.heartbeat&&clearTimeout(this.heartbeat),this.stateTimer=this.heartbeat=null}};function we(e,r){return`watch live: kane-cli explore view --exploration-id ${e}${r?` --env ${r}`:""}`}async function Kr(e){let r=new ge,n=new he,t=new Lr({start:e.startSource??n.source}),o=new xe({model:r,frames:t,post:e.post,onWarn:e.onWarn,onStop:e.onStop}),i=!1,u=!1,h=!1;return{model:r,frames:t,onBrowser(a){u||t.addBrowser(a)},offBrowser(a){t.removeBrowser(a)},attachRunner(a){n.attach(u?null:a)},runnerFrame(a,c){u||n.frame(a,c)},onEvent(a){r.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(!u){if(!a.liveToken){h||e.onWarn?.("live view is off for this run: the controller handed out no live token"),h=!0;return}o.arm({...e.controller,explorationId:a.explorationId,runId:a.runId,liveToken:a.liveToken})}},async close(a){u||(u=!0,await o.close(),n.attach(null),r.end(a),await t.close())}}}import{readFileSync as vt}from"fs";import{basename as _t}from"path";import{randomUUID as Qr}from"crypto";function Be(e){let r=[];for(let[n,t]of Object.entries(e)){if(t.type==="parameter")continue;let o=n.replace(/^(secrets\.user\.|global\.|environment\.)/,"");r.push({name:o,secret:!!t.secret,value:String(t.value??"")})}return r}async function Wr(e,r){if(r.activeRun){let c=null;try{c=await r.activeRun()}catch{c=null}if(c)return{ok:!1,error:`RUN_ACTIVE: run ${c.runId} is ${c.state} on exploration ${c.explorationId}; stop it or wait for it to end`}}let n=e.variables.filter(c=>c.secret),t=e.variables.filter(c=>!c.secret),o=[["LT_USERNAME",e.login.username],["LT_ACCESS_KEY",e.login.accessKey],...n.map(c=>[c.name,c.value])];for(let[c,l]of o){if(e.dev?.skipPush===c){e.onNote?.(`dev: not pushing secret ${c} (KANE_EXPLORE_DEV_SKIP_SECRET_PUSH)`);continue}try{await r.pushSecret(c,l)}catch(f){return{ok:!1,error:`could not push secret ${c} to HyperExecute Secrets: ${Z(f)}`}}}for(let c of t)try{await r.upsertGlobal(c.name,c.value)}catch(l){return{ok:!1,error:`could not push variable ${c.name} to Test Manager: ${Z(l)}`}}let i=o.map(([c])=>c);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 u;try{u=await r.hxSecretNames(i)}catch(c){return{ok:!1,error:`could not read your HyperExecute secrets to check them: ${Z(c)}`}}let h=i.filter(c=>!u.includes(c));if(h.length)return{ok:!1,error:`HyperExecute Secrets does not list ${h.join(", ")} after the push; the VM would run without ${h.length===1?"it":"them"}`};return a();async function a(){let c=e.body;if(e.devBundle)try{let{kane_version:l,...f}=e.body;c={...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 r.remoteRun({...c,variables:e.variables.map(f=>({name:f.name,secret:f.secret}))})}}catch(l){if(l instanceof de&&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 qr(e,r,n){let t={Authorization:X(r.username,r.accessKey),Accept:"application/json"},o=new URLSearchParams({username:r.username});for(let a of n)o.append("secretKey",a);let i=await q(`${e}/logistics/v1.0/all-secrets/list?${o}`,{method:"GET",headers:t});if(i.status===404&&(i=await q(`${e}/logistics/v1.0/secrets/list/${encodeURIComponent(r.username)}`,{method:"GET",headers:t})),!i.ok)throw new Error(`HTTP ${i.status}`);let u=null;try{u=await i.json()}catch{u=null}let h=yt(u);return n.filter(a=>h.has(a))}function yt(e){let r=new Set,n=e&&typeof e=="object"?e:{},t=Array.isArray(n.Data)?n.Data:Array.isArray(n.data)?n.data:Array.isArray(e)?e:[];for(let o of t)if(typeof o=="string")r.add(o);else if(o&&typeof o=="object"){let i=o,u=i.key??i.secretKey??i.Key??i.name;typeof u=="string"&&r.add(u)}return r}var Xr=["allowDomain","deny","allowPost","depthCaps","slowBudget","recheck","focus","hpsRegion","tunnel","tunnelName"];function Me(e,r){let n={};r&&(n.deps=r);for(let t of Xr){let o=e[t];o===void 0||Array.isArray(o)&&!o.length||(n[t]=o)}return n}function Jr(e){let r=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 t of Xr)r[t]!==void 0&&(n[t]=r[t]);return typeof r.deps=="string"&&r.deps&&(n.depsText=r.deps),n}function zr(e,r){let n={},t=[];for(let o of e){if(!o.secret){n[o.name]={value:"",secret:!1};continue}let i=r[o.name];if(!i||i.includes("${{.secrets.")){t.push(o.name);continue}n[o.name]={value:i,secret:!0}}return t.length?{ok:!1,missing:t}:{ok:!0,variables:n}}function Z(e){return e instanceof Error?e.message:String(e)}function Yr(e){let r=Be(e.variables).map(n=>({name:n.name,secret:n.secret}));return{url:e.url,prompt:e.prompt,policy:e.policy??pe,...r.length?{variables:r}:{},...e.maxParallel?{max_parallel:e.maxParallel}:{},...e.maxLeases?{max_leases:e.maxLeases}:{},args:Me({...e.opts,allowDomain:e.allowedDomains},e.depsText)}}function kt(e){let r={},n=(e.KANE_EXPLORE_DEV_SKIP_SECRET_PUSH??"").trim();return n&&(r.skipPush=n),(e.KANE_EXPLORE_DEV_SKIP_SECRET_CHECK??"").trim()==="1"&&(r.skipCheck=!0),r}async function Rt(e,r){let n=vt(r),t=new er(e.controllerBaseUrl,{username:e.basic.username,accessKey:e.basic.access_key}),o=`${Qr()}-${_t(r)}`,u=(await t.getPresignedUrls("explore-dev",Qr(),[{key:"bundle",content_type:"application/gzip",filename:o}])).urls.bundle;if(!u)throw new Error("the presign reply named no URL for the bundle");return await ur(u.upload_url,n,"application/gzip"),u.blob_url}function Et(e){return{project_id:e.projectId,url:e.url,prompt:e.prompt,policy:e.policy??pe,...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:Me(e.opts,e.depsText),kane_version:e.kaneVersion}}async function Zr(e,r){let n=new L({baseUrl:e.controllerBaseUrl,auth:e.basic}),t=new cr(e.secretsBaseUrl),o=new dr(e.tmsBaseUrl,e.basic.username,e.basic.access_key),i={username:e.basic.username,accessKey:e.basic.access_key},u=Et(r),h=r.dev,a=await Wr({variables:Be(r.variables),login:i,body:u,...h?{dev:kt(process.env),onNote:c=>e.emit({type:"warning",message:c}),devBundle:async()=>({bundle_url:await Rt(e,h.bundlePath),controller_url:h.controllerUrl})}:{}},{pushSecret:(c,l)=>t.pushSecret({secretKey:c,secretValue:l,username:i.username,accessKey:i.accessKey,orgId:e.orgId}),upsertGlobal:async(c,l)=>{await o.upsertVariable({name:c,value:l})},hxSecretNames:c=>qr(e.secretsBaseUrl,i,c),remoteRun:c=>n.remoteRun(c),activeRun:async()=>{if(!r.projectId)return null;let l=(await n.listExplorations({state:"running",project:r.projectId,limit:1})).explorations.find(f=>f.project_id===r.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(r.contextEnabled===!1&&Sr(a.error))return{ok:!1,error:Er,exitCode:2};let c=/could not launch/.test(a.error)||a.error.startsWith("RUN_ACTIVE:");return{ok:!1,error:a.error,exitCode:c?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:u.policy??pe}),r.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
+ `),a.reply.job_link&&process.stderr.write(`job: ${a.reply.job_link}
5
+ `),process.stderr.write(we(a.reply.exploration_id,e.env)+`
6
+ `)),{ok:!0,explorationId:a.reply.exploration_id,runId:a.reply.run_id}}async function et(e,r,n,t){let o=new L({baseUrl:e.controllerBaseUrl,auth:e.basic}),i;try{i=await o.runRequest(r,n)}catch(l){let f=l instanceof de?l.code:"";return{ok:!1,error:`could not read run ${n}'s request${f?` (${f})`:""}: ${l.message}`,exitCode:2,stopped:!1}}let u=i.requested&&typeof i.requested=="object"?i.requested:{},h=Array.isArray(u.variables)?u.variables:[],a=zr(h,t);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=J("secrets_missing",l);try{let y=await o.startRun(r,{run_id:n,sessions:1,client_release:V});await o.endRun(r,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:{...Jr({...u,url:u.url??i.target_url,prompt:u.prompt??i.prompt}),explorationId:r,claimRunId:n,variables:JSON.stringify(a.variables)}}}import{existsSync as Tt}from"fs";function be(e,r,n){let t=typeof e.explorationId=="string"?e.explorationId.trim():"";return t&&r?{explorationId:t}:n?{projectId:n}:null}function rt(e){let r=e.trim();try{let n=new URL(r);return`${n.protocol}//${n.host}${n.pathname.replace(/\/+$/,"")}${n.search}${n.hash}`}catch{return r.replace(/\/+$/,"").toLowerCase()}}function St(e,r){return rt(e)===rt(r)}var It=10;async function He(e,r){let n;for(let t=0;t<It;t++){let o=await e.listExplorations({state:"all",limit:100,...n?{cursor:n}:{},..."projectId"in r?{project:r.projectId}:{}}),i=o.explorations.find(u=>"projectId"in r?u.project_id===r.projectId:u.exploration_id===r.explorationId);if(i)return i;if(!o.next_cursor)return null;n=o.next_cursor}return null}function Lt(e){return`use a new --project for another site, or kane-cli explore delete ${e} first`}function Ve(e,r){let n=e.target_url??"";return!n||!r.trim()||St(n,r)?null:{error:`--url ${r.trim()} is not exploration ${e.exploration_id}'s URL (${n}): one exploration per project explores one URL`,next:Lt(e.exploration_id)}}var jt=e=>Ze.hex(ze.dim)(e),Ct=`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
+ `,Pt=`
8
+ One project has one exploration, of one URL: a re-run takes the exploration's
9
+ URL, and a different --url is refused (use a new --project for another site,
10
+ or kane-cli explore delete <id> first).
11
+
12
+ Examples:
13
+ # a project's first run, on HyperExecute (exits once the run is queued)
14
+ $ kane-cli explore run --project <id> --url https://example.com \\
15
+ --prompt "Explore checkout"
16
+ # run again: the URL is the project's exploration's
17
+ $ kane-cli explore run --project <id> --max-leases 40
18
+ # a read-only run on this machine
19
+ $ kane-cli explore run --project <id> --policy read_only --local-orchestration
20
+ # a local app, through your LT tunnel (start LT first)
21
+ $ kane-cli explore run --project <id> --url http://localhost:3000 \\
22
+ --tunnel-name dev
23
+ `;function tt(e){let r=Number(e);if(!Number.isInteger(r)||r<1)throw new Te("must be a positive integer");return r}function yo(e){let r=e.command("explore").description("Explore an app into a map of its screens and flows").enablePositionalOptions().option("--exploration-id <id>",Q({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>",Oe).option("--username <user>",Ue).option("--access-key <key>",Ne).option("--agent",Ae).configureHelp({sortSubcommands:!0,...fe([{title:"Target",flags:["--exploration-id"]},{title:"Output",flags:["--agent","--help"]},{title:"Account",flags:["--env","--username","--access-key"]}])}).addHelpText("after",`
24
+ On a terminal, plain \`kane-cli explore\` opens the project picker, then the
25
+ exploration's card (run again, watch, stop, map, sessions, context, delete);
26
+ with --agent or a pipe it prints this help. Each command's --help lists its
27
+ options, grouped, with their values, defaults and examples.
28
+ `).action(async(n,t)=>{if(t.args.length>0&&t.error(`error: unknown command '${t.args[0]}'`,{exitCode:2}),me(n,Mr()))return t.help();let{runExploreEntryAction:o}=await import("./explore-entry-QMCVGRP4.js");process.exitCode=await o(n)});r.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>",w("url")).option("--project <id>",w("project")).option("--exploration-id <id>",w("explorationId")).option("--prompt <text>",w("prompt"),"Explore the app").option("--max-leases <n>",w("maxLeases"),tt).option("--max-parallel <n>",w("maxParallel"),tt).option("--depth-caps <depth:cap,\u2026>",w("depthCaps")).option("--slow-budget <spec>",w("slowBudget")).option("--no-recheck",w("recheck")).option("--policy <policy>",w("policy")).option("--allow-domain <host>",w("allowDomain"),ye,[]).option("--deny <name>",w("deny"),ye,[]).option("--allow-post <host/path>",w("allowPost"),ye,[]).option("--focus <screen>",w("focus")).option("--local-orchestration",w("localOrchestration")).option("--browser <where>",w("browser"),"local").option("--headless",w("headless")).option("--tunnel",w("tunnel")).option("--tunnel-name <name>",w("tunnelName")).option("--deps <text>",w("deps"),ye,[]).option("--variables <json>",w("variables")).option("--variables-file <path>",w("variablesFile")).option("--no-context",w("context")).option("--agent",w("agent")).option("--env <name>",w("env")).option("--username <user>",w("username")).option("--access-key <key>",w("accessKey")).addOption(new le("--claim-run <run-id>","On a HyperExecute VM: take over this queued run (the job's own command; needs --exploration-id)").hideHelp()).addOption(new le("--dev-bundle <tgz>","Dev only: the VM installs this kane-cli bundle and talks to EXPLORE_DEV_CONTROLLER_URL").hideHelp()).addOption(new le("--hps-region <region>",`With remote browsers on prod: the regional host (${ce.join(", ")})`).hideHelp()).configureHelp(fe(Br())).addHelpText("after",Pt).configureOutput({outputError:(n,t)=>t(/\'--setup(?:-check)?(?:=|\')/.test(n)?Ct:n)}).action(async n=>{process.exitCode=await Vt(n)}),r.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>",Q({purpose:"The exploration to view",values:"an id from kane-cli explore list --all"})).option("--project <id>",Q({purpose:"View this project's exploration instead (a project has one)",values:"a project id"})).option("--port <n>",Q({purpose:"The port on 127.0.0.1",values:"1-65535",dflt:"the first free of 7420-7429"}),$t).option("--agent",Ae).option("--env <name>",Oe).option("--username <user>",Ue).option("--access-key <key>",Ne).configureHelp(fe([{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
+ Name the exploration with --exploration-id or --project, not both.
30
+
31
+ Examples:
32
+ $ kane-cli explore view --project <id>
33
+ $ kane-cli explore view --exploration-id <id> --port 7430
34
+ `).action(async n=>{process.exitCode=await Ft(n)}),Hr(r),Vr(r),r.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-V5QB36WJ.js");process.exitCode=await n()})}function $t(e){let r=Number(e);if(!Number.isInteger(r)||r<1||r>65535)throw new Te("must be an integer 1-65535");return r}function ye(e,r){return[...r,e]}function nt(e){let r=new Set;for(let n of e){let t=n.trim().toLowerCase();if(t){try{t.includes("://")&&(t=new URL(t).hostname)}catch{}t=t.replace(/\/.*$/,"").replace(/^www\./,"").replace(/\.$/,""),t&&r.add(t)}}return[...r]}function At(e,r){if(e.some(t=>t.trim()==="*"))return{posts:["*"]};let n=new Set;for(let t of e){let o=t.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 u=o.indexOf("/");if(u<=0)return i("a host followed by a path starting with /");let h=o.slice(0,u).toLowerCase(),a=o.slice(u),c=/^([^:]+?)\.?(?::(\d+))?$/.exec(h);if(!c)return i("an invalid host");let l=c[1],f=c[2]&&c[2]!=="80"&&c[2]!=="443"?`:${c[2]}`:"";if(h=l+f,!r.some(y=>l===y||l.endsWith(`.${y}`)))return i(`host ${l} is outside the run's domains (${r.join(", ")||"none"}); add it with --allow-domain first`);n.add(h+a)}return{posts:[...n]}}function Ot(e){if(e===void 0)return{caps:{}};let r={};for(let n of e.split(",").map(t=>t.trim()).filter(Boolean)){let t=/^(\d+):(\d+)$/.exec(n);if(!t)return{error:`--depth-caps "${e}": each entry is depth:cap with whole numbers, e.g. 0:0,1:3,2:1`};r[String(Number(t[1]))]=Number(t[2])}return Object.keys(r).length?{caps:r}:{error:`--depth-caps "${e}": give at least one depth:cap pair`}}var Ut={response:"response_ms",page:"page_ready_ms",step:"step_ms"};function Nt(e){if(e===void 0)return{budgets:{}};let r={};for(let n of e.split(",").map(t=>t.trim()).filter(Boolean)){let t=/^(response|page|step)=(\d+(?:\.\d+)?)(s|ms)$/.exec(n);if(!t)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(t[2])*(t[3]==="s"?1e3:1));if(o<1)return{error:`--slow-budget "${e}": a budget is more than 0`};r[Ut[t[1]]]=o}return Object.keys(r).length?{budgets:r}:{error:`--slow-budget "${e}": give at least one budget`}}function ot(e){return e.context===!1?{contextEnabled:!1}:{}}var Bt="--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 Fe(e){return async r=>{let n=await Y(e,"explore run");return n.ok?He(new L({baseUrl:n.controllerBaseUrl,auth:n.basic,timeoutMs:5e3}),r):null}}async function at(e){let r=typeof e.project=="string"?e.project:"";if(!r)return null;try{let n=await Y(e,"explore run");if(!n.ok)return null;let t=ae(e.env??new ie().getDefaultEnv()??"prod"),o=new nr(t.tmsBaseUrl,n.basic.username,n.basic.access_key);return await _r((async()=>{try{let u=await o.getProject(r);if(u?.name)return u.name}catch{}return(await o.listProjects()).find(u=>String(u.project_id)===r)?.name??null})(),4e3,()=>null)}catch{return null}}var Mt=async(e,r=Fe(e))=>{let n=null,t=typeof e.project=="string"?e.project:"",o=be(e,!!e.localOrchestration,t||null),i=null;if(o)try{i=await r(o)}catch{i=null}if(i){let h=Ve(i,typeof e.url=="string"?e.url:"");if(h){for(let a of Pe(h.error,h.next))process.stderr.write(a+`
35
+ `);return 2}n=i.target_url??null}let u=await(await import("./explore-run-tty-6UTBRCEF.js")).setupRunOpts(e,n,await at(e));return"opts"in u?u.opts:u.code};function Ht(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 Vt(e,r,n={}){let t=me(e,r),o=t?je("explore"):null,i=s=>s,u=null,h=typeof e.claimRun=="string"&&e.claimRun?e.claimRun:null,a=Dr({remote:!e.localOrchestration&&!h,onVm:!!h,hxJobId:Se().jobId??null,policy:typeof e.policy=="string"?e.policy:null,maxParallel:typeof e.maxParallel=="number"?e.maxParallel:null,maxLeases:typeof e.maxLeases=="number"?e.maxLeases:null}),c=()=>{if(!a.started()){a.markStarted();try{Ie()?.event("EXPLORE_START",a.startFields())}catch{}}},l=s=>{try{a.observe(s),s.type==="explore_run_started"&&c()}catch{}},f=s=>{l(s),o?o.emit(i(s)):u?.(i(s))},y=s=>{o?D(i(s)):process.stderr.write(`${s.type}: ${i(s).message}
36
+ `)},_=s=>{try{let d=Ie(),m={...s,error:s.error?i({message:s.error}).message:void 0};a.started()&&d?.event("EXPLORE_END",a.endFields(m));let p=a.errorFields(m);p&&d?.event("EXPLORE_ERROR",p)}catch{}return f({...Rr({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},g=(s,d)=>(y({type:"error",message:s}),d&&!o&&process.stderr.write(`next: ${d}
37
+ `),_({exitCode:2,error:s})),b=typeof e.claimRun=="string"&&e.claimRun?e.claimRun:null;if(b&&!t)return g("--claim-run is the HyperExecute VM's own mode; it never runs on a terminal");let G=$e(e);if("error"in G)return g(G.error,G.next);if(!t){let s=await(n.setup??(d=>Mt(d,n.lookupExploration??Fe(d))))(e);if(s===null)return 0;if(typeof s=="number")return s;e=s}if(!b&&!(typeof e.url=="string"&&e.url.trim())){let s=be(e,!!e.localOrchestration,typeof e.project=="string"&&e.project?e.project:null),d=null;if(s)try{d=await(n.lookupExploration??Fe(e))(s)}catch{d=null}d?.target_url&&(e={...e,url:d.target_url})}if(!b&&!(typeof e.url=="string"&&e.url.trim()))return g("required option '--url <url>' not specified");let E=!!e.localOrchestration||!!b;if(b&&e.localOrchestration)return g("--claim-run is the VM's own mode; it takes no --local-orchestration");if(e.devBundle&&E)return g("--dev-bundle is for a remote run (the default), not --local-orchestration or --claim-run");if(b){let s=String(e.explorationId??"").trim();if(!s)return g("--claim-run needs --exploration-id");let d=await Y(e,"explore run --claim-run");if(!d.ok)return g(d.error);let m=String(e.env??new ie().getDefaultEnv()??"prod"),p=await et(it(m,d.basic,"",A=>f(A)),s,b,process.env);if(!p.ok)return D(i({type:"error",message:p.error})),p.stopped?_({exitCode:p.exitCode,error:p.error,state:"stopped",remark:J("secrets_missing",p.error),explorationId:s,runId:b}):_({exitCode:p.exitCode,error:p.error,explorationId:s,runId:b});e={...e,...p.opts,env:e.env,username:e.username,accessKey:e.accessKey}}let O=$e(e);if("error"in O)return g(O.error,O.next);let x=O.policy,k={prompt:"",deps:""},R={},U="";try{let s=typeof e.depsText=="string"?e.depsText:mr(e.deps??[]);U=s;let d=fr({prompt:e.prompt??"Explore the app",deps:s},{globalDir:De(se,"variables"),localDir:De(process.cwd(),".testmuai","variables"),file:e.variablesFile,inline:e.variables,onLoadError:m=>y({type:"warning",message:m})});if("error"in d)return g(d.error);k={prompt:d.prompt,deps:d.deps},R=d.variables}catch(s){return g(`variables: ${s.message}`)}let C=nt(e.allowDomain??[]);if(k.deps&&C.length===0)return g("--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 lt=[...new Set([...C,...nt([String(e.url??"")])])],P=E?String(e.browser??"local"):"remote";if(!E&&e.browser!==void 0&&e.browser!=="local")return g("--browser applies to --local-orchestration; a remote run always uses remote browsers");if(P!=="local"&&P!=="remote")return g(`--browser ${P}: local or remote`);let M=e.hpsRegion;if(M!==void 0&&P!=="remote")return g("--hps-region needs --browser remote");if(M!==void 0&&!ce.includes(M))return g(`--hps-region ${M}: one of ${ce.join(", ")}`);let N=rr(e);if("error"in N)return g(N.error);if(N.tunnel&&P!=="remote")return g("--tunnel needs remote browsers (a remote run, or --browser remote): a local Chrome already reaches this machine");let K=e.maxParallel??1;if(P==="local"&&K>Ce)return g(`--max-parallel ${K}: at most ${Ce} browsers run on this machine at once (--browser remote runs up to ${ue})`);if(P==="remote"&&K>ue)return g(`--max-parallel ${K}: at most ${ue} remote browsers at once`);let ve=Ot(e.depthCaps);if("error"in ve)return g(ve.error);let _e=Nt(e.slowBudget);if("error"in _e)return g(_e.error);let ee=At(e.allowPost??[],lt);if("error"in ee)return g(ee.error);x==="mutating"&&ee.posts.length&&y({type:"warning",code:"allow_post_ignored",message:Ar});let re=new ie,I=e.env??re.getDefaultEnv()??"prod",B=ae(I),W=new or().load(),ut=re.loadProfileConfig(re.getActiveProfile()??"default",I)?.project_id??null,j=e.project??W.project_id??ut??null;if(x==="mutating"){let s=Or(String(e.url??"")),d=Ur(String(e.url??""));o?D(i({type:"warning",code:"policy_mutating",policy:x,host:s,message:d})):process.stderr.write((process.stderr.columns?pr(d,process.stderr.columns):d)+`
38
+ `);let m=n.mutatingMemory??Nr();if(!t&&!(j&&m.confirmed(j))){let A=await(n.confirmMutating??(async H=>(await import("./explore-run-tty-6UTBRCEF.js")).confirmMutatingRun({...H,projectName:H.projectName??(H.projectId?await at({...e,project:H.projectId}):null)})))({host:s,projectId:j,projectName:j===W.project_id?W.project_name??null:null});if(A!==!0)return process.stderr.write(`setup discarded; nothing launched
39
+ `),A===null?130:0;j&&m.remember(j)}}if(!t&&n.afterChecks)return n.afterChecks();let Ge=new Set;t||(u=s=>{s.type==="explore_remote_started"?process.stderr.write(z("queued on HyperExecute",` \xB7 run ${String(s.run_id).slice(0,8)}${s.job_link?` \xB7 ${String(s.job_link)}`:""}`,"done")+`
40
+ `):(s.type==="warning"||s.type==="error")&&process.stderr.write(`${String(s.type)}: ${String(s.message)}
41
+ `);for(let d of Ge)d(s)});let Ke=(s,d)=>{if(o)D(i({type:"error",message:s}));else for(let m of Pe(i({message:s}).message,d??Ht(s)))process.stderr.write(m+`
42
+ `)},v,We="";try{let s=await lr({creds:re,env:I,usernameFlag:e.username,accessKeyFlag:e.accessKey,log:()=>{}});v=s.basicAuth,We=String(s.resolvedCreds?.org_id??"")}catch(s){return s instanceof ar&&s.code==="not_authenticated"?g("not authenticated: pass --username/--access-key or run 'kane-cli login'"):g(`auth resolution failed: ${s.message}`)}if(!v)return g("explore needs Basic credentials (username + access key); none resolved");if(!b){let s=be(e,E,j),d=null,m=v;if(s)try{d=await(n.lookupExploration??(A=>He(new L({baseUrl:B.controllerBaseUrl,auth:m,timeoutMs:5e3}),A)))(s)}catch{d=null}let p=d?Ve(d,String(e.url??"")):null;if(p)return Ke(p.error,p.next),_({exitCode:2,error:p.error})}if(n.afterUrlCheck)return n.afterUrlCheck();if(!E){N.tunnel&&f({type:"warning",message:Bt});let s={...it(I,v,We,oe=>f(oe)),terminal:!t},d;if(typeof e.devBundle=="string"&&e.devBundle){let oe=(process.env.EXPLORE_DEV_CONTROLLER_URL??"").trim();if(!oe)return g("--dev-bundle needs EXPLORE_DEV_CONTROLLER_URL (the controller the VM talks to: the tunnel URL)");if(!Tt(e.devBundle))return g(`--dev-bundle ${e.devBundle}: no such file`);d={bundlePath:e.devBundle,controllerUrl:oe}}let m=j;if(!m)return g("a remote run needs a project: pass --project <id> or set one (kane-cli config set-project); one project has one exploration");t||process.stderr.write(z("launching on HyperExecute")+`
43
+ `),c();let p=await Zr(s,{opts:e,variables:R,depsText:U,prompt:e.prompt??"Explore the app",url:String(e.url),projectId:m,allowedDomains:C,policy:x,...ot(e),maxParallel:e.maxParallel,maxLeases:e.maxLeases,kaneVersion:V,...d?{dev:d}:{}});if(!p.ok)return Ke(p.error,p.stopped?"add the missing secret to your variables files (secret: true) or HyperExecute Secrets, then launch again":void 0),p.stopped?_({exitCode:p.exitCode,error:p.error,state:"stopped",remark:J("secrets_missing",p.error),explorationId:p.stopped.explorationId,runId:p.stopped.runId}):_({exitCode:p.exitCode,error:p.error});let A=_({exitCode:0,state:"queued",explorationId:p.explorationId,runId:p.runId});if(t)return A;let{runLiveView:H}=await import("./explore-live-QIET6WO4.js");return(await H({client:new L({baseUrl:B.controllerBaseUrl,auth:v}),explorationId:p.explorationId,runId:p.runId,mode:"remote",env:I,policy:x})).exitCode}let ke=sr();if(!ke)return g("v16-runner not found");let qe=W.window_size?.width??1280,Xe=W.window_size?.height??800,Je=j,$,te={explorationId:null,runId:null};if(P==="remote"){if(I!=="stage"&&I!=="prod")return g(`--browser remote: no remote browsers for env ${I}`);let s;try{s=wr(I,M??null)}catch(m){return g(m.message)}let d=v;i=xr([d.access_key]),$=vr({hpsBase:s,auth:d,forge:br(B.tmsBaseUrl,d,()=>({exploration_id:te.explorationId,run_id:te.runId,project_id:Je,hx_job_id:Se().jobId??null,kane_version:V,region:M??null,tunnel:!!N.tunnel,tunnel_name:N.tunnel?.name??null})),tunnel:N.tunnel,releaseSync:m=>yr(B.tmsBaseUrl,d,m),onEvent:m=>f({type:"remote_browser",...m})})}else $=gr({launch:tr,width:qe,height:Xe,headless:!!e.headless});Qe("explore-browsers",()=>$.releaseAllSync());let T=null,Re=null;try{T=await Kr({controller:{baseUrl:B.controllerBaseUrl,authHeader:X(v.username,v.access_key)},onWarn:s=>f({type:"warning",message:s}),onExploration:s=>{process.stderr.write(we(s,e.env)+`
44
+ `)},onStop:()=>{f({type:"warning",message:"explore stop: the run is stopping cleanly"}),Re?.()}})}catch(s){f({type:"warning",message:`live mode is off for this run: ${s.message}`})}let Ee=()=>{},ct=new Promise(s=>{Ee=s}),ne=null;t||Ge.add(s=>{s.type!=="explore_run_started"||ne||(ne=import("./explore-live-QIET6WO4.js").then(({runLiveView:d})=>d({client:new L({baseUrl:B.controllerBaseUrl,auth:v}),explorationId:String(s.exploration_id),runId:String(s.run_id),mode:"local",env:I,policy:x,ended:ct})))});try{let s=await Ir({url:e.url,prompt:k.prompt,maxLeases:e.maxLeases,explorationId:e.explorationId,...typeof e.claimRunId=="string"?{claimRunId:e.claimRunId}:{requested:Yr({opts:e,url:String(e.url),prompt:e.prompt??"Explore the app",depsText:U,variables:R,allowedDomains:C,policy:x,maxParallel:e.maxParallel,maxLeases:e.maxLeases})},projectId:Je,policy:x,context:k,variables:R,allowedDomains:C,...ot(e),allowPosts:x==="read_only"?ee.posts:[],depthCaps:ve.caps,slowBudgets:_e.budgets,recheck:e.recheck!==!1,maxParallel:K,...typeof e.focus=="string"?{focus:e.focus}:{},denyNames:(e.deny??[]).map(m=>m.trim()).filter(Boolean),headless:!!e.headless,width:qe,height:Xe,auth:v,clientRelease:V},{client:new L({baseUrl:B.controllerBaseUrl,auth:v}),spawnRunner:m=>{let p=ir({environment:I,username:v.username,accessKey:v.access_key,sessionId:m});return $.kind==="local"?Le({env:p,runner:ke,sessionId:m}):Fr(Le({env:p,runner:ke}),De(se,"sessions",m,"runner-stderr.log"),hr([v.access_key]))},acquireBrowser:async m=>{let p=await $.acquire(m);return T?.onBrowser(m),{cdpEndpoint:p.cdpEndpoint,release:()=>{T?.offBrowser(m),p.release()}}},releaseBrowsersOnInterrupt:$.kind==="remote",frameLink:m=>T?.attachRunner(m),onFrame:(m,p)=>T?.runnerFrame(m,p),onLiveRun:m=>{te.explorationId=m.explorationId,te.runId=m.runId,T?.armRun(m)},emit:m=>{l(m);let p=i(m);o?o.emit(p):u?.(p),T?.onEvent(p)},baseDir:se,onInterrupt:m=>{Re=m;let p=Kt(m);return()=>{Re=null,p()}}});await $.releaseAll(),await T?.close(s.stopReason??s.remark?.code??"stopped");let d=_(b?{...s,exitCode:kr(s)}:s);return Ee(d),ne&&await ne,d}finally{Ee(1),await T?.close("stopped"),await $.releaseAll(),Ye("explore-browsers")}}var Dt=3e3;async function Ft(e,r={}){let n=r.tty??!me(e),t=r.out??(x=>{process.stdout.write(x+`
45
+ `)}),o=n?null:je("explore"),i=String(e.explorationId??"").trim(),u=String(e.project??"").trim(),h=(x,k,R)=>(o?.emit({type:"done",status:k,exit_code:x,exploration_id:i||null,...R?{error:R}:{}}),x),a=(x,k)=>{if(o)D({type:"error",message:x});else{let R=r.err??(U=>{process.stderr.write(U+`
46
+ `)});R(`error: ${x}`),k&&R(`next: ${k}`)}return h(2,"error",x)};if(i&&u)return a("--exploration-id or --project, not both","kane-cli explore view --exploration-id <id>");if(!i&&!u)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 c=await Y(e,"explore view");if(!c.ok)return a(c.error,"kane-cli login");let l=c.basic,f={controllerBaseUrl:c.controllerBaseUrl};if(u){try{i=(await new L({baseUrl:f.controllerBaseUrl,auth:l}).listExplorations({state:"all",project:u})).explorations.find(k=>k.project_id===u)?.exploration_id??""}catch(x){return a(`could not find project ${u}'s exploration: ${x.message}`)}if(!i)return a(`project ${u} has no exploration`,`start one: kane-cli explore run --project ${u} --url <app>`)}let y=X(l.username,l.access_key),_={controllerBaseUrl:f.controllerBaseUrl,authHeader:y,explorationId:i,port:e.port,live:{controller:{baseUrl:f.controllerBaseUrl,authHeader:y}}},g=await Tr(_);if(g.kind==="not_found")return a(`exploration ${i} not found`,"kane-cli explore list --all");if(g.kind==="error")return a(`could not read the map: ${g.message}`);let b;try{b=await Cr(_)}catch(x){return a(`could not bind 127.0.0.1${_.port?`:${_.port}`:""}: ${x.message}`,"pass another --port, or leave it out for the first free one")}let G=r.hold?null:Wt(),E=null;try{E=await new L({baseUrl:f.controllerBaseUrl,auth:l,timeoutMs:Dt}).getContext(i)}catch{}o&&o.emit({type:"explore_view_started",url:b.url,exploration_id:i,context:E});let O=null;if(!o){let x=!r.out&&!!process.stdin.isTTY&&!!process.stdout.isTTY;x&&st(b.url),t(z("map viewer ready",` \xB7 ${b.url}`)),t(jt(` ${x?"opened in your browser \xB7 ":""}live when a run is going`)),t("");let k=g.kind==="ok"&&g.body.counts&&typeof g.body.counts=="object"?g.body.counts:null,R=E?`context ${E.enabled?"on":"off"}${E.last_job?` \xB7 ${E.last_job.status}`:""}`:"";for(let U of Pr({status:z("serving"),meta:["explore",i.slice(0,8),c.environment??""],tallies:[...$r(k).filter(C=>!C.endsWith("findings")&&!C.endsWith("finding")),...R?[R]:[]],keys:[...x?["o open again"]:[],"ctrl+c stop serving"]}))t(U);x&&!r.hold&&(O=Gt(()=>{st(b.url)}))}r.onStarted?.(b);try{await(G??r.hold())}finally{O?.()}return await b.close(),h(0,"stopped")}async function st(e){try{let{default:r}=await import("./open-MQLQKFAW.js");await r(e)}catch{process.stderr.write(`could not open a browser: open ${e}
47
+ `)}}function Gt(e){let r=process.stdin;if(!r.isTTY)return()=>{};let n=t=>{let o=t.toString("utf8");o===""?process.kill(process.pid,"SIGINT"):(o==="o"||o==="O")&&e()};return r.setRawMode(!0),r.resume(),r.on("data",n),()=>{r.off("data",n);try{r.setRawMode(!1)}catch{}r.pause()}}function Kt(e){let r=process.listeners("SIGINT");for(let n of r)process.removeListener("SIGINT",n);return process.on("SIGINT",e),()=>{process.removeListener("SIGINT",e);for(let n of r)process.on("SIGINT",n)}}function Wt(){return new Promise(e=>{let r=process.listeners("SIGINT"),n=process.listeners("SIGTERM");process.removeAllListeners("SIGINT"),process.removeAllListeners("SIGTERM");let t=()=>{process.removeListener("SIGINT",t),process.removeListener("SIGTERM",t);for(let o of r)process.on("SIGINT",o);for(let o of n)process.on("SIGTERM",o);e()};process.once("SIGINT",t),process.once("SIGTERM",t)})}function it(e,r,n,t){let o=ae(e);return{env:e,controllerBaseUrl:o.controllerBaseUrl,secretsBaseUrl:o.secretsBaseUrl,tmsBaseUrl:o.tmsBaseUrl,basic:r,orgId:n,emit:t}}export{Ct as a,Pt as b,yo as c,nt as d,At as e,Ot as f,Nt as g,ot as h,Bt as i,Vt as j,Dt as k,Ft as l,Kt as m};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-FCD3NYOM.js";import{a as c}from"./chunk-4QTH7VYE.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-HL5CJJXR.js"),import("./bootstrap-XGKU4WXB.js")]);await s(n(),r)}catch{}return this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(t){return this._lastError=t instanceof Error?t:new Error(String(t)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,t={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...t,headers:{...t.headers,Authorization:c(i.username,i.access_key)}}),n=await a(e,s(r));if(n.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return a(e,s(i))}return n}};function _(o){if(!o)return"network";let e=/failed:\s*(\d{3})\b/.exec(o.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{h as a,_ as b};
2
+ import{a as l}from"./chunk-FCD3NYOM.js";import{a as c}from"./chunk-4QTH7VYE.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-66TGWITQ.js"),import("./bootstrap-A2O4UZUJ.js")]);await s(n(),r)}catch{}return this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(t){return this._lastError=t instanceof Error?t:new Error(String(t)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,t={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...t,headers:{...t.headers,Authorization:c(i.username,i.access_key)}}),n=await a(e,s(r));if(n.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return a(e,s(i))}return n}};function _(o){if(!o)return"network";let e=/failed:\s*(\d{3})\b/.exec(o.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{h as a,_ as b};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-PCQK62MP.js";import{a as C}from"./chunk-TM45NPWL.js";import{r as m,s as u,t as f,u as x,v as y}from"./chunk-J4FIESTB.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
2
+ import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-HTJDMLZS.js";import{a as C}from"./chunk-JYH7CTF7.js";import{s as m,t as u,u as f,v as x,w as y}from"./chunk-BRWCWZE3.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
3
3
  Please open this URL manually: ${e}
4
4
  `)})})}};function v(s){let r=s.state==="success",o=r?"#22c55e":"#ef4444",e=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",t=r?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',i=s.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
5
5
  <html lang="en">
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as ae}from"./chunk-YPGZ5E4I.js";import{b as ue}from"./chunk-ZUZ6QJRA.js";import{n as k,p as ce,q as de,r as pe,s as fe}from"./chunk-ZMIKNNO6.js";import{a as ge}from"./chunk-YDPTSDIJ.js";import{a as w,b as q}from"./chunk-KGNE5CIM.js";import{d as le}from"./chunk-3AGP2BVN.js";import{d as oe,f as se}from"./chunk-OOGKX4Y6.js";import{b as ie}from"./chunk-7Y55CO42.js";import{a as re}from"./chunk-Q4SMITTV.js";import{a as te}from"./chunk-SMGRXKXX.js";import{a as ne}from"./chunk-PVN64537.js";import{a as G}from"./chunk-ZCBOHWN3.js";import{a as ee}from"./chunk-TM45NPWL.js";import{a as I}from"./chunk-HCBYKLMW.js";import{a as M,b as E}from"./chunk-33DWJV67.js";import{a as h}from"./chunk-FOJHSG5M.js";import{z as m}from"./chunk-J4FIESTB.js";import{e as Z}from"./chunk-UR6MHSHU.js";function j(e){if(!e)return"";let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toISOString().slice(0,16).replace("T"," ")} UTC`}function W(e){return e?e.code||e.message:""}function Y(e,t=Date.now()){if(!e)return"";let n=new Date(e).getTime();if(Number.isNaN(n))return e;let r=Math.floor(Math.max(0,t-n)/6e4);if(r<1)return"just now";if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function v(e,t=Date.now()){let n=Y(e,t);return!n||n==="just now"||!/^\d/.test(n)?n:`${n} ago`}function R(e){return e?e.slice(0,8):""}function me(e){if(!e)return"";try{return new URL(e).host||e}catch{return e}}function P(e){return e?e.replace(/_/g," "):""}var Ue={user_off:"turned off",project_not_shared:"project not shared: share it in Test Manager",project_unknown:"the project's sharing could not be checked",not_configured:"assurance jobs are not set up on this service",mark_refused:"the first assurance job could not share the project: ask a Test Manager admin for permission to create test cases, then turn context off and on"};function A(e){return e==null?"":e==="end"?"run end":`cut ${e}`}function xe(e){return e?e.enabled?e.running?"on \xB7 job running":e.last_job_status?`on \xB7 last job ${e.last_job_status}`:"on":"off":""}function K(e){let t=e.off_reason?Ue[e.off_reason]??e.off_reason:"";return e.enabled&&t?`on, blocked: ${t}`:e.enabled?"on":t?`off (${t})`:"off"}var f=e=>h.hex(m.dim)(e);var _e=e=>h.hex(m.orange)(e),J=e=>h.hex(m.green)(e),be=e=>h.hex(m.amber)(e),D=e=>h.hex(m.red)(e);function Be(e=process.stdout.columns){return Math.max(60,(e&&e>0?e:140)-2)}function Fe(e,t,n,r){let i=e.map((s,l)=>Math.max(s.length,...t.map(d=>(d[l]??"").length),1)),o=e.length*3+1,a=i.reduce((s,l)=>s+l,0)+o-n;if(a<=0)return t;let u=Math.min(a,Math.max(0,i[r]-7));for(i[r]-=u,a-=u;a>0;){let s=-1;if(i.forEach((l,d)=>{l>Math.max(7,e[d].length)&&(s<0||l>i[s])&&(s=d)}),s<0)break;i[s]-=1,a-=1}let c=(s,l)=>s.length<=l?s:`${s.slice(0,Math.max(0,l-1))}\u2026`;return t.map(s=>s.map((l,d)=>c(l,i[d])))}function ye(e,t,n,r){let i=Be(r);return le(e,Fe(e,t,i,n),i,n).map((o,a)=>a===1?h.bold(o):o)}function b(e,t="",n="open"){return`${(n==="done"?J:n==="failed"?D:_e)(`\u25CF ${e}`)}${t?f(t):""}`}function we(e,t){return[D(`error: ${e}`),...t?[`next: ${t}`]:[]]}function Ve(e){return e.current_session?`\u25CF ${e.current_session.state}`:"idle"}function Ge(e,t){if(e.current_session)return`run ${R(e.current_session.run_id)} \xB7 ${Y(e.current_session.started_at,t)}`;let n=e.last_session;return n?[W(n.remark)||"stopped",v(n.ended_at??n.started_at,t)].filter(Boolean).join(" \xB7 "):"never run"}function qe(e,t={}){return(e.project_id?t[e.project_id]:void 0)||(e.name?e.name:"")||R(e.project_id??e.exploration_id)}function $e(e,t){if(!e.length)return[f(t.all?"no explorations":"no running explorations (--all lists every one)")];let n=t.now??Date.now(),r=e.some(a=>a.context),i=["project","app","state","last run",...r?["context"]:[]],o=e.map(a=>[qe(a,t.projects),me(a.target_url),Ve(a),Ge(a,n),...r?[xe(a.context)]:[]]);return[...ye(i,o,1,t.cols),f(`${e.length} exploration${e.length===1?"":"s"} \xB7 newest first${t.nextCursor?` \xB7 more: --cursor ${t.nextCursor}`:""} \xB7 kane-cli explore to open one`)]}function ke(e){return e.credits&&typeof e.credits.total=="number"?Math.round(e.credits.total).toLocaleString("en-US"):""}function je(e,t,n){if(!t.length)return[f(`exploration ${e} has no sessions yet`)];let r=n.now??Date.now(),i=t.map(o=>[R(o.run_id),o.state==="stopped"?"stopped":`\u25CF ${o.state}`,W(o.remark)||"\u2014",o.mode,o.leases===void 0?"":String(o.leases),o.findings===void 0?"":String(o.findings),ke(o),v(o.started_at,r)]);return[...ye(["run","state","remark","mode","leases","findings","credits","started"],i,2,n.cols),f(`${t.length} session${t.length===1?"":"s"} \xB7 --run <run-id> for one in full${n.nextCursor?` \xB7 more: --cursor ${n.nextCursor}`:""}`)]}function X(e,t=18){let n=e.filter(([,i])=>i),r=Math.max(t,...n.map(([i])=>i.length+2));return n.map(([i,o,a])=>` ${f(i.padEnd(r))}${a?a(o):o}`)}function Ee(e){return[h.bold(`run ${e.run_id}`),...X([["exploration",e.exploration_id],["session",`#${e.version}`],["state",e.state,e.state==="stopped"?void 0:_e],["remark",e.remark?`${e.remark.code}: ${e.remark.message}`:""],["stop reason",e.stop_reason??""],["mode",e.mode],["started",j(e.started_at)],["started by",e.started_by_user_id?`user ${e.started_by_user_id}`:""],["claimed",j(e.claimed_at)],["stop asked",j(e.stop_requested_at)],["stopped by",e.stopped_by_user_id?`user ${e.stopped_by_user_id}`:""],["ended",j(e.ended_at)],["leases",e.leases===void 0?"":String(e.leases)],["findings",e.findings===void 0?"":String(e.findings)],["credits",ke(e)],["job",e.hx_job_link??e.hx_job_id??""]])]}function Ce(e){let t=K(e);return e.enabled?e.off_reason?be(t):J(t):f(t)}function We(e,t){return e?t!=null&&e===t?" by you":` by user ${e}`:""}function he(e,t){let n=P(e),r=A(t);return n?!r||r===n?n:`${n} \xB7 ${r}`:r}function at(e){let t=Math.max(20,e.cols??process.stdout.columns??100);return[f("\u2500".repeat(t)),`${e.status}${e.meta.filter(Boolean).length?f(` \xB7 ${e.meta.filter(Boolean).join(" \xB7 ")}`):""}`,...e.tallies?.length?[f(e.tallies.join(" \xB7 "))]:[],f(e.keys.join(" \xB7 "))]}function Te(e){if(!e)return[];let t=(n,r,i)=>typeof n=="number"?`${n} ${n===1?r:i}`:"";return[t(e.junctions,"screen","screens"),t(e.flows,"flow","flows"),t(e.findings,"finding","findings")].filter(Boolean)}function ut(e,t={}){let n=e.last_job,r=e.running_job,i=[h.bold(`Assurance context${t.project?` \xB7 "${t.project}"`:""}`),...X([["state",K(e),()=>Ce(e)],["changed",e.changed_at?`${v(e.changed_at)}${We(e.changed_by_user_id,t.me)}`:""],["pending cut",e.pending_cut?`${A(e.pending_cut.cut)} (${P(e.pending_cut.trigger)})`:"none"],["running job",r?`${R(r.job_id)} \xB7 ${he(r.trigger,r.cut)}${r.status==="launching"?" \xB7 launching (HyperExecute has not answered yet)":""}${r.hx_job_link?` \xB7 ${r.hx_job_link}`:""}`:"none"]]),""],o=["",f(`sync now: kane-cli explore context sync ${e.exploration_id}`)];if(!n)return[...i,f("no assurance job has run yet"),...o];let a=n.use_cases?.added?.length??0,u=n.use_cases?.modified?.length??0,c=n.tests?.failed??[],s=n.status==="ok"||n.status==="noop"?J:n.status==="partial"?be:D;return[...i,h.bold("Last job"),...X([["status",n.status,s],["trigger \xB7 cut",he(n.trigger,n.cut)],["use cases",a||u?`${a} added \xB7 ${u} modified`:""],["tests",n.tests?`${n.tests.designed??0} designed \xB7 ${n.tests.saved??0} saved${c.length?` \xB7 failed: ${c.join(", ")}`:""}`:""],["held",n.held?.length?n.held.map(l=>`${l.ref} (${l.why})`).join("; "):""],["error",n.error?`${n.error.code}${n.error.message?`: ${n.error.message}`:""}`:"",D],["ended",v(n.ended_at)],["credits",typeof n.credits=="number"?String(n.credits):""],["job",n.hx_job_link??n.hx_job_id??n.job_id]]),...(n.attempt??1)>1?[f(" retry of a failed attempt; counts cover this attempt only")]:[],...o]}function lt(e,t){let n=A(t.cut)||"the newest cut",r=f(` status: kane-cli explore context status ${e}`);return t.state==="launched"?[b("assurance job launched",` \xB7 ${P(t.trigger)||"manual"} \xB7 ${n}`),...t.hx_job_link?[f(` job: ${t.hx_job_link}`)]:[],r]:t.state==="launching"?[b("assurance job launching",` \xB7 ${n} \xB7 HyperExecute has not answered yet`),r]:t.state==="pending"&&t.trigger==="run_end"?[b("the run-end job is waiting",` \xB7 a job is running${t.running_job_id?` (${t.running_job_id})`:""}`),f(" this sync was folded into it: the run-end job reads the whole run, so nothing else is queued"),r]:t.state==="pending"?[b(`assurance ${n} pending`,` \xB7 a job is running${t.running_job_id?` (${t.running_job_id})`:""}; this cut runs after it (a newer one replaces it)`),r]:t.state==="running"?[b(`a job is already running on ${n}`,t.job_id?` (${t.job_id})`:""),r]:t.state==="up_to_date"?[b("assurance context up to date",` \xB7 ${t.cut!==void 0&&t.cut!==null?`${A(t.cut)} already read`:"nothing new"}`,"done")]:[b(`assurance sync: ${t.state}`)]}function ct(e,t,n,r){return[b(`assurance context ${n}`,r?` \xB7 "${r}"`:` \xB7 exploration ${e}`,"done"),` ${f("now")} ${Ce(t)}`,...n==="off"?[f(" the next cut is skipped; nothing already saved is deleted"),f(` turn on: kane-cli explore context on ${e}`)]:[f(" the controller catches up from the newest ended run")]]}function z(){return{stdin:!!process.stdin.isTTY,stdout:!!process.stdout.isTTY}}function Se(e,t=z()){return!!e.agent||!t.stdin||!t.stdout}var Ye=ce;function ve(e){return e.option("--agent",Ye)}function Re(e){return{formatHelp(t,n){let r=n.padWidth(t,n),i=n.helpWidth||80,o=2,a=2,u=(p,y)=>{if(!y)return p;let _=r+a;return y.split(`
2
+ import{a as ae}from"./chunk-EP4WGGMY.js";import{b as ue}from"./chunk-ZUZ6QJRA.js";import{a as w,b as q}from"./chunk-KGNE5CIM.js";import{n as k,p as ce,q as de,r as pe,s as fe}from"./chunk-MIQ6J5YG.js";import{a as ge}from"./chunk-YDPTSDIJ.js";import{d as le}from"./chunk-3AGP2BVN.js";import{d as oe,f as se}from"./chunk-TC2PHBPH.js";import{a as re}from"./chunk-66C5A2F5.js";import{b as ie}from"./chunk-PZOQ2IQK.js";import{a as te}from"./chunk-Q4QCSO6Y.js";import{a as I}from"./chunk-HCBYKLMW.js";import{a as ne}from"./chunk-PVN64537.js";import{a as G}from"./chunk-V24LUINK.js";import{a as ee}from"./chunk-JYH7CTF7.js";import{A as m}from"./chunk-BRWCWZE3.js";import{a as M,b as E}from"./chunk-33DWJV67.js";import{a as h}from"./chunk-FOJHSG5M.js";import{e as Z}from"./chunk-UR6MHSHU.js";function j(e){if(!e)return"";let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toISOString().slice(0,16).replace("T"," ")} UTC`}function W(e){return e?e.code||e.message:""}function Y(e,t=Date.now()){if(!e)return"";let n=new Date(e).getTime();if(Number.isNaN(n))return e;let r=Math.floor(Math.max(0,t-n)/6e4);if(r<1)return"just now";if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function v(e,t=Date.now()){let n=Y(e,t);return!n||n==="just now"||!/^\d/.test(n)?n:`${n} ago`}function R(e){return e?e.slice(0,8):""}function me(e){if(!e)return"";try{return new URL(e).host||e}catch{return e}}function P(e){return e?e.replace(/_/g," "):""}var Ue={user_off:"turned off",project_not_shared:"project not shared: share it in Test Manager",project_unknown:"the project's sharing could not be checked",not_configured:"assurance jobs are not set up on this service",mark_refused:"the first assurance job could not share the project: ask a Test Manager admin for permission to create test cases, then turn context off and on"};function A(e){return e==null?"":e==="end"?"run end":`cut ${e}`}function xe(e){return e?e.enabled?e.running?"on \xB7 job running":e.last_job_status?`on \xB7 last job ${e.last_job_status}`:"on":"off":""}function K(e){let t=e.off_reason?Ue[e.off_reason]??e.off_reason:"";return e.enabled&&t?`on, blocked: ${t}`:e.enabled?"on":t?`off (${t})`:"off"}var f=e=>h.hex(m.dim)(e);var _e=e=>h.hex(m.orange)(e),J=e=>h.hex(m.green)(e),be=e=>h.hex(m.amber)(e),D=e=>h.hex(m.red)(e);function Be(e=process.stdout.columns){return Math.max(60,(e&&e>0?e:140)-2)}function Fe(e,t,n,r){let i=e.map((s,l)=>Math.max(s.length,...t.map(d=>(d[l]??"").length),1)),o=e.length*3+1,a=i.reduce((s,l)=>s+l,0)+o-n;if(a<=0)return t;let u=Math.min(a,Math.max(0,i[r]-7));for(i[r]-=u,a-=u;a>0;){let s=-1;if(i.forEach((l,d)=>{l>Math.max(7,e[d].length)&&(s<0||l>i[s])&&(s=d)}),s<0)break;i[s]-=1,a-=1}let c=(s,l)=>s.length<=l?s:`${s.slice(0,Math.max(0,l-1))}\u2026`;return t.map(s=>s.map((l,d)=>c(l,i[d])))}function ye(e,t,n,r){let i=Be(r);return le(e,Fe(e,t,i,n),i,n).map((o,a)=>a===1?h.bold(o):o)}function b(e,t="",n="open"){return`${(n==="done"?J:n==="failed"?D:_e)(`\u25CF ${e}`)}${t?f(t):""}`}function we(e,t){return[D(`error: ${e}`),...t?[`next: ${t}`]:[]]}function Ve(e){return e.current_session?`\u25CF ${e.current_session.state}`:"idle"}function Ge(e,t){if(e.current_session)return`run ${R(e.current_session.run_id)} \xB7 ${Y(e.current_session.started_at,t)}`;let n=e.last_session;return n?[W(n.remark)||"stopped",v(n.ended_at??n.started_at,t)].filter(Boolean).join(" \xB7 "):"never run"}function qe(e,t={}){return(e.project_id?t[e.project_id]:void 0)||(e.name?e.name:"")||R(e.project_id??e.exploration_id)}function $e(e,t){if(!e.length)return[f(t.all?"no explorations":"no running explorations (--all lists every one)")];let n=t.now??Date.now(),r=e.some(a=>a.context),i=["project","app","state","last run",...r?["context"]:[]],o=e.map(a=>[qe(a,t.projects),me(a.target_url),Ve(a),Ge(a,n),...r?[xe(a.context)]:[]]);return[...ye(i,o,1,t.cols),f(`${e.length} exploration${e.length===1?"":"s"} \xB7 newest first${t.nextCursor?` \xB7 more: --cursor ${t.nextCursor}`:""} \xB7 kane-cli explore to open one`)]}function ke(e){return e.credits&&typeof e.credits.total=="number"?Math.round(e.credits.total).toLocaleString("en-US"):""}function je(e,t,n){if(!t.length)return[f(`exploration ${e} has no sessions yet`)];let r=n.now??Date.now(),i=t.map(o=>[R(o.run_id),o.state==="stopped"?"stopped":`\u25CF ${o.state}`,W(o.remark)||"\u2014",o.mode,o.leases===void 0?"":String(o.leases),o.findings===void 0?"":String(o.findings),ke(o),v(o.started_at,r)]);return[...ye(["run","state","remark","mode","leases","findings","credits","started"],i,2,n.cols),f(`${t.length} session${t.length===1?"":"s"} \xB7 --run <run-id> for one in full${n.nextCursor?` \xB7 more: --cursor ${n.nextCursor}`:""}`)]}function X(e,t=18){let n=e.filter(([,i])=>i),r=Math.max(t,...n.map(([i])=>i.length+2));return n.map(([i,o,a])=>` ${f(i.padEnd(r))}${a?a(o):o}`)}function Ee(e){return[h.bold(`run ${e.run_id}`),...X([["exploration",e.exploration_id],["session",`#${e.version}`],["state",e.state,e.state==="stopped"?void 0:_e],["remark",e.remark?`${e.remark.code}: ${e.remark.message}`:""],["stop reason",e.stop_reason??""],["mode",e.mode],["started",j(e.started_at)],["started by",e.started_by_user_id?`user ${e.started_by_user_id}`:""],["claimed",j(e.claimed_at)],["stop asked",j(e.stop_requested_at)],["stopped by",e.stopped_by_user_id?`user ${e.stopped_by_user_id}`:""],["ended",j(e.ended_at)],["leases",e.leases===void 0?"":String(e.leases)],["findings",e.findings===void 0?"":String(e.findings)],["credits",ke(e)],["job",e.hx_job_link??e.hx_job_id??""]])]}function Ce(e){let t=K(e);return e.enabled?e.off_reason?be(t):J(t):f(t)}function We(e,t){return e?t!=null&&e===t?" by you":` by user ${e}`:""}function he(e,t){let n=P(e),r=A(t);return n?!r||r===n?n:`${n} \xB7 ${r}`:r}function at(e){let t=Math.max(20,e.cols??process.stdout.columns??100);return[f("\u2500".repeat(t)),`${e.status}${e.meta.filter(Boolean).length?f(` \xB7 ${e.meta.filter(Boolean).join(" \xB7 ")}`):""}`,...e.tallies?.length?[f(e.tallies.join(" \xB7 "))]:[],f(e.keys.join(" \xB7 "))]}function Te(e){if(!e)return[];let t=(n,r,i)=>typeof n=="number"?`${n} ${n===1?r:i}`:"";return[t(e.junctions,"screen","screens"),t(e.flows,"flow","flows"),t(e.findings,"finding","findings")].filter(Boolean)}function ut(e,t={}){let n=e.last_job,r=e.running_job,i=[h.bold(`Assurance context${t.project?` \xB7 "${t.project}"`:""}`),...X([["state",K(e),()=>Ce(e)],["changed",e.changed_at?`${v(e.changed_at)}${We(e.changed_by_user_id,t.me)}`:""],["pending cut",e.pending_cut?`${A(e.pending_cut.cut)} (${P(e.pending_cut.trigger)})`:"none"],["running job",r?`${R(r.job_id)} \xB7 ${he(r.trigger,r.cut)}${r.status==="launching"?" \xB7 launching (HyperExecute has not answered yet)":""}${r.hx_job_link?` \xB7 ${r.hx_job_link}`:""}`:"none"]]),""],o=["",f(`sync now: kane-cli explore context sync ${e.exploration_id}`)];if(!n)return[...i,f("no assurance job has run yet"),...o];let a=n.use_cases?.added?.length??0,u=n.use_cases?.modified?.length??0,c=n.tests?.failed??[],s=n.status==="ok"||n.status==="noop"?J:n.status==="partial"?be:D;return[...i,h.bold("Last job"),...X([["status",n.status,s],["trigger \xB7 cut",he(n.trigger,n.cut)],["use cases",a||u?`${a} added \xB7 ${u} modified`:""],["tests",n.tests?`${n.tests.designed??0} designed \xB7 ${n.tests.saved??0} saved${c.length?` \xB7 failed: ${c.join(", ")}`:""}`:""],["held",n.held?.length?n.held.map(l=>`${l.ref} (${l.why})`).join("; "):""],["error",n.error?`${n.error.code}${n.error.message?`: ${n.error.message}`:""}`:"",D],["ended",v(n.ended_at)],["credits",typeof n.credits=="number"?String(n.credits):""],["job",n.hx_job_link??n.hx_job_id??n.job_id]]),...(n.attempt??1)>1?[f(" retry of a failed attempt; counts cover this attempt only")]:[],...o]}function lt(e,t){let n=A(t.cut)||"the newest cut",r=f(` status: kane-cli explore context status ${e}`);return t.state==="launched"?[b("assurance job launched",` \xB7 ${P(t.trigger)||"manual"} \xB7 ${n}`),...t.hx_job_link?[f(` job: ${t.hx_job_link}`)]:[],r]:t.state==="launching"?[b("assurance job launching",` \xB7 ${n} \xB7 HyperExecute has not answered yet`),r]:t.state==="pending"&&t.trigger==="run_end"?[b("the run-end job is waiting",` \xB7 a job is running${t.running_job_id?` (${t.running_job_id})`:""}`),f(" this sync was folded into it: the run-end job reads the whole run, so nothing else is queued"),r]:t.state==="pending"?[b(`assurance ${n} pending`,` \xB7 a job is running${t.running_job_id?` (${t.running_job_id})`:""}; this cut runs after it (a newer one replaces it)`),r]:t.state==="running"?[b(`a job is already running on ${n}`,t.job_id?` (${t.job_id})`:""),r]:t.state==="up_to_date"?[b("assurance context up to date",` \xB7 ${t.cut!==void 0&&t.cut!==null?`${A(t.cut)} already read`:"nothing new"}`,"done")]:[b(`assurance sync: ${t.state}`)]}function ct(e,t,n,r){return[b(`assurance context ${n}`,r?` \xB7 "${r}"`:` \xB7 exploration ${e}`,"done"),` ${f("now")} ${Ce(t)}`,...n==="off"?[f(" the next cut is skipped; nothing already saved is deleted"),f(` turn on: kane-cli explore context on ${e}`)]:[f(" the controller catches up from the newest ended run")]]}function z(){return{stdin:!!process.stdin.isTTY,stdout:!!process.stdout.isTTY}}function Se(e,t=z()){return!!e.agent||!t.stdin||!t.stdout}var Ye=ce;function ve(e){return e.option("--agent",Ye)}function Re(e){return{formatHelp(t,n){let r=n.padWidth(t,n),i=n.helpWidth||80,o=2,a=2,u=(p,y)=>{if(!y)return p;let _=r+a;return y.split(`
3
3
  `).map((V,Oe)=>n.wrap(`${(Oe===0?p:"").padEnd(_)}${V}`,i-o,_)).join(`
4
4
  `)},c=p=>p.join(`
5
5
  `).replace(/^/gm," ".repeat(o)),s=[`Usage: ${n.commandUsage(t)}`,""],l=n.commandDescription(t);l&&(s=s.concat([n.wrap(l,i,0),""]));let d=n.visibleArguments(t).map(p=>u(n.argumentTerm(p),n.argumentDescription(p)));d.length&&(s=s.concat(["Arguments:",c(d),""]));let g=n.visibleOptions(t),$=new Set;for(let p of e){let y=p.flags.map(_=>g.find(V=>V.long===_)).filter(_=>!!_&&!$.has(_));if(y.length){for(let _ of y)$.add(_);s=s.concat([`${p.title}:`,c(y.map(_=>u(n.optionTerm(_),_.description))),""])}}let T=g.filter(p=>!$.has(p));T.length&&(s=s.concat(["Other options:",c(T.map(p=>u(n.optionTerm(p),p.description))),""]));let S=n.visibleCommands(t).map(p=>u(n.subcommandTerm(p),n.subcommandDescription(p)));return S.length&&(s=s.concat(["Commands:",c(S),""])),s.join(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as d}from"./chunk-73ZFOJOK.js";import{a as m}from"./chunk-EZMRWXRT.js";import{da as u}from"./chunk-PI7OXS62.js";function h(e,r){return`${e}:hold:${r}`}function g(e,r){let n=[],o=[];for(let i of e.use_cases){let c=i.matches_existing;c?.cid&&r.hasNode(c.cid)?n.push({ref:c.cid,expectedTip:r.tipOf(c.cid)}):o.push({tempRef:i.temp_ref,title:String(i.title??""),probeText:String(i.title??"")})}return{verb:"extract",ucTargets:n,newBuCandidates:o,sourcePins:[{source_id:e.source.source_id,source_cid:e.source.source_cid}],readBasis:e.read_basis??null}}async function b(e){let r=d(e.proposal),n=t=>r.passthrough.use_cases.filter(a=>{let l=a.matches_existing?.cid,s=l?t.resolve(l):null,p=s?t.tipOf(s.cid):null;return p!=null&&(e.matchUnreviewed===!0||(t.trust.get(p)??null)!=="derived")}),o=n(e.graph),i=new Set(o.map(t=>t.temp_ref));return{ok:(await m(e.ctx,{...g({...r.passthrough,use_cases:o},e.graph),eventIds:[h(e.sid,e.proposalId)]},t=>{let a={...r.passthrough,use_cases:n(t.graph).filter(p=>i.has(p.temp_ref))},l=new Map(a.use_cases.map(p=>[p.temp_ref,{resolution:"approved"}])),s=u({store:e.store,graph:t.graph,scope:t.scope,proposal:a,proposalId:e.proposalId,verdicts:l,by:e.by,autoName:!0,allowStaleBasis:!0,eventIds:t.eventIds("extract",1),...e.durable?{sid:t.sid}:{},probeHits:t.probeHits,...e.matchUnreviewed?{matchUnreviewed:!0}:{}});return s.errors!==null?{errors:s.errors}:{result:s,record:s.record}})).ok,skippedAttach:r.passthrough.use_cases.length-o.length}}export{h as a,g as b,b as c};
2
+ import{b as d}from"./chunk-73ZFOJOK.js";import{a as m}from"./chunk-OVB5GVRB.js";import{da as u}from"./chunk-5EAJO372.js";function h(e,r){return`${e}:hold:${r}`}function g(e,r){let n=[],o=[];for(let i of e.use_cases){let c=i.matches_existing;c?.cid&&r.hasNode(c.cid)?n.push({ref:c.cid,expectedTip:r.tipOf(c.cid)}):o.push({tempRef:i.temp_ref,title:String(i.title??""),probeText:String(i.title??"")})}return{verb:"extract",ucTargets:n,newBuCandidates:o,sourcePins:[{source_id:e.source.source_id,source_cid:e.source.source_cid}],readBasis:e.read_basis??null}}async function b(e){let r=d(e.proposal),n=t=>r.passthrough.use_cases.filter(a=>{let l=a.matches_existing?.cid,s=l?t.resolve(l):null,p=s?t.tipOf(s.cid):null;return p!=null&&(e.matchUnreviewed===!0||(t.trust.get(p)??null)!=="derived")}),o=n(e.graph),i=new Set(o.map(t=>t.temp_ref));return{ok:(await m(e.ctx,{...g({...r.passthrough,use_cases:o},e.graph),eventIds:[h(e.sid,e.proposalId)]},t=>{let a={...r.passthrough,use_cases:n(t.graph).filter(p=>i.has(p.temp_ref))},l=new Map(a.use_cases.map(p=>[p.temp_ref,{resolution:"approved"}])),s=u({store:e.store,graph:t.graph,scope:t.scope,proposal:a,proposalId:e.proposalId,verdicts:l,by:e.by,autoName:!0,allowStaleBasis:!0,eventIds:t.eventIds("extract",1),...e.durable?{sid:t.sid}:{},probeHits:t.probeHits,...e.matchUnreviewed?{matchUnreviewed:!0}:{}});return s.errors!==null?{errors:s.errors}:{result:s,record:s.record}})).ok,skippedAttach:r.passthrough.use_cases.length-o.length}}export{h as a,g as b,b as c};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as v}from"./chunk-CCOD4GQJ.js";import{a as S}from"./chunk-QSCXXNC2.js";import{n as g}from"./chunk-UJLULWSR.js";import{a as u,b as d}from"./chunk-J4FIESTB.js";import{existsSync as P}from"fs";import{join as T}from"path";import{mkdirSync as b,rmSync as h,writeFileSync as k}from"fs";import{join as E,resolve as A}from"path";import{join as w}from"path";function m(){return process.env.KANE_CLI_WIRE_BASE_DIR||d}function J(e){return w(m(),"sessions",`testrun-${e}`)}function y(e=m()){return E(e,"sessions","active")}function _(e,r){return E(y(r),`${e}.json`)}function x(e){let r=e.pid??process.pid,n=_(r,e.baseDir);try{b(y(e.baseDir),{recursive:!0}),k(n,JSON.stringify({pid:r,cwd:process.cwd(),surface:e.surface,session_dir:A(e.sessionDir),started:new Date().toISOString(),cli_version:u,host_agent:S()},null,2)+`
2
+ import{b as v}from"./chunk-CCOD4GQJ.js";import{a as S}from"./chunk-QSCXXNC2.js";import{a as u,b as d}from"./chunk-BRWCWZE3.js";import{m as g}from"./chunk-WMXBRC4B.js";import{existsSync as P}from"fs";import{join as T}from"path";import{mkdirSync as b,rmSync as h,writeFileSync as k}from"fs";import{join as E,resolve as A}from"path";import{join as w}from"path";function m(){return process.env.KANE_CLI_WIRE_BASE_DIR||d}function J(e){return w(m(),"sessions",`testrun-${e}`)}function y(e=m()){return E(e,"sessions","active")}function _(e,r){return E(y(r),`${e}.json`)}function x(e){let r=e.pid??process.pid,n=_(r,e.baseDir);try{b(y(e.baseDir),{recursive:!0}),k(n,JSON.stringify({pid:r,cwd:process.cwd(),surface:e.surface,session_dir:A(e.sessionDir),started:new Date().toISOString(),cli_version:u,host_agent:S()},null,2)+`
3
3
  `)}catch{}return n}function f(e=process.pid,r){try{h(_(e,r),{force:!0})}catch{}}var R={run:"run_end",testmd:"test_md_done",testrun:"testrun_done",explore:"done"};import{appendFileSync as I,mkdirSync as N}from"fs";import{dirname as O}from"path";function D(e){let r=!1;return{path:e,append(n){try{r||(N(O(e),{recursive:!0}),r=!0),I(e,n+`
4
4
  `)}catch{}}}}function W(e,r=()=>new Date){let{v:n,ts:c,...i}=e;return{...i,v:1,ts:typeof c=="string"?c:r().toISOString()}}function V(e){let r=e.stdout??(t=>{process.stdout.write(t)}),n=R[e.surface],c=!1,i=null,o=null,p=[],l=()=>{if(!(o||!i||!P(i))){o=D(T(i,"events.ndjson"));for(let t of p)o.append(t);p=[];try{e.onAttach?.(i)}catch{}}};return{emit(t){if(c)return;let a=v(JSON.stringify(W(t,e.now)));r(a+`
5
5
  `),l(),o?o.append(a):p.push(a),t.type===n&&(c=!0,p=[])},attachSessionDir(t){i=t,l()},setTerminal(t){n=t},get logPath(){return o?o.path:null}}}var s=null;function j(e){return r=>{x({surface:e,sessionDir:r}),g("wire-active-run",()=>f()),process.once("exit",()=>f())}}function se(e,r){return s=V({surface:e,cliVersion:u,onAttach:r??j(e)}),s.emit({type:"stream_start",cli_version:u,surface:e,pid:process.pid}),s}function ce(){return s}function ue(e){if(s){s.emit(e);return}process.stdout.write(JSON.stringify(W(e))+`
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as ne}from"./chunk-WMGKUERB.js";import{a as y,b as ie,c as oe,d as le,e as ae}from"./chunk-UWPG5MWM.js";import{a as F,b as x,c as D,d as ee,f as re,h as de,i as pe}from"./chunk-GJXO6FF7.js";import{a as se,d as te}from"./chunk-ZCIWQHCO.js";import{a as X,c as Y,d as Z}from"./chunk-CQDCNP7V.js";import{Ba as B,Ea as v,Ja as Q,Pa as w,Va as U,Xa as $,Ya as O,Za as b,_a as G,ab as J,fb as H,i as _,jb as z,kb as W,mb as R,nb as K,ob as T,t as I}from"./chunk-PI7OXS62.js";import{a as C}from"./chunk-YJAQZMJT.js";import{existsSync as Se,readFileSync as Ee}from"fs";import{join as Me}from"path";import{mkdirSync as be,readFileSync as Re,renameSync as Fe,writeFileSync as Ae}from"fs";import{dirname as A,join as M}from"path";function E(r,o){be(A(r),{recursive:!0});let s=M(A(r),`.${process.pid}.tmp`);Ae(s,o),Fe(s,r)}function ue(r){try{return JSON.parse(Re(r,"utf8"))}catch{return null}}function ce(r){let o=s=>M(A(y(r,s)),"verdicts.json");return{read:s=>ue(y(r,s)),write:(s,i)=>E(y(r,s),JSON.stringify(i,null,2)+`
2
+ import{b as ne}from"./chunk-WMGKUERB.js";import{a as y,b as ie,c as oe,d as le,e as ae}from"./chunk-2EKLTUY2.js";import{a as F,b as x,c as D,d as ee,f as re,h as de,i as pe}from"./chunk-JBUKEIYL.js";import{a as se,d as te}from"./chunk-ZCIWQHCO.js";import{a as X,c as Y,d as Z}from"./chunk-5ORBAYTU.js";import{Ba as B,Ea as v,Ja as Q,Pa as w,Va as U,Xa as $,Ya as O,Za as b,_a as G,ab as J,fb as H,i as _,jb as z,kb as W,mb as R,nb as K,ob as T,t as I}from"./chunk-5EAJO372.js";import{a as C}from"./chunk-YJAQZMJT.js";import{existsSync as Se,readFileSync as Ee}from"fs";import{join as Me}from"path";import{mkdirSync as be,readFileSync as Re,renameSync as Fe,writeFileSync as Ae}from"fs";import{dirname as A,join as M}from"path";function E(r,o){be(A(r),{recursive:!0});let s=M(A(r),`.${process.pid}.tmp`);Ae(s,o),Fe(s,r)}function ue(r){try{return JSON.parse(Re(r,"utf8"))}catch{return null}}function ce(r){let o=s=>M(A(y(r,s)),"verdicts.json");return{read:s=>ue(y(r,s)),write:(s,i)=>E(y(r,s),JSON.stringify(i,null,2)+`
3
3
  `),writeReview:(s,i)=>E(M(A(y(r,s)),"review.json"),JSON.stringify(i,null,2)+`
4
4
  `),verdicts:s=>ue(o(s))??{verdicts:{}},saveVerdicts:(s,i)=>E(o(s),JSON.stringify(i,null,2)+`
5
5
  `)}}import{appendFileSync as fe,closeSync as qe,existsSync as V,openSync as Pe,readdirSync as Oe,readFileSync as ge,renameSync as Te,writeFileSync as he}from"fs";import{join as q}from"path";var me=".pending-facts.bad";function ye(r){let o=q(r,ie);return{quarantinePath:q(r,me),park:(s,i)=>{let l=null;try{l=w(r,{deadlineMs:i.deadlineMs})}catch{l=null}try{if(l)return fe(o,s+`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{N as y}from"./chunk-PI7OXS62.js";import{f as d,g as m}from"./chunk-KU3YHPWZ.js";var b={high:3,med:2,low:1},R={create:0,evolve:1,"reuse-candidate":2},E=.75;function u(e,s){return!e.superseded.has(s)&&e.trust.get(s)!=="archived"}function S(e,s){return e.edgesInto(s).some(n=>n.type===m.VERIFIES&&u(e,n.src))}function p(e,s="med"){let n=e.risk;return n==="high"||n==="med"||n==="low"?n:s}function l(e,s){return e.displayNameOf(s)??s}function g(e,s){return`kane-cli design tests --use-case ${l(e,s)}`}function _(e,s){let n=(r,o)=>{for(let c of e.edgesFrom(o)){let f=c.type===r?y(e,c.dst):null;if(f!==null&&u(e,f))return f}return null},t=n(m.SCOPED_TO,s);if(!t)return null;let i=e.nodeLabel.get(t);return i===d.USECASE?t:i===d.SCENARIO?n(m.BELONGS_TO,t):null}function w(e,s){let n=_(e,s);return n?g(e,n):G(e,s)}function G(e,s){return`kane-cli design explain ${l(e,s)}`}function h(e,s){let n=e.edgesFrom(s).find(i=>i.type===m.AUTOMATES&&u(e,i.dst));if(!n)return null;let t=e.edgesFrom(n.dst).find(i=>i.type===m.BELONGS_TO&&u(e,i.dst));return t?t.dst:null}function x(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.AC))u(e,n)&&(S(e,n)||s.push({ref:l(e,n),kind:"no-verifies",why:"no live test verifies this acceptance criterion",risk:p(t),stage:"design",tag:"create",ready_command:w(e,n)}));return s}function L(e){let s=[],n=new Map;for(let{cid:t}of e.byLabel(d.SCENARIO))if(u(e,t))for(let i of e.edgesFrom(t)){if(i.type!==m.BELONGS_TO)continue;let r=e.tipOf(i.dst);(n.get(r)??n.set(r,new Set).get(r)).add(t)}for(let{cid:t,content:i}of e.byLabel(d.USECASE)){if(!u(e,t))continue;let r=[...n.get(t)??[]];if(r.length===0){s.push({ref:l(e,t),kind:"zero-scenario",why:"use-case has no scenarios",risk:p(i),stage:"design",tag:"create",ready_command:g(e,t)});continue}r.every(c=>e.getNode(c)?.content.case_type==="happy")&&s.push({ref:l(e,t),kind:"happy-only",why:"use-case is exercised by happy-path scenarios only",risk:p(i),stage:"design",tag:"create",ready_command:g(e,t)})}return s}function C(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.GAP)){if(!u(e,n))continue;let i=t.ref,r=typeof i=="string"?e.resolve(i):null,o=r&&u(e,r.tip)?r.tip:null,c=o?e.nodeLabel.get(o):null,f=t.kind==="reconcile_deferred"?"kane-cli maintain reconcile":c===d.USECASE?g(e,o):c===d.AC?w(e,o):G(e,n),a=t.question&&typeof t.question=="object"?t.question:void 0,v=typeof t.text=="string"&&t.text||(a&&typeof a.header=="string"?a.header:"")||"design gap";s.push({ref:l(e,n),kind:String(t.kind),why:v,risk:p(t),stage:"design",tag:"create",ready_command:f,...typeof t.risk_rationale=="string"?{risk_rationale:t.risk_rationale}:{},...a?{question:a}:{}})}return s}function O(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.AC)){if(!u(e,n))continue;let i=e.stale(n);i==="fresh"||i==="superseded"||s.push({ref:l(e,n),kind:"stale-ac",why:`acceptance criterion is ${i} \u2014 its source moved since this was authored \xB7 why: kane-cli design explain ${l(e,n)}`,risk:p(t),stage:"design",tag:"evolve",ready_command:"kane-cli maintain reconcile"})}for(let{cid:n,content:t}of e.byLabel(d.TEST)){if(!u(e,n))continue;let i=e.stale(n);if(i==="fresh"||i==="superseded")continue;let r=e.edgesFrom(n).filter(k=>k.type===m.VERIFIES&&u(e,k.dst)),o=r.map(k=>p(e.getNode(k.dst)?.content??{})),c=o.includes("high")?"high":o.includes("med")?"med":o.includes("low")?"low":"med",f=r[0]?.dst??null,a=f?null:h(e,n),v=f?w(e,f):a?g(e,a):G(e,n);s.push({ref:l(e,n),kind:"stale-test",why:`test is ${i} \u2014 its source moved since this was authored`,risk:c,stage:"design",tag:"evolve",ready_command:v})}return s}async function A(e,s,n){for(let t of e)if(t.tag==="create"){if(!n){t.meta={embed_arm:"skipped"};continue}try{let i=s.resolve(t.ref),r=i?s.getNode(i.tip):null,o=r&&(String(r.content.title??"")||String(r.content.text??""))||t.why,c=r?.label===d.USECASE?"scenario":"test",a=(await n.searchSimilar(o,{label:c,k:1}))[0];a&&a.score>=E?(t.tag="reuse-candidate",t.meta={embed_arm:"used",near_hit:{ref:l(s,a.cid),score:a.score}}):t.meta={embed_arm:"used",near_hit:null}}catch{t.meta={embed_arm:"skipped"}}}}function T(e,s){let n=b[s.risk]-b[e.risk];if(n!==0)return n;let t=R[e.tag]-R[s.tag];return t!==0?t:e.ref<s.ref?-1:e.ref>s.ref?1:0}function N(e,s){let n=[],t=r=>{let o=y(e,r);return o?p(e.getNode(o)?.content??{}):"med"},i=r=>{let o=y(e,r),c=o?_(e,o):null;return c?l(e,c):r};for(let r of s.usecases??[])for(let o of r.acceptance_criteria??[])(o.covered_by??[]).length>0&&(o.execution==="failed"?n.push({ref:o.id,kind:"execution-failed",stage:"cover",tag:"evolve",risk:t(o.id),why:`covering test failed against this AC (tests: ${(o.covered_by??[]).join(", ")})`,ready_command:`kane-cli maintain evolve ${i(o.id)}`}):o.execution==="blocked"?n.push({ref:o.id,kind:"execution-blocked",stage:"cover",tag:"reuse-candidate",risk:t(o.id),why:"the oracle could not run (infrastructure) \u2014 the covering test exists and is reusable",ready_command:"kane-cli testrun run"}):o.execution==="not-run"&&n.push({ref:o.id,kind:"covered-not-run",stage:"cover",tag:"reuse-candidate",risk:t(o.id),why:"a covering test exists but never joined this pack \u2014 run it",ready_command:"kane-cli testrun run"}));return n}async function U(e,s,n,t){if(s!=="design"&&!t)throw new Error(`gaps-engine: stage "${s}" requires a pack's usecases doc`);let i=[];return(s==="design"||s==="all")&&i.push(...x(e),...L(e),...C(e),...O(e)),(s==="cover"||s==="all")&&i.push(...N(e,t)),await A(i,e,n),i.sort(T),i}export{u as a,S as b,_ as c,U as d};
2
+ import{N as y}from"./chunk-5EAJO372.js";import{f as d,g as m}from"./chunk-KU3YHPWZ.js";var b={high:3,med:2,low:1},R={create:0,evolve:1,"reuse-candidate":2},E=.75;function u(e,s){return!e.superseded.has(s)&&e.trust.get(s)!=="archived"}function S(e,s){return e.edgesInto(s).some(n=>n.type===m.VERIFIES&&u(e,n.src))}function p(e,s="med"){let n=e.risk;return n==="high"||n==="med"||n==="low"?n:s}function l(e,s){return e.displayNameOf(s)??s}function g(e,s){return`kane-cli design tests --use-case ${l(e,s)}`}function _(e,s){let n=(r,o)=>{for(let c of e.edgesFrom(o)){let f=c.type===r?y(e,c.dst):null;if(f!==null&&u(e,f))return f}return null},t=n(m.SCOPED_TO,s);if(!t)return null;let i=e.nodeLabel.get(t);return i===d.USECASE?t:i===d.SCENARIO?n(m.BELONGS_TO,t):null}function w(e,s){let n=_(e,s);return n?g(e,n):G(e,s)}function G(e,s){return`kane-cli design explain ${l(e,s)}`}function h(e,s){let n=e.edgesFrom(s).find(i=>i.type===m.AUTOMATES&&u(e,i.dst));if(!n)return null;let t=e.edgesFrom(n.dst).find(i=>i.type===m.BELONGS_TO&&u(e,i.dst));return t?t.dst:null}function x(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.AC))u(e,n)&&(S(e,n)||s.push({ref:l(e,n),kind:"no-verifies",why:"no live test verifies this acceptance criterion",risk:p(t),stage:"design",tag:"create",ready_command:w(e,n)}));return s}function L(e){let s=[],n=new Map;for(let{cid:t}of e.byLabel(d.SCENARIO))if(u(e,t))for(let i of e.edgesFrom(t)){if(i.type!==m.BELONGS_TO)continue;let r=e.tipOf(i.dst);(n.get(r)??n.set(r,new Set).get(r)).add(t)}for(let{cid:t,content:i}of e.byLabel(d.USECASE)){if(!u(e,t))continue;let r=[...n.get(t)??[]];if(r.length===0){s.push({ref:l(e,t),kind:"zero-scenario",why:"use-case has no scenarios",risk:p(i),stage:"design",tag:"create",ready_command:g(e,t)});continue}r.every(c=>e.getNode(c)?.content.case_type==="happy")&&s.push({ref:l(e,t),kind:"happy-only",why:"use-case is exercised by happy-path scenarios only",risk:p(i),stage:"design",tag:"create",ready_command:g(e,t)})}return s}function C(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.GAP)){if(!u(e,n))continue;let i=t.ref,r=typeof i=="string"?e.resolve(i):null,o=r&&u(e,r.tip)?r.tip:null,c=o?e.nodeLabel.get(o):null,f=t.kind==="reconcile_deferred"?"kane-cli maintain reconcile":c===d.USECASE?g(e,o):c===d.AC?w(e,o):G(e,n),a=t.question&&typeof t.question=="object"?t.question:void 0,v=typeof t.text=="string"&&t.text||(a&&typeof a.header=="string"?a.header:"")||"design gap";s.push({ref:l(e,n),kind:String(t.kind),why:v,risk:p(t),stage:"design",tag:"create",ready_command:f,...typeof t.risk_rationale=="string"?{risk_rationale:t.risk_rationale}:{},...a?{question:a}:{}})}return s}function O(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.AC)){if(!u(e,n))continue;let i=e.stale(n);i==="fresh"||i==="superseded"||s.push({ref:l(e,n),kind:"stale-ac",why:`acceptance criterion is ${i} \u2014 its source moved since this was authored \xB7 why: kane-cli design explain ${l(e,n)}`,risk:p(t),stage:"design",tag:"evolve",ready_command:"kane-cli maintain reconcile"})}for(let{cid:n,content:t}of e.byLabel(d.TEST)){if(!u(e,n))continue;let i=e.stale(n);if(i==="fresh"||i==="superseded")continue;let r=e.edgesFrom(n).filter(k=>k.type===m.VERIFIES&&u(e,k.dst)),o=r.map(k=>p(e.getNode(k.dst)?.content??{})),c=o.includes("high")?"high":o.includes("med")?"med":o.includes("low")?"low":"med",f=r[0]?.dst??null,a=f?null:h(e,n),v=f?w(e,f):a?g(e,a):G(e,n);s.push({ref:l(e,n),kind:"stale-test",why:`test is ${i} \u2014 its source moved since this was authored`,risk:c,stage:"design",tag:"evolve",ready_command:v})}return s}async function A(e,s,n){for(let t of e)if(t.tag==="create"){if(!n){t.meta={embed_arm:"skipped"};continue}try{let i=s.resolve(t.ref),r=i?s.getNode(i.tip):null,o=r&&(String(r.content.title??"")||String(r.content.text??""))||t.why,c=r?.label===d.USECASE?"scenario":"test",a=(await n.searchSimilar(o,{label:c,k:1}))[0];a&&a.score>=E?(t.tag="reuse-candidate",t.meta={embed_arm:"used",near_hit:{ref:l(s,a.cid),score:a.score}}):t.meta={embed_arm:"used",near_hit:null}}catch{t.meta={embed_arm:"skipped"}}}}function T(e,s){let n=b[s.risk]-b[e.risk];if(n!==0)return n;let t=R[e.tag]-R[s.tag];return t!==0?t:e.ref<s.ref?-1:e.ref>s.ref?1:0}function N(e,s){let n=[],t=r=>{let o=y(e,r);return o?p(e.getNode(o)?.content??{}):"med"},i=r=>{let o=y(e,r),c=o?_(e,o):null;return c?l(e,c):r};for(let r of s.usecases??[])for(let o of r.acceptance_criteria??[])(o.covered_by??[]).length>0&&(o.execution==="failed"?n.push({ref:o.id,kind:"execution-failed",stage:"cover",tag:"evolve",risk:t(o.id),why:`covering test failed against this AC (tests: ${(o.covered_by??[]).join(", ")})`,ready_command:`kane-cli maintain evolve ${i(o.id)}`}):o.execution==="blocked"?n.push({ref:o.id,kind:"execution-blocked",stage:"cover",tag:"reuse-candidate",risk:t(o.id),why:"the oracle could not run (infrastructure) \u2014 the covering test exists and is reusable",ready_command:"kane-cli testrun run"}):o.execution==="not-run"&&n.push({ref:o.id,kind:"covered-not-run",stage:"cover",tag:"reuse-candidate",risk:t(o.id),why:"a covering test exists but never joined this pack \u2014 run it",ready_command:"kane-cli testrun run"}));return n}async function U(e,s,n,t){if(s!=="design"&&!t)throw new Error(`gaps-engine: stage "${s}" requires a pack's usecases doc`);let i=[];return(s==="design"||s==="all")&&i.push(...x(e),...L(e),...C(e),...O(e)),(s==="cover"||s==="all")&&i.push(...N(e,t)),await A(i,e,n),i.sort(T),i}export{u as a,S as b,_ as c,U as d};