@testmuai/kane-cli 0.8.23 → 0.9.0

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 (250) hide show
  1. package/dist/{ChatSurface-GBZX4LWL.js → ChatSurface-FJPK3XEJ.js} +1 -1
  2. package/dist/{ChromeProfilePicker-UONX2UVC.js → ChromeProfilePicker-7DUDJTE2.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-6BJCNRNG.js → CliFeedbackPrompt-ZZPYC6OS.js} +1 -1
  4. package/dist/{CliUploadProgress-K4Z22DSY.js → CliUploadProgress-WQYKIBAR.js} +1 -1
  5. package/dist/ConfigView-KXNOODDW.js +2 -0
  6. package/dist/EvidenceViewOffer-BTBVPBZX.js +2 -0
  7. package/dist/FolderPicker-H4YEX5LV.js +2 -0
  8. package/dist/{InfoBox-OU5PLRIL.js → InfoBox-DTM7X24Z.js} +1 -1
  9. package/dist/{LinksBox-DH7TSUXW.js → LinksBox-KFG3FVOT.js} +1 -1
  10. package/dist/{ProfilesView-MGJKBOF5.js → ProfilesView-KBZHT4KL.js} +1 -1
  11. package/dist/{ProjectPicker-YFV6K77F.js → ProjectPicker-OARWULNN.js} +1 -1
  12. package/dist/{SaveSessionPrompt-64QKQB6B.js → SaveSessionPrompt-37SMU5MC.js} +1 -1
  13. package/dist/SingleShotApp-UYCAW65Y.js +2 -0
  14. package/dist/{SummaryBox-DGS3LVRF.js → SummaryBox-6RB5DSAH.js} +1 -1
  15. package/dist/TestMdRunView-ZMOII3PL.js +2 -0
  16. package/dist/{TestrunEvidenceTable-PHBAB4XQ.js → TestrunEvidenceTable-3UP2EYIV.js} +1 -1
  17. package/dist/{WhoamiView-6HWPYN6Y.js → WhoamiView-MC62GERR.js} +1 -1
  18. package/dist/app-client-PQFJAB63.js +2 -0
  19. package/dist/app-download-P6YXWSVQ.js +2 -0
  20. package/dist/{auth-NWBIFCB7.js → auth-LXW4OFKF.js} +1 -1
  21. package/dist/{binary-MOJTQGUV.js → binary-LVHXED3O.js} +1 -1
  22. package/dist/{bind-S3IQTPNN.js → bind-ZYESQSCJ.js} +2 -2
  23. package/dist/{bootstrap-RCV7PNMQ.js → bootstrap-DI4UGMH3.js} +1 -1
  24. package/dist/bridge-7J3JE3JS.js +2 -0
  25. package/dist/catalog-LLME3744.js +2 -0
  26. package/dist/{changelog-2N6HKKKQ.js → changelog-N5AZHXOS.js} +1 -1
  27. package/dist/{chunk-MZ7W4WLF.js → chunk-243ZJHT6.js} +1 -1
  28. package/dist/{chunk-LF42V6P6.js → chunk-2PKME4VT.js} +4 -4
  29. package/dist/{chunk-3OKX64UR.js → chunk-3MCPTVJX.js} +1 -1
  30. package/dist/{chunk-5UHY3PTQ.js → chunk-3YIZG7WZ.js} +1 -1
  31. package/dist/{chunk-TONFENRW.js → chunk-4BZOG6PE.js} +1 -1
  32. package/dist/{chunk-MBJHS653.js → chunk-4CYBXJIA.js} +1 -1
  33. package/dist/{chunk-BASTDR3M.js → chunk-4FHK4LKQ.js} +1 -1
  34. package/dist/{chunk-LNSBC32V.js → chunk-4Y2WH77W.js} +1 -1
  35. package/dist/{chunk-UQSVO7TY.js → chunk-5HMN74RZ.js} +1 -1
  36. package/dist/chunk-5RCS2LIQ.js +26 -0
  37. package/dist/chunk-5TQFOPJV.js +2 -0
  38. package/dist/{chunk-KJIDMW6N.js → chunk-6HU5M2DS.js} +1 -1
  39. package/dist/{chunk-JFZA4UON.js → chunk-6MD7SR7D.js} +1 -1
  40. package/dist/{chunk-J6TBTWW7.js → chunk-6VY62QC2.js} +1 -1
  41. package/dist/{chunk-GFNCGN5V.js → chunk-75MMTNPB.js} +2 -2
  42. package/dist/{chunk-OFRYEWZE.js → chunk-7GAHJZLH.js} +1 -1
  43. package/dist/chunk-7WXMV3O3.js +7 -0
  44. package/dist/{chunk-IIDBLJ5A.js → chunk-AHFIRHSP.js} +1 -1
  45. package/dist/chunk-AJT34ESA.js +38 -0
  46. package/dist/chunk-AKE2CTV6.js +2 -0
  47. package/dist/{chunk-VACHFCNC.js → chunk-AUMJ4RVA.js} +1 -1
  48. package/dist/chunk-BL3SJDCG.js +10 -0
  49. package/dist/chunk-BUPRL2TE.js +2 -0
  50. package/dist/chunk-C25M2J5Q.js +4 -0
  51. package/dist/{chunk-RAARDC2O.js → chunk-C6S2RPZA.js} +1 -1
  52. package/dist/{chunk-3C32LVLX.js → chunk-CNUCP6DK.js} +1 -1
  53. package/dist/chunk-CSNJPD2J.js +5 -0
  54. package/dist/{chunk-2FH4HJYB.js → chunk-CW3RHKLA.js} +1 -1
  55. package/dist/{chunk-J2FJ62K4.js → chunk-DOOI2JBD.js} +1 -1
  56. package/dist/{chunk-2A7OQRAD.js → chunk-DTRKTBCE.js} +4 -4
  57. package/dist/{chunk-QAG67DUT.js → chunk-DTRSYWZE.js} +1 -1
  58. package/dist/{chunk-5HOHXV2K.js → chunk-DWMESHFI.js} +1 -1
  59. package/dist/chunk-EBLXHOE3.js +2 -0
  60. package/dist/{chunk-PXHN7SFG.js → chunk-EOA6YPES.js} +1 -1
  61. package/dist/{chunk-FPFS6OSR.js → chunk-F7NSSQYZ.js} +1 -1
  62. package/dist/chunk-FMUV6UCX.js +2 -0
  63. package/dist/chunk-GCISXCDU.js +2 -0
  64. package/dist/chunk-GFBAK7WQ.js +8 -0
  65. package/dist/{chunk-RMVASIVL.js → chunk-GTVQYT3D.js} +2 -2
  66. package/dist/{chunk-CLQP3DHT.js → chunk-HAYV4D2I.js} +1 -1
  67. package/dist/{chunk-6YZ3VP3E.js → chunk-HG5LLZBU.js} +1 -1
  68. package/dist/chunk-HGFWIBVF.js +8 -0
  69. package/dist/{chunk-3UMVRJX3.js → chunk-ILDHE4P4.js} +2 -2
  70. package/dist/{chunk-QQCEP3QP.js → chunk-IPXKUYUK.js} +1 -1
  71. package/dist/{chunk-D4XR7EEQ.js → chunk-J3BGYSMD.js} +12 -10
  72. package/dist/{chunk-OYKRCDT4.js → chunk-JQY5HRZ4.js} +1 -1
  73. package/dist/{chunk-AGDPEZXT.js → chunk-JX6BFEDO.js} +1 -1
  74. package/dist/chunk-K3IQEL7R.js +7 -0
  75. package/dist/{chunk-5RHR4DMF.js → chunk-KWEOLPBJ.js} +1 -1
  76. package/dist/{chunk-SYJXTB4J.js → chunk-KXEE6VCA.js} +1 -1
  77. package/dist/{chunk-FORNRNHU.js → chunk-LH4IPANP.js} +1 -1
  78. package/dist/{chunk-WICJY6KL.js → chunk-LLG7NEGX.js} +1 -1
  79. package/dist/{chunk-UYI4WPNQ.js → chunk-M3UAZTDK.js} +1 -1
  80. package/dist/{chunk-DUYRCVI5.js → chunk-NMSZ7G6P.js} +1 -1
  81. package/dist/chunk-NOL7MNZH.js +2 -0
  82. package/dist/{chunk-C7NWWGLT.js → chunk-OC6H6BYI.js} +1 -1
  83. package/dist/{chunk-HBSYBL6J.js → chunk-OHOJSADN.js} +1 -1
  84. package/dist/chunk-OIUV3ISA.js +2 -0
  85. package/dist/{chunk-AIK7BAME.js → chunk-OJAXOOZ5.js} +2 -2
  86. package/dist/{chunk-RGRFL7XG.js → chunk-OMNLAGQC.js} +1 -1
  87. package/dist/{chunk-HPHETGRE.js → chunk-OOCCUUR2.js} +1 -1
  88. package/dist/{chunk-SB2SKN34.js → chunk-OXC6O5O7.js} +1 -1
  89. package/dist/chunk-OZQDD2EX.js +94 -0
  90. package/dist/{chunk-D6BULK7E.js → chunk-PCKIANML.js} +1 -1
  91. package/dist/{chunk-RD72POF2.js → chunk-PEDINHVU.js} +1 -1
  92. package/dist/{chunk-MKMJOMLX.js → chunk-PNUAP3RY.js} +2 -2
  93. package/dist/{chunk-2MEQTHNI.js → chunk-Q5CINJYL.js} +1 -1
  94. package/dist/{chunk-SY4T44VC.js → chunk-Q5RDCSYM.js} +1 -1
  95. package/dist/chunk-QAB3Y5FQ.js +4 -0
  96. package/dist/{chunk-WJR2FU7S.js → chunk-RTSBKCZY.js} +1 -1
  97. package/dist/{chunk-K6VDRR3H.js → chunk-RWSOZPJQ.js} +1 -1
  98. package/dist/{chunk-HJGVM6TS.js → chunk-SID4X77D.js} +1 -1
  99. package/dist/chunk-SOCHN2PY.js +2 -0
  100. package/dist/{chunk-NIFJJX6N.js → chunk-SRTKRHYI.js} +1 -1
  101. package/dist/chunk-TM7VRLWS.js +2 -0
  102. package/dist/{chunk-IEW7AW64.js → chunk-UA2QDAWT.js} +1 -1
  103. package/dist/{chunk-ZIHG6EKH.js → chunk-USOYXCZ4.js} +1 -1
  104. package/dist/{chunk-DWHF5HUD.js → chunk-USY7VAO6.js} +1 -1
  105. package/dist/{chunk-AT3RME5W.js → chunk-UWXDURAB.js} +1 -1
  106. package/dist/{chunk-D7WG7SRA.js → chunk-VBS33P2C.js} +1 -1
  107. package/dist/{chunk-YI3H2UIB.js → chunk-VHW7BMZQ.js} +1 -1
  108. package/dist/{chunk-SFFDVF3J.js → chunk-VORWZLS3.js} +2 -2
  109. package/dist/{chunk-DSKJ6J7Y.js → chunk-WDMUPK6I.js} +1 -1
  110. package/dist/{chunk-QGXVQIN5.js → chunk-WMI4P76K.js} +2 -2
  111. package/dist/{chunk-MKQ7ZRDW.js → chunk-WNOC6MQC.js} +1 -1
  112. package/dist/{chunk-XQQHSC7G.js → chunk-WRSIKZ2V.js} +1 -1
  113. package/dist/chunk-X2A6CC6B.js +2 -0
  114. package/dist/{chunk-LNFU4JZ7.js → chunk-XBX643ZD.js} +1 -1
  115. package/dist/{chunk-CAJZQQ3G.js → chunk-XKHWWKJZ.js} +1 -1
  116. package/dist/{chunk-HJX5PQRD.js → chunk-XT7XA4DN.js} +1 -1
  117. package/dist/{chunk-QU7P7B3W.js → chunk-Y3ZYN6AK.js} +3 -3
  118. package/dist/chunk-YBAVDT3G.js +2 -0
  119. package/dist/{chunk-5ESGUPSR.js → chunk-YWYORBY3.js} +1 -1
  120. package/dist/{chunk-IGHK2ENL.js → chunk-Z7IGTVJW.js} +1 -1
  121. package/dist/{chunk-CSVPZ33X.js → chunk-ZC2CKWLB.js} +1 -1
  122. package/dist/{chunk-UF4MU2AZ.js → chunk-ZER3FZSZ.js} +2 -2
  123. package/dist/chunk-ZJYT72BA.js +9 -0
  124. package/dist/{chunk-LHUW5QDT.js → chunk-ZXY4P76I.js} +1 -1
  125. package/dist/{config-7E4NS553.js → config-YGTHSGQN.js} +1 -1
  126. package/dist/cover-cmd-6RO366CC.js +3 -0
  127. package/dist/{credentials-PSQWWFGD.js → credentials-QD32Y7K7.js} +1 -1
  128. package/dist/{deps-bundle-PPOQHJTB.js → deps-bundle-OI7JJ22L.js} +1 -1
  129. package/dist/{deps-resolve-AX6ZAKLH.js → deps-resolve-ZOALDS6H.js} +1 -1
  130. package/dist/device-env-DXDJJMTL.js +2 -0
  131. package/dist/{dispatch-KMWEDMKE.js → dispatch-7EWWQRQ5.js} +1 -1
  132. package/dist/{doctor-XDF3MA4W.js → doctor-TPYPEEUL.js} +1 -1
  133. package/dist/evidence-NPFTBGDF.js +2 -0
  134. package/dist/evolve-cmd-VGVXV6XW.js +2 -0
  135. package/dist/explain-cmd-GOP5TE63.js +9 -0
  136. package/dist/{explain-cmd-JAOHSI4F.js → explain-cmd-M7IX2YNB.js} +1 -1
  137. package/dist/{extract-bind-PLMSZKLZ.js → extract-bind-CKIRLXAJ.js} +2 -2
  138. package/dist/{extract-cmd-RJBHPPF3.js → extract-cmd-3EWLSPGS.js} +1 -1
  139. package/dist/gaps-cmd-WVC5GXQC.js +3 -0
  140. package/dist/{generate-headless-TEDHS3F2.js → generate-headless-6WMJYNI6.js} +2 -2
  141. package/dist/index.js +175 -174
  142. package/dist/ingest-cmd-AECK5T4H.js +2 -0
  143. package/dist/install-ZV3KJZV4.js +2 -0
  144. package/dist/{interactive-bind-XUMKEGAN.js → interactive-bind-IYS6KDOH.js} +3 -3
  145. package/dist/lifecycle-cmd-XCSBELFQ.js +2 -0
  146. package/dist/list-cmd-S4DSN2ET.js +3 -0
  147. package/dist/{list-commands-OHIQFJGQ.js → list-commands-GLNGHPDU.js} +1 -1
  148. package/dist/login-flow-ASUUU7SO.js +2 -0
  149. package/dist/maintenance-cmd-K5KXRIFL.js +2 -0
  150. package/dist/mobile-prompts-ZUZTA3RV.js +2 -0
  151. package/dist/{objective-variable-gate-JALOH6SL.js → objective-variable-gate-CG2KK5UX.js} +1 -1
  152. package/dist/{open-provider-746LLSEO.js → open-provider-YIBB77FE.js} +1 -1
  153. package/dist/persist-recorded-session-EWV56TSZ.js +3 -0
  154. package/dist/pipeline-LAWACB2O.js +2 -0
  155. package/dist/prepare-target-WGPCZKLE.js +2 -0
  156. package/dist/real-device-run-MDLFKFVQ.js +2 -0
  157. package/dist/reconcile-cmd-XFM2ZXUJ.js +2 -0
  158. package/dist/reconcile-deps-V5VLDPYT.js +4 -0
  159. package/dist/reconcile-engine-VZBTMPUK.js +2 -0
  160. package/dist/{recording-banner-TCFFB6KE.js → recording-banner-CJHRPHHF.js} +1 -1
  161. package/dist/registry-3JXQFZEG.js +2 -0
  162. package/dist/{require-project-folder-2224ZMJ5.js → require-project-folder-SE5GVCYJ.js} +1 -1
  163. package/dist/resolve-run-intent-DD4MB6UD.js +2 -0
  164. package/dist/{resolver-GJR2Z7JY.js → resolver-TLO4SRWV.js} +1 -1
  165. package/dist/review-cmd-7EOYQMPE.js +5 -0
  166. package/dist/run-EHUNJPW6.js +2 -0
  167. package/dist/run-OTMPUQSH.js +2 -0
  168. package/dist/run-test-md-KBDEHGXJ.js +17 -0
  169. package/dist/session-target-UMNASXI7.js +2 -0
  170. package/dist/{sessions-cmd-IV25N2L7.js → sessions-cmd-M3SECFKQ.js} +1 -1
  171. package/dist/{skill-installer-T2IOCPET.js → skill-installer-32YYMM4N.js} +1 -1
  172. package/dist/{spawner-HQM2757J.js → spawner-DPT2RLAO.js} +1 -1
  173. package/dist/store-guard-U32JE6JJ.js +2 -0
  174. package/dist/structured-answers-ZI2B6JJE.js +1 -1
  175. package/dist/sync-cmd-3EP7LZGL.js +2 -0
  176. package/dist/sync-setup-SWTBVQEV.js +2 -0
  177. package/dist/tcg-generate-KXU7E2GF.js +2 -0
  178. package/dist/testmd-actions-PEWCPQ5R.js +2 -0
  179. package/dist/testmd-sync-ZWFQWZ2X.js +2 -0
  180. package/dist/token-refresh-QD3OCGJJ.js +2 -0
  181. package/dist/{validate-basic-V7R4RH5M.js → validate-basic-AAIXSAWH.js} +1 -1
  182. package/dist/{variable-receipt-F55CSW5Z.js → variable-receipt-YWNS24TH.js} +1 -1
  183. package/dist/{verdicts-7IUZFXB4.js → verdicts-LAB5BGCC.js} +1 -1
  184. package/dist/{version-check-PUUSB7AY.js → version-check-EHOLX3YH.js} +1 -1
  185. package/dist/{view-cmd-ELDKYRMZ.js → view-cmd-3WHG6MVB.js} +1 -1
  186. package/dist/walk-session-XP4KYFKO.js +2 -0
  187. package/dist/with-telemetry-FJMJQDCM.js +2 -0
  188. package/package.json +11 -11
  189. package/dist/ConfigView-BB22G7JO.js +0 -2
  190. package/dist/EvidenceViewOffer-25IQF3TX.js +0 -2
  191. package/dist/FolderPicker-65JFR2NW.js +0 -2
  192. package/dist/SingleShotApp-VYKUCRVW.js +0 -2
  193. package/dist/TestMdRunView-LKAITAA4.js +0 -2
  194. package/dist/app-client-ZCCNE3RV.js +0 -2
  195. package/dist/app-download-SQ2LYYL7.js +0 -2
  196. package/dist/bridge-O7ENTV4K.js +0 -2
  197. package/dist/chunk-7KRY26OF.js +0 -4
  198. package/dist/chunk-ATYXPCM6.js +0 -6
  199. package/dist/chunk-BL5QHONU.js +0 -2
  200. package/dist/chunk-CXF6AZWY.js +0 -2
  201. package/dist/chunk-DDHGEJJP.js +0 -2
  202. package/dist/chunk-EM3PU2YW.js +0 -2
  203. package/dist/chunk-EYOCNMUM.js +0 -2
  204. package/dist/chunk-FMBPUXWL.js +0 -8
  205. package/dist/chunk-FQJOWUEN.js +0 -2
  206. package/dist/chunk-MV3Q335C.js +0 -7
  207. package/dist/chunk-MWIE6LOZ.js +0 -4
  208. package/dist/chunk-ODU2JSMA.js +0 -8
  209. package/dist/chunk-RAPV3BTA.js +0 -98
  210. package/dist/chunk-TAOHYWEO.js +0 -2
  211. package/dist/chunk-URWWROLS.js +0 -9
  212. package/dist/chunk-VAN7ECN6.js +0 -2
  213. package/dist/chunk-VOYMN2WQ.js +0 -5
  214. package/dist/chunk-X4NUVVCJ.js +0 -26
  215. package/dist/chunk-YFQGOOF7.js +0 -2
  216. package/dist/cover-cmd-6KZX46S2.js +0 -3
  217. package/dist/device-env-TZQDB5T3.js +0 -2
  218. package/dist/evidence-EUIDOVOR.js +0 -2
  219. package/dist/evolve-cmd-QVTGTCJ5.js +0 -2
  220. package/dist/explain-cmd-36SVSHU7.js +0 -9
  221. package/dist/gaps-cmd-3WZPDDYS.js +0 -3
  222. package/dist/ingest-cmd-JDIOPJBN.js +0 -2
  223. package/dist/install-Y3VKFBK3.js +0 -2
  224. package/dist/lifecycle-cmd-FBDRFIOE.js +0 -2
  225. package/dist/list-cmd-TFUACRAM.js +0 -3
  226. package/dist/login-flow-OHNKSVYZ.js +0 -2
  227. package/dist/maintenance-cmd-7OSUIDL4.js +0 -2
  228. package/dist/mobile-prompts-DEVUZRG3.js +0 -2
  229. package/dist/persist-recorded-session-GPP6UKN6.js +0 -3
  230. package/dist/pipeline-QPTPZVUJ.js +0 -2
  231. package/dist/prepare-target-N7QRNYOS.js +0 -2
  232. package/dist/reconcile-cmd-SMGLHMLF.js +0 -2
  233. package/dist/reconcile-deps-DVIJK5UZ.js +0 -4
  234. package/dist/reconcile-engine-KL2J5SNQ.js +0 -2
  235. package/dist/registry-BFFA4YJK.js +0 -2
  236. package/dist/resolve-run-intent-HFXGEOYK.js +0 -2
  237. package/dist/review-cmd-CQE6SBZA.js +0 -5
  238. package/dist/run-BXKWDJFJ.js +0 -2
  239. package/dist/run-HSP2MZPU.js +0 -2
  240. package/dist/run-test-md-2ELPAASM.js +0 -17
  241. package/dist/session-target-UWROGOCY.js +0 -2
  242. package/dist/store-guard-NAW26EEQ.js +0 -2
  243. package/dist/sync-cmd-Q6ZYEVWI.js +0 -2
  244. package/dist/sync-setup-CA362C5S.js +0 -2
  245. package/dist/tcg-generate-CDB2N5LD.js +0 -2
  246. package/dist/testmd-actions-BDWDE2TG.js +0 -2
  247. package/dist/testmd-sync-EPTUVJYJ.js +0 -2
  248. package/dist/token-refresh-TKBOHXSD.js +0 -2
  249. package/dist/walk-session-EGIMA4VG.js +0 -2
  250. package/dist/with-telemetry-LRWWBISP.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{Q as T}from"./chunk-RMVASIVL.js";import"./chunk-LNSBC32V.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import{z as V}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{F as I}from"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import{f,g as x}from"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-CXF6AZWY.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{writeFileSync as ce,mkdirSync as pe}from"fs";import{tmpdir as ue}from"os";import{dirname as fe,join as ge}from"path";var F={DERIVES:"derivation",automates:"linkage",exercises:"mesh",verifies:"mesh",depends_on:"crosslink",reuses:"crosslink",belongs_to:"containment",scoped_to:"containment",annotates:"annotation"},re=(t,r)=>t===f.SOURCE?String(r.source_id??""):t===f.AC?String(r.text??""):t===f.STYLENOTE?String(r.statement??r.text??""):t===f.GAP?String(r.text??r.question??""):String(r.title??"");function H(t){let r=[];for(let[o,p]of t.nodeLabel){let g=t.getNode(o)?.content??{};r.push({cid:o,label:p,slug:p===f.SOURCE?String(g.source_id??""):t.displayNameOf?.(o)??t.nameOf.get(o)??o.slice(0,19),trust:t.trust.get(o)??"derived",fresh:t.stale(o),title:re(p,g),content:g,superseded:t.superseded.has(o)})}let e=new Map;for(let[o]of t.nodeLabel)for(let p of t.edgesFrom(o)){let g=`${p.type}|${p.src}|${p.dst}`,v=typeof p.props?.anchor=="string"?p.props.anchor:void 0,w=e.get(g);w?(w.count++,v&&w.anchors.push(v)):e.set(g,{key:g,type:p.type,family:F[p.type]??"mesh",src:p.src,dst:p.dst,count:1,anchors:v?[v]:[],container:F[p.type]==="containment"})}let s=[...e.values()],i={},l={trusted:0,derived:0,archived:0},d={fresh:0,stale:0,orphaned:0,superseded:0},a=0;for(let o of r)o.superseded||(a++,i[o.label]=(i[o.label]??0)+1,o.label!==f.SOURCE&&l[o.trust]++,d[o.fresh]++);return{nodes:r,edges:s,summary:{nodes:a,edges:s.reduce((o,p)=>o+p.count,0),byLabel:i,trust:l,fresh:d,usecases:i[f.USECASE]??0,designed:0}}}var P=/^([a-z]+)-(\d+)$/,E=(t,r)=>{let e=P.exec(t),s=P.exec(r);return e&&s&&e[1]===s[1]?Number(e[2])-Number(s[2]):t<r?-1:t>r?1:0};function se(t,r,e){let s=new Set,i=d=>{let a=e.nodeLabel.get(d);if(a===f.USECASE)s.add(d);else if(a===f.SCENARIO)for(let o of e.edgesFrom(d))o.type===x.BELONGS_TO&&s.add(o.dst)},l=e.edgesFrom(t);if(r===f.SCENARIO)for(let d of l)d.type===x.BELONGS_TO&&s.add(d.dst);if(r===f.AC)for(let d of l)d.type===x.SCOPED_TO&&i(d.dst);if(r===f.TEST)for(let d of l)d.type===x.AUTOMATES&&i(d.dst);return s}function G(t,r){let e=new Map,s=t.nodes.filter(a=>a.label===f.USECASE).map(a=>a.cid),i=s.map(a=>({ucCid:a,slug:r.nameOf.get(a)??a.slice(0,19),designed:r.designOf.has(a),nodeCids:[a]})).sort((a,o)=>E(a.slug,o.slug)),l={ucCid:"__shared__",slug:"cross-cutting",designed:!1,nodeCids:[]},d=new Map(i.map(a=>[a.ucCid,a]));for(let a of s)e.set(a,a);for(let a of t.nodes){if(a.label===f.SOURCE||a.label===f.USECASE)continue;let o=se(a.cid,a.label,r);if(o.size===1){let p=[...o][0];e.set(a.cid,p),d.get(p).nodeCids.push(a.cid)}else e.set(a.cid,"__shared__"),l.nodeCids.push(a.cid)}return{laneOf:e,lanes:[...i,l]}}var N={source:0,usecase:1,scenario:2,ac:3,test:4,stylenote:5,gap:5},ie=6,z=260,R=64,B=28;function U(t,r,e){let{lanes:s}=r,i=new Map(t.nodes.map(n=>[n.cid,n])),l=new Map,d=[],a=[],o=n=>{let m=n.map(h=>l.get(h)).filter(h=>h!==void 0);return m.length?m.reduce((h,S)=>h+S,0)/m.length:Number.MAX_SAFE_INTEGER},p=s.filter(n=>n.ucCid!=="__shared__"||n.nodeCids.length>0),g=t.nodes.filter(n=>n.label===f.SOURCE).sort((n,m)=>E(n.slug,m.slug)),v=0;for(let n of p){let m=n.nodeCids.map(c=>i.get(c)).filter(Boolean),h=c=>m.filter(u=>u.label===c),S=h(f.USECASE).sort((c,u)=>E(c.slug,u.slug));S.forEach((c,u)=>l.set(c.cid,u));let D=h(f.SCENARIO).sort((c,u)=>E(c.slug,u.slug));D.forEach((c,u)=>l.set(c.cid,u));let M=h(f.AC).sort((c,u)=>{let _=o(e.edgesInto(c.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src)),O=o(e.edgesInto(u.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src));return _-O||E(c.slug,u.slug)});M.forEach((c,u)=>l.set(c.cid,u));let j=h(f.TEST).sort((c,u)=>{let _=o(e.edgesFrom(c.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst)),O=o(e.edgesFrom(u.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst));return _-O||E(c.slug,u.slug)});j.forEach((c,u)=>l.set(c.cid,u));let q=m.filter(c=>N[c.label]===void 0||N[c.label]>=5).sort((c,u)=>E(c.slug,u.slug));q.forEach((c,u)=>l.set(c.cid,u));let A=Math.max(1,S.length,D.length,M.length,j.length,q.length)*R+B;for(let c of m){let u=N[c.label]??4,_=l.get(c.cid)??0;d.push({...c,lane:n.ucCid,col:u,x:u*z,y:v+B/2+_*R})}a.push({...n,y0:v,y1:v+A}),v+=A}let w=Math.max(v,R);g.forEach((n,m)=>d.push({...n,lane:"__spine__",col:0,x:0,y:w/(g.length+1)*(m+1)}));let L=ie*z;return{nodes:d,lanes:a,width:L,height:w}}function ae(t){return t.design_of?"design":t.review.length>0?"review":t.nodes.some(r=>r.label==="source")?"ingest":t.nodes.length>0?"extract":"other"}function $(t){let r=new Map,e=new Map,s=[];for(let i of t){for(let n of i.nodes)r.has(n.cid)||r.set(n.cid,i.seq);let l=new Map(e);for(let n of i.nodes)n.content?.derived===!0&&!e.has(n.cid)&&e.set(n.cid,"derived");for(let n of i.review)n.resolution==="approved"||n.resolution==="edited"?e.set(n.id,"trusted"):n.resolution==="rejected"?e.set(n.id,"archived"):n.resolution==="reset"&&e.set(n.id,"derived");let d=n=>{let m=0;for(let[h,S]of e)S===n&&l.get(h)!==n&&m++;return m},a=0;for(let[n,m]of e){let h=l.get(n);m==="derived"&&(h==="trusted"||h==="archived")&&a++}let o={trusted:d("trusted"),archived:d("archived"),reset:a},p=ae(i),g=i.nodes.map(n=>n.cid),v=i.edges.map(n=>`${n.type}|${n.src}|${n.dst}`),w=i.review.map(n=>n.id),L=p==="review"?"review \xB7 +"+o.trusted+" trusted"+(o.archived?", +"+o.archived+" archived":""):p+" \xB7 +"+g.length+" nodes";s.push({seq:i.seq,ts:i.ts,kind:p,label:L,mintedNodeCids:g,mintedEdgeKeys:v,reviewedNodeCids:w,trustDelta:o})}return{commits:s,bornSeq:r}}function Y(t,r,e){let s=[];for(let i of t){i.nodes.some(l=>l.cid===r)&&s.push({seq:i.seq,ts:i.ts,kind:"minted",detail:"minted here"});for(let l of i.review)l.id===r&&s.push({seq:i.seq,ts:i.ts,kind:"review",detail:l.resolution+(l.reason?": "+l.reason:"")})}return e.length&&s.push({seq:0,ts:"",kind:"derived_from",detail:"source lines "+e.join(", ")}),s}var oe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function k(t){return String(t).replace(/[&<>"']/g,r=>oe[r])}var W=t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"),de=new RegExp("[\u2028\u2029]","g");function X(t){return t.replace(/[<>&]/g,W).replace(de,W)}var K=t=>t.replace("sha256:","").slice(0,12);function J(t){if(!t||typeof t!="object")return"";let r=String(t.operator??""),e=t.operand!=null?String(t.operand):"",s=t.unit!=null?" "+String(t.unit):"",i=t.baseline!=null?String(t.baseline):"",l=t.within&&typeof t.within=="object"?t.within:null,d;switch(r){case"exists":d="exists: "+e;break;case"forall":d="for all "+e;break;case"contains":d="contains "+e;break;case"gte":d=">= "+e+s;break;case"lte":d="<= "+e+s;break;case"equals":d="= "+e+s+(i?" (was "+i+")":"");break;case"changed-by":d="changed by "+e+s;break;default:d=(r+" "+e+s).trim()}if(l){let a=l.threshold!=null?String(l.threshold):"",o=l.unit!=null?String(l.unit):"";(a||o)&&(d+=" within "+a+o)}return d.trim()}var C=t=>t==null||t===""?"":`<span class="chip">${k(t)}</span>`,y=(t,r)=>r==null||r===""?"":`<div class="kv"><span class="k">${k(t)}</span><span class="v">${k(r)}</span></div>`,le=t=>Array.isArray(t)&&t.length?`<ul class="crit">${t.map(r=>`<li>${k(r)}</li>`).join("")}</ul>`:"";function Q(t,r){let e=r??{};switch(t){case"usecase":return[y("description",e.description),y("value",e.value),[C(e.risk?"risk: "+e.risk:""),...Array.isArray(e.actors)?e.actors.map(s=>C(s)):[]].join(""),le(e.criteria)].join("");case"scenario":return[y("intent",e.intent),[C(e.case_type)].join(""),e.parameters&&typeof e.parameters=="object"?Object.entries(e.parameters).map(([s,i])=>y(s,i)).join(""):"",y("techniques",e.technique_notes)].join("");case"ac":return[y("",e.text),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),(()=>{let s=J(e.expected_answer);return s?`<div class="pred">${k(s)}</div>`:""})()].join("");case"test":{let s=J(e.check),i=e.test_md_blob!=null?`<pre class="md">${k(String(e.test_md_blob))}</pre>`:"";return[s?`<div class="pred">${k(s)}</div>`:"",y("definitionId",e.definitionId),i].join("")}case"source":return[y("source_id",e.source_id),y("blob",e.blob)].join("");case"stylenote":return[e.statement?`<div class="pred">${k(e.statement)}</div>`:"",[C(e.learned_from_kind?"learned from: "+e.learned_from_kind:"")].join(""),y("",e.text),Array.isArray(e.tags)?e.tags.map(s=>C(s)).join(""):""].join("");case"gap":return[y("",e.text??e.question),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),y("why",e.risk_rationale),y("ref",e.ref)].join("");default:return""}}function Z(t,r,e,s){let i=H(t),l=G(i,t),d=U(i,l,t),{commits:a}=$(r);i.summary.designed=l.lanes.filter(n=>n.designed&&n.ucCid!=="__shared__").length;let o={},p={};for(let n of i.nodes){o[n.cid]=Q(n.label,n.content);let m=t.edgesInto(n.cid).filter(h=>h.type===x.DERIVES&&typeof h.props?.anchor=="string").map(h=>h.props.anchor);p[n.cid]=Y(r,n.cid,m)}let g=d.nodes.map(n=>({cid:n.cid,slug:n.slug,label:n.label,trust:n.trust,fresh:n.fresh,title:n.title,superseded:n.superseded,lane:n.lane,col:n.col,x:n.x,y:n.y})),v=d.lanes.map(n=>({ucCid:n.ucCid,slug:n.slug,designed:n.designed,y0:n.y0,y1:n.y1})),L=i.nodes.some(n=>n.label===f.SOURCE)?{}:void 0;return{meta:{fromSeq:r[0]?.seq??0,tipHash:e[e.length-1]??null,storePath:s,schema:"assurance/context@1",asOf:r[r.length-1]?.ts??null},summary:i.summary,lanes:v,nodes:g,edges:i.edges,commits:a,lineage:p,contentHtml:o,width:d.width,height:d.height,source:L}}var ee="__PAYLOAD__",te=`<!doctype html>
