homegraph 1.5.7 → 1.5.10

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 (555) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +2 -2
  3. package/dist/bin/homegraph.js +16 -14
  4. package/dist/db/index.d.ts +1 -1
  5. package/dist/db/index.js +11 -25
  6. package/dist/db/queries.d.ts +5 -1
  7. package/dist/db/queries.js +31 -2
  8. package/dist/db/sqlite-adapter.d.ts +6 -12
  9. package/dist/db/sqlite-adapter.js +13 -41
  10. package/dist/directory.d.ts +1 -1
  11. package/dist/directory.js +25 -1
  12. package/dist/extraction/grammars.d.ts +2 -0
  13. package/dist/extraction/grammars.js +7 -7
  14. package/dist/extraction/index.js +17 -12
  15. package/dist/extraction/languages/arkts.d.ts +40 -7
  16. package/dist/extraction/languages/arkts.js +290 -84
  17. package/dist/extraction/tree-sitter.js +12 -3
  18. package/dist/graph/evidence-paths.d.ts +63 -0
  19. package/dist/graph/evidence-paths.js +245 -0
  20. package/dist/index.d.ts +6 -1
  21. package/dist/index.js +78 -29
  22. package/dist/mcp/arkts-evidence-packs.d.ts +67 -0
  23. package/dist/mcp/arkts-evidence-packs.js +352 -0
  24. package/dist/mcp/daemon.js +1 -1
  25. package/dist/mcp/engine.d.ts +20 -7
  26. package/dist/mcp/engine.js +113 -106
  27. package/dist/mcp/index-availability.d.ts +31 -0
  28. package/dist/mcp/index-availability.js +105 -0
  29. package/dist/mcp/index.js +5 -4
  30. package/dist/mcp/query-cache.d.ts +1 -1
  31. package/dist/mcp/query-cache.js +6 -2
  32. package/dist/mcp/query-worker.d.ts +1 -1
  33. package/dist/mcp/query-worker.js +1 -1
  34. package/dist/mcp/server-instructions.d.ts +2 -11
  35. package/dist/mcp/server-instructions.js +42 -75
  36. package/dist/mcp/session.js +12 -4
  37. package/dist/mcp/source-slice-identity.d.ts +3 -0
  38. package/dist/mcp/source-slice-identity.js +11 -0
  39. package/dist/mcp/tools.d.ts +29 -6
  40. package/dist/mcp/tools.js +240 -122
  41. package/dist/project-map/index.js +2 -42
  42. package/dist/spec/llm/client.js +3 -15
  43. package/dist/spec/llm/openai-sdk.d.ts +14 -0
  44. package/dist/spec/llm/openai-sdk.js +37 -0
  45. package/dist/spec/llm/retry.js +8 -9
  46. package/dist/utils.d.ts +5 -0
  47. package/dist/utils.js +24 -0
  48. package/package.json +4 -6
  49. package/dist/addons/dynamic-import.d.ts.map +0 -1
  50. package/dist/addons/dynamic-import.js.map +0 -1
  51. package/dist/addons/init-template.d.ts.map +0 -1
  52. package/dist/addons/init-template.js.map +0 -1
  53. package/dist/addons/loader.d.ts.map +0 -1
  54. package/dist/addons/loader.js.map +0 -1
  55. package/dist/addons/manager.d.ts.map +0 -1
  56. package/dist/addons/manager.js.map +0 -1
  57. package/dist/addons/paths.d.ts.map +0 -1
  58. package/dist/addons/paths.js.map +0 -1
  59. package/dist/addons/registry.d.ts.map +0 -1
  60. package/dist/addons/registry.js.map +0 -1
  61. package/dist/addons/semver.d.ts.map +0 -1
  62. package/dist/addons/semver.js.map +0 -1
  63. package/dist/addons/types.d.ts.map +0 -1
  64. package/dist/addons/types.js.map +0 -1
  65. package/dist/addons/validate.d.ts.map +0 -1
  66. package/dist/addons/validate.js.map +0 -1
  67. package/dist/arkui/index.d.ts.map +0 -1
  68. package/dist/arkui/index.js.map +0 -1
  69. package/dist/arkui/migrate-passage.d.ts.map +0 -1
  70. package/dist/arkui/migrate-passage.js.map +0 -1
  71. package/dist/arkui/migrate-semantics.d.ts.map +0 -1
  72. package/dist/arkui/migrate-semantics.js.map +0 -1
  73. package/dist/arkui/migrate-snapshot.d.ts.map +0 -1
  74. package/dist/arkui/migrate-snapshot.js.map +0 -1
  75. package/dist/bin/addon-commands.d.ts.map +0 -1
  76. package/dist/bin/addon-commands.js.map +0 -1
  77. package/dist/bin/command-supervision.d.ts.map +0 -1
  78. package/dist/bin/command-supervision.js.map +0 -1
  79. package/dist/bin/fatal-handler.d.ts.map +0 -1
  80. package/dist/bin/fatal-handler.js.map +0 -1
  81. package/dist/bin/homegraph.d.ts.map +0 -1
  82. package/dist/bin/homegraph.js.map +0 -1
  83. package/dist/bin/node-version-check.d.ts.map +0 -1
  84. package/dist/bin/node-version-check.js.map +0 -1
  85. package/dist/bin/uninstall.d.ts.map +0 -1
  86. package/dist/bin/uninstall.js.map +0 -1
  87. package/dist/context/formatter.d.ts.map +0 -1
  88. package/dist/context/formatter.js.map +0 -1
  89. package/dist/context/index.d.ts.map +0 -1
  90. package/dist/context/index.js.map +0 -1
  91. package/dist/context/markers.d.ts.map +0 -1
  92. package/dist/context/markers.js.map +0 -1
  93. package/dist/db/index.d.ts.map +0 -1
  94. package/dist/db/index.js.map +0 -1
  95. package/dist/db/migrations.d.ts.map +0 -1
  96. package/dist/db/migrations.js.map +0 -1
  97. package/dist/db/queries.d.ts.map +0 -1
  98. package/dist/db/queries.js.map +0 -1
  99. package/dist/db/sqlite-adapter.d.ts.map +0 -1
  100. package/dist/db/sqlite-adapter.js.map +0 -1
  101. package/dist/db/wal-valve.d.ts.map +0 -1
  102. package/dist/db/wal-valve.js.map +0 -1
  103. package/dist/directory.d.ts.map +0 -1
  104. package/dist/directory.js.map +0 -1
  105. package/dist/errors.d.ts.map +0 -1
  106. package/dist/errors.js.map +0 -1
  107. package/dist/extraction/arkts-batch-worker.d.ts.map +0 -1
  108. package/dist/extraction/arkts-batch-worker.js.map +0 -1
  109. package/dist/extraction/astro-extractor.d.ts.map +0 -1
  110. package/dist/extraction/astro-extractor.js.map +0 -1
  111. package/dist/extraction/cfml-extractor.d.ts.map +0 -1
  112. package/dist/extraction/cfml-extractor.js.map +0 -1
  113. package/dist/extraction/context.d.ts.map +0 -1
  114. package/dist/extraction/context.js.map +0 -1
  115. package/dist/extraction/default-ignore.d.ts.map +0 -1
  116. package/dist/extraction/default-ignore.js.map +0 -1
  117. package/dist/extraction/dfm-extractor.d.ts.map +0 -1
  118. package/dist/extraction/dfm-extractor.js.map +0 -1
  119. package/dist/extraction/extraction-version.d.ts.map +0 -1
  120. package/dist/extraction/extraction-version.js.map +0 -1
  121. package/dist/extraction/function-ref.d.ts.map +0 -1
  122. package/dist/extraction/function-ref.js.map +0 -1
  123. package/dist/extraction/generated-detection.d.ts.map +0 -1
  124. package/dist/extraction/generated-detection.js.map +0 -1
  125. package/dist/extraction/grammars.d.ts.map +0 -1
  126. package/dist/extraction/grammars.js.map +0 -1
  127. package/dist/extraction/index.d.ts.map +0 -1
  128. package/dist/extraction/index.js.map +0 -1
  129. package/dist/extraction/languages/arkts.d.ts.map +0 -1
  130. package/dist/extraction/languages/arkts.js.map +0 -1
  131. package/dist/extraction/languages/c-cpp.d.ts.map +0 -1
  132. package/dist/extraction/languages/c-cpp.js.map +0 -1
  133. package/dist/extraction/languages/cfquery.d.ts.map +0 -1
  134. package/dist/extraction/languages/cfquery.js.map +0 -1
  135. package/dist/extraction/languages/cfscript.d.ts.map +0 -1
  136. package/dist/extraction/languages/cfscript.js.map +0 -1
  137. package/dist/extraction/languages/cobol.d.ts.map +0 -1
  138. package/dist/extraction/languages/cobol.js.map +0 -1
  139. package/dist/extraction/languages/csharp.d.ts.map +0 -1
  140. package/dist/extraction/languages/csharp.js.map +0 -1
  141. package/dist/extraction/languages/dart.d.ts.map +0 -1
  142. package/dist/extraction/languages/dart.js.map +0 -1
  143. package/dist/extraction/languages/erlang.d.ts.map +0 -1
  144. package/dist/extraction/languages/erlang.js.map +0 -1
  145. package/dist/extraction/languages/go.d.ts.map +0 -1
  146. package/dist/extraction/languages/go.js.map +0 -1
  147. package/dist/extraction/languages/index.d.ts.map +0 -1
  148. package/dist/extraction/languages/index.js.map +0 -1
  149. package/dist/extraction/languages/java.d.ts.map +0 -1
  150. package/dist/extraction/languages/java.js.map +0 -1
  151. package/dist/extraction/languages/javascript.d.ts.map +0 -1
  152. package/dist/extraction/languages/javascript.js.map +0 -1
  153. package/dist/extraction/languages/kotlin.d.ts.map +0 -1
  154. package/dist/extraction/languages/kotlin.js.map +0 -1
  155. package/dist/extraction/languages/lua.d.ts.map +0 -1
  156. package/dist/extraction/languages/lua.js.map +0 -1
  157. package/dist/extraction/languages/luau.d.ts.map +0 -1
  158. package/dist/extraction/languages/luau.js.map +0 -1
  159. package/dist/extraction/languages/nix.d.ts.map +0 -1
  160. package/dist/extraction/languages/nix.js.map +0 -1
  161. package/dist/extraction/languages/objc.d.ts.map +0 -1
  162. package/dist/extraction/languages/objc.js.map +0 -1
  163. package/dist/extraction/languages/pascal.d.ts.map +0 -1
  164. package/dist/extraction/languages/pascal.js.map +0 -1
  165. package/dist/extraction/languages/php.d.ts.map +0 -1
  166. package/dist/extraction/languages/php.js.map +0 -1
  167. package/dist/extraction/languages/python.d.ts.map +0 -1
  168. package/dist/extraction/languages/python.js.map +0 -1
  169. package/dist/extraction/languages/r.d.ts.map +0 -1
  170. package/dist/extraction/languages/r.js.map +0 -1
  171. package/dist/extraction/languages/ruby.d.ts.map +0 -1
  172. package/dist/extraction/languages/ruby.js.map +0 -1
  173. package/dist/extraction/languages/rust.d.ts.map +0 -1
  174. package/dist/extraction/languages/rust.js.map +0 -1
  175. package/dist/extraction/languages/scala.d.ts.map +0 -1
  176. package/dist/extraction/languages/scala.js.map +0 -1
  177. package/dist/extraction/languages/solidity.d.ts.map +0 -1
  178. package/dist/extraction/languages/solidity.js.map +0 -1
  179. package/dist/extraction/languages/swift.d.ts.map +0 -1
  180. package/dist/extraction/languages/swift.js.map +0 -1
  181. package/dist/extraction/languages/terraform.d.ts.map +0 -1
  182. package/dist/extraction/languages/terraform.js.map +0 -1
  183. package/dist/extraction/languages/typescript.d.ts.map +0 -1
  184. package/dist/extraction/languages/typescript.js.map +0 -1
  185. package/dist/extraction/languages/vbnet.d.ts.map +0 -1
  186. package/dist/extraction/languages/vbnet.js.map +0 -1
  187. package/dist/extraction/liquid-extractor.d.ts.map +0 -1
  188. package/dist/extraction/liquid-extractor.js.map +0 -1
  189. package/dist/extraction/mybatis-extractor.d.ts.map +0 -1
  190. package/dist/extraction/mybatis-extractor.js.map +0 -1
  191. package/dist/extraction/parse-pool.d.ts.map +0 -1
  192. package/dist/extraction/parse-pool.js.map +0 -1
  193. package/dist/extraction/parse-worker.d.ts.map +0 -1
  194. package/dist/extraction/parse-worker.js.map +0 -1
  195. package/dist/extraction/razor-extractor.d.ts.map +0 -1
  196. package/dist/extraction/razor-extractor.js.map +0 -1
  197. package/dist/extraction/store-worker.d.ts.map +0 -1
  198. package/dist/extraction/store-worker.js.map +0 -1
  199. package/dist/extraction/store-writer.d.ts.map +0 -1
  200. package/dist/extraction/store-writer.js.map +0 -1
  201. package/dist/extraction/svelte-extractor.d.ts.map +0 -1
  202. package/dist/extraction/svelte-extractor.js.map +0 -1
  203. package/dist/extraction/tree-sitter-helpers.d.ts.map +0 -1
  204. package/dist/extraction/tree-sitter-helpers.js.map +0 -1
  205. package/dist/extraction/tree-sitter-types.d.ts.map +0 -1
  206. package/dist/extraction/tree-sitter-types.js.map +0 -1
  207. package/dist/extraction/tree-sitter.d.ts.map +0 -1
  208. package/dist/extraction/tree-sitter.js.map +0 -1
  209. package/dist/extraction/vue-extractor.d.ts.map +0 -1
  210. package/dist/extraction/vue-extractor.js.map +0 -1
  211. package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
  212. package/dist/extraction/wasm-runtime-flags.d.ts.map +0 -1
  213. package/dist/extraction/wasm-runtime-flags.js.map +0 -1
  214. package/dist/graph/index.d.ts.map +0 -1
  215. package/dist/graph/index.js.map +0 -1
  216. package/dist/graph/queries.d.ts.map +0 -1
  217. package/dist/graph/queries.js.map +0 -1
  218. package/dist/graph/traversal.d.ts.map +0 -1
  219. package/dist/graph/traversal.js.map +0 -1
  220. package/dist/graph-sources.d.ts.map +0 -1
  221. package/dist/graph-sources.js.map +0 -1
  222. package/dist/index.d.ts.map +0 -1
  223. package/dist/index.js.map +0 -1
  224. package/dist/installer/config-writer.d.ts.map +0 -1
  225. package/dist/installer/config-writer.js.map +0 -1
  226. package/dist/installer/index.d.ts.map +0 -1
  227. package/dist/installer/index.js.map +0 -1
  228. package/dist/installer/instructions-template.d.ts.map +0 -1
  229. package/dist/installer/instructions-template.js.map +0 -1
  230. package/dist/installer/targets/antigravity.d.ts.map +0 -1
  231. package/dist/installer/targets/antigravity.js.map +0 -1
  232. package/dist/installer/targets/claude.d.ts.map +0 -1
  233. package/dist/installer/targets/claude.js.map +0 -1
  234. package/dist/installer/targets/codebuddy.d.ts.map +0 -1
  235. package/dist/installer/targets/codebuddy.js.map +0 -1
  236. package/dist/installer/targets/codex.d.ts.map +0 -1
  237. package/dist/installer/targets/codex.js.map +0 -1
  238. package/dist/installer/targets/cursor.d.ts.map +0 -1
  239. package/dist/installer/targets/cursor.js.map +0 -1
  240. package/dist/installer/targets/deveco.d.ts.map +0 -1
  241. package/dist/installer/targets/deveco.js.map +0 -1
  242. package/dist/installer/targets/gemini.d.ts.map +0 -1
  243. package/dist/installer/targets/gemini.js.map +0 -1
  244. package/dist/installer/targets/hermes.d.ts.map +0 -1
  245. package/dist/installer/targets/hermes.js.map +0 -1
  246. package/dist/installer/targets/kiro.d.ts.map +0 -1
  247. package/dist/installer/targets/kiro.js.map +0 -1
  248. package/dist/installer/targets/opencode.d.ts.map +0 -1
  249. package/dist/installer/targets/opencode.js.map +0 -1
  250. package/dist/installer/targets/registry.d.ts.map +0 -1
  251. package/dist/installer/targets/registry.js.map +0 -1
  252. package/dist/installer/targets/shared.d.ts.map +0 -1
  253. package/dist/installer/targets/shared.js.map +0 -1
  254. package/dist/installer/targets/toml.d.ts.map +0 -1
  255. package/dist/installer/targets/toml.js.map +0 -1
  256. package/dist/installer/targets/types.d.ts.map +0 -1
  257. package/dist/installer/targets/types.js.map +0 -1
  258. package/dist/mcp/daemon-manager.d.ts.map +0 -1
  259. package/dist/mcp/daemon-manager.js.map +0 -1
  260. package/dist/mcp/daemon-paths.d.ts.map +0 -1
  261. package/dist/mcp/daemon-paths.js.map +0 -1
  262. package/dist/mcp/daemon-registry.d.ts.map +0 -1
  263. package/dist/mcp/daemon-registry.js.map +0 -1
  264. package/dist/mcp/daemon.d.ts.map +0 -1
  265. package/dist/mcp/daemon.js.map +0 -1
  266. package/dist/mcp/diff-impact.d.ts.map +0 -1
  267. package/dist/mcp/diff-impact.js.map +0 -1
  268. package/dist/mcp/dynamic-boundaries.d.ts.map +0 -1
  269. package/dist/mcp/dynamic-boundaries.js.map +0 -1
  270. package/dist/mcp/early-ppid.d.ts.map +0 -1
  271. package/dist/mcp/early-ppid.js.map +0 -1
  272. package/dist/mcp/engine.d.ts.map +0 -1
  273. package/dist/mcp/engine.js.map +0 -1
  274. package/dist/mcp/evidence-rendering.d.ts.map +0 -1
  275. package/dist/mcp/evidence-rendering.js.map +0 -1
  276. package/dist/mcp/explore-dedup.d.ts.map +0 -1
  277. package/dist/mcp/explore-dedup.js.map +0 -1
  278. package/dist/mcp/explore-repeat-guard.d.ts.map +0 -1
  279. package/dist/mcp/explore-repeat-guard.js.map +0 -1
  280. package/dist/mcp/explore-session-state.d.ts.map +0 -1
  281. package/dist/mcp/explore-session-state.js.map +0 -1
  282. package/dist/mcp/index.d.ts.map +0 -1
  283. package/dist/mcp/index.js.map +0 -1
  284. package/dist/mcp/liveness-watchdog.d.ts.map +0 -1
  285. package/dist/mcp/liveness-watchdog.js.map +0 -1
  286. package/dist/mcp/memory-budget.d.ts.map +0 -1
  287. package/dist/mcp/memory-budget.js.map +0 -1
  288. package/dist/mcp/ppid-watchdog.d.ts.map +0 -1
  289. package/dist/mcp/ppid-watchdog.js.map +0 -1
  290. package/dist/mcp/proxy.d.ts.map +0 -1
  291. package/dist/mcp/proxy.js.map +0 -1
  292. package/dist/mcp/query-cache.d.ts.map +0 -1
  293. package/dist/mcp/query-cache.js.map +0 -1
  294. package/dist/mcp/query-pool.d.ts.map +0 -1
  295. package/dist/mcp/query-pool.js.map +0 -1
  296. package/dist/mcp/query-worker.d.ts.map +0 -1
  297. package/dist/mcp/query-worker.js.map +0 -1
  298. package/dist/mcp/server-instructions.d.ts.map +0 -1
  299. package/dist/mcp/server-instructions.js.map +0 -1
  300. package/dist/mcp/session.d.ts.map +0 -1
  301. package/dist/mcp/session.js.map +0 -1
  302. package/dist/mcp/startup-handshake.d.ts.map +0 -1
  303. package/dist/mcp/startup-handshake.js.map +0 -1
  304. package/dist/mcp/stdin-teardown.d.ts.map +0 -1
  305. package/dist/mcp/stdin-teardown.js.map +0 -1
  306. package/dist/mcp/tools.d.ts.map +0 -1
  307. package/dist/mcp/tools.js.map +0 -1
  308. package/dist/mcp/transport.d.ts.map +0 -1
  309. package/dist/mcp/transport.js.map +0 -1
  310. package/dist/mcp/version.d.ts.map +0 -1
  311. package/dist/mcp/version.js.map +0 -1
  312. package/dist/project-config.d.ts.map +0 -1
  313. package/dist/project-config.js.map +0 -1
  314. package/dist/project-map/index.d.ts.map +0 -1
  315. package/dist/project-map/index.js.map +0 -1
  316. package/dist/resolution/c-fnptr-synthesizer.d.ts.map +0 -1
  317. package/dist/resolution/c-fnptr-synthesizer.js.map +0 -1
  318. package/dist/resolution/callback-synthesizer.d.ts.map +0 -1
  319. package/dist/resolution/callback-synthesizer.js.map +0 -1
  320. package/dist/resolution/cooperative-yield.d.ts.map +0 -1
  321. package/dist/resolution/cooperative-yield.js.map +0 -1
  322. package/dist/resolution/frameworks/arkts-entry.d.ts.map +0 -1
  323. package/dist/resolution/frameworks/arkts-entry.js.map +0 -1
  324. package/dist/resolution/frameworks/arkts-napi.d.ts.map +0 -1
  325. package/dist/resolution/frameworks/arkts-napi.js.map +0 -1
  326. package/dist/resolution/frameworks/astro.d.ts.map +0 -1
  327. package/dist/resolution/frameworks/astro.js.map +0 -1
  328. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +0 -1
  329. package/dist/resolution/frameworks/cargo-workspace.js.map +0 -1
  330. package/dist/resolution/frameworks/cics.d.ts.map +0 -1
  331. package/dist/resolution/frameworks/cics.js.map +0 -1
  332. package/dist/resolution/frameworks/csharp.d.ts.map +0 -1
  333. package/dist/resolution/frameworks/csharp.js.map +0 -1
  334. package/dist/resolution/frameworks/drupal.d.ts.map +0 -1
  335. package/dist/resolution/frameworks/drupal.js.map +0 -1
  336. package/dist/resolution/frameworks/expo-modules.d.ts.map +0 -1
  337. package/dist/resolution/frameworks/expo-modules.js.map +0 -1
  338. package/dist/resolution/frameworks/express.d.ts.map +0 -1
  339. package/dist/resolution/frameworks/express.js.map +0 -1
  340. package/dist/resolution/frameworks/fabric.d.ts.map +0 -1
  341. package/dist/resolution/frameworks/fabric.js.map +0 -1
  342. package/dist/resolution/frameworks/go.d.ts.map +0 -1
  343. package/dist/resolution/frameworks/go.js.map +0 -1
  344. package/dist/resolution/frameworks/goframe.d.ts.map +0 -1
  345. package/dist/resolution/frameworks/goframe.js.map +0 -1
  346. package/dist/resolution/frameworks/index.d.ts.map +0 -1
  347. package/dist/resolution/frameworks/index.js.map +0 -1
  348. package/dist/resolution/frameworks/java.d.ts.map +0 -1
  349. package/dist/resolution/frameworks/java.js.map +0 -1
  350. package/dist/resolution/frameworks/laravel.d.ts.map +0 -1
  351. package/dist/resolution/frameworks/laravel.js.map +0 -1
  352. package/dist/resolution/frameworks/nestjs.d.ts.map +0 -1
  353. package/dist/resolution/frameworks/nestjs.js.map +0 -1
  354. package/dist/resolution/frameworks/play.d.ts.map +0 -1
  355. package/dist/resolution/frameworks/play.js.map +0 -1
  356. package/dist/resolution/frameworks/python.d.ts.map +0 -1
  357. package/dist/resolution/frameworks/python.js.map +0 -1
  358. package/dist/resolution/frameworks/react-native.d.ts.map +0 -1
  359. package/dist/resolution/frameworks/react-native.js.map +0 -1
  360. package/dist/resolution/frameworks/react.d.ts.map +0 -1
  361. package/dist/resolution/frameworks/react.js.map +0 -1
  362. package/dist/resolution/frameworks/ruby.d.ts.map +0 -1
  363. package/dist/resolution/frameworks/ruby.js.map +0 -1
  364. package/dist/resolution/frameworks/rust.d.ts.map +0 -1
  365. package/dist/resolution/frameworks/rust.js.map +0 -1
  366. package/dist/resolution/frameworks/svelte.d.ts.map +0 -1
  367. package/dist/resolution/frameworks/svelte.js.map +0 -1
  368. package/dist/resolution/frameworks/swift-objc.d.ts.map +0 -1
  369. package/dist/resolution/frameworks/swift-objc.js.map +0 -1
  370. package/dist/resolution/frameworks/swift.d.ts.map +0 -1
  371. package/dist/resolution/frameworks/swift.js.map +0 -1
  372. package/dist/resolution/frameworks/terraform.d.ts.map +0 -1
  373. package/dist/resolution/frameworks/terraform.js.map +0 -1
  374. package/dist/resolution/frameworks/vue.d.ts.map +0 -1
  375. package/dist/resolution/frameworks/vue.js.map +0 -1
  376. package/dist/resolution/go-module.d.ts.map +0 -1
  377. package/dist/resolution/go-module.js.map +0 -1
  378. package/dist/resolution/goframe-synthesizer.d.ts.map +0 -1
  379. package/dist/resolution/goframe-synthesizer.js.map +0 -1
  380. package/dist/resolution/import-resolver.d.ts.map +0 -1
  381. package/dist/resolution/import-resolver.js.map +0 -1
  382. package/dist/resolution/index.d.ts.map +0 -1
  383. package/dist/resolution/index.js.map +0 -1
  384. package/dist/resolution/lru-cache.d.ts.map +0 -1
  385. package/dist/resolution/lru-cache.js.map +0 -1
  386. package/dist/resolution/memory-budget.d.ts.map +0 -1
  387. package/dist/resolution/memory-budget.js.map +0 -1
  388. package/dist/resolution/name-matcher.d.ts.map +0 -1
  389. package/dist/resolution/name-matcher.js.map +0 -1
  390. package/dist/resolution/path-aliases.d.ts.map +0 -1
  391. package/dist/resolution/path-aliases.js.map +0 -1
  392. package/dist/resolution/resolver-pool.d.ts.map +0 -1
  393. package/dist/resolution/resolver-pool.js.map +0 -1
  394. package/dist/resolution/resolver-worker.d.ts.map +0 -1
  395. package/dist/resolution/resolver-worker.js.map +0 -1
  396. package/dist/resolution/strip-comments.d.ts.map +0 -1
  397. package/dist/resolution/strip-comments.js.map +0 -1
  398. package/dist/resolution/swift-objc-bridge.d.ts.map +0 -1
  399. package/dist/resolution/swift-objc-bridge.js.map +0 -1
  400. package/dist/resolution/types.d.ts.map +0 -1
  401. package/dist/resolution/types.js.map +0 -1
  402. package/dist/resolution/workspace-packages.d.ts.map +0 -1
  403. package/dist/resolution/workspace-packages.js.map +0 -1
  404. package/dist/search/identifier-segments.d.ts.map +0 -1
  405. package/dist/search/identifier-segments.js.map +0 -1
  406. package/dist/search/literal-evidence.d.ts.map +0 -1
  407. package/dist/search/literal-evidence.js.map +0 -1
  408. package/dist/search/query-parser.d.ts.map +0 -1
  409. package/dist/search/query-parser.js.map +0 -1
  410. package/dist/search/query-plan-provider.d.ts.map +0 -1
  411. package/dist/search/query-plan-provider.js.map +0 -1
  412. package/dist/search/query-plan.d.ts.map +0 -1
  413. package/dist/search/query-plan.js.map +0 -1
  414. package/dist/search/query-utils.d.ts.map +0 -1
  415. package/dist/search/query-utils.js.map +0 -1
  416. package/dist/spec/build/diff-parser.d.ts.map +0 -1
  417. package/dist/spec/build/diff-parser.js.map +0 -1
  418. package/dist/spec/build/pipeline.d.ts.map +0 -1
  419. package/dist/spec/build/pipeline.js.map +0 -1
  420. package/dist/spec/build/scan.d.ts.map +0 -1
  421. package/dist/spec/build/scan.js.map +0 -1
  422. package/dist/spec/build/scope-resolver.d.ts.map +0 -1
  423. package/dist/spec/build/scope-resolver.js.map +0 -1
  424. package/dist/spec/build/spec-extractor.d.ts.map +0 -1
  425. package/dist/spec/build/spec-extractor.js.map +0 -1
  426. package/dist/spec/config.d.ts.map +0 -1
  427. package/dist/spec/config.js.map +0 -1
  428. package/dist/spec/db/commit-node.d.ts.map +0 -1
  429. package/dist/spec/db/commit-node.js.map +0 -1
  430. package/dist/spec/db/fragment-node.d.ts.map +0 -1
  431. package/dist/spec/db/fragment-node.js.map +0 -1
  432. package/dist/spec/db/fts.d.ts.map +0 -1
  433. package/dist/spec/db/fts.js.map +0 -1
  434. package/dist/spec/db/index.d.ts.map +0 -1
  435. package/dist/spec/db/index.js.map +0 -1
  436. package/dist/spec/db/persist.d.ts.map +0 -1
  437. package/dist/spec/db/persist.js.map +0 -1
  438. package/dist/spec/db/relations.d.ts.map +0 -1
  439. package/dist/spec/db/relations.js.map +0 -1
  440. package/dist/spec/db/schema.d.ts.map +0 -1
  441. package/dist/spec/db/schema.js.map +0 -1
  442. package/dist/spec/db/spec-node.d.ts.map +0 -1
  443. package/dist/spec/db/spec-node.js.map +0 -1
  444. package/dist/spec/db/sql-utils.d.ts.map +0 -1
  445. package/dist/spec/db/sql-utils.js.map +0 -1
  446. package/dist/spec/evolve/cluster-context.d.ts.map +0 -1
  447. package/dist/spec/evolve/cluster-context.js.map +0 -1
  448. package/dist/spec/evolve/commit-spec-analyzer.d.ts.map +0 -1
  449. package/dist/spec/evolve/commit-spec-analyzer.js.map +0 -1
  450. package/dist/spec/evolve/commit-spec-persister.d.ts.map +0 -1
  451. package/dist/spec/evolve/commit-spec-persister.js.map +0 -1
  452. package/dist/spec/evolve/impact-locator.d.ts.map +0 -1
  453. package/dist/spec/evolve/impact-locator.js.map +0 -1
  454. package/dist/spec/evolve/pipeline.d.ts.map +0 -1
  455. package/dist/spec/evolve/pipeline.js.map +0 -1
  456. package/dist/spec/evolve/spec-rewriter.d.ts.map +0 -1
  457. package/dist/spec/evolve/spec-rewriter.js.map +0 -1
  458. package/dist/spec/git/commits.d.ts.map +0 -1
  459. package/dist/spec/git/commits.js.map +0 -1
  460. package/dist/spec/git/exec.d.ts.map +0 -1
  461. package/dist/spec/git/exec.js.map +0 -1
  462. package/dist/spec/git/index.d.ts.map +0 -1
  463. package/dist/spec/git/index.js.map +0 -1
  464. package/dist/spec/graph/index.d.ts.map +0 -1
  465. package/dist/spec/graph/index.js.map +0 -1
  466. package/dist/spec/graph/queries.d.ts.map +0 -1
  467. package/dist/spec/graph/queries.js.map +0 -1
  468. package/dist/spec/llm/agent-client.d.ts.map +0 -1
  469. package/dist/spec/llm/agent-client.js.map +0 -1
  470. package/dist/spec/llm/agents/claude-code.d.ts.map +0 -1
  471. package/dist/spec/llm/agents/claude-code.js.map +0 -1
  472. package/dist/spec/llm/agents/codex.d.ts.map +0 -1
  473. package/dist/spec/llm/agents/codex.js.map +0 -1
  474. package/dist/spec/llm/agents/detect-utils.d.ts.map +0 -1
  475. package/dist/spec/llm/agents/detect-utils.js.map +0 -1
  476. package/dist/spec/llm/agents/deveco-code.d.ts.map +0 -1
  477. package/dist/spec/llm/agents/deveco-code.js.map +0 -1
  478. package/dist/spec/llm/agents/index.d.ts.map +0 -1
  479. package/dist/spec/llm/agents/index.js.map +0 -1
  480. package/dist/spec/llm/agents/types.d.ts.map +0 -1
  481. package/dist/spec/llm/agents/types.js.map +0 -1
  482. package/dist/spec/llm/client.d.ts.map +0 -1
  483. package/dist/spec/llm/client.js.map +0 -1
  484. package/dist/spec/llm/factory.d.ts.map +0 -1
  485. package/dist/spec/llm/factory.js.map +0 -1
  486. package/dist/spec/llm/prompts.d.ts.map +0 -1
  487. package/dist/spec/llm/prompts.js.map +0 -1
  488. package/dist/spec/llm/retry.d.ts.map +0 -1
  489. package/dist/spec/llm/retry.js.map +0 -1
  490. package/dist/spec/mine/addon/adapter.d.ts.map +0 -1
  491. package/dist/spec/mine/addon/adapter.js.map +0 -1
  492. package/dist/spec/mine/addon/render.d.ts.map +0 -1
  493. package/dist/spec/mine/addon/render.js.map +0 -1
  494. package/dist/spec/mine/addon/types.d.ts.map +0 -1
  495. package/dist/spec/mine/addon/types.js.map +0 -1
  496. package/dist/spec/mine/clustering/features.d.ts.map +0 -1
  497. package/dist/spec/mine/clustering/features.js.map +0 -1
  498. package/dist/spec/mine/clustering/index.d.ts.map +0 -1
  499. package/dist/spec/mine/clustering/index.js.map +0 -1
  500. package/dist/spec/mine/clustering/leiden.d.ts.map +0 -1
  501. package/dist/spec/mine/clustering/leiden.js.map +0 -1
  502. package/dist/spec/mine/clustering/text-similarity.d.ts.map +0 -1
  503. package/dist/spec/mine/clustering/text-similarity.js.map +0 -1
  504. package/dist/spec/mine/generator.d.ts.map +0 -1
  505. package/dist/spec/mine/generator.js.map +0 -1
  506. package/dist/spec/mine/persist.d.ts.map +0 -1
  507. package/dist/spec/mine/persist.js.map +0 -1
  508. package/dist/spec/mine/pipeline.d.ts.map +0 -1
  509. package/dist/spec/mine/pipeline.js.map +0 -1
  510. package/dist/spec/mine/scanner.d.ts.map +0 -1
  511. package/dist/spec/mine/scanner.js.map +0 -1
  512. package/dist/spec/types.d.ts.map +0 -1
  513. package/dist/spec/types.js.map +0 -1
  514. package/dist/spec/ui/index.d.ts.map +0 -1
  515. package/dist/spec/ui/index.js.map +0 -1
  516. package/dist/spec/ui/progress-handler.d.ts.map +0 -1
  517. package/dist/spec/ui/progress-handler.js.map +0 -1
  518. package/dist/spec/ui/progress.d.ts.map +0 -1
  519. package/dist/spec/ui/progress.js.map +0 -1
  520. package/dist/spec/utils/fs.d.ts.map +0 -1
  521. package/dist/spec/utils/fs.js.map +0 -1
  522. package/dist/spec/utils/index.d.ts.map +0 -1
  523. package/dist/spec/utils/index.js.map +0 -1
  524. package/dist/spec/utils/meta.d.ts.map +0 -1
  525. package/dist/spec/utils/meta.js.map +0 -1
  526. package/dist/spec/utils/truncate.d.ts.map +0 -1
  527. package/dist/spec/utils/truncate.js.map +0 -1
  528. package/dist/sync/git-hooks.d.ts.map +0 -1
  529. package/dist/sync/git-hooks.js.map +0 -1
  530. package/dist/sync/index.d.ts.map +0 -1
  531. package/dist/sync/index.js.map +0 -1
  532. package/dist/sync/watch-policy.d.ts.map +0 -1
  533. package/dist/sync/watch-policy.js.map +0 -1
  534. package/dist/sync/watcher.d.ts.map +0 -1
  535. package/dist/sync/watcher.js.map +0 -1
  536. package/dist/sync/worktree.d.ts.map +0 -1
  537. package/dist/sync/worktree.js.map +0 -1
  538. package/dist/types.d.ts.map +0 -1
  539. package/dist/types.js.map +0 -1
  540. package/dist/ui/glyphs.d.ts.map +0 -1
  541. package/dist/ui/glyphs.js.map +0 -1
  542. package/dist/ui/shimmer-progress.d.ts.map +0 -1
  543. package/dist/ui/shimmer-progress.js.map +0 -1
  544. package/dist/ui/shimmer-worker.d.ts.map +0 -1
  545. package/dist/ui/shimmer-worker.js.map +0 -1
  546. package/dist/ui/types.d.ts.map +0 -1
  547. package/dist/ui/types.js.map +0 -1
  548. package/dist/upgrade/index.d.ts.map +0 -1
  549. package/dist/upgrade/index.js.map +0 -1
  550. package/dist/upgrade/remove-binary.d.ts.map +0 -1
  551. package/dist/upgrade/remove-binary.js.map +0 -1
  552. package/dist/upgrade/update-check.d.ts.map +0 -1
  553. package/dist/upgrade/update-check.js.map +0 -1
  554. package/dist/utils.d.ts.map +0 -1
  555. package/dist/utils.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,36 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
