@maycombhq/atticus 2.0.0-beta.22 → 2.0.0-beta.23

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 (279) hide show
  1. package/dist/bin.js +12 -7
  2. package/dist/{chunk-LYBNHMVZ.js → chunk-27AJAKX7.js} +3 -3
  3. package/dist/{chunk-KXITGYLF.js → chunk-2QPJ4E4Z.js} +2 -2
  4. package/dist/{chunk-EIPTLPFC.js → chunk-2UMSHYCB.js} +24 -24
  5. package/dist/{chunk-6PPOWY5E.js → chunk-2WUTCPPJ.js} +6 -6
  6. package/dist/{chunk-VNU26RCO.js → chunk-2YSD6E6V.js} +33 -32
  7. package/dist/{chunk-P32RUW3B.js → chunk-3424TLIJ.js} +39 -7
  8. package/dist/{chunk-2MMCFP5C.js → chunk-3ASYYMOX.js} +8 -8
  9. package/dist/{chunk-PKBHS4AA.js → chunk-3EWKO457.js} +48 -17
  10. package/dist/{chunk-J3IOLXWM.js → chunk-3EX5HCZD.js} +5 -5
  11. package/dist/{chunk-BDKC6H5P.js → chunk-3MYBT62N.js} +5 -5
  12. package/dist/{chunk-ZFL7NY4F.js → chunk-3UHV76UD.js} +69 -41
  13. package/dist/{chunk-Q4K5WB2W.js → chunk-3ZA3AK2D.js} +10 -10
  14. package/dist/{chunk-O7FDLW7L.js → chunk-4ETO2FXE.js} +5 -5
  15. package/dist/{chunk-AFWUDXEM.js → chunk-4FLNCK6Q.js} +26 -11
  16. package/dist/{chunk-745DAZ4L.js → chunk-4GAB5ZOZ.js} +901 -332
  17. package/dist/{chunk-3RM4UK6W.js → chunk-4MYHETJ3.js} +18 -18
  18. package/dist/chunk-4R3TO4VL.js +94 -0
  19. package/dist/chunk-5MYE42AP.js +43 -0
  20. package/dist/chunk-5O7U67UA.js +57 -0
  21. package/dist/{chunk-Y2EQNWKV.js → chunk-5OXKCH4Z.js} +31 -31
  22. package/dist/{chunk-O45HFTFS.js → chunk-5VTIWEWP.js} +2 -2
  23. package/dist/{chunk-UNAGJYET.js → chunk-63NFFAGI.js} +12 -12
  24. package/dist/{chunk-6ZJ5A7AF.js → chunk-66AQ2JIU.js} +9 -9
  25. package/dist/chunk-6JVPBGQG.js +50 -0
  26. package/dist/{chunk-VY72R2XZ.js → chunk-6NCPLIIP.js} +124 -2
  27. package/dist/{chunk-D73UEXYW.js → chunk-6NN36LVK.js} +3 -3
  28. package/dist/{chunk-7FTTA3HD.js → chunk-6R5VHR3N.js} +5 -5
  29. package/dist/{chunk-CADWLE2T.js → chunk-6RQOINER.js} +4 -4
  30. package/dist/{chunk-WG5U3F5V.js → chunk-6RYB3EET.js} +12 -12
  31. package/dist/{chunk-RXPJMEOW.js → chunk-6SNTHK43.js} +10 -10
  32. package/dist/{chunk-ZFFYNRIO.js → chunk-6Y4FXOMI.js} +24 -22
  33. package/dist/{chunk-SQV37XO2.js → chunk-6ZFF7XSL.js} +6 -6
  34. package/dist/{chunk-JA5FI3QV.js → chunk-6ZSYLZ7O.js} +3 -3
  35. package/dist/{chunk-JENSEMXF.js → chunk-73CC73I4.js} +1 -1
  36. package/dist/{chunk-2F4CYZKJ.js → chunk-73GFVW2L.js} +5 -5
  37. package/dist/{chunk-M3NANSDZ.js → chunk-73V2OONC.js} +15 -15
  38. package/dist/{chunk-WKUJ3KPV.js → chunk-75OMRKY2.js} +4 -4
  39. package/dist/{chunk-7BR7IPOH.js → chunk-7IFTSAHP.js} +8 -8
  40. package/dist/{chunk-OWNCM4ZN.js → chunk-7K5OH45X.js} +136 -16
  41. package/dist/{chunk-VCTWPLAO.js → chunk-7NQAGYK4.js} +8 -8
  42. package/dist/{chunk-O4GXGGBX.js → chunk-7XWJ6ED2.js} +12 -12
  43. package/dist/{chunk-MFR5OPBD.js → chunk-7XYLNQFO.js} +5 -5
  44. package/dist/{chunk-GCWRWSU7.js → chunk-7YQBDE5W.js} +4 -4
  45. package/dist/{chunk-QKUJMING.js → chunk-A4JXVO5O.js} +5 -5
  46. package/dist/{chunk-LKOR5UET.js → chunk-AFBCNZRZ.js} +24 -24
  47. package/dist/{chunk-BXYMYEJ4.js → chunk-AGOLEMHK.js} +13 -14
  48. package/dist/{chunk-AVTBS4OW.js → chunk-AHFQHPFF.js} +22 -22
  49. package/dist/{chunk-NY2XSR5K.js → chunk-APDN6UOR.js} +116 -18
  50. package/dist/chunk-AQRUQNFB.js +322 -0
  51. package/dist/{chunk-5NMKONLP.js → chunk-AVMWESFZ.js} +3 -2
  52. package/dist/chunk-B4AEL3RF.js +1011 -0
  53. package/dist/{chunk-H7KM7LZE.js → chunk-BAY4K55I.js} +11 -11
  54. package/dist/{chunk-XD75VZIH.js → chunk-BFL4PO64.js} +7 -7
  55. package/dist/{chunk-34S2WGOB.js → chunk-BFMTGNAQ.js} +5 -3
  56. package/dist/{chunk-SLXZOMA6.js → chunk-BP33TBLI.js} +4 -4
  57. package/dist/{chunk-IFKEI4SA.js → chunk-BUUJ7N4O.js} +11 -11
  58. package/dist/{chunk-EGQRREQH.js → chunk-BYBU2EIB.js} +26 -15
  59. package/dist/{chunk-SFUP7TTO.js → chunk-C6ORPLCN.js} +4 -4
  60. package/dist/{chunk-IVBOQAGB.js → chunk-CA3DKO4D.js} +24 -2
  61. package/dist/{chunk-57TDNMI3.js → chunk-CFUDAW3R.js} +15 -15
  62. package/dist/{chunk-FFTRTL6R.js → chunk-CJEBRJBS.js} +4 -4
  63. package/dist/{chunk-EPCJQQWD.js → chunk-CKVBDVIW.js} +4 -4
  64. package/dist/{chunk-FPJPLKDW.js → chunk-CMB7FXHJ.js} +38 -16
  65. package/dist/{chunk-INQHESFB.js → chunk-CQ7RF4QN.js} +4 -4
  66. package/dist/{chunk-63YRMR6J.js → chunk-CS4BMJLL.js} +5 -5
  67. package/dist/{chunk-BPK5P77O.js → chunk-CT6NINGR.js} +3 -3
  68. package/dist/chunk-CXTG6AWM.js +40 -0
  69. package/dist/{chunk-CXJ6FUKN.js → chunk-CZ2ZS7AT.js} +9 -4
  70. package/dist/{chunk-S4PMJU6H.js → chunk-D6BVLTDV.js} +85 -29
  71. package/dist/{chunk-M32BLWDH.js → chunk-DCRYOMTM.js} +12 -12
  72. package/dist/{chunk-REWWDVQB.js → chunk-DHKDH464.js} +4 -4
  73. package/dist/{chunk-2LGRMVCA.js → chunk-DSHRA72L.js} +10 -10
  74. package/dist/{chunk-THDMSZ3R.js → chunk-E3PDCQRH.js} +2765 -665
  75. package/dist/chunk-EHXDB3SA.js +25 -0
  76. package/dist/{chunk-BTGPE6CR.js → chunk-EMVZIOOD.js} +7 -7
  77. package/dist/{chunk-DOBQKHIF.js → chunk-ENH6Z4TY.js} +28 -27
  78. package/dist/{chunk-LGFL54FP.js → chunk-EVTI22PQ.js} +6 -2
  79. package/dist/{chunk-7MJSQTL5.js → chunk-EXJZBL5N.js} +20 -20
  80. package/dist/{chunk-N3XIYPU3.js → chunk-FBCVC2GJ.js} +12 -12
  81. package/dist/{chunk-UWOJLHFT.js → chunk-FJVUHQPS.js} +34 -23
  82. package/dist/{chunk-7IGKHZ4Z.js → chunk-FL344WQD.js} +218 -211
  83. package/dist/{chunk-IH2XURVQ.js → chunk-FMJYKLDY.js} +5 -5
  84. package/dist/chunk-FMR2D3AZ.js +41 -0
  85. package/dist/{chunk-Q2TECDIT.js → chunk-FPBUTZI5.js} +2201 -326
  86. package/dist/{chunk-PJSJPMJI.js → chunk-FQVSLBTV.js} +3 -3
  87. package/dist/{chunk-NXJ5URP6.js → chunk-FRAEQVYN.js} +23 -22
  88. package/dist/{chunk-RLDGWLQ7.js → chunk-FRCOKUU4.js} +7 -7
  89. package/dist/{chunk-DCZWQLYT.js → chunk-FSN6JFXB.js} +18 -15
  90. package/dist/{chunk-W7VWI2YH.js → chunk-FTLYXMHA.js} +5 -5
  91. package/dist/{chunk-7GJS6DNX.js → chunk-FVYZ4Y52.js} +11 -3
  92. package/dist/{chunk-CQDGOPGH.js → chunk-G6EFXTUO.js} +2 -2
  93. package/dist/{chunk-JB5LINEM.js → chunk-G7VBMOZH.js} +3 -3
  94. package/dist/{chunk-7ASNL4Q4.js → chunk-GM4EFHUX.js} +15 -15
  95. package/dist/chunk-GOZLTLRY.js +232 -0
  96. package/dist/chunk-GPNMSX5H.js +36 -0
  97. package/dist/{chunk-BQ4SQQC6.js → chunk-GUGQSIQM.js} +9 -9
  98. package/dist/{chunk-E3ISYXO3.js → chunk-HJQVUOUL.js} +12 -12
  99. package/dist/{chunk-MFHL5URL.js → chunk-HMWJWYE2.js} +16 -16
  100. package/dist/{chunk-YYY3AZFE.js → chunk-HMZ2DRBC.js} +2 -2
  101. package/dist/{chunk-C3RY6KU6.js → chunk-HRS5O7VV.js} +500 -163
  102. package/dist/{chunk-AJQ72EBM.js → chunk-HUGQZQ2K.js} +6 -6
  103. package/dist/{chunk-AJYXNTNZ.js → chunk-ICBGVVRI.js} +10 -10
  104. package/dist/{chunk-J2JAKCIW.js → chunk-IKAW2KJU.js} +17 -17
  105. package/dist/{chunk-OUBGGKDU.js → chunk-IMZFOMVX.js} +1 -1
  106. package/dist/{chunk-LDLL7LB3.js → chunk-ISG547IS.js} +22 -22
  107. package/dist/{chunk-GZY6RUZ6.js → chunk-IYNCSYU4.js} +5 -2
  108. package/dist/{chunk-H5HBGNXU.js → chunk-J25YOUIZ.js} +4 -4
  109. package/dist/chunk-J2CDBSFP.js +69 -0
  110. package/dist/chunk-J2H7YG3K.js +34 -0
  111. package/dist/{chunk-SFSPGFCV.js → chunk-J32IPTVQ.js} +20 -20
  112. package/dist/{chunk-BEVTIBRH.js → chunk-J4CPHJUL.js} +5 -5
  113. package/dist/{chunk-F3P7N7SF.js → chunk-JFFKHIM6.js} +1 -1
  114. package/dist/{chunk-RUGXBPWI.js → chunk-JMEWJPF2.js} +8 -8
  115. package/dist/{chunk-WERM6KPJ.js → chunk-JSP73CDW.js} +9 -4
  116. package/dist/{chunk-66PPNOON.js → chunk-JXAKYP45.js} +26 -25
  117. package/dist/{chunk-7JITZFJC.js → chunk-K4OXYSGS.js} +4 -4
  118. package/dist/{chunk-EHA7RMZ3.js → chunk-K4RNVDR4.js} +4 -4
  119. package/dist/{chunk-R44CYFPV.js → chunk-K757G7AD.js} +12 -12
  120. package/dist/{chunk-FUJM6RTF.js → chunk-KDJ2YKAZ.js} +7 -7
  121. package/dist/{chunk-QAXW2N3B.js → chunk-KT6Q44CA.js} +28 -30
  122. package/dist/{chunk-EBL2R3YG.js → chunk-KTNOBTV5.js} +4 -4
  123. package/dist/chunk-KVVNAUIG.js +66 -0
  124. package/dist/{chunk-X5F3Q5LV.js → chunk-L3RCQWVQ.js} +21 -18
  125. package/dist/{chunk-7IOWA5D5.js → chunk-LHH5KG5A.js} +13 -3
  126. package/dist/{chunk-TNR75OXT.js → chunk-LM45GMMB.js} +11 -8
  127. package/dist/{chunk-FSMSFDLD.js → chunk-LO6Y7OTG.js} +4 -4
  128. package/dist/{chunk-WF7B67YE.js → chunk-LPDTDFKA.js} +10 -10
  129. package/dist/{chunk-SU74NDMQ.js → chunk-LSHSDC6S.js} +17 -17
  130. package/dist/{chunk-LJXMYKZJ.js → chunk-LZVHP7CT.js} +5 -5
  131. package/dist/{chunk-3NWDLGG6.js → chunk-M3EOFSPY.js} +26 -26
  132. package/dist/chunk-MBYYQHPM.js +31 -0
  133. package/dist/{chunk-KQGURXFU.js → chunk-MEJ63LDG.js} +32 -11
  134. package/dist/{chunk-FZOJFH7Q.js → chunk-MH2ZK67S.js} +11 -11
  135. package/dist/{chunk-R7NYHMUU.js → chunk-MLGWSBF4.js} +5108 -3895
  136. package/dist/{chunk-WJF2CS6M.js → chunk-MNIPPBCT.js} +5 -5
  137. package/dist/{chunk-XERYFDB5.js → chunk-MWF4PXQR.js} +32 -31
  138. package/dist/{chunk-BO4KX37X.js → chunk-N2YX6JMY.js} +18 -18
  139. package/dist/{chunk-GUX3PTYM.js → chunk-NAPHHWW2.js} +3 -3
  140. package/dist/{chunk-UUU4CLJG.js → chunk-NC755EKE.js} +5 -1
  141. package/dist/{chunk-WMTRHUI5.js → chunk-NCLZJCXA.js} +21 -21
  142. package/dist/chunk-NKJDO4UC.js +39 -0
  143. package/dist/chunk-NOYOFYAJ.js +59 -0
  144. package/dist/{chunk-ZQ3ON2VQ.js → chunk-NROSSWMS.js} +5 -5
  145. package/dist/{chunk-UWMJKX5U.js → chunk-OBUB3H72.js} +12 -12
  146. package/dist/{chunk-VW62D6QE.js → chunk-OCQWSFJD.js} +7 -7
  147. package/dist/{chunk-UPOY4YSQ.js → chunk-OK6JGLE7.js} +12 -12
  148. package/dist/{chunk-TYQBFTBR.js → chunk-OPWGPQ2N.js} +5 -5
  149. package/dist/{chunk-PPD7HTDP.js → chunk-OSYHGGL3.js} +18 -18
  150. package/dist/chunk-OXXZZ7HQ.js +50 -0
  151. package/dist/{chunk-5BD2KYLE.js → chunk-P22EPEBR.js} +16 -16
  152. package/dist/chunk-P4YUT7W7.js +45 -0
  153. package/dist/chunk-PCCLVIDP.js +217 -0
  154. package/dist/{chunk-CMDXGQTS.js → chunk-PFULMC2D.js} +21 -20
  155. package/dist/chunk-PGAMTKBI.js +16 -0
  156. package/dist/{chunk-6MUGR4LS.js → chunk-PNSSE7JM.js} +93 -18
  157. package/dist/{chunk-HYU5VLGA.js → chunk-POEMZECG.js} +1 -1
  158. package/dist/{chunk-UCROWG2D.js → chunk-POSDBRKV.js} +23 -23
  159. package/dist/{chunk-KDNTAPLX.js → chunk-POSZFDSQ.js} +3 -3
  160. package/dist/{chunk-3NFFJL5D.js → chunk-PQQKZPBU.js} +1 -1
  161. package/dist/{chunk-4EURQWQD.js → chunk-PRMUQUWN.js} +10 -10
  162. package/dist/{chunk-MO6P2JZH.js → chunk-PT4USJNN.js} +7 -7
  163. package/dist/{chunk-BTY3HZBO.js → chunk-PWXB5GBB.js} +16 -16
  164. package/dist/{chunk-S7FCV7S5.js → chunk-PXW2RZGQ.js} +1 -1
  165. package/dist/{chunk-NDCF4R6S.js → chunk-Q367UGYN.js} +3 -3
  166. package/dist/{chunk-IUPG3UKI.js → chunk-QAVRDONY.js} +187 -123
  167. package/dist/{chunk-E6ZIEVOI.js → chunk-QBMLBCQH.js} +12 -12
  168. package/dist/{chunk-VZALIKIF.js → chunk-QLQIFJP3.js} +12 -12
  169. package/dist/{chunk-EMRIQUND.js → chunk-QLWDIKO4.js} +82 -27
  170. package/dist/{chunk-PMUAJGLI.js → chunk-QVVGJVVX.js} +16 -16
  171. package/dist/{chunk-LNBQOP7D.js → chunk-QX4MAMUG.js} +21 -21
  172. package/dist/{chunk-X3WY6MN3.js → chunk-QZWRPQTI.js} +6 -6
  173. package/dist/{chunk-ISUAAMGS.js → chunk-RCG5IAAT.js} +18 -11
  174. package/dist/chunk-RGZFOKVO.js +106 -0
  175. package/dist/{chunk-O5PXQR67.js → chunk-RLZFL76D.js} +4 -4
  176. package/dist/{chunk-UF4AZOZB.js → chunk-RPQITJNX.js} +5 -5
  177. package/dist/{chunk-NR2UJWOC.js → chunk-RQQYEDAC.js} +8 -8
  178. package/dist/chunk-RQSLHZ7T.js +36 -0
  179. package/dist/{chunk-UPS2DGFC.js → chunk-RRQUQAXP.js} +1 -1
  180. package/dist/chunk-RYQ4JCFT.js +65 -0
  181. package/dist/{chunk-JLUCKAEL.js → chunk-S35DIFJH.js} +17 -17
  182. package/dist/{chunk-UGUP3ZM6.js → chunk-S5GSQPIN.js} +9 -9
  183. package/dist/chunk-S5XFO4GY.js +42 -0
  184. package/dist/chunk-S6LW2RRC.js +25 -0
  185. package/dist/{chunk-W62H2XSO.js → chunk-S6W3D5GS.js} +23 -23
  186. package/dist/{chunk-CX4RZ2KS.js → chunk-S7GUZ45I.js} +3 -3
  187. package/dist/{chunk-L27SV425.js → chunk-SCT4CEF7.js} +20 -20
  188. package/dist/{chunk-VTZMAJ3W.js → chunk-SK5RVP7X.js} +8 -8
  189. package/dist/{chunk-JAVI7JSP.js → chunk-SRTUETF5.js} +23 -22
  190. package/dist/{chunk-MZCGSXVR.js → chunk-SVGGMBJI.js} +13 -13
  191. package/dist/{chunk-SDKLKB6I.js → chunk-SWNKO4C4.js} +32 -25
  192. package/dist/chunk-SYP56T2D.js +65 -0
  193. package/dist/{chunk-5SJZW52K.js → chunk-T33TPFGI.js} +22 -22
  194. package/dist/{chunk-ZJXLNDH4.js → chunk-T3FNG2H2.js} +12 -12
  195. package/dist/{chunk-BIGDQDHD.js → chunk-T6MAWL5P.js} +4 -4
  196. package/dist/{chunk-RGERPOIV.js → chunk-T6MX7WXM.js} +14 -11
  197. package/dist/{chunk-QFWA2DPH.js → chunk-T7IIEDA3.js} +5 -5
  198. package/dist/{chunk-Z5IA3WDR.js → chunk-TABH4RBZ.js} +156 -79
  199. package/dist/{chunk-6ZGLAACW.js → chunk-TDSCKP3V.js} +2 -2
  200. package/dist/{chunk-G6X77UJZ.js → chunk-TMFMXQEN.js} +21 -21
  201. package/dist/{chunk-P2V7QW4D.js → chunk-TNCF26JK.js} +11 -11
  202. package/dist/{chunk-2GF7OLF3.js → chunk-TUM52SOE.js} +19 -15
  203. package/dist/{chunk-PBPBMP2B.js → chunk-TV56QLLV.js} +3 -3
  204. package/dist/{chunk-SYV5LHML.js → chunk-TVQSXWWV.js} +33 -33
  205. package/dist/{chunk-VBTP56CE.js → chunk-TXNSQ24G.js} +9 -8
  206. package/dist/{chunk-ZX57KSEQ.js → chunk-UALE35WK.js} +3 -3
  207. package/dist/{chunk-42SIDKEU.js → chunk-UJF7PIMP.js} +26 -26
  208. package/dist/{chunk-ONUPY3H6.js → chunk-UMCDODBX.js} +24 -24
  209. package/dist/{chunk-JJF6HALY.js → chunk-UTPIFH4I.js} +3 -3
  210. package/dist/{chunk-O7XLYEFA.js → chunk-V7PEHQZU.js} +54 -22
  211. package/dist/{chunk-XI2LCCYQ.js → chunk-VJFXQISZ.js} +8 -8
  212. package/dist/{chunk-AFZ3QA6W.js → chunk-VJZI6KFP.js} +22 -22
  213. package/dist/{chunk-Q6DFNVRJ.js → chunk-VK7WYA64.js} +12 -12
  214. package/dist/{chunk-6OJQOPUN.js → chunk-VKTXFFOZ.js} +2 -2
  215. package/dist/{chunk-MG4ZL5RW.js → chunk-VNIN7Q6Q.js} +16 -16
  216. package/dist/{chunk-ZQXZ2SES.js → chunk-VRO7KSGL.js} +21 -21
  217. package/dist/{chunk-OHVTTOPS.js → chunk-W3AZE7LN.js} +3 -3
  218. package/dist/chunk-W4TNCEI4.js +44 -0
  219. package/dist/{chunk-X4CXA2IL.js → chunk-W5VYJWOG.js} +22 -22
  220. package/dist/{chunk-7DOR27HL.js → chunk-WF3RCZNO.js} +6 -6
  221. package/dist/{chunk-LGBMTVNT.js → chunk-WOMQQWTO.js} +5 -5
  222. package/dist/{chunk-2Q56PQPS.js → chunk-WXVTYLVH.js} +2 -2
  223. package/dist/{chunk-UOR2DTHH.js → chunk-WYGTSZHR.js} +16 -14
  224. package/dist/{chunk-IDKCWSM5.js → chunk-WZYM5M4U.js} +388 -104
  225. package/dist/{chunk-U76OWS3Q.js → chunk-X5ZHDSLU.js} +23 -23
  226. package/dist/chunk-X7XVMYIL.js +5 -0
  227. package/dist/{chunk-2IIMFOPM.js → chunk-X7ZKNSK4.js} +18 -18
  228. package/dist/{chunk-UF4GLFBX.js → chunk-XAPXKFIS.js} +22 -22
  229. package/dist/{chunk-LQJPN536.js → chunk-XF6TSZW2.js} +2 -2
  230. package/dist/{chunk-T6DQR5TV.js → chunk-XFDDJQT7.js} +12 -12
  231. package/dist/{chunk-OHNCWBKF.js → chunk-XGO74QWR.js} +4 -4
  232. package/dist/chunk-XLZAAAPX.js +43 -0
  233. package/dist/{chunk-2RLKFUUL.js → chunk-XMUWPA56.js} +23 -23
  234. package/dist/{chunk-JRBFANFE.js → chunk-XNFM6WUK.js} +15 -15
  235. package/dist/{chunk-LO6P2VYG.js → chunk-XOMEQVLK.js} +2 -2
  236. package/dist/{chunk-YHCMZC2J.js → chunk-Y2H7X3VI.js} +7 -7
  237. package/dist/{chunk-ZZK56BLP.js → chunk-Y5IE6YKD.js} +4 -4
  238. package/dist/{chunk-KFAVQZSX.js → chunk-YD3KTW4H.js} +12 -12
  239. package/dist/{chunk-LZ7NUC62.js → chunk-YDCOZOER.js} +18 -18
  240. package/dist/{chunk-LFGTYX5U.js → chunk-YERAAEO4.js} +17 -17
  241. package/dist/{chunk-BHT7QK4G.js → chunk-YHMPDIRG.js} +4 -4
  242. package/dist/{chunk-ZJFRMSJT.js → chunk-Z2D4P3R3.js} +12 -12
  243. package/dist/{chunk-O66DM6DJ.js → chunk-Z3H27OMV.js} +4 -4
  244. package/dist/{chunk-7UOMVMFG.js → chunk-Z3RAFU5B.js} +15 -15
  245. package/dist/{chunk-FFLNS6VP.js → chunk-ZENHDXRZ.js} +21 -17
  246. package/dist/{chunk-23XVSEV5.js → chunk-ZFHFC74B.js} +18 -18
  247. package/dist/{chunk-53T4O55J.js → chunk-ZJGCGKA4.js} +3 -3
  248. package/dist/{chunk-WXFLMQSR.js → chunk-ZLQEQR3D.js} +5 -5
  249. package/dist/{chunk-HNM2YQT2.js → chunk-ZNHQGG7J.js} +7 -7
  250. package/dist/{chunk-2Q5EDGEO.js → chunk-ZNTTW4IT.js} +5 -5
  251. package/dist/{chunk-ZQ7SKESZ.js → chunk-ZR6J4QFQ.js} +7 -7
  252. package/dist/{chunk-PAQ2AS5E.js → chunk-ZSNOILL5.js} +1 -1
  253. package/dist/files.json +563 -511
  254. package/dist/packages/sdk/npm/index.js +1043 -43
  255. package/dist/packages/ui/dist/assets/{elk-api-CIf-0gz5.js → elk-api-DxfAMOJq.js} +2 -2
  256. package/dist/packages/ui/dist/assets/index-Buit9TfP.js +62 -0
  257. package/dist/packages/ui/dist/assets/index-Jyc9dFeZ.css +1 -0
  258. package/dist/packages/ui/dist/index.html +2 -2
  259. package/package.json +4 -4
  260. package/dist/chunk-2SKB4O2E.js +0 -59
  261. package/dist/chunk-4U276ICE.js +0 -39
  262. package/dist/chunk-6H3Z5JHH.js +0 -64
  263. package/dist/chunk-C4R4JLHE.js +0 -40
  264. package/dist/chunk-CBGGOQWU.js +0 -82
  265. package/dist/chunk-DLOBCJL6.js +0 -48
  266. package/dist/chunk-GIW4ZVDB.js +0 -39
  267. package/dist/chunk-IP74LCOQ.js +0 -57
  268. package/dist/chunk-IPHHDDC6.js +0 -45
  269. package/dist/chunk-KJXD4PNL.js +0 -50
  270. package/dist/chunk-KN5BXMWN.js +0 -44
  271. package/dist/chunk-OMI6FPPN.js +0 -43
  272. package/dist/chunk-OTLDSZDV.js +0 -69
  273. package/dist/chunk-PSOFBQWB.js +0 -42
  274. package/dist/chunk-T4YPZIQN.js +0 -36
  275. package/dist/chunk-TUULXQRW.js +0 -420
  276. package/dist/chunk-WNKPRSGI.js +0 -36
  277. package/dist/packages/ui/dist/assets/index-CoK_Dl0D.js +0 -47
  278. package/dist/packages/ui/dist/assets/index-Dw20IRhQ.css +0 -1
  279. package/dist/{chunk-24XLDU72.js → chunk-PXMV2LLY.js} +3 -3
