@testmuai/kane-cli 0.8.12 → 0.8.14

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 (308) hide show
  1. package/dist/{ChatSurface-DALSIICW.js → ChatSurface-AVL3TJA2.js} +3 -3
  2. package/dist/{ChromeProfilePicker-ZMVZH3AK.js → ChromeProfilePicker-WJZJOZ6Z.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-K66H7YE6.js → CliFeedbackPrompt-65BQF5G5.js} +1 -1
  4. package/dist/{CliUploadProgress-5DZHZY4M.js → CliUploadProgress-HEBZYKGN.js} +1 -1
  5. package/dist/{ConfigView-S5KBV62S.js → ConfigView-JEVQ2SO4.js} +1 -1
  6. package/dist/EvidenceViewOffer-5MB4ZXKM.js +2 -0
  7. package/dist/FolderPicker-SYFXH6D5.js +2 -0
  8. package/dist/{InfoBox-7PAM2FQH.js → InfoBox-KM5DLBCV.js} +1 -1
  9. package/dist/{LinksBox-2NVZ3FHJ.js → LinksBox-FQA36GTV.js} +1 -1
  10. package/dist/{ProfilesView-SIUBF7IU.js → ProfilesView-76KGHTMK.js} +1 -1
  11. package/dist/{ProjectPicker-5NI554X3.js → ProjectPicker-65YOU46H.js} +1 -1
  12. package/dist/{SaveSessionPrompt-5OULBV5N.js → SaveSessionPrompt-QD6BNTWO.js} +1 -1
  13. package/dist/ScrollbackTap-QHJOFYMC.js +2 -0
  14. package/dist/SingleShotApp-U54ETXS3.js +2 -0
  15. package/dist/{SummaryBox-GTGF3CBO.js → SummaryBox-N2B6DUDD.js} +1 -1
  16. package/dist/TestMdRunView-WA4TC5PT.js +2 -0
  17. package/dist/{TestrunEvidenceTable-7WBCOGYW.js → TestrunEvidenceTable-3WLQVTF4.js} +1 -1
  18. package/dist/{WhoamiView-E2SVBHLC.js → WhoamiView-T26HA4ZZ.js} +1 -1
  19. package/dist/agent-parse-XMWVKCRD.js +2 -0
  20. package/dist/{app-download-SAXSYXIV.js → app-download-XKZWFMEK.js} +1 -1
  21. package/dist/attach-target-V6LECVES.js +2 -0
  22. package/dist/{auth-3LLVDHOJ.js → auth-PPJANIMZ.js} +1 -1
  23. package/dist/{binary-WSMIRJNC.js → binary-DKWWODT2.js} +1 -1
  24. package/dist/bind-62AZYFAY.js +15 -0
  25. package/dist/{bootstrap-QTVHGL45.js → bootstrap-6IJNZIPT.js} +1 -1
  26. package/dist/bridge-X5DEJL6F.js +2 -0
  27. package/dist/{changelog-CNYWOB2V.js → changelog-UTGJ7FSP.js} +1 -1
  28. package/dist/chat-committer-HDE3TP5I.js +2 -0
  29. package/dist/chat-controller-3EPK7UZG.js +2 -0
  30. package/dist/chunk-22QIVSQR.js +29 -0
  31. package/dist/{chunk-CQ3ZQ5UK.js → chunk-2BFXT7VQ.js} +3 -3
  32. package/dist/{chunk-AHRL4E3M.js → chunk-2RMHDOP4.js} +1 -1
  33. package/dist/{chunk-HPUQJRDX.js → chunk-3BHRGHIZ.js} +1 -1
  34. package/dist/{chunk-EEFZXZTZ.js → chunk-3IXEARDX.js} +1 -1
  35. package/dist/chunk-3N6IAVD5.js +7 -0
  36. package/dist/{chunk-3OU2F34I.js → chunk-3SPOJWRA.js} +1 -1
  37. package/dist/chunk-3YX3RQXO.js +2 -0
  38. package/dist/chunk-42FHKRPA.js +4 -0
  39. package/dist/{chunk-FBYB3SRE.js → chunk-4BBDKWM3.js} +1 -1
  40. package/dist/{chunk-UDFDTFBL.js → chunk-4K5XTIJ6.js} +1 -1
  41. package/dist/chunk-52WM3XYO.js +4 -0
  42. package/dist/{chunk-H6VS5RYO.js → chunk-53MPG2J3.js} +1 -1
  43. package/dist/{chunk-R7QAS6LZ.js → chunk-55YDTPB7.js} +1 -1
  44. package/dist/{chunk-IDX3TOPY.js → chunk-5LJRZI7S.js} +1 -1
  45. package/dist/chunk-66MOZKD2.js +2 -0
  46. package/dist/chunk-6F6YI3ZG.js +2 -0
  47. package/dist/chunk-6LGED4FC.js +35 -0
  48. package/dist/chunk-73ULUGBM.js +5 -0
  49. package/dist/{chunk-X6APRDUM.js → chunk-75I46VTM.js} +2 -2
  50. package/dist/{chunk-5FYO3PFG.js → chunk-7L25ZNNP.js} +1 -1
  51. package/dist/chunk-7O54QURK.js +2 -0
  52. package/dist/{chunk-4T35SA2O.js → chunk-7RAI77XD.js} +1 -1
  53. package/dist/{chunk-7NXHVC7G.js → chunk-AC7BPO4X.js} +1 -1
  54. package/dist/chunk-AHXOKBVE.js +7 -0
  55. package/dist/{chunk-DNNZ353O.js → chunk-ALCE5RLK.js} +1 -1
  56. package/dist/{chunk-5AHOVOWV.js → chunk-ARG56PJG.js} +1 -1
  57. package/dist/chunk-B2ZGG7WM.js +2 -0
  58. package/dist/{chunk-GNAPBOAJ.js → chunk-BAKJPQGU.js} +1 -1
  59. package/dist/chunk-BJYGWXVP.js +52 -0
  60. package/dist/chunk-C74ABM24.js +2 -0
  61. package/dist/chunk-CGT4NFQN.js +8 -0
  62. package/dist/{chunk-EV64VI66.js → chunk-CRZUBDJ3.js} +1 -1
  63. package/dist/{chunk-M4WSRYRA.js → chunk-DA57DXCF.js} +1 -1
  64. package/dist/chunk-DHJSM5DT.js +2 -0
  65. package/dist/{chunk-UZXCCO7V.js → chunk-EMSLJTYN.js} +1 -1
  66. package/dist/{chunk-2LXJ2ZM3.js → chunk-FFFB5BXL.js} +1 -1
  67. package/dist/{chunk-WIAZN7G4.js → chunk-FFVNISYH.js} +1 -1
  68. package/dist/chunk-FQNQVC5O.js +5 -0
  69. package/dist/{chunk-NSD2H67E.js → chunk-GESG672R.js} +1 -1
  70. package/dist/{chunk-FHYG3QLL.js → chunk-GKZ2KVE6.js} +1 -1
  71. package/dist/chunk-GP7WD4UY.js +4 -0
  72. package/dist/{chunk-7R5K4IGS.js → chunk-GPIXV7AV.js} +2 -2
  73. package/dist/chunk-H6TNBKGR.js +5 -0
  74. package/dist/chunk-HOA4VWSD.js +5 -0
  75. package/dist/chunk-IE3OO5GI.js +2 -0
  76. package/dist/chunk-IICQ5KRD.js +5 -0
  77. package/dist/{chunk-VG7BTA5G.js → chunk-IQ7GPETF.js} +1 -1
  78. package/dist/{chunk-AFNDJK2A.js → chunk-IQ7NGOAT.js} +1 -1
  79. package/dist/{chunk-F2CET54H.js → chunk-J7NRD4Q7.js} +1 -1
  80. package/dist/{chunk-FAREJ4P2.js → chunk-JH6E632O.js} +1 -1
  81. package/dist/{chunk-L7GAZQYL.js → chunk-JJJSDDQ2.js} +1 -1
  82. package/dist/{chunk-XWO5MDEU.js → chunk-JKX57HA7.js} +1 -1
  83. package/dist/{chunk-LLY7TQSI.js → chunk-K7K23DIQ.js} +1 -1
  84. package/dist/chunk-KN65CUNT.js +15 -0
  85. package/dist/{chunk-YF26DH4Z.js → chunk-KOL6ZWOQ.js} +1 -1
  86. package/dist/{chunk-COVIEKZN.js → chunk-KOPP4CJW.js} +1 -1
  87. package/dist/chunk-KZG4E5RM.js +2 -0
  88. package/dist/{chunk-GRDYYYIQ.js → chunk-L4M7753M.js} +1 -1
  89. package/dist/{chunk-ZVJGHQNG.js → chunk-L6MOO4WT.js} +1 -1
  90. package/dist/chunk-LBNADEQN.js +8 -0
  91. package/dist/{chunk-HWHLKBUT.js → chunk-LL5DQO6V.js} +1 -1
  92. package/dist/chunk-LNV7C2YO.js +6 -0
  93. package/dist/{chunk-3N2YOHD6.js → chunk-LR5DJ6EN.js} +1 -1
  94. package/dist/{chunk-ZXN67F4U.js → chunk-M7DN6FO3.js} +1 -1
  95. package/dist/chunk-MLRO7OH3.js +9 -0
  96. package/dist/{chunk-ZZI4Y3CX.js → chunk-MNE5VMHT.js} +1 -1
  97. package/dist/{chunk-3G3LY6BM.js → chunk-N7ZRF5K3.js} +1 -1
  98. package/dist/{chunk-MMQLVGUJ.js → chunk-NBMLBCJ3.js} +1 -1
  99. package/dist/{chunk-WHYEXCTG.js → chunk-NDCRJXYF.js} +1 -1
  100. package/dist/{chunk-4E4GJPEM.js → chunk-NOLYYHVG.js} +1 -1
  101. package/dist/{chunk-IWVA37B6.js → chunk-O25AL4B7.js} +1 -1
  102. package/dist/{chunk-2MTAXT2U.js → chunk-O2APH6TZ.js} +1 -1
  103. package/dist/{chunk-KAZGHWGK.js → chunk-O3XBIURC.js} +1 -1
  104. package/dist/{chunk-APZCLVZD.js → chunk-O5AS2ZIX.js} +1 -1
  105. package/dist/{chunk-43DM2I6Q.js → chunk-O6U2HU5M.js} +1 -1
  106. package/dist/{chunk-7KAPHA56.js → chunk-OH2NSBO6.js} +1 -1
  107. package/dist/{chunk-3CCD434H.js → chunk-OO5GMBVI.js} +1 -1
  108. package/dist/chunk-OPL2MIQG.js +2 -0
  109. package/dist/chunk-P3JUE2RM.js +17 -0
  110. package/dist/{chunk-QZRHXGNI.js → chunk-PGU64EWQ.js} +1 -1
  111. package/dist/{chunk-24QPDHRD.js → chunk-Q7XBMBMR.js} +1 -1
  112. package/dist/{chunk-4TZSEC2C.js → chunk-QJ5O27SJ.js} +1 -1
  113. package/dist/{chunk-YTAAF62A.js → chunk-QPUVOVD7.js} +1 -1
  114. package/dist/{chunk-5A4QG7ZM.js → chunk-RBHQXWR7.js} +1 -1
  115. package/dist/{chunk-G52YPXKT.js → chunk-RH6KFHJB.js} +1 -1
  116. package/dist/{chunk-ASYWKYTQ.js → chunk-RQLU4NDG.js} +12 -12
  117. package/dist/{chunk-U27OWZPW.js → chunk-SFTFHFG3.js} +7 -7
  118. package/dist/{chunk-H6NHARB4.js → chunk-SGHP44WS.js} +1 -1
  119. package/dist/{chunk-U2CIXGZR.js → chunk-SQDQADWD.js} +1 -1
  120. package/dist/{chunk-IE4BCGUE.js → chunk-SX56MVUO.js} +1 -1
  121. package/dist/{chunk-O5U6EAL3.js → chunk-TCAHDVII.js} +1 -1
  122. package/dist/chunk-TNBF5OMZ.js +2 -0
  123. package/dist/chunk-TU6IMGWO.js +2 -0
  124. package/dist/{chunk-5G22NOZK.js → chunk-UHT5SVP5.js} +1 -1
  125. package/dist/{chunk-L2BCQQLJ.js → chunk-UXH3RMQ7.js} +1 -1
  126. package/dist/{chunk-DYXYNH6X.js → chunk-VNFCX2SH.js} +1 -1
  127. package/dist/{chunk-O7U5BVX5.js → chunk-WBHSPN55.js} +2 -2
  128. package/dist/chunk-WILT62DP.js +16 -0
  129. package/dist/{chunk-I57TM22L.js → chunk-WOA7VCGA.js} +1 -1
  130. package/dist/{chunk-SA6EDKUF.js → chunk-WR42Q3HU.js} +1 -1
  131. package/dist/chunk-X5276I5H.js +9 -0
  132. package/dist/{chunk-75HF3GPO.js → chunk-X74PP5NJ.js} +1 -1
  133. package/dist/{chunk-3XWKKSIM.js → chunk-XGHMZJGI.js} +2 -2
  134. package/dist/{chunk-XS2LZFCH.js → chunk-YCH7H7JX.js} +1 -1
  135. package/dist/{chunk-IGW77FMB.js → chunk-YHR2YAN5.js} +1 -1
  136. package/dist/chunk-YHVG7V3E.js +21 -0
  137. package/dist/chunk-YLQHY4A7.js +2 -0
  138. package/dist/{chunk-KGKJU27A.js → chunk-YYYQ5MVD.js} +1 -1
  139. package/dist/chunk-ZA4M4O7E.js +27 -0
  140. package/dist/chunk-ZKEOPIQ3.js +9 -0
  141. package/dist/chunk-ZUZ6QJRA.js +23 -0
  142. package/dist/{chunk-4ASRA7CD.js → chunk-ZWHPIR2Z.js} +2 -2
  143. package/dist/chunk-ZZTZJPT2.js +88 -0
  144. package/dist/committer-IYQPXG6C.js +2 -0
  145. package/dist/{config-HUK7V364.js → config-3AKWRTFS.js} +1 -1
  146. package/dist/{controller-client-OB4WD2C4.js → controller-client-ZF5IXRUV.js} +1 -1
  147. package/dist/cover-cmd-ZLAWMEC2.js +3 -0
  148. package/dist/{credentials-6DP4KAMJ.js → credentials-Q4WH5CBN.js} +1 -1
  149. package/dist/{deps-bundle-PZNXSKLC.js → deps-bundle-RVZK6LZJ.js} +1 -1
  150. package/dist/{deps-resolve-62XK3LKV.js → deps-resolve-6F2U4TJP.js} +1 -1
  151. package/dist/design-committer-J57IAAA5.js +2 -0
  152. package/dist/dispatch-46BETGXY.js +2 -0
  153. package/dist/{doctor-ZQQ4VMPY.js → doctor-WRPG56HH.js} +1 -1
  154. package/dist/docx-convert-WPZS6OIC.js +2 -0
  155. package/dist/{dossier-Y6TJWFZU.js → dossier-UGJMYYAB.js} +1 -1
  156. package/dist/evidence-XWR32HWP.js +2 -0
  157. package/dist/evolve-cmd-27ZQN6YB.js +2 -0
  158. package/dist/explain-H5HJEDEF.js +2 -0
  159. package/dist/explain-cmd-JCJTXVZY.js +9 -0
  160. package/dist/{explain-cmd-XCRO4AS6.js → explain-cmd-R45I5MT7.js} +1 -1
  161. package/dist/extract-bind-D5BYYGYA.js +14 -0
  162. package/dist/{extract-cmd-IPBCCR3T.js → extract-cmd-CCYW7FIY.js} +3 -3
  163. package/dist/feeder-RSHMGW6B.js +2 -0
  164. package/dist/gaps-cmd-3VJKQ25D.js +3 -0
  165. package/dist/{generate-headless-CLMSXEAS.js → generate-headless-2M6UT3IK.js} +2 -2
  166. package/dist/headless-io-3A3BZVQ5.js +2 -0
  167. package/dist/index.js +206 -164
  168. package/dist/ingest-QGLVY7ND.js +2 -0
  169. package/dist/ingest-cmd-HVTUK264.js +2 -0
  170. package/dist/install-5WJLE7XT.js +2 -0
  171. package/dist/interactive-bind-OJCYNQPI.js +26 -0
  172. package/dist/lifecycle-cmd-GWFGUGTC.js +2 -0
  173. package/dist/{list-cmd-V3HJ5K4O.js → list-cmd-AXDW64OY.js} +1 -1
  174. package/dist/list-commands-YNZ6EFIF.js +2 -0
  175. package/dist/{locks-cmd-CSVSWY2Y.js → locks-cmd-67OHQZNV.js} +1 -1
  176. package/dist/logical-ids-DN6IZSUM.js +2 -0
  177. package/dist/login-flow-PRXFPRYZ.js +2 -0
  178. package/dist/maintenance-cmd-QEMK6YNV.js +2 -0
  179. package/dist/{mobile-prompts-WJVFBWW5.js → mobile-prompts-OXHA5GHJ.js} +1 -1
  180. package/dist/{objective-variable-gate-GCQYYM77.js → objective-variable-gate-76GYUHEP.js} +1 -1
  181. package/dist/open-provider-E5VUGFNE.js +2 -0
  182. package/dist/pdf-convert-5H4HQNN3.js +2 -0
  183. package/dist/{persist-recorded-session-MHLD4A32.js → persist-recorded-session-KWPH37HI.js} +1 -1
  184. package/dist/phase-seed-HKJ2EF7R.js +2 -0
  185. package/dist/pipeline-A2OGF4XW.js +2 -0
  186. package/dist/prepare-target-P6BWJZBZ.js +2 -0
  187. package/dist/readmodel-IBFRM6EO.js +2 -0
  188. package/dist/reconcile-cmd-V7TDYETT.js +2 -0
  189. package/dist/reconcile-deps-X6IGH4CA.js +4 -0
  190. package/dist/reconcile-engine-OGXSIE7O.js +2 -0
  191. package/dist/{recording-banner-4H4AL6YN.js → recording-banner-IZWN2XFY.js} +1 -1
  192. package/dist/records-TJJJWBUD.js +2 -0
  193. package/dist/registry-GOLIFVK5.js +2 -0
  194. package/dist/{require-project-folder-G2G4WKWW.js → require-project-folder-PEEUITK6.js} +1 -1
  195. package/dist/{resolve-run-intent-MZRPYN4V.js → resolve-run-intent-JGXXE45Y.js} +1 -1
  196. package/dist/{resolver-X5NHNX5O.js → resolver-TY7XLJBN.js} +1 -1
  197. package/dist/revert-6BBBK3I4.js +2 -0
  198. package/dist/review-cmd-74YTPT7E.js +5 -0
  199. package/dist/run-DN4XARP2.js +2 -0
  200. package/dist/run-GRYWYKIH.js +2 -0
  201. package/dist/{run-test-md-4VRH7FU5.js → run-test-md-DFCKCQ4T.js} +2 -2
  202. package/dist/sessions-NH7WQWMX.js +2 -0
  203. package/dist/{sessions-cmd-VDQGRBEM.js → sessions-cmd-DV442ZCY.js} +1 -1
  204. package/dist/{skill-installer-WPW6NDCR.js → skill-installer-GRU3HOYF.js} +1 -1
  205. package/dist/{spawner-R3XOP3GP.js → spawner-LNMD4NJF.js} +1 -1
  206. package/dist/store-guard-Q4MYZQHF.js +2 -0
  207. package/dist/structured-answers-NADW6D44.js +5 -0
  208. package/dist/sync-cmd-H6Y5EB3L.js +2 -0
  209. package/dist/sync-setup-THGRBKTA.js +2 -0
  210. package/dist/sync-setup-ui-RC727VK6.js +3 -0
  211. package/dist/tcg-generate-SZZ7MJXY.js +2 -0
  212. package/dist/testmd-actions-MRIUOOXO.js +2 -0
  213. package/dist/testmd-sync-UYVJ47BN.js +2 -0
  214. package/dist/token-refresh-KN5JK2U4.js +2 -0
  215. package/dist/{validate-basic-YNGP5JFB.js → validate-basic-RCBEELSB.js} +1 -1
  216. package/dist/{variable-receipt-2VCUG7NN.js → variable-receipt-JHRW73Z6.js} +1 -1
  217. package/dist/verdicts-XFXDRND4.js +2 -0
  218. package/dist/{version-check-GUGRBTIH.js → version-check-Z774UWW3.js} +1 -1
  219. package/dist/{view-cmd-SXXNDZIC.js → view-cmd-I4LQGJ2X.js} +1 -1
  220. package/dist/walk-session-FP52IGLB.js +2 -0
  221. package/dist/with-telemetry-P6RUPWBH.js +2 -0
  222. package/package.json +12 -11
  223. package/dist/EvidenceViewOffer-UACWB3YJ.js +0 -2
  224. package/dist/FolderPicker-YH5TKMX3.js +0 -2
  225. package/dist/ScrollbackTap-Q3IOKNMS.js +0 -2
  226. package/dist/SingleShotApp-LA3EMPUK.js +0 -2
  227. package/dist/TestMdRunView-5MNKJJMS.js +0 -2
  228. package/dist/bind-A3M4PV4V.js +0 -12
  229. package/dist/bridge-E2C5VV3H.js +0 -2
  230. package/dist/chat-committer-RAOIL2T6.js +0 -2
  231. package/dist/chat-controller-YJCNU76T.js +0 -2
  232. package/dist/chunk-4O6XBS5G.js +0 -5
  233. package/dist/chunk-54JZ6VEW.js +0 -4
  234. package/dist/chunk-5DT7PIGB.js +0 -5
  235. package/dist/chunk-5KLDW3ZW.js +0 -85
  236. package/dist/chunk-6A47PRDS.js +0 -4
  237. package/dist/chunk-6FCPS2VT.js +0 -4
  238. package/dist/chunk-7RFGO3TH.js +0 -2
  239. package/dist/chunk-DBIBROYW.js +0 -5
  240. package/dist/chunk-DPUV6OSP.js +0 -2
  241. package/dist/chunk-G2Q2TP3O.js +0 -9
  242. package/dist/chunk-IAHKTEET.js +0 -2
  243. package/dist/chunk-IVQX3AKL.js +0 -4
  244. package/dist/chunk-JDGBRACP.js +0 -16
  245. package/dist/chunk-JOATASPP.js +0 -4
  246. package/dist/chunk-KRL2BDI5.js +0 -8
  247. package/dist/chunk-N7Z7BQYO.js +0 -3
  248. package/dist/chunk-NJJQL54J.js +0 -2
  249. package/dist/chunk-NP3VGFZM.js +0 -26
  250. package/dist/chunk-NVGBE2DR.js +0 -2
  251. package/dist/chunk-OS4VSIHT.js +0 -4
  252. package/dist/chunk-OZMYKG6E.js +0 -6
  253. package/dist/chunk-QQ5MHSSY.js +0 -2
  254. package/dist/chunk-RV7Q4RUV.js +0 -7
  255. package/dist/chunk-SACCB44S.js +0 -21
  256. package/dist/chunk-T4OJX2GZ.js +0 -15
  257. package/dist/chunk-TLFNUXKS.js +0 -2
  258. package/dist/chunk-UH2ZTX4E.js +0 -2
  259. package/dist/chunk-VDM3TWF6.js +0 -17
  260. package/dist/chunk-W3Z7AZNT.js +0 -4
  261. package/dist/chunk-WMVPJWWA.js +0 -37
  262. package/dist/chunk-XMTSHHYQ.js +0 -4
  263. package/dist/chunk-ZVZHE7KH.js +0 -27
  264. package/dist/committer-C6UCDYMC.js +0 -2
  265. package/dist/cover-cmd-5LPHIOSI.js +0 -3
  266. package/dist/design-committer-UPC6NZUF.js +0 -2
  267. package/dist/dispatch-7JCKGQVC.js +0 -2
  268. package/dist/docx-convert-BIV5T7F5.js +0 -2
  269. package/dist/evidence-YAXIWZ6A.js +0 -2
  270. package/dist/evolve-cmd-5ACHYQPE.js +0 -2
  271. package/dist/explain-3HAZY7Q6.js +0 -2
  272. package/dist/explain-cmd-RMJPXD4U.js +0 -9
  273. package/dist/extract-bind-BF2G6AS6.js +0 -10
  274. package/dist/feeder-IOR3XRNF.js +0 -2
  275. package/dist/gaps-cmd-3WXL6PAW.js +0 -3
  276. package/dist/headless-io-66RG5NN5.js +0 -2
  277. package/dist/ingest-TTUQ7UDK.js +0 -2
  278. package/dist/ingest-cmd-KP5M6XTA.js +0 -2
  279. package/dist/install-5VWCH5GW.js +0 -2
  280. package/dist/interactive-bind-MOV2VWHJ.js +0 -25
  281. package/dist/lifecycle-cmd-KSMETBPP.js +0 -2
  282. package/dist/list-commands-KUDSKVP5.js +0 -2
  283. package/dist/logical-ids-MLXAH45L.js +0 -2
  284. package/dist/login-flow-GZ3XHVCS.js +0 -2
  285. package/dist/maintenance-cmd-VFYGKY3X.js +0 -2
  286. package/dist/pdf-convert-OZIRUADA.js +0 -2
  287. package/dist/phase-seed-BMOSAA74.js +0 -2
  288. package/dist/pipeline-G7KWRK2G.js +0 -2
  289. package/dist/prepare-target-SQ5IGKXD.js +0 -2
  290. package/dist/readmodel-TDRFVDVI.js +0 -2
  291. package/dist/reconcile-cmd-NI3AYU3Y.js +0 -2
  292. package/dist/reconcile-deps-DCHUFIEC.js +0 -4
  293. package/dist/reconcile-engine-QXUKUKSL.js +0 -2
  294. package/dist/records-JLS63SDI.js +0 -2
  295. package/dist/registry-R6QNPI5E.js +0 -2
  296. package/dist/revert-PRR3D4XM.js +0 -2
  297. package/dist/review-cmd-SAGIKWEW.js +0 -4
  298. package/dist/run-PBS2J4N4.js +0 -2
  299. package/dist/run-VTUYLPSG.js +0 -2
  300. package/dist/sessions-GIEXOCE4.js +0 -2
  301. package/dist/structured-answers-YAVW65G4.js +0 -5
  302. package/dist/tcg-generate-HIC5AA3L.js +0 -2
  303. package/dist/testmd-actions-VOSP7L74.js +0 -2
  304. package/dist/testmd-sync-GNCDKPQN.js +0 -2
  305. package/dist/token-refresh-GSFVJ6GU.js +0 -2
  306. package/dist/verdicts-PRXUKSDV.js +0 -2
  307. package/dist/walk-session-G3DLBR24.js +0 -2
  308. package/dist/with-telemetry-5Y2CVPXK.js +0 -2
