@quolu/lattice 0.70.0 → 0.71.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (603) hide show
  1. package/bin/lattice.mjs +21 -0
  2. package/package.json +1 -1
  3. package/sensor/dist/bin/lattice-sensor.js +746 -323
  4. package/sensor/dist/bin/viewer-gate.d.ts +17 -0
  5. package/sensor/dist/bin/viewer-gate.d.ts.map +1 -0
  6. package/sensor/dist/bin/viewer-gate.js +31 -0
  7. package/sensor/dist/bin/viewer-gate.js.map +1 -0
  8. package/sensor/dist/context/formatter.d.ts +7 -1
  9. package/sensor/dist/context/formatter.d.ts.map +1 -1
  10. package/sensor/dist/context/formatter.js +12 -6
  11. package/sensor/dist/context/formatter.js.map +1 -1
  12. package/sensor/dist/context/index.d.ts +12 -0
  13. package/sensor/dist/context/index.d.ts.map +1 -1
  14. package/sensor/dist/context/index.js +103 -16
  15. package/sensor/dist/context/index.js.map +1 -1
  16. package/sensor/dist/db/index.d.ts +23 -2
  17. package/sensor/dist/db/index.d.ts.map +1 -1
  18. package/sensor/dist/db/index.js +109 -31
  19. package/sensor/dist/db/index.js.map +1 -1
  20. package/sensor/dist/db/migrations.d.ts +1 -1
  21. package/sensor/dist/db/migrations.d.ts.map +1 -1
  22. package/sensor/dist/db/migrations.js +68 -1
  23. package/sensor/dist/db/migrations.js.map +1 -1
  24. package/sensor/dist/db/queries.d.ts +583 -6
  25. package/sensor/dist/db/queries.d.ts.map +1 -1
  26. package/sensor/dist/db/queries.js +1425 -57
  27. package/sensor/dist/db/queries.js.map +1 -1
  28. package/sensor/dist/db/schema.sql +27 -4
  29. package/sensor/dist/db/sqlite-adapter.d.ts +2 -0
  30. package/sensor/dist/db/sqlite-adapter.d.ts.map +1 -1
  31. package/sensor/dist/db/sqlite-adapter.js +56 -7
  32. package/sensor/dist/db/sqlite-adapter.js.map +1 -1
  33. package/sensor/dist/db/synthesis-stage.d.ts +12 -0
  34. package/sensor/dist/db/synthesis-stage.d.ts.map +1 -0
  35. package/sensor/dist/db/synthesis-stage.js +93 -0
  36. package/sensor/dist/db/synthesis-stage.js.map +1 -0
  37. package/sensor/dist/db/wal-valve.d.ts +32 -12
  38. package/sensor/dist/db/wal-valve.d.ts.map +1 -1
  39. package/sensor/dist/db/wal-valve.js +65 -22
  40. package/sensor/dist/db/wal-valve.js.map +1 -1
  41. package/sensor/dist/db/wsl-shared-index.d.ts +53 -0
  42. package/sensor/dist/db/wsl-shared-index.d.ts.map +1 -0
  43. package/sensor/dist/db/wsl-shared-index.js +121 -0
  44. package/sensor/dist/db/wsl-shared-index.js.map +1 -0
  45. package/sensor/dist/directory.d.ts +126 -2
  46. package/sensor/dist/directory.d.ts.map +1 -1
  47. package/sensor/dist/directory.js +285 -16
  48. package/sensor/dist/directory.js.map +1 -1
  49. package/sensor/dist/errors.d.ts +14 -0
  50. package/sensor/dist/errors.d.ts.map +1 -1
  51. package/sensor/dist/errors.js +16 -1
  52. package/sensor/dist/errors.js.map +1 -1
  53. package/sensor/dist/extraction/cfml-extractor.d.ts +1 -0
  54. package/sensor/dist/extraction/cfml-extractor.d.ts.map +1 -1
  55. package/sensor/dist/extraction/cfml-extractor.js +15 -3
  56. package/sensor/dist/extraction/cfml-extractor.js.map +1 -1
  57. package/sensor/dist/extraction/dfm-extractor.d.ts.map +1 -1
  58. package/sensor/dist/extraction/dfm-extractor.js +14 -10
  59. package/sensor/dist/extraction/dfm-extractor.js.map +1 -1
  60. package/sensor/dist/extraction/extraction-version.d.ts +1 -1
  61. package/sensor/dist/extraction/extraction-version.d.ts.map +1 -1
  62. package/sensor/dist/extraction/extraction-version.js +3 -1
  63. package/sensor/dist/extraction/extraction-version.js.map +1 -1
  64. package/sensor/dist/extraction/function-ref.d.ts +6 -4
  65. package/sensor/dist/extraction/function-ref.d.ts.map +1 -1
  66. package/sensor/dist/extraction/function-ref.js +35 -14
  67. package/sensor/dist/extraction/function-ref.js.map +1 -1
  68. package/sensor/dist/extraction/generated-detection.d.ts +48 -12
  69. package/sensor/dist/extraction/generated-detection.d.ts.map +1 -1
  70. package/sensor/dist/extraction/generated-detection.js +176 -11
  71. package/sensor/dist/extraction/generated-detection.js.map +1 -1
  72. package/sensor/dist/extraction/grammars.d.ts +38 -0
  73. package/sensor/dist/extraction/grammars.d.ts.map +1 -1
  74. package/sensor/dist/extraction/grammars.js +115 -3
  75. package/sensor/dist/extraction/grammars.js.map +1 -1
  76. package/sensor/dist/extraction/index.d.ts +218 -14
  77. package/sensor/dist/extraction/index.d.ts.map +1 -1
  78. package/sensor/dist/extraction/index.js +887 -175
  79. package/sensor/dist/extraction/index.js.map +1 -1
  80. package/sensor/dist/extraction/languages/c-cpp.d.ts +58 -0
  81. package/sensor/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  82. package/sensor/dist/extraction/languages/c-cpp.js +310 -19
  83. package/sensor/dist/extraction/languages/c-cpp.js.map +1 -1
  84. package/sensor/dist/extraction/languages/dart.d.ts.map +1 -1
  85. package/sensor/dist/extraction/languages/dart.js +8 -3
  86. package/sensor/dist/extraction/languages/dart.js.map +1 -1
  87. package/sensor/dist/extraction/languages/erlang.d.ts.map +1 -1
  88. package/sensor/dist/extraction/languages/erlang.js +58 -22
  89. package/sensor/dist/extraction/languages/erlang.js.map +1 -1
  90. package/sensor/dist/extraction/languages/javascript.js +1 -1
  91. package/sensor/dist/extraction/languages/javascript.js.map +1 -1
  92. package/sensor/dist/extraction/languages/kotlin.d.ts.map +1 -1
  93. package/sensor/dist/extraction/languages/kotlin.js +169 -36
  94. package/sensor/dist/extraction/languages/kotlin.js.map +1 -1
  95. package/sensor/dist/extraction/languages/lua.d.ts.map +1 -1
  96. package/sensor/dist/extraction/languages/lua.js +4 -1
  97. package/sensor/dist/extraction/languages/lua.js.map +1 -1
  98. package/sensor/dist/extraction/languages/objc.d.ts.map +1 -1
  99. package/sensor/dist/extraction/languages/objc.js +4 -0
  100. package/sensor/dist/extraction/languages/objc.js.map +1 -1
  101. package/sensor/dist/extraction/languages/python.d.ts.map +1 -1
  102. package/sensor/dist/extraction/languages/python.js +71 -0
  103. package/sensor/dist/extraction/languages/python.js.map +1 -1
  104. package/sensor/dist/extraction/languages/rust.d.ts +20 -0
  105. package/sensor/dist/extraction/languages/rust.d.ts.map +1 -1
  106. package/sensor/dist/extraction/languages/rust.js +50 -20
  107. package/sensor/dist/extraction/languages/rust.js.map +1 -1
  108. package/sensor/dist/extraction/languages/scala.d.ts.map +1 -1
  109. package/sensor/dist/extraction/languages/scala.js +18 -3
  110. package/sensor/dist/extraction/languages/scala.js.map +1 -1
  111. package/sensor/dist/extraction/languages/swift.d.ts +15 -0
  112. package/sensor/dist/extraction/languages/swift.d.ts.map +1 -1
  113. package/sensor/dist/extraction/languages/swift.js +50 -0
  114. package/sensor/dist/extraction/languages/swift.js.map +1 -1
  115. package/sensor/dist/extraction/languages/typescript.d.ts.map +1 -1
  116. package/sensor/dist/extraction/languages/typescript.js +9 -2
  117. package/sensor/dist/extraction/languages/typescript.js.map +1 -1
  118. package/sensor/dist/extraction/liquid-extractor.d.ts +18 -0
  119. package/sensor/dist/extraction/liquid-extractor.d.ts.map +1 -1
  120. package/sensor/dist/extraction/liquid-extractor.js +98 -22
  121. package/sensor/dist/extraction/liquid-extractor.js.map +1 -1
  122. package/sensor/dist/extraction/mybatis-extractor.d.ts.map +1 -1
  123. package/sensor/dist/extraction/mybatis-extractor.js +6 -4
  124. package/sensor/dist/extraction/mybatis-extractor.js.map +1 -1
  125. package/sensor/dist/extraction/parse-pool.d.ts +7 -0
  126. package/sensor/dist/extraction/parse-pool.d.ts.map +1 -1
  127. package/sensor/dist/extraction/parse-pool.js +20 -1
  128. package/sensor/dist/extraction/parse-pool.js.map +1 -1
  129. package/sensor/dist/extraction/syntax-tokens.d.ts +103 -0
  130. package/sensor/dist/extraction/syntax-tokens.d.ts.map +1 -0
  131. package/sensor/dist/extraction/syntax-tokens.js +381 -0
  132. package/sensor/dist/extraction/syntax-tokens.js.map +1 -0
  133. package/sensor/dist/extraction/tree-sitter-helpers.d.ts +5 -0
  134. package/sensor/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  135. package/sensor/dist/extraction/tree-sitter-helpers.js +17 -0
  136. package/sensor/dist/extraction/tree-sitter-helpers.js.map +1 -1
  137. package/sensor/dist/extraction/tree-sitter-types.d.ts +31 -3
  138. package/sensor/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  139. package/sensor/dist/extraction/tree-sitter.d.ts +101 -18
  140. package/sensor/dist/extraction/tree-sitter.d.ts.map +1 -1
  141. package/sensor/dist/extraction/tree-sitter.js +928 -134
  142. package/sensor/dist/extraction/tree-sitter.js.map +1 -1
  143. package/sensor/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  144. package/sensor/dist/file-limits.d.ts +40 -0
  145. package/sensor/dist/file-limits.d.ts.map +1 -0
  146. package/sensor/dist/file-limits.js +147 -0
  147. package/sensor/dist/file-limits.js.map +1 -0
  148. package/sensor/dist/graph/branch-guards.d.ts +265 -0
  149. package/sensor/dist/graph/branch-guards.d.ts.map +1 -0
  150. package/sensor/dist/graph/branch-guards.js +2325 -0
  151. package/sensor/dist/graph/branch-guards.js.map +1 -0
  152. package/sensor/dist/graph/dead-code.d.ts +251 -0
  153. package/sensor/dist/graph/dead-code.d.ts.map +1 -0
  154. package/sensor/dist/graph/dead-code.js +776 -0
  155. package/sensor/dist/graph/dead-code.js.map +1 -0
  156. package/sensor/dist/graph/dynamic-boundary-report.d.ts +121 -0
  157. package/sensor/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
  158. package/sensor/dist/graph/dynamic-boundary-report.js +283 -0
  159. package/sensor/dist/graph/dynamic-boundary-report.js.map +1 -0
  160. package/sensor/dist/graph/index.d.ts +4 -0
  161. package/sensor/dist/graph/index.d.ts.map +1 -1
  162. package/sensor/dist/graph/index.js +16 -1
  163. package/sensor/dist/graph/index.js.map +1 -1
  164. package/sensor/dist/graph/named-symbol-flow.d.ts +125 -0
  165. package/sensor/dist/graph/named-symbol-flow.d.ts.map +1 -0
  166. package/sensor/dist/graph/named-symbol-flow.js +552 -0
  167. package/sensor/dist/graph/named-symbol-flow.js.map +1 -0
  168. package/sensor/dist/graph/queries.d.ts.map +1 -1
  169. package/sensor/dist/graph/queries.js +2 -0
  170. package/sensor/dist/graph/queries.js.map +1 -1
  171. package/sensor/dist/graph/symbol-lookup.d.ts +83 -0
  172. package/sensor/dist/graph/symbol-lookup.d.ts.map +1 -0
  173. package/sensor/dist/graph/symbol-lookup.js +181 -0
  174. package/sensor/dist/graph/symbol-lookup.js.map +1 -0
  175. package/sensor/dist/graph/traversal.d.ts +9 -0
  176. package/sensor/dist/graph/traversal.d.ts.map +1 -1
  177. package/sensor/dist/graph/traversal.js +62 -36
  178. package/sensor/dist/graph/traversal.js.map +1 -1
  179. package/sensor/dist/graph/type-hierarchy.d.ts +155 -0
  180. package/sensor/dist/graph/type-hierarchy.d.ts.map +1 -0
  181. package/sensor/dist/graph/type-hierarchy.js +382 -0
  182. package/sensor/dist/graph/type-hierarchy.js.map +1 -0
  183. package/sensor/dist/index.d.ts +272 -10
  184. package/sensor/dist/index.d.ts.map +1 -1
  185. package/sensor/dist/index.js +510 -34
  186. package/sensor/dist/index.js.map +1 -1
  187. package/sensor/dist/mcp/answer-freshness.d.ts +10 -0
  188. package/sensor/dist/mcp/answer-freshness.d.ts.map +1 -0
  189. package/sensor/dist/mcp/answer-freshness.js +68 -0
  190. package/sensor/dist/mcp/answer-freshness.js.map +1 -0
  191. package/sensor/dist/mcp/daemon-manager.d.ts +1 -1
  192. package/sensor/dist/mcp/daemon-manager.d.ts.map +1 -1
  193. package/sensor/dist/mcp/daemon-manager.js +17 -1
  194. package/sensor/dist/mcp/daemon-manager.js.map +1 -1
  195. package/sensor/dist/mcp/daemon-paths.d.ts +8 -0
  196. package/sensor/dist/mcp/daemon-paths.d.ts.map +1 -1
  197. package/sensor/dist/mcp/daemon-paths.js +65 -2
  198. package/sensor/dist/mcp/daemon-paths.js.map +1 -1
  199. package/sensor/dist/mcp/daemon-registry.d.ts +17 -4
  200. package/sensor/dist/mcp/daemon-registry.d.ts.map +1 -1
  201. package/sensor/dist/mcp/daemon-registry.js +133 -23
  202. package/sensor/dist/mcp/daemon-registry.js.map +1 -1
  203. package/sensor/dist/mcp/daemon.d.ts +26 -13
  204. package/sensor/dist/mcp/daemon.d.ts.map +1 -1
  205. package/sensor/dist/mcp/daemon.js +126 -32
  206. package/sensor/dist/mcp/daemon.js.map +1 -1
  207. package/sensor/dist/mcp/dynamic-boundaries.d.ts +1 -10
  208. package/sensor/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
  209. package/sensor/dist/mcp/dynamic-boundaries.js +46 -42
  210. package/sensor/dist/mcp/dynamic-boundaries.js.map +1 -1
  211. package/sensor/dist/mcp/engine.d.ts +31 -9
  212. package/sensor/dist/mcp/engine.d.ts.map +1 -1
  213. package/sensor/dist/mcp/engine.js +190 -79
  214. package/sensor/dist/mcp/engine.js.map +1 -1
  215. package/sensor/dist/mcp/explore-dedup.d.ts +140 -0
  216. package/sensor/dist/mcp/explore-dedup.d.ts.map +1 -0
  217. package/sensor/dist/mcp/explore-dedup.js +239 -0
  218. package/sensor/dist/mcp/explore-dedup.js.map +1 -0
  219. package/sensor/dist/mcp/explore-diagnostics.d.ts +289 -0
  220. package/sensor/dist/mcp/explore-diagnostics.d.ts.map +1 -0
  221. package/sensor/dist/mcp/explore-diagnostics.js +558 -0
  222. package/sensor/dist/mcp/explore-diagnostics.js.map +1 -0
  223. package/sensor/dist/mcp/explore-session-state.d.ts +217 -0
  224. package/sensor/dist/mcp/explore-session-state.d.ts.map +1 -0
  225. package/sensor/dist/mcp/explore-session-state.js +322 -0
  226. package/sensor/dist/mcp/explore-session-state.js.map +1 -0
  227. package/sensor/dist/mcp/index-freshness-worker.d.ts +2 -0
  228. package/sensor/dist/mcp/index-freshness-worker.d.ts.map +1 -0
  229. package/sensor/dist/mcp/index-freshness-worker.js +30 -0
  230. package/sensor/dist/mcp/index-freshness-worker.js.map +1 -0
  231. package/sensor/dist/mcp/index-freshness.d.ts +7 -0
  232. package/sensor/dist/mcp/index-freshness.d.ts.map +1 -0
  233. package/sensor/dist/mcp/index-freshness.js +94 -0
  234. package/sensor/dist/mcp/index-freshness.js.map +1 -0
  235. package/sensor/dist/mcp/index.d.ts +3 -1
  236. package/sensor/dist/mcp/index.d.ts.map +1 -1
  237. package/sensor/dist/mcp/index.js +109 -12
  238. package/sensor/dist/mcp/index.js.map +1 -1
  239. package/sensor/dist/mcp/liveness-watchdog.d.ts +4 -1
  240. package/sensor/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  241. package/sensor/dist/mcp/liveness-watchdog.js +11 -2
  242. package/sensor/dist/mcp/liveness-watchdog.js.map +1 -1
  243. package/sensor/dist/mcp/project-lifecycle.d.ts +9 -0
  244. package/sensor/dist/mcp/project-lifecycle.d.ts.map +1 -0
  245. package/sensor/dist/mcp/project-lifecycle.js +182 -0
  246. package/sensor/dist/mcp/project-lifecycle.js.map +1 -0
  247. package/sensor/dist/mcp/proxy.d.ts.map +1 -1
  248. package/sensor/dist/mcp/proxy.js +15 -1
  249. package/sensor/dist/mcp/proxy.js.map +1 -1
  250. package/sensor/dist/mcp/query-pool.d.ts +2 -2
  251. package/sensor/dist/mcp/query-pool.d.ts.map +1 -1
  252. package/sensor/dist/mcp/query-pool.js +9 -7
  253. package/sensor/dist/mcp/query-pool.js.map +1 -1
  254. package/sensor/dist/mcp/query-worker.js +2 -2
  255. package/sensor/dist/mcp/query-worker.js.map +1 -1
  256. package/sensor/dist/mcp/server-instructions.d.ts +2 -2
  257. package/sensor/dist/mcp/server-instructions.d.ts.map +1 -1
  258. package/sensor/dist/mcp/server-instructions.js +13 -6
  259. package/sensor/dist/mcp/server-instructions.js.map +1 -1
  260. package/sensor/dist/mcp/session.d.ts +16 -0
  261. package/sensor/dist/mcp/session.d.ts.map +1 -1
  262. package/sensor/dist/mcp/session.js +36 -13
  263. package/sensor/dist/mcp/session.js.map +1 -1
  264. package/sensor/dist/mcp/startup-handshake.d.ts +3 -1
  265. package/sensor/dist/mcp/startup-handshake.d.ts.map +1 -1
  266. package/sensor/dist/mcp/startup-handshake.js +10 -2
  267. package/sensor/dist/mcp/startup-handshake.js.map +1 -1
  268. package/sensor/dist/mcp/tools.d.ts +496 -38
  269. package/sensor/dist/mcp/tools.d.ts.map +1 -1
  270. package/sensor/dist/mcp/tools.js +4021 -772
  271. package/sensor/dist/mcp/tools.js.map +1 -1
  272. package/sensor/dist/mcp/writer-lock.d.ts +61 -0
  273. package/sensor/dist/mcp/writer-lock.d.ts.map +1 -0
  274. package/sensor/dist/mcp/writer-lock.js +260 -0
  275. package/sensor/dist/mcp/writer-lock.js.map +1 -0
  276. package/sensor/dist/project-config.d.ts +23 -0
  277. package/sensor/dist/project-config.d.ts.map +1 -1
  278. package/sensor/dist/project-config.js +39 -2
  279. package/sensor/dist/project-config.js.map +1 -1
  280. package/sensor/dist/resolution/alias-binding.d.ts +56 -0
  281. package/sensor/dist/resolution/alias-binding.d.ts.map +1 -0
  282. package/sensor/dist/resolution/alias-binding.js +127 -0
  283. package/sensor/dist/resolution/alias-binding.js.map +1 -0
  284. package/sensor/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  285. package/sensor/dist/resolution/c-fnptr-synthesizer.js +21 -19
  286. package/sensor/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  287. package/sensor/dist/resolution/callback-synthesizer.d.ts +23 -1
  288. package/sensor/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  289. package/sensor/dist/resolution/callback-synthesizer.js +356 -155
  290. package/sensor/dist/resolution/callback-synthesizer.js.map +1 -1
  291. package/sensor/dist/resolution/cpp-constructor.d.ts +4 -0
  292. package/sensor/dist/resolution/cpp-constructor.d.ts.map +1 -0
  293. package/sensor/dist/resolution/cpp-constructor.js +123 -0
  294. package/sensor/dist/resolution/cpp-constructor.js.map +1 -0
  295. package/sensor/dist/resolution/cpp-macro-visibility.d.ts +12 -0
  296. package/sensor/dist/resolution/cpp-macro-visibility.d.ts.map +1 -0
  297. package/sensor/dist/resolution/cpp-macro-visibility.js +342 -0
  298. package/sensor/dist/resolution/cpp-macro-visibility.js.map +1 -0
  299. package/sensor/dist/resolution/expo-router-synthesizer.d.ts +32 -0
  300. package/sensor/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
  301. package/sensor/dist/resolution/expo-router-synthesizer.js +189 -0
  302. package/sensor/dist/resolution/expo-router-synthesizer.js.map +1 -0
  303. package/sensor/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  304. package/sensor/dist/resolution/frameworks/csharp.js +96 -2
  305. package/sensor/dist/resolution/frameworks/csharp.js.map +1 -1
  306. package/sensor/dist/resolution/frameworks/expo-router.d.ts +189 -0
  307. package/sensor/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
  308. package/sensor/dist/resolution/frameworks/expo-router.js +785 -0
  309. package/sensor/dist/resolution/frameworks/expo-router.js.map +1 -0
  310. package/sensor/dist/resolution/frameworks/express.d.ts.map +1 -1
  311. package/sensor/dist/resolution/frameworks/express.js +251 -16
  312. package/sensor/dist/resolution/frameworks/express.js.map +1 -1
  313. package/sensor/dist/resolution/frameworks/index.d.ts +5 -0
  314. package/sensor/dist/resolution/frameworks/index.d.ts.map +1 -1
  315. package/sensor/dist/resolution/frameworks/index.js +29 -1
  316. package/sensor/dist/resolution/frameworks/index.js.map +1 -1
  317. package/sensor/dist/resolution/frameworks/java.d.ts.map +1 -1
  318. package/sensor/dist/resolution/frameworks/java.js +79 -47
  319. package/sensor/dist/resolution/frameworks/java.js.map +1 -1
  320. package/sensor/dist/resolution/frameworks/laravel.d.ts.map +1 -1
  321. package/sensor/dist/resolution/frameworks/laravel.js +294 -4
  322. package/sensor/dist/resolution/frameworks/laravel.js.map +1 -1
  323. package/sensor/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
  324. package/sensor/dist/resolution/frameworks/nestjs.js +6 -14
  325. package/sensor/dist/resolution/frameworks/nestjs.js.map +1 -1
  326. package/sensor/dist/resolution/frameworks/nextjs.d.ts +76 -0
  327. package/sensor/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
  328. package/sensor/dist/resolution/frameworks/nextjs.js +328 -0
  329. package/sensor/dist/resolution/frameworks/nextjs.js.map +1 -0
  330. package/sensor/dist/resolution/frameworks/object-literal.d.ts +32 -0
  331. package/sensor/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
  332. package/sensor/dist/resolution/frameworks/object-literal.js +139 -0
  333. package/sensor/dist/resolution/frameworks/object-literal.js.map +1 -0
  334. package/sensor/dist/resolution/frameworks/package-deps.d.ts +14 -0
  335. package/sensor/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
  336. package/sensor/dist/resolution/frameworks/package-deps.js +78 -0
  337. package/sensor/dist/resolution/frameworks/package-deps.js.map +1 -0
  338. package/sensor/dist/resolution/frameworks/python.d.ts.map +1 -1
  339. package/sensor/dist/resolution/frameworks/python.js +166 -0
  340. package/sensor/dist/resolution/frameworks/python.js.map +1 -1
  341. package/sensor/dist/resolution/frameworks/react-native.d.ts +26 -0
  342. package/sensor/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  343. package/sensor/dist/resolution/frameworks/react-native.js +153 -14
  344. package/sensor/dist/resolution/frameworks/react-native.js.map +1 -1
  345. package/sensor/dist/resolution/frameworks/react-router.d.ts +46 -0
  346. package/sensor/dist/resolution/frameworks/react-router.d.ts.map +1 -0
  347. package/sensor/dist/resolution/frameworks/react-router.js +187 -0
  348. package/sensor/dist/resolution/frameworks/react-router.js.map +1 -0
  349. package/sensor/dist/resolution/frameworks/react.d.ts +2 -1
  350. package/sensor/dist/resolution/frameworks/react.d.ts.map +1 -1
  351. package/sensor/dist/resolution/frameworks/react.js +188 -139
  352. package/sensor/dist/resolution/frameworks/react.js.map +1 -1
  353. package/sensor/dist/resolution/frameworks/svelte.d.ts.map +1 -1
  354. package/sensor/dist/resolution/frameworks/svelte.js +6 -1
  355. package/sensor/dist/resolution/frameworks/svelte.js.map +1 -1
  356. package/sensor/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
  357. package/sensor/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
  358. package/sensor/dist/resolution/frameworks/sveltekit-router.js +156 -0
  359. package/sensor/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
  360. package/sensor/dist/resolution/frameworks/swift.d.ts.map +1 -1
  361. package/sensor/dist/resolution/frameworks/swift.js +140 -99
  362. package/sensor/dist/resolution/frameworks/swift.js.map +1 -1
  363. package/sensor/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
  364. package/sensor/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
  365. package/sensor/dist/resolution/frameworks/tanstack-router.js +437 -0
  366. package/sensor/dist/resolution/frameworks/tanstack-router.js.map +1 -0
  367. package/sensor/dist/resolution/frameworks/vue-router.d.ts +82 -0
  368. package/sensor/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
  369. package/sensor/dist/resolution/frameworks/vue-router.js +377 -0
  370. package/sensor/dist/resolution/frameworks/vue-router.js.map +1 -0
  371. package/sensor/dist/resolution/import-resolver.d.ts +38 -0
  372. package/sensor/dist/resolution/import-resolver.d.ts.map +1 -1
  373. package/sensor/dist/resolution/import-resolver.js +394 -28
  374. package/sensor/dist/resolution/import-resolver.js.map +1 -1
  375. package/sensor/dist/resolution/index.d.ts +89 -25
  376. package/sensor/dist/resolution/index.d.ts.map +1 -1
  377. package/sensor/dist/resolution/index.js +573 -148
  378. package/sensor/dist/resolution/index.js.map +1 -1
  379. package/sensor/dist/resolution/js-builtins.d.ts +13 -0
  380. package/sensor/dist/resolution/js-builtins.d.ts.map +1 -0
  381. package/sensor/dist/resolution/js-builtins.js +46 -0
  382. package/sensor/dist/resolution/js-builtins.js.map +1 -0
  383. package/sensor/dist/resolution/name-matcher.d.ts +99 -22
  384. package/sensor/dist/resolution/name-matcher.d.ts.map +1 -1
  385. package/sensor/dist/resolution/name-matcher.js +2220 -86
  386. package/sensor/dist/resolution/name-matcher.js.map +1 -1
  387. package/sensor/dist/resolution/next-router-synthesizer.d.ts +27 -0
  388. package/sensor/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
  389. package/sensor/dist/resolution/next-router-synthesizer.js +113 -0
  390. package/sensor/dist/resolution/next-router-synthesizer.js.map +1 -0
  391. package/sensor/dist/resolution/path-aliases.d.ts +6 -4
  392. package/sensor/dist/resolution/path-aliases.d.ts.map +1 -1
  393. package/sensor/dist/resolution/path-aliases.js +125 -17
  394. package/sensor/dist/resolution/path-aliases.js.map +1 -1
  395. package/sensor/dist/resolution/react-router-synthesizer.d.ts +33 -0
  396. package/sensor/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
  397. package/sensor/dist/resolution/react-router-synthesizer.js +126 -0
  398. package/sensor/dist/resolution/react-router-synthesizer.js.map +1 -0
  399. package/sensor/dist/resolution/resolver-pool.d.ts +2 -0
  400. package/sensor/dist/resolution/resolver-pool.d.ts.map +1 -1
  401. package/sensor/dist/resolution/resolver-pool.js +4 -0
  402. package/sensor/dist/resolution/resolver-pool.js.map +1 -1
  403. package/sensor/dist/resolution/strip-comments.d.ts +6 -0
  404. package/sensor/dist/resolution/strip-comments.d.ts.map +1 -1
  405. package/sensor/dist/resolution/strip-comments.js +58 -0
  406. package/sensor/dist/resolution/strip-comments.js.map +1 -1
  407. package/sensor/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
  408. package/sensor/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
  409. package/sensor/dist/resolution/sveltekit-synthesizer.js +173 -0
  410. package/sensor/dist/resolution/sveltekit-synthesizer.js.map +1 -0
  411. package/sensor/dist/resolution/swift-type-visibility.d.ts +52 -0
  412. package/sensor/dist/resolution/swift-type-visibility.d.ts.map +1 -0
  413. package/sensor/dist/resolution/swift-type-visibility.js +328 -0
  414. package/sensor/dist/resolution/swift-type-visibility.js.map +1 -0
  415. package/sensor/dist/resolution/synth-utils.d.ts +26 -0
  416. package/sensor/dist/resolution/synth-utils.d.ts.map +1 -0
  417. package/sensor/dist/resolution/synth-utils.js +75 -0
  418. package/sensor/dist/resolution/synth-utils.js.map +1 -0
  419. package/sensor/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
  420. package/sensor/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
  421. package/sensor/dist/resolution/tanstack-router-synthesizer.js +114 -0
  422. package/sensor/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
  423. package/sensor/dist/resolution/tier-synthesizer.d.ts +54 -0
  424. package/sensor/dist/resolution/tier-synthesizer.d.ts.map +1 -0
  425. package/sensor/dist/resolution/tier-synthesizer.js +1294 -0
  426. package/sensor/dist/resolution/tier-synthesizer.js.map +1 -0
  427. package/sensor/dist/resolution/types.d.ts +78 -2
  428. package/sensor/dist/resolution/types.d.ts.map +1 -1
  429. package/sensor/dist/resolution/types.js +64 -0
  430. package/sensor/dist/resolution/types.js.map +1 -1
  431. package/sensor/dist/resolution/vue-router-synthesizer.d.ts +30 -0
  432. package/sensor/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
  433. package/sensor/dist/resolution/vue-router-synthesizer.js +115 -0
  434. package/sensor/dist/resolution/vue-router-synthesizer.js.map +1 -0
  435. package/sensor/dist/search/identifier-segments.d.ts +10 -0
  436. package/sensor/dist/search/identifier-segments.d.ts.map +1 -1
  437. package/sensor/dist/search/identifier-segments.js +29 -0
  438. package/sensor/dist/search/identifier-segments.js.map +1 -1
  439. package/sensor/dist/search/query-paths.d.ts +106 -0
  440. package/sensor/dist/search/query-paths.d.ts.map +1 -0
  441. package/sensor/dist/search/query-paths.js +513 -0
  442. package/sensor/dist/search/query-paths.js.map +1 -0
  443. package/sensor/dist/search/query-utils.d.ts +22 -2
  444. package/sensor/dist/search/query-utils.d.ts.map +1 -1
  445. package/sensor/dist/search/query-utils.js +56 -16
  446. package/sensor/dist/search/query-utils.js.map +1 -1
  447. package/sensor/dist/sync/watch-policy.d.ts +14 -0
  448. package/sensor/dist/sync/watch-policy.d.ts.map +1 -1
  449. package/sensor/dist/sync/watch-policy.js +19 -0
  450. package/sensor/dist/sync/watch-policy.js.map +1 -1
  451. package/sensor/dist/sync/watcher.d.ts +74 -35
  452. package/sensor/dist/sync/watcher.d.ts.map +1 -1
  453. package/sensor/dist/sync/watcher.js +281 -99
  454. package/sensor/dist/sync/watcher.js.map +1 -1
  455. package/sensor/dist/telemetry/index.d.ts +4 -2
  456. package/sensor/dist/telemetry/index.d.ts.map +1 -1
  457. package/sensor/dist/telemetry/index.js +92 -41
  458. package/sensor/dist/telemetry/index.js.map +1 -1
  459. package/sensor/dist/types.d.ts +18 -2
  460. package/sensor/dist/types.d.ts.map +1 -1
  461. package/sensor/dist/types.js +2 -0
  462. package/sensor/dist/types.js.map +1 -1
  463. package/sensor/dist/ui-server/api/deadcode.d.ts +84 -0
  464. package/sensor/dist/ui-server/api/deadcode.d.ts.map +1 -0
  465. package/sensor/dist/ui-server/api/deadcode.js +136 -0
  466. package/sensor/dist/ui-server/api/deadcode.js.map +1 -0
  467. package/sensor/dist/ui-server/api/effects.d.ts +94 -0
  468. package/sensor/dist/ui-server/api/effects.d.ts.map +1 -0
  469. package/sensor/dist/ui-server/api/effects.js +527 -0
  470. package/sensor/dist/ui-server/api/effects.js.map +1 -0
  471. package/sensor/dist/ui-server/api/entrypoints.d.ts +92 -0
  472. package/sensor/dist/ui-server/api/entrypoints.d.ts.map +1 -0
  473. package/sensor/dist/ui-server/api/entrypoints.js +361 -0
  474. package/sensor/dist/ui-server/api/entrypoints.js.map +1 -0
  475. package/sensor/dist/ui-server/api/events.d.ts +183 -0
  476. package/sensor/dist/ui-server/api/events.d.ts.map +1 -0
  477. package/sensor/dist/ui-server/api/events.js +430 -0
  478. package/sensor/dist/ui-server/api/events.js.map +1 -0
  479. package/sensor/dist/ui-server/api/file.d.ts +66 -0
  480. package/sensor/dist/ui-server/api/file.d.ts.map +1 -0
  481. package/sensor/dist/ui-server/api/file.js +235 -0
  482. package/sensor/dist/ui-server/api/file.js.map +1 -0
  483. package/sensor/dist/ui-server/api/filecode.d.ts +126 -0
  484. package/sensor/dist/ui-server/api/filecode.d.ts.map +1 -0
  485. package/sensor/dist/ui-server/api/filecode.js +205 -0
  486. package/sensor/dist/ui-server/api/filecode.js.map +1 -0
  487. package/sensor/dist/ui-server/api/flow.d.ts +226 -0
  488. package/sensor/dist/ui-server/api/flow.d.ts.map +1 -0
  489. package/sensor/dist/ui-server/api/flow.js +612 -0
  490. package/sensor/dist/ui-server/api/flow.js.map +1 -0
  491. package/sensor/dist/ui-server/api/hierarchy.d.ts +81 -0
  492. package/sensor/dist/ui-server/api/hierarchy.d.ts.map +1 -0
  493. package/sensor/dist/ui-server/api/hierarchy.js +92 -0
  494. package/sensor/dist/ui-server/api/hierarchy.js.map +1 -0
  495. package/sensor/dist/ui-server/api/index.d.ts +90 -0
  496. package/sensor/dist/ui-server/api/index.d.ts.map +1 -0
  497. package/sensor/dist/ui-server/api/index.js +332 -0
  498. package/sensor/dist/ui-server/api/index.js.map +1 -0
  499. package/sensor/dist/ui-server/api/map.d.ts +256 -0
  500. package/sensor/dist/ui-server/api/map.d.ts.map +1 -0
  501. package/sensor/dist/ui-server/api/map.js +760 -0
  502. package/sensor/dist/ui-server/api/map.js.map +1 -0
  503. package/sensor/dist/ui-server/api/node.d.ts +81 -0
  504. package/sensor/dist/ui-server/api/node.d.ts.map +1 -0
  505. package/sensor/dist/ui-server/api/node.js +388 -0
  506. package/sensor/dist/ui-server/api/node.js.map +1 -0
  507. package/sensor/dist/ui-server/api/nodes.d.ts +25 -0
  508. package/sensor/dist/ui-server/api/nodes.d.ts.map +1 -0
  509. package/sensor/dist/ui-server/api/nodes.js +45 -0
  510. package/sensor/dist/ui-server/api/nodes.js.map +1 -0
  511. package/sensor/dist/ui-server/api/program.d.ts +139 -0
  512. package/sensor/dist/ui-server/api/program.d.ts.map +1 -0
  513. package/sensor/dist/ui-server/api/program.js +315 -0
  514. package/sensor/dist/ui-server/api/program.js.map +1 -0
  515. package/sensor/dist/ui-server/api/respond.d.ts +76 -0
  516. package/sensor/dist/ui-server/api/respond.d.ts.map +1 -0
  517. package/sensor/dist/ui-server/api/respond.js +186 -0
  518. package/sensor/dist/ui-server/api/respond.js.map +1 -0
  519. package/sensor/dist/ui-server/api/route-roots.d.ts +39 -0
  520. package/sensor/dist/ui-server/api/route-roots.d.ts.map +1 -0
  521. package/sensor/dist/ui-server/api/route-roots.js +96 -0
  522. package/sensor/dist/ui-server/api/route-roots.js.map +1 -0
  523. package/sensor/dist/ui-server/api/routes.d.ts +59 -0
  524. package/sensor/dist/ui-server/api/routes.d.ts.map +1 -0
  525. package/sensor/dist/ui-server/api/routes.js +108 -0
  526. package/sensor/dist/ui-server/api/routes.js.map +1 -0
  527. package/sensor/dist/ui-server/api/screens.d.ts +117 -0
  528. package/sensor/dist/ui-server/api/screens.d.ts.map +1 -0
  529. package/sensor/dist/ui-server/api/screens.js +611 -0
  530. package/sensor/dist/ui-server/api/screens.js.map +1 -0
  531. package/sensor/dist/ui-server/api/search.d.ts +29 -0
  532. package/sensor/dist/ui-server/api/search.d.ts.map +1 -0
  533. package/sensor/dist/ui-server/api/search.js +232 -0
  534. package/sensor/dist/ui-server/api/search.js.map +1 -0
  535. package/sensor/dist/ui-server/api/session.d.ts +52 -0
  536. package/sensor/dist/ui-server/api/session.d.ts.map +1 -0
  537. package/sensor/dist/ui-server/api/session.js +196 -0
  538. package/sensor/dist/ui-server/api/session.js.map +1 -0
  539. package/sensor/dist/ui-server/api/source.d.ts +200 -0
  540. package/sensor/dist/ui-server/api/source.d.ts.map +1 -0
  541. package/sensor/dist/ui-server/api/source.js +422 -0
  542. package/sensor/dist/ui-server/api/source.js.map +1 -0
  543. package/sensor/dist/ui-server/api/stats.d.ts +27 -0
  544. package/sensor/dist/ui-server/api/stats.d.ts.map +1 -0
  545. package/sensor/dist/ui-server/api/stats.js +164 -0
  546. package/sensor/dist/ui-server/api/stats.js.map +1 -0
  547. package/sensor/dist/ui-server/api/steps.d.ts +274 -0
  548. package/sensor/dist/ui-server/api/steps.d.ts.map +1 -0
  549. package/sensor/dist/ui-server/api/steps.js +1544 -0
  550. package/sensor/dist/ui-server/api/steps.js.map +1 -0
  551. package/sensor/dist/ui-server/api/trail-store.d.ts +142 -0
  552. package/sensor/dist/ui-server/api/trail-store.d.ts.map +1 -0
  553. package/sensor/dist/ui-server/api/trail-store.js +325 -0
  554. package/sensor/dist/ui-server/api/trail-store.js.map +1 -0
  555. package/sensor/dist/ui-server/api/trails.d.ts +163 -0
  556. package/sensor/dist/ui-server/api/trails.d.ts.map +1 -0
  557. package/sensor/dist/ui-server/api/trails.js +369 -0
  558. package/sensor/dist/ui-server/api/trails.js.map +1 -0
  559. package/sensor/dist/ui-server/api/when.d.ts +133 -0
  560. package/sensor/dist/ui-server/api/when.d.ts.map +1 -0
  561. package/sensor/dist/ui-server/api/when.js +275 -0
  562. package/sensor/dist/ui-server/api/when.js.map +1 -0
  563. package/sensor/dist/ui-server/api/wire.d.ts +179 -0
  564. package/sensor/dist/ui-server/api/wire.d.ts.map +1 -0
  565. package/sensor/dist/ui-server/api/wire.js +231 -0
  566. package/sensor/dist/ui-server/api/wire.js.map +1 -0
  567. package/sensor/dist/ui-server/assets.d.ts +40 -0
  568. package/sensor/dist/ui-server/assets.d.ts.map +1 -0
  569. package/sensor/dist/ui-server/assets.js +110 -0
  570. package/sensor/dist/ui-server/assets.js.map +1 -0
  571. package/sensor/dist/ui-server/constants.d.ts +32 -0
  572. package/sensor/dist/ui-server/constants.d.ts.map +1 -0
  573. package/sensor/dist/ui-server/constants.js +35 -0
  574. package/sensor/dist/ui-server/constants.js.map +1 -0
  575. package/sensor/dist/ui-server/highlight/index.d.ts +113 -0
  576. package/sensor/dist/ui-server/highlight/index.d.ts.map +1 -0
  577. package/sensor/dist/ui-server/highlight/index.js +307 -0
  578. package/sensor/dist/ui-server/highlight/index.js.map +1 -0
  579. package/sensor/dist/ui-server/highlight/languages.d.ts +36 -0
  580. package/sensor/dist/ui-server/highlight/languages.d.ts.map +1 -0
  581. package/sensor/dist/ui-server/highlight/languages.js +50 -0
  582. package/sensor/dist/ui-server/highlight/languages.js.map +1 -0
  583. package/sensor/dist/ui-server/index.d.ts +92 -0
  584. package/sensor/dist/ui-server/index.d.ts.map +1 -0
  585. package/sensor/dist/ui-server/index.js +399 -0
  586. package/sensor/dist/ui-server/index.js.map +1 -0
  587. package/sensor/dist/ui-server/open-browser.d.ts +31 -0
  588. package/sensor/dist/ui-server/open-browser.d.ts.map +1 -0
  589. package/sensor/dist/ui-server/open-browser.js +79 -0
  590. package/sensor/dist/ui-server/open-browser.js.map +1 -0
  591. package/sensor/dist/ui-server/security.d.ts +127 -0
  592. package/sensor/dist/ui-server/security.d.ts.map +1 -0
  593. package/sensor/dist/ui-server/security.js +332 -0
  594. package/sensor/dist/ui-server/security.js.map +1 -0
  595. package/sensor/dist/ui-server/static.d.ts +45 -0
  596. package/sensor/dist/ui-server/static.d.ts.map +1 -0
  597. package/sensor/dist/ui-server/static.js +165 -0
  598. package/sensor/dist/ui-server/static.js.map +1 -0
  599. package/sensor/dist/utils.d.ts +14 -2
  600. package/sensor/dist/utils.d.ts.map +1 -1
  601. package/sensor/dist/utils.js +25 -10
  602. package/sensor/dist/utils.js.map +1 -1
  603. package/src/sensor-adapter.mjs +5 -1