@@ -6,11 +6,11 @@ var __atticusPath = (p) => __atticusFileURLToPath(__atticusUrl(p));
6
6
  import {
7
7
  boundedId,
8
8
  opt
9
- } from "./chunk-QKUJMING.js";
9
+ } from "./chunk-A4JXVO5O.js";
10
10
  import {
11
11
  curatedAliases,
12
12
  resolveNames
13
- } from "./chunk-6ZGLAACW.js";
13
+ } from "./chunk-TDSCKP3V.js";
14
14
  import {
15
15
  DATA_RULE,
16
16
  INSTRUCTION_RULES,
@@ -27,7 +27,7 @@ import {
27
27
  toRunSummary,
28
28
  verdictOf,
29
29
  wrapData
30
- } from "./chunk-P32RUW3B.js";
30
+ } from "./chunk-3424TLIJ.js";
31
31
  import {
32
32
  AgentDefinition,
33
33
  ChecklistPack,
@@ -67,11 +67,11 @@ import {
67
67
  serializeRecord,
68
68
  sourceReadsPage,
69
69
  toCanonicalYaml
70
- } from "./chunk-Q2TECDIT.js";
70
+ } from "./chunk-FPBUTZI5.js";
71
71
  import {
72
72
  SCHEMA_VERSION,
73
73
  writeFileAtomic
74
- } from "./chunk-TUULXQRW.js";
74
+ } from "./chunk-B4AEL3RF.js";
75
75
  import {
76
76
  require_dist
77
77
  } from "./chunk-BQGDB6ZL.js";