10
10
  ## [Unreleased]
11
11
 
12
12
 
13
+ ## [1.5.10] - 2026-09-20
14
+
15
+ ### Fixes
16
+
17
+ - ArkTS synthetic PROJECT modules are limited to Node `package.json` trees (e.g. hvigor plugins). Forgotten Harmony HARs that only have `oh-package.json5` / loose `.ets` outside root `build-profile.json5` are no longer registered for `analyseByModule` BODIES — on SceneBoard-scale repos that was reloading already-indexed monorepo deps into ModuleCache and inflating wall time and peak RSS. Those orphans are indexed via tree-sitter instead. Parent-dir swallow of real Harmony modules (e.g. `synthetic:feature/`) remains blocked (Spec 0036).
18
+ - After a streamed ArkTS modular batch finishes and releases the Scene, orphan `.ets` files that were never PROJECT-persisted no longer trigger a second full `analyseByModule` (the “127/127 done → starts again at 1/127” loop). They use the TypeScript tree-sitter fallback instead (Spec 0036).
19
+ - `homegraph init`/`index` reported duration now covers the full wall clock (extract + FTS rebuild + resolve/link + maintenance), not only the extraction orchestrator phase (Spec 0036).
20
+ - Harmony `build-profile.json5` files that use single-quoted strings (e.g. `'2in1'`) and bare keys now parse correctly, so multi-module ArkTS dirty sync can map changed `.ets` files to PROJECT modules instead of always falling back to a full rebuild (Spec 0034).
21
+
22
+ ### Improvements
23
+
24
+ - Bump `arkanalyzer` to **1.0.94**.
25
+ - Harmony projects with a root `build-profile.json5` now default to **serial indexing** after ArkAnalyzer: one parse worker and no resolve/synthesis worker pool. On SceneBoard-scale repos this cut peak process-tree PrivateMemory from ~8.5GB to ~3.8GB with only ~6% more wall clock. Opt out with `HOMEGRAPH_HARMONY_SERIAL=0`; force on with `=1`. Explicit `CODEGRAPH_PARSE_WORKERS` still overrides parse concurrency (Spec 0037).
26
+ - MCP product index readiness is now five short states (`empty` / `fast` / `full` / `dirty` / `syncing`): tool replies use a one-line `HomeGraph status=…` footer (or that line alone when the tool cannot answer yet). Pending edits surface as `dirty` with path list instead of the long stale banner; write locks stay `syncing`. MCP initialize includes a one-line status glossary (Spec 0035).
27
+
28
+ ## [1.5.8] - 2026-09-15
29
+
30
+ ### Improvements
31
+
32
+ - SQLite no longer depends on optional `better-sqlite3`. Backends are **`node:sqlite`** (Node ≥22.5 with FTS5) then **`node-sqlite3-wasm`**. Install trees drop ~10 MiB of unused native-addon source when vendor/offline packaging skips `prebuild-install`. `HOMEGRAPH_SQLITE_BACKEND=native` is ignored (use `node-sqlite` or `wasm`). Prefer Node 22.5+ for WAL (Spec 0033).
33
+ - Published `dist/` no longer includes source maps; vendored tree-sitter grammars are copied from an explicit list (unlisted files such as leftover wasm are not shipped). The `openai` package is an optional dependency used only by spec LLM commands — install it when running `homegraph spec` against an API (`npm install openai`). MCP `serve mcp` does not require it (Spec 0031).
34
+ - MCP product hosts get a unified **four-state** index readiness in tool results (`empty` / `fast` / `full` / `syncing`): deep tools and `homegraph_project` return success-shaped guidance with `status=…` instead of ambiguous phase prose; `tools/list` stays fully exposed. Auto-init cold start sets `building_fast` immediately after creating the empty DB, serializes empty-DB creation with `homegraph.lock`, and opens an existing index when a concurrent init wins. **Fast build** runs in-process; **full build** continues in the same MCP/daemon process in the background (`indexAll` yields between batches — no sibling `homegraph index` CLI, so there is no second writer to lock against). SQLite busy / write-lock contention maps to `syncing` rather than `isError`. The file watcher starts after the full build finishes (Spec 0032).
35
+ - ArkTS exploration now finds bounded directed paths between named anchors, selecting intermediate declarations and registration sources together. Typed state/event goals, exact qualified-name recovery, ambiguity gaps and explicit stop reasons reduce missing connections without treating shared callees as a path. `HOMEGRAPH_ARKTS_QUERY_PATHS=0` restores the first-batch evidence strategy for comparison; indexing and external tool interfaces are unchanged (Spec 0030).
36
+ - ArkTS symbol/flow exploration now selects complete source declarations and the dependencies of static relation evidence together. Explicit gaps identify omitted, stale and unindexed evidence; output and planner budgets no longer cut these packs mid-body. Virtual ArkAnalyzer entries are excluded, cache hits validate source fingerprints, and `HOMEGRAPH_ARKTS_EVIDENCE_PACKS=0` restores legacy rendering for comparison (Spec 0029). Literal/resource and focused usages/modules/native routes retain their existing behavior.
37
+
38
+ ### Fixes
39
+
40
+ - An MCP host's explicit project declaration (`--path`, or the client's `rootUri`/`workspaceFolders`) is now a **floor** for root resolution: a stray ancestor `.homegraph/` above it is never adopted. Previously a nested server walked up unbounded and could latch onto an unrelated ancestor index — observed live as a DevEco evaluation session creating `.homegraph` at a benchmark harness root, after which every nested project's daemon tried to index the entire result tree (OOM at 3.5GB in 48s) while its server was SIGKILL'd by the 60s liveness watchdog with every tool call hanging as `Connection closed`. Bare `serve mcp` and CLI commands keep the git-style unbounded walk-up; tool-level `projectPath` resolution is unchanged (Spec 0028).
41
+ - `homegraph_explore`'s description no longer reports `Budget: make at most 1 calls for this project (0 files indexed)` while auto-init is still building. Hosts snapshot `tools/list` once at connect, so that transient "0 files" read as terminal and agents abandoned HomeGraph for the whole session even though the index completed seconds later. The 0-file description now matches what a call actually returns: a failed build asks the agent to relay `homegraph index` to the user, an in-flight build points at `homegraph_project` and says to retry once indexing finishes, and a genuinely empty project says so honestly. Indexed repos keep the usual call-budget note unchanged (Spec 0027).
42
+
13
43
  ## [1.5.7] - 2026-09-09