2
+ import{Q as T}from"./chunk-GTVQYT3D.js";import"./chunk-4Y2WH77W.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-OMNLAGQC.js";import"./chunk-VVOKM2VO.js";import"./chunk-HGFWIBVF.js";import"./chunk-VZ7KXRXB.js";import{z as V}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import{F as I}from"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import{f,g as x}from"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-CH273NAE.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-FMUV6UCX.js";import"./chunk-NOL7MNZH.js";import"./chunk-5TQFOPJV.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{writeFileSync as ce,mkdirSync as pe}from"fs";import{tmpdir as ue}from"os";import{dirname as fe,join as ge}from"path";var F={DERIVES:"derivation",automates:"linkage",exercises:"mesh",verifies:"mesh",depends_on:"crosslink",reuses:"crosslink",belongs_to:"containment",scoped_to:"containment",annotates:"annotation"},re=(t,r)=>t===f.SOURCE?String(r.source_id??""):t===f.AC?String(r.text??""):t===f.STYLENOTE?String(r.statement??r.text??""):t===f.GAP?String(r.text??r.question??""):String(r.title??"");function H(t){let r=[];for(let[o,p]of t.nodeLabel){let g=t.getNode(o)?.content??{};r.push({cid:o,label:p,slug:p===f.SOURCE?String(g.source_id??""):t.displayNameOf?.(o)??t.nameOf.get(o)??o.slice(0,19),trust:t.trust.get(o)??"derived",fresh:t.stale(o),title:re(p,g),content:g,superseded:t.superseded.has(o)})}let e=new Map;for(let[o]of t.nodeLabel)for(let p of t.edgesFrom(o)){let g=`${p.type}|${p.src}|${p.dst}`,v=typeof p.props?.anchor=="string"?p.props.anchor:void 0,w=e.get(g);w?(w.count++,v&&w.anchors.push(v)):e.set(g,{key:g,type:p.type,family:F[p.type]??"mesh",src:p.src,dst:p.dst,count:1,anchors:v?[v]:[],container:F[p.type]==="containment"})}let s=[...e.values()],i={},l={trusted:0,derived:0,archived:0},d={fresh:0,stale:0,orphaned:0,superseded:0},a=0;for(let o of r)o.superseded||(a++,i[o.label]=(i[o.label]??0)+1,o.label!==f.SOURCE&&l[o.trust]++,d[o.fresh]++);return{nodes:r,edges:s,summary:{nodes:a,edges:s.reduce((o,p)=>o+p.count,0),byLabel:i,trust:l,fresh:d,usecases:i[f.USECASE]??0,designed:0}}}var P=/^([a-z]+)-(\d+)$/,E=(t,r)=>{let e=P.exec(t),s=P.exec(r);return e&&s&&e[1]===s[1]?Number(e[2])-Number(s[2]):t<r?-1:t>r?1:0};function se(t,r,e){let s=new Set,i=d=>{let a=e.nodeLabel.get(d);if(a===f.USECASE)s.add(d);else if(a===f.SCENARIO)for(let o of e.edgesFrom(d))o.type===x.BELONGS_TO&&s.add(o.dst)},l=e.edgesFrom(t);if(r===f.SCENARIO)for(let d of l)d.type===x.BELONGS_TO&&s.add(d.dst);if(r===f.AC)for(let d of l)d.type===x.SCOPED_TO&&i(d.dst);if(r===f.TEST)for(let d of l)d.type===x.AUTOMATES&&i(d.dst);return s}function G(t,r){let e=new Map,s=t.nodes.filter(a=>a.label===f.USECASE).map(a=>a.cid),i=s.map(a=>({ucCid:a,slug:r.nameOf.get(a)??a.slice(0,19),designed:r.designOf.has(a),nodeCids:[a]})).sort((a,o)=>E(a.slug,o.slug)),l={ucCid:"__shared__",slug:"cross-cutting",designed:!1,nodeCids:[]},d=new Map(i.map(a=>[a.ucCid,a]));for(let a of s)e.set(a,a);for(let a of t.nodes){if(a.label===f.SOURCE||a.label===f.USECASE)continue;let o=se(a.cid,a.label,r);if(o.size===1){let p=[...o][0];e.set(a.cid,p),d.get(p).nodeCids.push(a.cid)}else e.set(a.cid,"__shared__"),l.nodeCids.push(a.cid)}return{laneOf:e,lanes:[...i,l]}}var N={source:0,usecase:1,scenario:2,ac:3,test:4,stylenote:5,gap:5},ie=6,z=260,R=64,B=28;function U(t,r,e){let{lanes:s}=r,i=new Map(t.nodes.map(n=>[n.cid,n])),l=new Map,d=[],a=[],o=n=>{let m=n.map(h=>l.get(h)).filter(h=>h!==void 0);return m.length?m.reduce((h,S)=>h+S,0)/m.length:Number.MAX_SAFE_INTEGER},p=s.filter(n=>n.ucCid!=="__shared__"||n.nodeCids.length>0),g=t.nodes.filter(n=>n.label===f.SOURCE).sort((n,m)=>E(n.slug,m.slug)),v=0;for(let n of p){let m=n.nodeCids.map(c=>i.get(c)).filter(Boolean),h=c=>m.filter(u=>u.label===c),S=h(f.USECASE).sort((c,u)=>E(c.slug,u.slug));S.forEach((c,u)=>l.set(c.cid,u));let D=h(f.SCENARIO).sort((c,u)=>E(c.slug,u.slug));D.forEach((c,u)=>l.set(c.cid,u));let M=h(f.AC).sort((c,u)=>{let _=o(e.edgesInto(c.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src)),O=o(e.edgesInto(u.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src));return _-O||E(c.slug,u.slug)});M.forEach((c,u)=>l.set(c.cid,u));let j=h(f.TEST).sort((c,u)=>{let _=o(e.edgesFrom(c.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst)),O=o(e.edgesFrom(u.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst));return _-O||E(c.slug,u.slug)});j.forEach((c,u)=>l.set(c.cid,u));let q=m.filter(c=>N[c.label]===void 0||N[c.label]>=5).sort((c,u)=>E(c.slug,u.slug));q.forEach((c,u)=>l.set(c.cid,u));let A=Math.max(1,S.length,D.length,M.length,j.length,q.length)*R+B;for(let c of m){let u=N[c.label]??4,_=l.get(c.cid)??0;d.push({...c,lane:n.ucCid,col:u,x:u*z,y:v+B/2+_*R})}a.push({...n,y0:v,y1:v+A}),v+=A}let w=Math.max(v,R);g.forEach((n,m)=>d.push({...n,lane:"__spine__",col:0,x:0,y:w/(g.length+1)*(m+1)}));let L=ie*z;return{nodes:d,lanes:a,width:L,height:w}}function ae(t){return t.design_of?"design":t.review.length>0?"review":t.nodes.some(r=>r.label==="source")?"ingest":t.nodes.length>0?"extract":"other"}function $(t){let r=new Map,e=new Map,s=[];for(let i of t){for(let n of i.nodes)r.has(n.cid)||r.set(n.cid,i.seq);let l=new Map(e);for(let n of i.nodes)n.content?.derived===!0&&!e.has(n.cid)&&e.set(n.cid,"derived");for(let n of i.review)n.resolution==="approved"||n.resolution==="edited"?e.set(n.id,"trusted"):n.resolution==="rejected"?e.set(n.id,"archived"):n.resolution==="reset"&&e.set(n.id,"derived");let d=n=>{let m=0;for(let[h,S]of e)S===n&&l.get(h)!==n&&m++;return m},a=0;for(let[n,m]of e){let h=l.get(n);m==="derived"&&(h==="trusted"||h==="archived")&&a++}let o={trusted:d("trusted"),archived:d("archived"),reset:a},p=ae(i),g=i.nodes.map(n=>n.cid),v=i.edges.map(n=>`${n.type}|${n.src}|${n.dst}`),w=i.review.map(n=>n.id),L=p==="review"?"review \xB7 +"+o.trusted+" trusted"+(o.archived?", +"+o.archived+" archived":""):p+" \xB7 +"+g.length+" nodes";s.push({seq:i.seq,ts:i.ts,kind:p,label:L,mintedNodeCids:g,mintedEdgeKeys:v,reviewedNodeCids:w,trustDelta:o})}return{commits:s,bornSeq:r}}function Y(t,r,e){let s=[];for(let i of t){i.nodes.some(l=>l.cid===r)&&s.push({seq:i.seq,ts:i.ts,kind:"minted",detail:"minted here"});for(let l of i.review)l.id===r&&s.push({seq:i.seq,ts:i.ts,kind:"review",detail:l.resolution+(l.reason?": "+l.reason:"")})}return e.length&&s.push({seq:0,ts:"",kind:"derived_from",detail:"source lines "+e.join(", ")}),s}var oe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function k(t){return String(t).replace(/[&<>"']/g,r=>oe[r])}var W=t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"),de=new RegExp("[\u2028\u2029]","g");function X(t){return t.replace(/[<>&]/g,W).replace(de,W)}var K=t=>t.replace("sha256:","").slice(0,12);function J(t){if(!t||typeof t!="object")return"";let r=String(t.operator??""),e=t.operand!=null?String(t.operand):"",s=t.unit!=null?" "+String(t.unit):"",i=t.baseline!=null?String(t.baseline):"",l=t.within&&typeof t.within=="object"?t.within:null,d;switch(r){case"exists":d="exists: "+e;break;case"forall":d="for all "+e;break;case"contains":d="contains "+e;break;case"gte":d=">= "+e+s;break;case"lte":d="<= "+e+s;break;case"equals":d="= "+e+s+(i?" (was "+i+")":"");break;case"changed-by":d="changed by "+e+s;break;default:d=(r+" "+e+s).trim()}if(l){let a=l.threshold!=null?String(l.threshold):"",o=l.unit!=null?String(l.unit):"";(a||o)&&(d+=" within "+a+o)}return d.trim()}var C=t=>t==null||t===""?"":`<span class="chip">${k(t)}</span>`,y=(t,r)=>r==null||r===""?"":`<div class="kv"><span class="k">${k(t)}</span><span class="v">${k(r)}</span></div>`,le=t=>Array.isArray(t)&&t.length?`<ul class="crit">${t.map(r=>`<li>${k(r)}</li>`).join("")}</ul>`:"";function Q(t,r){let e=r??{};switch(t){case"usecase":return[y("description",e.description),y("value",e.value),[C(e.risk?"risk: "+e.risk:""),...Array.isArray(e.actors)?e.actors.map(s=>C(s)):[]].join(""),le(e.criteria)].join("");case"scenario":return[y("intent",e.intent),[C(e.case_type)].join(""),e.parameters&&typeof e.parameters=="object"?Object.entries(e.parameters).map(([s,i])=>y(s,i)).join(""):"",y("techniques",e.technique_notes)].join("");case"ac":return[y("",e.text),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),(()=>{let s=J(e.expected_answer);return s?`<div class="pred">${k(s)}</div>`:""})()].join("");case"test":{let s=J(e.check),i=e.test_md_blob!=null?`<pre class="md">${k(String(e.test_md_blob))}</pre>`:"";return[s?`<div class="pred">${k(s)}</div>`:"",y("definitionId",e.definitionId),i].join("")}case"source":return[y("source_id",e.source_id),y("blob",e.blob)].join("");case"stylenote":return[e.statement?`<div class="pred">${k(e.statement)}</div>`:"",[C(e.learned_from_kind?"learned from: "+e.learned_from_kind:"")].join(""),y("",e.text),Array.isArray(e.tags)?e.tags.map(s=>C(s)).join(""):""].join("");case"gap":return[y("",e.text??e.question),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),y("why",e.risk_rationale),y("ref",e.ref)].join("");default:return""}}function Z(t,r,e,s){let i=H(t),l=G(i,t),d=U(i,l,t),{commits:a}=$(r);i.summary.designed=l.lanes.filter(n=>n.designed&&n.ucCid!=="__shared__").length;let o={},p={};for(let n of i.nodes){o[n.cid]=Q(n.label,n.content);let m=t.edgesInto(n.cid).filter(h=>h.type===x.DERIVES&&typeof h.props?.anchor=="string").map(h=>h.props.anchor);p[n.cid]=Y(r,n.cid,m)}let g=d.nodes.map(n=>({cid:n.cid,slug:n.slug,label:n.label,trust:n.trust,fresh:n.fresh,title:n.title,superseded:n.superseded,lane:n.lane,col:n.col,x:n.x,y:n.y})),v=d.lanes.map(n=>({ucCid:n.ucCid,slug:n.slug,designed:n.designed,y0:n.y0,y1:n.y1})),L=i.nodes.some(n=>n.label===f.SOURCE)?{}:void 0;return{meta:{fromSeq:r[0]?.seq??0,tipHash:e[e.length-1]??null,storePath:s,schema:"assurance/context@1",asOf:r[r.length-1]?.ts??null},summary:i.summary,lanes:v,nodes:g,edges:i.edges,commits:a,lineage:p,contentHtml:o,width:d.width,height:d.height,source:L}}var ee="__PAYLOAD__",te=`<!doctype html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="utf-8">
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as ve}from"./chunk-Q4YYAN6E.js";import{c as he}from"./chunk-K2UJYY2U.js";import{k as ge}from"./chunk-PNUAP3RY.js";import{a as ie,c as ne,d as pe}from"./chunk-OJAXOOZ5.js";import"./chunk-Q6AHSGOE.js";import"./chunk-LDPLJFCV.js";import{a as Z}from"./chunk-A2SQD2AY.js";import"./chunk-KJQNAOOE.js";import"./chunk-LSDWPG6C.js";import{a as re,b as ce,c as le,d as N,f as G,g as de,i as ue,k as me,l as fe}from"./chunk-OOCCUUR2.js";import{a as ee,b as te}from"./chunk-UJZZDPDY.js";import{a as Y}from"./chunk-RRY5IXOB.js";import"./chunk-RKXHVP2Z.js";import"./chunk-5ZFOKYFB.js";import"./chunk-BZAGVBCX.js";import"./chunk-FY7TCYPK.js";import"./chunk-KDNNMU7Q.js";import"./chunk-GTVQYT3D.js";import{b as Q}from"./chunk-4Y2WH77W.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-5Y2G4NC7.js";import"./chunk-WESMQEPO.js";import"./chunk-OMNLAGQC.js";import"./chunk-VVOKM2VO.js";import"./chunk-HGFWIBVF.js";import"./chunk-VZ7KXRXB.js";import{z as _}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-CH273NAE.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{a as se}from"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-FMUV6UCX.js";import"./chunk-NOL7MNZH.js";import{y as h}from"./chunk-5TQFOPJV.js";import"./chunk-DFS4RMVP.js";import{a as K}from"./chunk-HCBYKLMW.js";import{a as F,b as x,k as ae}from"./chunk-C44QQJR4.js";import{a as Ie}from"./chunk-6YGTRKDT.js";import{e as U}from"./chunk-UR6MHSHU.js";var R=U(Ie(),1);function ke(t){let v=t.by??{kind:"human",id:process.env.USER??"operator"},k=t.mode==="interactive"?"override":t.mode,A=k==="override"?{note:"override \xB7 auto-answers, won't ask"}:{},M=(r,n)=>ee(t.onChild,{verb:"design",subject:r,...A,fixCmd:`kane-cli design tests --use-case ${r}`},n,l=>({ok:l===0,exitCode:l})),P=(r,n,l)=>ee(t.onChild,{verb:"evolve",subject:r,...A,fixCmd:`kane-cli maintain evolve ${n}`},l,a=>({ok:a.outcome==="evolved",exitCode:a.code})),S={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},u={applied:0,committed:0,retired:0,skipped:0,deferred:0,failed:0},w=new Map;for(let r of t.planRows)if(r.held_ref&&t.held){let n=t.held.rows.find(a=>a.temp_ref===r.held_ref);if(!n)continue;let l={kind:n.kind,ref:n.temp_ref,title:n.title,why:n.why,origin:"content-change",...r.impact?{impact:r.impact}:{}};w.set(l.ref,{card:l,source:"held",heldRef:n.temp_ref})}else if(r.kind==="MODIFY"){let n={kind:"MODIFY",ref:r.ref,title:r.ref,why:`${r.reason}: ${r.provenance}`,origin:r.origin??"structural-stale",...r.impact?{impact:r.impact}:{}};w.set(n.ref,{card:n,source:"row",row:r})}else if(r.kind==="ADD"){let n={kind:"ADD",ref:r.ref,title:r.ref,why:r.reason,origin:r.origin??"content-change"};w.set(n.ref,{card:n,source:"row",row:r})}for(let r of t.archive){if(r.kind!=="ARCHIVE")continue;let n={kind:"ARCHIVE",ref:r.ref,title:r.ref,why:r.why,provenance:r.why,...r.impact?{impact:r.impact}:{}};w.set(n.ref,{card:n,source:"archive",row:r})}for(let r of t.reviewFeeder?.()??[]){if(w.has(r.ref))continue;let n={kind:r.kind==="MODIFY_HELD"?"MODIFY":r.kind,ref:r.ref,title:r.title,why:r.why,...r.impact?{impact:r.impact}:{},...r.pair?{pair:r.pair}:{},...r.held?{held:!0}:{},...r.kind==="MODIFY_HELD"?{heldPayload:!0}:{}};w.set(n.ref,{card:n,source:"review",reviewCard:r})}let y=r=>(u.failed++,{outcome:"failed",detail:r});return{cards:()=>[...w.values()].map(r=>r.card),async submit(r,n){let l=w.get(r);if(!l)return y(`no card ${r}`);if(l.source==="review"){if(l.reviewCard.kind==="PAIR"&&n.v==="approve")return y(`${r} is a PAIR card \u2014 approve is not in its grammar (merge / keep both / defer); words ride a defer note`);let{submitReview:s}=await import("./verdicts-LAB5BGCC.js"),b=n.v==="approve"?{v:"approve"}:n.v==="archive"?{v:"archive",because:n.because??""}:n.v==="skip"&&l.reviewCard.kind==="MODIFY_HELD"?{v:"keep_current"}:n.v==="defer"||n.v==="skip"?{v:"defer"}:n.v==="merge"?{v:"merge"}:{v:"keep_both"},g=await s({contextDir:t.contextDir,signals:o=>t.signals({ref:o.ref,verdict:o.verdict,...o.reason?{reason:o.reason}:{}})},l.reviewCard,b,v);return g.outcome==="failed"?(u.failed++,g):g.outcome==="deferred"?(u.deferred++,n.v==="defer"&&n.note?(t.signals({ref:r,verdict:"deferred-with-note",reason:n.note}),{...g,detail:`steering noted: "${n.note}" \u2014 decide ${l.reviewCard.kind==="PAIR"?"merge / keep both":"the verdict"} when it re-offers`}):g):g.outcome==="retired"?(u.retired++,g):g.outcome==="committed"?(u.committed++,g):(u.applied++,g)}if(n.v==="merge"||n.v==="keep_both")return y(`${r} is a ${l.card.kind} card \u2014 ${n.v} applies to review cards only`);if(n.v==="skip")return u.skipped++,t.signals({ref:r,verdict:"gap-dismissed"}),{outcome:"skipped"};if(n.v==="defer")return u.deferred++,n.note?(t.signals({ref:r,verdict:"deferred-with-note",reason:n.note}),{outcome:"deferred",detail:`steering noted: "${n.note}"`}):{outcome:"deferred"};if(n.v==="archive"){if(l.source!=="archive")return y(`${r} is not an ARCHIVE card`);let s=_(t.contextDir),b=s.resolve(l.row.ref);if(b&&s.superseded.has(s.tipOf(b.cid)))return u.skipped++,{outcome:"skipped",detail:"already retired \u2014 nothing to do"};let g=ve(t.contextDir,_(t.contextDir),{ref:l.row.ref,reason:`reconcile retire: ${l.row.why}`,by:v});return g.errors?y(g.errors.map(o=>`${o.code}: ${o.detail}`).join("; ")):(u.retired++,t.signals({ref:r,verdict:"gap-resolved-archive",reason:l.row.why}),{outcome:"retired"})}if(l.source==="archive")return y(`${r} takes archive/skip/defer, not approve`);if(l.source==="held"){let s=ge(t.contextDir,t.held,l.heldRef,v,n.edits);if(!s.ok)return y(s.message);if(s.kind==="ADD"){let b=await M(s.ref,()=>t.runDesign(s.ref,{yes:!0,mode:k,...n.steering?{because:n.steering}:{}}));return b!==0?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its design run exited ${b} \u2014 finish with kane-cli design tests --use-case ${s.ref}`}):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-create",...n.steering?{reason:n.steering}:{}}),{outcome:"applied",detail:s.ref})}if(n.steering){let b=_(t.contextDir),g=ie(b,s.ref);if(!g.ok)return u.committed++,{outcome:"committed",detail:`committed ${s.ref}, but steering could not resolve it (${g.message}) \u2014 steer via kane-cli maintain evolve ${s.ref}`};let o=await P(g.target.display,s.ref,()=>ne(t.contextDir,g.target,{yes:!0,mode:k,because:n.steering},S,t.runDesign,"batch"));if(o.outcome==="no-design"){let c=await M(g.target.seamRef,()=>t.runDesign(g.target.seamRef,{yes:!0,mode:k,because:n.steering}));return c!==0?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its steered design run exited ${c} \u2014 finish with kane-cli design tests --use-case ${g.target.seamRef}`}):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-create",reason:n.steering}),{outcome:"applied",detail:s.ref})}return o.outcome==="failed"||o.outcome==="paused"?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but the steering evolve ${o.outcome} (exit ${o.code}) \u2014 finish with kane-cli maintain evolve ${s.ref}`}):o.outcome==="declined"?(u.committed++,{outcome:"committed",detail:`committed ${s.ref} \u2014 the steering evolve was declined; re-run kane-cli maintain evolve ${s.ref}`}):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-evolve",reason:n.steering}),{outcome:"applied",detail:s.ref})}return u.committed++,t.signals({ref:r,verdict:"gap-resolved-evolve"}),{outcome:"committed",detail:s.ref}}let a=_(t.contextDir),d=ie(a,l.row.ref);if(!d.ok)return y(d.message);if(l.card.kind==="ADD"){let s=await M(d.target.seamRef,()=>t.runDesign(d.target.seamRef,{yes:!0,mode:k}));return s!==0?y(`design run exited ${s}`):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-create"}),{outcome:"applied"})}let D=await P(d.target.display,l.row.ref,()=>ne(t.contextDir,d.target,{yes:!0,mode:k,...n.steering?{because:n.steering}:{}},S,t.runDesign,"batch"));return D.outcome==="evolved"?(u.applied++,t.signals({ref:r,verdict:"gap-resolved-evolve",...n.steering?{reason:n.steering}:{}}),{outcome:"applied"}):D.outcome==="failed"||D.outcome==="paused"?y(`evolve ${D.outcome} (exit ${D.code})`):(u.skipped++,{outcome:"skipped",detail:D.outcome})},summary:()=>({...u})}}var j=U(K(),1);function q({mark:t,markColor:v,color:k,indent:A=2,reserve:M=0,children:P}){let{stdout:S}=ae(),u=(S?.columns??80)-M,w=A+t.length+1;return(0,j.jsxs)(F,{children:[(0,j.jsx)(F,{width:w,flexShrink:0,children:(0,j.jsx)(x,{color:v,children:`${" ".repeat(A)}${t}`})}),(0,j.jsx)(F,{width:Math.max(20,u-w),children:(0,j.jsx)(x,{color:k,children:P})})]})}var p=U(K(),1);function be(t){return t.landed?"committed":t.outcome}var We={applied:{mark:"\u2714",color:"green"},committed:{mark:"\u2714",color:"green"},retired:{mark:"\u2714",color:"green"},skipped:{mark:"\xB7",color:"dim"},deferred:{mark:"\u2013",color:"dim"},failed:{mark:"\u2717",color:"red"}};function Ae(t){return t.v==="archive"?"Retiring\u2026":t.v==="approve"&&t.steering?"Approving with your changes \u2014 committing, then re-designing\u2026":"Applying \u2014 committing\u2026"}function Pe({controller:t,cards:v,note:k,markOutcome:A,routeChat:M,listEvolveTargets:P,barSubject:S,meta:u,resumeCmd:w,activeChild:y,onFinish:r,onCtrlC:n,pauseRef:l}){let[a,d]=(0,R.useState)(v.length>0?{at:"card",idx:0,sel:0,editor:null}:{at:"done-panel",sel:0}),D=(0,R.useRef)(0),s=(0,R.useRef)(a);s.current=a;let b=(0,R.useRef)([]),[,g]=(0,R.useState)(0),o=a.at==="busy"||a.at==="evolving";(0,R.useEffect)(()=>{if(!o)return;let e=setInterval(()=>g(i=>i+1),120);return()=>clearInterval(e)},[o]);let c=()=>{let e=t.summary();return`${e.applied+e.committed} applied \xB7 ${e.retired} retired \xB7 ${e.skipped} skipped \xB7 ${e.deferred} deferred`+(e.failed>0?` \xB7 ${e.failed} failed`:"")},E=()=>({state:"complete",facts:[c()]}),C=()=>({state:"walk-paused",reason:"ctrl+c",facts:[c(),"every verdict so far is committed \u2014 re-run the same reconcile command to continue"],...w?{resume:w}:{}}),$=()=>r(D.current,E()),T=(0,R.useRef)(!1),W=()=>{r(3,C())},I=()=>{if(T.current)return;T.current=!0;let e=s.current;if(e.at==="busy"||e.at==="evolving"){k((0,p.jsx)(x,{color:h.dim,children:"finishing the current item, then pausing\u2026"}));return}if(e.at==="done-panel"||e.at==="picker"||e.at==="why"||e.at==="view"){$();return}W()};l&&(l.current=I);let V=a.at==="card"||a.at==="busy"?v[a.idx]:null,O=()=>[{key:"finish",label:"finish"},...P?[{key:"evolve",label:"evolve another use-case\u2026"}]:[],...b.current.length>0?[{key:"view",label:"view what changed"}]:[]],H=()=>{let e=P?.()??[];if(e.length===0){k((0,p.jsx)(x,{color:h.dim,children:"nothing is stale \u2014 no evolve targets right now"})),d({at:"done-panel",sel:0});return}d({at:"picker",items:e,sel:0})},we=e=>{let i=e+1;i<v.length?d({at:"card",idx:i,sel:0,editor:null}):d({at:"done-panel",sel:0})},X=(0,R.useRef)(!1),L=(e,i)=>{if(X.current)return;X.current=!0;let m=v[e];d({at:"busy",idx:e,label:Ae(i),startedAt:Date.now()}),t.submit(m.ref,i).catch(f=>({outcome:"failed",detail:f instanceof Error?f.message:String(f)})).then(f=>{let B=We[f.outcome]??{mark:"\xB7",color:"dim"},Te=f.outcome!=="failed"&&f.outcome!=="skipped"&&f.outcome!=="deferred"&&m.impact&&"stale_refs"in m.impact&&m.impact.stale_refs.length>0?` \xB7 ${m.impact.stale_refs.length} item(s) now stale`:"",oe=`${f.outcome} [${m.kind}] ${Y(m.title)}${f.detail?` \u2014 ${Y(f.detail)}`:""}${Te}`;if(b.current.push({mark:B.mark,color:B.color,line:oe}),k((0,p.jsx)(q,{mark:B.mark,markColor:B.color==="green"?h.green:B.color==="red"?h.red:h.dim,color:B.color==="dim"?h.dim:void 0,children:oe})),f.outcome==="failed"&&(D.current=D.current===0?1:D.current),A(m.ref,be(f)),X.current=!1,T.current){W();return}we(e)})},ye=(e,i)=>{d({at:"evolving",title:e.title,startedAt:Date.now()}),M(`${e.key} ${i}`).catch(m=>`\u2717 evolve failed: ${m instanceof Error?m.message:String(m)}`).then(m=>{let f=m.startsWith("\u2713");if(b.current.push({mark:f?"\u2714":"\u2717",color:f?"green":"red",line:m.replace(/^[✓✗]\s*/,"")}),k((0,p.jsx)(q,{mark:f?"\u2714":"\u2717",markColor:f?h.green:h.red,children:m.replace(/^[✓✗]\s*/,"")})),T.current){$();return}d({at:"done-panel",sel:0})})},xe=(0,R.useMemo)(()=>({isFocused:()=>{let e=s.current;return e.at==="card"&&e.editor===null||e.at==="done-panel"||e.at==="picker"||e.at==="view"},onMove:e=>{d(i=>{if(i.at==="card"){let m=v[i.idx],f=G(m)??N(m).length-1;return{...i,sel:Math.max(0,Math.min(f,i.sel+e))}}return i.at==="done-panel"?{...i,sel:Math.max(0,Math.min(O().length-1,i.sel+e))}:i.at==="picker"?{...i,sel:Math.max(0,Math.min(i.items.length-1,i.sel+e))}:i})},onSelect:()=>{let e=s.current;if(e.at==="card"){let i=v[e.idx],m=G(i);if(m!==null&&e.sel===m){d({...e,editor:"",editorIntent:"steer"});return}let f=N(i)[e.sel];if(f?.v==="archive"&&i.kind==="REVIEW"){d({...e,editor:"",editorIntent:"because"});return}f&&L(e.idx,{v:f.v});return}if(e.at==="done-panel"){let i=O()[e.sel];i?.key==="finish"?$():i?.key==="evolve"?H():i?.key==="view"&&d({at:"view"});return}if(e.at==="picker"){let i=e.items[e.sel];i&&d({at:"why",item:i,text:""});return}},onDigit:e=>{let i=s.current;if(i.at==="card"){let m=v[i.idx],f=N(m)[e-1];if(f?.v==="archive"&&m.kind==="REVIEW"){d({...i,editor:"",editorIntent:"because"});return}f&&L(i.idx,{v:f.v});return}i.at==="done-panel"&&e-1<O().length&&d({...i,sel:e-1}),i.at==="picker"&&e-1<i.items.length&&d({...i,sel:e-1})},onType:e=>{d(i=>i.at!=="card"||G(v[i.idx])===null?i:{...i,editor:(i.editor??"")+e,editorIntent:i.editorIntent??"steer"})},isMulti:()=>!1,onSpace:()=>{},onBack:()=>{let e=s.current;(e.at==="picker"||e.at==="view")&&d({at:"done-panel",sel:0})}}),[v]);(0,R.useEffect)(()=>{a.at==="done"&&$()},[a.at]);let Ce=e=>Math.floor((Date.now()-e)/1e3),z=y?.current??null,$e=a.at==="card"?{kind:"card",n:a.idx+1,m:v.length}:a.at==="busy"?z?{kind:"child-working",step:re(a.label)}:{kind:"working",step:re(a.label),elapsedS:Ce(a.startedAt)}:a.at==="evolving"?{kind:"child-working",step:`evolving ${a.title}`}:{kind:"idle"},Re=a.at==="card"||a.at==="busy"?v.length-a.idx:0,Ee=a.at==="done-panel"||a.at==="picker"||a.at==="why"||a.at==="view",De=[...a.at==="card"?a.editor!==null?["\u23CE submit","esc back"]:fe(v[a.idx]).keys:a.at==="done-panel"?me(O(),{escBack:!1}).keys:a.at==="picker"?["\u2191\u2193 select","\u23CE confirm","esc back"]:a.at==="why"?["\u23CE submit","esc back"]:a.at==="view"?["esc back"]:[],"ctrl+c exit"],J=u??{verb:"reconcile",sid:"",env:""},Se=`view \xB7 this run's changes \xB7 ${b.current.length}`;return(0,p.jsxs)(F,{flexDirection:"column",children:[(0,p.jsx)(le,{onToggleThinking:()=>{},onCtrlC:()=>{n(),I()},panel:xe}),a.at==="card"&&V?(0,p.jsx)(de,{card:V,position:{n:a.idx+1,of:v.length},sel:a.sel,focused:a.editor===null,editorIntent:a.editorIntent??"steer",freeText:a.editor!==null?{value:a.editor,onChange:e=>d(i=>i.at==="card"?{...i,editor:e}:i),onSubmit:e=>{let i=s.current;if(i.at!=="card")return;let m=e.trim();if(!m){d({...i,editor:null,editorIntent:void 0});return}let f=v[i.idx];i.editorIntent==="because"?L(i.idx,{v:"archive",because:m}):f.kind==="PAIR"?L(i.idx,{v:"defer",note:m}):L(i.idx,{v:"approve",steering:m})},onCancel:()=>d(e=>e.at==="card"?{...e,editor:null,editorIntent:void 0}:e)}:null}):null,a.at==="done-panel"?(0,p.jsx)(Q,{headline:(()=>{let e=t.summary();return`reconcile done \u2014 ${e.applied+e.committed} applied \xB7 ${e.retired} retired \xB7 ${e.skipped} skipped \xB7 ${e.deferred} deferred${e.failed>0?` \xB7 ${e.failed} failed`:""}`})(),rows:O(),sel:a.sel,focused:!0}):null,a.at==="picker"?(0,p.jsx)(Q,{ask:!0,headline:"evolve which use-case?",rows:a.items.map(e=>({key:e.key,label:e.title,detail:e.badge})),sel:a.sel,focused:!0}):null,a.at==="why"?(0,p.jsxs)(F,{flexDirection:"column",borderStyle:"round",borderColor:h.assuranceAccent,paddingX:1,children:[(0,p.jsxs)(F,{children:[(0,p.jsxs)(x,{children:[(0,p.jsx)(x,{color:h.assuranceAccent,children:"\u25B8"})," ",(0,p.jsx)(x,{color:h.dim,children:"\u270E "})]}),(0,p.jsx)(se,{value:a.text,onChange:e=>d(i=>i.at==="why"?{...i,text:e}:i),onSubmit:e=>{let i=s.current;i.at==="why"&&(e.trim()?ye(i.item,e.trim()):d({at:"picker",items:[i.item],sel:0}))},onCancel:()=>{s.current.at==="why"&&H()},placeholder:`what should change about ${a.item.title}?`})]}),(0,p.jsx)(x,{color:h.muted,children:" \u23CE submit \xB7 esc back"})]}):null,a.at==="view"?(0,p.jsxs)(F,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,p.jsx)(x,{bold:!0,color:h.assuranceAccent,children:Se}),(0,p.jsx)(x,{children:" "}),b.current.map((e,i)=>(0,p.jsx)(q,{mark:e.mark,markColor:e.color==="green"?h.green:e.color==="red"?h.red:h.dim,color:e.color==="dim"?h.dim:void 0,indent:0,reserve:0,children:e.line},`vc-${i}`))]}):null,(0,p.jsx)(ce,{status:$e,meta:{...J,...S??J.subject?{subject:S??J.subject}:{}},tallies:ue(t.summary(),Re),keys:De,child:a.at==="evolving"?{verb:"evolve"}:z?{verb:z.verb}:void 0})]})}async function at(t){let v={current:null},k=o=>{v.current?.append(o)},A=null,M=async(o,c)=>{let[{runDesign:E},{resolveAgentAuthEnv:C},{runAgent:$},{preflightTurn:T}]=await Promise.all([import("./run-OTMPUQSH.js"),import("./spawner-DPT2RLAO.js"),import("./bridge-7J3JE3JS.js"),import("./turn-preflight-JGYT7LXP.js")]);A??=await C();let W=A;return E({useCase:o,force:!0,mode:c.mode??"override",...c.because?{because:c.because}:{},...c.changeDelta!==void 0?{changeDelta:c.changeDelta}:{},...c.priorDesign!==void 0?{priorDesign:c.priorDesign}:{}},{contextDir:t.dir,agent:$,preflightTurn:()=>T(W),ask:async()=>[],out:()=>{},progress:()=>{},isTTY:!1,auth:W})},P=t.runDesign??M,S={current:null},u="",w=o=>{if(o.kind==="start")S.current={verb:o.verb},u=o.subject,k((0,p.jsxs)(x,{color:h.assuranceAccent,children:[`\u25CF ${te(o.verb).ing} ${Y(o.subject)}`,o.note?(0,p.jsx)(x,{color:h.dim,children:` ${o.note}`}):null]}));else if(o.kind==="end"){let c=S.current?.verb??"design";S.current=null,k(o.ok?(0,p.jsx)(x,{color:h.green,children:`\u25CF ${te(c).ed} ${Y(u)} \u2014 ${o.durS}s`}):(0,p.jsx)(x,{color:h.red,children:`\u25CF ${c} failed \u2014 ${o.exitCode!=null?`exited ${o.exitCode}`:"error"}${o.fixCmd?` \xB7 ${o.fixCmd}`:""}`}))}},y=ke({contextDir:t.dir,held:t.held,archive:t.archive,planRows:t.rows,runDesign:P,mode:"interactive",signals:t.signals,onChild:w,reviewFeeder:()=>{try{return he({contextDir:t.dir},_(t.dir))}catch{return[]}}}),r=new Set(t.rows.filter(o=>o.applied!==void 0).map(o=>o.held_ref??o.ref)),n=y.cards().filter(o=>!r.has(o.ref)&&!(o.kind==="ARCHIVE"&&t.archiveState?.[o.ref]!==void 0)),l=o=>t.rows.findIndex(c=>(c.held_ref??c.ref)===o),a=(o,c)=>{try{if(n.find($=>$.ref===o)?.kind==="ARCHIVE"){c==="retired"?t.markA?.(o,"retired"):c==="skipped"&&t.markA?.(o,"skipped");return}let C=l(o);if(C<0)return;c==="applied"||c==="committed"?t.mark?.(C,"approved"):c==="skipped"&&t.mark?.(C,"skipped")}catch{}},d=async o=>{let[{openGraph:c},{resolveParentUc:E,evolveOneUc:C}]=await Promise.all([import("./readmodel-FVLRQWZ7.js"),import("./evolve-cmd-VGVXV6XW.js")]),[$,...T]=o.split(/\s+/),W=c(t.dir),I=E(W,$);if(!I.ok)return`couldn't resolve '${$}' \u2014 start with a use-case id (uc-\u2026): ${I.message}`;if(T.length===0)return`say what to change: \`${$} <your words>\` \u2014 the words become the redesign's change delta`;let V=T.join(" "),O={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},H=await C(t.dir,I.target,{yes:!0,mode:"override",because:V},O,P,"batch");return H.outcome==="evolved"?(t.signals({ref:I.target.display,verdict:"gap-resolved-evolve",reason:V}),`\u2713 redesigned ${I.target.display} \u2014 "${V}"`):`\u2717 evolve ${H.outcome} for ${I.target.display} (exit ${H.code})`},D=t.listEvolveTargets??(()=>{let o=_(t.dir);return pe(o).targets.map(c=>({key:c.display,title:c.display,badge:"stale"}))});if(t.script){let o=0;for(let c of n){let E=await t.script(c),C=await y.submit(c.ref,E);C.outcome==="failed"&&o===0&&(o=1),a(c.ref,be(C))}return o}let[{render:s},{ScrollbackProvider:b},{ScrollbackTap:g}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./scrollback-JLPJR25X.js"),import("./ScrollbackTap-QHJOFYMC.js")]);return new Promise(o=>{let c=!1,E=(V,O)=>{c||(c=!0,(async()=>{process.removeListener("SIGINT",W),await v.current?.flush();try{I.unmount()}catch{}O&&Z(O),o(V)})())},C=0,$={current:null},T=()=>{if(C+=1,C>=2){if(c)return;c=!0,process.removeListener("SIGINT",W);try{I.unmount()}catch{}Z({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 every committed verdict is safe in the store"]}),o(130)}},W=()=>{T(),$.current?.()};process.on("SIGINT",W);let I=s((0,p.jsxs)(b,{children:[(0,p.jsx)(g,{into:v}),(0,p.jsx)(Pe,{controller:y,cards:n,note:k,markOutcome:a,routeChat:d,listEvolveTargets:D,barSubject:t.barSubject,meta:t.meta,resumeCmd:t.resumeCmd,activeChild:S,onFinish:E,onCtrlC:T,pauseRef:$})]}),{exitOnCtrlC:!1})})}export{Pe as WalkSessionSurface,be as outcomeToMark,at as runWalkSession};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-CW3RHKLA.js";import"./chunk-T2ONUKTL.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-3YIZG7WZ.js";import"./chunk-ZLWURCJ7.js";import"./chunk-QSCXXNC2.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-5TQFOPJV.js";import"./chunk-UR6MHSHU.js";export{a as withTelemetry};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testmuai/kane-cli",
3
- "version": "0.8.23",
3
+ "version": "0.9.0",
4
4
  "description": "KaneAI Terminal UI — browser automation testing agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -33,16 +33,16 @@
