@testmuai/kane-cli 0.10.0 → 0.10.2

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 (397) hide show
  1. package/dist/ChatSurface-FIYDTZSI.js +2 -0
  2. package/dist/{ChromeProfilePicker-FWPUDKD6.js → ChromeProfilePicker-Q6FIGVYU.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-D5L2DO6A.js → CliFeedbackPrompt-2NV2G65E.js} +1 -1
  4. package/dist/{CliUploadProgress-HQX57WE6.js → CliUploadProgress-JZ5FXODE.js} +1 -1
  5. package/dist/{ConfigView-DGQXKEON.js → ConfigView-TZ4YINOE.js} +1 -1
  6. package/dist/EvidenceViewOffer-LKPN5BHX.js +2 -0
  7. package/dist/FolderPicker-H5K74PCH.js +2 -0
  8. package/dist/InfoBox-DNSOAK5L.js +2 -0
  9. package/dist/{LinksBox-WZ4RAMSH.js → LinksBox-32TZOANP.js} +1 -1
  10. package/dist/{ProfilesView-AGRNPGSW.js → ProfilesView-UC4MPM54.js} +1 -1
  11. package/dist/ProjectPicker-ZJ5RW6XL.js +2 -0
  12. package/dist/SaveSessionPrompt-F327WC7A.js +2 -0
  13. package/dist/SingleShotApp-OMLRYOSI.js +2 -0
  14. package/dist/{SummaryBox-XQJUZBAN.js → SummaryBox-XGFO5X76.js} +1 -1
  15. package/dist/TestMdRunView-ZZ77QTAQ.js +2 -0
  16. package/dist/TestrunEvidenceTable-G7MPF55X.js +2 -0
  17. package/dist/{WhoamiView-JQCURK2M.js → WhoamiView-4XIJXMTU.js} +1 -1
  18. package/dist/{app-download-OU6AGH2X.js → app-download-XEDO3EMV.js} +1 -1
  19. package/dist/{assurance-job-ZI3L6I4F.js → assurance-job-MD65GQLC.js} +1 -1
  20. package/dist/{auth-7Z54TMQQ.js → auth-WBIEHHDS.js} +1 -1
  21. package/dist/{binary-S5YL5GJD.js → binary-NVYLR36K.js} +1 -1
  22. package/dist/{bind-LIV72SEZ.js → bind-H3ALI2NG.js} +1 -1
  23. package/dist/{bootstrap-3V6TOO6I.js → bootstrap-JEVSVPQ2.js} +1 -1
  24. package/dist/bridge-2UHJOVLX.js +2 -0
  25. package/dist/{catalog-I3PC6LT6.js → catalog-5UYBWA4W.js} +1 -1
  26. package/dist/{catalog-client-WKYG3JN6.js → catalog-client-VVKV4JKW.js} +1 -1
  27. package/dist/{changelog-IHNWFYWY.js → changelog-FPWJXERY.js} +1 -1
  28. package/dist/chat-committer-ZKEKJA2R.js +2 -0
  29. package/dist/chat-controller-FXRJXUG3.js +2 -0
  30. package/dist/child-JHYENXE7.js +2 -0
  31. package/dist/{chunk-URAYFJGM.js → chunk-226AGYHB.js} +1 -1
  32. package/dist/{chunk-ZTAZ2R5Z.js → chunk-23DKB2MT.js} +1 -1
  33. package/dist/{chunk-JGLADDRH.js → chunk-2COXO5LQ.js} +1 -1
  34. package/dist/{chunk-TZVPDGJD.js → chunk-2GEAKFAV.js} +1 -1
  35. package/dist/{chunk-45URQUAK.js → chunk-2QKBXRLI.js} +1 -1
  36. package/dist/{chunk-AG5XJWEV.js → chunk-2ULYGALF.js} +1 -1
  37. package/dist/{chunk-G3J4XY3Z.js → chunk-32HED7X2.js} +1 -1
  38. package/dist/{chunk-GRURFGBP.js → chunk-32MFECUA.js} +1 -1
  39. package/dist/{chunk-N3KTLWJL.js → chunk-35BG2EMW.js} +1 -1
  40. package/dist/{chunk-KDR662D2.js → chunk-3KY7HHQU.js} +1 -1
  41. package/dist/{chunk-ZGQM6KWN.js → chunk-3V4J65GN.js} +1 -1
  42. package/dist/{chunk-DBTMKBHU.js → chunk-3YIA3DSL.js} +1 -1
  43. package/dist/{chunk-VVCZRCRD.js → chunk-44SIFDNY.js} +1 -1
  44. package/dist/{chunk-Z5BFCTHI.js → chunk-45NM23EQ.js} +2 -2
  45. package/dist/{chunk-I2MC6VVX.js → chunk-4C7WVQOD.js} +1 -1
  46. package/dist/{chunk-3UHPVQLU.js → chunk-4HARMERK.js} +1 -1
  47. package/dist/{chunk-A3TCFSCK.js → chunk-4HYPMGDF.js} +1 -1
  48. package/dist/{chunk-7KX2BHKG.js → chunk-4KCYNP2K.js} +1 -1
  49. package/dist/{chunk-FVYIV36L.js → chunk-4LGQHTXM.js} +1 -1
  50. package/dist/{chunk-WKZLK57W.js → chunk-4NEPHIAO.js} +1 -1
  51. package/dist/{chunk-YYVBE6W2.js → chunk-54NJJVG5.js} +1 -1
  52. package/dist/{chunk-3OVFKUXV.js → chunk-5F44KH3R.js} +1 -1
  53. package/dist/{chunk-WERIGVOH.js → chunk-5F5IVART.js} +1 -1
  54. package/dist/{chunk-FBQ7PQJV.js → chunk-5KJU4MG4.js} +1 -1
  55. package/dist/{chunk-D6CS62O7.js → chunk-5MFPQYW3.js} +1 -1
  56. package/dist/{chunk-ZI3X7DI2.js → chunk-5WLXAQ4H.js} +1 -1
  57. package/dist/{chunk-RFEON5GN.js → chunk-5XVWT6UK.js} +1 -1
  58. package/dist/{chunk-5IO5ZC4S.js → chunk-6CS23F3E.js} +1 -1
  59. package/dist/{chunk-DTYT6KBO.js → chunk-6JUS2ULI.js} +1 -1
  60. package/dist/{chunk-HMQ5M4JJ.js → chunk-6LEHGRRG.js} +1 -1
  61. package/dist/{chunk-5R3ODQHH.js → chunk-6SD4XTYC.js} +1 -1
  62. package/dist/{chunk-Y3YULFCK.js → chunk-6SWHEBPR.js} +1 -1
  63. package/dist/{chunk-BY2B4YJN.js → chunk-6YBH3WUW.js} +1 -1
  64. package/dist/{chunk-X3J4CC27.js → chunk-73HMW2WA.js} +1 -1
  65. package/dist/{chunk-PQXYHI5W.js → chunk-75FF7J5R.js} +1 -1
  66. package/dist/{chunk-JTJ7IPNI.js → chunk-7DLDADQR.js} +1 -1
  67. package/dist/{chunk-J4LQAT5P.js → chunk-7LYLJ75Z.js} +1 -1
  68. package/dist/{chunk-XLQ4F6BI.js → chunk-7O2FIZB7.js} +2 -2
  69. package/dist/{chunk-UUWSULIM.js → chunk-7PCLHURF.js} +3 -3
  70. package/dist/{chunk-FLOQ5NZL.js → chunk-7XJNYLQW.js} +1 -1
  71. package/dist/{chunk-3ZPEQDXZ.js → chunk-7ZR5CQY3.js} +1 -1
  72. package/dist/{chunk-CJQUVHHS.js → chunk-A474TUCE.js} +1 -1
  73. package/dist/chunk-A4ZV2SHL.js +5 -0
  74. package/dist/{chunk-RDH3E25Q.js → chunk-A7IMHUFY.js} +2 -2
  75. package/dist/{chunk-EVZLINBN.js → chunk-ABMM37L2.js} +1 -1
  76. package/dist/{chunk-QECTIQAC.js → chunk-AUSLHNXQ.js} +1 -1
  77. package/dist/{chunk-4MNSP4EO.js → chunk-B226SFOV.js} +1 -1
  78. package/dist/{chunk-2L3A5NKZ.js → chunk-B57ZRHEQ.js} +1 -1
  79. package/dist/{chunk-2PZKMT3I.js → chunk-BHQIH2FE.js} +1 -1
  80. package/dist/{chunk-4SJAOAYY.js → chunk-BJT6PZXL.js} +1 -1
  81. package/dist/{chunk-YKOEABP2.js → chunk-C6P6YUCR.js} +1 -1
  82. package/dist/chunk-CB344EDO.js +2 -0
  83. package/dist/chunk-CCOD4GQJ.js +2 -0
  84. package/dist/{chunk-CJE7PKRV.js → chunk-CQDCNP7V.js} +1 -1
  85. package/dist/{chunk-EPJ5SJL2.js → chunk-D4QXYAYA.js} +2 -2
  86. package/dist/{chunk-CBVHP7JB.js → chunk-DLP5S3TO.js} +1 -1
  87. package/dist/{chunk-EH43VWVR.js → chunk-DXIQVBMI.js} +1 -1
  88. package/dist/chunk-DXLZCJH5.js +7 -0
  89. package/dist/{chunk-WZLDFEWR.js → chunk-E4GIGM5V.js} +1 -1
  90. package/dist/{chunk-JOCEZK2M.js → chunk-EAWU2TOG.js} +1 -1
  91. package/dist/{chunk-G3CYFCSR.js → chunk-EEOAU43D.js} +1 -1
  92. package/dist/{chunk-MYZHOBS4.js → chunk-EHB55V23.js} +1 -1
  93. package/dist/{chunk-OR2B6T3B.js → chunk-ENRFXGID.js} +1 -1
  94. package/dist/{chunk-JT6WLJSV.js → chunk-ET5EK2CM.js} +1 -1
  95. package/dist/{chunk-HGVM2OZU.js → chunk-EZMRWXRT.js} +1 -1
  96. package/dist/{chunk-QMOGBKJM.js → chunk-FAMQ4DHU.js} +1 -1
  97. package/dist/{chunk-GGV336P5.js → chunk-FI2DVNRT.js} +1 -1
  98. package/dist/{chunk-AUJSC7PU.js → chunk-FNUGDPTS.js} +1 -1
  99. package/dist/{chunk-MPEIMWQI.js → chunk-FOLUB336.js} +1 -1
  100. package/dist/{chunk-4JWJH6TB.js → chunk-FYPIF3BE.js} +1 -1
  101. package/dist/{chunk-HHW6MRU3.js → chunk-G4K3TP2I.js} +1 -1
  102. package/dist/{chunk-P2ZQDQDB.js → chunk-GAKBHNC4.js} +1 -1
  103. package/dist/{chunk-DPGOAFKF.js → chunk-GBQ4K25P.js} +1 -1
  104. package/dist/{chunk-PCDIEYV6.js → chunk-GEZVC4S3.js} +1 -1
  105. package/dist/{chunk-UX2CDUPE.js → chunk-GJ7MO2FW.js} +2 -2
  106. package/dist/{chunk-PL3SG3M2.js → chunk-GJXO6FF7.js} +1 -1
  107. package/dist/{chunk-252GEI3H.js → chunk-GLM5UGTF.js} +1 -1
  108. package/dist/{chunk-JCSVBD4F.js → chunk-GQARXS6F.js} +1 -1
  109. package/dist/{chunk-NTXFPNAP.js → chunk-GT3JDX5H.js} +1 -1
  110. package/dist/{chunk-RARD6TC6.js → chunk-GZQAETB2.js} +1 -1
  111. package/dist/{chunk-TLOYTGVT.js → chunk-H4TIVILC.js} +1 -1
  112. package/dist/{chunk-7C4IEL5V.js → chunk-HG2ILWCE.js} +1 -1
  113. package/dist/{chunk-2SY2NCOP.js → chunk-HHOVANJ7.js} +1 -1
  114. package/dist/{chunk-DHYGCHKB.js → chunk-HM6LZ2KM.js} +1 -1
  115. package/dist/{chunk-NJCN6LP5.js → chunk-HNF3PWF3.js} +6 -6
  116. package/dist/{chunk-P2LDAW3C.js → chunk-HVOXMCKE.js} +1 -1
  117. package/dist/{chunk-JSLKCCD2.js → chunk-HWPWCCEV.js} +1 -1
  118. package/dist/{chunk-XMALVGH7.js → chunk-HX5OLRKU.js} +2 -2
  119. package/dist/{chunk-4I7YN6YY.js → chunk-HYJVYYAZ.js} +2 -2
  120. package/dist/{chunk-2N75WO7Y.js → chunk-I52NWH4U.js} +1 -1
  121. package/dist/{chunk-3T2TYDPT.js → chunk-IB5WG5YY.js} +1 -1
  122. package/dist/{chunk-6DZ7LVOG.js → chunk-IH73ZCBB.js} +1 -1
  123. package/dist/{chunk-SBR6D6GS.js → chunk-IT5JVCZN.js} +1 -1
  124. package/dist/{chunk-GGS3ATPB.js → chunk-IZ66FKPC.js} +1 -1
  125. package/dist/{chunk-EX6ORR7P.js → chunk-JNPFEBUR.js} +1 -1
  126. package/dist/{chunk-AU26ZZTX.js → chunk-JTNEF5ZP.js} +1 -1
  127. package/dist/{chunk-K2PLULJD.js → chunk-JUVY6PHY.js} +1 -1
  128. package/dist/{chunk-JQ7ZZQXC.js → chunk-K4K2BGQC.js} +3 -3
  129. package/dist/{chunk-VZA7BPCK.js → chunk-K75WIRI5.js} +1 -1
  130. package/dist/{chunk-4R4YUOVY.js → chunk-KKLCXRW6.js} +1 -1
  131. package/dist/{chunk-YGMQXS2J.js → chunk-KN7GZWKK.js} +1 -1
  132. package/dist/{chunk-I2VU2DTS.js → chunk-L3BUPFAQ.js} +4 -4
  133. package/dist/{chunk-2GE5X2A5.js → chunk-LLQWEGXD.js} +1 -1
  134. package/dist/chunk-LTPOMMAB.js +2 -0
  135. package/dist/{chunk-AUBSLPJZ.js → chunk-LWCP4GLY.js} +1 -1
  136. package/dist/{chunk-VQZOKTJ2.js → chunk-LXCTV75T.js} +1 -1
  137. package/dist/{chunk-YH4VZVHJ.js → chunk-LZGAFKYH.js} +1 -1
  138. package/dist/{chunk-3QICDXY5.js → chunk-LZPYIFHZ.js} +1 -1
  139. package/dist/{chunk-WQR2GYP7.js → chunk-M3TFOFUQ.js} +1 -1
  140. package/dist/{chunk-MKPDF26Q.js → chunk-M7Y5GGVJ.js} +1 -1
  141. package/dist/{chunk-52VCA4K2.js → chunk-MEMXFTLD.js} +1 -1
  142. package/dist/{chunk-U7NRZBB5.js → chunk-MINDIQET.js} +1 -1
  143. package/dist/{chunk-JX5NVKTV.js → chunk-MP6NCJFE.js} +1 -1
  144. package/dist/{chunk-VA3BSIUQ.js → chunk-MSYRAPDK.js} +1 -1
  145. package/dist/{chunk-HJLMH7ZM.js → chunk-MUX2A37P.js} +1 -1
  146. package/dist/{chunk-EQWMOGLO.js → chunk-NCP54AIQ.js} +2 -2
  147. package/dist/{chunk-QQI6N3FO.js → chunk-NVD2MXHQ.js} +1 -1
  148. package/dist/{chunk-2EVP636F.js → chunk-O2Y46A3G.js} +3 -3
  149. package/dist/{chunk-ONZ2CSTZ.js → chunk-O3TXAMFW.js} +1 -1
  150. package/dist/{chunk-YI4ESDAX.js → chunk-O5KTMDTH.js} +1 -1
  151. package/dist/{chunk-HBVHIEPB.js → chunk-OK6NLITG.js} +1 -1
  152. package/dist/{chunk-JFBEHCJN.js → chunk-OKA6FPJM.js} +1 -1
  153. package/dist/{chunk-65BG6GAE.js → chunk-OVNTCBNS.js} +1 -1
  154. package/dist/{chunk-4523YDTG.js → chunk-P4VFC6HO.js} +1 -1
  155. package/dist/{chunk-ULGBK4NS.js → chunk-PC22QRIY.js} +1 -1
  156. package/dist/{chunk-B2WFW74J.js → chunk-PEUIHME2.js} +1 -1
  157. package/dist/{chunk-Z777GGHB.js → chunk-PI7OXS62.js} +1 -1
  158. package/dist/{chunk-MHB6DMKZ.js → chunk-POA336CU.js} +1 -1
  159. package/dist/{chunk-ZZNQIFFI.js → chunk-PR5EGLEI.js} +1 -1
  160. package/dist/{chunk-MW2WNYJO.js → chunk-PRBWZXFA.js} +2 -2
  161. package/dist/{chunk-4BUEOKFV.js → chunk-PWNYTIVA.js} +1 -1
  162. package/dist/{chunk-FYCD765R.js → chunk-Q4JV4U65.js} +58 -58
  163. package/dist/{chunk-BRVIK3BU.js → chunk-Q5AKIQIE.js} +1 -1
  164. package/dist/{chunk-EC5IP5HZ.js → chunk-QB77LRF4.js} +1 -1
  165. package/dist/{chunk-AGXAJ2II.js → chunk-QUNIY6NN.js} +1 -1
  166. package/dist/{chunk-LHQUCRCH.js → chunk-QVMXL675.js} +1 -1
  167. package/dist/{chunk-FPPVNF53.js → chunk-R6TFRAMZ.js} +1 -1
  168. package/dist/{chunk-567D5ZTO.js → chunk-RAVAJZV2.js} +7 -7
  169. package/dist/{chunk-7ZJWUWSN.js → chunk-RDAIOJCR.js} +1 -1
  170. package/dist/{chunk-PBWYQR5I.js → chunk-RRKYHUOD.js} +1 -1
  171. package/dist/{chunk-GXMD23XB.js → chunk-S7XCOBYD.js} +1 -1
  172. package/dist/{chunk-32Y6QVFG.js → chunk-SALZ6WSF.js} +1 -1
  173. package/dist/{chunk-4NUSW4A2.js → chunk-SIHX5FW5.js} +1 -1
  174. package/dist/{chunk-USJ3LUAL.js → chunk-SSOUYKVG.js} +1 -1
  175. package/dist/{chunk-2B75UL7Y.js → chunk-SVIIUKJ2.js} +1 -1
  176. package/dist/{chunk-QVP4FSKT.js → chunk-T77LTLAD.js} +1 -1
  177. package/dist/{chunk-KRRZCY7U.js → chunk-TAY7J5VS.js} +1 -1
  178. package/dist/chunk-TD6GCEIK.js +2 -0
  179. package/dist/{chunk-ZY65IZJR.js → chunk-TM6VLC6V.js} +1 -1
  180. package/dist/{chunk-YKL5H4K6.js → chunk-TMH4TPMB.js} +1 -1
  181. package/dist/{chunk-COJINPOK.js → chunk-TU2KPOW2.js} +2 -2
  182. package/dist/{chunk-3BSYOCSW.js → chunk-U2VYTVKV.js} +1 -1
  183. package/dist/{chunk-W3NWHWK2.js → chunk-UCVP7ZY4.js} +1 -1
  184. package/dist/{chunk-436FZ4KG.js → chunk-UICJ2KLJ.js} +1 -1
  185. package/dist/{chunk-QWZJ5QDO.js → chunk-UMNCM4RJ.js} +1 -1
  186. package/dist/{chunk-LNHBZEDC.js → chunk-UWPG5MWM.js} +1 -1
  187. package/dist/{chunk-MJKRJGER.js → chunk-V3OZJO7Y.js} +1 -1
  188. package/dist/{chunk-ZKPY3AXW.js → chunk-VE4HLIGA.js} +1 -1
  189. package/dist/{chunk-K3OSK6PB.js → chunk-W2HRX3DR.js} +1 -1
  190. package/dist/{chunk-B7JLM3IX.js → chunk-W54BX6HC.js} +1 -1
  191. package/dist/{chunk-IZ65ZPWY.js → chunk-W5HFUBXD.js} +1 -1
  192. package/dist/{chunk-GRO6DLN3.js → chunk-WEJR2V7R.js} +1 -1
  193. package/dist/{chunk-A4BB6GLN.js → chunk-X3A4QPA3.js} +1 -1
  194. package/dist/{chunk-G2KTWFMU.js → chunk-X52YIWGG.js} +1 -1
  195. package/dist/{chunk-UEPJ26X2.js → chunk-X6FCXBXU.js} +1 -1
  196. package/dist/{chunk-LXM7VHYN.js → chunk-X7S7IGCV.js} +1 -1
  197. package/dist/{chunk-UNWPBMVM.js → chunk-XCUF5AVM.js} +1 -1
  198. package/dist/{chunk-FPVGA6XT.js → chunk-XHFU5TGS.js} +1 -1
  199. package/dist/{chunk-ZRDX2ARO.js → chunk-XNXJXGVB.js} +2 -2
  200. package/dist/{chunk-JRSEAXFE.js → chunk-XZ6J3Y2W.js} +1 -1
  201. package/dist/{chunk-JGRXMTME.js → chunk-YDB72F4K.js} +1 -1
  202. package/dist/{chunk-7DFBOVUB.js → chunk-YJAQZMJT.js} +1 -1
  203. package/dist/{chunk-GYDJO32R.js → chunk-YO6SNXBJ.js} +1 -1
  204. package/dist/{chunk-RLOJH5O6.js → chunk-Z24SD2EJ.js} +1 -1
  205. package/dist/{chunk-ENG2UTMX.js → chunk-Z36KVIRR.js} +1 -1
  206. package/dist/{chunk-PTISAIZW.js → chunk-Z6SI7YNV.js} +1 -1
  207. package/dist/{chunk-6NFOH4AC.js → chunk-ZAQGIC33.js} +1 -1
  208. package/dist/{chunk-AIGQCMGY.js → chunk-ZCL7XIVS.js} +1 -1
  209. package/dist/{chunk-ORNVIEUA.js → chunk-ZDCXWEQG.js} +1 -1
  210. package/dist/{chunk-WX4VGH5Q.js → chunk-ZDQYGLCZ.js} +1 -1
  211. package/dist/{chunk-6TNLITJO.js → chunk-ZHAMVLQZ.js} +1 -1
  212. package/dist/{chunk-H4KPNGY4.js → chunk-ZMWTRXFH.js} +1 -1
  213. package/dist/{chunk-GET4DINR.js → chunk-ZO3ZAMUU.js} +1 -1
  214. package/dist/{chunk-GI2JPIX5.js → chunk-ZZZGTDYE.js} +1 -1
  215. package/dist/commands-R5AYK6XM.js +2 -0
  216. package/dist/{committer-26UZDYSA.js → committer-UO3B3S5Y.js} +1 -1
  217. package/dist/{config-B472DZSR.js → config-YMHI3H3Y.js} +1 -1
  218. package/dist/cover-cmd-DVQIGFDY.js +2 -0
  219. package/dist/{credentials-TLT3RQOO.js → credentials-BCR73VGS.js} +1 -1
  220. package/dist/{deps-bundle-CMTIWBS5.js → deps-bundle-6WLX44OA.js} +1 -1
  221. package/dist/{deps-resolve-XLFZK74A.js → deps-resolve-DSAKPZ3T.js} +1 -1
  222. package/dist/{design-chat-I7X3QDDY.js → design-chat-YUI2JPO6.js} +1 -1
  223. package/dist/design-committer-7YIPFKMO.js +2 -0
  224. package/dist/design-headless-KIP6R7UV.js +2 -0
  225. package/dist/{design-remote-UDC5FP45.js → design-remote-XMSHDDUX.js} +2 -2
  226. package/dist/device-env-K7J5NN66.js +2 -0
  227. package/dist/dispatch-BV6XMCN3.js +2 -0
  228. package/dist/{doctor-UHFCIM4B.js → doctor-PGTNOMSP.js} +1 -1
  229. package/dist/{docx-convert-N4KMLLKO.js → docx-convert-DO5AQYD3.js} +1 -1
  230. package/dist/{dossier-6KMKEIXV.js → dossier-5XKNAK6Q.js} +1 -1
  231. package/dist/evidence-RO3RDZXO.js +2 -0
  232. package/dist/evidence-presentation-LSFOZGLH.js +2 -0
  233. package/dist/evolve-cmd-U2ALVGMT.js +2 -0
  234. package/dist/evolve-remote-K2MCCVMM.js +2 -0
  235. package/dist/{explain-cmd-R67B4YR3.js → explain-cmd-KNDORU2D.js} +1 -1
  236. package/dist/{explain-cmd-235TY7QX.js → explain-cmd-UWK5YVXG.js} +1 -1
  237. package/dist/explore-S2BGQUIF.js +2 -0
  238. package/dist/{explore-context-tty-YXEFT32U.js → explore-context-tty-WJHUSP3A.js} +1 -1
  239. package/dist/{explore-entry-V6L5FSP4.js → explore-entry-3EX2T3NS.js} +4 -4
  240. package/dist/{explore-live-N5VBLBUI.js → explore-live-TRY5A2ME.js} +1 -1
  241. package/dist/{explore-run-tty-ZZQ33GNA.js → explore-run-tty-ZV5XFKZA.js} +2 -2
  242. package/dist/{extract-bind-BTINHHE5.js → extract-bind-TXUBMK3T.js} +3 -3
  243. package/dist/extract-chat-VPYDGQKO.js +2 -0
  244. package/dist/{extract-cmd-45OZETCM.js → extract-cmd-YUOYMVF5.js} +2 -2
  245. package/dist/extract-headless-UWTAPOET.js +2 -0
  246. package/dist/{feeder-L55TH2NC.js → feeder-NGWIPZ26.js} +1 -1
  247. package/dist/folder-flags-WV7UV3JG.js +2 -0
  248. package/dist/gaps-cmd-PFV3FZCM.js +3 -0
  249. package/dist/gate-7ALXLCNB.js +2 -0
  250. package/dist/gate-NB5CJMTN.js +2 -0
  251. package/dist/{generate-headless-DAH3HHRQ.js → generate-headless-KMBBZTLS.js} +2 -2
  252. package/dist/hold-passthrough-JGHWMYDM.js +2 -0
  253. package/dist/{impact-cmd-3VFJAKYK.js → impact-cmd-PW33L5RF.js} +2 -2
  254. package/dist/index.js +4154 -190
  255. package/dist/ingest-ZHHHBUXR.js +2 -0
  256. package/dist/{ingest-cmd-YSEH5EPU.js → ingest-cmd-MXYILQLV.js} +3 -3
  257. package/dist/ingest-remote-2EEJP6ML.js +2 -0
  258. package/dist/install-7J34AYB6.js +2 -0
  259. package/dist/{interactive-bind-P3GTFIZM.js → interactive-bind-FDWJUTI6.js} +4 -4
  260. package/dist/{interactive-remote-PBRQHTAF.js → interactive-remote-O2Q2FNOH.js} +1 -1
  261. package/dist/lane-CNGO7LH5.js +2 -0
  262. package/dist/lattice-auth-TXNDLHM6.js +2 -0
  263. package/dist/{lifecycle-cmd-PUNFWKV5.js → lifecycle-cmd-GFHDBRXX.js} +1 -1
  264. package/dist/{list-cmd-RD7YBF4S.js → list-cmd-RR75PMPE.js} +1 -1
  265. package/dist/{list-commands-UZELZAB3.js → list-commands-3QGZWJ5P.js} +1 -1
  266. package/dist/{list-remote-KGKXPCQA.js → list-remote-AA3VSWOI.js} +1 -1
  267. package/dist/{locks-cmd-LXZ6I4QG.js → locks-cmd-AZKCSGHI.js} +1 -1
  268. package/dist/{logical-ids-D5PFYY4C.js → logical-ids-74PLU3VR.js} +1 -1
  269. package/dist/login-flow-ZQ6UFTS2.js +2 -0
  270. package/dist/{maintenance-cmd-WRWBCP3R.js → maintenance-cmd-OHGVARQ2.js} +1 -1
  271. package/dist/{mobile-prompts-Z7NQHRGP.js → mobile-prompts-FZRKLLTN.js} +1 -1
  272. package/dist/{objective-variable-gate-3Z7DNVVC.js → objective-variable-gate-V5HHFOUS.js} +1 -1
  273. package/dist/{onboarding-ZP4XDYEO.js → onboarding-NXGMV3VG.js} +1 -1
  274. package/dist/open-provider-XDJKT3W3.js +2 -0
  275. package/dist/pdf-convert-YB6PJFMI.js +2 -0
  276. package/dist/persist-recorded-session-INFN4JZT.js +3 -0
  277. package/dist/phase-seed-ZZSJME7M.js +2 -0
  278. package/dist/pipeline-MVZRI6YZ.js +2 -0
  279. package/dist/{policy-commands-TY6WOR73.js → policy-commands-3YJ6YCDN.js} +1 -1
  280. package/dist/{prepare-target-EVL2QSXA.js → prepare-target-DII5WZCX.js} +1 -1
  281. package/dist/{pull-cmd-QJQANBAW.js → pull-cmd-XZN53XFZ.js} +1 -1
  282. package/dist/{pull-route-AIOTLA3D.js → pull-route-R33BVADE.js} +1 -1
  283. package/dist/readmodel-TRV4E3MW.js +2 -0
  284. package/dist/real-device-run-DGENHGUV.js +2 -0
  285. package/dist/{reconcile-cmd-IJTQAJZX.js → reconcile-cmd-KFPRCCJB.js} +4 -4
  286. package/dist/reconcile-deps-UDQBWSLE.js +2 -0
  287. package/dist/{reconcile-remote-23D6SXXT.js → reconcile-remote-6WISFGRG.js} +2 -2
  288. package/dist/{recording-banner-MNRMMEX4.js → recording-banner-XOX2CDCF.js} +1 -1
  289. package/dist/registry-NV3EMDMK.js +2 -0
  290. package/dist/remote-entry-BCTFT643.js +2 -0
  291. package/dist/{remote-mode-AFNCN6EE.js → remote-mode-4HN27MD4.js} +1 -1
  292. package/dist/{remote-words-RCNFI2TQ.js → remote-words-LFDYKIZ7.js} +1 -1
  293. package/dist/{require-project-folder-7UH43GHI.js → require-project-folder-ZK4JJCDB.js} +1 -1
  294. package/dist/{resolve-run-intent-XEWFYMGN.js → resolve-run-intent-LYLVNNDZ.js} +1 -1
  295. package/dist/{resolver-QMPX6RBR.js → resolver-RMHGGYRP.js} +1 -1
  296. package/dist/revert-QKHPCRT6.js +2 -0
  297. package/dist/{review-cmd-2OECKNL5.js → review-cmd-UGF2FC5Y.js} +1 -1
  298. package/dist/run-CSYGVV3D.js +2 -0
  299. package/dist/run-YUHHD54J.js +2 -0
  300. package/dist/{run-channel-63SVP5OI.js → run-channel-IIIYXOIW.js} +1 -1
  301. package/dist/run-remote-BGKQDAOA.js +2 -0
  302. package/dist/{run-startup-gate-USQFSW47.js → run-startup-gate-4XE73OON.js} +1 -1
  303. package/dist/run-test-md-G6U3RU2Q.js +19 -0
  304. package/dist/session-worker.js +2 -2
  305. package/dist/{sessions-CFV7FOIT.js → sessions-NH2EG7BP.js} +1 -1
  306. package/dist/{sessions-cmd-LQ2LZQOC.js → sessions-cmd-CABAX7BO.js} +2 -2
  307. package/dist/{sessions-remote-H7CQST42.js → sessions-remote-Y4FTZL7Y.js} +1 -1
  308. package/dist/{skill-installer-LKYY6XFJ.js → skill-installer-FS2AV7GX.js} +1 -1
  309. package/dist/spawner-MQ4XEHIX.js +2 -0
  310. package/dist/{store-KM5MG3XB.js → store-PLKJZTGC.js} +1 -1
  311. package/dist/store-choice-UAB6Z4AL.js +2 -0
  312. package/dist/{store-guard-34GG2TW2.js → store-guard-DUN2X3SR.js} +1 -1
  313. package/dist/{store-site-ZSFINU6C.js → store-site-K5NHLI7D.js} +1 -1
  314. package/dist/stream-warnings-GM7YEOVG.js +2 -0
  315. package/dist/sync-cmd-AGTOGPYM.js +2 -0
  316. package/dist/{sync-setup-QQXYO6R4.js → sync-setup-4KIY3PDO.js} +1 -1
  317. package/dist/tcg-generate-CUY4AZ2V.js +2 -0
  318. package/dist/testmd-actions-UD6PAWUX.js +2 -0
  319. package/dist/{testmd-sync-PQ4GFKHB.js → testmd-sync-EEJ7GPLR.js} +1 -1
  320. package/dist/token-refresh-K6PVBBFE.js +2 -0
  321. package/dist/{trust-gate-AT2XBWN4.js → trust-gate-674C2NZS.js} +1 -1
  322. package/dist/{turn-preflight-LHYLRL7G.js → turn-preflight-R4PU6NYY.js} +1 -1
  323. package/dist/{use-case-ref-NA3IXGQW.js → use-case-ref-44BPIP4N.js} +1 -1
  324. package/dist/{validate-basic-3DX3MMC7.js → validate-basic-3JZRZL45.js} +1 -1
  325. package/dist/{variable-receipt-BXSZO36E.js → variable-receipt-7PRKDTRJ.js} +1 -1
  326. package/dist/verdicts-PVB7TV5S.js +2 -0
  327. package/dist/{version-check-OV6AOVED.js → version-check-IY3YSQIP.js} +1 -1
  328. package/dist/{view-cmd-QDKBBNIU.js → view-cmd-WUIGTRFX.js} +1 -1
  329. package/dist/{walk-session-BAYYPIKN.js → walk-session-EH7227WR.js} +1 -1
  330. package/dist/with-telemetry-7JMZUBUZ.js +2 -0
  331. package/package.json +16 -16
  332. package/dist/ChatSurface-XUV3EQPZ.js +0 -2
  333. package/dist/EvidenceViewOffer-EIANIYN7.js +0 -2
  334. package/dist/FolderPicker-XOA7FTHF.js +0 -2
  335. package/dist/InfoBox-OBH7SUGC.js +0 -2
  336. package/dist/ProjectPicker-6KRLKV4U.js +0 -2
  337. package/dist/SaveSessionPrompt-J2OPDEOO.js +0 -2
  338. package/dist/SingleShotApp-QI4B2TSL.js +0 -2
  339. package/dist/TestMdRunView-I4MV54FB.js +0 -2
  340. package/dist/TestrunEvidenceTable-WEIUSW3E.js +0 -2
  341. package/dist/bridge-SDEP7Y33.js +0 -2
  342. package/dist/chat-committer-FM5NG46O.js +0 -2
  343. package/dist/chat-controller-FWFQVZTB.js +0 -2
  344. package/dist/child-H2YSDFCG.js +0 -2
  345. package/dist/chunk-34R7BNZ2.js +0 -2
  346. package/dist/chunk-5T6II7VN.js +0 -7
  347. package/dist/chunk-KF4DKXSS.js +0 -2
  348. package/dist/chunk-NOFJXCYP.js +0 -5
  349. package/dist/chunk-SB6P5EQH.js +0 -2
  350. package/dist/commands-QOORPTSI.js +0 -2
  351. package/dist/cover-cmd-3VO6QC5Y.js +0 -2
  352. package/dist/design-committer-Y7R56RFZ.js +0 -2
  353. package/dist/design-headless-HUQOXLZB.js +0 -2
  354. package/dist/device-env-MMGISNHN.js +0 -2
  355. package/dist/dispatch-P2445PUU.js +0 -2
  356. package/dist/evidence-M3JTOJNL.js +0 -2
  357. package/dist/evidence-presentation-DV3DRB4S.js +0 -2
  358. package/dist/evolve-cmd-K3JXACMN.js +0 -2
  359. package/dist/evolve-remote-CUDVV2O2.js +0 -2
  360. package/dist/explore-UDD5FHXW.js +0 -2
  361. package/dist/extract-chat-ABZ5S7UU.js +0 -2
  362. package/dist/extract-headless-ALEFAMVS.js +0 -2
  363. package/dist/folder-flags-HTKJCXKB.js +0 -2
  364. package/dist/gaps-cmd-ROGQWK5X.js +0 -3
  365. package/dist/gate-QA5J7UZA.js +0 -2
  366. package/dist/gate-XFFFX5ZF.js +0 -2
  367. package/dist/hold-passthrough-K5PP26CP.js +0 -2
  368. package/dist/ingest-S5R736ZV.js +0 -2
  369. package/dist/ingest-remote-C6AP2Q7E.js +0 -2
  370. package/dist/install-B26Y2NU4.js +0 -2
  371. package/dist/lane-7IEAE6AC.js +0 -2
  372. package/dist/lattice-auth-7EL4ET3P.js +0 -2
  373. package/dist/login-flow-CHLGQGHK.js +0 -2
  374. package/dist/open-provider-U26BBVUE.js +0 -2
  375. package/dist/pdf-convert-LMKOKLXT.js +0 -2
  376. package/dist/persist-recorded-session-4IRYG5CJ.js +0 -3
  377. package/dist/phase-seed-2H6OXZXT.js +0 -2
  378. package/dist/pipeline-U7D25NST.js +0 -2
  379. package/dist/readmodel-KXCFPL2M.js +0 -2
  380. package/dist/real-device-run-QODMDUXF.js +0 -2
  381. package/dist/reconcile-deps-2CTIFXDR.js +0 -2
  382. package/dist/registry-MZYBLEW2.js +0 -2
  383. package/dist/remote-entry-DW2J56N4.js +0 -2
  384. package/dist/revert-37346WLE.js +0 -2
  385. package/dist/run-JWOHNWA3.js +0 -2
  386. package/dist/run-QFJ6ZRVD.js +0 -2
  387. package/dist/run-remote-66QTUQ2M.js +0 -2
  388. package/dist/run-test-md-7DRWCSQE.js +0 -19
  389. package/dist/spawner-C7NLLM4F.js +0 -2
  390. package/dist/store-choice-4J2NN6OQ.js +0 -2
  391. package/dist/stream-warnings-N4KVVWXV.js +0 -2
  392. package/dist/sync-cmd-3CHSWWWW.js +0 -2
  393. package/dist/tcg-generate-IPD5FQUW.js +0 -2
  394. package/dist/testmd-actions-V7P7BMKE.js +0 -2
  395. package/dist/token-refresh-LR33BKAB.js +0 -2
  396. package/dist/verdicts-7GKZEDHV.js +0 -2
  397. package/dist/with-telemetry-62LW4VFI.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as p}from"./chunk-GRURFGBP.js";import{a as g}from"./chunk-MYZHOBS4.js";import{existsSync as f}from"fs";import{isAbsolute as m,join as d,relative as v}from"path";function c(t){let n=f(d(t,".context"))?"assurance.json":"variables.json";return d(".testmuai","variables",n)}function h(t,n){if(!m(t))return t;let e=v(n,t);return e.startsWith("..")?t:e}function w(t,n){let e=t.used_by;if(e.length===0||e.every(s=>s.file===p))return"";if(n===void 0||!e.every(s=>s.file===n))return e.map(s=>`${s.file} step ${s.step}`).join(" \xB7 ");let a=[...new Set(e.map(s=>s.step))].sort((s,i)=>s-i);return a.length===1?`step ${a[0]}`:`steps ${a.join(", ")}`}function b(t,n){let e=new Map,a=new Map,s={header:"Not in any variables file",rows:[],declare:!0};for(let i of t){if(i.reason==="not_a_dataset_column"){let l=i.dataset??"",u=a.get(l);u||(u={header:`Not a column of dataset ${l}`.trimEnd(),rows:[],declare:!1},a.set(l,u)),u.rows.push(i);continue}if(i.reason!=="value_missing"){s.rows.push(i);continue}let r=h(i.file??c(n),n),o=e.get(r);o||(o={header:r===g?"Waiting for a value passed with --variables":`Waiting for a value in ${r}`,rows:[],declare:!1},e.set(r,o)),o.rows.push(i)}return[...e.values(),...a.values(),...s.rows.length>0?[s]:[]]}function $(t,n){let e=c(n);if(f(d(n,e)))return["",` Add ${t.length===1?"it":"them"} to ${e}`];let a=t.map(r=>`${JSON.stringify(r.name)}:`),s=Math.max(...a.map(r=>r.length))+1,i=a.map((r,o)=>` ${r.padEnd(s)}{ "value": "" }${o<a.length-1?",":""}`);return["",` Create ${e}:`,""," {",...i," }"]}function _(t,n){let e=t.length,a=`warning: ${e} variable${e===1?" has":"s have"} no value`,s=Math.max(...t.map(r=>r.name.length),8)+2,i=b(t,n.cwd).map(r=>{let o=[` ${r.header}`];for(let l of r.rows)o.push(` ${l.name.padEnd(s)}${w(l,n.entryFile)}`.trimEnd());return r.declare&&o.push(...$(r.rows,n.cwd)),o.join(`
2
+ import{a as p}from"./chunk-32MFECUA.js";import{a as g}from"./chunk-EHB55V23.js";import{existsSync as f}from"fs";import{isAbsolute as m,join as d,relative as v}from"path";function c(t){let n=f(d(t,".context"))?"assurance.json":"variables.json";return d(".testmuai","variables",n)}function h(t,n){if(!m(t))return t;let e=v(n,t);return e.startsWith("..")?t:e}function w(t,n){let e=t.used_by;if(e.length===0||e.every(s=>s.file===p))return"";if(n===void 0||!e.every(s=>s.file===n))return e.map(s=>`${s.file} step ${s.step}`).join(" \xB7 ");let a=[...new Set(e.map(s=>s.step))].sort((s,i)=>s-i);return a.length===1?`step ${a[0]}`:`steps ${a.join(", ")}`}function b(t,n){let e=new Map,a=new Map,s={header:"Not in any variables file",rows:[],declare:!0};for(let i of t){if(i.reason==="not_a_dataset_column"){let l=i.dataset??"",u=a.get(l);u||(u={header:`Not a column of dataset ${l}`.trimEnd(),rows:[],declare:!1},a.set(l,u)),u.rows.push(i);continue}if(i.reason!=="value_missing"){s.rows.push(i);continue}let r=h(i.file??c(n),n),o=e.get(r);o||(o={header:r===g?"Waiting for a value passed with --variables":`Waiting for a value in ${r}`,rows:[],declare:!1},e.set(r,o)),o.rows.push(i)}return[...e.values(),...a.values(),...s.rows.length>0?[s]:[]]}function $(t,n){let e=c(n);if(f(d(n,e)))return["",` Add ${t.length===1?"it":"them"} to ${e}`];let a=t.map(r=>`${JSON.stringify(r.name)}:`),s=Math.max(...a.map(r=>r.length))+1,i=a.map((r,o)=>` ${r.padEnd(s)}{ "value": "" }${o<a.length-1?",":""}`);return["",` Create ${e}:`,""," {",...i," }"]}function _(t,n){let e=t.length,a=`warning: ${e} variable${e===1?" has":"s have"} no value`,s=Math.max(...t.map(r=>r.name.length),8)+2,i=b(t,n.cwd).map(r=>{let o=[` ${r.header}`];for(let l of r.rows)o.push(` ${l.name.padEnd(s)}${w(l,n.entryFile)}`.trimEnd());return r.declare&&o.push(...$(r.rows,n.cwd)),o.join(`
3
3
  `)});return`${a}
4
4
 
5
5
  ${i.join(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as o,h as a}from"./chunk-2SY2NCOP.js";import{mkdirSync as p,writeFileSync as f,chmodSync as d,existsSync as m}from"fs";var y={darwin:"https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute",linux:"https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute",win32:"https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe"};function h(s){let t=y[s];if(!t)throw new Error(`unsupported platform for hyperexecute: ${s}`);return t}async function g(s,t={}){let i=t.platform??process.platform,u=t.existsImpl??m,c=t.fetchImpl??(r=>fetch(r)),e=a(s);if(u(e))return{status:"present",path:e};try{let r=h(i),n=await c(r);if(!n.ok)return{status:"failed",path:e,error:`download failed: HTTP ${n.status}`};let l=Buffer.from(await n.arrayBuffer());return p(o(s),{recursive:!0}),f(e,l),d(e,493),{status:"downloaded",path:e}}catch(r){return{status:"failed",path:e,error:r instanceof Error?r.message:String(r)}}}export{h as a,g as b};
2
+ import{g as o,h as a}from"./chunk-HHOVANJ7.js";import{mkdirSync as p,writeFileSync as f,chmodSync as d,existsSync as m}from"fs";var y={darwin:"https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute",linux:"https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute",win32:"https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe"};function h(s){let t=y[s];if(!t)throw new Error(`unsupported platform for hyperexecute: ${s}`);return t}async function g(s,t={}){let i=t.platform??process.platform,u=t.existsImpl??m,c=t.fetchImpl??(r=>fetch(r)),e=a(s);if(u(e))return{status:"present",path:e};try{let r=h(i),n=await c(r);if(!n.ok)return{status:"failed",path:e,error:`download failed: HTTP ${n.status}`};let l=Buffer.from(await n.arrayBuffer());return p(o(s),{recursive:!0}),f(e,l),d(e,493),{status:"downloaded",path:e}}catch(r){return{status:"failed",path:e,error:r instanceof Error?r.message:String(r)}}}export{h as a,g as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as s}from"./chunk-HCBYKLMW.js";import{a as m,b as o}from"./chunk-33DWJV67.js";import{z as i}from"./chunk-QMOGBKJM.js";import{e as x}from"./chunk-UR6MHSHU.js";var t=x(s(),1);function d({label:r,text:c,accent:a,color:n,width:l=15}){return(0,t.jsxs)(o,{children:[(0,t.jsx)(o,{color:i.dim,children:` ${r.padEnd(l)}`}),(0,t.jsx)(o,{color:n??(a?i.assuranceAccent:void 0),children:c})]})}function u({head:r,rows:c,minWidth:a=15}){let n=c.filter(e=>e.text),l=Math.max(a,...n.map(e=>e.label.length+2));return(0,t.jsxs)(m,{flexDirection:"column",children:[r?(0,t.jsx)(o,{bold:!0,children:r}):null,n.map((e,p)=>(0,t.jsx)(d,{label:e.label,text:e.text,color:e.color,width:l},p))]})}export{d as a,u as b};
2
+ import{a as s}from"./chunk-HCBYKLMW.js";import{a as m,b as o}from"./chunk-33DWJV67.js";import{z as i}from"./chunk-FAMQ4DHU.js";import{e as x}from"./chunk-UR6MHSHU.js";var t=x(s(),1);function d({label:r,text:c,accent:a,color:n,width:l=15}){return(0,t.jsxs)(o,{children:[(0,t.jsx)(o,{color:i.dim,children:` ${r.padEnd(l)}`}),(0,t.jsx)(o,{color:n??(a?i.assuranceAccent:void 0),children:c})]})}function u({head:r,rows:c,minWidth:a=15}){let n=c.filter(e=>e.text),l=Math.max(a,...n.map(e=>e.label.length+2));return(0,t.jsxs)(m,{flexDirection:"column",children:[r?(0,t.jsx)(o,{bold:!0,children:r}):null,n.map((e,p)=>(0,t.jsx)(d,{label:e.label,text:e.text,color:e.color,width:l},p))]})}export{d as a,u as b};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as A,d as C}from"./chunk-4SJAOAYY.js";import{e as x}from"./chunk-5D7ENQTQ.js";import{b,e as R}from"./chunk-YGMQXS2J.js";import{f as D,h as S,l as E}from"./chunk-MJKRJGER.js";import{b as I,c as _,g as N,h as k}from"./chunk-Y6Y6RAY4.js";import{b as h}from"./chunk-PQXYHI5W.js";import{a as v}from"./chunk-GGV336P5.js";import{h as y}from"./chunk-A7RJQJNT.js";import{mkdirSync as H,writeFileSync as q}from"fs";import{join as z}from"path";function P(e,t=process.env){return t.KANE_MOBILE_APP_BASE_URL||v(e).mobileAppBaseUrl}var J="device-config.json",$=new WeakMap;function G(e,t){let r=$.get(e)??new Map;$.set(e,r);let o=JSON.stringify([t.path,t.type,t.env,t.orgId]),i=r.get(o);if(i)return i;let n=e(t).finally(()=>r.delete(o));return r.set(o,n),n}function T(e){return e.startsWith("lt://")?e:`lt://${e}`}async function X(e,t){let r=await E(e.env,e.platform,{...e.selection.deviceName?{deviceName:e.selection.deviceName.value}:{},...e.selection.osVersion?{osVersion:e.selection.osVersion.value}:{}},t);if(r.kind==="unchecked"&&e.onWarning?.(`${r.reason} \u2014 the run continues, but the device and OS version are not checked before the session is requested.`),r.kind==="refused")throw new Error(r.detail)}async function Y(e,t){let r=e.selection.app.value.trim();if(h(r))return T(r);let o=e.credentials;if(!o?.orgId)throw new Error(`${r} has to be uploaded before it can run on a real device, but your account's org id was not found. Run kane-cli login, or set app: to an app ID from \`kane-cli apps list --target ${e.platform}\`.`);let i=await G(t,{path:r,type:e.platform,env:e.env,orgId:o.orgId,userId:o.userId??"",auth:{username:o.username,accessKey:o.accessKey,orgId:o.orgId},baseUrl:P(e.env),...e.onProgress?{onProgress:e.onProgress}:{}});if(b(i))throw new Error(`could not upload ${r} for this real-device run: ${i.reason}`);return T(i.appUrl??i.appId)}async function U(e,t={}){if(!e.credentials)throw new Error("a real-device run needs your TestMu AI username and access key, and none were found. Run kane-cli login, or pass --username and --access-key.");await X(e,t.fetchCatalog??S);let r=await Y(e,t.upload??R),{deviceName:o,osVersion:i}=e.selection,n={platform_name:e.platform,device_name:o?.value??D,...i?{platform_version:i.value}:{},app:r,...e.testName?{test_name:e.testName}:{},...e.tcId?{"tms.tc_id":e.tcId}:{},...e.capabilities},s=z(e.outDir,J);return H(e.outDir,{recursive:!0}),q(s,`${JSON.stringify(n,null,2)}
2
+ import{c as A,d as C}from"./chunk-BJT6PZXL.js";import{e as x}from"./chunk-5D7ENQTQ.js";import{b,e as R}from"./chunk-KN7GZWKK.js";import{f as D,h as S,l as E}from"./chunk-V3OZJO7Y.js";import{b as I,c as _,g as N,h as k}from"./chunk-Y6Y6RAY4.js";import{b as h}from"./chunk-75FF7J5R.js";import{a as v}from"./chunk-FI2DVNRT.js";import{h as y}from"./chunk-A7RJQJNT.js";import{mkdirSync as H,writeFileSync as q}from"fs";import{join as z}from"path";function P(e,t=process.env){return t.KANE_MOBILE_APP_BASE_URL||v(e).mobileAppBaseUrl}var J="device-config.json",$=new WeakMap;function G(e,t){let r=$.get(e)??new Map;$.set(e,r);let o=JSON.stringify([t.path,t.type,t.env,t.orgId]),i=r.get(o);if(i)return i;let n=e(t).finally(()=>r.delete(o));return r.set(o,n),n}function T(e){return e.startsWith("lt://")?e:`lt://${e}`}async function X(e,t){let r=await E(e.env,e.platform,{...e.selection.deviceName?{deviceName:e.selection.deviceName.value}:{},...e.selection.osVersion?{osVersion:e.selection.osVersion.value}:{}},t);if(r.kind==="unchecked"&&e.onWarning?.(`${r.reason} \u2014 the run continues, but the device and OS version are not checked before the session is requested.`),r.kind==="refused")throw new Error(r.detail)}async function Y(e,t){let r=e.selection.app.value.trim();if(h(r))return T(r);let o=e.credentials;if(!o?.orgId)throw new Error(`${r} has to be uploaded before it can run on a real device, but your account's org id was not found. Run kane-cli login, or set app: to an app ID from \`kane-cli apps list --target ${e.platform}\`.`);let i=await G(t,{path:r,type:e.platform,env:e.env,orgId:o.orgId,userId:o.userId??"",auth:{username:o.username,accessKey:o.accessKey,orgId:o.orgId},baseUrl:P(e.env),...e.onProgress?{onProgress:e.onProgress}:{}});if(b(i))throw new Error(`could not upload ${r} for this real-device run: ${i.reason}`);return T(i.appUrl??i.appId)}async function U(e,t={}){if(!e.credentials)throw new Error("a real-device run needs your TestMu AI username and access key, and none were found. Run kane-cli login, or pass --username and --access-key.");await X(e,t.fetchCatalog??S);let r=await Y(e,t.upload??R),{deviceName:o,osVersion:i}=e.selection,n={platform_name:e.platform,device_name:o?.value??D,...i?{platform_version:i.value}:{},app:r,...e.testName?{test_name:e.testName}:{},...e.tcId?{"tms.tc_id":e.tcId}:{},...e.capabilities},s=z(e.outDir,J);return H(e.outDir,{recursive:!0}),q(s,`${JSON.stringify(n,null,2)}
3
3
  `),{device:{platform:e.platform,target:e.platform,device_config_path:s},...o?{deviceName:o.value}:{},...i?{osVersion:i.value}:{},app:r}}import{createServer as Q}from"http";import{randomBytes as Z}from"crypto";import{spawn as ee}from"child_process";import{mkdtempSync as re,readdirSync as te,readFileSync as oe,rmSync as ie,writeFileSync as ne}from"fs";import{tmpdir as W}from"os";import{join as w}from"path";function M(e,t,r,o){let i=Buffer.from(`${o.username}:${o.accessKey}`).toString("base64"),n=new URLSearchParams({session:r,auth:i});return t==="ios"&&n.set("mode","webrtc"),`${e.replace(/\/+$/,"")}/?${n.toString()}`}function V(e){return e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`)}function ae(e){return`<!doctype html>
4
4
  <html lang="en">
5
5
  <head>
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as y,e as k}from"./chunk-KF4DKXSS.js";import{spawn as A}from"child_process";var S=new Set(["progress","ask_user","graph_query","ingest_request","proposal","design","impact","error","done","reasoning_delta","reasoning_done","tool_activity","decision_activity","text_delta","usage","receipt","chat_ops","session_paused","session_complete","state_checkpoint","turn_retry"]),M=5e3,E=new Set(["done","session_paused","error"]);function R(u,t={}){let a=t.spawnCmd!==void 0?t.spawnCmd:y();if(!a)throw new Error("assurance agent not found \u2014 your platform package may be missing; reinstall kane-cli (npm i -g @testmuai/kane-cli)");let h=u.source.images?.length??0;a.tier==="dev-python"&&h>0&&t.onWarn?.("warn: development agent in use \u2014 if image citations are missing, update the agent package");let n=A(a.cmd,a.args,{stdio:["pipe","pipe","pipe"],env:k(u.session_id,t.auth)});if(n.stdin.on("error",e=>{e.code!=="EPIPE"&&t.onWarn?.(`agent stdin: ${e.message}`)}),n.stdin.write(JSON.stringify(u)+`
2
+ import{c as y,e as k}from"./chunk-CB344EDO.js";import{spawn as A}from"child_process";var S=new Set(["progress","ask_user","graph_query","ingest_request","proposal","design","impact","error","done","reasoning_delta","reasoning_done","tool_activity","decision_activity","text_delta","usage","receipt","chat_ops","session_paused","session_complete","state_checkpoint","turn_retry"]),M=5e3,E=new Set(["done","session_paused","error"]);function R(u,t={}){let a=t.spawnCmd!==void 0?t.spawnCmd:y();if(!a)throw new Error("assurance agent not found \u2014 your platform package may be missing; reinstall kane-cli (npm i -g @testmuai/kane-cli)");let h=u.source.images?.length??0;a.tier==="dev-python"&&h>0&&t.onWarn?.("warn: development agent in use \u2014 if image citations are missing, update the agent package");let n=A(a.cmd,a.args,{stdio:["pipe","pipe","pipe"],env:k(u.session_id,t.auth)});if(n.stdin.on("error",e=>{e.code!=="EPIPE"&&t.onWarn?.(`agent stdin: ${e.message}`)}),n.stdin.write(JSON.stringify(u)+`
3
3
  `),n.stdout.setEncoding("utf8"),n.stderr.setEncoding("utf8"),t.onStderr){let e="";n.stderr.on("data",r=>{e+=r;let i;for(;(i=e.indexOf(`
4
4
  `))>=0;){let o=e.slice(0,i);e=e.slice(i+1),o.trim()&&t.onStderr(o)}})}let g=!1,d=new Promise(e=>{n.on("exit",(r,i)=>{g=!0,e({code:r,signal:i})})}),p=null,f=()=>(p??=(async()=>{if(g||n.pid===void 0)return;n.kill("SIGTERM");let e=setTimeout(()=>{g||n.kill("SIGKILL")},t.killGraceMs??M);e.unref?.(),await d,clearTimeout(e)})(),p),l,v=()=>{l===void 0&&(l=setTimeout(()=>{f()},t.killGraceMs??M),l.unref?.())};d.then(()=>clearTimeout(l));async function*w(){let e="",r=!1;for await(let i of n.stdout){e+=i;let o;for(;(o=e.indexOf(`
5
5
  `))>=0;){let c=e.slice(0,o).trim();if(e=e.slice(o+1),!c)continue;let m;try{m=JSON.parse(c)}catch{t.onWarn?.(`agent: skipping malformed line: ${c.slice(0,120)}`);continue}let s=m;if(!s||typeof s!="object"||!S.has(s.type)){t.onWarn?.(`agent: skipping unknown event type "${s&&typeof s=="object"?String(s.type??"?"):"?"}"`);continue}if(E.has(s.type)&&v(),yield s,s.type==="done"){r=!0;break}}if(r)break}await d.catch(()=>{})}return{events:w(),send:e=>{n.stdin&&!n.stdin.destroyed&&n.stdin.write(JSON.stringify(e)+`
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as Tr}from"./chunk-GI2JPIX5.js";import{a as dn,c as mn,e as Et,f as Je,g as $r,h as Rr,i as gn,j as Cr}from"./chunk-FVYIV36L.js";import{a as St,b as un}from"./chunk-AU26ZZTX.js";import{a as ln,b as wr}from"./chunk-RARD6TC6.js";import{a as xr,b as kr,c as vr}from"./chunk-JT6WLJSV.js";import{a as pr,b as ue}from"./chunk-7C4IEL5V.js";import{a as dr}from"./chunk-5Y2G4NC7.js";import{c as Rt}from"./chunk-SMXABALN.js";import{b as fr}from"./chunk-WN5VKKJ3.js";import{b as fn}from"./chunk-HD6NR44L.js";import{a as Ct,b as an,c as Ye,d as yr,e as cn}from"./chunk-BWXLZS5O.js";import{e as ze,f as S,g as br}from"./chunk-ZGQM6KWN.js";import{b as gr,c as Ge,d as hr}from"./chunk-22PIMG52.js";import{na as mr,oa as on}from"./chunk-Z777GGHB.js";import{a as ur}from"./chunk-WQR2GYP7.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a as w,b as r,k as Me}from"./chunk-33DWJV67.js";import{a as cr}from"./chunk-6YGTRKDT.js";import{z as o}from"./chunk-QMOGBKJM.js";import{e as U}from"./chunk-UR6MHSHU.js";var bn=U(cr(),1);var g=U(cr(),1);var m=U(Y(),1),Wi=60,Vi=100;function hn(e,s){let c=e.options.length,f=c,p=e.multi_select?f++:null,a=e.allow_free_text?f++:null,u=s?f++:null;return{optionCount:c,doneIdx:p,freeIdx:a,batchIdx:u,maxSel:f-1}}var Ki="\xA0",Ui={high:{text:`\u203C${Ki}high`,color:o.red},med:{text:"med",color:"yellow"},low:{text:"low",color:o.dim}};function Hi(e){let s=(e.header??e.text.split(/\s+/).slice(0,3).join(" ")).trim();return s.length>16?`${s.slice(0,15)}\u2026`:s}function Qi(e,s,c){let f=x=>e[x].length+6,p=f(s),a=s,u=s;for(;;){let x=u+1<e.length?f(u+1):1/0,y=a-1>=0?f(a-1):1/0;if(x===1/0&&y===1/0)break;if(x<=y){if(p+x>c)break;p+=x,u+=1}else{if(p+y>c)break;p+=y,a-=1}}return{lo:a,hi:u}}function Sr({batch:e,qView:s,sel:c=0,focused:f=!1,freeText:p=null,optionText:a=null,attach:u=null,multiSelFor:x,childPrefix:y,gapAbove:T=!0}){let{stdout:P}=Me(),V=P?.columns??80,re=V<Wi,C=Math.min(V-1,Vi),b=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),I=e.questions[b],pe=e.resolution[b],q=e.resolution.filter(B=>!B).length,fe=e.questions.length-q,we=St(e),W=hn(I,we!==""),xe=x?x(b):[],ie=Ui[I.risk],Z=B=>f&&c===B?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" ",A=`? ${y??""}the agent needs ${q===1?"one answer":`${q} answers`}`,Pe=e.questions.length>1?` \xB7 ${b+1} of ${e.questions.length} \xB7 ${fe} answered`:"",H=(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsxs)(r,{bold:!0,children:[I.text,ie?(0,m.jsx)(r,{color:ie.color,bold:!1,children:` ${ie.text}`}):null]})}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:I.rationale})}),(0,m.jsx)(r,{children:" "}),I.options.map((B,$)=>{let Q=f&&c===$;return a&&a.optionIndex===$?(0,m.jsx)(w,{flexDirection:"column",children:(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:`${$+1}. ${un(B.label)}`}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:a.value,onChange:a.onChange,onSubmit:a.onSubmit,onCancel:a.onCancel,placeholder:B.detail||"type your answer"})]})},`o-${$}`):(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsxs)(r,{children:[Z($)," ",I.multi_select?(0,m.jsx)(r,{color:xe.includes($)?o.green:o.dim,children:xe.includes($)?"[x] ":"[ ] "}):null,(0,m.jsx)(r,{color:Q?o.assuranceAccent:void 0,children:`${$+1}. ${un(B.label)}`}),$===I.recommended_index?(0,m.jsx)(r,{color:o.dim,children:" (recommended)"}):null,pe?.selected_index===$?(0,m.jsx)(r,{color:o.dim,children:" (current)"}):null]}),B.detail?(0,m.jsx)(w,{paddingLeft:5,children:(0,m.jsx)(r,{color:o.dim,children:B.detail})}):null]},`o-${$}`)}),I.multi_select&&W.doneIdx!=null?(0,m.jsxs)(r,{children:[Z(W.doneIdx)," ",(0,m.jsx)(r,{color:o.green,children:"\u2714"}),(0,m.jsx)(r,{color:f&&c===W.doneIdx?o.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,m.jsx)(r,{children:" "}):null,I.allow_free_text?p?(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.dim,children:"\u270E "})]}),(0,m.jsx)(Rt,{value:p.value,onChange:p.onChange,onSubmit:p.onSubmit,onCancel:p.onCancel,placeholder:"Tell me what to do"})]}):(0,m.jsxs)(r,{children:[W.freeIdx!=null?Z(W.freeIdx):" "," ",(0,m.jsx)(r,{color:f&&W.freeIdx!=null&&c===W.freeIdx?o.assuranceAccent:o.dim,children:"\u270E Tell me what to do"})]}):null,u?(0,m.jsxs)(w,{flexDirection:"column",marginTop:1,children:[(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"@ attach a file or URL"}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:"path or URL"})]}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),F=we!==""?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(r,{children:" "}),(0,m.jsxs)(r,{children:[f&&W.batchIdx!=null&&c===W.batchIdx?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" "," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"\xBB"}),(0,m.jsx)(r,{bold:!0,color:f&&W.batchIdx!=null&&c===W.batchIdx?o.assuranceAccent:void 0,children:" Go with recommendations"}),q>=5?(0,m.jsx)(r,{color:o.dim,children:` \u2014 resolves all ${q} open`}):null,(0,m.jsx)(r,{color:o.dim,children:" (tab)"})]})]}):null;if(re)return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsx)(r,{color:o.assuranceAccent,bold:!0,children:A}),e.questions.length>1?(0,m.jsx)(r,{color:o.dim,children:Pe.replace(/^ · /,"")}):null,(0,m.jsx)(r,{children:" "}),H,F]});let h=e.questions.map(B=>Hi(B)),me=e.questions.length>1?Qi(h,b,C-8):null;return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsxs)(r,{color:o.assuranceAccent,children:[(0,m.jsx)(r,{bold:!0,children:A}),Pe?(0,m.jsx)(r,{color:o.dim,children:Pe}):null]}),me?(0,m.jsx)(w,{marginTop:1,children:(0,m.jsxs)(r,{children:[me.lo>0?(0,m.jsx)(r,{color:o.dim,children:"\u25C0 "}):" ",e.questions.slice(me.lo,me.hi+1).map((B,$)=>{let Q=me.lo+$,et=$>0?" ":"";return Q===b?(0,m.jsxs)(r,{children:[et,(0,m.jsx)(r,{backgroundColor:o.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[Q]} `})]},B.id):(0,m.jsxs)(r,{children:[et,e.resolution[Q]?(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.green,children:"\u2713 "}),(0,m.jsx)(r,{color:o.dim,children:h[Q]})]}):(0,m.jsx)(r,{color:o.dim,children:`\u25CB ${h[Q]}`})]},B.id)}),me.hi<e.questions.length-1?(0,m.jsx)(r,{color:o.dim,children:" \u25B6"}):null]})}):null,(0,m.jsx)(r,{children:" "}),H,F]})}var Er={ac:["acceptance criterion","acceptance criteria"],gap:["open question","open questions"],scenario:["scenario","scenarios"],test:["test","tests"],"use-case":["use-case","use-cases"]},pn=e=>Er[e]?.[1]??`${e}s`,At={label:(e,s)=>s===1?Er[e]?.[0]??e:pn(e),skip:new Set(["exercise"])},xn={ac:null,test:null,gap:null,scenario:"kind"},Xi=(e,s,c)=>`${e} ${e===1?s:c}`,Gi=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function Ar(e){let s=e.covers?on(e.covers):"1 scenario",c=e.verifies.slice(0,2).map(on),f=e.verifiesTotal-c.length,p=c.length===0?Xi(e.verifiesTotal,"acceptance criterion","acceptance criteria"):Gi([...c,...f>0?[`${f} more`]:[]]);return`covers ${s} \xB7 verifies ${p}`}function Dr(e,s){let c=typeof s=="string"&&s!==""?s.split(", "):[],f=p=>typeof p=="string"&&mr.test(p);return{covers:f(e)?e:null,verifies:c.filter(f),verifiesTotal:c.length}}var Dt={"acceptance criteria":{name:"acceptance criteria",next:"scenarios",done:"acceptance criteria say what the use-case must always do"},scenarios:{name:"scenarios",next:"scenario checks",done:"scenarios are the paths a user takes that test the criteria"},"acceptance criteria + exercises":{name:"scenario checks",next:"tests",done:"scenario checks say which criteria each scenario checks"},"tests + gaps":{name:"tests"},tests:{name:"tests"}};function Ze(e){let s=Dt[e]?.name;if(s)return s;let c={exercises:"scenario checks",gaps:"open questions"};return[...new Set(e.split(" + ").map(f=>c[f]??f))].join(" + ")}var Ir={scenarios:"next, scenarios: the paths a user takes that test them","scenario checks":"next, scenario checks: which criteria each scenario checks",tests:"next, tests: runnable tests, and open questions for what can't run"},Br="phases: acceptance criteria \u2192 scenarios \u2192 scenario checks \u2192 tests";var k=U(Y(),1),zi=e=>e.startsWith("designing: ")?`designing: ${Ze(e.slice(11))}`:e;function Yi(e,s){let c=e.form==="assumed"?" (assumed)":e.form==="deferred"?"":" (you)",f=e.note?` \u2014 ${e.note}`:"",p=s?`"${e.stub}"`:`q${e.qNum} ${e.stub}`;return e.form==="deferred"?`\u21B3 deferred ${p}${f}`:e.form==="changed"?`\u21B3 changed ${p}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${c}${f}`:`\u21B3 ${e.form} ${p}: ${e.choice??"?"}${c}${f}`}var Ji=()=>(process.stdout?.columns??100)-12,Zi=new Set(["banner","header","user","agent","worked","childOpen","lines"]);function Lr({block:e,annotations:s,remote:c=!1,afterHeader:f=!1}){let p=e.era??0,{stdout:a}=Me(),u=c||p>0?(a?.columns??100)-p*2:null,x=ns(e,s??null,c,u,(a?.columns??100)-p*2),y=p>0?(0,k.jsx)(w,{marginLeft:p*2,children:x}):x;return f&&!Zi.has(e.kind)?(0,k.jsx)(w,{marginTop:1,children:y}):y}var es=new RegExp("[\\u1100-\\u115F\\u2E80-\\u303E\\u3041-\\uA4CF\\uAC00-\\uD7A3\\uF900-\\uFAFF\\uFE10-\\uFE19\\uFE30-\\uFE6F\\uFF00-\\uFF60\\uFFE0-\\uFFE6\\u{20000}-\\u{3FFFD}\u2714\u26A0]|\\p{Emoji_Presentation}","u"),It=e=>[...e].reduce((s,c)=>s+(es.test(c)?2:1),0);function ts(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s){let x=a?`${a} \xB7 ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function _e(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s.split(" ")){let x=a?`${a} ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function ns(e,s,c,f=null,p=100){switch(e.kind){case"banner":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{bold:!0,color:o.assuranceAccent,children:` ${c?zi(e.text):e.text}`})});case"header":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${e.text}`,e.tail?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.tail}`}):null]})});case"user":return(0,k.jsxs)(w,{marginTop:1,children:[(0,k.jsx)(r,{color:o.orange,children:"\u276F "}),(0,k.jsx)(r,{children:e.text})]});case"note":return(0,k.jsx)(r,{color:o.dim,children:` ${e.text}`});case"lines":return(0,k.jsx)(w,{flexDirection:"column",marginTop:1,children:e.lines.map((a,u)=>(0,k.jsx)(r,{...a.dim?{color:o.dim}:{},children:a.text},u))});case"agent":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(kr,{text:e.text,accent:o.assuranceAccent,indent:f===null?0:(e.era??0)*2})});case"worked":return(0,k.jsx)(w,{marginTop:1,flexDirection:"column",children:ts(" \u2699 ",hr(e.durS,e.toolCalls,e.tools),p).map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},u))});case"usage":return(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let a=s,u=(a?a.fresh:e.items.map((C,b)=>({item:C,num:b+1,updated:!1}))).filter(C=>!(c&&At.skip?.has(C.item.kind??""))),x={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"risk",stylenote:"kind"},y=C=>C.kind??"use-case",T=new Map;for(let C of u){let b=C.item,I=y(C.item),pe=c&&I==="test"?{title:b.title,summary:Ar(b.links??Dr(b.extra?.automates,b.extra?.verifies)),badge:""}:c&&I==="gap"?{title:b.question??"",summary:b.rationale??"",badge:""}:null,q=b.risk==="high"||b.risk==="med"||b.risk==="low"?b.risk:void 0,fe=b.logical_id??(c?b.matched_id:void 0),we={id:fe??"",staged:!fe,...c&&b.held&&!fe?{held:!0}:{},title:pe?.title??b.title,badge:pe?.badge??b.badge??b.risk??"",summary:pe?.summary??b.why??b.summary??b.description??"",...q?{risk:q}:{},...C.updated?{marker:"\u21B3 changed"}:{}},W=T.get(I)??[];W.push(we),T.set(I,W)}let P=u.some(C=>!!C.item.kind),V=(a?.unchanged??[]).reduce((C,b)=>C+b.count,0),re=a?.headerStats?` \u2014 ${a.headerStats}${V>0?` (${V} unchanged)`:""}`:"";return(0,k.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(0,k.jsxs)(r,{bold:!0,children:[P?"design":e.heading,re?(0,k.jsx)(r,{bold:!1,color:o.dim,children:re}):null]}),[...T.entries()].map(([C,b])=>(0,k.jsxs)(w,{flexDirection:"column",children:[T.size>1?(0,k.jsx)(r,{color:o.dim,children:`${c?pn(C):Ct(C)} \xB7 ${b.length}`}):null,(0,k.jsx)(Tr,{rows:b,width:Ji(),badgeHeader:c&&C in xn?xn[C]:x[C]??"info"})]},C)),a&&a.unchanged.length>0&&(0,k.jsx)(r,{color:o.dim,children:` \u22EE unchanged: ${a.unchanged.map(C=>`${C.count} ${C.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,k.jsx)(r,{color:o.dim,children:Yi(e.receipt,c)});case"continued":return(0,k.jsx)(r,{color:o.dim,children:"\u21B3 continued"});case"childOpen":{if(c)return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{color:o.assuranceAccent,children:`\u25CF ${e.update?S.updateOpen(e.subject,e.changed===!0):S.childOpen(e.verb,e.subject)}`})});let{ing:a}=fn(e.verb);return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${a} ${e.subject}`,e.sid?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.sid}`}):null,e.note?(0,k.jsx)(r,{color:o.dim,children:` ${e.note}`}):null]})})}case"childClose":{if(e.held)return(0,k.jsx)(w,{});if(c&&e.update){let x=[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.updateFailed(e.subject)}`});if(e.untouched)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUntouched(e.subject)} \u2014 ${x.join(" \xB7 ")}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUnfinished(e.subject)} \u2014 ${x.join(" \xB7 ")}`});let y=e.testsWritten?S.updateTests(e.testsWritten):null,T=[x[0],...y?[y]:[],...x.slice(1)];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.updateClosed(e.subject,T)}`})}if(c){if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.childFailed(e.verb,e.subject)}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${[S.childUnfinished(e.verb),[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ")].join(" \u2014 ")}`});let x=[Ge(e.durS),...e.tests?[S.childTests(e.verb,e.tests)]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.childClosed(e.verb,e.subject,x)}`})}let{ed:a}=fn(e.verb);if(!e.ok)return(0,k.jsxs)(r,{color:o.red,children:[`\u25CF ${e.verb} failed \u2014 ${e.exitCode!=null?`exited ${e.exitCode}`:"error"}`,e.fixCmd?(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.fixCmd}`}):null]});let u=[Ge(e.durS),...e.results?[e.results]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${a} ${e.subject} \u2014 ${u}`})}case"childBack":return(0,k.jsx)(r,{color:o.dim,children:`back with ${e.parentVerb} \u2014 ${e.context}`});case"commit":if(c&&e.person&&!e.ok&&e.refused?.length){let a=S.approveRefused(e.refused);return(0,k.jsxs)(w,{flexDirection:"column",children:[_e(" \u2717 ",a.line,f??100).map((u,x)=>(0,k.jsx)(r,{color:o.red,children:u},`p-${x}`)),a.notes.flatMap((u,x)=>_e(" ",u,f??100).map((y,T)=>(0,k.jsx)(r,{color:o.dim,children:y},`n-${x}-${T}`)))]})}return(0,k.jsxs)(w,{flexDirection:"column",children:[c&&e.held?_e(" \u2016 ",e.line,f??100).map((a,u)=>(0,k.jsx)(r,{children:a},`h-${u}`)):f!==null?_e(` ${e.ok?"\u2714":"\u2717"} `,e.line,f).map((a,u)=>(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:a},`c-${u}`)):(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),c&&e.refused?.length?S.chatRefused(e.refused).flatMap((a,u)=>_e(" ",a,f??100).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`r-${u}-${y}`))):(e.warnings??[]).flatMap((a,u)=>!c&&f!==null&&(e.era??0)>0?_e(" \u26A0 ",a,f).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`w-${u}-${y}`)):[(0,k.jsx)(r,{color:o.dim,children:` \u26A0 ${a}`},`w-${u}`)])]});case"error":return(0,k.jsxs)(ur,{variant:"error",paddingX:1,children:[(0,k.jsx)(r,{color:o.red,children:e.title}),e.detail.map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},`d-${u}`))]})}}var Oe=U(Y(),1);function Mr({item:e}){return(0,Oe.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,c)=>(0,Oe.jsx)(r,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${c}`)),(e.depends_on_hint??[]).length>0&&(0,Oe.jsx)(r,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,c])=>(0,Oe.jsx)(r,{dimColor:!0,children:`${s}: ${c}`},`extra-${s}`))]})}var E=U(Y(),1),kn=(e,s)=>Math.max(0,Math.min(s,e));function Lt(e,s,c){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:kn(e.cursor+s.delta,Math.max(0,c-1))};case"enter":return e.level==="list"?{...e,level:"detail",scroll:0}:e;case"back":return e.level==="detail"?{...e,level:"list",scroll:0}:null}}var Or={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function Pr(e,s){if(e.level==="detail")return{level:"detail",cursor:kn(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let c=s.entries.findIndex(f=>Or[f.kind]===e.section);if(c>=0)return{level:"list",cursor:c}}return{level:"list",cursor:0}}function rs(e){let s=[];for(let c of e.entries){let f=s.find(p=>p.kind===c.kind);f?f.entries.push(c):s.push({kind:c.kind,entries:[c]})}return s}var _r=3;function is({items:e,cursor:s,verb:c,more:f}){let p=`view \xB7 ${c} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,a=e.entries[s];return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,color:o.assuranceAccent,children:p}),rs(e).map(({kind:u,entries:x})=>{let y=a?.kind===u,T=y?x.findIndex(C=>C.num===a.num):-1,P=y?kn(T-1,Math.max(0,x.length-_r)):0,V=x.slice(P,P+(y?_r:1)),re=x.length-V.length;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{color:o.dim,children:`${Or[u]??Ct(u)} \xB7 ${x.length}`}),V.map(C=>{let b=y&&C.num===a.num,I=C.item.badge;return(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:b?"\u203A ":" "}),(0,E.jsx)(r,{children:`${C.num} \xB7 ${C.item.title}`}),I?(0,E.jsx)(r,{color:o.dim,children:` \xB7 ${I}`}):null]},`${C.kind}:${C.num}`)}),re>0&&(0,E.jsx)(r,{color:o.dim,children:` \u22EE ${re} more`})]},u)}),f?(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,E.jsx)(r,{color:o.dim,children:`\u22EF show all \u2014 ${f.hidden} more from earlier turns`})]}):null]})}var Bt=14;function ss({items:e,cursor:s,explain:c,grandTotal:f,dossier:p,scroll:a=0}){let u=e.entries[s];if(!u)return(0,E.jsx)(r,{color:o.dim,children:"nothing to show"});if(p){let y=Math.max(0,Math.min(a,Math.max(0,p.lines.length-Bt))),T=p.lines.slice(y,y+Bt);return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsxs)(r,{bold:!0,children:[`view \xB7 ${p.id}`,p.id.toLowerCase()!==p.rawId?(0,E.jsx)(r,{bold:!1,color:o.dim,children:` \xB7 ${p.rawId}`}):null]}),(0,E.jsx)(r,{bold:!0,children:p.title}),y>0?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${y} above`}):null,T.map((P,V)=>(0,E.jsx)(r,{color:P.dim?o.dim:void 0,children:P.text},`dl-${V}`)),p.lines.length>y+Bt?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${p.lines.length-y-Bt} more`}):null]})}let x=u.item;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${f??e.entries.length}`}),(0,E.jsx)(r,{children:u.item.title}),x.badge?(0,E.jsx)(r,{color:o.dim,children:`kind: ${x.badge}`}):null,x.why?(0,E.jsx)(r,{color:o.dim,children:x.why}):null,(0,E.jsx)(Mr,{item:u.item}),c?.map((y,T)=>(0,E.jsx)(r,{color:o.dim,children:y},`ex-${T}`)),(0,E.jsx)(r,{color:o.dim,children:"view-only \u2014 approvals happen in chat"})]})}function jr({items:e,state:s,verb:c,more:f,explain:p,grandTotal:a,dossier:u=null}){return s.level==="list"?(0,E.jsx)(is,{items:e,cursor:s.cursor,verb:c,more:f}):(0,E.jsx)(ss,{items:e,cursor:s.cursor,explain:p,grandTotal:a,dossier:u,scroll:s.scroll??0})}var J=U(Y(),1),vn=14;function os(e){let s=[],c=null;for(let f of e)f.field!==c&&(c=f.field,s.push({kind:"field",field:c})),s.push({kind:"line",field:c,line:f});return s}function Fr({title:e,lines:s,offset:c=0,remote:f=!1}){let p=os(s),a=Math.max(0,Math.min(c,Math.max(0,p.length-vn))),u=p.slice(a,a+vn),x=a,y=Math.max(0,p.length-a-vn),T=f?`the change to ${e} \xB7 old \u2192 new`:`view \xB7 diff \xB7 ${e} \xB7 current \u2192 proposed`;return(0,J.jsxs)(w,{flexDirection:"column",children:[(0,J.jsx)(r,{bold:!0,color:o.assuranceAccent,children:T}),x>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${x} above`})}):null,u.map((P,V)=>P.kind==="field"?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:P.field==="criteria"?f?"acceptance criteria":"criteria":P.field})},`r-${a+V}`):(0,J.jsx)(w,{paddingLeft:4,children:(0,J.jsx)(r,{color:P.line.op==="-"?"red":"green",children:`${P.line.op==="-"?"\u2212":"+"} ${P.line.text}`})},`r-${a+V}`)),y>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${y} more`})}):null]})}var ls={"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 qr(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let f=parseInt(s,10);return f>=1?{level:"detail",num:f}:{error:"items are numbered from 1 \u2014 /view 1"}}let c=ls[s];return c?{level:"list",section:c}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var D=U(Y(),1),as=6,Nr=12;function cs(e,s,c){let f=Math.max(20,s),p=[];for(let u of e.split(`
2
+ import{b as Tr}from"./chunk-ZZZGTDYE.js";import{a as dn,c as mn,e as Et,f as Je,g as $r,h as Rr,i as gn,j as Cr}from"./chunk-4LGQHTXM.js";import{a as St,b as un}from"./chunk-JTNEF5ZP.js";import{a as ln,b as wr}from"./chunk-GZQAETB2.js";import{a as xr,b as kr,c as vr}from"./chunk-ET5EK2CM.js";import{a as pr,b as ue}from"./chunk-HG2ILWCE.js";import{a as dr}from"./chunk-5Y2G4NC7.js";import{c as Rt}from"./chunk-SMXABALN.js";import{b as fr}from"./chunk-WN5VKKJ3.js";import{b as fn}from"./chunk-HD6NR44L.js";import{a as Ct,b as an,c as Ye,d as yr,e as cn}from"./chunk-BWXLZS5O.js";import{e as ze,f as S,g as br}from"./chunk-3V4J65GN.js";import{b as gr,c as Ge,d as hr}from"./chunk-22PIMG52.js";import{na as mr,oa as on}from"./chunk-PI7OXS62.js";import{a as ur}from"./chunk-M3TFOFUQ.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a as w,b as r,k as Me}from"./chunk-33DWJV67.js";import{a as cr}from"./chunk-6YGTRKDT.js";import{z as o}from"./chunk-FAMQ4DHU.js";import{e as U}from"./chunk-UR6MHSHU.js";var bn=U(cr(),1);var g=U(cr(),1);var m=U(Y(),1),Wi=60,Vi=100;function hn(e,s){let c=e.options.length,f=c,p=e.multi_select?f++:null,a=e.allow_free_text?f++:null,u=s?f++:null;return{optionCount:c,doneIdx:p,freeIdx:a,batchIdx:u,maxSel:f-1}}var Ki="\xA0",Ui={high:{text:`\u203C${Ki}high`,color:o.red},med:{text:"med",color:"yellow"},low:{text:"low",color:o.dim}};function Hi(e){let s=(e.header??e.text.split(/\s+/).slice(0,3).join(" ")).trim();return s.length>16?`${s.slice(0,15)}\u2026`:s}function Qi(e,s,c){let f=x=>e[x].length+6,p=f(s),a=s,u=s;for(;;){let x=u+1<e.length?f(u+1):1/0,y=a-1>=0?f(a-1):1/0;if(x===1/0&&y===1/0)break;if(x<=y){if(p+x>c)break;p+=x,u+=1}else{if(p+y>c)break;p+=y,a-=1}}return{lo:a,hi:u}}function Sr({batch:e,qView:s,sel:c=0,focused:f=!1,freeText:p=null,optionText:a=null,attach:u=null,multiSelFor:x,childPrefix:y,gapAbove:T=!0}){let{stdout:P}=Me(),V=P?.columns??80,re=V<Wi,C=Math.min(V-1,Vi),b=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),I=e.questions[b],pe=e.resolution[b],q=e.resolution.filter(B=>!B).length,fe=e.questions.length-q,we=St(e),W=hn(I,we!==""),xe=x?x(b):[],ie=Ui[I.risk],Z=B=>f&&c===B?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" ",A=`? ${y??""}the agent needs ${q===1?"one answer":`${q} answers`}`,Pe=e.questions.length>1?` \xB7 ${b+1} of ${e.questions.length} \xB7 ${fe} answered`:"",H=(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsxs)(r,{bold:!0,children:[I.text,ie?(0,m.jsx)(r,{color:ie.color,bold:!1,children:` ${ie.text}`}):null]})}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:I.rationale})}),(0,m.jsx)(r,{children:" "}),I.options.map((B,$)=>{let Q=f&&c===$;return a&&a.optionIndex===$?(0,m.jsx)(w,{flexDirection:"column",children:(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:`${$+1}. ${un(B.label)}`}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:a.value,onChange:a.onChange,onSubmit:a.onSubmit,onCancel:a.onCancel,placeholder:B.detail||"type your answer"})]})},`o-${$}`):(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsxs)(r,{children:[Z($)," ",I.multi_select?(0,m.jsx)(r,{color:xe.includes($)?o.green:o.dim,children:xe.includes($)?"[x] ":"[ ] "}):null,(0,m.jsx)(r,{color:Q?o.assuranceAccent:void 0,children:`${$+1}. ${un(B.label)}`}),$===I.recommended_index?(0,m.jsx)(r,{color:o.dim,children:" (recommended)"}):null,pe?.selected_index===$?(0,m.jsx)(r,{color:o.dim,children:" (current)"}):null]}),B.detail?(0,m.jsx)(w,{paddingLeft:5,children:(0,m.jsx)(r,{color:o.dim,children:B.detail})}):null]},`o-${$}`)}),I.multi_select&&W.doneIdx!=null?(0,m.jsxs)(r,{children:[Z(W.doneIdx)," ",(0,m.jsx)(r,{color:o.green,children:"\u2714"}),(0,m.jsx)(r,{color:f&&c===W.doneIdx?o.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,m.jsx)(r,{children:" "}):null,I.allow_free_text?p?(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.dim,children:"\u270E "})]}),(0,m.jsx)(Rt,{value:p.value,onChange:p.onChange,onSubmit:p.onSubmit,onCancel:p.onCancel,placeholder:"Tell me what to do"})]}):(0,m.jsxs)(r,{children:[W.freeIdx!=null?Z(W.freeIdx):" "," ",(0,m.jsx)(r,{color:f&&W.freeIdx!=null&&c===W.freeIdx?o.assuranceAccent:o.dim,children:"\u270E Tell me what to do"})]}):null,u?(0,m.jsxs)(w,{flexDirection:"column",marginTop:1,children:[(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"@ attach a file or URL"}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:"path or URL"})]}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),F=we!==""?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(r,{children:" "}),(0,m.jsxs)(r,{children:[f&&W.batchIdx!=null&&c===W.batchIdx?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" "," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"\xBB"}),(0,m.jsx)(r,{bold:!0,color:f&&W.batchIdx!=null&&c===W.batchIdx?o.assuranceAccent:void 0,children:" Go with recommendations"}),q>=5?(0,m.jsx)(r,{color:o.dim,children:` \u2014 resolves all ${q} open`}):null,(0,m.jsx)(r,{color:o.dim,children:" (tab)"})]})]}):null;if(re)return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsx)(r,{color:o.assuranceAccent,bold:!0,children:A}),e.questions.length>1?(0,m.jsx)(r,{color:o.dim,children:Pe.replace(/^ · /,"")}):null,(0,m.jsx)(r,{children:" "}),H,F]});let h=e.questions.map(B=>Hi(B)),me=e.questions.length>1?Qi(h,b,C-8):null;return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsxs)(r,{color:o.assuranceAccent,children:[(0,m.jsx)(r,{bold:!0,children:A}),Pe?(0,m.jsx)(r,{color:o.dim,children:Pe}):null]}),me?(0,m.jsx)(w,{marginTop:1,children:(0,m.jsxs)(r,{children:[me.lo>0?(0,m.jsx)(r,{color:o.dim,children:"\u25C0 "}):" ",e.questions.slice(me.lo,me.hi+1).map((B,$)=>{let Q=me.lo+$,et=$>0?" ":"";return Q===b?(0,m.jsxs)(r,{children:[et,(0,m.jsx)(r,{backgroundColor:o.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[Q]} `})]},B.id):(0,m.jsxs)(r,{children:[et,e.resolution[Q]?(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.green,children:"\u2713 "}),(0,m.jsx)(r,{color:o.dim,children:h[Q]})]}):(0,m.jsx)(r,{color:o.dim,children:`\u25CB ${h[Q]}`})]},B.id)}),me.hi<e.questions.length-1?(0,m.jsx)(r,{color:o.dim,children:" \u25B6"}):null]})}):null,(0,m.jsx)(r,{children:" "}),H,F]})}var Er={ac:["acceptance criterion","acceptance criteria"],gap:["open question","open questions"],scenario:["scenario","scenarios"],test:["test","tests"],"use-case":["use-case","use-cases"]},pn=e=>Er[e]?.[1]??`${e}s`,At={label:(e,s)=>s===1?Er[e]?.[0]??e:pn(e),skip:new Set(["exercise"])},xn={ac:null,test:null,gap:null,scenario:"kind"},Xi=(e,s,c)=>`${e} ${e===1?s:c}`,Gi=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function Ar(e){let s=e.covers?on(e.covers):"1 scenario",c=e.verifies.slice(0,2).map(on),f=e.verifiesTotal-c.length,p=c.length===0?Xi(e.verifiesTotal,"acceptance criterion","acceptance criteria"):Gi([...c,...f>0?[`${f} more`]:[]]);return`covers ${s} \xB7 verifies ${p}`}function Dr(e,s){let c=typeof s=="string"&&s!==""?s.split(", "):[],f=p=>typeof p=="string"&&mr.test(p);return{covers:f(e)?e:null,verifies:c.filter(f),verifiesTotal:c.length}}var Dt={"acceptance criteria":{name:"acceptance criteria",next:"scenarios",done:"acceptance criteria say what the use-case must always do"},scenarios:{name:"scenarios",next:"scenario checks",done:"scenarios are the paths a user takes that test the criteria"},"acceptance criteria + exercises":{name:"scenario checks",next:"tests",done:"scenario checks say which criteria each scenario checks"},"tests + gaps":{name:"tests"},tests:{name:"tests"}};function Ze(e){let s=Dt[e]?.name;if(s)return s;let c={exercises:"scenario checks",gaps:"open questions"};return[...new Set(e.split(" + ").map(f=>c[f]??f))].join(" + ")}var Ir={scenarios:"next, scenarios: the paths a user takes that test them","scenario checks":"next, scenario checks: which criteria each scenario checks",tests:"next, tests: runnable tests, and open questions for what can't run"},Br="phases: acceptance criteria \u2192 scenarios \u2192 scenario checks \u2192 tests";var k=U(Y(),1),zi=e=>e.startsWith("designing: ")?`designing: ${Ze(e.slice(11))}`:e;function Yi(e,s){let c=e.form==="assumed"?" (assumed)":e.form==="deferred"?"":" (you)",f=e.note?` \u2014 ${e.note}`:"",p=s?`"${e.stub}"`:`q${e.qNum} ${e.stub}`;return e.form==="deferred"?`\u21B3 deferred ${p}${f}`:e.form==="changed"?`\u21B3 changed ${p}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${c}${f}`:`\u21B3 ${e.form} ${p}: ${e.choice??"?"}${c}${f}`}var Ji=()=>(process.stdout?.columns??100)-12,Zi=new Set(["banner","header","user","agent","worked","childOpen","lines"]);function Lr({block:e,annotations:s,remote:c=!1,afterHeader:f=!1}){let p=e.era??0,{stdout:a}=Me(),u=c||p>0?(a?.columns??100)-p*2:null,x=ns(e,s??null,c,u,(a?.columns??100)-p*2),y=p>0?(0,k.jsx)(w,{marginLeft:p*2,children:x}):x;return f&&!Zi.has(e.kind)?(0,k.jsx)(w,{marginTop:1,children:y}):y}var es=new RegExp("[\\u1100-\\u115F\\u2E80-\\u303E\\u3041-\\uA4CF\\uAC00-\\uD7A3\\uF900-\\uFAFF\\uFE10-\\uFE19\\uFE30-\\uFE6F\\uFF00-\\uFF60\\uFFE0-\\uFFE6\\u{20000}-\\u{3FFFD}\u2714\u26A0]|\\p{Emoji_Presentation}","u"),It=e=>[...e].reduce((s,c)=>s+(es.test(c)?2:1),0);function ts(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s){let x=a?`${a} \xB7 ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function _e(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s.split(" ")){let x=a?`${a} ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function ns(e,s,c,f=null,p=100){switch(e.kind){case"banner":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{bold:!0,color:o.assuranceAccent,children:` ${c?zi(e.text):e.text}`})});case"header":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${e.text}`,e.tail?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.tail}`}):null]})});case"user":return(0,k.jsxs)(w,{marginTop:1,children:[(0,k.jsx)(r,{color:o.orange,children:"\u276F "}),(0,k.jsx)(r,{children:e.text})]});case"note":return(0,k.jsx)(r,{color:o.dim,children:` ${e.text}`});case"lines":return(0,k.jsx)(w,{flexDirection:"column",marginTop:1,children:e.lines.map((a,u)=>(0,k.jsx)(r,{...a.dim?{color:o.dim}:{},children:a.text},u))});case"agent":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(kr,{text:e.text,accent:o.assuranceAccent,indent:f===null?0:(e.era??0)*2})});case"worked":return(0,k.jsx)(w,{marginTop:1,flexDirection:"column",children:ts(" \u2699 ",hr(e.durS,e.toolCalls,e.tools),p).map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},u))});case"usage":return(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let a=s,u=(a?a.fresh:e.items.map((C,b)=>({item:C,num:b+1,updated:!1}))).filter(C=>!(c&&At.skip?.has(C.item.kind??""))),x={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"risk",stylenote:"kind"},y=C=>C.kind??"use-case",T=new Map;for(let C of u){let b=C.item,I=y(C.item),pe=c&&I==="test"?{title:b.title,summary:Ar(b.links??Dr(b.extra?.automates,b.extra?.verifies)),badge:""}:c&&I==="gap"?{title:b.question??"",summary:b.rationale??"",badge:""}:null,q=b.risk==="high"||b.risk==="med"||b.risk==="low"?b.risk:void 0,fe=b.logical_id??(c?b.matched_id:void 0),we={id:fe??"",staged:!fe,...c&&b.held&&!fe?{held:!0}:{},title:pe?.title??b.title,badge:pe?.badge??b.badge??b.risk??"",summary:pe?.summary??b.why??b.summary??b.description??"",...q?{risk:q}:{},...C.updated?{marker:"\u21B3 changed"}:{}},W=T.get(I)??[];W.push(we),T.set(I,W)}let P=u.some(C=>!!C.item.kind),V=(a?.unchanged??[]).reduce((C,b)=>C+b.count,0),re=a?.headerStats?` \u2014 ${a.headerStats}${V>0?` (${V} unchanged)`:""}`:"";return(0,k.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(0,k.jsxs)(r,{bold:!0,children:[P?"design":e.heading,re?(0,k.jsx)(r,{bold:!1,color:o.dim,children:re}):null]}),[...T.entries()].map(([C,b])=>(0,k.jsxs)(w,{flexDirection:"column",children:[T.size>1?(0,k.jsx)(r,{color:o.dim,children:`${c?pn(C):Ct(C)} \xB7 ${b.length}`}):null,(0,k.jsx)(Tr,{rows:b,width:Ji(),badgeHeader:c&&C in xn?xn[C]:x[C]??"info"})]},C)),a&&a.unchanged.length>0&&(0,k.jsx)(r,{color:o.dim,children:` \u22EE unchanged: ${a.unchanged.map(C=>`${C.count} ${C.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,k.jsx)(r,{color:o.dim,children:Yi(e.receipt,c)});case"continued":return(0,k.jsx)(r,{color:o.dim,children:"\u21B3 continued"});case"childOpen":{if(c)return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{color:o.assuranceAccent,children:`\u25CF ${e.update?S.updateOpen(e.subject,e.changed===!0):S.childOpen(e.verb,e.subject)}`})});let{ing:a}=fn(e.verb);return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${a} ${e.subject}`,e.sid?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.sid}`}):null,e.note?(0,k.jsx)(r,{color:o.dim,children:` ${e.note}`}):null]})})}case"childClose":{if(e.held)return(0,k.jsx)(w,{});if(c&&e.update){let x=[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.updateFailed(e.subject)}`});if(e.untouched)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUntouched(e.subject)} \u2014 ${x.join(" \xB7 ")}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUnfinished(e.subject)} \u2014 ${x.join(" \xB7 ")}`});let y=e.testsWritten?S.updateTests(e.testsWritten):null,T=[x[0],...y?[y]:[],...x.slice(1)];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.updateClosed(e.subject,T)}`})}if(c){if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.childFailed(e.verb,e.subject)}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${[S.childUnfinished(e.verb),[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ")].join(" \u2014 ")}`});let x=[Ge(e.durS),...e.tests?[S.childTests(e.verb,e.tests)]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.childClosed(e.verb,e.subject,x)}`})}let{ed:a}=fn(e.verb);if(!e.ok)return(0,k.jsxs)(r,{color:o.red,children:[`\u25CF ${e.verb} failed \u2014 ${e.exitCode!=null?`exited ${e.exitCode}`:"error"}`,e.fixCmd?(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.fixCmd}`}):null]});let u=[Ge(e.durS),...e.results?[e.results]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${a} ${e.subject} \u2014 ${u}`})}case"childBack":return(0,k.jsx)(r,{color:o.dim,children:`back with ${e.parentVerb} \u2014 ${e.context}`});case"commit":if(c&&e.person&&!e.ok&&e.refused?.length){let a=S.approveRefused(e.refused);return(0,k.jsxs)(w,{flexDirection:"column",children:[_e(" \u2717 ",a.line,f??100).map((u,x)=>(0,k.jsx)(r,{color:o.red,children:u},`p-${x}`)),a.notes.flatMap((u,x)=>_e(" ",u,f??100).map((y,T)=>(0,k.jsx)(r,{color:o.dim,children:y},`n-${x}-${T}`)))]})}return(0,k.jsxs)(w,{flexDirection:"column",children:[c&&e.held?_e(" \u2016 ",e.line,f??100).map((a,u)=>(0,k.jsx)(r,{children:a},`h-${u}`)):f!==null?_e(` ${e.ok?"\u2714":"\u2717"} `,e.line,f).map((a,u)=>(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:a},`c-${u}`)):(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),c&&e.refused?.length?S.chatRefused(e.refused).flatMap((a,u)=>_e(" ",a,f??100).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`r-${u}-${y}`))):(e.warnings??[]).flatMap((a,u)=>!c&&f!==null&&(e.era??0)>0?_e(" \u26A0 ",a,f).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`w-${u}-${y}`)):[(0,k.jsx)(r,{color:o.dim,children:` \u26A0 ${a}`},`w-${u}`)])]});case"error":return(0,k.jsxs)(ur,{variant:"error",paddingX:1,children:[(0,k.jsx)(r,{color:o.red,children:e.title}),e.detail.map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},`d-${u}`))]})}}var Oe=U(Y(),1);function Mr({item:e}){return(0,Oe.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,c)=>(0,Oe.jsx)(r,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${c}`)),(e.depends_on_hint??[]).length>0&&(0,Oe.jsx)(r,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,c])=>(0,Oe.jsx)(r,{dimColor:!0,children:`${s}: ${c}`},`extra-${s}`))]})}var E=U(Y(),1),kn=(e,s)=>Math.max(0,Math.min(s,e));function Lt(e,s,c){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:kn(e.cursor+s.delta,Math.max(0,c-1))};case"enter":return e.level==="list"?{...e,level:"detail",scroll:0}:e;case"back":return e.level==="detail"?{...e,level:"list",scroll:0}:null}}var Or={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function Pr(e,s){if(e.level==="detail")return{level:"detail",cursor:kn(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let c=s.entries.findIndex(f=>Or[f.kind]===e.section);if(c>=0)return{level:"list",cursor:c}}return{level:"list",cursor:0}}function rs(e){let s=[];for(let c of e.entries){let f=s.find(p=>p.kind===c.kind);f?f.entries.push(c):s.push({kind:c.kind,entries:[c]})}return s}var _r=3;function is({items:e,cursor:s,verb:c,more:f}){let p=`view \xB7 ${c} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,a=e.entries[s];return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,color:o.assuranceAccent,children:p}),rs(e).map(({kind:u,entries:x})=>{let y=a?.kind===u,T=y?x.findIndex(C=>C.num===a.num):-1,P=y?kn(T-1,Math.max(0,x.length-_r)):0,V=x.slice(P,P+(y?_r:1)),re=x.length-V.length;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{color:o.dim,children:`${Or[u]??Ct(u)} \xB7 ${x.length}`}),V.map(C=>{let b=y&&C.num===a.num,I=C.item.badge;return(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:b?"\u203A ":" "}),(0,E.jsx)(r,{children:`${C.num} \xB7 ${C.item.title}`}),I?(0,E.jsx)(r,{color:o.dim,children:` \xB7 ${I}`}):null]},`${C.kind}:${C.num}`)}),re>0&&(0,E.jsx)(r,{color:o.dim,children:` \u22EE ${re} more`})]},u)}),f?(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,E.jsx)(r,{color:o.dim,children:`\u22EF show all \u2014 ${f.hidden} more from earlier turns`})]}):null]})}var Bt=14;function ss({items:e,cursor:s,explain:c,grandTotal:f,dossier:p,scroll:a=0}){let u=e.entries[s];if(!u)return(0,E.jsx)(r,{color:o.dim,children:"nothing to show"});if(p){let y=Math.max(0,Math.min(a,Math.max(0,p.lines.length-Bt))),T=p.lines.slice(y,y+Bt);return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsxs)(r,{bold:!0,children:[`view \xB7 ${p.id}`,p.id.toLowerCase()!==p.rawId?(0,E.jsx)(r,{bold:!1,color:o.dim,children:` \xB7 ${p.rawId}`}):null]}),(0,E.jsx)(r,{bold:!0,children:p.title}),y>0?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${y} above`}):null,T.map((P,V)=>(0,E.jsx)(r,{color:P.dim?o.dim:void 0,children:P.text},`dl-${V}`)),p.lines.length>y+Bt?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${p.lines.length-y-Bt} more`}):null]})}let x=u.item;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${f??e.entries.length}`}),(0,E.jsx)(r,{children:u.item.title}),x.badge?(0,E.jsx)(r,{color:o.dim,children:`kind: ${x.badge}`}):null,x.why?(0,E.jsx)(r,{color:o.dim,children:x.why}):null,(0,E.jsx)(Mr,{item:u.item}),c?.map((y,T)=>(0,E.jsx)(r,{color:o.dim,children:y},`ex-${T}`)),(0,E.jsx)(r,{color:o.dim,children:"view-only \u2014 approvals happen in chat"})]})}function jr({items:e,state:s,verb:c,more:f,explain:p,grandTotal:a,dossier:u=null}){return s.level==="list"?(0,E.jsx)(is,{items:e,cursor:s.cursor,verb:c,more:f}):(0,E.jsx)(ss,{items:e,cursor:s.cursor,explain:p,grandTotal:a,dossier:u,scroll:s.scroll??0})}var J=U(Y(),1),vn=14;function os(e){let s=[],c=null;for(let f of e)f.field!==c&&(c=f.field,s.push({kind:"field",field:c})),s.push({kind:"line",field:c,line:f});return s}function Fr({title:e,lines:s,offset:c=0,remote:f=!1}){let p=os(s),a=Math.max(0,Math.min(c,Math.max(0,p.length-vn))),u=p.slice(a,a+vn),x=a,y=Math.max(0,p.length-a-vn),T=f?`the change to ${e} \xB7 old \u2192 new`:`view \xB7 diff \xB7 ${e} \xB7 current \u2192 proposed`;return(0,J.jsxs)(w,{flexDirection:"column",children:[(0,J.jsx)(r,{bold:!0,color:o.assuranceAccent,children:T}),x>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${x} above`})}):null,u.map((P,V)=>P.kind==="field"?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:P.field==="criteria"?f?"acceptance criteria":"criteria":P.field})},`r-${a+V}`):(0,J.jsx)(w,{paddingLeft:4,children:(0,J.jsx)(r,{color:P.line.op==="-"?"red":"green",children:`${P.line.op==="-"?"\u2212":"+"} ${P.line.text}`})},`r-${a+V}`)),y>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${y} more`})}):null]})}var ls={"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 qr(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let f=parseInt(s,10);return f>=1?{level:"detail",num:f}:{error:"items are numbered from 1 \u2014 /view 1"}}let c=ls[s];return c?{level:"list",section:c}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var D=U(Y(),1),as=6,Nr=12;function cs(e,s,c){let f=Math.max(20,s),p=[];for(let u of e.split(`
3
3
  `)){if(u.length<=f){p.push(u);continue}let x="";for(let y of u.split(" "))x&&x.length+1+y.length>f?(p.push(x),x=y):x=x?`${x} ${y}`:y;p.push(x)}let a=Math.max(0,p.length-c);return{body:p.slice(-c).join(`
4
4
  `),hidden:a}}function wn(e){return e.resumed?[{role:"agent",turnIndex:0,items:e.resumed.items},...e.turns]:e.turns}function Wr(e){let s={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},c={key:"keep",label:"keep the existing design",detail:"back to the list"};return e.designed==="stale"?[{...s,detail:"the use-case changed since it was designed"},c]:[c,s]}function Vr(e){return e.length===0?null:{approved:e.filter(s=>s.verdict==="approve").length,rejected:e.filter(s=>s.verdict==="reject").length,deferred:e.filter(s=>s.verdict==="defer").length}}function ds(e,s){return s?`the changes in ${e} could not be read: ${s.message}`:"no reviewable changes came back \u2014 the source may be unchanged"}function fo({controller:e,verb:s="extract",onCtrlC:c,chain:f=null,inspect:p=null,reconcile:a=null,autoReview:u=!1,onReviewExit:x,meta:y=null,remote:T=null}){let[,P]=(0,g.useState)(0),[V,re]=(0,g.useState)(!1),[C,b]=(0,g.useState)(null),[I,pe]=(0,g.useState)(null),q=(0,g.useRef)(null),[fe,we]=(0,g.useState)(null),W=(0,g.useRef)(null),xe=t=>{W.current=t,we(t)},ie=t=>{q.current=t,pe(t),t===null&&xe(null)},Z=(0,g.useRef)([]),[A,Pe]=(0,g.useState)(null),H=(0,g.useRef)(null),F=t=>{H.current=t,Pe(t)},[h,me]=(0,g.useState)(null),B=(0,g.useRef)(null),$=t=>{B.current=t,me(t)},[Q,et]=(0,g.useState)(null),yn=(0,g.useRef)(null),be=t=>{yn.current=t,et(t)},Mt=(0,g.useRef)({approved:0,rejected:0,deferred:0}),[Kr,Ur]=(0,g.useState)(null),je=(0,g.useRef)({added:0,updated:0}),Fe=(0,g.useRef)(!1),se=(0,g.useRef)(null),[ye,_t]=(0,g.useState)(null),Tn=(0,g.useRef)(new Set),$n=fr(),{stdout:Hr}=Me(),Qr=Hr?.columns??80,Rn=(0,g.useRef)(0),N=T!==null,R=T?.review??null,tt=N&&e.state.ledger.at(-1)?.kind==="agent",Ot=(0,g.useRef)(0);(0,g.useEffect)(()=>{let t=i=>R!==null&&i?.kind==="header"&&(i.era??0)>0,n=()=>{let i=e.state.ledger;for(let d=Rn.current;d<i.length;d++){let v=i[d];if(t(v))continue;let _=v.kind==="turn"?yr(e.state.turns,v.turnIndex,N?At:void 0):void 0;N&&_&&_.fresh.length===0&&_.unchanged.length===0||$n.append((0,D.jsx)(Lr,{block:v,annotations:_,remote:N,afterHeader:i[d-1]?.kind==="header"&&!t(i[d-1])||i[d-1]?.kind==="lines"},`lg-${d}`))}Rn.current=i.length};n();let l=e.subscribe(()=>{n();let i=e.state;q.current&&(i.pending||i.status==="pausing")&&(ie(null),i.pending&&b("questions arrived \u2014 back to chat")),P(d=>d+1)});return P(i=>i+1),l},[e,$n]);let{thinking:ge,status:ee,pending:M,confirm:qe,ledger:oe,activeTurn:Cn,stream:Xr,notice:nt}=e.state,Sn=(Xr?.text??"").trimEnd(),En=Sn.length>0,Gr=V&&(ge.liveThinking.length>0||ge.thinkingLog.length>0),zr=cs(ge.liveThinking||ge.thinkingLog.map(t=>t.text).join(`
5
5
  `),Qr-6,Nr),An=En?Sn.split(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{r as i,s as u}from"./chunk-UJLULWSR.js";async function d(e){if(!e.isInteractive)return{recovered:!1};if(f(e.creds,e.authOnly===!0))return{recovered:!1};let{SingleShotApp:a}=await import("./SingleShotApp-QI4B2TSL.js"),{ScrollbackProvider:t}=await import("./scrollback-GGNBDFQV.js"),{render:r}=await import("./build-5ZN47FAT.js"),o=await import("./react-QWOAB3TB.js"),n={current:null},l={current:!1},{waitUntilExit:c,unmount:s}=r(o.default.createElement(t,null,o.default.createElement(a,{resultRef:n,mode:"login",loginCompleteRef:l,...e.authOnly?{authOnly:!0}:{}})),{exitOnCtrlC:!1});u(()=>s()),await c();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),l.current?{recovered:!0}:e.onCancel==="return"?{recovered:!1,cancelled:!0}:(i(0,"Startup gate cancelled"),{recovered:!1})}function f(e,a=!1){let t=e.getActiveProfile(),r=e.getDefaultEnv();if(!t||!!!(e.loadBasicAuth(t,r)||e.loadCredentials(t,r)))return!1;if(a)return!0;let n=e.loadProfileConfig(t,r)??{};return!!n.project_id&&!!n.folder_id}export{d as a,f as b};
2
+ import{r as i,s as u}from"./chunk-UJLULWSR.js";async function d(e){if(!e.isInteractive)return{recovered:!1};if(f(e.creds,e.authOnly===!0))return{recovered:!1};let{SingleShotApp:a}=await import("./SingleShotApp-OMLRYOSI.js"),{ScrollbackProvider:t}=await import("./scrollback-GGNBDFQV.js"),{render:r}=await import("./build-5ZN47FAT.js"),o=await import("./react-QWOAB3TB.js"),n={current:null},l={current:!1},{waitUntilExit:c,unmount:s}=r(o.default.createElement(t,null,o.default.createElement(a,{resultRef:n,mode:"login",loginCompleteRef:l,...e.authOnly?{authOnly:!0}:{}})),{exitOnCtrlC:!1});u(()=>s()),await c();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),l.current?{recovered:!0}:e.onCancel==="return"?{recovered:!1,cancelled:!0}:(i(0,"Startup gate cancelled"),{recovered:!1})}function f(e,a=!1){let t=e.getActiveProfile(),r=e.getDefaultEnv();if(!t||!!!(e.loadBasicAuth(t,r)||e.loadCredentials(t,r)))return!1;if(a)return!0;let n=e.loadProfileConfig(t,r)??{};return!!n.project_id&&!!n.folder_id}export{d as a,f as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as P}from"./chunk-A3TCFSCK.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a as c,b as l,i as X}from"./chunk-33DWJV67.js";import{a as Z}from"./chunk-6YGTRKDT.js";import{z as i}from"./chunk-QMOGBKJM.js";import{e as O}from"./chunk-UR6MHSHU.js";var u=O(Z(),1);var e=O(Y(),1),d=5;function _(t,I){if(!I)return t;let a=I.toLowerCase();return t.filter(L=>L.label.toLowerCase().includes(a))}function U(t){let{title:I,items:a,loading:L=!1,loadingText:$,error:A=null,itemNoun:B="items",onSelect:k,onCancel:R,defaultActiveId:D,onTab:T,extraHint:w}=t,[b,s]=(0,u.useState)(0),[v,g]=(0,u.useState)(0),[f,M]=(0,u.useState)(""),[y,x]=(0,u.useState)(null),H=(0,u.useRef)(!1),N=!t.onSearch&&f!=="";(0,u.useEffect)(()=>{if(a.length===0||N)return;let n=D?a.findIndex(o=>o.id===D):a.findIndex(o=>o.isActive);if(t.preserveSelectionById&&!H.current&&n>=0&&a[n].id!==y){g(Math.floor(n/d)),s(n%d),x(a[n].id);return}if(t.preserveSelectionById&&y!==null){let o=a.findIndex(r=>r.id===y);if(o>=0){g(Math.floor(o/d)),s(o%d);return}}n>=0?(g(Math.floor(n/d)),s(n%d),t.preserveSelectionById&&x(a[n].id)):t.preserveSelectionById&&(g(0),s(0),x(a[0]?.id??null))},[a,D,t.preserveSelectionById,y,N]),(0,u.useEffect)(()=>{if(!t.onSearch)return;let n=setTimeout(()=>t.onSearch(f),t.searchDebounceMs??250);return()=>clearTimeout(n)},[f,t.onSearch,t.searchDebounceMs]);let m=t.onSearch?a:_(a,f),C=v*d,F=Math.min(C+d,m.length),E=Math.ceil(m.length/d),G=F-C,h=m.slice(C,F);return X((n,o)=>{if(H.current=!0,A){o.escape?R():o.tab&&T&&t.tabOnError&&T();return}if(o.escape){f?(M(""),s(0),g(0)):R();return}if(o.tab&&T){T();return}if(o.upArrow){if(b>0){let r=b-1;s(r),t.preserveSelectionById&&x(h[r]?.id??null)}else if(v>0){let r=v-1,S=d-1;g(r),s(S),t.preserveSelectionById&&x(m[r*d+S]?.id??null)}return}if(o.downArrow){if(b<G-1){let r=b+1;s(r),t.preserveSelectionById&&x(h[r]?.id??null)}else if(v<E-1){let r=v+1,S=0;g(r),s(S),t.preserveSelectionById&&x(m[r*d+S]?.id??null)}return}if(o.return&&h[b]){if(h[b].disabled)return;k(h[b]);return}if(o.backspace||o.delete){M(r=>r.slice(0,-1)),s(0),g(0);return}n&&!o.ctrl&&!o.meta&&(M(r=>r+n),s(0),g(0))},{isActive:!L}),L?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:i.orange,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(l,{color:i.secondary,children:$??`Loading ${B}\u2026`})})]}):A?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.red,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:i.red,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(l,{color:i.red,children:A})}),(0,e.jsx)(P,{bindings:t.tabOnError&&T&&w?[{keys:"tab",label:w}]:[],escBackLabel:t.escLabel??"back to chat"})]}):(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,e.jsxs)(c,{children:[(0,e.jsx)(l,{color:i.orange,bold:!0,children:I}),(0,e.jsxs)(l,{color:i.dim,children:[" (",m.length,!t.onSearch&&f?`/${a.length}`:""," ",B,t.loadingMore?" \xB7 loading more":"",")"]})]}),(0,e.jsxs)(c,{marginTop:1,children:[(0,e.jsx)(l,{color:i.secondary,children:f?"filter: ":""}),f?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{children:f}),(0,e.jsx)(l,{inverse:!0,children:" "})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(l,{color:i.dim,children:["Search ",B,"\u2026"]}),(0,e.jsx)(l,{inverse:!0,children:" "})]})]}),(0,e.jsx)(c,{flexDirection:"column",marginTop:1,children:t.searching?(0,e.jsxs)(l,{color:i.secondary,children:["Searching ",B,"\u2026"]}):m.length===0?(0,e.jsxs)(l,{color:i.dim,children:["No ",B,' match "',f,'"']}):h.map((n,o)=>{let r=o===b,S=r?"\u276F ":" ",K=n.disabled?i.muted:n.isActive?i.green:r?i.orange:void 0;return(0,e.jsxs)(c,{flexDirection:"column",children:[(0,e.jsxs)(l,{color:K,children:[S,n.label,n.isActive&&!n.disabled?" \u25CF selected":""]}),r&&n.disabled&&n.disabledHint&&(0,e.jsxs)(l,{color:i.red,children:[" ",n.disabledHint]})]},n.id)})}),!t.searching&&E>1&&(0,e.jsx)(c,{marginTop:1,children:(0,e.jsxs)(l,{color:i.dim,children:["Page ",v+1,"/",E]})}),t.footer&&(0,e.jsx)(c,{marginTop:1,flexDirection:"column",children:t.footer}),(0,e.jsx)(P,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"type",label:"to search"},...t.hideSelectOnDisabled&&h[b]?.disabled?[]:[{keys:"\u21B5",label:"select"}],...T&&w?[{keys:"tab",label:w}]:[]],escBackLabel:f?"clear":t.escLabel??"back to chat"})]})}export{U as a};
2
+ import{a as P}from"./chunk-4HYPMGDF.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a as c,b as l,i as X}from"./chunk-33DWJV67.js";import{a as Z}from"./chunk-6YGTRKDT.js";import{z as i}from"./chunk-FAMQ4DHU.js";import{e as O}from"./chunk-UR6MHSHU.js";var u=O(Z(),1);var e=O(Y(),1),d=5;function _(t,I){if(!I)return t;let a=I.toLowerCase();return t.filter(L=>L.label.toLowerCase().includes(a))}function U(t){let{title:I,items:a,loading:L=!1,loadingText:$,error:A=null,itemNoun:B="items",onSelect:k,onCancel:R,defaultActiveId:D,onTab:T,extraHint:w}=t,[b,s]=(0,u.useState)(0),[v,g]=(0,u.useState)(0),[f,M]=(0,u.useState)(""),[y,x]=(0,u.useState)(null),H=(0,u.useRef)(!1),N=!t.onSearch&&f!=="";(0,u.useEffect)(()=>{if(a.length===0||N)return;let n=D?a.findIndex(o=>o.id===D):a.findIndex(o=>o.isActive);if(t.preserveSelectionById&&!H.current&&n>=0&&a[n].id!==y){g(Math.floor(n/d)),s(n%d),x(a[n].id);return}if(t.preserveSelectionById&&y!==null){let o=a.findIndex(r=>r.id===y);if(o>=0){g(Math.floor(o/d)),s(o%d);return}}n>=0?(g(Math.floor(n/d)),s(n%d),t.preserveSelectionById&&x(a[n].id)):t.preserveSelectionById&&(g(0),s(0),x(a[0]?.id??null))},[a,D,t.preserveSelectionById,y,N]),(0,u.useEffect)(()=>{if(!t.onSearch)return;let n=setTimeout(()=>t.onSearch(f),t.searchDebounceMs??250);return()=>clearTimeout(n)},[f,t.onSearch,t.searchDebounceMs]);let m=t.onSearch?a:_(a,f),C=v*d,F=Math.min(C+d,m.length),E=Math.ceil(m.length/d),G=F-C,h=m.slice(C,F);return X((n,o)=>{if(H.current=!0,A){o.escape?R():o.tab&&T&&t.tabOnError&&T();return}if(o.escape){f?(M(""),s(0),g(0)):R();return}if(o.tab&&T){T();return}if(o.upArrow){if(b>0){let r=b-1;s(r),t.preserveSelectionById&&x(h[r]?.id??null)}else if(v>0){let r=v-1,S=d-1;g(r),s(S),t.preserveSelectionById&&x(m[r*d+S]?.id??null)}return}if(o.downArrow){if(b<G-1){let r=b+1;s(r),t.preserveSelectionById&&x(h[r]?.id??null)}else if(v<E-1){let r=v+1,S=0;g(r),s(S),t.preserveSelectionById&&x(m[r*d+S]?.id??null)}return}if(o.return&&h[b]){if(h[b].disabled)return;k(h[b]);return}if(o.backspace||o.delete){M(r=>r.slice(0,-1)),s(0),g(0);return}n&&!o.ctrl&&!o.meta&&(M(r=>r+n),s(0),g(0))},{isActive:!L}),L?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:i.orange,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(l,{color:i.secondary,children:$??`Loading ${B}\u2026`})})]}):A?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.red,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:i.red,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(l,{color:i.red,children:A})}),(0,e.jsx)(P,{bindings:t.tabOnError&&T&&w?[{keys:"tab",label:w}]:[],escBackLabel:t.escLabel??"back to chat"})]}):(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,e.jsxs)(c,{children:[(0,e.jsx)(l,{color:i.orange,bold:!0,children:I}),(0,e.jsxs)(l,{color:i.dim,children:[" (",m.length,!t.onSearch&&f?`/${a.length}`:""," ",B,t.loadingMore?" \xB7 loading more":"",")"]})]}),(0,e.jsxs)(c,{marginTop:1,children:[(0,e.jsx)(l,{color:i.secondary,children:f?"filter: ":""}),f?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{children:f}),(0,e.jsx)(l,{inverse:!0,children:" "})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(l,{color:i.dim,children:["Search ",B,"\u2026"]}),(0,e.jsx)(l,{inverse:!0,children:" "})]})]}),(0,e.jsx)(c,{flexDirection:"column",marginTop:1,children:t.searching?(0,e.jsxs)(l,{color:i.secondary,children:["Searching ",B,"\u2026"]}):m.length===0?(0,e.jsxs)(l,{color:i.dim,children:["No ",B,' match "',f,'"']}):h.map((n,o)=>{let r=o===b,S=r?"\u276F ":" ",K=n.disabled?i.muted:n.isActive?i.green:r?i.orange:void 0;return(0,e.jsxs)(c,{flexDirection:"column",children:[(0,e.jsxs)(l,{color:K,children:[S,n.label,n.isActive&&!n.disabled?" \u25CF selected":""]}),r&&n.disabled&&n.disabledHint&&(0,e.jsxs)(l,{color:i.red,children:[" ",n.disabledHint]})]},n.id)})}),!t.searching&&E>1&&(0,e.jsx)(c,{marginTop:1,children:(0,e.jsxs)(l,{color:i.dim,children:["Page ",v+1,"/",E]})}),t.footer&&(0,e.jsx)(c,{marginTop:1,flexDirection:"column",children:t.footer}),(0,e.jsx)(P,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"type",label:"to search"},...t.hideSelectOnDisabled&&h[b]?.disabled?[]:[{keys:"\u21B5",label:"select"}],...T&&w?[{keys:"tab",label:w}]:[]],escBackLabel:f?"clear":t.escLabel??"back to chat"})]})}export{U as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{h as w}from"./chunk-SXRHKXSE.js";import{a as h}from"./chunk-RZ4F3BHX.js";import{b as f}from"./chunk-QMOGBKJM.js";import{mkdtemp as O,rm as $}from"fs/promises";import{createWriteStream as R}from"fs";import{Readable as U}from"stream";import{pipeline as F}from"stream/promises";import{tmpdir as T}from"os";import{basename as z,join as A}from"path";import{access as x,cp as P,mkdir as g,readdir as y,readFile as S,rename as I,rm as k,stat as b,writeFile as v}from"fs/promises";import{basename as D,join as d}from"path";function u(){return d(f,"mobile","apps")}function m(){return d(u(),"index.json")}function C(){return{readIndex:async()=>{try{let e=JSON.parse(await S(m(),"utf8"));return{apps:Array.isArray(e.apps)?e.apps:[]}}catch{return{apps:[]}}},writeIndex:async r=>{await g(u(),{recursive:!0});let e=`${m()}.tmp`;await v(e,JSON.stringify(r,null,2)),await I(e,m())},exists:async r=>{try{return await x(r),!0}catch{return!1}},copy:(r,e)=>P(r,e,{recursive:!0,force:!0}),remove:r=>k(r,{recursive:!0,force:!0}),sizeOf:async r=>{try{return(await b(r)).size}catch{return}},now:()=>new Date}}var c=class{deps;constructor(e={}){this.deps={...C(),...e}}async list(){let{apps:e}=await this.deps.readIndex();return[...e].sort((t,s)=>s.lastUsedAt.localeCompare(t.lastUsedAt))}async find(e){return(await this.deps.readIndex()).apps.find(t=>t.key===e)}async put(e){let t=await this.deps.readIndex(),s=t.apps.find(n=>n.key===e.key),a=this.deps.now().toISOString();if(s&&await this.deps.exists(s.path))return s.lastUsedAt=a,await this.deps.writeIndex(t),s;s&&(t.apps=t.apps.filter(n=>n.key!==e.key));let l=D(e.name??e.sourcePath),o=d(u(),e.key),p=d(o,l);await g(o,{recursive:!0}),await this.deps.copy(e.sourcePath,p);let i={key:e.key,path:p,name:l,source:e.source,...e.source==="local"?{originPath:e.sourcePath}:{},addedAt:a,lastUsedAt:a,...await this.deps.sizeOf(p).then(n=>n?{bytes:n}:{})};return t.apps=[...t.apps.filter(n=>n.key!==e.key),i],await this.deps.writeIndex(t),i}async exists(e){if(await this.deps.sizeOf(e.path)!==void 0)return!0;try{return await y(e.path),!0}catch{return!1}}async forget(e){let t=await this.deps.readIndex(),s=t.apps.find(a=>a.key===e);s&&(await this.deps.remove(s.path),t.apps=t.apps.filter(a=>a.key!==e),await this.deps.writeIndex(t))}async prune(){let e=await this.deps.readIndex(),t=[];for(let s of e.apps)if(await this.deps.sizeOf(s.path)!==void 0)t.push(s);else try{await y(s.path),t.push(s)}catch{}return t.length!==e.apps.length&&await this.deps.writeIndex({apps:t}),t}};var E=30*6e4,j=/^APP\d{6,}$/;function Y(r){return!!r&&j.test(r.trim())}function _(){return{store:new c,client:(r,e)=>new w(r,e),fetchToFile:async(r,e)=>{let t=await h(r,{method:"GET",signal:AbortSignal.timeout(E)});if(!t.ok)throw new Error(`Downloading the app failed: ${t.status} ${t.statusText}`);if(!t.body)throw new Error("Downloading the app failed: empty response body");await F(U.fromWeb(t.body),R(e))}}}async function Z(r,e={}){let t={..._(),...e},s=r.appId.trim(),a=await t.store.find(s);if(a&&await t.store.exists(a))return r.onProgress?.(`using the copy of ${a.name} already on this machine`),await t.store.put({key:s,sourcePath:a.path,source:"cloud",name:a.name}),{path:a.path,name:a.name,fromStore:!0};r.onProgress?.(`looking up ${s}\u2026`);let o=await t.client(r.baseUrl,r.auth).details(s);if(r.accepts&&!r.accepts.some(i=>o.name.toLowerCase().endsWith(i)))throw new Error(`${o.name} cannot run on this device \u2014 expected ${r.accepts.join(" or ")}.`);r.onProgress?.(`downloading ${o.name} \u2014 this can take a while, please wait\u2026`);let p=await O(A(T(),"kane-app-dl-"));try{let i=A(p,z(o.name));await t.fetchToFile(o.url,i);let n=await t.store.put({key:s,sourcePath:i,source:"cloud",name:o.name});return r.onProgress?.(`${o.name} is ready`),{path:n.path,name:n.name,fromStore:!1,details:o}}finally{await $(p,{recursive:!0,force:!0})}}export{c as a,Y as b,Z as c};
2
+ import{h as w}from"./chunk-SXRHKXSE.js";import{a as h}from"./chunk-RZ4F3BHX.js";import{b as f}from"./chunk-FAMQ4DHU.js";import{mkdtemp as O,rm as $}from"fs/promises";import{createWriteStream as R}from"fs";import{Readable as U}from"stream";import{pipeline as F}from"stream/promises";import{tmpdir as T}from"os";import{basename as z,join as A}from"path";import{access as x,cp as P,mkdir as g,readdir as y,readFile as S,rename as I,rm as k,stat as b,writeFile as v}from"fs/promises";import{basename as D,join as d}from"path";function u(){return d(f,"mobile","apps")}function m(){return d(u(),"index.json")}function C(){return{readIndex:async()=>{try{let e=JSON.parse(await S(m(),"utf8"));return{apps:Array.isArray(e.apps)?e.apps:[]}}catch{return{apps:[]}}},writeIndex:async r=>{await g(u(),{recursive:!0});let e=`${m()}.tmp`;await v(e,JSON.stringify(r,null,2)),await I(e,m())},exists:async r=>{try{return await x(r),!0}catch{return!1}},copy:(r,e)=>P(r,e,{recursive:!0,force:!0}),remove:r=>k(r,{recursive:!0,force:!0}),sizeOf:async r=>{try{return(await b(r)).size}catch{return}},now:()=>new Date}}var c=class{deps;constructor(e={}){this.deps={...C(),...e}}async list(){let{apps:e}=await this.deps.readIndex();return[...e].sort((t,s)=>s.lastUsedAt.localeCompare(t.lastUsedAt))}async find(e){return(await this.deps.readIndex()).apps.find(t=>t.key===e)}async put(e){let t=await this.deps.readIndex(),s=t.apps.find(n=>n.key===e.key),a=this.deps.now().toISOString();if(s&&await this.deps.exists(s.path))return s.lastUsedAt=a,await this.deps.writeIndex(t),s;s&&(t.apps=t.apps.filter(n=>n.key!==e.key));let l=D(e.name??e.sourcePath),o=d(u(),e.key),p=d(o,l);await g(o,{recursive:!0}),await this.deps.copy(e.sourcePath,p);let i={key:e.key,path:p,name:l,source:e.source,...e.source==="local"?{originPath:e.sourcePath}:{},addedAt:a,lastUsedAt:a,...await this.deps.sizeOf(p).then(n=>n?{bytes:n}:{})};return t.apps=[...t.apps.filter(n=>n.key!==e.key),i],await this.deps.writeIndex(t),i}async exists(e){if(await this.deps.sizeOf(e.path)!==void 0)return!0;try{return await y(e.path),!0}catch{return!1}}async forget(e){let t=await this.deps.readIndex(),s=t.apps.find(a=>a.key===e);s&&(await this.deps.remove(s.path),t.apps=t.apps.filter(a=>a.key!==e),await this.deps.writeIndex(t))}async prune(){let e=await this.deps.readIndex(),t=[];for(let s of e.apps)if(await this.deps.sizeOf(s.path)!==void 0)t.push(s);else try{await y(s.path),t.push(s)}catch{}return t.length!==e.apps.length&&await this.deps.writeIndex({apps:t}),t}};var E=30*6e4,j=/^APP\d{6,}$/;function Y(r){return!!r&&j.test(r.trim())}function _(){return{store:new c,client:(r,e)=>new w(r,e),fetchToFile:async(r,e)=>{let t=await h(r,{method:"GET",signal:AbortSignal.timeout(E)});if(!t.ok)throw new Error(`Downloading the app failed: ${t.status} ${t.statusText}`);if(!t.body)throw new Error("Downloading the app failed: empty response body");await F(U.fromWeb(t.body),R(e))}}}async function Z(r,e={}){let t={..._(),...e},s=r.appId.trim(),a=await t.store.find(s);if(a&&await t.store.exists(a))return r.onProgress?.(`using the copy of ${a.name} already on this machine`),await t.store.put({key:s,sourcePath:a.path,source:"cloud",name:a.name}),{path:a.path,name:a.name,fromStore:!0};r.onProgress?.(`looking up ${s}\u2026`);let o=await t.client(r.baseUrl,r.auth).details(s);if(r.accepts&&!r.accepts.some(i=>o.name.toLowerCase().endsWith(i)))throw new Error(`${o.name} cannot run on this device \u2014 expected ${r.accepts.join(" or ")}.`);r.onProgress?.(`downloading ${o.name} \u2014 this can take a while, please wait\u2026`);let p=await O(A(T(),"kane-app-dl-"));try{let i=A(p,z(o.name));await t.fetchToFile(o.url,i);let n=await t.store.put({key:s,sourcePath:i,source:"cloud",name:o.name});return r.onProgress?.(`${o.name} is ready`),{path:n.path,name:n.name,fromStore:!1,details:o}}finally{await $(p,{recursive:!0,force:!0})}}export{c as a,Y as b,Z as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as l}from"./chunk-JFBEHCJN.js";import{a as m}from"./chunk-GGV336P5.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-VZA7BPCK.js";import{a as c,b as s,h as a,y as u}from"./chunk-QMOGBKJM.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
2
+ import{b as l}from"./chunk-OKA6FPJM.js";import{a as m}from"./chunk-FI2DVNRT.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-K75WIRI5.js";import{a as c,b as s,h as a,y as u}from"./chunk-FAMQ4DHU.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as i}from"./chunk-ENG2UTMX.js";function c(t){let o=[];t.executionId&&o.push({label:"execution",kind:"execution",packPath:i(t.executionId,t.cwd),status:t.executionStatus??"passed"});for(let e of t.authored)e.executionId&&o.push({label:e.relPath,kind:"authored",packPath:i(e.executionId,t.cwd),status:e.overallStatus,...e.testId?{testId:e.testId}:{},...e.commitId?{commitId:e.commitId}:{},...e.sourceExecutionId?{sourceExecutionId:e.sourceExecutionId}:{}});return o}function s(t){return t.map(o=>`kane-cli evidence serve ${o.packPath} # ${o.kind==="authored"?`${o.label} (authored)`:o.label}`)}export{c as a,s as b};
2
+ import{b as i}from"./chunk-Z36KVIRR.js";function c(t){let o=[];t.executionId&&o.push({label:"execution",kind:"execution",packPath:i(t.executionId,t.cwd),status:t.executionStatus??"passed"});for(let e of t.authored)e.executionId&&o.push({label:e.relPath,kind:"authored",packPath:i(e.executionId,t.cwd),status:e.overallStatus,...e.testId?{testId:e.testId}:{},...e.commitId?{commitId:e.commitId}:{},...e.sourceExecutionId?{sourceExecutionId:e.sourceExecutionId}:{}});return o}function s(t){return t.map(o=>`kane-cli evidence serve ${o.packPath} # ${o.kind==="authored"?`${o.label} (authored)`:o.label}`)}export{c as a,s as b};
@@ -1,9 +1,9 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Je}from"./chunk-DREQ3RAA.js";import{b as ne,c as $,d as ie,e as oe}from"./chunk-4523YDTG.js";import{h as jt,i as Ot}from"./chunk-GYDJO32R.js";import{b as mt,c as ft,d as gt,e as _t,f as vt,j as yt,l as ht,m as wt,n as x,o as bt,p as kt,r as xt}from"./chunk-52VCA4K2.js";import{c as St,d as It}from"./chunk-USJ3LUAL.js";import{a as N}from"./chunk-P2LDAW3C.js";import{a as At,b as Ct}from"./chunk-KRRZCY7U.js";import{b as Dt}from"./chunk-QQI6N3FO.js";import{a as X,c as qe,d as Ge,e as We,f as Z}from"./chunk-IINZZ4BZ.js";import{a as T}from"./chunk-73Y6T2UK.js";import{e as Pt}from"./chunk-ZKPY3AXW.js";import{b as et,e as tt,g as rt,h as nt,i as it,j as ot}from"./chunk-UX2CDUPE.js";import{b as h,c as ee,d as Qe,g as te}from"./chunk-ENG2UTMX.js";import{a as Q,b as C,d as Xe,e as Ze}from"./chunk-FYCD765R.js";import{a as Be,b as Ve}from"./chunk-VVCZRCRD.js";import{c as ze,d as Ye,e as He}from"./chunk-FBQ7PQJV.js";import{g as Ue}from"./chunk-Y6Y6RAY4.js";import{b as Ke,d as U,e as z}from"./chunk-URAYFJGM.js";import{a as F}from"./chunk-MPEIMWQI.js";import{d as pt}from"./chunk-XB6BJPDL.js";import{h as Y,k as st,m as at,o as ct}from"./chunk-7V34ZMMS.js";import{f as Et}from"./chunk-TLOYTGVT.js";import{a as Rt}from"./chunk-I2MC6VVX.js";import{M as dt,vb as lt}from"./chunk-Z777GGHB.js";import{f as re,g as ut}from"./chunk-KU3YHPWZ.js";import{b as A,c as b}from"./chunk-VZ7KXRXB.js";import{c as $e}from"./chunk-GGV336P5.js";import{f as Ne}from"./chunk-A7RJQJNT.js";import{a as Te}from"./chunk-QMOGBKJM.js";function j(e){if(e===null)return"broken";let t=Math.floor(e/100);return t===1?"passed":t===7?"failed":t===2?"skipped":"broken"}var D={failed:3,broken:2,passed:1,skipped:0};function se(e){let t="skipped";for(let r of e)D[r]>D[t]&&(t=r);return t}import{createHash as ur}from"crypto";import{basename as dr}from"path";function ae(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return t.length>0?t:"session"}function ce(e){return ur("sha256").update(e).digest("hex").slice(0,8)}function ue(e){let t=dr(e).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${ae(t)}-${ce(e)}`}function de(e,t){return`${ae(e)}-${ce(t)}`}function le(e,t=process.env){let r=Je(t),n={...r.testInstanceId?{hyper_test_instance_id:r.testInstanceId}:{},...r.jobId?{hyper_job_id:r.jobId}:{},...r.taskId?{hyper_task_id:r.taskId}:{},...e},o={};for(let[i,s]of Object.entries(n))typeof s=="string"&&s.length>0&&(o[i]=s);return o}function lr(e,t){return{pack_test_dir:e,ordinal_offset:t}}import{promises as S}from"fs";import{join as I}from"path";function pe(e){let t={evidence:"0.1",run_id:e.execution_id,status:"running",title:e.title,started:e.started,environment:{producer:{name:"kane-cli",version:e.producerVersion},...e.surfaces?{surfaces:e.surfaces}:{},run_kind:e.run_kind,origin:e.origin,pid:e.pid,...e.overrideStartUrl?{override_start_url:e.overrideStartUrl}:{}},...e.credits!==void 0?{metrics:{credits:{value:e.credits,type:"count"}}}:{}};return b(t,{lineWidth:-1})}async function me(e,t,r,n=process.cwd(),o){let i=o??h(e.execution_id,n),s=I(i,"tests",t);return await S.mkdir(I(i,"coverage"),{recursive:!0}),await S.writeFile(I(i,"coverage",".keep"),""),await S.mkdir(s,{recursive:!0}),await S.writeFile(I(i,"run.yaml"),pe(e)),r&&await S.writeFile(I(s,r.path),r.content),i}async function pr(e,t=process.cwd()){let r=h(e.execution_id,t);await S.mkdir(I(r,"coverage"),{recursive:!0}),await S.writeFile(I(r,"coverage",".keep"),"");let n=A(pe(e));return n.environment&&delete n.environment.run_kind,await S.writeFile(I(r,"run.yaml"),b(n,{lineWidth:-1})),r}async function mr(e,t=process.cwd()){return C(h(e,t),new Date().toISOString())}async function fe(e,t=process.cwd()){await S.rm(h(e,t),{recursive:!0,force:!0})}import{promises as ge}from"fs";import{join as _e}from"path";function H(e){let t={evidence:"0.1",test:e.testId,status:e.status,...e.durationMs!==void 0?{duration_ms:e.durationMs}:{},...e.attempts&&e.attempts.length?{attempts:e.attempts}:{},...e.flaky!==void 0?{flaky:e.flaky}:{},...e.adaptiveHeal?{adaptive_heal:e.adaptiveHeal}:{},...e.definitionPath?{definition:{path:e.definitionPath}}:{},...e.definitionId?{definition_id:e.definitionId}:{},...e.assuranceId?{assurance_id:e.assuranceId}:{},...e.assuranceBase?{assurance_base:e.assuranceBase}:{},...Object.keys(e.externalId).length?{external_id:e.externalId}:{},...e.tags&&e.tags.length?{tags:e.tags}:{},...Object.keys(e.environment).length?{environment:e.environment}:{},steps:e.steps};return b(t,{lineWidth:-1})}function ve(e){return b({logs:e},{lineWidth:-1})}async function ye(e,t,r){await ge.writeFile(_e(e,"tests",t,"result.yaml"),r)}async function he(e,t,r){let n=_e(e,"tests",t,"logs");await ge.mkdir(n,{recursive:!0}),await ge.writeFile(_e(n,"meta.yaml"),r)}import{promises as K}from"fs";import{join as Lt}from"path";function Mt(e){return Lt(e,".internal","meta.json")}async function Ft(e){let t;try{t=await K.readFile(Mt(e),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(t);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function we(e,t){let r;try{r=await Ft(e)??{}}catch(s){console.warn(`evidence: meta.json at ${e} unreadable \u2014 skipping execution-pointer append to preserve identity`,s);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(t),r.executions=n,await K.mkdir(Lt(e,".internal"),{recursive:!0});let o=Mt(e),i=`${o}.tmp-${process.pid}-${Date.now()}`;await K.writeFile(i,JSON.stringify(r,null,2)+`
2
+ import{a as Je}from"./chunk-DREQ3RAA.js";import{b as ne,c as $,d as ie,e as oe}from"./chunk-P4VFC6HO.js";import{h as jt,i as Ot}from"./chunk-YO6SNXBJ.js";import{b as mt,c as ft,d as gt,e as _t,f as vt,j as yt,l as ht,m as wt,n as x,o as bt,p as kt,r as xt}from"./chunk-MEMXFTLD.js";import{c as St,d as It}from"./chunk-SSOUYKVG.js";import{a as N}from"./chunk-HVOXMCKE.js";import{a as At,b as Ct}from"./chunk-TAY7J5VS.js";import{b as Dt}from"./chunk-NVD2MXHQ.js";import{a as X,c as qe,d as Ge,e as We,f as Z}from"./chunk-IINZZ4BZ.js";import{a as T}from"./chunk-73Y6T2UK.js";import{e as Pt}from"./chunk-VE4HLIGA.js";import{b as et,e as tt,g as rt,h as nt,i as it,j as ot}from"./chunk-GJ7MO2FW.js";import{b as h,c as ee,d as Qe,g as te}from"./chunk-Z36KVIRR.js";import{a as Q,b as C,d as Xe,e as Ze}from"./chunk-Q4JV4U65.js";import{a as Be,b as Ve}from"./chunk-44SIFDNY.js";import{c as ze,d as Ye,e as He}from"./chunk-5KJU4MG4.js";import{g as Ue}from"./chunk-Y6Y6RAY4.js";import{b as Ke,d as U,e as z}from"./chunk-226AGYHB.js";import{a as F}from"./chunk-FOLUB336.js";import{d as pt}from"./chunk-XB6BJPDL.js";import{h as Y,k as st,m as at,o as ct}from"./chunk-7V34ZMMS.js";import{f as Et}from"./chunk-H4TIVILC.js";import{a as Rt}from"./chunk-4C7WVQOD.js";import{M as dt,vb as lt}from"./chunk-PI7OXS62.js";import{f as re,g as ut}from"./chunk-KU3YHPWZ.js";import{b as A,c as b}from"./chunk-VZ7KXRXB.js";import{c as $e}from"./chunk-FI2DVNRT.js";import{f as Ne}from"./chunk-A7RJQJNT.js";import{a as Te}from"./chunk-FAMQ4DHU.js";function j(e){if(e===null)return"broken";let t=Math.floor(e/100);return t===1?"passed":t===7?"failed":t===2?"skipped":"broken"}var D={failed:3,broken:2,passed:1,skipped:0};function se(e){let t="skipped";for(let r of e)D[r]>D[t]&&(t=r);return t}import{createHash as ur}from"crypto";import{basename as dr}from"path";function ae(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return t.length>0?t:"session"}function ce(e){return ur("sha256").update(e).digest("hex").slice(0,8)}function ue(e){let t=dr(e).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${ae(t)}-${ce(e)}`}function de(e,t){return`${ae(e)}-${ce(t)}`}function le(e,t=process.env){let r=Je(t),n={...r.testInstanceId?{hyper_test_instance_id:r.testInstanceId}:{},...r.jobId?{hyper_job_id:r.jobId}:{},...r.taskId?{hyper_task_id:r.taskId}:{},...e},o={};for(let[i,s]of Object.entries(n))typeof s=="string"&&s.length>0&&(o[i]=s);return o}function lr(e,t){return{pack_test_dir:e,ordinal_offset:t}}import{promises as S}from"fs";import{join as I}from"path";function pe(e){let t={evidence:"0.1",run_id:e.execution_id,status:"running",title:e.title,started:e.started,environment:{producer:{name:"kane-cli",version:e.producerVersion},...e.surfaces?{surfaces:e.surfaces}:{},run_kind:e.run_kind,origin:e.origin,pid:e.pid,...e.overrideStartUrl?{override_start_url:e.overrideStartUrl}:{}},...e.credits!==void 0?{metrics:{credits:{value:e.credits,type:"count"}}}:{}};return b(t,{lineWidth:-1})}async function me(e,t,r,n=process.cwd(),o){let i=o??h(e.execution_id,n),s=I(i,"tests",t);return await S.mkdir(I(i,"coverage"),{recursive:!0}),await S.writeFile(I(i,"coverage",".keep"),""),await S.mkdir(s,{recursive:!0}),await S.writeFile(I(i,"run.yaml"),pe(e)),r&&await S.writeFile(I(s,r.path),r.content),i}async function pr(e,t=process.cwd()){let r=h(e.execution_id,t);await S.mkdir(I(r,"coverage"),{recursive:!0}),await S.writeFile(I(r,"coverage",".keep"),"");let n=A(pe(e));return n.environment&&delete n.environment.run_kind,await S.writeFile(I(r,"run.yaml"),b(n,{lineWidth:-1})),r}async function mr(e,t=process.cwd()){return C(h(e,t),new Date().toISOString())}async function fe(e,t=process.cwd()){await S.rm(h(e,t),{recursive:!0,force:!0})}import{promises as ge}from"fs";import{join as _e}from"path";function H(e){let t={evidence:"0.1",test:e.testId,status:e.status,...e.durationMs!==void 0?{duration_ms:e.durationMs}:{},...e.attempts&&e.attempts.length?{attempts:e.attempts}:{},...e.flaky!==void 0?{flaky:e.flaky}:{},...e.adaptiveHeal?{adaptive_heal:e.adaptiveHeal}:{},...e.definitionPath?{definition:{path:e.definitionPath}}:{},...e.definitionId?{definition_id:e.definitionId}:{},...e.assuranceId?{assurance_id:e.assuranceId}:{},...e.assuranceBase?{assurance_base:e.assuranceBase}:{},...Object.keys(e.externalId).length?{external_id:e.externalId}:{},...e.tags&&e.tags.length?{tags:e.tags}:{},...Object.keys(e.environment).length?{environment:e.environment}:{},steps:e.steps};return b(t,{lineWidth:-1})}function ve(e){return b({logs:e},{lineWidth:-1})}async function ye(e,t,r){await ge.writeFile(_e(e,"tests",t,"result.yaml"),r)}async function he(e,t,r){let n=_e(e,"tests",t,"logs");await ge.mkdir(n,{recursive:!0}),await ge.writeFile(_e(n,"meta.yaml"),r)}import{promises as K}from"fs";import{join as Lt}from"path";function Mt(e){return Lt(e,".internal","meta.json")}async function Ft(e){let t;try{t=await K.readFile(Mt(e),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(t);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function we(e,t){let r;try{r=await Ft(e)??{}}catch(s){console.warn(`evidence: meta.json at ${e} unreadable \u2014 skipping execution-pointer append to preserve identity`,s);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(t),r.executions=n,await K.mkdir(Lt(e,".internal"),{recursive:!0});let o=Mt(e),i=`${o}.tmp-${process.pid}-${Date.now()}`;await K.writeFile(i,JSON.stringify(r,null,2)+`
3
3
  `),await K.rename(i,o)}async function fr(e){try{let t=await Ft(e);return t&&Array.isArray(t.executions)?t.executions:[]}catch{return[]}}function be(e){let t=[];for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(o=>o.resultCode):[r.resultCode];for(let o of n)t.push(j(o))}return se(t)}function gr(e){let t=null;for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(o=>o.resultCode):[r.resultCode];for(let o of n)o!=null&&(t==null||D[j(o)]>D[j(t)]||D[j(o)]===D[j(t)]&&o>t)&&(t=o)}return t}import{promises as _r}from"fs";import{extname as Tt,basename as vr}from"path";var yr={".ndjson":"ndjson",".log":"log",".json":"json",".har":"har"};async function ke(e){let t;try{t=await _r.readdir(e)}catch{return[]}return t.filter(r=>r!=="meta.yaml"&&!r.startsWith(".")).sort().map(r=>({name:vr(r,Tt(r)),file:r,format:yr[Tt(r)]??"txt"}))}import{mkdirSync as hr,appendFileSync as wr}from"fs";import{join as Nt}from"path";function xe(e,t){return Nt(e,"tests",t,"logs")}function Se(e,t,r,n={},o){try{o?.(t,r,r,n)}catch{}if(e)try{hr(e,{recursive:!0});let i=JSON.stringify({ts:new Date().toISOString(),level:t,event:r,...n})+`
4
4
  `;wr(Nt(e,"diagnostics.ndjson"),i)}catch{}}import{promises as R}from"fs";import{dirname as Ar,join as O}from"path";import{statSync as br}from"fs";import{promises as Ie}from"fs";import{basename as kr,join as xr}from"path";var Sr=1e6,Ir=2e6;function Rr(){return Be.map(e=>Ve(e))}function $t(e=Rr()){return e.map(t=>{let r=0;try{r=br(t).size}catch{}return{path:t,offset:r}})}var Er=/\x1b\[[0-9;]*[A-Za-z]/g;async function Pr(e,t,r){let n;try{n=await Ie.open(e,"r");let o=(await n.stat()).size,i=t<=o?t:0,s=o-i;if(s<=0)return null;let a=s>r?o-r:i,c=Buffer.alloc(Math.min(s,r));return await n.read(c,0,c.length,a),c.toString("utf8")}catch{return null}finally{await n?.close().catch(()=>{})}}async function Bt(e,t){let r=t.caps?.stderr??Sr,n=t.caps?.appium??Ir,o=[];t.runnerStderrPath&&o.push({src:t.runnerStderrPath,from:0,cap:r});for(let i of t.appiumMarks??[])o.push({src:i.path,from:i.offset,cap:n});for(let i of o){let s=await Pr(i.src,i.from,i.cap);if(s===null)continue;let a=s.replace(Er,"");if(a!=="")try{await Ie.mkdir(e,{recursive:!0}),await Ie.writeFile(xr(e,kr(i.src)),a)}catch{}}}async function Cr(e){try{let t=O(e,"tests"),r=await R.readdir(t).catch(()=>[]);for(let n of r){let o=O(t,n,"steps"),i=await R.readdir(o).catch(()=>[]);for(let s of i){let a=await R.readFile(O(o,s,"failure.yaml"),"utf8").catch(()=>null);if(a!=null)try{let c=A(a);if(c&&typeof c=="object"&&c.triage)return!0}catch{}}}}catch{}return!1}async function Vt(e,t,r,n={}){let o=O(e,"tests",t,"logs");if(r)try{await R.mkdir(o,{recursive:!0}),await R.copyFile(r,O(o,"tui.log"))}catch{}await Bt(o,{runnerStderrPath:r?O(Ar(r),"runner-stderr.log"):void 0,appiumMarks:n.appiumMarks});let i=await ke(o);if(!i.length&&n.requireRealLog)throw new Error(`evidence test ${t} has no real log to declare`);i.length&&await he(e,t,ve(i))}async function Re(e){let t=e.cwd??process.cwd(),r=e.packDir??h(e.executionId,t);if(!e.saved&&!e.packDir)return await fe(e.executionId,t),{sealed:!1};await Vt(r,e.testId,e.tuiLogPath,{requireRealLog:e.requireRealLog,appiumMarks:e.appiumMarks}),await z(r,await e.catalog??Ke());let n=O(r,"run.yaml"),o=A(await R.readFile(n,"utf8"));o.environment={...o.environment??{},saved:e.saved,run_kind:e.runKind},await R.writeFile(n,b(o,{lineWidth:-1}));let i=await R.open(n,"r+");try{await i.sync()}finally{await i.close()}let s=await Cr(r);await C(r,new Date().toISOString());let a;try{let u=await Q(r,"L1");a=u.valid;let p=(u.diagnostics??[]).filter(f=>String(f?.code??"").includes("failure.status_disagrees"));if(p.length>0)if(e.expectStatusDisagrees||s){let f=e.expectStatusDisagrees?"expected under --bug-detection continue":"self-explained by triaged failure record(s)";console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 ${f}`)}else console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 step verdicts disagree with their failure records`,p);if(!u.valid){console.warn(`evidence: sealed pack ${e.executionId} failed L1 validation`,u.diagnostics);let f=String(u.diagnostics?.[0]?.code??"");Se(xe(r,e.testId),"warn","EVIDENCE_INVALID",{execution_id:e.executionId,first_code:f,surface:e.surface??"testmd"},e.log)}}catch(u){console.warn(`evidence: validation error for ${e.executionId}`,u)}let c;if(e.saved&&e.packDir)try{c=await Qe(r,e.executionId,t)}catch(u){console.warn(`evidence: store install failed for ${e.executionId}`,u)}if(e.outputStemDir)try{await we(e.outputStemDir,{execution_id:e.executionId,run_kind:e.runKind,status:e.verdict,valid:a,at:new Date().toISOString()})}catch(u){console.warn(`evidence: execution-pointer append failed for ${e.executionId} (pack is sealed)`,u)}return{sealed:!0,valid:a,storePath:c}}import{release as Ut}from"os";import{execFileSync as Dr}from"child_process";var zt=!1,q;function jr(){if(!zt)if(zt=!0,process.platform==="darwin")try{q=Dr("sw_vers",["-productVersion"],{timeout:2e3}).toString().trim()||void 0}catch{q=Ut()||void 0}else q=Ut()||void 0;return q}function Ee(e){let t={os:X(process.platform)},r=jr();if(r&&(t.os_version=r),e.cdpBrowser){let i=/^([A-Za-z]+)\/(\d+)/.exec(e.cdpBrowser);i&&(t.browser=i[1].replace(/^Headless/,""),t.browser_version=i[2])}e.resolution&&(t.resolution=e.resolution);let n=Ge(t,e.runnerEnvironment);if(!n.native_platform)return n;e.deviceName&&(n.device=e.deviceName),!n.os_version&&e.deviceOsVersion&&(n.os_version=e.deviceOsVersion);let o=ze(e.deviceApp);if(o&&(n.app=o),Ne(n.target)){let i=Ue(e.runnerEnvironment?.device);i&&(n.device=i)}return e.pixelResolution&&(n.viewport=n.resolution??Or(e.pixelResolution,n.pixel_ratio)??e.pixelResolution,n.resolution=e.pixelResolution),n}function Or(e,t){if(!t||!Number.isFinite(t)||t<=0)return;let r=/^(\d+)x(\d+)$/.exec(e);if(r)return`${Math.round(Number(r[1])/t)}x${Math.round(Number(r[2])/t)}`}async function Yt(e){if(e)try{let t=await fetch(`${e}/json/version`,{signal:AbortSignal.timeout(2e3)});if(!t.ok)return;let r=await t.json();return typeof r.Browser=="string"?r.Browser:void 0}catch{return}}function Lr(e){let t;return()=>(t||(t=Yt(e)),t)}import{promises as w,existsSync as E,readFileSync as Nr}from"fs";import{basename as $r,join as v}from"path";import{readFileSync as Mr}from"fs";import{dirname as Fr,resolve as Tr}from"path";function Ht(e,t){let r=Tr(e),n=Mr(r,"utf8");return Y(t?st(n,at(Fr(r),t)):n)}async function Kt(e){for(let t of await w.readdir(e,{withFileTypes:!0})){let r=v(e,t.name);if(t.isDirectory()){await Kt(r);continue}try{await w.unlink(r)}catch{await w.truncate(r,0)}}await w.rmdir(e).catch(()=>{})}function Br(e){let t=e.authorBoundary<0||e.authorBoundary>e.totalSteps?e.totalSteps:e.authorBoundary;return{shrink_count:e.shrinkCount,complete_reauthor:t===0&&e.totalSteps>0,author_boundary:t,total_steps:e.totalSteps,reauthored_steps:e.totalSteps-t,credits_consumed:Math.round(e.creditsConsumed*100)/100}}var B=class e{constructor(t){this.opts=t}executionId;testId;definitionPath=null;definitionContent=null;accumulatedSteps=[];maxOrdinal=0;_attempts=[];_packDirOverride;_attached=!1;appiumMarks=$t();get attached(){return this._attached}static async attach(t){let r=$r(t.packDir).replace(/\.evidence$/,""),n=new e({origin:"testrun",runKind:"author",pid:process.pid,title:t.testId,started:new Date().toISOString(),producerVersion:Te,cwd:t.cwd});n.executionId=r,n.testId=t.testId,n._packDirOverride=t.packDir,n._attached=!0;let o=v(t.packDir,"tests",t.testId);return await w.mkdir(o,{recursive:!0}),t.definition&&(await w.writeFile(v(o,t.definition.path),t.definition.content),n.definitionPath=t.definition.path,n.definitionContent=t.definition.content),n}async start(){if(this._attached)throw new Error("attach-mode session is already started");this.executionId=ee(),this.testId=this.opts.testmdRelPath?ue(this.opts.testmdRelPath):de(this.opts.objectiveOrName??"session",this.opts.sessionId??this.executionId);let t=this.opts.definition??null;return await me({execution_id:this.executionId,title:this.opts.title,started:this.opts.started,producerVersion:this.opts.producerVersion,surfaces:this.opts.surfaces,run_kind:this.opts.runKind,origin:this.opts.origin,pid:this.opts.pid,...this.opts.credits!==void 0?{credits:this.opts.credits}:{},...this.opts.overrideStartUrl?{overrideStartUrl:this.opts.overrideStartUrl}:{}},this.testId,t,this.opts.cwd,this.opts.packRootDir?this.pack:void 0),t&&(this.definitionPath=t.path,this.definitionContent=t.content),{executionId:this.executionId,testId:this.testId,packTestDir:this.packTestDir}}get pack(){return this._packDirOverride?this._packDirOverride:this.opts.packRootDir?v(this.opts.packRootDir,`${this.executionId}.evidence`):h(this.executionId,this.opts.cwd)}get packTestDir(){return v(this.pack,"tests",this.testId)}async writeDefinition(t,r="test.md"){await w.writeFile(v(this.packTestDir,r),t),this.definitionPath=r,this.definitionContent=t}computeEngineBlock(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=v(this.opts.cwd,this.opts.testmdRelPath);if(E(t))return ct(Nr(t,"utf8"))??{}}}catch{}return{}}computeDefinitionId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=v(this.opts.cwd,this.opts.testmdRelPath),r=v(this.opts.cwd,".context"),n=E(r)?lt(r):void 0;if(E(t))return Ht(t,n)}if(this.definitionContent!=null)return Y(this.definitionContent)}catch{}}noteSpawn(t){this.accumulatedSteps.push(...t.steps),this.maxOrdinal=Math.max(this.maxOrdinal,t.maxOrdinal)}nextOrdinalOffset(){return this.maxOrdinal}get steps(){return this.accumulatedSteps}get attempts(){return this._attempts}async archiveAttempt(t,r,n={}){let o=this._attempts.length+1,i=v(this.packTestDir,String(o)),s=n.log,a=(u,l)=>s?.("warn","ARCHIVE_ATTEMPT_FAILED",`Attempt ${o}: ${u} could not be archived into ${o}/; the next attempt will mingle with it`,{attempt:o,dir:u,error:String(l)}),c;try{await w.mkdir(i,{recursive:!0})}catch(u){a(`${o}/`,u)}for(let u of["steps","logs","v16-trajectory"]){let l=v(this.packTestDir,u);if(!E(l))continue;let p=v(i,u);try{await w.rename(l,p);continue}catch(f){s?.("warn","ARCHIVE_ATTEMPT_RENAME_FAILED",`Attempt ${o}: rename of ${u}/ refused; copying it into ${o}/ and emptying the originals in place`,{attempt:o,dir:u,error:String(f),fallback:"copy+truncate"})}try{await w.cp(l,p,{recursive:!0}),await Kt(l)}catch(f){a(u,f)}}try{this.definitionPath&&E(v(this.packTestDir,this.definitionPath))&&await w.copyFile(v(this.packTestDir,this.definitionPath),v(i,this.definitionPath));let u=v(i,"steps");if(E(u)){for(let l of await w.readdir(u))if(E(v(u,l,"failure.yaml"))){c=`${o}/steps/${l}/failure.yaml`;break}}}catch(u){a("definition + failure pointer",u)}return this._attempts.push({n:o,status:t,steps:this.accumulatedSteps,...r!==void 0?{failedAt:r}:{},...c?{failure:c}:{}}),this.accumulatedSteps=[],this.maxOrdinal=0,o}async writeResult(t){let r=be(t.spawns),n=this._attempts.length?[...this._attempts.map(m=>({status:m.status})),{status:r,...t.durationMs!==void 0?{duration_ms:t.durationMs}:{}}]:void 0,o=n?new Set(n.map(m=>m.status)).size>1:void 0,i=this._attempts.length>0,s=t.heal,a=i||s?.forced?{triggered:i,...i?{outcome:r==="passed"?"healed":"exhausted"}:{},...s?Br(s):{},...i?{attempts:this._attempts.map(m=>({n:m.n,status:m.status,failed_at:m.failedAt??-1,...m.failure?{failure:m.failure}:{}}))}:{}}:void 0,c=this.pack,u=le(t.externalIdInput),l=Z(t.runnerEnv,t.intentEnv),p=this.computeDefinitionId(),{id:f,base:y}=this.computeEngineBlock();await ye(c,this.testId,H({testId:this.testId,status:r,durationMs:t.durationMs,definitionPath:this.definitionPath,definitionId:p,assuranceId:f,assuranceBase:y,externalId:u,environment:l,steps:t.steps,tags:t.tags,attempts:n,flaky:o,adaptiveHeal:a}));for(let m of this._attempts){let _=v(this.packTestDir,String(m.n));E(_)&&await w.writeFile(v(_,"result.yaml"),H({testId:this.testId,status:m.status,definitionPath:this.definitionPath,definitionId:p,assuranceId:f,assuranceBase:y,externalId:u,environment:l,steps:m.steps,tags:t.tags}))}let d=t.externalIdInput;return t.log&&(d.commit_id||d.test_id||d.testcase_id)&&t.log("info","EVIDENCE_EXTERNAL_ID","Evidence external-id mapping",{execution_id:this.executionId,commit_id:d.commit_id??null,test_id:d.test_id??null,testcase_id:d.testcase_id??null,tc_id:u.tc_id??null,project_id:d.project_id??null,session_id:d.session_id??null,session_name:d.session_name??null,hyper_test_instance_id:u.hyper_test_instance_id??null,hyper_job_id:u.hyper_job_id??null,hyper_task_id:u.hyper_task_id??null,dataset_id:u.dataset_id??null,dataset_row_id:u.dataset_row_id??null,dataset_version_id:u.dataset_version_id??null}),r}get id(){return this.executionId}get test(){return this.testId}};async function Vr(e,t,r=te){try{let n=await r(e);if(n.aborted.length>0||n.removed.length>0)try{t?.("info","EVIDENCE_RECOVERY","Startup evidence recovery swept incomplete packs",{aborted:n.aborted,removed:n.removed,origin:"startup"})}catch{}return n}catch(n){return console.warn("evidence: startup recovery failed",n),{aborted:[],removed:[]}}}import{promises as dn}from"fs";import{existsSync as tn,mkdirSync as rn,rmSync as nn,writeFileSync as on}from"fs";import{join as Ce}from"path";import{mkdirSync as Ur,renameSync as zr,rmSync as Yr,writeFileSync as Hr}from"fs";import{join as qt}from"path";var Kr=5e6;function Gt(e,t,r){let n=qt(e,"coverage","sources"),o=new Map,i=!1;try{for(let s of r.usecases)for(let a of s.sources){if(o.has(a.id)){a.file=o.get(a.id);continue}if(!a.cid)continue;let c=t.getBlob(a.cid);if(c===null||c.byteLength>Kr)continue;i||(Ur(n,{recursive:!0}),i=!0);let u=qt(n,a.id),l=`${u}.tmp-${process.pid}`;Hr(l,c),zr(l,u);let p=`coverage/sources/${a.id}`;o.set(a.id,p),a.file=p}}catch{for(let s of r.usecases)for(let a of s.sources)delete a.file;if(i)try{Yr(n,{recursive:!0,force:!0})}catch{}}}function qr(e){return e.state==="proven"?"covered":e.proven>0?"partial":"uncovered"}function Gr(e,t,r){let n={};for(let s of e.perUc)n[s.id]={status:qr(s),state:s.state,pct:Math.round(s.pct)};let o={};for(let[s,a]of Object.entries(e.perAc)){let c=a.state==="proven";o[s]={score:c?1:0,verified:c,passes:t[s]?.passes??0,counted:t[s]?.counted??0}}let i=Object.values(n).map(s=>s.status);return{rollup_version:2,stale_sources:e.flags.stale_sources,high_risk_gaps:(r??[]).filter(s=>s.risk==="high").length,aspects:{coverage:{config:e.config,acs:o,usecases:n,summary:{coverage_pct:Math.round(e.pct),acs_verified:`${e.criteria.proven}/${e.criteria.total}`,usecases_covered:`${i.filter(s=>s==="covered").length}/${i.length}`,uncovered:i.filter(s=>s==="uncovered").length}}}}}var Wr={passed:"passed",failed:"failed",broken:"blocked"};function Jr(e,t,r){let n=e.edgesFrom(t).find(i=>i.type===ut.SCOPED_TO),o=n?e.tipOf(n.dst):r;return o===r?{type:"usecase",ref:x(e,r)}:{type:"scenario",ref:x(e,o)}}function Wt(e,t,r){let n=xt({graph:e,runs:t,thisRun:r}),{inScope:o}=ht(e),i=wt(e,new Set(o)),s=new Map(o.map(p=>[x(e,p),p])),a={},c=p=>F(e,p),u=n.perUc.map(p=>{let f=s.get(p.id),y=e.tipOf(f),d=mt(e,y,c).map(_=>gt(e,_,c,x)).sort((_,k)=>_.id<k.id?-1:1),m=(i.get(f)??[]).map(_=>{let k=x(e,_),L=e.getNode(_)?.content??{},V=bt(e,_).sort((g,P)=>x(e,g)<x(e,P)?-1:1),W=kt(e,t,_,V,r).sort((g,P)=>g.at<P.at?-1:g.at>P.at?1:0),M=n.perAc[k]?.this_run,J=V.length>0;a[k]={passes:W.filter(g=>g.verdict==="passed").length,counted:W.filter(g=>g.verdict==="passed"||g.verdict==="failed").length};let Fe=W.slice(-10).map(g=>({execution_id:g.executionId,ts:g.at,verdict:g.verdict,stale_at_run:!!g.fact.stale_at_run,oracle_mode:String(g.fact.oracle_mode),...g.fact.via_parent?{via_parent:String(g.fact.via_parent)}:{}}));return{id:k,text:String(L.text??""),risk:String(L.risk??""),scope:Jr(e,_,y),covered_by:V.map(g=>x(e,g)),...J?{link_type:"verifies"}:{},execution:M===void 0?"not-run":Wr[M]??"not-run",...M!==void 0?{this_run:M}:{},fresh:J&&M===void 0?"unknown":e.stale(_)==="fresh"?"fresh":"stale",derived:!!L.derived,..._t(L),...J?{satisfied_by:V.map(g=>{let P=e.getNode(g)?.content.check?.verified_against;return{test:x(e,g),...P?{step:P}:{}}})}:{},...Fe.length?{executions:Fe}:{}}}).sort((_,k)=>_.id<k.id?-1:1);return{...ft(e,f,x),scenarios:d,acceptance_criteria:m}}),l=vt(e);return{usecases:u,...l.length?{gaps:l}:{},rollup:Gr(n,a,l),coverage:n}}import{existsSync as Jt,readdirSync as Xr,readFileSync as Zr,statSync as Qr}from"fs";import{join as Pe}from"path";function Ae(e){let t=Pe(e,"tests");if(!Jt(t))return[];let r=[];for(let n of Xr(t).sort()){let o=Pe(t,n,"result.yaml");if(!Qr(Pe(t,n)).isDirectory()||!Jt(o))continue;let i=A(Zr(o,"utf8"));!i?.assurance_id&&!i?.definition_id||r.push({test:n,...i.assurance_id?{assuranceId:String(i.assurance_id)}:{},...i.definition_id?{definitionId:String(i.definition_id)}:{},...i.assurance_base?{base:String(i.assurance_base)}:{},verdict:String(i.status??""),acs:St(i.steps??[])})}return r}function en(e,t){if(t.assuranceId){let r=e.resolve(t.assuranceId),n=r?e.tipOf(r.cid):null;if(n!==null&&e.nodeLabel.get(n)===re.TEST&&F(e,n))return n}if(t.definitionId){for(let{cid:r,content:n}of e.byLabel(re.TEST))if(F(e,r)&&n.definitionId===t.definitionId)return r}return null}function Xt(e,t,r){let n=new Map,o=new Set;for(let i of t){let s=en(e,i);if(s===null||i.definitionId===void 0||r.definitionNow(e,s)!==i.definitionId)continue;let a=`${r.executionId}/${i.test}`;o.add(a);let c=n.get(s)??[];c.push({about:s,definition_id_at_run:i.definitionId,verdict:i.verdict,...i.acs.length?{per_ac:i.acs.map(u=>({ac_ref:u.ref,verdict:u.verdict}))}:{},drift_flag:!1,oracle_mode:"authored",stale_at_run:!1,execution_id:a,started_at:r.at,mode:"testmd",local:!0}),n.set(s,c)}return{runs:i=>n.get(e.tipOf(i))??[],thisRun:o}}var Zt=async(e,t,r)=>{if(t.kind==="grid")try{return Ae(e).some(i=>i.assuranceId)?{status:"pending",reason:"on_grid"}:{status:"skipped",reason:"not_assurance_project"}}catch{return{status:"pending",reason:"on_grid"}}if(t.kind==="none")return{status:"skipped",reason:t.reason};let n=Ce(e,"coverage"),o=tn(n);try{let i=Ae(e),s;if(t.kind==="lattice"){let a=await t.ask(i,r.executionId);if(a==="no_context")return{status:"skipped",reason:"no_use_cases_yet"};if(a==="no_answer")return{status:"pending",reason:"project_no_answer"};s=a}else{if(!t.store.exists())return{status:"skipped",reason:"not_assurance_project"};let a=dt(t.store);t.store.prefetch(pt(a),{token:null});let{runs:c,thisRun:u}=Xt(a,i,{executionId:r.executionId,at:new Date().toISOString(),definitionNow:yt});s=Wt(a,c,u);let l=new Set(s.coverage.this_run?.usecases??[]);Gt(e,t.store,{usecases:s.usecases.filter(p=>l.has(p.id))})}return rn(n,{recursive:!0}),on(Ce(n,"usecases.yaml"),b(s,{lineWidth:-1})),t.kind==="lattice"?{status:"written",computedBy:"project",project:t.project,doc:s.coverage}:{status:"written",computedBy:"local",doc:s.coverage}}catch(i){try{nn(o?Ce(n,"sources"):n,{recursive:!0,force:!0})}catch{}return{status:"failed",detail:i instanceof Error?i.message:String(i)}}};var sn=1e4,an=({url:e,basicAuth:t,projectId:r,body:n,budgetMs:o})=>Et({url:e,basicAuth:t,requestDeadlineMs:o}).coverageRun(r,n),cn=At("pack-coverage");function Qt(e,t={}){if((t.env??process.env).KANE_CLI_MODE==="hyperexecute")return{kind:"grid"};let r=Dt(e,t.address??$e());switch(r.kind){case"local":return{kind:"local",store:N(T(e))};case"refuse":return r.code==="BOTH_STORES"?{kind:"local",store:N(T(e))}:{kind:"none",reason:"project_file_unreadable"};case"remote":{let n=t.budgetMs??sn;return{kind:"lattice",project:r.projectName,ask:async(o,i)=>{try{let s=await(t.auth??Pt)(),a={execution_id:i,members:o.map(un)};return(await Ot((t.run??an)({url:r.latticeUrl,basicAuth:s,projectId:r.projectId,body:a,budgetMs:n}),n)).pack}catch(s){return s instanceof Rt&&s.code==="NO_CONTEXT"?"no_context":(cn(`the shared project's coverage wasn't read: ${s instanceof jt?s.message:Ct(s)}`),"no_answer")}}}}case"pick":return{kind:"none",reason:"not_assurance_project"}}}var un=e=>{let t=e.base??e.definitionId;return{...e.assuranceId?{assurance_id:e.assuranceId}:{},...t?{definition_id:t}:{},test:e.test,verdict:e.verdict,acs:e.acs}};async function ln(e){try{let t=new B({origin:"inline",runKind:"author",pid:e.pid,title:e.title,started:new Date().toISOString(),producerVersion:e.producerVersion,surfaces:e.surfaces,objectiveOrName:e.objectiveOrName,sessionId:e.sessionId,cwd:e.cwd,packRootDir:e.packRootDir}),r=await t.start();return{session:t,...r,packDir:t.pack,spawns:[],startedAtMs:Date.now(),cwd:e.cwd}}catch(t){return console.warn("evidence: inline pack creation failed",t),null}}function pn(e,t,r){if(!e)return;e.session.noteSpawn(t),t.resolution&&(e.resolution=t.resolution),e.runnerEnvironment=qe(e.runnerEnvironment,t.runnerEnvironment);let n=(r?.per_flow_metadata??[]).map(o=>({resultCode:o?.result_code!=null?Number(o.result_code):null}));e.spawns.push({resultCode:r?.result_code!=null?Number(r.result_code):null,...n.length?{perFlow:n}:{}})}function mn(e){if(e)return{packTestDir:e.packTestDir,ordinalOffset:e.session.nextOrdinalOffset()}}async function fn(e,t){if(!e)return null;if(e.finalized)return e.finalized;let r=(n,o,i)=>t.log?t.log("warn",n,o,i):console.warn(`evidence: ${o}`,i??"");try{if(t.recordedTestPath)try{await e.session.writeDefinition(await dn.readFile(t.recordedTestPath,"utf8"))}catch(c){r("EVIDENCE_DEFINITION_FAILED","could not attach synthesized test.md",{error:String(c)})}let n=t.cdpBrowserCapture?await t.cdpBrowserCapture():void 0,o=await e.session.writeResult({steps:e.session.steps,spawns:e.spawns.length?e.spawns:[{resultCode:null}],externalIdInput:{...t.externalIdInput,execution_id:e.executionId},runnerEnv:await He(Ee({cdpBrowser:n,resolution:e.resolution,runnerEnvironment:e.runnerEnvironment,deviceName:t.deviceName,deviceApp:t.deviceApp,pixelResolution:await Ye(e.packTestDir)}),{environment:t.environment,deviceModel:t.deviceModel,runnerEnvironment:e.runnerEnvironment}),intentEnv:We(t.model,e.runnerEnvironment),durationMs:t.durationMs??Date.now()-e.startedAtMs,log:t.log}),i=N(T(t.cwd??e.cwd??process.cwd()));try{if(t.recordedTestPath){let c=It({projectDir:t.cwd??e.cwd??process.cwd(),store:i,members:[{path:t.recordedTestPath,verdict:o,executionId:e.executionId,startedAt:new Date(e.startedAtMs).toISOString(),mode:"inline",local:t.local??!1}]});for(let u of c.warnings)r("EXEC_SYNC",u)}}catch(c){r("EXEC_SYNC","exec-sync failed",{error:String(c)})}let s;try{let c=t.cwd??e.cwd??process.cwd();s=await(t.coverageWriter??Zt)(e.packDir,(t.coverageSource??Qt)(c),{executionId:e.executionId}),(s.status==="skipped"||s.status==="failed")&&r("EVIDENCE_COVERAGE_SKIPPED",`coverage/usecases.yaml not written: ${s.status==="skipped"?s.reason:s.detail}`)}catch(c){s={status:"failed",detail:String(c)},r("EVIDENCE_COVERAGE_SKIPPED","coverage writer threw",{error:String(c)})}let a=await Re({executionId:e.executionId,testId:e.testId,saved:t.saved,runKind:"author",verdict:o,cwd:t.cwd??e.cwd,packDir:e.packDir,tuiLogPath:t.tuiLogPath,log:t.log,surface:"inline",requireRealLog:!!e.runnerEnvironment?.native_platform,appiumMarks:e.session.appiumMarks,catalog:t.environment?U(t.environment):void 0});return e.finalized={...a,coverage:s},t.log?.("info","EVIDENCE_SEALED","Inline pack sealed",{execution_id:e.executionId,verdict:o,valid:a.valid,pack:e.packDir,store_copy:a.storePath??null}),e.finalized}catch(n){return r("EVIDENCE_SEAL_FAILED","inline pack finalize failed",{error:String(n)}),null}}import{statSync as gn,openSync as _n,readSync as vn,closeSync as yn}from"fs";import{basename as hn,resolve as wn}from"path";async function bn(e,t,r={}){let n=r.out??(l=>process.stdout.write(l+`
5
5
  `)),o=l=>(n(`error: ${l}`),2);if(t.env!=="prod"&&t.env!=="stage")return o(`invalid --env: ${String(t.env)}`);if(t.port!==void 0&&(!Number.isInteger(t.port)||t.port<1||t.port>65535))return o("invalid --port: expected an integer 1-65535");let i;try{i=$(t.env,t.viewerUrl),new URL(i)}catch{return o(`invalid --viewer-url: ${t.viewerUrl}`)}if(e.length===0)return o("no pack paths given");let s=new Map;for(let l of e){let p=wn(l),f;try{f=gn(p)}catch{return o(`${l}: not found`)}if(f.isDirectory())return o(`${l}: is a directory \u2014 packs must be sealed .evidence files (run the execution to completion, or seal it, first)`);if(!f.isFile())return o(`${l}: not a regular file`);let y=Buffer.alloc(2),d=_n(p,"r");try{vn(d,y,0,2,0)}finally{yn(d)}if(y.toString("latin1")!=="PK")return o(`${l}: not a sealed evidence pack (zip magic missing)`);let m=hn(p);if(s.has(m))return o(`duplicate pack basename: ${m} (URL names collide \u2014 rename one)`);s.set(m,p)}let a=r.log??((l,p,f)=>process.stderr.write(`warn: ${p} reason=${f.reason} path=${f.path}
6
- `)),c;try{c=await ne({packs:s,allowedOrigins:[new URL(i).origin],port:t.port,log:a})}catch(l){return o(`could not bind 127.0.0.1${t.port?`:${t.port}`:""} \u2014 ${l.message}`)}n(`serving ${s.size} pack${s.size===1?"":"s"} on http://127.0.0.1:${c.port}`);for(let l of s.keys()){let p=c.urlFor(l);n(l),n(` pack ${p}`),n(` viewer ${ie(p,i)}`)}return n("press Ctrl-C to stop"),await(r.hold??kn)(),await c.close(),0}function kn(){return new Promise(e=>{let t=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of t)process.on("SIGINT",r);e()})})}import{promises as G}from"fs";import{tmpdir as Rn}from"os";import{basename as En,join as rr,resolve as je}from"path";var xn=["error","prefer_first","prefer_latest","discard"],Sn=["external_id.commit_id","external_id.test_id","external_id.dataset_row_id","environment.os","environment.os_version","environment.browser","environment.browser_version","environment.device","environment.app"];function er(e){let t=e.replace(/-/g,"_");return xn.includes(t)?t:null}function tr(e){let t=e==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...Sn],on_same:e??"nest",on_different:e?"error":"split"}};return b({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:t,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function De(e){try{if(!e.isTTY){e.log(oe(e.packPath));return}let t=$(e.env);await(e.renderPrompt??In)(e.packPath,t)}catch(t){try{e.log(`evidence view failed \u2014 ${t.message}`)}catch{}}}async function In(e,t){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-5ZN47FAT.js"),{EvidenceViewOffer:o}=await import("./EvidenceViewOffer-EIANIYN7.js");await new Promise(i=>{let s=n(r.default.createElement(o,{packPath:e,viewerBase:t,onDone:()=>{s.unmount(),i()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function Pn(e,t,r=process.cwd(),n={}){let o=n.out??(d=>process.stdout.write(d+`
6
+ `)),c;try{c=await ne({packs:s,allowedOrigins:[new URL(i).origin],port:t.port,log:a})}catch(l){return o(`could not bind 127.0.0.1${t.port?`:${t.port}`:""} \u2014 ${l.message}`)}n(`serving ${s.size} pack${s.size===1?"":"s"} on http://127.0.0.1:${c.port}`);for(let l of s.keys()){let p=c.urlFor(l);n(l),n(` pack ${p}`),n(` viewer ${ie(p,i)}`)}return n("press Ctrl-C to stop"),await(r.hold??kn)(),await c.close(),0}function kn(){return new Promise(e=>{let t=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of t)process.on("SIGINT",r);e()})})}import{promises as G}from"fs";import{tmpdir as Rn}from"os";import{basename as En,join as rr,resolve as je}from"path";var xn=["error","prefer_first","prefer_latest","discard"],Sn=["external_id.commit_id","external_id.test_id","external_id.dataset_row_id","environment.os","environment.os_version","environment.browser","environment.browser_version","environment.device","environment.app"];function er(e){let t=e.replace(/-/g,"_");return xn.includes(t)?t:null}function tr(e){let t=e==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...Sn],on_same:e??"nest",on_different:e?"error":"split"}};return b({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:t,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function De(e){try{if(!e.isTTY){e.log(oe(e.packPath));return}let t=$(e.env);await(e.renderPrompt??In)(e.packPath,t)}catch(t){try{e.log(`evidence view failed \u2014 ${t.message}`)}catch{}}}async function In(e,t){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-5ZN47FAT.js"),{EvidenceViewOffer:o}=await import("./EvidenceViewOffer-LKPN5BHX.js");await new Promise(i=>{let s=n(r.default.createElement(o,{packPath:e,viewerBase:t,onDone:()=>{s.unmount(),i()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function Pn(e,t,r=process.cwd(),n={}){let o=n.out??(d=>process.stdout.write(d+`
7
7
  `)),i=n.err??(d=>process.stderr.write(d+`
8
8
  `)),s=d=>(i(`evidence merge: ${d}`),2);if(!t.runId)return s("--run-id is required (merged identity is the caller's fact)");if(t.rules&&t.onCollision)return s("--rules and --on-collision are mutually exclusive");let a;if(t.onCollision!==void 0){let d=er(t.onCollision);if(!d)return s(`invalid --on-collision: ${t.onCollision} (expected error | prefer-first | prefer-latest | discard)`);a=d}let c=[];for(let d of e){let m=await Cn(d,r);if(!m)return s(`no pack found for "${d}"`);c.push(m)}let u=t.out?je(r,t.out):h(t.runId,r),l=[],p={files:t.policy??[],ids:t.policyId??[]};if(p.files.length+p.ids.length>0){if(!t.finalize)return s("--policy and --policy-id need a sealed merge (drop --no-finalize)");let d=await et(p,{cwd:r,fetchPolicy:n.fetchPolicy??tt({env:t.env})});if(!d.ok)return s(d.message);l=d.policies}let f=null,y;t.rules?y=je(r,t.rules):(f=await G.mkdtemp(rr(Rn(),"kane-merge-rules-")),y=rr(f,"merge-rules.yaml"),await G.writeFile(y,tr(a)));try{let d=await(n.mergeFn??Xe)(c,{runId:t.runId,out:u,rulesPath:y,title:t.title,finalize:!1});t.finalize&&(await(n.sealMergedFn??((k,L)=>An(k,L,U(t.env))))(u,Ze(d)),d={...d,output:{...d.output,finalized:!0}});let m=l.length?await nt(u,l,{judge:n.judge}):void 0;if(t.json)if(m){let{type:_,...k}=it(m,En(u,".evidence"));o(JSON.stringify({...d,verdict:{...k,verdicts:m.verdicts}}))}else o(JSON.stringify(d));else if(Dn(o,d),m){o(ot(m));for(let _ of m.files)o(` ${_}`)}return d.output.finalized&&!t.json&&await(n.offer??De)({packPath:u,env:t.env,isTTY:n.isTTY??(!!process.stdin.isTTY&&!!process.stderr.isTTY),log:i}),m?.filesError!==void 0?(i(`evidence merge: cannot write the verdict files: ${m.filesError}`),2):rt(0,m)}catch(d){let m=d instanceof Error?d.message:String(d);return d?.code==="ABORT"?(i(`evidence merge: aborted \u2014 ${m}`),1):s(m)}finally{f&&await G.rm(f,{recursive:!0,force:!0}).catch(()=>{})}}async function An(e,t,r){if(!t)throw new Error("cannot seal the merged pack: none of the merged packs records when it ended or started");await z(e,await r),await C(e,t)}async function Cn(e,t){let r=je(t,e);if(await nr(r))return r;let n=h(e,t);return await nr(n)?n:null}async function nr(e){try{return await G.stat(e),!0}catch{return!1}}function Dn(e,t){let{packs:r,tests:n,output:o}=t;e(`evidence: merged ${n.merged} tests from ${r.eligible.length} packs -> ${o.path} (${o.finalized?"sealed":"live"})`);for(let i of r.skipped)e(` skipped ${i.runId}: ${i.rule} \u2014 ${i.reason}`);for(let i of n.collisions){let s;i.action==="nest"?s=`nested into ${i.folder}, latest ${i.winner}`:i.action==="split"?s=`split into ${i.folder}`:s=`winner ${i.winner}`,e(` collision ${i.test}: ${s} (${i.rule})`)}for(let i of n.discarded)e(` discarded ${i}`)}import{copyFileSync as jn,existsSync as Oe,mkdirSync as On}from"fs";import{join as ir}from"path";function Ln(e,t,r){try{let n=ir(e,"auteur","execution.json");if(Oe(n))return!0;for(let o of t)if(!(!o||!Oe(o)))return On(ir(e,"auteur"),{recursive:!0}),jn(o,n),!0}catch(n){try{r?.("debug","EVIDENCE_BLOB_COPY_FAILED","auteur execution blob copy failed",{operation:"ensureAuteurExecution",source:t.find(o=>o&&Oe(o))??null,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{mkdirSync as Mn,writeFileSync as Fn}from"fs";import{join as or}from"path";function Tn(e,t,r){try{return Mn(or(e,"auteur"),{recursive:!0}),Fn(or(e,"auteur","dataset.json"),JSON.stringify(t,null,2)+`
9
9
  `,"utf8"),!0}catch(n){try{r?.("debug","EVIDENCE_DATASET_WRITE_FAILED","auteur dataset record write failed",{dataset_id:t.dataset_id,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{readFileSync as Nn}from"fs";import{join as $n}from"path";var sr="module_block";var Bn=new Set(["generative_block",sr]);function Me(e){let t=[],r=!0,n=i=>{if(i===null||typeof i!="object")return;let s=i;if(Array.isArray(s.operations))for(let a of s.operations){let c=a?.operation_id;typeof c=="string"&&c&&t.push(c)}if(Array.isArray(s.children)){Bn.has(s.content_type)||(r=!1);for(let a of s.children)n(a)}if(Array.isArray(s.branches)){r=!1;for(let a of s.branches){let c=a?.children;if(Array.isArray(c))for(let u of c)n(u)}}},o=e?.instructions;if(Array.isArray(o))for(let i of o)n(i);return{ids:t,linear:r}}function Vn(e){return Me(e).ids}function Le(e,t){let r=new Set(t.map(a=>a.action_id).filter(Boolean)),n=-1;for(let a of r){let c=e.indexOf(a);c>n&&(n=c)}let o=t.reduce((a,c)=>Math.max(a,c.ordinal),0),i=new Set,s=[];for(let a of e.slice(n+1))r.has(a)||i.has(a)||(i.add(a),s.push({id:a,ordinal:++o,status:"skipped",action_id:a}));return s}function ar(e,t){let r=new Set(t),n=e.filter(i=>i.action_id);if(n.some(i=>r.has(i.action_id))||n.length>t.length)return null;let o=0;return e.map(i=>i.action_id?{...i,action_id:t[o++]}:i)}function Un(e,t){if(e.length>t.length)return!1;for(let r=0;r<e.length;r++)if(t[r]!==e[r].action_id)return!1;return!0}function zn(e,t,r,n=!0){if(t.length===0)return{steps:e,tail:[]};let o=(r&&n?ar(e,t):null)??e,i=o.filter(a=>a.action_id),s=new Set(t);return i.length>0&&i.every(a=>s.has(a.action_id))?{steps:o,tail:Le(t,o)}:i.length>0&&!Un(i,t)?{steps:o,tail:[],unjoined:!0}:{steps:o,tail:Le(t,o)}}function cr(e){try{let t=Nn($n(e,"auteur","execution.json"),"utf8");return Me(JSON.parse(t))}catch{return{ids:[],linear:!0}}}function Yn(e){return cr(e).ids}export{j as a,se as b,ae as c,ce as d,ue as e,de as f,le as g,lr as h,pe as i,me as j,pr as k,mr as l,fe as m,H as n,ve as o,ye as p,he as q,we as r,fr as s,be as t,gr as u,ke as v,xe as w,Se as x,Vt as y,Re as z,Ee as A,Yt as B,Lr as C,B as D,Vr as E,Zt as F,Qt as G,ln as H,pn as I,mn as J,fn as K,bn as L,tr as M,De as N,Pn as O,Ln as P,Tn as Q,sr as R,Me as S,Vn as T,Le as U,ar as V,zn as W,cr as X,Yn as Y};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Ds,b as Ls,c as Os,d as js,e as Fs,f as Us}from"./chunk-CBVHP7JB.js";import{a as Br,b as Es,c as Cs,d as Vt,e as mt,f as As,g as Ns,h as Gr,i as qr,j as zr,k as $s,l as Bs}from"./chunk-ONZ2CSTZ.js";import{d as Vs}from"./chunk-NOFJXCYP.js";import{b as Yr,c as Wr}from"./chunk-RFEON5GN.js";import{R as qs}from"./chunk-Z5BFCTHI.js";import{a as ws}from"./chunk-WD52ZNQY.js";import{a as Or}from"./chunk-W3USRQX6.js";import{a as ft,b as xs,c as Mr}from"./chunk-BHSHGWBL.js";import{c as Ps}from"./chunk-S3DAAAE5.js";import{f as Vr,h as Kr,i as Hr}from"./chunk-YKL5H4K6.js";import{k as Ms}from"./chunk-VQZOKTJ2.js";import{A as rs,C as xr,D as ns,F as is,G as fs,P as ps,Q as gs,W as hs,X as ys,h as Bt,t as Zo,u as Xo,y as es,z as ts}from"./chunk-XLQ4F6BI.js";import{a as Go}from"./chunk-DREQ3RAA.js";import{c as ds,d as cs,e as us,g as ms}from"./chunk-GYDJO32R.js";import{c as os,d as ss}from"./chunk-USJ3LUAL.js";import{a as as}from"./chunk-P2LDAW3C.js";import{a as jt}from"./chunk-72KYMWQ5.js";import{a as Po,b as To,c as Do,d as Lo,e as Oo,f as jo,g as Rr,i as Fo}from"./chunk-JQ64X2TO.js";import{d as Mt,e as Rs}from"./chunk-4JWJH6TB.js";import{b as _s,c as jr,d as Fr,e as Ur,f as ye,g as Nr,i as $r,k as Ss}from"./chunk-JGRXMTME.js";import{a as ut,b as X,c as vs,e as Ie,f as Je,g as Lr,k as bs}from"./chunk-77ZZQJLX.js";import{a as Is}from"./chunk-UTM7D4PI.js";import{a as ko,b as So,c as Nt,e as $t,f as Ar}from"./chunk-AUBSLPJZ.js";import{a as Ft,c as Bo,d as Mo,e as Ut,f as Vo}from"./chunk-5T6II7VN.js";import{c as Ko,e as Ho}from"./chunk-IINZZ4BZ.js";import{a as Pr}from"./chunk-73Y6T2UK.js";import{d as Tr}from"./chunk-XMPTFXPW.js";import{f as qo,g as zo,h as Yo,i as Wo,j as Jo,k as Qo}from"./chunk-UX2CDUPE.js";import{g as Uo,h as No}from"./chunk-GET4DINR.js";import{f as go,i as ho,j as yo}from"./chunk-ULGBK4NS.js";import{a as bo,b as Io,d as _o}from"./chunk-HMQ5M4JJ.js";import{e as wo}from"./chunk-4SJAOAYY.js";import{h as vo}from"./chunk-5D7ENQTQ.js";import{a as Ro,b as Eo,d as Co,e as Ao}from"./chunk-FBQ7PQJV.js";import{a as Sr}from"./chunk-Y6Y6RAY4.js";import{d as xo,e as ct}from"./chunk-6K5BEEAJ.js";import{a as ao}from"./chunk-Z7S3IWUX.js";import{d as lo}from"./chunk-4JOD47QI.js";import{a as Ne}from"./chunk-FCD3NYOM.js";import{a as co}from"./chunk-3G2LSTK5.js";import{c as Ks,h as Hs,i as Gs}from"./chunk-GRURFGBP.js";import{a as Ts}from"./chunk-4IEQNX7F.js";import{c as ks}from"./chunk-MYZHOBS4.js";import{Ha as Dr,s as ls}from"./chunk-TLOYTGVT.js";import{a as oo}from"./chunk-RQKMSNEU.js";import{a as Er}from"./chunk-2L3A5NKZ.js";import{a as Cr}from"./chunk-QSCXXNC2.js";import{a as $o}from"./chunk-VO66KP2W.js";import{j as uo,m as mo,n as Ot,o as fo,p as po}from"./chunk-UJLULWSR.js";import{a as le}from"./chunk-GGV336P5.js";import{a as Lt}from"./chunk-4QTH7VYE.js";import{a as we}from"./chunk-RZ4F3BHX.js";import{a as so}from"./chunk-E47GFYXA.js";import{e as kr,f as dt,p as io}from"./chunk-A7RJQJNT.js";import{a as Tt,b as Dt,i as no,j as We}from"./chunk-QMOGBKJM.js";import{join as ke,basename as Ke}from"path";import{existsSync as pl,readFileSync as Xi}from"fs";function zs(e,t){if(process.env.KANE_REPLAY_TRACE==="1")for(let r=0;r<e.steps.length;r++){let n=e.steps[r],o=t[r],s=" ".repeat(n.trace.length-1),d=`step ${n.flatIndex}`;if(o.kind==="replay"){let p=o.replayOnly?` [replay-only @${o.replayOnly}]`:"";process.stderr.write(`[replay-trace] ${s}${d}: REPLAY${p} (would skip; v1 always authors)
2
+ import{a as Ds,b as Ls,c as Os,d as js,e as Fs,f as Us}from"./chunk-DLP5S3TO.js";import{a as Br,b as Es,c as Cs,d as Vt,e as mt,f as As,g as Ns,h as Gr,i as qr,j as zr,k as $s,l as Bs}from"./chunk-O3TXAMFW.js";import{d as Vs}from"./chunk-A4ZV2SHL.js";import{b as Yr,c as Wr}from"./chunk-5XVWT6UK.js";import{R as qs}from"./chunk-45NM23EQ.js";import{a as ws}from"./chunk-WD52ZNQY.js";import{a as Or}from"./chunk-W3USRQX6.js";import{a as ft,b as xs,c as Mr}from"./chunk-BHSHGWBL.js";import{c as Ps}from"./chunk-S3DAAAE5.js";import{f as Vr,h as Kr,i as Hr}from"./chunk-TMH4TPMB.js";import{k as Ms}from"./chunk-LXCTV75T.js";import{A as rs,C as xr,D as ns,F as is,G as fs,P as ps,Q as gs,W as hs,X as ys,h as Bt,t as Zo,u as Xo,y as es,z as ts}from"./chunk-7O2FIZB7.js";import{a as Go}from"./chunk-DREQ3RAA.js";import{c as ds,d as cs,e as us,g as ms}from"./chunk-YO6SNXBJ.js";import{c as os,d as ss}from"./chunk-SSOUYKVG.js";import{a as as}from"./chunk-HVOXMCKE.js";import{a as jt}from"./chunk-72KYMWQ5.js";import{a as Po,b as To,c as Do,d as Lo,e as Oo,f as jo,g as Rr,i as Fo}from"./chunk-JQ64X2TO.js";import{d as Mt,e as Rs}from"./chunk-FYPIF3BE.js";import{b as _s,c as jr,d as Fr,e as Ur,f as ye,g as Nr,i as $r,k as Ss}from"./chunk-YDB72F4K.js";import{a as ut,b as X,c as vs,e as Ie,f as Je,g as Lr,k as bs}from"./chunk-77ZZQJLX.js";import{a as Is}from"./chunk-UTM7D4PI.js";import{a as ko,b as So,c as Nt,e as $t,f as Ar}from"./chunk-LWCP4GLY.js";import{a as Ft,c as Bo,d as Mo,e as Ut,f as Vo}from"./chunk-DXLZCJH5.js";import{c as Ko,e as Ho}from"./chunk-IINZZ4BZ.js";import{a as Pr}from"./chunk-73Y6T2UK.js";import{d as Tr}from"./chunk-XMPTFXPW.js";import{f as qo,g as zo,h as Yo,i as Wo,j as Jo,k as Qo}from"./chunk-GJ7MO2FW.js";import{g as Uo,h as No}from"./chunk-ZO3ZAMUU.js";import{f as go,i as ho,j as yo}from"./chunk-PC22QRIY.js";import{a as bo,b as Io,d as _o}from"./chunk-6LEHGRRG.js";import{e as wo}from"./chunk-BJT6PZXL.js";import{h as vo}from"./chunk-5D7ENQTQ.js";import{a as Ro,b as Eo,d as Co,e as Ao}from"./chunk-5KJU4MG4.js";import{a as Sr}from"./chunk-Y6Y6RAY4.js";import{d as xo,e as ct}from"./chunk-6K5BEEAJ.js";import{a as ao}from"./chunk-Z7S3IWUX.js";import{d as lo}from"./chunk-4JOD47QI.js";import{a as Ne}from"./chunk-FCD3NYOM.js";import{a as co}from"./chunk-3G2LSTK5.js";import{c as Ks,h as Hs,i as Gs}from"./chunk-32MFECUA.js";import{a as Ts}from"./chunk-4IEQNX7F.js";import{c as ks}from"./chunk-EHB55V23.js";import{Ha as Dr,s as ls}from"./chunk-H4TIVILC.js";import{a as oo}from"./chunk-RQKMSNEU.js";import{a as Er}from"./chunk-B57ZRHEQ.js";import{a as Cr}from"./chunk-QSCXXNC2.js";import{a as $o}from"./chunk-VO66KP2W.js";import{j as uo,m as mo,n as Ot,o as fo,p as po}from"./chunk-UJLULWSR.js";import{a as le}from"./chunk-FI2DVNRT.js";import{a as Lt}from"./chunk-4QTH7VYE.js";import{a as we}from"./chunk-RZ4F3BHX.js";import{a as so}from"./chunk-E47GFYXA.js";import{e as kr,f as dt,p as io}from"./chunk-A7RJQJNT.js";import{a as Tt,b as Dt,i as no,j as We}from"./chunk-FAMQ4DHU.js";import{join as ke,basename as Ke}from"path";import{existsSync as pl,readFileSync as Xi}from"fs";function zs(e,t){if(process.env.KANE_REPLAY_TRACE==="1")for(let r=0;r<e.steps.length;r++){let n=e.steps[r],o=t[r],s=" ".repeat(n.trace.length-1),d=`step ${n.flatIndex}`;if(o.kind==="replay"){let p=o.replayOnly?` [replay-only @${o.replayOnly}]`:"";process.stderr.write(`[replay-trace] ${s}${d}: REPLAY${p} (would skip; v1 always authors)
3
3
  `)}else process.stderr.write(`[replay-trace] ${s}${d}: AUTHOR (${o.reason})
4
4
  `)}}function $e(e){process.env.KANE_REPLAY_TRACE==="1"&&process.stderr.write(e)}function Ys(e,t){let r=e===0?"(none)":`0..${e-1}`,n=e>=t?"(none)":`${e}..${t-1}`;$e(`[replay-trace] phase: replay ${r}, author ${n}
5
5
  `)}function Ws(e,t){$e(`[replay-trace] step ${e}: REPLAY ${t==="ok"?"OK":"FAILED"}
@@ -73,8 +73,8 @@ ${i.message}`:i.message;process.stderr.write(`error: mobile target preparation f
73
73
  `);else if(Zn){let i=u.basicAuth,c=L,m=G,y=await zi({controller:new Ne(g.controllerBaseUrl,{username:i.username,accessKey:i.access_key}),tms:new ct(g.tmsBaseUrl,u.resolvedCreds?.username??i.username,u.resolvedCreds?.access_key??i.access_key),testId:Qn,sessionId:l.sessionId,executionId:c.executionId,sealedPackPath:W.pack,projectId:m,...Ce?Qo(e.policies,Ce):{}});br||=y.ok,y.ok?(l.log("info","EVIDENCE_INGESTED","Replay evidence uploaded and ingested",{execution_id:c.executionId,project_id:m}),y.verdictsRejected!==void 0&&(l.log("warn","EVIDENCE_VERDICTS_REJECTED","Test Manager refused the policy verdicts; the run was ingested without them",{execution_id:c.executionId,error:y.verdictsRejected}),process.stderr.write(` \u26A0 Test Manager refused the policy verdicts, so the run was recorded without them: ${y.verdictsRejected}
74
74
  `))):(l.log("warn","EVIDENCE_PUBLISH_FAILED","Replay evidence publish failed",{execution_id:c.executionId,stage:y.stage,error:y.error}),process.stderr.write(` \u26A0 evidence publish failed (${y.stage}): ${y.error}
75
75
  `)),t.onAgentEvent({type:"test_md_evidence_ingest",status:y.ok?"ok":"failed",evidence_id:c.executionId,...y.ok?{}:{stage:y.stage},...y.ok&&y.verdictsRejected!==void 0?{verdicts:"rejected",verdicts_error:y.verdictsRejected}:{}})}if(yn=!0,await kl(n,v,l,re.outcomes,re.overallStatus,kt,De,ae.uploadResult,K,s,{resolvedAuth:u,tmsBaseUrl:g.tmsBaseUrl},B,fe,ht.committed),v.isFirstRun&&s.testmdSync!==!1)try{let i=ye(n);if(Rs({shouldUploadPipeline:Ct,uploadSucceeded:!!ae.uploadResult?.success,metaCommitId:i?.commit_id,metaTestId:i?.test_id})){let c=await Mt({sourcePath:n,testId:i.test_id,sessionId:l.sessionId,commitId:i.commit_id,controller:new Ne(g.controllerBaseUrl,{username:u.basicAuth.username,accessKey:u.basicAuth.access_key})});c.ok?l.log("info","BUNDLE_SYNC_OK","testmd bundle pushed",{commit_id:i.commit_id,bytes:c.bytes}):(l.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync failed",{commit_id:i.commit_id,stage:c.stage,error:c.error}),process.stderr.write(` \u26A0 bundle sync failed (${c.stage}): ${c.error}
76
- `)),t.onAgentEvent({type:"test_md_bundle_sync",status:c.ok?"ok":"failed",commit_id:i.commit_id,path:n,...c.ok?{bytes:c.bytes}:{stage:c.stage}})}}catch(i){l.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync threw",{error:i instanceof Error?i.message:String(i)})}else v.isFirstRun&&l.log("info","BUNDLE_SYNC_SKIPPED","testmd bundle sync skipped",{reason:"flag"});let Xn=le(f),At=ae.uploadResult?.testcaseId,xt=At&&ae.uploadResult?.shareId&&G?qt(Xn.testManagerUiUrl,G,At,ae.uploadResult.shareId):void 0,ma=a.unitFiles.filter(i=>i.file!==a.rootPath).map(i=>{let c=a.steps.filter(h=>h.owningFile===i.file),m=c.filter(h=>yt.has(h.flatIndex)).length,w=(i.kind==="test"?ye(i.file):null)?.commit_id===l.sessionId;return{path:i.file,kind:i.kind,replayed:c.length-m,authored:m,committed:w,...w?{commit_id:l.sessionId}:{}}}),eo={overallStatus:re.overallStatus,durationS:De,creditsConsumed:He,decisions:v.decisions,outcomes:re.outcomes,cancelled:fe,retryTriggered:vt,lockHeld:B,anyAuthorStepRan:ge,isFirstRun:v.isFirstRun,wantsPush:s.push===!0,uploadResult:ae.uploadResult,shouldUploadArtifacts:qe,shouldReplaceLocalOutput:ge&&!fe,shouldCommit:(B||v.isFirstRun)&&!fe&&re.overallStatus==="passed"&&!v.degradedReadonly,committed:ht.committed,...(E.kind==="attach"||E.kind==="run")&&(E.tc??je)?{caseTc:E.tc??je}:{},degradedReadonly:v.degradedReadonly,shareUrl:xt,imports:ma},{buildSummaryEvent:fa}=await import("./SummaryBox-XQJUZBAN.js");d?t.onAgentEvent({...fa(eo),...se?{override_start_url:se}:{}}):await t.onSummary(eo);let to=ae.uploadResult?.notSaved===!0;if(!d){let i=At&&G?yi(Xn.testManagerUiUrl,G,At):void 0;await t.onLinks({recordedTestPath:n,outputDir:X(n),shareableLink:xt,testCaseLink:i,codeExportDir:ae.uploadResult?.codeExportDir})}let Ir=!d&&!fe&&!!process.stdin.isTTY&&!!process.stderr.isTTY,ro=()=>{if(!to)return;let i=Ji(process.cwd(),n);ta(Dr.testRunNotSaved(E.kind==="attach"?E.tc:null,re.overallStatus==="passed",i.startsWith("..")?n:i),{isAgent:d,host:t})};Ir&&ro();let at=!e.suppressEvidenceOffer&&W?Ee:void 0;if(te.ownsLifecycle&&W&&wr&&!e.suppressEvidenceOffer){for(let c of Hi(at))process.stderr.write(c+`
77
- `);let{offerEvidenceView:i}=await import("./evidence-M3JTOJNL.js");await i({packPath:W.pack,env:f,isTTY:Ir,log:c=>process.stderr.write(c+`
76
+ `)),t.onAgentEvent({type:"test_md_bundle_sync",status:c.ok?"ok":"failed",commit_id:i.commit_id,path:n,...c.ok?{bytes:c.bytes}:{stage:c.stage}})}}catch(i){l.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync threw",{error:i instanceof Error?i.message:String(i)})}else v.isFirstRun&&l.log("info","BUNDLE_SYNC_SKIPPED","testmd bundle sync skipped",{reason:"flag"});let Xn=le(f),At=ae.uploadResult?.testcaseId,xt=At&&ae.uploadResult?.shareId&&G?qt(Xn.testManagerUiUrl,G,At,ae.uploadResult.shareId):void 0,ma=a.unitFiles.filter(i=>i.file!==a.rootPath).map(i=>{let c=a.steps.filter(h=>h.owningFile===i.file),m=c.filter(h=>yt.has(h.flatIndex)).length,w=(i.kind==="test"?ye(i.file):null)?.commit_id===l.sessionId;return{path:i.file,kind:i.kind,replayed:c.length-m,authored:m,committed:w,...w?{commit_id:l.sessionId}:{}}}),eo={overallStatus:re.overallStatus,durationS:De,creditsConsumed:He,decisions:v.decisions,outcomes:re.outcomes,cancelled:fe,retryTriggered:vt,lockHeld:B,anyAuthorStepRan:ge,isFirstRun:v.isFirstRun,wantsPush:s.push===!0,uploadResult:ae.uploadResult,shouldUploadArtifacts:qe,shouldReplaceLocalOutput:ge&&!fe,shouldCommit:(B||v.isFirstRun)&&!fe&&re.overallStatus==="passed"&&!v.degradedReadonly,committed:ht.committed,...(E.kind==="attach"||E.kind==="run")&&(E.tc??je)?{caseTc:E.tc??je}:{},degradedReadonly:v.degradedReadonly,shareUrl:xt,imports:ma},{buildSummaryEvent:fa}=await import("./SummaryBox-XGFO5X76.js");d?t.onAgentEvent({...fa(eo),...se?{override_start_url:se}:{}}):await t.onSummary(eo);let to=ae.uploadResult?.notSaved===!0;if(!d){let i=At&&G?yi(Xn.testManagerUiUrl,G,At):void 0;await t.onLinks({recordedTestPath:n,outputDir:X(n),shareableLink:xt,testCaseLink:i,codeExportDir:ae.uploadResult?.codeExportDir})}let Ir=!d&&!fe&&!!process.stdin.isTTY&&!!process.stderr.isTTY,ro=()=>{if(!to)return;let i=Ji(process.cwd(),n);ta(Dr.testRunNotSaved(E.kind==="attach"?E.tc:null,re.overallStatus==="passed",i.startsWith("..")?n:i),{isAgent:d,host:t})};Ir&&ro();let at=!e.suppressEvidenceOffer&&W?Ee:void 0;if(te.ownsLifecycle&&W&&wr&&!e.suppressEvidenceOffer){for(let c of Hi(at))process.stderr.write(c+`
77
+ `);let{offerEvidenceView:i}=await import("./evidence-RO3RDZXO.js");await i({packPath:W.pack,env:f,isTTY:Ir,log:c=>process.stderr.write(c+`
78
78
  `)})}return Ir||ro(),at&&t.onAgentEvent(Bi(at,W.pack)),t.onAgentEvent({type:"test_md_done",overall_status:re.overallStatus,duration_s:De,session_id:l.sessionId,...xt?{share_url:xt}:{},...at?{coverage:Mi(at)}:{},...se?{override_start_url:se}:{}}),await l.reportCompletedSession({runsCompleted:l.getStepRunRecords().length,creditsConsumed:He,durationSeconds:De}),{overallStatus:re.overallStatus,exitCode:zo(re.overallStatus==="passed"&&!to?0:1,Ce),outputDir:X(n),durationS:De,creditsConsumed:He,uploadResult:ae.uploadResult,anyAuthorStepRan:ge,resultCode:Xo(Te),...vr.length?{pendingInvestigations:vr}:{},ownPack:te.ownsLifecycle?Ni({executionId:L?.executionId,testId:v.testId??L?.testId,testcaseId:ae?.uploadResult?.testcaseId,commitId:l.sessionId,published:br,coverage:Ee}):void 0}}finally{!yn&&(B||v.unitLocks.length>0)&&await Sl(v,l,B,{resolvedAuth:u,tmsBaseUrl:g.tmsBaseUrl})}}function yl(e){if((e.env??process.env).KANE_CLI_MODE==="hyperexecute")return null;let t=ks({globalDir:e.globalDir,localDir:ke(e.cwd,".testmuai","variables"),file:e.opts.variablesFile,inline:e.opts.variables}),r=Hs(e.resolved,t,{authorFrom:e.authorFrom,produced:e.produced});return r.length===0?null:{text:Yr(r,{cwd:e.cwd,entryFile:Ke(e.resolved.rootPath)}),event:Wr(r,{cwd:e.cwd})}}function vl(e,t){let r={...e,...t,...Rr(e)},n=Object.keys(r).length>0?jt(r,""):{variables:{},objective:"",keyMap:{}};return{raw:r,auteur:n.variables,auteurObjective:"",...Fs(r)}}function Ze(e,t,r){let n={...e,...t??{},...Rr(e)};if(Object.keys(n).length===0)return{raw:n,variables:{},objective:r};let o=jt(n,r);return{raw:n,variables:Os(o.variables,o.objective),objective:o.objective}}function bl(e,t,r){let n=Ze(e,t,r).variables;return Object.keys(n).length>0?n:void 0}function wl(e,t){return e.max_steps??t??50}function Qi(e,t){let r=new Set(rr),n={...e};for(let[o,s]of Object.entries(t))r.has(o)||o!=="variables"&&s!==void 0&&e[o]===void 0&&(n[o]=s);return n}function Il(e,t){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}async function _l(e,t,r,n,o,s,d={}){let p=Cs(t);zs(t,p);let a=Ie(e),u=!d.setAsideMeta&&pl(a)?JSON.parse(Xi(a,"utf8")):null,b=u?.testcase_id,f=u?.test_id,g=u?.commit_id,_=r.push===!0,D=r.author===!0;_&&!b&&process.stderr.write(`[--push] no meta.json yet \u2014 flag is a no-op on first run
79
79
  `);let S=n.resolvedAuth.basicAuth;if(!S){let B=await n.resolvedAuth.resolver.resolve(!0);B?.username&&B?.access_key&&(S={username:B.username,access_key:B.access_key},n.resolvedAuth.basicAuth=S)}let R=!!S,l=!r.local&&R&&f!=null&&g!=null&&b!=null,M=l&&(Vt(p)||_||D),$=Es(t,p);if($.length>0)return process.stderr.write(`error: replay-only step(s) cannot be replayed \u2014 the agent cannot author them, so the run will not start:
80
80
  `+$.map(v=>` step ${v.flatIndex} "${v.heading}" @${v.kind} \u2014 ${v.reason} (${v.file})`).join(`
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b,c as R}from"./chunk-72KYMWQ5.js";import{a as y}from"./chunk-TDPWFYTJ.js";import{b as S}from"./chunk-34R7BNZ2.js";import{c as v}from"./chunk-VZ7KXRXB.js";import{a as f}from"./chunk-RZ4F3BHX.js";import{b as _}from"./chunk-QMOGBKJM.js";import{randomUUID as U}from"crypto";import{mkdirSync as P,writeFileSync as g,appendFileSync as G,existsSync as h,readFileSync as B}from"fs";import{join as d}from"path";import{writeFileSync as E,mkdirSync as A,existsSync as L}from"fs";import{join as c,relative as j}from"path";function I(r){let t=Object.keys(r.frontmatter).length>0?v(r.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${r.heading}`,""),r.steps.forEach((n,o)=>{s.push(`## Step ${o+1}`,n,"")}),s.join(`
2
+ import{b,c as R}from"./chunk-72KYMWQ5.js";import{b as S}from"./chunk-CCOD4GQJ.js";import{a as y}from"./chunk-TDPWFYTJ.js";import{c as v}from"./chunk-VZ7KXRXB.js";import{a as f}from"./chunk-RZ4F3BHX.js";import{b as _}from"./chunk-FAMQ4DHU.js";import{randomUUID as U}from"crypto";import{mkdirSync as P,writeFileSync as g,appendFileSync as G,existsSync as h,readFileSync as B}from"fs";import{join as d}from"path";import{writeFileSync as E,mkdirSync as A,existsSync as L}from"fs";import{join as c,relative as j}from"path";function I(r){let t=Object.keys(r.frontmatter).length>0?v(r.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${r.heading}`,""),r.steps.forEach((n,o)=>{s.push(`## Step ${o+1}`,n,"")}),s.join(`
3
3
  `)}var T=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),D=new Set(["model","env"]),u=class{constructor(e){this.opts=e}objectives=[];flushed=!1;lastWrittenPath=null;lastCollisionSuffixed=!1;appendObjective(e){this.objectives.push(e)}flush(){if(this.flushed||(this.flushed=!0,this.objectives.length===0))return;let e=this.opts.getName();if(!e)return;let t=c(this.opts.cwd,".testmuai","tests");try{A(t,{recursive:!0})}catch(a){process.stderr.write(`
4
4
  \u26A0 Failed to create ${j(this.opts.cwd,t)}/
5
5
  ${a.message}
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as D}from"./chunk-KGNE5CIM.js";import{a as ue,b as te,d as ce,e as R,k as de}from"./chunk-JCSVBD4F.js";import{mkdirSync as Be,writeFileSync as Ae}from"fs";import{join as X}from"path";var ve="start LT with --env ht-stage|ht-prod --tunnelName <name>; see kane-cli explore run --help";function me(t){if(/either tunnel is not running or disconnected/i.test(t))return`remote browser: no running LT tunnel found for this run (HPS: either tunnel is not running or disconnected)
2
+ import{a as D}from"./chunk-KGNE5CIM.js";import{a as ue,b as te,d as ce,e as R,k as de}from"./chunk-GQARXS6F.js";import{mkdirSync as Be,writeFileSync as Ae}from"fs";import{join as X}from"path";var ve="start LT with --env ht-stage|ht-prod --tunnelName <name>; see kane-cli explore run --help";function me(t){if(/either tunnel is not running or disconnected/i.test(t))return`remote browser: no running LT tunnel found for this run (HPS: either tunnel is not running or disconnected)
3
3
  next: ${ve}`;let e=/WebSocket error: \S*\/kane-cli\S* (5\d\d)\b/.exec(t)?.[1];if(e){let r=Ee(t);return`remote browser: HPS answered HTTP ${e} to the connect${r?` (HPS: ${r})`:""} (on a tunnel run: the tunnel service failed); run again, and report it to the platform team if it persists`}return null}function Ee(t){let e=t.split(`
4
4
  `).slice(1).find(i=>i.trim()&&!/^Call log:/.test(i.trim())&&!/^\s*-\s*</.test(i));if(!e)return null;let r=e.trim();try{let i=JSON.parse(r),s=i?.value?.message??i?.message;typeof s=="string"&&s.trim()&&(r=s.trim())}catch{}return r=r.replace(/\b(?:wss?|https?):\/\/\S+/g,"<url>"),r.length>300?r.slice(0,300)+"\u2026":r}var Se={baseMs:500,maxMs:3e4},W=class{o;backoff;sleep;nextSeq;draining=null;stopDeadline=null;wake=null;_state="open";_refusal=null;_fatal=null;_committedThisRun=0;constructor(e){this.o=e,this.backoff=e.backoff??Se,this.sleep=e.sleep??(r=>new Promise(i=>setTimeout(i,r))),this.nextSeq=Math.max(e.firstSeq,e.queue.lastParked+1)}get state(){return this._state}get refusal(){return this._refusal}get fatal(){return this._fatal}get pendingCount(){return this.o.queue.pendingCount}get committedThisRun(){return this._committedThisRun}get lastCommitted(){return this.o.queue.lastCommitted}enqueue(e){return e.run_id!==this.o.runId?{ok:!1,code:"RUN_MISMATCH",reason:`delta ${e.seq} names run ${e.run_id}, this run is ${this.o.runId}`}:!Number.isInteger(e.seq)||e.seq!==this.nextSeq?{ok:!1,code:"SEQUENCE_LOCAL",reason:`expected seq ${this.nextSeq} for run ${this.o.runId}, received ${String(e.seq)}`}:(this.o.queue.append(e),this.nextSeq=e.seq+1,this.kick(),{ok:!0})}kick(){this._state==="open"&&(this.draining||(this.draining=this.drainLoop().catch(e=>(this.markFatal(this.o.queue.pending()[0]?.seq??-1,"LOCAL_IO",e instanceof Error?e.message:String(e)),"stopped")).then(e=>{this.draining=null,e==="empty"&&this._state==="open"&&this.o.queue.pendingCount>0&&this.kick()})))}async flush(e){if(this.stopDeadline=Date.now()+e,this.kick(),this.wake){let r=this.wake;this.wake=null,r()}for(;this.draining;)await this.draining;return this.o.queue.pendingCount}async drainLoop(){let e=0;for(;this._state==="open";){let r=this.o.queue.pending()[0];if(!r)return"empty";let i=this.o.queue.refused(r.seq);if(i)return this.refuse(r.seq,i.code,`previously refused: ${i.reason}`,!1),"stopped";let s=await this.o.client.commitDelta(this.o.explorationId,this.o.runId,r);switch(s.kind){case"committed":e=0,this.o.queue.markCommitted(r.seq),this._committedThisRun++,this.o.onAck?.(r.seq);break;case"refused":return this.refuse(r.seq,s.code,s.reason,!0),"stopped";case"fatal":return this.markFatal(r.seq,s.code,s.reason),"stopped";case"transient":{e++;let a=Math.min(this.backoff.maxMs,this.backoff.baseMs*2**(e-1));if(this.stopDeadline!==null&&Date.now()+a>this.stopDeadline)return"deadline";this.o.onRetry?.(r.seq,e,s.reason,a),await this.interruptibleSleep(a);break}}}return"stopped"}markFatal(e,r,i){this._state="fatal",this._fatal={seq:e,code:r,reason:i},this.o.onFatal?.(e,r,i)}refuse(e,r,i,s){s&&this.o.queue.markRefused(e,r,i,{controller_wire:this.o.controllerWire,client_wire:ue}),this._state="refused",this._refusal={seq:e,code:r,reason:i},this.o.onRefused?.(e,r,i)}async interruptibleSleep(e){await Promise.race([this.sleep(e),new Promise(r=>{this.wake=r})]),this.wake=null}};import{appendFileSync as Ce,closeSync as $e,existsSync as Pe,fsyncSync as Te,mkdirSync as Ie,openSync as De,readFileSync as Me}from"fs";import{dirname as Oe,join as Le}from"path";var Fe="pending-deltas.ndjson",Q=class{path;deltas=new Map;committed=new Set;refusedBySeq=new Map;tornTail=!1;constructor(e){this.path=Le(e,Fe),this.load()}append(e){let r=this.deltas.get(e.seq);if(r){if(JSON.stringify(r)===JSON.stringify(e))return;throw new Error(`pending queue already holds a different delta for seq ${e.seq}`)}this.write({op:"delta",seq:e.seq,delta:e}),this.deltas.set(e.seq,e)}markCommitted(e){this.committed.has(e)||(this.write({op:"committed",seq:e}),this.committed.add(e))}markRefused(e,r,i,s={}){let a={...s.controller_wire?{controller_wire:s.controller_wire}:{},...s.client_wire?{client_wire:s.client_wire}:{}};this.write({op:"refused",seq:e,code:r,reason:i,...a}),this.refusedBySeq.set(e,{seq:e,code:r,reason:i,...a})}pending(){return[...this.deltas.entries()].filter(([e])=>!this.committed.has(e)).sort(([e],[r])=>e-r).map(([,e])=>e)}get pendingCount(){return this.pending().length}get lastCommitted(){let e=0;for(let r of this.committed)e=Math.max(e,r);return e}get lastParked(){let e=0;for(let r of this.deltas.keys())e=Math.max(e,r);return e}refused(e){return this.refusedBySeq.get(e)}load(){if(!Pe(this.path))return;let e=Me(this.path,"utf8");this.tornTail=e.length>0&&!e.endsWith(`
5
5
  `);let r=e.split(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as _}from"./chunk-MKPDF26Q.js";import{a as A}from"./chunk-WX4VGH5Q.js";import{a as i}from"./chunk-PVN64537.js";import{a as h}from"./chunk-GGV336P5.js";async function w(d){let{creds:a,env:l,usernameFlag:c,accessKeyFlag:u,log:r}=d,e=null,o=null;if(c&&u)e={username:c,access_key:u},r("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:c});else{let s=a.resolveAuth();s?.method==="basic"&&(e={username:s.username,access_key:s.access_key},r("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:s.username}))}if(!e){let{credentials:s,profile:k}=a.getActiveCredentials();if(!s)throw new i("Not authenticated \u2014 no credentials found","not_authenticated");if(o=s.access_token,s.expires_at-Date.now()/1e3<300)try{let n=await A({creds:a,profile:k,env:l,credentials:s});n&&(o=n.accessToken,r("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let m=n instanceof Error?n.message:String(n);throw r("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:m}),new i(`Token refresh failed: ${m}`,"refresh_failed")}}let v=h(l),E=async()=>o,g=e?{username:e.username,access_key:e.access_key}:null,f=new _(v.controllerBaseUrl,E,g,r),t=await f.resolve();return t&&!e&&(e={username:t.username,access_key:t.access_key},r("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:t.username})),{basicAuth:e,token:o,resolver:f,resolvedCreds:t}}export{w as a};
2
+ import{a as _}from"./chunk-M7Y5GGVJ.js";import{a as A}from"./chunk-ZDQYGLCZ.js";import{a as i}from"./chunk-PVN64537.js";import{a as h}from"./chunk-FI2DVNRT.js";async function w(d){let{creds:a,env:l,usernameFlag:c,accessKeyFlag:u,log:r}=d,e=null,o=null;if(c&&u)e={username:c,access_key:u},r("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:c});else{let s=a.resolveAuth();s?.method==="basic"&&(e={username:s.username,access_key:s.access_key},r("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:s.username}))}if(!e){let{credentials:s,profile:k}=a.getActiveCredentials();if(!s)throw new i("Not authenticated \u2014 no credentials found","not_authenticated");if(o=s.access_token,s.expires_at-Date.now()/1e3<300)try{let n=await A({creds:a,profile:k,env:l,credentials:s});n&&(o=n.accessToken,r("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let m=n instanceof Error?n.message:String(n);throw r("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:m}),new i(`Token refresh failed: ${m}`,"refresh_failed")}}let v=h(l),E=async()=>o,g=e?{username:e.username,access_key:e.access_key}:null,f=new _(v.controllerBaseUrl,E,g,r),t=await f.resolve();return t&&!e&&(e={username:t.username,access_key:t.access_key},r("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:t.username})),{basicAuth:e,token:o,resolver:f,resolvedCreds:t}}export{w as a};