@maycombhq/atticus 2.0.0-beta.25 → 2.0.0-beta.27

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 (326) hide show
  1. package/dist/bin.js +3 -3
  2. package/dist/chunk-22A2K555.js +653 -0
  3. package/dist/{chunk-UTZMF5CV.js → chunk-23TTURB2.js} +1 -1
  4. package/dist/{chunk-F36DIKJ3.js → chunk-2666BPJE.js} +19 -19
  5. package/dist/{chunk-E2OP6JNF.js → chunk-2ALBHI4Q.js} +28 -27
  6. package/dist/chunk-2ANBMA74.js +107 -0
  7. package/dist/{chunk-S7UQFI4B.js → chunk-2HCW6HXK.js} +27 -26
  8. package/dist/{chunk-HV3KPEFH.js → chunk-2ISR6MWD.js} +15 -15
  9. package/dist/{chunk-QQD25YNF.js → chunk-2MRYL45Z.js} +50 -9
  10. package/dist/{chunk-KN4UQJ7R.js → chunk-3GNUHLAN.js} +4 -4
  11. package/dist/chunk-3GURU22K.js +44 -0
  12. package/dist/{chunk-4U3JLIRC.js → chunk-3M3MDBOG.js} +1 -1
  13. package/dist/{chunk-DJ4C5ELF.js → chunk-3PBIZBWN.js} +1 -1
  14. package/dist/{chunk-XUCHGEF5.js → chunk-3PWXVBCB.js} +83 -40
  15. package/dist/chunk-3W2QX6TT.js +58 -0
  16. package/dist/{chunk-CPFAWYVC.js → chunk-3Z7ATALI.js} +5 -5
  17. package/dist/{chunk-ZGULQAPZ.js → chunk-44SWXDD7.js} +8 -5
  18. package/dist/{chunk-LGE6H4UP.js → chunk-46N5O5H7.js} +5 -5
  19. package/dist/{chunk-SRLUADSY.js → chunk-4D4DNTFE.js} +4 -4
  20. package/dist/{chunk-DMQJDHXG.js → chunk-4EAT7HOX.js} +7 -5
  21. package/dist/{chunk-DPZD7WVX.js → chunk-4FLIW5PJ.js} +4 -4
  22. package/dist/{chunk-SGTAQNOP.js → chunk-4LWA5VMJ.js} +52 -37
  23. package/dist/{chunk-D45K3XKK.js → chunk-4ODVHNA6.js} +18 -17
  24. package/dist/{chunk-7QZDGM5V.js → chunk-4POSAXNC.js} +6 -6
  25. package/dist/{chunk-A3J75BO2.js → chunk-4PQ4KDOA.js} +16 -15
  26. package/dist/{chunk-2Y5FJQSF.js → chunk-4UVTNHA6.js} +1 -1
  27. package/dist/{chunk-KVVNAUIG.js → chunk-4XK3HLOH.js} +1 -0
  28. package/dist/{chunk-V7T6URII.js → chunk-523NRKHF.js} +4 -4
  29. package/dist/{chunk-7EAH2MFY.js → chunk-5GCCG3GJ.js} +11 -5
  30. package/dist/{chunk-7U6PBBXG.js → chunk-5XW6RUDV.js} +8 -8
  31. package/dist/{chunk-Y3J365UC.js → chunk-5YEUAZZE.js} +8 -8
  32. package/dist/{chunk-JWLABUXL.js → chunk-62LD7CSY.js} +13 -13
  33. package/dist/{chunk-LOJGNSPA.js → chunk-67Y2J55V.js} +22 -21
  34. package/dist/{chunk-UCKG6UE7.js → chunk-6DSZ4CL7.js} +37 -22
  35. package/dist/{chunk-FNP4M4VL.js → chunk-6G67LSBG.js} +283 -61
  36. package/dist/{chunk-5GLGLWAJ.js → chunk-6OEB4FTC.js} +20 -19
  37. package/dist/{chunk-5RKN5QIX.js → chunk-6OTGCKYH.js} +9 -9
  38. package/dist/{chunk-UI7ID4HG.js → chunk-6XLCMDIP.js} +13 -13
  39. package/dist/chunk-76DZJTU7.js +190 -0
  40. package/dist/chunk-7764GVJK.js +37 -0
  41. package/dist/{chunk-TKCNJJ2S.js → chunk-7BOGXFZ3.js} +11 -11
  42. package/dist/{chunk-Q52KWTG5.js → chunk-7CVHKNAF.js} +16 -15
  43. package/dist/{chunk-XF5UMMQL.js → chunk-7FEIS3KV.js} +25 -24
  44. package/dist/{chunk-UTYL4XVA.js → chunk-7GXM45T5.js} +26 -23
  45. package/dist/{chunk-4PW5SRKJ.js → chunk-7YMAMNMT.js} +17 -16
  46. package/dist/chunk-7YWS47SE.js +56 -0
  47. package/dist/{chunk-LZFKJ2BR.js → chunk-A3LVMCA5.js} +1 -1
  48. package/dist/{chunk-7YFUNWFM.js → chunk-A7ZJKLFC.js} +11 -11
  49. package/dist/chunk-AANQC5QP.js +47 -0
  50. package/dist/{chunk-LP5QGTCR.js → chunk-AIQLTDC3.js} +3 -3
  51. package/dist/{chunk-EPXYFJTY.js → chunk-AKZTCZ6F.js} +4 -4
  52. package/dist/{chunk-5267F4BS.js → chunk-ALCSTVWQ.js} +3 -3
  53. package/dist/{chunk-NMBHFSJQ.js → chunk-ALUHO7SE.js} +26 -25
  54. package/dist/{chunk-3WO7ASU7.js → chunk-AMZ4XMES.js} +8 -8
  55. package/dist/{chunk-JKEUPSCE.js → chunk-AOQG37K4.js} +8 -6
  56. package/dist/{chunk-3NA2VE45.js → chunk-ARXZTHEI.js} +16 -15
  57. package/dist/{chunk-W2W7YCFL.js → chunk-AS4CTARY.js} +16 -15
  58. package/dist/{chunk-7AKJ2XTW.js → chunk-AVUPW23W.js} +18 -17
  59. package/dist/{chunk-CMUJSPP4.js → chunk-B56FCIEJ.js} +12 -12
  60. package/dist/{chunk-K3OIBTCV.js → chunk-BABATPOZ.js} +18 -17
  61. package/dist/{chunk-VAZYNF6I.js → chunk-BIOKDLLX.js} +21 -19
  62. package/dist/{chunk-23QHP4JJ.js → chunk-BUBKKEUV.js} +5 -5
  63. package/dist/{chunk-N3OEBQTA.js → chunk-CDC6VECU.js} +3 -3
  64. package/dist/chunk-CHEFUNZ4.js +425 -0
  65. package/dist/{chunk-MM7YWUBB.js → chunk-CIFR3DPV.js} +6 -6
  66. package/dist/{chunk-JCKKAELC.js → chunk-CLBVKD4P.js} +16 -15
  67. package/dist/{chunk-HHZEXF7V.js → chunk-CLM5Z3R5.js} +5 -5
  68. package/dist/{chunk-M7XNX5IC.js → chunk-CLYV5MB6.js} +9 -9
  69. package/dist/{chunk-SHWHRCMU.js → chunk-CRYIBCGP.js} +37 -19
  70. package/dist/{chunk-6576X5BJ.js → chunk-D3L5SO27.js} +5 -5
  71. package/dist/chunk-DAZM2INZ.js +34 -0
  72. package/dist/{chunk-VBJHIRKV.js → chunk-DF4BXBB2.js} +6 -6
  73. package/dist/{chunk-U4HZ5CXL.js → chunk-E7Q52EOO.js} +11 -11
  74. package/dist/{chunk-MZTU5L6S.js → chunk-EFDUC35B.js} +3 -3
  75. package/dist/{chunk-GIOOA2ZO.js → chunk-EHXEJFHD.js} +5 -5
  76. package/dist/{chunk-M6HI36T3.js → chunk-ELJ5Q4J2.js} +2 -2
  77. package/dist/{chunk-MJAIBPI5.js → chunk-EM6DKBTJ.js} +3 -3
  78. package/dist/{chunk-YGS2YVF2.js → chunk-EMC46SU4.js} +38 -17
  79. package/dist/{chunk-CB6H7MH2.js → chunk-EQEDIWFQ.js} +25 -24
  80. package/dist/chunk-EW574EZI.js +57 -0
  81. package/dist/{chunk-JJEPU4VS.js → chunk-EYINWNXL.js} +5 -5
  82. package/dist/{chunk-MJOIMGS4.js → chunk-EYVYHYCA.js} +8 -8
  83. package/dist/{chunk-WGOQZ4PQ.js → chunk-F66542M6.js} +34 -9
  84. package/dist/{chunk-EUCATH2U.js → chunk-F74OMLNU.js} +6 -6
  85. package/dist/{chunk-G5P7F6RQ.js → chunk-FADIWOA5.js} +3 -3
  86. package/dist/{chunk-JMOZ6K5A.js → chunk-FC3ZVD3O.js} +3 -3
  87. package/dist/{chunk-XXJSGCDO.js → chunk-FG65LXED.js} +8 -8
  88. package/dist/{chunk-5WZV37WS.js → chunk-FKAUBC4Y.js} +8 -8
  89. package/dist/{chunk-WA644MUQ.js → chunk-FM3EEDS2.js} +15 -15
  90. package/dist/{chunk-XZQBFF65.js → chunk-FS4E7F6O.js} +403 -148
  91. package/dist/{chunk-Q6UYUCNS.js → chunk-FSYJPYLE.js} +16 -15
  92. package/dist/{chunk-H7GAPNGQ.js → chunk-G33UIUG3.js} +46 -20
  93. package/dist/{chunk-OEUTV6EL.js → chunk-G3F4BYML.js} +15 -14
  94. package/dist/{chunk-7UYRN4ON.js → chunk-GBJRFFDW.js} +5 -5
  95. package/dist/{chunk-7HW2CMIN.js → chunk-GF6GBHFN.js} +13 -11
  96. package/dist/{chunk-DCPI3ETH.js → chunk-GLHOUT5E.js} +26 -25
  97. package/dist/{chunk-VOBG7BLB.js → chunk-GM6GXO2A.js} +20 -19
  98. package/dist/{chunk-KJPKIU2R.js → chunk-GSJ2RXE7.js} +29 -28
  99. package/dist/{chunk-HU7VXMFV.js → chunk-GT72FDER.js} +6 -6
  100. package/dist/{chunk-SBNBVUOF.js → chunk-GW6ZH77P.js} +37 -36
  101. package/dist/{chunk-6WYOJCB4.js → chunk-GZILYRGC.js} +3 -3
  102. package/dist/{chunk-4SS5ZK47.js → chunk-GZSOZYEP.js} +3 -3
  103. package/dist/{chunk-N6SSI6XO.js → chunk-H25QNDKK.js} +58 -36
  104. package/dist/{chunk-DYVUNT4O.js → chunk-H3RKW4RF.js} +7 -7
  105. package/dist/chunk-H7M7ZH6H.js +52 -0
  106. package/dist/chunk-H7NRWSMP.js +55 -0
  107. package/dist/{chunk-KW4DIXUL.js → chunk-HDWVR5KD.js} +4 -4
  108. package/dist/{chunk-HR34F2AJ.js → chunk-HG24EF5S.js} +16 -15
  109. package/dist/chunk-HPNYSY5M.js +1068 -0
  110. package/dist/{chunk-3VC2XJ53.js → chunk-HUMM4S5I.js} +6 -6
  111. package/dist/{chunk-K373N5U6.js → chunk-HVPS2YCW.js} +11 -11
  112. package/dist/{chunk-IGOE6KPG.js → chunk-I34CXV2C.js} +185 -11
  113. package/dist/{chunk-U7YZ3IRI.js → chunk-I57IH5X6.js} +360 -271
  114. package/dist/{chunk-P56N3NPT.js → chunk-I5X4WU7U.js} +6 -6
  115. package/dist/chunk-IAVVJ34R.js +55 -0
  116. package/dist/chunk-IBJE2E2S.js +51 -0
  117. package/dist/{chunk-EXCXNDTQ.js → chunk-IF3X6FMO.js} +1 -1
  118. package/dist/{chunk-GAVEIYKH.js → chunk-IJHJIL6T.js} +154 -25
  119. package/dist/chunk-IM435QAM.js +72 -0
  120. package/dist/{chunk-7NLYSTEK.js → chunk-IMBJ7WAO.js} +6 -6
  121. package/dist/{chunk-EM7F6XEU.js → chunk-INCFIDCB.js} +2 -2
  122. package/dist/{chunk-AYWJMHSX.js → chunk-IPMPLTEG.js} +3 -3
  123. package/dist/{chunk-PGKCRK77.js → chunk-IPSZDVLI.js} +12 -12
  124. package/dist/{chunk-IMTAHDME.js → chunk-IX2EOYOU.js} +50 -13
  125. package/dist/{chunk-QE444DZ2.js → chunk-IXNMGPF7.js} +61 -28
  126. package/dist/{chunk-NL6GIEJU.js → chunk-J6GO3K7G.js} +19 -18
  127. package/dist/chunk-JBLM6IUA.js +42 -0
  128. package/dist/{chunk-IWQEZFVV.js → chunk-JL2VOYSL.js} +91 -93
  129. package/dist/{chunk-K77ILFUQ.js → chunk-JRXFZB6J.js} +8 -8
  130. package/dist/{chunk-UR6JGVX2.js → chunk-JTOLBS7R.js} +988 -410
  131. package/dist/{chunk-GD6FXN6R.js → chunk-K73BHPTQ.js} +19 -18
  132. package/dist/{chunk-PYVFLITV.js → chunk-KF7KVUNJ.js} +5 -5
  133. package/dist/{chunk-F4WKGX7K.js → chunk-KKUCBKJE.js} +20 -19
  134. package/dist/{chunk-U7F6E5M3.js → chunk-KLFFHBWG.js} +27 -26
  135. package/dist/{chunk-ROVOAF2O.js → chunk-KMYB2XO7.js} +21 -13
  136. package/dist/chunk-KNYQUWFN.js +52 -0
  137. package/dist/{chunk-KFDOL2Y4.js → chunk-KOAJPMU2.js} +31 -20
  138. package/dist/chunk-KRTSE73S.js +55 -0
  139. package/dist/{chunk-IW3QMW3X.js → chunk-L3AM5YRP.js} +28 -9
  140. package/dist/{chunk-334N6EI2.js → chunk-LCIIFAID.js} +22 -21
  141. package/dist/{chunk-DLNQ3HUM.js → chunk-LCQIRCOT.js} +55 -10
  142. package/dist/{chunk-QFOJ3UPU.js → chunk-LFHBAWIM.js} +13 -13
  143. package/dist/chunk-LIHEMWIT.js +39 -0
  144. package/dist/{chunk-T5QYYB5L.js → chunk-LJLYWILK.js} +14 -14
  145. package/dist/{chunk-E7PR4WMM.js → chunk-LNJKDS5C.js} +26 -25
  146. package/dist/{chunk-HHZ2ZKUD.js → chunk-LTHY7E2P.js} +16 -15
  147. package/dist/{chunk-4WIVTPGE.js → chunk-LTVOQJKT.js} +7 -7
  148. package/dist/{chunk-TIOYZDRB.js → chunk-LZO3JABE.js} +6 -6
  149. package/dist/{chunk-PXMV2LLY.js → chunk-M65AZ4ZE.js} +3 -5
  150. package/dist/chunk-MPNTEWNY.js +492 -0
  151. package/dist/chunk-MQGQ3AWK.js +58 -0
  152. package/dist/{chunk-NQLTWGF4.js → chunk-MUXYUIBV.js} +6 -6
  153. package/dist/{chunk-5R3FRI6H.js → chunk-MWRRJDXQ.js} +34 -31
  154. package/dist/{chunk-XY6FVBBV.js → chunk-MZDHFWTN.js} +2 -2
  155. package/dist/chunk-N2XCT5OX.js +68 -0
  156. package/dist/{chunk-C5LX54QK.js → chunk-N3JGYAMD.js} +15 -15
  157. package/dist/{chunk-RL7PETU6.js → chunk-N5DLB74D.js} +367 -71
  158. package/dist/{chunk-MJMEF7SD.js → chunk-NC3Q7RIB.js} +10 -10
  159. package/dist/{chunk-4GWQVT2C.js → chunk-NCNLX4DL.js} +19 -18
  160. package/dist/{chunk-3D74UADA.js → chunk-NGSGJLKW.js} +2 -2
  161. package/dist/{chunk-OOU4N2JQ.js → chunk-NN7K2LLN.js} +25 -24
  162. package/dist/{chunk-ELNIQYLR.js → chunk-NNURP7VO.js} +15 -15
  163. package/dist/chunk-NSQB24WR.js +56 -0
  164. package/dist/{chunk-MWOPED6I.js → chunk-NV5S63YK.js} +7 -7
  165. package/dist/{chunk-CTJHEG6A.js → chunk-NWMFVPEP.js} +2 -0
  166. package/dist/{chunk-7E3G5NCH.js → chunk-NYT6QGZA.js} +22 -18
  167. package/dist/chunk-OB2DAIJX.js +62 -0
  168. package/dist/{chunk-YAUMNRCB.js → chunk-OC3OXDTG.js} +13 -8
  169. package/dist/{chunk-DAHKLVHU.js → chunk-OD6RNYMQ.js} +16 -16
  170. package/dist/{chunk-7FUQAT2R.js → chunk-OFYBRMRG.js} +6 -6
  171. package/dist/chunk-OGTELPDN.js +43 -0
  172. package/dist/{chunk-BS52P2CM.js → chunk-OQ7SBQ2Z.js} +7 -7
  173. package/dist/{chunk-OMSH46JK.js → chunk-OUDGBJC2.js} +16 -9
  174. package/dist/{chunk-USH4VU5D.js → chunk-OUGTAOGA.js} +2 -2
  175. package/dist/chunk-OWP5FCYM.js +60 -0
  176. package/dist/{chunk-YEGGQG5E.js → chunk-P36PTWBM.js} +8 -8
  177. package/dist/{chunk-IKRM64KR.js → chunk-P6Y2J2QY.js} +12 -12
  178. package/dist/{chunk-P4QTTCVK.js → chunk-PDJL2HO5.js} +24 -22
  179. package/dist/{chunk-WDJGJ3HV.js → chunk-PPKH6ULR.js} +152 -20
  180. package/dist/{chunk-5OVSDV77.js → chunk-Q4PFF2ZE.js} +8 -8
  181. package/dist/chunk-Q7EUPQEG.js +5 -0
  182. package/dist/{chunk-YRKAJ42V.js → chunk-QC6GSNIK.js} +7074 -3456
  183. package/dist/chunk-QCRQNYGI.js +211 -0
  184. package/dist/chunk-QDF533AW.js +90 -0
  185. package/dist/chunk-QDGNDNBG.js +50 -0
  186. package/dist/{chunk-2ULVUSIP.js → chunk-QGMD3PYL.js} +31 -24
  187. package/dist/{chunk-QEP4HTJE.js → chunk-QLT3WYTD.js} +6 -6
  188. package/dist/{chunk-GX67TNFA.js → chunk-QNDMAKQS.js} +11 -3
  189. package/dist/{chunk-XM3JE4QY.js → chunk-QNXMVJMA.js} +8 -8
  190. package/dist/{chunk-XP5DF5MC.js → chunk-QPAANKUR.js} +13 -12
  191. package/dist/{chunk-SD3PGZSR.js → chunk-QS4VX3HZ.js} +1 -1
  192. package/dist/{chunk-ZD64ZR64.js → chunk-QSM4K6LI.js} +7 -7
  193. package/dist/{chunk-Z4N7BKLN.js → chunk-QUFZDWPC.js} +8 -8
  194. package/dist/{chunk-ELNLHU7Y.js → chunk-QXXEOH3A.js} +18 -6
  195. package/dist/{chunk-QA4O2GGC.js → chunk-R4TUWD4C.js} +17 -1
  196. package/dist/{chunk-TAIYQDIV.js → chunk-ROI64BAI.js} +22 -21
  197. package/dist/{chunk-NMGFXT4S.js → chunk-RPVL3RTX.js} +19 -18
  198. package/dist/{chunk-62FMA437.js → chunk-RUNHVUCW.js} +16 -15
  199. package/dist/{chunk-I2M7MXSV.js → chunk-RWYPLODE.js} +9 -9
  200. package/dist/{chunk-5K6ZKHZR.js → chunk-RZYRUXSU.js} +4 -4
  201. package/dist/{chunk-TVFADTAT.js → chunk-S6TLXRBR.js} +7 -7
  202. package/dist/{chunk-PCZ4C2V7.js → chunk-SCOP3J6X.js} +7 -7
  203. package/dist/{chunk-JXLUHMTC.js → chunk-SCP24MJX.js} +24 -23
  204. package/dist/{chunk-R6HJ4SDB.js → chunk-SF3HXNXR.js} +6 -6
  205. package/dist/{chunk-7F4GZ7U2.js → chunk-SFCFL7Y5.js} +1 -1
  206. package/dist/{chunk-5RDKQOY3.js → chunk-SHFY73RI.js} +53 -112
  207. package/dist/{chunk-H75SPCAW.js → chunk-SHIARIEZ.js} +20 -19
  208. package/dist/chunk-SMFFUFMN.js +1876 -0
  209. package/dist/{chunk-JQGWP3SC.js → chunk-SVOGRJO6.js} +197 -124
  210. package/dist/chunk-SVZAAOHJ.js +46 -0
  211. package/dist/{chunk-BJDVI5W6.js → chunk-SZOU32VF.js} +21 -20
  212. package/dist/{chunk-MXPKXCGP.js → chunk-T2MN24LZ.js} +1 -1
  213. package/dist/{chunk-A3AADMM2.js → chunk-TD5WWJLN.js} +6 -6
  214. package/dist/{chunk-SXF66YNZ.js → chunk-TFN2N227.js} +6 -6
  215. package/dist/{chunk-RSA5JJMN.js → chunk-TFXNOQEU.js} +28 -27
  216. package/dist/{chunk-BEDZNT62.js → chunk-TMETWJFO.js} +11 -11
  217. package/dist/chunk-TNSAIISO.js +50 -0
  218. package/dist/{chunk-IDTVBZQI.js → chunk-TRJO2I4S.js} +3 -3
  219. package/dist/{chunk-IFDCCCEN.js → chunk-TRSNIJNM.js} +7 -7
  220. package/dist/{chunk-GDGE7ZHC.js → chunk-U3Z2QZE3.js} +6 -6
  221. package/dist/{chunk-GVOQJPKA.js → chunk-U7L3ORPK.js} +22 -21
  222. package/dist/{chunk-5UJ7C7IH.js → chunk-UDM6HGF4.js} +6 -6
  223. package/dist/{chunk-Z3KEX7ON.js → chunk-UDM7LXNJ.js} +7 -7
  224. package/dist/chunk-UDTO3U6E.js +35 -0
  225. package/dist/{chunk-UVKJVTKX.js → chunk-UEUPEUZX.js} +3 -3
  226. package/dist/chunk-UWBODTY7.js +514 -0
  227. package/dist/{chunk-KGT5RIGE.js → chunk-UYYYQTPD.js} +84 -51
  228. package/dist/{chunk-LKRMVWXB.js → chunk-V34N6JAN.js} +32 -31
  229. package/dist/{chunk-RX56MZLX.js → chunk-V3Y5P7OS.js} +24 -23
  230. package/dist/chunk-V6MLVGTP.js +89 -0
  231. package/dist/chunk-VC2XHC7P.js +424 -0
  232. package/dist/{chunk-MM5OAVSW.js → chunk-VCYE4MUD.js} +29 -28
  233. package/dist/{chunk-AGAFNUYZ.js → chunk-VN2VJ6BV.js} +19 -15
  234. package/dist/{chunk-DBVQEPZB.js → chunk-VVLWEM2Y.js} +6 -6
  235. package/dist/{chunk-F56DNMDD.js → chunk-VWCNMDMZ.js} +5 -5
  236. package/dist/{chunk-LNGFTPU7.js → chunk-W2A4NHQD.js} +25 -24
  237. package/dist/{chunk-LQD3R6NZ.js → chunk-W6OY2PMB.js} +10 -10
  238. package/dist/{chunk-IP6TSICI.js → chunk-WC6DHBVG.js} +16 -15
  239. package/dist/{chunk-MELS6T5J.js → chunk-WCA3WIGG.js} +5 -5
  240. package/dist/{chunk-GLISHJ4G.js → chunk-WJWSB65O.js} +1602 -452
  241. package/dist/{chunk-77REYYY5.js → chunk-WNPGLGCJ.js} +5 -5
  242. package/dist/chunk-WTOVWEY3.js +67 -0
  243. package/dist/{chunk-WS7KBKP4.js → chunk-X5B7KYPD.js} +507 -20
  244. package/dist/{chunk-O6DJMDBR.js → chunk-X73WLHSN.js} +7 -7
  245. package/dist/{chunk-YGNQUFVZ.js → chunk-XIIT4PVT.js} +3 -3
  246. package/dist/{chunk-5P4PNGPL.js → chunk-XLTT5QCX.js} +28 -25
  247. package/dist/{chunk-NPZ4KXIV.js → chunk-XMIS25ZJ.js} +21 -20
  248. package/dist/{chunk-NB664KWQ.js → chunk-XPDQ4T6G.js} +27 -26
  249. package/dist/{chunk-EAGSM3XY.js → chunk-XRWUYOX3.js} +138 -22
  250. package/dist/{chunk-2VN4TLGI.js → chunk-XZY4GTCX.js} +14 -9
  251. package/dist/{chunk-QSKY7FE3.js → chunk-Y2TVTI4P.js} +121 -15
  252. package/dist/{chunk-XVQQ3BQS.js → chunk-Y2U4CSCA.js} +28 -27
  253. package/dist/chunk-Y2U63JKE.js +41 -0
  254. package/dist/{chunk-UJ535VWR.js → chunk-Y6S7VCYN.js} +6 -6
  255. package/dist/{chunk-SEBBJQWK.js → chunk-YAPMGK7E.js} +11 -11
  256. package/dist/{chunk-CNF7D3A7.js → chunk-YAPVAYZN.js} +3 -3
  257. package/dist/{chunk-B2U4AOZ5.js → chunk-YCBDNWX3.js} +78 -57
  258. package/dist/{chunk-CGVRLQAY.js → chunk-YIGSUTW2.js} +1329 -92
  259. package/dist/{chunk-J65TN6QU.js → chunk-YJTBE6AJ.js} +5 -5
  260. package/dist/chunk-YQ3IXQIH.js +185 -0
  261. package/dist/{chunk-ZJQ64T6M.js → chunk-YRHKEXTP.js} +11 -11
  262. package/dist/{chunk-MN2XDLDM.js → chunk-YSSFS3YC.js} +17 -17
  263. package/dist/{chunk-BPDS7KUR.js → chunk-YXG2VQJJ.js} +200 -56
  264. package/dist/{chunk-XC5ZDFW7.js → chunk-Z4GLFTEH.js} +8 -8
  265. package/dist/{chunk-7X3WLAKP.js → chunk-Z65FWO6A.js} +157 -89
  266. package/dist/{chunk-OW53P52N.js → chunk-ZDG637ZT.js} +22 -21
  267. package/dist/{chunk-BIQNPWGX.js → chunk-ZIAMPN7N.js} +6 -6
  268. package/dist/chunk-ZIIBQHCX.js +53 -0
  269. package/dist/{chunk-RFQW7XT3.js → chunk-ZJJMYPGZ.js} +57 -27
  270. package/dist/{chunk-Y6KPWRZJ.js → chunk-ZOAX7W5S.js} +11 -11
  271. package/dist/chunk-ZSSR5GGB.js +48 -0
  272. package/dist/files.json +655 -551
  273. package/dist/fixtures/forge/expected/crosscheck.json +726 -0
  274. package/dist/fixtures/forge/slots/README.md +13 -0
  275. package/dist/fixtures/forge/slots/build.json +2686 -0
  276. package/dist/fixtures/forge/slots/crosscheck/forge-ledger.crosscheck.yaml +8 -0
  277. package/dist/fixtures/forge/slots/facts/forge-ledger.jsonl +17 -0
  278. package/dist/fixtures/forge/slots/facts/forge-ledger.meta.json +9 -0
  279. package/dist/fixtures/forge/slots/legacy/joins.json +113 -0
  280. package/dist/fixtures/forge/slots/readers/forge-events.json +306 -0
  281. package/dist/fixtures/forge/slots/readers/forge-gateway.json +238 -0
  282. package/dist/fixtures/forge/slots/readers/forge-infra.json +264 -0
  283. package/dist/fixtures/forge/slots/readers/forge-ledger.json +756 -0
  284. package/dist/fixtures/forge/slots/readers/forge-portal-bff.json +349 -0
  285. package/dist/fixtures/forge/slots/readers/forge-portal-ui.json +214 -0
  286. package/dist/fixtures/forge/slots/readers/forge-reports-job.json +258 -0
  287. package/dist/packages/sdk/npm/index.js +3859 -2939
  288. package/dist/packages/ui/dist/assets/{elk-api-ts8TigYQ.js → elk-api-CPE6PVL8.js} +2 -2
  289. package/dist/packages/ui/dist/assets/index-BYcVqj0l.js +65 -0
  290. package/dist/packages/ui/dist/assets/index-DF52Ejvz.css +1 -0
  291. package/dist/packages/ui/dist/index.html +2 -2
  292. package/package.json +5 -5
  293. package/dist/chunk-24OXGB3P.js +0 -82
  294. package/dist/chunk-2RABF6RT.js +0 -36
  295. package/dist/chunk-5CPZIWIN.js +0 -38
  296. package/dist/chunk-7YSMZEO3.js +0 -55
  297. package/dist/chunk-AENMOZMM.js +0 -42
  298. package/dist/chunk-BDKYHCGI.js +0 -71
  299. package/dist/chunk-BMMTWRWE.js +0 -50
  300. package/dist/chunk-CQRFCWQV.js +0 -45
  301. package/dist/chunk-CVWKS6GO.js +0 -50
  302. package/dist/chunk-D2CGJ7RR.js +0 -46
  303. package/dist/chunk-D7QIZLWB.js +0 -38
  304. package/dist/chunk-DM3H4V2G.js +0 -62
  305. package/dist/chunk-EJGUEUXG.js +0 -51
  306. package/dist/chunk-ELKTDXV3.js +0 -67
  307. package/dist/chunk-EP7ZBZLT.js +0 -170
  308. package/dist/chunk-EXGXCVWC.js +0 -52
  309. package/dist/chunk-FJS2FZFZ.js +0 -41
  310. package/dist/chunk-G3ZFEHCX.js +0 -925
  311. package/dist/chunk-GAU2IFIC.js +0 -33
  312. package/dist/chunk-GPOL5H3B.js +0 -55
  313. package/dist/chunk-HD72AL3L.js +0 -43
  314. package/dist/chunk-K4C2DWOZ.js +0 -232
  315. package/dist/chunk-KY3BUZYI.js +0 -54
  316. package/dist/chunk-LMNCRSER.js +0 -257
  317. package/dist/chunk-LPXH2DA4.js +0 -40
  318. package/dist/chunk-MLUHBVCI.js +0 -45
  319. package/dist/chunk-ONB7M2AF.js +0 -52
  320. package/dist/chunk-QBK33722.js +0 -51
  321. package/dist/chunk-S7I7SLZN.js +0 -59
  322. package/dist/chunk-UCQB6NKS.js +0 -192
  323. package/dist/chunk-UKMA5JFE.js +0 -52
  324. package/dist/chunk-X7QLAUNS.js +0 -47
  325. package/dist/packages/ui/dist/assets/index-CIfmX7DJ.css +0 -1
  326. package/dist/packages/ui/dist/assets/index-DNtpSfZS.js +0 -63
