scip-query 0.20.0 → 0.21.1

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 (594) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/README.md +255 -884
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/by-kind-XXGZGNZ6.js +2 -0
  5. package/dist/call-graph-VGY3R4L3.js +2 -0
  6. package/dist/call-graph-evidence-lZa2dwQA.d.ts +11 -0
  7. package/dist/change-analysis-types-CCtoCHbC.d.ts +9 -0
  8. package/dist/chunk-26CT72HM.js +2 -0
  9. package/dist/chunk-27OUNZW5.js +3 -0
  10. package/dist/chunk-2LJLEM5B.js +2 -0
  11. package/dist/chunk-3KXFB2FM.js +2 -0
  12. package/dist/chunk-3T5U2EQ2.js +2 -0
  13. package/dist/chunk-3TNRNKAT.js +2 -0
  14. package/dist/{chunk-PXY7F6Y4.js → chunk-3XQLJG7V.js} +5 -5
  15. package/dist/chunk-3XZELASU.js +2 -0
  16. package/dist/chunk-3YETOKNO.js +4 -0
  17. package/dist/chunk-47WX6UC4.js +2 -0
  18. package/dist/{chunk-7SQQWSY3.js → chunk-4HQYNZ3P.js} +2 -2
  19. package/dist/chunk-4IASLUOP.js +3 -0
  20. package/dist/{chunk-KMKTIO2G.js → chunk-4KIPF45P.js} +2 -2
  21. package/dist/chunk-4SZJF4GK.js +2 -0
  22. package/dist/chunk-4TOU7HHQ.js +2 -0
  23. package/dist/chunk-4ZCLDH6T.js +11 -0
  24. package/dist/{chunk-DQGFVPUV.js → chunk-527HV7JY.js} +3 -3
  25. package/dist/{chunk-ZTETIQ35.js → chunk-5BJPJUXF.js} +2 -2
  26. package/dist/chunk-5J3A6RBZ.js +16 -0
  27. package/dist/chunk-5KIJMEPC.js +2 -0
  28. package/dist/{chunk-JDOEX4E6.js → chunk-5QM7QT5B.js} +2 -2
  29. package/dist/chunk-5Z2H76VD.js +11 -0
  30. package/dist/chunk-63TFRBMB.js +2 -0
  31. package/dist/chunk-67FK5KGV.js +3 -0
  32. package/dist/chunk-6DO3VBLV.js +2 -0
  33. package/dist/chunk-6LS3IG2I.js +13 -0
  34. package/dist/chunk-6QN4FYQW.js +2 -0
  35. package/dist/chunk-6X4KO5A7.js +11 -0
  36. package/dist/chunk-743MEVFJ.js +8 -0
  37. package/dist/chunk-7G2WIVIX.js +2 -0
  38. package/dist/chunk-7KCZELVM.js +2 -0
  39. package/dist/chunk-7MUHSZGN.js +3 -0
  40. package/dist/chunk-7YZGSLW6.js +3 -0
  41. package/dist/chunk-7Z4GMCHM.js +117 -0
  42. package/dist/{chunk-32LVLCLN.js → chunk-AAOEROT3.js} +3 -3
  43. package/dist/chunk-AFRS7WJU.js +26 -0
  44. package/dist/chunk-ANCHW2R4.js +57 -0
  45. package/dist/{chunk-SXP2MBJH.js → chunk-AQF35NGT.js} +2 -2
  46. package/dist/chunk-ARGPDW2Y.js +6 -0
  47. package/dist/chunk-B3AREUQK.js +16 -0
  48. package/dist/chunk-BCTCADNB.js +2 -0
  49. package/dist/chunk-BM4OTGSY.js +3 -0
  50. package/dist/chunk-BMKTDJI6.js +16 -0
  51. package/dist/chunk-BOJ5SVE2.js +2 -0
  52. package/dist/{chunk-WXZLAAWK.js → chunk-BVR44XXB.js} +2 -2
  53. package/dist/{chunk-RUJURYSV.js → chunk-BYXWXLKM.js} +2 -2
  54. package/dist/chunk-BZCRHP46.js +3 -0
  55. package/dist/chunk-BZYSGZRK.js +2 -0
  56. package/dist/chunk-C52Q3JEQ.js +2 -0
  57. package/dist/chunk-C7WSQA6A.js +21 -0
  58. package/dist/{chunk-BDCC2NPY.js → chunk-CNT4ND5O.js} +2 -2
  59. package/dist/chunk-CQVDALWQ.js +2 -0
  60. package/dist/chunk-CTO3TRX7.js +2 -0
  61. package/dist/chunk-CXT3GZSQ.js +2 -0
  62. package/dist/{chunk-JVYA47YU.js → chunk-DGM2RJ3I.js} +2 -2
  63. package/dist/{chunk-7PIO7NKH.js → chunk-DK6MB565.js} +2 -2
  64. package/dist/chunk-DNPETNXT.js +2 -0
  65. package/dist/chunk-DRENNWRG.js +2 -0
  66. package/dist/chunk-DUDUIT5P.js +2 -0
  67. package/dist/chunk-DXEJ4FLZ.js +21 -0
  68. package/dist/chunk-DXYMTQZ4.js +2 -0
  69. package/dist/chunk-DZA7MQMU.js +6 -0
  70. package/dist/{chunk-ZHXX42OH.js → chunk-DZNWXJN2.js} +4 -4
  71. package/dist/{chunk-CJST5ETY.js → chunk-E6N6YTVM.js} +2 -2
  72. package/dist/chunk-E7CJ6O72.js +2 -0
  73. package/dist/chunk-EJHNTAEE.js +2 -0
  74. package/dist/chunk-EPLE5O5O.js +2 -0
  75. package/dist/chunk-F4FNK44D.js +2 -0
  76. package/dist/chunk-FCGMQETU.js +2 -0
  77. package/dist/chunk-FIO44MVK.js +3 -0
  78. package/dist/chunk-FLSVYEPL.js +2 -0
  79. package/dist/chunk-FOP7HD6H.js +3 -0
  80. package/dist/chunk-FSPENGSU.js +4 -0
  81. package/dist/chunk-FUUDUAKM.js +2 -0
  82. package/dist/chunk-FYCH2EYQ.js +2 -0
  83. package/dist/{chunk-5E4WNAVD.js → chunk-G47MFF47.js} +2 -2
  84. package/dist/chunk-G6VV7ROY.js +2 -0
  85. package/dist/chunk-GBZCVYWA.js +2 -0
  86. package/dist/chunk-GSHTVE56.js +3 -0
  87. package/dist/chunk-GTZFKDP3.js +2 -0
  88. package/dist/{chunk-2HPVVXM5.js → chunk-H2RBDP5S.js} +2 -2
  89. package/dist/chunk-H5EXS3HM.js +2 -0
  90. package/dist/chunk-HR5JYLVV.js +4 -0
  91. package/dist/chunk-HW7FASEL.js +2 -0
  92. package/dist/chunk-HYU4W353.js +10 -0
  93. package/dist/{chunk-FKSELJQF.js → chunk-I2LY3KN7.js} +2 -2
  94. package/dist/chunk-IGBQVEHE.js +2 -0
  95. package/dist/{chunk-3G66UZBH.js → chunk-IH3K5J6K.js} +2 -2
  96. package/dist/chunk-IHGK3SZ7.js +29 -0
  97. package/dist/chunk-IM23CSG5.js +2 -0
  98. package/dist/chunk-IQMGNIGY.js +2 -0
  99. package/dist/chunk-ITF3CWS5.js +2 -0
  100. package/dist/chunk-IZKJQQCQ.js +3 -0
  101. package/dist/chunk-J4HUBIVF.js +5 -0
  102. package/dist/{chunk-AZJQQKDD.js → chunk-JGMD6JGB.js} +2 -2
  103. package/dist/chunk-JLZWYDCZ.js +4 -0
  104. package/dist/chunk-JO6FK3Q5.js +2 -0
  105. package/dist/chunk-JSHDCVUM.js +81 -0
  106. package/dist/chunk-K2DZCH2K.js +2 -0
  107. package/dist/chunk-K63CAPS2.js +23 -0
  108. package/dist/chunk-KBIC6JHJ.js +2 -0
  109. package/dist/chunk-KFFQURUZ.js +2 -0
  110. package/dist/chunk-KFOYCQAJ.js +9 -0
  111. package/dist/chunk-KGKCJFWZ.js +6 -0
  112. package/dist/chunk-KK7GPALL.js +28 -0
  113. package/dist/chunk-L7WRUNKJ.js +2 -0
  114. package/dist/{chunk-W4ETQAXM.js → chunk-LFWB7TOJ.js} +2 -2
  115. package/dist/chunk-LGVTIZPV.js +61 -0
  116. package/dist/chunk-LIWIV26I.js +29 -0
  117. package/dist/chunk-LJMWILX6.js +3 -0
  118. package/dist/{chunk-BPAPWKP6.js → chunk-LXMW6ZAX.js} +8 -8
  119. package/dist/chunk-MFBVUQJZ.js +2 -0
  120. package/dist/{chunk-O64IZ6UX.js → chunk-MLTKGHD2.js} +2 -2
  121. package/dist/chunk-MLTSTKXD.js +5 -0
  122. package/dist/chunk-MR4ZKWO6.js +57 -0
  123. package/dist/{chunk-EN3O7VJA.js → chunk-MRXBLYRE.js} +2 -2
  124. package/dist/chunk-MXNGIEPU.js +3 -0
  125. package/dist/chunk-N4EFQIRX.js +20 -0
  126. package/dist/chunk-ND3BWIVN.js +7 -0
  127. package/dist/chunk-NODZYYGC.js +2 -0
  128. package/dist/chunk-NP4JFCLE.js +133 -0
  129. package/dist/chunk-NQXWWE6S.js +8 -0
  130. package/dist/chunk-NSDPPUDY.js +7 -0
  131. package/dist/chunk-NT4NVEHU.js +18 -0
  132. package/dist/chunk-O2VY47Y5.js +325 -0
  133. package/dist/chunk-O3EX5STE.js +5 -0
  134. package/dist/chunk-O4PZFAXA.js +3 -0
  135. package/dist/chunk-OA2BO4DR.js +2 -0
  136. package/dist/chunk-OFZVFIDF.js +3 -0
  137. package/dist/{chunk-PQCI4SQX.js → chunk-OG5UK2K7.js} +2 -2
  138. package/dist/chunk-OMVNRPST.js +2 -0
  139. package/dist/{chunk-7BAVHKMJ.js → chunk-OU6SDWAM.js} +9 -9
  140. package/dist/{chunk-LY4WC4AD.js → chunk-OY7PCALC.js} +2 -2
  141. package/dist/{chunk-A73XVBCR.js → chunk-P3UFF22M.js} +2 -2
  142. package/dist/chunk-PAZSBPJR.js +3 -0
  143. package/dist/chunk-PJBYDCBQ.js +38 -0
  144. package/dist/chunk-PRLU3I7G.js +79 -0
  145. package/dist/chunk-PU6XDQ2X.js +16 -0
  146. package/dist/{chunk-3CLX5EOX.js → chunk-PWEQ6CZZ.js} +2 -2
  147. package/dist/{chunk-XSRF6Q77.js → chunk-PX6QNUYF.js} +2 -2
  148. package/dist/chunk-Q4MRRB3C.js +3 -0
  149. package/dist/chunk-QGVUPYBC.js +35 -0
  150. package/dist/chunk-QH5Q6M5C.js +2 -0
  151. package/dist/chunk-QLWZUFDT.js +2 -0
  152. package/dist/chunk-QN2AI3D2.js +3 -0
  153. package/dist/{chunk-JAYYFEQY.js → chunk-QZCACNV5.js} +2 -2
  154. package/dist/chunk-RNKRYK6B.js +4 -0
  155. package/dist/chunk-RSUH7G5T.js +29 -0
  156. package/dist/chunk-RZWBTKXO.js +5 -0
  157. package/dist/chunk-SBFDPHKH.js +4 -0
  158. package/dist/{chunk-HX4GQPZP.js → chunk-SGSPCEFC.js} +3 -3
  159. package/dist/chunk-SIGVQT43.js +2 -0
  160. package/dist/chunk-SRIZDEWX.js +4 -0
  161. package/dist/chunk-SV2LEFVM.js +2 -0
  162. package/dist/chunk-T2PBOVDI.js +3 -0
  163. package/dist/chunk-TP2X2C2Y.js +3 -0
  164. package/dist/chunk-U2MNECDU.js +2 -0
  165. package/dist/chunk-U7DOYZDH.js +2 -0
  166. package/dist/chunk-UAQQR55F.js +2 -0
  167. package/dist/chunk-UBETC3Q2.js +2 -0
  168. package/dist/chunk-UEQORB2A.js +2 -0
  169. package/dist/chunk-UM56ZET4.js +38 -0
  170. package/dist/chunk-UXNXOMXJ.js +2 -0
  171. package/dist/{chunk-6SHPK5ZE.js → chunk-V6XENWOF.js} +2 -2
  172. package/dist/chunk-VJAD5WX5.js +2 -0
  173. package/dist/chunk-VRJG7N3I.js +453 -0
  174. package/dist/chunk-W7HN6V4E.js +7 -0
  175. package/dist/chunk-WCIKJ2E3.js +3 -0
  176. package/dist/chunk-WEXQYJY3.js +5 -0
  177. package/dist/chunk-WOPZX5GM.js +2 -0
  178. package/dist/chunk-WRQXLNYE.js +9 -0
  179. package/dist/{chunk-XKWKXZKW.js → chunk-WV6R37XV.js} +2 -2
  180. package/dist/{chunk-N5W4YZMK.js → chunk-WZ7V4BQV.js} +2 -2
  181. package/dist/chunk-WZRNEVYC.js +2 -0
  182. package/dist/chunk-X5MWO4DM.js +7 -0
  183. package/dist/chunk-XDAUYDFT.js +2 -0
  184. package/dist/{chunk-L7AW2QB5.js → chunk-XDOEHEET.js} +2 -2
  185. package/dist/chunk-XDQX6LDT.js +4 -0
  186. package/dist/chunk-XFRHBAIT.js +2 -0
  187. package/dist/chunk-XIPGCT3D.js +5 -0
  188. package/dist/chunk-XKM5D2XS.js +16 -0
  189. package/dist/chunk-XNF5T4T2.js +4 -0
  190. package/dist/chunk-Y2S4YNLH.js +3 -0
  191. package/dist/chunk-YA72ZUKO.js +2 -0
  192. package/dist/chunk-YBWE6J32.js +43 -0
  193. package/dist/chunk-YCXQQ3YB.js +2 -0
  194. package/dist/chunk-YDTK77JP.js +43 -0
  195. package/dist/chunk-YF25RQER.js +4 -0
  196. package/dist/chunk-YKHL4J3G.js +2 -0
  197. package/dist/chunk-YLNCTPOI.js +4 -0
  198. package/dist/chunk-YR7VRWNX.js +2 -0
  199. package/dist/chunk-YT4IQBET.js +3 -0
  200. package/dist/chunk-YUKYB54I.js +1 -0
  201. package/dist/chunk-Z2KGMIL4.js +2 -0
  202. package/dist/chunk-Z2QB75BS.js +3 -0
  203. package/dist/chunk-Z67JOKRE.js +554 -0
  204. package/dist/chunk-ZGDHC5AT.js +2 -0
  205. package/dist/chunk-ZMS4YCY7.js +2 -0
  206. package/dist/chunk-ZNW5A5VX.js +3 -0
  207. package/dist/{chunk-TFRAYKN6.js → chunk-ZP2WUVZ5.js} +2 -2
  208. package/dist/chunk-ZQUNCTEZ.js +2 -0
  209. package/dist/cli-main.js +8 -0
  210. package/dist/cli.js +1 -3
  211. package/dist/code-AXLJBZ6T.js +2 -0
  212. package/dist/code-B17qEMbt.d.ts +121 -0
  213. package/dist/code-result-json-CTZHAQXJ.js +2 -0
  214. package/dist/command-descriptors-6INSCKLW.js +342 -0
  215. package/dist/{config-types-jVM3D7MA.d.ts → config-types-B9B60MiR.d.ts} +199 -23
  216. package/dist/dataflow-AFXY423Q.js +2 -0
  217. package/dist/{db-B5PM5yNk.d.ts → db-BwIVAYNB.d.ts} +1 -1
  218. package/dist/dependence-slice-2G4X6VSJ.js +2 -0
  219. package/dist/deps-LMCAV5DO.js +2 -0
  220. package/dist/direct-navigation-2ONV22Y2.js +3 -0
  221. package/dist/entry-map-ZOC3VXO5.js +2 -0
  222. package/dist/exploration-topology-BG4v30HZ.d.ts +256 -0
  223. package/dist/file-dep-graph-Bqg3t3Px.d.ts +4 -0
  224. package/dist/file-kind-BKCVMNUf.d.ts +10 -0
  225. package/dist/files-WJQJLHMH.js +2 -0
  226. package/dist/graph-evidence-Bjyky2V4.d.ts +126 -0
  227. package/dist/graph-exploration-contract-CqDsnPQL.d.ts +7 -0
  228. package/dist/{health-Do5TKSJI.d.ts → health-CPp2Jf1Z.d.ts} +33 -34
  229. package/dist/hierarchy-ASNIHAX4.js +2 -0
  230. package/dist/imports-JICEKDKK.js +2 -0
  231. package/dist/index.d.ts +4 -31
  232. package/dist/index.js +1 -1
  233. package/dist/members-C5H2K3MS.js +2 -0
  234. package/dist/methods-KZOZHSD4.js +2 -0
  235. package/dist/next-anchor-candidates-BwMczMvX.d.ts +90 -0
  236. package/dist/output-continuation-command-NX3RH3TP.js +3 -0
  237. package/dist/output-pagination-3OFL2MJV.js +19 -0
  238. package/dist/postinstall.js +1 -1
  239. package/dist/project-reindex-A2SXUH2H.js +3 -0
  240. package/dist/queries/affected.d.ts +22 -4
  241. package/dist/queries/affected.js +1 -1
  242. package/dist/queries/anchors.d.ts +123 -0
  243. package/dist/queries/anchors.js +2 -0
  244. package/dist/queries/architecture.d.ts +3 -2
  245. package/dist/queries/architecture.js +1 -1
  246. package/dist/queries/bottlenecks.d.ts +26 -7
  247. package/dist/queries/bottlenecks.js +1 -1
  248. package/dist/queries/by-kind.d.ts +2 -2
  249. package/dist/queries/by-kind.js +1 -1
  250. package/dist/queries/call-graph.d.ts +17 -3
  251. package/dist/queries/call-graph.js +1 -1
  252. package/dist/queries/change-surface.d.ts +2 -2
  253. package/dist/queries/change-surface.js +1 -1
  254. package/dist/queries/cleanup-plan.d.ts +2 -2
  255. package/dist/queries/cleanup-plan.js +1 -1
  256. package/dist/queries/co-change.d.ts +2 -2
  257. package/dist/queries/co-change.js +1 -1
  258. package/dist/queries/code.d.ts +5 -26
  259. package/dist/queries/code.js +1 -1
  260. package/dist/queries/complexity-hotspots.d.ts +2 -2
  261. package/dist/queries/complexity-hotspots.js +1 -1
  262. package/dist/queries/complexity.d.ts +2 -2
  263. package/dist/queries/complexity.js +1 -1
  264. package/dist/queries/context.d.ts +145 -0
  265. package/dist/queries/context.js +2 -0
  266. package/dist/queries/convergence.d.ts +2 -2
  267. package/dist/queries/convergence.js +1 -1
  268. package/dist/queries/coupling.d.ts +8 -3
  269. package/dist/queries/coupling.js +1 -1
  270. package/dist/queries/cycles.d.ts +34 -7
  271. package/dist/queries/cycles.js +1 -1
  272. package/dist/queries/dataflow.d.ts +40 -14
  273. package/dist/queries/dataflow.js +1 -1
  274. package/dist/queries/dead.d.ts +2 -2
  275. package/dist/queries/dead.js +1 -1
  276. package/dist/queries/decorative-checkers.d.ts +3 -3
  277. package/dist/queries/decorative-checkers.js +1 -1
  278. package/dist/queries/deep-chains.d.ts +4 -38
  279. package/dist/queries/deep-chains.js +1 -1
  280. package/dist/queries/dependence-slice.d.ts +47 -0
  281. package/dist/queries/dependence-slice.js +2 -0
  282. package/dist/queries/dependency-depth.d.ts +49 -0
  283. package/dist/queries/dependency-depth.js +2 -0
  284. package/dist/queries/deps.d.ts +4 -2
  285. package/dist/queries/deps.js +1 -1
  286. package/dist/queries/diff-impact.d.ts +3 -3
  287. package/dist/queries/diff-impact.js +1 -1
  288. package/dist/queries/doc-drift.d.ts +4 -4
  289. package/dist/queries/doc-drift.js +1 -1
  290. package/dist/queries/drift.d.ts +2 -2
  291. package/dist/queries/drift.js +1 -1
  292. package/dist/queries/duplicate-bodies.d.ts +2 -2
  293. package/dist/queries/duplicate-bodies.js +1 -1
  294. package/dist/queries/entry-map.d.ts +121 -0
  295. package/dist/queries/entry-map.js +2 -0
  296. package/dist/queries/evidence.d.ts +70 -0
  297. package/dist/queries/evidence.js +2 -0
  298. package/dist/queries/extract-candidates.d.ts +2 -2
  299. package/dist/queries/extract-candidates.js +1 -1
  300. package/dist/queries/fan.d.ts +18 -5
  301. package/dist/queries/fan.js +1 -1
  302. package/dist/queries/files.d.ts +2 -2
  303. package/dist/queries/files.js +1 -1
  304. package/dist/queries/health.d.ts +4 -3
  305. package/dist/queries/health.js +1 -1
  306. package/dist/queries/hierarchy.d.ts +5 -3
  307. package/dist/queries/hierarchy.js +1 -1
  308. package/dist/queries/hotspots.d.ts +11 -5
  309. package/dist/queries/hotspots.js +1 -1
  310. package/dist/queries/imports.d.ts +2 -2
  311. package/dist/queries/imports.js +1 -1
  312. package/dist/queries/incomplete-migration.d.ts +4 -4
  313. package/dist/queries/incomplete-migration.js +1 -1
  314. package/dist/queries/index.d.ts +56 -136
  315. package/dist/queries/index.js +1 -1
  316. package/dist/queries/isolated.d.ts +2 -2
  317. package/dist/queries/isolated.js +1 -1
  318. package/dist/queries/locality-candidates.d.ts +2 -2
  319. package/dist/queries/locality-candidates.js +1 -1
  320. package/dist/queries/members.d.ts +2 -2
  321. package/dist/queries/members.js +1 -1
  322. package/dist/queries/methods.d.ts +2 -2
  323. package/dist/queries/methods.js +1 -1
  324. package/dist/queries/not-implemented.d.ts +3 -3
  325. package/dist/queries/not-implemented.js +1 -1
  326. package/dist/queries/outline.d.ts +2 -2
  327. package/dist/queries/outline.js +1 -1
  328. package/dist/queries/passthrough-candidates.d.ts +5 -9
  329. package/dist/queries/passthrough-candidates.js +1 -1
  330. package/dist/queries/plan-context.d.ts +27 -64
  331. package/dist/queries/plan-context.js +1 -1
  332. package/dist/queries/react-component-duplicates.d.ts +2 -2
  333. package/dist/queries/react-component-duplicates.js +1 -1
  334. package/dist/queries/react-hook-candidates.d.ts +2 -2
  335. package/dist/queries/react-hook-candidates.js +1 -1
  336. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  337. package/dist/queries/react-large-component-pressure.js +1 -1
  338. package/dist/queries/recent-duplicates.d.ts +2 -2
  339. package/dist/queries/recent-duplicates.js +1 -1
  340. package/dist/queries/redundant-reexports.d.ts +2 -2
  341. package/dist/queries/redundant-reexports.js +1 -1
  342. package/dist/queries/reference-neighborhood.d.ts +4 -0
  343. package/dist/queries/reference-neighborhood.js +2 -0
  344. package/dist/queries/reference-reachability.d.ts +48 -0
  345. package/dist/queries/reference-reachability.js +2 -0
  346. package/dist/queries/refs.d.ts +2 -2
  347. package/dist/queries/refs.js +1 -1
  348. package/dist/queries/self-audit.d.ts +2 -2
  349. package/dist/queries/self-audit.js +1 -1
  350. package/dist/queries/similar-chains.d.ts +2 -2
  351. package/dist/queries/similar-chains.js +1 -1
  352. package/dist/queries/similar-files.d.ts +2 -2
  353. package/dist/queries/similar-files.js +1 -1
  354. package/dist/queries/similar-signatures.d.ts +2 -2
  355. package/dist/queries/similar-signatures.js +1 -1
  356. package/dist/queries/similar.d.ts +2 -2
  357. package/dist/queries/similar.js +1 -1
  358. package/dist/queries/slice.d.ts +3 -36
  359. package/dist/queries/slice.js +1 -1
  360. package/dist/queries/source-inspection.d.ts +209 -0
  361. package/dist/queries/source-inspection.js +2 -0
  362. package/dist/queries/source-search.d.ts +13 -0
  363. package/dist/queries/source-search.js +2 -0
  364. package/dist/queries/stale-abstractions.d.ts +2 -2
  365. package/dist/queries/stale-abstractions.js +1 -1
  366. package/dist/queries/stats.d.ts +2 -2
  367. package/dist/queries/surface.d.ts +13 -4
  368. package/dist/queries/surface.js +1 -1
  369. package/dist/queries/symbols.d.ts +2 -2
  370. package/dist/queries/symbols.js +1 -1
  371. package/dist/queries/system-map.d.ts +449 -0
  372. package/dist/queries/system-map.js +2 -0
  373. package/dist/queries/system.d.ts +5 -3
  374. package/dist/queries/system.js +1 -1
  375. package/dist/queries/test-quality.d.ts +2 -2
  376. package/dist/queries/test-quality.js +1 -1
  377. package/dist/queries/trace.d.ts +47 -3
  378. package/dist/queries/trace.js +1 -1
  379. package/dist/queries/twin-ab.d.ts +3 -3
  380. package/dist/queries/twin-ab.js +1 -1
  381. package/dist/queries/twin-drift.d.ts +3 -3
  382. package/dist/queries/twin-drift.js +1 -1
  383. package/dist/queries/unused-imports.d.ts +2 -2
  384. package/dist/queries/unused-imports.js +1 -1
  385. package/dist/queries/unused-params.d.ts +2 -2
  386. package/dist/queries/unused-params.js +1 -1
  387. package/dist/queries/value-flow.d.ts +43 -0
  388. package/dist/queries/value-flow.js +2 -0
  389. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  390. package/dist/queries/vue-component-duplicates.js +1 -1
  391. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  392. package/dist/queries/vue-composable-candidates.js +1 -1
  393. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  394. package/dist/queries/vue-large-view-pressure.js +1 -1
  395. package/dist/queries/wrapper-candidates.d.ts +2 -2
  396. package/dist/queries/wrapper-candidates.js +1 -1
  397. package/dist/query-service-fastpath.js +6 -0
  398. package/dist/query-service-server.js +5 -0
  399. package/dist/refs-ZOORVRQC.js +2 -0
  400. package/dist/refs-pagination-SRCUOYRD.js +2 -0
  401. package/dist/reindex-worker.js +85 -86
  402. package/dist/reindex.d.ts +64 -42
  403. package/dist/reindex.js +93 -77
  404. package/dist/repository-text-C0Q8VYdN.d.ts +19 -0
  405. package/dist/runtime.d.ts +287 -8
  406. package/dist/runtime.js +4 -3
  407. package/dist/rust-semantic-session-server.js +1 -1
  408. package/dist/rust-semantic-session-worker.js +1 -1
  409. package/dist/rust-semantic-worker.js +1 -1
  410. package/dist/{scip-cli-BnEwZRLJ.d.ts → scip-cli-H-n59izO.d.ts} +33 -2
  411. package/dist/slice-NOTBWA7S.js +2 -0
  412. package/dist/source-search-types-Dwz8KeuW.d.ts +79 -0
  413. package/dist/source-snippet-_wrcgmZc.d.ts +15 -0
  414. package/dist/stats-OOJ74B32.js +2 -0
  415. package/dist/surface-BTBCLKNA.js +2 -0
  416. package/dist/symbol-resolution-SVSMX4RN.js +2 -0
  417. package/dist/system-2EIUFP6B.js +2 -0
  418. package/dist/trace-BB2GHQPG.js +2 -0
  419. package/dist/typescript-mailbox-worker.js +1 -1
  420. package/dist/value-flow-OA7AHSUG.js +2 -0
  421. package/dist/watch-server.js +3 -2
  422. package/docs/AGENT_GUIDE.md +133 -476
  423. package/docs/AI_FAILURE_MODES.md +30 -301
  424. package/docs/API.md +1 -1
  425. package/docs/API_EVOLUTION.md +6 -0
  426. package/docs/CLI_JSON_OUTPUT.md +207 -29
  427. package/docs/COMMAND_REFERENCE.md +255 -154
  428. package/docs/CONFIGURATION_WRITE_SAFETY.md +14 -13
  429. package/docs/DETECTOR_EVIDENCE_CONTRACTS.md +84 -0
  430. package/docs/DETECTOR_GUIDE.md +46 -138
  431. package/docs/DURABILITY.md +7 -1
  432. package/docs/INDEX_GENERATIONS.md +6 -0
  433. package/docs/LOCK_PROTOCOL.md +8 -0
  434. package/docs/REINDEX_METADATA_COMPATIBILITY.md +13 -3
  435. package/docs/SECURITY_MODEL.md +39 -42
  436. package/docs/accuracy-audit-checklist.md +4 -0
  437. package/docs/accuracy-hardening-goal.md +9 -2
  438. package/docs/analyzer-inventory.md +59 -264
  439. package/docs/analyzer-validation-protocol.md +62 -170
  440. package/docs/architecture-coherence-vision.md +18 -12
  441. package/docs/locality-analyzer-design.md +1 -1
  442. package/docs/schemas/cli-json-envelope.schema.json +212 -27
  443. package/docs/schemas/cli-json-export-receipt.schema.json +25 -0
  444. package/docs/schemas/cli-output-page.schema.json +1 -1
  445. package/docs/schemas/observation-receipt.schema.json +164 -0
  446. package/docs/schemas/project-config.schema.json +37 -45
  447. package/docs/schemas/suppression-record.schema.json +1 -34
  448. package/package.json +69 -11
  449. package/skills/concrete-plan/SKILL.md +8 -0
  450. package/skills/concrete-plan/agents/openai.yaml +4 -0
  451. package/skills/scip-explore/SKILL.md +49 -61
  452. package/skills/scip-explore/agents/openai.yaml +3 -3
  453. package/skills/scip-explore/references/delegated-exploration.md +51 -0
  454. package/skills/scip-explore/references/external-evidence.md +72 -0
  455. package/skills/scip-explore/references/information-model.md +51 -0
  456. package/skills/scip-explore/scripts/capture-evidence.mjs +666 -0
  457. package/skills/scip-integrity-audit/SKILL.md +185 -0
  458. package/skills/scip-integrity-audit/agents/openai.yaml +4 -0
  459. package/skills/scip-plan/SKILL.md +67 -49
  460. package/skills/scip-plan/agents/openai.yaml +3 -3
  461. package/skills/scip-query/SKILL.md +98 -77
  462. package/skills/scip-query/agents/openai.yaml +3 -3
  463. package/skills/scip-setup/SKILL.md +10 -102
  464. package/skills/scip-setup/agents/openai.yaml +3 -3
  465. package/dist/chunk-26QA6FAI.js +0 -8
  466. package/dist/chunk-2KAZEZ6M.js +0 -2
  467. package/dist/chunk-3ORVDL3H.js +0 -2
  468. package/dist/chunk-46XGSFNI.js +0 -2
  469. package/dist/chunk-4MAK2HOY.js +0 -6
  470. package/dist/chunk-4TURLRL5.js +0 -16
  471. package/dist/chunk-4UQVNCQE.js +0 -2
  472. package/dist/chunk-55Q3WLZX.js +0 -2
  473. package/dist/chunk-5I5G2QOX.js +0 -3
  474. package/dist/chunk-6LDJQXAH.js +0 -2
  475. package/dist/chunk-6O5TICIZ.js +0 -3
  476. package/dist/chunk-7O5IKBTZ.js +0 -16
  477. package/dist/chunk-7S5E7KWT.js +0 -2
  478. package/dist/chunk-7WPLAODU.js +0 -5
  479. package/dist/chunk-AFHORGLH.js +0 -42
  480. package/dist/chunk-AIE7TFJW.js +0 -9
  481. package/dist/chunk-AQOFWNQJ.js +0 -1
  482. package/dist/chunk-B2PX5I6M.js +0 -2
  483. package/dist/chunk-B75HZHUP.js +0 -2
  484. package/dist/chunk-B7PBSLZN.js +0 -2
  485. package/dist/chunk-BBW6JFHN.js +0 -2
  486. package/dist/chunk-BNXCIFVY.js +0 -2
  487. package/dist/chunk-BS2NMXQZ.js +0 -4
  488. package/dist/chunk-C3KV2II6.js +0 -2
  489. package/dist/chunk-C43RDDP4.js +0 -20
  490. package/dist/chunk-DAFAHMNB.js +0 -42
  491. package/dist/chunk-DQLPXMH6.js +0 -8
  492. package/dist/chunk-EKZTZXHZ.js +0 -117
  493. package/dist/chunk-EW2NTSFA.js +0 -18
  494. package/dist/chunk-F3Z4OUDS.js +0 -8
  495. package/dist/chunk-FJH2NW7J.js +0 -66
  496. package/dist/chunk-FTFP6O3L.js +0 -11
  497. package/dist/chunk-FYLK2DEJ.js +0 -2
  498. package/dist/chunk-GH74ASD6.js +0 -11
  499. package/dist/chunk-GMXWZP2B.js +0 -2
  500. package/dist/chunk-GOUBFH5O.js +0 -3
  501. package/dist/chunk-HLF2TX6R.js +0 -2
  502. package/dist/chunk-HX7M4BDI.js +0 -30
  503. package/dist/chunk-HZ72SESS.js +0 -128
  504. package/dist/chunk-IB2N4FIY.js +0 -10
  505. package/dist/chunk-IZYYAFN5.js +0 -2
  506. package/dist/chunk-JFGGXWQF.js +0 -947
  507. package/dist/chunk-JN4NMBEX.js +0 -8
  508. package/dist/chunk-JW56N3KI.js +0 -4
  509. package/dist/chunk-JZ2OXNWB.js +0 -2
  510. package/dist/chunk-KFZNKUNT.js +0 -2
  511. package/dist/chunk-L5GJNV2T.js +0 -8
  512. package/dist/chunk-L7JDSCDF.js +0 -4
  513. package/dist/chunk-LU47HG23.js +0 -14
  514. package/dist/chunk-LVY7NPF7.js +0 -2
  515. package/dist/chunk-MKCDWWGV.js +0 -4
  516. package/dist/chunk-MNE7YG56.js +0 -2
  517. package/dist/chunk-MRXBEXSY.js +0 -26
  518. package/dist/chunk-MV7OWDUX.js +0 -2
  519. package/dist/chunk-NGEXCJJW.js +0 -11
  520. package/dist/chunk-NIW6JDC5.js +0 -29
  521. package/dist/chunk-PBUQFCNB.js +0 -16
  522. package/dist/chunk-POAVPHH7.js +0 -2
  523. package/dist/chunk-QZ4JVECJ.js +0 -2
  524. package/dist/chunk-RDO52JGY.js +0 -2
  525. package/dist/chunk-RJT3TUUZ.js +0 -2
  526. package/dist/chunk-RVLDN63O.js +0 -4
  527. package/dist/chunk-RXOXSKY3.js +0 -2
  528. package/dist/chunk-S7OYBOCK.js +0 -2
  529. package/dist/chunk-SMNXQT5Z.js +0 -3
  530. package/dist/chunk-SRAFT254.js +0 -2
  531. package/dist/chunk-T7YQSHPQ.js +0 -3
  532. package/dist/chunk-UJCOIXDY.js +0 -2
  533. package/dist/chunk-UJPRPGCO.js +0 -13
  534. package/dist/chunk-WCCFZ7V7.js +0 -113
  535. package/dist/chunk-WUPW3UN3.js +0 -3
  536. package/dist/chunk-X54AGLVX.js +0 -2
  537. package/dist/chunk-Y2MVPNKY.js +0 -5
  538. package/dist/chunk-YKUU5AIC.js +0 -3
  539. package/dist/chunk-YLCJLTPL.js +0 -2
  540. package/dist/chunk-YTQVETEO.js +0 -2
  541. package/dist/chunk-Z4N3MZYA.js +0 -38
  542. package/dist/chunk-ZJOOT3BG.js +0 -2
  543. package/dist/chunk-ZK26BAQL.js +0 -2
  544. package/dist/command-descriptors-DSS46KXI.js +0 -642
  545. package/dist/diff-gate-types-B0QYpDv1.d.ts +0 -11
  546. package/dist/direct-navigation-6YHV6IB5.js +0 -3
  547. package/dist/queries/diff-gate.d.ts +0 -253
  548. package/dist/queries/diff-gate.js +0 -2
  549. package/docs/COMMITTED_RECORD_COMPATIBILITY.md +0 -154
  550. package/docs/analyzer-validation-ledger.md +0 -516
  551. package/docs/schemas/outcome-event-record.schema.json +0 -95
  552. package/skills/_shared/SKILL.md +0 -101
  553. package/skills/_shared/agents/openai.yaml +0 -4
  554. package/skills/_shared/references/agent-contract-catalog.md +0 -105
  555. package/skills/_shared/references/command-catalog.md +0 -118
  556. package/skills/_shared/references/detector-precision-and-diffgate.md +0 -59
  557. package/skills/_shared/references/evidence-and-dead-code.md +0 -25
  558. package/skills/scip-audit/SKILL.md +0 -77
  559. package/skills/scip-audit/agents/openai.yaml +0 -4
  560. package/skills/scip-audit/references/claims.md +0 -98
  561. package/skills/scip-audit/references/cleanup.md +0 -100
  562. package/skills/scip-audit/references/directory.md +0 -222
  563. package/skills/scip-audit/references/frontend.md +0 -130
  564. package/skills/scip-audit/references/integrity.md +0 -154
  565. package/skills/scip-audit/references/maintainability.md +0 -162
  566. package/skills/scip-audit/references/twin-drift.md +0 -104
  567. package/skills/scip-diagnose/SKILL.md +0 -52
  568. package/skills/scip-diagnose/agents/openai.yaml +0 -4
  569. package/skills/scip-diagnose/references/debug.md +0 -117
  570. package/skills/scip-diagnose/references/probe-reachability.md +0 -77
  571. package/skills/scip-diagnose/references/root-cause.md +0 -145
  572. package/skills/scip-diagnose/references/triage.md +0 -119
  573. package/skills/scip-explore/references/diagrams.md +0 -40
  574. package/skills/scip-explore/references/language-playbook.md +0 -49
  575. package/skills/scip-improve/SKILL.md +0 -56
  576. package/skills/scip-improve/agents/openai.yaml +0 -4
  577. package/skills/scip-improve/references/cleanup-batches.md +0 -53
  578. package/skills/scip-improve/references/directory-moves.md +0 -53
  579. package/skills/scip-improve/references/doc-reconcile.md +0 -30
  580. package/skills/scip-improve/references/frontend-extraction.md +0 -39
  581. package/skills/scip-improve/references/maintainability-mechanism.md +0 -43
  582. package/skills/scip-improve/references/twin-drift.md +0 -35
  583. package/skills/scip-plan/references/api-impact.md +0 -19
  584. package/skills/scip-plan/references/conductor.md +0 -41
  585. package/skills/scip-plan/references/high-assurance.md +0 -43
  586. package/skills/scip-plan/references/hyper-optimization.md +0 -50
  587. package/skills/scip-plan/references/tla-model.md +0 -88
  588. package/skills/scip-setup/references/bootstrap-workflow.md +0 -119
  589. package/skills/scip-setup/references/language-verification.md +0 -61
  590. package/skills/scip-setup/references/lifecycle-commands.md +0 -119
  591. package/skills/scip-setup/references/per-repo-triage.md +0 -24
  592. package/skills/scip-verify/SKILL.md +0 -229
  593. package/skills/scip-verify/agents/openai.yaml +0 -4
  594. package/skills/scip-verify/references/calibrate-detectors.md +0 -170
