@testmuai/kane-cli 0.8.13 → 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 (300) hide show
  1. package/dist/{ChatSurface-B6ZIO3JL.js → ChatSurface-AVL3TJA2.js} +3 -3
  2. package/dist/{ChromeProfilePicker-QSICCUMV.js → ChromeProfilePicker-WJZJOZ6Z.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-LLLNSKW2.js → CliFeedbackPrompt-65BQF5G5.js} +1 -1
  4. package/dist/{CliUploadProgress-N5IY66T2.js → CliUploadProgress-HEBZYKGN.js} +1 -1
  5. package/dist/{ConfigView-UQIRPENS.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-ZGSLEOPE.js → InfoBox-KM5DLBCV.js} +1 -1
  9. package/dist/{LinksBox-JFT44YUK.js → LinksBox-FQA36GTV.js} +1 -1
  10. package/dist/{ProfilesView-WZSPK3HF.js → ProfilesView-76KGHTMK.js} +1 -1
  11. package/dist/{ProjectPicker-SBBGVF4L.js → ProjectPicker-65YOU46H.js} +1 -1
  12. package/dist/{SaveSessionPrompt-F3563T3C.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-6N6NESLI.js → SummaryBox-N2B6DUDD.js} +1 -1
  16. package/dist/TestMdRunView-WA4TC5PT.js +2 -0
  17. package/dist/{TestrunEvidenceTable-JLJBJ76Q.js → TestrunEvidenceTable-3WLQVTF4.js} +1 -1
  18. package/dist/{WhoamiView-PNVUCWLB.js → WhoamiView-T26HA4ZZ.js} +1 -1
  19. package/dist/agent-parse-XMWVKCRD.js +2 -0
  20. package/dist/{app-download-NNB52ZRJ.js → app-download-XKZWFMEK.js} +1 -1
  21. package/dist/attach-target-V6LECVES.js +2 -0
  22. package/dist/{auth-JIDDELKY.js → auth-PPJANIMZ.js} +1 -1
  23. package/dist/{binary-LXYAW7WQ.js → binary-DKWWODT2.js} +1 -1
  24. package/dist/bind-62AZYFAY.js +15 -0
  25. package/dist/{bootstrap-THOC3SS7.js → bootstrap-6IJNZIPT.js} +1 -1
  26. package/dist/bridge-X5DEJL6F.js +2 -0
  27. package/dist/{changelog-BSMZXLTG.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-FNIL4G3V.js → chunk-2BFXT7VQ.js} +3 -3
  32. package/dist/{chunk-3FXNQTCE.js → chunk-2RMHDOP4.js} +1 -1
  33. package/dist/{chunk-7GUFVQOQ.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-I75FRXKE.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-VYMMGWVO.js → chunk-4BBDKWM3.js} +1 -1
  40. package/dist/{chunk-J2UN2AHO.js → chunk-4K5XTIJ6.js} +1 -1
  41. package/dist/chunk-52WM3XYO.js +4 -0
  42. package/dist/{chunk-WUV3FJ7C.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-2X3TANEV.js → chunk-6F6YI3ZG.js} +1 -1
  47. package/dist/chunk-6LGED4FC.js +35 -0
  48. package/dist/chunk-73ULUGBM.js +5 -0
  49. package/dist/{chunk-F5AI3UVS.js → chunk-75I46VTM.js} +2 -2
  50. package/dist/{chunk-SEKJZOKW.js → chunk-7L25ZNNP.js} +1 -1
  51. package/dist/chunk-7O54QURK.js +2 -0
  52. package/dist/{chunk-XAM5E27U.js → chunk-7RAI77XD.js} +1 -1
  53. package/dist/{chunk-PWRIG6UB.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-AQWTK6IN.js → chunk-ARG56PJG.js} +1 -1
  57. package/dist/{chunk-33GXXC2L.js → chunk-B2ZGG7WM.js} +1 -1
  58. package/dist/{chunk-LAQBCZ5A.js → chunk-BAKJPQGU.js} +1 -1
  59. package/dist/{chunk-DIM5X2FR.js → chunk-BJYGWXVP.js} +1 -1
  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-EXLXV5OU.js → chunk-DA57DXCF.js} +1 -1
  64. package/dist/{chunk-PUM5J56E.js → chunk-EMSLJTYN.js} +1 -1
  65. package/dist/{chunk-YEZYO5QH.js → chunk-FFFB5BXL.js} +1 -1
  66. package/dist/{chunk-WIAZN7G4.js → chunk-FFVNISYH.js} +1 -1
  67. package/dist/chunk-FQNQVC5O.js +5 -0
  68. package/dist/{chunk-UF4JZXEE.js → chunk-GESG672R.js} +1 -1
  69. package/dist/{chunk-XL6HDWM3.js → chunk-GKZ2KVE6.js} +1 -1
  70. package/dist/chunk-GP7WD4UY.js +4 -0
  71. package/dist/{chunk-PYQS5ST6.js → chunk-GPIXV7AV.js} +2 -2
  72. package/dist/chunk-H6TNBKGR.js +5 -0
  73. package/dist/chunk-HOA4VWSD.js +5 -0
  74. package/dist/chunk-IE3OO5GI.js +2 -0
  75. package/dist/chunk-IICQ5KRD.js +5 -0
  76. package/dist/{chunk-K4SULRBL.js → chunk-IQ7GPETF.js} +1 -1
  77. package/dist/{chunk-3M2D7UUI.js → chunk-IQ7NGOAT.js} +1 -1
  78. package/dist/{chunk-TMRLBSIA.js → chunk-J7NRD4Q7.js} +1 -1
  79. package/dist/{chunk-FE6XRABM.js → chunk-JH6E632O.js} +1 -1
  80. package/dist/{chunk-XH2KDLZO.js → chunk-JJJSDDQ2.js} +1 -1
  81. package/dist/{chunk-BTBUIL4Q.js → chunk-JKX57HA7.js} +1 -1
  82. package/dist/{chunk-VJ3ES3RR.js → chunk-K7K23DIQ.js} +1 -1
  83. package/dist/chunk-KN65CUNT.js +15 -0
  84. package/dist/{chunk-CAO3XRA2.js → chunk-KOL6ZWOQ.js} +1 -1
  85. package/dist/{chunk-MCKBJIBB.js → chunk-KOPP4CJW.js} +1 -1
  86. package/dist/chunk-KZG4E5RM.js +2 -0
  87. package/dist/{chunk-J3Q63NFG.js → chunk-L4M7753M.js} +1 -1
  88. package/dist/{chunk-BJAHVN2F.js → chunk-L6MOO4WT.js} +1 -1
  89. package/dist/chunk-LBNADEQN.js +8 -0
  90. package/dist/{chunk-Q4YAJJPP.js → chunk-LL5DQO6V.js} +1 -1
  91. package/dist/chunk-LNV7C2YO.js +6 -0
  92. package/dist/{chunk-JX2CAVX6.js → chunk-LR5DJ6EN.js} +1 -1
  93. package/dist/{chunk-IZU5ND2C.js → chunk-M7DN6FO3.js} +1 -1
  94. package/dist/chunk-MLRO7OH3.js +9 -0
  95. package/dist/{chunk-DMLYUTS4.js → chunk-MNE5VMHT.js} +1 -1
  96. package/dist/{chunk-TDNM22BQ.js → chunk-N7ZRF5K3.js} +1 -1
  97. package/dist/{chunk-TXZ66K4Q.js → chunk-NBMLBCJ3.js} +1 -1
  98. package/dist/{chunk-KSLJOUH4.js → chunk-NDCRJXYF.js} +1 -1
  99. package/dist/{chunk-XS3HIVNS.js → chunk-NOLYYHVG.js} +1 -1
  100. package/dist/{chunk-IWVA37B6.js → chunk-O25AL4B7.js} +1 -1
  101. package/dist/{chunk-AIVOYTYQ.js → chunk-O2APH6TZ.js} +1 -1
  102. package/dist/{chunk-KAZGHWGK.js → chunk-O3XBIURC.js} +1 -1
  103. package/dist/{chunk-ZOSY2PJM.js → chunk-O5AS2ZIX.js} +1 -1
  104. package/dist/{chunk-DXFMELKC.js → chunk-O6U2HU5M.js} +1 -1
  105. package/dist/{chunk-NUWOQS6L.js → chunk-OH2NSBO6.js} +1 -1
  106. package/dist/{chunk-ARU6KAGY.js → chunk-OO5GMBVI.js} +1 -1
  107. package/dist/chunk-OPL2MIQG.js +2 -0
  108. package/dist/chunk-P3JUE2RM.js +17 -0
  109. package/dist/{chunk-D4G3SEBU.js → chunk-PGU64EWQ.js} +1 -1
  110. package/dist/{chunk-GILD6RGH.js → chunk-Q7XBMBMR.js} +1 -1
  111. package/dist/{chunk-OHK6V7JX.js → chunk-QJ5O27SJ.js} +1 -1
  112. package/dist/{chunk-KXUTO5WC.js → chunk-QPUVOVD7.js} +1 -1
  113. package/dist/{chunk-NM76SG3S.js → chunk-RBHQXWR7.js} +1 -1
  114. package/dist/{chunk-LWQNRZH3.js → chunk-RH6KFHJB.js} +1 -1
  115. package/dist/{chunk-FUP4AP6J.js → chunk-RQLU4NDG.js} +1 -1
  116. package/dist/{chunk-MXDWS7S4.js → chunk-SFTFHFG3.js} +7 -7
  117. package/dist/{chunk-4PARDPK2.js → chunk-SGHP44WS.js} +1 -1
  118. package/dist/{chunk-6AZNGOLH.js → chunk-SQDQADWD.js} +1 -1
  119. package/dist/{chunk-N2I23ANS.js → chunk-SX56MVUO.js} +1 -1
  120. package/dist/{chunk-O5U6EAL3.js → chunk-TCAHDVII.js} +1 -1
  121. package/dist/chunk-TNBF5OMZ.js +2 -0
  122. package/dist/chunk-TU6IMGWO.js +2 -0
  123. package/dist/{chunk-5G22NOZK.js → chunk-UHT5SVP5.js} +1 -1
  124. package/dist/{chunk-UZCSVEWP.js → chunk-UXH3RMQ7.js} +1 -1
  125. package/dist/{chunk-K2UEVCIJ.js → chunk-VNFCX2SH.js} +1 -1
  126. package/dist/{chunk-NU45ROHH.js → chunk-WBHSPN55.js} +2 -2
  127. package/dist/chunk-WILT62DP.js +16 -0
  128. package/dist/{chunk-QD2BUO5M.js → chunk-WOA7VCGA.js} +1 -1
  129. package/dist/{chunk-RN5ERSV2.js → chunk-WR42Q3HU.js} +1 -1
  130. package/dist/chunk-X5276I5H.js +9 -0
  131. package/dist/{chunk-477DYMXZ.js → chunk-X74PP5NJ.js} +1 -1
  132. package/dist/{chunk-KV5BOFPK.js → chunk-XGHMZJGI.js} +2 -2
  133. package/dist/{chunk-XS2LZFCH.js → chunk-YCH7H7JX.js} +1 -1
  134. package/dist/{chunk-7KIIM6H7.js → chunk-YHR2YAN5.js} +1 -1
  135. package/dist/chunk-YHVG7V3E.js +21 -0
  136. package/dist/chunk-YLQHY4A7.js +2 -0
  137. package/dist/{chunk-KGKJU27A.js → chunk-YYYQ5MVD.js} +1 -1
  138. package/dist/{chunk-W2UYUV47.js → chunk-ZA4M4O7E.js} +2 -2
  139. package/dist/chunk-ZKEOPIQ3.js +9 -0
  140. package/dist/chunk-ZUZ6QJRA.js +23 -0
  141. package/dist/{chunk-3SP4JVDN.js → chunk-ZWHPIR2Z.js} +2 -2
  142. package/dist/chunk-ZZTZJPT2.js +88 -0
  143. package/dist/committer-IYQPXG6C.js +2 -0
  144. package/dist/{config-BCGD2FEX.js → config-3AKWRTFS.js} +1 -1
  145. package/dist/cover-cmd-ZLAWMEC2.js +3 -0
  146. package/dist/{credentials-YNH5BU2Z.js → credentials-Q4WH5CBN.js} +1 -1
  147. package/dist/{deps-bundle-LOFI4DAJ.js → deps-bundle-RVZK6LZJ.js} +1 -1
  148. package/dist/{deps-resolve-GA6IPHVZ.js → deps-resolve-6F2U4TJP.js} +1 -1
  149. package/dist/design-committer-J57IAAA5.js +2 -0
  150. package/dist/dispatch-46BETGXY.js +2 -0
  151. package/dist/{doctor-W5TQBYB5.js → doctor-WRPG56HH.js} +1 -1
  152. package/dist/docx-convert-WPZS6OIC.js +2 -0
  153. package/dist/{dossier-Y6TJWFZU.js → dossier-UGJMYYAB.js} +1 -1
  154. package/dist/evidence-XWR32HWP.js +2 -0
  155. package/dist/evolve-cmd-27ZQN6YB.js +2 -0
  156. package/dist/explain-H5HJEDEF.js +2 -0
  157. package/dist/explain-cmd-JCJTXVZY.js +9 -0
  158. package/dist/{explain-cmd-XCRO4AS6.js → explain-cmd-R45I5MT7.js} +1 -1
  159. package/dist/extract-bind-D5BYYGYA.js +14 -0
  160. package/dist/{extract-cmd-7FKQJNS7.js → extract-cmd-CCYW7FIY.js} +3 -3
  161. package/dist/feeder-RSHMGW6B.js +2 -0
  162. package/dist/gaps-cmd-3VJKQ25D.js +3 -0
  163. package/dist/{generate-headless-OBMB5CSB.js → generate-headless-2M6UT3IK.js} +2 -2
  164. package/dist/headless-io-3A3BZVQ5.js +2 -0
  165. package/dist/index.js +188 -205
  166. package/dist/ingest-QGLVY7ND.js +2 -0
  167. package/dist/ingest-cmd-HVTUK264.js +2 -0
  168. package/dist/install-5WJLE7XT.js +2 -0
  169. package/dist/interactive-bind-OJCYNQPI.js +26 -0
  170. package/dist/lifecycle-cmd-GWFGUGTC.js +2 -0
  171. package/dist/{list-cmd-V3HJ5K4O.js → list-cmd-AXDW64OY.js} +1 -1
  172. package/dist/{list-commands-SH4HPFI4.js → list-commands-YNZ6EFIF.js} +1 -1
  173. package/dist/{locks-cmd-CSVSWY2Y.js → locks-cmd-67OHQZNV.js} +1 -1
  174. package/dist/logical-ids-DN6IZSUM.js +2 -0
  175. package/dist/login-flow-PRXFPRYZ.js +2 -0
  176. package/dist/maintenance-cmd-QEMK6YNV.js +2 -0
  177. package/dist/{mobile-prompts-UZTRJ3L7.js → mobile-prompts-OXHA5GHJ.js} +1 -1
  178. package/dist/{objective-variable-gate-3VUXNDCZ.js → objective-variable-gate-76GYUHEP.js} +1 -1
  179. package/dist/open-provider-E5VUGFNE.js +2 -0
  180. package/dist/pdf-convert-5H4HQNN3.js +2 -0
  181. package/dist/{persist-recorded-session-QMRY4DOF.js → persist-recorded-session-KWPH37HI.js} +1 -1
  182. package/dist/phase-seed-HKJ2EF7R.js +2 -0
  183. package/dist/pipeline-A2OGF4XW.js +2 -0
  184. package/dist/prepare-target-P6BWJZBZ.js +2 -0
  185. package/dist/readmodel-IBFRM6EO.js +2 -0
  186. package/dist/reconcile-cmd-V7TDYETT.js +2 -0
  187. package/dist/reconcile-deps-X6IGH4CA.js +4 -0
  188. package/dist/reconcile-engine-OGXSIE7O.js +2 -0
  189. package/dist/{recording-banner-7E75ERQJ.js → recording-banner-IZWN2XFY.js} +1 -1
  190. package/dist/records-TJJJWBUD.js +2 -0
  191. package/dist/registry-GOLIFVK5.js +2 -0
  192. package/dist/{require-project-folder-LBUYWQOF.js → require-project-folder-PEEUITK6.js} +1 -1
  193. package/dist/{resolve-run-intent-GHISMXLZ.js → resolve-run-intent-JGXXE45Y.js} +1 -1
  194. package/dist/{resolver-7JC5VZ4S.js → resolver-TY7XLJBN.js} +1 -1
  195. package/dist/revert-6BBBK3I4.js +2 -0
  196. package/dist/review-cmd-74YTPT7E.js +5 -0
  197. package/dist/run-DN4XARP2.js +2 -0
  198. package/dist/run-GRYWYKIH.js +2 -0
  199. package/dist/{run-test-md-5LPCKCW7.js → run-test-md-DFCKCQ4T.js} +2 -2
  200. package/dist/sessions-NH7WQWMX.js +2 -0
  201. package/dist/{sessions-cmd-VDQGRBEM.js → sessions-cmd-DV442ZCY.js} +1 -1
  202. package/dist/{skill-installer-YQPZZB7I.js → skill-installer-GRU3HOYF.js} +1 -1
  203. package/dist/{spawner-X2FOOONV.js → spawner-LNMD4NJF.js} +1 -1
  204. package/dist/store-guard-Q4MYZQHF.js +2 -0
  205. package/dist/structured-answers-NADW6D44.js +5 -0
  206. package/dist/sync-cmd-H6Y5EB3L.js +2 -0
  207. package/dist/sync-setup-THGRBKTA.js +2 -0
  208. package/dist/sync-setup-ui-RC727VK6.js +3 -0
  209. package/dist/tcg-generate-SZZ7MJXY.js +2 -0
  210. package/dist/testmd-actions-MRIUOOXO.js +2 -0
  211. package/dist/testmd-sync-UYVJ47BN.js +2 -0
  212. package/dist/token-refresh-KN5JK2U4.js +2 -0
  213. package/dist/{validate-basic-GTSVZFQI.js → validate-basic-RCBEELSB.js} +1 -1
  214. package/dist/{variable-receipt-IHQAYWMZ.js → variable-receipt-JHRW73Z6.js} +1 -1
  215. package/dist/verdicts-XFXDRND4.js +2 -0
  216. package/dist/{version-check-IPEPJZDX.js → version-check-Z774UWW3.js} +1 -1
  217. package/dist/{view-cmd-SXXNDZIC.js → view-cmd-I4LQGJ2X.js} +1 -1
  218. package/dist/walk-session-FP52IGLB.js +2 -0
  219. package/dist/with-telemetry-P6RUPWBH.js +2 -0
  220. package/package.json +12 -11
  221. package/dist/EvidenceViewOffer-AZRAILJQ.js +0 -2
  222. package/dist/FolderPicker-OJFR7AKZ.js +0 -2
  223. package/dist/ScrollbackTap-Q3IOKNMS.js +0 -2
  224. package/dist/SingleShotApp-72D5VVLE.js +0 -2
  225. package/dist/TestMdRunView-4OA52DA2.js +0 -2
  226. package/dist/bind-F36JFHUK.js +0 -12
  227. package/dist/bridge-KMDML2NB.js +0 -2
  228. package/dist/chat-committer-RAOIL2T6.js +0 -2
  229. package/dist/chat-controller-YJCNU76T.js +0 -2
  230. package/dist/chunk-4WOVHRI2.js +0 -15
  231. package/dist/chunk-54JZ6VEW.js +0 -4
  232. package/dist/chunk-5DT7PIGB.js +0 -5
  233. package/dist/chunk-6FCPS2VT.js +0 -4
  234. package/dist/chunk-6IAA644J.js +0 -9
  235. package/dist/chunk-6J635CRI.js +0 -5
  236. package/dist/chunk-AGRUULPT.js +0 -4
  237. package/dist/chunk-BZTWTYQQ.js +0 -6
  238. package/dist/chunk-CUSTYILP.js +0 -2
  239. package/dist/chunk-DBIBROYW.js +0 -5
  240. package/dist/chunk-I27YRAGO.js +0 -7
  241. package/dist/chunk-IAHKTEET.js +0 -2
  242. package/dist/chunk-IVQX3AKL.js +0 -4
  243. package/dist/chunk-K6RAOZHP.js +0 -4
  244. package/dist/chunk-KO3FL2XW.js +0 -26
  245. package/dist/chunk-L32DKFRQ.js +0 -16
  246. package/dist/chunk-LPDBTGO5.js +0 -21
  247. package/dist/chunk-N7Z7BQYO.js +0 -3
  248. package/dist/chunk-NVGBE2DR.js +0 -2
  249. package/dist/chunk-OS4VSIHT.js +0 -4
  250. package/dist/chunk-OTMAFCZK.js +0 -8
  251. package/dist/chunk-P5MJMM3X.js +0 -85
  252. package/dist/chunk-QQ5MHSSY.js +0 -2
  253. package/dist/chunk-T7DGNWI2.js +0 -17
  254. package/dist/chunk-UH2ZTX4E.js +0 -2
  255. package/dist/chunk-W3Z7AZNT.js +0 -4
  256. package/dist/chunk-XMTSHHYQ.js +0 -4
  257. package/dist/committer-C6UCDYMC.js +0 -2
  258. package/dist/cover-cmd-5LPHIOSI.js +0 -3
  259. package/dist/design-committer-UPC6NZUF.js +0 -2
  260. package/dist/dispatch-FRCPK3AZ.js +0 -2
  261. package/dist/docx-convert-BIV5T7F5.js +0 -2
  262. package/dist/evidence-FHO36EEV.js +0 -2
  263. package/dist/evolve-cmd-6RXLKERE.js +0 -2
  264. package/dist/explain-3HAZY7Q6.js +0 -2
  265. package/dist/explain-cmd-RMJPXD4U.js +0 -9
  266. package/dist/extract-bind-BFJPRNPQ.js +0 -10
  267. package/dist/feeder-IOR3XRNF.js +0 -2
  268. package/dist/gaps-cmd-FDJ3PT4C.js +0 -3
  269. package/dist/headless-io-66RG5NN5.js +0 -2
  270. package/dist/ingest-TTUQ7UDK.js +0 -2
  271. package/dist/ingest-cmd-AV66Q5LC.js +0 -2
  272. package/dist/install-SFJ2FFQ6.js +0 -2
  273. package/dist/interactive-bind-N5AQB26T.js +0 -25
  274. package/dist/lifecycle-cmd-KSMETBPP.js +0 -2
  275. package/dist/logical-ids-MLXAH45L.js +0 -2
  276. package/dist/login-flow-ODVWEPRU.js +0 -2
  277. package/dist/maintenance-cmd-VFYGKY3X.js +0 -2
  278. package/dist/pdf-convert-OZIRUADA.js +0 -2
  279. package/dist/phase-seed-BMOSAA74.js +0 -2
  280. package/dist/pipeline-5FHWZAXK.js +0 -2
  281. package/dist/prepare-target-UJEY2FSR.js +0 -2
  282. package/dist/readmodel-TDRFVDVI.js +0 -2
  283. package/dist/reconcile-cmd-2QHZML2L.js +0 -2
  284. package/dist/reconcile-deps-ZBWUY3SM.js +0 -4
  285. package/dist/reconcile-engine-YC4RQYF2.js +0 -2
  286. package/dist/records-JLS63SDI.js +0 -2
  287. package/dist/registry-JJTRUPH7.js +0 -2
  288. package/dist/revert-PRR3D4XM.js +0 -2
  289. package/dist/review-cmd-SAGIKWEW.js +0 -4
  290. package/dist/run-43ACVPJK.js +0 -2
  291. package/dist/run-EOTOXNQO.js +0 -2
  292. package/dist/sessions-GIEXOCE4.js +0 -2
  293. package/dist/structured-answers-YAVW65G4.js +0 -5
  294. package/dist/tcg-generate-V4QRNEZV.js +0 -2
  295. package/dist/testmd-actions-2UMU3QMV.js +0 -2
  296. package/dist/testmd-sync-UBXDLWYD.js +0 -2
  297. package/dist/token-refresh-NL5AM446.js +0 -2
  298. package/dist/verdicts-QU6W3TUF.js +0 -2
  299. package/dist/walk-session-7JVB4Z5S.js +0 -2
  300. package/dist/with-telemetry-LRI7H6DH.js +0 -2
