scip-query 0.19.5 → 0.19.8

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 (421) hide show
  1. package/CHANGELOG.md +85 -1
  2. package/README.md +259 -53
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/chunk-2465DLHK.js +3 -0
  5. package/dist/{chunk-7GXM52MI.js → chunk-24GTWJ3N.js} +2 -2
  6. package/dist/{chunk-NH5ALKPW.js → chunk-2SNGN6U4.js} +2 -2
  7. package/dist/{chunk-3SVWW4PN.js → chunk-2U3OLUNJ.js} +2 -2
  8. package/dist/{chunk-XLTP42QA.js → chunk-33KUO7CG.js} +2 -2
  9. package/dist/{chunk-54HA4ZXH.js → chunk-33XTHFKR.js} +2 -2
  10. package/dist/{chunk-ZGZUZ7XE.js → chunk-3EDFLQ6A.js} +2 -2
  11. package/dist/chunk-3ZSJ3PWF.js +16 -0
  12. package/dist/{chunk-F6O7AAC3.js → chunk-43KC6EQZ.js} +2 -2
  13. package/dist/{chunk-I5RJM53C.js → chunk-464PLI5O.js} +2 -2
  14. package/dist/chunk-46XGSFNI.js +2 -0
  15. package/dist/{chunk-M7AIS73L.js → chunk-47BU5Z4T.js} +2 -2
  16. package/dist/chunk-4BV4QAZJ.js +5 -0
  17. package/dist/chunk-4YTUWQ6M.js +18 -0
  18. package/dist/{chunk-RV2FQIX3.js → chunk-5ML2BNRH.js} +2 -2
  19. package/dist/{chunk-6NSFJYRC.js → chunk-5YLUDDAF.js} +2 -2
  20. package/dist/chunk-67QRR5YC.js +6 -0
  21. package/dist/{chunk-GPBBJ5Y4.js → chunk-6GXYN7YA.js} +3 -3
  22. package/dist/{chunk-4333ETTV.js → chunk-6M7RONVB.js} +2 -2
  23. package/dist/chunk-6YTSKJJ3.js +2 -0
  24. package/dist/{chunk-QDV6RDCP.js → chunk-7FT5Y65S.js} +2 -2
  25. package/dist/{chunk-XTX6QHOF.js → chunk-7KYNAMMH.js} +2 -2
  26. package/dist/{chunk-DZ74OMG6.js → chunk-7LSVMFX7.js} +2 -2
  27. package/dist/{chunk-VTKGCT3V.js → chunk-7QHY3H7P.js} +2 -2
  28. package/dist/{chunk-MITTUCEH.js → chunk-7RAG65VK.js} +2 -2
  29. package/dist/{chunk-25LPM4DG.js → chunk-7SWJEWJF.js} +2 -2
  30. package/dist/{chunk-52ZYCAEO.js → chunk-7VCOXZH3.js} +2 -2
  31. package/dist/chunk-A2TNXAXO.js +8 -0
  32. package/dist/{chunk-IUFDSKGG.js → chunk-A3QXWFBK.js} +2 -2
  33. package/dist/{chunk-4T3LTWUS.js → chunk-AA4UWRNL.js} +2 -2
  34. package/dist/{chunk-4SALD7RU.js → chunk-ACAM6O5R.js} +2 -2
  35. package/dist/chunk-APMMR5Y2.js +2 -0
  36. package/dist/chunk-AQOFWNQJ.js +1 -0
  37. package/dist/chunk-AZFUMCQB.js +2 -0
  38. package/dist/{chunk-M7MTH5NR.js → chunk-BDOIKGDI.js} +2 -2
  39. package/dist/{chunk-BTEE5NZQ.js → chunk-BNXICU42.js} +2 -2
  40. package/dist/chunk-C5Q44Q5D.js +3 -0
  41. package/dist/{chunk-EOOJGLDU.js → chunk-CTF2GDEX.js} +2 -2
  42. package/dist/chunk-DHEQMPLW.js +2 -0
  43. package/dist/{chunk-IZKFSVBV.js → chunk-DQBCO2UY.js} +2 -2
  44. package/dist/{chunk-7B3UPBVA.js → chunk-DQGSM7RZ.js} +2 -2
  45. package/dist/chunk-E2LAW7SL.js +30 -0
  46. package/dist/chunk-E3HYEQO7.js +2 -0
  47. package/dist/chunk-E4NFOAD4.js +6 -0
  48. package/dist/chunk-E5HNT4X2.js +3 -0
  49. package/dist/{chunk-J77UIT3I.js → chunk-ELLMY7XJ.js} +2 -2
  50. package/dist/chunk-FD3HFKXR.js +5 -0
  51. package/dist/{chunk-SOAT6NLA.js → chunk-FIJCV235.js} +2 -2
  52. package/dist/{chunk-H7UKLTWJ.js → chunk-FJ5UDTQF.js} +2 -2
  53. package/dist/{chunk-HEXVUYFQ.js → chunk-GHKEJTCE.js} +2 -2
  54. package/dist/{chunk-LBMJEAEW.js → chunk-GLZTVKAB.js} +3 -3
  55. package/dist/{chunk-FWUUZTIO.js → chunk-GNC4JVAN.js} +2 -2
  56. package/dist/chunk-HIB452NU.js +949 -0
  57. package/dist/{chunk-NRCXJDHL.js → chunk-HZYDQPNY.js} +2 -2
  58. package/dist/chunk-IF6FP6B2.js +66 -0
  59. package/dist/{chunk-4RSI5EMG.js → chunk-JAY7YWS3.js} +2 -2
  60. package/dist/{chunk-STOL2BTL.js → chunk-JHF3E4YM.js} +2 -2
  61. package/dist/chunk-JORHF5AL.js +108 -0
  62. package/dist/{chunk-A2EZV2UM.js → chunk-K2WO7XY7.js} +2 -2
  63. package/dist/chunk-KFZNKUNT.js +2 -0
  64. package/dist/{chunk-YVVCVR2L.js → chunk-KJ2IIBZN.js} +2 -2
  65. package/dist/{chunk-QGXBRIM5.js → chunk-KKME5ZAI.js} +2 -2
  66. package/dist/chunk-KSGTULOS.js +9 -0
  67. package/dist/{chunk-UOAV44HR.js → chunk-KXDJAG4N.js} +3 -3
  68. package/dist/{chunk-UKZBVX4U.js → chunk-L4S2A7BV.js} +2 -2
  69. package/dist/chunk-LP3ARJKF.js +8 -0
  70. package/dist/chunk-LSOR3LQG.js +3 -0
  71. package/dist/{chunk-Q4IIEGXJ.js → chunk-MLFZP76A.js} +2 -2
  72. package/dist/{chunk-WQTAC523.js → chunk-MNSTUIDD.js} +2 -2
  73. package/dist/{chunk-VXQNNXJE.js → chunk-MSBDMFER.js} +2 -2
  74. package/dist/{chunk-X6D5IC6I.js → chunk-MZZBAITE.js} +5 -5
  75. package/dist/{chunk-I5AWSI2G.js → chunk-NE3TZUCI.js} +2 -2
  76. package/dist/{chunk-6E7UTQY7.js → chunk-NTUMF2X3.js} +2 -2
  77. package/dist/{chunk-S44IULR6.js → chunk-O23I56NA.js} +2 -2
  78. package/dist/{chunk-CFMXJPHH.js → chunk-O3O4XXO6.js} +2 -2
  79. package/dist/{chunk-IG7N5ZIK.js → chunk-OUBAF226.js} +2 -2
  80. package/dist/chunk-P3UO3EH3.js +2 -0
  81. package/dist/{chunk-YNRNA5LK.js → chunk-QGGLL3UH.js} +2 -2
  82. package/dist/chunk-QIQ63BHW.js +16 -0
  83. package/dist/{chunk-VGRICIQI.js → chunk-QJIVBYEK.js} +2 -2
  84. package/dist/chunk-QOXBSI6G.js +20 -0
  85. package/dist/chunk-QXK6UUSM.js +2 -0
  86. package/dist/{chunk-XYADIZHU.js → chunk-RA3AYNWP.js} +2 -2
  87. package/dist/chunk-RJMDJR3A.js +2 -0
  88. package/dist/{chunk-NSS46APD.js → chunk-RLH5VUMG.js} +2 -2
  89. package/dist/{chunk-GBQ5NYPR.js → chunk-S4S2WOIX.js} +6 -6
  90. package/dist/{chunk-YIJ7ZAA4.js → chunk-SERUIGV5.js} +2 -2
  91. package/dist/{chunk-FECYOO5O.js → chunk-SMQWE25B.js} +2 -2
  92. package/dist/{chunk-R4FQGQ4X.js → chunk-TAVELHYR.js} +2 -2
  93. package/dist/{chunk-U6WNH5GC.js → chunk-TWMJ3Y3G.js} +2 -2
  94. package/dist/chunk-VAXNI5NE.js +146 -0
  95. package/dist/chunk-VVY2G5ET.js +2 -0
  96. package/dist/{chunk-WER3B7MI.js → chunk-W3DBTGL4.js} +2 -2
  97. package/dist/{chunk-CNKAGUPL.js → chunk-WANA4KAQ.js} +2 -2
  98. package/dist/chunk-WJL2L6MV.js +60 -0
  99. package/dist/chunk-WUW7YUAH.js +11 -0
  100. package/dist/{chunk-QVWS2VWZ.js → chunk-WWKWUPSU.js} +2 -2
  101. package/dist/{chunk-ABMYA4TN.js → chunk-WY45BHKQ.js} +2 -2
  102. package/dist/chunk-X4FR5BZF.js +9 -0
  103. package/dist/chunk-X6RKPDY7.js +2 -0
  104. package/dist/{chunk-ZXJYMGD3.js → chunk-YLFORA5G.js} +2 -2
  105. package/dist/{chunk-KP6XRY5Z.js → chunk-YTVWB7YJ.js} +2 -2
  106. package/dist/{chunk-4XTA5OMB.js → chunk-ZCEJ63SP.js} +2 -2
  107. package/dist/{chunk-HKEHS2AS.js → chunk-ZJ5CBXK3.js} +2 -2
  108. package/dist/chunk-ZL2OGDCD.js +2 -0
  109. package/dist/cli.js +8 -3
  110. package/dist/command-descriptors-ZW5J4ZEM.js +631 -0
  111. package/dist/{config-types-D20KuvvZ.d.ts → config-types-B6MEoRNy.d.ts} +8 -0
  112. package/dist/{db-G_II8yXU.d.ts → db-DYLKr9Wn.d.ts} +18 -1
  113. package/dist/direct-navigation-42YHQPOI.js +3 -0
  114. package/dist/{health-oblXYgkF.d.ts → health-DgxIDXJC.d.ts} +1 -1
  115. package/dist/index.d.ts +2 -2
  116. package/dist/index.js +1 -1
  117. package/dist/postinstall.js +1 -1
  118. package/dist/queries/affected.d.ts +2 -2
  119. package/dist/queries/affected.js +1 -1
  120. package/dist/queries/architecture.d.ts +2 -2
  121. package/dist/queries/architecture.js +1 -1
  122. package/dist/queries/bottlenecks.d.ts +2 -2
  123. package/dist/queries/bottlenecks.js +1 -1
  124. package/dist/queries/by-kind.d.ts +2 -2
  125. package/dist/queries/by-kind.js +1 -1
  126. package/dist/queries/call-graph.d.ts +2 -2
  127. package/dist/queries/call-graph.js +1 -1
  128. package/dist/queries/change-surface.d.ts +2 -2
  129. package/dist/queries/change-surface.js +1 -1
  130. package/dist/queries/cleanup-plan.d.ts +2 -2
  131. package/dist/queries/cleanup-plan.js +1 -1
  132. package/dist/queries/co-change.d.ts +2 -2
  133. package/dist/queries/co-change.js +1 -1
  134. package/dist/queries/code.d.ts +2 -2
  135. package/dist/queries/code.js +1 -1
  136. package/dist/queries/complexity-hotspots.d.ts +2 -2
  137. package/dist/queries/complexity-hotspots.js +1 -1
  138. package/dist/queries/complexity.d.ts +2 -2
  139. package/dist/queries/complexity.js +1 -1
  140. package/dist/queries/convergence.d.ts +2 -2
  141. package/dist/queries/convergence.js +1 -1
  142. package/dist/queries/coupling.d.ts +2 -2
  143. package/dist/queries/coupling.js +1 -1
  144. package/dist/queries/cycles.d.ts +2 -2
  145. package/dist/queries/cycles.js +1 -1
  146. package/dist/queries/dataflow.d.ts +2 -2
  147. package/dist/queries/dataflow.js +1 -1
  148. package/dist/queries/dead.d.ts +2 -2
  149. package/dist/queries/dead.js +1 -1
  150. package/dist/queries/decorative-checkers.d.ts +3 -3
  151. package/dist/queries/decorative-checkers.js +1 -1
  152. package/dist/queries/deep-chains.d.ts +2 -2
  153. package/dist/queries/deep-chains.js +1 -1
  154. package/dist/queries/deps.d.ts +2 -2
  155. package/dist/queries/deps.js +1 -1
  156. package/dist/queries/diff-gate.d.ts +30 -2
  157. package/dist/queries/diff-gate.js +1 -1
  158. package/dist/queries/diff-impact.d.ts +2 -2
  159. package/dist/queries/diff-impact.js +1 -1
  160. package/dist/queries/doc-drift.d.ts +2 -2
  161. package/dist/queries/doc-drift.js +1 -1
  162. package/dist/queries/drift.d.ts +2 -2
  163. package/dist/queries/drift.js +1 -1
  164. package/dist/queries/duplicate-bodies.d.ts +2 -2
  165. package/dist/queries/duplicate-bodies.js +1 -1
  166. package/dist/queries/extract-candidates.d.ts +2 -2
  167. package/dist/queries/extract-candidates.js +1 -1
  168. package/dist/queries/fan.d.ts +2 -2
  169. package/dist/queries/fan.js +1 -1
  170. package/dist/queries/files.d.ts +2 -2
  171. package/dist/queries/health.d.ts +3 -3
  172. package/dist/queries/health.js +1 -1
  173. package/dist/queries/hierarchy.d.ts +2 -2
  174. package/dist/queries/hierarchy.js +1 -1
  175. package/dist/queries/hotspots.d.ts +2 -2
  176. package/dist/queries/hotspots.js +1 -1
  177. package/dist/queries/imports.d.ts +2 -2
  178. package/dist/queries/imports.js +1 -1
  179. package/dist/queries/incomplete-migration.d.ts +2 -2
  180. package/dist/queries/incomplete-migration.js +1 -1
  181. package/dist/queries/index.d.ts +17 -3
  182. package/dist/queries/index.js +1 -1
  183. package/dist/queries/isolated.d.ts +2 -2
  184. package/dist/queries/isolated.js +1 -1
  185. package/dist/queries/locality-candidates.d.ts +2 -2
  186. package/dist/queries/locality-candidates.js +1 -1
  187. package/dist/queries/members.d.ts +2 -2
  188. package/dist/queries/members.js +1 -1
  189. package/dist/queries/methods.d.ts +2 -2
  190. package/dist/queries/methods.js +1 -1
  191. package/dist/queries/not-implemented.d.ts +3 -3
  192. package/dist/queries/not-implemented.js +1 -1
  193. package/dist/queries/outline.d.ts +2 -2
  194. package/dist/queries/outline.js +1 -1
  195. package/dist/queries/passthrough-candidates.d.ts +2 -2
  196. package/dist/queries/passthrough-candidates.js +1 -1
  197. package/dist/queries/plan-context.d.ts +2 -2
  198. package/dist/queries/plan-context.js +1 -1
  199. package/dist/queries/react-component-duplicates.d.ts +2 -2
  200. package/dist/queries/react-component-duplicates.js +1 -1
  201. package/dist/queries/react-hook-candidates.d.ts +2 -2
  202. package/dist/queries/react-hook-candidates.js +1 -1
  203. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  204. package/dist/queries/react-large-component-pressure.js +1 -1
  205. package/dist/queries/recent-duplicates.d.ts +2 -2
  206. package/dist/queries/recent-duplicates.js +1 -1
  207. package/dist/queries/redundant-reexports.d.ts +2 -2
  208. package/dist/queries/redundant-reexports.js +1 -1
  209. package/dist/queries/refs.d.ts +2 -2
  210. package/dist/queries/refs.js +1 -1
  211. package/dist/queries/self-audit.d.ts +2 -2
  212. package/dist/queries/self-audit.js +1 -1
  213. package/dist/queries/similar-chains.d.ts +2 -2
  214. package/dist/queries/similar-chains.js +1 -1
  215. package/dist/queries/similar-files.d.ts +2 -2
  216. package/dist/queries/similar-files.js +1 -1
  217. package/dist/queries/similar-signatures.d.ts +2 -2
  218. package/dist/queries/similar-signatures.js +1 -1
  219. package/dist/queries/similar.d.ts +2 -2
  220. package/dist/queries/similar.js +1 -1
  221. package/dist/queries/slice.d.ts +2 -2
  222. package/dist/queries/slice.js +1 -1
  223. package/dist/queries/stale-abstractions.d.ts +2 -2
  224. package/dist/queries/stale-abstractions.js +1 -1
  225. package/dist/queries/stats.d.ts +2 -2
  226. package/dist/queries/stats.js +1 -1
  227. package/dist/queries/surface.d.ts +2 -2
  228. package/dist/queries/surface.js +1 -1
  229. package/dist/queries/symbols.d.ts +2 -2
  230. package/dist/queries/symbols.js +1 -1
  231. package/dist/queries/system.d.ts +2 -2
  232. package/dist/queries/system.js +1 -1
  233. package/dist/queries/test-quality.d.ts +2 -2
  234. package/dist/queries/test-quality.js +1 -1
  235. package/dist/queries/trace.d.ts +2 -2
  236. package/dist/queries/trace.js +1 -1
  237. package/dist/queries/twin-ab.d.ts +3 -3
  238. package/dist/queries/twin-ab.js +1 -1
  239. package/dist/queries/twin-drift.d.ts +2 -2
  240. package/dist/queries/twin-drift.js +1 -1
  241. package/dist/queries/unused-imports.d.ts +2 -2
  242. package/dist/queries/unused-imports.js +1 -1
  243. package/dist/queries/unused-params.d.ts +2 -2
  244. package/dist/queries/unused-params.js +1 -1
  245. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  246. package/dist/queries/vue-component-duplicates.js +1 -1
  247. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  248. package/dist/queries/vue-composable-candidates.js +1 -1
  249. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  250. package/dist/queries/vue-large-view-pressure.js +1 -1
  251. package/dist/queries/wrapper-candidates.d.ts +2 -2
  252. package/dist/queries/wrapper-candidates.js +1 -1
  253. package/dist/reindex-worker.js +26 -26
  254. package/dist/reindex.d.ts +14 -4
  255. package/dist/reindex.js +34 -38
  256. package/dist/runtime.d.ts +167 -18
  257. package/dist/runtime.js +3 -2
  258. package/dist/rust-semantic-session-server.js +1 -1
  259. package/dist/rust-semantic-session-worker.js +1 -1
  260. package/dist/rust-semantic-worker.js +1 -1
  261. package/dist/{scip-cli-kRpaexVJ.d.ts → scip-cli-Cc6c00-a.d.ts} +6 -2
  262. package/dist/watch-server.js +5 -5
  263. package/docs/AGENT_GUIDE.md +20 -4
  264. package/docs/AI_FAILURE_MODES.md +17 -17
  265. package/docs/API_EVOLUTION.md +71 -0
  266. package/docs/CLI_JSON_OUTPUT.md +168 -0
  267. package/docs/COMMAND_REFERENCE.md +10 -6
  268. package/docs/COMMITTED_RECORD_COMPATIBILITY.md +117 -0
  269. package/docs/CONFIGURATION_WRITE_SAFETY.md +130 -0
  270. package/docs/DETECTOR_GUIDE.md +46 -46
  271. package/docs/DURABILITY.md +103 -0
  272. package/docs/INDEX_GENERATIONS.md +121 -0
  273. package/docs/LOCK_PROTOCOL.md +133 -0
  274. package/docs/MAILBOX_LIFECYCLE.md +197 -0
  275. package/docs/REINDEX_METADATA_COMPATIBILITY.md +84 -0
  276. package/docs/RUST_DURABLE_SESSION_PROTOCOL.md +126 -0
  277. package/docs/SECURITY_MODEL.md +129 -0
  278. package/docs/TELEMETRY_RETENTION.md +77 -0
  279. package/docs/TIME_SEMANTICS.md +77 -0
  280. package/docs/WATCH_REFRESH_REQUESTS.md +110 -0
  281. package/docs/WINDOWS_SIDECAR_RELEASE.md +298 -0
  282. package/docs/analyzer-validation-ledger.md +24 -23
  283. package/docs/schemas/cli-json-envelope.schema.json +53 -0
  284. package/docs/schemas/cli-output-page.schema.json +104 -0
  285. package/docs/schemas/npm-release-state.schema.json +146 -0
  286. package/docs/schemas/outcome-event-record.schema.json +39 -0
  287. package/docs/schemas/project-config.schema.json +247 -0
  288. package/docs/schemas/suppression-record.schema.json +31 -0
  289. package/docs/schemas/windows-sidecar-provenance.schema.json +137 -0
  290. package/package.json +21 -10
  291. package/scripts/build-scip-windows.mjs +180 -61
  292. package/scripts/scip-windows-provenance.mjs +364 -0
  293. package/scripts/verify-scip-windows.mjs +29 -0
  294. package/skills/_shared/SKILL.md +90 -229
  295. package/skills/_shared/agents/openai.yaml +1 -1
  296. package/skills/_shared/references/agent-contract-catalog.md +105 -0
  297. package/skills/_shared/references/command-catalog.md +118 -0
  298. package/skills/_shared/references/detector-precision-and-diffgate.md +59 -0
  299. package/skills/_shared/references/evidence-and-dead-code.md +25 -0
  300. package/skills/scip-audit/SKILL.md +77 -0
  301. package/skills/scip-audit/agents/openai.yaml +4 -0
  302. package/skills/scip-audit/references/claims.md +98 -0
  303. package/skills/scip-audit/references/cleanup.md +101 -0
  304. package/skills/scip-audit/references/directory.md +222 -0
  305. package/skills/scip-audit/references/frontend.md +130 -0
  306. package/skills/scip-audit/references/integrity.md +154 -0
  307. package/skills/scip-audit/references/maintainability.md +162 -0
  308. package/skills/scip-audit/references/twin-drift.md +104 -0
  309. package/skills/scip-diagnose/SKILL.md +52 -0
  310. package/skills/scip-diagnose/agents/openai.yaml +4 -0
  311. package/skills/scip-diagnose/references/debug.md +117 -0
  312. package/skills/{scip-probe-reachability/SKILL.md → scip-diagnose/references/probe-reachability.md} +11 -27
  313. package/skills/scip-diagnose/references/root-cause.md +145 -0
  314. package/skills/scip-diagnose/references/triage.md +119 -0
  315. package/skills/scip-explore/SKILL.md +54 -85
  316. package/skills/scip-explore/agents/openai.yaml +2 -2
  317. package/skills/scip-explore/references/diagrams.md +40 -0
  318. package/skills/scip-explore/references/language-playbook.md +49 -0
  319. package/skills/scip-improve/SKILL.md +56 -0
  320. package/skills/scip-improve/agents/openai.yaml +4 -0
  321. package/skills/scip-improve/references/cleanup-batches.md +53 -0
  322. package/skills/scip-improve/references/directory-moves.md +53 -0
  323. package/skills/scip-improve/references/doc-reconcile.md +30 -0
  324. package/skills/scip-improve/references/frontend-extraction.md +39 -0
  325. package/skills/scip-improve/references/maintainability-mechanism.md +43 -0
  326. package/skills/scip-improve/references/twin-drift.md +35 -0
  327. package/skills/scip-plan/SKILL.md +68 -0
  328. package/skills/scip-plan/agents/openai.yaml +4 -0
  329. package/skills/scip-plan/references/api-impact.md +19 -0
  330. package/skills/scip-plan/references/conductor.md +41 -0
  331. package/skills/scip-plan/references/high-assurance.md +43 -0
  332. package/skills/scip-plan/references/hyper-optimization.md +50 -0
  333. package/skills/scip-plan/references/tla-model.md +88 -0
  334. package/skills/scip-query/SKILL.md +53 -98
  335. package/skills/scip-query/agents/openai.yaml +2 -2
  336. package/skills/scip-setup/SKILL.md +69 -181
  337. package/skills/scip-setup/agents/openai.yaml +3 -3
  338. package/skills/scip-setup/references/bootstrap-workflow.md +120 -0
  339. package/skills/scip-setup/references/language-verification.md +61 -0
  340. package/skills/scip-setup/references/lifecycle-commands.md +119 -0
  341. package/skills/scip-setup/references/per-repo-triage.md +24 -0
  342. package/skills/scip-verify/SKILL.md +126 -84
  343. package/skills/scip-verify/agents/openai.yaml +2 -2
  344. package/skills/scip-verify/references/calibrate-detectors.md +170 -0
  345. package/dist/chunk-2CTX5CMX.js +0 -4
  346. package/dist/chunk-2Y373BDD.js +0 -2
  347. package/dist/chunk-2YU7I3QO.js +0 -2
  348. package/dist/chunk-3MJ5YA4Y.js +0 -16
  349. package/dist/chunk-64RFXJT5.js +0 -16
  350. package/dist/chunk-7UY7SD7D.js +0 -927
  351. package/dist/chunk-B5NLK2B3.js +0 -6
  352. package/dist/chunk-C2QSK7E7.js +0 -2
  353. package/dist/chunk-C7NIYIQ4.js +0 -67
  354. package/dist/chunk-D4U5Q3FT.js +0 -7
  355. package/dist/chunk-DGAGY7RJ.js +0 -60
  356. package/dist/chunk-DLWR3NUU.js +0 -5
  357. package/dist/chunk-K2ERX4UT.js +0 -3
  358. package/dist/chunk-KHE7J5ZN.js +0 -3
  359. package/dist/chunk-L7SPDE73.js +0 -84
  360. package/dist/chunk-LHMNRHGV.js +0 -3
  361. package/dist/chunk-LM72NQ7T.js +0 -3
  362. package/dist/chunk-MSWVMDAH.js +0 -122
  363. package/dist/chunk-NH7WNNQC.js +0 -20
  364. package/dist/chunk-NPKYOIFM.js +0 -18
  365. package/dist/chunk-NZL2DBT7.js +0 -2
  366. package/dist/chunk-OMPZHGHO.js +0 -2
  367. package/dist/chunk-P2PC2WGR.js +0 -2
  368. package/dist/chunk-Q3AFUTGB.js +0 -8
  369. package/dist/chunk-QRGV2F7L.js +0 -2
  370. package/dist/chunk-TW4OG5FC.js +0 -4
  371. package/dist/chunk-U7DSEKOM.js +0 -30
  372. package/dist/chunk-V27BEQJN.js +0 -7
  373. package/dist/chunk-XAGAZSFE.js +0 -6
  374. package/dist/chunk-XBN5VO53.js +0 -2
  375. package/dist/chunk-YGAGTIDK.js +0 -11
  376. package/dist/command-descriptors-N2TL4XM2.js +0 -613
  377. package/dist/direct-navigation-DUCZCTOE.js +0 -3
  378. package/skills/scip-api-impact/SKILL.md +0 -140
  379. package/skills/scip-api-impact/agents/openai.yaml +0 -4
  380. package/skills/scip-calibrate/SKILL.md +0 -131
  381. package/skills/scip-calibrate/agents/openai.yaml +0 -4
  382. package/skills/scip-claim-audit/SKILL.md +0 -107
  383. package/skills/scip-claim-audit/agents/openai.yaml +0 -4
  384. package/skills/scip-cleanup-audit/SKILL.md +0 -130
  385. package/skills/scip-cleanup-audit/agents/openai.yaml +0 -4
  386. package/skills/scip-cleanup-improve/SKILL.md +0 -85
  387. package/skills/scip-cleanup-improve/agents/openai.yaml +0 -4
  388. package/skills/scip-concrete-plan/HIGH_ASSURANCE.md +0 -317
  389. package/skills/scip-concrete-plan/SKILL.md +0 -105
  390. package/skills/scip-concrete-plan/agents/openai.yaml +0 -4
  391. package/skills/scip-conductor/SKILL.md +0 -133
  392. package/skills/scip-conductor/agents/openai.yaml +0 -4
  393. package/skills/scip-debug/SKILL.md +0 -130
  394. package/skills/scip-debug/agents/openai.yaml +0 -4
  395. package/skills/scip-diagram/SKILL.md +0 -110
  396. package/skills/scip-diagram/agents/openai.yaml +0 -4
  397. package/skills/scip-directory-architecture/SKILL.md +0 -266
  398. package/skills/scip-directory-architecture/agents/openai.yaml +0 -4
  399. package/skills/scip-doc-reconcile/SKILL.md +0 -89
  400. package/skills/scip-doc-reconcile/agents/openai.yaml +0 -4
  401. package/skills/scip-hyper-optimization/SKILL.md +0 -156
  402. package/skills/scip-hyper-optimization/agents/openai.yaml +0 -4
  403. package/skills/scip-integrity-audit/SKILL.md +0 -152
  404. package/skills/scip-integrity-audit/agents/openai.yaml +0 -4
  405. package/skills/scip-language-playbook/SKILL.md +0 -106
  406. package/skills/scip-language-playbook/agents/openai.yaml +0 -4
  407. package/skills/scip-maintainability/SKILL.md +0 -158
  408. package/skills/scip-maintainability/agents/openai.yaml +0 -4
  409. package/skills/scip-probe-reachability/agents/openai.yaml +0 -4
  410. package/skills/scip-react-maintainability/SKILL.md +0 -101
  411. package/skills/scip-react-maintainability/agents/openai.yaml +0 -4
  412. package/skills/scip-root-cause/SKILL.md +0 -151
  413. package/skills/scip-root-cause/agents/openai.yaml +0 -4
  414. package/skills/scip-tla-model-system/SKILL.md +0 -148
  415. package/skills/scip-tla-model-system/agents/openai.yaml +0 -4
  416. package/skills/scip-triage-issue/SKILL.md +0 -133
  417. package/skills/scip-triage-issue/agents/openai.yaml +0 -4
  418. package/skills/scip-twin-drift/SKILL.md +0 -109
  419. package/skills/scip-twin-drift/agents/openai.yaml +0 -4
  420. package/skills/scip-vue-maintainability/SKILL.md +0 -107
  421. package/skills/scip-vue-maintainability/agents/openai.yaml +0 -4
