codebaseiq 0.3.0 → 0.4.0

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 (324) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/{chunk-7GAK2F3H.js → chunk-23AD24QZ.js} +12 -12
  4. package/dist/chunk-24TEZJST.js +2 -0
  5. package/dist/{chunk-356EZBIP.js → chunk-26EDDGAX.js} +2 -2
  6. package/dist/{chunk-O2M3VNDY.js → chunk-26EZWQ24.js} +2 -2
  7. package/dist/{chunk-U33PMPNW.js → chunk-2L3NCI52.js} +2 -2
  8. package/dist/{chunk-MSI3K7PJ.js → chunk-2QJAVISG.js} +2 -2
  9. package/dist/{chunk-4LK5OIPW.js → chunk-2ZBZRYX4.js} +2 -2
  10. package/dist/chunk-33AXWMO2.js +2 -0
  11. package/dist/{chunk-EQNMD62X.js → chunk-37K55EG3.js} +2 -2
  12. package/dist/{chunk-ITSJMNUD.js → chunk-3EFZ5KQ4.js} +2 -2
  13. package/dist/{chunk-D7DOB27N.js → chunk-3F23W57G.js} +2 -2
  14. package/dist/{chunk-BGGB5N53.js → chunk-3GKKCVKK.js} +2 -2
  15. package/dist/{chunk-MQW6SJ4P.js → chunk-3SYRGMCL.js} +2 -2
  16. package/dist/{chunk-PFC44E6D.js → chunk-3VDL7GTY.js} +2 -2
  17. package/dist/{chunk-7JELP5YE.js → chunk-3XBZ5PKL.js} +2 -2
  18. package/dist/{chunk-75KJGYX7.js → chunk-42PXSE74.js} +2 -2
  19. package/dist/{chunk-FEIZXBLH.js → chunk-4GIERC2P.js} +2 -2
  20. package/dist/{chunk-W7YLRXZE.js → chunk-4UXDBRIF.js} +2 -2
  21. package/dist/chunk-4XMZYLW5.js +2 -0
  22. package/dist/{chunk-6BF3VYEF.js → chunk-55NUXP2V.js} +2 -2
  23. package/dist/chunk-5AJQCOZZ.js +21 -0
  24. package/dist/{chunk-5DSL3NT2.js → chunk-5NUPFZFA.js} +2 -2
  25. package/dist/{chunk-RJVAPMHF.js → chunk-65QIFIF6.js} +2 -2
  26. package/dist/{chunk-36JC5BG2.js → chunk-66Q5VLH6.js} +2 -2
  27. package/dist/{chunk-D7AZAOZX.js → chunk-6CQPIIS7.js} +2 -2
  28. package/dist/{chunk-GV2CEZCW.js → chunk-6CTSFS7R.js} +2 -2
  29. package/dist/{chunk-Q4XEU3UH.js → chunk-6EBUAKJT.js} +2 -2
  30. package/dist/chunk-6I55VYFG.js +4 -0
  31. package/dist/chunk-6NUURWPF.js +3 -0
  32. package/dist/{chunk-MHWMEZDA.js → chunk-6P5QMOM7.js} +2 -2
  33. package/dist/{chunk-LZSQ6X7E.js → chunk-6S5FE4ZF.js} +2 -2
  34. package/dist/chunk-74LRKLNC.js +22 -0
  35. package/dist/chunk-75A23IID.js +3 -0
  36. package/dist/chunk-75VNTSO6.js +7 -0
  37. package/dist/chunk-7HBBVZJ6.js +3 -0
  38. package/dist/{chunk-VWYGCMV5.js → chunk-7PPBMBH6.js} +2 -2
  39. package/dist/{chunk-3RSBGWGL.js → chunk-7WG57A5X.js} +2 -2
  40. package/dist/{chunk-FWQGH2N2.js → chunk-7XHZX6FX.js} +2 -2
  41. package/dist/{chunk-RIYJ4L33.js → chunk-A5HJ3CJW.js} +2 -2
  42. package/dist/{chunk-LONKINMJ.js → chunk-AJ5HVC5Z.js} +2 -2
  43. package/dist/{chunk-ZAFGY22Q.js → chunk-AYRHOFLV.js} +2 -2
  44. package/dist/chunk-AZDY3EKD.js +93 -0
  45. package/dist/{chunk-CW6AXOLR.js → chunk-AZZNG5Z2.js} +2 -2
  46. package/dist/chunk-BEKCTUPY.js +3 -0
  47. package/dist/{chunk-CR3OG6SQ.js → chunk-BKKX2OU5.js} +2 -2
  48. package/dist/{chunk-5LL4KEHO.js → chunk-BQKRYKDD.js} +2 -2
  49. package/dist/{chunk-FOZ74V56.js → chunk-BVDQU2XJ.js} +2 -2
  50. package/dist/chunk-C3PPB2T5.js +5 -0
  51. package/dist/chunk-CABIZQXQ.js +21 -0
  52. package/dist/{chunk-M2Y6PCFE.js → chunk-CAH322MC.js} +2 -2
  53. package/dist/{chunk-EIBGSU2R.js → chunk-CBOOHUK4.js} +2 -2
  54. package/dist/chunk-CFIICAOM.js +2 -0
  55. package/dist/{chunk-XMJ53WG4.js → chunk-CPWYEPWQ.js} +2 -2
  56. package/dist/{chunk-LQHYYIOB.js → chunk-CRT7I7RJ.js} +2 -2
  57. package/dist/{chunk-IZDPGOZR.js → chunk-CZVSQQDU.js} +2 -2
  58. package/dist/{chunk-TNJGTQWO.js → chunk-D3KE26FS.js} +2 -2
  59. package/dist/{chunk-GP7C5VAE.js → chunk-DNRHRVKS.js} +2 -2
  60. package/dist/{chunk-SGMNWYTH.js → chunk-DOQLO74K.js} +2 -2
  61. package/dist/{chunk-AURCQHSG.js → chunk-DP3EJ6XL.js} +2 -2
  62. package/dist/{chunk-C7QWUBR2.js → chunk-DQZF7MP6.js} +2 -2
  63. package/dist/{chunk-E52K4L2W.js → chunk-DTM4EHD2.js} +2 -2
  64. package/dist/{chunk-YRKP7PM7.js → chunk-DUM7GR6B.js} +2 -2
  65. package/dist/{chunk-I22IZYDI.js → chunk-DZ4QOIRY.js} +2 -2
  66. package/dist/{chunk-EXZ7VLRY.js → chunk-E3R6TJ5T.js} +2 -2
  67. package/dist/chunk-E4DP45YU.js +3 -0
  68. package/dist/{chunk-PUVNH4PO.js → chunk-E5U6N5WI.js} +2 -2
  69. package/dist/chunk-E7T22WET.js +21 -0
  70. package/dist/{chunk-QEOWONKY.js → chunk-ED7ZAZ5V.js} +2 -2
  71. package/dist/{chunk-RCIGX23V.js → chunk-EDMG5CSO.js} +2 -2
  72. package/dist/{chunk-IHSLIIL3.js → chunk-EOSUV7H5.js} +2 -2
  73. package/dist/{chunk-FQTIFWLR.js → chunk-ESWVTSHU.js} +2 -2
  74. package/dist/{chunk-6VREELBC.js → chunk-ETZBIG6K.js} +2 -2
  75. package/dist/chunk-EYSJHKX6.js +3 -0
  76. package/dist/{chunk-Q23IMHXS.js → chunk-F4AGM7ZE.js} +37 -37
  77. package/dist/{chunk-FTTV7IRX.js → chunk-FPUJRBHL.js} +50 -50
  78. package/dist/{chunk-CCIYWXX6.js → chunk-G2UU6PQP.js} +2 -2
  79. package/dist/{chunk-C6WKPKCF.js → chunk-G3KRXNNT.js} +2 -2
  80. package/dist/{chunk-TEANKHUU.js → chunk-G3ZBP72R.js} +2 -2
  81. package/dist/{chunk-NBCQZSGR.js → chunk-GC4I33OD.js} +2 -2
  82. package/dist/{chunk-NDKOVQFG.js → chunk-GLXEWYQY.js} +2 -2
  83. package/dist/{chunk-AEXQYQD7.js → chunk-GRHNPFHT.js} +2 -2
  84. package/dist/{chunk-NBZKSTXP.js → chunk-GWESWURK.js} +2 -2
  85. package/dist/{chunk-Q3ZCQY2Y.js → chunk-GXOFPAIR.js} +2 -2
  86. package/dist/{chunk-USOAJHY7.js → chunk-H4FGIFEU.js} +2 -2
  87. package/dist/{chunk-LKUTSP4G.js → chunk-HOGS6JFP.js} +2 -2
  88. package/dist/{chunk-UQE4XFSA.js → chunk-HSJLK5MC.js} +2 -2
  89. package/dist/{chunk-BWL3PMPT.js → chunk-HTPEUJ42.js} +2 -2
  90. package/dist/{chunk-3RR2K7EZ.js → chunk-IBPXUGJV.js} +2 -2
  91. package/dist/{chunk-BFBIMTCJ.js → chunk-ITA3N7G6.js} +2 -2
  92. package/dist/chunk-JG5OWAEB.js +22 -0
  93. package/dist/{chunk-2PRONPAS.js → chunk-JGJKRTTB.js} +2 -2
  94. package/dist/{chunk-TJWVT4DO.js → chunk-JGXLB7PR.js} +2 -2
  95. package/dist/{chunk-K7JLSGCJ.js → chunk-JKUF2UG6.js} +3 -3
  96. package/dist/{chunk-CIYA2KZN.js → chunk-JOYASZRF.js} +2 -2
  97. package/dist/{chunk-U7NUXDQO.js → chunk-K3PFL5QQ.js} +2 -2
  98. package/dist/{chunk-WK2IQJPK.js → chunk-KAXBWTSX.js} +2 -2
  99. package/dist/{chunk-5ZI2PPI7.js → chunk-KHHAGHAW.js} +2 -2
  100. package/dist/{chunk-UW6KD57C.js → chunk-KJLUQVBG.js} +2 -2
  101. package/dist/{chunk-WWCV4E6J.js → chunk-KOVUXHIZ.js} +2 -2
  102. package/dist/chunk-KPMMOAV5.js +4 -0
  103. package/dist/{chunk-GDHWOA57.js → chunk-LKJZNGMA.js} +2 -2
  104. package/dist/{chunk-3VJ3OCRE.js → chunk-LMPOC372.js} +2 -2
  105. package/dist/{chunk-F3QSL4W2.js → chunk-LTPNP6D5.js} +2 -2
  106. package/dist/{chunk-MVRGB4KJ.js → chunk-M3IBH6C3.js} +9 -9
  107. package/dist/{chunk-PHNCEUXX.js → chunk-MAGBSB6E.js} +2 -2
  108. package/dist/{chunk-QMOZZ2VX.js → chunk-MFMHD36E.js} +2 -2
  109. package/dist/{chunk-LMTSB3TB.js → chunk-MJX2J5QE.js} +2 -2
  110. package/dist/{chunk-PTQPPPG2.js → chunk-N26LGGSF.js} +2 -2
  111. package/dist/{chunk-J7AMBVWF.js → chunk-NB2DAVPP.js} +2 -2
  112. package/dist/{chunk-JYI7CV25.js → chunk-NJDXNYLG.js} +2 -2
  113. package/dist/{chunk-BRQL7AFJ.js → chunk-NMKQOIYZ.js} +2 -2
  114. package/dist/{chunk-ICUL7XRT.js → chunk-NRNVMB2R.js} +2 -2
  115. package/dist/{chunk-DDN2F6GB.js → chunk-O5BWFNIH.js} +2 -2
  116. package/dist/{chunk-HVFB3PME.js → chunk-O7PCDZ5B.js} +2 -2
  117. package/dist/{chunk-KPZGTB2O.js → chunk-OAJYNPRU.js} +2 -2
  118. package/dist/{chunk-2EDX3JT5.js → chunk-OFUC6R46.js} +2 -2
  119. package/dist/chunk-OSZ7PW5K.js +5 -0
  120. package/dist/{chunk-B3UYV66Z.js → chunk-OZ2M2X7A.js} +2 -2
  121. package/dist/{chunk-6O3KXIDL.js → chunk-OZI44VCR.js} +2 -2
  122. package/dist/{chunk-XN3EKMLI.js → chunk-PCKIKOUA.js} +2 -2
  123. package/dist/{chunk-NCJILOAK.js → chunk-PFMQRHC6.js} +2 -2
  124. package/dist/chunk-PVKSZBX5.js +82 -0
  125. package/dist/{chunk-NEWHKGVD.js → chunk-QANCT4MO.js} +2 -2
  126. package/dist/{chunk-ZNH33XIB.js → chunk-QEWN7BLP.js} +2 -2
  127. package/dist/{chunk-OQUCBKOI.js → chunk-QFJ46F6F.js} +2 -2
  128. package/dist/{chunk-2E6OUPCF.js → chunk-QPQWR6CW.js} +2 -2
  129. package/dist/{chunk-YTJHCGYB.js → chunk-QX4HDF2I.js} +2 -2
  130. package/dist/{chunk-J3GLP7Q5.js → chunk-R2F2CTBA.js} +2 -2
  131. package/dist/{chunk-2OMXFE64.js → chunk-R7PXHYMY.js} +2 -2
  132. package/dist/{chunk-F74LZWCE.js → chunk-RGBZDOUO.js} +2 -2
  133. package/dist/{chunk-362QOSFD.js → chunk-RNPG5P4P.js} +2 -2
  134. package/dist/{chunk-D62CTZX6.js → chunk-RS6UYNEP.js} +2 -2
  135. package/dist/{chunk-VGWZ4MOY.js → chunk-RVBRPBLQ.js} +2 -2
  136. package/dist/{chunk-5IZRKWTZ.js → chunk-RWAZCEJD.js} +2 -2
  137. package/dist/{chunk-ZQ62NNKN.js → chunk-RWDIONS7.js} +2 -2
  138. package/dist/{chunk-HQA7EBSK.js → chunk-S3CJYDXP.js} +2 -2
  139. package/dist/{chunk-GL6UTNUB.js → chunk-S6UTKCBT.js} +2 -2
  140. package/dist/chunk-SLLFJXTW.js +27 -0
  141. package/dist/{chunk-TOTWJZIX.js → chunk-T3KTMLQT.js} +2 -2
  142. package/dist/{chunk-67VJAYVR.js → chunk-TB575ZGO.js} +2 -2
  143. package/dist/{chunk-YHPG3S2U.js → chunk-TG4GMU73.js} +2 -2
  144. package/dist/{chunk-CVHOQONG.js → chunk-THKM7OXM.js} +2 -2
  145. package/dist/{chunk-GVAF222T.js → chunk-TNLOX4TN.js} +2 -2
  146. package/dist/{chunk-HENP2O4A.js → chunk-UHFZDQZJ.js} +2 -2
  147. package/dist/{chunk-YT4DVWUV.js → chunk-UUMAM5LM.js} +2 -2
  148. package/dist/{chunk-JX6ZWDOS.js → chunk-UUT5P3V7.js} +2 -2
  149. package/dist/{chunk-Z6RL7XOE.js → chunk-VEPK6M5C.js} +2 -2
  150. package/dist/{chunk-C7OUW52M.js → chunk-VPCHKZ3I.js} +2 -2
  151. package/dist/{chunk-GIDCP7KV.js → chunk-VZY3XOBU.js} +2 -2
  152. package/dist/{chunk-XQAVQVIL.js → chunk-W6E6ME7G.js} +2 -2
  153. package/dist/{chunk-XQPPURLQ.js → chunk-WGYZBS5S.js} +2 -2
  154. package/dist/{chunk-GUFPEFBG.js → chunk-WUP24Q4U.js} +2 -2
  155. package/dist/chunk-WXUHXSLN.js +2 -0
  156. package/dist/{chunk-HINZQKSY.js → chunk-X4YZD2MP.js} +2 -2
  157. package/dist/chunk-XARPGCTL.js +2 -0
  158. package/dist/{chunk-5FWR5HLG.js → chunk-XDQ6QJF5.js} +20 -20
  159. package/dist/{chunk-JCMFBF4Z.js → chunk-XRH7R5SX.js} +2 -2
  160. package/dist/{chunk-BBP7HVBJ.js → chunk-XVJ2E7W7.js} +2 -2
  161. package/dist/{chunk-D53LWANR.js → chunk-Y7GFAU5N.js} +2 -2
  162. package/dist/{chunk-T6MQNNAC.js → chunk-YBDLHFZZ.js} +2 -2
  163. package/dist/{chunk-ZB4C5TTR.js → chunk-YI3CJPOY.js} +2 -2
  164. package/dist/chunk-YMAGXBLT.js +3 -0
  165. package/dist/{chunk-MZNMASFM.js → chunk-YRAGNEBZ.js} +2 -2
  166. package/dist/chunk-YXZAAQHZ.js +3 -0
  167. package/dist/chunk-Z2L5H2HF.js +3 -0
  168. package/dist/{chunk-JSNTHRLQ.js → chunk-ZHK7TVAJ.js} +2 -2
  169. package/dist/chunk-ZJNV27DZ.js +4 -0
  170. package/dist/{chunk-GQLDYCWS.js → chunk-ZQ6GAIUV.js} +2 -2
  171. package/dist/{chunk-TPO7XC5Z.js → chunk-ZQE2QYAC.js} +2 -2
  172. package/dist/chunk-ZUQ2MDFT.js +2 -0
  173. package/dist/cli-context-4R2LREXQ.js +3 -0
  174. package/dist/cli-context-6X7JYARX.js +2 -0
  175. package/dist/cli-failure-RECEHOM2.js +3 -0
  176. package/dist/cli-program-MXA3WTAO.js +7 -0
  177. package/dist/cli.js +1 -1
  178. package/dist/{code-viewer-VHLBLIUM.js → code-viewer-C6HE4DFC.js} +2 -2
  179. package/dist/{code-viewer-KIXEYQNJ.js → code-viewer-XHSSAMBX.js} +2 -2
  180. package/dist/{command-descriptors-YCLATF5I.js → command-descriptors-NWW34Z54.js} +171 -171
  181. package/dist/{command-descriptors-F5P2V3NW.js → command-descriptors-XHK3PK2I.js} +116 -116
  182. package/dist/{command-panels-SZONPMLJ.js → command-panels-OXMCJ2QZ.js} +2 -2
  183. package/dist/direct-navigation-236VXYBZ.js +3 -0
  184. package/dist/direct-navigation-36YSILY6.js +2 -0
  185. package/dist/index.js +1 -1
  186. package/dist/invocation-command-descriptors-35JULLNR.js +3 -0
  187. package/dist/invocation-command-descriptors-FEWSFUO2.js +2 -0
  188. package/dist/output-continuation-command-MJBVH3A5.js +2 -0
  189. package/dist/output-continuation-command-TBXIOPHQ.js +3 -0
  190. package/dist/project-reindex-5TCGOVSK.js +2 -0
  191. package/dist/project-reindex-BUNTSYKM.js +3 -0
  192. package/dist/queries/affected.js +1 -1
  193. package/dist/queries/anchors.js +1 -1
  194. package/dist/queries/architecture.js +1 -1
  195. package/dist/queries/bottlenecks.js +1 -1
  196. package/dist/queries/by-kind.js +1 -1
  197. package/dist/queries/call-graph.js +1 -1
  198. package/dist/queries/change-surface.js +1 -1
  199. package/dist/queries/cleanup-plan.js +1 -1
  200. package/dist/queries/co-change.js +1 -1
  201. package/dist/queries/code.js +1 -1
  202. package/dist/queries/complexity-hotspots.js +1 -1
  203. package/dist/queries/complexity.js +1 -1
  204. package/dist/queries/context.js +1 -1
  205. package/dist/queries/convergence.js +1 -1
  206. package/dist/queries/coupling.js +1 -1
  207. package/dist/queries/cycles.js +1 -1
  208. package/dist/queries/dataflow.js +1 -1
  209. package/dist/queries/dead.js +1 -1
  210. package/dist/queries/decorative-checkers.js +1 -1
  211. package/dist/queries/deep-chains.js +1 -1
  212. package/dist/queries/dependence-slice.js +1 -1
  213. package/dist/queries/dependency-depth.js +1 -1
  214. package/dist/queries/deps.js +1 -1
  215. package/dist/queries/diff-impact.js +1 -1
  216. package/dist/queries/doc-drift.js +1 -1
  217. package/dist/queries/drift.js +1 -1
  218. package/dist/queries/duplicate-bodies.js +1 -1
  219. package/dist/queries/entry-map.js +1 -1
  220. package/dist/queries/evidence.js +1 -1
  221. package/dist/queries/extract-candidates.js +1 -1
  222. package/dist/queries/fan.js +1 -1
  223. package/dist/queries/files.js +1 -1
  224. package/dist/queries/health.js +1 -1
  225. package/dist/queries/hierarchy.js +1 -1
  226. package/dist/queries/hotspots.js +1 -1
  227. package/dist/queries/imports.js +1 -1
  228. package/dist/queries/incomplete-migration.js +1 -1
  229. package/dist/queries/index.js +1 -1
  230. package/dist/queries/isolated.js +1 -1
  231. package/dist/queries/locality-candidates.js +1 -1
  232. package/dist/queries/members.js +1 -1
  233. package/dist/queries/methods.js +1 -1
  234. package/dist/queries/not-implemented.js +1 -1
  235. package/dist/queries/outline.js +1 -1
  236. package/dist/queries/passthrough-candidates.js +1 -1
  237. package/dist/queries/plan-context.js +1 -1
  238. package/dist/queries/react-component-duplicates.js +1 -1
  239. package/dist/queries/react-hook-candidates.js +1 -1
  240. package/dist/queries/react-large-component-pressure.js +1 -1
  241. package/dist/queries/recent-duplicates.js +1 -1
  242. package/dist/queries/redundant-reexports.js +1 -1
  243. package/dist/queries/reference-neighborhood.js +1 -1
  244. package/dist/queries/reference-reachability.js +1 -1
  245. package/dist/queries/refs.js +1 -1
  246. package/dist/queries/self-audit.js +1 -1
  247. package/dist/queries/similar-chains.js +1 -1
  248. package/dist/queries/similar-files.js +1 -1
  249. package/dist/queries/similar-signatures.js +1 -1
  250. package/dist/queries/similar.js +1 -1
  251. package/dist/queries/slice.js +1 -1
  252. package/dist/queries/source-inspection.js +1 -1
  253. package/dist/queries/source-search.js +1 -1
  254. package/dist/queries/stale-abstractions.js +1 -1
  255. package/dist/queries/surface.js +1 -1
  256. package/dist/queries/symbols.js +1 -1
  257. package/dist/queries/system-map.js +1 -1
  258. package/dist/queries/system.js +1 -1
  259. package/dist/queries/test-quality.js +1 -1
  260. package/dist/queries/trace.js +1 -1
  261. package/dist/queries/twin-ab.js +1 -1
  262. package/dist/queries/twin-drift.js +1 -1
  263. package/dist/queries/unused-imports.js +1 -1
  264. package/dist/queries/unused-params.js +1 -1
  265. package/dist/queries/value-flow.js +1 -1
  266. package/dist/queries/vue-component-duplicates.js +1 -1
  267. package/dist/queries/vue-composable-candidates.js +1 -1
  268. package/dist/queries/vue-large-view-pressure.js +1 -1
  269. package/dist/queries/wrapper-candidates.js +1 -1
  270. package/dist/reindex-worker.js +1 -1
  271. package/dist/reindex.js +30 -30
  272. package/dist/runtime.js +1 -1
  273. package/dist/rust-semantic-session-server.js +1 -1
  274. package/dist/rust-semantic-session-worker.js +1 -1
  275. package/dist/rust-semantic-worker.js +1 -1
  276. package/dist/sentinel-ensure-command-3MZCLPQY.js +2 -0
  277. package/dist/sentinel-ensure-command-LEWHIRLL.js +3 -0
  278. package/dist/sentinel-worker.js +1 -1
  279. package/dist/typescript-mailbox-worker.js +1 -1
  280. package/dist/watch-server.js +6 -6
  281. package/docs/COMMAND_REFERENCE.md +2 -2
  282. package/docs/SECURITY_MODEL.md +3 -0
  283. package/package.json +1 -1
  284. package/skills/codebaseiq/SKILL.md +15 -3
  285. package/dist/chunk-23C5AD3B.js +0 -2
  286. package/dist/chunk-2I2UHZET.js +0 -2
  287. package/dist/chunk-5IC2WZAL.js +0 -22
  288. package/dist/chunk-5T44HG5Y.js +0 -88
  289. package/dist/chunk-6JMAVFL4.js +0 -3
  290. package/dist/chunk-6WAPPQ5F.js +0 -82
  291. package/dist/chunk-7UCDGXRW.js +0 -8
  292. package/dist/chunk-AQI4N64O.js +0 -22
  293. package/dist/chunk-DAKIGMIK.js +0 -21
  294. package/dist/chunk-DUKHVPU5.js +0 -4
  295. package/dist/chunk-DVWO7RBC.js +0 -2
  296. package/dist/chunk-FH5WG4LE.js +0 -2
  297. package/dist/chunk-GQXXOS55.js +0 -2
  298. package/dist/chunk-GWYZVVKY.js +0 -21
  299. package/dist/chunk-JFIA2JI3.js +0 -3
  300. package/dist/chunk-JLZLLLW5.js +0 -3
  301. package/dist/chunk-MEUHIDI3.js +0 -7
  302. package/dist/chunk-OFGOOL6U.js +0 -3
  303. package/dist/chunk-P4NVCOM7.js +0 -2
  304. package/dist/chunk-SMDIEDM4.js +0 -27
  305. package/dist/chunk-SX72EVMY.js +0 -3
  306. package/dist/chunk-T5X7DK6C.js +0 -3
  307. package/dist/chunk-T75DS2E6.js +0 -21
  308. package/dist/chunk-TJBOJUVN.js +0 -3
  309. package/dist/chunk-UC2FD2PS.js +0 -4
  310. package/dist/chunk-UQYQBLJX.js +0 -5
  311. package/dist/chunk-Z35GOVEH.js +0 -2
  312. package/dist/cli-context-FJL2JHOE.js +0 -3
  313. package/dist/cli-context-PQNWHMCQ.js +0 -2
  314. package/dist/cli-program-UO7PZD6V.js +0 -7
  315. package/dist/direct-navigation-4XJTXIDT.js +0 -2
  316. package/dist/direct-navigation-J5MVYYAD.js +0 -3
  317. package/dist/invocation-command-descriptors-RWV4VAI4.js +0 -2
  318. package/dist/invocation-command-descriptors-U76PN7IY.js +0 -3
  319. package/dist/output-continuation-command-BL25S26S.js +0 -3
  320. package/dist/output-continuation-command-BTETTXEC.js +0 -2
  321. package/dist/project-reindex-CRJU3IFG.js +0 -2
  322. package/dist/project-reindex-TQFCOA2O.js +0 -3
  323. package/dist/sentinel-ensure-command-OSWGCFFL.js +0 -3
  324. package/dist/sentinel-ensure-command-SPW7XQLB.js +0 -2