@@ -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,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,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-T7DGNWI2.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-33GXXC2L.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-LPDBTGO5.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-K2UEVCIJ.js";import"./chunk-YMLC55J4.js";import"./chunk-KO3FL2XW.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-OTMAFCZK.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-7GUFVQOQ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-NU45ROHH.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-NUWOQS6L.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-33GXXC2L.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-6AZNGOLH.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-BJAHVN2F.js";import"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import"./chunk-6IAA644J.js";import"./chunk-I27YRAGO.js";import"./chunk-5G22NOZK.js";import"./chunk-YEZYO5QH.js";import"./chunk-BZAGVBCX.js";import"./chunk-BB2W35TW.js";import"./chunk-GX3FPJUG.js";import"./chunk-427OQS2N.js";import{a as F}from"./chunk-KSLJOUH4.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-J2UN2AHO.js";import"./chunk-TMRLBSIA.js";import"./chunk-T7DGNWI2.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-AIVOYTYQ.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-33GXXC2L.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-B6ZIO3JL.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-43ACVPJK.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-ZBWUY3SM.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-L32DKFRQ.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-KO3FL2XW.js";import"./chunk-EHN5HTUD.js";import"./chunk-CH273NAE.js";import"./chunk-OTMAFCZK.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-I27YRAGO.js";import"./chunk-R7QAS6LZ.js";import"./chunk-XS2LZFCH.js";import"./chunk-BKHXPBWN.js";import"./chunk-T7DGNWI2.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-33GXXC2L.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{h as a}from"./chunk-DIM5X2FR.js";import"./chunk-XS3HIVNS.js";import"./chunk-33GXXC2L.js";import"./chunk-UR6MHSHU.js";export{a as installPlugin};
@@ -1,25 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f}from"./chunk-A2SQD2AY.js";import{a as D}from"./chunk-MXDWS7S4.js";import"./chunk-ZKSN2SJ7.js";import"./chunk-N7Z7BQYO.js";import"./chunk-KGKJU27A.js";import"./chunk-6IAA644J.js";import"./chunk-I27YRAGO.js";import"./chunk-5G22NOZK.js";import"./chunk-YEZYO5QH.js";import"./chunk-BZAGVBCX.js";import"./chunk-BB2W35TW.js";import"./chunk-GX3FPJUG.js";import"./chunk-427OQS2N.js";import"./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"./chunk-TMRLBSIA.js";import"./chunk-T7DGNWI2.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-EV64VI66.js";import"./chunk-L32DKFRQ.js";import{c as E}from"./chunk-5DT7PIGB.js";import"./chunk-J3Q63NFG.js";import"./chunk-KO3FL2XW.js";import"./chunk-NVGBE2DR.js";import{a as I}from"./chunk-CH273NAE.js";import"./chunk-OTMAFCZK.js";import"./chunk-VZ7KXRXB.js";import{a as C,b as $}from"./chunk-AIVOYTYQ.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-EYOCNMUM.js";import"./chunk-33GXXC2L.js";import"./chunk-UR6MHSHU.js";async function W(e){let[{render:o},t,{QuestionBatchPrompt:s}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),l=t.default??t;return new Promise(n=>{let y=o(l.createElement(s,{questions:e,onSubmit:w=>{y.unmount(),n(w)}}))})}async function q(e){let{createInterface:o}=await import("readline/promises"),t=o({input:process.stdin,output:process.stdout});try{return/^y(es)?$/i.test((await t.question(`${e} [y/N] `)).trim())}finally{t.close()}}async function X(e){let{createInterface:o}=await import("readline/promises"),t=o({input:process.stdin,output:process.stdout});try{process.stdout.write(`${e.message}
3
- `),process.stdout.write(` 1. start at ${e.earliest} instead \u2014 the earliest uncommitted phase (recommended)
4
- `),process.stdout.write(` 2. proceed anyway \u2014 noted on the record
5
- `),process.stdout.write(` 3. cancel
6
- `);let s=(await t.question("pick [1-3, \u23CE = 1] ")).trim();return s===""||s==="1"?"earliest":s==="2"?"proceed":"cancel"}finally{t.close()}}async function _(e){let{createInterface:o}=await import("readline/promises"),t=o({input:process.stdin,output:process.stdout});try{if(process.stdout.write(`${e.message}
7
- `),e.wall==="already-designed"){process.stdout.write(` 1. view the existing design (recommended)
8
- `),process.stdout.write(` 2. redesign \u2014 asks a reason; ${e.impactPairs} live pair(s) superseded
9
- `),process.stdout.write(` 3. pick another use-case
10
- `);let l=(await t.question("pick [1-3, \u23CE = 1] ")).trim();return l===""||l==="1"?{pick:"view"}:l==="2"?{pick:"redesign",because:(await t.question("because (reason for the redesign): ")).trim()}:{pick:"back"}}process.stdout.write(` 1. refresh first \u2014 evolve re-designs against the moved use-case (recommended)
11
- `),process.stdout.write(` 2. proceed anyway \u2014 asks a reason, noted on the record
12
- `),process.stdout.write(` 3. back
13
- `);let s=(await t.question("pick [1-3, \u23CE = 1] ")).trim();return s===""||s==="1"?{pick:"refresh"}:s==="2"?{pick:"proceed",because:(await t.question("because (reason for proceeding): ")).trim()}:{pick:"back"}}finally{t.close()}}async function ie(e){let[{resolveAgentAuthEnv:o},{runAgent:t},{preflightTurn:s}]=await Promise.all([import("./spawner-X2FOOONV.js"),import("./bridge-KMDML2NB.js"),import("./turn-preflight-JGYT7LXP.js")]),l=await o(),n=I(process.cwd()),{baseUrlAdvisory:y}=await import("./turn-preflight-JGYT7LXP.js"),w=y();w&&process.stderr.write(w+`
14
- `);let i=$({verb:"design",mode:e.plan?"cli":"interactive",contextRoot:n,env:C(),resumeSid:e.resume,write:!0,longSession:!0}),k={...l,...i.spawnEnv()},b=await s(k);if(!b.ok)return process.stderr.write((b.message??"error: turn-endpoint preflight failed")+`
15
- `),process.stderr.write(i.supportFooter()+`
16
- `),i.error("preflight_auth"),await i.end({exit_code:2}),2;let S=async()=>b;if(e.plan){let r=await D({...e,confirmRetarget:q,askPhaseEntry:X,askDesignEntry:_},{contextDir:n,agent:t,preflightTurn:S,ask:W,out:a=>process.stdout.write(a+`
17
- `),progress:a=>process.stderr.write(a+`
18
- `),isTTY:E(),auth:k,telemetry:i});return r===1&&process.stderr.write(i.supportFooter()+`
19
- `),await i.end({exit_code:r}),r}if(!e.resume&&e.useCase&&!e.phase){let[{openGraph:r},{designGate:a}]=await Promise.all([import("./readmodel-TDRFVDVI.js"),import("./gate-E3BLIUEA.js")]),u=r(n),c=a(u,e.useCase,!!e.force);if(!c.ok)if(c.wall){let{captureForceScope:M}=await import("./design-committer-UPC6NZUF.js"),d=await _({wall:c.wall.kind,message:c.message,display:c.wall.display,impactPairs:M(u,e.useCase).length});if(d.pick==="redesign"||d.pick==="proceed"){if(!d.because.trim())return process.stderr.write(`a redesign needs a reason (--because) \u2014 nothing executed
20
- `),2;e={...e,force:!0,because:e.because??d.because.trim()}}else return d.pick==="view"?(process.stdout.write(`view the existing design: kane-cli context view ${c.wall.display}
21
- `),0):d.pick==="refresh"?(process.stdout.write(`refresh it first: kane-cli maintain evolve ${c.wall.display}
22
- `),0):(process.stdout.write(`nothing executed \u2014 list use-cases: kane-cli context list
23
- `),0)}else return process.stderr.write(`design: ${c.message}
24
- `),c.code}let[{render:j},R,{ScrollbackProvider:G},{ChatSurface:N},{ScrollbackTap:V},{makeChatController:B},{setInkExit:O},Q]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-B6ZIO3JL.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:Y},{topologyDescriptor:z},{explain:U},{openGraph:v}]=Q,x=R.default??R,p=B({commitChatTurn:Y,descriptor:z("design"),contextDir:n,refreshGraph:()=>v(n),graph:v(n),explain:U,by:{kind:"human",id:"owner"}}),{buildDossier:H}=await import("./dossier-Y6TJWFZU.js"),J=r=>{try{return H(v(n),r)}catch{return null}},P={current:null},m=null,A=0,T=null,g=!1,K=()=>{if(A+=1,A>=2){try{h.unmount()}catch{}f({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 anything already committed is safe in the store"]}),process.exit(130)}p.requestPause(),T=setTimeout(()=>{g||(g=!0,(async()=>{p.finalizeForExit(),await P.current?.flush();try{h.unmount()}catch{}f({state:"interrupted",facts:["the agent did not confirm the pause within 5s \u2014 nothing new was saved"]}),process.exit(130)})())},5e3)},L={verb:"design",sid:e.resume??i.ids.session_id,env:C(),...e.useCase?{subject:e.useCase}:{}},h=j(x.createElement(G,null,x.createElement(V,{into:P}),x.createElement(N,{controller:p,verb:"design",onCtrlC:K,inspect:J,meta:L})),{exitOnCtrlC:!1});O(()=>h.unmount());let F=null;try{let r=D({...e,confirmRetarget:q},{contextDir:n,agent:t,preflightTurn:S,onSummary:u=>{m=u},ask:u=>p.ask(u),out:u=>p.note(u),progress:()=>{},isTTY:E(),auth:k,chat:p,telemetry:i});r.finally(()=>{g=!0});let a=await r;return F=a,a===1&&process.stderr.write(i.supportFooter()+`
25
- `),await i.end({exit_code:a}),a}catch(r){throw m||(m={state:"crashed",facts:[`the session ended unexpectedly \u2014 ${r instanceof Error?r.name:"error"}`]}),r}finally{g=!0,T&&clearTimeout(T),p.finalizeForExit(),await P.current?.flush();try{h.unmount()}catch{}m?f(m):F===1&&f({state:"interrupted",facts:["the session ended without saving \u2014 see the error above"]})}}export{ie as bindDesignInteractive};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l,b as a,c as f,d as m}from"./chunk-OS4VSIHT.js";import"./chunk-5DT7PIGB.js";import"./chunk-CH273NAE.js";import{A as v,C as c,t as y,u as b}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";var g={kind:"human",id:process.env.USER??"operator"},C=/^(UNKNOWN_|BAD_|INVALID_|MALFORMED_|NOT_|SLUG_TAKEN|ALREADY_|SUPERSEDED_)/;function w(e){return e.every(r=>C.test(r.code))?2:1}function p(e,r){for(let n of r)l(e,`${n.code}: ${n.detail}`);return w(r)}async function E(e,r,n,o=process.cwd()){let t=a(o,n);if(!t||!await f(n,`retire source ${e} (head \u2192 null + tombstone record)`,r.yes))return 2;let i=c(t),s=b({contextDir:t,graph:i,sourceId:e,reason:r.reason,by:g});return s.errors?p(n,s.errors):(n.out(`retired ${e} (record ${s.record.seq}) \u2014 its use-cases stay until no live source evidences them`),0)}async function _(e,r,n,o=process.cwd()){let t=a(o,n);if(!t)return 2;if(v.test(r))return l(n,`"${r}" is in the reserved sequential-id namespace (assigned at mint) \u2014 pick a descriptive name`),2;let i=c(t),s=y({contextDir:t,graph:i,assignments:[{ref:e,slug:r}],by:g});return s.errors?p(n,s.errors):(n.out(`named ${s.record.names[0].cid} as "${r}" (record ${s.record.seq})`),0)}async function x(e,r,n,o=process.cwd()){let t=a(o,n);if(!t)return 2;let i=Number(e);if(!await f(n,`revert record ${i} via a compensation record`,r.yes))return 2;let s=c(t),{commitRevert:$}=await import("./revert-PRR3D4XM.js"),d=$({contextDir:t,graph:s,seq:i,reason:r.reason,by:g});for(let h of d.warnings)n.out(`note: ${h}`);if(d.errors)return p(n,d.errors);let u=d.record;return n.out(`reverted record ${i} via compensation record ${u.seq}: ${u.supersessions.length} supersession(s), ${u.review.length} trust restoration(s), ${Object.keys(u.source_head_moves).length} head move(s) \u2014 history unchanged, effects inverted`),0}async function P(e,r){return E(e,r,m())}async function R(e,r){return _(e,r,m())}async function k(e={},r=process.cwd()){return D(e,m(),r)}async function D(e,r,n=process.cwd()){let o=a(n,r);if(!o||!await f(r,"assign logical ids to every live unnamed node (one commit record)",e.yes))return 2;let{backfillLogicalIds:t}=await import("./logical-ids-MLXAH45L.js"),i=c(o),s=t(o,i);return s.errors?p(r,s.errors):(r.out(s.assigned===0?"backfill: every live node already has a logical id":`backfill: assigned ${s.assigned} logical id(s) (record ${s.record.seq})`),0)}async function q(e,r){return x(e,r,m())}export{k as nameBackfillCommand,R as nameCommand,P as retireCommand,q as revertCommand,D as runNameBackfillCommand,_ as runNameCommand,E as runRetireCommand,x as runRevertCommand};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{t as d,y as f,z as m}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";var y=Object.keys(f).filter(n=>n!=="source");function b(n,t,u={kind:"system",id:"logical-id-backfill"}){let l=new Set(t.names.keys()),r=[];for(let c of y)for(let{cid:s,content:e}of t.byLabel(c)){if(t.superseded.has(s)||t.nameOf.has(s))continue;let a=typeof e.title=="string"&&e.title||typeof e.intent=="string"&&e.intent||typeof e.statement=="string"&&e.statement||typeof e.text=="string"&&e.text||"",i=a?m(c,a,g=>l.has(g)):null;i&&(l.add(i),r.push({ref:s,slug:i}))}if(r.length===0)return{record:null,errors:null,assigned:0};let o=d({contextDir:n,graph:t,assignments:r,by:u});return o.errors?{record:null,errors:o.errors,assigned:0}:{record:o.record,errors:null,assigned:r.length}}export{b as backfillLogicalIds};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-DMLYUTS4.js";import"./chunk-RFHMDQXZ.js";import"./chunk-LAQBCZ5A.js";import"./chunk-NUWOQS6L.js";import"./chunk-RZ4F3BHX.js";import"./chunk-3M2D7UUI.js";import"./chunk-33GXXC2L.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as E,c as N,d as f}from"./chunk-OS4VSIHT.js";import"./chunk-5DT7PIGB.js";import{a as u}from"./chunk-CH273NAE.js";import{c as l,d as p,e as _}from"./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";var a=["CHAIN_ERROR","CARDINALITY_VIOLATION","DOUBLE_SUPERSEDE","SUPERSEDE_CYCLE","EDGE_CYCLE","SUPERSEDE_UNKNOWN_OLD","SUPERSEDE_UNKNOWN_NEW","SUPERSEDE_UNKNOWN_ECID","NAME_UNKNOWN_TARGET","UNKNOWN_LABEL","UNKNOWN_EDGE_TYPE","ILLEGAL_EDGE","MISSING_SALIENT","MISSING_FIELD","UNKNOWN_FIELD","UNKNOWN_EDGE_PROP","BAD_ENUM","BAD_CHECK","DERIVED_MISSING","DERIVED_DRIFT","NODE_FILE_MISSING","NODE_FILE_MISMATCH","NODE_FILE_CORRUPT"];function I(e){let t=r=>{let n=a.indexOf(r);return n===-1?a.length:n},o=e[0]?.code??"fsck_failed";for(let r of e)t(r.code)<t(o)&&(o=r.code);return o}function S(e){let t=new Map;for(let s of e.issues)t.set(s.code,(t.get(s.code)??0)+1);let o=[...t.entries()].sort((s,d)=>d[1]-s[1]).map(([s,d])=>`${s}:${d}`);for(;o.length>1&&o.join("/").length>512;)o.pop();let r=o.join("/"),n=e.issues.map(s=>({code:s.code,detail:s.detail.length>512?s.detail.slice(0,512):s.detail})),i=[...n],c=JSON.stringify(i);for(;i.length>0&&Buffer.byteLength(c,"utf8")>16384;)i.pop(),c=JSON.stringify(i);let m=n.length-i.length;return{issue_count:e.issues.length,records:e.records,...e.pending!==void 0?{pending:e.pending}:{},codes:r,issues:c,...m>0?{issues_truncated:m}:{}}}async function O(e,t=process.cwd(),o,r={}){if(!E(t,e))return r.json&&e.out(JSON.stringify({ok:!1,error:"NO_STORE"})),2;let n=_(u(t));if(n.ok)return r.json?e.out(JSON.stringify(n)):e.out(n.pending?`ok: ${n.records} record(s) verified \u2014 ${n.pending} record(s) pending catch-up (applied automatically on the next command)`:`ok: ${n.records} record(s) verified, derived projection in parity`),0;if(r.json)e.out(JSON.stringify(n));else for(let i of n.issues)e.out(`issue: ${p(i)}`);return o&&(o.event("ASR_FSCK_REPORT",S(n)),o.error(I(n.issues))),1}async function D(e,t,o=process.cwd()){if(!E(o,t)||!await N(t,"wipe .context/derived and rebuild it from the verified commit chain",e.yes))return 2;let r=l(u(o));return t.out(`rebuilt: ${r.applied.seq} record(s) replayed, ${Object.keys(r.nodeLabel).length} node(s) projected`),0}async function A(e,t={}){return O(f(),process.cwd(),e,t)}async function b(e={}){return D(e,f())}export{A as fsckCommand,b as rebuildCommand,O as runFsckCommand,D as runRebuildCommand};
@@ -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-R7QAS6LZ.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import"./chunk-NVGBE2DR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";export{e as PDFJS_VERSION,b as PDF_IMAGE_CAP,a as PDF_IMAGE_DIMENSION_FLOOR,d as PDF_IMAGE_MAX_BYTES,c as PDF_VISION_BYTE_BUDGET,f as PdfConvertError,g as convertPdf};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as p}from"./chunk-KAZGHWGK.js";import{c}from"./chunk-N7Z7BQYO.js";import"./chunk-KGKJU27A.js";import{a as g}from"./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{e as d}from"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";var u=["grounding","acs","scenarios","wiring","tests"];function l(i,r,o){let s=r.resolve(o);if(s===null)return[];let n=g(r,s.cid),a=c(d(i).records,n),e=a.reduce((t,m)=>Math.max(t,m.generation),0);return a.filter(t=>t.generation===e)}function E(i,r,o,s){let n=u;if(!n.includes(s))return{ok:!1,code:"UNKNOWN_PHASE",message:`--phase must be one of ${n.join(" | ")}, got '${s}'`,valid:[...n]};let a=new Set(l(i,r,o).map(t=>t.phase)),e=n.slice(0,n.indexOf(s)).filter(t=>t!=="grounding"&&!a.has(t));return e.length===0?{ok:!0,phase:s}:{ok:!1,code:"PHASE_ORDER",message:`--phase ${s} needs ${e.join(" + ")} committed first (nothing recorded for ${e.join(", ")})`,missing:e,earliest:e[0]}}function y(i,r,o,s){let n=l(i,r,o),a=r.resolve(o);if(a===null)return{priorDesign:void 0,phaseLadder:n};let e=p(r,a.tip);return{priorDesign:e.scenarios.length===0&&e.tests.length===0&&e.acs.length===0?void 0:e,phaseLadder:n}}function R(i,r,o){return`kane-cli design tests --use-case ${i} --phase ${r}${o?" --mode agent":""}`}export{u as PHASE_ORDER,y as buildPhaseSeed,E as checkPhaseEntry,R as phaseEntryCmd,l as phaseLadderFor};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-6J635CRI.js";import"./chunk-PDXZROJM.js";import"./chunk-LPDBTGO5.js";import"./chunk-QQ5MHSSY.js";import"./chunk-5GUD3CIH.js";import"./chunk-K2UEVCIJ.js";import"./chunk-YMLC55J4.js";import"./chunk-KO3FL2XW.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-CH273NAE.js";import"./chunk-NBXYL2JT.js";import"./chunk-OTMAFCZK.js";import"./chunk-VZ7KXRXB.js";import"./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-7GUFVQOQ.js";import"./chunk-BPMSNGXQ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-NU45ROHH.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-NUWOQS6L.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-33GXXC2L.js";import"./chunk-UR6MHSHU.js";export{c as UploadPipeline,b as packPresignEntry,a as readPackForUpload};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{h as a,i as b,j as c,k as d,l as e,m as f}from"./chunk-2X3TANEV.js";import"./chunk-7GUFVQOQ.js";import"./chunk-XH2KDLZO.js";import"./chunk-FUP4AP6J.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-NU45ROHH.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-PWRIG6UB.js";import"./chunk-TAOHYWEO.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-33GXXC2L.js";import"./chunk-UR6MHSHU.js";export{a as MobileHostUnsupportedError,b as MobilePreflightError,c as PACKAGE_ID_REJECTED,e as isInstallablePath,f as prepareTarget,d as toAppSpec};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{C as a,D as b,E as c}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";export{a as openGraph,b as staleForEvolve,c as supersessionChainOf};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f}from"./chunk-K6RAOZHP.js";import"./chunk-F5AI3UVS.js";import"./chunk-6AZNGOLH.js";import"./chunk-OS4VSIHT.js";import"./chunk-KAZGHWGK.js";import"./chunk-KGKJU27A.js";import"./chunk-W5TTF7GB.js";import"./chunk-BZAGVBCX.js";import"./chunk-JUJ4SAGH.js";import"./chunk-6J5T5FEY.js";import"./chunk-UJZZDPDY.js";import"./chunk-O5U6EAL3.js";import"./chunk-T7DGNWI2.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-YMLC55J4.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-33GXXC2L.js";import"./chunk-UR6MHSHU.js";export{c as childModeFor,d as emitWalkSignal,f as reconcileCommand,a as resolveReconcileMode,e as runReconcileCommand,b as validateReconcileInputs};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as q}from"./chunk-K6RAOZHP.js";import{a as J}from"./chunk-3FXNQTCE.js";import{j as K}from"./chunk-F5AI3UVS.js";import"./chunk-6AZNGOLH.js";import"./chunk-OS4VSIHT.js";import"./chunk-KAZGHWGK.js";import"./chunk-KGKJU27A.js";import{a as b,b as Y}from"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import{a as W}from"./chunk-YEZYO5QH.js";import"./chunk-BZAGVBCX.js";import"./chunk-BB2W35TW.js";import"./chunk-JUJ4SAGH.js";import"./chunk-6J5T5FEY.js";import"./chunk-UJZZDPDY.js";import"./chunk-O5U6EAL3.js";import"./chunk-T7DGNWI2.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-YMLC55J4.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import{e as P}from"./chunk-IDX3TOPY.js";import{C as D,d as V,j as G,q as M,r as H,v as U,w as F}from"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import{b as E}from"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import{e as A}from"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-33GXXC2L.js";import"./chunk-UR6MHSHU.js";import{existsSync as te,mkdirSync as re,readFileSync as N,readdirSync as ne,renameSync as ie,rmSync as le,writeFileSync as oe}from"fs";import{join as v}from"path";var ae=["title","description","summary","value"];function Q(e,t){let s=[],o=t.updated;if(!o)return s;for(let r of ae){let p=o[r];if(typeof p!="string"||p===e[r])continue;let g=e[r];typeof g=="string"&&g.length>0&&s.push({op:"-",field:r,text:g}),s.push({op:"+",field:r,text:p})}let i=(e.criteria??[]).map(String),u=o.criteria??[];if(u.length>0)if(u.some(r=>"op"in r))for(let r of u)r.op==="set"&&s.push({op:"+",field:"criteria",text:r.text}),r.op==="remove"&&s.push({op:"-",field:"criteria",text:r.text});else{let r=u.map(p=>p.text);for(let p of i)r.includes(p)||s.push({op:"-",field:"criteria",text:p});for(let p of r)i.includes(p)||s.push({op:"+",field:"criteria",text:p})}return s}function $(e){let t=e.filter(r=>r.field==="criteria"),s=t.filter(r=>r.op==="+").length,o=t.filter(r=>r.op==="-").length,i=[...new Set(e.filter(r=>r.field!=="criteria").map(r=>r.field))],u=[];return t.length>0&&u.push(`${t.length} criteria changed \xB7 +${s} \u2212${o}`),i.length>0&&u.push(`${i.join("/")} reworded`),u.join(" \xB7 ")||"no field changes"}var z={high:0,med:1,low:2};function B(e,t){return t?e.nameOf.get(t)??`${t.slice(0,19)}\u2026`:"(new)"}function O(e,t){if(!t)return;let s=e.edgesInto(t).filter(o=>o.type===A.BELONGS_TO||o.type===A.SCOPED_TO);if(s.length!==0)return{stale:s.length,direct:s.slice(0,3).map(o=>B(e,o.src))}}function X(e){return G(e).map(t=>({...t.source_id!==void 0?{source_id:t.source_id}:{},anchor:t.anchor,quote:t.quote??""}))}function S(e,t){let s=Y(e),o=[];for(let i of s.updates){let u=t.resolve(i.matches_existing.cid),r=u?t.tipOf(u.cid):null,p=(r?t.getNode(r)?.content:void 0)??{},g=Q(p,i);o.push({key:b("MODIFY",i.matches_existing.cid),kind:"MODIFY",...r?{ref:r}:{},display:B(t,r),title:typeof p.title=="string"?p.title:i.title,changeLine:i.change_note??$(g),diff:g,diffSummary:g.length>4?$(g):null,...i.risk!==void 0?{risk:i.risk}:{},cites:X(i),...i.matches_existing?.reason!==void 0?{tier:i.matches_existing.reason}:{},...O(t,r)!==void 0?{impact:O(t,r)}:{},payload:i})}for(let i of s.adds)o.push({key:b("ADD",i.temp_ref),kind:"ADD",display:"(new)",title:i.title,changeLine:i.summary??i.title,diff:[],diffSummary:null,...i.risk!==void 0?{risk:i.risk}:{},cites:X(i),payload:i});for(let i of s.archives){let u=t.resolve(i.target),r=u?t.tipOf(u.cid):null,p=(r?t.getNode(r)?.content:void 0)??{};o.push({key:b("ARCHIVE",i.target),kind:"ARCHIVE",...r?{ref:r}:{},display:B(t,r),title:typeof p.title=="string"?p.title:i.target,changeLine:i.reason,diff:[],diffSummary:null,...typeof p.risk=="string"?{risk:p.risk}:{},cites:[],reason:i.reason,basis:i.basis,...O(t,r)!==void 0?{impact:O(t,r)}:{}})}return o.sort((i,u)=>(z[i.risk??"low"]??2)-(z[u.risk??"low"]??2))}function j(e,t){return e.filter(s=>!(s.key in t))}async function Z(e){let{contextDir:t,graph:s,card:o,verdict:i,by:u}=e,r=null;if(o.kind!=="ADD"){let n=o.ref?s.resolve(o.ref):null;if(r=n?s.tipOf(n.cid):null,!r||(s.trust.get(r)??null)==="archived")return{ok:!1,refusal:`its target ${o.display} was retired while the review was open \u2014 nothing landed`}}if(i==="reject")return e.signals?.({ref:o.display,verdict:"reject",...e.note?{reason:e.note}:{}}),{ok:!0,landed:"none",note:"nothing saved \u2014 rejections aren't remembered yet; it may be re-proposed"};if(i==="defer"){let n=de({contextDir:t,card:o,note:e.note,changeBasis:e.changeBasis,tip:r,proposalId:e.proposalId});return n.ok?(e.signals?.({ref:o.display,verdict:"defer",...e.note?{reason:e.note}:{}}),{ok:!0,landed:"none",note:"gap recorded \u2014 visible in cover gaps until a later verdict resolves it"}):{ok:!1,refusal:n.refusal}}if(e.changeBasis?.to_cid){let n=s.resolve(e.changeBasis.source_id);if(!n)return{ok:!1,refusal:`the source ${e.changeBasis.source_id} no longer resolves \u2014 cannot verify this changeset is current; re-run maintain reconcile`};if(n.cid!==e.changeBasis.to_cid)return{ok:!1,refusal:`the source ${e.changeBasis.source_id} moved again while this review was open \u2014 re-run maintain reconcile to refresh the changeset`}}if(o.kind==="ARCHIVE"){let n=(e.proposal.archived??[]).filter(c=>{let y=s.resolve(c.target);return y!=null&&s.tipOf(y.cid)===r}),l=V({...e.proposal,archived:n},s);if(n.length===0||l.errors.length>0)return{ok:!1,refusal:l.errors.length>0?`${l.errors.map(c=>c.detail).join("; ")} \u2014 nothing landed; the card re-presents`:`its archive op no longer resolves to ${o.display} \u2014 re-run maintain reconcile`};let h;try{h=H({contextDir:t,graph:s,verdicts:new Map([[r,{resolution:"rejected",...o.reason??e.note?{reason:o.reason??e.note}:{}}]]),by:u})}catch(c){if(c instanceof E)return{ok:!1,refusal:"concurrent activity kept moving the store \u2014 try the card again"};throw c}return h.errors?{ok:!1,refusal:h.errors.map(c=>c.detail).join("; ")}:(e.signals?.({ref:o.display,verdict:"archive"}),F({contextDir:t,graph:s,targetTip:r,resolvedBy:r,...e.changeBasis?{sourceId:e.changeBasis.source_id}:{},by:u}),{ok:!0,landed:"archived"})}let p=o.payload,g=o.kind==="MODIFY"&&r&&p.matches_existing&&r!==p.matches_existing.cid?{...p,matches_existing:{...p.matches_existing,cid:r}}:p,R={version:1,read_basis:s.latestHash,source:e.proposal.source,...e.proposal.sources?{sources:e.proposal.sources}:{},use_cases:[g]},a=await W(J(t,e.sid??`card-${process.pid}`),{verb:"maintain",ucTargets:r?[{ref:r}]:[],newBuCandidates:o.kind==="ADD"?[{tempRef:g.temp_ref,title:g.title,probeText:`${g.title} ${g.summary??""}`.trim()}]:[],sourcePins:[],readBasis:s.latestHash},n=>{let l=M({contextDir:t,graph:n.graph,proposal:R,proposalId:`${e.proposalId}:${o.key}`,verdicts:new Map([[g.temp_ref,{resolution:"approved"}]]),by:u,autoName:!0,allowStaleBasis:!0,eventIds:n.eventIds("maintain",1),...e.sid?{sid:n.sid}:{},probeHits:n.probeHits});return l.errors!==null?{errors:l.errors}:{result:l,record:l.record}});if(!a.ok||!("result"in a))return{ok:!1,refusal:!a.ok&&a.kind==="validation"?a.errors.map(l=>l.detail).join("; "):"concurrent activity kept moving the store \u2014 try the card again"};e.signals?.({ref:o.display,verdict:"approve"});let d=a.result.record?.nodes.find(n=>n.label==="usecase")?.cid,f=o.kind==="MODIFY"?d??r??void 0:d;return o.kind==="MODIFY"&&r&&F({contextDir:t,graph:s,targetTip:r,resolvedBy:d??r,...e.changeBasis?{sourceId:e.changeBasis.source_id}:{},by:u}),{ok:!0,landed:o.kind==="MODIFY"?"successor":"minted",...f?{offer:{kind:o.kind==="MODIFY"?"evolve":"design",target:f}}:{}}}function de(e){let{card:t,changeBasis:s}=e,o={kind:"reconcile_deferred",derived:!0,text:t.changeLine||t.title,...t.risk?{risk:t.risk}:{},...e.note?{risk_rationale:e.note}:{},...e.tip?{ref:t.display,uc:e.tip}:{},...s?{basis:{source_id:s.source_id,from_cid:s.from_cid??"",to_cid:s.to_cid??""}}:{},...e.proposalId?{proposal_id:e.proposalId}:{},...t.payload?.temp_ref?{temp_ref:t.payload.temp_ref}:{}};return U({contextDir:e.contextDir,content:o,...e.tip?{annotates:e.tip}:{}})}function se(e,t){return v(e,"proposals",t,"verdicts.json")}function C(e,t){try{return JSON.parse(N(se(e,t),"utf8"))}catch{return{verdicts:{}}}}function ee(e,t,s){let o=v(e,"proposals",t);re(o,{recursive:!0});let i=v(o,`.verdicts.${process.pid}.tmp`);oe(i,JSON.stringify(s,null,2)+`
3
- `),ie(i,se(e,t))}function T(e,t){try{return JSON.parse(N(v(e,"proposals",t,"proposal.json"),"utf8"))}catch{return null}}function L(e,t){let s=v(e,"sessions");if(!te(s))return null;for(let o of ne(s)){let i;try{i=P(e,o)}catch{continue}if(!i?.reconcile||new Date(i.expires_at).getTime()<=Date.now()||C(e,i.reconcile.proposal_id).resolved)continue;let r=i.change_basis?.source_id??Object.keys(i.read_basis)[0]??"";if(!(t!==void 0&&r!==t))return{sid:i.sid,proposalId:i.reconcile.proposal_id,source:r,...i.change_basis?{changeBasis:{source_id:i.change_basis.source_id,to_cid:i.change_basis.new_head}}:{}}}return null}var fe=80;function pe(e){return{kind:e.kind,ref:e.display,title:e.kind==="ADD"?e.title:`${e.display} \xB7 ${e.title}`,why:e.changeLine,origin:"content-change",...e.tier!==void 0?{tier:e.tier}:{},...e.diffSummary==null&&e.diff.length>0?{diff:e.diff}:{},...e.diffSummary!=null?{diffSummary:e.diffSummary,viewDiff:!0}:{},...e.cites.length>0?{citeLines:e.cites.map(t=>`cite ${t.source_id??"conversation"} ${t.anchor} \u2014 "${t.quote.slice(0,fe)}"`)}:{},...e.impact?{impact:{stale_refs:Array(e.impact.stale).fill("\xB7"),...e.impact.direct.length>0?{direct_refs:e.impact.direct}:{}}}:{}}}function Be(e){let t=e.contextDir,s=e.changeContext?.source_id,o=new Map;e.changeContext&&o.set(e.changeContext.source_id,e.changeContext.old_head);let i=a=>{let d=o.get(a);if(d)return d;try{let f=K(t,a);return f&&o.set(a,f.old_head),f?.old_head}catch{return}},u=v(t,"proposals",".reconcile-steer-carry.json"),r=()=>{try{return JSON.parse(N(u,"utf8"))}catch{return null}},p=(a,d,f)=>{let n=r();if(!n||n.source!==f)return d;let l=C(t,a),h=!1;for(let c of d)(n.keys.includes(c.key)||c.kind==="ADD"&&n.addTitles.includes(c.title.toLowerCase()))&&!(c.key in l.verdicts)&&(l.verdicts[c.key]={verdict:"steer",at:new Date().toISOString()},h=!0);h&&ee(t,a,l);try{le(u)}catch{}return d},g=(a,d)=>{let f=T(t,a);if(!f)return[];let n=p(a,S(f,D(t)),d),l=C(t,a);return j(n,l.verdicts)},R=()=>{let a=v(t,"sessions");if(!te(a))return null;for(let d of ne(a)){let f;try{f=P(t,d)}catch{continue}if(!f||new Date(f.expires_at).getTime()<=Date.now())continue;let n=(f.ingest_schedule??[]).filter(l=>l.status==="skipped"&&(l.note??"").includes("review"));if(n.length>0)return{source:n[0].source_id,count:n.length}}return null};return{pending(){let a=L(t,s);if(a){let f=g(a.proposalId,a.source).length;return f>0?{source:a.source,count:f,kind:"cards"}:null}let d=R();return d?{source:d.source,count:d.count,kind:"needs-run"}:null},loadCards(){let a=L(t,s);if(!a)return[];let d=g(a.proposalId,a.source),f=d.filter(n=>n.kind==="ADD"||n.ref!=null);for(let n of d.filter(l=>l.kind!=="ADD"&&l.ref==null))e.note?.(`dropped: [${n.kind}] ${n.title} \u2014 its target was retired while the review was open; nothing lands`);return f.map(n=>({key:n.key,card:pe(n),viewLines:n.diff}))},noteSteer(){let a=L(t,s);if(!a)return;let d=T(t,a.proposalId);if(!d)return;let f=C(t,a.proposalId),n=S(d,D(t)).filter(c=>c.key in f.verdicts),l={source:a.source,keys:n.map(c=>c.key),addTitles:n.filter(c=>c.kind==="ADD").map(c=>c.title.toLowerCase())},h=`${u}.${process.pid}.tmp`;re(v(t,"proposals"),{recursive:!0}),oe(h,JSON.stringify(l,null,2)+`
4
- `),ie(h,u)},async applyVerdict(a,d,f){let n=L(t,s);if(!n)return{ok:!1,refusal:"the held changeset is gone \u2014 nothing to verdict"};let l=T(t,n.proposalId);if(!l)return{ok:!1,refusal:`proposal ${n.proposalId} is unreadable \u2014 re-run maintain reconcile`};if(a in C(t,n.proposalId).verdicts)return{ok:!1,refusal:"that change was already verdicted (another surface?) \u2014 refresh the review"};let h=D(t),c=S(l,h).find(x=>x.key===a);if(!c)return{ok:!1,refusal:"that change no longer builds a card \u2014 the set may have moved; re-open the review"};let y=i(n.source),I=n.changeBasis?{source_id:n.changeBasis.source_id,...y?{from_cid:y}:{},...n.changeBasis.to_cid?{to_cid:n.changeBasis.to_cid}:{}}:void 0,m=await Z({contextDir:t,graph:h,proposal:l,proposalId:n.proposalId,card:c,verdict:d,...f?{note:f}:{},by:{kind:"human",id:"owner"},sid:n.sid,...I?{changeBasis:I}:{},signals:x=>q(t,x.ref,x.verdict,x.reason)});if(!m.ok)return{ok:!1,refusal:m.refusal};let k=C(t,n.proposalId);return k.verdicts[a]={verdict:d,...f?{note:f}:{},at:new Date().toISOString()},j(S(l,D(t)),k.verdicts).length===0&&(k.resolved=!0),ee(t,n.proposalId,k),{ok:!0,line:`${d==="approve"?c.kind==="ARCHIVE"?"retired":"approved":d==="reject"?"rejected":"deferred"} change \xB7 [${c.kind}] ${c.display}${c.kind==="ADD"?"":` ${c.title}`} (you)`,...m.note?{note:m.note}:{},...m.offer&&m.offer.target?{offer:{kind:m.offer.kind,key:m.offer.target,title:c.kind==="ADD"?c.title:c.display}}:{}}},async startReview(a){let d=e.runPostureChild??(async(l,h)=>{let[{runExtract:c},{runAgent:y},{resolveAgentAuthEnv:I},{preflightTurn:m}]=await Promise.all([import("./run-EOTOXNQO.js"),import("./bridge-KMDML2NB.js"),import("./spawner-X2FOOONV.js"),import("./turn-preflight-JGYT7LXP.js")]),k=await I();return c({mode:"override",posture:"reconcile",source:l,changeContext:h},{contextDir:t,agent:y,preflightTurn:()=>m(k),ask:async _=>_.map(w=>({id:w.id,selected_index:w.recommended_index,free_text:null})),review:async _=>new Map(_.map(w=>[w.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:_=>e.note?.(_),progress:()=>{},isTTY:!1,auth:k})}),{buildChangeContext:f}=await import("./reconcile-engine-YC4RQYF2.js"),n=f(t,a);return n?(o.set(a,n.old_head),d(a,n)):(e.note?.(`no change context for ${a} \u2014 nothing to review`),2)}}}export{Be as makeReconcileDeps,C as readVerdictLedger,pe as toWalkCard};
@@ -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,j,k,l,m,n,o}from"./chunk-F5AI3UVS.js";import"./chunk-6AZNGOLH.js";import"./chunk-OS4VSIHT.js";import"./chunk-KAZGHWGK.js";import"./chunk-KGKJU27A.js";import"./chunk-BZAGVBCX.js";import"./chunk-JUJ4SAGH.js";import"./chunk-UJZZDPDY.js";import"./chunk-DNNZ353O.js";import"./chunk-5DT7PIGB.js";import"./chunk-YMLC55J4.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{g as EVOLVABLE,d as RECONCILE_NOTE_CHANGED,c as RECONCILE_SKIPPED_ARMS,j as buildChangeContext,l as buildReconcilePlan,i as capDiff,a as commitHeldRows,k as commitOneHeldRow,e as isLive,h as lineDiff,o as liveReextractSeam,m as liveReingestSeam,n as liveRemoteReingestSeam,f as parentUc,b as rowImpactOf};
@@ -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,j,k}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{c as AppendBusyError,b as AppendCasError,a as ChainError,d as acquireLock,j as appendRecord,k as appendRecordRaw,g as latestHash,e as readRecords,h as readRecordsFrom,f as readTail,i as recordsSince};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as a,c as b,d as c,e as d,f as e}from"./chunk-FUP4AP6J.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-NU45ROHH.js";import"./chunk-MSGW4JDG.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-33GXXC2L.js";import"./chunk-UR6MHSHU.js";export{d as discoverAll,a as knownPlatforms,c as providerFor,b as registeredPlatforms,e as resolveTarget};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as T}from"./chunk-JQW2QFSX.js";import{e as j,j as F}from"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";function H(b){let{contextDir:S,graph:f,seq:r,by:d}=b,{records:u,hashes:x}=j(S);if(!Number.isInteger(r)||r<1||r>u.length)return{record:null,warnings:[],errors:[{code:"UNKNOWN_SEQ",detail:`no record ${r} (chain has ${u.length})`}]};let i=u[r-1],p=u.slice(0,r-1),c=b.reason??`revert of record ${r}`,n=[],l=[],g=[],h=[],m={},B=new Set(i.nodes.map(e=>e.cid)),w=new Map;for(let e of u)for(let t of e.edges)w.has(t.ecid)||w.set(t.ecid,t);let N=e=>u.slice(r).some(t=>t.supersessions.some(s=>s.kind==="edge"&&s.ecid===e)),v=new Set,k=new Set;for(let e of i.nodes){if(f.superseded.has(e.cid)){v.add(e.cid),n.push(`${e.cid} was already superseded after record ${r} \u2014 left as is`);continue}k.add(e.cid),l.push({kind:"node",old:e.cid,new:null,reason:c,by:d})}let $=new Set;for(let e of i.edges){if(f.superseded.has(e.ecid)){n.push(`edge ${e.ecid} was already retracted after record ${r} \u2014 left as is`);continue}if((v.has(e.src)||v.has(e.dst))&&!k.has(e.src)&&!k.has(e.dst)){n.push(`edge ${e.ecid} was minted with a kept node \u2014 left as is`);continue}l.push({kind:"edge",ecid:e.ecid,reason:c,by:d}),$.add(e.ecid)}let y=new Set;for(let e of i.supersessions){if(e.kind!=="node")continue;if(u.slice(r).some(s=>s.supersessions.some(o=>o.kind==="node"&&o.old===e.old))){n.push(`supersession of ${e.old.slice(0,19)} was changed again after record ${r} \u2014 later state kept`);continue}let t;for(let s of p)for(let o of s.supersessions)o.kind==="node"&&o.old===e.old&&(t=o.new===o.old?void 0:o.new);t===void 0?(l.push({kind:"node",old:e.old,new:e.old,reason:c,by:d}),y.add(e.old)):l.push({kind:"node",old:e.old,new:t,reason:c,by:d})}for(let e of i.supersessions)if(!(e.kind!=="edge"||!e.revoke)){if(N(e.ecid)){n.push(`edge ${e.ecid} was touched again after record ${r} \u2014 later state kept`);continue}l.push({kind:"edge",ecid:e.ecid,reason:c,by:d}),$.add(e.ecid)}let E=[];for(let e of i.supersessions){if(e.kind!=="edge"||e.revoke)continue;if(N(e.ecid)){n.push(`edge ${e.ecid} was touched again after record ${r} \u2014 later state kept`);continue}let t=!1;for(let C of p)for(let _ of C.supersessions)_.kind==="edge"&&_.ecid===e.ecid&&(t=!_.revoke);if(t){n.push(`edge ${e.ecid} was already retracted before record ${r} \u2014 left retracted`);continue}let s=w.get(e.ecid);if(!s){n.push(`edge ${e.ecid} is unknown to the chain \u2014 left retracted`);continue}if(f.superseded.has(s.src)&&!y.has(s.src)){n.push(`edge ${e.ecid} would revive from a superseded source \u2014 left retracted`);continue}let o=f.tipOf(s.dst);if(f.superseded.has(o)&&!y.has(o)){n.push(`edge ${e.ecid} would point at a retired destination \u2014 left retracted`);continue}let a=T(f,{type:s.type,src:s.src,dst:s.dst},{pending:E,retracted:$},`revert revive ${s.type}`);if(a){n.push(`edge ${e.ecid} left retracted \u2014 reviving it would double an occupied slot (${a.detail})`);continue}l.push({kind:"edge",ecid:e.ecid,reason:c,by:d,revoke:!0}),E.push({src:s.src,dst:s.dst,type:s.type})}let R=u.slice(r);for(let e of Object.keys(i.source_head_moves)){if(R.some(s=>e in s.source_head_moves)){n.push(`head of ${e} was moved again after record ${r} \u2014 later state kept`);continue}let t=null;for(let s of p)e in s.source_head_moves&&(t=s.source_head_moves[e]);m[e]=t}let O=new Set;for(let e of i.review){if(O.has(e.id)||B.has(e.id))continue;if(O.add(e.id),R.some(o=>o.review.some(a=>a.id===e.id))){n.push(`trust of ${e.id.slice(0,19)} was reviewed again after record ${r} \u2014 later state kept`);continue}let t=null,s=null;for(let o of p)for(let a of o.review)a.id===e.id&&(t=a.resolution==="reset"?null:a.resolution,s=a.reason);t==="approved"||t==="edited"?g.push({id:e.id,kind:"review-item",resolution:"approved",edit:null,reason:c,by:d}):t==="rejected"?g.push({id:e.id,kind:"review-item",resolution:"rejected",edit:null,reason:s??c,by:d}):g.push({id:e.id,kind:"review-item",resolution:"reset",edit:null,reason:c,by:d})}for(let e of i.names??[]){if(R.some(s=>(s.names??[]).some(o=>o.slug===e.slug))){n.push(`slug "${e.slug}" was reassigned after record ${r} \u2014 later state kept`);continue}let t;for(let s of p)for(let o of s.names??[])o.slug===e.slug&&(t=o.cid);t!==void 0?h.push({cid:t,slug:e.slug,by:d}):n.push(`slug "${e.slug}" was first assigned by record ${r} \u2014 unassignment unsupported, reassign manually`)}return l.length===0&&g.length===0&&h.length===0&&Object.keys(m).length===0?{record:null,warnings:n,errors:[{code:"NOTHING_TO_REVERT",detail:`record ${r} left no compensable facts`}]}:(i.extraction_of&&n.push(`extraction cache for ${i.extraction_of.slice(0,19)} stays \u2014 re-extract with --force`),{record:F(S,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:g,supersessions:l,...h.length>0?{names:h}:{},source_head_moves:m},{expectPrev:x[x.length-1]??null}).record,warnings:n,errors:null})}export{H as commitRevert};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as x}from"./chunk-OS4VSIHT.js";import"./chunk-5DT7PIGB.js";import"./chunk-CH273NAE.js";import{C as O,r as V}from"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import{e as N}from"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";import{readFileSync as M}from"fs";var P=new Set(["derived","skipped","archived","drift"]),q={kind:"human",id:process.env.USER??"operator"};function $(r,t){return r.nameOf.get(t)??t.slice(0,19)}function A(r,t){let o=r.getNode(t)?.content??{},h=r.derivesInto(t)[0]?.props.anchor;return{cid:t,uc:{temp_ref:t,title:String(o.title??o.text??""),summary:o.summary!==void 0?String(o.summary):void 0,risk:String(o.risk??"med"),cite:{anchor:typeof h=="string"?h:"\u2014",quote:""},depends_on_hint:[],matches_existing:null}}}function G(r,t){let o=new Set,{records:h}=N(r);for(let i of h){if(i.proposal_id==null)continue;let u=new Set(i.review.map(e=>e.id));for(let e of i.nodes)u.has(e.cid)||o.add(e.cid)}for(let i of[...o])(t.trust.get(i)!=="derived"||t.superseded.has(i))&&o.delete(i);return o}var U=new Set(["approved","edited","rejected","skipped","supersede"]);function D(r){let t;try{t=JSON.parse(r)}catch(i){return{errors:[`not valid JSON: ${i instanceof Error?i.message:String(i)}`]}}if(!Array.isArray(t))return{errors:['expected a top-level array of {"ref", "resolution", ...} entries']};let o=[],h=[];return t.forEach((i,u)=>{if(i==null||typeof i!="object"||Array.isArray(i)){o.push(`[${u}]: not an object`);return}let e=i;(typeof e.ref!="string"||!e.ref.trim())&&o.push(`[${u}]: "ref" (slug or cid) is required`),(typeof e.resolution!="string"||!U.has(e.resolution))&&o.push(`[${u}]: "resolution" must be one of approved | edited | rejected | skipped | supersede`),e.resolution==="supersede"&&(typeof e.supersede_target!="string"||!e.supersede_target.trim())&&o.push(`[${u}]: resolution "supersede" requires "supersede_target" (slug or cid)`),e.edit!==void 0&&(e.edit==null||typeof e.edit!="object"||Array.isArray(e.edit))&&o.push(`[${u}]: "edit" must be an object ({title?, summary?, risk?})`),o.length===0&&h.push(e)}),o.length>0?{errors:o}:{entries:h}}async function Q(r,t,o,h=process.cwd()){let i=r.queue??"derived";if(!P.has(i))return t.out(`unknown queue ${i} \u2014 one of: derived | skipped | archived | drift`),2;if(r.mode!=null&&r.mode!=="agent"&&r.mode!=="ci")return(t.err??t.out)(`error: review --mode must be agent | ci, got '${r.mode}'`),2;r.mode==="agent"&&(r={...r,json:!0});let u=x(h,t);if(!u)return 2;let e=O(u),m=n=>(t.err??t.out)(n);if(r.allowArchive&&!r.because?.trim())return m('error: --allow-archive requires --because "<reason>" (the audit trail on the record)'),2;if(r.mode==="ci"&&r.allowArchive)return m("error: ci mode never archives \u2014 nothing committed"),2;if((r.approve?.length??0)>0||(r.skip?.length??0)>0||(r.defer?.length??0)>0){if(r.verdicts)return m("error: --approve/--skip/--defer and --verdicts are mutually exclusive"),2;let n=new Map,c=[];for(let d of r.approve??[]){let f=e.resolve(d),g=f&&!e.superseded.has(f.tip)?f.tip:null;if(!g){c.push(`${d}: names nothing in the graph`);continue}n.set(g,{resolution:"approved"})}for(let d of[...r.skip??[],...r.defer??[]])e.resolve(d)||c.push(`${d}: names nothing in the graph`);if(c.length>0){for(let d of c)m(`error: ${d}`);return m("error: nothing committed (structured verdicts are atomic \u2014 fix every offender and re-run)"),2}if(n.size===0)return t.out("nothing changed \u2014 every ref was skipped/deferred"),0;let l=V({contextDir:u,graph:e,verdicts:n,by:q});if(l.errors){for(let d of l.errors)m(`${d.code}: ${d.detail}`);return 1}return t.out(`review: committed record ${l.record.seq} \u2014 ${n.size} approved`),0}if(r.verdicts){let n=s=>(t.err??t.out)(s),c;try{c=M(r.verdicts,"utf8")}catch{return n(`error: cannot read verdicts file ${r.verdicts}`),2}let l=D(c);if("errors"in l){for(let s of l.errors)n(`error: --verdicts ${r.verdicts}: ${s}`);return 2}let d=new Set([...e.trust.entries()].filter(([s,a])=>(a==="derived"||a==="archived")&&!e.superseded.has(s)).map(([s])=>s)),f=new Map,g=[];for(let s of l.entries){let a=e.resolve(s.ref),p=a&&!e.superseded.has(a.tip)?a.tip:null;if(!p){g.push(`${s.ref}: names nothing in the graph`);continue}if(!d.has(p)){g.push(`${s.ref}: not in a review queue (trust: ${e.trust.get(p)??"?"})`);continue}if(f.has(p)){g.push(`${s.ref}: duplicate \u2014 an earlier entry already resolves to this node (${$(e,p)})`);continue}f.set(p,{resolution:s.resolution,...s.reason?{reason:s.reason}:{},...s.edit?{edit:s.edit}:{},...s.supersede_target?{supersedeTarget:s.supersede_target}:{}})}if(g.length>0){for(let s of g)n(`error: --verdicts: ${s}`);return n("error: nothing committed (the verdicts file is atomic \u2014 fix every offender and re-run)"),2}let y=[...f.entries()].filter(([,s])=>s.resolution==="rejected"||s.resolution==="supersede");if(y.length>0&&r.mode==="ci")return n(`error: ci mode never archives \u2014 ${y.length} retiring verdict(s) (rejected/supersede) present, nothing committed`),2;if(y.length>0&&r.allowArchive){let{archiveImpact:s}=await import("./feeder-IOR3XRNF.js");for(let[a,p]of y){let R=p.resolution==="supersede"?(()=>{let j=p.supersedeTarget?e.resolve(p.supersedeTarget):null;return j&&!e.superseded.has(j.tip)?j.tip:null})():a;if(R===null)continue;let C=s(e,R),I=p.resolution==="supersede"?`supersede (retires ${$(e,R)})`:`archive ${$(e,R)}`;n(`${I}: ${C.design_children} design child(ren) affected`)}for(let[,a]of y)a.reason||(a.reason=r.because)}let E=y.length>0&&!r.allowArchive,S=V({contextDir:u,graph:e,verdicts:f,by:q,...E?{holdArchives:!0}:{}});if(S.errors){if(S.errors[0]?.code==="NO_VERDICTS")return n("nothing changed \u2014 every item was skipped"),0;for(let s of S.errors)n(`${s.code}: ${s.detail}`);return 1}E&&t.out(`${y.length} archive(s) held for interactive confirmation (re-run with --allow-archive --because "<reason>" to apply headlessly)`);let _=new Map;for(let s of f.values())_.set(s.resolution,(_.get(s.resolution)??0)+1);if(r.json)for(let[s,a]of f.entries())t.out(JSON.stringify({ref:$(e,s),cid:s,resolution:a.resolution}));else{let s=[..._.entries()].map(([a,p])=>`${p} ${a}`).join(", ");t.out(`review: committed record ${S.record.seq} \u2014 ${s}`)}return 0}if(i==="drift"){let n=e.staleList().filter(({state:c})=>c!=="superseded").map(({cid:c,state:l})=>({ref:$(e,c),cid:c,state:l,title:String(e.getNode(c)?.content.title??e.getNode(c)?.content.source_id??""),pinned_sources:[...new Set(e.derivesInto(c).map(d=>String(d.props.source_id)))]}));if(r.json){for(let c of n)t.out(JSON.stringify(c));return 0}if(n.length===0)return t.out("drift queue is empty \u2014 every node's evidence matches the current source snapshots"),0;t.out(`${n.length} item(s) whose evidence changed (re-extract the source to re-approve):`);for(let c of n)t.out(` [${c.state}] ${c.ref} \xB7 ${c.title} \xB7 sources: ${c.pinned_sources.join(", ")||"\u2014"}`);return 0}if(!t.isTTY)return t.out("review: verdict queues need a TTY (drift listing works anywhere, or pass --verdicts <file.json>)"),2;let v,w;if(i==="archived")v=[...e.trust.entries()].filter(([n,c])=>c==="archived"&&!e.superseded.has(n)).map(([n])=>A(e,n)),w="skipped";else{let n=G(u,e),c=[...e.trust.entries()].filter(([d,f])=>f==="derived"&&!e.superseded.has(d)).map(([d])=>d),l=i==="skipped"?c.filter(d=>n.has(d)):c;l.sort((d,f)=>Number(n.has(f))-Number(n.has(d))),v=l.map(d=>A(e,d)),w="skipped"}if(v.length===0)return t.out(`${i} queue is empty`),0;t.out(`${v.length} node(s) in the ${i} queue \u2014 approve promotes, reject ${i==="archived"?"re-archives":"archives"}, edit mints a new version, skip leaves it for later`);let T=await o(v,e,w),k=V({contextDir:u,graph:e,verdicts:T,by:q});if(k.errors){if(k.errors[0]?.code==="NO_VERDICTS")return t.out("nothing changed \u2014 every item was skipped"),0;for(let n of k.errors)t.out(`${n.code}: ${n.detail}`);return 1}let b=k.record;return t.out(`committed record ${b.seq}: ${b.review.length} review fact(s), ${b.supersessions.length} supersession(s), ${b.nodes.length} new version(s)`),0}async function F(r,t,o){let[{render:h},i,{ReviewChecklist:u}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),e=i.default??i;return new Promise(m=>{let v=h(e.createElement(u,{items:r.map(w=>({uc:w.uc})),defaultResolution:o,onSubmit:w=>{v.unmount(),m(w)}}))})}async function B(r){let{bothTTY:t}=await import("./headless-io-66RG5NN5.js");return Q(r,{out:o=>process.stdout.write(o+`
3
- `),err:o=>process.stderr.write(o+`
4
- `),confirm:async()=>!1,isTTY:t()},F)}export{D as parseVerdictsFile,B as reviewCommand,Q as runReviewCommand};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-MXDWS7S4.js";import"./chunk-ZKSN2SJ7.js";import"./chunk-N7Z7BQYO.js";import"./chunk-KGKJU27A.js";import"./chunk-6IAA644J.js";import"./chunk-I27YRAGO.js";import"./chunk-5G22NOZK.js";import"./chunk-YEZYO5QH.js";import"./chunk-BZAGVBCX.js";import"./chunk-BB2W35TW.js";import"./chunk-GX3FPJUG.js";import"./chunk-427OQS2N.js";import"./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"./chunk-TMRLBSIA.js";import"./chunk-T7DGNWI2.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-EV64VI66.js";import"./chunk-L32DKFRQ.js";import"./chunk-5DT7PIGB.js";import"./chunk-J3Q63NFG.js";import"./chunk-KO3FL2XW.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-OTMAFCZK.js";import"./chunk-VZ7KXRXB.js";import"./chunk-IDX3TOPY.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-5EOX4MEY.js";import"./chunk-EYOCNMUM.js";import"./chunk-33GXXC2L.js";import"./chunk-UR6MHSHU.js";export{b as formatVariablesClosing,a as runDesign};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b,b as c,c as d,d as e,e as f,f as g,g as h}from"./chunk-BJAHVN2F.js";import"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import{d as a}from"./chunk-6IAA644J.js";import"./chunk-I27YRAGO.js";import"./chunk-5G22NOZK.js";import"./chunk-YEZYO5QH.js";import"./chunk-BZAGVBCX.js";import"./chunk-BB2W35TW.js";import"./chunk-GX3FPJUG.js";import"./chunk-427OQS2N.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"./chunk-J2UN2AHO.js";import"./chunk-TMRLBSIA.js";import"./chunk-T7DGNWI2.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-EV64VI66.js";import"./chunk-5DT7PIGB.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-IDX3TOPY.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-5EOX4MEY.js";import"./chunk-33GXXC2L.js";import"./chunk-UR6MHSHU.js";export{g as dedupPreFlags,c as deliveredImagesWire,e as displaySourceName,b as extractProtocolCtx,a as resolveAnswers,h as runExtract,d as sessionSourceRef,f as sourceBanner};
@@ -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-IDX3TOPY.js";import"./chunk-UR6MHSHU.js";export{a as SessionError,h as cleanSessions,b as createSession,f as listSessions,e as peekSession,d as reconcileLedgerResolved,c as resumeSession,g as sessionsHoldingSource};