@testmuai/kane-cli 0.8.16 → 0.8.18

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 (290) hide show
  1. package/dist/{ChatSurface-5JEEFY34.js → ChatSurface-SY7HJD46.js} +1 -1
  2. package/dist/{ChromeProfilePicker-6IVAYCWJ.js → ChromeProfilePicker-NCIURJK6.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-K4IN7S6J.js → CliFeedbackPrompt-TTVW5COG.js} +1 -1
  4. package/dist/{CliUploadProgress-MI4H4LKT.js → CliUploadProgress-E3WEIF36.js} +1 -1
  5. package/dist/{ConfigView-CJY5MB6H.js → ConfigView-ZY37EGAO.js} +1 -1
  6. package/dist/EvidenceViewOffer-6KT64W7L.js +2 -0
  7. package/dist/FolderPicker-MPLLN4VP.js +2 -0
  8. package/dist/{InfoBox-RP6RDCG7.js → InfoBox-JP3TTPIO.js} +1 -1
  9. package/dist/{LinksBox-QOQJ3S2I.js → LinksBox-4ZB7G5ET.js} +1 -1
  10. package/dist/{ProfilesView-BZEBT6R5.js → ProfilesView-25AXMCKS.js} +1 -1
  11. package/dist/{ProjectPicker-J42MEJRQ.js → ProjectPicker-RL3LXLTV.js} +1 -1
  12. package/dist/{SaveSessionPrompt-MKAIUVX7.js → SaveSessionPrompt-5W4ATISN.js} +1 -1
  13. package/dist/SingleShotApp-JV64B4XL.js +2 -0
  14. package/dist/{SummaryBox-JQJKGYDM.js → SummaryBox-GW4XAX5T.js} +1 -1
  15. package/dist/TestMdRunView-7N6QXMNR.js +2 -0
  16. package/dist/{TestrunEvidenceTable-FYDS3ZVU.js → TestrunEvidenceTable-SYCFAGM4.js} +1 -1
  17. package/dist/WhoamiView-H2DRYRRA.js +2 -0
  18. package/dist/{app-download-RA4CGTC5.js → app-download-2IZ4GPTA.js} +1 -1
  19. package/dist/{auth-TAT427C3.js → auth-6PKLNV6Z.js} +1 -1
  20. package/dist/{binary-OFPMBJ34.js → binary-OMBH4UTI.js} +1 -1
  21. package/dist/{bind-LY362KX7.js → bind-IHLHM5UM.js} +4 -4
  22. package/dist/bootstrap-UKZX3LRC.js +2 -0
  23. package/dist/bridge-KJNDGKPU.js +2 -0
  24. package/dist/{changelog-ZC3LHV2Z.js → changelog-ZWOIODQ4.js} +1 -1
  25. package/dist/chat-committer-6D7AQI6Z.js +2 -0
  26. package/dist/chat-controller-UJQ6Z4RE.js +2 -0
  27. package/dist/{chunk-OYY566GN.js → chunk-2KYJOBNI.js} +1 -1
  28. package/dist/{chunk-C6JFTSIQ.js → chunk-2LKSDGWA.js} +1 -1
  29. package/dist/chunk-3UI5VTQS.js +4 -0
  30. package/dist/chunk-3VAU3PNU.js +2 -0
  31. package/dist/{chunk-UAFCBZ3P.js → chunk-47FQ7ZUQ.js} +1 -1
  32. package/dist/{chunk-5VZAWKDF.js → chunk-4ANRRDC7.js} +1 -1
  33. package/dist/{chunk-KYZKPNPQ.js → chunk-4B3EHSTD.js} +1 -1
  34. package/dist/{chunk-NPKB7EK3.js → chunk-4BKSQFEP.js} +1 -1
  35. package/dist/{chunk-ICUTARPB.js → chunk-4JRCAHHB.js} +1 -1
  36. package/dist/{chunk-FQFVAFWK.js → chunk-4R5U7CHE.js} +1 -1
  37. package/dist/{chunk-QMZLIHBS.js → chunk-5B2NEYHF.js} +2 -2
  38. package/dist/{chunk-HYCOX7AB.js → chunk-5NZUMWUD.js} +2 -2
  39. package/dist/chunk-5RJ2J5QU.js +6 -0
  40. package/dist/{chunk-Q7LZ5QJV.js → chunk-5WUDW6BG.js} +1 -1
  41. package/dist/{chunk-GX3FPJUG.js → chunk-63DYVWNX.js} +1 -1
  42. package/dist/{chunk-ECIGXPLN.js → chunk-6FEEYKSE.js} +1 -1
  43. package/dist/{chunk-NN6UG2BE.js → chunk-6OIC4S3C.js} +1 -1
  44. package/dist/{chunk-2GWMENG5.js → chunk-6VB4FGBZ.js} +1 -1
  45. package/dist/{chunk-AAT4O22C.js → chunk-7BMM5DFP.js} +1 -1
  46. package/dist/{chunk-WPNNRMTP.js → chunk-7DSZ2YSD.js} +1 -1
  47. package/dist/{chunk-AHXOKBVE.js → chunk-7N6OCHPC.js} +1 -1
  48. package/dist/{chunk-OUWOLCCS.js → chunk-7PLIZBXB.js} +1 -1
  49. package/dist/{chunk-W4Y3PG7F.js → chunk-7ZKVI4US.js} +1 -1
  50. package/dist/chunk-7ZSHB3AN.js +2 -0
  51. package/dist/{chunk-7O54QURK.js → chunk-AACQE24F.js} +1 -1
  52. package/dist/{chunk-NADKZKGS.js → chunk-AK7BMF5T.js} +1 -1
  53. package/dist/{chunk-3MVEGB2I.js → chunk-ALHCB3LL.js} +1 -1
  54. package/dist/chunk-BXM5GDIO.js +8 -0
  55. package/dist/{chunk-VATOIZYG.js → chunk-C3GDK2OS.js} +5 -5
  56. package/dist/{chunk-J2LWXO55.js → chunk-CHA75LBJ.js} +1 -1
  57. package/dist/{chunk-JQW2QFSX.js → chunk-D6E6KRVX.js} +1 -1
  58. package/dist/chunk-D7WG7SRA.js +2 -0
  59. package/dist/chunk-DDLEZGZB.js +3 -0
  60. package/dist/chunk-DH3H6GWD.js +2 -0
  61. package/dist/{chunk-IYOPWIG4.js → chunk-DKPRWI7U.js} +2 -2
  62. package/dist/{chunk-H6S7L2I2.js → chunk-EA2LT5OJ.js} +1 -1
  63. package/dist/{chunk-4LVZLLTN.js → chunk-EHOYD6VL.js} +3 -3
  64. package/dist/{chunk-XGL3RSI5.js → chunk-EJBJ7MYC.js} +1 -1
  65. package/dist/{chunk-CDWUZ54U.js → chunk-EKZI5HZV.js} +1 -1
  66. package/dist/chunk-EVFFDODK.js +5 -0
  67. package/dist/{chunk-UEG4LJD6.js → chunk-EW3KRQGF.js} +1 -1
  68. package/dist/{chunk-GCMJDOAE.js → chunk-EYVHPJLK.js} +1 -1
  69. package/dist/{chunk-3IXEARDX.js → chunk-F2OBORCG.js} +1 -1
  70. package/dist/{chunk-ULGFPKC7.js → chunk-F3IWJ73B.js} +1 -1
  71. package/dist/chunk-FY7TCYPK.js +6 -0
  72. package/dist/{chunk-ZLIYWELJ.js → chunk-G76O7C56.js} +1 -1
  73. package/dist/{chunk-23MVD7GY.js → chunk-GESZSIB6.js} +1 -1
  74. package/dist/{chunk-WML5KSGQ.js → chunk-GUFIE3Z2.js} +1 -1
  75. package/dist/{chunk-O3ZKP4DY.js → chunk-H5N25XIT.js} +1 -1
  76. package/dist/{chunk-HBMNUT6E.js → chunk-H7A4R7WY.js} +1 -1
  77. package/dist/{chunk-O3XBIURC.js → chunk-HS7OIRGU.js} +1 -1
  78. package/dist/{chunk-EMAKLNDV.js → chunk-IFQD53QB.js} +1 -1
  79. package/dist/{chunk-BY2MU3ZS.js → chunk-IGLCR4J2.js} +1 -1
  80. package/dist/chunk-IICT4VOU.js +2 -0
  81. package/dist/{chunk-SWTJMTBY.js → chunk-IPQAKIJO.js} +1 -1
  82. package/dist/{chunk-TGBXIV7O.js → chunk-IQCW5SV5.js} +1 -1
  83. package/dist/chunk-J3OGBEEP.js +2 -0
  84. package/dist/{chunk-4PWYSDZR.js → chunk-JMWRMDSI.js} +1 -1
  85. package/dist/chunk-JQ64X2TO.js +2 -0
  86. package/dist/chunk-K2UJYY2U.js +2 -0
  87. package/dist/{chunk-ALCE5RLK.js → chunk-KDNNMU7Q.js} +1 -1
  88. package/dist/chunk-KJQNAOOE.js +6 -0
  89. package/dist/{chunk-V4JR5JCK.js → chunk-L4U7NP5Q.js} +1 -1
  90. package/dist/{chunk-G2ZMNVYN.js → chunk-LHU6TEKD.js} +1 -1
  91. package/dist/{chunk-U466V5JN.js → chunk-LQMA6N5S.js} +1 -1
  92. package/dist/chunk-LSDWPG6C.js +2 -0
  93. package/dist/{chunk-AGKE5WF3.js → chunk-MMLYJDXO.js} +1 -1
  94. package/dist/{chunk-BK42G6RI.js → chunk-MSLYSXGM.js} +1 -1
  95. package/dist/{chunk-Z2GDSCPS.js → chunk-MVOO7RPO.js} +1 -1
  96. package/dist/{chunk-QXUPBIV3.js → chunk-N4HKQTD5.js} +36 -36
  97. package/dist/{chunk-OPL2MIQG.js → chunk-NJ4BXZBX.js} +1 -1
  98. package/dist/{chunk-CVNHUDT4.js → chunk-NXZPWMK5.js} +1 -1
  99. package/dist/{chunk-IQDZ6YMY.js → chunk-NYP7QV54.js} +1 -1
  100. package/dist/{chunk-ZYEFWJNZ.js → chunk-OVL4WXGF.js} +1 -1
  101. package/dist/{chunk-IJTSA34Q.js → chunk-PMBQU63H.js} +1 -1
  102. package/dist/{chunk-TBYYPGHF.js → chunk-PVJB7CVS.js} +1 -1
  103. package/dist/{chunk-TU6IMGWO.js → chunk-Q4YYAN6E.js} +1 -1
  104. package/dist/{chunk-55YDTPB7.js → chunk-Q6F23V7L.js} +1 -1
  105. package/dist/chunk-QSCXXNC2.js +2 -0
  106. package/dist/{chunk-E44OHYDS.js → chunk-QX5LJVTD.js} +2 -2
  107. package/dist/{chunk-BCJNIDS3.js → chunk-RBVLIMOV.js} +1 -1
  108. package/dist/{chunk-3N6IAVD5.js → chunk-RDHWNSDP.js} +1 -1
  109. package/dist/{chunk-TCAHDVII.js → chunk-RRY5IXOB.js} +1 -1
  110. package/dist/{chunk-7QUFOWMU.js → chunk-SBQUEGTP.js} +1 -1
  111. package/dist/{chunk-YCH7H7JX.js → chunk-SEEEGDVK.js} +1 -1
  112. package/dist/{chunk-MD3S2RXN.js → chunk-SYKS57PK.js} +1 -1
  113. package/dist/{chunk-6HCY5LJO.js → chunk-TG4GGP3H.js} +3 -3
  114. package/dist/{chunk-CR7UWQ76.js → chunk-TSNQLZE3.js} +1 -1
  115. package/dist/{chunk-VOTIGXQ4.js → chunk-U2LDPUDZ.js} +1 -1
  116. package/dist/chunk-U6OTFMIT.js +4 -0
  117. package/dist/{chunk-7P6FSGRD.js → chunk-UAEU5IPH.js} +2 -2
  118. package/dist/{chunk-FYJ62EVY.js → chunk-UE5EYEFI.js} +1 -1
  119. package/dist/{chunk-F2XTOZTN.js → chunk-UQ6A52ML.js} +1 -1
  120. package/dist/{chunk-GGD7NKPL.js → chunk-UUS5AK6L.js} +2 -2
  121. package/dist/{chunk-52WM3XYO.js → chunk-V4B5QA3U.js} +1 -1
  122. package/dist/{chunk-5ACSALRU.js → chunk-VH73F65W.js} +2 -2
  123. package/dist/chunk-VIO7CCFW.js +5 -0
  124. package/dist/{chunk-IE3OO5GI.js → chunk-VVOKM2VO.js} +1 -1
  125. package/dist/{chunk-KPL2XHYF.js → chunk-WAZUOA3Y.js} +1 -1
  126. package/dist/chunk-WESMQEPO.js +2 -0
  127. package/dist/{chunk-Z5DGFN7R.js → chunk-WQV5SM5P.js} +1 -1
  128. package/dist/{chunk-SF5QPR6T.js → chunk-WTAJTPI5.js} +1 -1
  129. package/dist/{chunk-KZG4E5RM.js → chunk-WVHMPIDQ.js} +1 -1
  130. package/dist/{chunk-MZYPDLD3.js → chunk-WWVHK7OA.js} +1 -1
  131. package/dist/chunk-XLSOQLVT.js +2 -0
  132. package/dist/{chunk-Z4KRSLAM.js → chunk-XYMUKOKK.js} +1 -1
  133. package/dist/{chunk-WECVT7WE.js → chunk-YAUR5CBH.js} +1 -1
  134. package/dist/{chunk-PDTFQGQF.js → chunk-YNOADDF7.js} +1 -1
  135. package/dist/{chunk-U7BVK5IX.js → chunk-YPEIPCQY.js} +1 -1
  136. package/dist/{chunk-3LXN6AV5.js → chunk-YVKNKK22.js} +1 -1
  137. package/dist/chunk-ZARM7ESN.js +368 -0
  138. package/dist/chunk-ZLWURCJ7.js +2 -0
  139. package/dist/{chunk-MU3I453X.js → chunk-ZMM3Y6U7.js} +1 -1
  140. package/dist/{chunk-DSWHEEHN.js → chunk-ZO75BQ3Z.js} +1 -1
  141. package/dist/{chunk-IZ5CTC6M.js → chunk-ZV5KM7LI.js} +1 -1
  142. package/dist/{chunk-TWZ6NZWE.js → chunk-ZW3JBY5E.js} +4 -4
  143. package/dist/committer-2QPBANRD.js +2 -0
  144. package/dist/{config-WETHR632.js → config-ODCFEOAN.js} +1 -1
  145. package/dist/cover-cmd-AQ7PWJRH.js +3 -0
  146. package/dist/{credentials-RQPAP5KY.js → credentials-MUZUCSJJ.js} +1 -1
  147. package/dist/{deps-bundle-F47ZDYIM.js → deps-bundle-7COKI7UV.js} +1 -1
  148. package/dist/{deps-resolve-URKD4QCB.js → deps-resolve-ADN7P5L7.js} +1 -1
  149. package/dist/descriptor-3JJUOHBM.js +2 -0
  150. package/dist/design-committer-D44GSUXY.js +2 -0
  151. package/dist/dispatch-V24LFEAO.js +2 -0
  152. package/dist/{doctor-J44UKALC.js → doctor-3BRZM4EW.js} +1 -1
  153. package/dist/{docx-convert-WPZS6OIC.js → docx-convert-SQRTF7XS.js} +1 -1
  154. package/dist/{dossier-UGJMYYAB.js → dossier-7HVC6BNK.js} +1 -1
  155. package/dist/evidence-EBD3FIXA.js +2 -0
  156. package/dist/evolve-cmd-IR7UGOD2.js +2 -0
  157. package/dist/{explain-H5HJEDEF.js → explain-NEFBUX5G.js} +1 -1
  158. package/dist/{explain-cmd-R45I5MT7.js → explain-cmd-ENSJNQK7.js} +1 -1
  159. package/dist/{explain-cmd-USGRZFBY.js → explain-cmd-NNYKSAQK.js} +1 -1
  160. package/dist/{extract-bind-X4QRQX53.js → extract-bind-2GGLO5KU.js} +3 -3
  161. package/dist/{extract-cmd-RKEE32FN.js → extract-cmd-2BQJ2HNT.js} +2 -2
  162. package/dist/feeder-66TUPB2R.js +2 -0
  163. package/dist/gaps-cmd-Y6CZUCIX.js +3 -0
  164. package/dist/{gate-E3BLIUEA.js → gate-OYRDJMF6.js} +1 -1
  165. package/dist/{generate-headless-LSQHOR3G.js → generate-headless-SPGLBRH5.js} +2 -2
  166. package/dist/index.js +155 -158
  167. package/dist/ingest-OSNNM3DH.js +2 -0
  168. package/dist/ingest-cmd-N37FGNP5.js +2 -0
  169. package/dist/install-2PUHCC2Y.js +2 -0
  170. package/dist/interactive-bind-ZLO6S2SG.js +26 -0
  171. package/dist/lifecycle-cmd-6TWIQCKR.js +2 -0
  172. package/dist/list-cmd-NDD2OSP5.js +3 -0
  173. package/dist/{list-commands-Q77CAQJ2.js → list-commands-AARQ2RZG.js} +1 -1
  174. package/dist/logical-ids-GLVM2SVR.js +2 -0
  175. package/dist/login-flow-V4US6VQP.js +2 -0
  176. package/dist/maintenance-cmd-4QUVSGUY.js +2 -0
  177. package/dist/{mobile-prompts-PPPPKRS2.js → mobile-prompts-GYJS5BYX.js} +1 -1
  178. package/dist/{objective-variable-gate-BCKULIFQ.js → objective-variable-gate-FUVNHKRA.js} +1 -1
  179. package/dist/open-provider-QTPN6XOL.js +2 -0
  180. package/dist/{pdf-convert-5H4HQNN3.js → pdf-convert-RLXSXFWN.js} +1 -1
  181. package/dist/{persist-recorded-session-MK4HCDOY.js → persist-recorded-session-UFK5VC7S.js} +1 -1
  182. package/dist/phase-seed-H7KXNQO6.js +2 -0
  183. package/dist/pipeline-Z477UOXV.js +2 -0
  184. package/dist/prepare-target-IES7FXJG.js +2 -0
  185. package/dist/readmodel-FVLRQWZ7.js +2 -0
  186. package/dist/reconcile-cmd-NDLEM54D.js +2 -0
  187. package/dist/reconcile-deps-APR2LE3C.js +4 -0
  188. package/dist/reconcile-engine-C72AP4WS.js +2 -0
  189. package/dist/recording-banner-AZOKNSU3.js +2 -0
  190. package/dist/{records-TJJJWBUD.js → records-LMCVKPE5.js} +1 -1
  191. package/dist/registry-W3BMHQDQ.js +2 -0
  192. package/dist/{require-project-folder-ZLKONKKP.js → require-project-folder-LTVPPY3Q.js} +1 -1
  193. package/dist/{resolve-run-intent-3SXUS676.js → resolve-run-intent-XX6O3RYT.js} +1 -1
  194. package/dist/{resolver-G7NGWACO.js → resolver-XMASFMID.js} +1 -1
  195. package/dist/revert-NOUECRW4.js +2 -0
  196. package/dist/review-cmd-4TNBQDJU.js +5 -0
  197. package/dist/run-EOIV3OQE.js +2 -0
  198. package/dist/run-XXA7ILIM.js +2 -0
  199. package/dist/run-test-md-GVRVMPRZ.js +17 -0
  200. package/dist/{sessions-cmd-DV442ZCY.js → sessions-cmd-IV25N2L7.js} +1 -1
  201. package/dist/skill-installer-AWQT3LM2.js +3 -0
  202. package/dist/{spawner-H6IDWY5U.js → spawner-O3VKHYUY.js} +1 -1
  203. package/dist/store-guard-MHWBXA4C.js +2 -0
  204. package/dist/{structured-answers-NADW6D44.js → structured-answers-3C2DCFFF.js} +1 -1
  205. package/dist/sync-cmd-P2CL6YA6.js +2 -0
  206. package/dist/sync-setup-JY4T2X3M.js +2 -0
  207. package/dist/tcg-generate-GWLHZYLF.js +2 -0
  208. package/dist/testmd-actions-SYMNRTK4.js +2 -0
  209. package/dist/{testmd-sync-2CXNIPJ7.js → testmd-sync-IRV44CGT.js} +1 -1
  210. package/dist/token-refresh-IM6ELK6S.js +2 -0
  211. package/dist/{validate-basic-MN5NDCT2.js → validate-basic-A5TEMJNT.js} +1 -1
  212. package/dist/{variable-receipt-SIABUC74.js → variable-receipt-QDP2S5CQ.js} +1 -1
  213. package/dist/verdicts-H755EUQL.js +2 -0
  214. package/dist/{version-check-TDGK5REB.js → version-check-26W5GVBQ.js} +1 -1
  215. package/dist/{view-cmd-RLO7AP4X.js → view-cmd-D3BYBDZE.js} +1 -1
  216. package/dist/walk-session-ZZ26LEQE.js +2 -0
  217. package/dist/with-telemetry-UE6SYQWL.js +2 -0
  218. package/package.json +11 -11
  219. package/dist/EvidenceViewOffer-ABKTGD4K.js +0 -2
  220. package/dist/FolderPicker-RQIVS7ZR.js +0 -2
  221. package/dist/SingleShotApp-TZZ2J7ZO.js +0 -2
  222. package/dist/TestMdRunView-2YVGGFLU.js +0 -2
  223. package/dist/WhoamiView-F4PPB7SN.js +0 -2
  224. package/dist/bootstrap-RCDB5OWA.js +0 -2
  225. package/dist/bridge-E2NGMJYM.js +0 -2
  226. package/dist/chat-committer-HDE3TP5I.js +0 -2
  227. package/dist/chat-controller-3EPK7UZG.js +0 -2
  228. package/dist/chunk-3AVBUEBL.js +0 -8
  229. package/dist/chunk-4PMZ5FCD.js +0 -2
  230. package/dist/chunk-4WEVTED6.js +0 -3
  231. package/dist/chunk-7XMDCGIZ.js +0 -3
  232. package/dist/chunk-AKX4VRRR.js +0 -2
  233. package/dist/chunk-CRZUBDJ3.js +0 -6
  234. package/dist/chunk-FFVNISYH.js +0 -2
  235. package/dist/chunk-FWPRUGJJ.js +0 -368
  236. package/dist/chunk-GP7WD4UY.js +0 -4
  237. package/dist/chunk-HOA4VWSD.js +0 -5
  238. package/dist/chunk-JUJ4SAGH.js +0 -2
  239. package/dist/chunk-L2TV4G56.js +0 -4
  240. package/dist/chunk-NMBFAIXZ.js +0 -2
  241. package/dist/chunk-O25AL4B7.js +0 -5
  242. package/dist/chunk-RCYYE6ED.js +0 -2
  243. package/dist/chunk-TNBF5OMZ.js +0 -2
  244. package/dist/chunk-UHT5SVP5.js +0 -2
  245. package/dist/chunk-VWOAEF7J.js +0 -2
  246. package/dist/chunk-YMLC55J4.js +0 -2
  247. package/dist/chunk-YYYQ5MVD.js +0 -6
  248. package/dist/committer-IYQPXG6C.js +0 -2
  249. package/dist/cover-cmd-J3CTQT3R.js +0 -3
  250. package/dist/descriptor-PWUUNYV7.js +0 -2
  251. package/dist/design-committer-J57IAAA5.js +0 -2
  252. package/dist/dispatch-KOZAJQDW.js +0 -2
  253. package/dist/evidence-KRNDKDCT.js +0 -2
  254. package/dist/evolve-cmd-CEYGGIWA.js +0 -2
  255. package/dist/feeder-RSHMGW6B.js +0 -2
  256. package/dist/gaps-cmd-WL6P6YKS.js +0 -3
  257. package/dist/ingest-QGLVY7ND.js +0 -2
  258. package/dist/ingest-cmd-TQ4ARSDE.js +0 -2
  259. package/dist/install-47CRHVU6.js +0 -2
  260. package/dist/interactive-bind-FPC4RYEW.js +0 -26
  261. package/dist/lifecycle-cmd-DB5EFO2O.js +0 -2
  262. package/dist/list-cmd-UWGJRGKF.js +0 -3
  263. package/dist/logical-ids-DN6IZSUM.js +0 -2
  264. package/dist/login-flow-RSNR5HY2.js +0 -2
  265. package/dist/maintenance-cmd-EJ2RAMWB.js +0 -2
  266. package/dist/open-provider-XIGABCD3.js +0 -2
  267. package/dist/phase-seed-HKJ2EF7R.js +0 -2
  268. package/dist/pipeline-XDWHEZ5S.js +0 -2
  269. package/dist/prepare-target-NR3MTLLI.js +0 -2
  270. package/dist/readmodel-IBFRM6EO.js +0 -2
  271. package/dist/reconcile-cmd-VJPEY7YD.js +0 -2
  272. package/dist/reconcile-deps-T5YX6HRG.js +0 -4
  273. package/dist/reconcile-engine-GELPXSLV.js +0 -2
  274. package/dist/recording-banner-3ET3PMSV.js +0 -3
  275. package/dist/registry-3XMA4FOC.js +0 -2
  276. package/dist/revert-6BBBK3I4.js +0 -2
  277. package/dist/review-cmd-6DNGXV5E.js +0 -5
  278. package/dist/run-MUVZVTTC.js +0 -2
  279. package/dist/run-UJLRTKTO.js +0 -2
  280. package/dist/run-test-md-RI5RXVFU.js +0 -17
  281. package/dist/skill-installer-CAO2NJZP.js +0 -3
  282. package/dist/store-guard-PIA2DYZX.js +0 -2
  283. package/dist/sync-cmd-VFVTFIIJ.js +0 -2
  284. package/dist/sync-setup-R7BZDE24.js +0 -2
  285. package/dist/tcg-generate-QADJKNYZ.js +0 -2
  286. package/dist/testmd-actions-EXSVQRHQ.js +0 -2
  287. package/dist/token-refresh-5TVNSL4U.js +0 -2
  288. package/dist/verdicts-ZXXBKTOZ.js +0 -2
  289. package/dist/walk-session-ATWNUGHX.js +0 -2
  290. package/dist/with-telemetry-CLSDKQAG.js +0 -2
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ var l="assurance/context@1";var u={source:{hashed:["blob","source_id"],required:["blob","source_id"],enums:{}},usecase:{hashed:["actors","criteria","derived","description","risk","summary","title","value"],required:["derived","risk","title"],enums:{risk:["high","med","low"]}},scenario:{hashed:["case_type","derived","description","intent","parameters","tags","technique_notes","title"],required:["case_type","derived","intent","title"],enums:{case_type:["happy","negative","boundary","edge","security","a11y","perf","i18n"]}},ac:{hashed:["derived","expected_answer","kind","measurable","risk","text"],required:["derived","risk","text"],enums:{risk:["high","med","low"],kind:["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"]}},test:{hashed:["app","check","config","definitionId","derived","objectives_blob","surface_required","target","test_md_blob","title"],required:["definitionId","derived","title"],enums:{}},gap:{hashed:["basis","derived","kind","question","ref","risk","risk_rationale","text","uc"],unhashed:["proposal_id","temp_ref"],required:["derived","kind"],enums:{kind:["ambiguous","incomplete","contradictory","unmeasurable","missing-expected-result","budget-evicted","invariant-unexercised","reconcile_deferred"],risk:["high","med","low"]}},stylenote:{hashed:["derived","learned_from_kind","statement","tags","text"],unhashed:["learned_from"],required:["derived","learned_from_kind","statement"],enums:{learned_from_kind:["edit","directed-edit","mistake","usage"]}}},f={DERIVES:{src:["source"],dst:["usecase","ac","scenario","test"],salient:["anchor","source_cid","source_id"],optionalSalient:["claim"],props:["anchor","claim","quote","source_cid","source_id"],pin:{comparesTo:"source_head"},cardinality:"many",acyclic:!1},belongs_to:{src:["scenario"],dst:["usecase"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src",acyclic:!1},scoped_to:{src:["ac"],dst:["scenario","usecase"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src",acyclic:!1},exercises:{src:["scenario"],dst:["ac"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1},verifies:{src:["test"],dst:["ac"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1},automates:{src:["test"],dst:["scenario"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src-and-dst",acyclic:!1},depends_on:{src:["usecase","scenario"],dst:["usecase","scenario"],salient:[],props:["reason"],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!0},reuses:{src:["test"],dst:["test"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!0},annotates:{src:["gap","stylenote"],dst:["source","usecase","scenario","ac","test"],salient:[],props:["reason"],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1}},g=["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"];var E={presence:{operators:["exists","forall"],baseline:"null",requires:[]},"forbidden-presence":{operators:["exists","forall"],baseline:"null",requires:[]},count:{operators:["equals","gte","lte"],baseline:"null",requires:[],operand_forms:["literal","derived"]},delta:{operators:["changed-by"],baseline:"required",requires:[]},"state-transition":{operators:["changed-by","equals"],baseline:"required",requires:[]},absolute:{operators:["equals","contains","gte","lte"],baseline:"null",requires:[]},bound:{operators:["gte","lte"],baseline:"null",requires:[]},propagation:{operators:["exists","equals"],baseline:"null",requires:[]},latency:{operators:["lte"],baseline:"null",requires:["within"]},graded:{operators:["gte"],baseline:"null",requires:["metric","threshold"]}};function y(s){let n=/^design@(\d+)$/.exec(s??"");return n?Number(n[1]):0}var h=new Set(["unmeasurable","budget-evicted"]),m=Object.freeze({SOURCE:"source",USECASE:"usecase",SCENARIO:"scenario",AC:"ac",TEST:"test",GAP:"gap",STYLENOTE:"stylenote"}),S=Object.freeze({DERIVES:"DERIVES",BELONGS_TO:"belongs_to",SCOPED_TO:"scoped_to",EXERCISES:"exercises",VERIFIES:"verifies",AUTOMATES:"automates",DEPENDS_ON:"depends_on",REUSES:"reuses",ANNOTATES:"annotates"});function c(s,n,t){let r=[],e=E[s];if(!e)return r.push({code:"BAD_CHECK",detail:`${t}.kind ${JSON.stringify(s)} not in ${g.join("|")}`}),r;let o=n.operator;o!==void 0&&!e.operators.includes(o)&&r.push({code:"BAD_CHECK",detail:`${t}: operator ${JSON.stringify(o)} illegal for kind "${String(s)}" (legal: ${e.operators.join("|")})`});for(let a of e.requires)(n[a]===void 0||n[a]===null||n[a]==="")&&r.push({code:"BAD_CHECK",detail:`${t}: kind "${String(s)}" requires "${a}"`});e.baseline==="null"&&n.baseline!==void 0&&n.baseline!==null&&r.push({code:"BAD_CHECK",detail:`${t}: kind "${String(s)}" must carry baseline null (only delta/state-transition have one)`});let i=n.operand;if(i!==null&&typeof i=="object"&&!Array.isArray(i)){let a=Object.keys(i),d=i.derived;(!(e.operand_forms?.includes("derived")??!1)||a.length!==1||a[0]!=="derived"||typeof d!="string"||!d.trim())&&r.push({code:"BAD_CHECK",detail:`${t}: object operand is only the count derivation form {derived: "<how the runtime value is computed>"}`})}return r}function k(s,n){let t=u[s];if(!t)return[{code:"UNKNOWN_LABEL",detail:`unknown node label ${JSON.stringify(s)}`}];let r=[];for(let e of Object.keys(n))n[e]!==void 0&&!t.hashed.includes(e)&&!(t.unhashed??[]).includes(e)&&r.push({code:"UNKNOWN_FIELD",detail:`${s}.${e} is not in the ${l} schema`});for(let e of t.required)(n[e]===void 0||n[e]===null)&&r.push({code:"MISSING_FIELD",detail:`${s}.${e} is required`});for(let[e,o]of Object.entries(t.enums)){let i=n[e];i!==void 0&&!o.includes(i)&&r.push({code:"BAD_ENUM",detail:`${s}.${e} ${JSON.stringify(i)} not in ${o.join("|")}`})}if(s==="test"&&n.check&&typeof n.check=="object"){let e=n.check;r.push(...c(e.kind,e,"test.check"))}if(s==="ac"&&n.expected_answer&&typeof n.expected_answer=="object"){let e=n.expected_answer;r.push(...c(n.kind??e.kind,e,"ac.expected_answer"))}return r}function p(s){return f[s]}function N(s,n,t,r){let e=p(s);if(!e)return[{code:"UNKNOWN_EDGE_TYPE",detail:`unknown edge type ${JSON.stringify(s)}`}];let o=[];e.src.includes(n)||o.push({code:"ILLEGAL_EDGE",detail:`${s} src must be ${e.src.join("|")}, got ${n}`}),e.dst.includes(t)||o.push({code:"ILLEGAL_EDGE",detail:`${s} dst must be ${e.dst.join("|")}, got ${t}`}),s==="depends_on"&&n!==t&&o.push({code:"ILLEGAL_EDGE",detail:`depends_on links same-label nodes only, got ${n}\u2192${t}`});for(let i of e.salient)(r[i]===void 0||r[i]===null)&&o.push({code:"MISSING_SALIENT",detail:`${s}.props.${i} is salient (inside the ecid) and required`});for(let i of Object.keys(r))r[i]!==void 0&&(e.props.includes(i)||o.push({code:"UNKNOWN_EDGE_PROP",detail:`${s}.props.${i} is not in the ${l} schema`}));return o}function b(s,n){let t=u[s];if(!t)return n;let r={};for(let e of t.hashed)n[e]!==void 0&&(r[e]=n[e]);return r}function O(s,n){let t=p(s);if(!t)return n;let r={};for(let e of t.salient)n[e]!==void 0&&(r[e]=n[e]);for(let e of t.optionalSalient??[])n[e]!==void 0&&(r[e]=n[e]);return r}export{l as a,u as b,f as c,y as d,h as e,m as f,S as g,k as h,p as i,N as j,b as k,O as l};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as V}from"./chunk-F2XTOZTN.js";import{existsSync as R,readdirSync as D,readFileSync as S}from"fs";import{join as b}from"path";var T="--variables",E=["global","smart","environment","secrets","totp"],F=/^[a-z][a-z0-9_]*$/;function M(e){return typeof e=="string"?e.trim().length>0:typeof e=="number"&&Number.isFinite(e)}function p(e,t,n){let r=JSON.parse(e);if(!(!r||typeof r!="object")){for(let[o,i]of Object.entries(r))if(i&&typeof i=="object"&&"value"in i){let c={has_value:M(i.value),source:t};n.set(u(o),c)}}}function w(e,t){if(!R(e))return;let n;try{n=D(e).filter(r=>r.endsWith(".json")).sort()}catch{return}for(let r of n){let o=b(e,r);try{p(S(o,"utf-8"),o,t)}catch{}}}function W(e){return{globalDir:b(V,"variables"),localDir:b(e,".testmuai","variables")}}function q(e){let t=new Map;if(w(e.globalDir,t),w(e.localDir,t),e.file&&R(e.file))try{p(S(e.file,"utf-8"),e.file,t)}catch{}if(e.inline)try{p(e.inline,T,t)}catch{}return t}function m(e){let t=e.trim();if(!t)return null;let n=t.split(/[.[]/).map(r=>r.trim()).filter(Boolean);return n.length===0||E.includes(n[0])?null:n[0]}function u(e){let t=/^(?:global|secrets\.user|environment)\.(.+)$/.exec(e);return t?t[1]:e}function H(e){if(!e||!e.trim())return"variable name is empty";let t=e.split(".")[0];return E.includes(t)?`'${e}' starts with a runtime namespace (global/secrets/smart/environment/totp) \u2014 declare the bare name`:F.test(e)?null:`'${e}' is not lower_snake_case (letters, digits, underscores; starts with a letter)`}import{basename as z}from"path";var ee="objective",C=/(\\?)\{\{\s*([^{}]+?)\s*\}\}/g;function v(e){let t=[];if(!e)return t;for(let n of e.matchAll(C)){if(n[1])continue;let r=m(n[2]??"");r&&!t.includes(r)&&t.push(r)}return t}var $=/(\\?)\$\{\s*([^{}]+?)\s*\}/g;function B(e){let t=[];if(!e)return t;for(let n of e.matchAll($)){if(n[1])continue;let r=(n[2]??"").split(/[.[]/)[0]?.trim()??"";r&&!t.includes(r)&&t.push(r)}return t}function te(e,t,n){return U(e.map(({text:r,usedBy:o})=>B(r).filter(i=>!t.has(i)).map(i=>({name:i,reason:"not_a_dataset_column",dataset:n,used_by:[o]}))))}var P=/\b(?:store|save|extract|remember|capture)\b/i,Z=/\bas\s+(?:['"`]([A-Za-z_][A-Za-z0-9_]*)['"`]|([A-Za-z_][A-Za-z0-9_]*)(?=\s*(?:,|$)))/gi,J=new Set(["a","an","the"]);function I(e){let t=[];if(!e)return t;for(let n of e.split(/[.;\n]/))if(P.test(n))for(let r of n.matchAll(Z)){let o=r[1]??r[2];!o||J.has(o.toLowerCase())||t.includes(o)||t.push(o)}return t}function A(e,t,n){let r=t.get(e);return r?r.has_value?null:{name:e,reason:"value_missing",file:r.source,used_by:[n]}:{name:e,reason:"not_declared",used_by:[n]}}function re(e,t,n,r=[]){let o=new Set([...r,...I(e)]),i=[];for(let c of v(e)){if(o.has(c))continue;let l=A(c,t,n);l&&i.push(l)}return i}function ne(e,t,n={}){let r=e.rootGlobal.variables??{},o=new Set(n.produced??[]),i=n.authorFrom??0,c=[];for(let l of e.steps){let k=l.flatIndex-1>=i,f=I(l.objective);if(!k){for(let s of f)o.add(s);continue}let j={file:z(l.sourceFile),step:l.flatIndex},N=l.config.variables??{},d=new Map,_=s=>m(u(s))??u(s);for(let[s,a]of Object.entries(r))d.set(_(s),a.value);for(let[s,a]of Object.entries(N))d.set(_(s),a.value);let g=new Set,y=(s,a)=>{if(o.has(s)||f.includes(s))return;let h=d.get(s);if(h===void 0){g.add(s);return}if(a.has(s)){g.add(s);return}a.add(s);for(let O of v(h))y(O,a);a.delete(s)};for(let s of v(l.objective))y(s,new Set);let x=[];for(let s of g){let a=A(s,t,j);a&&x.push(a)}c.push(x);for(let s of f)o.add(s)}return U(c)}function se(e){let t=new Set,n=e&&typeof e=="object"?e:null;for(let r of n?.prior_runs??[])for(let o of Object.keys(r.variables??{}))t.add(o);return[...t]}function U(e){let t=new Map;for(let n of e)for(let r of n){let o=t.get(r.name);o?o.used_by.push(...r.used_by):t.set(r.name,{...r,used_by:[...r.used_by]})}return[...t.values()].sort((n,r)=>n.name<r.name?-1:1)}export{T as a,W as b,q as c,H as d,ee as e,v as f,te as g,re as h,ne as i,se as j,U as k};
2
+ import{b as V}from"./chunk-UQ6A52ML.js";import{existsSync as R,readdirSync as D,readFileSync as S}from"fs";import{join as b}from"path";var T="--variables",E=["global","smart","environment","secrets","totp"],F=/^[a-z][a-z0-9_]*$/;function M(e){return typeof e=="string"?e.trim().length>0:typeof e=="number"&&Number.isFinite(e)}function p(e,t,n){let r=JSON.parse(e);if(!(!r||typeof r!="object")){for(let[o,i]of Object.entries(r))if(i&&typeof i=="object"&&"value"in i){let c={has_value:M(i.value),source:t};n.set(u(o),c)}}}function w(e,t){if(!R(e))return;let n;try{n=D(e).filter(r=>r.endsWith(".json")).sort()}catch{return}for(let r of n){let o=b(e,r);try{p(S(o,"utf-8"),o,t)}catch{}}}function W(e){return{globalDir:b(V,"variables"),localDir:b(e,".testmuai","variables")}}function q(e){let t=new Map;if(w(e.globalDir,t),w(e.localDir,t),e.file&&R(e.file))try{p(S(e.file,"utf-8"),e.file,t)}catch{}if(e.inline)try{p(e.inline,T,t)}catch{}return t}function m(e){let t=e.trim();if(!t)return null;let n=t.split(/[.[]/).map(r=>r.trim()).filter(Boolean);return n.length===0||E.includes(n[0])?null:n[0]}function u(e){let t=/^(?:global|secrets\.user|environment)\.(.+)$/.exec(e);return t?t[1]:e}function H(e){if(!e||!e.trim())return"variable name is empty";let t=e.split(".")[0];return E.includes(t)?`'${e}' starts with a runtime namespace (global/secrets/smart/environment/totp) \u2014 declare the bare name`:F.test(e)?null:`'${e}' is not lower_snake_case (letters, digits, underscores; starts with a letter)`}import{basename as z}from"path";var ee="objective",C=/(\\?)\{\{\s*([^{}]+?)\s*\}\}/g;function v(e){let t=[];if(!e)return t;for(let n of e.matchAll(C)){if(n[1])continue;let r=m(n[2]??"");r&&!t.includes(r)&&t.push(r)}return t}var $=/(\\?)\$\{\s*([^{}]+?)\s*\}/g;function B(e){let t=[];if(!e)return t;for(let n of e.matchAll($)){if(n[1])continue;let r=(n[2]??"").split(/[.[]/)[0]?.trim()??"";r&&!t.includes(r)&&t.push(r)}return t}function te(e,t,n){return U(e.map(({text:r,usedBy:o})=>B(r).filter(i=>!t.has(i)).map(i=>({name:i,reason:"not_a_dataset_column",dataset:n,used_by:[o]}))))}var P=/\b(?:store|save|extract|remember|capture)\b/i,Z=/\bas\s+(?:['"`]([A-Za-z_][A-Za-z0-9_]*)['"`]|([A-Za-z_][A-Za-z0-9_]*)(?=\s*(?:,|$)))/gi,J=new Set(["a","an","the"]);function I(e){let t=[];if(!e)return t;for(let n of e.split(/[.;\n]/))if(P.test(n))for(let r of n.matchAll(Z)){let o=r[1]??r[2];!o||J.has(o.toLowerCase())||t.includes(o)||t.push(o)}return t}function A(e,t,n){let r=t.get(e);return r?r.has_value?null:{name:e,reason:"value_missing",file:r.source,used_by:[n]}:{name:e,reason:"not_declared",used_by:[n]}}function re(e,t,n,r=[]){let o=new Set([...r,...I(e)]),i=[];for(let c of v(e)){if(o.has(c))continue;let l=A(c,t,n);l&&i.push(l)}return i}function ne(e,t,n={}){let r=e.rootGlobal.variables??{},o=new Set(n.produced??[]),i=n.authorFrom??0,c=[];for(let l of e.steps){let k=l.flatIndex-1>=i,f=I(l.objective);if(!k){for(let s of f)o.add(s);continue}let j={file:z(l.sourceFile),step:l.flatIndex},N=l.config.variables??{},d=new Map,_=s=>m(u(s))??u(s);for(let[s,a]of Object.entries(r))d.set(_(s),a.value);for(let[s,a]of Object.entries(N))d.set(_(s),a.value);let g=new Set,y=(s,a)=>{if(o.has(s)||f.includes(s))return;let h=d.get(s);if(h===void 0){g.add(s);return}if(a.has(s)){g.add(s);return}a.add(s);for(let O of v(h))y(O,a);a.delete(s)};for(let s of v(l.objective))y(s,new Set);let x=[];for(let s of g){let a=A(s,t,j);a&&x.push(a)}c.push(x);for(let s of f)o.add(s)}return U(c)}function se(e){let t=new Set,n=e&&typeof e=="object"?e:null;for(let r of n?.prior_runs??[])for(let o of Object.keys(r.variables??{}))t.add(o);return[...t]}function U(e){let t=new Map;for(let n of e)for(let r of n){let o=t.get(r.name);o?o.used_by.push(...r.used_by):t.set(r.name,{...r,used_by:[...r.used_by]})}return[...t.values()].sort((n,r)=>n.name<r.name?-1:1)}export{T as a,W as b,q as c,H as d,ee as e,v as f,te as g,re as h,ne as i,se as j,U as k};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as N,c as O,e as S,f as D,j as T,p as y,r as z,t as U}from"./chunk-L45HDSJ7.js";import{a as Y,b as M}from"./chunk-NBXYL2JT.js";import{a as F}from"./chunk-CAOZKSQ3.js";import{a as R}from"./chunk-DHJSM5DT.js";import{a as A}from"./chunk-F2XTOZTN.js";import{e as $}from"./chunk-UR6MHSHU.js";var C=$(Y(),1);import{existsSync as k,readFileSync as I,readdirSync as J,statSync as K}from"fs";import{dirname as H,isAbsolute as V,join as h,relative as P,resolve as Z,sep as _}from"path";import{createHash as q}from"crypto";var b="testmd-bundle.json",u=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},B=e=>e.split(_).join("/");function v(e){if(!k(e))return[];let t=[];for(let s of J(e).sort()){let r=h(e,s);K(r).isDirectory()?t.push(...v(r)):t.push(r)}return t}function G(e){let t=e.map(r=>H(r).split(_)),s=t[0];for(let r of t.slice(1)){let i=0;for(;i<s.length&&i<r.length&&s[i]===r[i];)i++;s=s.slice(0,i)}return s.join(_)||_}function Q(e){for(let t of e){let s=F(t,I(t,"utf8"));for(let r of s.steps)if(r.body.kind==="import_ref"&&V(r.body.path))throw new u(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function j(e,t={}){let s=Z(e),r=S(s),i=y(s);if(!i?.commit_id||!i?.test_id)throw new u(`bundle sync: ${s} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let l;try{l=U(s)}catch(n){throw n instanceof z?new u(`bundle sync: ${n.message}`):n}let c=[s];for(let n of l.steps)for(let a of n.trace.slice(1))c.includes(a.file)||c.push(a.file);Q(c);let o=[],d=[];for(let n of l.unitFiles){if(n.file===s)continue;let a=N(n.file);o.includes(a)||o.push(a),n.kind==="module"&&d.push(S(n.file))}let m=[...c],p=n=>{k(n)&&m.push(n)};p(O(s)),m.push(r),p(D(s)),m.push(...v(T(s)));for(let n of o)p(h(n,"Result.md")),m.push(...v(h(n,".internal","steps")));for(let n of d)p(n);let f=G(m);if(k(h(f,b)))throw new u(`bundle sync: a real file named ${b} exists at the zip root (${f}) \u2014 it would collide with the generated manifest`);let w=m.map(n=>{let a=n===r&&t.identityOverride?Buffer.from(JSON.stringify({...JSON.parse(I(n,"utf8")),commit_id:t.identityOverride.commit_id},null,2)+`
2
+ import{b as N,c as O,e as S,f as D,j as T,p as y,r as z,t as U}from"./chunk-L45HDSJ7.js";import{a as Y,b as M}from"./chunk-NBXYL2JT.js";import{a as F}from"./chunk-CAOZKSQ3.js";import{a as R}from"./chunk-DHJSM5DT.js";import{a as A}from"./chunk-UQ6A52ML.js";import{e as $}from"./chunk-UR6MHSHU.js";var C=$(Y(),1);import{existsSync as k,readFileSync as I,readdirSync as J,statSync as K}from"fs";import{dirname as H,isAbsolute as V,join as h,relative as P,resolve as Z,sep as _}from"path";import{createHash as q}from"crypto";var b="testmd-bundle.json",u=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},B=e=>e.split(_).join("/");function v(e){if(!k(e))return[];let t=[];for(let s of J(e).sort()){let r=h(e,s);K(r).isDirectory()?t.push(...v(r)):t.push(r)}return t}function G(e){let t=e.map(r=>H(r).split(_)),s=t[0];for(let r of t.slice(1)){let i=0;for(;i<s.length&&i<r.length&&s[i]===r[i];)i++;s=s.slice(0,i)}return s.join(_)||_}function Q(e){for(let t of e){let s=F(t,I(t,"utf8"));for(let r of s.steps)if(r.body.kind==="import_ref"&&V(r.body.path))throw new u(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function j(e,t={}){let s=Z(e),r=S(s),i=y(s);if(!i?.commit_id||!i?.test_id)throw new u(`bundle sync: ${s} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let l;try{l=U(s)}catch(n){throw n instanceof z?new u(`bundle sync: ${n.message}`):n}let c=[s];for(let n of l.steps)for(let a of n.trace.slice(1))c.includes(a.file)||c.push(a.file);Q(c);let o=[],d=[];for(let n of l.unitFiles){if(n.file===s)continue;let a=N(n.file);o.includes(a)||o.push(a),n.kind==="module"&&d.push(S(n.file))}let m=[...c],p=n=>{k(n)&&m.push(n)};p(O(s)),m.push(r),p(D(s)),m.push(...v(T(s)));for(let n of o)p(h(n,"Result.md")),m.push(...v(h(n,".internal","steps")));for(let n of d)p(n);let f=G(m);if(k(h(f,b)))throw new u(`bundle sync: a real file named ${b} exists at the zip root (${f}) \u2014 it would collide with the generated manifest`);let w=m.map(n=>{let a=n===r&&t.identityOverride?Buffer.from(JSON.stringify({...JSON.parse(I(n,"utf8")),commit_id:t.identityOverride.commit_id},null,2)+`
3
3
  `):void 0,E=a??I(n);return{abs:n,rel:B(P(f,n)),sha256:q("sha256").update(E).digest("hex"),bytes:E.length,...a?{contents:a}:{}}}).sort((n,a)=>n.rel<a.rel?-1:1),x=B(P(f,s)),L={schema_version:2,entry:x,commit_id:t.identityOverride?.commit_id??i.commit_id,test_id:i.test_id,testcase_id:i.testcase_id??null,project_id:i.project_id??null,folder_id:i.folder_id??null,org_id:i.org_id??null,created_at:new Date().toISOString(),producer:{name:"kane-cli",version:A},files:w.map(n=>({path:n.rel,sha256:n.sha256,bytes:n.bytes})),units:l.unitFiles.filter(n=>n.file!==s).map(n=>({path:B(P(f,n.file)),kind:n.kind}))};return{zipRoot:f,entry:x,files:w,manifest:L}}var g=e=>e instanceof Error?e.message:String(e);function W(e){return new Promise((t,s)=>{let r=(0,C.default)("zip",{zlib:{level:6}}),i=[];r.on("data",l=>i.push(l)),r.on("error",s),r.on("end",()=>t(Buffer.concat(i))),r.append(JSON.stringify(e.manifest,null,2)+`
4
4
  `,{name:b});for(let l of e.files)l.contents?r.append(l.contents,{name:l.rel}):r.file(l.abs,{name:l.rel});r.finalize()})}async function X(e){let{plan:t,controller:s,testId:r,sessionId:i,commitId:l}=e,c;try{c=await W(t)}catch(d){return{ok:!1,stage:"zip",error:g(d)}}let o;try{let d={key:"testmd",content_type:"application/zip",filename:`${l}-testmd.zip`},p=(await s.getPresignedUrls(r,i,[d])).urls?.testmd?.upload_url;if(!p)return{ok:!1,stage:"presign",error:"presign response missing testmd upload_url"};o=p}catch(d){return{ok:!1,stage:"presign",error:g(d)}}try{await M(o,c,"application/zip")}catch(d){return{ok:!1,stage:"upload",error:g(d)}}return{ok:!0,bytes:c.length}}async function ee(e){let t;try{t=j(e.sourcePath,{identityOverride:e.identityOverride})}catch(s){return s instanceof u?{ok:!1,stage:"collect",error:s.message}:{ok:!1,stage:"collect",error:g(s)}}return X({...e,plan:t})}function ge(e){return e.shouldUploadPipeline&&e.uploadSucceeded&&!!e.metaCommitId&&!!e.metaTestId}function te(e){return e.persisted?e.uploadSucceeded?e.local?"local":e.hasBasicAuth?!e.metaCommitId||!e.metaTestId?"not_authored":null:"no_auth":"upload_failed":"not_persisted"}async function ye(e){let t=e.recordedTestPath??null,s=t?y(t):null,r=te({persisted:!!t,uploadSucceeded:e.uploadSucceeded,local:e.local,hasBasicAuth:!!e.basicAuth,metaCommitId:s?.commit_id,metaTestId:s?.test_id});if(r)return e.log("info","BUNDLE_SYNC_SKIPPED","testmd bundle sync skipped",{reason:r,...t?{path:t}:{}}),{skipped:r};let i=s.commit_id,l=s.test_id,c=o=>{try{e.onAgentEvent?.(o)}catch{}};try{let o=await(e.syncFn??ee)({sourcePath:t,testId:l,sessionId:e.sessionId,commitId:i,controller:new R(e.controllerBaseUrl,{username:e.basicAuth.username,accessKey:e.basicAuth.access_key})});return o.ok?(e.log("info","BUNDLE_SYNC_OK","testmd bundle pushed",{commit_id:i,path:t,bytes:o.bytes}),c({type:"test_md_bundle_sync",status:"ok",commit_id:i,path:t,bytes:o.bytes})):(e.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync failed",{commit_id:i,path:t,stage:o.stage,error:o.error}),c({type:"test_md_bundle_sync",status:"failed",commit_id:i,path:t,stage:o.stage})),o}catch(o){let d=g(o);return e.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync threw",{commit_id:i,path:t,error:d}),c({type:"test_md_bundle_sync",status:"failed",commit_id:i,path:t,stage:"upload"}),{ok:!1,stage:"upload",error:d}}}export{j as a,W as b,X as c,ee as d,ge as e,te as f,ye as g};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Ve}from"./chunk-23MVD7GY.js";import{a as Ye}from"./chunk-MD3S2RXN.js";import{a as We}from"./chunk-YCCUBQY4.js";import{a as qe}from"./chunk-VE3SUJMA.js";import{a as be}from"./chunk-U7BVK5IX.js";import{a as Ge}from"./chunk-KPL2XHYF.js";import{a as He}from"./chunk-BCJNIDS3.js";import{b as Le,y as u}from"./chunk-F2XTOZTN.js";import{a as re}from"./chunk-HCBYKLMW.js";import{a as h,b as f,h as Fe,i as Se,k as Ne}from"./chunk-C44QQJR4.js";import{a as we}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var je=$(we(),1);import{readFileSync as ct,writeFileSync as ut,mkdirSync as ft}from"fs";import{dirname as dt,join as ze}from"path";var mt=ze(Le,"command-history.json"),Dt=ze(Le,"generate-history.json"),ht=200,De=class{entries;filePath;max;constructor(t=mt,e=ht){this.filePath=t,this.max=e,this.entries=this._load()}push(t){this.entries.length>0&&this.entries[this.entries.length-1]===t||(this.entries.push(t),this.entries.length>this.max&&(this.entries=this.entries.slice(this.entries.length-this.max)),this._save())}getAll(){return[...this.entries]}search(t){let e=t.toLowerCase(),o=[];for(let s=this.entries.length-1;s>=0;s--)this.entries[s].toLowerCase().includes(e)&&o.push(this.entries[s]);return o}_load(){if(this.filePath===null)return[];try{let t=ct(this.filePath,"utf-8"),e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}_save(){if(this.filePath!==null)try{ft(dt(this.filePath),{recursive:!0}),ut(this.filePath,JSON.stringify(this.entries)+`
2
+ import{a as Ve}from"./chunk-GESZSIB6.js";import{a as Ye}from"./chunk-SYKS57PK.js";import{a as We}from"./chunk-YCCUBQY4.js";import{a as qe}from"./chunk-VE3SUJMA.js";import{a as be}from"./chunk-YPEIPCQY.js";import{a as Ge}from"./chunk-WAZUOA3Y.js";import{a as He}from"./chunk-RBVLIMOV.js";import{b as Le,y as u}from"./chunk-UQ6A52ML.js";import{a as re}from"./chunk-HCBYKLMW.js";import{a as h,b as f,h as Fe,i as Se,k as Ne}from"./chunk-C44QQJR4.js";import{a as we}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var je=$(we(),1);import{readFileSync as ct,writeFileSync as ut,mkdirSync as ft}from"fs";import{dirname as dt,join as ze}from"path";var mt=ze(Le,"command-history.json"),Dt=ze(Le,"generate-history.json"),ht=200,De=class{entries;filePath;max;constructor(t=mt,e=ht){this.filePath=t,this.max=e,this.entries=this._load()}push(t){this.entries.length>0&&this.entries[this.entries.length-1]===t||(this.entries.push(t),this.entries.length>this.max&&(this.entries=this.entries.slice(this.entries.length-this.max)),this._save())}getAll(){return[...this.entries]}search(t){let e=t.toLowerCase(),o=[];for(let s=this.entries.length-1;s>=0;s--)this.entries[s].toLowerCase().includes(e)&&o.push(this.entries[s]);return o}_load(){if(this.filePath===null)return[];try{let t=ct(this.filePath,"utf-8"),e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}_save(){if(this.filePath!==null)try{ft(dt(this.filePath),{recursive:!0}),ut(this.filePath,JSON.stringify(this.entries)+`
3
3
  `)}catch{}}};function kt(n){let t=(0,je.useRef)(null);return t.current||(t.current=new De(n)),t.current}var D=$(we(),1);var ke=$(we(),1);var Z=$(re(),1);function Xe({history:n,onSelect:t,onClose:e}){let[o,s]=(0,ke.useState)(""),[l,m]=(0,ke.useState)(0),v=o?n.search(o).slice(0,8):[];return Se((b,d)=>{if(d.escape){e();return}if(d.return){v.length>0&&v[l]?t(v[l]):e();return}if(d.upArrow){m(S=>Math.max(0,S-1));return}if(d.downArrow){m(S=>Math.min(v.length-1,S+1));return}if(d.backspace||d.delete){s(S=>S.slice(0,-1)),m(0);return}b&&!d.ctrl&&!d.meta&&(s(S=>S+b),m(0))}),(0,Z.jsxs)(h,{flexDirection:"column",marginLeft:2,borderStyle:"single",paddingX:1,children:[(0,Z.jsx)(f,{color:u.muted,bold:!0,children:"reverse search"}),(0,Z.jsxs)(h,{gap:1,children:[(0,Z.jsx)(f,{color:u.dim,children:"search:"}),(0,Z.jsx)(f,{children:o}),(0,Z.jsx)(f,{color:u.orange,children:"\u2588"})]}),v.length>0&&(0,Z.jsx)(f,{children:" "}),v.map((b,d)=>(0,Z.jsx)(h,{marginLeft:2,children:(0,Z.jsxs)(f,{color:d===l?u.orange:u.dim,bold:d===l,children:[d===l?"\u25B8 ":" ",b]})},`${d}-${b}`))]})}var X=$(re(),1);function Je({commands:n,selectedIndex:t}){return n.length===0?null:(0,X.jsx)(h,{flexDirection:"column",marginBottom:0,children:n.map((e,o)=>{let s=o===t;return e.disabled?(0,X.jsxs)(h,{children:[(0,X.jsx)(f,{color:u.dim,children:s?"\u276F ":" "}),(0,X.jsxs)(f,{color:u.dim,children:["/",e.name]}),(0,X.jsxs)(f,{color:u.dim,children:[" ",e.disabledReason??e.description]})]},e.name):(0,X.jsxs)(h,{children:[(0,X.jsx)(f,{color:s?u.orange:u.dim,children:s?"\u276F ":" "}),(0,X.jsxs)(f,{color:s?u.orange:void 0,bold:s,children:["/",e.name]}),e.args&&(0,X.jsxs)(f,{color:u.dim,children:[" ",e.args]}),(0,X.jsxs)(f,{color:u.dim,children:[" ",e.description]})]},e.name)})})}var Ze=$(we(),1);var q=$(re(),1),et={scenario:"Scenarios",case:"Test Cases",file:"Files",artifact:"Artifact candidates",installed:"Installed on device"};function Qe(n){let t={scenario:0,case:0,file:0,artifact:0,installed:0};for(let e of n)t[e.kind]++;return["scenario","case","file","artifact","installed"].filter(e=>t[e]>0).map(e=>`${t[e]} ${et[e]}`).join(" \xB7 ")}var Pe=7;function tt({items:n,selectedIndex:t,accent:e=u.orange}){let o=n.length;if(o===0)return null;let s=Math.floor(Pe/2),l=o<=Pe?0:Math.max(0,Math.min(t-s,o-Pe)),m=Math.min(o,l+Pe),v=l,b=o-m;return(0,q.jsxs)(h,{flexDirection:"column",marginBottom:0,children:[v>0&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:` \u22EF ${v} above \u2014 ${Qe(n.slice(0,l))}`})}),n.slice(l,m).map((d,S)=>{let U=l+S,F=d.selectable!==!1,E=U===t&&F,R=S===0||n[U-1].kind!==d.kind;return(0,q.jsxs)(Ze.default.Fragment,{children:[R&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:et[d.kind]})}),(0,q.jsxs)(h,{children:[(0,q.jsx)(f,{color:E?e:u.dim,children:E?"\u276F ":" "}),(0,q.jsxs)(f,{color:E?e:F?void 0:u.dim,bold:E,children:[d.label,d.reason?` \u2014 ${d.reason}`:""]})]})]},`${d.kind}:${d.value}:${U}`)}),b>0&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:` \u22EF ${b} more \u2014 ${Qe(n.slice(m))}`})})]})}var Be=$(we(),1);var gt=27,pt=127,xt=11;function bt(n){return n>=64&&n<=126}function Tt(n,t){n===xt&&t({killToEnd:!0,ctrl:!0,raw:String.fromCharCode(n)})}function vt(n,t){n===pt&&t({backspace:!0,meta:!0,raw:"\x1B\x7F"})}function wt(n,t){let e=n.map(s=>String.fromCharCode(s)).join(""),o=/^\[1;([0-9]+)([A-D])$/.exec(e);if(o){let s=parseInt(o[1],10),l=o[2],m={raw:"\x1B"+e};if(s===2)m.shift=!0;else if(s===3)m.meta=!0;else if(s===5)m.ctrl=!0;else return;l==="A"?m.arrowUp=!0:l==="B"?m.arrowDown=!0:l==="C"?m.arrowRight=!0:l==="D"&&(m.arrowLeft=!0),t(m);return}if(e==="[H"||e==="[1~"||e==="[7~"){t({home:!0,raw:"\x1B"+e});return}if(e==="[F"||e==="[4~"||e==="[8~"){t({end:!0,raw:"\x1B"+e});return}if(e==="[3;5~"){t({delete:!0,ctrl:!0,raw:"\x1B"+e});return}if(e==="[3;3~"){t({delete:!0,meta:!0,raw:"\x1B"+e});return}}function St(n,t){n===72?t({home:!0,raw:"\x1BO"+String.fromCharCode(n)}):n===70&&t({end:!0,raw:"\x1BO"+String.fromCharCode(n)})}function Et(){let n="IDLE",t=[];function e(){n="IDLE",t=[]}return{feed(o,s){for(let l of o)n==="IDLE"?l===gt?(n="ESC",t=[]):Tt(l,s):n==="ESC"?l===91?(n="CSI",t=[]):l===79?(n="SS3",t=[]):(vt(l,s),e()):n==="CSI"?(t.push(l),bt(l)&&(wt([91,...t],s),e())):n==="SS3"&&(St(l,s),e())},flushIdle(o){n==="ESC"&&t.length===0&&o({raw:"\x1B"}),e()}}}function nt(n,t={}){let e=(0,Be.useRef)(n);e.current=n;let{stdin:o}=Fe();(0,Be.useEffect)(()=>{if(t.isActive===!1||!o)return;let s=Et(),l=null,m=v=>{l&&(clearTimeout(l),l=null);let b=Buffer.isBuffer(v)?v:Buffer.from(v,"binary");s.feed(b,d=>e.current(d)),l=setTimeout(()=>{s.flushIdle(d=>e.current(d)),l=null},50)};return o.on("data",m),()=>{o.removeListener("data",m),l&&clearTimeout(l)}},[t.isActive,o])}var w=$(re(),1);function yt(n,t){let e=t-1;for(;e>=0&&n[e]!=="@"&&n[e]!==" "&&n[e]!==`
4
4
  `;)e--;return e<0||n[e]!=="@"||e>0&&n[e-1]!==" "&&n[e-1]!==`
5
5
  `?null:{at:e,query:n.slice(e+1,t).join("")}}function rt(n,t,e){for(let o=t+e;o>=0&&o<n.length;o+=e)if(n[o]?.selectable!==!1)return o;return t}function At(n){let t=n.findIndex(e=>e.selectable!==!1);return t===-1?0:t}var Oe=10;function Rt(n){return n.replace(/\x1b?\[200~/g,"").replace(/\x1b?\[201~/g,"").replace(/\r\n/g,`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{y as n}from"./chunk-F2XTOZTN.js";import{a as s}from"./chunk-HCBYKLMW.js";import{a,b as i}from"./chunk-C44QQJR4.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(i,{color:n.dim,children:e.join(" \xB7 ")})})}export{g as a};
2
+ import{y as n}from"./chunk-UQ6A52ML.js";import{a as s}from"./chunk-HCBYKLMW.js";import{a,b as i}from"./chunk-C44QQJR4.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(i,{color:n.dim,children:e.join(" \xB7 ")})})}export{g as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as Y,c as W}from"./chunk-PDXZROJM.js";import{S as X}from"./chunk-5ACSALRU.js";import{b as J}from"./chunk-5GUD3CIH.js";import{a as H}from"./chunk-VWOAEF7J.js";import{a as Rt,b as k}from"./chunk-NBXYL2JT.js";import{a as K}from"./chunk-BPMSNGXQ.js";import{a as G}from"./chunk-DHJSM5DT.js";import{a as $}from"./chunk-NLCCBXXV.js";import{a as R}from"./chunk-RZ4F3BHX.js";import{e as kt}from"./chunk-UR6MHSHU.js";import{readFileSync as L,existsSync as z,readdirSync as ue,mkdirSync as V,writeFileSync as w}from"fs";import{readFile as vt,unlink as le}from"fs/promises";import{join as y}from"path";import{existsSync as te,mkdirSync as ee,readdirSync as ht,writeFileSync as ne}from"fs";import{join as S}from"path";import{randomUUID as A}from"crypto";var Q=["children","instructions","branches","module_content","true_branch","false_branch"];function j(e){let t=new Map,n=r=>{if(!r||typeof r!="object")return;let o=r;if(Array.isArray(o.operations))for(let i of o.operations){let s=i.operation_id;if(typeof s!="string"||!s)continue;let a=t.get(s)??[];a.includes(o)||a.push(o),t.set(s,a)}for(let i of Q){let s=o[i];Array.isArray(s)?s.forEach(n):s&&typeof s=="object"&&n(s)}};return e.forEach(n),t}function Pt(e,t){if(!t||t.length===0)return;if(t.length===1)return t[0];let n=e.action_params?.script;if(typeof n=="string"&&n.trim()){let r=n.trim(),o=t.find(i=>St(i)?.trim()===r);if(o)return o}return t[0]}function St(e){let t=e,n=t.script_content??t.js_snippet;return typeof n=="string"?n:void 0}function D(e,t){let n=new Map;for(let r of e){let o=Pt(r,r.action_id?t.get(r.action_id):void 0);if(!o)continue;let i=n.get(o)??[];i.push(r),n.set(o,i)}return n.size===0?null:[...n].map(([r,o])=>Lt(r,o))}function tt(e,t){let n=j(t.authoredInstructions),r=[];for(let o of e){if(o.flatIndex===void 0||!t.replayOnlyFlatIndices.has(o.flatIndex))continue;let i=D(o.records,n);i&&r.push(...i)}return r}function et(e,t){let n=new Map(t.map(a=>[a.instruction_id,a])),r=[],o=a=>{if(!a||typeof a!="object")return;let c=a.instruction_id,u=typeof c=="string"?n.get(c):void 0;return u&&r.push(c),u},i=a=>{if(!a||typeof a!="object")return;let c=a;for(let u of Q){let l=c[u];if(Array.isArray(l))s(l);else if(l&&typeof l=="object"){let _=o(l);_&&(c[u]=_),i(_??l)}}},s=a=>{for(let c=0;c<a.length;c++){let u=o(a[c]);u&&(a[c]=u),i(u??a[c])}};return s(e),r}function wt(e){if(!e.timestamp||e.duration_ms==null)return"";let t=new Date(e.timestamp);return isNaN(t.getTime())?"":new Date(t.getTime()+e.duration_ms).toISOString()}function T(e){if(e!=null)try{return JSON.parse(e)}catch{return e}}function xt(e){return typeof e=="string"?"string":typeof e=="boolean"?"bool":typeof e=="number"?Number.isInteger(e)?"int":"float":Array.isArray(e)?"list":e==null?"NoneType":"JSON"}function C(e,t,n){let r=e.user_variables,o=typeof r=="string",i;try{i=o?JSON.parse(r):r??[]}catch{return}if(!Array.isArray(i)||i.length===0)return;let s=i.find(a=>t&&a.name===t)??(i.length===1?i[0]:void 0);s&&(s.value=n,s.value_type=xt(n),e.user_variables=o?JSON.stringify(i):i)}function Z(e){e.user_variables!==void 0&&(e.user_variables=typeof e.user_variables=="string"?"[]":[])}function Ot(e,t){let n=e.operations??[],r=new Set(t.map(i=>i.action_id).filter(Boolean)),o=n.filter(i=>r.has(i.operation_id));return o.length>0?o:n.length===1?n:[]}function Nt(e){let t=e.error??"Script execution failed";return{error:t,error_code:"SCRIPT_EXECUTION_ERROR",error_message:t,reason:t}}function Lt(e,t){let n=structuredClone(e),r=t[0],o=t[t.length-1];n.status=t.find(s=>s.status!=="success")?.status??r.status,n.start_timestamp=r.timestamp??n.start_timestamp,n.end_timestamp=wt(o)||n.end_timestamp;let i=Ot(n,t);for(let s of i)s.status=n.status,s.operation_start=n.start_timestamp,s.operation_end=n.end_timestamp;switch(n.content_type){case"api":{let s=o.action_params?.api_data?.response;if(s&&typeof s=="object")for(let a of[n,...i])a.api_data={...a.api_data??{},response:s},C(a,o.output_variable,s);break}case"script":{let s=o.output_variable??n.output_variable_name;if(n.status!=="success"){let a=Nt(o);n.code_error=a,Z(n);for(let c of i)c.execution_result=a,c.code_error=a,Z(c)}else if(o.output_value!=null){let a=T(o.output_value);C(n,s,a);for(let c of i)c.execution_result={value:a},C(c,s,a)}break}case"db_query":{o.output_value!=null&&(n.db_details={...n.db_details??{},carried_out_query:T(o.output_value)});break}case"screenshot_command":{let s=T(o.output_value);s&&typeof s=="object"&&(n.smartui_results=s);break}case"network_assertion":case"network_query":break;default:break}return n}var Tt="/home/kaneai/Downloads";function O(e){return`${Tt}/${e}`}function it(e){return"FILE__"+e.replace(/[^A-Za-z0-9]/g,"_")}function N(e){let t=e?.media;return!t||!t.name||!t.media_url?null:{media_id:t.media_id??"",name:t.name,media_url:t.media_url,type:t.type??"doc"}}function ot(e){return e?e.includes(`
2
+ import{b as Y,c as W}from"./chunk-PDXZROJM.js";import{S as X}from"./chunk-VH73F65W.js";import{b as J}from"./chunk-5GUD3CIH.js";import{a as H}from"./chunk-JQ64X2TO.js";import{a as Rt,b as k}from"./chunk-NBXYL2JT.js";import{a as K}from"./chunk-BPMSNGXQ.js";import{a as G}from"./chunk-DHJSM5DT.js";import{a as $}from"./chunk-NLCCBXXV.js";import{a as R}from"./chunk-RZ4F3BHX.js";import{e as kt}from"./chunk-UR6MHSHU.js";import{readFileSync as L,existsSync as z,readdirSync as ue,mkdirSync as V,writeFileSync as w}from"fs";import{readFile as vt,unlink as le}from"fs/promises";import{join as y}from"path";import{existsSync as te,mkdirSync as ee,readdirSync as ht,writeFileSync as ne}from"fs";import{join as S}from"path";import{randomUUID as A}from"crypto";var Q=["children","instructions","branches","module_content","true_branch","false_branch"];function j(e){let t=new Map,n=r=>{if(!r||typeof r!="object")return;let o=r;if(Array.isArray(o.operations))for(let i of o.operations){let s=i.operation_id;if(typeof s!="string"||!s)continue;let a=t.get(s)??[];a.includes(o)||a.push(o),t.set(s,a)}for(let i of Q){let s=o[i];Array.isArray(s)?s.forEach(n):s&&typeof s=="object"&&n(s)}};return e.forEach(n),t}function Pt(e,t){if(!t||t.length===0)return;if(t.length===1)return t[0];let n=e.action_params?.script;if(typeof n=="string"&&n.trim()){let r=n.trim(),o=t.find(i=>St(i)?.trim()===r);if(o)return o}return t[0]}function St(e){let t=e,n=t.script_content??t.js_snippet;return typeof n=="string"?n:void 0}function D(e,t){let n=new Map;for(let r of e){let o=Pt(r,r.action_id?t.get(r.action_id):void 0);if(!o)continue;let i=n.get(o)??[];i.push(r),n.set(o,i)}return n.size===0?null:[...n].map(([r,o])=>Lt(r,o))}function tt(e,t){let n=j(t.authoredInstructions),r=[];for(let o of e){if(o.flatIndex===void 0||!t.replayOnlyFlatIndices.has(o.flatIndex))continue;let i=D(o.records,n);i&&r.push(...i)}return r}function et(e,t){let n=new Map(t.map(a=>[a.instruction_id,a])),r=[],o=a=>{if(!a||typeof a!="object")return;let c=a.instruction_id,u=typeof c=="string"?n.get(c):void 0;return u&&r.push(c),u},i=a=>{if(!a||typeof a!="object")return;let c=a;for(let u of Q){let l=c[u];if(Array.isArray(l))s(l);else if(l&&typeof l=="object"){let _=o(l);_&&(c[u]=_),i(_??l)}}},s=a=>{for(let c=0;c<a.length;c++){let u=o(a[c]);u&&(a[c]=u),i(u??a[c])}};return s(e),r}function wt(e){if(!e.timestamp||e.duration_ms==null)return"";let t=new Date(e.timestamp);return isNaN(t.getTime())?"":new Date(t.getTime()+e.duration_ms).toISOString()}function T(e){if(e!=null)try{return JSON.parse(e)}catch{return e}}function xt(e){return typeof e=="string"?"string":typeof e=="boolean"?"bool":typeof e=="number"?Number.isInteger(e)?"int":"float":Array.isArray(e)?"list":e==null?"NoneType":"JSON"}function C(e,t,n){let r=e.user_variables,o=typeof r=="string",i;try{i=o?JSON.parse(r):r??[]}catch{return}if(!Array.isArray(i)||i.length===0)return;let s=i.find(a=>t&&a.name===t)??(i.length===1?i[0]:void 0);s&&(s.value=n,s.value_type=xt(n),e.user_variables=o?JSON.stringify(i):i)}function Z(e){e.user_variables!==void 0&&(e.user_variables=typeof e.user_variables=="string"?"[]":[])}function Ot(e,t){let n=e.operations??[],r=new Set(t.map(i=>i.action_id).filter(Boolean)),o=n.filter(i=>r.has(i.operation_id));return o.length>0?o:n.length===1?n:[]}function Nt(e){let t=e.error??"Script execution failed";return{error:t,error_code:"SCRIPT_EXECUTION_ERROR",error_message:t,reason:t}}function Lt(e,t){let n=structuredClone(e),r=t[0],o=t[t.length-1];n.status=t.find(s=>s.status!=="success")?.status??r.status,n.start_timestamp=r.timestamp??n.start_timestamp,n.end_timestamp=wt(o)||n.end_timestamp;let i=Ot(n,t);for(let s of i)s.status=n.status,s.operation_start=n.start_timestamp,s.operation_end=n.end_timestamp;switch(n.content_type){case"api":{let s=o.action_params?.api_data?.response;if(s&&typeof s=="object")for(let a of[n,...i])a.api_data={...a.api_data??{},response:s},C(a,o.output_variable,s);break}case"script":{let s=o.output_variable??n.output_variable_name;if(n.status!=="success"){let a=Nt(o);n.code_error=a,Z(n);for(let c of i)c.execution_result=a,c.code_error=a,Z(c)}else if(o.output_value!=null){let a=T(o.output_value);C(n,s,a);for(let c of i)c.execution_result={value:a},C(c,s,a)}break}case"db_query":{o.output_value!=null&&(n.db_details={...n.db_details??{},carried_out_query:T(o.output_value)});break}case"screenshot_command":{let s=T(o.output_value);s&&typeof s=="object"&&(n.smartui_results=s);break}case"network_assertion":case"network_query":break;default:break}return n}var Tt="/home/kaneai/Downloads";function O(e){return`${Tt}/${e}`}function it(e){return"FILE__"+e.replace(/[^A-Za-z0-9]/g,"_")}function N(e){let t=e?.media;return!t||!t.name||!t.media_url?null:{media_id:t.media_id??"",name:t.name,media_url:t.media_url,type:t.type??"doc"}}function ot(e){return e?e.includes(`
3
3
  `)?e.split(`
4
4
  `).map(t=>t.trim()).filter(Boolean):e.split(". ").map(t=>t.trim()).filter(Boolean).map(t=>t.endsWith(".")?t:t+"."):[]}function U(e){return typeof e=="string"&&e.includes("{{secrets.")}var Ct={click:"CLICK",double_click:"CLICK",type:"TYPE",fill:"TYPE",clear:"CLEAR",select:"SELECT",hover:"HOVER",drag:"DRAG_DROP",upload_files:"UPLOAD_FILE",navigate:"OPEN",go_back:"NAVIGATE",go_forward:"NAVIGATE",refresh:"REFRESH",press_key:"SENDKEYS",scroll:"SCROLL_PIXELS",scroll_into_view:"SCROLL_UNTIL_ELEMENT",wait:"WAIT",wait_until:"WAIT_UNTIL",wait_for_load:"WAIT_FOR_LOAD",switch_tab:"SWITCH_TAB",new_tab:"NEW_TAB",close_tab:"CLOSE_TAB",api:"API",evaluate_js:"EVALUATE_JS",vision_query:"VISION_QUERY",textual_query:"TEXTUAL_QUERY",get_url:"GET_URL",get_title:"GET_TITLE",assert:"ASSERTION",math:"MATHEMATICAL_OPERATION",set_cookies:"SET_COOKIES",delete_cookies:"DELETE_COOKIES",clear_cookies:"CLEAR_COOKIES",set_local_storage:"SET_LOCAL_STORAGE",delete_local_storage:"DELETE_LOCAL_STORAGE",clear_local_storage:"CLEAR_LOCAL_STORAGE",set_clipboard:"SET_CLIPBOARD",paste_clipboard:"PASTE_CLIPBOARD",clear_clipboard:"CLEAR_CLIPBOARD",device_control:"DEVICE_CONTROL",device_control_query:"DEVICE_CONTROL_QUERY"},st={literal:"SET_VARIABLE",condition:"SET_VARIABLE",visual:"VISION_QUERY",dom:"TEXTUAL_QUERY",url:"GET_URL",title:"GET_TITLE",devtool_network:"DEVTOOLS_NETWORK_QUERY",devtool_console:"DEVTOOLS_CONSOLE_QUERY",devtool_cookies:"DEVTOOLS_COOKIES_QUERY",devtool_storage:"DEVTOOLS_STORAGE_QUERY",devtool_performance:"DEVTOOLS_PERFORMANCE",api_response:"API_CALLS_QUERY",textual_visual:"TEXTUAL_ANALYZER"},jt=new Set(["CLICK","TYPE","FILL","HOVER","SCROLL_UNTIL_ELEMENT","UPLOAD_FILE","VISION_QUERY","DRAG_DROP","SELECT"]);function at(e,t){if(e==="analyze"){let r=t?.action_params?.analyzer_type??"";return st[r]}if(e==="scroll"&&t?.action_params?.into_view===!0)return"SCROLL_UNTIL_ELEMENT";let n=Ct[e];return n||console.warn(`[migrator] UNKNOWN action_type "${e}" \u2014 falling back to "${e.toUpperCase()}"; explicit mapping required`),n??e.toUpperCase()}function ct(e,t){if(!e||!t)return"";try{let n=new Date(e);return isNaN(n.getTime())?"":new Date(n.getTime()+t).toISOString()}catch{return""}}function ut(e){try{return JSON.parse(e.output_value??"{}")}catch{return{}}}function Dt(e){let t=e.output_variable??"";if(!t)return"[]";let r={...ut(e)};return delete r.body,JSON.stringify([{name:t,unique_key:(e.action_id??"").replace(/-/g,"").slice(0,8)||A().replace(/-/g,"").slice(0,8),value:r,variable_description:"API Response"}])}function Ut(e,t,n){let r=e.action_params??{},o=jt.has(t)?"Vision Agent":"Operation Agent",i={operation_type:t};if(t==="OPEN"&&(i.url=r.url??""),t==="SET_VARIABLE"&&(i.variable_name=e.output_variable??r.key??"",i.variable_value=e.output_value??""),t==="UPLOAD_FILE"){let m=N(r);m&&(i.value=O(m.name))}let s={},a={},c=e.action_instruction??"",u=r.text??"",l=r.url??"",_=[["intent",c],["value",u],["url",l]];for(let[m,h]of Object.entries(n)){let I=String(h);if(m.startsWith("secrets."))for(let[E,b]of _)b.includes(I)&&(a[E]=m);for(let[E,b]of _)b.includes(I)&&!(E in s)&&(s[E]=b)}let p=e.action_type,d={operation:e.action_instruction??"",agent:o,operation_dict:i,reasoning:p==="analyze"?r.query??"":e.intent??e.action_instruction??"",variable:s,secrets:a,params:{}};p==="analyze"&&typeof r.code=="string"&&r.code&&(d.code=r.code),p==="analyze"&&typeof r.code_js=="string"&&r.code_js&&(d.code_js=r.code_js),p==="analyze"&&typeof r.condition_expression=="string"&&r.condition_expression&&(d.condition_expression=r.condition_expression),r.uses_websocket===!0&&(d.uses_websocket=!0),r.uses_sse===!0&&(d.uses_sse=!0),p==="analyze"&&r.analyzer_type==="textual_visual"&&(typeof r.wrapped_js=="string"&&(d.wrapped_js=r.wrapped_js),Array.isArray(r.locators)&&(d.locators=r.locators),typeof r.operator=="string"&&(d.operator=r.operator),Array.isArray(r.transforms)&&(d.transforms=r.transforms),typeof r.query=="string"&&(d.query=r.query),typeof r.expected_value=="string"&&(d.expected_value=r.expected_value),typeof r.needs_unit_conversion=="boolean"&&(d.needs_unit_conversion=r.needs_unit_conversion),typeof r.condition=="string"&&(d.condition=r.condition));let g={set_cookies:"cookies",set_clipboard:"text",delete_cookies:"names",set_local_storage:"items",delete_local_storage:"keys"}[p];return g&&r[g]!==void 0&&(d[g]=r[g]),p==="set_clipboard"&&typeof r.html=="string"&&r.html&&(d.html=r.html),d}function Ft(e){let t=e.assertion_tree??{};if(typeof t.passed=="boolean")return t.passed;let n=t.sub_results??[];return n.length===0?t.status==="passed":(t.composite_operator??"and")==="or"?n.some(o=>o.passed===!0):n.every(o=>o.passed===!0)}function lt(e){return e.map(t=>({description:t.description??"",store_key:t.store_key??"",expected_value:t.expected??"",extracted_value:t.extracted_value??"",operator:t.operator??"equals",transforms:t.transforms??[]}))}function Bt(e){let t=e.assertion_tree??{},n=t.sub_results??[],r=lt(n);return{operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[],sub_results:n,sub_checks:r,composite_operator:t.composite_operator??"and",verification:t.verification??"",claim:t.description??""}}function Mt(e){let n=(e.action_params??{}).assertion_tree??{},r=n.sub_results??[],o=lt(r);return[{operation:e.action_instruction??"",agent:"Operation Agent",operation_dict:{operation_type:"ASSERTION",assertion_tree:{sub_results:r,sub_checks:o,composite_operator:n.composite_operator??"and",verification:"",claim:n.description??e.action_instruction??"",operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[]}},variable:{},secrets:{},params:{}}]}function zt(e,t,n,r){let o=e.visual_data;if(!o||o.x==null||o.y==null)return null;let i=t?`${t}/test_screenshots`:"";return{x:o.x,y:o.y,confidence:0,bbox:o.bbox??null,bbox_source:o.bbox?"accessibility_tree":"fallback",viewport_width:o.viewport_width??1280,viewport_height:o.viewport_height??800,scale_factor:null,raw_image_url:i?`${i}/untagged_screenshot/${n}.${r?.get(n)??"png"}`:"",raw_image_sas_url:"",annotated_image_url:"",annotated_image_sas_url:""}}function Vt(e){if(!e)return"";let t=e;return typeof e=="object"&&!Array.isArray(e)&&Array.isArray(e.frameInfo)&&(t=e.frameInfo),!Array.isArray(t)||t.length===0?"":JSON.stringify(t)}function qt(e){return/^(android|ios)_native$/i.test(e.platform??"")}function dt(e,t){return e.map(n=>({...n,type:t?n.strategy??n.type??"native":n.isXPath?"xpath":"css"}))}function $t(e,t,n){let r={selector_target:"",drag_displacement:{},hold_duration_ms:null,move_duration_ms:null,hold_at_destination_ms:null};if(e!=="drag")return r;let o=t.target_selectors,i={};typeof t.direction=="string"&&t.direction&&(i.direction=t.direction,typeof t.fraction=="number"&&(i.fraction=t.fraction));let s=a=>typeof t[a]=="number"?Math.trunc(t[a]):null;return{selector_target:Array.isArray(o)&&o.length>0?dt(o,n):"",drag_displacement:i,hold_duration_ms:s("hold_duration_ms"),move_duration_ms:s("move_duration_ms"),hold_at_destination_ms:s("hold_at_destination_ms")}}function nt(e,t="",n){let r=e.action_type,o=at(r,e),i=e.action_params??{},s=e.coordinates??null,a=e.selectors??null,c=!!(a&&a.length>0),u=qt(e),l=$t(r,i,u),_=e.timestamp??"",p=e.duration_ms??0,d=e.variables_used??{},f=e.action_id??A(),g=A(),m=ct(_,p),h="",I="";if(r==="navigate")I=i.url??"",h=I;else if(r==="type"||r==="fill")h=i.text??"";else if(r==="press_key")h=i.key??"";else if(r==="wait")h=String(i.ms??i.timeout_ms??"");else if(r==="evaluate_js")h=i.script??"";else if(r==="upload_files"){let q=N(i);q&&(h=O(q.name))}else r==="analyze"&&o==="SET_VARIABLE"&&(h=e.output_value??"");let E="";r==="go_back"?E="back":r==="go_forward"&&(E="forward");let b=e.action_instruction??"",v=U(h)||U(I)||U(b),x=Ut(e,o,d);return{operation_id:f,instruction_id:g,instruction:b,intent:b,operation_start:_,operation_end:m,status:e.status??"",command:o,name:"",target:"",value:h,message:"",operation_dict:"",frame:Vt(e.frame_info),error_message:e.error??"",code_snippet:"",sub_instruction_obj:JSON.stringify(x),test_id:"",test_version:"",action:"",string_to_float:!1,feedback_msg:"",time_taken:"",create_time_stamp:"",update_time_stamp:"",locator_variable:"",locator_variable_name:"",image_url:t?`${t}/test_screenshots/untagged_screenshot/${f}.${n?.get(f)??"png"}`:"",alternative_xpaths:[],attribute:"",value_description:"",url:I,navigation_direction:E,tagified_image_url:"",query_variable_name:e.output_variable??"",query_variable_value:e.output_value??"",query_variable_type:"",expected_value:"",queried_value:"",operator:"",assertion_status:o==="ASSERTION"?Ft(i):"",query_info_dict:{},query_content_confidence:"none",debugging_logs:[],locator_index:0,query_html:"",user_variables:"[]",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,tab_index:String(i.tab_index??""),tab_identifier:String(i.tab_identifier??""),scroll_value:i.amount??1,scroll_direction:i.direction??"",mi_scroll_payload:{},sleep_duration:0,app_id:"",manual_interaction_tag:"",string_to_float_list:[],js_snippet:r==="evaluate_js"?i.script??"":"",code_error:"",hide:v,dismiss_dialog:!1,use_v2_mobile_tagging:u,multiple_inputs:!1,dialog_action:"",dialog_type:"",is_coordinates_used_for_interaction:s!==null&&!c,element_coordinates_ratio:[],element_bounds_ratio:[],x_coord:c?null:s?.x??null,y_coord:c?null:s?.y??null,target_x_coord:i.target_x??null,target_y_coord:i.target_y??null,source_description:i.source_description??null,target_description:i.target_description??null,use_coordinates:s!==null&&!c,kaneaiMobileTaggingImageLimit:1,clicks_order_code:"se_js_ac",selector:c?dt(a,u):"",selector_target:l.selector_target,math_result_variable_name:"",math_result_variable_value:"",expression_tree:o==="ASSERTION"?Bt(i):i.expression_tree??{},assertion_tree:i.assertion_tree??{},assertion_tree_simplified:{},network_throttle:{},is_mobile_offline:!1,autoheal:!1,reprobe:e.reprobe??!1,click_modifier:(i.click_count??1)>=2?{kind:"multi_click",frequency:i.click_count}:null,db_query:"",db_details:{},db_query_decoded:"",is_global_variable:!1,is_global_variable_persist:!1,global_variable_id:"",wait_for_element_timeout:0,failure_condition:o==="ASSERTION"?"Fail test immediately":"",screenshot_command:"",smartui_contents:{},smartui_results:{},result_type:"",result_hint:"",drag_offset:{},drag_displacement:l.drag_displacement,hold_duration_ms:l.hold_duration_ms,move_duration_ms:l.move_duration_ms,hold_at_destination_ms:l.hold_at_destination_ms,start_coordinates:i.source_coordinates?{x:i.source_coordinates[0],y:i.source_coordinates[1]}:{},end_coordinates:i.target_coordinates?{x:i.target_coordinates[0],y:i.target_coordinates[1]}:{},element_rect:null,is_canvas:!1,until_condition:"",until_max_retries:0,until_settle_ms:0,api_data:r==="api"?{request:e.action_params?.api_data?.request??{}}:{},output_variables:r==="api"?e.output_variable?{[e.output_variable]:null}:{}:e.output_variable?{[e.output_variable]:e.output_value??""}:{},visual_context:zt(e,t,f,n),reasoning:r==="analyze"?i.query??"":e.intent??e.action_instruction??""}}function rt(e,t){let n=e.action_type,r=at(n,e),o=e.timestamp??"",i=e.duration_ms??0,s=ct(o,i),a=r==="ASSERTION"||r==="MATHEMATICAL_OPERATION";return{instruction_id:t.instruction_id,instruction_class:a?"non_driver_action":"driver_action",module_id:"",instruction:e.action_instruction??"",command:r,error:null,parent_instruction_id:"",classification_layer_resp:r==="ASSERTION"?Mt(e):[],classification_error:{},operations:[t],status:e.status??"",start_timestamp:o,end_timestamp:s,type:"agent_generated",tags:[],html_paths:[],optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,content_type:n==="api"?"api":n==="analyze"&&e.action_params?.analyzer_type==="api_response"?"api_calls_query":n==="analyze"&&e.action_params?.analyzer_type?.startsWith("devtool_")?e.action_params.analyzer_type.replace("devtool_","devtools_"):"instruction",js_snippet:n==="evaluate_js"?e.action_params?.script??"":"",user_variables:n==="api"?Dt(e):"[]",api_data:n==="api"?{request:e.action_params?.api_data?.request??{},response:ut(e)}:{},params_used:!1,hard_assertion:r==="ASSERTION"?e.action_params?.failure_condition==="hard":!1,expected_outcome:"",module_execution_index:0,module_version:null,network_throttle:{},isEdited:!1,use_query_assertion_v2:!1,db_query:"",db_details:{},network_assertion_content:{},screenshot_command:"",smartui_contents:{},generative_id:"",plan_id:"",generative_objective:"",error_message:"",error_code:"",reason:"",title:"",used_variables:[],reasoning:n==="analyze"?e.action_params?.query??"":e.intent??e.action_instruction??""}}function Gt(e,t=[]){let n=e.action_params??{},r=n.branches??[],o=n.winning_index??-1,i=n.sub_results??[],s={};for(let c of i){let u=c.sub_results;if(u)for(let l of u){let _=l.store_key;_&&(s[_]=l)}}let a=r.map((c,u)=>{let l=u===o,_=(c.sub_checks??[]).map(p=>{let d=s[p.store_key];return{description:p.description,store_key:p.store_key,expected_value:p.expected_value,stored_value:d?.extracted_value??p.stored_value,operator:p.operator??d?.operator??"equals",transforms:p.transforms??d?.transforms??[]}});if(_.length===0&&c.condition&&i.length>0){let d=i.find(f=>f.branch_index===u)?.sub_results??[];d.length>0&&(_=d.map(f=>({description:f.description??c.condition,store_key:f.store_key??"",expected_value:f.expected??"true",stored_value:f.extracted_value??void 0,operator:f.operator??"equals",transforms:f.transforms??[]})))}return{branch_index:u,condition:c.condition??null,branch_type:c.branch_type??"sub_objective",passed:l,sub_objective:null,custom_event:c.custom_event??null,children:l?t:[],sub_checks:c.condition?_:[],composite_operator:c.composite_operator??"and"}});return{content_type:"conditional_block",instruction_id:`if_else_${A().slice(0,8)}`,instruction:e.action_instruction??"",instruction_class:"driver_action",command:"",status:e.status??"success",resolved_branch_index:o,branches:a,generative_id:"",generative_objective:"",variables_used:{},classification_layer_resp:[],classification_error:{},used_variables:[],user_variables:"[]",module_id:"",module_execution_index:0,module_version:"",plan_id:"",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,error:null,error_message:"",error_code:"",reason:"",start_timestamp:e.timestamp??"",end_timestamp:"",type:"agent_generated",hook:null,hook_type:null,evaluation_context:{},query_variables:{}}}function _t(e,t,n){for(let r of e)r.content_type==="instruction"&&"generative_id"in r&&(r.generative_id=t,r.generative_objective=n)}function F(e,t="",n,r){let o=[],i=0;for(;i<e.length;){let s=e[i],a=s.action_type;if(!r?.keepFailedActions&&s.status==="error"&&a!=="assert"&&a!=="if_else"&&a!=="child_agent_start"&&a!=="child_agent_end"&&!(s.until_condition&&!s.error)){i+=1;continue}if(a==="analyze"&&(!st[s.action_params?.analyzer_type??""]||s.action_params?.analyzer_type==="textual_visual"&&s.action_params?.code)){i+=1;continue}if(a==="child_agent_start"){let c=s.action_params?.child_id??"",u=s.action_params?.objective??"",l=[];i+=1;let _=1,p="error",d;for(;i<e.length&&_>0;){let v=e[i],x=v.action_type;if(x==="child_agent_start")_+=1;else if(x==="child_agent_end"&&(_-=1,_===0)){p=v.status??"success",d=v,i+=1;break}_>0&&l.push(v),i+=1}let f=F(l,t,n);_t(f,c,u);let g=d?.action_params?.result_code??null,m=d?.action_params?.reason_code??null,h=d?.action_params?.error_message??null,I=d?.action_params?.summary??null,E=d?.action_params?.one_liner??null,b=p==="error";o.push({content_type:"generative_block",instruction_id:`generative_block_${c}`,generative_id:c,objective:u,status:p,children:f,error_message:b?h??null:null,error_code:b?m??null:null,result_code:g??null,bifurcation_context:[],approach_reason:ot(I),one_liner:E??null});continue}else if(a==="child_agent_end"){i+=1;continue}else if(a==="if_else"){i+=1;let c=[];for(;i<e.length&&e[i].action_type==="child_agent_start";){let u=e[i],l=u.action_params?.child_id??"",_=u.action_params?.objective??"",p=[];i+=1;let d=1,f="error";for(;i<e.length&&d>0;){let m=e[i];if(m.action_type==="child_agent_start")d+=1;else if(m.action_type==="child_agent_end"&&(d-=1,d===0)){f=m.status??"success",i+=1;break}d>0&&p.push(m),i+=1}let g=F(p,t,n);c.push(...g)}o.push(Gt(s,c));continue}else if(a==="query_tool"){i+=1;continue}else if(s.until_condition){let c=nt(s,t,n),u=rt(s,c),l=typeof s.until_condition_met=="boolean"?s.until_condition_met:s.status==="success";o.push({content_type:"until_block",instruction_id:`until_${A().slice(0,8)}`,condition:s.until_condition,max_retries:s.until_max_retries??10,settle_ms:s.until_settle_ms??500,current_count:0,condition_met:l,children:[u],generative_id:"",generative_objective:"",variables_used:{},status:s.status??"success"})}else{let c=nt(s,t,n),u=rt(s,c);o.push(u)}i+=1}return o}function P(e,t="",n,r){let o=[],i=[],s=r?.passthrough,a=s?j(s.authoredInstructions):null;for(let d of e){if(s&&a&&d.flatIndex!==void 0&&s.replayOnlyFlatIndices.has(d.flatIndex)){let b=D(d.records,a);if(b){for(let v of b)o.push(v),i.push(d.flatIndex);continue}console.warn(`[migrator] replay-only passthrough: no authored operation matched step ${d.flatIndex} (action_id \u2260 any operation_id in the authored blob) \u2014 falling back to this run's records`)}let f=F(d.records,t,n,r);if(f.length===0)continue;let g=A().replace(/-/g,"");_t(f,g,d.objective);let m=f.some(b=>"status"in b&&typeof b.status=="string"?b.status==="error"||b.status==="failed":!1),h=d.resultCode?parseInt(d.resultCode,10):null,I=h!==null&&!isNaN(h)&&h>=200,E=m||I?"error":"success";o.push({content_type:"generative_block",instruction_id:`generative_block_${g}`,generative_id:g,objective:d.objective,status:E,children:f,error_message:E==="error"?d.errorMessage??null:null,error_code:E==="error"?d.reasonCode??null:null,result_code:d.resultCode??null,bifurcation_context:[],approach_reason:ot(d.summary),one_liner:d.oneLiner??null}),i.push(d.flatIndex)}let c=o.map((d,f)=>({block:d,flat:i[f]})),u=r?.moduleSpans??[],l=r?.blockSpans??[],_=r?.authoredBlocks??[];u.length>0&&(c=pt(c,u,l,_));let p=mt(l,u);return p.length>0&&(c=B(c,p,_)),{instructions:c.map(d=>d.block)}}function pt(e,t,n,r){let o=[],i=a=>a===void 0?void 0:t.find(c=>a>=c.flatFrom&&a<=c.flatTo),s=0;for(;s<e.length;){let a=i(e[s].flat);if(!a){o.push(e[s]),s++;continue}let c=[];for(;s<e.length&&i(e[s].flat)===a;)c.push(e[s++]);let u=pt(c,a.children,n,r),l=mt(ft(n,a),a.children);l.length>0&&(u=B(u,l,r)),o.push({block:Qt(a,u.map(_=>_.block)),flat:c[0].flat})}return o}function gt(e,t){return e.flatFrom>=t.flatFrom&&e.flatTo<=t.flatTo}function ft(e,t){let n=[];for(let r of e)gt(r,t)?n.push(r):n.push(...ft(r.children,t));return n}function mt(e,t){let n=[],r=i=>{for(let s of i)n.push(s),r(s.children)};r(t);let o=i=>i.filter(s=>!n.some(a=>gt(s,a))).map(s=>({...s,children:o(s.children)}));return n.length>0?o(e):e}function B(e,t,n){let r=[...t].sort((u,l)=>u.flatFrom-l.flatFrom),o=[],i=(u,l)=>{o.push({block:Yt(u,l,n),flat:u.flatFrom})},s=(u,l)=>u!==void 0&&u>=l.flatFrom&&u<=l.flatTo,a=0,c=0;for(;c<e.length;){let u=e[c].flat;for(;a<r.length&&u!==void 0&&r[a].flatTo<u;)i(r[a++],[]);let l=a<r.length&&s(u,r[a])?r[a]:void 0;if(!l){o.push(e[c]),c++;continue}let _=[];for(;c<e.length&&s(e[c].flat,l);)_.push(e[c++]);i(l,_),a++}for(;a<r.length;)i(r[a++],[]);return o}function Kt(e){let t=new Map;for(let n of e)t.set(n.flat,n);return e.filter(n=>t.get(n.flat)===n)}var Ht=["children","instructions","branches","module_content","true_branch","false_branch"];function Jt(e,t){if(!t)return;let n=[...e];for(;n.length>0;){let r=n.pop();if(!r||typeof r!="object")continue;let o=r;if(o.instruction_id===t&&(o.content_type==="conditional_block"||o.content_type==="until_block"))return o;for(let i of Ht){let s=o[i];Array.isArray(s)?n.push(...s):s&&typeof s=="object"&&n.push(s)}}}function Xt(e,t,n){if(!e)return[];if(t==="while")return Array.isArray(e.children)?e.children:[];let o=(Array.isArray(e.branches)?e.branches:[])[n];return o&&Array.isArray(o.children)?o.children:[]}function Yt(e,t,n){let r=Jt(n,e.blockId),o=e.branches.map((i,s)=>{let a=t.filter(l=>l.flat!==void 0&&l.flat>=i.flatFrom&&l.flat<=i.flatTo);e.kind==="while"&&(a=Kt(a));let c=B(a,e.children,n).map(l=>l.block);if(c.length>0)return c;let u=Xt(r,e.kind,s);return u.length===0&&!i.taken&&console.warn(`[migrator] control-flow: branch ${s} of block ${e.blockId||e.instruction} did not run and no authored block matched \u2014 emitted empty`),u});return e.kind==="if"?Wt(e,o,r):Zt(e,o[0]??[],r)}function Wt(e,t,n){let r=Array.isArray(n?.branches)?n.branches:[],o=M(t.flat()),i=e.branches.map((s,a)=>{let c=r[a];return{branch_index:a,condition:s.branch_type==="else"?null:s.condition,branch_type:s.branch_type,passed:s.taken,sub_objective:null,custom_event:c?.custom_event??null,children:t[a],sub_checks:Array.isArray(c?.sub_checks)?c.sub_checks:[],composite_operator:c?.composite_operator??"and"}});return{content_type:"conditional_block",instruction_id:e.blockId||`if_else_${A().slice(0,8)}`,instruction:e.instruction,instruction_class:"driver_action",command:"",status:o?"error":"success",resolved_branch_index:e.branches.findIndex(s=>s.taken),branches:i,generative_id:"",generative_objective:"",variables_used:{},classification_layer_resp:[],classification_error:{},used_variables:[],user_variables:"[]",module_id:"",module_execution_index:0,module_version:"",plan_id:"",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,error:null,error_message:o?.message??"",error_code:o?.code??"",reason:"",start_timestamp:"",end_timestamp:"",type:"agent_generated",hook:null,hook_type:null,evaluation_context:{},query_variables:{}}}function Zt(e,t,n){let r=e.whileCfg??{max_retries:5,settle_ms:500,on_exhaust:"fail",iterations:0,condition_met:!1},o=M(t),i=(s,a)=>n&&n[s]!==void 0?n[s]:a;return{content_type:"until_block",instruction_id:e.blockId||`until_${A().slice(0,8)}`,condition:e.instruction,max_retries:r.max_retries,settle_ms:r.settle_ms,current_count:r.iterations,condition_met:r.condition_met,children:t,generative_id:"",generative_objective:"",variables_used:{},status:o?"error":"success",on_exhaust:i("on_exhaust",r.on_exhaust),mode:i("mode",""),check:i("check",""),conditions:i("conditions",[]),connectors:i("connectors",[]),sub_checks:i("sub_checks",[]),composite_operator:i("composite_operator","and")}}function M(e){for(let t of e){let n="status"in t&&typeof t.status=="string"?t.status:"";if(n==="error"||n==="failed"){let r="error_message"in t?t.error_message:void 0,o="error_code"in t?t.error_code:void 0;return{message:r??null,code:o??null}}}return null}function Qt(e,t){let n=e.meta,r=(u,l="")=>typeof n[u]=="string"?n[u]:l,o=(u,l=!1)=>typeof n[u]=="boolean"?n[u]:l,i=u=>Array.isArray(n[u])?n[u]:[],s=typeof n.module_version=="number"||typeof n.module_version=="string"?n.module_version:null,a=r("module_id"),c=M(t);return{content_type:X,instruction_id:`module_block_${a}`,module_id:a,module_version:s,module_instance_id:A(),module_name:r("module_name"),module_description:r("module_description"),module_platform:r("module_platform"),creation_mode:r("creation_mode","Agent"),tms_status:r("tms_status","active"),is_validated:o("is_validated"),is_dirty:e.dirty,enrichment_id:r("enrichment_id"),tags:i("tags"),project_ids:i("project_ids"),link_to_all:o("link_to_all"),status:c?"error":"success",children:t,error_message:c?.message??null,error_code:c?.code??null,update_available:!1,update_info:{}}}function bt(e,t){let n;try{n=ht(e)}catch{return 0}let r=0,o=n.filter(i=>/^\d+$/.test(i)).sort((i,s)=>Number(i)-Number(s));for(let i of o){let s=S(e,i),a=S(s,"logs");if(!te(a))continue;let c;try{c=ht(a)}catch{continue}let u=c.filter(p=>p.endsWith("-actions.ndjson")).sort((p,d)=>(parseInt(p,10)||0)-(parseInt(d,10)||0)),l=[];for(let p of u){let d=t.readActions(S(a,p));d.length&&l.push({objective:t.objective??"",records:d})}if(l.length===0)continue;let{instructions:_}=P(l,t.screenshotBaseUrl??"",t.extMap,{keepFailedActions:!0});if(_.length!==0)try{let p=S(s,"auteur");ee(p,{recursive:!0}),ne(S(p,"execution.json"),JSON.stringify(t.buildBlob(_),null,2)),r++,t.log?.("info","EVIDENCE_ARCHIVED_ATTEMPT_BLOB","Derived nested attempt blob",{attempt:i,instructions:_.length})}catch(p){t.log?.("debug","EVIDENCE_ARCHIVED_ATTEMPT_BLOB_FAILED","Nested attempt blob derivation failed",{attempt:i,error:p instanceof Error?p.message:String(p)})}}return r}var yt=kt(Rt(),1);import{createWriteStream as re}from"fs";import{readFile as ie}from"fs/promises";import{join as oe,basename as se}from"path";import{tmpdir as ae}from"os";var ce=["**/screenshots/**","**/annotated/**","**/tcg/**","**/bifurcation/**"];async function Et(e){let t=oe(ae(),`${se(e)}_artifacts.zip`);return new Promise((n,r)=>{let o=re(t),i=(0,yt.default)("zip",{zlib:{level:6}});o.on("close",()=>n(t)),i.on("error",r),i.pipe(o),i.glob("**/*",{cwd:e,ignore:ce}),i.finalize()})}async function It(e){return ie(e)}async function de(e,t){return vt(J(e,t))}function _e(e){return{key:"artifacts",content_type:"application/zip",filename:`${e}.evidence`}}var At=class{config;controller;testId;constructor(t){this.config=t,this.controller=new G(t.controllerBaseUrl,t.auth),this.testId=t.testId}log(t,n,r,o){this.config.log?.(t,n,r,o)}async execute(){let{onProgress:t}=this.config;try{if(!this.testId)return this.log("error","PIPELINE_ABORT","No test_id available"),{success:!1,testId:null,error:"No test_id available"};let n=this.config.evidence,r=null;if(this.config.shouldUploadArtifacts!==!1){t("convert","running");let a=this.collectNdjsonPerRun(),c=a.reduce((g,m)=>g+m.records.length,0);this.log("info","PIPELINE_CONVERT","Collected NDJSON records",{total_records:c,run_groups:a.length});let u=this.loadReplayOnlyPassthrough(),{instructions:l}=a.length>0?P(a,this.config.screenshotBaseUrl??"",this.config.screenshotExtMap,{moduleSpans:this.config.moduleSpans,...u?{passthrough:u}:{},...this.config.blockSpans?.length?{blockSpans:this.config.blockSpans,authoredBlocks:this.loadAuthoredBlocks()}:{}}):{instructions:[]};this.log("info","PIPELINE_CONVERT_INSTRUCTIONS","Auteur instructions produced",{count:l.length});let _=this.buildExecutionEnvelope(l),p=Buffer.from(JSON.stringify(_));this.log("info","PIPELINE_CONVERT_BLOB","Blob created",{size_kb:+(p.length/1024).toFixed(1)});let d=y(this.config.sessionDir,"execution.json");w(d,JSON.stringify(_,null,2)),this.log("info","PIPELINE_CONVERT_LOCAL_SAVE","Execution blob saved locally",{path:d});let f=n?.packTestDir??this.config.evidenceRead?.packTestDir;if(f){let g=y(f,"auteur");V(g,{recursive:!0}),w(y(g,"execution.json"),JSON.stringify(_,null,2)),this.log("info","PIPELINE_CONVERT_PACK_COPY","Execution blob copied into pack",{path:y(g,"execution.json")}),this.deriveArchivedAttemptBlobs(f)}if(t("convert","done"),n)r=p;else{t("zip","running"),this.log("info","PIPELINE_ZIP_START","Zipping session",{session_dir:this.config.sessionDir});let g=null,m;try{g=await Et(this.config.sessionDir),m=await It(g),this.log("info","PIPELINE_ZIP_DONE","Zip complete",{size_mb:+(m.length/1024/1024).toFixed(1),path:g}),t("zip","done",`${(m.length/1024/1024).toFixed(1)}MB`)}finally{g&&await le(g).catch(()=>{})}t("presign","running"),this.log("info","PIPELINE_PRESIGN_START","Requesting presigned URLs",{url:`${this.config.controllerBaseUrl}/upload/presign`,test_id:this.testId,session_id:this.config.sessionId});let h=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[{key:"artifacts",content_type:"application/zip",filename:`${this.config.sessionId}_artifacts.zip`},{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);this.log("info","PIPELINE_PRESIGN_OK","Presigned URLs received",{artifacts_url:h.urls.artifacts?.blob_url,blob_url:h.urls.blob?.blob_url}),t("presign","done"),t("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading artifacts and blob",{artifact_size_mb:+(m.length/1024/1024).toFixed(1),blob_size_kb:+(p.length/1024).toFixed(1)}),await Promise.all([k(h.urls.artifacts.upload_url,m,"application/zip"),k(h.urls.blob.upload_url,p,"application/json")]),this.log("info","PIPELINE_UPLOAD_OK","Upload complete"),t("upload","done")}}else{let a=this.collectNdjsonPerRun(),c=this.loadReplayOnlyPassthrough(),{instructions:u}=a.length>0?P(a,this.config.screenshotBaseUrl??"",this.config.screenshotExtMap,{keepFailedActions:!0,moduleSpans:this.config.moduleSpans,...c?{passthrough:c}:{},...this.config.blockSpans?.length?{blockSpans:this.config.blockSpans,authoredBlocks:this.loadAuthoredBlocks()}:{}}):{instructions:[]},l=this.buildExecutionEnvelope(u),_=y(this.config.sessionDir,"execution.json");w(_,JSON.stringify(l,null,2)),this.log("info","PIPELINE_LOCAL_SAVE","Execution blob saved locally (no upload)",{path:_});let p=this.config.evidence?.packTestDir??this.config.evidenceRead?.packTestDir;if(p){let d=y(p,"auteur");V(d,{recursive:!0});let f=this.readAuthoredExecution(),g=f?this.refreshReplayOnlyInPack(f,a,c):null;w(y(d,"execution.json"),g?.raw??JSON.stringify(l,null,2)),this.log("info","PIPELINE_CONVERT_PACK_COPY","Execution blob copied into pack (gated)",{path:y(d,"execution.json"),source:g?g.refreshed.length>0?"authored+replay_results":"authored":"run_envelope",...g&&g.refreshed.length>0?{refreshed_instruction_ids:g.refreshed}:{}}),this.deriveArchivedAttemptBlobs(p)}t("convert","skipped"),t("zip","skipped"),t("presign","skipped"),t("upload","skipped"),this.log("info","PIPELINE_UPLOAD_SKIPPED","Upload steps skipped (gate disabled)")}if(this.config.shouldReplaceLocalOutput&&this.config.onAtomicReplace){t("atomic_replace","running");try{await this.config.onAtomicReplace(),this.log("info","PIPELINE_ATOMIC_REPLACE_OK","Local output replaced"),t("atomic_replace","done")}catch(a){let c=a instanceof Error?a.message:String(a);throw this.log("error","PIPELINE_ATOMIC_REPLACE_FAILED","Atomic-replace failed",{error:c}),t("atomic_replace","failed",c),a}}else t("atomic_replace","skipped");let o,i;if(this.config.shouldCommit&&!this.config.isFirstRun&&this.config.onCommitLock){t("commit_lock","running");let a=await this.config.onCommitLock();if(a.ok)o=a.testcaseId||void 0,this.log("info","PIPELINE_COMMIT_LOCK_OK","Commit lock acquired",{testcase_id:o??"none",trigger:a.trigger??null,test_instance_id:a.testInstanceId??null}),t("commit_lock","done");else return this.log("error","PIPELINE_COMMIT_LOCK_FAILED","Commit lock failed",{reason:a.reason,message:a.message}),t("commit_lock","failed",`${a.reason??"unknown"}: ${a.message??""}`),{success:!1,testId:this.testId,error:`commit-lock failed: ${a.reason??"unknown"}`}}else t("commit_lock","skipped");if(this.config.isFirstRun&&!this.config.skipTmsFinalize){t("finalize","running"),this.log("info","PIPELINE_FINALIZE_START","Finalizing test (first-run)",{test_id:this.testId,commit_id:this.config.commitId});let a=new K(this.config.tmsBaseUrl,this.config.tmsUsername,this.config.tmsAccessKey),c=this.config.runObjectives&&this.config.runObjectives.length>0?this.config.runObjectives:[this.config.firstObjective];if(o=(await a.endTest(this.testId,{commit_id:this.config.commitId,time_taken:Math.round(this.config.totalDuration),steps_count:this.config.totalSteps,commit_message:this.config.firstObjective.slice(0,255),objectives:c})).testcase_id||void 0,this.log("info","PIPELINE_FINALIZE_OK","Test finalized",{testcase_id:o??"none"}),this.config.onFinalizeSuccess)try{await this.config.onFinalizeSuccess(o)}catch(l){this.log("warn","PIPELINE_FINALIZE_META_FAILED","Meta-rewrite after endTest failed",{error:String(l)})}t("finalize","done")}else t("finalize","skipped"),this.log("info","PIPELINE_FINALIZE_SKIPPED","Finalize skipped (evolve flow or first-run disabled)");if(o&&this.config.shareApiBaseUrl)try{i=await this.generateShareLink(o),this.log("info","PIPELINE_SHARE_OK","Share link generated",{share_id:i})}catch(a){this.log("warn","PIPELINE_SHARE_FAILED","Share link failed",{error:String(a)})}if(n&&r){let a=null;t("zip","running");try{await n.sealFn({testcaseId:o,shareId:i}),a=n.sealedPackPath?await vt(n.sealedPackPath):await de(n.executionId,n.cwd),this.log("info","PIPELINE_EVIDENCE_SEALED","Evidence pack sealed",{execution_id:n.executionId}),this.log("info","PIPELINE_PACK_READ","Sealed pack read",{size_mb:+(a.length/1024/1024).toFixed(1)})}catch(c){let u=c instanceof Error?c.message:String(c);this.log("warn","PIPELINE_EVIDENCE_UPLOAD_SKIPPED","Evidence seal/read failed \u2014 uploading blob only",{execution_id:n.executionId,error:u})}if(a){t("zip","done",`${(a.length/1024/1024).toFixed(1)}MB`),t("presign","running");let c=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[_e(n.executionId),{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);this.log("info","PIPELINE_PRESIGN_OK","Presigned URLs received",{artifacts_url:c.urls.artifacts?.blob_url,blob_url:c.urls.blob?.blob_url}),t("presign","done"),t("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading pack and blob",{artifact_size_mb:+(a.length/1024/1024).toFixed(1),blob_size_kb:+(r.length/1024).toFixed(1)}),await Promise.all([k(c.urls.artifacts.upload_url,a,"application/zip"),k(c.urls.blob.upload_url,r,"application/json")]),this.log("info","PIPELINE_UPLOAD_OK","Upload complete"),t("upload","done")}else{t("zip","skipped"),t("presign","running");let c=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);t("presign","done"),t("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading blob only (evidence skipped)",{blob_size_kb:+(r.length/1024).toFixed(1)}),await k(c.urls.blob.upload_url,r,"application/json"),this.log("info","PIPELINE_UPLOAD_OK","Blob upload complete (pack skipped)"),t("upload","done")}}let s;if(this.config.codeExport?.enabled&&o){let a=!1;try{await this.triggerCodeExport(o),this.log("info","PIPELINE_CODE_EXPORT_START","Code export triggered"),a=!0}catch(c){let u=c instanceof Error?c.message:String(c);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export trigger failed; skipping poll",{error:u}),t("code_export","failed",`trigger failed: ${u}`)}if(a){t("code_export","running","Waiting for code generation\u2026");try{s=await this.pollAndDownloadCode(o,t),this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:s}),t("code_export","done",s)}catch(c){let u=c instanceof Error?c.message:String(c);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:u}),t("code_export","failed",u)}}}else t("code_export","skipped");return this.log("info","PIPELINE_COMPLETE","Pipeline complete"),{success:!0,testId:this.testId,testcaseId:o,shareId:i,codeExportDir:s}}catch(n){return{success:!1,testId:this.testId,error:n instanceof Error?n.message:String(n)}}}async runCodeExport(t,n){let r=n??this.config.onProgress,o=!1;try{await this.triggerCodeExport(t),this.log("info","PIPELINE_CODE_EXPORT_TRIGGER","Code export triggered",{testcase_id:t}),o=!0}catch(i){let s=i instanceof Error?i.message:String(i);this.log("error","PIPELINE_CODE_EXPORT_TRIGGER_FAILED","Code export trigger failed; skipping poll",{error:s}),r("code_export","failed",`trigger failed: ${s}`)}if(o){r("code_export","running","Waiting for code generation\u2026");try{let i=await this.pollAndDownloadCode(t,r);return this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:i}),r("code_export","done",i),i}catch(i){let s=i instanceof Error?i.message:String(i);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:s}),r("code_export","failed",s);return}}}deriveArchivedAttemptBlobs(t){try{let n=bt(t,{readActions:r=>this.readNdjsonFromFile(r),buildBlob:r=>this.buildExecutionEnvelope(r),objective:this.config.firstObjective,screenshotBaseUrl:this.config.screenshotBaseUrl??"",extMap:this.config.screenshotExtMap,log:(r,o,i,s)=>this.log(r,o,i,s)});n>0&&this.log("info","PIPELINE_ARCHIVED_ATTEMPTS","Nested retry-attempt blobs derived",{count:n})}catch(n){this.log("debug","PIPELINE_ARCHIVED_ATTEMPTS_FAILED","Nested attempt blob pass failed",{error:n instanceof Error?n.message:String(n)})}}collectNdjsonPerRun(){let t=[],n=this.config.runObjectives??[],r=this.config.runMetadata??[],o=this.config.evidence??this.config.evidenceRead;for(let i=0;i<this.config.runDirs.length;i++){let s=this.config.runDirs[i],a=n[i]||this.config.firstObjective,c=r[i],u=o?this.readNdjsonFromFile(y(o.packTestDir,"logs",`${o.runIndices?.[i]??i}-actions.ndjson`)):this.readNdjsonFromDir(s);if(u.length>0){let l=o?.runIndices?.[i]??i,_=this.config.runFlatIndex?.[l];t.push({objective:a,records:u,..._!==void 0?{flatIndex:_}:{},resultCode:c?.resultCode,reasonCode:c?.reasonCode,errorMessage:c?.errorMessage,summary:c?.summary,oneLiner:c?.oneLiner})}}if(t.length===0){let i=y(this.config.sessionDir,"runs");if(z(i))try{let a=ue(i,{withFileTypes:!0}).filter(c=>c.isDirectory()).map(c=>c.name).sort();for(let c of a){let u=y(i,c),l=this.readNdjsonFromDir(u);l.length>0&&t.push({objective:this.config.firstObjective,records:l})}}catch{}}return t}readNdjsonFromDir(t){let n=[y(t,"run-test","actions.ndjson"),y(t,"actions.ndjson")];for(let r of n)if(z(r))return this.readNdjsonFromFile(r);return[]}readNdjsonFromFile(t){let n=[];if(!z(t))return n;this.log("debug","PIPELINE_COLLECT_READ","Reading NDJSON file",{path:t});let r=L(t,"utf-8");for(let o of r.split(`
5
5
  `)){let i=o.trim();if(i)try{n.push(JSON.parse(i))}catch{}}return n}async generateShareLink(t){let n=`${this.config.shareApiBaseUrl}/lshs/api/v1.0/share-item/generate-sharable-link`;this.log("info","PIPELINE_SHARE_START","Requesting share link",{url:n,testcase_id:t});let r={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({entityIds:[t],entityType:"Test Case Details",expiresAt:7})},o=!!this.config.authResolver;this.log("debug","PIPELINE_SHARE_AUTH","Share link auth config",{resolver:o,fallback_auth_type:typeof this.config.auth=="string"?"bearer":"basic",tms_user:this.config.tmsUsername});let i=o?await this.config.authResolver.fetch(n,r):await R(n,{...r,headers:{...r.headers,Authorization:this.buildAuthHeader()}});if(!i.ok)throw new Error(`Share link API failed: ${i.status} ${await i.text()}`);let s=await i.json();if(!s.shareId)throw new Error("Share link API returned no shareId");return s.shareId}async triggerCodeExport(t){if(!this.config.codeExport)throw new Error("triggerCodeExport called without resolved codeExport config");let{url:n,body:r}=Y({tmsBaseUrl:this.config.tmsBaseUrl,testcaseId:t,codeExport:this.config.codeExport,mobile:this.config.mobile});this.log("info","PIPELINE_CODE_EXPORT_POST","Triggering code export",{url:n});let o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)},i=this.config.authResolver?await this.config.authResolver.fetch(n,o):await R(n,{...o,headers:{...o.headers,Authorization:this.buildAuthHeader()}});if(!i.ok)throw new Error(`Code export failed: ${i.status} ${await i.text()}`)}async pollAndDownloadCode(t,n){let r=W({tmsBaseUrl:this.config.tmsBaseUrl,testcaseId:t}),o=this.config.exitTimeoutMs??3e5,i=5e3,s=Date.now()+o;this.log("info","PIPELINE_CODE_EXPORT_POLL","Polling for code export",{url:r,timeout_ms:o});let a=(c,u)=>this.config.authResolver?this.config.authResolver.fetch(c,u):R(c,{...u,headers:{...u?.headers,Authorization:this.buildAuthHeader()}});for(;Date.now()<s;){let c=await a(r,{method:"GET",headers:{Accept:"application/json"}});if(!c.ok){let d=await c.text().catch(()=>"");throw this.log("warn","PIPELINE_CODE_EXPORT_POLL_FAILED","Code export poll non-200; skipping",{status:c.status,body:d.slice(0,200)}),new Error(`code export poll skipped: HTTP ${c.status}`)}let l=(await c.json()).data?.find(d=>d.code_name==="kane-cli-trigger");if(!l){this.log("debug","PIPELINE_CODE_EXPORT_WAITING","No kane-cli-trigger entry yet"),n("code_export","running","Waiting for code generation\u2026"),await this.sleep(i);continue}let _=l.status.toLowerCase();if(_==="in progress"||_==="in_progress"||_==="pending"){this.log("debug","PIPELINE_CODE_EXPORT_IN_PROGRESS","Code export in progress",{status:l.status}),n("code_export","running","Generating code\u2026"),await this.sleep(i);continue}if(!l.url||l.url.length===0)throw new Error(`Code export status=${l.status} but no files returned`);let p=this.config.codeExportDir??y(this.config.sessionDir,"code-export");V(p,{recursive:!0}),this.log("info","PIPELINE_CODE_EXPORT_DOWNLOAD","Downloading code files",{file_count:l.url.length,dir:p}),n("code_export","running",`Downloading ${l.url.length} files\u2026`);for(let d of l.url){let f=y(p,d.file_name),g=await R(d.file_url);if(!g.ok){this.log("warn","PIPELINE_CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:d.file_name,status:g.status});continue}let m=await g.text();w(f,m,"utf-8"),this.log("info","PIPELINE_CODE_EXPORT_FILE_SAVED","File saved",{file_name:d.file_name,size_bytes:m.length})}return p}throw new Error("Code export timed out")}sleep(t){return new Promise(n=>setTimeout(n,t))}buildAuthHeader(){return typeof this.config.auth=="string"?`Bearer ${this.config.auth}`:$(this.config.auth.username,this.config.auth.accessKey)}readAuthoredExecution(){let t=this.config.authoredExecutionPath;if(!t)return null;try{let n=L(t,"utf8");return JSON.parse(n),n}catch{return this.log("warn","PIPELINE_AUTHORED_BLOB_UNREADABLE","Authored execution.json missing/unreadable \u2014 pack gets this run's envelope",{path:t}),null}}refreshReplayOnlyInPack(t,n,r){if(!r)return{raw:t,refreshed:[]};let o=tt(n,r);if(o.length===0)return{raw:t,refreshed:[]};let i=JSON.parse(t);if(!Array.isArray(i.instructions))return{raw:t,refreshed:[]};let s=et(i.instructions,o);return s.length===0?{raw:t,refreshed:s}:{raw:JSON.stringify(i,null,2),refreshed:s}}loadAuthoredBlocks(){let t=this.config.blockAuthoredExecutionPath;if(!t)return[];try{let n=JSON.parse(L(t,"utf8"));return Array.isArray(n.instructions)?n.instructions:[]}catch(n){return this.log("warn","PIPELINE_AUTHORED_BLOB_UNREADABLE","Authored execution.json missing/unreadable \u2014 branches that did not run this time upload empty",{path:t,error:n instanceof Error?n.message:String(n)}),[]}}loadReplayOnlyPassthrough(){let t=this.config.replayOnlyPassthrough;if(!(!t||t.flatIndices.length===0))try{let n=JSON.parse(L(t.authoredExecutionPath,"utf8"));if(!Array.isArray(n.instructions))throw new Error("no instructions array");return{authoredInstructions:n.instructions,replayOnlyFlatIndices:new Set(t.flatIndices)}}catch(n){this.log("warn","PIPELINE_PASSTHROUGH_BLOB_UNREADABLE","Authored execution.json missing/unreadable \u2014 replay-only steps convert from this run's records",{path:t.authoredExecutionPath,flat_indices:t.flatIndices,error:n instanceof Error?n.message:String(n)});return}}buildExecutionEnvelope(t){let n=this.config.runStatuses.every(u=>u==="passed")?"success":"error",r=this.config.variableIds??{},o=[];if(this.config.variables)for(let[u,l]of Object.entries(this.config.variables)){if(l.secret||H(l))continue;let _=u.startsWith("global.")?u.slice(7):u;o.push({id:r[_]??0,name:_,value:l.value,session_value:l.value,is_persist:!1,environment_id:0,environment_name:"No Env"})}let i=[],s=u=>{let l=i.find(_=>_.name===u.name);l?l.value=u.value:i.push(u)},a=[],c=new Set;for(let u of this.collectNdjsonPerRun())for(let l of u.records)if(l.output_variable&&l.output_value!=null&&s({name:l.output_variable,value:String(l.output_value),value_type:"test_level",variable_description:"ANALYZE result"}),l.action_type==="upload_files"){let _=N(l.action_params);if(_){let p=_.media_id||_.media_url;if(!c.has(p)){c.add(p),a.push({media_url:_.media_url,media_id:_.media_id,name:_.name,type:_.type});let d=O(_.name);s({name:it(_.name),value:d,value_type:"string",variable_description:`variable for ${d}`})}}}return{test_id:this.testId,version:"v4",auto_heal_version:this.config.apMode==="v2"?"AH2":"",session_id:this.config.sessionId,org_id:String(this.config.orgId),user_id:String(this.config.userId),url:this.config.firstUrl??"",start_timestamp:this.config.startedAt,end_timestamp:this.config.endedAt,status:n,commit_id:this.config.commitId,instructions:t,modules:[],uploaded_files:a,test_params:this.config.testParams??[],test_level_variables:JSON.stringify(i),test_global_variables:o,max_network_wait:0,wait_buffer:0,network_throttle:{},secrets:this.config.secrets??[],totp:[],environment_id:0,environment:"",mobile_browser:!1,native_popups:[],smartui:{},module_index:0}}};export{de as a,_e as b,At as c};