@@ -1,17 +1,65 @@
1
1
  /** Lattice sensor project-state directory management. */
2
+ /**
3
+ * The per-project data directory, as upstream's name for it. Lattice has one
4
+ * fixed path (no `LATTICE_SENSOR_DIR` override, no per-host variant), so this is
5
+ * {@link latticeSensorRelativeDir} under the name upstream code imports.
6
+ */
7
+ export declare const DEFAULT_LATTICE_SENSOR_DIR: string;
8
+ /**
9
+ * Upstream's WSL-on-a-Windows-drive data directory (#995). Lattice does not
10
+ * place an index here — see {@link latticeSensorRelativeDirFor} — and the name is
11
+ * kept only so upstream's WSL diagnostics compile unchanged.
12
+ */
13
+ export declare const WSL_LATTICE_SENSOR_DIR: string;
2
14
  /** Stable repository-relative owner path. It deliberately has no legacy override. */
3
15
  export declare function latticeSensorRelativeDir(): string;
4
16
  /** Repository-relative sensor state path. */
5
17
  export declare const LATTICE_SENSOR_DIR: string;
6
18
  /** Lattice owns `.lattice`; source extraction and watching never descend into it. */
7
19
  export declare function isLatticeStateDir(name: string): boolean;
20
+ /**
21
+ * The data directory for one project. Upstream picks a WSL-only sibling for a
22
+ * project on a Windows drive (#995); Lattice keeps the single fixed owner path
23
+ * on every host, because `.lattice/` is Lattice's state root and other Lattice
24
+ * components address the sensor index by that path. The WSL factory lane is
25
+ * retired, and a WSL user sharing a tree with Windows-native Lattice must run
26
+ * only one of them against it.
27
+ */
28
+ export declare function latticeSensorRelativeDirFor(_projectRoot: string): string;
8
29
  /** Absolute sensor state directory for a project. */
