@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,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as It,b as $n,c as Dt,e as rt,f as it,g as Cn,h as Rn,j as Sn,k as Bt,l as In}from"./chunk-WBH5GYFM.js";import{a as le,b as Oe,c as vn}from"./chunk-6J5T5FEY.js";import{b as Rt}from"./chunk-UJZZDPDY.js";import{a as tt}from"./chunk-VIO7CCFW.js";import{a as nt,d as _e,e as Tn,f as St}from"./chunk-RKXHVP2Z.js";import{a as yn}from"./chunk-RRY5IXOB.js";import{a as kn,b as bn,c as wn}from"./chunk-AXTPNZPX.js";import"./chunk-U6OTFMIT.js";import"./chunk-V4B5QA3U.js";import{a as hn,b as pn,c as xn}from"./chunk-RFDL7MHI.js";import{a as gn,b as me}from"./chunk-MXI5P373.js";import{a as dn}from"./chunk-5Y2G4NC7.js";import"./chunk-VVOKM2VO.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import{a as et}from"./chunk-YCCUBQY4.js";import{a as mn}from"./chunk-DZCJE77P.js";import{y as r}from"./chunk-SJZJ7ASF.js";import{b as fn}from"./chunk-DFS4RMVP.js";import{a as Q}from"./chunk-HCBYKLMW.js";import{a as k,b as n,k as Ze}from"./chunk-C44QQJR4.js";import{a as Mr}from"./chunk-6YGTRKDT.js";import{e as V}from"./chunk-UR6MHSHU.js";var m=V(Mr(),1);var a=V(Q(),1),Ar=60,Lr=100;function Et(t,o){let l=t.options.length,u=l,g=t.multi_select?u++:null,x=t.allow_free_text?u++:null,f=o?u++:null;return{optionCount:l,doneIdx:g,freeIdx:x,batchIdx:f,maxSel:u-1}}var Or="\xA0",_r={high:{text:`\u203C${Or}high`,color:r.red},med:{text:"med",color:"yellow"},low:{text:"low",color:r.dim}};function Pr(t){let o=(t.header??t.text.split(/\s+/).slice(0,3).join(" ")).trim();return o.length>16?`${o.slice(0,15)}\u2026`:o}function qr(t,o,l){let u=p=>t[p].length+6,g=u(o),x=o,f=o;for(;;){let p=f+1<t.length?u(f+1):1/0,C=x-1>=0?u(x-1):1/0;if(p===1/0&&C===1/0)break;if(p<=C){if(g+p>l)break;g+=p,f+=1}else{if(g+C>l)break;g+=C,x-=1}}return{lo:x,hi:f}}function Dn({batch:t,qView:o,sel:l=0,focused:u=!1,freeText:g=null,optionText:x=null,attach:f=null,multiSelFor:p,childPrefix:C}){let{stdout:M}=Ze(),v=M?.columns??80,T=v<Ar,W=Math.min(v-1,Lr),$=Math.max(0,Math.min(t.questions.length-1,o??(t.cursor<0?0:t.cursor))),I=t.questions[$],N=t.resolution[$],L=t.resolution.filter(D=>!D).length,B=t.questions.length-L,P=tt(t),O=Et(I,P!==""),H=p?p($):[],K=_r[I.risk],re=D=>u&&l===D?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" ",S=`? ${C??""}the agent needs ${L===1?"one answer":`${L} answers`}`,$e=t.questions.length>1?` \xB7 ${$+1} of ${t.questions.length} \xB7 ${B} answered`:"",z=(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsxs)(n,{bold:!0,children:[I.text,K?(0,a.jsx)(n,{color:K.color,bold:!1,children:` ${K.text}`}):null]})}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:I.rationale})}),(0,a.jsx)(n,{children:" "}),I.options.map((D,w)=>{let X=u&&l===w;return x&&x.optionIndex===w?(0,a.jsx)(k,{flexDirection:"column",children:(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:`${w+1}. ${D.label}`}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:x.value,onChange:x.onChange,onSubmit:x.onSubmit,onCancel:x.onCancel,placeholder:D.detail||"type your answer"})]})},`o-${w}`):(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsxs)(n,{children:[re(w)," ",I.multi_select?(0,a.jsx)(n,{color:H.includes(w)?r.green:r.dim,children:H.includes(w)?"[x] ":"[ ] "}):null,(0,a.jsx)(n,{color:X?r.assuranceAccent:void 0,children:`${w+1}. ${D.label}`}),w===I.recommended_index?(0,a.jsx)(n,{color:r.dim,children:" (recommended)"}):null,N?.selected_index===w?(0,a.jsx)(n,{color:r.dim,children:" (current)"}):null]}),D.detail?(0,a.jsx)(k,{paddingLeft:5,children:(0,a.jsx)(n,{color:r.dim,children:D.detail})}):null]},`o-${w}`)}),I.multi_select&&O.doneIdx!=null?(0,a.jsxs)(n,{children:[re(O.doneIdx)," ",(0,a.jsx)(n,{color:r.green,children:"\u2714"}),(0,a.jsx)(n,{color:u&&l===O.doneIdx?r.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,a.jsx)(n,{children:" "}):null,I.allow_free_text?g?(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.dim,children:"\u270E "})]}),(0,a.jsx)(et,{value:g.value,onChange:g.onChange,onSubmit:g.onSubmit,onCancel:g.onCancel,placeholder:"Tell me what to do"})]}):(0,a.jsxs)(n,{children:[O.freeIdx!=null?re(O.freeIdx):" "," ",(0,a.jsx)(n,{color:u&&O.freeIdx!=null&&l===O.freeIdx?r.assuranceAccent:r.dim,children:"\u270E Tell me what to do"})]}):null,f?(0,a.jsxs)(k,{flexDirection:"column",marginTop:1,children:[(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"@ attach a file or URL"}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:f.value,onChange:f.onChange,onSubmit:f.onSubmit,onCancel:f.onCancel,placeholder:"path or URL"})]}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),j=P!==""?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n,{children:" "}),(0,a.jsxs)(n,{children:[u&&O.batchIdx!=null&&l===O.batchIdx?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" "," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"\xBB"}),(0,a.jsx)(n,{bold:!0,color:u&&O.batchIdx!=null&&l===O.batchIdx?r.assuranceAccent:void 0,children:" Go with recommendations"}),L>=5?(0,a.jsx)(n,{color:r.dim,children:` \u2014 resolves all ${L} open`}):null,(0,a.jsx)(n,{color:r.dim,children:" (tab)"})]})]}):null;if(T)return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsx)(n,{color:r.assuranceAccent,bold:!0,children:S}),t.questions.length>1?(0,a.jsx)(n,{color:r.dim,children:$e.replace(/^ · /,"")}):null,(0,a.jsx)(n,{children:" "}),z,j]});let h=t.questions.map(D=>Pr(D)),ce=t.questions.length>1?qr(h,$,W-8):null;return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsxs)(n,{color:r.assuranceAccent,children:[(0,a.jsx)(n,{bold:!0,children:S}),$e?(0,a.jsx)(n,{color:r.dim,children:$e}):null]}),ce?(0,a.jsx)(k,{marginTop:1,children:(0,a.jsxs)(n,{children:[ce.lo>0?(0,a.jsx)(n,{color:r.dim,children:"\u25C0 "}):" ",t.questions.slice(ce.lo,ce.hi+1).map((D,w)=>{let X=ce.lo+w,Pe=w>0?" ":"";return X===$?(0,a.jsxs)(n,{children:[Pe,(0,a.jsx)(n,{backgroundColor:r.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[X]} `})]},D.id):(0,a.jsxs)(n,{children:[Pe,t.resolution[X]?(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.green,children:"\u2713 "}),(0,a.jsx)(n,{color:r.dim,children:h[X]})]}):(0,a.jsx)(n,{color:r.dim,children:`\u25CB ${h[X]}`})]},D.id)}),ce.hi<t.questions.length-1?(0,a.jsx)(n,{color:r.dim,children:" \u25B6"}):null]})}):null,(0,a.jsx)(n,{children:" "}),z,j]})}var A=V(Q(),1),Bn={high:0,med:1,low:2},jr={high:r.red,med:"yellow",low:r.dim};function Fr(t){return t.map((o,l)=>({r:o,i:l})).sort((o,l)=>(Bn[o.r.risk??"zz"]??3)-(Bn[l.r.risk??"zz"]??3)||o.i-l.i).map(({r:o})=>o)}function En({rows:t,width:o=120,badgeHeader:l="risk"}){if(t.length===0)return null;let u=Fr(t),g=B=>B.staged||!B.id?"(staged)":yn(B.id),x=Math.max(2,...u.map(B=>g(B).length)),f=Math.max(l.length,...u.map(B=>(B.badge??"").length)),p=o>=84&&u.some(B=>B.summary),M=o-(p?13:10)-x-f,v=Math.max(...u.map(B=>Math.max(B.title.length,(B.marker??"").length)),5),T=Math.max(5,p?Math.min(v,Math.max(16,Math.floor(M*.5))):Math.min(v,M)),W=p?Math.max(7,M-T):0,$=(B,P,O,H)=>vn(B,P,O,H.map(K=>K.length)),I=(B,P,O,H)=>[Oe(le(B,x),x),Oe(le(P,T),T),Oe(le(O,f),f),...p?[Oe(le(H,W),W)]:[]],N=I("id","title",l,"summary"),L=[];L.push((0,A.jsx)(n,{color:r.dim,children:$("\u250C","\u252C","\u2510",N)},"t")),L.push((0,A.jsxs)(n,{children:[N.map((B,P)=>(0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:P===0?"\u2502 ":" \u2502 "}),(0,A.jsx)(n,{bold:!0,children:B})]},P)),(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},"h")),L.push((0,A.jsx)(n,{color:r.dim,children:$("\u251C","\u253C","\u2524",N)},"m"));for(let[B,P]of u.entries()){let O=I(g(P),le(P.title,T),le(P.badge??"",f),le(P.summary??"",W)),H=P.badgeColor??jr[P.badge??""]??r.dim;if(L.push((0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:"\u2502 "}),(0,A.jsx)(n,{color:r.assuranceAccent,children:O[0]}),(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[1],(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),(0,A.jsx)(n,{color:H,children:O[2]}),p?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[3]]}):null,(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},`r-${B}`)),P.marker){let K=I("",le(P.marker,T),"","");L.push((0,A.jsx)(n,{color:r.dim,children:`\u2502 ${K.join(" \u2502 ")} \u2502`},`mk-${B}`))}}return L.push((0,A.jsx)(n,{color:r.dim,children:$("\u2514","\u2534","\u2518",N)},"b")),(0,A.jsx)(A.Fragment,{children:L})}var y=V(Q(),1);function Wr(t){let o=t.form==="assumed"?" (assumed)":t.form==="deferred"?"":" (you)",l=t.note?` \u2014 ${t.note}`:"";return t.form==="deferred"?`\u21B3 deferred q${t.qNum} ${t.stub}${l}`:t.form==="changed"?`\u21B3 changed q${t.qNum} ${t.stub}: ${t.prev??"?"} \u2192 ${t.choice??"?"}${o}${l}`:`\u21B3 ${t.form} q${t.qNum} ${t.stub}: ${t.choice??"?"}${o}${l}`}var Vr=()=>(process.stdout?.columns??100)-12;function Mn({block:t,annotations:o}){let l=t.era??0,u=Nr(t,o??null);return l>0?(0,y.jsx)(k,{marginLeft:l*2,children:u}):u}function Nr(t,o){switch(t.kind){case"banner":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{bold:!0,color:r.assuranceAccent,children:` ${t.text}`})});case"user":return(0,y.jsxs)(k,{marginTop:1,children:[(0,y.jsx)(n,{color:r.orange,children:"\u276F "}),(0,y.jsx)(n,{children:t.text})]});case"note":return(0,y.jsx)(n,{color:r.dim,children:` ${t.text}`});case"agent":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(pn,{text:t.text,accent:r.assuranceAccent})});case"worked":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{color:r.dim,children:` \u2699 ${wn(t.durS,t.toolCalls,t.tools)}`})});case"usage":return(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.credits.toFixed(1)} credits \u2014 total ${t.total.toFixed(1)}`});case"turn":{let l=o,u=l?l.fresh:t.items.map((v,T)=>({item:v,num:T+1,updated:!1})),g={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"severity",stylenote:"kind"},x=v=>v.kind??"use-case",f=new Map;for(let v of u){let T=v.item,W=x(v.item),$=T.risk==="high"||T.risk==="med"||T.risk==="low"?T.risk:void 0,I={id:T.logical_id??"",staged:!T.logical_id,title:T.title,badge:T.badge??T.risk??"",summary:T.why??T.summary??T.description??"",...$?{risk:$}:{},...v.updated?{marker:"\u21B3 changed"}:{}},N=f.get(W)??[];N.push(I),f.set(W,N)}let p=u.some(v=>!!v.item.kind),C=(l?.unchanged??[]).reduce((v,T)=>v+T.count,0),M=l?.headerStats?` \u2014 ${l.headerStats}${C>0?` (${C} unchanged)`:""}`:"";return(0,y.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(0,y.jsxs)(n,{bold:!0,children:[p?"design":t.heading,M?(0,y.jsx)(n,{bold:!1,color:r.dim,children:M}):null]}),[...f.entries()].map(([v,T])=>(0,y.jsxs)(k,{flexDirection:"column",children:[f.size>1?(0,y.jsx)(n,{color:r.dim,children:`${nt(v)} \xB7 ${T.length}`}):null,(0,y.jsx)(En,{rows:T,width:Vr(),badgeHeader:g[v]??"info"})]},v)),l&&l.unchanged.length>0&&(0,y.jsx)(n,{color:r.dim,children:` \u22EE unchanged: ${l.unchanged.map(v=>`${v.count} ${v.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,y.jsx)(n,{color:r.dim,children:Wr(t.receipt)});case"continued":return(0,y.jsx)(n,{color:r.dim,children:"\u21B3 continued"});case"childOpen":{let{ing:l}=Rt(t.verb);return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsxs)(n,{color:r.assuranceAccent,children:[`\u25CF ${l} ${t.subject}`,t.sid?(0,y.jsx)(n,{color:r.dim,children:` \u2014 ${t.sid}`}):null,t.note?(0,y.jsx)(n,{color:r.dim,children:` ${t.note}`}):null]})})}case"childClose":{let{ed:l}=Rt(t.verb);if(!t.ok)return(0,y.jsxs)(n,{color:r.red,children:[`\u25CF ${t.verb} failed \u2014 ${t.exitCode!=null?`exited ${t.exitCode}`:"error"}`,t.fixCmd?(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.fixCmd}`}):null]});let u=[bn(t.durS),...t.results?[t.results]:[],...t.credits!==void 0?[`${t.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,y.jsx)(n,{color:r.green,children:`\u25CF ${l} ${t.subject} \u2014 ${u}`})}case"childBack":return(0,y.jsx)(n,{color:r.dim,children:`back with ${t.parentVerb} \u2014 ${t.context}`});case"commit":return(0,y.jsxs)(k,{flexDirection:"column",children:[(0,y.jsx)(n,{color:t.ok?r.green:r.red,children:` ${t.ok?"\u2714":"\u2717"} ${t.line}`}),(t.warnings??[]).map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:` \u26A0 ${l}`},`w-${u}`))]});case"error":return(0,y.jsxs)(mn,{variant:"error",paddingX:1,children:[(0,y.jsx)(n,{color:r.red,children:t.title}),t.detail.map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:l},`d-${u}`))]})}}var Te=V(Q(),1);function An({item:t}){return(0,Te.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(t.cite??[]).map((o,l)=>(0,Te.jsx)(n,{dimColor:!0,children:`cite ${o.anchor??"conv"} \u2014 "${o.quote??""}"`},`cite-${l}`)),(t.depends_on_hint??[]).length>0&&(0,Te.jsx)(n,{dimColor:!0,children:`depends on: ${(t.depends_on_hint??[]).join(", ")}`}),Object.entries(t.extra??{}).map(([o,l])=>(0,Te.jsx)(n,{dimColor:!0,children:`${o}: ${l}`},`extra-${o}`))]})}var R=V(Q(),1),Mt=(t,o)=>Math.max(0,Math.min(o,t));function ot(t,o,l){switch(o.type){case"move":return t.level==="detail"?{...t,scroll:Math.max(0,(t.scroll??0)+o.delta)}:{...t,cursor:Mt(t.cursor+o.delta,Math.max(0,l-1))};case"enter":return t.level==="list"?{...t,level:"detail",scroll:0}:t;case"back":return t.level==="detail"?{...t,level:"list",scroll:0}:null}}var On={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function _n(t,o){if(t.level==="detail")return{level:"detail",cursor:Mt(t.num-1,Math.max(0,o.entries.length-1))};if(t.section){let l=o.entries.findIndex(u=>On[u.kind]===t.section);if(l>=0)return{level:"list",cursor:l}}return{level:"list",cursor:0}}function Kr(t){let o=[];for(let l of t.entries){let u=o.find(g=>g.kind===l.kind);u?u.entries.push(l):o.push({kind:l.kind,entries:[l]})}return o}var Ln=3;function Ur({items:t,cursor:o,verb:l,more:u}){let g=`view \xB7 ${l} so far \xB7 ${t.counts.map(f=>`${f.count} ${f.count===1?f.label.replace(/s$/,""):f.label}`).join(" \xB7 ")}`,x=t.entries[o];return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,color:r.assuranceAccent,children:g}),Kr(t).map(({kind:f,entries:p})=>{let C=x?.kind===f,M=C?p.findIndex($=>$.ref===x.ref):-1,v=C?Mt(M-1,Math.max(0,p.length-Ln)):0,T=p.slice(v,v+(C?Ln:1)),W=p.length-T.length;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{color:r.dim,children:`${On[f]??nt(f)} \xB7 ${p.length}`}),T.map($=>{let I=C&&$.ref===x.ref,N=$.item.badge;return(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:I?"\u203A ":" "}),(0,R.jsx)(n,{children:`${$.num} \xB7 ${$.item.title}`}),N?(0,R.jsx)(n,{color:r.dim,children:` \xB7 ${N}`}):null]},`${$.kind}:${$.ref}`)}),W>0&&(0,R.jsx)(n,{color:r.dim,children:` \u22EE ${W} more`})]},f)}),u?(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:o===t.entries.length?"\u203A ":" "}),(0,R.jsx)(n,{color:r.dim,children:`\u22EF show all \u2014 ${u.hidden} more from earlier turns`})]}):null]})}var st=14;function Qr({items:t,cursor:o,explain:l,grandTotal:u,dossier:g,scroll:x=0}){let f=t.entries[o];if(!f)return(0,R.jsx)(n,{color:r.dim,children:"nothing to show"});if(g){let C=Math.max(0,Math.min(x,Math.max(0,g.lines.length-st))),M=g.lines.slice(C,C+st);return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsxs)(n,{bold:!0,children:[`view \xB7 ${g.id}`,g.id.toLowerCase()!==g.rawId?(0,R.jsx)(n,{bold:!1,color:r.dim,children:` \xB7 ${g.rawId}`}):null]}),(0,R.jsx)(n,{bold:!0,children:g.title}),C>0?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${C} above`}):null,M.map((v,T)=>(0,R.jsx)(n,{color:v.dim?r.dim:void 0,children:v.text},`dl-${T}`)),g.lines.length>C+st?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${g.lines.length-C-st} more`}):null]})}let p=f.item;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,children:`view \xB7 ${f.kind} ${f.num} of ${u??t.entries.length}`}),(0,R.jsx)(n,{children:f.item.title}),p.badge?(0,R.jsx)(n,{color:r.dim,children:`kind: ${p.badge}`}):null,p.why?(0,R.jsx)(n,{color:r.dim,children:p.why}):null,(0,R.jsx)(An,{item:f.item}),l?.map((C,M)=>(0,R.jsx)(n,{color:r.dim,children:C},`ex-${M}`)),(0,R.jsx)(n,{color:r.dim,children:"view-only \u2014 approvals happen in chat"})]})}function Pn({items:t,state:o,verb:l,more:u,explain:g,grandTotal:x,dossier:f=null}){return o.level==="list"?(0,R.jsx)(Ur,{items:t,cursor:o.cursor,verb:l,more:u}):(0,R.jsx)(Qr,{items:t,cursor:o.cursor,explain:g,grandTotal:x,dossier:f,scroll:o.scroll??0})}var J=V(Q(),1),At=14;function Hr(t){let o=[],l=null;for(let u of t)u.field!==l&&(l=u.field,o.push({kind:"field",field:l})),o.push({kind:"line",field:l,line:u});return o}function qn({title:t,lines:o,offset:l=0}){let u=Hr(o),g=Math.max(0,Math.min(l,Math.max(0,u.length-At))),x=u.slice(g,g+At),f=g,p=Math.max(0,u.length-g-At),C=`view \xB7 diff \xB7 ${t} \xB7 current \u2192 proposed`;return(0,J.jsxs)(k,{flexDirection:"column",children:[(0,J.jsx)(n,{bold:!0,color:r.assuranceAccent,children:C}),f>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${f} above`})}):null,x.map((M,v)=>M.kind==="field"?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:M.field==="criteria"?"criteria":M.field})},`r-${g+v}`):(0,J.jsx)(k,{paddingLeft:4,children:(0,J.jsx)(n,{color:M.line.op==="-"?"red":"green",children:`${M.line.op==="-"?"\u2212":"+"} ${M.line.text}`})},`r-${g+v}`)),p>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${p} more`})}):null]})}var zr={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function jn(t){let o=(t??"").trim().toLowerCase();if(!o)return{level:"list"};if(/^\d+$/.test(o)){let u=parseInt(o,10);return u>=1?{level:"detail",num:u}:{error:"items are numbered from 1 \u2014 /view 1"}}let l=zr[o];return l?{level:"list",section:l}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var E=V(Q(),1),Xr=6,Fn=12;function Gr(t,o,l){let u=Math.max(20,o),g=[];for(let f of t.split(`
2
+ import{a as It,b as $n,c as Dt,e as rt,f as it,g as Cn,h as Rn,j as Sn,k as Bt,l as In}from"./chunk-OOCCUUR2.js";import{a as le,b as Oe,c as vn}from"./chunk-6J5T5FEY.js";import{b as Rt}from"./chunk-UJZZDPDY.js";import{a as yn}from"./chunk-RRY5IXOB.js";import{a as tt}from"./chunk-VIO7CCFW.js";import{a as nt,d as _e,e as Tn,f as St}from"./chunk-RKXHVP2Z.js";import{a as kn,b as bn,c as wn}from"./chunk-AXTPNZPX.js";import"./chunk-U6OTFMIT.js";import"./chunk-V4B5QA3U.js";import{a as hn,b as pn,c as xn}from"./chunk-EOA6YPES.js";import{a as gn,b as me}from"./chunk-4Y2WH77W.js";import{a as dn}from"./chunk-5Y2G4NC7.js";import"./chunk-VVOKM2VO.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import{a as et}from"./chunk-YCCUBQY4.js";import{a as mn}from"./chunk-Z7IGTVJW.js";import{y as r}from"./chunk-5TQFOPJV.js";import{b as fn}from"./chunk-DFS4RMVP.js";import{a as Q}from"./chunk-HCBYKLMW.js";import{a as k,b as n,k as Ze}from"./chunk-C44QQJR4.js";import{a as Mr}from"./chunk-6YGTRKDT.js";import{e as V}from"./chunk-UR6MHSHU.js";var m=V(Mr(),1);var a=V(Q(),1),Ar=60,Lr=100;function Et(t,o){let l=t.options.length,u=l,g=t.multi_select?u++:null,x=t.allow_free_text?u++:null,f=o?u++:null;return{optionCount:l,doneIdx:g,freeIdx:x,batchIdx:f,maxSel:u-1}}var Or="\xA0",_r={high:{text:`\u203C${Or}high`,color:r.red},med:{text:"med",color:"yellow"},low:{text:"low",color:r.dim}};function Pr(t){let o=(t.header??t.text.split(/\s+/).slice(0,3).join(" ")).trim();return o.length>16?`${o.slice(0,15)}\u2026`:o}function qr(t,o,l){let u=p=>t[p].length+6,g=u(o),x=o,f=o;for(;;){let p=f+1<t.length?u(f+1):1/0,C=x-1>=0?u(x-1):1/0;if(p===1/0&&C===1/0)break;if(p<=C){if(g+p>l)break;g+=p,f+=1}else{if(g+C>l)break;g+=C,x-=1}}return{lo:x,hi:f}}function Dn({batch:t,qView:o,sel:l=0,focused:u=!1,freeText:g=null,optionText:x=null,attach:f=null,multiSelFor:p,childPrefix:C}){let{stdout:M}=Ze(),v=M?.columns??80,T=v<Ar,W=Math.min(v-1,Lr),$=Math.max(0,Math.min(t.questions.length-1,o??(t.cursor<0?0:t.cursor))),I=t.questions[$],N=t.resolution[$],L=t.resolution.filter(D=>!D).length,B=t.questions.length-L,P=tt(t),O=Et(I,P!==""),H=p?p($):[],K=_r[I.risk],re=D=>u&&l===D?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" ",S=`? ${C??""}the agent needs ${L===1?"one answer":`${L} answers`}`,$e=t.questions.length>1?` \xB7 ${$+1} of ${t.questions.length} \xB7 ${B} answered`:"",z=(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsxs)(n,{bold:!0,children:[I.text,K?(0,a.jsx)(n,{color:K.color,bold:!1,children:` ${K.text}`}):null]})}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:I.rationale})}),(0,a.jsx)(n,{children:" "}),I.options.map((D,w)=>{let X=u&&l===w;return x&&x.optionIndex===w?(0,a.jsx)(k,{flexDirection:"column",children:(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:`${w+1}. ${D.label}`}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:x.value,onChange:x.onChange,onSubmit:x.onSubmit,onCancel:x.onCancel,placeholder:D.detail||"type your answer"})]})},`o-${w}`):(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsxs)(n,{children:[re(w)," ",I.multi_select?(0,a.jsx)(n,{color:H.includes(w)?r.green:r.dim,children:H.includes(w)?"[x] ":"[ ] "}):null,(0,a.jsx)(n,{color:X?r.assuranceAccent:void 0,children:`${w+1}. ${D.label}`}),w===I.recommended_index?(0,a.jsx)(n,{color:r.dim,children:" (recommended)"}):null,N?.selected_index===w?(0,a.jsx)(n,{color:r.dim,children:" (current)"}):null]}),D.detail?(0,a.jsx)(k,{paddingLeft:5,children:(0,a.jsx)(n,{color:r.dim,children:D.detail})}):null]},`o-${w}`)}),I.multi_select&&O.doneIdx!=null?(0,a.jsxs)(n,{children:[re(O.doneIdx)," ",(0,a.jsx)(n,{color:r.green,children:"\u2714"}),(0,a.jsx)(n,{color:u&&l===O.doneIdx?r.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,a.jsx)(n,{children:" "}):null,I.allow_free_text?g?(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.dim,children:"\u270E "})]}),(0,a.jsx)(et,{value:g.value,onChange:g.onChange,onSubmit:g.onSubmit,onCancel:g.onCancel,placeholder:"Tell me what to do"})]}):(0,a.jsxs)(n,{children:[O.freeIdx!=null?re(O.freeIdx):" "," ",(0,a.jsx)(n,{color:u&&O.freeIdx!=null&&l===O.freeIdx?r.assuranceAccent:r.dim,children:"\u270E Tell me what to do"})]}):null,f?(0,a.jsxs)(k,{flexDirection:"column",marginTop:1,children:[(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"@ attach a file or URL"}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:f.value,onChange:f.onChange,onSubmit:f.onSubmit,onCancel:f.onCancel,placeholder:"path or URL"})]}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),j=P!==""?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n,{children:" "}),(0,a.jsxs)(n,{children:[u&&O.batchIdx!=null&&l===O.batchIdx?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" "," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"\xBB"}),(0,a.jsx)(n,{bold:!0,color:u&&O.batchIdx!=null&&l===O.batchIdx?r.assuranceAccent:void 0,children:" Go with recommendations"}),L>=5?(0,a.jsx)(n,{color:r.dim,children:` \u2014 resolves all ${L} open`}):null,(0,a.jsx)(n,{color:r.dim,children:" (tab)"})]})]}):null;if(T)return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsx)(n,{color:r.assuranceAccent,bold:!0,children:S}),t.questions.length>1?(0,a.jsx)(n,{color:r.dim,children:$e.replace(/^ · /,"")}):null,(0,a.jsx)(n,{children:" "}),z,j]});let h=t.questions.map(D=>Pr(D)),ce=t.questions.length>1?qr(h,$,W-8):null;return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsxs)(n,{color:r.assuranceAccent,children:[(0,a.jsx)(n,{bold:!0,children:S}),$e?(0,a.jsx)(n,{color:r.dim,children:$e}):null]}),ce?(0,a.jsx)(k,{marginTop:1,children:(0,a.jsxs)(n,{children:[ce.lo>0?(0,a.jsx)(n,{color:r.dim,children:"\u25C0 "}):" ",t.questions.slice(ce.lo,ce.hi+1).map((D,w)=>{let X=ce.lo+w,Pe=w>0?" ":"";return X===$?(0,a.jsxs)(n,{children:[Pe,(0,a.jsx)(n,{backgroundColor:r.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[X]} `})]},D.id):(0,a.jsxs)(n,{children:[Pe,t.resolution[X]?(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.green,children:"\u2713 "}),(0,a.jsx)(n,{color:r.dim,children:h[X]})]}):(0,a.jsx)(n,{color:r.dim,children:`\u25CB ${h[X]}`})]},D.id)}),ce.hi<t.questions.length-1?(0,a.jsx)(n,{color:r.dim,children:" \u25B6"}):null]})}):null,(0,a.jsx)(n,{children:" "}),z,j]})}var A=V(Q(),1),Bn={high:0,med:1,low:2},jr={high:r.red,med:"yellow",low:r.dim};function Fr(t){return t.map((o,l)=>({r:o,i:l})).sort((o,l)=>(Bn[o.r.risk??"zz"]??3)-(Bn[l.r.risk??"zz"]??3)||o.i-l.i).map(({r:o})=>o)}function En({rows:t,width:o=120,badgeHeader:l="risk"}){if(t.length===0)return null;let u=Fr(t),g=B=>B.staged||!B.id?"(staged)":yn(B.id),x=Math.max(2,...u.map(B=>g(B).length)),f=Math.max(l.length,...u.map(B=>(B.badge??"").length)),p=o>=84&&u.some(B=>B.summary),M=o-(p?13:10)-x-f,v=Math.max(...u.map(B=>Math.max(B.title.length,(B.marker??"").length)),5),T=Math.max(5,p?Math.min(v,Math.max(16,Math.floor(M*.5))):Math.min(v,M)),W=p?Math.max(7,M-T):0,$=(B,P,O,H)=>vn(B,P,O,H.map(K=>K.length)),I=(B,P,O,H)=>[Oe(le(B,x),x),Oe(le(P,T),T),Oe(le(O,f),f),...p?[Oe(le(H,W),W)]:[]],N=I("id","title",l,"summary"),L=[];L.push((0,A.jsx)(n,{color:r.dim,children:$("\u250C","\u252C","\u2510",N)},"t")),L.push((0,A.jsxs)(n,{children:[N.map((B,P)=>(0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:P===0?"\u2502 ":" \u2502 "}),(0,A.jsx)(n,{bold:!0,children:B})]},P)),(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},"h")),L.push((0,A.jsx)(n,{color:r.dim,children:$("\u251C","\u253C","\u2524",N)},"m"));for(let[B,P]of u.entries()){let O=I(g(P),le(P.title,T),le(P.badge??"",f),le(P.summary??"",W)),H=P.badgeColor??jr[P.badge??""]??r.dim;if(L.push((0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:"\u2502 "}),(0,A.jsx)(n,{color:r.assuranceAccent,children:O[0]}),(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[1],(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),(0,A.jsx)(n,{color:H,children:O[2]}),p?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[3]]}):null,(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},`r-${B}`)),P.marker){let K=I("",le(P.marker,T),"","");L.push((0,A.jsx)(n,{color:r.dim,children:`\u2502 ${K.join(" \u2502 ")} \u2502`},`mk-${B}`))}}return L.push((0,A.jsx)(n,{color:r.dim,children:$("\u2514","\u2534","\u2518",N)},"b")),(0,A.jsx)(A.Fragment,{children:L})}var y=V(Q(),1);function Wr(t){let o=t.form==="assumed"?" (assumed)":t.form==="deferred"?"":" (you)",l=t.note?` \u2014 ${t.note}`:"";return t.form==="deferred"?`\u21B3 deferred q${t.qNum} ${t.stub}${l}`:t.form==="changed"?`\u21B3 changed q${t.qNum} ${t.stub}: ${t.prev??"?"} \u2192 ${t.choice??"?"}${o}${l}`:`\u21B3 ${t.form} q${t.qNum} ${t.stub}: ${t.choice??"?"}${o}${l}`}var Vr=()=>(process.stdout?.columns??100)-12;function Mn({block:t,annotations:o}){let l=t.era??0,u=Nr(t,o??null);return l>0?(0,y.jsx)(k,{marginLeft:l*2,children:u}):u}function Nr(t,o){switch(t.kind){case"banner":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{bold:!0,color:r.assuranceAccent,children:` ${t.text}`})});case"user":return(0,y.jsxs)(k,{marginTop:1,children:[(0,y.jsx)(n,{color:r.orange,children:"\u276F "}),(0,y.jsx)(n,{children:t.text})]});case"note":return(0,y.jsx)(n,{color:r.dim,children:` ${t.text}`});case"agent":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(pn,{text:t.text,accent:r.assuranceAccent})});case"worked":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{color:r.dim,children:` \u2699 ${wn(t.durS,t.toolCalls,t.tools)}`})});case"usage":return(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.credits.toFixed(1)} credits \u2014 total ${t.total.toFixed(1)}`});case"turn":{let l=o,u=l?l.fresh:t.items.map((v,T)=>({item:v,num:T+1,updated:!1})),g={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"severity",stylenote:"kind"},x=v=>v.kind??"use-case",f=new Map;for(let v of u){let T=v.item,W=x(v.item),$=T.risk==="high"||T.risk==="med"||T.risk==="low"?T.risk:void 0,I={id:T.logical_id??"",staged:!T.logical_id,title:T.title,badge:T.badge??T.risk??"",summary:T.why??T.summary??T.description??"",...$?{risk:$}:{},...v.updated?{marker:"\u21B3 changed"}:{}},N=f.get(W)??[];N.push(I),f.set(W,N)}let p=u.some(v=>!!v.item.kind),C=(l?.unchanged??[]).reduce((v,T)=>v+T.count,0),M=l?.headerStats?` \u2014 ${l.headerStats}${C>0?` (${C} unchanged)`:""}`:"";return(0,y.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(0,y.jsxs)(n,{bold:!0,children:[p?"design":t.heading,M?(0,y.jsx)(n,{bold:!1,color:r.dim,children:M}):null]}),[...f.entries()].map(([v,T])=>(0,y.jsxs)(k,{flexDirection:"column",children:[f.size>1?(0,y.jsx)(n,{color:r.dim,children:`${nt(v)} \xB7 ${T.length}`}):null,(0,y.jsx)(En,{rows:T,width:Vr(),badgeHeader:g[v]??"info"})]},v)),l&&l.unchanged.length>0&&(0,y.jsx)(n,{color:r.dim,children:` \u22EE unchanged: ${l.unchanged.map(v=>`${v.count} ${v.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,y.jsx)(n,{color:r.dim,children:Wr(t.receipt)});case"continued":return(0,y.jsx)(n,{color:r.dim,children:"\u21B3 continued"});case"childOpen":{let{ing:l}=Rt(t.verb);return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsxs)(n,{color:r.assuranceAccent,children:[`\u25CF ${l} ${t.subject}`,t.sid?(0,y.jsx)(n,{color:r.dim,children:` \u2014 ${t.sid}`}):null,t.note?(0,y.jsx)(n,{color:r.dim,children:` ${t.note}`}):null]})})}case"childClose":{let{ed:l}=Rt(t.verb);if(!t.ok)return(0,y.jsxs)(n,{color:r.red,children:[`\u25CF ${t.verb} failed \u2014 ${t.exitCode!=null?`exited ${t.exitCode}`:"error"}`,t.fixCmd?(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.fixCmd}`}):null]});let u=[bn(t.durS),...t.results?[t.results]:[],...t.credits!==void 0?[`${t.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,y.jsx)(n,{color:r.green,children:`\u25CF ${l} ${t.subject} \u2014 ${u}`})}case"childBack":return(0,y.jsx)(n,{color:r.dim,children:`back with ${t.parentVerb} \u2014 ${t.context}`});case"commit":return(0,y.jsxs)(k,{flexDirection:"column",children:[(0,y.jsx)(n,{color:t.ok?r.green:r.red,children:` ${t.ok?"\u2714":"\u2717"} ${t.line}`}),(t.warnings??[]).map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:` \u26A0 ${l}`},`w-${u}`))]});case"error":return(0,y.jsxs)(mn,{variant:"error",paddingX:1,children:[(0,y.jsx)(n,{color:r.red,children:t.title}),t.detail.map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:l},`d-${u}`))]})}}var Te=V(Q(),1);function An({item:t}){return(0,Te.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(t.cite??[]).map((o,l)=>(0,Te.jsx)(n,{dimColor:!0,children:`cite ${o.anchor??"conv"} \u2014 "${o.quote??""}"`},`cite-${l}`)),(t.depends_on_hint??[]).length>0&&(0,Te.jsx)(n,{dimColor:!0,children:`depends on: ${(t.depends_on_hint??[]).join(", ")}`}),Object.entries(t.extra??{}).map(([o,l])=>(0,Te.jsx)(n,{dimColor:!0,children:`${o}: ${l}`},`extra-${o}`))]})}var R=V(Q(),1),Mt=(t,o)=>Math.max(0,Math.min(o,t));function ot(t,o,l){switch(o.type){case"move":return t.level==="detail"?{...t,scroll:Math.max(0,(t.scroll??0)+o.delta)}:{...t,cursor:Mt(t.cursor+o.delta,Math.max(0,l-1))};case"enter":return t.level==="list"?{...t,level:"detail",scroll:0}:t;case"back":return t.level==="detail"?{...t,level:"list",scroll:0}:null}}var On={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function _n(t,o){if(t.level==="detail")return{level:"detail",cursor:Mt(t.num-1,Math.max(0,o.entries.length-1))};if(t.section){let l=o.entries.findIndex(u=>On[u.kind]===t.section);if(l>=0)return{level:"list",cursor:l}}return{level:"list",cursor:0}}function Kr(t){let o=[];for(let l of t.entries){let u=o.find(g=>g.kind===l.kind);u?u.entries.push(l):o.push({kind:l.kind,entries:[l]})}return o}var Ln=3;function Ur({items:t,cursor:o,verb:l,more:u}){let g=`view \xB7 ${l} so far \xB7 ${t.counts.map(f=>`${f.count} ${f.count===1?f.label.replace(/s$/,""):f.label}`).join(" \xB7 ")}`,x=t.entries[o];return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,color:r.assuranceAccent,children:g}),Kr(t).map(({kind:f,entries:p})=>{let C=x?.kind===f,M=C?p.findIndex($=>$.ref===x.ref):-1,v=C?Mt(M-1,Math.max(0,p.length-Ln)):0,T=p.slice(v,v+(C?Ln:1)),W=p.length-T.length;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{color:r.dim,children:`${On[f]??nt(f)} \xB7 ${p.length}`}),T.map($=>{let I=C&&$.ref===x.ref,N=$.item.badge;return(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:I?"\u203A ":" "}),(0,R.jsx)(n,{children:`${$.num} \xB7 ${$.item.title}`}),N?(0,R.jsx)(n,{color:r.dim,children:` \xB7 ${N}`}):null]},`${$.kind}:${$.ref}`)}),W>0&&(0,R.jsx)(n,{color:r.dim,children:` \u22EE ${W} more`})]},f)}),u?(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:o===t.entries.length?"\u203A ":" "}),(0,R.jsx)(n,{color:r.dim,children:`\u22EF show all \u2014 ${u.hidden} more from earlier turns`})]}):null]})}var st=14;function Qr({items:t,cursor:o,explain:l,grandTotal:u,dossier:g,scroll:x=0}){let f=t.entries[o];if(!f)return(0,R.jsx)(n,{color:r.dim,children:"nothing to show"});if(g){let C=Math.max(0,Math.min(x,Math.max(0,g.lines.length-st))),M=g.lines.slice(C,C+st);return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsxs)(n,{bold:!0,children:[`view \xB7 ${g.id}`,g.id.toLowerCase()!==g.rawId?(0,R.jsx)(n,{bold:!1,color:r.dim,children:` \xB7 ${g.rawId}`}):null]}),(0,R.jsx)(n,{bold:!0,children:g.title}),C>0?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${C} above`}):null,M.map((v,T)=>(0,R.jsx)(n,{color:v.dim?r.dim:void 0,children:v.text},`dl-${T}`)),g.lines.length>C+st?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${g.lines.length-C-st} more`}):null]})}let p=f.item;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,children:`view \xB7 ${f.kind} ${f.num} of ${u??t.entries.length}`}),(0,R.jsx)(n,{children:f.item.title}),p.badge?(0,R.jsx)(n,{color:r.dim,children:`kind: ${p.badge}`}):null,p.why?(0,R.jsx)(n,{color:r.dim,children:p.why}):null,(0,R.jsx)(An,{item:f.item}),l?.map((C,M)=>(0,R.jsx)(n,{color:r.dim,children:C},`ex-${M}`)),(0,R.jsx)(n,{color:r.dim,children:"view-only \u2014 approvals happen in chat"})]})}function Pn({items:t,state:o,verb:l,more:u,explain:g,grandTotal:x,dossier:f=null}){return o.level==="list"?(0,R.jsx)(Ur,{items:t,cursor:o.cursor,verb:l,more:u}):(0,R.jsx)(Qr,{items:t,cursor:o.cursor,explain:g,grandTotal:x,dossier:f,scroll:o.scroll??0})}var J=V(Q(),1),At=14;function Hr(t){let o=[],l=null;for(let u of t)u.field!==l&&(l=u.field,o.push({kind:"field",field:l})),o.push({kind:"line",field:l,line:u});return o}function qn({title:t,lines:o,offset:l=0}){let u=Hr(o),g=Math.max(0,Math.min(l,Math.max(0,u.length-At))),x=u.slice(g,g+At),f=g,p=Math.max(0,u.length-g-At),C=`view \xB7 diff \xB7 ${t} \xB7 current \u2192 proposed`;return(0,J.jsxs)(k,{flexDirection:"column",children:[(0,J.jsx)(n,{bold:!0,color:r.assuranceAccent,children:C}),f>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${f} above`})}):null,x.map((M,v)=>M.kind==="field"?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:M.field==="criteria"?"criteria":M.field})},`r-${g+v}`):(0,J.jsx)(k,{paddingLeft:4,children:(0,J.jsx)(n,{color:M.line.op==="-"?"red":"green",children:`${M.line.op==="-"?"\u2212":"+"} ${M.line.text}`})},`r-${g+v}`)),p>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${p} more`})}):null]})}var zr={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function jn(t){let o=(t??"").trim().toLowerCase();if(!o)return{level:"list"};if(/^\d+$/.test(o)){let u=parseInt(o,10);return u>=1?{level:"detail",num:u}:{error:"items are numbered from 1 \u2014 /view 1"}}let l=zr[o];return l?{level:"list",section:l}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var E=V(Q(),1),Xr=6,Fn=12;function Gr(t,o,l){let u=Math.max(20,o),g=[];for(let f of t.split(`
3
3
  `)){if(f.length<=u){g.push(f);continue}let p="";for(let C of f.split(" "))p&&p.length+1+C.length>u?(g.push(p),p=C):p=p?`${p} ${C}`:C;g.push(p)}let x=Math.max(0,g.length-l);return{body:g.slice(-l).join(`