@@ -79,11 +79,6 @@ import {
79
79
  __toESM
80
80
  } from "./chunk-TV45EUGM.js";
81
81
 
82
- // packages/knowledge/dist/sources.js
83
- import { createHash as createHash2 } from "node:crypto";
84
- import { readdir as readdir2, readFile as readFile2 } from "node:fs/promises";
85
- import { isAbsolute as isAbsolute2, join as join3, relative as relative2, resolve as resolve2, sep as sep2 } from "node:path";
86
-
87
82
  // packages/knowledge/dist/markdown.js
88
83
  var import_yaml = __toESM(require_dist(), 1);
89
84
  var HEADING = /^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/;
@@ -314,6 +309,11 @@ function mentionIndex(records, systems) {
314
309
  };
315
310
  }
316
311
 
312
+ // packages/knowledge/dist/sources.js
313
+ import { createHash as createHash2 } from "node:crypto";
314
+ import { readdir as readdir2, readFile as readFile2 } from "node:fs/promises";
315
+ import { isAbsolute as isAbsolute2, join as join3, relative as relative2, resolve as resolve2, sep as sep2 } from "node:path";
316
+
317
317
  // packages/knowledge/dist/exports.js
318
318
  var import_yaml2 = __toESM(require_dist(), 1);
319
319
  import { readdir, readFile } from "node:fs/promises";