9
30
  export declare function getLatticeSensorDir(projectRoot: string): string;
10
31
  /**
11
- * Check if a project has been initialized with LatticeSensor
12
- * Requires both .lattice/sensor/ directory AND sensor.db to exist
32
+ * Check if a project has been initialized with LatticeSensor.
33
+ *
34
+ * Requires `.lattice/sensor/sensor.db` to exist AND to carry the lattice sensor
35
+ * schema. A file that merely exists — empty, or a SQLite database with no
36
+ * tables, as an interrupted `init` or a stray `touch` leaves behind — used to
37
+ * count as initialized, so one such file in an ANCESTOR directory (worst
38
+ * case: `$HOME`) captured the upward resolution of every project beneath it
39
+ * and made their real indexes unreachable (#1895).
40
+ *
41
+ * The probe is cheap and gated so hot callers (the prompt hook, MCP root
42
+ * resolution on every call) pay one `stat`: file size, then a read-only
43
+ * SQLite open with a single `sqlite_master` lookup — memoized per path +
44
+ * mtime + size so an unchanged db is never reopened. A database that cannot
45
+ * be inspected counts as initialized (see probeSchema) — only a proven-absent
46
+ * schema, or a file SQLite refuses as not a database, says no.
13
47
  */
14
48
  export declare function isInitialized(projectRoot: string): boolean;
