@testmuai/kane-cli 0.8.17 → 0.8.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/dist/{ChatSurface-X2HLVN2I.js → ChatSurface-SY7HJD46.js} +1 -1
  2. package/dist/{ChromeProfilePicker-YU7HL6Z5.js → ChromeProfilePicker-NCIURJK6.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-7FEEVGCU.js → CliFeedbackPrompt-TTVW5COG.js} +1 -1
  4. package/dist/{CliUploadProgress-OTVPBGW4.js → CliUploadProgress-E3WEIF36.js} +1 -1
  5. package/dist/{ConfigView-UKHUASHL.js → ConfigView-ZY37EGAO.js} +1 -1
  6. package/dist/{EvidenceViewOffer-LIPGXO23.js → EvidenceViewOffer-6KT64W7L.js} +1 -1
  7. package/dist/FolderPicker-MPLLN4VP.js +2 -0
  8. package/dist/{InfoBox-2TYT2ROK.js → InfoBox-JP3TTPIO.js} +1 -1
  9. package/dist/{LinksBox-7AS6D7MX.js → LinksBox-4ZB7G5ET.js} +1 -1
  10. package/dist/{ProfilesView-F4MFHZ7Y.js → ProfilesView-25AXMCKS.js} +1 -1
  11. package/dist/{ProjectPicker-QLGZM35L.js → ProjectPicker-RL3LXLTV.js} +1 -1
  12. package/dist/{SaveSessionPrompt-T4MS76FY.js → SaveSessionPrompt-5W4ATISN.js} +1 -1
  13. package/dist/SingleShotApp-JV64B4XL.js +2 -0
  14. package/dist/{SummaryBox-IX32QPWM.js → SummaryBox-GW4XAX5T.js} +1 -1
  15. package/dist/TestMdRunView-7N6QXMNR.js +2 -0
  16. package/dist/{TestrunEvidenceTable-OK2HAENB.js → TestrunEvidenceTable-SYCFAGM4.js} +1 -1
  17. package/dist/WhoamiView-H2DRYRRA.js +2 -0
  18. package/dist/{app-download-CF4JLXWV.js → app-download-2IZ4GPTA.js} +1 -1
  19. package/dist/{auth-D4BDPJPR.js → auth-6PKLNV6Z.js} +1 -1
  20. package/dist/{binary-NWVJK542.js → binary-OMBH4UTI.js} +1 -1
  21. package/dist/{bind-LWN72YES.js → bind-IHLHM5UM.js} +2 -2
  22. package/dist/{bootstrap-63FBDEEU.js → bootstrap-UKZX3LRC.js} +1 -1
  23. package/dist/bridge-KJNDGKPU.js +2 -0
  24. package/dist/{changelog-GIZLIFMN.js → changelog-ZWOIODQ4.js} +1 -1
  25. package/dist/{chunk-BNZQKQOE.js → chunk-2KYJOBNI.js} +1 -1
  26. package/dist/{chunk-5UHM7CKR.js → chunk-2LKSDGWA.js} +1 -1
  27. package/dist/{chunk-JWOPRJIO.js → chunk-47FQ7ZUQ.js} +1 -1
  28. package/dist/{chunk-ZQ6KWTJ2.js → chunk-4ANRRDC7.js} +1 -1
  29. package/dist/{chunk-UQNRUAES.js → chunk-4B3EHSTD.js} +1 -1
  30. package/dist/{chunk-AH4QWIYU.js → chunk-4BKSQFEP.js} +1 -1
  31. package/dist/{chunk-3YBT4UGQ.js → chunk-4JRCAHHB.js} +1 -1
  32. package/dist/{chunk-5X7JIGG7.js → chunk-4R5U7CHE.js} +1 -1
  33. package/dist/{chunk-CCNPXTC6.js → chunk-5B2NEYHF.js} +2 -2
  34. package/dist/{chunk-5ZU7S4E7.js → chunk-5NZUMWUD.js} +2 -2
  35. package/dist/{chunk-UUYYTJG2.js → chunk-5RJ2J5QU.js} +1 -1
  36. package/dist/{chunk-DFK5QYB5.js → chunk-5WUDW6BG.js} +1 -1
  37. package/dist/{chunk-WKIYI6MB.js → chunk-6FEEYKSE.js} +1 -1
  38. package/dist/{chunk-KQCGBDPM.js → chunk-6OIC4S3C.js} +1 -1
  39. package/dist/{chunk-4OQ7GEIA.js → chunk-6VB4FGBZ.js} +1 -1
  40. package/dist/{chunk-4ASBXR6Q.js → chunk-7BMM5DFP.js} +1 -1
  41. package/dist/{chunk-637S3COE.js → chunk-7DSZ2YSD.js} +1 -1
  42. package/dist/{chunk-RGJIGNB3.js → chunk-7PLIZBXB.js} +1 -1
  43. package/dist/{chunk-D2F5T3NX.js → chunk-7ZKVI4US.js} +1 -1
  44. package/dist/{chunk-7U7HOEZO.js → chunk-7ZSHB3AN.js} +1 -1
  45. package/dist/{chunk-I6RTGDZ7.js → chunk-AK7BMF5T.js} +1 -1
  46. package/dist/{chunk-KWANVHJX.js → chunk-ALHCB3LL.js} +1 -1
  47. package/dist/{chunk-NFLQWKFR.js → chunk-BXM5GDIO.js} +2 -2
  48. package/dist/{chunk-5LSPHA3P.js → chunk-C3GDK2OS.js} +1 -1
  49. package/dist/{chunk-IGI4T3VC.js → chunk-CHA75LBJ.js} +1 -1
  50. package/dist/{chunk-5MKY3WMF.js → chunk-DDLEZGZB.js} +1 -1
  51. package/dist/{chunk-JPOYZCTX.js → chunk-DH3H6GWD.js} +1 -1
  52. package/dist/{chunk-GT6Y2SEY.js → chunk-DKPRWI7U.js} +2 -2
  53. package/dist/{chunk-DT2LIX5S.js → chunk-EA2LT5OJ.js} +1 -1
  54. package/dist/{chunk-47QKRIPY.js → chunk-EHOYD6VL.js} +3 -3
  55. package/dist/{chunk-UXJZUGKL.js → chunk-EJBJ7MYC.js} +1 -1
  56. package/dist/{chunk-CCW3VQIY.js → chunk-EKZI5HZV.js} +1 -1
  57. package/dist/{chunk-IZ3PYWUL.js → chunk-EW3KRQGF.js} +1 -1
  58. package/dist/{chunk-AG2MVCNK.js → chunk-EYVHPJLK.js} +1 -1
  59. package/dist/{chunk-HLUOLWEJ.js → chunk-F3IWJ73B.js} +1 -1
  60. package/dist/{chunk-2STKZSVF.js → chunk-G76O7C56.js} +1 -1
  61. package/dist/{chunk-5HDM7GDO.js → chunk-GESZSIB6.js} +1 -1
  62. package/dist/{chunk-L2SJRAK4.js → chunk-GUFIE3Z2.js} +1 -1
  63. package/dist/{chunk-AW34ZNNO.js → chunk-H5N25XIT.js} +1 -1
  64. package/dist/{chunk-IKB2JKMA.js → chunk-H7A4R7WY.js} +1 -1
  65. package/dist/{chunk-DQRVB5EU.js → chunk-IFQD53QB.js} +1 -1
  66. package/dist/{chunk-4PWAODKJ.js → chunk-IGLCR4J2.js} +1 -1
  67. package/dist/{chunk-IHUF6UP4.js → chunk-IQCW5SV5.js} +1 -1
  68. package/dist/{chunk-YOVKKZVZ.js → chunk-J3OGBEEP.js} +1 -1
  69. package/dist/{chunk-3UIZVDOF.js → chunk-JMWRMDSI.js} +1 -1
  70. package/dist/{chunk-UTIP6SMW.js → chunk-L4U7NP5Q.js} +1 -1
  71. package/dist/{chunk-MDM2LJFN.js → chunk-LHU6TEKD.js} +1 -1
  72. package/dist/{chunk-JGCB4OUP.js → chunk-LQMA6N5S.js} +1 -1
  73. package/dist/{chunk-SDJNWR4D.js → chunk-MMLYJDXO.js} +1 -1
  74. package/dist/{chunk-RSXCS474.js → chunk-MSLYSXGM.js} +1 -1
  75. package/dist/{chunk-MTCLFYNH.js → chunk-MVOO7RPO.js} +1 -1
  76. package/dist/{chunk-64TO3MD7.js → chunk-N4HKQTD5.js} +2 -2
  77. package/dist/{chunk-233MYVFS.js → chunk-NXZPWMK5.js} +1 -1
  78. package/dist/{chunk-ZRRBZUDJ.js → chunk-NYP7QV54.js} +1 -1
  79. package/dist/{chunk-KRI5NSGQ.js → chunk-OVL4WXGF.js} +1 -1
  80. package/dist/{chunk-N55U4S4W.js → chunk-PMBQU63H.js} +1 -1
  81. package/dist/{chunk-6OKOMKYR.js → chunk-PVJB7CVS.js} +1 -1
  82. package/dist/{chunk-6CYF7Q5W.js → chunk-QX5LJVTD.js} +2 -2
  83. package/dist/{chunk-VIYV6NIW.js → chunk-RBVLIMOV.js} +1 -1
  84. package/dist/{chunk-GBXF4JE6.js → chunk-SBQUEGTP.js} +1 -1
  85. package/dist/{chunk-EIMHIZKF.js → chunk-SYKS57PK.js} +1 -1
  86. package/dist/{chunk-OCWS5YVO.js → chunk-TG4GGP3H.js} +3 -3
  87. package/dist/{chunk-WDK5ETMA.js → chunk-TSNQLZE3.js} +1 -1
  88. package/dist/{chunk-KX5IV5FL.js → chunk-UAEU5IPH.js} +2 -2
  89. package/dist/{chunk-AIR2WVXM.js → chunk-UE5EYEFI.js} +1 -1
  90. package/dist/{chunk-PHR2OSWD.js → chunk-UQ6A52ML.js} +1 -1
  91. package/dist/{chunk-TMOSERKN.js → chunk-UUS5AK6L.js} +2 -2
  92. package/dist/{chunk-TISVRTL7.js → chunk-VH73F65W.js} +2 -2
  93. package/dist/{chunk-IHD2WXKT.js → chunk-WAZUOA3Y.js} +1 -1
  94. package/dist/{chunk-2LKNUXRN.js → chunk-WQV5SM5P.js} +1 -1
  95. package/dist/{chunk-75SSVUGS.js → chunk-WTAJTPI5.js} +1 -1
  96. package/dist/{chunk-ICFJVEEA.js → chunk-WWVHK7OA.js} +1 -1
  97. package/dist/{chunk-IDLJHKJX.js → chunk-XYMUKOKK.js} +1 -1
  98. package/dist/{chunk-JWPBLVPW.js → chunk-YAUR5CBH.js} +1 -1
  99. package/dist/{chunk-E6X5BVXC.js → chunk-YNOADDF7.js} +1 -1
  100. package/dist/{chunk-GIC56KI3.js → chunk-YPEIPCQY.js} +1 -1
  101. package/dist/{chunk-WC54SZUO.js → chunk-YVKNKK22.js} +1 -1
  102. package/dist/{chunk-B6NU3SNG.js → chunk-ZARM7ESN.js} +1 -1
  103. package/dist/{chunk-2LCWGWYC.js → chunk-ZMM3Y6U7.js} +1 -1
  104. package/dist/{chunk-KMF2PPJ5.js → chunk-ZO75BQ3Z.js} +1 -1
  105. package/dist/{chunk-RBFCGUR3.js → chunk-ZV5KM7LI.js} +1 -1
  106. package/dist/{chunk-LO47W2DO.js → chunk-ZW3JBY5E.js} +4 -4
  107. package/dist/{config-WKLEWUPU.js → config-ODCFEOAN.js} +1 -1
  108. package/dist/{cover-cmd-7TSQJFGM.js → cover-cmd-AQ7PWJRH.js} +1 -1
  109. package/dist/{credentials-FLY3ZXVX.js → credentials-MUZUCSJJ.js} +1 -1
  110. package/dist/{deps-bundle-CAKK3EO5.js → deps-bundle-7COKI7UV.js} +1 -1
  111. package/dist/{deps-resolve-MSLEFPVD.js → deps-resolve-ADN7P5L7.js} +1 -1
  112. package/dist/{dispatch-SXS276ZT.js → dispatch-V24LFEAO.js} +1 -1
  113. package/dist/{doctor-EZPQTFJM.js → doctor-3BRZM4EW.js} +1 -1
  114. package/dist/{evidence-GUOURW6F.js → evidence-EBD3FIXA.js} +1 -1
  115. package/dist/{evolve-cmd-LJJFOXXP.js → evolve-cmd-IR7UGOD2.js} +1 -1
  116. package/dist/{explain-cmd-5LLIJKM2.js → explain-cmd-NNYKSAQK.js} +1 -1
  117. package/dist/{extract-bind-CGU6WVS7.js → extract-bind-2GGLO5KU.js} +2 -2
  118. package/dist/{extract-cmd-7N7CCGN6.js → extract-cmd-2BQJ2HNT.js} +1 -1
  119. package/dist/{gaps-cmd-BNUGDF5N.js → gaps-cmd-Y6CZUCIX.js} +1 -1
  120. package/dist/{generate-headless-7TJYESUU.js → generate-headless-SPGLBRH5.js} +2 -2
  121. package/dist/index.js +44 -44
  122. package/dist/{ingest-cmd-B4T5CW5R.js → ingest-cmd-N37FGNP5.js} +1 -1
  123. package/dist/install-2PUHCC2Y.js +2 -0
  124. package/dist/{interactive-bind-HUZDSGFX.js → interactive-bind-ZLO6S2SG.js} +3 -3
  125. package/dist/{lifecycle-cmd-GIVLSUPE.js → lifecycle-cmd-6TWIQCKR.js} +1 -1
  126. package/dist/{list-cmd-KEKKQDUF.js → list-cmd-NDD2OSP5.js} +1 -1
  127. package/dist/{list-commands-SMBBT5CY.js → list-commands-AARQ2RZG.js} +1 -1
  128. package/dist/login-flow-V4US6VQP.js +2 -0
  129. package/dist/{maintenance-cmd-MLQ3IRFV.js → maintenance-cmd-4QUVSGUY.js} +1 -1
  130. package/dist/{mobile-prompts-EEPPPA6S.js → mobile-prompts-GYJS5BYX.js} +1 -1
  131. package/dist/{objective-variable-gate-AEBWIGH7.js → objective-variable-gate-FUVNHKRA.js} +1 -1
  132. package/dist/{open-provider-OTZ37JB6.js → open-provider-QTPN6XOL.js} +1 -1
  133. package/dist/{persist-recorded-session-IRWGMXGI.js → persist-recorded-session-UFK5VC7S.js} +1 -1
  134. package/dist/{pipeline-OV3TWKSZ.js → pipeline-Z477UOXV.js} +1 -1
  135. package/dist/prepare-target-IES7FXJG.js +2 -0
  136. package/dist/{reconcile-cmd-NBBDE7DJ.js → reconcile-cmd-NDLEM54D.js} +1 -1
  137. package/dist/{reconcile-deps-DJNIY7TP.js → reconcile-deps-APR2LE3C.js} +2 -2
  138. package/dist/{reconcile-engine-Z2XKUCQ7.js → reconcile-engine-C72AP4WS.js} +1 -1
  139. package/dist/{recording-banner-GCR6A46M.js → recording-banner-AZOKNSU3.js} +1 -1
  140. package/dist/registry-W3BMHQDQ.js +2 -0
  141. package/dist/{require-project-folder-YBB5T3OE.js → require-project-folder-LTVPPY3Q.js} +1 -1
  142. package/dist/{resolve-run-intent-XGZN6OQ6.js → resolve-run-intent-XX6O3RYT.js} +1 -1
  143. package/dist/{resolver-WNV53IOL.js → resolver-XMASFMID.js} +1 -1
  144. package/dist/{review-cmd-ZXTLZ4GE.js → review-cmd-4TNBQDJU.js} +1 -1
  145. package/dist/{run-YZP2PTNW.js → run-EOIV3OQE.js} +1 -1
  146. package/dist/{run-YWKZGZVL.js → run-XXA7ILIM.js} +1 -1
  147. package/dist/{run-test-md-N43FRXB6.js → run-test-md-GVRVMPRZ.js} +2 -2
  148. package/dist/{skill-installer-G7Z5ZDAQ.js → skill-installer-AWQT3LM2.js} +1 -1
  149. package/dist/{spawner-ABB7B5CQ.js → spawner-O3VKHYUY.js} +1 -1
  150. package/dist/{store-guard-YIQQF4LC.js → store-guard-MHWBXA4C.js} +1 -1
  151. package/dist/{sync-cmd-4AKHO5EG.js → sync-cmd-P2CL6YA6.js} +1 -1
  152. package/dist/{sync-setup-E7UV25KK.js → sync-setup-JY4T2X3M.js} +1 -1
  153. package/dist/tcg-generate-GWLHZYLF.js +2 -0
  154. package/dist/testmd-actions-SYMNRTK4.js +2 -0
  155. package/dist/{testmd-sync-I2E6W6JL.js → testmd-sync-IRV44CGT.js} +1 -1
  156. package/dist/token-refresh-IM6ELK6S.js +2 -0
  157. package/dist/{validate-basic-WZY6A3KD.js → validate-basic-A5TEMJNT.js} +1 -1
  158. package/dist/{variable-receipt-JONRYHCY.js → variable-receipt-QDP2S5CQ.js} +1 -1
  159. package/dist/{verdicts-JMVS6HNJ.js → verdicts-H755EUQL.js} +1 -1
  160. package/dist/{version-check-CD7DHZI2.js → version-check-26W5GVBQ.js} +1 -1
  161. package/dist/{view-cmd-ASH2UFUW.js → view-cmd-D3BYBDZE.js} +1 -1
  162. package/dist/{walk-session-ZPXR7ASG.js → walk-session-ZZ26LEQE.js} +1 -1
  163. package/dist/{with-telemetry-QXCHDKPW.js → with-telemetry-UE6SYQWL.js} +1 -1
  164. package/package.json +11 -11
  165. package/dist/FolderPicker-OTQYRAYC.js +0 -2
  166. package/dist/SingleShotApp-4CDTAF3H.js +0 -2
  167. package/dist/TestMdRunView-MRMY3RW5.js +0 -2
  168. package/dist/WhoamiView-AHMNIIXZ.js +0 -2
  169. package/dist/bridge-UMXGHAJF.js +0 -2
  170. package/dist/install-6KJ2MZX3.js +0 -2
  171. package/dist/login-flow-5ZIG7JXT.js +0 -2
  172. package/dist/prepare-target-35OI7XBL.js +0 -2
  173. package/dist/registry-V3ULHPLM.js +0 -2
  174. package/dist/tcg-generate-XJN5OMIJ.js +0 -2
  175. package/dist/testmd-actions-WFDWYEAU.js +0 -2
  176. package/dist/token-refresh-NADDXLYM.js +0 -2
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{A as K,B as L,D as M,E as N,F as O,G as P,H as Q,J as R,K as S,L as T,M as U,N as _,P as $,Q as aa,R as ba,T as ca,U as da,V as ea,W as fa,X as ga,Y as ha,Z as ia,a as c,b as d,c as e,d as f,e as g,f as h,h as i,i as j,j as t,k as u,l as v,m as w,n as x,o as y,p as z,q as A,r as B,s as C,t as D,u as E,v as F,w as G,x as H,y as I,z as J}from"./chunk-TISVRTL7.js";import{a as V,b as W,c as X,d as Y,e as Z}from"./chunk-D2F5T3NX.js";import"./chunk-AACQE24F.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-5GUD3CIH.js";import"./chunk-U2LDPUDZ.js";import"./chunk-WESMQEPO.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-IPQAKIJO.js";import"./chunk-VVOKM2VO.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import{a,f as b}from"./chunk-P7YZ3PU3.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-RSXCS474.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-TMOSERKN.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-VIYV6NIW.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-PHR2OSWD.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,b as buildEnvironment,j as buildEvidenceRunConfig,i as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,a as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,f as shortHash,e as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,h as testIdForInline,g as testIdForTestmd,k as validatePack,c as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,d as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
2
+ import{A as K,B as L,D as M,E as N,F as O,G as P,H as Q,J as R,K as S,L as T,M as U,N as _,P as $,Q as aa,R as ba,T as ca,U as da,V as ea,W as fa,X as ga,Y as ha,Z as ia,a as c,b as d,c as e,d as f,e as g,f as h,h as i,i as j,j as t,k as u,l as v,m as w,n as x,o as y,p as z,q as A,r as B,s as C,t as D,u as E,v as F,w as G,x as H,y as I,z as J}from"./chunk-VH73F65W.js";import{a as V,b as W,c as X,d as Y,e as Z}from"./chunk-7ZKVI4US.js";import"./chunk-AACQE24F.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-5GUD3CIH.js";import"./chunk-U2LDPUDZ.js";import"./chunk-WESMQEPO.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-IPQAKIJO.js";import"./chunk-VVOKM2VO.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import{a,f as b}from"./chunk-P7YZ3PU3.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSLYSXGM.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-UUS5AK6L.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-RBVLIMOV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-UQ6A52ML.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,b as buildEnvironment,j as buildEvidenceRunConfig,i as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,a as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,f as shortHash,e as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,h as testIdForInline,g as testIdForTestmd,k as validatePack,c as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,d as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g}from"./chunk-7U7HOEZO.js";import"./chunk-HS7OIRGU.js";import"./chunk-UJZZDPDY.js";import"./chunk-BZAGVBCX.js";import"./chunk-LSDWPG6C.js";import"./chunk-KDNNMU7Q.js";import"./chunk-6CYF7Q5W.js";import"./chunk-ICFJVEEA.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-IPQAKIJO.js";import"./chunk-VVOKM2VO.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-PHR2OSWD.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
2
+ import{a,b,c,d,e,f,g}from"./chunk-7ZSHB3AN.js";import"./chunk-HS7OIRGU.js";import"./chunk-UJZZDPDY.js";import"./chunk-BZAGVBCX.js";import"./chunk-LSDWPG6C.js";import"./chunk-KDNNMU7Q.js";import"./chunk-QX5LJVTD.js";import"./chunk-WWVHK7OA.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-IPQAKIJO.js";import"./chunk-VVOKM2VO.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-UQ6A52ML.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-F2OBORCG.js";import{Q as i}from"./chunk-6CYF7Q5W.js";import"./chunk-ICFJVEEA.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-IPQAKIJO.js";import"./chunk-VVOKM2VO.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{z as n}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-PHR2OSWD.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";async function f(s,p){let o=i(process.cwd(),{out:r=>process.stdout.write(r+`
2
+ import{a}from"./chunk-F2OBORCG.js";import{Q as i}from"./chunk-QX5LJVTD.js";import"./chunk-WWVHK7OA.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-IPQAKIJO.js";import"./chunk-VVOKM2VO.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{z as n}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-UQ6A52ML.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";async function f(s,p){let o=i(process.cwd(),{out:r=>process.stdout.write(r+`
3
3
  `),err:r=>process.stderr.write(r+`
4
4
  `),confirm:async()=>!1,isTTY:!!process.stdout.isTTY});if(!o)return 2;let c=n(o),t=a(o,c,s);if(p.json)return process.stdout.write(JSON.stringify(t)+`
5
5
  `),t.target?0:1;if(!t.target)return process.stdout.write(`error: ${s} names nothing in the graph
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $}from"./chunk-A2SQD2AY.js";import{f as se,g as U}from"./chunk-JGCB4OUP.js";import"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import"./chunk-KMF2PPJ5.js";import"./chunk-WVHMPIDQ.js";import"./chunk-CCNPXTC6.js";import"./chunk-D7WG7SRA.js";import"./chunk-SDJNWR4D.js";import"./chunk-AXTPNZPX.js";import"./chunk-U6OTFMIT.js";import"./chunk-BZAGVBCX.js";import"./chunk-V4B5QA3U.js";import"./chunk-BB2W35TW.js";import"./chunk-LO47W2DO.js";import{c as L}from"./chunk-YKTYVJBN.js";import"./chunk-FY7TCYPK.js";import"./chunk-63DYVWNX.js";import"./chunk-427OQS2N.js";import{a as A}from"./chunk-2STKZSVF.js";import{a as ie}from"./chunk-LSDWPG6C.js";import"./chunk-7N6OCHPC.js";import"./chunk-KDNNMU7Q.js";import"./chunk-Q6F23V7L.js";import"./chunk-SEEEGDVK.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import{e as W}from"./chunk-AIR2WVXM.js";import"./chunk-AG2MVCNK.js";import{T as ee,U as te,V as re,W as Y,X as ne}from"./chunk-6CYF7Q5W.js";import"./chunk-ICFJVEEA.js";import{c as O}from"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-IPQAKIJO.js";import"./chunk-VVOKM2VO.js";import{a as C}from"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import{a as B,b as H}from"./chunk-5MKY3WMF.js";import"./chunk-ZLWURCJ7.js";import"./chunk-QSCXXNC2.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-PHR2OSWD.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{existsSync as oe}from"fs";async function he(n){let[{render:s},a,{QuestionBatchPrompt:m}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),h=a.default??a;return new Promise(x=>{let v=s(h.createElement(m,{questions:n,onSubmit:t=>{v.unmount(),x(t)}}))})}async function we(n,s){let[{render:a},m,{ReviewChecklist:h}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),x=m.default??m;return new Promise(v=>{let t=a(x.createElement(h,{items:n.map(f=>{let w=s.get(f.temp_ref);return{uc:f,dedupWith:w&&!w.archived?w.cid:void 0,archivedMatch:w?.archived?{cid:w.cid,reason:w.reason}:void 0}}),onSubmit:f=>{t.unmount(),v(f)}}))})}async function ye(n){let{createInterface:s}=await import("readline/promises"),a=s({input:process.stdin,output:process.stdout});try{let m=await a.question(`${n} [y/N] `);return/^y(es)?$/i.test(m.trim())}finally{a.close()}}async function Ae(n){let s=C(process.cwd()),a=H({verb:"extract",mode:n.plan?"cli":"interactive",contextRoot:s,env:B(),resumeSid:n.resume,write:!0,longSession:!0});await ee(s,r=>process.stderr.write(r+`
2
+ import{a as $}from"./chunk-A2SQD2AY.js";import{f as se,g as U}from"./chunk-LQMA6N5S.js";import"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import"./chunk-ZO75BQ3Z.js";import"./chunk-WVHMPIDQ.js";import"./chunk-5B2NEYHF.js";import"./chunk-D7WG7SRA.js";import"./chunk-MMLYJDXO.js";import"./chunk-AXTPNZPX.js";import"./chunk-U6OTFMIT.js";import"./chunk-BZAGVBCX.js";import"./chunk-V4B5QA3U.js";import"./chunk-BB2W35TW.js";import"./chunk-ZW3JBY5E.js";import{c as L}from"./chunk-YKTYVJBN.js";import"./chunk-FY7TCYPK.js";import"./chunk-63DYVWNX.js";import"./chunk-427OQS2N.js";import{a as A}from"./chunk-G76O7C56.js";import{a as ie}from"./chunk-LSDWPG6C.js";import"./chunk-7N6OCHPC.js";import"./chunk-KDNNMU7Q.js";import"./chunk-Q6F23V7L.js";import"./chunk-SEEEGDVK.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import{e as W}from"./chunk-UE5EYEFI.js";import"./chunk-EYVHPJLK.js";import{T as ee,U as te,V as re,W as Y,X as ne}from"./chunk-QX5LJVTD.js";import"./chunk-WWVHK7OA.js";import{c as O}from"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-IPQAKIJO.js";import"./chunk-VVOKM2VO.js";import{a as C}from"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import{a as B,b as H}from"./chunk-DDLEZGZB.js";import"./chunk-ZLWURCJ7.js";import"./chunk-QSCXXNC2.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-UQ6A52ML.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{existsSync as oe}from"fs";async function he(n){let[{render:s},a,{QuestionBatchPrompt:m}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),h=a.default??a;return new Promise(x=>{let v=s(h.createElement(m,{questions:n,onSubmit:t=>{v.unmount(),x(t)}}))})}async function we(n,s){let[{render:a},m,{ReviewChecklist:h}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),x=m.default??m;return new Promise(v=>{let t=a(x.createElement(h,{items:n.map(f=>{let w=s.get(f.temp_ref);return{uc:f,dedupWith:w&&!w.archived?w.cid:void 0,archivedMatch:w?.archived?{cid:w.cid,reason:w.reason}:void 0}}),onSubmit:f=>{t.unmount(),v(f)}}))})}async function ye(n){let{createInterface:s}=await import("readline/promises"),a=s({input:process.stdin,output:process.stdout});try{let m=await a.question(`${n} [y/N] `);return/^y(es)?$/i.test(m.trim())}finally{a.close()}}async function Ae(n){let s=C(process.cwd()),a=H({verb:"extract",mode:n.plan?"cli":"interactive",contextRoot:s,env:B(),resumeSid:n.resume,write:!0,longSession:!0});await ee(s,r=>process.stderr.write(r+`
3
3
  `));{let r=oe(s)?Y(s):null;if(r)return process.stderr.write(`error: ${r.text}
4
4
  next: ${r.remedy}
5
5
  `),await a.end({exit_code:2}),2}let h={...await W(),...a.spawnEnv()},x=await L(h);if(!x.ok)return process.stderr.write((x.message??"error: turn-endpoint preflight failed")+`
@@ -7,7 +7,7 @@ next: ${r.remedy}
7
7
  `),a.error("preflight_auth"),await a.end({exit_code:2}),2;let v=async()=>x;if(n.plan){let r=await U(n,{contextDir:s,agent:A,preflightTurn:v,ask:he,review:we,confirmStale:ye,out:l=>process.stdout.write(l+`
8
8
  `),progress:l=>process.stderr.write(l+`
9
9
  `),isTTY:O(),auth:h,telemetry:a});return r===1&&process.stderr.write(a.supportFooter()+`
10
- `),await a.end({exit_code:r}),r}let[{render:t},f,{ScrollbackProvider:w},{ChatSurface:z},{ScrollbackTap:u},{makeChatController:F},{setInkExit:Q},T]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-X2HLVN2I.js"),import("./ScrollbackTap-QHJOFYMC.js"),import("./chat-controller-UJQ6Z4RE.js"),import("./exit-manager-ZLDO54S4.js"),Promise.all([import("./chat-committer-6D7AQI6Z.js"),import("./descriptor-3JJUOHBM.js"),import("./explain-NEFBUX5G.js"),import("./readmodel-FVLRQWZ7.js")])]),[{commitChatTurn:J},{topologyDescriptor:j},{explain:e},{openGraph:i}]=T,S=f.default??f,o=F({commitChatTurn:J,descriptor:j(),contextDir:s,refreshGraph:()=>i(s),graph:i(s),explain:e,by:{kind:"human",id:"owner"},dedupFlags:r=>se(r,i(s))}),q={current:null},P=null,K=0,G=null,I=!1,ae=()=>{if(K+=1,K>=2){try{M.unmount()}catch{}$({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 anything already committed is safe in the store"]}),process.exit(130)}o.requestPause(),G=setTimeout(()=>{I||(I=!0,(async()=>{o.finalizeForExit(),await q.current?.flush();try{M.unmount()}catch{}$({state:"interrupted",facts:["the agent did not confirm the pause within 5s \u2014 nothing new was saved"]}),process.exit(130)})())},5e3)},ce=await import("./dossier-7HVC6BNK.js"),de=r=>{try{return ce.buildDossier(i(s),r)}catch{return null}},ue={listUcs:()=>{let r=i(s),l=new Set(o.state.turns.flatMap(c=>(c.items??[]).map(p=>p.title.toLowerCase()))),d={high:0,med:1,low:2};return r.byLabel("usecase").filter(c=>!r.superseded.has(c.cid)).map((c,p)=>{let k=c.content,b=String(k.title??c.cid.slice(0,12)),V=ie(r,c.cid),E=V?V.designed_at_cid===c.cid?"current":"stale":void 0;return{key:c.cid,title:b,badge:E==="current"?"designed":E==="stale"?"designed \xB7 stale":l.has(b.toLowerCase())?"drafted this session":"existing",designed:E,risk:k.risk,i:p}}).sort((c,p)=>(d[c.risk??"zz"]??3)-(d[p.risk??"zz"]??3)||c.i-p.i).map(({key:c,title:p,badge:k,designed:b})=>({key:c,title:p,badge:k,designed:b}))},runDesignChild:async(r,l=!1,d="design")=>{try{let{designEntryCheck:g,confirmUnreviewedViaAsk:_}=await import("./trust-gate-EX7R2P4Y.js"),y=g(i(s),r);if(!y.ok&&(y.code==="UC_UNREVIEWED"||y.code==="UC_ARCHIVED")&&!await _(D=>o.ask(D),y))return o.note(`design child refused \u2014 approve it first: ${y.reviewCmd}`),2}catch{}let[{runDesign:c}]=await Promise.all([import("./run-YZP2PTNW.js")]),p="",k=(()=>{try{let g=i(s),_=g.resolve(r);return(_?g.getNode(_.cid)?.content?.title:void 0)??r}catch{return r}})(),{collectSessionItems:b}=await import("./session-items-2ATN7VXG.js"),V=b(o.state.turns).entries.length,E=o.state.credits?.total,fe=Date.now();o.ledger({kind:"childOpen",verb:d,subject:k});let ge=g=>{let _=Math.max(1,Math.round((Date.now()-fe)/1e3)),y=b(o.state.turns).entries.length-V,R=o.state.credits?.total,D=R!==void 0&&E!==void 0?R-E:R;o.ledger(g===0?{kind:"childClose",verb:d,subject:k,ok:!0,durS:_,...y>0?{results:`${y} item${y===1?"":"s"}`}:{},...D!==void 0&&D>0?{credits:D}:{}}:{kind:"childClose",verb:d,subject:k,ok:!1,durS:_,exitCode:g,fixCmd:`kane-cli design tests --use-case ${r}${l||d==="evolve"?" --force":""}`});let Z=b(o.state.turns).entries.length;o.ledger({kind:"childBack",parentVerb:"extract",context:`${Z} draft${Z===1?"":"s"} saved`})},N=1;try{N=await c({useCase:r,force:l,mode:"interactive"},{contextDir:s,agent:A,preflightTurn:v,ask:g=>o.ask(g),chat:o,nested:!0,out:g=>{p=g},progress:()=>{},isTTY:!0,auth:h})}finally{ge(N)}return N!==0&&p&&o.note(p),N}},{makeReconcileDeps:le}=await import("./reconcile-deps-DJNIY7TP.js"),me=le({contextDir:s,...n.changeContext?{changeContext:n.changeContext}:{},note:r=>o.note(r)}),pe={verb:"extract",sid:n.resume??a.ids.session_id,env:B(),...n.source?{subject:n.source}:{}},M=t(S.createElement(w,null,S.createElement(u,{into:q}),S.createElement(z,{controller:o,verb:"extract",onCtrlC:ae,chain:ue,inspect:de,reconcile:me,meta:pe})),{exitOnCtrlC:!1});Q(()=>M.unmount());let X=null;try{let r=U(n,{contextDir:s,agent:A,preflightTurn:v,onSummary:d=>{P=d},ask:d=>o.ask(d),review:async d=>new Map(d.map(c=>[c.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:d=>o.note(d),progress:()=>{},isTTY:O(),auth:h,chat:o,telemetry:a});r.finally(()=>{I=!0});let l=await r;return X=l,l===1&&process.stderr.write(a.supportFooter()+`
10
+ `),await a.end({exit_code:r}),r}let[{render:t},f,{ScrollbackProvider:w},{ChatSurface:z},{ScrollbackTap:u},{makeChatController:F},{setInkExit:Q},T]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-SY7HJD46.js"),import("./ScrollbackTap-QHJOFYMC.js"),import("./chat-controller-UJQ6Z4RE.js"),import("./exit-manager-ZLDO54S4.js"),Promise.all([import("./chat-committer-6D7AQI6Z.js"),import("./descriptor-3JJUOHBM.js"),import("./explain-NEFBUX5G.js"),import("./readmodel-FVLRQWZ7.js")])]),[{commitChatTurn:J},{topologyDescriptor:j},{explain:e},{openGraph:i}]=T,S=f.default??f,o=F({commitChatTurn:J,descriptor:j(),contextDir:s,refreshGraph:()=>i(s),graph:i(s),explain:e,by:{kind:"human",id:"owner"},dedupFlags:r=>se(r,i(s))}),q={current:null},P=null,K=0,G=null,I=!1,ae=()=>{if(K+=1,K>=2){try{M.unmount()}catch{}$({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 anything already committed is safe in the store"]}),process.exit(130)}o.requestPause(),G=setTimeout(()=>{I||(I=!0,(async()=>{o.finalizeForExit(),await q.current?.flush();try{M.unmount()}catch{}$({state:"interrupted",facts:["the agent did not confirm the pause within 5s \u2014 nothing new was saved"]}),process.exit(130)})())},5e3)},ce=await import("./dossier-7HVC6BNK.js"),de=r=>{try{return ce.buildDossier(i(s),r)}catch{return null}},ue={listUcs:()=>{let r=i(s),l=new Set(o.state.turns.flatMap(c=>(c.items??[]).map(p=>p.title.toLowerCase()))),d={high:0,med:1,low:2};return r.byLabel("usecase").filter(c=>!r.superseded.has(c.cid)).map((c,p)=>{let k=c.content,b=String(k.title??c.cid.slice(0,12)),V=ie(r,c.cid),E=V?V.designed_at_cid===c.cid?"current":"stale":void 0;return{key:c.cid,title:b,badge:E==="current"?"designed":E==="stale"?"designed \xB7 stale":l.has(b.toLowerCase())?"drafted this session":"existing",designed:E,risk:k.risk,i:p}}).sort((c,p)=>(d[c.risk??"zz"]??3)-(d[p.risk??"zz"]??3)||c.i-p.i).map(({key:c,title:p,badge:k,designed:b})=>({key:c,title:p,badge:k,designed:b}))},runDesignChild:async(r,l=!1,d="design")=>{try{let{designEntryCheck:g,confirmUnreviewedViaAsk:_}=await import("./trust-gate-EX7R2P4Y.js"),y=g(i(s),r);if(!y.ok&&(y.code==="UC_UNREVIEWED"||y.code==="UC_ARCHIVED")&&!await _(D=>o.ask(D),y))return o.note(`design child refused \u2014 approve it first: ${y.reviewCmd}`),2}catch{}let[{runDesign:c}]=await Promise.all([import("./run-EOIV3OQE.js")]),p="",k=(()=>{try{let g=i(s),_=g.resolve(r);return(_?g.getNode(_.cid)?.content?.title:void 0)??r}catch{return r}})(),{collectSessionItems:b}=await import("./session-items-2ATN7VXG.js"),V=b(o.state.turns).entries.length,E=o.state.credits?.total,fe=Date.now();o.ledger({kind:"childOpen",verb:d,subject:k});let ge=g=>{let _=Math.max(1,Math.round((Date.now()-fe)/1e3)),y=b(o.state.turns).entries.length-V,R=o.state.credits?.total,D=R!==void 0&&E!==void 0?R-E:R;o.ledger(g===0?{kind:"childClose",verb:d,subject:k,ok:!0,durS:_,...y>0?{results:`${y} item${y===1?"":"s"}`}:{},...D!==void 0&&D>0?{credits:D}:{}}:{kind:"childClose",verb:d,subject:k,ok:!1,durS:_,exitCode:g,fixCmd:`kane-cli design tests --use-case ${r}${l||d==="evolve"?" --force":""}`});let Z=b(o.state.turns).entries.length;o.ledger({kind:"childBack",parentVerb:"extract",context:`${Z} draft${Z===1?"":"s"} saved`})},N=1;try{N=await c({useCase:r,force:l,mode:"interactive"},{contextDir:s,agent:A,preflightTurn:v,ask:g=>o.ask(g),chat:o,nested:!0,out:g=>{p=g},progress:()=>{},isTTY:!0,auth:h})}finally{ge(N)}return N!==0&&p&&o.note(p),N}},{makeReconcileDeps:le}=await import("./reconcile-deps-APR2LE3C.js"),me=le({contextDir:s,...n.changeContext?{changeContext:n.changeContext}:{},note:r=>o.note(r)}),pe={verb:"extract",sid:n.resume??a.ids.session_id,env:B(),...n.source?{subject:n.source}:{}},M=t(S.createElement(w,null,S.createElement(u,{into:q}),S.createElement(z,{controller:o,verb:"extract",onCtrlC:ae,chain:ue,inspect:de,reconcile:me,meta:pe})),{exitOnCtrlC:!1});Q(()=>M.unmount());let X=null;try{let r=U(n,{contextDir:s,agent:A,preflightTurn:v,onSummary:d=>{P=d},ask:d=>o.ask(d),review:async d=>new Map(d.map(c=>[c.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:d=>o.note(d),progress:()=>{},isTTY:O(),auth:h,chat:o,telemetry:a});r.finally(()=>{I=!0});let l=await r;return X=l,l===1&&process.stderr.write(a.supportFooter()+`
11
11
  `),await a.end({exit_code:l}),l}catch(r){throw P||(P={state:"crashed",facts:[`the session ended unexpectedly \u2014 ${r instanceof Error?r.name:"error"}`]}),r}finally{I=!0,G&&clearTimeout(G),o.finalizeForExit(),await q.current?.flush();try{M.unmount()}catch{}P?$(P):X===1&&$({state:"interrupted",facts:["the session ended without saving \u2014 see the error above"]})}}async function $e(n){let s=H({verb:"extract",mode:n.mode,contextRoot:C(process.cwd()),env:B(),resumeSid:n.resume,write:!0,longSession:!0}),{makeHeadlessIO:a,resolveEncoding:m,guardedChannels:h}=await import("./headless-io-3A3BZVQ5.js"),{withStructuredNext:x,prepareStructuredResume:v}=await import("./structured-answers-3C2DCFFF.js"),t=x(a(m(n.mode),"extract")),f=await te(C(process.cwd()));f&&(m(n.mode)==="ndjson"?t.event(re(f)):t.progress(f.text));let{runWithChannel:w}=await import("./run-channel-RGH4WIQX.js"),z=m(n.mode)==="ndjson"?e=>w({event:i=>t.event(i)},e):e=>e();for(let e of n.landed??[]){let i=e;t.event({type:"ingested",source_id:e.source_id,status:e.status,cid:e.source_cid,...i.warnings?.length?{warnings:i.warnings}:{},...i.media?{media:i.media}:{},...i.duplicate_of?{duplicate_of:i.duplicate_of}:{},...i.lineage_candidate?{lineage_candidate:i.lineage_candidate}:{}})}{let e=oe(C(process.cwd()))?Y(C(process.cwd())):null;if(e)return m(n.mode)==="ndjson"?t.event(ne(e)):t.progress(`error: ${e.text}
12
12
  next: ${e.remedy}`),await s.end({exit_code:2}),t.done(2,"refused")}let u;try{u=v({opts:n,contextDir:C(process.cwd()),verb:"extract"})}catch(e){let i=e instanceof Error?e.message:String(e);return t.out(`error: ${i}`),n.mode==="agent"&&t.event({type:"error",message:i}),await s.end({exit_code:1}),n.mode==="agent"?t.done(1,"error"):1}if(u.kind==="refuse")return t.out(u.error),n.mode==="agent"&&t.event({type:"error",message:u.error,code:u.code}),await s.end({exit_code:2}),n.mode==="agent"?t.done(2,"refused"):2;let F=n;if(u.kind==="apply"){for(let e of u.notes)t.out(e);if(u.matchedQids.length>0){t.out(`applying ${u.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let e of u.matchedQids)t.event({type:"panel_resolved",id:e,by:"user",via:"flag"})}u.statement&&(F={...n,message:[n.message,u.statement].filter(Boolean).join(`
13
13
 
@@ -2,4 +2,4 @@ import { createRequire } from 'module'; const require = createRequire(import.met
2
2
  import{a as i}from"./chunk-CH273NAE.js";import"./chunk-UR6MHSHU.js";import{existsSync as u}from"fs";async function g(e){if(e.mode!=null&&!["interactive","agent","ci","override"].includes(e.mode)){let{makeHeadlessIO:t,agentRefusal:r}=await import("./headless-io-3A3BZVQ5.js");return r(t("ndjson","extract"),`extract: --mode must be interactive | agent | ci | override, got '${e.mode}'`,"MODE_USAGE")}let n=async(t,r)=>{if(e.mode!=="agent")return process.stderr.write(t+`
3
3
  `),2;let{makeHeadlessIO:o,agentRefusal:c}=await import("./headless-io-3A3BZVQ5.js");return c(o("ndjson","extract"),t,r)};if(e.apply)return n("extract: --apply is not implemented yet \u2014 coming with the plan\u2192apply workflow (run without --apply, or use --plan to preview)");{let{validateResumeMessage:t}=await import("./headless-io-3A3BZVQ5.js"),r=t(e,"extract");if(r)return n(r)}{let{gateStructuredFlags:t}=await import("./structured-answers-3C2DCFFF.js"),r=t(e,"extract");if(r)return n(r,"STRUCTURED_FLAGS_USAGE")}if(e.withSource&&!e.resume)return n("extract: --with-source pairs with --resume \u2014 it lands the source and sets the resumed session's pending questions aside");if(e.queued)return n("extract: --queued is gone \u2014 extract sweeps every pending source by default (just run kane-cli context extract)");if(!u(i(process.cwd())))return n("error: no context store here (run `kane-cli context ingest <files>` first)","NO_STORE");if(!e.mode&&!process.stdin.isTTY)return process.stderr.write(`extract: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
4
4
  `),2;let s=e.mode??"interactive";if(s==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`extract: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
5
- `),2;let{bindExtractInteractive:t}=await import("./extract-bind-CGU6WVS7.js");return t(e)}let{bindExtractHeadless:a}=await import("./extract-bind-CGU6WVS7.js");return a({...e,mode:s})}export{g as extractCommand};
5
+ `),2;let{bindExtractInteractive:t}=await import("./extract-bind-2GGLO5KU.js");return t(e)}let{bindExtractHeadless:a}=await import("./extract-bind-2GGLO5KU.js");return a({...e,mode:s})}export{g as extractCommand};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{P as G,Q as re,S as oe,o as ne,p as se}from"./chunk-6CYF7Q5W.js";import"./chunk-ICFJVEEA.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import{a as H,b as q,c as Q,d as X,e as Z,f as ee,g as te}from"./chunk-AACQE24F.js";import{f as V}from"./chunk-5GUD3CIH.js";import{a as O,b as F,c as C,d as z}from"./chunk-WESMQEPO.js";import"./chunk-EHN5HTUD.js";import"./chunk-IPQAKIJO.js";import"./chunk-VVOKM2VO.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{z as Y}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import{f as E,g as U}from"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-PHR2OSWD.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";function me(e,t){return e.length===0?"not_run":Q(e,t).verified?"proven":q(e,t).some(r=>r.verdict==="failed")?"failing":"blocked"}function ie(e,t){let s=null;for(let{cid:g}of e.byLabel(E.TEST))for(let o of e.execHistory(g))(!s||String(o.started_at)>s.started_at)&&(s={execution_id:String(o.execution_id),started_at:String(o.started_at)});if(!s)return null;let r=H[t],a=te(e),l=X(a).aspects[t],x={},u={},m=0,h=0,R=0;for(let g of a.usecases){let o=[];for(let v of g.acceptance_criteria){let f=v.executions??[],p=me(f,r);o.push(p),p==="failing"?m++:p==="blocked"?h++:p==="not_run"&&R++;let y=[],c;if(p==="failing"){let n=null,d=e.resolve(v.id)?.cid;for(let b of v.covered_by){let w=e.execHistory(b).map($=>({verdict:String(ee(e,$.per_ac,d,v.id)??$.verdict),oracle_mode:String($.oracle_mode),ts:String($.started_at),execution_id:String($.execution_id)})).filter($=>r.counted_verdicts.includes($.verdict)&&r.accepted_oracle_modes.includes($.oracle_mode)),S=w[w.length-1];S?.verdict==="failed"&&(y.push(b),(!n||S.ts>n.ts)&&(n={ts:S.ts,execution_id:S.execution_id}))}c=n?.execution_id}else p==="blocked"&&(c=f[f.length-1]?.execution_id);x[v.id]={state:p,viaTests:y,...c?{executionId:c}:{}}}let i=o.some(v=>v!=="not_run"),k=l.usecases[g.id],_=i?k.status==="covered"?"proven":k.status==="partial"?"partial":o.includes("failing")?"failing":o.includes("blocked")?"blocked":"not_run":"not_run";u[g.id]={pct:k.pct,status:_}}return{aspect:t,pct:l.summary.coverage_pct,acs_proven:l.summary.acs_verified,failing:m,blocked:h,not_run:R,latest_run:s,perUc:u,perAc:x,config:{...r,source:"graph_execution_facts",denominator:"current_live_acs"}}}var he=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],ve={failing:"failing",blocked:"blocked","needs-refresh":"needs refresh","needs-tests":"needs tests","needs-scenarios":"needs scenarios","happy-only":"happy path only","possible-duplicate":"possible duplicate","not-yet-run":"not yet run"},M={high:0,med:1,low:2};function D(e,t){let s=/^(.*?)(\d+)$/.exec(e),r=/^(.*?)(\d+)$/.exec(t);return s&&r&&s[1]===r[1]?Number(s[2])-Number(r[2]):e<t?-1:e>t?1:0}function I(e){if(!e||/^sha256:/.test(e))return"(unnamed)";let t=/^(uc|ac|sc|t)-(\d+)$/.exec(e);return t?`${t[1].toUpperCase()}-${t[2]}`:e}function be(e,t=5){let s=e.trim().split(/\s+/);return s.slice(0,t).join(" ")+(s.length>t?"\u2026":"")}function ye(e,t){let s=e.resolve(t),r=s?e.getNode(e.tipOf(s.cid))?.content:null;return String(r?.title??r?.text??"")}function ce(e,t){let s=e.resolve(t);return{id:s?e.displayNameOf(e.tipOf(s.cid))??e.displayNameOf(s.cid):null,title:be(ye(e,t),8)}}function xe(e,t){let s=e.resolve(t);if(!s)return null;let r=e.tipOf(s.cid);if(!O(e,r))return null;let a=e.nodeLabel.get(r);if(a===E.USECASE)return r;if(a===E.AC)return C(e,r);if(a===E.TEST){let l=e.edgesFrom(r).find(u=>u.type===U.VERIFIES&&O(e,u.dst));if(l)return C(e,l.dst);let x=e.edgesFrom(r).find(u=>u.type===U.AUTOMATES&&O(e,u.dst));if(x){let u=e.edgesFrom(x.dst).find(m=>m.type===U.BELONGS_TO&&O(e,m.dst));return u?u.dst:null}}return null}function L(e){if(e.tag==="reuse-candidate"&&e.stage==="design")return"possible-duplicate";switch(e.kind){case"no-verifies":return"needs-tests";case"zero-scenario":return"needs-scenarios";case"happy-only":return"happy-only";case"stale-ac":case"stale-test":return"needs-refresh";case"execution-failed":return"failing";case"execution-blocked":return"blocked";case"covered-not-run":return"not-yet-run";default:return"other"}}function ke(e,t){let s=e.resolve(t),r=s?e.getNode(e.tipOf(s.cid))?.content.risk:null;return r==="high"||r==="med"||r==="low"?r:"med"}function le(e,t,s,r,a){let l=a.servePaths??new Map,x=e.byLabel(E.USECASE).filter(({cid:o})=>O(e,o)),u=new Map(x.map(o=>[o.cid,o])),m=new Map(x.map(({cid:o})=>[o,[]])),h=[];for(let o of t){if(o.stage!=="design")continue;let i={...o,...ce(e,o.ref)},k=xe(e,o.ref),_=k?m.get(k):void 0;_&&L(o)!=="other"?_.push(i):h.push(i)}let R=new Map(x.map(({cid:o})=>[o,{total:0,designed:0}]));for(let{cid:o}of e.byLabel(E.AC)){if(!O(e,o))continue;let i=C(e,o),k=i?R.get(i):void 0;if(!k)continue;k.total++;let _=F(e,o);if(_&&k.designed++,!r)continue;let v=e.nameOf.get(o)??o,f=r.perAc[v];if(!f)continue;let{id:p,title:y}=ce(e,v),c={ref:e.displayNameOf(o)??o,id:p,title:y,risk:ke(e,v),stage:"cover"},n=m.get(i);f.state==="failing"?n.push({...c,kind:"execution-failed",tag:"evolve",why:"covering test failed against this AC",ready_command:f.executionId&&l.has(f.executionId)?`kane-cli evidence serve ${l.get(f.executionId)}`:"kane-cli testrun run",via_tests:f.viaTests,...f.executionId?{execution_id:f.executionId}:{},...f.executionId&&l.has(f.executionId)?{servePath:l.get(f.executionId)}:{},...a.testFiles?{viaFiles:f.viaTests.map(d=>a.testFiles.get(d)??null)}:{}}):f.state==="blocked"?n.push({...c,kind:"execution-blocked",tag:"reuse-candidate",why:"the formula could count no run \u2014 broken/skipped or an unaccepted oracle",ready_command:f.executionId&&l.has(f.executionId)?`kane-cli evidence serve ${l.get(f.executionId)}`:"kane-cli testrun run",...f.executionId?{execution_id:f.executionId}:{},...f.executionId&&l.has(f.executionId)?{servePath:l.get(f.executionId)}:{}}):f.state==="not_run"&&_&&n.push({...c,kind:"covered-not-run",tag:"reuse-candidate",why:"a covering test exists but has not run yet",ready_command:"kane-cli testrun run"})}let g=[];for(let{cid:o,content:i}of x){let k=e.displayNameOf(o)??o,_=e.nameOf.get(o)??o,v=s.perUc[k]??{pct:0,status:"undesigned",staleAcs:0},f=r?r.perUc[_]??{pct:0,status:"not_run"}:null,p=r!==null&&(f===null||f.status==="not_run"),y=R.get(o),c=m.get(o)??[],n=new Set(c.filter(b=>L(b)==="needs-refresh").map(b=>b.ref)),d=[];for(let b of he){let w=c.filter($=>L($)===b);if(b==="needs-tests"&&(w=w.filter($=>!n.has($.ref))),w.length===0)continue;w.sort(($,T)=>(M[$.risk]??3)-(M[T.risk]??3)||D($.ref,T.ref));let S=b==="failing"||b==="blocked"||w.length<=2||new Set(w.map($=>$.ready_command)).size>1;d.push({key:b,label:ve[b],...b==="needs-refresh"?{suffix:"source moved since these were designed"}:{},rows:w,...S?{}:{rosterCommand:w[0].ready_command}})}g.push({slug:k,title:String(i.title??""),risk:String(i.risk??""),des:v,prov:f,provAbsent:p,acTotal:y.total,acDesigned:y.designed,groups:d})}return g.sort((o,i)=>(M[o.risk]??3)-(M[i.risk]??3)||D(o.slug,i.slug)),h.sort((o,i)=>(M[o.risk]??3)-(M[i.risk]??3)||D(o.ref,i.ref)),{stage:a.stage,aspect:a.aspect,top:a.top,dc:s,pa:r,ucs:g,other:h}}function N(e,t){let s=Math.round(e/100*t);return"\u2588".repeat(s)+"\u2591".repeat(t-s)}function W(e,t){return e==="all"||t.stage===e}function B(e,t){return e.length<=t?e:t<=1?e.slice(0,t):e.slice(0,t-1)+"\u2026"}var _e={failing:"failing",blocked:"blocked","needs-refresh":"stale","needs-tests":"needs test","needs-scenarios":"no scenario","happy-only":"happy only","possible-duplicate":"duplicate?","not-yet-run":"to run"},$e=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate"];function ue(e,t){let s=Date.parse(e);if(Number.isNaN(s))return e;let r=Math.max(0,Math.floor((t-s)/1e3));return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function we(e,t){return(t.get("failing")??[]).length?0:(t.get("blocked")??[]).length?1:(t.get("needs-tests")??[]).length||(t.get("needs-scenarios")??[]).length?2:(t.get("needs-refresh")??[]).length?3:(t.get("not-yet-run")??[]).length>0||e.provAbsent?4:5}function de(e,t){let s=new Map;for(let g of t.groups)g.rows.length&&s.set(g.key,g.rows);let r=new Map;for(let g of t.groups){let o=g.rows.filter(i=>W(e.stage,i));o.length&&r.set(g.key,o)}let a=[],l=[],x=[],u=new Set;for(let g of $e){let o=r.get(g);if(o){for(let i of o){let k=g==="failing"&&i.via_tests?.length?` \xB7 via ${i.via_tests.map(_=>I(_)).join(", ")}`:"";a.push({id:i.ref===t.slug?"\u2014":I(i.id??i.ref),cls:_e[g],risk:i.ref===t.slug?"\u2014":i.risk,title:(i.ref===t.slug?i.why:i.title)+k})}if(g==="failing"||g==="blocked")for(let i of o)i.servePath&&u.add(`kane-cli evidence serve ${i.servePath}`);for(let i of o)i.ready_command&&!i.ready_command.startsWith("kane-cli evidence serve")&&i.ready_command!=="kane-cli testrun run"&&u.add(i.ready_command)}}let m=[...u].sort((g,o)=>Number(o.startsWith("kane-cli evidence serve"))-Number(g.startsWith("kane-cli evidence serve")));l.push(...m.map(g=>`\u21B3 ${g}`));let h=s.get("not-yet-run")??[],R=e.pa===null?t.acDesigned:h.length;return e.pa!==null&&R>0&&x.push(`${R} to run`),{uc:t,rows:a,spans:l,tails:x,toRun:R,severity:we(t,s)}}function pe(e,t){let{dc:s,pa:r}=e,a=Math.max(80,Math.min(t.width,100)),l=n=>t.color?`\x1B[2m${n}\x1B[22m`:n,x=t.now??Date.now(),u=[],m=r?.latest_run?`last run ${ue(r.latest_run.started_at,x)}`:"no runs yet";u.push(`coverage \u2014 designed \xD7 proven \xB7 ${e.aspect} \xB7 ${m}`),u.push(""),u.push(P(`designed ${String(s.pct).padStart(3)}% ${N(s.pct,10)} ${s.acs_designed} ACs have a verifying test`,t.color)),r?u.push(P(`proven ${String(r.pct).padStart(3)}% ${N(r.pct,10)} ${r.acs_proven} \xB7 ${r.failing} failing \xB7 ${r.blocked} blocked \xB7 ${r.not_run} not yet run`,t.color)):u.push("proven \u2014 no runs recorded yet \xB7 run tests, then re-run"),u.push("");let h=e.ucs.map(n=>de(e,n));h.sort((n,d)=>n.severity-d.severity||D(n.uc.slug,d.uc.slug));let R=h.some(n=>n.rows.length||n.spans.length||n.tails.length||r!==null&&n.toRun>0),g=n=>{let[d,b]=n.split("/").map(Number);return b>0&&d===b};if(!R&&g(s.acs_designed)&&(r===null||g(r.acs_proven))){let n=e.ucs.length,d=`use-case${n===1?"":"s"}`;return u.push(r?`no gaps \u2014 all ${n} ${d} designed and proven`:`no gaps \u2014 all ${n} ${d} designed \xB7 nothing run yet`),u.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),u}let o=(n,d)=>n.groups.filter(b=>d.includes(b.key)).reduce((b,w)=>b+w.rows.length,0),i=h.map(n=>({band:n,failing:o(n.uc,["failing"]),blocked:o(n.uc,["blocked"]),stale:o(n.uc,["needs-refresh"]),design:o(n.uc,["needs-tests","needs-scenarios"]),run:n.toRun})),k=[];i.some(n=>n.failing)&&k.push({hdr:"FAILING",get:n=>n.failing}),i.some(n=>n.blocked)&&k.push({hdr:"BLOCKED",get:n=>n.blocked}),i.some(n=>n.stale)&&k.push({hdr:"STALE",get:n=>n.stale}),i.some(n=>n.design)&&k.push({hdr:"TO DESIGN",get:n=>n.design}),i.some(n=>n.run)&&k.push({hdr:"TO RUN",get:n=>n.run}),a<100&&(k.length=0);let _=Math.min(16,Math.max(4,...h.map(n=>I(n.uc.slug).length))),v=15,f=k.map(n=>n.hdr.length+2),p=a-_-2-3-v-3-v-f.reduce((n,d)=>n+d,0)-2,y=n=>n.padStart(Math.floor((v+n.length)/2)).padEnd(v),c=`${" ".repeat(_+2)}${"USE CASE".padEnd(p+3)}${y("DESIGNED")} ${y("PROVEN")}`+k.map((n,d)=>n.hdr.padStart(f[d])).join("");u.push(l(c.trimEnd().slice(0,a)));for(let n of i){let d=n.band.uc,b=`${String(d.des.pct).padStart(3)}% ${N(d.des.pct,10)}`,w=r===null||d.provAbsent?Te("no runs",v,t.color):`${String(d.prov?.pct??0).padStart(3)}% ${N(d.prov?.pct??0,10)}`,S=k.map((T,j)=>String(T.get(n)||"\u2014").padStart(f[j])).join(""),$=`${B(I(d.slug),_).padEnd(_)} ${B(d.title,p).padEnd(p)} ${b} ${w}${S}`;u.push(P($,t.color))}return u.push(""),u.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),u}function Te(e,t,s){let r=e.padStart(Math.floor((t+e.length)/2)).padEnd(t);return s?`\x1B[2m${r}\x1B[22m`:r}function P(e,t){return t?e.replace(/(\s*\d+%) (█*)(░*)/g,(s,r,a,l)=>{let x=Number(r.trim().replace("%","")),u=x===100?"\x1B[32m":"\x1B[33m";return`${x===0?"\x1B[31m":u}${r}\x1B[39m ${u}${a}\x1B[39m\x1B[2m${l}\x1B[22m`}):e}function fe(e,t,s,r){let{pa:a}=e,l=Math.max(80,Math.min(r.width,100)),x=p=>r.color?`\x1B[2m${p}\x1B[22m`:p,u=r.now??Date.now(),m=[],h=e.ucs.find(p=>p.slug===t),R=a?.latest_run?`last run ${ue(a.latest_run.started_at,u)}`:"no runs yet";m.push(`${I(t)} \xB7 ${h?.title??""} \u2014 risk ${h?.risk??"\u2014"} \xB7 ${e.aspect} \xB7 ${R}`.slice(0,l)),m.push("");let g=h?de(e,h):null;if(h&&g){m.push(P(`designed ${String(h.des.pct).padStart(3)}% ${N(h.des.pct,10)} ${h.acDesigned}/${h.acTotal} ACs have a verifying test`,r.color));let p=g.tails.length?` \xB7 ${g.tails.join(" \xB7 ")}`:"";a===null||h.provAbsent?m.push(`proven \u2014 no runs yet${p}`):m.push(P(`proven ${String(h.prov?.pct??0).padStart(3)}% ${N(h.prov?.pct??0,10)} ${p.replace(/^ · /,"")}`,r.color)),m.push("")}let o=Math.min(16,Math.max(5,...s.map(p=>I(p.id).length))),i=10,k=5,_=l-o-2-i-2-k-2;m.push(x(`${" ".repeat(o+2)}${"STATE".padEnd(i+2)}${"RISK".padEnd(k+2)}ACCEPTANCE CRITERION`));let v=p=>{if(!r.color)return p;let y=p.trim(),c=y.startsWith("proven")?"\x1B[32m":y==="failing"||y==="needs test"?"\x1B[31m":y==="blocked"||y==="stale"?"\x1B[33m":"\x1B[2m",n=c==="\x1B[2m"?"\x1B[22m":"\x1B[39m";return p.replace(y,`${c}${y}${n}`)};for(let p of s){let c=(p.text+(p.via?` \xB7 via ${p.via}`:"")).split(/\s+/),n=[],d="";for(let b of c)d&&d.length+1+b.length>_?(n.push(d),d=b):d=d?`${d} ${b}`:b;d&&n.push(d),n.forEach((b,w)=>{w===0?m.push(`${B(I(p.id),o).padEnd(o)} ${v(p.state.padEnd(i))} ${p.risk.padEnd(k)} ${b}`):m.push(`${" ".repeat(o+2+i+2+k+2)}${b}`)})}let f=[];if(h&&g){for(let y of g.spans){let c=y.replace(/^↳ /,"");if(c.startsWith("kane-cli evidence serve")){let n=s.filter(d=>d.state==="blocked"||d.state==="failing").map(d=>I(d.id)).join(" \xB7 ");f.push({label:"see why",cmd:c,...n?{note:`(explains ${n})`}:{}})}else f.push({label:"design",cmd:c})}let p=s.filter(y=>y.state==="to run").length;if(p>0){let c=s.some(n=>n.state==="failing")?"(review evidence first \u2014 a re-run may heal over failures)":f.some(n=>n.label==="see why")?`(${p} ACs never executed \u2014 see why first)`:`(${p} ACs never executed)`;f.push({label:"first run",cmd:"kane-cli testrun run",note:c})}}if(f.length){m.push(""),m.push("next");let p=Math.max(...f.map(c=>c.label.length))+2,y=c=>r.color?`\x1B[36m${c}\x1B[39m`:c;for(let c of f){let n=` ${c.label.padEnd(p)}`;if(n.length+c.cmd.length>l){let d=c.cmd.lastIndexOf(" ",l-n.length),b=d>0?c.cmd.slice(0,d):c.cmd.slice(0,l-n.length),w=d>0?c.cmd.slice(d+1):c.cmd.slice(l-n.length);m.push(`${n}${y(b)}`),m.push(`${" ".repeat(n.length)}${y(w)}`),c.note&&m.push(x(`${" ".repeat(n.length)}${c.note}`))}else c.note&&n.length+c.cmd.length+3+c.note.length<=l?m.push(`${n}${y(c.cmd)} ${x(c.note)}`):(m.push(`${n}${y(c.cmd)}`),c.note&&m.push(x(`${" ".repeat(n.length)}${c.note}`)))}}return m.push(""),m.push(x("all use-cases: kane-cli cover gaps")),m}function K(e){let{dc:t,pa:s}=e,r=a=>e.top!==void 0?a.slice(0,e.top):a;return{stage:e.stage,rollup_version:1,design_completeness:{pct:t.pct,acs_designed:t.acs_designed,usecases_complete:t.usecases_complete,ucs_needing_scenarios:t.ucs_needing_scenarios,config:t.config},...s?{proven:{aspect:s.aspect,pct:s.pct,acs_proven:s.acs_proven,failing:s.failing,blocked:s.blocked,not_run:s.not_run,latest_run:s.latest_run,config:s.config}}:{},usecases:e.ucs.map(a=>({id:/^sha256:/.test(a.slug)?null:a.slug,title:a.title,risk:a.risk,design_completeness:{pct:a.des.pct,status:a.des.status},stale_acs:a.des.staleAcs,...s?{proven:a.prov??{pct:0,status:"not_run"}}:{},pending:r(a.groups.flatMap(l=>l.rows).filter(l=>W(e.stage,l))).map(ae)})),other:e.other.filter(a=>W(e.stage,a)).map(ae)}}function ae(e){let{servePath:t,viaFiles:s,meta:r,...a}=e;return{...a}}async function Re(e,t,s=oe(),r=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return G(s,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:_,agentRefusal:v}=await import("./headless-io-3A3BZVQ5.js"),{parsesAgainstGrammar:f}=await import("./next-TRSKMBO5.js"),p=_("ndjson","gaps",{stdout:T=>s.out(T.replace(/\n$/,"")),stderr:T=>(s.err??s.out)(T.replace(/\n$/,""))}),y=[],c=[],n={out:T=>y.push(T),err:T=>c.push(T),confirm:async()=>!1,isTTY:!1};if(await Re(e,{...t,json:!0,mode:void 0},n,r)!==0)return v(p,c.join("; ")||"cover gaps refused");let b=JSON.parse(y.join(`
2
+ import{P as G,Q as re,S as oe,o as ne,p as se}from"./chunk-QX5LJVTD.js";import"./chunk-WWVHK7OA.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import{a as H,b as q,c as Q,d as X,e as Z,f as ee,g as te}from"./chunk-AACQE24F.js";import{f as V}from"./chunk-5GUD3CIH.js";import{a as O,b as F,c as C,d as z}from"./chunk-WESMQEPO.js";import"./chunk-EHN5HTUD.js";import"./chunk-IPQAKIJO.js";import"./chunk-VVOKM2VO.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{z as Y}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import{f as E,g as U}from"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-UQ6A52ML.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";function me(e,t){return e.length===0?"not_run":Q(e,t).verified?"proven":q(e,t).some(r=>r.verdict==="failed")?"failing":"blocked"}function ie(e,t){let s=null;for(let{cid:g}of e.byLabel(E.TEST))for(let o of e.execHistory(g))(!s||String(o.started_at)>s.started_at)&&(s={execution_id:String(o.execution_id),started_at:String(o.started_at)});if(!s)return null;let r=H[t],a=te(e),l=X(a).aspects[t],x={},u={},m=0,h=0,R=0;for(let g of a.usecases){let o=[];for(let v of g.acceptance_criteria){let f=v.executions??[],p=me(f,r);o.push(p),p==="failing"?m++:p==="blocked"?h++:p==="not_run"&&R++;let y=[],c;if(p==="failing"){let n=null,d=e.resolve(v.id)?.cid;for(let b of v.covered_by){let w=e.execHistory(b).map($=>({verdict:String(ee(e,$.per_ac,d,v.id)??$.verdict),oracle_mode:String($.oracle_mode),ts:String($.started_at),execution_id:String($.execution_id)})).filter($=>r.counted_verdicts.includes($.verdict)&&r.accepted_oracle_modes.includes($.oracle_mode)),S=w[w.length-1];S?.verdict==="failed"&&(y.push(b),(!n||S.ts>n.ts)&&(n={ts:S.ts,execution_id:S.execution_id}))}c=n?.execution_id}else p==="blocked"&&(c=f[f.length-1]?.execution_id);x[v.id]={state:p,viaTests:y,...c?{executionId:c}:{}}}let i=o.some(v=>v!=="not_run"),k=l.usecases[g.id],_=i?k.status==="covered"?"proven":k.status==="partial"?"partial":o.includes("failing")?"failing":o.includes("blocked")?"blocked":"not_run":"not_run";u[g.id]={pct:k.pct,status:_}}return{aspect:t,pct:l.summary.coverage_pct,acs_proven:l.summary.acs_verified,failing:m,blocked:h,not_run:R,latest_run:s,perUc:u,perAc:x,config:{...r,source:"graph_execution_facts",denominator:"current_live_acs"}}}var he=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],ve={failing:"failing",blocked:"blocked","needs-refresh":"needs refresh","needs-tests":"needs tests","needs-scenarios":"needs scenarios","happy-only":"happy path only","possible-duplicate":"possible duplicate","not-yet-run":"not yet run"},M={high:0,med:1,low:2};function D(e,t){let s=/^(.*?)(\d+)$/.exec(e),r=/^(.*?)(\d+)$/.exec(t);return s&&r&&s[1]===r[1]?Number(s[2])-Number(r[2]):e<t?-1:e>t?1:0}function I(e){if(!e||/^sha256:/.test(e))return"(unnamed)";let t=/^(uc|ac|sc|t)-(\d+)$/.exec(e);return t?`${t[1].toUpperCase()}-${t[2]}`:e}function be(e,t=5){let s=e.trim().split(/\s+/);return s.slice(0,t).join(" ")+(s.length>t?"\u2026":"")}function ye(e,t){let s=e.resolve(t),r=s?e.getNode(e.tipOf(s.cid))?.content:null;return String(r?.title??r?.text??"")}function ce(e,t){let s=e.resolve(t);return{id:s?e.displayNameOf(e.tipOf(s.cid))??e.displayNameOf(s.cid):null,title:be(ye(e,t),8)}}function xe(e,t){let s=e.resolve(t);if(!s)return null;let r=e.tipOf(s.cid);if(!O(e,r))return null;let a=e.nodeLabel.get(r);if(a===E.USECASE)return r;if(a===E.AC)return C(e,r);if(a===E.TEST){let l=e.edgesFrom(r).find(u=>u.type===U.VERIFIES&&O(e,u.dst));if(l)return C(e,l.dst);let x=e.edgesFrom(r).find(u=>u.type===U.AUTOMATES&&O(e,u.dst));if(x){let u=e.edgesFrom(x.dst).find(m=>m.type===U.BELONGS_TO&&O(e,m.dst));return u?u.dst:null}}return null}function L(e){if(e.tag==="reuse-candidate"&&e.stage==="design")return"possible-duplicate";switch(e.kind){case"no-verifies":return"needs-tests";case"zero-scenario":return"needs-scenarios";case"happy-only":return"happy-only";case"stale-ac":case"stale-test":return"needs-refresh";case"execution-failed":return"failing";case"execution-blocked":return"blocked";case"covered-not-run":return"not-yet-run";default:return"other"}}function ke(e,t){let s=e.resolve(t),r=s?e.getNode(e.tipOf(s.cid))?.content.risk:null;return r==="high"||r==="med"||r==="low"?r:"med"}function le(e,t,s,r,a){let l=a.servePaths??new Map,x=e.byLabel(E.USECASE).filter(({cid:o})=>O(e,o)),u=new Map(x.map(o=>[o.cid,o])),m=new Map(x.map(({cid:o})=>[o,[]])),h=[];for(let o of t){if(o.stage!=="design")continue;let i={...o,...ce(e,o.ref)},k=xe(e,o.ref),_=k?m.get(k):void 0;_&&L(o)!=="other"?_.push(i):h.push(i)}let R=new Map(x.map(({cid:o})=>[o,{total:0,designed:0}]));for(let{cid:o}of e.byLabel(E.AC)){if(!O(e,o))continue;let i=C(e,o),k=i?R.get(i):void 0;if(!k)continue;k.total++;let _=F(e,o);if(_&&k.designed++,!r)continue;let v=e.nameOf.get(o)??o,f=r.perAc[v];if(!f)continue;let{id:p,title:y}=ce(e,v),c={ref:e.displayNameOf(o)??o,id:p,title:y,risk:ke(e,v),stage:"cover"},n=m.get(i);f.state==="failing"?n.push({...c,kind:"execution-failed",tag:"evolve",why:"covering test failed against this AC",ready_command:f.executionId&&l.has(f.executionId)?`kane-cli evidence serve ${l.get(f.executionId)}`:"kane-cli testrun run",via_tests:f.viaTests,...f.executionId?{execution_id:f.executionId}:{},...f.executionId&&l.has(f.executionId)?{servePath:l.get(f.executionId)}:{},...a.testFiles?{viaFiles:f.viaTests.map(d=>a.testFiles.get(d)??null)}:{}}):f.state==="blocked"?n.push({...c,kind:"execution-blocked",tag:"reuse-candidate",why:"the formula could count no run \u2014 broken/skipped or an unaccepted oracle",ready_command:f.executionId&&l.has(f.executionId)?`kane-cli evidence serve ${l.get(f.executionId)}`:"kane-cli testrun run",...f.executionId?{execution_id:f.executionId}:{},...f.executionId&&l.has(f.executionId)?{servePath:l.get(f.executionId)}:{}}):f.state==="not_run"&&_&&n.push({...c,kind:"covered-not-run",tag:"reuse-candidate",why:"a covering test exists but has not run yet",ready_command:"kane-cli testrun run"})}let g=[];for(let{cid:o,content:i}of x){let k=e.displayNameOf(o)??o,_=e.nameOf.get(o)??o,v=s.perUc[k]??{pct:0,status:"undesigned",staleAcs:0},f=r?r.perUc[_]??{pct:0,status:"not_run"}:null,p=r!==null&&(f===null||f.status==="not_run"),y=R.get(o),c=m.get(o)??[],n=new Set(c.filter(b=>L(b)==="needs-refresh").map(b=>b.ref)),d=[];for(let b of he){let w=c.filter($=>L($)===b);if(b==="needs-tests"&&(w=w.filter($=>!n.has($.ref))),w.length===0)continue;w.sort(($,T)=>(M[$.risk]??3)-(M[T.risk]??3)||D($.ref,T.ref));let S=b==="failing"||b==="blocked"||w.length<=2||new Set(w.map($=>$.ready_command)).size>1;d.push({key:b,label:ve[b],...b==="needs-refresh"?{suffix:"source moved since these were designed"}:{},rows:w,...S?{}:{rosterCommand:w[0].ready_command}})}g.push({slug:k,title:String(i.title??""),risk:String(i.risk??""),des:v,prov:f,provAbsent:p,acTotal:y.total,acDesigned:y.designed,groups:d})}return g.sort((o,i)=>(M[o.risk]??3)-(M[i.risk]??3)||D(o.slug,i.slug)),h.sort((o,i)=>(M[o.risk]??3)-(M[i.risk]??3)||D(o.ref,i.ref)),{stage:a.stage,aspect:a.aspect,top:a.top,dc:s,pa:r,ucs:g,other:h}}function N(e,t){let s=Math.round(e/100*t);return"\u2588".repeat(s)+"\u2591".repeat(t-s)}function W(e,t){return e==="all"||t.stage===e}function B(e,t){return e.length<=t?e:t<=1?e.slice(0,t):e.slice(0,t-1)+"\u2026"}var _e={failing:"failing",blocked:"blocked","needs-refresh":"stale","needs-tests":"needs test","needs-scenarios":"no scenario","happy-only":"happy only","possible-duplicate":"duplicate?","not-yet-run":"to run"},$e=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate"];function ue(e,t){let s=Date.parse(e);if(Number.isNaN(s))return e;let r=Math.max(0,Math.floor((t-s)/1e3));return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function we(e,t){return(t.get("failing")??[]).length?0:(t.get("blocked")??[]).length?1:(t.get("needs-tests")??[]).length||(t.get("needs-scenarios")??[]).length?2:(t.get("needs-refresh")??[]).length?3:(t.get("not-yet-run")??[]).length>0||e.provAbsent?4:5}function de(e,t){let s=new Map;for(let g of t.groups)g.rows.length&&s.set(g.key,g.rows);let r=new Map;for(let g of t.groups){let o=g.rows.filter(i=>W(e.stage,i));o.length&&r.set(g.key,o)}let a=[],l=[],x=[],u=new Set;for(let g of $e){let o=r.get(g);if(o){for(let i of o){let k=g==="failing"&&i.via_tests?.length?` \xB7 via ${i.via_tests.map(_=>I(_)).join(", ")}`:"";a.push({id:i.ref===t.slug?"\u2014":I(i.id??i.ref),cls:_e[g],risk:i.ref===t.slug?"\u2014":i.risk,title:(i.ref===t.slug?i.why:i.title)+k})}if(g==="failing"||g==="blocked")for(let i of o)i.servePath&&u.add(`kane-cli evidence serve ${i.servePath}`);for(let i of o)i.ready_command&&!i.ready_command.startsWith("kane-cli evidence serve")&&i.ready_command!=="kane-cli testrun run"&&u.add(i.ready_command)}}let m=[...u].sort((g,o)=>Number(o.startsWith("kane-cli evidence serve"))-Number(g.startsWith("kane-cli evidence serve")));l.push(...m.map(g=>`\u21B3 ${g}`));let h=s.get("not-yet-run")??[],R=e.pa===null?t.acDesigned:h.length;return e.pa!==null&&R>0&&x.push(`${R} to run`),{uc:t,rows:a,spans:l,tails:x,toRun:R,severity:we(t,s)}}function pe(e,t){let{dc:s,pa:r}=e,a=Math.max(80,Math.min(t.width,100)),l=n=>t.color?`\x1B[2m${n}\x1B[22m`:n,x=t.now??Date.now(),u=[],m=r?.latest_run?`last run ${ue(r.latest_run.started_at,x)}`:"no runs yet";u.push(`coverage \u2014 designed \xD7 proven \xB7 ${e.aspect} \xB7 ${m}`),u.push(""),u.push(P(`designed ${String(s.pct).padStart(3)}% ${N(s.pct,10)} ${s.acs_designed} ACs have a verifying test`,t.color)),r?u.push(P(`proven ${String(r.pct).padStart(3)}% ${N(r.pct,10)} ${r.acs_proven} \xB7 ${r.failing} failing \xB7 ${r.blocked} blocked \xB7 ${r.not_run} not yet run`,t.color)):u.push("proven \u2014 no runs recorded yet \xB7 run tests, then re-run"),u.push("");let h=e.ucs.map(n=>de(e,n));h.sort((n,d)=>n.severity-d.severity||D(n.uc.slug,d.uc.slug));let R=h.some(n=>n.rows.length||n.spans.length||n.tails.length||r!==null&&n.toRun>0),g=n=>{let[d,b]=n.split("/").map(Number);return b>0&&d===b};if(!R&&g(s.acs_designed)&&(r===null||g(r.acs_proven))){let n=e.ucs.length,d=`use-case${n===1?"":"s"}`;return u.push(r?`no gaps \u2014 all ${n} ${d} designed and proven`:`no gaps \u2014 all ${n} ${d} designed \xB7 nothing run yet`),u.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),u}let o=(n,d)=>n.groups.filter(b=>d.includes(b.key)).reduce((b,w)=>b+w.rows.length,0),i=h.map(n=>({band:n,failing:o(n.uc,["failing"]),blocked:o(n.uc,["blocked"]),stale:o(n.uc,["needs-refresh"]),design:o(n.uc,["needs-tests","needs-scenarios"]),run:n.toRun})),k=[];i.some(n=>n.failing)&&k.push({hdr:"FAILING",get:n=>n.failing}),i.some(n=>n.blocked)&&k.push({hdr:"BLOCKED",get:n=>n.blocked}),i.some(n=>n.stale)&&k.push({hdr:"STALE",get:n=>n.stale}),i.some(n=>n.design)&&k.push({hdr:"TO DESIGN",get:n=>n.design}),i.some(n=>n.run)&&k.push({hdr:"TO RUN",get:n=>n.run}),a<100&&(k.length=0);let _=Math.min(16,Math.max(4,...h.map(n=>I(n.uc.slug).length))),v=15,f=k.map(n=>n.hdr.length+2),p=a-_-2-3-v-3-v-f.reduce((n,d)=>n+d,0)-2,y=n=>n.padStart(Math.floor((v+n.length)/2)).padEnd(v),c=`${" ".repeat(_+2)}${"USE CASE".padEnd(p+3)}${y("DESIGNED")} ${y("PROVEN")}`+k.map((n,d)=>n.hdr.padStart(f[d])).join("");u.push(l(c.trimEnd().slice(0,a)));for(let n of i){let d=n.band.uc,b=`${String(d.des.pct).padStart(3)}% ${N(d.des.pct,10)}`,w=r===null||d.provAbsent?Te("no runs",v,t.color):`${String(d.prov?.pct??0).padStart(3)}% ${N(d.prov?.pct??0,10)}`,S=k.map((T,j)=>String(T.get(n)||"\u2014").padStart(f[j])).join(""),$=`${B(I(d.slug),_).padEnd(_)} ${B(d.title,p).padEnd(p)} ${b} ${w}${S}`;u.push(P($,t.color))}return u.push(""),u.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),u}function Te(e,t,s){let r=e.padStart(Math.floor((t+e.length)/2)).padEnd(t);return s?`\x1B[2m${r}\x1B[22m`:r}function P(e,t){return t?e.replace(/(\s*\d+%) (█*)(░*)/g,(s,r,a,l)=>{let x=Number(r.trim().replace("%","")),u=x===100?"\x1B[32m":"\x1B[33m";return`${x===0?"\x1B[31m":u}${r}\x1B[39m ${u}${a}\x1B[39m\x1B[2m${l}\x1B[22m`}):e}function fe(e,t,s,r){let{pa:a}=e,l=Math.max(80,Math.min(r.width,100)),x=p=>r.color?`\x1B[2m${p}\x1B[22m`:p,u=r.now??Date.now(),m=[],h=e.ucs.find(p=>p.slug===t),R=a?.latest_run?`last run ${ue(a.latest_run.started_at,u)}`:"no runs yet";m.push(`${I(t)} \xB7 ${h?.title??""} \u2014 risk ${h?.risk??"\u2014"} \xB7 ${e.aspect} \xB7 ${R}`.slice(0,l)),m.push("");let g=h?de(e,h):null;if(h&&g){m.push(P(`designed ${String(h.des.pct).padStart(3)}% ${N(h.des.pct,10)} ${h.acDesigned}/${h.acTotal} ACs have a verifying test`,r.color));let p=g.tails.length?` \xB7 ${g.tails.join(" \xB7 ")}`:"";a===null||h.provAbsent?m.push(`proven \u2014 no runs yet${p}`):m.push(P(`proven ${String(h.prov?.pct??0).padStart(3)}% ${N(h.prov?.pct??0,10)} ${p.replace(/^ · /,"")}`,r.color)),m.push("")}let o=Math.min(16,Math.max(5,...s.map(p=>I(p.id).length))),i=10,k=5,_=l-o-2-i-2-k-2;m.push(x(`${" ".repeat(o+2)}${"STATE".padEnd(i+2)}${"RISK".padEnd(k+2)}ACCEPTANCE CRITERION`));let v=p=>{if(!r.color)return p;let y=p.trim(),c=y.startsWith("proven")?"\x1B[32m":y==="failing"||y==="needs test"?"\x1B[31m":y==="blocked"||y==="stale"?"\x1B[33m":"\x1B[2m",n=c==="\x1B[2m"?"\x1B[22m":"\x1B[39m";return p.replace(y,`${c}${y}${n}`)};for(let p of s){let c=(p.text+(p.via?` \xB7 via ${p.via}`:"")).split(/\s+/),n=[],d="";for(let b of c)d&&d.length+1+b.length>_?(n.push(d),d=b):d=d?`${d} ${b}`:b;d&&n.push(d),n.forEach((b,w)=>{w===0?m.push(`${B(I(p.id),o).padEnd(o)} ${v(p.state.padEnd(i))} ${p.risk.padEnd(k)} ${b}`):m.push(`${" ".repeat(o+2+i+2+k+2)}${b}`)})}let f=[];if(h&&g){for(let y of g.spans){let c=y.replace(/^↳ /,"");if(c.startsWith("kane-cli evidence serve")){let n=s.filter(d=>d.state==="blocked"||d.state==="failing").map(d=>I(d.id)).join(" \xB7 ");f.push({label:"see why",cmd:c,...n?{note:`(explains ${n})`}:{}})}else f.push({label:"design",cmd:c})}let p=s.filter(y=>y.state==="to run").length;if(p>0){let c=s.some(n=>n.state==="failing")?"(review evidence first \u2014 a re-run may heal over failures)":f.some(n=>n.label==="see why")?`(${p} ACs never executed \u2014 see why first)`:`(${p} ACs never executed)`;f.push({label:"first run",cmd:"kane-cli testrun run",note:c})}}if(f.length){m.push(""),m.push("next");let p=Math.max(...f.map(c=>c.label.length))+2,y=c=>r.color?`\x1B[36m${c}\x1B[39m`:c;for(let c of f){let n=` ${c.label.padEnd(p)}`;if(n.length+c.cmd.length>l){let d=c.cmd.lastIndexOf(" ",l-n.length),b=d>0?c.cmd.slice(0,d):c.cmd.slice(0,l-n.length),w=d>0?c.cmd.slice(d+1):c.cmd.slice(l-n.length);m.push(`${n}${y(b)}`),m.push(`${" ".repeat(n.length)}${y(w)}`),c.note&&m.push(x(`${" ".repeat(n.length)}${c.note}`))}else c.note&&n.length+c.cmd.length+3+c.note.length<=l?m.push(`${n}${y(c.cmd)} ${x(c.note)}`):(m.push(`${n}${y(c.cmd)}`),c.note&&m.push(x(`${" ".repeat(n.length)}${c.note}`)))}}return m.push(""),m.push(x("all use-cases: kane-cli cover gaps")),m}function K(e){let{dc:t,pa:s}=e,r=a=>e.top!==void 0?a.slice(0,e.top):a;return{stage:e.stage,rollup_version:1,design_completeness:{pct:t.pct,acs_designed:t.acs_designed,usecases_complete:t.usecases_complete,ucs_needing_scenarios:t.ucs_needing_scenarios,config:t.config},...s?{proven:{aspect:s.aspect,pct:s.pct,acs_proven:s.acs_proven,failing:s.failing,blocked:s.blocked,not_run:s.not_run,latest_run:s.latest_run,config:s.config}}:{},usecases:e.ucs.map(a=>({id:/^sha256:/.test(a.slug)?null:a.slug,title:a.title,risk:a.risk,design_completeness:{pct:a.des.pct,status:a.des.status},stale_acs:a.des.staleAcs,...s?{proven:a.prov??{pct:0,status:"not_run"}}:{},pending:r(a.groups.flatMap(l=>l.rows).filter(l=>W(e.stage,l))).map(ae)})),other:e.other.filter(a=>W(e.stage,a)).map(ae)}}function ae(e){let{servePath:t,viaFiles:s,meta:r,...a}=e;return{...a}}async function Re(e,t,s=oe(),r=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return G(s,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:_,agentRefusal:v}=await import("./headless-io-3A3BZVQ5.js"),{parsesAgainstGrammar:f}=await import("./next-TRSKMBO5.js"),p=_("ndjson","gaps",{stdout:T=>s.out(T.replace(/\n$/,"")),stderr:T=>(s.err??s.out)(T.replace(/\n$/,""))}),y=[],c=[],n={out:T=>y.push(T),err:T=>c.push(T),confirm:async()=>!1,isTTY:!1};if(await Re(e,{...t,json:!0,mode:void 0},n,r)!==0)return v(p,c.join("; ")||"cover gaps refused");let b=JSON.parse(y.join(`
3
3
  `));p.event({type:"gaps",...b});let w=[],S=new Set,$=(T,j)=>{if(Array.isArray(T)){for(let A of T)$(A,j);return}if(T&&typeof T=="object"){let A=T,J=typeof A.why=="string"?A.why:j;typeof A.ready_command=="string"&&A.ready_command.startsWith("kane-cli ")&&f(A.ready_command)&&!S.has(A.ready_command)&&(S.add(A.ready_command),w.push({cmd:A.ready_command,why:J||"close the gap"}));for(let ge of Object.values(A))$(ge,J)}};return $(b,"close the gap"),p.done(0,void 0,w.slice(0,4))}let a=t.stage??"all";if(a!=="design"&&a!=="cover"&&a!=="all")return G(s,`--stage must be design | cover | all, got '${a}'`),2;if(t.top!==void 0&&(!Number.isInteger(t.top)||t.top<1))return G(s,"--top must be a positive integer"),2;let l=t.rollup??"lenient";if(l!=="lenient"&&l!=="strict")return G(s,`--rollup must be lenient | strict, got '${l}'`),2;let x=re(r,s);if(!x)return 2;let u=Y(x),m=Z(u),h=ie(u,l),R=await z(u,"design"),g=new Map;if(h)for(let _ of Object.values(h.perAc)){if(!_.executionId||g.has(_.executionId))continue;let v=await V(_.executionId,r);v&&g.set(_.executionId,Se(v,r))}let o=new Map;for(let[_,v]of se(ne(r)))v.length===1&&o.set(_,v[0].split("/").pop());let i=le(u,R,m,h,{stage:a,top:t.top,aspect:l,servePaths:g,testFiles:o});if(e!==void 0){let _=u.resolve(e),v=_?u.tipOf(_.cid):null;if(!v||u.nodeLabel.get(v)!==E.USECASE||!O(u,v))return G(s,`no use-case '${e}' in the graph`),2;let f=u.displayNameOf(v)??v;if(t.json){let c=K(i);return s.out(JSON.stringify({...c,usecases:c.usecases.filter(n=>n.id===f),other:[]},null,2)),0}let p=Ae(u,v,h,o),y=s.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let c of fe(i,f,p,{width:y,color:s.isTTY}))s.out(c);return 0}if(t.json)return s.out(JSON.stringify(K(i),null,2)),0;if(m.usecases_complete==="0/0")return s.out("nothing to measure yet \u2014 no live use-cases in the graph"),0;let k=s.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let _ of pe(i,{width:k,color:s.isTTY}))s.out(_);return 0}function Se(e,t){let s=t.endsWith("/")?t:t+"/";return e.startsWith(s)?e.slice(s.length):e}function Ae(e,t,s,r){let a=[];for(let{cid:l,content:x}of e.byLabel(E.AC)){if(!O(e,l)||C(e,l)!==t)continue;let u=F(e,l),m=e.nameOf.get(l)??l,h=s?.perAc[m],R=e.stale(l)!=="fresh",g=u?h?.state==="proven"?"proven \u2713":h?.state==="failing"?"failing":h?.state==="blocked"?"blocked":R?"stale":"to run":"needs test",o=h?.state==="failing"&&h.viaTests.length?h.viaTests.map(i=>`${I(i)}${r.get(i)?` ${r.get(i)}`:""}`).join(", "):void 0;a.push({id:e.displayNameOf(l)??l,state:g,risk:String(x.risk??""),text:String(x.text??x.title??""),...o?{via:o}:{}})}return a.sort((l,x)=>D(l.id,x.id)),a}export{Re as gapsCommand};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p as F,r as z,s as C,t as _,u as O,v as K}from"./chunk-UQNRUAES.js";import{d as J}from"./chunk-2LKNUXRN.js";import{b as k}from"./chunk-IZ3PYWUL.js";import{e as x}from"./chunk-ZRRBZUDJ.js";import"./chunk-JQ64X2TO.js";import"./chunk-VZ7KXRXB.js";import"./chunk-RGJIGNB3.js";import"./chunk-TDPWFYTJ.js";import{a as A}from"./chunk-5HDM7GDO.js";import"./chunk-EIMHIZKF.js";import{h as H}from"./chunk-IHUF6UP4.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-3YBT4UGQ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-TMOSERKN.js";import"./chunk-MSGW4JDG.js";import{n as E,o as q}from"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-MDM2LJFN.js";import"./chunk-IHD2WXKT.js";import{a as R}from"./chunk-VIYV6NIW.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import{a as j}from"./chunk-JWOPRJIO.js";import"./chunk-PHR2OSWD.js";import"./chunk-UR6MHSHU.js";import{join as se}from"path";async function V(t){let e=t.projectId,n=t.folderId,r=null;if(!e&&t.autoResolve){let l=await t.resolver.resolve();if(!l)throw new $("unauthorized; run `kane-cli login`");let u=await H({creds:t.autoResolve.creds,config:t.autoResolve.config,profile:t.autoResolve.profile,env:t.autoResolve.envName,tmsCreds:{username:l.username,access_key:l.access_key},isLocal:!1,log:t.log});u.status==="ok"&&(e=u.projectId,n=n??u.folderId,u.autoDefaulted&&(r={projectId:u.autoDefaulted.projectId,projectName:u.autoDefaulted.projectName,folderId:u.autoDefaulted.folderId,folderName:u.autoDefaulted.folderName}))}return{baseUrl:`${t.env.testGeneratorBaseUrl}/test-generator/api/v2`,tmsBaseUrl:t.env.tmsBaseUrl,authResolver:t.resolver,projectId:e,folderId:n,suiteName:t.suiteName,autoDefaulted:r,log:t.log}}function Z(t){return t.reduce((e,n)=>e+(n.test_cases?.length??0),0)}var y=class{constructor(e=n=>process.stdout.write(n)){this.write=e}emit(e){this.write(JSON.stringify(e)+`
2
+ import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p as F,r as z,s as C,t as _,u as O,v as K}from"./chunk-4B3EHSTD.js";import{d as J}from"./chunk-WQV5SM5P.js";import{b as k}from"./chunk-EW3KRQGF.js";import{e as x}from"./chunk-NYP7QV54.js";import"./chunk-JQ64X2TO.js";import"./chunk-VZ7KXRXB.js";import"./chunk-7PLIZBXB.js";import"./chunk-TDPWFYTJ.js";import{a as A}from"./chunk-GESZSIB6.js";import"./chunk-SYKS57PK.js";import{h as H}from"./chunk-IQCW5SV5.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-4JRCAHHB.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-UUS5AK6L.js";import"./chunk-MSGW4JDG.js";import{n as E,o as q}from"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-LHU6TEKD.js";import"./chunk-WAZUOA3Y.js";import{a as R}from"./chunk-RBVLIMOV.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import{a as j}from"./chunk-47FQ7ZUQ.js";import"./chunk-UQ6A52ML.js";import"./chunk-UR6MHSHU.js";import{join as se}from"path";async function V(t){let e=t.projectId,n=t.folderId,r=null;if(!e&&t.autoResolve){let l=await t.resolver.resolve();if(!l)throw new $("unauthorized; run `kane-cli login`");let u=await H({creds:t.autoResolve.creds,config:t.autoResolve.config,profile:t.autoResolve.profile,env:t.autoResolve.envName,tmsCreds:{username:l.username,access_key:l.access_key},isLocal:!1,log:t.log});u.status==="ok"&&(e=u.projectId,n=n??u.folderId,u.autoDefaulted&&(r={projectId:u.autoDefaulted.projectId,projectName:u.autoDefaulted.projectName,folderId:u.autoDefaulted.folderId,folderName:u.autoDefaulted.folderName}))}return{baseUrl:`${t.env.testGeneratorBaseUrl}/test-generator/api/v2`,tmsBaseUrl:t.env.tmsBaseUrl,authResolver:t.resolver,projectId:e,folderId:n,suiteName:t.suiteName,autoDefaulted:r,log:t.log}}function Z(t){return t.reduce((e,n)=>e+(n.test_cases?.length??0),0)}var y=class{constructor(e=n=>process.stdout.write(n)){this.write=e}emit(e){this.write(JSON.stringify(e)+`
3
3
  `)}onStart(e){this.emit({type:"generate_start",request_id:e.requestId,objective_chars:e.objectiveChars,scenario_limit:e.scenarioLimit,per_scenario_limit:e.perScenarioLimit,is_refine:e.isRefine})}onUpload(e){this.emit({type:"generate_upload",file:e.file,index:e.index,total:e.total,status:e.status})}onThinking(e){this.emit({type:"generate_thinking",took_ms:e.tookMs})}onProgress(e){this.emit({type:"generate_progress",pct:e})}onSnapshot(e){this.emit({type:"generate_snapshot",scenario_count:e.scenarios.length,case_count:Z(e.scenarios),scenarios:e.scenarios})}onClarification(e){this.emit({type:"generate_clarification",text:e})}onChat(e){this.emit({type:"generate_chat",text:e})}onError(e){this.emit({type:"error",message:e})}onSaveResult(e){this.emit({type:"generate_save_result",suite_dir:e.suiteDir,saved:e.saved,fell_back:e.fellBack,...e.warning?{warning:e.warning}:{}})}onDone(e){this.emit({type:"generate_done",request_id:e.requestId,status:e.status,scenario_count:e.scenarioCount,case_count:e.caseCount,refine_hint:e.refineHint,save_hint:e.saveHint,...e.suiteDir?{suite_dir:e.suiteDir}:{}})}onUpdateAvailable(e){this.emit({type:"update_available",current:e.current,latest:e.latest,severity:e.severity})}},S=class{constructor(e=n=>process.stdout.write(n)){this.write=e}onStart(e){let n=e.isRefine?"Refining":"Generating";this.write(`${n} (request ${e.requestId})\u2026
4
4
  `)}onUpload(e){e.status==="uploading"&&this.write(` uploading ${e.file} (${e.index}/${e.total})
5
5
  `)}onThinking(e){let n=e.tookMs?` (${Math.round(e.tookMs/1e3)}s)`:"";this.write(` thinking${n}
@@ -16,6 +16,6 @@ import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p a
16
16
  `),this.write(` Save: ${e.saveHint}
17
17
  `),e.suiteDir&&this.write(` Saved: ${e.suiteDir}
18
18
  `)}onUpdateAvailable(e){this.write(`(update available: ${e.current} \u2192 ${e.latest})
19
- `)}};import{createHash as ee}from"crypto";function te(t){return ee("sha1").update(JSON.stringify({t:t.title,p:t.preconditions,m:t.manual_steps})).digest("hex")}function re(t){let e=[];for(let n of t.scenarios)for(let r of n.test_cases??[])I(r)&&r.manual_steps!=null&&e.push(r);return e}async function ne(t,e,n){let r=new Array(t.length),l=0,u=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let d=l++;if(d>=t.length)return;try{r[d]={ok:!0,value:await n(t[d])}}catch{r[d]={ok:!1}}}});return await Promise.all(u),r}async function Y(t,e,n){let r=re(t),l=n.run??(async(c,s)=>{let m=await n.resolveAuth(),o=U({objective:c,model:n.model,sessionId:n.sessionId,auth:m});return F(o,n.spawnOpts,s)}),u=r.map(te),d=[...new Set(u)],g=new Map;d.forEach(c=>{g.set(c,r[u.indexOf(c)])});let p=d.map(c=>g.get(c)),v=await ne(p,n.concurrency??3,c=>l(L(c))),i=new Map;d.forEach((c,s)=>{let m=v[s];m.ok&&i.set(c,m.value)});let f=new Map;r.forEach((c,s)=>{f.set(c.id,i.get(u[s]))});let a=0;for(let c of t.scenarios)for(let s of c.test_cases??[])I(s)&&!f.get(s.id)&&a++;let w=c=>{let s=f.get(c.id);return s?N(s,c):M(c)};return{...await B(t,e,{suiteName:n.suiteName,redirectBareCwd:!1},w),fellBack:a}}function Pe(t,e){let n=!!t.agent||!!t.refine||!!t.save||!e,r=t.agent?"agent":"plain";return{headless:n,mode:r}}function $e(t){return t.refine&&t.save?{error:"use --refine or --save, not both"}:t.save?t.objective?{error:"--save takes no objective; use --refine to add to a request"}:t.req?{op:"save"}:{error:"--save requires --req <id>"}:t.refine?t.req?t.objective?t.out?{error:"--out is only valid with --save"}:{op:"refine"}:{error:"--refine needs a refinement objective"}:{error:"--refine requires --req <id>"}:t.req?{error:"--req requires --refine or --save"}:t.out?{error:"--out is only valid with --save"}:t.objective?{op:"new"}:{error:"provide an objective, or use --refine/--save with --req"}}function ie(){return se(process.cwd(),".testmuai","tests")}function Ge(t){if(typeof t!="string")return;let e=t.split(",").map(n=>n.trim()).filter(Boolean);return e.length?e:void 0}var X="tcg-generate-headless";function Q(t){return{refineHint:`kane-cli generate "<refinement>" --refine --req ${t}`,saveHint:`kane-cli generate --save --req ${t}`}}function W(t){return t.scenarios.reduce((e,n)=>e+(n.test_cases?.length??0),0)}function oe(t){return t==="completed"?0:t==="stopped"?3:1}async function Ne(t,e){let n=e.write??(i=>process.stdout.write(i)),r=e.sink??(e.mode==="agent"?new y(n):new S(n)),l,u,d=null;try{let i=await e.makeClient();l=i.client,u=i.conn,d=i.autoDefaulted}catch(i){return r.onError(i.message),2}if(e.mode==="agent"&&d){let{buildAutoDefaultedNdjson:i}=await import("./require-project-folder-YBB5T3OE.js");n(i(d))}try{let i=await(e.checkUpdate??J)();i&&r.onUpdateAvailable(i)}catch{}let g=t.reqId??null;E(X,()=>{g&&l.cancel(g).catch(()=>{})});let p=process.cwd(),v={validate:e.validate??z,upload:e.upload??O,buildMappings:K,onUpload:i=>r.onUpload(i)};try{if(t.op==="save"){let s;try{s=(await l.attach(t.reqId)).state}catch(D){return r.onError(D.message),2}g=s.requestId,r.onSnapshot(s);let m=t.outDir??ie(),o=await e.materialize(s,m,t.suiteName);r.onSaveResult({suiteDir:o.suiteDir,saved:o.paths.length,fellBack:o.fellBack,warning:o.warning});let h=Q(s.requestId);return r.onDone({requestId:s.requestId,status:"completed",scenarioCount:s.scenarios.length,caseCount:W(s),refineHint:h.refineHint,saveHint:h.saveHint,suiteDir:o.suiteDir}),0}let i=t.op==="refine",f,a;if(i){let s;try{s=await l.attach(t.reqId)}catch(o){return r.onError(o.message),2}if(a=s.state,g=a.requestId,a.error)return r.onError(a.error),2;let m;try{m=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:a.scenarios,isRefine:!0,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of m.warnings)process.stderr.write(`warning: ${o}
19
+ `)}};import{createHash as ee}from"crypto";function te(t){return ee("sha1").update(JSON.stringify({t:t.title,p:t.preconditions,m:t.manual_steps})).digest("hex")}function re(t){let e=[];for(let n of t.scenarios)for(let r of n.test_cases??[])I(r)&&r.manual_steps!=null&&e.push(r);return e}async function ne(t,e,n){let r=new Array(t.length),l=0,u=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let d=l++;if(d>=t.length)return;try{r[d]={ok:!0,value:await n(t[d])}}catch{r[d]={ok:!1}}}});return await Promise.all(u),r}async function Y(t,e,n){let r=re(t),l=n.run??(async(c,s)=>{let m=await n.resolveAuth(),o=U({objective:c,model:n.model,sessionId:n.sessionId,auth:m});return F(o,n.spawnOpts,s)}),u=r.map(te),d=[...new Set(u)],g=new Map;d.forEach(c=>{g.set(c,r[u.indexOf(c)])});let p=d.map(c=>g.get(c)),v=await ne(p,n.concurrency??3,c=>l(L(c))),i=new Map;d.forEach((c,s)=>{let m=v[s];m.ok&&i.set(c,m.value)});let f=new Map;r.forEach((c,s)=>{f.set(c.id,i.get(u[s]))});let a=0;for(let c of t.scenarios)for(let s of c.test_cases??[])I(s)&&!f.get(s.id)&&a++;let w=c=>{let s=f.get(c.id);return s?N(s,c):M(c)};return{...await B(t,e,{suiteName:n.suiteName,redirectBareCwd:!1},w),fellBack:a}}function Pe(t,e){let n=!!t.agent||!!t.refine||!!t.save||!e,r=t.agent?"agent":"plain";return{headless:n,mode:r}}function $e(t){return t.refine&&t.save?{error:"use --refine or --save, not both"}:t.save?t.objective?{error:"--save takes no objective; use --refine to add to a request"}:t.req?{op:"save"}:{error:"--save requires --req <id>"}:t.refine?t.req?t.objective?t.out?{error:"--out is only valid with --save"}:{op:"refine"}:{error:"--refine needs a refinement objective"}:{error:"--refine requires --req <id>"}:t.req?{error:"--req requires --refine or --save"}:t.out?{error:"--out is only valid with --save"}:t.objective?{op:"new"}:{error:"provide an objective, or use --refine/--save with --req"}}function ie(){return se(process.cwd(),".testmuai","tests")}function Ge(t){if(typeof t!="string")return;let e=t.split(",").map(n=>n.trim()).filter(Boolean);return e.length?e:void 0}var X="tcg-generate-headless";function Q(t){return{refineHint:`kane-cli generate "<refinement>" --refine --req ${t}`,saveHint:`kane-cli generate --save --req ${t}`}}function W(t){return t.scenarios.reduce((e,n)=>e+(n.test_cases?.length??0),0)}function oe(t){return t==="completed"?0:t==="stopped"?3:1}async function Ne(t,e){let n=e.write??(i=>process.stdout.write(i)),r=e.sink??(e.mode==="agent"?new y(n):new S(n)),l,u,d=null;try{let i=await e.makeClient();l=i.client,u=i.conn,d=i.autoDefaulted}catch(i){return r.onError(i.message),2}if(e.mode==="agent"&&d){let{buildAutoDefaultedNdjson:i}=await import("./require-project-folder-LTVPPY3Q.js");n(i(d))}try{let i=await(e.checkUpdate??J)();i&&r.onUpdateAvailable(i)}catch{}let g=t.reqId??null;E(X,()=>{g&&l.cancel(g).catch(()=>{})});let p=process.cwd(),v={validate:e.validate??z,upload:e.upload??O,buildMappings:K,onUpload:i=>r.onUpload(i)};try{if(t.op==="save"){let s;try{s=(await l.attach(t.reqId)).state}catch(D){return r.onError(D.message),2}g=s.requestId,r.onSnapshot(s);let m=t.outDir??ie(),o=await e.materialize(s,m,t.suiteName);r.onSaveResult({suiteDir:o.suiteDir,saved:o.paths.length,fellBack:o.fellBack,warning:o.warning});let h=Q(s.requestId);return r.onDone({requestId:s.requestId,status:"completed",scenarioCount:s.scenarios.length,caseCount:W(s),refineHint:h.refineHint,saveHint:h.saveHint,suiteDir:o.suiteDir}),0}let i=t.op==="refine",f,a;if(i){let s;try{s=await l.attach(t.reqId)}catch(o){return r.onError(o.message),2}if(a=s.state,g=a.requestId,a.error)return r.onError(a.error),2;let m;try{m=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:a.scenarios,isRefine:!0,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of m.warnings)process.stderr.write(`warning: ${o}
20
20
  `);r.onStart({requestId:a.requestId,objectiveChars:m.promptText.length,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,isRefine:!0});try{await l.chat(t.reqId,m.promptText,{mappings:m.mappings,attachments:m.attachments})}catch(o){return r.onError(o.message),2}f=s.events}else{let s;try{s=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:[],isRefine:!1,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of s.warnings)process.stderr.write(`warning: ${o}
21
21
  `);let m;try{m=await l.start({prompt:s.promptText,attachments:s.attachments,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,memoryEnhancement:t.memory})}catch(o){return r.onError(o.message),2}a=m.state,g=a.requestId,r.onStart({requestId:a.requestId,objectiveChars:s.promptText.length,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,isRefine:!1}),f=m.events}let w="";for await(let s of f){switch(a=P(a,s),s.type){case"thinking_done":r.onThinking({tookMs:s.tookMs});break;case"progress":r.onProgress(s.pct);break;case"clarification":r.onClarification(s.text);break;case"chat":r.onChat(s.text);break;case"error":r.onError(s.message);break;case"done":w=s.status;break;default:break}if(s.type==="done"||s.type!=="thinking"&&a.status&&T(a.status))break}r.onSnapshot(a);let b=w||a.status||"completed",c=Q(a.requestId);return r.onDone({requestId:a.requestId,status:b,scenarioCount:a.scenarios.length,caseCount:W(a),refineHint:c.refineHint,saveHint:c.saveHint,suiteDir:void 0}),oe(b)}finally{q(X)}}var ae=()=>{};async function Me(t){let e=new j,n=new A,r=e.getActiveProfile()??"default",l=t.env??e.getDefaultEnv()??"prod",u=R(l),d=new x;t.name&&d.setSessionName(t.name);let g=n.load().model,p=async()=>{let i=await k({creds:e,env:l,usernameFlag:t.username,accessKeyFlag:t.accessKey,log:()=>{}}),f=await V({resolver:i.resolver,env:u,log:ae,projectId:t.projectId,folderId:t.folderId,autoResolve:t.projectId?void 0:{creds:e,config:n,profile:r,envName:l}});return{client:G(f),conn:f,autoDefaulted:f.autoDefaulted??null}},v=async()=>{let i=await k({creds:e,env:l,usernameFlag:t.username,accessKeyFlag:t.accessKey,log:()=>{}});return i.basicAuth?{username:i.basicAuth.username,access_key:i.basicAuth.access_key}:i.token?{auth:{type:"bearer",token:i.token}}:{}};return{mode:t.mode,makeClient:p,materialize:(i,f,a)=>Y(i,f,{model:g,sessionId:d.sessionId,resolveAuth:v,spawnOpts:{environment:l},suiteName:a})}}export{Me as buildHeadlessDeps,Pe as decideGenerateMode,ie as defaultOutDir,Ge as parseFilesFlag,$e as resolveGenerateOp,Ne as runGenerateHeadless};