14
44
 
15
45
  ### Fixes
@@ -19,12 +49,17 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
19
49
 
20
50
  ### Improvements
21
51
 
52
+ - Prefer ordinary bash/search/read for source localization and use graph tools only for an unresolved relation. Remove mandatory explore-first guidance in both MCP initialization and tool descriptions; retain indexing, query schemas and validation requirements (Spec 0028).
53
+ - Preserve the action and constraints in explore queries, use repository-relative paths, and optionally label node source excerpts with a content identity for trace analysis (`HOMEGRAPH_SOURCE_RECEIPTS=1`, Spec 0027).
54
+
22
55
  - MCP `initialize` instructions: **single-file path-pinned edits → Read + edit, skip `homegraph_*`**; explore only when locate/cross-file is needed.
23
56
  - Explore **defers** (`Skip HomeGraph`, kind `path-pinned-edit`) when the query names one `…/File.ext` and is a code-change shape — avoids explore context tax on 082-style tasks.
24
57
  - Path scaffolding (`features/.../Foo.ets` + basename-as-Type) no longer counts as multi-anchor; `.ets`/`.ts`/… are not parsed as member access.
25
58
 
26
59
  ### New Features
27
60
 
61
+ - Standard-library Python retrieval debugger with an original-source Spatial Upscale demo, interactive steps, rules/LLM comparison, and persistent MCP/Planner evidence and error records (Spec 0025).
62
+
28
63
  - Experimental structured query planning for explore (Spec 0022): shared local routing features; optional, explicitly configured one-call model intent/decomposition/rephrase; bounded dependent retrieval with a shared deadline/output budget, validated anchors, worker propagation, context hints and direction-aware cache keys. Model failures fall back locally; compact diagnostic metadata includes planning usage/time and per-step coverage. No remote model calls by default.