49
+ /**
50
+ * `sensor.db` exists at `projectRoot` but does not carry the schema, and
51
+ * `init` can add it in place: an empty file, or a SQLite database without the
52
+ * lattice sensor tables (#1895). A file that is not SQLite at all is NOT this case —
53
+ * see {@link hasForeignDbFile}.
54
+ */
55
+ export declare function hasSchemalessDb(projectRoot: string): boolean;
56
+ /**
57
+ * `sensor.db` exists at `projectRoot` and is not a SQLite database (no
58
+ * header magic): SQLite refuses to open it, so `init` cannot rebuild it in
59
+ * place. The caller must say so rather than promise a repair; nothing here
60
+ * deletes the file.
61
+ */
62
+ export declare function hasForeignDbFile(projectRoot: string): boolean;
15
63
  /**
16
64
  * Find the nearest parent directory containing .lattice/sensor/
17
65
  *
@@ -36,6 +84,25 @@ export declare function isInitialized(projectRoot: string): boolean;
36
84
  * The returned string is a human phrase that slots into "… looks like {reason}".
37
85
  */
38
86
  export declare function unsafeIndexRootReason(projectRoot: string): string | null;
87
+ /**
88
+ * `dev:ino` for a path, or null if it can't be stat'd or the platform doesn't
89
+ * report a usable inode. Read as bigints: WSL DrvFs (`/mnt/c`) reports inodes
90
+ * above 2^53, where a plain number rounds nearby inodes onto one value. Windows
91
+ * st_ino is unreliable across handle reopens, so we deliberately return null
92
+ * there — the deleted-but-open-inode hazard this guards (#925) is a POSIX
93
+ * file-semantics issue that doesn't arise on Windows (an open file can't be
94
+ * unlinked).
95
+ */
96
+ export declare function statInode(p: string): string | null;
97
+ /**
98
+ * Whether two resolved index roots are one index spelled two ways — a symlinked
99
+ * checkout, or a case-variant on a case-insensitive mount (macOS, NTFS, WSL
100
+ * DrvFs `/mnt/c`), where `realpathSync` keeps the caller's casing (#1057).
101
+ * Compares the identity of both data directories as they are NOW, so an inode
102
+ * reused after a delete can't match: the deleted root no longer stats. Windows
103
+ * has no usable inode, so it compares the on-disk-cased native realpaths.
104
+ */
105
+ export declare function isSameIndexRoot(a: string, b: string): boolean;
39
106
  export declare function findNearestLatticeSensorRoot(startPath: string): string | null;