package/CHANGELOG.md CHANGED
@@ -9,6 +9,86 @@ names are separate packages, and no `scip-query` version is superseded in place.
9
9
  Entries at 0.20.0 and below record the predecessor package's history, retained
10
10
  for continuity; they document releases of `scip-query`, not of `codebaseiq`.
11
11
 
12
+ ## [0.4.0] — 2026-11-07
13
+
14
+ ### Added
15
+
16
+ - **`CODEBASEIQ_READ_ONLY=1` for agents whose sandbox cannot write the cache.**
17
+ A Codex delegate in a workspace-write sandbox failed its first query with
18
+ `EPERM` creating `~/.cache/codebaseiq/projects/<hash>` and fell back to
19
+ grep for an 80-minute refactor. Read-only mode answers from an index that
20
+ already exists and writes nothing: no cache adoption, generation lease,
21
+ shared evidence database, hash cache, update check, watch service, daemon,
22
+ or reindex. It warns when the index is older than the working tree.
23
+ - **`CODEBASEIQ_ALLOW_STALE=1` answers during a refactor instead of
24
+ reindexing.** Every edit makes the index stale, and a stale index otherwise
25
+ waits for a reindex before answering, which takes many minutes on a large
26
+ Rust crate. With this set (read-only mode implies it) the query answers from
27
+ the last good index and appends a `STALE OVERLAY` section: cited files
28
+ that changed since indexing are labelled stale, and the changed files the
29
+ result does not cite are listed as places where callers or references may be
30
+ missing. JSON output keeps stdout clean and reports the overlay on stderr.
31
+ - **New and dirty worktrees fork a shared baseline instead of indexing from
32
+ scratch.** A worktree with no index of its own forks the shared generation of
33
+ HEAD or its nearest first-parent ancestor when stale answers are accepted.
34
+ On VegaAssistant the first query in a dirty agent worktree took 47 s instead
35
+ of a 966 s full index, and 5 s after that
36
+ (`docs/benchmarks/2026-11-07-dirty-worktree-baseline-fork.md`).
37
+ - **`codebaseiq reindex --base <ref>` publishes that baseline.** Only a clean
38
+ checkout publishes a shared generation, so a repository whose checkouts are
39
+ never clean had none. This indexes the ref in a temporary clean worktree,
40
+ publishes it, and removes the worktree and its private cache.
41
+
42
+ ### Changed
43
+
44
+ - **`evidence` no longer requires `--depth` and `--max-edges`.** They default
45
+ to 2 and 32, the values the command's own examples used, so an agent passes
46
+ them only to widen or narrow a projection. `--edge` and `--direction` are
47
+ still required: they decide what the answer means, and the CLI does not
48
+ infer them. Coverage output is unchanged, so a default bound still reports
49
+ what it cut and how to recover it.
50
+ - **The AGENTS.md block that `setup` writes is a quarter of its former size.**
51
+ It was 1,370 words loaded into every agent session, and most of it repeated
52
+ the installed `codebaseiq` skill. It now says when to use codebaseiq, gives
53
+ a question-to-command table that starts with `refs`, `call-graph`,
54
+ `affected`, and `value-flow`, states the `evidence` contract in one line,
55
+ and points at the skill for the operating rules. The rules it no longer
56
+ repeats (coverage reading, edge semantics, state preservation, session
57
+ receipts, output format) moved into `skills/codebaseiq/SKILL.md`. Re-run
58
+ `codebaseiq setup` to replace the block in an existing repository.
59
+
60
+ ### Fixes
61
+
62
+ - **`npm run docs:commands` updates skill command tables on Windows.** The
63
+ frontmatter parser required LF line endings, so on an autocrlf checkout it
64
+ found no `commands:` list and left every skill's generated table stale.
65
+ - **Cache permission failures print one line that names the fix.** An
66
+ `EPERM`, `EACCES`, `ENOTDIR`, or `EROFS` on the cache, or a
67
+ `CODEBASEIQ_CACHE_DIR` that another project owns, used to crash with an
68
+ uncaught stack that printed a line of minified source. It now prints one
69
+ `error:` line that names `CODEBASEIQ_READ_ONLY` or `CODEBASEIQ_CACHE_DIR`.
70
+ - **Python indexes in a repository with no commits.** scip-python fell back
71
+ to `git rev-parse HEAD` for its project version and crashed; it now gets a
72
+ fixed version, which also keeps Python symbols stable across commits.
73
+ - **A failed indexer keeps the cause.** Its reason kept only the "exited
74
+ with status N:" line and dropped the stderr beneath it; it now keeps the
75
+ first error line from stderr.
76
+
77
+ ## [0.3.1] — 2026-10-19
78
+
79
+ ### Fixes
80
+
81
+ - **Large Rust workspaces can finish indexing.** Each language indexer was
82
+ stopped after 10 minutes, and rust-analyzer on a 15-crate Tauri workspace
83
+ had grown past that, so every refresh failed and `codebaseiq view` could not
84
+ prepare fresh evidence. The default limit is now 30 minutes.
85
+ `CODEBASEIQ_INDEXER_TIMEOUT_MS` still overrides it.
86
+ - **Stopping a timed-out indexer on Windows no longer reports a cleanup
87
+ failure.** `taskkill /T /F` had one second to end the whole process tree,
88
+ which is too short for rust-analyzer with its cargo, rustc, and proc-macro
89
+ children, so the error ended with "Process-tree cleanup failed: spawnSync
90
+ taskkill.exe ETIMEDOUT". It now has ten seconds.
91
+
12
92
  ## [0.3.0] — 2026-10-18
13
93
 
14
94
  ### Changed (codebaseiq writes its own SQLite index)
@@ -1,2 +1,2 @@
1
- import{e as t}from"./chunk-YTJHCGYB.js";import"./chunk-YUKYB54I.js";import"./chunk-XQAVQVIL.js";import"./chunk-YT4DVWUV.js";import"./chunk-RCIGX23V.js";import"./chunk-UQYQBLJX.js";import{writeFileSync as s}from"fs";import{workerData as o}from"worker_threads";var r=o;try{let e=t({projectRoot:r.projectRoot,dbPath:r.dbPath,tsconfig:r.tsconfig,vueFiles:r.vueFiles,tasks:r.tasks});s(r.resultPath,JSON.stringify({version:1,runId:r.runId,workerId:r.workerId,taskIds:r.taskIds,ok:!0,result:e}))}catch(e){s(r.resultPath,JSON.stringify({version:1,runId:r.runId,workerId:r.workerId,taskIds:r.taskIds,ok:!1,error:e instanceof Error?e.message:String(e)}))}
1
+ import{e as t}from"./chunk-QX4HDF2I.js";import"./chunk-YUKYB54I.js";import"./chunk-W6E6ME7G.js";import"./chunk-UUMAM5LM.js";import"./chunk-EDMG5CSO.js";import"./chunk-C3PPB2T5.js";import{writeFileSync as s}from"fs";import{workerData as o}from"worker_threads";var r=o;try{let e=t({projectRoot:r.projectRoot,dbPath:r.dbPath,tsconfig:r.tsconfig,vueFiles:r.vueFiles,tasks:r.tasks});s(r.resultPath,JSON.stringify({version:1,runId:r.runId,workerId:r.workerId,taskIds:r.taskIds,ok:!0,result:e}))}catch(e){s(r.resultPath,JSON.stringify({version:1,runId:r.runId,workerId:r.workerId,taskIds:r.taskIds,ok:!1,error:e instanceof Error?e.message:String(e)}))}
2
2
  //# sourceMappingURL=augment-vue-worker.js.map