@@ -0,0 +1,7 @@
1
+ import{a as U,b as j}from"./chunk-4SZJF4GK.js";import{a as I}from"./chunk-DXYMTQZ4.js";import{b as K}from"./chunk-O4PZFAXA.js";import{b as z,e as N,i as b}from"./chunk-H5EXS3HM.js";import{d as X}from"./chunk-Z2KGMIL4.js";import{d as A,e as w,f as F,h as G}from"./chunk-XIPGCT3D.js";var V=class extends Error{constructor(t){super(t),this.name="ReindexLockUnavailableError"}};import{existsSync as ee,statSync as Te}from"fs";import{dirname as ie,join as ae}from"path";import{appendFileSync as ge,existsSync as fe,mkdirSync as me,renameSync as pe,rmSync as ye,statSync as Re,truncateSync as be}from"fs";import{basename as xe,dirname as Be}from"path";var L=".previous",he=".rotation.lock",ve=2e3,J=class extends Error{constructor(n,r){super(`Timed out after ${r}ms waiting for rotating JSONL lock: ${n}`);this.lockPath=n;this.timeoutMs=r;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},M=class extends Error{constructor(n){super(`Rotating JSONL lock ownership changed before release: ${n}`);this.lockPath=n;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},q=Object.freeze({monotonicNow:X,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let n=K(e,{kind:"rotating-jsonl",detail:{target:xe(t)}});return n.kind==="acquired"?{kind:"acquired",lock:n.lock}:{kind:"contended"}},makeDirectory(e){me(e,{recursive:!0})},exists:fe,readBytes(e){return F(e,{maxBytes:A,inputKind:"rotating JSONL segment"})},size(e){return Re(e).size},truncate:be,remove(e){ye(e,{force:!0})},rename:pe,append:ge});function Y(e,t,n){let r=n.runtime??q,a=JSON.stringify(t);if(a===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let s=Buffer.from(`${a}
2
+ `),i=Math.max(1,Math.floor(n.maxSegmentBytes),s.length);return Z(e,n.lockTimeoutMs,r,()=>{r.makeDirectory(Be(e));let c=Ae(e,A,r);n.onPhase?.("tail-repaired");let o=`${e}${n.previousSuffix??L}`,u=!1,g=!1;return r.exists(e)&&r.size(e)+s.length>i&&(r.exists(o)&&(r.remove(o),g=!0),n.onPhase?.("previous-pruned"),r.rename(e,o),u=!0,n.onPhase?.("current-rotated")),r.append(e,s),n.onPhase?.("record-appended"),{lineBytes:s.length,segmentLimitBytes:i,repairedTailBytes:c,rotated:u,prunedPrevious:g}})}function H(e,t={}){let n=t.runtime??q,r=Le(t.maxSegmentBytes);return Z(e,t.lockTimeoutMs,n,()=>{let a=[],s=0,i=`${e}${t.previousSuffix??L}`;for(let c of[i,e]){if(!n.exists(c))continue;let o=Se(Q(c,r,n));a.push(...o.lines),s+=o.partialTailBytes}return{lines:a,ignoredPartialTailBytes:s}})}function Z(e,t,n,r){let a=`${e}${he}`,s=Math.max(0,t??ve),i=n.monotonicNow()+s,c;for(;;){let m=n.tryAcquireLock(a,e);if(m.kind==="acquired"){c=m.lock;break}let R=i-n.monotonicNow();if(R<=0)throw new J(a,s);n.wait(Math.min(5,R))}let o=!1,u,g;try{g=r()}catch(m){o=!0,u=m}let l=!1;try{l=c.release()}catch(m){if(!o)throw m}if(o)throw u;if(!l)throw new M(a);return g}function Ae(e,t,n){if(!n.exists(e))return 0;let r=Q(e,t,n);if(r.length===0||r[r.length-1]===10)return 0;let a=r.lastIndexOf(10),s=a<0?0:a+1;return n.truncate(e,s),r.length-s}function Le(e){let t=e??A;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function Q(e,t,n){let r=n.size(e);if(r>t)throw new w("rotating JSONL segment",e,"too-large",r,t);let a=n.readBytes(e),s=n.size(e);if(s!==r||a.byteLength!==r)throw new w("rotating JSONL segment",e,"changed-during-read",s,t);return a}function Se(e){let t=e.lastIndexOf(10),n=t<0?0:t+1;return{lines:e.subarray(0,n).toString("utf8").split(`
3
+ `).filter(a=>a.length>0),partialTailBytes:e.length-n}}var Oe="reindex-activity.jsonl",S=L,ke=1024*1024,Pe=1440*60*1e3,te=e=>G(e,"reindex activity segment");function T(e){return ae(ie(e),Oe)}function se(e){if(e.reused)return 0;let n=(e.shards?.some(r=>!r.reused&&r.strategy==="incremental")??!1?0:C(e.indexPath))+C(e.dbPath);for(let r of e.shards??[]){if(r.reused)continue;let a=r.producedOutputBytes??r.outputBytes;a!==null&&(n+=a)}return n}function Ee(e){let t=se(e),n=e.writeTelemetry;return n?Math.max(0,t-n.reflinkedBytes)+n.fallbackCopiedBytes+(n.incrementalWrittenBytes??0):t}function st(e,t){let n=t.lastRefresh;if(!n)return{state:"failed",reason:"reindex result has no refresh metadata"};let r=se(t);return D(T(e),{version:1,event:"run",recordedAt:n.completedAt,trigger:n.trigger,result:n.result,durationMs:n.durationMs,estimatedLogicalOutputBytes:r,estimatedWriteBytes:Ee(t),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,incrementalWrittenBytes:t.writeTelemetry?.incrementalWrittenBytes??0,byLanguage:Ce(t)})}function ot(e,t){return D(T(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function ut(e,t,n=new Date){return D(T(e),{version:1,event:"suppressed",recordedAt:n.toISOString(),trigger:t,reason:"completed-index-is-fresh"})}function _e(e,t,n=ke,r){Y(e,t,{maxSegmentBytes:n,previousSuffix:S,...r?{runtime:r}:{}})}function we(e,t=new Date,n=Pe,r=te){let a=t.getTime(),s=a-n,i={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(s).toISOString(),windowEndedAt:t.toISOString(),runs:0,rebuilt:0,fullRebuilds:0,reused:0,failed:0,suppressed:0,estimatedLogicalOutputBytes:0,estimatedWriteBytes:0,reflinkedBytes:0,fallbackCopiedBytes:0,languageAttribution:"complete",attributedRuns:0,unattributedRuns:0,invalidLanguageDetails:0,byLanguage:{},byTrigger:{}},c=T(e),o=[];if(r===te){if(!ee(c)&&!ee(`${c}${S}`))return i;try{let u=H(c,{previousSuffix:S});o=u.lines,i.ignoredPartialTailBytes=u.ignoredPartialTailBytes}catch{i.readErrors+=1,i.confidence="unavailable"}}else{let u=0;for(let g of[`${c}${S}`,c])try{o.push(...Ue(r(g))),u+=1}catch{i.readErrors+=1}u===0?i.confidence="unavailable":i.readErrors>0&&(i.confidence="partial")}for(let u of o){i.recordsRead+=1;let g=Ne(u);if(!g){i.invalidRecords+=1,i.confidence!=="unavailable"&&(i.confidence="partial");continue}let{record:l}=g,m=Date.parse(l.recordedAt);if(m<s||m>a){i.skippedRecords+=1;continue}if(i.invalidLanguageDetails=(i.invalidLanguageDetails??0)+g.invalidLanguageDetails,i.byTrigger[l.trigger.kind]=(i.byTrigger[l.trigger.kind]??0)+1,l.event==="suppressed"){i.suppressed+=1;continue}i.runs+=1,i[l.result]+=1,i.estimatedLogicalOutputBytes+=l.estimatedLogicalOutputBytes;let R=Ie(l);i.estimatedWriteBytes=(i.estimatedWriteBytes??0)+R,i.reflinkedBytes=(i.reflinkedBytes??0)+(l.reflinkedBytes??0),i.fallbackCopiedBytes=(i.fallbackCopiedBytes??0)+(l.fallbackCopiedBytes??0),l.result!=="failed"&&(g.hasLanguageDetails?i.attributedRuns=(i.attributedRuns??0)+1:i.unattributedRuns=(i.unattributedRuns??0)+1);for(let[x,p]of oe(l.byLanguage)){let y=(i.byLanguage??={})[x]??=Fe();y.runs+=1,y[p.result]+=1,y.producedOutputBytes+=p.producedOutputBytes,y.durationMs+=p.durationMs}ne(l)&&i.oldestRebuildAt===void 0&&(i.oldestRebuildAt=l.recordedAt),ne(l)&&(i.fullRebuilds=(i.fullRebuilds??0)+1),R>0&&i.oldestWriteAt===void 0&&(i.oldestWriteAt=l.recordedAt)}return i.ignoredPartialTailBytes>0&&i.confidence!=="unavailable"&&(i.confidence="partial"),i.languageAttribution=Ge(i),i}function D(e,t){try{return _e(e,t),{state:"recorded"}}catch(n){return{state:"failed",reason:n instanceof Error?n.message:String(n)}}}function Ne(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(n.version!==1||!z(n.recordedAt)||!n.trigger||!Me(n.trigger.kind))return null;if(n.event==="suppressed")return n.reason==="completed-index-is-fresh"?{record:n,hasLanguageDetails:!1,invalidLanguageDetails:0}:null;if(n.event!=="run"||n.result!=="rebuilt"&&n.result!=="reused"&&n.result!=="failed"||!b(n.durationMs)||!b(n.estimatedLogicalOutputBytes)||n.estimatedWriteBytes!==void 0&&!b(n.estimatedWriteBytes)||n.reflinkedBytes!==void 0&&!b(n.reflinkedBytes)||n.fallbackCopiedBytes!==void 0&&!b(n.fallbackCopiedBytes)||n.incrementalWrittenBytes!==void 0&&!b(n.incrementalWrittenBytes))return null;let r=n,{byLanguage:a,...s}=r,i=De(a);return{record:{...s,...i.byLanguage?{byLanguage:i.byLanguage}:{}},hasLanguageDetails:i.hasLanguageDetails,invalidLanguageDetails:i.invalidLanguageDetails}}catch{return null}}function Ie(e){return e.reflinkedBytes===void 0?e.estimatedWriteBytes??e.estimatedLogicalOutputBytes:Math.max(0,e.estimatedLogicalOutputBytes-e.reflinkedBytes)+(e.fallbackCopiedBytes??0)+(e.incrementalWrittenBytes??0)}function dt(e,t,n=new Date){return t.enabled?Je(we(e,n,t.windowMs),t,n.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function Je(e,t,n){let r=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,a=e.fullRebuilds??e.rebuilt,s={rebuilt:a,estimatedWriteBytes:r};return t.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:n+t.windowMs,...s,detail:`reindex activity evidence is ${e.confidence}`}:a>=t.maxRebuilds?{state:"paused",reason:"rebuild-count",until:re(e.oldestRebuildAt,t.windowMs,n),...s,detail:`${a}/${t.maxRebuilds} expensive full rebuild slots consumed`}:r>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:re(e.oldestWriteAt,t.windowMs,n),...s,detail:`${r}/${t.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...s}:{state:"allowed",...s}}function ne(e){if(e.result!=="rebuilt")return!1;let t=oe(e.byLanguage);return t.length===0?!0:t.some(([,n])=>n.result==="rebuilt"&&n.strategy!=="incremental"&&n.strategy!=="reused")}function re(e,t,n){let r=e?Date.parse(e):Number.NaN;return Number.isFinite(r)&&r+t>n?r+t:n+t}function Me(e){return e==="manual-cli"||e==="setup"||e==="watch-source"||e==="watch-startup"||e==="watch-demand"||e==="watch-git-head"||e==="watch-git-index"||e==="watch-git-state"||e==="unknown"}function C(e){try{return Te(e).size}catch{return 0}}function Ce(e){let t={};for(let n of e.languages){let r=(e.shards??[]).filter(u=>u.language===n),a=r.find(u=>u.id===n),s=e.reused||(a?a.reused:r.length>0&&r.every(u=>u.reused)),i=C(ae(ie(e.dbPath),"language-indexes",`${n}.scip`)),c=i>0?i:a?.outputBytes??i,o=s?0:a?.durationMs??r.filter(u=>!u.reused).reduce((u,g)=>u+g.durationMs,0);t[n]={result:s?"reused":"rebuilt",strategy:s?"reused":a?.strategy??"full",...a?.strategy==="full"&&(a.fallbackReason??a.missReason)?{fallbackReason:a.fallbackReason??a.missReason}:{},outputBytes:c,producedOutputBytes:s?0:a?.producedOutputBytes??c,durationMs:o}}return t}function De(e){if(e===void 0)return{hasLanguageDetails:!1,invalidLanguageDetails:0};if(!e||typeof e!="object"||Array.isArray(e))return{hasLanguageDetails:!1,invalidLanguageDetails:1};let t={},n=0;for(let[a,s]of Object.entries(e)){if(!$e(a)||!We(s)){n+=1;continue}t[a]=s}let r=Object.keys(t).length>0;return{...r?{byLanguage:t}:{},hasLanguageDetails:r,invalidLanguageDetails:n}}function We(e){if(!e||typeof e!="object")return!1;let t=e;return(t.result==="rebuilt"||t.result==="reused")&&(t.strategy===void 0||t.strategy==="reused"||t.strategy==="incremental"||t.strategy==="full")&&(t.fallbackReason===void 0||typeof t.fallbackReason=="string")&&N(t.outputBytes)&&N(t.producedOutputBytes)&&b(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function $e(e){return I.includes(e)}function oe(e){return e?I.flatMap(t=>{let n=e[t];return n?[[t,n]]:[]}):[]}function Fe(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function Ge(e){let t=e.invalidLanguageDetails??0,n=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":n===0?"unavailable":"partial"}function Ue(e){return e.endsWith(`
4
+ `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
5
+ `)+1))),e.split(`
6
+ `).filter(t=>t.length>0)}function ct(e){let t=JSON.stringify(e);return Buffer.byteLength(t)<=65536?t:void 0}function gt(e){if(!(!e||Buffer.byteLength(e)>65536))try{return je(JSON.parse(e))}catch{return}}function je(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;if(t.version!==1||t.baseGeneration!==null&&typeof t.baseGeneration!="string"||typeof t.complete!="boolean"||!Array.isArray(t.entries)||t.entries.length>1024||t.incompleteReason!==void 0&&typeof t.incompleteReason!="string")return;let n=[],r=new Set;for(let a of t.entries){if(!a||typeof a!="object"||Array.isArray(a))return;let s=a;if(typeof s.path!="string"||!ze(s.path)||s.kind!=="add"&&s.kind!=="change"&&s.kind!=="delete"||r.has(s.path))return;r.add(s.path),n.push({path:s.path,kind:s.kind})}if(!(t.complete&&t.incompleteReason!==void 0)&&!(!t.complete&&(!t.incompleteReason||t.incompleteReason.trim()==="")))return{version:1,baseGeneration:t.baseGeneration,complete:t.complete,...t.incompleteReason===void 0?{}:{incompleteReason:t.incompleteReason},entries:n}}function ze(e){return!e||e.includes("\0")||e.includes("\\")||e.startsWith("/")||/^[A-Za-z]:\//.test(e)?!1:e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")}import{spawn as Xe}from"child_process";import{platform as ue}from"os";import{performance as de}from"perf_hooks";var bt={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},v=class extends Error{constructor(n,r,a,s={}){super(a,s.cause===void 0?void 0:{cause:s.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=s.timedOut??!1,this.reaped=s.reaped??!1,this.stdout=s.stdout??"",this.stderr=s.stderr??"",this.stdoutTruncated=s.stdoutTruncated??!1,this.stderrTruncated=s.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function h(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function le(e,t,n,r){let a=Math.max(0,r-n);a>0&&e.push(t.subarray(0,a))}function ce(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function xt(e){h(e.timeoutMs,"timeoutMs"),h(e.maxStdoutBytes,"maxStdoutBytes"),h(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;h(t,"terminationGraceMs");let n=e.terminationForceMs??t;return h(n,"terminationForceMs"),new Promise((r,a)=>{let s=de.now(),i=ue()!=="win32"&&process.env.SCIP_REINDEX_PROCESS_GROUP_LEADER==="1",c=ue()!=="win32"&&!i,o;try{o=Xe(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:c?!0:e.detached,stdio:["pipe","pipe","pipe"]})}catch(d){let f=d instanceof Error?d.message:String(d);a(new v("spawn",e.label,`${e.label} could not start: ${f}`,{cause:d,reaped:!0}));return}let u=[],g=[],l=0,m=0,R=!1,x=!1,p=null,y=!1,W=o.pid===void 0?null:U(o.pid,c),O=()=>{clearTimeout($),e.signal?.removeEventListener("abort",P)},k=d=>{if(y||!p)return;y=!0,O();let f=Buffer.concat(u).toString("utf8"),E=Buffer.concat(g).toString("utf8"),_=d.reaped||!d.detail?"":` Process-tree cleanup failed: ${d.detail}`;a(new v(p.kind,e.label,`${p.message}${_}`,{timedOut:p.timedOut,reaped:d.reaped,stdout:f,stderr:E,stdoutTruncated:R,stderrTruncated:x}))},B=d=>{if(!(p||y)){if(p=d,!W){k({reaped:o.pid===void 0,reason:o.pid===void 0?"terminated":"identity-unavailable"});return}j(W,{gracefulMs:t,forceMs:n}).then(k,f=>{k({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},$=setTimeout(()=>{B({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);$.unref();let P=()=>{B({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",P,{once:!0}),e.signal?.aborted&&P(),o.stdout.on("data",d=>{let f=Buffer.isBuffer(d)?d:Buffer.from(d);e.outputLimitBehavior==="truncate-tail"?ce(u,f,e.maxStdoutBytes):le(u,f,l,e.maxStdoutBytes),l+=f.length,l>e.maxStdoutBytes&&(R=!0,e.outputLimitBehavior!=="truncate-tail"&&B({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),o.stderr.on("data",d=>{let f=Buffer.isBuffer(d)?d:Buffer.from(d);e.outputLimitBehavior==="truncate-tail"?ce(g,f,e.maxStderrBytes):le(g,f,m,e.maxStderrBytes),m+=f.length,m>e.maxStderrBytes&&(x=!0,e.outputLimitBehavior!=="truncate-tail"&&B({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),o.on("error",d=>{if(!y&&!p){if(o.pid===void 0){O(),y=!0,a(new v("spawn",e.label,`${e.label} could not start: ${d.message}`,{cause:d,reaped:!0}));return}B({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${d.message}`})}}),o.on("close",(d,f)=>{if(y||p)return;y=!0,O();let E=Buffer.concat(u).toString("utf8"),_=Buffer.concat(g).toString("utf8");r({status:d,signal:f,stdout:E,stderr:_,timedOut:!1,durationMs:de.now()-s,stdoutTruncated:R,stderrTruncated:x})}),e.input===void 0?o.stdin.end():o.stdin.end(e.input)})}export{bt as a,v as b,xt as c,V as d,L as e,Y as f,Oe as g,st as h,ot as i,ut as j,we as k,dt as l,ct as m,gt as n};
7
+ //# sourceMappingURL=chunk-W7HN6V4E.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{B as te,C as Ee}from"./chunk-Z67JOKRE.js";import{$ as Ce,C as K,Ed as k,Fd as G,H as Re,J as Ie,M as Q,Ua as ke,Ud as Z,Ue as Te,V as Y,Vd as ee,Ve as qe,W as C,Wd as R,X as be,Xd as $,Yd as j,_ as w,aa as we,df as _e,fa as A,te as re,u as v,ud as S,ue as Ae,vd as We,ve as ne,wa as P,wd as L,we as Pe,xd as X,xe,yd as M,ye as ie}from"./chunk-VRJG7N3I.js";import{spawn as Tt}from"child_process";import{existsSync as qt,rmSync as Ue}from"fs";import{dirname as _t,resolve as z}from"path";import{fileURLToPath as Dt}from"url";import{createHash as gt,randomUUID as oe}from"crypto";import{existsSync as vt,linkSync as St,readdirSync as Rt,rmSync as W}from"fs";import{basename as It,dirname as bt,join as m}from"path";var I=1,Ct=10*6e4,wt=10080*6e4,F="requests",x="claims",N="completions",Oe="staging";function Le(e,t,r={}){let n=r.now?.()??new Date,i=Et(r.ttlMs),o=At(r.idempotencyKey),a=o?`key-${gt("sha256").update(o).digest("hex")}`:`request-${(r.randomId??oe)()}`,s={version:I,requestId:a,...o?{idempotencyKey:o}:{},createdAt:n.toISOString(),deadlineAt:new Date(n.getTime()+i).toISOString(),detail:t.trim().slice(0,2048)||"stale index observed by a command"},c=Fe(e,a),d=ae(e,c,s,r.onStage);if(d.published)return{disposition:"accepted",request:s,achievedDurability:d.achievedDurability,directorySync:d.directorySync};let l=se(c);if(!l)throw new Error(`Watch refresh request identity ${a} exists but is malformed.`);return{disposition:"duplicate",request:l}}function sr(e,t={}){let r=t.now?.()??new Date,n=`claim-${(t.randomId??oe)()}`,i=Math.max(1,Math.floor(t.limit??64)),o=$e(e).sort(Pt),a=[];for(let s of o){if(a.length>=i)break;if(De(e,s.requestId))continue;if(Date.parse(s.deadlineAt)<=r.getTime()){Ge(e,{version:I,requestId:s.requestId,outcome:"expired",completedAt:r.toISOString()});continue}let c={version:I,requestId:s.requestId,claimId:n,claimedAt:r.toISOString()};if(ae(e,He(e,s.requestId),c).published){if(De(e,s.requestId)){je(e,s.requestId,n);continue}a.push(s)}}return{claimId:n,requests:a}}function ar(e,t,r=()=>new Date,n){let i=r().toISOString();for(let o of t.requests)Ge(e,{version:I,requestId:o.requestId,claimId:t.claimId,outcome:"completed",completedAt:i});n?.("after-completion"),kt(e,t),n?.("after-claim-release")}function kt(e,t){for(let r of t.requests)je(e,r.requestId,t.claimId)}function cr(e){let t=0;for(let r of b(m(e,x)))W(r,{force:!0}),t++;return t>0&&C(m(e,x)),Ne(e),t}function dr(e){let t=$e(e),r=new Map,n=Wt(m(e,F),se);for(let c of b(m(e,N))){let d=H(c);if(!d){n++;continue}r.set(d.requestId,d)}let i=new Set;for(let c of b(m(e,x))){let d=Me(c);if(!d){n++;continue}i.add(d.requestId)}let o=t.filter(c=>!r.has(c.requestId)&&!i.has(c.requestId)),a=[...r.values()].filter(c=>c.outcome==="completed").length,s=[...r.values()].filter(c=>c.outcome==="expired").length;return{pending:o.length,claimed:t.filter(c=>!r.has(c.requestId)&&i.has(c.requestId)).length,completed:a,expired:s,invalid:n,...o.length>0?{oldestPendingAt:o.map(c=>c.createdAt).reduce((c,d)=>xt(c,d))}:{}}}function lr(e,t={}){let r=(t.now?.()??new Date).getTime(),n=Math.max(0,t.retentionMs??wt),i=0;for(let o of b(m(e,N))){let a=H(o);!a||r-Date.parse(a.completedAt)<n||(W(o,{force:!0}),W(Fe(e,a.requestId),{force:!0}),i++)}return i>0&&(C(m(e,N)),C(m(e,F))),Ne(e),i}function se(e){return ce(e,t=>{let r=t;return r.version===I&&T(r.requestId)&&(r.idempotencyKey===void 0||typeof r.idempotencyKey=="string")&&P(r.createdAt)&&P(r.deadlineAt)&&Date.parse(r.deadlineAt)>=Date.parse(r.createdAt)&&typeof r.detail=="string"&&r.detail.length>0})}function Me(e){return ce(e,t=>{let r=t;return r.version===I&&T(r.requestId)&&T(r.claimId)&&P(r.claimedAt)})}function H(e){return ce(e,t=>{let r=t;return r.version===I&&T(r.requestId)&&(r.claimId===void 0||T(r.claimId))&&(r.outcome==="completed"||r.outcome==="expired")&&P(r.completedAt)})}function Ge(e,t){let r=Ve(e,t.requestId);if(ae(e,r,t).published)return;let n=H(r);if(!n||n.requestId!==t.requestId||n.outcome!==t.outcome)throw new Error(`Watch refresh completion ${t.requestId} conflicts with an existing record.`)}function ae(e,t,r,n){let i=m(e,Oe),o=bt(t),a=Y(i),s=Y(o),c=m(i,`${It(t)}.${process.pid}.${oe()}.tmp`);try{let d=G(c,r,{spacing:2,trailingNewline:!0});n?.("after-staged");try{St(c,t)}catch(u){if(u.code==="EEXIST")return{published:!1};throw u}let l=be(a,s,d.directorySync,C(o));return n?.("after-published"),{published:!0,achievedDurability:l==="synced"?"directory-durable":"file-flushed",directorySync:l}}finally{W(c,{force:!0})}}function $e(e){let t=[];for(let r of b(m(e,F))){let n=se(r);n&&t.push(n)}return t}function je(e,t,r){let n=He(e,t),i=Me(n);!i||i.claimId!==r||(W(n,{force:!0}),C(m(e,x)))}function Ne(e){for(let t of b(m(e,Oe),".tmp"))W(t,{force:!0})}function Wt(e,t){return b(e).filter(r=>!t(r)).length}function b(e,t=".json"){return vt(e)?Rt(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(t)).map(r=>m(e,r.name)).sort():[]}function ce(e,t){try{let r=JSON.parse(v(e,"watch refresh request record"));return t(r)?r:null}catch{return null}}function Fe(e,t){return m(e,F,`${t}.json`)}function He(e,t){return m(e,x,`${t}.json`)}function Ve(e,t){return m(e,N,`${t}.json`)}function De(e,t){return H(Ve(e,t))!==null}function Et(e){if(e===void 0)return Ct;if(!Number.isFinite(e)||e<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(e)}function At(e){let t=e?.trim();return t?t.slice(0,512):void 0}function T(e){return typeof e=="string"&&/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)}function Pt(e,t){return Date.parse(e.createdAt)-Date.parse(t.createdAt)||e.requestId.localeCompare(t.requestId)}function xt(e,t){return Date.parse(t)<Date.parse(e)?t:e}var Be=5e3,Ot=6e3,Lt=1e3,le=10,Mt=new Set(["capabilities","check-deps","config-validate","continue","doctor","init","install-skills","reindex","setup","setup-agent","status","suppress","uninstall","watch"]);function xr(e){let t=e.classification;if(t.kind!=="live")return;let{state:r}=t;return r.watcher.state==="idle"&&r.lastError===void 0?r.indexGeneration:void 0}function Gt(e,t=process.env){return t.SCIP_QUERY_SKIP_WATCH_SERVICE!=="1"&&!e.startsWith("__")&&!Mt.has(e)}function Tr(e){let t=e.env??process.env;if(t.SCIP_QUERY_SKIP_WATCH_SERVICE==="1")return{kind:"skipped",reason:"environment"};if(!Gt(e.commandName,t))return{kind:"skipped",reason:"excluded-command"};if(e.config.watch?.enabled!==!0)return{kind:"skipped",reason:"disabled"};if(e.config.watch.autoStart===!1)return{kind:"skipped",reason:"auto-start-disabled"};try{let r=$t({projectRoot:e.projectRoot,cacheDir:e.cacheDir,cliVersion:e.cliVersion,gitContext:e.gitContext,runtime:e.runtime});return{kind:r.disposition,state:r.state}}catch(r){return{kind:"failed",message:r instanceof Error?r.message:String(r)}}}function Qe(e,t,r){let n=Q(z(e));if(r&&Q(r.projectRoot)===n)return{projectRoot:n,worktreeKind:"git",worktreeId:r.worktreeId,cliVersion:t};let i=Re(n);if(i.kind==="error")throw new Error(`Could not establish Git worktree identity for ${n}: ${i.message}`);return i.kind==="non-git"?{projectRoot:n,worktreeKind:"non-git",cliVersion:t}:{projectRoot:n,worktreeKind:"git",worktreeId:i.identity.worktreeId,cliVersion:t}}function qr(e){return U(e,Qe(e.projectRoot,e.cliVersion,e.gitContext))}function U(e,t){let r=e.runtime??fe,n=R(e.cacheDir),i=$(n.statePath),o=he(n.lockPath);return{identity:t,classification:jt(i,t,r.now(),r.isProcessAlive),lock:o,lockIsLive:o!==null&&r.isProcessAlive(o.pid),paths:n}}function $t(e){let t=e.runtime??fe,r=Qe(e.projectRoot,e.cliVersion,e.gitContext),n=U(e,r),i=ue("ensure",n.classification);if(i.kind==="reuse")return V(n.paths.activityPath,t),{disposition:"reused",state:i.state};if(i.kind==="refuse-replace")throw new Error(`scip-query watch service pid ${i.state.pid} is still alive but its heartbeat is old. Refusing automatic replacement because civil-clock age alone cannot authorize a process signal.`);if(i.kind==="replace")pe(i.state,e,t),q(n.paths,i.state.pid,t);else if(i.kind==="start"){if(n.lockIsLive){let s=ze(e,r,t,Math.min(e.startupTimeoutMs??1e3,1e3));if(s)return V(n.paths.activityPath,t),{disposition:"reused",state:s};throw new Error(`scip-query watch is already running for ${z(e.projectRoot)} (pid ${n.lock?.pid}; lock: ${n.paths.lockPath}) without compatible daemon state. Stop the foreground watcher before starting the service.`)}n.classification.kind==="stale"&&q(n.paths,n.classification.state.pid,t)}else throw new Error(`Unexpected ensure action: ${i.kind}`);if(n=U(e,r),i=ue("ensure",n.classification),i.kind==="reuse")return V(n.paths.activityPath,t),{disposition:"reused",state:i.state};if(i.kind==="refuse-replace")throw new Error(`scip-query watch service pid ${i.state.pid} remains alive with an old heartbeat; automatic replacement is not authorized.`);let o=e.serverPath??Dt(new URL("./watch-server.js",import.meta.url));t.spawnServer(o,r.projectRoot,e.cliVersion,e.watchOverrides??{});let a=ze(e,r,t,e.startupTimeoutMs??Be);if(!a)throw new Error(`scip-query watch service did not become ready within ${e.startupTimeoutMs??Be}ms.`);return V(n.paths.activityPath,t),{disposition:"started",state:a}}function Ye(e){let t=e.runtime??fe,r=R(e.cacheDir),n=$(r.statePath),i=n?Je(n,t)?{kind:"live",state:n}:{kind:"stale",state:n,reason:"dead-process"}:{kind:"stopped"},o=ue("stop",i);if(o.kind==="signal-stop")return pe(o.state,e,t),q(r,o.state.pid,t),{disposition:"stopped",pid:o.state.pid};if(o.kind==="clean-stale")return q(r,o.state.pid,t),{disposition:"stopped",pid:o.state.pid};let a=he(r.lockPath);return o.kind==="already-stopped"&&a?(Je(a,t)&&pe(a,e,t),q(r,a.pid,t),{disposition:"stopped",pid:a.pid}):{disposition:"already-stopped"}}function _r(e,t,r={}){let{durability:n="durable",...i}=r;n==="durable"?G(e,t,i):k(e,t,i)}function Xe(e,t=Date.now()){k(e,{version:1,at:new Date(t).toISOString()})}function Dr(e,t,r=Date.now(),n={}){Le(R(_t(e)).refreshRequestsPath,t,{...n,now:()=>new Date(r)}),Xe(e,r)}function Or(e){try{let t=JSON.parse(v(e,"watch activity record"));return t.version!==1||!j(t.at)||t.refreshRequestedAt!==void 0&&!j(t.refreshRequestedAt)||t.refreshDetail!==void 0&&typeof t.refreshDetail!="string"?null:{atMs:Date.parse(t.at),...t.refreshRequestedAt===void 0?{}:{refreshRequestedAtMs:Date.parse(t.refreshRequestedAt)},...t.refreshDetail===void 0?{}:{refreshDetail:t.refreshDetail}}}catch{return null}}function Lr(e,t,r={}){let n=r.pid??process.pid,i=r.isProcessAlive??S,o=()=>{},a=r.readProcessIdentity??X,s=r.now??(()=>new Date),c={...re,wallNow:()=>s().getTime(),isProcessAlive:i,readProcessIdentity:a},d=Ae(e,{kind:"watch",pid:n,processIdentity:a(n),detail:{projectRoot:z(t)},parseLegacy:B,runtime:c});if(d.kind==="contended"){let l=Ze(d.observation);return{acquired:!1,lockPath:e,message:Nt(e,t,l),release:o}}return{acquired:!0,lockPath:e,message:"",release:()=>{d.lock.release()}}}function he(e){return Ze(ne(e,{parseLegacy:B}))}var B=e=>{let t=et(e);return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function Ze(e){if(e.state==="valid"&&e.record?.kind==="watch"){let t=e.record.detail?.projectRoot;return typeof t!="string"?null:{version:1,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},projectRoot:t,startedAt:e.record.startedAt}}return et(e.parsed)}function et(e){try{let t=e;if(t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!j(t.startedAt))return null;let r=t.processIdentity===void 0?null:We(t.processIdentity);return t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,pid:t.pid,...r?{processIdentity:r}:{},projectRoot:t.projectRoot,startedAt:t.startedAt}}catch{return null}}function jt(e,t,r,n){if(!e)return{kind:"stopped"};if(e.protocolVersion!==Z)return{kind:"incompatible",state:e,reason:"protocol"};if(e.projectRoot!==t.projectRoot)return{kind:"incompatible",state:e,reason:"project"};let i=t.worktreeKind==="git"?t.worktreeId:void 0;if(e.worktreeId!==i)return{kind:"incompatible",state:e,reason:"worktree"};if(e.cliVersion!==t.cliVersion)return{kind:"incompatible",state:e,reason:"cli-version"};if(!n(e.pid))return{kind:"stale",state:e,reason:"dead-process"};let o=Date.parse(e.heartbeatAt);return r-o>ee?{kind:"stale",state:e,reason:"old-heartbeat"}:{kind:"live",state:e}}function ue(e,t){switch(e){case"status":return{kind:"report",classification:t};case"ensure":switch(t.kind){case"stopped":return{kind:"start"};case"stale":return t.reason==="old-heartbeat"?{kind:"refuse-replace",state:t.state,reason:"old-heartbeat"}:{kind:"start"};case"live":return{kind:"reuse",state:t.state};case"incompatible":return{kind:"replace",state:t.state};default:return de(t)}case"stop":switch(t.kind){case"stopped":return{kind:"already-stopped"};case"stale":return t.reason==="old-heartbeat"?{kind:"signal-stop",state:t.state}:{kind:"clean-stale",state:t.state};case"live":case"incompatible":return{kind:"signal-stop",state:t.state};default:return de(t)}default:return de(e)}}function Mr(e){return e.idleTimeoutMs===0||e.watcher.state!=="idle"?!1:e.nowMs-e.lastActivityAtMs>=e.idleTimeoutMs}function ze(e,t,r,n){let i=r.monotonicNow??M,o=i()+n;for(;i()<=o;){let a=U(e,t).classification;if(a.kind==="live")return a.state;r.sleep(le)}return null}function pe(e,t,r){let{pid:n}=e;if(!r.isProcessAlive(n))return;Ke(e,r),r.signalProcess(n);let i=t.stopTimeoutMs??Ot,o=r.monotonicNow??M,a=o()+i;for(;o()<=a;){if(!r.isProcessAlive(n))return;r.sleep(le)}if(!r.forceSignalProcess)throw new Error(`scip-query watch service pid ${n} did not stop within ${i}ms and forced termination is unavailable.`);Ke(e,r),r.forceSignalProcess(n);let s=t.forceStopTimeoutMs??Lt,c=o()+s;for(;o()<=c;){if(!r.isProcessAlive(n))return;let d=r.readProcessIdentity(n);if(e.processIdentity&&d&&!L(e.processIdentity,d))return;r.sleep(le)}throw new Error(`scip-query watch service pid ${n} remained alive ${s}ms after forced termination.`)}function q(e,t,r){if(Ue(e.statePath,{force:!0}),Ue(e.activityPath,{force:!0}),he(e.lockPath)?.pid===t){let i={...re,wallNow:r.now,isProcessAlive:r.isProcessAlive,readProcessIdentity:r.readProcessIdentity},o=ne(e.lockPath,{parseLegacy:B,runtime:i});Pe(e.lockPath,o,{parseLegacy:B,runtime:i})}}function Je(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||L(e.processIdentity,r)}function Nt(e,t,r){return`error: scip-query watch is already running for ${z(t)}${r?` (pid ${r.pid}, started ${r.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}function V(e,t){try{(t.recordActivity??Xe)(e,t.now())}catch(r){let n=Ft(r);if(n!=="EPERM"&&n!=="EACCES"&&n!=="EROFS")throw r}}function Ft(e){return e.code}var fe={now:Date.now,monotonicNow:M,isProcessAlive:S,readProcessIdentity:X,spawnServer(e,t,r,n){if(!qt(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);Tt(process.execPath,[e,t,r,JSON.stringify(n)],{detached:!0,stdio:"ignore",env:{...process.env,SCIP_QUERY_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},forceSignalProcess(e){process.kill(e,"SIGKILL")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function Ke(e,t){if(!e.processIdentity)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its ownership record has no process identity.`);let r=t.readProcessIdentity(e.pid);if(!r)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity is unavailable.`);if(!L(e.processIdentity,r))throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity does not match the ownership record.`)}function de(e){throw new Error(`Unhandled watch service value: ${JSON.stringify(e)}`)}import{existsSync as J,lstatSync as _,readdirSync as nt,realpathSync as tt,rmSync as E,statSync as it}from"fs";import{join as p,resolve as D,sep as ot}from"path";var Ht=3600*1e3,Vt=2*1024*1024*1024,st=300*1e3,Ut="gc-state.json",Bt="gc.lock";function zt(e){let t=e.leases.filter(s=>s.managed&&!s.live&&!s.busy),r=at(e.leases,e.locks),n={};for(let s of e.generations)r.has(s.generationId)||(n[s.generationId]=s.unreferencedAt??e.nowMs);let i=e.generations.filter(s=>!r.has(s.generationId)).sort((s,c)=>n[s.generationId]-n[c.generationId]||s.generationId.localeCompare(c.generationId)),o=new Set;for(let s of i)e.nowMs-n[s.generationId]>=e.policy.generationTtlMs&&o.add(s.generationId);let a=e.generations.filter(s=>!o.has(s.generationId)).reduce((s,c)=>s+c.size,0);for(let s of i){if(a<=e.policy.budgetBytes)break;o.has(s.generationId)||(o.add(s.generationId),a-=s.size)}for(let s of o)delete n[s];return{deleteWorktrees:t,deleteGenerations:e.generations.filter(s=>o.has(s.generationId)),deleteLocks:e.locks.filter(s=>!s.live),deleteTemporaries:e.temporaries.filter(s=>!s.live),protectedGenerationIds:[...r].sort(),unreferencedSince:n}}function at(e,t){let r=new Set(e.filter(n=>n.managed&&(n.live||n.busy)).flatMap(n=>[n.lease.baseGenerationId,n.lease.activeGenerationId]).filter(n=>n!==void 0));for(let n of t)n.live&&r.add(n.generationId);return r}function Xr(e,t,r={}){if(!we())return{kind:"disabled"};let n=r.repositoryId===void 0?K(e)?.repositoryId:r.repositoryId;if(!n)return{kind:"unavailable"};let i=p(w(),"repositories",n),o=(r.now??Date.now)(),a=J(i)?ct(e,i,n,t,o,r):{kind:"unavailable"};return Jt(e,n,t,o,r),a}function ct(e,t,r,n,i,o){let a=p(t,"gc-state.json"),s=lt(a);if(!o.force&&s&&i-Date.parse(s.lastSweepAt)<st)return{kind:"throttled",sweptAt:s.lastSweepAt};let c=xe(t,{now:()=>i});if(!c)return{kind:"busy"};try{let d=dt(e,t,r,s?.unreferencedSince??{}),l=zt({nowMs:i,...d,policy:{generationTtlMs:o.policy?.generationTtlMs??Ht,budgetBytes:o.policy?.budgetBytes??Vt}}),u=0,f=0;for(let h of l.deleteWorktrees){if(!ge(h.lease))continue;if(!J(h.lease.localCacheDir)){E(h.leasePath,{force:!0}),f+=1;continue}if(!Qt(h.lease))continue;let Se=ie(p(h.lease.localCacheDir,"cache-lifecycle.lock"));if(Se)try{if(me(h.lease,!0))continue;try{Ye({projectRoot:h.lease.projectRoot,cacheDir:h.lease.localCacheDir,cliVersion:n})}catch{continue}if(me(h.lease,!0))continue;E(h.lease.localCacheDir,{recursive:!0,force:!0}),E(h.leasePath,{force:!0}),f+=1}finally{Se.release()}}for(let h of l.deleteLocks)E(h.path,{force:!0});for(let h of l.deleteTemporaries)E(h.path,{recursive:!0,force:!0});for(let h of l.deleteGenerations)E(h.path,{recursive:!0,force:!0}),u+=h.size;ke(p(t,"evidence.db"));let g={kind:"swept",sweptAt:new Date(i).toISOString(),deletedWorktrees:f,deletedGenerations:l.deleteGenerations.length,deletedBytes:u,protectedGenerations:l.protectedGenerationIds.length},y={version:1,lastSweepAt:g.sweptAt,unreferencedSince:l.unreferencedSince,lastResult:g};return k(a,y,{spacing:2,trailingNewline:!0}),g}catch(d){return{kind:"failed",error:d instanceof Error?d.message:String(d)}}finally{c.release()}}function Jt(e,t,r,n,i){let o=p(w(),"repositories");if(!J(o))return;let a=p(o,Ut),s=Xt(a);if(!i.force&&s!==void 0&&n-s<st)return;let c=ie(p(o,Bt));if(c)try{for(let d of O(o)){if(d===t||!/^[a-f0-9]{24}$/.test(d))continue;let l=p(o,d),u;try{u=_(l)}catch{continue}if(!u.isDirectory()||u.isSymbolicLink())continue;let f=Yt(l)??e;ct(f,l,d,r,n,i)}k(a,{version:1,lastSweepAt:new Date(n).toISOString()},{spacing:2,trailingNewline:!0})}finally{c.release()}}function Zr(e,t,r){let n=Te(e,r.dbPath,t);if(n)return{state:"bypassed",reason:n,localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let i=K(e);if(!i)return{state:"unavailable",reason:"Git worktree identity is unavailable",localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let o=p(w(),"repositories",i.repositoryId),a=ve(p(o,"worktrees",`${i.worktreeId}.json`)),s=lt(p(o,"gc-state.json")),c=dt(e,o,i.repositoryId,s?.unreferencedSince??{}),d=at(c.leases,c.locks),l=c.generations.filter(y=>!d.has(y.generationId)),u=c.generations.reduce((y,h)=>y+h.size,0),f=qe(e,t),g=0;return f&&(g=Kt(f)),{state:"managed",repositoryId:i.repositoryId,worktreeId:i.worktreeId,localCacheDir:r.cacheDir,...a?{baseGenerationId:a.baseGenerationId,activeGenerationId:a.activeGenerationId,lastAction:a.lastAction,reason:a.lastReason,lastSeenAt:a.lastSeenAt}:{},generations:c.generations.length,generationBytes:u,protectedGenerations:c.generations.filter(y=>d.has(y.generationId)).length,unreferencedGenerations:l.length,unreferencedBytes:l.reduce((y,h)=>y+h.size,0),temporaryGenerations:c.temporaries.length,sharedEvidence:{path:f,exists:g>0,bytes:g},cleanup:s?.lastResult}}function Kt(e){return[e,`${e}-wal`,`${e}-shm`].reduce((t,r)=>{try{return t+it(r).size}catch{return t}},0)}function dt(e,t,r,n){let i=new Set(Ie(e).map(d=>D(d.path))),o=[];for(let d of O(p(t,"worktrees"))){if(!d.endsWith(".json"))continue;let l=p(t,"worktrees",d),u=ve(l);if(!u)continue;let f=D(u.projectRoot);o.push({leasePath:l,lease:u,managed:u.repositoryId===r&&ge(u),live:i.has(f)||J(f),busy:me(u)})}let a=[];for(let d of O(p(t,"locks"))){let l=/^([a-f0-9]{64})\.lock$/.exec(d);if(!l)continue;let u=p(t,"locks",d),f=ye(u),g=f!==void 0&&S(f),y=l[1];a.push({generationId:y,path:u,live:g})}let s=[],c=[];for(let d of O(p(t,"generations"))){let l=/^\.tmp-(\d+)-/.exec(d);if(l){let g=p(t,"generations",d),y=Number(l[1]);try{c.push({path:g,size:rt(g),live:Number.isSafeInteger(y)&&S(y)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(d))continue;let u=p(t,"generations",d),f;try{f=_(u)}catch{continue}!f.isDirectory()||f.isSymbolicLink()||s.push({generationId:d,path:u,size:rt(u),...n[d]===void 0?{}:{unreferencedAt:n[d]}})}return{leases:o,generations:s,locks:a,temporaries:c}}function ge(e){if(e.ownershipChecksum!==_e(e)||A(e.localCacheDir)!==A(Ce(e.projectRoot)))return!1;let t=A(p(w(),"projects"));return A(e.localCacheDir).startsWith(`${t}${ot}`)}function Qt(e){if(!ge(e))return!1;let t=D(w()),r=D(p(t,"projects")),n=D(e.localCacheDir);try{let i=_(t),o=_(r),a=_(n);if(!i.isDirectory()||i.isSymbolicLink()||!o.isDirectory()||o.isSymbolicLink()||!a.isDirectory()||a.isSymbolicLink())return!1;let s=tt(r);return tt(n).startsWith(`${s}${ot}`)}catch{return!1}}function Yt(e){for(let t of O(p(e,"worktrees"))){if(!t.endsWith(".json"))continue;let r=ve(p(e,"worktrees",t));if(r)return r.projectRoot}}function me(e,t=!1){for(let n of t?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let i=ye(p(e.localCacheDir,n));if(i!==void 0&&S(i))return!0}let r=ye(R(e.localCacheDir).lockPath);return r!==void 0&&S(r)}function ve(e){try{let t=JSON.parse(v(e,"worktree cache lease"));return t.version!==1||typeof t.repositoryId!="string"||typeof t.worktreeId!="string"||typeof t.projectRoot!="string"||t.treeOid!==void 0&&typeof t.treeOid!="string"||typeof t.localCacheDir!="string"||t.baseGenerationId!==void 0&&typeof t.baseGenerationId!="string"||t.activeGenerationId!==void 0&&typeof t.activeGenerationId!="string"||typeof t.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(t.ownershipChecksum)||typeof t.lastAction!="string"||t.lastReason!==void 0&&typeof t.lastReason!="string"||typeof t.lastSeenAt!="string"?null:t}catch{return null}}function ye(e){try{let t=JSON.parse(v(e,"watch lock record"));return typeof t.pid=="number"&&Number.isSafeInteger(t.pid)&&t.pid>0?t.pid:void 0}catch{return}}function lt(e){try{let t=JSON.parse(v(e,"repository cache GC state"));return t.version!==1||typeof t.lastSweepAt!="string"||!Number.isFinite(Date.parse(t.lastSweepAt))||!t.unreferencedSince||typeof t.unreferencedSince!="object"||!t.lastResult?null:t}catch{return null}}function Xt(e){try{let t=JSON.parse(v(e,"global repository cache GC state"));if(t.version!==1||typeof t.lastSweepAt!="string")return;let r=Date.parse(t.lastSweepAt);return Number.isFinite(r)?r:void 0}catch{return}}function O(e){try{return nt(e)}catch{return[]}}function rt(e){let t=0,r=[e];for(;r.length>0;){let n=r.pop();for(let i of nt(n,{withFileTypes:!0})){let o=p(n,i.name);i.isDirectory()?r.push(o):i.isFile()&&(t+=it(o).size)}}return t}var ut=[{question:"Who can call or reach this?",family:"execution",direction:"incoming"},{question:"What can this call or reach?",family:"execution",direction:"outgoing"},{question:"Where can this value come from?",family:"dataflow",direction:"incoming"},{question:"Where can this value go?",family:"dataflow",direction:"outgoing"},{question:"Which producer and consumer rendezvous?",family:"runtime",direction:"both"},{question:"What resource is observed or changed?",family:"state",direction:"both"},{question:"What occurs before or after this?",family:"temporal",direction:"both"},{question:"What interface constrains this?",family:"contract",direction:"both"},{question:"Are these observations the same entity?",family:"identity",direction:"both"},{question:"What contains or owns this?",family:"ownership",direction:"both"},{question:"What does this statically rely on?",family:"dependencies",direction:"outgoing"}],pt={execution:{establishes:"Static may-call reachability between resolved program constructs.",nonClaims:["A may-call edge does not prove that a runtime invocation occurred."]},runtime:{establishes:"A source-grounded handoff between producer and consumer participants through a runtime mechanism.",nonClaims:["An unresolved or candidate join does not prove a runtime handoff."]},dataflow:{establishes:"A value, definition, argument, parameter, return, or statically resolved value may flow to another construct.",nonClaims:["Current partial providers do not establish general interprocedural definition-use coverage."]},state:{establishes:"A construct reads, writes, creates, deletes, or otherwise changes an identified state resource.",nonClaims:["A state edge does not prove transactionality, durability, or exclusive ownership unless qualified."]},temporal:{establishes:"One observed construct is locally ordered before or after another under the reported source evidence.",nonClaims:["Source order does not imply cross-process happens-before or durability."]},contract:{establishes:"A program construct implements, constrains, or is typed by an identified contract.",nonClaims:["Contract identity does not prove runtime invocation or conformance outside reported checks."]},identity:{establishes:"Two observations refer to the same compiler-owned or source-owned program entity.",nonClaims:["Shared identity does not establish execution or value transfer."]},ownership:{establishes:"A source construct, symbol, runtime observation, or state resource is contained or owned by another program entity.",nonClaims:["Structural ownership does not establish lifetime, singleton scope, or runtime execution unless qualified."]},dependencies:{establishes:"A file, module, or symbol statically relies on another indexed entity.",nonClaims:["A dependency edge does not establish that the depended-on code executes."]}};function ht(e){return te.flatMap(t=>t.relations.filter(r=>r.family===e).map(r=>({...r,providerId:t.id,providerLabel:t.label})))}function ft(e){return[...new Set(te.filter(t=>t.relations.some(r=>r.family===e)).map(t=>t.label))]}var nn=Ee.map(e=>({family:e,...pt[e],providers:ft(e),relations:ht(e)}));function mt(e){return{family:e,...pt[e],providers:ft(e),relations:ht(e)}}var an=["search","outline","entrypoints","evidence","inspect","code"];function cn(){return ut.map(e=>{let t=mt(e.family);return{...e,establishes:t.establishes,evidenceStrengths:yt(t.relations.flatMap(r=>r.evidenceStrengths)),supportCeilings:yt(t.relations.map(r=>r.supportCeiling)),nonClaim:t.nonClaims.join(" ")}})}function yt(e){return[...new Set(e)]}export{nn as a,Le as b,sr as c,ar as d,kt as e,cr as f,dr as g,lr as h,xr as i,Gt as j,Tr as k,Qe as l,qr as m,$t as n,Ye as o,_r as p,Dr as q,Or as r,Lr as s,he as t,Mr as u,st as v,Xr as w,Zr as x,an as y,cn as z};
3
+ //# sourceMappingURL=chunk-WCIKJ2E3.js.map
@@ -0,0 +1,5 @@
1
+ import{isAbsolute as tt,relative as mn}from"path";var g=class extends Error{constructor(n,r){super(`refusing unsafe project file path ${JSON.stringify(n)} (${r})`);this.relativePath=n;this.reason=r;this.name="UnsafeProjectPathError"}relativePath;reason;code="SCIP_QUERY_UNSAFE_PROJECT_PATH"};function Se(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Bi(e){return e.replace(/\\/g,"/")}function Mi(e,t){return Se(e)===Se(t)}function j(e,t){let n=mn(e,t);return n===""||!n.startsWith("..")&&!tt(n)}function w(e){if(!e)throw new g(e,"empty-path");if(e.includes("\0"))throw new g(e,"nul-byte");if(tt(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new g(e,"absolute-path");let t=Se(e);if(t.split("/").some(r=>r===".."))throw new g(e,"parent-traversal");if(!t||t===".")throw new g(e,"empty-path");return t}function te(e,t,n=[]){let r=xe(e);if(ct.has(r)||n.some(o=>ee(r,o))||t.some(o=>ut(r,o)))return"config";if(t.some(dt)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return"ambient";let i=pt(r);return t.some(o=>(lt[o]??[]).includes(i))?"source":"other"}function at(e,t,n){let r=xe(e);if(ct.has(r)||n?.some(o=>ee(r,o))||ut(r,t)||dt(t)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return!0;let i=pt(r);return(lt[t]??[]).includes(i)}function Gi(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!rt(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!rt(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(be)?null:t}function nt(e){return{...e,files:e.files.map(({semanticHash:t,...n})=>n)}}function Wi(e,t){return!e||!t?e===t:JSON.stringify(nt(e))===JSON.stringify(nt(t))}function zi(e,t){let n=new Map((e?.files??[]).map(a=>[a.path,a])),r=new Map(t.files.map(a=>[a.path,a])),i=new Set([...n.keys(),...r.keys()]),o=[];for(let a of[...i].sort()){let c=n.get(a),u=r.get(a),d=te(a,t.languages);!c&&u?o.push({kind:"added",path:a,inputKind:d,after:u}):c&&!u?o.push({kind:"deleted",path:a,inputKind:d,before:c}):c&&u&&(c.hash!==u.hash||c.size!==u.size)&&o.push({kind:"modified",path:a,inputKind:d,before:c,after:u})}let s=new Set;return e||s.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&s.add("snapshot-version-changed"),(it(e?.files??[])||it(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(yn)&&s.add("unreadable-input"),{version:1,changes:o,projectIdentityChanged:e?!Sn(e,t):!0,uncertainty:[...s].sort()}}function rt(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function it(e){return new Set(e.map(t=>t.path)).size!==e.length}function be(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&Number.isFinite(t.size)&&typeof t.hash=="string"&&(t.semanticHash===void 0||typeof t.semanticHash=="string")}function yn(e){return e.hash==="unreadable"||e.size<0}function Sn(e,t){return ot(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&ot(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function ot(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((i,o)=>i===r[o])}var ct=new Set([".scipquery.json"]),bn={typescript:["tsconfig.json"],javascript:["package.json"],java:["pom.xml","build.gradle"],scala:["build.sbt"],kotlin:["build.gradle.kts"],rust:["Cargo.toml"],python:["pyproject.toml","setup.py"],ruby:["Gemfile"],go:["go.mod"],cpp:["CMakeLists.txt","Makefile"],c:["CMakeLists.txt","Makefile"],csharp:["*.csproj","*.sln"],vb:["*.vbproj","*.sln"],dart:["pubspec.yaml"],php:["composer.json"],clojure:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"]},xn={typescript:["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],javascript:["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.json","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],java:["build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],scala:["plugins.sbt","build.properties"],kotlin:["pom.xml","build.gradle","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],rust:["Cargo.lock","rust-project.json","rust-toolchain","rust-toolchain.toml"],python:["setup.cfg","requirements*.txt","Pipfile","Pipfile.lock","poetry.lock","uv.lock"],ruby:["Gemfile.lock","gems.locked"],go:["go.sum","go.work","go.work.sum"],cpp:["compile_commands.json"],c:["compile_commands.json"],csharp:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],vb:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],dart:["pubspec.lock","analysis_options.yaml"],php:["composer.lock"],clojure:[]},st=new Map;function ut(e,t){return bn[t].some(n=>ee(e,n))||xn[t].some(n=>ee(e,n))}function ee(e,t){let n=xe(t).replace(/^\.\//,"");if(!n)return!1;let r=e.split("/").at(-1)??e,i=n.includes("/")?e:r;if(!n.includes("*")&&!n.includes("?"))return i===n;let o=st.get(n);if(!o){let s=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");o=new RegExp(`^${s}$`),st.set(n,o)}return o.test(i)}function xe(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function pt(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function dt(e){return e==="typescript"||e==="javascript"}var lt={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs",".vue"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ft(e){return typeof e=="string"&&Number.isFinite(Date.parse(e))}function $i(e){return typeof e=="string"&&e.length>0}function Ui(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function qi(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}var Pn=/^[a-f0-9]{64}$/u;function Ji(e){return typeof e=="string"&&Pn.test(e)}function Vi(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/u.test(e)}function Ki(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}var gt=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"];var Pe=2,v=3;var je=new Set(gt);function no(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(s){return{kind:"malformed",reason:`invalid JSON: ${En(s)}`}}if(!R(t))return{kind:"malformed",reason:"metadata must be a JSON object"};let n=t.version;if(!Number.isInteger(n))return{kind:"malformed",reason:"version must be an integer"};if(n!==Pe&&n!==v)return{kind:"unsupported",version:n,direction:n<Pe?"older":"future"};let r=Cn(t,n);if(r)return{kind:"malformed",reason:r};let i=t,o={metadata:i,capabilities:jn(i)};return n===Pe?{kind:"legacy",...o,metadata:i}:{kind:"supported",...o,metadata:i}}function ro(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function io(e){if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.stableGenerationIdentity)return null;let t=e.metadata;return JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages,scipCompanion:t.scipCompanion,sqliteLayoutVersion:t.version===v?t.sqliteLayoutVersion:void 0})}function jn(e){let t=e.fingerprint!==void 0,n=R(e.fingerprint),r=e.indexedLanguages!==void 0,i=e.status==="complete",o=e.version===v?e:null;return{usableForQuery:r,usableForEvidenceCache:t,publishableGeneration:i&&n&&r,stableGenerationIdentity:i&&t&&typeof e.updatedAt=="string",languageShardReuse:!!o?.languageFingerprints,typescriptProjectShardReuse:!!o?.typescriptProjectShards}}function Cn(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!ft(e.updatedAt))return"updatedAt must be a valid timestamp";for(let n of["requestedLanguages","indexedLanguages"])if(e[n]!==void 0&&!Fn(e[n]))return`${n} must contain unique supported languages`;return e.skipped!==void 0&&!kn(e.skipped)?"skipped must contain supported language/reason pairs":e.scipCompanion!==void 0&&e.scipCompanion!=="current"&&e.scipCompanion!=="deferred"?"scipCompanion must be current or deferred":t===v&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===v&&e.languageFingerprints!==void 0&&!wn(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===v&&e.typescriptProjectShards!==void 0&&!Rn(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function oo(e){return e.version===v&&e.sqliteLayoutVersion===1}function Fn(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&je.has(t))?!1:new Set(e).size===e.length}function kn(e){return Array.isArray(e)&&e.every(t=>R(t)&&typeof t.language=="string"&&je.has(t.language)&&typeof t.reason=="string")}function wn(e){return R(e)&&Object.entries(e).every(([t,n])=>je.has(t)&&R(n))}function Rn(e){return R(e)&&Object.values(e).every(t=>R(t)&&Array.isArray(t.files)&&t.files.every(be))}function En(e){return e instanceof Error?e.message:String(e)}import{closeSync as Ce,fstatSync as ne,openSync as Fe,readFileSync as In,readSync as ht}from"fs";import{createHash as vn}from"crypto";var mt=8*1024*1024,Tn=64*1024*1024,On=512*1024*1024,Ln=256*1024*1024,E=class extends Error{constructor(n,r,i,o,s){let a=i==="too-large"?`is ${o} bytes; the safety limit is ${s} bytes`:i==="not-regular"?"is not a regular file":"changed while it was being read";super(`${n} ${JSON.stringify(r)} ${a}`);this.inputKind=n;this.inputPath=r;this.reason=i;this.observedBytes=o;this.limitBytes=s;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="SCIP_QUERY_BOUNDED_FILE_READ"};function re(e,t){T(t.maxBytes);let n=String(e),r=Fe(e,"r");try{let i=ne(r);bt(i,t,n);let o=In(r),s=ne(r);if(s.dev!==i.dev||s.ino!==i.ino||s.size!==i.size||o.byteLength!==i.size)throw new E(t.inputKind,n,"changed-during-read",s.size,t.maxBytes);return o}finally{Ce(r)}}function yt(e,t,n="utf8"){return re(e,t).toString(n)}function z(e,t){return yt(e,{maxBytes:mt,inputKind:t})}function ke(e,t){T(t.maxBytes);let n=[],r=Buffer.allocUnsafe(64*1024),i=0;for(;;){let o=ht(e,r,0,r.length,null);if(o===0)break;if(i+=o,!Number.isSafeInteger(i)||i>t.maxBytes)throw new E(t.inputKind,`file descriptor ${e}`,"too-large",i,t.maxBytes);n.push(Buffer.from(r.subarray(0,o)))}return Buffer.concat(n,i)}function An(e,t,n="utf8"){return ke(e,t).toString(n)}function St(e,t){let n=Fe(e,"r");try{return ke(n,t)}finally{Ce(n)}}function Dn(e,t,n="utf8"){return St(e,t).toString(n)}function ie(e,t,n){T(t.maxBytes);let r=String(e),i=Fe(e,"r");try{let o=ne(i);bt(o,t,r);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,o.size))),a=0;for(;a<o.size;){let u=ht(i,s,0,Math.min(s.length,o.size-a),a);if(u===0)break;n(s.subarray(0,u)),a+=u}let c=ne(i);if(c.dev!==o.dev||c.ino!==o.ino||c.size!==o.size||a!==o.size)throw new E(t.inputKind,r,"changed-during-read",c.size,t.maxBytes);return a}finally{Ce(i)}}function _n(e,t){let n=vn("sha256");return ie(e,t,r=>n.update(r)),n.digest("hex")}function bt(e,t,n){if(!e.isFile())throw new E(t.inputKind,n,"not-regular",Number(e.size),t.maxBytes);if(e.size>t.maxBytes)throw new E(t.inputKind,n,"too-large",Number(e.size),t.maxBytes)}function T(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}import{spawnSync as Mn}from"child_process";import{createHash as Nn}from"crypto";import{existsSync as Gn,lstatSync as Wn,realpathSync as zn}from"fs";import{dirname as Hn,isAbsolute as $n,join as Un,relative as Po,resolve as ae,sep as jo}from"path";var xt=Symbol.for("scip-query.project-file-listing-context.v1"),Pt=globalThis,we=Pt[xt],O=we&&typeof we=="object"?we:{};Pt[xt]=O;function jt(e,t){let n=O.active?O.canonicalProjectRoots:void 0,r=n?.get(e);if(r!==void 0)return r;let i=t();return n?.set(e,i),i}function Ct(){return O.sequence??0}function Ft(e,t,n){let r=O.active,i=r?.get(e);if(i&&i.pathBytes<=t)return i;let o=Bn(n(),(O.sequence??0)+1);if(O.sequence=o.sequence,o.pathBytes>t)throw new RangeError(`Git project file listing exceeded ${t} path bytes.`);return r?.set(e,o),o}function*kt(e){let t=0;for(;t<e.taggedOutput.length;){let n=e.taggedOutput.indexOf("\0",t);if(n<0)return;yield e.taggedOutput.slice(t+2,n),t=n+1}}function Bn(e,t){let n=0,r=0,i=!0;for(;n<e.length;){let o=e.indexOf("\0",n);if(o<0||o<=n+2||e[n+1]!==" ")throw new Error("Git returned a malformed tagged project file listing.");let s=e[n];i&&=s==="H"||s==="?",r+=1,n=o+1}return{taggedOutput:e,pathBytes:Buffer.byteLength(e,"utf8")-r*2,indexAllowsTreeFingerprintReuse:i,sequence:t}}var H={run(e,t){let n=Rt(e,t);return n.kind==="success"?n.output:void 0},runResult:Rt},qn=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],Et=["status","--porcelain=v2","--branch","-z","--untracked-files=all"],oe=/^[0-9a-f]{40,64}$/;function Fo(e,t,n=H){if(!t||t.startsWith("-")||/[\0\r\n]/.test(t))throw new Error(`Invalid Git revision ${JSON.stringify(t)}.`);let r=n.runResult(e,["rev-parse","--verify","--end-of-options",`${t}^{commit}`]);if(r.kind!=="success"||!oe.test(r.output))throw new Error(`Git revision ${JSON.stringify(t)} does not resolve to exactly one commit.`);return r.output}function ko(e,t=H){return Jn(e,t)?.context}function Jn(e,t=H){let n=t.runResult(e,qn);if(n.kind==="success"){let i=Vn(n.output);if(i){let o=Kn(i,t);if(o)return wt(o)}}let r=Yn(e,t);return r?wt(r):void 0}function wt(e){return{context:e,projectFileInventorySequence:Ct()}}function It(e){let t=e.split("\0").filter(Boolean),n=t.find(i=>i.startsWith("# branch.oid "))?.slice(13),r=n==="(initial)"?void 0:n;if(!(r!==void 0&&!oe.test(r))&&n!==void 0)return{headCommit:r,clean:t.every(i=>i.startsWith("# "))}}function Vn(e){let t=e.split(`
2
+ `).map(c=>c.trim());if(t.length!==5)return;let[n,r,i,o,s]=t;if(!n||!r||!i||!o||!s||!oe.test(o)||!oe.test(s))return;let a=I(n);return{root:a,gitDir:I(se(a,r)),commonDir:I(se(a,i)),headCommit:o,treeOid:s}}function Kn(e,t){let n=t.run(e.root,Et);if(n===void 0)return;let r=It(n);return r?.headCommit!==e.headCommit?void 0:{...vt(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:Ee("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.clean}}function Yn(e,t){let n=Xn(e,t);if(n.kind!=="worktree")return;let r=n.identity,i=r.projectRoot,o=t.run(i,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=I(se(i,o)),a=Re(t.run(i,["rev-parse","--verify","HEAD"])),c=Re(t.run(i,["rev-parse","--verify","HEAD^{tree}"])),u=t.run(i,Et);if(u===void 0)return;let d=It(u);if(!(!d||d.headCommit!==a))return{...r,commonDir:s,repositoryId:Ee("repository",s),headCommit:a,treeOid:c,clean:d.clean}}function Xn(e,t=H){let n=t.runResult(e,["rev-parse","--show-toplevel"]);if(n.kind==="not-repository")return{kind:"non-git"};if(n.kind==="error")return n;let r=n.output.trim();if(!r)return{kind:"error",message:"Git returned an empty worktree root."};let i=I(r),o=t.run(i,["rev-parse","--absolute-git-dir"])?.trim();if(!o)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=I(se(i,o));return{kind:"worktree",identity:vt(i,s)}}function vt(e,t){return{projectRoot:e,gitDir:t,worktreeId:Ee("worktree",`${e}\0${t}`)}}function wo(e,t,n=H){return Re(n.run(e,t))}function se(e,t){return $n(t)?t:ae(e,t)}function I(e){try{return zn(e)}catch{return ae(e)}}function Ee(e,t){return Nn("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function Re(e){return e?.trim()||void 0}function Rt(e,t){let n=Mn("git",["-C",e,...t],{encoding:"utf-8",env:{...process.env,LC_ALL:"C"},maxBuffer:52428800,stdio:["ignore","pipe","pipe"],timeout:3e4,killSignal:"SIGKILL"});if(n.status===0)return{kind:"success",output:n.stdout.trimEnd()};let i=(typeof n.stderr=="string"?n.stderr.trim():"")||n.error?.message||`git exited with status ${n.status??"unknown"}`,o=n.error?.code;return(/not a git repository/i.test(i)||o==="ENOENT"&&Gn(ae(e)))&&!Qn(e)?{kind:"not-repository"}:{kind:"error",message:i}}function Qn(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=ae(e);for(;;){try{return Wn(Un(t,".git")),!0}catch(r){let i=r.code;if(i!=="ENOENT"&&i!=="ENOTDIR")return!0}let n=Hn(t);if(n===t)return!1;t=n}}import{createRequire as tr}from"module";import{existsSync as nr,lstatSync as Lo,readdirSync as rr,statSync as ir}from"fs";import f from"path";import{AsyncLocalStorage as Zn}from"async_hooks";var er=new Zn;function L(e,t){let n=ce(e);if(!n||n.missing.has(t))return;let r=n.files.get(t);if(r)return r;let i=n.readBaseFile?.(t);return i&&n.files.set(t,i),i}function A(e,t){let n=ce(e);if(n)return n.missing.has(t)?"missing":n.paths.includes(t)?"present":"missing"}function Tt(e,t){return ce(e)?.fingerprints.get(t)}function D(e){return ce(e)?.paths}function ce(e){let t=er.getStore();if(t)return t.projectRoot===I(e)?t:void 0}var or=tr(import.meta.url),Ot=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]),sr=18003;function ve(e,t=[]){let n=f.resolve(e),r=t.flatMap(c=>cr(n,c));if(r.length>0)return Lt(n,Dt(r));let i=ar(n),o=Dt(i),s=ur(n,o)?[n,...o]:o,a=s.length>0?s:[n];return Lt(n,a)}function _t(e){return new Set(e.map(t=>t==="."?"tsconfig.json":`${t.replace(/\/$/u,"")}/tsconfig.json`))}function Bt(e){let t=e.split("/").at(-1)?.toLowerCase();return t?.startsWith("tsconfig")===!0&&t.endsWith(".json")}function Mt(e,t,n=[]){let r;try{r=or("@ts-morph/common/dist/typescript.js")}catch{return null}let i=f.resolve(e),o=t==="workspace"?ve(i,n):["."],s=new Set;for(let a of o){let c=a==="."?i:f.join(i,a),u=f.join(c,"tsconfig.json"),d=fr(r,i);if(!d.fileExists(u))return null;let p=r.readConfigFile(u,d.readFile);if(p.error)return null;let l=r.parseJsonConfigFileContent(p.config,d,c);if(l.errors.some(m=>m.code!==sr))return null;for(let m of l.fileNames){let h=f.resolve(m);j(i,h)&&s.add(f.relative(i,h).split(f.sep).join("/"))}}return s}function Lt(e,t){return[...new Set(t.map(n=>$(e,n)))].sort((n,r)=>n.localeCompare(r))}function ar(e){let t=D(e);if(t)return t.flatMap(i=>{if(i.split("/").some(s=>Ot.has(s)))return[];let o=f.join(e,...i.split("/"));return At(e,o)?[f.dirname(o)]:[]});let n=[],r=[e];for(;r.length>0;){let i=r.pop(),o;try{o=rr(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=f.join(i,s.name);if(s.isDirectory()){!Ot.has(s.name)&&!s.name.startsWith(".")&&r.push(a);continue}s.isFile()&&At(e,a)&&n.push(f.dirname(a))}}return n}function cr(e,t){let n=t.trim();if(!n)return[];let r=f.resolve(e,n);if(!j(e,r))return[];let i=D(e);if(i){let o=$(e,r);if(i.includes(o)&&Ie(f.basename(r)))return[f.dirname(r)];let s=o==="."?"":`${o}/`;return i.some(a=>a.startsWith(s))?[r]:[]}try{let o=ir(r);if(o.isDirectory())return[r];if(o.isFile()&&Ie(f.basename(r)))return[f.dirname(r)]}catch{return[]}return[]}function At(e,t){if(!Ie(f.basename(t)))return!1;let n=Nt(e,t);return n?f.basename(t)==="tsconfig.json"||"include"in n||"files"in n||"references"in n:!1}function Ie(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function Dt(e){let t=[...new Set(e.map(n=>f.resolve(n)))].sort((n,r)=>n.localeCompare(r));return t.length<=1?t:t.filter(n=>!t.some(r=>r!==n&&hr(n,r)))}function ur(e,t){if(t.length===0||t.some(r=>f.resolve(r)===e))return!1;let n=f.join(e,"tsconfig.json");return dr(e,n)&&pr(e,n)}function pr(e,t){let r=Nt(e,t)?.include;return Array.isArray(r)?r.some(i=>typeof i=="string"&&i.trim()!==""&&!i.startsWith("!")&&(i.includes("/")||i.includes("**")||!f.extname(i))):!1}function Nt(e,t){try{let n=JSON.parse(lr(e,t));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function dr(e,t){let n=$(e,t),r=A(e,n);return r?r==="present":nr(t)}function lr(e,t){let n=$(e,t);if(D(e)){let i=L(e,n);if(!i)throw Object.assign(new Error(`Snapshot file ${n} is missing.`),{code:"ENOENT"});return i.content.toString("utf8")}return z(t,"TypeScript project config")}function fr(e,t){let n=D(t);if(!n)return e.sys;let r=f.resolve(t),i=new Set(n),o=gr(r,n),s=e,a=c=>{let u=f.resolve(c);return j(r,u)?$(r,u):null};return{useCaseSensitiveFileNames:e.sys.useCaseSensitiveFileNames,fileExists(c){let u=a(c);return u===null?e.sys.fileExists(c):i.has(u)},readFile(c){let u=a(c);return u===null?e.sys.readFile(c):L(r,u)?.content.toString("utf8")},readDirectory(c,u,d,p,l){let m=f.resolve(c);return j(r,m)?s.matchFiles(m,u,d,p,e.sys.useCaseSensitiveFileNames,r,l,h=>o.get(f.resolve(h))??{files:[],directories:[]},h=>h):e.sys.readDirectory(c,u,d,p,l)}}}function gr(e,t){let n=new Map,r=new Map,i=o=>{n.has(o)||n.set(o,new Set),r.has(o)||r.set(o,new Set)};i(e);for(let o of t){let s=o.split("/"),a=e;for(let c=0;c<s.length-1;c+=1){let u=s[c];i(a),r.get(a).add(u),a=f.join(a,u),i(a)}n.get(a).add(s.at(-1))}return new Map([...n].map(([o,s])=>[o,{files:[...s].sort(),directories:[...r.get(o)??[]].sort()}]))}function $(e,t){let n=f.relative(e,t);return n?n.split(f.sep).join("/"):"."}function hr(e,t){let n=f.relative(e,t);return!!n&&!n.startsWith("..")&&!f.isAbsolute(n)}import{createHash as Le}from"crypto";import{execFileSync as Gt}from"child_process";import{createRequire as mr}from"module";var yr=mr(import.meta.url),Sr=/\.(?:[cm]?[jt]sx?)$/iu,br=/\.[jt]sx$/iu,Wt=/(?:^|\/)package\.json$/iu,U,Te=new Map;function zt(e,t){if(!Ae(e))return;let n=xr();if(n)try{let r=typeof t=="string"?t:t.toString("utf8"),i=br.test(e)?n.LanguageVariant.JSX:n.LanguageVariant.Standard,o=n.createScanner(n.ScriptTarget.Latest,!1,i,r),s=Le("sha256").update(`typescript-semantic-v1\0${i}\0`),a=!1,c=!1;for(;;){let u=o.scan();if(u===n.SyntaxKind.EndOfFileToken)break;if(u===n.SyntaxKind.WhitespaceTrivia)continue;if(u===n.SyntaxKind.NewLineTrivia){a&&(c=!0);continue}c&&s.update("line-break\0");let d=o.getTokenText();s.update(`${u}\0${Buffer.byteLength(d)}\0`).update(d).update("\0"),a=!0,c=!1}return s.digest("hex")}catch{return}}function Ae(e){return Sr.test(e)}function De(e,t){if(Wt.test(e))try{let n=JSON.parse(typeof t=="string"?t:t.toString("utf8"));if(typeof n!="object"||n===null||Array.isArray(n))return;let{scripts:r,...i}=n;return Le("sha256").update("typescript-package-json-v1\0").update(Oe(i)).digest("hex")}catch{return}}function _e(e){return Wt.test(e)}function zo(e,t,n){if(!_e(t)||!/^[a-f0-9]{64}$/u.test(n))return;let r=`${e}\0${t}\0${n}`;if(Te.has(r))return Te.get(r);let i;try{let o=Gt("git",["-C",e,"log","--all","--format=%H","--max-count=64","--",t],{encoding:"utf8",maxBuffer:1048576,timeout:5e3}).split(/\r?\n/u).filter(Boolean);for(let s of o){let a=Gt("git",["-C",e,"show",`${s}:${t}`],{encoding:null,maxBuffer:4194304,timeout:5e3});if(Le("sha256").update(a).digest("hex")===n){i=De(t,a);break}}}catch{i=void 0}return Te.set(r,i),i}function xr(){if(U!==void 0)return U;try{U=yr("typescript")}catch{U=null}return U}function Oe(e){return Array.isArray(e)?`[${e.map(Oe).join(",")}]`:typeof e=="object"&&e!==null?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${Oe(n)}`).join(",")}}`:JSON.stringify(e)}import{createHash as Vt,randomUUID as Ir}from"crypto";import{chmodSync as Kt,existsSync as _,linkSync as vr,lstatSync as fe,readdirSync as Ne,realpathSync as C,unlinkSync as Tr,writeSync as Or}from"fs";import{homedir as Lr}from"os";import{basename as Ar,dirname as ge,isAbsolute as qt,join as y,resolve as he}from"path";import{closeSync as Pr,existsSync as jr,fsyncSync as Cr,mkdirSync as Fr,openSync as kr}from"fs";import{dirname as Ht}from"path";function ue(e,t,n,r){let i=0;for(;i<t.length;){let o=n.writeFile(e,t,i,t.length-i);if(!Number.isSafeInteger(o)||o<=0||o>t.length-i)throw new Error(`${r} write did not make valid forward progress`);i+=o}}function Be(e,t){if(t!=="win32")return!1;let n=e.code;return n==="EACCES"||n==="EBADF"||n==="EINVAL"||n==="EISDIR"||n==="EPERM"}var q=Object.freeze({platform:process.platform,pathExists:e=>jr(e),makeDirectory:e=>Fr(e,{recursive:!0}),openFile:(e,t,n)=>kr(e,t,n),syncFile:e=>Cr(e),closeFile:e=>Pr(e)});function $t(e,t=q){let n=[],r=e;for(;!t.pathExists(r);){n.push(r);let o=Ht(r);if(o===r)throw new Error(`Cannot establish a durable directory path without an existing ancestor: ${e}`);r=o}let i="synced";for(let o of n.reverse())t.makeDirectory(o),i=de(i,pe(Ht(o),t));return i}function pe(e,t=q){let n;try{n=t.openFile(e,"r")}catch(r){if(Be(r,t.platform))return"unsupported";throw r}try{t.syncFile(n)}catch(r){try{t.closeFile(n)}catch{}if(Be(r,t.platform))return"unsupported";throw r}return t.closeFile(n),"synced"}function de(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{createRequire as wr}from"module";var Rr=wr(import.meta.url),Ut=Er().version;function Er(){for(let e of["../package.json","../../package.json"])try{return Rr(e)}catch{}return{version:"0.0.0"}}var Yt=1,V=".scip-query-cache-owner.json",Dr=16*1024,Xt=Object.freeze({...q,randomToken:()=>Ir(),linkFile:(e,t)=>vr(e,t),removeFile:e=>Tr(e),writeFile:(e,t,n,r)=>Or(e,t,n,r)});function le(e,t){return Object.assign(new Error(`refusing unsafe project dbPath ${JSON.stringify(e)} (${t}); use a repository-relative directory that remains inside the checkout`),{name:"UnsafeCachePathError",code:"SCIP_QUERY_UNSAFE_CACHE_PATH",configuredPath:e,reason:t})}function F(e,t){return Object.assign(new Error(`refusing unowned cache directory ${JSON.stringify(e)} (${t}); move unrelated data elsewhere or choose a new empty dbPath`),{name:"CacheOwnershipError",code:"SCIP_QUERY_CACHE_OWNERSHIP",cacheDir:e,reason:t})}function _r(e,t){let n=C(e);return Mr(n,Ge(n,t))}function Ge(e,t){let n=C(e),r=process.env.SCIP_QUERY_CACHE_DIR;return r?he(r):t?.dbPath?Gr(n,t.dbPath):Br(n)}function Qt(){let e=process.env.XDG_CACHE_HOME;return y(e||y(Lr(),".cache"),"scip-query")}function Br(e){let t=he(e);try{t=C(t)}catch{}let n=Vt("sha256").update(t).digest("hex").slice(0,12);return y(Qt(),"projects",n)}function ss(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=y(Qt(),"repositories",e);return tn(t),C(t)}function as(e){return process.env.SCIP_QUERY_SHARED_CACHE!=="0"&&!process.env.SCIP_QUERY_CACHE_DIR&&!process.env.SCIP_QUERY_INDEX_DB&&!e?.dbPath}function cs(e,t){let n=_r(e,t);return{cacheDir:n,dbPath:y(n,"index.db"),indexPath:y(n,"index.scip"),metaPath:y(n,"meta.json")}}function Mr(e,t,n=Xt){return Nr(e,t,n).cacheDir}function Nr(e,t,n=Xt){let r=C(e),i=_(t)?"synced":tn(t,n),o=C(t),s=y(o,V);if(_(s))return Me(r,o),We(s),J(o),{kind:"existing",cacheDir:o};Jt(o),Ur(o),Jt(o);let c=`${JSON.stringify({schemaVersion:Yt,canonicalProjectRoot:r,canonicalCacheDir:o,creatorVersion:Ut},null,2)}
3
+ `;try{let u=qr(s,c,n),d=de(i,u);return{kind:"published",cacheDir:o,achievedDurability:d==="synced"?"directory-durable":"file-flushed",directorySync:d}}catch(u){if(Vr(u))return Me(r,o),{kind:"existing",cacheDir:o};throw u}}function Me(e,t){let n=C(e),r=C(t);return zr(r,n,r)}function us(e,t){return _(y(t,V))?(Me(e,t),Zt(t),!0):!1}function Gr(e,t){let n;try{n=w(t)}catch(s){throw s instanceof g?le(t,s.reason):s}let r=he(e,...n.split("/"));if(r===e||!j(e,r))throw le(t,"outside-project");let i=Wr(r),o=C(i);if(!j(e,o)&&o!==e)throw le(t,"symlink-escape");return r}function Wr(e){let t=e;for(;!_(t);){let n=ge(t);if(n===t)throw le(e,"no-existing-ancestor");t=n}return t}function zr(e,t,n){let r=y(e,V);if(!_(r)||fe(r).isSymbolicLink())throw F(e,"missing regular ownership record");let i=fe(r);if(!i.isFile()||i.size>Dr)throw F(e,"invalid ownership record file");let o=z(r,"cache ownership record"),s=Hr(o,e);if(t!==void 0&&s.canonicalProjectRoot!==t)throw F(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==n)throw F(e,"ownership record names a different cache directory");return{record:s,ownerSha256:Vt("sha256").update(o).digest("hex"),physicalCacheDir:e}}function Hr(e,t){try{let n=JSON.parse(e);if(n.schemaVersion!==Yt||typeof n.canonicalProjectRoot!="string"||typeof n.canonicalCacheDir!="string"||typeof n.creatorVersion!="string"||!qt(n.canonicalProjectRoot)||!qt(n.canonicalCacheDir))throw new Error("invalid fields");return n}catch(n){throw F(t,`malformed ownership record: ${n instanceof Error?n.message:String(n)}`)}}function Jt(e){let t=Ne(e).filter(n=>n!==V&&!$r(n));if(t.length>0)throw F(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function $r(e){return e.startsWith(`${V}.tmp-`)||e.startsWith("git-worktree-context.json.tmp-")||[".scipquery-generations","affected-shadow-latest.json","affected-shadow.jsonl","agent-hooks","augment-vue-meta.json","cache-lifecycle.lock","evidence.db","evidence.db-shm","evidence.db-wal","health-report-cache.json","git-worktree-context.json","index.db","index.db-shm","index.db-wal","index.lock","index.scip","language-indexes","meta.json","reindex-activity.jsonl","shared-cache.json","typescript-index","typescript-scip-fragments","typescript-scip-overlays","typescript-semantic","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function Ur(e){for(let t of Ne(e)){let n=y(e,t);try{let r=fe(n);if(r.isSymbolicLink())throw F(e,`legacy cache entry ${t} is a symlink`);if(r.isDirectory())J(n);else if(r.isFile())We(n);else throw F(e,`legacy cache entry ${t} is not a file or directory`)}catch(r){if(en(r))continue;throw r}}J(e)}function Zt(e,t=!1){try{let n=fe(e);if(n.isSymbolicLink())throw F(e,"managed cache tree contains a symlink");if(n.isFile()){We(e);return}if(!n.isDirectory())throw F(e,"managed cache tree contains a special file");J(e);for(let r of Ne(e))Zt(y(e,r),!0)}catch(n){if(t&&en(n))return;throw n}}function en(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function tn(e,t=q){let n=$t(e,t);return J(e),n}function qr(e,t,n){let r=`${e}.tmp-${process.pid}-${n.randomToken()}`,i,o=!1;try{i=n.openFile(r,"wx",384),o=!0,ue(i,Buffer.from(t),n,"cache ownership record"),n.syncFile(i),n.closeFile(i),i=void 0,n.linkFile(r,e);let s=pe(ge(e),n);return n.removeFile(r),o=!1,de(s,pe(ge(e),n))}finally{if(i!==void 0)try{n.closeFile(i)}catch{}if(o)try{n.removeFile(r)}catch{}}}function J(e){process.platform!=="win32"&&Kt(e,448)}function We(e){process.platform!=="win32"&&Kt(e,384)}function Jr(e){if(_(e))return C(e);let t=C(ge(e));return y(t,Ar(e))}function ps(e){return Jr(he(e))}function Vr(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{execFileSync as pi}from"child_process";import{isUtf8 as un}from"buffer";import{createHash as Je}from"crypto";import{closeSync as ln,fstatSync as K,lstatSync as Ke,openSync as fn,readdirSync as di,readFileSync as li,readSync as pn,readlinkSync as fi,realpathSync as X}from"fs";import{isAbsolute as gi,join as Ye,relative as hi,resolve as mi,sep as yi}from"path";import{closeSync as nn,existsSync as He,openSync as Kr,realpathSync as Yr,renameSync as Xr,unlinkSync as rn,writeSync as Qr}from"fs";import{dirname as Zr,join as ei}from"path";var ti="fingerprint-stat-cache.json",on=1,ni=8*1024*1024,ze=new Map;function $e(e,t,n,r){let i=sn(e),o=i.files.get(t);if(!(!o||!an(o,n,r)))return i.hits+=1,{hash:o.hash,size:o.fingerprintSize,...o.semanticHash===void 0?{}:{semanticHash:o.semanticHash}}}function Ue(e,t,n,r,i){if(i.hash==="unreadable"||i.size<0||!Number.isFinite(i.size))return;let o=sn(e),s={kind:n,dev:r.dev,ino:r.ino,mtimeMs:r.mtimeMs,ctimeMs:r.ctimeMs,size:r.size,hash:i.hash,fingerprintSize:i.size,...i.semanticHash===void 0?{}:{semanticHash:i.semanticHash}},a=o.files.get(t);a&&ci(a,s)||(o.files.set(t,s),o.stores+=1,o.dirty=!0)}function qe(e){let t=ze.get(cn(e));if(!(!t?.dirty||!t.cachePath))try{let n=Zr(t.cachePath);if(!He(n))return;ui(t.cachePath,oi(t)),t.dirty=!1}catch{}}function sn(e){let t=cn(e),n=ze.get(t);if(n)return n;let r=ri(t),i=ii(r),o={cachePath:r,files:i,dirty:!1,hits:0,stores:0};return ze.set(t,o),o}function ri(e){try{let t=Ge(e);return He(t)?ei(t,ti):null}catch{return null}}function ii(e){let t=new Map;if(!e||!He(e))return t;try{let n=JSON.parse(re(e,{inputKind:"fingerprint stat cache",maxBytes:ni}).toString("utf8"));if(!si(n))return t;for(let[r,i]of Object.entries(n.files))i&&t.set(r,i)}catch{return t}return t}function oi(e){return{version:on,files:Object.fromEntries(e.files)}}function si(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.version!==on||typeof t.files!="object"||t.files===null?!1:Object.values(t.files).every(ai)}function ai(e){if(typeof e!="object"||e===null)return!1;let t=e;return(t.kind==="file"||t.kind==="symlink")&&Number.isFinite(t.dev)&&Number.isFinite(t.ino)&&Number.isFinite(t.mtimeMs)&&Number.isFinite(t.ctimeMs)&&Number.isFinite(t.size)&&Number.isFinite(t.fingerprintSize)&&typeof t.hash=="string"&&t.hash!=="unreadable"&&(t.semanticHash===void 0||typeof t.semanticHash=="string")}function an(e,t,n){return e.kind===t&&e.dev===n.dev&&e.ino===n.ino&&e.mtimeMs===n.mtimeMs&&e.ctimeMs===n.ctimeMs&&e.size===n.size}function ci(e,t){return an(e,t.kind,t)&&e.hash===t.hash&&e.fingerprintSize===t.fingerprintSize&&e.semanticHash===t.semanticHash}function ui(e,t){let n=`${e}.${process.pid}.tmp`;try{rn(n)}catch{}let r=Buffer.from(`${JSON.stringify(t)}
4
+ `,"utf8"),i=Kr(n,"wx",384);try{ue(i,r,{writeFile:(o,s,a,c)=>Qr(o,s,a,c)},"fingerprint stat cache")}catch(o){throw nn(i),rn(n),o}nn(i),Xr(n,e)}function cn(e){return Yr(e)}var Q=64*1024*1024,Si=1024*1024,bi=1024,B=class extends Error{constructor(n,r,i,o){super(`${n} ${JSON.stringify(r)} is ${i} bytes; the safety limit is ${o} bytes`);this.inputKind=n;this.inputPath=r;this.observedBytes=i;this.limitBytes=o;this.name="InputTooLargeError"}inputKind;inputPath;observedBytes;limitBytes;code="SCIP_QUERY_INPUT_TOO_LARGE"};function xi(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,n)=>t.localeCompare(n))}function Xe(e,t,n={}){let r=w(t),i=jt(e,()=>X(e)),o=mi(i,...r.split("/"));if(!j(i,o)||o===i)throw new g(t,"outside-project");let s=X(o);if(!j(i,s)||s===i)throw new g(t,"outside-project");let a=Ke(s);if(!a.isFile())throw new g(t,"not-a-file");let c={projectRoot:i,relativePath:r,absolutePath:s,size:a.size,mtimeMs:a.mtimeMs,device:a.dev,inode:a.ino},u=n.maxBytes??Q;if(T(u),c.size>u)throw new B(n.inputKind??"project file",c.relativePath,c.size,u);return c}function Pi(e,t,n={}){let r=w(t),i=A(e,r);if(i){if(i==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(r)} does not exist.`),{code:"ENOENT"});let c=L(e,r);if(!c)throw new g(r,"changed-during-read");let u=n.maxBytes??Q;if(T(u),c.size>u)throw new B(n.inputKind??"project file",r,c.size,u);return Buffer.from(c.content)}let o=Xe(e,t,n),s=n.maxBytes??Q,a=fn(o.absolutePath,"r");try{let c=K(a);if(Y(c,o,t),c.size>s)throw new B(n.inputKind??"project file",o.relativePath,c.size,s);let u=li(a),d=K(a);if(Y(d,o,t),u.byteLength!==c.size)throw new g(t,"changed-during-read");return u}finally{ln(a)}}function Ts(e,t,n,r={}){if(n.byteLength===0)throw new Error("Project file probe literal must not be empty.");let{matchedLiteralIndexes:i,...o}=ji(e,t,[n],r);return{...o,includesLiteral:i.length>0}}function ji(e,t,n,r={}){if(n.length===0||n.some(c=>c.byteLength===0))throw new Error("Project file probe literals must not be empty.");let i=w(t),o=A(e,i);if(o){if(o==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(i)} does not exist.`),{code:"ENOENT"});let c=L(e,i);if(!c)throw new g(i,"changed-during-read");let u=r.maxBytes??Q;if(T(u),c.size>u)throw new B(r.inputKind??"project file",i,c.size,u);let d=!c.content.includes(0)&&un(c.content),p=n.map(dn),l=d?Fi(c.content,n,p):[];return{byteLength:c.size,isUtf8Text:d,matchedLiteralIndexes:l,bytes:l.length>0?Buffer.from(c.content):null,...r.computeSha256?{sha256:c.sha256}:{}}}let s=Xe(e,t,r),a=fn(s.absolutePath,"r");try{let c=K(a);Y(c,s,t);let u=r.computeSha256?Je("sha256"):null,d=r.scratchBuffer??Buffer.allocUnsafe(Si);if(d.byteLength===0)throw new Error("Project file probe scratch buffer must not be empty.");let p=0,l=n.map(()=>!1),m=!1,h=!0,b=Buffer.alloc(0),Z=n.map(()=>Buffer.alloc(0)),M=n.map(dn);for(;p<c.size;){let x=pn(a,d,0,Math.min(d.byteLength,c.size-p),p);if(x<=0)throw new g(t,"changed-during-read");let P=d.subarray(0,x);if(u?.update(P),m||=P.includes(0),h){let S=b.byteLength>0?Buffer.concat([b,P]):P,W=Ci(S);h=un(S.subarray(0,W)),b=Buffer.from(S.subarray(W))}for(let S=0;S<n.length;S+=1){if(l[S])continue;let W=n[S],et=Z[S];l[S]=ki(P,W,et,M[S]),Z[S]=wi(P,W,et)}p+=x}h&&=b.byteLength===0,Y(K(a),s,t);let N=!m&&h,G=N?l.flatMap((x,P)=>x?[P]:[]):[],k=null;if(G.length>0){k=Buffer.allocUnsafe(c.size);let x=0;for(;x<k.byteLength;){let P=pn(a,k,x,k.byteLength-x,x);if(P<=0)throw new g(t,"changed-during-read");x+=P}Y(K(a),s,t)}return{byteLength:c.size,isUtf8Text:N,matchedLiteralIndexes:G,bytes:k,...u?{sha256:u.digest("hex")}:{}}}finally{ln(a)}}function Os(e,t,n={}){return Pi(e,t,n).toString("utf8")}function Y(e,t,n){if(!e.isFile()||e.dev!==t.device||e.ino!==t.inode||e.size!==t.size)throw new g(n,"changed-during-read")}function Ci(e){if(e.byteLength===0)return 0;let t=e.byteLength-1,n=0;for(;t>=0&&n<3&&(e[t]&192)===128;)n+=1,t-=1;if(t<0)return e.byteLength;let r=e[t];return((r&128)===0?1:(r&224)===192?2:(r&240)===224?3:(r&248)===240?4:0)>e.byteLength-t?t:e.byteLength}function Fi(e,t,n){return t.flatMap((r,i)=>Ve(e,r,n[i])?[i]:[])}function ki(e,t,n,r){if(Ve(e,t,r))return!0;if(n.byteLength===0||t.byteLength===1)return!1;let i=e.subarray(0,Math.min(e.byteLength,t.byteLength-1));return Ve(Buffer.concat([n,i]),t,r)}function Ve(e,t,n){if(n<0)return e.includes(t);let r=t[n],i=e.indexOf(r),o=0;for(;i>=0;){if(o+=1,o>bi)return e.includes(t);let s=i-n;if(s>=0&&s+t.byteLength<=e.byteLength&&e.compare(t,0,t.byteLength,s,s+t.byteLength)===0)return!0;i=e.indexOf(r,i+1)}return!1}function dn(e){for(let n=1;n<e.byteLength;n+=1){let r=e[n];if(r>=65&&r<=90)return n}let t=e[0];return t>=65&&t<=90?0:-1}function wi(e,t,n){let r=t.byteLength-1;if(r===0)return Buffer.alloc(0);if(e.byteLength>=r)return Buffer.from(e.subarray(e.byteLength-r));let i=Buffer.concat([n,e]);return Buffer.from(i.subarray(Math.max(0,i.byteLength-r)))}function Qe(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function Ls(e,t){try{return Xe(e,t),!0}catch(n){if(Qe(n))return!1;throw n}}function Ri(e){let t=D(e);return t?t.filter(n=>n&&!ye(n)).sort():(Li(e)??Ai(e)).filter(n=>n&&!ye(n)).sort()}function Ei(e,t={}){let n=(t.includePaths??[]).map(w),r=[...new Set([...Ri(e),...n])].filter(s=>!ye(s)).filter(s=>!t.language||at(s,t.language,t.markerFiles)).filter(s=>!t.includePath||t.includePath(s)).sort((s,a)=>s.localeCompare(a)),i=X(e),o=r.flatMap(s=>gn(e,i,s));return qe(i),o}function gn(e,t,n){let r=Tt(e,n);if(r)return[{path:n,size:r.fingerprintSize??r.size,hash:r.sha256}];if(A(e,n)==="present"){let o=L(e,n);if(o)return[{path:n,size:o.fingerprintSize??o.size,hash:o.sha256}]}let i=Ye(e,n);try{let o=Ke(i);if(o.isSymbolicLink()){let b=$e(t,n,"symlink",me(o));if(b)return[{path:n,size:b.size,hash:b.hash}];let Z=X(i),M=hi(t,Z);if(M===".."||M.startsWith(`..${yi}`)||gi(M))throw new Error("external symlink");let N=fi(i),G=Je("sha256").update("symlink\0").update(N).digest("hex"),k=Buffer.byteLength(N);return Ue(t,n,"symlink",me(o),{hash:G,size:k}),[{path:n,size:k,hash:G}]}let s=Ae(n)||_e(n),a=$e(t,n,"file",me(o));if(a&&(!s||a.semanticHash!==void 0))return[{path:n,size:a.size,hash:a.hash,...a.semanticHash===void 0?{}:{semanticHash:a.semanticHash}}];let c=Je("sha256"),u=s,d=[],p=ie(i,{inputKind:"project fingerprint input",maxBytes:Q},b=>{c.update(b),u&&d.push(Buffer.from(b))}),l=c.digest("hex"),m=u?Buffer.concat(d,p):void 0,h=m?zt(n,m)??De(n,m):void 0;return Ue(t,n,"file",me(o),{hash:l,size:p,...h===void 0?{}:{semanticHash:h}}),[{path:n,size:p,hash:l,...h===void 0?{}:{semanticHash:h}}]}catch(o){return Qe(o)?[]:[{path:n,size:-1,hash:"unreadable"}]}}function me(e){return{dev:e.dev,ino:e.ino,mtimeMs:e.mtimeMs,ctimeMs:e.ctimeMs,size:e.size}}function hn(e,t,n){let r=Ze(t,n),i=[...r.typescriptProjects.filter(c=>Ti(e,c)),...r.clojureConfigPath?[r.clojureConfigPath]:[]],o=r.languages.includes("typescript")?Mt(e,r.typescriptProjectMode,r.typescriptProjects):null,s=r.languages.includes("typescript")?r.typescriptProjectMode==="workspace"?ve(e,r.typescriptProjects):["."]:[],a=_t(s);return{...r,files:Ei(e,{includePath:c=>{if(c===".scipquery.json")return!1;let u=te(c,t,i);return u==="other"||u==="config"&&Bt(c)&&!a.has(c)?!1:u!=="source"||!vi(c)||!o?!0:o.has(c)},includePaths:i})}}function As(e,t){let n=new Set(t.files.map(o=>o.path)),r=hn(e,t.languages,t),i=new Map(r.files.map(o=>[o.path,o]));return{...Ze(t.languages,t),files:[...t.files.flatMap(o=>{let s=i.get(o.path);return s?[s]:[]}),...r.files.filter(o=>!n.has(o.path))]}}function Ds(e,t,n,r,i,o){let s=p=>({mode:"full",fingerprint:hn(e,t,n),reason:p});if(!i)return s("change-journal-unavailable");if(!i.complete)return s(`change-journal-incomplete:${i.incompleteReason??"unknown"}`);if(!o)return s("accepted-generation-unavailable");if(i.baseGeneration!==o)return s("change-journal-base-mismatch");if(!r)return s("prior-project-input-snapshot-unavailable");let a=Ze(t,n);if(!Ii(r,a))return s("project-input-configuration-changed");if(new Set(r.files.map(p=>p.path)).size!==r.files.length)return s("prior-project-input-snapshot-has-duplicate-paths");if(i.entries.length===0)return{mode:"delta",fingerprint:{...a,files:[...r.files].sort((p,l)=>p.path.localeCompare(l.path))},changedPaths:[]};let c=[...a.typescriptProjects,...a.clojureConfigPath?[a.clojureConfigPath]:[]],u=new Map(r.files.map(p=>[p.path,p]));for(let p of i.entries){let l=u.get(p.path);if(te(p.path,t,c)!=="source")return s("non-source-project-input-changed");if(p.kind==="add"&&l)return s("added-path-already-in-prior-project-input-snapshot");if(p.kind==="delete"&&!l)return s("deleted-path-not-in-prior-project-input-snapshot");if(p.kind==="change"&&!l)return s("changed-path-not-in-prior-project-input-snapshot");if(l&&(l.hash==="unreadable"||l.size<0))return s("changed-path-was-unreadable")}let d=X(e);for(let p of i.entries){let l=gn(e,d,p.path);if(p.kind==="delete"){if(l.length!==0)return s("deleted-source-is-still-readable");u.delete(p.path);continue}if(l.length!==1||l[0].hash==="unreadable"||l[0].size<0)return s(p.kind==="add"?"added-source-is-not-readable":"changed-source-no-longer-readable");u.set(p.path,l[0])}return qe(d),{mode:"delta",fingerprint:{...a,files:[...u.values()].sort((p,l)=>p.path.localeCompare(l.path))},changedPaths:i.entries.map(p=>p.path).sort()}}function Ii(e,t){return e.version===t.version&&JSON.stringify([...e.languages].sort())===JSON.stringify(t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&JSON.stringify([...e.typescriptProjects].sort())===JSON.stringify(t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function vi(e){return/\.(?:[cm]?[jt]sx?|vue)$/iu.test(e)}function Ti(e,t){let n;try{n=w(t)}catch{return!1}let r=A(e,n);if(r)return r==="present";try{return Ke(Ye(e,n)).isFile()}catch(i){if(Qe(i))return!1;throw i}}function Ze(e,t){return{version:3,languages:[...e].sort(),pnpmWorkspaces:t.typescriptProjectMode!=="workspace"&&t.pnpmWorkspaces===!0,typescriptProjectMode:t.typescriptProjectMode??"single",typescriptProjects:xi(t.typescriptProjects),clojureConfigPath:Oi(t.clojureConfigPath)}}function Oi(e){return e?.trim()||void 0}function Li(e){try{let t=Ft(e,52428800,()=>pi("git",["-C",e,"ls-files","-co","-v","-z","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:104857600,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"}));return[...kt(t)]}catch{return null}}function Ai(e){let t=[],n=[""];for(;n.length>0;){let r=n.pop(),i=r?Ye(e,r):e,o;try{o=di(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=r?`${r}/${s.name}`:s.name;if(s.isDirectory()){ye(a)||n.push(a);continue}t.push(a)}}return t}function ye(e){let t=e.split("/");return e==="meta.json"||t[0]===".scipquery"&&(t[1]==="events"||t[1]==="ledger"||t[1]==="releases"||t[1]==="suppressions")||t.some(n=>Di.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var Di=new Set([".git","node_modules",".scipquery-cache",".scipquery-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);export{g as a,Se as b,Bi as c,Mi as d,j as e,w as f,te as g,at as h,Gi as i,nt as j,Wi as k,zi as l,bn as m,R as n,ft as o,$i as p,Ui as q,qi as r,Ji as s,Vi as t,Ki as u,gt as v,v as w,no as x,ro as y,io as z,jn as A,oo as B,mt as C,Tn as D,On as E,Ln as F,E as G,re as H,yt as I,z as J,An as K,Dn as L,ie as M,_n as N,ue as O,Be as P,q as Q,$t as R,pe as S,de as T,Ft as U,kt as V,H as W,Fo as X,ko as Y,wo as Z,se as _,I as $,ve as aa,_t as ba,Bt as ca,Mt as da,zo as ea,Ut as fa,Ge as ga,Qt as ha,Br as ia,ss as ja,as as ka,cs as la,us as ma,ps as na,B as oa,xi as pa,Xe as qa,Pi as ra,Ts as sa,ji as ta,Os as ua,Qe as va,Ls as wa,Ri as xa,Ei as ya,hn as za,As as Aa,Ds as Ba,Ze as Ca};
5
+ //# sourceMappingURL=chunk-WEXQYJY3.js.map
@@ -0,0 +1,2 @@
1
+ import{i as Q,m as X,v as P,x as I}from"./chunk-SIGVQT43.js";import{a as L,b as G,d as R}from"./chunk-DXYMTQZ4.js";import{a as d,f as w,g as B,h as p}from"./chunk-H5EXS3HM.js";import{E as U,T as H,U as W,a as V,ca as Y,g as F,h as S,ma as J,n as O,oa as K,p as q,ra as z}from"./chunk-XIPGCT3D.js";import{existsSync as Re}from"fs";import{randomUUID as ze}from"crypto";import{isAbsolute as Xe,join as Pe,relative as Ze,resolve as et}from"path";var f=1,m=2,ue="./node_modules/scip-query/docs/schemas/project-config.schema.json";function Z(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(c){return{kind:"malformed",reason:`invalid JSON: ${c instanceof Error?c.message:String(c)}`}}if(!d(t))return{kind:"malformed",reason:"project config must be a JSON object"};let n=t.schemaVersion;if(n!==void 0&&!Number.isInteger(n))return{kind:"malformed",reason:"schemaVersion must be an integer"};let r=n===void 0?f:n;if(r!==f&&r!==m)return{kind:"unsupported",schemaVersion:r,direction:r<f?"older":"future"};let s=t.$schema;if(s!==void 0&&(typeof s!="string"||s.trim()===""))return{kind:"malformed",reason:"$schema must be a non-empty string when present"};let i=ee(t),a=r!==m||typeof t.$schema!="string";return r===f?{kind:"legacy",sourceVersion:f,config:i,needsMigration:a}:{kind:"supported",sourceVersion:m,config:i,needsMigration:a}}function ee(e){let t=e,{$schema:n,schemaVersion:r,...s}=t;return{$schema:typeof n=="string"&&n.trim()!==""?n:ue,schemaVersion:m,...s}}import{createHash as pe}from"crypto";var k=1,te=2,ne=1,_=1,E="sha256";function Be(e,t,n){if(!p(e)||!w(t))throw new Error("Observation identity requires a bounded projection name and positive projection version.");return{schemaVersion:ne,canonicalizationVersion:_,hashAlgorithm:E,projection:{name:e,version:t},digest:pe(E).update(le(e,t,n)).digest("hex")}}function le(e,t,n){return`{"canonicalizationVersion":${_},"projection":${JSON.stringify(e)},"projectionVersion":${t},"value":${JSON.stringify(n)}}`}function fe(e){if(!d(e))return{kind:"malformed",reason:"observation receipt must be an object"};let t=e.schemaVersion;if(!Number.isInteger(t))return{kind:"malformed",reason:"observation receipt schemaVersion must be an integer"};if(t===k)return ge(e)?{kind:"legacy",schemaVersion:k,receipt:e}:{kind:"malformed",reason:"observation receipt v1 fields are malformed or contradictory"};if(t===te)return he(e)?{kind:"supported",schemaVersion:te,receipt:e}:{kind:"malformed",reason:"observation receipt v2 facts are malformed or contradictory"};let n=t;return{kind:"unsupported",schemaVersion:n,direction:n<k?"older":"future"}}function re(e){let t=fe(e);return t.kind==="legacy"||t.kind==="supported"}function me(e,t){return e.schemaVersion===t.schemaVersion&&e.canonicalizationVersion===t.canonicalizationVersion&&e.hashAlgorithm===t.hashAlgorithm&&e.projection.name===t.projection.name&&e.projection.version===t.projection.version}function ge(e){if(!d(e))return!1;let t=e.index,n=e.worktree;return oe(e.observedAt)&&p(e.projectIdentity)&&Oe(e.authorityKind)&&(t===void 0||d(t)&&p(t.generationIdentity)&&(t.source==="immutable"||t.source==="legacy")&&(t.alignment==="not-certified"||t.alignment==="leased"))&&(n===void 0||d(n)&&p(n.identity)&&typeof n.clean=="boolean"&&(n.headCommit===void 0||p(n.headCommit))&&(n.treeOid===void 0||p(n.treeOid)))&&Se(e.authorityKind,t,n)}function he(e){if(!d(e))return!1;let t=e.facts,n=e.observedSources,r=e.stabilityProofs;if(!oe(e.observedAt)||!d(t)||!Array.isArray(n)||n.length===0||!n.every(be)||!A(n,o=>o.kind)||!Array.isArray(r)||!r.every(ve)||!A(r,o=>o.source)||r.some(o=>!n.some(u=>u.kind===o.source))||!r.every(o=>xe(o,t))||["collaborationDomain","repositoryLineage","workspaceInstance","wholeContent"].some(o=>t[o]!==void 0&&!l(t[o])))return!1;let i=t.relevantInputs;if(i!==void 0&&(!Array.isArray(i)||!i.every(ye)||!A(i,o=>`${o.subject}\0${o.identity.projection.name}`)))return!1;let a=t.index;if(a!==void 0&&(!d(a)||!l(a.generation)||a.inputs!==void 0&&!l(a.inputs)||a.source!=="immutable"&&a.source!=="legacy"))return!1;let c=e.diagnostics;return(c===void 0||d(c)&&(c.clean===void 0||typeof c.clean=="boolean")&&(c.headCommit===void 0||p(c.headCommit))&&(c.treeOid===void 0||p(c.treeOid)))&&Ce(t,n)}function l(e){return!d(e)||!d(e.projection)?!1:e.schemaVersion===ne&&e.canonicalizationVersion===_&&e.hashAlgorithm===E&&p(e.projection.name)&&w(e.projection.version)&&B(e.digest)}function ye(e){return d(e)&&p(e.subject)&&l(e.identity)}function be(e){return d(e)&&ie(e.kind)&&(e.identity===void 0||l(e.identity))}function ve(e){return d(e)&&ie(e.source)&&(e.kind==="immutable"||e.kind==="fixed-snapshot"||e.kind==="bracketed"||e.kind==="not-established"||e.kind==="invalidated")}function Ce(e,t){let n=e.index,r=t.find(o=>o.kind==="index-generation");if(r){if(!d(n)||!l(n.generation)||r.identity&&!j(r.identity,n.generation))return!1}else if(n!==void 0)return!1;let s=e.workspaceInstance,i=t.find(o=>o.kind==="live-workspace");if(i?.identity&&(!l(s)||!j(i.identity,s)))return!1;let a=e.wholeContent,c=t.find(o=>o.kind==="repository-snapshot");return!(c?.identity&&(!l(a)||!j(c.identity,a)))}function xe(e,t){return e.kind==="not-established"||e.kind==="invalidated"?!0:e.source==="index-generation"?e.kind==="immutable"&&d(t.index)&&t.index.source==="immutable":e.source==="repository-snapshot"?e.kind==="fixed-snapshot":e.source==="live-workspace"?e.kind==="bracketed":!1}function j(e,t){return me(e,t)&&e.digest===t.digest}function Se(e,t,n){return e==="index-worktree"?t!==void 0&&n!==void 0:e==="index-only"?t!==void 0&&n===void 0:e==="worktree-only"?t===void 0&&n!==void 0:e==="process-local"&&t===void 0&&n===void 0}function Oe(e){return e==="index-worktree"||e==="index-only"||e==="worktree-only"||e==="process-local"}function ie(e){return e==="index-generation"||e==="repository-snapshot"||e==="live-workspace"||e==="process"}function oe(e){return typeof e=="string"&&!Number.isNaN(Date.parse(e))}function A(e,t){return new Set(e.map(t)).size===e.length}function He(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.kind==="automated-adjudication"&&t.policyVersion===1&&(t.decidedBy==="agent"||t.decidedBy==="human")&&G.includes(t.reasonCode)&&Array.isArray(t.evidence)&&t.evidence.length>0&&t.evidence.every(we)&&(t.observation===void 0||re(t.observation))&&!!t.invalidateOn&&typeof t.invalidateOn=="object"&&typeof t.invalidateOn.targetContentChange=="boolean"&&typeof t.invalidateOn.detectorMajorChange=="boolean"}function we(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return(t.kind==="source"||t.kind==="config"||t.kind==="test"||t.kind==="graph")&&typeof t.referent=="string"&&t.referent.trim()!==""&&typeof t.claim=="string"&&t.claim.trim()!==""&&(t.contentHash===void 0||/^[a-f0-9]{64}$/u.test(t.contentHash))&&(t.generation===void 0||typeof t.generation=="string"&&t.generation.length>0)}var h=".scipquery.json",Ie=2e3,se=5e3,ae=se,ke=15*6e4,ce={enabled:!0,windowMs:15*6e4,maxRebuilds:2,maxEstimatedWriteBytes:1024*1024*1024},je={enabled:!1,autoStart:!1,allowExpensiveRebuild:!1,debounceMs:Ie,cooldownMs:ae,gitPollMs:2e3,idleTimeoutMs:ke,autoRefresh:!0,ignore:[],resourceBudget:ce};var it=new Set(L);function ot(e){let t=Pe(e,h);if(!Re(t))return{};let n;try{n=F(t,{maxBytes:V,inputKind:"scip-query project config"})}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`unable to read ${h} at ${t}: ${s}`,{cause:r})}return Ae(Z(n),t,"read").config}function st(e){return{...je,...e.watch,cooldownMs:Math.max(se,e.watch?.cooldownMs??ae),resourceBudget:{...ce,...e.watch?.resourceBudget}}}function Ae(e,t,n){if(e.kind==="legacy"||e.kind==="supported")return e;if(e.kind==="malformed"){let s=n==="read"?`invalid ${h} at ${t}: ${e.reason}`:`Cannot update ${t}: the latest project config is ${e.reason}.`;throw new Error(`${s} The file was left untouched.`)}let r=n==="read"?`invalid ${h} at ${t}`:`Cannot update ${t}: the latest project config is invalid`;throw new Error(`${r} (unsupported ${e.direction} schemaVersion ${e.schemaVersion}; this scip-query reads legacy v${f} and current v${m}). Upgrade scip-query before retrying; the file was left untouched.`)}import{existsSync as y,lstatSync as Ee}from"fs";import{resolve as _e}from"path";function xt(e,t,n,r={}){let s=new Date().toISOString();if(!y(n.dbPath))return{state:"missing",checkedAt:s,metaPath:n.metaPath,reason:"No SQLite index database exists.",remedy:"Run: scip-query reindex"};if(!y(n.metaPath))return{state:"unknown",checkedAt:s,metaPath:n.metaPath,reason:"No reindex metadata file exists next to the SQLite index.",remedy:"Run: scip-query reindex"};try{let i=R(S(n.metaPath,"reindex metadata"));if(i.kind==="unsupported")return{state:"unknown",checkedAt:s,metaPath:n.metaPath,reason:`Reindex metadata version ${i.version} is unsupported by this scip-query build.`,remedy:"Upgrade scip-query or run: scip-query reindex"};if(i.kind==="malformed")return{state:"unknown",checkedAt:s,metaPath:n.metaPath,reason:`Could not decode reindex metadata: ${i.reason}`,remedy:"Run: scip-query reindex"};let a=i.metadata,c=t.languages??Q(e),o=a.fingerprint,u=n.cacheDir&&r.gitContext&&I(r.gitContext,n.cacheDir,o)?o:void 0,g=n.cacheDir&&r.gitContext&&u&&Ne(u,c,t)&&Te(e,u,t)?r.gitObservation?.context===r.gitContext?r.gitContext:H(r.gitContext):void 0,de=r.gitObservation&&r.gitObservation.context===r.gitContext?r.gitObservation.projectFileInventorySequence:void 0,M=g?.clean&&W(e,void 0,{cachedInventoryAfterSequence:de})?g:void 0,b=n.cacheDir&&M&&u&&I(M,n.cacheDir,u)?u:Me(e,c,t),N=[...a.indexedLanguages??[]].sort(),v=i.capabilities.publishableGeneration&&q(O(a.fingerprint),b)&&JSON.stringify(N)===JSON.stringify(b.languages),C=P(n.dbPath,n.metaPath),T=C.state==="invalid"||C.state==="drifted",x=v?X(n.dbPath,b,N):void 0,$=x?.state==="incomplete",D=v&&!T&&!$;return{state:D?"fresh":"stale",checkedAt:s,metaPath:n.metaPath,updatedAt:a.updatedAt,lastRefresh:a.lastRefresh,reason:T?`SQLite generation requires repair: ${C.reason}`:$?`SQLite generation is missing ${x.missingDocumentCount} indexed source document(s): ${x.missingPaths.join(", ")}`:v?"Index metadata fingerprint matches current source files.":"Index metadata fingerprint differs from current source files.",remedy:D?void 0:"Run: scip-query reindex"}}catch(i){return{state:"unknown",checkedAt:s,metaPath:n.metaPath,reason:`Could not read reindex metadata: ${i instanceof Error?i.message:String(i)}`,remedy:"Run: scip-query reindex"}}}function St(e){let t=new Date().toISOString();if(!y(e.dbPath))return{state:"missing",checkedAt:t,metaPath:e.metaPath,reason:"No SQLite index database exists.",remedy:"Run: scip-query reindex"};if(!y(e.metaPath))return{state:"unknown",checkedAt:t,metaPath:e.metaPath,reason:"No reindex metadata file exists next to the SQLite index.",remedy:"Run: scip-query reindex"};try{let n=R(S(e.metaPath,"reindex metadata"));if(n.kind==="unsupported")return{state:"unknown",checkedAt:t,metaPath:e.metaPath,reason:`Reindex metadata version ${n.version} is unsupported by this scip-query build.`,remedy:"Upgrade scip-query or run: scip-query reindex"};if(n.kind==="malformed")return{state:"unknown",checkedAt:t,metaPath:e.metaPath,reason:`Could not decode reindex metadata: ${n.reason}`,remedy:"Run: scip-query reindex"};let r=n.metadata,s=[...r.indexedLanguages??[]].sort(),i=O(r.fingerprint),a=[...i?.languages??[]].sort(),c=n.capabilities.publishableGeneration&&i!==null&&JSON.stringify(s)===JSON.stringify(a),o=P(e.dbPath,e.metaPath),u=o.state==="invalid"||o.state==="drifted",g=c&&!u;return{state:g?"fresh":"stale",checkedAt:t,metaPath:e.metaPath,updatedAt:r.updatedAt,lastRefresh:r.lastRefresh,reason:u?`SQLite generation requires repair: ${o.reason}`:c?"Watcher accepted the newly published index generation with no later changes pending.":"Published index metadata is not a complete queryable generation.",remedy:g?void 0:"Run: scip-query reindex"}}catch(n){return{state:"unknown",checkedAt:t,metaPath:e.metaPath,reason:`Could not read reindex metadata: ${n instanceof Error?n.message:String(n)}`,remedy:"Run: scip-query reindex"}}}function Me(e,t,n){return K(e,t,{pnpmWorkspaces:n.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:n.indexer?.typescript?.projectMode,typescriptProjects:n.indexer?.typescript?.projects,clojureConfigPath:n.indexer?.clojure?.configPath})}function Ne(e,t,n){let r=$e(t,n);return e.version===r.version&&JSON.stringify([...e.languages].sort())===JSON.stringify(r.languages)&&e.pnpmWorkspaces===r.pnpmWorkspaces&&e.typescriptProjectMode===r.typescriptProjectMode&&JSON.stringify([...e.typescriptProjects].sort())===JSON.stringify(r.typescriptProjects)&&e.clojureConfigPath===r.clojureConfigPath}function Te(e,t,n){if(!(t.languages.includes("typescript")||!!t.clojureConfigPath))return!0;let s=J(e);if(t.clojureConfigPath){let i=U(t.clojureConfigPath);if(!s.includes(i))return!1;try{if(!Ee(_e(e,i)).isFile())return!1}catch{return!1}}return!t.languages.includes("typescript")||Y(e,n.indexer?.typescript?.projectMode,n.indexer?.typescript?.projects??[],s)}function $e(e,t){return z(e,{pnpmWorkspaces:t.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:t.indexer?.typescript?.projectMode,typescriptProjects:t.indexer?.typescript?.projects,clojureConfigPath:t.indexer?.clojure?.configPath})}export{te as a,Be as b,He as c,ot as d,st as e,xt as f,St as g};
2
+ //# sourceMappingURL=chunk-WOPZX5GM.js.map
@@ -0,0 +1,9 @@
1
+ function u(i,o){let c=m(i,o,e=>{let n=e?`AND m.symbol_id IN (${e.map(()=>"?").join(",")})`:"";return i.all(`SELECT m.symbol_id, d.relative_path, c.document_id,
2
+ c.start_line AS chunk_start, c.end_line AS chunk_end
3
+ FROM mentions m
4
+ JOIN chunks c ON m.chunk_id = c.id
5
+ JOIN documents d ON c.document_id = d.id
6
+ WHERE m.role != 1
7
+ ${n}
8
+ ${i.pathExclusionsFor("d")}`,...e??[])}),r=new Map;for(let e of c){let n=`${e.symbol_id}\0${e.document_id}\0${e.chunk_start}\0${e.chunk_end}`;r.set(n,e)}let t=o?new Map(o.map((e,n)=>[e,n])):null;return[...r.values()].sort((e,n)=>(t?(t.get(e.symbol_id)??0)-(t.get(n.symbol_id)??0):0)||e.relative_path.localeCompare(n.relative_path)||e.chunk_start-n.chunk_start||e.chunk_end-n.chunk_end||e.symbol_id-n.symbol_id)}function m(i,o,c){if(!o)return c();if(o.length===0)return[];let r=[];for(let t=0;t<o.length;t+=750)r.push(...c(o.slice(t,t+750)));return r}export{u as a};
9
+ //# sourceMappingURL=chunk-WRQXLNYE.js.map
@@ -1,4 +1,4 @@
1
- import{u as l,v as d,x as u}from"./chunk-HZ72SESS.js";import{h as c}from"./chunk-WUPW3UN3.js";import h from"better-sqlite3";var m=["busy_timeout = 5000","query_only = ON","temp_store = MEMORY","cache_size = -64000","mmap_size = 268435456"],o=class{constructor(t,e){this.connection=t;this.releaseGenerationReader=e}connection;releaseGenerationReader;active=!0;initialize(t){try{for(let e of m)this.connection.pragma(e);t(this.connection)}catch(e){try{this.close()}catch(n){throw new AggregateError([e,n],"SQLite initialization and rollback both failed.",{cause:n})}throw e}}close(){if(!this.active)return;this.active=!1;let t,e;try{this.connection.close()}catch(n){t=n}try{this.releaseGenerationReader()}catch(n){e=n}if(t!==void 0&&e!==void 0)throw new AggregateError([t,e],"SQLite connection close and generation-reader release both failed.");if(t!==void 0)throw t;if(e!==void 0)throw e}},b=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs",".scipquery-cache","__pycache__",".venv","venv"],p=class{db;config;generation;pathFilter;connection;connectionOwnership;statementCache=new Map;constructor(t,e){this.config=t,this.pathFilter=e??null;let n=S(t),i=new o(n.db,n.release);try{i.initialize(y),this.generation=n.generation,this.connection=n.db,this.connectionOwnership=i,this.db=g(n.db)}catch(r){try{i.close()}catch(s){throw new AggregateError([r,s],"SQLite construction and rollback both failed.",{cause:s})}throw r}}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
1
+ import{n as l,s as d,v as u}from"./chunk-LGVTIZPV.js";import{f as c}from"./chunk-WEXQYJY3.js";import h from"better-sqlite3";var m=["busy_timeout = 5000","query_only = ON","temp_store = MEMORY","cache_size = -64000","mmap_size = 268435456"],o=class{constructor(t,e){this.connection=t;this.releaseGenerationReader=e}connection;releaseGenerationReader;active=!0;initialize(t){try{for(let e of m)this.connection.pragma(e);t(this.connection)}catch(e){try{this.close()}catch(n){throw new AggregateError([e,n],"SQLite initialization and rollback both failed.",{cause:n})}throw e}}close(){if(!this.active)return;this.active=!1;let t,e;try{this.connection.close()}catch(n){t=n}try{this.releaseGenerationReader()}catch(n){e=n}if(t!==void 0&&e!==void 0)throw new AggregateError([t,e],"SQLite connection close and generation-reader release both failed.");if(t!==void 0)throw t;if(e!==void 0)throw e}},b=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs",".scipquery-cache","__pycache__",".venv","venv"],p=class{db;config;generation;pathFilter;connection;connectionOwnership;statementCache=new Map;constructor(t,e){this.config=t,this.pathFilter=e??null;let n=S(t),i=new o(n.db,n.release);try{i.initialize(y),this.generation=n.generation,this.connection=n.db,this.connectionOwnership=i,this.db=g(n.db)}catch(r){try{i.close()}catch(s){throw new AggregateError([r,s],"SQLite construction and rollback both failed.",{cause:s})}throw r}}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
2
2
  EXISTS (
3
3
  SELECT 1
4
4
  FROM defn_enclosing_ranges local_der
@@ -17,4 +17,4 @@ import{u as l,v as d,x as u}from"./chunk-HZ72SESS.js";import{h as c}from"./chunk
17
17
  )
18
18
  )`}get pathExclusions(){return this.pathExclusionsFor("d")}get symbolNoise(){return this.symbolNoiseFor("gs")}pathExclusionsFor(...t){return t.flatMap(e=>b.flatMap(n=>[`AND ${e}.relative_path NOT LIKE '${n}/%'`,`AND ${e}.relative_path NOT LIKE '%/${n}/%'`])).join(`
19
19
  `)}symbolNoiseFor(t){return`AND ${t}.symbol NOT LIKE '%().(%' AND ${t}.symbol NOT LIKE '%typeLiteral%'`}all(t,...e){return this.statement(t).all(...e)}get(t,...e){return this.statement(t).get(...e)}close(){this.statementCache.clear(),this.connectionOwnership.close()}statement(t){let e=this.statementCache.get(t);return e||(e=this.connection.prepare(t),this.statementCache.set(t,e)),e}};function g(a){return Object.freeze({prepare(t){let e=a.prepare(t);if(!e.readonly||!e.reader)throw new Error("ScipDatabase.db only permits read-only statements that return rows.");return f(e)}})}function f(a){let t={get:(...e)=>a.get(...e),all:(...e)=>a.all(...e),iterate:(...e)=>a.iterate(...e),pluck(e){return e===void 0?a.pluck():a.pluck(e),t},expand(e){return e===void 0?a.expand():a.expand(e),t},raw(e){return e===void 0?a.raw():a.raw(e),t},bind(...e){return a.bind(...e),t},columns:()=>a.columns(),safeIntegers(e){return e===void 0?a.safeIntegers():a.safeIntegers(e),t}};return Object.freeze(t)}function y(a){if(!a.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'documents'").get())return;let e=a.prepare("SELECT relative_path FROM documents").iterate();for(let n of e)c(n.relative_path)}function S(a){for(let t=0;t<4;t+=1){let e=l(a),n=e.generation,i;try{i=new h(n.databasePath,{readonly:!0,fileMustExist:!0})}catch(r){throw e.release(),r}if(n.source==="immutable")return{db:i,generation:n,release:e.release};try{let r=d(a);if(n.databaseFileIdentity===u(n.databasePath)&&r.source==="legacy"&&r.identity===n.identity&&r.databaseFileIdentity===n.databaseFileIdentity&&r.metadataRaw===n.metadataRaw)return{db:i,generation:n,release:e.release}}catch(r){throw i.close(),e.release(),r}i.close(),e.release()}throw new Error("SQLite index publication changed repeatedly while opening a coherent generation.")}export{p as a};
20
- //# sourceMappingURL=chunk-XKWKXZKW.js.map
20
+ //# sourceMappingURL=chunk-WV6R37XV.js.map
@@ -1,2 +1,2 @@
1
- import{K as c,L as l}from"./chunk-WCCFZ7V7.js";function h(e,a,i,r,n,o){let t=new Set;d(e,a,i,r)&&t.add(n);for(let s of o)s.value&&p(t,s.label,s.value);return[...t].slice(0,6)}function p(e,a,i){let r=u(i);a.endsWith("name")&&y(r)&&e.add(`${a} has type-guard boundary shape`);for(let n of r){let o=f.get(n);o&&e.add(`${a} has ${o} term: ${n}`)}}function d(e,a,i,r){if(i<=0)return!1;let n=c(e,a);if(n.length===0)return!1;for(let o=i-1;o>=0&&o>=i-5;o-=1){let t=(n[o]??"").trim();if(t!==""){if(l(t)===r)return!0;if(!t.startsWith("//")&&!t.startsWith("*")&&!t.startsWith("/*")&&!t.startsWith("@")&&!t.startsWith("#"))return!1}}return!1}function u(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function y(e){return e.some(a=>g.has(a))&&e.some(a=>m.has(a))}var f=new Map([["access","access policy"],["accessible","access policy"],["adapter","adapter"],["adapters","adapter"],["allow","access policy"],["allowed","access policy"],["animation","animation calculation"],["api","api surface"],["apply","settings/application"],["audit","side-effect boundary"],["auth","authorization"],["authorize","authorization"],["audio","audio side-effect"],["can","access policy"],["capabilities","capability boundary"],["capability","capability boundary"],["boundary","boundary"],["begin","lifecycle"],["bridge","bridge"],["bridges","bridge"],["cache","state cache"],["chase","gameplay action"],["command","command boundary"],["context","context policy"],["cooldown","temporal state"],["cooldowns","temporal state"],["controller","controller"],["controllers","controller"],["diagnostic","diagnostics"],["diagnostics","diagnostics"],["effect","side-effect boundary"],["effects","side-effect boundary"],["energy","gameplay calculation"],["expired","temporal state"],["facade","facade"],["facades","facade"],["fire","gameplay action"],["gateway","gateway"],["gateways","gateway"],["guard","guard"],["guards","guard"],["haptic","haptic side-effect"],["haptics","haptic side-effect"],["head","sequence boundary"],["history","state history"],["input","input boundary"],["jump","gameplay action"],["keyboard","input boundary"],["log","side-effect boundary"],["logger","side-effect boundary"],["lock","coordination boundary"],["middleware","middleware"],["multiplier","gameplay calculation"],["mute","audio side-effect"],["normalize","normalization"],["normalise","normalization"],["normalizer","normalization"],["oscillate","animation calculation"],["oscillation","animation calculation"],["overlap","collision predicate"],["performance","diagnostics"],["permission","access policy"],["permissions","access policy"],["policy","policy"],["pool","state pool"],["pooled","state pool"],["pools","state pool"],["predict","prediction"],["presenter","presenter"],["presenters","presenter"],["projectile","gameplay entity"],["provider","provider boundary"],["providers","provider boundary"],["public","public surface"],["quality","settings/application"],["rate","calculation"],["register","registry"],["registry","registry"],["relay","relay"],["relays","relay"],["reseed","state lifecycle"],["reset","state lifecycle"],["respond","response boundary"],["response","response boundary"],["resolve","resolution"],["resolver","resolution"],["route","route boundary"],["routes","route boundary"],["run","lifecycle"],["sample","diagnostics"],["score","gameplay calculation"],["scope","scope policy"],["scroll","position state"],["scrolled","position state"],["seed","state lifecycle"],["seeded","state lifecycle"],["segment","segment boundary"],["segments","segment boundary"],["setting","settings/application"],["settings","settings/application"],["spawn","gameplay lifecycle"],["spawning","gameplay lifecycle"],["speed","gameplay calculation"],["surface","public surface"],["tail","sequence boundary"],["tick","temporal state"],["transaction","transaction"],["transactional","transaction"],["transform","transformation"],["transformer","transformation"],["translate","translation"],["translator","translation"],["try","fallible action"],["validate","validation"],["validation","validation"],["validator","validation"],["visual","diagnostics"],["window","settings/application"],["socket","transport boundary"],["websocket","transport boundary"]]),g=new Set(["can","has","is","should"]),m=new Set(["access","api","auth","collision","expired","input","keyboard","overlap","permission","permissions","policy","projectile","response","route","routes","scope"]);export{h as a};
2
- //# sourceMappingURL=chunk-N5W4YZMK.js.map
1
+ import{C as c,D as l}from"./chunk-JSHDCVUM.js";function h(e,a,i,r,n,o){let t=new Set;d(e,a,i,r)&&t.add(n);for(let s of o)s.value&&p(t,s.label,s.value);return[...t].slice(0,6)}function p(e,a,i){let r=u(i);a.endsWith("name")&&y(r)&&e.add(`${a} has type-guard boundary shape`);for(let n of r){let o=f.get(n);o&&e.add(`${a} has ${o} term: ${n}`)}}function d(e,a,i,r){if(i<=0)return!1;let n=c(e,a);if(n.length===0)return!1;for(let o=i-1;o>=0&&o>=i-5;o-=1){let t=(n[o]??"").trim();if(t!==""){if(l(t)===r)return!0;if(!t.startsWith("//")&&!t.startsWith("*")&&!t.startsWith("/*")&&!t.startsWith("@")&&!t.startsWith("#"))return!1}}return!1}function u(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function y(e){return e.some(a=>g.has(a))&&e.some(a=>m.has(a))}var f=new Map([["access","access policy"],["accessible","access policy"],["adapter","adapter"],["adapters","adapter"],["allow","access policy"],["allowed","access policy"],["animation","animation calculation"],["api","api surface"],["apply","settings/application"],["audit","side-effect boundary"],["auth","authorization"],["authorize","authorization"],["audio","audio side-effect"],["can","access policy"],["capabilities","capability boundary"],["capability","capability boundary"],["boundary","boundary"],["begin","lifecycle"],["bridge","bridge"],["bridges","bridge"],["cache","state cache"],["chase","gameplay action"],["command","command boundary"],["context","context policy"],["cooldown","temporal state"],["cooldowns","temporal state"],["controller","controller"],["controllers","controller"],["diagnostic","diagnostics"],["diagnostics","diagnostics"],["effect","side-effect boundary"],["effects","side-effect boundary"],["energy","gameplay calculation"],["expired","temporal state"],["facade","facade"],["facades","facade"],["fire","gameplay action"],["gateway","gateway"],["gateways","gateway"],["guard","guard"],["guards","guard"],["haptic","haptic side-effect"],["haptics","haptic side-effect"],["head","sequence boundary"],["history","state history"],["input","input boundary"],["jump","gameplay action"],["keyboard","input boundary"],["log","side-effect boundary"],["logger","side-effect boundary"],["lock","coordination boundary"],["middleware","middleware"],["multiplier","gameplay calculation"],["mute","audio side-effect"],["normalize","normalization"],["normalise","normalization"],["normalizer","normalization"],["oscillate","animation calculation"],["oscillation","animation calculation"],["overlap","collision predicate"],["performance","diagnostics"],["permission","access policy"],["permissions","access policy"],["policy","policy"],["pool","state pool"],["pooled","state pool"],["pools","state pool"],["predict","prediction"],["presenter","presenter"],["presenters","presenter"],["projectile","gameplay entity"],["provider","provider boundary"],["providers","provider boundary"],["public","public surface"],["quality","settings/application"],["rate","calculation"],["register","registry"],["registry","registry"],["relay","relay"],["relays","relay"],["reseed","state lifecycle"],["reset","state lifecycle"],["respond","response boundary"],["response","response boundary"],["resolve","resolution"],["resolver","resolution"],["route","route boundary"],["routes","route boundary"],["run","lifecycle"],["sample","diagnostics"],["score","gameplay calculation"],["scope","scope policy"],["scroll","position state"],["scrolled","position state"],["seed","state lifecycle"],["seeded","state lifecycle"],["segment","segment boundary"],["segments","segment boundary"],["setting","settings/application"],["settings","settings/application"],["spawn","gameplay lifecycle"],["spawning","gameplay lifecycle"],["speed","gameplay calculation"],["surface","public surface"],["tail","sequence boundary"],["tick","temporal state"],["transaction","transaction"],["transactional","transaction"],["transform","transformation"],["transformer","transformation"],["translate","translation"],["translator","translation"],["try","fallible action"],["validate","validation"],["validation","validation"],["validator","validation"],["visual","diagnostics"],["window","settings/application"],["socket","transport boundary"],["websocket","transport boundary"]]),g=new Set(["can","has","is","should"]),m=new Set(["access","api","auth","collision","expired","input","keyboard","overlap","permission","permissions","policy","projectile","response","route","routes","scope"]);export{h as a};
2
+ //# sourceMappingURL=chunk-WZ7V4BQV.js.map
@@ -0,0 +1,2 @@
1
+ import{a as P,b as y}from"./chunk-JGMD6JGB.js";import{a as C,c as b,e as r,f}from"./chunk-B3X6KU75.js";import{a as g,b as h,c as k}from"./chunk-KMVGRIO2.js";import{O as v}from"./chunk-C7WSQA6A.js";function L(e,i={}){let{minSimilarity:o=.62,minTokens:n=8,limit:c=20,scope:l,scanLimit:u,filePattern:m,focusFiles:d}=i,s=B(e,{scope:l,minTokens:n,scanLimit:u}),p=P(s,t=>t.tokens);return y({profiles:s,limit:c,filePattern:m,focusFiles:d,candidateIndex:p,profile:{name:"vue-component-duplicates"},compare:(t,a)=>V(t,a,o),sort:(t,a)=>a.similarity-t.similarity||t.fileA.localeCompare(a.fileA)||t.fileB.localeCompare(a.fileB)})}function B(e,i){return v(e).vueProfiles({scope:i.scope,minTemplateTokens:i.minTokens,scanLimit:i.scanLimit}).map(o=>({file:o.file,tokens:o.templateTokens,loc:T(o)}))}function T(e){return e.totalLines}function V(e,i,o){let n=g(e.tokens,i.tokens);if(n.size<6||!R(n))return null;let c=k(e.tokens,i.tokens);if(c<o)return null;let l=r(n,"component:"),u=r(n,"prop:"),m=r(n,"event:"),d=r(n,"directive:"),s=r(n,"slot:"),p=r(n,"id:"),t=S({sharedComponents:l,sharedProps:u,sharedEvents:m,sharedDirectives:d,sharedSlots:s,sharedIdentifiers:p});return{fileA:e.file,fileB:i.file,similarity:c,tokenCountA:e.tokens.size,tokenCountB:i.tokens.size,sharedTokens:f(n),sharedComponents:l,sharedProps:u,sharedEvents:m,sharedDirectives:d,sharedSlots:s,sharedIdentifiers:p,evidenceClass:t.evidenceClass,actionTier:t.actionTier,evidenceClassReasons:t.reasons,recommendation:t.recommendation,uniqueToA:f(h(e.tokens,i.tokens)).slice(0,25),uniqueToB:f(h(i.tokens,e.tokens)).slice(0,25),locA:e.loc,locB:i.loc}}function R(e){let i=0,o=0;for(let n of e)n.startsWith("component:")&&(i+=1),(n.startsWith("prop:")||n.startsWith("event:")||n.startsWith("directive:")||n.startsWith("slot:"))&&(o+=1);return b([{name:"component",count:i},{name:"behavior",count:o}],[{min:{component:1},reason:"shared custom component"},{min:{behavior:3},reason:"shared Vue template structure"}]).pass}function S(e){return C({genericWords:x,primitiveGroups:[{values:e.sharedProps,reasonPrefix:"shared props",bucket:"generic"},{values:e.sharedEvents,reasonPrefix:"shared events",bucket:"generic"},{values:e.sharedDirectives,reasonPrefix:"shared directives",bucket:"generic"},{values:e.sharedSlots,reasonPrefix:"shared slots",bucket:"generic"}],nameGroups:[{names:e.sharedComponents,label:"shared component",fallbackBucket:"generic"},{names:e.sharedIdentifiers,label:"shared identifier",fallbackBucket:"generic"}],recommendation:w})}function w(e){switch(e){case"domain-behavior":case"mixed":return"Review for a shared component or feature-specific Vue primitive around the named domain structure.";case"shared-abstraction":return"Review the existing shared component usage first; extract only if duplicated structure remains outside it.";case"generic-workflow-scaffolding":return"Generic structural overlap \u2014 verify intent before consolidating."}}var x=new Set(["actions","app","button","card","content","container","dialog","field","form","header","input","item","label","layout","list","modal","page","panel","row","section","shell","table","text","toolbar","ui","value","view","wrapper"]);export{L as a};
2
+ //# sourceMappingURL=chunk-WZRNEVYC.js.map
@@ -0,0 +1,7 @@
1
+ import{d as j}from"./chunk-ARGPDW2Y.js";import{a as k}from"./chunk-2LJLEM5B.js";import{a as _}from"./chunk-Z2QB75BS.js";import{b as C}from"./chunk-CXT3GZSQ.js";import{a as T}from"./chunk-U2MNECDU.js";import{d as S}from"./chunk-UM56ZET4.js";import{a as O,b as w,e as $}from"./chunk-7MUHSZGN.js";import{d as L,e as I,t as g}from"./chunk-7Z4GMCHM.js";import{l as B,w as M}from"./chunk-6LS3IG2I.js";import{C as P}from"./chunk-JSHDCVUM.js";import{a as F}from"./chunk-WEXQYJY3.js";import{basename as le,extname as U}from"path";var ee=12,ne=280;function y(n,e,t,o){let i=te(n,e,t,o);if(i.size===0)return se();let r=[],s=new Set,l=(a,d,c,f)=>{if(d===e&&c<=o&&f>=t)return;let b=`${d}:${c}:${f}:${a}`;s.has(b)||(s.add(b),r.push({name:a,relativePath:d,startLine:c,endLine:f}))};for(let a of g(n,e))i.has(a.leaf)&&l(a.leaf,a.relativePath,a.startLine,a.endLine);for(let a of M(n,e)){let d=a.localName;if(!d||!i.has(d)||!a.sourcePath||a.kind==="namespace")continue;let c=a.importedName==="default"?d:a.importedName;for(let f of T(n,a.sourcePath,c,{maxReexportDepth:3}))l(d,f.relativePath,f.startLine,f.endLine)}r.sort(W);let u=r.map(a=>{let d=ie(n,a);return d?{...a,source:d}:null}).filter(a=>a!==null).slice(0,ee);return D(u)}function A(n,e=[]){return D(re(n.flatMap(t=>t?.inline??[]),e))}function Ne(n){return n?n.inline.reduce((e,t)=>e+t.name.length+t.source.length+32,0):0}function te(n,e,t,o){let i=B(n,e),r=new Set;if(!i)return r;for(let s=t;s<=o;s+=1)for(let l of i.identifiersByLine[s]??[])r.add(l);return r}function ie(n,e){if(e.startLine!==e.endLine)return null;let t=(P(n,e.relativePath)[e.startLine]??"").trim();if(!t||t.length>ne)return null;let o=t.indexOf("=");if(o<0||t[o+1]===">")return null;let i=t.slice(o+1).replace(/(?:\/\/|#).*$/u,"").trim();if(!i||i.includes("${")||/\b(?:function|class|struct|interface|trait|enum|lambda)\b/u.test(i))return null;let s=i.replace(/(['"`])(?:\\.|(?!\1).)*\1/gu,"").replace(/\b(?:0[xX][\dA-Fa-f_]+|0[bB][01_]+|0[oO][0-7_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[eE][+-]?\d+)?)n?\b/gu,""),l=new Set(["true","false","null","undefined","None","True","False"]);return(s.match(/[A-Za-z_][A-Za-z0-9_]*/gu)??[]).some(a=>!l.has(a))?null:t}function re(n,e){let t=new Map;for(let o of n){if(oe(o,e))continue;let i=`${o.relativePath}:${o.startLine}:${o.endLine}:${o.name}`;t.has(i)||t.set(i,{...o})}return[...t.values()].sort(W)}function oe(n,e){return e.some(t=>t.relativePath===n.relativePath&&t.startLine<=n.startLine&&t.endLine>=n.endLine)}function W(n,e){return n.relativePath.localeCompare(e.relativePath)||n.startLine-e.startLine||n.name.localeCompare(e.name)}function D(n){return{coverage:"indexed-project-literal-values",inline:n}}function se(){return D([])}function Ae(n,e,t={}){let{context:o=0}=t,i=Y(e);if(i)return q(n,i.filePath,i.startLine,i.endLine,o);let r=Q(n,e);if(r)return K(n,r);let s=O(n,e);return s?p(n,s,o):null}function We(n,e,t={}){if(e.length===0)throw new RangeError("code requires at least one selector.");if(e.length>24)throw new RangeError(`code accepts at most ${24} selectors per complete packet; received ${e.length}.`);let o=t.context??0,i=t.members??"exported",r=e.map(u=>ue(n,u,o,i)),s=r.flatMap(u=>u.results),l=s.map(u=>({relativePath:u.relativePath,startLine:u.startLine,endLine:u.endLine}));return{requested:e.length,matched:r.filter(u=>u.status==="matched").length,ambiguous:r.filter(u=>u.status==="ambiguous").length,missing:r.filter(u=>u.status==="missing").length,entries:r,bindingClosure:A(s.map(u=>u.bindingClosure),l)}}function ue(n,e,t,o){let i=Y(e);if(i){let d=q(n,i.filePath,i.startLine,i.endLine,t);return d?de(n,e,d,t):x(n,e,"definition-source-unreadable")}let r=Q(n,e);if(r)return fe(n,e,r,t,o);let s=w(n,e);if(!s.match)return x(n,e,"definition-not-found");let l=Le(n,s),u=l.map(V);if(s.total>1){let d=s.total<=4&&l.length===s.total;return{selector:e,status:"ambiguous",kind:"source",totalCandidates:s.total,results:d?l.flatMap(c=>{let f=p(n,c,t);return f?[f]:[]}):[],definitions:[],candidates:u,omittedCandidates:Math.max(0,s.total-u.length),suggestions:[]}}let a=p(n,s.match,t);return a?ve(e,a):x(n,e,"definition-source-unreadable")}function de(n,e,t,o){let i=g(n,t.relativePath).filter(a=>!X(a,t.relativePath)),r=ce(n,t,i),s=G(r.map(a=>p(n,a,o)).filter(a=>a!==null)).filter(a=>!J(t,a)),l=new Set(s.map(a=>a.symbol)),u=r.filter(a=>!l.has(a.symbol)&&!(t.startLine<=a.startLine&&t.endLine>=a.endLine)).map(V);return{selector:e,status:"matched",kind:"source",totalCandidates:1,results:[t,...s],definitions:[],candidates:[],omittedCandidates:0,suggestions:[],rangeCoverage:{basis:"requested-range-and-same-file-call-closure",referencedDefinitions:r.length,returnedDefinitions:r.length-u.length,returnedBodies:s.length,omittedDefinitions:u.length,omittedLedger:u}}}function ce(n,e,t){if(!h(e.freshness))return[];if(t.length===0)return[];let o=S(n,t,{additive:!1,semantic:!1}),i=new Map;for(let s of t){let l=i.get(s.symbol)??[];l.push(s),i.set(s.symbol,l)}let r=new Map;for(let s of t)if(!(s.endLine<e.startLine||s.startLine>e.endLine)){for(let l of o.get(s.symbolId)??[])if(l.file===e.relativePath&&!(l.source==="ast-callsite"&&(l.chunkId<e.startLine||l.chunkId>e.endLine)))for(let u of i.get(l.symbol)??[])r.set(u.symbolId,u)}return H(n,[...r.values()],t)}function fe(n,e,t,o,i){let r=t.relativePath,s=ge(n,r),l=h(t.freshness)?g(n,r).filter(m=>!X(m,r)):[],u=l.filter(m=>_(n,m)),a=u.length>0?u:me(s,l),d=i==="all"?[]:H(n,a,l),c=i==="all"||l.length===0?[K(n,t)]:G(d.map(m=>p(n,m,o)).filter(m=>m!==null)),f=he(s,c),b=be(r,s,c),N=Ce(s);return{selector:e,status:"matched",kind:"file-source",totalCandidates:1,results:c,definitions:[],candidates:[],omittedCandidates:0,suggestions:[],fileCoverage:{members:i,basis:i==="all"||l.length===0?"complete-file-source":u.length>0?"explicit-exports-and-same-file-reference-closure":"top-level-and-same-file-reference-closure",totalDefinitions:N,returnedDefinitions:f,returnedBodies:c.length,omittedDefinitions:Math.max(0,N-f),omittedLedger:b}}}function me(n,e){let t=new Set(n.map(o=>o.symbol));return e.filter(o=>t.has(o.symbol))}function ge(n,e){return k(n,e).flatMap(t=>pe(t,e)?t.children:[t])}function X(n,e){return z(e).has(n.leaf)}function pe(n,e){return z(e).has(I(n.symbol))}function z(n){let e=le(n);return new Set([e,e.slice(0,Math.max(0,e.length-U(e).length))])}function H(n,e,t){if(e.length===0)return[];let o=S(n,t,{additive:!0,semantic:!1}),i=new Map;for(let l of t){let u=i.get(l.symbol)??[];u.push(l),i.set(l.symbol,u)}let r=new Map,s=[...e];for(;s.length>0;){let l=s.shift();if(!r.has(l.symbolId)){r.set(l.symbolId,l);for(let u of o.get(l.symbolId)??[])for(let a of i.get(u.symbol)??[])r.has(a.symbolId)||s.push(a)}}return[...r.values()].sort(ye)}function G(n){let e=[...n].sort((o,i)=>o.relativePath.localeCompare(i.relativePath)||o.startLine-i.startLine||i.endLine-o.endLine),t=[];for(let o of e)t.some(i=>J(i,o))||t.push(o);return t}function K(n,e){let t=e.text.split(`
2
+ `);return{symbol:e.relativePath,shortName:e.relativePath,relativePath:e.relativePath,startLine:0,endLine:Math.max(0,t.length-1),language:n.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath)?.language??E(e.relativePath),source:e.text,freshness:e.freshness,...h(e.freshness)?{bindingClosure:y(n,e.relativePath,0,Math.max(0,t.length-1))}:{}}}function he(n,e){return v(n).filter(t=>e.some(o=>R(t,o))).length}function be(n,e,t){let o=[];return Z(o,n,e,t,0),o}function Z(n,e,t,o,i){for(let r of t){if(o.some(l=>R(r,l)))continue;let s=v(r.children).filter(l=>!o.some(u=>R(l,u))).length;n.push({symbol:r.symbol,shortName:r.shortName,relativePath:e,startLine:r.startLine,endLine:r.endLine,signature:r.signature,depth:i,nestedDefinitions:s}),Z(n,e,r.children,o,i+1)}}function v(n){return n.flatMap(e=>[e,...v(e.children)])}function Ce(n){return v(n).length}function R(n,e){return e.startLine<=n.startLine&&e.endLine>=n.endLine}function J(n,e){return n.relativePath===e.relativePath&&n.startLine<=e.startLine&&n.endLine>=e.endLine}function ye(n,e){return n.startLine-e.startLine||e.endLine-n.endLine||n.symbol.localeCompare(e.symbol)}function ve(n,e){return{selector:n,status:"matched",kind:"source",totalCandidates:1,results:[e],definitions:[],candidates:[],omittedCandidates:0,suggestions:[]}}function x(n,e,t){return{selector:e,status:"missing",kind:"source",totalCandidates:0,results:[],definitions:[],candidates:[],omittedCandidates:0,suggestions:$(n,e,5),reason:t}}function Q(n,e){try{return C(n,e)}catch(t){if(t instanceof F)return null;throw t}}function Le(n,e){if(!e.match)return[];let t=[e.match];for(let i of e.candidates){let r=g(n,i.relativePath).find(s=>s.symbol===i.symbol&&s.startLine===i.startLine);r&&t.push(r)}let o=new Set;return t.filter(i=>{let r=`${i.relativePath}:${i.startLine}:${i.endLine}:${i.symbol}`;return o.has(r)?!1:(o.add(r),!0)})}function V(n){return{symbol:n.symbol,shortName:L(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine}}function Y(n){let e=n.match(/^(.+):(\d+)-(\d+)$/);if(!e)return null;let t=Number(e[2]),o=Number(e[3]);if(!Number.isSafeInteger(t)||t<1)throw new RangeError(`Source range start line must be a positive integer, got "${e[2]}".`);if(!Number.isSafeInteger(o)||o<t)throw new RangeError(`Source range end line must be an integer at or after ${t}, got "${e[3]}".`);return{filePath:e[1],startLine:t,endLine:o}}function p(n,e,t){let o=n.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),i=C(n,e.relativePath);if(!i)return null;let s=i.text.split(`
3
+ `),l=e.endLine<=e.startLine?j(n,e.relativePath,e.startLine,Number.MAX_SAFE_INTEGER):null,u=l?.unitType?l.unitStartLine:e.startLine,a=l?.unitType?l.unitEndLine:e.endLine,d=Math.max(0,u-t),c=Math.min(s.length-1,a+t),f=s.slice(d,c+1).join(`
4
+ `);return{symbol:e.symbol,shortName:L(e.symbol),relativePath:e.relativePath,startLine:d,endLine:c,language:o?.language??E(e.relativePath),source:f,freshness:i.freshness,...h(i.freshness)?{bindingClosure:y(n,e.relativePath,d,c)}:{}}}function q(n,e,t,o,i){let r=C(n,e);if(!r)return null;let s=n.get("SELECT language FROM documents WHERE relative_path = ?",r.relativePath),u=r.text.split(`
5
+ `);if(t>u.length)return null;let a=Math.max(0,t-1-i),d=Math.min(u.length-1,o-1+i),c=u.slice(a,d+1).join(`
6
+ `);return{symbol:`${r.relativePath}:${t}-${o}`,shortName:`${r.relativePath}:${t}-${o}`,relativePath:r.relativePath,startLine:a,endLine:d,language:s?.language??E(r.relativePath),source:c,freshness:r.freshness,...h(r.freshness)?{bindingClosure:y(n,r.relativePath,a,d)}:{}}}function h(n){return!!(n&&n.semantic.state!=="stale"&&n.semantic.basis!=="no-compiler-document")}function E(n){switch(U(n).toLowerCase()){case".ts":case".tsx":case".mts":case".cts":return"typescript";case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".py":case".pyi":return"python";case".rs":return"rust";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":return"scala";case".rb":return"ruby";case".php":return"php";case".cs":return"csharp";case".vb":return"vb";case".dart":return"dart";case".c":case".h":return"c";case".cc":case".cpp":case".cxx":case".hpp":case".hh":case".hxx":return"cpp";case".vue":return"vue";default:return null}}export{y as a,A as b,Ne as c,Ae as d,We as e};
7
+ //# sourceMappingURL=chunk-X5MWO4DM.js.map
@@ -0,0 +1,2 @@
1
+ var a=[{id:"general-interprocedural-value-flow",families:["dataflow"],capability:"Whole-program definition-use flow through arbitrary calls and returns is unavailable.",consequence:"Missing dataflow edges cannot establish that a value never crosses an unmodeled call.",recoverWith:["value-flow","dependence-slice","inspect","code"]},{id:"heap-aliasing",families:["dataflow","state"],capability:"Heap points-to and cross-instance alias analysis are unavailable.",consequence:"Missing field or state edges cannot establish that two references never reach the same object.",recoverWith:["value-flow","dependence-slice","inspect","code"]},{id:"exceptional-flow",families:["execution","dataflow","temporal"],capability:"Interprocedural exception propagation and finally completion flow are unavailable.",consequence:"Normal-path reachability and ordering do not establish behavior after a throw or rejection.",recoverWith:["dependence-slice","inspect","code"]},{id:"reflection",families:["execution","runtime","identity","dependencies"],capability:"Reflective lookup, dynamic loading, and name-computed invocation are unavailable without exact evidence.",consequence:"Missing static edges cannot establish that a construct is unreachable through reflection.",recoverWith:["search","inspect","code"]},{id:"generated-dispatch",families:["execution","runtime","identity"],capability:"Dispatch tables or names created only by generated or unavailable source are unavailable.",consequence:"Missing dispatch edges cannot establish that no generated consumer exists.",recoverWith:["search","inspect","code"]},{id:"unsupported-framework-adapters",families:["runtime","dataflow","state","temporal"],capability:"Framework runtime crossings without a registered source adapter are unavailable.",consequence:"Missing boundary edges cannot establish that no producer, consumer, state effect, or ordering exists.",recoverWith:["search","inspect","code"]}];function s(t){let i=new Set(t);return a.filter(n=>n.families.some(r=>i.has(r)))}function u(t){return s(t).map(i=>`[${i.id}] ${i.capability} ${i.consequence} Recover selected paths with: ${i.recoverWith.map(n=>`scip-query ${n}`).join(", ")}.`)}var c=["incoming","outgoing","both"];function e(t,i,n,r={}){return{family:t,subtype:i,...r.match?{match:r.match}:{},directions:c,evidenceStrengths:r.strengths??["exact","derived","mixed"],supportCeiling:r.supportCeiling??"partial",establishes:n,nonClaims:r.nonClaims??[],recoverWith:r.recoverWith??["inspect","code"]}}var l=["predicate-consequence","predicate-alternative","predicate-fallthrough","predicate-case","predicate-default","predicate-return","predicate-throw","loop-iteration","loop-exit","exception-handler","finally-cleanup","handler-return","handler-throw"],d=["captured-value-to-state","constant-to-state","expression-to-state","property-to-state","return-to-state","value-to-state"],p=["await-completion-before","awaits-completion","inside-lock-scope","lexical-successor"],h=[{id:"indexed-program-identity",label:"SCIP/compiler identity and source ownership",requirements:["indexed-graph"],relations:[e("execution","call","The source construct may call the resolved target.",{strengths:["exact","derived","candidate","mixed"],nonClaims:["Static may-call reachability does not prove that an invocation occurred at runtime."],recoverWith:["call-graph","inspect","code"]}),e("execution","result-callback","The referenced callable can produce the result consumed by this path.",{nonClaims:["A callback relationship does not prove invocation order or runtime selection."],recoverWith:["call-graph","inspect","code"]}),e("contract","uses-contract-symbol","The source construct refers to the identified contract symbol.",{supportCeiling:"exact",nonClaims:["Contract identity does not prove runtime invocation or behavioral conformance."],recoverWith:["hierarchy","inspect","code"]}),e("identity","references","The occurrence resolves to the identified compiler-owned symbol.",{supportCeiling:"exact",nonClaims:["A reference does not establish execution or value transfer."],recoverWith:["refs","trace","inspect"]}),e("ownership","contains","The owner contains the identified program construct.",{supportCeiling:"exact",nonClaims:["Structural containment does not establish runtime lifetime or sharing scope."],recoverWith:["outline","inspect"]}),e("ownership","contains-","The owner contains the identified program construct.",{match:"prefix",supportCeiling:"exact",nonClaims:["Structural containment does not establish runtime lifetime or sharing scope."],recoverWith:["outline","inspect"]}),e("ownership","owns-","The owner owns the identified source or runtime observation.",{match:"prefix",supportCeiling:"exact",nonClaims:["Observation ownership does not establish singleton lifetime or exclusive ownership."],recoverWith:["inspect","code"]}),e("dependencies","imports","The source file or module statically imports the indexed target.",{nonClaims:["An import does not establish that imported code executes."],recoverWith:["imports","deps","code"]}),e("dependencies","imports-external","The source region statically imports an external package.",{nonClaims:["An external import does not establish which package behavior executes."],recoverWith:["imports","code"]})]},{id:"runtime-boundary-join",label:"source-grounded runtime-boundary joins",requirements:["indexed-graph","source-facts"],relations:[e("runtime","runtime-handoff","A producer and consumer share a source-grounded runtime rendezvous.",{strengths:["exact","derived","candidate","mixed"],nonClaims:["A candidate or unresolved join does not prove a runtime handoff."],recoverWith:["evidence","inspect","code"]}),e("runtime","discriminator-dispatch","A serialized discriminator selects the reported consumer.",{strengths:["exact","derived","mixed"],nonClaims:["The dispatch edge does not prove delivery, retry, or successful handling."],recoverWith:["evidence","inspect","code"]}),e("dataflow","serialized-discriminator-transfer","The producer serializes the discriminator consumed by dispatch.",{strengths:["exact","derived","mixed"],nonClaims:["This edge does not establish the flow of every payload field."],recoverWith:["value-flow","inspect","code"]}),e("temporal","enqueue-before-consume","The reported enqueue precedes a possible consume through the queue.",{strengths:["exact","derived","mixed"],nonClaims:["Queue order does not establish delivery time, uniqueness, retry count, or durability."],recoverWith:["evidence","inspect","code"]})]},{id:"parser-control-dependence",label:"parser-proved intraprocedural control dependence",requirements:["indexed-graph","source-facts"],relations:[...l.map(t=>e("execution",t,"The outcome is control-dependent on the reported predicate or handler.",{strengths:["exact"],nonClaims:["Local control dependence does not establish that the containing function executes."],recoverWith:["dependence-slice","inspect","code"]})),e("execution","returns","The selected construct contains the reported return terminal.",{strengths:["exact"],nonClaims:["A local return terminal does not establish that the containing callable executes."],recoverWith:["inspect","code"]}),e("execution","throws","The selected construct contains the reported throw terminal.",{strengths:["exact"],nonClaims:["A local throw terminal does not establish propagation, handling, or callable execution."],recoverWith:["inspect","code"]})]},{id:"bounded-static-value-flow",label:"compiler callsites and bounded static value evaluation",requirements:["indexed-graph","source-facts"],relations:["argument-to-parameter","constant-to-parameter","property-to-parameter","return-to-parameter","return-to-call-result"].map(t=>e("dataflow",t,"The reported value may reach the target through the evidenced callsite transfer.",{strengths:["exact","derived","mixed"],nonClaims:["This provider does not establish general local definition-use, alias, field, or heap flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}))},{id:"typescript-local-dependence",label:"TypeScript compiler identities, control-flow graph, and reaching definitions",requirements:["typescript-semantic"],relations:[e("dataflow","definition-to-use","The definition reaches the reported read on a feasible local control-flow path.",{strengths:["exact"],nonClaims:["Local reaching definitions do not establish heap aliasing, exceptional flow, or the runtime order of closure invocation."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),e("dataflow","value-to-definition","The reported right-hand-side read supplies the assigned local definition.",{strengths:["exact"],nonClaims:["A local assignment edge does not establish field or heap points-to flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),e("dataflow","closure-capture","The nested callable reads the reported binding from an enclosing callable.",{strengths:["candidate"],supportCeiling:"candidate",nonClaims:["Closure capture does not establish whether or when the nested callable executes."],recoverWith:["call-graph","inspect","code"]}),e("dataflow","field-definition-to-use","The reported same-owner field definition can reach the field read.",{strengths:["exact","candidate"],nonClaims:["Field-name identity does not establish whole-program heap aliasing or cross-instance flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),e("execution","control-dependence","Execution of the reported statement depends on the outcome of the predicate.",{strengths:["exact"],nonClaims:["Intraprocedural control dependence does not establish that the containing callable executes."],recoverWith:["dependence-slice","inspect","code"]})]},{id:"parser-state-temporal",label:"parser-proved local state and temporal facts",requirements:["indexed-graph","source-facts"],relations:[...d.map(t=>e("dataflow",t,"The reported source value is assigned into the identified state resource.",{strengths:["exact"],nonClaims:["The edge does not establish alias, heap, or later read flow."],recoverWith:["value-flow","inspect","code"]})),...["writes-resource","deletes-resource","reads-resource","enqueues-resource","consumes-resource"].map(t=>e("state",t,"The reported construct performs the named operation on the identified resource.",{strengths:["exact"],nonClaims:["A state operation does not establish transactionality, durability, or exclusive ownership."],recoverWith:["evidence","inspect","code"]})),...p.map(t=>e("temporal",t,"The reported source constructs have the named local ordering relationship.",{strengths:["exact"],nonClaims:["Local source order does not establish cross-process happens-before or durable completion."],recoverWith:["evidence","inspect","code"]}))]}];function m(t,i){let n=h.flatMap(r=>r.relations.filter(o=>o.family===t&&(o.match==="prefix"?i.startsWith(o.subtype):i===o.subtype)).map(o=>({provider:r,relation:o})));if(n.length>1)throw new Error(`Ambiguous graph relation provider for ${t}/${i}: ${n.map(r=>r.provider.id).join(", ")}`);return n[0]??null}export{u as a,m as b};
2
+ //# sourceMappingURL=chunk-XDAUYDFT.js.map
@@ -1,4 +1,4 @@
1
- import{a as g}from"./chunk-S7OYBOCK.js";import{j as p}from"./chunk-HX7M4BDI.js";import{a as f}from"./chunk-T7YQSHPQ.js";import{d as u,e as _,i as N}from"./chunk-EKZTZXHZ.js";import{p as d}from"./chunk-UJPRPGCO.js";import{x as l}from"./chunk-GH74ASD6.js";import{J as b}from"./chunk-WCCFZ7V7.js";import{a as I}from"./chunk-NGEXCJJW.js";import{c}from"./chunk-C3KV2II6.js";function Y(e,t,r={}){return T(e,t,r)?.map(s=>({symbol:s.symbol,shortName:s.shortName,fromFile:s.fromFile}))??[]}function Z(e,t){let r=f(e,t),s=O(e,t);if(s.length>0&&!x(r))return s;let o=k(e,t,r);return h(t)&&o.length>0?o:D([...s,...o])}function G(e,t,r={}){let s=g(e,t);if(!s)return[];let o=S(e,s),n=r.semantic===!1?null:E(e,s);return(n?R(n,o):o).filter(m=>!m.used).map(m=>({symbol:m.symbol,shortName:m.shortName,importedIn:m.importer}))}function R(e,t){let r=new Map;for(let o of t){let n=r.get(o.shortName);n?n.push(o):r.set(o.shortName,[o])}let s=e.map(o=>{let n=r.get(o.shortName),i=n?.shift();return n?.length===0&&r.delete(o.shortName),i?{...o,used:o.used||i.used}:o});return s.push(...[...r.values()].flat()),s}function O(e,t){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
1
+ import{a as g}from"./chunk-QH5Q6M5C.js";import{f as p}from"./chunk-GSHTVE56.js";import{a as f}from"./chunk-7MUHSZGN.js";import{d as u,e as _,i as N}from"./chunk-7Z4GMCHM.js";import{w as d}from"./chunk-6LS3IG2I.js";import{a as I,z as l}from"./chunk-C7WSQA6A.js";import{z as b}from"./chunk-JSHDCVUM.js";import{c}from"./chunk-WEXQYJY3.js";function Y(e,t,r={}){return T(e,t,r)?.map(s=>({symbol:s.symbol,shortName:s.shortName,fromFile:s.fromFile}))??[]}function Z(e,t){let r=f(e,t),s=O(e,t);if(s.length>0&&!x(r))return s;let o=k(e,t,r);return h(t)&&o.length>0?o:D([...s,...o])}function G(e,t,r={}){let s=g(e,t);if(!s)return[];let o=S(e,s),n=r.semantic===!1?null:E(e,s);return(n?R(n,o):o).filter(m=>!m.used).map(m=>({symbol:m.symbol,shortName:m.shortName,importedIn:m.importer}))}function R(e,t){let r=new Map;for(let o of t){let n=r.get(o.shortName);n?n.push(o):r.set(o.shortName,[o])}let s=e.map(o=>{let n=r.get(o.shortName),i=n?.shift();return n?.length===0&&r.delete(o.shortName),i?{...o,used:o.used||i.used}:o});return s.push(...[...r.values()].flat()),s}function O(e,t){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d ON c.document_id = d.id
@@ -32,4 +32,4 @@ import{a as g}from"./chunk-S7OYBOCK.js";import{j as p}from"./chunk-HX7M4BDI.js";
32
32
  WHERE imp_d.relative_path = ?
33
33
  AND m.role = 2
34
34
  ORDER BY def_d.relative_path, gs.symbol`,t).filter(n=>!e.isIgnored(n.importer));if(o.length>0){let n=r.semantic===!1?[]:p(e,t);return o.map(i=>({symbol:i.symbol,shortName:u(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||n.some(m=>m.isUsed&&m.sourcePath===i.from_file)}))}return null}function E(e,t){let r=p(e,t);return r.length>0?r.map(s=>{let o=y(s.importedName,s.localName,s.kind);return{symbol:o,shortName:o,fromFile:s.sourcePath??"(external)",importer:t,used:s.kind==="side-effect"?!0:s.isUsed}}):null}function S(e,t){let r=A(t,b(e,t));return d(e,t).map(s=>{let o=y(s.importedName,s.localName,s.kind),n=s.kind==="side-effect"||v(t,s)||r.has(s.localName??s.importedName)?!0:s.used;return{symbol:o,shortName:o,fromFile:s.sourcePath??"(external)",importer:t,used:n}})}function A(e,t){let r=new Set;if(l(e)!=="python")return r;let s=/(?:^|\n)\s*__all__\s*(?:\+?=)\s*[[(]([\s\S]*?)[\])]/g;for(let o of t.matchAll(s)){let n=o[1]??"";for(let i of n.matchAll(/(['"])([A-Za-z_]\w*)\1/g))r.add(i[2])}return r}function v(e,t){if(l(e)!=="rust"||t.used||t.kind==="side-effect")return!1;let r=t.localName??t.importedName;return r==="_"||/^[A-Z]/.test(r)}function y(e,t,r){return r==="namespace"&&e==="*"&&t?`* as ${t}`:r==="default"&&t?`default as ${t}`:r==="side-effect"?"(side effect import)":t&&t!==e?`${e} as ${t}`:e}function $(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{Y as a,Z as b,G as c};
35
- //# sourceMappingURL=chunk-L7AW2QB5.js.map
35
+ //# sourceMappingURL=chunk-XDOEHEET.js.map
@@ -0,0 +1,4 @@
1
+ import{a as k,b as fe,e as ye,h as G,k as Re,m as we}from"./chunk-FOP7HD6H.js";import{b as L}from"./chunk-YBWE6J32.js";import{a as xe}from"./chunk-C7WSQA6A.js";import{d as Se,h as X,t as Y,w as Me,y as Ie}from"./chunk-JSHDCVUM.js";import{G as me,J as x,R as ge,S as P,T as K,g as ae,i as ce,o as de,q as c,qa as be,ra as he,u as le,v as ue,x as pe}from"./chunk-WEXQYJY3.js";import{execFileSync as Fe}from"child_process";import{createHash as Qe}from"crypto";import{existsSync as N,statSync as et}from"fs";import{createRequire as tt}from"module";import{platform as nt}from"os";import{dirname as ve,join as T}from"path";var rt=tt(import.meta.url),fn={language:"rust",indexerBinary:"rust-analyzer",installUrl:"https://github.com/rust-lang/rust-analyzer"};function Z(t){return[t.indexerBinary,...t.binaryAliases??[]]}function it(t){let e=Z(t);return e.length===1?e[0]:e.join(" or ")}function Q(t){for(let e of Z(t)){let n=we(e);if(n)return n}return st(t)}function mn(t){return Q(t)!==null||ot(t)}function ot(t){return Pe(t)!==null}function st(t){let e=Pe(t);if(!e)return null;let r=JSON.parse(x(e,"indexer package manifest")).bin;if(!r)return null;if(typeof r=="string")return T(ve(e),r);for(let i of Z(t)){let o=r[i];if(o)return T(ve(e),o)}return null}function Pe(t){if(!t.bundledNpmPackage)return null;try{return rt.resolve(`${t.bundledNpmPackage}/package.json`)}catch{return null}}function at(t,e){for(let n of t.projectLocalBinaries??[]){let r=T(e,n);if(N(r))return r}return null}function ct(t,e){for(let n of t.projectLocalBinaries??[]){let r=T(e,n);if(N(r))return Te(e,n,r)}return null}function yn(t,e){let n=dt(t,e);if(!n||n.canonicalPath!==e.canonicalPath||n.sha256!==e.sha256||n.size!==e.size||n.mtimeMs!==e.mtimeMs||n.device!==e.device||n.inode!==e.inode||n.executable!==e.executable)throw new Error(`refusing changed project-local indexer ${e.relativePath}; review the current file and rerun with --trust-project-tools`)}function dt(t,e){try{return Te(t,e.relativePath,e.configuredPath)}catch{return null}}function Te(t,e,n){let r={maxBytes:268435456,inputKind:"project-local indexer"},i=be(t,e,r),o=he(t,e,r),s=et(i.absolutePath);return{configuredPath:n,canonicalPath:i.absolutePath,relativePath:e,sha256:Qe("sha256").update(o).digest("hex"),size:i.size,mtimeMs:i.mtimeMs,device:i.device,inode:i.inode,executable:(s.mode&73)!==0}}function lt(t,e,n={}){return(n.trustProjectTools?ct(t,e)?.canonicalPath:null)??Q(t)}function gn(t,e=process.env,n=t.indexerBinary){if(t.indexerBinary!=="scip-dotnet"||ee(n,e))return e;let r=Ae(n,e);return r?{...e,DOTNET_ROOT:r}:e}function bn(t,e,n={}){let r=it(t),i=e?lt(t,e,n):Q(t);if(!i)return{language:t.language,binaryLabel:r,installed:!1,runnable:!1,resolvedBinary:null,installUrl:t.installUrl,...e&&at(t,e)?{note:"project-local indexer available only with --trust-project-tools"}:{}};if(t.indexerBinary!=="scip-dotnet")return{language:t.language,binaryLabel:r,installed:!0,runnable:!0,resolvedBinary:i};let o=ut(i);return{language:t.language,binaryLabel:r,installed:!0,runnable:o.runnable,resolvedBinary:i,installUrl:t.installUrl,note:o.note}}function ut(t){if(ee(t,process.env))return{runnable:!0};let e=Ae(t,process.env);if(e)return{runnable:!0,note:`using .NET 9 runtime from ${e}`};let n=Be(process.env);return{runnable:!1,note:n.length>0?`.NET 9 runtime still unavailable after checking ${n.join(", ")}`:"binary is present, but scip-dotnet still needs a .NET 9 runtime"}}function Ae(t,e){for(let n of Be(e))if(ee(t,{...e,DOTNET_ROOT:n}))return n;return null}function Be(t){let e=[],n=t.DOTNET_ROOT;if(n&&N(n)&&e.push(n),nt()==="darwin"&&Re("brew"))try{let r=Fe("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:t,timeout:1e4,killSignal:"SIGKILL"}).toString().trim(),i=T(r,"libexec");N(i)&&!e.includes(i)&&e.push(i)}catch{}return e}function ee(t,e){try{return Fe(t,["--version"],{stdio:"pipe",env:e,timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var pt=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function C(t){let e=t.toLowerCase();return pt.some(n=>e.endsWith(n))}function q(t){let e=O(t.projectFiles),n=new Set(e),r=new Map(t.snapshot.files.map(l=>[l.path,l])),i=t.snapshot.files.filter(l=>{let m=ae(l.path,["typescript"]);return m==="config"||m==="ambient"}).map(l=>l.path),o=O([...e,...i]),s=o.find(l=>!r.has(l)),a=new Set(t.snapshot.files.map(l=>l.path)).size!==t.snapshot.files.length,d=!s&&o.some(l=>Ee(r.get(l))),f=X(JSON.stringify({pnpmWorkspaces:t.snapshot.pnpmWorkspaces,typescriptProjectMode:t.snapshot.typescriptProjectMode,typescriptProjects:O(t.snapshot.typescriptProjects),membership:e})),u,p;return{identityFor(l,m){if(!n.has(l))return I("target-outside-project");if(a)return I("duplicate-input-path");if(s)return I("missing-input-fingerprint");if(d)return I("unreadable-input");let g=[],y,z;if(t.graph===null)g.push("dependency-graph-unavailable"),z="whole-project",y=o;else{let F=l===u&&p?p:ft(l,t.graph);if(u=l,p=F,F.find(V=>!r.has(V)))return I("missing-input-fingerprint");if(y=O([...F,...i]),y.some(V=>Ee(r.get(V))))return I("unreadable-input");z="dependency-closure"}let Ze=y.map(F=>mt(r.get(F)));return{version:1,key:X(JSON.stringify({version:1,engineIdentity:t.engineIdentity,schemaVersion:m,projectIdentity:f,inputs:Ze})),mode:z,inputFiles:y,reasons:g}}}}function ft(t,e){let n=new Set,r=[t];for(let i=0;i<r.length;i+=1){let o=r[i];if(!(o===void 0||n.has(o))){n.add(o);for(let s of[...e.get(o)??[]].sort())n.has(s)||r.push(s)}}return[...n].sort()}function mt(t){return t.semanticHash===void 0?{path:t.path,size:t.size,hash:t.hash}:{path:t.path,semanticHash:t.semanticHash}}function Ee(t){return t.size<0||t.hash==="unreadable"}function I(t){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[t]}}function O(t){return[...new Set(t)].sort()}import{createRequire as yt}from"module";var De=yt(import.meta.url),A,$;function gt(){if(A!==void 0)return A;try{A=De("ts-morph")}catch{A=null}return A}function _(){if($)return $;let t=gt();if(!t)return"ts-morph:unavailable";let e="unknown";try{e=De("ts-morph/package.json").version??"unknown"}catch{}return $=`ts-morph:${e}:typescript:${t.ts.version}`,$}function wn(t,e){return e.map(n=>({tsconfigPath:n,project:new t.Project({tsConfigFilePath:n,skipFileDependencyResolution:!0})}))}function vn(t,e,n){return{language:"typescript",availability:()=>({available:!1,reason:t,tsconfigPath:e,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var bt=Se("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function te(t,e,n){let r=bt.get(t,()=>ht(t));if(!r)return null;let i=`${n}\0${e}`,o=r.identities.get(i);if(o)return o;let s=r.builder.identityFor(e,n);return r.identities.set(i,s),s}function B(t){return xe(t,{includeIgnored:!1}).filter(C).sort()}function ht(t){try{if(!t.generation.metadataRaw)return null;let e=pe(t.generation.metadataRaw);if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.usableForEvidenceCache)return null;let n=ce(e.metadata.fingerprint);return n?{builder:q({projectFiles:B(t),snapshot:n,graph:L(t),engineIdentity:_()}),identities:new Map}:null}catch{return null}}function W(t,e){let n=new Map(t.map(i=>[i.symbol,i])),r=new Map(t.map(i=>[i.symbolId,[]]));for(let i of e.values())for(let o of i){let s=n.get(o.targetSymbol);s&&r.get(s.symbolId).push(o.location)}for(let[i,o]of r)r.set(i,St(o));return r}function Le(t,e,n){let r=ke(t,e),i=ke(t,n),o=[...r].filter(p=>!i.has(p)).sort(),s=[...i].filter(p=>!r.has(p)).sort(),a=je(t,e),d=je(t,n),f=[...a].filter(p=>!d.has(p)).sort(),u=[...d].filter(p=>!a.has(p)).sort();return{passed:o.length===0&&s.length===0,expectedCount:r.size,actualCount:i.size,missing:o,extra:s,callerFiles:{passed:f.length===0&&u.length===0,expectedCount:a.size,actualCount:d.size,missing:f,extra:u}}}function je(t,e){let n=new Set;for(let r of t)for(let i of e.get(r.symbolId)??[])i.file!==r.relativePath&&n.add(`${r.symbol}\0${i.file}`);return n}function Nn(t,e,n){let r=new Set(n),i=new Map(n.map(o=>[o,[]]));for(let o of t)for(let s of e.get(o.symbolId)??[])r.has(s.file)&&i.get(s.file).push({targetSymbol:o.symbol,location:s});for(let[o,s]of i)i.set(o,xt(s));return i}function ke(t,e){let n=new Set;for(let r of t)for(let i of e.get(r.symbolId)??[])n.add(`${r.symbol}\0${i.file}\0${i.line}\0${i.column}`);return n}function St(t){let e=new Map;for(let n of t)e.set(`${n.file}\0${n.line}\0${n.column}`,n);return[...e.values()].sort(Ne)}function xt(t){let e=new Map;for(let n of t){let{location:r}=n;e.set(`${n.targetSymbol}\0${r.file}\0${r.line}\0${r.column}`,n)}return[...e.values()].sort((n,r)=>n.targetSymbol.localeCompare(r.targetSymbol)||Ne(n.location,r.location))}function Ne(t,e){return t.file.localeCompare(e.file)||t.line-e.line||t.column-e.column}var ne="typescript-reference-fragment-v2",Ce=128,J=Me({kind:"typescript-reference-fragments",invalidation:Ie("typescript-reference-fragments"),serialize:t=>JSON.stringify(t),deserialize:It});function zn(t,e,n,r=t,i,o=new Set(n.keys())){let s=B(t),a=q({projectFiles:s,snapshot:e,graph:i??L(t),engineIdentity:_()}),d=[],f=0;for(let[p,l]of n){let m=a.identityFor(p,ne).key;if(!m){f+=1;continue}d.push({relativePath:p,contentHash:m,value:[...l]})}let u=s.filter(p=>!o.has(p)&&!n.has(p)).length;return J.writeBatch(r,d),{affectedFiles:d.length,carriedFiles:u,skippedAffectedFiles:f}}function Vn(t,e,n,r){let i=e.filter(s=>C(s.relativePath));if(i.length===0)return E("no TypeScript definitions");let o=E("shadow did not run");return Y("typescript.reference-fragments.shadow",()=>{try{let s=r(i[0].relativePath);if(!s.availability().available||!s.referenceFragmentsForFiles)return o=E("TypeScript reference fragment provider is unavailable"),o;let a=B(t),d=new Set(a),f=new Map;for(let m of Oe(a)){let g=s.referenceFragmentsForFiles(m);if(m.some(y=>!g.has(y)))return o=E("TypeScript reference fragment provider returned an incomplete batch"),o;for(let y of m)f.set(y,g.get(y)??[])}let u=W(i,f),p=Le(i,Mt(n,d),u);if(!p.passed)return o={state:"failing",files:a.length,keyedFiles:0,writtenFiles:0,...p},o;let l=[];for(let m of a){let g=te(t,m,ne);g?.key&&l.push({relativePath:m,contentHash:g.key,value:f.get(m)??[]})}return J.writeBatch(t,l),o={state:"passing",files:a.length,keyedFiles:l.length,writtenFiles:l.length,...p},o}catch(s){return o=E(s instanceof Error?s.message:String(s)),o}},()=>({...o}))}function Mt(t,e){return new Map([...t].map(([n,r])=>[n,r.filter(i=>e.has(i.file))]))}function Kn(t,e,n){if(e.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let r="fallback",i=0,o=0,s=0,a=0;return Y("typescript.reference-fragments.materialize",()=>{try{let d=B(t);i=d.length;let f=new Map,u=new Map,p=[];for(let m of d){let g=te(t,m,ne);if(!g?.key)return null;f.set(m,g.key);let y=J.read(t,m,g.key);y===null?(s+=1,p.push(m)):(o+=1,u.set(m,y))}if(s===0)return r="hit",{references:W(e,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a};let l=n(e[0].relativePath);if(!l.availability().available||!l.referenceFragmentsForFiles)return null;for(let m of Oe(p)){let g=l.referenceFragmentsForFiles(m);if(m.some(y=>!g.has(y)))return null;J.writeBatch(t,m.map(y=>({relativePath:y,contentHash:f.get(y),value:g.get(y)??[]})));for(let y of m)u.set(y,g.get(y)??[]);a+=m.length}return r="computed",{references:W(e,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a}}catch{return null}},()=>({state:r,files:i,cacheHits:o,cacheMisses:s,computedFiles:a}))}function Oe(t){let e=[];for(let n=0;n<t.length;n+=Ce)e.push(t.slice(n,n+Ce));return e}function E(t){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:t}}function It(t){try{let e=JSON.parse(t);return!Array.isArray(e)||!e.every(Rt)?null:e}catch{return null}}function Rt(t){if(!t||typeof t!="object")return!1;let e=t,n=e.location;return typeof e.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}import{createHash as vt,randomUUID as Ue}from"crypto";import{existsSync as v,lstatSync as j,mkdirSync as er,readdirSync as w,renameSync as He,rmSync as M}from"fs";import{basename as U,dirname as Ft,join as b}from"path";function qe(t){return re(t,wt)}function re(t,e){return Array.isArray(t)?`[${t.map(n=>re(n,e)).join(",")}]`:t&&typeof t=="object"?`{${Object.entries(t).sort(([n],[r])=>e(n,r)).map(([n,r])=>`${JSON.stringify(n)}:${re(r,e)}`).join(",")}}`:JSON.stringify(t)}function wt(t,e){return t.localeCompare(e)}var Pt=1,Tt=Object.freeze({maxItems:1024,maxBytes:512*1024*1024,maxItemBytes:64*1024*1024,maxBatch:16,claimLeaseMs:5*6e4,responseRetentionMs:10*6e4,deadLetterRetentionMs:1440*6e4,temporaryRetentionMs:6e4,cleanupBatch:64}),R=class extends Error{constructor(n,r,i,o){let s=n==="item-too-large"?`request is ${o} bytes; per-item limit is ${i.maxItemBytes}`:n==="item-capacity"?`mailbox has ${r.totalItems} retained items; limit is ${i.maxItems}`:n==="byte-capacity"?`mailbox retains ${r.totalBytes} bytes and the request adds ${o}; limit is ${i.maxBytes}`:"another writer held the admission coordinator through the bounded wait";super(`Mailbox backpressure: ${s}. Retry after the service drains or expires retained work.`);this.code=n;this.status=r;this.limits=i;this.attemptedBytes=o;this.name="MailboxBackpressureError"}code;status;limits;attemptedBytes},At=".owner.json",Bt={isProcessAlive:()=>!0,readProcessIdentity:()=>null};function ar(t){return{rootDir:t,pendingDir:b(t,"pending"),inflightDir:b(t,"inflight"),responseDir:b(t,"responses"),deadLetterDir:b(t,"dead-letter"),legacyRequestDir:b(t,"requests")}}function Et(t={}){let e={...Tt,...t};for(let[n,r]of Object.entries(e))if(!Number.isFinite(r)||r<=0||!Number.isInteger(r))throw new Error(`Mailbox limit ${n} must be a positive integer.`);return e}function ze(t){let e=[t.pendingDir,t.inflightDir,t.responseDir,t.deadLetterDir,t.legacyRequestDir].map(n=>ge(n));return K(...e)}function cr(t,e){return vt("sha256").update(qe({namespace:t,payload:e})).digest("hex")}function Ve(t){if(!/^[a-f0-9]{64}$/.test(t))throw new Error("Mailbox operation keys must be lowercase SHA-256 identities.");return`op-${t}`}function dr(t,e,n={}){let r=Et(n.limits),i=n.nowMs??Date.now(),o=ze(t);return qt(e),jt(t,r,n.admissionLockTimeoutMs??2e3,n.monotonicNow??ye,n.durability??"durable",()=>{Dt(t,i,r);let s=b(t.pendingDir,`${e.id}.json`),a=b(t.responseDir,`${e.id}.json`),d=$e(t,e.id);if(d){let l=_e(d,e.operationKey,e.id);return{disposition:"duplicate",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:l.deadlineAtMs??e.deadlineAtMs}}let f=`${JSON.stringify(e)}
2
+ `,u=Buffer.byteLength(f),p=Ke(t);if(u>r.maxItemBytes)throw new R("item-too-large",p,r,u);if(p.totalItems+1>r.maxItems)throw new R("item-capacity",p,r,u);if(p.totalBytes+u>r.maxBytes)throw new R("byte-capacity",p,r,u);n.onBeforePublish?.();try{let l=n.durability??"durable",m=G(s,f,{durability:l}),g=l==="durable"?K(o,m.directorySync):"not-requested";return{disposition:"accepted",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:e.deadlineAtMs,achievedDurability:m.achievedDurability,directorySync:g}}catch(l){if(l.code!=="EEXIST")throw l;let m=$e(t,e.id);if(!m)throw l;let g=_e(m,e.operationKey,e.id);return{disposition:"duplicate",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:g.deadlineAtMs??e.deadlineAtMs}}})}function Dt(t,e,n,r=Bt){let i={reclaimed:0,completedClaimsRemoved:0,responsesRemoved:0,deadLettersRemoved:0,temporaryFilesRemoved:0},o=n.cleanupBatch;for(let s of oe(t.inflightDir)){if(o<=0)break;let a=b(t.responseDir,`${s.requestId}.json`);if(v(a)){M(s.path,{force:!0}),i.completedClaimsRemoved++,o--;continue}if(s.claimExpiresAtMs>e||Ct(t,s.ownerId,r)!=="dead")continue;let d=b(t.pendingDir,s.originalFile);try{He(s.path,d),i.reclaimed++}catch(f){if(f.code!=="EEXIST")throw f;M(s.path,{force:!0})}P(Ft(s.path)),P(t.pendingDir),o--}o=We(t.responseDir,o,(s,a)=>a+n.responseRetentionMs,e,()=>{i.responsesRemoved++}),o=We(t.deadLetterDir,o,(s,a)=>a+n.deadLetterRetentionMs,e,()=>{i.deadLettersRemoved++});for(let s of[t.pendingDir,t.inflightDir,t.responseDir,t.deadLetterDir,t.legacyRequestDir]){if(o<=0)break;for(let a of Ge(s)){if(o<=0)break;if(!U(a).includes(".tmp-"))continue;let d;try{d=j(a).mtimeMs}catch(f){if(f.code==="ENOENT")continue;throw f}d+n.temporaryRetentionMs>e||(M(a,{force:!0}),i.temporaryFilesRemoved++,o--)}}return $t(t.inflightDir),i}function Ke(t){ze(t);let e=[...D(t.pendingDir).map(d=>({path:d,pending:!0})),...D(t.legacyRequestDir).map(d=>({path:d,pending:!0}))],n=oe(t.inflightDir).map(d=>({path:d.path,pending:!1})),r=D(t.responseDir).map(d=>({path:d,pending:!1})),i=D(t.deadLetterDir).map(d=>({path:d,pending:!1})),o=[...e,...n,...r,...i],s=0,a;for(let d of e){let f=se(d.path);if(!f){s++;continue}let u=f.enqueuedAtMs;if(u===void 0)try{u=j(d.path).mtimeMs}catch(p){if(p.code==="ENOENT")continue;throw p}a=a===void 0?u:Math.min(a,u)}return{pending:e.length,inflight:n.length,responses:r.length,deadLetters:i.length,invalid:s,totalItems:o.length,totalBytes:o.reduce((d,f)=>d+_t(f.path),0),...a===void 0?{}:{oldestPendingAt:new Date(a).toISOString()}}}function jt(t,e,n,r,i,o){let s=b(t.rootDir,".admission.lock"),a=`${process.pid}-${Ue()}`,d=r()+Math.max(0,n);for(;!kt(t.rootDir,s,a,i);){if(Lt(s),r()>=d)throw new R("admission-busy",Ke(t),e,0);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,5)}try{return o()}finally{try{ie(s).ownerToken===a&&(M(s,{recursive:!0,force:!0}),i==="durable"&&P(t.rootDir))}catch{}}}function kt(t,e,n,r){let i=`${JSON.stringify({ownerToken:n,pid:process.pid,acquiredAtMs:Date.now()})}
3
+ `;try{return G(e,i,{durability:r}),!0}catch(o){if(o.code==="EEXIST")return!1;try{ie(e).ownerToken===n&&(M(e,{force:!0}),r==="durable"&&P(t))}catch{}throw o}}function Lt(t){let e=null;try{let r=ie(t);typeof r.ownerToken=="string"&&Number.isSafeInteger(r.pid)&&Number(r.pid)>0&&(e=Number(r.pid))}catch{}if(e===null||Nt(e))return;let n=`${t}.stale-${Ue()}`;try{He(t,n)}catch(r){let i=r.code;if(i==="ENOENT"||i==="EEXIST")return;throw r}M(n,{recursive:!0,force:!0})}function ie(t){try{return JSON.parse(x(t,"mailbox lock record"))}catch(e){if(e.code!=="EISDIR"&&!(e instanceof me&&e.reason==="not-regular"))throw e;return JSON.parse(x(b(t,"owner.json"),"mailbox lock owner record"))}}function Nt(t){try{return process.kill(t,0),!0}catch(e){let n=e.code;return n==="EPERM"||n!=="ESRCH"}}function Ct(t,e,n){let r=Ot(b(t.inflightDir,Xe(e),At));if(!r)return"unknown";if(!n.isProcessAlive(r.pid))return"dead";if(!r.processIdentity)return"live";let i=n.readProcessIdentity(r.pid);return i?fe(r.processIdentity,i)?"live":"dead":"unknown"}function Ot(t){try{let e=JSON.parse(x(t,"mailbox owner record"));if(e.version!==1||typeof e.ownerId!="string"||!e.ownerId||typeof e.pid!="number"||!Number.isSafeInteger(e.pid)||e.pid<=0)return null;let n=e.processIdentity===void 0?null:k(e.processIdentity);return e.processIdentity!==void 0&&(!n||n.pid!==e.pid)?null:{version:1,ownerId:e.ownerId,pid:e.pid,...n?{processIdentity:n}:{}}}catch{return null}}function $e(t,e){for(let n of[b(t.pendingDir,`${e}.json`),b(t.legacyRequestDir,`${e}.json`),b(t.responseDir,`${e}.json`)])if(v(n))return n;for(let n of oe(t.inflightDir))if(n.requestId===e)return n.path;return null}function _e(t,e,n){let r=se(t);if(r?.operationKey===e)return r;if(U(t)===`${Ve(e)}.json`)return{id:n,operationKey:e};throw new Error(`Mailbox operation ${n} conflicts with an existing retained record.`)}function qt(t){if(t.mailboxVersion!==Pt||t.id!==Ve(t.operationKey)||!t.clientId.trim()||!Number.isFinite(t.enqueuedAtMs)||!Number.isFinite(t.deadlineAtMs)||t.deadlineAtMs<t.enqueuedAtMs)throw new Error("Mailbox request has an invalid lifecycle identity.")}function oe(t){if(!v(t))return[];let e=[];for(let n of w(t,{withFileTypes:!0})){if(!n.isDirectory())continue;let r=Je(n.name);if(r===null)continue;let i=b(t,n.name);for(let o of w(i,{withFileTypes:!0})){if(!o.isFile()||!o.name.endsWith(".claim"))continue;let s=/^(.*)\.(\d+)\.claim$/.exec(o.name);if(!s)continue;let a=Je(s[1]),d=Number(s[2]);if(a===null||U(a)!==a||!a.endsWith(".json")||!Number.isSafeInteger(d))continue;let f=b(i,o.name),u=se(f)??{id:U(a,".json")},p;try{p=j(f)}catch(l){if(l.code==="ENOENT")continue;throw l}e.push({requestId:u.id,ownerId:r,path:f,originalFile:a,claimedAtMs:p.mtimeMs,claimExpiresAtMs:d,byteLength:p.size,...u.operationKey?{operationKey:u.operationKey}:{},...u.clientId?{clientId:u.clientId}:{},...u.enqueuedAtMs===void 0?{}:{enqueuedAtMs:u.enqueuedAtMs},...u.deadlineAtMs===void 0?{}:{deadlineAtMs:u.deadlineAtMs},legacy:u.operationKey===void 0})}}return e.sort((n,r)=>n.claimedAtMs-r.claimedAtMs||n.path.localeCompare(r.path))}function se(t){try{let e=JSON.parse(x(t,"mailbox record"));return typeof e.id!="string"||!e.id?null:{id:e.id,...typeof e.operationKey=="string"?{operationKey:e.operationKey}:{},...typeof e.clientId=="string"?{clientId:e.clientId}:{},...typeof e.enqueuedAtMs=="number"?{enqueuedAtMs:e.enqueuedAtMs}:{},...typeof e.deadlineAtMs=="number"?{deadlineAtMs:e.deadlineAtMs}:{}}}catch{return null}}function We(t,e,n,r,i){for(let o of D(t)){if(e<=0)break;let s;try{s=j(o)}catch(a){if(a.code==="ENOENT")continue;throw a}n(o,s.mtimeMs)>r||(M(o,{force:!0}),i(),e--)}return e}function D(t){return v(t)?w(t,{withFileTypes:!0}).filter(e=>e.isFile()).map(e=>b(t,e.name)).sort():[]}function Ge(t){if(!v(t))return[];let e=[];for(let n of w(t,{withFileTypes:!0})){let r=b(t,n.name);n.isFile()?e.push(r):n.isDirectory()&&e.push(...Ge(r))}return e.sort()}function $t(t){if(v(t))for(let e of w(t,{withFileTypes:!0})){if(!e.isDirectory())continue;let n=b(t,e.name);w(n).some(r=>r.endsWith(".claim"))||M(n,{recursive:!0,force:!0})}}function _t(t){try{return j(t).size}catch{return 0}}function Xe(t){return Buffer.from(t,"utf8").toString("base64url")}function Je(t){try{let e=Buffer.from(t,"base64url").toString("utf8");return Xe(e)===t?e:null}catch{return null}}import{join as H}from"path";var gr=1e4,Wt="watch.lock",Jt="watch-state.json",Ut="watch-activity.json",Ht="watch-refresh-requests";function br(t){return{lockPath:H(t,Wt),statePath:H(t,Jt),activityPath:H(t,Ut),refreshRequestsPath:H(t,Ht)}}function hr(t){try{return zt(JSON.parse(x(t,"watch service state")))}catch{return null}}function zt(t){if(!t||typeof t!="object")return null;let e=t;if(e.version!==1||typeof e.protocolVersion!="number"||typeof e.pid!="number"||!Number.isInteger(e.pid)||e.pid<=0||typeof e.projectRoot!="string"||e.worktreeId!==void 0&&(typeof e.worktreeId!="string"||e.worktreeId.length===0)||typeof e.cliVersion!="string"||!h(e.startedAt)||!h(e.heartbeatAt)||!h(e.lastActivityAt)||!Vt(e.watcher)||e.idleDeadlineAt!==void 0&&!h(e.idleDeadlineAt))return null;if(e.processIdentity!==void 0){let n=k(e.processIdentity);if(!n||n.pid!==e.pid)return null;e.processIdentity=n}return e.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(e.indexGeneration)||e.lastError!==void 0&&!Kt(e.lastError)||e.lastRefresh!==void 0&&!Gt(e.lastRefresh)||e.reindexActivity!==void 0&&!Xt(e.reindexActivity)||e.refreshRequests!==void 0&&!Zt(e.refreshRequests)||e.typescriptSemantic!==void 0&&!Qt(e.typescriptSemantic)||e.typescriptIndex!==void 0&&!en(e.typescriptIndex)?null:e}function h(t){return de(t)}function Vt(t){if(!t||typeof t!="object"||!("state"in t))return!1;let e=t;switch(e.state){case"idle":return!0;case"waiting":return S(e.changedFiles)&&S(e.reindexAt);case"indexing":return S(e.startedAt);case"cooldown":return S(e.until)&&typeof e.dirty=="boolean";case"budget-paused":return S(e.until)&&typeof e.dirty=="boolean"&&typeof e.reason=="string"&&c(e.rebuilt)&&c(e.estimatedWriteBytes);case"draining":return S(e.startedAt)&&typeof e.reason=="string";default:return!1}}function Kt(t){if(!t||typeof t!="object")return!1;let e=t;return h(e.at)&&typeof e.message=="string"}function Gt(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.trigger?.kind=="string"&&typeof e.result=="string"&&h(e.startedAt)&&h(e.completedAt)&&S(e.durationMs)}function Xt(t){if(!t||typeof t!="object")return!1;let e=t;return e.confidence!==void 0&&e.confidence!=="complete"&&e.confidence!=="partial"&&e.confidence!=="unavailable"||e.recordsRead!==void 0&&!c(e.recordsRead)||e.invalidRecords!==void 0&&!c(e.invalidRecords)||e.skippedRecords!==void 0&&!c(e.skippedRecords)||e.readErrors!==void 0&&!c(e.readErrors)||e.ignoredPartialTailBytes!==void 0&&!c(e.ignoredPartialTailBytes)||!h(e.windowStartedAt)||!h(e.windowEndedAt)||!c(e.runs)||!c(e.rebuilt)||e.fullRebuilds!==void 0&&!c(e.fullRebuilds)||!c(e.reused)||!c(e.failed)||!c(e.suppressed)||!S(e.estimatedLogicalOutputBytes)||e.estimatedWriteBytes!==void 0&&!c(e.estimatedWriteBytes)||e.reflinkedBytes!==void 0&&!c(e.reflinkedBytes)||e.fallbackCopiedBytes!==void 0&&!c(e.fallbackCopiedBytes)||e.oldestRebuildAt!==void 0&&!h(e.oldestRebuildAt)||e.oldestWriteAt!==void 0&&!h(e.oldestWriteAt)||e.languageAttribution!==void 0&&e.languageAttribution!=="complete"&&e.languageAttribution!=="partial"&&e.languageAttribution!=="unavailable"||e.attributedRuns!==void 0&&!c(e.attributedRuns)||e.unattributedRuns!==void 0&&!c(e.unattributedRuns)||e.invalidLanguageDetails!==void 0&&!c(e.invalidLanguageDetails)||e.estimatedLogicalOutputBytes<0||!e.byTrigger||typeof e.byTrigger!="object"||Array.isArray(e.byTrigger)||e.byLanguage!==void 0&&!Yt(e.byLanguage)?!1:Object.values(e.byTrigger).every(n=>n===void 0||c(n))}function Yt(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;for(let[e,n]of Object.entries(t)){if(!ue.includes(e)||!n||typeof n!="object")return!1;let r=n;if(!c(r.runs)||!c(r.rebuilt)||!c(r.reused)||!c(r.producedOutputBytes)||!le(r.durationMs)||r.rebuilt+r.reused!==r.runs)return!1}return!0}function Zt(t){if(!t||typeof t!="object")return!1;let e=t;return c(e.pending)&&c(e.claimed)&&c(e.completed)&&c(e.expired)&&c(e.invalid)&&(e.oldestPendingAt===void 0||h(e.oldestPendingAt))}function Qt(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&(e.state==="idle"||e.state==="ready"||e.state==="unavailable"||e.state==="error")&&S(e.requests)&&S(e.sessionsCreated)&&S(e.sessionsReused)&&S(e.sessionsRefreshed)&&S(e.sessionsReplaced)&&S(e.projectsCreated)&&(e.lastRequestAt===void 0||h(e.lastRequestAt))&&(e.lastError===void 0||typeof e.lastError=="string")&&(e.busyUntil===void 0||h(e.busyUntil))&&(e.mailbox===void 0||Ye(e.mailbox))}function en(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&(e.state==="idle"||e.state==="ready"||e.state==="unavailable"||e.state==="error")&&c(e.requests)&&c(e.sessionsCreated)&&c(e.sessionsReplaced)&&(e.sessionsEvicted===void 0||c(e.sessionsEvicted))&&(e.activeSessions===void 0||c(e.activeSessions))&&(e.maxActiveSessions===void 0||c(e.maxActiveSessions))&&(e.heapUsedBytes===void 0||c(e.heapUsedBytes))&&(e.heapLimitBytes===void 0||c(e.heapLimitBytes))&&(e.softMemoryLimitBytes===void 0||c(e.softMemoryLimitBytes))&&(e.retireRequested===void 0||typeof e.retireRequested=="boolean")&&c(e.initializations)&&c(e.programUpdates)&&c(e.documentsEmitted)&&c(e.documentsRemoved)&&(e.lastRequestAt===void 0||h(e.lastRequestAt))&&(e.lastDurationMs===void 0||S(e.lastDurationMs)&&e.lastDurationMs>=0)&&(e.lastError===void 0||typeof e.lastError=="string")&&(e.busyUntil===void 0||h(e.busyUntil))&&(e.mailbox===void 0||Ye(e.mailbox))}function Ye(t){if(!t||typeof t!="object")return!1;let e=t;return c(e.pending)&&c(e.inflight)&&c(e.responses)&&c(e.deadLetters)&&c(e.invalid)&&c(e.totalItems)&&S(e.totalBytes)&&e.totalBytes>=0&&e.totalItems===e.pending+e.inflight+e.responses+e.deadLetters&&(e.oldestPendingAt===void 0||h(e.oldestPendingAt))}function S(t){return typeof t=="number"&&Number.isFinite(t)}export{fn as a,it as b,Q as c,mn as d,at as e,ct as f,yn as g,gn as h,bn as i,qe as j,Pt as k,ar as l,cr as m,Ve as n,dr as o,gr as p,br as q,hr as r,pt as s,C as t,gt as u,wn as v,vn as w,Nn as x,te as y,zn as z,Vn as A,Kn as B};
4
+ //# sourceMappingURL=chunk-XDQX6LDT.js.map
@@ -0,0 +1,2 @@
1
+ import{F as a,P as c}from"./chunk-NP4JFCLE.js";var D=4;function m(e,i,t,r={}){return p(e,i,t,r.maxReexportDepth??D,0,new Set)}function p(e,i,t,r,s,o){let f=`${i}\0${t}`;if(o.has(f)||s>r)return[];o.add(f);let u=c(e,i).filter(n=>n.leaf===t);return u.length>0?u:a(e,i).flatMap(n=>n.sourcePath?n.kind==="named"&&!n.names.includes(t)?[]:p(e,n.sourcePath,t,r,s+1,new Set(o)):[])}export{m as a};
2
+ //# sourceMappingURL=chunk-XFRHBAIT.js.map