40
107
  /**
41
108
  * Indexed sub-project roots beneath `root` (bounded breadth-first scan). For
@@ -49,6 +116,35 @@ export declare function findIndexedSubprojectRoots(root: string, opts?: {
49
116
  maxDepth?: number;
50
117
  max?: number;
51
118
  }): string[];
119
+ /** Result of {@link resolveServerRoot}. */
120
+ export interface ServerRootResolution {
121
+ /** The project root to serve as the default, or null when none resolved. */
122
+ root: string | null;
123
+ /** True when `root` was adopted from the down-scan rather than the up-walk. */
124
+ viaSubScan: boolean;
125
+ /**
126
+ * Indexed sub-projects the down-scan saw when it ran but could NOT adopt
127
+ * (zero or several candidates). Empty when the up-walk resolved or the scan
128
+ * was skipped. Callers surface these so "no default project" errors can say
129
+ * what IS reachable (#1607).
130
+ */
131
+ candidates: string[];
132
+ }
133
+ /**
134
+ * Resolve the project root an MCP server should serve as its DEFAULT project
135
+ * (#1606). Up-walk first (`findNearestLatticeSensorRoot` — the common case, and
136
+ * cheap). When nothing is indexed at or above `searchFrom`, run the bounded
137
+ * sub-project down-scan `planFrontload` already uses, behind the workspace
138
+ * gate above: EXACTLY ONE indexed sub-project is unambiguous and is adopted
139
+ * as the root; zero or several yield no root, with the candidates carried so
140
+ * the caller can name them instead of failing silently (#1607).
141
+ *
142
+ * `opts.subprojectScan: false` skips the down-scan entirely (the per-tool-call
143
+ * retry path throttles it; the up-walk always runs).
144
+ */
145
+ export declare function resolveServerRoot(searchFrom: string, opts?: {
146
+ subprojectScan?: boolean;
147
+ }): ServerRootResolution;
52
148
  /**
53
149
  * Does `prompt` contain an explicit structural keyword? A keyword is a strong,
54
150
  * self-contained signal, so the front-load hook fires on it directly — no graph
@@ -85,6 +181,26 @@ export declare function extractCodeTokens(prompt: string): string[];
85
181
  * non-candidate prompt ("fix this typo", in any language) stays a zero-cost no-op.
86
182
  */
