@quolu/lattice 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (769) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +20 -0
  3. package/bin/lattice-mcp.mjs +134 -0
  4. package/bin/lattice.mjs +78 -0
  5. package/package.json +47 -0
  6. package/sensor/LICENSE +21 -0
  7. package/sensor/NOTICE +30 -0
  8. package/sensor/dist/bin/codegraph.d.ts +26 -0
  9. package/sensor/dist/bin/codegraph.d.ts.map +1 -0
  10. package/sensor/dist/bin/codegraph.js +2279 -0
  11. package/sensor/dist/bin/codegraph.js.map +1 -0
  12. package/sensor/dist/bin/command-supervision.d.ts +49 -0
  13. package/sensor/dist/bin/command-supervision.d.ts.map +1 -0
  14. package/sensor/dist/bin/command-supervision.js +95 -0
  15. package/sensor/dist/bin/command-supervision.js.map +1 -0
  16. package/sensor/dist/bin/fatal-handler.d.ts +20 -0
  17. package/sensor/dist/bin/fatal-handler.d.ts.map +1 -0
  18. package/sensor/dist/bin/fatal-handler.js +118 -0
  19. package/sensor/dist/bin/fatal-handler.js.map +1 -0
  20. package/sensor/dist/bin/node-version-check.d.ts +37 -0
  21. package/sensor/dist/bin/node-version-check.d.ts.map +1 -0
  22. package/sensor/dist/bin/node-version-check.js +79 -0
  23. package/sensor/dist/bin/node-version-check.js.map +1 -0
  24. package/sensor/dist/bin/uninstall.d.ts +14 -0
  25. package/sensor/dist/bin/uninstall.d.ts.map +1 -0
  26. package/sensor/dist/bin/uninstall.js +36 -0
  27. package/sensor/dist/bin/uninstall.js.map +1 -0
  28. package/sensor/dist/context/formatter.d.ts +30 -0
  29. package/sensor/dist/context/formatter.d.ts.map +1 -0
  30. package/sensor/dist/context/formatter.js +263 -0
  31. package/sensor/dist/context/formatter.js.map +1 -0
  32. package/sensor/dist/context/index.d.ts +119 -0
  33. package/sensor/dist/context/index.d.ts.map +1 -0
  34. package/sensor/dist/context/index.js +1326 -0
  35. package/sensor/dist/context/index.js.map +1 -0
  36. package/sensor/dist/context/markers.d.ts +19 -0
  37. package/sensor/dist/context/markers.d.ts.map +1 -0
  38. package/sensor/dist/context/markers.js +22 -0
  39. package/sensor/dist/context/markers.js.map +1 -0
  40. package/sensor/dist/db/index.d.ts +264 -0
  41. package/sensor/dist/db/index.d.ts.map +1 -0
  42. package/sensor/dist/db/index.js +603 -0
  43. package/sensor/dist/db/index.js.map +1 -0
  44. package/sensor/dist/db/migrations.d.ts +44 -0
  45. package/sensor/dist/db/migrations.d.ts.map +1 -0
  46. package/sensor/dist/db/migrations.js +241 -0
  47. package/sensor/dist/db/migrations.js.map +1 -0
  48. package/sensor/dist/db/queries.d.ts +563 -0
  49. package/sensor/dist/db/queries.d.ts.map +1 -0
  50. package/sensor/dist/db/queries.js +2179 -0
  51. package/sensor/dist/db/queries.js.map +1 -0
  52. package/sensor/dist/db/schema.sql +196 -0
  53. package/sensor/dist/db/sqlite-adapter.d.ts +55 -0
  54. package/sensor/dist/db/sqlite-adapter.d.ts.map +1 -0
  55. package/sensor/dist/db/sqlite-adapter.js +135 -0
  56. package/sensor/dist/db/sqlite-adapter.js.map +1 -0
  57. package/sensor/dist/db/wal-valve.d.ts +106 -0
  58. package/sensor/dist/db/wal-valve.d.ts.map +1 -0
  59. package/sensor/dist/db/wal-valve.js +208 -0
  60. package/sensor/dist/db/wal-valve.js.map +1 -0
  61. package/sensor/dist/directory.d.ts +183 -0
  62. package/sensor/dist/directory.d.ts.map +1 -0
  63. package/sensor/dist/directory.js +797 -0
  64. package/sensor/dist/directory.js.map +1 -0
  65. package/sensor/dist/errors.d.ts +136 -0
  66. package/sensor/dist/errors.d.ts.map +1 -0
  67. package/sensor/dist/errors.js +219 -0
  68. package/sensor/dist/errors.js.map +1 -0
  69. package/sensor/dist/extraction/astro-extractor.d.ts +79 -0
  70. package/sensor/dist/extraction/astro-extractor.d.ts.map +1 -0
  71. package/sensor/dist/extraction/astro-extractor.js +320 -0
  72. package/sensor/dist/extraction/astro-extractor.js.map +1 -0
  73. package/sensor/dist/extraction/cfml-extractor.d.ts +107 -0
  74. package/sensor/dist/extraction/cfml-extractor.d.ts.map +1 -0
  75. package/sensor/dist/extraction/cfml-extractor.js +494 -0
  76. package/sensor/dist/extraction/cfml-extractor.js.map +1 -0
  77. package/sensor/dist/extraction/dfm-extractor.d.ts +31 -0
  78. package/sensor/dist/extraction/dfm-extractor.d.ts.map +1 -0
  79. package/sensor/dist/extraction/dfm-extractor.js +151 -0
  80. package/sensor/dist/extraction/dfm-extractor.js.map +1 -0
  81. package/sensor/dist/extraction/dynamic-import.d.ts +82 -0
  82. package/sensor/dist/extraction/dynamic-import.d.ts.map +1 -0
  83. package/sensor/dist/extraction/dynamic-import.js +313 -0
  84. package/sensor/dist/extraction/dynamic-import.js.map +1 -0
  85. package/sensor/dist/extraction/extraction-version.d.ts +25 -0
  86. package/sensor/dist/extraction/extraction-version.d.ts.map +1 -0
  87. package/sensor/dist/extraction/extraction-version.js +28 -0
  88. package/sensor/dist/extraction/extraction-version.js.map +1 -0
  89. package/sensor/dist/extraction/function-ref.d.ts +118 -0
  90. package/sensor/dist/extraction/function-ref.d.ts.map +1 -0
  91. package/sensor/dist/extraction/function-ref.js +727 -0
  92. package/sensor/dist/extraction/function-ref.js.map +1 -0
  93. package/sensor/dist/extraction/generated-detection.d.ts +30 -0
  94. package/sensor/dist/extraction/generated-detection.d.ts.map +1 -0
  95. package/sensor/dist/extraction/generated-detection.js +83 -0
  96. package/sensor/dist/extraction/generated-detection.js.map +1 -0
  97. package/sensor/dist/extraction/grammars.d.ts +138 -0
  98. package/sensor/dist/extraction/grammars.d.ts.map +1 -0
  99. package/sensor/dist/extraction/grammars.js +648 -0
  100. package/sensor/dist/extraction/grammars.js.map +1 -0
  101. package/sensor/dist/extraction/index.d.ts +251 -0
  102. package/sensor/dist/extraction/index.d.ts.map +1 -0
  103. package/sensor/dist/extraction/index.js +2563 -0
  104. package/sensor/dist/extraction/index.js.map +1 -0
  105. package/sensor/dist/extraction/kernel/decode.d.ts +9 -0
  106. package/sensor/dist/extraction/kernel/decode.d.ts.map +1 -0
  107. package/sensor/dist/extraction/kernel/decode.js +156 -0
  108. package/sensor/dist/extraction/kernel/decode.js.map +1 -0
  109. package/sensor/dist/extraction/kernel/index.d.ts +62 -0
  110. package/sensor/dist/extraction/kernel/index.d.ts.map +1 -0
  111. package/sensor/dist/extraction/kernel/index.js +165 -0
  112. package/sensor/dist/extraction/kernel/index.js.map +1 -0
  113. package/sensor/dist/extraction/kernel/layout.d.ts +92 -0
  114. package/sensor/dist/extraction/kernel/layout.d.ts.map +1 -0
  115. package/sensor/dist/extraction/kernel/layout.js +95 -0
  116. package/sensor/dist/extraction/kernel/layout.js.map +1 -0
  117. package/sensor/dist/extraction/kernel/loader.d.ts +61 -0
  118. package/sensor/dist/extraction/kernel/loader.d.ts.map +1 -0
  119. package/sensor/dist/extraction/kernel/loader.js +146 -0
  120. package/sensor/dist/extraction/kernel/loader.js.map +1 -0
  121. package/sensor/dist/extraction/languages/arkts.d.ts +3 -0
  122. package/sensor/dist/extraction/languages/arkts.d.ts.map +1 -0
  123. package/sensor/dist/extraction/languages/arkts.js +127 -0
  124. package/sensor/dist/extraction/languages/arkts.js.map +1 -0
  125. package/sensor/dist/extraction/languages/c-cpp.d.ts +111 -0
  126. package/sensor/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  127. package/sensor/dist/extraction/languages/c-cpp.js +878 -0
  128. package/sensor/dist/extraction/languages/c-cpp.js.map +1 -0
  129. package/sensor/dist/extraction/languages/cfquery.d.ts +12 -0
  130. package/sensor/dist/extraction/languages/cfquery.d.ts.map +1 -0
  131. package/sensor/dist/extraction/languages/cfquery.js +28 -0
  132. package/sensor/dist/extraction/languages/cfquery.js.map +1 -0
  133. package/sensor/dist/extraction/languages/cfscript.d.ts +3 -0
  134. package/sensor/dist/extraction/languages/cfscript.d.ts.map +1 -0
  135. package/sensor/dist/extraction/languages/cfscript.js +73 -0
  136. package/sensor/dist/extraction/languages/cfscript.js.map +1 -0
  137. package/sensor/dist/extraction/languages/cobol.d.ts +33 -0
  138. package/sensor/dist/extraction/languages/cobol.d.ts.map +1 -0
  139. package/sensor/dist/extraction/languages/cobol.js +499 -0
  140. package/sensor/dist/extraction/languages/cobol.js.map +1 -0
  141. package/sensor/dist/extraction/languages/csharp.d.ts +25 -0
  142. package/sensor/dist/extraction/languages/csharp.d.ts.map +1 -0
  143. package/sensor/dist/extraction/languages/csharp.js +175 -0
  144. package/sensor/dist/extraction/languages/csharp.js.map +1 -0
  145. package/sensor/dist/extraction/languages/dart.d.ts +3 -0
  146. package/sensor/dist/extraction/languages/dart.d.ts.map +1 -0
  147. package/sensor/dist/extraction/languages/dart.js +374 -0
  148. package/sensor/dist/extraction/languages/dart.js.map +1 -0
  149. package/sensor/dist/extraction/languages/erlang.d.ts +3 -0
  150. package/sensor/dist/extraction/languages/erlang.d.ts.map +1 -0
  151. package/sensor/dist/extraction/languages/erlang.js +350 -0
  152. package/sensor/dist/extraction/languages/erlang.js.map +1 -0
  153. package/sensor/dist/extraction/languages/go.d.ts +3 -0
  154. package/sensor/dist/extraction/languages/go.d.ts.map +1 -0
  155. package/sensor/dist/extraction/languages/go.js +111 -0
  156. package/sensor/dist/extraction/languages/go.js.map +1 -0
  157. package/sensor/dist/extraction/languages/index.d.ts +10 -0
  158. package/sensor/dist/extraction/languages/index.d.ts.map +1 -0
  159. package/sensor/dist/extraction/languages/index.js +71 -0
  160. package/sensor/dist/extraction/languages/index.js.map +1 -0
  161. package/sensor/dist/extraction/languages/java.d.ts +3 -0
  162. package/sensor/dist/extraction/languages/java.d.ts.map +1 -0
  163. package/sensor/dist/extraction/languages/java.js +315 -0
  164. package/sensor/dist/extraction/languages/java.js.map +1 -0
  165. package/sensor/dist/extraction/languages/javascript.d.ts +3 -0
  166. package/sensor/dist/extraction/languages/javascript.d.ts.map +1 -0
  167. package/sensor/dist/extraction/languages/javascript.js +106 -0
  168. package/sensor/dist/extraction/languages/javascript.js.map +1 -0
  169. package/sensor/dist/extraction/languages/kotlin.d.ts +3 -0
  170. package/sensor/dist/extraction/languages/kotlin.d.ts.map +1 -0
  171. package/sensor/dist/extraction/languages/kotlin.js +379 -0
  172. package/sensor/dist/extraction/languages/kotlin.js.map +1 -0
  173. package/sensor/dist/extraction/languages/lua.d.ts +3 -0
  174. package/sensor/dist/extraction/languages/lua.d.ts.map +1 -0
  175. package/sensor/dist/extraction/languages/lua.js +150 -0
  176. package/sensor/dist/extraction/languages/lua.js.map +1 -0
  177. package/sensor/dist/extraction/languages/luau.d.ts +3 -0
  178. package/sensor/dist/extraction/languages/luau.d.ts.map +1 -0
  179. package/sensor/dist/extraction/languages/luau.js +37 -0
  180. package/sensor/dist/extraction/languages/luau.js.map +1 -0
  181. package/sensor/dist/extraction/languages/nix.d.ts +3 -0
  182. package/sensor/dist/extraction/languages/nix.d.ts.map +1 -0
  183. package/sensor/dist/extraction/languages/nix.js +294 -0
  184. package/sensor/dist/extraction/languages/nix.js.map +1 -0
  185. package/sensor/dist/extraction/languages/objc.d.ts +3 -0
  186. package/sensor/dist/extraction/languages/objc.d.ts.map +1 -0
  187. package/sensor/dist/extraction/languages/objc.js +175 -0
  188. package/sensor/dist/extraction/languages/objc.js.map +1 -0
  189. package/sensor/dist/extraction/languages/pascal.d.ts +3 -0
  190. package/sensor/dist/extraction/languages/pascal.d.ts.map +1 -0
  191. package/sensor/dist/extraction/languages/pascal.js +77 -0
  192. package/sensor/dist/extraction/languages/pascal.js.map +1 -0
  193. package/sensor/dist/extraction/languages/php.d.ts +3 -0
  194. package/sensor/dist/extraction/languages/php.d.ts.map +1 -0
  195. package/sensor/dist/extraction/languages/php.js +196 -0
  196. package/sensor/dist/extraction/languages/php.js.map +1 -0
  197. package/sensor/dist/extraction/languages/python.d.ts +3 -0
  198. package/sensor/dist/extraction/languages/python.d.ts.map +1 -0
  199. package/sensor/dist/extraction/languages/python.js +56 -0
  200. package/sensor/dist/extraction/languages/python.js.map +1 -0
  201. package/sensor/dist/extraction/languages/r.d.ts +3 -0
  202. package/sensor/dist/extraction/languages/r.d.ts.map +1 -0
  203. package/sensor/dist/extraction/languages/r.js +314 -0
  204. package/sensor/dist/extraction/languages/r.js.map +1 -0
  205. package/sensor/dist/extraction/languages/ruby.d.ts +3 -0
  206. package/sensor/dist/extraction/languages/ruby.d.ts.map +1 -0
  207. package/sensor/dist/extraction/languages/ruby.js +149 -0
  208. package/sensor/dist/extraction/languages/ruby.js.map +1 -0
  209. package/sensor/dist/extraction/languages/rust.d.ts +3 -0
  210. package/sensor/dist/extraction/languages/rust.d.ts.map +1 -0
  211. package/sensor/dist/extraction/languages/rust.js +142 -0
  212. package/sensor/dist/extraction/languages/rust.js.map +1 -0
  213. package/sensor/dist/extraction/languages/scala.d.ts +3 -0
  214. package/sensor/dist/extraction/languages/scala.d.ts.map +1 -0
  215. package/sensor/dist/extraction/languages/scala.js +209 -0
  216. package/sensor/dist/extraction/languages/scala.js.map +1 -0
  217. package/sensor/dist/extraction/languages/solidity.d.ts +3 -0
  218. package/sensor/dist/extraction/languages/solidity.d.ts.map +1 -0
  219. package/sensor/dist/extraction/languages/solidity.js +293 -0
  220. package/sensor/dist/extraction/languages/solidity.js.map +1 -0
  221. package/sensor/dist/extraction/languages/swift.d.ts +3 -0
  222. package/sensor/dist/extraction/languages/swift.d.ts.map +1 -0
  223. package/sensor/dist/extraction/languages/swift.js +152 -0
  224. package/sensor/dist/extraction/languages/swift.js.map +1 -0
  225. package/sensor/dist/extraction/languages/terraform.d.ts +3 -0
  226. package/sensor/dist/extraction/languages/terraform.d.ts.map +1 -0
  227. package/sensor/dist/extraction/languages/terraform.js +641 -0
  228. package/sensor/dist/extraction/languages/terraform.js.map +1 -0
  229. package/sensor/dist/extraction/languages/typescript.d.ts +16 -0
  230. package/sensor/dist/extraction/languages/typescript.d.ts.map +1 -0
  231. package/sensor/dist/extraction/languages/typescript.js +167 -0
  232. package/sensor/dist/extraction/languages/typescript.js.map +1 -0
  233. package/sensor/dist/extraction/languages/vbnet.d.ts +11 -0
  234. package/sensor/dist/extraction/languages/vbnet.d.ts.map +1 -0
  235. package/sensor/dist/extraction/languages/vbnet.js +141 -0
  236. package/sensor/dist/extraction/languages/vbnet.js.map +1 -0
  237. package/sensor/dist/extraction/liquid-extractor.d.ts +59 -0
  238. package/sensor/dist/extraction/liquid-extractor.d.ts.map +1 -0
  239. package/sensor/dist/extraction/liquid-extractor.js +357 -0
  240. package/sensor/dist/extraction/liquid-extractor.js.map +1 -0
  241. package/sensor/dist/extraction/mybatis-extractor.d.ts +68 -0
  242. package/sensor/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  243. package/sensor/dist/extraction/mybatis-extractor.js +300 -0
  244. package/sensor/dist/extraction/mybatis-extractor.js.map +1 -0
  245. package/sensor/dist/extraction/parse-pool.d.ts +160 -0
  246. package/sensor/dist/extraction/parse-pool.d.ts.map +1 -0
  247. package/sensor/dist/extraction/parse-pool.js +402 -0
  248. package/sensor/dist/extraction/parse-pool.js.map +1 -0
  249. package/sensor/dist/extraction/parse-worker.d.ts +8 -0
  250. package/sensor/dist/extraction/parse-worker.d.ts.map +1 -0
  251. package/sensor/dist/extraction/parse-worker.js +138 -0
  252. package/sensor/dist/extraction/parse-worker.js.map +1 -0
  253. package/sensor/dist/extraction/razor-extractor.d.ts +42 -0
  254. package/sensor/dist/extraction/razor-extractor.d.ts.map +1 -0
  255. package/sensor/dist/extraction/razor-extractor.js +285 -0
  256. package/sensor/dist/extraction/razor-extractor.js.map +1 -0
  257. package/sensor/dist/extraction/spawn-invokes.d.ts +101 -0
  258. package/sensor/dist/extraction/spawn-invokes.d.ts.map +1 -0
  259. package/sensor/dist/extraction/spawn-invokes.js +327 -0
  260. package/sensor/dist/extraction/spawn-invokes.js.map +1 -0
  261. package/sensor/dist/extraction/store-worker.d.ts +24 -0
  262. package/sensor/dist/extraction/store-worker.d.ts.map +1 -0
  263. package/sensor/dist/extraction/store-worker.js +110 -0
  264. package/sensor/dist/extraction/store-worker.js.map +1 -0
  265. package/sensor/dist/extraction/store-writer.d.ts +63 -0
  266. package/sensor/dist/extraction/store-writer.d.ts.map +1 -0
  267. package/sensor/dist/extraction/store-writer.js +174 -0
  268. package/sensor/dist/extraction/store-writer.js.map +1 -0
  269. package/sensor/dist/extraction/svelte-extractor.d.ts +56 -0
  270. package/sensor/dist/extraction/svelte-extractor.d.ts.map +1 -0
  271. package/sensor/dist/extraction/svelte-extractor.js +275 -0
  272. package/sensor/dist/extraction/svelte-extractor.js.map +1 -0
  273. package/sensor/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  274. package/sensor/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  275. package/sensor/dist/extraction/tree-sitter-helpers.js +153 -0
  276. package/sensor/dist/extraction/tree-sitter-helpers.js.map +1 -0
  277. package/sensor/dist/extraction/tree-sitter-types.d.ts +258 -0
  278. package/sensor/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  279. package/sensor/dist/extraction/tree-sitter-types.js +10 -0
  280. package/sensor/dist/extraction/tree-sitter-types.js.map +1 -0
  281. package/sensor/dist/extraction/tree-sitter.d.ts +724 -0
  282. package/sensor/dist/extraction/tree-sitter.d.ts.map +1 -0
  283. package/sensor/dist/extraction/tree-sitter.js +6721 -0
  284. package/sensor/dist/extraction/tree-sitter.js.map +1 -0
  285. package/sensor/dist/extraction/vue-extractor.d.ts +51 -0
  286. package/sensor/dist/extraction/vue-extractor.d.ts.map +1 -0
  287. package/sensor/dist/extraction/vue-extractor.js +254 -0
  288. package/sensor/dist/extraction/vue-extractor.js.map +1 -0
  289. package/sensor/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
  290. package/sensor/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  291. package/sensor/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  292. package/sensor/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  293. package/sensor/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  294. package/sensor/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  295. package/sensor/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  296. package/sensor/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  297. package/sensor/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  298. package/sensor/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  299. package/sensor/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  300. package/sensor/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  301. package/sensor/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  302. package/sensor/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  303. package/sensor/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  304. package/sensor/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  305. package/sensor/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  306. package/sensor/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
  307. package/sensor/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  308. package/sensor/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  309. package/sensor/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  310. package/sensor/dist/extraction/wasm-runtime-flags.d.ts +53 -0
  311. package/sensor/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  312. package/sensor/dist/extraction/wasm-runtime-flags.js +130 -0
  313. package/sensor/dist/extraction/wasm-runtime-flags.js.map +1 -0
  314. package/sensor/dist/graph/index.d.ts +8 -0
  315. package/sensor/dist/graph/index.d.ts.map +1 -0
  316. package/sensor/dist/graph/index.js +13 -0
  317. package/sensor/dist/graph/index.js.map +1 -0
  318. package/sensor/dist/graph/queries.d.ts +106 -0
  319. package/sensor/dist/graph/queries.d.ts.map +1 -0
  320. package/sensor/dist/graph/queries.js +339 -0
  321. package/sensor/dist/graph/queries.js.map +1 -0
  322. package/sensor/dist/graph/traversal.d.ts +127 -0
  323. package/sensor/dist/graph/traversal.d.ts.map +1 -0
  324. package/sensor/dist/graph/traversal.js +599 -0
  325. package/sensor/dist/graph/traversal.js.map +1 -0
  326. package/sensor/dist/index.d.ts +653 -0
  327. package/sensor/dist/index.d.ts.map +1 -0
  328. package/sensor/dist/index.js +1646 -0
  329. package/sensor/dist/index.js.map +1 -0
  330. package/sensor/dist/installer/beta-signup.d.ts +54 -0
  331. package/sensor/dist/installer/beta-signup.d.ts.map +1 -0
  332. package/sensor/dist/installer/beta-signup.js +178 -0
  333. package/sensor/dist/installer/beta-signup.js.map +1 -0
  334. package/sensor/dist/installer/config-writer.d.ts +28 -0
  335. package/sensor/dist/installer/config-writer.d.ts.map +1 -0
  336. package/sensor/dist/installer/config-writer.js +91 -0
  337. package/sensor/dist/installer/config-writer.js.map +1 -0
  338. package/sensor/dist/installer/index.d.ts +142 -0
  339. package/sensor/dist/installer/index.d.ts.map +1 -0
  340. package/sensor/dist/installer/index.js +622 -0
  341. package/sensor/dist/installer/index.js.map +1 -0
  342. package/sensor/dist/installer/instructions-template.d.ts +41 -0
  343. package/sensor/dist/installer/instructions-template.d.ts.map +1 -0
  344. package/sensor/dist/installer/instructions-template.js +53 -0
  345. package/sensor/dist/installer/instructions-template.js.map +1 -0
  346. package/sensor/dist/installer/targets/antigravity.d.ts +57 -0
  347. package/sensor/dist/installer/targets/antigravity.d.ts.map +1 -0
  348. package/sensor/dist/installer/targets/antigravity.js +308 -0
  349. package/sensor/dist/installer/targets/antigravity.js.map +1 -0
  350. package/sensor/dist/installer/targets/claude.d.ts +62 -0
  351. package/sensor/dist/installer/targets/claude.d.ts.map +1 -0
  352. package/sensor/dist/installer/targets/claude.js +454 -0
  353. package/sensor/dist/installer/targets/claude.js.map +1 -0
  354. package/sensor/dist/installer/targets/codex.d.ts +18 -0
  355. package/sensor/dist/installer/targets/codex.d.ts.map +1 -0
  356. package/sensor/dist/installer/targets/codex.js +185 -0
  357. package/sensor/dist/installer/targets/codex.js.map +1 -0
  358. package/sensor/dist/installer/targets/cursor.d.ts +35 -0
  359. package/sensor/dist/installer/targets/cursor.d.ts.map +1 -0
  360. package/sensor/dist/installer/targets/cursor.js +254 -0
  361. package/sensor/dist/installer/targets/cursor.js.map +1 -0
  362. package/sensor/dist/installer/targets/gemini.d.ts +26 -0
  363. package/sensor/dist/installer/targets/gemini.d.ts.map +1 -0
  364. package/sensor/dist/installer/targets/gemini.js +165 -0
  365. package/sensor/dist/installer/targets/gemini.js.map +1 -0
  366. package/sensor/dist/installer/targets/hermes.d.ts +18 -0
  367. package/sensor/dist/installer/targets/hermes.d.ts.map +1 -0
  368. package/sensor/dist/installer/targets/hermes.js +359 -0
  369. package/sensor/dist/installer/targets/hermes.js.map +1 -0
  370. package/sensor/dist/installer/targets/kiro.d.ts +27 -0
  371. package/sensor/dist/installer/targets/kiro.d.ts.map +1 -0
  372. package/sensor/dist/installer/targets/kiro.js +178 -0
  373. package/sensor/dist/installer/targets/kiro.js.map +1 -0
  374. package/sensor/dist/installer/targets/opencode.d.ts +38 -0
  375. package/sensor/dist/installer/targets/opencode.d.ts.map +1 -0
  376. package/sensor/dist/installer/targets/opencode.js +288 -0
  377. package/sensor/dist/installer/targets/opencode.js.map +1 -0
  378. package/sensor/dist/installer/targets/registry.d.ts +35 -0
  379. package/sensor/dist/installer/targets/registry.d.ts.map +1 -0
  380. package/sensor/dist/installer/targets/registry.js +91 -0
  381. package/sensor/dist/installer/targets/registry.js.map +1 -0
  382. package/sensor/dist/installer/targets/shared.d.ts +101 -0
  383. package/sensor/dist/installer/targets/shared.d.ts.map +1 -0
  384. package/sensor/dist/installer/targets/shared.js +264 -0
  385. package/sensor/dist/installer/targets/shared.js.map +1 -0
  386. package/sensor/dist/installer/targets/toml.d.ts +52 -0
  387. package/sensor/dist/installer/targets/toml.d.ts.map +1 -0
  388. package/sensor/dist/installer/targets/toml.js +147 -0
  389. package/sensor/dist/installer/targets/toml.js.map +1 -0
  390. package/sensor/dist/installer/targets/types.d.ts +108 -0
  391. package/sensor/dist/installer/targets/types.d.ts.map +1 -0
  392. package/sensor/dist/installer/targets/types.js +16 -0
  393. package/sensor/dist/installer/targets/types.js.map +1 -0
  394. package/sensor/dist/mcp/daemon-manager.d.ts +42 -0
  395. package/sensor/dist/mcp/daemon-manager.d.ts.map +1 -0
  396. package/sensor/dist/mcp/daemon-manager.js +129 -0
  397. package/sensor/dist/mcp/daemon-manager.js.map +1 -0
  398. package/sensor/dist/mcp/daemon-paths.d.ts +73 -0
  399. package/sensor/dist/mcp/daemon-paths.d.ts.map +1 -0
  400. package/sensor/dist/mcp/daemon-paths.js +170 -0
  401. package/sensor/dist/mcp/daemon-paths.js.map +1 -0
  402. package/sensor/dist/mcp/daemon-registry.d.ts +54 -0
  403. package/sensor/dist/mcp/daemon-registry.d.ts.map +1 -0
  404. package/sensor/dist/mcp/daemon-registry.js +241 -0
  405. package/sensor/dist/mcp/daemon-registry.js.map +1 -0
  406. package/sensor/dist/mcp/daemon.d.ts +290 -0
  407. package/sensor/dist/mcp/daemon.d.ts.map +1 -0
  408. package/sensor/dist/mcp/daemon.js +867 -0
  409. package/sensor/dist/mcp/daemon.js.map +1 -0
  410. package/sensor/dist/mcp/dynamic-boundaries.d.ts +41 -0
  411. package/sensor/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  412. package/sensor/dist/mcp/dynamic-boundaries.js +360 -0
  413. package/sensor/dist/mcp/dynamic-boundaries.js.map +1 -0
  414. package/sensor/dist/mcp/early-ppid.d.ts +26 -0
  415. package/sensor/dist/mcp/early-ppid.d.ts.map +1 -0
  416. package/sensor/dist/mcp/early-ppid.js +29 -0
  417. package/sensor/dist/mcp/early-ppid.js.map +1 -0
  418. package/sensor/dist/mcp/engine.d.ts +130 -0
  419. package/sensor/dist/mcp/engine.d.ts.map +1 -0
  420. package/sensor/dist/mcp/engine.js +375 -0
  421. package/sensor/dist/mcp/engine.js.map +1 -0
  422. package/sensor/dist/mcp/index.d.ts +113 -0
  423. package/sensor/dist/mcp/index.d.ts.map +1 -0
  424. package/sensor/dist/mcp/index.js +551 -0
  425. package/sensor/dist/mcp/index.js.map +1 -0
  426. package/sensor/dist/mcp/liveness-watchdog.d.ts +35 -0
  427. package/sensor/dist/mcp/liveness-watchdog.d.ts.map +1 -0
  428. package/sensor/dist/mcp/liveness-watchdog.js +267 -0
  429. package/sensor/dist/mcp/liveness-watchdog.js.map +1 -0
  430. package/sensor/dist/mcp/ppid-watchdog.d.ts +62 -0
  431. package/sensor/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  432. package/sensor/dist/mcp/ppid-watchdog.js +64 -0
  433. package/sensor/dist/mcp/ppid-watchdog.js.map +1 -0
  434. package/sensor/dist/mcp/proxy.d.ts +99 -0
  435. package/sensor/dist/mcp/proxy.d.ts.map +1 -0
  436. package/sensor/dist/mcp/proxy.js +737 -0
  437. package/sensor/dist/mcp/proxy.js.map +1 -0
  438. package/sensor/dist/mcp/query-pool.d.ts +108 -0
  439. package/sensor/dist/mcp/query-pool.d.ts.map +1 -0
  440. package/sensor/dist/mcp/query-pool.js +315 -0
  441. package/sensor/dist/mcp/query-pool.js.map +1 -0
  442. package/sensor/dist/mcp/query-worker.d.ts +24 -0
  443. package/sensor/dist/mcp/query-worker.d.ts.map +1 -0
  444. package/sensor/dist/mcp/query-worker.js +87 -0
  445. package/sensor/dist/mcp/query-worker.js.map +1 -0
  446. package/sensor/dist/mcp/server-instructions.d.ts +34 -0
  447. package/sensor/dist/mcp/server-instructions.d.ts.map +1 -0
  448. package/sensor/dist/mcp/server-instructions.js +106 -0
  449. package/sensor/dist/mcp/server-instructions.js.map +1 -0
  450. package/sensor/dist/mcp/session.d.ts +92 -0
  451. package/sensor/dist/mcp/session.d.ts.map +1 -0
  452. package/sensor/dist/mcp/session.js +355 -0
  453. package/sensor/dist/mcp/session.js.map +1 -0
  454. package/sensor/dist/mcp/startup-handshake.d.ts +44 -0
  455. package/sensor/dist/mcp/startup-handshake.d.ts.map +1 -0
  456. package/sensor/dist/mcp/startup-handshake.js +73 -0
  457. package/sensor/dist/mcp/startup-handshake.js.map +1 -0
  458. package/sensor/dist/mcp/stdin-teardown.d.ts +27 -0
  459. package/sensor/dist/mcp/stdin-teardown.d.ts.map +1 -0
  460. package/sensor/dist/mcp/stdin-teardown.js +49 -0
  461. package/sensor/dist/mcp/stdin-teardown.js.map +1 -0
  462. package/sensor/dist/mcp/tools.d.ts +651 -0
  463. package/sensor/dist/mcp/tools.d.ts.map +1 -0
  464. package/sensor/dist/mcp/tools.js +4574 -0
  465. package/sensor/dist/mcp/tools.js.map +1 -0
  466. package/sensor/dist/mcp/transport.d.ts +188 -0
  467. package/sensor/dist/mcp/transport.d.ts.map +1 -0
  468. package/sensor/dist/mcp/transport.js +377 -0
  469. package/sensor/dist/mcp/transport.js.map +1 -0
  470. package/sensor/dist/mcp/version.d.ts +30 -0
  471. package/sensor/dist/mcp/version.d.ts.map +1 -0
  472. package/sensor/dist/mcp/version.js +85 -0
  473. package/sensor/dist/mcp/version.js.map +1 -0
  474. package/sensor/dist/project-config.d.ts +94 -0
  475. package/sensor/dist/project-config.d.ts.map +1 -0
  476. package/sensor/dist/project-config.js +374 -0
  477. package/sensor/dist/project-config.js.map +1 -0
  478. package/sensor/dist/resolution/c-fnptr-synthesizer.d.ts +6 -0
  479. package/sensor/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
  480. package/sensor/dist/resolution/c-fnptr-synthesizer.js +1070 -0
  481. package/sensor/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
  482. package/sensor/dist/resolution/callback-synthesizer.d.ts +59 -0
  483. package/sensor/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  484. package/sensor/dist/resolution/callback-synthesizer.js +3961 -0
  485. package/sensor/dist/resolution/callback-synthesizer.js.map +1 -0
  486. package/sensor/dist/resolution/cooperative-yield.d.ts +40 -0
  487. package/sensor/dist/resolution/cooperative-yield.d.ts.map +1 -0
  488. package/sensor/dist/resolution/cooperative-yield.js +44 -0
  489. package/sensor/dist/resolution/cooperative-yield.js.map +1 -0
  490. package/sensor/dist/resolution/frameworks/astro.d.ts +9 -0
  491. package/sensor/dist/resolution/frameworks/astro.d.ts.map +1 -0
  492. package/sensor/dist/resolution/frameworks/astro.js +169 -0
  493. package/sensor/dist/resolution/frameworks/astro.js.map +1 -0
  494. package/sensor/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  495. package/sensor/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  496. package/sensor/dist/resolution/frameworks/cargo-workspace.js +225 -0
  497. package/sensor/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  498. package/sensor/dist/resolution/frameworks/cics.d.ts +20 -0
  499. package/sensor/dist/resolution/frameworks/cics.d.ts.map +1 -0
  500. package/sensor/dist/resolution/frameworks/cics.js +90 -0
  501. package/sensor/dist/resolution/frameworks/cics.js.map +1 -0
  502. package/sensor/dist/resolution/frameworks/csharp.d.ts +8 -0
  503. package/sensor/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  504. package/sensor/dist/resolution/frameworks/csharp.js +241 -0
  505. package/sensor/dist/resolution/frameworks/csharp.js.map +1 -0
  506. package/sensor/dist/resolution/frameworks/drupal.d.ts +51 -0
  507. package/sensor/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  508. package/sensor/dist/resolution/frameworks/drupal.js +367 -0
  509. package/sensor/dist/resolution/frameworks/drupal.js.map +1 -0
  510. package/sensor/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  511. package/sensor/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  512. package/sensor/dist/resolution/frameworks/expo-modules.js +148 -0
  513. package/sensor/dist/resolution/frameworks/expo-modules.js.map +1 -0
  514. package/sensor/dist/resolution/frameworks/express.d.ts +8 -0
  515. package/sensor/dist/resolution/frameworks/express.d.ts.map +1 -0
  516. package/sensor/dist/resolution/frameworks/express.js +308 -0
  517. package/sensor/dist/resolution/frameworks/express.js.map +1 -0
  518. package/sensor/dist/resolution/frameworks/fabric.d.ts +3 -0
  519. package/sensor/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  520. package/sensor/dist/resolution/frameworks/fabric.js +354 -0
  521. package/sensor/dist/resolution/frameworks/fabric.js.map +1 -0
  522. package/sensor/dist/resolution/frameworks/go.d.ts +8 -0
  523. package/sensor/dist/resolution/frameworks/go.d.ts.map +1 -0
  524. package/sensor/dist/resolution/frameworks/go.js +184 -0
  525. package/sensor/dist/resolution/frameworks/go.js.map +1 -0
  526. package/sensor/dist/resolution/frameworks/goframe.d.ts +41 -0
  527. package/sensor/dist/resolution/frameworks/goframe.d.ts.map +1 -0
  528. package/sensor/dist/resolution/frameworks/goframe.js +112 -0
  529. package/sensor/dist/resolution/frameworks/goframe.js.map +1 -0
  530. package/sensor/dist/resolution/frameworks/index.d.ts +50 -0
  531. package/sensor/dist/resolution/frameworks/index.d.ts.map +1 -0
  532. package/sensor/dist/resolution/frameworks/index.js +175 -0
  533. package/sensor/dist/resolution/frameworks/index.js.map +1 -0
  534. package/sensor/dist/resolution/frameworks/java.d.ts +8 -0
  535. package/sensor/dist/resolution/frameworks/java.d.ts.map +1 -0
  536. package/sensor/dist/resolution/frameworks/java.js +517 -0
  537. package/sensor/dist/resolution/frameworks/java.js.map +1 -0
  538. package/sensor/dist/resolution/frameworks/laravel.d.ts +13 -0
  539. package/sensor/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  540. package/sensor/dist/resolution/frameworks/laravel.js +257 -0
  541. package/sensor/dist/resolution/frameworks/laravel.js.map +1 -0
  542. package/sensor/dist/resolution/frameworks/nestjs.d.ts +26 -0
  543. package/sensor/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  544. package/sensor/dist/resolution/frameworks/nestjs.js +698 -0
  545. package/sensor/dist/resolution/frameworks/nestjs.js.map +1 -0
  546. package/sensor/dist/resolution/frameworks/play.d.ts +19 -0
  547. package/sensor/dist/resolution/frameworks/play.d.ts.map +1 -0
  548. package/sensor/dist/resolution/frameworks/play.js +111 -0
  549. package/sensor/dist/resolution/frameworks/play.js.map +1 -0
  550. package/sensor/dist/resolution/frameworks/python.d.ts +10 -0
  551. package/sensor/dist/resolution/frameworks/python.d.ts.map +1 -0
  552. package/sensor/dist/resolution/frameworks/python.js +400 -0
  553. package/sensor/dist/resolution/frameworks/python.js.map +1 -0
  554. package/sensor/dist/resolution/frameworks/react-native.d.ts +3 -0
  555. package/sensor/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  556. package/sensor/dist/resolution/frameworks/react-native.js +410 -0
  557. package/sensor/dist/resolution/frameworks/react-native.js.map +1 -0
  558. package/sensor/dist/resolution/frameworks/react.d.ts +8 -0
  559. package/sensor/dist/resolution/frameworks/react.d.ts.map +1 -0
  560. package/sensor/dist/resolution/frameworks/react.js +334 -0
  561. package/sensor/dist/resolution/frameworks/react.js.map +1 -0
  562. package/sensor/dist/resolution/frameworks/ruby.d.ts +8 -0
  563. package/sensor/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  564. package/sensor/dist/resolution/frameworks/ruby.js +302 -0
  565. package/sensor/dist/resolution/frameworks/ruby.js.map +1 -0
  566. package/sensor/dist/resolution/frameworks/rust.d.ts +8 -0
  567. package/sensor/dist/resolution/frameworks/rust.d.ts.map +1 -0
  568. package/sensor/dist/resolution/frameworks/rust.js +304 -0
  569. package/sensor/dist/resolution/frameworks/rust.js.map +1 -0
  570. package/sensor/dist/resolution/frameworks/svelte.d.ts +9 -0
  571. package/sensor/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  572. package/sensor/dist/resolution/frameworks/svelte.js +253 -0
  573. package/sensor/dist/resolution/frameworks/svelte.js.map +1 -0
  574. package/sensor/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  575. package/sensor/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  576. package/sensor/dist/resolution/frameworks/swift-objc.js +252 -0
  577. package/sensor/dist/resolution/frameworks/swift-objc.js.map +1 -0
  578. package/sensor/dist/resolution/frameworks/swift.d.ts +10 -0
  579. package/sensor/dist/resolution/frameworks/swift.d.ts.map +1 -0
  580. package/sensor/dist/resolution/frameworks/swift.js +400 -0
  581. package/sensor/dist/resolution/frameworks/swift.js.map +1 -0
  582. package/sensor/dist/resolution/frameworks/terraform.d.ts +38 -0
  583. package/sensor/dist/resolution/frameworks/terraform.d.ts.map +1 -0
  584. package/sensor/dist/resolution/frameworks/terraform.js +277 -0
  585. package/sensor/dist/resolution/frameworks/terraform.js.map +1 -0
  586. package/sensor/dist/resolution/frameworks/vue.d.ts +9 -0
  587. package/sensor/dist/resolution/frameworks/vue.d.ts.map +1 -0
  588. package/sensor/dist/resolution/frameworks/vue.js +303 -0
  589. package/sensor/dist/resolution/frameworks/vue.js.map +1 -0
  590. package/sensor/dist/resolution/go-module.d.ts +26 -0
  591. package/sensor/dist/resolution/go-module.d.ts.map +1 -0
  592. package/sensor/dist/resolution/go-module.js +78 -0
  593. package/sensor/dist/resolution/go-module.js.map +1 -0
  594. package/sensor/dist/resolution/goframe-synthesizer.d.ts +29 -0
  595. package/sensor/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
  596. package/sensor/dist/resolution/goframe-synthesizer.js +163 -0
  597. package/sensor/dist/resolution/goframe-synthesizer.js.map +1 -0
  598. package/sensor/dist/resolution/import-resolver.d.ts +84 -0
  599. package/sensor/dist/resolution/import-resolver.d.ts.map +1 -0
  600. package/sensor/dist/resolution/import-resolver.js +2172 -0
  601. package/sensor/dist/resolution/import-resolver.js.map +1 -0
  602. package/sensor/dist/resolution/index.d.ts +309 -0
  603. package/sensor/dist/resolution/index.d.ts.map +1 -0
  604. package/sensor/dist/resolution/index.js +2050 -0
  605. package/sensor/dist/resolution/index.js.map +1 -0
  606. package/sensor/dist/resolution/lru-cache.d.ts +24 -0
  607. package/sensor/dist/resolution/lru-cache.d.ts.map +1 -0
  608. package/sensor/dist/resolution/lru-cache.js +62 -0
  609. package/sensor/dist/resolution/lru-cache.js.map +1 -0
  610. package/sensor/dist/resolution/name-matcher.d.ts +126 -0
  611. package/sensor/dist/resolution/name-matcher.d.ts.map +1 -0
  612. package/sensor/dist/resolution/name-matcher.js +1968 -0
  613. package/sensor/dist/resolution/name-matcher.js.map +1 -0
  614. package/sensor/dist/resolution/path-aliases.d.ts +68 -0
  615. package/sensor/dist/resolution/path-aliases.d.ts.map +1 -0
  616. package/sensor/dist/resolution/path-aliases.js +238 -0
  617. package/sensor/dist/resolution/path-aliases.js.map +1 -0
  618. package/sensor/dist/resolution/resolver-pool.d.ts +66 -0
  619. package/sensor/dist/resolution/resolver-pool.d.ts.map +1 -0
  620. package/sensor/dist/resolution/resolver-pool.js +244 -0
  621. package/sensor/dist/resolution/resolver-pool.js.map +1 -0
  622. package/sensor/dist/resolution/resolver-worker.d.ts +17 -0
  623. package/sensor/dist/resolution/resolver-worker.d.ts.map +1 -0
  624. package/sensor/dist/resolution/resolver-worker.js +114 -0
  625. package/sensor/dist/resolution/resolver-worker.js.map +1 -0
  626. package/sensor/dist/resolution/strip-comments.d.ts +27 -0
  627. package/sensor/dist/resolution/strip-comments.d.ts.map +1 -0
  628. package/sensor/dist/resolution/strip-comments.js +492 -0
  629. package/sensor/dist/resolution/strip-comments.js.map +1 -0
  630. package/sensor/dist/resolution/swift-objc-bridge.d.ts +134 -0
  631. package/sensor/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  632. package/sensor/dist/resolution/swift-objc-bridge.js +256 -0
  633. package/sensor/dist/resolution/swift-objc-bridge.js.map +1 -0
  634. package/sensor/dist/resolution/types.d.ts +265 -0
  635. package/sensor/dist/resolution/types.d.ts.map +1 -0
  636. package/sensor/dist/resolution/types.js +8 -0
  637. package/sensor/dist/resolution/types.js.map +1 -0
  638. package/sensor/dist/resolution/workspace-packages.d.ts +58 -0
  639. package/sensor/dist/resolution/workspace-packages.d.ts.map +1 -0
  640. package/sensor/dist/resolution/workspace-packages.js +346 -0
  641. package/sensor/dist/resolution/workspace-packages.js.map +1 -0
  642. package/sensor/dist/search/identifier-segments.d.ts +60 -0
  643. package/sensor/dist/search/identifier-segments.d.ts.map +1 -0
  644. package/sensor/dist/search/identifier-segments.js +176 -0
  645. package/sensor/dist/search/identifier-segments.js.map +1 -0
  646. package/sensor/dist/search/query-parser.d.ts +57 -0
  647. package/sensor/dist/search/query-parser.d.ts.map +1 -0
  648. package/sensor/dist/search/query-parser.js +177 -0
  649. package/sensor/dist/search/query-parser.js.map +1 -0
  650. package/sensor/dist/search/query-utils.d.ts +87 -0
  651. package/sensor/dist/search/query-utils.d.ts.map +1 -0
  652. package/sensor/dist/search/query-utils.js +449 -0
  653. package/sensor/dist/search/query-utils.js.map +1 -0
  654. package/sensor/dist/sync/git-hooks.d.ts +45 -0
  655. package/sensor/dist/sync/git-hooks.d.ts.map +1 -0
  656. package/sensor/dist/sync/git-hooks.js +227 -0
  657. package/sensor/dist/sync/git-hooks.js.map +1 -0
  658. package/sensor/dist/sync/index.d.ts +19 -0
  659. package/sensor/dist/sync/index.d.ts.map +1 -0
  660. package/sensor/dist/sync/index.js +35 -0
  661. package/sensor/dist/sync/index.js.map +1 -0
  662. package/sensor/dist/sync/watch-policy.d.ts +48 -0
  663. package/sensor/dist/sync/watch-policy.d.ts.map +1 -0
  664. package/sensor/dist/sync/watch-policy.js +124 -0
  665. package/sensor/dist/sync/watch-policy.js.map +1 -0
  666. package/sensor/dist/sync/watcher.d.ts +372 -0
  667. package/sensor/dist/sync/watcher.d.ts.map +1 -0
  668. package/sensor/dist/sync/watcher.js +879 -0
  669. package/sensor/dist/sync/watcher.js.map +1 -0
  670. package/sensor/dist/sync/worktree.d.ts +63 -0
  671. package/sensor/dist/sync/worktree.d.ts.map +1 -0
  672. package/sensor/dist/sync/worktree.js +182 -0
  673. package/sensor/dist/sync/worktree.js.map +1 -0
  674. package/sensor/dist/telemetry/index.d.ts +157 -0
  675. package/sensor/dist/telemetry/index.d.ts.map +1 -0
  676. package/sensor/dist/telemetry/index.js +556 -0
  677. package/sensor/dist/telemetry/index.js.map +1 -0
  678. package/sensor/dist/types.d.ts +458 -0
  679. package/sensor/dist/types.d.ts.map +1 -0
  680. package/sensor/dist/types.js +117 -0
  681. package/sensor/dist/types.js.map +1 -0
  682. package/sensor/dist/ui/color.d.ts +21 -0
  683. package/sensor/dist/ui/color.d.ts.map +1 -0
  684. package/sensor/dist/ui/color.js +42 -0
  685. package/sensor/dist/ui/color.js.map +1 -0
  686. package/sensor/dist/ui/glyphs.d.ts +67 -0
  687. package/sensor/dist/ui/glyphs.d.ts.map +1 -0
  688. package/sensor/dist/ui/glyphs.js +125 -0
  689. package/sensor/dist/ui/glyphs.js.map +1 -0
  690. package/sensor/dist/ui/shimmer-progress.d.ts +11 -0
  691. package/sensor/dist/ui/shimmer-progress.d.ts.map +1 -0
  692. package/sensor/dist/ui/shimmer-progress.js +164 -0
  693. package/sensor/dist/ui/shimmer-progress.js.map +1 -0
  694. package/sensor/dist/ui/shimmer-worker.d.ts +2 -0
  695. package/sensor/dist/ui/shimmer-worker.d.ts.map +1 -0
  696. package/sensor/dist/ui/shimmer-worker.js +126 -0
  697. package/sensor/dist/ui/shimmer-worker.js.map +1 -0
  698. package/sensor/dist/ui/types.d.ts +15 -0
  699. package/sensor/dist/ui/types.d.ts.map +1 -0
  700. package/sensor/dist/ui/types.js +3 -0
  701. package/sensor/dist/ui/types.js.map +1 -0
  702. package/sensor/dist/upgrade/index.d.ts +171 -0
  703. package/sensor/dist/upgrade/index.d.ts.map +1 -0
  704. package/sensor/dist/upgrade/index.js +659 -0
  705. package/sensor/dist/upgrade/index.js.map +1 -0
  706. package/sensor/dist/upgrade/remove-binary.d.ts +87 -0
  707. package/sensor/dist/upgrade/remove-binary.d.ts.map +1 -0
  708. package/sensor/dist/upgrade/remove-binary.js +289 -0
  709. package/sensor/dist/upgrade/remove-binary.js.map +1 -0
  710. package/sensor/dist/upgrade/update-check.d.ts +92 -0
  711. package/sensor/dist/upgrade/update-check.d.ts.map +1 -0
  712. package/sensor/dist/upgrade/update-check.js +258 -0
  713. package/sensor/dist/upgrade/update-check.js.map +1 -0
  714. package/sensor/dist/utils.d.ts +224 -0
  715. package/sensor/dist/utils.d.ts.map +1 -0
  716. package/sensor/dist/utils.js +583 -0
  717. package/sensor/dist/utils.js.map +1 -0
  718. package/sensor/package.json +61 -0
  719. package/src/artifact-contracts-v2.mjs +325 -0
  720. package/src/artifact-contracts.mjs +895 -0
  721. package/src/bootstrap.mjs +88 -0
  722. package/src/boundary-compiler.mjs +712 -0
  723. package/src/boundary-observation-compiler-v2.mjs +339 -0
  724. package/src/codegraph-adapter.mjs +422 -0
  725. package/src/control-compiler.mjs +532 -0
  726. package/src/factory-diagnostics.mjs +187 -0
  727. package/src/isolation-runner.mjs +333 -0
  728. package/src/node-version-guard.mjs +43 -0
  729. package/src/rc1-black-box-oracle.mjs +906 -0
  730. package/src/rc1-comparison.mjs +154 -0
  731. package/src/rc1-evidence-bundle.mjs +456 -0
  732. package/src/rc1-v4-campaign.mjs +707 -0
  733. package/src/rc1-v4-transform.mjs +467 -0
  734. package/src/rc1-v5-artifact-set.mjs +855 -0
  735. package/src/rc1-v5-behavior-evidence.mjs +594 -0
  736. package/src/rc1-v5-campaign.mjs +796 -0
  737. package/src/rc1-v5-transform.mjs +421 -0
  738. package/src/rc1-v6-artifact-set.mjs +807 -0
  739. package/src/rc1-v6-behavior-evidence.mjs +273 -0
  740. package/src/rc1-v6-campaign.mjs +623 -0
  741. package/src/rc1-v6-causal-binding.mjs +471 -0
  742. package/src/rc1-v6-measurement.mjs +331 -0
  743. package/src/rc2-artifact-set.mjs +1579 -0
  744. package/src/rc2-campaign.mjs +1520 -0
  745. package/src/rc2-delivery-policy-front-end.mjs +1079 -0
  746. package/src/rc2-delivery-policy-oracle.mjs +134 -0
  747. package/src/rc2-delivery-policy-transform.mjs +1127 -0
  748. package/src/rc2-rc1-transfer-front-end.mjs +511 -0
  749. package/src/rc3-actual-dogfood.mjs +648 -0
  750. package/src/rc3-dogfood-scaffold.mjs +310 -0
  751. package/src/rc3-scripted-campaign.mjs +1301 -0
  752. package/src/rc4-stage1-dogfood.mjs +652 -0
  753. package/src/runtime-cli.mjs +504 -0
  754. package/src/runtime-contracts.mjs +631 -0
  755. package/src/runtime-decision-verifier.mjs +607 -0
  756. package/src/runtime-diff-observer.mjs +265 -0
  757. package/src/runtime-engine.mjs +674 -0
  758. package/src/runtime-errors.mjs +356 -0
  759. package/src/runtime-event-store.mjs +217 -0
  760. package/src/runtime-front-end.mjs +764 -0
  761. package/src/runtime-hold-recompile.mjs +606 -0
  762. package/src/runtime-projection.mjs +180 -0
  763. package/src/runtime-scripted-executor.mjs +163 -0
  764. package/src/runtime-worktree-executor.mjs +199 -0
  765. package/src/schedulability-compiler-v2.mjs +303 -0
  766. package/src/schedulability-verifier-v2.mjs +317 -0
  767. package/src/seam-transform.mjs +554 -0
  768. package/src/treatment-compiler.mjs +728 -0
  769. package/src/treatment-runner.mjs +658 -0