@@ -1,4 +1,4 @@
1
- import{f as L,g as A}from"./chunk-SX72EVMY.js";import{a as _,b as S,d as b}from"./chunk-3LCDIREB.js";import{v as F}from"./chunk-UC2FD2PS.js";import{mkdtempSync as O}from"fs";import{win32 as q}from"path";var Q=259,Z=8,ee=6,y="\\\\?\\",C=`${y}UNC\\`;function k(e,n,t){if(t!=="win32"||e.startsWith(y))return;let a=q.resolve(e);if(!(a.length+n<=Q))return a.startsWith("\\\\")?`${C}${a.slice(2)}`:`${y}${a}`}function N(e,n=process.platform){return e===""||e===":memory:"?e:k(e,Z,n)??e}function _e(e,n=process.platform){let t=k(e,ee,n);if(!t)return O(e);let a=O(t);return a.startsWith(C)?`\\\\${a.slice(C.length)}`:a.slice(y.length)}var I=[],x=[];function m(e){e.groups.length>0&&I.push(e)}function j(e){x.push(e)}function be(e){let n=[];for(let t of x)try{t.close(e)}catch(a){n.push(a)}if(n.length===1)throw n[0];if(n.length>1)throw new AggregateError(n,"Multiple database-owned resources failed to close.")}function Ce(e,n){let t=new Set(n.groups);for(let a of I)a.groups.some(r=>t.has(r))&&(n.file!==void 0&&a.clearFile?a.clearFile(e,n.file):a.clearAll(e))}function M(){let e=new WeakMap;return{cache:e,ensure(n){let t=e.get(n);return t||(t=new Map,e.set(n,t)),t}}}function h(e,n){let{cache:t,ensure:a}=M(),r={get(i,s,o){let c=a(i);if(c.has(s))return c.get(s);let d=o();return c.set(s,d),d},invalidate(i,s){t.get(i)?.delete(s)},invalidateAll(i){t.delete(i)},size(i){return t.get(i)?.size??0}};return m({name:e,groups:n.clearGroups,clearAll:i=>r.invalidateAll(i),clearFile:(i,s)=>r.invalidate(i,s)}),r}function Pe(e,n){let t=new WeakMap,a={get(r,i){let s=t.get(r);if(s)return s.value;let o=i();return t.set(r,{value:o}),o},invalidate(r){t.delete(r)},has(r){return t.has(r)}};return m({name:e,groups:n.clearGroups,clearAll:r=>a.invalidate(r)}),a}var te={clearGroups:["whole-project","source-file"]};function we(e){return ne(e,te)}function ne(e,n){let{cache:t,ensure:a}=M(),r={get(i,s,o,c){let d=a(i),T=d.get(s);if(T&&T.source===o)return T.value;let w=c();return d.set(s,{source:o,value:w}),w},invalidate(i,s){t.get(i)?.delete(s)},invalidateAll(i){t.delete(i)}};return m({name:e,groups:n.clearGroups,clearAll:i=>r.invalidateAll(i),clearFile:(i,s)=>r.invalidate(i,s)}),r}import{createHash as re}from"crypto";import{existsSync as Oe,mkdirSync as ae}from"fs";import{dirname as V,join as ie}from"path";import K from"better-sqlite3";var se="evidence.db";var oe=["source-facts","callable-units","definition-exclusions","doc-path-tokens","react-component-behavior-profiles"],R=new Set(oe);var Ke=512*1024*1024,ce=6e4,v=new WeakMap;j({name:"evidence-connections",close:X});var le=h("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),de=h("evidence-project-fingerprint",{clearGroups:["whole-project"]}),p="evidence-v1",f="version NOT LIKE 'evidence-%'";function H(e){return re("sha256").update(e).digest("hex")}function He(e,n,t){return le.get(e,n,()=>H(t))}function U(e){return de.get(e,"current",()=>{try{if(!e.generation.metadataRaw)return null;let n=F(e.generation.metadataRaw);if(n.kind!=="legacy"&&n.kind!=="supported"||!n.capabilities.usableForEvidenceCache)return null;let t=n.metadata,a=[...t.indexedLanguages??[]].sort();return H(JSON.stringify({fingerprint:t.fingerprint,indexedLanguages:a,status:t.status}))}catch(n){return E("project fingerprint unavailable",n),null}})}function E(e,n){process.env.CODEBASEIQ_DEBUG&&console.error(`evidence-cache: ${e}: ${n instanceof Error?n.message:String(n)}`)}function u(e){if(v.has(e))return v.get(e)??null;let n=null;try{let t=new K(N(ie(V(e.config.dbPath),se)));t.pragma("journal_mode = WAL"),t.pragma("busy_timeout = 5000"),t.pragma("synchronous = NORMAL"),t.exec(`
1
+ import{f as O,g as A}from"./chunk-YMAGXBLT.js";import{a as _,b as S,d as b}from"./chunk-3LCDIREB.js";import{S as L,v as F}from"./chunk-6I55VYFG.js";import{mkdtempSync as k}from"fs";import{win32 as Q}from"path";var Z=259,ee=8,te=6,y="\\\\?\\",C=`${y}UNC\\`;function I(e,n,t){if(t!=="win32"||e.startsWith(y))return;let a=Q.resolve(e);if(!(a.length+n<=Z))return a.startsWith("\\\\")?`${C}${a.slice(2)}`:`${y}${a}`}function N(e,n=process.platform){return e===""||e===":memory:"?e:I(e,ee,n)??e}function Se(e,n=process.platform){let t=I(e,te,n);if(!t)return k(e);let a=k(t);return a.startsWith(C)?`\\\\${a.slice(C.length)}`:a.slice(y.length)}var x=[],j=[];function m(e){e.groups.length>0&&x.push(e)}function M(e){j.push(e)}function Ce(e){let n=[];for(let t of j)try{t.close(e)}catch(a){n.push(a)}if(n.length===1)throw n[0];if(n.length>1)throw new AggregateError(n,"Multiple database-owned resources failed to close.")}function Ne(e,n){let t=new Set(n.groups);for(let a of x)a.groups.some(r=>t.has(r))&&(n.file!==void 0&&a.clearFile?a.clearFile(e,n.file):a.clearAll(e))}function V(){let e=new WeakMap;return{cache:e,ensure(n){let t=e.get(n);return t||(t=new Map,e.set(n,t)),t}}}function f(e,n){let{cache:t,ensure:a}=V(),r={get(i,s,o){let c=a(i);if(c.has(s))return c.get(s);let d=o();return c.set(s,d),d},invalidate(i,s){t.get(i)?.delete(s)},invalidateAll(i){t.delete(i)},size(i){return t.get(i)?.size??0}};return m({name:e,groups:n.clearGroups,clearAll:i=>r.invalidateAll(i),clearFile:(i,s)=>r.invalidate(i,s)}),r}function we(e,n){let t=new WeakMap,a={get(r,i){let s=t.get(r);if(s)return s.value;let o=i();return t.set(r,{value:o}),o},invalidate(r){t.delete(r)},has(r){return t.has(r)}};return m({name:e,groups:n.clearGroups,clearAll:r=>a.invalidate(r)}),a}var ne={clearGroups:["whole-project","source-file"]};function Fe(e){return re(e,ne)}function re(e,n){let{cache:t,ensure:a}=V(),r={get(i,s,o,c){let d=a(i),T=d.get(s);if(T&&T.source===o)return T.value;let w=c();return d.set(s,{source:o,value:w}),w},invalidate(i,s){t.get(i)?.delete(s)},invalidateAll(i){t.delete(i)}};return m({name:e,groups:n.clearGroups,clearAll:i=>r.invalidateAll(i),clearFile:(i,s)=>r.invalidate(i,s)}),r}import{createHash as ae}from"crypto";import{existsSync as ke,mkdirSync as ie}from"fs";import{dirname as K,join as se}from"path";import H from"better-sqlite3";var oe="evidence.db";var ce=["source-facts","callable-units","definition-exclusions","doc-path-tokens","react-component-behavior-profiles"],R=new Set(ce);var Ue=512*1024*1024,le=6e4,E=new WeakMap;M({name:"evidence-connections",close:W});var de=f("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),pe=f("evidence-project-fingerprint",{clearGroups:["whole-project"]}),p="evidence-v1",v="version NOT LIKE 'evidence-%'";function U(e){return ae("sha256").update(e).digest("hex")}function Xe(e,n,t){return de.get(e,n,()=>U(t))}function X(e){return pe.get(e,"current",()=>{try{if(!e.generation.metadataRaw)return null;let n=F(e.generation.metadataRaw);if(n.kind!=="legacy"&&n.kind!=="supported"||!n.capabilities.usableForEvidenceCache)return null;let t=n.metadata,a=[...t.indexedLanguages??[]].sort();return U(JSON.stringify({fingerprint:t.fingerprint,indexedLanguages:a,status:t.status}))}catch(n){return h("project fingerprint unavailable",n),null}})}function h(e,n){process.env.CODEBASEIQ_DEBUG&&console.error(`evidence-cache: ${e}: ${n instanceof Error?n.message:String(n)}`)}function u(e){if(E.has(e))return E.get(e)??null;if(L())return E.set(e,null),null;let n=null;try{let t=new H(N(se(K(e.config.dbPath),oe)));t.pragma("journal_mode = WAL"),t.pragma("busy_timeout = 5000"),t.pragma("synchronous = NORMAL"),t.exec(`
2
2
  CREATE TABLE IF NOT EXISTS file_evidence (
3
3
  kind TEXT NOT NULL,
4
4
  relative_path TEXT NOT NULL,
@@ -32,29 +32,29 @@ import{f as L,g as A}from"./chunk-SX72EVMY.js";import{a as _,b as S,d as b}from"
32
32
  payload TEXT NOT NULL,
33
33
  PRIMARY KEY (relative_path, symbol)
34
34
  );
35
- `),n={evidence:t,shared:pe(e.config.sharedEvidenceDbPath),readFileEvidence:t.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),readLegacyFileEvidence:t.prepare(`SELECT payload FROM file_evidence
36
- WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${f}
35
+ `),n={evidence:t,shared:ue(e.config.sharedEvidenceDbPath),readFileEvidence:t.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),readLegacyFileEvidence:t.prepare(`SELECT payload FROM file_evidence
36
+ WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${v}
37
37
  ORDER BY version DESC
38
38
  LIMIT 1`),writeFileEvidence:t.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readProjectEvidence:t.prepare("SELECT payload FROM project_evidence WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND version = ?"),readLegacyProjectEvidence:t.prepare(`SELECT payload FROM project_evidence
39
- WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${f}
39
+ WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${v}
40
40
  ORDER BY version DESC
41
41
  LIMIT 1`),writeProjectEvidence:t.prepare("INSERT OR REPLACE INTO project_evidence (kind, cache_key, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:t.prepare(`SELECT payload FROM semantic_callees
42
42
  WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCallees:t.prepare(`SELECT payload FROM semantic_callees
43
- WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${f}
43
+ WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${v}
44
44
  ORDER BY version DESC
45
45
  LIMIT 1`),readCalleesForFile:t.prepare(`SELECT symbol, payload FROM semantic_callees
46
46
  WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCalleesForFile:t.prepare(`SELECT symbol, payload FROM semantic_callees
47
- WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND ${f}
47
+ WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND ${v}
48
48
  ORDER BY symbol, version DESC`),writeCallees:t.prepare(`INSERT OR REPLACE INTO semantic_callees
49
49
  (relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:t.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:t.prepare(`SELECT payload FROM semantic_references
50
50
  WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferences:t.prepare(`SELECT payload FROM semantic_references
51
- WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${f}
51
+ WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${v}
52
52
  ORDER BY version DESC
53
53
  LIMIT 1`),readReferencesForFile:t.prepare(`SELECT symbol, payload FROM semantic_references
54
54
  WHERE relative_path = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferencesForFile:t.prepare(`SELECT symbol, payload FROM semantic_references
55
- WHERE relative_path = ? AND project_fingerprint = ? AND ${f}
55
+ WHERE relative_path = ? AND project_fingerprint = ? AND ${v}
56
56
  ORDER BY symbol, version DESC`),writeReferences:t.prepare(`INSERT OR REPLACE INTO semantic_references
57
- (relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:t.prepare("DELETE FROM semantic_references WHERE relative_path = ? AND project_fingerprint != ?")}}catch(t){E("disabled (open failed)",t)}return v.set(e,n),n}function g(e,n,t){E(`disabled (${n})`,t);try{X(e)}catch(a){E("close failed while disabling",a)}v.set(e,null)}function X(e){let n=v.get(e);if(v.delete(e),!n)return;let t,a;try{n.shared?.evidence.close()}catch(r){t=r}try{n.evidence.close()}catch(r){a=r}if(t!==void 0&&a!==void 0)throw new AggregateError([t,a],"Shared and project evidence connections failed to close.");if(t!==void 0)throw t;if(a!==void 0)throw a}function pe(e){if(!e)return null;try{ae(V(e),{recursive:!0});let n=new K(N(e));return n.pragma("journal_mode = WAL"),n.pragma("busy_timeout = 250"),n.pragma("synchronous = NORMAL"),n.exec(`
57
+ (relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:t.prepare("DELETE FROM semantic_references WHERE relative_path = ? AND project_fingerprint != ?")}}catch(t){h("disabled (open failed)",t)}return E.set(e,n),n}function g(e,n,t){h(`disabled (${n})`,t);try{W(e)}catch(a){h("close failed while disabling",a)}E.set(e,null)}function W(e){let n=E.get(e);if(E.delete(e),!n)return;let t,a;try{n.shared?.evidence.close()}catch(r){t=r}try{n.evidence.close()}catch(r){a=r}if(t!==void 0&&a!==void 0)throw new AggregateError([t,a],"Shared and project evidence connections failed to close.");if(t!==void 0)throw t;if(a!==void 0)throw a}function ue(e){if(!e)return null;try{ie(K(e),{recursive:!0});let n=new H(N(e));return n.pragma("journal_mode = WAL"),n.pragma("busy_timeout = 250"),n.pragma("synchronous = NORMAL"),n.exec(`
58
58
  CREATE TABLE IF NOT EXISTS file_evidence (
59
59
  kind TEXT NOT NULL,
60
60
  relative_path TEXT NOT NULL,
@@ -72,6 +72,6 @@ import{f as L,g as A}from"./chunk-SX72EVMY.js";import{a as _,b as S,d as b}from"
72
72
  DO UPDATE SET payload = excluded.payload, last_accessed_at = excluded.last_accessed_at`),touchFileEvidence:n.prepare(`UPDATE file_evidence
73
73
  SET last_accessed_at = ?
74
74
  WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?
75
- AND last_accessed_at < ?`)}}catch(n){return E("shared cache disabled (open failed)",n),null}}function P(e,n,t){E(`shared cache disabled (${n})`,t);try{e.shared?.evidence.close()}catch{}e.shared=null}function W(e,n,t,a){let r=u(e);if(!r)return null;try{let i=r.readFileEvidence.get(n,t,a,p)??r.readLegacyFileEvidence.get(n,t,a);if(i?.payload!==void 0)return i.payload;if(!R.has(n)||!r.shared)return null;try{let s=r.shared.readFileEvidence.get(n,t,a,p);return s?.payload!==void 0&&ue(r.shared,n,t,a),s?.payload??null}catch(s){return P(r,"file_evidence read",s),null}}catch(i){return g(e,"file_evidence read",i),null}}function ue(e,n,t,a){let r=Date.now();try{e.touchFileEvidence.run(r,n,t,a,p,r-ce)}catch(i){E("shared file_evidence recency touch skipped",i)}}function B(e,n,t,a,r){let i=u(e);if(i)try{if(i.writeFileEvidence.run(n,t,a,p,r),R.has(n)&&i.shared)try{i.shared.writeFileEvidence.run(n,t,a,p,r,Date.now())}catch(s){P(i,"file_evidence write",s)}}catch(s){g(e,"file_evidence write",s)}}function $(e,n){if(n.length===0)return;let t=u(e);if(t)try{t.evidence.transaction(()=>{for(let r of n)t.writeFileEvidence.run(r.kind,r.relativePath,r.contentHash,p,r.payload)})();let a=n.filter(r=>R.has(r.kind));if(a.length>0&&t.shared)try{t.shared.evidence.transaction(()=>{for(let r of a)t.shared.writeFileEvidence.run(r.kind,r.relativePath,r.contentHash,p,r.payload,Date.now())})()}catch(r){P(t,"file_evidence batch write",r)}}catch(a){g(e,"file_evidence batch write",a)}}function G(e,n,t,a){let r=u(e);if(!r)return null;try{return(r.readProjectEvidence.get(n,t,a,p)??r.readLegacyProjectEvidence.get(n,t,a))?.payload??null}catch(i){return g(e,"project_evidence read",i),null}}function Y(e,n,t,a,r){let i=u(e);if(i)try{i.writeProjectEvidence.run(n,t,a,p,r)}catch(s){g(e,"project_evidence write",s)}}function Ue(e,n,t,a){let r=u(e);if(!r)return new Map;try{let i=r.readCalleesForFile.all(n,t,a,p),s=r.readLegacyCalleesForFile.all(n,t,a);return z([...s,...i])}catch(i){return g(e,"semantic_callees bulk read",i),new Map}}function Xe(e,n,t){let a=u(e);if(!a)return new Map;try{let r=a.readReferencesForFile.all(n,t,p),i=a.readLegacyReferencesForFile.all(n,t);return z([...i,...r])}catch(r){return g(e,"semantic_references bulk read",r),new Map}}function z(e){let n=new Map;for(let t of e)n.set(t.symbol,t.payload);return n}function We(e,n){if(n.length===0)return;let t=u(e);if(t)try{t.evidence.transaction(()=>{let a=new Set;for(let r of n){let i=`${r.relativePath}\0${r.contentHash}`;a.has(i)||(a.add(i),t.dropStaleCallees.run(r.relativePath,r.contentHash)),t.writeCallees.run(r.relativePath,r.symbol,r.contentHash,r.depsDigest,p,r.payload)}})()}catch(a){g(e,"semantic_callees write",a)}}function Be(e,n){if(n.length===0)return;let t=u(e);if(t)try{t.evidence.transaction(()=>{let a=new Set;for(let r of n){let i=`${r.relativePath}\0${r.projectFingerprint}`;a.has(i)||(a.add(i),t.dropStaleReferences.run(r.relativePath,r.projectFingerprint)),t.writeReferences.run(r.relativePath,r.symbol,r.projectFingerprint,p,r.payload)}})()}catch(a){g(e,"semantic_references write",a)}}function Ge(e){return typeof e=="object"&&e!==null}function Ye(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")?e:null}var ge=[l("source-facts",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/source-facts.ts"}),l("callable-units",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/source/callable-units.test.ts",owner:"src/source/facts/callable-units.ts"}),l("file-definitions",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/symbols/definition-catalog.ts"}),l("definition-exclusions",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/framework-patterns.ts"}),l("doc-path-tokens",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-products.test.ts",owner:"tests/storage/evidence-cache.test.ts"}),l("doc-path-evidence",{dependsOn:["content-hash","git-history","git-head","tool-version"],keyParts:["kind","relativePath","contentHash","trackedFiles","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/cleanup/doc-drift.ts"}),l("source-imports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),l("source-reexports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),l("source-fingerprints",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/definition-catalog.test.ts",owner:"src/queries/cleanup/similar.ts"}),l("consumer-file-usage",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/internal/consumer-evidence.ts"}),l("react-component-behavior-profiles",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/react-profile.ts"}),l("git-file-adds",{dependsOn:["git-head","git-history","tool-version"],keyParts:["kind","cacheKey","head","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/git-history.ts"}),l("typescript-reference-fragments",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-reference-fragments.test.ts",owner:"src/semantic/typescript/reference-fragment-shadow.ts"}),l("typescript-import-usage",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),l("typescript-signatures",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),D("file-dependency-graph",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","scope","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/file-dep-graph.test.ts",owner:"src/symbols/graph/file-dep-graph.ts"}),D("semantic-import-usage",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","relativePath","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),D("semantic-signatures",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","symbol","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),D("health-semantic-prewarm",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","scope","cliVersion","projectFingerprint","payloadVersion"],stalenessTest:"tests/runtime/cli-support.test.ts",owner:"src/runtime/cli-support.ts"})];function et(e){let n=new Map;return{kind:e.kind,read(t,a,r){let i=!1,s=0,o;if(_()){let c=U(t);if(c){let d=`${c}\0${a}\0${r}`;o=n.get(d),o||(o=S(["evidence-product-file-read-v1",e.kind,c,a,r]),n.set(d,o))}}return b("evidence-product.file.read",()=>{let c=W(t,e.kind,a,r);if(c===null)return null;s=c.length;try{let d=e.deserialize(c);return i=d!==null,d}catch{return null}},()=>({...o?{workIdentity:o,workOutcome:"computed"}:{},scope:"file",kind:e.kind,available:!0,hit:i,payloadBytes:s}))},write(t,a,r,i){B(t,e.kind,a,r,e.serialize(i))},writeBatch(t,a){$(t,a.map(r=>({kind:e.kind,relativePath:r.relativePath,contentHash:r.contentHash,payload:e.serialize(r.value)})))}}}function tt(e){let n=new Map;return{kind:e.kind,read(t,a,r){let i=!1,s=0,o;if(_()){let c=`${r}\0${a}`;o=n.get(c),o||(o=S(["evidence-product-project-read-v1",e.kind,r,a]),n.set(c,o))}return b("evidence-product.project.read",()=>{let c=G(t,e.kind,a,r);if(c===null)return null;s=c.length;try{let d=e.deserialize(c);return i=d!==null,d}catch{return null}},()=>({...o?{workIdentity:o,workOutcome:"computed"}:{},scope:"project",kind:e.kind,available:!0,hit:i,payloadBytes:s}))},write(t,a,r,i){Y(t,e.kind,a,r,e.serialize(i))}}}function nt(e){let n=ge.find(t=>t.kind===e);if(!n)throw new Error(`missing evidence product manifest entry for ${e}`);return n.invalidation}function l(e,n){return{scope:"file",kind:e,invalidation:{scope:"file",...n}}}function D(e,n){return{scope:"project",kind:e,invalidation:{scope:"project",...n}}}var Ee=h("source-text",{clearGroups:["whole-project","source-file"]}),he=h("source-lines",{clearGroups:["whole-project","source-file"]});function fe(e,n){let t=n.replace(/\\/g,"/");return Ee.get(e,t,()=>{try{return L(e.config.projectRoot,t,{inputKind:"indexed source file"})}catch(a){if(A(a))return"";throw a}})}function ve(e,n){let t=n.replace(/\\/g,"/");return he.get(e,t,()=>{let a=fe(e,t);return a?a.split(`
76
- `):[]})}var ye=/^\s*(?:\/\/|#|\/\*+|\*)\s*codebaseiq[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar|twin))?\b/i;function me(e){let n=ye.exec(e);return n?n[1]??"":null}function st(e,n,t){return J(e,n,t).length>0}function ot(e,n,t,a){let r=a.toLowerCase();return J(e,n,t).some(i=>i.toLowerCase()===r)}function J(e,n,t){if(t<=0)return[];let a=ve(e,n);if(a.length===0)return[];let r=[];for(let i=t-1;i>=0&&i>=t-5;i-=1){let s=(a[i]??"").trim();if(s==="")continue;let o=me(s);if(o!==null){r.push(o);continue}if(!s.startsWith("//")&&!s.startsWith("*")&&!s.startsWith("/*")&&!s.startsWith("@")&&!s.startsWith("#"))return r}return r}export{N as a,_e as b,m as c,j as d,be as e,Ce as f,h as g,Pe as h,we as i,ne as j,H as k,He as l,U as m,Ue as n,Xe as o,We as p,Be as q,Ge as r,Ye as s,et as t,tt as u,nt as v,fe as w,ve as x,me as y,st as z,ot as A};
77
- //# sourceMappingURL=chunk-7GAK2F3H.js.map
75
+ AND last_accessed_at < ?`)}}catch(n){return h("shared cache disabled (open failed)",n),null}}function P(e,n,t){h(`shared cache disabled (${n})`,t);try{e.shared?.evidence.close()}catch{}e.shared=null}function B(e,n,t,a){let r=u(e);if(!r)return null;try{let i=r.readFileEvidence.get(n,t,a,p)??r.readLegacyFileEvidence.get(n,t,a);if(i?.payload!==void 0)return i.payload;if(!R.has(n)||!r.shared)return null;try{let s=r.shared.readFileEvidence.get(n,t,a,p);return s?.payload!==void 0&&ge(r.shared,n,t,a),s?.payload??null}catch(s){return P(r,"file_evidence read",s),null}}catch(i){return g(e,"file_evidence read",i),null}}function ge(e,n,t,a){let r=Date.now();try{e.touchFileEvidence.run(r,n,t,a,p,r-le)}catch(i){h("shared file_evidence recency touch skipped",i)}}function $(e,n,t,a,r){let i=u(e);if(i)try{if(i.writeFileEvidence.run(n,t,a,p,r),R.has(n)&&i.shared)try{i.shared.writeFileEvidence.run(n,t,a,p,r,Date.now())}catch(s){P(i,"file_evidence write",s)}}catch(s){g(e,"file_evidence write",s)}}function G(e,n){if(n.length===0)return;let t=u(e);if(t)try{t.evidence.transaction(()=>{for(let r of n)t.writeFileEvidence.run(r.kind,r.relativePath,r.contentHash,p,r.payload)})();let a=n.filter(r=>R.has(r.kind));if(a.length>0&&t.shared)try{t.shared.evidence.transaction(()=>{for(let r of a)t.shared.writeFileEvidence.run(r.kind,r.relativePath,r.contentHash,p,r.payload,Date.now())})()}catch(r){P(t,"file_evidence batch write",r)}}catch(a){g(e,"file_evidence batch write",a)}}function Y(e,n,t,a){let r=u(e);if(!r)return null;try{return(r.readProjectEvidence.get(n,t,a,p)??r.readLegacyProjectEvidence.get(n,t,a))?.payload??null}catch(i){return g(e,"project_evidence read",i),null}}function z(e,n,t,a,r){let i=u(e);if(i)try{i.writeProjectEvidence.run(n,t,a,p,r)}catch(s){g(e,"project_evidence write",s)}}function We(e,n,t,a){let r=u(e);if(!r)return new Map;try{let i=r.readCalleesForFile.all(n,t,a,p),s=r.readLegacyCalleesForFile.all(n,t,a);return J([...s,...i])}catch(i){return g(e,"semantic_callees bulk read",i),new Map}}function Be(e,n,t){let a=u(e);if(!a)return new Map;try{let r=a.readReferencesForFile.all(n,t,p),i=a.readLegacyReferencesForFile.all(n,t);return J([...i,...r])}catch(r){return g(e,"semantic_references bulk read",r),new Map}}function J(e){let n=new Map;for(let t of e)n.set(t.symbol,t.payload);return n}function $e(e,n){if(n.length===0)return;let t=u(e);if(t)try{t.evidence.transaction(()=>{let a=new Set;for(let r of n){let i=`${r.relativePath}\0${r.contentHash}`;a.has(i)||(a.add(i),t.dropStaleCallees.run(r.relativePath,r.contentHash)),t.writeCallees.run(r.relativePath,r.symbol,r.contentHash,r.depsDigest,p,r.payload)}})()}catch(a){g(e,"semantic_callees write",a)}}function Ge(e,n){if(n.length===0)return;let t=u(e);if(t)try{t.evidence.transaction(()=>{let a=new Set;for(let r of n){let i=`${r.relativePath}\0${r.projectFingerprint}`;a.has(i)||(a.add(i),t.dropStaleReferences.run(r.relativePath,r.projectFingerprint)),t.writeReferences.run(r.relativePath,r.symbol,r.projectFingerprint,p,r.payload)}})()}catch(a){g(e,"semantic_references write",a)}}function ze(e){return typeof e=="object"&&e!==null}function Je(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")?e:null}var Ee=[l("source-facts",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/source-facts.ts"}),l("callable-units",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/source/callable-units.test.ts",owner:"src/source/facts/callable-units.ts"}),l("file-definitions",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/symbols/definition-catalog.ts"}),l("definition-exclusions",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/framework-patterns.ts"}),l("doc-path-tokens",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-products.test.ts",owner:"tests/storage/evidence-cache.test.ts"}),l("doc-path-evidence",{dependsOn:["content-hash","git-history","git-head","tool-version"],keyParts:["kind","relativePath","contentHash","trackedFiles","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/cleanup/doc-drift.ts"}),l("source-imports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),l("source-reexports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),l("source-fingerprints",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/definition-catalog.test.ts",owner:"src/queries/cleanup/similar.ts"}),l("consumer-file-usage",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/internal/consumer-evidence.ts"}),l("react-component-behavior-profiles",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/react-profile.ts"}),l("git-file-adds",{dependsOn:["git-head","git-history","tool-version"],keyParts:["kind","cacheKey","head","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/git-history.ts"}),l("typescript-reference-fragments",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-reference-fragments.test.ts",owner:"src/semantic/typescript/reference-fragment-shadow.ts"}),l("typescript-import-usage",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),l("typescript-signatures",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),D("file-dependency-graph",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","scope","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/file-dep-graph.test.ts",owner:"src/symbols/graph/file-dep-graph.ts"}),D("semantic-import-usage",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","relativePath","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),D("semantic-signatures",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","symbol","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),D("health-semantic-prewarm",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","scope","cliVersion","projectFingerprint","payloadVersion"],stalenessTest:"tests/runtime/cli-support.test.ts",owner:"src/runtime/cli-support.ts"})];function nt(e){let n=new Map;return{kind:e.kind,read(t,a,r){let i=!1,s=0,o;if(_()){let c=X(t);if(c){let d=`${c}\0${a}\0${r}`;o=n.get(d),o||(o=S(["evidence-product-file-read-v1",e.kind,c,a,r]),n.set(d,o))}}return b("evidence-product.file.read",()=>{let c=B(t,e.kind,a,r);if(c===null)return null;s=c.length;try{let d=e.deserialize(c);return i=d!==null,d}catch{return null}},()=>({...o?{workIdentity:o,workOutcome:"computed"}:{},scope:"file",kind:e.kind,available:!0,hit:i,payloadBytes:s}))},write(t,a,r,i){$(t,e.kind,a,r,e.serialize(i))},writeBatch(t,a){G(t,a.map(r=>({kind:e.kind,relativePath:r.relativePath,contentHash:r.contentHash,payload:e.serialize(r.value)})))}}}function rt(e){let n=new Map;return{kind:e.kind,read(t,a,r){let i=!1,s=0,o;if(_()){let c=`${r}\0${a}`;o=n.get(c),o||(o=S(["evidence-product-project-read-v1",e.kind,r,a]),n.set(c,o))}return b("evidence-product.project.read",()=>{let c=Y(t,e.kind,a,r);if(c===null)return null;s=c.length;try{let d=e.deserialize(c);return i=d!==null,d}catch{return null}},()=>({...o?{workIdentity:o,workOutcome:"computed"}:{},scope:"project",kind:e.kind,available:!0,hit:i,payloadBytes:s}))},write(t,a,r,i){z(t,e.kind,a,r,e.serialize(i))}}}function at(e){let n=Ee.find(t=>t.kind===e);if(!n)throw new Error(`missing evidence product manifest entry for ${e}`);return n.invalidation}function l(e,n){return{scope:"file",kind:e,invalidation:{scope:"file",...n}}}function D(e,n){return{scope:"project",kind:e,invalidation:{scope:"project",...n}}}var he=f("source-text",{clearGroups:["whole-project","source-file"]}),fe=f("source-lines",{clearGroups:["whole-project","source-file"]});function ve(e,n){let t=n.replace(/\\/g,"/");return he.get(e,t,()=>{try{return O(e.config.projectRoot,t,{inputKind:"indexed source file"})}catch(a){if(A(a))return"";throw a}})}function ye(e,n){let t=n.replace(/\\/g,"/");return fe.get(e,t,()=>{let a=ve(e,t);return a?a.split(`
76
+ `):[]})}var me=/^\s*(?:\/\/|#|\/\*+|\*)\s*codebaseiq[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar|twin))?\b/i;function De(e){let n=me.exec(e);return n?n[1]??"":null}function ct(e,n,t){return q(e,n,t).length>0}function lt(e,n,t,a){let r=a.toLowerCase();return q(e,n,t).some(i=>i.toLowerCase()===r)}function q(e,n,t){if(t<=0)return[];let a=ye(e,n);if(a.length===0)return[];let r=[];for(let i=t-1;i>=0&&i>=t-5;i-=1){let s=(a[i]??"").trim();if(s==="")continue;let o=De(s);if(o!==null){r.push(o);continue}if(!s.startsWith("//")&&!s.startsWith("*")&&!s.startsWith("/*")&&!s.startsWith("@")&&!s.startsWith("#"))return r}return r}export{N as a,Se as b,m as c,M as d,Ce as e,Ne as f,f as g,we as h,Fe as i,re as j,U as k,Xe as l,X as m,We as n,Be as o,$e as p,Ge as q,ze as r,Je as s,nt as t,rt as u,at as v,ve as w,ye as x,De as y,ct as z,lt as A};
77
+ //# sourceMappingURL=chunk-23AD24QZ.js.map
@@ -0,0 +1,2 @@
1
+ import{b as r}from"./chunk-MJX2J5QE.js";import{y as e}from"./chunk-TNLOX4TN.js";function l(t,s){let o=r(t,s);return e(t,o).map(({relativePath:n,...a})=>a)}export{l as a};
2
+ //# sourceMappingURL=chunk-24TEZJST.js.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-GV2CEZCW.js";function l(d,c,o){if(o.length===0)return[];let e=new Set(o),n=s(d),r=new Set;if(c==="forward")for(let t of e)for(let i of n.get(t)??[])e.has(i)||r.add(i);else for(let[t,i]of n)if(!e.has(t))for(let _ of e)i.has(_)&&r.add(t);return[...r].sort()}export{l as a};
2
- //# sourceMappingURL=chunk-356EZBIP.js.map
1
+ import{a as s}from"./chunk-6CTSFS7R.js";function l(d,c,o){if(o.length===0)return[];let e=new Set(o),n=s(d),r=new Set;if(c==="forward")for(let t of e)for(let i of n.get(t)??[])e.has(i)||r.add(i);else for(let[t,i]of n)if(!e.has(t))for(let _ of e)i.has(_)&&r.add(t);return[...r].sort()}export{l as a};
2
+ //# sourceMappingURL=chunk-26EDDGAX.js.map
@@ -1,7 +1,7 @@
1
- import{a as B}from"./chunk-T75DS2E6.js";import{b as N,e as A,h as p,l as I}from"./chunk-D7DOB27N.js";import{a as J}from"./chunk-6O3KXIDL.js";import{d as m,e as L,f as O,h as w}from"./chunk-UQYQBLJX.js";import{existsSync as W,statSync as ne}from"fs";import{dirname as F,join as z}from"path";import{appendFileSync as j,existsSync as U,mkdirSync as q,renameSync as X,rmSync as G,statSync as V,truncateSync as K}from"fs";import{basename as Y,dirname as H}from"path";var R=".previous",Q=".rotation.lock",Z=2e3,h=class extends Error{constructor(t,r){super(`Timed out after ${r}ms waiting for rotating JSONL lock: ${t}`);this.lockPath=t;this.timeoutMs=r;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},S=class extends Error{constructor(t){super(`Rotating JSONL lock ownership changed before release: ${t}`);this.lockPath=t;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},D=Object.freeze({monotonicNow:J,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,i){let t=I(e,{kind:"rotating-jsonl",detail:{target:Y(i)}});return t.kind==="acquired"?{kind:"acquired",lock:t.lock}:{kind:"contended"}},makeDirectory(e){q(e,{recursive:!0})},exists:U,readBytes(e){return O(e,{maxBytes:m,inputKind:"rotating JSONL segment"})},size(e){return V(e).size},truncate:K,remove(e){G(e,{force:!0})},rename:X,append:j});function E(e,i,t){let r=t.runtime??D,a=JSON.stringify(i);if(a===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let s=Buffer.from(`${a}
1
+ import{a as B}from"./chunk-E7T22WET.js";import{b as N,e as A,h as p,l as I}from"./chunk-3F23W57G.js";import{a as J}from"./chunk-OZI44VCR.js";import{d as m,e as L,f as O,h as w}from"./chunk-C3PPB2T5.js";import{existsSync as W,statSync as ne}from"fs";import{dirname as F,join as z}from"path";import{appendFileSync as j,existsSync as U,mkdirSync as q,renameSync as X,rmSync as G,statSync as V,truncateSync as K}from"fs";import{basename as Y,dirname as H}from"path";var R=".previous",Q=".rotation.lock",Z=2e3,h=class extends Error{constructor(t,r){super(`Timed out after ${r}ms waiting for rotating JSONL lock: ${t}`);this.lockPath=t;this.timeoutMs=r;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},S=class extends Error{constructor(t){super(`Rotating JSONL lock ownership changed before release: ${t}`);this.lockPath=t;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},D=Object.freeze({monotonicNow:J,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,i){let t=I(e,{kind:"rotating-jsonl",detail:{target:Y(i)}});return t.kind==="acquired"?{kind:"acquired",lock:t.lock}:{kind:"contended"}},makeDirectory(e){q(e,{recursive:!0})},exists:U,readBytes(e){return O(e,{maxBytes:m,inputKind:"rotating JSONL segment"})},size(e){return V(e).size},truncate:K,remove(e){G(e,{force:!0})},rename:X,append:j});function E(e,i,t){let r=t.runtime??D,a=JSON.stringify(i);if(a===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let s=Buffer.from(`${a}
2
2
  `),n=Math.max(1,Math.floor(t.maxSegmentBytes),s.length);return M(e,t.lockTimeoutMs,r,()=>{r.makeDirectory(H(e));let d=ee(e,m,r);t.onPhase?.("tail-repaired");let c=`${e}${t.previousSuffix??R}`,o=!1,l=!1;return r.exists(e)&&r.size(e)+s.length>n&&(r.exists(c)&&(r.remove(c),l=!0),t.onPhase?.("previous-pruned"),r.rename(e,c),o=!0,t.onPhase?.("current-rotated")),r.append(e,s),t.onPhase?.("record-appended"),{lineBytes:s.length,segmentLimitBytes:n,repairedTailBytes:d,rotated:o,prunedPrevious:l}})}function P(e,i={}){let t=i.runtime??D,r=te(i.maxSegmentBytes);return M(e,i.lockTimeoutMs,t,()=>{let a=[],s=0,n=`${e}${i.previousSuffix??R}`;for(let d of[n,e]){if(!t.exists(d))continue;let c=ie(_(d,r,t));a.push(...c.lines),s+=c.partialTailBytes}return{lines:a,ignoredPartialTailBytes:s}})}function M(e,i,t,r){let a=`${e}${Q}`,s=Math.max(0,i??Z),n=t.monotonicNow()+s,d;for(;;){let g=t.tryAcquireLock(a,e);if(g.kind==="acquired"){d=g.lock;break}let f=n-t.monotonicNow();if(f<=0)throw new h(a,s);t.wait(Math.min(5,f))}let c=!1,o,l;try{l=r()}catch(g){c=!0,o=g}let u=!1;try{u=d.release()}catch(g){if(!c)throw g}if(c)throw o;if(!u)throw new S(a);return l}function ee(e,i,t){if(!t.exists(e))return 0;let r=_(e,i,t);if(r.length===0||r[r.length-1]===10)return 0;let a=r.lastIndexOf(10),s=a<0?0:a+1;return t.truncate(e,s),r.length-s}function te(e){let i=e??m;if(!Number.isSafeInteger(i)||i<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${i}`);return i}function _(e,i,t){let r=t.size(e);if(r>i)throw new L("rotating JSONL segment",e,"too-large",r,i);let a=t.readBytes(e),s=t.size(e);if(s!==r||a.byteLength!==r)throw new L("rotating JSONL segment",e,"changed-during-read",s,i);return a}function ie(e){let i=e.lastIndexOf(10),t=i<0?0:i+1;return{lines:e.subarray(0,t).toString("utf8").split(`
3
3
  `).filter(a=>a.length>0),partialTailBytes:e.length-t}}var re="reindex-activity.jsonl",b=R,ae=1024*1024,se=1440*60*1e3,C=e=>w(e,"reindex activity segment");function x(e){return z(F(e),re)}function oe(e){if(e.reused)return 0;let i=T(e.indexPath)+T(e.dbPath);for(let t of e.shards??[])!t.reused&&t.outputBytes!==null&&(i+=t.outputBytes);return i}function De(e,i){let t=i.lastRefresh;if(!t)return{state:"failed",reason:"reindex result has no refresh metadata"};let r=oe(i);return k(x(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:t.result,durationMs:t.durationMs,estimatedLogicalOutputBytes:r,estimatedWriteBytes:r+(i.writeTelemetry?.fallbackCopiedBytes??0),reflinkedBytes:i.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:i.writeTelemetry?.fallbackCopiedBytes??0,byLanguage:pe(i)})}function Ee(e,i){return k(x(e),{version:1,event:"run",recordedAt:i.completedAt,trigger:i.trigger,result:"failed",durationMs:i.durationMs,estimatedLogicalOutputBytes:0})}function Pe(e,i,t=new Date){return k(x(e),{version:1,event:"suppressed",recordedAt:t.toISOString(),trigger:i,reason:"completed-index-is-fresh"})}function ue(e,i,t=ae,r){E(e,i,{maxSegmentBytes:t,previousSuffix:b,...r?{runtime:r}:{}})}function de(e,i=new Date,t=se,r=C){let a=i.getTime(),s=a-t,n={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(s).toISOString(),windowEndedAt:i.toISOString(),runs:0,rebuilt: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:{}},d=x(e),c=[];if(r===C){if(!W(d)&&!W(`${d}${b}`))return n;try{let o=P(d,{previousSuffix:b});c=o.lines,n.ignoredPartialTailBytes=o.ignoredPartialTailBytes}catch{n.readErrors+=1,n.confidence="unavailable"}}else{let o=0;for(let l of[`${d}${b}`,d])try{c.push(...ve(r(l))),o+=1}catch{n.readErrors+=1}o===0?n.confidence="unavailable":n.readErrors>0&&(n.confidence="partial")}for(let o of c){n.recordsRead+=1;let l=ce(o);if(!l){n.invalidRecords+=1,n.confidence!=="unavailable"&&(n.confidence="partial");continue}let{record:u}=l,g=Date.parse(u.recordedAt);if(g<s||g>a){n.skippedRecords+=1;continue}if(n.invalidLanguageDetails=(n.invalidLanguageDetails??0)+l.invalidLanguageDetails,n.byTrigger[u.trigger.kind]=(n.byTrigger[u.trigger.kind]??0)+1,u.event==="suppressed"){n.suppressed+=1;continue}n.runs+=1,n[u.result]+=1,n.estimatedLogicalOutputBytes+=u.estimatedLogicalOutputBytes,n.estimatedWriteBytes=(n.estimatedWriteBytes??0)+(u.estimatedWriteBytes??u.estimatedLogicalOutputBytes),n.reflinkedBytes=(n.reflinkedBytes??0)+(u.reflinkedBytes??0),n.fallbackCopiedBytes=(n.fallbackCopiedBytes??0)+(u.fallbackCopiedBytes??0),u.result!=="failed"&&(l.hasLanguageDetails?n.attributedRuns=(n.attributedRuns??0)+1:n.unattributedRuns=(n.unattributedRuns??0)+1);for(let[f,v]of Re(u.byLanguage)){let y=(n.byLanguage??={})[f]??=be();y.runs+=1,y[v.result]+=1,y.producedOutputBytes+=v.producedOutputBytes,y.durationMs+=v.durationMs}u.result==="rebuilt"&&n.oldestRebuildAt===void 0&&(n.oldestRebuildAt=u.recordedAt),(u.estimatedWriteBytes??u.estimatedLogicalOutputBytes)>0&&n.oldestWriteAt===void 0&&(n.oldestWriteAt=u.recordedAt)}return n.ignoredPartialTailBytes>0&&n.confidence!=="unavailable"&&(n.confidence="partial"),n.languageAttribution=xe(n),n}function k(e,i){try{return ue(e,i),{state:"recorded"}}catch(t){return{state:"failed",reason:t instanceof Error?t.message:String(t)}}}function ce(e){try{let i=JSON.parse(e);if(!i||typeof i!="object")return null;let t=i;if(t.version!==1||!N(t.recordedAt)||!t.trigger||!ge(t.trigger.kind))return null;if(t.event==="suppressed")return t.reason==="completed-index-is-fresh"?{record:t,hasLanguageDetails:!1,invalidLanguageDetails:0}:null;if(t.event!=="run"||t.result!=="rebuilt"&&t.result!=="reused"&&t.result!=="failed"||!p(t.durationMs)||!p(t.estimatedLogicalOutputBytes)||t.estimatedWriteBytes!==void 0&&!p(t.estimatedWriteBytes)||t.reflinkedBytes!==void 0&&!p(t.reflinkedBytes)||t.fallbackCopiedBytes!==void 0&&!p(t.fallbackCopiedBytes))return null;let r=t,{byLanguage:a,...s}=r,n=fe(a);return{record:{...s,...n.byLanguage?{byLanguage:n.byLanguage}:{}},hasLanguageDetails:n.hasLanguageDetails,invalidLanguageDetails:n.invalidLanguageDetails}}catch{return null}}function Me(e,i,t=new Date){return i.enabled?le(de(e,t,i.windowMs),i,t.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function le(e,i,t){let r=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,a={rebuilt:e.rebuilt,estimatedWriteBytes:r};return i.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:t+i.windowMs,...a,detail:`reindex activity evidence is ${e.confidence}`}:e.rebuilt>=i.maxRebuilds?{state:"paused",reason:"rebuild-count",until:$(e.oldestRebuildAt,i.windowMs,t),...a,detail:`${e.rebuilt}/${i.maxRebuilds} automatic rebuild slots consumed`}:r>=i.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:$(e.oldestWriteAt,i.windowMs,t),...a,detail:`${r}/${i.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...a}:{state:"allowed",...a}}function $(e,i,t){let r=e?Date.parse(e):Number.NaN;return Number.isFinite(r)&&r+i>t?r+i:t+i}function ge(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 T(e){try{return ne(e).size}catch{return 0}}function pe(e){let i={};for(let t of e.languages){let r=(e.shards??[]).filter(o=>o.language===t),a=r.find(o=>o.id===t),s=e.reused||(a?a.reused:r.length>0&&r.every(o=>o.reused)),n=T(z(F(e.dbPath),"language-indexes",`${t}.scip`)),d=n>0?n:a?.outputBytes??n,c=s?0:a?.durationMs??r.filter(o=>!o.reused).reduce((o,l)=>o+l.durationMs,0);i[t]={result:s?"reused":"rebuilt",outputBytes:d,producedOutputBytes:s?0:d,durationMs:c}}return i}function fe(e){if(e===void 0)return{hasLanguageDetails:!1,invalidLanguageDetails:0};if(!e||typeof e!="object"||Array.isArray(e))return{hasLanguageDetails:!1,invalidLanguageDetails:1};let i={},t=0;for(let[a,s]of Object.entries(e)){if(!me(a)||!ye(s)){t+=1;continue}i[a]=s}let r=Object.keys(i).length>0;return{...r?{byLanguage:i}:{},hasLanguageDetails:r,invalidLanguageDetails:t}}function ye(e){if(!e||typeof e!="object")return!1;let i=e;return(i.result==="rebuilt"||i.result==="reused")&&A(i.outputBytes)&&A(i.producedOutputBytes)&&p(i.durationMs)&&(i.result!=="reused"||i.producedOutputBytes===0&&i.durationMs===0)&&i.producedOutputBytes<=i.outputBytes}function me(e){return B.includes(e)}function Re(e){return e?B.flatMap(i=>{let t=e[i];return t?[[i,t]]:[]}):[]}function be(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function xe(e){let i=e.invalidLanguageDetails??0,t=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&i===0?"complete":t===0?"unavailable":"partial"}function ve(e){return e.endsWith(`
4
4
  `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
5
5
  `)+1))),e.split(`
6
6
  `).filter(i=>i.length>0)}export{R as a,E as b,re as c,De as d,Ee as e,Pe as f,de as g,Me as h};
7
- //# sourceMappingURL=chunk-O2M3VNDY.js.map
7
+ //# sourceMappingURL=chunk-26EZWQ24.js.map
@@ -1,3 +1,3 @@
1
- import{a as f}from"./chunk-SGMNWYTH.js";import{b as d,d as m}from"./chunk-GVAF222T.js";function u(e,r){let c=f(e,r);if(!c)return[];let t=e.get(`SELECT symbol, enclosing_symbol FROM global_symbols
1
+ import{a as f}from"./chunk-DOQLO74K.js";import{b as d,d as m}from"./chunk-TNLOX4TN.js";function u(e,r){let c=f(e,r);if(!c)return[];let t=e.get(`SELECT symbol, enclosing_symbol FROM global_symbols
2
2
  WHERE id = ? LIMIT 1`,c.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],n=t.enclosing_symbol,i=1,y=new Set([t.symbol]);for(;n&&!y.has(n)&&i<20;){y.add(n);let s=e.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",n);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:i}),n=s.enclosing_symbol,i++}if(o.length>1)return o;let b=d(t.symbol);if("kind"in b)return o;let l=b.descriptors;if(l.length<=1)return o;let h=[o[0]];for(let s=l.length-2,p=1;s>=0;s--,p++){let g=l.slice(0,s+1).map(a=>a.suffix==="method"?`${a.name}()`:a.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");h.push({symbol:g,shortName:g,depth:p})}return h}function N(e,r){return u(e,r)}export{u as a,N as b};
3
- //# sourceMappingURL=chunk-U33PMPNW.js.map
3
+ //# sourceMappingURL=chunk-2L3NCI52.js.map
@@ -1,4 +1,4 @@
1
- import{c as W,d as J,e as K,f as U,n as Q}from"./chunk-J7AMBVWF.js";import{d as z,e as Y}from"./chunk-SGX43S2L.js";import{A as B,e as F,g as G,t as j,u as H,z as $}from"./chunk-GVAF222T.js";import{k as D,p as x}from"./chunk-F74LZWCE.js";import{z as A}from"./chunk-ICUL7XRT.js";import{h as M}from"./chunk-7GAK2F3H.js";import{d as P}from"./chunk-UC2FD2PS.js";function _e(o,n,e={}){return ee(o,n,e).rows}function ee(o,n,e={}){let t=N(o,[n],{additive:e.additive,semantic:e.semantic,semanticEvidence:e.semanticEvidence}),a=e.callableOnly?(t.rows.get(n.symbolId)??[]).filter(l=>G(l.symbol)||l.source==="ast-callsite"):t.rows.get(n.symbolId)??[];return{rows:typeof e.limit=="number"?a.slice(0,e.limit):a,semanticIncomplete:t.incompleteSymbolIds.has(n.symbolId),semanticUnavailable:t.unavailableSymbolIds.has(n.symbolId)}}function Le(o,n,e){return ne(o,n,e).rows}function ne(o,n,e){let t=Z(o,[n],e);return{rows:t.rows.get(n.symbolId)??[],semanticIncomplete:t.incompleteSymbolIds.has(n.symbolId),semanticUnavailable:t.unavailableSymbolIds.has(n.symbolId)}}function Ae(o,n,e){return Z(o,n,e).rows}function Z(o,n,e){let t=ae(o)?ce(o,n,{semantic:e.semantic!==!1,semanticEvidence:e.semanticEvidence}):se(o,e.semanticEvidence,{semantic:e.semantic!==!1});return{rows:new Map(n.map(l=>[l.symbolId,typeof e.limit=="number"?(t.rows.get(l.symbolId)??[]).slice(0,e.limit):t.rows.get(l.symbolId)??[]])),incompleteSymbolIds:new Set(n.filter(l=>t.incompleteSymbolIds.has(l.symbolId)).map(l=>l.symbolId)),unavailableSymbolIds:new Set(n.filter(l=>t.unavailableSymbolIds.has(l.symbolId)).map(l=>l.symbolId))}}var oe=M("caller-rows",{clearGroups:["whole-project"]}),te=M("caller-rows-non-semantic",{clearGroups:["whole-project"]}),ie=M("targeted-caller-strategy",{clearGroups:["whole-project"]}),le=2e4;function ae(o){return ie.get(o,()=>(o.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>le)}function se(o,n,e={}){return(e.semantic===!1?te:oe).get(o,()=>{let a=H(o),l=N(o,a,{semantic:e.semantic!==!1,semanticEvidence:n}),m=new Map;for(let c of a)m.set(c.symbol,c.symbolId);let b=new Map,f=new Map;for(let c of a){let s=l.rows.get(c.symbolId);if(!(!s||s.length===0))for(let u of s){let r=m.get(u.symbol);if(r===void 0||r===c.symbolId)continue;let i=b.get(r);i||(i=[],b.set(r,i),f.set(r,new Set));let w=`${c.symbol}|${c.relativePath}`;f.get(r).has(w)||(f.get(r).add(w),i.push({symbol:c.symbol,file:c.relativePath,source:"caller-map-inversion",callEvidence:u.source}))}}return{rows:b,incompleteSymbolIds:l.incompleteSymbolIds.size===0?new Set:new Set(a.map(c=>c.symbolId)),unavailableSymbolIds:l.unavailableSymbolIds.size===0?new Set:new Set(a.map(c=>c.symbolId))}})}function ce(o,n,e){let t=e.semantic&&e.semanticEvidence?n.flatMap(s=>{let u=re(o,s);return u?[u]:[]}):[],a=new Map(t.map(s=>[s.symbolId,s])),l=e.semantic&&e.semanticEvidence?e.semanticEvidence.referenceEvidenceMap(o,t):{rows:new Map,incompleteSymbolIds:new Set,unavailableSymbolIds:new Set},m=Q(o,n),b=new Map;for(let s of n){let u=[],r=new Set,i=d=>{if(d.symbol===s.symbol)return;let p=`${d.symbol}|${d.file}`;r.has(p)||(r.add(p),u.push(d))};for(let d of m.get(s.symbolId)??[])d.file!==s.relativePath&&i({symbol:d.enclosingSymbol??d.file,file:d.file,source:"resolved-reference"});let w=a.get(s.symbolId);if(w)for(let d of l.rows.get(w.symbolId)??[]){if(d.file===s.relativePath||o.isIgnored(d.file))continue;let p=B(j(o,d.file),d.line);i({symbol:p?.symbol??d.file,file:d.file,source:"semantic-reference"})}b.set(s.symbolId,u)}let f=new Set(l.incompleteSymbolIds),c=new Set(l.unavailableSymbolIds);if(e.semantic)for(let s of n)a.has(s.symbolId)||f.add(s.symbolId);return{rows:b,incompleteSymbolIds:f,unavailableSymbolIds:c}}function re(o,n){let e=z().join(", "),t=Y().join(", ");return o.get(`SELECT
1
+ import{c as W,d as J,e as K,f as U,n as Q}from"./chunk-NB2DAVPP.js";import{d as z,e as Y}from"./chunk-SGX43S2L.js";import{A as B,e as F,g as G,t as j,u as H,z as $}from"./chunk-TNLOX4TN.js";import{k as D,p as x}from"./chunk-RGBZDOUO.js";import{z as A}from"./chunk-NRNVMB2R.js";import{h as M}from"./chunk-23AD24QZ.js";import{d as P}from"./chunk-6I55VYFG.js";function _e(o,n,e={}){return ee(o,n,e).rows}function ee(o,n,e={}){let t=N(o,[n],{additive:e.additive,semantic:e.semantic,semanticEvidence:e.semanticEvidence}),a=e.callableOnly?(t.rows.get(n.symbolId)??[]).filter(l=>G(l.symbol)||l.source==="ast-callsite"):t.rows.get(n.symbolId)??[];return{rows:typeof e.limit=="number"?a.slice(0,e.limit):a,semanticIncomplete:t.incompleteSymbolIds.has(n.symbolId),semanticUnavailable:t.unavailableSymbolIds.has(n.symbolId)}}function Le(o,n,e){return ne(o,n,e).rows}function ne(o,n,e){let t=Z(o,[n],e);return{rows:t.rows.get(n.symbolId)??[],semanticIncomplete:t.incompleteSymbolIds.has(n.symbolId),semanticUnavailable:t.unavailableSymbolIds.has(n.symbolId)}}function Ae(o,n,e){return Z(o,n,e).rows}function Z(o,n,e){let t=ae(o)?ce(o,n,{semantic:e.semantic!==!1,semanticEvidence:e.semanticEvidence}):se(o,e.semanticEvidence,{semantic:e.semantic!==!1});return{rows:new Map(n.map(l=>[l.symbolId,typeof e.limit=="number"?(t.rows.get(l.symbolId)??[]).slice(0,e.limit):t.rows.get(l.symbolId)??[]])),incompleteSymbolIds:new Set(n.filter(l=>t.incompleteSymbolIds.has(l.symbolId)).map(l=>l.symbolId)),unavailableSymbolIds:new Set(n.filter(l=>t.unavailableSymbolIds.has(l.symbolId)).map(l=>l.symbolId))}}var oe=M("caller-rows",{clearGroups:["whole-project"]}),te=M("caller-rows-non-semantic",{clearGroups:["whole-project"]}),ie=M("targeted-caller-strategy",{clearGroups:["whole-project"]}),le=2e4;function ae(o){return ie.get(o,()=>(o.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>le)}function se(o,n,e={}){return(e.semantic===!1?te:oe).get(o,()=>{let a=H(o),l=N(o,a,{semantic:e.semantic!==!1,semanticEvidence:n}),m=new Map;for(let c of a)m.set(c.symbol,c.symbolId);let b=new Map,f=new Map;for(let c of a){let s=l.rows.get(c.symbolId);if(!(!s||s.length===0))for(let u of s){let r=m.get(u.symbol);if(r===void 0||r===c.symbolId)continue;let i=b.get(r);i||(i=[],b.set(r,i),f.set(r,new Set));let w=`${c.symbol}|${c.relativePath}`;f.get(r).has(w)||(f.get(r).add(w),i.push({symbol:c.symbol,file:c.relativePath,source:"caller-map-inversion",callEvidence:u.source}))}}return{rows:b,incompleteSymbolIds:l.incompleteSymbolIds.size===0?new Set:new Set(a.map(c=>c.symbolId)),unavailableSymbolIds:l.unavailableSymbolIds.size===0?new Set:new Set(a.map(c=>c.symbolId))}})}function ce(o,n,e){let t=e.semantic&&e.semanticEvidence?n.flatMap(s=>{let u=re(o,s);return u?[u]:[]}):[],a=new Map(t.map(s=>[s.symbolId,s])),l=e.semantic&&e.semanticEvidence?e.semanticEvidence.referenceEvidenceMap(o,t):{rows:new Map,incompleteSymbolIds:new Set,unavailableSymbolIds:new Set},m=Q(o,n),b=new Map;for(let s of n){let u=[],r=new Set,i=d=>{if(d.symbol===s.symbol)return;let p=`${d.symbol}|${d.file}`;r.has(p)||(r.add(p),u.push(d))};for(let d of m.get(s.symbolId)??[])d.file!==s.relativePath&&i({symbol:d.enclosingSymbol??d.file,file:d.file,source:"resolved-reference"});let w=a.get(s.symbolId);if(w)for(let d of l.rows.get(w.symbolId)??[]){if(d.file===s.relativePath||o.isIgnored(d.file))continue;let p=B(j(o,d.file),d.line);i({symbol:p?.symbol??d.file,file:d.file,source:"semantic-reference"})}b.set(s.symbolId,u)}let f=new Set(l.incompleteSymbolIds),c=new Set(l.unavailableSymbolIds);if(e.semantic)for(let s of n)a.has(s.symbolId)||f.add(s.symbolId);return{rows:b,incompleteSymbolIds:f,unavailableSymbolIds:c}}function re(o,n){let e=z().join(", "),t=Y().join(", ");return o.get(`SELECT
2
2
  d.id AS documentId,
3
3
  gs.id AS symbolId,
4
4
  gs.symbol,
@@ -35,4 +35,4 @@ import{c as W,d as J,e as K,f as U,n as Q}from"./chunk-J7AMBVWF.js";import{d as
35
35
  ) def_chunk ON def_chunk.symbol_id = gs.id
36
36
  WHERE gs.id IN (${i.map(()=>"?").join(",")})`,...i,...i)),b=k([...n.map(i=>i.documentId),...m.flatMap(i=>i.document_id===null?[]:[i.document_id])]),f=new Map(b.flatMap(i=>o.all(`SELECT id, relative_path FROM documents
37
37
  WHERE id IN (${i.map(()=>"?").join(",")})`,...i).map(w=>[w.id,w.relative_path]))),c=new Map;for(let i of m)c.has(i.symbol_id)||c.set(i.symbol_id,{symbol:i.symbol,file:i.document_id!==null?f.get(i.document_id)??"":""});let s=new Map,u=f,r=ye(n);for(let[i,w]of r){let p=[...a.get(i)??[]].sort((y,g)=>y.start_line-g.start_line||y.end_line-g.end_line),v=[...w].sort((y,g)=>y.startLine-g.startLine||y.endLine-g.endLine),I=new Set,R=0;for(let y of v){for(;R<p.length&&p[R].start_line<=y.endLine;)I.add(p[R]),R+=1;for(let S of I)S.end_line<y.startLine&&I.delete(S);let g=new Set,O=[],_=null,q=()=>{if(_)return _;let S=u.get(y.documentId)??"",E=new Set;if(S){let L=W(o,S),C=Math.max(0,y.startLine),T=Math.min(L.length-1,y.endLine);for(let h=C;h<=T;h+=1)for(let X of L[h])E.add(X)}return _=E,E};for(let S of I){if(S.symbol_id===y.symbolId)continue;let E=c.get(S.symbol_id);if(!E)continue;if(!(S.start_line>=y.startLine&&S.end_line<=y.endLine)){if(!(S.start_line<=y.endLine&&S.end_line>=y.startLine))continue;let h=F(E.symbol);if(!h||!q().has(h))continue}let C=`${E.symbol}|${S.chunk_id}`;g.has(C)||(g.add(C),O.push({...E,chunkId:S.chunk_id,source:"scip-chunk"}))}s.set(y.symbolId,O)}}return s}var V=500;function k(o){let n=[...new Set(o)],e=[];for(let t=0;t<n.length;t+=V)e.push(n.slice(t,t+V));return e}function ye(o){let n=new Map;for(let e of o){let t=n.get(e.documentId);t?t.push(e):n.set(e.documentId,[e])}return n}function pe(o){let n=new Map;for(let[e,t]of o){let a=[];for(let l of t)a.push({symbol:l.symbol,file:l.file,chunkId:-1,source:"semantic-callee",...l.callsiteLine===void 0?{}:{callsiteLine:l.callsiteLine}});n.set(e,a)}return n}export{_e as a,ee as b,Le as c,ne as d,Ae as e,Z as f,De as g,N as h};
38
- //# sourceMappingURL=chunk-MSI3K7PJ.js.map
38
+ //# sourceMappingURL=chunk-2QJAVISG.js.map
@@ -1,2 +1,2 @@
1
- import{d as F,f as w}from"./chunk-T75DS2E6.js";import{u as S,v as D,x as b,y as E}from"./chunk-D7DOB27N.js";import{h as m}from"./chunk-UQYQBLJX.js";import{createHash as V}from"crypto";import{dirname as B,join as A}from"path";var T=4,z=3,L=2,$="typescript-index";function ne(t){let e=A(t,$),r=D(e);return{...r,requestDir:r.legacyRequestDir}}function ie(t){let e=JSON.parse(t),r=e.protocolVersion,n=r===L,i=r===z;if(!n&&!i&&r!==T||typeof e.id!="string"||!e.id||typeof e.baseGeneration!="string"||!e.baseGeneration||typeof e.deadlineAtMs!="number"||!Number.isFinite(e.deadlineAtMs)||!U(e.request)||!n&&(e.mailboxVersion!==S||typeof e.operationKey!="string"||!/^[a-f0-9]{64}$/.test(e.operationKey)||e.id!==E(e.operationKey)||typeof e.clientId!="string"||!e.clientId||typeof e.enqueuedAtMs!="number"||!Number.isFinite(e.enqueuedAtMs)||e.deadlineAtMs<e.enqueuedAtMs))throw new Error("TypeScript index service received an invalid mailbox request.");if(!n){let s=e,p=b(i?"typescript-index-v3":"typescript-index-v4",{baseGeneration:s.baseGeneration,request:s.request});if(s.operationKey!==p)throw new Error("TypeScript index service received a mismatched mailbox operation identity.");return{...s,protocolVersion:T}}let o=b("typescript-index-v2",{id:e.id,baseGeneration:e.baseGeneration,request:e.request});return{protocolVersion:T,mailboxVersion:S,id:e.id,operationKey:o,clientId:"legacy-v2",enqueuedAtMs:e.deadlineAtMs,deadlineAtMs:e.deadlineAtMs,baseGeneration:e.baseGeneration,request:e.request}}function oe(t){try{let e=w(F(m(A(B(t),"meta.json"),"reindex metadata")));return e?V("sha256").update(e).digest("hex"):null}catch{return null}}function U(t){if(!t||typeof t!="object")return!1;let e=t,r=C(e.modifiedFiles)?e.modifiedFiles:null,n=C(e.affectedFiles)?e.affectedFiles:null;return e.kind==="emit-documents"&&typeof e.tsconfigPath=="string"&&!!e.tsconfigPath&&typeof e.projectArgument=="string"&&!!e.projectArgument&&typeof e.projectIdentity=="string"&&!!e.projectIdentity&&typeof e.producerIdentity=="string"&&!!e.producerIdentity&&r!==null&&r.length>0&&new Set(r).size===r.length&&n!==null&&n.length>0&&new Set(n).size===n.length}function C(t){return Array.isArray(t)&&t.every(e=>typeof e=="string"&&e.length>0)}import{createRequire as G}from"module";import{dirname as R,isAbsolute as Y,relative as _,resolve as d,sep as v}from"path";var l=G(import.meta.url),H=1,M="0.4.0";function X(){try{let t=j();if(!t.available)return t;let{packageRoot:e}=t,r=l.resolve("typescript",{paths:[e]}),n=l(r),{FileIndexer:i}=l(d(e,"dist/src/FileIndexer.js")),{Input:o}=l(d(e,"dist/src/Input.js")),{Packages:s}=l(d(e,"dist/src/Packages.js")),p=l(d(e,"dist/src/scip.js"));if(!i||!o||!s||!p.scip?.Document||!p.scip.Index)return{available:!1,reason:"scip-typescript document runtime has an unsupported module shape"};let c={packageVersion:t.packageVersion,typescript:n,Document:p.scip.Document,Index:p.scip.Index,FileIndexer:i,Input:o,Packages:s};return{available:!0,runtime:c,producerIdentity:k(c)}}catch(t){return{available:!1,reason:`scip-typescript document runtime unavailable: ${t instanceof Error?t.message:String(t)}`}}}function ue(){let t=j();return t.available?{available:!0,packageVersion:t.packageVersion,typescriptVersion:t.typescriptVersion,producerIdentity:t.producerIdentity}:t}function j(){try{let t=l.resolve("@sourcegraph/scip-typescript/package.json"),e=JSON.parse(m(t,"scip-typescript package manifest"));if(e.version!==M)return{available:!1,reason:`unsupported scip-typescript version ${String(e.version??"unknown")}; expected ${M}`};let r=R(t),n=l.resolve("typescript/package.json",{paths:[r]}),i=JSON.parse(m(n,"TypeScript package manifest"));return typeof i.version!="string"||!i.version?{available:!1,reason:"scip-typescript TypeScript compiler version is unavailable"}:{available:!0,packageRoot:r,packageVersion:e.version,typescriptVersion:i.version,producerIdentity:q(e.version,i.version)}}catch(t){return{available:!1,reason:`scip-typescript document producer unavailable: ${t instanceof Error?t.message:String(t)}`}}}function le(t){let e=t.runtime===void 0?X():t.runtime===null?{available:!1,reason:"scip-typescript document runtime unavailable"}:{available:!0,runtime:t.runtime,producerIdentity:k(t.runtime)};return e.available?{available:!0,emitter:new x(t,e.runtime)}:e}var x=class{producerIdentity;workspaceRoot;tsconfigPath;projectRoot;maxFileByteSize;runtime;host;config=null;includedFiles=new Set;program=null;checker=null;symbolTable=new Map;constructorTable=new Map;packages;fragments=new Map;stats={initializations:0,programUpdates:0,documentsEmitted:0,documentsRemoved:0,sourceNodesReused:0,sourceNodesReplaced:0,symbolEntriesPruned:0};constructor(e,r){this.workspaceRoot=d(e.workspaceRoot),this.tsconfigPath=d(this.workspaceRoot,e.tsconfigPath),this.projectRoot=e.projectRoot??J(this.workspaceRoot,R(this.tsconfigPath)),this.maxFileByteSize=e.maxFileByteSize??1024*1024,this.runtime=r,this.producerIdentity=k(r);let n=N(r.typescript,this.tsconfigPath);this.config=n,this.host=new I(r.typescript,n.options,this.workspaceRoot),this.packages=new r.Packages(this.projectRoot)}initialize(){let e=performance.now(),r=this.config??N(this.runtime.typescript,this.tsconfigPath);this.includedFiles=new Set(r.fileNames.map(g)),this.program=this.runtime.typescript.createProgram(r.fileNames,r.options,this.host.compilerHost),this.checker=this.program.getTypeChecker(),this.stats.initializations+=1;let n=[];for(let i of this.program.getSourceFiles())this.includedFiles.has(g(i.fileName))&&n.push(this.emitSourceFile(i));return this.result(n,e)}advance(e){if(!this.program||!this.checker||!this.config)return this.initializeAndAdvance(e);let r=performance.now(),n=f(e.modifiedFiles),i=f(e.affectedFiles);this.validateIncrementalPaths(n,i);let o=this.program,s=new Map;for(let c of n){let u=y(this.workspaceRoot,c),a=o.getSourceFile(u);if(!a)throw new Error(`modified TypeScript source is unavailable: ${c}`);s.set(c,a),this.stats.symbolEntriesPruned+=O(this.symbolTable,a),this.stats.symbolEntriesPruned+=O(this.constructorTable,a),this.host.invalidate(u)}this.program=this.runtime.typescript.createProgram(this.config.fileNames,this.config.options,this.host.compilerHost,o),this.checker=this.program.getTypeChecker(),this.stats.programUpdates+=1;for(let[c,u]of s)this.program.getSourceFile(y(this.workspaceRoot,c))===u?this.stats.sourceNodesReused+=1:this.stats.sourceNodesReplaced+=1;let p=i.map(c=>{let u=y(this.workspaceRoot,c),a=this.program.getSourceFile(u);if(!a)throw new Error(`affected TypeScript source is unavailable: ${c}`);return this.emitSourceFile(a)});return this.result(p,r)}fragment(e){return this.fragments.get(h(e))??null}snapshotStats(){return{...this.stats}}initializeAndAdvance(e){let r=this.initialize(),n=f(e.modifiedFiles),i=f(e.affectedFiles);this.validateIncrementalPaths(n,i);let o=new Set(i);return{...r,fragments:r.fragments.filter(s=>o.has(s.relativePath))}}validateIncrementalPaths(e,r){if(e.length===0)throw new Error("incremental TypeScript document update requires a modified file");if(r.length===0)throw new Error("incremental TypeScript document update requires an affected file");for(let n of e){let i=y(this.workspaceRoot,n);if(!this.program?.getSourceFile(i))throw new Error(`modified TypeScript dependency is unavailable to the configured project: ${n}`)}for(let n of r){let i=y(this.workspaceRoot,n);if(!this.includedFiles.has(g(i)))throw new Error(`affected TypeScript file is outside the configured project: ${n}`)}}emitSourceFile(e){if(!this.checker)throw new Error("TypeScript document emitter is not initialized");let r=h(_(this.workspaceRoot,e.fileName)),n=new this.runtime.Document({relative_path:r,occurrences:[]});if(new this.runtime.FileIndexer(this.checker,{cwd:this.workspaceRoot,projectRoot:this.projectRoot,projectDisplayName:this.projectRoot,maxFileByteSizeNumber:this.maxFileByteSize},new this.runtime.Input(e.fileName,e.getText()),n,this.symbolTable,this.constructorTable,this.packages,e).index(),this.stats.documentsEmitted+=1,n.occurrences.length===0)return this.fragments.delete(r),this.stats.documentsRemoved+=1,{relativePath:r,bytes:null,occurrences:0,symbols:n.symbols.length,referenceFragments:[]};let o=n.serializeBinary();return this.fragments.set(r,o),{relativePath:r,bytes:o,occurrences:n.occurrences.length,symbols:n.symbols.length,referenceFragments:K(r,n)}}result(e,r){return{producerIdentity:this.producerIdentity,fragments:e,durationMs:performance.now()-r,stats:this.snapshotStats()}}};function K(t,e){let r=new Map;for(let n of e.occurrences){if(!n.symbol||(n.symbol_roles&1)!==0||n.range.length<3)continue;let i=n.range[0],o=n.range[1];if(!Number.isInteger(i)||!Number.isInteger(o))continue;let s={targetSymbol:n.symbol,location:{file:t,line:i,column:o}};r.set(`${n.symbol}\0${i}\0${o}`,s)}return[...r.values()].sort((n,i)=>n.targetSymbol.localeCompare(i.targetSymbol)||n.location.line-i.location.line||n.location.column-i.location.column)}var I=class{compilerHost;sourceFiles=new Map;constructor(e,r,n){let i=e.createCompilerHost(r),o=i.getSourceFile.bind(i);this.compilerHost={...i,getCurrentDirectory:()=>n,getSourceFile:(s,p,c,u)=>{let a=g(s);if(this.sourceFiles.has(a))return this.sourceFiles.get(a);let P=o(s,p,c,u);return this.sourceFiles.set(a,P),P}}}invalidate(e){this.sourceFiles.delete(g(e))}};function N(t,e){let r=t.readConfigFile(e,t.sys.readFile);if(r.error)throw new Error(t.formatDiagnostics([r.error],t.createCompilerHost({})));let n=t.parseJsonConfigFileContent(r.config,t.sys,R(e)),i=n.errors.filter(o=>o.code!==18003);if(i.length>0)throw new Error(t.formatDiagnostics(i,t.createCompilerHost({})));return n}function k(t){return q(t.packageVersion,t.typescript.version)}function q(t,e){return`scip-typescript:${t}:typescript:${e}:document-adapter:${H}`}function J(t,e){return h(_(t,e))||"."}function y(t,e){if(Y(e))throw new Error(`expected a project-relative path: ${e}`);let r=d(t,e),n=t.endsWith(v)?t:`${t}${v}`;if(r!==t&&!r.startsWith(n))throw new Error(`path escapes the project root: ${e}`);return r}function f(t){return[...new Set(t.map(h))].sort()}function h(t){return t.split(v).join("/").replace(/^\.\//,"")}function g(t){return d(t)}function O(t,e){let r=0;for(let n of t.keys())if(W(n)){try{if(n.getSourceFile()!==e)continue}catch{continue}t.delete(n),r+=1}return r}function W(t){return!!(t&&typeof t=="object"&&"kind"in t&&"getSourceFile"in t)}export{ue as a,le as b,T as c,ne as d,ie as e,oe as f};
2
- //# sourceMappingURL=chunk-4LK5OIPW.js.map
1
+ import{d as F,f as w}from"./chunk-E7T22WET.js";import{u as S,v as D,x as b,y as E}from"./chunk-3F23W57G.js";import{h as m}from"./chunk-C3PPB2T5.js";import{createHash as V}from"crypto";import{dirname as B,join as A}from"path";var T=4,z=3,L=2,$="typescript-index";function ne(t){let e=A(t,$),r=D(e);return{...r,requestDir:r.legacyRequestDir}}function ie(t){let e=JSON.parse(t),r=e.protocolVersion,n=r===L,i=r===z;if(!n&&!i&&r!==T||typeof e.id!="string"||!e.id||typeof e.baseGeneration!="string"||!e.baseGeneration||typeof e.deadlineAtMs!="number"||!Number.isFinite(e.deadlineAtMs)||!U(e.request)||!n&&(e.mailboxVersion!==S||typeof e.operationKey!="string"||!/^[a-f0-9]{64}$/.test(e.operationKey)||e.id!==E(e.operationKey)||typeof e.clientId!="string"||!e.clientId||typeof e.enqueuedAtMs!="number"||!Number.isFinite(e.enqueuedAtMs)||e.deadlineAtMs<e.enqueuedAtMs))throw new Error("TypeScript index service received an invalid mailbox request.");if(!n){let s=e,p=b(i?"typescript-index-v3":"typescript-index-v4",{baseGeneration:s.baseGeneration,request:s.request});if(s.operationKey!==p)throw new Error("TypeScript index service received a mismatched mailbox operation identity.");return{...s,protocolVersion:T}}let o=b("typescript-index-v2",{id:e.id,baseGeneration:e.baseGeneration,request:e.request});return{protocolVersion:T,mailboxVersion:S,id:e.id,operationKey:o,clientId:"legacy-v2",enqueuedAtMs:e.deadlineAtMs,deadlineAtMs:e.deadlineAtMs,baseGeneration:e.baseGeneration,request:e.request}}function oe(t){try{let e=w(F(m(A(B(t),"meta.json"),"reindex metadata")));return e?V("sha256").update(e).digest("hex"):null}catch{return null}}function U(t){if(!t||typeof t!="object")return!1;let e=t,r=C(e.modifiedFiles)?e.modifiedFiles:null,n=C(e.affectedFiles)?e.affectedFiles:null;return e.kind==="emit-documents"&&typeof e.tsconfigPath=="string"&&!!e.tsconfigPath&&typeof e.projectArgument=="string"&&!!e.projectArgument&&typeof e.projectIdentity=="string"&&!!e.projectIdentity&&typeof e.producerIdentity=="string"&&!!e.producerIdentity&&r!==null&&r.length>0&&new Set(r).size===r.length&&n!==null&&n.length>0&&new Set(n).size===n.length}function C(t){return Array.isArray(t)&&t.every(e=>typeof e=="string"&&e.length>0)}import{createRequire as G}from"module";import{dirname as R,isAbsolute as Y,relative as _,resolve as d,sep as v}from"path";var l=G(import.meta.url),H=1,M="0.4.0";function X(){try{let t=j();if(!t.available)return t;let{packageRoot:e}=t,r=l.resolve("typescript",{paths:[e]}),n=l(r),{FileIndexer:i}=l(d(e,"dist/src/FileIndexer.js")),{Input:o}=l(d(e,"dist/src/Input.js")),{Packages:s}=l(d(e,"dist/src/Packages.js")),p=l(d(e,"dist/src/scip.js"));if(!i||!o||!s||!p.scip?.Document||!p.scip.Index)return{available:!1,reason:"scip-typescript document runtime has an unsupported module shape"};let c={packageVersion:t.packageVersion,typescript:n,Document:p.scip.Document,Index:p.scip.Index,FileIndexer:i,Input:o,Packages:s};return{available:!0,runtime:c,producerIdentity:k(c)}}catch(t){return{available:!1,reason:`scip-typescript document runtime unavailable: ${t instanceof Error?t.message:String(t)}`}}}function ue(){let t=j();return t.available?{available:!0,packageVersion:t.packageVersion,typescriptVersion:t.typescriptVersion,producerIdentity:t.producerIdentity}:t}function j(){try{let t=l.resolve("@sourcegraph/scip-typescript/package.json"),e=JSON.parse(m(t,"scip-typescript package manifest"));if(e.version!==M)return{available:!1,reason:`unsupported scip-typescript version ${String(e.version??"unknown")}; expected ${M}`};let r=R(t),n=l.resolve("typescript/package.json",{paths:[r]}),i=JSON.parse(m(n,"TypeScript package manifest"));return typeof i.version!="string"||!i.version?{available:!1,reason:"scip-typescript TypeScript compiler version is unavailable"}:{available:!0,packageRoot:r,packageVersion:e.version,typescriptVersion:i.version,producerIdentity:q(e.version,i.version)}}catch(t){return{available:!1,reason:`scip-typescript document producer unavailable: ${t instanceof Error?t.message:String(t)}`}}}function le(t){let e=t.runtime===void 0?X():t.runtime===null?{available:!1,reason:"scip-typescript document runtime unavailable"}:{available:!0,runtime:t.runtime,producerIdentity:k(t.runtime)};return e.available?{available:!0,emitter:new x(t,e.runtime)}:e}var x=class{producerIdentity;workspaceRoot;tsconfigPath;projectRoot;maxFileByteSize;runtime;host;config=null;includedFiles=new Set;program=null;checker=null;symbolTable=new Map;constructorTable=new Map;packages;fragments=new Map;stats={initializations:0,programUpdates:0,documentsEmitted:0,documentsRemoved:0,sourceNodesReused:0,sourceNodesReplaced:0,symbolEntriesPruned:0};constructor(e,r){this.workspaceRoot=d(e.workspaceRoot),this.tsconfigPath=d(this.workspaceRoot,e.tsconfigPath),this.projectRoot=e.projectRoot??J(this.workspaceRoot,R(this.tsconfigPath)),this.maxFileByteSize=e.maxFileByteSize??1024*1024,this.runtime=r,this.producerIdentity=k(r);let n=N(r.typescript,this.tsconfigPath);this.config=n,this.host=new I(r.typescript,n.options,this.workspaceRoot),this.packages=new r.Packages(this.projectRoot)}initialize(){let e=performance.now(),r=this.config??N(this.runtime.typescript,this.tsconfigPath);this.includedFiles=new Set(r.fileNames.map(g)),this.program=this.runtime.typescript.createProgram(r.fileNames,r.options,this.host.compilerHost),this.checker=this.program.getTypeChecker(),this.stats.initializations+=1;let n=[];for(let i of this.program.getSourceFiles())this.includedFiles.has(g(i.fileName))&&n.push(this.emitSourceFile(i));return this.result(n,e)}advance(e){if(!this.program||!this.checker||!this.config)return this.initializeAndAdvance(e);let r=performance.now(),n=f(e.modifiedFiles),i=f(e.affectedFiles);this.validateIncrementalPaths(n,i);let o=this.program,s=new Map;for(let c of n){let u=y(this.workspaceRoot,c),a=o.getSourceFile(u);if(!a)throw new Error(`modified TypeScript source is unavailable: ${c}`);s.set(c,a),this.stats.symbolEntriesPruned+=O(this.symbolTable,a),this.stats.symbolEntriesPruned+=O(this.constructorTable,a),this.host.invalidate(u)}this.program=this.runtime.typescript.createProgram(this.config.fileNames,this.config.options,this.host.compilerHost,o),this.checker=this.program.getTypeChecker(),this.stats.programUpdates+=1;for(let[c,u]of s)this.program.getSourceFile(y(this.workspaceRoot,c))===u?this.stats.sourceNodesReused+=1:this.stats.sourceNodesReplaced+=1;let p=i.map(c=>{let u=y(this.workspaceRoot,c),a=this.program.getSourceFile(u);if(!a)throw new Error(`affected TypeScript source is unavailable: ${c}`);return this.emitSourceFile(a)});return this.result(p,r)}fragment(e){return this.fragments.get(h(e))??null}snapshotStats(){return{...this.stats}}initializeAndAdvance(e){let r=this.initialize(),n=f(e.modifiedFiles),i=f(e.affectedFiles);this.validateIncrementalPaths(n,i);let o=new Set(i);return{...r,fragments:r.fragments.filter(s=>o.has(s.relativePath))}}validateIncrementalPaths(e,r){if(e.length===0)throw new Error("incremental TypeScript document update requires a modified file");if(r.length===0)throw new Error("incremental TypeScript document update requires an affected file");for(let n of e){let i=y(this.workspaceRoot,n);if(!this.program?.getSourceFile(i))throw new Error(`modified TypeScript dependency is unavailable to the configured project: ${n}`)}for(let n of r){let i=y(this.workspaceRoot,n);if(!this.includedFiles.has(g(i)))throw new Error(`affected TypeScript file is outside the configured project: ${n}`)}}emitSourceFile(e){if(!this.checker)throw new Error("TypeScript document emitter is not initialized");let r=h(_(this.workspaceRoot,e.fileName)),n=new this.runtime.Document({relative_path:r,occurrences:[]});if(new this.runtime.FileIndexer(this.checker,{cwd:this.workspaceRoot,projectRoot:this.projectRoot,projectDisplayName:this.projectRoot,maxFileByteSizeNumber:this.maxFileByteSize},new this.runtime.Input(e.fileName,e.getText()),n,this.symbolTable,this.constructorTable,this.packages,e).index(),this.stats.documentsEmitted+=1,n.occurrences.length===0)return this.fragments.delete(r),this.stats.documentsRemoved+=1,{relativePath:r,bytes:null,occurrences:0,symbols:n.symbols.length,referenceFragments:[]};let o=n.serializeBinary();return this.fragments.set(r,o),{relativePath:r,bytes:o,occurrences:n.occurrences.length,symbols:n.symbols.length,referenceFragments:K(r,n)}}result(e,r){return{producerIdentity:this.producerIdentity,fragments:e,durationMs:performance.now()-r,stats:this.snapshotStats()}}};function K(t,e){let r=new Map;for(let n of e.occurrences){if(!n.symbol||(n.symbol_roles&1)!==0||n.range.length<3)continue;let i=n.range[0],o=n.range[1];if(!Number.isInteger(i)||!Number.isInteger(o))continue;let s={targetSymbol:n.symbol,location:{file:t,line:i,column:o}};r.set(`${n.symbol}\0${i}\0${o}`,s)}return[...r.values()].sort((n,i)=>n.targetSymbol.localeCompare(i.targetSymbol)||n.location.line-i.location.line||n.location.column-i.location.column)}var I=class{compilerHost;sourceFiles=new Map;constructor(e,r,n){let i=e.createCompilerHost(r),o=i.getSourceFile.bind(i);this.compilerHost={...i,getCurrentDirectory:()=>n,getSourceFile:(s,p,c,u)=>{let a=g(s);if(this.sourceFiles.has(a))return this.sourceFiles.get(a);let P=o(s,p,c,u);return this.sourceFiles.set(a,P),P}}}invalidate(e){this.sourceFiles.delete(g(e))}};function N(t,e){let r=t.readConfigFile(e,t.sys.readFile);if(r.error)throw new Error(t.formatDiagnostics([r.error],t.createCompilerHost({})));let n=t.parseJsonConfigFileContent(r.config,t.sys,R(e)),i=n.errors.filter(o=>o.code!==18003);if(i.length>0)throw new Error(t.formatDiagnostics(i,t.createCompilerHost({})));return n}function k(t){return q(t.packageVersion,t.typescript.version)}function q(t,e){return`scip-typescript:${t}:typescript:${e}:document-adapter:${H}`}function J(t,e){return h(_(t,e))||"."}function y(t,e){if(Y(e))throw new Error(`expected a project-relative path: ${e}`);let r=d(t,e),n=t.endsWith(v)?t:`${t}${v}`;if(r!==t&&!r.startsWith(n))throw new Error(`path escapes the project root: ${e}`);return r}function f(t){return[...new Set(t.map(h))].sort()}function h(t){return t.split(v).join("/").replace(/^\.\//,"")}function g(t){return d(t)}function O(t,e){let r=0;for(let n of t.keys())if(W(n)){try{if(n.getSourceFile()!==e)continue}catch{continue}t.delete(n),r+=1}return r}function W(t){return!!(t&&typeof t=="object"&&"kind"in t&&"getSourceFile"in t)}export{ue as a,le as b,T as c,ne as d,ie as e,oe as f};
2
+ //# sourceMappingURL=chunk-2ZBZRYX4.js.map
@@ -0,0 +1,2 @@
1
+ import{d as f,e as p}from"./chunk-OZI44VCR.js";import{execFileSync as y}from"child_process";import{platform as I}from"os";var S=1e3,T=2*1024*1024,M=1e4,E=25;function v(e,n,r=h){let t=r.readIdentity(e),o=new Map;return t&&o.set(e,t),{rootPid:e,rootIdentity:t,ownsProcessGroup:n,knownMembers:o}}async function k(e,n,r=h){if(!e.rootIdentity){let a=await l(e,n.gracefulMs+n.forceMs,r);return{reaped:a,reason:a?"terminated":"identity-unavailable",detail:a?void 0:`Could not establish the birth identity of process ${e.rootPid}.`}}let t=b(e,r);if(t==="mismatch")return{reaped:!1,reason:"identity-mismatch",detail:`Process ${e.rootPid} no longer has the identity owned by this runner.`};if(t==="exited"&&!g(e,r))return{reaped:!0,reason:"terminated"};if(r.platform==="win32"){try{r.terminateWindowsTree(e.rootPid)}catch(u){let c=await l(e,n.forceMs,r);return{reaped:c,reason:c?"terminated":"signal-failed",detail:c?void 0:m(u)}}let a=await l(e,n.forceMs,r);return{reaped:a,reason:a?"terminated":"deadline"}}let o=P(e,"SIGTERM",r);if(await l(e,n.gracefulMs,r))return{reaped:!0,reason:"terminated"};let s=P(e,"SIGKILL",r);return await l(e,n.forceMs,r)?{reaped:!0,reason:"terminated"}:s?{reaped:!1,reason:s.reason,detail:s.detail}:o?{reaped:!1,reason:o.reason,detail:o.detail}:{reaped:!1,reason:"deadline",detail:`Process tree ${e.rootPid} did not exit before its termination deadline.`}}function b(e,n){let r=n.readIdentity(e.rootPid);if(!r)return"exited";if(!e.rootIdentity||!f(e.rootIdentity,r))return"mismatch";e.knownMembers.set(e.rootPid,r);for(let t of n.listDescendantPids(e.rootPid)){let o=n.readIdentity(t);o&&e.knownMembers.set(t,o)}return"owned"}function P(e,n,r){let t=b(e,r);if(t==="mismatch")return{reason:"identity-mismatch",detail:`Process ${e.rootPid} changed identity before ${n}.`};if(t==="owned"&&e.ownsProcessGroup)try{return r.signal(-e.rootPid,n),null}catch(i){if(!w(i))return{reason:"signal-failed",detail:m(i)}}let o=null;for(let i of e.knownMembers.values()){let s=r.readIdentity(i.pid);if(!(!s||!f(i,s)))try{r.signal(i.pid,n)}catch(d){!w(d)&&o===null&&(o=m(d))}}return o===null?null:{reason:"signal-failed",detail:o}}async function l(e,n,r){let t=r.now()+n;for(;g(e,r);){if(r.now()>=t)return!1;await r.sleep(Math.min(E,Math.max(1,t-r.now())))}return!0}function g(e,n){if(!e.rootIdentity&&n.isProcessAlive(e.rootPid))return!0;for(let r of e.knownMembers.values()){let t=n.readIdentity(r.pid);if(t&&f(r,t))return!0}return!!(e.ownsProcessGroup&&n.isProcessGroupAlive(e.rootPid))}function R(e){let n=y("ps",["-axo","pid=,ppid="],{encoding:"utf8",timeout:S,maxBuffer:T,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0}),r=new Map;for(let s of n.split(/\r?\n/)){let d=/^\s*(\d+)\s+(\d+)\s*$/.exec(s);if(!d)continue;let a=Number(d[1]),u=Number(d[2]),c=r.get(u)??[];c.push(a),r.set(u,c)}let t=[],o=[...r.get(e)??[]],i=new Set;for(;o.length>0;){let s=o.pop();i.has(s)||(i.add(s),t.push(s),o.push(...r.get(s)??[]))}return t}function w(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ESRCH"}function m(e){return e instanceof Error?e.message:String(e)}var h={platform:I(),now:Date.now,readIdentity:p,isProcessAlive(e){try{return process.kill(e,0),!0}catch(n){return typeof n=="object"&&n!==null&&"code"in n&&n.code==="EPERM"}},isProcessGroupAlive(e){if(this.platform==="win32")return!1;try{return process.kill(-e,0),!0}catch(n){return typeof n=="object"&&n!==null&&"code"in n&&n.code==="EPERM"}},listDescendantPids(e){if(this.platform==="win32")return[];try{return R(e)}catch{return[]}},signal(e,n){process.kill(e,n)},terminateWindowsTree(e){y("taskkill.exe",["/PID",String(e),"/T","/F"],{timeout:M,maxBuffer:T,stdio:"ignore",windowsHide:!0})},async sleep(e){await new Promise(n=>setTimeout(n,e))}};export{v as a,k as b};
2
+ //# sourceMappingURL=chunk-33AXWMO2.js.map
@@ -1,4 +1,4 @@
1
- import{aa as b,ba as x,h as g}from"./chunk-UQYQBLJX.js";import{execFileSync as R,spawnSync as J}from"child_process";import{platform as H}from"os";import{resolve as W}from"path";import{createHash as C}from"crypto";import{existsSync as y,renameSync as L,rmSync as B,writeFileSync as D}from"fs";import{tmpdir as j}from"os";import{join as M}from"path";var I=`'use strict';
1
+ import{ea as b,fa as x,h as g}from"./chunk-C3PPB2T5.js";import{execFileSync as R,spawnSync as J}from"child_process";import{platform as H}from"os";import{resolve as W}from"path";import{createHash as C}from"crypto";import{existsSync as y,renameSync as L,rmSync as B,writeFileSync as D}from"fs";import{tmpdir as j}from"os";import{join as M}from"path";var I=`'use strict';
2
2
  const NativeRegExp = globalThis.RegExp;
3
3
  const escapeLoneSeparator = (args) =>
4
4
  typeof args[0] === 'string' && args[0] === '\\\\' ? ['\\\\\\\\', ...args.slice(1)] : args;
@@ -48,4 +48,4 @@ globalThis.RegExp = new Proxy(NativeRegExp, {
48
48
  FROM chunks c
49
49
  JOIN documents d ON d.id = c.document_id
50
50
  WHERE c.id IN (${o.map(()=>"?").join(",")})`,...o);for(let s of i){let c=A(s.occurrences);if(!c){for(let a of t.get(s.id)??[])r.set(a,null);continue}for(let a of c)(a.roles&1)===0&&r.get(a.symbol)?.push({relativePath:s.relative_path,occurrence:a})}}return r}function k(e){let n=[];for(let r=0;r<e.length;r+=750)n.push(e.slice(r,r+750));return n}export{Ie as a,T as b,he as c,_ as d,ke as e,Y as f,p as g,Ae as h,ne as i,re as j,Ce as k,Le as l,Be as m,je as n,Me as o,Fe as p,$e as q,He as r,Ge as s,Ke as t,Ze as u};
51
- //# sourceMappingURL=chunk-EQNMD62X.js.map
51
+ //# sourceMappingURL=chunk-37K55EG3.js.map
@@ -1,2 +1,2 @@
1
- import{c as t}from"./chunk-NCJILOAK.js";function i(r,s,e={}){let a=t(r,s,{families:["dataflow"],...e.maxDepth!==void 0?{maxDepth:e.maxDepth}:{},...e.maxEdges!==void 0?{maxEdges:e.maxEdges}:{}});return{kind:"value-flow",targets:a.targets,edges:a.edges,coverage:{status:a.coverage.status,basis:"proved-bounded-static-value-flow",analysisBasis:"partial-system-definition-use",providers:["bounded-static-value-flow","typescript-local-dependence"],supportedRelations:["compiler-identified local definitions reaching local reads through a TypeScript control-flow graph","right-hand-side local reads supplying assignments and declarations","candidate closure captures and bounded same-owner field flow with explicit evidence strength","direct argument-to-parameter forwarding at compiler-resolved calls","bounded mechanically derived static arguments","callee return value to a consumed compiler-resolved call result"],unsupportedRelations:["general heap alias and cross-instance field points-to flow","exceptional control and value flow","closure invocation order","downstream local definition-use after a call result","dynamic calls not resolved by the semantic provider"],graph:a.coverage}}}export{i as a};
2
- //# sourceMappingURL=chunk-ITSJMNUD.js.map
1
+ import{c as t}from"./chunk-PFMQRHC6.js";function i(r,s,e={}){let a=t(r,s,{families:["dataflow"],...e.maxDepth!==void 0?{maxDepth:e.maxDepth}:{},...e.maxEdges!==void 0?{maxEdges:e.maxEdges}:{}});return{kind:"value-flow",targets:a.targets,edges:a.edges,coverage:{status:a.coverage.status,basis:"proved-bounded-static-value-flow",analysisBasis:"partial-system-definition-use",providers:["bounded-static-value-flow","typescript-local-dependence"],supportedRelations:["compiler-identified local definitions reaching local reads through a TypeScript control-flow graph","right-hand-side local reads supplying assignments and declarations","candidate closure captures and bounded same-owner field flow with explicit evidence strength","direct argument-to-parameter forwarding at compiler-resolved calls","bounded mechanically derived static arguments","callee return value to a consumed compiler-resolved call result"],unsupportedRelations:["general heap alias and cross-instance field points-to flow","exceptional control and value flow","closure invocation order","downstream local definition-use after a call result","dynamic calls not resolved by the semantic provider"],graph:a.coverage}}}export{i as a};
2
+ //# sourceMappingURL=chunk-3EFZ5KQ4.js.map
@@ -1,4 +1,4 @@
1
- import{a as P,c as B,d as k,e as ue}from"./chunk-6O3KXIDL.js";import{e as ae,g as de,h as F,s as L,t as $,u as le,v as w,w as f,x as b}from"./chunk-UQYQBLJX.js";function me(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}}import{randomUUID as _e}from"crypto";import{closeSync as Ce,fsyncSync as qe,linkSync as $e,mkdirSync as je,openSync as Je,statSync as We,unlinkSync as Ke,writeSync as Ue}from"fs";import{dirname as U}from"path";var J="codebaseiq-process-lock",W=1,O=Object.freeze({wallNow:()=>Date.now(),isProcessAlive:me,readProcessIdentity:ue,randomToken:()=>_e(),makeDirectory:e=>je(e,{recursive:!0}),openFile:(e,r,t)=>Je(e,r,t),writeFile:(e,r,t,n)=>Ue(e,r,t,n),syncFile:e=>qe(e),closeFile:e=>Ce(e),linkFile:(e,r)=>$e(e,r),readFile:e=>F(e,"process lock record"),statFile:e=>{let r=We(e);return{dev:r.dev,ino:r.ino,size:r.size,mtimeMs:r.mtimeMs}},removeFile:e=>Ke(e)});function $r(e,r){let t=r.runtime??O;t.makeDirectory(U(e));let n;for(let i=0;i<2;i+=1)try{return{kind:"acquired",lock:fe(e,r,t),...n?{reclaimed:n}:{}}}catch(o){if(o.code!=="EEXIST")throw o;let s=R(e,{parseLegacy:r.parseLegacy,runtime:t});if(i===0&&Xe(e,s,{creationGraceMs:r.creationGraceMs,parseLegacy:r.parseLegacy,runtime:t})){n=s;continue}return{kind:"contended",observation:s}}return{kind:"contended",observation:R(e,{parseLegacy:r.parseLegacy,runtime:t})}}function R(e,r={}){let t=r.runtime??O,n,i;try{n=t.statFile(e),i=t.readFile(e)}catch(a){return a.code==="ENOENT"?{state:"missing"}:{state:"malformed"}}let o;try{o=JSON.parse(i)}catch{return{state:"malformed",raw:i,identity:n}}let s=ze(o);if(s)return{state:"valid",raw:i,identity:n,record:s,owner:He(s),parsed:o};let c=r.parseLegacy?.(o)??null;return c?{state:"legacy",raw:i,identity:n,owner:c,parsed:o}:{state:"malformed",raw:i,identity:n,parsed:o}}function ze(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;if(r.protocol!==J||r.version!==W||typeof r.kind!="string"||r.kind.trim()===""||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.token!="string"||r.token.trim()===""||typeof r.startedAt!="string"||!Number.isFinite(Date.parse(r.startedAt))||r.detail!==void 0&&(typeof r.detail!="object"||r.detail===null||Array.isArray(r.detail)))return null;let t=r.processIdentity===void 0?null:B(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{protocol:J,version:W,kind:r.kind,pid:r.pid,token:r.token,...t?{processIdentity:t}:{},startedAt:r.startedAt,...r.detail?{detail:r.detail}:{}}}function Xe(e,r,t={}){let n=t.runtime??O;if(!K(r,n))return!1;let i=Ve(`${e}.reclaim`,n);if(!i)return!1;try{let o=R(e,{parseLegacy:t.parseLegacy,runtime:n});return!pe(r,o)||!K(o,n)?!1:z(e,n)}finally{i.release()}}function fe(e,r,t){let n=r.pid??process.pid,i=t.randomToken(),o=r.processIdentity===void 0?t.readProcessIdentity(n):r.processIdentity,s={protocol:J,version:W,kind:r.kind,pid:n,token:i,...o?{processIdentity:o}:{},startedAt:new Date(t.wallNow()).toISOString(),...r.detail?{detail:r.detail}:{}},c=`${e}.${i}.candidate`,a=t.openFile(c,"wx",384),d;try{L(a,Buffer.from(`${JSON.stringify(s)}
1
+ import{a as P,c as B,d as k,e as ue}from"./chunk-OZI44VCR.js";import{e as ae,g as de,h as F,s as L,t as $,u as le,v as w,w as f,x as b}from"./chunk-C3PPB2T5.js";function me(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}}import{randomUUID as _e}from"crypto";import{closeSync as Ce,fsyncSync as qe,linkSync as $e,mkdirSync as je,openSync as Je,statSync as We,unlinkSync as Ke,writeSync as Ue}from"fs";import{dirname as U}from"path";var J="codebaseiq-process-lock",W=1,O=Object.freeze({wallNow:()=>Date.now(),isProcessAlive:me,readProcessIdentity:ue,randomToken:()=>_e(),makeDirectory:e=>je(e,{recursive:!0}),openFile:(e,r,t)=>Je(e,r,t),writeFile:(e,r,t,n)=>Ue(e,r,t,n),syncFile:e=>qe(e),closeFile:e=>Ce(e),linkFile:(e,r)=>$e(e,r),readFile:e=>F(e,"process lock record"),statFile:e=>{let r=We(e);return{dev:r.dev,ino:r.ino,size:r.size,mtimeMs:r.mtimeMs}},removeFile:e=>Ke(e)});function $r(e,r){let t=r.runtime??O;t.makeDirectory(U(e));let n;for(let i=0;i<2;i+=1)try{return{kind:"acquired",lock:fe(e,r,t),...n?{reclaimed:n}:{}}}catch(o){if(o.code!=="EEXIST")throw o;let s=R(e,{parseLegacy:r.parseLegacy,runtime:t});if(i===0&&Xe(e,s,{creationGraceMs:r.creationGraceMs,parseLegacy:r.parseLegacy,runtime:t})){n=s;continue}return{kind:"contended",observation:s}}return{kind:"contended",observation:R(e,{parseLegacy:r.parseLegacy,runtime:t})}}function R(e,r={}){let t=r.runtime??O,n,i;try{n=t.statFile(e),i=t.readFile(e)}catch(a){return a.code==="ENOENT"?{state:"missing"}:{state:"malformed"}}let o;try{o=JSON.parse(i)}catch{return{state:"malformed",raw:i,identity:n}}let s=ze(o);if(s)return{state:"valid",raw:i,identity:n,record:s,owner:He(s),parsed:o};let c=r.parseLegacy?.(o)??null;return c?{state:"legacy",raw:i,identity:n,owner:c,parsed:o}:{state:"malformed",raw:i,identity:n,parsed:o}}function ze(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;if(r.protocol!==J||r.version!==W||typeof r.kind!="string"||r.kind.trim()===""||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.token!="string"||r.token.trim()===""||typeof r.startedAt!="string"||!Number.isFinite(Date.parse(r.startedAt))||r.detail!==void 0&&(typeof r.detail!="object"||r.detail===null||Array.isArray(r.detail)))return null;let t=r.processIdentity===void 0?null:B(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{protocol:J,version:W,kind:r.kind,pid:r.pid,token:r.token,...t?{processIdentity:t}:{},startedAt:r.startedAt,...r.detail?{detail:r.detail}:{}}}function Xe(e,r,t={}){let n=t.runtime??O;if(!K(r,n))return!1;let i=Ve(`${e}.reclaim`,n);if(!i)return!1;try{let o=R(e,{parseLegacy:t.parseLegacy,runtime:n});return!pe(r,o)||!K(o,n)?!1:z(e,n)}finally{i.release()}}function fe(e,r,t){let n=r.pid??process.pid,i=t.randomToken(),o=r.processIdentity===void 0?t.readProcessIdentity(n):r.processIdentity,s={protocol:J,version:W,kind:r.kind,pid:n,token:i,...o?{processIdentity:o}:{},startedAt:new Date(t.wallNow()).toISOString(),...r.detail?{detail:r.detail}:{}},c=`${e}.${i}.candidate`,a=t.openFile(c,"wx",384),d;try{L(a,Buffer.from(`${JSON.stringify(s)}
2
2
  `),t,"process lock"),t.syncFile(a)}catch(y){d=y}try{t.closeFile(a)}catch(y){d??=y}if(d!==void 0)throw j(c,t),d;try{t.linkFile(c,e)}catch(y){throw j(c,t),y}j(c,t);try{be(U(e),t)}catch(y){throw ye(e,s,t),y}let l=!1;return{path:e,record:s,release:()=>l?!1:(l=!0,ye(e,s,t))}}function ye(e,r,t=O){let n=R(e,{runtime:t});return n.state!=="valid"||!n.record||n.record.pid!==r.pid||n.record.token!==r.token||r.processIdentity&&(!n.record.processIdentity||!k(r.processIdentity,n.record.processIdentity))?!1:z(e,t)}function Ve(e,r){for(let t=0;t<2;t+=1)try{return fe(e,{kind:"reclaim-guard",runtime:r},r)}catch(n){if(n.code!=="EEXIST")return null;let i=R(e,{runtime:r});if(t>0||!K(i,r))return null;let o=R(e,{runtime:r});if(!pe(i,o)||!z(e,r))return null}return null}function K(e,r){if(e.state==="missing")return!1;if(e.owner){if(!r.isProcessAlive(e.owner.pid))return!0;if(!e.owner.processIdentity)return!1;let t=r.readProcessIdentity(e.owner.pid);return t!==null&&!k(e.owner.processIdentity,t)}return!1}function pe(e,r){return e.state===r.state&&e.raw===r.raw&&e.identity!==void 0&&r.identity!==void 0&&e.identity.dev===r.identity.dev&&e.identity.ino===r.identity.ino&&e.identity.size===r.identity.size&&e.identity.mtimeMs===r.identity.mtimeMs}function He(e){return{pid:e.pid,...e.processIdentity?{processIdentity:e.processIdentity}:{}}}function be(e,r){let t;try{t=r.openFile(e,"r")}catch(n){if($(n,process.platform))return;throw n}try{r.syncFile(t)}catch(n){if(!$(n,process.platform))throw n}finally{r.closeFile(t)}}function z(e,r){try{return r.removeFile(e),be(U(e),r),!0}catch{return!1}}function j(e,r){try{r.removeFile(e)}catch{}}import{randomUUID as sr}from"crypto";import{closeSync as cr,existsSync as ar,fsyncSync as dr,linkSync as lr,mkdirSync as ur,openSync as mr,renameSync as yr,unlinkSync as fr,writeSync as pr}from"fs";import{dirname as we}from"path";var Ye=Object.freeze(["EPERM","EACCES","EBUSY"]),Ge=Object.freeze([10,20,40,80,160,320,640,1e3,1e3,1e3]);function Qe(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}var X=Object.freeze({platform:process.platform,sleep:Qe});function Ze(e,r){if(r!=="win32")return!1;let t=e?.code;return typeof t=="string"&&Ye.includes(t)}function ge(e,r={}){let t=r.runtime??X,n=r.delaysMs??Ge;for(let i of n)try{return e()}catch(o){if(!Ze(o,t.platform))throw o;t.sleep(i)}return e()}import{chmodSync as er,constants as rr,copyFileSync as tr}from"fs";import{dirname as nr}from"path";var xe=Object.freeze({...le,copyFile:(e,r)=>tr(e,r,rr.COPYFILE_FICLONE),chmodFile:(e,r)=>er(e,r)});function ir(e,r,t={}){let n=t.runtime??xe,i=nr(r),o=w(i,n);if(n.copyFile(e,r),n.platform==="win32")or(r,t.mode,n);else{t.mode!==void 0&&n.chmodFile(r,t.mode);let s=n.openFile(r,"r");try{n.syncFile(s)}finally{n.closeFile(s)}}return b(o,f(i,n))}function or(e,r,t){let n=!1,i;try{i=t.openFile(e,"r+")}catch(o){let s=o.code;if(s!=="EACCES"&&s!=="EPERM")throw o;t.chmodFile(e,384),n=!0,i=t.openFile(e,"r+")}try{t.syncFile(i)}finally{t.closeFile(i)}r!==void 0?t.chmodFile(e,r):n&&t.chmodFile(e,292)}var Me=Object.freeze({platform:process.platform,randomToken:()=>sr(),pathExists:e=>ar(e),makeDirectory:e=>ur(e,{recursive:!0}),openFile:(e,r,t)=>mr(e,r,t),writeFile:(e,r,t,n)=>pr(e,r,t,n),syncFile:e=>dr(e),closeFile:e=>cr(e),renameFile:(e,r)=>yr(e,r),linkFile:(e,r)=>lr(e,r),removeFile:e=>fr(e)});function V(e,r,t={}){let n=t.durability??"visibility",i=t.runtime??Me,o=we(e),s=n==="durable"?w(o,i):(i.makeDirectory(o),"not-requested"),c=`${e}.tmp-${i.randomToken()}`,a=typeof r=="string"?Buffer.from(r):r,d,l=!1;try{d=i.openFile(c,"wx",t.mode??384),l=!0,L(d,a,i,"atomic file"),n==="durable"&&i.syncFile(d),i.closeFile(d),d=void 0,ge(()=>i.renameFile(c,e),{runtime:{platform:i.platform,sleep:i.sleep??X.sleep}}),l=!1;let y=n==="durable"?b(s,f(o,i)):"not-requested";return Fe(n,y)}finally{if(d!==void 0)try{i.closeFile(d)}catch{}if(l)try{i.removeFile(c)}catch{}}}function N(e,r,t={}){let n=t.durability??"visibility",i=t.runtime??Me;if(!i.linkFile)throw new Error("Exclusive atomic file publication requires hard-link support.");let o=we(e),s=n==="durable"?w(o,i):(i.makeDirectory(o),"not-requested"),c=`${e}.tmp-${i.randomToken()}`,a=typeof r=="string"?Buffer.from(r):r,d,l=!1;try{d=i.openFile(c,"wx",t.mode??384),l=!0,L(d,a,i,"exclusive atomic file"),n==="durable"&&i.syncFile(d),i.closeFile(d),d=void 0,i.linkFile(c,e);let y=n==="durable"?f(o,i):"not-requested";i.removeFile(c),l=!1;let u=n==="durable"?b(s,y,f(o,i)):"not-requested";return Fe(n,u)}finally{if(d!==void 0)try{i.closeFile(d)}catch{}if(l)try{i.removeFile(c)}catch{}}}function Fe(e,r){return{requestedDurability:e,achievedDurability:e==="visibility"?"visibility":r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function nt(e,r,t={}){V(e,he(r,t),{durability:"visibility",runtime:t.runtime})}function H(e,r,t={}){return V(e,he(r,t),{durability:"durable",runtime:t.runtime})}function he(e,r){let t=JSON.stringify(e,null,r.spacing);return r.trailingNewline?`${t}
3
3
  `:t}import{createHash as Y,randomUUID as Ae}from"crypto";import{existsSync as M,lstatSync as D,readdirSync as I,renameSync as G,rmSync as g}from"fs";import{basename as A,dirname as Q,join as m}from"path";function T(e){return Array.isArray(e)?`[${e.map(T).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([r],[t])=>r.localeCompare(t)).map(([r,t])=>`${JSON.stringify(r)}:${T(t)}`).join(",")}}`:JSON.stringify(e)}var Z=1,br=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}),x=class extends Error{constructor(t,n,i,o){let s=t==="item-too-large"?`request is ${o} bytes; per-item limit is ${i.maxItemBytes}`:t==="item-capacity"?`mailbox has ${n.totalItems} retained items; limit is ${i.maxItems}`:t==="byte-capacity"?`mailbox retains ${n.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=t;this.status=n;this.limits=i;this.attemptedBytes=o;this.name="MailboxBackpressureError"}code;status;limits;attemptedBytes},Ee=".owner.json",ee={isProcessAlive:()=>!0,readProcessIdentity:()=>null};function pt(e){return{rootDir:e,pendingDir:m(e,"pending"),inflightDir:m(e,"inflight"),responseDir:m(e,"responses"),deadLetterDir:m(e,"dead-letter"),legacyRequestDir:m(e,"requests")}}function S(e={}){let r={...br,...e};for(let[t,n]of Object.entries(r))if(!Number.isFinite(n)||n<=0||!Number.isInteger(n))throw new Error(`Mailbox limit ${t} must be a positive integer.`);return r}function C(e){let r=[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir].map(t=>w(t));return b(...r)}function bt(e,r){return Y("sha256").update(T({namespace:e,payload:r})).digest("hex")}function gr(e){if(!/^[a-f0-9]{64}$/.test(e))throw new Error("Mailbox operation keys must be lowercase SHA-256 identities.");return`op-${e}`}function gt(e,r,t={}){let n=S(t.limits),i=t.nowMs??Date.now(),o=C(e);return Sr(r),te(e,n,t.admissionLockTimeoutMs??2e3,t.monotonicNow??P,()=>{re(e,i,n);let s=m(e.pendingDir,`${r.id}.json`),c=m(e.responseDir,`${r.id}.json`),a=Ie(e,r.id);if(a){let u=ke(a,r.operationKey,r.id);return{disposition:"duplicate",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:u.deadlineAtMs??r.deadlineAtMs}}let d=`${JSON.stringify(r)}
4
4
  `,l=Buffer.byteLength(d),y=q(e);if(l>n.maxItemBytes)throw new x("item-too-large",y,n,l);if(y.totalItems+1>n.maxItems)throw new x("item-capacity",y,n,l);if(y.totalBytes+l>n.maxBytes)throw new x("byte-capacity",y,n,l);t.onBeforePublish?.();try{let u=N(s,d,{durability:"durable"}),p=b(o,u.directorySync);return{disposition:"accepted",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:r.deadlineAtMs,achievedDurability:p==="synced"?"directory-durable":"file-flushed",directorySync:p}}catch(u){if(u.code!=="EEXIST")throw u;let p=Ie(e,r.id);if(!p)throw u;let v=ke(p,r.operationKey,r.id);return{disposition:"duplicate",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:v.deadlineAtMs??r.deadlineAtMs}}})}function xr(e,r){if(!r.ownerId.trim())throw new Error("Mailbox claim owner identity is required.");if(r.owner&&(!Number.isSafeInteger(r.owner.pid)||r.owner.pid<=0||r.owner.processIdentity!==void 0&&r.owner.processIdentity.pid!==r.owner.pid))throw new Error("Mailbox claim process identity is invalid.");let t=r.nowMs??Date.now(),n=S(r.limits),i=C(e);try{return te(e,n,2e3,r.monotonicNow??P,()=>wr(e,r.ownerId,t,n,r.liveness??ee,r.owner??{pid:process.pid},i,r.onClaimStage))}catch(o){if(o instanceof x&&o.code==="admission-busy")return[];throw o}}function xt(e,r){return!Se(e.pendingDir)&&!Se(e.legacyRequestDir)?[]:xr(e,r)}function wr(e,r,t,n,i,o,s,c){re(e,t,n,i);let a=m(e.inflightDir,_(r)),d=[...Re(e.pendingDir,!1),...Re(e.legacyRequestDir,!0)].sort((u,p)=>u.orderAtMs-p.orderAtMs||u.header.id.localeCompare(p.header.id)||u.path.localeCompare(p.path)),l=s;d.length>0&&(l=b(l,w(a)),c?.("after-owner-directory-durable"),Rr(a,r,o),c?.("after-owner-record-published"));let y=[];for(let u of d){if(y.length>=n.maxBatch)break;let p=m(e.responseDir,`${u.header.id}.json`);if(M(p)){g(u.path,{force:!0});continue}let v=Math.max(t+n.claimLeaseMs,(u.header.deadlineAtMs??t)+5e3),Be=`${_(u.originalFile)}.${v}.claim`,oe=m(a,Be);try{G(u.path,oe)}catch(se){let ce=se.code;if(ce==="ENOENT"||ce==="EEXIST")continue;throw se}c?.("after-claim-renamed");let Oe=f(Q(u.path));c?.("after-source-directory-synced");let Ne=f(a);c?.("after-destination-directory-synced");let Te=b(l,Oe,Ne);y.push({requestId:u.header.id,ownerId:r,path:oe,originalFile:u.originalFile,claimedAtMs:t,claimExpiresAtMs:v,byteLength:u.byteLength,...u.header.operationKey?{operationKey:u.header.operationKey}:{},...u.header.clientId?{clientId:u.header.clientId}:{},...u.header.enqueuedAtMs===void 0?{}:{enqueuedAtMs:u.header.enqueuedAtMs},...u.header.deadlineAtMs===void 0?{}:{deadlineAtMs:u.header.deadlineAtMs},legacy:u.legacy,directorySync:Te})}return y}function wt(e,r={}){let t=S(r);if(e.byteLength>t.maxItemBytes)throw new x("item-too-large",{pending:0,inflight:1,responses:0,deadLetters:0,invalid:0,totalItems:1,totalBytes:e.byteLength},t,e.byteLength);return de(e.path,{maxBytes:t.maxItemBytes,inputKind:"bounded mailbox item"})}function Mr(e,r,t,n={}){let i=n.nowMs??Date.now(),o=S(n.limits),s={...t,mailboxVersion:Z,operationKey:r.operationKey??`legacy-${r.requestId}`,clientId:r.clientId??"legacy",...r.deadlineAtMs===void 0?{}:{deadlineAtMs:r.deadlineAtMs},completedAtMs:i,expiresAtMs:i+o.responseRetentionMs},c=Buffer.byteLength(`${JSON.stringify(s)}
@@ -6,4 +6,4 @@ import{a as P,c as B,d as k,e as ue}from"./chunk-6O3KXIDL.js";import{e as ae,g a
6
6
  `),l=q(e);l.totalItems<s.maxItems&&l.totalBytes+d<=s.maxBytes&&H(c,a,{spacing:2,trailingNewline:!0})}}function Ft(e,r={}){let t=r.nowMs??Date.now(),n=S(r.limits);return C(e),te(e,n,2e3,r.monotonicNow??P,()=>re(e,t,n,r.liveness??ee))}function re(e,r,t,n=ee){let i={reclaimed:0,completedClaimsRemoved:0,responsesRemoved:0,deadLettersRemoved:0,temporaryFilesRemoved:0},o=t.cleanupBatch;for(let s of ie(e.inflightDir)){if(o<=0)break;let c=m(e.responseDir,`${s.requestId}.json`);if(M(c)){g(s.path,{force:!0}),i.completedClaimsRemoved++,o--;continue}if(s.claimExpiresAtMs>r||Dr(e,s.ownerId,n)!=="dead")continue;let a=m(e.pendingDir,s.originalFile);try{G(s.path,a),i.reclaimed++}catch(d){if(d.code!=="EEXIST")throw d;g(s.path,{force:!0})}f(Q(s.path)),f(e.pendingDir),o--}o=De(e.responseDir,o,(s,c)=>c+t.responseRetentionMs,r,()=>{i.responsesRemoved++}),o=De(e.deadLetterDir,o,(s,c)=>c+t.deadLetterRetentionMs,r,()=>{i.deadLettersRemoved++});for(let s of[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir]){if(o<=0)break;for(let c of Pe(s)){if(o<=0)break;A(c).includes(".tmp-")&&(D(c).mtimeMs+t.temporaryRetentionMs>r||(g(c,{force:!0}),i.temporaryFilesRemoved++,o--))}}return Lr(e.inflightDir),i}function q(e){C(e);let r=[...h(e.pendingDir).map(a=>({path:a,pending:!0})),...h(e.legacyRequestDir).map(a=>({path:a,pending:!0}))],t=ie(e.inflightDir).map(a=>({path:a.path,pending:!1})),n=h(e.responseDir).map(a=>({path:a,pending:!1})),i=h(e.deadLetterDir).map(a=>({path:a,pending:!1})),o=[...r,...t,...n,...i],s=0,c;for(let a of r){let d=E(a.path);if(!d){s++;continue}let l=d.enqueuedAtMs??D(a.path).mtimeMs;c=c===void 0?l:Math.min(c,l)}return{pending:r.length,inflight:t.length,responses:n.length,deadLetters:i.length,invalid:s,totalItems:o.length,totalBytes:o.reduce((a,d)=>a+Ar(d.path),0),...c===void 0?{}:{oldestPendingAt:new Date(c).toISOString()}}}function Fr(e,r,t){let n=m(e.responseDir,`${r.requestId}.json`),i=`${JSON.stringify(t)}
7
7
  `;try{N(n,i,{durability:"durable"})}catch(o){if(o.code!=="EEXIST")throw o;let s=E(n),c=r.operationKey??`legacy-${r.requestId}`;if(s?.operationKey!==c)throw new Error(`Mailbox completion ${r.requestId} conflicts with an existing operation.`,{cause:o})}}function te(e,r,t,n,i){let o=m(e.rootDir,".admission.lock"),s=`${process.pid}-${Ae()}`,c=n()+Math.max(0,t);for(;!hr(e.rootDir,o,s);){if(Ir(o),n()>=c)throw new x("admission-busy",q(e),r,0);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,5)}try{return i()}finally{try{ne(o).ownerToken===s&&(g(o,{recursive:!0,force:!0}),f(e.rootDir))}catch{}}}function hr(e,r,t){let n=`${JSON.stringify({ownerToken:t,pid:process.pid,acquiredAtMs:Date.now()})}
8
8
  `;try{return N(r,n,{durability:"durable"}),!0}catch(i){if(i.code==="EEXIST")return!1;try{ne(r).ownerToken===t&&(g(r,{force:!0}),f(e))}catch{}throw i}}function Ir(e){let r=null;try{let n=ne(e);typeof n.ownerToken=="string"&&Number.isSafeInteger(n.pid)&&Number(n.pid)>0&&(r=Number(n.pid))}catch{}if(r===null||kr(r))return;let t=`${e}.stale-${Ae()}`;try{G(e,t)}catch(n){let i=n.code;if(i==="ENOENT"||i==="EEXIST")return;throw n}g(t,{recursive:!0,force:!0})}function ne(e){try{return JSON.parse(F(e,"mailbox lock record"))}catch(r){if(r.code!=="EISDIR"&&!(r instanceof ae&&r.reason==="not-regular"))throw r;return JSON.parse(F(m(e,"owner.json"),"mailbox lock owner record"))}}function kr(e){try{return process.kill(e,0),!0}catch(r){let t=r.code;return t==="EPERM"||t!=="ESRCH"}}function Rr(e,r,t){let n=m(e,Ee),i=t.processIdentity,o=ve(n);if(!(o&&o.ownerId===r&&o.pid===t.pid&&(!o.processIdentity&&!i||o.processIdentity&&i&&k(o.processIdentity,i)))){if(h(e).some(s=>s.endsWith(".claim")))throw new Error(`Mailbox owner identity ${r} collides with retained work from another process instance.`);H(n,{version:1,ownerId:r,pid:t.pid,...i?{processIdentity:i}:{}})}}function Dr(e,r,t){let n=ve(m(e.inflightDir,_(r),Ee));if(!n)return"unknown";if(!t.isProcessAlive(n.pid))return"dead";if(!n.processIdentity)return"live";let i=t.readProcessIdentity(n.pid);return i?k(n.processIdentity,i)?"live":"dead":"unknown"}function ve(e){try{let r=JSON.parse(F(e,"mailbox owner record"));if(r.version!==1||typeof r.ownerId!="string"||!r.ownerId||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0)return null;let t=r.processIdentity===void 0?null:B(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{version:1,ownerId:r.ownerId,pid:r.pid,...t?{processIdentity:t}:{}}}catch{return null}}function Ie(e,r){for(let t of[m(e.pendingDir,`${r}.json`),m(e.legacyRequestDir,`${r}.json`),m(e.responseDir,`${r}.json`)])if(M(t))return t;for(let t of ie(e.inflightDir))if(t.requestId===r)return t.path;return null}function ke(e,r,t){let n=E(e);if(!n||n.operationKey!==r)throw new Error(`Mailbox operation ${t} conflicts with an existing retained record.`);return n}function Sr(e){if(e.mailboxVersion!==Z||e.id!==gr(e.operationKey)||!e.clientId.trim()||!Number.isFinite(e.enqueuedAtMs)||!Number.isFinite(e.deadlineAtMs)||e.deadlineAtMs<e.enqueuedAtMs)throw new Error("Mailbox request has an invalid lifecycle identity.")}function Re(e,r){return h(e).filter(t=>t.endsWith(".json")).map(t=>{let n=D(t),i=A(t,".json"),o=E(t)??{id:i};return{path:t,originalFile:A(t),header:o,byteLength:n.size,orderAtMs:o.enqueuedAtMs??n.mtimeMs,legacy:r}})}function ie(e){if(!M(e))return[];let r=[];for(let t of I(e,{withFileTypes:!0})){if(!t.isDirectory())continue;let n=Le(t.name);if(n===null)continue;let i=m(e,t.name);for(let o of I(i,{withFileTypes:!0})){if(!o.isFile()||!o.name.endsWith(".claim"))continue;let s=/^(.*)\.(\d+)\.claim$/.exec(o.name);if(!s)continue;let c=Le(s[1]),a=Number(s[2]);if(c===null||A(c)!==c||!c.endsWith(".json")||!Number.isSafeInteger(a))continue;let d=m(i,o.name),l=E(d)??{id:A(c,".json")},y=D(d);r.push({requestId:l.id,ownerId:n,path:d,originalFile:c,claimedAtMs:y.mtimeMs,claimExpiresAtMs:a,byteLength:y.size,...l.operationKey?{operationKey:l.operationKey}:{},...l.clientId?{clientId:l.clientId}:{},...l.enqueuedAtMs===void 0?{}:{enqueuedAtMs:l.enqueuedAtMs},...l.deadlineAtMs===void 0?{}:{deadlineAtMs:l.deadlineAtMs},legacy:l.operationKey===void 0})}}return r.sort((t,n)=>t.claimedAtMs-n.claimedAtMs||t.path.localeCompare(n.path))}function E(e){try{let r=JSON.parse(F(e,"mailbox record"));return typeof r.id!="string"||!r.id?null:{id:r.id,...typeof r.operationKey=="string"?{operationKey:r.operationKey}:{},...typeof r.clientId=="string"?{clientId:r.clientId}:{},...typeof r.enqueuedAtMs=="number"?{enqueuedAtMs:r.enqueuedAtMs}:{},...typeof r.deadlineAtMs=="number"?{deadlineAtMs:r.deadlineAtMs}:{}}}catch{return null}}function De(e,r,t,n,i){for(let o of h(e)){if(r<=0)break;let s=D(o);t(o,s.mtimeMs)>n||(g(o,{force:!0}),i(),r--)}return r}function h(e){return M(e)?I(e,{withFileTypes:!0}).filter(r=>r.isFile()).map(r=>m(e,r.name)).sort():[]}function Se(e){try{return I(e).some(r=>r.endsWith(".json"))}catch{return!1}}function Pe(e){if(!M(e))return[];let r=[];for(let t of I(e,{withFileTypes:!0})){let n=m(e,t.name);t.isFile()?r.push(n):t.isDirectory()&&r.push(...Pe(n))}return r.sort()}function Lr(e){if(M(e))for(let r of I(e,{withFileTypes:!0})){if(!r.isDirectory())continue;let t=m(e,r.name);I(t).some(n=>n.endsWith(".claim"))||g(t,{recursive:!0,force:!0})}}function Ar(e){try{return D(e).size}catch{return 0}}function _(e){return Buffer.from(e,"utf8").toString("base64url")}function Le(e){try{let r=Buffer.from(e,"base64url").toString("utf8");return _(r)===e?r:null}catch{return null}}function Er(e){return/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)?e:`invalid-${Y("sha256").update(e).digest("hex")}`}function vr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function It(e){return typeof e=="string"&&Number.isFinite(Date.parse(e))}function kt(e){return vr(e)&&Object.values(e).every(r=>typeof r=="string"||r===null)}function Rt(e){return typeof e=="string"&&e.length>0}function Dt(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function St(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}function Lt(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/u.test(e)}function At(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}export{vr as a,It as b,kt as c,Rt as d,Dt as e,St as f,Lt as g,At as h,ge as i,me as j,O as k,$r as l,R as m,Xe as n,ir as o,V as p,N as q,nt as r,H as s,T as t,Z as u,pt as v,C as w,bt as x,gr as y,gt as z,xt as A,wt as B,Mr as C,Mt as D,Ft as E,q as F};
9
- //# sourceMappingURL=chunk-D7DOB27N.js.map
9
+ //# sourceMappingURL=chunk-3F23W57G.js.map