@@ -1,17 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as N,b as he,c as ye,d as be,e as Ee,f as _e,m as T}from"./chunk-54JZ6VEW.js";import{a as J,b as F}from"./chunk-2UIHS2FH.js";import{a as M}from"./chunk-N2P4MI32.js";import{a as we}from"./chunk-YKTYVJBN.js";import{b as B,d as W}from"./chunk-NVGBE2DR.js";import{C as j}from"./chunk-W3Z7AZNT.js";import{w as ge}from"./chunk-NJJQL54J.js";var A="https://integrations.lambdatest.com",E=class extends Error{constructor(e,r){super(r);this.code=e;this.name="LisError"}};function ft(t){let n=t.TESTMUAI_ENV==="stage"?"stage":"prod";return`${ge[n].shareApiBaseUrl}/lis/api/v1`}function gt(t){let n=t.env??process.env,e=t.auth?.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH;if(e)return{authorization:`Basic ${e}`};let r=t.auth?.TESTMUAI_API_KEY||n.TESTMUAI_API_KEY;return r?{authorization:`Bearer ${r}`}:{}}function k(t){let n=t.split(`
3
- `,1)[0].replace(/[\u0000-\u001f\u007f-\u009f]/g,"");return n.length>200?`${n.slice(0,200)}\u2026`:n}function ht(t,n,e="the issue"){return t===401||t===403?new E("LIS_AUTH","credentials rejected \u2014 run `kane-cli login` and retry"):t>=500?new E("LIS_UNAVAILABLE",`the integrations service returned an error (HTTP ${t}) \u2014 retry later`):new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${e}: ${k(n)||`HTTP ${t}`}`)}function C(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{throw new E("LIS_UNAVAILABLE","the integrations service returned a malformed response \u2014 retry later")}}function ce(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{return{}}}function Le(t){return ce(t).code}function S(t,n="the issue",e="Atlassian"){let r=ce(t),s=e==="Atlassian"?"Confluence":e;switch(r.code){case"TOKEN_EXPIRED":return new E("LIS_SETUP",`your ${e} connection needs a resync \u2014 reconnect at ${A} and retry`);case"NOT_INSTALLED":return new E("LIS_SETUP",`no ${e} connection for this account \u2014 create one at ${A} and retry`);case"SCOPE_MISSING":return new E("LIS_SETUP",`the connection has no ${s} access \u2014 reconnect with ${s} at ${A} and retry`);case"FORBIDDEN":return new E("LIS_FORBIDDEN",`you don't have access to ${n}`);case"NOT_FOUND":return new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${n}: ${k(r.message??"")||"not found"}`);case"PAYLOAD_TOO_LARGE":return new E("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");case"INVALID_PAYLOAD":return new E("LIS_UNAVAILABLE",`the integrations service rejected the request (${k(r.message??"")||"invalid payload"}) \u2014 retry later`);case"NOT_SUPPORTED":return new E("LIS_UNAVAILABLE","the integrations service does not support this operation yet");case"UPSTREAM_ERROR":case"UPSTREAM_TIMEOUT":return new E("LIS_UNAVAILABLE",`${e} is not responding through the integrations service \u2014 retry later`);default:return ht(t.status,r.message??"",n)}}var yt=3e4,bt=5;async function $(t,n,e){let r=e.env??process.env,s=e.fetchImpl??fetch;for(let o=0;;o++){let l=new AbortController,u=setTimeout(()=>l.abort(),yt);try{let i=await s(`${ft(r)}${t}`,{...n,headers:{"content-type":"application/json",...gt(e),...n.headers??{}},signal:l.signal}),c=await Promise.race([i.arrayBuffer(),new Promise((d,p)=>{l.signal.addEventListener("abort",()=>p(new DOMException("aborted","AbortError")),{once:!0})})]),a={status:i.status,ok:i.ok,headers:i.headers,bytes:Buffer.from(c)};if(a.status===429){if(o>0)throw new E("LIS_RATE_LIMITED","the integrations service is busy \u2014 try again in a moment");let d=ce(a).data?.retry_after_sec,p=Math.min(Math.max(typeof d=="number"&&Number.isFinite(d)?d:1,0),bt);clearTimeout(u),await new Promise(y=>setTimeout(y,p*1e3));continue}return a}catch(i){throw i instanceof E?i:l.signal.aborted?new E("LIS_UNAVAILABLE","the integrations service did not respond within 30 seconds \u2014 retry later"):new E("LIS_UNAVAILABLE",`could not reach the integrations service (${k(i instanceof Error?i.message:String(i))}) \u2014 check your connection and retry`)}finally{clearTimeout(u)}}}function V(t){let n=t.headers.get("content-type")??"application/octet-stream";if(n.includes("json"))try{let e=JSON.parse(t.bytes.toString("utf8")),r=e.content??e.data?.content;if(typeof r=="string")return{bytes:Buffer.from(r,"base64"),mediaType:e.mime_type??e.data?.mime_type??"application/octet-stream"}}catch{}return{bytes:t.bytes,mediaType:n}}async function H(t={}){let n=await $("/jira/info",{method:"GET"},t);if(!n.ok)throw S(n);let e=C(n),r=(e.data?.SELECTED_PROJECTS??[]).map(s=>s?.key).filter(s=>typeof s=="string"&&s.length>0);return{installed:e.data?.INSTALLED==="YES",selectAll:e.data?.SELECT_ALL===!0,selectedProjects:r,capabilities:{document:e.data?.capabilities?.document===!0,comments:e.data?.capabilities?.comments===!0}}}async function z(t,n={}){let e=await $("/jira/issue?details=true",{method:"POST",body:JSON.stringify({plugin_code:"jira",issueKey:t})},n);if(!e.ok)throw S(e);let r=C(e);if(r.type==="error"||!r.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue: ${k(r.message??"")||"issue not found or not accessible"}`);return r.data}var Ie=100,Et=5e3,_t=60;async function X(t,n={}){let e=[],r=new Set,s=null,o=0;for(let l=0;;l++){if(l>=_t)throw new E("LIS_UNAVAILABLE","the integrations service kept returning comment pages without finishing \u2014 retry later");let u=await $("/jira/issue/comments",{method:"POST",body:JSON.stringify({resource_id:t,max_results:Ie,cursor:s,start_at:o,order_by:"created",fetch_all:!1})},n);if(!u.ok)throw S(u,"the issue's comments");let i=C(u);if(i.type==="error"||!i.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue's comments: ${k(i.message??"")||"unavailable"}`);for(let w of i.data.comments??[]){let f=String(w.id);r.has(f)||(r.add(f),e.push(w))}let c=i.data.pagination;if(!c?.has_more)return e;if(e.length>=Et)throw new E("JIRA_ISSUE_UNAVAILABLE","the issue has more comments than can be ingested \u2014 cannot build a complete identity");let a=c.next_cursor??null,d=c.next_start_at!=null,p=d?c.next_start_at:o+Ie;if(!(a!=null&&a!==s||a==null&&d&&p!==o))throw new E("LIS_UNAVAILABLE","the integrations service returned a non-advancing comments page \u2014 retry later");s=a,o=p}}async function Z(t,n={}){let e=await $("/jira/attachment",{method:"POST",body:JSON.stringify({attachment_id:t})},n);if(!e.ok){if(Le(e)===void 0){if(e.status===413)throw new E("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");if(e.status===404)throw new E("JIRA_NOT_CONNECTED",`Jira is not connected for this account \u2014 connect it at ${A} and retry`)}throw S(e,`attachment ${t}`)}return V(e)}var q="kane.source.jira/2";function Ae(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t)){let n=t.map(Ae).filter(e=>e!==null);return n.length===0?null:n.join(", ")}if(t!==null&&typeof t=="object"){let n=t;for(let e of["name","value","displayName"])if(typeof n[e]=="string")return n[e];return null}return null}function ve(t,n,e){let r=[],s={},o=t.additional_fields??{};for(let a of Object.keys(o).sort()){let d=Ae(o[a]);if(d===null){r.push(`field "${a}" has no stable text form \u2014 dropped from the envelope`);continue}s[a]=d}let l=[...t.attachments??[]].map(a=>({id:String(a.id),filename:a.filename??"",media_type:a.mime_type??"application/octet-stream",size:a.size??0})).sort((a,d)=>{let p=Number(a.id),y=Number(d.id);return Number.isFinite(p)&&Number.isFinite(y)?p-y:a.id<d.id?-1:a.id>d.id?1:0}),u=e.map(a=>({id:String(a.id),author:a.author?.display_name??"",body:a.body??"",created:a.created??""})).sort((a,d)=>{if(a.created!==d.created)return a.created<d.created?-1:1;let p=Number(a.id),y=Number(d.id);return Number.isFinite(p)&&Number.isFinite(y)&&p!==y?p-y:a.id<d.id?-1:a.id>d.id?1:0}),i=t.key;if(!/^[A-Za-z][A-Za-z0-9_]*-\d+$/.test(i))throw new Error(`cannot build a stable identity for issue key "${i}" \u2014 expected a PROJECT-NUMBER key`);let c={schema:q,site:n,project:i.slice(0,i.lastIndexOf("-")),issue:{id:t.id,key:i},content:{summary:t.summary??"",description:t.description??"",fields:s},attachments:l,comments:u};return{bytes:Buffer.from(JSON.stringify(c),"utf8"),envelope:c,warnings:r}}var Se=64,wt=16,Lt=6e6,It=5e7,At=12e6,vt={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},St=new Set(["png","jpeg","webp"]);function $e(t){return async n=>{let e;try{e=JSON.parse(n.toString("utf8"))}catch{throw new Error("JIRA_ENVELOPE_SCHEMA: source bytes are not a kane jira envelope")}if(e.schema!==q)throw new Error(`JIRA_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${q}`);let r=[],s=new Map,o=[],l=0,u=new Map,i=[];for(let d=0;d<e.attachments.length;d++){let p=e.attachments[d],y=`i${d+1}`,w=`attachment:${p.filename}`,f=v=>`[img#${y}] ${p.filename} (${p.media_type}, ${p.size} bytes${v?"":" \u2014 not delivered"})`,h=(v,R,x)=>{r.push({ref:y,loc:w,media_type:v,...x?.blob?{blob:x.blob}:{},...x?.appearance?{appearance:x.appearance}:{},delivery:R,...x?.duplicate_of?{duplicate_of:x.duplicate_of}:{}})};if(!p.media_type.startsWith("image/")){h(p.media_type,"unsupported-vision-media-type"),i.push(f(!1));continue}let _;try{_=await t.fetchAttachment(p.id)}catch{h(p.media_type,"external-image-not-fetched"),i.push(f(!1));continue}let b=_.bytes,g=J(b),m=vt[g.format],I=B(b);if(s.set(I,b),!St.has(g.format)){let v=g.format==="gif"||g.format==="bmp"||g.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";h(m,v,{blob:I}),i.push(f(!1));continue}if(g.width===void 0||g.height===void 0||g.width*g.height>It){h(m,"undecodable",{blob:I}),i.push(f(!1));continue}let L;if(g.format==="png"||g.format==="jpeg"){let v=F(b,g.format);if(v===null){h(m,"undecodable",{blob:I}),i.push(f(!1));continue}L=M(v.data,{width:v.width,height:v.height,channels:v.channels})}if(g.width<Se||g.height<Se){h(m,"below-dimension-floor",{blob:I,appearance:L}),i.push(f(!1));continue}let O=u.get(I);if(O!==void 0){h(m,"duplicate",{blob:I,appearance:L,duplicate_of:O}),i.push(f(!1));continue}if(b.byteLength>Lt){h(m,"image-too-large",{blob:I,appearance:L}),i.push(f(!1));continue}if(l+b.byteLength>At){h(m,"vision-byte-budget-reached",{blob:I,appearance:L}),i.push(f(!1));continue}if(o.length>=wt){h(m,"image-cap-reached",{blob:I,appearance:L}),i.push(f(!1));continue}u.set(I,y),l+=b.byteLength,o.push(y),h(m,"selected",{blob:I,appearance:L}),i.push(f(!0))}let c=[];c.push(`${e.issue.key} \xB7 ${e.site}/${e.project}`,`Summary: ${e.content.summary}`),e.content.description!==""&&c.push("",...e.content.description.split(`
4
- `));let a=Object.keys(e.content.fields);return a.length>0&&c.push("","--- fields ---",...a.map(d=>`${d}: ${e.content.fields[d]}`)),i.length>0&&c.push("","--- attachments ---",...i),e.comments.length>0&&(c.push("","--- comments ---"),e.comments.forEach((d,p)=>{p>0&&c.push(""),c.push(`[${p+1}] ${d.author} \xB7 ${d.created}`,...d.body.split(`
5
- `))})),{projection:c.join(`
6
- `)+`
7
- `,inventory:r,blobs:s,delivered:o,converter:{name:"jira-convert",version:"2",policy:"v1"}}}}var $t=/^[A-Za-z][A-Za-z0-9_]*-\d+$/;function Q(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.lastIndexOf("browse");if(r===-1||r+1>=e.length)return null;let s=e[r+1];return $t.test(s)?{site:n.hostname,issueKey:s.toUpperCase()}:null}function ee(t,n){let e=j(t),r=e.heads.get(n);return r==null?null:Ce(t,e,r)}function te(t,n){let r=ee(t,n)?.site;return typeof r=="string"&&r.length>0?r:null}function ke(t,n,e,r){let s=j(t);for(let[o,l]of s.heads){if(l==null||s.mediaOf(l).format!==n)continue;let u=Ce(t,s,l);if(u===null)continue;let i=u;for(let c of e){if(i===null||typeof i!="object"){i=void 0;break}i=i[c]}if(i===r)return o}return null}function Ce(t,n,e){let r=n.getNode(e)?.content?.blob;if(typeof r!="string")return null;let s=W(t,r);if(s===null)return null;try{let o=JSON.parse(s.toString("utf8"));return o!==null&&typeof o=="object"?o:null}catch{return null}}var Re={jira:"a jira issue source",confluence:"a confluence page source",linear:"a linear issue source","linear-doc":"a linear document source",web:"a web page source"};function P(t,n,e){let r=j(t),s=r.heads.get(n);if(s==null)return null;let o=r.mediaOf(s).format;if(o===e)return null;let l=Re[o]??`${o} content`;return`source '${n}' is already backed by ${l}, not ${Re[e]??e} \u2014 retire it first (kane-cli context retire ${n}) or ingest under a different id with --as`}async function Rt(t,n,e,r,s){let o=Q(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Jira issue URL (https://<site>/browse/KEY-123)`),{code:1};let l=s?.lis??{jiraInfo:H,jiraIssue:z,jiraAttachment:Z,jiraComments:X};try{let i={auth:await(s?.authEnv??(await import("./auth-3LLVDHOJ.js")).resolveLisAuthEnv)(),env:process.env},c=await l.jiraInfo(i);if(!c.installed)return(e.err??e.out)(`error: ${t}: no Atlassian connection for this account \u2014 create one at ${A} and retry`),{code:1};if(c.capabilities.comments===!1)return(e.err??e.out)(`error: ${t}: the connection cannot read issue comments yet \u2014 resync it at ${A} and retry`),{code:1};let a=o.issueKey.slice(0,o.issueKey.lastIndexOf("-"));if(!c.selectAll&&c.selectedProjects.length>0&&!c.selectedProjects.includes(a))return(e.err??e.out)(`error: ${t}: project ${a} is not in the integration's selected projects (${c.selectedProjects.join(", ")}) \u2014 add it at ${A}`),{code:1};let d=await l.jiraIssue(o.issueKey,i),p=await l.jiraComments(o.issueKey,i),y=o.site;if(d.host)try{y=new URL(d.host).hostname}catch{y=d.host.replace(/^https?:\/\//,"").replace(/[/:].*$/,"")}let{bytes:w,warnings:f}=ve(d,y,p),h=n??o.issueKey.toLowerCase();N(h);let _=P(r,h,"jira");if(_!==null)return(e.err??e.out)(`error: ${t}: ${_}`),{code:1};let b=te(r,h);if(b!==null&&b!==y)return(e.err??e.out)(`error: ${t}: source '${h}' was ingested from ${b}, but this read serves ${y} \u2014 retire it first (kane-cli context retire ${h}) or ingest under a different id with --as`),{code:1};let g=await T({contextDir:r,bytes:w,media:he,sourceId:h,label:t,confirmSameSource:e.isTTY?m=>e.confirm(`identical content already ingested as ${m} \u2014 treat as the same source?`):void 0,converters:{jira:$e({fetchAttachment:m=>l.jiraAttachment(m,i)})}});e.out(U(e.isTTY,g,o.issueKey));for(let m of f)e.out(`warning: ${m}`);for(let m of g.warnings??[])e.out(`warning: ${m}`);if(g.composite){let m=g.composite.delivered+g.composite.omitted;e.out(`${g.source_id}: jira, ${m} attachments, ${g.composite.delivered} images delivered (${g.composite.omitted} omitted)`)}return{code:0,result:{status:g.status,source_id:g.source_id,source_cid:g.cid}}}catch(u){return u instanceof E?((e.err??e.out)(`error: ${t}: ${u.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${kt(u instanceof Error?u.message:String(u))}`),{code:1})}}function kt(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the issue's content is too large to ingest (${n[1]}; the limit is ${n[2]}) \u2014 trim the description or attachments in Jira and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the issue's text is too large to ingest \u2014 trim the description in Jira and retry":t}var Oe={name:"jira",hint:"Jira issue URLs (https://<site>/browse/KEY-123)",match:t=>Q(t)!==null,ingest:Rt,sourceIdFor:t=>{let n=Q(t);return n?n.issueKey.toLowerCase():null}};async function Ne(t,n={}){let e=await $("/jira/document",{method:"POST",body:JSON.stringify({resource_id:t,format:"markdown"})},n);if(!e.ok)throw S(e,"the page");let r=C(e);if(r.type==="error"||!r.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the page: ${k(r.message??"")||"page not found or not accessible"}`);return r.data}async function Te(t,n={}){let e=await $("/jira/attachment",{method:"POST",body:JSON.stringify({source:"confluence",download:t})},n);if(!e.ok)throw S(e,"the page's attachment");return{bytes:V(e).bytes}}var ne="kane.source.confluence/1";function Pe(t,n){if(typeof t.id!="string"||t.id==="")throw new Error("cannot build a stable identity for this page \u2014 the integrations service returned no page id");let e=[...t.labels??[]].filter(o=>typeof o=="string").sort(),r=[...t.attachments??[]].map(o=>({id:String(o.id),filename:o.filename??"",media_type:o.mime_type??"application/octet-stream",size:o.size??0})).sort((o,l)=>o.id<l.id?-1:o.id>l.id?1:0),s={schema:ne,site:n,page:{id:t.id},space:{key:t.space?.key??""},title:t.title??"",labels:e,content:{body:t.body??""},attachments:r};return{bytes:Buffer.from(JSON.stringify(s),"utf8"),envelope:s,warnings:[]}}var Ue=64,Ct=16,Ot=6e6,Nt=5e7,Tt=12e6,Pt={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},Ut=new Set(["png","jpeg","webp"]);function xe(t){let n=new Map(Object.entries(t.downloads));return async e=>{let r;try{r=JSON.parse(e.toString("utf8"))}catch{throw new Error("CONFLUENCE_ENVELOPE_SCHEMA: source bytes are not a kane confluence envelope")}if(r.schema!==ne)throw new Error(`CONFLUENCE_ENVELOPE_SCHEMA: unknown envelope schema "${r.schema}" \u2014 this CLI understands ${ne}`);let s=[],o=new Map,l=[],u=0,i=new Map,c=[];for(let d=0;d<r.attachments.length;d++){let p=r.attachments[d],y=`i${d+1}`,w=`attachment:${p.filename}`,f=R=>`[img#${y}] ${p.filename} (${p.media_type}, ${p.size} bytes${R?"":" \u2014 not delivered"})`,h=(R,x,D)=>{s.push({ref:y,loc:w,media_type:R,...D?.blob?{blob:D.blob}:{},...D?.appearance?{appearance:D.appearance}:{},delivery:x,...D?.duplicate_of?{duplicate_of:D.duplicate_of}:{}})};if(!p.media_type.startsWith("image/")){h(p.media_type,"unsupported-vision-media-type"),c.push(f(!1));continue}let _=n.get(p.id);if(!_){h(p.media_type,"external-image-not-fetched"),c.push(f(!1));continue}let b;try{b=await t.fetchAttachment({id:p.id,download:_})}catch{h(p.media_type,"external-image-not-fetched"),c.push(f(!1));continue}let g=b.bytes,m=J(g),I=Pt[m.format],L=B(g);if(o.set(L,g),!Ut.has(m.format)){let R=m.format==="gif"||m.format==="bmp"||m.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";h(I,R,{blob:L}),c.push(f(!1));continue}if(m.width===void 0||m.height===void 0||m.width*m.height>Nt){h(I,"undecodable",{blob:L}),c.push(f(!1));continue}let O;if(m.format==="png"||m.format==="jpeg"){let R=F(g,m.format);if(R===null){h(I,"undecodable",{blob:L}),c.push(f(!1));continue}O=M(R.data,{width:R.width,height:R.height,channels:R.channels})}if(m.width<Ue||m.height<Ue){h(I,"below-dimension-floor",{blob:L,appearance:O}),c.push(f(!1));continue}let v=i.get(L);if(v!==void 0){h(I,"duplicate",{blob:L,appearance:O,duplicate_of:v}),c.push(f(!1));continue}if(g.byteLength>Ot){h(I,"image-too-large",{blob:L,appearance:O}),c.push(f(!1));continue}if(u+g.byteLength>Tt){h(I,"vision-byte-budget-reached",{blob:L,appearance:O}),c.push(f(!1));continue}if(l.length>=Ct){h(I,"image-cap-reached",{blob:L,appearance:O}),c.push(f(!1));continue}i.set(L,y),u+=g.byteLength,l.push(y),h(I,"selected",{blob:L,appearance:O}),c.push(f(!0))}let a=[];return a.push(`${r.title} \xB7 ${r.site} \xB7 ${r.space.key}`),r.labels.length>0&&a.push(`labels: ${r.labels.join(", ")}`),r.content.body!==""&&a.push("",...r.content.body.split(`
8
- `)),c.length>0&&a.push("","--- attachments ---",...c),{projection:a.join(`
9
- `)+`
10
- `,inventory:s,blobs:o,delivered:l,converter:{name:"confluence-convert",version:"1",policy:"v1"}}}}var xt=/^[A-Za-z0-9~][A-Za-z0-9._~-]*$/;function re(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.indexOf("wiki");if(r===-1||e[r+1]!=="spaces"||e[r+3]!=="pages")return null;let s=e[r+2],o=e[r+4];return s===void 0||o===void 0||!xt.test(s)||!/^\d+$/.test(o)?null:{site:n.hostname,spaceKey:s,pageId:o}}async function Dt(t,n,e,r,s){let o=re(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Confluence page URL (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)`),{code:1};let l=s?.lis??{jiraInfo:H,jiraIssue:z,jiraAttachment:Z,jiraComments:X},u=s?.confluence??{confluenceDocument:Ne,confluenceAttachment:Te};try{let c={auth:await(s?.authEnv??(await import("./auth-3LLVDHOJ.js")).resolveLisAuthEnv)(),env:process.env},a=await l.jiraInfo(c);if(!a.installed)return(e.err??e.out)(`error: ${t}: no Atlassian connection for this account \u2014 create one at ${A} and retry`),{code:1};if(a.capabilities.document===!1)return(e.err??e.out)(`error: ${t}: the connection has no Confluence access \u2014 reconnect with Confluence at ${A} and retry`),{code:1};let d=await u.confluenceDocument(o.pageId,c),p=o.site;if(d.url)try{p=new URL(d.url).hostname}catch{}let{bytes:y,warnings:w}=Pe(d,p),f=n??`page-${o.pageId}`;N(f);let h=P(r,f,"confluence");if(h!==null)return(e.err??e.out)(`error: ${t}: ${h}`),{code:1};let _=te(r,f);if(_!==null&&_!==p)return(e.err??e.out)(`error: ${t}: source '${f}' was ingested from ${_}, but this read serves ${p} \u2014 retire it first (kane-cli context retire ${f}) or ingest under a different id with --as`),{code:1};let b=Object.fromEntries((d.attachments??[]).filter(m=>typeof m.download=="string"&&m.download.length>0).map(m=>[String(m.id),m.download])),g=await T({contextDir:r,bytes:y,media:ye,sourceId:f,label:t,confirmSameSource:e.isTTY?m=>e.confirm(`identical content already ingested as ${m} \u2014 treat as the same source?`):void 0,converters:{confluence:xe({downloads:b,fetchAttachment:m=>u.confluenceAttachment(m.download,c)})}});e.out(U(e.isTTY,g,`${o.spaceKey}/${o.pageId}`));for(let m of w)e.out(`warning: ${m}`);for(let m of g.warnings??[])e.out(`warning: ${m}`);if(g.composite){let m=g.composite.delivered+g.composite.omitted;e.out(`${g.source_id}: confluence, ${m} attachments, ${g.composite.delivered} images delivered (${g.composite.omitted} omitted)`)}return{code:0,result:{status:g.status,source_id:g.source_id,source_cid:g.cid}}}catch(i){return i instanceof E?((e.err??e.out)(`error: ${t}: ${i.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${jt(i instanceof Error?i.message:String(i))}`),{code:1})}}function jt(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the page's content is too large to ingest (${n[1]}; the limit is ${n[2]}) \u2014 trim the page in Confluence and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the page's text is too large to ingest \u2014 trim the page in Confluence and retry":t}var De={name:"confluence",hint:"Confluence page URLs (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)",match:t=>re(t)!==null,ingest:Dt,sourceIdFor:t=>{let n=re(t);return n?`page-${n.pageId}`:null}};async function je(t={}){let n=await $("/linear-app/info",{method:"GET"},t);if(!n.ok)throw S(n,"the connection","Linear");let e=C(n);return{installed:e.data?.INSTALLED==="YES",capabilities:{issue:e.data?.capabilities?.issue===!0,comments:e.data?.capabilities?.comments===!0,document:e.data?.capabilities?.document===!0}}}async function Be(t,n={}){let e=await $("/linear-app/issue?details=true",{method:"POST",body:JSON.stringify({plugin_code:"linear-app",issueKey:t})},n);if(!e.ok)throw S(e,"the issue","Linear");let r=C(e);if(r.type==="error"||!r.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue: ${k(r.message??"")||"issue not found or not accessible"}`);return r.data}var Bt=100,Mt=5e3,Jt=60;async function Me(t,n={}){let e=[],r=new Set,s=null;for(let o=0;;o++){if(o>=Jt)throw new E("LIS_UNAVAILABLE","the integrations service kept returning comment pages without finishing \u2014 retry later");let l=await $("/linear-app/issue/comments",{method:"POST",body:JSON.stringify({resource_id:t,max_results:Bt,...s===null?{}:{cursor:s},fetch_all:!1})},n);if(!l.ok)throw S(l,"the issue's comments","Linear");let u=C(l);if(u.type==="error"||!u.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue's comments: ${k(u.message??"")||"unavailable"}`);if(u.data.partial)throw new E("JIRA_ISSUE_UNAVAILABLE","the integrations service returned an incomplete comment set \u2014 retry later");for(let a of u.data.comments??[]){if(typeof a.id!="string"||a.id==="")throw new E("JIRA_ISSUE_UNAVAILABLE","the integrations service returned an incomplete comment set \u2014 a comment row has no comment id");r.has(a.id)||(r.add(a.id),e.push(a))}let i=u.data.pagination;if(!i?.has_more)return e;if(e.length>=Mt)throw new E("JIRA_ISSUE_UNAVAILABLE","the issue has more comments than can be ingested \u2014 cannot build a complete identity");let c=i.next_cursor??null;if(c==null||c===s)throw new E("LIS_UNAVAILABLE","the integrations service returned a non-advancing comments page \u2014 retry later");s=c}}async function Je(t,n={}){let e=await $("/linear-app/document",{method:"POST",body:JSON.stringify({resource_id:t,format:"markdown"})},n);if(!e.ok)throw S(e,"the document","Linear");let r=C(e);if(r.type==="error"||!r.data)throw new E("JIRA_ISSUE_UNAVAILABLE",`could not fetch the document: ${k(r.message??"")||"document not found or not accessible"}`);return r.data}async function Fe(t,n={}){let e=await $("/linear-app/attachment",{method:"POST",body:JSON.stringify({attachment_id:t})},n);if(!e.ok)throw S(e,"the attachment","Linear");return{bytes:V(e).bytes}}var oe="kane.source.linear/1",ie="kane.source.linear-doc/1",Ft=/https:\/\/uploads\.linear\.app\/[^\s)"'`]+/g;function G(t){return t.replace(Ft,n=>{let e=n.indexOf("?");return e===-1?n:n.slice(0,e)})}function Ve(t,n){return t.id<n.id?-1:t.id>n.id?1:0}function Vt(t,n){return Ve(t,n)||(t.filename<n.filename?-1:t.filename>n.filename?1:0)||(t.url<n.url?-1:t.url>n.url?1:0)}function Ge(t,n,e){if(typeof t.id!="string"||t.id==="")throw new Error("cannot build a stable identity for this issue \u2014 the integrations service returned no issue id");let r=t.key;if(!/^[A-Za-z][A-Za-z0-9]*-\d+$/.test(r)){let c=String(r).replace(/[\u0000-\u001f\u007f-\u009f]/g,"").slice(0,80);throw new Error(`cannot build a stable identity for issue key "${c}" \u2014 expected a TEAM-NUMBER key`)}let s={},o=[...t.labels??[]].filter(c=>typeof c=="string").sort();o.length>0&&(s.labels=o.join(", ")),typeof t.priority=="string"&&t.priority!==""&&(s.priority=t.priority),typeof t.project=="string"&&t.project!==""&&(s.project=t.project),typeof t.status=="string"&&t.status!==""&&(s.status=t.status);let l=(t.attachments??[]).map(c=>({id:c.id!=null&&String(c.id)!==""?String(c.id):G(c.download??""),filename:c.filename??"",url:G(c.download??"")})).sort(Vt),u=n.map(c=>({id:String(c.id),author:c.author?.display_name??"",body:G(c.body??""),created:c.created??""})).sort((c,a)=>c.created!==a.created?c.created<a.created?-1:1:Ve(c,a)),i={schema:oe,site:e,team:r.slice(0,r.lastIndexOf("-")),issue:{uuid:t.id,key:r},content:{title:t.summary??"",description:G(t.description??""),fields:s},attachments:l,comments:u};return{bytes:Buffer.from(JSON.stringify(i),"utf8"),envelope:i,warnings:[]}}function Ye(t,n,e){if(typeof t.id!="string"||t.id==="")throw new Error("cannot build a stable identity for this document \u2014 the integrations service returned no document id");let r=(t.attachments??[]).map(o=>({url:G(o.download??String(o.id??"")),filename:o.filename??""})).sort((o,l)=>o.url<l.url?-1:o.url>l.url?1:0),s={schema:ie,site:n,document:{uuid:t.id,slug_id:e},project:{id:t.space?.key??""},title:t.title??"",content:{body:G(t.body??"")},attachments:r};return{bytes:Buffer.from(JSON.stringify(s),"utf8"),envelope:s,warnings:[]}}var Ke=64,Gt=16,Yt=6e6,Kt=5e7,Wt=12e6,se=64,We="https://uploads.linear.app/",Ht=/https:\/\/uploads\.linear\.app\/[^\s)"'`]+/g,zt={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},Xt=new Set(["png","jpeg","webp"]);async function He(t,n){let e=[],r=new Map,s=[],o=0,l=new Map,u=[];for(let i=0;i<t.length;i++){let c=t[i],a=`i${i+1}`,d=m=>`[img#${a}] ${c.label}${m?"":" \u2014 not delivered"}`,p=(m,I,L)=>{e.push({ref:a,loc:c.loc,media_type:m,...L?.blob?{blob:L.blob}:{},...L?.appearance?{appearance:L.appearance}:{},delivery:I,...L?.duplicate_of?{duplicate_of:L.duplicate_of}:{}})},y;try{y=await n(c.url)}catch{p("application/octet-stream","external-image-not-fetched"),u.push(d(!1));continue}let w=y.bytes,f=J(w),h=zt[f.format],_=B(w);if(r.set(_,w),!Xt.has(f.format)){let m=f.format==="gif"||f.format==="bmp"||f.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";p(h,m,{blob:_}),u.push(d(!1));continue}if(f.width===void 0||f.height===void 0||f.width*f.height>Kt){p(h,"undecodable",{blob:_}),u.push(d(!1));continue}let b;if(f.format==="png"||f.format==="jpeg"){let m=F(w,f.format);if(m===null){p(h,"undecodable",{blob:_}),u.push(d(!1));continue}b=M(m.data,{width:m.width,height:m.height,channels:m.channels})}if(f.width<Ke||f.height<Ke){p(h,"below-dimension-floor",{blob:_,appearance:b}),u.push(d(!1));continue}let g=l.get(_);if(g!==void 0){p(h,"duplicate",{blob:_,appearance:b,duplicate_of:g}),u.push(d(!1));continue}if(w.byteLength>Yt){p(h,"image-too-large",{blob:_,appearance:b}),u.push(d(!1));continue}if(o+w.byteLength>Wt){p(h,"vision-byte-budget-reached",{blob:_,appearance:b}),u.push(d(!1));continue}if(s.length>=Gt){p(h,"image-cap-reached",{blob:_,appearance:b}),u.push(d(!1));continue}l.set(_,a),o+=w.byteLength,s.push(a),p(h,"selected",{blob:_,appearance:b}),u.push(d(!0))}return{inventory:e,blobs:r,delivered:s,lines:u}}function Zt(t){let n=new Set,e=[];for(let r of t.match(Ht)??[])n.has(r)||(n.add(r),e.push(r));return e}function ze(t){return async n=>{let e;try{e=JSON.parse(n.toString("utf8"))}catch{throw new Error("LINEAR_ENVELOPE_SCHEMA: source bytes are not a kane linear envelope")}if(e.schema!==oe)throw new Error(`LINEAR_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${oe}`);let r=[],s=new Set;for(let a of Zt(e.content.description))s.add(a),r.push({url:a,label:a,loc:`body:${a}`});let o=[];for(let a of e.attachments)if(a.url.startsWith(We)){if(s.has(a.url)){if(a.filename!==""){let d=r.find(p=>p.url===a.url);d!==void 0&&d.label===d.url&&(d.label=a.filename)}continue}s.add(a.url),r.push({url:a.url,label:a.filename||a.url,loc:`attachment:${a.filename||a.url}`})}else a.url!==""&&o.push(`[${o.length+1}] ${a.filename||a.url} \u2014 ${a.url}`);let l=Math.max(0,r.length-se),u=await He(r.slice(0,se),t.fetchAttachment);l>0&&u.lines.push(`${l} more upload links not examined`);let i=[];i.push(`${e.issue.key} \xB7 ${e.site}`,`Title: ${e.content.title}`),e.content.description!==""&&i.push("",...e.content.description.split(`
11
- `));let c=Object.keys(e.content.fields);return c.length>0&&i.push("","--- fields ---",...c.map(a=>`${a}: ${e.content.fields[a]}`)),u.lines.length>0&&i.push("","--- images ---",...u.lines),o.length>0&&i.push("","--- links ---",...o),e.comments.length>0&&(i.push("","--- comments ---"),e.comments.forEach((a,d)=>{d>0&&i.push(""),i.push(`[${d+1}] ${a.author} \xB7 ${a.created}`,...a.body.split(`
12
- `))})),{projection:i.join(`
13
- `)+`
14
- `,inventory:u.inventory,blobs:u.blobs,delivered:u.delivered,converter:{name:"linear-convert",version:"1",policy:"v1"}}}}function Xe(t){return async n=>{let e;try{e=JSON.parse(n.toString("utf8"))}catch{throw new Error("LINEAR_DOC_ENVELOPE_SCHEMA: source bytes are not a kane linear document envelope")}if(e.schema!==ie)throw new Error(`LINEAR_DOC_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${ie}`);let r=new Set,s=[];for(let i of e.attachments)!i.url.startsWith(We)||r.has(i.url)||(r.add(i.url),s.push({url:i.url,label:i.filename||i.url,loc:`body:${i.url}`}));let o=Math.max(0,s.length-se),l=await He(s.slice(0,se),t.fetchAttachment);o>0&&l.lines.push(`${o} more upload links not examined`);let u=[];return u.push(`${e.title} \xB7 ${e.site}`),e.content.body!==""&&u.push("",...e.content.body.split(`
15
- `)),l.lines.length>0&&u.push("","--- images ---",...l.lines),{projection:u.join(`
16
- `)+`
17
- `,inventory:l.inventory,blobs:l.blobs,delivered:l.delivered,converter:{name:"linear-doc-convert",version:"1",policy:"v1"}}}}var qt=/^[A-Za-z][A-Za-z0-9]*-\d+$/,Qt=/-([0-9a-f]{12})$/;function ue(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}return n.hostname.toLowerCase()!=="linear.app"?null:n.pathname.split("/").filter(Boolean)}function Ze(t){let n=ue(t);return n===null||n.length<3?null:{workspace:n[0],segs:n}}function Y(t){let n=Ze(t);if(n===null||n.segs[1]!=="issue")return null;let e=n.segs[2];return qt.test(e)?{workspace:n.workspace,key:e}:null}function K(t){let n=Ze(t);if(n===null||n.segs[1]!=="document")return null;let e=n.segs[2].match(Qt);return e===null?null:{workspace:n.workspace,slugId:e[1]}}var en=new Set(["project","team","view","initiative","cycle","roadmap","inbox","triage","my-issues"]),qe=new Set(["docs","features","method","blog","customers","pricing","integrations","developers","changelog","about","careers","security","download","contact","now","switch","homepage"]);function le(t){let n=ue(t);return n===null||n.length<2||!en.has(n[1])||qe.has(n[0].toLowerCase())?null:{workspace:n[0],section:n[1]}}function de(t){let n=ue(t);return n===null||n.length<2||n[1]!=="issue"&&n[1]!=="document"||qe.has(n[0].toLowerCase())||Y(t)!==null||K(t)!==null?null:{workspace:n[0],section:n[1]}}function Qe(t){let n=Y(t);return n?n.key.toLowerCase():null}function et(t){let n=K(t);return n?`doc-${n.slugId}`:null}var tt={linearInfo:je,linearIssue:Be,linearComments:Me,linearDocument:Je,linearAttachment:Fe};function nt(t,n){if(t)try{let e=new URL(t).pathname.split("/").filter(Boolean)[0];if(e)return`linear.app/${e.toLowerCase()}`}catch{}return`linear.app/${n.toLowerCase()}`}function rt(t,n,e,r,s,o){let l=ee(t,r);if(l!==null&&typeof l.schema=="string"&&l.schema.startsWith(`kane.source.${n}/`)){let i=l;for(let c of e)i=i!==null&&typeof i=="object"?i[c]:void 0;if(typeof i=="string"&&i!==""&&i!==s)return`source '${r}' was ingested from a different ${o} that used this key \u2014 the key was recycled; retire it first (kane-cli context retire ${r}) or ingest under a different id with --as`}let u=ke(t,n,e,s);return u!==null&&u!==r?`this ${o} is already ingested as '${u}' (its key changed) \u2014 reconcile that source, or retire it to re-ingest under the new key`:null}function ot(t,n,e,r){let s=ee(t,e);if(s===null||typeof s.schema!="string"||!s.schema.startsWith(`kane.source.${n}/`))return null;let o=s.site;return typeof o!="string"||o.length===0||o===r?null:`source '${e}' was ingested from ${o}, but this read serves ${r} \u2014 retire it first (kane-cli context retire ${e}) or ingest under a different id with --as`}async function tn(t,n,e,r,s){let o=Y(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Linear issue URL (https://linear.app/<workspace>/issue/KEY-123)`),{code:1};let l=s?.linear??tt;try{let i={auth:await(s?.authEnv??(await import("./auth-3LLVDHOJ.js")).resolveLisAuthEnv)(),env:process.env},c=await l.linearInfo(i);if(!c.installed)return(e.err??e.out)(`error: ${t}: no Linear connection for this account \u2014 create one at ${A} and retry`),{code:1};if(c.capabilities.issue===!1||c.capabilities.comments===!1)return(e.err??e.out)(`error: ${t}: the connection cannot read issues or their comments yet \u2014 resync it at ${A} and retry`),{code:1};let a=await l.linearIssue(o.key,i),d=await l.linearComments(o.key,i),p=nt(a.host,o.workspace),{bytes:y,envelope:w,warnings:f}=Ge(a,d,p),h=n??o.key.toLowerCase();N(h);let _=rt(r,"linear",["issue","uuid"],h,w.issue.uuid,"issue")??P(r,h,"linear")??ot(r,"linear",h,p);if(_!==null)return(e.err??e.out)(`error: ${t}: ${_}`),{code:1};let b=await T({contextDir:r,bytes:y,media:Ee,sourceId:h,label:t,confirmSameSource:e.isTTY?g=>e.confirm(`identical content already ingested as ${g} \u2014 treat as the same source?`):void 0,converters:{linear:ze({fetchAttachment:g=>l.linearAttachment(g,i)})}});e.out(U(e.isTTY,b,w.issue.key));for(let g of f)e.out(`warning: ${g}`);for(let g of b.warnings??[])e.out(`warning: ${g}`);if(b.composite){let g=b.composite.delivered+b.composite.omitted;e.out(`${b.source_id}: linear, ${g} images, ${b.composite.delivered} delivered (${b.composite.omitted} omitted)`)}return{code:0,result:{status:b.status,source_id:b.source_id,source_cid:b.cid}}}catch(u){return u instanceof E?((e.err??e.out)(`error: ${t}: ${u.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${it(u instanceof Error?u.message:String(u),"issue","Linear")}`),{code:1})}}async function nn(t,n,e,r,s){let o=K(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Linear document URL (https://linear.app/<workspace>/document/<slug>)`),{code:1};let l=s?.linear??tt;try{let i={auth:await(s?.authEnv??(await import("./auth-3LLVDHOJ.js")).resolveLisAuthEnv)(),env:process.env},c=await l.linearInfo(i);if(!c.installed)return(e.err??e.out)(`error: ${t}: no Linear connection for this account \u2014 create one at ${A} and retry`),{code:1};if(c.capabilities.document===!1)return(e.err??e.out)(`error: ${t}: the connection cannot read documents yet \u2014 resync it at ${A} and retry`),{code:1};let a=await l.linearDocument(o.slugId,i),d=nt(a.url,o.workspace),{bytes:p,envelope:y,warnings:w}=Ye(a,d,o.slugId),f=n??`doc-${o.slugId}`;N(f);let h=rt(r,"linear-doc",["document","uuid"],f,y.document.uuid,"document")??P(r,f,"linear-doc")??ot(r,"linear-doc",f,d);if(h!==null)return(e.err??e.out)(`error: ${t}: ${h}`),{code:1};let _=await T({contextDir:r,bytes:p,media:_e,sourceId:f,label:t,confirmSameSource:e.isTTY?b=>e.confirm(`identical content already ingested as ${b} \u2014 treat as the same source?`):void 0,converters:{linearDoc:Xe({fetchAttachment:b=>l.linearAttachment(b,i)})}});e.out(U(e.isTTY,_,y.title||`document ${o.slugId}`));for(let b of w)e.out(`warning: ${b}`);for(let b of _.warnings??[])e.out(`warning: ${b}`);if(_.composite){let b=_.composite.delivered+_.composite.omitted;e.out(`${_.source_id}: linear document, ${b} images, ${_.composite.delivered} delivered (${_.composite.omitted} omitted)`)}return{code:0,result:{status:_.status,source_id:_.source_id,source_cid:_.cid}}}catch(u){return u instanceof E?((e.err??e.out)(`error: ${t}: ${u.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${it(u instanceof Error?u.message:String(u),"document","Linear")}`),{code:1})}}function it(t,n,e){let r=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return r?`the ${n}'s content is too large to ingest (${r[1]}; the limit is ${r[2]}) \u2014 trim the ${n} in ${e} and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?`the ${n}'s text is too large to ingest \u2014 trim the ${n} in ${e} and retry`:t}var st={name:"linear",hint:"Linear issue URLs (https://linear.app/<workspace>/issue/KEY-123)",match:t=>Y(t)!==null,ingest:tn,sourceIdFor:Qe},at={name:"linear-doc",hint:"Linear document URLs (https://linear.app/<workspace>/document/<slug>)",match:t=>K(t)!==null,ingest:nn,sourceIdFor:et},ct={name:"linear-page",hint:"Linear issue or document URLs (other linear.app pages are not ingestable)",match:t=>le(t)!==null||de(t)!==null,ingest:async(t,n,e)=>{let r=le(t);if(r===null){let s=de(t);return s!==null?((e.err??e.out)(`error: ${t}: this Linear ${s.section} link is incomplete or malformed \u2014 use the full form (https://linear.app/${s.workspace}/issue/KEY-123 or https://linear.app/${s.workspace}/document/<slug>-<id>)`),{code:1}):((e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Linear workspace page`),{code:1})}return(e.err??e.out)(`error: ${t}: this Linear page can't be ingested \u2014 only issue and document URLs are supported; ingest the project's issues or documents individually (https://linear.app/${r.workspace}/issue/KEY-123)`),{code:1}},sourceIdFor:()=>null};var rn=new Set(["invalid_url","target_disallowed","page_not_found","page_access_blocked","page_paywalled","unsupported_content_type","page_too_large","page_timeout","scrape_unavailable","scrape_rate_limited","internal_error","credit_denied"]);async function ut(t,n){let e=n.env??process.env,r=n.fetchImpl??fetch,s=we(e),o={"Content-Type":"application/json"},l=await n.authEnv(),u=l.TESTMUAI_BASIC_AUTH??e.TESTMUAI_BASIC_AUTH,i=l.TESTMUAI_API_KEY??e.TESTMUAI_API_KEY;u?o.Authorization=`Basic ${u}`:i&&(o.Authorization=`Bearer ${i}`);let c;try{c=await r(`${s}/assurance/web/scrape`,{method:"POST",headers:o,body:JSON.stringify({url:t}),signal:AbortSignal.timeout(n.timeoutMs??55e3)})}catch{return{ok:!1,kind:"transport_unreachable"}}if(c.status===401)return{ok:!1,kind:"auth_rejected"};let a;try{a=await c.json()}catch{return{ok:!1,kind:c.status===404?"route_missing":"malformed_response"}}if(c.ok){let p=a.page;return p===void 0||typeof p.markdown!="string"||p.markdown===""||typeof p.final_url!="string"||p.final_url===""||typeof p.projection?.kind!="string"||typeof p.projection?.version!="string"?{ok:!1,kind:"malformed_response"}:{ok:!0,page:p}}let d=a.code;return typeof d=="string"&&rn.has(d)?{ok:!1,kind:d}:c.status===404?{ok:!1,kind:"route_missing"}:c.status===403?{ok:!1,kind:"auth_rejected"}:{ok:!1,kind:"malformed_response"}}var pe="kane.source.web/1";function lt(t,n,e){if(e==="")throw new Error("cannot build a web source from an empty page projection");if(n.kind===""||n.version==="")throw new Error("cannot build a stable identity without a server-reported projection kind/version");let r={schema:pe,url:t,projection:{kind:n.kind,version:n.version},content:{markdown:e}};return{bytes:Buffer.from(JSON.stringify(r),"utf8"),envelope:r}}var on=new Set(["markdown"]);function dt(){return async t=>{let n;try{n=JSON.parse(t.toString("utf8"))}catch{throw new Error("this web source's stored envelope is not readable \u2014 re-ingest the page")}if(n.schema!==pe)throw new Error(`unknown web envelope schema '${String(n.schema)}' \u2014 re-ingest the page with this CLI version`);if(!on.has(n.projection?.kind??""))throw new Error(`unknown web projection kind '${String(n.projection?.kind)}' \u2014 update kane-cli to read this source`);if(typeof n.content?.markdown!="string"||n.content.markdown==="")throw new Error("this web source's stored envelope carries no content \u2014 re-ingest the page");return{projection:n.content.markdown,inventory:[],blobs:new Map,delivered:[],converter:{name:"web-convert",version:"1",policy:"markdown-passthrough"}}}}import{createHash as sn}from"crypto";function pt(t){return ae(t)!==null}function ae(t){if(!/^https?:\/\//i.test(t))return null;let n;try{n=new URL(t)}catch{return null}return n.hostname===""?null:(n.hash="",n.username="",n.password="",n.toString())}function me(t){let n=ae(t);if(n===null)return null;let e=new URL(n),r=(e.hostname+e.pathname).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40).replace(/-+$/,""),s=sn("sha256").update(n,"utf8").digest("hex").slice(0,8);return`${r||"page"}-${s}`}function an(t,n){let e=j(t),r=e.heads.get(n);if(r==null)return null;let s=e.getNode(r)?.content?.blob;if(typeof s!="string")return null;let o=W(t,s);if(o===null)return null;try{let l=JSON.parse(o.toString("utf8"));return l.schema!=="kane.source.web/1"?null:typeof l.url=="string"&&l.url.length>0?l.url:null}catch{return null}}function fe(t){switch(t){case"invalid_url":return"this is not a valid public HTTP or HTTPS page URL \u2014 check the address and try again";case"target_disallowed":return"that address cannot be fetched because it does not point to an allowed public web page";case"page_not_found":return"the page could not be found \u2014 check that the URL is correct and that the page still exists";case"page_access_blocked":return"the page refused automated access, so its contents could not be ingested \u2014 use a publicly accessible version of the page";case"page_paywalled":return"the page is behind a paywall or sign-in screen, so its full contents could not be ingested \u2014 use a publicly accessible copy";case"unsupported_content_type":return"the URL does not point to an HTML web page \u2014 download the document and ingest the supported file instead";case"page_too_large":return"the page contains too much text to ingest as a single source \u2014 use a narrower page or trim the content first";case"page_timeout":return"the page took too long to load \u2014 try again later";case"scrape_unavailable":case"scrape_rate_limited":case"internal_error":return"the page ingest service is temporarily unavailable \u2014 try again later";case"credit_denied":return"the page could not be ingested \u2014 your organization is out of credits";case"auth_rejected":return"your credentials were rejected \u2014 run `kane-cli login` and retry";case"route_missing":return"ingesting web pages is not available in your environment yet \u2014 nothing is wrong with the URL; try again later";case"transport_unreachable":return"the page ingest service could not be reached \u2014 check your connection and try again";case"malformed_response":return"the page ingest service returned a response that could not be read safely \u2014 try again later"}}function cn(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the page contains too much text to ingest as a single source (${n[1]}; the limit is ${n[2]}) \u2014 use a narrower page or trim the content first`:t.startsWith("PROJECTION_TOO_LARGE:")?"the page contains too much text to ingest as a single source \u2014 use a narrower page or trim the content first":t}async function un(t,n,e,r,s){let o=ae(t);if(o===null)return(e.err??e.out)(`error: ${t}: ${fe("invalid_url")}`),{code:1};let l=me(t),u=n??l;if(u===null)return(e.err??e.out)(`error: ${t}: ${fe("invalid_url")}`),{code:1};try{N(u)}catch(y){return(e.err??e.out)(`error: ${t}: ${y instanceof Error?y.message:String(y)}`),{code:1}}let i=P(r,u,"web");if(i!==null)return(e.err??e.out)(`error: ${t}: ${i}`),{code:1};let c=an(r,u);if(c!==null&&c!==o){if(!e.isTTY)return(e.err??e.out)(`error: ${t}: source '${u}' was ingested from ${c} \u2014 re-run on a TTY to adopt the new URL as its next version, or ingest under a different id with --as`),{code:1};if(!await e.confirm(`source '${u}' was ingested from ${c} \u2014 treat ${o} as its new version (replaces the current version; items built on it go stale)?`))return e.out(`skipped ${t} \u2014 ingest under a different id with --as to keep both pages`),{code:1}}let a=s?.web?.scrape??ut,d=s?.authEnv??(async()=>(await import("./spawner-R3XOP3GP.js")).resolveAgentAuthEnv()),p=await a(o,{authEnv:d});if(!p.ok)return(e.err??e.out)(`error: ${t}: ${fe(p.kind)}`),{code:1};try{let{bytes:y}=lt(o,p.page.projection,p.page.markdown),w=await T({contextDir:r,bytes:y,media:be,sourceId:u,label:o,confirmSameSource:e.isTTY?h=>e.confirm(`identical content already ingested as ${h} \u2014 treat as the same source?`):void 0,converters:{web:dt()}}),f=new URL(o).hostname+new URL(o).pathname;e.out(U(e.isTTY,w,f));for(let h of w.warnings??[])e.out(`warning: ${h}`);return e.isTTY&&p.page.title&&e.out(` title: ${p.page.title}`),{code:0,result:{status:w.status,source_id:w.source_id,source_cid:w.cid}}}catch(y){return(e.err??e.out)(`error: ${t}: ${cn(y instanceof Error?y.message:String(y))}`),{code:1}}}var mt={name:"web",hint:"any public web page URL (https://\u2026)",match:pt,ingest:un,sourceIdFor:me};function U(t,n,e){return t?n.status==="created"?`landed ${n.source_id} (${e}) \u2014 new source`:n.status==="versioned"?`landed ${n.source_id} (${e}) \u2014 new version; dependents go stale`:`${n.source_id} unchanged \u2014 already landed`:`${n.status} ${n.source_id} source ${n.cid} blob ${n.blob}`}var ln=[Oe,De,st,at,ct,mt];function Kr(t){return/^https?:\/\/.+/i.test(t)}function Wr(t){return ln.find(n=>n.match(t))??null}export{U as a,ln as b,Kr as c,Wr as d};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as be}from"./chunk-JQW2QFSX.js";import{a as xe,b as Re}from"./chunk-6FCPS2VT.js";import{a as se,b as q,d as ue}from"./chunk-UH2ZTX4E.js";import{a as Ne,b as Ee,g as le,j as ee}from"./chunk-XMTSHHYQ.js";import{d as te,e as w,f as re,g as oe,h as de}from"./chunk-AKX4VRRR.js";function Me(r,s){let t=r.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(t.length>60){let o=t.lastIndexOf("-",60);t=(o>0?t.slice(0,o):t.slice(0,60)).replace(/-+$/g,"")}if(!ae.test(t))return null;let e=t;for(let o=2;s(e);o++)e=`${t}-${o}`;return ae.test(e)?e:null}var Ve={source:"src",usecase:"uc",scenario:"sc",ac:"ac",test:"t",gap:"gap",stylenote:"sty"};function ze(r,s,t){let e=Ve[r];return Me(e?`${e} ${s}`:s,t)}var Pe={usecase:"uc",scenario:"sc",ac:"ac",test:"t",gap:"gap",stylenote:"sty"},Oe=/^(uc|sc|ac|t|gap|sty)-\d+$/i;function we(r,s,t){let e=Pe[r];if(!e)return null;let o=new RegExp(`^${e}-(\\d+)$`),d=0;for(let p of t){let l=o.exec(p);if(!l)continue;let n=Number(l[1]);Number.isSafeInteger(n)&&n>d&&(d=n)}let c=d+1;for(;s(`${e}-${c}`);)c+=1;return`${e}-${c}`}var Le=/^L([1-9]\d*)-L([1-9]\d*)$/,Ge=/^img#(p[1-9]\d*-[1-9]\d*|i[1-9]\d*)$/;function pe(r){if(r==="img#whole")return{kind:"img-whole"};let s=Ge.exec(r);if(s)return{kind:"img-part",ref:s[1]};let t=Le.exec(r);return t?{kind:"lines",a:parseInt(t[1],10),b:parseInt(t[2],10)}:null}function Ue(r,s){let t=/^L(\d+)-L(\d+)$/.exec(s);if(!t)return null;let e=parseInt(t[1],10),o=parseInt(t[2],10),d=r.split(`
3
- `);return e<1||o<e||o>d.length?null:d.slice(e-1,o).map(c=>c.replace(/^\d+\| /,"")).join(`
4
- `)}function Te(r,s,t){let e=pe(s.anchor);if(r.format==="image")return e?.kind==="img-whole"?[]:[{code:"CITE_ANCHOR_INVALID",detail:`image cites are anchor-only (img#whole), got ${s.anchor}`}];if(e?.kind==="img-part")return new Set((r.images??[]).map(c=>c.ref)).has(e.ref)?[]:[{code:"CITE_ANCHOR_INVALID",detail:`anchor ${s.anchor} names no embedded image of this source version`}];if(!s.anchor||s.quote===void 0||s.quote==="")return[{code:"MISSING_CITE",detail:"text-kind cites need anchor+quote"}];let o=t!==null?Ue(t,s.anchor):null;return o===null?[{code:"BAD_ANCHOR",detail:`anchor ${s.anchor} does not resolve in the source`}]:o.includes(s.quote)?[]:[{code:"QUOTE_MISMATCH",detail:`quote is not verbatim within ${s.anchor}`}]}import{existsSync as Fe,readFileSync as He}from"fs";function dt(r){let s=Re(r),t=new Map(Object.entries(s.heads)),e=new Map(Object.entries(s.trust)),o=new Map(Object.entries(s.nodeLabel)),d=new Map(Object.entries(s.superseded)),c=new Map(Object.entries(s.names)),p=new Map(Object.entries(s.archivedReason)),l=new Set(s.appliedEvents),n=new Map(Object.entries(s.conv)),m=g=>s.media[g]??{format:"text",media_type:"text/plain",anchors_supported:["L-L"]},f=new Map;for(let[g,_]of c)f.set(_,g);let a=new Map,S=g=>{if(a.has(g))return a.get(g);if(!o.has(g))return a.set(g,null),null;let _=xe(r,g);if(!Fe(_))throw new Ne(`derived node file missing for ${g} \u2014 run kane-cli context rebuild`);let I=JSON.parse(He(_,"utf8"));return a.set(g,I),I},v=g=>{let _=g,I=new Set;for(;d.has(_)&&!I.has(_);){I.add(_);let O=d.get(_);if(typeof O!="string")break;_=O}return _},N=null,y=g=>{let _=f.get(g);if(_!==void 0)return _;if(N===null){N=new Map;for(let[G,D]of d)typeof D=="string"&&N.set(D,G)}let I=new Set,O=g;for(;!I.has(O);){I.add(O);let G=N.get(O);if(G===void 0)return null;let D=f.get(G);if(D!==void 0)return D;O=G}return null},b=g=>{Oe.test(g)&&(g=g.toLowerCase());let _=t.get(g),I=o.has(g)?g:c.get(g)??(typeof _=="string"?_:void 0);if(I===void 0||!o.has(I))return null;let O=v(I);return{cid:I,tip:O,superseded:d.has(I)||d.has(O)}},V=new Map;for(let g of Object.values(s.forward))for(let _ of g){let I=V.get(_.dst);I?I.push(_):V.set(_.dst,[_])}let A=g=>(g??[]).filter(_=>!d.has(_.ecid)),K=g=>A(V.get(g)),P=g=>K(g).filter(_=>_.type===w.DERIVES),J=g=>A(s.forward[g]).some(_=>oe(_.type)?.pin?.comparesTo==="dst_tip"&&d.has(_.dst)),ie=g=>{if(d.has(g))return"superseded";let _=P(g);if(_.length===0)return J(g)?"stale":"fresh";let I=new Map;for(let D of _)I.set(D.props.source_id,D);let O=!1,G=!1;for(let[D,k]of I){let U=t.get(D);if(U!=null&&(O=!0,U!==k.props.source_cid)){let i=n.get(D)?.chain;(!i||!i.includes(k.props.source_cid))&&(G=!0)}}return O?G||J(g)?"stale":"fresh":"orphaned"};return{heads:t,trust:e,nodeLabel:o,superseded:d,names:c,nameOf:f,archivedReason:p,appliedEvents:l,convChains:n,mediaOf:m,extractedSourceCids:new Set(s.extracted),extractionCompleteness:new Map(Object.entries(s.completeness??{}).map(([g,{seq:_,...I}])=>[g,I])),designOf:new Map(Object.entries(s.design_of??{})),designGenerationOf:new Map(Object.entries(s.design_generation??{})),latestHash:s.applied.hash,lastSeq:s.applied.seq,hasNode:g=>o.has(g),getNode:S,byLabel:g=>[...o.entries()].filter(([,_])=>_===g).map(([_])=>({cid:_,content:S(_)?.content??{}})),edgesFrom:g=>A(s.forward[g]),edgesInto:K,derivesInto:P,resolve:b,tipOf:v,displayNameOf:y,stale:ie,staleList:()=>[...o.keys()].map(g=>({cid:g,state:ie(g)})).filter(g=>g.state!=="fresh"),execHistory:g=>{let _=b(g);if(!_)return[];let I=v(_.cid),O=new Set([I]),G=!0;for(;G;){G=!1;for(let[k,U]of d)U!==null&&O.has(U)&&!O.has(k)&&(O.add(k),G=!0)}let D=[];for(let k of Object.entries(s.exec??{}))O.has(k[0])&&D.push(...k[1]);return D.sort((k,U)=>k.started_at<U.started_at?-1:1)},retractedEdgesTouching:g=>{let _=new Set([v(g),g]),I=!0;for(;I;){I=!1;for(let[k,U]of d)typeof U=="string"&&_.has(U)&&!_.has(k)&&(_.add(k),I=!0)}let O=s.edgeRetractions??{},G=[],D=new Set;for(let k of _)for(let U of[...s.forward[k]??[],...V.get(k)??[]]){let i=O[U.ecid];!i||D.has(U.ecid)||(D.add(U.ecid),G.push({...U,retraction:i}))}return G}}}function at(r,s){if(r.stale(s)!=="stale")return!1;let t=new Map;for(let e of r.derivesInto(s))t.set(e.props.source_id,e);for(let[e,o]of t){let d=r.heads.get(e);if(d==null||d===o.props.source_cid)continue;let c=r.convChains.get(e)?.chain;if(!c||!c.includes(o.props.source_cid))return!0}for(let e of r.edgesFrom(s)){if(oe(e.type)?.pin?.comparesTo!=="dst_tip"||!r.superseded.has(e.dst))continue;let o=r.tipOf(e.dst);if(r.superseded.has(o)||r.nodeLabel.get(o)==="usecase")return!0}return!1}function fe(r,s){let t=new Map;for(let[c,p]of r.superseded)typeof p=="string"&&p!==c&&t.set(p,[...t.get(p)??[],c]);let e=[],o=[s],d=new Set;for(;o.length>0;){let c=o.pop();d.has(c)||(d.add(c),e.push(c),o.push(...t.get(c)??[]))}return e}function je(r,s){return(r.extraction_claims??[]).some(t=>t.source_id===s&&t.completeness==="complete")}function qe(r,s){let t=new Set;for(let e of fe(r,s))for(let o of r.derivesInto(e))t.add(o.props?.source_id??"conversation");return t}function ve(r,s){let t=[],e=[],o=r.archived??[];if(o.length===0)return{valid:t,errors:e};let d=new Set([...r.source?[r.source.source_id]:[],...(r.sources??[]).map(p=>p.source_id)]),c=new Set;for(let p of r.use_cases){if(!p.matches_existing)continue;let l=s.resolve(p.matches_existing.cid);l&&c.add(s.tipOf(l.cid))}for(let p of o){let l=`archived[${p.target}]`,n=s.resolve(p.target),m=n?s.tipOf(n.cid):null;if(!m||(s.trust.get(m)??null)==="archived"){e.push({code:"ARCHIVE_TARGET_UNKNOWN",detail:`${l}: target does not resolve to an existing, live item`});continue}let f=qe(s,m);if(!f.has(p.basis)){e.push({code:"ARCHIVE_FOREIGN_PROVENANCE",detail:`${l}: its provenance does not include ${p.basis} \u2014 an archive claim must come from a source that evidences the item`});continue}if(!d.has(p.basis)){e.push({code:"ARCHIVE_WITHOUT_COMPLETE_CLAIM",detail:`${l}: ${p.basis} was not read by this extraction \u2014 a completeness claim only counts for a source this run actually read`});continue}if(!je(r,p.basis)){e.push({code:"ARCHIVE_WITHOUT_COMPLETE_CLAIM",detail:`${l}: archiving needs an EXPLICIT complete extraction claim for ${p.basis} (the omitted-claims default does not count) \u2014 add extraction_claims`});continue}if(c.has(m)){e.push({code:"ARCHIVE_TARGET_MATCHED",detail:`${l}: this proposal also matches the target via matches_existing \u2014 a matched item cannot be archived by the same extraction; propose the change as an update instead`});continue}let a=[...f].filter(S=>S!==p.basis);if(a.length>0){e.push({code:"ARCHIVE_OTHER_LIVE_EVIDENCE",detail:`${l}: still evidenced by ${a.join(", ")} \u2014 an item another live source evidences is never archived from here`});continue}t.push({op:p,cid:m})}return{valid:t,errors:e}}function Se(r,s,t){return r.superseded.has(t)}function ke(r){let{graph:s,oldTip:t,newCid:e,newLabel:o,by:d}=r,c=[],p=[],l=[],n=[],m=new Set;for(let f of s.edgesFrom(t)){if(f.type===w.DERIVES||r.skipEcids?.has(f.ecid))continue;p.push({kind:"edge",ecid:f.ecid,reason:r.reason,by:d}),m.add(f.ecid);let a=r.dstRedirect?.get(f.dst)??f.dst,S=s.nodeLabel.get(f.dst)??"(unknown)",v=de(f.type,o,S,f.props);if(v.length>0){l.push(`rebless ${f.type} \u2192 ${f.dst}: ${v.map(b=>b.detail).join("; ")}`);continue}let N=be(s,{type:f.type,src:e,dst:a},{pending:n,retracted:m},`rebless ${f.type}`);if(N){l.push(N.detail);continue}let y=q(f.type,e,a,f.props);if(s.superseded.has(y)){l.push(`rebless ${f.type} \u2192 ${a}: the re-derived edge (${y}) was retracted \u2014 retraction is terminal, the successor cannot revive it`);continue}c.push({ecid:y,type:f.type,src:e,dst:a,props:f.props}),n.push({src:e,dst:a,type:f.type})}return{edges:c,supersessions:p,errors:l}}var ae=/^[a-z0-9][a-z0-9-]{1,63}$/;function De(r,s,t,e){if(!s)return{error:{code:"SUPERSEDE_TARGET_MISSING",detail:"supersede verdict needs a target (slug or cid)"}};let o=r.resolve(s);return o?o.superseded||e.has(o.cid)?{error:{code:"ALREADY_SUPERSEDED",detail:`${s} is already superseded (tip: ${o.tip})`}}:o.cid===t?{error:{code:"SELF_SUPERSEDE",detail:"a node cannot supersede itself"}}:{targetCid:o.cid}:{error:{code:"UNKNOWN_SUPERSEDE_TARGET",detail:`${s} names nothing in the graph`}}}function Ke(r,s,t,e,o=[]){if(!oe(s)?.acyclic)return null;if(t===e)return{code:"EDGE_CYCLE",detail:`${s} ${t} \u2192 itself`};let c=n=>[...r.edgesFrom(n).filter(m=>m.type===s).map(m=>m.dst),...o.filter(m=>m.type===s&&m.src===n).map(m=>m.dst)],p=new Set,l=[e];for(;l.length>0;){let n=l.pop();if(n===t)return{code:"EDGE_CYCLE",detail:`${s} ${t} \u2192 ${e} closes a cycle`};p.has(n)||(p.add(n),l.push(...c(n)))}return null}function Rt(r,s,t,e){let d=oe(s)?.cardinality;if(d!=="one-live-per-src"&&d!=="one-live-per-src-and-dst")return null;let c=r.edgesFrom(t).filter(p=>p.type===s&&!r.superseded.has(p.dst));if(c.length>0)return{code:"CARDINALITY_VIOLATION",detail:`${s} from ${t} already has a live edge (${c[0].ecid}) \u2014 supersede it first`};if(d==="one-live-per-src-and-dst"&&e!==void 0){let p=r.edgesInto(e).filter(l=>l.type===s&&!r.superseded.has(l.src));if(p.length>0)return{code:"CARDINALITY_VIOLATION",detail:`${s} onto ${e} already has a live edge (${p[0].ecid}) \u2014 strict 1:1, supersede it first`}}return null}var Ie=new Set(["high","med","low"]),ge=r=>r.cites&&r.cites.length>0?r.cites:[r.cite];function he(r){let s=0;for(let t of r)typeof t=="object"&&t!==null&&"op"in t&&s++;return s===0?"flat":s===r.length?"ops":"mixed"}var We=/^c[1-9][0-9]*$/;function Ae(r,s,t,e){let o=new Map,d=[],c=[];for(let[l,n]of s.entries()){let m=`${r}.updated.criteria[${l}]`;if(n.op==="keep"||n.op==="remove"){if(!We.test(n.ref??"")){e.push({code:"CRITERIA_REF_UNKNOWN",detail:`${m}: ref ${JSON.stringify(n.ref)} is not a c<N> criterion index`});continue}if(o.has(n.ref)){e.push({code:"CRITERIA_REF_DUPLICATE",detail:`${m}: ${n.ref} is already named by another op \u2014 every prior criterion appears in exactly one keep or remove`});continue}o.set(n.ref,n);let f=Number.parseInt(n.ref.slice(1),10);if(f>t.length){e.push({code:"CRITERIA_REF_UNKNOWN",detail:`${m}: ${n.ref} \u2014 the live target has ${t.length} criteria`});continue}if(t[f-1]!==n.text){e.push({code:"CRITERIA_REF_MISMATCH",detail:`${m}: ${n.ref} echo mismatch \u2014 the live target's criterion ${f} reads ${JSON.stringify(t[f-1])}, the op echoed ${JSON.stringify(n.text)} \u2014 re-read the node and re-emit`});continue}n.op==="remove"&&(d.push(n.text),(!n.reason||!n.reason.trim())&&e.push({code:"EMPTY_REASON",detail:`${m}: a remove op carries its reason`}))}else!n.text||!n.text.trim()?e.push({code:"EMPTY_CRITERION",detail:`${m}: set text is empty`}):c.push(n.text)}let p=[];for(let l=1;l<=t.length;l++)o.has(`c${l}`)||p.push(`c${l}`);p.length>0&&e.push({code:"CRITERIA_PARTITION_INCOMPLETE",detail:`${r}: prior criteria ${p.join(", ")} named by no keep/remove op \u2014 every prior criterion must be kept or removed (with a reason)`});for(let l of d)c.includes(l)&&e.push({code:"CRITERIA_OP_CONFLICT",detail:`${r}: ${JSON.stringify(l)} is removed AND re-set in the same update \u2014 drop one of the two ops`})}function bt(r,s,t){let e=[],o=r.sources??[r.source],d=new Map(o.map(n=>[n.source_id,n.source_cid])),c=new Map;if(typeof s=="string")c.set(r.source.source_id,{media:t.mediaOf(r.source.source_cid),numberedText:s});else for(let[n,m]of s)c.set(n,m);for(let n of o)t.hasNode(n.source_cid)||e.push({code:"MISSING_SOURCE_NODE",detail:`source ${n.source_id} (${n.source_cid}) is not a committed node \u2014 ingest it first`});let p=(n,m)=>{let f=m.source_id??r.source.source_id;if(!d.has(f)){e.push({code:"CITE_SOURCE_UNKNOWN",detail:`${n}: cite source ${JSON.stringify(f)} is not in read_basis`});return}let a=c.get(f);if(!a){e.push({code:"MISSING_SOURCE_NODE",detail:`${n}: no citable text available for source ${f}`});return}for(let S of Te(a.media,m,a.numberedText))e.push({code:S.code,detail:`${n}: ${S.detail}`})},l=new Set;for(let n of r.use_cases){if(l.has(n.temp_ref)&&e.push({code:"DUP_TEMP_REF",detail:`duplicate temp_ref ${n.temp_ref}`}),l.add(n.temp_ref),(!n.title||!n.title.trim())&&e.push({code:"EMPTY_TITLE",detail:`${n.temp_ref}: title is empty`}),Ie.has(n.risk)||e.push({code:"BAD_RISK",detail:`${n.temp_ref}: risk ${JSON.stringify(n.risk)} not in high|med|low`}),!n.cite||!n.cite.anchor)e.push({code:"MISSING_CITE",detail:`${n.temp_ref}: every derived use-case must carry a cite`});else for(let f of ge(n))p(n.temp_ref,f);n.matches_existing&&!t.hasNode(n.matches_existing.cid)&&e.push({code:"UNKNOWN_MATCH",detail:`${n.temp_ref}: matches_existing ${n.matches_existing.cid} is not in the graph`});for(let[f,a]of(n.criteria??[]).entries())(!a.text||!a.text.trim())&&e.push({code:"EMPTY_CRITERION",detail:`${n.temp_ref}.criteria[${f}]: text is empty`}),!a.cite||!a.cite.anchor?e.push({code:"MISSING_CITE",detail:`${n.temp_ref}.criteria[${f}]: every criterion carries its own cite`}):p(`${n.temp_ref}.criteria[${f}]`,a.cite);let m=n.updated?.criteria??[];if(m.length>0){let f=he(m);if(f==="mixed")e.push({code:"CRITERIA_SHAPE_MIXED",detail:`${n.temp_ref}.updated.criteria mixes op-shaped (keep/set/remove) and {text, cite} entries \u2014 emit ONE shape for the whole array`});else if(f==="ops"){let a=m,S=n.matches_existing?Ye(t,n.matches_existing.cid):null;if(!S)e.push({code:"CRITERIA_REF_UNKNOWN",detail:`${n.temp_ref}: op-union criteria address a prior version \u2014 they need a resolvable matches_existing target`});else{let v=t.getNode(S.cid)?.content.criteria??[];Ae(n.temp_ref,a,v,e)}for(let[v,N]of a.entries())N.op==="set"&&(!N.cite||!N.cite.anchor?e.push({code:"MISSING_CITE",detail:`${n.temp_ref}.updated.criteria[${v}]: a set op carries the proposing source's cite`}):p(`${n.temp_ref}.updated.criteria[${v}]`,N.cite))}else for(let[a,S]of m.entries())(!S.text||!S.text.trim())&&e.push({code:"EMPTY_CRITERION",detail:`${n.temp_ref}.updated.criteria[${a}]: text is empty`}),!S.cite||!S.cite.anchor?e.push({code:"MISSING_CITE",detail:`${n.temp_ref}.updated.criteria[${a}]: every updated criterion carries its own cite`}):p(`${n.temp_ref}.updated.criteria[${a}]`,S.cite)}}return e.push(...ve(r,t).errors),e}function Be(r,s,t){return`${r}:${s}:${t}`}function Je(r,s,t,e){let o=`${s}:${t}:`,d=0;for(let c of r.appliedEvents){if(!c.startsWith(o))continue;let p=c.slice(o.length);if(!/^\d+$/.test(p))continue;let l=Number.parseInt(p,10);l>d&&(d=l)}return Array.from({length:e},(c,p)=>Be(s,t,d+1+p))}function Ye(r,s){let t=r.resolve(s);if(t===null)return null;let e=t.cid;if(r.superseded.has(e)){let o=r.tipOf(e);return r.superseded.has(o)?null:{cid:o,redirected:!0}}return{cid:e,redirected:!1}}function Ot(r){let{contextDir:s,graph:t,proposal:e,proposalId:o,verdicts:d,by:c,allowStaleBasis:p,extractorVersion:l,autoName:n}=r,m=le(s);if(!p&&e.read_basis!==m)return{record:null,errors:[{code:"STALE_BASIS",detail:`proposal read_basis ${String(e.read_basis)} != latest ${String(m)}`}]};for(let i of e.sources??[e.source])if(!t.hasNode(i.source_cid))return{record:null,errors:[{code:"MISSING_SOURCE_NODE",detail:`source ${i.source_id} (${i.source_cid}) is not a committed node \u2014 ingest it first`}]};let f=new Map((e.sources??[e.source]).map(i=>[i.source_id,i.source_cid])),a=[],S=[],v=new Map,N=[],y=t.mediaOf(e.source.source_cid),b=new Set,V=[],A=[],K=[],P=[];for(let i of ve(e,t).valid)P.push({id:i.cid,kind:"pending_archive",resolution:"pending",edit:null,reason:i.op.reason,by:c});let J=[],ie=[],g=new Set,_=new Set,I=(i,h,F)=>{let Y=De(t,h.supersedeTarget,F,g);if("error"in Y){a.push({code:Y.error.code,detail:`${i}: ${Y.error.detail}`});return}g.add(Y.targetCid),J.push({kind:"node",old:Y.targetCid,new:F,reason:h.reason??`superseded via review by ${c.id}`,by:c})};for(let i of e.use_cases){let h=d.get(i.temp_ref)??{resolution:"skipped"};b.has(i.temp_ref)&&a.push({code:"DUP_TEMP_REF",detail:`duplicate temp_ref ${i.temp_ref}`}),b.add(i.temp_ref),(!i.title||!i.title.trim())&&a.push({code:"EMPTY_TITLE",detail:`${i.temp_ref}: title is empty`}),Ie.has(i.risk)||a.push({code:"BAD_RISK",detail:`${i.temp_ref}: risk ${JSON.stringify(i.risk)} not in high|med|low`});let F=pe(i.cite?.anchor??""),Y=i.cite?.source_id!==void 0&&f.has(i.cite.source_id)?t.mediaOf(f.get(i.cite.source_id)):y;if(Y.format==="image"){if(F?.kind!=="img-whole"){a.push({code:i.cite?.anchor?"CITE_ANCHOR_INVALID":"MISSING_CITE",detail:`${i.temp_ref}: image cites are anchor-only (img#whole)`});continue}}else if(F?.kind==="img-part"){if(!(Y.images??[]).some(E=>E.ref===F.ref)){a.push({code:"CITE_ANCHOR_INVALID",detail:`${i.temp_ref}: anchor ${i.cite?.anchor} names no embedded image of this source version`});continue}}else if(!i.cite||!i.cite.anchor||!i.cite.quote){a.push({code:"MISSING_CITE",detail:`${i.temp_ref}: every derived use-case must cite anchor+quote`});continue}h.resolution==="edited"&&h.edit&&(h.edit.title!==void 0&&!h.edit.title.trim()&&a.push({code:"EMPTY_TITLE",detail:`${i.temp_ref}: edited title is empty`}),h.edit.risk!==void 0&&!Ie.has(h.edit.risk)&&a.push({code:"BAD_RISK",detail:`${i.temp_ref}: edited risk ${JSON.stringify(h.edit.risk)} invalid`}));let me=ue({title:h.edit?.title??i.title,description:i.description,summary:h.edit?.summary??i.summary,actors:i.actors,value:i.value,risk:h.edit?.risk??i.risk,...i.criteria&&i.criteria.length>0?{criteria:i.criteria.map(u=>u.text)}:{}}),x=se("usecase",me),_e=i.cite.source_id??e.source.source_id,Ce=f.get(_e);if(i.cite.source_id!==void 0&&Ce===void 0){a.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: cite source ${JSON.stringify(_e)} is not in read_basis`});continue}let Z={source_id:_e,source_cid:Ce??e.source.source_cid,anchor:i.cite.anchor,...i.cite.quote?{quote:i.cite.quote}:{}};if(i.matches_existing&&!t.hasNode(i.matches_existing.cid)){a.push({code:"UNKNOWN_MATCH",detail:`${i.temp_ref}: matches_existing ${i.matches_existing.cid} is not in the graph`});continue}let R=i.matches_existing?.cid??(t.hasNode(x)?x:null);if(R&&t.superseded.has(R)){let u=t.tipOf(R);R=t.superseded.has(u)?null:u}if(R&&i.matches_existing&&(t.trust.get(R)??null)==="derived"){let u=i.updated?.criteria??[];if(i.changed&&u.length>0&&he(u)==="ops"&&(h.resolution==="approved"||h.resolution==="edited")){a.push({code:"UC_UNREVIEWED",detail:`${i.temp_ref}: merge target ${R.slice(0,19)} is unreviewed (derived) \u2014 bless it first (kane-cli context review) and re-propose the merge`});continue}let E=(r.probeHits??[]).find(C=>C.tempRef===i.temp_ref&&C.candidateCid===R);N.push({tempRef:i.temp_ref,candidate_cid:R,score:E?.score??1,scorer:E?.scorer??"lexical_fallback"}),R=null}if(R){if(i.changed&&(h.resolution==="approved"||h.resolution==="edited")){let u=i.updated;if(!u||Object.keys(u).length===0){a.push({code:"CHANGED_NEEDS_PAYLOAD",detail:`${i.temp_ref}: changed:true needs an updated{...} payload naming the moved fields`});continue}let E=t.getNode(R)?.content??{},C=u.criteria??[],M=C.length>0?he(C):"flat";if(M==="mixed"){a.push({code:"CRITERIA_SHAPE_MIXED",detail:`${i.temp_ref}.updated.criteria mixes op-shaped (keep/set/remove) and {text, cite} entries \u2014 emit ONE shape for the whole array`});continue}if(M==="ops"){let L=C,H=E.criteria??[],j=a.length;Ae(i.temp_ref,L,H,a);for(let[ne,ce]of L.entries())ce.op==="set"&&(!ce.cite||!ce.cite.anchor)&&a.push({code:"MISSING_CITE",detail:`${i.temp_ref}.updated.criteria[${ne}]: a set op carries the proposing source's cite`});if(a.length>j)continue;let T=L.filter(ne=>ne.op!=="remove").map(ne=>ne.text),B=ue({title:h.edit?.title??u.title??String(E.title??i.title),...u.description??E.description?{description:u.description??E.description}:{},...h.edit?.summary??u.summary??E.summary?{summary:h.edit?.summary??u.summary??E.summary}:{},...u.actors??E.actors?{actors:u.actors??E.actors}:{},...u.value??E.value?{value:u.value??E.value}:{},risk:h.edit?.risk??u.risk??String(E.risk??i.risk),...T.length>0?{criteria:T}:{}}),Q=se("usecase",B);if(Q!==R){for(let $ of re("usecase",B))a.push({code:$.code,detail:`${i.temp_ref}: ${$.detail}`});V.push({cid:Q,label:te.USECASE,content:B});for(let $ of ge(i)){let X=$.source_id??e.source.source_id,W=f.get(X);if(!W){a.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: cite source ${JSON.stringify(X)} is not in read_basis`});continue}let z={source_id:X,source_cid:W,anchor:$.anchor,...$.quote?{quote:$.quote}:{}};A.push({ecid:q("DERIVES",W,Q,z),type:w.DERIVES,src:W,dst:Q,props:z})}let ce=fe(t,R).flatMap($=>t.edgesInto($)).filter($=>$.type===w.DERIVES&&typeof $.props.claim=="string");for(let $ of L){if($.op!=="keep")continue;let X=new Set;for(let W of ce){let z=W.props;if(z.claim!==$.text)continue;let $e=`${z.source_id}|${z.source_cid}|${z.anchor}`;if(X.has($e))continue;X.add($e);let ye={...W.props};A.push({ecid:q("DERIVES",W.src,Q,ye),type:w.DERIVES,src:W.src,dst:Q,props:ye})}}for(let $ of L){if($.op!=="set")continue;let X=$.cite.source_id??e.source.source_id,W=f.get(X);if(!W){a.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: set cite source ${JSON.stringify(X)} is not in read_basis`});continue}let z={source_id:X,source_cid:W,anchor:$.cite.anchor,...$.cite.quote?{quote:$.cite.quote}:{},claim:$.text};A.push({ecid:q("DERIVES",W,Q,z),type:w.DERIVES,src:W,dst:Q,props:z})}for(let $ of L)$.op==="remove"&&S.push({about:R,ref:$.ref,text:$.text,reason:$.reason});I(i.temp_ref,{resolution:"supersede",supersedeTarget:R,reason:h.reason??`criteria merge: ${e.source.source_id} (${L.filter($=>$.op==="keep").length} kept, ${L.filter($=>$.op==="set").length} set, ${L.filter($=>$.op==="remove").length} removed)`},Q),P.push({id:Q,kind:"review-item",resolution:h.resolution,edit:h.resolution==="edited"?{...h.edit}:null,reason:null,by:c});continue}}else{let L=C.map(T=>typeof T=="string"?{text:T,cite:void 0}:T),H=ue({title:h.edit?.title??u.title??String(E.title??i.title),...u.description??E.description?{description:u.description??E.description}:{},...h.edit?.summary??u.summary??E.summary?{summary:h.edit?.summary??u.summary??E.summary}:{},...u.actors??E.actors?{actors:u.actors??E.actors}:{},...u.value??E.value?{value:u.value??E.value}:{},risk:h.edit?.risk??u.risk??String(E.risk??i.risk),...u.criteria?L.length>0?{criteria:L.map(T=>T.text)}:{}:E.criteria?{criteria:E.criteria}:{}}),j=se("usecase",H);if(j!==R){for(let T of re("usecase",H))a.push({code:T.code,detail:`${i.temp_ref}: ${T.detail}`});V.push({cid:j,label:te.USECASE,content:H}),A.push({ecid:q("DERIVES",Z.source_cid,j,Z),type:w.DERIVES,src:Z.source_cid,dst:j,props:Z});for(let T of L){if(!T.cite)continue;let B={source_id:e.source.source_id,source_cid:e.source.source_cid,anchor:T.cite.anchor,...T.cite.quote?{quote:T.cite.quote}:{},claim:T.text};A.push({ecid:q("DERIVES",B.source_cid,j,B),type:w.DERIVES,src:B.source_cid,dst:j,props:B})}I(i.temp_ref,{resolution:"supersede",supersedeTarget:R,reason:h.reason??`matches-but-changed: ${e.source.source_id} moved (${Object.keys(u).join(", ")})`},j),P.push({id:j,kind:"review-item",resolution:h.resolution,edit:h.resolution==="edited"?{...h.edit}:null,reason:null,by:c});continue}for(let T of L){if(!T.cite)continue;let B={source_id:e.source.source_id,source_cid:e.source.source_cid,anchor:T.cite.anchor,...T.cite.quote?{quote:T.cite.quote}:{},claim:T.text};A.push({ecid:q("DERIVES",B.source_cid,R,B),type:w.DERIVES,src:B.source_cid,dst:R,props:B})}}}if(i.changed&&h.resolution==="skipped"){let u=i.updated?.criteria??[];u.length>0&&he(u)==="ops"&&P.push({id:R,kind:"pending_update",resolution:"pending",edit:{temp_ref:i.temp_ref,source_id:e.source.source_id,updated:i.updated},reason:i.change_note??null,by:c})}if(h.resolution!=="rejected"){for(let u of ge(i)){let E=u.source_id??e.source.source_id,C=f.get(E);if(!C){a.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: cite source ${JSON.stringify(E)} is not in read_basis`});continue}let M={source_id:E,source_cid:C,anchor:u.anchor,...u.quote?{quote:u.quote}:{}};A.push({ecid:q("DERIVES",C,R,M),type:w.DERIVES,src:C,dst:R,props:M})}(h.resolution==="approved"||h.resolution==="edited"||h.resolution==="supersede")&&P.push({id:R,kind:"review-item",resolution:"approved",edit:null,reason:null,by:c}),h.resolution==="supersede"&&I(i.temp_ref,h,R)}continue}for(let u of re("usecase",me))a.push({code:u.code,detail:`${i.temp_ref}: ${u.detail}`});for(let u of de(w.DERIVES,"source","usecase",Z))a.push({code:u.code,detail:`${i.temp_ref}: ${u.detail}`});V.push({cid:x,label:te.USECASE,content:me}),v.set(i.temp_ref,x),A.push({ecid:q("DERIVES",Z.source_cid,x,Z),type:w.DERIVES,src:Z.source_cid,dst:x,props:Z});for(let u of ge(i).slice(1)){let E=u.source_id??e.source.source_id,C=f.get(E);if(!C){a.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: cite source ${JSON.stringify(E)} is not in read_basis`});continue}let M={source_id:E,source_cid:C,anchor:u.anchor,...u.quote?{quote:u.quote}:{}};for(let L of de(w.DERIVES,"source","usecase",M))a.push({code:L.code,detail:`${i.temp_ref}: ${L.detail}`});A.push({ecid:q("DERIVES",C,x,M),type:w.DERIVES,src:C,dst:x,props:M})}for(let u of i.criteria??[]){let E=u.cite.source_id??e.source.source_id,C=f.get(E);if(!C){a.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: criterion cite source ${JSON.stringify(E)} is not in read_basis`});continue}let M={source_id:E,source_cid:C,anchor:u.cite.anchor,...u.cite.quote?{quote:u.cite.quote}:{},claim:u.text};A.push({ecid:q("DERIVES",M.source_cid,x,M),type:w.DERIVES,src:M.source_cid,dst:x,props:M})}for(let u of i.depends_on_hint??[]){let E=H=>H.toLowerCase().trim().replace(/\s+/g," "),C=null,M=t.resolve(u);if(M&&!M.superseded&&t.nodeLabel.get(M.cid)===te.USECASE&&(C=M.cid),!C){for(let{cid:H,content:j}of t.byLabel(te.USECASE))if(!t.superseded.has(H)&&E(String(j.title??""))===E(u)){C=H;break}}if(!C){let H=V.find(j=>j.label===te.USECASE&&E(String(j.content.title??""))===E(u));H&&(C=H.cid)}!C||C===x||Ke(t,w.DEPENDS_ON,x,C,K)||K.some(H=>H.src===x&&H.dst===C)||(A.push({ecid:q(w.DEPENDS_ON,x,C,{reason:"extract hint"}),type:w.DEPENDS_ON,src:x,dst:C,props:{reason:"extract hint"}}),K.push({src:x,dst:C,type:w.DEPENDS_ON}))}if((h.resolution==="approved"||h.resolution==="edited"||h.resolution==="supersede")&&t.superseded.get(x)===null&&!g.has(x)&&J.push({kind:"node",old:x,new:x,reason:`re-minted after tombstone via review by ${c.id}`,by:c}),n){let u=we("usecase",E=>_.has(E),t.names.keys());u!==null&&!t.nameOf.has(x)&&(_.add(u),ie.push({cid:x,slug:u,by:c}))}h.resolution==="approved"?P.push({id:x,kind:"review-item",resolution:"approved",edit:null,reason:null,by:c}):h.resolution==="edited"?P.push({id:x,kind:"review-item",resolution:"edited",edit:{...h.edit},reason:null,by:c}):h.resolution==="rejected"?P.push({id:x,kind:"review-item",resolution:"rejected",edit:null,reason:h.reason??null,by:c}):h.resolution==="supersede"&&(P.push({id:x,kind:"review-item",resolution:"approved",edit:null,reason:h.reason??null,by:c}),I(i.temp_ref,h,x))}if(a.length)return{record:null,errors:a};let O=new Date().toISOString(),G=(e.sources?.length??0)>1||(e.extraction_claims?.length??0)>0,D;if(G){let i=[];if(e.extraction_claims==null)i.push({source_id:e.source.source_id,source_cid:e.source.source_cid,completeness:"complete",...l?{extractor_version:l}:{},at:O});else{let h=new Map(e.extraction_claims.map(F=>[F.source_id,F.completeness]));for(let F of e.sources??[e.source]){let Y=h.get(F.source_id)??null;Y!==null&&i.push({source_id:F.source_id,source_cid:F.source_cid,completeness:Y,...l?{extractor_version:l}:{},at:O})}}D=i}else D=e.source.source_cid;let k=[];for(let i of r.probeHits??[])k.push({...v.has(i.tempRef)?{new_cid:v.get(i.tempRef)}:{},candidate_cid:i.candidateCid,score:i.score,scorer:i.scorer,probe_basis:null});for(let i of N){let h=v.get(i.tempRef);k.some(F=>F.new_cid===h&&F.candidate_cid===i.candidate_cid)||k.push({...h!==void 0?{new_cid:h}:{},candidate_cid:i.candidate_cid,score:i.score,scorer:i.scorer,probe_basis:null})}return{record:ee(s,{ts:O,proposal_id:o,...o!=null?{extraction_of:D}:{},...o!=null&&l?{extractor_version:l}:{},...S.length>0?{criteria_removed:S}:{},...k.length>0?{dedup_hits:k}:{},nodes:V,edges:A,review:P,supersessions:J,...ie.length>0?{names:ie}:{},...r.judgements&&r.judgements.length>0?{judgements:r.judgements}:{},...r.eventIds&&r.eventIds.length>0?{event_ids:r.eventIds}:r.sid?{event_ids:Je(t,r.sid,"extract",1)}:{},...r.sid?{sid:r.sid}:{},source_head_moves:{}},{expectPrev:m}).record,errors:null}}function wt(r){let{contextDir:s,graph:t,verdicts:e,by:o}=r,d=[],c=[],p=[],l=[],n=[],m=new Set,f=new Map;for(let[S,v]of e){if(v.resolution!=="edited")continue;let N=t.resolve(S);if(!N||N.superseded)continue;let y=t.getNode(N.cid);if(!y)continue;let b={...y.content,...v.edit?.title!==void 0?{title:v.edit.title}:{},...v.edit?.summary!==void 0?{summary:v.edit.summary}:{},...v.edit?.risk!==void 0?{risk:v.edit.risk}:{}};if(re(y.label,b).length>0)continue;let V=se(y.label,b);V===N.cid||Se(t,N.cid,V)||f.set(N.cid,V)}for(let[S,v]of e){if(v.resolution==="skipped")continue;let N=t.resolve(S);if(!N){d.push({code:"UNKNOWN_NODE",detail:`${S} names nothing in the graph`});continue}if(N.superseded){d.push({code:"SUPERSEDED_TARGET",detail:`${S} is superseded \u2014 review the tip (${N.tip})`});continue}let y=N.cid;if(v.resolution==="approved")l.push({id:y,kind:"review-item",resolution:"approved",edit:null,reason:null,by:o});else if(v.resolution==="rejected")r.holdArchives?l.push({id:y,kind:"pending_archive",resolution:"pending",edit:null,reason:v.reason??null,by:o}):l.push({id:y,kind:"review-item",resolution:"rejected",edit:null,reason:v.reason??null,by:o});else if(v.resolution==="edited"){if(m.has(y)){d.push({code:"DUPLICATE_TARGET",detail:`${S}: this node was already superseded by another verdict in this batch \u2014 one verdict per node`});continue}let b=t.getNode(y);if(!b){d.push({code:"UNKNOWN_NODE",detail:`${S}: node file unreadable`});continue}let V={...b.content,...v.edit?.title!==void 0?{title:v.edit.title}:{},...v.edit?.summary!==void 0?{summary:v.edit.summary}:{},...v.edit?.risk!==void 0?{risk:v.edit.risk}:{}},A=re(b.label,V);if(A.length>0){for(let J of A)d.push({code:J.code,detail:`${S}: ${J.detail}`});continue}let K=se(b.label,V);if(K===y){l.push({id:y,kind:"review-item",resolution:"approved",edit:null,reason:null,by:o});continue}if(Se(t,y,K)){d.push({code:"SUPERSEDE_CYCLE",detail:`${S}: edit reproduces an already-superseded version (supersession cycle guard) \u2014 re-edit forward or redesign`});continue}let P=ke({graph:t,oldTip:y,newCid:K,newLabel:b.label,by:o,reason:`re-blessed onto ${K} (edited in review)`,dstRedirect:f});if(P.errors.length>0){for(let J of P.errors)d.push({code:"REBLESS_REFUSED",detail:`${S}: ${J}`});continue}c.push({cid:K,label:b.label,content:V}),p.push(...P.edges),m.add(y),n.push({kind:"node",old:y,new:K,reason:v.reason??"edited in review",by:o}),n.push(...P.supersessions),l.push({id:K,kind:"review-item",resolution:"edited",edit:{...v.edit},reason:null,by:o})}else if(v.resolution==="supersede"){let b=De(t,v.supersedeTarget,y,m);if("error"in b){d.push({code:b.error.code,detail:`${S}: ${b.error.detail}`});continue}m.add(b.targetCid),r.holdArchives?l.push({id:b.targetCid,kind:"pending_archive",resolution:"pending",edit:null,reason:`supersede by ${y}${v.reason?` \u2014 ${v.reason}`:""}`,by:o}):(n.push({kind:"node",old:b.targetCid,new:y,reason:v.reason??`superseded via review by ${o.id}`,by:o}),l.push({id:y,kind:"review-item",resolution:"approved",edit:null,reason:v.reason??null,by:o}))}}return d.length?{record:null,errors:d}:l.length===0&&n.length===0?{record:null,errors:[{code:"NO_VERDICTS",detail:"every item was skipped \u2014 nothing to commit"}]}:{record:ee(s,{ts:new Date().toISOString(),proposal_id:null,nodes:c,edges:p,review:l,supersessions:n,source_head_moves:{}},{expectPrev:t.latestHash}).record,errors:null}}function Tt(r){let{contextDir:s,graph:t,survivor:e,merged:o,reason:d,by:c}=r,p=t.resolve(e),l=t.resolve(o);return p?l?p.superseded||l.superseded?{record:null,errors:[{code:"ALREADY_SUPERSEDED",detail:"a side of the pair is already superseded \u2014 the pair is drained"}]}:p.cid===l.cid?{record:null,errors:[{code:"SELF_SUPERSEDE",detail:"a pair cannot merge a node into itself"}]}:{record:ee(s,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:l.cid,new:p.cid,reason:d??`pair merge: duplicate of ${e}`,by:c}],source_head_moves:{}},{expectPrev:t.latestHash}).record,errors:null}:{record:null,errors:[{code:"UNKNOWN_NODE",detail:`${o} names nothing in the graph`}]}:{record:null,errors:[{code:"UNKNOWN_NODE",detail:`${e} names nothing in the graph`}]}}function kt(r){let{contextDir:s,graph:t,assignments:e,by:o}=r,d=[],c=[],p=new Set;for(let{ref:n,slug:m}of e){if(!ae.test(m)){d.push({code:"BAD_SLUG",detail:`${JSON.stringify(m)} \u2014 slugs are kebab-case ${String(ae)}`});continue}let f=t.resolve(n);if(!f){d.push({code:"UNKNOWN_REF",detail:`${n} names nothing in the graph`});continue}if(f.superseded){d.push({code:"SUPERSEDED_TARGET",detail:`${n} is superseded \u2014 name the tip instead (${f.tip})`});continue}let a=t.names.get(m);if(a!==void 0&&!t.superseded.has(a)&&a!==f.cid||p.has(m)){d.push({code:"SLUG_TAKEN",detail:`${m} already names ${a??"another node in this record"}`});continue}p.add(m),c.push({cid:f.cid,slug:m,by:o})}return d.length?{record:null,errors:d}:c.length===0?{record:null,errors:[{code:"NO_ASSIGNMENTS",detail:"nothing to name"}]}:{record:ee(s,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],names:c,source_head_moves:{}},{expectPrev:t.latestHash}).record,errors:null}}function Dt(r){let{contextDir:s,graph:t,sourceId:e,reason:o,by:d}=r,c=t.heads.get(e);return c===void 0?{record:null,errors:[{code:"UNKNOWN_SOURCE",detail:`no source ${e} in the graph`}]}:c===null?{record:null,errors:[{code:"ALREADY_RETIRED",detail:`source ${e} is already retired`}]}:{record:ee(s,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:c,new:null,reason:o??`retired source ${e}`,by:d}],source_head_moves:{[e]:null},names:[]},{expectPrev:t.latestHash}).record,errors:null}}function At(r){let s=re("gap",r.content);if(s.length>0)return{ok:!1,refusal:`defer gap failed schema validation: ${s.map(d=>d.detail).join("; ")}`};let t=se("gap",r.content),e={reason:"reconcile change deferred"},o=r.annotates?[{ecid:q(w.ANNOTATES,t,r.annotates,e),type:w.ANNOTATES,src:t,dst:r.annotates,props:e}]:[];for(let d=0;;d++)try{return ee(r.contextDir,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:t,label:"gap",content:r.content}],edges:o,review:[],supersessions:[],source_head_moves:{}},{expectPrev:le(r.contextDir)}),{ok:!0,cid:t}}catch(c){if(c instanceof Ee){if(d<3)continue;return{ok:!1,refusal:"concurrent activity kept moving the store \u2014 try the card again"}}throw c}}function Mt(r){let s=r.graph.byLabel("gap").filter(t=>t.content.kind==="reconcile_deferred"&&typeof t.content.uc=="string"&&r.graph.tipOf(t.content.uc)===r.targetTip&&(r.sourceId===void 0||t.content.basis?.source_id===void 0||t.content.basis.source_id===r.sourceId)&&!r.graph.superseded.has(t.cid)&&r.graph.trust.get(t.cid)!=="archived");if(s.length===0)return{resolved:0};for(let t=0;;t++)try{return ee(r.contextDir,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:s.map(e=>({kind:"node",old:e.cid,new:r.resolvedBy,reason:"reconcile change resolved by a later verdict",by:r.by})),source_head_moves:{}},{expectPrev:le(r.contextDir)}),{resolved:s.length}}catch(e){if(e instanceof Ee){if(t<3)continue;return{resolved:0}}throw e}}export{pe as a,Ue as b,Te as c,ve as d,Se as e,ke as f,ae as g,Ke as h,Rt as i,ge as j,he as k,Ae as l,bt as m,Be as n,Je as o,Ye as p,Ot as q,wt as r,Tt as s,kt as t,Dt as u,At as v,Mt as w,Me as x,Ve as y,ze as z,Oe as A,we as B,dt as C,at as D,fe as E};
@@ -1,37 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as m,d as g,e as f}from"./chunk-4E4GJPEM.js";import{b as d}from"./chunk-NJJQL54J.js";import{mkdirSync as M,writeFileSync as o,existsSync as c,readFileSync as O}from"fs";import{join as a}from"path";var p={name:"remote-execution",version:"0.3.0",backendId:"hyper",kaneCompat:">=0.4.0",defaults:{runson:"mac",concurrency:1}},E={runson:"mac",concurrency:1,timeoutMinutes:120},y=`version: "0.1"
3
- runson: {{runson}}
4
- autosplit: true
5
- concurrency: {{concurrency}}
6
- scenarioCommandStatusOnly: true
7
- shell: bash
8
- runtime:
9
- - language: python
10
- version: "3.11.9"
11
- env:
12
- KANE_CLI_MODE: hyperexecute
13
- TESTMUAI_ENV: {{env}}
14
- pre:
15
- - rm -rf .testmuai/evidence
16
- - npm install -g @testmuai/kane-cli@{{kaneVersion}}
17
- - kane-cli login --env {{env}} --username \${{.secrets.LT_USERNAME}} --access-key \${{.secrets.LT_ACCESS_KEY}}{{projectFolderFlags}}
18
- testDiscovery:
19
- type: raw
20
- mode: dynamic
21
- command: {{discoveryCommand}}
22
- testRunnerCommand: |
23
- C=$(find /Users/ltuser/lrc/chrome /Applications "$HOME/Applications" -maxdepth 6 -name 'Google Chrome' -path '*/MacOS/*' -type f 2>/dev/null | head -1)
24
- if [ -z "$C" ]; then C=$(command -v google-chrome || command -v google-chrome-stable || true); fi
25
- if [ -n "$C" ]; then export KANE_CLI_CHROME_PATH="$C"; echo "using chrome: $C"; fi
26
- kane-cli testmd run "$test" --env {{env}} --no-evidence-publish --headless --agent{{memberFlags}}
27
- rc=$?
28
- mkdir -p artifacts/session && cp -R "$HOME/.testmuai/kaneai/sessions/." artifacts/session/ 2>/dev/null || true
29
- exit $rc
30
- uploadArtefacts:
31
- - name: kane-testrun
32
- path:
33
- {{uploadPaths}}
34
- `;var _={"remote-execution":{manifest:p,templates:{"hyperexecute.yaml.tmpl":y},config:E}};function v(e){return _[e]}function b(e,i){let l=i.base??d,r=v(e);if(!r)return{status:"failed",name:e,version:"",dir:"",error:`unknown plugin '${e}'`};let n=r.manifest.version;if(i.version&&i.version!==n)return{status:"failed",name:e,version:n,dir:"",error:`only bundled version ${n} is available (requested ${i.version})`};let t=m(e,n,l),u=g(e,l),h=c(a(t,"plugin.json"))&&c(u)&&O(u,"utf8").trim()===n;try{M(a(t,"templates"),{recursive:!0}),o(a(t,"plugin.json"),JSON.stringify(r.manifest,null,2)+`
35
- `);for(let[C,P]of Object.entries(r.templates))o(a(t,"templates",C),P);let s=f(e,l);return c(s)||o(s,JSON.stringify(r.config,null,2)+`
36
- `),o(u,n+`
37
- `),{status:h?"already-installed":"installed",name:e,version:n,dir:t}}catch(s){return{status:"failed",name:e,version:n,dir:t,error:s.message}}}export{y as a,b};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as O}from"./chunk-DBIBROYW.js";import{a as $}from"./chunk-AKX4VRRR.js";import{a as E,b as N}from"./chunk-IAHKTEET.js";import{closeSync as S,existsSync as F,fsyncSync as k,mkdirSync as P,openSync as q,readFileSync as p,readdirSync as T,renameSync as R,rmSync as v,writeFileSync as A}from"fs";import{join as u}from"path";var i=class extends Error{};function x(e,t){if(e.schema_version!==void 0&&e.schema_version!==$)throw new i(`record ${t} is stamped ${e.schema_version}, this build reads ${$} \u2014 migrate explicitly`);if(e.parents!==void 0&&!(e.prev_hash===null?e.parents.length===0:e.parents.length===1&&e.parents[0]===e.prev_hash))throw new i(`record ${t}: parents does not mirror prev_hash \u2014 multi-parent records need a DAG-aware reader`)}var C=class extends i{},b=class extends i{code="CONTEXT_APPEND_BUSY"};function I(e,t){P(e,{recursive:!0});let r=u(e,".lock"),c=Date.now()+(t?t.deadlineMs:2e3);for(;;)try{let o=q(r,"wx");return A(o,`${process.pid}
3
- `),S(o),()=>{try{v(r)}catch{}}}catch(o){if(o.code!=="EEXIST")throw o;if(t){let n=null,a=null;try{a=p(r,"utf8");let h=Number.parseInt(a.trim(),10);n=Number.isInteger(h)?h:null}catch{a=null}if(a!==null&&(n===null||!O(n))){let h=`${r}.break-${process.pid}-${Date.now()}`;try{R(r,h);let s=null;try{s=p(h,"utf8")}catch{s=null}if(s===null||s===a)v(h,{force:!0});else try{R(h,r)}catch{v(h,{force:!0})}}catch(s){if(s.code!=="ENOENT")throw s}continue}if(Date.now()>c)throw new b(`.context append is busy: ${r} held by live pid ${String(n)} past the deadline`);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25+Math.floor(Math.random()*50));continue}if(Date.now()>c)throw new i(`.context is locked by another process \u2014 remove ${r} if that process is gone`);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25)}}var j=/^\d{6}-[0-9a-f]{12}\.json$/,f=e=>u(e,"commits");function w(e){return"sha256:"+N(Buffer.from(E(e),"utf8"))}function y(e){let t=f(e);return F(t)?T(t).filter(r=>j.test(r)).sort():[]}function H(e){let t=y(e),r=[],c=[],o=null;return t.forEach((n,a)=>{let h=p(u(f(e),n),"utf8"),s;try{s=JSON.parse(h)}catch(d){throw new i(`corrupt commit record ${n}: ${String(d)}`)}if(s.seq!==a+1)throw new i(`sequence gap: expected seq ${a+1}, ${n} has ${s.seq}`);if(s.prev_hash!==o)throw new i(`broken chain at ${n}: prev_hash ${String(s.prev_hash)} != ${String(o)}`);x(s,n);let m=w(s),l=n.slice(7,19);if(!m.slice(7).startsWith(l))throw new i(`tampered record ${n}: content hash ${m} does not match filename`);r.push(s),c.push(m),o=m}),{records:r,hashes:c}}function J(e){let t=y(e);if(t.length===0)return null;let r=t[t.length-1],c=p(u(f(e),r),"utf8"),o;try{o=JSON.parse(c)}catch(a){throw new i(`corrupt tail record ${r}: ${String(a)}`)}x(o,r);let n=w(o);if(!n.slice(7).startsWith(r.slice(7,19)))throw new i(`tampered tail record ${r}: content hash ${n} does not match filename`);if(o.seq!==t.length)throw new i(`sequence gap at tail: ${t.length} record files but tail seq is ${o.seq}`);return{seq:o.seq,hash:n}}function U(e){return J(e)?.hash??null}function B(e,t,r){let c=y(e);if(c.length<t)throw new i(`derived state is ahead of the record log (applied seq ${t}, ${c.length} records) \u2014 run kane-cli context rebuild`);let o=[],n=[],a=r;for(let h=t;h<c.length;h++){let s=c[h],m=p(u(f(e),s),"utf8"),l;try{l=JSON.parse(m)}catch(g){throw new i(`corrupt commit record ${s}: ${String(g)}`)}if(l.seq!==h+1)throw new i(`sequence gap: expected seq ${h+1}, ${s} has ${l.seq}`);if(l.prev_hash!==a)throw new i(`broken chain at ${s}: prev_hash ${String(l.prev_hash)} != ${String(a)}`);x(l,s);let d=w(l);if(!d.slice(7).startsWith(s.slice(7,19)))throw new i(`tampered record ${s}: content hash ${d} does not match filename`);o.push(l),n.push(d),a=d}return{records:o,hashes:n}}function V(e,t){if(t.seq===0){if(t.hash!==null)throw new i("watermark not in chain: seq 0 cannot carry a hash");return H(e)}let r=y(e);if(r.length<t.seq)throw new i(`watermark not in chain: seq ${t.seq} is beyond the ${r.length}-record chain`);let c=r[t.seq-1],o;try{o=JSON.parse(p(u(f(e),c),"utf8"))}catch(a){throw new i(`watermark record ${c} unreadable: ${String(a)}`)}let n=w(o);if(n!==t.hash)throw new i(`watermark not in chain: seq ${t.seq} hashes ${n}, watermark claims ${String(t.hash)}`);return B(e,t.seq,t.hash)}function Y(e,t,r){let c=I(e,r.busyRetry);try{return M(e,t,r)}finally{c()}}function K(e,t){let r=I(e);try{return M(e,t,{})}finally{r()}}function M(e,t,r){let c=J(e),o=(c?.seq??0)+1,n=c?.hash??null;if(r.expectPrev!==void 0&&r.expectPrev!==n)throw new C(`concurrent append detected: validated against ${String(r.expectPrev)} but the chain head is ${String(n)} \u2014 re-open and retry`);let a={seq:o,prev_hash:n,...t,schema_version:$,parents:n===null?[]:[n]},h=w(a),s=f(e);P(s,{recursive:!0});let m=`${String(o).padStart(6,"0")}-${h.slice(7,19)}.json`,l=u(s,m),d=l+".tmp",g=q(d,"w");try{A(g,JSON.stringify(a)+`
4
- `),k(g)}finally{S(g)}R(d,l);try{let _=q(s,"r");k(_),S(_)}catch{}return{seq:o,hash:h,file:l,record:a}}export{i as a,C as b,b as c,I as d,H as e,J as f,U as g,B as h,V as i,Y as j,K as k};
@@ -1,27 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as j,b as H}from"./chunk-4ASRA7CD.js";import{a as B,b as N}from"./chunk-XWO5MDEU.js";import{a as se,b as ie,c as ae}from"./chunk-PDXZROJM.js";import{d as ce}from"./chunk-G52YPXKT.js";import{a as $,b as q,e as M,g as oe}from"./chunk-T4OJX2GZ.js";import{a as re,b as ne}from"./chunk-KRL2BDI5.js";import{a as L}from"./chunk-APZCLVZD.js";import{a as te}from"./chunk-5A4QG7ZM.js";import{a as X}from"./chunk-7KAPHA56.js";import{a as ee}from"./chunk-DPUV6OSP.js";import{a as A}from"./chunk-RZ4F3BHX.js";import{a as O}from"./chunk-AFNDJK2A.js";import{x as y}from"./chunk-NJJQL54J.js";import{a as F}from"./chunk-HCBYKLMW.js";import{a as k,b as p,i as Z}from"./chunk-C44QQJR4.js";import{a as K}from"./chunk-6YGTRKDT.js";import{e as v}from"./chunk-UR6MHSHU.js";var D=v(K(),1);import{existsSync as P,readFileSync as He,rmSync as ye,unlinkSync as Ve}from"fs";import{resolve as Q}from"path";import{promises as le,realpathSync as Ee}from"fs";import{homedir as Se}from"os";import{join as V,parse as ve,relative as ue,resolve as de}from"path";var fe=new Set(["node_modules",".git","dist","build",".next",".venv","venv","target","__pycache__"]),R=class extends Error{constructor(s){super(`refusing to scan '${s}'. Run from your project root, or pass --root <dir>.`);this.cwd=s;this.name="HomeRefusedError"}};function me(e){try{return Ee(de(e))}catch{return de(e)}}function Re(e){let r=me(e),s=me(Se()),n=ve(r).root;if(process.platform==="win32"){let o=t=>t.toLowerCase();return o(r)===o(s)||o(r)===o(n)}return r===s||r===n}async function U(e){if(Re(e.root))throw new R(e.root);let r=e.maxEntries??5e4,s=e.maxResults??5e3,n=new Set(e.ignore??[]),o=[],t=0,i=0,a=!1,u,c=[e.root];for(;c.length>0&&!a;){let l=c.shift(),g;try{g=await le.readdir(l,{withFileTypes:!0})}catch{continue}i++;for(let _ of g){if(t++,t>r){a=!0,u="max_entries";break}let m=_.name,T=V(l,m);if(_.isDirectory()){if(fe.has(m)||m.startsWith(".")||m.startsWith("output-")||n.has(m))continue;c.push(T)}else if(_.isFile()&&m.endsWith("_test.md")&&(o.push({path:T,relPath:ue(e.root,T),source:"cwd"}),o.length>=s)){a=!0,u="max_results";break}}e.onProgress?.(i,o.length)}if(!a){let g=[{dir:V(e.root,".testmuai","tests"),depth:0}];for(;g.length>0&&!a;){let{dir:_,depth:m}=g.shift(),T;try{T=await le.readdir(_,{withFileTypes:!0})}catch{continue}i++;for(let d of T){if(t++,t>r){a=!0,u="max_entries";break}let b=d.name,w=V(_,b);if(d.isDirectory()){if(m>=20||b.startsWith(".")||b.startsWith("output-")||fe.has(b))continue;g.push({dir:w,depth:m+1})}else if(d.isFile()&&b.endsWith("_test.md")&&(o.push({path:w,relPath:ue(e.root,w),source:"tests-dir"}),o.length>=s)){a=!0,u="max_results";break}}}}return{results:o,aborted:a,abortReason:u,dirsScanned:i}}import{readFileSync as Pe}from"fs";function Y(e){let r;try{r=Pe(e,"utf8")}catch{return{tags:[]}}try{let{global:s}=re(e,r),n=ne(s);return{tags:s.tags??[],...n?{mobileTarget:n}:{}}}catch{return{tags:[],...De(r)?{mobileTarget:Me}:{}}}}var Me={platform:"",app:""};function De(e){let r=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!r)return!1;let s=r[1].split(/\r?\n/);if(s.some(o=>/^target:\s*['"]?(emulator|simulator)['"]?\s*$/.test(o)))return!0;let n=s.findIndex(o=>/^target:\s*$/.test(o));return n<0?!1:s.slice(n+1).some(o=>/^\s+\S/.test(o))}function W(e){return Y(e).tags}import{mkdirSync as Ce,writeFileSync as $e}from"fs";import{join as Ie}from"path";function ge(e,r){return`Basic ${Buffer.from(`${e}:${r}`).toString("base64")}`}async function Fe(e){let r=ie({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId,codeExport:{enabled:!0,language:e.language,skipValidation:e.skipValidation},mobile:e.framework==="appium"}),s=await A(r.url,{method:"POST",headers:{"content-type":"application/json",authorization:ge(e.auth.username,e.auth.access_key)},body:JSON.stringify(r.body)});if(!s.ok)throw new Error(`code-export trigger failed: ${s.status} ${await s.text()}`);e.log("info","CODE_EXPORT_TRIGGERED","Code export triggered",{testcase_id:e.testcaseId})}async function Oe(e){let r=ae({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId}),s=e.pollIntervalMs??5e3,n=e.timeoutMs??3e5,o=Date.now()+n;for(;Date.now()<o;){let t=await A(r,{headers:{authorization:ge(e.auth.username,e.auth.access_key),accept:"application/json"}});if(!t.ok){await new Promise(c=>setTimeout(c,s));continue}let a=(await t.json()).data?.find(c=>c.code_name==="kane-cli-trigger");if(!a){await new Promise(c=>setTimeout(c,s));continue}let u=(a.status??"").toLowerCase();if(u==="in progress"||u==="in_progress"||u==="pending"){await new Promise(c=>setTimeout(c,s));continue}if(!a.url||a.url.length===0)throw new Error(`code-export status=${a.status} but no files returned`);Ce(e.outDir,{recursive:!0});for(let c of a.url){let l=Ie(e.outDir,c.file_name),g=await A(c.file_url);if(!g.ok){e.log("warn","CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:c.file_name,status:g.status});continue}let _=await g.text();$e(l,_,"utf-8")}return e.log("info","CODE_EXPORT_DOWNLOADED","Code export saved",{out_dir:e.outDir,file_count:a.url.length}),e.outDir}throw new Error("code-export polling timed out")}async function pe(e){return await Fe(e),await Oe(e)}var E=v(K(),1);import{existsSync as Ae,readFileSync as Le}from"fs";var h=v(F(),1);function je(e){j(e);let r=M(e);if(!Ae(r))return null;try{return JSON.parse(Le(r,"utf8"))}catch{return{}}}function Be(e){return e===null?"never_run":e.testcase_id?"synced":"local_only"}function Ne(e){return e==="synced"?"\u2601":e==="local_only"?"\u25A3":"\u25CB"}function Ue(e){return e==="tests-dir"?"\u2726":" "}function We(e,r){return r==="all"?!0:r==="synced"?e.status==="synced":r==="local"?e.status==="local_only":r==="never_run"?e.status==="never_run":r==="cli"?e.source==="tests-dir":r==="hand"?e.source==="cwd":!0}var z=["all","synced","local","never_run","cli","hand"];function Je(e){let r=z.indexOf(e);return z[(r+1)%z.length]}function he({root:e,currentOrgId:r,onSelect:s,onCancel:n}){let[o,t]=(0,E.useState)([]),[i,a]=(0,E.useState)(null),[u,c]=(0,E.useState)(!0),[l,g]=(0,E.useState)("all");(0,E.useEffect)(()=>{(async()=>{try{let d=await U({root:e}),b=[];for(let w of d.results){let G=je(w.path);G?.org_id!==void 0&&G.org_id!==r||b.push({path:w.path,relPath:w.relPath,name:$(w.path),status:Be(G),source:w.source,tags:W(w.path)})}t(b),c(!1)}catch(d){d instanceof R,a(d.message),c(!1)}})()},[e,r]);let _=(0,E.useMemo)(()=>o.filter(d=>We(d,l)).map(d=>({id:d.path,label:`${Ne(d.status)} ${Ue(d.source)} ${d.relPath}${d.tags.length>0?` [${d.tags.join(", ")}]`:""}`})),[o,l]),m=(0,E.useMemo)(()=>Ke(l,o),[l,o]);if(i)return(0,h.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:y.red,paddingX:2,paddingY:1,children:[(0,h.jsx)(p,{color:y.red,bold:!0,children:"testmd"}),(0,h.jsx)(k,{marginTop:1,children:(0,h.jsx)(p,{color:y.red,children:i})})]});let T=l==="all"?"all":Ge(l);return(0,h.jsx)(te,{title:`testmd \xB7 filter: ${T}`,items:_,loading:u,itemNoun:"tests",onSelect:d=>{let b=o.find(w=>w.path===d.id);b&&s(b)},onCancel:n,onTab:()=>g(d=>Je(d)),extraHint:"cycle filter",footer:m})}function Ge(e){return e==="synced"?"synced (\u2601)":e==="local"?"local (\u25A3)":e==="never_run"?"never run (\u25CB)":e==="cli"?"cli-generated (\u2726)":e==="hand"?"hand-written":"all"}function Ke(e,r){let s={synced:r.filter(o=>o.status==="synced").length,local:r.filter(o=>o.status==="local_only").length,never:r.filter(o=>o.status==="never_run").length,cli:r.filter(o=>o.source==="tests-dir").length,hand:r.filter(o=>o.source==="cwd").length},n=o=>o?y.orange:y.dim;return(0,h.jsxs)(k,{flexDirection:"column",children:[(0,h.jsx)(p,{color:y.dim,children:"legend:"}),(0,h.jsxs)(k,{children:[(0,h.jsx)(p,{color:n(e==="synced"),children:` \u2601 synced (${s.synced}) `}),(0,h.jsx)(p,{color:n(e==="local"),children:`\u25A3 local (${s.local}) `}),(0,h.jsx)(p,{color:n(e==="never_run"),children:`\u25CB never run (${s.never})`})]}),(0,h.jsxs)(k,{children:[(0,h.jsx)(p,{color:n(e==="cli"),children:` \u2726 cli-generated (${s.cli}) `}),(0,h.jsx)(p,{color:n(e==="hand"),children:` hand-written (${s.hand})`})]})]})}var I=v(K(),1);import{existsSync as Xe,readFileSync as qe}from"fs";var f=v(F(),1);function _e({path:e,relPath:r,onAction:s,onBack:n,onView:o}){let[t,i]=(0,I.useState)(null),[a,u]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let l=M(e);if(Xe(l))try{i(JSON.parse(qe(l,"utf8")))}catch{i(null)}},[e]),Z((l,g)=>{if(g.escape){if(a){u(!1);return}n();return}if(a){l==="y"||l==="Y"?(u(!1),s("delete")):(l==="n"||l==="N")&&u(!1);return}l==="r"&&s("run"),l==="e"&&t?.testcase_id&&s("export"),l==="d"&&u(!0),l==="v"&&o&&o()});let c=({k:l,v:g})=>g?(0,f.jsxs)(p,{children:[(0,f.jsx)(p,{color:y.dim,children:l.padEnd(14)}),g]}):null;return(0,f.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:y.orange,paddingX:2,paddingY:1,children:[(0,f.jsx)(p,{color:y.orange,bold:!0,children:r}),(0,f.jsx)(k,{marginTop:1,flexDirection:"column",children:t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c,{k:"test_id",v:t.test_id}),(0,f.jsx)(c,{k:"testcase_id",v:t.testcase_id}),(0,f.jsx)(c,{k:"project_id",v:t.project_id}),(0,f.jsx)(c,{k:"folder_id",v:t.folder_id}),(0,f.jsx)(c,{k:"org_id",v:t.org_id}),(0,f.jsx)(c,{k:"session_name",v:t.session_name}),(0,f.jsx)(c,{k:"commit_id",v:t.commit_id})]}):(0,f.jsx)(p,{color:y.dim,children:"(never run \u2014 no meta.json)"})}),a?(0,f.jsx)(k,{marginTop:1,children:(0,f.jsxs)(p,{color:y.red,bold:!0,children:["Delete ",r," and its output dir? [y/n]"]})}):(0,f.jsx)(k,{marginTop:1,children:(0,f.jsxs)(p,{color:y.dim,children:["[r] run [e] export",t?.testcase_id?"":" (need testcase_id)"," [d] delete",o?" [v] view":""," [Esc] back"]})})]})}function C(e){j(e);let r=M(e);if(!P(r))return null;try{return JSON.parse(He(r,"utf8"))}catch{return null}}function xe(e,r){return!e||e.org_id===void 0?!0:e.org_id===r}function J(e,r){return xe(e,r)?null:(process.stderr.write(`error: this test belongs to org ${e.org_id}; you are logged in as org ${r}.
3
- Switch profiles with \`kane-cli profiles switch\` to act on it.
4
- `),2)}async function Ht(e={}){let r=!!process.stdin.isTTY&&!e.json,s=new O,n=new L;await H({isInteractive:r,creds:s,config:n});let o=s.getDefaultEnv()??"prod";try{let t=await N({creds:s,env:o,log:()=>{}});return t.resolvedCreds?.org_id===void 0?(process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),{ok:!1,code:2}):{ok:!0,orgId:String(t.resolvedCreds.org_id)}}catch(t){if(t instanceof B)return process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),{ok:!1,code:2};throw t}}async function Vt(e,r){if(process.stdin.isTTY&&!e.json)return await Qe(r,e.root);let s=e.root??process.cwd(),n;try{n=await U({root:s,ignore:e.ignore})}catch(o){if(o instanceof R)return process.stderr.write(`error: ${o.message}
5
- `),2;throw o}for(let o of n.results){let t=C(o.path);if(!xe(t,r))continue;let i={path:o.relPath.startsWith(".")?o.relPath:`./${o.relPath}`,name:$(o.path),has_meta:t!==null,source:o.source,synced:!!t?.testcase_id,tags:W(o.path)};t&&(t.test_id&&(i.test_id=t.test_id),t.testcase_id&&(i.testcase_id=t.testcase_id),t.org_id&&(i.org_id=t.org_id),t.project_id&&(i.project_id=t.project_id),t.folder_id&&(i.folder_id=t.folder_id)),process.stdout.write(JSON.stringify(i)+`
6
- `)}return n.aborted&&process.stderr.write(`warn: walk aborted (${n.abortReason}). Pass --root or --ignore to narrow.
7
- `),0}var we=-1001,be=-1002,ke=-1003,x={action:null,path:null};function Ye(e,r){return x.action=e,x.path=r,e==="run"?we:e==="export"?be:ke}function ze({root:e,currentOrgId:r,onComplete:s}){let[n,o]=D.default.useState({kind:"list"});return D.default.useEffect(()=>{n.kind==="exiting"&&s(n.code)},[n,s]),n.kind==="list"?D.default.createElement(he,{root:e,currentOrgId:r,onSelect:t=>o({kind:"inspect",path:t.path,relPath:t.relPath}),onCancel:()=>o({kind:"exiting",code:0})}):n.kind==="inspect"?D.default.createElement(_e,{path:n.path,relPath:n.relPath,onAction:async t=>{o({kind:"exiting",code:Ye(t,n.path)})},onBack:()=>o({kind:"list"})}):null}async function Qe(e,r){let s=r??process.cwd(),{render:n}=await import("./build-JIKYOZUH.js"),o=await new Promise(t=>{let{unmount:i,waitUntilExit:a}=n(D.default.createElement(ze,{root:s,currentOrgId:e,onComplete:u=>{i(),t(u)}}),{stdout:process.stderr,exitOnCtrlC:!0});a().then(()=>t(0)).catch(()=>t(0))});if(o===we&&x.path){let{runTestMdFile:t}=await import("./run-test-md-4VRH7FU5.js"),i=await t(x.path,{});return x.action=null,x.path=null,i}if(o===be&&x.path){let t=await et(x.path,{},e);return x.action=null,x.path=null,t}if(o===ke&&x.path){let t=await Ze(x.path,!0,e);return x.action=null,x.path=null,t}return o}async function Yt(e,r){let s=Q(e);if(!P(s))return process.stderr.write(`error: file not found: ${s}
8
- `),2;let n=C(s),o=J(n,r);if(o!==null)return o;let t={path:s,name:$(s),has_meta:n!==null};return n&&(n.commit_id&&(t.commit_id=n.commit_id),n.test_id&&(t.test_id=n.test_id),n.testcase_id&&(t.testcase_id=n.testcase_id),n.project_id&&(t.project_id=n.project_id),n.folder_id&&(t.folder_id=n.folder_id),n.org_id&&(t.org_id=n.org_id),n.session_name&&(t.session_name=n.session_name)),process.stdout.write(JSON.stringify(t)+`
9
- `),0}async function Ze(e,r,s){let n=Q(e);if(!P(n))return process.stderr.write(`error: file not found: ${n}
10
- `),2;let o=C(n),t=J(o,s);if(t!==null)return t;if(!r)return process.stderr.write(`error: refusing to delete without --yes.
11
- This will remove '${n}' and '${q(n)}/'.
12
- `),2;let i=q(n);if(P(i))try{ye(i,{recursive:!0,force:!0})}catch(a){return process.stderr.write(`error: failed to remove ${i}: ${a.message}
13
- `),2}try{Ve(n)}catch(a){return process.stderr.write(`error: failed to remove ${n}: ${a.message}
14
- `),2}return process.stderr.write(`removed ${n} and ${i}/
15
- `),0}var S=class extends Error{kind;constructor(r,s){super(s),this.name="ExportError",this.kind=r}};async function zt(e,r){let{codeDir:s}=await Te(e,r);return{codeDir:s}}async function Te(e,r){let s=C(e);if(!s?.testcase_id)throw new S("not-synced","this test has not been synced to TMS \u2014 run `kane-cli testmd run` first.");let n=new L().load(),o=Y(e).mobileTarget!==void 0;if(o&&r.language?.toLowerCase()==="javascript")throw new S("js-on-mobile","--language javascript is not supported on a mobile target \u2014 mobile code export is Appium + Python only. Drop the flag, or pass --language python.");let t=r.language??n.code_export?.language;if(!o&&!t)throw new S("no-language","--language not provided and no default in tui-config.");let{framework:i,language:a}=se(t??"python",o),u=r.output??oe(e,i,a),c=P(u);if(c&&!r.force){let m=!1;try{let{readdirSync:T}=await import("fs");m=T(u).length>0}catch{}if(m)return{kind:"reused",codeDir:u}}c&&r.force&&ye(u,{recursive:!0,force:!0});let l=new O,g=r.env??l.getDefaultEnv()??"prod",_;try{_=await N({creds:l,env:g,log:()=>{}})}catch(m){throw m instanceof B?new S("auth-fail","not authenticated. Run `kane-cli login` first."):m}if(!_.basicAuth)throw new S("auth-incomplete","TMS basic auth could not be resolved. Run `kane-cli login` again.");try{let m=X(g);await pe({tmsBaseUrl:m.tmsBaseUrl,testcaseId:s.testcase_id,auth:_.basicAuth,language:a,framework:i,skipValidation:n.code_export?.skip_validation??!0,outDir:u,log:()=>{}})}catch(m){throw new S("export-fail",`code export failed: ${m.message}`)}return{kind:"exported",codeDir:u}}async function et(e,r,s){let n=Q(e);if(!P(n))return process.stderr.write(`error: file not found: ${n}
16
- `),2;let o=C(n),t=J(o,s);if(t!==null)return t;try{let i=await Te(n,r);return i.kind==="reused"?process.stderr.write(`reusing existing export at ${i.codeDir}
17
- `):process.stderr.write(`exported to ${i.codeDir}
18
- `),0}catch(i){if(i instanceof S)return i.kind==="not-synced"?(process.stderr.write("error: this test has not been synced to TMS \u2014 run `kane-cli testmd run` first.\n"),2):i.kind==="no-language"?(process.stderr.write(`error: --language not provided and no default in tui-config.
19
- `),2):i.kind==="js-on-mobile"?(process.stderr.write(`error: ${i.message}
20
- `),2):i.kind==="auth-fail"?(process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),2):i.kind==="auth-incomplete"?(process.stderr.write("error: TMS basic auth could not be resolved. Run `kane-cli login` again.\n"),2):(process.stderr.write(`error: ${i.message}
21
- `),2);throw i}}async function Qt(e={}){let r=!!process.stdin.isTTY,s=new O,n=new L;await H({isInteractive:r,creds:s,config:n});let o=e.env??s.getDefaultEnv()??"prod";try{let t=await N({creds:s,env:o,usernameFlag:e.username,accessKeyFlag:e.accessKey,log:()=>{}});return t.resolvedCreds?.org_id===void 0||!t.basicAuth?(process.stderr.write("error: could not resolve TMS credentials. Run `kane-cli login` again.\n"),{ok:!1,code:2}):{ok:!0,orgId:String(t.resolvedCreds.org_id),basicAuth:t.basicAuth,controllerBaseUrl:X(o).controllerBaseUrl}}catch(t){if(t instanceof B)return process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),{ok:!1,code:2};throw t}}async function Zt(e,r,s=ce){if(!P(e))return process.stderr.write(`error: file not found: ${e}
22
- `),2;if(!e.endsWith("_test.md"))return process.stderr.write(`error: not a *_test.md file: ${e}
23
- `),2;let n=C(e),o=J(n,r.orgId);if(o!==null)return o;if(!n?.commit_id||!n?.test_id)return process.stderr.write(`error: ${e} is not authored \u2014 run \`kane-cli testmd run ${e}\` first.
24
- `),2;let t=await s({sourcePath:e,testId:n.test_id,sessionId:n.commit_id,commitId:n.commit_id,controller:new ee(r.controllerBaseUrl,{username:r.basicAuth.username,accessKey:r.basicAuth.access_key})}),i={type:"test_md_bundle_sync",status:t.ok?"ok":"failed",commit_id:n.commit_id,...t.ok?{bytes:t.bytes}:{stage:t.stage}};return process.stdout.write(JSON.stringify(i)+`
25
- `),t.ok?(process.stderr.write(`synced: ${n.commit_id}-testmd.zip (${t.bytes} bytes)
26
- `),0):(process.stderr.write(`error: bundle sync failed at ${t.stage}: ${t.error}
27
- `),t.stage==="collect"?2:1)}export{U as a,Y as b,he as c,_e as d,C as e,xe as f,J as g,Ht as h,Vt as i,Qe as j,Yt as k,Ze as l,S as m,zt as n,et as o,Qt as p,Zt as q};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q,w as r}from"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import{i as a}from"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{b as SLUG_RE,c as checkAcyclic,d as checkCardinality,e as citesOf,q as commitDeferGap,o as commitNames,n as commitPairMerge,l as commitProposal,p as commitRetire,m as commitReviewFacts,f as criteriaShape,i as mintEventId,j as nextEventIds,a as recordsSince,r as resolveDeferGaps,k as resolveLivingTip,g as validateCriterionOps,h as validateProposal};
@@ -1,3 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as O}from"./chunk-DYW5C6II.js";import{a as g,b as S,d as G}from"./chunk-OS4VSIHT.js";import"./chunk-5DT7PIGB.js";import{e as w,f as $}from"./chunk-5GUD3CIH.js";import{d as x}from"./chunk-YMLC55J4.js";import{e as k}from"./chunk-EHN5HTUD.js";import"./chunk-CH273NAE.js";import{b}from"./chunk-VZ7KXRXB.js";import{C as R}from"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";import{basename as h}from"path";import{statSync as A}from"fs";function C(t,e){if(!t)return 1;let o=t.resolve(e);return!o||o.superseded?1:t.getNode(o.tip)?.content.risk==="high"?3:1}function D(t,e){return t.usecases.map(o=>{let s=o.acceptance_criteria??[],a=s.filter(n=>(n.covered_by??[]).length>0),l=s.filter(n=>n.execution==="passed"),i=s.filter(n=>n.execution==="failed"),u=s.filter(n=>n.execution==="blocked"),d=0,m=0;for(let n of s){let f=C(e,n.id);d+=f,n.execution==="passed"&&(m+=f)}let r=d===0?0:Math.round(100*m/d),p=a.length===0?"uncovered":s.length===l.length?"covered":u.length>0&&i.length===0?"blocked":"partial";return{id:o.id,title:o.title,status:p,pct:r,acs:{total:s.length,covered:a.length,passed:l.length,failed:i.length,blocked:u.length},stale:s.filter(n=>n.fresh==="stale").map(n=>n.id)}})}async function P(t){let e=await w(t);return e.length===0?null:e.map(o=>({p:o,m:A(o).mtimeMs})).sort((o,s)=>s.m-o.m)[0].p}var N={covered:"\u2714",partial:"\u25D0",uncovered:"\u2716",blocked:"\u23F8"};function _(t){let e=Math.round(t/10);return"\u2588".repeat(e)+"\u2591".repeat(10-e)}async function I(t,e=G(),o=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return g(e,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:r,agentRefusal:p}=await import("./headless-io-66RG5NN5.js"),n=r("ndjson","cover",{stdout:c=>e.out(c.replace(/\n$/,"")),stderr:c=>(e.err??e.out)(c.replace(/\n$/,""))}),f=[],v=[],j={out:c=>f.push(c),err:c=>v.push(c),confirm:async()=>!1,isTTY:!1};if(await I({...t,json:!0,mode:void 0},j,o)!==0)return p(n,v.join("; ")||"cover refused");let y=JSON.parse(f.join(`
3
- `));return n.event({type:"coverage",...y}),n.done(0,void 0,M(y.completeness??[]))}let s=S(o,e);if(!s)return 2;let a=t.from?await $(t.from,o):await P(o);if(!a)return g(e,t.from?`no evidence pack at '${t.from}'`:"no evidence pack in .testmuai/evidence \u2014 run a test first, or pass --from <pack>"),2;let l=await k(a,"coverage/usecases.yaml");if(l==null)return g(e,`${h(a)} carries no coverage/usecases.yaml \u2014 the pack predates coverage or its project had no .context at seal time`),2;let i=b(l);if(!i||!Array.isArray(i.usecases))return g(e,`${h(a)}: coverage/usecases.yaml is not a usecases document`),2;let u=R(s),d=D(i,u),m=await x(u,"design");if(t.json)return e.out(JSON.stringify({pack:a,depth:d,completeness:m},null,2)),0;e.out(`coverage \u2014 ${h(a)}`),e.out(""),e.out("depth (proven by the pack):");for(let r of d){let p=r.stale.length?` \xB7 ${r.stale.length} stale`:"";e.out(` ${N[r.status]} ${_(r.pct)} ${String(r.pct).padStart(3)}% ${r.id} \u2014 ${r.status} (${r.acs.passed}/${r.acs.total} ACs proven${r.acs.failed?`, ${r.acs.failed} failed`:""}${r.acs.blocked?`, ${r.acs.blocked} blocked`:""})${p}`)}e.out(""),e.out("completeness (live graph):"),m.length===0&&e.out(" no design gaps \u2014 every AC verified, every use-case scenarioed");for(let r of m)e.out(` [${r.risk}] ${r.tag} ${r.ref} \u2014 ${r.why}`),e.out(` \u2192 ${r.ready_command}`);return 0}function M(t){return t.filter(e=>e.ready_command.startsWith("kane-cli ")&&O(e.ready_command)).slice(0,4).map(e=>({cmd:e.ready_command,why:e.why}))}export{I as coverCommand,M as coverNext,D as depthRows};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-N7Z7BQYO.js";import"./chunk-KGKJU27A.js";import"./chunk-BB2W35TW.js";import"./chunk-DNNZ353O.js";import"./chunk-NVGBE2DR.js";import"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{a as captureForceScope,b as commitDesign,c as designPhaseLadder};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-VDM3TWF6.js";import"./chunk-54JZ6VEW.js";import"./chunk-DNNZ353O.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-YKTYVJBN.js";import"./chunk-NVGBE2DR.js";import"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-NJJQL54J.js";import"./chunk-UR6MHSHU.js";export{b as REMOTE_PROVIDERS,d as findProvider,a as landingReceipt,c as looksLikeUrl};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h,i}from"./chunk-XS2LZFCH.js";import"./chunk-BKHXPBWN.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-NVGBE2DR.js";import"./chunk-IAHKTEET.js";import"./chunk-MSGW4JDG.js";import"./chunk-UR6MHSHU.js";export{a as DOCX_CONVERTER_POLICY,b as DOCX_CONVERTER_VERSION,d as DOCX_IMAGE_CAP,c as DOCX_IMAGE_DIMENSION_FLOOR,f as DOCX_IMAGE_MAX_BYTES,g as DOCX_IMAGE_MAX_PIXELS,e as DOCX_VISION_BYTE_BUDGET,i as convertDocx,h as renderTokens};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{$ as ia,A as K,B as L,D as M,E as N,F as O,G as P,H as Q,L as R,M as S,N as T,O as U,P as _,R as $,S as aa,T as ba,V as ca,W as da,X as ea,Y as fa,Z as ga,_ as ha,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-SACCB44S.js";import"./chunk-QQ5MHSSY.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{a as V,b as W,c as X,d as Y,e as Z}from"./chunk-DYXYNH6X.js";import"./chunk-YMLC55J4.js";import"./chunk-NP3VGFZM.js";import"./chunk-NVGBE2DR.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-CH273NAE.js";import"./chunk-KRL2BDI5.js";import"./chunk-VZ7KXRXB.js";import{a,f as b}from"./chunk-P7YZ3PU3.js";import"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-HPUQJRDX.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-O7U5BVX5.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-7KAPHA56.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-NJJQL54J.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 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g}from"./chunk-U2CIXGZR.js";import"./chunk-OS4VSIHT.js";import"./chunk-KAZGHWGK.js";import"./chunk-BZAGVBCX.js";import"./chunk-JUJ4SAGH.js";import"./chunk-UJZZDPDY.js";import"./chunk-DNNZ353O.js";import"./chunk-5DT7PIGB.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.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,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-EEFZXZTZ.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{a as explain};
@@ -1,9 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as a}from"./chunk-OS4VSIHT.js";import{a as i}from"./chunk-EEFZXZTZ.js";import"./chunk-5DT7PIGB.js";import"./chunk-CH273NAE.js";import{C as n}from"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";async function f(s,p){let o=a(process.cwd(),{out:r=>process.stdout.write(r+`
3
- `),err:r=>process.stderr.write(r+`
4
- `),confirm:async()=>!1,isTTY:!!process.stdout.isTTY});if(!o)return 2;let c=n(o),t=i(o,c,s);if(p.json)return process.stdout.write(JSON.stringify(t)+`
5
- `),t.target?0:1;if(!t.target)return process.stdout.write(`error: ${s} names nothing in the graph
6
- `),1;let e=t.target;process.stdout.write(`${e.slug??e.cid} ${e.label} tip ${e.tip}
7
- `);for(let r of t.entries)process.stdout.write(` #${r.seq} ${r.ts} ${r.kind} ${r.detail}${r.rationale?`
8
- why: ${r.rationale}`:""}
9
- `);return 0}export{f as explainCommand};
@@ -1,10 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $}from"./chunk-A2SQD2AY.js";import{f as Z,g as z}from"./chunk-ZVJGHQNG.js";import"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import"./chunk-G2Q2TP3O.js";import"./chunk-RV7Q4RUV.js";import"./chunk-5G22NOZK.js";import"./chunk-2LXJ2ZM3.js";import"./chunk-BZAGVBCX.js";import"./chunk-BB2W35TW.js";import"./chunk-GX3FPJUG.js";import"./chunk-427OQS2N.js";import{a as F}from"./chunk-WHYEXCTG.js";import{a as ee}from"./chunk-JUJ4SAGH.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-IVQX3AKL.js";import"./chunk-R7QAS6LZ.js";import"./chunk-XS2LZFCH.js";import"./chunk-BKHXPBWN.js";import{e as Y}from"./chunk-UDFDTFBL.js";import"./chunk-F2CET54H.js";import"./chunk-VDM3TWF6.js";import"./chunk-54JZ6VEW.js";import"./chunk-DNNZ353O.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import{c as L}from"./chunk-YKTYVJBN.js";import"./chunk-EV64VI66.js";import{c as O}from"./chunk-5DT7PIGB.js";import"./chunk-NVGBE2DR.js";import{a as A}from"./chunk-CH273NAE.js";import{a as U,b as H}from"./chunk-2MTAXT2U.js";import"./chunk-4PMZ5FCD.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-NJJQL54J.js";import"./chunk-UR6MHSHU.js";async function ue(t){let[{render:n},o,{QuestionBatchPrompt:f}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),g=o.default??o;return new Promise(y=>{let x=n(g.createElement(f,{questions:t,onSubmit:r=>{x.unmount(),y(r)}}))})}async function le(t,n){let[{render:o},f,{ReviewChecklist:g}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),y=f.default??f;return new Promise(x=>{let r=o(y.createElement(g,{items:t.map(v=>{let h=n.get(v.temp_ref);return{uc:v,dedupWith:h&&!h.archived?h.cid:void 0,archivedMatch:h?.archived?{cid:h.cid,reason:h.reason}:void 0}}),onSubmit:v=>{r.unmount(),x(v)}}))})}async function me(t){let{createInterface:n}=await import("readline/promises"),o=n({input:process.stdin,output:process.stdout});try{let f=await o.question(`${t} [y/N] `);return/^y(es)?$/i.test(f.trim())}finally{o.close()}}async function be(t){let n=A(process.cwd()),o=H({verb:"extract",mode:t.plan?"cli":"interactive",contextRoot:n,env:U(),resumeSid:t.resume,write:!0,longSession:!0}),g={...await Y(),...o.spawnEnv()},y=await L(g);if(!y.ok)return process.stderr.write((y.message??"error: turn-endpoint preflight failed")+`
3
- `),process.stderr.write(o.supportFooter()+`
4
- `),o.error("preflight_auth"),await o.end({exit_code:2}),2;let x=async()=>y;if(t.plan){let s=await z(t,{contextDir:n,agent:F,preflightTurn:x,ask:ue,review:le,confirmStale:me,out:l=>process.stdout.write(l+`
5
- `),progress:l=>process.stderr.write(l+`
6
- `),isTTY:O(),auth:g,telemetry:o});return s===1&&process.stderr.write(o.supportFooter()+`
7
- `),await o.end({exit_code:s}),s}let[{render:r},v,{ScrollbackProvider:h},{ChatSurface:u},{ScrollbackTap:j},{makeChatController:Q},{setInkExit:_},W]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-DALSIICW.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-YJCNU76T.js"),import("./exit-manager-ZLDO54S4.js"),Promise.all([import("./chat-committer-RAOIL2T6.js"),import("./descriptor-PWUUNYV7.js"),import("./explain-3HAZY7Q6.js"),import("./readmodel-TDRFVDVI.js")])]),[{commitChatTurn:M},{topologyDescriptor:e},{explain:a},{openGraph:k}]=W,E=v.default??v,i=Q({commitChatTurn:M,descriptor:e(),contextDir:n,refreshGraph:()=>k(n),graph:k(n),explain:a,by:{kind:"human",id:"owner"},dedupFlags:s=>Z(s,k(n))}),q={current:null},P=null,J=0,G=null,V=!1,te=()=>{if(J+=1,J>=2){try{I.unmount()}catch{}$({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 anything already committed is safe in the store"]}),process.exit(130)}i.requestPause(),G=setTimeout(()=>{V||(V=!0,(async()=>{i.finalizeForExit(),await q.current?.flush();try{I.unmount()}catch{}$({state:"interrupted",facts:["the agent did not confirm the pause within 5s \u2014 nothing new was saved"]}),process.exit(130)})())},5e3)},re=await import("./dossier-Y6TJWFZU.js"),ne=s=>{try{return re.buildDossier(k(n),s)}catch{return null}},se={listUcs:()=>{let s=k(n),l=new Set(i.state.turns.flatMap(c=>(c.items??[]).map(m=>m.title.toLowerCase()))),d={high:0,med:1,low:2};return s.byLabel("usecase").filter(c=>!s.superseded.has(c.cid)).map((c,m)=>{let b=c.content,C=String(b.title??c.cid.slice(0,12)),N=ee(s,c.cid),S=N?N.designed_at_cid===c.cid?"current":"stale":void 0;return{key:c.cid,title:C,badge:S==="current"?"designed":S==="stale"?"designed \xB7 stale":l.has(C.toLowerCase())?"drafted this session":"existing",designed:S,risk:b.risk,i:m}}).sort((c,m)=>(d[c.risk??"zz"]??3)-(d[m.risk??"zz"]??3)||c.i-m.i).map(({key:c,title:m,badge:b,designed:C})=>({key:c,title:m,badge:b,designed:C}))},runDesignChild:async(s,l=!1,d="design")=>{try{let{designEntryCheck:p,confirmUnreviewedViaAsk:T}=await import("./trust-gate-EX7R2P4Y.js"),w=p(k(n),s);if(!w.ok&&(w.code==="UC_UNREVIEWED"||w.code==="UC_ARCHIVED")&&!await T(D=>i.ask(D),w))return i.note(`design child refused \u2014 approve it first: ${w.reviewCmd}`),2}catch{}let[{runDesign:c}]=await Promise.all([import("./run-PBS2J4N4.js")]),m="",b=(()=>{try{let p=k(n),T=p.resolve(s);return(T?p.getNode(T.cid)?.content?.title:void 0)??s}catch{return s}})(),{collectSessionItems:C}=await import("./session-items-2ATN7VXG.js"),N=C(i.state.turns).entries.length,S=i.state.credits?.total,ce=Date.now();i.ledger({kind:"childOpen",verb:d,subject:b});let de=p=>{let T=Math.max(1,Math.round((Date.now()-ce)/1e3)),w=C(i.state.turns).entries.length-N,B=i.state.credits?.total,D=B!==void 0&&S!==void 0?B-S:B;i.ledger(p===0?{kind:"childClose",verb:d,subject:b,ok:!0,durS:T,...w>0?{results:`${w} item${w===1?"":"s"}`}:{},...D!==void 0&&D>0?{credits:D}:{}}:{kind:"childClose",verb:d,subject:b,ok:!1,durS:T,exitCode:p,fixCmd:`kane-cli design tests --use-case ${s}${l||d==="evolve"?" --force":""}`});let X=C(i.state.turns).entries.length;i.ledger({kind:"childBack",parentVerb:"extract",context:`${X} draft${X===1?"":"s"} saved`})},R=1;try{R=await c({useCase:s,force:l,mode:"interactive"},{contextDir:n,agent:F,preflightTurn:x,ask:p=>i.ask(p),chat:i,nested:!0,out:p=>{m=p},progress:()=>{},isTTY:!0,auth:g})}finally{de(R)}return R!==0&&m&&i.note(m),R}},{makeReconcileDeps:ie}=await import("./reconcile-deps-DCHUFIEC.js"),oe=ie({contextDir:n,...t.changeContext?{changeContext:t.changeContext}:{},note:s=>i.note(s)}),ae={verb:"extract",sid:t.resume??o.ids.session_id,env:U(),...t.source?{subject:t.source}:{}},I=r(E.createElement(h,null,E.createElement(j,{into:q}),E.createElement(u,{controller:i,verb:"extract",onCtrlC:te,chain:se,inspect:ne,reconcile:oe,meta:ae})),{exitOnCtrlC:!1});_(()=>I.unmount());let K=null;try{let s=z(t,{contextDir:n,agent:F,preflightTurn:x,onSummary:d=>{P=d},ask:d=>i.ask(d),review:async d=>new Map(d.map(c=>[c.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:d=>i.note(d),progress:()=>{},isTTY:O(),auth:g,chat:i,telemetry:o});s.finally(()=>{V=!0});let l=await s;return K=l,l===1&&process.stderr.write(o.supportFooter()+`
8
- `),await o.end({exit_code:l}),l}catch(s){throw P||(P={state:"crashed",facts:[`the session ended unexpectedly \u2014 ${s instanceof Error?s.name:"error"}`]}),s}finally{V=!0,G&&clearTimeout(G),i.finalizeForExit(),await q.current?.flush();try{I.unmount()}catch{}P?$(P):K===1&&$({state:"interrupted",facts:["the session ended without saving \u2014 see the error above"]})}}async function Ce(t){let n=H({verb:"extract",mode:t.mode,contextRoot:A(process.cwd()),env:U(),resumeSid:t.resume,write:!0,longSession:!0}),{makeHeadlessIO:o,resolveEncoding:f,guardedChannels:g}=await import("./headless-io-66RG5NN5.js"),{withStructuredNext:y,prepareStructuredResume:x}=await import("./structured-answers-YAVW65G4.js"),r=y(o(f(t.mode),"extract")),{runWithChannel:v}=await import("./run-channel-RGH4WIQX.js"),h=f(t.mode)==="ndjson"?e=>v({event:a=>r.event(a)},e):e=>e();for(let e of t.landed??[]){let a=e;r.event({type:"ingested",source_id:e.source_id,status:e.status,cid:e.source_cid,...a.warnings?.length?{warnings:a.warnings}:{},...a.media?{media:a.media}:{},...a.duplicate_of?{duplicate_of:a.duplicate_of}:{},...a.lineage_candidate?{lineage_candidate:a.lineage_candidate}:{}})}let u;try{u=x({opts:t,contextDir:A(process.cwd()),verb:"extract"})}catch(e){let a=e instanceof Error?e.message:String(e);return r.out(`error: ${a}`),t.mode==="agent"&&r.event({type:"error",message:a}),await n.end({exit_code:1}),t.mode==="agent"?r.done(1,"error"):1}if(u.kind==="refuse")return r.out(u.error),t.mode==="agent"&&r.event({type:"error",message:u.error,code:u.code}),await n.end({exit_code:2}),t.mode==="agent"?r.done(2,"refused"):2;let j=t;if(u.kind==="apply"){for(let e of u.notes)r.out(e);if(u.matchedQids.length>0){r.out(`applying ${u.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let e of u.matchedQids)r.event({type:"panel_resolved",id:e,by:"user",via:"flag"})}u.statement&&(j={...t,message:[t.message,u.statement].filter(Boolean).join(`
9
-
10
- `)})}let{makeInterruptGuard:Q}=await import("./interrupt-guard-UREUWNRL.js"),_=Q(F,e=>r.out(e)),M=g(r,()=>_.interrupted(),/^error: (agent failed|repair run failed|agent ended)/);try{let e=await h(async()=>{let a={...await Y(),...n.spawnEnv()};return z(j,{contextDir:A(process.cwd()),agent:_.agent,preflightTurn:()=>L(a),ask:async()=>[],review:async k=>new Map(k.map(E=>[E.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!1,out:M.out,emit:M.emit,progress:r.progress,isTTY:!1,auth:a,telemetry:n})});return _.interrupted()&&e!==3?(r.out("interrupted \u2014 no session saved"),await n.end({exit_code:130}),r.done(130)):(e===1&&r.out(n.supportFooter()),await n.end({exit_code:e}),r.done(e))}catch(e){return r.event({type:"error",message:`error: extract failed: ${e instanceof Error?e.message:String(e)}`}),r.out(`error: extract failed: ${e instanceof Error?e.message:String(e)}`),r.out('hint: the full trace is in the file named on the "trace:" line at the start of this run'),r.done(1)}finally{_.dispose()}}export{Ce as bindExtractHeadless,be as bindExtractInteractive};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-WIAZN7G4.js";import"./chunk-EV64VI66.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{a as archiveImpact,b as heldArchiveScan,c as reviewCards,d as reviewCounts};
@@ -1,3 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as M,b as se,d as re}from"./chunk-OS4VSIHT.js";import{a as te,b as ne}from"./chunk-JDGBRACP.js";import"./chunk-5DT7PIGB.js";import{a as H,b as q,c as Q,d as X,e as Z,f as ee}from"./chunk-QQ5MHSSY.js";import{f as Y}from"./chunk-5GUD3CIH.js";import{a as O,b as F,c as G,d as z}from"./chunk-YMLC55J4.js";import"./chunk-NP3VGFZM.js";import"./chunk-EHN5HTUD.js";import"./chunk-CH273NAE.js";import"./chunk-KRL2BDI5.js";import"./chunk-VZ7KXRXB.js";import{C as V}from"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import{d as E,e as U}from"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-EYOCNMUM.js";import"./chunk-UR6MHSHU.js";function ge(e,t){return e.length===0?"not_run":Q(e,t).verified?"proven":q(e,t).some(r=>r.verdict==="failed")?"failing":"blocked"}function oe(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=ee(e),l=X(a).aspects[t],x={},d={},m=0,h=0,T=0;for(let g of a.usecases){let o=[];for(let b of g.acceptance_criteria){let f=b.executions??[],p=ge(f,r);o.push(p),p==="failing"?m++:p==="blocked"?h++:p==="not_run"&&T++;let y=[],c;if(p==="failing"){let n=null;for(let u of b.covered_by){let v=e.execHistory(u).map(S=>({verdict:String(S.per_ac?.find(R=>R.ac_ref===b.id)?.verdict??S.verdict),oracle_mode:String(S.oracle_mode),ts:String(S.started_at),execution_id:String(S.execution_id)})).filter(S=>r.counted_verdicts.includes(S.verdict)&&r.accepted_oracle_modes.includes(S.oracle_mode)),$=v[v.length-1];$?.verdict==="failed"&&(y.push(u),(!n||$.ts>n.ts)&&(n={ts:$.ts,execution_id:$.execution_id}))}c=n?.execution_id}else p==="blocked"&&(c=f[f.length-1]?.execution_id);x[b.id]={state:p,viaTests:y,...c?{executionId:c}:{}}}let i=o.some(b=>b!=="not_run"),_=l.usecases[g.id],k=i?_.status==="covered"?"proven":_.status==="partial"?"partial":o.includes("failing")?"failing":o.includes("blocked")?"blocked":"not_run":"not_run";d[g.id]={pct:_.pct,status:k}}return{aspect:t,pct:l.summary.coverage_pct,acs_proven:l.summary.acs_verified,failing:m,blocked:h,not_run:T,latest_run:s,perUc:d,perAc:x,config:{...r,source:"graph_execution_facts",denominator:"current_live_acs"}}}var me=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],he={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"},C={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 ve(e,t=5){let s=e.trim().split(/\s+/);return s.slice(0,t).join(" ")+(s.length>t?"\u2026":"")}function be(e,t){let s=e.resolve(t),r=s?e.getNode(e.tipOf(s.cid))?.content:null;return String(r?.title??r?.text??"")}function ie(e,t){let s=e.resolve(t);return{id:s?e.displayNameOf(e.tipOf(s.cid))??e.displayNameOf(s.cid):null,title:ve(be(e,t),8)}}function ye(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 G(e,r);if(a===E.TEST){let l=e.edgesFrom(r).find(d=>d.type===U.VERIFIES&&O(e,d.dst));if(l)return G(e,l.dst);let x=e.edgesFrom(r).find(d=>d.type===U.AUTOMATES&&O(e,d.dst));if(x){let d=e.edgesFrom(x.dst).find(m=>m.type===U.BELONGS_TO&&O(e,m.dst));return d?d.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 xe(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 ae(e,t,s,r,a){let l=a.servePaths??new Map,x=e.byLabel(E.USECASE).filter(({cid:o})=>O(e,o)),d=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,...ie(e,o.ref)},_=ye(e,o.ref),k=_?m.get(_):void 0;k&&L(o)!=="other"?k.push(i):h.push(i)}let T=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=G(e,o),_=i?T.get(i):void 0;if(!_)continue;_.total++;let k=F(e,o);if(k&&_.designed++,!r)continue;let b=e.nameOf.get(o)??o,f=r.perAc[b];if(!f)continue;let{id:p,title:y}=ie(e,b),c={ref:e.displayNameOf(o)??o,id:p,title:y,risk:xe(e,b),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(u=>a.testFiles.get(u)??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"&&k&&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 _=e.displayNameOf(o)??o,k=e.nameOf.get(o)??o,b=s.perUc[_]??{pct:0,status:"undesigned",staleAcs:0},f=r?r.perUc[k]??{pct:0,status:"not_run"}:null,p=r!==null&&(f===null||f.status==="not_run"),y=T.get(o),c=m.get(o)??[],n=new Set(c.filter(v=>L(v)==="needs-refresh").map(v=>v.ref)),u=[];for(let v of me){let $=c.filter(R=>L(R)===v);if(v==="needs-tests"&&($=$.filter(R=>!n.has(R.ref))),$.length===0)continue;$.sort((R,w)=>(C[R.risk]??3)-(C[w.risk]??3)||D(R.ref,w.ref));let S=v==="failing"||v==="blocked"||$.length<=2||new Set($.map(R=>R.ready_command)).size>1;u.push({key:v,label:he[v],...v==="needs-refresh"?{suffix:"source moved since these were designed"}:{},rows:$,...S?{}:{rosterCommand:$[0].ready_command}})}g.push({slug:_,title:String(i.title??""),risk:String(i.risk??""),des:b,prov:f,provAbsent:p,acTotal:y.total,acDesigned:y.designed,groups:u})}return g.sort((o,i)=>(C[o.risk]??3)-(C[i.risk]??3)||D(o.slug,i.slug)),h.sort((o,i)=>(C[o.risk]??3)-(C[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"},ke=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate"];function le(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 $e(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 ue(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=[],d=new Set;for(let g of ke){let o=r.get(g);if(o){for(let i of o){let _=g==="failing"&&i.via_tests?.length?` \xB7 via ${i.via_tests.map(k=>I(k)).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)+_})}if(g==="failing"||g==="blocked")for(let i of o)i.servePath&&d.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"&&d.add(i.ready_command)}}let m=[...d].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")??[],T=e.pa===null?t.acDesigned:h.length;return e.pa!==null&&T>0&&x.push(`${T} to run`),{uc:t,rows:a,spans:l,tails:x,toRun:T,severity:$e(t,s)}}function de(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(),d=[],m=r?.latest_run?`last run ${le(r.latest_run.started_at,x)}`:"no runs yet";d.push(`coverage \u2014 designed \xD7 proven \xB7 ${e.aspect} \xB7 ${m}`),d.push(""),d.push(P(`designed ${String(s.pct).padStart(3)}% ${N(s.pct,10)} ${s.acs_designed} ACs have a verifying test`,t.color)),r?d.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)):d.push("proven \u2014 no runs recorded yet \xB7 run tests, then re-run"),d.push("");let h=e.ucs.map(n=>ue(e,n));h.sort((n,u)=>n.severity-u.severity||D(n.uc.slug,u.uc.slug));let T=h.some(n=>n.rows.length||n.spans.length||n.tails.length||r!==null&&n.toRun>0),g=n=>{let[u,v]=n.split("/").map(Number);return v>0&&u===v};if(!T&&g(s.acs_designed)&&(r===null||g(r.acs_proven))){let n=e.ucs.length,u=`use-case${n===1?"":"s"}`;return d.push(r?`no gaps \u2014 all ${n} ${u} designed and proven`:`no gaps \u2014 all ${n} ${u} designed \xB7 nothing run yet`),d.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),d}let o=(n,u)=>n.groups.filter(v=>u.includes(v.key)).reduce((v,$)=>v+$.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})),_=[];i.some(n=>n.failing)&&_.push({hdr:"FAILING",get:n=>n.failing}),i.some(n=>n.blocked)&&_.push({hdr:"BLOCKED",get:n=>n.blocked}),i.some(n=>n.stale)&&_.push({hdr:"STALE",get:n=>n.stale}),i.some(n=>n.design)&&_.push({hdr:"TO DESIGN",get:n=>n.design}),i.some(n=>n.run)&&_.push({hdr:"TO RUN",get:n=>n.run}),a<100&&(_.length=0);let k=Math.min(16,Math.max(4,...h.map(n=>I(n.uc.slug).length))),b=15,f=_.map(n=>n.hdr.length+2),p=a-k-2-3-b-3-b-f.reduce((n,u)=>n+u,0)-2,y=n=>n.padStart(Math.floor((b+n.length)/2)).padEnd(b),c=`${" ".repeat(k+2)}${"USE CASE".padEnd(p+3)}${y("DESIGNED")} ${y("PROVEN")}`+_.map((n,u)=>n.hdr.padStart(f[u])).join("");d.push(l(c.trimEnd().slice(0,a)));for(let n of i){let u=n.band.uc,v=`${String(u.des.pct).padStart(3)}% ${N(u.des.pct,10)}`,$=r===null||u.provAbsent?we("no runs",b,t.color):`${String(u.prov?.pct??0).padStart(3)}% ${N(u.prov?.pct??0,10)}`,S=_.map((w,j)=>String(w.get(n)||"\u2014").padStart(f[j])).join(""),R=`${B(I(u.slug),k).padEnd(k)} ${B(u.title,p).padEnd(p)} ${v} ${$}${S}`;d.push(P(R,t.color))}return d.push(""),d.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),d}function we(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("%","")),d=x===100?"\x1B[32m":"\x1B[33m";return`${x===0?"\x1B[31m":d}${r}\x1B[39m ${d}${a}\x1B[39m\x1B[2m${l}\x1B[22m`}):e}function pe(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,d=r.now??Date.now(),m=[],h=e.ucs.find(p=>p.slug===t),T=a?.latest_run?`last run ${le(a.latest_run.started_at,d)}`:"no runs yet";m.push(`${I(t)} \xB7 ${h?.title??""} \u2014 risk ${h?.risk??"\u2014"} \xB7 ${e.aspect} \xB7 ${T}`.slice(0,l)),m.push("");let g=h?ue(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,_=5,k=l-o-2-i-2-_-2;m.push(x(`${" ".repeat(o+2)}${"STATE".padEnd(i+2)}${"RISK".padEnd(_+2)}ACCEPTANCE CRITERION`));let b=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=[],u="";for(let v of c)u&&u.length+1+v.length>k?(n.push(u),u=v):u=u?`${u} ${v}`:v;u&&n.push(u),n.forEach((v,$)=>{$===0?m.push(`${B(I(p.id),o).padEnd(o)} ${b(p.state.padEnd(i))} ${p.risk.padEnd(_)} ${v}`):m.push(`${" ".repeat(o+2+i+2+_+2)}${v}`)})}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(u=>u.state==="blocked"||u.state==="failing").map(u=>I(u.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 u=c.cmd.lastIndexOf(" ",l-n.length),v=u>0?c.cmd.slice(0,u):c.cmd.slice(0,l-n.length),$=u>0?c.cmd.slice(u+1):c.cmd.slice(l-n.length);m.push(`${n}${y(v)}`),m.push(`${" ".repeat(n.length)}${y($)}`),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(ce)})),other:e.other.filter(a=>W(e.stage,a)).map(ce)}}function ce(e){let{servePath:t,viaFiles:s,meta:r,...a}=e;return{...a}}async function Te(e,t,s=re(),r=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return M(s,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:k,agentRefusal:b}=await import("./headless-io-66RG5NN5.js"),{parsesAgainstGrammar:f}=await import("./next-TRSKMBO5.js"),p=k("ndjson","gaps",{stdout:w=>s.out(w.replace(/\n$/,"")),stderr:w=>(s.err??s.out)(w.replace(/\n$/,""))}),y=[],c=[],n={out:w=>y.push(w),err:w=>c.push(w),confirm:async()=>!1,isTTY:!1};if(await Te(e,{...t,json:!0,mode:void 0},n,r)!==0)return b(p,c.join("; ")||"cover gaps refused");let v=JSON.parse(y.join(`
3
- `));p.event({type:"gaps",...v});let $=[],S=new Set,R=(w,j)=>{if(Array.isArray(w)){for(let A of w)R(A,j);return}if(w&&typeof w=="object"){let A=w,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),$.push({cmd:A.ready_command,why:J||"close the gap"}));for(let fe of Object.values(A))R(fe,J)}};return R(v,"close the gap"),p.done(0,void 0,$.slice(0,4))}let a=t.stage??"all";if(a!=="design"&&a!=="cover"&&a!=="all")return M(s,`--stage must be design | cover | all, got '${a}'`),2;if(t.top!==void 0&&(!Number.isInteger(t.top)||t.top<1))return M(s,"--top must be a positive integer"),2;let l=t.rollup??"lenient";if(l!=="lenient"&&l!=="strict")return M(s,`--rollup must be lenient | strict, got '${l}'`),2;let x=se(r,s);if(!x)return 2;let d=V(x),m=Z(d),h=oe(d,l),T=await z(d,"design"),g=new Map;if(h)for(let k of Object.values(h.perAc)){if(!k.executionId||g.has(k.executionId))continue;let b=await Y(k.executionId,r);b&&g.set(k.executionId,Re(b,r))}let o=new Map;for(let[k,b]of ne(te(r)))b.length===1&&o.set(k,b[0].split("/").pop());let i=ae(d,T,m,h,{stage:a,top:t.top,aspect:l,servePaths:g,testFiles:o});if(e!==void 0){let k=d.resolve(e),b=k?d.tipOf(k.cid):null;if(!b||d.nodeLabel.get(b)!==E.USECASE||!O(d,b))return M(s,`no use-case '${e}' in the graph`),2;let f=d.displayNameOf(b)??b;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=Se(d,b,h,o),y=s.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let c of pe(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 _=s.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let k of de(i,{width:_,color:s.isTTY}))s.out(k);return 0}function Re(e,t){let s=t.endsWith("/")?t:t+"/";return e.startsWith(s)?e.slice(s.length):e}function Se(e,t,s,r){let a=[];for(let{cid:l,content:x}of e.byLabel(E.AC)){if(!O(e,l)||G(e,l)!==t)continue;let d=F(e,l),m=e.nameOf.get(l)??l,h=s?.perAc[m],T=e.stale(l)!=="fresh",g=d?h?.state==="proven"?"proven \u2713":h?.state==="failing"?"failing":h?.state==="blocked"?"blocked":T?"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{Te as gapsCommand};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h}from"./chunk-5DT7PIGB.js";import"./chunk-UR6MHSHU.js";export{a as EVENT_SCHEMA_VERSION,e as MAX_MESSAGE_BYTES,g as agentRefusal,c as bothTTY,h as guardedChannels,d as makeHeadlessIO,b as resolveEncoding,f as validateResumeMessage};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{i as a,j as b,k as c,l as d,m as e}from"./chunk-54JZ6VEW.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-NVGBE2DR.js";import"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{a as compositePayloadBytes,e as ingestBytes,d as ingestFile,b as slugFromFilename,c as versionBaseOf};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-RV7Q4RUV.js";import"./chunk-R7QAS6LZ.js";import"./chunk-XS2LZFCH.js";import"./chunk-BKHXPBWN.js";import"./chunk-VDM3TWF6.js";import"./chunk-54JZ6VEW.js";import"./chunk-DNNZ353O.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-YKTYVJBN.js";import"./chunk-5DT7PIGB.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSGW4JDG.js";import"./chunk-NJJQL54J.js";import"./chunk-UR6MHSHU.js";export{c as ingestCommand,b as runIngestCommand,a as runIngestWithResults};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as a}from"./chunk-WMVPJWWA.js";import"./chunk-4E4GJPEM.js";import"./chunk-NJJQL54J.js";import"./chunk-UR6MHSHU.js";export{a as installPlugin};