@@ -0,0 +1,879 @@
1
+ "use strict";
2
+ /**
3
+ * File Watcher
4
+ *
5
+ * Watches the project directory for file changes and triggers debounced sync
6
+ * operations to keep the code graph up-to-date.
7
+ *
8
+ * Uses Node's built-in `fs.watch` directly (no third-party watcher, no native
9
+ * addon) with a per-platform strategy chosen to keep the open-descriptor /
10
+ * kernel-watch cost BOUNDED rather than growing with the number of files:
11
+ *
12
+ * - macOS / Windows: a SINGLE recursive `fs.watch(root, {recursive:true})`.
13
+ * libuv maps this to one FSEvents stream (macOS) / one
14
+ * ReadDirectoryChangesW handle (Windows), so it costs O(1) descriptors no
15
+ * matter how large the tree. This is the fix for the macOS file-table
16
+ * exhaustion (#644 / #496 / #555 / #628): the previous watcher held one
17
+ * open fd PER WATCHED FILE on macOS (tens of thousands of REG fds), which
18
+ * exhausted `kern.maxfiles` and crashed unrelated processes system-wide.
19
+ *
20
+ * - Linux: recursive `fs.watch` is unsupported, so we watch each (non-ignored)
21
+ * DIRECTORY with one inotify watch — O(directories), NOT O(files). New
22
+ * directories are picked up dynamically and an overall watch cap bounds
23
+ * inotify usage on pathological monorepos (#579). A single inotify watch on
24
+ * a directory already reports create/modify/delete for its children, so
25
+ * per-file watches are never needed.
26
+ *
27
+ * Excluded trees (node_modules/, dist/, .git/, …) are filtered via the
28
+ * indexer's `buildScopeIgnore` (built-in default-ignore dirs + the project's
29
+ * .gitignore) — on Linux they're never descended into (so they cost no watch),
30
+ * and on macOS/Windows the single recursive stream still covers them but their
31
+ * events are dropped before any sync is scheduled. Either way the watcher's
32
+ * scope matches the indexer's (#276 / #407).
33
+ */
34
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
35
+ if (k2 === undefined) k2 = k;
36
+ var desc = Object.getOwnPropertyDescriptor(m, k);
37
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
38
+ desc = { enumerable: true, get: function() { return m[k]; } };
39
+ }
40
+ Object.defineProperty(o, k2, desc);
41
+ }) : (function(o, m, k, k2) {
42
+ if (k2 === undefined) k2 = k;
43
+ o[k2] = m[k];
44
+ }));
45
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
46
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
47
+ }) : function(o, v) {
48
+ o["default"] = v;
49
+ });
50
+ var __importStar = (this && this.__importStar) || (function () {
51
+ var ownKeys = function(o) {
52
+ ownKeys = Object.getOwnPropertyNames || function (o) {
53
+ var ar = [];
54
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
55
+ return ar;
56
+ };
57
+ return ownKeys(o);
58
+ };
59
+ return function (mod) {
60
+ if (mod && mod.__esModule) return mod;
61
+ var result = {};
62
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
63
+ __setModuleDefault(result, mod);
64
+ return result;
65
+ };
66
+ })();
67
+ Object.defineProperty(exports, "__esModule", { value: true });
68
+ exports.FileWatcher = exports.LockUnavailableError = void 0;
69
+ exports.__setFsWatchForTests = __setFsWatchForTests;
70
+ exports.__emitWatchEventForTests = __emitWatchEventForTests;
71
+ const fs = __importStar(require("fs"));
72
+ const path = __importStar(require("path"));
73
+ const extraction_1 = require("../extraction");
74
+ const project_config_1 = require("../project-config");
75
+ const errors_1 = require("../errors");
76
+ const utils_1 = require("../utils");
77
+ const directory_1 = require("../directory");
78
+ const watch_policy_1 = require("./watch-policy");
79
+ /**
80
+ * Number of consecutive lock-contention retries the watcher tolerates before
81
+ * it gives up and degrades auto-sync. Brief contention (another writer for a
82
+ * few cycles) stays under this; a long-lived external writer crosses it.
83
+ */
84
+ const MAX_LOCK_RETRIES = 5;
85
+ /**
86
+ * Number of consecutive GENERIC (non-lock) sync failures the watcher tolerates
87
+ * before it degrades auto-sync. A deterministic failure — a tree-sitter
88
+ * extractor that crashes on one file, DB corruption, `SQLITE_FULL`, an OOM in
89
+ * batched resolution — recurs every debounce cycle, so left unbounded it would
90
+ * retry forever (log + work spam) while the auto-update guarantee is silently
91
+ * dead (#1127). A single clean sync resets the streak, so a transient hiccup
92
+ * that recovers within the budget never degrades.
93
+ */
94
+ const MAX_SYNC_FAILURE_RETRIES = 5;
95
+ /** Cap on the exponential retry backoff (either mode) so it never sleeps absurdly long. */
96
+ const MAX_RETRY_BACKOFF_MS = 30_000;
97
+ /** Actionable degrade message; both exhaustion paths share it verbatim. */
98
+ const EXHAUSTION_REASON = 'OS watch/file limit exhausted; auto-sync disabled. Run `codegraph sync` ' +
99
+ '(or install git sync hooks) to refresh the graph after changes.';
100
+ /**
101
+ * Actionable, NON-fatal warning for Linux inotify watch-count exhaustion.
102
+ * Unlike {@link EXHAUSTION_REASON} this does not disable the watcher — the
103
+ * watches already installed keep working — so it names the exact kernel knob to
104
+ * raise instead.
105
+ */
106
+ const INOTIFY_LIMIT_REASON = 'Linux inotify watch limit reached (fs.inotify.max_user_watches); live ' +
107
+ 'watching now covers only part of the project, so edits in unwatched ' +
108
+ 'directories will not auto-sync. Raise the limit (e.g. `sudo sysctl ' +
109
+ 'fs.inotify.max_user_watches=1048576`, persisted in /etc/sysctl.d) and ' +
110
+ 'restart, or run `codegraph sync` (or install git sync hooks) to refresh.';
111
+ /**
112
+ * True when an error is OS watch/file-descriptor exhaustion (EMFILE/ENFILE).
113
+ * Prefers the structured `err.code`; falls back to message matching ONLY when
114
+ * no code is present (some platforms surface a bare Error from `fs.watch`).
115
+ */
116
+ function isWatchResourceExhaustion(err) {
117
+ const e = err;
118
+ if (e?.code === 'EMFILE' || e?.code === 'ENFILE')
119
+ return true;
120
+ if (!e?.code && e?.message) {
121
+ return /EMFILE|ENFILE|too many open files/i.test(e.message);
122
+ }
123
+ return false;
124
+ }
125
+ /**
126
+ * True when an error is Linux inotify *watch-count* exhaustion. `fs.watch`
127
+ * surfaces a hit `fs.inotify.max_user_watches` as ENOSPC ("no space" = no watch
128
+ * descriptors left, NOT disk space). This only arises on the Linux
129
+ * per-directory path; it is non-fatal (raise the limit and partial watching
130
+ * keeps working), so it warns rather than degrading.
131
+ */
132
+ function isInotifyWatchExhaustion(err) {
133
+ return err?.code === 'ENOSPC';
134
+ }
135
+ /**
136
+ * Native recursive `fs.watch` is only reliable on macOS and Windows; on Linux
137
+ * (and AIX) it throws `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`. We branch on this
138
+ * to pick the recursive vs per-directory strategy.
139
+ */
140
+ function supportsRecursiveWatch() {
141
+ return process.platform === 'darwin' || process.platform === 'win32';
142
+ }
143
+ let watchImpl = fs.watch;
144
+ /** @internal Test-only seam to inject a fake fs.watch implementation. */
145
+ function __setFsWatchForTests(fn) {
146
+ watchImpl = fn ?? fs.watch;
147
+ }
148
+ /**
149
+ * Upper bound on simultaneously-watched directories on the Linux per-directory
150
+ * path. Each is one inotify watch; the kernel's `fs.inotify.max_user_watches`
151
+ * is the hard limit (commonly 8k–128k). We stop adding watches past this and
152
+ * log once — partial live-watch (with `codegraph sync` as the backstop) is far
153
+ * better than exhausting the user's inotify budget and breaking watching
154
+ * system-wide (#579). Tunable via CODEGRAPH_MAX_DIR_WATCHES.
155
+ */
156
+ const DEFAULT_MAX_DIR_WATCHES = 50_000;
157
+ function maxDirWatches() {
158
+ const raw = process.env.CODEGRAPH_MAX_DIR_WATCHES;
159
+ if (raw && /^\d+$/.test(raw)) {
160
+ const n = Number(raw);
161
+ if (n > 0)
162
+ return n;
163
+ }
164
+ return DEFAULT_MAX_DIR_WATCHES;
165
+ }
166
+ /**
167
+ * Test seam (see {@link __emitWatchEventForTests}). Maps a watcher's project
168
+ * root to its live instance so tests can synthesize a change event
169
+ * deterministically — real fs.watch delivery latency races under parallel
170
+ * vitest (the reason the previous chokidar mock existed). Only populated under
171
+ * a test runner, so production carries no bookkeeping or retained references.
172
+ */
173
+ const liveWatchersForTests = new Map();
174
+ const IS_TEST_RUNTIME = !!(process.env.VITEST || process.env.NODE_ENV === 'test');
175
+ /**
176
+ * Thrown by a `syncFn` to signal that the underlying sync couldn't acquire
177
+ * the cross-process write lock (#449). The watcher treats this as "no
178
+ * progress" — preserves `pendingFiles`, skips `onSyncComplete`, and the
179
+ * `finally` block reschedules. Quiet (debug-only) because a long-running
180
+ * external indexer can hit this every debounce cycle.
181
+ */
182
+ class LockUnavailableError extends Error {
183
+ constructor(message = 'CodeGraph file lock unavailable; another process is writing') {
184
+ super(message);
185
+ this.name = 'LockUnavailableError';
186
+ }
187
+ }
188
+ exports.LockUnavailableError = LockUnavailableError;
189
+ /**
190
+ * FileWatcher monitors a project directory for changes and triggers
191
+ * debounced sync operations via a provided callback.
192
+ *
193
+ * Design goals:
194
+ * - Bounded resource usage: O(1) descriptors on macOS/Windows (one recursive
195
+ * watch), O(directories) inotify watches on Linux — never O(files), which
196
+ * was the system-crashing fd leak on macOS (#644/#496/#555/#628).
197
+ * - Debounced to avoid thrashing on rapid saves
198
+ * - Filters to supported source files by extension
199
+ * - Ignores .codegraph/ and .git/ regardless of .gitignore
200
+ * - Tracks per-file pending state so MCP tools can flag stale results
201
+ * without blocking on a sync (issue #403)
202
+ */
203
+ class FileWatcher {
204
+ /** macOS/Windows: the single recursive watcher. Null on Linux. */
205
+ recursiveWatcher = null;
206
+ /** Linux: one watcher per watched directory (keyed by absolute path). */
207
+ dirWatchers = new Map();
208
+ /** Set once the per-directory watch cap is hit, so we log only once. */
209
+ dirCapWarned = false;
210
+ /**
211
+ * Set once the Linux inotify watch limit (ENOSPC) is hit. Double duty: we
212
+ * warn only once, AND we stop attempting new directory watches for the rest
213
+ * of the session — once the kernel budget is exhausted every further
214
+ * `inotify_add_watch` fails too, so trying the rest of the tree is pure
215
+ * waste. NON-fatal (does not degrade): installed watches keep working.
216
+ */
217
+ inotifyLimitWarned = false;
218
+ /**
219
+ * One-way latch: the reason live watching was permanently disabled at runtime
220
+ * (watch-resource exhaustion, lock contention past the retry budget, or a
221
+ * persistent generic sync failure past the retry budget), or null while
222
+ * healthy. Set by {@link degrade}; cleared only by a fresh start().
223
+ */
224
+ degradedReason = null;
225
+ /** Consecutive lock-contention retries for watcher-triggered syncs. */
226
+ lockRetryCount = 0;
227
+ /** Consecutive generic (non-lock) sync failures; reset only by a clean sync. */
228
+ syncFailureRetryCount = 0;
229
+ /** Test-only inert mode: started, but with no OS watcher installed. */
230
+ inert = false;
231
+ debounceTimer = null;
232
+ /**
233
+ * Files seen by the watcher since the last successful sync — populated on
234
+ * every change event, cleared at the start of a sync, and re-populated by
235
+ * events that arrive mid-sync (or restored on sync failure). Keyed by the
236
+ * same project-relative POSIX path the rest of the codebase uses, so a
237
+ * caller can intersect tool-response file paths against this map cheaply.
238
+ */
239
+ pendingFiles = new Map();
240
+ /**
241
+ * Wall-clock ms at which the in-flight sync began. Combined with
242
+ * {@link pendingFiles}'s `lastSeenMs`, this distinguishes "still in the
243
+ * debounce window" (lastSeen > syncStarted, sync hasn't started yet for
244
+ * this edit) from "currently being indexed" (lastSeen <= syncStarted).
245
+ */
246
+ syncStartedMs = 0;
247
+ syncing = false;
248
+ stopped = false;
249
+ /**
250
+ * True once the initial watch set is established. Unlike the previous
251
+ * chokidar implementation there is no asynchronous initial "crawl" emitting
252
+ * an `add` per existing file — `fs.watch` only reports changes from the
253
+ * moment it's installed — so this flips to true synchronously at the end of
254
+ * `start()`. The startup reconcile against on-disk state is handled
255
+ * separately by the engine's catch-up sync, not by the watcher.
256
+ */
257
+ ready = false;
258
+ /**
259
+ * Callbacks that resolve when the watch set is established. Used by tests
260
+ * (and any production caller that cares about a clean baseline) to
261
+ * deterministically gate on watcher readiness.
262
+ */
263
+ readyWaiters = [];
264
+ // The shared scope matcher (built-in defaults + project .gitignore, with
265
+ // embedded child repos matched by their OWN rules — #514), built once at
266
+ // start(). Same source of truth the indexer uses, so watcher scope can
267
+ // never diverge from index scope. An embedded repo created after start()
268
+ // joins the scope on the next watcher restart / re-index.
269
+ ignoreMatcher = null;
270
+ projectRoot;
271
+ debounceMs;
272
+ syncFn;
273
+ onSyncComplete;
274
+ onSyncError;
275
+ onDegraded;
276
+ inertForTests;
277
+ constructor(projectRoot, syncFn, options = {}) {
278
+ this.projectRoot = projectRoot;
279
+ this.syncFn = syncFn;
280
+ this.debounceMs = options.debounceMs ?? 2000;
281
+ this.onSyncComplete = options.onSyncComplete;
282
+ this.onSyncError = options.onSyncError;
283
+ this.onDegraded = options.onDegraded;
284
+ this.inertForTests = options.inertForTests ?? false;
285
+ }
286
+ /**
287
+ * Start watching for file changes.
288
+ * Returns true if watching started successfully, false otherwise.
289
+ */
290
+ start() {
291
+ if (this.recursiveWatcher || this.dirWatchers.size > 0 || this.inert)
292
+ return true; // Already watching
293
+ this.stopped = false;
294
+ this.degradedReason = null;
295
+ this.lockRetryCount = 0;
296
+ this.syncFailureRetryCount = 0;
297
+ // Some environments make filesystem watching unusable — most notably
298
+ // WSL2 /mnt/ drives, where the underlying fs.watch calls block long
299
+ // enough to break MCP startup handshakes (issue #199). Skip watching
300
+ // there; callers fall back to manual `codegraph sync` or git sync hooks.
301
+ const disabledReason = (0, watch_policy_1.watchDisabledReason)(this.projectRoot);
302
+ if (disabledReason) {
303
+ (0, errors_1.logDebug)('File watcher disabled', { reason: disabledReason, projectRoot: this.projectRoot });
304
+ return false;
305
+ }
306
+ // Reuse the indexer's ignore set so the watcher and indexer agree on scope.
307
+ this.ignoreMatcher = (0, extraction_1.buildScopeIgnore)(this.projectRoot);
308
+ try {
309
+ if (this.inertForTests) {
310
+ // Test-only: install no OS watcher; the seam drives events instead.
311
+ this.inert = true;
312
+ }
313
+ else if (supportsRecursiveWatch()) {
314
+ this.startRecursive();
315
+ }
316
+ else {
317
+ this.startPerDirectory();
318
+ }
319
+ // The per-directory (Linux) path catches watch-resource exhaustion inside
320
+ // watchTree and degrades synchronously rather than throwing, so it never
321
+ // reaches the catch below. Surface that as a failed start here so both
322
+ // strategies report exhaustion identically (start() === false).
323
+ if (this.degradedReason)
324
+ return false;
325
+ // No async crawl to wait on: as soon as the watch set is installed we
326
+ // have a clean baseline (pendingFiles is only populated by post-start
327
+ // events). Clear defensively and flip ready.
328
+ this.pendingFiles.clear();
329
+ this.ready = true;
330
+ for (const cb of this.readyWaiters)
331
+ cb();
332
+ this.readyWaiters.length = 0;
333
+ if (IS_TEST_RUNTIME)
334
+ liveWatchersForTests.set(this.projectRoot, this);
335
+ (0, errors_1.logDebug)('File watcher started', {
336
+ projectRoot: this.projectRoot,
337
+ debounceMs: this.debounceMs,
338
+ mode: this.inertForTests ? 'inert' : supportsRecursiveWatch() ? 'recursive' : 'per-directory',
339
+ watchedDirs: this.dirWatchers.size || undefined,
340
+ });
341
+ return true;
342
+ }
343
+ catch (err) {
344
+ // Watcher setup failed. Watch-resource exhaustion (EMFILE/ENFILE on the
345
+ // recursive path) is terminal — degrade cleanly with one actionable
346
+ // warning instead of leaving a half-broken watcher. Everything else
347
+ // (permission denied, missing directory) keeps the prior quiet-stop.
348
+ if (isWatchResourceExhaustion(err)) {
349
+ this.degrade(EXHAUSTION_REASON, { error: String(err) });
350
+ }
351
+ else {
352
+ (0, errors_1.logWarn)('Could not start file watcher', { error: String(err) });
353
+ this.stop();
354
+ }
355
+ return false;
356
+ }
357
+ }
358
+ /**
359
+ * macOS/Windows: one recursive watcher for the whole tree. O(1) descriptors.
360
+ * `filename` arrives relative to the project root (with subdirectories), so
361
+ * it maps straight to a project-relative path.
362
+ */
363
+ startRecursive() {
364
+ this.recursiveWatcher = watchImpl(this.projectRoot, { recursive: true, persistent: true }, (_event, filename) => {
365
+ if (this.stopped || filename == null)
366
+ return;
367
+ this.handleChange((0, utils_1.normalizePath)(String(filename)));
368
+ });
369
+ this.recursiveWatcher.on('error', (err) => {
370
+ if (isWatchResourceExhaustion(err)) {
371
+ this.degrade(EXHAUSTION_REASON, { error: String(err) });
372
+ return;
373
+ }
374
+ (0, errors_1.logWarn)('File watcher error', { error: String(err) });
375
+ });
376
+ }
377
+ /**
378
+ * Linux: walk the (non-ignored) tree and watch each directory. One inotify
379
+ * watch per directory reports create/modify/delete for that directory's
380
+ * direct children, so we never watch individual files.
381
+ */
382
+ startPerDirectory() {
383
+ this.watchTree(this.projectRoot, /* markExisting */ false);
384
+ }
385
+ /**
386
+ * Add an inotify watch for `dir` and recurse into its non-ignored
387
+ * subdirectories. When `markExisting` is true (a directory that appeared
388
+ * AFTER startup), the source files already inside it are recorded as pending
389
+ * — this closes the `mkdir + write` race where files created before the new
390
+ * directory's watch is installed would otherwise be missed until the next
391
+ * full sync. The initial startup walk passes false (the engine's catch-up
392
+ * sync owns the baseline).
393
+ */
394
+ watchTree(dir, markExisting) {
395
+ // A degrade() mid-walk (exhaustion on an earlier directory) calls stop(),
396
+ // which sets `stopped`; bail so the recursion unwinds without adding more
397
+ // watches to a watcher that is shutting down. `inotifyLimitWarned` does the
398
+ // same after ENOSPC — the kernel budget is gone, so stop trying the rest of
399
+ // the tree (every add would fail) while keeping the watches already set.
400
+ if (this.stopped || this.degradedReason || this.inotifyLimitWarned)
401
+ return;
402
+ if (this.dirWatchers.has(dir))
403
+ return;
404
+ if (this.dirWatchers.size >= maxDirWatches()) {
405
+ if (!this.dirCapWarned) {
406
+ this.dirCapWarned = true;
407
+ (0, errors_1.logWarn)('File watcher hit directory-watch cap; remaining subtrees rely on manual/periodic sync', {
408
+ cap: maxDirWatches(),
409
+ });
410
+ }
411
+ return;
412
+ }
413
+ let w;
414
+ try {
415
+ w = watchImpl(dir, { persistent: true }, (_event, filename) => this.handleDirEvent(dir, filename));
416
+ }
417
+ catch (err) {
418
+ // EMFILE/ENFILE means the PROCESS is out of descriptors — every further
419
+ // directory would fail too, so degrade the whole watcher rather than
420
+ // limping along with a partial watch set.
421
+ if (isWatchResourceExhaustion(err)) {
422
+ this.degrade(EXHAUSTION_REASON, { error: String(err), dir });
423
+ }
424
+ else if (isInotifyWatchExhaustion(err)) {
425
+ // ENOSPC = inotify watch budget exhausted. NON-fatal: keep the watches
426
+ // we have and tell the user the knob to raise (warn once).
427
+ this.warnInotifyLimit({ error: String(err), dir });
428
+ }
429
+ // ENOENT / EACCES on a single directory stays non-fatal: skip it quietly.
430
+ return;
431
+ }
432
+ w.on('error', (err) => {
433
+ if (isWatchResourceExhaustion(err)) {
434
+ this.degrade(EXHAUSTION_REASON, { error: String(err), dir });
435
+ return;
436
+ }
437
+ if (isInotifyWatchExhaustion(err)) {
438
+ this.warnInotifyLimit({ error: String(err), dir });
439
+ }
440
+ this.unwatchDir(dir);
441
+ });
442
+ this.dirWatchers.set(dir, w);
443
+ let entries;
444
+ try {
445
+ entries = fs.readdirSync(dir, { withFileTypes: true });
446
+ }
447
+ catch {
448
+ return;
449
+ }
450
+ for (const entry of entries) {
451
+ const child = path.join(dir, entry.name);
452
+ if (entry.isDirectory()) {
453
+ if (this.shouldIgnoreDir(child))
454
+ continue;
455
+ this.watchTree(child, markExisting);
456
+ }
457
+ else if (markExisting && entry.isFile()) {
458
+ this.handleChange((0, utils_1.normalizePath)(path.relative(this.projectRoot, child)));
459
+ }
460
+ }
461
+ }
462
+ /**
463
+ * Linux per-directory event handler. `filename` is relative to `dir`. A new
464
+ * sub-directory is picked up by extending the watch tree; everything else is
465
+ * routed through the shared change handler.
466
+ */
467
+ handleDirEvent(dir, filename) {
468
+ if (this.stopped || filename == null)
469
+ return;
470
+ const full = path.join(dir, String(filename));
471
+ // A newly-created directory needs its own watch (recursive isn't available
472
+ // on Linux). statSync is cheap and these events are rare relative to file
473
+ // edits. If the path vanished (rapid create/delete) the stat throws and we
474
+ // fall through to the change handler, which no-ops on a non-source path.
475
+ try {
476
+ if (fs.statSync(full).isDirectory()) {
477
+ if (!this.shouldIgnoreDir(full))
478
+ this.watchTree(full, /* markExisting */ true);
479
+ return;
480
+ }
481
+ }
482
+ catch {
483
+ // deleted/inaccessible — treat as a normal change below
484
+ }
485
+ this.handleChange((0, utils_1.normalizePath)(path.relative(this.projectRoot, full)));
486
+ }
487
+ /**
488
+ * Shared change handler for both watch strategies. `rel` is a
489
+ * project-relative POSIX path. Applies the ignore + source-file filters and,
490
+ * for a real source change, records it as pending (#403) and schedules a
491
+ * debounced sync.
492
+ *
493
+ * The recursive (macOS/Windows) watcher reports events for ignored trees too
494
+ * (one stream covers the whole repo), so the ignore check here is load-bearing
495
+ * — it drops node_modules/dist/.git churn before any sync is scheduled.
496
+ */
497
+ handleChange(rel) {
498
+ if (!rel || rel === '.' || rel.startsWith('..'))
499
+ return;
500
+ if (this.isAlwaysIgnored(rel))
501
+ return;
502
+ if (this.ignoreMatcher && this.ignoreMatcher.ignores(rel))
503
+ return;
504
+ if (!(0, extraction_1.isSourceFile)(rel, (0, project_config_1.loadExtensionOverrides)(this.projectRoot))) {
505
+ this.maybeScheduleForRemovedDir(rel);
506
+ return;
507
+ }
508
+ (0, errors_1.logDebug)('File change detected', { file: rel });
509
+ if (this.ready) {
510
+ const now = Date.now();
511
+ const existing = this.pendingFiles.get(rel);
512
+ this.pendingFiles.set(rel, {
513
+ firstSeenMs: existing?.firstSeenMs ?? now,
514
+ lastSeenMs: now,
515
+ });
516
+ }
517
+ this.scheduleSync();
518
+ }
519
+ /**
520
+ * A deleted DIRECTORY arrives as one event on the directory's own path —
521
+ * no source extension, so the source-file filter drops it, and the files
522
+ * underneath may never get events of their own (Windows's recursive
523
+ * watcher reports only the top-most removed entry; macOS FSEvents can
524
+ * coalesce a tree deletion the same way). The index then kept every child
525
+ * record until some unrelated edit happened to trigger a sync (#1285).
526
+ *
527
+ * If a non-source path no longer exists on disk, treat it as a potential
528
+ * subtree removal and schedule the debounced sync — its scan-diff removes
529
+ * whatever is gone, which is the ground truth for what was underneath.
530
+ * pendingFiles is left alone (we can't know the children from the event).
531
+ * An event for an EXISTING non-source file stays fully ignored, so build
532
+ * churn on live files never schedules work; a deleted non-source file
533
+ * costs at most one no-op scan-diff, absorbed by the debounce.
534
+ */
535
+ maybeScheduleForRemovedDir(rel) {
536
+ try {
537
+ fs.statSync(path.join(this.projectRoot, rel));
538
+ return; // still on disk — an ordinary non-source change, ignore
539
+ }
540
+ catch {
541
+ /* gone — fall through */
542
+ }
543
+ (0, errors_1.logDebug)('Non-source path removed; scheduling sync for possible directory removal', {
544
+ path: rel,
545
+ });
546
+ this.scheduleSync();
547
+ }
548
+ /** Close and forget the watch for a directory that errored/was removed. */
549
+ unwatchDir(dir) {
550
+ const w = this.dirWatchers.get(dir);
551
+ if (w) {
552
+ try {
553
+ w.close();
554
+ }
555
+ catch {
556
+ /* already closed */
557
+ }
558
+ this.dirWatchers.delete(dir);
559
+ }
560
+ }
561
+ /** Our own dirs are always ignored, regardless of .gitignore. */
562
+ isAlwaysIgnored(rel) {
563
+ // First path segment. Ignore any CodeGraph data dir — the active one AND a
564
+ // sibling like `.codegraph-win` a second environment (Windows/WSL) created
565
+ // in the same tree, so neither side watches the other's index (#636).
566
+ const top = rel.split('/')[0] ?? rel;
567
+ return ((0, directory_1.isCodeGraphDataDir)(top) ||
568
+ rel === '.git' || rel.startsWith('.git/'));
569
+ }
570
+ /**
571
+ * True for any directory that should NOT be watched (used while building the
572
+ * Linux per-directory watch tree). Tests the directory form of the path so a
573
+ * dir-only ignore rule like `build/` matches.
574
+ */
575
+ shouldIgnoreDir(dirPath) {
576
+ const rel = (0, utils_1.normalizePath)(path.relative(this.projectRoot, dirPath));
577
+ if (!rel || rel === '.' || rel.startsWith('..'))
578
+ return false; // root / outside
579
+ if (this.isAlwaysIgnored(rel))
580
+ return true;
581
+ if (!this.ignoreMatcher)
582
+ return false;
583
+ return this.ignoreMatcher.ignores(rel + '/');
584
+ }
585
+ /**
586
+ * Permanently disable live watching after a terminal runtime failure
587
+ * (watch-resource exhaustion, lock contention past the retry budget, or a
588
+ * persistent generic sync failure past the retry budget).
589
+ * Idempotent: logs one actionable warning, fires {@link WatchOptions.onDegraded}
590
+ * once, and stops the watcher. A subsequent start() clears the latch.
591
+ */
592
+ degrade(reason, context = {}) {
593
+ if (this.degradedReason)
594
+ return;
595
+ this.degradedReason = reason;
596
+ (0, errors_1.logWarn)('File watcher disabled', { projectRoot: this.projectRoot, reason, ...context });
597
+ this.onDegraded?.(reason);
598
+ this.stop();
599
+ }
600
+ /**
601
+ * Warn ONCE that the Linux inotify watch budget is exhausted (ENOSPC), and
602
+ * stop adding new watches for the rest of this session — every further
603
+ * `inotify_add_watch` would fail too, so walking the rest of the tree is
604
+ * waste. Unlike {@link degrade} this is NON-fatal: the watches already
605
+ * installed keep firing, and `codegraph sync` covers the unwatched remainder.
606
+ * The message names the kernel knob to raise (`fs.inotify.max_user_watches`).
607
+ */
608
+ warnInotifyLimit(context = {}) {
609
+ if (this.inotifyLimitWarned)
610
+ return;
611
+ this.inotifyLimitWarned = true;
612
+ (0, errors_1.logWarn)(INOTIFY_LIMIT_REASON, { watchedDirs: this.dirWatchers.size, ...context });
613
+ }
614
+ /**
615
+ * Whether live watching has degraded permanently (until the next start()).
616
+ * Distinct from {@link isActive}: a degraded watcher is inactive, but an
617
+ * inactive watcher is not necessarily degraded (it may simply be stopped or
618
+ * never started). Hosts use this to tell the user auto-sync is off.
619
+ */
620
+ isDegraded() {
621
+ return this.degradedReason !== null;
622
+ }
623
+ /** The reason live watching degraded, or null if it is healthy. */
624
+ getDegradedReason() {
625
+ return this.degradedReason;
626
+ }
627
+ /**
628
+ * Stop watching for file changes.
629
+ */
630
+ stop() {
631
+ this.stopped = true;
632
+ if (this.debounceTimer) {
633
+ clearTimeout(this.debounceTimer);
634
+ this.debounceTimer = null;
635
+ }
636
+ if (this.recursiveWatcher) {
637
+ try {
638
+ this.recursiveWatcher.close();
639
+ }
640
+ catch {
641
+ /* already closed */
642
+ }
643
+ this.recursiveWatcher = null;
644
+ }
645
+ for (const w of this.dirWatchers.values()) {
646
+ try {
647
+ w.close();
648
+ }
649
+ catch {
650
+ /* already closed */
651
+ }
652
+ }
653
+ this.dirWatchers.clear();
654
+ this.dirCapWarned = false;
655
+ this.inotifyLimitWarned = false;
656
+ this.lockRetryCount = 0;
657
+ this.syncFailureRetryCount = 0;
658
+ // NB: degradedReason is intentionally NOT reset here — it must survive the
659
+ // stop() that degrade() triggers so isDegraded() stays true. start() clears it.
660
+ this.inert = false;
661
+ this.pendingFiles.clear();
662
+ this.ready = false;
663
+ this.ignoreMatcher = null;
664
+ if (IS_TEST_RUNTIME)
665
+ liveWatchersForTests.delete(this.projectRoot);
666
+ (0, errors_1.logDebug)('File watcher stopped');
667
+ }
668
+ /**
669
+ * @internal Test-only: feed a synthetic project-relative change through the
670
+ * same filter → pendingFiles → debounced-sync path a real fs.watch event
671
+ * takes. Lets the watcher / staleness-banner suites stay deterministic
672
+ * instead of racing on OS watch-delivery latency. See
673
+ * {@link __emitWatchEventForTests}.
674
+ */
675
+ ingestEventForTests(relPath) {
676
+ this.handleChange((0, utils_1.normalizePath)(relPath));
677
+ }
678
+ /**
679
+ * Whether the watcher is currently active.
680
+ */
681
+ isActive() {
682
+ return (this.recursiveWatcher !== null || this.dirWatchers.size > 0 || this.inert) && !this.stopped;
683
+ }
684
+ /**
685
+ * Resolves once the watch set has been installed (or immediately if it
686
+ * already has). Useful for tests that need a deterministic boundary before
687
+ * asserting on `pendingFiles`.
688
+ *
689
+ * Production callers don't need this: `pendingFiles` is read continuously,
690
+ * the staleness banner is always correct (empty or populated), and there is
691
+ * no asynchronous initial-scan window with `fs.watch`.
692
+ */
693
+ waitUntilReady(timeoutMs = 10000) {
694
+ if (this.ready)
695
+ return Promise.resolve();
696
+ return new Promise((resolve, reject) => {
697
+ const t = setTimeout(() => {
698
+ const idx = this.readyWaiters.indexOf(handler);
699
+ if (idx >= 0)
700
+ this.readyWaiters.splice(idx, 1);
701
+ reject(new Error(`FileWatcher.waitUntilReady timed out after ${timeoutMs}ms`));
702
+ }, timeoutMs);
703
+ const handler = () => { clearTimeout(t); resolve(); };
704
+ this.readyWaiters.push(handler);
705
+ });
706
+ }
707
+ /**
708
+ * Schedule a normal debounced sync after a source edit.
709
+ */
710
+ scheduleSync() {
711
+ if (this.debounceTimer) {
712
+ clearTimeout(this.debounceTimer);
713
+ }
714
+ this.debounceTimer = setTimeout(() => {
715
+ this.debounceTimer = null;
716
+ this.flush();
717
+ }, this.debounceMs);
718
+ }
719
+ /**
720
+ * Schedule a retry after a recoverable sync failure (lock contention). Kept
721
+ * separate from {@link scheduleSync} so prolonged contention backs off
722
+ * exponentially instead of hammering the lock every debounce cycle.
723
+ */
724
+ scheduleRetrySync(delayMs) {
725
+ if (this.debounceTimer) {
726
+ clearTimeout(this.debounceTimer);
727
+ }
728
+ this.debounceTimer = setTimeout(() => {
729
+ this.debounceTimer = null;
730
+ this.flush();
731
+ }, delayMs);
732
+ }
733
+ /**
734
+ * Flush pending changes by running sync.
735
+ *
736
+ * pendingFiles is NOT cleared at the start of sync — entries are removed
737
+ * only after sync commits successfully, and only for entries whose
738
+ * lastSeenMs <= syncStartedMs. That way, a query that arrives mid-sync
739
+ * still sees the affected files marked stale (the DB hasn't been updated
740
+ * yet), and an event that lands mid-sync persists into the follow-up.
741
+ *
742
+ * On sync failure pendingFiles is left untouched — every edit is still
743
+ * unindexed, and the rescheduled sync will absorb the same set next time.
744
+ */
745
+ async flush() {
746
+ // If already syncing, the post-sync check will re-trigger
747
+ if (this.syncing || this.stopped)
748
+ return;
749
+ this.syncStartedMs = Date.now();
750
+ this.syncing = true;
751
+ try {
752
+ const result = await this.syncFn();
753
+ this.lockRetryCount = 0; // a clean sync clears any contention backoff
754
+ this.syncFailureRetryCount = 0; // ...and any generic-failure backoff
755
+ // Remove entries whose most recent event predates this sync — those
756
+ // edits are now in the DB. Entries with lastSeenMs > syncStartedMs
757
+ // arrived mid-sync; whether the in-flight sync captured them depends
758
+ // on when sync read that file, so we keep them as pending and let
759
+ // the follow-up sync handle them. We prefer false positives ("shown
760
+ // stale, actually fresh" → at worst one extra Read) over false
761
+ // negatives ("shown fresh, actually stale" → misleads the agent).
762
+ for (const [filePath, info] of this.pendingFiles) {
763
+ if (info.lastSeenMs <= this.syncStartedMs) {
764
+ this.pendingFiles.delete(filePath);
765
+ }
766
+ }
767
+ this.onSyncComplete?.(result);
768
+ }
769
+ catch (err) {
770
+ if (err instanceof LockUnavailableError) {
771
+ this.lockRetryCount += 1;
772
+ // Lock-failure no-op (another writer holds the lock). pendingFiles
773
+ // stays intact and the `finally` block reschedules with backoff. Keep
774
+ // brief contention quiet (debug-only — a long external index would
775
+ // otherwise spam stderr every cycle), but stop retrying forever: once a
776
+ // writer holds the lock past the budget, degrade auto-sync explicitly.
777
+ (0, errors_1.logDebug)('Watch sync skipped: file lock unavailable', {
778
+ pendingFiles: this.pendingFiles.size,
779
+ retryCount: this.lockRetryCount,
780
+ });
781
+ if (this.lockRetryCount > MAX_LOCK_RETRIES) {
782
+ this.degrade('CodeGraph file lock held by another process past the retry budget; ' +
783
+ 'auto-sync disabled. Run `codegraph sync` once the other writer finishes ' +
784
+ '(or install git sync hooks) to refresh the graph.', { pendingFiles: this.pendingFiles.size, retryCount: this.lockRetryCount });
785
+ }
786
+ }
787
+ else {
788
+ this.lockRetryCount = 0; // a non-lock failure isn't contention; reset that streak
789
+ this.syncFailureRetryCount += 1;
790
+ const error = err instanceof Error ? err : new Error(String(err));
791
+ (0, errors_1.logWarn)('Watch sync failed', {
792
+ error: error.message,
793
+ retryCount: this.syncFailureRetryCount,
794
+ });
795
+ this.onSyncError?.(error);
796
+ // A persistent (deterministic) sync failure — a broken extractor on a
797
+ // specific file, DB corruption, SQLITE_FULL, an OOM in resolution —
798
+ // would otherwise retry forever at the debounce cadence, spamming logs
799
+ // and work while the auto-update guarantee is silently dead (#1127).
800
+ // Bound it exactly like lock contention: the `finally` block backs off
801
+ // exponentially, and past the budget we degrade so the dead guarantee
802
+ // is surfaced (onDegraded / isDegraded) instead of hidden. A single
803
+ // clean sync resets the streak, so a transient hiccup never degrades.
804
+ if (this.syncFailureRetryCount > MAX_SYNC_FAILURE_RETRIES) {
805
+ this.degrade(`CodeGraph auto-sync failed ${this.syncFailureRetryCount} times in a row; ` +
806
+ 'auto-sync disabled. Run `codegraph sync` (or install git sync hooks) to ' +
807
+ `refresh the graph after changes. Last error: ${error.message}`, { error: error.message, retryCount: this.syncFailureRetryCount });
808
+ }
809
+ }
810
+ // Failure: leave pendingFiles untouched. Every edit it tracks is
811
+ // still unindexed; the rescheduled sync sees the same set.
812
+ }
813
+ finally {
814
+ this.syncing = false;
815
+ // If pending files remain (mid-sync events, or this sync failed),
816
+ // schedule another pass. After EITHER failure mode — lock contention or a
817
+ // generic sync failure — back off exponentially (debounceMs · 2^(n-1),
818
+ // capped) instead of retrying at the normal debounce cadence; a clean
819
+ // sync resets both counters so normal edits keep the fast debounce. Use
820
+ // the larger streak so interleaved failures still back off. A degrade()
821
+ // above already set `stopped`, so this won't reschedule a watcher that
822
+ // has given up.
823
+ if (this.pendingFiles.size > 0 && !this.stopped) {
824
+ const retryCount = Math.max(this.lockRetryCount, this.syncFailureRetryCount);
825
+ if (retryCount > 0) {
826
+ const retryDelayMs = Math.min(this.debounceMs * 2 ** Math.max(0, retryCount - 1), MAX_RETRY_BACKOFF_MS);
827
+ this.scheduleRetrySync(retryDelayMs);
828
+ }
829
+ else {
830
+ this.scheduleSync();
831
+ }
832
+ }
833
+ }
834
+ }
835
+ /**
836
+ * Snapshot of files seen by the watcher since the last successful sync.
837
+ *
838
+ * Used by MCP tool responses to mark stale results without blocking on a
839
+ * sync: a tool that returns a hit in `src/foo.ts` while `src/foo.ts` is in
840
+ * this list tells the agent "Read this file directly, the index lags."
841
+ *
842
+ * `indexing` is true when a sync is currently in flight whose start time is
843
+ * AFTER this file's most recent event — i.e. that sync will absorb the
844
+ * edit. False means the file is still inside the debounce window and no
845
+ * sync has started yet (a follow-up call a few hundred ms later may show
846
+ * `indexing: true` or the file may have left the list entirely).
847
+ *
848
+ * Cheap: O(pendingFiles.size), no I/O, no locks.
849
+ */
850
+ getPendingFiles() {
851
+ const result = [];
852
+ for (const [filePath, info] of this.pendingFiles) {
853
+ result.push({
854
+ path: filePath,
855
+ firstSeenMs: info.firstSeenMs,
856
+ lastSeenMs: info.lastSeenMs,
857
+ indexing: this.syncing && this.syncStartedMs >= info.lastSeenMs,
858
+ });
859
+ }
860
+ return result;
861
+ }
862
+ }
863
+ exports.FileWatcher = FileWatcher;
864
+ /**
865
+ * Test-only: synthesize a source-file change for the live watcher running at
866
+ * `projectRoot`, exercising the real filter → pendingFiles → debounced-sync
867
+ * logic without depending on fs.watch delivery timing (which races under
868
+ * parallel vitest). `relPath` is project-relative POSIX (e.g. "src/foo.ts").
869
+ * Returns false if no live watcher is registered for that root (e.g. outside a
870
+ * test runtime, where the registry is intentionally not populated).
871
+ */
872
+ function __emitWatchEventForTests(projectRoot, relPath) {
873
+ const w = liveWatchersForTests.get(projectRoot);
874
+ if (!w)
875
+ return false;
876
+ w.ingestEventForTests(relPath);
877
+ return true;
878
+ }
879
+ //# sourceMappingURL=watcher.js.map