@testmuai/kane-cli 0.8.11 → 0.8.12

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 (213) hide show
  1. package/dist/{ChatSurface-YFJDAXOG.js → ChatSurface-DALSIICW.js} +1 -1
  2. package/dist/{ChromeProfilePicker-PUCZN6WU.js → ChromeProfilePicker-ZMVZH3AK.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-JAIB5MHS.js → CliFeedbackPrompt-K66H7YE6.js} +1 -1
  4. package/dist/{CliUploadProgress-53LQMQJD.js → CliUploadProgress-5DZHZY4M.js} +1 -1
  5. package/dist/{ConfigView-7HFP4OXS.js → ConfigView-S5KBV62S.js} +1 -1
  6. package/dist/EvidenceViewOffer-UACWB3YJ.js +2 -0
  7. package/dist/FolderPicker-YH5TKMX3.js +2 -0
  8. package/dist/{InfoBox-62YG3YNQ.js → InfoBox-7PAM2FQH.js} +1 -1
  9. package/dist/{LinksBox-6NS3GHWO.js → LinksBox-2NVZ3FHJ.js} +1 -1
  10. package/dist/{ProfilesView-HIKK2HPC.js → ProfilesView-SIUBF7IU.js} +1 -1
  11. package/dist/{ProjectPicker-2CJMO5TD.js → ProjectPicker-5NI554X3.js} +1 -1
  12. package/dist/{SaveSessionPrompt-4DTPZSXD.js → SaveSessionPrompt-5OULBV5N.js} +1 -1
  13. package/dist/SingleShotApp-LA3EMPUK.js +2 -0
  14. package/dist/{SummaryBox-A6LKKQXJ.js → SummaryBox-GTGF3CBO.js} +1 -1
  15. package/dist/TestMdRunView-5MNKJJMS.js +2 -0
  16. package/dist/{TestrunEvidenceTable-7SCCTZPH.js → TestrunEvidenceTable-7WBCOGYW.js} +1 -1
  17. package/dist/{WhoamiView-PDMQ6F5N.js → WhoamiView-E2SVBHLC.js} +1 -1
  18. package/dist/{app-download-K2ELUXWR.js → app-download-SAXSYXIV.js} +1 -1
  19. package/dist/{auth-5WJSFLCP.js → auth-3LLVDHOJ.js} +1 -1
  20. package/dist/{binary-QVQRWQFK.js → binary-WSMIRJNC.js} +1 -1
  21. package/dist/{bind-5WELCZ4S.js → bind-A3M4PV4V.js} +3 -3
  22. package/dist/{bootstrap-3LNHRDQH.js → bootstrap-QTVHGL45.js} +1 -1
  23. package/dist/bridge-E2C5VV3H.js +2 -0
  24. package/dist/{changelog-TK6DWFVW.js → changelog-CNYWOB2V.js} +1 -1
  25. package/dist/{chat-committer-MAW25ICC.js → chat-committer-RAOIL2T6.js} +1 -1
  26. package/dist/chat-controller-YJCNU76T.js +2 -0
  27. package/dist/{chunk-5LEO463W.js → chunk-24QPDHRD.js} +1 -1
  28. package/dist/{chunk-DLJIML73.js → chunk-2LXJ2ZM3.js} +1 -1
  29. package/dist/{chunk-GSNGC7HI.js → chunk-2MTAXT2U.js} +1 -1
  30. package/dist/{chunk-5NBT5IVT.js → chunk-3CCD434H.js} +1 -1
  31. package/dist/{chunk-K6BWPGBO.js → chunk-3G3LY6BM.js} +1 -1
  32. package/dist/{chunk-2E55VQYA.js → chunk-3N2YOHD6.js} +1 -1
  33. package/dist/{chunk-OC7TJTQG.js → chunk-3OU2F34I.js} +1 -1
  34. package/dist/{chunk-DHWS7SLT.js → chunk-3XWKKSIM.js} +2 -2
  35. package/dist/{chunk-TB2CCKL7.js → chunk-43DM2I6Q.js} +1 -1
  36. package/dist/{chunk-WRVDIZAI.js → chunk-4ASRA7CD.js} +2 -2
  37. package/dist/{chunk-ZMJD3CI7.js → chunk-4E4GJPEM.js} +1 -1
  38. package/dist/{chunk-CABRAZOL.js → chunk-4O6XBS5G.js} +1 -1
  39. package/dist/{chunk-DJJO4IHY.js → chunk-4T35SA2O.js} +1 -1
  40. package/dist/{chunk-YSNBXUM6.js → chunk-4TZSEC2C.js} +1 -1
  41. package/dist/{chunk-3D7VYEDP.js → chunk-54JZ6VEW.js} +1 -1
  42. package/dist/{chunk-FIODM24X.js → chunk-5A4QG7ZM.js} +1 -1
  43. package/dist/{chunk-A76UL3EN.js → chunk-5AHOVOWV.js} +1 -1
  44. package/dist/{chunk-6DOS5CJ5.js → chunk-5FYO3PFG.js} +1 -1
  45. package/dist/{chunk-QHSF2CXK.js → chunk-5G22NOZK.js} +1 -1
  46. package/dist/{chunk-47WY2637.js → chunk-5KLDW3ZW.js} +58 -57
  47. package/dist/{chunk-7P3JGF2X.js → chunk-6A47PRDS.js} +1 -1
  48. package/dist/{chunk-FYLMTZ3J.js → chunk-6FCPS2VT.js} +1 -1
  49. package/dist/{chunk-A4BDLZOD.js → chunk-75HF3GPO.js} +1 -1
  50. package/dist/{chunk-BE4FBVKY.js → chunk-7KAPHA56.js} +1 -1
  51. package/dist/{chunk-3FJNTRAS.js → chunk-7NXHVC7G.js} +1 -1
  52. package/dist/{chunk-Y4ODYIOP.js → chunk-7R5K4IGS.js} +1 -1
  53. package/dist/{chunk-JJJREAFQ.js → chunk-7RFGO3TH.js} +1 -1
  54. package/dist/{chunk-NVRXDLJN.js → chunk-AFNDJK2A.js} +1 -1
  55. package/dist/{chunk-X6WB2QTT.js → chunk-AHRL4E3M.js} +1 -1
  56. package/dist/{chunk-7KRCBN6X.js → chunk-APZCLVZD.js} +1 -1
  57. package/dist/{chunk-4VZRBBLF.js → chunk-ASYWKYTQ.js} +1 -1
  58. package/dist/{chunk-QIRZBOKA.js → chunk-COVIEKZN.js} +1 -1
  59. package/dist/{chunk-HJBORIFP.js → chunk-CQ3ZQ5UK.js} +3 -3
  60. package/dist/{chunk-4FXSDPQW.js → chunk-DYXYNH6X.js} +1 -1
  61. package/dist/{chunk-OKBEMFAW.js → chunk-EEFZXZTZ.js} +1 -1
  62. package/dist/{chunk-DP7GPS6S.js → chunk-EV64VI66.js} +1 -1
  63. package/dist/{chunk-7HUJVIMO.js → chunk-F2CET54H.js} +2 -2
  64. package/dist/{chunk-NYUMJDCE.js → chunk-FAREJ4P2.js} +1 -1
  65. package/dist/{chunk-CRPBARFG.js → chunk-FBYB3SRE.js} +1 -1
  66. package/dist/{chunk-TSW5A7W3.js → chunk-FHYG3QLL.js} +1 -1
  67. package/dist/{chunk-NLSR2IFN.js → chunk-G2Q2TP3O.js} +1 -1
  68. package/dist/{chunk-F7R6A6P5.js → chunk-G52YPXKT.js} +1 -1
  69. package/dist/{chunk-XB7EMX6J.js → chunk-GNAPBOAJ.js} +1 -1
  70. package/dist/chunk-GRDYYYIQ.js +2 -0
  71. package/dist/{chunk-2ZBY2GME.js → chunk-H6NHARB4.js} +1 -1
  72. package/dist/chunk-H6VS5RYO.js +11 -0
  73. package/dist/{chunk-3PMEHGH3.js → chunk-HPUQJRDX.js} +1 -1
  74. package/dist/{chunk-GV5BX2IQ.js → chunk-HWHLKBUT.js} +1 -1
  75. package/dist/{chunk-VGLY4HWA.js → chunk-I57TM22L.js} +1 -1
  76. package/dist/{chunk-OGJ6ZSLC.js → chunk-IE4BCGUE.js} +1 -1
  77. package/dist/{chunk-M3Q7IQMS.js → chunk-IGW77FMB.js} +1 -1
  78. package/dist/{chunk-B7K5WOOU.js → chunk-IVQX3AKL.js} +1 -1
  79. package/dist/{chunk-ZES42R57.js → chunk-IWVA37B6.js} +1 -1
  80. package/dist/{chunk-CQKKDIKA.js → chunk-JDGBRACP.js} +1 -1
  81. package/dist/{chunk-Z6GMZOVL.js → chunk-JOATASPP.js} +3 -3
  82. package/dist/{chunk-S63XGGBE.js → chunk-KAZGHWGK.js} +1 -1
  83. package/dist/{chunk-Z4QLCWLB.js → chunk-KGKJU27A.js} +1 -1
  84. package/dist/{chunk-JAO7TZBV.js → chunk-L2BCQQLJ.js} +1 -1
  85. package/dist/{chunk-OKCULEBD.js → chunk-L7GAZQYL.js} +1 -1
  86. package/dist/{chunk-7B7OSHPX.js → chunk-LLY7TQSI.js} +1 -1
  87. package/dist/{chunk-CBLUNSF4.js → chunk-M4WSRYRA.js} +1 -1
  88. package/dist/{chunk-FQRWYXFG.js → chunk-MMQLVGUJ.js} +1 -1
  89. package/dist/{chunk-6GH4DRKR.js → chunk-N7Z7BQYO.js} +1 -1
  90. package/dist/{chunk-DEUDRSU7.js → chunk-NJJQL54J.js} +1 -1
  91. package/dist/{chunk-GMXM4WHF.js → chunk-NSD2H67E.js} +1 -1
  92. package/dist/{chunk-YELGHSVH.js → chunk-O5U6EAL3.js} +1 -1
  93. package/dist/{chunk-4VYWTTT4.js → chunk-O7U5BVX5.js} +2 -2
  94. package/dist/{chunk-4AZ7IG2A.js → chunk-QZRHXGNI.js} +1 -1
  95. package/dist/{chunk-SNKFWPEM.js → chunk-RV7Q4RUV.js} +2 -2
  96. package/dist/{chunk-IX4FH5W6.js → chunk-SA6EDKUF.js} +1 -1
  97. package/dist/{chunk-O7RB4X6I.js → chunk-SACCB44S.js} +2 -2
  98. package/dist/{chunk-2QSG5ZG6.js → chunk-TLFNUXKS.js} +1 -1
  99. package/dist/chunk-U27OWZPW.js +368 -0
  100. package/dist/{chunk-HFRMJP2P.js → chunk-U2CIXGZR.js} +1 -1
  101. package/dist/{chunk-G5ZGEZCA.js → chunk-UDFDTFBL.js} +1 -1
  102. package/dist/{chunk-TYRTD5DD.js → chunk-UH2ZTX4E.js} +1 -1
  103. package/dist/{chunk-CL3AMEK6.js → chunk-UZXCCO7V.js} +1 -1
  104. package/dist/{chunk-YQ4MRF57.js → chunk-VDM3TWF6.js} +4 -4
  105. package/dist/{chunk-ASK4AZFC.js → chunk-VG7BTA5G.js} +1 -1
  106. package/dist/{chunk-R4EGL7VM.js → chunk-W3Z7AZNT.js} +1 -1
  107. package/dist/{chunk-VUOAFV27.js → chunk-WHYEXCTG.js} +1 -1
  108. package/dist/{chunk-HULEZ3D3.js → chunk-WIAZN7G4.js} +1 -1
  109. package/dist/{chunk-M7CGNE2D.js → chunk-WMVPJWWA.js} +1 -1
  110. package/dist/{chunk-4SXJKDHO.js → chunk-X6APRDUM.js} +2 -2
  111. package/dist/{chunk-OXHMUZJV.js → chunk-XMTSHHYQ.js} +1 -1
  112. package/dist/{chunk-B7TJIUKZ.js → chunk-XWO5MDEU.js} +1 -1
  113. package/dist/{chunk-AXW3WDFO.js → chunk-YF26DH4Z.js} +1 -1
  114. package/dist/{chunk-W7NI6JCF.js → chunk-YTAAF62A.js} +1 -1
  115. package/dist/{chunk-XYSFPVJX.js → chunk-ZVJGHQNG.js} +1 -1
  116. package/dist/{chunk-NGASEXVA.js → chunk-ZVZHE7KH.js} +2 -2
  117. package/dist/{chunk-W4IRHQGO.js → chunk-ZXN67F4U.js} +1 -1
  118. package/dist/{chunk-URLZULC7.js → chunk-ZZI4Y3CX.js} +1 -1
  119. package/dist/{committer-42AFWMEX.js → committer-C6UCDYMC.js} +1 -1
  120. package/dist/{config-KU2UICMC.js → config-HUK7V364.js} +1 -1
  121. package/dist/{cover-cmd-HAOBK2IC.js → cover-cmd-5LPHIOSI.js} +1 -1
  122. package/dist/{credentials-BEC4I5SE.js → credentials-6DP4KAMJ.js} +1 -1
  123. package/dist/{deps-bundle-EY5T7OH3.js → deps-bundle-PZNXSKLC.js} +1 -1
  124. package/dist/{deps-resolve-MPLFFCZZ.js → deps-resolve-62XK3LKV.js} +1 -1
  125. package/dist/design-committer-UPC6NZUF.js +2 -0
  126. package/dist/dispatch-7JCKGQVC.js +2 -0
  127. package/dist/{doctor-JBXA6WNL.js → doctor-ZQQ4VMPY.js} +1 -1
  128. package/dist/docx-convert-BIV5T7F5.js +1 -1
  129. package/dist/{dossier-WSWXZAPL.js → dossier-Y6TJWFZU.js} +1 -1
  130. package/dist/{evidence-MJV3PY2J.js → evidence-YAXIWZ6A.js} +1 -1
  131. package/dist/evolve-cmd-5ACHYQPE.js +2 -0
  132. package/dist/explain-3HAZY7Q6.js +2 -0
  133. package/dist/{explain-cmd-BXFR5DB6.js → explain-cmd-RMJPXD4U.js} +1 -1
  134. package/dist/{explain-cmd-IRQ2YX5L.js → explain-cmd-XCRO4AS6.js} +1 -1
  135. package/dist/{extract-bind-PPMY4FFA.js → extract-bind-BF2G6AS6.js} +3 -3
  136. package/dist/{extract-cmd-RHVLPNQB.js → extract-cmd-IPBCCR3T.js} +2 -2
  137. package/dist/{feeder-52VBZY3R.js → feeder-IOR3XRNF.js} +1 -1
  138. package/dist/{gaps-cmd-MSDGU6OU.js → gaps-cmd-3WXL6PAW.js} +1 -1
  139. package/dist/{generate-headless-NSK32S53.js → generate-headless-CLMSXEAS.js} +2 -2
  140. package/dist/index.js +115 -110
  141. package/dist/ingest-TTUQ7UDK.js +2 -0
  142. package/dist/ingest-cmd-KP5M6XTA.js +2 -0
  143. package/dist/install-5VWCH5GW.js +2 -0
  144. package/dist/{interactive-bind-4FNW3OYT.js → interactive-bind-MOV2VWHJ.js} +4 -4
  145. package/dist/{lifecycle-cmd-HYNG5KH6.js → lifecycle-cmd-KSMETBPP.js} +1 -1
  146. package/dist/{list-cmd-Y4WEOT3E.js → list-cmd-V3HJ5K4O.js} +1 -1
  147. package/dist/{list-commands-CJCEW7MQ.js → list-commands-KUDSKVP5.js} +1 -1
  148. package/dist/{logical-ids-N3UZACB4.js → logical-ids-MLXAH45L.js} +1 -1
  149. package/dist/login-flow-GZ3XHVCS.js +2 -0
  150. package/dist/{maintenance-cmd-UJNH47SG.js → maintenance-cmd-VFYGKY3X.js} +1 -1
  151. package/dist/{mobile-prompts-SJZVJWSB.js → mobile-prompts-WJVFBWW5.js} +1 -1
  152. package/dist/objective-variable-gate-GCQYYM77.js +2 -0
  153. package/dist/{persist-recorded-session-FWBAOQEF.js → persist-recorded-session-MHLD4A32.js} +1 -1
  154. package/dist/{phase-seed-2WI7KUYO.js → phase-seed-BMOSAA74.js} +1 -1
  155. package/dist/pipeline-G7KWRK2G.js +2 -0
  156. package/dist/prepare-target-SQ5IGKXD.js +2 -0
  157. package/dist/readmodel-TDRFVDVI.js +2 -0
  158. package/dist/reconcile-cmd-NI3AYU3Y.js +2 -0
  159. package/dist/{reconcile-deps-GMQA6ULT.js → reconcile-deps-DCHUFIEC.js} +2 -2
  160. package/dist/{reconcile-engine-XLLYS5ZB.js → reconcile-engine-QXUKUKSL.js} +1 -1
  161. package/dist/{recording-banner-CQBXZMT3.js → recording-banner-4H4AL6YN.js} +1 -1
  162. package/dist/{records-EW4PIJ5W.js → records-JLS63SDI.js} +1 -1
  163. package/dist/registry-R6QNPI5E.js +2 -0
  164. package/dist/{require-project-folder-K3E3QIOZ.js → require-project-folder-G2G4WKWW.js} +1 -1
  165. package/dist/{resolve-run-intent-3CENNCF3.js → resolve-run-intent-MZRPYN4V.js} +1 -1
  166. package/dist/{resolver-PSNP72H4.js → resolver-X5NHNX5O.js} +1 -1
  167. package/dist/{revert-RXHWWUMQ.js → revert-PRR3D4XM.js} +1 -1
  168. package/dist/{review-cmd-JUOWTME4.js → review-cmd-SAGIKWEW.js} +1 -1
  169. package/dist/run-PBS2J4N4.js +2 -0
  170. package/dist/run-VTUYLPSG.js +2 -0
  171. package/dist/{run-test-md-XBM6RMCI.js → run-test-md-4VRH7FU5.js} +2 -2
  172. package/dist/{sessions-cmd-PGE6LP2W.js → sessions-cmd-VDQGRBEM.js} +1 -1
  173. package/dist/{skill-installer-FBOPYFYS.js → skill-installer-WPW6NDCR.js} +1 -1
  174. package/dist/{spawner-URQ5OAY7.js → spawner-R3XOP3GP.js} +1 -1
  175. package/dist/{structured-answers-BZWJUX22.js → structured-answers-YAVW65G4.js} +1 -1
  176. package/dist/tcg-generate-HIC5AA3L.js +2 -0
  177. package/dist/testmd-actions-VOSP7L74.js +2 -0
  178. package/dist/{testmd-sync-TPUBEORI.js → testmd-sync-GNCDKPQN.js} +1 -1
  179. package/dist/token-refresh-GSFVJ6GU.js +2 -0
  180. package/dist/{validate-basic-BXBHTTTO.js → validate-basic-YNGP5JFB.js} +1 -1
  181. package/dist/variable-receipt-2VCUG7NN.js +2 -0
  182. package/dist/verdicts-PRXUKSDV.js +2 -0
  183. package/dist/{version-check-BGHE3LAK.js → version-check-GUGRBTIH.js} +1 -1
  184. package/dist/{view-cmd-XD5ENSML.js → view-cmd-SXXNDZIC.js} +1 -1
  185. package/dist/{walk-session-EYBUURRA.js → walk-session-G3DLBR24.js} +1 -1
  186. package/dist/{with-telemetry-L3SO6J3L.js → with-telemetry-5Y2CVPXK.js} +1 -1
  187. package/package.json +11 -11
  188. package/dist/EvidenceViewOffer-2T2ZGHIF.js +0 -2
  189. package/dist/FolderPicker-LTQW4YNR.js +0 -2
  190. package/dist/SingleShotApp-KXZF5ZJM.js +0 -2
  191. package/dist/TestMdRunView-6X6W5YAP.js +0 -2
  192. package/dist/bridge-WFSSMJ57.js +0 -2
  193. package/dist/chat-controller-6GW2HSJP.js +0 -2
  194. package/dist/chunk-2KQF6WLX.js +0 -363
  195. package/dist/design-committer-2BQVZPO4.js +0 -2
  196. package/dist/dispatch-NE35HS5F.js +0 -2
  197. package/dist/evolve-cmd-I4Z6IPIM.js +0 -2
  198. package/dist/explain-O3A2HZWD.js +0 -2
  199. package/dist/ingest-WTPY2VLS.js +0 -2
  200. package/dist/ingest-cmd-GOPW3SNF.js +0 -2
  201. package/dist/install-BDHZVEY4.js +0 -2
  202. package/dist/login-flow-DLG2WHSZ.js +0 -2
  203. package/dist/pipeline-B2TYZBMB.js +0 -2
  204. package/dist/prepare-target-JGVB7OKC.js +0 -2
  205. package/dist/readmodel-YDLGQDMH.js +0 -2
  206. package/dist/reconcile-cmd-6ILIXD3U.js +0 -2
  207. package/dist/registry-AA5YIO5Y.js +0 -2
  208. package/dist/run-6CMGGU2W.js +0 -2
  209. package/dist/run-PZIYMD35.js +0 -2
  210. package/dist/tcg-generate-BPLQ7WJ5.js +0 -2
  211. package/dist/testmd-actions-WJS2YM7B.js +0 -2
  212. package/dist/token-refresh-IT4LVE2H.js +0 -2
  213. package/dist/verdicts-J5MJHUGG.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as kt,g as xt}from"./chunk-QQ5MHSSY.js";import{b as y,c as me,d as ut,f as fe,g as ge}from"./chunk-5GUD3CIH.js";import{b as ve,c as K,d as ye,e as be}from"./chunk-4FXSDPQW.js";import{a as lt,d as pt,h as L,i as mt,j as ft,k as U,l as gt,m as Z,n as _t,o as F,p as ht}from"./chunk-NP3VGFZM.js";import{a as V,b as z,d as dt}from"./chunk-EHN5HTUD.js";import{d as Et}from"./chunk-NVGBE2DR.js";import{a as re}from"./chunk-CH273NAE.js";import{d as _e}from"./chunk-KRL2BDI5.js";import{b as $,c as k}from"./chunk-VZ7KXRXB.js";import{a as le,c as st,d as at,e as ct,f as pe}from"./chunk-P7YZ3PU3.js";import{C as x,e as bt,f as wt}from"./chunk-R4EGL7VM.js";import{b as G}from"./chunk-FYLMTZ3J.js";import{a as yt}from"./chunk-TYRTD5DD.js";import{b as he,d as ee,g as te,j as H}from"./chunk-OXHMUZJV.js";import{d as q,f as vt}from"./chunk-AKX4VRRR.js";import{a as it,b as ot}from"./chunk-3PMEHGH3.js";import{a as nt}from"./chunk-DEUDRSU7.js";function D(e){if(e===null)return"broken";let t=Math.floor(e/100);return t===1?"passed":t===7?"failed":t===2?"skipped":"broken"}var C={failed:3,broken:2,passed:1,skipped:0};function we(e){let t="skipped";for(let r of e)C[r]>C[t]&&(t=r);return t}import{createHash as fr}from"crypto";import{basename as gr}from"path";function ke(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return t.length>0?t:"session"}function xe(e){return fr("sha256").update(e).digest("hex").slice(0,8)}function Ee(e){let t=gr(e).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${ke(t)}-${xe(e)}`}function Ie(e,t){return`${ke(e)}-${xe(t)}`}function Se(e){let t=e?.trim();return t||void 0}function It(e=process.env){let t=Se(e.TEST_INSTANCE_ID),r=Se(e.JOB_ID),n=Se(e.TASK_ID);return{...t?{testInstanceId:t}:{},...r?{jobId:r}:{},...n?{taskId:n}:{}}}function Re(e,t=process.env){let r=It(t),n={...r.testInstanceId?{hyper_test_instance_id:r.testInstanceId}:{},...r.jobId?{hyper_job_id:r.jobId}:{},...r.taskId?{hyper_task_id:r.taskId}:{},...e},i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&s.length>0&&(i[o]=s);return i}function _r(e,t){return{pack_test_dir:e,ordinal_offset:t}}import{promises as I}from"fs";import{join as S}from"path";function Ae(e){let t={evidence:"0.1",run_id:e.execution_id,status:"running",title:e.title,started:e.started,environment:{producer:{name:"kane-cli",version:e.producerVersion},...e.surfaces?{surfaces:e.surfaces}:{},run_kind:e.run_kind,origin:e.origin,pid:e.pid},...e.credits!==void 0?{metrics:{credits:{value:e.credits,type:"count"}}}:{}};return k(t,{lineWidth:-1})}async function Pe(e,t,r,n=process.cwd(),i){let o=i??y(e.execution_id,n),s=S(o,"tests",t);return await I.mkdir(S(o,"coverage"),{recursive:!0}),await I.writeFile(S(o,"coverage",".keep"),""),await I.mkdir(s,{recursive:!0}),await I.writeFile(S(o,"run.yaml"),Ae(e)),r&&await I.writeFile(S(s,r.path),r.content),o}async function hr(e,t=process.cwd()){let r=y(e.execution_id,t);await I.mkdir(S(r,"coverage"),{recursive:!0}),await I.writeFile(S(r,"coverage",".keep"),"");let n=$(Ae(e));return n.environment&&delete n.environment.run_kind,await I.writeFile(S(r,"run.yaml"),k(n,{lineWidth:-1})),r}async function vr(e,t=process.cwd()){return z(y(e,t),new Date().toISOString())}async function $e(e,t=process.cwd()){await I.rm(y(e,t),{recursive:!0,force:!0})}import{promises as Le}from"fs";import{join as Fe}from"path";function ne(e){let t={evidence:"0.1",test:e.testId,status:e.status,...e.durationMs!==void 0?{duration_ms:e.durationMs}:{},...e.attempts&&e.attempts.length?{attempts:e.attempts}:{},...e.flaky!==void 0?{flaky:e.flaky}:{},...e.adaptiveHeal?{adaptive_heal:e.adaptiveHeal}:{},...e.definitionPath?{definition:{path:e.definitionPath}}:{},...e.definitionId?{definition_id:e.definitionId}:{},...e.assuranceId?{assurance_id:e.assuranceId}:{},...Object.keys(e.externalId).length?{external_id:e.externalId}:{},...e.tags&&e.tags.length?{tags:e.tags}:{},...Object.keys(e.environment).length?{environment:e.environment}:{},steps:e.steps};return k(t,{lineWidth:-1})}function Ce(e){return k({logs:e},{lineWidth:-1})}async function De(e,t,r){await Le.writeFile(Fe(e,"tests",t,"result.yaml"),r)}async function je(e,t,r){let n=Fe(e,"tests",t,"logs");await Le.mkdir(n,{recursive:!0}),await Le.writeFile(Fe(n,"meta.yaml"),r)}import{promises as ie}from"fs";import{join as St}from"path";function Rt(e){return St(e,".internal","meta.json")}async function At(e){let t;try{t=await ie.readFile(Rt(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 Oe(e,t){let r;try{r=await At(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 ie.mkdir(St(e,".internal"),{recursive:!0});let i=Rt(e),o=`${i}.tmp-${process.pid}-${Date.now()}`;await ie.writeFile(o,JSON.stringify(r,null,2)+`
2
+ import{d as kt,g as xt}from"./chunk-QQ5MHSSY.js";import{b as y,c as me,d as ut,f as fe,g as ge}from"./chunk-5GUD3CIH.js";import{b as ve,c as K,d as ye,e as be}from"./chunk-DYXYNH6X.js";import{a as lt,d as pt,h as L,i as mt,j as ft,k as U,l as gt,m as Z,n as _t,o as F,p as ht}from"./chunk-NP3VGFZM.js";import{d as Et}from"./chunk-NVGBE2DR.js";import{a as V,b as z,d as dt}from"./chunk-EHN5HTUD.js";import{a as re}from"./chunk-CH273NAE.js";import{d as _e}from"./chunk-KRL2BDI5.js";import{b as $,c as k}from"./chunk-VZ7KXRXB.js";import{a as le,c as st,d as at,e as ct,f as pe}from"./chunk-P7YZ3PU3.js";import{C as x,e as bt,f as wt}from"./chunk-W3Z7AZNT.js";import{b as G}from"./chunk-6FCPS2VT.js";import{a as yt}from"./chunk-UH2ZTX4E.js";import{b as he,d as ee,g as te,j as H}from"./chunk-XMTSHHYQ.js";import{d as q,f as vt}from"./chunk-AKX4VRRR.js";import{a as it,b as ot}from"./chunk-HPUQJRDX.js";import{a as nt}from"./chunk-NJJQL54J.js";function D(e){if(e===null)return"broken";let t=Math.floor(e/100);return t===1?"passed":t===7?"failed":t===2?"skipped":"broken"}var C={failed:3,broken:2,passed:1,skipped:0};function we(e){let t="skipped";for(let r of e)C[r]>C[t]&&(t=r);return t}import{createHash as fr}from"crypto";import{basename as gr}from"path";function ke(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return t.length>0?t:"session"}function xe(e){return fr("sha256").update(e).digest("hex").slice(0,8)}function Ee(e){let t=gr(e).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${ke(t)}-${xe(e)}`}function Ie(e,t){return`${ke(e)}-${xe(t)}`}function Se(e){let t=e?.trim();return t||void 0}function It(e=process.env){let t=Se(e.TEST_INSTANCE_ID),r=Se(e.JOB_ID),n=Se(e.TASK_ID);return{...t?{testInstanceId:t}:{},...r?{jobId:r}:{},...n?{taskId:n}:{}}}function Re(e,t=process.env){let r=It(t),n={...r.testInstanceId?{hyper_test_instance_id:r.testInstanceId}:{},...r.jobId?{hyper_job_id:r.jobId}:{},...r.taskId?{hyper_task_id:r.taskId}:{},...e},i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&s.length>0&&(i[o]=s);return i}function _r(e,t){return{pack_test_dir:e,ordinal_offset:t}}import{promises as I}from"fs";import{join as S}from"path";function Ae(e){let t={evidence:"0.1",run_id:e.execution_id,status:"running",title:e.title,started:e.started,environment:{producer:{name:"kane-cli",version:e.producerVersion},...e.surfaces?{surfaces:e.surfaces}:{},run_kind:e.run_kind,origin:e.origin,pid:e.pid},...e.credits!==void 0?{metrics:{credits:{value:e.credits,type:"count"}}}:{}};return k(t,{lineWidth:-1})}async function Pe(e,t,r,n=process.cwd(),i){let o=i??y(e.execution_id,n),s=S(o,"tests",t);return await I.mkdir(S(o,"coverage"),{recursive:!0}),await I.writeFile(S(o,"coverage",".keep"),""),await I.mkdir(s,{recursive:!0}),await I.writeFile(S(o,"run.yaml"),Ae(e)),r&&await I.writeFile(S(s,r.path),r.content),o}async function hr(e,t=process.cwd()){let r=y(e.execution_id,t);await I.mkdir(S(r,"coverage"),{recursive:!0}),await I.writeFile(S(r,"coverage",".keep"),"");let n=$(Ae(e));return n.environment&&delete n.environment.run_kind,await I.writeFile(S(r,"run.yaml"),k(n,{lineWidth:-1})),r}async function vr(e,t=process.cwd()){return z(y(e,t),new Date().toISOString())}async function $e(e,t=process.cwd()){await I.rm(y(e,t),{recursive:!0,force:!0})}import{promises as Le}from"fs";import{join as Fe}from"path";function ne(e){let t={evidence:"0.1",test:e.testId,status:e.status,...e.durationMs!==void 0?{duration_ms:e.durationMs}:{},...e.attempts&&e.attempts.length?{attempts:e.attempts}:{},...e.flaky!==void 0?{flaky:e.flaky}:{},...e.adaptiveHeal?{adaptive_heal:e.adaptiveHeal}:{},...e.definitionPath?{definition:{path:e.definitionPath}}:{},...e.definitionId?{definition_id:e.definitionId}:{},...e.assuranceId?{assurance_id:e.assuranceId}:{},...Object.keys(e.externalId).length?{external_id:e.externalId}:{},...e.tags&&e.tags.length?{tags:e.tags}:{},...Object.keys(e.environment).length?{environment:e.environment}:{},steps:e.steps};return k(t,{lineWidth:-1})}function Ce(e){return k({logs:e},{lineWidth:-1})}async function De(e,t,r){await Le.writeFile(Fe(e,"tests",t,"result.yaml"),r)}async function je(e,t,r){let n=Fe(e,"tests",t,"logs");await Le.mkdir(n,{recursive:!0}),await Le.writeFile(Fe(n,"meta.yaml"),r)}import{promises as ie}from"fs";import{join as St}from"path";function Rt(e){return St(e,".internal","meta.json")}async function At(e){let t;try{t=await ie.readFile(Rt(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 Oe(e,t){let r;try{r=await At(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 ie.mkdir(St(e,".internal"),{recursive:!0});let i=Rt(e),o=`${i}.tmp-${process.pid}-${Date.now()}`;await ie.writeFile(o,JSON.stringify(r,null,2)+`
3
3
  `),await ie.rename(o,i)}async function yr(e){try{let t=await At(e);return t&&Array.isArray(t.executions)?t.executions:[]}catch{return[]}}async function br(e,t,r=process.cwd()){let n=await fe(e,r);if(!n){let o=`evidence: no pack found for "${e}"`;return t.json?console.log(JSON.stringify({valid:!1,error:"not_found",target:e})):console.error(o),2}let i=await V(n,t.profile??"L1");return t.json?console.log(JSON.stringify({valid:i.valid,status:i.status,diagnostics:i.diagnostics})):console.log(`evidence: ${i.valid?"valid":"INVALID"} (${t.profile??"L1"}, status ${i.status})`),i.valid?0:1}function Te(e){let t=[];for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)t.push(D(i))}return we(t)}function wr(e){let t=null;for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)i!=null&&(t==null||C[D(i)]>C[D(t)]||C[D(i)]===C[D(t)]&&i>t)&&(t=i)}return t}import{promises as kr}from"fs";import{extname as Pt,basename as xr}from"path";var Er={".ndjson":"ndjson",".log":"log",".json":"json",".har":"har"};async function Me(e){let t;try{t=await kr.readdir(e)}catch{return[]}return t.filter(r=>r!=="meta.yaml"&&!r.startsWith(".")).sort().map(r=>({name:xr(r,Pt(r)),file:r,format:Er[Pt(r)]??"txt"}))}import{mkdirSync as Ir,appendFileSync as Sr}from"fs";import{join as $t}from"path";function Ne(e,t){return $t(e,"tests",t,"logs")}function Be(e,t,r,n={},i){try{i?.(t,r,r,n)}catch{}if(e)try{Ir(e,{recursive:!0});let o=JSON.stringify({ts:new Date().toISOString(),level:t,event:r,...n})+`
4
4
  `;Sr($t(e,"diagnostics.ndjson"),o)}catch{}}import{promises as R}from"fs";import{dirname as jr,join as j}from"path";import{statSync as Rr}from"fs";import{promises as Ve}from"fs";import{basename as Ar,join as Pr}from"path";var $r=1e6,Lr=2e6;function Fr(){return it.map(e=>ot(e))}function Lt(e=Fr()){return e.map(t=>{let r=0;try{r=Rr(t).size}catch{}return{path:t,offset:r}})}var Cr=/\x1b\[[0-9;]*[A-Za-z]/g;async function Dr(e,t,r){let n;try{n=await Ve.open(e,"r");let i=(await n.stat()).size,o=t<=i?t:0,s=i-o;if(s<=0)return null;let c=s>r?i-r:o,u=Buffer.alloc(Math.min(s,r));return await n.read(u,0,u.length,c),u.toString("utf8")}catch{return null}finally{await n?.close().catch(()=>{})}}async function Ft(e,t){let r=t.caps?.stderr??$r,n=t.caps?.appium??Lr,i=[];t.runnerStderrPath&&i.push({src:t.runnerStderrPath,from:0,cap:r});for(let o of t.appiumMarks??[])i.push({src:o.path,from:o.offset,cap:n});for(let o of i){let s=await Dr(o.src,o.from,o.cap);if(s===null)continue;let c=s.replace(Cr,"");if(c!=="")try{await Ve.mkdir(e,{recursive:!0}),await Ve.writeFile(Pr(e,Ar(o.src)),c)}catch{}}}async function Or(e){try{let t=j(e,"tests"),r=await R.readdir(t).catch(()=>[]);for(let n of r){let i=j(t,n,"steps"),o=await R.readdir(i).catch(()=>[]);for(let s of o){let c=await R.readFile(j(i,s,"failure.yaml"),"utf8").catch(()=>null);if(c!=null)try{let u=$(c);if(u&&typeof u=="object"&&u.triage)return!0}catch{}}}}catch{}return!1}async function Ct(e,t,r,n={}){let i=j(e,"tests",t,"logs");if(r)try{await R.mkdir(i,{recursive:!0}),await R.copyFile(r,j(i,"tui.log"))}catch{}await Ft(i,{runnerStderrPath:r?j(jr(r),"runner-stderr.log"):void 0,appiumMarks:n.appiumMarks});let o=await Me(i);if(!o.length&&n.requireRealLog)throw new Error(`evidence test ${t} has no real log to declare`);o.length&&await je(e,t,Ce(o))}async function ze(e){let t=e.cwd??process.cwd(),r=e.packDir??y(e.executionId,t);if(!e.saved&&!e.packDir)return await $e(e.executionId,t),{sealed:!1};await Ct(r,e.testId,e.tuiLogPath,{requireRealLog:e.requireRealLog,appiumMarks:e.appiumMarks});let n=j(r,"run.yaml"),i=$(await R.readFile(n,"utf8"));i.environment={...i.environment??{},saved:e.saved,run_kind:e.runKind},await R.writeFile(n,k(i,{lineWidth:-1}));let o=await R.open(n,"r+");try{await o.sync()}finally{await o.close()}let s=await Or(r);await z(r,new Date().toISOString());let c;try{let a=await V(r,"L1");c=a.valid;let l=(a.diagnostics??[]).filter(d=>String(d?.code??"").includes("failure.status_disagrees"));if(l.length>0)if(e.expectStatusDisagrees||s){let d=e.expectStatusDisagrees?"expected under --bug-detection continue":"self-explained by triaged failure record(s)";console.warn(`evidence: ${l.length} status_disagrees advisory(ies) \u2014 ${d}`)}else console.warn(`evidence: ${l.length} status_disagrees advisory(ies) \u2014 step verdicts disagree with their failure records`,l);if(!a.valid){console.warn(`evidence: sealed pack ${e.executionId} failed L1 validation`,a.diagnostics);let d=String(a.diagnostics?.[0]?.code??"");Be(Ne(r,e.testId),"warn","EVIDENCE_INVALID",{execution_id:e.executionId,first_code:d,surface:e.surface??"testmd"},e.log)}}catch(a){console.warn(`evidence: validation error for ${e.executionId}`,a)}let u;if(e.saved&&e.packDir)try{u=await ut(r,e.executionId,t)}catch(a){console.warn(`evidence: store install failed for ${e.executionId}`,a)}if(e.outputStemDir)try{await Oe(e.outputStemDir,{execution_id:e.executionId,run_kind:e.runKind,status:e.verdict,valid:c,at:new Date().toISOString()})}catch(a){console.warn(`evidence: execution-pointer append failed for ${e.executionId} (pack is sealed)`,a)}return{sealed:!0,valid:c,storePath:u}}import{release as Mt}from"os";import{execFileSync as Tr}from"child_process";import{promises as Dt}from"fs";import{join as jt}from"path";function Ot(e){return e.replace(/\([^)]*\)/g," ").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||void 0}async function Tt(e){try{let t=jt(e,"steps"),r=(await Dt.readdir(t,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name).sort((n,i)=>(parseInt(n,10)||0)-(parseInt(i,10)||0));for(let n of r)try{let i=await Dt.readFile(jt(t,n,"step.json"),"utf8"),s=JSON.parse(i).basis?.window;if(Array.isArray(s)&&s.length===2&&Number.isFinite(Number(s[0]))&&Number.isFinite(Number(s[1]))&&Number(s[0])>0&&Number(s[1])>0)return`${Math.round(Number(s[0]))}x${Math.round(Number(s[1]))}`}catch{}return}catch{return}}var Nt=!1,oe;function Mr(){if(!Nt)if(Nt=!0,process.platform==="darwin")try{oe=Tr("sw_vers",["-productVersion"],{timeout:2e3}).toString().trim()||void 0}catch{oe=Mt()||void 0}else oe=Mt()||void 0;return oe}function Ue(e){let t={os:le(process.platform)},r=Mr();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=at(t,e.runnerEnvironment);if(!n.native_platform)return n;if(e.deviceName&&(n.device=e.deviceName),e.deviceModel){let i=Ot(e.deviceModel);i&&(n.device_slug=i)}return e.pixelResolution&&(n.viewport=n.resolution??Nr(e.pixelResolution,n.pixel_ratio)??e.pixelResolution,n.resolution=e.pixelResolution),n}function Nr(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 Bt(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 Br(e){let t;return()=>(t||(t=Bt(e)),t)}import{promises as b,existsSync as A,readFileSync as qr}from"fs";import{basename as Hr,join as _}from"path";import{readFileSync as Vr}from"fs";import{dirname as zr,resolve as Ur}from"path";function Vt(e,t){let r=Ur(e),n=Vr(r,"utf8");return L(t?U(n,Z(zr(r),t)):n)}async function zt(e){for(let t of await b.readdir(e,{withFileTypes:!0})){let r=_(e,t.name);if(t.isDirectory()){await zt(r);continue}try{await b.unlink(r)}catch{await b.truncate(r,0)}}await b.rmdir(e).catch(()=>{})}function Gr(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 W=class e{constructor(t){this.opts=t}executionId;testId;definitionPath=null;definitionContent=null;accumulatedSteps=[];maxOrdinal=0;_attempts=[];_packDirOverride;_attached=!1;appiumMarks=Lt();get attached(){return this._attached}static async attach(t){let r=Hr(t.packDir).replace(/\.evidence$/,""),n=new e({origin:"testrun",runKind:"author",pid:process.pid,title:t.testId,started:new Date().toISOString(),producerVersion:nt,cwd:t.cwd});n.executionId=r,n.testId=t.testId,n._packDirOverride=t.packDir,n._attached=!0;let i=_(t.packDir,"tests",t.testId);return await b.mkdir(i,{recursive:!0}),t.definition&&(await b.writeFile(_(i,t.definition.path),t.definition.content),n.definitionPath=t.definition.path,n.definitionContent=t.definition.content),n}async start(){if(this._attached)throw new Error("attach-mode session is already started");this.executionId=me(),this.testId=this.opts.testmdRelPath?Ee(this.opts.testmdRelPath):Ie(this.opts.objectiveOrName??"session",this.opts.sessionId??this.executionId);let t=this.opts.definition??null;return await Pe({execution_id:this.executionId,title:this.opts.title,started:this.opts.started,producerVersion:this.opts.producerVersion,surfaces:this.opts.surfaces,run_kind:this.opts.runKind,origin:this.opts.origin,pid:this.opts.pid,...this.opts.credits!==void 0?{credits:this.opts.credits}:{}},this.testId,t,this.opts.cwd,this.opts.packRootDir?this.pack:void 0),t&&(this.definitionPath=t.path,this.definitionContent=t.content),{executionId:this.executionId,testId:this.testId,packTestDir:this.packTestDir}}get pack(){return this._packDirOverride?this._packDirOverride:this.opts.packRootDir?_(this.opts.packRootDir,`${this.executionId}.evidence`):y(this.executionId,this.opts.cwd)}get packTestDir(){return _(this.pack,"tests",this.testId)}async writeDefinition(t,r="test.md"){await b.writeFile(_(this.packTestDir,r),t),this.definitionPath=r,this.definitionContent=t}computeAssuranceId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=_(this.opts.cwd,this.opts.testmdRelPath);if(A(t))return F(qr(t,"utf8"))?.id}}catch{}}computeDefinitionId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=_(this.opts.cwd,this.opts.testmdRelPath),r=_(this.opts.cwd,".context"),n=A(r)?x(r):void 0;if(A(t))return Vt(t,n)}if(this.definitionContent!=null)return L(this.definitionContent)}catch{}}noteSpawn(t){this.accumulatedSteps.push(...t.steps),this.maxOrdinal=Math.max(this.maxOrdinal,t.maxOrdinal)}nextOrdinalOffset(){return this.maxOrdinal}get steps(){return this.accumulatedSteps}get attempts(){return this._attempts}async archiveAttempt(t,r,n={}){let i=this._attempts.length+1,o=_(this.packTestDir,String(i)),s=n.log,c=(a,p)=>s?.("warn","ARCHIVE_ATTEMPT_FAILED",`Attempt ${i}: ${a} could not be archived into ${i}/; the next attempt will mingle with it`,{attempt:i,dir:a,error:String(p)}),u;try{await b.mkdir(o,{recursive:!0})}catch(a){c(`${i}/`,a)}for(let a of["steps","logs","v16-trajectory"]){let p=_(this.packTestDir,a);if(!A(p))continue;let l=_(o,a);try{await b.rename(p,l);continue}catch(d){s?.("warn","ARCHIVE_ATTEMPT_RENAME_FAILED",`Attempt ${i}: rename of ${a}/ refused; copying it into ${i}/ and emptying the originals in place`,{attempt:i,dir:a,error:String(d),fallback:"copy+truncate"})}try{await b.cp(p,l,{recursive:!0}),await zt(p)}catch(d){c(a,d)}}try{this.definitionPath&&A(_(this.packTestDir,this.definitionPath))&&await b.copyFile(_(this.packTestDir,this.definitionPath),_(o,this.definitionPath));let a=_(o,"steps");if(A(a)){for(let p of await b.readdir(a))if(A(_(a,p,"failure.yaml"))){u=`${i}/steps/${p}/failure.yaml`;break}}}catch(a){c("definition + failure pointer",a)}return this._attempts.push({n:i,status:t,steps:this.accumulatedSteps,...r!==void 0?{failedAt:r}:{},...u?{failure:u}:{}}),this.accumulatedSteps=[],this.maxOrdinal=0,i}async writeResult(t){let r=Te(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,i=n?new Set(n.map(m=>m.status)).size>1:void 0,o=this._attempts.length>0,s=t.heal,c=o||s?.forced?{triggered:o,...o?{outcome:r==="passed"?"healed":"exhausted"}:{},...s?Gr(s):{},...o?{attempts:this._attempts.map(m=>({n:m.n,status:m.status,failed_at:m.failedAt??-1,...m.failure?{failure:m.failure}:{}}))}:{}}:void 0,u=this.pack,a=Re(t.externalIdInput),p=pe(t.runnerEnv,t.intentEnv),l=this.computeDefinitionId(),d=this.computeAssuranceId();await De(u,this.testId,ne({testId:this.testId,status:r,durationMs:t.durationMs,definitionPath:this.definitionPath,definitionId:l,assuranceId:d,externalId:a,environment:p,steps:t.steps,tags:t.tags,attempts:n,flaky:i,adaptiveHeal:c}));for(let m of this._attempts){let g=_(this.packTestDir,String(m.n));A(g)&&await b.writeFile(_(g,"result.yaml"),ne({testId:this.testId,status:m.status,definitionPath:this.definitionPath,definitionId:l,assuranceId:d,externalId:a,environment:p,steps:m.steps,tags:t.tags}))}let f=t.externalIdInput;return t.log&&(f.commit_id||f.test_id||f.testcase_id)&&t.log("info","EVIDENCE_EXTERNAL_ID","Evidence external-id mapping",{execution_id:this.executionId,commit_id:f.commit_id??null,test_id:f.test_id??null,testcase_id:f.testcase_id??null,project_id:f.project_id??null,session_id:f.session_id??null,session_name:f.session_name??null,hyper_test_instance_id:a.hyper_test_instance_id??null,hyper_job_id:a.hyper_job_id??null,hyper_task_id:a.hyper_task_id??null}),r}get id(){return this.executionId}get test(){return this.testId}};async function Kr(e,t,r=ge){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 _n}from"fs";import{existsSync as Ke,mkdirSync as dn,readdirSync as un,readFileSync as ln,rmSync as pn,statSync as mn,writeFileSync as fn}from"fs";import{join as M}from"path";import{mkdirSync as Wr,renameSync as Yr,rmSync as Jr,writeFileSync as Xr}from"fs";import{join as Ut}from"path";var Qr=5e6;function qt(e,t,r){let n=Ut(e,"coverage","sources"),i=new Map,o=!1;try{for(let s of r.usecases)for(let c of s.sources){if(i.has(c.id)){c.file=i.get(c.id);continue}if(!c.cid)continue;let u=Et(t,c.cid);if(u===null||u.byteLength>Qr)continue;o||(Wr(n,{recursive:!0}),o=!0);let a=Ut(n,c.id),p=`${a}.tmp-${process.pid}`;Xr(p,u),Yr(p,a);let l=`coverage/sources/${c.id}`;i.set(c.id,l),c.file=l}}catch{for(let s of r.usecases)for(let c of s.sources)delete c.file;if(o)try{Jr(n,{recursive:!0,force:!0})}catch{}}}import{appendFileSync as Zt,existsSync as O,readFileSync as P,renameSync as er,writeFileSync as tr}from"fs";import{dirname as He,isAbsolute as ae,join as T,resolve as ce}from"path";var Zr=new Set(["inline","testmd","testrun"]),en=new Set(["inferred","authored","runtime-derived"]),se=new Set(["passed","failed","broken","skipped"]);function Ht(e,t,r){if(r.facts.length===0)return{record:null,errors:[{code:"EMPTY_EXECUTIONS",detail:"a run with no designed units attaches no facts \u2014 skip the call"}]};let n=t;for(let i=0;;i++){let o=te(e);if(n.latestHash!==o){if(i>=3)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(n.latestHash)} but chain head is ${String(o)} \u2014 retry budget exhausted`}]};n=x(e);continue}let s=tn(e,n,r);if(s!=="cas")return s;if(i>=3)return{record:null,errors:[{code:"STALE_BASIS",detail:"concurrent appends kept moving the head \u2014 retry budget exhausted"}]};n=x(e)}}function Gt(e,t){return Zr.has(e.mode)?se.has(e.verdict)?en.has(e.oracle_mode)?typeof e.drift_flag!="boolean"||typeof e.stale_at_run!="boolean"?[{code:"MISSING_FIELD",detail:`${t}: drift_flag and stale_at_run are required booleans`}]:!e.execution_id||!e.started_at||!e.definition_id_at_run?[{code:"MISSING_FIELD",detail:`${t}: execution_id, started_at and definition_id_at_run are required`}]:[]:[{code:"BAD_ORACLE_MODE",detail:`${t}: oracle_mode '${e.oracle_mode}' not in inferred|authored|runtime-derived`}]:[{code:"BAD_VERDICT",detail:`${t}: verdict '${e.verdict}' not in ${[...se].join("|")}`}]:[{code:"BAD_MODE",detail:`${t}: mode '${e.mode}' not in inline|testmd|testrun`}]}function Kt(e,t,r,n){return{about:t,definition_id_at_run:e.definition_id_at_run,verdict:e.verdict,...r&&r.length?{per_ac:r}:{},drift_flag:e.drift_flag,oracle_mode:e.oracle_mode,stale_at_run:e.stale_at_run,...n.length?{unresolved_acs:n}:{},execution_id:e.execution_id,...e.evidence_id?{evidence_id:e.evidence_id}:{},...e.duration_ms!==void 0?{duration_ms:e.duration_ms}:{},started_at:e.started_at,mode:e.mode,local:e.local,...e.via_parent?{via_parent:e.via_parent}:{}}}function Wt(e,t){if(!Array.isArray(t.facts)||t.facts.length===0)return{record:null,errors:[{code:"EMPTY_EXECUTIONS",detail:"parked line carries no facts"}]};for(let r=0;;r++){let n=x(e),i=t.facts.filter(a=>n.appliedEvents.has(a.event_id)).map(a=>a.event_id),o=t.facts.filter(a=>!n.appliedEvents.has(a.event_id));if(o.length===0)return{record:null,errors:null,applied:[],skipped:i,rejected:[]};let s=[],c=[],u=[];for(let a of o){let p=`executions[${a.ref}]`,l=[];if(!a.about_cid||!n.hasNode(a.about_cid))l.push({code:"UNKNOWN_REF",detail:`${p}: about_cid '${String(a.about_cid)}' is not in the graph \u2014 the pinned run-time target is gone`});else if(n.nodeLabel.get(a.about_cid)!==q.TEST)l.push({code:"ILLEGAL_TARGET",detail:`${p}: execution facts attach to tests \u2014 '${a.about_cid}' is a ${n.nodeLabel.get(a.about_cid)}`});else if(!a.event_id)l.push({code:"MISSING_FIELD",detail:`${p}: parked facts require event_id`});else{l.push(...Gt(a,p));for(let m of a.per_ac??[])se.has(m.verdict)||l.push({code:"BAD_VERDICT",detail:`${p}.per_ac['${m.ac_ref}']: verdict '${m.verdict}'`})}if(l.length>0){s.push({event_id:a.event_id??"",errors:l});continue}let d=[],f=[...a.unresolved_acs??[]];for(let m of a.per_ac??[]){let g=n.resolve(m.ac_ref),w=g?n.tipOf(g.cid):null;if(!g||!w||n.superseded.has(w)||n.nodeLabel.get(w)!==q.AC){f.push(m.ac_ref);continue}d.push({ac_ref:n.nameOf.get(w)??w,verdict:m.verdict})}c.push(Kt(a,a.about_cid,d,f)),u.push(a.event_id)}if(c.length===0)return{record:null,errors:null,applied:[],skipped:i,rejected:s};try{let a=H(e,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],executions:c,event_ids:[...u].sort(),source_head_moves:{}},{expectPrev:n.latestHash,busyRetry:{deadlineMs:5e3}}),p;try{G(e)}catch(l){p=`parked facts committed, but the projection refresh failed (${l instanceof Error?l.message:String(l)}) \u2014 read state rebuilds on the next open`}return{record:a.record,errors:null,applied:u,skipped:i,rejected:s,...p?{warnings:[p]}:{}}}catch(a){if(!(a instanceof he))throw a;if(r>=3)return{record:null,errors:[{code:"STALE_BASIS",detail:"concurrent appends kept moving the head \u2014 parked replay retry budget exhausted (line stays queued)"}]}}}}function tn(e,t,r){let n=[],i=[];for(let c of r.facts){let u=`executions[${c.ref}]`,a=t.resolve(c.ref),p=a?t.tipOf(a.cid):null;if(!a||!p||t.superseded.has(p)){n.push({code:"UNKNOWN_REF",detail:`${u}: '${c.ref}' is not a live committed node`});continue}if(t.nodeLabel.get(p)!==q.TEST){n.push({code:"ILLEGAL_TARGET",detail:`${u}: execution facts attach to tests \u2014 '${c.ref}' is a ${t.nodeLabel.get(p)}`});continue}let l=Gt(c,u);if(l.length>0){n.push(...l);continue}let d=[];for(let f of c.per_ac??[]){let m=t.resolve(f.ac_ref),g=m?t.tipOf(m.cid):null;if(!m||!g||t.superseded.has(g)||t.nodeLabel.get(g)!==q.AC){n.push({code:"UNKNOWN_REF",detail:`${u}.per_ac: '${f.ac_ref}' is not a live AC`});continue}if(!se.has(f.verdict)){n.push({code:"BAD_VERDICT",detail:`${u}.per_ac['${f.ac_ref}']: verdict '${f.verdict}'`});continue}d.push({ac_ref:t.nameOf.get(g)??g,verdict:f.verdict})}i.push(Kt(c,p,d,c.unresolved_acs??[]))}if(n.length>0)return{record:null,errors:n};let o;try{o=H(e,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],executions:i,...r.eventIds&&r.eventIds.length>0?{event_ids:r.eventIds}:{},source_head_moves:{}},{expectPrev:t.latestHash,busyRetry:{deadlineMs:r.lockDeadlineMs??5e3}})}catch(c){if(c instanceof he)return"cas";throw c}let s;try{G(e)}catch(c){s=`facts committed, but the projection refresh failed (${c instanceof Error?c.message:String(c)}) \u2014 read state rebuilds on the next open`}return{record:o.record,errors:null,...s?{warnings:[s]}:{}}}function rr(e){let t={failed:3,broken:2,skipped:1,passed:0},r=new Map;for(let n of e)for(let i of n.verifies??[]){let o=r.get(i);(o===void 0||(t[n.status]??0)>(t[o]??0))&&r.set(i,n.status)}return[...r.entries()].map(([n,i])=>({ref:n,verdict:i}))}function nr(e){let t=[],r=re(e.cwd);if(!O(r))return{synced:0,superseded:0,skipped:"no-context",warnings:t};let n=e.by??{kind:"ai",id:"exec-sync"},i=e.lockDeadlineMs;try{rn(r,t,i)}catch(d){t.push(`sync: parked-facts replay failed (${d instanceof Error?d.message:String(d)}) \u2014 queue intact, retrying next sync`)}let o=x(r),s=[],c=0,u=new Set,a=new Set(e.members.map(d=>ae(d.path)?d.path:ce(e.cwd,d.path))),p=new Map;for(let d of e.members){let f=ae(d.path)?d.path:ce(e.cwd,d.path);if(!O(f)){t.push(`sync: member file missing: ${f} \u2014 skipped, no fact attached`);continue}for(let m of nn(f,t))if(!u.has(m.path))try{let g=m.path===f,w=!g&&a.has(m.path),h=g?void 0:F(P(f,"utf8"))?.id,Y=P(m.path,"utf8"),E=F(Y);if(!E?.id){u.add(m.path);continue}let ue=o.resolve(E.id),N=ue?o.tipOf(ue.cid):null;if(!ue||!N||o.superseded.has(N)){u.add(m.path),t.push(`sync: ${E.id} does not resolve to a live test \u2014 skipped (foreign store?)`);continue}let J=L(U(Y,Z(He(m.path),o))),mr=String(o.getNode(N)?.content.test_md_blob??""),X=L(U(mr,gt(o))),B=!1,Q=N;if(J===X)E.base!==X&&Qt(m.path,Y,X,t);else if(E.base===X){let v=sn(r,o,N,Y,J,He(m.path),n);v.error?(t.push(`sync: could not supersede ${E.id}: ${v.error}`),B=!0):(c++,Q=v.newCid,B=v.oracleTier,Qt(m.path,P(m.path,"utf8"),J,t),o=x(r))}else B=!0,t.push(E.base?`sync: ${E.id} was edited from an older version \u2014 graph kept; reconcile via a redesign or maintain`:`sync: ${E.id} carries no base pin (hand-copied file?) \u2014 fact attached with drift flag`);if(w){B&&p.set(m.path,!0);continue}u.add(m.path);let Ze=o.getNode(Q)?.content.check,et=g?d.acs??[]:[],tt=et.filter(v=>Jt(o,v.ref)),rt=et.filter(v=>!Jt(o,v.ref)).map(v=>v.ref);s.push({ref:E.id,about_cid:Q,definition_id_at_run:J,verdict:d.verdict,...tt.length?{per_ac:tt.map(v=>({ac_ref:v.ref,verdict:v.verdict}))}:{},drift_flag:B||p.get(m.path)===!0||g&&d.driftFlag===!0,oracle_mode:Ze?.expected_mode??(lt(Ze?.operand)?"runtime-derived":"inferred"),stale_at_run:o.stale(Q)!=="fresh",...rt.length?{unresolved_acs:rt}:{},execution_id:d.executionId,...d.evidenceId?{evidence_id:d.evidenceId}:{},...d.durationMs!==void 0?{duration_ms:d.durationMs}:{},started_at:d.startedAt,mode:d.mode,local:d.local,...h?{via_parent:h}:{}})}catch(g){m.path!==f&&a.has(m.path)||u.add(m.path),t.push(`sync: ${m.path} failed to sync (${g instanceof Error?g.message:String(g)}) \u2014 skipped; other members unaffected`)}}if(s.length===0)return{synced:0,superseded:c,warnings:t};let l;try{l=Ht(r,x(r),{facts:s,by:n,lockDeadlineMs:i})}catch(d){return t.push(`sync facts: commit threw: ${d instanceof Error?d.message:String(d)}`),Yt(r,s,n,t,i),{synced:0,superseded:c,warnings:t}}return l.errors?(Yt(r,s,n,t,i),t.push(...l.errors.map(d=>`sync facts: ${d.code}: ${d.detail}`)),{synced:0,superseded:c,warnings:t}):(l.warnings&&t.push(...l.warnings.map(d=>`sync facts: ${d}`)),{synced:s.length,superseded:c,warnings:t})}var Ge="pending-facts.ndjson",qe=".pending-facts.bad";function Yt(e,t,r,n,i){try{let o={by:r,ts:new Date().toISOString(),facts:t.map(c=>({...c,about_cid:c.about_cid??"",event_id:`exec-fact:${c.execution_id}:${c.ref}`}))},s=null;try{s=ee(e,{deadlineMs:i??5e3})}catch{n.push("sync facts: store lock busy \u2014 parking without it (a concurrent queue rewrite may race this line)")}try{Zt(T(e,Ge),JSON.stringify(o)+`
5
5
  `)}finally{s?.()}n.push(`sync facts: commit failed \u2014 ${t.length} fact(s) parked to ${T(e,Ge)}; they replay on the next sync`)}catch(o){n.push(`sync facts: could not park the failed batch (${o instanceof Error?o.message:String(o)}) \u2014 this run's facts are LOST`)}}function rn(e,t,r){let n=T(e,Ge);if(!O(n))return;let i;{let a=ee(e,{deadlineMs:r??5e3});try{i=P(n,"utf8")}finally{a()}}let o=i.split(`
@@ -16,6 +16,6 @@ import{d as kt,g as xt}from"./chunk-QQ5MHSSY.js";import{b as y,c as me,d as ut,f
16
16
  `),o=-1;if(i[0]?.trim()==="---"){for(let u=1;u<i.length;u++)if(i[u].trim()==="---"){o=u;break}}if(o<0)return;let s=_t(i,o);if(!s)return;if(s.baseLine!==void 0){let u=i[s.baseLine].endsWith("\r")?"\r":"";i[s.baseLine]=`${s.childIndent}base: ${r}${s.baseComment?` ${s.baseComment}`:""}${u}`}else if(s.strayBase){n.push(`sync: ${e} has a base: line this scanner cannot confidently rewrite (unexpected indentation or key quoting) \u2014 pin refresh skipped (stale pin until the shape is fixed)`);return}else{let a=i[s.idLine??s.start].endsWith("\r")?"\r":"";i.splice((s.idLine??s.start)+1,0,`${s.childIndent??" "}base: ${r}${a}`)}let c=`${e}.tmp-sync.${process.pid}-${cn++}`;tr(c,i.join(`
17
17
  `)),er(c,e)}catch(i){n.push(`sync: pin refresh failed for ${e} (${i instanceof Error?i.message:String(i)}) \u2014 next run self-heals`)}}var gn={passed:"passed",failed:"failed",broken:"blocked",skipped:"not-run"},ir=(e,t)=>{try{if(!Ke(t))return{status:"skipped",reason:"no context store at the project root"};let r=M(e,"tests");if(!Ke(r))return{status:"skipped",reason:"pack has no tests/"};let n=new Map;for(let c of un(r)){let u=M(r,c,"result.yaml");if(!Ke(u)||!mn(M(r,c)).isDirectory())continue;let a=$(ln(u,"utf8"));if(!a?.definition_id&&!a?.assurance_id)continue;let p=rr(a.steps??[]),l={testShortId:String(a.test??c),execution:gn[String(a.status)]??"not-run",...p.length?{acs:p}:{}};a.assurance_id&&n.set(`id:${a.assurance_id}`,l),a.definition_id&&n.set(`def:${a.definition_id}`,l)}let i=xt(x(t),n,{scope:"run"}),o=kt(i);qt(e,t,i);let s=k({...i,rollup:o},{lineWidth:-1});return dn(M(e,"coverage"),{recursive:!0}),fn(M(e,"coverage","usecases.yaml"),s),{status:"written"}}catch(r){try{pn(M(e,"coverage","sources"),{recursive:!0,force:!0})}catch{}return{status:"skipped",reason:r instanceof Error?r.message:String(r)}}};async function hn(e){try{let t=new W({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 vn(e,t,r){if(!e)return;e.session.noteSpawn(t),t.resolution&&(e.resolution=t.resolution),e.runnerEnvironment=st(e.runnerEnvironment,t.runnerEnvironment);let n=(r?.per_flow_metadata??[]).map(i=>({resultCode:i?.result_code!=null?Number(i.result_code):null}));e.spawns.push({resultCode:r?.result_code!=null?Number(r.result_code):null,...n.length?{perFlow:n}:{}})}function yn(e){if(e)return{packTestDir:e.packTestDir,ordinalOffset:e.session.nextOrdinalOffset()}}async function bn(e,t){if(!e)return null;if(e.finalized)return e.finalized;let r=(n,i,o)=>t.log?t.log("warn",n,i,o):console.warn(`evidence: ${i}`,o??"");try{if(t.recordedTestPath)try{await e.session.writeDefinition(await _n.readFile(t.recordedTestPath,"utf8"))}catch(s){r("EVIDENCE_DEFINITION_FAILED","could not attach synthesized test.md",{error:String(s)})}let n=t.cdpBrowserCapture?await t.cdpBrowserCapture():void 0,i=await e.session.writeResult({steps:e.session.steps,spawns:e.spawns.length?e.spawns:[{resultCode:null}],externalIdInput:{...t.externalIdInput,execution_id:e.executionId},runnerEnv:Ue({cdpBrowser:n,resolution:e.resolution,runnerEnvironment:e.runnerEnvironment,deviceName:t.deviceName,deviceModel:t.deviceModel,pixelResolution:await Tt(e.packTestDir)}),intentEnv:ct(t.model,e.runnerEnvironment),durationMs:t.durationMs??Date.now()-e.startedAtMs,log:t.log});try{if(t.recordedTestPath){let s=nr({cwd:t.cwd??e.cwd??process.cwd(),members:[{path:t.recordedTestPath,verdict:i,executionId:e.executionId,startedAt:new Date(e.startedAtMs).toISOString(),mode:"inline",local:t.local??!1}]});for(let c of s.warnings)r("EXEC_SYNC",c)}}catch(s){r("EXEC_SYNC","exec-sync failed",{error:String(s)})}try{let s=(t.coverageWriter??ir)(e.packDir,re(t.cwd??e.cwd??process.cwd()));s.status==="skipped"&&r("EVIDENCE_COVERAGE_SKIPPED",`coverage/usecases.yaml not written: ${s.reason}`)}catch(s){r("EVIDENCE_COVERAGE_SKIPPED","coverage writer threw",{error:String(s)})}let o=await ze({executionId:e.executionId,testId:e.testId,saved:t.saved,runKind:"author",verdict:i,cwd:t.cwd??e.cwd,packDir:e.packDir,tuiLogPath:t.tuiLogPath,log:t.log,surface:"inline",requireRealLog:!!e.runnerEnvironment?.native_platform,appiumMarks:e.session.appiumMarks});return e.finalized=o,t.log?.("info","EVIDENCE_SEALED","Inline pack sealed",{execution_id:e.executionId,verdict:i,valid:o.valid,pack:e.packDir,store_copy:o.storePath??null}),o}catch(n){return r("EVIDENCE_SEAL_FAILED","inline pack finalize failed",{error:String(n)}),null}}import{statSync as wn,openSync as kn,readSync as xn,closeSync as En}from"fs";import{basename as In,resolve as Sn}from"path";async function Rn(e,t,r={}){let n=r.out??(p=>process.stdout.write(p+`
18
18
  `)),i=p=>(n(`error: ${p}`),2);if(t.env!=="prod"&&t.env!=="stage")return i(`invalid --env: ${String(t.env)}`);if(t.port!==void 0&&(!Number.isInteger(t.port)||t.port<1||t.port>65535))return i("invalid --port: expected an integer 1-65535");let o;try{o=K(t.env,t.viewerUrl),new URL(o)}catch{return i(`invalid --viewer-url: ${t.viewerUrl}`)}if(e.length===0)return i("no pack paths given");let s=new Map;for(let p of e){let l=Sn(p),d;try{d=wn(l)}catch{return i(`${p}: not found`)}if(d.isDirectory())return i(`${p}: is a directory \u2014 packs must be sealed .evidence files (run the execution to completion, or seal it, first)`);if(!d.isFile())return i(`${p}: not a regular file`);let f=Buffer.alloc(2),m=kn(l,"r");try{xn(m,f,0,2,0)}finally{En(m)}if(f.toString("latin1")!=="PK")return i(`${p}: not a sealed evidence pack (zip magic missing)`);let g=In(l);if(s.has(g))return i(`duplicate pack basename: ${g} (URL names collide \u2014 rename one)`);s.set(g,l)}let c=r.log??((p,l,d)=>process.stderr.write(`warn: ${l} reason=${d.reason} path=${d.path}
19
- `)),u;try{u=await ve({packs:s,allowedOrigins:[new URL(o).origin],port:t.port,log:c})}catch(p){return i(`could not bind 127.0.0.1${t.port?`:${t.port}`:""} \u2014 ${p.message}`)}n(`serving ${s.size} pack${s.size===1?"":"s"} on http://127.0.0.1:${u.port}`);for(let p of s.keys()){let l=u.urlFor(p);n(p),n(` pack ${l}`),n(` viewer ${ye(l,o)}`)}return n("press Ctrl-C to stop"),await(r.hold??An)(),await u.close(),0}function An(){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 de}from"fs";import{tmpdir as Fn}from"os";import{join as ar,resolve as Ye}from"path";var Pn=["error","prefer_first","prefer_latest","discard"],$n=["external_id.commit_id","external_id.test_id","environment.os","environment.os_version","environment.browser","environment.browser_version"];function or(e){let t=e.replace(/-/g,"_");return Pn.includes(t)?t:null}function sr(e){let t=e==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...$n],on_same:e??"nest",on_different:e?"error":"split"}};return k({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 We(e){try{if(!e.isTTY){e.log(be(e.packPath));return}let t=K(e.env);await(e.renderPrompt??Ln)(e.packPath,t)}catch(t){try{e.log(`evidence view failed \u2014 ${t.message}`)}catch{}}}async function Ln(e,t){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{EvidenceViewOffer:i}=await import("./EvidenceViewOffer-2T2ZGHIF.js");await new Promise(o=>{let s=n(r.default.createElement(i,{packPath:e,viewerBase:t,onDone:()=>{s.unmount(),o()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function Cn(e,t,r=process.cwd(),n={}){let i=n.out??(d=>process.stdout.write(d+`
19
+ `)),u;try{u=await ve({packs:s,allowedOrigins:[new URL(o).origin],port:t.port,log:c})}catch(p){return i(`could not bind 127.0.0.1${t.port?`:${t.port}`:""} \u2014 ${p.message}`)}n(`serving ${s.size} pack${s.size===1?"":"s"} on http://127.0.0.1:${u.port}`);for(let p of s.keys()){let l=u.urlFor(p);n(p),n(` pack ${l}`),n(` viewer ${ye(l,o)}`)}return n("press Ctrl-C to stop"),await(r.hold??An)(),await u.close(),0}function An(){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 de}from"fs";import{tmpdir as Fn}from"os";import{join as ar,resolve as Ye}from"path";var Pn=["error","prefer_first","prefer_latest","discard"],$n=["external_id.commit_id","external_id.test_id","environment.os","environment.os_version","environment.browser","environment.browser_version"];function or(e){let t=e.replace(/-/g,"_");return Pn.includes(t)?t:null}function sr(e){let t=e==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...$n],on_same:e??"nest",on_different:e?"error":"split"}};return k({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 We(e){try{if(!e.isTTY){e.log(be(e.packPath));return}let t=K(e.env);await(e.renderPrompt??Ln)(e.packPath,t)}catch(t){try{e.log(`evidence view failed \u2014 ${t.message}`)}catch{}}}async function Ln(e,t){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{EvidenceViewOffer:i}=await import("./EvidenceViewOffer-UACWB3YJ.js");await new Promise(o=>{let s=n(r.default.createElement(i,{packPath:e,viewerBase:t,onDone:()=>{s.unmount(),o()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function Cn(e,t,r=process.cwd(),n={}){let i=n.out??(d=>process.stdout.write(d+`
20
20
  `)),o=n.err??(d=>process.stderr.write(d+`
21
21
  `)),s=d=>(o(`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 c;if(t.onCollision!==void 0){let d=or(t.onCollision);if(!d)return s(`invalid --on-collision: ${t.onCollision} (expected error | prefer-first | prefer-latest | discard)`);c=d}let u=[];for(let d of e){let f=await Dn(d,r);if(!f)return s(`no pack found for "${d}"`);u.push(f)}let a=t.out?Ye(r,t.out):y(t.runId,r),p=null,l;t.rules?l=Ye(r,t.rules):(p=await de.mkdtemp(ar(Fn(),"kane-merge-rules-")),l=ar(p,"merge-rules.yaml"),await de.writeFile(l,sr(c)));try{let d=await(n.mergeFn??dt)(u,{runId:t.runId,out:a,rulesPath:l,title:t.title,finalize:t.finalize});return t.json?i(JSON.stringify(d)):jn(i,d),d.output.finalized&&!t.json&&await(n.offer??We)({packPath:a,env:t.env,isTTY:n.isTTY??(!!process.stdin.isTTY&&!!process.stderr.isTTY),log:o}),0}catch(d){let f=d instanceof Error?d.message:String(d);return d?.code==="ABORT"?(o(`evidence merge: aborted \u2014 ${f}`),1):s(f)}finally{p&&await de.rm(p,{recursive:!0,force:!0}).catch(()=>{})}}async function Dn(e,t){let r=Ye(t,e);if(await cr(r))return r;let n=y(e,t);return await cr(n)?n:null}async function cr(e){try{return await de.stat(e),!0}catch{return!1}}function jn(e,t){let{packs:r,tests:n,output:i}=t;e(`evidence: merged ${n.merged} tests from ${r.eligible.length} packs -> ${i.path} (${i.finalized?"sealed":"live"})`);for(let o of r.skipped)e(` skipped ${o.runId}: ${o.rule} \u2014 ${o.reason}`);for(let o of n.collisions){let s;o.action==="nest"?s=`nested into ${o.folder}, latest ${o.winner}`:o.action==="split"?s=`split into ${o.folder}`:s=`winner ${o.winner}`,e(` collision ${o.test}: ${s} (${o.rule})`)}for(let o of n.discarded)e(` discarded ${o}`)}import{copyFileSync as On,existsSync as Je,mkdirSync as Tn}from"fs";import{join as dr}from"path";function Mn(e,t,r){try{let n=dr(e,"auteur","execution.json");if(Je(n))return!0;for(let i of t)if(!(!i||!Je(i)))return Tn(dr(e,"auteur"),{recursive:!0}),On(i,n),!0}catch(n){try{r?.("debug","EVIDENCE_BLOB_COPY_FAILED","auteur execution blob copy failed",{operation:"ensureAuteurExecution",source:t.find(i=>i&&Je(i))??null,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{readFileSync as Nn}from"fs";import{join as Bn}from"path";var ur="module_block";var Vn=new Set(["generative_block",ur]);function Qe(e){let t=[],r=!0,n=o=>{if(o===null||typeof o!="object")return;let s=o;if(Array.isArray(s.operations))for(let c of s.operations){let u=c?.operation_id;typeof u=="string"&&u&&t.push(u)}if(Array.isArray(s.children)){Vn.has(s.content_type)||(r=!1);for(let c of s.children)n(c)}if(Array.isArray(s.branches)){r=!1;for(let c of s.branches){let u=c?.children;if(Array.isArray(u))for(let a of u)n(a)}}},i=e?.instructions;if(Array.isArray(i))for(let o of i)n(o);return{ids:t,linear:r}}function zn(e){return Qe(e).ids}function Xe(e,t){let r=new Set(t.map(c=>c.action_id).filter(Boolean)),n=-1;for(let c of r){let u=e.indexOf(c);u>n&&(n=u)}let i=t.reduce((c,u)=>Math.max(c,u.ordinal),0),o=new Set,s=[];for(let c of e.slice(n+1))r.has(c)||o.has(c)||(o.add(c),s.push({id:c,ordinal:++i,status:"skipped",action_id:c}));return s}function lr(e,t){let r=new Set(t),n=e.filter(o=>o.action_id);if(n.some(o=>r.has(o.action_id))||n.length>t.length)return null;let i=0;return e.map(o=>o.action_id?{...o,action_id:t[i++]}:o)}function 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 qn(e,t,r,n=!0){if(t.length===0)return{steps:e,tail:[]};let i=(r&&n?lr(e,t):null)??e,o=i.filter(c=>c.action_id),s=new Set(t);return o.length>0&&o.every(c=>s.has(c.action_id))?{steps:i,tail:Xe(t,i)}:o.length>0&&!Un(o,t)?{steps:i,tail:[],unjoined:!0}:{steps:i,tail:Xe(t,i)}}function pr(e){try{let t=Nn(Bn(e,"auteur","execution.json"),"utf8");return Qe(JSON.parse(t))}catch{return{ids:[],linear:!0}}}function Hn(e){return pr(e).ids}export{D as a,we as b,ke as c,xe as d,Ee as e,Ie as f,It as g,Re as h,_r as i,Ae as j,Pe as k,hr as l,vr as m,$e as n,ne as o,Ce as p,De as q,je as r,Oe as s,yr as t,br as u,Te as v,wr as w,Me as x,Ne as y,Be as z,Ct as A,ze as B,Tt as C,Ue as D,Bt as E,Br as F,W as G,Kr as H,rr as I,nr as J,ir as K,hn as L,vn as M,yn as N,bn as O,Rn as P,sr as Q,We as R,Cn as S,Mn as T,ur as U,Qe as V,zn as W,Xe as X,lr as Y,qn as Z,pr as _,Hn as $};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as j}from"./chunk-YELGHSVH.js";import{d as K}from"./chunk-RKXHVP2Z.js";import{a as L}from"./chunk-5Y2G4NC7.js";import{a as M}from"./chunk-YCCUBQY4.js";import{x as s}from"./chunk-DEUDRSU7.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as x,b as n,i as D,k as E}from"./chunk-C44QQJR4.js";import{a as I}from"./chunk-6YGTRKDT.js";import{e as y}from"./chunk-UR6MHSHU.js";var g=y(O(),1);function ee(e){let t=e.findIndex(r=>r.free);return t>=0?t:null}var q=60,Q=100;function te({headline:e,ask:t=!1,rows:r,sel:o,focused:d,freeText:c=null,freeTextNote:h,sublines:b=[]}){let{stdout:p}=E(),i=p?.columns??80,v=i<q,k=Math.min(i-1,Q),u=a=>d&&o===a?(0,g.jsx)(n,{color:s.assuranceAccent,children:"\u276F"}):" ",m=t?`? ${e}`:e,A=Math.max(4,k-3),S=b.map((a,w)=>(0,g.jsx)(n,{color:s.dim,children:` ${a.length>A?`${a.slice(0,A-1)}\u2026`:a}`},`sub-${w}`)),R=0,B=r.map((a,w)=>a.free?c?(0,g.jsxs)(x,{flexDirection:"column",children:[(0,g.jsxs)(x,{children:[(0,g.jsxs)(n,{children:[(0,g.jsx)(n,{color:s.assuranceAccent,children:"\u276F"})," ",(0,g.jsx)(n,{color:s.dim,children:"\u270E "})]}),(0,g.jsx)(M,{value:c.value,onChange:c.onChange,onSubmit:c.onSubmit,onCancel:c.onCancel,placeholder:a.label})]}),h?(0,g.jsx)(n,{color:s.muted,children:` ${h}`}):null]},a.key):(0,g.jsxs)(n,{children:[u(w)," ",(0,g.jsx)(n,{color:s.dim,children:`\u270E ${a.label}`})]},a.key):(R+=1,(0,g.jsxs)(n,{bold:d&&o===w,children:[u(w),` ${R}. ${a.label}`,a.detail?(0,g.jsx)(n,{color:s.dim,bold:!1,children:` \u2014 ${a.detail}`}):null]},a.key)));return v?(0,g.jsxs)(x,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,g.jsx)(n,{bold:!0,color:s.assuranceAccent,children:m}),S,B]}):(0,g.jsxs)(x,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,g.jsx)(n,{bold:!0,color:s.assuranceAccent,children:m}),S,(0,g.jsx)(n,{children:" "}),B]})}var H=y(I(),1);var $=y(O(),1),N=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function le(e){let t=e.replace(/…$/,"");return t&&t.charAt(0).toLowerCase()+t.slice(1)}function F(e,t){if(e.length<=t)return e;if(t<=1)return"\u2026";let r=Math.ceil((t-1)/2),o=Math.floor((t-1)/2);return`${e.slice(0,r)}\u2026${o>0?e.slice(-o):""}`}function ce({status:e,meta:t,tallies:r,keys:o,child:d,cols:c}){let{stdout:h}=E(),b=c??h?.columns??80,p=e.kind==="working"||e.kind==="child-working",[i,v]=(0,H.useState)(0);L(()=>v(f=>f+1),p?120:null);let k=N[i%N.length],u,m;switch(e.kind){case"working":u=`${k} ${e.step}${e.elapsedS!==void 0?` \xB7 ${e.elapsedS}s`:""}`,m=s.assuranceAccent;break;case"waiting":u=`\u25CF waiting on you${e.pending?` \u2014 ${e.pending} question${e.pending===1?"":"s"}`:""}`,m=s.amber;break;case"idle":u="\u25CF idle",m=s.assuranceAccent;break;case"card":u=`\u25CF card ${e.n} of ${e.m}`,m=s.amber;break;case"child-working":u=`${k} child: ${e.step}`,m=s.assuranceAccent;break;case"child-waiting":u="\u25CF child waiting on you",m=s.amber;break}let A=d?`${t.verb} \u25B8 ${d.verb}`:t.verb,S=d?.sid?t.sid?`${F(t.sid,14)} \u25B8 ${d.sid}`:d.sid:t.sid,R=t.env==="prod"?"":t.env,B=[A,S,R].filter(Boolean),a=" \xB7 ",w=u.length+a.length+B.join(a).length,C=t.subject;if(C){let f=b-w-a.length;C=f>=8?F(C,f):void 0}let _=[A,...C?[C]:[],S,R].filter(Boolean).join(a);return(0,$.jsxs)(x,{flexDirection:"column",children:[(0,$.jsx)(n,{color:s.muted,children:"\u2500".repeat(Math.max(1,b))}),(0,$.jsxs)(n,{children:[(0,$.jsx)(n,{color:m,children:u}),(0,$.jsx)(n,{color:s.dim,children:`${a}${_}`})]}),(0,$.jsx)(n,{color:s.dim,children:r.items.length>0?r.items.join(a):" "}),(0,$.jsx)(n,{color:s.muted,children:o.join(a)})]})}var P=y(I(),1);function ue({onToggleThinking:e,onCtrlC:t,explorer:r,panel:o}){let c=(0,P.useRef)(null),h=(0,P.useRef)(""),b=()=>{c.current&&clearTimeout(c.current),c.current=null,h.current=""};return(0,P.useEffect)(()=>b,[]),D((p,i)=>{if(i.ctrl&&p==="t"){e();return}if(i.ctrl&&p==="c"){t();return}if(!i.ctrl&&p.includes("")){t();return}if(!i.ctrl&&p.includes("")){e();return}if(r&&r.isOpen()){let v=()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{b(),r.onBack()},150)};if(c.current){if(i.upArrow||i.downArrow||i.return){b(),i.return?r.onEnter():r.onMove(i.upArrow?-1:1);return}if(h.current+=p,h.current==="["){v();return}let k=h.current;b();let u=/^\[([ABCD])/.exec(k);if(u){(u[1]==="A"||u[1]==="B")&&r.onMove(u[1]==="A"?-1:1);return}r.onBack();return}if(i.upArrow){r.onMove(-1);return}if(i.downArrow){r.onMove(1);return}if(i.return){r.onEnter();return}if(i.escape){h.current="",v();return}return}if(o&&o.isFocused()){let v=()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{b(),o.onBack()},150)};if(c.current){if(i.upArrow||i.downArrow||i.return||i.leftArrow||i.rightArrow){b(),i.return?o.onSelect():i.leftArrow?o.onLeft?.():i.rightArrow?o.onRight?.():o.onMove(i.upArrow?-1:1);return}if(h.current+=p,h.current==="["){v();return}let k=h.current;b();let u=/^\[([ABCD])/.exec(k);if(u){u[1]==="A"||u[1]==="B"?o.onMove(u[1]==="A"?-1:1):u[1]==="C"?o.onRight?.():o.onLeft?.();return}o.onBack();return}if(i.upArrow){o.onMove(-1);return}if(i.downArrow){o.onMove(1);return}if(i.leftArrow){o.onLeft?.();return}if(i.rightArrow){o.onRight?.();return}if(i.return){o.onSelect();return}if(i.escape){h.current="",v();return}if(/^[1-9]$/.test(p)){o.onDigit(Number(p));return}if(i.tab){o.onTab?.();return}if(p===" "&&o.isMulti()){o.onSpace();return}if(p&&!i.ctrl&&!i.meta){o.onType(p);return}return}}),null}var l=y(O(),1);function X(e){return e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}function V(e){let t=X(e);return e.viewDiff&&t.push({v:"view_diff",label:"view diff",detail:"full old \u2192 new"}),t}function W(e){return e.kind==="ARCHIVE"?null:V(e).length}var Y={ADD:{color:s.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:s.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},U=60;function be({card:e,position:t,sel:r=0,focused:o=!1,freeText:d=null,editorIntent:c="steer"}){let{stdout:h}=E(),b=h?.columns??80,p=b<U,i=V(e),v=W(e),k=Y[e.kind],u=f=>o&&r===f?(0,l.jsx)(n,{color:s.assuranceAccent,children:"\u276F"}):" ",m=e.impact,A=m&&"stale_refs"in m&&m.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${m.stale_refs.length} item(s) stale`+((m.direct_refs?.length??0)>0?` \u2014 ${m.direct_refs.length} directly touched: ${m.direct_refs.join(", ")}`:""):m&&"design_children"in m?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${m.design_children} design child(ren)`:null,S=e.provenance&&e.provenance!==e.why?e.provenance:e.origin??null,R=[{label:"why",text:e.why},...S?[{label:"from",text:S,dimmer:!0}]:[],...e.tier?[{label:"match",text:e.tier,dimmer:!0}]:[],...A?[{label:"impact",text:A}]:[]],B=Math.max(...R.map(f=>f.label.length)),a="? reconcile",w=`item ${t.n} of ${t.of}`,C=(0,l.jsxs)(x,{flexDirection:"column",children:[(0,l.jsx)(x,{paddingLeft:2,children:(0,l.jsxs)(n,{bold:!0,children:[(0,l.jsx)(n,{color:k.color,children:`[${e.kind}]`}),` ${j(e.title)}`]})}),R.map((f,T)=>(0,l.jsx)(x,{paddingLeft:2,children:(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:s.dim,children:`${f.label.padEnd(B)} `}),(0,l.jsx)(n,{color:f.dimmer?s.dim:void 0,children:f.text})]})},`f-${T}`)),e.diffSummary?(0,l.jsx)(x,{paddingLeft:2,children:(0,l.jsx)(n,{color:s.dim,children:e.diffSummary})}):(e.diff??[]).map((f,T)=>(0,l.jsx)(x,{paddingLeft:4,children:(0,l.jsx)(n,{color:f.op==="-"?"red":"green",children:`${f.op==="-"?"\u2212":"+"} ${f.field==="criteria"?"criterion":f.field}: ${f.text}`})},`d-${T}`)),(e.citeLines??[]).map((f,T)=>(0,l.jsx)(x,{paddingLeft:2,children:(0,l.jsx)(n,{color:s.dim,children:f})},`c-${T}`)),(0,l.jsx)(n,{children:" "}),i.map((f,T)=>(0,l.jsxs)(n,{children:[u(T),` ${T+1}. ${f.label}`,(0,l.jsx)(n,{color:s.dim,children:` \u2014 ${f.detail}`})]},`o-${T}`)),v!==null||d&&c==="because"?d?(0,l.jsxs)(x,{flexDirection:"column",children:[(0,l.jsxs)(x,{children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:s.assuranceAccent,children:"\u276F"})," ",(0,l.jsx)(n,{color:s.dim,children:"\u270E "})]}),(0,l.jsx)(M,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:c==="because"?"why archive it?":"say what to adjust"})]}),(0,l.jsx)(n,{color:s.muted,children:c==="because"?" submits as: archive \xB7 your reason goes on the record":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):v!==null?(0,l.jsxs)(n,{children:[u(v)," ",(0,l.jsx)(n,{color:s.dim,children:e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(p)return(0,l.jsxs)(x,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,l.jsx)(n,{bold:!0,color:s.assuranceAccent,children:a}),(0,l.jsx)(n,{color:s.dim,children:w}),C]});let _=Math.max(2,Math.min(b-1,100)-a.length-w.length);return(0,l.jsxs)(x,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{bold:!0,color:s.assuranceAccent,children:a})," ".repeat(_),(0,l.jsx)(n,{color:s.dim,children:w})]}),(0,l.jsx)(n,{children:" "}),C]})}var z={"acceptance criteria":1,scenarios:2,"acceptance criteria + exercises":3,"tests + gaps":4};function we(e,t){let r=[],o=K(e.turns).entries.length;if(t==="design"){let c;for(let b=e.ledger.length-1;b>=0;b--){let p=e.ledger[b];if(p.kind==="banner"&&p.text.startsWith("designing: ")){c=p.text.slice(11);break}}let h=c?z[c]:void 0;h&&r.push(`phase ${h}/4`),o>0&&r.push(`${o} item${o===1?"":"s"} this session`)}else o>0&&r.push(`${o} saved as draft${o===1?"":"s"}`);let d=e.pending?e.pending.resolution.filter(c=>!c).length:0;return d>0&&r.push(`${d} question${d===1?"":"s"} pending`),e.credits&&r.push(`${e.credits.total.toFixed(1)} credits`),{items:r}}function ke(e,t){let r=[],o=e.applied+e.committed+e.retired;r.push(`${o} applied`),r.push(`${t} to decide`);let d=[];return e.skipped>0&&d.push(`${e.skipped} skipped`),e.deferred>0&&d.push(`${e.deferred} deferred`),e.failed>0&&d.push(`${e.failed} failed`),{items:[...r,...d]}}function Ae(e,t){let r=["\u2191\u2193 select","\u23CE confirm"];return e.multi_select&&r.push("space toggle"),t.batchCount>1&&r.push("\u2190 \u2192 questions"),(e.allow_free_text||e.options.some(o=>o.input===!0))&&r.push("\u270E type your own"),t.canAttach&&r.push("@ attach a file or URL"),t.escBack&&r.push("esc back"),{keys:r}}function Se(e,t){let r=["\u2191\u2193 select","\u23CE confirm"];return e.some(o=>o.free)&&r.push("\u270E type your own"),t.escBack&&r.push("esc back"),{keys:r}}function Re(e){let t=["\u2191\u2193 select","\u23CE confirm","1-9 verdict"];return W(e)!==null&&t.push("type = adjust"),t.push("esc \xB7 nothing to undo"),{keys:t}}export{ee as a,te as b,le as c,ce as d,ue as e,X as f,V as g,W as h,be as i,we as j,ke as k,Ae as l,Se as m,Re as n};
2
+ import{a as j}from"./chunk-O5U6EAL3.js";import{d as K}from"./chunk-RKXHVP2Z.js";import{a as L}from"./chunk-5Y2G4NC7.js";import{a as M}from"./chunk-YCCUBQY4.js";import{x as s}from"./chunk-NJJQL54J.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as x,b as n,i as D,k as E}from"./chunk-C44QQJR4.js";import{a as I}from"./chunk-6YGTRKDT.js";import{e as y}from"./chunk-UR6MHSHU.js";var g=y(O(),1);function ee(e){let t=e.findIndex(r=>r.free);return t>=0?t:null}var q=60,Q=100;function te({headline:e,ask:t=!1,rows:r,sel:o,focused:d,freeText:c=null,freeTextNote:h,sublines:b=[]}){let{stdout:p}=E(),i=p?.columns??80,v=i<q,k=Math.min(i-1,Q),u=a=>d&&o===a?(0,g.jsx)(n,{color:s.assuranceAccent,children:"\u276F"}):" ",m=t?`? ${e}`:e,A=Math.max(4,k-3),S=b.map((a,w)=>(0,g.jsx)(n,{color:s.dim,children:` ${a.length>A?`${a.slice(0,A-1)}\u2026`:a}`},`sub-${w}`)),R=0,B=r.map((a,w)=>a.free?c?(0,g.jsxs)(x,{flexDirection:"column",children:[(0,g.jsxs)(x,{children:[(0,g.jsxs)(n,{children:[(0,g.jsx)(n,{color:s.assuranceAccent,children:"\u276F"})," ",(0,g.jsx)(n,{color:s.dim,children:"\u270E "})]}),(0,g.jsx)(M,{value:c.value,onChange:c.onChange,onSubmit:c.onSubmit,onCancel:c.onCancel,placeholder:a.label})]}),h?(0,g.jsx)(n,{color:s.muted,children:` ${h}`}):null]},a.key):(0,g.jsxs)(n,{children:[u(w)," ",(0,g.jsx)(n,{color:s.dim,children:`\u270E ${a.label}`})]},a.key):(R+=1,(0,g.jsxs)(n,{bold:d&&o===w,children:[u(w),` ${R}. ${a.label}`,a.detail?(0,g.jsx)(n,{color:s.dim,bold:!1,children:` \u2014 ${a.detail}`}):null]},a.key)));return v?(0,g.jsxs)(x,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,g.jsx)(n,{bold:!0,color:s.assuranceAccent,children:m}),S,B]}):(0,g.jsxs)(x,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,g.jsx)(n,{bold:!0,color:s.assuranceAccent,children:m}),S,(0,g.jsx)(n,{children:" "}),B]})}var H=y(I(),1);var $=y(O(),1),N=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function le(e){let t=e.replace(/…$/,"");return t&&t.charAt(0).toLowerCase()+t.slice(1)}function F(e,t){if(e.length<=t)return e;if(t<=1)return"\u2026";let r=Math.ceil((t-1)/2),o=Math.floor((t-1)/2);return`${e.slice(0,r)}\u2026${o>0?e.slice(-o):""}`}function ce({status:e,meta:t,tallies:r,keys:o,child:d,cols:c}){let{stdout:h}=E(),b=c??h?.columns??80,p=e.kind==="working"||e.kind==="child-working",[i,v]=(0,H.useState)(0);L(()=>v(f=>f+1),p?120:null);let k=N[i%N.length],u,m;switch(e.kind){case"working":u=`${k} ${e.step}${e.elapsedS!==void 0?` \xB7 ${e.elapsedS}s`:""}`,m=s.assuranceAccent;break;case"waiting":u=`\u25CF waiting on you${e.pending?` \u2014 ${e.pending} question${e.pending===1?"":"s"}`:""}`,m=s.amber;break;case"idle":u="\u25CF idle",m=s.assuranceAccent;break;case"card":u=`\u25CF card ${e.n} of ${e.m}`,m=s.amber;break;case"child-working":u=`${k} child: ${e.step}`,m=s.assuranceAccent;break;case"child-waiting":u="\u25CF child waiting on you",m=s.amber;break}let A=d?`${t.verb} \u25B8 ${d.verb}`:t.verb,S=d?.sid?t.sid?`${F(t.sid,14)} \u25B8 ${d.sid}`:d.sid:t.sid,R=t.env==="prod"?"":t.env,B=[A,S,R].filter(Boolean),a=" \xB7 ",w=u.length+a.length+B.join(a).length,C=t.subject;if(C){let f=b-w-a.length;C=f>=8?F(C,f):void 0}let _=[A,...C?[C]:[],S,R].filter(Boolean).join(a);return(0,$.jsxs)(x,{flexDirection:"column",children:[(0,$.jsx)(n,{color:s.muted,children:"\u2500".repeat(Math.max(1,b))}),(0,$.jsxs)(n,{children:[(0,$.jsx)(n,{color:m,children:u}),(0,$.jsx)(n,{color:s.dim,children:`${a}${_}`})]}),(0,$.jsx)(n,{color:s.dim,children:r.items.length>0?r.items.join(a):" "}),(0,$.jsx)(n,{color:s.muted,children:o.join(a)})]})}var P=y(I(),1);function ue({onToggleThinking:e,onCtrlC:t,explorer:r,panel:o}){let c=(0,P.useRef)(null),h=(0,P.useRef)(""),b=()=>{c.current&&clearTimeout(c.current),c.current=null,h.current=""};return(0,P.useEffect)(()=>b,[]),D((p,i)=>{if(i.ctrl&&p==="t"){e();return}if(i.ctrl&&p==="c"){t();return}if(!i.ctrl&&p.includes("")){t();return}if(!i.ctrl&&p.includes("")){e();return}if(r&&r.isOpen()){let v=()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{b(),r.onBack()},150)};if(c.current){if(i.upArrow||i.downArrow||i.return){b(),i.return?r.onEnter():r.onMove(i.upArrow?-1:1);return}if(h.current+=p,h.current==="["){v();return}let k=h.current;b();let u=/^\[([ABCD])/.exec(k);if(u){(u[1]==="A"||u[1]==="B")&&r.onMove(u[1]==="A"?-1:1);return}r.onBack();return}if(i.upArrow){r.onMove(-1);return}if(i.downArrow){r.onMove(1);return}if(i.return){r.onEnter();return}if(i.escape){h.current="",v();return}return}if(o&&o.isFocused()){let v=()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{b(),o.onBack()},150)};if(c.current){if(i.upArrow||i.downArrow||i.return||i.leftArrow||i.rightArrow){b(),i.return?o.onSelect():i.leftArrow?o.onLeft?.():i.rightArrow?o.onRight?.():o.onMove(i.upArrow?-1:1);return}if(h.current+=p,h.current==="["){v();return}let k=h.current;b();let u=/^\[([ABCD])/.exec(k);if(u){u[1]==="A"||u[1]==="B"?o.onMove(u[1]==="A"?-1:1):u[1]==="C"?o.onRight?.():o.onLeft?.();return}o.onBack();return}if(i.upArrow){o.onMove(-1);return}if(i.downArrow){o.onMove(1);return}if(i.leftArrow){o.onLeft?.();return}if(i.rightArrow){o.onRight?.();return}if(i.return){o.onSelect();return}if(i.escape){h.current="",v();return}if(/^[1-9]$/.test(p)){o.onDigit(Number(p));return}if(i.tab){o.onTab?.();return}if(p===" "&&o.isMulti()){o.onSpace();return}if(p&&!i.ctrl&&!i.meta){o.onType(p);return}return}}),null}var l=y(O(),1);function X(e){return e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}function V(e){let t=X(e);return e.viewDiff&&t.push({v:"view_diff",label:"view diff",detail:"full old \u2192 new"}),t}function W(e){return e.kind==="ARCHIVE"?null:V(e).length}var Y={ADD:{color:s.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:s.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},U=60;function be({card:e,position:t,sel:r=0,focused:o=!1,freeText:d=null,editorIntent:c="steer"}){let{stdout:h}=E(),b=h?.columns??80,p=b<U,i=V(e),v=W(e),k=Y[e.kind],u=f=>o&&r===f?(0,l.jsx)(n,{color:s.assuranceAccent,children:"\u276F"}):" ",m=e.impact,A=m&&"stale_refs"in m&&m.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${m.stale_refs.length} item(s) stale`+((m.direct_refs?.length??0)>0?` \u2014 ${m.direct_refs.length} directly touched: ${m.direct_refs.join(", ")}`:""):m&&"design_children"in m?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${m.design_children} design child(ren)`:null,S=e.provenance&&e.provenance!==e.why?e.provenance:e.origin??null,R=[{label:"why",text:e.why},...S?[{label:"from",text:S,dimmer:!0}]:[],...e.tier?[{label:"match",text:e.tier,dimmer:!0}]:[],...A?[{label:"impact",text:A}]:[]],B=Math.max(...R.map(f=>f.label.length)),a="? reconcile",w=`item ${t.n} of ${t.of}`,C=(0,l.jsxs)(x,{flexDirection:"column",children:[(0,l.jsx)(x,{paddingLeft:2,children:(0,l.jsxs)(n,{bold:!0,children:[(0,l.jsx)(n,{color:k.color,children:`[${e.kind}]`}),` ${j(e.title)}`]})}),R.map((f,T)=>(0,l.jsx)(x,{paddingLeft:2,children:(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:s.dim,children:`${f.label.padEnd(B)} `}),(0,l.jsx)(n,{color:f.dimmer?s.dim:void 0,children:f.text})]})},`f-${T}`)),e.diffSummary?(0,l.jsx)(x,{paddingLeft:2,children:(0,l.jsx)(n,{color:s.dim,children:e.diffSummary})}):(e.diff??[]).map((f,T)=>(0,l.jsx)(x,{paddingLeft:4,children:(0,l.jsx)(n,{color:f.op==="-"?"red":"green",children:`${f.op==="-"?"\u2212":"+"} ${f.field==="criteria"?"criterion":f.field}: ${f.text}`})},`d-${T}`)),(e.citeLines??[]).map((f,T)=>(0,l.jsx)(x,{paddingLeft:2,children:(0,l.jsx)(n,{color:s.dim,children:f})},`c-${T}`)),(0,l.jsx)(n,{children:" "}),i.map((f,T)=>(0,l.jsxs)(n,{children:[u(T),` ${T+1}. ${f.label}`,(0,l.jsx)(n,{color:s.dim,children:` \u2014 ${f.detail}`})]},`o-${T}`)),v!==null||d&&c==="because"?d?(0,l.jsxs)(x,{flexDirection:"column",children:[(0,l.jsxs)(x,{children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:s.assuranceAccent,children:"\u276F"})," ",(0,l.jsx)(n,{color:s.dim,children:"\u270E "})]}),(0,l.jsx)(M,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:c==="because"?"why archive it?":"say what to adjust"})]}),(0,l.jsx)(n,{color:s.muted,children:c==="because"?" submits as: archive \xB7 your reason goes on the record":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):v!==null?(0,l.jsxs)(n,{children:[u(v)," ",(0,l.jsx)(n,{color:s.dim,children:e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(p)return(0,l.jsxs)(x,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,l.jsx)(n,{bold:!0,color:s.assuranceAccent,children:a}),(0,l.jsx)(n,{color:s.dim,children:w}),C]});let _=Math.max(2,Math.min(b-1,100)-a.length-w.length);return(0,l.jsxs)(x,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{bold:!0,color:s.assuranceAccent,children:a})," ".repeat(_),(0,l.jsx)(n,{color:s.dim,children:w})]}),(0,l.jsx)(n,{children:" "}),C]})}var z={"acceptance criteria":1,scenarios:2,"acceptance criteria + exercises":3,"tests + gaps":4};function we(e,t){let r=[],o=K(e.turns).entries.length;if(t==="design"){let c;for(let b=e.ledger.length-1;b>=0;b--){let p=e.ledger[b];if(p.kind==="banner"&&p.text.startsWith("designing: ")){c=p.text.slice(11);break}}let h=c?z[c]:void 0;h&&r.push(`phase ${h}/4`),o>0&&r.push(`${o} item${o===1?"":"s"} this session`)}else o>0&&r.push(`${o} saved as draft${o===1?"":"s"}`);let d=e.pending?e.pending.resolution.filter(c=>!c).length:0;return d>0&&r.push(`${d} question${d===1?"":"s"} pending`),e.credits&&r.push(`${e.credits.total.toFixed(1)} credits`),{items:r}}function ke(e,t){let r=[],o=e.applied+e.committed+e.retired;r.push(`${o} applied`),r.push(`${t} to decide`);let d=[];return e.skipped>0&&d.push(`${e.skipped} skipped`),e.deferred>0&&d.push(`${e.deferred} deferred`),e.failed>0&&d.push(`${e.failed} failed`),{items:[...r,...d]}}function Ae(e,t){let r=["\u2191\u2193 select","\u23CE confirm"];return e.multi_select&&r.push("space toggle"),t.batchCount>1&&r.push("\u2190 \u2192 questions"),(e.allow_free_text||e.options.some(o=>o.input===!0))&&r.push("\u270E type your own"),t.canAttach&&r.push("@ attach a file or URL"),t.escBack&&r.push("esc back"),{keys:r}}function Se(e,t){let r=["\u2191\u2193 select","\u23CE confirm"];return e.some(o=>o.free)&&r.push("\u270E type your own"),t.escBack&&r.push("esc back"),{keys:r}}function Re(e){let t=["\u2191\u2193 select","\u23CE confirm","1-9 verdict"];return W(e)!==null&&t.push("type = adjust"),t.push("esc \xB7 nothing to undo"),{keys:t}}export{ee as a,te as b,le as c,ce as d,ue as e,X as f,V as g,W as h,be as i,we as j,ke as k,Ae as l,Se as m,Re as n};