@maycombhq/atticus 2.0.0-beta.2 → 2.0.0-beta.21

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 (273) hide show
  1. package/dist/bin.js +8 -4
  2. package/dist/chunk-265LWMOA.js +91 -0
  3. package/dist/chunk-26WBY34Y.js +37 -0
  4. package/dist/{chunk-UBBC2XSG.js → chunk-26Z7OGQW.js} +518 -93
  5. package/dist/chunk-2D7PWSOK.js +172 -0
  6. package/dist/{chunk-JCZIKA4C.js → chunk-2HH3UCZM.js} +4 -4
  7. package/dist/{chunk-GDLULHTC.js → chunk-2HTEMYTB.js} +12 -26
  8. package/dist/chunk-2UCRFXFZ.js +130 -0
  9. package/dist/{chunk-MVZVGYXH.js → chunk-2V2ZPQQU.js} +81 -13
  10. package/dist/{chunk-BOHJZTEQ.js → chunk-36RY7ZXM.js} +130 -71
  11. package/dist/{chunk-I3E7CX4H.js → chunk-37WE3LS2.js} +3 -3
  12. package/dist/{chunk-IPKHE5D6.js → chunk-3AQ2R5NL.js} +1520 -871
  13. package/dist/chunk-3G6S7LAA.js +43 -0
  14. package/dist/chunk-3J5I7ZOU.js +58 -0
  15. package/dist/{chunk-65NYPGRC.js → chunk-3LZ6P5EP.js} +1 -1
  16. package/dist/chunk-3SSTNB4E.js +191 -0
  17. package/dist/chunk-3TD6S4TC.js +49 -0
  18. package/dist/{chunk-3C7EYRFZ.js → chunk-3UTYPHN3.js} +1 -1
  19. package/dist/{chunk-G2B4ZQGH.js → chunk-3WON4G3M.js} +2 -2
  20. package/dist/{chunk-S3QNRWYR.js → chunk-42EPP7OB.js} +12 -12
  21. package/dist/chunk-455SYIIE.js +113 -0
  22. package/dist/{chunk-YISXLPHN.js → chunk-4B6BT75O.js} +166 -23
  23. package/dist/{chunk-C6EKFH7J.js → chunk-4CLK2RJO.js} +7 -7
  24. package/dist/chunk-4CYTJ5TZ.js +38 -0
  25. package/dist/{chunk-EYWIDJFU.js → chunk-4D62IZII.js} +5 -5
  26. package/dist/chunk-4FOAYLI4.js +328 -0
  27. package/dist/{chunk-7JUKDRSZ.js → chunk-4KNOJC6J.js} +294 -215
  28. package/dist/{chunk-YMZ3TNYB.js → chunk-4PYC2UGC.js} +2 -2
  29. package/dist/{chunk-27NKUS3X.js → chunk-4SLBCEPD.js} +2104 -726
  30. package/dist/chunk-4TKVU2I2.js +122 -0
  31. package/dist/{chunk-RUVFXE2L.js → chunk-4WXRPQDE.js} +448 -47
  32. package/dist/{chunk-7ZUIMTOU.js → chunk-5CMPVC3N.js} +24 -24
  33. package/dist/chunk-5G7ILBUG.js +66 -0
  34. package/dist/{chunk-HFQCFSJR.js → chunk-5PV7S2ZP.js} +3 -3
  35. package/dist/{chunk-FITWGOJ2.js → chunk-5QUOPNLN.js} +4 -4
  36. package/dist/{chunk-Z6LF7HQN.js → chunk-5TDRBOAV.js} +5 -5
  37. package/dist/{chunk-T6AIP7H5.js → chunk-5WERBKLE.js} +199 -63
  38. package/dist/{chunk-XPCM366L.js → chunk-62DLJSLV.js} +8 -8
  39. package/dist/{chunk-L24C55VN.js → chunk-64AADMTW.js} +99 -25
  40. package/dist/{chunk-K65BJIMT.js → chunk-67BP7HXL.js} +17 -17
  41. package/dist/chunk-6DQYZU2W.js +379 -0
  42. package/dist/{chunk-EDS2L2LD.js → chunk-6EXDI5GI.js} +52 -26
  43. package/dist/chunk-6FNAKCET.js +38 -0
  44. package/dist/{chunk-6IU67AEK.js → chunk-75ASLHBT.js} +21 -15
  45. package/dist/{chunk-A3GY6SOA.js → chunk-75ZOZFGH.js} +18 -18
  46. package/dist/{chunk-MGYZM27B.js → chunk-77O633L5.js} +49 -23
  47. package/dist/{chunk-GQ4N4WKF.js → chunk-7AB6OWTV.js} +3 -3
  48. package/dist/{chunk-M766ZJ6W.js → chunk-7CZHUZBL.js} +25 -25
  49. package/dist/{chunk-A7UPUQFY.js → chunk-7FHNFCHK.js} +643 -124
  50. package/dist/chunk-7FUIVIBG.js +415 -0
  51. package/dist/{chunk-6QSERWXH.js → chunk-7QPCGTPS.js} +21 -21
  52. package/dist/{chunk-LR3R6Z2A.js → chunk-A2G72UI4.js} +7 -7
  53. package/dist/{chunk-I4JRCD6M.js → chunk-AE4P57KK.js} +23 -17
  54. package/dist/{chunk-AVJDSJ2F.js → chunk-AHW3RY3X.js} +7 -7
  55. package/dist/chunk-AM6FP6JW.js +43 -0
  56. package/dist/{chunk-CSZ4C5N6.js → chunk-AOCWFA7T.js} +93 -10
  57. package/dist/{chunk-EPTBZ3GP.js → chunk-API5TOUB.js} +1 -1
  58. package/dist/{chunk-652QWTLZ.js → chunk-AZDITBCT.js} +3 -3
  59. package/dist/{chunk-DPUYDDQG.js → chunk-BA2HUMDN.js} +25 -3
  60. package/dist/chunk-BA3U7ALS.js +99 -0
  61. package/dist/{chunk-HVUPKCGJ.js → chunk-BC6KKZ67.js} +5 -5
  62. package/dist/{chunk-CKSITVS4.js → chunk-BEPCKDCP.js} +2554 -722
  63. package/dist/{chunk-3ALD2W2A.js → chunk-BPPU3PW7.js} +4 -4
  64. package/dist/{chunk-QRAOANID.js → chunk-BVWWPBKD.js} +21 -21
  65. package/dist/{chunk-ZDPAS56H.js → chunk-BXBCMGIQ.js} +7 -1
  66. package/dist/chunk-BXZ4PKIT.js +233 -0
  67. package/dist/chunk-C7CEK3KW.js +247 -0
  68. package/dist/chunk-CFH3QH26.js +29 -0
  69. package/dist/chunk-CG6CULP6.js +170 -0
  70. package/dist/chunk-CLD4RVTA.js +45 -0
  71. package/dist/{chunk-DKJA76CJ.js → chunk-CNPY4NTZ.js} +13 -13
  72. package/dist/chunk-CNU5Q2D5.js +575 -0
  73. package/dist/{chunk-T2UYZSCQ.js → chunk-COYN3UAN.js} +126 -23
  74. package/dist/{chunk-23W7VWKR.js → chunk-CPK7QSBG.js} +1360 -113
  75. package/dist/{chunk-4AK7IBVP.js → chunk-D2WSW4GU.js} +1 -1
  76. package/dist/{chunk-ABWHYWNI.js → chunk-D57MFJPP.js} +3 -3
  77. package/dist/chunk-D5KV5PSK.js +45 -0
  78. package/dist/chunk-D5MASS4I.js +48 -0
  79. package/dist/{chunk-7EOBHUMC.js → chunk-DCWN3HFV.js} +2 -2
  80. package/dist/{chunk-QSXK2RGH.js → chunk-DDJPM5YX.js} +2 -2
  81. package/dist/chunk-DN4A2Q2O.js +57 -0
  82. package/dist/{chunk-IHMLFRVV.js → chunk-DUPZPDCJ.js} +58 -16
  83. package/dist/{chunk-PRPPGYZG.js → chunk-E2VXBSIR.js} +4 -4
  84. package/dist/chunk-E57AOFYN.js +32 -0
  85. package/dist/{chunk-UGLN7QHV.js → chunk-ECLXZWAG.js} +12 -12
  86. package/dist/{chunk-5WG5YP4T.js → chunk-EDZ45WIR.js} +14 -14
  87. package/dist/chunk-EFCQSMXB.js +37 -0
  88. package/dist/{chunk-2ANOROX3.js → chunk-EZIN5E5B.js} +8 -8
  89. package/dist/{chunk-BWZ77RQT.js → chunk-F6H2RJ3N.js} +1 -1
  90. package/dist/{chunk-OLQJTJJU.js → chunk-FAJDKNSD.js} +7 -3
  91. package/dist/chunk-FGAGWYZB.js +47 -0
  92. package/dist/{chunk-4WBVUHXN.js → chunk-FLVZFTLQ.js} +18 -18
  93. package/dist/chunk-FQ6WH6PB.js +140 -0
  94. package/dist/{chunk-T6XQL73F.js → chunk-FRHD22WM.js} +61 -23
  95. package/dist/{chunk-XAKWMCXI.js → chunk-FVMPFCDS.js} +4 -4
  96. package/dist/{chunk-B2WLAWNJ.js → chunk-FY3QIRTL.js} +3 -3
  97. package/dist/{chunk-CPA6HPVR.js → chunk-FYBF5MB2.js} +15 -11
  98. package/dist/{chunk-V2YTAIQO.js → chunk-G5YJBNDZ.js} +21 -6
  99. package/dist/chunk-G6IQYM25.js +339 -0
  100. package/dist/chunk-G6X4YL4D.js +161 -0
  101. package/dist/{chunk-SJRGMG6A.js → chunk-GC2VK3JT.js} +25 -25
  102. package/dist/{chunk-SP2I63OO.js → chunk-GCS3FZOB.js} +77 -3
  103. package/dist/{chunk-6TACQN3N.js → chunk-GDZB57IU.js} +5 -5
  104. package/dist/chunk-GIFMBCTW.js +221 -0
  105. package/dist/{chunk-YY6ZQQBP.js → chunk-GK4PYVEC.js} +18 -8
  106. package/dist/{chunk-TDD55CJH.js → chunk-GNWAOVFQ.js} +6 -5
  107. package/dist/chunk-GS76RXQE.js +226 -0
  108. package/dist/{chunk-YYQN46FY.js → chunk-GSGIZ2OO.js} +23 -23
  109. package/dist/chunk-GUYL7RMK.js +60 -0
  110. package/dist/chunk-GX74YWR7.js +321 -0
  111. package/dist/chunk-HE3HRDNZ.js +122 -0
  112. package/dist/{chunk-AIOQPLA5.js → chunk-HGHRSF3E.js} +30 -12
  113. package/dist/{chunk-2RMYG36Q.js → chunk-HK3VOHIE.js} +198 -336
  114. package/dist/{chunk-QZSX3F7C.js → chunk-HS4BGB4G.js} +24 -22
  115. package/dist/{chunk-XY3P7JW7.js → chunk-HSZMPH5T.js} +834 -149
  116. package/dist/{chunk-L6SGQIR3.js → chunk-HWD4JPU7.js} +4 -2
  117. package/dist/{chunk-PCVDV3UZ.js → chunk-HXXP2NTE.js} +6 -6
  118. package/dist/{chunk-AA6YULYB.js → chunk-I2A3Z5AK.js} +7 -7
  119. package/dist/{chunk-N7IXEHK3.js → chunk-ICHDSWEY.js} +7 -7
  120. package/dist/chunk-IFFRGC3N.js +31 -0
  121. package/dist/{chunk-4BN53TG3.js → chunk-IFHDV6KQ.js} +31 -23
  122. package/dist/chunk-J2O4LFVI.js +80 -0
  123. package/dist/chunk-J5AAZ6OJ.js +161 -0
  124. package/dist/{chunk-ZMFPW66A.js → chunk-JAABT3DA.js} +3 -3
  125. package/dist/chunk-JITJP64K.js +34 -0
  126. package/dist/chunk-JKIGL3XQ.js +162 -0
  127. package/dist/chunk-JRVNXLZP.js +615 -0
  128. package/dist/chunk-JRXHON4E.js +41 -0
  129. package/dist/{chunk-DHPACDG7.js → chunk-JS6WMC3J.js} +8 -8
  130. package/dist/chunk-JU4QNJSR.js +62 -0
  131. package/dist/{chunk-PAMPPUR6.js → chunk-JYMIB5XY.js} +1697 -172
  132. package/dist/{chunk-RRTKKSLQ.js → chunk-JYTIHTIK.js} +8 -6
  133. package/dist/{chunk-3HI6Z55Y.js → chunk-K332XW7K.js} +324 -39
  134. package/dist/{chunk-GLUX4EEP.js → chunk-K6JB6XTX.js} +9 -9
  135. package/dist/chunk-KDAHXQIE.js +294 -0
  136. package/dist/chunk-KYZMRSPS.js +93 -0
  137. package/dist/chunk-L4CESDPB.js +22 -0
  138. package/dist/{chunk-NXFPS2LR.js → chunk-LEBR5NHW.js} +14 -14
  139. package/dist/chunk-LIJJCBQI.js +223 -0
  140. package/dist/{chunk-DE76JROX.js → chunk-LIRVU3HW.js} +16 -16
  141. package/dist/{chunk-JMSCMUCA.js → chunk-LN77DXBM.js} +145 -21
  142. package/dist/{chunk-JIITQXFB.js → chunk-LNWEWYCM.js} +2969 -788
  143. package/dist/{chunk-TANFV3MZ.js → chunk-LO3BLMVG.js} +3 -3
  144. package/dist/chunk-LPV6T362.js +250 -0
  145. package/dist/{chunk-2VHF7OXM.js → chunk-LQH4P45K.js} +1 -1
  146. package/dist/chunk-LU4MQVAL.js +41 -0
  147. package/dist/chunk-LWDNKE4X.js +273 -0
  148. package/dist/chunk-M4H2UG4R.js +218 -0
  149. package/dist/{chunk-6BVONWJ7.js → chunk-M6D2U3YM.js} +3 -3
  150. package/dist/chunk-MD7KUEJ3.js +514 -0
  151. package/dist/{chunk-66YVAGGM.js → chunk-MMZUN7ZO.js} +20 -20
  152. package/dist/chunk-MZGRDONP.js +916 -0
  153. package/dist/chunk-N3RUGTGV.js +39 -0
  154. package/dist/{chunk-JGZCG5VM.js → chunk-NCB6656Z.js} +7 -7
  155. package/dist/{chunk-4NDAAFQT.js → chunk-NRQ65LTQ.js} +7 -5
  156. package/dist/{chunk-UNM6ZOKP.js → chunk-NTAVOWYD.js} +145 -18
  157. package/dist/{chunk-3USYZGRF.js → chunk-NYOABJNK.js} +36 -27
  158. package/dist/{chunk-WVPJSRRJ.js → chunk-O4IKAIZ2.js} +24 -20
  159. package/dist/{chunk-D3PO4DOZ.js → chunk-ODMBPDDV.js} +51 -14
  160. package/dist/chunk-OKUB6RJA.js +533 -0
  161. package/dist/chunk-OMPENNWY.js +39 -0
  162. package/dist/chunk-OPQZISG3.js +25 -0
  163. package/dist/{chunk-5GGOLAKC.js → chunk-OV57AHCG.js} +26 -26
  164. package/dist/chunk-OZJ3JLYI.js +58 -0
  165. package/dist/{chunk-KEM4SDDP.js → chunk-P2VBXX7N.js} +11 -10
  166. package/dist/{chunk-S2A7YC3Q.js → chunk-PAINMSID.js} +10150 -1720
  167. package/dist/chunk-PKJAV25S.js +43 -0
  168. package/dist/{chunk-EBEW3XXQ.js → chunk-PNQLCRSS.js} +4 -4
  169. package/dist/{chunk-WY6PP6AA.js → chunk-PQH56YF6.js} +37 -5
  170. package/dist/chunk-PRTBPXYA.js +50 -0
  171. package/dist/{chunk-YEDDOYSC.js → chunk-PRW3HXM3.js} +2 -2
  172. package/dist/chunk-PRZ7KMWL.js +42 -0
  173. package/dist/{chunk-6M5NK3K3.js → chunk-PTQ3ZALZ.js} +42 -4
  174. package/dist/{chunk-5GDRCDQB.js → chunk-PUEWDYGP.js} +2 -2
  175. package/dist/chunk-Q26LDIUV.js +236 -0
  176. package/dist/{chunk-CR3MTH32.js → chunk-Q46QDDMF.js} +77 -7
  177. package/dist/chunk-QBNWF5ZU.js +19 -0
  178. package/dist/chunk-QE527XRY.js +342 -0
  179. package/dist/{chunk-CNUKCS2T.js → chunk-QHJJMZLX.js} +1518 -54
  180. package/dist/chunk-QJCJOMW3.js +425 -0
  181. package/dist/{chunk-VYDBJ73M.js → chunk-QKMRFNMA.js} +15 -15
  182. package/dist/chunk-QOOEYDNJ.js +317 -0
  183. package/dist/chunk-QSIDVFB7.js +45 -0
  184. package/dist/{chunk-R77KLRB3.js → chunk-RA33EYS4.js} +19 -18
  185. package/dist/{chunk-DFBCSHVT.js → chunk-RALY3E5U.js} +4 -4
  186. package/dist/{chunk-ZCJDOK2S.js → chunk-S2RY3BOD.js} +35 -21
  187. package/dist/chunk-S5LSDXV4.js +40 -0
  188. package/dist/chunk-SB5GRUFM.js +54 -0
  189. package/dist/chunk-SH27FYPF.js +150 -0
  190. package/dist/chunk-T74WQQGS.js +40 -0
  191. package/dist/{chunk-O3WI5KWW.js → chunk-TGVVUKTG.js} +2 -2
  192. package/dist/chunk-THN26IEF.js +48 -0
  193. package/dist/chunk-TJH2EUAZ.js +47 -0
  194. package/dist/{chunk-ZNCEKR4J.js → chunk-TQ4TG57V.js} +12 -8
  195. package/dist/{chunk-7FBGJFEE.js → chunk-TQTRWENN.js} +12 -12
  196. package/dist/{chunk-TYAID7B7.js → chunk-TSM6T6GQ.js} +23 -23
  197. package/dist/{chunk-DPZHZQKE.js → chunk-TW3KOSQK.js} +43 -10
  198. package/dist/{chunk-MC3H7736.js → chunk-TWQRPM76.js} +37 -4
  199. package/dist/chunk-TYD6I4CZ.js +109 -0
  200. package/dist/chunk-U3NBK4EU.js +420 -0
  201. package/dist/{chunk-6JCPI55B.js → chunk-UDXWIPCB.js} +47 -7
  202. package/dist/{chunk-MMOSZPWJ.js → chunk-UEVZZZU2.js} +4 -4
  203. package/dist/{chunk-JBTK5OP2.js → chunk-UF4UHCIG.js} +2 -2
  204. package/dist/{chunk-6JUBZBMW.js → chunk-UFE36WJH.js} +4 -4
  205. package/dist/{chunk-ONLS5QA5.js → chunk-URIKUID7.js} +12 -12
  206. package/dist/chunk-UYLBRRFK.js +1106 -0
  207. package/dist/chunk-UZACEG2C.js +515 -0
  208. package/dist/{chunk-7SW2QWLU.js → chunk-VAMHOHUU.js} +12 -12
  209. package/dist/{chunk-RZPYKDWS.js → chunk-VUVGX5L2.js} +1 -1
  210. package/dist/{chunk-Q4D5X7QB.js → chunk-VYOCPTUB.js} +44 -24
  211. package/dist/{chunk-CAQZUNOH.js → chunk-WAZEXEJH.js} +567 -3
  212. package/dist/chunk-WCEF7H6L.js +221 -0
  213. package/dist/{chunk-2DIQQJCB.js → chunk-WEOMJHPV.js} +12 -12
  214. package/dist/{chunk-FHH4I4ZV.js → chunk-WFU77T3A.js} +12 -6
  215. package/dist/chunk-WIWTJMMR.js +292 -0
  216. package/dist/{chunk-2BFCZ3RK.js → chunk-WNTIOBOG.js} +18 -18
  217. package/dist/{chunk-7WD63HU2.js → chunk-X2CUXTWU.js} +6 -6
  218. package/dist/chunk-X7EMBM5X.js +34 -0
  219. package/dist/chunk-XEQCQO66.js +33 -0
  220. package/dist/{chunk-F7HYOUFF.js → chunk-XG4WJHLQ.js} +20 -4
  221. package/dist/{chunk-EFHQ3TWP.js → chunk-XOL3GFW2.js} +171 -31
  222. package/dist/{chunk-NE2W3OO7.js → chunk-XQ3YZ4QW.js} +22 -22
  223. package/dist/{chunk-CEXSU4S6.js → chunk-Y6K3CJBU.js} +723 -85
  224. package/dist/{chunk-4RS5KZQD.js → chunk-YAH5IQAL.js} +5 -5
  225. package/dist/{chunk-64EQYWCA.js → chunk-YBOVNMHC.js} +51 -14
  226. package/dist/chunk-YF5DZCPN.js +1212 -0
  227. package/dist/chunk-YIGBJNH4.js +37 -0
  228. package/dist/{chunk-BKVWTZ6A.js → chunk-YJ3TBOTK.js} +25 -25
  229. package/dist/{chunk-Q5AMFEWD.js → chunk-YKTE2RU3.js} +2 -2
  230. package/dist/{chunk-7EKXJZ2Y.js → chunk-YO2PKTXT.js} +296 -37
  231. package/dist/{chunk-6J5OKA4Y.js → chunk-YTTNTQOX.js} +15 -15
  232. package/dist/{chunk-OT2O76OS.js → chunk-YWAKDNMH.js} +183 -33
  233. package/dist/{chunk-R6XF6UR3.js → chunk-YZDZOEV4.js} +4 -4
  234. package/dist/chunk-Z3QFH7YG.js +17 -0
  235. package/dist/{chunk-W5BVQF44.js → chunk-Z6VLC5X4.js} +17 -17
  236. package/dist/{chunk-HLJAXMM4.js → chunk-ZFQMMU5Y.js} +2 -2
  237. package/dist/{chunk-W3BQAZ3Q.js → chunk-ZKYRDV7A.js} +12 -12
  238. package/dist/{chunk-ZMAINWBW.js → chunk-ZLS6PU2O.js} +3 -3
  239. package/dist/{chunk-ZVM6AKKM.js → chunk-ZOSD4FXV.js} +3 -3
  240. package/dist/chunk-ZPDDEVQX.js +47 -0
  241. package/dist/{chunk-TXLH6WHQ.js → chunk-ZQLRCA2V.js} +11 -11
  242. package/dist/{chunk-HITVBIJS.js → chunk-ZX7235KR.js} +128 -54
  243. package/dist/{chunk-GT4I4ZWM.js → chunk-ZZFHLRQW.js} +18 -16
  244. package/dist/files.json +636 -364
  245. package/dist/packages/naysayer/constitution/constitution.yaml +19 -0
  246. package/dist/packages/sdk/npm/index.js +5614 -2343
  247. package/dist/packages/ui/dist/assets/{elk-api-tma0MCuh.js → elk-api-CowTnhEJ.js} +2 -2
  248. package/dist/packages/ui/dist/assets/index-Dw20IRhQ.css +1 -0
  249. package/dist/packages/ui/dist/assets/index-z2wv0d5d.js +47 -0
  250. package/dist/packages/ui/dist/index.html +2 -2
  251. package/package.json +4 -4
  252. package/dist/chunk-2BF2EYJV.js +0 -174
  253. package/dist/chunk-42EVSKME.js +0 -37
  254. package/dist/chunk-4BKGMUIK.js +0 -53
  255. package/dist/chunk-5KLGBXG5.js +0 -48
  256. package/dist/chunk-6BNC6EQ4.js +0 -41
  257. package/dist/chunk-6D2CQ5II.js +0 -41
  258. package/dist/chunk-7AVHLZGD.js +0 -45
  259. package/dist/chunk-D46WUV3T.js +0 -33
  260. package/dist/chunk-E36QOJMD.js +0 -47
  261. package/dist/chunk-FQXYPF7E.js +0 -147
  262. package/dist/chunk-GBRFVT63.js +0 -45
  263. package/dist/chunk-ICY36XCH.js +0 -34
  264. package/dist/chunk-J4K3KVLD.js +0 -131
  265. package/dist/chunk-JZU3H6UQ.js +0 -54
  266. package/dist/chunk-NN2ZQEB4.js +0 -38
  267. package/dist/chunk-PCOCACY3.js +0 -385
  268. package/dist/chunk-RTEYOSJY.js +0 -29
  269. package/dist/chunk-RVH5SUW5.js +0 -69
  270. package/dist/chunk-VN3DP4LQ.js +0 -43
  271. package/dist/chunk-XPTOBS2D.js +0 -48
  272. package/dist/packages/ui/dist/assets/index-B54fm9FQ.js +0 -29
  273. package/dist/packages/ui/dist/assets/index-DD_hufQz.css +0 -1
