codebaseiq 0.1.0 → 0.2.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 (422) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/{chunk-DQMDCD24.js → chunk-27PHVDKL.js} +2 -2
  4. package/dist/{chunk-ZMI2JSX2.js → chunk-2DMVFAY7.js} +2 -2
  5. package/dist/{chunk-5PUWMSDU.js → chunk-2E6BTWER.js} +2 -2
  6. package/dist/{chunk-YESXMKX3.js → chunk-2F5ERMNI.js} +2 -2
  7. package/dist/chunk-2VKB5CMA.js +60 -0
  8. package/dist/{chunk-NNJ2KZZG.js → chunk-327YK6TB.js} +4 -4
  9. package/dist/chunk-347TXATM.js +2 -0
  10. package/dist/{chunk-VEXUL62T.js → chunk-35YYZD3D.js} +2 -2
  11. package/dist/chunk-36WRYYTE.js +3 -0
  12. package/dist/chunk-37TKC6MB.js +2 -0
  13. package/dist/{chunk-FAJQ7LWY.js → chunk-3AC56WAR.js} +2 -2
  14. package/dist/{chunk-JE3WZ6II.js → chunk-3NUZVLR7.js} +2 -2
  15. package/dist/{chunk-UZGZB3VB.js → chunk-3XFJUWJE.js} +2 -2
  16. package/dist/{chunk-OVTS4DKB.js → chunk-4AOOSCZ7.js} +2 -2
  17. package/dist/{chunk-LU3BMVH2.js → chunk-4IFISPQW.js} +2 -2
  18. package/dist/chunk-4NHWNAWQ.js +11 -0
  19. package/dist/chunk-4O52YNKL.js +5 -0
  20. package/dist/{chunk-HPJRBHVT.js → chunk-54K6556S.js} +2 -2
  21. package/dist/{chunk-HRWGYWRJ.js → chunk-57GCCPLS.js} +2 -2
  22. package/dist/{chunk-J77SU6VA.js → chunk-57KEZDPT.js} +2 -2
  23. package/dist/{chunk-OFBE4NGP.js → chunk-57KFVPVZ.js} +2 -2
  24. package/dist/{chunk-WOQBZPIF.js → chunk-5BDK6QC3.js} +2 -2
  25. package/dist/{chunk-7MGU3HPH.js → chunk-5IO2APSS.js} +2 -2
  26. package/dist/chunk-5NJPH3QZ.js +61 -0
  27. package/dist/{chunk-GW6Z3WGY.js → chunk-5WXOEJ4G.js} +2 -2
  28. package/dist/chunk-5XEVXVTK.js +3 -0
  29. package/dist/{chunk-RR7SX44N.js → chunk-6OVNYYY4.js} +2 -2
  30. package/dist/{chunk-ZV3JV5G5.js → chunk-6SDEQTVY.js} +2 -2
  31. package/dist/{chunk-EF2R3WNQ.js → chunk-6URCE5QY.js} +2 -2
  32. package/dist/{chunk-UCD3H3UZ.js → chunk-6ZV5EDUT.js} +2 -2
  33. package/dist/{chunk-C6SBF2WH.js → chunk-77GHPR2R.js} +2 -2
  34. package/dist/{chunk-YVCIMIOC.js → chunk-7R64XY4Y.js} +2 -2
  35. package/dist/{chunk-VXYS3FZD.js → chunk-7Z7HCZ7J.js} +2 -2
  36. package/dist/{chunk-CO5R3UNA.js → chunk-A67HT5FR.js} +2 -2
  37. package/dist/{chunk-UDS562V4.js → chunk-A7XQT7MH.js} +2 -2
  38. package/dist/{chunk-RDBI2RXU.js → chunk-ACZDU5GK.js} +2 -2
  39. package/dist/{chunk-FETNQCFO.js → chunk-AM5SUGHF.js} +2 -2
  40. package/dist/{chunk-NNOKTMZT.js → chunk-B2E3HZ2A.js} +2 -2
  41. package/dist/{chunk-CVYSU6BX.js → chunk-BH5CE4LN.js} +2 -2
  42. package/dist/chunk-BLKYYQ7C.js +543 -0
  43. package/dist/{chunk-4WKDMDEW.js → chunk-BX2U3QQV.js} +2 -2
  44. package/dist/{chunk-ZKX2FRS6.js → chunk-CANBLFVQ.js} +2 -2
  45. package/dist/{chunk-SMRBZ6EC.js → chunk-CCRZLRWJ.js} +2 -2
  46. package/dist/chunk-CDWSLAPN.js +21 -0
  47. package/dist/chunk-CIVYHK7U.js +22 -0
  48. package/dist/{chunk-L57ZKWVG.js → chunk-CMXW7MFV.js} +2 -2
  49. package/dist/{chunk-T3DGWPXM.js → chunk-CSZOQ7YO.js} +2 -2
  50. package/dist/{chunk-ZZXSWSN6.js → chunk-CWMHWD56.js} +2 -2
  51. package/dist/{chunk-6NW7MU72.js → chunk-CZEIHYMP.js} +2 -2
  52. package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
  53. package/dist/{chunk-XWUOUWYI.js → chunk-DFPAZXLU.js} +2 -2
  54. package/dist/{chunk-MOVBWNIP.js → chunk-DKJXK3HA.js} +2 -2
  55. package/dist/{chunk-XMQ23E27.js → chunk-DLC6JDN7.js} +2 -2
  56. package/dist/chunk-DUKHVPU5.js +4 -0
  57. package/dist/{chunk-ID63777H.js → chunk-DVYG3JTA.js} +2 -2
  58. package/dist/{chunk-NE6IU5ZD.js → chunk-EFFMFK7C.js} +2 -2
  59. package/dist/{chunk-I2T2LLK2.js → chunk-EM5UHLAM.js} +2 -2
  60. package/dist/chunk-EN4AHLL3.js +3 -0
  61. package/dist/chunk-EXMVF3JR.js +3 -0
  62. package/dist/{chunk-SWHMHUKF.js → chunk-FEBLLMTL.js} +2 -2
  63. package/dist/chunk-FIXYHQ3W.js +3 -0
  64. package/dist/{chunk-RKEJ6VTF.js → chunk-FLLXYUOL.js} +2 -2
  65. package/dist/{chunk-KWVHSKHK.js → chunk-FPDL2TUB.js} +2 -2
  66. package/dist/chunk-FQA3KIFX.js +17 -0
  67. package/dist/chunk-FWY2PRIF.js +3 -0
  68. package/dist/chunk-FY5V4V4F.js +2 -0
  69. package/dist/chunk-G2XUZCF2.js +88 -0
  70. package/dist/{chunk-QHRNXP3C.js → chunk-GXVDTHFC.js} +2 -2
  71. package/dist/{chunk-6MUIJMVL.js → chunk-H3CKAL6P.js} +2 -2
  72. package/dist/chunk-H5QXP63L.js +2 -0
  73. package/dist/{chunk-VUIYB2V3.js → chunk-HBQGKMM3.js} +2 -2
  74. package/dist/{chunk-PYAB5SM6.js → chunk-HBXZAGY6.js} +2 -2
  75. package/dist/{chunk-NNO6A2PO.js → chunk-HCMQZPEO.js} +2 -2
  76. package/dist/{chunk-Q65CQ4XL.js → chunk-HHBBGWES.js} +2 -2
  77. package/dist/{chunk-GTXSJDCO.js → chunk-HIEXRDJF.js} +2 -2
  78. package/dist/{chunk-4FC325IF.js → chunk-HYKSLTAR.js} +2 -2
  79. package/dist/{chunk-XLQ3GLWZ.js → chunk-I2KP4AGR.js} +2 -2
  80. package/dist/chunk-I5FCDTK2.js +2 -0
  81. package/dist/{chunk-QKPLA6IC.js → chunk-I645ZF75.js} +2 -2
  82. package/dist/{chunk-FDGD5AB5.js → chunk-IBM3F2BJ.js} +2 -2
  83. package/dist/{chunk-Q72QSKXC.js → chunk-IEL6Q5W3.js} +38 -38
  84. package/dist/{chunk-NCZUNH3E.js → chunk-IGQQUENU.js} +12 -12
  85. package/dist/chunk-IGYAZPRX.js +4 -0
  86. package/dist/chunk-IOVPAZWP.js +3 -0
  87. package/dist/{chunk-OL6KJP3N.js → chunk-IVJJNVSX.js} +2 -2
  88. package/dist/{chunk-AKB7V7TV.js → chunk-IWAMYGPN.js} +2 -2
  89. package/dist/chunk-IYBIBMPF.js +90 -0
  90. package/dist/{chunk-IOP6FWIM.js → chunk-J24VICI5.js} +2 -2
  91. package/dist/{chunk-C7QOQX32.js → chunk-JN5LIBT3.js} +2 -2
  92. package/dist/{chunk-O6QTXQPJ.js → chunk-JOALNFY3.js} +2 -2
  93. package/dist/{chunk-GCHRX4YW.js → chunk-JUO3Z644.js} +2 -2
  94. package/dist/{chunk-BJ6SQAEN.js → chunk-JXHLB7TP.js} +2 -2
  95. package/dist/{chunk-IJ4HMYBE.js → chunk-JYX5UZSZ.js} +2 -2
  96. package/dist/chunk-K2O7SBAU.js +2 -0
  97. package/dist/{chunk-OLF4MA5W.js → chunk-K5G7SPAG.js} +2 -2
  98. package/dist/{chunk-YSNONTJ2.js → chunk-KDYQQJ6X.js} +2 -2
  99. package/dist/{chunk-7NVGT435.js → chunk-KM4QRWI5.js} +2 -2
  100. package/dist/{chunk-HKQUXIFO.js → chunk-KNV5VFDV.js} +2 -2
  101. package/dist/chunk-L3YSDLNB.js +2 -0
  102. package/dist/{chunk-EZNMUY67.js → chunk-LAGDJXFY.js} +2 -2
  103. package/dist/{chunk-ENCCHKM6.js → chunk-LY2NB5XR.js} +4 -4
  104. package/dist/chunk-M4EVGA5S.js +14 -0
  105. package/dist/chunk-M7LAIM77.js +127 -0
  106. package/dist/{chunk-BVAJLC5A.js → chunk-MRGTCMDK.js} +2 -2
  107. package/dist/{chunk-OZYRSMSH.js → chunk-MT5W4DUG.js} +2 -2
  108. package/dist/{chunk-VE5AVNMP.js → chunk-MTMF4N7F.js} +2 -2
  109. package/dist/chunk-N3Q3AWGW.js +545 -0
  110. package/dist/{chunk-TXXOEMZJ.js → chunk-NDGTJHQN.js} +2 -2
  111. package/dist/chunk-NIO346UL.js +2 -0
  112. package/dist/chunk-NJA4MMBD.js +2 -0
  113. package/dist/{chunk-7FND7D7N.js → chunk-NK76RSB6.js} +2 -2
  114. package/dist/{chunk-H3LGFZVK.js → chunk-NTRW52UR.js} +2 -2
  115. package/dist/{chunk-JOIRNPPY.js → chunk-OJFLPVBP.js} +2 -2
  116. package/dist/{chunk-KMITESMT.js → chunk-OMBRP7BB.js} +2 -2
  117. package/dist/{chunk-UP3BUZR5.js → chunk-OVKZM2XI.js} +2 -2
  118. package/dist/{chunk-MVB3DAEY.js → chunk-PARCKE3Q.js} +2 -2
  119. package/dist/{chunk-CAUCPUOF.js → chunk-PFPHS4NO.js} +2 -2
  120. package/dist/chunk-PHPQ24UG.js +22 -0
  121. package/dist/chunk-PLZXWZHY.js +77 -0
  122. package/dist/{chunk-34WBMAYK.js → chunk-PNVZIJ57.js} +2 -2
  123. package/dist/{chunk-SYDJMPES.js → chunk-QKVTWODE.js} +2 -2
  124. package/dist/{chunk-FW53T7EB.js → chunk-QLTFXVUI.js} +2 -2
  125. package/dist/{chunk-PBI2LFKH.js → chunk-QMGWSEPL.js} +2 -2
  126. package/dist/{chunk-CQP3THUZ.js → chunk-QVHZB75Z.js} +2 -2
  127. package/dist/{chunk-6BQ3DSPK.js → chunk-QVWDQTMG.js} +2 -2
  128. package/dist/{chunk-ST7V3SKN.js → chunk-RCPZOPV6.js} +2 -2
  129. package/dist/chunk-RJWAB4VR.js +345 -0
  130. package/dist/chunk-RRPK327J.js +20 -0
  131. package/dist/chunk-RVYLJDXC.js +21 -0
  132. package/dist/chunk-RWKEXCHU.js +3 -0
  133. package/dist/{chunk-L4NRUAGJ.js → chunk-S5SKXCND.js} +2 -2
  134. package/dist/{chunk-RBAS5ZHI.js → chunk-S64NCE2Z.js} +2 -2
  135. package/dist/{chunk-WMPRTGH2.js → chunk-SF34QLK2.js} +2 -2
  136. package/dist/{chunk-ANFVSJWQ.js → chunk-SJZQ2PTZ.js} +2 -2
  137. package/dist/{chunk-4XTAUQFD.js → chunk-SRY26ITJ.js} +2 -2
  138. package/dist/chunk-SV2LEFVM.js +2 -0
  139. package/dist/{chunk-7XAN6GKB.js → chunk-T3YFIJ5P.js} +2 -2
  140. package/dist/chunk-T55YPJGB.js +3 -0
  141. package/dist/chunk-TAJ6UGCO.js +21 -0
  142. package/dist/{chunk-PIOMTC27.js → chunk-TUTSO7UZ.js} +2 -2
  143. package/dist/{chunk-FQKZWM4L.js → chunk-U24M5RQM.js} +5 -5
  144. package/dist/{chunk-XME3HPXZ.js → chunk-U2XX3BT4.js} +2 -2
  145. package/dist/{chunk-SZD2KF7Q.js → chunk-UWB5WMC2.js} +2 -2
  146. package/dist/{chunk-6CS3UQTN.js → chunk-VCL7FK3E.js} +2 -2
  147. package/dist/{chunk-N3IQCBCF.js → chunk-VCWAJPXQ.js} +2 -2
  148. package/dist/{chunk-LZYFLFEH.js → chunk-VG55NFXF.js} +2 -2
  149. package/dist/{chunk-PTAWHLVJ.js → chunk-VLTUX4IF.js} +2 -2
  150. package/dist/{chunk-JEJLSICM.js → chunk-VVCBMH5O.js} +2 -2
  151. package/dist/{chunk-JSOYNVWH.js → chunk-VYZQZ4ZN.js} +2 -2
  152. package/dist/chunk-W3FK73MD.js +8 -0
  153. package/dist/{chunk-UNBY47BC.js → chunk-W6C6QTXJ.js} +2 -2
  154. package/dist/chunk-WH5SYOMD.js +2 -0
  155. package/dist/chunk-WJOQC4P7.js +7 -0
  156. package/dist/chunk-WO47BIPY.js +3 -0
  157. package/dist/chunk-WOOTEWQT.js +239 -0
  158. package/dist/{chunk-UBGWN7I4.js → chunk-X5I2BQGX.js} +2 -2
  159. package/dist/{chunk-PX4RYAAK.js → chunk-XNUWRTYM.js} +2 -2
  160. package/dist/{chunk-ICFDQHAM.js → chunk-XUJM6474.js} +2 -2
  161. package/dist/chunk-XYLV727H.js +21 -0
  162. package/dist/{chunk-TRRC4ZJ7.js → chunk-YFQPWKHR.js} +2 -2
  163. package/dist/{chunk-NEDP5RFQ.js → chunk-YIOQJ45A.js} +2 -2
  164. package/dist/{chunk-Y6KHROC3.js → chunk-YXJ4IAHH.js} +2 -2
  165. package/dist/chunk-YYFV32WR.js +3 -0
  166. package/dist/{chunk-BH5F2Q4O.js → chunk-ZB3V5QM7.js} +2 -2
  167. package/dist/chunk-ZJZQ7Q2Q.js +3 -0
  168. package/dist/{chunk-EMNIHCRB.js → chunk-ZNQCR656.js} +2 -2
  169. package/dist/{chunk-TIIC3ZE7.js → chunk-ZOEDRCR4.js} +2 -2
  170. package/dist/cli-context-TSADTXLB.js +2 -0
  171. package/dist/cli-context-XEPPF4RX.js +3 -0
  172. package/dist/cli-program-KJGQEM72.js +7 -0
  173. package/dist/cli.js +1 -1
  174. package/dist/{code-DlqpBDd0.d.ts → code-CDe-mIjx.d.ts} +1 -1
  175. package/dist/code-viewer-YGDON6SY.js +12 -0
  176. package/dist/code-viewer-ZCTHXQ5C.js +11 -0
  177. package/dist/command-descriptors-5VAB2MZX.js +335 -0
  178. package/dist/command-descriptors-EAHKIRAG.js +337 -0
  179. package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
  180. package/dist/{db-D7sauVFH.d.ts → db-DmRNdCtm.d.ts} +1 -1
  181. package/dist/direct-navigation-B3SGOOBW.js +2 -0
  182. package/dist/direct-navigation-ZL362KXF.js +3 -0
  183. package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-Bs54NWws.d.ts} +1 -1
  184. package/dist/{health-DJaZXg8I.d.ts → health-BnzbSLCE.d.ts} +1 -1
  185. package/dist/index.d.ts +2 -2
  186. package/dist/index.js +1 -1
  187. package/dist/invocation-command-descriptors-CSUGUHTT.js +2 -0
  188. package/dist/invocation-command-descriptors-PPVZOIE5.js +3 -0
  189. package/dist/output-continuation-command-FTVVBVSN.js +2 -0
  190. package/dist/output-continuation-command-ITPRC3YV.js +3 -0
  191. package/dist/project-reindex-7HZSLLLY.js +3 -0
  192. package/dist/project-reindex-NGM3DYBN.js +2 -0
  193. package/dist/queries/affected.d.ts +2 -2
  194. package/dist/queries/affected.js +1 -1
  195. package/dist/queries/anchors.d.ts +2 -2
  196. package/dist/queries/anchors.js +1 -1
  197. package/dist/queries/architecture.d.ts +2 -2
  198. package/dist/queries/architecture.js +1 -1
  199. package/dist/queries/bottlenecks.d.ts +2 -2
  200. package/dist/queries/bottlenecks.js +1 -1
  201. package/dist/queries/by-kind.d.ts +2 -2
  202. package/dist/queries/by-kind.js +1 -1
  203. package/dist/queries/call-graph.d.ts +2 -2
  204. package/dist/queries/call-graph.js +1 -1
  205. package/dist/queries/change-surface.d.ts +2 -2
  206. package/dist/queries/change-surface.js +1 -1
  207. package/dist/queries/cleanup-plan.d.ts +2 -2
  208. package/dist/queries/cleanup-plan.js +1 -1
  209. package/dist/queries/co-change.d.ts +2 -2
  210. package/dist/queries/co-change.js +1 -1
  211. package/dist/queries/code.d.ts +3 -3
  212. package/dist/queries/code.js +1 -1
  213. package/dist/queries/complexity-hotspots.d.ts +2 -2
  214. package/dist/queries/complexity-hotspots.js +1 -1
  215. package/dist/queries/complexity.d.ts +2 -2
  216. package/dist/queries/complexity.js +1 -1
  217. package/dist/queries/context.d.ts +2 -2
  218. package/dist/queries/context.js +1 -1
  219. package/dist/queries/convergence.d.ts +2 -2
  220. package/dist/queries/convergence.js +1 -1
  221. package/dist/queries/coupling.d.ts +2 -2
  222. package/dist/queries/coupling.js +1 -1
  223. package/dist/queries/cycles.d.ts +2 -2
  224. package/dist/queries/cycles.js +1 -1
  225. package/dist/queries/dataflow.d.ts +2 -2
  226. package/dist/queries/dataflow.js +1 -1
  227. package/dist/queries/dead.d.ts +2 -2
  228. package/dist/queries/dead.js +1 -1
  229. package/dist/queries/decorative-checkers.d.ts +2 -2
  230. package/dist/queries/decorative-checkers.js +1 -1
  231. package/dist/queries/deep-chains.d.ts +2 -2
  232. package/dist/queries/deep-chains.js +1 -1
  233. package/dist/queries/dependence-slice.d.ts +3 -3
  234. package/dist/queries/dependence-slice.js +1 -1
  235. package/dist/queries/dependency-depth.d.ts +2 -2
  236. package/dist/queries/dependency-depth.js +1 -1
  237. package/dist/queries/deps.d.ts +2 -2
  238. package/dist/queries/deps.js +1 -1
  239. package/dist/queries/diff-impact.d.ts +2 -2
  240. package/dist/queries/diff-impact.js +1 -1
  241. package/dist/queries/doc-drift.d.ts +2 -2
  242. package/dist/queries/doc-drift.js +1 -1
  243. package/dist/queries/drift.d.ts +2 -2
  244. package/dist/queries/drift.js +1 -1
  245. package/dist/queries/duplicate-bodies.d.ts +2 -2
  246. package/dist/queries/duplicate-bodies.js +1 -1
  247. package/dist/queries/entry-map.d.ts +2 -2
  248. package/dist/queries/entry-map.js +1 -1
  249. package/dist/queries/evidence.d.ts +3 -3
  250. package/dist/queries/evidence.js +1 -1
  251. package/dist/queries/extract-candidates.d.ts +2 -2
  252. package/dist/queries/extract-candidates.js +1 -1
  253. package/dist/queries/fan.d.ts +2 -2
  254. package/dist/queries/fan.js +1 -1
  255. package/dist/queries/files.d.ts +2 -2
  256. package/dist/queries/files.js +1 -1
  257. package/dist/queries/health.d.ts +3 -3
  258. package/dist/queries/health.js +1 -1
  259. package/dist/queries/hierarchy.d.ts +2 -2
  260. package/dist/queries/hierarchy.js +1 -1
  261. package/dist/queries/hotspots.d.ts +2 -2
  262. package/dist/queries/hotspots.js +1 -1
  263. package/dist/queries/imports.d.ts +2 -2
  264. package/dist/queries/imports.js +1 -1
  265. package/dist/queries/incomplete-migration.d.ts +2 -2
  266. package/dist/queries/incomplete-migration.js +1 -1
  267. package/dist/queries/index.d.ts +5 -5
  268. package/dist/queries/index.js +1 -1
  269. package/dist/queries/isolated.d.ts +2 -2
  270. package/dist/queries/isolated.js +1 -1
  271. package/dist/queries/locality-candidates.d.ts +2 -2
  272. package/dist/queries/locality-candidates.js +1 -1
  273. package/dist/queries/members.d.ts +2 -2
  274. package/dist/queries/members.js +1 -1
  275. package/dist/queries/methods.d.ts +2 -2
  276. package/dist/queries/methods.js +1 -1
  277. package/dist/queries/not-implemented.d.ts +2 -2
  278. package/dist/queries/not-implemented.js +1 -1
  279. package/dist/queries/outline.d.ts +2 -2
  280. package/dist/queries/outline.js +1 -1
  281. package/dist/queries/passthrough-candidates.d.ts +2 -2
  282. package/dist/queries/passthrough-candidates.js +1 -1
  283. package/dist/queries/plan-context.d.ts +2 -2
  284. package/dist/queries/plan-context.js +1 -1
  285. package/dist/queries/react-component-duplicates.d.ts +2 -2
  286. package/dist/queries/react-component-duplicates.js +1 -1
  287. package/dist/queries/react-hook-candidates.d.ts +2 -2
  288. package/dist/queries/react-hook-candidates.js +1 -1
  289. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  290. package/dist/queries/react-large-component-pressure.js +1 -1
  291. package/dist/queries/recent-duplicates.d.ts +2 -2
  292. package/dist/queries/recent-duplicates.js +1 -1
  293. package/dist/queries/redundant-reexports.d.ts +2 -2
  294. package/dist/queries/redundant-reexports.js +1 -1
  295. package/dist/queries/reference-neighborhood.d.ts +2 -2
  296. package/dist/queries/reference-neighborhood.js +1 -1
  297. package/dist/queries/reference-reachability.d.ts +2 -2
  298. package/dist/queries/reference-reachability.js +1 -1
  299. package/dist/queries/refs.d.ts +2 -2
  300. package/dist/queries/refs.js +1 -1
  301. package/dist/queries/self-audit.d.ts +2 -2
  302. package/dist/queries/self-audit.js +1 -1
  303. package/dist/queries/similar-chains.d.ts +2 -2
  304. package/dist/queries/similar-chains.js +1 -1
  305. package/dist/queries/similar-files.d.ts +2 -2
  306. package/dist/queries/similar-files.js +1 -1
  307. package/dist/queries/similar-signatures.d.ts +2 -2
  308. package/dist/queries/similar-signatures.js +1 -1
  309. package/dist/queries/similar.d.ts +2 -2
  310. package/dist/queries/similar.js +1 -1
  311. package/dist/queries/slice.d.ts +2 -2
  312. package/dist/queries/slice.js +1 -1
  313. package/dist/queries/source-inspection.d.ts +4 -4
  314. package/dist/queries/source-inspection.js +1 -1
  315. package/dist/queries/source-search.d.ts +2 -2
  316. package/dist/queries/source-search.js +1 -1
  317. package/dist/queries/stale-abstractions.d.ts +2 -2
  318. package/dist/queries/stale-abstractions.js +1 -1
  319. package/dist/queries/stats.d.ts +2 -2
  320. package/dist/queries/surface.d.ts +2 -2
  321. package/dist/queries/surface.js +1 -1
  322. package/dist/queries/symbols.d.ts +2 -2
  323. package/dist/queries/symbols.js +1 -1
  324. package/dist/queries/system-map.d.ts +2 -2
  325. package/dist/queries/system-map.js +1 -1
  326. package/dist/queries/system.d.ts +2 -2
  327. package/dist/queries/system.js +1 -1
  328. package/dist/queries/test-quality.d.ts +2 -2
  329. package/dist/queries/test-quality.js +1 -1
  330. package/dist/queries/trace.d.ts +2 -2
  331. package/dist/queries/trace.js +1 -1
  332. package/dist/queries/twin-ab.d.ts +2 -2
  333. package/dist/queries/twin-ab.js +1 -1
  334. package/dist/queries/twin-drift.d.ts +2 -2
  335. package/dist/queries/twin-drift.js +1 -1
  336. package/dist/queries/unused-imports.d.ts +2 -2
  337. package/dist/queries/unused-imports.js +1 -1
  338. package/dist/queries/unused-params.d.ts +2 -2
  339. package/dist/queries/unused-params.js +1 -1
  340. package/dist/queries/value-flow.d.ts +3 -3
  341. package/dist/queries/value-flow.js +1 -1
  342. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  343. package/dist/queries/vue-component-duplicates.js +1 -1
  344. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  345. package/dist/queries/vue-composable-candidates.js +1 -1
  346. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  347. package/dist/queries/vue-large-view-pressure.js +1 -1
  348. package/dist/queries/wrapper-candidates.d.ts +2 -2
  349. package/dist/queries/wrapper-candidates.js +1 -1
  350. package/dist/reindex-worker.js +1 -1
  351. package/dist/reindex.d.ts +3 -3
  352. package/dist/reindex.js +31 -31
  353. package/dist/runtime.d.ts +24 -4
  354. package/dist/runtime.js +3 -3
  355. package/dist/rust-semantic-session-server.js +1 -1
  356. package/dist/rust-semantic-session-worker.js +1 -1
  357. package/dist/rust-semantic-worker.js +1 -1
  358. package/dist/{scip-cli-B7N3haxa.d.ts → scip-cli-BRFKkHQn.d.ts} +1 -1
  359. package/dist/sentinel-ensure-command-KYYULCFU.js +2 -0
  360. package/dist/sentinel-ensure-command-RIZA3RY7.js +3 -0
  361. package/dist/sentinel-hook.js +39 -0
  362. package/dist/sentinel-worker.js +16 -0
  363. package/dist/typescript-mailbox-worker.js +1 -1
  364. package/dist/watch-server.js +6 -6
  365. package/docs/COMMAND_REFERENCE.md +5 -3
  366. package/docs/schemas/project-config.schema.json +159 -0
  367. package/package.json +9 -5
  368. package/skills/codebaseiq/SKILL.md +1 -1
  369. package/skills/concrete-plan/SKILL.md +1 -1
  370. package/ui/view/api.js +450 -0
  371. package/ui/view/app.js +394 -0
  372. package/ui/view/builder.js +323 -0
  373. package/ui/view/file-panel.js +170 -0
  374. package/ui/view/focus.js +379 -0
  375. package/ui/view/index.html +54 -0
  376. package/ui/view/map.js +424 -0
  377. package/ui/view/styles.css +1125 -0
  378. package/dist/chunk-2X7V4HS4.js +0 -88
  379. package/dist/chunk-3IER7Q6H.js +0 -12
  380. package/dist/chunk-3JSXXYTZ.js +0 -345
  381. package/dist/chunk-476NR5B7.js +0 -2
  382. package/dist/chunk-5VKBFZZU.js +0 -3
  383. package/dist/chunk-ADTBPVUZ.js +0 -21
  384. package/dist/chunk-BFFZDZQV.js +0 -2
  385. package/dist/chunk-BMYOV5GP.js +0 -77
  386. package/dist/chunk-C74PPYLA.js +0 -3
  387. package/dist/chunk-CWONGW6P.js +0 -3
  388. package/dist/chunk-DDZ7VHWV.js +0 -20
  389. package/dist/chunk-DR2LURYU.js +0 -3
  390. package/dist/chunk-ECQBG7PW.js +0 -564
  391. package/dist/chunk-FM5BPL4V.js +0 -60
  392. package/dist/chunk-G6XFR4ZL.js +0 -4
  393. package/dist/chunk-GTIYTDRE.js +0 -562
  394. package/dist/chunk-HOA5YGOH.js +0 -3
  395. package/dist/chunk-KUW32IRO.js +0 -2
  396. package/dist/chunk-LTA3BRZX.js +0 -2
  397. package/dist/chunk-NAUD7LCA.js +0 -2
  398. package/dist/chunk-OGTFJ3XD.js +0 -2
  399. package/dist/chunk-Q5ELPRKQ.js +0 -2
  400. package/dist/chunk-QCN62RTF.js +0 -3
  401. package/dist/chunk-QW7EP6WI.js +0 -21
  402. package/dist/chunk-RU65DDUP.js +0 -215
  403. package/dist/chunk-SELM5MER.js +0 -2
  404. package/dist/chunk-SNNWPCN7.js +0 -4
  405. package/dist/chunk-TFZB6XTM.js +0 -239
  406. package/dist/chunk-UXM43C7T.js +0 -3
  407. package/dist/chunk-VFY6Y2H6.js +0 -61
  408. package/dist/chunk-WE5RZHZ7.js +0 -5
  409. package/dist/chunk-Z54RD7VL.js +0 -3
  410. package/dist/cli-context-3SNLDYBM.js +0 -3
  411. package/dist/cli-context-T3B7W6GG.js +0 -2
  412. package/dist/cli-program-YNOXO72B.js +0 -7
  413. package/dist/command-descriptors-6AOUKWW7.js +0 -346
  414. package/dist/command-descriptors-ZFKJSRUP.js +0 -344
  415. package/dist/direct-navigation-DP4LVMRX.js +0 -3
  416. package/dist/direct-navigation-FLUS3BT6.js +0 -2
  417. package/dist/invocation-command-descriptors-QT2JMY5J.js +0 -3
  418. package/dist/invocation-command-descriptors-YN4QJEAX.js +0 -2
  419. package/dist/output-continuation-command-2V2SL4TD.js +0 -2
  420. package/dist/output-continuation-command-65J5IP3O.js +0 -3
  421. package/dist/project-reindex-5JOKXAXT.js +0 -2
  422. package/dist/project-reindex-UQBIKO4M.js +0 -3