33
33
  "ws": "^8.20.0"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@testmuai/kane-cli-assurance-darwin-arm64": "0.8.23",
37
- "@testmuai/kane-cli-assurance-darwin-x64": "0.8.23",
38
- "@testmuai/kane-cli-assurance-linux-arm64": "0.8.23",
39
- "@testmuai/kane-cli-assurance-linux-x64": "0.8.23",
40
- "@testmuai/kane-cli-assurance-win-x64": "0.8.23",
41
- "@testmuai/kane-cli-darwin-arm64": "0.8.23",
42
- "@testmuai/kane-cli-darwin-x64": "0.8.23",
43
- "@testmuai/kane-cli-linux-x64": "0.8.23",
44
- "@testmuai/kane-cli-linux-arm64": "0.8.23",
45
- "@testmuai/kane-cli-win-x64": "0.8.23",
36
+ "@testmuai/kane-cli-assurance-darwin-arm64": "0.9.0",
37
+ "@testmuai/kane-cli-assurance-darwin-x64": "0.9.0",
38
+ "@testmuai/kane-cli-assurance-linux-arm64": "0.9.0",
39
+ "@testmuai/kane-cli-assurance-linux-x64": "0.9.0",
40
+ "@testmuai/kane-cli-assurance-win-x64": "0.9.0",
41
+ "@testmuai/kane-cli-darwin-arm64": "0.9.0",
42
+ "@testmuai/kane-cli-darwin-x64": "0.9.0",
43
+ "@testmuai/kane-cli-linux-x64": "0.9.0",
44
+ "@testmuai/kane-cli-linux-arm64": "0.9.0",
45
+ "@testmuai/kane-cli-win-x64": "0.9.0",
46
46
  "@testmuai/kane-cli-node-darwin-arm64": "24.18.0",