@@ -528,6 +528,25 @@ ${(0, import_yaml2.stringify)(fm, { lineWidth: 0 })}---
528
528
  ${body}`;
529
529
  }
530
530
  var titleSegment = (t) => t.normalize("NFKD").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "") || "page";
531
+ function uniquePagePaths(pages, alt, keeps = () => false) {
532
+ const count = /* @__PURE__ */ new Map();
533
+ for (const p of pages)
534
+ count.set(p.pagePath, (count.get(p.pagePath) ?? 0) + 1);
535
+ const taken = new Set(pages.filter((p) => count.get(p.pagePath) === 1).map((p) => p.pagePath));
536
+ const out = [];
537
+ for (const p of pages) {
538
+ if (count.get(p.pagePath) === 1) {
539
+ out.push(p);
540
+ continue;
541
+ }
542
+ let path = keeps(p) && !taken.has(p.pagePath) ? p.pagePath : alt(p);
543
+ for (let n = 2; taken.has(path); n++)
544
+ path = alt(p).replace(/\.md$/, `-${n}.md`);
545
+ taken.add(path);
546
+ out.push({ ...p, pagePath: path });
547
+ }
548
+ return out;
549
+ }
531
550
  function readCsv(text2) {
532
551
  const rows = [];
533
552
  let row = [];
@@ -686,7 +705,11 @@ var confluenceExportAdapter = {
686
705
  ...m.updated ? { updatedAt: m.updated } : {}
687
706
  });
688
707
  }
689
- return out;
708
+ return uniquePagePaths(out, (p) => {
709
+ const file = p.path.split("/").pop().replace(/\.html?$/i, "");
710
+ const id = /(?:^|_)(\d+)$/.exec(file)?.[1] ?? titleSegment(file);
711
+ return p.pagePath.replace(/\.md$/, `-${id}.md`);
712
+ });
690
713
  }
691
714
  };
692
715
  var sharepointExportAdapter = {
@@ -726,7 +749,8 @@ var sharepointExportAdapter = {
726
749
  ...m.updated ? { updatedAt: m.updated } : {}
727
750
  });
728
751
  }
729
- return out;
752
+ const ext = (p) => /\.([^./]+)$/.exec(p.path)?.[1]?.toLowerCase() ?? "";
753
+ return uniquePagePaths(out, (p) => p.pagePath.replace(/\.md$/, `.${ext(p)}.md`), (p) => ext(p) === "md");
730
754
  }
731
755
  };
732
756
 
@@ -899,6 +923,53 @@ var markdownFolderAdapter = {
899
923
  return out;
900
924
  }
901
925
  };
926
+ function withApiMeta(body, labels, restricted) {
927
+ if (!labels?.length && !restricted)
928
+ return body;
929
+ const lines = body.replace(/\r\n?/g, "\n").split("\n");
930
+ const end = frontMatterEnd(lines);
931
+ let own = {};
932
+ let rest = body;
933
+ if (end > 0) {
934
+ const doc = readMarkdown(lines.slice(0, end + 1).join("\n"));
935
+ if (doc.frontMatterProblem)
936
+ return body;
937
+ own = doc.frontMatter;
938
+ rest = lines.slice(end + 1).join("\n");
939
+ }
940
+ const ownLabels = end > 0 && own.labels !== void 0 && own.labels !== null ? Array.isArray(own.labels) ? own.labels.map(String) : String(own.labels).split(/[;,]/).map((x) => x.trim()).filter(Boolean) : [];
941
+ const all = [...ownLabels, ...(labels ?? []).filter((l) => !ownLabels.includes(l))];
942
+ const fm = [
943
+ ...all.length ? [`labels: [${all.map((l) => JSON.stringify(l)).join(", ")}]`] : [],
944
+ ...restricted ? ["restricted: true"] : [],
945
+ ...Object.entries(own).filter(([k]) => k !== "labels" && !(restricted && k === "restricted")).map(([k, v]) => `${JSON.stringify(k)}: ${JSON.stringify(v ?? null)}`)
946
+ ];
947
+ return `---
948
+ ${fm.join("\n")}
949
+ ---
950
+ ${rest}`;
951
+ }
952
+ function wikiApiAdapter(api) {
953
+ return {
954
+ async pages(source) {
955
+ const out = [];
956
+ for (const space of source.spaces) {
957
+ const heads = await api.listPages(space);
958
+ for (const h of [...heads].sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0)) {
959
+ const p = await api.getPage(h.id);
960
+ out.push({
961
+ pagePath: `${space}/${p.id}`,
962
+ path: `${source.id}:${space}/${p.id}`,
963
+ content: withApiMeta(p.body, p.labels, p.restricted),
964
+ updatedAt: p.updatedAt,
965
+ version: String(p.version)
966
+ });
967
+ }
968
+ }
969
+ return out;
970
+ }
971
+ };
972
+ }
902
973
  var DEFAULT_LEVELS = ["public", "internal", "confidential", "restricted"];
903
974
  var DAY = 864e5;
904
975
  var daysBetween = (from, to) => Math.floor((Date.parse(to) - Date.parse(from)) / DAY);
@@ -1049,11 +1120,36 @@ async function syncSources(o) {
1049
1120
  read.push({ source, raw: reads.filter((r) => !r.skipReason) });
1050
1121
  }
1051
1122
  const owners = pageOwners(read.filter((x) => !o.adaptersById?.[x.source.id]));
1123
+ const checked = /* @__PURE__ */ new Map();
1124
+ const checkedPage = (source, r) => {
1125
+ const key = `${source.id}\0${r.path}\0${r.pagePath}`;
1126
+ const known = checked.get(key);
1127
+ if (known)
1128
+ return known;
1129
+ const page = readPage({
1130
+ source: source.id,
1131
+ sourceType: source.type,
1132
+ path: r.path,
1133
+ pagePath: r.pagePath,
1134
+ content: r.content,
1135
+ ...r.updatedAt ? { updatedAt: r.updatedAt } : {},
1136
+ ...r.version ? { version: r.version } : {},
1137
+ records,
1138
+ systems,
1139
+ defaultClassification,
1140
+ mentions: index
1141
+ });
1142
+ const level = levels.indexOf(page.classification);
1143
+ const skip = page.doc.frontMatterProblem ? page.doc.frontMatterProblem : !source.readRestricted && pageRestricted(page.frontMatter) ? "under view restrictions, so above the limit for the metarepo's audience (readRestricted on the source says everyone who reads the metarepo may read it)" : level === -1 ? `unknown classification ${page.classification}` : level > limitLevel ? `${page.classification} is above the limit (${limit})` : void 0;
1144
+ const out = { page, ...skip !== void 0 ? { skip } : {} };
1145
+ checked.set(key, out);
1146
+ return out;
1147
+ };
1052
1148
  const mirrors = mirrorReaders(read.filter((x) => !o.adaptersById?.[x.source.id]).map((x) => ({
1053
1149
  source: x.source,
1054
1150
  raw: x.raw.filter((r) => {
1055
1151
  const owner = owners.get(r.path);
1056
- return !owner || owner.source === x.source.id;
1152
+ return (!owner || owner.source === x.source.id) && !checkedPage(x.source, r).skip;
1057
1153
  })
1058
1154
  })), o.orgPack);
1059
1155
  for (const { source, raw: all } of read) {
@@ -1078,38 +1174,9 @@ async function syncSources(o) {
1078
1174
  }
1079
1175
  const flagged = new Map(screenDocuments(raw.map((r) => ({ path: r.path, text: r.content, format: "markdown" }))).map((f) => [f.path, f]));
1080
1176
  for (const r of raw) {
1081
- const page = readPage({
1082
- source: source.id,
1083
- sourceType: source.type,
1084
- path: r.path,
1085
- pagePath: r.pagePath,
1086
- content: r.content,
1087
- ...r.updatedAt ? { updatedAt: r.updatedAt } : {},
1088
- ...r.version ? { version: r.version } : {},
1089
- records,
1090
- systems,
1091
- defaultClassification,
1092
- mentions: index
1093
- });
1094
- if (page.doc.frontMatterProblem) {
1095
- res.skipped.push({ source: source.id, path: r.path, reason: page.doc.frontMatterProblem });
1096
- continue;
1097
- }
1098
- if (!source.readRestricted && pageRestricted(page.frontMatter)) {
1099
- res.skipped.push({
1100
- source: source.id,
1101
- path: r.path,
1102
- reason: "under view restrictions, so above the limit for the metarepo's audience (readRestricted on the source says everyone who reads the metarepo may read it)"
1103
- });
1104
- continue;
1105
- }
1106
- const level = levels.indexOf(page.classification);
1107
- if (level === -1 || level > limitLevel) {
1108
- res.skipped.push({
1109
- source: source.id,
1110
- path: r.path,
1111
- reason: level === -1 ? `unknown classification ${page.classification}` : `${page.classification} is above the limit (${limit})`
1112
- });
1177
+ const { page, skip } = checkedPage(source, r);
1178
+ if (skip !== void 0) {
1179
+ res.skipped.push({ source: source.id, path: r.path, reason: skip });
1113
1180
  continue;
1114
1181
  }
1115
1182
  if (page.date) {
@@ -1138,8 +1205,41 @@ async function syncSources(o) {
1138
1205
  res.documents.push(sourceDocument(page));
1139
1206
  }
1140
1207
  }
1208
+ res.documents = uniqueDocumentIds(res.pages, res.documents);
1141
1209
  return res;
1142
1210
  }
1211
+ function uniqueDocumentIds(pages, docs) {
1212
+ const by = /* @__PURE__ */ new Map();
1213
+ docs.forEach((d, k) => by.set(d.id, [...by.get(d.id) ?? [], k]));
1214
+ const out = [...docs];
1215
+ const taken = new Set(docs.map((d) => d.id));
1216
+ const plain = (k) => {
1217
+ const base = pages[k].pagePath.replace(/\.(md|markdown)$/i, "");
1218
+ return slug(base) === base;
1219
+ };
1220
+ const byPath = (a, b) => {
1221
+ const x = pages[a].pagePath;
1222
+ const y = pages[b].pagePath;
1223
+ return x < y ? -1 : x > y ? 1 : 0;
1224
+ };
1225
+ for (const [id, ks] of by) {
1226
+ if (ks.length < 2)
1227
+ continue;
1228
+ const order = [...ks].sort((a, b) => Number(plain(b)) - Number(plain(a)) || byPath(a, b));
1229
+ for (const k of order.slice(1)) {
1230
+ const p = pages[k];
1231
+ const h = createHash2("sha256").update(`${p.source}\0${p.pagePath}`).digest("hex");
1232
+ const withHash = (n2) => `${id.slice(0, 119 - n2).replace(/[-.]+$/, "")}-${h.slice(0, n2)}`;
1233
+ let n = 8;
1234
+ while (taken.has(withHash(n)) && n < 32)
1235
+ n += 4;
1236
+ const next = withHash(n);
1237
+ taken.add(next);
1238
+ out[k] = { ...docs[k], id: next };
1239
+ }
1240
+ }
1241
+ return out;
1242
+ }
1143
1243
  function pageOwners(read) {
1144
1244
  const by = /* @__PURE__ */ new Map();
1145
1245
  for (const { source, raw } of read)
@@ -1955,11 +2055,6 @@ var FlowGraph = class {
1955
2055
  }
1956
2056
  };
1957
2057
 
1958
- // packages/features/dist/proposals.js
1959
- var import_yaml4 = __toESM(require_dist(), 1);
1960
- import { mkdir, readdir as readdir3, readFile as readFile3, writeFile } from "node:fs/promises";
1961
- import { join as join4 } from "node:path";
1962
-
1963
2058
  // packages/features/dist/detect.js
1964
2059
  var ENTRY_TYPES = /* @__PURE__ */ new Set(["rest", "grpc", "soap", "graphql", "webhook", "websocket", "sse"]);
1965
2060
  var DEFAULT_DEPTH = 8;
@@ -2402,6 +2497,9 @@ function detectFeatures(records, o = {}) {
2402
2497
  }
2403
2498
 
2404
2499
  // packages/features/dist/proposals.js
2500
+ var import_yaml4 = __toESM(require_dist(), 1);
2501
+ import { mkdir, readdir as readdir3, readFile as readFile3, writeFile } from "node:fs/promises";
2502
+ import { join as join4 } from "node:path";
2405
2503
  var NameProposalFile = external_exports.strictObject({
2406
2504
  schemaVersion: external_exports.literal(1),
2407
2505
  feature: RecordId,
@@ -3491,6 +3589,48 @@ function newestEvidence(r, commitDates = {}) {
3491
3589
  }
3492
3590
  return best;
3493
3591
  }
3592
+ function freshness(input) {
3593
+ const windows = input.orgPack?.pack?.freshness ?? {};
3594
+ const fallback = input.defaultDays ?? 365;
3595
+ const res = { stale: [], undated: [], documents: [] };
3596
+ const sorted2 = [...input.records].sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
3597
+ for (const r of sorted2) {
3598
+ const maxDays = windows[r.kind] ?? fallback;
3599
+ if (r.kind === "SourceDocument") {
3600
+ if (r.supersededBy)
3601
+ res.documents.push({
3602
+ id: r.id,
3603
+ path: r.path,
3604
+ reason: "superseded",
3605
+ supersededBy: r.supersededBy
3606
+ });
3607
+ else if (r.date) {
3608
+ const ageDays2 = daysBetween(r.date, input.now);
3609
+ if (ageDays2 > maxDays)
3610
+ res.documents.push({
3611
+ id: r.id,
3612
+ path: r.path,
3613
+ reason: "stale",
3614
+ date: r.date,
3615
+ ageDays: ageDays2,
3616
+ maxDays
3617
+ });
3618
+ }
3619
+ continue;
3620
+ }
3621
+ if (r.kind === "CuratedDecision")
3622
+ continue;
3623
+ const newest = newestEvidence(r, input.commitDates);
3624
+ if (!newest) {
3625
+ res.undated.push(r.id);
3626
+ continue;
3627
+ }
3628
+ const ageDays = daysBetween(newest, input.now);
3629
+ if (ageDays > maxDays)
3630
+ res.stale.push({ id: r.id, kind: r.kind, newest, ageDays, maxDays });
3631
+ }
3632
+ return res;
3633
+ }
3494
3634
 
3495
3635
  // packages/knowledge/dist/gaps.js
3496
3636
  function governingPatterns(i, ctx) {
@@ -4160,6 +4300,150 @@ function domainProfile(records, system, o) {
4160
4300
  return (o.template ?? DEFAULT_DOMAIN_PROFILE).replace(/\{\{\s*([a-z]+)\s*\}\}/g, (whole, k) => values[k] ?? whole);
4161
4301
  }
4162
4302
 
4303
+ // packages/knowledge/dist/quotes.js
4304
+ var HEADING2 = /^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/;
4305
+ var FENCE2 = /^ {0,3}(```+|~~~+)/;
4306
+ var SETEXT = /^ {0,3}(?:=+|-+)\s*$/;
4307
+ function visibleText(text2) {
4308
+ const spans = hiddenSpans(text2);
4309
+ if (!spans.length)
4310
+ return text2;
4311
+ let out = "";
4312
+ let at = 0;
4313
+ for (const s2 of spans) {
4314
+ if (s2.start < at)
4315
+ continue;
4316
+ out += text2.slice(at, s2.start) + text2.slice(s2.start, s2.end).replace(/[^\n]/g, " ");
4317
+ at = s2.end;
4318
+ }
4319
+ return out + text2.slice(at);
4320
+ }
4321
+ function pageLines(text2) {
4322
+ const lines = visibleText(text2.replace(/\r\n?/g, "\n")).split("\n");
4323
+ let i = 0;
4324
+ if (lines[0]?.trim() === "---") {
4325
+ const end = lines.findIndex((l, k) => k > 0 && (l.trim() === "---" || l.trim() === "..."));
4326
+ if (end > 0)
4327
+ i = end + 1;
4328
+ }
4329
+ const out = [];
4330
+ let section = "";
4331
+ let fence;
4332
+ for (; i < lines.length; i++) {
4333
+ const l = lines[i];
4334
+ const f = FENCE2.exec(l);
4335
+ if (f)
4336
+ fence = fence ? l.trim().startsWith(fence) ? void 0 : fence : f[1];
4337
+ const h = fence ? void 0 : HEADING2.exec(l);
4338
+ if (h) {
4339
+ section = h[2];
4340
+ continue;
4341
+ }
4342
+ const next = lines[i + 1];
4343
+ if (!fence && !f && l.trim() && next !== void 0 && SETEXT.test(next) && !SETEXT.test(l)) {
4344
+ section = l.trim();
4345
+ i++;
4346
+ continue;
4347
+ }
4348
+ out.push({ line: i + 1, text: l, section });
4349
+ }
4350
+ return out;
4351
+ }
4352
+ var foldQuote = (s2) => s2.replace(/[‘’‛′]/g, "'").replace(/[“”‟″]/g, '"').replace(/\s+/g, " ").trim();
4353
+ var ENTITIES2 = {
4354
+ amp: "&",
4355
+ lt: "<",
4356
+ gt: ">",
4357
+ quot: '"',
4358
+ apos: "'",
4359
+ nbsp: " ",
4360
+ ndash: "\u2013",
4361
+ mdash: "\u2014",
4362
+ hellip: "\u2026",
4363
+ lsquo: "\u2018",
4364
+ rsquo: "\u2019",
4365
+ ldquo: "\u201C",
4366
+ rdquo: "\u201D",
4367
+ zwsp: "",
4368
+ shy: ""
4369
+ };
4370
+ var INLINE_TAG = /<\/?(?:a|abbr|b|bdi|big|cite|code|del|dfn|em|font|i|ins|kbd|mark|q|s|samp|small|span|strike|strong|sub|sup|time|tt|u|var)(?:\s[^<>]*)?\/?>/gi;
4371
+ var ALNUM = /[\p{L}\p{N}]/u;
4372
+ function readerText(s2) {
4373
+ return s2.replace(/&(#x[0-9a-f]{1,6}|#[0-9]{1,7}|[a-z]{2,8});/gi, (m, e) => {
4374
+ if (e[0] !== "#")
4375
+ return ENTITIES2[e.toLowerCase()] ?? m;
4376
+ const n = e[1] === "x" || e[1] === "X" ? parseInt(e.slice(2), 16) : Number(e.slice(1));
4377
+ return n > 0 && n <= 1114111 ? String.fromCodePoint(n) : m;
4378
+ }).replace(/[\u200b-\u200d\u2060\ufeff\u00ad]/g, "").replace(/<br\s*\/?>/gi, " ").replace(INLINE_TAG, "").replace(/!?\[([^\]]*)\]\([^)\s]*(?:\s+"[^"]*")?\)/g, "$1").replace(/!?\[([^\]]+)\]\[[^\]]*\]/g, "$1").replace(/<((?:https?|mailto):[^<>\s]+)>/g, "$1").replace(/\\([!-/:-@[-`{-~])/g, "$1").replace(/`+/g, "").replace(/(^|[^\p{L}\p{N}*_~])(?:\*{1,3}|_{1,3}|~~)(?=[^\s*_~])/gu, "$1").replace(/([^\s*_~])(?:\*{1,3}|_{1,3}|~~)(?=$|[^\p{L}\p{N}*_~])/gu, "$1").replace(/([\p{L}\p{N}])\*{1,3}(?=[\p{L}\p{N}])/gu, "$1").replace(/[\u2010-\u2015\u2212]/g, "-").replace(/\u2026/g, "...");
4379
+ }
4380
+ var sameHeading = (a, b) => foldQuote(readerText(a)).replace(/^#+\s*/, "").toLowerCase() === foldQuote(readerText(b)).replace(/^#+\s*/, "").toLowerCase();
4381
+ var matchFold = (s2) => foldQuote(readerText(s2)).replace(/"/g, "'");
4382
+ var MARKERS = /^\s*(?:>\s?)*\s*(?:(?:[-*+]|\d{1,9}[.)])\s+)?/;
4383
+ var unmark = (s2) => s2.replace(MARKERS, "");
4384
+ function findIn(lines, q) {
4385
+ let text2 = "";
4386
+ const lineAt = [];
4387
+ for (const l of lines) {
4388
+ const t = matchFold(unmark(l.text));
4389
+ if (!t)
4390
+ continue;
4391
+ if (text2) {
4392
+ text2 += " ";
4393
+ lineAt.push(l.line);
4394
+ }
4395
+ for (let k = 0; k < t.length; k++)
4396
+ lineAt.push(l.line);
4397
+ text2 += t;
4398
+ }
4399
+ const wordStart = ALNUM.test(q[0] ?? "");
4400
+ const wordEnd = ALNUM.test(q.at(-1) ?? "");
4401
+ for (let at = text2.indexOf(q); at !== -1; at = text2.indexOf(q, at + 1)) {
4402
+ if (wordStart && at > 0 && ALNUM.test(text2[at - 1]))
4403
+ continue;
4404
+ const end = at + q.length;
4405
+ if (wordEnd && end < text2.length && ALNUM.test(text2[end]))
4406
+ continue;
4407
+ return lineAt[at];
4408
+ }
4409
+ return void 0;
4410
+ }
4411
+ function checkQuote(text2, quote2, section) {
4412
+ const q = matchFold(unmark(quote2)).replace(/[\s.,;:!?]+$/, "");
4413
+ if (q.length < 12)
4414
+ return { ok: false, problem: "the quote is too short to check" };
4415
+ const lines = pageLines(text2);
4416
+ const sections = [...new Set(lines.map((l) => l.section))];
4417
+ if (section !== void 0 && section.trim() !== "") {
4418
+ const wanted = sections.filter((s2) => sameHeading(s2, section));
4419
+ for (const s2 of wanted) {
4420
+ const line = findIn(lines.filter((l) => l.section === s2), q);
4421
+ if (line !== void 0)
4422
+ return { ok: true, line, section: s2 };
4423
+ }
4424
+ for (const s2 of sections) {
4425
+ const line = findIn(lines.filter((l) => l.section === s2), q);
4426
+ if (line !== void 0)
4427
+ return {
4428
+ ok: false,
4429
+ problem: wanted.length ? `the quote is on the page under "${s2 || "(no heading)"}", not under "${section}"` : `the page has no heading "${section}"; the quote is under "${s2 || "(no heading)"}"`,
4430
+ foundUnder: s2,
4431
+ line
4432
+ };
4433
+ }
4434
+ return {
4435
+ ok: false,
4436
+ problem: wanted.length ? `the quote is not on the page, word for word` : `the page has no heading "${section}", and the quote is not on the page, word for word`
4437
+ };
4438
+ }
4439
+ for (const s2 of sections) {
4440
+ const line = findIn(lines.filter((l) => l.section === s2), q);
4441
+ if (line !== void 0)
4442
+ return { ok: true, line, section: s2 };
4443
+ }
4444
+ return { ok: false, problem: "the quote is not on the page, word for word" };
4445
+ }
4446
+
4163
4447
  // packages/knowledge/dist/grounding.js
4164
4448
  var UNITS = {
4165
4449
  zero: 0,
@@ -4354,54 +4638,150 @@ function workingDays(d) {
4354
4638
  return Math.ceil(d.unit === "working-days" ? n : d.unit === "calendar-days" ? n * 5 / 7 : n / 8);
4355
4639
  }
4356
4640
 
4357
- // packages/knowledge/dist/tags.js
4358
- var import_yaml6 = __toESM(require_dist(), 1);
4359
- var slug3 = (s2) => s2.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
4360
- function tagList(values) {
4361
- return [
4362
- ...new Set(values.flatMap((v) => v.split(",")).map(slug3).filter(Boolean))
4363
- ];
4641
+ // packages/knowledge/dist/value-claims.js
4642
+ var LEAD_TIME = "lead-time";
4643
+ var leadTimeInputs = (item, leadTime) => ({
4644
+ v: 1,
4645
+ item,
4646
+ leadTime: leadTime.trim()
4647
+ });
4648
+ async function leadTimeDaysOf(store, item, leadTime) {
4649
+ if (!leadTime?.trim())
4650
+ return void 0;
4651
+ const j = await store.get(LEAD_TIME, judgmentKey(LEAD_TIME, leadTimeInputs(item, leadTime)));
4652
+ const v = j?.value;
4653
+ return v && typeof v.min === "number" && typeof v.max === "number" && v.unit ? { min: v.min, max: v.max, unit: v.unit } : void 0;
4364
4654
  }
4365
- function setSourceTags(text2, sourceId, change) {
4366
- const doc = (0, import_yaml6.parseDocument)(text2);
4367
- if (doc.errors.length)
4368
- return { ok: false, error: `sources.yaml can't be read: ${doc.errors[0].message}` };
4369
- const wikis = doc.get("wikis");
4370
- if (!(0, import_yaml6.isSeq)(wikis))
4371
- return { ok: false, error: `sources.yaml has no wikis, so there is no ${sourceId} to tag.` };
4372
- const entry = wikis.items.find((w) => (0, import_yaml6.isMap)(w) && w.get("id") === sourceId);
4373
- if (!entry) {
4374
- const ids = wikis.items.map((w) => (0, import_yaml6.isMap)(w) ? String(w.get("id")) : "").filter(Boolean);
4375
- return {
4376
- ok: false,
4377
- error: `There is no source ${sourceId} in sources.yaml${ids.length ? ` (there is ${ids.join(", ")})` : ""}.`
4378
- };
4379
- }
4380
- entry.flow = false;
4381
- const current = entry.toJSON().tags ?? {};
4382
- const kinds = change.kinds ? tagList(change.kinds) : current.kinds ?? [];
4383
- const frameworks = change.frameworks ? tagList(change.frameworks) : current.frameworks ?? [];
4384
- const tags = {};
4385
- if (kinds.length)
4386
- tags.kinds = kinds;
4387
- if (frameworks.length)
4388
- tags.frameworks = frameworks;
4389
- if (Object.keys(tags).length) {
4390
- const node = doc.createNode(tags);
4391
- node.flow = false;
4392
- for (const v of node.items)
4393
- if ((0, import_yaml6.isSeq)(v.value))
4394
- v.value.flow = true;
4395
- entry.set("tags", node);
4396
- } else
4397
- entry.delete("tags");
4398
- if (change.owner !== void 0) {
4399
- if (change.owner.trim())
4400
- entry.set("owner", change.owner.trim());
4401
- else
4402
- entry.delete("owner");
4403
- }
4404
- const out = doc.toString();
4655
+ var VALUES = (field) => field === "lead_time" || field.startsWith("dates.");
4656
+ var inputsOf = (id, c) => ({
4657
+ v: 1,
4658
+ item: id,
4659
+ field: c.field,
4660
+ value: c.value,
4661
+ span: c.span
4662
+ });
4663
+ async function settleClaims(items, o) {
4664
+ const at = o.now.toISOString().replace(/\.\d{3}Z$/, "Z");
4665
+ const judging = o.runtime.kind !== "hand-off" && o.runtime.kind !== "mock";
4666
+ const out = /* @__PURE__ */ new Map();
4667
+ const fail = (id, p) => out.set(id, [...out.get(id) ?? [], p]);
4668
+ const verdicts = /* @__PURE__ */ new Map();
4669
+ const ask = [];
4670
+ for (const c of items)
4671
+ for (const cl of c.claims) {
4672
+ const inputs = inputsOf(c.item.id, cl);
4673
+ const key = judgmentKey(STATES_VALUE_SPEC.kind, inputs);
4674
+ const stored = await o.store.get(STATES_VALUE_SPEC.kind, key);
4675
+ if (stored && typeof stored.verdict === "string") {
4676
+ verdicts.set(key, { verdict: stored.verdict, by: stored.confirmedBy });
4677
+ continue;
4678
+ }
4679
+ if (judging)
4680
+ ask.push({
4681
+ inputs,
4682
+ texts: { span: cl.span },
4683
+ facts: [`field: ${cl.field}`, `value: ${cl.value}`]
4684
+ });
4685
+ else if (!VALUES(cl.field)) {
4686
+ const by = { by: "ai", run: o.run };
4687
+ await o.store.put(makeJudgment({
4688
+ kind: STATES_VALUE_SPEC.kind,
4689
+ inputs,
4690
+ verdict: "yes",
4691
+ quotes: [{ of: "span", text: cl.span }],
4692
+ why: "The reading the knowledge scan gave with the words it cited.",
4693
+ confirmedBy: by,
4694
+ at
4695
+ }));
4696
+ verdicts.set(key, { verdict: "yes", by });
4697
+ }
4698
+ }
4699
+ if (ask.length) {
4700
+ const r = await judge(STATES_VALUE_SPEC, ask, {
4701
+ runtime: o.runtime,
4702
+ store: o.store,
4703
+ change: "knowledge-scan",
4704
+ now: o.now
4705
+ });
4706
+ for (const [k, v] of r.results)
4707
+ verdicts.set(k, {
4708
+ verdict: v.verdict,
4709
+ by: v.judgment?.confirmedBy ?? { by: "check", rule: "veto" }
4710
+ });
4711
+ }
4712
+ for (const c of items) {
4713
+ let daysBy;
4714
+ for (const cl of c.claims) {
4715
+ const v = verdicts.get(judgmentKey(STATES_VALUE_SPEC.kind, inputsOf(c.item.id, cl)));
4716
+ if (v?.verdict === "yes") {
4717
+ if (cl.field === "lead_time_days")
4718
+ daysBy = v.by;
4719
+ continue;
4720
+ }
4721
+ fail(c.item.id, v === void 0 ? `${cl.field} "${cl.value}" isn't word for word in "${cl.span}": write it as the page says it` : `${cl.field} "${cl.value}": the words "${cl.span}" don't state it (a judge read them${v.verdict === "unsure" ? " and couldn't tell" : ""}); quote the words that do`);
4722
+ }
4723
+ const days = c.item.lead_time_days;
4724
+ if (days && daysBy && c.item.lead_time && !out.has(c.item.id))
4725
+ await o.store.put(makeJudgment({
4726
+ kind: LEAD_TIME,
4727
+ inputs: leadTimeInputs(c.item.id, c.item.lead_time),
4728
+ verdict: "normalised",
4729
+ value: days,
4730
+ confirmedBy: daysBy,
4731
+ at
4732
+ }));
4733
+ }
4734
+ return out;
4735
+ }
4736
+
4737
+ // packages/knowledge/dist/tags.js
4738
+ var import_yaml6 = __toESM(require_dist(), 1);
4739
+ var slug3 = (s2) => s2.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
4740
+ function tagList(values) {
4741
+ return [
4742
+ ...new Set(values.flatMap((v) => v.split(",")).map(slug3).filter(Boolean))
4743
+ ];
4744
+ }
4745
+ function setSourceTags(text2, sourceId, change) {
4746
+ const doc = (0, import_yaml6.parseDocument)(text2);
4747
+ if (doc.errors.length)
4748
+ return { ok: false, error: `sources.yaml can't be read: ${doc.errors[0].message}` };
4749
+ const wikis = doc.get("wikis");
4750
+ if (!(0, import_yaml6.isSeq)(wikis))
4751
+ return { ok: false, error: `sources.yaml has no wikis, so there is no ${sourceId} to tag.` };
4752
+ const entry = wikis.items.find((w) => (0, import_yaml6.isMap)(w) && w.get("id") === sourceId);
4753
+ if (!entry) {
4754
+ const ids = wikis.items.map((w) => (0, import_yaml6.isMap)(w) ? String(w.get("id")) : "").filter(Boolean);
4755
+ return {
4756
+ ok: false,
4757
+ error: `There is no source ${sourceId} in sources.yaml${ids.length ? ` (there is ${ids.join(", ")})` : ""}.`
4758
+ };
4759
+ }
4760
+ entry.flow = false;
4761
+ const current = entry.toJSON().tags ?? {};
4762
+ const kinds = change.kinds ? tagList(change.kinds) : current.kinds ?? [];
4763
+ const frameworks = change.frameworks ? tagList(change.frameworks) : current.frameworks ?? [];
4764
+ const tags = {};
4765
+ if (kinds.length)
4766
+ tags.kinds = kinds;
4767
+ if (frameworks.length)
4768
+ tags.frameworks = frameworks;
4769
+ if (Object.keys(tags).length) {
4770
+ const node = doc.createNode(tags);
4771
+ node.flow = false;
4772
+ for (const v of node.items)
4773
+ if ((0, import_yaml6.isSeq)(v.value))
4774
+ v.value.flow = true;
4775
+ entry.set("tags", node);
4776
+ } else
4777
+ entry.delete("tags");
4778
+ if (change.owner !== void 0) {
4779
+ if (change.owner.trim())
4780
+ entry.set("owner", change.owner.trim());
4781
+ else
4782
+ entry.delete("owner");
4783
+ }
4784
+ const out = doc.toString();
4405
4785
  const check = Sources.safeParse((0, import_yaml6.parseDocument)(out).toJSON());
4406
4786
  if (!check.success)
4407
4787
  return {
@@ -4487,8 +4867,19 @@ async function writeSnapshots(o) {
4487
4867
  pages: [],
4488
4868
  skipped: o.sync.skipped.filter((s2) => s2.source === w.id).map((s2) => ({ page: s2.path, reason: s2.reason }))
4489
4869
  };
4870
+ const listed = /* @__PURE__ */ new Map();
4490
4871
  for (const p of pages) {
4491
4872
  const file = safe(fileFor(p.pagePath));
4873
+ const first = listed.get(p.pagePath) ?? listed.get(`\0${file}`);
4874
+ if (first !== void 0) {
4875
+ manifest.skipped.push({
4876
+ page: p.path,
4877
+ reason: `another page of the source has the path ${p.pagePath} (${first}), which is kept`
4878
+ });
4879
+ continue;
4880
+ }
4881
+ listed.set(p.pagePath, p.path);
4882
+ listed.set(`\0${file}`, p.path);
4492
4883
  const was = before.get(p.pagePath);
4493
4884
  const keep = was && was.sha256 === p.hash && was.file === file ? was.in : void 0;
4494
4885
  if (!keep) {
@@ -4506,7 +4897,7 @@ async function writeSnapshots(o) {
4506
4897
  });
4507
4898
  }
4508
4899
  await writeFileAtomic(join5(dir, SNAPSHOT_FILE), (0, import_yaml7.stringify)(manifest));
4509
- out.push({ source: w.id, dir: rel, pages: pages.length, copied });
4900
+ out.push({ source: w.id, dir: rel, pages: manifest.pages.length, copied });
4510
4901
  }
4511
4902
  return out;
4512
4903
  }
@@ -4657,203 +5048,6 @@ function sectionAt(text2, line) {
4657
5048
  return lines.slice(start, end).join("\n");
4658
5049
  }
4659
5050
 
4660
- // packages/knowledge/dist/quotes.js
4661
- var HEADING2 = /^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/;
4662
- var FENCE2 = /^ {0,3}(```+|~~~+)/;
4663
- function visibleText(text2) {
4664
- const spans = hiddenSpans(text2);
4665
- if (!spans.length)
4666
- return text2;
4667
- let out = "";
4668
- let at = 0;
4669
- for (const s2 of spans) {
4670
- if (s2.start < at)
4671
- continue;
4672
- out += text2.slice(at, s2.start) + text2.slice(s2.start, s2.end).replace(/[^\n]/g, " ");
4673
- at = s2.end;
4674
- }
4675
- return out + text2.slice(at);
4676
- }
4677
- function pageLines(text2) {
4678
- const lines = visibleText(text2.replace(/\r\n?/g, "\n")).split("\n");
4679
- let i = 0;
4680
- if (lines[0]?.trim() === "---") {
4681
- const end = lines.findIndex((l, k) => k > 0 && (l.trim() === "---" || l.trim() === "..."));
4682
- if (end > 0)
4683
- i = end + 1;
4684
- }
4685
- const out = [];
4686
- let section = "";
4687
- let fence;
4688
- for (; i < lines.length; i++) {
4689
- const l = lines[i];
4690
- const f = FENCE2.exec(l);
4691
- if (f)
4692
- fence = fence ? l.trim().startsWith(fence) ? void 0 : fence : f[1];
4693
- const h = fence ? void 0 : HEADING2.exec(l);
4694
- if (h) {
4695
- section = h[2];
4696
- continue;
4697
- }
4698
- out.push({ line: i + 1, text: l, section });
4699
- }
4700
- return out;
4701
- }
4702
- var foldQuote = (s2) => s2.replace(/[‘’‛′]/g, "'").replace(/[“”‟″]/g, '"').replace(/\s+/g, " ").trim();
4703
- var sameHeading = (a, b) => foldQuote(a).replace(/^#+\s*/, "").toLowerCase() === foldQuote(b).replace(/^#+\s*/, "").toLowerCase();
4704
- var matchFold = (s2) => foldQuote(s2).replace(/"/g, "'");
4705
- var MARKERS = /^\s*(?:>\s?)*\s*(?:(?:[-*+]|\d{1,9}[.)])\s+)?/;
4706
- var unmark = (s2) => s2.replace(MARKERS, "");
4707
- function findIn(lines, q) {
4708
- let text2 = "";
4709
- const lineAt = [];
4710
- for (const l of lines) {
4711
- const t = matchFold(unmark(l.text));
4712
- if (!t)
4713
- continue;
4714
- if (text2) {
4715
- text2 += " ";
4716
- lineAt.push(l.line);
4717
- }
4718
- for (let k = 0; k < t.length; k++)
4719
- lineAt.push(l.line);
4720
- text2 += t;
4721
- }
4722
- const at = text2.indexOf(q);
4723
- return at === -1 ? void 0 : lineAt[at];
4724
- }
4725
- function checkQuote(text2, quote2, section) {
4726
- const q = matchFold(unmark(quote2)).replace(/[\s.,;:!?]+$/, "");
4727
- if (q.length < 12)
4728
- return { ok: false, problem: "the quote is too short to check" };
4729
- const lines = pageLines(text2);
4730
- const sections = [...new Set(lines.map((l) => l.section))];
4731
- if (section !== void 0 && section.trim() !== "") {
4732
- const wanted = sections.filter((s2) => sameHeading(s2, section));
4733
- for (const s2 of wanted) {
4734
- const line = findIn(lines.filter((l) => l.section === s2), q);
4735
- if (line !== void 0)
4736
- return { ok: true, line, section: s2 };
4737
- }
4738
- for (const s2 of sections) {
4739
- const line = findIn(lines.filter((l) => l.section === s2), q);
4740
- if (line !== void 0)
4741
- return {
4742
- ok: false,
4743
- problem: wanted.length ? `the quote is on the page under "${s2 || "(no heading)"}", not under "${section}"` : `the page has no heading "${section}"; the quote is under "${s2 || "(no heading)"}"`,
4744
- foundUnder: s2,
4745
- line
4746
- };
4747
- }
4748
- return {
4749
- ok: false,
4750
- problem: wanted.length ? `the quote is not on the page, word for word` : `the page has no heading "${section}", and the quote is not on the page, word for word`
4751
- };
4752
- }
4753
- for (const s2 of sections) {
4754
- const line = findIn(lines.filter((l) => l.section === s2), q);
4755
- if (line !== void 0)
4756
- return { ok: true, line, section: s2 };
4757
- }
4758
- return { ok: false, problem: "the quote is not on the page, word for word" };
4759
- }
4760
-
4761
- // packages/knowledge/dist/value-claims.js
4762
- var LEAD_TIME = "lead-time";
4763
- var leadTimeInputs = (item, leadTime) => ({
4764
- v: 1,
4765
- item,
4766
- leadTime: leadTime.trim()
4767
- });
4768
- async function leadTimeDaysOf(store, item, leadTime) {
4769
- if (!leadTime?.trim())
4770
- return void 0;
4771
- const j = await store.get(LEAD_TIME, judgmentKey(LEAD_TIME, leadTimeInputs(item, leadTime)));
4772
- const v = j?.value;
4773
- return v && typeof v.min === "number" && typeof v.max === "number" && v.unit ? { min: v.min, max: v.max, unit: v.unit } : void 0;
4774
- }
4775
- var VALUES = (field) => field === "lead_time" || field.startsWith("dates.");
4776
- var inputsOf = (id, c) => ({
4777
- v: 1,
4778
- item: id,
4779
- field: c.field,
4780
- value: c.value,
4781
- span: c.span
4782
- });
4783
- async function settleClaims(items, o) {
4784
- const at = o.now.toISOString().replace(/\.\d{3}Z$/, "Z");
4785
- const judging = o.runtime.kind !== "hand-off" && o.runtime.kind !== "mock";
4786
- const out = /* @__PURE__ */ new Map();
4787
- const fail = (id, p) => out.set(id, [...out.get(id) ?? [], p]);
4788
- const verdicts = /* @__PURE__ */ new Map();
4789
- const ask = [];
4790
- for (const c of items)
4791
- for (const cl of c.claims) {
4792
- const inputs = inputsOf(c.item.id, cl);
4793
- const key = judgmentKey(STATES_VALUE_SPEC.kind, inputs);
4794
- const stored = await o.store.get(STATES_VALUE_SPEC.kind, key);
4795
- if (stored && typeof stored.verdict === "string") {
4796
- verdicts.set(key, { verdict: stored.verdict, by: stored.confirmedBy });
4797
- continue;
4798
- }
4799
- if (judging)
4800
- ask.push({
4801
- inputs,
4802
- texts: { span: cl.span },
4803
- facts: [`field: ${cl.field}`, `value: ${cl.value}`]
4804
- });
4805
- else if (!VALUES(cl.field)) {
4806
- const by = { by: "ai", run: o.run };
4807
- await o.store.put(makeJudgment({
4808
- kind: STATES_VALUE_SPEC.kind,
4809
- inputs,
4810
- verdict: "yes",
4811
- quotes: [{ of: "span", text: cl.span }],
4812
- why: "The reading the knowledge scan gave with the words it cited.",
4813
- confirmedBy: by,
4814
- at
4815
- }));
4816
- verdicts.set(key, { verdict: "yes", by });
4817
- }
4818
- }
4819
- if (ask.length) {
4820
- const r = await judge(STATES_VALUE_SPEC, ask, {
4821
- runtime: o.runtime,
4822
- store: o.store,
4823
- change: "knowledge-scan",
4824
- now: o.now
4825
- });
4826
- for (const [k, v] of r.results)
4827
- verdicts.set(k, {
4828
- verdict: v.verdict,
4829
- by: v.judgment?.confirmedBy ?? { by: "check", rule: "veto" }
4830
- });
4831
- }
4832
- for (const c of items) {
4833
- let daysBy;
4834
- for (const cl of c.claims) {
4835
- const v = verdicts.get(judgmentKey(STATES_VALUE_SPEC.kind, inputsOf(c.item.id, cl)));
4836
- if (v?.verdict === "yes") {
4837
- if (cl.field === "lead_time_days")
4838
- daysBy = v.by;
4839
- continue;
4840
- }
4841
- fail(c.item.id, v === void 0 ? `${cl.field} "${cl.value}" isn't word for word in "${cl.span}": write it as the page says it` : `${cl.field} "${cl.value}": the words "${cl.span}" don't state it (a judge read them${v.verdict === "unsure" ? " and couldn't tell" : ""}); quote the words that do`);
4842
- }
4843
- const days = c.item.lead_time_days;
4844
- if (days && daysBy && c.item.lead_time && !out.has(c.item.id))
4845
- await o.store.put(makeJudgment({
4846
- kind: LEAD_TIME,
4847
- inputs: leadTimeInputs(c.item.id, c.item.lead_time),
4848
- verdict: "normalised",
4849
- value: days,
4850
- confirmedBy: daysBy,
4851
- at
4852
- }));
4853
- }
4854
- return out;
4855
- }
4856
-
4857
5051
  // packages/knowledge/dist/conflict-owner.js
4858
5052
  var dateOnly2 = (v) => {
4859
5053
  if (v instanceof Date)
@@ -5448,39 +5642,52 @@ function checkConflict(raw, pages, ids) {
5448
5642
  }
5449
5643
  };
5450
5644
  }
5451
- function checkSuperseded(raw, pages) {
5645
+ function resolveAnyPage(pages, snapshots, ref3) {
5646
+ const read = resolvePage(pages, ref3);
5647
+ if (read)
5648
+ return { source: read.page.source, page: read.page.pagePath };
5649
+ const r = ref3.trim().replace(/^\.\//, "");
5650
+ const all = snapshots.flatMap((s2) => s2.manifest.pages.map((p) => ({ source: s2.manifest.source, page: p.page })));
5651
+ const exact = all.find((p) => p.page === r || `${p.source}/${p.page}` === r);
5652
+ if (exact)
5653
+ return exact;
5654
+ const byName = all.filter((p) => basename(p.page) === basename(r));
5655
+ return byName.length === 1 ? byName[0] : void 0;
5656
+ }
5657
+ function checkSuperseded(raw, pages, snapshots) {
5452
5658
  const p = SupersededIn.safeParse(raw);
5453
5659
  if (!p.success)
5454
5660
  return { problem: `a superseded page: ${fmt(p.error.issues).join("; ")}` };
5455
5661
  const s2 = p.data;
5456
5662
  const oldP = resolvePage(pages, s2.old);
5457
- const newP = resolvePage(pages, s2.new);
5663
+ const newRef = resolveAnyPage(pages, snapshots, s2.new);
5458
5664
  if (!oldP)
5459
5665
  return { problem: `superseded: there is no page ${s2.old} in the snapshot` };
5460
- if (!newP)
5666
+ if (!newRef)
5461
5667
  return { problem: `superseded: there is no page ${s2.new} in the snapshot` };
5668
+ const newP = pages.find((x) => x.page.source === newRef.source && x.page.pagePath === newRef.page);
5462
5669
  const on = s2.page ? resolvePage(pages, s2.page, s2.quote) : void 0;
5463
- const candidates = on ? [on] : [newP, oldP];
5670
+ const candidates = on ? [on] : newP ? [newP, oldP] : [oldP];
5464
5671
  const where = candidates.find((c) => checkQuote(c.page.text ?? "", s2.quote).ok);
5465
5672
  if (!where)
5466
5673
  return {
5467
5674
  problem: `superseded ${s2.old}: the quote is not on ${candidates.map((c) => c.page.pagePath).join(" or ")}, word for word`
5468
5675
  };
5469
5676
  const ref3 = (x) => ({ source: x.page.source, page: x.page.pagePath });
5470
- return { ok: { old: ref3(oldP), new: ref3(newP), quote: s2.quote, quotedOn: ref3(where) } };
5677
+ return { ok: { old: ref3(oldP), new: newRef, quote: s2.quote, quotedOn: ref3(where) } };
5471
5678
  }
5472
- function frontMatterSuperseded(pages) {
5679
+ function frontMatterSuperseded(pages, snapshots) {
5473
5680
  const out = [];
5474
5681
  for (const p of pages) {
5475
5682
  const fm = p.page.frontMatter;
5476
5683
  const by = fm["superseded-by"] ?? fm.superseded_by ?? fm.supersededBy;
5477
5684
  if (typeof by !== "string")
5478
5685
  continue;
5479
- const n = resolvePage(pages, by) ?? resolvePage(pages, `${by}.md`);
5686
+ const n = resolveAnyPage(pages, snapshots, by) ?? resolveAnyPage(pages, snapshots, `${by}.md`);
5480
5687
  if (!n)
5481
5688
  continue;
5482
5689
  const ref3 = (x) => ({ source: x.page.source, page: x.page.pagePath });
5483
- out.push({ old: ref3(p), new: ref3(n), quote: `superseded-by: ${by}`, quotedOn: ref3(p) });
5690
+ out.push({ old: ref3(p), new: n, quote: `superseded-by: ${by}`, quotedOn: ref3(p) });
5484
5691
  }
5485
5692
  return out;
5486
5693
  }
@@ -5509,6 +5716,35 @@ function checkInjection(raw, pages) {
5509
5716
  };
5510
5717
  }
5511
5718
  var norm = (s2) => words4(s2).join(" ");
5719
+ var recordTitle = (r) => r.kind === "Pattern" || r.kind === "Party" || r.kind === "Product" ? r.name : r.title;
5720
+ function recordConflict(x, y) {
5721
+ if (x.kind !== y.kind || !x.quote || !y.quote)
5722
+ return void 0;
5723
+ if (x.quote.source === y.quote.source && x.quote.page === y.quote.page)
5724
+ return void 0;
5725
+ const field = (r, f) => {
5726
+ const v = r[f];
5727
+ return typeof v === "string" ? v : void 0;
5728
+ };
5729
+ const cx = field(x, "catalogueItem");
5730
+ const sameThing = norm(recordTitle(x)) === norm(recordTitle(y)) || !!cx && norm(cx) === norm(field(y, "catalogueItem") ?? "");
5731
+ if (!sameThing)
5732
+ return void 0;
5733
+ const differ = (f) => {
5734
+ const a = field(x, f);
5735
+ const b = field(y, f);
5736
+ return a !== void 0 && b !== void 0 && norm(a) !== norm(b);
5737
+ };
5738
+ if (!differ("leadTime") && !differ("handledBy"))
5739
+ return void 0;
5740
+ return {
5741
+ about: [x.id, y.id],
5742
+ pages: [x, y].map((i) => ({ source: i.quote.source, page: i.quote.page })),
5743
+ says: [x.quote.text, y.quote.text],
5744
+ summary: `${recordTitle(x)}: the pages disagree on ${differ("leadTime") ? "the lead time" : "who handles it"}`,
5745
+ foundBy: "check"
5746
+ };
5747
+ }
5512
5748
  function checkConflicts(items) {
5513
5749
  const out = [];
5514
5750
  for (let a = 0; a < items.length; a++)
@@ -5783,9 +6019,10 @@ async function scanKnowledge(snapshots, o) {
5783
6019
  return result;
5784
6020
  }
5785
6021
  const kept = /* @__PURE__ */ new Map();
6022
+ const takenBy = new Map((o.taken ?? []).map((r) => [r.id, r]));
5786
6023
  let failed = [];
5787
6024
  let conflicts = [];
5788
- const superseded = frontMatterSuperseded(pages);
6025
+ const superseded = frontMatterSuperseded(pages, snapshots);
5789
6026
  const aiInjections = [];
5790
6027
  let feedback = [];
5791
6028
  let answered2 = false;
@@ -5867,7 +6104,7 @@ async function scanKnowledge(snapshots, o) {
5867
6104
  }
5868
6105
  answered2 = true;
5869
6106
  for (const s2 of answer.superseded) {
5870
- const c = checkSuperseded(s2, pages);
6107
+ const c = checkSuperseded(s2, pages, snapshots);
5871
6108
  if ("problem" in c)
5872
6109
  problems.push(c.problem);
5873
6110
  else if (!superseded.some((x) => x.old.page === c.ok.old.page && x.old.source === c.ok.old.source))
@@ -5893,6 +6130,18 @@ async function scanKnowledge(snapshots, o) {
5893
6130
  continue;
5894
6131
  }
5895
6132
  seen.add(id);
6133
+ const other = takenBy.get(id);
6134
+ const at = c.ok.page.page;
6135
+ if (other && !(other.quote?.source === at.source && other.quote.page === at.pagePath)) {
6136
+ failed.push({
6137
+ id,
6138
+ kind: c.ok.item.kind,
6139
+ title: c.ok.item.title,
6140
+ page: at.pagePath,
6141
+ problems: [idTaken(id, other, at.source)]
6142
+ });
6143
+ continue;
6144
+ }
5896
6145
  kept.set(id, c.ok);
5897
6146
  }
5898
6147
  for (const [id, c] of kept) {
@@ -5966,6 +6215,10 @@ async function scanKnowledge(snapshots, o) {
5966
6215
  return true;
5967
6216
  }
5968
6217
  }
6218
+ var idTaken = (id, other, source) => {
6219
+ const where = other.quote ? other.quote.source === source ? other.quote.page : `${other.quote.source}/${other.quote.page}` : "another item";
6220
+ return `id ${id} is used by ${where}; choose another`;
6221
+ };
5969
6222
  var sameSet = (a, b) => a.length === b.length && [...a].sort().join("\n") === [...b].sort().join("\n");
5970
6223
  function checkScanAnswer(snapshots, output) {
5971
6224
  const pages = snapshots.flatMap((s2) => s2.pages.map((p) => preparePage(p, s2)));
@@ -5980,9 +6233,9 @@ function checkScanAnswer(snapshots, output) {
5980
6233
  return [`the answer isn't YAML: ${e.message.split("\n")[0]}`];
5981
6234
  }
5982
6235
  const problems = [];
5983
- const superseded = frontMatterSuperseded(pages);
6236
+ const superseded = frontMatterSuperseded(pages, snapshots);
5984
6237
  for (const s2 of answer.superseded) {
5985
- const c = checkSuperseded(s2, pages);
6238
+ const c = checkSuperseded(s2, pages, snapshots);
5986
6239
  if ("problem" in c)
5987
6240
  problems.push(c.problem);
5988
6241
  else
@@ -6085,6 +6338,11 @@ function copyDate(p) {
6085
6338
  }
6086
6339
  var isKnowledgeRecord = (r) => r.kind === "Pattern" || r.kind === "ProcessDefinition" || r.kind === "Decision" || r.kind === "Product" || r.kind === "Party" && !!r.quote;
6087
6340
 
6341
+ // packages/knowledge/dist/knowledge-store.js
6342
+ var import_yaml10 = __toESM(require_dist(), 1);
6343
+ import { readdir as readdir6, readFile as readFile6, rm as rm2 } from "node:fs/promises";
6344
+ import { join as join7, relative as relative3, sep as sep3 } from "node:path";
6345
+
6088
6346
  // packages/knowledge/dist/reviews.js
6089
6347
  var import_yaml9 = __toESM(require_dist(), 1);
6090
6348
  import { createHash as createHash4 } from "node:crypto";
@@ -6174,9 +6432,19 @@ function canonical(v) {
6174
6432
  return v;
6175
6433
  }
6176
6434
  function itemMeaning(r) {
6435
+ return meaningHash(r, false);
6436
+ }
6437
+ function itemMeaningBefore50(r) {
6438
+ return meaningHash(r, true);
6439
+ }
6440
+ function meaningHash(r, flagsAndTags) {
6177
6441
  const strip = (q) => q ? Object.fromEntries(Object.entries(q).filter(([k]) => k !== "snapshot" && k !== "line")) : q;
6178
6442
  const x = { ...r };
6179
6443
  delete x.evidence;
6444
+ if (!flagsAndTags) {
6445
+ delete x.flags;
6446
+ delete x.tags;
6447
+ }
6180
6448
  x.quote = strip(x.quote);
6181
6449
  if (Array.isArray(x.alsoOn))
6182
6450
  x.alsoOn = x.alsoOn.map(strip);
@@ -6265,7 +6533,7 @@ async function readReviews(root) {
6265
6533
  function applyReview(item, review) {
6266
6534
  if (!review)
6267
6535
  return { item };
6268
- const stale = review.checked !== itemMeaning(item);
6536
+ const stale = review.checked !== itemMeaning(item) && review.checked !== itemMeaningBefore50(item);
6269
6537
  const summary3 = {
6270
6538
  state: stale ? "stale" : review.verdict,
6271
6539
  verdict: review.verdict,
@@ -6274,16 +6542,13 @@ function applyReview(item, review) {
6274
6542
  ...review.note ? { note: review.note } : {},
6275
6543
  ...review.corrections ? { corrected: Object.keys(review.corrections).sort() } : {}
6276
6544
  };
6277
- if (!review.corrections)
6545
+ if (!review.corrections || stale)
6278
6546
  return { item, summary: summary3 };
6279
6547
  const merged = parseRecord({ ...item, ...review.corrections });
6280
6548
  return { item: merged.ok ? merged.record : item, summary: summary3 };
6281
6549
  }
6282
6550
 
6283
6551
  // packages/knowledge/dist/knowledge-store.js
6284
- var import_yaml10 = __toESM(require_dist(), 1);
6285
- import { readdir as readdir6, readFile as readFile6, rm as rm2 } from "node:fs/promises";
6286
- import { join as join7, relative as relative3, sep as sep3 } from "node:path";
6287
6552
  var KNOWLEDGE_REPORT = "scan.yaml";
6288
6553
  var toPosix3 = (p) => p.split(sep3).join("/");
6289
6554
  async function files(dir) {
@@ -6342,7 +6607,7 @@ async function readKnowledge(root, o = {}) {
6342
6607
  const a = applyReview(item, r.reviews.get(item.id));
6343
6608
  if (a.summary)
6344
6609
  reviews[item.id] = a.summary;
6345
- if (a.summary?.state === "rejected")
6610
+ if (a.summary?.verdict === "rejected")
6346
6611
  rejected.push(a.item);
6347
6612
  else
6348
6613
  shown.push(a.item);
@@ -6368,15 +6633,72 @@ async function writeKnowledge(root, result, scannedAt, o = {}) {
6368
6633
  return !pages || page === void 0 || pages.has(page);
6369
6634
  };
6370
6635
  const before = await readKnowledge(root, { raw: true, cacheRoot: root });
6371
- const pageText = (source, page) => o.snapshots?.find((x) => x.manifest.source === source)?.pages.find((p) => p.pagePath === page)?.text;
6636
+ const snapPage = (source, page) => {
6637
+ const snap = o.snapshots?.find((x) => x.manifest.source === source);
6638
+ const p = snap?.pages.find((x) => x.pagePath === page);
6639
+ return snap && p ? { snap, p } : void 0;
6640
+ };
6641
+ const pageText = (source, page) => snapPage(source, page)?.p.text;
6372
6642
  const stillQuoted = (r) => {
6373
6643
  if (!r.flags?.some((f) => f.startsWith("found:")) || !r.quote)
6374
6644
  return false;
6375
6645
  const text2 = pageText(r.quote.source, r.quote.page);
6376
6646
  return text2 !== void 0 && checkQuote(text2, r.quote.text, r.quote.section).ok;
6377
6647
  };
6378
- const keep = before.items.filter((r) => !touches(sourceOf(r), r.quote?.page) || stillQuoted(r));
6379
- const all = [...keep, ...result.items];
6648
+ const recheckAlsoOn = (r) => {
6649
+ if (!r.alsoOn.some((a) => touches(a.source, a.page)))
6650
+ return r;
6651
+ const alsoOn = [];
6652
+ const evidence = [...r.evidence];
6653
+ const paired = evidence.length === r.alsoOn.length + 1;
6654
+ const keptEvidence = paired ? [evidence[0]] : evidence;
6655
+ r.alsoOn.forEach((a, k) => {
6656
+ if (!touches(a.source, a.page)) {
6657
+ alsoOn.push(a);
6658
+ if (paired)
6659
+ keptEvidence.push(evidence[k + 1]);
6660
+ return;
6661
+ }
6662
+ const at = snapPage(a.source, a.page);
6663
+ const c = at ? checkQuote(at.p.text ?? "", a.text, a.section) : void 0;
6664
+ if (!at || !c?.ok)
6665
+ return;
6666
+ const m = at.snap.manifest.pages.find((x) => x.page === a.page);
6667
+ const snapshot = m?.in ?? at.snap.manifest.date;
6668
+ alsoOn.push({ ...a, section: c.section, line: c.line, snapshot });
6669
+ if (paired)
6670
+ keptEvidence.push({ ...evidence[k + 1], path: at.p.path, line: c.line });
6671
+ });
6672
+ return { ...r, alsoOn, evidence: keptEvidence };
6673
+ };
6674
+ const keep = before.items.filter((r) => !touches(sourceOf(r), r.quote?.page) || stillQuoted(r)).map(recheckAlsoOn);
6675
+ const keptById = new Map(keep.map((r) => [r.id, r]));
6676
+ const refused = [];
6677
+ const accepted = [];
6678
+ for (const r of result.items) {
6679
+ const k = keptById.get(r.id);
6680
+ if (k && !(k.quote?.source === r.quote?.source && k.quote?.page === r.quote?.page)) {
6681
+ refused.push({
6682
+ id: r.id,
6683
+ kind: knowledgeKindOf(r) ?? r.kind,
6684
+ title: itemTitle(r),
6685
+ ...r.quote ? { page: r.quote.page, source: r.quote.source } : {},
6686
+ problems: [idTaken(r.id, k, r.quote?.source ?? "")]
6687
+ });
6688
+ continue;
6689
+ }
6690
+ accepted.push(r);
6691
+ }
6692
+ const readNow = new Set(accepted.map((r) => r.id));
6693
+ const merged = [...keep.filter((r) => !readNow.has(r.id)), ...accepted];
6694
+ const refusedIds = new Set(refused.map((f) => f.id));
6695
+ const found = result.conflicts.filter((c) => !c.about.some((a) => refusedIds.has(a)));
6696
+ const conflicts = mergeConflicts(before.report?.conflicts ?? [], found, merged, {
6697
+ readNow,
6698
+ ...o.snapshots ? { snapshots: o.snapshots } : {},
6699
+ superseded: result.superseded
6700
+ });
6701
+ const all = merged.map((r) => withConflictFlags(r, conflicts));
6380
6702
  const dir = join7(knowledgeDirOf(root), "items");
6381
6703
  const wanted = new Map(all.map((r) => [recordPath(r), serializeRecord(r)]));
6382
6704
  let written = 0;
@@ -6439,7 +6761,7 @@ async function writeKnowledge(root, result, scannedAt, o = {}) {
6439
6761
  scannedAt,
6440
6762
  snapshots,
6441
6763
  changes: { at: scannedAt, ...changes },
6442
- conflicts: [...other(old?.conflicts), ...result.conflicts],
6764
+ conflicts,
6443
6765
  superseded: [
6444
6766
  ...(old?.superseded ?? []).filter((x) => !touches(x.old.source, x.old.page)),
6445
6767
  ...result.superseded
@@ -6450,11 +6772,62 @@ async function writeKnowledge(root, result, scannedAt, o = {}) {
6450
6772
  ...result.failed.map((f) => ({
6451
6773
  ...f,
6452
6774
  ...result.snapshots.length === 1 ? { source: result.snapshots[0].source } : {}
6453
- }))
6775
+ })),
6776
+ ...refused
6454
6777
  ]
6455
6778
  };
6456
6779
  await writeFileAtomic(join7(knowledgeDirOf(root), KNOWLEDGE_REPORT), (0, import_yaml10.stringify)(report));
6457
- return { written, removed, changes };
6780
+ return { written, removed, changes, ...refused.length ? { refused } : {} };
6781
+ }
6782
+ var sameAbout = (a, b) => a.length === b.length && [...a].sort().join("\n") === [...b].sort().join("\n");
6783
+ function mergeConflicts(old, found, items, o) {
6784
+ const byId2 = new Map(items.map((r) => [r.id, r]));
6785
+ const out = found.filter((c) => c.about.every((a) => byId2.has(a)));
6786
+ const has = (about) => out.some((c) => sameAbout(c.about, about));
6787
+ for (const c of old) {
6788
+ if (has(c.about) || !c.about.every((a) => byId2.has(a)))
6789
+ continue;
6790
+ const reread = c.about.filter((a) => o.readNow.has(a));
6791
+ if (c.foundBy === "check") {
6792
+ if (!reread.length) {
6793
+ out.push(c);
6794
+ continue;
6795
+ }
6796
+ const [x, y] = c.about.map((a) => byId2.get(a));
6797
+ const again = x && y && c.about.length === 2 ? recordConflict(x, y) : void 0;
6798
+ if (again)
6799
+ out.push({ ...again, ...c.owner ? { owner: c.owner } : {} });
6800
+ } else if (reread.length < c.about.length)
6801
+ out.push(c);
6802
+ }
6803
+ const facts2 = (o.snapshots ?? []).flatMap((s2) => s2.pages.map((p) => pageFacts(p, s2.manifest)));
6804
+ const kept = items.filter((r) => !o.readNow.has(r.id));
6805
+ for (const x of items.filter((r) => o.readNow.has(r.id)))
6806
+ for (const y of kept) {
6807
+ if (has([x.id, y.id]))
6808
+ continue;
6809
+ const c = recordConflict(x, y);
6810
+ if (!c)
6811
+ continue;
6812
+ const handledBy = [x, y].map((r) => "handledBy" in r ? r.handledBy : void 0).filter((h) => typeof h === "string");
6813
+ const owner = facts2.length ? conflictOwner(c, facts2, {
6814
+ ...knowledgeKindOf(x) ? { kind: knowledgeKindOf(x) } : {},
6815
+ ...new Set(handledBy).size === 1 ? { handledBy: handledBy[0] } : {}
6816
+ }, o.superseded) : void 0;
6817
+ out.push(owner ? { ...c, owner } : c);
6818
+ }
6819
+ return out;
6820
+ }
6821
+ function withConflictFlags(r, conflicts) {
6822
+ const mine = conflicts.filter((c) => c.about.includes(r.id)).map((c) => `conflict:${c.pages.map((p) => p.page).join("|")}`);
6823
+ const flags = [
6824
+ .../* @__PURE__ */ new Set([...(r.flags ?? []).filter((f) => !f.startsWith("conflict:")), ...mine.sort()])
6825
+ ];
6826
+ const same3 = flags.length === (r.flags ?? []).length && flags.every((f, k) => f === r.flags[k]);
6827
+ if (same3)
6828
+ return r;
6829
+ const { flags: _, ...rest } = r;
6830
+ return flags.length ? { ...rest, flags } : rest;
6458
6831
  }
6459
6832
  function filterItems(items, o) {
6460
6833
  const tag = o.tag?.toLowerCase();
@@ -7310,6 +7683,10 @@ function planRescan(snapshots, report, items, o = {}) {
7310
7683
  }
7311
7684
  return plan;
7312
7685
  }
7686
+ function keptBy(items, plan) {
7687
+ const previous = new Set(plan.previous);
7688
+ return items.filter((i) => !previous.has(i));
7689
+ }
7313
7690
 
7314
7691
  // packages/knowledge/dist/find.js
7315
7692
  var import_yaml12 = __toESM(require_dist(), 1);
@@ -7397,6 +7774,8 @@ async function findKnowledge(snapshots, phrase, o) {
7397
7774
  ...o.resume ? { resume: o.resume } : {},
7398
7775
  ...o.maxAttempts ? { maxAttempts: o.maxAttempts } : {},
7399
7776
  focus: { phrase, known },
7777
+ // Review round 50: an id an item of another page has is handed back, never reused.
7778
+ taken: o.items.filter((i) => !known.includes(i)),
7400
7779
  ...o.judgments ? { judgments: o.judgments } : {}
7401
7780
  });
7402
7781
  const ids = new Set(o.items.map((i) => i.id));
@@ -7426,8 +7805,8 @@ var FindFile = external_exports.object({
7426
7805
  var slugOf2 = (s2) => fold2(s2).replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "search";
7427
7806
  var findsDir = (root) => join10(knowledgeDirOf(root), FINDS_DIR);
7428
7807
  async function saveFind(root, r, at) {
7429
- const slug4 = slugOf2(r.phrase);
7430
- await writeFileAtomic(join10(findsDir(root), `${slug4}.yaml`), `# What a search of the wikis found (ADR 0101). atticus knowledge keep <candidate> --find ${slug4} keeps one.
7808
+ const slug5 = slugOf2(r.phrase);
7809
+ await writeFileAtomic(join10(findsDir(root), `${slug5}.yaml`), `# What a search of the wikis found (ADR 0101). atticus knowledge keep <candidate> --find ${slug5} keeps one.
7431
7810
  ${(0, import_yaml12.stringify)({
7432
7811
  schemaVersion: 1,
7433
7812
  phrase: r.phrase,
@@ -7435,10 +7814,10 @@ ${(0, import_yaml12.stringify)({
7435
7814
  matches: r.matches,
7436
7815
  candidates: r.candidates
7437
7816
  }, { lineWidth: 0 })}`);
7438
- return slug4;
7817
+ return slug5;
7439
7818
  }
7440
- async function readFind(root, slug4) {
7441
- const text2 = await readFile8(join10(findsDir(root), `${slug4}.yaml`), "utf8").catch(() => void 0);
7819
+ async function readFind(root, slug5) {
7820
+ const text2 = await readFile8(join10(findsDir(root), `${slug5}.yaml`), "utf8").catch(() => void 0);
7442
7821
  if (text2 === void 0)
7443
7822
  return void 0;
7444
7823
  const f = FindFile.safeParse((0, import_yaml12.parse)(text2));
@@ -7455,7 +7834,7 @@ async function readFind(root, slug4) {
7455
7834
  });
7456
7835
  }
7457
7836
  return {
7458
- slug: slug4,
7837
+ slug: slug5,
7459
7838
  phrase: f.data.phrase,
7460
7839
  at: f.data.at,
7461
7840
  matches: f.data.matches,
@@ -7484,14 +7863,14 @@ var KIND_FIELD = {
7484
7863
  Party: ["partyKind", (k) => k === "vendor" ? "vendor" : "internal-team"],
7485
7864
  Product: ["productKind", (k) => k]
7486
7865
  };
7487
- async function keepCandidate(root, slug4, id, o) {
7488
- const f = await readFind(root, slug4);
7866
+ async function keepCandidate(root, slug5, id, o) {
7867
+ const f = await readFind(root, slug5);
7489
7868
  if (!f)
7490
- return { error: `There is no saved search ${slug4}. atticus knowledge finds lists them.` };
7869
+ return { error: `There is no saved search ${slug5}. atticus knowledge finds lists them.` };
7491
7870
  const c = f.candidates.find((x) => x.record.id === id);
7492
7871
  if (!c)
7493
7872
  return {
7494
- error: `The search ${slug4} has no candidate ${id}: it has ${f.candidates.map((x) => x.record.id).join(", ")}.`
7873
+ error: `The search ${slug5} has no candidate ${id}: it has ${f.candidates.map((x) => x.record.id).join(", ")}.`
7495
7874
  };
7496
7875
  if (c.known)
7497
7876
  return {
@@ -7503,7 +7882,7 @@ async function keepCandidate(root, slug4, id, o) {
7503
7882
  if (!allowed.includes(as))
7504
7883
  return { error: `${id} can be kept as ${allowed.join(" or ")}.` };
7505
7884
  const [field, value] = KIND_FIELD[c.record.kind];
7506
- const flag = `found:${slug4}`;
7885
+ const flag = `found:${slug5}`;
7507
7886
  const parsed = parseRecord({
7508
7887
  ...c.record,
7509
7888
  [field]: value(as),
@@ -7525,7 +7904,7 @@ async function keepCandidate(root, slug4, id, o) {
7525
7904
  await writeReview(root, r.review);
7526
7905
  c.kept = { by: o.by, at: o.at, as };
7527
7906
  c.record = item;
7528
- await writeFileAtomic(join10(findsDir(root), `${slug4}.yaml`), `# What a search of the wikis found (ADR 0101). atticus knowledge keep <candidate> --find ${slug4} keeps one.
7907
+ await writeFileAtomic(join10(findsDir(root), `${slug5}.yaml`), `# What a search of the wikis found (ADR 0101). atticus knowledge keep <candidate> --find ${slug5} keeps one.
7529
7908
  ${(0, import_yaml12.stringify)({
7530
7909
  schemaVersion: 1,
7531
7910
  phrase: f.phrase,
@@ -7945,15 +8324,149 @@ ${(0, import_yaml14.stringify)({ ...draft2, proposals: left }, { lineWidth: 0 })
7945
8324
  };
7946
8325
  }
7947
8326
 
8327
+ // packages/knowledge/dist/passages.js
8328
+ var MAX_TEXT = 1500;
8329
+ var clip = (s2) => s2.length > MAX_TEXT ? `${s2.slice(0, MAX_TEXT - 1).trimEnd()}\u2026` : s2;
8330
+ function visibleLines(text2) {
8331
+ const raw = text2.replace(/\r\n?/g, "\n").split("\n");
8332
+ const lines = visibleText(raw.join("\n")).split("\n").map((l, i) => l === raw[i] ? l : l.replace(/[ \t]{2,}/g, " ").trimEnd());
8333
+ let from = 0;
8334
+ if (lines[0]?.trim() === "---") {
8335
+ const end = lines.findIndex((l, k) => k > 0 && (l.trim() === "---" || l.trim() === "..."));
8336
+ if (end > 0) {
8337
+ for (let k = 0; k <= end; k++)
8338
+ lines[k] = "";
8339
+ from = end + 1;
8340
+ }
8341
+ }
8342
+ return { lines, from };
8343
+ }
8344
+ function pageSections(p) {
8345
+ const { lines, from } = visibleLines(p.text);
8346
+ const out = [];
8347
+ const path = [];
8348
+ let start = from;
8349
+ let heading = "";
8350
+ const flush = (end) => {
8351
+ const body = lines.slice(start, end);
8352
+ const text2 = body.filter((l, i) => !(i === 0 && /^#{1,6}\s/.test(l))).join("\n").trim();
8353
+ if (text2 || heading)
8354
+ out.push({
8355
+ source: p.source,
8356
+ page: p.page,
8357
+ path: p.path,
8358
+ heading,
8359
+ line: start + 1,
8360
+ text: clip(text2)
8361
+ });
8362
+ };
8363
+ let inFence = false;
8364
+ lines.forEach((l, i) => {
8365
+ if (/^\s*(```|~~~)/.test(l))
8366
+ inFence = !inFence;
8367
+ const h = inFence ? null : /^(#{1,6})\s+(.*?)\s*#*\s*$/.exec(l);
8368
+ if (!h)
8369
+ return;
8370
+ if (i > start || heading)
8371
+ flush(i);
8372
+ const level = h[1].length;
8373
+ while (path.length && path.at(-1).level >= level)
8374
+ path.pop();
8375
+ path.push({ level, text: h[2] });
8376
+ heading = path.map((x) => x.text).join(" \u203A ");
8377
+ start = i;
8378
+ });
8379
+ flush(lines.length);
8380
+ return out.filter((s2) => s2.text || s2.heading);
8381
+ }
8382
+ var slug4 = (s2) => s2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
8383
+ function sectionOf(pages, id) {
8384
+ const hash = id.indexOf("#");
8385
+ const where = hash < 0 ? id : id.slice(0, hash);
8386
+ const want = hash < 0 ? "" : id.slice(hash + 1).trim();
8387
+ const page = pages.find((p) => `${p.source}/${p.page}` === where || p.path === where || p.page === where);
8388
+ if (!page)
8389
+ return void 0;
8390
+ const sections = pageSections(page);
8391
+ if (!want)
8392
+ return sections[0];
8393
+ const w = want.toLowerCase();
8394
+ const last = (h) => h.split(" \u203A ").at(-1) ?? h;
8395
+ return sections.find((s2) => s2.heading.toLowerCase() === w || last(s2.heading).toLowerCase() === w) ?? sections.find((s2) => slug4(s2.heading) === slug4(want) || slug4(last(s2.heading)) === slug4(want)) ?? sections.find((s2) => slug4(want).endsWith(slug4(last(s2.heading))) && slug4(last(s2.heading)));
8396
+ }
8397
+ function rankPassages(question, pages, limit = 5) {
8398
+ const q = [...new Set(termsOf(question))];
8399
+ if (!q.length)
8400
+ return [];
8401
+ const all = pages.flatMap(pageSections);
8402
+ const docs = all.map((s2) => new Set(termsOf(`${s2.heading} ${s2.text}`)));
8403
+ const idf = new Map(q.map((t) => [t, Math.log(1 + all.length / (1 + docs.filter((d) => d.has(t)).length))]));
8404
+ const need = q.length > 2 ? 2 : 1;
8405
+ return all.map((s2, k) => {
8406
+ const hits = q.filter((t) => docs[k].has(t));
8407
+ const heading = new Set(termsOf(s2.heading));
8408
+ const score = hits.reduce((n, t) => n + idf.get(t) * (heading.has(t) ? 1.5 : 1), 0);
8409
+ return { s: s2, hits: hits.length, score };
8410
+ }).filter((x) => x.hits >= need).sort((a, b) => b.score - a.score || a.s.path.localeCompare(b.s.path) || a.s.line - b.s.line).slice(0, limit).map((x) => x.s);
8411
+ }
8412
+ function knowledgeAnswer(question, o) {
8413
+ const limit = o.limit ?? 5;
8414
+ const q = termsOf(question);
8415
+ const need = new Set(q).size > 2 ? 2 : 1;
8416
+ const items = rankItems(question, [...o.items]).filter((x) => {
8417
+ const own = new Set(termsOf(`${itemTitle(x.item)} ${x.item.quote?.text ?? ""} ${x.item.tags.join(" ")}`));
8418
+ return [...new Set(q)].filter((t) => own.has(t)).length >= need;
8419
+ }).slice(0, limit).map(({ item }) => ({
8420
+ id: item.id,
8421
+ kind: item.kind,
8422
+ title: itemTitle(item),
8423
+ ...item.quote ? {
8424
+ quote: {
8425
+ source: item.quote.source,
8426
+ page: item.quote.page,
8427
+ ...item.quote.section ? { section: item.quote.section } : {},
8428
+ text: item.quote.text
8429
+ }
8430
+ } : {}
8431
+ }));
8432
+ return { items, passages: rankPassages(question, o.pages, limit) };
8433
+ }
8434
+
7948
8435
  export {
8436
+ frontMatterEnd,
8437
+ readMarkdown,
8438
+ sentences,
8439
+ mentionIndex,
8440
+ decodeEntities,
8441
+ htmlToMarkdown,
8442
+ elementInner,
8443
+ exportDate,
8444
+ exportPage,
8445
+ titleSegment,
8446
+ uniquePagePaths,
8447
+ readCsv,
8448
+ confluenceExportAdapter,
8449
+ sharepointExportAdapter,
7949
8450
  readSourceSettings,
8451
+ pageSignalsOf,
7950
8452
  pageStandingOf,
8453
+ bodyKey,
8454
+ pageRestricted,
8455
+ authorityWords,
7951
8456
  scopeWords,
8457
+ exceptionTo,
7952
8458
  emptyPlaces,
7953
8459
  scopeMatch,
8460
+ markdownFolderAdapter,
8461
+ wikiApiAdapter,
7954
8462
  daysBetween,
8463
+ pageOwnerLine,
7955
8464
  readPage,
7956
8465
  syncSources,
8466
+ sourceDocument,
8467
+ reachesItem,
8468
+ mapFacts,
8469
+ reachesItems,
7957
8470
  judgeFacts,
7958
8471
  scanPatterns,
7959
8472
  diffPatterns,
@@ -7976,50 +8489,101 @@ export {
7976
8489
  workItemsFromTracker,
7977
8490
  suggestFeatureLinks,
7978
8491
  featureFlows,
8492
+ FEATURE_CHECKS,
8493
+ NAME_ABBREVIATIONS,
8494
+ nameWords2 as nameWords,
8495
+ abbreviates,
7979
8496
  namingHint,
8497
+ glossaryTermKnown,
7980
8498
  newestEvidence,
8499
+ freshness,
8500
+ KNOWLEDGE_CHECKS,
7981
8501
  knowledgeGaps,
8502
+ COVERAGE_AREAS,
7982
8503
  featureCoverage,
7983
8504
  coverage,
7984
8505
  toApiCoverage,
8506
+ DEFAULT_DOMAIN_PROFILE,
7985
8507
  domainProfile,
8508
+ visibleText,
8509
+ pageLines,
8510
+ foldQuote,
8511
+ readerText,
7986
8512
  checkQuote,
8513
+ valueTokens,
8514
+ groundValues,
7987
8515
  workingDays,
8516
+ LEAD_TIME,
8517
+ leadTimeInputs,
7988
8518
  leadTimeDaysOf,
8519
+ settleClaims,
7989
8520
  tagList,
7990
8521
  setSourceTags,
7991
8522
  SNAPSHOT_FILE,
7992
8523
  SnapshotManifest,
8524
+ sourceTags,
7993
8525
  writeSnapshots,
8526
+ readManifest,
8527
+ snapshotCopyPath,
7994
8528
  snapshotDates,
7995
8529
  snapshotSources,
7996
8530
  readSnapshot,
7997
8531
  snapshotPages,
8532
+ linksIn,
8533
+ sectionAt,
7998
8534
  pageFacts,
8535
+ conflictOwner,
8536
+ KNOWLEDGE_READER,
7999
8537
  KNOWLEDGE_SCAN_OUTPUT,
8538
+ knowledgeReaderAgent,
8539
+ preparePage,
8540
+ SCAN_ROOM_RESERVE,
8000
8541
  knowledgeScanRoom,
8542
+ recordConflict,
8001
8543
  scanKnowledge,
8544
+ idTaken,
8002
8545
  checkScanAnswer,
8546
+ isKnowledgeRecord,
8547
+ REVIEWS_DIR,
8548
+ KnowledgeReview,
8003
8549
  correctableFields,
8004
8550
  fieldName,
8551
+ itemMeaning,
8552
+ itemMeaningBefore50,
8005
8553
  reviewItem,
8006
8554
  writeReview,
8007
8555
  readReviews,
8556
+ applyReview,
8557
+ KNOWLEDGE_REPORT,
8008
8558
  readKnowledge,
8009
8559
  writeKnowledge,
8010
8560
  filterItems,
8011
8561
  itemTitle,
8562
+ KNOWLEDGE_ASK_OUTPUT,
8563
+ KNOWLEDGE_ASKER,
8564
+ knowledgeAskerAgent,
8012
8565
  termsOf,
8566
+ rankItems,
8013
8567
  itemForAi,
8014
8568
  askKnowledge,
8569
+ valuesOf,
8570
+ codeSettles,
8571
+ snapshotPageReader,
8572
+ standingSuggestion,
8015
8573
  CONFLICT_STEP,
8574
+ conflictKey,
8575
+ conflictKeyOfQuestion,
8016
8576
  conflictDraft,
8017
8577
  readConflicts,
8018
8578
  conflictLine,
8019
8579
  codeText,
8580
+ unquoteGitPath,
8020
8581
  checkoutGitWiki,
8021
8582
  gitWikiAdapter,
8583
+ tokensOf,
8022
8584
  planRescan,
8585
+ keptBy,
8586
+ FINDS_DIR,
8023
8587
  searchPages,
8024
8588
  findKnowledge,
8025
8589
  saveFind,
@@ -8030,6 +8594,11 @@ export {
8030
8594
  draftOrgPack,
8031
8595
  acceptOrgPackDraft,
8032
8596
  estimateScan,
8597
+ StandardCheckProposal,
8033
8598
  draftStandardChecks,
8034
- acceptStandardChecks
8599
+ acceptStandardChecks,
8600
+ pageSections,
8601
+ sectionOf,
8602
+ rankPassages,
8603
+ knowledgeAnswer
8035
8604
  };