@@ -1,2 +1,2 @@
1
- import{a as z}from"./chunk-P5XHIJHI.js";import{a as De,i as Me}from"./chunk-KUW32IRO.js";import{c as xe,h as _e}from"./chunk-5VKBFZZU.js";import{a as he,e as Ee,i as ke}from"./chunk-DRENNWRG.js";import{a as S,c as be,d as M,e as f,f as X,h as ge,j,t as x,u as k,v as Ae,x as q,y as K,z as we}from"./chunk-RDBI2RXU.js";import{a as C,i as G,k as v}from"./chunk-R2NOK63J.js";import{a as ye,b as Se,c as L,d as w}from"./chunk-EF2R3WNQ.js";import{a as pe,b as E,c as Re,f as me,fa as Ie,g as A,m as J}from"./chunk-WE5RZHZ7.js";import{createHash as fn}from"crypto";import{resolve as pn}from"path";var b=3;function V(e){return fn("sha256").update(x({kind:"codebaseiq-durable-rust-mailbox",protocolVersion:b,sessionDir:pn(e)})).digest("hex")}function Rn(e,n){if(!S(e)||typeof e.id!="string"||!e.id)return T("Durable Rust semantic helper received an invalid mailbox request.");if(e.id!==n.claimRequestId)return T("Durable Rust semantic request identity does not match its mailbox path.");if(e.protocolVersion===void 0){if(e.mailboxVersion!==void 0||e.operationKey!==void 0||e.clientId!==void 0||e.enqueuedAtMs!==void 0||e.deadlineAtMs!==void 0||e.sessionIdentity!==void 0)return T("Durable Rust semantic helper received a partially versioned request without a protocol version.");let s=Ce(e.request);if(!s)return T("Durable Rust semantic helper received an invalid legacy request kind or payload.");let i=n.nowMs+Math.max(1,s.timeoutMs);return{ok:!0,compatibility:"legacy-v2",value:{mailboxVersion:k,protocolVersion:b,id:e.id,operationKey:q("rust-semantic-v2",{id:e.id,request:s}),clientId:"legacy-v2",enqueuedAtMs:n.nowMs,deadlineAtMs:i,sessionIdentity:n.sessionIdentity,request:s}}}let t=mn(e,n);if(!t.ok)return t;if(e.protocolVersion!==b)return{ok:!1,code:"unsupported-protocol",error:`Durable Rust semantic helper does not support mailbox protocol ${String(e.protocolVersion)}.`,responseIdentity:t.responseIdentity};let r=Ce(e.request);return r?t.operationKey!==q("rust-semantic-v3",r)?{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received a mismatched mailbox operation identity.",responseIdentity:t.responseIdentity}:t.deadlineAtMs-t.enqueuedAtMs!==r.timeoutMs?{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received a deadline that does not match the request timeout.",responseIdentity:t.responseIdentity}:t.deadlineAtMs<n.nowMs?{ok:!1,code:"expired-request",error:"Durable Rust semantic request expired before processing.",responseIdentity:t.responseIdentity}:{ok:!0,compatibility:t.priorSessionIdentity?"prior-v3":"current-v3",value:{mailboxVersion:k,protocolVersion:b,id:e.id,operationKey:t.operationKey,clientId:t.clientId,enqueuedAtMs:t.enqueuedAtMs,deadlineAtMs:t.deadlineAtMs,sessionIdentity:n.sessionIdentity,request:r}}:{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received an invalid request kind or payload.",responseIdentity:t.responseIdentity}}function te(e,n){return S(e)?e.protocolVersion!==b?qe(e.protocolVersion===void 0?"helper wrote a prior uncorrelated response protocol":`helper wrote unsupported response protocol ${String(e.protocolVersion)}`):e.mailboxVersion!==k||e.id!==n.requestId||e.operationKey!==n.operationKey||e.sessionIdentity!==n.sessionIdentity||e.deadlineAtMs!==n.deadlineAtMs?qe("helper wrote an incompatible response identity"):typeof e.completedAtMs!="number"||!Number.isFinite(e.completedAtMs)||e.completedAtMs>n.deadlineAtMs||n.nowMs>n.deadlineAtMs?{ok:!1,code:"expired-request",error:"helper response arrived after the durable request deadline"}:e.ok===!1?typeof e.error!="string"||!Mn(e.errorCode)?ee("helper wrote an invalid rejection response"):{ok:!1,code:e.errorCode,error:e.error}:e.ok!==!0||e.session!=="created"&&e.session!=="reused"&&e.session!=="invalidated"||!gn(e.response,n.requestKind)?ee("helper wrote an invalid success response"):{ok:!0,session:e.session,response:e.response}:ee("helper wrote an invalid response object")}function mn(e,n){if(e.mailboxVersion!==k||typeof e.protocolVersion!="number"||!Number.isInteger(e.protocolVersion)||typeof e.operationKey!="string"||!Te(e.operationKey)||e.id!==K(e.operationKey)||typeof e.clientId!="string"||!e.clientId||typeof e.enqueuedAtMs!="number"||!Number.isFinite(e.enqueuedAtMs)||typeof e.deadlineAtMs!="number"||!Number.isFinite(e.deadlineAtMs)||e.deadlineAtMs<e.enqueuedAtMs||e.sessionIdentity!==void 0&&(typeof e.sessionIdentity!="string"||!Te(e.sessionIdentity))||e.sessionIdentity===void 0&&e.protocolVersion!==b)return T("Durable Rust semantic helper received an invalid mailbox lifecycle.");let t={id:n.claimRequestId,sessionIdentity:n.sessionIdentity,deadlineAtMs:e.deadlineAtMs};return e.sessionIdentity!==void 0&&e.sessionIdentity!==n.sessionIdentity?{ok:!1,code:"malformed-request",error:"Durable Rust semantic request belongs to a different mailbox session.",responseIdentity:t}:{ok:!0,responseIdentity:t,operationKey:e.operationKey,clientId:e.clientId,enqueuedAtMs:e.enqueuedAtMs,deadlineAtMs:e.deadlineAtMs,priorSessionIdentity:e.sessionIdentity===void 0}}function Ce(e){return!S(e)||typeof e.identityKey!="string"||!e.identityKey||!X(e.timeoutMs)||e.workerEnvironment!==void 0&&!be(e.workerEnvironment)?null:e.kind==="semantic"&&yn(e.request)?{kind:"semantic",identityKey:e.identityKey,...e.workerEnvironment===void 0?{}:{workerEnvironment:e.workerEnvironment},request:e.request,timeoutMs:e.timeoutMs}:e.kind==="import-definitions"&&Sn(e.request)?{kind:"import-definitions",identityKey:e.identityKey,...e.workerEnvironment===void 0?{}:{workerEnvironment:e.workerEnvironment},request:e.request,timeoutMs:e.timeoutMs}:null}function yn(e){return!S(e)||!M(e.projectRoot)||!M(e.rustAnalyzerBinary)||!Be(e.definitions)?!1:Z(e.referenceDefinitions)&&Z(e.calleeDefinitions)&&Z(e.signatureDefinitions)&&I(e.requestTimeoutMs)&&I(e.readinessDeadlineMs)&&I(e.referenceRetryTimeoutMs)&&I(e.diagnosticsTimeoutMs)&&I(e.settleDelayMs)&&Oe(e.concurrency)&&ne(e.includeReferences)&&ne(e.includeCallees)&&ne(e.includeSignatures)}function Sn(e){return!S(e)||!M(e.projectRoot)||!M(e.rustAnalyzerBinary)||!M(e.file)||!Array.isArray(e.positions)||!e.positions.every(n=>S(n)&&M(n.id)&&M(n.file)&&f(n.line)&&f(n.column))?!1:I(e.requestTimeoutMs)&&I(e.readinessDeadlineMs)&&I(e.diagnosticsTimeoutMs)&&I(e.settleDelayMs)&&Oe(e.concurrency)}function Be(e){return Array.isArray(e)&&e.every(bn)}function Z(e){return e===void 0||Be(e)}function bn(e){return S(e)&&f(e.symbolId)&&f(e.documentId)&&f(e.startLine)&&Pe(e.startChar)&&f(e.endLine)&&Pe(e.endChar)&&typeof e.symbol=="string"&&typeof e.relativePath=="string"&&typeof e.leaf=="string"&&(e.parentTypeName===null||typeof e.parentTypeName=="string")&&typeof e.isFunctionLike=="boolean"&&typeof e.isTypeLike=="boolean"&&(e.kind===null||Number.isSafeInteger(e.kind))&&(e.documentation===null||typeof e.documentation=="string")&&(e.enclosingSymbol===null||typeof e.enclosingSymbol=="string")}function gn(e,n){return!S(e)||typeof e.available!="boolean"||e.available===!1&&(typeof e.reason!="string"||e.reason.length===0)||e.available===!0&&e.reason!==void 0?!1:n==="import-definitions"?Array.isArray(e.sourcePaths)&&e.sourcePaths.every(t=>Array.isArray(t)&&t.length===2&&typeof t[0]=="string"&&(t[1]===null||typeof t[1]=="string")):ve(e.references,In)&&(e.incompleteReferenceSymbolIds===void 0||Array.isArray(e.incompleteReferenceSymbolIds)&&e.incompleteReferenceSymbolIds.every(t=>Number.isSafeInteger(t)))&&(e.callees===void 0||ve(e.callees,Dn))&&(e.signatures===void 0||Array.isArray(e.signatures)&&e.signatures.every(t=>Array.isArray(t)&&t.length===2&&Number.isSafeInteger(t[0])&&(t[1]===null||typeof t[1]=="string")))}function ve(e,n){return Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.length===2&&Number.isSafeInteger(t[0])&&Array.isArray(t[1])&&t[1].every(n))}function In(e){return S(e)&&typeof e.file=="string"&&f(e.line)&&f(e.column)}function Dn(e){return S(e)&&typeof e.symbol=="string"&&typeof e.file=="string"&&f(e.line)&&(e.callsiteLine===void 0||f(e.callsiteLine))}function Mn(e){return e==="unsupported-protocol"||e==="malformed-request"||e==="expired-request"||e==="handler-error"}function T(e){return{ok:!1,code:"malformed-request",error:e}}function ee(e){return{ok:!1,code:"malformed-response",error:e}}function qe(e){return{ok:!1,code:"incompatible-response",error:e}}function Te(e){return/^[a-f0-9]{64}$/.test(e)}function Oe(e){return e===void 0||X(e)}function Pe(e){return e===void 0||f(e)}function I(e){return e===void 0||ge(e)}function ne(e){return e===void 0||typeof e=="boolean"}import{spawn as Bn}from"child_process";import{createHash as On,randomUUID as Nn}from"crypto";import{existsSync as Qe,realpathSync as Un,rmSync as Wn}from"fs";import{tmpdir as Fn}from"os";import{resolve as _}from"path";import{execFileSync as Cn}from"child_process";import{existsSync as hn}from"fs";import{deserializeSCIP as En,SymbolRole as kn}from"@c4312/scip";var re=new WeakMap,An="SCIP_RUST_SCIP_OCCURRENCE_REFERENCE_MODE";function kt(e,n){let t=new Map,r=H(),s=n.filter(u=>Ue(u,r));if(s.length===0)return t;let i=We(e);if(!i)return t;for(let u of s){let l=Ne(i,u);l!==null&&t.set(u.symbolId,l)}return t}function At(e,n){if(!Ue(n,H()))return null;let t=We(e);return t?Ne(t,n):null}function Ne(e,n){return e.referencesBySymbol.get(n.symbol)??[]}function Ue(e,n="safe"){if(!e.symbol.startsWith("rust-analyzer ")||!e.relativePath.endsWith(".rs")||ke(e.symbol)||/impl#\[[^\]]+\]\[Default\]default\(\)\.$/.test(e.symbol))return!1;if(n==="all")return!0;let t=Ee(e.symbol);if(t==="method")return!0;if(t!=="term")return!1;let r=he(e.symbol);return"kind"in r?!1:!wn(r)}function wn(e){for(let n=0;n<e.descriptors.length-1;n+=1)if(e.descriptors[n]?.suffix==="type")return!0;return!1}function We(e){if(re.has(e))return re.get(e)??null;let n=xn(e);return re.set(e,n),n}function xn(e){if(!e.generation.indexPath||!hn(e.generation.indexPath))return null;try{let n=En(me(e.generation.indexPath,{inputKind:"SCIP occurrence-reference index",maxBytes:Re})),t=new Map;for(let r of n.documents??[]){let s=r.relativePath;if(!(!s||e.isIgnored(s)))for(let i of r.occurrences??[]){if(!i.symbol||(i.symbolRoles&kn.Definition)!==0)continue;let u=_n(s,i.range);if(!u)continue;let l=t.get(i.symbol)??[];l.push(u),t.set(i.symbol,l)}}for(let[r,s]of t)t.set(r,_e(s));return{referencesBySymbol:t}}catch{return null}}function _n(e,n){if(n.length<3)return null;let t=n[0],r=n[1];return!Number.isInteger(t)||!Number.isInteger(r)?null:{file:e,line:t,column:r}}function H(){return process.env[An]==="all"?"all":"safe"}function Fe(e){let n=Me(De,e),t=n.runnable;return t?{available:!0,dependencyAvailable:t,resolvedBinary:n.resolvedBinary??void 0,note:"rust-analyzer semantic reference queries are enabled."}:{available:!1,dependencyAvailable:t,resolvedBinary:n.resolvedBinary??void 0,reason:"rust-analyzer is not runnable; Rust semantic checks will use SCIP/source evidence only."}}var Le=new Map;function se(e){let t=Fe(e).resolvedBinary??null;return{engine:"rust-analyzer",resolvedBinary:t,version:t?vn(e,t):"unavailable"}}function Tt(e){return{...se(e),scipOccurrenceReferenceMode:H()}}function vn(e,n){let t=`${e}\0${n}`,r=Le.get(t);if(r)return r;let s;try{s=Cn(n,["--version"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:2e3}).trim()}catch{s="unknown"}return Le.set(t,s),s}import{createHash as qn}from"crypto";var Tn=new Set(["Cargo.lock","Cargo.toml","rust-project.json","rust-toolchain","rust-toolchain.toml"]);function je(e){let n=Ie(e,{includePath:Pn});return qn("sha256").update(JSON.stringify(n)).digest("hex")}function Pn(e){let n=e.replaceAll("\\","/"),t=n.split("/").at(-1)??n;return n.endsWith(".rs")||Tn.has(t)?!0:n===".cargo/config"||n===".cargo/config.toml"||n.endsWith("/.cargo/config")||n.endsWith("/.cargo/config.toml")}var Ln=5e3,Je=10,jn=3e4;function Ke(e,n,t,r=nn){let s=r.engineIdentity(e),i={protocolVersion:b,projectRoot:r.canonicalProjectRoot(e),projectFingerprint:r.projectFingerprint(e),engine:{engine:s.engine,resolvedBinary:s.resolvedBinary,version:s.version},workerFingerprint:r.fileFingerprint(n),environment:Xe(r.environment())};return{key:oe(x(i)),...i}}var ze=class{constructor(n,t=Vn){this.createRequester=n;this.applyEnvironment=t}createRequester;applyEnvironment;requester=null;identityKey=null;semanticResponseCache=null;handle(n){this.applyEnvironment(n.workerEnvironment??{});let t;if(this.requester?this.identityKey!==n.identityKey?(this.semanticResponseCache=null,this.requester.shutdown(),this.requester=this.createRequester(),this.identityKey=n.identityKey,t="invalidated"):t="reused":(this.requester=this.createRequester(),this.identityKey=n.identityKey,t="created"),n.kind==="semantic"){let r=Kn(n.request),s=t==="reused"&&r!==null&&this.semanticResponseCache?.identityKey===n.identityKey&&this.semanticResponseCache.requestKey===r?this.semanticResponseCache.response:null;if(s)return Ve(!0,n.request.definitions.length),{session:t,response:s};let i=this.requester.requestSemantic(n.request,n.timeoutMs);return r!==null&&zn(i)&&(this.semanticResponseCache={identityKey:n.identityKey,requestKey:r,response:i}),Ve(!1,n.request.definitions.length),{session:t,response:i}}return{session:t,response:this.requester.requestImportDefinitions(n.request,n.timeoutMs)}}shutdown(){this.requester?.shutdown(),this.requester=null,this.identityKey=null,this.semanticResponseCache=null}};function Kn(e){if(e.includeReferences===!1||e.includeCallees!==!0||e.includeSignatures===!0||(e.referenceDefinitions?.length??0)===0||(e.calleeDefinitions?.length??0)===0)return null;let{readinessDeadlineMs:n,...t}=e;return oe(x(t))}function zn(e){return e.available&&Array.isArray(e.callees)&&(e.incompleteReferenceSymbolIds?.length??0)===0}function Ve(e,n){C()&&v({type:"span",name:"rust.semantic.durable-session.response-cache",durationMs:0,ok:!0,hit:e,definitions:n})}function P(e,n,t,r){if(e.protocolVersion!==b||!t(e.pid))return!1;if(!e.processIdentity)return!0;let s=r?.(e.pid);return s!=null&&Se(e.processIdentity,s)}function ie(e,n,t){let r;try{r=J(n,{maxBytes:E,inputKind:"Rust semantic engine artifact"})}catch{r="missing"}let s=oe(x({projectRoot:_(e),serverPath:_(n),serverFingerprint:r})).slice(0,20);return _(t,`codebaseiq-rust-session-${s}`)}function He(e){let n=e===void 0?Number.NaN:Number(e);return Number.isInteger(n)&&n>=0?n:0}function Xe(e){return Object.fromEntries(Object.entries(e).filter(([n])=>Ze(n)).sort(([n],[t])=>n.localeCompare(t)).map(([n,t])=>[n,t??null]))}function Ge(e,n){let t=n.runtime??Jn,r=n.identityRuntime??nn,s=ie(e,n.serverPath,n.tempRoot??Fn()),i=!1,u=(l,d)=>{if(i)throw new Error("Durable Rust semantic session was already disposed.");return $n(s,n.serverPath,n.semanticWorkerPath,l,d,t,n.mailboxLimits)};return{requestSemantic(l,d){let R=Ke(e,n.semanticWorkerPath,l,r),{readinessDeadlineMs:c,...o}=l;return u({kind:"semantic",identityKey:R.key,workerEnvironment:Ye(),request:{...o,referenceRetryTimeoutMs:Hn(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,l.referenceRetryTimeoutMs),settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?l.settleDelayMs:He(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:d},d)},requestImportDefinitions(l,d){let R=Ke(e,n.semanticWorkerPath,l,r),{readinessDeadlineMs:c,...o}=l;return u({kind:"import-definitions",identityKey:R.key,workerEnvironment:Ye(),request:{...o,settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?l.settleDelayMs:He(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:d},d)},shutdown(){i=!0}}}function Vn(e){for(let n of Object.keys(process.env))en(n)&&delete process.env[n];for(let[n,t]of Object.entries(e))t!==null&&(process.env[n]=t)}function Hn(e,n){return n!==void 0?n:e===void 0?jn:void 0}function $n(e,n,t,r,s,i,u={}){let l=i.now(),d=l+s,R=(i.monotonicNow??w)(),c=R+s,o=q("rust-semantic-v3",r),a=K(o),p=Ae(e),m=V(e),y=we(p,{mailboxVersion:k,protocolVersion:b,id:a,operationKey:o,clientId:i.randomId(),enqueuedAtMs:l,deadlineAtMs:d,sessionIdentity:m,request:r},{nowMs:l,limits:u});for($e(e,n,t,c,i);(i.monotonicNow??w)()<=c;){if(Qe(y.responsePath)){let D=Yn(A(y.responsePath,{maxBytes:u.maxItemBytes??E,inputKind:"durable Rust semantic mailbox response"}),{requestId:a,operationKey:o,sessionIdentity:m,deadlineAtMs:y.authoritativeDeadlineAtMs,requestKind:r.kind,nowMs:i.now()});if(!D.ok)throw new Error(D.error);return C()&&v({type:"span",name:"rust.semantic.durable-session.request",durationMs:(i.monotonicNow??w)()-R,ok:!0,session:D.session,kind:r.kind}),D.response}let h=B(e);(!h||!P(h,i.now(),i.isProcessAlive,i.readProcessIdentity))&&$e(e,n,t,c,i),i.sleep(Je)}throw new Error(`Durable Rust semantic session timed out after ${(s/1e3).toFixed(0)}s.`)}function $e(e,n,t,r,s){let i=B(e);if(i&&P(i,s.now(),s.isProcessAlive,s.readProcessIdentity))return;Wn(_(e,"server.json"),{force:!0}),s.spawnServer(n,e,t);let u=s.monotonicNow??w,l=Math.min(r,u()+Ln);for(;u()<=l;){let d=B(e);if(d&&P(d,s.now(),s.isProcessAlive,s.readProcessIdentity))return;s.sleep(Je)}throw new Error("Durable Rust semantic session helper did not become ready within 5s.")}function B(e){try{let n=JSON.parse(A(_(e,"server.json"),{maxBytes:pe,inputKind:"durable Rust session state"}));if(typeof n.protocolVersion!="number"||n.sessionIdentity!==void 0&&(typeof n.sessionIdentity!="string"||n.sessionIdentity!==V(e))||typeof n.pid!="number"||typeof n.heartbeatAtMs!="number"||n.busyUntilMs!==void 0&&typeof n.busyUntilMs!="number"||n.mailbox!==void 0&&!Qn(n.mailbox))return null;let t=n.processIdentity===void 0?null:ye(n.processIdentity);return n.processIdentity!==void 0&&(!t||t.pid!==n.pid)?null:{protocolVersion:n.protocolVersion,...n.sessionIdentity===void 0?{}:{sessionIdentity:n.sessionIdentity},pid:n.pid,...t?{processIdentity:t}:{},heartbeatAtMs:n.heartbeatAtMs,...n.busyUntilMs===void 0?{}:{busyUntilMs:n.busyUntilMs},...n.mailbox===void 0?{}:{mailbox:n.mailbox}}}catch{return null}}function Yn(e,n){try{return te(JSON.parse(e),n)}catch(t){return{ok:!1,code:"malformed-response",error:`helper wrote malformed JSON: ${t instanceof Error?t.message:String(t)}`}}}function Qn(e){if(!e||typeof e!="object")return!1;let n=e;return f(n.pending)&&f(n.inflight)&&f(n.responses)&&f(n.deadLetters)&&f(n.invalid)&&f(n.totalItems)&&typeof n.totalBytes=="number"&&Number.isFinite(n.totalBytes)&&n.totalBytes>=0&&(n.oldestPendingAt===void 0||Number.isFinite(Date.parse(n.oldestPendingAt)))}function Ye(){return Object.fromEntries(Object.entries(process.env).filter(([e])=>en(e)).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,n??null]))}function Ze(e){return e==="HOME"||e==="PATH"||e.startsWith("CARGO_")||e.startsWith("RA_")||e.startsWith("RUST")}function en(e){return Ze(e)||e.startsWith("SCIP_RUST_")||e==="CODEBASEIQ_PROFILE"||e==="CODEBASEIQ_PROFILE_CACHE_STATE"||e==="CODEBASEIQ_PROFILE_COMMAND"||e==="CODEBASEIQ_PROFILE_OUT"||e==="CODEBASEIQ_PROFILE_RUN_ID"||e==="CODEBASEIQ_PROFILE_WORKLOAD_IDENTITY"||e==="CODEBASEIQ_PROFILE_WORKLOAD_IDENTITY_KIND"||e==="CODEBASEIQ_PROFILE_MIN_MS"}var nn={canonicalProjectRoot(e){try{return Un(e)}catch{return _(e)}},projectFingerprint(e){return je(e)},engineIdentity:se,fileFingerprint(e){return J(e,{maxBytes:E,inputKind:"Rust semantic engine artifact"})},environment(){return Xe(process.env)}},Jn={now:Date.now,monotonicNow:w,randomId:Nn,isProcessAlive:j,readProcessIdentity:L,spawnServer(e,n,t){if(!Qe(e))throw new Error(`Durable Rust semantic session helper was not found at ${e}. Run npm run build first.`);Bn(process.execPath,[e,n,t],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()},sleep(e){let n=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(n,0,0,e)}};function oe(e){return On("sha256").update(e).digest("hex")}import{existsSync as Xn,mkdtempSync as tn,rmSync as ue}from"fs";import{tmpdir as de}from"os";import{join as le}from"path";import{fileURLToPath as F,pathToFileURL as Gn}from"url";import{SHARE_ENV as Zn,Worker as et}from"worker_threads";function $(e,n,t=new Set){let r=new Map;for(let s of e)t.has(s.symbolId)||r.set(s.symbolId,n.get(s.symbolId)??[]);return r}function ae(e,n,t){let r=z(process.env.SCIP_RUST_SEMANTIC_BATCH_TIMEOUT_MS)??0;if(r>0)return r;let s=Math.max(1,Math.ceil(e/Math.max(1,t)));return Math.max(12e4,3e4+s*n)}var rn=15e3,sn=8,an=5e3,nt=64,tt=96,fe=class{constructor(n,t,r={}){this.projectRoot=n;this.status=t;this.opts=r;this.requester=r.requester??ot(n,process.env.SCIP_RUST_SEMANTIC_DURABLE_SESSION)}projectRoot;status;opts;requester;referencesForDefinitions(n){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:N(t),references:U(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!0});return{...O(r),resolvedBinary:t.resolvedBinary,references:$(n,new Map(r.references),new Set(r.incompleteReferenceSymbolIds??[]))}}catch(r){return this.opts.fallbackReferenceResolver?.referencesForDefinitions(n)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),references:U(n)}}}calleesForDefinitions(n){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:N(t),callees:W(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!1,includeCallees:!0});return{...O(r),resolvedBinary:t.resolvedBinary,callees:ce(n,new Map(r.callees??[]))}}catch(r){return this.opts.fallbackCalleeResolver?.calleesForDefinitions(n)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),callees:W(n)}}}referencesAndCalleesForDefinitions(n,t){let r=this.status(this.projectRoot);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:N(r),references:U(n),callees:W(t)};let s=[...n,...t];try{let i=this.requestSession(r.resolvedBinary,s,{includeReferences:n.length>0,includeCallees:t.length>0,referenceDefinitions:n,calleeDefinitions:t});return{...O(i),resolvedBinary:r.resolvedBinary,references:$(n,new Map(i.references),new Set(i.incompleteReferenceSymbolIds??[])),callees:ce(t,new Map(i.callees??[]))}}catch(i){return this.fallbackReferencesAndCallees(r,n,t,i)}}signaturesForDefinitions(n){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:N(t),signatures:on(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!1,includeCallees:!1,includeSignatures:!0});return{...O(r),resolvedBinary:t.resolvedBinary,signatures:dt(n,new Map(r.signatures??[]))}}catch(r){return this.opts.fallbackSignatureResolver?.signaturesForDefinitions(n)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),signatures:on(n)}}}importDefinitionsForFile(n,t){let r=this.status(this.projectRoot);if(t.length===0)return r.available?{available:!0,resolvedBinary:r.resolvedBinary,sourcePaths:new Map}:{available:!1,reason:r.reason,resolvedBinary:r.resolvedBinary,sourcePaths:new Map};if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:N(r),sourcePaths:new Map(t.map(s=>[s.id,null]))};try{let s=this.requestImportDefinitions(r.resolvedBinary,n,t);return{...O(s),resolvedBinary:r.resolvedBinary,sourcePaths:new Map(s.sourcePaths)}}catch(s){return{available:!1,resolvedBinary:r.resolvedBinary,reason:s instanceof Error?s.message:String(s),sourcePaths:new Map(t.map(i=>[i.id,null]))}}}dispose(){this.requester.shutdown()}requestSession(n,t,r){let s=Y(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,rn),i=Q(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),u=Y(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,sn),l=Q(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),d=r.referenceDefinitions?[...r.referenceDefinitions]:void 0,R=r.calleeDefinitions?[...r.calleeDefinitions]:void 0,c=r.signatureDefinitions?[...r.signatureDefinitions]:void 0,o=rt(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,...r}),a={projectRoot:this.projectRoot,rustAnalyzerBinary:n,definitions:[...t],...d?{referenceDefinitions:d}:{},...R?{calleeDefinitions:R}:{},...c?{signatureDefinitions:c}:{},requestTimeoutMs:s,...r.includeReferences!==!1&&i>0?{referenceRetryTimeoutMs:i}:{},diagnosticsTimeoutMs:l,settleDelayMs:o,concurrency:u,includeReferences:r.includeReferences,includeCallees:r.includeCallees,includeSignatures:r.includeSignatures},p=ft(a);return G("rust.semantic.session.request",()=>this.requester.requestSemantic(a,ae(p,pt(s,a.referenceRetryTimeoutMs),u)),()=>({definitions:t.length,operationDefinitions:p,referenceDefinitions:a.referenceDefinitions?.length,calleeDefinitions:a.calleeDefinitions?.length,signatureDefinitions:a.signatureDefinitions?.length,references:a.includeReferences!==!1,callees:a.includeCallees===!0,signatures:a.includeSignatures===!0,referenceRetryTimeoutMs:a.referenceRetryTimeoutMs}))}fallbackReferencesAndCallees(n,t,r,s){let i=t.length===0?{available:!0,resolvedBinary:n.resolvedBinary,references:U(t)}:this.opts.fallbackReferenceResolver?.referencesForDefinitions(t),u=r.length===0?{available:!0,resolvedBinary:n.resolvedBinary,callees:W(r)}:this.opts.fallbackCalleeResolver?.calleesForDefinitions(r);if(i&&u){let l={resolvedBinary:i.resolvedBinary??u.resolvedBinary??n.resolvedBinary,references:$(t,i.references),callees:ce(r,u.callees)};return i.available&&u.available?{available:!0,...l}:{available:!1,reason:(i.available?void 0:i.reason)??(u.available?void 0:u.reason)??"Rust semantic fallback was unavailable.",...l}}return{available:!1,resolvedBinary:n.resolvedBinary,reason:s instanceof Error?s.message:String(s),references:U(t),callees:W(r)}}requestImportDefinitions(n,t,r){let s=Y(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,rn),i=Y(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,sn),u=Q(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),l=Q(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,an),d={projectRoot:this.projectRoot,rustAnalyzerBinary:n,file:t,positions:[...r],requestTimeoutMs:s,diagnosticsTimeoutMs:u,settleDelayMs:l,concurrency:i};return G("rust.semantic.import-definitions.session.request",()=>this.requester.requestImportDefinitions(d,ae(r.length,s,i)),()=>({file:t,positions:r.length}))}};function O(e){return e.available?{available:!0}:{available:!1,reason:e.reason}}function N(e){return e.available?"rust-analyzer binary path is unavailable.":e.reason}function Sr(e,n,t={}){return new fe(e,n,t)}function rt(e,n){let t=dn(e);if(t!==null)return t;let r=n.includeReferences!==!1;return r&&n.includeCallees!==!0&&n.includeSignatures!==!0&&n.definitionCount<=nt||r&&n.includeCallees===!0&&n.includeSignatures!==!0&&n.definitionCount<=tt?0:an}function un(e){let n=e?.trim().toLowerCase(),t=n==="0"||n==="false"||n==="off"||n==="worker",r=n==="1"||n==="true"||n==="on"||n==="durable",s=n===void 0||n==="";return{transport:t||!s&&!r?"worker":"durable",source:s?"default":"environment",fallback:"worker",valid:s||t||r,optOut:"SCIP_RUST_SEMANTIC_DURABLE_SESSION=0"}}function st(e){return un(e).transport}function br(e,n){let t=un(n);if(t.transport==="worker")return{...t,state:"per-command"};let r=F(cn()),s=ie(e,r,de()),i=B(s);return i?{...t,state:P(i,Date.now(),j,L)?"live":"stale",pid:i.pid,heartbeatAtMs:i.heartbeatAtMs,...i.busyUntilMs===void 0?{}:{busyUntilMs:i.busyUntilMs}}:{...t,state:"stopped"}}function it(e,n){let t=null,r=!1,s=!1,i=!1,u=()=>t??=n(),l=()=>{s||(e.shutdown(),s=!0)},d=(c,o,a)=>{let p=ct(c);r=!0;try{l()}catch{}C()&&v({type:"span",name:"rust.semantic.durable-session.request",durationMs:a,ok:!1,kind:o,session:"worker-fallback",reason:p})},R=(c,o,a)=>{if(i)throw new Error("Rust semantic failover session was already disposed.");if(r)return a(u());let p=performance.now();try{return o(e)}catch(m){d(m,c,performance.now()-p)}return a(u())};return{requestSemantic(c,o){return R("semantic",a=>a.requestSemantic(c,o),a=>a.requestSemantic(c,o))},requestImportDefinitions(c,o){return R("import-definitions",a=>a.requestImportDefinitions(c,o),a=>a.requestImportDefinitions(c,o))},shutdown(){if(i)return;i=!0;let c=[];try{l()}catch(o){c.push(o)}try{t?.shutdown()}catch(o){c.push(o)}if(c.length>0)throw c[0]}}}function ot(e,n,t={worker:()=>at(),durable:()=>Ge(e,{serverPath:F(cn()),semanticWorkerPath:F(ln())})}){return st(n)==="durable"?it(t.durable(),t.worker):t.worker()}function at(e={}){let n=null,t=null,r=1,s=!1,i=null,u=null,l=o=>{o&&ue(o,{recursive:!0,force:!0})},d=()=>{if(i)return;let o=n,a=t;n=null,t=null;let p=o?o.terminate():Promise.resolve(0);i=Promise.allSettled([p,xe(a,{gracefulMs:1e3,forceMs:1e3})]).then(([m,y])=>{let D=(y.status==="fulfilled"?y.value:[{reaped:!1,detail:String(y.reason)}]).filter(g=>!g.reaped);if(m.status==="rejected"||D.length>0){u=new Error(`Rust semantic worker cleanup did not complete; ownership evidence remains at ${a??"unknown"}.`);return}l(a)}).finally(()=>{i=null})},R=()=>{if(n)return n;if(i)throw new Error("The previous Rust semantic session worker is still terminating; retry the request.");if(u)throw u;let o=e.semanticWorkerPath?Gn(e.semanticWorkerPath):ln();if(!Xn(F(o)))throw new Error(`Rust semantic session worker was not found at ${F(o)}. Run npm run build before using built semantic Rust queries.`);return t=tn(le(de(),"codebaseiq-rust-session-")),n=new et(o,e.shareEnvironment?{env:Zn}:void 0),n.unref(),n},c=()=>{let o=t??tn(le(de(),"codebaseiq-rust-session-"));return t=o,le(o,`${r++}.json`)};return{requestSemantic(o,a){if(s)throw new Error("Rust semantic session was already disposed.");let p=R(),m=c(),y=new SharedArrayBuffer(4),h=new Int32Array(y);if(p.postMessage({kind:"semantic",request:o,responsePath:m,sharedBuffer:y}),Atomics.wait(h,0,0,a)==="timed-out")throw d(),new Error(`Rust semantic session worker timed out after ${(a/1e3).toFixed(0)}s`);try{let g=ut(A(m,{maxBytes:E,inputKind:"Rust semantic worker response"}));if(!g.ok)throw new Error(g.error);return g.response}finally{ue(m,{force:!0})}},requestImportDefinitions(o,a){if(s)throw new Error("Rust semantic session was already disposed.");let p=R(),m=c(),y=new SharedArrayBuffer(4),h=new Int32Array(y);if(p.postMessage({kind:"import-definitions",request:o,responsePath:m,sharedBuffer:y}),Atomics.wait(h,0,0,a)==="timed-out")throw d(),new Error(`Rust semantic import-definition session worker timed out after ${(a/1e3).toFixed(0)}s`);try{let g=lt(A(m,{maxBytes:E,inputKind:"Rust import-definition worker response"}));if(!g.ok)throw new Error(g.error);return g.response}finally{ue(m,{force:!0})}},shutdown(){if(s)return;if(s=!0,!n){l(t),t=null;return}let o=c(),a=new SharedArrayBuffer(4),p=new Int32Array(a);n.postMessage({kind:"shutdown",responsePath:o,sharedBuffer:a}),Atomics.wait(p,0,0,5e3),d()}}}function ut(e){let n=JSON.parse(e);if(!n||typeof n!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=n;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof n.error=="string"?n.error:"Rust semantic session worker failed."}}function lt(e){let n=JSON.parse(e);if(!n||typeof n!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=n;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof n.error=="string"?n.error:"Rust semantic session worker failed."}}function ct(e){let n=e instanceof Error?`${e.name} ${e.message}`.toLowerCase():String(e).toLowerCase();return n.includes("readiness")?"readiness":n.includes("timeout")||n.includes("timed out")?"timeout":n.includes("helper")?"helper":"request"}function U(e){return new Map(e.map(n=>[n.symbolId,[]]))}function W(e){return new Map(e.map(n=>[n.symbolId,[]]))}function on(e){return new Map(e.map(n=>[n.symbolId,null]))}function ce(e,n){return new Map(e.map(t=>[t.symbolId,n.get(t.symbolId)??[]]))}function dt(e,n){return new Map(e.map(t=>[t.symbolId,n.get(t.symbolId)??null]))}function ft(e){let n=0;return e.includeReferences!==!1&&(n+=(e.referenceDefinitions??e.definitions).length),e.includeCallees===!0&&(n+=(e.calleeDefinitions??e.definitions).length),e.includeSignatures===!0&&(n+=(e.signatureDefinitions??e.definitions).length),Math.max(1,n)}function pt(e,n){return n&&n>0?Math.max(e,n):e}function ln(){return new URL("./rust-semantic-session-worker.js",import.meta.url)}function cn(){return new URL("./rust-semantic-session-server.js",import.meta.url)}function Y(e,n){return z(e)??n}function Q(e,n){return dn(e)??n}function dn(e){if(!e)return null;let n=Number(e);return Number.isInteger(n)&&n>=0?n:null}export{kt as a,At as b,Fe as c,Tt as d,b as e,V as f,Rn as g,ze as h,$ as i,ae as j,Sr as k,rt as l,br as m,at as n,pt as o};
2
- //# sourceMappingURL=chunk-NNO6A2PO.js.map
1
+ import{a as z}from"./chunk-P5XHIJHI.js";import{a as De,i as Me}from"./chunk-H5QXP63L.js";import{c as xe,h as _e}from"./chunk-EXMVF3JR.js";import{a as he,e as Ee,i as ke}from"./chunk-DRENNWRG.js";import{a as S,c as be,d as M,e as f,f as X,h as ge,j,t as x,u as k,v as Ae,x as q,y as K,z as we}from"./chunk-ACZDU5GK.js";import{a as C,i as G,k as v}from"./chunk-R2NOK63J.js";import{a as ye,b as Se,c as L,d as w}from"./chunk-6URCE5QY.js";import{a as pe,b as E,c as Re,f as me,g as A,ga as Ie,m as J}from"./chunk-4O52YNKL.js";import{createHash as fn}from"crypto";import{resolve as pn}from"path";var b=3;function V(e){return fn("sha256").update(x({kind:"codebaseiq-durable-rust-mailbox",protocolVersion:b,sessionDir:pn(e)})).digest("hex")}function Rn(e,n){if(!S(e)||typeof e.id!="string"||!e.id)return T("Durable Rust semantic helper received an invalid mailbox request.");if(e.id!==n.claimRequestId)return T("Durable Rust semantic request identity does not match its mailbox path.");if(e.protocolVersion===void 0){if(e.mailboxVersion!==void 0||e.operationKey!==void 0||e.clientId!==void 0||e.enqueuedAtMs!==void 0||e.deadlineAtMs!==void 0||e.sessionIdentity!==void 0)return T("Durable Rust semantic helper received a partially versioned request without a protocol version.");let s=Ce(e.request);if(!s)return T("Durable Rust semantic helper received an invalid legacy request kind or payload.");let i=n.nowMs+Math.max(1,s.timeoutMs);return{ok:!0,compatibility:"legacy-v2",value:{mailboxVersion:k,protocolVersion:b,id:e.id,operationKey:q("rust-semantic-v2",{id:e.id,request:s}),clientId:"legacy-v2",enqueuedAtMs:n.nowMs,deadlineAtMs:i,sessionIdentity:n.sessionIdentity,request:s}}}let t=mn(e,n);if(!t.ok)return t;if(e.protocolVersion!==b)return{ok:!1,code:"unsupported-protocol",error:`Durable Rust semantic helper does not support mailbox protocol ${String(e.protocolVersion)}.`,responseIdentity:t.responseIdentity};let r=Ce(e.request);return r?t.operationKey!==q("rust-semantic-v3",r)?{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received a mismatched mailbox operation identity.",responseIdentity:t.responseIdentity}:t.deadlineAtMs-t.enqueuedAtMs!==r.timeoutMs?{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received a deadline that does not match the request timeout.",responseIdentity:t.responseIdentity}:t.deadlineAtMs<n.nowMs?{ok:!1,code:"expired-request",error:"Durable Rust semantic request expired before processing.",responseIdentity:t.responseIdentity}:{ok:!0,compatibility:t.priorSessionIdentity?"prior-v3":"current-v3",value:{mailboxVersion:k,protocolVersion:b,id:e.id,operationKey:t.operationKey,clientId:t.clientId,enqueuedAtMs:t.enqueuedAtMs,deadlineAtMs:t.deadlineAtMs,sessionIdentity:n.sessionIdentity,request:r}}:{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received an invalid request kind or payload.",responseIdentity:t.responseIdentity}}function te(e,n){return S(e)?e.protocolVersion!==b?qe(e.protocolVersion===void 0?"helper wrote a prior uncorrelated response protocol":`helper wrote unsupported response protocol ${String(e.protocolVersion)}`):e.mailboxVersion!==k||e.id!==n.requestId||e.operationKey!==n.operationKey||e.sessionIdentity!==n.sessionIdentity||e.deadlineAtMs!==n.deadlineAtMs?qe("helper wrote an incompatible response identity"):typeof e.completedAtMs!="number"||!Number.isFinite(e.completedAtMs)||e.completedAtMs>n.deadlineAtMs||n.nowMs>n.deadlineAtMs?{ok:!1,code:"expired-request",error:"helper response arrived after the durable request deadline"}:e.ok===!1?typeof e.error!="string"||!Mn(e.errorCode)?ee("helper wrote an invalid rejection response"):{ok:!1,code:e.errorCode,error:e.error}:e.ok!==!0||e.session!=="created"&&e.session!=="reused"&&e.session!=="invalidated"||!gn(e.response,n.requestKind)?ee("helper wrote an invalid success response"):{ok:!0,session:e.session,response:e.response}:ee("helper wrote an invalid response object")}function mn(e,n){if(e.mailboxVersion!==k||typeof e.protocolVersion!="number"||!Number.isInteger(e.protocolVersion)||typeof e.operationKey!="string"||!Te(e.operationKey)||e.id!==K(e.operationKey)||typeof e.clientId!="string"||!e.clientId||typeof e.enqueuedAtMs!="number"||!Number.isFinite(e.enqueuedAtMs)||typeof e.deadlineAtMs!="number"||!Number.isFinite(e.deadlineAtMs)||e.deadlineAtMs<e.enqueuedAtMs||e.sessionIdentity!==void 0&&(typeof e.sessionIdentity!="string"||!Te(e.sessionIdentity))||e.sessionIdentity===void 0&&e.protocolVersion!==b)return T("Durable Rust semantic helper received an invalid mailbox lifecycle.");let t={id:n.claimRequestId,sessionIdentity:n.sessionIdentity,deadlineAtMs:e.deadlineAtMs};return e.sessionIdentity!==void 0&&e.sessionIdentity!==n.sessionIdentity?{ok:!1,code:"malformed-request",error:"Durable Rust semantic request belongs to a different mailbox session.",responseIdentity:t}:{ok:!0,responseIdentity:t,operationKey:e.operationKey,clientId:e.clientId,enqueuedAtMs:e.enqueuedAtMs,deadlineAtMs:e.deadlineAtMs,priorSessionIdentity:e.sessionIdentity===void 0}}function Ce(e){return!S(e)||typeof e.identityKey!="string"||!e.identityKey||!X(e.timeoutMs)||e.workerEnvironment!==void 0&&!be(e.workerEnvironment)?null:e.kind==="semantic"&&yn(e.request)?{kind:"semantic",identityKey:e.identityKey,...e.workerEnvironment===void 0?{}:{workerEnvironment:e.workerEnvironment},request:e.request,timeoutMs:e.timeoutMs}:e.kind==="import-definitions"&&Sn(e.request)?{kind:"import-definitions",identityKey:e.identityKey,...e.workerEnvironment===void 0?{}:{workerEnvironment:e.workerEnvironment},request:e.request,timeoutMs:e.timeoutMs}:null}function yn(e){return!S(e)||!M(e.projectRoot)||!M(e.rustAnalyzerBinary)||!Be(e.definitions)?!1:Z(e.referenceDefinitions)&&Z(e.calleeDefinitions)&&Z(e.signatureDefinitions)&&I(e.requestTimeoutMs)&&I(e.readinessDeadlineMs)&&I(e.referenceRetryTimeoutMs)&&I(e.diagnosticsTimeoutMs)&&I(e.settleDelayMs)&&Oe(e.concurrency)&&ne(e.includeReferences)&&ne(e.includeCallees)&&ne(e.includeSignatures)}function Sn(e){return!S(e)||!M(e.projectRoot)||!M(e.rustAnalyzerBinary)||!M(e.file)||!Array.isArray(e.positions)||!e.positions.every(n=>S(n)&&M(n.id)&&M(n.file)&&f(n.line)&&f(n.column))?!1:I(e.requestTimeoutMs)&&I(e.readinessDeadlineMs)&&I(e.diagnosticsTimeoutMs)&&I(e.settleDelayMs)&&Oe(e.concurrency)}function Be(e){return Array.isArray(e)&&e.every(bn)}function Z(e){return e===void 0||Be(e)}function bn(e){return S(e)&&f(e.symbolId)&&f(e.documentId)&&f(e.startLine)&&Pe(e.startChar)&&f(e.endLine)&&Pe(e.endChar)&&typeof e.symbol=="string"&&typeof e.relativePath=="string"&&typeof e.leaf=="string"&&(e.parentTypeName===null||typeof e.parentTypeName=="string")&&typeof e.isFunctionLike=="boolean"&&typeof e.isTypeLike=="boolean"&&(e.kind===null||Number.isSafeInteger(e.kind))&&(e.documentation===null||typeof e.documentation=="string")&&(e.enclosingSymbol===null||typeof e.enclosingSymbol=="string")}function gn(e,n){return!S(e)||typeof e.available!="boolean"||e.available===!1&&(typeof e.reason!="string"||e.reason.length===0)||e.available===!0&&e.reason!==void 0?!1:n==="import-definitions"?Array.isArray(e.sourcePaths)&&e.sourcePaths.every(t=>Array.isArray(t)&&t.length===2&&typeof t[0]=="string"&&(t[1]===null||typeof t[1]=="string")):ve(e.references,In)&&(e.incompleteReferenceSymbolIds===void 0||Array.isArray(e.incompleteReferenceSymbolIds)&&e.incompleteReferenceSymbolIds.every(t=>Number.isSafeInteger(t)))&&(e.callees===void 0||ve(e.callees,Dn))&&(e.signatures===void 0||Array.isArray(e.signatures)&&e.signatures.every(t=>Array.isArray(t)&&t.length===2&&Number.isSafeInteger(t[0])&&(t[1]===null||typeof t[1]=="string")))}function ve(e,n){return Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.length===2&&Number.isSafeInteger(t[0])&&Array.isArray(t[1])&&t[1].every(n))}function In(e){return S(e)&&typeof e.file=="string"&&f(e.line)&&f(e.column)}function Dn(e){return S(e)&&typeof e.symbol=="string"&&typeof e.file=="string"&&f(e.line)&&(e.callsiteLine===void 0||f(e.callsiteLine))}function Mn(e){return e==="unsupported-protocol"||e==="malformed-request"||e==="expired-request"||e==="handler-error"}function T(e){return{ok:!1,code:"malformed-request",error:e}}function ee(e){return{ok:!1,code:"malformed-response",error:e}}function qe(e){return{ok:!1,code:"incompatible-response",error:e}}function Te(e){return/^[a-f0-9]{64}$/.test(e)}function Oe(e){return e===void 0||X(e)}function Pe(e){return e===void 0||f(e)}function I(e){return e===void 0||ge(e)}function ne(e){return e===void 0||typeof e=="boolean"}import{spawn as Bn}from"child_process";import{createHash as On,randomUUID as Nn}from"crypto";import{existsSync as Qe,realpathSync as Un,rmSync as Wn}from"fs";import{tmpdir as Fn}from"os";import{resolve as _}from"path";import{execFileSync as Cn}from"child_process";import{existsSync as hn}from"fs";import{deserializeSCIP as En,SymbolRole as kn}from"@c4312/scip";var re=new WeakMap,An="SCIP_RUST_SCIP_OCCURRENCE_REFERENCE_MODE";function kt(e,n){let t=new Map,r=H(),s=n.filter(u=>Ue(u,r));if(s.length===0)return t;let i=We(e);if(!i)return t;for(let u of s){let l=Ne(i,u);l!==null&&t.set(u.symbolId,l)}return t}function At(e,n){if(!Ue(n,H()))return null;let t=We(e);return t?Ne(t,n):null}function Ne(e,n){return e.referencesBySymbol.get(n.symbol)??[]}function Ue(e,n="safe"){if(!e.symbol.startsWith("rust-analyzer ")||!e.relativePath.endsWith(".rs")||ke(e.symbol)||/impl#\[[^\]]+\]\[Default\]default\(\)\.$/.test(e.symbol))return!1;if(n==="all")return!0;let t=Ee(e.symbol);if(t==="method")return!0;if(t!=="term")return!1;let r=he(e.symbol);return"kind"in r?!1:!wn(r)}function wn(e){for(let n=0;n<e.descriptors.length-1;n+=1)if(e.descriptors[n]?.suffix==="type")return!0;return!1}function We(e){if(re.has(e))return re.get(e)??null;let n=xn(e);return re.set(e,n),n}function xn(e){if(!e.generation.indexPath||!hn(e.generation.indexPath))return null;try{let n=En(me(e.generation.indexPath,{inputKind:"SCIP occurrence-reference index",maxBytes:Re})),t=new Map;for(let r of n.documents??[]){let s=r.relativePath;if(!(!s||e.isIgnored(s)))for(let i of r.occurrences??[]){if(!i.symbol||(i.symbolRoles&kn.Definition)!==0)continue;let u=_n(s,i.range);if(!u)continue;let l=t.get(i.symbol)??[];l.push(u),t.set(i.symbol,l)}}for(let[r,s]of t)t.set(r,_e(s));return{referencesBySymbol:t}}catch{return null}}function _n(e,n){if(n.length<3)return null;let t=n[0],r=n[1];return!Number.isInteger(t)||!Number.isInteger(r)?null:{file:e,line:t,column:r}}function H(){return process.env[An]==="all"?"all":"safe"}function Fe(e){let n=Me(De,e),t=n.runnable;return t?{available:!0,dependencyAvailable:t,resolvedBinary:n.resolvedBinary??void 0,note:"rust-analyzer semantic reference queries are enabled."}:{available:!1,dependencyAvailable:t,resolvedBinary:n.resolvedBinary??void 0,reason:"rust-analyzer is not runnable; Rust semantic checks will use SCIP/source evidence only."}}var Le=new Map;function se(e){let t=Fe(e).resolvedBinary??null;return{engine:"rust-analyzer",resolvedBinary:t,version:t?vn(e,t):"unavailable"}}function Tt(e){return{...se(e),scipOccurrenceReferenceMode:H()}}function vn(e,n){let t=`${e}\0${n}`,r=Le.get(t);if(r)return r;let s;try{s=Cn(n,["--version"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:2e3}).trim()}catch{s="unknown"}return Le.set(t,s),s}import{createHash as qn}from"crypto";var Tn=new Set(["Cargo.lock","Cargo.toml","rust-project.json","rust-toolchain","rust-toolchain.toml"]);function je(e){let n=Ie(e,{includePath:Pn});return qn("sha256").update(JSON.stringify(n)).digest("hex")}function Pn(e){let n=e.replaceAll("\\","/"),t=n.split("/").at(-1)??n;return n.endsWith(".rs")||Tn.has(t)?!0:n===".cargo/config"||n===".cargo/config.toml"||n.endsWith("/.cargo/config")||n.endsWith("/.cargo/config.toml")}var Ln=5e3,Je=10,jn=3e4;function Ke(e,n,t,r=nn){let s=r.engineIdentity(e),i={protocolVersion:b,projectRoot:r.canonicalProjectRoot(e),projectFingerprint:r.projectFingerprint(e),engine:{engine:s.engine,resolvedBinary:s.resolvedBinary,version:s.version},workerFingerprint:r.fileFingerprint(n),environment:Xe(r.environment())};return{key:oe(x(i)),...i}}var ze=class{constructor(n,t=Vn){this.createRequester=n;this.applyEnvironment=t}createRequester;applyEnvironment;requester=null;identityKey=null;semanticResponseCache=null;handle(n){this.applyEnvironment(n.workerEnvironment??{});let t;if(this.requester?this.identityKey!==n.identityKey?(this.semanticResponseCache=null,this.requester.shutdown(),this.requester=this.createRequester(),this.identityKey=n.identityKey,t="invalidated"):t="reused":(this.requester=this.createRequester(),this.identityKey=n.identityKey,t="created"),n.kind==="semantic"){let r=Kn(n.request),s=t==="reused"&&r!==null&&this.semanticResponseCache?.identityKey===n.identityKey&&this.semanticResponseCache.requestKey===r?this.semanticResponseCache.response:null;if(s)return Ve(!0,n.request.definitions.length),{session:t,response:s};let i=this.requester.requestSemantic(n.request,n.timeoutMs);return r!==null&&zn(i)&&(this.semanticResponseCache={identityKey:n.identityKey,requestKey:r,response:i}),Ve(!1,n.request.definitions.length),{session:t,response:i}}return{session:t,response:this.requester.requestImportDefinitions(n.request,n.timeoutMs)}}shutdown(){this.requester?.shutdown(),this.requester=null,this.identityKey=null,this.semanticResponseCache=null}};function Kn(e){if(e.includeReferences===!1||e.includeCallees!==!0||e.includeSignatures===!0||(e.referenceDefinitions?.length??0)===0||(e.calleeDefinitions?.length??0)===0)return null;let{readinessDeadlineMs:n,...t}=e;return oe(x(t))}function zn(e){return e.available&&Array.isArray(e.callees)&&(e.incompleteReferenceSymbolIds?.length??0)===0}function Ve(e,n){C()&&v({type:"span",name:"rust.semantic.durable-session.response-cache",durationMs:0,ok:!0,hit:e,definitions:n})}function P(e,n,t,r){if(e.protocolVersion!==b||!t(e.pid))return!1;if(!e.processIdentity)return!0;let s=r?.(e.pid);return s!=null&&Se(e.processIdentity,s)}function ie(e,n,t){let r;try{r=J(n,{maxBytes:E,inputKind:"Rust semantic engine artifact"})}catch{r="missing"}let s=oe(x({projectRoot:_(e),serverPath:_(n),serverFingerprint:r})).slice(0,20);return _(t,`codebaseiq-rust-session-${s}`)}function He(e){let n=e===void 0?Number.NaN:Number(e);return Number.isInteger(n)&&n>=0?n:0}function Xe(e){return Object.fromEntries(Object.entries(e).filter(([n])=>Ze(n)).sort(([n],[t])=>n.localeCompare(t)).map(([n,t])=>[n,t??null]))}function Ge(e,n){let t=n.runtime??Jn,r=n.identityRuntime??nn,s=ie(e,n.serverPath,n.tempRoot??Fn()),i=!1,u=(l,d)=>{if(i)throw new Error("Durable Rust semantic session was already disposed.");return $n(s,n.serverPath,n.semanticWorkerPath,l,d,t,n.mailboxLimits)};return{requestSemantic(l,d){let R=Ke(e,n.semanticWorkerPath,l,r),{readinessDeadlineMs:c,...o}=l;return u({kind:"semantic",identityKey:R.key,workerEnvironment:Ye(),request:{...o,referenceRetryTimeoutMs:Hn(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,l.referenceRetryTimeoutMs),settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?l.settleDelayMs:He(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:d},d)},requestImportDefinitions(l,d){let R=Ke(e,n.semanticWorkerPath,l,r),{readinessDeadlineMs:c,...o}=l;return u({kind:"import-definitions",identityKey:R.key,workerEnvironment:Ye(),request:{...o,settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?l.settleDelayMs:He(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:d},d)},shutdown(){i=!0}}}function Vn(e){for(let n of Object.keys(process.env))en(n)&&delete process.env[n];for(let[n,t]of Object.entries(e))t!==null&&(process.env[n]=t)}function Hn(e,n){return n!==void 0?n:e===void 0?jn:void 0}function $n(e,n,t,r,s,i,u={}){let l=i.now(),d=l+s,R=(i.monotonicNow??w)(),c=R+s,o=q("rust-semantic-v3",r),a=K(o),p=Ae(e),m=V(e),y=we(p,{mailboxVersion:k,protocolVersion:b,id:a,operationKey:o,clientId:i.randomId(),enqueuedAtMs:l,deadlineAtMs:d,sessionIdentity:m,request:r},{nowMs:l,limits:u});for($e(e,n,t,c,i);(i.monotonicNow??w)()<=c;){if(Qe(y.responsePath)){let D=Yn(A(y.responsePath,{maxBytes:u.maxItemBytes??E,inputKind:"durable Rust semantic mailbox response"}),{requestId:a,operationKey:o,sessionIdentity:m,deadlineAtMs:y.authoritativeDeadlineAtMs,requestKind:r.kind,nowMs:i.now()});if(!D.ok)throw new Error(D.error);return C()&&v({type:"span",name:"rust.semantic.durable-session.request",durationMs:(i.monotonicNow??w)()-R,ok:!0,session:D.session,kind:r.kind}),D.response}let h=B(e);(!h||!P(h,i.now(),i.isProcessAlive,i.readProcessIdentity))&&$e(e,n,t,c,i),i.sleep(Je)}throw new Error(`Durable Rust semantic session timed out after ${(s/1e3).toFixed(0)}s.`)}function $e(e,n,t,r,s){let i=B(e);if(i&&P(i,s.now(),s.isProcessAlive,s.readProcessIdentity))return;Wn(_(e,"server.json"),{force:!0}),s.spawnServer(n,e,t);let u=s.monotonicNow??w,l=Math.min(r,u()+Ln);for(;u()<=l;){let d=B(e);if(d&&P(d,s.now(),s.isProcessAlive,s.readProcessIdentity))return;s.sleep(Je)}throw new Error("Durable Rust semantic session helper did not become ready within 5s.")}function B(e){try{let n=JSON.parse(A(_(e,"server.json"),{maxBytes:pe,inputKind:"durable Rust session state"}));if(typeof n.protocolVersion!="number"||n.sessionIdentity!==void 0&&(typeof n.sessionIdentity!="string"||n.sessionIdentity!==V(e))||typeof n.pid!="number"||typeof n.heartbeatAtMs!="number"||n.busyUntilMs!==void 0&&typeof n.busyUntilMs!="number"||n.mailbox!==void 0&&!Qn(n.mailbox))return null;let t=n.processIdentity===void 0?null:ye(n.processIdentity);return n.processIdentity!==void 0&&(!t||t.pid!==n.pid)?null:{protocolVersion:n.protocolVersion,...n.sessionIdentity===void 0?{}:{sessionIdentity:n.sessionIdentity},pid:n.pid,...t?{processIdentity:t}:{},heartbeatAtMs:n.heartbeatAtMs,...n.busyUntilMs===void 0?{}:{busyUntilMs:n.busyUntilMs},...n.mailbox===void 0?{}:{mailbox:n.mailbox}}}catch{return null}}function Yn(e,n){try{return te(JSON.parse(e),n)}catch(t){return{ok:!1,code:"malformed-response",error:`helper wrote malformed JSON: ${t instanceof Error?t.message:String(t)}`}}}function Qn(e){if(!e||typeof e!="object")return!1;let n=e;return f(n.pending)&&f(n.inflight)&&f(n.responses)&&f(n.deadLetters)&&f(n.invalid)&&f(n.totalItems)&&typeof n.totalBytes=="number"&&Number.isFinite(n.totalBytes)&&n.totalBytes>=0&&(n.oldestPendingAt===void 0||Number.isFinite(Date.parse(n.oldestPendingAt)))}function Ye(){return Object.fromEntries(Object.entries(process.env).filter(([e])=>en(e)).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,n??null]))}function Ze(e){return e==="HOME"||e==="PATH"||e.startsWith("CARGO_")||e.startsWith("RA_")||e.startsWith("RUST")}function en(e){return Ze(e)||e.startsWith("SCIP_RUST_")||e==="CODEBASEIQ_PROFILE"||e==="CODEBASEIQ_PROFILE_CACHE_STATE"||e==="CODEBASEIQ_PROFILE_COMMAND"||e==="CODEBASEIQ_PROFILE_OUT"||e==="CODEBASEIQ_PROFILE_RUN_ID"||e==="CODEBASEIQ_PROFILE_WORKLOAD_IDENTITY"||e==="CODEBASEIQ_PROFILE_WORKLOAD_IDENTITY_KIND"||e==="CODEBASEIQ_PROFILE_MIN_MS"}var nn={canonicalProjectRoot(e){try{return Un(e)}catch{return _(e)}},projectFingerprint(e){return je(e)},engineIdentity:se,fileFingerprint(e){return J(e,{maxBytes:E,inputKind:"Rust semantic engine artifact"})},environment(){return Xe(process.env)}},Jn={now:Date.now,monotonicNow:w,randomId:Nn,isProcessAlive:j,readProcessIdentity:L,spawnServer(e,n,t){if(!Qe(e))throw new Error(`Durable Rust semantic session helper was not found at ${e}. Run npm run build first.`);Bn(process.execPath,[e,n,t],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()},sleep(e){let n=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(n,0,0,e)}};function oe(e){return On("sha256").update(e).digest("hex")}import{existsSync as Xn,mkdtempSync as tn,rmSync as ue}from"fs";import{tmpdir as de}from"os";import{join as le}from"path";import{fileURLToPath as F,pathToFileURL as Gn}from"url";import{SHARE_ENV as Zn,Worker as et}from"worker_threads";function $(e,n,t=new Set){let r=new Map;for(let s of e)t.has(s.symbolId)||r.set(s.symbolId,n.get(s.symbolId)??[]);return r}function ae(e,n,t){let r=z(process.env.SCIP_RUST_SEMANTIC_BATCH_TIMEOUT_MS)??0;if(r>0)return r;let s=Math.max(1,Math.ceil(e/Math.max(1,t)));return Math.max(12e4,3e4+s*n)}var rn=15e3,sn=8,an=5e3,nt=64,tt=96,fe=class{constructor(n,t,r={}){this.projectRoot=n;this.status=t;this.opts=r;this.requester=r.requester??ot(n,process.env.SCIP_RUST_SEMANTIC_DURABLE_SESSION)}projectRoot;status;opts;requester;referencesForDefinitions(n){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:N(t),references:U(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!0});return{...O(r),resolvedBinary:t.resolvedBinary,references:$(n,new Map(r.references),new Set(r.incompleteReferenceSymbolIds??[]))}}catch(r){return this.opts.fallbackReferenceResolver?.referencesForDefinitions(n)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),references:U(n)}}}calleesForDefinitions(n){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:N(t),callees:W(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!1,includeCallees:!0});return{...O(r),resolvedBinary:t.resolvedBinary,callees:ce(n,new Map(r.callees??[]))}}catch(r){return this.opts.fallbackCalleeResolver?.calleesForDefinitions(n)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),callees:W(n)}}}referencesAndCalleesForDefinitions(n,t){let r=this.status(this.projectRoot);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:N(r),references:U(n),callees:W(t)};let s=[...n,...t];try{let i=this.requestSession(r.resolvedBinary,s,{includeReferences:n.length>0,includeCallees:t.length>0,referenceDefinitions:n,calleeDefinitions:t});return{...O(i),resolvedBinary:r.resolvedBinary,references:$(n,new Map(i.references),new Set(i.incompleteReferenceSymbolIds??[])),callees:ce(t,new Map(i.callees??[]))}}catch(i){return this.fallbackReferencesAndCallees(r,n,t,i)}}signaturesForDefinitions(n){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:N(t),signatures:on(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!1,includeCallees:!1,includeSignatures:!0});return{...O(r),resolvedBinary:t.resolvedBinary,signatures:dt(n,new Map(r.signatures??[]))}}catch(r){return this.opts.fallbackSignatureResolver?.signaturesForDefinitions(n)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),signatures:on(n)}}}importDefinitionsForFile(n,t){let r=this.status(this.projectRoot);if(t.length===0)return r.available?{available:!0,resolvedBinary:r.resolvedBinary,sourcePaths:new Map}:{available:!1,reason:r.reason,resolvedBinary:r.resolvedBinary,sourcePaths:new Map};if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:N(r),sourcePaths:new Map(t.map(s=>[s.id,null]))};try{let s=this.requestImportDefinitions(r.resolvedBinary,n,t);return{...O(s),resolvedBinary:r.resolvedBinary,sourcePaths:new Map(s.sourcePaths)}}catch(s){return{available:!1,resolvedBinary:r.resolvedBinary,reason:s instanceof Error?s.message:String(s),sourcePaths:new Map(t.map(i=>[i.id,null]))}}}dispose(){this.requester.shutdown()}requestSession(n,t,r){let s=Y(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,rn),i=Q(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),u=Y(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,sn),l=Q(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),d=r.referenceDefinitions?[...r.referenceDefinitions]:void 0,R=r.calleeDefinitions?[...r.calleeDefinitions]:void 0,c=r.signatureDefinitions?[...r.signatureDefinitions]:void 0,o=rt(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,...r}),a={projectRoot:this.projectRoot,rustAnalyzerBinary:n,definitions:[...t],...d?{referenceDefinitions:d}:{},...R?{calleeDefinitions:R}:{},...c?{signatureDefinitions:c}:{},requestTimeoutMs:s,...r.includeReferences!==!1&&i>0?{referenceRetryTimeoutMs:i}:{},diagnosticsTimeoutMs:l,settleDelayMs:o,concurrency:u,includeReferences:r.includeReferences,includeCallees:r.includeCallees,includeSignatures:r.includeSignatures},p=ft(a);return G("rust.semantic.session.request",()=>this.requester.requestSemantic(a,ae(p,pt(s,a.referenceRetryTimeoutMs),u)),()=>({definitions:t.length,operationDefinitions:p,referenceDefinitions:a.referenceDefinitions?.length,calleeDefinitions:a.calleeDefinitions?.length,signatureDefinitions:a.signatureDefinitions?.length,references:a.includeReferences!==!1,callees:a.includeCallees===!0,signatures:a.includeSignatures===!0,referenceRetryTimeoutMs:a.referenceRetryTimeoutMs}))}fallbackReferencesAndCallees(n,t,r,s){let i=t.length===0?{available:!0,resolvedBinary:n.resolvedBinary,references:U(t)}:this.opts.fallbackReferenceResolver?.referencesForDefinitions(t),u=r.length===0?{available:!0,resolvedBinary:n.resolvedBinary,callees:W(r)}:this.opts.fallbackCalleeResolver?.calleesForDefinitions(r);if(i&&u){let l={resolvedBinary:i.resolvedBinary??u.resolvedBinary??n.resolvedBinary,references:$(t,i.references),callees:ce(r,u.callees)};return i.available&&u.available?{available:!0,...l}:{available:!1,reason:(i.available?void 0:i.reason)??(u.available?void 0:u.reason)??"Rust semantic fallback was unavailable.",...l}}return{available:!1,resolvedBinary:n.resolvedBinary,reason:s instanceof Error?s.message:String(s),references:U(t),callees:W(r)}}requestImportDefinitions(n,t,r){let s=Y(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,rn),i=Y(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,sn),u=Q(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),l=Q(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,an),d={projectRoot:this.projectRoot,rustAnalyzerBinary:n,file:t,positions:[...r],requestTimeoutMs:s,diagnosticsTimeoutMs:u,settleDelayMs:l,concurrency:i};return G("rust.semantic.import-definitions.session.request",()=>this.requester.requestImportDefinitions(d,ae(r.length,s,i)),()=>({file:t,positions:r.length}))}};function O(e){return e.available?{available:!0}:{available:!1,reason:e.reason}}function N(e){return e.available?"rust-analyzer binary path is unavailable.":e.reason}function Sr(e,n,t={}){return new fe(e,n,t)}function rt(e,n){let t=dn(e);if(t!==null)return t;let r=n.includeReferences!==!1;return r&&n.includeCallees!==!0&&n.includeSignatures!==!0&&n.definitionCount<=nt||r&&n.includeCallees===!0&&n.includeSignatures!==!0&&n.definitionCount<=tt?0:an}function un(e){let n=e?.trim().toLowerCase(),t=n==="0"||n==="false"||n==="off"||n==="worker",r=n==="1"||n==="true"||n==="on"||n==="durable",s=n===void 0||n==="";return{transport:t||!s&&!r?"worker":"durable",source:s?"default":"environment",fallback:"worker",valid:s||t||r,optOut:"SCIP_RUST_SEMANTIC_DURABLE_SESSION=0"}}function st(e){return un(e).transport}function br(e,n){let t=un(n);if(t.transport==="worker")return{...t,state:"per-command"};let r=F(cn()),s=ie(e,r,de()),i=B(s);return i?{...t,state:P(i,Date.now(),j,L)?"live":"stale",pid:i.pid,heartbeatAtMs:i.heartbeatAtMs,...i.busyUntilMs===void 0?{}:{busyUntilMs:i.busyUntilMs}}:{...t,state:"stopped"}}function it(e,n){let t=null,r=!1,s=!1,i=!1,u=()=>t??=n(),l=()=>{s||(e.shutdown(),s=!0)},d=(c,o,a)=>{let p=ct(c);r=!0;try{l()}catch{}C()&&v({type:"span",name:"rust.semantic.durable-session.request",durationMs:a,ok:!1,kind:o,session:"worker-fallback",reason:p})},R=(c,o,a)=>{if(i)throw new Error("Rust semantic failover session was already disposed.");if(r)return a(u());let p=performance.now();try{return o(e)}catch(m){d(m,c,performance.now()-p)}return a(u())};return{requestSemantic(c,o){return R("semantic",a=>a.requestSemantic(c,o),a=>a.requestSemantic(c,o))},requestImportDefinitions(c,o){return R("import-definitions",a=>a.requestImportDefinitions(c,o),a=>a.requestImportDefinitions(c,o))},shutdown(){if(i)return;i=!0;let c=[];try{l()}catch(o){c.push(o)}try{t?.shutdown()}catch(o){c.push(o)}if(c.length>0)throw c[0]}}}function ot(e,n,t={worker:()=>at(),durable:()=>Ge(e,{serverPath:F(cn()),semanticWorkerPath:F(ln())})}){return st(n)==="durable"?it(t.durable(),t.worker):t.worker()}function at(e={}){let n=null,t=null,r=1,s=!1,i=null,u=null,l=o=>{o&&ue(o,{recursive:!0,force:!0})},d=()=>{if(i)return;let o=n,a=t;n=null,t=null;let p=o?o.terminate():Promise.resolve(0);i=Promise.allSettled([p,xe(a,{gracefulMs:1e3,forceMs:1e3})]).then(([m,y])=>{let D=(y.status==="fulfilled"?y.value:[{reaped:!1,detail:String(y.reason)}]).filter(g=>!g.reaped);if(m.status==="rejected"||D.length>0){u=new Error(`Rust semantic worker cleanup did not complete; ownership evidence remains at ${a??"unknown"}.`);return}l(a)}).finally(()=>{i=null})},R=()=>{if(n)return n;if(i)throw new Error("The previous Rust semantic session worker is still terminating; retry the request.");if(u)throw u;let o=e.semanticWorkerPath?Gn(e.semanticWorkerPath):ln();if(!Xn(F(o)))throw new Error(`Rust semantic session worker was not found at ${F(o)}. Run npm run build before using built semantic Rust queries.`);return t=tn(le(de(),"codebaseiq-rust-session-")),n=new et(o,e.shareEnvironment?{env:Zn}:void 0),n.unref(),n},c=()=>{let o=t??tn(le(de(),"codebaseiq-rust-session-"));return t=o,le(o,`${r++}.json`)};return{requestSemantic(o,a){if(s)throw new Error("Rust semantic session was already disposed.");let p=R(),m=c(),y=new SharedArrayBuffer(4),h=new Int32Array(y);if(p.postMessage({kind:"semantic",request:o,responsePath:m,sharedBuffer:y}),Atomics.wait(h,0,0,a)==="timed-out")throw d(),new Error(`Rust semantic session worker timed out after ${(a/1e3).toFixed(0)}s`);try{let g=ut(A(m,{maxBytes:E,inputKind:"Rust semantic worker response"}));if(!g.ok)throw new Error(g.error);return g.response}finally{ue(m,{force:!0})}},requestImportDefinitions(o,a){if(s)throw new Error("Rust semantic session was already disposed.");let p=R(),m=c(),y=new SharedArrayBuffer(4),h=new Int32Array(y);if(p.postMessage({kind:"import-definitions",request:o,responsePath:m,sharedBuffer:y}),Atomics.wait(h,0,0,a)==="timed-out")throw d(),new Error(`Rust semantic import-definition session worker timed out after ${(a/1e3).toFixed(0)}s`);try{let g=lt(A(m,{maxBytes:E,inputKind:"Rust import-definition worker response"}));if(!g.ok)throw new Error(g.error);return g.response}finally{ue(m,{force:!0})}},shutdown(){if(s)return;if(s=!0,!n){l(t),t=null;return}let o=c(),a=new SharedArrayBuffer(4),p=new Int32Array(a);n.postMessage({kind:"shutdown",responsePath:o,sharedBuffer:a}),Atomics.wait(p,0,0,5e3),d()}}}function ut(e){let n=JSON.parse(e);if(!n||typeof n!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=n;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof n.error=="string"?n.error:"Rust semantic session worker failed."}}function lt(e){let n=JSON.parse(e);if(!n||typeof n!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=n;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof n.error=="string"?n.error:"Rust semantic session worker failed."}}function ct(e){let n=e instanceof Error?`${e.name} ${e.message}`.toLowerCase():String(e).toLowerCase();return n.includes("readiness")?"readiness":n.includes("timeout")||n.includes("timed out")?"timeout":n.includes("helper")?"helper":"request"}function U(e){return new Map(e.map(n=>[n.symbolId,[]]))}function W(e){return new Map(e.map(n=>[n.symbolId,[]]))}function on(e){return new Map(e.map(n=>[n.symbolId,null]))}function ce(e,n){return new Map(e.map(t=>[t.symbolId,n.get(t.symbolId)??[]]))}function dt(e,n){return new Map(e.map(t=>[t.symbolId,n.get(t.symbolId)??null]))}function ft(e){let n=0;return e.includeReferences!==!1&&(n+=(e.referenceDefinitions??e.definitions).length),e.includeCallees===!0&&(n+=(e.calleeDefinitions??e.definitions).length),e.includeSignatures===!0&&(n+=(e.signatureDefinitions??e.definitions).length),Math.max(1,n)}function pt(e,n){return n&&n>0?Math.max(e,n):e}function ln(){return new URL("./rust-semantic-session-worker.js",import.meta.url)}function cn(){return new URL("./rust-semantic-session-server.js",import.meta.url)}function Y(e,n){return z(e)??n}function Q(e,n){return dn(e)??n}function dn(e){if(!e)return null;let n=Number(e);return Number.isInteger(n)&&n>=0?n:null}export{kt as a,At as b,Fe as c,Tt as d,b as e,V as f,Rn as g,ze as h,$ as i,ae as j,Sr as k,rt as l,br as m,at as n,pt as o};
2
+ //# sourceMappingURL=chunk-HCMQZPEO.js.map
@@ -1,2 +1,2 @@
1
- import{a as d,b as m}from"./chunk-IRQOAM5G.js";import{c as u}from"./chunk-NMTSZXCL.js";import{a as c}from"./chunk-NNOKTMZT.js";function y(t,e={}){let{minSimilarity:o=.5,limit:l=20,scope:n,filePattern:p}=e,r=e.minDeps??(p?1:3),{profiles:i,distinctiveDeps:f}=D(t,{scope:n,minDeps:r}),s=d(i,a=>a.deps);return m({profiles:i,limit:l,filePattern:p,overrunFactor:5,candidateIndex:s,profile:{name:"similar-files"},compare:(a,g)=>F(a,g,o,f)})}function D(t,e){let{scope:o,minDeps:l}=e,n=c(t,o),{universalDeps:p,distinctiveDeps:r}=S(n),i=[];for(let[f,s]of n)s.size>=l&&i.push({file:f,deps:new Set([...s].filter(a=>!p.has(a)))});return{profiles:i,distinctiveDeps:r}}function S(t){let e=new Set,o=new Set,l=t.size;if(l===0)return{universalDeps:e,distinctiveDeps:o};let n=new Map;for(let r of t.values())for(let i of r)n.set(i,(n.get(i)??0)+1);let p=Math.max(3,Math.ceil(l*.03));for(let[r,i]of n)i>=5&&i/l>.3?e.add(r):i<=p&&o.add(r);return{universalDeps:e,distinctiveDeps:o}}function F(t,e,o,l){let n=new Set;for(let s of t.deps)e.deps.has(s)&&n.add(s);if(n.size<3||t.deps.size<4||e.deps.size<4)return null;let p=0;for(let s of n)l.has(s)&&p++;if(p<2)return null;let r=u(t.deps,e.deps);if(r<o)return null;let i=[];for(let s of t.deps)e.deps.has(s)||i.push(s);let f=[];for(let s of e.deps)t.deps.has(s)||f.push(s);return{fileA:t.file,fileB:e.file,similarity:r,sharedDeps:[...n],uniqueToA:i,uniqueToB:f}}export{y as a};
2
- //# sourceMappingURL=chunk-Q65CQ4XL.js.map
1
+ import{a as d,b as m}from"./chunk-IRQOAM5G.js";import{c as u}from"./chunk-NMTSZXCL.js";import{a as c}from"./chunk-B2E3HZ2A.js";function y(t,e={}){let{minSimilarity:o=.5,limit:l=20,scope:n,filePattern:p}=e,r=e.minDeps??(p?1:3),{profiles:i,distinctiveDeps:f}=D(t,{scope:n,minDeps:r}),s=d(i,a=>a.deps);return m({profiles:i,limit:l,filePattern:p,overrunFactor:5,candidateIndex:s,profile:{name:"similar-files"},compare:(a,g)=>F(a,g,o,f)})}function D(t,e){let{scope:o,minDeps:l}=e,n=c(t,o),{universalDeps:p,distinctiveDeps:r}=S(n),i=[];for(let[f,s]of n)s.size>=l&&i.push({file:f,deps:new Set([...s].filter(a=>!p.has(a)))});return{profiles:i,distinctiveDeps:r}}function S(t){let e=new Set,o=new Set,l=t.size;if(l===0)return{universalDeps:e,distinctiveDeps:o};let n=new Map;for(let r of t.values())for(let i of r)n.set(i,(n.get(i)??0)+1);let p=Math.max(3,Math.ceil(l*.03));for(let[r,i]of n)i>=5&&i/l>.3?e.add(r):i<=p&&o.add(r);return{universalDeps:e,distinctiveDeps:o}}function F(t,e,o,l){let n=new Set;for(let s of t.deps)e.deps.has(s)&&n.add(s);if(n.size<3||t.deps.size<4||e.deps.size<4)return null;let p=0;for(let s of n)l.has(s)&&p++;if(p<2)return null;let r=u(t.deps,e.deps);if(r<o)return null;let i=[];for(let s of t.deps)e.deps.has(s)||i.push(s);let f=[];for(let s of e.deps)t.deps.has(s)||f.push(s);return{fileA:t.file,fileB:e.file,similarity:r,sharedDeps:[...n],uniqueToA:i,uniqueToB:f}}export{y as a};
2
+ //# sourceMappingURL=chunk-HHBBGWES.js.map
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-UZGZB3VB.js";import{b as a}from"./chunk-ADTBPVUZ.js";import{existsSync as c}from"fs";import{isAbsolute as p,join as u}from"path";function g(e,t){let o=l(e,t,{allowMultiple:!1})[0]?.relativePath;return o||s(e,t)}function x(e,t){return l(e,t,{allowMultiple:!0}).map(o=>o.relativePath)}function s(e,t){if(!t)return null;let o=t.replace(/\\/g,"/").replace(/^\.\//,""),r=p(o)&&o.startsWith(e.config.projectRoot)?o.slice(e.config.projectRoot.length).replace(/^\/+/,""):o,n=u(e.config.projectRoot,r);return c(n)?r:null}function l(e,t,o){let r=a(e,t,o);if(r.length===0){if(s(e,t))return[];let n=i(e,t);return!n||e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,score:700}]}return r}export{g as a,x as b};
2
- //# sourceMappingURL=chunk-GTXSJDCO.js.map
1
+ import{a as i}from"./chunk-3XFJUWJE.js";import{b as a}from"./chunk-RVYLJDXC.js";import{existsSync as c}from"fs";import{isAbsolute as p,join as u}from"path";function g(e,t){let o=l(e,t,{allowMultiple:!1})[0]?.relativePath;return o||s(e,t)}function x(e,t){return l(e,t,{allowMultiple:!0}).map(o=>o.relativePath)}function s(e,t){if(!t)return null;let o=t.replace(/\\/g,"/").replace(/^\.\//,""),r=p(o)&&o.startsWith(e.config.projectRoot)?o.slice(e.config.projectRoot.length).replace(/^\/+/,""):o,n=u(e.config.projectRoot,r);return c(n)?r:null}function l(e,t,o){let r=a(e,t,o);if(r.length===0){if(s(e,t))return[];let n=i(e,t);return!n||e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,score:700}]}return r}export{g as a,x as b};
2
+ //# sourceMappingURL=chunk-HIEXRDJF.js.map
@@ -1,4 +1,4 @@
1
- import{A as G,D as P,a as y,b as ce,i as k,j as le,t as B,u as de,w as j,x as ue,y as b}from"./chunk-LTA3BRZX.js";import{$a as C,Za as g,_a as ne,bb as x,j as ee,k as te,mb as oe,nb as re,ob as ie,qb as se,r as S,sb as ae,ub as E}from"./chunk-GTIYTDRE.js";import{G as Y,H,J as Z,q as N,r as L,t as M}from"./chunk-NCZUNH3E.js";import{Q as X}from"./chunk-Z54RD7VL.js";import{i as W}from"./chunk-3IER7Q6H.js";import{c as T,g as Q}from"./chunk-DRENNWRG.js";function ge(e,n,t){if(!Number.isSafeInteger(t.limit)||t.limit<=0)throw new Error("Reference page limit must be a positive safe integer.");let o=N(e,n);if(!o)return{rows:[],hasMore:!1,producer:t.producer??"source-keyset",semanticEnrichment:!1};if(t.producer==="complete-only"||t.semantic===!0||o.relativePath.endsWith(".rb"))return F(e,n,t);let i=Y(e,o);if(!i)return F(e,n,t);let s=fe(e,o),c=Te(e,s),a=[],l=t.producer==="source-keyset";for(let u of c){if(t.after&&u<t.after.relativePath)continue;t.instrumentation?.fileScanned?.(u);let f=H(e,i,u);f.length>0&&(l=!0);let d=new Set(f);s?.relativePath===u&&d.add(s.line);for(let m of[...d].sort((p,Ae)=>p-Ae)){let p={relativePath:u,line:m};if(!(t.after&&R(p,t.after)<=0)&&(a.push(p),t.instrumentation?.rowAccepted?.(p),l&&a.length>t.limit))return me(a,t.limit)}}return l?me(a,t.limit):F(e,n,t,s)}function R(e,n){return(e.relativePath<n.relativePath?-1:e.relativePath>n.relativePath?1:0)||e.line-n.line}function me(e,n){return{rows:e.slice(0,n),hasMore:e.length>n,producer:"source-keyset",semanticEnrichment:!1}}function F(e,n,t,o){let r=N(e,n),i=t.semantic===!0||r?.relativePath.endsWith(".rb")?S(e,n,{semantic:t.semantic}):De(e,n,o),s=Me(i).filter(c=>!t.after||R(c,t.after)>0);for(let c of s.slice(0,t.limit+1))t.instrumentation?.rowAccepted?.(c);return{rows:s.slice(0,t.limit),hasMore:s.length>t.limit,producer:"complete-only",semanticEnrichment:t.semantic===!0}}function De(e,n,t){let o=N(e,n);if(!o)return[];let r=t===void 0?fe(e,o):t,i=Z(e,o).map(s=>({relativePath:s.file,line:s.line}));return r?[r,...i]:i}function fe(e,n){return!Q(n.symbol)&&!e.isIgnored(n.relativePath)?{relativePath:n.relativePath,line:n.startLine}:null}function Te(e,n){let t=W(e);return!n||t.includes(n.relativePath)?t:[...t,n.relativePath].sort((o,r)=>o<r?-1:o>r?1:0)}function Me(e){let n=new Map;for(let t of e)n.set(`${t.relativePath}\0${t.line}`,t);return[...n.values()].sort(R)}import{InvalidArgumentError as v}from"commander";var St=X,Be=/^[+-]?\d+$/u,je=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,xt=(e=>V(e,"an integer")),pe=(e=>{let n=V(e,"a non-negative integer");if(n<0)throw new v(`Expected a non-negative integer, got "${e}".`);return n}),he=(e=>{let n=V(e,"a positive integer");if(n<1)throw new v(`Expected a positive integer, got "${e}".`);return n}),Et=(e=>{if(!je.test(e))throw new v(`Expected a number, got "${e}".`);let n=Number(e);if(!Number.isFinite(n))throw new v(`Expected a finite number, got "${e}".`);return n});function V(e,n){if(!Be.test(e))throw new v(`Expected ${n}, got "${e}".`);let t=Number(e);if(!Number.isSafeInteger(t))throw new v(`Expected ${n}, got "${e}".`);return t}function h(e,n,t,...o){return o.length>0?{flags:e,description:n,parser:t,defaultValue:o[0]}:{flags:e,description:n,parser:t}}function Ge(){return h("--json","Output as JSON for programmatic consumption")}function Fe(){return h("--compact","Emit minified one-line JSON (use with --json)")}function Ve(){return h("--result-only","Emit only the command-owned result (use with --json)")}function Ce(e=[]){return I(e)}function I(e=[]){let n=[Ge(),Ve(),Fe()],t=new Set(n.map(o=>o.flags));return[...e.filter(o=>!t.has(o.flags)),...n]}function $(e,n=[]){return{category:e,examples:n}}function Pt(e,n){return{origin:"mixed",observedSources:e,producerValidation:{status:"not-evaluated"},families:n}}function $t(e,n){return{origin:e,observedSources:n,producerValidation:{status:"not-evaluated"}}}function wt(e,n,t){return{id:e,selector:n,origin:{kind:"fixed",origin:t}}}function Ot(e,n,t,o){return{id:e,selector:n,origin:{kind:"result-field",field:t,values:o}}}function w(e,n,t,o,r,i,s){return{answers:typeof e=="string"?[e]:e,returns:typeof n=="string"?[n]:n,inputs:t,coverage:o,operation:i,semantic:s,...r?{scope:r}:{}}}function Nt(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,K(s.join(" "),c.join("; "),["This command establishes only its declared result units and evidence contract."],void 0,{outputCost:o==="complete"?"bounded":"variable"}))}function ye(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,Ke(c.join("; "),["This command does not establish repository graph relationships unless its result says so explicitly."]))}function be(e,n,t={ranking:"identity-only"}){return{kind:"locator",locates:e,nonClaims:n,outputCost:"small",frontierClosure:["evidence","inspect","code"],...t}}function Lt(e){return{kind:"graph-projection",outputCost:"bounded",frontierClosure:["inspect","code"],...e}}function Re(e,n,t,o={}){return{kind:"source-read",reads:e,nonClaims:n,outputCost:"potentially-large",frontierClosure:[],...t?{compatibility:t}:{},...o}}function K(e,n,t,o,r={}){return{kind:"analysis",analysis:e,resultMeaning:n,nonClaims:t,outputCost:"bounded",frontierClosure:["inspect","code"],...o?{compatibility:o}:{},...r}}function Ke(e,n,t,o={}){return{kind:"maintenance",effect:e,nonClaims:n,outputCost:"variable",frontierClosure:[],...t?{compatibility:t}:{},...o}}function J(e){return Buffer.from(JSON.stringify(e),"utf8").toString("base64url")}function A(e){return e.generation.identity}function U(e){return"after"in e?J({version:2,...e}):J({version:1,...e})}function ve(e,n){let t=_e(e);if(!Je(t)&&!Ue(t))throw new Error("Invalid result cursor. Run the command again without --cursor.");return ze(t,n),t}function Je(e){if(!e||typeof e!="object")return!1;let n=e;return n.version===1&&typeof n.command=="string"&&typeof n.target=="string"&&Number.isSafeInteger(n.offset)&&(n.offset??-1)>=0&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function Ue(e){if(!e||typeof e!="object")return!1;let n=e,t=n.after;return n.version===2&&typeof n.command=="string"&&typeof n.target=="string"&&!!t&&typeof t.relativePath=="string"&&t.relativePath.length>0&&Number.isSafeInteger(t.line)&&(t.line??-1)>=0&&(n.producer==="source-keyset"||n.producer==="complete-only")&&typeof n.semanticEnrichment=="boolean"&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function _e(e){try{return JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{throw new Error("Invalid result cursor. Run the command again without --cursor.")}}function ze(e,n){if(e.command!==n.command||e.target!==n.target)throw new Error("This cursor belongs to a different command or target. Run again without --cursor.");if(e.indexGeneration!==n.indexGeneration)throw new Error("The index changed after this cursor was issued. Run again without --cursor.")}function Se(e,n){let t=L(e,n),o=qe(t);for(let r of o)console.log(r)}function xe(e,n,t="No results found for resolved symbol."){return L(e,n).match?t:z(n,M(e,n,5))}function _(e,n,t,o){return{...D(e,n),[o]:t}}function D(e,n){let t=L(e,n);return t.match?{matched:!0,resolved:{symbol:t.match.symbol,shortName:T(t.match.symbol),relativePath:t.match.relativePath},otherMatches:t.candidates.map(o=>({shortName:o.shortName,relativePath:o.relativePath,startLine:o.startLine})),totalMatches:t.total}:{matched:!1,suggestions:M(e,n,5)}}function z(e,n){let t=`No definition matched '${e}'.`;return n.length>0?`${t} Suggestions: ${n.join(", ")}`:t}function qe(e){if(!e.match||e.total<=1)return[];let n=e.match,t=Math.max(0,e.total-1),o=[`Resolved: ${T(n.symbol)} (${n.relativePath}) -- ${t} other definition(s) share this name; qualify as <dir/leaf> to target another.`],r=e.candidates.slice(0,3);return r.length>0&&o.push(`Alternates: ${r.map(i=>`${i.shortName} (${i.relativePath}:${g(i.startLine)})`).join("; ")}`),o.push(""),o}var We=k(({db:e,args:n,opts:t})=>{let o=B(n,0),r=b(t,"signatures"),i=ee(e,o);if(b(t,"json")){P("outline",n,t,i);return}if(console.log(`\u2550\u2550\u2550 REQUEST \u2550\u2550\u2550
1
+ import{A as G,D as P,a as y,b as ce,i as k,j as le,t as B,u as de,w as j,x as ue,y as b}from"./chunk-NJA4MMBD.js";import{c as oe,d as re,e as ie,g as se,i as ae,k as E}from"./chunk-CDWSLAPN.js";import{eb as g,fb as ne,gb as C,ib as x,n as ee,p as te,w as S}from"./chunk-BLKYYQ7C.js";import{G as Y,H,J as Z,q as N,r as L,t as M}from"./chunk-IGQQUENU.js";import{c as W}from"./chunk-FWY2PRIF.js";import{c as T,g as Q}from"./chunk-DRENNWRG.js";import{qa as X}from"./chunk-WJOQC4P7.js";function ge(e,n,t){if(!Number.isSafeInteger(t.limit)||t.limit<=0)throw new Error("Reference page limit must be a positive safe integer.");let o=N(e,n);if(!o)return{rows:[],hasMore:!1,producer:t.producer??"source-keyset",semanticEnrichment:!1};if(t.producer==="complete-only"||t.semantic===!0||o.relativePath.endsWith(".rb"))return F(e,n,t);let i=Y(e,o);if(!i)return F(e,n,t);let s=fe(e,o),c=Te(e,s),a=[],l=t.producer==="source-keyset";for(let u of c){if(t.after&&u<t.after.relativePath)continue;t.instrumentation?.fileScanned?.(u);let f=H(e,i,u);f.length>0&&(l=!0);let d=new Set(f);s?.relativePath===u&&d.add(s.line);for(let m of[...d].sort((p,Ae)=>p-Ae)){let p={relativePath:u,line:m};if(!(t.after&&R(p,t.after)<=0)&&(a.push(p),t.instrumentation?.rowAccepted?.(p),l&&a.length>t.limit))return me(a,t.limit)}}return l?me(a,t.limit):F(e,n,t,s)}function R(e,n){return(e.relativePath<n.relativePath?-1:e.relativePath>n.relativePath?1:0)||e.line-n.line}function me(e,n){return{rows:e.slice(0,n),hasMore:e.length>n,producer:"source-keyset",semanticEnrichment:!1}}function F(e,n,t,o){let r=N(e,n),i=t.semantic===!0||r?.relativePath.endsWith(".rb")?S(e,n,{semantic:t.semantic}):De(e,n,o),s=Me(i).filter(c=>!t.after||R(c,t.after)>0);for(let c of s.slice(0,t.limit+1))t.instrumentation?.rowAccepted?.(c);return{rows:s.slice(0,t.limit),hasMore:s.length>t.limit,producer:"complete-only",semanticEnrichment:t.semantic===!0}}function De(e,n,t){let o=N(e,n);if(!o)return[];let r=t===void 0?fe(e,o):t,i=Z(e,o).map(s=>({relativePath:s.file,line:s.line}));return r?[r,...i]:i}function fe(e,n){return!Q(n.symbol)&&!e.isIgnored(n.relativePath)?{relativePath:n.relativePath,line:n.startLine}:null}function Te(e,n){let t=W(e);return!n||t.includes(n.relativePath)?t:[...t,n.relativePath].sort((o,r)=>o<r?-1:o>r?1:0)}function Me(e){let n=new Map;for(let t of e)n.set(`${t.relativePath}\0${t.line}`,t);return[...n.values()].sort(R)}import{InvalidArgumentError as v}from"commander";var St=X,Be=/^[+-]?\d+$/u,je=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,xt=(e=>V(e,"an integer")),pe=(e=>{let n=V(e,"a non-negative integer");if(n<0)throw new v(`Expected a non-negative integer, got "${e}".`);return n}),he=(e=>{let n=V(e,"a positive integer");if(n<1)throw new v(`Expected a positive integer, got "${e}".`);return n}),Et=(e=>{if(!je.test(e))throw new v(`Expected a number, got "${e}".`);let n=Number(e);if(!Number.isFinite(n))throw new v(`Expected a finite number, got "${e}".`);return n});function V(e,n){if(!Be.test(e))throw new v(`Expected ${n}, got "${e}".`);let t=Number(e);if(!Number.isSafeInteger(t))throw new v(`Expected ${n}, got "${e}".`);return t}function h(e,n,t,...o){return o.length>0?{flags:e,description:n,parser:t,defaultValue:o[0]}:{flags:e,description:n,parser:t}}function Ge(){return h("--json","Output as JSON for programmatic consumption")}function Fe(){return h("--compact","Emit minified one-line JSON (use with --json)")}function Ve(){return h("--result-only","Emit only the command-owned result (use with --json)")}function Ce(e=[]){return I(e)}function I(e=[]){let n=[Ge(),Ve(),Fe()],t=new Set(n.map(o=>o.flags));return[...e.filter(o=>!t.has(o.flags)),...n]}function $(e,n=[]){return{category:e,examples:n}}function Pt(e,n){return{origin:"mixed",observedSources:e,producerValidation:{status:"not-evaluated"},families:n}}function $t(e,n){return{origin:e,observedSources:n,producerValidation:{status:"not-evaluated"}}}function wt(e,n,t){return{id:e,selector:n,origin:{kind:"fixed",origin:t}}}function Ot(e,n,t,o){return{id:e,selector:n,origin:{kind:"result-field",field:t,values:o}}}function w(e,n,t,o,r,i,s){return{answers:typeof e=="string"?[e]:e,returns:typeof n=="string"?[n]:n,inputs:t,coverage:o,operation:i,semantic:s,...r?{scope:r}:{}}}function Nt(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,K(s.join(" "),c.join("; "),["This command establishes only its declared result units and evidence contract."],void 0,{outputCost:o==="complete"?"bounded":"variable"}))}function ye(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,Ke(c.join("; "),["This command does not establish repository graph relationships unless its result says so explicitly."]))}function be(e,n,t={ranking:"identity-only"}){return{kind:"locator",locates:e,nonClaims:n,outputCost:"small",frontierClosure:["evidence","inspect","code"],...t}}function Lt(e){return{kind:"graph-projection",outputCost:"bounded",frontierClosure:["inspect","code"],...e}}function Re(e,n,t,o={}){return{kind:"source-read",reads:e,nonClaims:n,outputCost:"potentially-large",frontierClosure:[],...t?{compatibility:t}:{},...o}}function K(e,n,t,o,r={}){return{kind:"analysis",analysis:e,resultMeaning:n,nonClaims:t,outputCost:"bounded",frontierClosure:["inspect","code"],...o?{compatibility:o}:{},...r}}function Ke(e,n,t,o={}){return{kind:"maintenance",effect:e,nonClaims:n,outputCost:"variable",frontierClosure:[],...t?{compatibility:t}:{},...o}}function J(e){return Buffer.from(JSON.stringify(e),"utf8").toString("base64url")}function A(e){return e.generation.identity}function U(e){return"after"in e?J({version:2,...e}):J({version:1,...e})}function ve(e,n){let t=_e(e);if(!Je(t)&&!Ue(t))throw new Error("Invalid result cursor. Run the command again without --cursor.");return ze(t,n),t}function Je(e){if(!e||typeof e!="object")return!1;let n=e;return n.version===1&&typeof n.command=="string"&&typeof n.target=="string"&&Number.isSafeInteger(n.offset)&&(n.offset??-1)>=0&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function Ue(e){if(!e||typeof e!="object")return!1;let n=e,t=n.after;return n.version===2&&typeof n.command=="string"&&typeof n.target=="string"&&!!t&&typeof t.relativePath=="string"&&t.relativePath.length>0&&Number.isSafeInteger(t.line)&&(t.line??-1)>=0&&(n.producer==="source-keyset"||n.producer==="complete-only")&&typeof n.semanticEnrichment=="boolean"&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function _e(e){try{return JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{throw new Error("Invalid result cursor. Run the command again without --cursor.")}}function ze(e,n){if(e.command!==n.command||e.target!==n.target)throw new Error("This cursor belongs to a different command or target. Run again without --cursor.");if(e.indexGeneration!==n.indexGeneration)throw new Error("The index changed after this cursor was issued. Run again without --cursor.")}function Se(e,n){let t=L(e,n),o=qe(t);for(let r of o)console.log(r)}function xe(e,n,t="No results found for resolved symbol."){return L(e,n).match?t:z(n,M(e,n,5))}function _(e,n,t,o){return{...D(e,n),[o]:t}}function D(e,n){let t=L(e,n);return t.match?{matched:!0,resolved:{symbol:t.match.symbol,shortName:T(t.match.symbol),relativePath:t.match.relativePath},otherMatches:t.candidates.map(o=>({shortName:o.shortName,relativePath:o.relativePath,startLine:o.startLine})),totalMatches:t.total}:{matched:!1,suggestions:M(e,n,5)}}function z(e,n){let t=`No definition matched '${e}'.`;return n.length>0?`${t} Suggestions: ${n.join(", ")}`:t}function qe(e){if(!e.match||e.total<=1)return[];let n=e.match,t=Math.max(0,e.total-1),o=[`Resolved: ${T(n.symbol)} (${n.relativePath}) -- ${t} other definition(s) share this name; qualify as <dir/leaf> to target another.`],r=e.candidates.slice(0,3);return r.length>0&&o.push(`Alternates: ${r.map(i=>`${i.shortName} (${i.relativePath}:${g(i.startLine)})`).join("; ")}`),o.push(""),o}var We=k(({db:e,args:n,opts:t})=>{let o=B(n,0),r=b(t,"signatures"),i=ee(e,o);if(b(t,"json")){P("outline",n,t,i);return}if(console.log(`\u2550\u2550\u2550 REQUEST \u2550\u2550\u2550
2
2
  file=${JSON.stringify(o)}; signatures=${r?"shown":"hidden"}`),i.length===0){console.log(`
3
3
  \u2550\u2550\u2550 OBSERVED FACTS \u2550\u2550\u2550
4
4
  No compiler-owned constructs were found for ${JSON.stringify(o)}.`),console.log(`
@@ -27,4 +27,4 @@ ${p}continue with --cursor ${d.cursor}`)}});function Ye(e,n,t){let o=S(e,n,{sema
27
27
  `),o=0,r=0;for(let i=0;i<t.length;i++){let s=t[i].length+12;i>o&&r+s>Ee&&(n.push(`${e.relativePath}:${g(e.startLine+o)}-${g(e.startLine+i-1)}`),o=i,r=0),r+=s}return n.push(`${e.relativePath}:${g(e.startLine+o)}-${g(e.endLine)}`),n}function Pe(e,n){return{requested:n.length,matched:n.filter(t=>t.status==="matched").length,ambiguous:n.filter(t=>t.status==="ambiguous").length,missing:n.filter(t=>t.status==="missing").length,entries:[...n],bindingClosure:e.bindingClosure}}function $e(e,n){return["codebaseiq","code",...e.map(O),...n.members==="all"?["--members","all"]:[],...n.context>0?["--context",String(n.context)]:[]].join(" ")}function dt(e,n,t){if(!t)return D(e,n);let o={file:t.relativePath,symbol:t.shortName,language:t.language??"unknown",range:{startLine:g(t.startLine),endLine:g(t.endLine)},...t.freshness?{freshness:t.freshness}:{},lines:t.source.split(`
28
28
  `).map((s,c)=>({line:g(t.startLine+c),text:s}))},r=D(e,n),i=r.totalMatches??0;return!r.matched||!r.resolved||i<=1?o:{...o,resolution:{selected:r.resolved,alternatives:r.otherMatches??[],totalMatches:i}}}function ut(e){return{requested:e.requested,matched:e.matched,ambiguous:e.ambiguous,missing:e.missing,entries:e.entries.map(n=>({selector:n.selector,status:n.status,kind:n.kind,totalCandidates:n.totalCandidates,sources:n.results.map(t=>({file:t.relativePath,symbol:t.shortName,language:t.language??"unknown",range:{startLine:g(t.startLine),endLine:g(t.endLine)},...t.freshness?{freshness:t.freshness}:{},lines:t.source.split(`
29
29
  `).map((o,r)=>({line:g(t.startLine+r),text:o}))})),definitions:n.definitions,...n.fileCoverage?{fileCoverage:n.fileCoverage}:{},...n.rangeCoverage?{rangeCoverage:n.rangeCoverage}:{},candidates:n.candidates,omittedCandidates:n.omittedCandidates,suggestions:n.suggestions,...n.reason?{reason:n.reason}:{}})),literalValues:e.bindingClosure.inline}}function O(e){return`'${e.replaceAll("'","'\\''")}'`}var Zt=[{id:"session",command:"session",description:"Show evidence already delivered in this agent exploration session",options:[h("--reset","Clear this agent exploration-session ledger")],agent:ye("Which indexed source ranges and graph facts have already been delivered in this exploration session?","prior command ordinals, exact source ranges, and content-bound graph receipts",[],"complete","repository",ce("repository-observation",[{when:{kind:"option",name:"reset",equals:!0},role:"mutation"}])),renderShape:"custom",docs:$("Navigation"),handler:et},{id:"refs",command:"refs <symbol>",description:"Find all files referencing a symbol",options:Ce([h("--full","Run unbounded semantic analysis on large indexes"),h("-n, --limit <n>","Maximum reference sites to return",he),h("--cursor <cursor>","Continue a prior bounded result (implies --limit 50 when omitted)")]),budget:"semantic",agent:{operation:y,answers:["Which files reference this symbol?","Is this symbol used anywhere, or only defined?"],returns:["referencing file paths","reference line numbers grouped by file"],inputs:["symbol"],coverage:"bounded",semantic:K("Resolve the exact reference sites attributed to one compiler symbol identity.","Referencing file paths and reference line numbers grouped by file.",["Reference sites do not establish runtime execution, data flow, or task relevance."]),contrasts:[{command:"imported-by",distinction:"imported-by lists files importing the symbol; refs covers every reference site, imported or not."},{command:"affected",distinction:"refs is one hop out; affected is the transitive closure of what could break."}]},renderShape:"grouped-by-file",docs:$("Navigation",["codebaseiq refs login"]),handler:Qe},{id:"outline",command:"outline <file>",description:"Tree view of symbols in a file, with line ranges",agent:{...w("What symbols and nesting exist in this file?","symbol names, nesting, and line ranges",["file"],"complete",void 0,y,be(["file","symbol","construct"],["File ownership and nesting do not establish execution or task relevance."],{ranking:"identity-only",manualInput:"One exact current project file path.",evidenceCeiling:"Exact compiler-owned constructs and ranges when the file is indexed; no invented semantic overlay."})),contrasts:[{command:"search",distinction:"outline enumerates constructs in one known file; search locates exact text across current project text."},{command:"code",distinction:"outline returns identities and ranges; code materializes exact source for selected identities."}]},options:I([h("--signatures","Show trimmed symbol signatures")]),renderShape:"custom",docs:$("Navigation"),handler:We},{id:"code",command:"code <selectors...>",description:"Read exact definitions, ranges with local call closure, or file export surfaces",agent:{...w("What exact source defines these symbols, ranges, or file surfaces?","per-selector resolution, complete definition source, exact ranges with statically attributed same-file call closure, file export surfaces, omitted-local ledgers, and line ranges",[["symbol","file"]],"complete",void 0,y,Re(["construct","exact-source"],["Source materialization does not establish callers, runtime reachability, or task relevance by itself."],void 0,{manualInput:"One or more exact symbols, file:line ranges, or file paths.",evidenceCeiling:"Exact current source bytes for every resolved selector, with omitted file-local constructs disclosed."})),resultUnits:{kind:"field",field:"code"},contrasts:[{command:"inspect",distinction:"code materializes complete exact source; inspect batches bounded behavior or source gaps."},{command:"outline",distinction:"code reads selected implementations; outline enumerates file structure without reading every body."}]},options:I([h("-C, --context <n>","Extra lines of context above/below",pe,0),h("--members <exported|all>","For file selectors, return the exported surface or the complete file",void 0,"exported")]),renderShape:"custom",docs:$("Navigation",["codebaseiq code parseRequest handleRequest","codebaseiq code src/api.ts src/web.ts"]),handler:Xe}];export{St as a,xt as b,pe as c,he as d,Et as e,h as f,Fe as g,Ce as h,I as i,$ as j,Pt as k,$t as l,wt as m,Ot as n,w as o,Nt as p,ye as q,be as r,Lt as s,Re as t,K as u,Se as v,xe as w,_ as x,D as y,Zt as z};
30
- //# sourceMappingURL=chunk-4FC325IF.js.map
30
+ //# sourceMappingURL=chunk-HYKSLTAR.js.map
@@ -1,2 +1,2 @@
1
- import{b as c,e as p,g as u,i as b}from"./chunk-CWONGW6P.js";import{h as x,v as m}from"./chunk-NNJ2KZZG.js";import{createHash as P}from"crypto";import{TextDecoder as k}from"util";var D=new k("utf-8",{fatal:!0});function j(e){return b(e.config.projectRoot)}function I(e,t){let r=x(t),i;try{i=p(e.config.projectRoot,r,{inputKind:"repository text file"})}catch(s){if(u(s)||s instanceof c)return null;throw s}let n=T(i);return n===null?null:F(r,i,n,v(e),S(e))}function L(e,t={}){let r=j(e).filter(o=>!t.scope||o.includes(t.scope)),i=v(e),n=S(e),s=[],l=[],f=[],d=[],g=0;for(let o of r){let a;try{a=p(e.config.projectRoot,o,{inputKind:"repository text file"})}catch(y){if(y instanceof c){d.push(o);continue}if(u(y))continue;f.push(o);continue}let h=T(a);if(h===null){l.push(o);continue}g+=a.byteLength,s.push(F(o,a,h,i,n))}return{files:s,candidateFiles:r.length,scannedBytes:g,skippedBinaryPaths:l,skippedUnreadablePaths:f,skippedOversizedPaths:d}}function F(e,t,r,i,n){let s=P("sha256").update(t).digest("hex");return{relativePath:e,text:r,bytes:t.byteLength,freshness:{exactText:{state:"current",basis:"working-tree-read",sha256:s},semantic:w(e,s,i,n)}}}function w(e,t,r,i){if(!i.has(e))return{state:"unavailable",basis:"no-compiler-document"};let n=r.get(e);return n?{state:n===t?"aligned":"stale",basis:"indexed-input-fingerprint"}:{state:"unavailable",basis:"fingerprint-unavailable"}}function S(e){return new Set(e.all(`SELECT documents.relative_path FROM documents WHERE 1 = 1 ${e.pathExclusionsFor("documents")}`).map(t=>t.relative_path))}function v(e){let t=new Map;if(!e.generation.metadataRaw)return t;let r=m(e.generation.metadataRaw);if(r.kind!=="legacy"&&r.kind!=="supported")return t;let i=r.metadata.fingerprint;if(!R(i)||!Array.isArray(i.files))return t;for(let n of i.files)!R(n)||typeof n.path!="string"||typeof n.hash!="string"||t.set(n.path,n.hash);return t}function T(e){if(e.includes(0))return null;try{return D.decode(e)}catch{return null}}function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}export{j as a,I as b,L as c};
2
- //# sourceMappingURL=chunk-XLQ3GLWZ.js.map
1
+ import{b as c,e as p,g as u,i as b}from"./chunk-IOVPAZWP.js";import{h as x,v as m}from"./chunk-327YK6TB.js";import{createHash as P}from"crypto";import{TextDecoder as k}from"util";var D=new k("utf-8",{fatal:!0});function j(e){return b(e.config.projectRoot)}function I(e,t){let r=x(t),i;try{i=p(e.config.projectRoot,r,{inputKind:"repository text file"})}catch(s){if(u(s)||s instanceof c)return null;throw s}let n=T(i);return n===null?null:F(r,i,n,v(e),S(e))}function L(e,t={}){let r=j(e).filter(o=>!t.scope||o.includes(t.scope)),i=v(e),n=S(e),s=[],l=[],f=[],d=[],g=0;for(let o of r){let a;try{a=p(e.config.projectRoot,o,{inputKind:"repository text file"})}catch(y){if(y instanceof c){d.push(o);continue}if(u(y))continue;f.push(o);continue}let h=T(a);if(h===null){l.push(o);continue}g+=a.byteLength,s.push(F(o,a,h,i,n))}return{files:s,candidateFiles:r.length,scannedBytes:g,skippedBinaryPaths:l,skippedUnreadablePaths:f,skippedOversizedPaths:d}}function F(e,t,r,i,n){let s=P("sha256").update(t).digest("hex");return{relativePath:e,text:r,bytes:t.byteLength,freshness:{exactText:{state:"current",basis:"working-tree-read",sha256:s},semantic:w(e,s,i,n)}}}function w(e,t,r,i){if(!i.has(e))return{state:"unavailable",basis:"no-compiler-document"};let n=r.get(e);return n?{state:n===t?"aligned":"stale",basis:"indexed-input-fingerprint"}:{state:"unavailable",basis:"fingerprint-unavailable"}}function S(e){return new Set(e.all(`SELECT documents.relative_path FROM documents WHERE 1 = 1 ${e.pathExclusionsFor("documents")}`).map(t=>t.relative_path))}function v(e){let t=new Map;if(!e.generation.metadataRaw)return t;let r=m(e.generation.metadataRaw);if(r.kind!=="legacy"&&r.kind!=="supported")return t;let i=r.metadata.fingerprint;if(!R(i)||!Array.isArray(i.files))return t;for(let n of i.files)!R(n)||typeof n.path!="string"||typeof n.hash!="string"||t.set(n.path,n.hash);return t}function T(e){if(e.includes(0))return null;try{return D.decode(e)}catch{return null}}function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}export{j as a,I as b,L as c};
2
+ //# sourceMappingURL=chunk-I2KP4AGR.js.map
@@ -0,0 +1,2 @@
1
+ import{m as g,n as h,z as S}from"./chunk-TAJ6UGCO.js";import{c as u,d as m,h as p,k as f}from"./chunk-5XEVXVTK.js";import{B as d}from"./chunk-WJOQC4P7.js";import{G as c,N as a,Y as l}from"./chunk-4O52YNKL.js";import{statSync as y}from"fs";import{join as R,resolve as C}from"path";var D=3e3,v=250,P={env:process.env,cliVersion:c,loadConfig:d,cacheDir:(e,r)=>a(e,r).cacheDir,registryRecord:e=>p(u(),m(e)),isProcessAlive:f,configChangedAtMs:e=>y(R(e,".codebaseiq.json")).mtimeMs,refreshHookBinary:e=>{S(e)},ensure:g,stop:h,sleep:e=>new Promise(r=>setTimeout(r,e))};async function _(e,r=P){let n=l(C(e)),t=r.loadConfig(n);if(t.sentinel?.enabled!==!0)return"sentinel-disabled";if(r.refreshHookBinary(r.cliVersion),t.watch?.enabled!==!0)return"watch-disabled";if(r.env.CODEBASEIQ_SKIP_WATCH_SERVICE==="1")return"environment";if(E(r,n))return"already-running";let i={projectRoot:n,cacheDir:r.cacheDir(n,t),cliVersion:r.cliVersion,spawnEnv:{CODEBASEIQ_SENTINEL_ENSURE:"1"}},o=r.ensure(i);if(o.disposition==="started")return"started";for(let s=0;s<D;s+=v)if(await r.sleep(v),E(r,n))return"reused";return Date.parse(o.state.startedAt)>=r.configChangedAtMs(n)?"reused-without-sentinel":(r.stop(i),r.ensure(i),"restarted")}function E(e,r){let n=e.registryRecord(r);return n!==void 0&&e.isProcessAlive(n.pid)&&n.serviceVersion===e.cliVersion}async function j(e){if(typeof e!="string"||e.length===0)throw new Error("A project root is required.");await _(e)}var k={id:"__sentinel-ensure-service",command:"__sentinel-ensure-service <projectRoot>",hidden:!0,description:"Internal: start the resident service that hosts the trailing sentinel",renderShape:"custom",handler:j};export{_ as a,k as b};
2
+ //# sourceMappingURL=chunk-I5FCDTK2.js.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-XLQ3GLWZ.js";import{h as o}from"./chunk-NNJ2KZZG.js";function g(e,r){return s(e).filter(t=>c({pattern:r,relativePath:t})).map(t=>({relativePath:t}))}function c(e,r){let t=typeof e=="string"?{pattern:e,relativePath:r}:e;if(typeof t.pattern!="string"||typeof t.relativePath!="string")throw new TypeError("pathMatchesGlob requires pattern and relativePath.");let n=o(t.pattern),a=o(t.relativePath);if(!/[*?]/.test(n))return a.includes(n);let l=n.includes("/")?n:`**/${n}`;return i(l.split("/"),a.split("/"))}function i(e,r){if(e.length===0)return r.length===0;let[t,...n]=e;return t==="**"?i(n,r)||r.length>0&&i(e,r.slice(1)):r.length===0||!f(t??"",r[0]??"")?!1:i(n,r.slice(1))}function f(e,r){let t="^";for(let n of e)n==="*"?t+="[^/]*":n==="?"?t+="[^/]":t+=p(n);return t+="$",new RegExp(t).test(r)}function p(e){return/[\\^$.*+?()[\]{}|]/.test(e)?`\\${e}`:e}export{g as a,c as b};
2
- //# sourceMappingURL=chunk-QKPLA6IC.js.map
1
+ import{a as s}from"./chunk-I2KP4AGR.js";import{h as o}from"./chunk-327YK6TB.js";function g(e,r){return s(e).filter(t=>c({pattern:r,relativePath:t})).map(t=>({relativePath:t}))}function c(e,r){let t=typeof e=="string"?{pattern:e,relativePath:r}:e;if(typeof t.pattern!="string"||typeof t.relativePath!="string")throw new TypeError("pathMatchesGlob requires pattern and relativePath.");let n=o(t.pattern),a=o(t.relativePath);if(!/[*?]/.test(n))return a.includes(n);let l=n.includes("/")?n:`**/${n}`;return i(l.split("/"),a.split("/"))}function i(e,r){if(e.length===0)return r.length===0;let[t,...n]=e;return t==="**"?i(n,r)||r.length>0&&i(e,r.slice(1)):r.length===0||!f(t??"",r[0]??"")?!1:i(n,r.slice(1))}function f(e,r){let t="^";for(let n of e)n==="*"?t+="[^/]*":n==="?"?t+="[^/]":t+=p(n);return t+="$",new RegExp(t).test(r)}function p(e){return/[\\^$.*+?()[\]{}|]/.test(e)?`\\${e}`:e}export{g as a,c as b};
2
+ //# sourceMappingURL=chunk-I645ZF75.js.map
@@ -1,2 +1,2 @@
1
- import{d as F,f as w}from"./chunk-QW7EP6WI.js";import{u as S,v as D,x as b,y as E}from"./chunk-RDBI2RXU.js";import{h as m}from"./chunk-WE5RZHZ7.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-FDGD5AB5.js.map
1
+ import{d as F,f as w}from"./chunk-XYLV727H.js";import{u as S,v as D,x as b,y as E}from"./chunk-ACZDU5GK.js";import{h as m}from"./chunk-4O52YNKL.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-IBM3F2BJ.js.map