87
183
  export declare function isStructuralPrompt(prompt: string): boolean;
184
+ /**
185
+ * Claude Code persists `UserPromptSubmit` hook stdout above this many
186
+ * characters to a file and shows the model a ~2 KB preview instead (#1694).
187
+ * Measured on Claude Code 2.1.261; documented in the hooks reference as a
188
+ * 10,000-character cap on hook output strings.
189
+ */
190
+ export declare const CLAUDE_CODE_INLINE_HOOK_OUTPUT_LIMIT = 10000;
191
+ /**
192
+ * Max characters of explore text injected by `lattice sensor prompt-hook` before
193
+ * truncation. Must stay under {@link CLAUDE_CODE_INLINE_HOOK_OUTPUT_LIMIT} so
194
+ * the host delivers the payload inline. 9,000 leaves ~1k for the
195
+ * `<lattice_sensor_context>` wrapper and the `projectPath` nudge lines appended
196
+ * after the cap is applied.
197
+ */
198
+ export declare const PROMPT_HOOK_INJECTION_MAX = 9000;
199
+ /**
200
+ * Cap explore text for the prompt-hook injection, preserving the existing
201
+ * "call lattice_sensor_explore for the rest" notice when truncated.
202
+ */
203
+ export declare function capPromptHookInjection(text: string, max?: number): string;
88
204
  /**
89
205
  * What the front-load hook should do for a prompt issued from a directory.
90
206
  */
@@ -144,4 +260,12 @@ export declare function validateDirectory(projectRoot: string): {
144
260
  valid: boolean;
145
261
  errors: string[];
146
262
  };
263
+ /**
264
+ * Claude Code injects `<task-notification>…</task-notification>` blocks as
265
+ * `user` messages when a background agent finishes, and UserPromptSubmit
266
+ * hooks receive them exactly like typed prompts (#1832). The whole prompt
267
+ * must be that single envelope; a user question that merely mentions the
268
+ * marker is still a prompt.
269
+ */
270
+ export declare function isTaskNotification(prompt: string): boolean;
147
271
  //# sourceMappingURL=directory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAAA,yDAAyD;AASzD,qFAAqF;AACrF,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB,QAA6B,CAAC;AAE7D,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,qDAAqD;AACrD,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAQ1D;AAED;;;;;;;;GAQG;AACH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA8BxE;AAED,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmB7E;AA2BD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7C,MAAM,EAAE,CAmBV;AAsND;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAK5D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAkB1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;yEAEqE;IACrE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;6EAEyE;IACzE,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB;;oEAEgE;IAChE,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAwCxE;AAyDD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAgBzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAuBzD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CA8BnE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA+B5D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAYlF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CA6BA"}
