@testmuai/kane-cli 0.8.22 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/dist/{ChatSurface-PA73V3NT.js → ChatSurface-FJPK3XEJ.js} +1 -1
  2. package/dist/{ChromeProfilePicker-XX223SYB.js → ChromeProfilePicker-7DUDJTE2.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-J6DW6TZL.js → CliFeedbackPrompt-ZZPYC6OS.js} +1 -1
  4. package/dist/{CliUploadProgress-TWEL7NWG.js → CliUploadProgress-WQYKIBAR.js} +1 -1
  5. package/dist/ConfigView-KXNOODDW.js +2 -0
  6. package/dist/EvidenceViewOffer-BTBVPBZX.js +2 -0
  7. package/dist/FolderPicker-H4YEX5LV.js +2 -0
  8. package/dist/{InfoBox-ELZ5Q65V.js → InfoBox-DTM7X24Z.js} +1 -1
  9. package/dist/{LinksBox-2V26KLTJ.js → LinksBox-KFG3FVOT.js} +1 -1
  10. package/dist/{ProfilesView-P4Z42LSX.js → ProfilesView-KBZHT4KL.js} +1 -1
  11. package/dist/{ProjectPicker-2QNFNN7T.js → ProjectPicker-OARWULNN.js} +1 -1
  12. package/dist/{SaveSessionPrompt-XMWL3P6G.js → SaveSessionPrompt-37SMU5MC.js} +1 -1
  13. package/dist/SingleShotApp-UYCAW65Y.js +2 -0
  14. package/dist/{SummaryBox-RWO4BYYD.js → SummaryBox-6RB5DSAH.js} +1 -1
  15. package/dist/TestMdRunView-ZMOII3PL.js +2 -0
  16. package/dist/{TestrunEvidenceTable-MUOGF6CZ.js → TestrunEvidenceTable-3UP2EYIV.js} +1 -1
  17. package/dist/{WhoamiView-4EYWZR4N.js → WhoamiView-MC62GERR.js} +1 -1
  18. package/dist/app-client-PQFJAB63.js +2 -0
  19. package/dist/app-download-P6YXWSVQ.js +2 -0
  20. package/dist/{auth-5HAY24TN.js → auth-LXW4OFKF.js} +1 -1
  21. package/dist/{binary-6UEOI7PT.js → binary-LVHXED3O.js} +1 -1
  22. package/dist/{bind-3C2IIPML.js → bind-ZYESQSCJ.js} +2 -2
  23. package/dist/{bootstrap-DBAQWVNA.js → bootstrap-DI4UGMH3.js} +1 -1
  24. package/dist/bridge-7J3JE3JS.js +2 -0
  25. package/dist/catalog-LLME3744.js +2 -0
  26. package/dist/{changelog-QAGRYBEZ.js → changelog-N5AZHXOS.js} +1 -1
  27. package/dist/{chunk-2G5CJQOR.js → chunk-243ZJHT6.js} +1 -1
  28. package/dist/{chunk-BNC4DJCC.js → chunk-2PKME4VT.js} +4 -4
  29. package/dist/{chunk-XQNJSM5C.js → chunk-3MCPTVJX.js} +1 -1
  30. package/dist/{chunk-VW3PFRCO.js → chunk-3YIZG7WZ.js} +1 -1
  31. package/dist/{chunk-CE23VDW5.js → chunk-4BZOG6PE.js} +1 -1
  32. package/dist/{chunk-5TQIKRKP.js → chunk-4CYBXJIA.js} +1 -1
  33. package/dist/{chunk-P37ALET7.js → chunk-4FHK4LKQ.js} +1 -1
  34. package/dist/{chunk-MXI5P373.js → chunk-4Y2WH77W.js} +1 -1
  35. package/dist/{chunk-GF32QBCM.js → chunk-5HMN74RZ.js} +1 -1
  36. package/dist/chunk-5RCS2LIQ.js +26 -0
  37. package/dist/chunk-5TQFOPJV.js +2 -0
  38. package/dist/{chunk-SREUA7YQ.js → chunk-6HU5M2DS.js} +1 -1
  39. package/dist/{chunk-WGIZQGR5.js → chunk-6MD7SR7D.js} +1 -1
  40. package/dist/{chunk-NMAPNJRY.js → chunk-6VY62QC2.js} +1 -1
  41. package/dist/{chunk-JHYWNWS5.js → chunk-75MMTNPB.js} +2 -2
  42. package/dist/{chunk-SIXPXYCH.js → chunk-7GAHJZLH.js} +1 -1
  43. package/dist/chunk-7WXMV3O3.js +7 -0
  44. package/dist/{chunk-FR3LVUAB.js → chunk-AHFIRHSP.js} +1 -1
  45. package/dist/chunk-AJT34ESA.js +38 -0
  46. package/dist/chunk-AKE2CTV6.js +2 -0
  47. package/dist/{chunk-WRGPMDDE.js → chunk-AUMJ4RVA.js} +1 -1
  48. package/dist/chunk-BL3SJDCG.js +10 -0
  49. package/dist/chunk-BUPRL2TE.js +2 -0
  50. package/dist/chunk-C25M2J5Q.js +4 -0
  51. package/dist/{chunk-5FQYB5SM.js → chunk-C6S2RPZA.js} +1 -1
  52. package/dist/{chunk-YFBJWIBU.js → chunk-CNUCP6DK.js} +1 -1
  53. package/dist/chunk-CSNJPD2J.js +5 -0
  54. package/dist/{chunk-GVE5GEW2.js → chunk-CW3RHKLA.js} +1 -1
  55. package/dist/{chunk-6C35NKQ7.js → chunk-DOOI2JBD.js} +1 -1
  56. package/dist/{chunk-T6MGCP57.js → chunk-DTRKTBCE.js} +4 -4
  57. package/dist/{chunk-LSRNUBIV.js → chunk-DTRSYWZE.js} +1 -1
  58. package/dist/{chunk-Z2XKFYMH.js → chunk-DWMESHFI.js} +1 -1
  59. package/dist/chunk-EBLXHOE3.js +2 -0
  60. package/dist/{chunk-RFDL7MHI.js → chunk-EOA6YPES.js} +1 -1
  61. package/dist/{chunk-HKIBJDKE.js → chunk-F7NSSQYZ.js} +1 -1
  62. package/dist/chunk-FMUV6UCX.js +2 -0
  63. package/dist/chunk-GCISXCDU.js +2 -0
  64. package/dist/chunk-GFBAK7WQ.js +8 -0
  65. package/dist/{chunk-5D6YMG63.js → chunk-GTVQYT3D.js} +2 -2
  66. package/dist/{chunk-QV445GUU.js → chunk-HAYV4D2I.js} +1 -1
  67. package/dist/{chunk-PUFZTE6L.js → chunk-HG5LLZBU.js} +1 -1
  68. package/dist/chunk-HGFWIBVF.js +8 -0
  69. package/dist/{chunk-R43ELADV.js → chunk-ILDHE4P4.js} +2 -2
  70. package/dist/{chunk-REPKBN7I.js → chunk-IPXKUYUK.js} +1 -1
  71. package/dist/{chunk-R7ZDLGMU.js → chunk-J3BGYSMD.js} +12 -10
  72. package/dist/{chunk-NAWGHDA3.js → chunk-JQY5HRZ4.js} +1 -1
  73. package/dist/{chunk-6MCQ2UKE.js → chunk-JX6BFEDO.js} +1 -1
  74. package/dist/chunk-K3IQEL7R.js +7 -0
  75. package/dist/{chunk-NUYGWRB2.js → chunk-KWEOLPBJ.js} +1 -1
  76. package/dist/{chunk-EVBCKI7D.js → chunk-KXEE6VCA.js} +1 -1
  77. package/dist/{chunk-XFQLR6MF.js → chunk-LH4IPANP.js} +1 -1
  78. package/dist/{chunk-UXR57BCE.js → chunk-LLG7NEGX.js} +1 -1
  79. package/dist/{chunk-O4LJWUSJ.js → chunk-M3UAZTDK.js} +1 -1
  80. package/dist/{chunk-MHMEEA4S.js → chunk-NMSZ7G6P.js} +1 -1
  81. package/dist/chunk-NOL7MNZH.js +2 -0
  82. package/dist/{chunk-SW54RAAT.js → chunk-OC6H6BYI.js} +1 -1
  83. package/dist/{chunk-RUSRN7YE.js → chunk-OHOJSADN.js} +1 -1
  84. package/dist/chunk-OIUV3ISA.js +2 -0
  85. package/dist/{chunk-LKPOOZYN.js → chunk-OJAXOOZ5.js} +2 -2
  86. package/dist/{chunk-RGRFL7XG.js → chunk-OMNLAGQC.js} +1 -1
  87. package/dist/{chunk-WBH5GYFM.js → chunk-OOCCUUR2.js} +1 -1
  88. package/dist/{chunk-SVJBOVI4.js → chunk-OXC6O5O7.js} +1 -1
  89. package/dist/chunk-OZQDD2EX.js +94 -0
  90. package/dist/{chunk-FDXDFZ7J.js → chunk-PCKIANML.js} +1 -1
  91. package/dist/{chunk-ZUJGYHZ2.js → chunk-PEDINHVU.js} +1 -1
  92. package/dist/{chunk-3H3KTCL7.js → chunk-PNUAP3RY.js} +2 -2
  93. package/dist/{chunk-5ILTSBWT.js → chunk-Q5CINJYL.js} +1 -1
  94. package/dist/{chunk-PLIQ72LH.js → chunk-Q5RDCSYM.js} +1 -1
  95. package/dist/chunk-QAB3Y5FQ.js +4 -0
  96. package/dist/{chunk-WJR2FU7S.js → chunk-RTSBKCZY.js} +1 -1
  97. package/dist/{chunk-3M6OM3T4.js → chunk-RWSOZPJQ.js} +1 -1
  98. package/dist/{chunk-5XAX4C5N.js → chunk-SID4X77D.js} +1 -1
  99. package/dist/chunk-SOCHN2PY.js +2 -0
  100. package/dist/{chunk-L35DJDX7.js → chunk-SRTKRHYI.js} +1 -1
  101. package/dist/chunk-TM7VRLWS.js +2 -0
  102. package/dist/{chunk-VCY7UNEL.js → chunk-UA2QDAWT.js} +1 -1
  103. package/dist/{chunk-JHBNXTG6.js → chunk-USOYXCZ4.js} +1 -1
  104. package/dist/{chunk-CBUSNWHA.js → chunk-USY7VAO6.js} +1 -1
  105. package/dist/{chunk-BPYRVV7O.js → chunk-UWXDURAB.js} +1 -1
  106. package/dist/{chunk-D7WG7SRA.js → chunk-VBS33P2C.js} +1 -1
  107. package/dist/{chunk-XKYL4K4A.js → chunk-VHW7BMZQ.js} +1 -1
  108. package/dist/{chunk-4ZBI54KE.js → chunk-VORWZLS3.js} +2 -2
  109. package/dist/{chunk-3MWLFHPO.js → chunk-WDMUPK6I.js} +1 -1
  110. package/dist/{chunk-BPDFI2DC.js → chunk-WMI4P76K.js} +2 -2
  111. package/dist/{chunk-4VW3B7SE.js → chunk-WNOC6MQC.js} +1 -1
  112. package/dist/{chunk-JQ3JB5CO.js → chunk-WRSIKZ2V.js} +1 -1
  113. package/dist/chunk-X2A6CC6B.js +2 -0
  114. package/dist/{chunk-I4SO2FQV.js → chunk-XBX643ZD.js} +1 -1
  115. package/dist/{chunk-E2KV4BQB.js → chunk-XKHWWKJZ.js} +1 -1
  116. package/dist/{chunk-JPOFRYTX.js → chunk-XT7XA4DN.js} +1 -1
  117. package/dist/{chunk-WPBETG6U.js → chunk-Y3ZYN6AK.js} +3 -3
  118. package/dist/chunk-YBAVDT3G.js +2 -0
  119. package/dist/{chunk-OT3VKXJX.js → chunk-YWYORBY3.js} +1 -1
  120. package/dist/{chunk-DZCJE77P.js → chunk-Z7IGTVJW.js} +1 -1
  121. package/dist/{chunk-2OIIXLXW.js → chunk-ZC2CKWLB.js} +1 -1
  122. package/dist/{chunk-3BUYTNAV.js → chunk-ZER3FZSZ.js} +2 -2
  123. package/dist/chunk-ZJYT72BA.js +9 -0
  124. package/dist/{chunk-5BHB5D2C.js → chunk-ZXY4P76I.js} +1 -1
  125. package/dist/{config-HVSKN6L4.js → config-YGTHSGQN.js} +1 -1
  126. package/dist/cover-cmd-6RO366CC.js +3 -0
  127. package/dist/{credentials-FH6VZPJS.js → credentials-QD32Y7K7.js} +1 -1
  128. package/dist/{deps-bundle-QUROUKJI.js → deps-bundle-OI7JJ22L.js} +1 -1
  129. package/dist/{deps-resolve-N2KKJ37Q.js → deps-resolve-ZOALDS6H.js} +1 -1
  130. package/dist/device-env-DXDJJMTL.js +2 -0
  131. package/dist/{dispatch-BYA5Q2SD.js → dispatch-7EWWQRQ5.js} +1 -1
  132. package/dist/{doctor-MGHY2M36.js → doctor-TPYPEEUL.js} +1 -1
  133. package/dist/evidence-NPFTBGDF.js +2 -0
  134. package/dist/evolve-cmd-VGVXV6XW.js +2 -0
  135. package/dist/explain-cmd-GOP5TE63.js +9 -0
  136. package/dist/{explain-cmd-JAOHSI4F.js → explain-cmd-M7IX2YNB.js} +1 -1
  137. package/dist/{extract-bind-T7GKUEJ6.js → extract-bind-CKIRLXAJ.js} +2 -2
  138. package/dist/{extract-cmd-WXG34RMY.js → extract-cmd-3EWLSPGS.js} +1 -1
  139. package/dist/gaps-cmd-WVC5GXQC.js +3 -0
  140. package/dist/{generate-headless-BSBY47K2.js → generate-headless-6WMJYNI6.js} +2 -2
  141. package/dist/index.js +175 -174
  142. package/dist/ingest-cmd-AECK5T4H.js +2 -0
  143. package/dist/install-ZV3KJZV4.js +2 -0
  144. package/dist/{interactive-bind-JAB6XUPX.js → interactive-bind-IYS6KDOH.js} +3 -3
  145. package/dist/lifecycle-cmd-XCSBELFQ.js +2 -0
  146. package/dist/list-cmd-S4DSN2ET.js +3 -0
  147. package/dist/{list-commands-VTWPMFG3.js → list-commands-GLNGHPDU.js} +1 -1
  148. package/dist/login-flow-ASUUU7SO.js +2 -0
  149. package/dist/maintenance-cmd-K5KXRIFL.js +2 -0
  150. package/dist/mobile-prompts-ZUZTA3RV.js +2 -0
  151. package/dist/{objective-variable-gate-WZFN5I7Y.js → objective-variable-gate-CG2KK5UX.js} +1 -1
  152. package/dist/{open-provider-YXHFPVDE.js → open-provider-YIBB77FE.js} +1 -1
  153. package/dist/persist-recorded-session-EWV56TSZ.js +3 -0
  154. package/dist/pipeline-LAWACB2O.js +2 -0
  155. package/dist/prepare-target-WGPCZKLE.js +2 -0
  156. package/dist/real-device-run-MDLFKFVQ.js +2 -0
  157. package/dist/reconcile-cmd-XFM2ZXUJ.js +2 -0
  158. package/dist/reconcile-deps-V5VLDPYT.js +4 -0
  159. package/dist/reconcile-engine-VZBTMPUK.js +2 -0
  160. package/dist/{recording-banner-FRH2EJBM.js → recording-banner-CJHRPHHF.js} +1 -1
  161. package/dist/registry-3JXQFZEG.js +2 -0
  162. package/dist/{require-project-folder-A6YTVLAK.js → require-project-folder-SE5GVCYJ.js} +1 -1
  163. package/dist/resolve-run-intent-DD4MB6UD.js +2 -0
  164. package/dist/{resolver-U55SNASN.js → resolver-TLO4SRWV.js} +1 -1
  165. package/dist/review-cmd-7EOYQMPE.js +5 -0
  166. package/dist/run-EHUNJPW6.js +2 -0
  167. package/dist/run-OTMPUQSH.js +2 -0
  168. package/dist/run-test-md-KBDEHGXJ.js +17 -0
  169. package/dist/session-target-UMNASXI7.js +2 -0
  170. package/dist/{sessions-cmd-IV25N2L7.js → sessions-cmd-M3SECFKQ.js} +1 -1
  171. package/dist/{skill-installer-LSDCMJ6P.js → skill-installer-32YYMM4N.js} +1 -1
  172. package/dist/{spawner-HZXP66DS.js → spawner-DPT2RLAO.js} +1 -1
  173. package/dist/store-guard-U32JE6JJ.js +2 -0
  174. package/dist/structured-answers-ZI2B6JJE.js +1 -1
  175. package/dist/sync-cmd-3EP7LZGL.js +2 -0
  176. package/dist/sync-setup-SWTBVQEV.js +2 -0
  177. package/dist/tcg-generate-KXU7E2GF.js +2 -0
  178. package/dist/testmd-actions-PEWCPQ5R.js +2 -0
  179. package/dist/testmd-sync-ZWFQWZ2X.js +2 -0
  180. package/dist/token-refresh-QD3OCGJJ.js +2 -0
  181. package/dist/{validate-basic-5NYH5WYI.js → validate-basic-AAIXSAWH.js} +1 -1
  182. package/dist/{variable-receipt-C3US6X4M.js → variable-receipt-YWNS24TH.js} +1 -1
  183. package/dist/{verdicts-VPTU4YAS.js → verdicts-LAB5BGCC.js} +1 -1
  184. package/dist/{version-check-YY57B2A4.js → version-check-EHOLX3YH.js} +1 -1
  185. package/dist/{view-cmd-KWIBYZ5S.js → view-cmd-3WHG6MVB.js} +1 -1
  186. package/dist/walk-session-XP4KYFKO.js +2 -0
  187. package/dist/with-telemetry-FJMJQDCM.js +2 -0
  188. package/package.json +11 -11
  189. package/dist/ConfigView-ROFNVFDQ.js +0 -2
  190. package/dist/EvidenceViewOffer-XUP44BGJ.js +0 -2
  191. package/dist/FolderPicker-XLAK7324.js +0 -2
  192. package/dist/SingleShotApp-3YZSE3AA.js +0 -2
  193. package/dist/TestMdRunView-QHPMG46M.js +0 -2
  194. package/dist/app-client-ZCCNE3RV.js +0 -2
  195. package/dist/app-download-KUJVMZ7L.js +0 -2
  196. package/dist/bridge-NHXCRSIU.js +0 -2
  197. package/dist/chunk-26HZJJN6.js +0 -5
  198. package/dist/chunk-2HFNP2LM.js +0 -2
  199. package/dist/chunk-3NMXXTHE.js +0 -2
  200. package/dist/chunk-44NNFVCJ.js +0 -7
  201. package/dist/chunk-46U7TRPE.js +0 -98
  202. package/dist/chunk-5E4JLXR5.js +0 -2
  203. package/dist/chunk-ADBOWRMW.js +0 -2
  204. package/dist/chunk-BL5QHONU.js +0 -2
  205. package/dist/chunk-DF4EBXGN.js +0 -8
  206. package/dist/chunk-EYOCNMUM.js +0 -2
  207. package/dist/chunk-FBRTUEAL.js +0 -26
  208. package/dist/chunk-GYLMH2EX.js +0 -4
  209. package/dist/chunk-OBB57E2L.js +0 -4
  210. package/dist/chunk-ODU2JSMA.js +0 -8
  211. package/dist/chunk-SB5XM4YV.js +0 -6
  212. package/dist/chunk-SJZJ7ASF.js +0 -2
  213. package/dist/chunk-TAOHYWEO.js +0 -2
  214. package/dist/chunk-WHNF5SWS.js +0 -9
  215. package/dist/chunk-YFQGOOF7.js +0 -2
  216. package/dist/cover-cmd-ZZJA5C6H.js +0 -3
  217. package/dist/device-env-ID7EDDOD.js +0 -2
  218. package/dist/evidence-XYKLWPPY.js +0 -2
  219. package/dist/evolve-cmd-BURJDLVF.js +0 -2
  220. package/dist/explain-cmd-53EO2IMN.js +0 -9
  221. package/dist/gaps-cmd-T55FFFVB.js +0 -3
  222. package/dist/ingest-cmd-BYOZCTVG.js +0 -2
  223. package/dist/install-OABVIXAE.js +0 -2
  224. package/dist/lifecycle-cmd-QVGYYJSG.js +0 -2
  225. package/dist/list-cmd-RQYRC345.js +0 -3
  226. package/dist/login-flow-HUORIV6P.js +0 -2
  227. package/dist/maintenance-cmd-NC2VI5G7.js +0 -2
  228. package/dist/mobile-prompts-VCA73IYP.js +0 -2
  229. package/dist/persist-recorded-session-SZDBBSNH.js +0 -3
  230. package/dist/pipeline-FAU3PBDH.js +0 -2
  231. package/dist/prepare-target-XYOTVK2I.js +0 -2
  232. package/dist/reconcile-cmd-2BFK7RFL.js +0 -2
  233. package/dist/reconcile-deps-CYWH6GM4.js +0 -4
  234. package/dist/reconcile-engine-ZWIJFYBP.js +0 -2
  235. package/dist/registry-QR3BDI5F.js +0 -2
  236. package/dist/resolve-run-intent-PHAXPW6C.js +0 -2
  237. package/dist/review-cmd-ZKCXBMFP.js +0 -5
  238. package/dist/run-76I4OYXD.js +0 -2
  239. package/dist/run-XJK3YOW2.js +0 -2
  240. package/dist/run-test-md-A3QRWLCW.js +0 -17
  241. package/dist/session-target-UWROGOCY.js +0 -2
  242. package/dist/store-guard-27XJZ7WF.js +0 -2
  243. package/dist/sync-cmd-JZ3MXGEU.js +0 -2
  244. package/dist/sync-setup-HGG7ALGA.js +0 -2
  245. package/dist/tcg-generate-S77VVSVU.js +0 -2
  246. package/dist/testmd-actions-VQJ22WZZ.js +0 -2
  247. package/dist/testmd-sync-RKSGTCZA.js +0 -2
  248. package/dist/token-refresh-AOCGYGEC.js +0 -2
  249. package/dist/walk-session-YSKEJM2F.js +0 -2
  250. package/dist/with-telemetry-2NY4CPL5.js +0 -2
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m,c}from"./chunk-EYOCNMUM.js";import{c as b,j as h}from"./chunk-SJZJ7ASF.js";import{readFileSync as w,writeFileSync as y,mkdirSync as C,existsSync as k}from"fs";import{dirname as x}from"path";var f={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:h,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"dom",network_ws:!1,network_sse:!1,bug_detection:"off",final_validation:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0};function T(o){let{mobile:e,...i}=o,t={...i};delete t.target,delete t.device,delete t.device_name,delete t.os_version,delete t.app;let n=e??{};n.tui_target&&(t.target=n.tui_target);let s=n.default_target?.name?.trim(),l=n.default_target?.os_version?.trim();if(s||l)s&&(t.device_name=s),l&&(t.os_version=l);else{let r=n.default_target?.id?.trim();r&&(t.device=r)}n.default_app&&(t.app=n.default_app);let a={};return n.no_reset!==void 0&&(a.no_reset=n.no_reset),n.appium_url!==void 0&&(a.appium_url=n.appium_url),n.auto_grant_permissions!==void 0&&(a.auto_grant_permissions=n.auto_grant_permissions),n.auto_accept_alerts!==void 0&&(a.auto_accept_alerts=n.auto_accept_alerts),Object.keys(a).length>0&&(t.mobile=a),t}function S(o){let e=o.mobile??{},i=typeof o.target=="string"?o.target:void 0,t=typeof o.device=="string"&&o.device.trim()!==""?o.device.trim():void 0,n=g=>typeof g=="string"&&g.trim()!==""?g.trim():void 0,s=n(o.device_name),l=n(o.os_version),a=typeof o.app=="string"&&o.app!==""?o.app:void 0,r={},u=i??e.tui_target;u&&(r.tui_target=u);let _=m(u,void 0).kind,d=_==="emulator"||_==="simulator"?_:null;d&&(s||l)?r.default_target={platform:c(d),kind:d,...s?{name:s}:{},...l?{os_version:l}:{}}:d&&t?r.default_target={platform:c(d),kind:d,id:t}:(e.default_target?.id?.trim()||e.default_target?.name?.trim())&&(r.default_target=e.default_target);let p=a??e.default_app;return p&&(r.default_app=p),e.no_reset!==void 0&&(r.no_reset=e.no_reset),e.appium_url!==void 0&&(r.appium_url=e.appium_url),e.auto_grant_permissions!==void 0&&(r.auto_grant_permissions=e.auto_grant_permissions),e.auto_accept_alerts!==void 0&&(r.auto_accept_alerts=e.auto_accept_alerts),Object.keys(r).length>0?r:void 0}var v=class{constructor(e=b){this.path=e}exists(){return k(this.path)}load(){try{let e=w(this.path,"utf-8"),i=JSON.parse(e),t=S(i),{target:n,device:s,app:l,...a}=i;return{...f,...a,...t?{mobile:t}:{},code_export:{...f.code_export,...i.code_export??{}},generate:{...f.generate,...i.generate??{}}}}catch{return{...f,code_export:{...f.code_export},generate:{...f.generate}}}}write(e){try{C(x(this.path),{recursive:!0}),y(this.path,JSON.stringify(T(e),null,2)+`
3
- `)}catch(i){let t=i instanceof Error?i.message:String(i);process.stderr.write(`[config] Failed to save config: ${t}
4
- `)}}set(e,i){let t=this.load();t[e]=i,this.write(t)}save(e){this.write({...this.load(),...e})}getMobile(){return this.load().mobile??{}}setMobile(e){let i={...this.getMobile()};for(let t of Object.keys(e)){let n=e[t];n===void 0?delete i[t]:i[t]=n}this.set("mobile",Object.keys(i).length>0?i:void 0)}writeRaw(e){this.write(e)}};export{v as a};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as $e}from"./chunk-SB5XM4YV.js";import{a as te}from"./chunk-Z2XKFYMH.js";import{a as K}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-YFBJWIBU.js";import{a as ve}from"./chunk-DZCJE77P.js";import{y as i}from"./chunk-SJZJ7ASF.js";import{b as ye}from"./chunk-DFS4RMVP.js";import{a as k}from"./chunk-HCBYKLMW.js";import{a as s,b as o,i as Se,j as Te,k as ee}from"./chunk-C44QQJR4.js";import{a as V}from"./chunk-6YGTRKDT.js";import{e as R}from"./chunk-UR6MHSHU.js";var A=R(V(),1);var C=R(V(),1);function de(e){let t=e.flatMap(u=>[u,...u.children??[]]),n=t.filter(u=>u.status==="passed").length,l=t.filter(u=>u.status==="failed").length,a=t.filter(u=>u.status==="passed"||u.status==="failed").length;return{passed:n,failed:l,total:a}}function we(e){let t=$e(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[n,l]=(0,C.useState)(0),[a,u]=(0,C.useState)("idle"),c=(0,C.useRef)("idle"),v=(0,C.useRef)(0),S=(0,C.useRef)(!1),T=(0,C.useRef)(null),d=(0,C.useRef)(null),L=(0,C.useCallback)(h=>{c.current=h,u(h)},[]),O=(0,C.useCallback)(async h=>{let b=await e.getNextConfig(h);if(!b){L("done"),e.onAllComplete?.();return}let B=h?v.current+1:0;v.current=B,l(B),e.onStepStart?.(b,B),T.current=null,d.current=null,L("running"),await t.startRun(b,e.spawnOpts)},[t,e,L]);(0,C.useEffect)(()=>{S.current||(S.current=!0,O(null))},[]),(0,C.useEffect)(()=>{if(!t.lastRunEnd||t.lastRunEnd===T.current||c.current!=="running")return;T.current=t.lastRunEnd,c.current="transitioning",u("transitioning");let h=t.lastRunEnd,b=de(t.steps),B=t.bifurcationInfo,F={status:h.status==="passed"?"passed":"failed",duration_s:h.duration??0,reason:h.reason,runEnd:h,hadError:!1,stepsPassed:b.passed,stepsFailed:b.failed,stepsTotal:b.total,bifurcationFlows:B&&!B.isSingleFlow?B.flows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(F,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(F)},[t.lastRunEnd]),(0,C.useEffect)(()=>{if(!t.runError||t.runError===d.current||t.lastRunEnd||c.current!=="running")return;d.current=t.runError,c.current="transitioning",u("transitioning");let h=de(t.steps),b={status:"failed",duration_s:0,reason:t.runError,runEnd:null,hadError:!0,stepsPassed:h.passed,stepsFailed:h.failed,stepsTotal:h.total,bifurcationFlows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(b,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(b)},[t.runError,t.lastRunEnd]);let y=(0,C.useCallback)(()=>{t.cancelRun()},[t]);return{runner:t,currentStepIndex:n,phase:a,cancel:y}}var pe=R(V(),1);var ne=R(k(),1),Ee=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function ke({label:e,hasBifurcation:t=!1}){let[n,l]=(0,pe.useState)(0),[a,u]=(0,pe.useState)(0);K(()=>{l(v=>(v+1)%Ee.length)},80),K(()=>{u(v=>(v+1)%4)},400);let c=e??(t?"Planning approach":"Analyzing objective");return(0,ne.jsxs)(s,{marginLeft:1,children:[(0,ne.jsxs)(o,{color:i.orange,children:[Ee[n]," "]}),(0,ne.jsxs)(o,{color:i.dim,children:[c,".".repeat(a+1)]})]})}function Ie(e){if(!e.isRunning||e.replayInfo)return null;let t=e.bifurcationInfo;if(t&&!t.isSingleFlow){let n=e.steps.findIndex(a=>a.status==="running");return(n===-1?e.cmInitCounts.length===0:n>=e.cmInitCounts.length)?{label:n>0?`Planning flow ${n+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(n=>n.children?.length)?null:{hasBifurcation:!!t}}var I=R(V(),1);var Ce=R(V(),1);var re=R(k(),1),He="#ffc580",Ue="#ffd9a8",Le="#ffffff";function oe({text:e,active:t=!0}){let[n,l]=(0,Ce.useState)(0),a=4;if(K(()=>{l(c=>(c+1)%(e.length+a*2))},t?80:null),!t)return(0,re.jsx)(o,{color:Le,children:e});let u=e.split("").map((c,v)=>{let S=n-a,T=Math.abs(v-S-a/2),d;return T<=a/2?d=He:T<=a?d=Ue:d=Le,(0,re.jsx)(o,{color:d,children:c},v)});return(0,re.jsx)(o,{children:u})}var _=R(k(),1),We={starting:i.orange,running:i.orange,passed:i.green,failed:i.red,cancelled:i.dim,timed_out:i.orange};function ie({currentStep:e,maxSteps:t,elapsed:n,status:l}){let a=We[l]??i.orange,u=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`;return(0,_.jsxs)(s,{marginLeft:3,children:[(0,_.jsx)(o,{color:i.dim,children:"Steps "}),(0,_.jsx)(o,{bold:!0,children:e}),(0,_.jsxs)(o,{color:i.dim,children:["/",t]}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Elapsed "}),(0,_.jsx)(o,{bold:!0,children:u}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Status "}),(0,_.jsx)(o,{bold:!0,color:a,children:l})]})}var Ve={click:"\u25CF",type:"\u229E",scroll:"\u2195",navigate:"\u2192",analyze:"\u25CE",assert:"\u25C8","if-else":"\u2442",select:"\u25BC",press_key:"\u21B5",wait:"\u2026",tool_call:"\u2299"};function Oe(e){return Ve[e]??"\u25CF"}var q=R(k(),1);function fe({steps:e,flows:t,cmInitCounts:n,renderStep:l}){return(0,q.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,q.jsxs)(o,{color:i.dim,children:["\u2501\u2501 Bifurcated into ",t?.length??e.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),e.map((a,u)=>(0,q.jsxs)(s,{flexDirection:"column",marginTop:u>0?1:0,children:[(0,q.jsxs)(o,{color:i.orange,children:["Flow ",u+1,": ",t?.[u]??a.objective]}),n&&n[u]!=null&&(0,q.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",n[u]," checkpoints"]}),a.children&&a.children.length>0?a.children.map(c=>{let v=!!c.branchObjective,S=`f${u}-${c.childId??"p"}-${c.index}`;return v?(0,q.jsxs)(s,{flexDirection:"column",children:[l({...c,children:void 0},S),(c.children??[]).map(T=>(0,q.jsx)(s,{marginLeft:2,children:l(T,`${S}-${T.childId??"p"}-${T.index}`)},`${S}-${T.childId??"p"}-${T.index}`))]},`${S}-host`):l(c,S)}):a.status==="pending"&&(0,q.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})]},u))]})}var H=R(k(),1);function Pe({label:e,shimmer:t=!1}){return(0,H.jsxs)(s,{marginLeft:6,children:[(0,H.jsx)(te,{}),(0,H.jsx)(o,{children:" "}),t?(0,H.jsx)(oe,{text:e,active:!0}):(0,H.jsx)(o,{color:i.dim,children:e})]})}var De=R(V(),1);var me=R(k(),1);function ze(e,t){let n=[];for(let l of e.split(`
3
- `)){if(l===""){n.push("");continue}let a="";for(let u of l.split(" ")){let c=u;for(;c.length>t;)a&&(n.push(a),a=""),n.push(c.slice(0,t)),c=c.slice(t);a===""?a=c:a.length+1+c.length<=t?a+=" "+c:(n.push(a),a=c)}n.push(a)}return n}function je({text:e,maxLines:t=3}){let{stdout:n}=ee(),l=Math.max(20,(n?.columns??80)-7),a=!e.trim(),[u,c]=(0,De.useState)(!0);K(()=>c(T=>!T),500);let v=(a?"Thinking\u2026":e)+(u?"\u258C":" "),S=ze(v,l).slice(-t);for(;S.length<t;)S.push("");return(0,me.jsx)(s,{borderStyle:"round",borderColor:i.muted,paddingX:1,marginLeft:3,flexDirection:"column",children:S.map((T,d)=>(0,me.jsx)(o,{color:a?i.dim:i.secondary,wrap:"truncate-end",children:T.length?T:" "},d))})}var U=R(k(),1);function se({activity:e,describe:t,describeVisible:n}){return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(Pe,{label:e.label,shimmer:e.shimmer}):null,n?(0,U.jsx)(je,{text:t??""}):null]})}var r=R(k(),1);function le(e){for(let t of e){if(t.children&&t.children.length>0){let n=le(t.children);if(n)return n}if(t.status==="running")return t}}function z(e){return e.status==="running"&&!e.branchObjective&&(!e.children||e.children.length===0)}function Fe(e){let t=[];for(let n of e)z(n)||(n.children&&n.children.length>0?t.push({...n,children:Fe(n.children)}):t.push(n));return t}function ge(e,t){if(!e)return null;let n=e.objective??"";return n.length>0&&!/^Step \d+$/.test(n)?{label:n+"\u2026",shimmer:!1}:{label:t?"Looking at the screen\u2026":"Deciding next action\u2026",shimmer:!0}}function P({step:e,indent:t=2}){let n=e.actionType?Oe(e.actionType):null,l=e.status==="running",a=e.status==="passed",u=e.status==="failed",c=e.status==="pending"||e.status==="stopped",{stdout:v}=ee(),S=v?.columns??80,T=Math.max(20,S-t-21),d=e.objective??"",L=d.length>T?d.slice(0,T-1)+"\u2026":d,O=(e.duration??0)*1e3,y=e.duration!=null?O<1e3?`${Math.round(O)}ms`:`${(O/1e3).toFixed(1)}s`:"";return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsxs)(s,{marginLeft:t,children:[(0,r.jsx)(s,{width:4,children:(0,r.jsxs)(o,{color:i.muted,children:[String(e.index).padStart(2," ")," "]})}),(0,r.jsx)(s,{width:3,children:l?(0,r.jsx)(te,{}):a?(0,r.jsx)(o,{color:i.green,bold:!0,children:"\u2713"}):u?(0,r.jsx)(o,{color:i.red,bold:!0,children:"\u2717"}):(0,r.jsx)(o,{color:i.muted,children:"\u25CB"})}),(0,r.jsx)(s,{flexGrow:1,children:l?(0,r.jsx)(oe,{text:L,active:!0}):u?(0,r.jsx)(o,{color:i.red,children:L}):c?(0,r.jsx)(o,{color:i.dim,children:L}):(0,r.jsx)(o,{color:i.dim,children:L})}),(a||u)&&n?(0,r.jsx)(s,{width:3,marginLeft:1,children:(0,r.jsx)(o,{color:i.muted,children:n})}):(0,r.jsx)(s,{width:3,marginLeft:1}),(0,r.jsx)(s,{width:7,justifyContent:"flex-end",children:(0,r.jsx)(o,{color:i.dim,children:y})})]}),e.children&&e.children.length>0&&(0,r.jsx)(s,{flexDirection:"column",children:e.children.map((h,b)=>(0,r.jsx)(P,{step:h,indent:t+2},`child-${b}`))})]})}function Xe(e){return e.type==="cm_init"?(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",e.count," checkpoints"]})}):(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsx)(P,{step:e.step})})}function _e({steps:e,bifurcated:t,flows:n,cmInitCounts:l,maxSteps:a=50,staticSteps:u=!1,onStepCommit:c,describe:v,describeVisible:S,describeRevealing:T}){let d=(0,I.useRef)(new Set),L=(0,I.useRef)(!1),O=(0,I.useRef)(new Set),y=(0,I.useRef)(!1),h=(0,I.useRef)(new Set),b=(0,I.useRef)(0);(0,I.useEffect)(()=>{e.length===0&&b.current>0&&(d.current.clear(),L.current=!1,O.current.clear(),y.current=!1,h.current.clear()),b.current=e.length},[e.length]);let B=e.flatMap(p=>[p,...p.children??[]]),F=B.some(p=>p.status==="running"),M=B.some(p=>p.status==="failed"),X=B.length===0||B.every(p=>p.status==="pending"),Y=B.filter(p=>p.status==="passed"||p.status==="failed").length,N;X?N="starting":F?N="running":M?N="failed":N="passed";let J=(0,I.useRef)(null),[ce,he]=(0,I.useState)(0);(0,I.useEffect)(()=>{B.length===0||X?(J.current=null,he(0)):F&&J.current==null&&(J.current=Date.now())},[F,X,B.length]),(0,I.useEffect)(()=>{if(!F)return;let p=setInterval(()=>{J.current!=null&&he((Date.now()-J.current)/1e3)},500);return()=>clearInterval(p)},[F]);let ae=(0,I.useRef)(new Set),[,xe]=(0,I.useState)(0),be=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!c||!u||t)return;let p=[];!be.current&&l&&l[0]!=null&&(be.current=!0,l[0]>0&&p.push({key:"cm_init_0",type:"cm_init",count:l[0]}));for(let g of e)(g.status==="passed"||g.status==="failed")&&!ae.current.has(g.index)&&(ae.current.add(g.index),p.push({key:`step_${g.index}`,type:"step",step:{...g,children:g.children?[...g.children]:void 0}}));if(p.length>0){for(let g of p)c(Xe(g));xe(g=>g+1)}},[e,t,l,u,c]),(0,I.useEffect)(()=>{if(!c||u)return;let p=d.current.size;if(!t&&!y.current&&l&&l[0]!=null&&(y.current=!0,l[0]>0&&c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25A0 Generated task with ",l[0]," checkpoints"]})}))),t&&n&&!L.current&&(L.current=!0,c((0,r.jsx)(o,{color:i.purple,children:"\u2501\u2501 Bifurcated into "+n.length+" flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"}))),t){let g=e.flatMap((x,f)=>{let m=x.children??[];return!O.current.has(f)&&m.length>0&&(O.current.add(f),c((0,r.jsx)(o,{color:i.purple,children:" Flow "+(f+1)+": "+(n?.[f]??"")})),l?.[f]!=null&&l[f]>0&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})})))),l?.[f]!=null&&l[f]>0&&O.current.has(f)&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})}))),m});for(let x of g){let f=`${x.childId??"p"}-${x.index}-${x.objective}`;if(!!x.branchObjective){d.current.has(f)||(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...x,children:void 0}})})));for(let $ of x.children??[]){let w=`child-${x.childId??"p"}-${x.index}-${$.childId??"p"}-${$.index}-${$.objective}`;d.current.has(w)||($.status==="passed"||$.status==="failed"||$.status==="stopped")&&(d.current.add(w),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:$})})))}continue}d.current.has(f)||(x.status==="passed"||x.status==="failed"||x.status==="stopped")&&(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:x})})))}}else for(let g of e){let x=`${g.index}-${g.objective}`,f=!!g.branchObjective;f&&!d.current.has(x)&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})));for(let m of g.children??[]){let $=`child-${g.index}-${m.childId??"p"}-${m.index}-${m.objective}`;d.current.has($)||(m.status==="passed"||m.status==="failed"||m.status==="stopped")&&(d.current.add($),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:m})})))}!f&&!d.current.has(x)&&(g.status==="passed"||g.status==="failed"||g.status==="stopped")&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})))}d.current.size>p&&xe(g=>g+1)},[e,c,t,n,l]);let G=[];if(u&&!t)for(let p of e)ae.current.has(p.index)||G.push(p);else if(c&&!u)if(t)for(let p of e){let g=p.children??[],x=[];for(let f of g){let m=`${f.childId??"p"}-${f.index}-${f.objective}`,$=d.current.has(m);if(f.branchObjective){let w=(f.children??[]).filter(Q=>{let ue=`child-${f.childId??"p"}-${f.index}-${Q.childId??"p"}-${Q.index}-${Q.objective}`;return!d.current.has(ue)});(!$||w.length>0)&&x.push({...f,children:w})}else $||x.push(f)}x.length>0&&G.push({...p,children:x})}else for(let p of e){let g=`${p.index}-${p.objective}`,x=d.current.has(g),f=(p.children??[]).filter(m=>{let $=`child-${p.index}-${m.childId??"p"}-${m.index}-${m.objective}`;return!d.current.has($)});x?f.length>0&&G.push({...p,children:f}):G.push({...p,children:f})}if(!u){let p=c?G:e,g=le(p),x=ge(g,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[t?c?p.length>0?(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:p.map((m,$)=>(0,r.jsx)(s,{flexDirection:"column",marginTop:$>0?1:0,children:m.children&&m.children.length>0?m.children.map(w=>{if(z(w))return null;let Q=!!w.branchObjective,ue=`${w.childId??"p"}-${w.index}-${w.objective}`,Ke=d.current.has(ue);return Q?(0,r.jsxs)(s,{flexDirection:"column",children:[!Ke&&(0,r.jsx)(P,{step:{...w,children:void 0}}),(w.children??[]).filter(Z=>!z(Z)).map(Z=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:Z})},`f${$}-${w.index}-${Z.childId??"p"}-${Z.index}`))]},`f${$}-host-${w.childId??"p"}-${w.index}`):(0,r.jsx)(P,{step:w},`f${$}-${w.childId??"p"}-${w.index}`)}):m.status==="pending"&&(0,r.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})},$))}):null:(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(m,$)=>z(m)?null:(0,r.jsx)(P,{step:m},$)}):(0,r.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[!c&&l&&l[0]!=null&&(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",l[0]," checkpoints"]}),p.filter(m=>!(m.status==="running"&&(!m.children||m.children.length===0))).map(m=>{let $=`${m.index}-${m.objective}`;return c&&d.current.has($)?(0,r.jsx)(s,{flexDirection:"column",children:(m.children??[]).filter(w=>!z(w)).map(w=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:w})},`${w.childId??"p"}-${w.index}`))},`branch-children-${m.index}`):(0,r.jsx)(P,{step:m},m.index)})]}),(0,r.jsx)(se,{activity:x,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}if(t){let p=le(e),g=ge(p,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(x,f)=>z(x)?null:(0,r.jsx)(P,{step:x},f)}),(0,r.jsx)(se,{activity:g,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}let Ne=le(G),Ge=ge(Ne,T),Re=Fe(G);return(0,r.jsxs)(s,{flexDirection:"column",children:[Re.length>0&&(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:Re.map(p=>(0,r.jsx)(P,{step:p},p.index))}),(0,r.jsx)(se,{activity:Ge,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}var W=R(k(),1);function Ae({runner:e,runKey:t,onStepCommit:n}){let l=Ie({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,W.jsxs)(W.Fragment,{children:[l&&(0,W.jsx)(ke,{label:l.label,hasBifurcation:l.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,W.jsx)(_e,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:n},`run-${t}`)]})}var D=R(k(),1),Ye=64;function Je(e){return e.split(`
4
- `).map(t=>t.replace(/^[-–•]\s*/,"").trim()).filter(t=>t.length>0)}function qe({status:e,summary:t,duration:n,steps:l,stepsPassed:a,stepsFailed:u,reason:c,creditsConsumed:v}){let S=e==="passed",T=S?i.green:i.red,d=S?"\u2713":"\u2717",L=e.toUpperCase(),O=a??(S?l:Math.max(0,l-1)),y=u??(S?0:1),h=y>0?`${l} steps (${O} passed, ${y} failed)`:`${l} steps`,b=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`,B=Je(t);return(0,D.jsx)(s,{flexDirection:"column",marginTop:1,children:(0,D.jsxs)(s,{borderStyle:"round",borderColor:T,flexDirection:"column",paddingX:2,paddingY:1,width:Ye+6,children:[(0,D.jsxs)(s,{flexDirection:"column",children:[(0,D.jsxs)(o,{bold:!0,color:T,children:[d," ",L]}),(0,D.jsxs)(o,{color:i.dim,wrap:"wrap",children:[h," \xB7 ",b,typeof v=="number"&&v>0?` \xB7 ${parseFloat(v.toFixed(4))} credits`:""]})]}),B.length>0&&(0,D.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:B.map((F,M)=>(0,D.jsxs)(s,{marginBottom:M<B.length-1?1:0,children:[(0,D.jsx)(o,{color:i.orange,children:"\u25CF "}),(0,D.jsx)(s,{flexShrink:1,children:(0,D.jsx)(o,{wrap:"wrap",children:F})})]},M))}),c&&!S&&(0,D.jsx)(s,{marginTop:1,children:(0,D.jsxs)(o,{color:i.red,wrap:"wrap",children:["Reason: ",c]})})]})})}var j=R(k(),1);function Me({message:e,code:t,remediation:n,docsUrl:l}){return(0,j.jsx)(ve,{title:"Error",variant:"error",children:(0,j.jsxs)(s,{flexDirection:"column",paddingY:1,children:[(0,j.jsxs)(o,{color:i.red,bold:!0,children:[" \u2717 ",e]}),t&&(0,j.jsxs)(s,{marginTop:0,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Code: "}),(0,j.jsx)(o,{color:i.dim,children:t})]}),n&&(0,j.jsxs)(s,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.green,bold:!0,children:"Fix:"}),(0,j.jsxs)(o,{color:i.orange,children:["$ ",n]})]}),l&&(0,j.jsxs)(s,{marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Docs: "}),(0,j.jsx)(o,{color:i.orange,underline:!0,children:l})]})]})})}var E=R(k(),1);function un(e){let{exit:t}=Te(),{append:n}=ye(),l=(0,A.useRef)(!1);(0,A.useEffect)(()=>{l.current||(l.current=!0,n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsxs)(s,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,E.jsx)(o,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.orange,children:e.topBanner.model}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.dim,children:e.topBanner.auth})]})})),n((0,E.jsx)(Qe,{data:e.globalConfig})),e.priorAttemptRollup&&n((0,E.jsx)(o,{color:i.dim,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})))},[]);let a=(0,A.useRef)(null),u=(0,A.useCallback)(async y=>{let h=await e.getNextStep(y);return h?(a.current=h,h.config):(a.current=null,null)},[e]),c=(0,A.useCallback)((y,h)=>{let b=a.current;if(!b)return;let B=b.mode==="replay"?"cyan":"#dc4e08",F=b.modeReason?` (${b.modeReason})`:"",M=b.perStepOverrides?Object.entries(b.perStepOverrides):[];n((0,E.jsxs)(s,{flexDirection:"column",marginBottom:0,children:[(0,E.jsxs)(o,{children:[(0,E.jsxs)(o,{color:i.dim,children:[b.banner.stepLabel," "]}),(0,E.jsxs)(o,{color:B,children:["[",b.mode,"]"]}),(0,E.jsx)(o,{color:i.dim,children:F})]}),(0,E.jsx)(o,{color:i.dim,children:b.banner.objective}),M.length>0&&(0,E.jsxs)(o,{color:i.dim,children:["overrides: ",M.map(([X,Y])=>`${X}=${Y}`).join(", ")]})]}))},[n]),v=(0,A.useRef)(0),S=(0,A.useRef)(!1),T=(0,A.useCallback)((y,h)=>(y.hadError?n((0,E.jsx)(Me,{message:y.reason??"Runner error",code:"RUNNER_ERROR"})):n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsx)(qe,{status:y.status,summary:y.runEnd?.summary??"",duration:y.runEnd?.duration??0,steps:y.stepsTotal,stepsPassed:y.stepsPassed,stepsFailed:y.stepsFailed,reason:y.runEnd?.reason,creditsConsumed:y.runEnd?.credits_consumed})})),e.onStepEnd?.(y,h)??!0),[n,e]),d=we({getNextConfig:u,onStepStart:c,onStepEnd:T,onAllComplete:()=>{e.onAllComplete(),e.exitOnComplete!==!1&&setImmediate(()=>t())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts}),L=250,O=5e3;return Se((y,h)=>{if(h.ctrl&&y==="c"){let b=Date.now(),B=b-v.current;if(B<L)return;S.current&&B<O?(d.cancel(),e.onCancel?.(),e.exitOnComplete!==!1&&setImmediate(()=>t())):(S.current=!0,n((0,E.jsx)(o,{color:"yellow",children:"press Ctrl+C again to cancel run"}))),v.current=b}}),(0,E.jsx)(s,{flexDirection:"column",children:d.phase!=="done"&&(0,E.jsx)(Ae,{runner:d.runner,runKey:d.currentStepIndex,onStepCommit:n})})}function Qe({data:e}){return(0,E.jsx)(Be,{title:"test.md run",titleColor:"#ff9500",borderColor:i.dim,rows:[{label:"source",value:e.source},{label:"steps",value:`${e.steps.total} (${e.steps.replay} replay, ${e.steps.author} author per walker)`},{label:"model",value:e.model},{label:"viewport",value:`${e.viewport.width} x ${e.viewport.height}`},{label:"chrome",value:e.chrome},{label:"session",value:e.session},{label:"variables",value:`${e.variables.count} (${e.variables.secrets} secret)`},{label:"flags",value:e.flags.length>0?e.flags.join(" "):"(none)"}]})}export{_e as a,ke as b,Ie as c,de as d,qe as e,Me as f,un as g};
@@ -1,8 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as h}from"./chunk-VZ7KXRXB.js";import{c as _}from"./chunk-EYOCNMUM.js";import{dirname as j,isAbsolute as F,resolve as P}from"path";var k=["db","api","js","smartui","network_query","network_assertion","gps","accessibility","media_injection","network_throttle","deeplink"];var a=class extends Error{constructor(r,o,e){super(`[${o}${e!=null?`:${e}`:""}] ${r}`);this.file=o;this.line=e;this.name="TestMdParseError"}};var v=["if","elif","else","end-if","while","end-while"];var T={"end-if":"if","end-while":"while"};function R(n,t){let r=[],o=()=>r[r.length-1];for(let i of t){let s=i.controlFlow;if(s==="if"||s==="while"){r.push({kind:s,id:i.index,branch:0,elseSeen:!1}),i.block={id:i.index,branch:0,depth:r.length};continue}if(s==="elif"||s==="else"){let d=o();if(!d||d.kind!=="if")throw new a(`@${s} outside an open @if`,n,i.headingLine);if(d.elseSeen)throw new a(`@${s} after @else`,n,i.headingLine);d.branch+=1,d.elseSeen=s==="else",i.block={id:d.id,branch:d.branch,depth:r.length};continue}if(s==="end-if"||s==="end-while"){let d=o(),c=T[s];if(!d||d.kind!==c)throw new a(`@${s} without an open @${c}`,n,i.headingLine);i.block={id:d.id,branch:-1,depth:r.length},r.pop();continue}let l=o();l&&(i.block={id:l.id,branch:l.branch,depth:r.length})}let e=o();if(e){let i=t.find(s=>s.index===e.id);throw new a(`unclosed @${e.kind} block`,n,i?.headingLine)}}var Y=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),$=new Set(["mode","max_steps","timeout","global_context","local_context","variables","session_context","code_export","code_language","url","target","chrome_profile","cdp_endpoint","ws_endpoint","headless","app","no_reset","os_version","device_name","on_lock_conflict","tags","assurance","dataset"]),O=new Set(["optional"]),N=new Set(["optional","variables"]),M=new Set(["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"]),S=new Set(["app","no_reset","os_version","device_name"]),B=new Set(["mode","on_lock_conflict","tags","assurance","dataset"]);function be(n,t){let r=t.split(`
3
- `),{global:o,bodyStartLine:e}=G(n,r),{title:i,steps:s}=oe(n,r,e);return{path:n,title:i,global:o,steps:s}}function G(n,t){if(t[0]?.trim()!=="---")return{global:{},bodyStartLine:0};let r=-1;for(let l=1;l<t.length;l++)if(t[l].trim()==="---"){r=l;break}if(r===-1)throw new a("frontmatter is missing closing '---'",n,1);let o=t.slice(1,r).join(`
4
- `),e;try{e=h(o)??{}}catch(l){throw new a(`invalid YAML in frontmatter: ${l.message}`,n,1)}if(A(n,e,"frontmatter",1),e.on_lock_conflict!==void 0){let l=e.on_lock_conflict;if(l!=="readonly"&&l!=="fail"&&l!=="wait")throw new a(`on_lock_conflict must be 'readonly' | 'fail' | 'wait', got: ${JSON.stringify(l)}`,n,1)}if(E(n,e,1),se(n,e,1),e.assurance!==void 0){let l=e.assurance;if(l===null||typeof l!="object"||Array.isArray(l))throw new a("assurance must be a mapping with sub-keys {id, base}",n,1);let d=l;for(let c of Object.keys(d))if(c!=="id"&&c!=="base")throw new a(`unknown assurance sub-key '${c}' \u2014 the engine block allows only {id, base}`,n,1);if(typeof d.id!="string"||d.id.length===0)throw new a("assurance.id must be a non-empty string (logical id)",n,1);if(d.base!==void 0&&!(typeof d.base=="string"&&/^sha256:[0-9a-f]+$/.test(d.base)))throw new a("assurance.base must be a 'sha256:<hex>' string",n,1)}if(e.tags!==void 0){let l=e.tags,d=Array.isArray(l)?l.map(c=>String(c)).join(","):String(l);e.tags=I(d,n,1)}if(e.target!==void 0&&(e.target=q(e.target,n,1)),e.app!==void 0&&(e.app=H(e.app,n,1)),e.no_reset!==void 0&&typeof e.no_reset!="boolean")throw new a(`no_reset must be boolean: got ${typeof e.no_reset}`,n,1);if(e.os_version!==void 0&&typeof e.os_version!="string")if(typeof e.os_version=="number")e.os_version=String(e.os_version);else throw new a(`os_version must be a string: got ${typeof e.os_version}`,n,1);let i=e.target,s=i==="emulator"||i==="simulator";if(i==="android"||i==="ios"){for(let l of S)if(e[l]!==void 0)throw new a(`${l} cannot be set with target: ${i} \u2014 a real-device run takes its device and app from the run's device config`,n,1)}if(s&&e.app===void 0)throw new a(`target: ${String(i)} needs an app \u2014 add \`app: <path-to-build | AppId>\``,n,1);if(!s&&e.app!==void 0)throw new a("app requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(!s&&e.no_reset!==void 0)throw new a("no_reset requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(!s&&e.os_version!==void 0)throw new a("os_version requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(e.device_name!==void 0&&typeof e.device_name!="string")throw new a(`device_name must be a string: got ${typeof e.device_name}`,n,1);if(!s&&e.device_name!==void 0)throw new a("device_name requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);return{global:e,bodyStartLine:r+1}}function I(n,t,r){let e=n.trim().replace(/^\[/,"").replace(/\]$/,"").split(",").map(i=>i.trim().toLowerCase());if(e.length===0||e.some(i=>i.length===0))throw new a("tags must be a non-empty list of non-empty strings",t,r);return[...new Set(e)]}var V=new Set(["chrome","cdp","ws","emulator","simulator","android","ios"]),W="target must be one of 'chrome' | 'cdp' | 'ws' (web), 'emulator' | 'simulator' (mobile, with a root `app:` key) or 'android' | 'ios' (a real device)";function q(n,t,r){if(typeof n=="string"&&V.has(n))return n;throw n!==null&&typeof n=="object"&&!Array.isArray(n)?new a(`the mapping form of target is no longer accepted \u2014 write flat keys:
5
- target: emulator | simulator
6
- app: <path-to-build | AppId>`,t,r):new a(`${W} \u2014 got: ${JSON.stringify(n)}`,t,r)}function H(n,t,r){if(typeof n!="string"||n.trim().length===0)throw new a("app must be a build (e.g. ./builds/app-debug.apk) or an app id from your cloud uploads",t,r);let o=n.trim();if(!/\.(apk|zip)$/i.test(o)&&!/^APP\d{6,}$/.test(o))throw new a(`app '${o}' is not a build \u2014 expected a path ending in .apk or .zip, or an app id from your cloud uploads.`,t,r);return z(o,t)}function z(n,t){return/^APP[0-9A-Za-z_-]+$/.test(n)||F(n)?n:P(j(t),n)}function ye(n){let t=n.target;if(t==="android"||t==="ios")return{platform:t,app:"",realDevice:!0};if(!(t!=="emulator"&&t!=="simulator"))return{platform:_(t)??"",app:n.app??"",...n.no_reset!==void 0?{no_reset:n.no_reset}:{},...n.os_version!==void 0?{os_version:n.os_version}:{},...n.device_name!==void 0?{device_name:n.device_name}:{}}}function he(n){let t=n.target;return t==="chrome"||t==="cdp"||t==="ws"?t:void 0}var D=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function J(n,t,r){let o=D.exec(t);if(o)return{label:t.slice(0,o.index).trim(),verifies:o[1].split(",").map(i=>i.trim())};let e=t.lastIndexOf("@verifies");if(e>0&&/\s/.test(t[e-1])){let i=t.slice(e+9).split(/[\s,]+/).filter(s=>s.length>0);if(i.length===0||i.every(s=>s.startsWith("ac-")))throw new a("malformed @verifies directive \u2014 expected '@verifies ac-<id>[, ac-<id>\u2026]' at the end of the heading",n,r)}return{label:t,verifies:[]}}var x=k.join("|"),U=new RegExp(`^(.*\\S)\\s+@(${x})\\s*$`),Z=new RegExp(`^@(${x})\\s*$`);function Q(n,t,r,o){let e=Z.exec(t);if(e)throw new a(`replay-only marker @${e[1]} needs a step label before it (e.g. '## Step 3 @${e[1]}')`,n,r);let i=U.exec(t);if(!i)return null;let s=i[2];if(o)throw new a(`only one replay-only marker per step \u2014 found @${o} and @${s}`,n,r);return{label:i[1].trim(),replayOnly:s}}var L=v.join("|"),X=new RegExp(`^(.*\\S)\\s+@(${L})\\s*$`),ee=new RegExp(`^@(${L})\\s*$`);function ne(n,t,r,o){let e=ee.exec(t);if(e)throw new a(`control-flow marker @${e[1]} needs a step label before it (e.g. '## banner is visible @${e[1]}')`,n,r);let i=X.exec(t);if(!i)return null;let s=i[2];if(o)throw new a(`only one control-flow marker per step \u2014 found @${o} and @${s}`,n,r);return{label:i[1].trim(),controlFlow:s}}function te(n,t,r){let o=t,e,i,s=()=>{let d=Q(n,o,r,e);d&&({label:o,replayOnly:e}=d);let c=ne(n,o,r,i);c&&({label:o,controlFlow:i}=c)};s();let l=J(n,o,r);if(o=l.label,s(),e&&i)throw new a(`@${i} is a control-flow marker and @${e} a replay-only marker \u2014 a step carries one or the other`,n,r);return{label:o,verifies:l.verifies,...e?{replayOnly:e}:{},...i?{controlFlow:i}:{}}}function oe(n,t,r){let o,e=r;for(;e<t.length&&t[e].trim()==="";)e++;let i=e<t.length?/^#\s+(.+?)\s*$/.exec(t[e]):null;i&&(o=i[1],e++);let s=[];for(let d=e;d<t.length;d++)/^##\s/.test(t[d])&&s.push(d);let l=[];for(let d=0;d<s.length;d++){let c=s[d],p=s[d+1]??t.length,w=t[c].replace(/^##\s+/,"").trim(),{label:m,verifies:f,replayOnly:u,controlFlow:g}=te(n,w,c+1),b=t.slice(c+1,p),{config:C,body:y,optional:K}=re(n,c+1,b);if(u&&y.kind==="import_ref")throw new a(`@${u} is a replay-only marker for objective steps \u2014 it cannot mark an @import row`,n,c+1);if(g&&y.kind==="import_ref")throw new a(`@${g} is a control-flow marker for objective steps \u2014 it cannot mark an @import row`,n,c+1);l.push({index:d+1,heading:m,verifies:f,config:C,body:y,headingLine:c+1,optional:K,...u?{replayOnly:u}:{},...g?{controlFlow:g}:{}})}return R(n,l),{title:o,steps:l}}function re(n,t,r){let o=0;for(;o<r.length&&r[o].trim()==="";)o++;let e,i=t;if(o<r.length&&/^```yaml\s*$/.test(r[o])){let f=o;i=t+f,o++;let u=-1;for(;o<r.length;){if(/^```\s*$/.test(r[o])){u=o;break}o++}if(u===-1)throw new a("step-config fenced ```yaml block is not closed",n,i);let g=r.slice(f+1,u).join(`
7
- `);try{e=h(g)??{}}catch(b){throw new a(`invalid YAML in step config: ${b.message}`,n,i)}o=u+1}let s=ie(r.slice(o)),l=s.filter(f=>f.trim()!=="");if(l.length>0&&/^@session\s+/.test(l[0].trim()))throw new a("@session is no longer supported (iteration 3); use @import instead",n,t);let d=/^@import\s+(\S.*)$/,p=s.filter(f=>d.test(f.trim())).length>0;if(p&&l.length!==1)throw new a("step body must be exactly one of prose / @import",n,t);let w=!1,m;if(e){if(A(n,e,p?"step config (ref)":"step config (objective)",i),E(n,e,i),typeof e.optional=="boolean")w=e.optional;else if(e.optional!==void 0)throw new a(`step config 'optional' must be boolean: got ${typeof e.optional}`,n,i);let f={...e};delete f.optional,p&&delete f.variables,!p&&Object.keys(f).length>0&&(m=f)}if(p){let u=d.exec(l[0].trim())[1].trim(),g=e?.variables;return{body:{kind:"import_ref",path:u,...g&&Object.keys(g).length>0?{bindings:g}:{}},optional:w}}return{body:{kind:"objective",text:s.join(`
8
- `).trim()},config:m,optional:w}}function ie(n){let t=0,r=n.length;for(;t<r&&n[t].trim()==="";)t++;for(;r>t&&n[r-1].trim()==="";)r--;return n.slice(t,r)}function E(n,t,r){let o=t.variables;if(o==null)return;if(typeof o!="object"||Array.isArray(o))throw new a("variables must be an object map",n,r);let e={};for(let[i,s]of Object.entries(o))if(typeof s=="string")e[i]={value:s};else if(s&&typeof s=="object"&&!Array.isArray(s)&&typeof s.value=="string")e[i]=s;else throw new a(`variable '${i}' must be a string or { value: ... } object`,n,r);t.variables=e}function se(n,t,r){let o=t.dataset;if(o==null)return;if(typeof o=="string"){if(!o.trim())throw new a("dataset needs an id",n,r);t.dataset={id:o.trim()};return}if(typeof o!="object"||Array.isArray(o))throw new a("dataset must be an id or a mapping { id, row }",n,r);let e=o;for(let s of Object.keys(e))if(s!=="id"&&s!=="row")throw new a(`unknown dataset sub-key '${s}' \u2014 only { id, row } are allowed`,n,r);if(typeof e.id!="string"||!e.id.trim())throw new a("dataset needs an id",n,r);let i={id:e.id.trim()};if(e.row!==void 0){let s=e.row;if(!(typeof s=="string"&&s.trim().length>0&&!/^\d+$/.test(s.trim())))throw new a(`dataset row must be the row's _id as Test Manager shows it, not a position: got ${JSON.stringify(s)}`,n,r);i.row=s.trim()}t.dataset=i}function A(n,t,r,o){for(let e of Object.keys(t)){if(Y.has(e))throw new a(`auth/identity keys are CLI-only: ${e}`,n,o);if(r==="frontmatter"){if(O.has(e))throw new a(`step-only key in frontmatter: ${e}`,n,o);if(!$.has(e))throw new a(`unknown config key: ${e}`,n,o)}else if(r==="step config (objective)"){if(!$.has(e)&&!O.has(e))throw new a(`unknown config key: ${e}`,n,o);if(M.has(e))throw new a(`chrome config is global-only: ${e}`,n,o);if(S.has(e))throw new a(`'${e}' is global-only: the whole run drives one app`,n,o);if(B.has(e))throw new a(`'${e}' is run-level and cannot be set per-step`,n,o)}else if(!N.has(e))throw new a(`step config on @import may only contain 'optional' / 'variables': got ${e}`,n,o)}}export{be as a,ye as b,he as c,D as d};
@@ -1,6 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Y,b as Z,c as ee,d as ne,e as te}from"./chunk-44NNFVCJ.js";import{b as ie,c as re}from"./chunk-YFQGOOF7.js";import{n as X,p as P}from"./chunk-RSSOJ3L2.js";import{a as Pe}from"./chunk-6YGTRKDT.js";import{e as Ce}from"./chunk-UR6MHSHU.js";function se(i){return{command:"start",...i}}function oe(i,n,s){return{command:"run",run_id:i,kind:n,...s}}function ae(i){return{command:"cancel",...i?{run_id:i}:{}}}function ue(i){return{command:"ask_user_response",answer:i}}function de(i={}){return{command:"shutdown",...i.testStatus?{test_status:i.testStatus,remark:i.remark??""}:{}}}var z=Symbol("run-queue-end"),G=class{items=[];waiting=null;ended=!1;error=null;push(n){if(this.waiting){let{resolve:s}=this.waiting;this.waiting=null,s(n)}else this.items.push(n)}end(){if(this.ended=!0,this.waiting){let{resolve:n}=this.waiting;this.waiting=null,n(z)}}fail(n){if(this.error=n,this.waiting){let{reject:s}=this.waiting;this.waiting=null,s(n)}}next(){return this.items.length>0?Promise.resolve(this.items.shift()):this.error?Promise.reject(this.error):this.ended?Promise.resolve(z):new Promise((n,s)=>{this.waiting={resolve:n,reject:s}})}},D=class{env;runner;log;sessionId;spawnFn;proc=null;activeRun=null;pendingReady=null;shuttingDown=!1;finalized=!1;exitInfo=null;exitedUnexpectedly=!1;exitResolve;exited;constructor(n){this.env=n.env,this.runner=n.runner,this.log=n.log,this.sessionId=n.sessionId,this.spawnFn=n.spawn??Z;let s;this.exited=new Promise(l=>{s=l}),this.exitResolve=s}async start(n){if(this.proc)throw new Error("PersistentRunner.start called twice");this.proc=this.spawnFn({env:this.env,runner:this.runner,log:this.log,sessionId:this.sessionId}),this.consume();let s=new Promise((l,g)=>{this.pendingReady={resolve:l,reject:g}});this.writeCommand(se(n)),await s}async*run(n,s,l){if(!this.proc)throw new Error("PersistentRunner.run called before start");if(this.finalized)throw new Error(`v16-runner is not running (exited code=${this.exitInfo?.code??"null"}, signal=${this.exitInfo?.signal??"none"}) \u2014 cannot start run '${n}'`);if(this.activeRun)throw new Error(`PersistentRunner.run overlap: '${this.activeRun.runId}' still in flight`);let g=new G,w={runId:n,queue:g};this.activeRun=w,this.writeCommand(oe(n,s,l));try{for(;;){let v=await g.next();if(v===z||(yield v,v.type==="run_end"&&(v.run_id===void 0||v.run_id===n)))break}}finally{this.activeRun===w&&(this.activeRun=null)}}sendUserResponse(n){this.writeCommand(ue(n))}cancel(n){this.writeCommand(ae(n))}kill(){this.proc?.child.kill("SIGTERM")}async shutdown(n={}){this.shuttingDown=!0,this.proc&&(this.writeCommand(de(n)),await this.exited)}get stderr(){return this.proc?.getStderr()??""}get diedUnexpectedly(){return this.exitedUnexpectedly}writeCommand(n){let s=JSON.stringify(n)+`
3
- `;try{this.proc?.child.stdin?.write(s)}catch{}}async consume(){if(!this.proc)return;try{for await(let l of this.proc.events){if(l.type==="ready"){this.onReady();continue}if(l.type==="error"&&this.pendingReady){this.onStartError(l.message);continue}this.routeEvent(l)}}catch(l){this.log?.("error","PERSISTENT_RUNNER_STREAM_ERROR","Runner stdout stream errored",{error:l instanceof Error?l.message:String(l)})}let{code:n,signal:s}=await this.proc.exited;this.onExit(n,s)}onReady(){if(this.pendingReady){let{resolve:n}=this.pendingReady;this.pendingReady=null,n()}}onStartError(n){if(!this.pendingReady)return;let{reject:s}=this.pendingReady;this.pendingReady=null,s(new Error(`failed to start: ${n??"unknown error"}`))}routeEvent(n){let s=this.activeRun;if(!s){this.log?.("warn","PERSISTENT_RUNNER_ORPHAN_EVENT","Runner event with no active run",{event_type:n.type});return}s.queue.push(n)}onExit(n,s){if(!this.finalized){if(this.finalized=!0,this.exitInfo={code:n,signal:s},this.shuttingDown||(this.exitedUnexpectedly=!0),this.exitResolve({code:n,signal:s}),this.pendingReady){let{reject:l}=this.pendingReady;this.pendingReady=null,l(new Error(`v16-runner exited before ready (code=${n}, signal=${s??"none"})`))}if(this.activeRun){let{queue:l}=this.activeRun;if(this.activeRun=null,this.shuttingDown)l.end();else{let g=this.proc?.getStderr()?.slice(-500)??"";l.fail(new Error(`v16-runner exited unexpectedly mid-run (code=${n}, signal=${s??"none"})${g?`
4
- ${g}`:""}`))}}}}};var p=Ce(Pe(),1);function le(i){let n={cdp_endpoint:i.cdp_endpoint,ws_endpoint:i.ws_endpoint,width:i.width,height:i.height,headless:i.headless,model:i.model,max_steps:i.max_steps,network_ws:i.network_ws,network_sse:i.network_sse,session_id:i.session_id};return i.device&&(n.device=i.device),i.auth&&(n.auth=i.auth),i.project_id&&(n.project_id=i.project_id),i.disable_ask_user&&(n.disable_ask_user=!0),i.username&&(n.username=i.username),i.access_key&&(n.access_key=i.access_key),n}function j(i,n){let s=null,l=(g,w)=>{for(let v=0;v<g.length;v++){let _=g[v],h=[...w,v];n(_)&&(s===null||h.length>s.length)&&(s=h),_.children&&_.children.length>0&&l(_.children,h)}};return l(i,[]),s}function N(i,n,s){if(n.length===0)return[...i];let l=n[0],g=[...i],w=g[l];if(n.length===1)g[l]=s(w);else{let v=n.slice(1),_=N(w.children??[],v,s);g[l]={...w,children:_}}return g}function ce(){return{steps:[],maxOrdinal:0}}function je(i,n){if(n.type==="run_start"&&n.child_id)return n.environment?.resolution?{...i,resolution:n.environment.resolution}:i;if(n.type==="run_start"){let s=re(i.runnerEnvironment,ie(n.environment));if(s)return{...i,runnerEnvironment:s,...s.resolution?{resolution:s.resolution}:{}}}if(n.type==="step_end"&&typeof n.ordinal=="number"&&n.id){let s={id:n.id,ordinal:n.ordinal,status:n.status,...n.kind?{kind:n.kind}:{},...typeof n.duration=="number"?{duration_ms:Math.round(n.duration*1e3)}:{},...typeof n.action_id=="string"&&n.action_id?{action_id:n.action_id}:{}};return{...i,steps:[...i.steps,s],maxOrdinal:Math.max(i.maxOrdinal,n.ordinal)}}return i}function K(i){let n=i.indexOf(": ");return n>0&&n<15?i.slice(n+2):i}function V(i){return i.map(n=>{let s=n.children?V(n.children):n.children;return n.status==="running"?{...n,status:"stopped",phase:void 0,children:s}:s!==n.children?{...n,children:s}:n})}function ze(i,n,s,l,g){let[w,v]=(0,p.useState)(!1),[_,h]=(0,p.useState)([]),[pe,T]=(0,p.useState)(null),[he,B]=(0,p.useState)(null),[fe,k]=(0,p.useState)(null),[me,W]=(0,p.useState)(null),[ve,J]=(0,p.useState)([]),[ge,H]=(0,p.useState)(null),[Re,Se]=(0,p.useState)(void 0),[ye,$]=(0,p.useState)(0),y=(0,p.useRef)(null),E=(0,p.useRef)(null),S=(0,p.useRef)(null),b=(0,p.useRef)(0),F=(0,p.useRef)(!1),U=(0,p.useRef)(ce()),O=(0,p.useRef)(null),we=(0,p.useCallback)(async(m,x)=>{let Q=O.current;if(Q)try{await Q}catch{}h([]),T(null),B(null),k(null),W(null),J([]),H(null),Se(m.max_steps),v(!0),S.current=null,b.current=0,U.current=ce();let I=y.current;if(I&&E.current!==m.session_id){try{I.kill()}catch{}y.current=null,E.current=null,$(e=>e+1),I=null}if(!I){let e=Y();if(!e){k("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available."),v(!1);return}let d=ne({environment:x?.environment,mode:x?.mode,assertionMode:x?.assertionMode,finalValidation:x?.finalValidation,username:m.username,accessKey:m.access_key,sessionId:m.session_id});m.device?.platform&&await ee(d,m.device);let u=new D({env:d,runner:e,log:x?.log,sessionId:m.session_id});y.current=u,E.current=m.session_id,I=u,X("runner",()=>{try{u.kill()}catch{}});let o=le(m);try{await u.start(o)}catch(a){k(a instanceof Error?a.message:String(a)),v(!1),P("runner","Runner start failed"),y.current=null,E.current=null,$(t=>t+1);return}}let M={...m};delete M.run_id,te(M,{environment:x?.environment});let ke=`run-${m.run_index}`,Ie=m.mode==="replay"?"replay":"author",L=I,q=(async()=>{F.current=!1;for await(let e of L.run(ke,Ie,M)){if(F.current)break;switch(U.current=je(U.current,e),e.type){case"run_start":if(e.child_id)break;if(S.current&&!S.current.isSingleFlow){let d=b.current;b.current++,h(u=>u.map((o,a)=>a===d?{...o,status:"running"}:o.status==="running"&&!o.children?.some(t=>t.status==="running")?{...o,status:o.children?.some(t=>t.status==="failed")?"failed":"passed"}:o))}break;case"bifurcation":{let d=e.flows??[],u=e.count??d.length,o={flows:d,isSingleFlow:e.is_single_flow??u<=1};W(o),S.current=o,b.current=0,h(d.map((a,t)=>({index:t+1,objective:a??`Flow ${t+1}`,status:"pending"})));break}case"step_start":{n?.("STEP_START",`Step ${e.index} started`,{index:e.index,objective:e.objective,child_id:e.child_id});let d=e.index,u=e.objective??`Step ${d}`,o=e.child_id,a=S.current&&!S.current.isSingleFlow;if(o)h(t=>{let r=j(t,c=>c.branchChildId===o)??j(t,c=>c.status==="running");return r?N(t,r,c=>{let f=(c.children??[]).map(R=>R.status==="running"&&R.childId===o?{...R,status:"stopped",phase:void 0}:R);return f.push({index:d,objective:u,status:"running",childId:o}),{...c,children:f}}):t});else if(a){let t=Math.max(0,b.current-1);h(r=>{let c=[...r];if(t>=c.length)return r;let f={...c[t]},C=[...f.children??[]].map(A=>A.status==="running"&&A.childId===void 0?{...A,status:"stopped",phase:void 0}:A);return C.push({index:d,objective:u,status:"running"}),f.children=C,f.status="running",c[t]=f,c})}else h(t=>{let r=V(t);return r.some(f=>f.index===d)?r.map(f=>f.index===d?{...f,status:"running",objective:u}:f):[...r,{index:d,objective:u,status:"running"}]});break}case"step_event":{n?.("STEP_EVENT",`Step ${e.index} ${e.event}`,{index:e.index,phase:e.event,action_type:e.action_type,detail:e.detail,child_id:e.child_id});let d=e.child_id,u=S.current&&!S.current.isSingleFlow;if(e.event==="cm_init"&&e.checkpoint_count!=null){J(o=>[...o,e.checkpoint_count]);break}if(e.event==="replay_started"){H({recordingLength:e.recording_length??0});break}if(e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&s?.(e.detail),d){let o=t=>{if(t.index!==e.index||t.childId!==d)return t;let r={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(r.objective=e.detail),e.action_type&&(r.actionType=e.action_type),{...t,...r}},a=t=>t.map(r=>{let c=o(r);return c!==r?c:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let o=Math.max(0,b.current-1);h(a=>{let t=[...a];if(o>=t.length)return a;let r={...t[o]},c=[...r.children??[]];if(!c.some(R=>R.index===e.index&&R.childId===void 0))c.push({index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type});else for(let R=0;R<c.length;R++){if(c[R].index!==e.index||c[R].childId!==void 0)continue;let C={phase:e.event};e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(C.objective=e.detail),e.action_type&&(C.actionType=e.action_type),c[R]={...c[R],...C}}return r.children=c,t[o]=r,t})}else h(o=>o.some(t=>t.index===e.index)?o.map(t=>{if(t.index!==e.index)return t;let r={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(r.objective=e.detail),e.action_type&&(r.actionType=e.action_type),{...t,...r}}):[...V(o),{index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type}]);break}case"step_end":{n?.("STEP_END",`Step ${e.index} ${e.status}`,{index:e.index,status:e.status,duration:e.duration,summary:e.summary,child_id:e.child_id}),l?.();let d=e.child_id,u=S.current&&!S.current.isSingleFlow;if(d){let o=t=>t.index===e.index&&t.childId===d?{...t,status:e.status,duration:e.duration,phase:void 0,objective:t.objective.startsWith("Step ")?K(e.summary||t.objective):t.objective}:t,a=t=>t.map(r=>{let c=o(r);return c!==r?c:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let o=Math.max(0,b.current-1);h(a=>{let t=[...a];if(o>=t.length)return a;let r={...t[o]},c=(r.children??[]).map(f=>f.index===e.index&&f.childId===void 0?{...f,status:e.status,duration:e.duration,phase:void 0,objective:f.objective.startsWith("Step ")?K(e.summary||f.objective):f.objective}:f);return r.children=c,t[o]=r,t})}else h(o=>o.map(a=>a.index===e.index?{...a,status:e.status,duration:e.duration,phase:void 0,objective:a.objective.startsWith("Step ")?K(e.summary||a.objective):a.objective}:a));{let a=S.current&&!S.current.isSingleFlow?Math.max(0,b.current-1):0,t=typeof e.ordinal=="number"&&e.id?{ordinal:e.ordinal,id:e.id}:void 0;i?.(e.index,a,e.child_id,t)}break}case"child_agent_start":{let d=e.objective??"",u=e.child_id;h(o=>{let a=j(o,t=>t.status==="running");return a?N(o,a,t=>({...t,objective:`${d} (branch)`,phase:`child: ${d.slice(0,50)}`,branchObjective:d,branchChildId:u})):o});break}case"child_agent_end":{let d=e.child_id,u=`child ${e.success?"done":"failed"}`;h(o=>{let a=j(o,t=>t.branchChildId===d);return a?N(o,a,t=>({...t,phase:u})):o.map(t=>t.phase?.startsWith("child:")?{...t,phase:u}:t)});break}case"describe_trigger":g?.(e);break;case"ask_user":T(e.question??"");break;case"run_end":h(d=>d.map(u=>u.status==="running"?{...u,status:e.status,phase:void 0}:u)),v(!1),B(e);break;case"error":v(!1),k(e.message??"Runner error"),h(d=>d.map(u=>u.status==="running"?{...u,status:"failed",phase:void 0}:u));break}}})().catch(e=>{if(y.current!==L)return;let u=[e instanceof Error?e.message:String(e)],o=L.stderr;o&&!u.join(`
5
- `).includes(o)&&u.push(o),k(u.join(`
6
- `)),v(!1),h(a=>a.map(t=>t.status==="running"?{...t,status:"failed",phase:void 0}:t)),P("runner","Runner died mid-run"),y.current=null,E.current=null,$(a=>a+1)});O.current=q,q.finally(()=>{O.current===q&&(O.current=null)})},[i,n,s,l,g]),xe=(0,p.useCallback)(m=>{y.current?.sendUserResponse(m),T(null)},[]),_e=(0,p.useCallback)(()=>{let m=y.current;m&&(m.cancel(),v(!1),T(null))},[]),be=(0,p.useCallback)(async()=>{let m=y.current;if(m){try{await Promise.race([m.shutdown(),new Promise(x=>setTimeout(x,5e3))])}catch{}P("runner","Runner shut down"),y.current=null,E.current=null,$(x=>x+1)}},[]),Ee=(0,p.useCallback)(()=>{h([]),B(null),k(null)},[]);return(0,p.useEffect)(()=>()=>{F.current=!0,P("runner","Component unmounted"),y.current=null,E.current=null},[]),{isRunning:w,steps:_,askingUser:pe,lastRunEnd:he,runError:fe,bifurcationInfo:me,cmInitCounts:ve,replayInfo:ge,maxSteps:Re,sessionGen:ye,startRun:we,sendAnswer:xe,cancelRun:_e,shutdownRunner:be,clearLastRun:Ee,getEvidenceState:()=>U.current}}export{D as a,le as b,ce as c,je as d,ze as e};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{homedir as s}from"os";import{join as t}from"path";var g="0.8.22";var a=t(s(),".testmuai","kaneai"),b=t(a,"profiles"),h=t(a,"tui-config.json"),_=t(a,"media"),A="https://registry.npmjs.org/@testmuai/kane-cli",x="https://api.github.com/repos/LambdaTest/kane-cli/releases",i="@testmuai/kane-cli-skill",L=`https://registry.npmjs.org/${i}`,r="kane-cli",u=[{dir:t(s(),".claude","skills",r),agent:"Claude Code"},{dir:t(s(),".agents","skills",r),agent:"Codex CLI"},{dir:t(s(),".gemini","skills",r),agent:"Gemini CLI"}],U="https://dd-proxy.lambdatest.com/intake/kane-cli",R="https://kaneai-playground.lambdatest.io",I=9222,E=9230,C=t(a,"chrome-profiles"),o=t(a,"hints"),T=t(o,"state.json");function f(e){return t(o,`catalog-${e}.json`)}var c=t(a,"mobile");function S(e,n="android"){return t(c,n==="ios"?`device-catalog-ios-${e}.json`:`device-catalog-${e}.json`)}var l="127.0.0.1",B=18392,v=18400,p="/callback";function N(e){return`http://${l}:${e}${p}`}var O="KANE CLI",P="*",k={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server",evidenceViewerUrl:"https://evidence.lambdatest.com",mediaArtefactsHost:"prod-mobile-artefacts.lambdatest.com",mobileAppBaseUrl:"https://api.lambdatest.com"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server",evidenceViewerUrl:"https://stage-evidence.lambdatestinternal.com",mediaArtefactsHost:"stage-mobile-artefacts.lambdatestinternal.com",mobileAppBaseUrl:"https://stage-api.lambdatestinternal.com"}},D={orange:"#ff9500",generateAccent:"#0d9488",assuranceAccent:"#b388ff",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444",amber:"#fbbf24"};export{g as a,a as b,h as c,_ as d,A as e,x as f,i as g,u as h,U as i,R as j,I as k,E as l,C as m,T as n,f as o,S as p,l as q,B as r,v as s,p as t,N as u,O as v,P as w,k as x,D as y};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as g}from"./chunk-RZ4F3BHX.js";import{openAsBlob as w}from"fs";import{basename as A}from"path";var d={emulator:{product:"app-testing",type:"emulator",source:"web-client"},simulator:{product:"app-testing",type:"simulator",source:"web-client"}},f={emulator:"application/vnd.android.package-archive",simulator:"application/zip"},b=30*6e4,u=3e4;function _(n){let t=n??{},e=Array.isArray(t.data)?t.data:[],r=[];for(let a of e){let i=a??{},c=typeof i.app_id=="string"?i.app_id:void 0;c&&r.push({appId:c,name:typeof i.name=="string"&&i.name.trim()!==""?i.name:c,...typeof i.package=="string"?{packageName:i.package}:{},...typeof i.updated_at=="string"?{updatedAt:i.updated_at}:{}})}let s=t.metaData??{},o=typeof s.total=="number"?s.total:typeof s.total=="string"&&Number.isFinite(Number(s.total))?Number(s.total):r.length;return{apps:r,total:o}}function k(){return{fileBody:n=>w(n),request:g}}function $(n){if(!n||typeof n!="object")return null;let t=n,e=typeof t.app_id=="string"?t.app_id:void 0;return e?{appId:e,...typeof t.app_url=="string"?{appUrl:t.app_url}:{},...typeof t.url=="string"?{url:t.url}:{},cached:t.cached===!0,...typeof t.name=="string"?{name:t.name}:{}}:null}function R(n){if(!n||typeof n!="object")return null;let t=n,e=typeof t.app_id=="string"?t.app_id:void 0,r=typeof t.download_url=="string"&&t.download_url!==""?t.download_url:void 0;if(!e||!r)return null;let s=typeof t.app_name=="string"&&t.app_name.trim()!==""?t.app_name:`${e}.bin`;return{appId:e,name:s,url:r,...typeof t.package=="string"?{packageName:t.package}:{},...typeof t.type=="string"?{type:t.type}:{}}}function U(n){if(!n||typeof n!="object")return null;let t=n,e=typeof t.app_id=="string"?t.app_id:void 0,r=a=>typeof t[a]=="string"&&t[a]!==""?t[a]:void 0,s=r("cf_url")??r("cf_ap_url")??r("url");if(!e||!s)return null;let o=typeof t.name=="string"&&t.name.trim()!==""?t.name:`${e}.bin`;return{appId:e,name:o,url:s,...typeof t.package=="string"?{packageName:t.package}:{},...typeof t.type=="string"?{type:t.type}:{}}}function T(n){let t=n?.cause,e=t instanceof Error?t.message:typeof t=="string"?t:void 0,r=n instanceof Error?n.message:String(n);return e&&e!==r?`${r} (${e})`:r}var p=class extends Error{constructor(e,r){super(e);this.status=r;this.name="AppUploadError"}};async function l(n){let t=await n.text();try{let e=JSON.parse(t);return e.message??e.error??t}catch{return t||`app service returned ${n.status}`}}var m=20,h=100,y=class{constructor(t,e,r={}){this.baseUrl=t;this.auth=e;this.deps={...k(),...r}}deps;headers(){return{Authorization:`Basic ${Buffer.from(`${this.auth.username}:${this.auth.accessKey}`).toString("base64")}`,Accept:"application/json"}}async upload(t,e,r={}){let s=A(t);if(!this.auth.orgId||!Number.isFinite(Number(this.auth.orgId)))throw new p(`Could not register ${s}: this account's org id is required to record an upload.`);let o=await this.uploadTarget(s,e);r.onProgress?.(`uploading ${s}\u2026`);let a=await this.deps.request(o.uploadUrl,{method:"PUT",headers:{"Content-Type":f[e]},body:await this.deps.fileBody(t),signal:r.signal??AbortSignal.timeout(b)});if(!a.ok)throw new p(`Uploading ${s} failed: ${a.status} ${await a.text()}`,a.status);let i=o.uploadUrl.split("?")[0];return this.register(s,e,i)}async uploadTarget(t,e){let r=d[e],s=new URLSearchParams({key:t,contentType:f[e],product:r.product}),o=await this.deps.request(`${this.baseUrl}/app/get-upload-url?${s.toString()}`,{method:"GET",headers:this.headers(),signal:AbortSignal.timeout(u)});if(!o.ok)throw new p(`Could not start the upload of ${t}: ${await l(o)}`,o.status);let a=await o.json();if(!a.uploadURL)throw new p(`Could not start the upload of ${t}: no upload url.`);return{key:a.Key??"",uploadUrl:a.uploadURL}}async register(t,e,r){let s=Number(this.auth.orgId),o=d[e],a=await this.deps.request(`${this.baseUrl}/app/url`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({name:t,source:o.source,type:o.type,org_id:s,url:r,product:o.product}),signal:AbortSignal.timeout(u)});if(!a.ok)throw new p(`Could not register ${t}: ${await l(a)}`,a.status);let i=$(await a.json());if(!i)throw new p(`Registering ${t} returned no app id.`);return i}async list(t){let e=t.limit??m;e<=0&&(e=m),e>h&&(e=h);let r=t.offset!==void 0&&t.offset>0?t.offset:0,s=new URLSearchParams({limit:String(e),offset:String(r),type:d[t.type].type,level:"user",searchtxt:t.search??""}),o=`${this.baseUrl}/app/list?${s.toString()}`,a;try{a=await this.deps.request(o,{method:"GET",headers:this.headers(),signal:AbortSignal.timeout(u)})}catch(i){throw new p(T(i))}if(!a.ok)throw new p(`Could not list your uploads: ${await l(a)}`,a.status);return _(await a.json())}async details(t){let e=await this.deps.request(`${this.baseUrl}/app/${encodeURIComponent(t)}/download?format=url`,{method:"GET",headers:this.headers(),signal:AbortSignal.timeout(u)});if(e.ok){let o=R(await e.json());if(o)return o}else if(e.status!==404)throw new p(`${t}: ${await l(e)}`,e.status);let r=await this.deps.request(`${this.baseUrl}/app/${encodeURIComponent(t)}/url`,{method:"GET",headers:this.headers(),signal:AbortSignal.timeout(u)});if(!r.ok)throw new p(`${t}: ${await l(r)}`,r.status);let s=U(await r.json());if(!s)throw new p(`${t} returned no download url.`);return s}async liveness(t){try{return await this.details(t),"alive"}catch(e){let r=e instanceof p?e.status:void 0;return r!==void 0&&r>=400&&r<500?"gone":"unknown"}}};export{f as a,_ as b,$ as c,R as d,U as e,T as f,p as g,y as h};
@@ -1,9 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as Me,h as $e}from"./chunk-AACQE24F.js";import{b as H,c as C,d as K,e as Y}from"./chunk-5TQIKRKP.js";import{b as _,c as B,d as Ae,f as z,g as U}from"./chunk-5GUD3CIH.js";import{c as Ve,d as Be}from"./chunk-WJR2FU7S.js";import{a as A,b as D,d as Pe}from"./chunk-EHN5HTUD.js";import{h as j,k as je,m as Oe,o as Fe}from"./chunk-RGRFL7XG.js";import{d as Te}from"./chunk-VVOKM2VO.js";import{a as N,c as Se,d as Ee,e as Re,f as V}from"./chunk-YFQGOOF7.js";import{z as O}from"./chunk-IICT4VOU.js";import{a as Ne}from"./chunk-CH273NAE.js";import{b as x,c as h}from"./chunk-VZ7KXRXB.js";import{a as De,b as Ce,c as Le}from"./chunk-PUFZTE6L.js";import{a as xe,b as Ie}from"./chunk-RUSRN7YE.js";import{a as ke}from"./chunk-SJZJ7ASF.js";function S(e){if(e===null)return"broken";let t=Math.floor(e/100);return t===1?"passed":t===7?"failed":t===2?"skipped":"broken"}var I={failed:3,broken:2,passed:1,skipped:0};function q(e){let t="skipped";for(let r of e)I[r]>I[t]&&(t=r);return t}import{createHash as ft}from"crypto";import{basename as gt}from"path";function W(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return t.length>0?t:"session"}function G(e){return ft("sha256").update(e).digest("hex").slice(0,8)}function J(e){let t=gt(e).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${W(t)}-${G(e)}`}function X(e,t){return`${W(e)}-${G(t)}`}function Z(e){let t=e?.trim();return t||void 0}function ze(e=process.env){let t=Z(e.TEST_INSTANCE_ID),r=Z(e.JOB_ID),n=Z(e.TASK_ID);return{...t?{testInstanceId:t}:{},...r?{jobId:r}:{},...n?{taskId:n}:{}}}function Q(e,t=process.env){let r=ze(t),n={...r.testInstanceId?{hyper_test_instance_id:r.testInstanceId}:{},...r.jobId?{hyper_job_id:r.jobId}:{},...r.taskId?{hyper_task_id:r.taskId}:{},...e},i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&s.length>0&&(i[o]=s);return i}function _t(e,t){return{pack_test_dir:e,ordinal_offset:t}}import{promises as w}from"fs";import{join as y}from"path";function ee(e){let t={evidence:"0.1",run_id:e.execution_id,status:"running",title:e.title,started:e.started,environment:{producer:{name:"kane-cli",version:e.producerVersion},...e.surfaces?{surfaces:e.surfaces}:{},run_kind:e.run_kind,origin:e.origin,pid:e.pid},...e.credits!==void 0?{metrics:{credits:{value:e.credits,type:"count"}}}:{}};return h(t,{lineWidth:-1})}async function te(e,t,r,n=process.cwd(),i){let o=i??_(e.execution_id,n),s=y(o,"tests",t);return await w.mkdir(y(o,"coverage"),{recursive:!0}),await w.writeFile(y(o,"coverage",".keep"),""),await w.mkdir(s,{recursive:!0}),await w.writeFile(y(o,"run.yaml"),ee(e)),r&&await w.writeFile(y(s,r.path),r.content),o}async function vt(e,t=process.cwd()){let r=_(e.execution_id,t);await w.mkdir(y(r,"coverage"),{recursive:!0}),await w.writeFile(y(r,"coverage",".keep"),"");let n=x(ee(e));return n.environment&&delete n.environment.run_kind,await w.writeFile(y(r,"run.yaml"),h(n,{lineWidth:-1})),r}async function ht(e,t=process.cwd()){return D(_(e,t),new Date().toISOString())}async function re(e,t=process.cwd()){await w.rm(_(e,t),{recursive:!0,force:!0})}import{promises as ne}from"fs";import{join as ie}from"path";function F(e){let t={evidence:"0.1",test:e.testId,status:e.status,...e.durationMs!==void 0?{duration_ms:e.durationMs}:{},...e.attempts&&e.attempts.length?{attempts:e.attempts}:{},...e.flaky!==void 0?{flaky:e.flaky}:{},...e.adaptiveHeal?{adaptive_heal:e.adaptiveHeal}:{},...e.definitionPath?{definition:{path:e.definitionPath}}:{},...e.definitionId?{definition_id:e.definitionId}:{},...e.assuranceId?{assurance_id:e.assuranceId}:{},...Object.keys(e.externalId).length?{external_id:e.externalId}:{},...e.tags&&e.tags.length?{tags:e.tags}:{},...Object.keys(e.environment).length?{environment:e.environment}:{},steps:e.steps};return h(t,{lineWidth:-1})}function oe(e){return h({logs:e},{lineWidth:-1})}async function se(e,t,r){await ne.writeFile(ie(e,"tests",t,"result.yaml"),r)}async function ae(e,t,r){let n=ie(e,"tests",t,"logs");await ne.mkdir(n,{recursive:!0}),await ne.writeFile(ie(n,"meta.yaml"),r)}import{promises as M}from"fs";import{join as Ue}from"path";function He(e){return Ue(e,".internal","meta.json")}async function Ke(e){let t;try{t=await M.readFile(He(e),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(t);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function ce(e,t){let r;try{r=await Ke(e)??{}}catch(s){console.warn(`evidence: meta.json at ${e} unreadable \u2014 skipping execution-pointer append to preserve identity`,s);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(t),r.executions=n,await M.mkdir(Ue(e,".internal"),{recursive:!0});let i=He(e),o=`${i}.tmp-${process.pid}-${Date.now()}`;await M.writeFile(o,JSON.stringify(r,null,2)+`
3
- `),await M.rename(o,i)}async function wt(e){try{let t=await Ke(e);return t&&Array.isArray(t.executions)?t.executions:[]}catch{return[]}}async function yt(e,t,r=process.cwd()){let n=await z(e,r);if(!n){let o=`evidence: no pack found for "${e}"`;return t.json?console.log(JSON.stringify({valid:!1,error:"not_found",target:e})):console.error(o),2}let i=await A(n,t.profile??"L1");return t.json?console.log(JSON.stringify({valid:i.valid,status:i.status,diagnostics:i.diagnostics})):console.log(`evidence: ${i.valid?"valid":"INVALID"} (${t.profile??"L1"}, status ${i.status})`),i.valid?0:1}function ue(e){let t=[];for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)t.push(S(i))}return q(t)}function bt(e){let t=null;for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)i!=null&&(t==null||I[S(i)]>I[S(t)]||I[S(i)]===I[S(t)]&&i>t)&&(t=i)}return t}import{promises as kt}from"fs";import{extname as Ye,basename as xt}from"path";var It={".ndjson":"ndjson",".log":"log",".json":"json",".har":"har"};async function de(e){let t;try{t=await kt.readdir(e)}catch{return[]}return t.filter(r=>r!=="meta.yaml"&&!r.startsWith(".")).sort().map(r=>({name:xt(r,Ye(r)),file:r,format:It[Ye(r)]??"txt"}))}import{mkdirSync as St,appendFileSync as Et}from"fs";import{join as qe}from"path";function le(e,t){return qe(e,"tests",t,"logs")}function pe(e,t,r,n={},i){try{i?.(t,r,r,n)}catch{}if(e)try{St(e,{recursive:!0});let o=JSON.stringify({ts:new Date().toISOString(),level:t,event:r,...n})+`
4
- `;Et(qe(e,"diagnostics.ndjson"),o)}catch{}}import{promises as b}from"fs";import{dirname as Ft,join as E}from"path";import{statSync as Rt}from"fs";import{promises as me}from"fs";import{basename as Pt,join as At}from"path";var Dt=1e6,Ct=2e6;function Lt(){return xe.map(e=>Ie(e))}function We(e=Lt()){return e.map(t=>{let r=0;try{r=Rt(t).size}catch{}return{path:t,offset:r}})}var jt=/\x1b\[[0-9;]*[A-Za-z]/g;async function Ot(e,t,r){let n;try{n=await me.open(e,"r");let i=(await n.stat()).size,o=t<=i?t:0,s=i-o;if(s<=0)return null;let a=s>r?i-r:o,u=Buffer.alloc(Math.min(s,r));return await n.read(u,0,u.length,a),u.toString("utf8")}catch{return null}finally{await n?.close().catch(()=>{})}}async function Ge(e,t){let r=t.caps?.stderr??Dt,n=t.caps?.appium??Ct,i=[];t.runnerStderrPath&&i.push({src:t.runnerStderrPath,from:0,cap:r});for(let o of t.appiumMarks??[])i.push({src:o.path,from:o.offset,cap:n});for(let o of i){let s=await Ot(o.src,o.from,o.cap);if(s===null)continue;let a=s.replace(jt,"");if(a!=="")try{await me.mkdir(e,{recursive:!0}),await me.writeFile(At(e,Pt(o.src)),a)}catch{}}}async function Mt(e){try{let t=E(e,"tests"),r=await b.readdir(t).catch(()=>[]);for(let n of r){let i=E(t,n,"steps"),o=await b.readdir(i).catch(()=>[]);for(let s of o){let a=await b.readFile(E(i,s,"failure.yaml"),"utf8").catch(()=>null);if(a!=null)try{let u=x(a);if(u&&typeof u=="object"&&u.triage)return!0}catch{}}}}catch{}return!1}async function Je(e,t,r,n={}){let i=E(e,"tests",t,"logs");if(r)try{await b.mkdir(i,{recursive:!0}),await b.copyFile(r,E(i,"tui.log"))}catch{}await Ge(i,{runnerStderrPath:r?E(Ft(r),"runner-stderr.log"):void 0,appiumMarks:n.appiumMarks});let o=await de(i);if(!o.length&&n.requireRealLog)throw new Error(`evidence test ${t} has no real log to declare`);o.length&&await ae(e,t,oe(o))}async function fe(e){let t=e.cwd??process.cwd(),r=e.packDir??_(e.executionId,t);if(!e.saved&&!e.packDir)return await re(e.executionId,t),{sealed:!1};await Je(r,e.testId,e.tuiLogPath,{requireRealLog:e.requireRealLog,appiumMarks:e.appiumMarks});let n=E(r,"run.yaml"),i=x(await b.readFile(n,"utf8"));i.environment={...i.environment??{},saved:e.saved,run_kind:e.runKind},await b.writeFile(n,h(i,{lineWidth:-1}));let o=await b.open(n,"r+");try{await o.sync()}finally{await o.close()}let s=await Mt(r);await D(r,new Date().toISOString());let a;try{let c=await A(r,"L1");a=c.valid;let p=(c.diagnostics??[]).filter(l=>String(l?.code??"").includes("failure.status_disagrees"));if(p.length>0)if(e.expectStatusDisagrees||s){let l=e.expectStatusDisagrees?"expected under --bug-detection continue":"self-explained by triaged failure record(s)";console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 ${l}`)}else console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 step verdicts disagree with their failure records`,p);if(!c.valid){console.warn(`evidence: sealed pack ${e.executionId} failed L1 validation`,c.diagnostics);let l=String(c.diagnostics?.[0]?.code??"");pe(le(r,e.testId),"warn","EVIDENCE_INVALID",{execution_id:e.executionId,first_code:l,surface:e.surface??"testmd"},e.log)}}catch(c){console.warn(`evidence: validation error for ${e.executionId}`,c)}let u;if(e.saved&&e.packDir)try{u=await Ae(r,e.executionId,t)}catch(c){console.warn(`evidence: store install failed for ${e.executionId}`,c)}if(e.outputStemDir)try{await ce(e.outputStemDir,{execution_id:e.executionId,run_kind:e.runKind,status:e.verdict,valid:a,at:new Date().toISOString()})}catch(c){console.warn(`evidence: execution-pointer append failed for ${e.executionId} (pack is sealed)`,c)}return{sealed:!0,valid:a,storePath:u}}import{release as Xe}from"os";import{execFileSync as $t}from"child_process";var Ze=!1,$;function Tt(){if(!Ze)if(Ze=!0,process.platform==="darwin")try{$=$t("sw_vers",["-productVersion"],{timeout:2e3}).toString().trim()||void 0}catch{$=Xe()||void 0}else $=Xe()||void 0;return $}function ge(e){let t={os:N(process.platform)},r=Tt();if(r&&(t.os_version=r),e.cdpBrowser){let o=/^([A-Za-z]+)\/(\d+)/.exec(e.cdpBrowser);o&&(t.browser=o[1].replace(/^Headless/,""),t.browser_version=o[2])}e.resolution&&(t.resolution=e.resolution);let n=Ee(t,e.runnerEnvironment);if(!n.native_platform)return n;e.deviceName&&(n.device=e.deviceName),!n.os_version&&e.deviceOsVersion&&(n.os_version=e.deviceOsVersion);let i=De(e.deviceApp);if(i&&(n.app=i),e.deviceModel){let o=Ce(e.deviceModel);o&&(n.device_slug=o)}return e.pixelResolution&&(n.viewport=n.resolution??Nt(e.pixelResolution,n.pixel_ratio)??e.pixelResolution,n.resolution=e.pixelResolution),n}function Nt(e,t){if(!t||!Number.isFinite(t)||t<=0)return;let r=/^(\d+)x(\d+)$/.exec(e);if(r)return`${Math.round(Number(r[1])/t)}x${Math.round(Number(r[2])/t)}`}async function Qe(e){if(e)try{let t=await fetch(`${e}/json/version`,{signal:AbortSignal.timeout(2e3)});if(!t.ok)return;let r=await t.json();return typeof r.Browser=="string"?r.Browser:void 0}catch{return}}function Vt(e){let t;return()=>(t||(t=Qe(e)),t)}import{promises as v,existsSync as k,readFileSync as Ht}from"fs";import{basename as Kt,join as m}from"path";import{readFileSync as Bt}from"fs";import{dirname as zt,resolve as Ut}from"path";function et(e,t){let r=Ut(e),n=Bt(r,"utf8");return j(t?je(n,Oe(zt(r),t)):n)}async function tt(e){for(let t of await v.readdir(e,{withFileTypes:!0})){let r=m(e,t.name);if(t.isDirectory()){await tt(r);continue}try{await v.unlink(r)}catch{await v.truncate(r,0)}}await v.rmdir(e).catch(()=>{})}function Yt(e){let t=e.authorBoundary<0||e.authorBoundary>e.totalSteps?e.totalSteps:e.authorBoundary;return{shrink_count:e.shrinkCount,complete_reauthor:t===0&&e.totalSteps>0,author_boundary:t,total_steps:e.totalSteps,reauthored_steps:e.totalSteps-t,credits_consumed:Math.round(e.creditsConsumed*100)/100}}var L=class e{constructor(t){this.opts=t}executionId;testId;definitionPath=null;definitionContent=null;accumulatedSteps=[];maxOrdinal=0;_attempts=[];_packDirOverride;_attached=!1;appiumMarks=We();get attached(){return this._attached}static async attach(t){let r=Kt(t.packDir).replace(/\.evidence$/,""),n=new e({origin:"testrun",runKind:"author",pid:process.pid,title:t.testId,started:new Date().toISOString(),producerVersion:ke,cwd:t.cwd});n.executionId=r,n.testId=t.testId,n._packDirOverride=t.packDir,n._attached=!0;let i=m(t.packDir,"tests",t.testId);return await v.mkdir(i,{recursive:!0}),t.definition&&(await v.writeFile(m(i,t.definition.path),t.definition.content),n.definitionPath=t.definition.path,n.definitionContent=t.definition.content),n}async start(){if(this._attached)throw new Error("attach-mode session is already started");this.executionId=B(),this.testId=this.opts.testmdRelPath?J(this.opts.testmdRelPath):X(this.opts.objectiveOrName??"session",this.opts.sessionId??this.executionId);let t=this.opts.definition??null;return await te({execution_id:this.executionId,title:this.opts.title,started:this.opts.started,producerVersion:this.opts.producerVersion,surfaces:this.opts.surfaces,run_kind:this.opts.runKind,origin:this.opts.origin,pid:this.opts.pid,...this.opts.credits!==void 0?{credits:this.opts.credits}:{}},this.testId,t,this.opts.cwd,this.opts.packRootDir?this.pack:void 0),t&&(this.definitionPath=t.path,this.definitionContent=t.content),{executionId:this.executionId,testId:this.testId,packTestDir:this.packTestDir}}get pack(){return this._packDirOverride?this._packDirOverride:this.opts.packRootDir?m(this.opts.packRootDir,`${this.executionId}.evidence`):_(this.executionId,this.opts.cwd)}get packTestDir(){return m(this.pack,"tests",this.testId)}async writeDefinition(t,r="test.md"){await v.writeFile(m(this.packTestDir,r),t),this.definitionPath=r,this.definitionContent=t}computeAssuranceId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=m(this.opts.cwd,this.opts.testmdRelPath);if(k(t))return Fe(Ht(t,"utf8"))?.id}}catch{}}computeDefinitionId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=m(this.opts.cwd,this.opts.testmdRelPath),r=m(this.opts.cwd,".context"),n=k(r)?O(r):void 0;if(k(t))return et(t,n)}if(this.definitionContent!=null)return j(this.definitionContent)}catch{}}noteSpawn(t){this.accumulatedSteps.push(...t.steps),this.maxOrdinal=Math.max(this.maxOrdinal,t.maxOrdinal)}nextOrdinalOffset(){return this.maxOrdinal}get steps(){return this.accumulatedSteps}get attempts(){return this._attempts}async archiveAttempt(t,r,n={}){let i=this._attempts.length+1,o=m(this.packTestDir,String(i)),s=n.log,a=(c,d)=>s?.("warn","ARCHIVE_ATTEMPT_FAILED",`Attempt ${i}: ${c} could not be archived into ${i}/; the next attempt will mingle with it`,{attempt:i,dir:c,error:String(d)}),u;try{await v.mkdir(o,{recursive:!0})}catch(c){a(`${i}/`,c)}for(let c of["steps","logs","v16-trajectory"]){let d=m(this.packTestDir,c);if(!k(d))continue;let p=m(o,c);try{await v.rename(d,p);continue}catch(l){s?.("warn","ARCHIVE_ATTEMPT_RENAME_FAILED",`Attempt ${i}: rename of ${c}/ refused; copying it into ${i}/ and emptying the originals in place`,{attempt:i,dir:c,error:String(l),fallback:"copy+truncate"})}try{await v.cp(d,p,{recursive:!0}),await tt(d)}catch(l){a(c,l)}}try{this.definitionPath&&k(m(this.packTestDir,this.definitionPath))&&await v.copyFile(m(this.packTestDir,this.definitionPath),m(o,this.definitionPath));let c=m(o,"steps");if(k(c)){for(let d of await v.readdir(c))if(k(m(c,d,"failure.yaml"))){u=`${i}/steps/${d}/failure.yaml`;break}}}catch(c){a("definition + failure pointer",c)}return this._attempts.push({n:i,status:t,steps:this.accumulatedSteps,...r!==void 0?{failedAt:r}:{},...u?{failure:u}:{}}),this.accumulatedSteps=[],this.maxOrdinal=0,i}async writeResult(t){let r=ue(t.spawns),n=this._attempts.length?[...this._attempts.map(g=>({status:g.status})),{status:r,...t.durationMs!==void 0?{duration_ms:t.durationMs}:{}}]:void 0,i=n?new Set(n.map(g=>g.status)).size>1:void 0,o=this._attempts.length>0,s=t.heal,a=o||s?.forced?{triggered:o,...o?{outcome:r==="passed"?"healed":"exhausted"}:{},...s?Yt(s):{},...o?{attempts:this._attempts.map(g=>({n:g.n,status:g.status,failed_at:g.failedAt??-1,...g.failure?{failure:g.failure}:{}}))}:{}}:void 0,u=this.pack,c=Q(t.externalIdInput),d=V(t.runnerEnv,t.intentEnv),p=this.computeDefinitionId(),l=this.computeAssuranceId();await se(u,this.testId,F({testId:this.testId,status:r,durationMs:t.durationMs,definitionPath:this.definitionPath,definitionId:p,assuranceId:l,externalId:c,environment:d,steps:t.steps,tags:t.tags,attempts:n,flaky:i,adaptiveHeal:a}));for(let g of this._attempts){let R=m(this.packTestDir,String(g.n));k(R)&&await v.writeFile(m(R,"result.yaml"),F({testId:this.testId,status:g.status,definitionPath:this.definitionPath,definitionId:p,assuranceId:l,externalId:c,environment:d,steps:g.steps,tags:t.tags}))}let f=t.externalIdInput;return t.log&&(f.commit_id||f.test_id||f.testcase_id)&&t.log("info","EVIDENCE_EXTERNAL_ID","Evidence external-id mapping",{execution_id:this.executionId,commit_id:f.commit_id??null,test_id:f.test_id??null,testcase_id:f.testcase_id??null,tc_id:c.tc_id??null,project_id:f.project_id??null,session_id:f.session_id??null,session_name:f.session_name??null,hyper_test_instance_id:c.hyper_test_instance_id??null,hyper_job_id:c.hyper_job_id??null,hyper_task_id:c.hyper_task_id??null,dataset_id:c.dataset_id??null,dataset_row_id:c.dataset_row_id??null,dataset_version_id:c.dataset_version_id??null}),r}get id(){return this.executionId}get test(){return this.testId}};async function qt(e,t,r=U){try{let n=await r(e);if(n.aborted.length>0||n.removed.length>0)try{t?.("info","EVIDENCE_RECOVERY","Startup evidence recovery swept incomplete packs",{aborted:n.aborted,removed:n.removed,origin:"startup"})}catch{}return n}catch(n){return console.warn("evidence: startup recovery failed",n),{aborted:[],removed:[]}}}import{promises as sr}from"fs";import{existsSync as _e,mkdirSync as Qt,readdirSync as er,readFileSync as tr,rmSync as rr,statSync as nr,writeFileSync as ir}from"fs";import{join as P}from"path";import{mkdirSync as Wt,renameSync as Gt,rmSync as Jt,writeFileSync as Xt}from"fs";import{join as rt}from"path";var Zt=5e6;function nt(e,t,r){let n=rt(e,"coverage","sources"),i=new Map,o=!1;try{for(let s of r.usecases)for(let a of s.sources){if(i.has(a.id)){a.file=i.get(a.id);continue}if(!a.cid)continue;let u=Te(t,a.cid);if(u===null||u.byteLength>Zt)continue;o||(Wt(n,{recursive:!0}),o=!0);let c=rt(n,a.id),d=`${c}.tmp-${process.pid}`;Xt(d,u),Gt(d,c);let p=`coverage/sources/${a.id}`;i.set(a.id,p),a.file=p}}catch{for(let s of r.usecases)for(let a of s.sources)delete a.file;if(o)try{Jt(n,{recursive:!0,force:!0})}catch{}}}var or={passed:"passed",failed:"failed",broken:"blocked",skipped:"not-run"},it=(e,t)=>{try{if(!_e(t))return{status:"skipped",reason:"no context store at the project root"};let r=P(e,"tests");if(!_e(r))return{status:"skipped",reason:"pack has no tests/"};let n=new Map;for(let a of er(r)){let u=P(r,a,"result.yaml");if(!_e(u)||!nr(P(r,a)).isDirectory())continue;let c=x(tr(u,"utf8"));if(!c?.definition_id&&!c?.assurance_id)continue;let d=Ve(c.steps??[]),p={testShortId:String(c.test??a),execution:or[String(c.status)]??"not-run",...d.length?{acs:d}:{}};c.assurance_id&&n.set(`id:${c.assurance_id}`,p),c.definition_id&&n.set(`def:${c.definition_id}`,p)}let i=$e(O(t),n,{scope:"run"}),o=Me(i);nt(e,t,i);let s=h({...i,rollup:o},{lineWidth:-1});return Qt(P(e,"coverage"),{recursive:!0}),ir(P(e,"coverage","usecases.yaml"),s),{status:"written"}}catch(r){try{rr(P(e,"coverage","sources"),{recursive:!0,force:!0})}catch{}return{status:"skipped",reason:r instanceof Error?r.message:String(r)}}};async function ar(e){try{let t=new L({origin:"inline",runKind:"author",pid:e.pid,title:e.title,started:new Date().toISOString(),producerVersion:e.producerVersion,surfaces:e.surfaces,objectiveOrName:e.objectiveOrName,sessionId:e.sessionId,cwd:e.cwd,packRootDir:e.packRootDir}),r=await t.start();return{session:t,...r,packDir:t.pack,spawns:[],startedAtMs:Date.now(),cwd:e.cwd}}catch(t){return console.warn("evidence: inline pack creation failed",t),null}}function cr(e,t,r){if(!e)return;e.session.noteSpawn(t),t.resolution&&(e.resolution=t.resolution),e.runnerEnvironment=Se(e.runnerEnvironment,t.runnerEnvironment);let n=(r?.per_flow_metadata??[]).map(i=>({resultCode:i?.result_code!=null?Number(i.result_code):null}));e.spawns.push({resultCode:r?.result_code!=null?Number(r.result_code):null,...n.length?{perFlow:n}:{}})}function ur(e){if(e)return{packTestDir:e.packTestDir,ordinalOffset:e.session.nextOrdinalOffset()}}async function dr(e,t){if(!e)return null;if(e.finalized)return e.finalized;let r=(n,i,o)=>t.log?t.log("warn",n,i,o):console.warn(`evidence: ${i}`,o??"");try{if(t.recordedTestPath)try{await e.session.writeDefinition(await sr.readFile(t.recordedTestPath,"utf8"))}catch(s){r("EVIDENCE_DEFINITION_FAILED","could not attach synthesized test.md",{error:String(s)})}let n=t.cdpBrowserCapture?await t.cdpBrowserCapture():void 0,i=await e.session.writeResult({steps:e.session.steps,spawns:e.spawns.length?e.spawns:[{resultCode:null}],externalIdInput:{...t.externalIdInput,execution_id:e.executionId},runnerEnv:ge({cdpBrowser:n,resolution:e.resolution,runnerEnvironment:e.runnerEnvironment,deviceName:t.deviceName,deviceModel:t.deviceModel,deviceApp:t.deviceApp,pixelResolution:await Le(e.packTestDir)}),intentEnv:Re(t.model,e.runnerEnvironment),durationMs:t.durationMs??Date.now()-e.startedAtMs,log:t.log});try{if(t.recordedTestPath){let s=Be({cwd:t.cwd??e.cwd??process.cwd(),members:[{path:t.recordedTestPath,verdict:i,executionId:e.executionId,startedAt:new Date(e.startedAtMs).toISOString(),mode:"inline",local:t.local??!1}]});for(let a of s.warnings)r("EXEC_SYNC",a)}}catch(s){r("EXEC_SYNC","exec-sync failed",{error:String(s)})}try{let s=(t.coverageWriter??it)(e.packDir,Ne(t.cwd??e.cwd??process.cwd()));s.status==="skipped"&&r("EVIDENCE_COVERAGE_SKIPPED",`coverage/usecases.yaml not written: ${s.reason}`)}catch(s){r("EVIDENCE_COVERAGE_SKIPPED","coverage writer threw",{error:String(s)})}let o=await fe({executionId:e.executionId,testId:e.testId,saved:t.saved,runKind:"author",verdict:i,cwd:t.cwd??e.cwd,packDir:e.packDir,tuiLogPath:t.tuiLogPath,log:t.log,surface:"inline",requireRealLog:!!e.runnerEnvironment?.native_platform,appiumMarks:e.session.appiumMarks});return e.finalized=o,t.log?.("info","EVIDENCE_SEALED","Inline pack sealed",{execution_id:e.executionId,verdict:i,valid:o.valid,pack:e.packDir,store_copy:o.storePath??null}),o}catch(n){return r("EVIDENCE_SEAL_FAILED","inline pack finalize failed",{error:String(n)}),null}}import{statSync as lr,openSync as pr,readSync as mr,closeSync as fr}from"fs";import{basename as gr,resolve as _r}from"path";async function vr(e,t,r={}){let n=r.out??(d=>process.stdout.write(d+`
5
- `)),i=d=>(n(`error: ${d}`),2);if(t.env!=="prod"&&t.env!=="stage")return i(`invalid --env: ${String(t.env)}`);if(t.port!==void 0&&(!Number.isInteger(t.port)||t.port<1||t.port>65535))return i("invalid --port: expected an integer 1-65535");let o;try{o=C(t.env,t.viewerUrl),new URL(o)}catch{return i(`invalid --viewer-url: ${t.viewerUrl}`)}if(e.length===0)return i("no pack paths given");let s=new Map;for(let d of e){let p=_r(d),l;try{l=lr(p)}catch{return i(`${d}: not found`)}if(l.isDirectory())return i(`${d}: is a directory \u2014 packs must be sealed .evidence files (run the execution to completion, or seal it, first)`);if(!l.isFile())return i(`${d}: not a regular file`);let f=Buffer.alloc(2),g=pr(p,"r");try{mr(g,f,0,2,0)}finally{fr(g)}if(f.toString("latin1")!=="PK")return i(`${d}: not a sealed evidence pack (zip magic missing)`);let R=gr(p);if(s.has(R))return i(`duplicate pack basename: ${R} (URL names collide \u2014 rename one)`);s.set(R,p)}let a=r.log??((d,p,l)=>process.stderr.write(`warn: ${p} reason=${l.reason} path=${l.path}
6
- `)),u;try{u=await H({packs:s,allowedOrigins:[new URL(o).origin],port:t.port,log:a})}catch(d){return i(`could not bind 127.0.0.1${t.port?`:${t.port}`:""} \u2014 ${d.message}`)}n(`serving ${s.size} pack${s.size===1?"":"s"} on http://127.0.0.1:${u.port}`);for(let d of s.keys()){let p=u.urlFor(d);n(d),n(` pack ${p}`),n(` viewer ${K(p,o)}`)}return n("press Ctrl-C to stop"),await(r.hold??hr)(),await u.close(),0}function hr(){return new Promise(e=>{let t=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of t)process.on("SIGINT",r);e()})})}import{promises as T}from"fs";import{tmpdir as kr}from"os";import{join as at,resolve as he}from"path";var wr=["error","prefer_first","prefer_latest","discard"],yr=["external_id.commit_id","external_id.test_id","external_id.dataset_row_id","environment.os","environment.os_version","environment.browser","environment.browser_version","environment.device","environment.app"];function ot(e){let t=e.replace(/-/g,"_");return wr.includes(t)?t:null}function st(e){let t=e==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...yr],on_same:e??"nest",on_different:e?"error":"split"}};return h({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:t,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function ve(e){try{if(!e.isTTY){e.log(Y(e.packPath));return}let t=C(e.env);await(e.renderPrompt??br)(e.packPath,t)}catch(t){try{e.log(`evidence view failed \u2014 ${t.message}`)}catch{}}}async function br(e,t){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{EvidenceViewOffer:i}=await import("./EvidenceViewOffer-XUP44BGJ.js");await new Promise(o=>{let s=n(r.default.createElement(i,{packPath:e,viewerBase:t,onDone:()=>{s.unmount(),o()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function xr(e,t,r=process.cwd(),n={}){let i=n.out??(l=>process.stdout.write(l+`
7
- `)),o=n.err??(l=>process.stderr.write(l+`
8
- `)),s=l=>(o(`evidence merge: ${l}`),2);if(!t.runId)return s("--run-id is required (merged identity is the caller's fact)");if(t.rules&&t.onCollision)return s("--rules and --on-collision are mutually exclusive");let a;if(t.onCollision!==void 0){let l=ot(t.onCollision);if(!l)return s(`invalid --on-collision: ${t.onCollision} (expected error | prefer-first | prefer-latest | discard)`);a=l}let u=[];for(let l of e){let f=await Ir(l,r);if(!f)return s(`no pack found for "${l}"`);u.push(f)}let c=t.out?he(r,t.out):_(t.runId,r),d=null,p;t.rules?p=he(r,t.rules):(d=await T.mkdtemp(at(kr(),"kane-merge-rules-")),p=at(d,"merge-rules.yaml"),await T.writeFile(p,st(a)));try{let l=await(n.mergeFn??Pe)(u,{runId:t.runId,out:c,rulesPath:p,title:t.title,finalize:t.finalize});return t.json?i(JSON.stringify(l)):Sr(i,l),l.output.finalized&&!t.json&&await(n.offer??ve)({packPath:c,env:t.env,isTTY:n.isTTY??(!!process.stdin.isTTY&&!!process.stderr.isTTY),log:o}),0}catch(l){let f=l instanceof Error?l.message:String(l);return l?.code==="ABORT"?(o(`evidence merge: aborted \u2014 ${f}`),1):s(f)}finally{d&&await T.rm(d,{recursive:!0,force:!0}).catch(()=>{})}}async function Ir(e,t){let r=he(t,e);if(await ct(r))return r;let n=_(e,t);return await ct(n)?n:null}async function ct(e){try{return await T.stat(e),!0}catch{return!1}}function Sr(e,t){let{packs:r,tests:n,output:i}=t;e(`evidence: merged ${n.merged} tests from ${r.eligible.length} packs -> ${i.path} (${i.finalized?"sealed":"live"})`);for(let o of r.skipped)e(` skipped ${o.runId}: ${o.rule} \u2014 ${o.reason}`);for(let o of n.collisions){let s;o.action==="nest"?s=`nested into ${o.folder}, latest ${o.winner}`:o.action==="split"?s=`split into ${o.folder}`:s=`winner ${o.winner}`,e(` collision ${o.test}: ${s} (${o.rule})`)}for(let o of n.discarded)e(` discarded ${o}`)}import{copyFileSync as Er,existsSync as we,mkdirSync as Rr}from"fs";import{join as ut}from"path";function Pr(e,t,r){try{let n=ut(e,"auteur","execution.json");if(we(n))return!0;for(let i of t)if(!(!i||!we(i)))return Rr(ut(e,"auteur"),{recursive:!0}),Er(i,n),!0}catch(n){try{r?.("debug","EVIDENCE_BLOB_COPY_FAILED","auteur execution blob copy failed",{operation:"ensureAuteurExecution",source:t.find(i=>i&&we(i))??null,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{mkdirSync as Ar,writeFileSync as Dr}from"fs";import{join as dt}from"path";function Cr(e,t,r){try{return Ar(dt(e,"auteur"),{recursive:!0}),Dr(dt(e,"auteur","dataset.json"),JSON.stringify(t,null,2)+`
9
- `,"utf8"),!0}catch(n){try{r?.("debug","EVIDENCE_DATASET_WRITE_FAILED","auteur dataset record write failed",{dataset_id:t.dataset_id,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{readFileSync as Lr}from"fs";import{join as jr}from"path";var lt="module_block";var Or=new Set(["generative_block",lt]);function be(e){let t=[],r=!0,n=o=>{if(o===null||typeof o!="object")return;let s=o;if(Array.isArray(s.operations))for(let a of s.operations){let u=a?.operation_id;typeof u=="string"&&u&&t.push(u)}if(Array.isArray(s.children)){Or.has(s.content_type)||(r=!1);for(let a of s.children)n(a)}if(Array.isArray(s.branches)){r=!1;for(let a of s.branches){let u=a?.children;if(Array.isArray(u))for(let c of u)n(c)}}},i=e?.instructions;if(Array.isArray(i))for(let o of i)n(o);return{ids:t,linear:r}}function Fr(e){return be(e).ids}function ye(e,t){let r=new Set(t.map(a=>a.action_id).filter(Boolean)),n=-1;for(let a of r){let u=e.indexOf(a);u>n&&(n=u)}let i=t.reduce((a,u)=>Math.max(a,u.ordinal),0),o=new Set,s=[];for(let a of e.slice(n+1))r.has(a)||o.has(a)||(o.add(a),s.push({id:a,ordinal:++i,status:"skipped",action_id:a}));return s}function pt(e,t){let r=new Set(t),n=e.filter(o=>o.action_id);if(n.some(o=>r.has(o.action_id))||n.length>t.length)return null;let i=0;return e.map(o=>o.action_id?{...o,action_id:t[i++]}:o)}function Mr(e,t){if(e.length>t.length)return!1;for(let r=0;r<e.length;r++)if(t[r]!==e[r].action_id)return!1;return!0}function $r(e,t,r,n=!0){if(t.length===0)return{steps:e,tail:[]};let i=(r&&n?pt(e,t):null)??e,o=i.filter(a=>a.action_id),s=new Set(t);return o.length>0&&o.every(a=>s.has(a.action_id))?{steps:i,tail:ye(t,i)}:o.length>0&&!Mr(o,t)?{steps:i,tail:[],unjoined:!0}:{steps:i,tail:ye(t,i)}}function mt(e){try{let t=Lr(jr(e,"auteur","execution.json"),"utf8");return be(JSON.parse(t))}catch{return{ids:[],linear:!0}}}function Tr(e){return mt(e).ids}export{S as a,q as b,W as c,G as d,J as e,X as f,ze as g,Q as h,_t as i,ee as j,te as k,vt as l,ht as m,re as n,F as o,oe as p,se as q,ae as r,ce as s,wt as t,yt as u,ue as v,bt as w,de as x,le as y,pe as z,Je as A,fe as B,ge as C,Qe as D,Vt as E,L as F,qt as G,it as H,ar as I,cr as J,ur as K,dr as L,vr as M,st as N,ve as O,xr as P,Pr as Q,Cr as R,lt as S,be as T,Fr as U,ye as V,pt as W,$r as X,mt as Y,Tr as Z};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as d}from"./chunk-BL5QHONU.js";var c={darwin:"macOS",linux:"Linux",win32:"Windows"};function l(n){return c[n]??n}function r(n){return typeof n!="string"?void 0:n.trim()||void 0}function u(n){return typeof n=="number"&&Number.isFinite(n)&&n>0?n:void 0}function f(n){if(!n||typeof n!="object")return;let i=n,t=i.device&&typeof i.device=="object"?i.device:void 0,e=t?{...r(t.model)?{model:r(t.model)}:{},...r(t.manufacturer)?{manufacturer:r(t.manufacturer)}:{},...r(t.os_version)?{os_version:r(t.os_version)}:{},...u(t.pixel_ratio)!==void 0?{pixel_ratio:u(t.pixel_ratio)}:{},...r(t.automation)?{automation:r(t.automation)}:{},...r(t.device_instance_id)?{device_instance_id:r(t.device_instance_id)}:{},...d(t.target)?{target:d(t.target)}:{}}:void 0,a=r(i.resolution),o=r(i.native_platform),s=e&&Object.keys(e).length>0;if(!(!a&&!o&&!s))return{...a?{resolution:a}:{},...o?{native_platform:o}:{},...s?{device:e}:{}}}function p(n,i){if(!n)return i;if(!i)return n;let t={...n.device??{},...i.device??{}};return{...n,...i,...Object.keys(t).length?{device:t}:{}}}function m(n){if(n.startsWith("android"))return"Android";if(n.startsWith("ios"))return"iOS"}function _(n,i){let t=f(i);if(!t)return n;let e={...n};if(t.resolution&&(t.native_platform||!e.resolution)&&(e.resolution=t.resolution),!t.native_platform)return e;e.native_platform=t.native_platform,delete e.browser,delete e.browser_version;let a=m(t.native_platform);a&&(e.os=a);let o=t.device;return o?.model&&(e.device=o.model),o?.manufacturer&&(e.manufacturer=o.manufacturer),o?.os_version?e.os_version=o.os_version:delete e.os_version,o?.pixel_ratio!==void 0&&(e.pixel_ratio=o.pixel_ratio),o?.automation&&(e.automation=o.automation),o?.device_instance_id&&(e.device_instance_id=o.device_instance_id),o?.target&&(e.target=o.target),e}function g(n,i,t){let a=!!f(i)?.native_platform;return{model:n,platform:a?"Mobile":"Desktop",platform_type:a?"app":"web",...t?{run_kind:t}:{}}}function w(n,i){let t={},e=(a,o)=>{o!==void 0&&o!==""&&(t[a]=o)};return e("model",i.model),e("os",n.os),e("browser",n.browser),e("browser_version",n.browser_version),e("resolution",n.resolution),e("viewport",n.viewport),e("platform",i.platform),e("platform_type",i.platform_type),e("run_kind",i.run_kind),e("os_version",n.os_version),e("native_platform",n.native_platform),e("manufacturer",n.manufacturer),e("pixel_ratio",n.pixel_ratio),e("automation",n.automation),e("device_instance_id",n.device_instance_id),e("target",n.target),e("app",n.app),n.device!==void 0&&n.device!==""?t.device=n.device:i.platform_type&&i.platform_type!=="web"&&(t.device=null),e("device_slug",n.device_slug),t}export{l as a,f as b,p as c,_ as d,g as e,w as f};
@@ -1,3 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as O}from"./chunk-LDPLJFCV.js";import{P as g,Q as S,S as G}from"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import{e as w,f as $}from"./chunk-5GUD3CIH.js";import{d as x}from"./chunk-WESMQEPO.js";import{e as k}from"./chunk-EHN5HTUD.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import{z as R}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import{b}from"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{basename as h}from"path";import{statSync as A}from"fs";function C(t,e){if(!t)return 1;let o=t.resolve(e);return!o||o.superseded?1:t.getNode(o.tip)?.content.risk==="high"?3:1}function D(t,e){return t.usecases.map(o=>{let s=o.acceptance_criteria??[],a=s.filter(n=>(n.covered_by??[]).length>0),l=s.filter(n=>n.execution==="passed"),i=s.filter(n=>n.execution==="failed"),u=s.filter(n=>n.execution==="blocked"),d=0,m=0;for(let n of s){let f=C(e,n.id);d+=f,n.execution==="passed"&&(m+=f)}let r=d===0?0:Math.round(100*m/d),p=a.length===0?"uncovered":s.length===l.length?"covered":u.length>0&&i.length===0?"blocked":"partial";return{id:o.id,title:o.title,status:p,pct:r,acs:{total:s.length,covered:a.length,passed:l.length,failed:i.length,blocked:u.length},stale:s.filter(n=>n.fresh==="stale").map(n=>n.id)}})}async function P(t){let e=await w(t);return e.length===0?null:e.map(o=>({p:o,m:A(o).mtimeMs})).sort((o,s)=>s.m-o.m)[0].p}var N={covered:"\u2714",partial:"\u25D0",uncovered:"\u2716",blocked:"\u23F8"};function _(t){let e=Math.round(t/10);return"\u2588".repeat(e)+"\u2591".repeat(10-e)}async function I(t,e=G(),o=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return g(e,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:r,agentRefusal:p}=await import("./headless-io-75HUMWZB.js"),n=r("ndjson","cover",{stdout:c=>e.out(c.replace(/\n$/,"")),stderr:c=>(e.err??e.out)(c.replace(/\n$/,""))}),f=[],v=[],j={out:c=>f.push(c),err:c=>v.push(c),confirm:async()=>!1,isTTY:!1};if(await I({...t,json:!0,mode:void 0},j,o)!==0)return p(n,v.join("; ")||"cover refused");let y=JSON.parse(f.join(`
3
- `));return n.event({type:"coverage",...y}),n.done(0,void 0,M(y.completeness??[]))}let s=S(o,e);if(!s)return 2;let a=t.from?await $(t.from,o):await P(o);if(!a)return g(e,t.from?`no evidence pack at '${t.from}'`:"no evidence pack in .testmuai/evidence \u2014 run a test first, or pass --from <pack>"),2;let l=await k(a,"coverage/usecases.yaml");if(l==null)return g(e,`${h(a)} carries no coverage/usecases.yaml \u2014 the pack predates coverage or its project had no .context at seal time`),2;let i=b(l);if(!i||!Array.isArray(i.usecases))return g(e,`${h(a)}: coverage/usecases.yaml is not a usecases document`),2;let u=R(s),d=D(i,u),m=await x(u,"design");if(t.json)return e.out(JSON.stringify({pack:a,depth:d,completeness:m},null,2)),0;e.out(`coverage \u2014 ${h(a)}`),e.out(""),e.out("depth (proven by the pack):");for(let r of d){let p=r.stale.length?` \xB7 ${r.stale.length} stale`:"";e.out(` ${N[r.status]} ${_(r.pct)} ${String(r.pct).padStart(3)}% ${r.id} \u2014 ${r.status} (${r.acs.passed}/${r.acs.total} ACs proven${r.acs.failed?`, ${r.acs.failed} failed`:""}${r.acs.blocked?`, ${r.acs.blocked} blocked`:""})${p}`)}e.out(""),e.out("completeness (live graph):"),m.length===0&&e.out(" no design gaps \u2014 every AC verified, every use-case scenarioed");for(let r of m)e.out(` [${r.risk}] ${r.tag} ${r.ref} \u2014 ${r.why}`),e.out(` \u2192 ${r.ready_command}`);return 0}function M(t){return t.filter(e=>e.ready_command.startsWith("kane-cli ")&&O(e.ready_command)).slice(0,4).map(e=>({cmd:e.ready_command,why:e.why}))}export{I as coverCommand,M as coverNext,D as depthRows};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-PUFZTE6L.js";import"./chunk-JPOFRYTX.js";import"./chunk-TAOHYWEO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{b as deviceSlug,a as evidenceAppName,c as readFirstStepPixelWindow};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{A as K,B as L,C as M,D as N,E as O,F as P,G as Q,I as R,J as S,K as T,L as U,M as _,O as $,P as aa,Q as ba,R as ca,T as da,U as ea,V as fa,W as ga,X as ha,Y as ia,Z as ja,a as c,b as d,c as e,d as f,e as g,f as h,h as i,i as j,j as t,k as u,l as v,m as w,n as x,o as y,p as z,q as A,r as B,s as C,t as D,u as E,v as F,w as G,x as H,y as I,z as J}from"./chunk-WHNF5SWS.js";import"./chunk-AACQE24F.js";import{a as V,b as W,c as X,d as Y,e as Z}from"./chunk-5TQIKRKP.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-5GUD3CIH.js";import"./chunk-WJR2FU7S.js";import"./chunk-WESMQEPO.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import{a,f as b}from"./chunk-YFQGOOF7.js";import"./chunk-BL5QHONU.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-PUFZTE6L.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-RUSRN7YE.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JHYWNWS5.js";import"./chunk-MSGW4JDG.js";import"./chunk-JPOFRYTX.js";import"./chunk-TAOHYWEO.js";import"./chunk-4JOD47QI.js";import"./chunk-MHMEEA4S.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,b as buildEnvironment,j as buildEvidenceRunConfig,i as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,ea as flattenAuteurLeafIds,da as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,a as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ja as readPackLeafIds,ia as readPackLeaves,s as recoverStore,ga as remapReplayActionIds,r as resolvePack,ha as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,f as shortHash,e as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,fa as synthesizeSkippedTail,h as testIdForInline,g as testIdForTestmd,k as validatePack,c as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,d as worstOf,G as worstResultCode,ca as writeAuteurDataset,B as writeLogsMeta,A as writeResult};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-LKPOOZYN.js";import"./chunk-Q6AHSGOE.js";import"./chunk-LDPLJFCV.js";import"./chunk-UJZZDPDY.js";import"./chunk-5ZFOKYFB.js";import"./chunk-BZAGVBCX.js";import"./chunk-FY7TCYPK.js";import"./chunk-LSDWPG6C.js";import"./chunk-KDNNMU7Q.js";import"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{g as EVOLVE_SCOPE_ADVICE,h as composeEvolveStatement,b as designStateOf,k as evolveCommand,c as evolveOneUc,j as forwardChildLine,i as liveRunDesignForUc,f as namedEntityOf,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
@@ -1,9 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-F2OBORCG.js";import{Q as i}from"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import{z as n}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";async function f(s,p){let o=i(process.cwd(),{out:r=>process.stdout.write(r+`
3
- `),err:r=>process.stderr.write(r+`
4
- `),confirm:async()=>!1,isTTY:!!process.stdout.isTTY});if(!o)return 2;let c=n(o),t=a(o,c,s);if(p.json)return process.stdout.write(JSON.stringify(t)+`
5
- `),t.target?0:1;if(!t.target)return process.stdout.write(`error: ${s} names nothing in the graph
6
- `),1;let e=t.target;process.stdout.write(`${e.slug??e.cid} ${e.label} tip ${e.tip}
7
- `);for(let r of t.entries)process.stdout.write(` #${r.seq} ${r.ts} ${r.kind} ${r.detail}${r.rationale?`
8
- why: ${r.rationale}`:""}
9
- `);return 0}export{f as explainCommand};
@@ -1,3 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{P as G,Q as re,S as oe,o as ne,p as se}from"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import{a as H,b as q,c as Q,d as X,e as Z,f as ee,g as te}from"./chunk-AACQE24F.js";import{f as V}from"./chunk-5GUD3CIH.js";import{a as O,b as F,c as C,d as z}from"./chunk-WESMQEPO.js";import"./chunk-EHN5HTUD.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import{z as Y}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import{f as E,g as U}from"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";function me(e,t){return e.length===0?"not_run":Q(e,t).verified?"proven":q(e,t).some(r=>r.verdict==="failed")?"failing":"blocked"}function ie(e,t){let s=null;for(let{cid:g}of e.byLabel(E.TEST))for(let o of e.execHistory(g))(!s||String(o.started_at)>s.started_at)&&(s={execution_id:String(o.execution_id),started_at:String(o.started_at)});if(!s)return null;let r=H[t],a=te(e),l=X(a).aspects[t],x={},u={},m=0,h=0,R=0;for(let g of a.usecases){let o=[];for(let v of g.acceptance_criteria){let f=v.executions??[],p=me(f,r);o.push(p),p==="failing"?m++:p==="blocked"?h++:p==="not_run"&&R++;let y=[],c;if(p==="failing"){let n=null,d=e.resolve(v.id)?.cid;for(let b of v.covered_by){let w=e.execHistory(b).map($=>({verdict:String(ee(e,$.per_ac,d,v.id)??$.verdict),oracle_mode:String($.oracle_mode),ts:String($.started_at),execution_id:String($.execution_id)})).filter($=>r.counted_verdicts.includes($.verdict)&&r.accepted_oracle_modes.includes($.oracle_mode)),S=w[w.length-1];S?.verdict==="failed"&&(y.push(b),(!n||S.ts>n.ts)&&(n={ts:S.ts,execution_id:S.execution_id}))}c=n?.execution_id}else p==="blocked"&&(c=f[f.length-1]?.execution_id);x[v.id]={state:p,viaTests:y,...c?{executionId:c}:{}}}let i=o.some(v=>v!=="not_run"),k=l.usecases[g.id],_=i?k.status==="covered"?"proven":k.status==="partial"?"partial":o.includes("failing")?"failing":o.includes("blocked")?"blocked":"not_run":"not_run";u[g.id]={pct:k.pct,status:_}}return{aspect:t,pct:l.summary.coverage_pct,acs_proven:l.summary.acs_verified,failing:m,blocked:h,not_run:R,latest_run:s,perUc:u,perAc:x,config:{...r,source:"graph_execution_facts",denominator:"current_live_acs"}}}var he=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],ve={failing:"failing",blocked:"blocked","needs-refresh":"needs refresh","needs-tests":"needs tests","needs-scenarios":"needs scenarios","happy-only":"happy path only","possible-duplicate":"possible duplicate","not-yet-run":"not yet run"},M={high:0,med:1,low:2};function D(e,t){let s=/^(.*?)(\d+)$/.exec(e),r=/^(.*?)(\d+)$/.exec(t);return s&&r&&s[1]===r[1]?Number(s[2])-Number(r[2]):e<t?-1:e>t?1:0}function I(e){if(!e||/^sha256:/.test(e))return"(unnamed)";let t=/^(uc|ac|sc|t)-(\d+)$/.exec(e);return t?`${t[1].toUpperCase()}-${t[2]}`:e}function be(e,t=5){let s=e.trim().split(/\s+/);return s.slice(0,t).join(" ")+(s.length>t?"\u2026":"")}function ye(e,t){let s=e.resolve(t),r=s?e.getNode(e.tipOf(s.cid))?.content:null;return String(r?.title??r?.text??"")}function ce(e,t){let s=e.resolve(t);return{id:s?e.displayNameOf(e.tipOf(s.cid))??e.displayNameOf(s.cid):null,title:be(ye(e,t),8)}}function xe(e,t){let s=e.resolve(t);if(!s)return null;let r=e.tipOf(s.cid);if(!O(e,r))return null;let a=e.nodeLabel.get(r);if(a===E.USECASE)return r;if(a===E.AC)return C(e,r);if(a===E.TEST){let l=e.edgesFrom(r).find(u=>u.type===U.VERIFIES&&O(e,u.dst));if(l)return C(e,l.dst);let x=e.edgesFrom(r).find(u=>u.type===U.AUTOMATES&&O(e,u.dst));if(x){let u=e.edgesFrom(x.dst).find(m=>m.type===U.BELONGS_TO&&O(e,m.dst));return u?u.dst:null}}return null}function L(e){if(e.tag==="reuse-candidate"&&e.stage==="design")return"possible-duplicate";switch(e.kind){case"no-verifies":return"needs-tests";case"zero-scenario":return"needs-scenarios";case"happy-only":return"happy-only";case"stale-ac":case"stale-test":return"needs-refresh";case"execution-failed":return"failing";case"execution-blocked":return"blocked";case"covered-not-run":return"not-yet-run";default:return"other"}}function ke(e,t){let s=e.resolve(t),r=s?e.getNode(e.tipOf(s.cid))?.content.risk:null;return r==="high"||r==="med"||r==="low"?r:"med"}function le(e,t,s,r,a){let l=a.servePaths??new Map,x=e.byLabel(E.USECASE).filter(({cid:o})=>O(e,o)),u=new Map(x.map(o=>[o.cid,o])),m=new Map(x.map(({cid:o})=>[o,[]])),h=[];for(let o of t){if(o.stage!=="design")continue;let i={...o,...ce(e,o.ref)},k=xe(e,o.ref),_=k?m.get(k):void 0;_&&L(o)!=="other"?_.push(i):h.push(i)}let R=new Map(x.map(({cid:o})=>[o,{total:0,designed:0}]));for(let{cid:o}of e.byLabel(E.AC)){if(!O(e,o))continue;let i=C(e,o),k=i?R.get(i):void 0;if(!k)continue;k.total++;let _=F(e,o);if(_&&k.designed++,!r)continue;let v=e.nameOf.get(o)??o,f=r.perAc[v];if(!f)continue;let{id:p,title:y}=ce(e,v),c={ref:e.displayNameOf(o)??o,id:p,title:y,risk:ke(e,v),stage:"cover"},n=m.get(i);f.state==="failing"?n.push({...c,kind:"execution-failed",tag:"evolve",why:"covering test failed against this AC",ready_command:f.executionId&&l.has(f.executionId)?`kane-cli evidence serve ${l.get(f.executionId)}`:"kane-cli testrun run",via_tests:f.viaTests,...f.executionId?{execution_id:f.executionId}:{},...f.executionId&&l.has(f.executionId)?{servePath:l.get(f.executionId)}:{},...a.testFiles?{viaFiles:f.viaTests.map(d=>a.testFiles.get(d)??null)}:{}}):f.state==="blocked"?n.push({...c,kind:"execution-blocked",tag:"reuse-candidate",why:"the formula could count no run \u2014 broken/skipped or an unaccepted oracle",ready_command:f.executionId&&l.has(f.executionId)?`kane-cli evidence serve ${l.get(f.executionId)}`:"kane-cli testrun run",...f.executionId?{execution_id:f.executionId}:{},...f.executionId&&l.has(f.executionId)?{servePath:l.get(f.executionId)}:{}}):f.state==="not_run"&&_&&n.push({...c,kind:"covered-not-run",tag:"reuse-candidate",why:"a covering test exists but has not run yet",ready_command:"kane-cli testrun run"})}let g=[];for(let{cid:o,content:i}of x){let k=e.displayNameOf(o)??o,_=e.nameOf.get(o)??o,v=s.perUc[k]??{pct:0,status:"undesigned",staleAcs:0},f=r?r.perUc[_]??{pct:0,status:"not_run"}:null,p=r!==null&&(f===null||f.status==="not_run"),y=R.get(o),c=m.get(o)??[],n=new Set(c.filter(b=>L(b)==="needs-refresh").map(b=>b.ref)),d=[];for(let b of he){let w=c.filter($=>L($)===b);if(b==="needs-tests"&&(w=w.filter($=>!n.has($.ref))),w.length===0)continue;w.sort(($,T)=>(M[$.risk]??3)-(M[T.risk]??3)||D($.ref,T.ref));let S=b==="failing"||b==="blocked"||w.length<=2||new Set(w.map($=>$.ready_command)).size>1;d.push({key:b,label:ve[b],...b==="needs-refresh"?{suffix:"source moved since these were designed"}:{},rows:w,...S?{}:{rosterCommand:w[0].ready_command}})}g.push({slug:k,title:String(i.title??""),risk:String(i.risk??""),des:v,prov:f,provAbsent:p,acTotal:y.total,acDesigned:y.designed,groups:d})}return g.sort((o,i)=>(M[o.risk]??3)-(M[i.risk]??3)||D(o.slug,i.slug)),h.sort((o,i)=>(M[o.risk]??3)-(M[i.risk]??3)||D(o.ref,i.ref)),{stage:a.stage,aspect:a.aspect,top:a.top,dc:s,pa:r,ucs:g,other:h}}function N(e,t){let s=Math.round(e/100*t);return"\u2588".repeat(s)+"\u2591".repeat(t-s)}function W(e,t){return e==="all"||t.stage===e}function B(e,t){return e.length<=t?e:t<=1?e.slice(0,t):e.slice(0,t-1)+"\u2026"}var _e={failing:"failing",blocked:"blocked","needs-refresh":"stale","needs-tests":"needs test","needs-scenarios":"no scenario","happy-only":"happy only","possible-duplicate":"duplicate?","not-yet-run":"to run"},$e=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate"];function ue(e,t){let s=Date.parse(e);if(Number.isNaN(s))return e;let r=Math.max(0,Math.floor((t-s)/1e3));return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function we(e,t){return(t.get("failing")??[]).length?0:(t.get("blocked")??[]).length?1:(t.get("needs-tests")??[]).length||(t.get("needs-scenarios")??[]).length?2:(t.get("needs-refresh")??[]).length?3:(t.get("not-yet-run")??[]).length>0||e.provAbsent?4:5}function de(e,t){let s=new Map;for(let g of t.groups)g.rows.length&&s.set(g.key,g.rows);let r=new Map;for(let g of t.groups){let o=g.rows.filter(i=>W(e.stage,i));o.length&&r.set(g.key,o)}let a=[],l=[],x=[],u=new Set;for(let g of $e){let o=r.get(g);if(o){for(let i of o){let k=g==="failing"&&i.via_tests?.length?` \xB7 via ${i.via_tests.map(_=>I(_)).join(", ")}`:"";a.push({id:i.ref===t.slug?"\u2014":I(i.id??i.ref),cls:_e[g],risk:i.ref===t.slug?"\u2014":i.risk,title:(i.ref===t.slug?i.why:i.title)+k})}if(g==="failing"||g==="blocked")for(let i of o)i.servePath&&u.add(`kane-cli evidence serve ${i.servePath}`);for(let i of o)i.ready_command&&!i.ready_command.startsWith("kane-cli evidence serve")&&i.ready_command!=="kane-cli testrun run"&&u.add(i.ready_command)}}let m=[...u].sort((g,o)=>Number(o.startsWith("kane-cli evidence serve"))-Number(g.startsWith("kane-cli evidence serve")));l.push(...m.map(g=>`\u21B3 ${g}`));let h=s.get("not-yet-run")??[],R=e.pa===null?t.acDesigned:h.length;return e.pa!==null&&R>0&&x.push(`${R} to run`),{uc:t,rows:a,spans:l,tails:x,toRun:R,severity:we(t,s)}}function pe(e,t){let{dc:s,pa:r}=e,a=Math.max(80,Math.min(t.width,100)),l=n=>t.color?`\x1B[2m${n}\x1B[22m`:n,x=t.now??Date.now(),u=[],m=r?.latest_run?`last run ${ue(r.latest_run.started_at,x)}`:"no runs yet";u.push(`coverage \u2014 designed \xD7 proven \xB7 ${e.aspect} \xB7 ${m}`),u.push(""),u.push(P(`designed ${String(s.pct).padStart(3)}% ${N(s.pct,10)} ${s.acs_designed} ACs have a verifying test`,t.color)),r?u.push(P(`proven ${String(r.pct).padStart(3)}% ${N(r.pct,10)} ${r.acs_proven} \xB7 ${r.failing} failing \xB7 ${r.blocked} blocked \xB7 ${r.not_run} not yet run`,t.color)):u.push("proven \u2014 no runs recorded yet \xB7 run tests, then re-run"),u.push("");let h=e.ucs.map(n=>de(e,n));h.sort((n,d)=>n.severity-d.severity||D(n.uc.slug,d.uc.slug));let R=h.some(n=>n.rows.length||n.spans.length||n.tails.length||r!==null&&n.toRun>0),g=n=>{let[d,b]=n.split("/").map(Number);return b>0&&d===b};if(!R&&g(s.acs_designed)&&(r===null||g(r.acs_proven))){let n=e.ucs.length,d=`use-case${n===1?"":"s"}`;return u.push(r?`no gaps \u2014 all ${n} ${d} designed and proven`:`no gaps \u2014 all ${n} ${d} designed \xB7 nothing run yet`),u.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),u}let o=(n,d)=>n.groups.filter(b=>d.includes(b.key)).reduce((b,w)=>b+w.rows.length,0),i=h.map(n=>({band:n,failing:o(n.uc,["failing"]),blocked:o(n.uc,["blocked"]),stale:o(n.uc,["needs-refresh"]),design:o(n.uc,["needs-tests","needs-scenarios"]),run:n.toRun})),k=[];i.some(n=>n.failing)&&k.push({hdr:"FAILING",get:n=>n.failing}),i.some(n=>n.blocked)&&k.push({hdr:"BLOCKED",get:n=>n.blocked}),i.some(n=>n.stale)&&k.push({hdr:"STALE",get:n=>n.stale}),i.some(n=>n.design)&&k.push({hdr:"TO DESIGN",get:n=>n.design}),i.some(n=>n.run)&&k.push({hdr:"TO RUN",get:n=>n.run}),a<100&&(k.length=0);let _=Math.min(16,Math.max(4,...h.map(n=>I(n.uc.slug).length))),v=15,f=k.map(n=>n.hdr.length+2),p=a-_-2-3-v-3-v-f.reduce((n,d)=>n+d,0)-2,y=n=>n.padStart(Math.floor((v+n.length)/2)).padEnd(v),c=`${" ".repeat(_+2)}${"USE CASE".padEnd(p+3)}${y("DESIGNED")} ${y("PROVEN")}`+k.map((n,d)=>n.hdr.padStart(f[d])).join("");u.push(l(c.trimEnd().slice(0,a)));for(let n of i){let d=n.band.uc,b=`${String(d.des.pct).padStart(3)}% ${N(d.des.pct,10)}`,w=r===null||d.provAbsent?Te("no runs",v,t.color):`${String(d.prov?.pct??0).padStart(3)}% ${N(d.prov?.pct??0,10)}`,S=k.map((T,j)=>String(T.get(n)||"\u2014").padStart(f[j])).join(""),$=`${B(I(d.slug),_).padEnd(_)} ${B(d.title,p).padEnd(p)} ${b} ${w}${S}`;u.push(P($,t.color))}return u.push(""),u.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),u}function Te(e,t,s){let r=e.padStart(Math.floor((t+e.length)/2)).padEnd(t);return s?`\x1B[2m${r}\x1B[22m`:r}function P(e,t){return t?e.replace(/(\s*\d+%) (█*)(░*)/g,(s,r,a,l)=>{let x=Number(r.trim().replace("%","")),u=x===100?"\x1B[32m":"\x1B[33m";return`${x===0?"\x1B[31m":u}${r}\x1B[39m ${u}${a}\x1B[39m\x1B[2m${l}\x1B[22m`}):e}function fe(e,t,s,r){let{pa:a}=e,l=Math.max(80,Math.min(r.width,100)),x=p=>r.color?`\x1B[2m${p}\x1B[22m`:p,u=r.now??Date.now(),m=[],h=e.ucs.find(p=>p.slug===t),R=a?.latest_run?`last run ${ue(a.latest_run.started_at,u)}`:"no runs yet";m.push(`${I(t)} \xB7 ${h?.title??""} \u2014 risk ${h?.risk??"\u2014"} \xB7 ${e.aspect} \xB7 ${R}`.slice(0,l)),m.push("");let g=h?de(e,h):null;if(h&&g){m.push(P(`designed ${String(h.des.pct).padStart(3)}% ${N(h.des.pct,10)} ${h.acDesigned}/${h.acTotal} ACs have a verifying test`,r.color));let p=g.tails.length?` \xB7 ${g.tails.join(" \xB7 ")}`:"";a===null||h.provAbsent?m.push(`proven \u2014 no runs yet${p}`):m.push(P(`proven ${String(h.prov?.pct??0).padStart(3)}% ${N(h.prov?.pct??0,10)} ${p.replace(/^ · /,"")}`,r.color)),m.push("")}let o=Math.min(16,Math.max(5,...s.map(p=>I(p.id).length))),i=10,k=5,_=l-o-2-i-2-k-2;m.push(x(`${" ".repeat(o+2)}${"STATE".padEnd(i+2)}${"RISK".padEnd(k+2)}ACCEPTANCE CRITERION`));let v=p=>{if(!r.color)return p;let y=p.trim(),c=y.startsWith("proven")?"\x1B[32m":y==="failing"||y==="needs test"?"\x1B[31m":y==="blocked"||y==="stale"?"\x1B[33m":"\x1B[2m",n=c==="\x1B[2m"?"\x1B[22m":"\x1B[39m";return p.replace(y,`${c}${y}${n}`)};for(let p of s){let c=(p.text+(p.via?` \xB7 via ${p.via}`:"")).split(/\s+/),n=[],d="";for(let b of c)d&&d.length+1+b.length>_?(n.push(d),d=b):d=d?`${d} ${b}`:b;d&&n.push(d),n.forEach((b,w)=>{w===0?m.push(`${B(I(p.id),o).padEnd(o)} ${v(p.state.padEnd(i))} ${p.risk.padEnd(k)} ${b}`):m.push(`${" ".repeat(o+2+i+2+k+2)}${b}`)})}let f=[];if(h&&g){for(let y of g.spans){let c=y.replace(/^↳ /,"");if(c.startsWith("kane-cli evidence serve")){let n=s.filter(d=>d.state==="blocked"||d.state==="failing").map(d=>I(d.id)).join(" \xB7 ");f.push({label:"see why",cmd:c,...n?{note:`(explains ${n})`}:{}})}else f.push({label:"design",cmd:c})}let p=s.filter(y=>y.state==="to run").length;if(p>0){let c=s.some(n=>n.state==="failing")?"(review evidence first \u2014 a re-run may heal over failures)":f.some(n=>n.label==="see why")?`(${p} ACs never executed \u2014 see why first)`:`(${p} ACs never executed)`;f.push({label:"first run",cmd:"kane-cli testrun run",note:c})}}if(f.length){m.push(""),m.push("next");let p=Math.max(...f.map(c=>c.label.length))+2,y=c=>r.color?`\x1B[36m${c}\x1B[39m`:c;for(let c of f){let n=` ${c.label.padEnd(p)}`;if(n.length+c.cmd.length>l){let d=c.cmd.lastIndexOf(" ",l-n.length),b=d>0?c.cmd.slice(0,d):c.cmd.slice(0,l-n.length),w=d>0?c.cmd.slice(d+1):c.cmd.slice(l-n.length);m.push(`${n}${y(b)}`),m.push(`${" ".repeat(n.length)}${y(w)}`),c.note&&m.push(x(`${" ".repeat(n.length)}${c.note}`))}else c.note&&n.length+c.cmd.length+3+c.note.length<=l?m.push(`${n}${y(c.cmd)} ${x(c.note)}`):(m.push(`${n}${y(c.cmd)}`),c.note&&m.push(x(`${" ".repeat(n.length)}${c.note}`)))}}return m.push(""),m.push(x("all use-cases: kane-cli cover gaps")),m}function K(e){let{dc:t,pa:s}=e,r=a=>e.top!==void 0?a.slice(0,e.top):a;return{stage:e.stage,rollup_version:1,design_completeness:{pct:t.pct,acs_designed:t.acs_designed,usecases_complete:t.usecases_complete,ucs_needing_scenarios:t.ucs_needing_scenarios,config:t.config},...s?{proven:{aspect:s.aspect,pct:s.pct,acs_proven:s.acs_proven,failing:s.failing,blocked:s.blocked,not_run:s.not_run,latest_run:s.latest_run,config:s.config}}:{},usecases:e.ucs.map(a=>({id:/^sha256:/.test(a.slug)?null:a.slug,title:a.title,risk:a.risk,design_completeness:{pct:a.des.pct,status:a.des.status},stale_acs:a.des.staleAcs,...s?{proven:a.prov??{pct:0,status:"not_run"}}:{},pending:r(a.groups.flatMap(l=>l.rows).filter(l=>W(e.stage,l))).map(ae)})),other:e.other.filter(a=>W(e.stage,a)).map(ae)}}function ae(e){let{servePath:t,viaFiles:s,meta:r,...a}=e;return{...a}}async function Re(e,t,s=oe(),r=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return G(s,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:_,agentRefusal:v}=await import("./headless-io-75HUMWZB.js"),{parsesAgainstGrammar:f}=await import("./next-KZXH4UA4.js"),p=_("ndjson","gaps",{stdout:T=>s.out(T.replace(/\n$/,"")),stderr:T=>(s.err??s.out)(T.replace(/\n$/,""))}),y=[],c=[],n={out:T=>y.push(T),err:T=>c.push(T),confirm:async()=>!1,isTTY:!1};if(await Re(e,{...t,json:!0,mode:void 0},n,r)!==0)return v(p,c.join("; ")||"cover gaps refused");let b=JSON.parse(y.join(`
3
- `));p.event({type:"gaps",...b});let w=[],S=new Set,$=(T,j)=>{if(Array.isArray(T)){for(let A of T)$(A,j);return}if(T&&typeof T=="object"){let A=T,J=typeof A.why=="string"?A.why:j;typeof A.ready_command=="string"&&A.ready_command.startsWith("kane-cli ")&&f(A.ready_command)&&!S.has(A.ready_command)&&(S.add(A.ready_command),w.push({cmd:A.ready_command,why:J||"close the gap"}));for(let ge of Object.values(A))$(ge,J)}};return $(b,"close the gap"),p.done(0,void 0,w.slice(0,4))}let a=t.stage??"all";if(a!=="design"&&a!=="cover"&&a!=="all")return G(s,`--stage must be design | cover | all, got '${a}'`),2;if(t.top!==void 0&&(!Number.isInteger(t.top)||t.top<1))return G(s,"--top must be a positive integer"),2;let l=t.rollup??"lenient";if(l!=="lenient"&&l!=="strict")return G(s,`--rollup must be lenient | strict, got '${l}'`),2;let x=re(r,s);if(!x)return 2;let u=Y(x),m=Z(u),h=ie(u,l),R=await z(u,"design"),g=new Map;if(h)for(let _ of Object.values(h.perAc)){if(!_.executionId||g.has(_.executionId))continue;let v=await V(_.executionId,r);v&&g.set(_.executionId,Se(v,r))}let o=new Map;for(let[_,v]of se(ne(r)))v.length===1&&o.set(_,v[0].split("/").pop());let i=le(u,R,m,h,{stage:a,top:t.top,aspect:l,servePaths:g,testFiles:o});if(e!==void 0){let _=u.resolve(e),v=_?u.tipOf(_.cid):null;if(!v||u.nodeLabel.get(v)!==E.USECASE||!O(u,v))return G(s,`no use-case '${e}' in the graph`),2;let f=u.displayNameOf(v)??v;if(t.json){let c=K(i);return s.out(JSON.stringify({...c,usecases:c.usecases.filter(n=>n.id===f),other:[]},null,2)),0}let p=Ae(u,v,h,o),y=s.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let c of fe(i,f,p,{width:y,color:s.isTTY}))s.out(c);return 0}if(t.json)return s.out(JSON.stringify(K(i),null,2)),0;if(m.usecases_complete==="0/0")return s.out("nothing to measure yet \u2014 no live use-cases in the graph"),0;let k=s.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let _ of pe(i,{width:k,color:s.isTTY}))s.out(_);return 0}function Se(e,t){let s=t.endsWith("/")?t:t+"/";return e.startsWith(s)?e.slice(s.length):e}function Ae(e,t,s,r){let a=[];for(let{cid:l,content:x}of e.byLabel(E.AC)){if(!O(e,l)||C(e,l)!==t)continue;let u=F(e,l),m=e.nameOf.get(l)??l,h=s?.perAc[m],R=e.stale(l)!=="fresh",g=u?h?.state==="proven"?"proven \u2713":h?.state==="failing"?"failing":h?.state==="blocked"?"blocked":R?"stale":"to run":"needs test",o=h?.state==="failing"&&h.viaTests.length?h.viaTests.map(i=>`${I(i)}${r.get(i)?` ${r.get(i)}`:""}`).join(", "):void 0;a.push({id:e.displayNameOf(l)??l,state:g,risk:String(x.risk??""),text:String(x.text??x.title??""),...o?{via:o}:{}})}return a.sort((l,x)=>D(l.id,x.id)),a}export{Re as gapsCommand};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-4ZBI54KE.js";import"./chunk-T6MGCP57.js";import"./chunk-YKTYVJBN.js";import"./chunk-7N6OCHPC.js";import"./chunk-KDNNMU7Q.js";import"./chunk-Q6F23V7L.js";import"./chunk-SEEEGDVK.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ingestCommand,b as runIngestCommand,a as runIngestWithResults};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{h as a}from"./chunk-R7ZDLGMU.js";import"./chunk-SIXPXYCH.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{a as installPlugin};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{P as v,Q as A,R as S,S as l,W as _,X as P,Y as R}from"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import{d as k,g as f}from"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import{q as I,r as w,x,z as u}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import{a as D}from"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{t as C}from"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{existsSync as L}from"fs";var $={kind:"human",id:process.env.USER??"operator"},N=["interactive","agent","ci","override"],U=/^(UNKNOWN_|BAD_|INVALID_|MALFORMED_|NOT_|SLUG_TAKEN|ALREADY_|SUPERSEDED_)/;function H(n){return n.every(e=>U.test(e.code))?2:1}function g(n,e,r){let c=H(r);if(e){for(let t of r)e.event({type:"error",code:t.code,message:t.detail});return e.done(c)}for(let t of r)v(n,`${t.code}: ${t.detail}`);return c}function h(n,e){return k("ndjson",e,{stdout:r=>n.out(r.replace(/\n$/,"")),stderr:r=>(n.err??n.out)(r.replace(/\n$/,""))})}async function y(n,e,r,c,t){if(e.mode!==void 0&&!N.includes(e.mode))return f(h(r,n),`${n}: --mode must be interactive | agent | ci | override, got '${e.mode}'`,"MODE_USAGE");if(e.mode!=="agent"){let s=A(c,r);return!s||R(s,r)||t&&!await S(r,t,e.yes)?2:{dir:s,hio:null}}let o=h(r,n),i=D(c);if(!L(i))return o.event({type:"error",message:"no context store here",remedy:"run kane-cli context ingest <files> first"}),o.done(2,"refused");let a=_(i);return a?(o.event(P(a)),o.done(2,"refused")):t&&!e.yes?f(o,`refusing to ${t} without --yes`,"USAGE","add --yes"):{dir:i,hio:o}}async function b(n,e){if(!n)return e();try{return await e()}catch(r){if(r instanceof C)throw r;return n.event({type:"error",message:r instanceof Error?r.message:String(r)}),n.done(1,"error")}}function O(n,e,r){return e?e.done(0):(n.out(r),0)}async function q(n,e,r,c=process.cwd()){let t=await y("retire",e,r,c,`retire source ${n} (head \u2192 null + tombstone record)`);if(typeof t=="number")return t;let{dir:o,hio:i}=t;return b(i,async()=>{let a=u(o),s=w({contextDir:o,graph:a,sourceId:n,reason:e.reason,by:$});return s.errors?g(r,i,s.errors):O(r,i,`retired ${n} (record ${s.record.seq}) \u2014 its use-cases stay until no live source evidences them`)})}async function G(n,e,r,c=process.cwd(),t={}){let o="kane-cli context name <ref> <slug> | kane-cli context name --backfill";if(!n||!e)return t.mode==="agent"?f(h(r,"name"),"name needs a ref and a slug","USAGE",o):((r.err??r.out)(`usage: ${o}`),2);let i=await y("name",t,r,c,null);if(typeof i=="number")return i;let{dir:a,hio:s}=i;if(x.test(e)){let d=`"${e}" is in the reserved sequential-id namespace (assigned at mint) \u2014 pick a descriptive name`;return s?f(s,d,"USAGE","pick a descriptive name"):(v(r,d),2)}return b(s,async()=>{let d=u(a),m=I({contextDir:a,graph:d,assignments:[{ref:n,slug:e}],by:$});return m.errors?g(r,s,m.errors):O(r,s,`named ${m.record.names[0].cid} as "${e}" (record ${m.record.seq})`)})}async function M(n,e,r,c=process.cwd()){let t=Number(n),o=await y("revert",e,r,c,`revert record ${t} via a compensation record`);if(typeof o=="number")return o;let{dir:i,hio:a}=o;return b(a,async()=>{let s=u(i),{commitRevert:d}=await import("./revert-NOUECRW4.js"),m=d({contextDir:i,graph:s,seq:t,reason:e.reason,by:$});for(let E of m.warnings)a?a.event({type:"warning",message:E}):r.out(`note: ${E}`);if(m.errors)return g(r,a,m.errors);let p=m.record;return O(r,a,`reverted record ${t} via compensation record ${p.seq}: ${p.supersessions.length} supersession(s), ${p.review.length} trust restoration(s), ${Object.keys(p.source_head_moves).length} head move(s) \u2014 history unchanged, effects inverted`)})}async function z(n,e){return q(n,e,l())}async function J(n,e,r={}){return G(n,e,l(),process.cwd(),r)}async function X(n={},e=process.cwd()){return V(n,l(),e)}async function V(n,e,r=process.cwd()){let c=await y("name",n,e,r,"assign logical ids to every live unnamed node (one commit record)");if(typeof c=="number")return c;let{dir:t,hio:o}=c;return b(o,async()=>{let{backfillLogicalIds:i}=await import("./logical-ids-GLVM2SVR.js"),a=u(t),s=i(t,a);return s.errors?g(e,o,s.errors):O(e,o,s.assigned===0?"backfill: every live node already has a logical id":`backfill: assigned ${s.assigned} logical id(s) (record ${s.record.seq})`)})}async function Z(n,e){return M(n,e,l())}export{X as nameBackfillCommand,J as nameCommand,z as retireCommand,Z as revertCommand,V as runNameBackfillCommand,G as runNameCommand,q as runRetireCommand,M as runRevertCommand};
@@ -1,3 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{Q as m}from"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import{z as g}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import{f as s}from"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";var h=[s.SOURCE,s.USECASE,s.SCENARIO,s.AC,s.TEST,s.GAP];function b(n,e){if(n===s.SOURCE)return String(e.source_id??"");let l=e.question?.header,o=e.title??e.text??l??e.kind??"";return String(o)}function E(n,e){if(n.length<=e)return n;let l=n.slice(0,e-1),o=l.lastIndexOf(" ");return`${(o>e*.6?l.slice(0,o):l).trimEnd()}\u2026`}var p=58;async function O(n,e,l=process.cwd()){let o=m(l,e);if(!o)return 2;let a=g(o),i=[...a.nodeLabel.entries()].filter(([t])=>n.all||!a.superseded.has(t)).map(([t,r])=>{let u=a.getNode(t)?.content??{},f=a.trust.get(t)??(r===s.SOURCE?"-":"derived");return{id:r===s.SOURCE?String(u.source_id??""):a.nameOf.get(t)??t.slice(0,19),cid:t,label:r,title:b(r,u),trust:f,fresh:f==="archived"?"-":a.stale(t)}});if(n.type&&(i=i.filter(t=>t.label===n.type)),n.inferred&&(i=i.filter(t=>t.trust==="derived")),n.stale&&(i=i.filter(t=>t.fresh!=="fresh")),!n.all){let t=new Map;for(let r of i)t.set(`${r.label}:${r.id}`,r);i=[...t.values()]}let c=t=>{let r=h.indexOf(t);return r===-1?h.length:r};if(i.sort((t,r)=>c(t.label)-c(r.label)||t.title.localeCompare(r.title)),n.json){for(let t of i)e.out(JSON.stringify(t));return 0}if(i.length===0)return e.out("(no matching nodes)"),0;e.out("trust \xB7 fresh \xB7 title \xB7 id");let d=null;for(let t of i){if(t.label!==d){d=t.label;let u=i.filter(f=>f.label===t.label).length;e.out(""),e.out(`\u2500\u2500 ${t.label} \xB7 ${u} \u2500\u2500`)}let r=E(t.title||"(untitled)",p);e.out(` ${t.trust.padEnd(8)} ${t.fresh.padEnd(6)} ${r.padEnd(p)} ${t.id}`)}{let{heldArchiveScan:t}=await import("./feeder-66TUPB2R.js"),r=t(o,a).live.size;r>0&&(e.out(""),e.out(`${r} held archive(s) awaiting confirmation \u2014 kane-cli context review walks them (or --allow-archive --because applies headlessly)`))}return 0}async function C(n){return O(n,{out:e=>process.stdout.write(e+`
3
- `),confirm:async()=>!1,isTTY:!!process.stdout.isTTY})}export{E as capWord,C as listCommand,O as runListCommand,b as titleOf};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-P37ALET7.js";import"./chunk-RFHMDQXZ.js";import"./chunk-5FQYB5SM.js";import"./chunk-MHMEEA4S.js";import"./chunk-RZ4F3BHX.js";import"./chunk-OT3VKXJX.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{Q as E,R as N,S as f}from"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import{a as u}from"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{Y as l,Z as p,_}from"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";var a=["CHAIN_ERROR","CARDINALITY_VIOLATION","DOUBLE_SUPERSEDE","SUPERSEDE_CYCLE","EDGE_CYCLE","SUPERSEDE_UNKNOWN_OLD","SUPERSEDE_UNKNOWN_NEW","SUPERSEDE_UNKNOWN_ECID","NAME_UNKNOWN_TARGET","UNKNOWN_LABEL","UNKNOWN_EDGE_TYPE","ILLEGAL_EDGE","MISSING_SALIENT","MISSING_FIELD","UNKNOWN_FIELD","UNKNOWN_EDGE_PROP","BAD_ENUM","BAD_CHECK","DERIVED_MISSING","DERIVED_DRIFT","NODE_FILE_MISSING","NODE_FILE_MISMATCH","NODE_FILE_CORRUPT"];function I(e){let t=r=>{let n=a.indexOf(r);return n===-1?a.length:n},o=e[0]?.code??"fsck_failed";for(let r of e)t(r.code)<t(o)&&(o=r.code);return o}function S(e){let t=new Map;for(let s of e.issues)t.set(s.code,(t.get(s.code)??0)+1);let o=[...t.entries()].sort((s,d)=>d[1]-s[1]).map(([s,d])=>`${s}:${d}`);for(;o.length>1&&o.join("/").length>512;)o.pop();let r=o.join("/"),n=e.issues.map(s=>({code:s.code,detail:s.detail.length>512?s.detail.slice(0,512):s.detail})),i=[...n],c=JSON.stringify(i);for(;i.length>0&&Buffer.byteLength(c,"utf8")>16384;)i.pop(),c=JSON.stringify(i);let m=n.length-i.length;return{issue_count:e.issues.length,records:e.records,...e.pending!==void 0?{pending:e.pending}:{},codes:r,issues:c,...m>0?{issues_truncated:m}:{}}}async function O(e,t=process.cwd(),o,r={}){if(!E(t,e))return r.json&&e.out(JSON.stringify({ok:!1,error:"NO_STORE"})),2;let n=_(u(t));if(n.ok)return r.json?e.out(JSON.stringify(n)):e.out(n.pending?`ok: ${n.records} record(s) verified \u2014 ${n.pending} record(s) pending catch-up (applied automatically on the next command)`:`ok: ${n.records} record(s) verified, derived projection in parity`),0;if(r.json)e.out(JSON.stringify(n));else for(let i of n.issues)e.out(`issue: ${p(i)}`);return o&&(o.event("ASR_FSCK_REPORT",S(n)),o.error(I(n.issues))),1}async function D(e,t,o=process.cwd()){if(!E(o,t)||!await N(t,"wipe .context/derived and rebuild it from the verified commit chain",e.yes))return 2;let r=l(u(o));return t.out(`rebuilt: ${r.applied.seq} record(s) replayed, ${Object.keys(r.nodeLabel).length} node(s) projected`),0}async function A(e,t={}){return O(f(),process.cwd(),e,t)}async function b(e={}){return D(e,f())}export{A as fsckCommand,b as rebuildCommand,O as runFsckCommand,D as runRebuildCommand};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as c,b as m,c as s,d,e as P}from"./chunk-2HFNP2LM.js";import"./chunk-Z2XKFYMH.js";import"./chunk-5Y2G4NC7.js";import{a as f}from"./chunk-3NMXXTHE.js";import"./chunk-ADBOWRMW.js";import"./chunk-RUSRN7YE.js";import"./chunk-YCCUBQY4.js";import"./chunk-4VW3B7SE.js";import"./chunk-SREUA7YQ.js";import"./chunk-5BHB5D2C.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JHYWNWS5.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-JPOFRYTX.js";import"./chunk-TAOHYWEO.js";import"./chunk-2OIIXLXW.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-SJZJ7ASF.js";import{a as p}from"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var g=a(T(),1);import{access as k}from"fs/promises";var l=a(p(),1);async function u(r){let{render:e}=await import("./build-JIKYOZUH.js");return await new Promise(t=>{let{unmount:i,waitUntilExit:n}=e(r(o=>{i(),t(o)}),{stdout:process.stderr,exitOnCtrlC:!0});n().then(()=>t(null)).catch(()=>t(null))})}async function K(){return await u(r=>(0,l.jsx)(f,{mode:"mobile-only",onSelect:e=>{(e==="emulator"||e==="simulator")&&r(e)},onCancel:()=>r(null)}))}async function M(r,e,t){return await u(i=>(0,l.jsx)(c,{targets:r,kind:e,...t?{preselectedTarget:t}:{},onSelect:n=>i(n),onCancel:()=>i(null)}))}function y({kind:r,listApps:e,done:t}){let[i,n]=(0,g.useState)(e?"source":"local");return i==="source"?(0,l.jsx)(d,{kind:r,onSelect:o=>n(o==="local"?"local":"cloud"),onCancel:()=>t(null)}):i==="cloud"&&e?(0,l.jsx)(m,{kind:r,listApps:e,onSelect:o=>t(o.appId),onManualEntry:()=>n("id"),onCancel:()=>n("source")}):i==="id"?(0,l.jsx)(P,{onSubmit:async o=>(t(o),{ok:!0}),onBack:()=>n("cloud")}):(0,l.jsx)(s,{kind:r,onSelect:async o=>{try{await k(o.value)}catch{return{ok:!1,error:`${o.value} is not there.`}}return t(o.value),{ok:!0}},onBack:()=>e?n("source"):t(null),onCancel:()=>t(null)})}async function x(r){return await u(e=>(0,l.jsx)(y,{...r,done:e}))}export{x as promptApp,M as promptDevice,K as promptMobileKind};
@@ -1,3 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{k as T}from"./chunk-BNC4DJCC.js";import{a as _}from"./chunk-WD52ZNQY.js";import{a as h}from"./chunk-W3USRQX6.js";import"./chunk-EHN5HTUD.js";import{a as m}from"./chunk-GYLMH2EX.js";import{a as I,b as S,u as P}from"./chunk-NAWGHDA3.js";import"./chunk-XKYL4K4A.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";async function y(e,o={}){e.flushRecorder();let s=e.recorder?.lastWrittenPath??null;if(!s)return e.log("info","PERSIST_SKIPPED","No recorded path \u2014 recorder.flush no-op",{reason:e.sessionName?"recorder_flush_failed":"no_session_name",session_name:e.sessionName}),null;let p;try{p=P(s)}catch(t){throw e.log("error","PERSIST_RESOLVE_FAILED","resolveTestMd threw",{error:t.message,recorded_path:s}),t}let i=e.getRunsAsStepRecords(),u=e.getFlows(),d=[],c=0;for(let t=0;t<i.length;t++){let r=i[t],l=u.slice(c,c+r.totalRunDirs);c+=r.totalRunDirs;let f=l.find(n=>n.status==="failed"||n.status==="error"),R=f?"failed":l.length===0?"skipped":"passed";d.push({rootStepIndex:t+1,status:R,duration_s:l.reduce((n,w)=>n+(w.duration??0),0),reason:f?.reason})}let D=d.some(t=>t.status==="failed")?"failed":"passed",E=new m().load(),g=h(E.code_export?.language==="javascript"?"javascript":"python",o.mobile),a=S(s);e.log("info","PERSIST_START","Building staging dir",{recorded_path:s,output_dir:a,session_dir:e.sessionDir,step_count:i.length,flow_count:u.length});try{await T({resolvedTest:p,sessionDir:e.sessionDir,stepRunRecords:i,outcomes:d,overallStatus:D,startedISO:e.startedAt,durationS:d.reduce((t,r)=>t+(r.duration_s??0),0),sessionId:e.sessionId,commitId:e.sessionId,tmsIds:{testId:e.testId??void 0,testcaseId:o.testcaseId,projectId:o.projectId,folderId:o.folderId,orgId:o.orgId??e.orgId??void 0,sessionName:e.sessionName??I(s)},codeExportDir:o.codeExportDir,codeExportLanguage:g.language,codeExportFramework:g.framework,packTestDir:o.packTestDir}),e.log("info","PERSIST_STAGING_OK","Staging dir built",{output_dir:a}),_(a),e.log("info","PERSIST_OK","Persist complete",{output_dir:a})}catch(t){let r=t;e.log("error","PERSIST_FAILED","staging build / atomic replace failed",{error:r.message,stack:r.stack,output_dir:a}),process.stderr.write(`[persist] staging build / atomic replace failed: ${r.message}
3
- `)}return{recordedTestPath:s,outputDir:a}}export{y as persistRecordedSession};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-26HZJJN6.js";import"./chunk-W3USRQX6.js";import"./chunk-WHNF5SWS.js";import"./chunk-AACQE24F.js";import"./chunk-5TQIKRKP.js";import"./chunk-5GUD3CIH.js";import"./chunk-WJR2FU7S.js";import"./chunk-WESMQEPO.js";import"./chunk-EHN5HTUD.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import"./chunk-YFQGOOF7.js";import"./chunk-BL5QHONU.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-JQ64X2TO.js";import"./chunk-NBXYL2JT.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-PUFZTE6L.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-RUSRN7YE.js";import"./chunk-2KVECC36.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JHYWNWS5.js";import"./chunk-MSGW4JDG.js";import"./chunk-JPOFRYTX.js";import"./chunk-TAOHYWEO.js";import"./chunk-4JOD47QI.js";import"./chunk-MHMEEA4S.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{c as UploadPipeline,b as packPresignEntry,a as readPackForUpload};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{h as a,i as b,j as c,k as d,l as e,m as f}from"./chunk-ADBOWRMW.js";import"./chunk-RUSRN7YE.js";import"./chunk-SREUA7YQ.js";import"./chunk-5BHB5D2C.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JHYWNWS5.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-JPOFRYTX.js";import"./chunk-TAOHYWEO.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{a as MobileHostUnsupportedError,b as MobilePreflightError,c as PACKAGE_ID_REJECTED,e as isInstallablePath,f as prepareTarget,d as toAppSpec};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f}from"./chunk-WPBETG6U.js";import"./chunk-3H3KTCL7.js";import"./chunk-LKPOOZYN.js";import"./chunk-Q6AHSGOE.js";import"./chunk-LDPLJFCV.js";import"./chunk-KJQNAOOE.js";import"./chunk-6J5T5FEY.js";import"./chunk-UJZZDPDY.js";import"./chunk-RRY5IXOB.js";import"./chunk-5ZFOKYFB.js";import"./chunk-W5TTF7GB.js";import"./chunk-BZAGVBCX.js";import"./chunk-T6MGCP57.js";import"./chunk-YKTYVJBN.js";import"./chunk-FY7TCYPK.js";import"./chunk-LSDWPG6C.js";import"./chunk-7N6OCHPC.js";import"./chunk-KDNNMU7Q.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-WESMQEPO.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as childModeFor,d as emitWalkSignal,f as reconcileCommand,a as resolveReconcileMode,e as runReconcileCommand,b as validateReconcileInputs};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as q}from"./chunk-WPBETG6U.js";import{j as K}from"./chunk-3H3KTCL7.js";import"./chunk-LKPOOZYN.js";import"./chunk-Q6AHSGOE.js";import{a as J}from"./chunk-REPKBN7I.js";import"./chunk-LDPLJFCV.js";import"./chunk-KJQNAOOE.js";import"./chunk-6J5T5FEY.js";import"./chunk-UJZZDPDY.js";import"./chunk-RRY5IXOB.js";import"./chunk-5ZFOKYFB.js";import{a as b,b as Y}from"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import{a as W}from"./chunk-E2KV4BQB.js";import"./chunk-BB2W35TW.js";import"./chunk-BZAGVBCX.js";import"./chunk-T6MGCP57.js";import"./chunk-YKTYVJBN.js";import"./chunk-FY7TCYPK.js";import"./chunk-LSDWPG6C.js";import"./chunk-7N6OCHPC.js";import"./chunk-KDNNMU7Q.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-WESMQEPO.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import{a as V,g as G,n as M,o as H,s as U,t as F,z as D}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import{f as P}from"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{x as E}from"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import{g as A}from"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{existsSync as te,mkdirSync as re,readFileSync as N,readdirSync as ne,renameSync as ie,rmSync as le,writeFileSync as oe}from"fs";import{join as v}from"path";var ae=["title","description","summary","value"];function Q(e,t){let s=[],o=t.updated;if(!o)return s;for(let r of ae){let p=o[r];if(typeof p!="string"||p===e[r])continue;let g=e[r];typeof g=="string"&&g.length>0&&s.push({op:"-",field:r,text:g}),s.push({op:"+",field:r,text:p})}let i=(e.criteria??[]).map(String),u=o.criteria??[];if(u.length>0)if(u.some(r=>"op"in r))for(let r of u)r.op==="set"&&s.push({op:"+",field:"criteria",text:r.text}),r.op==="remove"&&s.push({op:"-",field:"criteria",text:r.text});else{let r=u.map(p=>p.text);for(let p of i)r.includes(p)||s.push({op:"-",field:"criteria",text:p});for(let p of r)i.includes(p)||s.push({op:"+",field:"criteria",text:p})}return s}function $(e){let t=e.filter(r=>r.field==="criteria"),s=t.filter(r=>r.op==="+").length,o=t.filter(r=>r.op==="-").length,i=[...new Set(e.filter(r=>r.field!=="criteria").map(r=>r.field))],u=[];return t.length>0&&u.push(`${t.length} criteria changed \xB7 +${s} \u2212${o}`),i.length>0&&u.push(`${i.join("/")} reworded`),u.join(" \xB7 ")||"no field changes"}var z={high:0,med:1,low:2};function B(e,t){return t?e.nameOf.get(t)??`${t.slice(0,19)}\u2026`:"(new)"}function O(e,t){if(!t)return;let s=e.edgesInto(t).filter(o=>o.type===A.BELONGS_TO||o.type===A.SCOPED_TO);if(s.length!==0)return{stale:s.length,direct:s.slice(0,3).map(o=>B(e,o.src))}}function X(e){return G(e).map(t=>({...t.source_id!==void 0?{source_id:t.source_id}:{},anchor:t.anchor,quote:t.quote??""}))}function S(e,t){let s=Y(e),o=[];for(let i of s.updates){let u=t.resolve(i.matches_existing.cid),r=u?t.tipOf(u.cid):null,p=(r?t.getNode(r)?.content:void 0)??{},g=Q(p,i);o.push({key:b("MODIFY",i.matches_existing.cid),kind:"MODIFY",...r?{ref:r}:{},display:B(t,r),title:typeof p.title=="string"?p.title:i.title,changeLine:i.change_note??$(g),diff:g,diffSummary:g.length>4?$(g):null,...i.risk!==void 0?{risk:i.risk}:{},cites:X(i),...i.matches_existing?.reason!==void 0?{tier:i.matches_existing.reason}:{},...O(t,r)!==void 0?{impact:O(t,r)}:{},payload:i})}for(let i of s.adds)o.push({key:b("ADD",i.temp_ref),kind:"ADD",display:"(new)",title:i.title,changeLine:i.summary??i.title,diff:[],diffSummary:null,...i.risk!==void 0?{risk:i.risk}:{},cites:X(i),payload:i});for(let i of s.archives){let u=t.resolve(i.target),r=u?t.tipOf(u.cid):null,p=(r?t.getNode(r)?.content:void 0)??{};o.push({key:b("ARCHIVE",i.target),kind:"ARCHIVE",...r?{ref:r}:{},display:B(t,r),title:typeof p.title=="string"?p.title:i.target,changeLine:i.reason,diff:[],diffSummary:null,...typeof p.risk=="string"?{risk:p.risk}:{},cites:[],reason:i.reason,basis:i.basis,...O(t,r)!==void 0?{impact:O(t,r)}:{}})}return o.sort((i,u)=>(z[i.risk??"low"]??2)-(z[u.risk??"low"]??2))}function j(e,t){return e.filter(s=>!(s.key in t))}async function Z(e){let{contextDir:t,graph:s,card:o,verdict:i,by:u}=e,r=null;if(o.kind!=="ADD"){let n=o.ref?s.resolve(o.ref):null;if(r=n?s.tipOf(n.cid):null,!r||(s.trust.get(r)??null)==="archived")return{ok:!1,refusal:`its target ${o.display} was retired while the review was open \u2014 nothing landed`}}if(i==="reject")return e.signals?.({ref:o.display,verdict:"reject",...e.note?{reason:e.note}:{}}),{ok:!0,landed:"none",note:"nothing saved \u2014 rejections aren't remembered yet; it may be re-proposed"};if(i==="defer"){let n=de({contextDir:t,card:o,note:e.note,changeBasis:e.changeBasis,tip:r,proposalId:e.proposalId});return n.ok?(e.signals?.({ref:o.display,verdict:"defer",...e.note?{reason:e.note}:{}}),{ok:!0,landed:"none",note:"gap recorded \u2014 visible in cover gaps until a later verdict resolves it"}):{ok:!1,refusal:n.refusal}}if(e.changeBasis?.to_cid){let n=s.resolve(e.changeBasis.source_id);if(!n)return{ok:!1,refusal:`the source ${e.changeBasis.source_id} no longer resolves \u2014 cannot verify this changeset is current; re-run maintain reconcile`};if(n.cid!==e.changeBasis.to_cid)return{ok:!1,refusal:`the source ${e.changeBasis.source_id} moved again while this review was open \u2014 re-run maintain reconcile to refresh the changeset`}}if(o.kind==="ARCHIVE"){let n=(e.proposal.archived??[]).filter(c=>{let y=s.resolve(c.target);return y!=null&&s.tipOf(y.cid)===r}),l=V({...e.proposal,archived:n},s);if(n.length===0||l.errors.length>0)return{ok:!1,refusal:l.errors.length>0?`${l.errors.map(c=>c.detail).join("; ")} \u2014 nothing landed; the card re-presents`:`its archive op no longer resolves to ${o.display} \u2014 re-run maintain reconcile`};let h;try{h=H({contextDir:t,graph:s,verdicts:new Map([[r,{resolution:"rejected",...o.reason??e.note?{reason:o.reason??e.note}:{}}]]),by:u})}catch(c){if(c instanceof E)return{ok:!1,refusal:"concurrent activity kept moving the store \u2014 try the card again"};throw c}return h.errors?{ok:!1,refusal:h.errors.map(c=>c.detail).join("; ")}:(e.signals?.({ref:o.display,verdict:"archive"}),F({contextDir:t,graph:s,targetTip:r,resolvedBy:r,...e.changeBasis?{sourceId:e.changeBasis.source_id}:{},by:u}),{ok:!0,landed:"archived"})}let p=o.payload,g=o.kind==="MODIFY"&&r&&p.matches_existing&&r!==p.matches_existing.cid?{...p,matches_existing:{...p.matches_existing,cid:r}}:p,R={version:1,read_basis:s.latestHash,source:e.proposal.source,...e.proposal.sources?{sources:e.proposal.sources}:{},use_cases:[g]},a=await W(J(t,e.sid??`card-${process.pid}`),{verb:"maintain",ucTargets:r?[{ref:r}]:[],newBuCandidates:o.kind==="ADD"?[{tempRef:g.temp_ref,title:g.title,probeText:`${g.title} ${g.summary??""}`.trim()}]:[],sourcePins:[],readBasis:s.latestHash},n=>{let l=M({contextDir:t,graph:n.graph,proposal:R,proposalId:`${e.proposalId}:${o.key}`,verdicts:new Map([[g.temp_ref,{resolution:"approved"}]]),by:u,autoName:!0,allowStaleBasis:!0,eventIds:n.eventIds("maintain",1),...e.sid?{sid:n.sid}:{},probeHits:n.probeHits});return l.errors!==null?{errors:l.errors}:{result:l,record:l.record}});if(!a.ok||!("result"in a))return{ok:!1,refusal:!a.ok&&a.kind==="validation"?a.errors.map(l=>l.detail).join("; "):"concurrent activity kept moving the store \u2014 try the card again"};e.signals?.({ref:o.display,verdict:"approve"});let d=a.result.record?.nodes.find(n=>n.label==="usecase")?.cid,f=o.kind==="MODIFY"?d??r??void 0:d;return o.kind==="MODIFY"&&r&&F({contextDir:t,graph:s,targetTip:r,resolvedBy:d??r,...e.changeBasis?{sourceId:e.changeBasis.source_id}:{},by:u}),{ok:!0,landed:o.kind==="MODIFY"?"successor":"minted",...f?{offer:{kind:o.kind==="MODIFY"?"evolve":"design",target:f}}:{}}}function de(e){let{card:t,changeBasis:s}=e,o={kind:"reconcile_deferred",derived:!0,text:t.changeLine||t.title,...t.risk?{risk:t.risk}:{},...e.note?{risk_rationale:e.note}:{},...e.tip?{ref:t.display,uc:e.tip}:{},...s?{basis:{source_id:s.source_id,from_cid:s.from_cid??"",to_cid:s.to_cid??""}}:{},...e.proposalId?{proposal_id:e.proposalId}:{},...t.payload?.temp_ref?{temp_ref:t.payload.temp_ref}:{}};return U({contextDir:e.contextDir,content:o,...e.tip?{annotates:e.tip}:{}})}function se(e,t){return v(e,"proposals",t,"verdicts.json")}function C(e,t){try{return JSON.parse(N(se(e,t),"utf8"))}catch{return{verdicts:{}}}}function ee(e,t,s){let o=v(e,"proposals",t);re(o,{recursive:!0});let i=v(o,`.verdicts.${process.pid}.tmp`);oe(i,JSON.stringify(s,null,2)+`
3
- `),ie(i,se(e,t))}function T(e,t){try{return JSON.parse(N(v(e,"proposals",t,"proposal.json"),"utf8"))}catch{return null}}function L(e,t){let s=v(e,"sessions");if(!te(s))return null;for(let o of ne(s)){let i;try{i=P(e,o)}catch{continue}if(!i?.reconcile||new Date(i.expires_at).getTime()<=Date.now()||C(e,i.reconcile.proposal_id).resolved)continue;let r=i.change_basis?.source_id??Object.keys(i.read_basis)[0]??"";if(!(t!==void 0&&r!==t))return{sid:i.sid,proposalId:i.reconcile.proposal_id,source:r,...i.change_basis?{changeBasis:{source_id:i.change_basis.source_id,to_cid:i.change_basis.new_head}}:{}}}return null}var fe=80;function pe(e){return{kind:e.kind,ref:e.display,title:e.kind==="ADD"?e.title:`${e.display} \xB7 ${e.title}`,why:e.changeLine,origin:"content-change",...e.tier!==void 0?{tier:e.tier}:{},...e.diffSummary==null&&e.diff.length>0?{diff:e.diff}:{},...e.diffSummary!=null?{diffSummary:e.diffSummary,viewDiff:!0}:{},...e.cites.length>0?{citeLines:e.cites.map(t=>`cite ${t.source_id??"conversation"} ${t.anchor} \u2014 "${t.quote.slice(0,fe)}"`)}:{},...e.impact?{impact:{stale_refs:Array(e.impact.stale).fill("\xB7"),...e.impact.direct.length>0?{direct_refs:e.impact.direct}:{}}}:{}}}function Be(e){let t=e.contextDir,s=e.changeContext?.source_id,o=new Map;e.changeContext&&o.set(e.changeContext.source_id,e.changeContext.old_head);let i=a=>{let d=o.get(a);if(d)return d;try{let f=K(t,a);return f&&o.set(a,f.old_head),f?.old_head}catch{return}},u=v(t,"proposals",".reconcile-steer-carry.json"),r=()=>{try{return JSON.parse(N(u,"utf8"))}catch{return null}},p=(a,d,f)=>{let n=r();if(!n||n.source!==f)return d;let l=C(t,a),h=!1;for(let c of d)(n.keys.includes(c.key)||c.kind==="ADD"&&n.addTitles.includes(c.title.toLowerCase()))&&!(c.key in l.verdicts)&&(l.verdicts[c.key]={verdict:"steer",at:new Date().toISOString()},h=!0);h&&ee(t,a,l);try{le(u)}catch{}return d},g=(a,d)=>{let f=T(t,a);if(!f)return[];let n=p(a,S(f,D(t)),d),l=C(t,a);return j(n,l.verdicts)},R=()=>{let a=v(t,"sessions");if(!te(a))return null;for(let d of ne(a)){let f;try{f=P(t,d)}catch{continue}if(!f||new Date(f.expires_at).getTime()<=Date.now())continue;let n=(f.ingest_schedule??[]).filter(l=>l.status==="skipped"&&(l.note??"").includes("review"));if(n.length>0)return{source:n[0].source_id,count:n.length}}return null};return{pending(){let a=L(t,s);if(a){let f=g(a.proposalId,a.source).length;return f>0?{source:a.source,count:f,kind:"cards"}:null}let d=R();return d?{source:d.source,count:d.count,kind:"needs-run"}:null},loadCards(){let a=L(t,s);if(!a)return[];let d=g(a.proposalId,a.source),f=d.filter(n=>n.kind==="ADD"||n.ref!=null);for(let n of d.filter(l=>l.kind!=="ADD"&&l.ref==null))e.note?.(`dropped: [${n.kind}] ${n.title} \u2014 its target was retired while the review was open; nothing lands`);return f.map(n=>({key:n.key,card:pe(n),viewLines:n.diff}))},noteSteer(){let a=L(t,s);if(!a)return;let d=T(t,a.proposalId);if(!d)return;let f=C(t,a.proposalId),n=S(d,D(t)).filter(c=>c.key in f.verdicts),l={source:a.source,keys:n.map(c=>c.key),addTitles:n.filter(c=>c.kind==="ADD").map(c=>c.title.toLowerCase())},h=`${u}.${process.pid}.tmp`;re(v(t,"proposals"),{recursive:!0}),oe(h,JSON.stringify(l,null,2)+`
4
- `),ie(h,u)},async applyVerdict(a,d,f){let n=L(t,s);if(!n)return{ok:!1,refusal:"the held changeset is gone \u2014 nothing to verdict"};let l=T(t,n.proposalId);if(!l)return{ok:!1,refusal:`proposal ${n.proposalId} is unreadable \u2014 re-run maintain reconcile`};if(a in C(t,n.proposalId).verdicts)return{ok:!1,refusal:"that change was already verdicted (another surface?) \u2014 refresh the review"};let h=D(t),c=S(l,h).find(x=>x.key===a);if(!c)return{ok:!1,refusal:"that change no longer builds a card \u2014 the set may have moved; re-open the review"};let y=i(n.source),I=n.changeBasis?{source_id:n.changeBasis.source_id,...y?{from_cid:y}:{},...n.changeBasis.to_cid?{to_cid:n.changeBasis.to_cid}:{}}:void 0,m=await Z({contextDir:t,graph:h,proposal:l,proposalId:n.proposalId,card:c,verdict:d,...f?{note:f}:{},by:{kind:"human",id:"owner"},sid:n.sid,...I?{changeBasis:I}:{},signals:x=>q(t,x.ref,x.verdict,x.reason)});if(!m.ok)return{ok:!1,refusal:m.refusal};let k=C(t,n.proposalId);return k.verdicts[a]={verdict:d,...f?{note:f}:{},at:new Date().toISOString()},j(S(l,D(t)),k.verdicts).length===0&&(k.resolved=!0),ee(t,n.proposalId,k),{ok:!0,line:`${d==="approve"?c.kind==="ARCHIVE"?"retired":"approved":d==="reject"?"rejected":"deferred"} change \xB7 [${c.kind}] ${c.display}${c.kind==="ADD"?"":` ${c.title}`} (you)`,...m.note?{note:m.note}:{},...m.offer&&m.offer.target?{offer:{kind:m.offer.kind,key:m.offer.target,title:c.kind==="ADD"?c.title:c.display}}:{}}},async startReview(a){let d=e.runPostureChild??(async(l,h)=>{let[{runExtract:c},{runAgent:y},{resolveAgentAuthEnv:I},{preflightTurn:m}]=await Promise.all([import("./run-76I4OYXD.js"),import("./bridge-NHXCRSIU.js"),import("./spawner-HZXP66DS.js"),import("./turn-preflight-JGYT7LXP.js")]),k=await I();return c({mode:"override",posture:"reconcile",source:l,changeContext:h},{contextDir:t,agent:y,preflightTurn:()=>m(k),ask:async _=>_.map(w=>({id:w.id,selected_index:w.recommended_index,free_text:null})),review:async _=>new Map(_.map(w=>[w.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:_=>e.note?.(_),progress:()=>{},isTTY:!1,auth:k})}),{buildChangeContext:f}=await import("./reconcile-engine-ZWIJFYBP.js"),n=f(t,a);return n?(o.set(a,n.old_head),d(a,n)):(e.note?.(`no change context for ${a} \u2014 nothing to review`),2)}}}export{Be as makeReconcileDeps,C as readVerdictLedger,pe as toWalkCard};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk-3H3KTCL7.js";import"./chunk-LKPOOZYN.js";import"./chunk-Q6AHSGOE.js";import"./chunk-LDPLJFCV.js";import"./chunk-KJQNAOOE.js";import"./chunk-UJZZDPDY.js";import"./chunk-5ZFOKYFB.js";import"./chunk-BZAGVBCX.js";import"./chunk-FY7TCYPK.js";import"./chunk-LSDWPG6C.js";import"./chunk-KDNNMU7Q.js";import"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-WESMQEPO.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{g as EVOLVABLE,d as RECONCILE_NOTE_CHANGED,c as RECONCILE_SKIPPED_ARMS,j as buildChangeContext,l as buildReconcilePlan,i as capDiff,a as commitHeldRows,k as commitOneHeldRow,e as isLive,h as lineDiff,o as liveReextractSeam,m as liveReingestSeam,n as liveRemoteReingestSeam,f as parentUc,b as rowImpactOf};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as a,c as b,d as c,e as d,f as e}from"./chunk-5BHB5D2C.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JHYWNWS5.js";import"./chunk-MSGW4JDG.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{d as discoverAll,a as knownPlatforms,c as providerFor,b as registeredPlatforms,e as resolveTarget};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h,i,j}from"./chunk-DF4EBXGN.js";import"./chunk-ADBOWRMW.js";import"./chunk-RUSRN7YE.js";import"./chunk-SREUA7YQ.js";import"./chunk-5BHB5D2C.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JHYWNWS5.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-JPOFRYTX.js";import"./chunk-TAOHYWEO.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{j as CHOOSE_MOBILE_KIND_MESSAGE,a as appSuitsTarget,b as deviceFromFlags,f as formatRunningOn,g as missingPieceMessage,c as nameNeedsVersionMessage,d as resolveRunIntent,e as resolveTestmdIntent,i as staleAppMessage,h as staleDeviceMessage};