29
64
 
30
65
  ### Fixes
@@ -219,3 +254,5 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
219
254
  [1.4.1]: https://gitcode.com/ProgramAnalysis/homegraph/tags/v1.4.1
220
255
  [1.5.6]: https://github.com/fujiaxin-coder/homegraph/releases/tag/v1.5.6
221
256
  [1.5.7]: https://github.com/fujiaxin-coder/homegraph/releases/tag/v1.5.7
257
+ [1.5.8]: https://github.com/fujiaxin-coder/homegraph/releases/tag/v1.5.8
258
+ [1.5.10]: https://github.com/fujiaxin-coder/homegraph/releases/tag/v1.5.10
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
  ### 1. 安装 CLI
17
17
 
18
- 需要 **Node.js 22+**(推荐 22.5+ 或 24)。SQLite 优先用内置 `node:sqlite`(≥22.5),否则 `better-sqlite3`(12.x),再不行回退 `node-sqlite3-wasm`。
18
+ 需要 **Node.js 22+**(推荐 22.5+ 或 24)。SQLite 优先用内置 `node:sqlite`(≥22.5 且含 FTS5),否则回退 `node-sqlite3-wasm`。
19
19
 
20
20
  ```bash
21
21
  npm install -g homegraph
@@ -356,7 +356,7 @@ Cursor 等项目级配置写入 `./.cursor/mcp.json`,格式相同。推荐使
356
356
 
357
357
  ## 环境要求
358
358
 
359
- - Node.js **22+**(推荐 22.5+ 或 24;SQLite:`node:sqlite` → better-sqlite3 12.x → wasm)
359
+ - Node.js **22+**(推荐 22.5+ 或 24;SQLite:`node:sqlite` → wasm)
360
360
  - 首次索引时会对项目源码做 AST 解析,大型仓库首次 `init -i` 可能需要数分钟
361
361
  - WSL2 下若项目位于 Windows 盘符(`/mnt/c` 等)且 MCP 连接不稳定,可设置 `HOMEGRAPH_NO_DAEMON=1` 跳过共享后台服务,每个会话独立运行
362
362
 
@@ -573,6 +573,7 @@ function main() {
573
573
  .option('-f, --force', 'Index even if the path looks like your home directory or a filesystem root')
574
574
  .option('-q, --quiet', 'Suppress progress output')
575
575
  .option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
576
+ .option('--inplace', 'Index into the existing database without recreating it (MCP auto-init; DB may already be open by the parent)')
576
577
  .action(async (pathArg, options) => {
577
578
  const projectPath = resolveProjectPath(pathArg);
578
579
  try {
@@ -589,16 +590,13 @@ function main() {
589
590
  process.exit(1);
590
591
  }
591
592
  const { default: HomeGraph } = await loadHomeGraph();
592
- // `index` is a FULL re-index — identical to a fresh `init`. RECREATE the
593
- // database from scratch (discard .homegraph/homegraph.db + its WAL) rather
594
- // than opening the old graph and DELETE-ing every row. The clear-then-index
595
- // approach reported "0 nodes" without the clear (#874); the recreate keeps
596
- // that fixed AND avoids the failure mode where, on a large or pre-fix
597
- // poisoned index, the per-row FTS delete churn wedged the main thread long
598
- // enough to trip the liveness watchdog before scanning even began (#1067).
599
- // recreate() hands back a fresh, empty instance — no clear() needed. For
600
- // fast incremental updates use `sync`.
601
- const cg = await HomeGraph.recreate(projectPath);
593
+ // Default `index` is a FULL re-index via recreate(). MCP auto-init already
594
+ // created an empty DB and keeps it open in the parent — recreate() cannot
595
+ // unlink the file on Windows (EPERM) and the detached child exits with 0
596
+ // files (Spec 0032). `--inplace` opens the existing DB and indexAll()s.
597
+ const cg = options.inplace
598
+ ? await HomeGraph.open(projectPath, { sources: 'both' })
599
+ : await HomeGraph.recreate(projectPath);
602
600
  // Supervise the indexer: self-terminate if orphaned (parent shim killed)
603
601
  // or if the main thread wedges — neither was guarded on this path (#999).
604
602
  const supervision = (0, command_supervision_1.installCommandSupervision)('index');
@@ -809,10 +807,9 @@ function main() {
809
807
  warn('The write-ahead log is larger than the database — killed sessions left it behind. It is reclaimed automatically on open; if it persists across runs, another live HomeGraph process is holding it.');
810
808
  }
811
809
  }
812
- // Prefer node:sqlite → better-sqlite3; wasm is last-resort (no WAL).
810
+ // Prefer node:sqlite; wasm is last-resort (no WAL).
813
811
  const backendLabel = backend === 'node-sqlite' ? chalk.green('node-sqlite')
814
- : backend === 'native' ? chalk.green('native (better-sqlite3)')
815
- : chalk.yellow(`wasm ${(0, glyphs_1.getGlyphs)().dash} slower fallback; use Node 22.5+ or \`npm rebuild better-sqlite3\``);
812
+ : chalk.yellow(`wasm ${(0, glyphs_1.getGlyphs)().dash} slower fallback; use Node 22.5+ for built-in node:sqlite`);
816
813
  console.log(` Backend: ${backendLabel}`);
