homegraph 1.5.6 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (560) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +12 -6
  3. package/dist/bin/homegraph.js +16 -14
  4. package/dist/context/index.js +120 -15
  5. package/dist/db/index.d.ts +1 -1
  6. package/dist/db/index.js +11 -25
  7. package/dist/db/queries.d.ts +5 -1
  8. package/dist/db/queries.js +31 -2
  9. package/dist/db/sqlite-adapter.d.ts +6 -12
  10. package/dist/db/sqlite-adapter.js +13 -41
  11. package/dist/directory.d.ts +1 -1
  12. package/dist/directory.js +25 -1
  13. package/dist/extraction/grammars.d.ts +2 -0
  14. package/dist/extraction/grammars.js +7 -7
  15. package/dist/extraction/languages/arkts.d.ts +25 -3
  16. package/dist/extraction/languages/arkts.js +184 -22
  17. package/dist/graph/evidence-paths.d.ts +63 -0
  18. package/dist/graph/evidence-paths.js +245 -0
  19. package/dist/index.d.ts +6 -1
  20. package/dist/index.js +55 -17
  21. package/dist/mcp/arkts-evidence-packs.d.ts +67 -0
  22. package/dist/mcp/arkts-evidence-packs.js +352 -0
  23. package/dist/mcp/daemon.js +1 -1
  24. package/dist/mcp/engine.d.ts +20 -7
  25. package/dist/mcp/engine.js +113 -106
  26. package/dist/mcp/evidence-rendering.d.ts +10 -0
  27. package/dist/mcp/evidence-rendering.js +71 -0
  28. package/dist/mcp/explore-repeat-guard.d.ts +8 -13
  29. package/dist/mcp/explore-repeat-guard.js +54 -114
  30. package/dist/mcp/explore-session-state.d.ts +26 -4
  31. package/dist/mcp/explore-session-state.js +50 -4
  32. package/dist/mcp/index-availability.d.ts +23 -0
  33. package/dist/mcp/index-availability.js +78 -0
  34. package/dist/mcp/index.js +5 -4
  35. package/dist/mcp/query-cache.d.ts +1 -1
  36. package/dist/mcp/query-cache.js +90 -3
  37. package/dist/mcp/query-worker.d.ts +1 -1
  38. package/dist/mcp/query-worker.js +1 -1
  39. package/dist/mcp/server-instructions.d.ts +4 -9
  40. package/dist/mcp/server-instructions.js +34 -61
  41. package/dist/mcp/session.js +12 -4
  42. package/dist/mcp/source-slice-identity.d.ts +3 -0
  43. package/dist/mcp/source-slice-identity.js +11 -0
  44. package/dist/mcp/tools.d.ts +43 -9
  45. package/dist/mcp/tools.js +859 -155
  46. package/dist/search/literal-evidence.d.ts +44 -0
  47. package/dist/search/literal-evidence.js +278 -0
  48. package/dist/search/query-plan-provider.d.ts +6 -0
  49. package/dist/search/query-plan-provider.js +289 -0
  50. package/dist/search/query-plan.d.ts +98 -0
  51. package/dist/search/query-plan.js +334 -0
  52. package/dist/search/query-utils.d.ts +6 -1
  53. package/dist/search/query-utils.js +64 -5
  54. package/dist/spec/llm/client.js +3 -15
  55. package/dist/spec/llm/openai-sdk.d.ts +14 -0
  56. package/dist/spec/llm/openai-sdk.js +37 -0
  57. package/dist/spec/llm/retry.js +8 -9
  58. package/dist/types.d.ts +17 -0
  59. package/dist/utils.d.ts +5 -0
  60. package/dist/utils.js +24 -0
  61. package/package.json +3 -5
  62. package/dist/addons/dynamic-import.d.ts.map +0 -1
  63. package/dist/addons/dynamic-import.js.map +0 -1
  64. package/dist/addons/init-template.d.ts.map +0 -1
  65. package/dist/addons/init-template.js.map +0 -1
  66. package/dist/addons/loader.d.ts.map +0 -1
  67. package/dist/addons/loader.js.map +0 -1
  68. package/dist/addons/manager.d.ts.map +0 -1
  69. package/dist/addons/manager.js.map +0 -1
  70. package/dist/addons/paths.d.ts.map +0 -1
  71. package/dist/addons/paths.js.map +0 -1
  72. package/dist/addons/registry.d.ts.map +0 -1
  73. package/dist/addons/registry.js.map +0 -1
  74. package/dist/addons/semver.d.ts.map +0 -1
  75. package/dist/addons/semver.js.map +0 -1
  76. package/dist/addons/types.d.ts.map +0 -1
  77. package/dist/addons/types.js.map +0 -1
  78. package/dist/addons/validate.d.ts.map +0 -1
  79. package/dist/addons/validate.js.map +0 -1
  80. package/dist/arkui/index.d.ts.map +0 -1
  81. package/dist/arkui/index.js.map +0 -1
  82. package/dist/arkui/migrate-passage.d.ts.map +0 -1
  83. package/dist/arkui/migrate-passage.js.map +0 -1
  84. package/dist/arkui/migrate-semantics.d.ts.map +0 -1
  85. package/dist/arkui/migrate-semantics.js.map +0 -1
  86. package/dist/arkui/migrate-snapshot.d.ts.map +0 -1
  87. package/dist/arkui/migrate-snapshot.js.map +0 -1
  88. package/dist/bin/addon-commands.d.ts.map +0 -1
  89. package/dist/bin/addon-commands.js.map +0 -1
  90. package/dist/bin/command-supervision.d.ts.map +0 -1
  91. package/dist/bin/command-supervision.js.map +0 -1
  92. package/dist/bin/fatal-handler.d.ts.map +0 -1
  93. package/dist/bin/fatal-handler.js.map +0 -1
  94. package/dist/bin/homegraph.d.ts.map +0 -1
  95. package/dist/bin/homegraph.js.map +0 -1
  96. package/dist/bin/node-version-check.d.ts.map +0 -1
  97. package/dist/bin/node-version-check.js.map +0 -1
  98. package/dist/bin/uninstall.d.ts.map +0 -1
  99. package/dist/bin/uninstall.js.map +0 -1
  100. package/dist/context/formatter.d.ts.map +0 -1
  101. package/dist/context/formatter.js.map +0 -1
  102. package/dist/context/index.d.ts.map +0 -1
  103. package/dist/context/index.js.map +0 -1
  104. package/dist/context/markers.d.ts.map +0 -1
  105. package/dist/context/markers.js.map +0 -1
  106. package/dist/db/index.d.ts.map +0 -1
  107. package/dist/db/index.js.map +0 -1
  108. package/dist/db/migrations.d.ts.map +0 -1
  109. package/dist/db/migrations.js.map +0 -1
  110. package/dist/db/queries.d.ts.map +0 -1
  111. package/dist/db/queries.js.map +0 -1
  112. package/dist/db/sqlite-adapter.d.ts.map +0 -1
  113. package/dist/db/sqlite-adapter.js.map +0 -1
  114. package/dist/db/wal-valve.d.ts.map +0 -1
  115. package/dist/db/wal-valve.js.map +0 -1
  116. package/dist/directory.d.ts.map +0 -1
  117. package/dist/directory.js.map +0 -1
  118. package/dist/errors.d.ts.map +0 -1
  119. package/dist/errors.js.map +0 -1
  120. package/dist/extraction/arkts-batch-worker.d.ts.map +0 -1
  121. package/dist/extraction/arkts-batch-worker.js.map +0 -1
  122. package/dist/extraction/astro-extractor.d.ts.map +0 -1
  123. package/dist/extraction/astro-extractor.js.map +0 -1
  124. package/dist/extraction/cfml-extractor.d.ts.map +0 -1
  125. package/dist/extraction/cfml-extractor.js.map +0 -1
  126. package/dist/extraction/context.d.ts.map +0 -1
  127. package/dist/extraction/context.js.map +0 -1
  128. package/dist/extraction/default-ignore.d.ts.map +0 -1
  129. package/dist/extraction/default-ignore.js.map +0 -1
  130. package/dist/extraction/dfm-extractor.d.ts.map +0 -1
  131. package/dist/extraction/dfm-extractor.js.map +0 -1
  132. package/dist/extraction/extraction-version.d.ts.map +0 -1
  133. package/dist/extraction/extraction-version.js.map +0 -1
  134. package/dist/extraction/function-ref.d.ts.map +0 -1
  135. package/dist/extraction/function-ref.js.map +0 -1
  136. package/dist/extraction/generated-detection.d.ts.map +0 -1
  137. package/dist/extraction/generated-detection.js.map +0 -1
  138. package/dist/extraction/grammars.d.ts.map +0 -1
  139. package/dist/extraction/grammars.js.map +0 -1
  140. package/dist/extraction/index.d.ts.map +0 -1
  141. package/dist/extraction/index.js.map +0 -1
  142. package/dist/extraction/languages/arkts.d.ts.map +0 -1
  143. package/dist/extraction/languages/arkts.js.map +0 -1
  144. package/dist/extraction/languages/c-cpp.d.ts.map +0 -1
  145. package/dist/extraction/languages/c-cpp.js.map +0 -1
  146. package/dist/extraction/languages/cfquery.d.ts.map +0 -1
  147. package/dist/extraction/languages/cfquery.js.map +0 -1
  148. package/dist/extraction/languages/cfscript.d.ts.map +0 -1
  149. package/dist/extraction/languages/cfscript.js.map +0 -1
  150. package/dist/extraction/languages/cobol.d.ts.map +0 -1
  151. package/dist/extraction/languages/cobol.js.map +0 -1
  152. package/dist/extraction/languages/csharp.d.ts.map +0 -1
  153. package/dist/extraction/languages/csharp.js.map +0 -1
  154. package/dist/extraction/languages/dart.d.ts.map +0 -1
  155. package/dist/extraction/languages/dart.js.map +0 -1
  156. package/dist/extraction/languages/erlang.d.ts.map +0 -1
  157. package/dist/extraction/languages/erlang.js.map +0 -1
  158. package/dist/extraction/languages/go.d.ts.map +0 -1
  159. package/dist/extraction/languages/go.js.map +0 -1
  160. package/dist/extraction/languages/index.d.ts.map +0 -1
  161. package/dist/extraction/languages/index.js.map +0 -1
  162. package/dist/extraction/languages/java.d.ts.map +0 -1
  163. package/dist/extraction/languages/java.js.map +0 -1
  164. package/dist/extraction/languages/javascript.d.ts.map +0 -1
  165. package/dist/extraction/languages/javascript.js.map +0 -1
  166. package/dist/extraction/languages/kotlin.d.ts.map +0 -1
  167. package/dist/extraction/languages/kotlin.js.map +0 -1
  168. package/dist/extraction/languages/lua.d.ts.map +0 -1
  169. package/dist/extraction/languages/lua.js.map +0 -1
  170. package/dist/extraction/languages/luau.d.ts.map +0 -1
  171. package/dist/extraction/languages/luau.js.map +0 -1
  172. package/dist/extraction/languages/nix.d.ts.map +0 -1
  173. package/dist/extraction/languages/nix.js.map +0 -1
  174. package/dist/extraction/languages/objc.d.ts.map +0 -1
  175. package/dist/extraction/languages/objc.js.map +0 -1
  176. package/dist/extraction/languages/pascal.d.ts.map +0 -1
  177. package/dist/extraction/languages/pascal.js.map +0 -1
  178. package/dist/extraction/languages/php.d.ts.map +0 -1
  179. package/dist/extraction/languages/php.js.map +0 -1
  180. package/dist/extraction/languages/python.d.ts.map +0 -1
  181. package/dist/extraction/languages/python.js.map +0 -1
  182. package/dist/extraction/languages/r.d.ts.map +0 -1
  183. package/dist/extraction/languages/r.js.map +0 -1
  184. package/dist/extraction/languages/ruby.d.ts.map +0 -1
  185. package/dist/extraction/languages/ruby.js.map +0 -1
  186. package/dist/extraction/languages/rust.d.ts.map +0 -1
  187. package/dist/extraction/languages/rust.js.map +0 -1
  188. package/dist/extraction/languages/scala.d.ts.map +0 -1
  189. package/dist/extraction/languages/scala.js.map +0 -1
  190. package/dist/extraction/languages/solidity.d.ts.map +0 -1
  191. package/dist/extraction/languages/solidity.js.map +0 -1
  192. package/dist/extraction/languages/swift.d.ts.map +0 -1
  193. package/dist/extraction/languages/swift.js.map +0 -1
  194. package/dist/extraction/languages/terraform.d.ts.map +0 -1
  195. package/dist/extraction/languages/terraform.js.map +0 -1
  196. package/dist/extraction/languages/typescript.d.ts.map +0 -1
  197. package/dist/extraction/languages/typescript.js.map +0 -1
  198. package/dist/extraction/languages/vbnet.d.ts.map +0 -1
  199. package/dist/extraction/languages/vbnet.js.map +0 -1
  200. package/dist/extraction/liquid-extractor.d.ts.map +0 -1
  201. package/dist/extraction/liquid-extractor.js.map +0 -1
  202. package/dist/extraction/mybatis-extractor.d.ts.map +0 -1
  203. package/dist/extraction/mybatis-extractor.js.map +0 -1
  204. package/dist/extraction/parse-pool.d.ts.map +0 -1
  205. package/dist/extraction/parse-pool.js.map +0 -1
  206. package/dist/extraction/parse-worker.d.ts.map +0 -1
  207. package/dist/extraction/parse-worker.js.map +0 -1
  208. package/dist/extraction/razor-extractor.d.ts.map +0 -1
  209. package/dist/extraction/razor-extractor.js.map +0 -1
  210. package/dist/extraction/store-worker.d.ts.map +0 -1
  211. package/dist/extraction/store-worker.js.map +0 -1
  212. package/dist/extraction/store-writer.d.ts.map +0 -1
  213. package/dist/extraction/store-writer.js.map +0 -1
  214. package/dist/extraction/svelte-extractor.d.ts.map +0 -1
  215. package/dist/extraction/svelte-extractor.js.map +0 -1
  216. package/dist/extraction/tree-sitter-helpers.d.ts.map +0 -1
  217. package/dist/extraction/tree-sitter-helpers.js.map +0 -1
  218. package/dist/extraction/tree-sitter-types.d.ts.map +0 -1
  219. package/dist/extraction/tree-sitter-types.js.map +0 -1
  220. package/dist/extraction/tree-sitter.d.ts.map +0 -1
  221. package/dist/extraction/tree-sitter.js.map +0 -1
  222. package/dist/extraction/vue-extractor.d.ts.map +0 -1
  223. package/dist/extraction/vue-extractor.js.map +0 -1
  224. package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
  225. package/dist/extraction/wasm-runtime-flags.d.ts.map +0 -1
  226. package/dist/extraction/wasm-runtime-flags.js.map +0 -1
  227. package/dist/graph/index.d.ts.map +0 -1
  228. package/dist/graph/index.js.map +0 -1
  229. package/dist/graph/queries.d.ts.map +0 -1
  230. package/dist/graph/queries.js.map +0 -1
  231. package/dist/graph/traversal.d.ts.map +0 -1
  232. package/dist/graph/traversal.js.map +0 -1
  233. package/dist/graph-sources.d.ts.map +0 -1
  234. package/dist/graph-sources.js.map +0 -1
  235. package/dist/index.d.ts.map +0 -1
  236. package/dist/index.js.map +0 -1
  237. package/dist/installer/config-writer.d.ts.map +0 -1
  238. package/dist/installer/config-writer.js.map +0 -1
  239. package/dist/installer/index.d.ts.map +0 -1
  240. package/dist/installer/index.js.map +0 -1
  241. package/dist/installer/instructions-template.d.ts.map +0 -1
  242. package/dist/installer/instructions-template.js.map +0 -1
  243. package/dist/installer/targets/antigravity.d.ts.map +0 -1
  244. package/dist/installer/targets/antigravity.js.map +0 -1
  245. package/dist/installer/targets/claude.d.ts.map +0 -1
  246. package/dist/installer/targets/claude.js.map +0 -1
  247. package/dist/installer/targets/codebuddy.d.ts.map +0 -1
  248. package/dist/installer/targets/codebuddy.js.map +0 -1
  249. package/dist/installer/targets/codex.d.ts.map +0 -1
  250. package/dist/installer/targets/codex.js.map +0 -1
  251. package/dist/installer/targets/cursor.d.ts.map +0 -1
  252. package/dist/installer/targets/cursor.js.map +0 -1
  253. package/dist/installer/targets/deveco.d.ts.map +0 -1
  254. package/dist/installer/targets/deveco.js.map +0 -1
  255. package/dist/installer/targets/gemini.d.ts.map +0 -1
  256. package/dist/installer/targets/gemini.js.map +0 -1
  257. package/dist/installer/targets/hermes.d.ts.map +0 -1
  258. package/dist/installer/targets/hermes.js.map +0 -1
  259. package/dist/installer/targets/kiro.d.ts.map +0 -1
  260. package/dist/installer/targets/kiro.js.map +0 -1
  261. package/dist/installer/targets/opencode.d.ts.map +0 -1
  262. package/dist/installer/targets/opencode.js.map +0 -1
  263. package/dist/installer/targets/registry.d.ts.map +0 -1
  264. package/dist/installer/targets/registry.js.map +0 -1
  265. package/dist/installer/targets/shared.d.ts.map +0 -1
  266. package/dist/installer/targets/shared.js.map +0 -1
  267. package/dist/installer/targets/toml.d.ts.map +0 -1
  268. package/dist/installer/targets/toml.js.map +0 -1
  269. package/dist/installer/targets/types.d.ts.map +0 -1
  270. package/dist/installer/targets/types.js.map +0 -1
  271. package/dist/mcp/daemon-manager.d.ts.map +0 -1
  272. package/dist/mcp/daemon-manager.js.map +0 -1
  273. package/dist/mcp/daemon-paths.d.ts.map +0 -1
  274. package/dist/mcp/daemon-paths.js.map +0 -1
  275. package/dist/mcp/daemon-registry.d.ts.map +0 -1
  276. package/dist/mcp/daemon-registry.js.map +0 -1
  277. package/dist/mcp/daemon.d.ts.map +0 -1
  278. package/dist/mcp/daemon.js.map +0 -1
  279. package/dist/mcp/diff-impact.d.ts.map +0 -1
  280. package/dist/mcp/diff-impact.js.map +0 -1
  281. package/dist/mcp/dynamic-boundaries.d.ts.map +0 -1
  282. package/dist/mcp/dynamic-boundaries.js.map +0 -1
  283. package/dist/mcp/early-ppid.d.ts.map +0 -1
  284. package/dist/mcp/early-ppid.js.map +0 -1
  285. package/dist/mcp/engine.d.ts.map +0 -1
  286. package/dist/mcp/engine.js.map +0 -1
  287. package/dist/mcp/explore-dedup.d.ts.map +0 -1
  288. package/dist/mcp/explore-dedup.js.map +0 -1
  289. package/dist/mcp/explore-repeat-guard.d.ts.map +0 -1
  290. package/dist/mcp/explore-repeat-guard.js.map +0 -1
  291. package/dist/mcp/explore-session-state.d.ts.map +0 -1
  292. package/dist/mcp/explore-session-state.js.map +0 -1
  293. package/dist/mcp/index.d.ts.map +0 -1
  294. package/dist/mcp/index.js.map +0 -1
  295. package/dist/mcp/liveness-watchdog.d.ts.map +0 -1
  296. package/dist/mcp/liveness-watchdog.js.map +0 -1
  297. package/dist/mcp/memory-budget.d.ts.map +0 -1
  298. package/dist/mcp/memory-budget.js.map +0 -1
  299. package/dist/mcp/ppid-watchdog.d.ts.map +0 -1
  300. package/dist/mcp/ppid-watchdog.js.map +0 -1
  301. package/dist/mcp/proxy.d.ts.map +0 -1
  302. package/dist/mcp/proxy.js.map +0 -1
  303. package/dist/mcp/query-cache.d.ts.map +0 -1
  304. package/dist/mcp/query-cache.js.map +0 -1
  305. package/dist/mcp/query-pool.d.ts.map +0 -1
  306. package/dist/mcp/query-pool.js.map +0 -1
  307. package/dist/mcp/query-worker.d.ts.map +0 -1
  308. package/dist/mcp/query-worker.js.map +0 -1
  309. package/dist/mcp/server-instructions.d.ts.map +0 -1
  310. package/dist/mcp/server-instructions.js.map +0 -1
  311. package/dist/mcp/session.d.ts.map +0 -1
  312. package/dist/mcp/session.js.map +0 -1
  313. package/dist/mcp/startup-handshake.d.ts.map +0 -1
  314. package/dist/mcp/startup-handshake.js.map +0 -1
  315. package/dist/mcp/stdin-teardown.d.ts.map +0 -1
  316. package/dist/mcp/stdin-teardown.js.map +0 -1
  317. package/dist/mcp/tools.d.ts.map +0 -1
  318. package/dist/mcp/tools.js.map +0 -1
  319. package/dist/mcp/transport.d.ts.map +0 -1
  320. package/dist/mcp/transport.js.map +0 -1
  321. package/dist/mcp/version.d.ts.map +0 -1
  322. package/dist/mcp/version.js.map +0 -1
  323. package/dist/project-config.d.ts.map +0 -1
  324. package/dist/project-config.js.map +0 -1
  325. package/dist/project-map/index.d.ts.map +0 -1
  326. package/dist/project-map/index.js.map +0 -1
  327. package/dist/resolution/c-fnptr-synthesizer.d.ts.map +0 -1
  328. package/dist/resolution/c-fnptr-synthesizer.js.map +0 -1
  329. package/dist/resolution/callback-synthesizer.d.ts.map +0 -1
  330. package/dist/resolution/callback-synthesizer.js.map +0 -1
  331. package/dist/resolution/cooperative-yield.d.ts.map +0 -1
  332. package/dist/resolution/cooperative-yield.js.map +0 -1
  333. package/dist/resolution/frameworks/arkts-entry.d.ts.map +0 -1
  334. package/dist/resolution/frameworks/arkts-entry.js.map +0 -1
  335. package/dist/resolution/frameworks/arkts-napi.d.ts.map +0 -1
  336. package/dist/resolution/frameworks/arkts-napi.js.map +0 -1
  337. package/dist/resolution/frameworks/astro.d.ts.map +0 -1
  338. package/dist/resolution/frameworks/astro.js.map +0 -1
  339. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +0 -1
  340. package/dist/resolution/frameworks/cargo-workspace.js.map +0 -1
  341. package/dist/resolution/frameworks/cics.d.ts.map +0 -1
  342. package/dist/resolution/frameworks/cics.js.map +0 -1
  343. package/dist/resolution/frameworks/csharp.d.ts.map +0 -1
  344. package/dist/resolution/frameworks/csharp.js.map +0 -1
  345. package/dist/resolution/frameworks/drupal.d.ts.map +0 -1
  346. package/dist/resolution/frameworks/drupal.js.map +0 -1
  347. package/dist/resolution/frameworks/expo-modules.d.ts.map +0 -1
  348. package/dist/resolution/frameworks/expo-modules.js.map +0 -1
  349. package/dist/resolution/frameworks/express.d.ts.map +0 -1
  350. package/dist/resolution/frameworks/express.js.map +0 -1
  351. package/dist/resolution/frameworks/fabric.d.ts.map +0 -1
  352. package/dist/resolution/frameworks/fabric.js.map +0 -1
  353. package/dist/resolution/frameworks/go.d.ts.map +0 -1
  354. package/dist/resolution/frameworks/go.js.map +0 -1
  355. package/dist/resolution/frameworks/goframe.d.ts.map +0 -1
  356. package/dist/resolution/frameworks/goframe.js.map +0 -1
  357. package/dist/resolution/frameworks/index.d.ts.map +0 -1
  358. package/dist/resolution/frameworks/index.js.map +0 -1
  359. package/dist/resolution/frameworks/java.d.ts.map +0 -1
  360. package/dist/resolution/frameworks/java.js.map +0 -1
  361. package/dist/resolution/frameworks/laravel.d.ts.map +0 -1
  362. package/dist/resolution/frameworks/laravel.js.map +0 -1
  363. package/dist/resolution/frameworks/nestjs.d.ts.map +0 -1
  364. package/dist/resolution/frameworks/nestjs.js.map +0 -1
  365. package/dist/resolution/frameworks/play.d.ts.map +0 -1
  366. package/dist/resolution/frameworks/play.js.map +0 -1
  367. package/dist/resolution/frameworks/python.d.ts.map +0 -1
  368. package/dist/resolution/frameworks/python.js.map +0 -1
  369. package/dist/resolution/frameworks/react-native.d.ts.map +0 -1
  370. package/dist/resolution/frameworks/react-native.js.map +0 -1
  371. package/dist/resolution/frameworks/react.d.ts.map +0 -1
  372. package/dist/resolution/frameworks/react.js.map +0 -1
  373. package/dist/resolution/frameworks/ruby.d.ts.map +0 -1
  374. package/dist/resolution/frameworks/ruby.js.map +0 -1
  375. package/dist/resolution/frameworks/rust.d.ts.map +0 -1
  376. package/dist/resolution/frameworks/rust.js.map +0 -1
  377. package/dist/resolution/frameworks/svelte.d.ts.map +0 -1
  378. package/dist/resolution/frameworks/svelte.js.map +0 -1
  379. package/dist/resolution/frameworks/swift-objc.d.ts.map +0 -1
  380. package/dist/resolution/frameworks/swift-objc.js.map +0 -1
  381. package/dist/resolution/frameworks/swift.d.ts.map +0 -1
  382. package/dist/resolution/frameworks/swift.js.map +0 -1
  383. package/dist/resolution/frameworks/terraform.d.ts.map +0 -1
  384. package/dist/resolution/frameworks/terraform.js.map +0 -1
  385. package/dist/resolution/frameworks/vue.d.ts.map +0 -1
  386. package/dist/resolution/frameworks/vue.js.map +0 -1
  387. package/dist/resolution/go-module.d.ts.map +0 -1
  388. package/dist/resolution/go-module.js.map +0 -1
  389. package/dist/resolution/goframe-synthesizer.d.ts.map +0 -1
  390. package/dist/resolution/goframe-synthesizer.js.map +0 -1
  391. package/dist/resolution/import-resolver.d.ts.map +0 -1
  392. package/dist/resolution/import-resolver.js.map +0 -1
  393. package/dist/resolution/index.d.ts.map +0 -1
  394. package/dist/resolution/index.js.map +0 -1
  395. package/dist/resolution/lru-cache.d.ts.map +0 -1
  396. package/dist/resolution/lru-cache.js.map +0 -1
  397. package/dist/resolution/memory-budget.d.ts.map +0 -1
  398. package/dist/resolution/memory-budget.js.map +0 -1
  399. package/dist/resolution/name-matcher.d.ts.map +0 -1
  400. package/dist/resolution/name-matcher.js.map +0 -1
  401. package/dist/resolution/path-aliases.d.ts.map +0 -1
  402. package/dist/resolution/path-aliases.js.map +0 -1
  403. package/dist/resolution/resolver-pool.d.ts.map +0 -1
  404. package/dist/resolution/resolver-pool.js.map +0 -1
  405. package/dist/resolution/resolver-worker.d.ts.map +0 -1
  406. package/dist/resolution/resolver-worker.js.map +0 -1
  407. package/dist/resolution/strip-comments.d.ts.map +0 -1
  408. package/dist/resolution/strip-comments.js.map +0 -1
  409. package/dist/resolution/swift-objc-bridge.d.ts.map +0 -1
  410. package/dist/resolution/swift-objc-bridge.js.map +0 -1
  411. package/dist/resolution/types.d.ts.map +0 -1
  412. package/dist/resolution/types.js.map +0 -1
  413. package/dist/resolution/workspace-packages.d.ts.map +0 -1
  414. package/dist/resolution/workspace-packages.js.map +0 -1
  415. package/dist/search/identifier-segments.d.ts.map +0 -1
  416. package/dist/search/identifier-segments.js.map +0 -1
  417. package/dist/search/query-parser.d.ts.map +0 -1
  418. package/dist/search/query-parser.js.map +0 -1
  419. package/dist/search/query-utils.d.ts.map +0 -1
  420. package/dist/search/query-utils.js.map +0 -1
  421. package/dist/spec/build/diff-parser.d.ts.map +0 -1
  422. package/dist/spec/build/diff-parser.js.map +0 -1
  423. package/dist/spec/build/pipeline.d.ts.map +0 -1
  424. package/dist/spec/build/pipeline.js.map +0 -1
  425. package/dist/spec/build/scan.d.ts.map +0 -1
  426. package/dist/spec/build/scan.js.map +0 -1
  427. package/dist/spec/build/scope-resolver.d.ts.map +0 -1
  428. package/dist/spec/build/scope-resolver.js.map +0 -1
  429. package/dist/spec/build/spec-extractor.d.ts.map +0 -1
  430. package/dist/spec/build/spec-extractor.js.map +0 -1
  431. package/dist/spec/config.d.ts.map +0 -1
  432. package/dist/spec/config.js.map +0 -1
  433. package/dist/spec/db/commit-node.d.ts.map +0 -1
  434. package/dist/spec/db/commit-node.js.map +0 -1
  435. package/dist/spec/db/fragment-node.d.ts.map +0 -1
  436. package/dist/spec/db/fragment-node.js.map +0 -1
  437. package/dist/spec/db/fts.d.ts.map +0 -1
  438. package/dist/spec/db/fts.js.map +0 -1
  439. package/dist/spec/db/index.d.ts.map +0 -1
  440. package/dist/spec/db/index.js.map +0 -1
  441. package/dist/spec/db/persist.d.ts.map +0 -1
  442. package/dist/spec/db/persist.js.map +0 -1
  443. package/dist/spec/db/relations.d.ts.map +0 -1
  444. package/dist/spec/db/relations.js.map +0 -1
  445. package/dist/spec/db/schema.d.ts.map +0 -1
  446. package/dist/spec/db/schema.js.map +0 -1
  447. package/dist/spec/db/spec-node.d.ts.map +0 -1
  448. package/dist/spec/db/spec-node.js.map +0 -1
  449. package/dist/spec/db/sql-utils.d.ts.map +0 -1
  450. package/dist/spec/db/sql-utils.js.map +0 -1
  451. package/dist/spec/evolve/cluster-context.d.ts.map +0 -1
  452. package/dist/spec/evolve/cluster-context.js.map +0 -1
  453. package/dist/spec/evolve/commit-spec-analyzer.d.ts.map +0 -1
  454. package/dist/spec/evolve/commit-spec-analyzer.js.map +0 -1
  455. package/dist/spec/evolve/commit-spec-persister.d.ts.map +0 -1
  456. package/dist/spec/evolve/commit-spec-persister.js.map +0 -1
  457. package/dist/spec/evolve/impact-locator.d.ts.map +0 -1
  458. package/dist/spec/evolve/impact-locator.js.map +0 -1
  459. package/dist/spec/evolve/pipeline.d.ts.map +0 -1
  460. package/dist/spec/evolve/pipeline.js.map +0 -1
  461. package/dist/spec/evolve/spec-rewriter.d.ts.map +0 -1
  462. package/dist/spec/evolve/spec-rewriter.js.map +0 -1
  463. package/dist/spec/git/commits.d.ts.map +0 -1
  464. package/dist/spec/git/commits.js.map +0 -1
  465. package/dist/spec/git/exec.d.ts.map +0 -1
  466. package/dist/spec/git/exec.js.map +0 -1
  467. package/dist/spec/git/index.d.ts.map +0 -1
  468. package/dist/spec/git/index.js.map +0 -1
  469. package/dist/spec/graph/index.d.ts.map +0 -1
  470. package/dist/spec/graph/index.js.map +0 -1
  471. package/dist/spec/graph/queries.d.ts.map +0 -1
  472. package/dist/spec/graph/queries.js.map +0 -1
  473. package/dist/spec/llm/agent-client.d.ts.map +0 -1
  474. package/dist/spec/llm/agent-client.js.map +0 -1
  475. package/dist/spec/llm/agents/claude-code.d.ts.map +0 -1
  476. package/dist/spec/llm/agents/claude-code.js.map +0 -1
  477. package/dist/spec/llm/agents/codex.d.ts.map +0 -1
  478. package/dist/spec/llm/agents/codex.js.map +0 -1
  479. package/dist/spec/llm/agents/detect-utils.d.ts.map +0 -1
  480. package/dist/spec/llm/agents/detect-utils.js.map +0 -1
  481. package/dist/spec/llm/agents/deveco-code.d.ts.map +0 -1
  482. package/dist/spec/llm/agents/deveco-code.js.map +0 -1
  483. package/dist/spec/llm/agents/index.d.ts.map +0 -1
  484. package/dist/spec/llm/agents/index.js.map +0 -1
  485. package/dist/spec/llm/agents/types.d.ts.map +0 -1
  486. package/dist/spec/llm/agents/types.js.map +0 -1
  487. package/dist/spec/llm/client.d.ts.map +0 -1
  488. package/dist/spec/llm/client.js.map +0 -1
  489. package/dist/spec/llm/factory.d.ts.map +0 -1
  490. package/dist/spec/llm/factory.js.map +0 -1
  491. package/dist/spec/llm/prompts.d.ts.map +0 -1
  492. package/dist/spec/llm/prompts.js.map +0 -1
  493. package/dist/spec/llm/retry.d.ts.map +0 -1
  494. package/dist/spec/llm/retry.js.map +0 -1
  495. package/dist/spec/mine/addon/adapter.d.ts.map +0 -1
  496. package/dist/spec/mine/addon/adapter.js.map +0 -1
  497. package/dist/spec/mine/addon/render.d.ts.map +0 -1
  498. package/dist/spec/mine/addon/render.js.map +0 -1
  499. package/dist/spec/mine/addon/types.d.ts.map +0 -1
  500. package/dist/spec/mine/addon/types.js.map +0 -1
  501. package/dist/spec/mine/clustering/features.d.ts.map +0 -1
  502. package/dist/spec/mine/clustering/features.js.map +0 -1
  503. package/dist/spec/mine/clustering/index.d.ts.map +0 -1
  504. package/dist/spec/mine/clustering/index.js.map +0 -1
  505. package/dist/spec/mine/clustering/leiden.d.ts.map +0 -1
  506. package/dist/spec/mine/clustering/leiden.js.map +0 -1
  507. package/dist/spec/mine/clustering/text-similarity.d.ts.map +0 -1
  508. package/dist/spec/mine/clustering/text-similarity.js.map +0 -1
  509. package/dist/spec/mine/generator.d.ts.map +0 -1
  510. package/dist/spec/mine/generator.js.map +0 -1
  511. package/dist/spec/mine/persist.d.ts.map +0 -1
  512. package/dist/spec/mine/persist.js.map +0 -1
  513. package/dist/spec/mine/pipeline.d.ts.map +0 -1
  514. package/dist/spec/mine/pipeline.js.map +0 -1
  515. package/dist/spec/mine/scanner.d.ts.map +0 -1
  516. package/dist/spec/mine/scanner.js.map +0 -1
  517. package/dist/spec/types.d.ts.map +0 -1
  518. package/dist/spec/types.js.map +0 -1
  519. package/dist/spec/ui/index.d.ts.map +0 -1
  520. package/dist/spec/ui/index.js.map +0 -1
  521. package/dist/spec/ui/progress-handler.d.ts.map +0 -1
  522. package/dist/spec/ui/progress-handler.js.map +0 -1
  523. package/dist/spec/ui/progress.d.ts.map +0 -1
  524. package/dist/spec/ui/progress.js.map +0 -1
  525. package/dist/spec/utils/fs.d.ts.map +0 -1
  526. package/dist/spec/utils/fs.js.map +0 -1
  527. package/dist/spec/utils/index.d.ts.map +0 -1
  528. package/dist/spec/utils/index.js.map +0 -1
  529. package/dist/spec/utils/meta.d.ts.map +0 -1
  530. package/dist/spec/utils/meta.js.map +0 -1
  531. package/dist/spec/utils/truncate.d.ts.map +0 -1
  532. package/dist/spec/utils/truncate.js.map +0 -1
  533. package/dist/sync/git-hooks.d.ts.map +0 -1
  534. package/dist/sync/git-hooks.js.map +0 -1
  535. package/dist/sync/index.d.ts.map +0 -1
  536. package/dist/sync/index.js.map +0 -1
  537. package/dist/sync/watch-policy.d.ts.map +0 -1
  538. package/dist/sync/watch-policy.js.map +0 -1
  539. package/dist/sync/watcher.d.ts.map +0 -1
  540. package/dist/sync/watcher.js.map +0 -1
  541. package/dist/sync/worktree.d.ts.map +0 -1
  542. package/dist/sync/worktree.js.map +0 -1
  543. package/dist/types.d.ts.map +0 -1
  544. package/dist/types.js.map +0 -1
  545. package/dist/ui/glyphs.d.ts.map +0 -1
  546. package/dist/ui/glyphs.js.map +0 -1
  547. package/dist/ui/shimmer-progress.d.ts.map +0 -1
  548. package/dist/ui/shimmer-progress.js.map +0 -1
  549. package/dist/ui/shimmer-worker.d.ts.map +0 -1
  550. package/dist/ui/shimmer-worker.js.map +0 -1
  551. package/dist/ui/types.d.ts.map +0 -1
  552. package/dist/ui/types.js.map +0 -1
  553. package/dist/upgrade/index.d.ts.map +0 -1
  554. package/dist/upgrade/index.js.map +0 -1
  555. package/dist/upgrade/remove-binary.d.ts.map +0 -1
  556. package/dist/upgrade/remove-binary.js.map +0 -1
  557. package/dist/upgrade/update-check.d.ts.map +0 -1
  558. package/dist/upgrade/update-check.js.map +0 -1
  559. package/dist/utils.d.ts.map +0 -1
  560. package/dist/utils.js.map +0 -1