@@ -0,0 +1,1876 @@
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
+ keptFilesMayHaveChanged
8
+ } from "./chunk-NWMFVPEP.js";
9
+
10
+ // packages/core/dist/cite.js
11
+ var escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
12
+ var PARAM = /^(\{[^}]*\}|:[^/]+|<[^>]+>|\$\{[^}]*\})$/;
13
+ var PARAM_RE = "(?:\\{[^}]*\\}|:[A-Za-z_]\\w*|<[^>]+>|\\$\\{[^}]*\\})";
14
+ var fieldKey = (f) => f.split(".").pop().toLowerCase().replace(/[^a-z0-9]/g, "");
15
+ function lineNamesRoute(line, path) {
16
+ const segs = path.split(/[?#]/, 1)[0].split("/").filter(Boolean);
17
+ if (!segs.some((s) => !PARAM.test(s))) {
18
+ const body = segs.map((s) => PARAM.test(s) ? PARAM_RE : escape(s)).join("/");
19
+ if (new RegExp(`["'\`]/${body}/?["'\`]`).test(line))
20
+ return true;
21
+ if (!segs.length && /\bpath:\s*(['"`])\1|\bindex:\s*true\b/.test(line))
22
+ return true;
23
+ const head = segs.slice(0, -1).map(() => PARAM_RE).join("/");
24
+ return segs.length > 0 && new RegExp(`["'\`]/${head ? `${head}/` : ""}["'\`]\\s*\\+`).test(line);
25
+ }
26
+ for (let k = 0; k < segs.length; k++) {
27
+ const tail = segs.slice(k);
28
+ if (!tail.some((s) => !PARAM.test(s)))
29
+ break;
30
+ const re = new RegExp(`(?:/|["'\`])${tail.map((s) => PARAM.test(s) ? PARAM_RE : escape(s)).join("/")}(?![A-Za-z0-9_-])`, "i");
31
+ if (re.test(line))
32
+ return true;
33
+ const last = tail[tail.length - 1];
34
+ if (PARAM.test(last) && tail.length > 1) {
35
+ const head = tail.slice(0, -1);
36
+ const re2 = new RegExp(`/${head.map((s) => PARAM.test(s) ? PARAM_RE : escape(s)).join("/")}/?["'\`]`, "i");
37
+ if (re2.test(line))
38
+ return true;
39
+ }
40
+ }
41
+ return false;
42
+ }
43
+ var lineNamesWord = (line, word) => {
44
+ const w = word.trim();
45
+ if (!w)
46
+ return false;
47
+ const before = /^[A-Za-z0-9_]/.test(w) ? "(^|[^A-Za-z0-9_])" : "";
48
+ const after = /[A-Za-z0-9_]$/.test(w) ? "($|[^A-Za-z0-9_])" : "";
49
+ return new RegExp(`${before}${escape(w)}${after}`, "i").test(line);
50
+ };
51
+ var lineNamesField = (line, field) => {
52
+ const k = fieldKey(field);
53
+ return k.length > 0 && line.toLowerCase().replace(/[^a-z0-9]/g, " ").replace(/ /g, "").includes(k);
54
+ };
55
+ var lineNamesClaim = (line, c) => c.kind === "route" ? lineNamesRoute(line, c.value) : c.kind === "word" ? lineNamesWord(line, c.value) : lineNamesField(line, c.value);
56
+ function claimOnLines(lines, line, claim, window = 1) {
57
+ const from = Math.max(1, line - window);
58
+ const to = Math.min(lines.length, line + window);
59
+ for (let i = from; i <= to; i++)
60
+ if (lineNamesClaim(lines[i - 1] ?? "", claim))
61
+ return true;
62
+ return false;
63
+ }
64
+ function normalizeQuote(q) {
65
+ return q.replace(/\r\n?/g, "\n").replace(/[‘’‚]/g, "'").replace(/[“”„]/g, '"').replace(/\s+/g, " ").trim().replace(/[;,.]+$/, "").trim();
66
+ }
67
+ function quoteMatches(line, quote) {
68
+ if (!quote)
69
+ return true;
70
+ const q = normalizeQuote(quote).replace(/"/g, "'");
71
+ if (q === "")
72
+ return true;
73
+ const l = normalizeQuote(line).replace(/"/g, "'");
74
+ const at = q.indexOf("<redacted>");
75
+ if (at >= 0)
76
+ return at === 0 || l.includes(q.slice(0, at).trimEnd());
77
+ return l === q || l.startsWith(q) || l.includes(q);
78
+ }
79
+ var BINARY = /\.(png|jpe?g|gif|webp|ico|pdf|zip|jar|war|ear|gz|tgz|7z|exe|dll|so|dylib|class|wasm|woff2?|ttf|otf|mp[34]|mov|avi|bin|dat)$/i;
80
+ var NOTEBOOK = /\.ipynb$/i;
81
+ var MINIFIED = /(\.min\.(js|css)|[-.]bundle\.js|\.map)$/i;
82
+ function isBinaryPath(path) {
83
+ return BINARY.test(path);
84
+ }
85
+ function quoteNotRequired(path, line) {
86
+ return BINARY.test(path) || NOTEBOOK.test(path) || MINIFIED.test(path) || line.length > 1e3;
87
+ }
88
+ var SECRET_PATH = [
89
+ /(^|\/)\.env(\.|$)/i,
90
+ /(^|\/)secrets?\//i,
91
+ /(^|\/)credentials?(\.|$)/i,
92
+ /\.(pem|key|p12|pfx|jks|keystore)$/i,
93
+ /(^|\/)id_(rsa|ed25519|ecdsa|dsa)(\.|$)/i
94
+ ];
95
+ function isSecretPath(path) {
96
+ const p = path.replace(/\\/g, "/").split("/").map((x) => x.replace(/:.*$/, "").replace(/[. ]+$/, "")).join("/");
97
+ return SECRET_PATH.some((re) => re.test(p));
98
+ }
99
+ var SECRET_KEY = /(password|passwd|pwd|secret|token|api[-_]?key|access[-_]?key|private[-_]?key|client[-_]?secret|credential)/i;
100
+ var PLACEHOLDER = /^(\$\{|\{\{|env:|vault:|secret:|ref:|<)/;
101
+ var KEY_VALUE = /^(\s*[-"']?\s*)([A-Za-z0-9_.:-]*?(?:password|passwd|pwd|secret|token|api[-_]?key|access[-_]?key|private[-_]?key|credentials?))(["']?\s*[:=]\s*)(.+)$/i;
102
+ var SECRET_WORDS = "(?:password|passwd|pwd|secret|token|api[-_]?key|access[-_]?key|private[-_]?key|credentials?)";
103
+ var KEY_LITERAL = new RegExp(`((?:^|[^A-Za-z0-9_.$-])[A-Za-z0-9_.$-]*?${SECRET_WORDS}["'\`]?\\]?(?:\\s*:\\s*[A-Za-z_][\\w.<>?\\[\\]]*(?=\\s*=))?\\s*(?::=|=>|=(?!=)|:(?!:))\\s*)(["'\`])((?:(?!\\2)[^\\\\]|\\\\.)+)\\2`, "i");
104
+ var SETTER_LITERAL = new RegExp(`(\\b(?:set|with)[A-Za-z0-9_]*?${SECRET_WORDS}\\s*\\(\\s*)(["'\`])((?:(?!\\2)[^\\\\]|\\\\.)+)\\2`, "i");
105
+ var KEY_BARE = new RegExp(`((?:\\bexport\\s+|--|[?&;])[A-Za-z0-9_.-]*?${SECRET_WORDS}\\s*=\\s*)([^\\s&;"'\`]+)`, "gi");
106
+ var URL_CREDENTIALS = /\b([a-z][a-z0-9+.-]*:\/\/[^\s:@/]+:)([^\s@/]+)(?=@)/gi;
107
+ var BEARER = /\b(Bearer\s+)([A-Za-z0-9._~+/-]{16,}=*)/g;
108
+ var BASIC = /\b(Basic\s+)((?=[A-Za-z0-9+/]*[0-9+/=])[A-Za-z0-9+/]{12,}={0,2})/g;
109
+ var TOKEN_SHAPES = [
110
+ /\bgh[pousr]_[A-Za-z0-9]{20,}/g,
111
+ /\bgithub_pat_[A-Za-z0-9_]{20,}/g,
112
+ /\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{8,}/g,
113
+ /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,
114
+ /\bxox[abprs]-[A-Za-z0-9-]{10,}/g,
115
+ /\bAIza[0-9A-Za-z_-]{35}/g,
116
+ /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g
117
+ ];
118
+ var TOKEN_PREFIXES = [
119
+ /\bgh[pousr]_/,
120
+ /\bgithub_pat_/,
121
+ /\bgl(?:pat|ptt|dt|rt|cbt|imt|soat|ffct|agent)-/,
122
+ /\bnpm_/,
123
+ /\bpypi-/,
124
+ /\bhf_/,
125
+ /\b(?:sk|rk|pk)[-_]/,
126
+ /\bwhsec_/,
127
+ /\bxox[abeprs]-/,
128
+ /\bxapp-/,
129
+ /\b(?:AKIA|ASIA|AGPA|AIDA|AROA|ANPA)[0-9A-Z]{4}/,
130
+ /\bAIza/,
131
+ /\beyJ/,
132
+ /\bya29\./,
133
+ /\bshp(?:at|ss|ca|pa)_/,
134
+ /\bdop_v1_/,
135
+ /\bSG\./,
136
+ /\bsq0(?:atp|csp|idp)-/,
137
+ /\bEAAA[A-Za-z0-9]/,
138
+ /\bSK[0-9a-fA-F]{8}/,
139
+ /\bAC[0-9a-f]{8}/,
140
+ /\bdapi[0-9a-f]{8}/,
141
+ /AccountKey=/i,
142
+ /SharedAccessSignature|[?&]sig=/i,
143
+ /\bBearer\s/i,
144
+ /\bBasic\s/i
145
+ ];
146
+ var hasTokenPrefix = (text) => TOKEN_PREFIXES.some((re) => re.test(text));
147
+ function hasSecretShape(text, o = {}) {
148
+ for (const m of text.matchAll(URL_CREDENTIALS))
149
+ if (!refersOnly(m[2]))
150
+ return true;
151
+ if (new RegExp(BEARER.source).test(text))
152
+ return true;
153
+ if (o.basic !== false && new RegExp(BASIC.source).test(text))
154
+ return true;
155
+ return TOKEN_SHAPES.some((re) => new RegExp(re.source).test(text));
156
+ }
157
+ function maskSecretShapes(text, mask = "***") {
158
+ let out = text.replace(URL_CREDENTIALS, (all2, head, pass) => refersOnly(pass) ? all2 : `${head}${mask}`);
159
+ out = out.replace(BEARER, `$1${mask}`).replace(BASIC, `$1${mask}`);
160
+ for (const re of TOKEN_SHAPES)
161
+ out = out.replace(re, mask);
162
+ return out;
163
+ }
164
+ function keyIsSecret(key) {
165
+ if (hasSecretShape(key))
166
+ return true;
167
+ for (const run of key.match(/[0-9a-f]{24,}|[0-9A-F]{24,}/g) ?? [])
168
+ if (/\d/.test(run) && /[a-f]/i.test(run))
169
+ return true;
170
+ const digitsAndLetters = /\d/.test(key) && /[A-Za-z]/.test(key);
171
+ if (key.length >= 32 && /^[A-Za-z0-9+/=]+$/.test(key) && digitsAndLetters)
172
+ return true;
173
+ if (key.length >= 32 && /^[A-Za-z0-9_-]+$/.test(key) && /\d/.test(key) && /[a-z]/.test(key) && /[A-Z]/.test(key))
174
+ return true;
175
+ if (key.length < 16 || !/^[A-Za-z0-9+/=]+$/.test(key) || !/\d/.test(key))
176
+ return false;
177
+ const kind = (c) => /\d/.test(c) ? 0 : /[a-z]/.test(c) ? 1 : 2;
178
+ let switches = 0;
179
+ for (let i = 1; i < key.length; i++)
180
+ if (kind(key[i]) !== kind(key[i - 1]))
181
+ switches++;
182
+ return switches >= key.length / 2;
183
+ }
184
+ var placeholder = (v) => PLACEHOLDER.test(v.trim().replace(/^["'`]/, ""));
185
+ var refersOnly = (v) => placeholder(v) || /^[$%{]/.test(v);
186
+ function redactSecrets(line) {
187
+ if (/-----BEGIN [A-Z ]*PRIVATE KEY-----/.test(line))
188
+ return "<redacted>";
189
+ let out = line;
190
+ if (SECRET_KEY.test(out)) {
191
+ const m = KEY_VALUE.exec(out);
192
+ if (m && !placeholder(m[4]))
193
+ out = `${m[1]}${m[2]}${m[3]}<redacted>`;
194
+ for (const re of [KEY_LITERAL, SETTER_LITERAL]) {
195
+ const k = re.exec(out);
196
+ if (k && !placeholder(k[3]))
197
+ out = `${out.slice(0, k.index)}${k[1]}<redacted>`;
198
+ }
199
+ out = out.replace(KEY_BARE, (all2, key, v) => refersOnly(v) || v === "<redacted>" ? all2 : `${key}<redacted>`);
200
+ }
201
+ out = out.replace(URL_CREDENTIALS, (all2, head, pass) => refersOnly(pass) ? all2 : `${head}<redacted>`);
202
+ out = out.replace(BEARER, "$1<redacted>").replace(BASIC, "$1<redacted>");
203
+ for (const re of TOKEN_SHAPES)
204
+ out = out.replace(re, "<redacted>");
205
+ return out;
206
+ }
207
+ var SECRET_IDENT = new RegExp(`[A-Za-z0-9_]*${SECRET_WORDS}[A-Za-z0-9_]*`, "i");
208
+ var OPAQUE_LITERAL = /(["'`])([^\s"'`]{8,})\1/g;
209
+ function quoteHoldsSecret(quote) {
210
+ if (!SECRET_IDENT.test(quote))
211
+ return false;
212
+ for (const m of quote.matchAll(OPAQUE_LITERAL)) {
213
+ const v = m[2];
214
+ if (/^[/.#$%{<]/.test(v) || v.includes("://") || placeholder(v))
215
+ continue;
216
+ if (/[A-Za-z]/.test(v) && /[0-9]/.test(v))
217
+ return true;
218
+ }
219
+ return false;
220
+ }
221
+ function defaultActionAt(lines, path) {
222
+ if (path.split(/[?#]/, 1)[0].replace(/\/+/g, "") !== "")
223
+ return false;
224
+ const text = lines.join("\n");
225
+ const mvc5 = /defaults:\s*new\s*\{[^}]*\}/.exec(text)?.[0];
226
+ if (!/MapDefaultControllerRoute|\{controller=\w+\}/.test(text) && !mvc5)
227
+ return false;
228
+ const controller = /\{controller=(\w+)\}/.exec(text)?.[1] ?? (mvc5 ? /controller\s*=\s*"(\w+)"/.exec(mvc5)?.[1] : void 0) ?? "Home";
229
+ const action = /\{action=(\w+)\}/.exec(text)?.[1] ?? (mvc5 ? /action\s*=\s*"(\w+)"/.exec(mvc5)?.[1] : void 0) ?? "Index";
230
+ return new RegExp(`\\b${controller}Controller\\b`).test(text) && new RegExp(`\\b${action}\\s*\\(`).test(text);
231
+ }
232
+ var WORD_SEP = "[:._/#\\s]";
233
+ function partsBuildWord(claim, parts, lines) {
234
+ if (!parts.length)
235
+ return false;
236
+ let s = claim.trim();
237
+ for (const raw of parts) {
238
+ const v = raw.trim();
239
+ if (!v)
240
+ return false;
241
+ const before = new RegExp(`^${WORD_SEP}`).test(v) ? "" : `(?<=^|${WORD_SEP}|\\u0000)`;
242
+ const after = new RegExp(`${WORD_SEP}$`).test(v) ? "" : `(?=$|${WORD_SEP}|\\u0000)`;
243
+ const re = new RegExp(`${before}${escape(v)}${after}`, "i");
244
+ if (!re.test(s))
245
+ return false;
246
+ s = s.replace(re, "\0");
247
+ }
248
+ const edge = new RegExp(`^${WORD_SEP}+|${WORD_SEP}+$`, "g");
249
+ const rest = s.split("\0").map((p) => p.replace(edge, "")).filter(Boolean);
250
+ return rest.length > 0 && rest.every((p) => lines.some((l) => lineNamesWord(l, p)));
251
+ }
252
+ var pathPieces = (path) => path.split(/[?#]/, 1)[0].split("/").filter((s) => s && !PARAM.test(s)).flatMap((s) => s.split(".")).filter(Boolean);
253
+ var linesNamePiece = (lines, p) => [p, p.replace(/-/g, "")].some((q) => lines.some((l) => new RegExp(`(^|[^A-Za-z0-9]|(?<=[a-z0-9])(?=[A-Z]))${escape(q)}`, "i").test(l)));
254
+ function partsNamePath(lines, path) {
255
+ const parts = pathPieces(path);
256
+ if (!parts.length)
257
+ return lines.some((l) => lineNamesRoute(l, path)) || defaultActionAt(lines, path);
258
+ return parts.every((p) => linesNamePiece(lines, p));
259
+ }
260
+ function declaresConventionalRoute(texts) {
261
+ return texts.some((t) => /[{[]action(=\w*)?\??[}\]]|\bMapDefaultControllerRoute\b/i.test(t) || drfActionNamed(t));
262
+ }
263
+ function drfActionNamed(t) {
264
+ for (const m of t.matchAll(/@action\s*\(/g)) {
265
+ let depth = 1;
266
+ let i = m.index + m[0].length;
267
+ for (; i < t.length && depth > 0; i++)
268
+ if (t[i] === "(")
269
+ depth++;
270
+ else if (t[i] === ")")
271
+ depth--;
272
+ if (!/\burl_path\s*=/.test(t.slice(m.index, i)))
273
+ return true;
274
+ }
275
+ return false;
276
+ }
277
+ var commentText = (l) => l.replace(/^\s*(\/\/+|\/\*+|\*+|#+|<!--|--)/, "");
278
+ var writesPieceAsPath = (l, p) => (
279
+ // after a quote, a `/`, a `:`, a tag's `>` or an interpolation's `}` (`"/balances"`, `'users'`,
280
+ // `:users`, `<Path>v1</Path>`, `$"{base}users"`, `${base}users`), and ending there
281
+ new RegExp(`["'\`/:>}]${escape(p)}(?![A-Za-z0-9_-])`, "i").test(l)
282
+ );
283
+ function pathPieceOnlyInComment(rawNear, isComment, partLines, path) {
284
+ const comments = rawNear.filter((l, i) => isComment(l, i)).map(commentText);
285
+ if (!comments.length)
286
+ return void 0;
287
+ const code = rawNear.filter((l, i) => !isComment(l, i));
288
+ return pathPieces(path).find((p) => !linesNamePiece(partLines, p) && comments.some((l) => writesPieceAsPath(l, p)) && !code.some((l) => writesPieceAsPath(l, p)));
289
+ }
290
+
291
+ // packages/core/dist/fs.js
292
+ import { randomBytes } from "node:crypto";
293
+ import { link, mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
294
+ import { hostname } from "node:os";
295
+ import { basename, dirname, join, resolve } from "node:path";
296
+ async function writeFileAtomic(path, data) {
297
+ await mkdir(dirname(path), { recursive: true });
298
+ const tmp = `${path}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
299
+ try {
300
+ await writeFile(tmp, data, typeof data === "string" ? "utf8" : void 0);
301
+ await renameRetrying(tmp, path);
302
+ } catch (e) {
303
+ await rm(tmp, { force: true });
304
+ throw e;
305
+ } finally {
306
+ keptFilesMayHaveChanged(path);
307
+ }
308
+ }
309
+ var FileChangedError = class extends Error {
310
+ path;
311
+ constructor(path) {
312
+ super(`${path} changed since it was read (another edit, or a person's): nothing was written. Read it again and redo the change.`);
313
+ this.path = path;
314
+ }
315
+ };
316
+ var writing = /* @__PURE__ */ new Map();
317
+ function writeFileIfUnchanged(path, before, data) {
318
+ const key = resolve(path);
319
+ const prev = writing.get(key) ?? Promise.resolve();
320
+ const work = async () => {
321
+ const now = await readFile(path, "utf8").catch(() => void 0);
322
+ if (now !== before)
323
+ throw new FileChangedError(path);
324
+ await writeFileAtomic(path, data);
325
+ };
326
+ const next = prev.then(work, work);
327
+ const tail = next.catch(() => void 0);
328
+ writing.set(key, tail);
329
+ void tail.then(() => {
330
+ if (writing.get(key) === tail)
331
+ writing.delete(key);
332
+ });
333
+ return next;
334
+ }
335
+ var BUSY = /* @__PURE__ */ new Set(["EPERM", "EBUSY", "EACCES"]);
336
+ async function renameRetrying(from, to, tries = 9) {
337
+ for (let i = 0; ; i++) {
338
+ try {
339
+ await rename(from, to);
340
+ return;
341
+ } catch (e) {
342
+ const code = e.code ?? "";
343
+ if (!BUSY.has(code) || i >= tries - 1)
344
+ throw e;
345
+ await new Promise((r) => setTimeout(r, 20 * 2 ** i));
346
+ }
347
+ }
348
+ }
349
+ var LockHeldError = class extends Error {
350
+ held;
351
+ file;
352
+ constructor(held, file) {
353
+ super(`Another ${held.what} is running (process ${held.pid} on ${held.host}, since ${held.startedAt}). Wait for it to finish${file ? `; if nothing is running, delete ${file}` : ""}.`);
354
+ this.held = held;
355
+ this.file = file;
356
+ this.name = "LockHeldError";
357
+ }
358
+ };
359
+ var heldHere = /* @__PURE__ */ new Set();
360
+ var lockFileOf = (root, name) => join(root, ".atticus", "locks", `${name}.json`);
361
+ function alive(pid) {
362
+ try {
363
+ process.kill(pid, 0);
364
+ return true;
365
+ } catch (e) {
366
+ return e.code === "EPERM";
367
+ }
368
+ }
369
+ async function readLock(root, name, o = {}) {
370
+ try {
371
+ const file = lockFileOf(root, name);
372
+ const info = JSON.parse(await readFile(file, "utf8"));
373
+ const here = info.host === hostname();
374
+ const age = (o.now ?? (() => /* @__PURE__ */ new Date()))().getTime() - Date.parse(info.startedAt);
375
+ const stale = here && (!alive(info.pid) || info.pid === process.pid && !heldHere.has(file)) || o.maxAgeMs !== void 0 && Number.isFinite(age) && age > o.maxAgeMs;
376
+ return { ...info, stale };
377
+ } catch {
378
+ return void 0;
379
+ }
380
+ }
381
+ async function acquireLock(root, name, what, now = () => /* @__PURE__ */ new Date(), o = {}) {
382
+ const file = lockFileOf(root, name);
383
+ await ensureLocalIgnore(root);
384
+ await mkdir(dirname(file), { recursive: true });
385
+ const info = {
386
+ pid: process.pid,
387
+ host: hostname(),
388
+ startedAt: now().toISOString(),
389
+ what
390
+ };
391
+ let interrupted;
392
+ for (let attempt = 0; attempt < 2; attempt++) {
393
+ try {
394
+ await writeFile(file, JSON.stringify(info), { encoding: "utf8", flag: "wx" });
395
+ heldHere.add(file);
396
+ const release = async () => {
397
+ const cur = await readLock(root, name);
398
+ if (cur && cur.pid === info.pid && cur.startedAt === info.startedAt)
399
+ await rm(file, { force: true });
400
+ heldHere.delete(file);
401
+ };
402
+ return interrupted ? { release, interrupted } : { release };
403
+ } catch (e) {
404
+ if (e.code !== "EEXIST")
405
+ throw e;
406
+ const held = await readLock(root, name, { ...o, now });
407
+ if (held && !held.stale)
408
+ throw new LockHeldError(held, file);
409
+ if (held) {
410
+ const { stale: _s, ...rest } = held;
411
+ interrupted = rest;
412
+ }
413
+ await rm(file, { force: true });
414
+ }
415
+ }
416
+ throw new Error(`Couldn't take the ${name} lock at ${file}.`);
417
+ }
418
+ var sharedLockFileOf = (path) => `${path}.lock`;
419
+ var sharing = /* @__PURE__ */ new Map();
420
+ var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
421
+ var QUICK_WRITE_LOCK = { maxAgeMs: 12e4 };
422
+ function withSharedFileLock(path, work, o = {}) {
423
+ const key = resolve(path);
424
+ const prev = sharing.get(key) ?? Promise.resolve();
425
+ const run = async () => {
426
+ const release = await takeSharedLock(key, o);
427
+ try {
428
+ return await work();
429
+ } finally {
430
+ await release();
431
+ }
432
+ };
433
+ const next = prev.then(run, run);
434
+ const tail = next.catch(() => void 0);
435
+ sharing.set(key, tail);
436
+ void tail.then(() => {
437
+ if (sharing.get(key) === tail)
438
+ sharing.delete(key);
439
+ });
440
+ return next;
441
+ }
442
+ async function takeSharedLock(path, o) {
443
+ const file = sharedLockFileOf(path);
444
+ const staleMs = o.staleMs ?? 1e4;
445
+ const waitMs = o.waitMs ?? 15e3;
446
+ const info = {
447
+ pid: process.pid,
448
+ host: hostname(),
449
+ startedAt: (/* @__PURE__ */ new Date()).toISOString(),
450
+ what: o.what ?? `write of ${basename(path)}`,
451
+ token: randomBytes(8).toString("hex")
452
+ };
453
+ await mkdir(dirname(file), { recursive: true });
454
+ const start = Date.now();
455
+ let delay = 5;
456
+ for (; ; ) {
457
+ let code;
458
+ try {
459
+ await writeFile(file, JSON.stringify(info), { encoding: "utf8", flag: "wx" });
460
+ return () => releaseShared(file, info.token);
461
+ } catch (e) {
462
+ code = e.code ?? "";
463
+ if (code !== "EEXIST" && !BUSY.has(code))
464
+ throw e;
465
+ }
466
+ let held;
467
+ if (code === "EEXIST") {
468
+ const seen = await readFile(file, "utf8").catch(() => void 0);
469
+ if (seen === void 0)
470
+ continue;
471
+ held = parseLockInfo(seen);
472
+ if (await isStaleShared(file, held, staleMs, o.maxAgeMs)) {
473
+ await takeOver(file, seen, info.token);
474
+ continue;
475
+ }
476
+ }
477
+ if (Date.now() - start > waitMs)
478
+ throw new LockHeldError(held ?? { pid: 0, host: "?", startedAt: "?", what: `write of ${basename(path)}` }, file);
479
+ await sleep(delay + Math.floor(Math.random() * delay));
480
+ delay = Math.min(delay * 2, 100);
481
+ }
482
+ }
483
+ function parseLockInfo(text) {
484
+ try {
485
+ const j = JSON.parse(text);
486
+ return typeof j.pid === "number" && typeof j.startedAt === "string" ? {
487
+ pid: j.pid,
488
+ host: String(j.host ?? ""),
489
+ startedAt: j.startedAt,
490
+ what: String(j.what ?? "")
491
+ } : void 0;
492
+ } catch {
493
+ return void 0;
494
+ }
495
+ }
496
+ async function isStaleShared(file, held, staleMs, maxAgeMs) {
497
+ if (held && maxAgeMs !== void 0) {
498
+ const since2 = Date.parse(held.startedAt);
499
+ if (Number.isFinite(since2) && Date.now() - since2 > maxAgeMs)
500
+ return true;
501
+ }
502
+ if (held && held.host === hostname() && held.pid !== process.pid)
503
+ return !alive(held.pid);
504
+ const since = held ? Date.parse(held.startedAt) : await stat(file).then((s) => s.mtimeMs, () => NaN);
505
+ return Number.isFinite(since) && Date.now() - since > staleMs;
506
+ }
507
+ async function takeOver(file, seen, token) {
508
+ const aside = `${file}.${token}.stale`;
509
+ try {
510
+ await rename(file, aside);
511
+ } catch {
512
+ return;
513
+ }
514
+ const moved = await readFile(aside, "utf8").catch(() => void 0);
515
+ if (moved !== void 0 && moved !== seen)
516
+ await link(aside, file).catch(() => void 0);
517
+ await rmRetrying(aside);
518
+ }
519
+ async function releaseShared(file, token) {
520
+ const now = await readFile(file, "utf8").catch(() => void 0);
521
+ if (now === void 0)
522
+ return;
523
+ try {
524
+ if (JSON.parse(now).token !== token)
525
+ return;
526
+ } catch {
527
+ return;
528
+ }
529
+ await rmRetrying(file);
530
+ }
531
+ async function rmRetrying(file, tries = 9) {
532
+ for (let i = 0; ; i++) {
533
+ try {
534
+ await rm(file, { force: true });
535
+ return;
536
+ } catch (e) {
537
+ const code = e.code ?? "";
538
+ if (!BUSY.has(code) || i >= tries - 1)
539
+ throw e;
540
+ await sleep(20 * 2 ** i);
541
+ }
542
+ }
543
+ }
544
+ var LOCAL_ONLY = [
545
+ "me.yaml",
546
+ "logs/",
547
+ "locks/",
548
+ "backups/",
549
+ "history/",
550
+ "probe/",
551
+ "cache/",
552
+ // ADR 0161: where `atticus map --all` is in the estate, so running it again resumes.
553
+ "map-all/"
554
+ ];
555
+ async function ensureLocalIgnore(root) {
556
+ const file = join(root, ".atticus", ".gitignore");
557
+ const text = await readFile(file, "utf8").catch(() => "");
558
+ const have = new Set(text.split(/\r?\n/).map((l) => l.trim()));
559
+ const missing = LOCAL_ONLY.filter((l) => !have.has(l));
560
+ if (!missing.length)
561
+ return;
562
+ const prefix = text && !text.endsWith("\n") ? `${text}
563
+ ` : text;
564
+ await writeFileAtomic(file, `${prefix}${prefix ? "" : "# This machine's own files: never committed.\n"}${missing.join("\n")}
565
+ `);
566
+ }
567
+
568
+ // packages/core/dist/log.js
569
+ import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
570
+ import { homedir, userInfo } from "node:os";
571
+ import { join as join2 } from "node:path";
572
+ var ORDER = { debug: 10, info: 20, warn: 30, error: 40, off: 100 };
573
+ var LOG_MAX_BYTES = 5 * 1024 * 1024;
574
+ var LOG_KEEP = 3;
575
+ var logFileOf = (root) => join2(root, ".atticus", "logs", "atticus.log");
576
+ var SECRET_KEY2 = /(token|password|passwd|pwd|secret|api[-_]?key|private[-_]?key|credential|authorization|cookie|session)/i;
577
+ function redactText(s, o = {}) {
578
+ let out = s.replace(/([a-z][a-z0-9+.-]*:\/\/)[^/@\s:]+:[^/@\s]+@/gi, "$1***@").replace(/\b(bearer|basic)\s+[A-Za-z0-9._~+/=-]{8,}/gi, "$1 ***").replace(new RegExp(`(${SECRET_KEY2.source})(["']?\\s*[:=]\\s*["']?)([^\\s"',;&]+)`, "gi"), "$1$3***").replace(/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{5,}/g, "***").replace(/\b(?=[A-Za-z0-9+_-]*\d)(?=[A-Za-z0-9+_-]*[A-Z])(?=[A-Za-z0-9+_-]*[a-z])[A-Za-z0-9+_-]{32,}={0,2}/g, "***");
579
+ const home = o.home ?? safeHome();
580
+ if (home && home.length > 3)
581
+ out = out.split(home).join("~");
582
+ const user = o.user ?? safeUser();
583
+ if (user && user.length > 2)
584
+ out = out.replace(new RegExp(`([\\\\/])${escapeRe(user)}(?=[\\\\/])`, "g"), "$1<user>");
585
+ return out;
586
+ }
587
+ function redact(v, o = {}) {
588
+ if (typeof v === "string")
589
+ return redactText(v, o);
590
+ if (Array.isArray(v))
591
+ return v.map((x) => redact(x, o));
592
+ if (v && typeof v === "object") {
593
+ const out = {};
594
+ for (const [k, x] of Object.entries(v))
595
+ out[k] = SECRET_KEY2.test(k) ? "***" : redact(x, o);
596
+ return out;
597
+ }
598
+ return v;
599
+ }
600
+ var escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
601
+ function safeHome() {
602
+ try {
603
+ return homedir();
604
+ } catch {
605
+ return void 0;
606
+ }
607
+ }
608
+ function safeUser() {
609
+ try {
610
+ return userInfo().username;
611
+ } catch {
612
+ return void 0;
613
+ }
614
+ }
615
+ function rotate(file, max, keep) {
616
+ try {
617
+ if (statSync(file).size < max)
618
+ return;
619
+ } catch {
620
+ return;
621
+ }
622
+ rmSync(`${file}.${keep}`, { force: true });
623
+ for (let i = keep - 1; i >= 1; i--) {
624
+ try {
625
+ renameSync(`${file}.${i}`, `${file}.${i + 1}`);
626
+ } catch {
627
+ }
628
+ }
629
+ try {
630
+ renameSync(file, `${file}.1`);
631
+ } catch {
632
+ }
633
+ }
634
+ function logLevelFrom(env = process.env) {
635
+ const v = (env.ATTICUS_LOG ?? "").toLowerCase();
636
+ return v in ORDER ? v : "info";
637
+ }
638
+ function createLog(root, o = {}) {
639
+ const file = logFileOf(root);
640
+ const level = o.level ?? logLevelFrom();
641
+ const now = o.now ?? (() => /* @__PURE__ */ new Date());
642
+ const write = (lvl, event, fields) => {
643
+ if (ORDER[lvl] < ORDER[level])
644
+ return;
645
+ try {
646
+ mkdirSync(join2(file, ".."), { recursive: true });
647
+ ignoreLocalSync(root);
648
+ rotate(file, o.maxBytes ?? LOG_MAX_BYTES, o.keep ?? LOG_KEEP);
649
+ const entry = redact({ at: now().toISOString(), level: lvl, event, ...fields });
650
+ appendFileSync(file, `${JSON.stringify(entry)}
651
+ `, "utf8");
652
+ } catch {
653
+ }
654
+ };
655
+ return {
656
+ file,
657
+ debug: (e, f = {}) => write("debug", e, f),
658
+ info: (e, f = {}) => write("info", e, f),
659
+ warn: (e, f = {}) => write("warn", e, f),
660
+ error: (e, err, f = {}) => write("error", e, {
661
+ ...f,
662
+ error: err instanceof Error ? { name: err.name, message: err.message, stack: err.stack?.split("\n").slice(0, 25) } : { message: String(err) }
663
+ })
664
+ };
665
+ }
666
+ function ignoreLocalSync(root) {
667
+ const f = join2(root, ".atticus", ".gitignore");
668
+ const text = existsSync(f) ? readFileSync(f, "utf8") : "";
669
+ const have = new Set(text.split(/\r?\n/).map((l) => l.trim()));
670
+ const missing = LOCAL_ONLY.filter((l) => !have.has(l));
671
+ if (!missing.length)
672
+ return;
673
+ const prefix = text && !text.endsWith("\n") ? `${text}
674
+ ` : text;
675
+ const head = prefix ? "" : "# This machine's own files: never committed.\n";
676
+ writeFileSync(f, `${prefix}${head}${missing.join("\n")}
677
+ `, "utf8");
678
+ }
679
+ var NO_LOG = {
680
+ file: "",
681
+ debug: () => void 0,
682
+ info: () => void 0,
683
+ warn: () => void 0,
684
+ error: () => void 0
685
+ };
686
+
687
+ // packages/core/dist/process-trees.js
688
+ import { execFile, spawn } from "node:child_process";
689
+ import { constants as osConstants } from "node:os";
690
+ var live = /* @__PURE__ */ new Map();
691
+ var listeners = /* @__PURE__ */ new Set();
692
+ var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
693
+ var TREE_SIGNAL_GRACE_MS = 1e4;
694
+ var holds = 0;
695
+ var pending;
696
+ function stopTrackedTrees() {
697
+ for (const fn of listeners) {
698
+ try {
699
+ fn();
700
+ } catch {
701
+ }
702
+ }
703
+ for (const [, stop] of live) {
704
+ try {
705
+ stop("SIGTERM");
706
+ } catch {
707
+ }
708
+ }
709
+ }
710
+ function onStopping(fn) {
711
+ listeners.add(fn);
712
+ return () => listeners.delete(fn);
713
+ }
714
+ var own = /* @__PURE__ */ new Map();
715
+ function onAtticusSignal(sig, fn, o = {}) {
716
+ const set = own.get(sig) ?? /* @__PURE__ */ new Map();
717
+ own.set(sig, set);
718
+ let gone = false;
719
+ const off = (later = false) => {
720
+ if (gone)
721
+ return;
722
+ gone = true;
723
+ process.off(sig, h);
724
+ if (later)
725
+ setImmediate(() => set.delete(fn));
726
+ else
727
+ set.delete(fn);
728
+ };
729
+ const h = () => {
730
+ if (o.once)
731
+ off(true);
732
+ fn(sig);
733
+ };
734
+ set.set(fn, { fallback: o.fallback === true });
735
+ process.on(sig, h);
736
+ return () => off();
737
+ }
738
+ function atticusHandles(sig, except) {
739
+ for (const [fn, h] of own.get(sig) ?? [])
740
+ if (fn !== except && !h.fallback)
741
+ return true;
742
+ return false;
743
+ }
744
+ var stopPending = () => pending !== void 0;
745
+ var onSignal = (sig) => {
746
+ stopTrackedTrees();
747
+ if (atticusHandles(sig))
748
+ return;
749
+ if (!pending) {
750
+ pending = sig;
751
+ setTimeout(raise, TREE_SIGNAL_GRACE_MS).unref?.();
752
+ }
753
+ settle();
754
+ };
755
+ function raise() {
756
+ const sig = pending;
757
+ if (!sig)
758
+ return;
759
+ pending = void 0;
760
+ unhook();
761
+ try {
762
+ process.kill(process.pid, sig);
763
+ } catch {
764
+ process.exit(128 + (osConstants.signals[sig] ?? 1));
765
+ }
766
+ }
767
+ function settle() {
768
+ if (holds > 0 || live.size > 0)
769
+ return;
770
+ if (pending)
771
+ raise();
772
+ else
773
+ unhook();
774
+ }
775
+ var onExit = () => {
776
+ for (const [child, stop] of live) {
777
+ if (child.exitCode !== null || child.signalCode !== null)
778
+ continue;
779
+ try {
780
+ stop("SIGKILL");
781
+ } catch {
782
+ }
783
+ }
784
+ };
785
+ var hooked = false;
786
+ function hook() {
787
+ if (hooked)
788
+ return;
789
+ hooked = true;
790
+ for (const s of SIGNALS)
791
+ process.prependListener(s, onSignal);
792
+ process.on("exit", onExit);
793
+ }
794
+ function unhook() {
795
+ if (!hooked)
796
+ return;
797
+ hooked = false;
798
+ for (const s of SIGNALS)
799
+ process.off(s, onSignal);
800
+ process.off("exit", onExit);
801
+ }
802
+ function trackTree(child, stop = (s) => stopProcessGroup(child, s)) {
803
+ live.set(child, stop);
804
+ hook();
805
+ let done = false;
806
+ return () => {
807
+ if (done)
808
+ return;
809
+ done = true;
810
+ live.delete(child);
811
+ settle();
812
+ };
813
+ }
814
+ function holdStop() {
815
+ holds++;
816
+ hook();
817
+ let released = false;
818
+ return () => {
819
+ if (released)
820
+ return;
821
+ released = true;
822
+ holds--;
823
+ settle();
824
+ };
825
+ }
826
+ var trackedTrees = () => live.size;
827
+ function stopProcessGroup(child, signal = "SIGTERM") {
828
+ if (child.pid === void 0)
829
+ return;
830
+ if (process.platform === "win32") {
831
+ try {
832
+ spawn("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
833
+ windowsHide: true,
834
+ stdio: "ignore"
835
+ }).on("error", () => child.kill());
836
+ } catch {
837
+ child.kill();
838
+ }
839
+ return;
840
+ }
841
+ try {
842
+ process.kill(-child.pid, signal);
843
+ } catch {
844
+ child.kill(signal);
845
+ }
846
+ }
847
+ function processDescendants(pid) {
848
+ return new Promise((resolve2) => {
849
+ execFile("ps", ["-A", "-o", "pid=,ppid=,lstart="], { encoding: "utf8", timeout: 2e3, windowsHide: true }, (err, text) => {
850
+ if (err) {
851
+ resolve2(/* @__PURE__ */ new Map());
852
+ return;
853
+ }
854
+ const kids = /* @__PURE__ */ new Map();
855
+ for (const line of text.split("\n")) {
856
+ const m = /^\s*(\d+)\s+(\d+)\s*(.*)$/.exec(line);
857
+ if (!m)
858
+ continue;
859
+ const p = Number(m[1]);
860
+ const pp = Number(m[2]);
861
+ kids.set(pp, [...kids.get(pp) ?? [], { pid: p, start: m[3].trim() }]);
862
+ }
863
+ const out = /* @__PURE__ */ new Map();
864
+ const walk = (p) => {
865
+ for (const k of kids.get(p) ?? []) {
866
+ if (out.has(k.pid))
867
+ continue;
868
+ out.set(k.pid, k.start);
869
+ walk(k.pid);
870
+ }
871
+ };
872
+ walk(pid);
873
+ resolve2(out);
874
+ });
875
+ });
876
+ }
877
+ function processesNow() {
878
+ return new Promise((resolve2) => {
879
+ execFile("ps", ["-A", "-o", "pid=,lstart="], { encoding: "utf8", timeout: 2e3, windowsHide: true }, (err, text) => {
880
+ const out = /* @__PURE__ */ new Map();
881
+ if (!err)
882
+ for (const line of text.split("\n")) {
883
+ const m = /^\s*(\d+)\s*(.*)$/.exec(line);
884
+ if (m)
885
+ out.set(Number(m[1]), m[2].trim());
886
+ }
887
+ resolve2(out);
888
+ });
889
+ });
890
+ }
891
+ var TREE_KILL_AFTER_MS = 5e3;
892
+ function killProcessTree(child, signal = "SIGTERM") {
893
+ const pid = child.pid;
894
+ if (pid === void 0)
895
+ return;
896
+ if (process.platform === "win32" || signal === "SIGKILL") {
897
+ stopProcessGroup(child, signal === "SIGKILL" ? "SIGKILL" : "SIGTERM");
898
+ return;
899
+ }
900
+ const ended = () => child.exitCode !== null || child.signalCode !== null;
901
+ const send = (pids, s) => {
902
+ try {
903
+ process.kill(-pid, s);
904
+ } catch {
905
+ }
906
+ for (const p of pids)
907
+ try {
908
+ process.kill(p, s);
909
+ } catch {
910
+ }
911
+ };
912
+ void processDescendants(pid).then((first) => {
913
+ send([...first.keys(), ...ended() ? [] : [pid]], "SIGTERM");
914
+ let hardDone = false;
915
+ const hard = async () => {
916
+ if (hardDone)
917
+ return;
918
+ hardDone = true;
919
+ const now = await processesNow();
920
+ const still = [...first].filter(([p, start]) => now.get(p) === start).map(([p]) => p);
921
+ send([...still, ...ended() ? [] : [pid]], "SIGKILL");
922
+ };
923
+ const timer = setTimeout(() => void hard(), TREE_KILL_AFTER_MS);
924
+ timer.unref?.();
925
+ if (ended()) {
926
+ clearTimeout(timer);
927
+ void hard();
928
+ } else
929
+ child.once("exit", () => {
930
+ clearTimeout(timer);
931
+ void hard();
932
+ });
933
+ });
934
+ }
935
+
936
+ // packages/core/dist/run-log.js
937
+ import { createHash, randomBytes as randomBytes2 } from "node:crypto";
938
+ import { accessSync, appendFileSync as appendFileSync2, closeSync, constants as fsConstants, existsSync as existsSync2, fstatSync, lstatSync, mkdirSync as mkdirSync2, openSync, readdirSync, readFileSync as readFileSync2, readSync, renameSync as renameSync2, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
939
+ import { hostname as hostname2 } from "node:os";
940
+ import { join as join3 } from "node:path";
941
+ var RUN_LOG_KEEP = 50;
942
+ var RUN_LOG_MAX_BYTES = 2 * 1024 * 1024;
943
+ var RUN_LOG_LINE_MAX = 4e3;
944
+ var RUN_LOG_READ_MAX = 5e3;
945
+ var RUN_HEARTBEAT_MS = 3e4;
946
+ var RUN_SILENT_MS = 5 * 60 * 1e3;
947
+ var TERMINAL_RUN_ID = /^\d{8}-\d{6}-\d{1,10}-[0-9a-f]{4}$/;
948
+ var runLogsDirOf = (root) => join3(root, ".atticus", "logs", "runs");
949
+ var runningDirOf = (root) => join3(root, ".atticus", "logs", "running");
950
+ var all = true;
951
+ var only = (...c) => new Set(c);
952
+ var but = (...c) => ({ except: new Set(c) });
953
+ var RECORDED = {
954
+ // The long ones.
955
+ map: all,
956
+ scan: all,
957
+ verify: all,
958
+ upgrade: all,
959
+ reconcile: all,
960
+ "run-ready": all,
961
+ workspace: only("sync", "bring-in", "open", "prune"),
962
+ task: but("context"),
963
+ knowledge: only("scan", "find", "ask", "keep", "verify", "correct", "reject"),
964
+ handoff: only("done"),
965
+ index: only("rebuild", "embed"),
966
+ // A change, from its start to its archive, and what it asks of people.
967
+ change: but("status", "list", "knowledge", "similar", "impact", "conflicts", "estimate", "map"),
968
+ initiative: but("status"),
969
+ questions: but("list", "show", "proposed", "decisions"),
970
+ critic: all,
971
+ finding: all,
972
+ plan: all,
973
+ stories: all,
974
+ needs: only("done", "skip", "reopen"),
975
+ todo: only("done", "run"),
976
+ ado: all,
977
+ release: all,
978
+ outcome: only("record"),
979
+ tests: only("generate"),
980
+ spec: only("draft", "seed", "accept", "hand-down", "hand-up"),
981
+ feature: but("list", "show"),
982
+ triage: only("decide"),
983
+ alias: all,
984
+ // The estate, the org pack and what Atticus learns.
985
+ baseline: all,
986
+ repo: all,
987
+ "repo-type": only("new", "note", "rules"),
988
+ rules: only("add", "activate", "off", "draft", "try", "import"),
989
+ types: only("add"),
990
+ skills: only("import", "write"),
991
+ connect: all,
992
+ join: all,
993
+ estate: only("join", "measure", "shared", "contracts"),
994
+ sources: only("sync", "tag", "refresh"),
995
+ glossary: only("scan", "define", "link", "alias"),
996
+ intake: only("add", "traffic"),
997
+ patterns: only("scan"),
998
+ defences: only("scan"),
999
+ onboard: but("check"),
1000
+ frameworks: all,
1001
+ dialect: only("new", "kit"),
1002
+ plugin: all,
1003
+ absorb: all,
1004
+ orgpack: only("draft", "accept", "owner"),
1005
+ standards: all,
1006
+ openspec: only("setup"),
1007
+ templates: only("draft"),
1008
+ // ADR 0195: the build's commands write the catalog and its slots; the cross-check its dismissals.
1009
+ catalog: only("migrate", "build", "edits", "undo", "prune", "crosscheck"),
1010
+ diagram: all,
1011
+ "assistant-files": all,
1012
+ site: only("build"),
1013
+ init: all,
1014
+ adopt: all,
1015
+ unadopt: all,
1016
+ support: only("bundle"),
1017
+ probe: all,
1018
+ eval: only("run"),
1019
+ bench: all
1020
+ };
1021
+ var NOT_RECORDED_FLAGS = /* @__PURE__ */ new Set(["help", "version", "check", "dry-run"]);
1022
+ var QUICK = /* @__PURE__ */ new Set(["map render", "verify audit", "scan review", "critic stats"]);
1023
+ var WRITES_WITH = {
1024
+ "catalog edits": ["curate"],
1025
+ "catalog undo": ["yes"],
1026
+ "catalog prune": ["yes"],
1027
+ "catalog crosscheck": ["dismiss", "undismiss", "promote"]
1028
+ };
1029
+ function recordedCommand(positionals, flags) {
1030
+ const [group, command] = positionals;
1031
+ if (!group || flags.some((f) => NOT_RECORDED_FLAGS.has(f)))
1032
+ return false;
1033
+ if (command && QUICK.has(`${group} ${command}`))
1034
+ return false;
1035
+ const writes = command ? WRITES_WITH[`${group} ${command}`] : void 0;
1036
+ if (writes && !flags.some((f) => writes.includes(f)))
1037
+ return false;
1038
+ const rule = RECORDED[group];
1039
+ if (rule === void 0)
1040
+ return false;
1041
+ if (rule === true)
1042
+ return true;
1043
+ if (!command)
1044
+ return false;
1045
+ return rule instanceof Set ? rule.has(command) : !rule.except.has(command);
1046
+ }
1047
+ var MAX_WORDS = 8;
1048
+ var WHERE_FLAGS = /* @__PURE__ */ new Set(["root", "metarepo"]);
1049
+ var TITLE_VALUE_FLAGS = /* @__PURE__ */ new Set([
1050
+ "area",
1051
+ "audience",
1052
+ "base",
1053
+ "by",
1054
+ "change",
1055
+ "component",
1056
+ "depth",
1057
+ "epic",
1058
+ "estate",
1059
+ "format",
1060
+ "framework",
1061
+ "gate",
1062
+ "group",
1063
+ "hops",
1064
+ "iteration",
1065
+ "journey",
1066
+ "kind",
1067
+ "language",
1068
+ "lens",
1069
+ "level",
1070
+ "limit",
1071
+ "mode",
1072
+ "model",
1073
+ "models",
1074
+ "owner",
1075
+ "platform",
1076
+ "pr",
1077
+ "release",
1078
+ "repo",
1079
+ "repos",
1080
+ "round",
1081
+ "run",
1082
+ "scope",
1083
+ "state",
1084
+ "step",
1085
+ "story",
1086
+ "system",
1087
+ "tag",
1088
+ "target",
1089
+ "task",
1090
+ "team",
1091
+ "template",
1092
+ "type"
1093
+ ]);
1094
+ var TITLE_VALUE_MAX = 48;
1095
+ var HANDLE = /^@[\w.-]+$/;
1096
+ var LONG_RUN = /[0-9a-f]{16,}|[0-9A-F]{16,}|\d{9,}|\d{4}(?:[ -]?\d{4}){3}|\b\d{3}-\d{2}-\d{4}\b/;
1097
+ var WORK_ITEM_SYSTEMS = ["ado", "jira"];
1098
+ var WORK_ITEM_REF = new RegExp(`^(?:${WORK_ITEM_SYSTEMS.join("|")}):(?:\\d{1,7}|[A-Z][A-Z0-9]{1,9}-\\d{1,7})$`);
1099
+ var ID_FORMS = [
1100
+ /^\d{4}-\d{2}-\d{2}$/,
1101
+ /^v?\d{1,3}\.\d{1,3}\.\d{1,3}(?:-[a-z]{1,12}(?:\.\d{1,3})?)?$/,
1102
+ /^\d{1,3}(?:\.\d{1,3}){1,2}$/,
1103
+ /^q-[0-9a-f]{1,12}$/,
1104
+ /^run-\d{14}-(?:\d{4}|[0-9a-f]{6})$/,
1105
+ TERMINAL_RUN_ID,
1106
+ /^[a-z]{1,24}(?:[-.](?:[a-z]{1,24}\d{0,3}|\d{1,4}))+$/,
1107
+ WORK_ITEM_REF
1108
+ ];
1109
+ var LINK_REF = /^link:([^:]+):([^:]+)$/;
1110
+ var PART = /^(?:[a-z]{1,24}\d{0,3}|[A-Z][a-z]{1,23}|[A-Z]{1,8}|\d{1,6})$/;
1111
+ function idShaped(w) {
1112
+ if (!w || w.length > 100)
1113
+ return false;
1114
+ if (!w.split(/[-._/]/).every((p) => PART.test(p)))
1115
+ return false;
1116
+ return (w.match(/\d+/g) ?? []).length <= 1;
1117
+ }
1118
+ function titleWord(word, redact2 = {}) {
1119
+ if (!word || word.length > 100 || /[\s\\]/.test(word) || word.includes("//"))
1120
+ return void 0;
1121
+ const handle = HANDLE.test(word);
1122
+ if (word.includes("@") && !handle)
1123
+ return void 0;
1124
+ if (hasTokenPrefix(word) || hasSecretShape(word))
1125
+ return void 0;
1126
+ if (redactText(word, redact2) !== word)
1127
+ return void 0;
1128
+ const bare = handle ? word.slice(1) : word;
1129
+ if (ID_FORMS.some((re) => re.test(bare)))
1130
+ return word;
1131
+ const link2 = LINK_REF.exec(bare);
1132
+ if (link2)
1133
+ return idShaped(link2[1]) && idShaped(link2[2]) ? word : void 0;
1134
+ if (bare.includes(":") || LONG_RUN.test(bare) || keyIsSecret(bare))
1135
+ return void 0;
1136
+ return idShaped(bare) ? word : void 0;
1137
+ }
1138
+ function titleValue(flag, value, redact2 = {}) {
1139
+ if (value === void 0 || !value || !TITLE_VALUE_FLAGS.has(flag))
1140
+ return void 0;
1141
+ if (value.includes(":") || value.startsWith("-") || value.length > 400)
1142
+ return void 0;
1143
+ if (!value.split(",").every((i) => titleWord(i, redact2) !== void 0))
1144
+ return void 0;
1145
+ if (hasSecretShape(value) || keyIsSecret(value))
1146
+ return void 0;
1147
+ return value.length > TITLE_VALUE_MAX ? `${value.slice(0, TITLE_VALUE_MAX)}\u2026` : value;
1148
+ }
1149
+ function runTitle(positionals, flags, values = {}, redact2 = {}) {
1150
+ const command = [];
1151
+ const add = (w) => {
1152
+ if (w !== "\u2026" || command.at(-1) !== "\u2026")
1153
+ command.push(w);
1154
+ };
1155
+ for (const w of positionals.slice(0, MAX_WORDS))
1156
+ add(titleWord(w, redact2) ?? "\u2026");
1157
+ if (positionals.length > MAX_WORDS)
1158
+ add("\u2026");
1159
+ const names = flags.filter((f) => /^[a-z][a-z0-9-]{0,40}$/.test(f) && !WHERE_FLAGS.has(f)).map((f) => {
1160
+ const v = Object.hasOwn(values, f) ? titleValue(f, values[f], redact2) : void 0;
1161
+ return v === void 0 ? `--${f}` : `--${f} ${v}`;
1162
+ });
1163
+ if (flags.includes("\u2026"))
1164
+ names.push("--\u2026");
1165
+ return { command, title: ["atticus", ...command, ...names].join(" ") };
1166
+ }
1167
+ var APP_JOB_WORDS = {
1168
+ scan: "Scan",
1169
+ sync: "Sync",
1170
+ reconcile: "Reconcile",
1171
+ index: "Index",
1172
+ intake: "Intake",
1173
+ step: "AI step",
1174
+ local: "Local step",
1175
+ work: "Request"
1176
+ };
1177
+ function appRunTitle(kind, ids = [], redact2 = {}) {
1178
+ const kept = [];
1179
+ for (const id of ids.slice(0, MAX_WORDS)) {
1180
+ const w = titleWord(id, redact2) ?? "\u2026";
1181
+ if (w !== "\u2026" || kept.at(-1) !== "\u2026")
1182
+ kept.push(w);
1183
+ }
1184
+ if (ids.length > MAX_WORDS && kept.at(-1) !== "\u2026")
1185
+ kept.push("\u2026");
1186
+ const words = Object.hasOwn(APP_JOB_WORDS, kind) ? APP_JOB_WORDS[kind] : "Job";
1187
+ return { title: [words, ...kept].join(" "), ids: kept };
1188
+ }
1189
+ function runLogKept(root, env = process.env) {
1190
+ if (env.ATTICUS_RUN_LOG === "off")
1191
+ return false;
1192
+ return isMetarepoRoot(root);
1193
+ }
1194
+ function isMetarepoRoot(root) {
1195
+ return existsSync2(join3(root, "org-pack")) || existsSync2(join3(root, ".atticus", "org-pack"));
1196
+ }
1197
+ var RETITLED_MARK = ".retitled-beta27";
1198
+ var RETITLE_MAX_BYTES = 1024 * 1024;
1199
+ var RETITLE_MAX_RECORDS = 1e3;
1200
+ var RETITLE_WAIT_MS = 7 * 24 * 60 * 60 * 1e3;
1201
+ var retitleTried = /* @__PURE__ */ new Set();
1202
+ function readSmallFile(file, max) {
1203
+ const before = lstatSync(file, { throwIfNoEntry: false });
1204
+ if (!before?.isFile() || before.size > max)
1205
+ return void 0;
1206
+ const fd = openSync(file, fsConstants.O_RDONLY | (fsConstants.O_NOFOLLOW ?? 0) | (fsConstants.O_NONBLOCK ?? 0));
1207
+ try {
1208
+ const st = fstatSync(fd);
1209
+ if (!st.isFile() || st.size > max)
1210
+ return void 0;
1211
+ const buf = Buffer.alloc(st.size);
1212
+ let at = 0;
1213
+ while (at < buf.length) {
1214
+ const n = readSync(fd, buf, at, buf.length - at, at);
1215
+ if (n <= 0)
1216
+ break;
1217
+ at += n;
1218
+ }
1219
+ return buf.subarray(0, at).toString("utf8");
1220
+ } finally {
1221
+ closeSync(fd);
1222
+ }
1223
+ }
1224
+ function retitleTerminalRuns(root, retitle) {
1225
+ const dir = runningDirOf(root);
1226
+ const mark = join3(dir, RETITLED_MARK);
1227
+ if (retitleTried.has(dir))
1228
+ return 0;
1229
+ let names;
1230
+ try {
1231
+ if (lstatSync(mark, { throwIfNoEntry: false }))
1232
+ return 0;
1233
+ if (!lstatSync(dir, { throwIfNoEntry: false })?.isDirectory())
1234
+ return 0;
1235
+ accessSync(dir, fsConstants.W_OK);
1236
+ names = readdirSync(dir).filter((n) => n.endsWith(".json") && TERMINAL_RUN_ID.test(n.slice(0, -5))).sort().slice(-RETITLE_MAX_RECORDS);
1237
+ } catch {
1238
+ return 0;
1239
+ }
1240
+ let changed = 0;
1241
+ let later = false;
1242
+ const here = hostHash();
1243
+ const now = Date.now();
1244
+ const settling = (file) => {
1245
+ try {
1246
+ const st = lstatSync(file, { throwIfNoEntry: false });
1247
+ return !!st?.isFile() && st.size <= RETITLE_MAX_BYTES && Math.abs(now - st.mtimeMs) <= RETITLE_WAIT_MS;
1248
+ } catch {
1249
+ return false;
1250
+ }
1251
+ };
1252
+ for (const n of names) {
1253
+ const file = join3(dir, n);
1254
+ const id = n.slice(0, -5);
1255
+ try {
1256
+ const text = readSmallFile(file, RETITLE_MAX_BYTES);
1257
+ if (text === void 0) {
1258
+ if (settling(file))
1259
+ later = true;
1260
+ continue;
1261
+ }
1262
+ const raw = JSON.parse(text);
1263
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
1264
+ continue;
1265
+ if (raw.state === "running") {
1266
+ const r = readRecord(root, id);
1267
+ if (r && !goneRun(r, here, pidAlive, now, root)) {
1268
+ later = true;
1269
+ continue;
1270
+ }
1271
+ }
1272
+ const words = Array.isArray(raw.command) ? raw.command.map((w) => `${w}`) : [];
1273
+ if (raw.startedBy === "app" && !words.length) {
1274
+ const job = raw.job && typeof raw.job === "object" ? raw.job : {};
1275
+ const kind = typeof job.kind === "string" ? job.kind : "";
1276
+ const ids = Array.isArray(job.ids) ? job.ids.map((w) => `${w}`) : [];
1277
+ const got2 = appRunTitle(kind, ids);
1278
+ const next2 = {
1279
+ ...raw,
1280
+ title: got2.title,
1281
+ command: [],
1282
+ ...raw.job && typeof raw.job === "object" ? { job: { ...job, ...got2.ids.length ? { ids: got2.ids } : {} } } : {}
1283
+ };
1284
+ if (!got2.ids.length && next2.job)
1285
+ delete next2.job.ids;
1286
+ if (JSON.stringify(next2) === JSON.stringify(raw))
1287
+ continue;
1288
+ writeJson(file, next2);
1289
+ changed++;
1290
+ continue;
1291
+ }
1292
+ if (words[0] === "secret" || words[0] === "legacy" && words[1] === "secret") {
1293
+ try {
1294
+ rmSync2(join3(runLogsDirOf(root), `${id}.log`), { force: true });
1295
+ rmSync2(file, { force: true });
1296
+ changed++;
1297
+ } catch {
1298
+ later = true;
1299
+ }
1300
+ continue;
1301
+ }
1302
+ if (typeof raw.title !== "string")
1303
+ continue;
1304
+ const flags = Array.isArray(raw.flags) ? raw.flags.map((f) => `${f}`) : [];
1305
+ const got = retitle({ command: words, flags });
1306
+ const next = { ...raw, title: got.title, command: got.command };
1307
+ if (got.flags)
1308
+ next.flags = got.flags;
1309
+ if (JSON.stringify(next) === JSON.stringify(raw))
1310
+ continue;
1311
+ writeJson(file, next);
1312
+ changed++;
1313
+ } catch {
1314
+ if (settling(file))
1315
+ later = true;
1316
+ }
1317
+ }
1318
+ if (later)
1319
+ return changed;
1320
+ try {
1321
+ writeFileSync2(mark, `${(/* @__PURE__ */ new Date()).toISOString()}
1322
+ `, { encoding: "utf8", flag: "wx" });
1323
+ } catch {
1324
+ retitleTried.add(dir);
1325
+ }
1326
+ return changed;
1327
+ }
1328
+ function startedByOf(env = process.env) {
1329
+ if (env.ATTICUS_ACP_SESSION)
1330
+ return "copilot";
1331
+ const said = env.ATTICUS_STARTED_BY;
1332
+ if (said === "vscode" || said === "intellij" || said === "terminal")
1333
+ return said;
1334
+ if (env.TERM_PROGRAM === "vscode")
1335
+ return "vscode";
1336
+ if ((env.TERMINAL_EMULATOR ?? "").startsWith("JetBrains"))
1337
+ return "intellij";
1338
+ return "terminal";
1339
+ }
1340
+ var hostHash = () => {
1341
+ try {
1342
+ return createHash("sha256").update(hostname2()).digest("hex").slice(0, 12);
1343
+ } catch {
1344
+ return "unknown";
1345
+ }
1346
+ };
1347
+ function procStartOf(pid) {
1348
+ if (process.platform !== "linux")
1349
+ return void 0;
1350
+ try {
1351
+ const stat2 = readFileSync2(`/proc/${pid}/stat`, "utf8");
1352
+ const v = stat2.slice(stat2.lastIndexOf(")") + 2).split(" ")[19];
1353
+ return v && /^\d+$/.test(v) ? v : void 0;
1354
+ } catch {
1355
+ return void 0;
1356
+ }
1357
+ }
1358
+ var pad = (n, w = 2) => String(n).padStart(w, "0");
1359
+ var idAt = (d, pid) => `${d.getUTCFullYear()}${pad(d.getUTCMonth() + 1)}${pad(d.getUTCDate())}-${pad(d.getUTCHours())}${pad(d.getUTCMinutes())}${pad(d.getUTCSeconds())}-${pid}-${randomBytes2(2).toString("hex")}`;
1360
+ var ANSI = /\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b\][^\u0007]*\u0007/g;
1361
+ function runLogLines(text, o = {}) {
1362
+ return text.replace(ANSI, "").split(/\r?\n|\r/).map((l) => {
1363
+ const r = maskSecretShapes(redactText(l, o));
1364
+ return r.length > RUN_LOG_LINE_MAX ? `${r.slice(0, RUN_LOG_LINE_MAX)}\u2026` : r;
1365
+ });
1366
+ }
1367
+ var writeJson = (file, v) => {
1368
+ const text = `${JSON.stringify(v, null, 2)}
1369
+ `;
1370
+ const tmp = `${file}.${process.pid}.tmp`;
1371
+ try {
1372
+ rmSync2(tmp, { force: true });
1373
+ writeFileSync2(tmp, text, { encoding: "utf8", flag: "wx" });
1374
+ renameSync2(tmp, file);
1375
+ } catch {
1376
+ rmSync2(tmp, { force: true });
1377
+ if (lstatSync(file, { throwIfNoEntry: false })?.isSymbolicLink())
1378
+ return;
1379
+ writeFileSync2(file, text, "utf8");
1380
+ }
1381
+ };
1382
+ function prune(root, keep, live2) {
1383
+ let names;
1384
+ try {
1385
+ names = readdirSync(runningDirOf(root)).filter((n) => n.endsWith(".json") && TERMINAL_RUN_ID.test(n.slice(0, -5))).sort();
1386
+ } catch {
1387
+ return;
1388
+ }
1389
+ const removed = /* @__PURE__ */ new Set();
1390
+ let over = names.length - keep;
1391
+ for (const n of names) {
1392
+ if (over <= 0)
1393
+ break;
1394
+ const id = n.slice(0, -5);
1395
+ if (live2(id))
1396
+ continue;
1397
+ rmSync2(join3(runningDirOf(root), n), { force: true });
1398
+ rmSync2(join3(runLogsDirOf(root), `${id}.log`), { force: true });
1399
+ removed.add(id);
1400
+ over--;
1401
+ }
1402
+ try {
1403
+ const kept = new Set(names.map((n) => n.slice(0, -5)).filter((id) => !removed.has(id)));
1404
+ for (const n of readdirSync(runLogsDirOf(root)))
1405
+ if (n.endsWith(".log") && TERMINAL_RUN_ID.test(n.slice(0, -4)) && !kept.has(n.slice(0, -4)))
1406
+ rmSync2(join3(runLogsDirOf(root), n), { force: true });
1407
+ } catch {
1408
+ }
1409
+ }
1410
+ function startTerminalRun(root, o) {
1411
+ const now = o.now ?? (() => /* @__PURE__ */ new Date());
1412
+ const pid = o.pid ?? process.pid;
1413
+ const keep = Math.max(o.keep ?? RUN_LOG_KEEP, 1);
1414
+ const maxBytes = Math.max(o.maxBytes ?? RUN_LOG_MAX_BYTES, 256);
1415
+ const started = now();
1416
+ let runId = idAt(started, pid);
1417
+ for (let n = 0; n < 8 && existsSync2(join3(runningDirOf(root), `${runId}.json`)); n++)
1418
+ runId = idAt(started, pid);
1419
+ const heartbeatMs = o.heartbeatMs ?? (o.hookProcess ? RUN_HEARTBEAT_MS : void 0);
1420
+ const procStart = o.procStart ? o.procStart() : pid === process.pid ? procStartOf(pid) : void 0;
1421
+ const app = o.app && !o.app.command ? appRunTitle(o.app.job.kind, o.app.ids, o.redact) : void 0;
1422
+ const { command, title } = app ? { command: [], title: app.title } : runTitle(o.positionals, o.flags, o.values, o.redact);
1423
+ const rec = {
1424
+ schemaVersion: 1,
1425
+ runId,
1426
+ pid,
1427
+ host: hostHash(),
1428
+ title,
1429
+ command,
1430
+ flags: o.flags.filter((f) => /^[a-z][a-z0-9-]{0,40}$/.test(f)),
1431
+ startedBy: o.app ? "app" : startedByOf(o.env),
1432
+ startedAt: started.toISOString(),
1433
+ state: "running",
1434
+ lines: 0,
1435
+ dropped: 0,
1436
+ ...procStart ? { procStart } : {},
1437
+ ...heartbeatMs ? { beatAt: started.toISOString() } : {},
1438
+ ...o.app ? {
1439
+ job: {
1440
+ id: o.app.job.id,
1441
+ kind: o.app.job.kind,
1442
+ ...app?.ids.length ? { ids: app.ids } : {}
1443
+ }
1444
+ } : {}
1445
+ };
1446
+ const jsonFile = join3(runningDirOf(root), `${runId}.json`);
1447
+ const logFile = join3(runLogsDirOf(root), `${runId}.log`);
1448
+ try {
1449
+ mkdirSync2(runningDirOf(root), { recursive: true });
1450
+ mkdirSync2(runLogsDirOf(root), { recursive: true });
1451
+ ignoreLocalSync(root);
1452
+ const alive2 = o.alive ?? pidAlive;
1453
+ prune(root, keep - 1, (id) => {
1454
+ const r = readRecord(root, id);
1455
+ return !!r && r.state === "running" && !goneRun(r, rec.host, alive2, now().getTime(), root);
1456
+ });
1457
+ writeFileSync2(logFile, "", "utf8");
1458
+ writeJson(jsonFile, rec);
1459
+ } catch {
1460
+ return void 0;
1461
+ }
1462
+ let bytes = 0;
1463
+ let inFile = 0;
1464
+ let ended = false;
1465
+ let broken = false;
1466
+ const save = () => {
1467
+ try {
1468
+ if (heartbeatMs && !ended)
1469
+ rec.beatAt = now().toISOString();
1470
+ writeJson(jsonFile, { ...rec, lines: rec.dropped + inFile });
1471
+ } catch {
1472
+ }
1473
+ };
1474
+ const trim = () => {
1475
+ const all2 = readFileSync2(logFile, "utf8").split("\n");
1476
+ if (all2.at(-1) === "")
1477
+ all2.pop();
1478
+ let size = 0;
1479
+ let at = all2.length;
1480
+ while (at > 0 && size + Buffer.byteLength(all2[at - 1]) + 1 <= maxBytes / 2) {
1481
+ size += Buffer.byteLength(all2[at - 1]) + 1;
1482
+ at--;
1483
+ }
1484
+ const kept = all2.slice(at);
1485
+ const tmp = `${logFile}.${process.pid}.tmp`;
1486
+ const text = kept.length ? `${kept.join("\n")}
1487
+ ` : "";
1488
+ try {
1489
+ writeFileSync2(tmp, text, "utf8");
1490
+ renameSync2(tmp, logFile);
1491
+ } catch {
1492
+ rmSync2(tmp, { force: true });
1493
+ writeFileSync2(logFile, text, "utf8");
1494
+ }
1495
+ rec.dropped += at;
1496
+ inFile = kept.length;
1497
+ bytes = size;
1498
+ save();
1499
+ };
1500
+ const unhook2 = [];
1501
+ if (heartbeatMs) {
1502
+ const beat = setInterval(() => {
1503
+ if (!ended)
1504
+ save();
1505
+ }, heartbeatMs);
1506
+ beat.unref?.();
1507
+ unhook2.push(() => clearInterval(beat));
1508
+ }
1509
+ const recorder = {
1510
+ runId,
1511
+ line(text) {
1512
+ if (ended || broken)
1513
+ return;
1514
+ try {
1515
+ for (const l of runLogLines(text, o.redact)) {
1516
+ const s = `${l}
1517
+ `;
1518
+ const n = Buffer.byteLength(s);
1519
+ if (bytes + n > maxBytes)
1520
+ trim();
1521
+ appendFileSync2(logFile, s, "utf8");
1522
+ bytes += n;
1523
+ inFile++;
1524
+ }
1525
+ } catch {
1526
+ broken = true;
1527
+ }
1528
+ },
1529
+ end(code, how) {
1530
+ if (ended)
1531
+ return;
1532
+ ended = true;
1533
+ for (const u of unhook2)
1534
+ u();
1535
+ rec.state = how === "crash" ? "failed" : code === 0 ? "done" : code === 130 || code === 143 ? "cancelled" : "failed";
1536
+ rec.exitCode = code;
1537
+ if (how === "app-closed")
1538
+ rec.appClosed = true;
1539
+ rec.finishedAt = now().toISOString();
1540
+ save();
1541
+ }
1542
+ };
1543
+ if (o.hookProcess) {
1544
+ const onExit2 = (code) => recorder.end(typeof code === "number" ? code : 1);
1545
+ process.once("exit", onExit2);
1546
+ unhook2.push(() => process.off("exit", onExit2));
1547
+ for (const [sig, code] of [
1548
+ ["SIGINT", 130],
1549
+ ["SIGTERM", 143]
1550
+ ]) {
1551
+ const on = () => {
1552
+ if (atticusHandles(sig, on) || stopPending())
1553
+ return;
1554
+ recorder.end(code);
1555
+ process.exit(code);
1556
+ };
1557
+ unhook2.push(onAtticusSignal(sig, on, { fallback: true }));
1558
+ }
1559
+ }
1560
+ return recorder;
1561
+ }
1562
+ function startAppRun(root, o) {
1563
+ return startTerminalRun(root, {
1564
+ positionals: o.command?.positionals ?? [],
1565
+ flags: o.command?.flags ?? [],
1566
+ ...o.command?.values ? { values: o.command.values } : {},
1567
+ app: { job: o.job, ...o.ids ? { ids: o.ids } : {}, ...o.command ? { command: true } : {} },
1568
+ heartbeatMs: o.heartbeatMs ?? RUN_HEARTBEAT_MS,
1569
+ ...o.now ? { now: o.now } : {},
1570
+ ...o.redact ? { redact: o.redact } : {}
1571
+ });
1572
+ }
1573
+ function pidAlive(pid) {
1574
+ try {
1575
+ process.kill(pid, 0);
1576
+ return true;
1577
+ } catch (e) {
1578
+ return e.code === "EPERM";
1579
+ }
1580
+ }
1581
+ var DAY = 24 * 60 * 60 * 1e3;
1582
+ var mtimeOf = (file) => {
1583
+ try {
1584
+ return statSync2(file).mtimeMs;
1585
+ } catch {
1586
+ return 0;
1587
+ }
1588
+ };
1589
+ function goneRun(r, here, alive2, now, root, startOf = procStartOf) {
1590
+ const age = now - Date.parse(r.startedAt);
1591
+ if (r.host !== here)
1592
+ return age > 2 * DAY;
1593
+ if (!alive2(r.pid) || age > 7 * DAY)
1594
+ return true;
1595
+ const started = r.procStart ? startOf(r.pid) : void 0;
1596
+ if (started !== void 0)
1597
+ return started !== r.procStart;
1598
+ if (r.beatAt) {
1599
+ const last = Math.max(Date.parse(r.beatAt) || 0, mtimeOf(join3(runLogsDirOf(root), `${r.runId}.log`)));
1600
+ return now - last > RUN_SILENT_MS;
1601
+ }
1602
+ return false;
1603
+ }
1604
+ function readRecord(root, runId) {
1605
+ if (!TERMINAL_RUN_ID.test(runId))
1606
+ return void 0;
1607
+ try {
1608
+ const r = JSON.parse(readFileSync2(join3(runningDirOf(root), `${runId}.json`), "utf8"));
1609
+ if (r.schemaVersion !== 1 || r.runId !== runId || typeof r.title !== "string" || typeof r.startedAt !== "string" || typeof r.pid !== "number" || !["running", "done", "failed", "cancelled"].includes(r.state))
1610
+ return void 0;
1611
+ const { job, appClosed, ...rest } = r;
1612
+ const jobOk = !!job && typeof job === "object" && typeof job.id === "string" && typeof job.kind === "string";
1613
+ return {
1614
+ ...rest,
1615
+ command: Array.isArray(r.command) ? r.command.map(String) : [],
1616
+ flags: Array.isArray(r.flags) ? r.flags.map(String) : [],
1617
+ lines: Number(r.lines) || 0,
1618
+ dropped: Number(r.dropped) || 0,
1619
+ ...typeof r.procStart === "string" ? { procStart: r.procStart } : {},
1620
+ ...typeof r.beatAt === "string" ? { beatAt: r.beatAt } : {},
1621
+ ...jobOk ? { job: { id: job.id, kind: job.kind } } : {},
1622
+ ...appClosed === true ? { appClosed: true } : {}
1623
+ };
1624
+ } catch {
1625
+ return void 0;
1626
+ }
1627
+ }
1628
+ function readTerminalRuns(root, o = {}) {
1629
+ let names;
1630
+ try {
1631
+ names = readdirSync(runningDirOf(root));
1632
+ } catch {
1633
+ return [];
1634
+ }
1635
+ const here = hostHash();
1636
+ const alive2 = o.alive ?? pidAlive;
1637
+ const now = (o.now ?? (() => /* @__PURE__ */ new Date()))().getTime();
1638
+ const out = [];
1639
+ for (const n of names.sort().reverse()) {
1640
+ if (!n.endsWith(".json"))
1641
+ continue;
1642
+ const r = readRecord(root, n.slice(0, -5));
1643
+ if (!r)
1644
+ continue;
1645
+ if (r.state === "running") {
1646
+ if (goneRun(r, here, alive2, now, root, o.startOf)) {
1647
+ out.push({ ...r, stale: true });
1648
+ continue;
1649
+ }
1650
+ }
1651
+ out.push(r);
1652
+ }
1653
+ return out;
1654
+ }
1655
+ var readTerminalRun = (root, runId, o = {}) => TERMINAL_RUN_ID.test(runId) ? readTerminalRuns(root, o).find((r) => r.runId === runId) : void 0;
1656
+ function readTerminalRunLines(root, runId, from, max = RUN_LOG_READ_MAX) {
1657
+ const r = readRecord(root, runId);
1658
+ if (!r)
1659
+ return void 0;
1660
+ let text;
1661
+ try {
1662
+ text = readFileSync2(join3(runLogsDirOf(root), `${runId}.log`), "utf8");
1663
+ } catch {
1664
+ text = "";
1665
+ }
1666
+ const all2 = text.split("\n");
1667
+ all2.pop();
1668
+ const total = r.dropped + all2.length;
1669
+ const start = from === void 0 ? Math.max(total - max, r.dropped) : Math.max(Math.min(from, total), r.dropped);
1670
+ const lines = all2.slice(start - r.dropped, start - r.dropped + max);
1671
+ return { from: start, lines, total };
1672
+ }
1673
+ function linesIn(buf, skip, max) {
1674
+ const lines = [];
1675
+ let at = 0;
1676
+ let n = 0;
1677
+ while (at < buf.length) {
1678
+ const nl = buf.indexOf(10, at);
1679
+ if (nl < 0)
1680
+ break;
1681
+ if (n >= skip) {
1682
+ if (lines.length >= max)
1683
+ return { lines, end: at, more: true };
1684
+ lines.push(buf.toString("utf8", at, nl));
1685
+ }
1686
+ n++;
1687
+ at = nl + 1;
1688
+ }
1689
+ return { lines, end: at, more: false };
1690
+ }
1691
+ function readFrom(file, from, size) {
1692
+ const buf = Buffer.alloc(Math.max(size - from, 0));
1693
+ if (!buf.length)
1694
+ return buf;
1695
+ const fd = openSync(file, "r");
1696
+ try {
1697
+ let got = 0;
1698
+ while (got < buf.length) {
1699
+ const n = readSync(fd, buf, got, buf.length - got, from + got);
1700
+ if (n <= 0)
1701
+ break;
1702
+ got += n;
1703
+ }
1704
+ return got < buf.length ? buf.subarray(0, got) : buf;
1705
+ } finally {
1706
+ closeSync(fd);
1707
+ }
1708
+ }
1709
+ function tailTerminalRunLines(root, runId, at, max = RUN_LOG_READ_MAX) {
1710
+ const file = join3(runLogsDirOf(root), `${runId}.log`);
1711
+ for (let tries = 0; ; tries++) {
1712
+ const r = readRecord(root, runId);
1713
+ if (!r)
1714
+ return void 0;
1715
+ let size = 0;
1716
+ let ino = 0;
1717
+ try {
1718
+ const st = statSync2(file);
1719
+ size = st.size;
1720
+ ino = st.ino;
1721
+ } catch {
1722
+ }
1723
+ if (at && at.dropped === r.dropped && at.ino === ino && size >= at.bytes) {
1724
+ let buf2;
1725
+ try {
1726
+ buf2 = readFrom(file, at.bytes, size);
1727
+ } catch {
1728
+ buf2 = Buffer.alloc(0);
1729
+ }
1730
+ const got2 = linesIn(buf2, 0, max);
1731
+ return {
1732
+ from: at.line,
1733
+ lines: got2.lines,
1734
+ at: {
1735
+ line: at.line + got2.lines.length,
1736
+ bytes: at.bytes + got2.end,
1737
+ dropped: r.dropped,
1738
+ ino
1739
+ },
1740
+ more: got2.more
1741
+ };
1742
+ }
1743
+ let buf;
1744
+ try {
1745
+ buf = readFileSync2(file);
1746
+ } catch {
1747
+ buf = Buffer.alloc(0);
1748
+ }
1749
+ const again = readRecord(root, runId);
1750
+ if (again && again.dropped !== r.dropped && tries < 1)
1751
+ continue;
1752
+ let count = 0;
1753
+ for (let i = buf.indexOf(10); i >= 0; i = buf.indexOf(10, i + 1))
1754
+ count++;
1755
+ const total = r.dropped + count;
1756
+ const start = at === void 0 ? Math.max(total - max, r.dropped) : Math.max(Math.min(at.line, total), r.dropped);
1757
+ const got = linesIn(buf, start - r.dropped, max);
1758
+ return {
1759
+ from: start,
1760
+ lines: got.lines,
1761
+ at: { line: start + got.lines.length, bytes: got.end, dropped: r.dropped, ino },
1762
+ more: got.more
1763
+ };
1764
+ }
1765
+ }
1766
+
1767
+ // packages/core/dist/printer.js
1768
+ import { AsyncLocalStorage } from "node:async_hooks";
1769
+ var printer = new AsyncLocalStorage();
1770
+ function withPrinter(print, work) {
1771
+ return printer.run(print, work);
1772
+ }
1773
+ function printToCurrent(line) {
1774
+ const p = printer.getStore();
1775
+ if (!p)
1776
+ return;
1777
+ try {
1778
+ p(line);
1779
+ } catch {
1780
+ }
1781
+ }
1782
+
1783
+ export {
1784
+ fieldKey,
1785
+ lineNamesRoute,
1786
+ lineNamesWord,
1787
+ lineNamesField,
1788
+ lineNamesClaim,
1789
+ claimOnLines,
1790
+ normalizeQuote,
1791
+ quoteMatches,
1792
+ isBinaryPath,
1793
+ quoteNotRequired,
1794
+ isSecretPath,
1795
+ TOKEN_PREFIXES,
1796
+ hasTokenPrefix,
1797
+ hasSecretShape,
1798
+ maskSecretShapes,
1799
+ keyIsSecret,
1800
+ redactSecrets,
1801
+ quoteHoldsSecret,
1802
+ partsBuildWord,
1803
+ partsNamePath,
1804
+ declaresConventionalRoute,
1805
+ pathPieceOnlyInComment,
1806
+ writeFileAtomic,
1807
+ FileChangedError,
1808
+ writeFileIfUnchanged,
1809
+ renameRetrying,
1810
+ LockHeldError,
1811
+ lockFileOf,
1812
+ readLock,
1813
+ acquireLock,
1814
+ sharedLockFileOf,
1815
+ QUICK_WRITE_LOCK,
1816
+ withSharedFileLock,
1817
+ LOCAL_ONLY,
1818
+ ensureLocalIgnore,
1819
+ LOG_MAX_BYTES,
1820
+ LOG_KEEP,
1821
+ logFileOf,
1822
+ redactText,
1823
+ redact,
1824
+ logLevelFrom,
1825
+ createLog,
1826
+ ignoreLocalSync,
1827
+ NO_LOG,
1828
+ TREE_SIGNAL_GRACE_MS,
1829
+ stopTrackedTrees,
1830
+ onStopping,
1831
+ onAtticusSignal,
1832
+ atticusHandles,
1833
+ stopPending,
1834
+ trackTree,
1835
+ holdStop,
1836
+ trackedTrees,
1837
+ stopProcessGroup,
1838
+ processDescendants,
1839
+ TREE_KILL_AFTER_MS,
1840
+ killProcessTree,
1841
+ RUN_LOG_KEEP,
1842
+ RUN_LOG_MAX_BYTES,
1843
+ RUN_LOG_LINE_MAX,
1844
+ RUN_LOG_READ_MAX,
1845
+ RUN_HEARTBEAT_MS,
1846
+ RUN_SILENT_MS,
1847
+ TERMINAL_RUN_ID,
1848
+ runLogsDirOf,
1849
+ runningDirOf,
1850
+ recordedCommand,
1851
+ TITLE_VALUE_FLAGS,
1852
+ TITLE_VALUE_MAX,
1853
+ WORK_ITEM_SYSTEMS,
1854
+ titleWord,
1855
+ titleValue,
1856
+ runTitle,
1857
+ APP_JOB_WORDS,
1858
+ appRunTitle,
1859
+ runLogKept,
1860
+ isMetarepoRoot,
1861
+ RETITLED_MARK,
1862
+ RETITLE_MAX_BYTES,
1863
+ retitleTerminalRuns,
1864
+ startedByOf,
1865
+ procStartOf,
1866
+ runLogLines,
1867
+ startTerminalRun,
1868
+ startAppRun,
1869
+ pidAlive,
1870
+ readTerminalRuns,
1871
+ readTerminalRun,
1872
+ readTerminalRunLines,
1873
+ tailTerminalRunLines,
1874
+ withPrinter,
1875
+ printToCurrent
1876
+ };