@@ -0,0 +1,1212 @@
1
+ import { createRequire as __atticusCreateRequire } from "node:module";
2
+ import { fileURLToPath as __atticusFileURLToPath } from "node:url";
3
+ var require = __atticusCreateRequire(import.meta.url);
4
+ var __atticusUrl = (p) => new URL("./" + p, import.meta.url).href;
5
+ var __atticusPath = (p) => __atticusFileURLToPath(__atticusUrl(p));
6
+ import {
7
+ copilotAcpAllowed,
8
+ copilotAcpByDefault,
9
+ readWrites
10
+ } from "./chunk-LIJJCBQI.js";
11
+ import {
12
+ mapCommand,
13
+ mapStateOf
14
+ } from "./chunk-26Z7OGQW.js";
15
+ import {
16
+ factsRepos,
17
+ verifyCommand
18
+ } from "./chunk-LN77DXBM.js";
19
+ import "./chunk-L4CESDPB.js";
20
+ import {
21
+ plannedTopUp,
22
+ recordRulesNow,
23
+ ruleSetsOfFiles
24
+ } from "./chunk-U3NBK4EU.js";
25
+ import "./chunk-455SYIIE.js";
26
+ import {
27
+ estateFreshness
28
+ } from "./chunk-LWDNKE4X.js";
29
+ import {
30
+ onboardingQueue
31
+ } from "./chunk-HE3HRDNZ.js";
32
+ import "./chunk-3J5I7ZOU.js";
33
+ import "./chunk-4FOAYLI4.js";
34
+ import "./chunk-GX74YWR7.js";
35
+ import "./chunk-G6IQYM25.js";
36
+ import "./chunk-LPV6T362.js";
37
+ import {
38
+ rulesLackingAll
39
+ } from "./chunk-GIFMBCTW.js";
40
+ import {
41
+ loadReadPlan,
42
+ partUnaccounted,
43
+ readPlanProgress
44
+ } from "./chunk-MD7KUEJ3.js";
45
+ import {
46
+ checkoutOf,
47
+ conventionsAt,
48
+ excludesOf,
49
+ headOf
50
+ } from "./chunk-Q46QDDMF.js";
51
+ import "./chunk-TGVVUKTG.js";
52
+ import "./chunk-TQ4TG57V.js";
53
+ import {
54
+ isMetarepo,
55
+ notMetarepo
56
+ } from "./chunk-3G4YI4ZU.js";
57
+ import {
58
+ ASSISTANT_FORMATS,
59
+ assistantTier,
60
+ readProbes
61
+ } from "./chunk-3AQ2R5NL.js";
62
+ import "./chunk-VOGCSYOI.js";
63
+ import {
64
+ estateRepos,
65
+ productionRepos
66
+ } from "./chunk-4SLBCEPD.js";
67
+ import "./chunk-64AADMTW.js";
68
+ import {
69
+ dirSource,
70
+ sameCommit,
71
+ sessionTokensFor
72
+ } from "./chunk-JYMIB5XY.js";
73
+ import "./chunk-CPK7QSBG.js";
74
+ import "./chunk-YO2PKTXT.js";
75
+ import "./chunk-TWQRPM76.js";
76
+ import "./chunk-VUVGX5L2.js";
77
+ import "./chunk-API5TOUB.js";
78
+ import "./chunk-XOL3GFW2.js";
79
+ import {
80
+ AcpSetupError,
81
+ AcpSignInError,
82
+ currentPromptLimit
83
+ } from "./chunk-QHJJMZLX.js";
84
+ import "./chunk-7AB6OWTV.js";
85
+ import {
86
+ factsDirOf,
87
+ factsRelOf,
88
+ headFromFiles,
89
+ listQuestions,
90
+ loadOrgPack,
91
+ orgPackDirOf,
92
+ parseFacts,
93
+ require_dist
94
+ } from "./chunk-PAINMSID.js";
95
+ import {
96
+ ensureLocalIgnore,
97
+ writeFileAtomic
98
+ } from "./chunk-ODMBPDDV.js";
99
+ import {
100
+ __toESM
101
+ } from "./chunk-TV45EUGM.js";
102
+
103
+ // packages/cli/dist/map-all.js
104
+ var import_yaml = __toESM(require_dist(), 1);
105
+ import { existsSync } from "node:fs";
106
+ import { readFile, stat } from "node:fs/promises";
107
+ import { join } from "node:path";
108
+ var MAP_ALL_STATE_REL = ".atticus/map-all/state.json";
109
+ var statePath = (root) => join(root, ".atticus", "map-all", "state.json");
110
+ var REMIND_MS = 10 * 6e4;
111
+ var IDLE_MINUTES = 30;
112
+ var POLL_MS = 3e3;
113
+ var RETRIES = 3;
114
+ var plural = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
115
+ var tokensText = (n) => n.toLocaleString("en-US");
116
+ var firstLine = (e) => String(e?.message ?? e).split("\n")[0];
117
+ async function readMapAllState(root) {
118
+ const text = await readFile(statePath(root), "utf8").catch(() => void 0);
119
+ if (!text)
120
+ return void 0;
121
+ try {
122
+ const s = JSON.parse(text);
123
+ return s.schemaVersion === 1 && s.repos && typeof s.repos === "object" ? s : void 0;
124
+ } catch {
125
+ return void 0;
126
+ }
127
+ }
128
+ async function saveState(root, s, now) {
129
+ s.updatedAt = new Date(now).toISOString().replace(/\.\d{3}Z$/, "Z");
130
+ await ensureLocalIgnore(root);
131
+ await writeFileAtomic(statePath(root), `${JSON.stringify(s, null, 2)}
132
+ `);
133
+ }
134
+ function modelModeAllowed(op) {
135
+ const rt = op.runtime;
136
+ return rt.ai !== "off" && rt.modes.allowed.includes("model") && !!rt.adapters.model && rt.adapters.model.type !== "mock";
137
+ }
138
+ async function mapReader(root) {
139
+ const op = await loadOrgPack(orgPackDirOf(root));
140
+ const tier = assistantTier(op.runtime, { probes: (await readProbes(root)).results });
141
+ const name = tier.assistant ? ASSISTANT_FORMATS[tier.assistant].name : "no assistant";
142
+ const paste = tier.tier !== "off" && (tier.assistant === "copilot" || tier.tier !== 1);
143
+ return { name, loop: paste && isMetarepo(root) };
144
+ }
145
+ async function limitFor(root, op, given) {
146
+ const flag = given ?? currentPromptLimit();
147
+ if (flag !== void 0)
148
+ return { limit: flag, from: "flag" };
149
+ const maxInput = op.runtime.adapters.model?.settings.maxInput;
150
+ if (typeof maxInput === "number")
151
+ return { limit: maxInput, from: "runtime.yaml" };
152
+ const tier = assistantTier(op.runtime, { probes: (await readProbes(root)).results });
153
+ if (tier.maxTokensFrom === "probe" && tier.maxTokens !== void 0)
154
+ return { limit: tier.maxTokens, from: "probe" };
155
+ return void 0;
156
+ }
157
+ async function gapsTextAt(root, repo) {
158
+ return readFile(join(factsDirOf(root), `${repo}.gaps.md`), "utf8").catch(() => "");
159
+ }
160
+ var MAX_GAPS_SESSIONS = 40;
161
+ function preparedLine(repo, prompt) {
162
+ return `Read ${prompt} and do exactly what it says. Atticus has prepared it: run no other atticus command (not assistant-files, not map). When the facts are written, run \`atticus verify ${repo}\` by itself, with no pipe or redirection; if you can't run commands here, just stop when the facts are written: Atticus verifies them.`;
163
+ }
164
+ function captured() {
165
+ const lines = [];
166
+ const errs = [];
167
+ return { lines, errs, out: (l) => lines.push(l), err: (l) => errs.push(l) };
168
+ }
169
+ function jsonOf(lines) {
170
+ for (let i = lines.length - 1; i >= 0; i--) {
171
+ const l = lines[i].trimStart();
172
+ if (!l.startsWith("{"))
173
+ continue;
174
+ try {
175
+ return JSON.parse(lines.slice(i).join("\n"));
176
+ } catch {
177
+ try {
178
+ return JSON.parse(l);
179
+ } catch {
180
+ continue;
181
+ }
182
+ }
183
+ }
184
+ return void 0;
185
+ }
186
+ async function commitOf(root, repo, f) {
187
+ if (f?.head)
188
+ return f.head;
189
+ const dir = await checkoutOf(root, repo).catch(() => void 0);
190
+ if (!dir || !existsSync(dir))
191
+ return void 0;
192
+ return await headFromFiles(dir) ?? await headOf(dir);
193
+ }
194
+ async function partsOf(root, repo, commit, limit, git, models, force) {
195
+ const io = captured();
196
+ const code = await mapCommand(root, repo, { estimate: true, json: true, commit, maxTokens: limit, ...models ? { models } : {} }, io, git ? { git } : {});
197
+ const r = code === 0 ? jsonOf(io.lines) : void 0;
198
+ if (!r)
199
+ return io.errs[0] ?? `atticus map ${repo} --estimate didn't plan it`;
200
+ const planned = r.parts.parts;
201
+ const batches = r.batches ?? void 0;
202
+ if (!planned.length)
203
+ return {
204
+ parts: [
205
+ {
206
+ part: 1,
207
+ total: 1,
208
+ paths: [],
209
+ files: r.read?.files ?? r.files,
210
+ tokens: r.read?.tokens ?? r.tokens
211
+ }
212
+ ],
213
+ total: 1,
214
+ tokens: r.read?.tokens ?? r.tokens,
215
+ ...batches !== void 0 ? { batches } : {}
216
+ };
217
+ const states = r.parts.plan?.parts ?? [];
218
+ const parts = planned.map((p, i) => ({ part: i + 1, total: planned.length, ...p })).filter((p) => force ? !force.done.has(p.part) : states.find((s) => s.part === p.part)?.state !== "done");
219
+ return {
220
+ parts,
221
+ total: planned.length,
222
+ tokens: parts.reduce((n, p) => n + p.tokens, 0),
223
+ ...batches !== void 0 ? { batches } : {}
224
+ };
225
+ }
226
+ async function rulesPartsOf(root, repo, commit, limit, o = {}) {
227
+ const dir = await checkoutOf(root, repo).catch(() => void 0);
228
+ if (!dir)
229
+ return "no clone to read: atticus workspace sync clones it";
230
+ const p = await plannedTopUp(root, repo, {
231
+ commit,
232
+ source: dirSource(dir),
233
+ exclude: await excludesOf(root, repo),
234
+ conventions: await conventionsAt(root),
235
+ session: sessionTokensFor(limit),
236
+ ...o.save ? {} : { dryRun: true },
237
+ ...o.models ? { models: o.models } : {}
238
+ });
239
+ if ("error" in p)
240
+ return p.error;
241
+ const sessions = p.topUp?.sessions ?? [];
242
+ const parts = sessions.map((x, i) => ({
243
+ part: i + 1,
244
+ total: sessions.length,
245
+ paths: x.paths,
246
+ files: x.files,
247
+ tokens: x.tokens,
248
+ done: !!x.done
249
+ })).filter((x) => !x.done).map(({ done: _d, ...x }) => x);
250
+ return { parts, total: sessions.length, sets: ruleSetsOfFiles(sessions), given: p.lacking };
251
+ }
252
+ async function planEstate(root, op, o, c, state) {
253
+ const all = estateRepos(op).map((r) => r.id);
254
+ const production = new Set(productionRepos(op).map((r) => r.id));
255
+ if (o.repos) {
256
+ const unknown = o.repos.filter((r) => !all.includes(r));
257
+ if (unknown.length)
258
+ return `No repo ${unknown.join(", ")} in the manifests (org-pack/profiles/*/repos.manifest.yaml).`;
259
+ }
260
+ const ids = o.repos ? all.filter((r) => o.repos.includes(r)) : all;
261
+ const fresh = await estateFreshness(root, { repos: ids, ...c.git ? { git: c.git } : {} });
262
+ const byId = new Map(fresh.repos.map((r) => [r.repo, r]));
263
+ const skipped = [];
264
+ const todo = [];
265
+ for (const repo of ids) {
266
+ const f = byId.get(repo);
267
+ const commit = await commitOf(root, repo, f);
268
+ if (!commit || f?.state === "no-checkout") {
269
+ skipped.push({ repo, why: "no clone to read: atticus workspace sync clones it" });
270
+ continue;
271
+ }
272
+ const state2 = f?.state ?? "not-read";
273
+ if (o.force) {
274
+ todo.push({
275
+ repo,
276
+ kind: "read",
277
+ commit,
278
+ why: state2 === "not-read" ? "--force: read whole" : "--force: read whole again, the facts on file kept as already kept",
279
+ ...state2 === "not-read" ? {} : { started: true },
280
+ force: true
281
+ });
282
+ continue;
283
+ }
284
+ if (o.gaps) {
285
+ if (state2 === "not-read")
286
+ skipped.push({ repo, why: "not read yet: the gaps pass follows a read" });
287
+ else if (state2 === "stale" || state2 === "unknown-commit")
288
+ skipped.push({
289
+ repo,
290
+ why: "its clone moved past its facts: atticus map --all --stale reads what changed first"
291
+ });
292
+ else if (isDone(repo, commit))
293
+ skipped.push({ repo, why: "its gaps pass is done at this commit" });
294
+ else
295
+ todo.push({ repo, kind: "gaps", commit, why: "the second pass on what its read left" });
296
+ continue;
297
+ }
298
+ if (state2 === "stale" || state2 === "unknown-commit") {
299
+ todo.push({
300
+ repo,
301
+ kind: "reread",
302
+ commit,
303
+ why: state2 === "stale" ? `its clone moved past its facts: ${plural(f.reread, "fact")} to read again, ${plural(f.toRead, "file")} to read` : "the clone lacks the commit its facts were read at: read whole again",
304
+ started: true
305
+ });
306
+ continue;
307
+ }
308
+ if (state2 === "rules-changed") {
309
+ const progress = await readPlanProgress(root, repo, { commit });
310
+ todo.push(progress && !progress.stale && progress.next ? {
311
+ repo,
312
+ kind: "read",
313
+ commit,
314
+ why: `its read is under way: ${progress.done} of ${progress.total} parts read`,
315
+ started: true
316
+ } : { repo, kind: "rules", commit, why: "", started: true });
317
+ continue;
318
+ }
319
+ if (state2 === "moved") {
320
+ todo.push({
321
+ repo,
322
+ kind: "carry",
323
+ commit,
324
+ why: "its clone moved, but nothing its facts cite changed: verify carries them",
325
+ started: true
326
+ });
327
+ continue;
328
+ }
329
+ if (o.stale) {
330
+ skipped.push({
331
+ repo,
332
+ why: state2 === "fresh" ? "fresh" : "not read yet (atticus map --all reads it)"
333
+ });
334
+ continue;
335
+ }
336
+ if (state2 === "fresh") {
337
+ const progress = await readPlanProgress(root, repo, { commit });
338
+ if (progress && !progress.stale && progress.next) {
339
+ todo.push({
340
+ repo,
341
+ kind: "read",
342
+ commit,
343
+ why: `its read is under way: ${progress.done} of ${progress.total} parts read`,
344
+ started: true
345
+ });
346
+ } else
347
+ skipped.push({ repo, why: "read and fresh" });
348
+ continue;
349
+ }
350
+ todo.push({ repo, kind: "read", commit, why: "not read yet" });
351
+ }
352
+ const prod = todo.filter((t) => production.has(t.repo));
353
+ const q = await onboardingQueue(root, prod.map((t) => ({ repo: t.repo, ...t.started ? { started: true } : {} })));
354
+ const ordered = [
355
+ ...q.queue.map((x) => prod.find((t) => t.repo === x.repo)),
356
+ ...todo.filter((t) => !production.has(t.repo))
357
+ ];
358
+ const items = [];
359
+ for (const t of ordered) {
360
+ const base = {
361
+ repo: t.repo,
362
+ kind: t.kind,
363
+ commit: t.commit,
364
+ why: t.why,
365
+ ...production.has(t.repo) ? {} : { prototype: true },
366
+ ...t.force ? { force: true } : {}
367
+ };
368
+ if (t.kind === "carry") {
369
+ items.push({ ...base, parts: [], total: 0, tokens: 0 });
370
+ continue;
371
+ }
372
+ if (t.kind === "rules") {
373
+ const p2 = await rulesPartsOf(root, t.repo, t.commit, c.limit, {
374
+ ...o.models ? { models: o.models } : {}
375
+ });
376
+ if (typeof p2 === "string") {
377
+ skipped.push({ repo: t.repo, why: p2 });
378
+ continue;
379
+ }
380
+ items.push({
381
+ ...base,
382
+ why: p2.sets.length ? `read before these reading rules: ${p2.sets.join(", ")}` : "read before the reading rules there are now, but no file of it is one they apply to: recorded as read under them",
383
+ sets: p2.sets,
384
+ given: p2.given,
385
+ parts: p2.parts,
386
+ total: p2.total,
387
+ tokens: p2.parts.reduce((n, x) => n + x.tokens, 0)
388
+ });
389
+ continue;
390
+ }
391
+ if (t.kind === "gaps") {
392
+ items.push({
393
+ ...base,
394
+ parts: [{ part: 1, total: 1, paths: [], files: 0, tokens: 0 }],
395
+ total: 1,
396
+ tokens: 0
397
+ });
398
+ continue;
399
+ }
400
+ const p = await partsOf(root, t.repo, t.commit, c.limit, c.git, o.models, t.force ? { done: forcedDone(t.repo, t.commit) } : void 0);
401
+ if (typeof p === "string") {
402
+ skipped.push({ repo: t.repo, why: p });
403
+ continue;
404
+ }
405
+ if (c.mode === "model" && p.batches === void 0) {
406
+ skipped.push({
407
+ repo: t.repo,
408
+ why: `a model of ${c.limit} tokens leaves too little room for its files beside the instructions`
409
+ });
410
+ continue;
411
+ }
412
+ if (!p.parts.length) {
413
+ skipped.push({ repo: t.repo, why: "every part of its read plan is read" });
414
+ continue;
415
+ }
416
+ items.push({ ...base, ...p });
417
+ }
418
+ return { limit: c.limit, limitFrom: c.limitFrom, mode: c.mode, items, skipped };
419
+ function forcedDone(repo, commit) {
420
+ const r = state?.repos[repo];
421
+ if (!r?.force || !sameCommit(r.commit, commit))
422
+ return /* @__PURE__ */ new Set();
423
+ return new Set(Object.entries(r.parts).filter(([, p]) => p.state === "done").map(([n]) => Number(n)));
424
+ }
425
+ function isDone(repo, commit) {
426
+ const r = state?.repos[repo];
427
+ return !!r?.done && r.kind === "gaps" && sameCommit(r.commit, commit);
428
+ }
429
+ }
430
+ function planLines(plan) {
431
+ const out = [];
432
+ const reading = plan.items.filter((i) => i.kind !== "carry");
433
+ const parts = reading.reduce((n, i) => n + i.parts.length, 0);
434
+ const planned = reading.reduce((n, i) => n + Math.max(i.total, i.parts.length), 0);
435
+ const tokens = reading.reduce((n, i) => n + i.tokens, 0);
436
+ out.push(`The estate at ${tokensText(plan.limit)} tokens a prompt (${plan.limitFrom === "flag" ? "--max-tokens" : plan.limitFrom === "probe" ? "the limit atticus probe measured" : "runtime.yaml's maxInput"}), ${plan.mode === "model" ? "read by runtime.yaml's model, unattended" : plan.mode === "copilot-acp" ? "read by GitHub Copilot through its Agent Client Protocol, unattended: one new session per part" : "read by Copilot Chat in agent mode: you paste one line per part"}:`);
437
+ plan.items.forEach((i, n) => {
438
+ const head = ` ${n + 1}. ${i.repo}${i.prototype ? " (prototype: read, never joined)" : ""}`;
439
+ if (i.kind === "carry" || i.kind === "rules" && !i.parts.length)
440
+ return out.push(`${head}: ${i.why}.`);
441
+ if (i.kind === "rules")
442
+ out.push(`${head}: top-up for the reading rules added since it was read (${(i.sets ?? []).join(", ")}); ${plural(i.parts.length, "part")}${i.parts.length < i.total ? ` of ${i.total}` : ""}, about ${tokensText(i.tokens)} tokens.`);
443
+ if (i.kind === "rules") {
444
+ if (i.total > 1)
445
+ for (const p of i.parts)
446
+ out.push(` part ${p.part} of ${p.total} (about ${tokensText(p.tokens)} tokens, ${plural(p.files, "file")}): ${p.paths.join(", ")}`);
447
+ return;
448
+ }
449
+ if (i.kind === "gaps")
450
+ return out.push(`${head}: ${i.why}, planned when it starts.`);
451
+ out.push(`${head}: ${i.kind === "reread" ? "re-read" : "read"}, ${i.why}; ${plural(i.parts.length, "part")}${i.parts.length < i.total ? ` of ${i.total}` : ""}, about ${tokensText(i.tokens)} tokens${plan.mode === "model" && i.batches !== void 0 ? `, ${plural(i.batches, "prompt")}` : ""}.`);
452
+ if (i.total > 1)
453
+ for (const p of i.parts)
454
+ out.push(` part ${p.part} of ${p.total} (about ${tokensText(p.tokens)} tokens, ${plural(p.files, "file")}): ${p.paths.join(", ")}`);
455
+ });
456
+ for (const s of plan.skipped)
457
+ out.push(` - ${s.repo}: skipped, ${s.why}.`);
458
+ out.push(plan.items.length ? `In all: ${plural(plan.items.length, "repo")}, ${plural(parts, "part")} to read${planned > parts ? ` (of ${planned} planned; ${planned - parts} ${planned - parts === 1 ? "is" : "are"} read already)` : ""}, about ${tokensText(tokens)} tokens (estimated from the source, not metered). Then atticus verify --all --write joins the estate once.` : "Nothing to read: every repo is read and fresh, or skipped as said.");
459
+ return out;
460
+ }
461
+ var mtime = async (p) => (await stat(p).catch(() => void 0))?.mtimeMs;
462
+ async function snapOf(root, repo) {
463
+ const dir = factsDirOf(root);
464
+ const [facts, reviewed, verify] = await Promise.all([
465
+ mtime(join(dir, `${repo}.jsonl`)),
466
+ mtime(join(dir, `${repo}.reviewed.jsonl`)),
467
+ mtime(join(dir, `${repo}.verify.yaml`))
468
+ ]);
469
+ return {
470
+ ...facts !== void 0 ? { facts } : {},
471
+ ...reviewed !== void 0 ? { reviewed } : {},
472
+ ...verify !== void 0 ? { verify } : {}
473
+ };
474
+ }
475
+ var sameSnap = (a, b) => a.facts === b.facts && a.reviewed === b.reviewed && a.verify === b.verify;
476
+ async function writtenOf(root, repo) {
477
+ const dir = factsDirOf(root);
478
+ const facts = await readFile(join(dir, `${repo}.jsonl`), "utf8").catch(() => "");
479
+ const p = facts.trim() ? parseFacts(facts) : void 0;
480
+ const ids = (p?.ok ? p.facts : []).map((f) => {
481
+ const c = f.cite;
482
+ return `${f.id}|${c?.file ?? ""}:${c?.line ?? ""}`;
483
+ });
484
+ const reviewed = (await readFile(join(dir, `${repo}.reviewed.jsonl`), "utf8").catch(() => "")).split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
485
+ return JSON.stringify([[...new Set(ids)].sort(), reviewed]);
486
+ }
487
+ async function factsAt(root, repo, commit) {
488
+ const text = await readFile(join(factsDirOf(root), `${repo}.jsonl`), "utf8").catch(() => "");
489
+ if (!text.trim())
490
+ return 0;
491
+ const p = parseFacts(text);
492
+ return p.ok ? p.facts.filter((f) => sameCommit(f.commit, commit)).length : 0;
493
+ }
494
+ async function settled(root, repo, commit, s, since) {
495
+ if (s.verify === void 0 || s.verify === since.verify)
496
+ return false;
497
+ if (s.verify < (s.facts ?? 0) || s.verify < (s.reviewed ?? 0))
498
+ return false;
499
+ const text = await readFile(join(factsDirOf(root), `${repo}.verify.yaml`), "utf8").catch(() => "");
500
+ try {
501
+ const v = (0, import_yaml.parse)(text) ?? {};
502
+ return v.rejected === 0 && (!v.commit || sameCommit(v.commit, commit));
503
+ } catch {
504
+ return false;
505
+ }
506
+ }
507
+ async function covered(root, item, part, first, now, unknown, wrote) {
508
+ const moved = now.facts !== first.facts || now.reviewed !== first.reviewed;
509
+ if (item.force) {
510
+ if (!(wrote ?? moved))
511
+ return false;
512
+ return item.total <= 1 || !!unknown && !leftOf(part, unknown).length;
513
+ }
514
+ if (item.kind === "rules") {
515
+ const plan = await loadReadPlan(root, item.repo);
516
+ if (!plan?.topUp)
517
+ return (await rulesLackingAll(root, item.repo, plan?.rules)).length === 0;
518
+ return !!plan.topUp.sessions[part.part - 1]?.done;
519
+ }
520
+ if (item.total > 1) {
521
+ const p = await readPlanProgress(root, item.repo);
522
+ const s = p?.parts.find((x) => x.part === part.part);
523
+ if (s?.state === "done")
524
+ return true;
525
+ return !!s && !!unknown && !partUnaccounted(s, unknown).length;
526
+ }
527
+ if (item.kind === "read")
528
+ return moved || now.reviewed !== void 0 || await factsAt(root, item.repo, item.commit) > 0;
529
+ return moved;
530
+ }
531
+ var leftOf = (part, unknown) => partUnaccounted({ paths: part.paths, left: [] }, unknown);
532
+ function unaccountedWords(left, shown = 5) {
533
+ return left.map((u) => {
534
+ if (!u.files.length)
535
+ return `${u.glob} (no fact cites a line of it yet)`;
536
+ const dir = u.glob.replace(/\/?\*\*?$/, "");
537
+ const rel = u.files.map((f) => u.glob.includes("*") && dir && f.startsWith(`${dir}/`) ? f.slice(dir.length + 1) : f);
538
+ const more = rel.length > shown ? `, and ${rel.length - shown} more` : "";
539
+ return `${u.glob} (${plural(u.files.length, "file")}: ${rel.slice(0, shown).join(", ")}${more})`;
540
+ }).join("; ");
541
+ }
542
+ var CapReached = class extends Error {
543
+ };
544
+ function capped(inner, o, spent) {
545
+ const over = () => o.maxParts !== void 0 && spent.prompts >= o.maxParts || o.budgetTokens !== void 0 && spent.tokens >= o.budgetTokens;
546
+ const estimated = /* @__PURE__ */ new Map();
547
+ return {
548
+ kind: inner.kind,
549
+ prepare: async (r) => {
550
+ if (over())
551
+ throw new CapReached();
552
+ spent.prompts++;
553
+ const run = await inner.prepare(r);
554
+ const est = r.pack.manifest.totalTokens;
555
+ estimated.set(run.runId, est);
556
+ spent.tokens += est;
557
+ return run;
558
+ },
559
+ run: async (id, signal) => {
560
+ const run = await inner.run(id, signal);
561
+ const u = run.usage;
562
+ if (u)
563
+ spent.tokens += u.inputTokens + u.outputTokens - (estimated.get(id) ?? 0);
564
+ estimated.delete(id);
565
+ return run;
566
+ },
567
+ result: (id) => inner.result(id)
568
+ };
569
+ }
570
+ async function mapAllCommand(root, o, io, deps = {}) {
571
+ if (!isMetarepo(root)) {
572
+ io.err(notMetarepo(root));
573
+ return 2;
574
+ }
575
+ const clock = deps.clock ?? {
576
+ now: () => Date.now(),
577
+ sleep: (ms) => new Promise((r) => setTimeout(r, ms))
578
+ };
579
+ const op = await loadOrgPack(orgPackDirOf(root));
580
+ const lim = await limitFor(root, op, o.maxTokens);
581
+ if (!lim) {
582
+ io.err("Atticus doesn't know your model's limit, and a part planned too big overflows the reader: pass --max-tokens <n> (the context window of the model Copilot Chat uses, in tokens), or set maxInput under adapters.model in runtime.yaml.");
583
+ return 2;
584
+ }
585
+ const limit = lim.limit;
586
+ const allowed = modelModeAllowed(op);
587
+ const mode = o.mode ?? (copilotAcpByDefault(op) ? "copilot-acp" : allowed ? "model" : "copilot");
588
+ if (mode === "copilot-acp" && !copilotAcpAllowed(op) && !deps.acp) {
589
+ io.err("runtime.yaml doesn't allow copilot-acp here (schemaVersion 3, copilot-acp in modes.allowed and copilot in assistants.allowed): map the estate through Copilot Chat (atticus map --all without --mode copilot-acp), or ask for it in a pull request (ADR 0171).");
590
+ return 2;
591
+ }
592
+ const stateMode = mode === "model" ? "model" : "copilot";
593
+ if (mode === "model" && !allowed && !deps.runtime) {
594
+ io.err("runtime.yaml doesn't allow model mode with a provider here: map the estate through Copilot (atticus map --all without --mode model).");
595
+ return 2;
596
+ }
597
+ if (o.force && (o.gaps || o.stale)) {
598
+ io.err("--force reads the repos whole again; it doesn't go with --stale or --gaps.");
599
+ return 2;
600
+ }
601
+ if (mode === "model" && o.gaps) {
602
+ io.err("The gaps pass is a session for an assistant that opens files: run atticus map --all --gaps --mode hand-off and paste each line into Copilot Chat.");
603
+ return 2;
604
+ }
605
+ let state = await readMapAllState(root);
606
+ if (state && (state.gaps !== !!o.gaps || state.mode !== stateMode))
607
+ state = void 0;
608
+ const plan = await planEstate(root, op, o, { limit: lim.limit, limitFrom: lim.from, mode, ...deps.git ? { git: deps.git } : {} }, state);
609
+ if (typeof plan === "string") {
610
+ io.err(plan);
611
+ return 2;
612
+ }
613
+ if (o.dryRun) {
614
+ if (o.json)
615
+ io.out(JSON.stringify(plan, null, 2));
616
+ else
617
+ for (const l of planLines(plan))
618
+ io.out(l);
619
+ return 0;
620
+ }
621
+ for (const l of planLines(plan))
622
+ io.out(l);
623
+ const emit = (e) => {
624
+ try {
625
+ deps.onEvent?.(e);
626
+ } catch {
627
+ }
628
+ };
629
+ emit({
630
+ type: "plan",
631
+ repos: plan.items.map((i) => ({ repo: i.repo, kind: i.kind, parts: i.parts.length }))
632
+ });
633
+ const st = state ?? {
634
+ schemaVersion: 1,
635
+ updatedAt: "",
636
+ mode: stateMode,
637
+ gaps: !!o.gaps,
638
+ repos: {}
639
+ };
640
+ const save = () => saveState(root, st, clock.now());
641
+ await save();
642
+ const totals = {
643
+ parts: 0,
644
+ repos: /* @__PURE__ */ new Set(),
645
+ rejected: /* @__PURE__ */ new Map(),
646
+ added: 0,
647
+ removed: 0,
648
+ ends: [],
649
+ spent: { prompts: 0, tokens: 0 }
650
+ };
651
+ const stopped = () => deps.signal?.aborted === true;
652
+ const repoState = (item) => {
653
+ const r = st.repos[item.repo];
654
+ if (r && sameCommit(r.commit, item.commit) && r.kind === item.kind && !!r.force === !!item.force)
655
+ return r;
656
+ return st.repos[item.repo] = {
657
+ commit: item.commit,
658
+ kind: item.kind,
659
+ parts: {},
660
+ ...item.force ? { force: true } : {}
661
+ };
662
+ };
663
+ const resumeAs = o.resumeAs ?? `atticus map --all${o.repos ? ` --repos ${o.repos.join(",")}` : ""}${o.stale ? " --stale" : ""}${o.gaps ? " --gaps" : ""}${o.force ? " --force" : ""}${o.models ? ` --models ${o.models}` : ""}${lim.from === "flag" ? ` --max-tokens ${limit}` : ""}${o.idleMinutes ? ` --idle ${o.idleMinutes}` : ""}`;
664
+ let idleStop = false;
665
+ const partState = (item, part) => repoState(item).parts[String(part)] ??= { retries: 0 };
666
+ const verifyStep = async (item) => {
667
+ const c = captured();
668
+ try {
669
+ await verifyCommand(root, item.repo, { commit: item.commit, write: true, json: true }, c);
670
+ } catch (e) {
671
+ io.out(`${item.repo}: verify stopped: ${firstLine(e)}. Moving on; ${resumeAs} tries it again.`);
672
+ return void 0;
673
+ }
674
+ const v = jsonOf(c.lines);
675
+ if (!v) {
676
+ io.out(`${item.repo}: verify didn't run: ${c.errs[0] ?? "no report"}`);
677
+ return void 0;
678
+ }
679
+ const links = v.written?.links;
680
+ totals.rejected.set(item.repo, v.rejected);
681
+ if (links) {
682
+ totals.added += links.added.length;
683
+ totals.removed += links.removed.length;
684
+ }
685
+ emit({
686
+ type: "verify",
687
+ repo: item.repo,
688
+ kept: v.accepted,
689
+ rejected: v.rejected,
690
+ coverage: v.coverage.ratio,
691
+ open: v.questions?.open ?? 0
692
+ });
693
+ io.out(`${item.repo}: ${plural(v.accepted, "fact")} kept, ${v.rejected} rejected; coverage ${Math.round(v.coverage.ratio * 100)}% (${v.coverage.unknown.length} files no fact cites yet)${links ? `; links +${links.added.length} -${links.removed.length}` : ""}; ${plural(v.questions?.open ?? 0, "question")} open. ${v.rejected ? `Nothing written to the catalog until the rejected facts are fixed (${factsRelOf(root)}/${item.repo}.rejected.jsonl).` : v.written ? "Written to the catalog." : ""}`.trimEnd());
694
+ return v;
695
+ };
696
+ let quit = false;
697
+ let capHit = false;
698
+ let signIn = false;
699
+ let runtime;
700
+ const items = plan.items;
701
+ for (const [n, item] of items.entries()) {
702
+ if (quit || stopped())
703
+ break;
704
+ const where = `repo ${n + 1} of ${items.length}`;
705
+ emit({ type: "repo", repo: item.repo, index: n + 1, total: items.length, why: item.why });
706
+ if (item.kind === "rules" && !item.parts.length) {
707
+ io.out("");
708
+ io.out(`===== ${item.repo} (${where}): ${item.why} =====`);
709
+ await recordRulesNow(root, item.repo, item.commit, item.given ?? []);
710
+ repoState(item).done = true;
711
+ totals.repos.add(item.repo);
712
+ await save();
713
+ continue;
714
+ }
715
+ if (item.kind === "carry") {
716
+ io.out("");
717
+ io.out(`===== ${item.repo} (${where}): ${item.why} =====`);
718
+ const v = await verifyStep(item);
719
+ if (v && !v.rejected) {
720
+ repoState(item).done = true;
721
+ totals.repos.add(item.repo);
722
+ }
723
+ await save();
724
+ continue;
725
+ }
726
+ if (mode === "model") {
727
+ runtime ??= deps.runtime ?? await deps.makeRuntime?.();
728
+ if (!runtime) {
729
+ io.err("No model runtime: model mode needs runtime.yaml's provider.");
730
+ return 2;
731
+ }
732
+ const r = await modelRead(item, where, capped(runtime, o, totals.spent));
733
+ if (r === "cap") {
734
+ capHit = true;
735
+ break;
736
+ }
737
+ continue;
738
+ }
739
+ if (mode === "copilot-acp") {
740
+ for (const part of item.parts) {
741
+ if (quit || stopped() || capHit)
742
+ break;
743
+ const end = await acpPart(item, part, where);
744
+ if (end === "quit")
745
+ quit = true;
746
+ if (end === "cap")
747
+ capHit = true;
748
+ }
749
+ continue;
750
+ }
751
+ for (const part of item.parts) {
752
+ if (quit || stopped())
753
+ break;
754
+ const end = await copilotPart(item, part, where);
755
+ if (end === "quit") {
756
+ quit = true;
757
+ break;
758
+ }
759
+ }
760
+ }
761
+ const interrupted = quit || stopped() || capHit;
762
+ if (interrupted) {
763
+ if (!idleStop) {
764
+ io.out("");
765
+ io.out(capHit ? `Stopped at the cap (${o.maxParts !== void 0 ? `--max-parts ${o.maxParts}` : ""}${o.maxParts !== void 0 && o.budgetTokens !== void 0 ? ", " : ""}${o.budgetTokens !== void 0 ? `--budget-tokens ${o.budgetTokens}` : ""}): ${plural(totals.spent.prompts, mode === "copilot-acp" ? "session" : "prompt")} run. atticus map --all carries on from here.` : "Stopped. Where the estate stands is saved: atticus map --all carries on from here.");
766
+ }
767
+ } else if (totals.parts || totals.repos.size) {
768
+ io.out("");
769
+ io.out("Joining the estate: atticus verify --all --write.");
770
+ const repos = await factsRepos(root);
771
+ let passed = 0;
772
+ for (const repo of repos) {
773
+ const c = captured();
774
+ const code = await verifyCommand(root, repo, { write: true, json: true }, c);
775
+ const v = jsonOf(c.lines);
776
+ if (code === 0)
777
+ passed++;
778
+ if (v?.written?.links) {
779
+ totals.added += v.written.links.added.length;
780
+ totals.removed += v.written.links.removed.length;
781
+ }
782
+ if (v)
783
+ totals.rejected.set(repo, v.rejected);
784
+ }
785
+ io.out(`Verified ${plural(repos.length, "repo")}: ${passed} passed${repos.length - passed ? `, ${repos.length - passed} with something to fix` : ""}.`);
786
+ }
787
+ await save();
788
+ await summary(interrupted);
789
+ return signIn ? 1 : 0;
790
+ async function copilotPart(item, part, where) {
791
+ const ps = partState(item, part.part);
792
+ const nth = item.parts.indexOf(part) + 1;
793
+ const label = item.total > 1 ? `part ${part.part} of ${item.total}${item.parts.length < item.total && nth > 0 ? `, ${nth} of the ${item.parts.length} to read` : ""}` : "one session";
794
+ const named = item.total > 1 ? `part ${part.part} of ${item.total}` : "one session";
795
+ const progress = item.total > 1 ? await readPlanProgress(root, item.repo) : void 0;
796
+ const first0 = item.kind === "rules" ? await rulesLine(item) : item.kind === "gaps" ? await gapsLine(item) : item.force ? forceLine(item, part) : ps.retries > 0 || progress?.next && progress.next.part !== part.part ? await restLine(item, part) ?? `/atticus-map ${item.repo}${item.total > 1 ? ` --part ${part.part}` : ""}` : `/atticus-map ${item.repo}`;
797
+ if (first0 === void 0) {
798
+ io.out(`${item.repo}: no gaps left; nothing to read.`);
799
+ return finishPart(item, part, ps);
800
+ }
801
+ if (first0 === "done")
802
+ return finishPart(item, part, ps);
803
+ let line = first0;
804
+ await block(item, part, label, where, line, ps.retries);
805
+ let base = item.force ? await writtenOf(root, item.repo) : "";
806
+ let first = await snapOf(root, item.repo);
807
+ let since = first;
808
+ let prev = first;
809
+ let lastChange = clock.now();
810
+ let lastRemind = clock.now();
811
+ const started = clock.now();
812
+ const idleMinutes = o.idleMinutes ?? IDLE_MINUTES;
813
+ for (; ; ) {
814
+ if (stopped()) {
815
+ ps.state = "incomplete";
816
+ await save();
817
+ return "quit";
818
+ }
819
+ const typed = deps.input?.take()?.trim().toLowerCase();
820
+ if (typed === "q") {
821
+ ps.state = "incomplete";
822
+ await save();
823
+ return "quit";
824
+ }
825
+ if (typed === "s") {
826
+ io.out(`Skipped ${item.repo} ${label}.`);
827
+ ps.state = "skipped";
828
+ await save();
829
+ totals.ends.push(endOf(item, part, "skipped"));
830
+ return "skipped";
831
+ }
832
+ if (typed === "r") {
833
+ const again = await retry(item, part, label, where);
834
+ if (again === "done")
835
+ return finishPart(item, part, ps);
836
+ if (item.force)
837
+ base = await writtenOf(root, item.repo);
838
+ first = await snapOf(root, item.repo);
839
+ since = first;
840
+ prev = first;
841
+ lastChange = clock.now();
842
+ continue;
843
+ }
844
+ const now = await snapOf(root, item.repo);
845
+ if (!sameSnap(now, prev)) {
846
+ lastChange = clock.now();
847
+ prev = now;
848
+ }
849
+ if (await settled(root, item.repo, item.commit, now, since)) {
850
+ const wrote = item.force ? await writtenOf(root, item.repo) !== base : void 0;
851
+ const v = await verifyStep(item);
852
+ const after = await snapOf(root, item.repo);
853
+ if (v && !v.rejected && await covered(root, item, part, first, after, v.coverage.unknown, wrote)) {
854
+ const was = item.kind === "gaps" ? await gapsTextAt(root, item.repo) : void 0;
855
+ if (item.kind === "gaps" && await gapsLine(item) !== void 0 && await gapsTextAt(root, item.repo) !== was) {
856
+ io.out(`${item.repo}: that gaps session is verified; more gaps are left, for a NEW chat.`);
857
+ const again = await retry(item, part, label, where);
858
+ if (again === "done")
859
+ return finishPart(item, part, ps);
860
+ first = await snapOf(root, item.repo);
861
+ since = first;
862
+ prev = first;
863
+ lastChange = clock.now();
864
+ continue;
865
+ }
866
+ return finishPart(item, part, ps);
867
+ }
868
+ if (v?.rejected)
869
+ io.out(`Not done yet: ${plural(v.rejected, "fact")} rejected for the reader to fix. Still waiting (s + Enter skips, r + Enter gives the prompt again for what's left).`);
870
+ else if (v && item.total > 1 && item.kind !== "rules") {
871
+ const left = await leftNow(item, part, v.coverage.unknown);
872
+ io.out(left.length ? `Still not covered in ${item.repo} ${named}: ${unaccountedWords(left)}. ${item.force ? `r + Enter gives the line again (${line}); ` : `r + Enter gives a NEW chat only what is left of the part: these files, and any line verify lists as skipped under it (/atticus-map ${item.repo} --part ${part.part} --gaps); `}s + Enter skips the part; q + Enter stops.` : `Not done yet: nothing was written for ${item.repo} ${named} since its line was given. r + Enter gives the line again; s + Enter skips the part; q + Enter stops.`);
873
+ } else
874
+ io.out("Not done yet: the part isn't accounted for in the facts yet. Still waiting (s + Enter skips, r + Enter gives the prompt again for what's left).");
875
+ since = after;
876
+ prev = after;
877
+ lastRemind = clock.now();
878
+ }
879
+ if (clock.now() - lastChange >= idleMinutes * 6e4) {
880
+ io.out(`Stopped waiting on ${item.repo} ${label}: nothing was written for ${plural(idleMinutes, "minute")} (--idle ${idleMinutes}). Where the estate stands is saved: ${resumeAs} carries on from here (it verifies what was written and gives the line again for what's left).`);
881
+ ps.state = "incomplete";
882
+ idleStop = true;
883
+ await save();
884
+ return "quit";
885
+ }
886
+ if (clock.now() - lastRemind >= (deps.remindMs ?? REMIND_MS)) {
887
+ io.out(`Still waiting on ${item.repo} ${label} (${Math.round((clock.now() - started) / 6e4)} minutes). The line to paste: ${line} (s + Enter skips, r + Enter retries what's left, q + Enter stops)`);
888
+ lastRemind = clock.now();
889
+ }
890
+ await clock.sleep(deps.pollMs ?? POLL_MS);
891
+ }
892
+ async function retry(item2, part2, label2, where2) {
893
+ ps.retries++;
894
+ await save();
895
+ if (item2.force) {
896
+ const wrote = await writtenOf(root, item2.repo) !== base;
897
+ const v = existsSync(join(factsDirOf(root), `${item2.repo}.jsonl`)) ? await verifyStep(item2) : void 0;
898
+ if (v && !v.rejected && await covered(root, item2, part2, first, await snapOf(root, item2.repo), v.coverage.unknown, wrote))
899
+ return "done";
900
+ }
901
+ const rest = item2.kind === "rules" ? await rulesLine(item2) : item2.kind === "gaps" ? await gapsLine(item2) : item2.force ? forceLine(item2, part2) : await restLine(item2, part2);
902
+ if (rest === "done" || rest === void 0 && item2.kind === "gaps")
903
+ return "done";
904
+ line = rest ?? `/atticus-map ${item2.repo}`;
905
+ await block(item2, part2, label2, where2, line, ps.retries);
906
+ if (ps.retries >= RETRIES) {
907
+ const smaller = Math.max(8e3, Math.floor(limit / 2 / 1e3) * 1e3);
908
+ io.out(`${item2.repo} ${label2} has been given again ${plural(ps.retries, "time")}: a smaller limit plans it in smaller parts, each a shorter chat. Stop (q), then atticus map --all --repos ${item2.repo} --max-tokens ${smaller}.`);
909
+ }
910
+ return "again";
911
+ }
912
+ }
913
+ async function leftNow(item, part, unknown) {
914
+ if (item.force)
915
+ return leftOf(part, unknown);
916
+ const s = (await readPlanProgress(root, item.repo))?.parts.find((x) => x.part === part.part);
917
+ return s ? partUnaccounted(s, unknown) : leftOf(part, unknown);
918
+ }
919
+ function forceLine(item, part) {
920
+ return `/atticus-map ${item.repo}${item.total > 1 ? ` --part ${part.part}` : ""}`;
921
+ }
922
+ async function finishPart(item, part, ps) {
923
+ ps.state = "done";
924
+ if (item.kind === "gaps" || part.part === item.total)
925
+ repoState(item).done = true;
926
+ if (item.force && Object.keys(repoState(item).parts).length >= item.total && Object.values(repoState(item).parts).every((p) => p.state === "done"))
927
+ await recordRulesNow(root, item.repo, item.commit);
928
+ totals.parts++;
929
+ totals.repos.add(item.repo);
930
+ await save();
931
+ return "done";
932
+ }
933
+ async function restLine(item, part) {
934
+ if (!existsSync(join(factsDirOf(root), `${item.repo}.jsonl`)))
935
+ return void 0;
936
+ const v = await verifyStep(item);
937
+ if (!v)
938
+ return void 0;
939
+ const parted = item.total > 1;
940
+ const c = captured();
941
+ const code = await mapCommand(root, item.repo, {
942
+ gaps: true,
943
+ json: true,
944
+ commit: item.commit,
945
+ maxTokens: limit,
946
+ ...parted ? { part: part.part } : {},
947
+ ...o.models ? { models: o.models } : {}
948
+ }, c, deps.git ? { git: deps.git } : {});
949
+ const g = code === 0 ? jsonOf(c.lines) : void 0;
950
+ if (!g)
951
+ return void 0;
952
+ if (!g.sessions.length && !v.rejected)
953
+ return "done";
954
+ return g.prompt ? preparedLine(item.repo, g.prompt) : `/atticus-map ${item.repo}${parted ? ` --part ${part.part}` : ""} --gaps`;
955
+ }
956
+ async function rulesLine(item) {
957
+ const p = await rulesPartsOf(root, item.repo, item.commit, limit, {
958
+ save: true,
959
+ ...o.models ? { models: o.models } : {}
960
+ });
961
+ if (typeof p === "string" || !p.parts.length)
962
+ return "done";
963
+ const c = captured();
964
+ const code = await mapCommand(root, item.repo, {
965
+ rules: true,
966
+ json: true,
967
+ commit: item.commit,
968
+ maxTokens: limit,
969
+ ...o.models ? { models: o.models } : {}
970
+ }, c, deps.git ? { git: deps.git } : {});
971
+ const j = code === 0 ? jsonOf(c.lines) : void 0;
972
+ return j?.prompt ? preparedLine(item.repo, j.prompt) : `/atticus-map ${item.repo} --rules`;
973
+ }
974
+ async function gapsLine(item) {
975
+ const plain = captured();
976
+ await verifyCommand(root, item.repo, { commit: item.commit, json: true }, plain);
977
+ const c = captured();
978
+ const code = await mapCommand(root, item.repo, {
979
+ gaps: true,
980
+ json: true,
981
+ commit: item.commit,
982
+ maxTokens: limit,
983
+ ...o.models ? { models: o.models } : {}
984
+ }, c, deps.git ? { git: deps.git } : {});
985
+ const g = code === 0 ? jsonOf(c.lines) : void 0;
986
+ if (!g) {
987
+ io.out(`${item.repo}: the gaps pass couldn't be planned: ${c.errs[0] ?? "no plan"}`);
988
+ return void 0;
989
+ }
990
+ if (!g.sessions.length)
991
+ return void 0;
992
+ return g.prompt ? preparedLine(item.repo, g.prompt) : `/atticus-map ${item.repo} --gaps`;
993
+ }
994
+ async function block(item, part, label, where, line, retries) {
995
+ io.out("");
996
+ io.out(`===== ${item.repo}, ${item.kind === "gaps" ? "the gaps pass" : item.kind === "rules" ? `the rules top-up${item.total > 1 ? `, ${label}` : ""}` : label} (${where})${retries ? `, given again (${retries})` : ""} =====`);
997
+ io.out(`In a NEW Copilot Chat (agent mode), run: ${line}`);
998
+ if (item.force)
999
+ io.out(`${item.total > 1 ? `That chat reads part ${part.part} whole again: ${part.paths.join(", ")} (about ${tokensText(part.tokens)} tokens). ` : ""}The facts on file stay, as already kept: the chat names one by its id and doesn't write it again (one whose line changed it rewrites under the same id).`);
1000
+ else if (item.kind === "rules")
1001
+ io.out(`That chat reads ${plural(part.files, "file")} again for the reading rules added since (${(item.sets ?? []).join(", ")}): ${part.paths.join(", ")} (about ${tokensText(part.tokens)} tokens).`);
1002
+ else if (item.total > 1 && !line.includes("--gaps"))
1003
+ io.out(`That chat reads part ${part.part}: ${part.paths.join(", ")} (about ${tokensText(part.tokens)} tokens); the estimate it runs names it.`);
1004
+ else if (line.includes("--part"))
1005
+ io.out(`That chat reads only what is left of part ${part.part}, as the prompt it writes lists.`);
1006
+ const copied = await (deps.clipboard ?? (async () => false))(line);
1007
+ io.out(copied ? "The line is on your clipboard." : "Copy the line above (no clipboard tool here).");
1008
+ io.out("Waiting for the facts it writes. s + Enter skips this part, r + Enter verifies what is there and gives the line again for what's left, q + Enter (or Ctrl+C) stops; atticus map --all carries on.");
1009
+ }
1010
+ function overCap() {
1011
+ return o.maxParts !== void 0 && totals.spent.prompts >= o.maxParts || o.budgetTokens !== void 0 && totals.spent.tokens >= o.budgetTokens;
1012
+ }
1013
+ async function acpPart(item, part, where) {
1014
+ const ps = partState(item, part.part);
1015
+ const label = item.total > 1 ? `part ${part.part} of ${item.total}` : "one session";
1016
+ const progress = item.total > 1 ? await readPlanProgress(root, item.repo) : void 0;
1017
+ const first0 = item.kind === "rules" ? await rulesLine(item) : item.kind === "gaps" ? await gapsLine(item) : item.force ? forceLine(item, part) : ps.retries > 0 || progress?.next && progress.next.part !== part.part ? await restLine(item, part) ?? `/atticus-map ${item.repo}${item.total > 1 ? ` --part ${part.part}` : ""}` : `/atticus-map ${item.repo}`;
1018
+ if (first0 === void 0) {
1019
+ io.out(`${item.repo}: no gaps left; nothing to read.`);
1020
+ return finishPart(item, part, ps);
1021
+ }
1022
+ if (first0 === "done")
1023
+ return finishPart(item, part, ps);
1024
+ let line = first0;
1025
+ const runner = deps.acp ?? await deps.makeAcp?.();
1026
+ if (!runner) {
1027
+ io.err("No Copilot session runner: copilot-acp needs runtime.yaml's copilotAcp.");
1028
+ return "quit";
1029
+ }
1030
+ let more = 0;
1031
+ for (let attempt = 0; attempt < 2; attempt++) {
1032
+ if (stopped())
1033
+ break;
1034
+ if (overCap())
1035
+ return "cap";
1036
+ io.out("");
1037
+ io.out(`===== ${item.repo}, ${item.kind === "gaps" ? "the gaps pass" : item.kind === "rules" ? "the rules top-up" : label} (${where})${attempt ? ", given again in a new session" : ""} =====`);
1038
+ io.out(`In a NEW Copilot session (copilot-acp): ${line}`);
1039
+ emit({
1040
+ type: "session",
1041
+ repo: item.repo,
1042
+ label: item.kind === "gaps" ? "the gaps pass" : item.kind === "rules" ? "the rules top-up" : label,
1043
+ line,
1044
+ attempt
1045
+ });
1046
+ const base = item.force ? await writtenOf(root, item.repo) : "";
1047
+ const first = await snapOf(root, item.repo);
1048
+ totals.spent.prompts++;
1049
+ let cut = false;
1050
+ try {
1051
+ const r = await runner({
1052
+ line,
1053
+ change: `map-${item.repo}`,
1054
+ writeRoots: readWrites(root),
1055
+ ...deps.signal ? { signal: deps.signal } : {},
1056
+ onProgress: io.out
1057
+ });
1058
+ totals.spent.tokens += r.usage ? r.usage.inputTokens + r.usage.outputTokens : part.tokens;
1059
+ io.out(`The session ended (${r.stopped ?? r.stopReason}).`);
1060
+ emit({
1061
+ type: "session.end",
1062
+ repo: item.repo,
1063
+ ended: r.stopped ?? r.stopReason,
1064
+ ...r.usage ? { tokens: r.usage.inputTokens + r.usage.outputTokens } : {}
1065
+ });
1066
+ cut = !!r.stopped;
1067
+ } catch (e) {
1068
+ if (e instanceof AcpSetupError) {
1069
+ io.err(`${e.message} The run stops here; ${resumeAs} carries on once it is put right.`);
1070
+ emit({ type: "session.end", repo: item.repo, ended: "failed", failed: e.message });
1071
+ ps.state = "incomplete";
1072
+ await save();
1073
+ return "quit";
1074
+ }
1075
+ if (e instanceof AcpSignInError) {
1076
+ io.err(e.message);
1077
+ emit({ type: "session.end", repo: item.repo, ended: "failed", failed: e.message });
1078
+ signIn = true;
1079
+ ps.state = "incomplete";
1080
+ await save();
1081
+ return "quit";
1082
+ }
1083
+ totals.spent.tokens += part.tokens;
1084
+ io.out(`${item.repo} ${label}: the Copilot session failed: ${firstLine(e)}`);
1085
+ emit({ type: "session.end", repo: item.repo, ended: "failed", failed: firstLine(e) });
1086
+ }
1087
+ if (stopped())
1088
+ break;
1089
+ const wrote = item.force ? await writtenOf(root, item.repo) !== base : void 0;
1090
+ const v = existsSync(join(factsDirOf(root), `${item.repo}.jsonl`)) ? await verifyStep(item) : void 0;
1091
+ const after = await snapOf(root, item.repo);
1092
+ if (v && !v.rejected && // beta.17: a one-session read stopped by Atticus is done only once its coverage leaves
1093
+ // nothing (what it wrote may be only the start).
1094
+ !(cut && item.total <= 1 && item.kind !== "rules" && (v.coverage.unknown?.length ?? 0) > 0) && await covered(root, item, part, first, after, v.coverage.unknown, wrote)) {
1095
+ const was = item.kind === "gaps" ? await gapsTextAt(root, item.repo) : void 0;
1096
+ const next = item.kind === "gaps" ? await gapsLine(item) : void 0;
1097
+ if (next !== void 0 && more < MAX_GAPS_SESSIONS && await gapsTextAt(root, item.repo) !== was) {
1098
+ more++;
1099
+ line = next;
1100
+ attempt = -1;
1101
+ continue;
1102
+ }
1103
+ return finishPart(item, part, ps);
1104
+ }
1105
+ if (attempt > 0)
1106
+ break;
1107
+ ps.retries++;
1108
+ await save();
1109
+ const rest = item.kind === "rules" ? await rulesLine(item) : item.kind === "gaps" ? await gapsLine(item) : item.force ? forceLine(item, part) : await restLine(item, part);
1110
+ if (rest === "done" || rest === void 0 && item.kind === "gaps")
1111
+ return finishPart(item, part, ps);
1112
+ line = rest ?? `/atticus-map ${item.repo}${item.total > 1 ? ` --part ${part.part}` : ""}`;
1113
+ io.out(`${item.repo} ${label} isn't accounted for yet${v?.rejected ? ` (${plural(v.rejected, "fact")} rejected)` : ""}: one more try in a NEW session with only what is left (${line}).`);
1114
+ }
1115
+ ps.state = "incomplete";
1116
+ await save();
1117
+ if (stopped())
1118
+ return "quit";
1119
+ io.out(`${item.repo} ${label}: still not accounted for after a second session; moving on. atticus map --all carries on from here.`);
1120
+ totals.ends.push(endOf(item, part, "incomplete"));
1121
+ return "incomplete";
1122
+ }
1123
+ async function modelRead(item, where, rt) {
1124
+ io.out("");
1125
+ io.out(item.kind === "rules" ? `===== ${item.repo} (${where}): topping up on the model for the reading rules added since it was read (${(item.sets ?? []).join(", ")}) =====` : `===== ${item.repo} (${where}): ${item.kind === "reread" ? "re-reading what changed" : "reading"} on the model, ${plural(item.batches ?? 0, "prompt")} =====`);
1126
+ for (let attempt = 1; attempt <= RETRIES; attempt++) {
1127
+ if (stopped())
1128
+ return "failed";
1129
+ const before = await mapStateOf(root, item.repo);
1130
+ const resume = !!before && !before.done && sameCommit(before.commit, item.commit);
1131
+ let error;
1132
+ try {
1133
+ await mapCommand(root, item.repo, {
1134
+ commit: item.commit,
1135
+ maxTokens: limit,
1136
+ ...o.models ? { models: o.models } : {},
1137
+ ...item.kind === "rules" ? { rules: true } : {},
1138
+ ...resume && !(item.force && attempt === 1) ? { next: true } : item.force && attempt === 1 || before && !before.done ? { force: true } : {}
1139
+ }, io, { runtime: rt, ...deps.git ? { git: deps.git } : {} });
1140
+ } catch (e) {
1141
+ if (e instanceof CapReached) {
1142
+ await save();
1143
+ return "cap";
1144
+ }
1145
+ error = firstLine(e);
1146
+ }
1147
+ const after = await mapStateOf(root, item.repo);
1148
+ const unfinished = !!after && !after.done && sameCommit(after.commit, item.commit);
1149
+ if (!error && !unfinished) {
1150
+ await verifyStep(item);
1151
+ const ps = partState(item, 1);
1152
+ return finishPart(item, item.parts[0] ?? { part: 1, total: 1, paths: [], files: 0, tokens: 0 }, ps);
1153
+ }
1154
+ if (attempt < RETRIES) {
1155
+ const wait = (deps.backoffMs ?? 5e3) * 2 ** (attempt - 1);
1156
+ io.out(`${item.repo}: the model's read stopped (${error ?? "a prompt got no answer"}); trying what is left again in ${Math.round(wait / 1e3)}s (try ${attempt + 1} of ${RETRIES}).`);
1157
+ await clock.sleep(wait);
1158
+ } else {
1159
+ io.out(`${item.repo}: the model's read failed ${RETRIES} times (${error ?? "a prompt got no answer"}); moving on.`);
1160
+ }
1161
+ }
1162
+ partState(item, 1).state = "failed";
1163
+ totals.ends.push({
1164
+ repo: item.repo,
1165
+ end: "failed",
1166
+ command: `atticus map --all --repos ${item.repo}`
1167
+ });
1168
+ await save();
1169
+ return "failed";
1170
+ }
1171
+ function endOf(item, part, end) {
1172
+ return {
1173
+ repo: item.repo,
1174
+ ...item.total > 1 ? { part: part.part, total: item.total } : {},
1175
+ end,
1176
+ command: `atticus map --all --repos ${item.repo}${o.gaps ? " --gaps" : ""}${item.force ? " --force" : ""} (or /atticus-map ${item.repo}${o.gaps ? " --gaps" : item.force && item.total > 1 ? ` --part ${part.part}` : ""} in a new chat)`
1177
+ };
1178
+ }
1179
+ async function summary(interrupted2) {
1180
+ for (const item of items)
1181
+ for (const part of item.kind === "carry" ? [] : item.parts) {
1182
+ const s = st.repos[item.repo]?.parts[String(part.part)];
1183
+ if (s?.state === "done" || totals.ends.some((e) => e.repo === item.repo && (e.part ?? 1) === part.part))
1184
+ continue;
1185
+ if (mode === "model" && totals.ends.some((e) => e.repo === item.repo))
1186
+ continue;
1187
+ totals.ends.push(endOf(item, part, "incomplete"));
1188
+ }
1189
+ const open = (await listQuestions(root, { state: "open" }).catch(() => ({ questions: [] }))).questions.length;
1190
+ const rejected = [...totals.rejected.values()].reduce((n, x) => n + x, 0);
1191
+ io.out("");
1192
+ io.out(`${interrupted2 ? "So far" : "Done"}: ${plural(totals.repos.size, "repo")} read, ${plural(totals.parts, "part")}${mode === "model" ? ` (${plural(totals.spent.prompts, "prompt")})` : mode === "copilot-acp" ? ` (${plural(totals.spent.prompts, "session")})` : ""}; ${plural(rejected, "fact")} rejected; links +${totals.added} -${totals.removed}; ${plural(open, "question")} open.`);
1193
+ const left = totals.ends.filter((e) => e.end !== "done");
1194
+ if (left.length) {
1195
+ io.out("Not finished:");
1196
+ for (const e of left)
1197
+ io.out(` ${e.repo}${e.part ? ` part ${e.part} of ${e.total}` : ""}: ${e.end}; ${e.command}`);
1198
+ }
1199
+ io.out("Next: atticus questions list --mine (answer what the code couldn't settle), then atticus estate fresh.");
1200
+ }
1201
+ }
1202
+ export {
1203
+ MAP_ALL_STATE_REL,
1204
+ limitFor,
1205
+ mapAllCommand,
1206
+ mapReader,
1207
+ modelModeAllowed,
1208
+ planEstate,
1209
+ preparedLine,
1210
+ readMapAllState,
1211
+ unaccountedWords
1212
+ };