@@ -23,6 +23,9 @@ exports.normalizeExploreQueryTerms = normalizeExploreQueryTerms;
23
23
  exports.buildMcpQueryCacheFingerprint = buildMcpQueryCacheFingerprint;
24
24
  exports.buildMcpQueryCacheKey = buildMcpQueryCacheKey;
25
25
  const node_crypto_1 = require("node:crypto");
26
+ const query_plan_1 = require("../search/query-plan");
27
+ const PLAN_RELATIONS = new Set(query_plan_1.QUERY_RELATIONS);
28
+ const PLAN_SOURCE_SCOPES = new Set(query_plan_1.QUERY_SOURCE_SCOPES);
26
29
  /** Mirrors `getExploreOutputBudget` tier breakpoints — cache-key only. */
27
30
  function defaultExploreMaxFiles(fileCount) {
28
31
  if (fileCount < 150)
@@ -32,7 +35,7 @@ function defaultExploreMaxFiles(fileCount) {
32
35
  return 8;
33
36
  }
34
37
  /** Bump when cache-key normalization or cached payload shape changes. */
35
- exports.QUERY_CACHE_FORMAT_VERSION = 1;
38
+ exports.QUERY_CACHE_FORMAT_VERSION = 5;
36
39
  const METADATA_INDEX_STAMP = 'query_cache_index_stamp';
37
40
  const METADATA_FORMAT_VERSION = 'query_cache_format_version';
38
41
  /** Tools that must stay live — never cached. */
@@ -140,7 +143,10 @@ function exploreEnvFingerprint() {
140
143
  ? '0'
141
144
  : '1';
142
145
  const rankMultiterm = process.env.HOMEGRAPH_RANK_NO_MULTITERM === '1' ? '0' : '1';
143
- return `linums:${linums}|adaptive:${adaptive}|rankMultiterm:${rankMultiterm}`;
146
+ const fullSource = process.env.HOMEGRAPH_EXPLORE_FULL_SOURCE === '1' ? '1' : '0';
147
+ const evidencePacks = process.env.HOMEGRAPH_ARKTS_EVIDENCE_PACKS === '0' ? '0' : '1';
148
+ const queryPaths = process.env.HOMEGRAPH_ARKTS_QUERY_PATHS === '0' ? '0' : '1';
149
+ return `linums:${linums}|adaptive:${adaptive}|rankMultiterm:${rankMultiterm}|fullSource:${fullSource}|arktsEvidence:${evidencePacks}|arktsPaths:${queryPaths}`;
144
150
  }
145
151
  function normalizeString(value) {
146
152
  if (typeof value !== 'string')
@@ -152,13 +158,92 @@ function intParam(value, fallback) {
152
158
  const n = Number(value);
153
159
  return Number.isFinite(n) && n > 0 ? Math.floor(Math.floor(n)) : fallback;
154
160
  }
161
+ /**
162
+ * Project the execution semantics of an internal plan, not its per-call timing.
163
+ * Ordered queries/steps/anchors preserve direction (A calls B != B calls A).
164
+ * Explicit projection also keeps telemetry, deadlines and unknown fields out of
165
+ * keys, and is safe on malformed/cyclic values at a worker or library boundary.
166
+ */
167
+ function queryPlanFingerprint(value) {
168
+ const record = (v) => v !== null && typeof v === 'object' && !Array.isArray(v)
169
+ ? v : undefined;
170
+ const strings = (v, limit) => {
171
+ if (!Array.isArray(v) || v.length > limit)
172
+ return undefined;
173
+ return v.every(item => typeof item === 'string' && item.length <= 256)
174
+ ? v : undefined;
175
+ };
176
+ const query = (v) => typeof v === 'string' && v.length <= 16_384 ? v : undefined;
177
+ const validRetrievalFields = (v) => (v.searchTerms === undefined || strings(v.searchTerms, 32) !== undefined)
178
+ && (v.literalTexts === undefined || strings(v.literalTexts, 16) !== undefined)
179
+ && (v.relation === undefined || (typeof v.relation === 'string' && PLAN_RELATIONS.has(v.relation)))
180
+ && (v.sourceScope === undefined || (typeof v.sourceScope === 'string' && PLAN_SOURCE_SCOPES.has(v.sourceScope)));
181
+ const plan = record(value);
182
+ if (!plan || !validRetrievalFields(plan))
183
+ return undefined;
184
+ if ((typeof plan.version !== 'number' || !Number.isFinite(plan.version))
185
+ && (typeof plan.version !== 'string' || plan.version.length > 64))
186
+ return undefined;
187
+ const originalQuery = query(plan.originalQuery);
188
+ const canonicalQuery = query(plan.canonicalQuery);
189
+ const intent = normalizeString(plan.intent);
190
+ const route = normalizeString(plan.route);
191
+ const anchors = strings(plan.anchors, 32);
192
+ const searchTerms = strings(plan.searchTerms, 32);
193
+ if (originalQuery === undefined || canonicalQuery === undefined || !intent || !route
194
+ || !anchors || !searchTerms || !Array.isArray(plan.steps) || plan.steps.length > 3)
195
+ return undefined;
196
+ const steps = [];
197
+ for (const value of plan.steps) {
198
+ const step = record(value);
199
+ if (!step || !validRetrievalFields(step))
200
+ return undefined;
201
+ const id = normalizeString(step.id);
202
+ const stepQuery = query(step.query);
203
+ const stepIntent = normalizeString(step.intent);
204
+ const stepAnchors = strings(step.anchors, 32);
205
+ const dependsOn = strings(step.dependsOn, 3);
206
+ if (!id || stepQuery === undefined || !stepIntent || !stepAnchors || !dependsOn)
207
+ return undefined;
208
+ steps.push({ id, query: stepQuery, intent: stepIntent, anchors: stepAnchors, dependsOn,
209
+ searchTerms: strings(step.searchTerms, 32), literalTexts: strings(step.literalTexts, 16),
210
+ relation: normalizeString(step.relation), sourceScope: normalizeString(step.sourceScope) });
211
+ }
212
+ const features = record(plan.features);
213
+ if (!features || Object.keys(features).length > 64
214
+ || !Object.values(features).every(v => typeof v === 'boolean'))
215
+ return undefined;
216
+ return stableJson({
217
+ version: plan.version, originalQuery, canonicalQuery, intent, route,
218
+ taskContext: query(plan.taskContext),
219
+ anchors, searchTerms, steps, features,
220
+ literalTexts: strings(plan.literalTexts, 16), relation: normalizeString(plan.relation),
221
+ sourceScope: normalizeString(plan.sourceScope),
222
+ source: typeof plan.source === 'string' ? plan.source : undefined,
223
+ confidence: typeof plan.confidence === 'number' || typeof plan.confidence === 'string'
224
+ ? plan.confidence : undefined,
225
+ });
226
+ }
155
227
  /** Build the pre-hash fingerprint string for a tool + args pair. */
156
228
  function buildMcpQueryCacheFingerprint(toolName, args, fileCount) {
157
229
  const parts = [toolName.replace(/^homegraph_/, '')];
158
230
  switch (toolName) {
159
231
  case 'homegraph_explore': {
160
232
  const query = normalizeString(args.query) ?? '';
161
- parts.push(`terms:${normalizeExploreQueryTerms(query).join(',')}`);
233
+ const plan = queryPlanFingerprint(args.__homegraphQueryPlan);
234
+ if (plan) {
235
+ parts.push(`plan:${plan}`);
236
+ }
237
+ else {
238
+ // Preserve order-independent legacy keys for calls without a valid plan.
239
+ parts.push(`terms:${normalizeExploreQueryTerms(query).join(',')}`);
240
+ const taskContext = normalizeString(args.taskContext);
241
+ if (taskContext)
242
+ parts.push(`taskContext:${taskContext.slice(0, 4000)}`);
243
+ }
244
+ const indexState = normalizeString(args.__homegraphQueryIndexState);
245
+ if (indexState)
246
+ parts.push(`indexState:${JSON.stringify(indexState)}`);
162
247
  if (args.maxFiles != null) {
163
248
  parts.push(`maxFiles:${intParam(args.maxFiles, 12)}`);
164
249
  }
@@ -173,6 +258,8 @@ function buildMcpQueryCacheFingerprint(toolName, args, fileCount) {
173
258
  }
174
259
  case 'homegraph_search': {
175
260
  parts.push(`query:${(normalizeString(args.query) ?? '').toLowerCase()}`);
261
+ // Search can reuse the compact ArkTS renderer as an existing fast path.
262
+ parts.push(exploreEnvFingerprint());
176
263
  if (args.kind != null) {
177
264
  const kind = args.kind === 'type' ? 'type_alias' : String(args.kind);
178
265
  parts.push(`kind:${kind}`);
@@ -2,7 +2,7 @@
2
2
  * Query worker thread — issue: concurrent MCP tool calls starve the daemon.
3
3
  *
4
4
  * The shared daemon serves every session on ONE event loop with synchronous
5
- * SQLite (better-sqlite3 / wasm). `codegraph_explore` is CPU-heavy (FTS + RWR/personalized-
5
+ * SQLite (node:sqlite / wasm). `codegraph_explore` is CPU-heavy (FTS + RWR/personalized-
6
6
  * PageRank + impact + output building) stitched together by microtask `await`s,
7
7
  * so N concurrent explores keep the microtask queue continuously full and
8
8
  * starve the macrotask phases — timers AND socket I/O. The transport freezes:
@@ -3,7 +3,7 @@
3
3
  * Query worker thread — issue: concurrent MCP tool calls starve the daemon.
4
4
  *
5
5
  * The shared daemon serves every session on ONE event loop with synchronous
6
- * SQLite (better-sqlite3 / wasm). `codegraph_explore` is CPU-heavy (FTS + RWR/personalized-
6
+ * SQLite (node:sqlite / wasm). `codegraph_explore` is CPU-heavy (FTS + RWR/personalized-
7
7
  * PageRank + impact + output building) stitched together by microtask `await`s,
8
8
  * so N concurrent explores keep the microtask queue continuously full and
9
9
  * starve the macrotask phases — timers AND socket I/O. The transport freezes:
@@ -1,12 +1,7 @@
1
1
  /**
2
- * Server-level instructions emitted in the MCP `initialize` response.
3
- *
4
- * Single source of truth for agent-facing tool guidance (issue #529).
5
- * Edit here — not installer prompts or eval harness prompts.
6
- *
7
- * Keep this short: long essays are low-salience and rarely change tool choice.
8
- * Prefer concrete habits (query shape, which tool, when to stop).
2
+ * MCP initialize 中的统一工具指引;工具描述必须遵守相同的按需策略。
3
+ * 仅调整检索选择,不改变索引、查询语义或编码任务的验收要求。
9
4
  */
10
- export declare const SERVER_INSTRUCTIONS = "# HomeGraph \u2014 structural locator for THIS repo\n\nLocal symbol graph (defs / calls / imports / files). Use it to **coarse-locate** in-repo symbols (`file:line` + short source), then answer. Not general Q&A, not SDK docs.\n\n## Call first (do not Grep/Glob/Read first)\n\nWill you **explain or edit in-repo code**? \u2192 `homegraph_explore` **once** with the user task as `query` (Chinese OK; add English Type / `Type.member` / `@kit` / `@ohos` tokens when you know them).\n\nAlready know **one** exact symbol? Prefer smaller tools: `homegraph_callers` / `homegraph_callees` / `homegraph_node`. Spelling unknown \u2192 `homegraph_search` last.\n\nFor a narrow inventory, call `homegraph_usages` (where-used), `homegraph_modules` (named module deps/cycles), or `homegraph_native` (NAPI exports). Existing clients may keep calling `homegraph_explore`: high-confidence shapes route to the same bounded handlers.\n\nEngineering overview / module\u2192file map (including while the full index is still building) \u2192 `homegraph_project`.\n\n**Must explore-first:** how/mechanism wiring, named Type / `.member`, in-repo `@kit`/`@ohos` **usages**, deps/cycles, NAPI / `.d.ts` wrap sites, pre-edit orientation.\n\nArkUI V1\u2194V2 / state-decorator migration on a named component \u2192 `homegraph_arkui_migrate` once (not explore stitching).\n\n## How to write `query`\n\n- Put **concrete anchors** in the bag: `FooManager`, `BarEvent`, `Type.member`, `feature/foo`, `@kit.X`.\n- Map Chinese entities to English symbol stems when you can (`\u8BBE\u7F6E`\u2192`Setting`, `\u65B0\u5EFA`\u2192`New`) \u2014 search/explore cluster `Entity` / `EntityManager` / `EntityViewModel`.\n- Keep **intent words** with the Type (`\u6765\u6E90` / `\u5206\u53D1` / `\u4F9D\u8D56` / `NAPI` / `\u9A71\u52A8`) \u2014 bare Type alone may drop survey routing.\n- Multi-app monorepo: pass `projectPath` to the app root; ignore sibling-app paths as noise.\n\n## After one explore\n\n- Returned line-numbered source = **already Read** for those symbols \u2014 do not re-Grep/Read/node the **same** symbols.\n- **Coarse locate / ANSWER NOW** \u2192 answer/edit from anchors; do not verify with a Grep storm.\n- **Partial locator** \u2192 **ONE** tighter follow-up with the named **Next anchor** only \u2014 never a paraphrase or a different Type (server refuses). After Partial: **no** `homegraph_callers`/`callees`; at most **one** `homegraph_node`. A **second** Partial \u2192 stop HomeGraph; ONE narrow Grep then answer \u2014 never a repo-wide glob/Read storm.\n- Busy/deadline \u2192 retry **once** tighter; then answer from anchors (narrow Grep OK for residuals).\n\nPrefer smallest tool when the name is known: callers/callees/node \u226A explore \u226A search. Prefer **one** Type-wide inventory explore over fanning `homegraph_callers` per method. Session fuse: **\u22642** `homegraph_explore` per project; after Partial follow-ups must name the **Next anchor**; **\u22641** `homegraph_node` after Partial \u2014 further calls are refused.\n\n## Do not call HomeGraph\n\nRuntime Skip is a short blacklist (everything else is served if you call):\n\n- Topic \u2192 file list with no Type/file basename\n- Literal / layout copy hunts with no Type/file/`@kit`/`@ohos`\n- Pure existence / concept-compare with no graph anchors\n- Official website/docs only \u00B7 scaffold empty project \u00B7 git/blame/diff \u00B7 media/binary inventories\n\n`@kit` / OHOS **API usage in this repo** \u2192 explore (not Skip). Feature **catalogs** of an SDK \u2192 SDK docs, not HomeGraph.\n\nIf a tool returns **Skip HomeGraph**, stop \u2014 do not retry `homegraph_*`.\n\n## Tips\n\n- Empty callers/callees = **edges not indexed**, not \u201Cmissing symbol\u201D \u2014 use the definition anchor; narrow Grep for registration if needed.\n- **Staleness banner** \u2014 Read only listed edited files.\n- **Not indexed** \u2014 use built-ins; user runs `homegraph init` (you do not).\n";
11
- export declare const SERVER_INSTRUCTIONS_NO_ROOT_INDEX = "# HomeGraph \u2014 per-project (pass projectPath)\n\nPass `projectPath` to a folder that has `.homegraph/`.\n\n**Call first:** explain/edit in-repo code \u2192 `homegraph_explore` with task keywords (no Grep-first). Named Type / `Type.member` / usages / deps / NAPI / `@kit` \u2192 explore.\n\nNarrow inventories may call `homegraph_usages`, `homegraph_modules`, or `homegraph_native` directly; pass the same `projectPath`.\n\n**Skip:** topic file-lists, concept compares, literal hunts, git history, media. No index \u2192 Read/Grep/Glob; user runs `homegraph init`.\n\n**Query habit:** Chinese OK; add English Type/`@kit` tokens when known. Explore = coarse locate. Partial \u2192 one tighter follow-up with a concrete name from the list. ONE narrow Grep OK for residual unindexed wiring \u2014 not a Grep storm.\n";
5
+ export declare const SERVER_INSTRUCTIONS = "# HomeGraph \u2014 optional structural evidence for this repo\n\n## When to call (path-first, bash-first)\n\nUse ordinary bash/search/read tools first for repository paths, symbols, literal strings and local changes. Skip HomeGraph when those tools provide sufficient evidence, including for difficult implementation tasks. A known path can be read directly; an adequate source result does not need a second graph lookup.\n\nHomeGraph is optional. Use it only for a concrete unresolved relationship that benefits from graph evidence: cross-file state/event propagation, callers/callees, module dependencies or ArkTS-to-native registration. Name the missing relation and use anchors from the current task or source. There is no mandatory number of bash searches before a useful graph query.\n\nChoose the smallest available tool for that gap:\n- Exact usage/reference locations \u2192 `homegraph_usages`; callers/callees \u2192 the corresponding tool.\n- Named module dependencies/cycles \u2192 `homegraph_modules`; native exports/registration \u2192 `homegraph_native`.\n- One missing symbol body \u2192 `homegraph_node`; prefer direct read if its path is already known.\n- An unresolved cross-symbol mechanism \u2192 `homegraph_explore`. Do not use it for routine pre-edit orientation, a literal search, or to re-confirm source already found with bash.\n- ArkUI migration analysis \u2192 `homegraph_arkui_migrate` when that analysis is needed; SDK contracts \u2192 project declarations or SDK documentation.\n\nDo not call explore after a focused tool already answered the relation. Keep working directly once the edit location and affected behavior are sufficiently supported. Task difficulty and file count alone do not require graph use.\n\n## Query and recovery\n\nWrite one focused sentence: requested action + target + known anchors + unresolved relation + preservation constraints. Use the full public task as `taskContext` when needed. Keep UI labels verbatim; use exact symbols from the task or source instead of inventing names or piling up generic keywords. Use returned repository-relative paths without reconstructing an experiment directory; a path refusal requires valid in-repo relocation, not broader permissions.\n\nA project map is navigation, not proof of a located feature. Preserve requested product/module scope and verify each candidate before editing. Start with one focused graph request; recover only a named missing body/relation. Budget: \u22642 `homegraph_explore` attempts per project, \u22641 focused depth recovery; existing runtime budgets may be tighter. These are ceilings, never a required sequence. If evidence is still missing, use targeted bash/search/read and continue implementation. Do not expand into unrelated files merely to exhaust a budget.\n\n\n- ArkTS evidence packs keep complete declarations and the source dependencies of displayed static relations together. Gaps identify omitted, stale or unindexed evidence; inspect only a gap relevant to the task. A static link does not prove runtime ordering or value propagation, and a complete declaration does not prove its enclosing call conditions.\n- ArkTS path evidence follows typed, directed relations between named anchors within a bounded search. A provided path includes intermediate declarations and registration sites. Check its goal and stop reason; no path in scope does not prove no relationship. Qualify ambiguous symbols with their owning type or file.\n- Reuse complete, unchanged, line-numbered source ranges already visible. An outline, path list, truncated body or SDK declaration cannot replace missing implementation evidence. A slice hash identifies that excerpt, not the whole file. Refresh affected ranges after edits.\n- An empty edge set means the relation may be unindexed, not absent. For partial, stale or irrelevant results, inspect the exact missing source with scoped search/read. After a query adds no evidence, change the method or scope rather than paraphrasing the same explore.\n- Retrieval completion is not task completion. Continue the requested edits and validation; check the original task's behavior and preservation constraints. Build success alone does not establish functional correctness.\n\nNo index \u2192 use ordinary tools; indexing is managed by the host. Do not run HomeGraph initialization as part of solving the task.\n";
6
+ export declare const SERVER_INSTRUCTIONS_NO_ROOT_INDEX = "# HomeGraph \u2014 optional per-project evidence\n\nPass `projectPath` to an already indexed folder with `.homegraph/`. No index \u2192 use ordinary tools; indexing is managed by the host.\n\n## When to call (path-first, bash-first)\n\nUse ordinary bash/search/read tools first for repository paths, symbols, literal strings and local changes. Skip HomeGraph when those tools provide sufficient evidence, including for difficult implementation tasks. A known path can be read directly; an adequate source result does not need a second graph lookup.\n\nHomeGraph is optional. Use it only for a concrete unresolved relationship that benefits from graph evidence: cross-file state/event propagation, callers/callees, module dependencies or ArkTS-to-native registration. Name the missing relation and use anchors from the current task or source. There is no mandatory number of bash searches before a useful graph query.\n\nChoose the smallest available tool for that gap:\n- Exact usage/reference locations \u2192 `homegraph_usages`; callers/callees \u2192 the corresponding tool.\n- Named module dependencies/cycles \u2192 `homegraph_modules`; native exports/registration \u2192 `homegraph_native`.\n- One missing symbol body \u2192 `homegraph_node`; prefer direct read if its path is already known.\n- An unresolved cross-symbol mechanism \u2192 `homegraph_explore`. Do not use it for routine pre-edit orientation, a literal search, or to re-confirm source already found with bash.\n- ArkUI migration analysis \u2192 `homegraph_arkui_migrate` when that analysis is needed; SDK contracts \u2192 project declarations or SDK documentation.\n\nDo not call explore after a focused tool already answered the relation. Keep working directly once the edit location and affected behavior are sufficiently supported. Task difficulty and file count alone do not require graph use.\n\n## Query and recovery\n\nWrite one focused sentence: requested action + target + known anchors + unresolved relation + preservation constraints. Use the full public task as `taskContext` when needed. Keep UI labels verbatim; use exact symbols from the task or source instead of inventing names or piling up generic keywords. Use returned repository-relative paths without reconstructing an experiment directory; a path refusal requires valid in-repo relocation, not broader permissions.\n\nA project map is navigation, not proof of a located feature. Preserve requested product/module scope and verify each candidate before editing. Start with one focused graph request; recover only a named missing body/relation. Budget: \u22642 `homegraph_explore` attempts per project, \u22641 focused depth recovery; existing runtime budgets may be tighter. These are ceilings, never a required sequence. If evidence is still missing, use targeted bash/search/read and continue implementation. Do not expand into unrelated files merely to exhaust a budget.\n\n\n- ArkTS evidence packs keep complete declarations and the source dependencies of displayed static relations together. Gaps identify omitted, stale or unindexed evidence; inspect only a gap relevant to the task. A static link does not prove runtime ordering or value propagation, and a complete declaration does not prove its enclosing call conditions.\n- ArkTS path evidence follows typed, directed relations between named anchors within a bounded search. A provided path includes intermediate declarations and registration sites. Check its goal and stop reason; no path in scope does not prove no relationship. Qualify ambiguous symbols with their owning type or file.\n- Reuse complete, unchanged, line-numbered source ranges already visible. An outline, path list, truncated body or SDK declaration cannot replace missing implementation evidence. A slice hash identifies that excerpt, not the whole file. Refresh affected ranges after edits.\n- An empty edge set means the relation may be unindexed, not absent. For partial, stale or irrelevant results, inspect the exact missing source with scoped search/read. After a query adds no evidence, change the method or scope rather than paraphrasing the same explore.\n- Retrieval completion is not task completion. Continue the requested edits and validation; check the original task's behavior and preservation constraints. Build success alone does not establish functional correctness.\n\n";
12
7
  //# sourceMappingURL=server-instructions.d.ts.map
@@ -1,78 +1,51 @@
1
1
  "use strict";
2
2
  /**
3
- * Server-level instructions emitted in the MCP `initialize` response.
4
- *
5
- * Single source of truth for agent-facing tool guidance (issue #529).
6
- * Edit here — not installer prompts or eval harness prompts.
7
- *
8
- * Keep this short: long essays are low-salience and rarely change tool choice.
9
- * Prefer concrete habits (query shape, which tool, when to stop).
3
+ * MCP initialize 中的统一工具指引;工具描述必须遵守相同的按需策略。
4
+ * 仅调整检索选择,不改变索引、查询语义或编码任务的验收要求。
10
5
  */
11
6
  Object.defineProperty(exports, "__esModule", { value: true });
12
7
  exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = exports.SERVER_INSTRUCTIONS = void 0;
13
- exports.SERVER_INSTRUCTIONS = `# HomeGraph — structural locator for THIS repo
14
-
15
- Local symbol graph (defs / calls / imports / files). Use it to **coarse-locate** in-repo symbols (\`file:line\` + short source), then answer. Not general Q&A, not SDK docs.
16
-
17
- ## Call first (do not Grep/Glob/Read first)
18
-
19
- Will you **explain or edit in-repo code**? → \`homegraph_explore\` **once** with the user task as \`query\` (Chinese OK; add English Type / \`Type.member\` / \`@kit\` / \`@ohos\` tokens when you know them).
20
-
21
- Already know **one** exact symbol? Prefer smaller tools: \`homegraph_callers\` / \`homegraph_callees\` / \`homegraph_node\`. Spelling unknown → \`homegraph_search\` last.
22
-
23
- For a narrow inventory, call \`homegraph_usages\` (where-used), \`homegraph_modules\` (named module deps/cycles), or \`homegraph_native\` (NAPI exports). Existing clients may keep calling \`homegraph_explore\`: high-confidence shapes route to the same bounded handlers.
24
-
25
- Engineering overview / module→file map (including while the full index is still building) → \`homegraph_project\`.
26
-
27
- **Must explore-first:** how/mechanism wiring, named Type / \`.member\`, in-repo \`@kit\`/\`@ohos\` **usages**, deps/cycles, NAPI / \`.d.ts\` wrap sites, pre-edit orientation.
28
-
29
- ArkUI V1↔V2 / state-decorator migration on a named component → \`homegraph_arkui_migrate\` once (not explore stitching).
30
-
31
- ## How to write \`query\`
32
-
33
- - Put **concrete anchors** in the bag: \`FooManager\`, \`BarEvent\`, \`Type.member\`, \`feature/foo\`, \`@kit.X\`.
34
- - Map Chinese entities to English symbol stems when you can (\`设置\`→\`Setting\`, \`新建\`→\`New\`) — search/explore cluster \`Entity\` / \`EntityManager\` / \`EntityViewModel\`.
35
- - Keep **intent words** with the Type (\`来源\` / \`分发\` / \`依赖\` / \`NAPI\` / \`驱动\`) — bare Type alone may drop survey routing.
36
- - Multi-app monorepo: pass \`projectPath\` to the app root; ignore sibling-app paths as noise.
37
-
38
- ## After one explore
39
-
40
- - Returned line-numbered source = **already Read** for those symbols — do not re-Grep/Read/node the **same** symbols.
41
- - **Coarse locate / ANSWER NOW** → answer/edit from anchors; do not verify with a Grep storm.
42
- - **Partial locator** → **ONE** tighter follow-up with the named **Next anchor** only — never a paraphrase or a different Type (server refuses). After Partial: **no** \`homegraph_callers\`/\`callees\`; at most **one** \`homegraph_node\`. A **second** Partial → stop HomeGraph; ONE narrow Grep then answer — never a repo-wide glob/Read storm.
43
- - Busy/deadline → retry **once** tighter; then answer from anchors (narrow Grep OK for residuals).
44
-
45
- Prefer smallest tool when the name is known: callers/callees/node ≪ explore ≪ search. Prefer **one** Type-wide inventory explore over fanning \`homegraph_callers\` per method. Session fuse: **≤2** \`homegraph_explore\` per project; after Partial follow-ups must name the **Next anchor**; **≤1** \`homegraph_node\` after Partial — further calls are refused.
46
-
47
- ## Do not call HomeGraph
48
-
49
- Runtime Skip is a short blacklist (everything else is served if you call):
50
-
51
- - Topic → file list with no Type/file basename
52
- - Literal / layout copy hunts with no Type/file/\`@kit\`/\`@ohos\`
53
- - Pure existence / concept-compare with no graph anchors
54
- - Official website/docs only · scaffold empty project · git/blame/diff · media/binary inventories
8
+ const SOURCE_AND_VALIDATION = `
9
+ - ArkTS evidence packs keep complete declarations and the source dependencies of displayed static relations together. Gaps identify omitted, stale or unindexed evidence; inspect only a gap relevant to the task. A static link does not prove runtime ordering or value propagation, and a complete declaration does not prove its enclosing call conditions.
10
+ - ArkTS path evidence follows typed, directed relations between named anchors within a bounded search. A provided path includes intermediate declarations and registration sites. Check its goal and stop reason; no path in scope does not prove no relationship. Qualify ambiguous symbols with their owning type or file.
11
+ - Reuse complete, unchanged, line-numbered source ranges already visible. An outline, path list, truncated body or SDK declaration cannot replace missing implementation evidence. A slice hash identifies that excerpt, not the whole file. Refresh affected ranges after edits.
12
+ - An empty edge set means the relation may be unindexed, not absent. For partial, stale or irrelevant results, inspect the exact missing source with scoped search/read. After a query adds no evidence, change the method or scope rather than paraphrasing the same explore.
13
+ - Retrieval completion is not task completion. Continue the requested edits and validation; check the original task's behavior and preservation constraints. Build success alone does not establish functional correctness.
14
+ `;
15
+ const ON_DEMAND = `## When to call (path-first, bash-first)
55
16
 
56
- \`@kit\` / OHOS **API usage in this repo** → explore (not Skip). Feature **catalogs** of an SDK → SDK docs, not HomeGraph.
17
+ Use ordinary bash/search/read tools first for repository paths, symbols, literal strings and local changes. Skip HomeGraph when those tools provide sufficient evidence, including for difficult implementation tasks. A known path can be read directly; an adequate source result does not need a second graph lookup.
57
18
 
58
- If a tool returns **Skip HomeGraph**, stop — do not retry \`homegraph_*\`.
19
+ HomeGraph is optional. Use it only for a concrete unresolved relationship that benefits from graph evidence: cross-file state/event propagation, callers/callees, module dependencies or ArkTS-to-native registration. Name the missing relation and use anchors from the current task or source. There is no mandatory number of bash searches before a useful graph query.
59
20
 
60
- ## Tips
21
+ Choose the smallest available tool for that gap:
22
+ - Exact usage/reference locations → \`homegraph_usages\`; callers/callees → the corresponding tool.
23
+ - Named module dependencies/cycles → \`homegraph_modules\`; native exports/registration → \`homegraph_native\`.
24
+ - One missing symbol body → \`homegraph_node\`; prefer direct read if its path is already known.
25
+ - An unresolved cross-symbol mechanism → \`homegraph_explore\`. Do not use it for routine pre-edit orientation, a literal search, or to re-confirm source already found with bash.
26
+ - ArkUI migration analysis → \`homegraph_arkui_migrate\` when that analysis is needed; SDK contracts → project declarations or SDK documentation.
61
27
 
62
- - Empty callers/callees = **edges not indexed**, not “missing symbol” — use the definition anchor; narrow Grep for registration if needed.
63
- - **Staleness banner** — Read only listed edited files.
64
- - **Not indexed** — use built-ins; user runs \`homegraph init\` (you do not).
28
+ Do not call explore after a focused tool already answered the relation. Keep working directly once the edit location and affected behavior are sufficiently supported. Task difficulty and file count alone do not require graph use.
65
29
  `;
66
- exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = `# HomeGraph — per-project (pass projectPath)
30
+ const QUERY = `## Query and recovery
67
31
 
68
- Pass \`projectPath\` to a folder that has \`.homegraph/\`.
32
+ Write one focused sentence: requested action + target + known anchors + unresolved relation + preservation constraints. Use the full public task as \`taskContext\` when needed. Keep UI labels verbatim; use exact symbols from the task or source instead of inventing names or piling up generic keywords. Use returned repository-relative paths without reconstructing an experiment directory; a path refusal requires valid in-repo relocation, not broader permissions.
69
33
 
70
- **Call first:** explain/edit in-repo code → \`homegraph_explore\` with task keywords (no Grep-first). Named Type / \`Type.member\` / usages / deps / NAPI / \`@kit\` → explore.
34
+ A project map is navigation, not proof of a located feature. Preserve requested product/module scope and verify each candidate before editing. Start with one focused graph request; recover only a named missing body/relation. Budget: ≤2 \`homegraph_explore\` attempts per project, ≤1 focused depth recovery; existing runtime budgets may be tighter. These are ceilings, never a required sequence. If evidence is still missing, use targeted bash/search/read and continue implementation. Do not expand into unrelated files merely to exhaust a budget.
35
+ `;
36
+ exports.SERVER_INSTRUCTIONS = `# HomeGraph — optional structural evidence for this repo
71
37
 
72
- Narrow inventories may call \`homegraph_usages\`, \`homegraph_modules\`, or \`homegraph_native\` directly; pass the same \`projectPath\`.
38
+ ${ON_DEMAND}
39
+ ${QUERY}
40
+ ${SOURCE_AND_VALIDATION}
41
+ No index → use ordinary tools; indexing is managed by the host. Do not run HomeGraph initialization as part of solving the task.
42
+ `;
43
+ exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = `# HomeGraph — optional per-project evidence
73
44
 
74
- **Skip:** topic file-lists, concept compares, literal hunts, git history, media. No index → Read/Grep/Glob; user runs \`homegraph init\`.
45
+ Pass \`projectPath\` to an already indexed folder with \`.homegraph/\`. No index → use ordinary tools; indexing is managed by the host.
75
46
 
76
- **Query habit:** Chinese OK; add English Type/\`@kit\` tokens when known. Explore = coarse locate. Partial → one tighter follow-up with a concrete name from the list. ONE narrow Grep OK for residual unindexed wiring — not a Grep storm.
47
+ ${ON_DEMAND}
48
+ ${QUERY}
49
+ ${SOURCE_AND_VALIDATION}
77
50
  `;
78
51
  //# sourceMappingURL=server-instructions.js.map
@@ -253,7 +253,10 @@ class MCPSession {
253
253
  // Kick off engine init in the background. If another session in the
254
254
  // same daemon already opened the project, `ensureInitialized` is a
255
255
  // ~free no-op — N concurrent clients pay exactly one open.
256
- this.resolvePromise = this.engine.ensureInitialized(explicitPath);
256
+ // explicitPath is a DECLARED root (rootUri / workspaceFolders / --path),
257
+ // so it also bounds the walk-up (spec 0028): a stray ancestor .homegraph
258
+ // must not hijack the session.
259
+ this.resolvePromise = this.engine.ensureInitialized(explicitPath, explicitPath);
257
260
  }
258
261
  }
259
262
  async handleToolsList(request) {
@@ -329,9 +332,10 @@ class MCPSession {
329
332
  return;
330
333
  }
331
334
  // Last resort: walk from the best candidate (sync open). Picks up
332
- // projects that appeared after the server started.
335
+ // projects that appeared after the server started. The hint (server
336
+ // --path) is a declaration → floor; bare cwd is not.
333
337
  const candidate = hint ?? process.cwd();
334
- this.engine.retryInitializeSync(candidate);
338
+ this.engine.retryInitializeSync(candidate, hint ?? undefined);
335
339
  }
336
340
  /**
337
341
  * Ask the client for its workspace root via `roots/list` and open the
@@ -339,11 +343,15 @@ class MCPSession {
339
343
  */
340
344
  async initFromRoots() {
341
345
  let target = process.cwd();
346
+ // Only a real roots/list answer is a client DECLARATION of the workspace
347
+ // root — the cwd fallbacks are not, and keep the git-style walk-up.
348
+ let declared = false;
342
349
  try {
343
350
  const result = await this.transport.request('roots/list', undefined, ROOTS_LIST_TIMEOUT_MS);
344
351
  const rootPath = firstRootPath(result);
345
352
  if (rootPath) {
346
353
  target = rootPath;
354
+ declared = true;
347
355
  }
348
356
  else {
349
357
  process.stderr.write('[HomeGraph MCP] Client returned no workspace roots; falling back to process cwd.\n');
@@ -353,7 +361,7 @@ class MCPSession {
353
361
  const msg = err instanceof Error ? err.message : String(err);
354
362
  process.stderr.write(`[HomeGraph MCP] roots/list request failed (${msg}); falling back to process cwd.\n`);
355
363
  }
356
- await this.engine.ensureInitialized(target);
364
+ await this.engine.ensureInitialized(target, declared ? target : undefined);
357
365
  }
358
366
  }
359
367
  exports.MCPSession = MCPSession;
@@ -0,0 +1,3 @@
1
+ /** 只标识实际返回的片段,不冒充整个文件版本或任务覆盖率。 */
2
+ export declare function sourceSliceIdentity(path: string, start: number, source: string): string;
3
+ //# sourceMappingURL=source-slice-identity.d.ts.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sourceSliceIdentity = sourceSliceIdentity;
4
+ const node_crypto_1 = require("node:crypto");
5
+ /** 只标识实际返回的片段,不冒充整个文件版本或任务覆盖率。 */
6
+ function sourceSliceIdentity(path, start, source) {
7
+ const end = start + source.split('\n').length - 1;
8
+ const digest = (0, node_crypto_1.createHash)('sha256').update(source, 'utf8').digest('hex').slice(0, 16);
9
+ return `Source slice: ${path}:${start}-${end}; excerpt-sha256=${digest}. Excerpt only; refresh after edits.`;
10
+ }
11
+ //# sourceMappingURL=source-slice-identity.js.map
@@ -202,6 +202,8 @@ export interface ToolResult {
202
202
  text: string;
203
203
  }>;
204
204
  isError?: boolean;
205
+ /** Compact diagnostics for hosts/evaluators; never credentials or source dumps. */
206
+ _meta?: Record<string, unknown>;
205
207
  /**
206
208
  * Internal: what an explore call emitted (CG-17). {@link ToolHandler.execute}
207
209
  * records it into the calling session's state and deletes it before the result
@@ -315,6 +317,23 @@ export declare class ToolHandler {
315
317
  * allowlist so a trimmed surface is reflected in ListTools.
316
318
  */
317
319
  getTools(): ToolDefinition[];
320
+ /**
321
+ * Per-repo suffix appended to homegraph_explore's description (Spec 0027).
322
+ *
323
+ * fileCount === 0 must not read as "this project is empty": hosts snapshot
324
+ * tools/list once at connect (#964), and an auto-init that is still building
325
+ * reports 0 at that instant. Field evidence (DevEco Code bench, 3 sessions,
326
+ * zero homegraph calls): agents read "make at most 1 calls for this project
327
+ * (0 files indexed)" as terminal — "homegraph isn't indexed for this
328
+ * project" — and permanently fell back to Read/Grep even though the index
329
+ * completed seconds later. Mirror maybeDeepToolPhaseGate's success-shaped
330
+ * guidance so the frozen description and the live call-time response tell
331
+ * the same story: failed build → say so (indexing is the user's call, so
332
+ * the agent relays it); still building → point at homegraph_project and
333
+ * retry; genuinely empty → honest empty note. Only fileCount > 0 carries a
334
+ * call budget — there is nothing to budget over an unbuilt index.
335
+ */
336
+ private exploreSuffix;
318
337
  /**
319
338
  * Get HomeGraph instance for a project
320
339
  *
@@ -422,6 +441,10 @@ export declare class ToolHandler {
422
441
  * once the session's one allowed depth drill is spent.
423
442
  */
424
443
  private tryDepthToolFuse;
444
+ /** A repeated query is duplicate evidence only while its source is unchanged. */
445
+ private shouldRefuseRepeatedEvidence;
446
+ /** Same bounded fingerprint check for repeat protection and cached source packs. */
447
+ private areEvidenceFilesCurrent;
425
448
  /** Count a successful depth-tool call when the latest explore was Partial. */
426
449
  private noteDepthToolUse;
427
450
  /**
@@ -474,9 +497,8 @@ export declare class ToolHandler {
474
497
  */
475
498
  private dispatchTool;
476
499
  /**
477
- * Gate symbol/graph tools while auto-init is still on the fast map or
478
- * background full index (and no nodes exist yet). Success-shaped guidance —
479
- * never isError — so agents keep using HomeGraph.
500
+ * Gate symbol/graph tools by product index state (Spec 0032).
501
+ * Success-shaped guidance — never isError — so agents keep using HomeGraph.
480
502
  */
481
503
  private maybeDeepToolPhaseGate;
482
504
  private handleSearch;
@@ -612,14 +634,24 @@ export declare class ToolHandler {
612
634
  * Avoids fat multi-body compact that hits the soft deadline (D60).
613
635
  */
614
636
  private buildMultiTypeDependencySection;
615
- /**
616
- * Main-thread fast path for inventory surveys — skips the worker queue.
617
- */
637
+ /** Exact validation for model-proposed names: a fuzzy hit is not proof. */
638
+ private isExactPlanAnchor;
639
+ /** Bind only declarations returned by this step, not input or global fuzzy hits. */
640
+ private locatedPlanBindings;
641
+ private withQueryPlanDiagnostics;
642
+ /** Select once; legacy section builders consume the same canonical query/features. */
643
+ private tryPlannedFastPath;
644
+ /** Internal execution only: no recursive MCP calls, model requests or new deadline. */
645
+ private executePlannedStep;
646
+ private executeQueryPlan;
647
+ /** Main-thread fast path for inventory surveys — skips the worker queue. */
618
648
  private tryFastPathResult;
619
649
  /** Conservative compatibility router: ambiguous mechanism queries stay broad. */
620
650
  private specializedExploreRouteForQuery;
621
651
  /** Run exactly one bounded survey family and expose the selected route. */
622
652
  private runSpecializedExploreRoute;
653
+ /** Directed file import witnesses for an explicit module-import relation. */
654
+ private renderModuleImports;
623
655
  /** Usage sites for a bare symbol bag, including non-call textual references. */
624
656
  private buildBareSymbolUsageSection;
625
657
  private trySpecializedExploreRoute;
@@ -630,9 +662,9 @@ export declare class ToolHandler {
630
662
  * Fast inventory-only explore — skips findRelevantContext for survey/caller/dependency queries.
631
663
  */
632
664
  private tryFastInventoryExplore;
633
- /**
634
- * Render a compact symbol-bounded slice of one file (lightweight mechanism path).
635
- */
665
+ /** Pack already-located ArkTS evidence before legacy windowing can cut it. */
666
+ private tryArktsEvidenceExplore;
667
+ /** Render a compact symbol-bounded slice on the legacy mechanism path. */
636
668
  private renderLightMechanismSource;
637
669
  /**
638
670
  * Lightweight mechanism explore — seed entry symbols + flow spine, skip
@@ -740,6 +772,8 @@ export declare class ToolHandler {
740
772
  * tax on small projects while earning its keep on large ones.
741
773
  */
742
774
  private handleExplore;
775
+ /** Render literal witnesses before graph-heavy sections, including unindexed UI. */
776
+ private renderLiteralSource;
743
777
  /**
744
778
  * An explore response plus the record of what it emitted (CG-17). The record
745
779
  * rides the result only as far as {@link execute}, which files it into the