817
814
  const journalLabel = journalMode === 'wal'
818
815
  ? chalk.green('wal')
@@ -1415,7 +1412,12 @@ function main() {
1415
1412
  * explains this to anyone who runs it by hand.
1416
1413
  */
1417
1414
  async function runServeMcp(options) {
1418
- const projectPath = options.path ? resolveProjectPath(options.path) : undefined;
1415
+ // An MCP host's --path is a DECLARATION of the project root, not a search
1416
+ // hint: resolve it literally and never walk up past it (spec 0028). A stray
1417
+ // ancestor .homegraph above the declared root otherwise hijacks the session
1418
+ // (observed as a harness-root index poisoning every nested bench project).
1419
+ // resolveProjectPath keeps its subdir walk-up for the human CLI subcommands.
1420
+ const projectPath = options.path ? path.resolve(options.path) : undefined;
1419
1421
  // Commander sets watch=false when --no-watch is passed. Route it through
1420
1422
  // the same env-var chokepoint the watcher and MCP server already honor.
1421
1423
  if (options.watch === false) {
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { SqliteDatabase, SqliteBackend } from './sqlite-adapter';
7
7
  import { SchemaVersion } from '../types';
8
- export { SqliteDatabase, SqliteBackend, WASM_FALLBACK_FIX_RECIPE, isNodeSqliteAvailable, isNodeSqliteFts5Available, isNativeSqliteAvailable, } from './sqlite-adapter';
8
+ export { SqliteDatabase, SqliteBackend, WASM_FALLBACK_FIX_RECIPE, isNodeSqliteAvailable, isNodeSqliteFts5Available, } from './sqlite-adapter';
9
9
  /**
10
10
  * WAL size past which `healOversizedWal` (run at every `open`) checkpoints and
11
11
  * truncates the file, and to which `journal_size_limit` clips the WAL after any
package/dist/db/index.js CHANGED
@@ -38,7 +38,7 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  };
39
39
  })();
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.DATABASE_FILENAME = exports.DatabaseConnection = exports.WAL_HEAL_THRESHOLD_BYTES = exports.isNativeSqliteAvailable = exports.isNodeSqliteFts5Available = exports.isNodeSqliteAvailable = exports.WASM_FALLBACK_FIX_RECIPE = void 0;
41
+ exports.DATABASE_FILENAME = exports.DatabaseConnection = exports.WAL_HEAL_THRESHOLD_BYTES = exports.isNodeSqliteFts5Available = exports.isNodeSqliteAvailable = exports.WASM_FALLBACK_FIX_RECIPE = void 0;
42
42
  exports.resolveWalHealBytes = resolveWalHealBytes;
43
43
  exports.getDatabasePath = getDatabasePath;
44
44
  exports.removeDatabaseFiles = removeDatabaseFiles;
@@ -51,7 +51,6 @@ var sqlite_adapter_2 = require("./sqlite-adapter");
51
51
  Object.defineProperty(exports, "WASM_FALLBACK_FIX_RECIPE", { enumerable: true, get: function () { return sqlite_adapter_2.WASM_FALLBACK_FIX_RECIPE; } });
52
52
  Object.defineProperty(exports, "isNodeSqliteAvailable", { enumerable: true, get: function () { return sqlite_adapter_2.isNodeSqliteAvailable; } });
53
53
  Object.defineProperty(exports, "isNodeSqliteFts5Available", { enumerable: true, get: function () { return sqlite_adapter_2.isNodeSqliteFts5Available; } });
54
- Object.defineProperty(exports, "isNativeSqliteAvailable", { enumerable: true, get: function () { return sqlite_adapter_2.isNativeSqliteAvailable; } });
55
54
  /**
56
55
  * Apply connection-level PRAGMAs. Shared by `initialize` and `open` so the two
57
56
  * paths can't drift.
@@ -62,9 +61,9 @@ Object.defineProperty(exports, "isNativeSqliteAvailable", { enumerable: true, ge
62
61
  * the lock instead of throwing "database is locked" immediately. See issue #238.
63
62
  *
64
63
  * The 5s window (was 120s) rides out a normal incremental sync; the old
65
- * 2-minute wait presented as a frozen, hung agent. With WAL (node:sqlite or
66
- * better-sqlite3), reads never block on a writer, so this timeout only governs
67
- * cross-process write contention. The WASM fallback remaps WAL → DELETE.
64
+ * 2-minute wait presented as a frozen, hung agent. With WAL (node:sqlite),
65
+ * reads never block on a writer, so this timeout only governs cross-process
66
+ * write contention. The WASM fallback remaps WAL → DELETE.
68
67
  */
69
68
  function configureConnection(db) {
70
69
  db.pragma('busy_timeout = 5000'); // MUST be first — see above
@@ -593,9 +592,8 @@ class DatabaseConnection {
593
592
  return null;
594
593
  }
595
594
  }
596
- // WASM has no real WAL; mixing node:sqlite with a better-sqlite3 main
597
- // connection (e.g. Node 23 where node:sqlite lacks FTS5) corrupts WAL state.
598
- if (this.backend !== 'node-sqlite' && this.backend !== 'native') {
595
+ // WASM has no real WAL — only checkpoint node:sqlite connections.
596
+ if (this.backend !== 'node-sqlite') {
599
597
  return null;
600
598
  }
601
599
  try {
@@ -605,14 +603,8 @@ class DatabaseConnection {
605
603
  let row = null;
606
604
  let err = null;
607
605
  try {
608
- let db = null;
609
- if (workerData.backend === 'native') {
610
- const Database = require('better-sqlite3');
611
- db = new Database(workerData.dbPath);
612
- } else {
613
- const { DatabaseSync } = require('node:sqlite');
614
- db = new DatabaseSync(workerData.dbPath);
615
- }
606
+ const { DatabaseSync } = require('node:sqlite');
607
+ const db = new DatabaseSync(workerData.dbPath);
616
608
  const mode = workerData.mode === 'TRUNCATE' ? 'TRUNCATE' : 'PASSIVE';
617
609
  try {
618
610
  if (mode === 'TRUNCATE') db.exec('PRAGMA busy_timeout = 2000');
@@ -633,7 +625,7 @@ class DatabaseConnection {
633
625
  try {
634
626
  const worker = new Worker(workerSource, {
635
627
  eval: true,
636
- workerData: { dbPath: this.dbPath, mode, backend: this.backend },
628
+ workerData: { dbPath: this.dbPath, mode },
637
629
  });
638
630
  worker.once('message', (m) => {
639
631
  if (m?.err && process.env.HOMEGRAPH_WAL_VALVE_DEBUG) {
@@ -721,14 +713,8 @@ class DatabaseConnection {
721
713
  const workerSource = `
722
714
  const { workerData, parentPort } = require('node:worker_threads');
723
715
  try {
724
- let db = null;
725
- try {
726
- const { DatabaseSync } = require('node:sqlite');
727
- db = new DatabaseSync(workerData.dbPath);
728
- } catch {
729
- const Database = require('better-sqlite3');
730
- db = new Database(workerData.dbPath);
731
- }
716
+ const { DatabaseSync } = require('node:sqlite');
717
+ const db = new DatabaseSync(workerData.dbPath);
732
718
  for (const p of workerData.pragmas) { try { db.exec(p); } catch {} }
733
719
  try { db.close(); } catch {}
734
720
  } catch {}
@@ -268,7 +268,7 @@ export declare class QueryBuilder {
268
268
  /**
269
269
  * Get nodes by exact qualified name match (uses idx_nodes_qualified_name index)
270
270
  */
271
- getNodesByQualifiedNameExact(qualifiedName: string): Node[];
271
+ getNodesByQualifiedNameExact(qualifiedName: string, limit?: number): Node[];
272
272
  /**
273
273
  * Get nodes by lowercase name match (uses idx_nodes_lower_name expression index)
274
274
  */
@@ -349,6 +349,10 @@ export declare class QueryBuilder {
349
349
  * Get incoming edges to a node
350
350
  */
351
351
  getIncomingEdges(targetId: string, kinds?: EdgeKind[], limit?: number): Edge[];
352
+ /** Bounded local adjacency for evidence search; never load a whole hub into JS.
353
+ * Known endpoints get a small indexed lookup before the bounded neighbor scan.
354
+ */
355
+ getEvidenceEdges(nodeId: string, direction: 'outgoing' | 'incoming', kinds: EdgeKind[], limit: number, preferredIds?: string[]): Edge[];
352
356
  /**
353
357
  * Find all edges where both source and target are in the given node set.
354
358
  * Useful for recovering inter-node connectivity after BFS.
@@ -626,7 +626,7 @@ class QueryBuilder {
626
626
  if (misses.length === 0)
627
627
  return out;
628
628
  // Chunk under SQLite's parameter limit (default 999, raised to 32766
629
- // in better-sqlite3 builds — chunk at 500 for safety across both
629
+ // across node:sqlite / wasm builds — chunk at 500 for safety across both
630
630
  // backends and to keep the query plan simple).
631
631
  for (let i = 0; i < misses.length; i += SQLITE_PARAM_CHUNK_SIZE) {
632
632
  const chunk = misses.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
@@ -921,7 +921,12 @@ class QueryBuilder {
921
921
  /**
922
922
  * Get nodes by exact qualified name match (uses idx_nodes_qualified_name index)
923
923
  */
924
- getNodesByQualifiedNameExact(qualifiedName) {
924
+ getNodesByQualifiedNameExact(qualifiedName, limit) {
925
+ if (limit !== undefined) {
926
+ const cap = Number.isFinite(limit) ? Math.max(1, Math.min(100, Math.floor(limit))) : 25;
927
+ return this.db.prepare('SELECT * FROM nodes WHERE qualified_name = ? LIMIT ?')
928
+ .all(qualifiedName, cap).map(rowToNode);
929
+ }
925
930
  if (!this.stmts.getNodesByQualifiedNameExact) {
926
931
  this.stmts.getNodesByQualifiedNameExact = this.db.prepare('SELECT * FROM nodes WHERE qualified_name = ?');
927
932
  }
@@ -1571,6 +1576,30 @@ class QueryBuilder {
1571
1576
  const rows = this.stmts.getEdgesByTarget.all(targetId);
1572
1577
  return rows.map(rowToEdge);
1573
1578
  }
1579
+ /** Bounded local adjacency for evidence search; never load a whole hub into JS.
1580
+ * Known endpoints get a small indexed lookup before the bounded neighbor scan.
1581
+ */
1582
+ getEvidenceEdges(nodeId, direction, kinds, limit, preferredIds = []) {
1583
+ if (!kinds.length)
1584
+ return [];
1585
+ const cap = Number.isFinite(limit) ? Math.max(1, Math.min(100, Math.floor(limit))) : 25;
1586
+ const column = direction === 'incoming' ? 'target' : 'source';
1587
+ const opposite = direction === 'incoming' ? 'source' : 'target';
1588
+ const kindsSql = kinds.map(() => '?').join(',');
1589
+ const preferred = [...new Set(preferredIds)].slice(0, 4);
1590
+ const base = `SELECT * FROM edges WHERE ${column} = ? AND kind IN (${kindsSql})`;
1591
+ const rows = [];
1592
+ if (preferred.length) {
1593
+ rows.push(...this.db.prepare(`${base} AND ${opposite} IN (${preferred.map(() => '?').join(',')}) LIMIT ?`)
1594
+ .all(nodeId, ...kinds, ...preferred, cap));
1595
+ }
1596
+ if (rows.length < cap) {
1597
+ const omitPreferred = preferred.length ? ` AND ${opposite} NOT IN (${preferred.map(() => '?').join(',')})` : '';
1598
+ rows.push(...this.db.prepare(`${base}${omitPreferred} LIMIT ?`)
1599
+ .all(nodeId, ...kinds, ...preferred, cap - rows.length));
1600
+ }
1601
+ return rows.map(rowToEdge);
1602
+ }
1574
1603
  /**
1575
1604
  * Find all edges where both source and target are in the given node set.
1576
1605
  * Useful for recovering inter-node connectivity after BFS.
@@ -1,16 +1,12 @@
1
1
  /**
2
2
  * SQLite Adapter
3
3
  *
4
- * Three-tier selection (first success wins):
4
+ * Two-tier selection (first success wins):
5
5
  * 1. `node:sqlite` (`DatabaseSync`) — real SQLite + WAL + FTS5, Node ≥22.5
6
6
  * (skipped when the build lacks FTS5 — e.g. some Node 23.x official builds)
7
- * 2. `better-sqlite3` — native addon (optionalDependency)
8
- * 3. `node-sqlite3-wasm` — last-resort fallback (no WAL; slower / lock-prone)
7
+ * 2. `node-sqlite3-wasm` — cross-platform fallback (no WAL; slower / lock-prone)
9
8
  *
10
- * Library hosts on Node 22.0–22.4 land on (2) or (3). Node ≥22.5 prefers (1) when
11
- * FTS5 is present and skips the native build. Override with
12
- * `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|native|wasm`.
13
- * optionalDependency `better-sqlite3` is 12.x (Node 22+); wasm remains the last resort.
9
+ * Override with `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|wasm`.
14
10
  */
15
11
  export interface SqliteStatement {
16
12
  run(...params: any[]): {
@@ -37,11 +33,11 @@ export interface SqliteDatabase {
37
33
  readonly open: boolean;
38
34
  }
39
35
  /** Active SQLite backend after {@link createDatabase}. */
40
- export type SqliteBackend = 'node-sqlite' | 'native' | 'wasm';
36
+ export type SqliteBackend = 'node-sqlite' | 'wasm';
41
37
  /**
42
38
  * One-line recovery hint when WASM is active (no WAL — slower / lock-prone).
43
39
  */
44
- export declare const WASM_FALLBACK_FIX_RECIPE: string;
40
+ export declare const WASM_FALLBACK_FIX_RECIPE = "upgrade to Node.js 22.5+ (uses built-in node:sqlite with FTS5), then restart homegraph";
45
41
  /**
46
42
  * Banner shown to stderr when falling back to WASM.
47
43
  */
@@ -49,11 +45,9 @@ export declare function buildWasmFallbackBanner(priorErrors?: string): string;
49
45
  /** True when `require('node:sqlite').DatabaseSync` succeeds. */
50
46
  export declare function isNodeSqliteAvailable(): boolean;
51
47
  export declare function isNodeSqliteFts5Available(): boolean;
52
- /** True when `require('better-sqlite3')` succeeds. */
53
- export declare function isNativeSqliteAvailable(): boolean;
54
48
  /**
55
49
  * Create a database connection.
56
- * Order: node:sqlite (with FTS5) → better-sqlite3 → node-sqlite3-wasm (unless overridden).
50
+ * Order: node:sqlite (with FTS5) → node-sqlite3-wasm (unless overridden).
57
51
  */
58
52
  export declare function createDatabase(dbPath: string, opts?: {
59
53
  readOnly?: boolean;
@@ -2,30 +2,23 @@
2
2
  /**
3
3
  * SQLite Adapter
4
4
  *
5
- * Three-tier selection (first success wins):
5
+ * Two-tier selection (first success wins):
6
6
  * 1. `node:sqlite` (`DatabaseSync`) — real SQLite + WAL + FTS5, Node ≥22.5
7
7
  * (skipped when the build lacks FTS5 — e.g. some Node 23.x official builds)
8
- * 2. `better-sqlite3` — native addon (optionalDependency)
9
- * 3. `node-sqlite3-wasm` — last-resort fallback (no WAL; slower / lock-prone)
8
+ * 2. `node-sqlite3-wasm` — cross-platform fallback (no WAL; slower / lock-prone)
10
9
  *
11
- * Library hosts on Node 22.0–22.4 land on (2) or (3). Node ≥22.5 prefers (1) when
12
- * FTS5 is present and skips the native build. Override with
13
- * `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|native|wasm`.
14
- * optionalDependency `better-sqlite3` is 12.x (Node 22+); wasm remains the last resort.
10
+ * Override with `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|wasm`.
15
11
  */
16
12
  Object.defineProperty(exports, "__esModule", { value: true });
17
13
  exports.WASM_FALLBACK_FIX_RECIPE = void 0;
18
14
  exports.buildWasmFallbackBanner = buildWasmFallbackBanner;
19
15
  exports.isNodeSqliteAvailable = isNodeSqliteAvailable;
20
16
  exports.isNodeSqliteFts5Available = isNodeSqliteFts5Available;
21
- exports.isNativeSqliteAvailable = isNativeSqliteAvailable;
22
17
  exports.createDatabase = createDatabase;
23
18
  /**
24
19
  * One-line recovery hint when WASM is active (no WAL — slower / lock-prone).
25
20
  */
26
- exports.WASM_FALLBACK_FIX_RECIPE = 'upgrade to Node.js 22.5+ (uses built-in node:sqlite), or ' +
27
- '`xcode-select --install` (macOS) / `apt install build-essential` (Debian/Ubuntu) ' +
28
- 'then `npm rebuild better-sqlite3`.';
21
+ exports.WASM_FALLBACK_FIX_RECIPE = 'upgrade to Node.js 22.5+ (uses built-in node:sqlite with FTS5), then restart homegraph';
29
22
  /**
30
23
  * Banner shown to stderr when falling back to WASM.
31
24
  */
@@ -33,20 +26,15 @@ function buildWasmFallbackBanner(priorErrors) {
33
26
  const sep = '─'.repeat(72);
34
27
  const lines = [
35
28
  sep,
36
- '[HomeGraph] WASM SQLite fallback active (node:sqlite + better-sqlite3 unavailable)',
29
+ '[HomeGraph] WASM SQLite fallback active (node:sqlite unavailable or lacks FTS5)',
37
30
  sep,
38
31
  'Indexing and sync will be 5-10x slower than a WAL backend, and concurrent',
39
- 'reads can hit "database is locked". Prefer Node 22.5+ or better-sqlite3.',
32
+ 'reads can hit "database is locked". Prefer Node.js 22.5 or newer.',
40
33
  '',
41
- 'Fix — use built-in SQLite (best when you can):',
34
+ 'Fix — use built-in SQLite:',
42
35
  ' Use Node.js 22.5 or newer, then restart homegraph',
43
36
  '',
44
- 'Fix — native better-sqlite3:',
45
- ' macOS: xcode-select --install && npm rebuild better-sqlite3',
46
- ' Linux: sudo apt install build-essential python3 make && npm rebuild better-sqlite3',
47
- ' Any: npm install better-sqlite3 --save',
48
- '',
49
- 'Verify after fix: `homegraph status` should show Backend: node-sqlite or native.',
37
+ 'Verify after fix: `homegraph status` should show Backend: node-sqlite.',
50
38
  ];
51
39
  if (priorErrors) {
52
40
  lines.push('', `Prior load errors: ${priorErrors}`);
@@ -155,20 +143,9 @@ function isNodeSqliteFts5Available() {
155
143
  }
156
144
  return cachedNodeSqliteFts5;
157
145
  }
158
- /** True when `require('better-sqlite3')` succeeds. */
159
- function isNativeSqliteAvailable() {
160
- try {
161
- // eslint-disable-next-line @typescript-eslint/no-require-imports
162
- require('better-sqlite3');
163
- return true;
164
- }
165
- catch {
166
- return false;
167
- }
168
- }
169
146
  /**
170
147
  * Wraps Node's built-in `node:sqlite` (`DatabaseSync`) to match the
171
- * better-sqlite3 interface the rest of the code expects.
148
+ * statement/database interface the rest of the code expects.
172
149
  */
173
150
  class NodeSqliteAdapter {
174
151
  _db;
@@ -362,10 +339,11 @@ class WasmDatabaseAdapter {
362
339
  }
363
340
  function resolveBackendOrder() {
364
341
  const raw = process.env.HOMEGRAPH_SQLITE_BACKEND?.trim().toLowerCase();
365
- if (raw === 'node-sqlite' || raw === 'native' || raw === 'wasm') {
342
+ if (raw === 'node-sqlite' || raw === 'wasm') {
366
343
  return [raw];
367
344
  }
368
- return ['node-sqlite', 'native', 'wasm'];
345
+ // Unknown values (including legacy `native`) fall through to the default order.
346
+ return ['node-sqlite', 'wasm'];
369
347
  }
370
348
  function tryOpenBackend(backend, dbPath, opts) {
371
349
  try {
@@ -379,12 +357,6 @@ function tryOpenBackend(backend, dbPath, opts) {
379
357
  }
380
358
  return { db: new NodeSqliteAdapter(dbPath, opts), backend: 'node-sqlite' };
381
359
  }
382
- if (backend === 'native') {
383
- // eslint-disable-next-line @typescript-eslint/no-require-imports
384
- const Database = require('better-sqlite3');
385
- const db = opts?.readOnly ? new Database(dbPath, { readonly: true }) : new Database(dbPath);
386
- return { db: db, backend: 'native' };
387
- }
388
360
  return { db: new WasmDatabaseAdapter(dbPath, opts), backend: 'wasm' };
389
361
  }
390
362
  catch (error) {
@@ -393,7 +365,7 @@ function tryOpenBackend(backend, dbPath, opts) {
393
365
  }
394
366
  /**
395
367
  * Create a database connection.
396
- * Order: node:sqlite (with FTS5) → better-sqlite3 → node-sqlite3-wasm (unless overridden).
368
+ * Order: node:sqlite (with FTS5) → node-sqlite3-wasm (unless overridden).
397
369
  */
398
370
  function createDatabase(dbPath, opts) {
399
371
  const order = resolveBackendOrder();
@@ -63,7 +63,7 @@ export declare function isInitialized(projectRoot: string): boolean;
63
63
  * The returned string is a human phrase that slots into "… looks like {reason}".
64
64
  */
65
65
  export declare function unsafeIndexRootReason(projectRoot: string): string | null;
66
- export declare function findNearestHomeGraphRoot(startPath: string): string | null;
66
+ export declare function findNearestHomeGraphRoot(startPath: string, floor?: string): string | null;
67
67
  /**
68
68
  * Indexed sub-project roots beneath `root` (bounded breadth-first scan). For
69
69
  * the monorepo case behind #964: the index lives in a CHILD
package/dist/directory.js CHANGED
@@ -183,17 +183,41 @@ function unsafeIndexRootReason(projectRoot) {
183
183
  }
184
184
  return null;
185
185
  }
186
- function findNearestHomeGraphRoot(startPath) {
186
+ function findNearestHomeGraphRoot(startPath, floor) {
187
+ // A floor (an MCP host's explicit --path / rootUri) bounds the walk: an
188
+ // ancestor .homegraph above it must not be adopted — a stray ancestor index
189
+ // hijacks every nested server, whose daemon then indexes the wrong (often
190
+ // huge) tree and OOMs (spec 0028). Only honored when it contains the start;
191
+ // a misconfigured floor must not break discovery.
192
+ const resolveBestEffort = (p) => {
193
+ try {
194
+ return fs.realpathSync(path.resolve(p));
195
+ }
196
+ catch {
197
+ return path.resolve(p);
198
+ }
199
+ };
200
+ // Walk the literal chain (returned to the caller in ITS coordinate system);
201
+ // track the realpath chain in parallel only for the boundary comparison, so
202
+ // a symlinked prefix (macOS /var vs /private/var) cannot desync the floor.
187
203
  let current = path.resolve(startPath);
204
+ let currentReal = resolveBestEffort(current);
188
205
  const root = path.parse(current).root;
206
+ const floorDir = floor ? resolveBestEffort(floor) : null;
207
+ const clamped = floorDir !== null &&
208
+ (currentReal === floorDir || currentReal.startsWith(floorDir + path.sep));
189
209
  while (current !== root) {
190
210
  if (isInitialized(current)) {
191
211
  return current;
192
212
  }
213
+ if (clamped && currentReal === floorDir) {
214
+ return null; // the floor itself has no index — stop, never look above
215
+ }
193
216
  const parent = path.dirname(current);
194
217
  if (parent === current)
195
218
  break; // Reached filesystem root
196
219
  current = parent;
220
+ currentReal = path.dirname(currentReal);
197
221
  }
198
222
  // Check root as well
199
223
  if (isInitialized(current)) {
@@ -51,6 +51,8 @@ export declare function isArkModuleJson5(filePath: string): boolean;
51
51
  * Idempotent — safe to call multiple times.
52
52
  */
53
53
  export declare function initGrammars(): Promise<void>;
54
+ /** Filenames copy-assets must ship under dist/extraction/wasm/ (Spec 0031). */
55
+ export declare function vendoredWasmFilenames(): string[];
54
56
  /**
55
57
  * Pre-read the grammar WASM bytes for an index set, keyed by language. The
56
58
  * orchestrator reads each grammar ONCE and hands the bytes to every parse
@@ -47,6 +47,7 @@ exports.isErlangAppFile = isErlangAppFile;
47
47
  exports.isPlayRoutesFile = isPlayRoutesFile;
48
48
  exports.isArkModuleJson5 = isArkModuleJson5;
49
49
  exports.initGrammars = initGrammars;
50
+ exports.vendoredWasmFilenames = vendoredWasmFilenames;
50
51
  exports.readGrammarWasmBytes = readGrammarWasmBytes;
51
52
  exports.loadGrammarsForLanguages = loadGrammarsForLanguages;
52
53
  exports.loadAllGrammars = loadAllGrammars;
@@ -309,13 +310,8 @@ async function initGrammars() {
309
310
  * primary constructors natively. Terraform: tree-sitter-wasms does not ship
310
311
  * HCL/Terraform at all, so we vendor the prebuilt tree-sitter-terraform.wasm
311
312
  * from @tree-sitter-grammars/tree-sitter-hcl 1.2.0 (Apache-2.0) —
312
- * byte-identical to the npm package's artifact. ArkTS: tree-sitter-wasms
313
- * doesn't ship it either; we vendor the prebuilt tree-sitter-arkts.wasm from
314
- * the tree-sitter-arkts 0.2.0 npm package (harmony-contrib/tree-sitter-arkts,
315
- * MIT) — byte-identical to the npm tarball's artifact. It extends the
316
- * tree-sitter-javascript grammar the same way tree-sitter-typescript does,
317
- * adding `struct_declaration` and the `arkui_component_expression` build()
318
- * DSL. Nix: tree-sitter-wasms doesn't ship it; we vendor a wasm built from
313
+ * byte-identical to the npm package's artifact. Nix: tree-sitter-wasms doesn't
314
+ * ship it; we vendor a wasm built from
319
315
  * nix-community/tree-sitter-nix @ 3d0173d (MIT) with tree-sitter-cli 0.25.10
320
316
  * (`generate` + `build --wasm`, ABI 15 — upstream's checked-in parser.c is
321
317
  * still ABI 13; all 54 upstream corpus tests pass on the regenerated parser).
@@ -324,6 +320,10 @@ const VENDORED_WASM_LANGS = new Set([
324
320
  'pascal', 'scala', 'lua', 'luau', 'csharp', 'r', 'cfml', 'cfscript', 'cfquery',
325
321
  'cobol', 'vbnet', 'erlang', 'terraform', 'nix',
326
322
  ]);
323
+ /** Filenames copy-assets must ship under dist/extraction/wasm/ (Spec 0031). */
324
+ function vendoredWasmFilenames() {
325
+ return [...new Set([...VENDORED_WASM_LANGS].map((lang) => WASM_GRAMMAR_FILES[lang]))].sort();
326
+ }
327
327
  /** Absolute path of a language's grammar WASM (vendored or tree-sitter-wasms). */
328
328
  function resolveWasmPath(lang) {
329
329
  const wasmFile = WASM_GRAMMAR_FILES[lang];
@@ -1475,17 +1475,25 @@ class ExtractionOrchestrator {
1475
1475
  await (0, arkts_1.primeArkTSBatch)(this.rootDir, this.queries, firstEtsFile);
1476
1476
  errors.push(...(0, arkts_1.drainArkTSIndexNotices)());
1477
1477
  }
1478
- // Start parse pool only after Scene teardown — most .ets are already in DB.
1479
- const remainingToParse = files.filter((f) => !((0, arkts_1.isArkTSBatchPersisted)(f) || ((0, arkts_1.isArkTSBatchCommitted)() && (0, arkts_1.isArkAnalyzerSourcePath)(f)))).length;
1478
+ // Start parse pool only after Scene teardown — AA-persisted .ets are already
1479
+ // in DB. Ark sources that never entered a PROJECT module (forgotten HARs /
1480
+ // packageless orphans) are NOT skipped here — they fall through to tree-sitter.
1481
+ const remainingToParse = files.filter((f) => !(0, arkts_1.isArkTSBatchPersisted)(f)).length;
1480
1482
  if (useWorker) {
1481
1483
  // CODEGRAPH_PARSE_WORKERS: explicit worker count; 1 = the old single-worker
1482
1484
  // behaviour (the conservative rollback). Unset → clamp(cores-1, 1, 8).
1485
+ // Harmony modular repos default to 1 worker (Spec 0037) unless overridden.
1483
1486
  let poolSize = (0, parse_pool_1.resolveParsePoolSize)(process.env.CODEGRAPH_PARSE_WORKERS, os.cpus().length);
1484
- if (!process.env.CODEGRAPH_PARSE_WORKERS?.trim() && remainingToParse < 500) {
1485
- poolSize = Math.min(poolSize, 2);
1486
- }
1487
- else if (!process.env.CODEGRAPH_PARSE_WORKERS?.trim() && remainingToParse < 2000) {
1488
- poolSize = Math.min(poolSize, 4);
1487
+ if (!process.env.CODEGRAPH_PARSE_WORKERS?.trim()) {
1488
+ if ((0, arkts_1.preferHarmonySerialIndexing)(this.rootDir)) {
1489
+ poolSize = 1;
1490
+ }
1491
+ else if (remainingToParse < 500) {
1492
+ poolSize = Math.min(poolSize, 2);
1493
+ }
1494
+ else if (remainingToParse < 2000) {
1495
+ poolSize = Math.min(poolSize, 4);
1496
+ }
1489
1497
  }
1490
1498
  pool = new parse_pool_1.ParseWorkerPool({
1491
1499
  languages: neededLanguages,
@@ -1523,8 +1531,7 @@ class ExtractionOrchestrator {
1523
1531
  const batch = files.slice(i, i + FILE_IO_BATCH_SIZE);
1524
1532
  // Read files in parallel (with path validation before any I/O)
1525
1533
  const fileContents = await Promise.all(batch.map(async (fp) => {
1526
- if ((0, arkts_1.isArkTSBatchPersisted)(fp) ||
1527
- ((0, arkts_1.isArkTSBatchCommitted)() && (0, arkts_1.isArkAnalyzerSourcePath)(fp))) {
1534
+ if ((0, arkts_1.isArkTSBatchPersisted)(fp)) {
1528
1535
  return {
1529
1536
  filePath: fp,
1530
1537
  content: null,
@@ -1559,9 +1566,7 @@ class ExtractionOrchestrator {
1559
1566
  aborted = true;
1560
1567
  break;
1561
1568
  }
1562
- if ((0, arkts_1.isArkTSBatchPersisted)(filePath) ||
1563
- arktsBatchSkipped ||
1564
- ((0, arkts_1.isArkTSBatchCommitted)() && (0, arkts_1.isArkAnalyzerSourcePath)(filePath))) {
1569
+ if ((0, arkts_1.isArkTSBatchPersisted)(filePath) || arktsBatchSkipped) {
1565
1570
  processed++;
1566
1571
  filesIndexed++;
1567
1572
  onProgress?.({ phase: 'parsing', current: processed, total, currentFile: filePath });