@testmuai/kane-cli 0.9.0 → 0.10.0-rc.1

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 (634) hide show
  1. package/dist/ChatSurface-VPD5G67Q.js +2 -0
  2. package/dist/ChromeProfilePicker-CRKQEFYD.js +2 -0
  3. package/dist/CliFeedbackPrompt-M7BMWLKK.js +2 -0
  4. package/dist/CliUploadProgress-OP7DXMC2.js +2 -0
  5. package/dist/ConfigView-XI74BCCH.js +2 -0
  6. package/dist/EvidenceViewOffer-HAAK6DS5.js +2 -0
  7. package/dist/FolderPicker-W5S6RFCP.js +2 -0
  8. package/dist/InfoBox-OWUEHV2D.js +2 -0
  9. package/dist/LinksBox-PNSESNCU.js +2 -0
  10. package/dist/ProfilesView-PYDZZHKO.js +2 -0
  11. package/dist/ProjectPicker-BGFCUGT5.js +2 -0
  12. package/dist/SaveSessionPrompt-SUJE54GS.js +2 -0
  13. package/dist/ScrollbackTap-4SPXGFMU.js +2 -0
  14. package/dist/SingleShotApp-4TDXZEUA.js +2 -0
  15. package/dist/SummaryBox-FALOODAQ.js +2 -0
  16. package/dist/TestMdRunView-4GPRWHEU.js +2 -0
  17. package/dist/TestrunEvidenceTable-OBVQJ6IO.js +2 -0
  18. package/dist/WhoamiView-6WXGRANY.js +2 -0
  19. package/dist/{agent-parse-2MLJOJTH.js → agent-parse-CAS45UKA.js} +1 -1
  20. package/dist/app-client-U2YYF65L.js +2 -0
  21. package/dist/app-download-RXVZB6MM.js +2 -0
  22. package/dist/assurance-job-C3TXZGLL.js +7 -0
  23. package/dist/auth-7Z54TMQQ.js +2 -0
  24. package/dist/{binary-LVHXED3O.js → binary-DJCDMGPX.js} +1 -1
  25. package/dist/bind-XVO4CQYV.js +2 -0
  26. package/dist/bootstrap-TY5RANJ7.js +2 -0
  27. package/dist/bridge-T6QMYKED.js +2 -0
  28. package/dist/build-5ZN47FAT.js +2 -0
  29. package/dist/catalog-RRQF4TCA.js +2 -0
  30. package/dist/{changelog-N5AZHXOS.js → changelog-GBEVIUFJ.js} +1 -1
  31. package/dist/chat-committer-ZCSRJEUB.js +2 -0
  32. package/dist/chat-controller-XINCDH6Z.js +2 -0
  33. package/dist/child-G2GCW73X.js +2 -0
  34. package/dist/chunk-22PIMG52.js +2 -0
  35. package/dist/chunk-252FWF2G.js +19 -0
  36. package/dist/{chunk-UWXDURAB.js → chunk-2IZRPMZN.js} +1 -1
  37. package/dist/{chunk-X2A6CC6B.js → chunk-2NFS4KE4.js} +1 -1
  38. package/dist/{chunk-ZXY4P76I.js → chunk-2OOFURWD.js} +1 -1
  39. package/dist/chunk-2OSFI33O.js +97 -0
  40. package/dist/{chunk-CSNJPD2J.js → chunk-2S3W2JT3.js} +3 -3
  41. package/dist/chunk-2SWSVJUP.js +12 -0
  42. package/dist/chunk-2TVPA3LL.js +2 -0
  43. package/dist/{chunk-FMUV6UCX.js → chunk-2XW33VOK.js} +1 -1
  44. package/dist/chunk-33DWJV67.js +235 -0
  45. package/dist/chunk-34R7BNZ2.js +2 -0
  46. package/dist/chunk-35ECWCCK.js +2 -0
  47. package/dist/chunk-3BSYOCSW.js +3 -0
  48. package/dist/chunk-3G2LSTK5.js +2 -0
  49. package/dist/chunk-3GXN6VF6.js +2 -0
  50. package/dist/chunk-3JLEDSG5.js +4 -0
  51. package/dist/chunk-3QICDXY5.js +5 -0
  52. package/dist/chunk-3UVSAAES.js +10 -0
  53. package/dist/chunk-42PALMW2.js +4 -0
  54. package/dist/chunk-432ZOE42.js +21 -0
  55. package/dist/chunk-44B6THYK.js +2 -0
  56. package/dist/chunk-47WQBG5I.js +6 -0
  57. package/dist/{chunk-DOOI2JBD.js → chunk-4D5PC6QE.js} +1 -1
  58. package/dist/chunk-4I7YN6YY.js +3 -0
  59. package/dist/chunk-4IEQNX7F.js +2 -0
  60. package/dist/{chunk-KXEE6VCA.js → chunk-4LPX2OLV.js} +1 -1
  61. package/dist/chunk-4LTHDJ3D.js +2 -0
  62. package/dist/chunk-4QTH7VYE.js +2 -0
  63. package/dist/chunk-54XA5MZH.js +2 -0
  64. package/dist/chunk-57MDWTON.js +2 -0
  65. package/dist/{chunk-CNUCP6DK.js → chunk-5BUIIFLC.js} +1 -1
  66. package/dist/{chunk-AKE2CTV6.js → chunk-5D7ENQTQ.js} +1 -1
  67. package/dist/chunk-63EKRZKI.js +2 -0
  68. package/dist/{chunk-EHN5HTUD.js → chunk-65VANXOF.js} +51 -51
  69. package/dist/chunk-672CQECV.js +47 -0
  70. package/dist/chunk-6LIC2R22.js +3 -0
  71. package/dist/chunk-6NFOH4AC.js +4 -0
  72. package/dist/chunk-6NWT2TEJ.js +2 -0
  73. package/dist/chunk-6PIIUAZF.js +3 -0
  74. package/dist/{chunk-4CYBXJIA.js → chunk-6U7ID777.js} +1 -1
  75. package/dist/chunk-6UVIY56J.js +2 -0
  76. package/dist/chunk-72KYMWQ5.js +2 -0
  77. package/dist/chunk-72RC7JSA.js +21 -0
  78. package/dist/chunk-74W4AOT2.js +2 -0
  79. package/dist/chunk-77ZZQJLX.js +2 -0
  80. package/dist/chunk-7DFBOVUB.js +2 -0
  81. package/dist/chunk-7EXDYXXD.js +2 -0
  82. package/dist/chunk-7HO4NX5W.js +1 -0
  83. package/dist/chunk-7KX2BHKG.js +2 -0
  84. package/dist/chunk-7LKCWO2R.js +11 -0
  85. package/dist/{chunk-ULGZPRKU.js → chunk-7NCJMWFX.js} +1 -1
  86. package/dist/{chunk-EBLXHOE3.js → chunk-7RPKHKA3.js} +1 -1
  87. package/dist/chunk-7RWP4Y3H.js +2 -0
  88. package/dist/chunk-7V4BQSSV.js +2 -0
  89. package/dist/chunk-7XBNMOH4.js +6 -0
  90. package/dist/chunk-A6TJOZ24.js +2 -0
  91. package/dist/chunk-AA674WLL.js +2 -0
  92. package/dist/chunk-AIXJYMSP.js +9 -0
  93. package/dist/chunk-AJQZ3ST5.js +8 -0
  94. package/dist/chunk-AQ2OG2EF.js +2 -0
  95. package/dist/chunk-AUJSC7PU.js +4 -0
  96. package/dist/chunk-AVI5H4UM.js +13 -0
  97. package/dist/chunk-AZLNLHUA.js +4 -0
  98. package/dist/chunk-B2HXPGIZ.js +26 -0
  99. package/dist/{chunk-HGFWIBVF.js → chunk-B7ZX5HEN.js} +5 -5
  100. package/dist/{chunk-WRSIKZ2V.js → chunk-BJJUKB5K.js} +1 -1
  101. package/dist/{chunk-66MOZKD2.js → chunk-BSRSXYDZ.js} +1 -1
  102. package/dist/{chunk-4BZOG6PE.js → chunk-BVO4C5F2.js} +1 -1
  103. package/dist/chunk-BWXLZS5O.js +2 -0
  104. package/dist/chunk-BY65QAAN.js +4 -0
  105. package/dist/chunk-BZVNI44O.js +6 -0
  106. package/dist/chunk-C5Z7MQE6.js +2 -0
  107. package/dist/chunk-C6HI6Y3S.js +2 -0
  108. package/dist/chunk-CB4ARIHR.js +2 -0
  109. package/dist/{chunk-C25M2J5Q.js → chunk-CPBBYNL7.js} +1 -1
  110. package/dist/{chunk-75MMTNPB.js → chunk-D4FFXCX6.js} +2 -2
  111. package/dist/chunk-D756UWY2.js +6 -0
  112. package/dist/chunk-DBMW3VUN.js +4 -0
  113. package/dist/chunk-DD5TULWQ.js +34 -0
  114. package/dist/{chunk-Q5RDCSYM.js → chunk-DDJNYQBH.js} +1 -1
  115. package/dist/{chunk-6HU5M2DS.js → chunk-DHQ4SQWA.js} +1 -1
  116. package/dist/chunk-DNGOT65K.js +3 -0
  117. package/dist/chunk-DPGOAFKF.js +2 -0
  118. package/dist/chunk-DREQ3RAA.js +2 -0
  119. package/dist/chunk-DTUPEKEO.js +2 -0
  120. package/dist/chunk-E6KSRQXL.js +8 -0
  121. package/dist/chunk-EF47KRUK.js +2 -0
  122. package/dist/chunk-ENL4XTQ2.js +2 -0
  123. package/dist/chunk-EXFDIVNI.js +9 -0
  124. package/dist/chunk-EZN7CF45.js +4 -0
  125. package/dist/chunk-F3U6T4YD.js +22 -0
  126. package/dist/{chunk-DHJSM5DT.js → chunk-FCD3NYOM.js} +1 -1
  127. package/dist/chunk-FFL55I2M.js +2 -0
  128. package/dist/chunk-FIP5L6LV.js +9 -0
  129. package/dist/chunk-FOJHSG5M.js +6 -0
  130. package/dist/chunk-FSYOTRMC.js +2 -0
  131. package/dist/chunk-GFLB2SHW.js +2 -0
  132. package/dist/chunk-GMTHZUZ3.js +2 -0
  133. package/dist/chunk-GRURFGBP.js +2 -0
  134. package/dist/chunk-GZFLJORM.js +2 -0
  135. package/dist/{chunk-EOA6YPES.js → chunk-H3HHSTEK.js} +4 -4
  136. package/dist/chunk-HAW5WEKT.js +13 -0
  137. package/dist/chunk-HFJSP4KD.js +2 -0
  138. package/dist/chunk-HHW6MRU3.js +6 -0
  139. package/dist/chunk-HIUAUZNL.js +2 -0
  140. package/dist/chunk-HJLMH7ZM.js +2 -0
  141. package/dist/{chunk-5GUD3CIH.js → chunk-HQ2E2XCU.js} +1 -1
  142. package/dist/{chunk-K3IQEL7R.js → chunk-I2KOGINW.js} +1 -1
  143. package/dist/chunk-I2MC6VVX.js +2 -0
  144. package/dist/chunk-I5NSJBOZ.js +2 -0
  145. package/dist/chunk-I6OQISK4.js +2 -0
  146. package/dist/chunk-IBBD36FQ.js +2 -0
  147. package/dist/{chunk-GCISXCDU.js → chunk-IINZZ4BZ.js} +1 -1
  148. package/dist/{chunk-M3UAZTDK.js → chunk-IMDMRJQ6.js} +2 -2
  149. package/dist/chunk-IXW7FOGX.js +2 -0
  150. package/dist/chunk-IZ65ZPWY.js +3 -0
  151. package/dist/chunk-JD52IXON.js +9 -0
  152. package/dist/chunk-JGRXMTME.js +15 -0
  153. package/dist/{chunk-NBXYL2JT.js → chunk-JIRNI5TB.js} +7 -7
  154. package/dist/chunk-JNSWKGTB.js +2 -0
  155. package/dist/chunk-JPYW6U4D.js +2 -0
  156. package/dist/chunk-JQSLUGD4.js +3 -0
  157. package/dist/{chunk-GFBAK7WQ.js → chunk-K45BKGB5.js} +7 -7
  158. package/dist/chunk-KF4DKXSS.js +2 -0
  159. package/dist/chunk-KGNE5CIM.js +2 -0
  160. package/dist/chunk-KM3YCIDV.js +3 -0
  161. package/dist/chunk-KU3YHPWZ.js +2 -0
  162. package/dist/chunk-L4UVUFL6.js +3 -0
  163. package/dist/chunk-LCSJ7GOG.js +2 -0
  164. package/dist/chunk-LKQFG4RW.js +5 -0
  165. package/dist/chunk-LNNWCBPQ.js +2 -0
  166. package/dist/chunk-LRS5MGBY.js +3 -0
  167. package/dist/chunk-LRXBJTD4.js +4 -0
  168. package/dist/chunk-LSDJOVWW.js +6 -0
  169. package/dist/chunk-LWJRSUE2.js +2 -0
  170. package/dist/chunk-LX2I4JEH.js +2 -0
  171. package/dist/{chunk-RWSOZPJQ.js → chunk-M6MBMRFR.js} +1 -1
  172. package/dist/chunk-MGNRNLBE.js +2 -0
  173. package/dist/chunk-MII3JOO3.js +4 -0
  174. package/dist/chunk-MNBGG4H3.js +16 -0
  175. package/dist/chunk-MYVKUJGS.js +2 -0
  176. package/dist/chunk-MYZHOBS4.js +2 -0
  177. package/dist/chunk-MZOIHUVX.js +27 -0
  178. package/dist/{chunk-7GAHJZLH.js → chunk-N3TCNZSX.js} +1 -1
  179. package/dist/chunk-NC7D7GOM.js +21 -0
  180. package/dist/{chunk-HAYV4D2I.js → chunk-NDEI7R4K.js} +1 -1
  181. package/dist/{chunk-BL3SJDCG.js → chunk-NFRA64NU.js} +1 -1
  182. package/dist/chunk-NLZZLANH.js +4 -0
  183. package/dist/{chunk-DWMESHFI.js → chunk-NQTYWHPB.js} +1 -1
  184. package/dist/chunk-NWBLYMH7.js +3 -0
  185. package/dist/chunk-NWD54VV5.js +2 -0
  186. package/dist/chunk-NXRF7FFS.js +2 -0
  187. package/dist/chunk-O3HHTKZ5.js +6 -0
  188. package/dist/{chunk-F7NSSQYZ.js → chunk-OAKYUBD3.js} +1 -1
  189. package/dist/{chunk-7WXMV3O3.js → chunk-OEWYXCTA.js} +1 -1
  190. package/dist/{chunk-4FHK4LKQ.js → chunk-OF7WPCTQ.js} +1 -1
  191. package/dist/chunk-OFSDB7B4.js +3 -0
  192. package/dist/chunk-OJ33Q6DU.js +2 -0
  193. package/dist/chunk-OQ5G773E.js +2 -0
  194. package/dist/chunk-OVNRRI4E.js +2 -0
  195. package/dist/{chunk-C6S2RPZA.js → chunk-OZNBTSW5.js} +1 -1
  196. package/dist/chunk-P2ZQDQDB.js +2 -0
  197. package/dist/chunk-P7MSVLAH.js +6 -0
  198. package/dist/chunk-PUVMC4PX.js +26 -0
  199. package/dist/{chunk-SEEEGDVK.js → chunk-PZA3BSOE.js} +1 -1
  200. package/dist/chunk-Q3C6NDGI.js +2 -0
  201. package/dist/chunk-QCKA665H.js +2 -0
  202. package/dist/chunk-QDFY5GGO.js +5 -0
  203. package/dist/{chunk-YBAVDT3G.js → chunk-QHRUBG7J.js} +1 -1
  204. package/dist/chunk-QI5RZ7LL.js +2 -0
  205. package/dist/chunk-QNLVC5ZB.js +2 -0
  206. package/dist/{chunk-WDMUPK6I.js → chunk-QQ4TKLWP.js} +1 -1
  207. package/dist/chunk-QS5ZJFGF.js +4 -0
  208. package/dist/chunk-QTZBVDPR.js +12 -0
  209. package/dist/chunk-QXQ7KVEN.js +2 -0
  210. package/dist/chunk-R4JUKTDO.js +2 -0
  211. package/dist/chunk-R7KXAISS.js +12 -0
  212. package/dist/chunk-RDP7GWSY.js +2 -0
  213. package/dist/chunk-REKHAN53.js +5 -0
  214. package/dist/{chunk-KWEOLPBJ.js → chunk-RFEON5GN.js} +1 -1
  215. package/dist/{chunk-SOCHN2PY.js → chunk-RFIIM33J.js} +1 -1
  216. package/dist/chunk-RG372DON.js +6 -0
  217. package/dist/chunk-RPRXRKKR.js +2 -0
  218. package/dist/chunk-RTVWQK7I.js +2 -0
  219. package/dist/{chunk-2PKME4VT.js → chunk-RW3Z2HMB.js} +4 -4
  220. package/dist/chunk-RX47NRSM.js +2 -0
  221. package/dist/chunk-RX6776AI.js +5 -0
  222. package/dist/chunk-S53AQU7R.js +6 -0
  223. package/dist/{chunk-XT7XA4DN.js → chunk-SA6IKFFD.js} +1 -1
  224. package/dist/{chunk-Q5CINJYL.js → chunk-SLKYD44Y.js} +1 -1
  225. package/dist/chunk-SMTBOSEJ.js +2 -0
  226. package/dist/chunk-SMXABALN.js +2 -0
  227. package/dist/chunk-SONMD3W5.js +5 -0
  228. package/dist/chunk-SWMTXMKB.js +2 -0
  229. package/dist/{chunk-TM7VRLWS.js → chunk-SXRHKXSE.js} +1 -1
  230. package/dist/chunk-T3HEJASG.js +5 -0
  231. package/dist/chunk-T4AVLJCW.js +6 -0
  232. package/dist/{chunk-6VY62QC2.js → chunk-T6K2MEWP.js} +1 -1
  233. package/dist/{chunk-PCKIANML.js → chunk-T7H4LBFK.js} +1 -1
  234. package/dist/chunk-TNORODUF.js +2 -0
  235. package/dist/chunk-TW63WWEN.js +2 -0
  236. package/dist/chunk-UALJTPSA.js +18 -0
  237. package/dist/chunk-UAWWLLTI.js +2 -0
  238. package/dist/chunk-UEE3RZN4.js +14 -0
  239. package/dist/chunk-UTM7D4PI.js +2 -0
  240. package/dist/chunk-UUJIGOEO.js +2 -0
  241. package/dist/chunk-UYDHOHSZ.js +2 -0
  242. package/dist/chunk-V5JGXOV7.js +2 -0
  243. package/dist/chunk-V7S6S5W3.js +2 -0
  244. package/dist/{chunk-OHOJSADN.js → chunk-VG44B5JD.js} +1 -1
  245. package/dist/chunk-VJGWVBZR.js +1 -0
  246. package/dist/chunk-VLDCHFXF.js +2 -0
  247. package/dist/chunk-VO66KP2W.js +2 -0
  248. package/dist/{chunk-J3BGYSMD.js → chunk-VQLH63X7.js} +8 -8
  249. package/dist/chunk-VRIZDOO5.js +2 -0
  250. package/dist/chunk-VYHT2IET.js +1397 -0
  251. package/dist/chunk-VZJ6LUXX.js +2 -0
  252. package/dist/chunk-W3OVSDBN.js +29 -0
  253. package/dist/chunk-W7FLXW6Q.js +5 -0
  254. package/dist/{chunk-UA2QDAWT.js → chunk-WEM3MOAL.js} +1 -1
  255. package/dist/chunk-WI7K6VKQ.js +2 -0
  256. package/dist/chunk-WMGKUERB.js +6 -0
  257. package/dist/{chunk-DFS4RMVP.js → chunk-WN5VKKJ3.js} +1 -1
  258. package/dist/chunk-WOSANGV6.js +5 -0
  259. package/dist/chunk-WYSZ6TPW.js +15 -0
  260. package/dist/chunk-XB6BJPDL.js +2 -0
  261. package/dist/{chunk-YWYORBY3.js → chunk-XBEYWXPV.js} +1 -1
  262. package/dist/chunk-XIPKSXRQ.js +16 -0
  263. package/dist/chunk-XJ7HCXKW.js +2 -0
  264. package/dist/chunk-XMPTFXPW.js +5 -0
  265. package/dist/chunk-XZYA7DNH.js +2 -0
  266. package/dist/chunk-Y4T4SLDO.js +2 -0
  267. package/dist/{chunk-OIUV3ISA.js → chunk-Y6Y6RAY4.js} +1 -1
  268. package/dist/chunk-YDPTSDIJ.js +2 -0
  269. package/dist/chunk-YDSGXB25.js +2 -0
  270. package/dist/chunk-YIKF4ERQ.js +375 -0
  271. package/dist/chunk-Z55KBMYV.js +2 -0
  272. package/dist/chunk-ZCRZFAOT.js +2 -0
  273. package/dist/chunk-ZFM77AQU.js +2 -0
  274. package/dist/{chunk-Q6F23V7L.js → chunk-ZFMRQ57Y.js} +1 -1
  275. package/dist/chunk-ZHWU6L2G.js +5 -0
  276. package/dist/chunk-ZTHYAHDN.js +17 -0
  277. package/dist/chunk-ZZP5SHUV.js +3 -0
  278. package/dist/committer-JGY66PFM.js +2 -0
  279. package/dist/config-5ZOALGKE.js +2 -0
  280. package/dist/controller-client-PB3AZAGG.js +2 -0
  281. package/dist/cover-cmd-UA2SVIZZ.js +2 -0
  282. package/dist/{credentials-QD32Y7K7.js → credentials-MRG452Y6.js} +1 -1
  283. package/dist/{deps-bundle-OI7JJ22L.js → deps-bundle-FWINW4XM.js} +1 -1
  284. package/dist/{deps-resolve-ZOALDS6H.js → deps-resolve-IET4KIBO.js} +1 -1
  285. package/dist/descriptor-7T32VRMB.js +2 -0
  286. package/dist/design-chat-MM5PJD2N.js +2 -0
  287. package/dist/design-committer-TRYP3LOZ.js +2 -0
  288. package/dist/design-headless-FZONCKHW.js +2 -0
  289. package/dist/design-remote-SPVRIY2H.js +3 -0
  290. package/dist/device-env-LXJ65AVF.js +2 -0
  291. package/dist/dispatch-DVQ3H7EJ.js +2 -0
  292. package/dist/doctor-VAX2BWQF.js +2 -0
  293. package/dist/docx-convert-6IZO5P5K.js +2 -0
  294. package/dist/{dossier-7HVC6BNK.js → dossier-NROC2MCY.js} +1 -1
  295. package/dist/evidence-LVVK7ROT.js +2 -0
  296. package/dist/evidence-presentation-YYTIDCBS.js +2 -0
  297. package/dist/evolve-cmd-AGRKG7T3.js +2 -0
  298. package/dist/evolve-remote-BGHULJTL.js +2 -0
  299. package/dist/{exit-manager-ZLDO54S4.js → exit-manager-EDHCETUN.js} +1 -1
  300. package/dist/explain-DGJ5T6V5.js +2 -0
  301. package/dist/explain-cmd-VYAANFFZ.js +4 -0
  302. package/dist/explain-cmd-WOBGS6KX.js +12 -0
  303. package/dist/explore-LOKNOVNP.js +2 -0
  304. package/dist/explore-context-tty-JTZVZFOE.js +2 -0
  305. package/dist/explore-entry-5OGNLFAU.js +6 -0
  306. package/dist/explore-live-2XZHUYFS.js +5 -0
  307. package/dist/explore-run-tty-LGTIK2NA.js +5 -0
  308. package/dist/extract-bind-NM2BBK4I.js +14 -0
  309. package/dist/extract-chat-HLQMJJIC.js +2 -0
  310. package/dist/extract-cmd-T2TSAC3N.js +6 -0
  311. package/dist/extract-headless-OQTQ3FJK.js +2 -0
  312. package/dist/feeder-NY45UFJK.js +2 -0
  313. package/dist/folder-flags-WXUR6OPJ.js +2 -0
  314. package/dist/gaps-cmd-PTSKPTF7.js +3 -0
  315. package/dist/gate-P57VP4E5.js +2 -0
  316. package/dist/gate-WISOUTHQ.js +2 -0
  317. package/dist/{generate-headless-6WMJYNI6.js → generate-headless-JYZP6VXZ.js} +3 -3
  318. package/dist/headless-io-FFM5T6KL.js +2 -0
  319. package/dist/hold-passthrough-IOWPVB4W.js +2 -0
  320. package/dist/identity-HL5CJJXR.js +2 -0
  321. package/dist/index.js +178 -160
  322. package/dist/ingest-PDGS5ZTL.js +2 -0
  323. package/dist/ingest-cmd-LHCBMO4Z.js +8 -0
  324. package/dist/ingest-remote-D5TO5JQP.js +2 -0
  325. package/dist/ink-screen-RZ7QDIUI.js +2 -0
  326. package/dist/install-Z6K2D2VY.js +2 -0
  327. package/dist/interactive-bind-5EJQUGKI.js +26 -0
  328. package/dist/interactive-remote-D77ULJGL.js +65 -0
  329. package/dist/interrupt-guard-QETBPINI.js +2 -0
  330. package/dist/lane-AQYRIW24.js +2 -0
  331. package/dist/lattice-auth-74XGF77Y.js +2 -0
  332. package/dist/lifecycle-cmd-7SM6UCMH.js +2 -0
  333. package/dist/list-cmd-Z6FZXMFU.js +3 -0
  334. package/dist/list-commands-CZYZ7GIG.js +2 -0
  335. package/dist/list-remote-WOPOC6KK.js +15 -0
  336. package/dist/locks-cmd-JJ2QNTNY.js +2 -0
  337. package/dist/logical-ids-RXAQJZ3T.js +2 -0
  338. package/dist/login-flow-2FZEOVHM.js +2 -0
  339. package/dist/maintenance-cmd-VRTGZVRE.js +2 -0
  340. package/dist/mobile-prompts-KNAHU64X.js +2 -0
  341. package/dist/{next-KZXH4UA4.js → next-O6SUSX3R.js} +1 -1
  342. package/dist/{objective-variable-gate-CG2KK5UX.js → objective-variable-gate-3Z7DNVVC.js} +1 -1
  343. package/dist/onboarding-LGT6PMDZ.js +5 -0
  344. package/dist/open-provider-OZAG6WZS.js +2 -0
  345. package/dist/{paths-JCYX6UWL.js → paths-UMIX3RJF.js} +1 -1
  346. package/dist/pdf-convert-447ACUB3.js +2 -0
  347. package/dist/persist-recorded-session-BX7II5P7.js +3 -0
  348. package/dist/phase-seed-LCJ4WSYV.js +2 -0
  349. package/dist/pipeline-IXVTVRS5.js +2 -0
  350. package/dist/prepare-target-ULMKVKMC.js +2 -0
  351. package/dist/pull-cmd-6AL2WYHB.js +2 -0
  352. package/dist/pull-route-TTVARJMV.js +2 -0
  353. package/dist/readmodel-INMP6MNW.js +2 -0
  354. package/dist/real-device-run-2LFS5WE2.js +2 -0
  355. package/dist/reconcile-cmd-R6H37SQR.js +5 -0
  356. package/dist/reconcile-deps-TWJ3FTSU.js +2 -0
  357. package/dist/reconcile-remote-GWDV5CUT.js +13 -0
  358. package/dist/recording-banner-ACC67Q2U.js +2 -0
  359. package/dist/registry-6IJYQXQC.js +2 -0
  360. package/dist/remote-entry-YL7O2NJQ.js +2 -0
  361. package/dist/remote-mode-7G6PLJCW.js +4 -0
  362. package/dist/remote-words-45USLRVN.js +2 -0
  363. package/dist/require-project-folder-A3UDRELU.js +2 -0
  364. package/dist/resolve-run-intent-ZGPSUBXV.js +2 -0
  365. package/dist/resolver-IPM6R7U4.js +2 -0
  366. package/dist/revert-FHOBLZWF.js +2 -0
  367. package/dist/review-cmd-NNT5C5RZ.js +5 -0
  368. package/dist/run-5RQUCNYP.js +2 -0
  369. package/dist/run-PC5YO4AS.js +2 -0
  370. package/dist/run-channel-63SVP5OI.js +2 -0
  371. package/dist/run-remote-3AYYVPKX.js +2 -0
  372. package/dist/run-startup-gate-NKRMKYBB.js +2 -0
  373. package/dist/run-test-md-HE6DUWQR.js +17 -0
  374. package/dist/scrollback-GGNBDFQV.js +2 -0
  375. package/dist/session-target-DD53UXO7.js +2 -0
  376. package/dist/session-worker.js +12 -0
  377. package/dist/sessions-CFV7FOIT.js +2 -0
  378. package/dist/sessions-cmd-GYMETJHG.js +26 -0
  379. package/dist/sessions-remote-GI7GOBMH.js +3 -0
  380. package/dist/shell-arg-FN3MT5U7.js +2 -0
  381. package/dist/{skill-installer-32YYMM4N.js → skill-installer-3QAVQGDH.js} +1 -1
  382. package/dist/spawner-C7NLLM4F.js +2 -0
  383. package/dist/store-X6XPFSKF.js +2 -0
  384. package/dist/store-choice-RT73HAI7.js +2 -0
  385. package/dist/store-guard-SNWKLHQV.js +2 -0
  386. package/dist/store-id-YZ5WKJ25.js +2 -0
  387. package/dist/store-site-KA2DNBGY.js +2 -0
  388. package/dist/stream-warnings-GEQKKJU7.js +2 -0
  389. package/dist/structured-answers-EQ2AP3F7.js +2 -0
  390. package/dist/sync-cmd-NBPPDG3B.js +2 -0
  391. package/dist/sync-setup-5NUCH6N3.js +2 -0
  392. package/dist/{sync-setup-ui-RC727VK6.js → sync-setup-ui-XITPGSO4.js} +2 -2
  393. package/dist/tcg-generate-Z23CUISY.js +2 -0
  394. package/dist/test-definition-VRI4YIYL.js +2 -0
  395. package/dist/testmd-actions-GH5BW5V5.js +2 -0
  396. package/dist/testmd-sync-ACKCIOL3.js +2 -0
  397. package/dist/tms-client-NXAB6VJD.js +2 -0
  398. package/dist/token-refresh-4UCYAG6A.js +2 -0
  399. package/dist/trust-gate-AT2XBWN4.js +2 -0
  400. package/dist/turn-preflight-LHYLRL7G.js +2 -0
  401. package/dist/ui-SNV3FD2G.js +4 -0
  402. package/dist/use-case-ref-NE4X4MZN.js +2 -0
  403. package/dist/validate-basic-RE2WLIGQ.js +2 -0
  404. package/dist/{variable-receipt-YWNS24TH.js → variable-receipt-BXSZO36E.js} +1 -1
  405. package/dist/verdicts-XK3GAUX3.js +2 -0
  406. package/dist/version-check-4FJVZP3K.js +2 -0
  407. package/dist/{view-cmd-3WHG6MVB.js → view-cmd-N47BQZPD.js} +4 -3
  408. package/dist/walk-session-DA7QWXSW.js +2 -0
  409. package/dist/with-telemetry-7V4LY2BG.js +2 -0
  410. package/package.json +11 -11
  411. package/dist/ChatSurface-FJPK3XEJ.js +0 -8
  412. package/dist/ChromeProfilePicker-7DUDJTE2.js +0 -2
  413. package/dist/CliFeedbackPrompt-ZZPYC6OS.js +0 -2
  414. package/dist/CliUploadProgress-WQYKIBAR.js +0 -2
  415. package/dist/ConfigView-KXNOODDW.js +0 -2
  416. package/dist/EvidenceViewOffer-BTBVPBZX.js +0 -2
  417. package/dist/FolderPicker-H4YEX5LV.js +0 -2
  418. package/dist/InfoBox-DTM7X24Z.js +0 -2
  419. package/dist/LinksBox-KFG3FVOT.js +0 -2
  420. package/dist/ProfilesView-KBZHT4KL.js +0 -2
  421. package/dist/ProjectPicker-OARWULNN.js +0 -2
  422. package/dist/SaveSessionPrompt-37SMU5MC.js +0 -2
  423. package/dist/ScrollbackTap-QHJOFYMC.js +0 -2
  424. package/dist/SingleShotApp-UYCAW65Y.js +0 -2
  425. package/dist/SummaryBox-6RB5DSAH.js +0 -2
  426. package/dist/TestMdRunView-ZMOII3PL.js +0 -2
  427. package/dist/TestrunEvidenceTable-3UP2EYIV.js +0 -2
  428. package/dist/WhoamiView-MC62GERR.js +0 -2
  429. package/dist/app-client-PQFJAB63.js +0 -2
  430. package/dist/app-download-P6YXWSVQ.js +0 -2
  431. package/dist/auth-LXW4OFKF.js +0 -2
  432. package/dist/bind-ZYESQSCJ.js +0 -15
  433. package/dist/bootstrap-DI4UGMH3.js +0 -2
  434. package/dist/bridge-7J3JE3JS.js +0 -2
  435. package/dist/build-JIKYOZUH.js +0 -2
  436. package/dist/catalog-LLME3744.js +0 -2
  437. package/dist/chat-committer-6D7AQI6Z.js +0 -2
  438. package/dist/chat-controller-UJQ6Z4RE.js +0 -2
  439. package/dist/chunk-243ZJHT6.js +0 -4
  440. package/dist/chunk-2KVECC36.js +0 -2
  441. package/dist/chunk-2YEHV2CX.js +0 -2
  442. package/dist/chunk-3MCPTVJX.js +0 -2
  443. package/dist/chunk-3UI5VTQS.js +0 -4
  444. package/dist/chunk-3VAU3PNU.js +0 -2
  445. package/dist/chunk-3YIZG7WZ.js +0 -3
  446. package/dist/chunk-4Y2WH77W.js +0 -2
  447. package/dist/chunk-5EOX4MEY.js +0 -2
  448. package/dist/chunk-5HMN74RZ.js +0 -9
  449. package/dist/chunk-5LJRZI7S.js +0 -6
  450. package/dist/chunk-5RCS2LIQ.js +0 -26
  451. package/dist/chunk-5TQFOPJV.js +0 -2
  452. package/dist/chunk-5ZFOKYFB.js +0 -5
  453. package/dist/chunk-63DYVWNX.js +0 -2
  454. package/dist/chunk-6MD7SR7D.js +0 -9
  455. package/dist/chunk-7N6OCHPC.js +0 -7
  456. package/dist/chunk-A2SQD2AY.js +0 -4
  457. package/dist/chunk-AACQE24F.js +0 -2
  458. package/dist/chunk-AHFIRHSP.js +0 -18
  459. package/dist/chunk-AJT34ESA.js +0 -38
  460. package/dist/chunk-AUMJ4RVA.js +0 -21
  461. package/dist/chunk-AXTPNZPX.js +0 -2
  462. package/dist/chunk-BB2W35TW.js +0 -2
  463. package/dist/chunk-BKM2LWU2.js +0 -3
  464. package/dist/chunk-BUPRL2TE.js +0 -2
  465. package/dist/chunk-C44QQJR4.js +0 -239
  466. package/dist/chunk-CW3RHKLA.js +0 -5
  467. package/dist/chunk-D6E6KRVX.js +0 -2
  468. package/dist/chunk-DTRKTBCE.js +0 -17
  469. package/dist/chunk-DTRSYWZE.js +0 -2
  470. package/dist/chunk-EVFFDODK.js +0 -5
  471. package/dist/chunk-F2OBORCG.js +0 -2
  472. package/dist/chunk-FQNQVC5O.js +0 -5
  473. package/dist/chunk-FY7TCYPK.js +0 -6
  474. package/dist/chunk-GTVQYT3D.js +0 -35
  475. package/dist/chunk-HG5LLZBU.js +0 -2
  476. package/dist/chunk-I7TIGB7K.js +0 -2
  477. package/dist/chunk-IICT4VOU.js +0 -2
  478. package/dist/chunk-ILDHE4P4.js +0 -6
  479. package/dist/chunk-IPXKUYUK.js +0 -2
  480. package/dist/chunk-JQY5HRZ4.js +0 -15
  481. package/dist/chunk-JX6BFEDO.js +0 -4
  482. package/dist/chunk-K2UJYY2U.js +0 -2
  483. package/dist/chunk-KBM3XHAM.js +0 -2
  484. package/dist/chunk-KDNNMU7Q.js +0 -4
  485. package/dist/chunk-KJQNAOOE.js +0 -6
  486. package/dist/chunk-LH4IPANP.js +0 -2
  487. package/dist/chunk-LLG7NEGX.js +0 -6
  488. package/dist/chunk-LSDWPG6C.js +0 -2
  489. package/dist/chunk-MSGW4JDG.js +0 -2
  490. package/dist/chunk-NJ4BXZBX.js +0 -2
  491. package/dist/chunk-NLCCBXXV.js +0 -2
  492. package/dist/chunk-NMSZ7G6P.js +0 -2
  493. package/dist/chunk-OC6H6BYI.js +0 -6
  494. package/dist/chunk-OJAXOOZ5.js +0 -8
  495. package/dist/chunk-OMNLAGQC.js +0 -29
  496. package/dist/chunk-OOCCUUR2.js +0 -2
  497. package/dist/chunk-OXC6O5O7.js +0 -2
  498. package/dist/chunk-OZQDD2EX.js +0 -94
  499. package/dist/chunk-PEDINHVU.js +0 -2
  500. package/dist/chunk-PNUAP3RY.js +0 -8
  501. package/dist/chunk-Q2F5QB2W.js +0 -2
  502. package/dist/chunk-Q4YYAN6E.js +0 -2
  503. package/dist/chunk-Q6AHSGOE.js +0 -5
  504. package/dist/chunk-QAB3Y5FQ.js +0 -4
  505. package/dist/chunk-RDHWNSDP.js +0 -7
  506. package/dist/chunk-RKXHVP2Z.js +0 -2
  507. package/dist/chunk-RRY5IXOB.js +0 -2
  508. package/dist/chunk-RSSOJ3L2.js +0 -21
  509. package/dist/chunk-RTSBKCZY.js +0 -16
  510. package/dist/chunk-SID4X77D.js +0 -370
  511. package/dist/chunk-SRTKRHYI.js +0 -12
  512. package/dist/chunk-T2ONUKTL.js +0 -5
  513. package/dist/chunk-U6OTFMIT.js +0 -4
  514. package/dist/chunk-UD7KKHPW.js +0 -5
  515. package/dist/chunk-USOYXCZ4.js +0 -2
  516. package/dist/chunk-USY7VAO6.js +0 -2
  517. package/dist/chunk-V4B5QA3U.js +0 -4
  518. package/dist/chunk-VBS33P2C.js +0 -2
  519. package/dist/chunk-VHW7BMZQ.js +0 -2
  520. package/dist/chunk-VIO7CCFW.js +0 -5
  521. package/dist/chunk-VORWZLS3.js +0 -9
  522. package/dist/chunk-VVOKM2VO.js +0 -2
  523. package/dist/chunk-W5TTF7GB.js +0 -6
  524. package/dist/chunk-WESMQEPO.js +0 -2
  525. package/dist/chunk-WMI4P76K.js +0 -27
  526. package/dist/chunk-WNOC6MQC.js +0 -2
  527. package/dist/chunk-WVHMPIDQ.js +0 -2
  528. package/dist/chunk-XBX643ZD.js +0 -2
  529. package/dist/chunk-XKHWWKJZ.js +0 -3
  530. package/dist/chunk-XLSOQLVT.js +0 -2
  531. package/dist/chunk-Y3ZYN6AK.js +0 -4
  532. package/dist/chunk-YCCUBQY4.js +0 -2
  533. package/dist/chunk-YKTYVJBN.js +0 -3
  534. package/dist/chunk-YLQHY4A7.js +0 -2
  535. package/dist/chunk-Z7IGTVJW.js +0 -2
  536. package/dist/chunk-ZC2CKWLB.js +0 -2
  537. package/dist/chunk-ZER3FZSZ.js +0 -22
  538. package/dist/chunk-ZJYT72BA.js +0 -9
  539. package/dist/chunk-ZKSN2SJ7.js +0 -2
  540. package/dist/chunk-ZLWURCJ7.js +0 -2
  541. package/dist/committer-2QPBANRD.js +0 -2
  542. package/dist/config-YGTHSGQN.js +0 -2
  543. package/dist/controller-client-ZF5IXRUV.js +0 -2
  544. package/dist/cover-cmd-6RO366CC.js +0 -3
  545. package/dist/descriptor-3JJUOHBM.js +0 -2
  546. package/dist/design-committer-D44GSUXY.js +0 -2
  547. package/dist/device-env-DXDJJMTL.js +0 -2
  548. package/dist/dispatch-7EWWQRQ5.js +0 -2
  549. package/dist/doctor-TPYPEEUL.js +0 -2
  550. package/dist/docx-convert-SQRTF7XS.js +0 -2
  551. package/dist/evidence-NPFTBGDF.js +0 -2
  552. package/dist/evidence-presentation-XF23B7F2.js +0 -2
  553. package/dist/evolve-cmd-VGVXV6XW.js +0 -2
  554. package/dist/explain-NEFBUX5G.js +0 -2
  555. package/dist/explain-cmd-GOP5TE63.js +0 -9
  556. package/dist/explain-cmd-M7IX2YNB.js +0 -3
  557. package/dist/extract-bind-CKIRLXAJ.js +0 -14
  558. package/dist/extract-cmd-3EWLSPGS.js +0 -5
  559. package/dist/feeder-66TUPB2R.js +0 -2
  560. package/dist/gaps-cmd-WVC5GXQC.js +0 -3
  561. package/dist/gate-OYRDJMF6.js +0 -2
  562. package/dist/headless-io-75HUMWZB.js +0 -2
  563. package/dist/identity-ADZ4PAJF.js +0 -2
  564. package/dist/ingest-OSNNM3DH.js +0 -2
  565. package/dist/ingest-cmd-AECK5T4H.js +0 -2
  566. package/dist/install-ZV3KJZV4.js +0 -2
  567. package/dist/interactive-bind-IYS6KDOH.js +0 -26
  568. package/dist/interrupt-guard-UREUWNRL.js +0 -2
  569. package/dist/lifecycle-cmd-XCSBELFQ.js +0 -2
  570. package/dist/list-cmd-S4DSN2ET.js +0 -3
  571. package/dist/list-commands-GLNGHPDU.js +0 -2
  572. package/dist/locks-cmd-67OHQZNV.js +0 -2
  573. package/dist/logical-ids-GLVM2SVR.js +0 -2
  574. package/dist/login-flow-ASUUU7SO.js +0 -2
  575. package/dist/maintenance-cmd-K5KXRIFL.js +0 -2
  576. package/dist/mobile-prompts-ZUZTA3RV.js +0 -2
  577. package/dist/open-provider-YIBB77FE.js +0 -2
  578. package/dist/pdf-convert-RLXSXFWN.js +0 -2
  579. package/dist/persist-recorded-session-EWV56TSZ.js +0 -3
  580. package/dist/phase-seed-MKHEWUN6.js +0 -2
  581. package/dist/pipeline-LAWACB2O.js +0 -2
  582. package/dist/prepare-target-WGPCZKLE.js +0 -2
  583. package/dist/readmodel-FVLRQWZ7.js +0 -2
  584. package/dist/real-device-run-MDLFKFVQ.js +0 -2
  585. package/dist/reconcile-cmd-XFM2ZXUJ.js +0 -2
  586. package/dist/reconcile-deps-V5VLDPYT.js +0 -4
  587. package/dist/reconcile-engine-VZBTMPUK.js +0 -2
  588. package/dist/recording-banner-CJHRPHHF.js +0 -2
  589. package/dist/records-LMCVKPE5.js +0 -2
  590. package/dist/registry-3JXQFZEG.js +0 -2
  591. package/dist/require-project-folder-SE5GVCYJ.js +0 -2
  592. package/dist/resolve-run-intent-DD4MB6UD.js +0 -2
  593. package/dist/resolver-TLO4SRWV.js +0 -2
  594. package/dist/revert-NOUECRW4.js +0 -2
  595. package/dist/review-cmd-7EOYQMPE.js +0 -5
  596. package/dist/run-EHUNJPW6.js +0 -2
  597. package/dist/run-OTMPUQSH.js +0 -2
  598. package/dist/run-channel-RGH4WIQX.js +0 -2
  599. package/dist/run-test-md-KBDEHGXJ.js +0 -17
  600. package/dist/scrollback-JLPJR25X.js +0 -2
  601. package/dist/session-items-2ATN7VXG.js +0 -2
  602. package/dist/session-target-UMNASXI7.js +0 -2
  603. package/dist/sessions-NH7WQWMX.js +0 -2
  604. package/dist/sessions-cmd-M3SECFKQ.js +0 -25
  605. package/dist/spawner-DPT2RLAO.js +0 -2
  606. package/dist/store-guard-U32JE6JJ.js +0 -2
  607. package/dist/store-id-EOSGEKVK.js +0 -2
  608. package/dist/structured-answers-ZI2B6JJE.js +0 -2
  609. package/dist/sync-cmd-3EP7LZGL.js +0 -2
  610. package/dist/sync-setup-SWTBVQEV.js +0 -2
  611. package/dist/tcg-generate-KXU7E2GF.js +0 -2
  612. package/dist/testmd-actions-PEWCPQ5R.js +0 -2
  613. package/dist/testmd-sync-ZWFQWZ2X.js +0 -2
  614. package/dist/tms-client-KU6HCA23.js +0 -2
  615. package/dist/token-refresh-QD3OCGJJ.js +0 -2
  616. package/dist/trust-gate-EX7R2P4Y.js +0 -2
  617. package/dist/turn-preflight-JGYT7LXP.js +0 -2
  618. package/dist/ui-JEJGTURD.js +0 -4
  619. package/dist/validate-basic-AAIXSAWH.js +0 -2
  620. package/dist/verdicts-LAB5BGCC.js +0 -2
  621. package/dist/version-check-EHOLX3YH.js +0 -2
  622. package/dist/walk-session-XP4KYFKO.js +0 -2
  623. package/dist/with-telemetry-FJMJQDCM.js +0 -2
  624. /package/dist/{chunk-BKHXPBWN.js → chunk-2RUSXQ3O.js} +0 -0
  625. /package/dist/{chunk-6J5T5FEY.js → chunk-3AGP2BVN.js} +0 -0
  626. /package/dist/{chunk-CH273NAE.js → chunk-73Y6T2UK.js} +0 -0
  627. /package/dist/{chunk-ZMNJBUAO.js → chunk-73ZFOJOK.js} +0 -0
  628. /package/dist/{chunk-NOL7MNZH.js → chunk-A7RJQJNT.js} +0 -0
  629. /package/dist/{chunk-N2P4MI32.js → chunk-FWGUISUG.js} +0 -0
  630. /package/dist/{chunk-UJZZDPDY.js → chunk-HD6NR44L.js} +0 -0
  631. /package/dist/{chunk-LDPLJFCV.js → chunk-I6S6DZ2E.js} +0 -0
  632. /package/dist/{chunk-427OQS2N.js → chunk-LD5B3QFW.js} +0 -0
  633. /package/dist/{chunk-2UIHS2FH.js → chunk-PGESS7BW.js} +0 -0
  634. /package/dist/{chunk-BZAGVBCX.js → chunk-ZCIWQHCO.js} +0 -0
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as R}from"./chunk-VZ7KXRXB.js";import{d as $,f as b,g as _,h as v,r as O,s as S,u as k,v as x}from"./chunk-NOL7MNZH.js";import{dirname as B,isAbsolute as D,resolve as G}from"path";var L=["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 E=["if","elif","else","end-if","while","end-while"];var M={"end-if":"if","end-while":"while"};function A(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(),l=M[s];if(!d||d.kind!==l)throw new a(`@${s} without an open @${l}`,n,i.headingLine);i.block={id:d.id,branch:-1,depth:r.length},r.pop();continue}let c=o();c&&(i.block={id:c.id,branch:c.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 I=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),C=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"]),K=new Set(["optional"]),V=new Set(["optional","variables"]),W=new Set(["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"]),H=new Set(["app","no_reset","os_version","device_name"]),q=new Set(["mode","on_lock_conflict","tags","assurance","dataset"]);function Oe(n,t){let r=t.split(`
2
+ import{b as k}from"./chunk-VZ7KXRXB.js";import{d as R,f as b,g as $,h as y,r as O,s as S,u as v,v as x}from"./chunk-A7RJQJNT.js";import{dirname as B,isAbsolute as D,resolve as G}from"path";var L=["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 E=["if","elif","else","end-if","while","end-while"];var M={"end-if":"if","end-while":"while"};function A(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 l=o();if(!l||l.kind!=="if")throw new a(`@${s} outside an open @if`,n,i.headingLine);if(l.elseSeen)throw new a(`@${s} after @else`,n,i.headingLine);l.branch+=1,l.elseSeen=s==="else",i.block={id:l.id,branch:l.branch,depth:r.length};continue}if(s==="end-if"||s==="end-while"){let l=o(),d=M[s];if(!l||l.kind!==d)throw new a(`@${s} without an open @${d}`,n,i.headingLine);i.block={id:l.id,branch:-1,depth:r.length},r.pop();continue}let c=o();c&&(i.block={id:c.id,branch:c.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 I=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),T=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"]),C=new Set(["optional"]),V=new Set(["optional","variables"]),W=new Set(["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"]),H=new Set(["app","no_reset","os_version","device_name"]),q=new Set(["mode","on_lock_conflict","tags","assurance","dataset"]);function xe(n,t){let r=t.split(`
3
3
  `),{global:o,bodyStartLine:e}=z(n,r),{title:i,steps:s}=ce(n,r,e);return{path:n,title:i,global:o,steps:s}}function z(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=R(o)??{}}catch(l){throw new a(`invalid YAML in frontmatter: ${l.message}`,n,1)}if(P(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(j(n,e,1),pe(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 f=l;for(let p of Object.keys(f))if(p!=="id"&&p!=="base")throw new a(`unknown assurance sub-key '${p}' \u2014 the engine block allows only {id, base}`,n,1);if(typeof f.id!="string"||f.id.length===0)throw new a("assurance.id must be a non-empty string (logical id)",n,1);if(f.base!==void 0&&!(typeof f.base=="string"&&/^sha256:[0-9a-f]+$/.test(f.base)))throw new a("assurance.base must be a 'sha256:<hex>' string",n,1)}if(e.tags!==void 0){let l=e.tags,f=Array.isArray(l)?l.map(p=>String(p)).join(","):String(l);e.tags=J(f,n,1)}if(e.target!==void 0&&(e.target=Q(e.target,n,1)),e.app!==void 0&&(e.app=X(e.app,n,1,e.target)),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),c=b(i),d=$(i);if(c&&e.no_reset!==void 0)throw new a(`no_reset is not supported with target: ${i} \u2014 a real-device session always starts with a fresh install of the app. Remove no_reset from the file.`,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(!d&&e.app!==void 0)throw new a("app is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove app from this web test",n,1);if(!d&&e.no_reset!==void 0)throw new a("no_reset requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(!d&&e.os_version!==void 0)throw new a("os_version is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove os_version from this web test",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(!d&&e.device_name!==void 0)throw new a("device_name is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove device_name from this web test",n,1);return{global:e,bodyStartLine:r+1}}function J(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 U=new Set(["chrome","cdp","ws","emulator","simulator","android","ios"]),Z="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"&&U.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:
4
+ `),e;try{e=k(o)??{}}catch(l){throw new a(`invalid YAML in frontmatter: ${l.message}`,n,1)}if(P(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(j(n,e,1),pe(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 u of Object.keys(d))if(u!=="id"&&u!=="base")throw new a(`unknown assurance sub-key '${u}' \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(u=>String(u)).join(","):String(l);e.tags=J(d,n,1)}if(e.target!==void 0&&(e.target=Q(e.target,n,1)),e.app!==void 0&&(e.app=X(e.app,n,1,e.target)),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=b(i),c=R(i);if(s&&e.no_reset!==void 0)throw new a(`no_reset is not supported with target: ${i} \u2014 a real-device session always starts with a fresh install of the app. Remove no_reset from the file.`,n,1);if(!c&&e.app!==void 0)throw new a("app is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove app from this web test",n,1);if(!c&&e.no_reset!==void 0)throw new a("no_reset requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(!c&&e.os_version!==void 0)throw new a("os_version is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove os_version from this web test",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(!c&&e.device_name!==void 0)throw new a("device_name is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove device_name from this web test",n,1);return{global:e,bodyStartLine:r+1}}function J(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 U=new Set(["chrome","cdp","ws","emulator","simulator","android","ios"]),Z="target must be one of 'chrome' | 'cdp' | 'ws' (web), 'emulator' | 'simulator' (mobile; the app in a root `app:` key, or given to the run) or 'android' | 'ios' (a real device)";function Q(n,t,r){if(typeof n=="string"&&U.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
5
  target: emulator | simulator
6
- app: <path-to-build | AppId>`,t,r):new a(`${Z} \u2014 got: ${JSON.stringify(n)}`,t,r)}function X(n,t,r,o){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 e=n.trim(),i=b(o),s=O(i?["android","ios"]:["emulator","simulator"]);if(S(e,s)===void 0&&!/^APP\d{6,}$/.test(e))throw new a(i?`app '${e}' cannot run on a real device \u2014 use ${k("android")} (Android), ${k("ios")} (iOS), or an app ID from \`kane-cli apps list --target ${o}\`.`:`app '${e}' is not a build \u2014 expected a path ending in ${x(s,"or")}, or an app id from your cloud uploads.`,t,r);return ee(e,t)}function ee(n,t){return/^APP[0-9A-Za-z_-]+$/.test(n)||D(n)?n:G(B(t),n)}function Se(n){let t=n.target;if(b(t))return{platform:v(t),app:n.app??"",realDevice:!0,...n.os_version!==void 0?{os_version:n.os_version}:{},...n.device_name!==void 0?{device_name:n.device_name}:{}};if(_(t))return{platform:v(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 xe(n){let t=n.target;return t==="chrome"||t==="cdp"||t==="ws"?t:void 0}var ne=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function te(n,t,r){let o=ne.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 T=L.join("|"),oe=new RegExp(`^(.*\\S)\\s+@(${T})\\s*$`),re=new RegExp(`^@(${T})\\s*$`);function ie(n,t,r,o){let e=re.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=oe.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 F=E.join("|"),se=new RegExp(`^(.*\\S)\\s+@(${F})\\s*$`),ae=new RegExp(`^@(${F})\\s*$`);function le(n,t,r,o){let e=ae.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=se.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 de(n,t,r){let o=t,e,i,s=()=>{let d=ie(n,o,r,e);d&&({label:o,replayOnly:e}=d);let l=le(n,o,r,i);l&&({label:o,controlFlow:i}=l)};s();let c=te(n,o,r);if(o=c.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:c.verifies,...e?{replayOnly:e}:{},...i?{controlFlow:i}:{}}}function ce(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 c=[];for(let d=0;d<s.length;d++){let l=s[d],f=s[d+1]??t.length,p=t[l].replace(/^##\s+/,"").trim(),{label:w,verifies:u,replayOnly:g,controlFlow:m}=de(n,p,l+1),y=t.slice(l+1,f),{config:Y,body:h,optional:N}=fe(n,l+1,y);if(g&&h.kind==="import_ref")throw new a(`@${g} is a replay-only marker for objective steps \u2014 it cannot mark an @import row`,n,l+1);if(m&&h.kind==="import_ref")throw new a(`@${m} is a control-flow marker for objective steps \u2014 it cannot mark an @import row`,n,l+1);c.push({index:d+1,heading:w,verifies:u,config:Y,body:h,headingLine:l+1,optional:N,...g?{replayOnly:g}:{},...m?{controlFlow:m}:{}})}return A(n,c),{title:o,steps:c}}function fe(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 u=o;i=t+u,o++;let g=-1;for(;o<r.length;){if(/^```\s*$/.test(r[o])){g=o;break}o++}if(g===-1)throw new a("step-config fenced ```yaml block is not closed",n,i);let m=r.slice(u+1,g).join(`
7
- `);try{e=R(m)??{}}catch(y){throw new a(`invalid YAML in step config: ${y.message}`,n,i)}o=g+1}let s=ue(r.slice(o)),c=s.filter(u=>u.trim()!=="");if(c.length>0&&/^@session\s+/.test(c[0].trim()))throw new a("@session is no longer supported (iteration 3); use @import instead",n,t);let d=/^@import\s+(\S.*)$/,f=s.filter(u=>d.test(u.trim())).length>0;if(f&&c.length!==1)throw new a("step body must be exactly one of prose / @import",n,t);let p=!1,w;if(e){if(P(n,e,f?"step config (ref)":"step config (objective)",i),j(n,e,i),typeof e.optional=="boolean")p=e.optional;else if(e.optional!==void 0)throw new a(`step config 'optional' must be boolean: got ${typeof e.optional}`,n,i);let u={...e};delete u.optional,f&&delete u.variables,!f&&Object.keys(u).length>0&&(w=u)}if(f){let g=d.exec(c[0].trim())[1].trim(),m=e?.variables;return{body:{kind:"import_ref",path:g,...m&&Object.keys(m).length>0?{bindings:m}:{}},optional:p}}return{body:{kind:"objective",text:s.join(`
8
- `).trim()},config:w,optional:p}}function ue(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 j(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 pe(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 P(n,t,r,o){for(let e of Object.keys(t)){if(I.has(e))throw new a(`auth/identity keys are CLI-only: ${e}`,n,o);if(r==="frontmatter"){if(K.has(e))throw new a(`step-only key in frontmatter: ${e}`,n,o);if(!C.has(e))throw new a(`unknown config key: ${e}`,n,o)}else if(r==="step config (objective)"){if(!C.has(e)&&!K.has(e))throw new a(`unknown config key: ${e}`,n,o);if(W.has(e))throw new a(`chrome config is global-only: ${e}`,n,o);if(H.has(e))throw new a(`'${e}' is global-only: the whole run drives one app`,n,o);if(q.has(e))throw new a(`'${e}' is run-level and cannot be set per-step`,n,o)}else if(!V.has(e))throw new a(`step config on @import may only contain 'optional' / 'variables': got ${e}`,n,o)}}export{Oe as a,Se as b,xe as c,ne as d};
6
+ app: <path-to-build | AppId>`,t,r):new a(`${Z} \u2014 got: ${JSON.stringify(n)}`,t,r)}function X(n,t,r,o){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 e=n.trim(),i=b(o),s=O(i?["android","ios"]:["emulator","simulator"]);if(S(e,s)===void 0&&!/^APP\d{6,}$/.test(e))throw new a(i?`app '${e}' cannot run on a real device \u2014 use ${v("android")} (Android), ${v("ios")} (iOS), or an app ID from \`kane-cli apps list --target ${o}\`.`:`app '${e}' is not a build \u2014 expected a path ending in ${x(s,"or")}, or an app id from your cloud uploads.`,t,r);return ee(e,t)}function ee(n,t){return/^APP[0-9A-Za-z_-]+$/.test(n)||D(n)?n:G(B(t),n)}function Le(n){let t=n.target;if(b(t))return{platform:y(t),app:n.app??"",realDevice:!0,...n.os_version!==void 0?{os_version:n.os_version}:{},...n.device_name!==void 0?{device_name:n.device_name}:{}};if($(t))return{platform:y(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 Ee(n){let t=n.target;return t==="chrome"||t==="cdp"||t==="ws"?t:void 0}var ne=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function te(n,t,r){let o=ne.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 K=L.join("|"),oe=new RegExp(`^(.*\\S)\\s+@(${K})\\s*$`),re=new RegExp(`^@(${K})\\s*$`);function ie(n,t,r,o){let e=re.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=oe.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 F=E.join("|"),se=new RegExp(`^(.*\\S)\\s+@(${F})\\s*$`),ae=new RegExp(`^@(${F})\\s*$`);function le(n,t,r,o){let e=ae.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=se.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 de(n,t,r){let o=t,e,i,s=()=>{let l=ie(n,o,r,e);l&&({label:o,replayOnly:e}=l);let d=le(n,o,r,i);d&&({label:o,controlFlow:i}=d)};s();let c=te(n,o,r);if(o=c.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:c.verifies,...e?{replayOnly:e}:{},...i?{controlFlow:i}:{}}}function ce(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 l=e;l<t.length;l++)/^##\s/.test(t[l])&&s.push(l);let c=[];for(let l=0;l<s.length;l++){let d=s[l],u=s[l+1]??t.length,m=t[d].replace(/^##\s+/,"").trim(),{label:w,verifies:f,replayOnly:p,controlFlow:g}=de(n,m,d+1),h=t.slice(d+1,u),{config:Y,body:_,optional:N}=fe(n,d+1,h);if(p&&_.kind==="import_ref")throw new a(`@${p} is a replay-only marker for objective steps \u2014 it cannot mark an @import row`,n,d+1);if(g&&_.kind==="import_ref")throw new a(`@${g} is a control-flow marker for objective steps \u2014 it cannot mark an @import row`,n,d+1);c.push({index:l+1,heading:w,verifies:f,config:Y,body:_,headingLine:d+1,optional:N,...p?{replayOnly:p}:{},...g?{controlFlow:g}:{}})}return A(n,c),{title:o,steps:c}}function fe(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 p=-1;for(;o<r.length;){if(/^```\s*$/.test(r[o])){p=o;break}o++}if(p===-1)throw new a("step-config fenced ```yaml block is not closed",n,i);let g=r.slice(f+1,p).join(`
7
+ `);try{e=k(g)??{}}catch(h){throw new a(`invalid YAML in step config: ${h.message}`,n,i)}o=p+1}let s=ue(r.slice(o)),c=s.filter(f=>f.trim()!=="");if(c.length>0&&/^@session\s+/.test(c[0].trim()))throw new a("@session is no longer supported (iteration 3); use @import instead",n,t);let l=/^@import\s+(\S.*)$/,u=s.filter(f=>l.test(f.trim())).length>0;if(u&&c.length!==1)throw new a("step body must be exactly one of prose / @import",n,t);let m=!1,w;if(e){if(P(n,e,u?"step config (ref)":"step config (objective)",i),j(n,e,i),typeof e.optional=="boolean")m=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,u&&delete f.variables,!u&&Object.keys(f).length>0&&(w=f)}if(u){let p=l.exec(c[0].trim())[1].trim(),g=e?.variables;return{body:{kind:"import_ref",path:p,...g&&Object.keys(g).length>0?{bindings:g}:{}},optional:m}}return{body:{kind:"objective",text:s.join(`
8
+ `).trim()},config:w,optional:m}}function ue(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 j(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 pe(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 P(n,t,r,o){for(let e of Object.keys(t)){if(I.has(e))throw new a(`auth/identity keys are CLI-only: ${e}`,n,o);if(r==="frontmatter"){if(C.has(e))throw new a(`step-only key in frontmatter: ${e}`,n,o);if(!T.has(e))throw new a(`unknown config key: ${e}`,n,o)}else if(r==="step config (objective)"){if(!T.has(e)&&!C.has(e))throw new a(`unknown config key: ${e}`,n,o);if(W.has(e))throw new a(`chrome config is global-only: ${e}`,n,o);if(H.has(e))throw new a(`'${e}' is global-only: the whole run drives one app`,n,o);if(q.has(e))throw new a(`'${e}' is run-level and cannot be set per-step`,n,o)}else if(!V.has(e))throw new a(`step config on @import may only contain 'optional' / 'variables': got ${e}`,n,o)}}export{xe as a,Le as b,Ee as c,ne as d};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $}from"./chunk-AHFIRHSP.js";import{g as D}from"./chunk-K3IQEL7R.js";import{a as E}from"./chunk-NLCCBXXV.js";function U(e){return["completed","failed","ended","stopped"].includes(e.trim().toLowerCase())}function je(e){return["ended","stopped"].includes(e.trim().toLowerCase())}function q(e){return{requestId:e.requestId,objective:e.objective,status:"",turnActive:!1,scenarios:[],thinking:"",thinkingLog:[],chatLog:[],progress:0}}function Re(e){return e.pendingClarification===void 0?e:{...e,pendingClarification:void 0}}function Ce(e){return{...e,turnActive:!0,error:void 0,thinking:"",thinkingLog:[]}}function P(e,t){switch(t.type){case"thinking":return{...e,status:"thinking",thinking:e.thinking+t.delta};case"thinking_done":return{...e,thinkingLog:[...e.thinkingLog,{text:e.thinking,tookMs:t.tookMs}],thinking:""};case"progress":return{...e,progress:t.pct};case"snapshot":return{...e,scenarios:t.data.scenarios,status:t.data.status,headline:t.data.headline??e.headline};case"chat":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}]};case"clarification":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}],pendingClarification:t.text};case"limit":return{...e,limits:{scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit}};case"error":return{...e,error:t.message};case"done":return{...e,status:t.status,turnActive:!1,error:t.status==="failed"&&!e.error?"generation failed":e.error}}}function H(e,t){let n=[],i=e.type??"",d=e.status??"";if(i==="ping")return n;switch(i){case"thinking_token":typeof e.data=="string"&&n.push({type:"thinking",delta:e.data});break;case"thinking_stopped":{let r=e.data??{},o=se(r.time_taken);n.push({type:"thinking_done",text:typeof e.data=="string"?e.data:r.message??"",tookMs:o});break}case"progress":{let r=e.data??{};typeof r.progress=="number"&&n.push({type:"progress",pct:r.progress});break}case"clarification":{let r=e.data??{};typeof r.message=="string"&&n.push({type:"clarification",text:r.message});break}case"chatting_stopped":{let r=e.data??{};typeof r.message=="string"&&r.message.length>0&&n.push({type:"chat",text:r.message});break}case"limit_update":{let r=e.data??{},o=r.test_cases_limit??e.test_cases_limit,p=r.per_scenario_test_cases_limit??e.per_scenario_test_cases_limit;n.push({type:"limit",scenarioLimit:o,perScenarioLimit:p});break}case"error":{let r=typeof e.data=="string"?e.data:e.data?.message??"generation error";n.push({type:"error",message:r});break}case"request_cancelled":return n.push({type:"done",status:"stopped"}),n;case"session_ended":return n.push({type:"done",status:"ended"}),n;default:break}if(Array.isArray(e.scenarios)&&n.push({type:"snapshot",data:{requestId:t,status:d,headline:e.headline,scenarios:e.scenarios}}),d&&U(d)){let r=d.trim().toLowerCase();n.push({type:"done",status:r})}return n}function se(e){if(!e)return;let t=/^([\d.]+)(ms|s)?$/.exec(e.trim());if(!t)return;let n=Number(t[1]);if(Number.isFinite(n))return t[2]==="ms"?Math.round(n):Math.round(n*1e3)}var v=class extends Error{constructor(t){super(t),this.name="AuthError"}},M=class extends Error{constructor(t){super(t),this.name="ForbiddenError"}},I=class extends Error{constructor(t){super(t),this.name="InsufficientCreditsError"}},k=class extends Error{constructor(n,i){super(n);this.cause=i;this.name="TransportError"}};function x(e,t){let n=t?.message??t?.error??`HTTP ${e}`;return e===401?new v(n):e===403?t?.key==="insufficient_credits"?new I(n):new M(n):new k(n)}async function*J(e){let t=e.fetchImpl??fetch,n=e.maxRetries??5,i=e.maxBackoffMs??3e4,d=e.connectTimeoutMs??1e4,r=0,o=!1;for(;;){if(e.signal.aborted)return;let p=new AbortController,a=()=>p.abort();e.signal.addEventListener("abort",a,{once:!0});let c=setTimeout(()=>p.abort(),d),g;try{g=await t(e.url,{method:"GET",headers:{Authorization:await e.authHeader(),Accept:"text/event-stream"},signal:p.signal})}catch(w){if(clearTimeout(c),e.signal.removeEventListener("abort",a),e.signal.aborted)return;if(++r>n)throw new k("SSE connect failed",w);await O(F(r,i));continue}if(clearTimeout(c),!g.ok){e.signal.removeEventListener("abort",a);let w=await oe(g);if(g.status===401&&o){if(++r>n)throw x(401,w);await O(F(r,i));continue}throw x(g.status,w)}if(!g.body)throw e.signal.removeEventListener("abort",a),new k("SSE response had no body");o=!0,r=0;let m=g.body.getReader(),h=new TextDecoder("utf-8"),b="";try{for(;;){if(e.signal.aborted){await m.cancel().catch(()=>{});return}let{done:w,value:s}=await m.read();if(w)break;b+=h.decode(s,{stream:!0});let f;for(;(f=b.indexOf(`
2
+ import{a as $}from"./chunk-UALJTPSA.js";import{g as D}from"./chunk-I2KOGINW.js";import{a as E}from"./chunk-4QTH7VYE.js";function U(e){return["completed","failed","ended","stopped"].includes(e.trim().toLowerCase())}function je(e){return["ended","stopped"].includes(e.trim().toLowerCase())}function q(e){return{requestId:e.requestId,objective:e.objective,status:"",turnActive:!1,scenarios:[],thinking:"",thinkingLog:[],chatLog:[],progress:0}}function Re(e){return e.pendingClarification===void 0?e:{...e,pendingClarification:void 0}}function Ce(e){return{...e,turnActive:!0,error:void 0,thinking:"",thinkingLog:[]}}function P(e,t){switch(t.type){case"thinking":return{...e,status:"thinking",thinking:e.thinking+t.delta};case"thinking_done":return{...e,thinkingLog:[...e.thinkingLog,{text:e.thinking,tookMs:t.tookMs}],thinking:""};case"progress":return{...e,progress:t.pct};case"snapshot":return{...e,scenarios:t.data.scenarios,status:t.data.status,headline:t.data.headline??e.headline};case"chat":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}]};case"clarification":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}],pendingClarification:t.text};case"limit":return{...e,limits:{scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit}};case"error":return{...e,error:t.message};case"done":return{...e,status:t.status,turnActive:!1,error:t.status==="failed"&&!e.error?"generation failed":e.error}}}function H(e,t){let n=[],i=e.type??"",d=e.status??"";if(i==="ping")return n;switch(i){case"thinking_token":typeof e.data=="string"&&n.push({type:"thinking",delta:e.data});break;case"thinking_stopped":{let r=e.data??{},o=se(r.time_taken);n.push({type:"thinking_done",text:typeof e.data=="string"?e.data:r.message??"",tookMs:o});break}case"progress":{let r=e.data??{};typeof r.progress=="number"&&n.push({type:"progress",pct:r.progress});break}case"clarification":{let r=e.data??{};typeof r.message=="string"&&n.push({type:"clarification",text:r.message});break}case"chatting_stopped":{let r=e.data??{};typeof r.message=="string"&&r.message.length>0&&n.push({type:"chat",text:r.message});break}case"limit_update":{let r=e.data??{},o=r.test_cases_limit??e.test_cases_limit,p=r.per_scenario_test_cases_limit??e.per_scenario_test_cases_limit;n.push({type:"limit",scenarioLimit:o,perScenarioLimit:p});break}case"error":{let r=typeof e.data=="string"?e.data:e.data?.message??"generation error";n.push({type:"error",message:r});break}case"request_cancelled":return n.push({type:"done",status:"stopped"}),n;case"session_ended":return n.push({type:"done",status:"ended"}),n;default:break}if(Array.isArray(e.scenarios)&&n.push({type:"snapshot",data:{requestId:t,status:d,headline:e.headline,scenarios:e.scenarios}}),d&&U(d)){let r=d.trim().toLowerCase();n.push({type:"done",status:r})}return n}function se(e){if(!e)return;let t=/^([\d.]+)(ms|s)?$/.exec(e.trim());if(!t)return;let n=Number(t[1]);if(Number.isFinite(n))return t[2]==="ms"?Math.round(n):Math.round(n*1e3)}var v=class extends Error{constructor(t){super(t),this.name="AuthError"}},M=class extends Error{constructor(t){super(t),this.name="ForbiddenError"}},I=class extends Error{constructor(t){super(t),this.name="InsufficientCreditsError"}},k=class extends Error{constructor(n,i){super(n);this.cause=i;this.name="TransportError"}};function x(e,t){let n=t?.message??t?.error??`HTTP ${e}`;return e===401?new v(n):e===403?t?.key==="insufficient_credits"?new I(n):new M(n):new k(n)}async function*J(e){let t=e.fetchImpl??fetch,n=e.maxRetries??5,i=e.maxBackoffMs??3e4,d=e.connectTimeoutMs??1e4,r=0,o=!1;for(;;){if(e.signal.aborted)return;let p=new AbortController,a=()=>p.abort();e.signal.addEventListener("abort",a,{once:!0});let c=setTimeout(()=>p.abort(),d),g;try{g=await t(e.url,{method:"GET",headers:{Authorization:await e.authHeader(),Accept:"text/event-stream"},signal:p.signal})}catch(w){if(clearTimeout(c),e.signal.removeEventListener("abort",a),e.signal.aborted)return;if(++r>n)throw new k("SSE connect failed",w);await O(F(r,i));continue}if(clearTimeout(c),!g.ok){e.signal.removeEventListener("abort",a);let w=await oe(g);if(g.status===401&&o){if(++r>n)throw x(401,w);await O(F(r,i));continue}throw x(g.status,w)}if(!g.body)throw e.signal.removeEventListener("abort",a),new k("SSE response had no body");o=!0,r=0;let m=g.body.getReader(),h=new TextDecoder("utf-8"),b="";try{for(;;){if(e.signal.aborted){await m.cancel().catch(()=>{});return}let{done:w,value:s}=await m.read();if(w)break;b+=h.decode(s,{stream:!0});let f;for(;(f=b.indexOf(`
3
3
 
4
4
  `))>=0;){let u=b.slice(0,f);b=b.slice(f+2);let l=ie(u);l&&(yield l)}}}catch(w){if(e.signal.aborted)return;if(++r>n)throw new k("SSE stream dropped",w);await O(F(r,i));continue}finally{e.signal.removeEventListener("abort",a)}return}}function ie(e){let t="message",n="";for(let i of e.split(`
5
5
  `))i.startsWith("event:")?t=i.slice(6).trim():i.startsWith("data:")&&(n+=i.slice(5).trim());if(t!=="message"||!n)return null;try{let i=Buffer.from(n,"base64").toString("utf-8");return JSON.parse(i)}catch{return null}}function F(e,t){return Math.min(t,1e3*2**(e-1))}function O(e){return new Promise(t=>setTimeout(t,e))}async function oe(e){try{return await e.clone().json()}catch{return}}function W(e,t){t?.length&&(e.append("files",t.map(n=>n.fileKey).join(",")),e.append("gemini_metadata",JSON.stringify(t.map(n=>({fileData:{fileUri:n.geminiUri,mimeType:n.mimeType}})))))}function Ue(e,t={}){let n=t.fetchImpl??fetch,i=new Map,d=!0;async function r(){let s=await e.authResolver.resolve();if(!s)throw new v("unauthorized; run `kane-cli login`");return E(s.username,s.access_key)}function o(s){return`${e.baseUrl}${s}`}async function p(s){if(!s.ok){let f;try{f=await s.clone().json()}catch{f=void 0}throw x(s.status,f)}return s.json()}function a(s){let f=s?.data??s;return{request_id:f.request_id??f.id,status:f.status??""}}function c(s,f,u,l){let y=q({requestId:s,objective:f});l&&(y=P(y,{type:"snapshot",data:l}),l.status==="cleaned_up"&&(y={...y,error:"session was reaped (cleaned_up) \u2014 continuing will destructively regenerate"}));let S=new AbortController;u&&(u.aborted?S.abort():u.addEventListener("abort",()=>S.abort(),{once:!0})),i.set(s,S);let A={requestId:s,state:y,events:void 0};return A.events=(async function*(){try{let C=J({url:o(`/requests/${s}/sse`),authHeader:r,signal:S.signal,log:e.log,fetchImpl:n});for await(let L of C)for(let z of H(L,s))A.state=P(A.state,z),yield z}finally{i.delete(s)}})(),A}async function g(s,f){let u=new FormData;u.append("prompt",s.prompt),d=s.memoryEnhancement??!0,u.append("memory_enhancement",String(d)),s.scenarioLimit!==void 0&&u.append("test_scenario_limit",String(s.scenarioLimit)),s.perScenarioLimit!==void 0&&u.append("per_scenario_test_cases_limit",String(s.perScenarioLimit));let l=s.projectId??e.projectId,y=s.folderId??e.folderId;l&&u.append("project_id",l),y&&u.append("folder_id",y),W(u,s.attachments);let S=await n(o("/requests"),{method:"POST",headers:{Authorization:await r()},body:u}),A=await p(S),{request_id:C}=a(A),L=String(C);return c(L,s.prompt,f)}async function m(s,f){let u=await n(o(`/requests/${s}`),{method:"GET",headers:{Authorization:await r()}}),l=await p(u),y=l?.data??l,S={requestId:s,status:y.status??"",headline:y.headline,scenarios:Array.isArray(y.scenarios)?y.scenarios:[]};return c(s,"",f,S)}async function h(s,f,u){let l=new FormData;l.append("prompt",f),l.append("chat_enabled","true"),l.append("memory_enhancement",String(d)),u?.mappings&&l.append("mappings",JSON.stringify(u.mappings)),W(l,u?.attachments);let y=await n(o(`/requests/${s}`),{method:"PUT",headers:{Authorization:await r()},body:l});if(!y.ok){let S;try{S=await y.clone().json()}catch{}throw x(y.status,S)}}async function b(s){i.get(s)?.abort();let u=await n(o(`/requests/${s}/stop`),{method:"DELETE",headers:{Authorization:await r()}});if(!u.ok&&u.status!==404){let l;try{l=await u.clone().json()}catch{}throw x(u.status,l)}}async function w(s){i.get(s)?.abort();let u=await n(o(`/requests/${s}/end`),{method:"DELETE",headers:{Authorization:await r()}});if(!u.ok&&u.status!==404){let l;try{l=await u.clone().json()}catch{}throw x(u.status,l)}}return{start:g,attach:m,chat:h,cancel:b,end:w}}import{statSync as ae,realpathSync as G,existsSync as ce}from"fs";import{extname as ue,resolve as j,isAbsolute as pe}from"path";import{homedir as V}from"os";var de=new Set([".txt",".md",".json",".xml",".jpg",".jpeg",".png",".gif",".bmp",".webp",".pdf",".docx",".csv",".xlsx",".mp3",".wav",".m4a",".webm",".mpeg",".mpga",".mp4",".mov"]),le=50*1024*1024,X=10;function fe(e){return e==="~"?V():e.startsWith("~/")?j(V(),e.slice(2)):e}function Ge(e,t){let n=[],i=[],d=new Set,r=[],o=(()=>{try{return G(j(t))}catch{return j(t)}})(),p=o.endsWith("/")?o:o+"/";for(let a of e){let c=fe(a),g=pe(c)?c:j(t,c);if(!ce(g)){n.push(`Not found: ${a}`);continue}let m;try{m=G(g)}catch{n.push(`Cannot resolve: ${a}`);continue}if(d.has(m))continue;let h;try{h=ae(m)}catch{n.push(`Cannot read: ${a}`);continue}if(!h.isFile()){n.push(`Not a file: ${a}`);continue}if(h.size===0){n.push(`Empty file: ${a}`);continue}let b=ue(m).toLowerCase();if(!de.has(b)){n.push(`Unsupported type ${b||"(none)"}: ${a}`);continue}if(h.size>le){n.push(`Too large (>50MB): ${a}`);continue}m!==o&&!m.startsWith(p)&&i.push(`Outside working dir: ${a}`),d.add(m),r.push(m)}return r.length>X&&n.push(`Too many files: ${r.length} (max ${X})`),{ok:n.length?[]:r,errors:n,warnings:i}}var B=class extends Error{constructor(n){super(n.join("; "));this.errors=n;this.name="AttachmentValidationError"}};async function Xe(e){let{promptText:t,filePaths:n,cwd:i,scenarios:d,isRefine:r,conn:o,deps:p}=e,{ok:a,errors:c,warnings:g}=p.validate(n,i);if(c.length)throw new B(c);e.onValidated?.();let m=a.length?await p.upload(o,a,p.onUpload):[],h=r?p.buildMappings(t,d):void 0;return{promptText:t,mappings:h,attachments:m,warnings:g}}import{readFile as me}from"fs/promises";import{basename as K}from"path";async function ge(e){let t=await e.authResolver.resolve();if(!t)throw new v("unauthorized; run `kane-cli login`");return E(t.username,t.access_key)}async function he(e,t,n={}){let i=n.fetchImpl??fetch,d=await me(t),r=K(t),o=new FormData;o.append("file",new Blob([d]),r),o.append("source","omniBox"),o.append("geminiFileUpload","true");let p=await i(`${e.tmsBaseUrl}/v1/attachment`,{method:"POST",headers:{Authorization:await ge(e)},body:o,signal:n.signal});if(!p.ok){let h;try{h=await p.clone().json()}catch{}throw x(p.status,h)}let a=await p.json(),c=a?.data??a,g=c?.gemini_response?.uri,m=c?.gemini_response?.mimeType;if(!c?.file_key||!g){let h=c&&typeof c=="object"?Object.keys(c).join(","):typeof c,b=(()=>{try{return JSON.stringify(c).slice(0,500)}catch{return"<unserializable>"}})();throw new Error(`attachment upload for ${r} returned no file_key/gemini uri \u2014 status ${p.status}, body keys: [${h}], raw: ${b}`)}return{fileName:c.file_name??r,fileKey:c.file_key,geminiUri:g,mimeType:m??"application/octet-stream"}}async function tt(e,t,n,i={}){let d=[];for(let r=0;r<t.length;r++){if(i.signal?.aborted)throw Object.assign(new Error("upload aborted"),{name:"AbortError"});let o=K(t[r]);n?.({file:o,index:r+1,total:t.length,status:"uploading"});try{d.push(await he(e,t[r],i)),n?.({file:o,index:r+1,total:t.length,status:"done"})}catch(p){throw n?.({file:o,index:r+1,total:t.length,status:"failed"}),p}}return d}var ye=/@([sS])(\d+)\.([cC])(\d+)/g,be=/@([sS])(\d+)(?!\d)(?!\.[cC]\d)/g;function rt(e,t){let n={},i={};for(let d of e.matchAll(ye)){let r=Number(d[2]),o=Number(d[4]),p=t[r-1];if(!p)continue;n[`s${r}`]=String(p.id);let a=p.test_cases??[];if(a[o-1])for(let c=0;c<o;c++){let g=a[c];g&&(i[`s${r}.c${c+1}`]=String(g.id))}}for(let d of e.matchAll(be)){let r=Number(d[2]),o=t[r-1];o&&(n[`s${r}`]=String(o.id))}if(!(Object.keys(n).length===0&&Object.keys(i).length===0))return{scenario:n,testcase:i}}function R(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(n==null||typeof n!="object")return[];let i=n;if(typeof i.step!="string")return[];let d=typeof i.expected_result=="string"?i.expected_result:typeof i.outcome=="string"?i.outcome:"";t.push({step:i.step,expected:d})}return t}var we=30,Se=300;function Z(){return{mode:"testing",max_steps:we,timeout:Se,variables:{}}}function Q(e){return e.title??`Test case ${e.id}`}function ct(e,t){return $({frontmatter:Z(),heading:Q(t),steps:e.sub_objectives.map(n=>n.objective)})}function Y(e){let t=R(e.manual_steps).map(n=>n.step);return $({frontmatter:Z(),heading:Q(e),steps:t})}import{mkdtempSync as xe,mkdirSync as N,writeFileSync as ee,rmSync as te,renameSync as _e,existsSync as ne,readFileSync as ve}from"fs";import{join as _,resolve as ke}from"path";async function ft(e,t,n,i=Y){(n.redirectBareCwd??!0)&&ke(t)===process.cwd()&&(t=_(t,".testmuai","tests"));let d=T(e.objective)??e.headline,r=T(n.suiteName)??`${T(re(d,4))??"tcg"}-${e.requestId}`,o=r,p=_(t,r);ne(p)&&!Te(p,e.requestId)&&(o=`${r}-${e.requestId}`);let a=_(t,o),c=[],g=new Map;for(let h of e.scenarios){let b=(h.test_cases??[]).filter(Ae);if(b.length===0)continue;let w=T(Ee(h.scode))??T(h.sid)??`s${h.id}`,s=g.get(w)??new Set;g.set(w,s);for(let f of b){let u=T(re(f.title,5))??"case",l=`${u}_test.md`;for(let y=2;s.has(l);y++)l=`${u}-${y}_test.md`;s.add(l),c.push({dir:w,file:l,tc:f})}}if(c.length===0)return{suiteDir:a,paths:[],warning:"no functional test cases generated"};N(t,{recursive:!0});let m=xe(_(t,".tcg-tmp-"));try{N(_(m,"helpers"),{recursive:!0}),ee(_(m,".tcg-suite.json"),JSON.stringify({requestId:e.requestId,suiteName:o}));let h=[],b=new Set;for(let s of c){let f=_(m,s.dir);b.has(f)||(N(f,{recursive:!0}),b.add(f));let u=_(f,s.file);ee(u,i(s.tc)),h.push(u)}ne(a)&&te(a,{recursive:!0,force:!0}),_e(m,a);let w=h.map(s=>s.replace(m,a));return{suiteDir:a,paths:w}}catch(h){try{te(m,{recursive:!0,force:!0})}catch{}throw h}}function Ae(e){return(e.category??"").trim().toLowerCase()==="functional"}function Te(e,t){try{return JSON.parse(ve(_(e,".tcg-suite.json"),"utf-8"))?.requestId===t}catch{return!1}}function T(e){return e&&e.length>0?e:void 0}function re(e,t){return e?e.toLowerCase().replace(/[^a-z0-9]+/g," ").trim().split(/\s+/).filter(Boolean).slice(0,t).join("-"):""}function Ee(e){return e?e.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""):""}function ht(e){let t=[];e.title&&t.push(e.title),e.description&&t.push("",e.description);let n=R(e.manual_steps);return n.length>0&&(t.push("","Steps:"),n.forEach((i,d)=>{t.push(`${d+1}. ${i.step}`)})),t.join(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as l}from"./chunk-DFS4RMVP.js";function n({into:r}){return r.current=l(),null}export{n as a};
2
+ import{b as l}from"./chunk-WN5VKKJ3.js";function n({into:r}){return r.current=l(),null}export{n as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-DHJSM5DT.js";import{a as c}from"./chunk-NLCCBXXV.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-ADZ4PAJF.js"),import("./bootstrap-DI4UGMH3.js")]);await s(n(),r)}catch{}return this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(t){return this._lastError=t instanceof Error?t:new Error(String(t)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,t={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...t,headers:{...t.headers,Authorization:c(i.username,i.access_key)}}),n=await a(e,s(r));if(n.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return a(e,s(i))}return n}};function _(o){if(!o)return"network";let e=/failed:\s*(\d{3})\b/.exec(o.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{h as a,_ as b};
2
+ import{a as l}from"./chunk-FCD3NYOM.js";import{a as c}from"./chunk-4QTH7VYE.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-HL5CJJXR.js"),import("./bootstrap-TY5RANJ7.js")]);await s(n(),r)}catch{}return this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(t){return this._lastError=t instanceof Error?t:new Error(String(t)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,t={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...t,headers:{...t.headers,Authorization:c(i.username,i.access_key)}}),n=await a(e,s(r));if(n.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return a(e,s(i))}return n}};function _(o){if(!o)return"network";let e=/failed:\s*(\d{3})\b/.exec(o.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{h as a,_ as b};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ var M={"use-case":"use-cases",ac:"ACs",scenario:"scenarios",test:"tests",gap:"gaps"},y=n=>M[n]??`${n}s`,O=n=>n==="ac"?"AC":n==="use-case"?"use-case":n,m=n=>n.kind??"use-case",b=n=>`${m(n)}:${n.logical_id??n.temp_ref}`;function D(n,e){if(!e.logical_id)return;let s=n.get(`${m(e)}:${e.temp_ref}`);return s&&!s.item.logical_id?s:void 0}var A=n=>{let e=n;return JSON.stringify([e.question??null,e.rationale??null])};function U(n){let e=n,s=e.badge??n.risk??null,l=e.why??n.summary??n.description??null;return JSON.stringify([n.title,s,l,e.extra??null,n.depends_on_hint??null])}function w(n){return n.filter(e=>e.role==="agent"&&typeof e.turnIndex=="number"&&Array.isArray(e.items)&&e.items.length>0)}var B=n=>h(n).entries.filter(e=>e.item.logical_id&&!e.item.turnedDown&&!e.item.sessionAdded&&m(e.item)!=="exercise").length;function h(n){let e=new Map,s=1;for(let r of w(n)){let a=new Set;for(let o of r.items){let c=b(o);if(a.has(c))continue;a.add(c);let d=e.has(c)?void 0:D(e,o);d&&e.delete(b(d.item));let p=e.get(c)??d;e.set(c,{num:p?.num??s++,ref:o.temp_ref,kind:m(o),item:o,turnIndex:r.turnIndex,fingerprint:U(o)})}}let l=[...e.values()].sort((r,a)=>r.num-a.num),u=[];for(let r of l){let a=u.find(o=>o.kind===r.kind);a?a.count++:u.push({kind:r.kind,label:y(r.kind),count:1})}return{entries:l,byRef:e,counts:u}}function K(n,e,s){let u=w(n).find(t=>t.turnIndex===e);if(!u)return null;let r=n.filter(t=>t.role!=="agent"||typeof t.turnIndex!="number"||t.turnIndex<=e),a=h(r),o=h(n.filter(t=>t.role!=="agent"||typeof t.turnIndex!="number"||t.turnIndex<e)),c=[],d=new Map,p=new Map,x=new Map,I=new Set;for(let t of u.items){let i=b(t);if(I.has(i))continue;I.add(i);let f=o.byRef.get(i)??D(o.byRef,t),k=t.changed===!0,$=a.byRef.get(i).num,g=m(t);if(s?.skip?.has(g))continue;let E=f!==void 0&&f.fingerprint===U(t)&&(!s||A(f.item)===A(t));if(f&&!k&&E){d.set(g,(d.get(g)??0)+1);continue}let C=!!f||k,T=C?x:p;T.set(g,(T.get(g)??0)+1),c.push({item:t,num:$,updated:C})}let S=(t,i)=>s?s.label(t,i):i===1?O(t):y(t),R=[...d.entries()].map(([t,i])=>({label:s?s.label(t,i):y(t),count:i})),_=[...[...p.entries()].map(([t,i])=>`${i} new ${S(t,i)}`),...[...x.entries()].map(([t,i])=>`${i} updated ${S(t,i)}`)].join(" \xB7 ");return{fresh:c,unchanged:R,headerStats:_}}function L(n,e){let s=n.entries.filter(r=>r.turnIndex===e);if(s.length===0)return n;let l=new Map(s.map(r=>[r.ref,r])),u=[];for(let r of s){let a=u.find(o=>o.kind===r.kind);a?a.count+=1:u.push({kind:r.kind,label:y(r.kind),count:1})}return{entries:s,byRef:l,counts:u}}export{y as a,B as b,h as c,K as d,L as e};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ var a={complete:"complete",paused:"paused",interrupted:"interrupted",crashed:"crashed","walk-paused":"walk paused"};function s(e){return[`session summary \u2014 ${a[e.state]}${e.reason?` (${e.reason})`:""}`,...e.facts.map(t=>` ${t}`),...e.resume?[` resume: ${e.resume}`]:[],...e.resumeMessage?[` or with a message: ${e.resumeMessage}`]:[],...e.tracePath?[` trace: ${e.tracePath}`]:[]]}function m(e){process.stdout.write(s(e).join(`
3
+ `)+`
4
+ `)}export{s as a,m as b};
@@ -0,0 +1,6 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{N as v,O as x,Q as g}from"./chunk-432ZOE42.js";import{a as p}from"./chunk-R7KXAISS.js";import{a as b}from"./chunk-YDSGXB25.js";import{d as h,i as C}from"./chunk-LKQFG4RW.js";import{b as y}from"./chunk-HD6NR44L.js";import{M as E}from"./chunk-UEE3RZN4.js";async function O(o,e,n,t={},i=process.cwd()){let u=e.mode==="agent";if(o&&e.fromStale)return v(n,"pass a <ref> OR --from-stale, not both"),2;if(!o&&!e.fromStale)return v(n,"evolve needs a <ref> or --from-stale"),2;if(!u&&(e.answer?.length??0)>0)return v(n,"--answer rides --mode agent: the blast-radius question is asked on the stream and answered on the next call. In a terminal, answer the prompt instead"),2;let s=x(i,n);if(!s)return 2;let a=()=>h(E(p(s))).targets.length===0;if(!e.yes&&!n.isTTY&&!u&&!(e.fromStale&&a()))return v(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless, run with --mode agent (the question rides the stream and is answered with --answer on the next call) or let kane-cli maintain reconcile drive it"),2;let d=u?b(e.answer):null,m=t.emitEvent;return C(p(s),{...o?{ref:o}:{},...e.because?{because:e.because}:{},...e.mode?{mode:e.mode}:{},...e.yes?{yes:!0}:{}},{io:n,asks:{blast:d??{ask:async(c,l)=>await n.confirm(`proceed with the re-design of ${l}?`)?"proceed":"decline"}},runDesign:t.runDesignForUc??I,...t.onChild?{onChild:t.onChild}:!m&&n.isTTY?{onChild:$(n)}:{},...m?{emit:m}:{},by:{kind:"human",id:process.env.USER??"operator"}})}function $(o){let e="",n="evolve";return t=>{t.kind==="start"?(e=t.subject,n=t.verb,o.out(`\u25CF ${y(t.verb).ing} ${t.subject}`)):t.kind==="end"&&o.out(t.ok?`\u25CF ${y(n).ed} ${e} \u2014 ${t.durS}s`:`\u25CF ${n} failed \u2014 ${t.exitCode!=null?`exited ${t.exitCode}`:"error"}${t.fixCmd?` \xB7 ${t.fixCmd}`:""}`)}}var I=async(o,e)=>{let{designTestsCommand:n}=await import("./bind-XVO4CQYV.js"),t=a=>n({useCase:o,force:!0,...e.mode?{mode:e.mode}:e.yes?{mode:"override"}:{},...e.because?{because:e.because}:{},...e.changeDelta!==void 0?{changeDelta:e.changeDelta}:{},...e.priorDesign!==void 0?{priorDesign:e.priorDesign}:{},...e.repinsKept?{repinsKept:!0}:{},...e.statement?{statement:e.statement}:{},...a?{onEvent:a}:{}});if(e.mode!=="agent")return t(e.onChildEvent);let i=e.onChildEvent,u=process.stdout.write,s="";process.stdout.write=((a,d,m)=>{if(i){s+=typeof a=="string"?a:Buffer.isBuffer(a)?a.toString("utf8"):String(a);let l=s.indexOf(`
3
+ `);for(;l>=0;)S(s.slice(0,l),i),s=s.slice(l+1),l=s.indexOf(`
4
+ `)}let c=typeof d=="function"?d:m;return typeof c=="function"&&queueMicrotask(()=>c(null)),!0});try{return await t()}finally{process.stdout.write=u,i&&s.length>0&&S(s,i)}};function S(o,e){let n=o.trim();if(!n.startsWith("{"))return;let t;try{t=JSON.parse(n)}catch{return}if(!t||typeof t!="object"||typeof t.type!="string")return;let i=t;i.type!=="done"&&e(i)}async function B(o,e,n={},t,i=process.cwd()){if(!t&&i===process.cwd()){let{remoteEntry:d}=await import("./remote-entry-YL7O2NJQ.js"),m=await d("maintain evolve",e.mode==="agent");if(m!==null){if("exit"in m)return m.exit;let{remoteEvolve:c}=await import("./evolve-remote-BGHULJTL.js");return c({choice:m.choice,...o!==void 0?{ref:o}:{},opts:e})}}let{makeHeadlessIO:u,agentRefusal:s}=await import("./headless-io-FFM5T6KL.js");if(e.mode!==void 0&&e.mode!=="interactive"&&e.mode!=="agent")return s(u("ndjson","evolve",t),`--mode must be interactive | agent, got '${e.mode}'`,"MODE_USAGE");if(e.mode==="agent"){let d=process.stdout.write.bind(process.stdout),m=process.stderr.write.bind(process.stderr),c=u("ndjson","evolve",t??{stdout:r=>{d(r)},stderr:r=>{m(r)}}),l=[],D=r=>{(r.type==="evolve_paused"||r.type==="session_paused")&&Array.isArray(r.next)&&l.push(...r.next),c.event(r)},k={out:c.out,err:(r,w)=>c.event({type:"error",message:r,...w?{code:w}:{}}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},{runWithChannel:T}=await import("./run-channel-63SVP5OI.js"),f=2;try{f=await T({event:r=>c.event(r)},()=>O(o,e,k,{...n,emitEvent:D},i))}catch(r){f=1,c.event({type:"error",message:r instanceof Error?r.message:String(r)})}return c.done(f,void 0,l.length>0?l:void 0)}let a=t?{...g(),out:d=>t.stdout(`${d}
5
+ `),err:d=>t.stderr(`${d}
6
+ `),isTTY:!1}:g();return O(o,e,a,n,i)}export{O as a,I as b,S as c,B as d};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ function v(u,c,s=5e3){let f=process.listeners("SIGINT");process.removeAllListeners("SIGINT");let r=!1,o=!1,a=!1,n=new Set,l=[],d=e=>{try{e.send({type:"pause"})}catch{}if(s===null)return;let t=setTimeout(()=>{try{e.kill()}catch{}},s);t.unref?.(),l.push(t)},i=()=>{if(!r){r=!0,c(n.size>0?"interrupt \u2014 asking the agent to pause and save the session (Ctrl+C again to kill)":"interrupt \u2014 finishing the current step (Ctrl+C again to exit now)");for(let e of n)d(e);return}n.size===0&&process.exit(130),p()},p=()=>{o=!0;for(let e of n)try{e.kill()}catch{}};return process.on("SIGINT",i),{agent:((...e)=>{let t=u(...e);if(n.add(t),Promise.resolve(t.exited).catch(()=>{}).finally(()=>n.delete(t)),o)try{t.kill()}catch{}else r&&d(t);return t}),interrupted:()=>r,interrupt:()=>{r||i()},kill:p,dispose:()=>{if(!a){a=!0;for(let e of l)clearTimeout(e);process.removeListener("SIGINT",i);for(let e of f)process.on("SIGINT",e)}}}}export{v as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as T}from"./chunk-3G2LSTK5.js";import{a as d}from"./chunk-RZ4F3BHX.js";var h=class extends Error{constructor(t,e){super(t);this.status=e}name="EndTestError"},l=class extends Error{constructor(r){super(`Test Manager couldn't be reached: ${r}`),this.name="TmsUnreachable"}},b=class extends Error{constructor(t,e,s){super(t);this.status=e;this.body=s;this.name="TmsHttpError"}},P=class extends T{constructor(r,t,e){super(r,{username:t,accessKey:e})}async listProjects(r){let t=[],e=!1;for await(let s of this.listProjectsStream({log:r})){if(r&&!e&&s.projects.length>0){let n=s.projects[0];r("info","PROJECT_SAMPLE","Project list sample",{project_id:n.project_id,name:n.name}),e=!0}t.push(...s.projects)}return t}async*listProjectsStream(r){let t=r?.perPage??200,e=r?.maxPages??100,s=r?.signal,n=r?.log,a=r?.name?.trim(),o=0,c=null;for(let i=1;i<=e;i++){if(s?.aborted)return;let u=`${this.baseUrl}/v1/projects?page=${i}&per_page=${t}&sort=${r?.sort??"created_at"}&filter[product]=KTM`;a&&(u+=`&filter[name]=${encodeURIComponent(a)}`);let j=AbortSignal.timeout(15e3),S=s?AbortSignal.any([s,j]):j,g;try{g=await d(u,{method:"GET",headers:this.headers(),signal:S})}catch(p){if(s?.aborted)return;if(i===1)throw p;n?.("warn","PROJECTS_STREAM_PARTIAL","stream stopped mid-page",{page:i,total_loaded:o,error:p instanceof Error?p.message:String(p)}),yield{page:i,projects:[],totalLoaded:o,done:!0,total:c};return}if(!g.ok){if(i===1)throw new Error(`listProjects ${g.status}: ${await g.text()}`);n?.("warn","PROJECTS_STREAM_PARTIAL","stream stopped on non-OK response",{page:i,status:g.status,total_loaded:o}),yield{page:i,projects:[],totalLoaded:o,done:!0,total:c};return}let w=await g.json(),y=w.data??[];o+=y.length;let _=y.length<t;if(typeof w.pagination?.total=="number"&&(c=w.pagination.total),yield{page:i,projects:y,totalLoaded:o,done:_,total:c},_)return}n?.("warn","PROJECTS_STREAM_MAXPAGES","max pages reached",{max_pages:e,total_loaded:o}),yield{page:e,projects:[],totalLoaded:o,done:!0,total:c}}async getProject(r){let t;try{t=await d(`${this.baseUrl}/v1/projects/${encodeURIComponent(r)}`,{method:"GET",headers:this.headers(),signal:AbortSignal.timeout(15e3)})}catch(n){throw new l(n instanceof Error?n.message:String(n))}if(t.status===408||t.status===429)throw new l(`HTTP ${t.status}`);if(t.status>=400&&t.status<500)return null;if(!t.ok)throw new l(`HTTP ${t.status}`);let e;try{e=await t.json()}catch(n){throw new l(`an answer that isn't JSON: ${n instanceof Error?n.message:String(n)}`)}let s=typeof e.data?.name=="string"?e.data.name:typeof e.data?.project_name=="string"?e.data.project_name:null;if(s===null)throw new l("an answer with no project name");return{id:r,name:s}}async getDefaultFolder(r){let t=await d(`${this.baseUrl}/v1/projects/${r}/folder/default`,{method:"GET",headers:this.headers()});if(!t.ok)throw new Error(`Get default folder failed: ${t.status} ${await t.text()}`);return(await t.json()).id}async listFolders(r){let t=await d(`${this.baseUrl}/v1/folder/entity/${r}`,{method:"GET",headers:this.headers()});if(!t.ok)throw new Error(`List folders failed: ${t.status} ${await t.text()}`);return(await t.json()).data??[]}async validateProjectFolder(r,t){let e;try{e=await d(`${this.baseUrl}/v1/folder/entity/${r}`,{method:"GET",headers:this.headers()})}catch{return{project:"error",folder:"error"}}if(e.status>=400&&e.status<500)return{project:"missing",folder:"missing"};if(!e.ok)return{project:"error",folder:"error"};let s;try{s=await e.json()}catch{return{project:"error",folder:"error"}}return{project:"ok",folder:(s.data??[]).some(o=>o.id===t)?"ok":"missing"}}async createProject(r,t=""){let e=await d(`${this.baseUrl}/v1/projects`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({name:r,description:t,tags:[],source:"KTM"})});if(!e.ok){let n=await e.text(),a;try{a=JSON.parse(n)}catch{a=void 0}throw new b(`Create project failed: ${e.status} ${n}`,e.status,a)}let s=await e.json();return{id:s.id,name:r,...s.created===!1?{created:!1}:{}}}async createFolder(r,t,e=""){let s=await d(`${this.baseUrl}/v1/folder`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({folders:[{name:t,description:e,entity_id:r,entity_type:"project"}]})});if(!s.ok)throw new Error(`Create folder failed: ${s.status} ${await s.text()}`);return{id:(await s.json()).id,name:t}}async createAtmTest(r,t){let e=t?`Bearer ${t}`:this.authHeader,s=await d(`${this.baseUrl}/kane-cli/v1/test`,{method:"POST",headers:{Authorization:e,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!s.ok)throw new Error(`Create ATM test failed: ${s.status} ${await s.text()}`);let n=await s.json();if(!n.test_id)throw new Error("Create ATM test returned no test_id");return n.test_id}async createAttachedTest(r,t){let e;try{e=await d(`${this.baseUrl}/kane-cli/v1/test`,{method:"POST",headers:{Authorization:t?`Bearer ${t}`:this.authHeader,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)})}catch{return{ok:!1,reason:"failed",status:null}}let s=await e.json().catch(()=>null);if(e.status>=500)return{ok:!1,reason:"failed",status:e.status};if(!e.ok){let o=s?.error;return{ok:!1,reason:"refused",code:typeof s?.code=="string"?s.code:typeof o?.code=="string"?o.code:`HTTP_${e.status}`,status:e.status}}let n=typeof s?.test_id=="string"?s.test_id:"";if(n==="")return{ok:!1,reason:"failed",status:e.status};let a=s?.test_case_id;return typeof a!="string"&&typeof a!="number"||String(a)!==r.test_case_id?{ok:!1,reason:"outdated"}:{ok:!0,testId:n}}async createMobileAtmTest(r,t){let e=t?`Bearer ${t}`:this.authHeader,s=await d(`${this.baseUrl}/kane-cli/v1/mobile/test`,{method:"POST",headers:{Authorization:e,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!s.ok)throw new Error(`Create mobile ATM test failed: ${s.status} ${await s.text()}`);let n=await s.json();if(!n.test_id)throw new Error("Create mobile ATM test returned no test_id");return n.test_id}async createBrowserSession(r,t={}){let e=await d(`${this.baseUrl}/kane-cli/v1/browser-sessions`,{...t.signal?{signal:t.signal}:{},method:"POST",headers:{Authorization:this.authHeader,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({metadata:r})});if(!e.ok)throw await f.from(e);let s=await e.json().catch(()=>null);if(typeof s?.id!="string"||!s.id)throw new Error("Create browser session returned no id");return s.id}async endBrowserSession(r,t={}){let e=await d(`${this.baseUrl}/kane-cli/v1/browser-sessions/${encodeURIComponent(r)}`,{...t.signal?{signal:t.signal}:{},method:"DELETE",headers:{Authorization:this.authHeader,Accept:"application/json"}});if(!e.ok)throw await f.from(e)}async endTest(r,t,e){let s=e?`Bearer ${e}`:this.authHeader,n=new URLSearchParams({commit_id:t.commit_id,time_taken:String(t.time_taken),steps_count:String(t.steps_count),commit_message:t.commit_message}),a={};t.objectives&&t.objectives.length>0&&(a.objectives=t.objectives),t.assurance&&(a.assurance={test:t.assurance.test,definition_id:t.assurance.definitionId});let o;try{o=await d(`${this.baseUrl}/kane-cli/v1/test/${r}?${n.toString()}`,{method:"DELETE",headers:{Authorization:s,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(a)})}catch(i){throw new h(`End test failed: ${i instanceof Error?i.message:String(i)}`,null)}if(!o.ok){let i=await o.text().catch(u=>u instanceof Error?u.message:String(u));throw new h(`End test failed: ${o.status} ${i}`,o.status)}let c;try{c=await o.json()}catch(i){throw new h(`End test failed: ${i instanceof Error?i.message:String(i)}`,null)}return{testcase_id:c.data?.testcase_id??"",test_id:c.data?.test_id??r,project_id:c.data?.project_id??"",...typeof c.data?.commit_id=="string"?{commit_id:c.data.commit_id}:{}}}async submitFeedback(r,t){let e=t?`Bearer ${t}`:this.authHeader,s={instruction_id:r.instruction_id,test_id:r.test_id,feedback_type:r.feedback_type,mode:r.mode??"human"};r.details&&(s.details=r.details);let n=await d(`${this.baseUrl}/atm/v1/generative-feedback`,{method:"POST",headers:{Authorization:e,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(s)});if(!n.ok)throw new Error(`Submit feedback failed: ${n.status} ${await n.text()}`);return await n.json()}async ingestEvidence(r,t){let e=await d(`${this.baseUrl}/kane-cli/v1/evidence/ingest`,{method:"POST",headers:{Authorization:this.authHeader,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({evidence_id:r,project_id:t})});if(!e.ok)throw new Error(`Evidence ingest failed: ${e.status} ${await e.text()}`)}},f=class m extends Error{constructor(t,e,s,n){super(`Browser session failed: ${t} ${e}`);this.status=t;this.text=e;this.code=s;this.detail=n;this.name="BrowserSessionRefusal"}static async from(t){let e=await t.text().catch(()=>""),s=null;try{s=JSON.parse(e)}catch{}let n=s?.error&&typeof s.error=="object"?s.error:null,a=o=>typeof o=="string"&&o.trim()?o:null;return new m(t.status,e,a(s?.errorCode)??a(s?.code)??a(n?.code),a(s?.message)??a(n?.message))}};export{h as a,l as b,b as c,P as d,f as e};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ var s=new Set(["SYNC_BEHIND","SYNC_DIVERGED","SYNC_POSITION_TAKEN","SYNC_LOCAL_MOVED"]),i=new Set(["SYNC_REMOTE_CHAIN_BROKEN","SYNC_OBJECT_CORRUPT","SYNC_LOCAL_RECORD_CORRUPT"]),N=class extends Error{constructor(n,e,Y,u){super(e);this.code=n;this.remedy=Y;this.diagnostic=u}};function T(r){return s.has(r)?3:i.has(r)?1:2}var o="kane-context/v1",S=`${o}/commits/`,f=`${o}/meta.json`,O=1e3,C=999999999,I=new RegExp(`^${o}/commits/(\\d{6})/(\\d{9})\\.json$`),c=/^sha256:([0-9a-f]{64})$/;function E(r,t){let n=c.exec(r);if(!n)throw new Error(`not a ${t} fingerprint: ${r} \u2014 expected sha256:<64 lower-case hex>`);return n[1]}function _(r){if(!Number.isInteger(r)||r<1||r>C)throw new Error(`bad position ${r} \u2014 a position is a whole number from 1 to ${C}`);return String(Math.floor((r-1)/O)).padStart(6,"0")}function g(r){return`${S}${_(r)}/${String(r).padStart(9,"0")}.json`}function D(r){return`${S}${_(r)}/`}function L(r){let t=I.exec(r);if(!t)return null;let n=Number(t[2]);return n<1||t[1]!==_(n)?null:n}function l(r){let t=E(r,"blob");return`${o}/blobs/${t.slice(0,2)}/${t.slice(2)}`}function d(r,t){return`${R(r)}${E(t,"proposal digest").slice(0,12)}.json`}function R(r){let t=a(r);if(t===""||t==="."||t==="..")throw new Error(`bad proposal id ${JSON.stringify(r)} \u2014 a proposal id names a folder`);return`${o}/proposals/${t}/`}function a(r){let t="";for(let n of Buffer.from(r,"utf8")){let e=String.fromCharCode(n);t+=/^[a-z0-9._-]$/.test(e)?e:`~${n.toString(16).padStart(2,"0")}`}return t}function A(r){if(!/^[0-9a-f]{16,32}$/.test(r))throw new Error("probe nonce must be 16 to 32 lower-case hex characters");return`${o}/probe/${r}`}export{N as a,T as b,S as c,f as d,g as e,D as f,L as g,l as h,d as i,R as j,A as k};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $e,b as we,g as Ee}from"./chunk-7WXMV3O3.js";import{a as te}from"./chunk-DWMESHFI.js";import{a as G}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-CNUCP6DK.js";import{a as Te}from"./chunk-Z7IGTVJW.js";import{y as i}from"./chunk-5TQFOPJV.js";import{b as ye}from"./chunk-DFS4RMVP.js";import{a as E}from"./chunk-HCBYKLMW.js";import{a as s,b as o,i as Se,j as ve,k as ee}from"./chunk-C44QQJR4.js";import{a as z}from"./chunk-6YGTRKDT.js";import{e as R}from"./chunk-UR6MHSHU.js";var M=R(z(),1);var I=R(z(),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 ke(e){let t=Ee(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[n,l]=(0,I.useState)(0),[a,u]=(0,I.useState)("idle"),c=(0,I.useRef)("idle"),B=(0,I.useRef)(0),S=(0,I.useRef)(!1),v=(0,I.useRef)(null),d=(0,I.useRef)(null),O=(0,I.useCallback)(m=>{c.current=m,u(m)},[]),P=(0,I.useCallback)(async m=>{e.reportVerdictOnComplete&&await t.shutdownRunner($e(e.runVerdict?.()??(m?"failed":"passed"))),e.onAllComplete?.()},[t,e]),T=(0,I.useCallback)(async m=>{let b=await e.getNextConfig(m);if(!b){O("done"),await P(!1);return}let C=m?B.current+1:0;B.current=C,l(C),e.onStepStart?.(b,C),v.current=null,d.current=null,O("running"),await t.startRun(b,e.spawnOpts)},[t,e,O]);(0,I.useEffect)(()=>{S.current||(S.current=!0,T(null))},[]),(0,I.useEffect)(()=>{if(!t.lastRunEnd||t.lastRunEnd===v.current||c.current!=="running")return;v.current=t.lastRunEnd,c.current="transitioning",u("transitioning");let m=t.lastRunEnd,b=de(t.steps),C=t.bifurcationInfo,A={status:m.status==="passed"?"passed":"failed",duration_s:m.duration??0,reason:m.reason,runEnd:m,hadError:!1,stepsPassed:b.passed,stepsFailed:b.failed,stepsTotal:b.total,bifurcationFlows:C&&!C.isSingleFlow?C.flows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(A,B.current)??!0)){O("done"),P(A.status==="failed");return}T(A)},[t.lastRunEnd]),(0,I.useEffect)(()=>{if(!t.runError||t.runError===d.current||t.lastRunEnd||c.current!=="running")return;d.current=t.runError,c.current="transitioning",u("transitioning");let m=de(t.steps),b={status:"failed",duration_s:0,reason:t.runError,runEnd:null,hadError:!0,stepsPassed:m.passed,stepsFailed:m.failed,stepsTotal:m.total,bifurcationFlows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(b,B.current)??!0)){O("done"),P(!0);return}T(b)},[t.runError,t.lastRunEnd]);let k=(0,I.useCallback)(()=>{t.cancelRun()},[t]);return{runner:t,currentStepIndex:n,phase:a,cancel:k}}var pe=R(z(),1);var ne=R(E(),1),Ce=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Le({label:e,hasBifurcation:t=!1}){let[n,l]=(0,pe.useState)(0),[a,u]=(0,pe.useState)(0);G(()=>{l(B=>(B+1)%Ce.length)},80),G(()=>{u(B=>(B+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:[Ce[n]," "]}),(0,ne.jsxs)(o,{color:i.dim,children:[c,".".repeat(a+1)]})]})}function Oe(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 L=R(z(),1);var Pe=R(z(),1);var re=R(E(),1),Ue="#ffc580",We="#ffd9a8",Ie="#ffffff";function oe({text:e,active:t=!0}){let[n,l]=(0,Pe.useState)(0),a=4;if(G(()=>{l(c=>(c+1)%(e.length+a*2))},t?80:null),!t)return(0,re.jsx)(o,{color:Ie,children:e});let u=e.split("").map((c,B)=>{let S=n-a,v=Math.abs(B-S-a/2),d;return v<=a/2?d=Ue:v<=a?d=We:d=Ie,(0,re.jsx)(o,{color:d,children:c},B)});return(0,re.jsx)(o,{children:u})}var _=R(E(),1),ze={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=ze[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 Xe={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 De(e){return Xe[e]??"\u25CF"}var q=R(E(),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 B=!!c.branchObjective,S=`f${u}-${c.childId??"p"}-${c.index}`;return B?(0,q.jsxs)(s,{flexDirection:"column",children:[l({...c,children:void 0},S),(c.children??[]).map(v=>(0,q.jsx)(s,{marginLeft:2,children:l(v,`${S}-${v.childId??"p"}-${v.index}`)},`${S}-${v.childId??"p"}-${v.index}`))]},`${S}-host`):l(c,S)}):a.status==="pending"&&(0,q.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})]},u))]})}var K=R(E(),1);function je({label:e,shimmer:t=!1}){return(0,K.jsxs)(s,{marginLeft:6,children:[(0,K.jsx)(te,{}),(0,K.jsx)(o,{children:" "}),t?(0,K.jsx)(oe,{text:e,active:!0}):(0,K.jsx)(o,{color:i.dim,children:e})]})}var Fe=R(z(),1);var me=R(E(),1);function Ye(e,t){let n=[];for(let l of e.split(`
2
+ import{a as $e,b as we,g as Ee}from"./chunk-OEWYXCTA.js";import{a as te}from"./chunk-NQTYWHPB.js";import{a as G}from"./chunk-5Y2G4NC7.js";import{b as ye}from"./chunk-WN5VKKJ3.js";import{a as Be}from"./chunk-5BUIIFLC.js";import{a as Te}from"./chunk-I5NSJBOZ.js";import{a as E}from"./chunk-HCBYKLMW.js";import{a as s,b as o,i as Se,j as ve,k as ee}from"./chunk-33DWJV67.js";import{a as z}from"./chunk-6YGTRKDT.js";import{y as i}from"./chunk-I6OQISK4.js";import{e as R}from"./chunk-UR6MHSHU.js";var M=R(z(),1);var I=R(z(),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 ke(e){let t=Ee(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[n,l]=(0,I.useState)(0),[a,u]=(0,I.useState)("idle"),c=(0,I.useRef)("idle"),B=(0,I.useRef)(0),S=(0,I.useRef)(!1),v=(0,I.useRef)(null),d=(0,I.useRef)(null),O=(0,I.useCallback)(m=>{c.current=m,u(m)},[]),P=(0,I.useCallback)(async m=>{e.reportVerdictOnComplete&&await t.shutdownRunner($e(e.runVerdict?.()??(m?"failed":"passed"))),e.onAllComplete?.()},[t,e]),T=(0,I.useCallback)(async m=>{let b=await e.getNextConfig(m);if(!b){O("done"),await P(!1);return}let C=m?B.current+1:0;B.current=C,l(C),e.onStepStart?.(b,C),v.current=null,d.current=null,O("running"),await t.startRun(b,e.spawnOpts)},[t,e,O]);(0,I.useEffect)(()=>{S.current||(S.current=!0,T(null))},[]),(0,I.useEffect)(()=>{if(!t.lastRunEnd||t.lastRunEnd===v.current||c.current!=="running")return;v.current=t.lastRunEnd,c.current="transitioning",u("transitioning");let m=t.lastRunEnd,b=de(t.steps),C=t.bifurcationInfo,A={status:m.status==="passed"?"passed":"failed",duration_s:m.duration??0,reason:m.reason,runEnd:m,hadError:!1,stepsPassed:b.passed,stepsFailed:b.failed,stepsTotal:b.total,bifurcationFlows:C&&!C.isSingleFlow?C.flows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(A,B.current)??!0)){O("done"),P(A.status==="failed");return}T(A)},[t.lastRunEnd]),(0,I.useEffect)(()=>{if(!t.runError||t.runError===d.current||t.lastRunEnd||c.current!=="running")return;d.current=t.runError,c.current="transitioning",u("transitioning");let m=de(t.steps),b={status:"failed",duration_s:0,reason:t.runError,runEnd:null,hadError:!0,stepsPassed:m.passed,stepsFailed:m.failed,stepsTotal:m.total,bifurcationFlows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(b,B.current)??!0)){O("done"),P(!0);return}T(b)},[t.runError,t.lastRunEnd]);let k=(0,I.useCallback)(()=>{t.cancelRun()},[t]);return{runner:t,currentStepIndex:n,phase:a,cancel:k}}var pe=R(z(),1);var ne=R(E(),1),Ce=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Le({label:e,hasBifurcation:t=!1}){let[n,l]=(0,pe.useState)(0),[a,u]=(0,pe.useState)(0);G(()=>{l(B=>(B+1)%Ce.length)},80),G(()=>{u(B=>(B+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:[Ce[n]," "]}),(0,ne.jsxs)(o,{color:i.dim,children:[c,".".repeat(a+1)]})]})}function Oe(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 L=R(z(),1);var Pe=R(z(),1);var re=R(E(),1),Ue="#ffc580",We="#ffd9a8",Ie="#ffffff";function oe({text:e,active:t=!0}){let[n,l]=(0,Pe.useState)(0),a=4;if(G(()=>{l(c=>(c+1)%(e.length+a*2))},t?80:null),!t)return(0,re.jsx)(o,{color:Ie,children:e});let u=e.split("").map((c,B)=>{let S=n-a,v=Math.abs(B-S-a/2),d;return v<=a/2?d=Ue:v<=a?d=We:d=Ie,(0,re.jsx)(o,{color:d,children:c},B)});return(0,re.jsx)(o,{children:u})}var _=R(E(),1),ze={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=ze[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 Xe={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 De(e){return Xe[e]??"\u25CF"}var q=R(E(),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 B=!!c.branchObjective,S=`f${u}-${c.childId??"p"}-${c.index}`;return B?(0,q.jsxs)(s,{flexDirection:"column",children:[l({...c,children:void 0},S),(c.children??[]).map(v=>(0,q.jsx)(s,{marginLeft:2,children:l(v,`${S}-${v.childId??"p"}-${v.index}`)},`${S}-${v.childId??"p"}-${v.index}`))]},`${S}-host`):l(c,S)}):a.status==="pending"&&(0,q.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})]},u))]})}var K=R(E(),1);function je({label:e,shimmer:t=!1}){return(0,K.jsxs)(s,{marginLeft:6,children:[(0,K.jsx)(te,{}),(0,K.jsx)(o,{children:" "}),t?(0,K.jsx)(oe,{text:e,active:!0}):(0,K.jsx)(o,{color:i.dim,children:e})]})}var Fe=R(z(),1);var me=R(E(),1);function Ye(e,t){let n=[];for(let l of e.split(`
3
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 _e({text:e,maxLines:t=3}){let{stdout:n}=ee(),l=Math.max(20,(n?.columns??80)-7),a=!e.trim(),[u,c]=(0,Fe.useState)(!0);G(()=>c(v=>!v),500);let B=(a?"Thinking\u2026":e)+(u?"\u258C":" "),S=Ye(B,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((v,d)=>(0,me.jsx)(o,{color:a?i.dim:i.secondary,wrap:"truncate-end",children:v.length?v:" "},d))})}var H=R(E(),1);function se({activity:e,describe:t,describeVisible:n}){return(0,H.jsxs)(H.Fragment,{children:[e?(0,H.jsx)(je,{label:e.label,shimmer:e.shimmer}):null,n?(0,H.jsx)(_e,{text:t??""}):null]})}var r=R(E(),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 X(e){return e.status==="running"&&!e.branchObjective&&(!e.children||e.children.length===0)}function Ae(e){let t=[];for(let n of e)X(n)||(n.children&&n.children.length>0?t.push({...n,children:Ae(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 D({step:e,indent:t=2}){let n=e.actionType?De(e.actionType):null,l=e.status==="running",a=e.status==="passed",u=e.status==="failed",c=e.status==="pending"||e.status==="stopped",{stdout:B}=ee(),S=B?.columns??80,v=Math.max(20,S-t-21),d=e.objective??"",O=d.length>v?d.slice(0,v-1)+"\u2026":d,P=(e.duration??0)*1e3,T=e.duration!=null?P<1e3?`${Math.round(P)}ms`:`${(P/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:O,active:!0}):u?(0,r.jsx)(o,{color:i.red,children:O}):c?(0,r.jsx)(o,{color:i.dim,children:O}):(0,r.jsx)(o,{color:i.dim,children:O})}),(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:T})})]}),e.children&&e.children.length>0&&(0,r.jsx)(s,{flexDirection:"column",children:e.children.map((k,m)=>(0,r.jsx)(D,{step:k,indent:t+2},`child-${m}`))})]})}function Je(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)(D,{step:e.step})})}function Me({steps:e,bifurcated:t,flows:n,cmInitCounts:l,maxSteps:a=50,staticSteps:u=!1,onStepCommit:c,describe:B,describeVisible:S,describeRevealing:v}){let d=(0,L.useRef)(new Set),O=(0,L.useRef)(!1),P=(0,L.useRef)(new Set),T=(0,L.useRef)(!1),k=(0,L.useRef)(new Set),m=(0,L.useRef)(0);(0,L.useEffect)(()=>{e.length===0&&m.current>0&&(d.current.clear(),O.current=!1,P.current.clear(),T.current=!1,k.current.clear()),m.current=e.length},[e.length]);let b=e.flatMap(p=>[p,...p.children??[]]),C=b.some(p=>p.status==="running"),A=b.some(p=>p.status==="failed"),W=b.length===0||b.every(p=>p.status==="pending"),Y=b.filter(p=>p.status==="passed"||p.status==="failed").length,N;W?N="starting":C?N="running":A?N="failed":N="passed";let J=(0,L.useRef)(null),[ce,he]=(0,L.useState)(0);(0,L.useEffect)(()=>{b.length===0||W?(J.current=null,he(0)):C&&J.current==null&&(J.current=Date.now())},[C,W,b.length]),(0,L.useEffect)(()=>{if(!C)return;let p=setInterval(()=>{J.current!=null&&he((Date.now()-J.current)/1e3)},500);return()=>clearInterval(p)},[C]);let ae=(0,L.useRef)(new Set),[,xe]=(0,L.useState)(0),be=(0,L.useRef)(!1);(0,L.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 h of e)(h.status==="passed"||h.status==="failed")&&!ae.current.has(h.index)&&(ae.current.add(h.index),p.push({key:`step_${h.index}`,type:"step",step:{...h,children:h.children?[...h.children]:void 0}}));if(p.length>0){for(let h of p)c(Je(h));xe(h=>h+1)}},[e,t,l,u,c]),(0,L.useEffect)(()=>{if(!c||u)return;let p=d.current.size;if(!t&&!T.current&&l&&l[0]!=null&&(T.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&&!O.current&&(O.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 h=e.flatMap((x,f)=>{let g=x.children??[];return!P.current.has(f)&&g.length>0&&(P.current.add(f),c((0,r.jsx)(o,{color:i.purple,children:" Flow "+(f+1)+": "+(n?.[f]??"")})),l?.[f]!=null&&l[f]>0&&!k.current.has(f)&&(k.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&&P.current.has(f)&&!k.current.has(f)&&(k.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"]})}))),g});for(let x of h){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)(D,{step:{...x,children:void 0}})})));for(let y of x.children??[]){let $=`child-${x.childId??"p"}-${x.index}-${y.childId??"p"}-${y.index}-${y.objective}`;d.current.has($)||(y.status==="passed"||y.status==="failed"||y.status==="stopped")&&(d.current.add($),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(D,{step:y})})))}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)(D,{step:x})})))}}else for(let h of e){let x=`${h.index}-${h.objective}`,f=!!h.branchObjective;f&&!d.current.has(x)&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(D,{step:{...h,children:void 0}})})));for(let g of h.children??[]){let y=`child-${h.index}-${g.childId??"p"}-${g.index}-${g.objective}`;d.current.has(y)||(g.status==="passed"||g.status==="failed"||g.status==="stopped")&&(d.current.add(y),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(D,{step:g})})))}!f&&!d.current.has(x)&&(h.status==="passed"||h.status==="failed"||h.status==="stopped")&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(D,{step:{...h,children:void 0}})})))}d.current.size>p&&xe(h=>h+1)},[e,c,t,n,l]);let V=[];if(u&&!t)for(let p of e)ae.current.has(p.index)||V.push(p);else if(c&&!u)if(t)for(let p of e){let h=p.children??[],x=[];for(let f of h){let g=`${f.childId??"p"}-${f.index}-${f.objective}`,y=d.current.has(g);if(f.branchObjective){let $=(f.children??[]).filter(Q=>{let ue=`child-${f.childId??"p"}-${f.index}-${Q.childId??"p"}-${Q.index}-${Q.objective}`;return!d.current.has(ue)});(!y||$.length>0)&&x.push({...f,children:$})}else y||x.push(f)}x.length>0&&V.push({...p,children:x})}else for(let p of e){let h=`${p.index}-${p.objective}`,x=d.current.has(h),f=(p.children??[]).filter(g=>{let y=`child-${p.index}-${g.childId??"p"}-${g.index}-${g.objective}`;return!d.current.has(y)});x?f.length>0&&V.push({...p,children:f}):V.push({...p,children:f})}if(!u){let p=c?V:e,h=le(p),x=ge(h,v);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((g,y)=>(0,r.jsx)(s,{flexDirection:"column",marginTop:y>0?1:0,children:g.children&&g.children.length>0?g.children.map($=>{if(X($))return null;let Q=!!$.branchObjective,ue=`${$.childId??"p"}-${$.index}-${$.objective}`,He=d.current.has(ue);return Q?(0,r.jsxs)(s,{flexDirection:"column",children:[!He&&(0,r.jsx)(D,{step:{...$,children:void 0}}),($.children??[]).filter(Z=>!X(Z)).map(Z=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(D,{step:Z})},`f${y}-${$.index}-${Z.childId??"p"}-${Z.index}`))]},`f${y}-host-${$.childId??"p"}-${$.index}`):(0,r.jsx)(D,{step:$},`f${y}-${$.childId??"p"}-${$.index}`)}):g.status==="pending"&&(0,r.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})},y))}):null:(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(g,y)=>X(g)?null:(0,r.jsx)(D,{step:g},y)}):(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(g=>!(g.status==="running"&&(!g.children||g.children.length===0))).map(g=>{let y=`${g.index}-${g.objective}`;return c&&d.current.has(y)?(0,r.jsx)(s,{flexDirection:"column",children:(g.children??[]).filter($=>!X($)).map($=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(D,{step:$})},`${$.childId??"p"}-${$.index}`))},`branch-children-${g.index}`):(0,r.jsx)(D,{step:g},g.index)})]}),(0,r.jsx)(se,{activity:x,describe:B,describeVisible:S}),b.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}if(t){let p=le(e),h=ge(p,v);return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(x,f)=>X(x)?null:(0,r.jsx)(D,{step:x},f)}),(0,r.jsx)(se,{activity:h,describe:B,describeVisible:S}),b.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}let Ge=le(V),Ke=ge(Ge,v),Re=Ae(V);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)(D,{step:p},p.index))}),(0,r.jsx)(se,{activity:Ke,describe:B,describeVisible:S}),b.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}var U=R(E(),1);function qe({runner:e,runKey:t,onStepCommit:n}){let l=Oe({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,U.jsxs)(U.Fragment,{children:[l&&(0,U.jsx)(Le,{label:l.label,hasBifurcation:l.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,U.jsx)(Me,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:n},`run-${t}`)]})}var j=R(E(),1),Qe=64;function Ze(e){return e.split(`
4
4
  `).map(t=>t.replace(/^[-–•]\s*/,"").trim()).filter(t=>t.length>0)}function Ne({status:e,summary:t,duration:n,steps:l,stepsPassed:a,stepsFailed:u,reason:c,creditsConsumed:B}){let S=e==="passed",v=S?i.green:i.red,d=S?"\u2713":"\u2717",O=e.toUpperCase(),P=a??(S?l:Math.max(0,l-1)),T=u??(S?0:1),k=T>0?`${l} steps (${P} passed, ${T} failed)`:`${l} steps`,m=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`,b=Ze(t);return(0,j.jsx)(s,{flexDirection:"column",marginTop:1,children:(0,j.jsxs)(s,{borderStyle:"round",borderColor:v,flexDirection:"column",paddingX:2,paddingY:1,width:Qe+6,children:[(0,j.jsxs)(s,{flexDirection:"column",children:[(0,j.jsxs)(o,{bold:!0,color:v,children:[d," ",O]}),(0,j.jsxs)(o,{color:i.dim,wrap:"wrap",children:[k," \xB7 ",m,typeof B=="number"&&B>0?` \xB7 ${parseFloat(B.toFixed(4))} credits`:""]})]}),b.length>0&&(0,j.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:b.map((C,A)=>(0,j.jsxs)(s,{marginBottom:A<b.length-1?1:0,children:[(0,j.jsx)(o,{color:i.orange,children:"\u25CF "}),(0,j.jsx)(s,{flexShrink:1,children:(0,j.jsx)(o,{wrap:"wrap",children:C})})]},A))}),c&&!S&&(0,j.jsx)(s,{marginTop:1,children:(0,j.jsxs)(o,{color:i.red,wrap:"wrap",children:["Reason: ",c]})})]})})}var F=R(E(),1);function Ve({message:e,code:t,remediation:n,docsUrl:l}){return(0,F.jsx)(Te,{title:"Error",variant:"error",children:(0,F.jsxs)(s,{flexDirection:"column",paddingY:1,children:[(0,F.jsxs)(o,{color:i.red,bold:!0,children:[" \u2717 ",e]}),t&&(0,F.jsxs)(s,{marginTop:0,marginLeft:5,children:[(0,F.jsx)(o,{color:i.muted,children:"Code: "}),(0,F.jsx)(o,{color:i.dim,children:t})]}),n&&(0,F.jsxs)(s,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,F.jsx)(o,{color:i.green,bold:!0,children:"Fix:"}),(0,F.jsxs)(o,{color:i.orange,children:["$ ",n]})]}),l&&(0,F.jsxs)(s,{marginTop:1,marginLeft:5,children:[(0,F.jsx)(o,{color:i.muted,children:"Docs: "}),(0,F.jsx)(o,{color:i.orange,underline:!0,children:l})]})]})})}var w=R(E(),1),et=1e4;function gn(e){let{exit:t}=ve(),{append:n}=ye(),l=(0,M.useRef)(!1);(0,M.useEffect)(()=>{l.current||(l.current=!0,n((0,w.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,w.jsxs)(s,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,w.jsx)(o,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,w.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,w.jsx)(o,{color:i.orange,children:e.topBanner.model}),(0,w.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,w.jsx)(o,{color:i.dim,children:e.topBanner.auth})]})})),n((0,w.jsx)(tt,{data:e.globalConfig})),e.priorAttemptRollup&&n((0,w.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,M.useRef)(null),u=(0,M.useCallback)(async T=>{let k=await e.getNextStep(T);return k?(a.current=k,k.config):(a.current=null,null)},[e]),c=(0,M.useCallback)((T,k)=>{let m=a.current;if(!m)return;let b=m.mode==="replay"?"cyan":"#dc4e08",C=m.modeReason?` (${m.modeReason})`:"",A=m.perStepOverrides?Object.entries(m.perStepOverrides):[];n((0,w.jsxs)(s,{flexDirection:"column",marginBottom:0,children:[(0,w.jsxs)(o,{children:[(0,w.jsxs)(o,{color:i.dim,children:[m.banner.stepLabel," "]}),(0,w.jsxs)(o,{color:b,children:["[",m.mode,"]"]}),(0,w.jsx)(o,{color:i.dim,children:C})]}),(0,w.jsx)(o,{color:i.dim,children:m.banner.objective}),A.length>0&&(0,w.jsxs)(o,{color:i.dim,children:["overrides: ",A.map(([W,Y])=>`${W}=${Y}`).join(", ")]})]}))},[n]),B=(0,M.useRef)(0),S=(0,M.useRef)(!1),v=(0,M.useCallback)((T,k)=>(T.hadError?n((0,w.jsx)(Ve,{message:T.reason??"Runner error",code:"RUNNER_ERROR"})):n((0,w.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,w.jsx)(Ne,{status:T.status,summary:T.runEnd?.summary??"",duration:T.runEnd?.duration??0,steps:T.stepsTotal,stepsPassed:T.stepsPassed,stepsFailed:T.stepsFailed,reason:T.runEnd?.reason,creditsConsumed:T.runEnd?.credits_consumed})})),e.onStepEnd?.(T,k)??!0),[n,e]),d=ke({getNextConfig:u,onStepStart:c,onStepEnd:v,onAllComplete:()=>{e.onAllComplete(),e.exitOnComplete!==!1&&setImmediate(()=>t())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts,...e.reportVerdictOnComplete?{reportVerdictOnComplete:!0}:{},...e.runVerdict?{runVerdict:e.runVerdict}:{}}),O=250,P=5e3;return Se((T,k)=>{if(k.ctrl&&T==="c"){let m=Date.now(),b=m-B.current;if(b<O)return;if(S.current&&b<P){d.cancel(),e.onCancel?.();let C=e.reportVerdictOnComplete?d.runner.shutdownRunner(we,{timeoutMs:et}):Promise.resolve();e.exitOnComplete!==!1&&C.then(()=>setImmediate(()=>t()))}else S.current=!0,n((0,w.jsx)(o,{color:"yellow",children:"press Ctrl+C again to cancel run"}));B.current=m}}),(0,w.jsx)(s,{flexDirection:"column",children:d.phase!=="done"&&(0,w.jsx)(qe,{runner:d.runner,runKey:d.currentStepIndex,onStepCommit:n})})}function tt({data:e}){return(0,w.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{Me as a,Le as b,Oe as c,de as d,Ne as e,Ve as f,gn as g};
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as W}from"./chunk-MSGW4JDG.js";import{d as U,e as F}from"./chunk-4JOD47QI.js";import{a as H}from"./chunk-5TQFOPJV.js";import{createHash as Y}from"crypto";import{access as Q,mkdir as S,mkdtemp as Z,readdir as O,readFile as y,rename as N,rm as v,writeFile as x}from"fs/promises";import{homedir as tt}from"os";import{arch as et,platform as st}from"process";import{dirname as C,isAbsolute as nt,join as l,relative as X,resolve as rt,sep as it}from"path";var q=1,ot={emulator:"emulator",simulator:"simulator"};function Pt(i){return ot[i.kind]??null}var j=class extends Error{constructor(s,e,n){super([`Managed mobile dependencies for ${s} are not installed.`,`- kaneai-mobile-deps ${s} ${e.bundleVersion}: ${e.url} (${_(e.bytes)})`,`Destination: ${n}`,`Run \`kane-cli doctor --target ${s} --install\` to download it.`].join(`
3
- `));this.deviceClass=s;this.name="DepsInstallRequiredError"}};function _(i){return i>=1024*1024?`${Math.ceil(i/(1024*1024))} MB`:`${i} bytes`}function at(i){let t=i/1048576;return t>=10?`${Math.round(t)} MB/s`:t>=1?`${t.toFixed(1)} MB/s`:`${Math.max(1,Math.round(i/1024))} KB/s`}function lt(i){let t=Math.max(1,Math.round(i));return t<60?`~${t}s left`:`~${Math.floor(t/60)}m ${t%60}s left`}var K=8*1024*1024,ct=8;function ut(i){if(!Number.isFinite(i)||i<2*K)return null;let t=Math.min(ct,Math.floor(i/K)),s=Math.ceil(i/t),e=[];for(let n=0;n<i;n+=s)e.push({start:n,end:Math.min(n+s,i)-1});return e}async function L(i,t){let s=i.body;if(!s||typeof s.getReader!="function"){let c=new Uint8Array(await i.arrayBuffer());return t?.(c.length),c}let e=s.getReader(),n=[],r=0;for(;;){let{done:c,value:h}=await e.read();if(c)break;h&&(n.push(h),r+=h.length,t?.(h.length))}let o=new Uint8Array(r),a=0;for(let c of n)o.set(c,a),a+=c.length;return o}var z=3,dt=3e4,k=class extends Error{};async function pt(i,t,s,e,n,r=dt){let o=new Uint8Array(s),a=0,c=new AbortController,h=null,b=!1;try{await Promise.all(e.map(async(f,M)=>{let P=0,V=d=>{P+=d,a+=d,n?.(a)},T=()=>{a=Math.max(0,a-P),P=0},R=null;for(let d=0;d<z;d+=1){if(c.signal.aborted)return;let u=new AbortController,m=()=>u.abort();c.signal.addEventListener("abort",m,{once:!0});let w=!1,g=null,$=()=>{g&&clearTimeout(g),g=setTimeout(()=>{w=!0,u.abort()},r)};try{$();let p=await i(t,{headers:{Range:`bytes=${f.start}-${f.end}`},signal:u.signal});if(typeof p.body?.getReader!="function"&&g&&(clearTimeout(g),g=null),!p.ok)throw new k(`Could not download ${t}: HTTP ${p.status}`);if(p.status!==206){b=!0,M===0?h=await L(p,I=>{$(),V(I)}):await(p.body?.cancel().catch(()=>{})??Promise.resolve());return}let D=f.end-f.start+1,E=await L(p,I=>{$(),V(I)});if(E.length!==D)throw new Error(`range ${f.start}-${f.end} returned ${E.length} bytes (expected ${D})`);o.set(E,f.start);return}catch(p){if(p instanceof k)throw p;if(c.signal.aborted)return;T(),R=w?new Error(`no data for ${Math.round(r/1e3)}s`):p instanceof Error?p:new Error(String(p))}finally{g&&clearTimeout(g),c.signal.removeEventListener("abort",m)}}throw new Error(`Could not download ${t}: range ${f.start}-${f.end} failed after ${z} attempts (${R?.message??"unknown error"}) \u2014 check your network and rerun \`kane-cli doctor --target <emulator|simulator> --install\`.`)}))}catch(f){throw c.abort(),f}return h||(b?null:o)}async function ht(i,t,s,e,n){let r=ut(s);if(r){let c=await pt(i,t,s,r,e,n?.stallMs);if(c)return c}let o=await i(t);if(!o.ok)throw new Error(`Could not download ${t}: HTTP ${o.status}`);let a=0;return L(o,e&&(c=>{a+=c,e(a)}))}function ft(i){return Y("sha256").update(i).digest("hex")}function mt(i,t){let s=X(i,t);return s!==""&&!s.startsWith(`..${it}`)&&s!==".."&&!nt(s)}async function A(i){try{return await Q(i),!0}catch{return!1}}function wt(){return{home:tt(),os:st,arch:et,cliVersion:H,nodeModuleVersion:process.versions.modules,fetch,resolveBundle:async i=>(await import("./deps-resolve-ZOALDS6H.js")).controllerResolveBundle()(i),exec:U,now:()=>new Date,wait:F,processAlive:i=>{try{return process.kill(i,0),!0}catch{return!1}}}}var B=class extends Error{constructor(s,e,n){super(`No managed mobile dependencies are published for ${s} (kane-cli ${e}).
2
+ import{d as U,e as F}from"./chunk-4JOD47QI.js";import{d as W}from"./chunk-GMTHZUZ3.js";import{a as H}from"./chunk-I6OQISK4.js";import{createHash as Y}from"crypto";import{access as Q,mkdir as S,mkdtemp as Z,readdir as O,readFile as y,rename as N,rm as v,writeFile as x}from"fs/promises";import{homedir as tt}from"os";import{arch as et,platform as st}from"process";import{dirname as C,isAbsolute as nt,join as l,relative as X,resolve as rt,sep as it}from"path";var q=1,ot={emulator:"emulator",simulator:"simulator"};function Pt(i){return ot[i.kind]??null}var j=class extends Error{constructor(s,e,n){super([`Managed mobile dependencies for ${s} are not installed.`,`- kaneai-mobile-deps ${s} ${e.bundleVersion}: ${e.url} (${_(e.bytes)})`,`Destination: ${n}`,`Run \`kane-cli doctor --target ${s} --install\` to download it.`].join(`
3
+ `));this.deviceClass=s;this.name="DepsInstallRequiredError"}};function _(i){return i>=1024*1024?`${Math.ceil(i/(1024*1024))} MB`:`${i} bytes`}function at(i){let t=i/1048576;return t>=10?`${Math.round(t)} MB/s`:t>=1?`${t.toFixed(1)} MB/s`:`${Math.max(1,Math.round(i/1024))} KB/s`}function lt(i){let t=Math.max(1,Math.round(i));return t<60?`~${t}s left`:`~${Math.floor(t/60)}m ${t%60}s left`}var K=8*1024*1024,ct=8;function ut(i){if(!Number.isFinite(i)||i<2*K)return null;let t=Math.min(ct,Math.floor(i/K)),s=Math.ceil(i/t),e=[];for(let n=0;n<i;n+=s)e.push({start:n,end:Math.min(n+s,i)-1});return e}async function L(i,t){let s=i.body;if(!s||typeof s.getReader!="function"){let c=new Uint8Array(await i.arrayBuffer());return t?.(c.length),c}let e=s.getReader(),n=[],r=0;for(;;){let{done:c,value:h}=await e.read();if(c)break;h&&(n.push(h),r+=h.length,t?.(h.length))}let o=new Uint8Array(r),a=0;for(let c of n)o.set(c,a),a+=c.length;return o}var z=3,dt=3e4,k=class extends Error{};async function pt(i,t,s,e,n,r=dt){let o=new Uint8Array(s),a=0,c=new AbortController,h=null,b=!1;try{await Promise.all(e.map(async(f,M)=>{let P=0,V=d=>{P+=d,a+=d,n?.(a)},T=()=>{a=Math.max(0,a-P),P=0},R=null;for(let d=0;d<z;d+=1){if(c.signal.aborted)return;let u=new AbortController,m=()=>u.abort();c.signal.addEventListener("abort",m,{once:!0});let w=!1,g=null,$=()=>{g&&clearTimeout(g),g=setTimeout(()=>{w=!0,u.abort()},r)};try{$();let p=await i(t,{headers:{Range:`bytes=${f.start}-${f.end}`},signal:u.signal});if(typeof p.body?.getReader!="function"&&g&&(clearTimeout(g),g=null),!p.ok)throw new k(`Could not download ${t}: HTTP ${p.status}`);if(p.status!==206){b=!0,M===0?h=await L(p,I=>{$(),V(I)}):await(p.body?.cancel().catch(()=>{})??Promise.resolve());return}let D=f.end-f.start+1,E=await L(p,I=>{$(),V(I)});if(E.length!==D)throw new Error(`range ${f.start}-${f.end} returned ${E.length} bytes (expected ${D})`);o.set(E,f.start);return}catch(p){if(p instanceof k)throw p;if(c.signal.aborted)return;T(),R=w?new Error(`no data for ${Math.round(r/1e3)}s`):p instanceof Error?p:new Error(String(p))}finally{g&&clearTimeout(g),c.signal.removeEventListener("abort",m)}}throw new Error(`Could not download ${t}: range ${f.start}-${f.end} failed after ${z} attempts (${R?.message??"unknown error"}) \u2014 check your network and rerun \`kane-cli doctor --target <emulator|simulator> --install\`.`)}))}catch(f){throw c.abort(),f}return h||(b?null:o)}async function ht(i,t,s,e,n){let r=ut(s);if(r){let c=await pt(i,t,s,r,e,n?.stallMs);if(c)return c}let o=await i(t);if(!o.ok)throw new Error(`Could not download ${t}: HTTP ${o.status}`);let a=0;return L(o,e&&(c=>{a+=c,e(a)}))}function ft(i){return Y("sha256").update(i).digest("hex")}function mt(i,t){let s=X(i,t);return s!==""&&!s.startsWith(`..${it}`)&&s!==".."&&!nt(s)}async function A(i){try{return await Q(i),!0}catch{return!1}}function wt(){return{home:tt(),os:st,arch:et,cliVersion:H,nodeModuleVersion:process.versions.modules,fetch,resolveBundle:async i=>(await import("./deps-resolve-IET4KIBO.js")).controllerResolveBundle()(i),exec:U,now:()=>new Date,wait:F,processAlive:i=>{try{return process.kill(i,0),!0}catch{return!1}}}}var B=class extends Error{constructor(s,e,n){super(`No managed mobile dependencies are published for ${s} (kane-cli ${e}).
4
4
  This is a packaging gap, not something to install locally \u2014 report it, or pass --appium-url to use an Appium server you manage yourself.`);this.coordinate=s;this.cause=n;this.name="NoPublishedBundleError"}},J=class i{deps;constructor(t={}){this.deps={...wt(),...t}}mobileRoot(){return l(this.deps.home,".testmuai","kaneai","mobile")}depsRoot(){return l(this.mobileRoot(),"deps")}classRoot(t,s){return l(this.depsRoot(),s,t)}resolveCacheFile(){return l(this.depsRoot(),"resolve-cache.json")}resolveCacheKey(t){return`${this.deps.cliVersion}|${this.deps.os}-${this.deps.arch}-${t}`}static RESOLVE_CACHE_TTL_MS=1440*60*1e3;async readCachedWantedVersion(t){try{let e=JSON.parse(await y(this.resolveCacheFile(),"utf8"))[this.resolveCacheKey(t)];if(!e?.bundleVersion||!e.fetchedAt)return null;let n=this.deps.now().getTime()-new Date(e.fetchedAt).getTime();return n>=0&&n<i.RESOLVE_CACHE_TTL_MS?e.bundleVersion:null}catch{return null}}async writeResolveCache(t,s){try{let e={};try{e=JSON.parse(await y(this.resolveCacheFile(),"utf8"))}catch{}e[this.resolveCacheKey(t)]={bundleVersion:s,fetchedAt:this.deps.now().toISOString()},await S(this.depsRoot(),{recursive:!0}),await x(this.resolveCacheFile(),`${JSON.stringify(e,null,2)}
5
5
  `)}catch{}}async warmResolveCache(t){if(await this.readCachedWantedVersion(t)===null)try{await this.resolveOrExplain(t)}catch{}}paths(t,s){let e=this.classRoot(t,s);return{root:e,appium:l(e,"appium"),appiumHome:l(e,"appium-home"),platformTools:l(e,"platform-tools"),wdaDir:l(e,"wda","Build","Products","Debug-iphonesimulator"),iwdpBinDir:l(e,"bin"),installManifest:l(e,"install-manifest.json")}}async status(t,s){s||(s=await this.readCachedWantedVersion(t)??void 0);let e=[];try{e=await O(this.depsRoot())}catch{}s&&(e=e.filter(c=>c===s));let n=null;for(let c of e){let h=this.classRoot(t,c),b=null;try{b=JSON.parse(await y(l(h,"install-manifest.json"),"utf8"))}catch{continue}b.schemaVersion===q&&(!s&&b.cliVersion!==this.deps.cliVersion||(!n||b.installedAt>n.manifest.installedAt)&&(n={manifest:b,root:h}))}if(!n)return{class:t,installed:!1};let r=this.paths(t,n.manifest.bundleVersion),o=[l(r.appium,"node_modules","appium","index.js")];t==="emulator"&&o.push(l(r.platformTools,this.deps.os==="win32"?"adb.exe":"adb")),t==="simulator"&&o.push(l(r.wdaDir,"WebDriverAgentRunner-Runner.app"));for(let c of o)if(!await A(c))return{class:t,installed:!1,version:n.manifest.bundleVersion,root:n.root,corrupt:`a bundle component is missing from disk (${X(n.root,c)})`};let a=await this.postInstallDrifted(r);return{class:t,installed:!0,version:n.manifest.bundleVersion,root:n.root,...a?{needsRepair:a}:{}}}async postInstallDrifted(t){let s=l(t.appiumHome,"node_modules",".cache","appium","extensions.yaml");if(!await A(s))return!1;let e=await y(s,"utf8");for(let n of e.split(`
6
6
  `)){let r=/^\s*installPath:\s*(.+?)\s*$/.exec(n);if(r&&!r[1].startsWith(t.appiumHome))return!0}return!1}async environment(t){let s=await this.status(t);if(!s.installed||!s.version)return{dirs:[]};let e=this.paths(t,s.version),n=[],r={dirs:n,appiumHome:e.appiumHome};return t!=="simulator"&&(n.push(e.platformTools),r.platformToolsDir=e.platformTools),n.push(l(e.appium,"node_modules",".bin")),t==="simulator"&&(n.push(e.iwdpBinDir),r.wdaDir=e.wdaDir,r.wdaRoot=l(e.root,"wda"),r.iwdpBinDir=e.iwdpBinDir),r}async ensure(t,s){let e,n;try{e=await this.resolveOrExplain(t)}catch(a){n=a}let r=await this.status(t,e?.bundleVersion);if(r.installed&&!r.needsRepair)return e&&r.version&&await this.adoptInstall(t,r.version),r;if(!e)throw n;if(r.installed&&r.needsRepair&&r.version){let a=this.paths(t,r.version);return await this.withInstallLock(async()=>{await this.postInstall(a.root,a,s.onProgress)}),await this.adoptInstall(t,r.version),this.status(t,e.bundleVersion)}let o=e;if(!s.automatic&&!s.approved)throw new j(t,o,this.classRoot(t,o.bundleVersion));return await this.withInstallLock(async()=>{(await this.status(t,o.bundleVersion)).installed||await this.install(t,o,s.onProgress)}),this.status(t,o.bundleVersion)}async adoptInstall(t,s){try{let e=this.paths(t,s).installManifest,n=JSON.parse(await y(e,"utf8"));if(n.cliVersion===this.deps.cliVersion)return;n.cliVersion=this.deps.cliVersion;let r=l(C(e),`install-manifest-${process.pid}.json`);await x(r,`${JSON.stringify(n,null,2)}
@@ -0,0 +1,6 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as bt}from"./chunk-LX2I4JEH.js";import{a as St}from"./chunk-O3HHTKZ5.js";import{a as gt,b as mt,d as ht,e as _t}from"./chunk-3GXN6VF6.js";import{F as ct,H as dt,L as at,M as ft,P as le,W as ut,a as st,b as Ie,ba as pt,f as nt,g as it,oa as X,pa as lt,r as ot,v as rt}from"./chunk-UEE3RZN4.js";import{d as pe,e as W,f as _,g,h as Ze,i as et,j as tt}from"./chunk-KU3YHPWZ.js";var Pt=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/,Lt=new Set([g.EXERCISES,g.VERIFIES,g.SCOPED_TO]),Y=n=>({record:null,errors:n,minted:{},logicalIds:{},superseded:[],warnings:[],finalizedTests:{}});function J(n){return n.toLowerCase().trim().replace(/\s+/g," ")}function yt(n,E,t,l,f){return y=>{if(!f||!W.has(String(y.kind))||!(y.kind==="unmeasurable"||l==="tests")||y.ref&&(t.scenarios??[]).some(T=>T.temp_ref===y.ref))return!0;let O=y.ref?n.resolve(y.ref):null;return!!(O&&n.nodeLabel.get(O.cid)===_.SCENARIO&&!n.superseded.has(n.tipOf(O.cid))&&n.edgesFrom(n.tipOf(O.cid)).some(T=>T.type===g.BELONGS_TO&&n.tipOf(T.dst)===E))}}function Ot(n){let E=new Set;return n.sections.scenarios?.length&&E.add(_.SCENARIO),n.sections.tests?.length&&E.add(_.TEST),n.gen8&&(n.sections.tests?.length||n.phase==="tests"&&n.gapsToMint.some(t=>W.has(String(t.kind))))&&(E.add(_.TEST),E.add(_.GAP)),E}function Et(n,E,t){let l=new Set,f=[];for(let y of E)n.superseded.has(y)||(t.has(n.nodeLabel.get(y)??"")?l.add(y):f.push(y));return{retired:l,remaining:f}}function ss(n,E){let t=n.tokenAt(E.seq),l=t===null?null:n.intentOf(t);if(l===null)return null;let f=l.args,y=l.pins.forceScope;if(l.verb!=="design"||f.forceScope==null||!Array.isArray(y)||!f.sections||!f.ucRef)return;let O=E.seq>1?n.tokenAt(E.seq-1):null;if(O===null)return null;let T=ft(n,{token:O}),F=le(T,f.ucRef);if(!F.ok)return null;let R=pe(f.templateVersion)>=8,C=(f.sections.gaps??[]).filter(yt(T,F.cid,f.sections,f.phase,R));return Et(T,y,Ot({sections:f.sections,phase:f.phase,gen8:R,gapsToMint:C})).remaining}function Ft(n,E,t={}){let l=le(n,E);if(!l.ok)return[];let f=new Set,y=new Set;for(let{cid:O}of n.byLabel(_.SCENARIO))if(!n.superseded.has(O)&&n.edgesFrom(O).some(T=>T.type===g.BELONGS_TO&&n.tipOf(T.dst)===l.cid)){f.add(O),y.add(O),y.add(n.tipOf(O));for(let T of n.edgesInto(O))T.type!==g.AUTOMATES||n.superseded.has(T.src)||f.add(T.src)}if(t.blockerGaps){let O=new Set([l.cid,n.tipOf(l.cid)]);for(let{cid:T,content:F}of n.byLabel(_.GAP)){if(n.superseded.has(T)||n.trust.get(T)==="archived"||!W.has(String(F.kind??"")))continue;let R=typeof F.uc=="string"?F.uc:"";if(!O.has(R)&&!O.has(n.tipOf(R)))continue;let C=F.ref,k=typeof C=="string"&&C?n.resolve(C):null;k&&(y.has(k.cid)||y.has(n.tipOf(k.cid)))&&f.add(T)}}return[...f]}function ns(n){let{store:E,graph:t,sections:l,by:f}=n,y=n.engine??"design@1",O=E.head(),T=E.serialize(O);if(!E.sameToken(E.parse(t.latestHash),O))return Y([{code:"STALE_BASIS",detail:`graph opened at ${String(t.latestHash)} but chain head is ${String(T)} \u2014 re-open and retry`}]);let F=le(t,n.ucRef);if(!F.ok)return Y([{code:"UNKNOWN_UC",detail:`${n.ucRef} is not a live use-case`}]);let R=F.cid,C={ucRef:R,automates:{},verifies:{},reuses:{},scope:{},depends_on:{},exercises:[],scoped_to_repoints:[],judgements:[],body_tags:{},forceScope:[]},k=[],Ae=/^design@(\d+)$/.exec(n.templateVersion??""),Q=pe(n.templateVersion)>=8,Ne=yt(t,R,l,n.phase,Q),te=(l.gaps??[]).filter(Ne),Tt=Ae!==null&&Number.parseInt(Ae[1],10)>=3,De=new Map,$t=(e,i)=>{let s=De.get(e.source_cid);if(s===void 0){let p=rt(E,t,e.source_cid);s=p?St(p.toString("utf8")):null,De.set(e.source_cid,s)}if(s===null)return k.push({code:"CITE_UNVERIFIED",detail:`${i}: source ${e.source_id} (${e.source_cid.slice(0,19)}) has no citable text to verify against`}),!1;let u=ct(t.mediaOf(e.source_cid),e,s);if(u.length>0){for(let p of u)k.push({code:"CITE_UNVERIFIED",detail:`${i}: ${p.code}: ${p.detail}`});return!1}return!0},xe=pe(n.templateVersion)>=9,kt=(e,i)=>{let s=e.source_cid?t.mediaOf(e.source_cid):void 0;if(!e.source_cid||!t.hasNode(e.source_cid)&&s==null)return{code:"CITE_SOURCE_UNKNOWN",detail:`${i}: there is no source ${e.source_id} in this store to cite \u2014 cite a source the use case reads, by its id`};if(s?.plugin?.cites_deep===!0)return null;let u=s?.format==="plugin"?`version ${e.source_cid.slice(0,19)} of ${e.source_id} was stored before its plugin allowed citations below the use case (or by a plugin that does not allow them) \u2014 re-ingest it, or cite it at the use case`:`${e.source_id} is not a source-plugin source that allows citations below the use case \u2014 cite it at the use case instead, or leave this item's cites out`;return{code:"CITE_DEPTH_UNSUPPORTED",detail:`${i}: ${u}`}},ge=(e,i,s,u,p)=>{for(let m of i??[]){if(u){let a=kt(m,`${s}.cite`);if(a){k.push(a);continue}}if(Tt&&!$t(m,`${s}.cite`))continue;let x={source_id:m.source_id,source_cid:m.source_cid,anchor:m.anchor,...m.quote?{quote:m.quote}:{}},G=Ct.one(e,x,p);if("fault"in G){k.push(G.fault);continue}B(g.DERIVES,m.source_cid,e,G.props,`${s}.cite`)}},vt=()=>xe?bt(t,R):[],P=[],M=[],N=[],me=[],re=[],w={},q={},he={},L=[],Z=[],H=[],Pe=new Set,_e=[],ce=new Set,Le=n.forceScope??(n.force?Ft(t,n.ucRef,{blockerGaps:Q}):[]);C.forceScope=[...Le];let{retired:U,remaining:Fe}=Et(t,Le,Ot({sections:l,phase:n.phase,gen8:Q,gapsToMint:te})),V=new Set,be=e=>!t.superseded.has(e)&&(!U.has(e)||V.has(e)),j=(e,i,s)=>{if(w[e])return w[e];let u=t.resolve(e),p=u?be(u.cid)?u.cid:t.tipOf(u.cid):null;return!u||!p||!be(p)?(k.push({code:"UNKNOWN_REF",detail:`${i}: '${e}' is neither in this payload nor a live committed node`}),null):s&&t.nodeLabel.get(p)!==s?(k.push({code:"ILLEGAL_EDGE",detail:`${i}: '${e}' is a ${t.nodeLabel.get(p)}, expected ${s}`}),null):p},Rt=(e,i,s,u)=>{if(t.nameOf.has(i)){q[u]=t.nameOf.get(i);return}let p=lt(e,m=>Pe.has(m),t.names.keys());p!==null&&(Pe.add(p),me.push({cid:i,slug:p,by:f}),q[u]=p)},de=(e,i,s,u)=>{for(let m of Ze(e,s))k.push({code:m.code,detail:`${i}: ${m.detail}`});let p=st(e,s);if(t.hasNode(p)&&!t.superseded.has(p))return U.has(p)&&V.add(p),w[i]=p,p;if(t.hasNode(p)&&t.superseded.has(p)){let m=X(t.nameOf.get(p)??p),x=t.tipOf(p),G=x!==p&&!t.superseded.has(x);return k.push(G?{code:"NODE_SUPERSEDED",detail:`${i}: '${u}' is ${m} as it was before it was replaced by ${X(t.nameOf.get(x)??x)} \u2014 refer to ${X(t.nameOf.get(x)??x)} to keep it, or send it changed`}:{code:"NODE_TOMBSTONED",detail:`${i}: '${u}' is ${m}, which was retired \u2014 a retired item can't come back as it was; send it changed (it is then a new item), or leave it out`}),null}return P.push({cid:p,label:e,content:s}),w[i]=p,Rt(e,p,u,i),p},Ct=it(nt(E,t)),B=(e,i,s,u,p)=>{let m=Ie(e,i,s,u);if(t.edgesFrom(i).some(d=>d.ecid===m&&!t.superseded.has(d.ecid))){e===g.AUTOMATES&&ce.add(s);return}if(t.superseded.has(m)){k.push({code:"EDGE_RETRACTED",detail:`${p}: this ${e} edge was retracted (${m}) \u2014 retraction is terminal for commits. Add a NEW relationship (different endpoint or props), redesign, or revert the retracting record`});return}if(Lt.has(e)&&t.hasNode(i)&&!t.superseded.has(i)&&t.hasNode(s)&&!t.superseded.has(s)){let d=t.displayNameOf(s);for(let c of t.edgesFrom(i))c.type!==e||c.dst===s||t.superseded.has(c.ecid)||!t.superseded.has(c.dst)||t.tipOf(c.dst)!==s||d===null||t.displayNameOf(c.dst)!==d||N.some(v=>v.kind==="edge"&&v.ecid===c.ecid)||N.push({kind:"edge",ecid:c.ecid,reason:`re-pinned onto ${s} (the same link to its live version) by ${f.id}`,by:f})}let x=t.nodeLabel.get(i)??P.find(d=>d.cid===i)?.label??"(unknown)",G=t.nodeLabel.get(s)??P.find(d=>d.cid===s)?.label??"(unknown)";for(let d of tt(e,x,G,u))k.push({code:d.code,detail:`${p}: ${d.detail}`});let a=ut(t,e,i,s,_e);if(a){k.push({code:a.code,detail:`${p}: ${a.detail}`});return}if(e===g.BELONGS_TO||e===g.SCOPED_TO){let d=dt(t,{type:e,src:i,dst:s},{pending:_e,retracted:new Set(N.flatMap(c=>c.kind==="edge"?[c.ecid]:[])),freed:new Set([...U].filter(c=>!V.has(c)))},p);if(d){k.push(d);return}}if(e===g.AUTOMATES){if(ce.has(s)){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: two automates onto ${s} in one record (strict 1:1)`});return}if(ce.add(s),!U.has(s)||V.has(s)){let d=h=>U.has(h)&&!V.has(h);if(t.edgesFrom(i).some(h=>h.type===g.AUTOMATES&&h.dst!==s&&!t.superseded.has(h.dst)&&!d(h.dst))&&t.hasNode(i)){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates from ${i} already has a live edge \u2014 supersede it first`});return}if(t.edgesInto(s).some(h=>h.type===g.AUTOMATES&&h.src!==i&&!t.superseded.has(h.src)&&!d(h.src))){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates onto ${s} already has a live edge \u2014 strict 1:1, supersede it first`});return}}}M.push({ecid:Ie(e,i,s,u),type:e,src:i,dst:s,props:u}),_e.push({src:i,dst:s,type:e})},Se=new Set;for(let e of te)e.kind==="budget-evicted"&&e.ref&&Se.add(e.ref);let K=[];for(let[e,i]of(l.gaps??[]).entries()){if(Ne(i))continue;let s=i.temp_ref??i.ref??"gap";K.push(e),L.push(`${s} not committed: a ${i.kind} gap stands in for a scenario's test \u2014 ref must be that scenario's committed id (sc-N) or its temp_ref in this payload; got ${i.ref?`'${i.ref}'`:"no ref"}`)}let Me=()=>{for(let e of te){let i=e.temp_ref??e.ref??"gap",s=e.question;if(!s||typeof s!="object"||!s.header||!Array.isArray(s.options)||s.options.length===0||!Number.isInteger(s.recommended_index)){k.push({code:"GAP_QUESTION_INCOMPLETE",detail:`${i}: design gaps carry a full ranked question object (header/options/recommended_index)`});continue}let u=e.ref?Q?w[e.ref]??e.ref:e.ref:void 0,p={kind:e.kind,question:s,derived:!0,uc:R,...e.risk?{risk:e.risk}:{},...e.risk_rationale?{risk_rationale:e.risk_rationale}:{},...e.text?{text:e.text}:{},...u?{ref:u}:{}};de(_.GAP,i,p,String(s.header))}};Q||Me();let ae=n.lineage===2,D={reuseOf:{seen:0,honored:0,linked:0,unresolved:0},byPair:0,byCriteria:0,byTitle:0},fe=[],ye={},Oe=new Map;if(ae)for(let e of l.scenarios??[]){if(typeof e.reuse_of!="string"||!e.reuse_of)continue;D.reuseOf.seen+=1;let i=t.resolve(e.reuse_of),s=i?t.superseded.has(i.cid)?t.tipOf(i.cid):i.cid:null;if(!(s!==null&&!t.superseded.has(s)&&t.nodeLabel.get(s)===_.SCENARIO&&t.edgesFrom(s).some(p=>p.type===g.BELONGS_TO&&t.tipOf(p.dst)===R))){D.reuseOf.unresolved+=1,fe.push(`${e.temp_ref}: reuse_of '${e.reuse_of}' names no scenario of this use case \u2014 saved as a new scenario`);continue}Oe.set(e.temp_ref,s),ye[e.temp_ref]=s}let Ge=new Map;for(let{cid:e,content:i}of t.byLabel(_.SCENARIO))be(e)&&t.edgesFrom(e).some(s=>s.type===g.BELONGS_TO&&t.tipOf(s.dst)===R)&&Ge.set(J(String(i.title??"")),e);for(let e of l.scenarios??[]){let i=Oe.get(e.temp_ref);if(i!==void 0&&!U.has(i))if(t.edgesInto(i).some(m=>m.type===g.AUTOMATES&&!t.superseded.has(m.ecid)&&!t.superseded.has(m.src))&&(l.tests??[]).some(m=>m.automates===e.temp_ref))fe.push(`${e.temp_ref}: reuse_of '${e.reuse_of}' names a scenario that already has its test \u2014 saved as a new scenario`);else{w[e.temp_ref]=i;let m=t.displayNameOf(i);m&&(q[e.temp_ref]=m),D.reuseOf.linked+=1;continue}let s=Ge.get(J(e.title));if(s){k.push({code:"DUPLICATE_SCENARIO",detail:`${e.temp_ref}: '${e.title}' duplicates live scenario ${t.nameOf.get(s)??s} \u2014 exercise/link it instead (reuse before minting)`});continue}let u={title:e.title,intent:e.intent,case_type:e.case_type,derived:!0,...e.technique_notes?{technique_notes:e.technique_notes}:{},...e.description?{description:e.description}:{},...e.parameters?{parameters:e.parameters}:{},...e.tags?{tags:e.tags}:{}};de(_.SCENARIO,e.temp_ref,u,e.title)}for(let e of l.scenarios??[]){let i=w[e.temp_ref];if(i){B(g.BELONGS_TO,i,R,{},e.temp_ref);for(let s of e.depends_on??[]){let u=j(s,`${e.temp_ref}.depends_on`,_.SCENARIO);u&&((C.depends_on[e.temp_ref]??=[]).push(u),B(g.DEPENDS_ON,i,u,{},`${e.temp_ref}.depends_on`))}ge(i,e.cites,e.temp_ref,!0,M)}}for(let e of l.acs??[]){let i={text:e.text,kind:e.kind,risk:e.risk,derived:!0,...e.expected_answer?{expected_answer:e.expected_answer}:{},...e.measurable!==void 0?{measurable:e.measurable}:{}},s=de(_.AC,e.temp_ref,i,e.text);if(!s)continue;let u=e.scope?.type==="scenario"&&e.scope.ref?j(e.scope.ref,`${e.temp_ref}.scope`,_.SCENARIO):R;u&&u!==R&&(C.scope[e.temp_ref]=u),u&&!t.edgesFrom(s).some(p=>p.type===g.SCOPED_TO&&!t.superseded.has(p.ecid))&&B(g.SCOPED_TO,s,u,{},`${e.temp_ref}.scope`),ge(s,e.cites,e.temp_ref,xe,M)}for(let e of l.exercises??[]){let i=j(e.scenario,"exercises.scenario",_.SCENARIO),s=j(e.ac,"exercises.ac",_.AC);!i||!s||(C.exercises.push({scenario:i,ac:s}),B(g.EXERCISES,i,s,{},`exercises ${e.scenario}\u2192${e.ac}`))}let Be=0;for(let e of l.scoped_to_repoints??[]){let i=j(e.ac,"scoped_to_repoints.ac",_.AC),s=j(e.to,"scoped_to_repoints.to");if(!i||!s)continue;C.scoped_to_repoints.push({ac:i,to:s});let u=t.edgesFrom(i).find(p=>p.type===g.SCOPED_TO&&!t.superseded.has(p.ecid));if(u&&u.dst===s){Be+=1,L.push(`scoped_to_repoints ${e.ac}: already scoped to ${e.to} \u2014 no-op`);continue}u&&N.push({kind:"edge",ecid:u.ecid,reason:`re-scoped to ${e.to} by ${f.id}`,by:f}),B(g.SCOPED_TO,i,s,{},`scoped_to_repoints ${e.ac}`)}let Ue=new Map;if(n.finalizeTestBody)for(let[e,i]of t.nameOf)Ue.set(t.tipOf(e),i);let je=e=>t.nameOf.get(e)??Ue.get(t.tipOf(e))??null,Ee=e=>{if(w[e])return w[e];let i=t.resolve(e);return i?t.names.has(e)&&!t.superseded.has(i.cid)?i.cid:t.tipOf(i.cid):null},wt=e=>{let i=Ee(e);if(!i&&n.strict)throw new Error(`UNMAPPED_REF: '${e}' resolves to nothing on this graph`);return i?w[e]?q[e]??je(i):t.names.has(e)?e:je(i):null};Q&&Me();for(let e of l.tests??[]){for(let a of e.reuses??[])Se.has(a)&&k.push({code:"REUSES_EVICTED",detail:`${e.temp_ref}: reuses '${a}' which was budget-evicted \u2014 drop the edge; the dependent gap names the missing @import`});{let a=c=>c==="emulator"||c==="simulator"?c:"web",d=c=>{let v=(l.tests??[]).find(z=>z.temp_ref===c);if(v)return a(v.target);let h=t.resolve(c),b=h?t.getNode(t.tipOf(h.cid)??h.cid)?.content:void 0;if(typeof b?.target=="string")return a(String(b.target));let I=/^\s*\[mobile:\s*(emulator|simulator)\]/m.exec(String(b?.test_md_blob??""));return I?I[1]:"web"};for(let c of e.reuses??[]){let v=a(e.target),h=d(c);v!==h&&k.push({code:"REUSES_CROSS_SURFACE",detail:`${e.temp_ref}: reuses '${c}' which runs on ${h} while this test runs on ${v} \u2014 a test imports only same-surface units`})}}let i=e.test_md_blob,s=e.definitionId,u=e.objectives_blob;if(n.finalizeTestBody){let a;try{a=n.finalizeTestBody({temp_ref:e.temp_ref,test_md_blob:e.test_md_blob,verifies:e.verifies,reuses:e.reuses??[]},wt)}catch(d){return Y([{code:"FINALIZE_BODY",detail:`${e.temp_ref}: ${d instanceof Error?d.message:String(d)}`}])}a&&(i=a.test_md_blob,s=a.definitionId,u=a.objectives_blob??u,he[e.temp_ref]=s)}let p={title:e.title,check:e.check,definitionId:s,derived:!0,...e.config?{config:e.config}:{},...i?{test_md_blob:i}:{},...u?{objectives_blob:u}:{},...e.surface_required!==void 0?{surface_required:e.surface_required}:{},...e.target?{target:e.target}:{},...e.app&&e.target?{app:e.app}:{}},m=de(_.TEST,e.temp_ref,p,e.title);if(!m)continue;ge(m,e.cites,e.temp_ref,!0,M);let x=j(e.automates,`${e.temp_ref}.automates`,_.SCENARIO);x&&(C.automates[e.temp_ref]=x,B(g.AUTOMATES,m,x,{},`${e.temp_ref}.automates`)),C.verifies[e.temp_ref]=[];for(let a of e.verifies){let d=j(a,`${e.temp_ref}.verifies`,_.AC);d&&(C.verifies[e.temp_ref].push(d),B(g.VERIFIES,m,d,{},`${e.temp_ref}.verifies`))}C.reuses[e.temp_ref]=[];for(let a of e.reuses??[]){if(Se.has(a))continue;let d=j(a,`${e.temp_ref}.reuses`,_.TEST);d&&(C.reuses[e.temp_ref].push(d),B(g.REUSES,m,d,{},`${e.temp_ref}.reuses`))}for(let a of e.verifies){let d=Ee(a)??void 0;d&&(t.trust.get(d)??"derived")==="derived"&&!P.some(c=>c.cid===d)?(L.push(`${e.temp_ref}: verifies ${a} which is still DERIVED (unapproved) \u2014 committed anyway; approve it in chat or via review`),Z.push({test:e.temp_ref,criterion:d})):d&&w[a]===d&&(l.acs??[]).some(c=>c.temp_ref===a)&&(L.push(`${e.temp_ref}: verifies ${a} minted in this same record (unapproved) \u2014 committed anyway; approve it in chat`),Z.push({test:e.temp_ref,criterion:d}))}if(!String(e.test_md_blob??"").split(`
3
+ `).some(a=>/^##\s/.test(a)&&!/—\s?assert/.test(a)&&Pt.test(a))&&e.verifies.length>1){let a=e.check?.verified_against;L.push(`${e.temp_ref}: verifies ${e.verifies.length} ACs but machine-asserts only 1 (check.verified_against=${a!=null?String(a):"?"}) \u2014 the rest ride prose only`)}}let se=[];for(let e of l.tests??[]){let i={};for(let s of Gt(e.test_md_blob,e.objectives_blob)){let u=Ee(s);u?i[s]=u:se.push(`${e.temp_ref}: body tag '${s}' resolves to nothing`)}C.body_tags[e.temp_ref]=i,se.push(...Mt(e.temp_ref,i,[...C.verifies[e.temp_ref]??[],...C.reuses[e.temp_ref]??[]]))}if(se.length>0){if(n.strict)return Y(se.map(e=>({code:"BODY_EDGE_MISMATCH",detail:e})));L.push(...se.map(e=>`integrity: ${e}`))}let ee=[];{let e=(a,d)=>`${a??""}\0${J(String(d??""))}`,i=(a,d)=>n.reason?`${n.reason} \u2014 evolve by ${f.id}${d?` (${d})`:""}`:a,s=a=>t.edgesFrom(a).some(d=>d.type!==g.SCOPED_TO?!1:d.dst===R||t.tipOf(d.dst)===R?!0:t.nodeLabel.get(d.dst)===_.SCENARIO&&t.edgesFrom(d.dst).some(c=>c.type===g.BELONGS_TO&&t.tipOf(c.dst)===R)),u=new Map;for(let{cid:a,content:d}of t.byLabel(_.AC)){if(t.superseded.has(a)||!s(a))continue;let c=J(String(d.text??""));u.set(c,[...u.get(c)??[],a])}let p=new Map;for(let a of P){if(a.label!==_.AC)continue;let d=J(String(a.content.text??""));p.set(d,[...p.get(d)??[],a.cid])}let m=[];for(let[a,d]of u){let c=p.get(a)??[];d.length!==1||c.length!==1||m.push([d[0],c[0]])}if(ae){let a=new Map(m),d=[...U].filter(o=>!V.has(o)),c=new Map,v=new Set,h=(o,r,S)=>{c.set(o,{cid:r,tag:S}),v.add(r)},b=(o,r)=>{let S=new Map;for(let A of o){let oe=r(A);oe&&S.set(oe,[...S.get(oe)??[],A])}return S},I=(o,r,S)=>{let A=0;for(let[oe,Je]of o){let Qe=r.get(oe)??[];Je.length===1&&Qe.length===1&&(h(Je[0],Qe[0],S),A+=1)}return A},z=new Map,$e=new Set;for(let[o,r]of Oe){let S=w[o];!U.has(r)||V.has(r)||!S||!P.some(A=>A.cid===S)||($e.add(S),z.set(r,[...z.get(r)??[],S]))}let $=new Set,It=o=>J(String(P.find(r=>r.cid===o)?.content.title??""));for(let[o,r]of z){if(r.length===1){h(o,r[0],"reuse_of successor"),D.reuseOf.honored+=1;continue}$.add(o);let S=r.filter(A=>It(A)===J(String(t.getNode(o)?.content.title??"")));S.length===1&&(h(o,S[0],"title-matched successor"),D.byTitle+=1)}let ke=o=>d.filter(r=>t.nodeLabel.get(r)===o&&!c.has(r)&&!$.has(r)),ve=o=>P.filter(r=>r.label===o&&!v.has(r.cid)&&!$e.has(r.cid)).map(r=>r.cid),ze=o=>[...new Set(o.map(r=>a.get(t.tipOf(r))??t.tipOf(r)))].sort().join(`
4
+ `),At=o=>t.edgesFrom(o).filter(r=>r.type===g.EXERCISES&&!t.superseded.has(r.ecid)).map(r=>r.dst),Nt=o=>M.filter(r=>r.type===g.EXERCISES&&r.src===o).map(r=>r.dst);D.byCriteria+=I(b(ke(_.SCENARIO),o=>ze(At(o))),b(ve(_.SCENARIO),o=>ze(Nt(o))),"same-criteria successor");let He=(o,r)=>e(t.nodeLabel.get(o)??P.find(S=>S.cid===o)?.label,(r??t.getNode(o)?.content)?.title),Re=new Map(P.map(o=>[o.cid,o.content])),Ke=o=>I(b(ke(o),r=>He(r)),b(ve(o),r=>He(r,Re.get(r))),"title-matched successor");D.byTitle+=Ke(_.SCENARIO);let Dt=o=>{let r=t.edgesFrom(o).find(A=>A.type===g.AUTOMATES&&!t.superseded.has(A.ecid));if(!r)return"";let S=t.tipOf(r.dst);return c.get(r.dst)?.cid??c.get(S)?.cid??S};D.byPair+=I(b(ke(_.TEST),Dt),b(ve(_.TEST),o=>M.find(r=>r.type===g.AUTOMATES&&r.src===o)?.dst??""),"paired test successor"),D.byTitle+=Ke(_.TEST);let Ce=new Set(d),ue=o=>{let r=c.get(o)?.cid??c.get(t.tipOf(o))?.cid??t.tipOf(o);return t.superseded.has(r)&&!Re.has(r)||Ce.has(r)&&!c.has(r)?null:r},we=new Set;for(let o of M)o.type===g.AUTOMATES&&Re.has(o.src)&&we.add(ue(o.dst)??o.dst);for(let{cid:o}of t.byLabel(_.TEST))if(!(t.superseded.has(o)||Ce.has(o)))for(let r of t.edgesFrom(o))r.type===g.AUTOMATES&&!t.superseded.has(r.ecid)&&we.add(ue(r.dst)??r.dst);let xt=!l.tests?.length&&te.some(o=>W.has(String(o.kind))),We=new Set,Xe=o=>{if(typeof o!="string"||!o)return;let r=w[o]??t.resolve(o)?.cid,S=r?ue(r):null;S!==null&&We.add(S)};for(let o of te)W.has(String(o.kind))&&Xe(o.ref);for(let{cid:o,content:r}of t.byLabel(_.GAP))t.superseded.has(o)||Ce.has(o)||t.trust.get(o)==="archived"||W.has(String(r.kind??""))&&Xe(r.ref);let ie=new Map,Ye=new Set;for(let o of xt?[]:d){if(t.nodeLabel.get(o)!==_.TEST||c.has(o))continue;let r=t.edgesFrom(o).find(A=>A.type===g.AUTOMATES&&!t.superseded.has(A.ecid)),S=r?ue(r.dst):null;!r||S===null||we.has(S)||Ye.has(S)||We.has(S)||(ie.set(o,{edge:r,scenario:S}),Ye.add(S))}for(let o of d){if(ie.has(o))continue;let r=c.get(o);r?(N.push({kind:"node",old:o,new:r.cid,reason:i(`--force redesign of ${n.ucRef} by ${f.id} (${r.tag})`,r.tag),by:f}),ee.push({old:o,next:r.cid})):N.push({kind:"node",old:o,new:null,reason:i(`--force redesign of ${n.ucRef} by ${f.id}`),by:f}),H.push(o)}for(let[o,{edge:r,scenario:S}]of ie)r.dst===S||ee.some(A=>A.old===r.dst)||(N.push({kind:"edge",ecid:r.ecid,reason:`re-blessed onto ${S} (its test kept by the redesign of ${n.ucRef}) by ${f.id}`,by:f}),B(g.AUTOMATES,o,S,r.props,`keep ${t.nameOf.get(o)??o}`));ie.size>0&&(D.keptTests=ie.size)}else{let a=new Map;for(let c of P){if(c.label!==_.SCENARIO&&c.label!==_.TEST)continue;let v=e(c.label,c.content.title);a.set(v,[...a.get(v)??[],c.cid])}let d=new Map;for(let c of U){if(V.has(c))continue;let v=e(t.nodeLabel.get(c),t.getNode(c)?.content.title);d.set(v,[...d.get(v)??[],c])}for(let[c,v]of d){let h=a.get(c)??[],b=v.length===1&&h.length===1;for(let I of v)b?(N.push({kind:"node",old:I,new:h[0],reason:i(`--force redesign of ${n.ucRef} by ${f.id} (title-matched successor)`,"title-matched successor"),by:f}),ee.push({old:I,next:h[0]})):N.push({kind:"node",old:I,new:null,reason:i(`--force redesign of ${n.ucRef} by ${f.id}`),by:f}),H.push(I)}}for(let[a,d]of m)N.push({kind:"node",old:a,new:d,reason:i(`AC re-emitted with changed content by ${f.id} (text-matched successor)`,"AC text-matched successor"),by:f}),ee.push({old:a,next:d}),H.push(a);if(n.force||n.forceScope){let a=new Set(H),d=new Map(ee.map(b=>[b.old,b.next])),c=new Set(P.map(b=>b.cid)),v=b=>{if(c.has(b))return!0;let I=d.get(b)??t.tipOf(b);return c.has(I)||!t.superseded.has(I)&&!a.has(I)},h=new Set(N.flatMap(b=>b.kind==="edge"?[b.ecid]:[]));for(let{cid:b}of t.byLabel(_.AC)){if(t.superseded.has(b)||a.has(b)||!s(b))continue;let I=t.edgesFrom(b).filter($=>$.type===g.SCOPED_TO&&!t.superseded.has($.ecid)&&!h.has($.ecid)).map($=>$.dst);if(I.length===0||I.some(v))continue;let z=I.map($=>t.nameOf.get($)??t.nameOf.get(t.tipOf($))??$).join(", ");if([...t.edgesInto(b).filter($=>($.type===g.EXERCISES||$.type===g.VERIFIES)&&!t.superseded.has($.ecid)&&!h.has($.ecid)).map($=>$.src),...M.filter($=>($.type===g.EXERCISES||$.type===g.VERIFIES)&&$.dst===b).map($=>$.src)].some($=>v($))){L.push(`ORPHANED_CRITERION: ${X(t.nameOf.get(b)??b)} is scoped to ${z}, which is retired, and a live scenario or test still rests on it \u2014 kept; re-scope it (scoped_to_repoints) to the scenario or use case it belongs to`);continue}N.push({kind:"node",old:b,new:null,reason:i(`orphaned: its scenario ${z} was retired; retired with it by the redesign of ${n.ucRef} (${f.id})`,"orphaned criterion"),by:f}),H.push(b)}}let x=new Set(H),G=new Set;for(let a of N)a.kind==="edge"&&G.add(a.ecid);for(let{old:a,next:d}of ee)for(let c of t.edgesInto(a))et(c.type)?.pin?.comparesTo!=="dst_tip"||t.superseded.has(c.src)||x.has(c.src)||G.has(c.ecid)||(N.push({kind:"edge",ecid:c.ecid,reason:`re-blessed onto ${d} (redirect successor of ${a}) by ${f.id}`,by:f}),G.add(c.ecid),M.some(h=>h.type===c.type&&h.src===c.src&&h.dst===d)||t.edgesFrom(c.src).some(h=>h.type===c.type&&h.dst===d))||c.type===g.AUTOMATES&&ce.has(d)||B(c.type,c.src,d,c.props,`rebless ${c.type} from ${t.nameOf.get(c.src)??c.src}`)}let ne=vt();if(ne.length>0){let e=s=>[...M.filter(u=>u.dst===s),...t.edgesInto(s).filter(u=>!t.superseded.has(u.ecid))].some(u=>u.type===g.DERIVES&&ne.includes(String(u.props.source_id))),i=[...(l.scenarios??[]).map(s=>({label:"scenario",temp_ref:s.temp_ref,title:s.title})),...(l.tests??[]).map(s=>({label:"test",temp_ref:s.temp_ref,title:s.title}))];for(let s of i){let u=w[s.temp_ref];!u||e(u)||L.push(`CITE_MISSING: ${s.label} ${X(q[s.temp_ref]??t.nameOf.get(u)??s.temp_ref)} "${s.title}" cites nothing of ${ne.join(", ")}, whose plugin asks each scenario and test to cite what it rests on \u2014 committed anyway; cite its screens and flows so a change to them marks exactly this ${s.label} stale`)}}if(ne.length>0)for(let e of n.droppedCriterionCites??[]){let i=w[e.temp_ref],s=X(q[e.temp_ref]??(i?t.nameOf.get(i):void 0)??e.temp_ref);L.push(`CITE_DROPPED: criterion ${s} \u2014 a cite was dropped: ${e.why}; the criterion is committed without it. A criterion cites only into ${ne.join(", ")}, whose plugin asks each item to cite what it rests on`)}if(k.length>0)return Y(k);let qe=ae&&(D.reuseOf.seen>0||D.byPair+D.byCriteria+D.byTitle+(D.keptTests??0)>0)?{lineage:D}:{},Ve=fe.length?{modelWarnings:fe}:{};if(P.length===0&&M.length===0&&N.length===0&&re.length===0)return Object.keys(w).length>0||Be>0?(L.push("everything in this phase is already current \u2014 nothing re-committed"),{record:null,errors:null,minted:w,logicalIds:q,superseded:[],warnings:L,finalizedTests:he,unchanged:!0,...K.length?{droppedBlockers:K}:{},...Z.length?{awaitingApproval:Z}:{},...qe,...Ve,...n.force||n.forceScope?{forceScopeRemaining:Fe}:{}}):{...Y([{code:"EMPTY_DESIGN",detail:"finalize_design produced nothing to commit"}]),warnings:L,...K.length?{droppedBlockers:K}:{}};if(n.generationTicket){let e=ht(t,n.generationTicket);if(e!==null)return Y([e])}let Te=n.eventIds&&n.eventIds.length>0?n.eventIds:n.sid?pt(t,n.sid,"design",1):null;return{record:at(E,{ts:new Date().toISOString(),proposal_id:null,nodes:P,edges:M,review:[],supersessions:N,source_head_moves:{},...me.length>0?{names:me}:{},...(()=>{for(let e of l.judgements??[]){let i=e.target?w[e.target]??t.resolve(e.target)?.tip??R:R;C.judgements.push(i),re.push({about:i,rationale:`[${e.kind}] ${e.rationale}`,by:f})}return re.length>0?{judgements:re}:{}})(),design_of:{uc_cid:R,engine:y},...n.generationTicket?{design_generation:_t(n.generationTicket,R,f)}:{},...Te?{event_ids:Te}:{},...n.sid?{sid:n.sid}:{},...n.phase?{design_phase:{uc_root:gt(t,t.resolve(n.ucRef)?.cid??R),generation:n.generationTicket?.next_gen??mt(t,n.ucRef)?.gen??1,phase:n.phase,completeness:n.phaseCompleteness??"complete",...n.payloadDigest?{payload_digest:n.payloadDigest}:{}}}:{}},{graph:t,scope:{ucTargets:[{ref:R}],...n.generationTicket?{generationTicket:{uc_root:n.generationTicket.uc_root,next_gen:n.generationTicket.next_gen}}:{}},expectPrev:t.latestHash,intent:{v:1,verb:"design",args:ot({ucRef:n.ucRef,sections:l,by:f,engine:y,force:n.force??!1,forceScope:n.forceScope??null,reason:n.reason??null,generationTicket:n.generationTicket??null,templateVersion:n.templateVersion??null,phase:n.phase??null,phaseCompleteness:n.phaseCompleteness??null,eventIds:Te,sid:n.sid??null,...ae?{lineage:2}:{}}),pins:Object.keys(ye).length?{...C,reuse_of:ye}:C},provenance:n.provenance}).record,errors:null,minted:w,logicalIds:q,superseded:H,warnings:L,finalizedTests:he,...K.length?{droppedBlockers:K}:{},...Z.length?{awaitingApproval:Z}:{},...n.force||n.forceScope?{forceScopeRemaining:Fe}:{},...qe,...Ve}}function Mt(n,E,t){let l=new Set(Object.values(E));if(l.size===0)return[];let f=new Set(t),y=[];for(let[O,T]of Object.entries(E))f.has(T)||y.push(`${n}: body tag '${O}' has no verifies or reuses edge`);for(let O of f)l.has(O)||y.push(`${n}: edge to ${O} has no body tag`);return y}function Gt(n,E){let t=[];for(let f of(n??"").split(`
5
+ `)){let y=/^##\s.*?\s@verifies\s+(.+?)\s*$/.exec(f);y&&t.push(...y[1].split(",").map(T=>T.trim()).filter(Boolean));let O=/^@import\s+(\S+)\s*$/.exec(f.trim())??/^## Import: (\S+)\s*$/.exec(f);O&&t.push(O[1])}let l=null;for(let f of(E??"").split(`
6
+ `)){let y=/^\s*verifies:\s*\[(.*)\]\s*$/.exec(f);if(y){t.push(...y[1].split(",").map(F=>F.trim()).filter(Boolean)),l=null;continue}let O=/^(\s*)verifies:\s*$/.exec(f);if(O){l=O[1].length;continue}let T=l!==null?/^(\s*)-\s+(\S+)\s*$/.exec(f):null;T&&T[1].length>=l?t.push(T[2]):l=null}return t}function is(n,E){let t=[];for(let l of n){let f=l.design_phase;!f||typeof f!="object"||f.uc_root===E&&(typeof f.phase!="string"||typeof f.generation!="number"||t.push({phase:f.phase,generation:f.generation,seq:l.seq,completeness:f.completeness==="partial"?"partial":"complete"}))}return t.sort((l,f)=>l.seq-f.seq)}export{yt as a,Ot as b,Et as c,ss as d,Ft as e,ns as f,is as g};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{g as U,i as x}from"./chunk-KU3YHPWZ.js";import{a as N,b as y}from"./chunk-7V4BQSSV.js";var M=/^[a-z][a-z0-9-]{1,31}$/,T=/^[A-Za-z0-9][A-Za-z0-9._:/#-]{0,199}$/,E=/^[A-Za-z0-9+/=:_-]{8,128}$/,_="~rest",p={contentBytes:26214400,textBytes:5e6,units:2e4,unitIndexBytes:2097152,reasonChars:200,reasonsBytes:51200,explainMs:12e4,cursorBytes:1024,contextNotes:20,contextTitleChars:120,contextNoteBytes:8192,contextBytes:65536,coverageGroups:200,coverageGroupNameChars:120,coverageBytes:1048576,hookMs:12e4,chainSteps:256,reconfirms:256};function L(n,e){let r=e(n);if(r===void 0)return null;let u=new Map([[n,0]]),o=new Map;for(let f=1;f<=p.chainSteps;f++){let i=r?.changes;if(i==null||typeof i.from!="string"||u.has(i.from))break;u.set(i.from,f);for(let t of[i.changed,i.removed])for(let s of Array.isArray(t)?t:[])o.has(s)||o.set(s,f);r=e(i.from)}return{distance:u,touchedAt:o,hasIndex:f=>e(f)?.index!==void 0}}var b=n=>Array.isArray(n)&&n.length>0?n:null;function A(n,e){let{stale:r,failing:u}=O(n,e);return{stale:r,failing:u}}function O(n,e){let r=a=>e.distance.get(a.props.source_cid)??1/0,u=1/0;for(let a of n)u=Math.min(u,r(a));let o=new Map,f=[],i=new Set,t=!1;for(let a of n){let l=r(a),d=b(a.props.units);if(d===null){(e.hasIndex(a.props.source_cid)||l!==0&&!(u<l))&&(t=!0,i.add(a));continue}let g=l===0||l!==1/0&&d.every(h=>(e.touchedAt.get(h)??1/0)>l),I=[...d,...b(a.props.reconfirms)??[]];f.push({edge:a,distance:l,passes:g,speaksFor:I});for(let h of I){let m=o.get(h);m===void 0||l<m.distance?o.set(h,{distance:l,passes:g}):l===m.distance&&!g&&(m.passes=!1)}}let s=[...o].filter(([,a])=>!a.passes).map(([a])=>a).sort();for(let a of f)!a.passes&&a.speaksFor.some(l=>o.get(l).distance===a.distance&&!o.get(l).passes)&&i.add(a.edge);return{stale:t||s.length>0,failing:s,failed:n.filter(a=>i.has(a))}}function D(n,e,r){if(e.superseded(n))return"superseded";let u=e.outgoing.some(t=>x(t.type)?.pin?.comparesTo==="dst_tip"&&e.superseded(t.dst));if(e.incomingDerives.length===0)return u?"stale":"fresh";let o=new Map;for(let t of e.incomingDerives)o.set(t.props.source_id,t);let f=!1,i=!1;for(let[t,s]of o){let a=e.headOf(t);if(a==null)continue;f=!0;let l=r?.(t,a)??null;if(l!==null){A(e.incomingDerives.filter(d=>d.props.source_id===t),l).stale&&(i=!0);continue}if(a!==s.props.source_cid){let d=e.convChain(t);(!d||!d.includes(s.props.source_cid))&&(i=!0)}}return f?i||u?"stale":"fresh":"orphaned"}function k(n,e){return{superseded:r=>e.supersededBy(r)!==void 0,incomingDerives:e.edgesInto(n).filter(r=>r.type===U.DERIVES),outgoing:e.edgesFrom(n),headOf:r=>e.headOf(r),convChain:r=>e.convChain(r)}}function F(n){let e=n.pluginOf?.bind(n);if(e===void 0)return;let r=new Map;return(u,o)=>{let f=r.get(o);return f===void 0&&r.set(o,f=L(o,e)),f}}function z(n){let e=F(n);return r=>D(r,k(r,n),e)}var C=n=>n.replace(/\n$/,"").split(`
3
+ `),S=n=>"sha256:"+y(Buffer.from(n.join(`
4
+ `),"utf8")),c=(n,e,r,u)=>({ok:!1,fault:{code:n,detail:e,...r===void 0?{}:{at:r},...u===void 0?{}:{unit:u}}});function q(n,e){if(!Array.isArray(n))return c("UNIT_LIST_INVALID","the unit list is not a list");if(n.length>p.units)return c("UNIT_COUNT_OVER_LIMIT",`${n.length} units, the limit is ${p.units}`);let r=C(e),u=new Set,o=[],f=0;for(let i=0;i<n.length;i++){let t=n[i];if(typeof t!="object"||t===null||Array.isArray(t))return c("UNIT_LIST_INVALID",`entry ${i} is not a unit`,i);let s=t.id;if(s===_)return c("UNIT_ID_RESERVED",`${_} is the core's own unit`,i,s);if(typeof s!="string"||!T.test(s))return c("UNIT_ID_INVALID",`entry ${i} has an id a unit may not have: ${JSON.stringify(s)}`,i);if(u.has(s))return c("UNIT_ID_DUPLICATE",`${s} is listed twice`,i,s);u.add(s);let a=t.lines;if(!Array.isArray(a)||a.length!==2||!Number.isInteger(a[0])||!Number.isInteger(a[1])||a[0]<1||a[1]<a[0])return c("UNIT_LINES_INVALID",`${s}: lines must be [first, last], whole numbers from 1, first not after last`,i,s);let[l,d]=a;if(d>r.length)return c("UNIT_LINES_OUTSIDE_TEXT",`${s}: lines ${l} to ${d}, the text has ${r.length}`,i,s);if(l<=f){let g=o.some(I=>l<=I.lines[1]&&d>=I.lines[0]);return c(g?"UNIT_LINES_OVERLAP":"UNIT_ORDER",g?`${s}: its lines are shared with another unit`:`${s}: the list is not in line order`,i,s)}if(f=d,typeof t.fingerprint!="string"||t.fingerprint==="")return c("UNIT_FINGERPRINT_MISSING",`${s} has no fingerprint`,i,s);if(!E.test(t.fingerprint))return c("UNIT_FINGERPRINT_INVALID",`${s}: a fingerprint is 8 to 128 characters of letters, digits and + / = : _ -`,i,s);for(let g of["ref","kind","label"])if(t[g]!==void 0&&(typeof t[g]!="string"||t[g]===""))return c("UNIT_LIST_INVALID",`${s}: ${g} must be text when given`,i,s);if(t.ref!==void 0&&!r.slice(l-1,d).some(g=>g.includes(t.ref)))return c("UNIT_REF_NOT_IN_LINES",`${s}: its ref ${JSON.stringify(t.ref)} does not appear in its own lines`,i,s);o.push({id:s,lines:[l,d],fingerprint:t.fingerprint,...t.ref!==void 0?{ref:t.ref}:{},...t.kind!==void 0?{kind:t.kind}:{},...t.label!==void 0?{label:t.label}:{}})}return{ok:!0,units:o}}function H(n,e,r,u){let o=C(u),f=r.map(s=>({id:s.id,lines:[s.lines[0],s.lines[1]],fingerprint:s.fingerprint,text:S(o.slice(s.lines[0]-1,s.lines[1])),...s.ref!==void 0?{ref:s.ref}:{},...s.kind!==void 0?{kind:s.kind}:{},...s.label!==void 0?{label:s.label}:{}})),i=[],t=1;for(let s of r)s.lines[0]>t&&i.push([t,s.lines[0]-1]),t=s.lines[1]+1;if(t<=o.length&&i.push([t,o.length]),i.length>0){let s=S(i.flatMap(([a,l])=>o.slice(a-1,l)));f.push({id:_,segments:i,fingerprint:s,text:s})}return{v:1,plugin:n,rules:e,units:f}}function K(n){let e=Buffer.from(N(n),"utf8");return e.byteLength>p.unitIndexBytes?c("UNIT_INDEX_TOO_LARGE",`the unit index is ${e.byteLength} bytes, the limit is ${p.unitIndexBytes}`):{ok:!0,bytes:e}}function W(n){if(n===null)return null;try{let e=JSON.parse(Buffer.from(n).toString("utf8"));return typeof e!="object"||e===null||e.v!==1||typeof e.plugin!="string"||typeof e.rules!="string"||!Array.isArray(e.units)||!e.units.every(r=>typeof r=="object"&&r!==null&&typeof r.id=="string"&&typeof r.fingerprint=="string")?null:e}catch{return null}}function Q(n,e,r){let u=([o,f])=>o<=r&&f>=e;return n.units.filter(o=>o.lines!==void 0?u(o.lines):(o.segments??[]).some(u)).map(o=>o.id)}function Y(n,e){let r=new Map(n.units.map(t=>[t.id,t.fingerprint])),u=new Map(e.units.map(t=>[t.id,t.fingerprint])),o=[],f=[],i=[];for(let[t,s]of r)u.has(t)?u.get(t)!==s&&o.push(t):f.push(t);for(let t of u.keys())r.has(t)||i.push(t);return{changed:o.sort(),removed:f.sort(),added:i.sort()}}var $=/\u001b\[[0-?]*[ -\/]*[@-~]|\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)?|\u001b[@-Z\\-_]/g,w=/[\t\n\v\f\r\u0085\u2028\u2029]+/g,v=/[\u0000-\u001f\u007f-\u009f]/g,P=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;function R(n){if(typeof n!="string")return null;let e=n.replace($,"").replace(w," ").replace(v,"").replace(P,"").replace(/ {2,}/g," ").trim();return e===""?null:e}var B=n=>typeof n=="string"&&n.length<=p.reasonChars&&R(n)===n;function tn(n){let e=R(n);return e===null?null:`"${e.replace(/["\u201c\u201d]/g,"'")}"`}function sn(n,e){if(typeof n!="object"||n===null||Array.isArray(n))return"has reasons that are not an object";let r=Object.entries(n);if(r.length===0)return"has an empty reasons object";let u=0;for(let[o,f]of r){if(!e.includes(o))return`has a reason for ${JSON.stringify(o)}, which is not one of its changed units`;if(!B(f))return`has a reason for ${JSON.stringify(o)} that is not one line of at most ${p.reasonChars} characters with no control character`;u+=Buffer.byteLength(f,"utf8")}return u>p.reasonsBytes?`has reasons of ${u} bytes in all, the limit is ${p.reasonsBytes}`:null}export{M as a,T as b,_ as c,p as d,L as e,A as f,O as g,F as h,z as i,C as j,q as k,H as l,K as m,W as n,Q as o,Y as p,R as q,tn as r,sn as s};
@@ -0,0 +1,34 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{c as A,d as C}from"./chunk-T4AVLJCW.js";import{e as x}from"./chunk-5D7ENQTQ.js";import{b,e as R}from"./chunk-RFIIM33J.js";import{f as D,h as S,l as E}from"./chunk-NFRA64NU.js";import{b as I,c as _,g as N,h as k}from"./chunk-Y6Y6RAY4.js";import{b as h}from"./chunk-SA6IKFFD.js";import{a as v}from"./chunk-MGNRNLBE.js";import{h as y}from"./chunk-A7RJQJNT.js";import{mkdirSync as H,writeFileSync as q}from"fs";import{join as z}from"path";function P(e,t=process.env){return t.KANE_MOBILE_APP_BASE_URL||v(e).mobileAppBaseUrl}var J="device-config.json",$=new WeakMap;function G(e,t){let r=$.get(e)??new Map;$.set(e,r);let o=JSON.stringify([t.path,t.type,t.env,t.orgId]),i=r.get(o);if(i)return i;let n=e(t).finally(()=>r.delete(o));return r.set(o,n),n}function T(e){return e.startsWith("lt://")?e:`lt://${e}`}async function X(e,t){let r=await E(e.env,e.platform,{...e.selection.deviceName?{deviceName:e.selection.deviceName.value}:{},...e.selection.osVersion?{osVersion:e.selection.osVersion.value}:{}},t);if(r.kind==="unchecked"&&e.onWarning?.(`${r.reason} \u2014 the run continues, but the device and OS version are not checked before the session is requested.`),r.kind==="refused")throw new Error(r.detail)}async function Y(e,t){let r=e.selection.app.value.trim();if(h(r))return T(r);let o=e.credentials;if(!o?.orgId)throw new Error(`${r} has to be uploaded before it can run on a real device, but your account's org id was not found. Run kane-cli login, or set app: to an app ID from \`kane-cli apps list --target ${e.platform}\`.`);let i=await G(t,{path:r,type:e.platform,env:e.env,orgId:o.orgId,userId:o.userId??"",auth:{username:o.username,accessKey:o.accessKey,orgId:o.orgId},baseUrl:P(e.env),...e.onProgress?{onProgress:e.onProgress}:{}});if(b(i))throw new Error(`could not upload ${r} for this real-device run: ${i.reason}`);return T(i.appUrl??i.appId)}async function U(e,t={}){if(!e.credentials)throw new Error("a real-device run needs your TestMu AI username and access key, and none were found. Run kane-cli login, or pass --username and --access-key.");await X(e,t.fetchCatalog??S);let r=await Y(e,t.upload??R),{deviceName:o,osVersion:i}=e.selection,n={platform_name:e.platform,device_name:o?.value??D,...i?{platform_version:i.value}:{},app:r,...e.testName?{test_name:e.testName}:{},...e.tcId?{"tms.tc_id":e.tcId}:{},...e.capabilities},s=z(e.outDir,J);return H(e.outDir,{recursive:!0}),q(s,`${JSON.stringify(n,null,2)}
3
+ `),{device:{platform:e.platform,target:e.platform,device_config_path:s},...o?{deviceName:o.value}:{},...i?{osVersion:i.value}:{},app:r}}import{createServer as Q}from"http";import{randomBytes as Z}from"crypto";import{spawn as ee}from"child_process";import{mkdtempSync as re,readdirSync as te,readFileSync as oe,rmSync as ie,writeFileSync as ne}from"fs";import{tmpdir as W}from"os";import{join as w}from"path";function M(e,t,r,o){let i=Buffer.from(`${o.username}:${o.accessKey}`).toString("base64"),n=new URLSearchParams({session:r,auth:i});return t==="ios"&&n.set("mode","webrtc"),`${e.replace(/\/+$/,"")}/?${n.toString()}`}function V(e){return e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`)}function ae(e){return`<!doctype html>
4
+ <html lang="en">
5
+ <head>
6
+ <meta charset="utf-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <title>${V(e.title)}</title>
9
+ <style>
10
+ html, body { margin: 0; height: 100%; background: #111; font-family: system-ui, sans-serif; }
11
+ iframe { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; }
12
+ #guard { position: fixed; inset: 0; cursor: not-allowed; background: transparent; }
13
+ #badge, #ended { position: fixed; left: 50%; transform: translateX(-50%); padding: 6px 12px;
14
+ border-radius: 999px; font-size: 13px; color: #fff; background: rgba(0, 0, 0, 0.7); }
15
+ #badge { bottom: 16px; }
16
+ #ended { top: 16px; display: none; background: #b42318; }
17
+ </style>
18
+ </head>
19
+ <body>
20
+ <iframe src="${V(e.streamUrl)}" allow="autoplay; fullscreen"></iframe>
21
+ ${e.viewOnly?'<div id="guard"></div>':""}
22
+ <div id="badge">View only \u2014 the test is driving this device</div>
23
+ <div id="ended">The session ended</div>
24
+ <script>
25
+ // kane-cli answers while the run lives; once it stops, say so.
26
+ setInterval(() => {
27
+ fetch(location.pathname + "/alive", { cache: "no-store" })
28
+ .then((r) => { if (!r.ok) throw new Error(); })
29
+ .catch(() => { document.getElementById("ended").style.display = "block"; });
30
+ }, 3000);
31
+ </script>
32
+ </body>
33
+ </html>
34
+ `}async function O(e){let t=`/${Z(16).toString("hex")}`,r=ae(e),o=Q((s,a)=>{if(s.url===t){a.writeHead(200,{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}),a.end(r);return}if(s.url===`${t}/alive`){a.writeHead(204),a.end();return}a.writeHead(404),a.end()});await new Promise((s,a)=>{o.once("error",a),o.listen(0,"127.0.0.1",()=>s())}),o.unref();let i=o.address();return{url:`http://127.0.0.1:${typeof i=="object"&&i?i.port:0}${t}`,close:()=>o.close()}}function B(e){let r=e?.width,o=e?.height;return!r||!o?{width:400,height:820}:{width:Math.min(1200,Math.max(320,Math.round(820*r/o))),height:820}}function se(e,t,r){return[`--app=${e}`,`--user-data-dir=${t}`,`--window-size=${r.width},${r.height}`,"--no-first-run","--no-default-browser-check","--autoplay-policy=no-user-gesture-required"]}var ce=3e3;async function j(e,t,r=ce){if(!C())throw new Error("Google Chrome is not installed (or set KANE_CLI_CHROME_PATH).");le();let o=re(w(W(),L));ne(w(o,F),String(process.pid));let i=ee(A(),se(e,o,t),{stdio:"ignore",detached:process.platform!=="win32"});i.unref();let n=()=>K(o);await new Promise((u,g)=>{let c=setTimeout(()=>{i.off("error",d),i.off("exit",f),u()},r);c.unref();function d(l){clearTimeout(c),n(),g(new Error(`Chrome did not start: ${l.message}`))}function f(l,m){clearTimeout(c),n(),g(new Error(`Chrome quit as it opened (${m??`exit code ${l}`}).`))}i.once("error",d),i.once("exit",f)}),i.on("error",()=>{}),i.once("exit",n);let s=()=>p();process.once("exit",s);let a=!1;function p(){if(!a){a=!0,process.off("exit",s);try{i.pid&&process.platform!=="win32"?process.kill(-i.pid):i.kill()}catch{}n()}}return p}var L="kane-device-view-",F="kane-cli.pid";function K(e){try{ie(e,{recursive:!0,force:!0,maxRetries:3,retryDelay:100})}catch{}}function de(e){try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function le(e=W()){let t;try{t=te(e).filter(r=>r.startsWith(L))}catch{return}for(let r of t){let o=w(e,r),i=NaN;try{i=Number(oe(w(o,F),"utf8"))}catch{}Number.isInteger(i)&&i>0&&de(i)||K(o)}}function We(e){return e.flag===!1||e.mobile?.device_stream===!1?"off":e.interactive?"open":"off"}function me(e){let t=e.basicAuth;if(!t)return;let r=e.resolvedCreds;return{username:t.username,accessKey:t.access_key,...r?.org_id?{orgId:String(r.org_id)}:{},...r?.user_id?{userId:String(r.user_id)}:{}}}async function Me(e){let t=me(e.auth),r=e.selection?await U({platform:e.target,selection:e.selection,env:e.env,outDir:e.sessionDir,...t?{credentials:t}:{},testName:e.testName,...e.tcId?{tcId:e.tcId}:{},capabilities:x(e.mobile,e.target),onProgress:e.write,onWarning:c=>e.write(`warning: ${c}`)}):I({platform:e.target,hasCredentials:!!t});e.write(_(e.target));let o=r.app?.replace(/^lt:\/\//,""),i=k(e.target,r.app,e.write),n,s,a=!1,p=!1,u=()=>{p=!0,s?.(),n?.close()},g=c=>{let d=c.type==="run_start"&&!c.child_id?c.environment?.device:void 0,f=d?.session_id;if(a||!f||!t||(e.stream??"off")==="off")return;a=!0;let l=N(d);O({streamUrl:M(v(e.env).deviceStreamUrl,y(e.target),f,t),title:l?`${l} \u2014 live`:"Real device \u2014 live",viewOnly:e.target==="android"}).then(async m=>{n=m,s=await(e.openWindow??j)(m.url,B(d)),p?u():e.write("Showing the device in its own window.")}).catch(m=>{n?.close(),e.write(`note: no live view of the device \u2014 ${m.message}`)})};return{device:r.device,...r.deviceName?{deviceName:r.deviceName}:{},...r.osVersion?{osVersion:r.osVersion}:{},...r.app?{app:r.app}:{},...h(o)?{appId:o}:{},announce:c=>{i(c),g(c)},stopStream:u}}var pe="infra_error.device_lost";function Oe(e){return e?.reason_code===pe}export{P as a,We as b,me as c,Me as d,Oe as e};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as B}from"./chunk-S3DAAAE5.js";import{a as g}from"./chunk-CNUCP6DK.js";import{y as s}from"./chunk-5TQFOPJV.js";import{a as w}from"./chunk-HCBYKLMW.js";import{a as x,b as t,c as h,i as P,j as S}from"./chunk-C44QQJR4.js";import{a as C}from"./chunk-6YGTRKDT.js";import{e as T}from"./chunk-UR6MHSHU.js";var o=T(C(),1);var e=T(w(),1);function D({defaultName:i,onSubmit:c}){let[d,p]=(0,o.useState)("confirm"),[f,a]=(0,o.useState)(""),[m,u]=(0,o.useState)(null),l=(0,o.useMemo)(()=>f.trim()||i,[f,i]);return P((n,r)=>{if(d==="confirm"){if(n==="y"||n==="Y"){a(i),p("name");return}if(n==="n"||n==="N"||r.escape||r.ctrl&&n==="c"){c(null);return}if(r.return){c(i);return}return}if(r.return){if(!B(l)){u(`name "${l}" is invalid; allowed: letters, digits, underscore, hyphen`);return}c(l);return}if(r.escape||r.ctrl&&n==="c"){c(null);return}if(r.backspace||r.delete){a(v=>v.slice(0,-1)),u(null);return}n&&!r.ctrl&&!r.meta&&(a(v=>v+n),u(null))}),d==="confirm"?(0,e.jsx)(g,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsx)(t,{color:s.orange,children:i})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[(0,e.jsx)(t,{color:s.dim,children:"enter \u2014 save with this name"}),(0,e.jsx)(t,{color:s.dim,children:"Y \u2014 edit name"}),(0,e.jsx)(t,{color:s.dim,children:"N/esc \u2014 discard session"})]})}):(0,e.jsx)(g,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsxs)(x,{children:[(0,e.jsx)(t,{color:s.orange,children:f}),(0,e.jsx)(t,{inverse:!0,children:" "})]})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[m&&(0,e.jsx)(t,{color:s.red,children:m}),(0,e.jsx)(t,{color:s.dim,children:"enter \u2014 save \xB7 esc \u2014 discard"})]})})}function V(){return new Date().toISOString().slice(0,19).replace(/:/g,"-")}async function Y(i){return new Promise(c=>{function d(){let{exit:a}=S(),[m,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(m){let l=setTimeout(()=>a(),50);return()=>clearTimeout(l)}},[m,a]),(0,e.jsx)(D,{defaultName:i,onSubmit:l=>{c(l),u(!0)}})}let{waitUntilExit:p,unmount:f}=h((0,e.jsx)(d,{}),{stdout:process.stderr,exitOnCtrlC:!1});p().then(()=>{try{f()}catch{}})})}export{D as a,V as b,Y as c};
2
+ import{b as B}from"./chunk-S3DAAAE5.js";import{a as g}from"./chunk-5BUIIFLC.js";import{a as w}from"./chunk-HCBYKLMW.js";import{a as x,b as t,c as h,i as P,j as S}from"./chunk-33DWJV67.js";import{a as C}from"./chunk-6YGTRKDT.js";import{y as s}from"./chunk-I6OQISK4.js";import{e as T}from"./chunk-UR6MHSHU.js";var o=T(C(),1);var e=T(w(),1);function D({defaultName:i,onSubmit:c}){let[d,p]=(0,o.useState)("confirm"),[f,a]=(0,o.useState)(""),[m,u]=(0,o.useState)(null),l=(0,o.useMemo)(()=>f.trim()||i,[f,i]);return P((n,r)=>{if(d==="confirm"){if(n==="y"||n==="Y"){a(i),p("name");return}if(n==="n"||n==="N"||r.escape||r.ctrl&&n==="c"){c(null);return}if(r.return){c(i);return}return}if(r.return){if(!B(l)){u(`name "${l}" is invalid; allowed: letters, digits, underscore, hyphen`);return}c(l);return}if(r.escape||r.ctrl&&n==="c"){c(null);return}if(r.backspace||r.delete){a(v=>v.slice(0,-1)),u(null);return}n&&!r.ctrl&&!r.meta&&(a(v=>v+n),u(null))}),d==="confirm"?(0,e.jsx)(g,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsx)(t,{color:s.orange,children:i})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[(0,e.jsx)(t,{color:s.dim,children:"enter \u2014 save with this name"}),(0,e.jsx)(t,{color:s.dim,children:"Y \u2014 edit name"}),(0,e.jsx)(t,{color:s.dim,children:"N/esc \u2014 discard session"})]})}):(0,e.jsx)(g,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsxs)(x,{children:[(0,e.jsx)(t,{color:s.orange,children:f}),(0,e.jsx)(t,{inverse:!0,children:" "})]})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[m&&(0,e.jsx)(t,{color:s.red,children:m}),(0,e.jsx)(t,{color:s.dim,children:"enter \u2014 save \xB7 esc \u2014 discard"})]})})}function V(){return new Date().toISOString().slice(0,19).replace(/:/g,"-")}async function Y(i){return new Promise(c=>{function d(){let{exit:a}=S(),[m,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(m){let l=setTimeout(()=>a(),50);return()=>clearTimeout(l)}},[m,a]),(0,e.jsx)(D,{defaultName:i,onSubmit:l=>{c(l),u(!0)}})}let{waitUntilExit:p,unmount:f}=h((0,e.jsx)(d,{}),{stdout:process.stderr,exitOnCtrlC:!1});p().then(()=>{try{f()}catch{}})})}export{D as a,V as b,Y as c};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as f,d as l}from"./chunk-ZXY4P76I.js";import{a as p}from"./chunk-TZXXJWHA.js";function d(t,e,o){return{id:`${t}.internal`,label:e,required:!0,status:"fail",detail:o instanceof Error?o.message:String(o)}}async function k(t,e={}){let o=p();if(!o.supported)return{sections:[{platform:"host",checks:[{id:"host.platform",label:"host",required:!0,status:"fail",detail:o.reason}]}]};let n=t?f().filter(r=>r.toLowerCase()===t.toLowerCase()):f(),{managedDeps:i}=await import("./deps-bundle-OI7JJ22L.js"),s=n.flatMap(r=>r==="android"?["emulator"]:r==="ios"?["simulator"]:[]);await Promise.allSettled(s.map(r=>i().warmResolveCache(r)));let c=[];for(let r of n){let u=l(r);if(!u)continue;let a;try{a=await u.checks(e)}catch(h){a=[d(r,"toolchain check",h)]}c.push({platform:r,checks:a})}return{sections:c}}function m(t){return t==="pass"?"\u2713":t==="fail"?"\u2717":"\u2139"}function x(t){return t.charAt(0).toUpperCase()+t.slice(1)}function C(t){let e=[];if(t.sections.length===0)return"No mobile platforms are supported on this host.";for(let o of t.sections){e.length>0&&e.push(""),e.push(`${x(o.platform)} toolchain`);let n=o.checks.filter(s=>s.status!=="info"),i=new Set;for(let s of n){let c=s.detail?` \u2014 ${s.detail}`:"";if(e.push(` ${m(s.status)} ${s.label}${c}`),s.status==="fail"&&s.fixText&&!i.has(s.fixText)){i.add(s.fixText);for(let r of s.fixText.split(`
2
+ import{b as f,d as l}from"./chunk-2OOFURWD.js";import{a as p}from"./chunk-TZXXJWHA.js";function d(t,e,o){return{id:`${t}.internal`,label:e,required:!0,status:"fail",detail:o instanceof Error?o.message:String(o)}}async function k(t,e={}){let o=p();if(!o.supported)return{sections:[{platform:"host",checks:[{id:"host.platform",label:"host",required:!0,status:"fail",detail:o.reason}]}]};let n=t?f().filter(r=>r.toLowerCase()===t.toLowerCase()):f(),{managedDeps:i}=await import("./deps-bundle-FWINW4XM.js"),s=n.flatMap(r=>r==="android"?["emulator"]:r==="ios"?["simulator"]:[]);await Promise.allSettled(s.map(r=>i().warmResolveCache(r)));let c=[];for(let r of n){let u=l(r);if(!u)continue;let a;try{a=await u.checks(e)}catch(h){a=[d(r,"toolchain check",h)]}c.push({platform:r,checks:a})}return{sections:c}}function m(t){return t==="pass"?"\u2713":t==="fail"?"\u2717":"\u2139"}function x(t){return t.charAt(0).toUpperCase()+t.slice(1)}function C(t){let e=[];if(t.sections.length===0)return"No mobile platforms are supported on this host.";for(let o of t.sections){e.length>0&&e.push(""),e.push(`${x(o.platform)} toolchain`);let n=o.checks.filter(s=>s.status!=="info"),i=new Set;for(let s of n){let c=s.detail?` \u2014 ${s.detail}`:"";if(e.push(` ${m(s.status)} ${s.label}${c}`),s.status==="fail"&&s.fixText&&!i.has(s.fixText)){i.add(s.fixText);for(let r of s.fixText.split(`
3
3
  `))e.push(` fix: ${r}`)}}}return e.join(`
4
4
  `)}function w(t){return t.sections.length===0?!0:t.sections.every(e=>e.checks.some(o=>o.required&&o.status==="fail"&&!o.fixedByBundle))}function b(t){for(let e of t.sections)for(let o of e.checks)if(o.required&&o.status!=="pass")return 2;return 0}export{k as a,C as b,w as c,b as d};
@@ -0,0 +1,3 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as h}from"./chunk-72KYMWQ5.js";import{a as d}from"./chunk-JQ64X2TO.js";import{a as m}from"./chunk-34R7BNZ2.js";import{a as p}from"./chunk-3G2LSTK5.js";import{a as V}from"./chunk-4IEQNX7F.js";import{a as y}from"./chunk-MGNRNLBE.js";import{a as g}from"./chunk-4QTH7VYE.js";import{a as c}from"./chunk-RZ4F3BHX.js";var u=class{constructor(e){this.baseUrl=e}async pushSecret(e){let s=g(e.username,e.accessKey),n=await c(`${this.baseUrl}/logistics/v1.0/secrets/create`,{method:"PUT",headers:{Authorization:s,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({secretKey:e.secretKey,secretValue:e.secretValue,orgId:e.orgId,username:e.username,scope:"user",type:"user",accessKey:e.accessKey})});if(!n.ok)throw new Error(`Push secret failed: ${n.status} ${await n.text()}`)}static extractVariableKeys(e){let s=e.matchAll(/\{\{([a-zA-Z_][a-zA-Z0-9_]*)\}\}/g),n=new Set;for(let t of s)n.add(t[1]);return[...n]}};var f=class extends p{constructor(e,s,n){super(e,{username:s,accessKey:n})}async upsertVariable(e){let s=e.environmentId??0,n=await c(`${this.baseUrl}/v1/variables`,{method:"POST",headers:this.headers(),body:JSON.stringify({name:e.name,value:String(e.value),type:"variable",value_type:"string",is_persist:e.isPersist??!1,environment_id:s})});if(n.ok){let o=await n.json().catch(()=>({}));if(o.type==="Success"&&o.id!=null)return{id:Number(o.id)||0}}let t=await c(`${this.baseUrl}/v1/variables/${encodeURIComponent(e.name)}?environment_id=${s}`,{method:"GET",headers:this.headers()});if(!t.ok)return{id:0};let i=(await t.json().catch(()=>({}))).data?.id;return i==null?{id:0}:(await c(`${this.baseUrl}/v1/variables/${i}`,{method:"PUT",headers:this.headers(),body:JSON.stringify({value:String(e.value),value_type:"string"})})).ok?{id:Number(i)||0}:{id:0}}};import{readdirSync as P,readFileSync as E,existsSync as S}from"fs";import{join as A}from"path";function b(r,e){let s=e.type==="parameter";return{value:typeof e.value=="number"?String(e.value):e.value,secret:e.secret??!1,syntax:e.syntax??(s?"${"+r+"}":`{{${r}}}`),...typeof e.type=="string"?{type:e.type}:{},...typeof e.description=="string"?{description:e.description}:{}}}function v(r,e){if(!S(r))return{};let s={},n;try{n=P(r).filter(t=>t.endsWith(".json")).sort()}catch{return{}}for(let t of n)try{let a=E(A(r,t),"utf-8"),i=JSON.parse(a);if(i&&typeof i=="object")for(let[l,o]of Object.entries(i))o&&typeof o=="object"&&"value"in o&&(s[l]=b(l,o))}catch{e?e("warn","VARIABLE_PARSE_FAILED","Skipping invalid variables file",{file:t}):process.stderr.write(`[variables] Warning: skipping invalid variables file: ${t}
3
+ `)}return s}function R(r){if(!S(r))throw new Error(`Variables file not found: ${r}`);let e=E(r,"utf-8"),s=V(e,r),n={};if(s&&typeof s=="object")for(let[t,a]of Object.entries(s))a&&typeof a=="object"&&"value"in a&&(n[t]=b(t,a));return n}function w(r){let e;try{e=JSON.parse(r)}catch{throw new Error("Invalid --variables JSON")}let s={};if(e&&typeof e=="object")for(let[n,t]of Object.entries(e))t&&typeof t=="object"&&"value"in t&&(s[n]=b(n,t));return s}function j(r,e,s){let n=v(r,s),t=v(e,s);return{...n,...t}}function G(r,e){if(Object.keys(r).length===0)return{};let s={};for(let[n,t]of Object.entries(r)){let a=t.syntax??`{{${n}}}`;k(e,a)&&(s[n]=t)}return s}function I(r){let e=r.trim();return e.startsWith("{{")&&e.endsWith("}}")?e.slice(2,-2).trim():e.startsWith("${")&&e.endsWith("}")?e.slice(2,-1).trim():e}function k(r,e){if(!e||!r)return!1;if(r.includes(e))return!0;let s=I(e);if(!s)return!1;let n=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(?:\\{\\{|\\$\\{)\\s*${n}(?=\\s*\\}|[.\\[])`).test(r)}function M(r){let e=j(r.globalDir,r.localDir,r.onLoadError),s=r.file?R(r.file):{},n=r.inline?w(r.inline):{},t={...e,...s,...n,...r.parameters??{}},a=Object.keys(t).length>0,{variables:i,objective:l}=a?h(t,r.objective):{variables:{},objective:r.objective},o=_(t);return m(o.secretEntries.map(([,x])=>x.value)),{raw:t,auteur:i,auteurObjective:l,...o}}function _(r){let e=Object.entries(r),s=e.filter(([,t])=>d(t)),n=e.filter(([,t])=>!d(t));return{secretEntries:n.filter(([,t])=>t.secret),nonSecretEntries:n.filter(([,t])=>!t.secret),parameterEntries:s}}async function Q(r){if(r.localMode)return{};let e=y(r.env);if(r.variables.secretEntries.length>0){let n=new u(e.secretsBaseUrl);for(let[t,a]of r.variables.secretEntries)n.pushSecret({secretKey:t,secretValue:a.value,username:r.auth.username,accessKey:r.auth.access_key,orgId:r.orgId}).then(()=>r.log("info","SECRET_PUSH_OK","Secret pushed",{key:t})).catch(i=>r.log("error","SECRET_PUSH_FAILED","Secret push failed",{key:t,error:String(i)}))}let s={};if(r.variables.nonSecretEntries.length>0){let n=new f(e.tmsBaseUrl,r.auth.username,r.auth.access_key);for(let[t,a]of r.variables.nonSecretEntries)try{let i=await n.upsertVariable({name:t,value:a.value});s[t]=i.id,r.log("info","VAR_PUSH_OK","Variable pushed",{name:t,id:i.id})}catch(i){r.log("error","VAR_PUSH_FAILED","Variable push failed",{name:t,error:String(i)})}}return s}export{u as a,f as b,G as c,M as d,_ as e,Q as f};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{m as n}from"./chunk-4I7YN6YY.js";var g={prod:"https://kaneai-api.lambdatest.com/v16-controller/v1",stage:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1"};function d(e=process.env){return e.TESTMUAI_BASE_URL||g[e.TESTMUAI_ENV==="stage"?"stage":"prod"]}function h(e=process.env){return e.TESTMUAI_BASE_URL&&e.TESTMUAI_ENV!=="stage"?"note: TESTMUAI_BASE_URL applies to context/design commands only \u2014 run/testmd use your configured environment":null}async function _(e,s=process.env,l=fetch){let o=d(s),f=`${o}/assurance/turn`,a={"Content-Type":"application/json"},c=e.TESTMUAI_BASIC_AUTH??s.TESTMUAI_BASIC_AUTH,i=e.TESTMUAI_API_KEY??s.TESTMUAI_API_KEY;c?a.Authorization=`Basic ${c}`:i&&(a.Authorization=`Bearer ${i}`);let t,u="";try{let r=await l(f,{method:"POST",headers:a,body:"{}",signal:AbortSignal.timeout(8e3)});t=r.status,t===401&&(u=await r.text().catch(()=>""))}catch(r){return{ok:!1,final:!1,cause:"unreachable",message:n().text("note.controller_unreachable",{base:o,error:r instanceof Error?r.message:String(r)})}}return t===404?{ok:!1,final:!0,cause:"unsupported",message:n().text("note.assurance_unsupported",{})}:t>=500?{ok:!1,final:!1,cause:"unreachable",message:n().text("note.controller_unreachable",{base:o,error:`HTTP ${t}`})}:t===401&&p(u)?{ok:!1,final:!1,cause:"login_unchecked",message:n().text("note.controller_unreachable",{base:o,error:"HTTP 401: it could not check the credentials"})}:t===401?{ok:!1,final:!0,cause:"rejected",message:n().text("note.credentials_rejected",{env:s.TESTMUAI_ENV??"prod"})}:{ok:!0}}function p(e){try{return JSON.parse(e).error==="authentication failed"}catch{return!1}}export{d as a,h as b,_ as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ function e(t){let n=t?.trim();return n||void 0}function o(t=process.env){let n=e(t.TEST_INSTANCE_ID),r=e(t.JOB_ID),s=e(t.TASK_ID);return{...n?{testInstanceId:n}:{},...r?{jobId:r}:{},...s?{taskId:s}:{}}}export{o as a};