47
47
  "@testmuai/kane-cli-node-darwin-x64": "24.18.0",
48
48
  "@testmuai/kane-cli-node-linux-x64": "24.18.0",
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as C,b as l,c as o}from"./chunk-IGHK2ENL.js";import{y as n}from"./chunk-CXF6AZWY.js";import{a as b}from"./chunk-HCBYKLMW.js";import{a as u,j as p}from"./chunk-C44QQJR4.js";import{a as y}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var x=a(y(),1);var e=a(b(),1);function T({model:w,authLabel:B,profile:h,env:D,defaultUrl:s,projectId:i,projectName:d,folderId:t,folderName:f,windowSize:P,chromeProfile:R,target:r,deviceName:m,osVersion:v,appLabel:g}){let V=i?d?`${d} (${i})`:i:"(none)",$=t?f?`${f} (${t})`:t:"(none)",{exit:c}=p();return(0,x.useEffect)(()=>{let S=setTimeout(()=>c(),50);return()=>clearTimeout(S)},[c]),(0,e.jsx)(u,{flexDirection:"column",children:(0,e.jsx)(C,{title:"Configuration",children:(0,e.jsxs)(u,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(o,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:B}),(0,e.jsx)(l,{label:" profile",value:h}),(0,e.jsx)(l,{label:" env",value:D}),(0,e.jsx)(o,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:s??"(none)",valueColor:s?n.orange:n.dim}),(0,e.jsx)(l,{label:" model",value:w}),(0,e.jsx)(l,{label:" window",value:P}),(0,e.jsx)(l,{label:" project",value:V}),(0,e.jsx)(l,{label:" folder",value:$}),r!==void 0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" target",value:r}),r!=="desktop"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" device_name",value:m??"(not set)",valueColor:m?void 0:n.dim}),(0,e.jsx)(l,{label:" os_version",value:v??"(not set)",valueColor:v?void 0:n.dim}),(0,e.jsx)(l,{label:" app",value:g??"(not set)",valueColor:g?void 0:n.dim})]})]}),(0,e.jsx)(o,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:R,valueColor:n.dim})]})})})}export{T as ConfigView};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-AT3RME5W.js";import"./chunk-URWWROLS.js";import"./chunk-AACQE24F.js";import"./chunk-MBJHS653.js";import"./chunk-5GUD3CIH.js";import"./chunk-WJR2FU7S.js";import"./chunk-WESMQEPO.js";import"./chunk-EHN5HTUD.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import"./chunk-YFQGOOF7.js";import"./chunk-BL5QHONU.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-6YZ3VP3E.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-HBSYBL6J.js";import"./chunk-RFHMDQXZ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-GFNCGN5V.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-HJX5PQRD.js";import"./chunk-TAOHYWEO.js";import"./chunk-4JOD47QI.js";import"./chunk-DUYRCVI5.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-CXF6AZWY.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-RD72POF2.js";import"./chunk-YCCUBQY4.js";import"./chunk-MKQ7ZRDW.js";import"./chunk-2KVECC36.js";import"./chunk-CSVPZ33X.js";import"./chunk-DUYRCVI5.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CXF6AZWY.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-DDHGEJJP.js";import"./chunk-CLQP3DHT.js";import"./chunk-VAN7ECN6.js";import"./chunk-IIDBLJ5A.js";import"./chunk-TDPWFYTJ.js";import"./chunk-MWIE6LOZ.js";import"./chunk-JQ64X2TO.js";import"./chunk-VZ7KXRXB.js";import"./chunk-TONFENRW.js";import"./chunk-6YZ3VP3E.js";import"./chunk-ZIHG6EKH.js";import"./chunk-RD72POF2.js";import"./chunk-YCCUBQY4.js";import"./chunk-MKQ7ZRDW.js";import"./chunk-2KVECC36.js";import"./chunk-VE3SUJMA.js";import"./chunk-TZXXJWHA.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-HJX5PQRD.js";import"./chunk-TAOHYWEO.js";import"./chunk-CSVPZ33X.js";import"./chunk-Z7S3IWUX.js";import"./chunk-RAARDC2O.js";import"./chunk-DUYRCVI5.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-5ESGUPSR.js";import"./chunk-CXF6AZWY.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as a}from"./chunk-7KRY26OF.js";import"./chunk-ATYXPCM6.js";import"./chunk-MV3Q335C.js";import"./chunk-5HOHXV2K.js";import"./chunk-5Y2G4NC7.js";import"./chunk-YFQGOOF7.js";import"./chunk-BL5QHONU.js";import"./chunk-TDPWFYTJ.js";import"./chunk-MWIE6LOZ.js";import"./chunk-LHUW5QDT.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-GFNCGN5V.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-DUYRCVI5.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-3C32LVLX.js";import"./chunk-IGHK2ENL.js";import"./chunk-CXF6AZWY.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h}from"./chunk-TAOHYWEO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-UR6MHSHU.js";export{h as AppClient,g as AppUploadError,a as UPLOAD_CONTENT_TYPE,e as parseAppDetails,b as parseAppListPage,d as parseSignedDownload,c as parseUploadResponse,f as transportReason};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as a,c as b}from"./chunk-HJX5PQRD.js";import"./chunk-TAOHYWEO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CXF6AZWY.js";import"./chunk-UR6MHSHU.js";export{a as isAppId,b as resolveCloudApp};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-C7NWWGLT.js";import"./chunk-SB2SKN34.js";import"./chunk-MZ7W4WLF.js";import"./chunk-UD7KKHPW.js";import"./chunk-CXF6AZWY.js";import"./chunk-UR6MHSHU.js";export{a as runAgent};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as $e}from"./chunk-ATYXPCM6.js";import{a as te}from"./chunk-5HOHXV2K.js";import{a as K}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-3C32LVLX.js";import{a as ve}from"./chunk-IGHK2ENL.js";import{y as i}from"./chunk-CXF6AZWY.js";import{b as ye}from"./chunk-DFS4RMVP.js";import{a as k}from"./chunk-HCBYKLMW.js";import{a as s,b as o,i as Se,j as Te,k as ee}from"./chunk-C44QQJR4.js";import{a as V}from"./chunk-6YGTRKDT.js";import{e as R}from"./chunk-UR6MHSHU.js";var A=R(V(),1);var C=R(V(),1);function de(e){let t=e.flatMap(u=>[u,...u.children??[]]),n=t.filter(u=>u.status==="passed").length,l=t.filter(u=>u.status==="failed").length,a=t.filter(u=>u.status==="passed"||u.status==="failed").length;return{passed:n,failed:l,total:a}}function we(e){let t=$e(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[n,l]=(0,C.useState)(0),[a,u]=(0,C.useState)("idle"),c=(0,C.useRef)("idle"),v=(0,C.useRef)(0),S=(0,C.useRef)(!1),T=(0,C.useRef)(null),d=(0,C.useRef)(null),L=(0,C.useCallback)(h=>{c.current=h,u(h)},[]),O=(0,C.useCallback)(async h=>{let b=await e.getNextConfig(h);if(!b){L("done"),e.onAllComplete?.();return}let B=h?v.current+1:0;v.current=B,l(B),e.onStepStart?.(b,B),T.current=null,d.current=null,L("running"),await t.startRun(b,e.spawnOpts)},[t,e,L]);(0,C.useEffect)(()=>{S.current||(S.current=!0,O(null))},[]),(0,C.useEffect)(()=>{if(!t.lastRunEnd||t.lastRunEnd===T.current||c.current!=="running")return;T.current=t.lastRunEnd,c.current="transitioning",u("transitioning");let h=t.lastRunEnd,b=de(t.steps),B=t.bifurcationInfo,F={status:h.status==="passed"?"passed":"failed",duration_s:h.duration??0,reason:h.reason,runEnd:h,hadError:!1,stepsPassed:b.passed,stepsFailed:b.failed,stepsTotal:b.total,bifurcationFlows:B&&!B.isSingleFlow?B.flows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(F,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(F)},[t.lastRunEnd]),(0,C.useEffect)(()=>{if(!t.runError||t.runError===d.current||t.lastRunEnd||c.current!=="running")return;d.current=t.runError,c.current="transitioning",u("transitioning");let h=de(t.steps),b={status:"failed",duration_s:0,reason:t.runError,runEnd:null,hadError:!0,stepsPassed:h.passed,stepsFailed:h.failed,stepsTotal:h.total,bifurcationFlows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(b,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(b)},[t.runError,t.lastRunEnd]);let y=(0,C.useCallback)(()=>{t.cancelRun()},[t]);return{runner:t,currentStepIndex:n,phase:a,cancel:y}}var pe=R(V(),1);var ne=R(k(),1),Ee=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function ke({label:e,hasBifurcation:t=!1}){let[n,l]=(0,pe.useState)(0),[a,u]=(0,pe.useState)(0);K(()=>{l(v=>(v+1)%Ee.length)},80),K(()=>{u(v=>(v+1)%4)},400);let c=e??(t?"Planning approach":"Analyzing objective");return(0,ne.jsxs)(s,{marginLeft:1,children:[(0,ne.jsxs)(o,{color:i.orange,children:[Ee[n]," "]}),(0,ne.jsxs)(o,{color:i.dim,children:[c,".".repeat(a+1)]})]})}function Ie(e){if(!e.isRunning||e.replayInfo)return null;let t=e.bifurcationInfo;if(t&&!t.isSingleFlow){let n=e.steps.findIndex(a=>a.status==="running");return(n===-1?e.cmInitCounts.length===0:n>=e.cmInitCounts.length)?{label:n>0?`Planning flow ${n+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(n=>n.children?.length)?null:{hasBifurcation:!!t}}var I=R(V(),1);var Ce=R(V(),1);var re=R(k(),1),He="#ffc580",Ue="#ffd9a8",Le="#ffffff";function oe({text:e,active:t=!0}){let[n,l]=(0,Ce.useState)(0),a=4;if(K(()=>{l(c=>(c+1)%(e.length+a*2))},t?80:null),!t)return(0,re.jsx)(o,{color:Le,children:e});let u=e.split("").map((c,v)=>{let S=n-a,T=Math.abs(v-S-a/2),d;return T<=a/2?d=He:T<=a?d=Ue:d=Le,(0,re.jsx)(o,{color:d,children:c},v)});return(0,re.jsx)(o,{children:u})}var _=R(k(),1),We={starting:i.orange,running:i.orange,passed:i.green,failed:i.red,cancelled:i.dim,timed_out:i.orange};function ie({currentStep:e,maxSteps:t,elapsed:n,status:l}){let a=We[l]??i.orange,u=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`;return(0,_.jsxs)(s,{marginLeft:3,children:[(0,_.jsx)(o,{color:i.dim,children:"Steps "}),(0,_.jsx)(o,{bold:!0,children:e}),(0,_.jsxs)(o,{color:i.dim,children:["/",t]}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Elapsed "}),(0,_.jsx)(o,{bold:!0,children:u}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Status "}),(0,_.jsx)(o,{bold:!0,color:a,children:l})]})}var Ve={click:"\u25CF",type:"\u229E",scroll:"\u2195",navigate:"\u2192",analyze:"\u25CE",assert:"\u25C8","if-else":"\u2442",select:"\u25BC",press_key:"\u21B5",wait:"\u2026",tool_call:"\u2299"};function Oe(e){return Ve[e]??"\u25CF"}var q=R(k(),1);function fe({steps:e,flows:t,cmInitCounts:n,renderStep:l}){return(0,q.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,q.jsxs)(o,{color:i.dim,children:["\u2501\u2501 Bifurcated into ",t?.length??e.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),e.map((a,u)=>(0,q.jsxs)(s,{flexDirection:"column",marginTop:u>0?1:0,children:[(0,q.jsxs)(o,{color:i.orange,children:["Flow ",u+1,": ",t?.[u]??a.objective]}),n&&n[u]!=null&&(0,q.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",n[u]," checkpoints"]}),a.children&&a.children.length>0?a.children.map(c=>{let v=!!c.branchObjective,S=`f${u}-${c.childId??"p"}-${c.index}`;return v?(0,q.jsxs)(s,{flexDirection:"column",children:[l({...c,children:void 0},S),(c.children??[]).map(T=>(0,q.jsx)(s,{marginLeft:2,children:l(T,`${S}-${T.childId??"p"}-${T.index}`)},`${S}-${T.childId??"p"}-${T.index}`))]},`${S}-host`):l(c,S)}):a.status==="pending"&&(0,q.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})]},u))]})}var H=R(k(),1);function Pe({label:e,shimmer:t=!1}){return(0,H.jsxs)(s,{marginLeft:6,children:[(0,H.jsx)(te,{}),(0,H.jsx)(o,{children:" "}),t?(0,H.jsx)(oe,{text:e,active:!0}):(0,H.jsx)(o,{color:i.dim,children:e})]})}var De=R(V(),1);var me=R(k(),1);function ze(e,t){let n=[];for(let l of e.split(`
3
- `)){if(l===""){n.push("");continue}let a="";for(let u of l.split(" ")){let c=u;for(;c.length>t;)a&&(n.push(a),a=""),n.push(c.slice(0,t)),c=c.slice(t);a===""?a=c:a.length+1+c.length<=t?a+=" "+c:(n.push(a),a=c)}n.push(a)}return n}function je({text:e,maxLines:t=3}){let{stdout:n}=ee(),l=Math.max(20,(n?.columns??80)-7),a=!e.trim(),[u,c]=(0,De.useState)(!0);K(()=>c(T=>!T),500);let v=(a?"Thinking\u2026":e)+(u?"\u258C":" "),S=ze(v,l).slice(-t);for(;S.length<t;)S.push("");return(0,me.jsx)(s,{borderStyle:"round",borderColor:i.muted,paddingX:1,marginLeft:3,flexDirection:"column",children:S.map((T,d)=>(0,me.jsx)(o,{color:a?i.dim:i.secondary,wrap:"truncate-end",children:T.length?T:" "},d))})}var U=R(k(),1);function se({activity:e,describe:t,describeVisible:n}){return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(Pe,{label:e.label,shimmer:e.shimmer}):null,n?(0,U.jsx)(je,{text:t??""}):null]})}var r=R(k(),1);function le(e){for(let t of e){if(t.children&&t.children.length>0){let n=le(t.children);if(n)return n}if(t.status==="running")return t}}function z(e){return e.status==="running"&&!e.branchObjective&&(!e.children||e.children.length===0)}function Fe(e){let t=[];for(let n of e)z(n)||(n.children&&n.children.length>0?t.push({...n,children:Fe(n.children)}):t.push(n));return t}function ge(e,t){if(!e)return null;let n=e.objective??"";return n.length>0&&!/^Step \d+$/.test(n)?{label:n+"\u2026",shimmer:!1}:{label:t?"Looking at the screen\u2026":"Deciding next action\u2026",shimmer:!0}}function P({step:e,indent:t=2}){let n=e.actionType?Oe(e.actionType):null,l=e.status==="running",a=e.status==="passed",u=e.status==="failed",c=e.status==="pending"||e.status==="stopped",{stdout:v}=ee(),S=v?.columns??80,T=Math.max(20,S-t-21),d=e.objective??"",L=d.length>T?d.slice(0,T-1)+"\u2026":d,O=(e.duration??0)*1e3,y=e.duration!=null?O<1e3?`${Math.round(O)}ms`:`${(O/1e3).toFixed(1)}s`:"";return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsxs)(s,{marginLeft:t,children:[(0,r.jsx)(s,{width:4,children:(0,r.jsxs)(o,{color:i.muted,children:[String(e.index).padStart(2," ")," "]})}),(0,r.jsx)(s,{width:3,children:l?(0,r.jsx)(te,{}):a?(0,r.jsx)(o,{color:i.green,bold:!0,children:"\u2713"}):u?(0,r.jsx)(o,{color:i.red,bold:!0,children:"\u2717"}):(0,r.jsx)(o,{color:i.muted,children:"\u25CB"})}),(0,r.jsx)(s,{flexGrow:1,children:l?(0,r.jsx)(oe,{text:L,active:!0}):u?(0,r.jsx)(o,{color:i.red,children:L}):c?(0,r.jsx)(o,{color:i.dim,children:L}):(0,r.jsx)(o,{color:i.dim,children:L})}),(a||u)&&n?(0,r.jsx)(s,{width:3,marginLeft:1,children:(0,r.jsx)(o,{color:i.muted,children:n})}):(0,r.jsx)(s,{width:3,marginLeft:1}),(0,r.jsx)(s,{width:7,justifyContent:"flex-end",children:(0,r.jsx)(o,{color:i.dim,children:y})})]}),e.children&&e.children.length>0&&(0,r.jsx)(s,{flexDirection:"column",children:e.children.map((h,b)=>(0,r.jsx)(P,{step:h,indent:t+2},`child-${b}`))})]})}function Xe(e){return e.type==="cm_init"?(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",e.count," checkpoints"]})}):(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsx)(P,{step:e.step})})}function _e({steps:e,bifurcated:t,flows:n,cmInitCounts:l,maxSteps:a=50,staticSteps:u=!1,onStepCommit:c,describe:v,describeVisible:S,describeRevealing:T}){let d=(0,I.useRef)(new Set),L=(0,I.useRef)(!1),O=(0,I.useRef)(new Set),y=(0,I.useRef)(!1),h=(0,I.useRef)(new Set),b=(0,I.useRef)(0);(0,I.useEffect)(()=>{e.length===0&&b.current>0&&(d.current.clear(),L.current=!1,O.current.clear(),y.current=!1,h.current.clear()),b.current=e.length},[e.length]);let B=e.flatMap(p=>[p,...p.children??[]]),F=B.some(p=>p.status==="running"),M=B.some(p=>p.status==="failed"),X=B.length===0||B.every(p=>p.status==="pending"),Y=B.filter(p=>p.status==="passed"||p.status==="failed").length,N;X?N="starting":F?N="running":M?N="failed":N="passed";let J=(0,I.useRef)(null),[ce,he]=(0,I.useState)(0);(0,I.useEffect)(()=>{B.length===0||X?(J.current=null,he(0)):F&&J.current==null&&(J.current=Date.now())},[F,X,B.length]),(0,I.useEffect)(()=>{if(!F)return;let p=setInterval(()=>{J.current!=null&&he((Date.now()-J.current)/1e3)},500);return()=>clearInterval(p)},[F]);let ae=(0,I.useRef)(new Set),[,xe]=(0,I.useState)(0),be=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!c||!u||t)return;let p=[];!be.current&&l&&l[0]!=null&&(be.current=!0,l[0]>0&&p.push({key:"cm_init_0",type:"cm_init",count:l[0]}));for(let g of e)(g.status==="passed"||g.status==="failed")&&!ae.current.has(g.index)&&(ae.current.add(g.index),p.push({key:`step_${g.index}`,type:"step",step:{...g,children:g.children?[...g.children]:void 0}}));if(p.length>0){for(let g of p)c(Xe(g));xe(g=>g+1)}},[e,t,l,u,c]),(0,I.useEffect)(()=>{if(!c||u)return;let p=d.current.size;if(!t&&!y.current&&l&&l[0]!=null&&(y.current=!0,l[0]>0&&c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25A0 Generated task with ",l[0]," checkpoints"]})}))),t&&n&&!L.current&&(L.current=!0,c((0,r.jsx)(o,{color:i.purple,children:"\u2501\u2501 Bifurcated into "+n.length+" flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"}))),t){let g=e.flatMap((x,f)=>{let m=x.children??[];return!O.current.has(f)&&m.length>0&&(O.current.add(f),c((0,r.jsx)(o,{color:i.purple,children:" Flow "+(f+1)+": "+(n?.[f]??"")})),l?.[f]!=null&&l[f]>0&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})})))),l?.[f]!=null&&l[f]>0&&O.current.has(f)&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})}))),m});for(let x of g){let f=`${x.childId??"p"}-${x.index}-${x.objective}`;if(!!x.branchObjective){d.current.has(f)||(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...x,children:void 0}})})));for(let $ of x.children??[]){let w=`child-${x.childId??"p"}-${x.index}-${$.childId??"p"}-${$.index}-${$.objective}`;d.current.has(w)||($.status==="passed"||$.status==="failed"||$.status==="stopped")&&(d.current.add(w),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:$})})))}continue}d.current.has(f)||(x.status==="passed"||x.status==="failed"||x.status==="stopped")&&(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:x})})))}}else for(let g of e){let x=`${g.index}-${g.objective}`,f=!!g.branchObjective;f&&!d.current.has(x)&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})));for(let m of g.children??[]){let $=`child-${g.index}-${m.childId??"p"}-${m.index}-${m.objective}`;d.current.has($)||(m.status==="passed"||m.status==="failed"||m.status==="stopped")&&(d.current.add($),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:m})})))}!f&&!d.current.has(x)&&(g.status==="passed"||g.status==="failed"||g.status==="stopped")&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})))}d.current.size>p&&xe(g=>g+1)},[e,c,t,n,l]);let G=[];if(u&&!t)for(let p of e)ae.current.has(p.index)||G.push(p);else if(c&&!u)if(t)for(let p of e){let g=p.children??[],x=[];for(let f of g){let m=`${f.childId??"p"}-${f.index}-${f.objective}`,$=d.current.has(m);if(f.branchObjective){let w=(f.children??[]).filter(Q=>{let ue=`child-${f.childId??"p"}-${f.index}-${Q.childId??"p"}-${Q.index}-${Q.objective}`;return!d.current.has(ue)});(!$||w.length>0)&&x.push({...f,children:w})}else $||x.push(f)}x.length>0&&G.push({...p,children:x})}else for(let p of e){let g=`${p.index}-${p.objective}`,x=d.current.has(g),f=(p.children??[]).filter(m=>{let $=`child-${p.index}-${m.childId??"p"}-${m.index}-${m.objective}`;return!d.current.has($)});x?f.length>0&&G.push({...p,children:f}):G.push({...p,children:f})}if(!u){let p=c?G:e,g=le(p),x=ge(g,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[t?c?p.length>0?(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:p.map((m,$)=>(0,r.jsx)(s,{flexDirection:"column",marginTop:$>0?1:0,children:m.children&&m.children.length>0?m.children.map(w=>{if(z(w))return null;let Q=!!w.branchObjective,ue=`${w.childId??"p"}-${w.index}-${w.objective}`,Ke=d.current.has(ue);return Q?(0,r.jsxs)(s,{flexDirection:"column",children:[!Ke&&(0,r.jsx)(P,{step:{...w,children:void 0}}),(w.children??[]).filter(Z=>!z(Z)).map(Z=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:Z})},`f${$}-${w.index}-${Z.childId??"p"}-${Z.index}`))]},`f${$}-host-${w.childId??"p"}-${w.index}`):(0,r.jsx)(P,{step:w},`f${$}-${w.childId??"p"}-${w.index}`)}):m.status==="pending"&&(0,r.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})},$))}):null:(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(m,$)=>z(m)?null:(0,r.jsx)(P,{step:m},$)}):(0,r.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[!c&&l&&l[0]!=null&&(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",l[0]," checkpoints"]}),p.filter(m=>!(m.status==="running"&&(!m.children||m.children.length===0))).map(m=>{let $=`${m.index}-${m.objective}`;return c&&d.current.has($)?(0,r.jsx)(s,{flexDirection:"column",children:(m.children??[]).filter(w=>!z(w)).map(w=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:w})},`${w.childId??"p"}-${w.index}`))},`branch-children-${m.index}`):(0,r.jsx)(P,{step:m},m.index)})]}),(0,r.jsx)(se,{activity:x,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}if(t){let p=le(e),g=ge(p,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(x,f)=>z(x)?null:(0,r.jsx)(P,{step:x},f)}),(0,r.jsx)(se,{activity:g,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}let Ne=le(G),Ge=ge(Ne,T),Re=Fe(G);return(0,r.jsxs)(s,{flexDirection:"column",children:[Re.length>0&&(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:Re.map(p=>(0,r.jsx)(P,{step:p},p.index))}),(0,r.jsx)(se,{activity:Ge,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}var W=R(k(),1);function Ae({runner:e,runKey:t,onStepCommit:n}){let l=Ie({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,W.jsxs)(W.Fragment,{children:[l&&(0,W.jsx)(ke,{label:l.label,hasBifurcation:l.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,W.jsx)(_e,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:n},`run-${t}`)]})}var D=R(k(),1),Ye=64;function Je(e){return e.split(`
4
- `).map(t=>t.replace(/^[-–•]\s*/,"").trim()).filter(t=>t.length>0)}function qe({status:e,summary:t,duration:n,steps:l,stepsPassed:a,stepsFailed:u,reason:c,creditsConsumed:v}){let S=e==="passed",T=S?i.green:i.red,d=S?"\u2713":"\u2717",L=e.toUpperCase(),O=a??(S?l:Math.max(0,l-1)),y=u??(S?0:1),h=y>0?`${l} steps (${O} passed, ${y} failed)`:`${l} steps`,b=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`,B=Je(t);return(0,D.jsx)(s,{flexDirection:"column",marginTop:1,children:(0,D.jsxs)(s,{borderStyle:"round",borderColor:T,flexDirection:"column",paddingX:2,paddingY:1,width:Ye+6,children:[(0,D.jsxs)(s,{flexDirection:"column",children:[(0,D.jsxs)(o,{bold:!0,color:T,children:[d," ",L]}),(0,D.jsxs)(o,{color:i.dim,wrap:"wrap",children:[h," \xB7 ",b,typeof v=="number"&&v>0?` \xB7 ${parseFloat(v.toFixed(4))} credits`:""]})]}),B.length>0&&(0,D.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:B.map((F,M)=>(0,D.jsxs)(s,{marginBottom:M<B.length-1?1:0,children:[(0,D.jsx)(o,{color:i.orange,children:"\u25CF "}),(0,D.jsx)(s,{flexShrink:1,children:(0,D.jsx)(o,{wrap:"wrap",children:F})})]},M))}),c&&!S&&(0,D.jsx)(s,{marginTop:1,children:(0,D.jsxs)(o,{color:i.red,wrap:"wrap",children:["Reason: ",c]})})]})})}var j=R(k(),1);function Me({message:e,code:t,remediation:n,docsUrl:l}){return(0,j.jsx)(ve,{title:"Error",variant:"error",children:(0,j.jsxs)(s,{flexDirection:"column",paddingY:1,children:[(0,j.jsxs)(o,{color:i.red,bold:!0,children:[" \u2717 ",e]}),t&&(0,j.jsxs)(s,{marginTop:0,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Code: "}),(0,j.jsx)(o,{color:i.dim,children:t})]}),n&&(0,j.jsxs)(s,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.green,bold:!0,children:"Fix:"}),(0,j.jsxs)(o,{color:i.orange,children:["$ ",n]})]}),l&&(0,j.jsxs)(s,{marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Docs: "}),(0,j.jsx)(o,{color:i.orange,underline:!0,children:l})]})]})})}var E=R(k(),1);function un(e){let{exit:t}=Te(),{append:n}=ye(),l=(0,A.useRef)(!1);(0,A.useEffect)(()=>{l.current||(l.current=!0,n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsxs)(s,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,E.jsx)(o,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.orange,children:e.topBanner.model}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.dim,children:e.topBanner.auth})]})})),n((0,E.jsx)(Qe,{data:e.globalConfig})),e.priorAttemptRollup&&n((0,E.jsx)(o,{color:i.dim,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})))},[]);let a=(0,A.useRef)(null),u=(0,A.useCallback)(async y=>{let h=await e.getNextStep(y);return h?(a.current=h,h.config):(a.current=null,null)},[e]),c=(0,A.useCallback)((y,h)=>{let b=a.current;if(!b)return;let B=b.mode==="replay"?"cyan":"#dc4e08",F=b.modeReason?` (${b.modeReason})`:"",M=b.perStepOverrides?Object.entries(b.perStepOverrides):[];n((0,E.jsxs)(s,{flexDirection:"column",marginBottom:0,children:[(0,E.jsxs)(o,{children:[(0,E.jsxs)(o,{color:i.dim,children:[b.banner.stepLabel," "]}),(0,E.jsxs)(o,{color:B,children:["[",b.mode,"]"]}),(0,E.jsx)(o,{color:i.dim,children:F})]}),(0,E.jsx)(o,{color:i.dim,children:b.banner.objective}),M.length>0&&(0,E.jsxs)(o,{color:i.dim,children:["overrides: ",M.map(([X,Y])=>`${X}=${Y}`).join(", ")]})]}))},[n]),v=(0,A.useRef)(0),S=(0,A.useRef)(!1),T=(0,A.useCallback)((y,h)=>(y.hadError?n((0,E.jsx)(Me,{message:y.reason??"Runner error",code:"RUNNER_ERROR"})):n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsx)(qe,{status:y.status,summary:y.runEnd?.summary??"",duration:y.runEnd?.duration??0,steps:y.stepsTotal,stepsPassed:y.stepsPassed,stepsFailed:y.stepsFailed,reason:y.runEnd?.reason,creditsConsumed:y.runEnd?.credits_consumed})})),e.onStepEnd?.(y,h)??!0),[n,e]),d=we({getNextConfig:u,onStepStart:c,onStepEnd:T,onAllComplete:()=>{e.onAllComplete(),e.exitOnComplete!==!1&&setImmediate(()=>t())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts}),L=250,O=5e3;return Se((y,h)=>{if(h.ctrl&&y==="c"){let b=Date.now(),B=b-v.current;if(B<L)return;S.current&&B<O?(d.cancel(),e.onCancel?.(),e.exitOnComplete!==!1&&setImmediate(()=>t())):(S.current=!0,n((0,E.jsx)(o,{color:"yellow",children:"press Ctrl+C again to cancel run"}))),v.current=b}}),(0,E.jsx)(s,{flexDirection:"column",children:d.phase!=="done"&&(0,E.jsx)(Ae,{runner:d.runner,runKey:d.currentStepIndex,onStepCommit:n})})}function Qe({data:e}){return(0,E.jsx)(Be,{title:"test.md run",titleColor:"#ff9500",borderColor:i.dim,rows:[{label:"source",value:e.source},{label:"steps",value:`${e.steps.total} (${e.steps.replay} replay, ${e.steps.author} author per walker)`},{label:"model",value:e.model},{label:"viewport",value:`${e.viewport.width} x ${e.viewport.height}`},{label:"chrome",value:e.chrome},{label:"session",value:e.session},{label:"variables",value:`${e.variables.count} (${e.variables.secrets} secret)`},{label:"flags",value:e.flags.length>0?e.flags.join(" "):"(none)"}]})}export{_e as a,ke as b,Ie as c,de as d,qe as e,Me as f,un as g};
@@ -1,6 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Y,b as Z,c as ee,d as ne,e as te}from"./chunk-MV3Q335C.js";import{b as ie,c as re}from"./chunk-YFQGOOF7.js";import{n as X,p as P}from"./chunk-RSSOJ3L2.js";import{a as Pe}from"./chunk-6YGTRKDT.js";import{e as Ce}from"./chunk-UR6MHSHU.js";function se(i){return{command:"start",...i}}function oe(i,n,s){return{command:"run",run_id:i,kind:n,...s}}function ae(i){return{command:"cancel",...i?{run_id:i}:{}}}function ue(i){return{command:"ask_user_response",answer:i}}function de(i={}){return{command:"shutdown",...i.testStatus?{test_status:i.testStatus,remark:i.remark??""}:{}}}var z=Symbol("run-queue-end"),G=class{items=[];waiting=null;ended=!1;error=null;push(n){if(this.waiting){let{resolve:s}=this.waiting;this.waiting=null,s(n)}else this.items.push(n)}end(){if(this.ended=!0,this.waiting){let{resolve:n}=this.waiting;this.waiting=null,n(z)}}fail(n){if(this.error=n,this.waiting){let{reject:s}=this.waiting;this.waiting=null,s(n)}}next(){return this.items.length>0?Promise.resolve(this.items.shift()):this.error?Promise.reject(this.error):this.ended?Promise.resolve(z):new Promise((n,s)=>{this.waiting={resolve:n,reject:s}})}},D=class{env;runner;log;sessionId;spawnFn;proc=null;activeRun=null;pendingReady=null;shuttingDown=!1;finalized=!1;exitInfo=null;exitedUnexpectedly=!1;exitResolve;exited;constructor(n){this.env=n.env,this.runner=n.runner,this.log=n.log,this.sessionId=n.sessionId,this.spawnFn=n.spawn??Z;let s;this.exited=new Promise(l=>{s=l}),this.exitResolve=s}async start(n){if(this.proc)throw new Error("PersistentRunner.start called twice");this.proc=this.spawnFn({env:this.env,runner:this.runner,log:this.log,sessionId:this.sessionId}),this.consume();let s=new Promise((l,g)=>{this.pendingReady={resolve:l,reject:g}});this.writeCommand(se(n)),await s}async*run(n,s,l){if(!this.proc)throw new Error("PersistentRunner.run called before start");if(this.finalized)throw new Error(`v16-runner is not running (exited code=${this.exitInfo?.code??"null"}, signal=${this.exitInfo?.signal??"none"}) \u2014 cannot start run '${n}'`);if(this.activeRun)throw new Error(`PersistentRunner.run overlap: '${this.activeRun.runId}' still in flight`);let g=new G,w={runId:n,queue:g};this.activeRun=w,this.writeCommand(oe(n,s,l));try{for(;;){let v=await g.next();if(v===z||(yield v,v.type==="run_end"&&(v.run_id===void 0||v.run_id===n)))break}}finally{this.activeRun===w&&(this.activeRun=null)}}sendUserResponse(n){this.writeCommand(ue(n))}cancel(n){this.writeCommand(ae(n))}kill(){this.proc?.child.kill("SIGTERM")}async shutdown(n={}){this.shuttingDown=!0,this.proc&&(this.writeCommand(de(n)),await this.exited)}get stderr(){return this.proc?.getStderr()??""}get diedUnexpectedly(){return this.exitedUnexpectedly}writeCommand(n){let s=JSON.stringify(n)+`
3
- `;try{this.proc?.child.stdin?.write(s)}catch{}}async consume(){if(!this.proc)return;try{for await(let l of this.proc.events){if(l.type==="ready"){this.onReady();continue}if(l.type==="error"&&this.pendingReady){this.onStartError(l.message);continue}this.routeEvent(l)}}catch(l){this.log?.("error","PERSISTENT_RUNNER_STREAM_ERROR","Runner stdout stream errored",{error:l instanceof Error?l.message:String(l)})}let{code:n,signal:s}=await this.proc.exited;this.onExit(n,s)}onReady(){if(this.pendingReady){let{resolve:n}=this.pendingReady;this.pendingReady=null,n()}}onStartError(n){if(!this.pendingReady)return;let{reject:s}=this.pendingReady;this.pendingReady=null,s(new Error(`failed to start: ${n??"unknown error"}`))}routeEvent(n){let s=this.activeRun;if(!s){this.log?.("warn","PERSISTENT_RUNNER_ORPHAN_EVENT","Runner event with no active run",{event_type:n.type});return}s.queue.push(n)}onExit(n,s){if(!this.finalized){if(this.finalized=!0,this.exitInfo={code:n,signal:s},this.shuttingDown||(this.exitedUnexpectedly=!0),this.exitResolve({code:n,signal:s}),this.pendingReady){let{reject:l}=this.pendingReady;this.pendingReady=null,l(new Error(`v16-runner exited before ready (code=${n}, signal=${s??"none"})`))}if(this.activeRun){let{queue:l}=this.activeRun;if(this.activeRun=null,this.shuttingDown)l.end();else{let g=this.proc?.getStderr()?.slice(-500)??"";l.fail(new Error(`v16-runner exited unexpectedly mid-run (code=${n}, signal=${s??"none"})${g?`
4
- ${g}`:""}`))}}}}};var p=Ce(Pe(),1);function le(i){let n={cdp_endpoint:i.cdp_endpoint,ws_endpoint:i.ws_endpoint,width:i.width,height:i.height,headless:i.headless,model:i.model,max_steps:i.max_steps,network_ws:i.network_ws,network_sse:i.network_sse,session_id:i.session_id};return i.device&&(n.device=i.device),i.auth&&(n.auth=i.auth),i.project_id&&(n.project_id=i.project_id),i.disable_ask_user&&(n.disable_ask_user=!0),i.username&&(n.username=i.username),i.access_key&&(n.access_key=i.access_key),n}function j(i,n){let s=null,l=(g,w)=>{for(let v=0;v<g.length;v++){let _=g[v],h=[...w,v];n(_)&&(s===null||h.length>s.length)&&(s=h),_.children&&_.children.length>0&&l(_.children,h)}};return l(i,[]),s}function N(i,n,s){if(n.length===0)return[...i];let l=n[0],g=[...i],w=g[l];if(n.length===1)g[l]=s(w);else{let v=n.slice(1),_=N(w.children??[],v,s);g[l]={...w,children:_}}return g}function ce(){return{steps:[],maxOrdinal:0}}function je(i,n){if(n.type==="run_start"&&n.child_id)return n.environment?.resolution?{...i,resolution:n.environment.resolution}:i;if(n.type==="run_start"){let s=re(i.runnerEnvironment,ie(n.environment));if(s)return{...i,runnerEnvironment:s,...s.resolution?{resolution:s.resolution}:{}}}if(n.type==="step_end"&&typeof n.ordinal=="number"&&n.id){let s={id:n.id,ordinal:n.ordinal,status:n.status,...n.kind?{kind:n.kind}:{},...typeof n.duration=="number"?{duration_ms:Math.round(n.duration*1e3)}:{},...typeof n.action_id=="string"&&n.action_id?{action_id:n.action_id}:{}};return{...i,steps:[...i.steps,s],maxOrdinal:Math.max(i.maxOrdinal,n.ordinal)}}return i}function K(i){let n=i.indexOf(": ");return n>0&&n<15?i.slice(n+2):i}function V(i){return i.map(n=>{let s=n.children?V(n.children):n.children;return n.status==="running"?{...n,status:"stopped",phase:void 0,children:s}:s!==n.children?{...n,children:s}:n})}function ze(i,n,s,l,g){let[w,v]=(0,p.useState)(!1),[_,h]=(0,p.useState)([]),[pe,T]=(0,p.useState)(null),[he,B]=(0,p.useState)(null),[fe,k]=(0,p.useState)(null),[me,W]=(0,p.useState)(null),[ve,J]=(0,p.useState)([]),[ge,H]=(0,p.useState)(null),[Re,Se]=(0,p.useState)(void 0),[ye,$]=(0,p.useState)(0),y=(0,p.useRef)(null),E=(0,p.useRef)(null),S=(0,p.useRef)(null),b=(0,p.useRef)(0),F=(0,p.useRef)(!1),U=(0,p.useRef)(ce()),O=(0,p.useRef)(null),we=(0,p.useCallback)(async(m,x)=>{let Q=O.current;if(Q)try{await Q}catch{}h([]),T(null),B(null),k(null),W(null),J([]),H(null),Se(m.max_steps),v(!0),S.current=null,b.current=0,U.current=ce();let I=y.current;if(I&&E.current!==m.session_id){try{I.kill()}catch{}y.current=null,E.current=null,$(e=>e+1),I=null}if(!I){let e=Y();if(!e){k("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available."),v(!1);return}let d=ne({environment:x?.environment,mode:x?.mode,assertionMode:x?.assertionMode,finalValidation:x?.finalValidation,username:m.username,accessKey:m.access_key,sessionId:m.session_id});m.device?.platform&&await ee(d,m.device);let u=new D({env:d,runner:e,log:x?.log,sessionId:m.session_id});y.current=u,E.current=m.session_id,I=u,X("runner",()=>{try{u.kill()}catch{}});let o=le(m);try{await u.start(o)}catch(a){k(a instanceof Error?a.message:String(a)),v(!1),P("runner","Runner start failed"),y.current=null,E.current=null,$(t=>t+1);return}}let M={...m};delete M.run_id,te(M,{environment:x?.environment});let ke=`run-${m.run_index}`,Ie=m.mode==="replay"?"replay":"author",L=I,q=(async()=>{F.current=!1;for await(let e of L.run(ke,Ie,M)){if(F.current)break;switch(U.current=je(U.current,e),e.type){case"run_start":if(e.child_id)break;if(S.current&&!S.current.isSingleFlow){let d=b.current;b.current++,h(u=>u.map((o,a)=>a===d?{...o,status:"running"}:o.status==="running"&&!o.children?.some(t=>t.status==="running")?{...o,status:o.children?.some(t=>t.status==="failed")?"failed":"passed"}:o))}break;case"bifurcation":{let d=e.flows??[],u=e.count??d.length,o={flows:d,isSingleFlow:e.is_single_flow??u<=1};W(o),S.current=o,b.current=0,h(d.map((a,t)=>({index:t+1,objective:a??`Flow ${t+1}`,status:"pending"})));break}case"step_start":{n?.("STEP_START",`Step ${e.index} started`,{index:e.index,objective:e.objective,child_id:e.child_id});let d=e.index,u=e.objective??`Step ${d}`,o=e.child_id,a=S.current&&!S.current.isSingleFlow;if(o)h(t=>{let r=j(t,c=>c.branchChildId===o)??j(t,c=>c.status==="running");return r?N(t,r,c=>{let f=(c.children??[]).map(R=>R.status==="running"&&R.childId===o?{...R,status:"stopped",phase:void 0}:R);return f.push({index:d,objective:u,status:"running",childId:o}),{...c,children:f}}):t});else if(a){let t=Math.max(0,b.current-1);h(r=>{let c=[...r];if(t>=c.length)return r;let f={...c[t]},C=[...f.children??[]].map(A=>A.status==="running"&&A.childId===void 0?{...A,status:"stopped",phase:void 0}:A);return C.push({index:d,objective:u,status:"running"}),f.children=C,f.status="running",c[t]=f,c})}else h(t=>{let r=V(t);return r.some(f=>f.index===d)?r.map(f=>f.index===d?{...f,status:"running",objective:u}:f):[...r,{index:d,objective:u,status:"running"}]});break}case"step_event":{n?.("STEP_EVENT",`Step ${e.index} ${e.event}`,{index:e.index,phase:e.event,action_type:e.action_type,detail:e.detail,child_id:e.child_id});let d=e.child_id,u=S.current&&!S.current.isSingleFlow;if(e.event==="cm_init"&&e.checkpoint_count!=null){J(o=>[...o,e.checkpoint_count]);break}if(e.event==="replay_started"){H({recordingLength:e.recording_length??0});break}if(e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&s?.(e.detail),d){let o=t=>{if(t.index!==e.index||t.childId!==d)return t;let r={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(r.objective=e.detail),e.action_type&&(r.actionType=e.action_type),{...t,...r}},a=t=>t.map(r=>{let c=o(r);return c!==r?c:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let o=Math.max(0,b.current-1);h(a=>{let t=[...a];if(o>=t.length)return a;let r={...t[o]},c=[...r.children??[]];if(!c.some(R=>R.index===e.index&&R.childId===void 0))c.push({index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type});else for(let R=0;R<c.length;R++){if(c[R].index!==e.index||c[R].childId!==void 0)continue;let C={phase:e.event};e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(C.objective=e.detail),e.action_type&&(C.actionType=e.action_type),c[R]={...c[R],...C}}return r.children=c,t[o]=r,t})}else h(o=>o.some(t=>t.index===e.index)?o.map(t=>{if(t.index!==e.index)return t;let r={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(r.objective=e.detail),e.action_type&&(r.actionType=e.action_type),{...t,...r}}):[...V(o),{index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type}]);break}case"step_end":{n?.("STEP_END",`Step ${e.index} ${e.status}`,{index:e.index,status:e.status,duration:e.duration,summary:e.summary,child_id:e.child_id}),l?.();let d=e.child_id,u=S.current&&!S.current.isSingleFlow;if(d){let o=t=>t.index===e.index&&t.childId===d?{...t,status:e.status,duration:e.duration,phase:void 0,objective:t.objective.startsWith("Step ")?K(e.summary||t.objective):t.objective}:t,a=t=>t.map(r=>{let c=o(r);return c!==r?c:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let o=Math.max(0,b.current-1);h(a=>{let t=[...a];if(o>=t.length)return a;let r={...t[o]},c=(r.children??[]).map(f=>f.index===e.index&&f.childId===void 0?{...f,status:e.status,duration:e.duration,phase:void 0,objective:f.objective.startsWith("Step ")?K(e.summary||f.objective):f.objective}:f);return r.children=c,t[o]=r,t})}else h(o=>o.map(a=>a.index===e.index?{...a,status:e.status,duration:e.duration,phase:void 0,objective:a.objective.startsWith("Step ")?K(e.summary||a.objective):a.objective}:a));{let a=S.current&&!S.current.isSingleFlow?Math.max(0,b.current-1):0,t=typeof e.ordinal=="number"&&e.id?{ordinal:e.ordinal,id:e.id}:void 0;i?.(e.index,a,e.child_id,t)}break}case"child_agent_start":{let d=e.objective??"",u=e.child_id;h(o=>{let a=j(o,t=>t.status==="running");return a?N(o,a,t=>({...t,objective:`${d} (branch)`,phase:`child: ${d.slice(0,50)}`,branchObjective:d,branchChildId:u})):o});break}case"child_agent_end":{let d=e.child_id,u=`child ${e.success?"done":"failed"}`;h(o=>{let a=j(o,t=>t.branchChildId===d);return a?N(o,a,t=>({...t,phase:u})):o.map(t=>t.phase?.startsWith("child:")?{...t,phase:u}:t)});break}case"describe_trigger":g?.(e);break;case"ask_user":T(e.question??"");break;case"run_end":h(d=>d.map(u=>u.status==="running"?{...u,status:e.status,phase:void 0}:u)),v(!1),B(e);break;case"error":v(!1),k(e.message??"Runner error"),h(d=>d.map(u=>u.status==="running"?{...u,status:"failed",phase:void 0}:u));break}}})().catch(e=>{if(y.current!==L)return;let u=[e instanceof Error?e.message:String(e)],o=L.stderr;o&&!u.join(`
5
- `).includes(o)&&u.push(o),k(u.join(`
6
- `)),v(!1),h(a=>a.map(t=>t.status==="running"?{...t,status:"failed",phase:void 0}:t)),P("runner","Runner died mid-run"),y.current=null,E.current=null,$(a=>a+1)});O.current=q,q.finally(()=>{O.current===q&&(O.current=null)})},[i,n,s,l,g]),xe=(0,p.useCallback)(m=>{y.current?.sendUserResponse(m),T(null)},[]),_e=(0,p.useCallback)(()=>{let m=y.current;m&&(m.cancel(),v(!1),T(null))},[]),be=(0,p.useCallback)(async()=>{let m=y.current;if(m){try{await Promise.race([m.shutdown(),new Promise(x=>setTimeout(x,5e3))])}catch{}P("runner","Runner shut down"),y.current=null,E.current=null,$(x=>x+1)}},[]),Ee=(0,p.useCallback)(()=>{h([]),B(null),k(null)},[]);return(0,p.useEffect)(()=>()=>{F.current=!0,P("runner","Component unmounted"),y.current=null,E.current=null},[]),{isRunning:w,steps:_,askingUser:pe,lastRunEnd:he,runError:fe,bifurcationInfo:me,cmInitCounts:ve,replayInfo:ge,maxSteps:Re,sessionGen:ye,startRun:we,sendAnswer:xe,cancelRun:_e,shutdownRunner:be,clearLastRun:Ee,getEvidenceState:()=>U.current}}export{D as a,le as b,ce as c,je as d,ze as e};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- var i=["emulator","simulator","android","ios"];function r(e){return i.includes(e)?e:void 0}function n(e){return e==="android"||e==="ios"}export{r as a,n as b};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{homedir as s}from"os";import{join as t}from"path";var g="0.8.23";var a=t(s(),".testmuai","kaneai"),b=t(a,"profiles"),h=t(a,"tui-config.json"),_=t(a,"media"),A="https://registry.npmjs.org/@testmuai/kane-cli",x="https://api.github.com/repos/LambdaTest/kane-cli/releases",i="@testmuai/kane-cli-skill",L=`https://registry.npmjs.org/${i}`,r="kane-cli",u=[{dir:t(s(),".claude","skills",r),agent:"Claude Code"},{dir:t(s(),".agents","skills",r),agent:"Codex CLI"},{dir:t(s(),".gemini","skills",r),agent:"Gemini CLI"}],U="https://dd-proxy.lambdatest.com/intake/kane-cli",R="https://kaneai-playground.lambdatest.io",I=9222,E=9230,C=t(a,"chrome-profiles"),o=t(a,"hints"),T=t(o,"state.json");function f(e){return t(o,`catalog-${e}.json`)}var c=t(a,"mobile");function S(e,n="android"){return t(c,n==="ios"?`device-catalog-ios-${e}.json`:`device-catalog-${e}.json`)}var l="127.0.0.1",B=18392,v=18400,p="/callback";function N(e){return`http://${l}:${e}${p}`}var O="KANE CLI",P="*",k={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server",evidenceViewerUrl:"https://evidence.lambdatest.com",mediaArtefactsHost:"prod-mobile-artefacts.lambdatest.com",mobileAppBaseUrl:"https://api.lambdatest.com"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server",evidenceViewerUrl:"https://stage-evidence.lambdatestinternal.com",mediaArtefactsHost:"stage-mobile-artefacts.lambdatestinternal.com",mobileAppBaseUrl:"https://stage-api.lambdatestinternal.com"}},D={orange:"#ff9500",generateAccent:"#0d9488",assuranceAccent:"#b388ff",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444",amber:"#fbbf24"};export{g as a,a as b,h as c,_ as d,A as e,x as f,i as g,u as h,U as i,R as j,I as k,E as l,C as m,T as n,f as o,S as p,l as q,B as r,v as s,p as t,N as u,O as v,P as w,k as x,D as y};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as V,c as H,d as W,e as ie,f as se}from"./chunk-CLQP3DHT.js";import{a as le}from"./chunk-VAN7ECN6.js";import{e as ee}from"./chunk-IIDBLJ5A.js";import{a as te}from"./chunk-MWIE6LOZ.js";import{a as oe}from"./chunk-TONFENRW.js";import{a as re}from"./chunk-6YZ3VP3E.js";import{b as Y}from"./chunk-ZIHG6EKH.js";import{b as Z}from"./chunk-RD72POF2.js";import{a as I}from"./chunk-2KVECC36.js";import{a as T,b as j,d as ne}from"./chunk-VE3SUJMA.js";import{b as Q}from"./chunk-TZXXJWHA.js";import{r as b}from"./chunk-RSSOJ3L2.js";import{i as J}from"./chunk-Z7S3IWUX.js";import{a as D}from"./chunk-DUYRCVI5.js";import{a as B,e as K}from"./chunk-EYOCNMUM.js";import{a as z}from"./chunk-5ESGUPSR.js";import{a as q}from"./chunk-HCBYKLMW.js";import{a as c,b as u,i as L,j as G}from"./chunk-C44QQJR4.js";import{a as ve}from"./chunk-6YGTRKDT.js";import{e as F}from"./chunk-UR6MHSHU.js";var s=F(ve(),1);var o=F(q(),1);function Xe({resultRef:x,mode:g="singleshot",loginCompleteRef:d}){let{exit:p}=G(),A=(0,s.useRef)(new z),E=(0,s.useRef)(new te),v=(0,s.useRef)(new ee),n=A.current,l=E.current,O=v.current,ae=V(),[h,f]=(0,s.useState)(g==="login"?"login":"gate"),[M,ce]=(0,s.useState)(null),[xe,R]=(0,s.useState)(null),[Pe,$]=(0,s.useState)(null),[N,ue]=(0,s.useState)(null),[X,S]=(0,s.useState)([]),P=(0,s.useCallback)((e,t,i,r)=>O.log(e,t,i,r),[O]),we=(0,s.useCallback)((e,t)=>{e?T(n,l,e,t):l.save({project_id:null,project_name:null,folder_id:null,folder_name:null})},[n,l]),C=(0,s.useCallback)(()=>{if(g==="login")d&&(d.current=!0),p();else{let e=l.load().mobile,t=B(e?.tui_target,e?.default_target?.kind),i=(t.kind==="unset"||t.kind==="choose-mobile")&&Q();f(i?"target":"input")}},[g,p,d,l]),k=(0,s.useCallback)((e,t)=>{let i=T(n,l,e,t);if(g==="login"){f("ensure-project");return}ne(i)?C():i.projectId?f("ensure-folder"):f("ensure-project")},[n,l,C,g]);L((e,t)=>{t.ctrl&&e==="c"&&b(0,"Ctrl+C exit")});let U=(0,s.useRef)(!1);s.default.useEffect(()=>{U.current||(U.current=!0,g!=="login"&&se(n,P).then(e=>{ce(e),e.status==="authenticated"?k(e.result.profile,e.result.env):e.status==="needs_pick"?f("pick"):(R(e.profile??null),$(e.env??null),f("login"))}).catch(e=>{ue(`Auth check failed: ${e instanceof Error?e.message:String(e)}`)}))},[n,P]);let fe=(0,s.useCallback)(e=>{x.current={objective:e},p()},[x,p]),de=(0,s.useCallback)(async(e,t)=>{n.setActiveProfile(e),n.setDefaultEnv(t),(await ie(n,e,t,P)).status==="authenticated"?k(e,t):(R(e),$(t),f("login"))},[n,P,k]),w=(0,s.useCallback)(()=>{let e=n.getActiveProfile(),t=n.getDefaultEnv();if(!e)return null;let i=D(t),r=n.loadBasicAuth(e,t);return new oe(i.controllerBaseUrl,async()=>n.loadCredentials(e,t)?.access_token??null,r,P)},[n,P]),ge=(0,s.useCallback)(async()=>{let e=w();if(!e)return null;let t=e.cached??await e.resolve();if(!t)return null;let i=D(n.getDefaultEnv()),r=new I(i.tmsBaseUrl,t.username,t.access_key);try{let m=(await r.listProjects()).find(_=>_.name==="KaneAI Generated");if(m)return{id:m.project_id,name:m.name};let y=await r.createProject("KaneAI Generated");return{id:y.id,name:y.name}}catch{return null}},[w,n]),me=(0,s.useCallback)(async e=>{let t=w();if(!t)return null;let i=t.cached??await t.resolve();if(!i)return null;let r=D(n.getDefaultEnv()),a=new I(r.tmsBaseUrl,i.username,i.access_key);try{let y=(await a.listFolders(e)).find(pe=>pe.name==="Untitled");if(y)return{id:y.id,name:y.name};let _=await a.createFolder(e,"Untitled");return{id:_.id,name:_.name}}catch{return null}},[w,n]);if(h==="gate")return(0,o.jsx)(c,{paddingX:1,children:(0,o.jsx)(u,{color:"yellow",children:"Checking authentication..."})});if(N)return(0,o.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,o.jsx)(u,{color:"red",children:N}),(0,o.jsx)(u,{color:"gray",children:"Press Ctrl+C to exit."})]});if(h==="pick"&&M?.status==="needs_pick")return(0,o.jsx)(he,{profiles:M.profiles,onSelect:de});if(h==="login")return(0,o.jsx)(W,{devMode:process.env.KANE_DEV_MODE==="1",profiles:n.listProfiles(),onBasicLogin:async(e,t,i,r)=>{let{validateBasicAuth:a}=await import("./validate-basic-V7R4RH5M.js");await a(t,i,r),n.saveBasicAuth(e,t,{username:i,access_key:r}),n.setActiveProfile(e),n.setDefaultEnv(t)},onOAuthLogin:async(e,t)=>{let{LoginFlow:i}=await import("./login-flow-OHNKSVYZ.js");n.setDefaultEnv(t),n.setActiveProfile(e),await new i(e,t,n).login()},onComplete:(e,t)=>{R(e),$(t),n.setActiveProfile(e),n.setDefaultEnv(t),k(e,t)},onCancel:()=>{b(0,"Login cancelled")}});if(h==="ensure-project"){let e=n.getActiveProfile()??"default",t=n.getDefaultEnv(),i=()=>{if(g==="login"){f("ensure-folder");return}T(n,l,e,t).folderId?C():f("ensure-folder")};return(0,o.jsxs)(c,{flexDirection:"column",children:[(0,o.jsx)(c,{paddingX:1,marginBottom:1,children:(0,o.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,o.jsx)(Y,{resolver:w(),currentProjectId:l.load().project_id,env:t,onSelect:(r,a)=>{j(n,l,e,t,{projectId:r,projectName:a}),S(m=>[...m,`\u2713 Project: ${a} (${r})`]),i()},onCancel:async()=>{let r=await ge();r&&(j(n,l,e,t,{projectId:r.id,projectName:r.name}),S(a=>[...a,`\u2713 Default project: ${r.name} (${r.id})`]),i())}})]})}if(h==="ensure-folder"){let e=n.getActiveProfile()??"default",t=n.getDefaultEnv(),i=n.loadProfileConfig(e,t);return(0,o.jsxs)(c,{flexDirection:"column",children:[(0,o.jsx)(c,{paddingX:1,marginBottom:1,children:(0,o.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,o.jsx)(Z,{resolver:w(),projectId:i?.project_id??"",currentFolderId:l.load().folder_id,env:t,onSelect:(r,a)=>{j(n,l,e,t,{folderId:r,folderName:a}),S(m=>[...m,`\u2713 Folder: ${a} (${r})`]),C()},onCancel:async()=>{if(!i?.project_id)return;let r=await me(i.project_id);r&&(j(n,l,e,t,{folderId:r.id,folderName:r.name}),S(a=>[...a,`\u2713 Default folder: ${r.name} (${r.id})`]),C())}})]})}if(h==="target"){let e=B(l.load().mobile?.tui_target,l.load().mobile?.default_target?.kind).kind==="choose-mobile";return(0,o.jsx)(c,{paddingX:1,children:(0,o.jsx)(le,{mode:e?"mobile-only":"all",onSelect:t=>{l.setMobile({tui_target:t}),f("input")},onCancel:()=>f("input")})})}if(h==="input"){let e=l.load().mobile,t=B(e?.tui_target,e?.default_target?.kind),i=(()=>{if(t.kind==="emulator"||t.kind==="simulator"){let r=J(e?.default_target)??"(no device)",a=re(e?.default_app)??"(no app)";return`Config: ${K(t.kind)} \xB7 ${r} \xB7 ${a}`}return"Config: Desktop \xB7 Chrome"})();return(0,o.jsxs)(c,{flexDirection:"column",children:[X.length>0&&(0,o.jsx)(c,{flexDirection:"column",paddingX:1,marginBottom:1,children:X.map((r,a)=>(0,o.jsx)(u,{color:"green",children:r},a))}),(0,o.jsx)(c,{paddingX:1,children:(0,o.jsx)(u,{color:"gray",children:i})}),(0,o.jsx)(H,{onSubmit:fe,onEscape:()=>b(0,"User pressed Escape"),history:ae,placeholder:"Type an objective..."})]})}return(0,o.jsx)(o.Fragment,{})}function he({profiles:x,onSelect:g}){let[d,p]=(0,s.useState)(0),[A,E]=(0,s.useState)(!1);return L((v,n)=>{if(!A){if(n.escape){b(0,"Profile picker cancelled");return}if(n.upArrow&&d>0&&p(l=>l-1),n.downArrow&&d<x.length-1&&p(l=>l+1),n.return){E(!0);let l=x[d];g(l.profile,l.env).catch(()=>E(!1))}}}),(0,o.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,o.jsx)(u,{color:"#ff9500",bold:!0,children:"Select a profile:"}),(0,o.jsx)(c,{marginTop:1,flexDirection:"column",children:x.map((v,n)=>(0,o.jsxs)(u,{children:[n===d?"\u276F ":" ",(0,o.jsx)(u,{color:n===d?"#ff9500":"white",bold:n===d,children:v.profile}),(0,o.jsxs)(u,{color:"gray",children:[" [",v.env,"]"]})]},`${v.profile}-${v.env}`))}),A&&(0,o.jsx)(c,{marginTop:1,children:(0,o.jsx)(u,{color:"yellow",children:"Validating credentials..."})})]})}export{Xe as a};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as G,f as q,h as H}from"./chunk-HBSYBL6J.js";import{a as j,b as z,c as K}from"./chunk-KJIDMW6N.js";import{d as B,f as O}from"./chunk-LHUW5QDT.js";import{a as N}from"./chunk-MMBBQ4OZ.js";import{b as F,c as $,j as R}from"./chunk-GFNCGN5V.js";import{a as L}from"./chunk-TZXXJWHA.js";import{n as T}from"./chunk-RSSOJ3L2.js";import{a as Y,b as C,c as V}from"./chunk-HJX5PQRD.js";import{h as J}from"./chunk-TAOHYWEO.js";import{e as E}from"./chunk-Z7S3IWUX.js";import{b as M}from"./chunk-CXF6AZWY.js";function X(e){return e.kind==="simulator"?e.id:e.virtualName??e.id}function Z(e,r,t={}){let o={platform:e.platform,udid:e.id,target:e.kind};return r&&(o.app_package=r),t.noReset!==void 0&&(o.no_reset=t.noReset),t.appiumUrl&&(o.appium_url=t.appiumUrl),e.platform==="android"&&t.autoGrantPermissions!==void 0&&(o.auto_grant_permissions=t.autoGrantPermissions),e.platform==="ios"&&t.autoAcceptAlerts!==void 0&&(o.auto_accept_alerts=t.autoAcceptAlerts),o}function Q(e=process.env){let r=e.KANE_APPIUM_URL?.trim();return r||null}import{createHash as De}from"crypto";import{readdir as xe,stat as ke}from"fs/promises";import{basename as g,extname as Ie,join as Ue,relative as Se}from"path";import{createHash as ge}from"crypto";import{createReadStream as fe}from"fs";import{mkdir as me,readFile as he,rename as ve,writeFile as we}from"fs/promises";import{dirname as be,join as ye}from"path";var Pe=60,Te=5;function W(){return{entries:[]}}function ee(){return ye(M,"mobile","app-cache.json")}async function A(e){let r=ge("sha256");for await(let t of fe(e))r.update(t);return r.digest("hex")}function Ce(){return{readFile:e=>he(e,"utf8"),writeFile:async(e,r)=>{await me(be(e),{recursive:!0});let t=`${e}.tmp`;await we(t,r),await ve(t,e)},hashFile:A,now:()=>new Date}}function D(e){if(!e)return;let r=/\/(\d{4})\/(\d{2})\/(\d{2})\//.exec(e);if(!r)return;let[,t,o,a]=r,s=new Date(`${t}-${o}-${a}T00:00:00Z`);return Number.isNaN(s.getTime())?void 0:s.toISOString()}function Ae(e,r){if(!e.storedAt)return!0;let t=new Date(e.storedAt).getTime();return Number.isNaN(t)?!0:(r.getTime()-t)/864e5>=Pe-Te}var u=class{deps;constructor(r={}){this.deps={...Ce(),...r}}async read(){try{let r=JSON.parse(await this.deps.readFile(ee()));if(!r||typeof r!="object")return W();let t=r;return{entries:Array.isArray(t.entries)?t.entries:[]}}catch{return W()}}async write(r){await this.deps.writeFile(ee(),JSON.stringify(r,null,2))}async hashOf(r){return this.deps.hashFile(r)}async lookup(r){return(await this.read()).entries.find(o=>o.sha256===r.sha256&&o.env===r.env&&o.orgId===r.orgId&&o.type===r.type)}async remember(r){let t=await this.read();t.entries=[...t.entries.filter(o=>!(o.sha256===r.sha256&&o.env===r.env&&o.orgId===r.orgId&&o.type===r.type)),r],await this.write(t)}async forget(r){let t=await this.read(),o=t.entries.length;t.entries=t.entries.filter(a=>!(a.sha256===r.sha256&&a.env===r.env&&a.orgId===r.orgId&&a.type===r.type)),t.entries.length!==o&&await this.write(t)}isNearExpiry(r){return Ae(r,this.deps.now())}};var re={emulator:[".apk"],simulator:[".zip"]};function te(e){return e.skipped===!0}function _e(e,r){let t=Ie(e).toLowerCase();return t===".ipa"?`${g(e)} is a device build \u2014 .ipa is not accepted for ${r} runs.`:re[r].includes(t)?null:`${g(e)} cannot be uploaded for a ${r} run \u2014 expected one of ${re[r].join(", ")}.`}async function x(e,r){if(!(await ke(e)).isDirectory())return r.hashOf(e);let o=[],a=async p=>{for(let i of await xe(p,{withFileTypes:!0})){let n=Ue(p,i.name);i.isDirectory()?await a(n):i.isFile()&&o.push(n)}};await a(e),o.sort();let s=De("sha256");for(let p of o)s.update(Se(e,p)),s.update("\0"),s.update(await A(p)),s.update("\0");return s.digest("hex")}async function oe(e){let r=_e(e.path,e.type);if(r)return{skipped:!0,reason:r};let t=e.cache??new u,o=e.client??new J(e.baseUrl,{...e.auth,orgId:e.orgId}),a;try{a=await x(e.path,t)}catch(i){return{skipped:!0,reason:`could not read ${g(e.path)}: ${i.message}`}}let s={sha256:a,env:e.env,orgId:e.orgId,type:e.type},p=await t.lookup(s);if(p){if(await o.liveness(p.appId)!=="gone")return{appId:p.appId,...p.appUrl?{appUrl:p.appUrl}:{},fromCache:!0};e.onProgress?.(`${p.appId} is no longer in the cloud \u2014 uploading again`),await t.forget(s)}try{e.onProgress?.(`uploading ${g(e.path)}\u2026`);let i=await o.upload(e.path,e.type);return await t.remember({sha256:a,env:e.env,orgId:e.orgId,type:e.type,appId:i.appId,...i.appUrl?{appUrl:i.appUrl}:{},...D(i.url)?{storedAt:D(i.url)}:{},sourcePath:e.path}),e.onProgress?.(i.cached?`${g(e.path)} already in the cloud (${i.appId})`:`${g(e.path)} uploaded (${i.appId})`),{appId:i.appId,...i.appUrl?{appUrl:i.appUrl}:{},fromCache:!1}}catch(i){return{skipped:!0,reason:i.message}}}function v(e){return`${e.platform}|${X(e)}`}var m=new Map,ae=new Set;function ie(e){return ae.has(v(e))}function nr(e,r,t){r.state==="stopped"&&(m.has(v(r))||se(e,r,t))}async function ne(e,r,t){let o=m.get(v(r));return o?(t?.(`waiting for ${r.displayName} to finish booting\u2026`),o):se(e,r,t)}function se(e,r,t){let o=v(r),a=e.prepare(r,t);m.set(o,a),r.state==="stopped"&&a.then(()=>ae.add(o),()=>{});let s=()=>{m.get(o)===a&&m.delete(o)};return a.then(s,s),a.catch(()=>{}),a}import{basename as Me}from"path";import{spawnSync as Ee}from"child_process";async function Fe(e,r,t){if(!e.teardownPlan||!t.appPackage&&!t.shutdown)return;let o;try{o=await e.teardownPlan(r,t)}catch{return}o.length!==0&&T(`device:${r.id}`,()=>{G({udid:r.id,displayName:r.displayName});for(let a of o)try{Ee(a.file,a.args,{timeout:3e4,stdio:"ignore"})}catch{}})}var pe={emulator:[".apk"],simulator:[".zip"]};async function $e(e,r,t,o){if(e.kind==="package")return e;if(e.kind==="app_id"){let a=r.cloudUpload;if(!a)throw new Error(`${e.value} is an app id, which needs an account to download it. Log in, or pass a path to a local build instead.`);let s=await V({appId:e.value,baseUrl:a.baseUrl,auth:a.auth,...pe[t]?{accepts:pe[t]}:{},...o?{onProgress:o}:{}}),p=I(s.path);if(!p||p.kind==="app_id")throw new Error(`${s.name} is not a build this CLI can install (from ${e.value}).`);return p}try{let a=new u,s=await x(e.value,a),p=new Y;await p.find(s)||o?.(`copying ${Me(e.value)} into the local app store\u2026`);let n=await p.put({key:s,sourcePath:e.value,source:"local"});return{...e,value:n.path}}catch{return e}}function Re(e){T(`appium:${e}`,()=>{H({deviceClass:e,owner:process.pid})})}var k=class extends Error{constructor(r){super(r),this.name="MobileHostUnsupportedError"}},w=class extends Error{constructor(t,o){super(t);this.doctorText=o;this.name="MobilePreflightError"}};async function Ne(e,r,t){let o=t.cloudUpload,a=await oe({path:e,type:r,env:o.env,orgId:o.orgId,userId:o.userId,auth:o.auth,baseUrl:o.baseUrl,...t.onProgress?{onProgress:t.onProgress}:{}});if(te(a)){t.onProgress?.(`app not uploaded \u2014 ${a.reason}`);return}return a.appId}var Be="app must be a build (.apk for an emulator, .zip of the .app bundle for a simulator) or an app id from your cloud uploads \u2014 a package id names something already installed on one device, so it cannot be uploaded, exported as code, or run anywhere else.",de=/\.(apk|zip)$/i;function I(e){let r=e.trim();if(C(r))return{kind:"app_id",value:r};let t=de.exec(r)?.[1]?.toLowerCase();return t?{kind:t,value:r}:null}function Oe(e){return!!e&&(de.test(e)||C(e.trim()))}function Le(e){return e.filter(r=>r.required&&r.status==="fail")}function je(e,r){return!!r&&E(e,r)}async function Dr(e){let r=L();if(!r.supported)throw new k(r.reason);let t=Q()??e.appiumUrl??e.defaults?.appium_url,o=!!(e.agent||!e.interactive),a=R(),s=!!N();o&&e.platform?.toLowerCase()!=="ios"&&!s&&((await a.status("emulator")).installed||await a.ensure("emulator",{automatic:!0,onProgress:e.onProgress}));let p=await j(e.platform,{appiumUrl:t});if(K(p)){let d=p.sections.flatMap(P=>Le(P.checks)).map(P=>P.label).join(", ");throw new w(`Mobile toolchain not ready (${d}). Run \`kane-cli doctor --target ${e.platform?.toLowerCase()==="ios"?"simulator":e.platform?.toLowerCase()==="android"?"emulator":"<emulator|simulator>"}\` for details.`,z(p))}let i=await O({device:e.device,platform:e.platform,defaultTarget:e.defaults?.default_target,interactive:e.interactive}),n;if(i.ok)n=i.target;else if(i.reason==="needs-picker"&&e.pickTarget){let d=await e.pickTarget(i.candidates);if(!d)throw new Error("Target selection cancelled");n=d}else throw new Error(i.message);let f=B(n.platform);if(!f)throw new Error(`No provider for platform "${n.platform}"`);let l=F(n);if(!l)throw new Error(`No managed dependencies serve ${n.platform} ${n.kind} targets yet.`);if(!(s&&n.platform.toLowerCase()==="android"))try{await a.ensure(l,{automatic:o,onProgress:e.onProgress})}catch(d){throw d instanceof $?new w(d.message,d.message):d}let le=n.state!=="ready"||ie(n);n=await ne(f,n,e.onProgress);let ce=await q(l,{...t?{appiumUrl:t}:{},device:{udid:n.id,displayName:n.displayName},onProgress:e.onProgress});Re(l);let U=je(n,e.defaults?.default_target)?e.defaults?.default_app:void 0,h=e.app??(Oe(U)?U:void 0);if(e.app&&!I(e.app))throw new Error(`${e.app}: ${Be}`);let c=h?I(h):null,S=c?await $e(c,e,l,e.onProgress):null,b=S?await f.ensureApp(n,S,e.onProgress):void 0,y=c?.kind==="app_id"?c.value:e.cloudUpload&&c&&h?await Ne(c.value,l,e):void 0;await Fe(f,n,{shutdown:le,...b?{appPackage:b}:{}});let ue=Z(n,b,{noReset:e.noReset??e.defaults?.no_reset,appiumUrl:ce.url,autoGrantPermissions:e.defaults?.auto_grant_permissions,autoAcceptAlerts:e.defaults?.auto_accept_alerts}),_=y??h;return{device:ue,target:n,provider:f,...y?{appId:y}:{},..._?{appRef:_}:{}}}export{X as a,Z as b,te as c,_e as d,oe as e,nr as f,ne as g,k as h,w as i,Be as j,I as k,Oe as l,Dr as m};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- var o=["desktop","emulator","simulator"],r=["emulator","simulator"];function i(e,n){return e===void 0||e===""?{kind:"unset"}:o.includes(e)?{kind:e}:e==="web"?{kind:"desktop"}:e==="mobile"?r.includes(n??"")?{kind:n}:{kind:"choose-mobile"}:{kind:"unset"}}function s(e){return e==="emulator"||e==="simulator"}function u(e){if(e==="emulator")return"android";if(e==="simulator")return"ios"}function a(e){return r.includes(e)?e:void 0}var t={desktop:"Desktop",emulator:"Emulator",simulator:"Simulator"};function d(e){return t[e]}export{i as a,s as b,u as c,a as d,d as e};
@@ -1,8 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{j as R,k}from"./chunk-EM3PU2YW.js";import{d as f,i as v}from"./chunk-Z7S3IWUX.js";import{a as _,c as $,e as m}from"./chunk-EYOCNMUM.js";var x=["desktop","emulator","simulator"];function T(e,t){return e.kind==="app_id"?!0:t==="emulator"?e.kind==="apk":e.kind==="zip"}function I(e){let t=e.deviceName,n=e.osVersion;return t!==void 0&&t.trim()===""||n!==void 0&&n.trim()===""?{ok:!1,message:"--device-name and --os-version cannot be empty."}:{ok:!0,...t!==void 0?{name:t.trim()}:{},...n!==void 0?{osVersion:n.trim()}:{}}}function A(e){return`--device-name needs an OS version \u2014 a bare name matches every runtime that ships it.
3
- Provide one: ${e}`}function h(e,t,n){let s=k(e);return s?T(s,t)?null:t==="emulator"?`${n} cannot run on an emulator (needs an .apk, or an APP\u2026 id).`:`${n} cannot run on a simulator (needs a .zip of the .app bundle, or an APP\u2026 id).`:`${e}: ${R}`}function V(e){return x.includes(e)?e:null}function w(e){return`--target must be one of desktop, emulator, simulator (got "${e}")`}function y(e){let t=[];for(let[n,s]of[["--device-name",e.deviceName],["--os-version",e.osVersion],["--app",e.app]])s!==void 0&&t.push(`ignored ${n} ${s}: session target is desktop \u2014 set --target emulator|simulator to run on a device`);return t}function K(e){let{flags:t,saved:n}=e,s=[],o;if(t.target!==void 0){let i=V(t.target);if(!i)return{kind:"invalid",message:w(t.target)};o=i}else{let i=_(n?.tui_target,n?.default_target?.kind);if(i.kind==="choose-mobile")return{kind:"choose-mobile-kind"};o=i.kind==="unset"?"desktop":i.kind}if(o==="desktop")return s.push(...y(t)),{kind:"web",warnings:s};if(!e.host.supported)return{kind:"invalid",message:e.host.reason??"this machine cannot run mobile targets."};let g=[],r,u,d=I(t);if(!d.ok)return{kind:"invalid",message:d.message};let c=n?.default_target&&n.default_target.kind===o?f(n.default_target):void 0;if(d.name!==void 0||d.osVersion!==void 0){let i=d.name??c?.name,a=d.osVersion??c?.osVersion;if(a===void 0)return{kind:"invalid",message:A("--os-version <version>, or save one (kane-cli config set-os-version)")};u={...i!==void 0?{name:i}:{},osVersion:a},r={value:i?`${i} (${a})`:`any device on ${a}`,source:"flag"}}else if(n?.default_target&&n.default_target.kind===o&&(f(n.default_target)!==void 0||n.default_target.id!==void 0))r={value:v(n.default_target)??"(saved device)",source:"saved"};else{if(n?.default_target&&n.default_target.kind!==o&&(f(n.default_target)!==void 0||n.default_target.id!==void 0))return{kind:"invalid",message:`Your saved device '${v(n.default_target)}' is ${n.default_target.kind==="simulator"?"a simulator":"an emulator"}, but this run targets ${o==="simulator"?"a simulator":"an emulator"}. Pass --device-name and --os-version, or update your config (set-target, set-device-name, set-os-version).`};g.push("device")}let l;if(t.app!==void 0){let i=h(t.app,o,`--app ${t.app}`);if(i)return{kind:"invalid",message:i};l={value:t.app,source:"flag"}}else{let i=n?.default_app,a=i?k(i):null;a&&T(a,o)&&n?.default_target?.kind===o?l={value:i,source:"saved"}:g.push("app")}return{kind:"mobile",target:o,...u?{deviceSelector:u}:{},...r?{device:r}:{},...l?{app:l}:{},missing:g,warnings:s}}var S={emulator:"an emulator",simulator:"a simulator",android:"a real device",ios:"a real device"};function P(e){let t=[];for(let[n,s]of[["--device-name",e.deviceName],["--os-version",e.osVersion],["--app",e.app]])s!==void 0&&t.push(`ignored ${n} ${s}: a real-device run takes its device and app from the run's device config`);return t}function E(e){return`this run was given a device config (KANE_CLI_DEVICE_CONFIG), so it runs on a real device, but the test file ${e?`has \`target: ${e}\``:"has no `target:` (a web test)"} \u2014 only a \`target: android\` or \`target: ios\` test runs on a real device.`}function M(e){let{flags:t,file:n}=e,s=[],o=n.target==="emulator"||n.target==="simulator"?n.target:void 0,g=n.target==="android"||n.target==="ios"?n.target:void 0,r;if(t.target!==void 0){let a=V(t.target);if(!a)return{kind:"invalid",message:w(t.target)};r=a;let p=o??g;p&&p!==r&&s.push(`--target ${r} overrides the file's \`target: ${p}\` \u2014 steps recorded on ${S[p]} may not replay here`)}else{if(g)return e.grid?(s.push(...P(t)),{kind:"real-device",platform:g,warnings:s}):{kind:"invalid",message:`\`target: ${g}\` is not supported. Supported mobile targets: \`emulator\`, \`simulator\`.`};r=o??"desktop"}if(r!=="desktop"&&e.grid)return{kind:"invalid",message:`KANE_CLI_GRID is set, which works only for real-device tests (\`target: android\` / \`target: ios\`), and this test targets ${S[r]}. Unset KANE_CLI_GRID and try again.`};if(e.deviceConfig)return{kind:"invalid",message:E(n.target)};if(r==="desktop")return s.push(...y(t)),{kind:"web",warnings:s};let u=I(t);if(!u.ok)return{kind:"invalid",message:u.message};let d=u.name??(n.device_name?.trim()||void 0),c=u.osVersion??(n.os_version?.trim()||void 0);if(d!==void 0&&c===void 0)return{kind:"invalid",message:A("--os-version <version>, or os_version: in the test file")};let l=c!==void 0?{...d!==void 0?{name:d}:{},osVersion:c}:void 0;if(r==="simulator"&&l&&l.name===void 0&&s.push(`the file names no device_name \u2014 any simulator on ${c} may be used. Add device_name: to the file (or pass --device-name) to pin the device.`),t.app!==void 0){let a=h(t.app,r,`--app ${t.app}`);if(a)return{kind:"invalid",message:a}}else if(n.app){let a=h(n.app,r,`the file's app: ${n.app}`);if(a)return{kind:"invalid",message:a}}let i=t.app??(n.app||void 0);return{kind:"mobile",target:r,platform:$(r)??"",...i?{app:i}:{},...l?{deviceSelector:l}:{},...n.no_reset!==void 0?{noReset:n.no_reset}:{},warnings:s}}function L(e){return e.target==="desktop"?"Running on: Desktop \xB7 Chrome":`Running on: ${m(e.target)} \xB7 ${e.deviceLabel} \xB7 ${e.appLabel}`}var b={emulator:"</path/to/app.apk | AppId>",simulator:"</path/to/app.zip | AppId>"};function N(e,t){let n=m(e).toLowerCase();return t==="device"?[`session target is "${n}" but no device is set.`,` See devices: kane-cli devices list --target ${e}`,' Set one: kane-cli config set-device-name "<name>" && kane-cli config set-os-version "<version>"',' Or per-run: --device-name "<name>" --os-version "<version>"'].join(`
4
- `):[`session target is "${n}" but no app is set.`,` Set one: kane-cli config set-app ${b[e]}`,` Or per-run: --app ${b[e]}`].join(`
5
- `)}function O(e){return[`saved device "${e}" was not found on this machine.`," See devices: kane-cli devices list",' Set one: kane-cli config set-device-name "<name>" && kane-cli config set-os-version "<version>"'].join(`
6
- `)}function j(e,t){return[`saved app ${e} no longer exists on disk.`," The build may have been moved or cleaned. Set a new one:",` kane-cli config set-app ${b[t]}`].join(`
7
- `)}var G=['session target is "mobile" from an older version \u2014 say which kind:'," kane-cli config set-target emulator|simulator"].join(`
8
- `);export{T as a,I as b,A as c,K as d,M as e,L as f,N as g,O as h,j as i,G as j};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as C}from"./chunk-5HOHXV2K.js";import{k as Z}from"./chunk-EM3PU2YW.js";import{a as D}from"./chunk-YCCUBQY4.js";import{a as M}from"./chunk-MKQ7ZRDW.js";import{a as z}from"./chunk-LHUW5QDT.js";import{b as W}from"./chunk-HJX5PQRD.js";import{a as B}from"./chunk-CSVPZ33X.js";import{e as V}from"./chunk-Z7S3IWUX.js";import{y as o}from"./chunk-CXF6AZWY.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as n,b as t,i as L}from"./chunk-C44QQJR4.js";import{a as N}from"./chunk-6YGTRKDT.js";import{e as g}from"./chunk-UR6MHSHU.js";var T=g(A(),1);function te(e){let i=e.kind==="simulator";switch(e.state){case"ready":return i?"Booted":"Running";case"stopped":return i?"Shutdown":"Stopped";case"unauthorized":return"UNAUTHORIZED";case"offline":return"Offline"}}function re(e){switch(e.state){case"unauthorized":return"accept the authorisation prompt on the device, then reopen this list";case"offline":return e.kind==="simulator"?"not responding \u2014 open Simulator.app to inspect it":"not responding \u2014 reconnect it, or restart the emulator";default:return}}function ne(e,i){let m=i.id!==void 0?{...i,id:z(i.id)}:i,c=e.virtualName!==void 0?{...e,virtualName:z(e.virtualName)}:e;return V(c,m)}function ie(e){return e.virtualName??e.displayName}function ae(e,i){let m=e.state==="ready"||e.state==="stopped",c=re(e),b=e.osVersion?` (${e.osVersion})`:"";return{id:e.id,label:`${ie(e)}${b} \xB7 ${te(e)}`,...i&&ne(e,i)?{isActive:!0}:{},...m?{}:{disabled:!0},...!m&&c?{disabledHint:c}:{}}}function le(e){return e==="emulator"?"No Android emulator found. Make sure an emulator exists on this machine (Android Studio \u2192 Device Manager), then reopen this list.":e==="simulator"?"No iOS simulator found. Make sure a simulator exists on this machine (Xcode \u2192 Windows \u2192 Devices and Simulators), then reopen this list.":"No emulator or simulator found. Make sure one exists on this machine, then reopen this list."}function he({targets:e,preselectedTarget:i,preselectedId:m,busyMessage:c,onSelect:b,onCancel:f,kind:l}){if(c)return(0,T.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,T.jsx)(t,{color:o.orange,bold:!0,children:"Device"}),(0,T.jsxs)(n,{marginTop:1,children:[(0,T.jsx)(C,{}),(0,T.jsxs)(t,{color:o.secondary,children:[" ",c]})]})]});if(e.length===0)return(0,T.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,T.jsx)(t,{color:o.orange,bold:!0,children:"Device"}),(0,T.jsx)(n,{marginTop:1,children:(0,T.jsx)(t,{color:o.dim,children:le(l)})})]});let d=e.map(r=>ae(r,i)),p=i?d.find(r=>r.isActive)?.id??null:m?e.find(r=>r.id===m||r.virtualName===m)?.id??null:null,a=new Map(e.map(r=>[r.id,r]));return(0,T.jsx)(M,{title:"Device",items:d,itemNoun:"devices",defaultActiveId:p,preserveSelectionById:!0,onSelect:r=>{let y=a.get(r.id);y&&b(y)},onCancel:f})}var x=g(N(),1);var u=g(A(),1),q=50,G=500;function pe(e){return`${e.name} (${e.appId})`}function Pe({kind:e,listApps:i,onSelect:m,onManualEntry:c,onCancel:b,busyMessage:f}){let[l,d]=(0,x.useState)([]),[p,a]=(0,x.useState)(!0),[r,y]=(0,x.useState)(!1),[Q,O]=(0,x.useState)(!1),[E,H]=(0,x.useState)(null),[w,J]=(0,x.useState)(""),[j,U]=(0,x.useState)(!1),$=(0,x.useRef)(!0),R=(0,x.useRef)(0);if((0,x.useEffect)(()=>{let h=++R.current,k=w.trim();$.current?a(!0):k&&O(!0),y(!0),H(null),U(!1),(async()=>{let I=[];try{for(let P=0;;P+=q){let X=await i({limit:q,offset:P,search:k});if(h!==R.current)return;if(I.push(...X.apps),d([...I]),$.current&&(a(!1),$.current=!1),O(!1),X.apps.length===0||I.length>=X.total)break;if(I.length>=G){U(!0);break}}}catch(P){if(h!==R.current)return;H(P instanceof Error?P.message:String(P)),a(!1),O(!1)}finally{h===R.current&&y(!1)}})()},[w,i]),L((h,k)=>{if(k.tab){c();return}k.escape&&b()},{isActive:!!E&&!f}),f)return(0,u.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,u.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,u.jsxs)(n,{marginTop:1,children:[(0,u.jsx)(C,{}),(0,u.jsxs)(t,{color:o.secondary,children:[" ",f]})]})]});if(E)return(0,u.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.red,paddingX:2,paddingY:1,children:[(0,u.jsx)(t,{color:o.red,bold:!0,children:"App under test"}),(0,u.jsx)(n,{marginTop:1,children:(0,u.jsx)(t,{color:o.red,children:"Could not load your uploads."})}),(0,u.jsx)(n,{marginTop:1,children:(0,u.jsx)(t,{color:o.dim,children:E})}),(0,u.jsx)(B,{bindings:[{keys:"tab",label:"tab to enter an app id"}],escBackLabel:"back to chat"})]});let ee=new Map(l.map(h=>[h.appId,h])),oe=l.map(h=>({id:h.appId,label:pe(h)})),_=!p&&!r&&l.length===0&&!w.trim()?e==="simulator"?"No simulator builds uploaded to this account yet \u2014 press Tab to enter an app id.":"No emulator builds uploaded to this account yet \u2014 press Tab to enter an app id.":null;return(0,u.jsx)(M,{title:"App under test",items:oe,loading:p,loadingText:"Loading your uploads\u2026",loadingMore:r,searching:Q,itemNoun:"uploads",preserveSelectionById:!0,onSearch:J,onTab:c,extraHint:"tab to enter an id",footer:_?(0,u.jsx)(t,{color:o.dim,children:_}):j?(0,u.jsx)(t,{color:o.dim,children:`Showing the first ${G} \u2014 type to search the rest.`}):void 0,onSelect:h=>{let k=ee.get(h.id);k&&m({appId:k.appId,name:k.name})},onCancel:b})}var Y=g(N(),1);var S=g(A(),1),se={emulator:["apk"],simulator:["zip"]};function ce(e){return Z(e.trim())}function Oe({kind:e,onBack:i,onSelect:m,onCancel:c}){let[b,f]=(0,Y.useState)(""),[l,d]=(0,Y.useState)(null),p=e==="emulator"?".apk":".zip";return(0,S.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,S.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,S.jsx)(n,{marginTop:1,children:(0,S.jsx)(t,{color:o.dim,children:`Path to a build (${p}): `})}),(0,S.jsxs)(n,{marginTop:1,children:[(0,S.jsx)(t,{color:o.dim,children:" "}),(0,S.jsx)(D,{value:b,onChange:a=>{f(a),l&&d(null)},onSubmit:a=>{let r=ce(a);if(!r){d(a.trim()?`Not a build \u2014 expected ${p}.`:"Enter the path to a build.");return}if(!se[e].includes(r.kind)){d(`${r.kind} builds don't run on a ${e} \u2014 expected ${p}.`);return}d(null),m(r).then(y=>{!y.ok&&y.error&&d(y.error)})},onCancel:i,placeholder:e==="emulator"?"/path/to/app-debug.apk":"/path/to/MyApp.zip"})]}),l&&(0,S.jsx)(n,{marginTop:1,children:(0,S.jsx)(t,{color:o.red,children:l})}),(0,S.jsx)(B,{bindings:[{keys:"\u21B5",label:"use this build"}],escBackLabel:"back"})]})}var F=g(N(),1);var v=g(A(),1);function de(e){return[{value:"local",label:"Local build",hint:e==="emulator"?".apk":".zip",available:!0},{value:"uploaded",label:"Uploaded app",hint:"an app id from your cloud uploads",available:!0}]}function Ye({kind:e,onSelect:i,onCancel:m}){let c=de(e),[b,f]=(0,F.useState)(0),[l,d]=(0,F.useState)(null);return L((p,a)=>{if(a.escape){m();return}if(a.upArrow&&f(r=>Math.max(0,r-1)),a.downArrow&&f(r=>Math.min(c.length-1,r+1)),a.return){let r=c[b];if(!r.available){d("That source isn't available \u2014 choose a local build for now.");return}d(null),i(r.value)}}),(0,v.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,v.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,v.jsx)(n,{marginTop:1,flexDirection:"column",children:c.map((p,a)=>{let r=a===b,y=p.available?r?o.orange:void 0:o.muted;return(0,v.jsxs)(n,{children:[(0,v.jsxs)(t,{color:y,children:[r?"\u276F ":" ",p.label]}),(0,v.jsxs)(t,{color:o.dim,children:[" ",p.hint]})]},p.value)})}),l&&(0,v.jsx)(n,{marginTop:1,children:(0,v.jsx)(t,{color:o.red,children:l})}),(0,v.jsx)(B,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}var K=g(N(),1);var s=g(A(),1);function qe({busyMessage:e,onSubmit:i,onBack:m}){let[c,b]=(0,K.useState)(""),[f,l]=(0,K.useState)(null);return e?(0,s.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,s.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,s.jsxs)(n,{marginTop:1,children:[(0,s.jsx)(C,{}),(0,s.jsxs)(t,{color:o.secondary,children:[" ",e]})]})]}):(0,s.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,s.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,s.jsx)(n,{marginTop:1,children:(0,s.jsx)(t,{color:o.dim,children:"App id from your cloud uploads:"})}),(0,s.jsxs)(n,{marginTop:1,children:[(0,s.jsx)(t,{color:o.dim,children:" "}),(0,s.jsx)(D,{value:c,onChange:d=>{b(d),f&&l(null)},onSubmit:d=>{let p=d.trim();if(!p){l("Enter an app id.");return}if(!W(p)){l("That doesn't look like an app id \u2014 they start with APP.");return}l(null),i(p).then(a=>{!a.ok&&a.error&&l(a.error)})},onCancel:m,placeholder:"APP1016032231178585590501450"})]}),f&&(0,s.jsxs)(n,{marginTop:1,flexDirection:"column",children:[(0,s.jsx)(t,{color:o.red,children:f}),(0,s.jsx)(t,{color:o.dim,children:"Enter a valid app id \u2014 copy it from your cloud uploads."})]}),(0,s.jsx)(B,{bindings:[{keys:"\u21B5",label:"use this app"}],escBackLabel:"back"})]})}export{he as a,Pe as b,Oe as c,Ye as d,qe as e};
@@ -1,7 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as A}from"./chunk-BL5QHONU.js";import{a as R}from"./chunk-TDPWFYTJ.js";import{a as x}from"./chunk-MWIE6LOZ.js";import{d as S}from"./chunk-LHUW5QDT.js";import{a as y}from"./chunk-MMBBQ4OZ.js";import{a as p}from"./chunk-DUYRCVI5.js";import{d as _,i as E}from"./chunk-CXF6AZWY.js";import{spawn as h,execSync as L}from"child_process";import{appendFileSync as C,existsSync as m,mkdirSync as P}from"fs";import{homedir as U}from"os";import{join as V,resolve as s,dirname as v,delimiter as b}from"path";import{fileURLToPath as D}from"url";import{createInterface as I}from"readline";async function*T(e){let n=I({input:e,crlfDelay:1/0});for await(let r of n){let o=r.trim();if(o)try{let i=JSON.parse(o);i&&typeof i.type=="string"&&(yield i)}catch{}}}function O(e){return e==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_BIFURCATION_PHASES:"1"},unset:["V16_NETWORK_WS","V16_NETWORK_SSE"]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_NETWORK_WS","V16_NETWORK_SSE"]}}function w(e){return e?{set:{},unset:["V16_AGENT_SKIP_CP_FINAL"]}:{set:{V16_AGENT_SKIP_CP_FINAL:"true"},unset:[]}}function N(e){return e==="dom"?{set:{V16_AGENT_ENABLE_TEXTUAL_VISUAL:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_TEXTUAL_VISUAL"]}}var c=v(D(import.meta.url));function k(){for(let e of["python3","python"])try{return L(`${e} --version`,{stdio:"ignore"}),e}catch{}return null}function K(){let n=process.platform==="win32"?"v16-runner.exe":"v16-runner",r={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},o=`${process.platform}-${process.arch}`,i=r[o];if(i)for(let t of i){let a=[s(c,"..","node_modules",t,"bin",n),s(c,"..","..","node_modules",t,"bin",n),s(c,"..","..","..","node_modules",t,"bin",n),s(c,"..","..","..","..","node_modules",t,"bin",n)];for(let u of a)if(m(u))return{cmd:u,args:[]}}let d=[s(c,"bin",n),s(c,"..","bin",n),s(c,"..","..","..","..","v16-runner","dist",n),s(c,"..","..","..","v16-runner","dist",n),s(c,"..","..","v16-runner","dist",n),s(process.cwd(),"v16-runner","dist",n),s(process.cwd(),"..","v16-runner","dist",n)];for(let t of d)if(m(t))return{cmd:t,args:[]};let l=[s(c,"..","..","v16-runner"),s(c,"..","..","..","..","v16-runner"),s(c,"..","..","..","v16-runner"),s(process.cwd(),"v16-runner"),s(process.cwd(),"..","v16-runner")];for(let t of l)if(m(s(t,"main.py"))){for(let u of[s(t,".venv","bin","python"),s(t,"..",".venv","bin","python"),s(t,"..","browser-agent",".venv","bin","python")])if(m(u))return{cmd:u,args:["main.py"],cwd:t};let a=k();if(a)return{cmd:a,args:["main.py"],cwd:t}}return null}function M(e){return e?V(U(),".testmuai","kaneai","sessions",e,"runner-stderr.log"):null}function B(e){let n=h(e.runner.cmd,e.runner.args,{stdio:["pipe","pipe","pipe"],env:e.env,cwd:e.runner.cwd});n.stdin.on("error",()=>{});let r=M(e.sessionId);if(r)try{P(v(r),{recursive:!0})}catch{}let o=1e5,i="";n.stderr.on("data",u=>{if(i+=u.toString(),i.length>o&&(i=i.slice(-o)),r)try{C(r,u)}catch{}}),n.on("error",u=>{e.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:u.message})});let d=null,l=null,t=new Promise(u=>{n.on("close",(f,g)=>{d=f,l=g?String(g):null,e.log?.("info","RUNNER_EXIT","Runner exited",{code:f,signal:l??"none"}),u({code:f,signal:l})})}),a=T(n.stdout);return{child:n,events:a,getStderr:()=>i,getExitCode:()=>d,getExitSignal:()=>l,exited:t}}async function H(e,n){if(!n?.platform||!n.target)return;if(A(n.target)){e.TESTMU_RUN_TARGET??="cloud";return}let r=await S(n.platform)?.toolEnv(n.target)??{dirs:[]};if(r.dirs.length>0&&(e.PATH=[...r.dirs,e.PATH??""].filter(Boolean).join(b)),r.appiumHome&&(e.APPIUM_HOME=r.appiumHome),r.wdaRoot&&(e.TESTMU_IOS_WDA_DERIVED_DATA=r.wdaRoot),n.platform==="android"){let o=y();o&&(e.PATH=[o.platformToolsDir,e.PATH??""].filter(Boolean).join(b),e.ANDROID_HOME=o.root,e.ANDROID_SDK_ROOT=o.root)}}function G(e){let n={...process.env};e.environment&&(n.TESTMUAI_ENV=e.environment),n.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(n.PYTHONIOENCODING="utf-8",n.PYTHONUTF8="1");let r=p(e.environment);n.V16_SERVER_API_HOST=r.v16ServerHost,n.ATMS_URL=r.tmsBaseUrl.replace(/\/api\/?$/,""),e.username&&e.accessKey&&(n.LT_USERNAME=e.username,n.LT_ACCESS_KEY=e.accessKey),e.sessionId&&(n.TESTMUAI_SESSION_ID=e.sessionId);let o=O(e.mode??"testing");Object.assign(n,o.set);for(let a of o.unset)delete n[a];let i=new x().load(),d=N(e.assertionMode??(i.assertion_mode==="visual"?"visual":"dom"));Object.assign(n,d.set);for(let a of d.unset)delete n[a];let l=e.finalValidation??i.final_validation,t=w(l);Object.assign(n,t.set);for(let a of t.unset)delete n[a];return n}function j(e,n){let r=p(n?.environment),o=R();o!==void 0&&e.ap_mode===void 0&&(e.ap_mode=o),e.telemetry_proxy_url===void 0&&process.env.KANE_TELEMETRY!=="0"&&(e.telemetry_proxy_url=E),e.media_upload===void 0&&e.org_id&&e.username&&e.access_key&&(e.media_upload={url:r.shareApiBaseUrl.replace(/\/$/,"")+"/mfs/v1.0/media/upload",artefacts_host:r.mediaArtefactsHost,org_id:e.org_id,media_dir:_})}async function ae(e,n){let r=K();if(!r)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");process.env.KANE_SPAWN_DEBUG&&process.stderr.write(`[spawn-debug] ${JSON.stringify(r)}
3
- `);let o=G({environment:n?.environment,mode:n?.mode,assertionMode:n?.assertionMode,finalValidation:n?.finalValidation,username:e.username,accessKey:e.access_key,sessionId:e.session_id});e.device?.platform&&await H(o,e.device),j(e,{environment:n?.environment});let i=B({env:o,runner:r,log:n?.log,sessionId:e.session_id}),d=i.child;d.stdin.write(JSON.stringify(e)+`
4
- `);let l=M(e.session_id);if(l)try{P(v(l),{recursive:!0}),C(l,`--- runner spawn ${new Date().toISOString()} run_index=${e.run_index} ---
5
- `)}catch{}return{child:d,events:i.events,sendUserResponse(t){let a=JSON.stringify({type:"user_response",answer:t});try{d.stdin.write(a+`
6
- `)}catch{}},sendCancel(t){let a=JSON.stringify({type:"cancel",reason:t});try{d.stdin.write(a+`
7
- `)}catch{}},cancel(){d.kill("SIGTERM")},get stderr(){return i.getStderr()},get exitCode(){return i.getExitCode()},get exitSignal(){return i.getExitSignal()},exited:i.exited}}export{K as a,B as b,H as c,G as d,j as e,ae as f};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m,c}from"./chunk-EYOCNMUM.js";import{c as b,j as h}from"./chunk-CXF6AZWY.js";import{readFileSync as w,writeFileSync as y,mkdirSync as C,existsSync as k}from"fs";import{dirname as x}from"path";var f={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:h,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"dom",network_ws:!1,network_sse:!1,bug_detection:"off",final_validation:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0};function T(o){let{mobile:e,...i}=o,t={...i};delete t.target,delete t.device,delete t.device_name,delete t.os_version,delete t.app;let n=e??{};n.tui_target&&(t.target=n.tui_target);let s=n.default_target?.name?.trim(),l=n.default_target?.os_version?.trim();if(s||l)s&&(t.device_name=s),l&&(t.os_version=l);else{let r=n.default_target?.id?.trim();r&&(t.device=r)}n.default_app&&(t.app=n.default_app);let a={};return n.no_reset!==void 0&&(a.no_reset=n.no_reset),n.appium_url!==void 0&&(a.appium_url=n.appium_url),n.auto_grant_permissions!==void 0&&(a.auto_grant_permissions=n.auto_grant_permissions),n.auto_accept_alerts!==void 0&&(a.auto_accept_alerts=n.auto_accept_alerts),Object.keys(a).length>0&&(t.mobile=a),t}function S(o){let e=o.mobile??{},i=typeof o.target=="string"?o.target:void 0,t=typeof o.device=="string"&&o.device.trim()!==""?o.device.trim():void 0,n=g=>typeof g=="string"&&g.trim()!==""?g.trim():void 0,s=n(o.device_name),l=n(o.os_version),a=typeof o.app=="string"&&o.app!==""?o.app:void 0,r={},u=i??e.tui_target;u&&(r.tui_target=u);let _=m(u,void 0).kind,d=_==="emulator"||_==="simulator"?_:null;d&&(s||l)?r.default_target={platform:c(d),kind:d,...s?{name:s}:{},...l?{os_version:l}:{}}:d&&t?r.default_target={platform:c(d),kind:d,id:t}:(e.default_target?.id?.trim()||e.default_target?.name?.trim())&&(r.default_target=e.default_target);let p=a??e.default_app;return p&&(r.default_app=p),e.no_reset!==void 0&&(r.no_reset=e.no_reset),e.appium_url!==void 0&&(r.appium_url=e.appium_url),e.auto_grant_permissions!==void 0&&(r.auto_grant_permissions=e.auto_grant_permissions),e.auto_accept_alerts!==void 0&&(r.auto_accept_alerts=e.auto_accept_alerts),Object.keys(r).length>0?r:void 0}var v=class{constructor(e=b){this.path=e}exists(){return k(this.path)}load(){try{let e=w(this.path,"utf-8"),i=JSON.parse(e),t=S(i),{target:n,device:s,app:l,...a}=i;return{...f,...a,...t?{mobile:t}:{},code_export:{...f.code_export,...i.code_export??{}},generate:{...f.generate,...i.generate??{}}}}catch{return{...f,code_export:{...f.code_export},generate:{...f.generate}}}}write(e){try{C(x(this.path),{recursive:!0}),y(this.path,JSON.stringify(T(e),null,2)+`
3
- `)}catch(i){let t=i instanceof Error?i.message:String(i);process.stderr.write(`[config] Failed to save config: ${t}
4
- `)}}set(e,i){let t=this.load();t[e]=i,this.write(t)}save(e){this.write({...this.load(),...e})}getMobile(){return this.load().mobile??{}}setMobile(e){let i={...this.getMobile()};for(let t of Object.keys(e)){let n=e[t];n===void 0?delete i[t]:i[t]=n}this.set("mobile",Object.keys(i).length>0?i:void 0)}writeRaw(e){this.write(e)}};export{v as a};
@@ -1,8 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as h}from"./chunk-VZ7KXRXB.js";import{c as _}from"./chunk-EYOCNMUM.js";import{dirname as j,isAbsolute as F,resolve as P}from"path";var k=["db","api","js","smartui","network_query","network_assertion","gps","accessibility","media_injection","network_throttle","deeplink"];var a=class extends Error{constructor(r,o,e){super(`[${o}${e!=null?`:${e}`:""}] ${r}`);this.file=o;this.line=e;this.name="TestMdParseError"}};var v=["if","elif","else","end-if","while","end-while"];var T={"end-if":"if","end-while":"while"};function R(n,t){let r=[],o=()=>r[r.length-1];for(let i of t){let s=i.controlFlow;if(s==="if"||s==="while"){r.push({kind:s,id:i.index,branch:0,elseSeen:!1}),i.block={id:i.index,branch:0,depth:r.length};continue}if(s==="elif"||s==="else"){let d=o();if(!d||d.kind!=="if")throw new a(`@${s} outside an open @if`,n,i.headingLine);if(d.elseSeen)throw new a(`@${s} after @else`,n,i.headingLine);d.branch+=1,d.elseSeen=s==="else",i.block={id:d.id,branch:d.branch,depth:r.length};continue}if(s==="end-if"||s==="end-while"){let d=o(),c=T[s];if(!d||d.kind!==c)throw new a(`@${s} without an open @${c}`,n,i.headingLine);i.block={id:d.id,branch:-1,depth:r.length},r.pop();continue}let l=o();l&&(i.block={id:l.id,branch:l.branch,depth:r.length})}let e=o();if(e){let i=t.find(s=>s.index===e.id);throw new a(`unclosed @${e.kind} block`,n,i?.headingLine)}}var Y=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),$=new Set(["mode","max_steps","timeout","global_context","local_context","variables","session_context","code_export","code_language","url","target","chrome_profile","cdp_endpoint","ws_endpoint","headless","app","no_reset","os_version","device_name","on_lock_conflict","tags","assurance","dataset"]),O=new Set(["optional"]),N=new Set(["optional","variables"]),M=new Set(["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"]),S=new Set(["app","no_reset","os_version","device_name"]),B=new Set(["mode","on_lock_conflict","tags","assurance","dataset"]);function be(n,t){let r=t.split(`
3
- `),{global:o,bodyStartLine:e}=G(n,r),{title:i,steps:s}=oe(n,r,e);return{path:n,title:i,global:o,steps:s}}function G(n,t){if(t[0]?.trim()!=="---")return{global:{},bodyStartLine:0};let r=-1;for(let l=1;l<t.length;l++)if(t[l].trim()==="---"){r=l;break}if(r===-1)throw new a("frontmatter is missing closing '---'",n,1);let o=t.slice(1,r).join(`
4
- `),e;try{e=h(o)??{}}catch(l){throw new a(`invalid YAML in frontmatter: ${l.message}`,n,1)}if(A(n,e,"frontmatter",1),e.on_lock_conflict!==void 0){let l=e.on_lock_conflict;if(l!=="readonly"&&l!=="fail"&&l!=="wait")throw new a(`on_lock_conflict must be 'readonly' | 'fail' | 'wait', got: ${JSON.stringify(l)}`,n,1)}if(E(n,e,1),se(n,e,1),e.assurance!==void 0){let l=e.assurance;if(l===null||typeof l!="object"||Array.isArray(l))throw new a("assurance must be a mapping with sub-keys {id, base}",n,1);let d=l;for(let c of Object.keys(d))if(c!=="id"&&c!=="base")throw new a(`unknown assurance sub-key '${c}' \u2014 the engine block allows only {id, base}`,n,1);if(typeof d.id!="string"||d.id.length===0)throw new a("assurance.id must be a non-empty string (logical id)",n,1);if(d.base!==void 0&&!(typeof d.base=="string"&&/^sha256:[0-9a-f]+$/.test(d.base)))throw new a("assurance.base must be a 'sha256:<hex>' string",n,1)}if(e.tags!==void 0){let l=e.tags,d=Array.isArray(l)?l.map(c=>String(c)).join(","):String(l);e.tags=I(d,n,1)}if(e.target!==void 0&&(e.target=q(e.target,n,1)),e.app!==void 0&&(e.app=H(e.app,n,1)),e.no_reset!==void 0&&typeof e.no_reset!="boolean")throw new a(`no_reset must be boolean: got ${typeof e.no_reset}`,n,1);if(e.os_version!==void 0&&typeof e.os_version!="string")if(typeof e.os_version=="number")e.os_version=String(e.os_version);else throw new a(`os_version must be a string: got ${typeof e.os_version}`,n,1);let i=e.target,s=i==="emulator"||i==="simulator";if(i==="android"||i==="ios"){for(let l of S)if(e[l]!==void 0)throw new a(`${l} cannot be set with target: ${i} \u2014 a real-device run takes its device and app from the run's device config`,n,1)}if(s&&e.app===void 0)throw new a(`target: ${String(i)} needs an app \u2014 add \`app: <path-to-build | AppId>\``,n,1);if(!s&&e.app!==void 0)throw new a("app requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(!s&&e.no_reset!==void 0)throw new a("no_reset requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(!s&&e.os_version!==void 0)throw new a("os_version requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(e.device_name!==void 0&&typeof e.device_name!="string")throw new a(`device_name must be a string: got ${typeof e.device_name}`,n,1);if(!s&&e.device_name!==void 0)throw new a("device_name requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);return{global:e,bodyStartLine:r+1}}function I(n,t,r){let e=n.trim().replace(/^\[/,"").replace(/\]$/,"").split(",").map(i=>i.trim().toLowerCase());if(e.length===0||e.some(i=>i.length===0))throw new a("tags must be a non-empty list of non-empty strings",t,r);return[...new Set(e)]}var V=new Set(["chrome","cdp","ws","emulator","simulator","android","ios"]),W="target must be one of 'chrome' | 'cdp' | 'ws' (web), 'emulator' | 'simulator' (mobile, with a root `app:` key) or 'android' | 'ios' (a real device)";function q(n,t,r){if(typeof n=="string"&&V.has(n))return n;throw n!==null&&typeof n=="object"&&!Array.isArray(n)?new a(`the mapping form of target is no longer accepted \u2014 write flat keys:
5
- target: emulator | simulator
6
- app: <path-to-build | AppId>`,t,r):new a(`${W} \u2014 got: ${JSON.stringify(n)}`,t,r)}function H(n,t,r){if(typeof n!="string"||n.trim().length===0)throw new a("app must be a build (e.g. ./builds/app-debug.apk) or an app id from your cloud uploads",t,r);let o=n.trim();if(!/\.(apk|zip)$/i.test(o)&&!/^APP\d{6,}$/.test(o))throw new a(`app '${o}' is not a build \u2014 expected a path ending in .apk or .zip, or an app id from your cloud uploads.`,t,r);return z(o,t)}function z(n,t){return/^APP[0-9A-Za-z_-]+$/.test(n)||F(n)?n:P(j(t),n)}function ye(n){let t=n.target;if(t==="android"||t==="ios")return{platform:t,app:"",realDevice:!0};if(!(t!=="emulator"&&t!=="simulator"))return{platform:_(t)??"",app:n.app??"",...n.no_reset!==void 0?{no_reset:n.no_reset}:{},...n.os_version!==void 0?{os_version:n.os_version}:{},...n.device_name!==void 0?{device_name:n.device_name}:{}}}function he(n){let t=n.target;return t==="chrome"||t==="cdp"||t==="ws"?t:void 0}var D=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function J(n,t,r){let o=D.exec(t);if(o)return{label:t.slice(0,o.index).trim(),verifies:o[1].split(",").map(i=>i.trim())};let e=t.lastIndexOf("@verifies");if(e>0&&/\s/.test(t[e-1])){let i=t.slice(e+9).split(/[\s,]+/).filter(s=>s.length>0);if(i.length===0||i.every(s=>s.startsWith("ac-")))throw new a("malformed @verifies directive \u2014 expected '@verifies ac-<id>[, ac-<id>\u2026]' at the end of the heading",n,r)}return{label:t,verifies:[]}}var x=k.join("|"),U=new RegExp(`^(.*\\S)\\s+@(${x})\\s*$`),Z=new RegExp(`^@(${x})\\s*$`);function Q(n,t,r,o){let e=Z.exec(t);if(e)throw new a(`replay-only marker @${e[1]} needs a step label before it (e.g. '## Step 3 @${e[1]}')`,n,r);let i=U.exec(t);if(!i)return null;let s=i[2];if(o)throw new a(`only one replay-only marker per step \u2014 found @${o} and @${s}`,n,r);return{label:i[1].trim(),replayOnly:s}}var L=v.join("|"),X=new RegExp(`^(.*\\S)\\s+@(${L})\\s*$`),ee=new RegExp(`^@(${L})\\s*$`);function ne(n,t,r,o){let e=ee.exec(t);if(e)throw new a(`control-flow marker @${e[1]} needs a step label before it (e.g. '## banner is visible @${e[1]}')`,n,r);let i=X.exec(t);if(!i)return null;let s=i[2];if(o)throw new a(`only one control-flow marker per step \u2014 found @${o} and @${s}`,n,r);return{label:i[1].trim(),controlFlow:s}}function te(n,t,r){let o=t,e,i,s=()=>{let d=Q(n,o,r,e);d&&({label:o,replayOnly:e}=d);let c=ne(n,o,r,i);c&&({label:o,controlFlow:i}=c)};s();let l=J(n,o,r);if(o=l.label,s(),e&&i)throw new a(`@${i} is a control-flow marker and @${e} a replay-only marker \u2014 a step carries one or the other`,n,r);return{label:o,verifies:l.verifies,...e?{replayOnly:e}:{},...i?{controlFlow:i}:{}}}function oe(n,t,r){let o,e=r;for(;e<t.length&&t[e].trim()==="";)e++;let i=e<t.length?/^#\s+(.+?)\s*$/.exec(t[e]):null;i&&(o=i[1],e++);let s=[];for(let d=e;d<t.length;d++)/^##\s/.test(t[d])&&s.push(d);let l=[];for(let d=0;d<s.length;d++){let c=s[d],p=s[d+1]??t.length,w=t[c].replace(/^##\s+/,"").trim(),{label:m,verifies:f,replayOnly:u,controlFlow:g}=te(n,w,c+1),b=t.slice(c+1,p),{config:C,body:y,optional:K}=re(n,c+1,b);if(u&&y.kind==="import_ref")throw new a(`@${u} is a replay-only marker for objective steps \u2014 it cannot mark an @import row`,n,c+1);if(g&&y.kind==="import_ref")throw new a(`@${g} is a control-flow marker for objective steps \u2014 it cannot mark an @import row`,n,c+1);l.push({index:d+1,heading:m,verifies:f,config:C,body:y,headingLine:c+1,optional:K,...u?{replayOnly:u}:{},...g?{controlFlow:g}:{}})}return R(n,l),{title:o,steps:l}}function re(n,t,r){let o=0;for(;o<r.length&&r[o].trim()==="";)o++;let e,i=t;if(o<r.length&&/^```yaml\s*$/.test(r[o])){let f=o;i=t+f,o++;let u=-1;for(;o<r.length;){if(/^```\s*$/.test(r[o])){u=o;break}o++}if(u===-1)throw new a("step-config fenced ```yaml block is not closed",n,i);let g=r.slice(f+1,u).join(`
7
- `);try{e=h(g)??{}}catch(b){throw new a(`invalid YAML in step config: ${b.message}`,n,i)}o=u+1}let s=ie(r.slice(o)),l=s.filter(f=>f.trim()!=="");if(l.length>0&&/^@session\s+/.test(l[0].trim()))throw new a("@session is no longer supported (iteration 3); use @import instead",n,t);let d=/^@import\s+(\S.*)$/,p=s.filter(f=>d.test(f.trim())).length>0;if(p&&l.length!==1)throw new a("step body must be exactly one of prose / @import",n,t);let w=!1,m;if(e){if(A(n,e,p?"step config (ref)":"step config (objective)",i),E(n,e,i),typeof e.optional=="boolean")w=e.optional;else if(e.optional!==void 0)throw new a(`step config 'optional' must be boolean: got ${typeof e.optional}`,n,i);let f={...e};delete f.optional,p&&delete f.variables,!p&&Object.keys(f).length>0&&(m=f)}if(p){let u=d.exec(l[0].trim())[1].trim(),g=e?.variables;return{body:{kind:"import_ref",path:u,...g&&Object.keys(g).length>0?{bindings:g}:{}},optional:w}}return{body:{kind:"objective",text:s.join(`
8
- `).trim()},config:m,optional:w}}function ie(n){let t=0,r=n.length;for(;t<r&&n[t].trim()==="";)t++;for(;r>t&&n[r-1].trim()==="";)r--;return n.slice(t,r)}function E(n,t,r){let o=t.variables;if(o==null)return;if(typeof o!="object"||Array.isArray(o))throw new a("variables must be an object map",n,r);let e={};for(let[i,s]of Object.entries(o))if(typeof s=="string")e[i]={value:s};else if(s&&typeof s=="object"&&!Array.isArray(s)&&typeof s.value=="string")e[i]=s;else throw new a(`variable '${i}' must be a string or { value: ... } object`,n,r);t.variables=e}function se(n,t,r){let o=t.dataset;if(o==null)return;if(typeof o=="string"){if(!o.trim())throw new a("dataset needs an id",n,r);t.dataset={id:o.trim()};return}if(typeof o!="object"||Array.isArray(o))throw new a("dataset must be an id or a mapping { id, row }",n,r);let e=o;for(let s of Object.keys(e))if(s!=="id"&&s!=="row")throw new a(`unknown dataset sub-key '${s}' \u2014 only { id, row } are allowed`,n,r);if(typeof e.id!="string"||!e.id.trim())throw new a("dataset needs an id",n,r);let i={id:e.id.trim()};if(e.row!==void 0){let s=e.row;if(!(typeof s=="string"&&s.trim().length>0&&!/^\d+$/.test(s.trim())))throw new a(`dataset row must be the row's _id as Test Manager shows it, not a position: got ${JSON.stringify(s)}`,n,r);i.row=s.trim()}t.dataset=i}function A(n,t,r,o){for(let e of Object.keys(t)){if(Y.has(e))throw new a(`auth/identity keys are CLI-only: ${e}`,n,o);if(r==="frontmatter"){if(O.has(e))throw new a(`step-only key in frontmatter: ${e}`,n,o);if(!$.has(e))throw new a(`unknown config key: ${e}`,n,o)}else if(r==="step config (objective)"){if(!$.has(e)&&!O.has(e))throw new a(`unknown config key: ${e}`,n,o);if(M.has(e))throw new a(`chrome config is global-only: ${e}`,n,o);if(S.has(e))throw new a(`'${e}' is global-only: the whole run drives one app`,n,o);if(B.has(e))throw new a(`'${e}' is run-level and cannot be set per-step`,n,o)}else if(!N.has(e))throw new a(`step config on @import may only contain 'optional' / 'variables': got ${e}`,n,o)}}export{be as a,ye as b,he as c,D as d};