4
4
  `),hidden:x}}function Wn(t){let o={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},l={key:"keep",label:"keep the existing design",detail:"back to the list"};return t.designed==="stale"?[{...o,detail:"the use-case changed since it was designed"},l]:[l,o]}function Xi({controller:t,verb:o="extract",onCtrlC:l,chain:u=null,inspect:g=null,reconcile:x=null,autoReview:f=!1,onReviewExit:p,meta:C=null}){let[,M]=(0,m.useState)(0),[v,T]=(0,m.useState)(!1),[W,$]=(0,m.useState)(null),[I,N]=(0,m.useState)(null),L=(0,m.useRef)(null),[B,P]=(0,m.useState)(null),O=(0,m.useRef)(null),H=e=>{O.current=e,P(e)},K=e=>{L.current=e,N(e),e===null&&H(null)},re=(0,m.useRef)([]),[S,$e]=(0,m.useState)(null),z=(0,m.useRef)(null),j=e=>{z.current=e,$e(e)},[h,ce]=(0,m.useState)(null),D=(0,m.useRef)(null),w=e=>{D.current=e,ce(e)},[X,Pe]=(0,m.useState)(null),Lt=(0,m.useRef)(null),he=e=>{Lt.current=e,Pe(e)},lt=(0,m.useRef)({approved:0,rejected:0,deferred:0}),Ce=(0,m.useRef)(!1),ae=(0,m.useRef)(null),Ot=fn(),{stdout:Vn}=Ze(),Nn=Vn?.columns??80,_t=(0,m.useRef)(0),ct=(0,m.useRef)(0);(0,m.useEffect)(()=>{let e=()=>{let i=t.state.ledger;for(let c=_t.current;c<i.length;c++){let d=i[c],b=d.kind==="turn"?Tn(t.state.turns,d.turnIndex):void 0;Ot.append((0,E.jsx)(Mn,{block:d,annotations:b},`lg-${c}`))}_t.current=i.length};e();let s=t.subscribe(()=>{e();let i=t.state;L.current&&(i.pending||i.status==="pausing")&&(K(null),i.pending&&$("questions arrived \u2014 back to chat")),M(c=>c+1)});return M(i=>i+1),s},[t,Ot]);let{thinking:ue,status:de,pending:_,confirm:qe,ledger:ie,activeTurn:Pt,stream:Kn,notice:je}=t.state,qt=(Kn?.text??"").trimEnd(),jt=qt.length>0,Un=v&&(ue.liveThinking.length>0||ue.thinkingLog.length>0),Qn=Gr(ue.liveThinking||ue.thinkingLog.map(e=>e.text).join(`