package/dist/runtime.d.ts CHANGED
@@ -1,14 +1,8 @@
1
- import { P as ProjectConfig, a as SupportedLanguage } from './config-types-D20KuvvZ.js';
2
- import { W as WatcherStatus, R as RefreshTrigger } from './scip-cli-kRpaexVJ.js';
3
- export { g as getScipVersion, i as isScipInstalled, p as printScipInstallInstructions } from './scip-cli-kRpaexVJ.js';
1
+ import { P as ProjectConfig, a as SupportedLanguage, T as TypeScriptProjectMode } from './config-types-B6MEoRNy.js';
2
+ import { watch } from 'chokidar';
3
+ import { R as RefreshTrigger, W as WatcherStatus } from './scip-cli-Cc6c00-a.js';
4
+ export { g as getScipVersion, i as isScipInstalled, p as printScipInstallInstructions } from './scip-cli-Cc6c00-a.js';
4
5
 
5
- /**
6
- * Resolve all storage paths for a project's index files (cache dir, SQLite
7
- * db, .scip index, meta.json). Distinct from queries/internal/file-resolution.ts's
8
- * resolveIndexedPaths, which resolves a file-pattern query against the
9
- * already-indexed documents table -- a different job that happens to share
10
- * "resolve" + "index" + "paths" vocabulary.
11
- */
12
6
  declare function resolveIndexStoragePaths(projectRoot: string, config?: ProjectConfig): {
13
7
  cacheDir: string;
14
8
  dbPath: string;
@@ -31,11 +25,82 @@ interface WatcherOptions {
31
25
  projectRoot: string;
32
26
  config: ProjectConfig;
33
27
  languages?: SupportedLanguage[];
28
+ reindexRunner?: ReindexRunner;
29
+ subscriptionFactory?: WatchSubscriptionFactory;
30
+ clock?: WatchClock;
34
31
  onStatus?: (status: WatcherStatus) => void;
35
- onReindexComplete?: (durationMs: number) => boolean | void;
32
+ onReindexComplete?: (durationMs: number, trigger: RefreshTrigger) => boolean | void;
33
+ onReindexError?: (error: Error, trigger: RefreshTrigger) => void;
36
34
  onRefreshSuppressed?: (trigger: RefreshTrigger) => void;
37
35
  onError?: (error: Error) => void;
38
36
  }
37
+ interface ReindexRunRequest {
38
+ projectRoot: string;
39
+ config: ProjectConfig;
40
+ languages?: SupportedLanguage[];
41
+ pnpmWorkspaces: boolean;
42
+ typescriptProjectMode?: TypeScriptProjectMode;
43
+ typescriptProjects?: string[];
44
+ clojureConfigPath?: string;
45
+ indexerConcurrency?: number;
46
+ trigger: RefreshTrigger;
47
+ }
48
+ interface ReindexWorkerLaunch {
49
+ workerPath: string;
50
+ env: NodeJS.ProcessEnv;
51
+ }
52
+ interface ReindexRunner {
53
+ start(request: ReindexRunRequest): ReindexOperation;
54
+ }
55
+ interface ReindexDiagnostics {
56
+ stdoutTail: string;
57
+ stderrTail: string;
58
+ stdoutTruncated: boolean;
59
+ stderrTruncated: boolean;
60
+ }
61
+ type ReindexCancellationResult = {
62
+ state: 'exited';
63
+ diagnostics: ReindexDiagnostics;
64
+ } | {
65
+ state: 'degraded';
66
+ reason: string;
67
+ diagnostics: ReindexDiagnostics;
68
+ };
69
+ interface ReindexOperation {
70
+ completion: Promise<number>;
71
+ cancel(): Promise<ReindexCancellationResult>;
72
+ diagnostics(): ReindexDiagnostics;
73
+ }
74
+ type WatcherStopResult = {
75
+ state: 'stopped';
76
+ } | {
77
+ state: 'degraded';
78
+ reasons: string[];
79
+ };
80
+ interface ReindexRunnerOptions {
81
+ timeoutMs?: number;
82
+ terminationGraceMs?: number;
83
+ maxOutputBytes?: number;
84
+ resolveLaunch?: (request: ReindexRunRequest) => ReindexWorkerLaunch;
85
+ }
86
+ interface WatchSubscription {
87
+ on(event: 'all', listener: (eventName: string, path: string) => void): WatchSubscription;
88
+ on(event: 'error', listener: (error: unknown) => void): WatchSubscription;
89
+ close(): void | Promise<void>;
90
+ }
91
+ type WatchSubscriptionOptions = NonNullable<Parameters<typeof watch>[1]>;
92
+ type WatchSubscriptionFactory = (projectRoot: string, options: WatchSubscriptionOptions) => WatchSubscription;
93
+ type WatchTimer = ReturnType<typeof setTimeout>;
94
+ interface WatchClock {
95
+ /** Process-local elapsed clock used for debounce/cooldown control. */
96
+ now(): number;
97
+ /** Civil clock used only in externally visible status timestamps. */
98
+ wallNow?(): number;
99
+ setTimeout(callback: () => void, delayMs: number): WatchTimer;
100
+ clearTimeout(timer: WatchTimer): void;
101
+ setInterval(callback: () => void, intervalMs: number): WatchTimer;
102
+ clearInterval(timer: WatchTimer): void;
103
+ }
39
104
  /**
40
105
  * File watcher that triggers single-flight background reindexing.
41
106
  *
@@ -58,8 +123,15 @@ declare class Watcher {
58
123
  private indexerConcurrency?;
59
124
  private onStatus;
60
125
  private onReindexComplete;
126
+ private onReindexError;
61
127
  private onRefreshSuppressed;
62
128
  private onError;
129
+ private reindexRunner;
130
+ private subscriptionFactory;
131
+ private clock;
132
+ private activeOperation;
133
+ private stopPromise;
134
+ private stopInProgress;
63
135
  private status;
64
136
  private debounceTimer;
65
137
  private cooldownTimer;
@@ -79,7 +151,7 @@ declare class Watcher {
79
151
  /** Start watching for file changes */
80
152
  start(): void;
81
153
  /** Stop watching and clean up */
82
- stop(): void;
154
+ stop(): Promise<WatcherStopResult>;
83
155
  /** Request a refresh through the same single-flight/coalescing state machine used by file events. */
84
156
  requestRefresh(trigger: RefreshTrigger, opts?: {
85
157
  immediate?: boolean;
@@ -91,11 +163,9 @@ declare class Watcher {
91
163
  private relativeWatchPath;
92
164
  private scheduleReindex;
93
165
  private triggerReindex;
94
- /**
95
- * Run the reindex in a forked child process.
96
- * The child process uses the reindexer's own atomic publish path.
97
- */
98
- private runReindex;
166
+ private finishStop;
167
+ private wallNow;
168
+ private reindexRequest;
99
169
  private setStatus;
100
170
  private clearDebounceTimer;
101
171
  private clearCooldownTimer;
@@ -104,6 +174,8 @@ declare class Watcher {
104
174
  private readGitState;
105
175
  private clearGitPollTimer;
106
176
  }
177
+ declare function resolveReindexWorkerLaunch(request: ReindexRunRequest): ReindexWorkerLaunch;
178
+ declare function createReindexRunner(options?: ReindexRunnerOptions): ReindexRunner;
107
179
 
108
180
  interface InstallSkillsResult {
109
181
  installed: string[];
@@ -121,4 +193,81 @@ declare function installSkills(opts?: {
121
193
  quiet?: boolean;
122
194
  }): InstallSkillsResult;
123
195
 
124
- export { Watcher, type WatcherOptions, initProjectConfig, installSkills, loadProjectConfig, resolveIndexStoragePaths };
196
+ declare const CLI_JSON_ENVELOPE_KIND: "scip-query-result";
197
+ declare const LEGACY_CLI_JSON_ENVELOPE_SCHEMA_VERSION: 0;
198
+ declare const CURRENT_CLI_JSON_ENVELOPE_SCHEMA_VERSION: 1;
199
+ interface CliJsonProducer {
200
+ name: 'scip-query';
201
+ version: string;
202
+ }
203
+ /**
204
+ * One public machine-readable CLI response. The envelope is the stable
205
+ * transport contract; `result` remains the command-owned payload whose schema
206
+ * can advance independently through `resultSchemaVersion`.
207
+ */
208
+ interface CliJsonEnvelopeV1<Result = unknown> {
209
+ kind: typeof CLI_JSON_ENVELOPE_KIND;
210
+ schemaVersion: typeof CURRENT_CLI_JSON_ENVELOPE_SCHEMA_VERSION;
211
+ producer: CliJsonProducer;
212
+ command: string;
213
+ resultSchemaVersion: number;
214
+ evidence?: 'graph-fact' | 'heuristic' | 'mixed';
215
+ analysisBudget?: unknown;
216
+ args: readonly unknown[];
217
+ options: Readonly<Record<string, unknown>>;
218
+ result: Result;
219
+ coverage?: unknown;
220
+ agentResult?: unknown;
221
+ }
222
+ interface LegacyCliJsonEnvelope<Result = unknown> {
223
+ command: string;
224
+ args: readonly unknown[];
225
+ options: Readonly<Record<string, unknown>>;
226
+ result: Result;
227
+ evidence?: 'graph-fact' | 'heuristic' | 'mixed';
228
+ analysisBudget?: unknown;
229
+ coverage?: unknown;
230
+ agentResult?: unknown;
231
+ }
232
+ type CompatibleCliJsonEnvelope<Result = unknown> = {
233
+ kind: 'legacy';
234
+ schemaVersion: typeof LEGACY_CLI_JSON_ENVELOPE_SCHEMA_VERSION;
235
+ envelope: LegacyCliJsonEnvelope<Result>;
236
+ } | {
237
+ kind: 'supported';
238
+ schemaVersion: typeof CURRENT_CLI_JSON_ENVELOPE_SCHEMA_VERSION;
239
+ envelope: CliJsonEnvelopeV1<Result>;
240
+ };
241
+ type DecodedCliJsonEnvelope<Result = unknown> = CompatibleCliJsonEnvelope<Result> | {
242
+ kind: 'unsupported';
243
+ schemaVersion: number;
244
+ direction: 'older' | 'future';
245
+ producer?: {
246
+ name: string;
247
+ version: string;
248
+ };
249
+ } | {
250
+ kind: 'unsupported-result';
251
+ schemaVersion: typeof CURRENT_CLI_JSON_ENVELOPE_SCHEMA_VERSION;
252
+ command: string;
253
+ resultSchemaVersion: number;
254
+ supportedResultSchemaVersions: readonly number[];
255
+ } | {
256
+ kind: 'malformed';
257
+ reason: string;
258
+ };
259
+ /**
260
+ * Decodes the current envelope and the immediately preceding unversioned
261
+ * shape. Unknown additive fields are deliberately preserved on the returned
262
+ * object and ignored by compatibility checks.
263
+ */
264
+ declare function decodeCliJsonEnvelope<Result = unknown>(input: unknown): DecodedCliJsonEnvelope<Result>;
265
+ declare function requireCompatibleCliJsonEnvelope<Result = unknown>(input: unknown): CompatibleCliJsonEnvelope<Result>;
266
+ /**
267
+ * Result schemas start at v1. A command that advances independently adds its
268
+ * supported transition window here without forcing unrelated commands to
269
+ * change their payload contract.
270
+ */
271
+ declare function supportedCliResultSchemaVersions(command: string): readonly number[];
272
+
273
+ export { CLI_JSON_ENVELOPE_KIND, CURRENT_CLI_JSON_ENVELOPE_SCHEMA_VERSION, type CliJsonEnvelopeV1, type CliJsonProducer, type CompatibleCliJsonEnvelope, type DecodedCliJsonEnvelope, LEGACY_CLI_JSON_ENVELOPE_SCHEMA_VERSION, type LegacyCliJsonEnvelope, type ReindexCancellationResult, type ReindexDiagnostics, type ReindexOperation, type ReindexRunRequest, type ReindexRunner, type ReindexRunnerOptions, type ReindexWorkerLaunch, type WatchClock, type WatchSubscription, type WatchSubscriptionFactory, type WatchSubscriptionOptions, Watcher, type WatcherOptions, type WatcherStopResult, createReindexRunner, decodeCliJsonEnvelope, initProjectConfig, installSkills, loadProjectConfig, requireCompatibleCliJsonEnvelope, resolveIndexStoragePaths, resolveReindexWorkerLaunch, supportedCliResultSchemaVersions };
package/dist/runtime.js CHANGED
@@ -1,3 +1,4 @@
1
- import{b as D,c as N,d as F,f as m,l as y}from"./chunk-V27BEQJN.js";import{a as R}from"./chunk-DGAGY7RJ.js";import{e as f,f as x}from"./chunk-LM72NQ7T.js";import{readFileSync as W,writeFileSync as G,existsSync as P}from"fs";import{isAbsolute as he,join as E,relative as de,resolve as ge}from"path";var g=".scipquery.json",k=250,j=0,T=10*6e4,U={enabled:!1,debounceMs:k,cooldownMs:j,gitPollMs:2e3,idleTimeoutMs:T,autoRefresh:!0,ignore:[]},q=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"];var fe=new Set(q);function S(s){let e=E(s,g);if(!P(e))return{};try{let t=W(e,"utf-8");return JSON.parse(t)}catch(t){let r=t instanceof Error?t.message:String(t);throw t instanceof SyntaxError?new Error(`invalid ${g} at ${e}: ${r}`,{cause:t}):new Error(`unable to read ${g} at ${e}: ${r}`,{cause:t})}}function I(s){return{...U,...s.watch}}function L(s,e){let t=E(s,g);return P(t)||G(t,JSON.stringify({languages:e,watch:{enabled:!0,debounceMs:k,cooldownMs:j,gitPollMs:2e3,idleTimeoutMs:T,autoRefresh:!0}},null,2)+`
2
- `),t}import{fork as Y}from"child_process";import{statSync as K}from"fs";import{isAbsolute as B,join as H,relative as z}from"path";import{watch as X}from"chokidar";import J from"ignore";var v=class{projectRoot;config;watchConfig;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;clojureConfigPath;indexerConcurrency;onStatus;onReindexComplete;onRefreshSuppressed;onError;status={state:"idle"};debounceTimer=null;cooldownTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;reindexInFlight=!1;lastReindexEnd=0;fsWatchers=[];sourcePollingFallbackStarted=!1;gitPollTimer=null;lastGitState=null;gitignoreFilter;extraIgnore;stopped=!1;constructor(e){this.projectRoot=e.projectRoot,this.config=e.config,this.watchConfig=I(e.config),this.languages=e.languages,this.pnpmWorkspaces=e.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=e.config.indexer?.typescript?.projectMode,this.typescriptProjects=e.config.indexer?.typescript?.projects,this.clojureConfigPath=e.config.indexer?.clojure?.configPath,this.indexerConcurrency=e.config.indexerConcurrency,this.onStatus=e.onStatus??(()=>{}),this.onReindexComplete=e.onReindexComplete??(()=>{}),this.onRefreshSuppressed=e.onRefreshSuppressed??(()=>{}),this.onError=e.onError??(t=>console.error(t.message)),this.gitignoreFilter=R(e.projectRoot),this.extraIgnore=J(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){this.stopped=!1,this.sourcePollingFallbackStarted=!1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{this.startSourceWatcher()}catch(e){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(e)}`))}}stop(){this.stopped=!0;for(let e of this.fsWatchers)e.close();this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearGitPollTimer(),this.setStatus({state:"idle"})}requestRefresh(e,t={}){if(!t.immediate||this.reindexInFlight||this.status.state==="cooldown"){this.scheduleReindex(e);return}this.pendingTrigger=$(this.pendingTrigger,e),this.changedFiles+=1,this.clearDebounceTimer(),this.triggerReindex()}startSourceWatcher(e=!1){let t=X(this.projectRoot,{ignoreInitial:!0,ignored:(r,i)=>this.isIgnoredWatchPath(r,i?.isDirectory()??!1),usePolling:e,...e?{interval:500,binaryInterval:1e3}:{}});t.on("all",(r,i)=>{this.stopped||this.handleFileChange(i)}),t.on("error",r=>this.handleSourceWatcherError(t,r,e)),this.fsWatchers.push(t)}handleSourceWatcherError(e,t,r){if(r||this.sourcePollingFallbackStarted||!V(t)||this.stopped){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(t)}`));return}this.sourcePollingFallbackStarted=!0,this.fsWatchers=this.fsWatchers.filter(i=>i!==e),e.close();try{this.startSourceWatcher(!0)}catch(i){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(i)}`))}}isIgnoredWatchPath(e,t){let r=this.relativeWatchPath(e);if(!r)return!1;let i=t?`${r}/`:r;return i===".git/"||i.startsWith(".git/")?!0:this.gitignoreFilter.isIgnored(i)||this.extraIgnore.ignores(i)}handleFileChange(e){let t=this.relativeWatchPath(e);!t||t===".."||t.startsWith("../")||t===".git"||t.startsWith(".git/")||this.gitignoreFilter.isIgnored(t)||this.extraIgnore.ignores(t)||t.endsWith("index.db")||t.endsWith("index.scip")||t.endsWith("index.db.tmp")||t.endsWith(m)||t.endsWith(`${m}.previous`)||this.scheduleReindex({kind:"watch-source",detail:t})}relativeWatchPath(e){let t=B(e)?e:H(this.projectRoot,e);return z(this.projectRoot,t).replaceAll("\\","/")}scheduleReindex(e){if(this.pendingTrigger=$(this.pendingTrigger,e),this.changedFiles++,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}this.clearDebounceTimer();let t=Date.now()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:t}),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let e=Date.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&e<this.watchConfig.cooldownMs){let i=this.watchConfig.cooldownMs-e;this.dirty=!0;let o=Date.now()+i;this.setStatus({state:"cooldown",until:o,dirty:!0}),this.cooldownTimer=setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},i);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let t=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let r=Date.now();this.setStatus({state:"indexing",startedAt:r}),this.runReindex(t).then(i=>{this.reindexInFlight=!1,this.lastReindexEnd=Date.now();let o=!1;try{o=this.onReindexComplete(i)===!0}catch(n){this.onError(n instanceof Error?n:new Error(String(n)))}if(this.dirty&&!this.stopped){if(o){let c=this.pendingTrigger??{kind:"unknown"};this.dirty=!1,this.changedFiles=0,this.pendingTrigger=null,this.onRefreshSuppressed(c),this.setStatus({state:"idle"});return}let n=Date.now()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:n,dirty:!0}),this.cooldownTimer=setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(i=>{this.reindexInFlight=!1,this.lastReindexEnd=Date.now(),this.onError(i instanceof Error?i:new Error(String(i))),this.setStatus({state:"idle"})})}runReindex(e){return new Promise((t,r)=>{let i=Date.now(),o=S(this.projectRoot),n=Object.keys(o).length>0?o:this.config,c=y(this.projectRoot,n),a=n.indexer?.typescript,l=n.indexer?.clojure,p=Y(new URL("./reindex-worker.js",import.meta.url).pathname,[],{detached:!0,env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:this.projectRoot,SCIP_REINDEX_OUTPUT_SCIP:c.indexPath,SCIP_REINDEX_OUTPUT_DB:c.dbPath,SCIP_REINDEX_LANGUAGES:(n.languages??this.languages)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(n.indexerConcurrency??this.indexerConcurrency??""),SCIP_REINDEX_PNPM_WORKSPACES:a?.pnpmWorkspaces??this.pnpmWorkspaces?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:a?.projectMode??this.typescriptProjectMode,projects:a?.projects??this.typescriptProjects??[]}),SCIP_REINDEX_CLOJURE_CONFIG_PATH:l?.configPath??this.clojureConfigPath??"",SCIP_REINDEX_TRIGGER_KIND:e.kind,SCIP_REINDEX_TRIGGER_DETAIL:e.detail??""},stdio:"pipe"});p.on("exit",u=>{u===0?t(Date.now()-i):r(new Error(`Reindex worker exited with code ${u}`))}),p.on("error",r)})}setStatus(e){this.status=e,this.onStatus(e)}clearDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}startGitStatePolling(){this.lastGitState=this.readGitState(),this.lastGitState&&(this.gitPollTimer=setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.())}pollGitState(){let e=this.lastGitState,t=this.readGitState();if(!e||!t||this.stopped){this.lastGitState=t;return}this.lastGitState=t;let r=e.head!==t.head,i=e.indexPath!==t.indexPath||e.indexMtimeMs!==t.indexMtimeMs||e.indexSize!==t.indexSize;r&&i?this.scheduleReindex({kind:"watch-git-state",detail:"HEAD and index changed"}):r?this.scheduleReindex({kind:"watch-git-head",detail:"HEAD changed"}):i&&this.scheduleReindex({kind:"watch-git-index",detail:t.indexPath??"index changed"})}readGitState(){let e=f(this.projectRoot,["rev-parse","--git-path","index"]);if(!e)return null;let t=x(this.projectRoot,e),r={head:f(this.projectRoot,["rev-parse","--verify","HEAD"]),indexPath:t};try{let i=K(t);r.indexMtimeMs=i.mtimeMs,r.indexSize=i.size}catch{r.indexMtimeMs=void 0,r.indexSize=void 0}return r}clearGitPollTimer(){this.gitPollTimer&&(clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};function $(s,e){return s?s.kind===e.kind?s.detail===e.detail?s:{kind:s.kind,detail:"multiple changes"}:{kind:"watch-git-state",detail:`${s.kind}, ${e.kind}`}:e}function V(s){return s instanceof Error&&"code"in s&&s.code==="EMFILE"||String(s).includes("EMFILE: too many open files")}import{existsSync as C,mkdirSync as Q,symlinkSync as Z,readlinkSync as A,unlinkSync as _,readdirSync as ee}from"fs";import{join as h,dirname as b,resolve as d,relative as te,isAbsolute as re}from"path";import{homedir as w,platform as ie}from"os";import{fileURLToPath as se}from"url";var ne=ie()==="win32",M=["_shared","scip-query","scip-setup","scip-calibrate","scip-cleanup-audit","scip-cleanup-improve","scip-integrity-audit","scip-twin-drift","scip-claim-audit","scip-probe-reachability","scip-hyper-optimization","scip-api-impact","scip-concrete-plan","scip-conductor","scip-debug","scip-explore","scip-root-cause","scip-triage-issue","scip-diagram","scip-doc-reconcile","scip-directory-architecture","scip-maintainability","scip-react-maintainability","scip-vue-maintainability","scip-verify","scip-language-playbook","scip-tla-model-system"];function oe(s={}){let e=s.quiet?()=>{}:console.log,t=se(import.meta.url),r=d(b(t),"..","skills"),i=[h(w(),".claude","skills"),h(w(),".codex","skills"),h(w(),".agents","skills")],o={installed:[],skipped:[],alreadyLinked:[],pruned:[]};for(let n of i){let c=b(n);if(!C(c))continue;Q(n,{recursive:!0});let a=ce(n);ae(n,r,a,o,e);for(let l of M){let p=h(r,l),u=h(n,l);if(!C(p)){o.skipped.push(`${a}/${l}`);continue}if(C(u)){try{let O=A(u);if(d(O)===d(p)){o.alreadyLinked.push(`${a}/${l}`),e(` ok: ${l} \u2192 ${a} (already linked)`);continue}}catch{o.skipped.push(`${a}/${l}`),e(` skip: ${l} \u2192 ${a} (exists, not a symlink)`);continue}_(u)}Z(p,u,ne?"junction":"dir"),o.installed.push(`${a}/${l}`),e(` done: ${l} \u2192 ${a}`)}}return o}function ae(s,e,t,r,i){let o=new Set(M);for(let n of ee(s)){if(o.has(n))continue;let c=h(s,n),a;try{a=d(b(c),A(c))}catch{continue}le(a,e)&&(_(c),r.pruned.push(`${t}/${n}`),i(` prune: ${n} \u2192 ${t} (removed stale scip-query skill link)`))}}function le(s,e){let t=te(d(e),d(s));return t===""||!t.startsWith("..")&&!re(t)}function ce(s){return s.includes(".codex")?"Codex":s.includes(".agents")?"Agents":"Claude"}export{v as Watcher,N as getScipVersion,L as initProjectConfig,oe as installSkills,D as isScipInstalled,S as loadProjectConfig,F as printScipInstallInstructions,y as resolveIndexStoragePaths};
1
+ import{e as b,i as Re,j as Ce,k as Se,m as G,r as q,v as J,w as U}from"./chunk-KSGTULOS.js";import{a as D}from"./chunk-WJL2L6MV.js";import"./chunk-DHEQMPLW.js";import{h as C,k as F,l as L,m as W,p as w,q as V}from"./chunk-LSOR3LQG.js";import{g as h,j as O,k as N,l as M,q as A,s as $}from"./chunk-VVY2G5ET.js";import{existsSync as Ne}from"fs";import{isAbsolute as Tt,join as ee,relative as _t,resolve as It}from"path";var p=1,f=2,xe="./node_modules/scip-query/docs/schemas/project-config.schema.json";function B(t){let e=t;if(typeof t=="string")try{e=JSON.parse(t)}catch(l){return{kind:"malformed",reason:`invalid JSON: ${l instanceof Error?l.message:String(l)}`}}if(!h(e))return{kind:"malformed",reason:"project config must be a JSON object"};let r=e.schemaVersion;if(r!==void 0&&!Number.isInteger(r))return{kind:"malformed",reason:"schemaVersion must be an integer"};let n=r===void 0?p:r;if(n!==p&&n!==f)return{kind:"unsupported",schemaVersion:n,direction:n<p?"older":"future"};let i=e.$schema;if(i!==void 0&&(typeof i!="string"||i.trim()===""))return{kind:"malformed",reason:"$schema must be a non-empty string when present"};let s=k(e),o=n!==f||typeof e.$schema!="string";return n===p?{kind:"legacy",sourceVersion:p,config:s,needsMigration:o}:{kind:"supported",sourceVersion:f,config:s,needsMigration:o}}function k(t){let e=t,{$schema:r,schemaVersion:n,...i}=e;return{$schema:typeof r=="string"&&r.trim()!==""?r:xe,schemaVersion:f,...i}}function H(t){return`${JSON.stringify(k(t),null,2)}
2
+ `}import{createHash as Y}from"crypto";import{closeSync as Ee,fstatSync as K,openSync as we,rmSync as be}from"fs";import{dirname as ke}from"path";var Pe=2e3,Te=10,_e=3,x=class extends Error{constructor(r,n,i){super(`Concurrent edit detected for ${r}; expected revision ${X(n)}, but found ${X(i)}. The latest file was left untouched.`);this.path=r;this.original=n;this.latest=i;this.name="FileRevisionConflictError"}path;original;latest};function Q(t,e,r={}){let n=Ie(t,r.lockTimeoutMs??Pe,r.monotonicNow??C);try{let i=Math.max(0,Math.floor(r.maxRetries??_e));for(let s=0;;s+=1){let o=S(t),l=e(o,s);if(l.kind==="unchanged")return{changed:!1,attempts:s+1,previous:o,current:o};r.onBeforeCommit?.({attempt:s,snapshot:o,mutation:l});let c=S(t);if(!Oe(o.revision,c.revision)){if(s<i)continue;throw new x(t,o.revision,c.revision)}try{je(t,l,o.revision)}catch(u){if(u.code==="EEXIST"){let d=S(t);if(s<i)continue;throw new x(t,o.revision,d.revision)}throw u}return{changed:!0,attempts:s+1,previous:o,current:S(t)}}}finally{n.release()}}function S(t){for(let e=0;e<4;e+=1){let r;try{r=we(t,"r");let n=z(K(r)),i=$(r,{maxBytes:M,inputKind:"revisioned text file"}),s=z(K(r));if(!Z(n,s))continue;return{path:t,text:i,revision:{exists:!0,hash:Y("sha256").update(i).digest("hex"),identity:s}}}catch(n){if(n.code==="ENOENT")return{path:t,text:"",revision:{exists:!1,hash:Y("sha256").update("").digest("hex")}};throw n}finally{r!==void 0&&Ee(r)}}throw new Error(`Could not read a stable revision of ${t}; the file is changing continuously.`)}function Ie(t,e,r){let n=`${t}.scip-query-write.lock`,i=r()+Math.max(0,e);for(;;){let s=G(n,{kind:"revisioned-file-mutation",detail:{target:t}});if(s.kind==="acquired")return s.lock;if(r()>=i)throw new Error(`Timed out after ${e}ms waiting to update ${t}; the file was left untouched.`);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,Te)}}function je(t,e,r){if(e.kind==="delete"){if(!r.exists)return;be(t),W(ke(t));return}let n=e.mode??r.identity?.mode;r.exists?F(t,e.text,{durability:"durable",mode:n}):L(t,e.text,{durability:"durable",mode:n})}function Oe(t,e){return t.exists===e.exists&&t.hash===e.hash&&(t.identity===void 0?e.identity===void 0:e.identity!==void 0&&Z(t.identity,e.identity))}function z(t){return{dev:t.dev,ino:t.ino,size:t.size,mtimeMs:t.mtimeMs,mode:t.mode&511}}function Z(t,e){return t.dev===e.dev&&t.ino===e.ino&&t.size===e.size&&t.mtimeMs===e.mtimeMs&&t.mode===e.mode}function X(t){return t.exists?t.hash.slice(0,12):"<absent>"}var v=".scipquery.json",te=250,re=0,ne=10*6e4,Me={enabled:!1,debounceMs:te,cooldownMs:re,gitPollMs:2e3,idleTimeoutMs:ne,autoRefresh:!0,ignore:[]};var At=new Set(O);function P(t){let e=ee(t,v);if(!Ne(e))return{};let r;try{r=A(e,{maxBytes:N,inputKind:"scip-query project config"})}catch(n){let i=n instanceof Error?n.message:String(n);throw new Error(`unable to read ${v} at ${e}: ${i}`,{cause:n})}return Fe(B(r),e,"read").config}function ie(t){return{...Me,...t.watch}}function Ae(t,e){let r=ee(t,v),n={languages:e,watch:{enabled:!0,debounceMs:te,cooldownMs:re,gitPollMs:2e3,idleTimeoutMs:ne,autoRefresh:!0}};return Q(r,i=>i.revision.exists?{kind:"unchanged"}:{kind:"write",text:$e(n)}),r}function $e(t){return H(t)}function Fe(t,e,r){if(t.kind==="legacy"||t.kind==="supported")return t;if(t.kind==="malformed"){let i=r==="read"?`invalid ${v} at ${e}: ${t.reason}`:`Cannot update ${e}: the latest project config is ${t.reason}.`;throw new Error(`${i} The file was left untouched.`)}let n=r==="read"?`invalid ${v} at ${e}`:`Cannot update ${e}: the latest project config is invalid`;throw new Error(`${n} (unsupported ${t.direction} schemaVersion ${t.schemaVersion}; this scip-query reads legacy v${p} and current v${f}). Upgrade scip-query before retrying; the file was left untouched.`)}import{statSync as Le}from"fs";import{basename as We,isAbsolute as Ve,join as De,relative as Ge}from"path";import{watch as qe}from"chokidar";import Je from"ignore";var T=class{projectRoot;config;watchConfig;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;clojureConfigPath;indexerConcurrency;onStatus;onReindexComplete;onReindexError;onRefreshSuppressed;onError;reindexRunner;subscriptionFactory;clock;activeOperation=null;stopPromise=null;stopInProgress=!1;status={state:"idle"};debounceTimer=null;cooldownTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;reindexInFlight=!1;lastReindexEnd=0;fsWatchers=[];sourcePollingFallbackStarted=!1;gitPollTimer=null;lastGitState=null;gitignoreFilter;extraIgnore;stopped=!1;constructor(e){this.projectRoot=e.projectRoot,this.config=e.config,this.watchConfig=ie(e.config),this.languages=e.languages,this.pnpmWorkspaces=e.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=e.config.indexer?.typescript?.projectMode,this.typescriptProjects=e.config.indexer?.typescript?.projects,this.clojureConfigPath=e.config.indexer?.clojure?.configPath,this.indexerConcurrency=e.config.indexerConcurrency,this.onStatus=e.onStatus??(()=>{}),this.onReindexComplete=e.onReindexComplete??(()=>{}),this.onReindexError=e.onReindexError??(()=>{}),this.onRefreshSuppressed=e.onRefreshSuppressed??(()=>{}),this.onError=e.onError??(r=>console.error(r.message)),this.clock=e.clock??Ue,this.reindexRunner=e.reindexRunner??ce(),this.subscriptionFactory=e.subscriptionFactory??Be,this.gitignoreFilter=D(e.projectRoot),this.extraIgnore=Je(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){if(this.stopInProgress)throw new Error("Cannot restart a watcher while its previous ownership is still draining.");this.stopped=!1,this.stopPromise=null,this.sourcePollingFallbackStarted=!1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{this.startSourceWatcher()}catch(e){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(e)}`))}}stop(){if(this.stopPromise)return this.stopPromise;this.stopped=!0,this.stopInProgress=!0;let e=this.fsWatchers;this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearGitPollTimer();let r=this.activeOperation;return r&&this.setStatus({state:"draining",startedAt:this.wallNow(),reason:"waiting for the active reindex worker to exit"}),this.stopPromise=this.finishStop(e,r).finally(()=>{this.stopInProgress=!1}),this.stopPromise}requestRefresh(e,r={}){if(!this.stopped){if(!r.immediate||this.reindexInFlight||this.status.state==="cooldown"){this.scheduleReindex(e);return}this.pendingTrigger=se(this.pendingTrigger,e),this.changedFiles+=1,this.clearDebounceTimer(),this.triggerReindex()}}startSourceWatcher(e=!1){let r=this.subscriptionFactory(this.projectRoot,{ignoreInitial:!0,ignored:(n,i)=>this.isIgnoredWatchPath(n,i?.isDirectory()??!1),usePolling:e,...e?{interval:500,binaryInterval:1e3}:{}});r.on("all",(n,i)=>{this.stopped||this.handleFileChange(i)}),r.on("error",n=>this.handleSourceWatcherError(r,n,e)),this.fsWatchers.push(r)}handleSourceWatcherError(e,r,n){if(n||this.sourcePollingFallbackStarted||!Xe(r)||this.stopped){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(r)}`));return}this.sourcePollingFallbackStarted=!0,this.fsWatchers=this.fsWatchers.filter(i=>i!==e),e.close();try{this.startSourceWatcher(!0)}catch(i){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(i)}`))}}isIgnoredWatchPath(e,r){let n=this.relativeWatchPath(e);if(!n)return!1;let i=r?`${n}/`:n;return i===".git/"||i.startsWith(".git/")?!0:this.gitignoreFilter.isIgnored(i)||this.extraIgnore.ignores(i)}handleFileChange(e){let r=this.relativeWatchPath(e);!r||r===".."||r.startsWith("../")||r===".git"||r.startsWith(".git/")||this.gitignoreFilter.isIgnored(r)||this.extraIgnore.ignores(r)||r.endsWith("index.db")||r.endsWith("index.scip")||r.endsWith("index.db.tmp")||We(r).startsWith(q)||this.scheduleReindex({kind:"watch-source",detail:r})}relativeWatchPath(e){let r=Ve(e)?e:De(this.projectRoot,e);return Ge(this.projectRoot,r).replaceAll("\\","/")}scheduleReindex(e){if(this.pendingTrigger=se(this.pendingTrigger,e),this.changedFiles++,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}this.clearDebounceTimer();let r=this.wallNow()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:r}),this.debounceTimer=this.clock.setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let e=this.clock.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&e<this.watchConfig.cooldownMs){let s=this.watchConfig.cooldownMs-e;this.dirty=!0;let o=this.wallNow()+s;this.setStatus({state:"cooldown",until:o,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},s);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let r=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let n=this.wallNow();this.setStatus({state:"indexing",startedAt:n});let i=this.reindexRunner.start(this.reindexRequest(r));this.activeOperation=i,i.completion.then(s=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let o=!1;try{o=this.onReindexComplete(s,r)===!0}catch(l){this.onError(l instanceof Error?l:new Error(String(l)))}if(this.dirty&&!this.stopped){if(o){let c=this.pendingTrigger??{kind:"unknown"};this.dirty=!1,this.changedFiles=0,this.pendingTrigger=null,this.onRefreshSuppressed(c),this.setStatus({state:"idle"});return}let l=this.wallNow()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:l,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(s=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let o=s instanceof Error?s:new Error(String(s));this.onReindexError(o,r),this.onError(o),this.setStatus({state:"idle"})}).finally(()=>{this.activeOperation===i&&(this.activeOperation=null)})}async finishStop(e,r){let n=[],i=r?r.cancel():null,s=await Promise.allSettled(e.map(o=>Promise.resolve().then(()=>o.close())));for(let o of s)o.status==="rejected"&&n.push(`watch subscription close failed: ${String(o.reason)}`);if(i)try{let o=await i;o.state==="degraded"&&n.push(o.reason)}catch(o){n.push(`reindex cancellation failed: ${o instanceof Error?o.message:String(o)}`)}return n.length>0?(this.setStatus({state:"draining",startedAt:this.wallNow(),reason:n.join("; ")}),{state:"degraded",reasons:n}):(this.setStatus({state:"idle"}),{state:"stopped"})}wallNow(){return this.clock.wallNow?.()??this.clock.now()}reindexRequest(e){return{projectRoot:this.projectRoot,config:this.config,languages:this.languages,pnpmWorkspaces:this.pnpmWorkspaces,typescriptProjectMode:this.typescriptProjectMode,typescriptProjects:this.typescriptProjects,clojureConfigPath:this.clojureConfigPath,indexerConcurrency:this.indexerConcurrency,trigger:e}}setStatus(e){this.status=e,this.onStatus(e)}clearDebounceTimer(){this.debounceTimer&&(this.clock.clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(this.clock.clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}startGitStatePolling(){this.lastGitState=this.readGitState(),this.lastGitState&&(this.gitPollTimer=this.clock.setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.())}pollGitState(){let e=this.lastGitState,r=this.readGitState();if(!e||!r||this.stopped){this.lastGitState=r;return}this.lastGitState=r;let n=e.head!==r.head,i=e.indexPath!==r.indexPath||e.indexMtimeMs!==r.indexMtimeMs||e.indexSize!==r.indexSize;n&&i?this.scheduleReindex({kind:"watch-git-state",detail:"HEAD and index changed"}):n?this.scheduleReindex({kind:"watch-git-head",detail:"HEAD changed"}):i&&this.scheduleReindex({kind:"watch-git-index",detail:r.indexPath??"index changed"})}readGitState(){let e=w(this.projectRoot,["rev-parse","--git-path","index"]);if(!e)return null;let r=V(this.projectRoot,e),n={head:w(this.projectRoot,["rev-parse","--verify","HEAD"]),indexPath:r};try{let i=Le(r);n.indexMtimeMs=i.mtimeMs,n.indexSize=i.size}catch{n.indexMtimeMs=void 0,n.indexSize=void 0}return n}clearGitPollTimer(){this.gitPollTimer&&(this.clock.clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};function ae(t){let{projectRoot:e,config:r,languages:n,pnpmWorkspaces:i,typescriptProjectMode:s,typescriptProjects:o,clojureConfigPath:l,indexerConcurrency:c,trigger:u}=t,d=P(e),a=Object.keys(d).length>0?d:r,R=b(e,a),E=a.indexer?.typescript,ve=a.indexer?.clojure;return{workerPath:new URL("./reindex-worker.js",import.meta.url).pathname,env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:e,SCIP_REINDEX_OUTPUT_SCIP:R.indexPath,SCIP_REINDEX_OUTPUT_DB:R.dbPath,SCIP_REINDEX_LANGUAGES:(a.languages??n)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(a.indexerConcurrency??c??""),SCIP_REINDEX_PNPM_WORKSPACES:E?.pnpmWorkspaces??i?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:E?.projectMode??s,projects:E?.projects??o??[]}),SCIP_REINDEX_CLOJURE_CONFIG_PATH:ve?.configPath??l??"",SCIP_REINDEX_TRIGGER_KIND:u.kind,SCIP_REINDEX_TRIGGER_DETAIL:u.detail??"",SCIP_REINDEX_PROCESS_GROUP_LEADER:"1"}}}var Ue={now:C,wallNow:()=>Date.now(),setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Be=(t,e)=>qe(t,e),He=15*6e4,Ye=1e3,Ke=64*1024;function ze(){return{stdoutTail:"",stderrTail:"",stdoutTruncated:!1,stderrTruncated:!1}}function oe(t,e){let r=t instanceof Error?t.message:String(t),n=e.stderrTail.trim()||e.stdoutTail.trim();return n?`${r}
3
+ ${n}`:r}function ce(t={}){let e=t.timeoutMs??He,r=t.terminationGraceMs??Ye,n=t.maxOutputBytes??Ke,i=t.resolveLaunch??ae;return{start(s){let o=i(s),l=new AbortController,c=ze(),u=!1,d=U({command:process.execPath,args:[...process.execArgv,o.workerPath],label:"watch reindex worker",env:o.env,timeoutMs:e,terminationGraceMs:r,maxStdoutBytes:n,maxStderrBytes:n,outputLimitBehavior:"truncate-tail",signal:l.signal,detached:!0}).then(a=>{if(c={stdoutTail:a.stdout,stderrTail:a.stderr,stdoutTruncated:a.stdoutTruncated,stderrTruncated:a.stderrTruncated},a.status!==0)throw new Error(oe(new Error(`Reindex worker exited with ${a.signal?`signal ${a.signal}`:`code ${a.status}`}`),c));return a.durationMs}).catch(a=>{throw a instanceof J&&(c={stdoutTail:a.stdout,stderrTail:a.stderr,stdoutTruncated:a.stdoutTruncated,stderrTruncated:a.stderrTruncated}),new Error(oe(a,c),{cause:a})}).finally(()=>{u=!0});return{completion:d,async cancel(){u||l.abort();try{await d}catch{}return{state:"exited",diagnostics:c}},diagnostics:()=>c}}}}function se(t,e){return t?t.kind===e.kind?t.detail===e.detail?t:{kind:t.kind,detail:"multiple changes"}:{kind:"watch-git-state",detail:`${t.kind}, ${e.kind}`}:e}function Xe(t){return t instanceof Error&&"code"in t&&t.code==="EMFILE"||String(t).includes("EMFILE: too many open files")}import{existsSync as _,mkdirSync as Qe,symlinkSync as Ze,readlinkSync as le,unlinkSync as ue,readdirSync as et}from"fs";import{join as g,dirname as j,resolve as m,relative as tt,isAbsolute as rt}from"path";import{homedir as I,platform as nt}from"os";import{fileURLToPath as it}from"url";var ot=nt()==="win32",de=["_shared","scip-query","scip-setup","scip-explore","scip-plan","scip-diagnose","scip-audit","scip-improve","scip-verify"];function st(t={}){let e=t.quiet?()=>{}:console.log,r=it(import.meta.url),n=m(j(r),"..","skills"),i=[g(I(),".claude","skills"),g(I(),".codex","skills"),g(I(),".agents","skills")],s={installed:[],skipped:[],alreadyLinked:[],pruned:[]};for(let o of i){let l=j(o);if(!_(l))continue;Qe(o,{recursive:!0});let c=lt(o);at(o,n,c,s,e);for(let u of de){let d=g(n,u),a=g(o,u);if(!_(d)){s.skipped.push(`${c}/${u}`);continue}if(_(a)){try{let R=le(a);if(m(R)===m(d)){s.alreadyLinked.push(`${c}/${u}`),e(` ok: ${u} \u2192 ${c} (already linked)`);continue}}catch{s.skipped.push(`${c}/${u}`),e(` skip: ${u} \u2192 ${c} (exists, not a symlink)`);continue}ue(a)}Ze(d,a,ot?"junction":"dir"),s.installed.push(`${c}/${u}`),e(` done: ${u} \u2192 ${c}`)}}return s}function at(t,e,r,n,i){let s=new Set(de);for(let o of et(t)){if(s.has(o))continue;let l=g(t,o),c;try{c=m(j(l),le(l))}catch{continue}ct(c,e)&&(ue(l),n.pruned.push(`${r}/${o}`),i(` prune: ${o} \u2192 ${r} (removed stale scip-query skill link)`))}}function ct(t,e){let r=tt(m(e),m(t));return r===""||!r.startsWith("..")&&!rt(r)}function lt(t){return t.includes(".codex")?"Codex":t.includes(".agents")?"Agents":"Claude"}var fe="scip-query-result",ge=0,y=1,ut=1;function me(t){if(!h(t))return{kind:"malformed",reason:"CLI JSON output must be an object."};let e=Object.hasOwn(t,"kind"),r=Object.hasOwn(t,"schemaVersion");if(!e&&!r){let o=pe(t);return o?{kind:"malformed",reason:`Legacy CLI JSON envelope: ${o}`}:{kind:"legacy",schemaVersion:ge,envelope:t}}if(!e||!r)return{kind:"malformed",reason:"CLI JSON envelope must contain both kind and schemaVersion."};if(t.kind!==fe)return{kind:"malformed",reason:`Unsupported CLI JSON envelope kind: ${ft(t.kind)}.`};let n=t.schemaVersion;if(!Number.isSafeInteger(n)||Number(n)<1)return{kind:"malformed",reason:"CLI JSON envelope schemaVersion must be a positive safe integer."};if(n!==y)return{kind:"unsupported",schemaVersion:Number(n),direction:Number(n)<y?"older":"future",...he(t.producer)?{producer:t.producer}:{}};let i=pe(t);if(i)return{kind:"malformed",reason:`CLI JSON envelope v1: ${i}`};if(!he(t.producer))return{kind:"malformed",reason:"CLI JSON envelope v1: producer must identify scip-query and its non-empty version."};if(!ht(t.resultSchemaVersion))return{kind:"malformed",reason:"CLI JSON envelope v1: resultSchemaVersion must be a positive safe integer."};let s=ye(t.command);return s.includes(t.resultSchemaVersion)?{kind:"supported",schemaVersion:y,envelope:t}:{kind:"unsupported-result",schemaVersion:y,command:t.command,resultSchemaVersion:t.resultSchemaVersion,supportedResultSchemaVersions:s}}function dt(t){let e=me(t);if(e.kind==="legacy"||e.kind==="supported")return e;if(e.kind==="unsupported"){let r=e.producer?` from ${e.producer.name}@${e.producer.version}`:"";throw new Error(`Unsupported scip-query CLI JSON schemaVersion ${e.schemaVersion}${r}; this consumer supports the legacy unversioned envelope and schemaVersion ${y}.`)}throw e.kind==="unsupported-result"?new Error(`Unsupported resultSchemaVersion ${e.resultSchemaVersion} for scip-query command ${JSON.stringify(e.command)}; this consumer supports ${e.supportedResultSchemaVersions.join(", ")}.`):new Error(`Malformed scip-query CLI JSON envelope: ${e.reason}`)}function ye(t){return pt[t]??[ut]}var pt={};function pe(t){return typeof t.command!="string"||t.command.length===0?"command must be a non-empty string.":Array.isArray(t.args)?h(t.options)?Object.hasOwn(t,"result")?null:"result is required.":"options must be an object.":"args must be an array."}function he(t){return h(t)&&t.name==="scip-query"&&typeof t.version=="string"&&t.version.length>0}function ht(t){return Number.isSafeInteger(t)&&Number(t)>0}function ft(t){return typeof t=="string"?JSON.stringify(t):String(t)}export{fe as CLI_JSON_ENVELOPE_KIND,y as CURRENT_CLI_JSON_ENVELOPE_SCHEMA_VERSION,ge as LEGACY_CLI_JSON_ENVELOPE_SCHEMA_VERSION,T as Watcher,ce as createReindexRunner,me as decodeCliJsonEnvelope,Ce as getScipVersion,Ae as initProjectConfig,st as installSkills,Re as isScipInstalled,P as loadProjectConfig,Se as printScipInstallInstructions,dt as requireCompatibleCliJsonEnvelope,b as resolveIndexStoragePaths,ae as resolveReindexWorkerLaunch,ye as supportedCliResultSchemaVersions};
3
4
  //# sourceMappingURL=runtime.js.map
@@ -1,2 +1,2 @@
1
- import"./chunk-P5XHIJHI.js";import{a as b,b as v}from"./chunk-KHE7J5ZN.js";import{a as w,g as k}from"./chunk-HGFDYOVB.js";import d from"process";import{closeSync as ee,mkdirSync as y,openSync as re,readFileSync as O,readdirSync as ne,rmSync as h,writeFileSync as te}from"fs";import{dirname as se,resolve as c}from"path";import{pathToFileURL as oe}from"url";import{spawn as x}from"child_process";import{createHash as B,randomUUID as W}from"crypto";import{existsSync as L,mkdirSync as ge,readFileSync as he,realpathSync as Ee,rmSync as Ie}from"fs";import{tmpdir as _e}from"os";import{resolve as ke}from"path";var T=2;var g=class{constructor(r,n=z){this.createRequester=r;this.applyEnvironment=n}createRequester;applyEnvironment;requester=null;identityKey=null;semanticResponseCache=null;handle(r){this.applyEnvironment(r.workerEnvironment??{});let n;if(this.requester?this.identityKey!==r.identityKey?(this.semanticResponseCache=null,this.requester.shutdown(),this.requester=this.createRequester(),this.identityKey=r.identityKey,n="invalidated"):n="reused":(this.requester=this.createRequester(),this.identityKey=r.identityKey,n="created"),r.kind==="semantic"){let s=j(r.request),o=n==="reused"&&s!==null&&this.semanticResponseCache?.identityKey===r.identityKey&&this.semanticResponseCache.requestKey===s?this.semanticResponseCache.response:null;if(o)return M(!0,r.request.definitions.length),{session:n,response:o};let a=this.requester.requestSemantic(r.request,r.timeoutMs);return s!==null&&F(a)&&(this.semanticResponseCache={identityKey:r.identityKey,requestKey:s,response:a}),M(!1,r.request.definitions.length),{session:n,response:a}}return{session:n,response:this.requester.requestImportDefinitions(r.request,r.timeoutMs)}}shutdown(){this.requester?.shutdown(),this.requester=null,this.identityKey=null,this.semanticResponseCache=null}};function j(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:r,...n}=e;return $(I(n))}function F(e){return e.available&&Array.isArray(e.callees)&&(e.incompleteReferenceSymbolIds?.length??0)===0}function M(e,r){w()&&k({type:"span",name:"rust.semantic.durable-session.response-cache",durationMs:0,ok:!0,hit:e,definitions:r})}function z(e){for(let r of Object.keys(process.env))Y(r)&&delete process.env[r];for(let[r,n]of Object.entries(e))n!==null&&(process.env[r]=n)}function K(e){return e==="HOME"||e==="PATH"||e.startsWith("CARGO_")||e.startsWith("RA_")||e.startsWith("RUST")}function Y(e){return K(e)||e.startsWith("SCIP_RUST_")||e==="SCIP_QUERY_PROFILE"||e==="SCIP_QUERY_PROFILE_CACHE_STATE"||e==="SCIP_QUERY_PROFILE_COMMAND"||e==="SCIP_QUERY_PROFILE_OUT"||e==="SCIP_QUERY_PROFILE_RUN_ID"||e==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY"||e==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY_KIND"||e==="SCIP_QUERY_PROFILE_MIN_MS"}var Ae={now:Date.now,randomId:W,isProcessAlive:b,spawnServer(e,r,n){if(!L(e))throw new Error(`Durable Rust semantic session helper was not found at ${e}. Run npm run build first.`);x(process.execPath,[e,r,n],{detached:!0,stdio:"ignore"}).unref()},sleep(e){let r=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(r,0,0,e)}};function I(e){return Array.isArray(e)?`[${e.map(I).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>`${JSON.stringify(r)}:${I(n)}`).join(",")}}`:JSON.stringify(e)}function $(e){return B("sha256").update(e).digest("hex")}import{existsSync as H,mkdtempSync as A,readFileSync as C,rmSync as D}from"fs";import{tmpdir as q}from"os";import{join as _}from"path";import{fileURLToPath as P,pathToFileURL as V}from"url";import{SHARE_ENV as J,Worker as Q}from"worker_threads";function U(e={}){let r=null,n=null,s=1,o=!1,a=()=>{n&&(D(n,{recursive:!0,force:!0}),n=null)},f=()=>{let t=r;r=null,t&&t.terminate(),a()},u=()=>{if(r)return r;let t=e.semanticWorkerPath?V(e.semanticWorkerPath):Z();if(!H(P(t)))throw new Error(`Rust semantic session worker was not found at ${P(t)}. Run npm run build before using built semantic Rust queries.`);return n=A(_(q(),"scip-query-rust-session-")),r=new Q(t,e.shareEnvironment?{env:J}:void 0),r.unref(),r},l=()=>{let t=n??A(_(q(),"scip-query-rust-session-"));return n=t,_(t,`${s++}.json`)};return{requestSemantic(t,i){if(o)throw new Error("Rust semantic session was already disposed.");let R=u(),p=l(),S=new SharedArrayBuffer(4),E=new Int32Array(S);if(R.postMessage({kind:"semantic",request:t,responsePath:p,sharedBuffer:S}),Atomics.wait(E,0,0,i)==="timed-out")throw f(),new Error(`Rust semantic session worker timed out after ${(i/1e3).toFixed(0)}s`);try{let m=G(C(p,"utf8"));if(!m.ok)throw new Error(m.error);return m.response}finally{D(p,{force:!0})}},requestImportDefinitions(t,i){if(o)throw new Error("Rust semantic session was already disposed.");let R=u(),p=l(),S=new SharedArrayBuffer(4),E=new Int32Array(S);if(R.postMessage({kind:"import-definitions",request:t,responsePath:p,sharedBuffer:S}),Atomics.wait(E,0,0,i)==="timed-out")throw f(),new Error(`Rust semantic import-definition session worker timed out after ${(i/1e3).toFixed(0)}s`);try{let m=X(C(p,"utf8"));if(!m.ok)throw new Error(m.error);return m.response}finally{D(p,{force:!0})}},shutdown(){if(o)return;if(o=!0,!r){a();return}let t=l(),i=new SharedArrayBuffer(4),R=new Int32Array(i);r.postMessage({kind:"shutdown",responsePath:t,sharedBuffer:i}),Atomics.wait(R,0,0,5e3),f()}}}function G(e){let r=JSON.parse(e);if(!r||typeof r!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let n=r;return n.ok===!0&&"response"in n?{ok:!0,response:n.response}:{ok:!1,error:typeof r.error=="string"?r.error:"Rust semantic session worker failed."}}function X(e){let r=JSON.parse(e);if(!r||typeof r!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let n=r;return n.ok===!0&&"response"in n?{ok:!0,response:n.response}:{ok:!1,error:typeof r.error=="string"?r.error:"Rust semantic session worker failed."}}function Z(){return new URL("./rust-semantic-session-worker.js",import.meta.url)}var ie=10*6e4,ae=10,ue=1e3;function le(e,r,n={}){let s=c(e,"requests"),o=c(e,"responses");y(s,{recursive:!0}),y(o,{recursive:!0});let a=0;for(let f of ne(s).filter(u=>u.endsWith(".json")).sort()){let u=c(s,f),l=null;try{l=fe(O(u,"utf8")),n.beforeRequest?.(l.request);let t=r.handle(l.request);v(c(o,`${l.id}.json`),{ok:!0,...t})}catch(t){let i=l?.id??f.slice(0,-5);v(c(o,`${i}.json`),{ok:!1,error:t instanceof Error?t.message:String(t)})}finally{h(u,{force:!0}),a+=1}}return a}async function ce(e,r){y(c(e,"requests"),{recursive:!0}),y(c(e,"responses"),{recursive:!0});let n=c(e,"server.lock");if(!Re(n))return;let s=new g(()=>U({semanticWorkerPath:r,shareEnvironment:!0})),o=!1,a=Date.now(),f=0,u,l=()=>{o=!0};d.once("SIGINT",l),d.once("SIGTERM",l);let t=(i=!1)=>{let R=Date.now();!i&&R-f<ue||(f=R,v(c(e,"server.json"),{protocolVersion:T,pid:d.pid,heartbeatAtMs:R,...u===void 0?{}:{busyUntilMs:u}}))};try{t(!0);let i=pe();for(;!o&&Date.now()-a<i;)le(e,s,{beforeRequest(p){u=Date.now()+p.timeoutMs+5e3,t(!0)}})>0?(a=Date.now(),u=void 0,t(!0)):t(),await me(ae)}finally{s.shutdown(),h(c(e,"server.json"),{force:!0}),h(n,{force:!0})}}function Re(e){y(se(e),{recursive:!0});for(let r=0;r<2;r+=1)try{let n=re(e,"wx");return te(n,String(d.pid)),ee(n),!0}catch{let n=de(e);if(n!==null&&b(n))return!1;h(e,{force:!0})}return!1}function de(e){try{let r=Number(O(e,"utf8"));return Number.isInteger(r)&&r>0?r:null}catch{return null}}function fe(e){let r=JSON.parse(e);if(typeof r.id!="string"||!r.request||typeof r.request!="object")throw new Error("Durable Rust semantic helper received an invalid mailbox request.");return{id:r.id,request:r.request}}function pe(){let e=Number(d.env.SCIP_RUST_SEMANTIC_DURABLE_IDLE_MS);return Number.isInteger(e)&&e>=0?e:ie}function me(e){return new Promise(r=>setTimeout(r,e))}var Se=d.argv[1]?oe(c(d.argv[1])).href:null;if(Se===import.meta.url){let e=d.argv[2],r=d.argv[3];!e||!r?(console.error("durable-rust-session: expected <session-dir> <semantic-worker-path>"),d.exitCode=1):await ce(e,r)}export{le as processDurableRustSessionRequests};
1
+ import"./chunk-P5XHIJHI.js";import{A as Z,B as ee,D as ne,a as D,c as V,d as I,e as P,f as z,i as E,j as k,l as $,q as Q,r as A,s as _,t as N,u as B,v as U,w as J,y as X,z as G}from"./chunk-X4FR5BZF.js";import{a as Y,g as H}from"./chunk-HGFDYOVB.js";import{a as g}from"./chunk-APMMR5Y2.js";import{b as C,g as v}from"./chunk-46XGSFNI.js";import p from"process";import{randomUUID as Ue}from"crypto";import{rmSync as Oe}from"fs";import{resolve as T}from"path";import{pathToFileURL as Le}from"url";import{spawn as ge}from"child_process";import{createHash as Me,randomUUID as De}from"crypto";import{existsSync as he,realpathSync as Rn,rmSync as fn}from"fs";import{tmpdir as yn}from"os";import{resolve as Sn}from"path";import{createHash as fe}from"crypto";import{resolve as me}from"path";var m=3;function q(e){return fe("sha256").update(A({kind:"scip-query-durable-rust-mailbox",protocolVersion:m,sessionDir:me(e)})).digest("hex")}function W(e,n){if(!D(e)||typeof e.id!="string"||!e.id)return w("Durable Rust semantic helper received an invalid mailbox request.");if(e.id!==n.claimRequestId)return w("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 w("Durable Rust semantic helper received a partially versioned request without a protocol version.");let o=te(e.request);if(!o)return w("Durable Rust semantic helper received an invalid legacy request kind or payload.");let c=n.nowMs+Math.max(1,o.timeoutMs);return{ok:!0,compatibility:"legacy-v2",value:{mailboxVersion:_,protocolVersion:m,id:e.id,operationKey:U("rust-semantic-v2",{id:e.id,request:o}),clientId:"legacy-v2",enqueuedAtMs:n.nowMs,deadlineAtMs:c,sessionIdentity:n.sessionIdentity,request:o}}}let t=ye(e,n);if(!t.ok)return t;if(e.protocolVersion!==m)return{ok:!1,code:"unsupported-protocol",error:`Durable Rust semantic helper does not support mailbox protocol ${String(e.protocolVersion)}.`,responseIdentity:t.responseIdentity};let i=te(e.request);return i?t.operationKey!==U("rust-semantic-v3",i)?{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received a mismatched mailbox operation identity.",responseIdentity:t.responseIdentity}:t.deadlineAtMs-t.enqueuedAtMs!==i.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:_,protocolVersion:m,id:e.id,operationKey:t.operationKey,clientId:t.clientId,enqueuedAtMs:t.enqueuedAtMs,deadlineAtMs:t.deadlineAtMs,sessionIdentity:n.sessionIdentity,request:i}}:{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received an invalid request kind or payload.",responseIdentity:t.responseIdentity}}function ye(e,n){if(e.mailboxVersion!==_||typeof e.protocolVersion!="number"||!Number.isInteger(e.protocolVersion)||typeof e.operationKey!="string"||!re(e.operationKey)||e.id!==J(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"||!re(e.sessionIdentity))||e.sessionIdentity===void 0&&e.protocolVersion!==m)return w("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 te(e){return!D(e)||typeof e.identityKey!="string"||!e.identityKey||!P(e.timeoutMs)||e.workerEnvironment!==void 0&&!V(e.workerEnvironment)?null:e.kind==="semantic"&&be(e.request)?{kind:"semantic",identityKey:e.identityKey,...e.workerEnvironment===void 0?{}:{workerEnvironment:e.workerEnvironment},request:e.request,timeoutMs:e.timeoutMs}:e.kind==="import-definitions"&&Se(e.request)?{kind:"import-definitions",identityKey:e.identityKey,...e.workerEnvironment===void 0?{}:{workerEnvironment:e.workerEnvironment},request:e.request,timeoutMs:e.timeoutMs}:null}function be(e){return!D(e)||!h(e.projectRoot)||!h(e.rustAnalyzerBinary)||!oe(e.definitions)?!1:O(e.referenceDefinitions)&&O(e.calleeDefinitions)&&O(e.signatureDefinitions)&&b(e.requestTimeoutMs)&&b(e.readinessDeadlineMs)&&b(e.referenceRetryTimeoutMs)&&b(e.diagnosticsTimeoutMs)&&b(e.settleDelayMs)&&ie(e.concurrency)&&L(e.includeReferences)&&L(e.includeCallees)&&L(e.includeSignatures)}function Se(e){return!D(e)||!h(e.projectRoot)||!h(e.rustAnalyzerBinary)||!h(e.file)||!Array.isArray(e.positions)||!e.positions.every(n=>D(n)&&h(n.id)&&h(n.file)&&I(n.line)&&I(n.column))?!1:b(e.requestTimeoutMs)&&b(e.readinessDeadlineMs)&&b(e.diagnosticsTimeoutMs)&&b(e.settleDelayMs)&&ie(e.concurrency)}function oe(e){return Array.isArray(e)&&e.every(Ie)}function O(e){return e===void 0||oe(e)}function Ie(e){return D(e)&&I(e.symbolId)&&I(e.documentId)&&I(e.startLine)&&se(e.startChar)&&I(e.endLine)&&se(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 w(e){return{ok:!1,code:"malformed-request",error:e}}function re(e){return/^[a-f0-9]{64}$/.test(e)}function h(e){return typeof e=="string"&&e.length>0}function ie(e){return e===void 0||P(e)}function se(e){return e===void 0||I(e)}function b(e){return e===void 0||z(e)}function L(e){return e===void 0||typeof e=="boolean"}var x=class{constructor(n,t=ke){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 i=Ee(n.request),o=t==="reused"&&i!==null&&this.semanticResponseCache?.identityKey===n.identityKey&&this.semanticResponseCache.requestKey===i?this.semanticResponseCache.response:null;if(o)return ae(!0,n.request.definitions.length),{session:t,response:o};let c=this.requester.requestSemantic(n.request,n.timeoutMs);return i!==null&&we(c)&&(this.semanticResponseCache={identityKey:n.identityKey,requestKey:i,response:c}),ae(!1,n.request.definitions.length),{session:t,response:c}}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 Ee(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 qe(A(t))}function we(e){return e.available&&Array.isArray(e.callees)&&(e.incompleteReferenceSymbolIds?.length??0)===0}function ae(e,n){Y()&&H({type:"span",name:"rust.semantic.durable-session.response-cache",durationMs:0,ok:!0,hit:e,definitions:n})}function ke(e){for(let n of Object.keys(process.env))_e(n)&&delete process.env[n];for(let[n,t]of Object.entries(e))t!==null&&(process.env[n]=t)}function Ae(e){return e==="HOME"||e==="PATH"||e.startsWith("CARGO_")||e.startsWith("RA_")||e.startsWith("RUST")}function _e(e){return Ae(e)||e.startsWith("SCIP_RUST_")||e==="SCIP_QUERY_PROFILE"||e==="SCIP_QUERY_PROFILE_CACHE_STATE"||e==="SCIP_QUERY_PROFILE_COMMAND"||e==="SCIP_QUERY_PROFILE_OUT"||e==="SCIP_QUERY_PROFILE_RUN_ID"||e==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY"||e==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY_KIND"||e==="SCIP_QUERY_PROFILE_MIN_MS"}var En={now:Date.now,monotonicNow:g,randomId:De,isProcessAlive:k,readProcessIdentity:E,spawnServer(e,n,t){if(!he(e))throw new Error(`Durable Rust semantic session helper was not found at ${e}. Run npm run build first.`);ge(process.execPath,[e,n,t],{detached:!0,stdio:"ignore"}).unref()},sleep(e){let n=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(n,0,0,e)}};function qe(e){return Me("sha256").update(e).digest("hex")}import{existsSync as xe,mkdtempSync as ue,rmSync as F}from"fs";import{tmpdir as le}from"os";import{join as K}from"path";import{fileURLToPath as de,pathToFileURL as Te}from"url";import{SHARE_ENV as Ce,Worker as ve}from"worker_threads";function ce(e={}){let n=null,t=null,i=1,o=!1,c=()=>{t&&(F(t,{recursive:!0,force:!0}),t=null)},S=()=>{let r=n;n=null,r&&r.terminate(),c()},M=()=>{if(n)return n;let r=e.semanticWorkerPath?Te(e.semanticWorkerPath):Be();if(!xe(de(r)))throw new Error(`Rust semantic session worker was not found at ${de(r)}. Run npm run build before using built semantic Rust queries.`);return t=ue(K(le(),"scip-query-rust-session-")),n=new ve(r,e.shareEnvironment?{env:Ce}:void 0),n.unref(),n},y=()=>{let r=t??ue(K(le(),"scip-query-rust-session-"));return t=r,K(r,`${i++}.json`)};return{requestSemantic(r,s){if(o)throw new Error("Rust semantic session was already disposed.");let f=M(),l=y(),u=new SharedArrayBuffer(4),R=new Int32Array(u);if(f.postMessage({kind:"semantic",request:r,responsePath:l,sharedBuffer:u}),Atomics.wait(R,0,0,s)==="timed-out")throw S(),new Error(`Rust semantic session worker timed out after ${(s/1e3).toFixed(0)}s`);try{let a=Pe(v(l,{maxBytes:C,inputKind:"Rust semantic worker response"}));if(!a.ok)throw new Error(a.error);return a.response}finally{F(l,{force:!0})}},requestImportDefinitions(r,s){if(o)throw new Error("Rust semantic session was already disposed.");let f=M(),l=y(),u=new SharedArrayBuffer(4),R=new Int32Array(u);if(f.postMessage({kind:"import-definitions",request:r,responsePath:l,sharedBuffer:u}),Atomics.wait(R,0,0,s)==="timed-out")throw S(),new Error(`Rust semantic import-definition session worker timed out after ${(s/1e3).toFixed(0)}s`);try{let a=Ne(v(l,{maxBytes:C,inputKind:"Rust import-definition worker response"}));if(!a.ok)throw new Error(a.error);return a.response}finally{F(l,{force:!0})}},shutdown(){if(o)return;if(o=!0,!n){c();return}let r=y(),s=new SharedArrayBuffer(4),f=new Int32Array(s);n.postMessage({kind:"shutdown",responsePath:r,sharedBuffer:s}),Atomics.wait(f,0,0,5e3),S()}}}function Pe(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 Ne(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 Be(){return new URL("./rust-semantic-session-worker.js",import.meta.url)}var We=10*6e4,Fe=10,Ke=1e3;function je(e,n,t={}){let i=N(e);B(i);let o=t.now??(t.nowMs===void 0?Date.now:()=>t.nowMs),c=o(),S=q(e),M=X(i,{ownerId:t.ownerId??Xe,nowMs:c,limits:t.limits,owner:Ge,liveness:Ze}),y=0;for(let r of M){let s=null,f,l="handler-error";try{let u=G(r,t.limits),R;try{R=JSON.parse(u)}catch{throw l="malformed-request",new Error("Durable Rust semantic helper received malformed request JSON.")}let d=W(R,{claimRequestId:r.requestId,sessionIdentity:S,nowMs:o()});if(!d.ok)throw l=d.code,f=d.responseIdentity,new Error(d.error);s=d.value,f={id:s.id,sessionIdentity:s.sessionIdentity,deadlineAtMs:s.deadlineAtMs};let a=Ve(s.request,t.monotonicNowMs??g());t.beforeRequest?.(a);let Re=n.handle(a),j=o();if(s.deadlineAtMs<j)throw l="expired-request",new Error("Durable Rust semantic request expired while the helper was processing it.");Z(i,r,{ok:!0,protocolVersion:m,id:s.id,sessionIdentity:s.sessionIdentity,deadlineAtMs:s.deadlineAtMs,...Re},{nowMs:j,limits:t.limits})}catch(u){let R=o(),d=f??(s?{id:s.id,sessionIdentity:s.sessionIdentity,deadlineAtMs:s.deadlineAtMs}:void 0),a=u instanceof Error?u.message:String(u);ee(i,r,{ok:!1,protocolVersion:m,id:d?.id??r.requestId,...d?{sessionIdentity:d.sessionIdentity,deadlineAtMs:d.deadlineAtMs}:{},errorCode:l,error:a},a,{nowMs:R,limits:t.limits})}y+=1}return y}function Ve(e,n){let t=n+Math.max(1,e.timeoutMs-1e3);return{...e,request:{...e.request,readinessDeadlineMs:t}}}async function ze(e,n){let t=N(e);B(t);let i=T(e,"server.lock"),o=He(i);if(!o)return;let c=new x(()=>ce({semanticWorkerPath:n,shareEnvironment:!0})),S=!1,M=g(),y=Number.NEGATIVE_INFINITY,r,s=E(p.pid),f=q(e),l=()=>{S=!0};p.once("SIGINT",l),p.once("SIGTERM",l);let u=(R=!1)=>{let d=Date.now(),a=g();!R&&a-y<Ke||(y=a,Q(T(e,"server.json"),{protocolVersion:m,sessionIdentity:f,pid:p.pid,...s?{processIdentity:s}:{},heartbeatAtMs:d,...r===void 0?{}:{busyUntilMs:r},mailbox:ne(t)}))};try{u(!0);let R=$e();for(;!S&&g()-M<R;)je(e,c,{beforeRequest(a){r=Date.now()+a.timeoutMs+5e3,u(!0)}})>0?(M=g(),r=void 0,u(!0)):u(),await Qe(Fe)}finally{c.shutdown(),Oe(T(e,"server.json"),{force:!0}),o.release()}}var Ye=e=>{let n=Number(e);return Number.isInteger(n)&&n>0?{pid:n}:null};function He(e){let n=$(e,{kind:"rust-durable-session-server",parseLegacy:Ye});return n.kind==="acquired"?n.lock:null}function $e(){let e=Number(p.env.SCIP_RUST_SEMANTIC_DURABLE_IDLE_MS);return Number.isInteger(e)&&e>=0?e:We}function Qe(e){return new Promise(n=>setTimeout(n,e))}var Je=p.argv[1]?Le(T(p.argv[1])).href:null;if(Je===import.meta.url){let e=p.argv[2],n=p.argv[3];!e||!n?(console.error("durable-rust-session: expected <session-dir> <semantic-worker-path>"),p.exitCode=1):await ze(e,n)}var Xe=`rust-semantic-${p.pid}-${Ue()}`,pe=E(p.pid),Ge={pid:p.pid,...pe?{processIdentity:pe}:{}},Ze={isProcessAlive:k,readProcessIdentity:E};export{He as acquireDurableRustSessionServerLock,je as processDurableRustSessionRequests};
2
2
  //# sourceMappingURL=rust-semantic-session-server.js.map
@@ -1,2 +1,2 @@
1
- import{A as ue,B as de,C as b,D as S,a as q,b as ee,c as A,d as G,e as N,f as F,g as B,h as E,i as ne,j as te,k as ie,l as se,n as j,o as H,p as U,q as W,r as re,u as ae,v as oe,w as le,x as ce,y as k}from"./chunk-D4U5Q3FT.js";import{a as O,f as d,g as D}from"./chunk-HGFDYOVB.js";import _ from"process";import{existsSync as pe,readFileSync as we,writeFileSync as Pe}from"fs";import{isAbsolute as De,resolve as K}from"path";import{performance as L}from"perf_hooks";import{parentPort as ke}from"worker_threads";var be="SCIP_RUST_SEMANTIC_REFERENCE_TASK_PROFILE_MS",Se="SCIP_RUST_SEMANTIC_CALLEE_TASK_PROFILE_MS",P=new Map,fe=Promise.resolve();ke?.on("message",e=>{fe=fe.then(()=>Te(e)).catch(()=>{})});async function Te(e){if(e.kind==="shutdown"){await We(),g(e.responsePath,{ok:!0},e.sharedBuffer);return}if(e.kind==="import-definitions"){try{let t=await ze(e.request);g(e.responsePath,{ok:!0,response:t},e.sharedBuffer)}catch(t){let i=B(t);if(i){g(e.responsePath,i,e.sharedBuffer);return}let n={available:!1,reason:t instanceof Error?t.message:String(t),sourcePaths:e.request.positions.map(r=>[r.id,null])};g(e.responsePath,{ok:!0,response:n},e.sharedBuffer)}return}try{let t=await ve(e.request);g(e.responsePath,{ok:!0,response:t},e.sharedBuffer)}catch(t){let i=B(t);if(i){g(e.responsePath,i,e.sharedBuffer);return}let n=ye(e.request,t instanceof Error?t.message:String(t));g(e.responsePath,{ok:!0,response:n},e.sharedBuffer)}}async function ze(e){let t={timeoutMs:e.requestTimeoutMs,deadlineMs:e.readinessDeadlineMs},i=await d("rust.semantic.worker.session",()=>Re(e.projectRoot,e.rustAnalyzerBinary,[e.file],{requestTimeoutMs:e.requestTimeoutMs,readinessDeadlineMs:e.readinessDeadlineMs}),()=>({kind:"import-definitions",files:1,positions:e.positions.length}));if(!i.capabilities.definitionProvider)return{available:!1,reason:"rust-analyzer initialized without textDocument/definition support.",sourcePaths:e.positions.map(o=>[o.id,null])};let n=0;await F(()=>d("rust.semantic.worker.open-source-documents",async()=>{n=await Ae(i,e.projectRoot,[e.file],{diagnosticsTimeoutMs:e.diagnosticsTimeoutMs,settleDelayMs:e.settleDelayMs,readinessDeadlineMs:e.readinessDeadlineMs})},()=>({files:1,openedDocuments:n,positions:e.positions.length})),()=>ge(P,i,e.readinessDeadlineMs));let r=0;return{available:!0,sourcePaths:await d("rust.semantic.worker.import-definitions",()=>S(e.positions,e.concurrency??8,async o=>{let c=await i.client.definition({textDocument:{uri:E(e.projectRoot,o.file)},position:{line:o.line,character:o.column}},t),f=Fe(e.projectRoot,c);return f&&(r+=1),[o.id,f]}),()=>({positions:e.positions.length,resolvedPositions:r,concurrency:e.concurrency??8}))}}async function ve(e){let t={timeoutMs:e.requestTimeoutMs,deadlineMs:e.readinessDeadlineMs},i=e.includeReferences!==!1,n=e.includeCallees===!0,r=e.includeSignatures===!0,a=j(e),o=H(e),c=U(e),f=W(e),l=await d("rust.semantic.worker.session",()=>Ie(e),()=>({kind:"semantic",definitions:f.length,referenceDefinitions:a.length,calleeDefinitions:o.length,signatureDefinitions:c.length,references:i,callees:n,signatures:r})),p=Ee(l.capabilities,{references:i,callees:n,signatures:r});if(p)return ye(e,p);let u=0;await F(()=>d("rust.semantic.worker.open-definition-documents",async()=>{u=await Ce(l,e)},()=>({definitions:f.length,openedDocuments:u})),()=>ge(P,l,e.readinessDeadlineMs));let m=0,M=0,y=O(),J=y?new Map:null,T=y?me(_.env[be]):null,V=()=>i?d("rust.semantic.worker.references",()=>S(a,e.concurrency??8,async s=>{let w=y?L.now():0,h=await ue(l.client,te(e.projectRoot,s,!1),{requestTimeoutMs:e.requestTimeoutMs,retryTimeoutMs:e.referenceRetryTimeoutMs,deadlineMs:e.readinessDeadlineMs}),R=se(ie(e.projectRoot,h.locations)),C=y?Math.round(L.now()-w):0;return _e(J,s.relativePath,{durationMs:C,references:R.length,hasReferences:R.length>0,slow:T!==null&&C>=T}),T!==null&&C>=T&&D({type:"span",name:"rust.semantic.worker.reference-task",durationMs:C,ok:!0,symbolId:s.symbolId,relativePath:s.relativePath,leaf:s.leaf,kind:s.kind,startLine:s.startLine,endLine:s.endLine,references:R.length,complete:h.complete}),R.length>0&&(M+=1),m+=R.length,{symbolId:s.symbolId,references:R,complete:h.complete}}),()=>({definitions:a.length,concurrency:e.concurrency??8,definitionsWithReferences:M,references:m})):Promise.resolve(a.map(s=>({symbolId:s.symbolId,references:[],complete:!0}))),Q=0,X=0,z=O(),Y=z?new Map:null,v=z?me(_.env[Se]):null,Z=()=>n?d("rust.semantic.worker.callees",()=>S(o,e.concurrency??8,async s=>{let w=z?L.now():0,h=await de(l.client,e.projectRoot,s,t),R=z?Math.round(L.now()-w):0;return Ge(Y,s.relativePath,{durationMs:R,callees:h.length,hasCallees:h.length>0,slow:v!==null&&R>=v}),v!==null&&R>=v&&D({type:"span",name:"rust.semantic.worker.callee-task",durationMs:R,ok:!0,symbolId:s.symbolId,relativePath:s.relativePath,leaf:s.leaf,kind:s.kind,startLine:s.startLine,endLine:s.endLine,callees:h.length}),h.length>0&&(X+=1),Q+=h.length,{symbolId:s.symbolId,callees:h}}),()=>({definitions:o.length,concurrency:e.concurrency??8,definitionsWithCallees:X,callees:Q})):Promise.resolve([]),I,x;i&&n&&a.length>0&&o.length>0&&je()?[I,x]=await Promise.all([V(),Z()]):(I=await V(),x=await Z()),xe(J),Ne(Y);let $=0,Me=r?await d("rust.semantic.worker.signatures",()=>S(c,e.concurrency??8,async s=>{let w=await re(l.client,e.projectRoot,s,t);return w&&($+=1),{symbolId:s.symbolId,signature:w}}),()=>({definitions:c.length,concurrency:e.concurrency??8,signaturesFound:$})):[];return{available:!0,references:I.filter(s=>s.complete).map(s=>[s.symbolId,s.references]),incompleteReferenceSymbolIds:I.filter(s=>!s.complete).map(s=>s.symbolId),...n?{callees:x.map(s=>[s.symbolId,s.callees])}:{},...r?{signatures:Me.map(s=>[s.symbolId,s.signature])}:{}}}async function Ie(e){return Re(e.projectRoot,e.rustAnalyzerBinary,W(e).map(t=>t.relativePath),{requestTimeoutMs:e.requestTimeoutMs,readinessDeadlineMs:e.readinessDeadlineMs})}async function Re(e,t,i,n){let r=le(e,i.map(M=>({relativePath:M}))),a=oe(e,r),o=Le(t,a,r),c=P.get(o);if(c)return c;let f=ae(r),l=new q(ee(t,a),{requestTimeoutMs:n.requestTimeoutMs,configuration:f}),p=n.readinessDeadlineMs===void 0?null:{afterGeneration:l.serverStatusGeneration(),deadlineMs:n.readinessDeadlineMs},u=await F(()=>d("rust.semantic.worker.initialize",()=>l.initialize({processId:_.pid,rootUri:E(a,"."),capabilities:{textDocument:{references:{dynamicRegistration:!1},definition:{dynamicRegistration:!1},callHierarchy:{dynamicRegistration:!1},hover:{dynamicRegistration:!1}}},initializationOptions:f},{timeoutMs:n.requestTimeoutMs,deadlineMs:n.readinessDeadlineMs}),()=>({linkedProjects:r.length,relativePaths:i.length})),()=>l.shutdown({deadlineMs:n.readinessDeadlineMs}).catch(()=>{})),m={key:o,client:l,capabilities:u.capabilities,openedPaths:new Set,initializationReadiness:p};return P.set(o,m),m}async function Ce(e,t){let i=W(t).filter(l=>e.openedPaths.has(l.relativePath)?!1:pe(K(t.projectRoot,l.relativePath)));if(i.length===0)return await he(e),0;let n=e.initializationReadiness,r=t.readinessDeadlineMs===void 0?null:{statusSnapshot:n?null:e.client.serverStatusSnapshot(),initializationGeneration:n?.afterGeneration,deadlineMs:t.readinessDeadlineMs},a=ce(e.client,t.projectRoot,i);for(let l of i)e.openedPaths.add(l.relativePath);let o=t.diagnosticsTimeoutMs??1e4,c=o;await d("rust.semantic.worker.diagnostics",()=>r?N(l=>(c=l,k(e.client,a,l)),o,r.deadlineMs):k(e.client,a,o),()=>({openedDocuments:a.length,timeoutMs:c}));let f=t.settleDelayMs??5e3;if(!r)await d("rust.semantic.worker.settle",()=>b(f),()=>({openedDocuments:a.length,settleDelayMs:f}));else{let l;await d("rust.semantic.worker.readiness",async()=>{let p=m=>d("rust.semantic.worker.settle",()=>b(m),()=>({openedDocuments:a.length,settleDelayMs:m})),u=r.initializationGeneration===void 0?await G(e.client,r.statusSnapshot,a.length,r.deadlineMs,f,Date.now,p):await A(e.client,r.initializationGeneration,a.length,r.deadlineMs,f,Date.now,p);r.initializationGeneration!==void 0&&(e.initializationReadiness=null),l=u?.health},()=>({phase:r.initializationGeneration===void 0?"didOpen":"initialize+didOpen",openedDocuments:a.length,health:l}))}return a.length}async function Ae(e,t,i,n){let r=i.filter(u=>e.openedPaths.has(u)?!1:pe(K(t,u)));if(r.length===0)return await he(e),0;let a=e.initializationReadiness,o=n.readinessDeadlineMs===void 0?null:{statusSnapshot:a?null:e.client.serverStatusSnapshot(),initializationGeneration:a?.afterGeneration,deadlineMs:n.readinessDeadlineMs},c=[];for(let u of r){let m=E(t,u);e.client.didOpenTextDocument({uri:m,languageId:"rust",version:1,text:we(K(t,u),"utf8")}),e.openedPaths.add(u),c.push(m)}let f=n.diagnosticsTimeoutMs??1e4,l=f;await d("rust.semantic.worker.diagnostics",()=>o?N(u=>(l=u,k(e.client,c,u)),f,o.deadlineMs):k(e.client,c,f),()=>({openedDocuments:c.length,timeoutMs:l}));let p=n.settleDelayMs??5e3;if(!o)await d("rust.semantic.worker.settle",()=>b(p),()=>({openedDocuments:c.length,settleDelayMs:p}));else{let u;await d("rust.semantic.worker.readiness",async()=>{let m=y=>d("rust.semantic.worker.settle",()=>b(y),()=>({openedDocuments:c.length,settleDelayMs:y})),M=o.initializationGeneration===void 0?await G(e.client,o.statusSnapshot,c.length,o.deadlineMs,p,Date.now,m):await A(e.client,o.initializationGeneration,c.length,o.deadlineMs,p,Date.now,m);o.initializationGeneration!==void 0&&(e.initializationReadiness=null),u=M?.health},()=>({phase:o.initializationGeneration===void 0?"didOpen":"initialize+didOpen",openedDocuments:c.length,health:u}))}return c.length}async function he(e){let t=e.initializationReadiness;if(!t)return;let i;await d("rust.semantic.worker.readiness",async()=>{i=(await A(e.client,t.afterGeneration,0,t.deadlineMs,0)).health,e.initializationReadiness=null},()=>({phase:"initialize",openedDocuments:0,health:i}))}function Fe(e,t){for(let i of t){let n=ne(e,i.uri);if(!(!n||n===".."||n.startsWith("../")||De(n)))return n}return null}function Ee(e,t){return t.references&&!e.referencesProvider?"rust-analyzer initialized without textDocument/references support.":t.callees&&!e.callHierarchyProvider?"rust-analyzer initialized without call hierarchy support.":t.signatures&&!e.hoverProvider?"rust-analyzer initialized without hover support.":null}function ye(e,t){let i=j(e),n=H(e),r=U(e);return{available:!1,reason:t,references:i.map(a=>[a.symbolId,[]]),...e.includeCallees?{callees:n.map(a=>[a.symbolId,[]])}:{},...e.includeSignatures?{signatures:r.map(a=>[a.symbolId,null])}:{}}}async function We(){let e=[...P.values()];P.clear(),await Promise.all(e.map(t=>t.client.shutdown().catch(()=>{})))}async function ge(e,t,i){e.get(t.key)===t&&e.delete(t.key),await t.client.shutdown({deadlineMs:i}).catch(()=>{})}function Le(e,t,i){return JSON.stringify({binary:e,sessionRoot:t,linkedProjects:i})}function _e(e,t,i){if(!e)return;let n=Oe(e,t);n.definitions+=1,i.hasReferences&&(n.definitionsWithReferences+=1),n.references+=i.references,n.durationMs+=i.durationMs,n.maxDurationMs=Math.max(n.maxDurationMs,i.durationMs),i.slow&&(n.slowTasks+=1)}function xe(e){if(!e)return;let t=[...e.entries()].sort(([i,n],[r,a])=>a.durationMs-n.durationMs||i.localeCompare(r));for(let[i,n]of t)D({type:"span",name:"rust.semantic.worker.references.by-file",durationMs:n.durationMs,ok:!0,relativePath:i,definitions:n.definitions,definitionsWithReferences:n.definitionsWithReferences,references:n.references,maxDurationMs:n.maxDurationMs,slowTasks:n.slowTasks,aggregate:"sum-task-duration"})}function Oe(e,t){let i=e.get(t);if(i)return i;let n={definitions:0,definitionsWithReferences:0,references:0,durationMs:0,maxDurationMs:0,slowTasks:0};return e.set(t,n),n}function Ge(e,t,i){if(!e)return;let n=Be(e,t);n.definitions+=1,i.hasCallees&&(n.definitionsWithCallees+=1),n.callees+=i.callees,n.durationMs+=i.durationMs,n.maxDurationMs=Math.max(n.maxDurationMs,i.durationMs),i.slow&&(n.slowTasks+=1)}function Ne(e){if(!e)return;let t=[...e.entries()].sort(([i,n],[r,a])=>a.durationMs-n.durationMs||i.localeCompare(r));for(let[i,n]of t)D({type:"span",name:"rust.semantic.worker.callees.by-file",durationMs:n.durationMs,ok:!0,relativePath:i,definitions:n.definitions,definitionsWithCallees:n.definitionsWithCallees,callees:n.callees,maxDurationMs:n.maxDurationMs,slowTasks:n.slowTasks,aggregate:"sum-task-duration"})}function Be(e,t){let i=e.get(t);if(i)return i;let n={definitions:0,definitionsWithCallees:0,callees:0,durationMs:0,maxDurationMs:0,slowTasks:0};return e.set(t,n),n}function me(e){if(e===void 0||e==="")return null;let t=Number(e);return Number.isInteger(t)&&t>=0?t:null}function je(){let e=_.env.SCIP_RUST_SEMANTIC_PARALLEL_OPERATIONS;return e!=="0"&&e!=="false"}function g(e,t,i){Pe(e,JSON.stringify(t));let n=new Int32Array(i);Atomics.store(n,0,1),Atomics.notify(n,0)}export{ge as discardRustAnalyzerSession};
1
+ import{A as de,B as fe,C as b,D as S,a as ee,b as ne,c as A,d as j,e as G,f as F,g as N,h as E,i as te,j as ie,k as se,l as re,n as B,o as H,p as U,q as W,r as ae,u as oe,v as le,w as ce,x as ue,y as k}from"./chunk-A2TNXAXO.js";import{l as $,m as q}from"./chunk-C5Q44Q5D.js";import{a as O,f as u,g as D}from"./chunk-HGFDYOVB.js";import"./chunk-APMMR5Y2.js";import"./chunk-46XGSFNI.js";import _ from"process";import{existsSync as we,writeFileSync as Pe}from"fs";import{isAbsolute as De,resolve as ke}from"path";import{performance as L}from"perf_hooks";import{parentPort as be}from"worker_threads";var Se="SCIP_RUST_SEMANTIC_REFERENCE_TASK_PROFILE_MS",Te="SCIP_RUST_SEMANTIC_CALLEE_TASK_PROFILE_MS",P=new Map,me=Promise.resolve();be?.on("message",e=>{me=me.then(()=>ze(e)).catch(()=>{})});async function ze(e){if(e.kind==="shutdown"){await Le(),g(e.responsePath,{ok:!0},e.sharedBuffer);return}if(e.kind==="import-definitions"){try{let t=await ve(e.request);g(e.responsePath,{ok:!0,response:t},e.sharedBuffer)}catch(t){let i=N(t);if(i){g(e.responsePath,i,e.sharedBuffer);return}let n={available:!1,reason:t instanceof Error?t.message:String(t),sourcePaths:e.request.positions.map(r=>[r.id,null])};g(e.responsePath,{ok:!0,response:n},e.sharedBuffer)}return}try{let t=await Ie(e.request);g(e.responsePath,{ok:!0,response:t},e.sharedBuffer)}catch(t){let i=N(t);if(i){g(e.responsePath,i,e.sharedBuffer);return}let n=ye(e.request,t instanceof Error?t.message:String(t));g(e.responsePath,{ok:!0,response:n},e.sharedBuffer)}}async function ve(e){let t={timeoutMs:e.requestTimeoutMs,deadlineMs:e.readinessDeadlineMs},i=await u("rust.semantic.worker.session",()=>Re(e.projectRoot,e.rustAnalyzerBinary,[e.file],{requestTimeoutMs:e.requestTimeoutMs,readinessDeadlineMs:e.readinessDeadlineMs}),()=>({kind:"import-definitions",files:1,positions:e.positions.length}));if(!i.capabilities.definitionProvider)return{available:!1,reason:"rust-analyzer initialized without textDocument/definition support.",sourcePaths:e.positions.map(o=>[o.id,null])};let n=0;await F(()=>u("rust.semantic.worker.open-source-documents",async()=>{n=await Fe(i,e.projectRoot,[e.file],{diagnosticsTimeoutMs:e.diagnosticsTimeoutMs,settleDelayMs:e.settleDelayMs,readinessDeadlineMs:e.readinessDeadlineMs})},()=>({files:1,openedDocuments:n,positions:e.positions.length})),()=>ge(P,i,e.readinessDeadlineMs));let r=0;return{available:!0,sourcePaths:await u("rust.semantic.worker.import-definitions",()=>S(e.positions,e.concurrency??8,async o=>{let c=await i.client.definition({textDocument:{uri:E(e.projectRoot,o.file)},position:{line:o.line,character:o.column}},t),f=Ee(e.projectRoot,c);return f&&(r+=1),[o.id,f]}),()=>({positions:e.positions.length,resolvedPositions:r,concurrency:e.concurrency??8}))}}async function Ie(e){let t={timeoutMs:e.requestTimeoutMs,deadlineMs:e.readinessDeadlineMs},i=e.includeReferences!==!1,n=e.includeCallees===!0,r=e.includeSignatures===!0,a=B(e),o=H(e),c=U(e),f=W(e),l=await u("rust.semantic.worker.session",()=>Ce(e),()=>({kind:"semantic",definitions:f.length,referenceDefinitions:a.length,calleeDefinitions:o.length,signatureDefinitions:c.length,references:i,callees:n,signatures:r})),p=We(l.capabilities,{references:i,callees:n,signatures:r});if(p)return ye(e,p);let d=0;await F(()=>u("rust.semantic.worker.open-definition-documents",async()=>{d=await Ae(l,e)},()=>({definitions:f.length,openedDocuments:d})),()=>ge(P,l,e.readinessDeadlineMs));let m=0,M=0,y=O(),K=y?new Map:null,T=y?pe(_.env[Se]):null,J=()=>i?u("rust.semantic.worker.references",()=>S(a,e.concurrency??8,async s=>{let w=y?L.now():0,h=await de(l.client,ie(e.projectRoot,s,!1),{requestTimeoutMs:e.requestTimeoutMs,retryTimeoutMs:e.referenceRetryTimeoutMs,deadlineMs:e.readinessDeadlineMs}),R=re(se(e.projectRoot,h.locations)),C=y?Math.round(L.now()-w):0;return xe(K,s.relativePath,{durationMs:C,references:R.length,hasReferences:R.length>0,slow:T!==null&&C>=T}),T!==null&&C>=T&&D({type:"span",name:"rust.semantic.worker.reference-task",durationMs:C,ok:!0,symbolId:s.symbolId,relativePath:s.relativePath,leaf:s.leaf,kind:s.kind,startLine:s.startLine,endLine:s.endLine,references:R.length,complete:h.complete}),R.length>0&&(M+=1),m+=R.length,{symbolId:s.symbolId,references:R,complete:h.complete}}),()=>({definitions:a.length,concurrency:e.concurrency??8,definitionsWithReferences:M,references:m})):Promise.resolve(a.map(s=>({symbolId:s.symbolId,references:[],complete:!0}))),V=0,Q=0,z=O(),X=z?new Map:null,v=z?pe(_.env[Te]):null,Y=()=>n?u("rust.semantic.worker.callees",()=>S(o,e.concurrency??8,async s=>{let w=z?L.now():0,h=await fe(l.client,e.projectRoot,s,t),R=z?Math.round(L.now()-w):0;return Ge(X,s.relativePath,{durationMs:R,callees:h.length,hasCallees:h.length>0,slow:v!==null&&R>=v}),v!==null&&R>=v&&D({type:"span",name:"rust.semantic.worker.callee-task",durationMs:R,ok:!0,symbolId:s.symbolId,relativePath:s.relativePath,leaf:s.leaf,kind:s.kind,startLine:s.startLine,endLine:s.endLine,callees:h.length}),h.length>0&&(Q+=1),V+=h.length,{symbolId:s.symbolId,callees:h}}),()=>({definitions:o.length,concurrency:e.concurrency??8,definitionsWithCallees:Q,callees:V})):Promise.resolve([]),I,x;i&&n&&a.length>0&&o.length>0&&He()?[I,x]=await Promise.all([J(),Y()]):(I=await J(),x=await Y()),Oe(K),Ne(X);let Z=0,Me=r?await u("rust.semantic.worker.signatures",()=>S(c,e.concurrency??8,async s=>{let w=await ae(l.client,e.projectRoot,s,t);return w&&(Z+=1),{symbolId:s.symbolId,signature:w}}),()=>({definitions:c.length,concurrency:e.concurrency??8,signaturesFound:Z})):[];return{available:!0,references:I.filter(s=>s.complete).map(s=>[s.symbolId,s.references]),incompleteReferenceSymbolIds:I.filter(s=>!s.complete).map(s=>s.symbolId),...n?{callees:x.map(s=>[s.symbolId,s.callees])}:{},...r?{signatures:Me.map(s=>[s.symbolId,s.signature])}:{}}}async function Ce(e){return Re(e.projectRoot,e.rustAnalyzerBinary,W(e).map(t=>t.relativePath),{requestTimeoutMs:e.requestTimeoutMs,readinessDeadlineMs:e.readinessDeadlineMs})}async function Re(e,t,i,n){let r=ce(e,i.map(M=>({relativePath:M}))),a=le(e,r),o=_e(t,a,r),c=P.get(o);if(c)return c;let f=oe(r),l=new ee(ne(t,a),{requestTimeoutMs:n.requestTimeoutMs,configuration:f}),p=n.readinessDeadlineMs===void 0?null:{afterGeneration:l.serverStatusGeneration(),deadlineMs:n.readinessDeadlineMs},d=await F(()=>u("rust.semantic.worker.initialize",()=>l.initialize({processId:_.pid,rootUri:E(a,"."),capabilities:{textDocument:{references:{dynamicRegistration:!1},definition:{dynamicRegistration:!1},callHierarchy:{dynamicRegistration:!1},hover:{dynamicRegistration:!1}}},initializationOptions:f},{timeoutMs:n.requestTimeoutMs,deadlineMs:n.readinessDeadlineMs}),()=>({linkedProjects:r.length,relativePaths:i.length})),()=>l.shutdown({deadlineMs:n.readinessDeadlineMs}).catch(()=>{})),m={key:o,client:l,capabilities:d.capabilities,openedPaths:new Set,initializationReadiness:p};return P.set(o,m),m}async function Ae(e,t){let i=W(t).filter(l=>e.openedPaths.has(l.relativePath)?!1:we(ke(t.projectRoot,l.relativePath)));if(i.length===0)return await he(e),0;let n=e.initializationReadiness,r=t.readinessDeadlineMs===void 0?null:{statusSnapshot:n?null:e.client.serverStatusSnapshot(),initializationGeneration:n?.afterGeneration,deadlineMs:t.readinessDeadlineMs},a=ue(e.client,t.projectRoot,i);for(let l of i)e.openedPaths.add(l.relativePath);let o=t.diagnosticsTimeoutMs??1e4,c=o;await u("rust.semantic.worker.diagnostics",()=>r?G(l=>(c=l,k(e.client,a,l)),o,r.deadlineMs):k(e.client,a,o),()=>({openedDocuments:a.length,timeoutMs:c}));let f=t.settleDelayMs??5e3;if(!r)await u("rust.semantic.worker.settle",()=>b(f),()=>({openedDocuments:a.length,settleDelayMs:f}));else{let l;await u("rust.semantic.worker.readiness",async()=>{let p=m=>u("rust.semantic.worker.settle",()=>b(m),()=>({openedDocuments:a.length,settleDelayMs:m})),d=r.initializationGeneration===void 0?await j(e.client,r.statusSnapshot,a.length,r.deadlineMs,f,Date.now,p):await A(e.client,r.initializationGeneration,a.length,r.deadlineMs,f,Date.now,p);r.initializationGeneration!==void 0&&(e.initializationReadiness=null),l=d?.health},()=>({phase:r.initializationGeneration===void 0?"didOpen":"initialize+didOpen",openedDocuments:a.length,health:l}))}return a.length}async function Fe(e,t,i,n){let r=i.filter(d=>!e.openedPaths.has(d));if(r.length===0)return await he(e),0;let a=e.initializationReadiness,o=n.readinessDeadlineMs===void 0?null:{statusSnapshot:a?null:e.client.serverStatusSnapshot(),initializationGeneration:a?.afterGeneration,deadlineMs:n.readinessDeadlineMs},c=[];for(let d of r)try{let m=E(t,d);e.client.didOpenTextDocument({uri:m,languageId:"rust",version:1,text:$(t,d,{inputKind:"indexed Rust source file"})}),e.openedPaths.add(d),c.push(m)}catch(m){if(!q(m))throw m}let f=n.diagnosticsTimeoutMs??1e4,l=f;await u("rust.semantic.worker.diagnostics",()=>o?G(d=>(l=d,k(e.client,c,d)),f,o.deadlineMs):k(e.client,c,f),()=>({openedDocuments:c.length,timeoutMs:l}));let p=n.settleDelayMs??5e3;if(!o)await u("rust.semantic.worker.settle",()=>b(p),()=>({openedDocuments:c.length,settleDelayMs:p}));else{let d;await u("rust.semantic.worker.readiness",async()=>{let m=y=>u("rust.semantic.worker.settle",()=>b(y),()=>({openedDocuments:c.length,settleDelayMs:y})),M=o.initializationGeneration===void 0?await j(e.client,o.statusSnapshot,c.length,o.deadlineMs,p,Date.now,m):await A(e.client,o.initializationGeneration,c.length,o.deadlineMs,p,Date.now,m);o.initializationGeneration!==void 0&&(e.initializationReadiness=null),d=M?.health},()=>({phase:o.initializationGeneration===void 0?"didOpen":"initialize+didOpen",openedDocuments:c.length,health:d}))}return c.length}async function he(e){let t=e.initializationReadiness;if(!t)return;let i;await u("rust.semantic.worker.readiness",async()=>{i=(await A(e.client,t.afterGeneration,0,t.deadlineMs,0)).health,e.initializationReadiness=null},()=>({phase:"initialize",openedDocuments:0,health:i}))}function Ee(e,t){for(let i of t){let n=te(e,i.uri);if(!(!n||n===".."||n.startsWith("../")||De(n)))return n}return null}function We(e,t){return t.references&&!e.referencesProvider?"rust-analyzer initialized without textDocument/references support.":t.callees&&!e.callHierarchyProvider?"rust-analyzer initialized without call hierarchy support.":t.signatures&&!e.hoverProvider?"rust-analyzer initialized without hover support.":null}function ye(e,t){let i=B(e),n=H(e),r=U(e);return{available:!1,reason:t,references:i.map(a=>[a.symbolId,[]]),...e.includeCallees?{callees:n.map(a=>[a.symbolId,[]])}:{},...e.includeSignatures?{signatures:r.map(a=>[a.symbolId,null])}:{}}}async function Le(){let e=[...P.values()];P.clear(),await Promise.all(e.map(t=>t.client.shutdown().catch(()=>{})))}async function ge(e,t,i){e.get(t.key)===t&&e.delete(t.key),await t.client.shutdown({deadlineMs:i}).catch(()=>{})}function _e(e,t,i){return JSON.stringify({binary:e,sessionRoot:t,linkedProjects:i})}function xe(e,t,i){if(!e)return;let n=je(e,t);n.definitions+=1,i.hasReferences&&(n.definitionsWithReferences+=1),n.references+=i.references,n.durationMs+=i.durationMs,n.maxDurationMs=Math.max(n.maxDurationMs,i.durationMs),i.slow&&(n.slowTasks+=1)}function Oe(e){if(!e)return;let t=[...e.entries()].sort(([i,n],[r,a])=>a.durationMs-n.durationMs||i.localeCompare(r));for(let[i,n]of t)D({type:"span",name:"rust.semantic.worker.references.by-file",durationMs:n.durationMs,ok:!0,relativePath:i,definitions:n.definitions,definitionsWithReferences:n.definitionsWithReferences,references:n.references,maxDurationMs:n.maxDurationMs,slowTasks:n.slowTasks,aggregate:"sum-task-duration"})}function je(e,t){let i=e.get(t);if(i)return i;let n={definitions:0,definitionsWithReferences:0,references:0,durationMs:0,maxDurationMs:0,slowTasks:0};return e.set(t,n),n}function Ge(e,t,i){if(!e)return;let n=Be(e,t);n.definitions+=1,i.hasCallees&&(n.definitionsWithCallees+=1),n.callees+=i.callees,n.durationMs+=i.durationMs,n.maxDurationMs=Math.max(n.maxDurationMs,i.durationMs),i.slow&&(n.slowTasks+=1)}function Ne(e){if(!e)return;let t=[...e.entries()].sort(([i,n],[r,a])=>a.durationMs-n.durationMs||i.localeCompare(r));for(let[i,n]of t)D({type:"span",name:"rust.semantic.worker.callees.by-file",durationMs:n.durationMs,ok:!0,relativePath:i,definitions:n.definitions,definitionsWithCallees:n.definitionsWithCallees,callees:n.callees,maxDurationMs:n.maxDurationMs,slowTasks:n.slowTasks,aggregate:"sum-task-duration"})}function Be(e,t){let i=e.get(t);if(i)return i;let n={definitions:0,definitionsWithCallees:0,callees:0,durationMs:0,maxDurationMs:0,slowTasks:0};return e.set(t,n),n}function pe(e){if(e===void 0||e==="")return null;let t=Number(e);return Number.isInteger(t)&&t>=0?t:null}function He(){let e=_.env.SCIP_RUST_SEMANTIC_PARALLEL_OPERATIONS;return e!=="0"&&e!=="false"}function g(e,t,i){Pe(e,JSON.stringify(t));let n=new Int32Array(i);Atomics.store(n,0,1),Atomics.notify(n,0)}export{ge as discardRustAnalyzerSession};
2
2
  //# sourceMappingURL=rust-semantic-session-worker.js.map
@@ -1,2 +1,2 @@
1
- import{A as o,B as p,C as q,D as r,m as a,n as b,o as c,p as d,q as e,r as f,s as g,t as h,u as i,v as j,w as k,x as l,y as m,z as n}from"./chunk-D4U5Q3FT.js";export{p as calleesForDefinition,k as cargoManifestsForDefinitions,h as hoverToRustSignature,g as hoverWithRetry,l as openDefinitionDocuments,o as referencesWithCompletion,n as referencesWithRetry,a as runRustAnalyzerReferenceBatch,r as runWithConcurrency,i as rustAnalyzerInitializationOptions,j as rustAnalyzerSessionRoot,c as rustRequestCalleeDefinitions,b as rustRequestReferenceDefinitions,e as rustRequestSessionDefinitions,d as rustRequestSignatureDefinitions,f as signatureForDefinition,q as sleep,m as waitForOpenedDocuments};
1
+ import{A as o,B as p,C as q,D as r,m as a,n as b,o as c,p as d,q as e,r as f,s as g,t as h,u as i,v as j,w as k,x as l,y as m,z as n}from"./chunk-A2TNXAXO.js";import"./chunk-C5Q44Q5D.js";import"./chunk-APMMR5Y2.js";import"./chunk-46XGSFNI.js";export{p as calleesForDefinition,k as cargoManifestsForDefinitions,h as hoverToRustSignature,g as hoverWithRetry,l as openDefinitionDocuments,o as referencesWithCompletion,n as referencesWithRetry,a as runRustAnalyzerReferenceBatch,r as runWithConcurrency,i as rustAnalyzerInitializationOptions,j as rustAnalyzerSessionRoot,c as rustRequestCalleeDefinitions,b as rustRequestReferenceDefinitions,e as rustRequestSessionDefinitions,d as rustRequestSignatureDefinitions,f as signatureForDefinition,q as sleep,m as waitForOpenedDocuments};
2
2
  //# sourceMappingURL=rust-semantic-worker.js.map
@@ -1,4 +1,4 @@
1
- import { a as SupportedLanguage } from './config-types-D20KuvvZ.js';
1
+ import { a as SupportedLanguage } from './config-types-B6MEoRNy.js';
2
2
 
3
3
  type WatcherStatus = {
4
4
  state: 'idle';
@@ -13,6 +13,10 @@ type WatcherStatus = {
13
13
  state: 'cooldown';
14
14
  until: number;
15
15
  dirty: boolean;
16
+ } | {
17
+ state: 'draining';
18
+ startedAt: number;
19
+ reason: string;
16
20
  };
17
21
  type RefreshTriggerKind = 'manual-cli' | 'setup' | 'watch-source' | 'watch-startup' | 'watch-demand' | 'watch-git-head' | 'watch-git-index' | 'watch-git-state' | 'unknown';
18
22
  interface RefreshTrigger {
@@ -48,7 +52,7 @@ declare function getScipVersion(): string | null;
48
52
  declare function printScipInstallInstructions(): void;
49
53
  /**
50
54
  * Attempt to auto-install the `scip` CLI binary.
51
- * Tries brew (macOS), then go install, then prints manual instructions.
55
+ * Uses an immutable Go module identity, then prints versioned manual instructions.
52
56
  * Returns true if installation succeeded.
53
57
  */
54
58
  declare function tryInstallScipCli(onStatus: (msg: string) => void): boolean;