1
+ {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAAA,yDAAyD;AASzD;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAiD,CAAC;AAEzF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAsC,CAAC;AAE1E,qFAAqF;AACrF,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB,QAA6B,CAAC;AAE7D,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,qDAAqD;AACrD,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAc1D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAM5D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAK7D;AAkDD;;;;;;;;GAQG;AACH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA8BxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQlD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAW7D;AAED,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmB7E;AA2BD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7C,MAAM,EAAE,CAqBV;AAED,2CAA2C;AAC3C,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,+EAA+E;IAC/E,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAoBD;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GACtC,oBAAoB,CAStB;AAsND;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAK5D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAkB1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,QAAS,CAAC;AAE3D;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,OAAQ,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAA4B,GAAG,MAAM,CAI5F;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;yEAEqE;IACrE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;6EAEyE;IACzE,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB;;oEAEgE;IAChE,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAwCxE;AAyDD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAgBzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAuBzD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CA8BnE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA+B5D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAYlF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CA6BA;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D"}
@@ -34,17 +34,24 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.LATTICE_SENSOR_DIR = void 0;
37
+ exports.PROMPT_HOOK_INJECTION_MAX = exports.CLAUDE_CODE_INLINE_HOOK_OUTPUT_LIMIT = exports.LATTICE_SENSOR_DIR = exports.WSL_LATTICE_SENSOR_DIR = exports.DEFAULT_LATTICE_SENSOR_DIR = void 0;
38
38
  exports.latticeSensorRelativeDir = latticeSensorRelativeDir;
39
39
  exports.isLatticeStateDir = isLatticeStateDir;
40
+ exports.latticeSensorRelativeDirFor = latticeSensorRelativeDirFor;
40
41
  exports.getLatticeSensorDir = getLatticeSensorDir;
41
42
  exports.isInitialized = isInitialized;
43
+ exports.hasSchemalessDb = hasSchemalessDb;
44
+ exports.hasForeignDbFile = hasForeignDbFile;
42
45
  exports.unsafeIndexRootReason = unsafeIndexRootReason;
46
+ exports.statInode = statInode;
47
+ exports.isSameIndexRoot = isSameIndexRoot;
43
48
  exports.findNearestLatticeSensorRoot = findNearestLatticeSensorRoot;
44
49
  exports.findIndexedSubprojectRoots = findIndexedSubprojectRoots;
50
+ exports.resolveServerRoot = resolveServerRoot;
45
51
  exports.hasStructuralKeyword = hasStructuralKeyword;
46
52
  exports.extractCodeTokens = extractCodeTokens;
47
53
  exports.isStructuralPrompt = isStructuralPrompt;
54
+ exports.capPromptHookInjection = capPromptHookInjection;
48
55
  exports.planFrontload = planFrontload;
49
56
  exports.createDirectory = createDirectory;
50
57
  exports.removeDirectory = removeDirectory;
@@ -52,11 +59,24 @@ exports.listDirectoryContents = listDirectoryContents;
52
59
  exports.getDirectorySize = getDirectorySize;
53
60
  exports.ensureSubdirectory = ensureSubdirectory;
54
61
  exports.validateDirectory = validateDirectory;
62
+ exports.isTaskNotification = isTaskNotification;
55
63
  const fs = __importStar(require("fs"));
56
64
  const os = __importStar(require("os"));
57
65
  const path = __importStar(require("path"));
58
66
  const LATTICE_STATE_DIR = '.lattice';
59
67
  const SENSOR_STATE_DIR = 'sensor';
68
+ /**
69
+ * The per-project data directory, as upstream's name for it. Lattice has one
70
+ * fixed path (no `LATTICE_SENSOR_DIR` override, no per-host variant), so this is
71
+ * {@link latticeSensorRelativeDir} under the name upstream code imports.
72
+ */
73
+ exports.DEFAULT_LATTICE_SENSOR_DIR = path.join(LATTICE_STATE_DIR, SENSOR_STATE_DIR);
74
+ /**
75
+ * Upstream's WSL-on-a-Windows-drive data directory (#995). Lattice does not
76
+ * place an index here — see {@link latticeSensorRelativeDirFor} — and the name is
77
+ * kept only so upstream's WSL diagnostics compile unchanged.
78
+ */
79
+ exports.WSL_LATTICE_SENSOR_DIR = `${exports.DEFAULT_LATTICE_SENSOR_DIR}-wsl`;
60
80
  /** Stable repository-relative owner path. It deliberately has no legacy override. */
61
81
  function latticeSensorRelativeDir() {
62
82
  return path.join(LATTICE_STATE_DIR, SENSOR_STATE_DIR);
@@ -67,13 +87,37 @@ exports.LATTICE_SENSOR_DIR = latticeSensorRelativeDir();
67
87
  function isLatticeStateDir(name) {
68
88
  return name === LATTICE_STATE_DIR;
69
89
  }
90
+ /**
91
+ * The data directory for one project. Upstream picks a WSL-only sibling for a
92
+ * project on a Windows drive (#995); Lattice keeps the single fixed owner path
93
+ * on every host, because `.lattice/` is Lattice's state root and other Lattice
94
+ * components address the sensor index by that path. The WSL factory lane is
95
+ * retired, and a WSL user sharing a tree with Windows-native Lattice must run
96
+ * only one of them against it.
97
+ */
98
+ function latticeSensorRelativeDirFor(_projectRoot) {
99
+ return latticeSensorRelativeDir();
100
+ }
70
101
  /** Absolute sensor state directory for a project. */
71
102
  function getLatticeSensorDir(projectRoot) {
72
103
  return path.join(projectRoot, LATTICE_STATE_DIR, SENSOR_STATE_DIR);
73
104
  }
74
105
  /**
75
- * Check if a project has been initialized with LatticeSensor
76
- * Requires both .lattice/sensor/ directory AND sensor.db to exist
106
+ * Check if a project has been initialized with LatticeSensor.
107
+ *
108
+ * Requires `.lattice/sensor/sensor.db` to exist AND to carry the lattice sensor
109
+ * schema. A file that merely exists — empty, or a SQLite database with no
110
+ * tables, as an interrupted `init` or a stray `touch` leaves behind — used to
111
+ * count as initialized, so one such file in an ANCESTOR directory (worst
112
+ * case: `$HOME`) captured the upward resolution of every project beneath it
113
+ * and made their real indexes unreachable (#1895).
114
+ *
115
+ * The probe is cheap and gated so hot callers (the prompt hook, MCP root
116
+ * resolution on every call) pay one `stat`: file size, then a read-only
117
+ * SQLite open with a single `sqlite_master` lookup — memoized per path +
118
+ * mtime + size so an unchanged db is never reopened. A database that cannot
119
+ * be inspected counts as initialized (see probeSchema) — only a proven-absent
120
+ * schema, or a file SQLite refuses as not a database, says no.
77
121
  */
78
122
  function isInitialized(projectRoot) {
79
123
  const sensorDir = getLatticeSensorDir(projectRoot);
@@ -82,7 +126,102 @@ function isInitialized(projectRoot) {
82
126
  }
83
127
  // Must have sensor.db, not just .lattice/sensor folder
84
128
  const dbPath = path.join(sensorDir, 'sensor.db');
85
- return fs.existsSync(dbPath);
129
+ let st;
130
+ try {
131
+ st = fs.statSync(dbPath);
132
+ }
133
+ catch {
134
+ return false;
135
+ }
136
+ return hasLatticeSensorSchema(dbPath, st);
137
+ }
138
+ /**
139
+ * `sensor.db` exists at `projectRoot` but does not carry the schema, and
140
+ * `init` can add it in place: an empty file, or a SQLite database without the
141
+ * lattice sensor tables (#1895). A file that is not SQLite at all is NOT this case —
142
+ * see {@link hasForeignDbFile}.
143
+ */
144
+ function hasSchemalessDb(projectRoot) {
145
+ const dbPath = path.join(getLatticeSensorDir(projectRoot), 'sensor.db');
146
+ let st;
147
+ try {
148
+ st = fs.statSync(dbPath);
149
+ }
150
+ catch {
151
+ return false;
152
+ }
153
+ if (!st.isFile() || isInitialized(projectRoot))
154
+ return false;
155
+ return st.size === 0 || probeSchema(dbPath) === 'no-schema';
156
+ }
157
+ /**
158
+ * `sensor.db` exists at `projectRoot` and is not a SQLite database (no
159
+ * header magic): SQLite refuses to open it, so `init` cannot rebuild it in
160
+ * place. The caller must say so rather than promise a repair; nothing here
161
+ * deletes the file.
162
+ */
163
+ function hasForeignDbFile(projectRoot) {
164
+ const dbPath = path.join(getLatticeSensorDir(projectRoot), 'sensor.db');
165
+ let st;
166
+ try {
167
+ st = fs.statSync(dbPath);
168
+ }
169
+ catch {
170
+ return false;
171
+ }
172
+ return st.isFile() && st.size > 0 && probeSchema(dbPath) === 'not-sqlite';
173
+ }
174
+ /** A SQLite file header is 100 bytes; anything shorter cannot hold a schema. */
175
+ const SQLITE_HEADER_SIZE = 100;
176
+ /** SQLITE_NOTADB: SQLite read the file and it is not a database. */
177
+ const SQLITE_NOTADB = 26;
178
+ const schemaProbeCache = new Map();
179
+ function hasLatticeSensorSchema(dbPath, st) {
180
+ if (!st.isFile() || st.size < SQLITE_HEADER_SIZE)
181
+ return false;
182
+ const cached = schemaProbeCache.get(dbPath);
183
+ if (cached && cached.mtimeMs === st.mtimeMs && cached.size === st.size)
184
+ return cached.ok;
185
+ const probe = probeSchema(dbPath);
186
+ const ok = probe === 'schema' || probe === 'unknown';
187
+ schemaProbeCache.set(dbPath, { mtimeMs: st.mtimeMs, size: st.size, ok });
188
+ return ok;
189
+ }
190
+ /**
191
+ * What `sensor.db` holds, asked of SQLite itself through a read-only
192
+ * connection: the lattice sensor schema, a database without it, not a database at
193
+ * all (SQLITE_NOTADB), or `unknown` — locked, busy, a WAL db in a directory we
194
+ * cannot create `-shm` in (read-only checkout, mount, another user's tree),
195
+ * disk I/O. Callers treat `unknown` as initialized: the pre-existing behaviour
196
+ * for a database we cannot inspect.
197
+ *
198
+ * The file is never read through a descriptor of our own, not even for its
199
+ * 16-byte header. Closing ANY descriptor on a database file drops every POSIX
200
+ * lock this process holds on it, including those of a connection it already
201
+ * has open (sqlite.org/howtocorrupt.html §2.2.1) — and the MCP server resolves
202
+ * projects through isInitialized on every call while it holds the index as
203
+ * its writer. SQLite's own connections share one lock table per file, so a
204
+ * second connection opened and closed here leaves the first one's locks alone.
205
+ */
206
+ function probeSchema(dbPath) {
207
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
208
+ const { DatabaseSync } = require('node:sqlite');
209
+ let db = null;
210
+ try {
211
+ db = new DatabaseSync(dbPath, { readOnly: true });
212
+ const row = db.prepare("SELECT 1 AS ok FROM sqlite_master WHERE type = 'table' AND name = 'nodes'").get();
213
+ return row !== undefined ? 'schema' : 'no-schema';
214
+ }
215
+ catch (error) {
216
+ return error?.errcode === SQLITE_NOTADB ? 'not-sqlite' : 'unknown';
217
+ }
218
+ finally {
219
+ // Never hold the handle: Windows file locking would block the owner.
220
+ try {
221
+ db?.close();
222
+ }
223
+ catch { /* already closed */ }
224
+ }
86
225
  }
87
226
  /**
88
227
  * Find the nearest parent directory containing .lattice/sensor/
@@ -135,6 +274,48 @@ function unsafeIndexRootReason(projectRoot) {
135
274
  }
136
275
  return null;
137
276
  }
277
+ /**
278
+ * `dev:ino` for a path, or null if it can't be stat'd or the platform doesn't
279
+ * report a usable inode. Read as bigints: WSL DrvFs (`/mnt/c`) reports inodes
280
+ * above 2^53, where a plain number rounds nearby inodes onto one value. Windows
281
+ * st_ino is unreliable across handle reopens, so we deliberately return null
282
+ * there — the deleted-but-open-inode hazard this guards (#925) is a POSIX
283
+ * file-semantics issue that doesn't arise on Windows (an open file can't be
284
+ * unlinked).
285
+ */
286
+ function statInode(p) {
287
+ if (process.platform === 'win32')
288
+ return null;
289
+ try {
290
+ const s = fs.statSync(p, { bigint: true });
291
+ return `${s.dev}:${s.ino}`;
292
+ }
293
+ catch {
294
+ return null;
295
+ }
296
+ }
297
+ /**
298
+ * Whether two resolved index roots are one index spelled two ways — a symlinked
299
+ * checkout, or a case-variant on a case-insensitive mount (macOS, NTFS, WSL
300
+ * DrvFs `/mnt/c`), where `realpathSync` keeps the caller's casing (#1057).
301
+ * Compares the identity of both data directories as they are NOW, so an inode
302
+ * reused after a delete can't match: the deleted root no longer stats. Windows
303
+ * has no usable inode, so it compares the on-disk-cased native realpaths.
304
+ */
305
+ function isSameIndexRoot(a, b) {
306
+ if (a === b)
307
+ return true;
308
+ if (process.platform === 'win32') {
309
+ try {
310
+ return fs.realpathSync.native(getLatticeSensorDir(a)) === fs.realpathSync.native(getLatticeSensorDir(b));
311
+ }
312
+ catch {
313
+ return false;
314
+ }
315
+ }
316
+ const id = statInode(getLatticeSensorDir(a));
317
+ return id !== null && id === statInode(getLatticeSensorDir(b));
318
+ }
138
319
  function findNearestLatticeSensorRoot(startPath) {
139
320
  let current = path.resolve(startPath);
140
321
  const root = path.parse(current).root;
@@ -183,6 +364,9 @@ function escapeRegExp(s) {
183
364
  * never turns into a full-tree crawl on a large repo.
184
365
  */
185
366
  function findIndexedSubprojectRoots(root, opts = {}) {
367
+ // A stray workspace manifest must not enable scanning home or broader roots (#1454).
368
+ if (unsafeIndexRootReason(root) !== null)
369
+ return [];
186
370
  const maxDepth = opts.maxDepth ?? 4;
187
371
  const max = opts.max ?? 64;
188
372
  const out = [];
@@ -214,6 +398,57 @@ function findIndexedSubprojectRoots(root, opts = {}) {
214
398
  walk(root, 1);
215
399
  return out;
216
400
  }
401
+ /**
402
+ * Whether `base` is a plausible workspace root for the sub-project down-scan.
403
+ * Mirrors `planFrontload`'s manifest gate, widened to accept a bare `.git`
404
+ * entry — the #1606 shape is a workspace container holding only agent config
405
+ * and a `.git`, with every build manifest living in the indexed children. The
406
+ * user's home directory and the filesystem root are never eligible: a stray
407
+ * manifest there must not turn server startup into a scan that could adopt an
408
+ * unrelated project (#1454 documents that failure mode for the prompt-hook).
409
+ */
410
+ function eligibleForSubprojectScan(base) {
411
+ if (base === path.parse(base).root)
412
+ return false;
413
+ let home = null;
414
+ try {
415
+ home = os.homedir();
416
+ }
417
+ catch {
418
+ home = null;
419
+ }
420
+ if (home && (base === home || base === path.resolve(home)))
421
+ return false;
422
+ if (looksLikeProjectRoot(base))
423
+ return true;
424
+ return fs.existsSync(path.join(base, '.git'));
425
+ }
426
+ /**
427
+ * Resolve the project root an MCP server should serve as its DEFAULT project
428
+ * (#1606). Up-walk first (`findNearestLatticeSensorRoot` — the common case, and
429
+ * cheap). When nothing is indexed at or above `searchFrom`, run the bounded
430
+ * sub-project down-scan `planFrontload` already uses, behind the workspace
431
+ * gate above: EXACTLY ONE indexed sub-project is unambiguous and is adopted
432
+ * as the root; zero or several yield no root, with the candidates carried so
433
+ * the caller can name them instead of failing silently (#1607).
434
+ *
435
+ * `opts.subprojectScan: false` skips the down-scan entirely (the per-tool-call
436
+ * retry path throttles it; the up-walk always runs).
437
+ */
438
+ function resolveServerRoot(searchFrom, opts = {}) {
439
+ const up = findNearestLatticeSensorRoot(searchFrom);
440
+ if (up)
441
+ return { root: up, viaSubScan: false, candidates: [] };
442
+ if (opts.subprojectScan === false)
443
+ return { root: null, viaSubScan: false, candidates: [] };
444
+ const base = path.resolve(searchFrom);
445
+ if (!eligibleForSubprojectScan(base))
446
+ return { root: null, viaSubScan: false, candidates: [] };
447
+ const subs = findIndexedSubprojectRoots(base);
448
+ if (subs.length === 1)
449
+ return { root: subs[0], viaSubScan: true, candidates: subs };
450
+ return { root: null, viaSubScan: false, candidates: subs };
451
+ }
217
452
  /**
218
453
  * Unicode-aware word-boundary emulation for the keyword lists below. JS's `\b`
219
454
  * is ASCII-only — it fires only at `[A-Za-z0-9_]` edges — so it can never bound
@@ -229,8 +464,9 @@ const NOT_WORD_AFTER = /(?![\p{L}\p{N}_])/u.source;
229
464
  * Structural keywords matched as EXACT words (boundary on both sides): short
230
465
  * or ambiguous tokens where prefix matching would false-positive ("flow" in
231
466
  * "flower", "path" in "pathological"). Grouped by language; a term appears once
232
- * even when several languages share it ("como" is Portuguese for how AND
233
- * unaccented-typed Spanish "cómo").
467
+ * even when several languages share it. Ambiguous everyday words like PT/ES
468
+ * "como" and DE "wie" are excluded: the hook instead requires another strong
469
+ * keyword, a verified code token, or indexed prose segments (#1654).
234
470
  */
235
471
  const STRUCTURAL_WORDS = [
236
472
  // English — the pre-#1126 list minus what moved to STRUCTURAL_STEMS: the
@@ -239,17 +475,16 @@ const STRUCTURAL_WORDS = [
239
475
  'how', 'where', 'tracing', 'flows?', 'paths?', 'reach(?:es|ed)?', 'wired?', 'breaks?', 'why does',
240
476
  // French (où=where, flux=flow, chemin=path, casse=breaks)
241
477
  'comment', 'où', 'flux', 'chemins?', 'casse',
242
- // Spanish (cómo/como=how, dónde/donde=where, flujo=flow, ruta/camino=path,
478
+ // Spanish (cómo=how, dónde/donde=where, flujo=flow, ruta/camino=path,
243
479
  // rompe=breaks, llaman / quién llama = call(s) — bare "llama" is excluded:
244
480
  // it's also the animal/model name in English prompts)
245
481
  'cómo', 'dónde', 'donde', 'flujos?', 'rutas?', 'caminos?', 'rompe', 'llaman', 'quién llama', 'quien llama',
246
- // Portuguese (como=how — also covers unaccented Spanish; onde=where,
247
- // fluxo=flow, caminho=path)
248
- 'como', 'onde', 'fluxos?', 'caminhos?',
249
- // German (wie=how, wo/woher/wohin=where, Pfad=path, Fluss/Ablauf=flow,
482
+ // Portuguese (onde=where, fluxo=flow, caminho=path)
483
+ 'onde', 'fluxos?', 'caminhos?',
484
+ // German (wo/woher/wohin=where, Pfad=path, Fluss/Ablauf=flow,
250
485
  // bricht/kaputt=breaks, ruft=calls, hängt=depends — "hängt … von X ab"
251
486
  // splits the separable verb "abhängen", so the "abhäng" stem can't catch it)
252
- 'wie', 'wo', 'woher', 'wohin', 'pfade?', 'fluss', 'ablauf', 'bricht', 'kaputt', 'ruft', 'hängt',
487
+ 'wo', 'woher', 'wohin', 'pfade?', 'fluss', 'ablauf', 'bricht', 'kaputt', 'ruft', 'hängt',
253
488
  // Italian (dove=where, flusso=flow, percorso/i=path)
254
489
  'dove', 'flusso', 'percors[oi]',
255
490
  // Russian (как=how, где=where, путь/пути=path, работает=works)
@@ -485,6 +720,30 @@ function extractCodeTokens(prompt) {
485
720
  function isStructuralPrompt(prompt) {
486
721
  return hasStructuralKeyword(prompt) || extractCodeTokens(prompt).length > 0;
487
722
  }
723
+ /**
724
+ * Claude Code persists `UserPromptSubmit` hook stdout above this many
725
+ * characters to a file and shows the model a ~2 KB preview instead (#1694).
726
+ * Measured on Claude Code 2.1.261; documented in the hooks reference as a
727
+ * 10,000-character cap on hook output strings.
728
+ */
729
+ exports.CLAUDE_CODE_INLINE_HOOK_OUTPUT_LIMIT = 10_000;
730
+ /**
731
+ * Max characters of explore text injected by `lattice sensor prompt-hook` before
732
+ * truncation. Must stay under {@link CLAUDE_CODE_INLINE_HOOK_OUTPUT_LIMIT} so
733
+ * the host delivers the payload inline. 9,000 leaves ~1k for the
734
+ * `<lattice_sensor_context>` wrapper and the `projectPath` nudge lines appended
735
+ * after the cap is applied.
736
+ */
737
+ exports.PROMPT_HOOK_INJECTION_MAX = 9_000;
738
+ /**
739
+ * Cap explore text for the prompt-hook injection, preserving the existing
740
+ * "call lattice_sensor_explore for the rest" notice when truncated.
741
+ */
742
+ function capPromptHookInjection(text, max = exports.PROMPT_HOOK_INJECTION_MAX) {
743
+ return text.length > max
744
+ ? `${text.slice(0, max)}\n…(truncated; call lattice_sensor_explore for the rest)`
745
+ : text;
746
+ }
488
747
  /**
489
748
  * Decide what the front-load hook injects for a `prompt` issued from `cwd`,
490
749
  * shaped by where the `.lattice/sensor/` index(es) actually are:
@@ -604,10 +863,10 @@ function ensureGitignore(gitignorePath) {
604
863
  */
605
864
  function createDirectory(projectRoot) {
606
865
  const sensorDir = getLatticeSensorDir(projectRoot);
607
- const dbPath = path.join(sensorDir, 'sensor.db');
608
- // Only throw if LatticeSensor is actually initialized (db exists)
609
- // .lattice/sensor/ folder alone is fine
610
- if (fs.existsSync(dbPath)) {
866
+ // Only throw if LatticeSensor is actually initialized (db with a schema).
867
+ // .lattice/sensor/ folder alone — or a schema-less sensor.db left by an
868
+ // interrupted init (#1895) — is fine: initialize() adds the schema to it.
869
+ if (isInitialized(projectRoot)) {
611
870
  throw new Error(`LatticeSensor already initialized in ${projectRoot}`);
612
871
  }
613
872
  // Create main directory (if it doesn't exist)
@@ -738,4 +997,14 @@ function validateDirectory(projectRoot) {
738
997
  errors,
739
998
  };
740
999
  }
1000
+ /**
1001
+ * Claude Code injects `<task-notification>…</task-notification>` blocks as
1002
+ * `user` messages when a background agent finishes, and UserPromptSubmit
1003
+ * hooks receive them exactly like typed prompts (#1832). The whole prompt
1004
+ * must be that single envelope; a user question that merely mentions the
1005
+ * marker is still a prompt.
1006
+ */
1007
+ function isTaskNotification(prompt) {
1008
+ return /^\s*<task-notification>[\s\S]*<\/task-notification>\s*$/.test(prompt);
1009
+ }
741
1010
  //# sourceMappingURL=directory.js.map