5
5
  `),Nn-6,Fn),Ft=jt?qt.split(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-FDXDFZ7J.js";import"./chunk-2OIIXLXW.js";import"./chunk-SJZJ7ASF.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
2
+ import{a,b,c}from"./chunk-PCKIANML.js";import"./chunk-ZC2CKWLB.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as r}from"./chunk-6C35NKQ7.js";import"./chunk-2OIIXLXW.js";import"./chunk-SJZJ7ASF.js";import"./chunk-HCBYKLMW.js";import{c as e}from"./chunk-C44QQJR4.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
2
+ import{a as r}from"./chunk-DOOI2JBD.js";import"./chunk-ZC2CKWLB.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import{c as e}from"./chunk-C44QQJR4.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as P,b as g,c as f}from"./chunk-3MWLFHPO.js";import"./chunk-Z2XKFYMH.js";import"./chunk-5Y2G4NC7.js";import"./chunk-SJZJ7ASF.js";import{a as c}from"./chunk-HCBYKLMW.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
2
+ import{a as P,b as g,c as f}from"./chunk-WDMUPK6I.js";import"./chunk-DWMESHFI.js";import"./chunk-5Y2G4NC7.js";import"./chunk-5TQFOPJV.js";import{a as c}from"./chunk-HCBYKLMW.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as h,b as l,c as i}from"./chunk-Z7IGTVJW.js";import{y as n}from"./chunk-5TQFOPJV.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as s,j as C}from"./chunk-C44QQJR4.js";import{a as S}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var B=u(S(),1);var e=u(x(),1);function T({model:D,authLabel:w,profile:$,env:y,defaultUrl:d,projectId:a,projectName:v,folderId:t,folderName:g,windowSize:P,chromeProfile:R,target:r,deviceName:m,osVersion:f,appLabel:b,deviceSettings:c=[]}){let V=a?v?`${v} (${a})`:a:"(none)",A=t?g?`${g} (${t})`:t:"(none)",{exit:p}=C();return(0,B.useEffect)(()=>{let o=setTimeout(()=>p(),50);return()=>clearTimeout(o)},[p]),(0,e.jsx)(s,{flexDirection:"column",children:(0,e.jsx)(h,{title:"Configuration",children:(0,e.jsxs)(s,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(i,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:w}),(0,e.jsx)(l,{label:" profile",value:$}),(0,e.jsx)(l,{label:" env",value:y}),(0,e.jsx)(i,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:d??"(none)",valueColor:d?n.orange:n.dim}),(0,e.jsx)(l,{label:" model",value:D}),(0,e.jsx)(l,{label:" window",value:P}),(0,e.jsx)(l,{label:" project",value:V}),(0,e.jsx)(l,{label:" folder",value:A}),r!==void 0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" target",value:r}),r!=="desktop"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" device_name",value:m??"(not set)",valueColor:m?void 0:n.dim}),(0,e.jsx)(l,{label:" os_version",value:f??"(not set)",valueColor:f?void 0:n.dim}),(0,e.jsx)(l,{label:" app",value:b??"(not set)",valueColor:b?void 0:n.dim})]})]}),c.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{label:"Device settings"}),c.map(o=>(0,e.jsx)(l,{label:` ${o.label}`,value:o.value},o.label))]}),(0,e.jsx)(i,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:R,valueColor:n.dim})]})})})}export{T as ConfigView};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-UWXDURAB.js";import"./chunk-ZJYT72BA.js";import"./chunk-AACQE24F.js";import"./chunk-5GUD3CIH.js";import"./chunk-4CYBXJIA.js";import"./chunk-RTSBKCZY.js";import"./chunk-WESMQEPO.js";import"./chunk-EHN5HTUD.js";import"./chunk-OMNLAGQC.js";import"./chunk-VVOKM2VO.js";import"./chunk-HGFWIBVF.js";import"./chunk-VZ7KXRXB.js";import"./chunk-GCISXCDU.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-CH273NAE.js";import"./chunk-RFHMDQXZ.js";import"./chunk-OHOJSADN.js";import"./chunk-OIUV3ISA.js";import"./chunk-HG5LLZBU.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-75MMTNPB.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-XT7XA4DN.js";import"./chunk-TM7VRLWS.js";import"./chunk-4JOD47QI.js";import"./chunk-NMSZ7G6P.js";import"./chunk-RZ4F3BHX.js";import"./chunk-FMUV6UCX.js";import"./chunk-NOL7MNZH.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-PEDINHVU.js";import"./chunk-WNOC6MQC.js";import"./chunk-YCCUBQY4.js";import"./chunk-2KVECC36.js";import"./chunk-ZC2CKWLB.js";import"./chunk-NMSZ7G6P.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-YFBJWIBU.js";import"./chunk-DZCJE77P.js";import"./chunk-SJZJ7ASF.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as InfoBox};
2
+ import{a}from"./chunk-CNUCP6DK.js";import"./chunk-Z7IGTVJW.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as InfoBox};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-XFQLR6MF.js";import"./chunk-SJZJ7ASF.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
2
+ import{a}from"./chunk-LH4IPANP.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-NMAPNJRY.js";import"./chunk-2OIIXLXW.js";import"./chunk-SJZJ7ASF.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
2
+ import{a,b}from"./chunk-6VY62QC2.js";import"./chunk-ZC2CKWLB.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-JHBNXTG6.js";import"./chunk-YCCUBQY4.js";import"./chunk-4VW3B7SE.js";import"./chunk-2KVECC36.js";import"./chunk-2OIIXLXW.js";import"./chunk-MHMEEA4S.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-SJZJ7ASF.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
2
+ import{a,b}from"./chunk-USOYXCZ4.js";import"./chunk-WNOC6MQC.js";import"./chunk-YCCUBQY4.js";import"./chunk-2KVECC36.js";import"./chunk-ZC2CKWLB.js";import"./chunk-NMSZ7G6P.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-PLIQ72LH.js";import"./chunk-S3DAAAE5.js";import"./chunk-YFBJWIBU.js";import"./chunk-DZCJE77P.js";import"./chunk-SJZJ7ASF.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SaveSessionPrompt,b as defaultSessionTimestamp,c as renderSavePrompt};
2
+ import{a,b,c}from"./chunk-Q5RDCSYM.js";import"./chunk-S3DAAAE5.js";import"./chunk-CNUCP6DK.js";import"./chunk-Z7IGTVJW.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SaveSessionPrompt,b as defaultSessionTimestamp,c as renderSavePrompt};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-BUPRL2TE.js";import"./chunk-HAYV4D2I.js";import"./chunk-X2A6CC6B.js";import"./chunk-AHFIRHSP.js";import"./chunk-JQ64X2TO.js";import"./chunk-TDPWFYTJ.js";import"./chunk-QAB3Y5FQ.js";import"./chunk-VZ7KXRXB.js";import"./chunk-4BZOG6PE.js";import"./chunk-AKE2CTV6.js";import"./chunk-OIUV3ISA.js";import"./chunk-HG5LLZBU.js";import"./chunk-USOYXCZ4.js";import"./chunk-PEDINHVU.js";import"./chunk-WNOC6MQC.js";import"./chunk-YCCUBQY4.js";import"./chunk-2KVECC36.js";import"./chunk-VE3SUJMA.js";import"./chunk-TZXXJWHA.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-XT7XA4DN.js";import"./chunk-TM7VRLWS.js";import"./chunk-ZC2CKWLB.js";import"./chunk-Z7S3IWUX.js";import"./chunk-C6S2RPZA.js";import"./chunk-NMSZ7G6P.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-FMUV6UCX.js";import"./chunk-NOL7MNZH.js";import"./chunk-YWYORBY3.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-I4SO2FQV.js";import"./chunk-YFBJWIBU.js";import"./chunk-DZCJE77P.js";import"./chunk-SJZJ7ASF.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{d as AutoExitSummaryBox,c as SummaryBox,b as buildSummaryEvent,a as buildSummaryRendered};
2
+ import{a,b,c,d}from"./chunk-XBX643ZD.js";import"./chunk-CNUCP6DK.js";import"./chunk-Z7IGTVJW.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{d as AutoExitSummaryBox,c as SummaryBox,b as buildSummaryEvent,a as buildSummaryRendered};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{g as a}from"./chunk-C25M2J5Q.js";import"./chunk-7WXMV3O3.js";import"./chunk-K3IQEL7R.js";import"./chunk-TDPWFYTJ.js";import"./chunk-QAB3Y5FQ.js";import"./chunk-DWMESHFI.js";import"./chunk-5Y2G4NC7.js";import"./chunk-GCISXCDU.js";import"./chunk-AKE2CTV6.js";import"./chunk-ZXY4P76I.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-75MMTNPB.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-NMSZ7G6P.js";import"./chunk-RZ4F3BHX.js";import"./chunk-FMUV6UCX.js";import"./chunk-NOL7MNZH.js";import"./chunk-CNUCP6DK.js";import"./chunk-Z7IGTVJW.js";import"./chunk-5TQFOPJV.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-VCY7UNEL.js";import"./chunk-5TQIKRKP.js";import"./chunk-RFHMDQXZ.js";import"./chunk-MHMEEA4S.js";import"./chunk-DZCJE77P.js";import"./chunk-SJZJ7ASF.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as buildServeMap,b as renderTestrunEvidenceTable};
2
+ import{a,b}from"./chunk-UA2QDAWT.js";import"./chunk-4CYBXJIA.js";import"./chunk-RFHMDQXZ.js";import"./chunk-NMSZ7G6P.js";import"./chunk-Z7IGTVJW.js";import"./chunk-5TQFOPJV.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as buildServeMap,b as renderTestrunEvidenceTable};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f,b as r}from"./chunk-DZCJE77P.js";import{y as o}from"./chunk-SJZJ7ASF.js";import{a as s}from"./chunk-HCBYKLMW.js";import{a as i,b as l,j as x}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var p=a(B(),1);var e=a(s(),1);function V({profile:b,env:g,authenticated:n,authMethod:v,username:c,tokenStatus:t,serverStatus:d,detail:u}){let{exit:m}=x();return(0,p.useEffect)(()=>{let h=setTimeout(()=>m(),50);return()=>clearTimeout(h)},[m]),(0,e.jsx)(i,{flexDirection:"column",children:(0,e.jsx)(f,{title:"Identity",variant:n?"success":"warning",children:(0,e.jsxs)(i,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(i,{children:d==="rejected"?(0,e.jsx)(l,{color:o.red,bold:!0,children:"\u2717 Not authenticated"}):d==="unreachable"?(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Couldn't verify"}):n?(0,e.jsx)(l,{color:o.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(i,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(r,{label:"Profile",value:b}),(0,e.jsx)(r,{label:"Environment",value:g}),(0,e.jsx)(r,{label:"Method",value:v}),c&&(0,e.jsx)(r,{label:"User",value:c}),t&&(0,e.jsx)(r,{label:"Token",value:t,valueColor:t==="valid"?o.green:t==="expired"?o.red:o.dim}),u&&(0,e.jsx)(r,{label:"Detail",value:u})]})]})})})}export{V as WhoamiView};
2
+ import{a as f,b as r}from"./chunk-Z7IGTVJW.js";import{y as o}from"./chunk-5TQFOPJV.js";import{a as s}from"./chunk-HCBYKLMW.js";import{a as i,b as l,j as x}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var p=a(B(),1);var e=a(s(),1);function V({profile:b,env:g,authenticated:n,authMethod:v,username:c,tokenStatus:t,serverStatus:d,detail:u}){let{exit:m}=x();return(0,p.useEffect)(()=>{let h=setTimeout(()=>m(),50);return()=>clearTimeout(h)},[m]),(0,e.jsx)(i,{flexDirection:"column",children:(0,e.jsx)(f,{title:"Identity",variant:n?"success":"warning",children:(0,e.jsxs)(i,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(i,{children:d==="rejected"?(0,e.jsx)(l,{color:o.red,bold:!0,children:"\u2717 Not authenticated"}):d==="unreachable"?(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Couldn't verify"}):n?(0,e.jsx)(l,{color:o.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(i,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(r,{label:"Profile",value:b}),(0,e.jsx)(r,{label:"Environment",value:g}),(0,e.jsx)(r,{label:"Method",value:v}),c&&(0,e.jsx)(r,{label:"User",value:c}),t&&(0,e.jsx)(r,{label:"Token",value:t,valueColor:t==="valid"?o.green:t==="expired"?o.red:o.dim}),u&&(0,e.jsx)(r,{label:"Detail",value:u})]})]})})})}export{V as WhoamiView};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d,e,f,g,h}from"./chunk-TM7VRLWS.js";import"./chunk-RZ4F3BHX.js";import"./chunk-NOL7MNZH.js";import"./chunk-UR6MHSHU.js";export{h as AppClient,g as AppUploadError,a as UPLOAD_CONTENT_TYPE,e as parseAppDetails,b as parseAppListPage,d as parseSignedDownload,c as parseUploadResponse,f as transportReason};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as a,c as b}from"./chunk-XT7XA4DN.js";import"./chunk-TM7VRLWS.js";import"./chunk-RZ4F3BHX.js";import"./chunk-NOL7MNZH.js";import"./chunk-5TQFOPJV.js";import"./chunk-UR6MHSHU.js";export{a as isAppId,b as resolveCloudApp};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import"./chunk-UR6MHSHU.js";async function i(e){try{let[{CredentialsManager:n},{AuthResolver:a},{getEnvironment:s}]=await Promise.all([import("./credentials-FH6VZPJS.js"),import("./resolver-U55SNASN.js"),import("./config-HVSKN6L4.js")]),t=new n,o=t.getActiveProfile()??"default",c=t.loadCredentials(o,e);if(typeof c?.access_token!="string")return null;let r=await new a(s(e).controllerBaseUrl,async()=>c.access_token,null).resolve();return typeof r?.username!="string"||!r.username||typeof r.access_key!="string"||!r.access_key?null:Buffer.from(`${r.username}:${r.access_key}`,"utf8").toString("base64")}catch{return null}}async function u(e={}){let n=e.env??process.env,s=await(e.resolveBase??(async()=>(await import("./spawner-HZXP66DS.js")).resolveAgentAuthEnv()))();if(s.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH)return s;let t=n.TESTMUAI_ENV==="stage"?"stage":"prod",o=await(e.exchange??i)(t);return o?{...s,TESTMUAI_BASIC_AUTH:o}:s}export{u as resolveLisAuthEnv};
2
+ import"./chunk-UR6MHSHU.js";async function i(e){try{let[{CredentialsManager:n},{AuthResolver:a},{getEnvironment:s}]=await Promise.all([import("./credentials-QD32Y7K7.js"),import("./resolver-TLO4SRWV.js"),import("./config-YGTHSGQN.js")]),t=new n,o=t.getActiveProfile()??"default",c=t.loadCredentials(o,e);if(typeof c?.access_token!="string")return null;let r=await new a(s(e).controllerBaseUrl,async()=>c.access_token,null).resolve();return typeof r?.username!="string"||!r.username||typeof r.access_key!="string"||!r.access_key?null:Buffer.from(`${r.username}:${r.access_key}`,"utf8").toString("base64")}catch{return null}}async function u(e={}){let n=e.env??process.env,s=await(e.resolveBase??(async()=>(await import("./spawner-DPT2RLAO.js")).resolveAgentAuthEnv()))();if(s.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH)return s;let t=n.TESTMUAI_ENV==="stage"?"stage":"prod",o=await(e.exchange??i)(t);return o?{...s,TESTMUAI_BASIC_AUTH:o}:s}export{u as resolveLisAuthEnv};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-3M6OM3T4.js";import"./chunk-SIXPXYCH.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{b as ensureHyperexecuteBinary,a as hyperexecuteDownloadUrl};
2
+ import{a,b}from"./chunk-RWSOZPJQ.js";import"./chunk-7GAHJZLH.js";import"./chunk-5TQFOPJV.js";import"./chunk-UR6MHSHU.js";export{b as ensureHyperexecuteBinary,a as hyperexecuteDownloadUrl};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as N}from"./chunk-5XAX4C5N.js";import"./chunk-ZKSN2SJ7.js";import"./chunk-EVFFDODK.js";import"./chunk-KJQNAOOE.js";import"./chunk-GF32QBCM.js";import"./chunk-4ZBI54KE.js";import"./chunk-D7WG7SRA.js";import"./chunk-WVHMPIDQ.js";import"./chunk-E2KV4BQB.js";import"./chunk-BB2W35TW.js";import"./chunk-AXTPNZPX.js";import"./chunk-U6OTFMIT.js";import"./chunk-BZAGVBCX.js";import"./chunk-V4B5QA3U.js";import"./chunk-T6MGCP57.js";import"./chunk-YKTYVJBN.js";import"./chunk-FY7TCYPK.js";import"./chunk-63DYVWNX.js";import"./chunk-427OQS2N.js";import"./chunk-LSDWPG6C.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-2G5CJQOR.js";import"./chunk-CBUSNWHA.js";import{U as A,V as U,W as I,X as k}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 d}from"./chunk-CH273NAE.js";import"./chunk-XKYL4K4A.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{t as R}from"./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";import{existsSync as M}from"fs";var q=new Set(["interactive","agent","ci","override"]);function F(t){return t.mode!=null&&!q.has(t.mode)?{error:`design: --mode must be interactive | agent | ci | override, got '${t.mode}'`}:t.strength!=null&&t.strength!=="pairwise"&&t.strength!=="3-wise"?{error:`design: --strength must be pairwise | 3-wise, got '${t.strength}'`}:t.max!=null&&(!Number.isInteger(t.max)||t.max<1)?{error:"design: --max must be a positive integer"}:!t.useCase&&!t.resume?{error:"design: --use-case is required (or --resume <sid> \u2014 the session remembers its use-case)"}:{useCase:t.useCase,max:t.max,strength:t.strength,mode:t.mode,force:t.force,resume:t.resume,plan:t.plan,message:t.message,phase:t.phase,allowUnreviewed:t.allowUnreviewed,because:t.because,changeDelta:t.changeDelta,priorDesign:t.priorDesign,statement:t.statement}}async function X(t){let l=async(e,s)=>{if(t.mode!=="agent")return process.stderr.write(e+`
2
+ import{d as N}from"./chunk-SID4X77D.js";import"./chunk-ZKSN2SJ7.js";import"./chunk-EVFFDODK.js";import"./chunk-KJQNAOOE.js";import"./chunk-LSDWPG6C.js";import"./chunk-5HMN74RZ.js";import"./chunk-VORWZLS3.js";import"./chunk-VBS33P2C.js";import"./chunk-WVHMPIDQ.js";import"./chunk-XKHWWKJZ.js";import"./chunk-BB2W35TW.js";import"./chunk-AXTPNZPX.js";import"./chunk-U6OTFMIT.js";import"./chunk-BZAGVBCX.js";import"./chunk-V4B5QA3U.js";import"./chunk-SEEEGDVK.js";import"./chunk-243ZJHT6.js";import"./chunk-DTRKTBCE.js";import"./chunk-2UIHS2FH.js";import"./chunk-YKTYVJBN.js";import"./chunk-FY7TCYPK.js";import"./chunk-63DYVWNX.js";import"./chunk-427OQS2N.js";import"./chunk-7N6OCHPC.js";import"./chunk-KDNNMU7Q.js";import"./chunk-Q2F5QB2W.js";import"./chunk-Q6F23V7L.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import"./chunk-USY7VAO6.js";import{U as A,V as U,W as I,X as k}from"./chunk-GTVQYT3D.js";import"./chunk-4Y2WH77W.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-VHW7BMZQ.js";import"./chunk-OMNLAGQC.js";import"./chunk-VVOKM2VO.js";import"./chunk-HGFWIBVF.js";import"./chunk-VZ7KXRXB.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import{t as R}from"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import{a as d}from"./chunk-CH273NAE.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-YCCUBQY4.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-FMUV6UCX.js";import"./chunk-NOL7MNZH.js";import"./chunk-5TQFOPJV.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{existsSync as M}from"fs";var q=new Set(["interactive","agent","ci","override"]);function F(t){return t.mode!=null&&!q.has(t.mode)?{error:`design: --mode must be interactive | agent | ci | override, got '${t.mode}'`}:t.strength!=null&&t.strength!=="pairwise"&&t.strength!=="3-wise"?{error:`design: --strength must be pairwise | 3-wise, got '${t.strength}'`}:t.max!=null&&(!Number.isInteger(t.max)||t.max<1)?{error:"design: --max must be a positive integer"}:!t.useCase&&!t.resume?{error:"design: --use-case is required (or --resume <sid> \u2014 the session remembers its use-case)"}:{useCase:t.useCase,max:t.max,strength:t.strength,mode:t.mode,force:t.force,resume:t.resume,plan:t.plan,message:t.message,phase:t.phase,allowUnreviewed:t.allowUnreviewed,because:t.because,changeDelta:t.changeDelta,priorDesign:t.priorDesign,statement:t.statement}}async function X(t){let l=async(e,s)=>{if(t.mode!=="agent")return process.stderr.write(e+`
3
3
  `),2;let{makeHeadlessIO:n,agentRefusal:c}=await import("./headless-io-75HUMWZB.js");return c(n("ndjson","design"),e,s)};if(t.mode!=null&&!["interactive","agent","ci","override"].includes(t.mode)){let{makeHeadlessIO:e,agentRefusal:s}=await import("./headless-io-75HUMWZB.js");return s(e("ndjson","design"),`design: --mode must be interactive | agent | ci | override, got '${t.mode}'`,"MODE_USAGE")}let T=F(t);if("error"in T)return l(T.error);let o=T;{let{validateResumeMessage:e}=await import("./headless-io-75HUMWZB.js"),s=e(o,"design");if(s)return l(s)}{let{gateStructuredFlags:e}=await import("./structured-answers-ZI2B6JJE.js"),s=e(t,"design");if(s)return l(s,"STRUCTURED_FLAGS_USAGE")}if(!M(d(process.cwd())))return l("error: no context store here (run `kane-cli context ingest` + `kane-cli context extract` first)","NO_STORE");{let e=I(d(process.cwd()));if(e){if(t.mode!=="agent")return l(`error: ${e.text}
4
4
  next: ${e.remedy}`,e.code);let{makeHeadlessIO:s}=await import("./headless-io-75HUMWZB.js"),n=s("ndjson","design");return n.event(k(e)),n.done(2,"refused")}}let x=!!o.resume;if(o.useCase&&o.resume&&!t.allowUnreviewed)try{let{peekSession:e}=await import("./sessions-NH7WQWMX.js"),s=e(d(process.cwd()),o.resume);x=!!(s&&s.use_case===o.useCase)}catch{x=!1}if(o.useCase&&!x&&!t.allowUnreviewed)try{let[{openGraph:e},{designEntryCheck:s}]=await Promise.all([import("./readmodel-FVLRQWZ7.js"),import("./trust-gate-EX7R2P4Y.js")]),n=s(e(d(process.cwd())),o.useCase);if(!n.ok&&(n.code==="UC_UNREVIEWED"||n.code==="UC_ARCHIVED"))if((o.mode??"interactive")==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY){let{createInterface:f}=await import("readline/promises"),u=f({input:process.stdin,output:process.stderr}),w=(await u.question(`design: ${n.detail}
5
5
  Design against it anyway? (y/N) `)).trim().toLowerCase();if(u.close(),w!=="y"&&w!=="yes")return process.stderr.write(`aborted \u2014 approve it first: ${n.reviewCmd}
@@ -7,7 +7,7 @@ Design against it anyway? (y/N) `)).trim().toLowerCase();if(u.close(),w!=="y"&&w
7
7
  `),2}catch(e){process.env.KANE_DEBUG&&process.stderr.write(`trust gate skipped: ${String(e)}
8
8
  `)}let r=null,p=null;try{if(!o.mode&&!process.stdin.isTTY)return process.stderr.write(`design: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
9
9
  `),2;let e=o.mode??"interactive";if(e==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`design: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
10
- `),2;let{bindDesignInteractive:i}=await import("./interactive-bind-JAB6XUPX.js");return await i(o)}let{resolveAgentAuthEnv:s}=await import("./spawner-HZXP66DS.js"),{runAgent:n}=await import("./bridge-NHXCRSIU.js"),{preflightTurn:c}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:f}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:u}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:w,resolveEncoding:E,guardedChannels:G}=await import("./headless-io-75HUMWZB.js"),{withStructuredNext:O,prepareStructuredResume:Y}=await import("./structured-answers-ZI2B6JJE.js");r=O(w(E(e),"design"));let b=await A(d(process.cwd()));b&&(E(e)==="ndjson"?r.event(U(b)):r.progress(b.text));let{runWithChannel:H}=await import("./run-channel-RGH4WIQX.js"),v=r,P=E(e)==="ndjson"?i=>H({event:g=>v.event(g)},i):i=>i(),C=i=>{v.out(i),v.event({type:"note",text:i})},{telemetryBootstrap:j,telemetryEnvName:B}=await import("./bootstrap-DBAQWVNA.js"),m=j({verb:"design",mode:e,contextRoot:d(process.cwd()),env:B(),resumeSid:o.resume,write:!0,longSession:!0});p=i=>m.end(i);let a=Y({opts:t,contextDir:d(process.cwd()),verb:"design"});if(a.kind==="refuse")return r.out(a.error),e==="agent"&&r.event({type:"error",message:a.error,code:a.code}),await m.end({exit_code:2}),e==="agent"?r.done(2,"refused"):2;let D;if(a.kind==="apply"){for(let i of a.notes)C(i);if(a.matchedQids.length>0){C(`applying ${a.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let i of a.matchedQids)r.event({type:"panel_resolved",id:i,by:"user",via:"flag"})}a.statement&&(D=[o.message,a.statement].filter(Boolean).join(`
10
+ `),2;let{bindDesignInteractive:i}=await import("./interactive-bind-IYS6KDOH.js");return await i(o)}let{resolveAgentAuthEnv:s}=await import("./spawner-DPT2RLAO.js"),{runAgent:n}=await import("./bridge-7J3JE3JS.js"),{preflightTurn:c}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:f}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:u}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:w,resolveEncoding:E,guardedChannels:G}=await import("./headless-io-75HUMWZB.js"),{withStructuredNext:O,prepareStructuredResume:Y}=await import("./structured-answers-ZI2B6JJE.js");r=O(w(E(e),"design"));let b=await A(d(process.cwd()));b&&(E(e)==="ndjson"?r.event(U(b)):r.progress(b.text));let{runWithChannel:H}=await import("./run-channel-RGH4WIQX.js"),v=r,P=E(e)==="ndjson"?i=>H({event:g=>v.event(g)},i):i=>i(),C=i=>{v.out(i),v.event({type:"note",text:i})},{telemetryBootstrap:j,telemetryEnvName:B}=await import("./bootstrap-DI4UGMH3.js"),m=j({verb:"design",mode:e,contextRoot:d(process.cwd()),env:B(),resumeSid:o.resume,write:!0,longSession:!0});p=i=>m.end(i);let a=Y({opts:t,contextDir:d(process.cwd()),verb:"design"});if(a.kind==="refuse")return r.out(a.error),e==="agent"&&r.event({type:"error",message:a.error,code:a.code}),await m.end({exit_code:2}),e==="agent"?r.done(2,"refused"):2;let D;if(a.kind==="apply"){for(let i of a.notes)C(i);if(a.matchedQids.length>0){C(`applying ${a.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let i of a.matchedQids)r.event({type:"panel_resolved",id:i,by:"user",via:"flag"})}a.statement&&(D=[o.message,a.statement].filter(Boolean).join(`
11
11
 
12
12
  `))}let _=u();_&&C(_);let h=f(n,i=>r.out(i)),S=G(r,()=>h.interrupted(),/^error: (design agent failed|the design agent ended)/);try{let i=e==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY?async y=>{let{createInterface:L}=await import("readline/promises"),$=L({input:process.stdin,output:process.stdout});try{return/^y(es)?$/i.test((await $.question(`${y} [y/N] `)).trim())}finally{$.close()}}:void 0,g=await P(async()=>{let y={...await s(),...m.spawnEnv()};return N({...o,mode:e,...D!==void 0?{message:D}:{},...i?{confirmRetarget:i}:{}},{contextDir:d(process.cwd()),agent:h.agent,preflightTurn:()=>c(y),ask:async()=>[],out:S.out,emit:S.emit,progress:v.progress,isTTY:!1,auth:y,telemetry:m})});return h.interrupted()&&g!==3?(r.out("interrupted \u2014 no session saved"),await m.end({exit_code:130}),r.done(130)):(g===1&&r.out(m.supportFooter()),await m.end({exit_code:g}),r.done(g))}finally{h.dispose()}}catch(e){if(e instanceof R)return p&&await p({exit_code:2}).catch(()=>{}),r?(r.event(k({code:e.code,text:e.message,remedy:e.remedy})),r.done(2,"refused")):(process.stderr.write(`error: ${e.message}
13
13
  next: ${e.remedy}
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-VW3PFRCO.js";import"./chunk-ZLWURCJ7.js";import"./chunk-QSCXXNC2.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{b as telemetryBootstrap,a as telemetryEnvName};
2
+ import{a,b}from"./chunk-3YIZG7WZ.js";import"./chunk-ZLWURCJ7.js";import"./chunk-QSCXXNC2.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-5TQFOPJV.js";import"./chunk-UR6MHSHU.js";export{b as telemetryBootstrap,a as telemetryEnvName};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-OC6H6BYI.js";import"./chunk-OXC6O5O7.js";import"./chunk-243ZJHT6.js";import"./chunk-UD7KKHPW.js";import"./chunk-5TQFOPJV.js";import"./chunk-UR6MHSHU.js";export{a as runAgent};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{f as a,g as b,h as c,i as d,j as e,k as f,l as g}from"./chunk-BL3SJDCG.js";import"./chunk-NMSZ7G6P.js";import"./chunk-RZ4F3BHX.js";import"./chunk-5TQFOPJV.js";import"./chunk-UR6MHSHU.js";export{a as ANY_REAL_DEVICE,g as checkRealDevice,c as fetchRealDeviceCatalog,e as isAnyRealDevice,f as matchRealDevice,d as osMajorOf,b as parseRealDeviceCatalog};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-RZ4F3BHX.js";import{b as i,f as c}from"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";import{readFileSync as u,writeFileSync as g,mkdirSync as d}from"fs";import{join as f}from"path";var h=f(i,"changelog-cache.json"),p=3600*1e3;function y(){try{let e=JSON.parse(u(h,"utf-8"));if(Date.now()-e.cachedAt<p)return e}catch{}return null}function m(e){try{d(i,{recursive:!0}),g(h,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function A(e){try{let t=y();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await l(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return m(s),e?.all?s:s.slice(0,5)}catch{return[]}}function v(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
2
+ import{a as l}from"./chunk-RZ4F3BHX.js";import{b as i,f as c}from"./chunk-5TQFOPJV.js";import"./chunk-UR6MHSHU.js";import{readFileSync as u,writeFileSync as g,mkdirSync as d}from"fs";import{join as f}from"path";var h=f(i,"changelog-cache.json"),p=3600*1e3;function y(){try{let e=JSON.parse(u(h,"utf-8"));if(Date.now()-e.cachedAt<p)return e}catch{}return null}function m(e){try{d(i,{recursive:!0}),g(h,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function A(e){try{let t=y();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await l(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return m(s),e?.all?s:s.slice(0,5)}catch{return[]}}function v(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
3
3
  `).filter(a=>a.trim());for(let a of o)t.push(` ${a}`)}t.push("")}return t.join(`
4
4
  `)}export{A as fetchChangelog,v as formatChangelog};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as n}from"./chunk-SJZJ7ASF.js";import{createHash as _}from"crypto";import{existsSync as m,readFileSync as u}from"fs";import{dirname as T,join as f,resolve as o}from"path";import{fileURLToPath as E}from"url";var s=T(E(import.meta.url)),l=2;function p(e,r){let t=_("sha256");return t.update(`kane-assurance-contract
2
+ import{a as n}from"./chunk-5TQFOPJV.js";import{createHash as _}from"crypto";import{existsSync as m,readFileSync as u}from"fs";import{dirname as T,join as f,resolve as o}from"path";import{fileURLToPath as E}from"url";var s=T(E(import.meta.url)),l=2;function p(e,r){let t=_("sha256");return t.update(`kane-assurance-contract
3
3
  `),t.update(e),t.update(`
4
4
  agent_state_schema=${r}`),"sha256:"+t.digest("hex")}function d(){return[o(s,".."),o(s,"../../..")]}function i(){return"sha256:4f00de27d151118e79aafd46ebe51bb69ce7dd9fabe647124c62f2d187e11aa7"}var a=class extends Error{constructor(t,c){super(`agent/cli contract mismatch (cli ${t||"<unset>"}, agent ${c||"<unset>"}) \u2014 rebuild or reinstall the stale half`);this.expected=t;this.actual=c;this.name="PairMismatchError"}};function I(){return{TESTMUAI_CONTRACT_DIGEST:i(),TESTMUAI_CLIENT_VERSION:process.env.KANE_DEV_FORCE_CLIENT_RELEASE??`kane-cli/${n}`}}export{a,I as b};
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as z}from"./chunk-EHN5HTUD.js";import{b as X,c as v,e as W,i as Y,j as Z,k as ee,l as te,m as E,o as ne,p as se}from"./chunk-NAWGHDA3.js";import{a as Q}from"./chunk-ODU2JSMA.js";import{d as q}from"./chunk-SJZJ7ASF.js";import{copyFileSync as Re,cpSync as xe,existsSync as P,mkdirSync as Ie,readFileSync as ze,readdirSync as ke,rmSync as Qe,writeFileSync as Xe}from"fs";import{dirname as Ye,isAbsolute as Ze,join as x,relative as et,resolve as tt}from"path";import{writeFileSync as ve,mkdirSync as Pe,readFileSync as je}from"fs";import{dirname as De,basename as re}from"path";function oe(e){let t=e.outPath??v(e.sourcePath);Pe(De(t),{recursive:!0});let n=[];n.push("---"),n.push(`test: ../${re(e.sourcePath)}`),n.push(`status: ${e.overallStatus}`),n.push(`started: ${e.startedISO}`),n.push(`duration_s: ${e.durationS}`),n.push(`session_id: ${e.sessionId}`),n.push("---",""),n.push(`# ${e.title??re(e.sourcePath)} \u2014 Result`,"");for(let r=0;r<e.rootSteps.length;r++){let o=e.rootSteps[r],s=e.outcomes.find(l=>l.rootStepIndex===r+1);if(n.push($e(o,s)),s?.stepMd5&&n.push(`md5: ${s.stepMd5}`),s?.status==="failed"&&s.reason&&n.push(`Reason: ${s.reason}`),s?.softFailures?.length)for(let l of s.softFailures){let a=l.reason?`: ${l.reason}`:"";n.push(`\u26A0 optional sub-step ${l.subStepIndex} failed${a}`)}o.body.kind==="objective"&&s?.status!=="skipped"&&n.push(o.body.text),n.push("")}return ve(t,n.join(`
2
+ import{b as X,c as v,e as W,i as Y,j as Z,k as ee,l as te,m as E,o as ne,p as se}from"./chunk-JQY5HRZ4.js";import{e as z}from"./chunk-EHN5HTUD.js";import{a as Q}from"./chunk-HGFWIBVF.js";import{d as q}from"./chunk-5TQFOPJV.js";import{copyFileSync as Re,cpSync as xe,existsSync as P,mkdirSync as Ie,readFileSync as ze,readdirSync as ke,rmSync as Qe,writeFileSync as Xe}from"fs";import{dirname as Ye,isAbsolute as Ze,join as x,relative as et,resolve as tt}from"path";import{writeFileSync as ve,mkdirSync as Pe,readFileSync as je}from"fs";import{dirname as De,basename as re}from"path";function oe(e){let t=e.outPath??v(e.sourcePath);Pe(De(t),{recursive:!0});let n=[];n.push("---"),n.push(`test: ../${re(e.sourcePath)}`),n.push(`status: ${e.overallStatus}`),n.push(`started: ${e.startedISO}`),n.push(`duration_s: ${e.durationS}`),n.push(`session_id: ${e.sessionId}`),n.push("---",""),n.push(`# ${e.title??re(e.sourcePath)} \u2014 Result`,"");for(let r=0;r<e.rootSteps.length;r++){let o=e.rootSteps[r],s=e.outcomes.find(d=>d.rootStepIndex===r+1);if(n.push($e(o,s)),s?.stepMd5&&n.push(`md5: ${s.stepMd5}`),s?.status==="failed"&&s.reason&&n.push(`Reason: ${s.reason}`),s?.softFailures?.length)for(let d of s.softFailures){let a=d.reason?`: ${d.reason}`:"";n.push(`\u26A0 optional sub-step ${d.subStepIndex} failed${a}`)}o.body.kind==="objective"&&s?.status!=="skipped"&&n.push(o.body.text),n.push("")}return ve(t,n.join(`
3
3
  `),"utf8"),t}function $e(e,t){if(!t)return`## ${e.heading} (no outcome)`;let n=t.duration_s!=null?`${t.duration_s}s`:"\u2014";if(t.status==="skipped")return`## ${e.heading} \u23ED skipped`;let r=t.softFailed?" (optional)":"";if(t.refKind&&t.status==="passed"){let o=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2713 passed (via @${t.refKind} ${t.refLabel} \u2014 ${t.inlinedCount} inlined steps, ${n}${o})`}if(t.refKind&&t.status==="failed"){let o=t.failedSubStepIndex&&t.failedSubStepIndex.length>0?` \u2014 at sub-step ${t.failedSubStepIndex.join(" \u2192 sub-step ")}`:"",s=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2717 failed${r} (via @${t.refKind} ${t.refLabel}${o}, ${n}${s})`}return t.status==="passed"?`## ${e.heading} \u2713 passed (${n})`:`## ${e.heading} \u2717 failed${r} (${n})`}var Fe=/^##\s+(.+?)\s+(✓ passed|✗ failed(?:\s+\(optional\))?|⏭ skipped)(?:\s+\((.*)\))?\s*$/,Oe=/via\s+@\w+\s+(\S+).*?(?:→\s+(\S+))?\s*$/,_e=/^md5:\s+([a-f0-9]{32})\s*$/;function ie(e,t){for(let n=t;n<e.length&&!/^##\s/.test(e[n]);n++){if(e[n].trim()==="")continue;let r=_e.exec(e[n]);return r?r[1]:null}return null}function D(e){let n=je(e,"utf8").split(`
4
- `),r="passed";if(n[0]?.trim()==="---")for(let s=1;s<n.length&&n[s].trim()!=="---";s++){let l=/^status:\s+(passed|failed|interrupted)\s*$/.exec(n[s]);l&&(r=l[1])}let o=[];for(let s=0;s<n.length;s++){let l=Fe.exec(n[s]);if(!l)continue;let a=l[1],i=l[2],c=l[3]??"",f=i.startsWith("\u2713")?"passed":i.startsWith("\u23ED")?"skipped":"failed";if(/via\s+@/.test(c)){let m=Oe.exec(c),w=m?.[1]??"",I=m?.[2]??null;o.push({kind:"import",heading:a,status:f,md5:ie(n,s+1),importPath:w,helperResultRelPath:I})}else o.push({kind:"objective",heading:a,status:f,md5:ie(n,s+1)})}return{overallStatus:r,steps:o}}import{copyFileSync as ae,existsSync as H,mkdirSync as Ae,writeFileSync as de,promises as dt}from"fs";import{join as $,dirname as pe,basename as Te}from"path";async function le(e){for(let t=0;t<e.totalRunDirs;t++){let n=e.runIndex+t,r=$(e.sessionDir,"runs",String(n)),o=$(e.stagingStepDir,"flows",String(t));Ae(o,{recursive:!0});let s=$(o,"actions.ndjson");if(e.packTestDir){let i=$(e.packTestDir,"logs",`${n}-actions.ndjson`);if(H(i)){ae(i,s);continue}let c=pe(pe(e.packTestDir)),f=Te(e.packTestDir),S=H(c)?await z(c,`tests/${f}/logs/${n}-actions.ndjson`).catch(()=>null):null;de(s,S??"");continue}let l=[$(r,"run-test","actions.ndjson"),$(r,"actions.ndjson")],a=!1;for(let i of l)if(H(i)){ae(i,s),a=!0;break}a||de(s,"")}}import{existsSync as ce,readFileSync as fe,readdirSync as Ne}from"fs";import{join as F}from"path";function Ee(e){if(e.action_type!=="upload_files")return null;let t=e.action_params?.media;if(!t||typeof t!="object")return null;let n=typeof t.media_id=="string"?t.media_id:"",r=typeof t.name=="string"?t.name:"",o=typeof t.media_url=="string"?t.media_url:"";if(!n||!r||!o)return null;let s=typeof t.type=="string"&&t.type?t.type:"doc";return{media_id:n,name:r,media_url:o,type:s}}function Le(e){let t=e.action_params?.file_paths,n=Array.isArray(t)?t[0]:t;return typeof n=="string"&&n.length>0?n:null}function Ue(e){let t={};for(let[n,r]of Object.entries(e??{}))t[n]={...r,refs:[...r.refs??[]]};return t}function Ke(e,t){if(!t)return!1;let n=t.endsWith("/")?t:t+"/";return e.startsWith(n)}function ue(e,t,n,r={}){let o=Ue(e);for(let s of t){let l=Ee(s);if(!l)continue;let a=o[l.media_id]??={name:l.name,media_url:l.media_url,type:l.type,refs:[],recorded_at:n};a.recorded_at=n;let i=Le(s);if(!(!i||Ke(i,r.ignoreAliasUnder))){for(let[c,f]of Object.entries(o))c!==l.media_id&&(f.refs=f.refs.filter(S=>S!==i));a.refs.includes(i)||a.refs.push(i)}}return o}function ct(e){let t=e?.media;if(!t||typeof t!="object")return[];let n=[];for(let[r,o]of Object.entries(t)){if(!r||!o||typeof o!="object")continue;let s=o;typeof s.name!="string"||!s.name||typeof s.media_url!="string"||!s.media_url||n.push({media_id:r,name:s.name,media_url:s.media_url,type:typeof s.type=="string"&&s.type?s.type:"doc",refs:Array.isArray(s.refs)?s.refs.filter(l=>typeof l=="string"&&l.length>0):[]})}return n}function Ce(e){let t=[];for(let n of e){let r;try{r=fe(n,"utf8")}catch{continue}for(let o of r.split(`
5
- `)){let s=o.trim();if(s)try{let l=JSON.parse(s);l&&typeof l=="object"&&t.push(l)}catch{}}}return t}function V(e){try{return Ne(e,{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name).sort((t,n)=>t.localeCompare(n,void 0,{numeric:!0}))}catch{return[]}}function St(e){if(!e)return[];let t=[];for(let n of V(F(e,"runs")))for(let r of[F(e,"runs",n,"run-test","actions.ndjson"),F(e,"runs",n,"actions.ndjson")])if(ce(r)){t.push(r);break}return t}function me(e){let t=[],n=F(e,".internal","steps");for(let r of V(n)){let o=F(n,r,"flows");for(let s of V(o)){let l=F(o,s,"actions.ndjson");ce(l)&&t.push(l)}}return t}function We(e){try{let n=JSON.parse(fe(e,"utf8"))?.media;return n&&typeof n=="object"?n:void 0}catch{return}}function ge(e){let t=We(e.priorMetaPath),n=Ce(e.recordFiles),r=ue(t,n,e.now??new Date().toISOString(),{ignoreAliasUnder:e.ignoreAliasUnder??q});return Object.keys(r).length>0?r:void 0}import{existsSync as L,readdirSync as He}from"fs";import{dirname as Ve,join as O,basename as B}from"path";function wt(e,t){let n=[];return e.steps.forEach((r,o)=>{let s=t[o];r.block||!r.replayOnly||!s||s.kind!=="author"||n.push({flatIndex:r.flatIndex,file:r.owningFile,heading:r.trace[r.trace.length-1].heading,kind:r.replayOnly,reason:s.reason})}),n}function vt(e){let t=[],n=new Set,r=new Map;function o(i){if(r.has(i))return r.get(i);let c=v(i),f=L(c)?D(c):null;return r.set(i,f),f}let s=new Map;function l(i){if(s.has(i))return s.get(i);let c=O(i,"Result.md"),f=L(c)?D(c):null;return s.set(i,f),f}function a(i){for(let c=1;c<i.trace.length;c++){let f=i.trace[c-1],S=o(f.file);if(!S)continue;let m=S.steps[f.stepIndex-1];if(m){if(m.kind!=="import")return{kind:"author",reason:"structure-mismatch"};if(B(m.importPath)!==B(i.trace[c].file))return{kind:"author",reason:"structure-mismatch"};if(m.md5!=null&&m.md5!==f.rowMd5)return{kind:"author",reason:"structure-mismatch"}}}return null}for(let i of e.steps){let c=i.trace[i.trace.length-1].stepIndex,f=i.replayOnly;if(i.block){let g=o(i.owningFile)?.steps[c-1],j=i.controlFlow!==void 0,T=g?.kind==="objective"&&g.status==="skipped";if(j||T){t.push({kind:"replay",recordingDir:"",flowCount:0,unrecorded:!0,...f?{replayOnly:f}:{}});continue}}let S=n.has(i.owningFile);for(let g=0;g<i.trace.length-1&&!S;g++)n.has(i.trace[g].file)&&(S=!0);if(S&&!f){t.push({kind:"author",reason:o(i.owningFile)===null?"no-result-md":"downstream-of-divergence"});continue}let m=a(i);if(m){for(let g=0;g<i.trace.length;g++)n.add(i.trace[g].file);if(!f){t.push(m);continue}}let w=o(i.owningFile),I;if(w===null&&i.trace.length>1){let g=J(i.trace);I=he(i,l(g),c,g)}else I=he(i,w,c);if(f&&I.kind==="replay"&&(I={...I,replayOnly:f}),t.push(I),I.kind==="author"){n.add(i.owningFile);for(let g=0;g<i.trace.length-1;g++)n.add(i.trace[g].file)}}return t}function he(e,t,n,r=null){if(!t)return{kind:"author",reason:"no-result-md"};let o=t.steps[n-1];if(!o)return{kind:"author",reason:"no-result-md"};if(o.kind!=="objective")return{kind:"author",reason:"structure-mismatch"};if(o.status!=="passed")return{kind:"author",reason:"recorded-failed"};let s=E(e);if(s!==o.md5)return{kind:"author",reason:"md5-mismatch"};let l=r===null?ee(e.owningFile,n,s.slice(0,8)):O(r,".internal","steps",`${n}-${s.slice(0,8)}`),a=Be(l);return a===0?{kind:"author",reason:"missing-recording"}:{kind:"replay",recordingDir:l,flowCount:a}}function Be(e){let t=O(e,"flows");if(!L(t))return 0;let n;try{n=He(t,{withFileTypes:!0}).filter(o=>o.isDirectory()&&/^\d+$/.test(o.name)).map(o=>parseInt(o.name,10))}catch{return 0}if(n.length===0)return 0;let r=Math.max(...n);for(let o=0;o<=r;o++)if(!L(O(t,String(o),"actions.ndjson")))return 0;return r+1}function Pt(e){return e.some(t=>t.kind==="author")}function jt(e){for(let t=0;t<e.length;t++)if(e[t].kind==="author")return t;return e.length}function J(e){let t=s=>{let l=B(s);return l.endsWith("_test.md")?l.slice(0,-8):l.endsWith(".md")?l.slice(0,-3):l},n=t(e[0].file),r=t(e[e.length-1].file),o=e.slice(0,-1).map(s=>String(s.stepIndex));return O(Ve(e[e.length-1].file),`helper-output-${r}-${n}-${o.join("-")}`)}function Dt(e){return Array.from({length:e.flowCount},(t,n)=>O(e.recordingDir,"flows",String(n),"actions.ndjson"))}import{existsSync as ye,mkdirSync as Je,rmSync as Ge,cpSync as qe}from"fs";function Se(e,t){ye(e)&&(ye(t)&&Ge(t,{recursive:!0,force:!0}),Je(t,{recursive:!0}),qe(e,t,{recursive:!0}))}async function Vt(e){let t=new Map;for(let a of e.stepRunRecords)t.set(a.testmdStepIndex,a);let n=e.authoredFlatIdx??new Set,r=[],o=[],s=new Map,l=a=>{if(s.has(a))return s.get(a);let i=x(a,"Result.md"),c=P(i)?D(i):null;return s.set(a,c),c};for(let a of e.resolvedTest.unitFiles){let i=a.file===e.resolvedTest.rootPath,c=Q(a.file,ze(a.file,"utf8")),f=v(a.file),S=P(f)?D(f):null,m=[],w=[],I=[],g=[];if(!i)for(let p of e.resolvedTest.steps){if(p.owningFile!==a.file||p.trace.length<2)continue;let d=J(p.trace);g.includes(d)||g.push(d)}let j=p=>{if(S!==null)return null;for(let d of g){let M=l(d)?.steps[p-1];if(M)return{row:M,dir:d}}return null},T=[],U=!1,G=!1,K=!1,N=!1;for(let p of c.steps){let d=p.index,u=S?.steps[d-1];if(p.body.kind==="objective"){let h=e.resolvedTest.steps.filter(y=>y.owningFile===a.file&&y.trace[y.trace.length-1].stepIndex===d&&t.has(y.flatIndex)),R=h.length>0?h[h.length-1]:null;if(R){U=!0,n.has(R.flatIndex)&&(G=!0);let y=E(R),k;i?k=e.outcomes.find(we=>we.rootStepIndex===d)??{rootStepIndex:d,status:"skipped"}:k={rootStepIndex:d,status:be(R,e.outcomes)},k.status==="failed"&&(K=!0),k.stepMd5==null&&(k.stepMd5=y),m.push(k),w.push({stepIndex:d,md5:y,rec:t.get(R.flatIndex)}),(!u||u.kind!=="objective"||u.status!==k.status||k.status==="passed"&&u.md5!==y)&&(N=!0)}else if(u&&u.kind==="objective")m.push({rootStepIndex:d,status:u.status,...u.md5?{stepMd5:u.md5}:{}}),I.push(d);else if(!i&&j(d)?.row.kind==="objective"){let y=j(d),k=y.row;m.push({rootStepIndex:d,status:k.status,...k.md5?{stepMd5:k.md5}:{}}),T.push({psIdx:d,dir:y.dir})}else i?m.push(e.outcomes.find(y=>y.rootStepIndex===d)??{rootStepIndex:d,status:"skipped"}):m.push({rootStepIndex:d,status:"skipped"});continue}let M=Ze(p.body.path)?p.body.path:tt(Ye(a.file),p.body.path),_=te({path:p.body.path,bindings:p.body.bindings,optional:p.optional??!1}),C=et(X(a.file),v(M)),A=e.resolvedTest.steps.filter(h=>h.trace.some((R,y)=>y<h.trace.length-1&&R.file===a.file&&R.stepIndex===d)&&t.has(h.flatIndex));if(A.length>0){U=!0;let h;if(i)h=e.outcomes.find(R=>R.rootStepIndex===d)??{rootStepIndex:d,status:"passed",refKind:"import",refLabel:p.body.path};else{let R=A.some(y=>be(y,e.outcomes)==="failed");h={rootStepIndex:d,status:R?"failed":"passed",refKind:"import",refLabel:p.body.path,inlinedCount:A.length}}h.status==="failed"&&(K=!0),h.stepMd5==null&&(h.stepMd5=_),h.helperResultRelPath==null&&(h.helperResultRelPath=C),m.push(h),(!u||u.kind!=="import"||u.status!==h.status||u.md5!==_)&&(N=!0)}else if(u&&u.kind==="import")m.push({rootStepIndex:d,status:u.status,refKind:"import",refLabel:u.importPath,...u.md5?{stepMd5:u.md5}:{},...u.helperResultRelPath?{helperResultRelPath:u.helperResultRelPath}:{}});else if(!i&&j(d)?.row.kind==="import"){let h=j(d).row;m.push({rootStepIndex:d,status:h.status,refKind:"import",refLabel:p.body.path})}else i?m.push(e.outcomes.find(h=>h.rootStepIndex===d)??{rootStepIndex:d,status:"skipped",refKind:"import",refLabel:p.body.path}):m.push({rootStepIndex:d,status:"skipped",refKind:"import",refLabel:p.body.path})}if(!(i||U&&(G||K||S===null||N)))continue;r.push(a.file);let b=Y(a.file);Ie(x(b,".internal"),{recursive:!0});for(let p of w){let d=x(b,".internal","steps",`${p.stepIndex}-${p.md5.slice(0,8)}`);Ie(d,{recursive:!0}),await le({sessionDir:e.sessionDir,runIndex:p.rec.runIndex,totalRunDirs:p.rec.totalRunDirs,stagingStepDir:d,packTestDir:e.packTestDir})}if(I.length>0){let p=Z(a.file);if(P(p))for(let d of ke(p)){let u=parseInt(d.split("-")[0]??"",10);!Number.isNaN(u)&&I.includes(u)&&xe(x(p,d),x(b,".internal","steps",d),{recursive:!0})}}for(let p of T){let d=x(p.dir,".internal","steps");if(P(d))for(let u of ke(d))parseInt(u.split("-")[0]??"",10)===p.psIdx&&xe(x(d,u),x(b,".internal","steps",u),{recursive:!0})}let Me=m.some(p=>p.status==="failed");if(oe({sourcePath:a.file,title:c.title,rootSteps:c.steps,outcomes:m,overallStatus:i?e.overallStatus:Me?"failed":"passed",startedISO:e.startedISO,durationS:i?e.durationS:0,sessionId:e.sessionId,outPath:x(b,"Result.md")}),i){let p={};e.commitId&&(p.commit_id=e.commitId),e.tmsIds.testId&&(p.test_id=e.tmsIds.testId),e.tmsIds.testcaseId&&(p.testcase_id=e.tmsIds.testcaseId),e.tmsIds.projectId&&(p.project_id=e.tmsIds.projectId),e.tmsIds.folderId&&(p.folder_id=e.tmsIds.folderId),e.tmsIds.orgId&&(p.org_id=e.tmsIds.orgId),e.tmsIds.sessionName&&(p.session_name=e.tmsIds.sessionName);let d=ge({priorMetaPath:W(a.file),recordFiles:me(b)});d&&(p.media=d);let u=ne(a.file);u&&(p.tc_id=u);let M=se(a.file);M&&(p.environment_id=M),Xe(x(b,".internal","meta.json"),JSON.stringify(p,null,2)+`
4
+ `),r="passed";if(n[0]?.trim()==="---")for(let s=1;s<n.length&&n[s].trim()!=="---";s++){let d=/^status:\s+(passed|failed|interrupted)\s*$/.exec(n[s]);d&&(r=d[1])}let o=[];for(let s=0;s<n.length;s++){let d=Fe.exec(n[s]);if(!d)continue;let a=d[1],i=d[2],c=d[3]??"",f=i.startsWith("\u2713")?"passed":i.startsWith("\u23ED")?"skipped":"failed";if(/via\s+@/.test(c)){let m=Oe.exec(c),w=m?.[1]??"",I=m?.[2]??null;o.push({kind:"import",heading:a,status:f,md5:ie(n,s+1),importPath:w,helperResultRelPath:I})}else o.push({kind:"objective",heading:a,status:f,md5:ie(n,s+1)})}return{overallStatus:r,steps:o}}import{copyFileSync as ae,existsSync as H,mkdirSync as Ae,writeFileSync as de,promises as dt}from"fs";import{join as $,dirname as le,basename as Te}from"path";async function pe(e){for(let t=0;t<e.totalRunDirs;t++){let n=e.runIndex+t,r=$(e.sessionDir,"runs",String(n)),o=$(e.stagingStepDir,"flows",String(t));Ae(o,{recursive:!0});let s=$(o,"actions.ndjson");if(e.packTestDir){let i=$(e.packTestDir,"logs",`${n}-actions.ndjson`);if(H(i)){ae(i,s);continue}let c=le(le(e.packTestDir)),f=Te(e.packTestDir),S=H(c)?await z(c,`tests/${f}/logs/${n}-actions.ndjson`).catch(()=>null):null;de(s,S??"");continue}let d=[$(r,"run-test","actions.ndjson"),$(r,"actions.ndjson")],a=!1;for(let i of d)if(H(i)){ae(i,s),a=!0;break}a||de(s,"")}}import{existsSync as ce,readFileSync as fe,readdirSync as Ne}from"fs";import{join as F}from"path";function Ee(e){if(e.action_type!=="upload_files")return null;let t=e.action_params?.media;if(!t||typeof t!="object")return null;let n=a=>typeof t[a]=="string"?t[a]:"",r=n("media_id"),o=n("name"),s=n("media_url");if(!r||!o||!s)return null;let d=n("type")||"doc";return{media_id:r,name:o,media_url:s,type:d,alias:n("alias")}}function Le(e){let t=e.action_params?.file_paths,n=Array.isArray(t)?t[0]:t;return typeof n=="string"&&n.length>0?n:null}function Ue(e){let t={};for(let[n,r]of Object.entries(e??{}))t[n]={...r,refs:[...r.refs??[]]};return t}function Ke(e,t){if(!t)return!1;let n=t.endsWith("/")?t:t+"/";return e.startsWith(n)}function ue(e,t,n,r={}){let o=Ue(e);for(let s of t){let d=Ee(s);if(!d)continue;let a=o[d.media_id]??={name:d.name,media_url:d.media_url,type:d.type,refs:[],recorded_at:n,...d.alias?{alias:d.alias}:{}};a.recorded_at=n;let i=Le(s);if(!(!i||Ke(i,r.ignoreAliasUnder))){for(let[c,f]of Object.entries(o))c!==d.media_id&&(f.refs=f.refs.filter(S=>S!==i));a.refs.includes(i)||a.refs.push(i)}}return o}function ct(e){let t=e?.media;if(!t||typeof t!="object")return[];let n=[];for(let[r,o]of Object.entries(t)){if(!r||!o||typeof o!="object")continue;let s=o;typeof s.name!="string"||!s.name||typeof s.media_url!="string"||!s.media_url||n.push({media_id:r,name:s.name,media_url:s.media_url,type:typeof s.type=="string"&&s.type?s.type:"doc",refs:Array.isArray(s.refs)?s.refs.filter(d=>typeof d=="string"&&d.length>0):[],...typeof s.alias=="string"&&s.alias?{alias:s.alias}:{}})}return n}function Ce(e){let t=[];for(let n of e){let r;try{r=fe(n,"utf8")}catch{continue}for(let o of r.split(`
5
+ `)){let s=o.trim();if(s)try{let d=JSON.parse(s);d&&typeof d=="object"&&t.push(d)}catch{}}}return t}function V(e){try{return Ne(e,{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name).sort((t,n)=>t.localeCompare(n,void 0,{numeric:!0}))}catch{return[]}}function St(e){if(!e)return[];let t=[];for(let n of V(F(e,"runs")))for(let r of[F(e,"runs",n,"run-test","actions.ndjson"),F(e,"runs",n,"actions.ndjson")])if(ce(r)){t.push(r);break}return t}function me(e){let t=[],n=F(e,".internal","steps");for(let r of V(n)){let o=F(n,r,"flows");for(let s of V(o)){let d=F(o,s,"actions.ndjson");ce(d)&&t.push(d)}}return t}function We(e){try{let n=JSON.parse(fe(e,"utf8"))?.media;return n&&typeof n=="object"?n:void 0}catch{return}}function ge(e){let t=We(e.priorMetaPath),n=Ce(e.recordFiles),r=ue(t,n,e.now??new Date().toISOString(),{ignoreAliasUnder:e.ignoreAliasUnder??q});return Object.keys(r).length>0?r:void 0}import{existsSync as L,readdirSync as He}from"fs";import{dirname as Ve,join as O,basename as B}from"path";function wt(e,t){let n=[];return e.steps.forEach((r,o)=>{let s=t[o];r.block||!r.replayOnly||!s||s.kind!=="author"||n.push({flatIndex:r.flatIndex,file:r.owningFile,heading:r.trace[r.trace.length-1].heading,kind:r.replayOnly,reason:s.reason})}),n}function vt(e){let t=[],n=new Set,r=new Map;function o(i){if(r.has(i))return r.get(i);let c=v(i),f=L(c)?D(c):null;return r.set(i,f),f}let s=new Map;function d(i){if(s.has(i))return s.get(i);let c=O(i,"Result.md"),f=L(c)?D(c):null;return s.set(i,f),f}function a(i){for(let c=1;c<i.trace.length;c++){let f=i.trace[c-1],S=o(f.file);if(!S)continue;let m=S.steps[f.stepIndex-1];if(m){if(m.kind!=="import")return{kind:"author",reason:"structure-mismatch"};if(B(m.importPath)!==B(i.trace[c].file))return{kind:"author",reason:"structure-mismatch"};if(m.md5!=null&&m.md5!==f.rowMd5)return{kind:"author",reason:"structure-mismatch"}}}return null}for(let i of e.steps){let c=i.trace[i.trace.length-1].stepIndex,f=i.replayOnly;if(i.block){let g=o(i.owningFile)?.steps[c-1],j=i.controlFlow!==void 0,T=g?.kind==="objective"&&g.status==="skipped";if(j||T){t.push({kind:"replay",recordingDir:"",flowCount:0,unrecorded:!0,...f?{replayOnly:f}:{}});continue}}let S=n.has(i.owningFile);for(let g=0;g<i.trace.length-1&&!S;g++)n.has(i.trace[g].file)&&(S=!0);if(S&&!f){t.push({kind:"author",reason:o(i.owningFile)===null?"no-result-md":"downstream-of-divergence"});continue}let m=a(i);if(m){for(let g=0;g<i.trace.length;g++)n.add(i.trace[g].file);if(!f){t.push(m);continue}}let w=o(i.owningFile),I;if(w===null&&i.trace.length>1){let g=J(i.trace);I=he(i,d(g),c,g)}else I=he(i,w,c);if(f&&I.kind==="replay"&&(I={...I,replayOnly:f}),t.push(I),I.kind==="author"){n.add(i.owningFile);for(let g=0;g<i.trace.length-1;g++)n.add(i.trace[g].file)}}return t}function he(e,t,n,r=null){if(!t)return{kind:"author",reason:"no-result-md"};let o=t.steps[n-1];if(!o)return{kind:"author",reason:"no-result-md"};if(o.kind!=="objective")return{kind:"author",reason:"structure-mismatch"};if(o.status!=="passed")return{kind:"author",reason:"recorded-failed"};let s=E(e);if(s!==o.md5)return{kind:"author",reason:"md5-mismatch"};let d=r===null?ee(e.owningFile,n,s.slice(0,8)):O(r,".internal","steps",`${n}-${s.slice(0,8)}`),a=Be(d);return a===0?{kind:"author",reason:"missing-recording"}:{kind:"replay",recordingDir:d,flowCount:a}}function Be(e){let t=O(e,"flows");if(!L(t))return 0;let n;try{n=He(t,{withFileTypes:!0}).filter(o=>o.isDirectory()&&/^\d+$/.test(o.name)).map(o=>parseInt(o.name,10))}catch{return 0}if(n.length===0)return 0;let r=Math.max(...n);for(let o=0;o<=r;o++)if(!L(O(t,String(o),"actions.ndjson")))return 0;return r+1}function Pt(e){return e.some(t=>t.kind==="author")}function jt(e){for(let t=0;t<e.length;t++)if(e[t].kind==="author")return t;return e.length}function J(e){let t=s=>{let d=B(s);return d.endsWith("_test.md")?d.slice(0,-8):d.endsWith(".md")?d.slice(0,-3):d},n=t(e[0].file),r=t(e[e.length-1].file),o=e.slice(0,-1).map(s=>String(s.stepIndex));return O(Ve(e[e.length-1].file),`helper-output-${r}-${n}-${o.join("-")}`)}function Dt(e){return Array.from({length:e.flowCount},(t,n)=>O(e.recordingDir,"flows",String(n),"actions.ndjson"))}import{existsSync as ye,mkdirSync as Je,rmSync as Ge,cpSync as qe}from"fs";function Se(e,t){ye(e)&&(ye(t)&&Ge(t,{recursive:!0,force:!0}),Je(t,{recursive:!0}),qe(e,t,{recursive:!0}))}async function Vt(e){let t=new Map;for(let a of e.stepRunRecords)t.set(a.testmdStepIndex,a);let n=e.authoredFlatIdx??new Set,r=[],o=[],s=new Map,d=a=>{if(s.has(a))return s.get(a);let i=x(a,"Result.md"),c=P(i)?D(i):null;return s.set(a,c),c};for(let a of e.resolvedTest.unitFiles){let i=a.file===e.resolvedTest.rootPath,c=Q(a.file,ze(a.file,"utf8")),f=v(a.file),S=P(f)?D(f):null,m=[],w=[],I=[],g=[];if(!i)for(let p of e.resolvedTest.steps){if(p.owningFile!==a.file||p.trace.length<2)continue;let l=J(p.trace);g.includes(l)||g.push(l)}let j=p=>{if(S!==null)return null;for(let l of g){let M=d(l)?.steps[p-1];if(M)return{row:M,dir:l}}return null},T=[],U=!1,G=!1,K=!1,N=!1;for(let p of c.steps){let l=p.index,u=S?.steps[l-1];if(p.body.kind==="objective"){let h=e.resolvedTest.steps.filter(y=>y.owningFile===a.file&&y.trace[y.trace.length-1].stepIndex===l&&t.has(y.flatIndex)),R=h.length>0?h[h.length-1]:null;if(R){U=!0,n.has(R.flatIndex)&&(G=!0);let y=E(R),k;i?k=e.outcomes.find(we=>we.rootStepIndex===l)??{rootStepIndex:l,status:"skipped"}:k={rootStepIndex:l,status:be(R,e.outcomes)},k.status==="failed"&&(K=!0),k.stepMd5==null&&(k.stepMd5=y),m.push(k),w.push({stepIndex:l,md5:y,rec:t.get(R.flatIndex)}),(!u||u.kind!=="objective"||u.status!==k.status||k.status==="passed"&&u.md5!==y)&&(N=!0)}else if(u&&u.kind==="objective")m.push({rootStepIndex:l,status:u.status,...u.md5?{stepMd5:u.md5}:{}}),I.push(l);else if(!i&&j(l)?.row.kind==="objective"){let y=j(l),k=y.row;m.push({rootStepIndex:l,status:k.status,...k.md5?{stepMd5:k.md5}:{}}),T.push({psIdx:l,dir:y.dir})}else i?m.push(e.outcomes.find(y=>y.rootStepIndex===l)??{rootStepIndex:l,status:"skipped"}):m.push({rootStepIndex:l,status:"skipped"});continue}let M=Ze(p.body.path)?p.body.path:tt(Ye(a.file),p.body.path),_=te({path:p.body.path,bindings:p.body.bindings,optional:p.optional??!1}),C=et(X(a.file),v(M)),A=e.resolvedTest.steps.filter(h=>h.trace.some((R,y)=>y<h.trace.length-1&&R.file===a.file&&R.stepIndex===l)&&t.has(h.flatIndex));if(A.length>0){U=!0;let h;if(i)h=e.outcomes.find(R=>R.rootStepIndex===l)??{rootStepIndex:l,status:"passed",refKind:"import",refLabel:p.body.path};else{let R=A.some(y=>be(y,e.outcomes)==="failed");h={rootStepIndex:l,status:R?"failed":"passed",refKind:"import",refLabel:p.body.path,inlinedCount:A.length}}h.status==="failed"&&(K=!0),h.stepMd5==null&&(h.stepMd5=_),h.helperResultRelPath==null&&(h.helperResultRelPath=C),m.push(h),(!u||u.kind!=="import"||u.status!==h.status||u.md5!==_)&&(N=!0)}else if(u&&u.kind==="import")m.push({rootStepIndex:l,status:u.status,refKind:"import",refLabel:u.importPath,...u.md5?{stepMd5:u.md5}:{},...u.helperResultRelPath?{helperResultRelPath:u.helperResultRelPath}:{}});else if(!i&&j(l)?.row.kind==="import"){let h=j(l).row;m.push({rootStepIndex:l,status:h.status,refKind:"import",refLabel:p.body.path})}else i?m.push(e.outcomes.find(h=>h.rootStepIndex===l)??{rootStepIndex:l,status:"skipped",refKind:"import",refLabel:p.body.path}):m.push({rootStepIndex:l,status:"skipped",refKind:"import",refLabel:p.body.path})}if(!(i||U&&(G||K||S===null||N)))continue;r.push(a.file);let b=Y(a.file);Ie(x(b,".internal"),{recursive:!0});for(let p of w){let l=x(b,".internal","steps",`${p.stepIndex}-${p.md5.slice(0,8)}`);Ie(l,{recursive:!0}),await pe({sessionDir:e.sessionDir,runIndex:p.rec.runIndex,totalRunDirs:p.rec.totalRunDirs,stagingStepDir:l,packTestDir:e.packTestDir})}if(I.length>0){let p=Z(a.file);if(P(p))for(let l of ke(p)){let u=parseInt(l.split("-")[0]??"",10);!Number.isNaN(u)&&I.includes(u)&&xe(x(p,l),x(b,".internal","steps",l),{recursive:!0})}}for(let p of T){let l=x(p.dir,".internal","steps");if(P(l))for(let u of ke(l))parseInt(u.split("-")[0]??"",10)===p.psIdx&&xe(x(l,u),x(b,".internal","steps",u),{recursive:!0})}let Me=m.some(p=>p.status==="failed");if(oe({sourcePath:a.file,title:c.title,rootSteps:c.steps,outcomes:m,overallStatus:i?e.overallStatus:Me?"failed":"passed",startedISO:e.startedISO,durationS:i?e.durationS:0,sessionId:e.sessionId,outPath:x(b,"Result.md")}),i){let p={};e.commitId&&(p.commit_id=e.commitId),e.tmsIds.testId&&(p.test_id=e.tmsIds.testId),e.tmsIds.testcaseId&&(p.testcase_id=e.tmsIds.testcaseId),e.tmsIds.projectId&&(p.project_id=e.tmsIds.projectId),e.tmsIds.folderId&&(p.folder_id=e.tmsIds.folderId),e.tmsIds.orgId&&(p.org_id=e.tmsIds.orgId),e.tmsIds.sessionName&&(p.session_name=e.tmsIds.sessionName);let l=ge({priorMetaPath:W(a.file),recordFiles:me(b)});l&&(p.media=l);let u=ne(a.file);u&&(p.tc_id=u);let M=se(a.file);M&&(p.environment_id=M),Xe(x(b,".internal","meta.json"),JSON.stringify(p,null,2)+`
6
6
  `,"utf8");let _=x(e.sessionDir,"execution.json");if(P(_))try{Re(_,x(b,".internal","execution.json"))}catch{}if(e.codeExportDir){let C=e.codeExportLanguage??"python",A=e.codeExportFramework??"playwright",h=x(b,`${A}-${C}-code`);try{Se(e.codeExportDir,h)}catch(R){process.stderr.write(`warn: codegen copy failed: ${R.message}
7
- `)}}}else if(a.kind==="test"||a.kind==="module"){let p=W(a.file);if(P(p))try{Re(p,x(b,".internal","meta.json"))}catch{}}!i&&g.length>0&&m.every(d=>d.status!=="skipped")&&o.push({unitFile:a.file,dirs:g.filter(d=>P(d))})}return{changedUnitFiles:r,legacySweep:o}}function Bt(e){for(let t of e)try{Qe(t,{recursive:!0,force:!0})}catch{}}function be(e,t){let n=e.trace[0].stepIndex,r=t.find(a=>a.rootStepIndex===n);if(!r)return"skipped";if(r.status==="passed")return"passed";if(r.status==="skipped")return"skipped";let o=e.trace.slice(1).map(a=>a.stepIndex),s=r.failedSubStepIndex??[],l=Math.min(o.length,s.length);for(let a=0;a<l;a++)if(o[a]!==s[a])return o[a]<s[a]?"passed":"skipped";return o.length===s.length?"failed":o.length<s.length?"passed":"skipped"}export{oe as a,wt as b,vt as c,Pt as d,jt as e,Dt as f,ct as g,St as h,ge as i,Se as j,Vt as k,Bt as l};
7
+ `)}}}else if(a.kind==="test"||a.kind==="module"){let p=W(a.file);if(P(p))try{Re(p,x(b,".internal","meta.json"))}catch{}}!i&&g.length>0&&m.every(l=>l.status!=="skipped")&&o.push({unitFile:a.file,dirs:g.filter(l=>P(l))})}return{changedUnitFiles:r,legacySweep:o}}function Bt(e){for(let t of e)try{Qe(t,{recursive:!0,force:!0})}catch{}}function be(e,t){let n=e.trace[0].stepIndex,r=t.find(a=>a.rootStepIndex===n);if(!r)return"skipped";if(r.status==="passed")return"passed";if(r.status==="skipped")return"skipped";let o=e.trace.slice(1).map(a=>a.stepIndex),s=r.failedSubStepIndex??[],d=Math.min(o.length,s.length);for(let a=0;a<d;a++)if(o[a]!==s[a])return o[a]<s[a]?"passed":"skipped";return o.length===s.length?"failed":o.length<s.length?"passed":"skipped"}export{oe as a,wt as b,vt as c,Pt as d,jt as e,Dt as f,ct as g,St as h,ge as i,Se as j,Vt as k,Bt as l};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as h}from"./chunk-CE23VDW5.js";import{a as f}from"./chunk-HKIBJDKE.js";import{a as m}from"./chunk-MHMEEA4S.js";var i=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function S(c){let{creds:o,env:a,usernameFlag:l,accessKeyFlag:g,log:t}=c,e=null,u=null;if(l&&g)e={username:l,access_key:g},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=o.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=o.getActiveCredentials();if(!r)throw new i("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await f({creds:o,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let d=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:d}),new i(`Token refresh failed: ${d}`,"refresh_failed")}}let v=m(a),b=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,p=new h(v.controllerBaseUrl,b,y,t),s=await p.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:p,resolvedCreds:s}}export{i as a,S as b};
2
+ import{a as h}from"./chunk-4BZOG6PE.js";import{a as f}from"./chunk-F7NSSQYZ.js";import{a as m}from"./chunk-NMSZ7G6P.js";var i=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function S(c){let{creds:o,env:a,usernameFlag:l,accessKeyFlag:g,log:t}=c,e=null,u=null;if(l&&g)e={username:l,access_key:g},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=o.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=o.getActiveCredentials();if(!r)throw new i("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await f({creds:o,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let d=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:d}),new i(`Token refresh failed: ${d}`,"refresh_failed")}}let v=m(a),b=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,p=new h(v.controllerBaseUrl,b,y,t),s=await p.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:p,resolvedCreds:s}}export{i as a,S as b};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as w}from"./chunk-ZLWURCJ7.js";import{a as O}from"./chunk-QSCXXNC2.js";import{a as I}from"./chunk-KBM3XHAM.js";import{f as L}from"./chunk-5LJRZI7S.js";import{a as N,b as k}from"./chunk-BKM2LWU2.js";import{a as R,b as y,c as T,d as m,e as A,g as b,h as r}from"./chunk-RSSOJ3L2.js";import{b as x}from"./chunk-5EOX4MEY.js";import{a as E}from"./chunk-RZ4F3BHX.js";import{a as g,i as v}from"./chunk-SJZJ7ASF.js";import{platform as X,arch as Y}from"os";import P from"fs";import M from"fs";import D from"path";var V=1e3,d=0,j=new Set([130,3]),a=class t{ids;logger;opts;ended=!1;createdAt=Date.now();errorState;constructor(e,n={emitted:!1}){this.ids=e.envelope,this.logger=e.logger,this.opts=e,this.errorState=n}get enabled(){return this.logger!==null}event(e,n={}){if(!this.logger)return;e==="ASR_ERROR"&&(this.errorState.emitted=!0);let i=m(this.ids,e,n);this.logger.log(R[e],e,e,C(i))}error(e,n={}){this.logger&&(this.logger.escalate(d),this.event("ASR_ERROR",{...n,error_code:e}))}child(e,n){return new t({...this.opts,envelope:{...this.ids,operation_id:n,parent_operation_id:this.ids.operation_id,verb:"design"}},this.errorState)}async lateBindContext(e){if(!(!this.logger||this.ids.context_instance_id))try{let{ensureStoreIds:n}=await import("./store-id-EOSGEKVK.js"),{ids:i,cloned:s}=n(e);this.ids.context_lineage_id=i.context_lineage_id,this.ids.context_instance_id=i.context_instance_id,s&&this.event("ASR_CONTEXT_CLONED")}catch{}}agentSession(e){this.ids.agent_session_id=e}spawnEnv(){if(!this.opts.telemetryEnabled)return{};let e={TESTMUAI_USER_SESSION_ID:this.ids.session_id,TESTMUAI_OPERATION_ID:this.ids.operation_id,TESTMUAI_CLIENT_VERSION:this.opts.clientVersion,TESTMUAI_TELEMETRY_PROXY_URL:this.opts.proxyUrl};return this.ids.context_instance_id&&(e.TESTMUAI_CONTEXT_INSTANCE_ID=this.ids.context_instance_id),e}traceTee(){return e=>{if(!this.logger)return;let n=typeof e.kind=="string"?e.kind.slice(0,64):"trace",i={...C(m(this.ids,"ASR_CMD_START",{})),trace_kind:n};typeof e.code=="string"&&(i.trace_code=e.code.slice(0,64)),delete i.event,this.logger.logStep(d,`trace_${n}`,n,i)}}wireTrace(e,n,i){if(!this.logger)return;i&&this.agentSession(i);let s=n&&typeof n=="object"?n:{};switch(e){case"spawn":this.event("ASR_AGENT_SPAWN",{tier:s.tier});break;case"session_paused":this.event("ASR_SESSION_PAUSED",s);break;case"commit":this.event("ASR_COMMIT",s);break;default:this.traceTee()({kind:e,code:typeof s.code=="string"?s.code:void 0})}}banner(){return`session: ${this.ids.session_id}`}supportFooter(){return`if this keeps failing, share this id with support: ${this.ids.session_id}`}async end(e){if(!this.ended){if(this.ended=!0,e.duration_ms===void 0&&(e={...e,duration_ms:Date.now()-this.createdAt}),this.logger)if(e.exit_code===0?this.logger.discardSteps(d):this.logger.escalate(d),e.exit_code>0&&!j.has(e.exit_code)&&!this.errorState.emitted&&this.event("ASR_ERROR",{error_code:e.exit_code===2?"usage_exit_unattributed":`exit_${e.exit_code}_unattributed`,exit_code:e.exit_code}),this.event("ASR_CMD_END",e),this.opts.longSession)await this.logger.shutdown();else{let n=await this.logger.flushOnce(V);(n==="failed"||n==="timeout")&&A(this.logger.drainBuffer())}this.logger&&this.writeManifestLine(e.exit_code),r(null)}}writeManifestLine(e){try{let n=x(this.ids.context_instance_id??null);M.mkdirSync(D.dirname(n),{recursive:!0});let i={ts:new Date().toISOString(),session_id:this.ids.session_id,operation_id:this.ids.operation_id,agent_session_id:this.ids.agent_session_id,verb:this.ids.verb,mode:this.ids.mode,exit_code:e};M.appendFileSync(n,JSON.stringify(i)+`
2
+ import{a as w}from"./chunk-ZLWURCJ7.js";import{a as O}from"./chunk-QSCXXNC2.js";import{a as I}from"./chunk-KBM3XHAM.js";import{f as L}from"./chunk-5LJRZI7S.js";import{a as N,b as k}from"./chunk-BKM2LWU2.js";import{a as R,b as y,c as T,d as m,e as A,g as b,h as r}from"./chunk-RSSOJ3L2.js";import{b as x}from"./chunk-5EOX4MEY.js";import{a as E}from"./chunk-RZ4F3BHX.js";import{a as g,i as v}from"./chunk-5TQFOPJV.js";import{platform as X,arch as Y}from"os";import P from"fs";import M from"fs";import D from"path";var V=1e3,d=0,j=new Set([130,3]),a=class t{ids;logger;opts;ended=!1;createdAt=Date.now();errorState;constructor(e,n={emitted:!1}){this.ids=e.envelope,this.logger=e.logger,this.opts=e,this.errorState=n}get enabled(){return this.logger!==null}event(e,n={}){if(!this.logger)return;e==="ASR_ERROR"&&(this.errorState.emitted=!0);let i=m(this.ids,e,n);this.logger.log(R[e],e,e,C(i))}error(e,n={}){this.logger&&(this.logger.escalate(d),this.event("ASR_ERROR",{...n,error_code:e}))}child(e,n){return new t({...this.opts,envelope:{...this.ids,operation_id:n,parent_operation_id:this.ids.operation_id,verb:"design"}},this.errorState)}async lateBindContext(e){if(!(!this.logger||this.ids.context_instance_id))try{let{ensureStoreIds:n}=await import("./store-id-EOSGEKVK.js"),{ids:i,cloned:s}=n(e);this.ids.context_lineage_id=i.context_lineage_id,this.ids.context_instance_id=i.context_instance_id,s&&this.event("ASR_CONTEXT_CLONED")}catch{}}agentSession(e){this.ids.agent_session_id=e}spawnEnv(){if(!this.opts.telemetryEnabled)return{};let e={TESTMUAI_USER_SESSION_ID:this.ids.session_id,TESTMUAI_OPERATION_ID:this.ids.operation_id,TESTMUAI_CLIENT_VERSION:this.opts.clientVersion,TESTMUAI_TELEMETRY_PROXY_URL:this.opts.proxyUrl};return this.ids.context_instance_id&&(e.TESTMUAI_CONTEXT_INSTANCE_ID=this.ids.context_instance_id),e}traceTee(){return e=>{if(!this.logger)return;let n=typeof e.kind=="string"?e.kind.slice(0,64):"trace",i={...C(m(this.ids,"ASR_CMD_START",{})),trace_kind:n};typeof e.code=="string"&&(i.trace_code=e.code.slice(0,64)),delete i.event,this.logger.logStep(d,`trace_${n}`,n,i)}}wireTrace(e,n,i){if(!this.logger)return;i&&this.agentSession(i);let s=n&&typeof n=="object"?n:{};switch(e){case"spawn":this.event("ASR_AGENT_SPAWN",{tier:s.tier});break;case"session_paused":this.event("ASR_SESSION_PAUSED",s);break;case"commit":this.event("ASR_COMMIT",s);break;default:this.traceTee()({kind:e,code:typeof s.code=="string"?s.code:void 0})}}banner(){return`session: ${this.ids.session_id}`}supportFooter(){return`if this keeps failing, share this id with support: ${this.ids.session_id}`}async end(e){if(!this.ended){if(this.ended=!0,e.duration_ms===void 0&&(e={...e,duration_ms:Date.now()-this.createdAt}),this.logger)if(e.exit_code===0?this.logger.discardSteps(d):this.logger.escalate(d),e.exit_code>0&&!j.has(e.exit_code)&&!this.errorState.emitted&&this.event("ASR_ERROR",{error_code:e.exit_code===2?"usage_exit_unattributed":`exit_${e.exit_code}_unattributed`,exit_code:e.exit_code}),this.event("ASR_CMD_END",e),this.opts.longSession)await this.logger.shutdown();else{let n=await this.logger.flushOnce(V);(n==="failed"||n==="timeout")&&A(this.logger.drainBuffer())}this.logger&&this.writeManifestLine(e.exit_code),r(null)}}writeManifestLine(e){try{let n=x(this.ids.context_instance_id??null);M.mkdirSync(D.dirname(n),{recursive:!0});let i={ts:new Date().toISOString(),session_id:this.ids.session_id,operation_id:this.ids.operation_id,agent_session_id:this.ids.agent_session_id,verb:this.ids.verb,mode:this.ids.mode,exit_code:e};M.appendFileSync(n,JSON.stringify(i)+`
3
3
  `,{flag:"a",mode:384})}catch{}}};function C(t){let e={event:t.event,session_id:t.session_id,operation_id:t.operation_id,verb:t.verb,mode:t.mode,component:t.component,seq:t.seq,context_lineage_id:t.context_lineage_id,context_instance_id:t.context_instance_id};t.parent_operation_id&&(e.parent_operation_id=t.parent_operation_id),t.agent_session_id&&(e.agent_session_id=t.agent_session_id);for(let[n,i]of Object.entries(t.context))e[n]=i;return e}var u=process.env.KANE_TELEMETRY_URL||v;function B(){return process.env.TESTMUAI_BASE_URL?"custom":process.env.TESTMUAI_ENV==="stage"?"stage":"prod"}function _e(t){let e=process.env.KANE_TELEMETRY!=="0"&&(!process.env.VITEST||process.env.KANE_TELEMETRY==="1"),n=t.env??B(),i=null;if(t.resumeSid&&t.contextRoot)try{let o=L(t.contextRoot,t.resumeSid);o?.user_session_id&&(i=o.user_session_id)}catch{}if(!i&&t.applyPlanPath)try{let o=JSON.parse(P.readFileSync(t.applyPlanPath,"utf8"));o.telemetry?.user_session_id&&(i=o.telemetry.user_session_id)}catch{}let s=i!==null;i||(i=y());let l=null,c=null,f=!1;if(t.contextRoot&&P.existsSync(t.contextRoot))if(t.write&&e){let o=k(t.contextRoot);l=o.ids.context_lineage_id,c=o.ids.context_instance_id,f=o.cloned}else{let o=N(t.contextRoot);l=o?.context_lineage_id??null,c=o?.context_instance_id??null}let h={session_id:i,operation_id:T(),context_lineage_id:l,context_instance_id:c,verb:t.verb,mode:t.mode,component:"kane-cli"},_=null;if(e){let o=I(n),S={org_id:o.org_id??"",user_id:o.user_id??"",machine_id:o.machine_id,email:null,email_domain:"",user_type:o.user_type??"unknown",env:o.env,plan:o.plan??"unknown"},U=t.mode==="interactive"||t.mode==="cli"?"cli":"agent";_=new w({proxyUrl:u,sessionId:i,identity:S,device:{cli_version:g,platform:X(),arch:Y(),host_agent:O(),invocation_mode:U},getToken:async()=>null}),t.longSession&&_.start()}let p=new a({envelope:h,logger:_,longSession:!!t.longSession,proxyUrl:u,clientVersion:`kane-cli/${g}`,telemetryEnabled:e});return e&&(r(h),p.event("ASR_CMD_START",{resumed:s,applied_plan:!!t.applyPlanPath}),f&&p.event("ASR_CONTEXT_CLONED"),b(async o=>{try{return(await E(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})).ok}catch{return!1}}).catch(()=>{})),p}export{B as a,_e as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-DHJSM5DT.js";import{a as c}from"./chunk-NLCCBXXV.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-ADZ4PAJF.js"),import("./bootstrap-DBAQWVNA.js")]);await s(n(),r)}catch{}return this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(t){return this._lastError=t instanceof Error?t:new Error(String(t)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,t={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...t,headers:{...t.headers,Authorization:c(i.username,i.access_key)}}),n=await a(e,s(r));if(n.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return a(e,s(i))}return n}};function _(o){if(!o)return"network";let e=/failed:\s*(\d{3})\b/.exec(o.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{h as a,_ as b};
2
+ import{a as l}from"./chunk-DHJSM5DT.js";import{a as c}from"./chunk-NLCCBXXV.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-ADZ4PAJF.js"),import("./bootstrap-DI4UGMH3.js")]);await s(n(),r)}catch{}return this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(t){return this._lastError=t instanceof Error?t:new Error(String(t)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,t={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...t,headers:{...t.headers,Authorization:c(i.username,i.access_key)}}),n=await a(e,s(r));if(n.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return a(e,s(i))}return n}};function _(o){if(!o)return"network";let e=/failed:\s*(\d{3})\b/.exec(o.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{h as a,_ as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as y}from"./chunk-MHMEEA4S.js";import{createServer as b}from"http";import{createReadStream as C,promises as S}from"fs";import{randomBytes as R}from"crypto";var u="127.0.0.1";function A(n,e){if(!n)return null;let o=/^bytes=(\d*)-(\d*)$/.exec(n.trim());if(!o)return null;let[,a,r]=o;if(a===""&&r==="")return null;if(a===""){let i=Number(r);return i===0||e===0?"unsatisfiable":{start:Math.max(0,e-i),end:e-1}}let t=Number(a);if(t>=e)return"unsatisfiable";let c=r===""?e-1:Math.min(Number(r),e-1);return c<t?null:{start:t,end:c}}async function I(n){let e=R(16).toString("hex"),o=b((r,t)=>{H(r,t,n,e).catch(()=>t.destroy())});await new Promise((r,t)=>{o.once("error",t),o.listen(n.port??0,u,()=>{o.removeListener("error",t),r()})});let a=o.address().port;return{port:a,urlFor:r=>`http://${u}:${a}/${e}/${encodeURIComponent(r)}`,close:()=>new Promise(r=>{o.close(()=>r()),o.closeAllConnections()})}}async function H(n,e,o,a){let r=n.url??"/",t=s=>{try{o.log?.("warn","EVIDENCE_SERVE_DENIED",{reason:s,path:r})}catch{}};if(n.headers.host!==`${u}:${n.socket.localPort}`){t("host_mismatch"),e.writeHead(403).end();return}let c=n.headers.origin;if(c!==void 0&&!o.allowedOrigins.includes(c)){t("origin_denied"),e.writeHead(403).end();return}let i=c?{"Access-Control-Allow-Origin":c,Vary:"Origin","Access-Control-Expose-Headers":"Content-Range, Content-Length"}:{};if(n.method==="OPTIONS"){let s={...i,"Access-Control-Allow-Methods":"GET, HEAD, OPTIONS","Access-Control-Allow-Headers":"range","Access-Control-Max-Age":"86400"};n.headers["access-control-request-private-network"]==="true"&&(s["Access-Control-Allow-Private-Network"]="true"),e.writeHead(204,s).end();return}if(n.method!=="GET"&&n.method!=="HEAD"){e.writeHead(405,i).end();return}let v;try{let s=new URL(n.url??"/",`http://${u}`).pathname.split("/");if(s.length!==3||s[1]!==a){t("bad_token"),e.writeHead(404,i).end();return}v=decodeURIComponent(s[2])}catch{t("not_found"),e.writeHead(404,i).end();return}let g=o.packs.get(v);if(!g){t("not_found"),e.writeHead(404,i).end();return}let d;try{let s=await S.stat(g);if(!s.isFile())throw new Error("not a file");d=s.size}catch{t("not_found"),e.writeHead(404,i).end();return}let h={...i,"Accept-Ranges":"bytes","Content-Type":"application/zip","Cache-Control":"no-store"};if(n.method==="HEAD"){e.writeHead(200,{...h,"Content-Length":String(d)}).end();return}let l=A(n.headers.range,d);if(l==="unsatisfiable"){t("unsatisfiable"),e.writeHead(416,{...i,"Content-Range":`bytes */${d}`}).end();return}let[m,p,w]=l===null?[0,d-1,200]:[l.start,l.end,206],E={...h,"Content-Length":String(p-m+1)};if(w===206&&(E["Content-Range"]=`bytes ${m}-${p}/${d}`),e.writeHead(w,E),d===0){e.end();return}let f=C(g,{start:m,end:p});f.on("error",()=>e.destroy()),e.on("close",()=>f.destroy()),f.pipe(e)}function O(n,e){return(e??y(n).evidenceViewerUrl).replace(/\/+$/,"")}function k(n,e){return`${e}/?pack=${encodeURIComponent(n)}`}function P(n){return`evidence: view locally with \`kane-cli evidence serve ${n}\``}export{A as a,I as b,O as c,k as d,P as e};
2
+ import{a as y}from"./chunk-NMSZ7G6P.js";import{createServer as b}from"http";import{createReadStream as C,promises as S}from"fs";import{randomBytes as R}from"crypto";var u="127.0.0.1";function A(n,e){if(!n)return null;let o=/^bytes=(\d*)-(\d*)$/.exec(n.trim());if(!o)return null;let[,a,r]=o;if(a===""&&r==="")return null;if(a===""){let i=Number(r);return i===0||e===0?"unsatisfiable":{start:Math.max(0,e-i),end:e-1}}let t=Number(a);if(t>=e)return"unsatisfiable";let c=r===""?e-1:Math.min(Number(r),e-1);return c<t?null:{start:t,end:c}}async function I(n){let e=R(16).toString("hex"),o=b((r,t)=>{H(r,t,n,e).catch(()=>t.destroy())});await new Promise((r,t)=>{o.once("error",t),o.listen(n.port??0,u,()=>{o.removeListener("error",t),r()})});let a=o.address().port;return{port:a,urlFor:r=>`http://${u}:${a}/${e}/${encodeURIComponent(r)}`,close:()=>new Promise(r=>{o.close(()=>r()),o.closeAllConnections()})}}async function H(n,e,o,a){let r=n.url??"/",t=s=>{try{o.log?.("warn","EVIDENCE_SERVE_DENIED",{reason:s,path:r})}catch{}};if(n.headers.host!==`${u}:${n.socket.localPort}`){t("host_mismatch"),e.writeHead(403).end();return}let c=n.headers.origin;if(c!==void 0&&!o.allowedOrigins.includes(c)){t("origin_denied"),e.writeHead(403).end();return}let i=c?{"Access-Control-Allow-Origin":c,Vary:"Origin","Access-Control-Expose-Headers":"Content-Range, Content-Length"}:{};if(n.method==="OPTIONS"){let s={...i,"Access-Control-Allow-Methods":"GET, HEAD, OPTIONS","Access-Control-Allow-Headers":"range","Access-Control-Max-Age":"86400"};n.headers["access-control-request-private-network"]==="true"&&(s["Access-Control-Allow-Private-Network"]="true"),e.writeHead(204,s).end();return}if(n.method!=="GET"&&n.method!=="HEAD"){e.writeHead(405,i).end();return}let v;try{let s=new URL(n.url??"/",`http://${u}`).pathname.split("/");if(s.length!==3||s[1]!==a){t("bad_token"),e.writeHead(404,i).end();return}v=decodeURIComponent(s[2])}catch{t("not_found"),e.writeHead(404,i).end();return}let g=o.packs.get(v);if(!g){t("not_found"),e.writeHead(404,i).end();return}let d;try{let s=await S.stat(g);if(!s.isFile())throw new Error("not a file");d=s.size}catch{t("not_found"),e.writeHead(404,i).end();return}let h={...i,"Accept-Ranges":"bytes","Content-Type":"application/zip","Cache-Control":"no-store"};if(n.method==="HEAD"){e.writeHead(200,{...h,"Content-Length":String(d)}).end();return}let l=A(n.headers.range,d);if(l==="unsatisfiable"){t("unsatisfiable"),e.writeHead(416,{...i,"Content-Range":`bytes */${d}`}).end();return}let[m,p,w]=l===null?[0,d-1,200]:[l.start,l.end,206],E={...h,"Content-Length":String(p-m+1)};if(w===206&&(E["Content-Range"]=`bytes ${m}-${p}/${d}`),e.writeHead(w,E),d===0){e.end();return}let f=C(g,{start:m,end:p});f.on("error",()=>e.destroy()),e.on("close",()=>f.destroy()),f.pipe(e)}function O(n,e){return(e??y(n).evidenceViewerUrl).replace(/\/+$/,"")}function k(n,e){return`${e}/?pack=${encodeURIComponent(n)}`}function P(n){return`evidence: view locally with \`kane-cli evidence serve ${n}\``}export{A as a,I as b,O as c,k as d,P as e};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-5FQYB5SM.js";import{a as C}from"./chunk-OT3VKXJX.js";import{q as m,r as u,s as f,t as x,u as y}from"./chunk-SJZJ7ASF.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
2
+ import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-C6S2RPZA.js";import{a as C}from"./chunk-YWYORBY3.js";import{q as m,r as u,s as f,t as x,u as y}from"./chunk-5TQFOPJV.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
3
3
  Please open this URL manually: ${e}
4
4
  `)})})}};function v(s){let r=s.state==="success",o=r?"#22c55e":"#ef4444",e=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",t=r?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',i=s.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
5
5
  <html lang="en">
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as y}from"./chunk-YCCUBQY4.js";import{y as t}from"./chunk-SJZJ7ASF.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as c,b as n,k as w}from"./chunk-C44QQJR4.js";import{e as k}from"./chunk-UR6MHSHU.js";var e=k(O(),1);function D(i){let a=i.findIndex(s=>s.free);return a>=0?a:null}var P=60,C=100;function F({headline:i,ask:a=!1,rows:s,sel:u,focused:m,freeText:l=null,freeTextNote:x,sublines:$=[]}){let{stdout:h}=w(),p=h?.columns??80,A=p<P,B=Math.min(p-1,C),d=o=>m&&u===o?(0,e.jsx)(n,{color:t.assuranceAccent,children:"\u276F"}):" ",b=a?`? ${i}`:i,f=Math.max(4,B-3),T=$.map((o,r)=>(0,e.jsx)(n,{color:t.dim,children:` ${o.length>f?`${o.slice(0,f-1)}\u2026`:o}`},`sub-${r}`)),g=0,R=s.map((o,r)=>o.free?l?(0,e.jsxs)(c,{flexDirection:"column",children:[(0,e.jsxs)(c,{children:[(0,e.jsxs)(n,{children:[(0,e.jsx)(n,{color:t.assuranceAccent,children:"\u276F"})," ",(0,e.jsx)(n,{color:t.dim,children:"\u270E "})]}),(0,e.jsx)(y,{value:l.value,onChange:l.onChange,onSubmit:l.onSubmit,onCancel:l.onCancel,placeholder:o.label})]}),x?(0,e.jsx)(n,{color:t.muted,children:` ${x}`}):null]},o.key):(0,e.jsxs)(n,{children:[d(r)," ",(0,e.jsx)(n,{color:t.dim,children:`\u270E ${o.label}`})]},o.key):(g+=1,(0,e.jsxs)(n,{bold:m&&u===r,children:[d(r),` ${g}. ${o.label}`,o.detail?(0,e.jsx)(n,{color:t.dim,bold:!1,children:` \u2014 ${o.detail}`}):null]},o.key)));return A?(0,e.jsxs)(c,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,e.jsx)(n,{bold:!0,color:t.assuranceAccent,children:b}),T,R]}):(0,e.jsxs)(c,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,e.jsx)(n,{bold:!0,color:t.assuranceAccent,children:b}),T,(0,e.jsx)(n,{children:" "}),R]})}export{D as a,F as b};
2
+ import{a as y}from"./chunk-YCCUBQY4.js";import{y as t}from"./chunk-5TQFOPJV.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as c,b as n,k as w}from"./chunk-C44QQJR4.js";import{e as k}from"./chunk-UR6MHSHU.js";var e=k(O(),1);function D(i){let a=i.findIndex(s=>s.free);return a>=0?a:null}var P=60,C=100;function F({headline:i,ask:a=!1,rows:s,sel:u,focused:m,freeText:l=null,freeTextNote:x,sublines:$=[]}){let{stdout:h}=w(),p=h?.columns??80,A=p<P,B=Math.min(p-1,C),d=o=>m&&u===o?(0,e.jsx)(n,{color:t.assuranceAccent,children:"\u276F"}):" ",b=a?`? ${i}`:i,f=Math.max(4,B-3),T=$.map((o,r)=>(0,e.jsx)(n,{color:t.dim,children:` ${o.length>f?`${o.slice(0,f-1)}\u2026`:o}`},`sub-${r}`)),g=0,R=s.map((o,r)=>o.free?l?(0,e.jsxs)(c,{flexDirection:"column",children:[(0,e.jsxs)(c,{children:[(0,e.jsxs)(n,{children:[(0,e.jsx)(n,{color:t.assuranceAccent,children:"\u276F"})," ",(0,e.jsx)(n,{color:t.dim,children:"\u270E "})]}),(0,e.jsx)(y,{value:l.value,onChange:l.onChange,onSubmit:l.onSubmit,onCancel:l.onCancel,placeholder:o.label})]}),x?(0,e.jsx)(n,{color:t.muted,children:` ${x}`}):null]},o.key):(0,e.jsxs)(n,{children:[d(r)," ",(0,e.jsx)(n,{color:t.dim,children:`\u270E ${o.label}`})]},o.key):(g+=1,(0,e.jsxs)(n,{bold:m&&u===r,children:[d(r),` ${g}. ${o.label}`,o.detail?(0,e.jsx)(n,{color:t.dim,bold:!1,children:` \u2014 ${o.detail}`}):null]},o.key)));return A?(0,e.jsxs)(c,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,e.jsx)(n,{bold:!0,color:t.assuranceAccent,children:b}),T,R]}):(0,e.jsxs)(c,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,e.jsx)(n,{bold:!0,color:t.assuranceAccent,children:b}),T,(0,e.jsx)(n,{children:" "}),R]})}export{D as a,F as b};