homegraph 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (361) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +268 -243
  3. package/dist/arkts/ohos-api-index.d.ts +15 -0
  4. package/dist/arkts/ohos-api-index.d.ts.map +1 -0
  5. package/dist/arkts/ohos-api-index.js +190 -0
  6. package/dist/arkts/ohos-api-index.js.map +1 -0
  7. package/dist/arkts/ohos-sdk-input.d.ts +36 -0
  8. package/dist/arkts/ohos-sdk-input.d.ts.map +1 -0
  9. package/dist/arkts/ohos-sdk-input.js +214 -0
  10. package/dist/arkts/ohos-sdk-input.js.map +1 -0
  11. package/dist/bin/command-supervision.d.ts +12 -0
  12. package/dist/bin/command-supervision.d.ts.map +1 -0
  13. package/dist/bin/command-supervision.js +86 -0
  14. package/dist/bin/command-supervision.js.map +1 -0
  15. package/dist/bin/homegraph.d.ts +1 -1
  16. package/dist/bin/homegraph.js +971 -71
  17. package/dist/bin/homegraph.js.map +1 -1
  18. package/dist/db/index.d.ts +20 -0
  19. package/dist/db/index.d.ts.map +1 -1
  20. package/dist/db/index.js +39 -0
  21. package/dist/db/index.js.map +1 -1
  22. package/dist/db/migrations.d.ts +1 -1
  23. package/dist/db/migrations.d.ts.map +1 -1
  24. package/dist/db/migrations.js +58 -19
  25. package/dist/db/migrations.js.map +1 -1
  26. package/dist/db/queries.d.ts +14 -0
  27. package/dist/db/queries.d.ts.map +1 -1
  28. package/dist/db/queries.js +314 -143
  29. package/dist/db/queries.js.map +1 -1
  30. package/dist/db/schema.sql +172 -152
  31. package/dist/directory.d.ts +32 -0
  32. package/dist/directory.d.ts.map +1 -1
  33. package/dist/directory.js +88 -5
  34. package/dist/directory.js.map +1 -1
  35. package/dist/extraction/arkts-batch-worker.d.ts +2 -0
  36. package/dist/extraction/arkts-batch-worker.d.ts.map +1 -0
  37. package/dist/extraction/arkts-batch-worker.js +28 -0
  38. package/dist/extraction/arkts-batch-worker.js.map +1 -0
  39. package/dist/extraction/context.d.ts +11 -0
  40. package/dist/extraction/context.d.ts.map +1 -1
  41. package/dist/extraction/context.js +20 -0
  42. package/dist/extraction/context.js.map +1 -1
  43. package/dist/extraction/index.d.ts +16 -2
  44. package/dist/extraction/index.d.ts.map +1 -1
  45. package/dist/extraction/index.js +619 -380
  46. package/dist/extraction/index.js.map +1 -1
  47. package/dist/extraction/languages/arkts-state-decorators.d.ts +13 -0
  48. package/dist/extraction/languages/arkts-state-decorators.d.ts.map +1 -0
  49. package/dist/extraction/languages/arkts-state-decorators.js +26 -0
  50. package/dist/extraction/languages/arkts-state-decorators.js.map +1 -0
  51. package/dist/extraction/languages/arkts-viewtree.d.ts +4 -2
  52. package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -1
  53. package/dist/extraction/languages/arkts-viewtree.js +21 -6
  54. package/dist/extraction/languages/arkts-viewtree.js.map +1 -1
  55. package/dist/extraction/languages/arkts.d.ts +98 -2
  56. package/dist/extraction/languages/arkts.d.ts.map +1 -1
  57. package/dist/extraction/languages/arkts.js +1290 -61
  58. package/dist/extraction/languages/arkts.js.map +1 -1
  59. package/dist/extraction/languages/c-cpp.d.ts +56 -0
  60. package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  61. package/dist/extraction/languages/c-cpp.js +198 -1
  62. package/dist/extraction/languages/c-cpp.js.map +1 -1
  63. package/dist/extraction/languages/ohos-api-consumer.d.ts +34 -0
  64. package/dist/extraction/languages/ohos-api-consumer.d.ts.map +1 -0
  65. package/dist/extraction/languages/ohos-api-consumer.js +283 -0
  66. package/dist/extraction/languages/ohos-api-consumer.js.map +1 -0
  67. package/dist/extraction/parse-pool.d.ts +126 -0
  68. package/dist/extraction/parse-pool.d.ts.map +1 -0
  69. package/dist/extraction/parse-pool.js +319 -0
  70. package/dist/extraction/parse-pool.js.map +1 -0
  71. package/dist/extraction/tree-sitter-types.d.ts +17 -0
  72. package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  73. package/dist/extraction/tree-sitter.d.ts +21 -0
  74. package/dist/extraction/tree-sitter.d.ts.map +1 -1
  75. package/dist/extraction/tree-sitter.js +198 -27
  76. package/dist/extraction/tree-sitter.js.map +1 -1
  77. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  78. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  79. package/dist/graph/traversal.d.ts.map +1 -1
  80. package/dist/graph/traversal.js +76 -17
  81. package/dist/graph/traversal.js.map +1 -1
  82. package/dist/index.d.ts +25 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +78 -4
  85. package/dist/index.js.map +1 -1
  86. package/dist/installer/instructions-template.js +9 -9
  87. package/dist/installer/targets/shared.d.ts +5 -6
  88. package/dist/installer/targets/shared.d.ts.map +1 -1
  89. package/dist/installer/targets/shared.js +5 -6
  90. package/dist/installer/targets/shared.js.map +1 -1
  91. package/dist/mcp/daemon-paths.d.ts +30 -3
  92. package/dist/mcp/daemon-paths.d.ts.map +1 -1
  93. package/dist/mcp/daemon-paths.js +50 -10
  94. package/dist/mcp/daemon-paths.js.map +1 -1
  95. package/dist/mcp/daemon-registry.d.ts.map +1 -1
  96. package/dist/mcp/daemon-registry.js +7 -3
  97. package/dist/mcp/daemon-registry.js.map +1 -1
  98. package/dist/mcp/daemon.d.ts +48 -0
  99. package/dist/mcp/daemon.d.ts.map +1 -1
  100. package/dist/mcp/daemon.js +196 -32
  101. package/dist/mcp/daemon.js.map +1 -1
  102. package/dist/mcp/engine.d.ts +17 -0
  103. package/dist/mcp/engine.d.ts.map +1 -1
  104. package/dist/mcp/engine.js +73 -1
  105. package/dist/mcp/engine.js.map +1 -1
  106. package/dist/mcp/index.d.ts.map +1 -1
  107. package/dist/mcp/index.js +25 -43
  108. package/dist/mcp/index.js.map +1 -1
  109. package/dist/mcp/liveness-watchdog.js +16 -16
  110. package/dist/mcp/ppid-watchdog.d.ts +18 -0
  111. package/dist/mcp/ppid-watchdog.d.ts.map +1 -1
  112. package/dist/mcp/ppid-watchdog.js +37 -0
  113. package/dist/mcp/ppid-watchdog.js.map +1 -1
  114. package/dist/mcp/query-cache.d.ts +25 -0
  115. package/dist/mcp/query-cache.d.ts.map +1 -0
  116. package/dist/mcp/query-cache.js +191 -0
  117. package/dist/mcp/query-cache.js.map +1 -0
  118. package/dist/mcp/query-pool.d.ts +94 -0
  119. package/dist/mcp/query-pool.d.ts.map +1 -0
  120. package/dist/mcp/query-pool.js +297 -0
  121. package/dist/mcp/query-pool.js.map +1 -0
  122. package/dist/mcp/query-worker.d.ts +24 -0
  123. package/dist/mcp/query-worker.d.ts.map +1 -0
  124. package/dist/mcp/query-worker.js +87 -0
  125. package/dist/mcp/query-worker.js.map +1 -0
  126. package/dist/mcp/server-instructions.d.ts +5 -7
  127. package/dist/mcp/server-instructions.d.ts.map +1 -1
  128. package/dist/mcp/server-instructions.js +72 -74
  129. package/dist/mcp/server-instructions.js.map +1 -1
  130. package/dist/mcp/tools.d.ts +94 -4
  131. package/dist/mcp/tools.d.ts.map +1 -1
  132. package/dist/mcp/tools.js +877 -71
  133. package/dist/mcp/tools.js.map +1 -1
  134. package/dist/project-config.d.ts +20 -0
  135. package/dist/project-config.d.ts.map +1 -1
  136. package/dist/project-config.js +42 -2
  137. package/dist/project-config.js.map +1 -1
  138. package/dist/reasoning/login.js +1 -1
  139. package/dist/reasoning/login.js.map +1 -1
  140. package/dist/reasoning/reasoner.js +32 -32
  141. package/dist/resolution/c-fnptr-synthesizer.d.ts +0 -28
  142. package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  143. package/dist/resolution/c-fnptr-synthesizer.js +765 -79
  144. package/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  145. package/dist/resolution/callback-synthesizer.d.ts +1 -1
  146. package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  147. package/dist/resolution/callback-synthesizer.js +72 -11
  148. package/dist/resolution/callback-synthesizer.js.map +1 -1
  149. package/dist/resolution/cooperative-yield.d.ts +32 -0
  150. package/dist/resolution/cooperative-yield.d.ts.map +1 -0
  151. package/dist/resolution/cooperative-yield.js +42 -0
  152. package/dist/resolution/cooperative-yield.js.map +1 -0
  153. package/dist/resolution/index.d.ts +11 -2
  154. package/dist/resolution/index.d.ts.map +1 -1
  155. package/dist/resolution/index.js +72 -4
  156. package/dist/resolution/index.js.map +1 -1
  157. package/dist/resolution/name-matcher.d.ts +22 -0
  158. package/dist/resolution/name-matcher.d.ts.map +1 -1
  159. package/dist/resolution/name-matcher.js +317 -20
  160. package/dist/resolution/name-matcher.js.map +1 -1
  161. package/dist/spec/config.d.ts +39 -0
  162. package/dist/spec/config.d.ts.map +1 -0
  163. package/dist/spec/config.js +304 -0
  164. package/dist/spec/config.js.map +1 -0
  165. package/dist/spec/db/commit-node.d.ts +23 -0
  166. package/dist/spec/db/commit-node.d.ts.map +1 -0
  167. package/dist/spec/db/commit-node.js +62 -0
  168. package/dist/spec/db/commit-node.js.map +1 -0
  169. package/dist/spec/db/fragment-node.d.ts +24 -0
  170. package/dist/spec/db/fragment-node.d.ts.map +1 -0
  171. package/dist/spec/db/fragment-node.js +128 -0
  172. package/dist/spec/db/fragment-node.js.map +1 -0
  173. package/dist/spec/db/fts.d.ts +74 -0
  174. package/dist/spec/db/fts.d.ts.map +1 -0
  175. package/dist/spec/db/fts.js +324 -0
  176. package/dist/spec/db/fts.js.map +1 -0
  177. package/dist/spec/db/index.d.ts +13 -0
  178. package/dist/spec/db/index.d.ts.map +1 -0
  179. package/dist/spec/db/index.js +50 -0
  180. package/dist/spec/db/index.js.map +1 -0
  181. package/dist/spec/db/relations.d.ts +55 -0
  182. package/dist/spec/db/relations.d.ts.map +1 -0
  183. package/dist/spec/db/relations.js +158 -0
  184. package/dist/spec/db/relations.js.map +1 -0
  185. package/dist/spec/db/schema.d.ts +33 -0
  186. package/dist/spec/db/schema.d.ts.map +1 -0
  187. package/dist/spec/db/schema.js +119 -0
  188. package/dist/spec/db/schema.js.map +1 -0
  189. package/dist/spec/db/schema.sql +117 -0
  190. package/dist/spec/db/spec-node.d.ts +41 -0
  191. package/dist/spec/db/spec-node.d.ts.map +1 -0
  192. package/dist/spec/db/spec-node.js +114 -0
  193. package/dist/spec/db/spec-node.js.map +1 -0
  194. package/dist/spec/evolve/impact-locator.d.ts +13 -0
  195. package/dist/spec/evolve/impact-locator.d.ts.map +1 -0
  196. package/dist/spec/evolve/impact-locator.js +25 -0
  197. package/dist/spec/evolve/impact-locator.js.map +1 -0
  198. package/dist/spec/evolve/llm-client.d.ts +50 -0
  199. package/dist/spec/evolve/llm-client.d.ts.map +1 -0
  200. package/dist/spec/evolve/llm-client.js +176 -0
  201. package/dist/spec/evolve/llm-client.js.map +1 -0
  202. package/dist/spec/evolve/logic-checker.d.ts +12 -0
  203. package/dist/spec/evolve/logic-checker.d.ts.map +1 -0
  204. package/dist/spec/evolve/logic-checker.js +24 -0
  205. package/dist/spec/evolve/logic-checker.js.map +1 -0
  206. package/dist/spec/evolve/pipeline.d.ts +42 -0
  207. package/dist/spec/evolve/pipeline.d.ts.map +1 -0
  208. package/dist/spec/evolve/pipeline.js +567 -0
  209. package/dist/spec/evolve/pipeline.js.map +1 -0
  210. package/dist/spec/evolve/spec-rewriter.d.ts +42 -0
  211. package/dist/spec/evolve/spec-rewriter.d.ts.map +1 -0
  212. package/dist/spec/evolve/spec-rewriter.js +230 -0
  213. package/dist/spec/evolve/spec-rewriter.js.map +1 -0
  214. package/dist/spec/graph/queries.d.ts +155 -0
  215. package/dist/spec/graph/queries.d.ts.map +1 -0
  216. package/dist/spec/graph/queries.js +440 -0
  217. package/dist/spec/graph/queries.js.map +1 -0
  218. package/dist/spec/llm/client.d.ts +29 -0
  219. package/dist/spec/llm/client.d.ts.map +1 -0
  220. package/dist/spec/llm/client.js +123 -0
  221. package/dist/spec/llm/client.js.map +1 -0
  222. package/dist/spec/llm/index.d.ts +3 -0
  223. package/dist/spec/llm/index.d.ts.map +1 -0
  224. package/dist/spec/llm/index.js +11 -0
  225. package/dist/spec/llm/index.js.map +1 -0
  226. package/dist/spec/llm/prompts.d.ts +13 -0
  227. package/dist/spec/llm/prompts.d.ts.map +1 -0
  228. package/dist/spec/llm/prompts.js +75 -0
  229. package/dist/spec/llm/prompts.js.map +1 -0
  230. package/dist/spec/mining/diff-parser.d.ts +33 -0
  231. package/dist/spec/mining/diff-parser.d.ts.map +1 -0
  232. package/dist/spec/mining/diff-parser.js +166 -0
  233. package/dist/spec/mining/diff-parser.js.map +1 -0
  234. package/dist/spec/mining/git-scanner.d.ts +103 -0
  235. package/dist/spec/mining/git-scanner.d.ts.map +1 -0
  236. package/dist/spec/mining/git-scanner.js +307 -0
  237. package/dist/spec/mining/git-scanner.js.map +1 -0
  238. package/dist/spec/mining/pipeline.d.ts +53 -0
  239. package/dist/spec/mining/pipeline.d.ts.map +1 -0
  240. package/dist/spec/mining/pipeline.js +178 -0
  241. package/dist/spec/mining/pipeline.js.map +1 -0
  242. package/dist/spec/mining/scope-resolver.d.ts +45 -0
  243. package/dist/spec/mining/scope-resolver.d.ts.map +1 -0
  244. package/dist/spec/mining/scope-resolver.js +103 -0
  245. package/dist/spec/mining/scope-resolver.js.map +1 -0
  246. package/dist/spec/mining/spec-extractor.d.ts +69 -0
  247. package/dist/spec/mining/spec-extractor.d.ts.map +1 -0
  248. package/dist/spec/mining/spec-extractor.js +369 -0
  249. package/dist/spec/mining/spec-extractor.js.map +1 -0
  250. package/dist/spec/types.d.ts +149 -0
  251. package/dist/spec/types.d.ts.map +1 -0
  252. package/dist/spec/types.js +15 -0
  253. package/dist/spec/types.js.map +1 -0
  254. package/dist/spec/utils.d.ts +167 -0
  255. package/dist/spec/utils.d.ts.map +1 -0
  256. package/dist/spec/utils.js +463 -0
  257. package/dist/spec/utils.js.map +1 -0
  258. package/dist/sync/worktree.d.ts +9 -0
  259. package/dist/sync/worktree.d.ts.map +1 -1
  260. package/dist/sync/worktree.js +40 -0
  261. package/dist/sync/worktree.js.map +1 -1
  262. package/dist/types.d.ts +6 -1
  263. package/dist/types.d.ts.map +1 -1
  264. package/dist/ui/shimmer-progress.d.ts +2 -0
  265. package/dist/ui/shimmer-progress.d.ts.map +1 -1
  266. package/dist/ui/shimmer-progress.js +19 -2
  267. package/dist/ui/shimmer-progress.js.map +1 -1
  268. package/dist/upgrade/index.js +1 -1
  269. package/dist/upgrade/index.js.map +1 -1
  270. package/package.json +58 -57
  271. package/scripts/add-lang/bench.sh +60 -60
  272. package/scripts/add-lang/check-grammar.mjs +75 -75
  273. package/scripts/add-lang/dump-ast.mjs +103 -103
  274. package/scripts/add-lang/verify-extraction.mjs +70 -70
  275. package/scripts/agent-eval/ab-adoption.sh +91 -91
  276. package/scripts/agent-eval/ab-hook.sh +86 -86
  277. package/scripts/agent-eval/ab-impl.sh +78 -78
  278. package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -102
  279. package/scripts/agent-eval/ab-sufficiency.sh +78 -78
  280. package/scripts/agent-eval/arms-F.sh +21 -21
  281. package/scripts/agent-eval/arms-matrix.sh +37 -37
  282. package/scripts/agent-eval/audit.sh +68 -68
  283. package/scripts/agent-eval/bench-readme.sh +28 -28
  284. package/scripts/agent-eval/bench-why-repo.sh +22 -22
  285. package/scripts/agent-eval/block-read-hook.sh +19 -19
  286. package/scripts/agent-eval/hook-settings.json +15 -15
  287. package/scripts/agent-eval/itrun.sh +120 -120
  288. package/scripts/agent-eval/offload-eval-3arm.sh +72 -72
  289. package/scripts/agent-eval/offload-eval-cost.mjs +133 -133
  290. package/scripts/agent-eval/offload-eval-effort.mjs +108 -108
  291. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -25
  292. package/scripts/agent-eval/offload-eval-frontload.sh +47 -47
  293. package/scripts/agent-eval/offload-eval-ground-truth.json +18 -18
  294. package/scripts/agent-eval/offload-eval-hook.mjs +84 -84
  295. package/scripts/agent-eval/offload-eval-judge.mjs +103 -103
  296. package/scripts/agent-eval/offload-eval-matrix.sh +20 -20
  297. package/scripts/agent-eval/offload-eval-metrics.mjs +94 -94
  298. package/scripts/agent-eval/offload-eval-refs1.sh +50 -50
  299. package/scripts/agent-eval/offload-eval-setup.sh +24 -24
  300. package/scripts/agent-eval/offload-eval-styles.sh +71 -71
  301. package/scripts/agent-eval/offload-eval-summarize.mjs +68 -68
  302. package/scripts/agent-eval/offload-eval.md +76 -76
  303. package/scripts/agent-eval/parse-arms.mjs +116 -116
  304. package/scripts/agent-eval/parse-bench-readme.mjs +84 -84
  305. package/scripts/agent-eval/parse-run.mjs +45 -45
  306. package/scripts/agent-eval/parse-session.mjs +93 -93
  307. package/scripts/agent-eval/probe-context.mjs +21 -21
  308. package/scripts/agent-eval/probe-explore.mjs +40 -40
  309. package/scripts/agent-eval/probe-node.mjs +20 -20
  310. package/scripts/agent-eval/probe-sweep.mjs +119 -119
  311. package/scripts/agent-eval/probe-trace.mjs +20 -20
  312. package/scripts/agent-eval/redirect-read-hook.sh +38 -38
  313. package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
  314. package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
  315. package/scripts/agent-eval/run-agent.sh +34 -34
  316. package/scripts/agent-eval/run-all.sh +69 -69
  317. package/scripts/agent-eval/run-arms.sh +56 -56
  318. package/scripts/agent-eval/seq-matrix.mjs +137 -137
  319. package/scripts/build-bundle.sh +118 -118
  320. package/scripts/exp_boundary_eval/README.md +247 -0
  321. package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
  322. package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
  323. package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-310.pyc +0 -0
  324. package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
  325. package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
  326. package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
  327. package/scripts/exp_boundary_eval/_test_mcp_chain.py +78 -0
  328. package/scripts/exp_boundary_eval/_test_stdin.py +8 -0
  329. package/scripts/exp_boundary_eval/_utils.py +1116 -0
  330. package/scripts/exp_boundary_eval/analyze.py +1313 -0
  331. package/scripts/exp_boundary_eval/data/agents.json +109 -0
  332. package/scripts/exp_boundary_eval/data/experiments.json +140 -0
  333. package/scripts/exp_boundary_eval/deveco_arm.py +519 -0
  334. package/scripts/exp_boundary_eval/run_all.py +378 -0
  335. package/scripts/exp_boundary_eval/run_one.py +165 -0
  336. package/scripts/exp_boundary_eval/run_session.py +158 -0
  337. package/scripts/exp_boundary_eval/setup.py +120 -0
  338. package/scripts/exp_boundary_eval/win_mcp_launcher.py +73 -0
  339. package/scripts/exp_boundary_eval/win_mcp_stdio_wrap.js +36 -0
  340. package/scripts/exp_boundary_eval/win_node_launcher.py +24 -0
  341. package/scripts/extract-release-notes.mjs +130 -130
  342. package/scripts/local-install.sh +41 -41
  343. package/scripts/npm-sdk.js +75 -75
  344. package/scripts/npm-shim.js +268 -246
  345. package/scripts/ohos-sdk-publish.mjs +133 -0
  346. package/scripts/pack-npm.sh +119 -119
  347. package/scripts/prepare-release.mjs +270 -270
  348. package/scripts/qa_eval/README.md +407 -404
  349. package/scripts/qa_eval/_test_deveco_probe.py +41 -41
  350. package/scripts/qa_eval/agent_runner.py +526 -526
  351. package/scripts/qa_eval/data/.gitignore +4 -4
  352. package/scripts/qa_eval/data/test-set.jsonl +2 -22
  353. package/scripts/qa_eval/eval_metrics.py +274 -233
  354. package/scripts/qa_eval/external_agent.py +976 -671
  355. package/scripts/qa_eval/llm_config.py +92 -92
  356. package/scripts/qa_eval/memory_monitor.py +132 -132
  357. package/scripts/qa_eval/my_answer_accuracy.py +187 -187
  358. package/scripts/qa_eval/requirements.txt +2 -2
  359. package/scripts/qa_eval/run_pipeline.py +804 -711
  360. package/scripts/qa_eval/stats_efficiency.py +279 -279
  361. package/scripts/qa_eval/stats_scores.py +207 -207
@@ -1,118 +1,118 @@
1
- #!/usr/bin/env bash
2
- #
3
- # Build a self-contained HomeGraph bundle: an official Node runtime + the
4
- # compiled app + its production deps, so HomeGraph runs with NO system Node and
5
- # NO native build — node:sqlite is built into the bundled Node. One archive per
6
- # platform.
7
- #
8
- # Because dropping better-sqlite3 left zero native addons, the recipe is pure
9
- # file-packaging (download the target's Node, copy the app, archive) — so any
10
- # platform's bundle can be built on any OS. No cross-compile, no native runners.
11
- #
12
- # Usage:
13
- # scripts/build-bundle.sh <target> [node-version]
14
- # target: darwin-arm64 | darwin-x64 | linux-x64 | linux-arm64
15
- # | win32-x64 | win32-arm64
16
- # node-version: e.g. v24.16.0 (default below; pin for reproducible builds)
17
- #
18
- # Output:
19
- # unix: release/homegraph-<target>.tar.gz (launcher: bin/homegraph)
20
- # windows: release/homegraph-<target>.zip (launcher: bin/homegraph.cmd)
21
- set -euo pipefail
22
-
23
- TARGET="${1:?usage: build-bundle.sh <target> [node-version]}"
24
- NODE_VERSION="${2:-v24.16.0}"
25
-
26
- ROOT="$(cd "$(dirname "$0")/.." && pwd)"
27
- OUT="$ROOT/release"
28
- WORK="$(mktemp -d)"
29
- trap 'rm -rf "$WORK"' EXIT
30
-
31
- ARCH="${TARGET##*-}" # x64 | arm64
32
- OSFAM="${TARGET%-*}" # darwin | linux | win32
33
-
34
- echo "[bundle] target=${TARGET} node=${NODE_VERSION}"
35
-
36
- # 1. Download + extract the official Node runtime for the target platform.
37
- if [ "$OSFAM" = "win32" ]; then
38
- NODE_DIST="node-${NODE_VERSION}-win-${ARCH}"
39
- NODE_URL="https://nodejs.org/dist/${NODE_VERSION}/${NODE_DIST}.zip"
40
- echo "[bundle] downloading ${NODE_URL}"
41
- curl -fsSL "$NODE_URL" -o "$WORK/node.zip"
42
- if command -v unzip >/dev/null 2>&1; then
43
- unzip -q "$WORK/node.zip" -d "$WORK"
44
- else
45
- tar -xf "$WORK/node.zip" -C "$WORK" # bsdtar can read zip
46
- fi
47
- NODE_BIN="$WORK/${NODE_DIST}/node.exe"
48
- else
49
- NODE_DIST="node-${NODE_VERSION}-${TARGET}"
50
- NODE_URL="https://nodejs.org/dist/${NODE_VERSION}/${NODE_DIST}.tar.gz"
51
- echo "[bundle] downloading ${NODE_URL}"
52
- curl -fsSL "$NODE_URL" -o "$WORK/node.tar.gz"
53
- tar -xzf "$WORK/node.tar.gz" -C "$WORK"
54
- NODE_BIN="$WORK/${NODE_DIST}/bin/node"
55
- fi
56
- [ -f "$NODE_BIN" ] || { echo "[bundle] error: node binary not found ($NODE_BIN)" >&2; exit 1; }
57
-
58
- # 2. Build the app (compiled JS + copied wasm/schema assets).
59
- echo "[bundle] building app"
60
- ( cd "$ROOT" && npm run build >/dev/null )
61
-
62
- # 3. Stage: app + production-only deps (pure JS/wasm → portable across platforms).
63
- STAGE="$WORK/homegraph-${TARGET}"
64
- mkdir -p "$STAGE/lib" "$STAGE/bin"
65
- cp -R "$ROOT/dist" "$STAGE/lib/dist"
66
- cp "$ROOT/package.json" "$ROOT/package-lock.json" "$STAGE/lib/"
67
- echo "[bundle] installing production dependencies"
68
- ( cd "$STAGE/lib" && npm ci --omit=dev --ignore-scripts >/dev/null 2>&1 )
69
- rm -f "$STAGE/lib/package-lock.json"
70
-
71
- # 4. Vendored Node + launcher (the launcher uses the bundled Node by relative
72
- # path, so no system Node is ever needed).
73
- #
74
- # `--liftoff-only`: keep tree-sitter's large WASM grammars on V8's Liftoff
75
- # baseline compiler so they never reach the turboshaft optimizing tier, whose
76
- # per-compilation Zone arena OOMs the whole process (`Fatal process out of
77
- # memory: Zone`) on Node >= 22 — even with tens of GB free. The flag is read at
78
- # V8 engine init so it must be on node's command line; the parse worker inherits
79
- # it. See issues #293/#298 and src/extraction/wasm-runtime-flags.ts. (The CLI
80
- # also self-relaunches with this flag when launched without it, so non-bundled
81
- # runs are covered too; passing it here avoids that extra spawn.)
82
- if [ "$OSFAM" = "win32" ]; then
83
- cp "$NODE_BIN" "$STAGE/node.exe"
84
- printf '@"%%~dp0..\\node.exe" --liftoff-only "%%~dp0..\\lib\\dist\\bin\\homegraph.js" %%*\r\n' \
85
- > "$STAGE/bin/homegraph.cmd"
86
- else
87
- cp "$NODE_BIN" "$STAGE/node"
88
- cat > "$STAGE/bin/homegraph" <<'LAUNCH'
89
- #!/bin/sh
90
- # Resolve symlinks (e.g. the ~/.local/bin/homegraph link install.sh creates) so
91
- # we find the real bundle dir, not the symlink's location.
92
- SELF="$0"
93
- while [ -L "$SELF" ]; do
94
- target="$(readlink "$SELF")"
95
- case "$target" in
96
- /*) SELF="$target" ;;
97
- *) SELF="$(dirname "$SELF")/$target" ;;
98
- esac
99
- done
100
- DIR="$(cd "$(dirname "$SELF")/.." && pwd)"
101
- # --liftoff-only: avoid the V8 turboshaft WASM Zone OOM (issues #293/#298).
102
- exec "$DIR/node" --liftoff-only "$DIR/lib/dist/bin/homegraph.js" "$@"
103
- LAUNCH
104
- chmod +x "$STAGE/bin/homegraph"
105
- fi
106
-
107
- # 5. Archive (.zip for Windows, .tar.gz otherwise).
108
- mkdir -p "$OUT"
109
- if [ "$OSFAM" = "win32" ]; then
110
- ARCHIVE="$OUT/homegraph-${TARGET}.zip"
111
- rm -f "$ARCHIVE"
112
- ( cd "$WORK" && zip -rqX "$ARCHIVE" "homegraph-${TARGET}" )
113
- else
114
- ARCHIVE="$OUT/homegraph-${TARGET}.tar.gz"
115
- # --no-xattrs: don't embed macOS xattrs that make GNU tar warn on Linux.
116
- tar --no-xattrs -czf "$ARCHIVE" -C "$WORK" "homegraph-${TARGET}"
117
- fi
118
- echo "[bundle] wrote ${ARCHIVE} ($(du -h "$ARCHIVE" | cut -f1))"
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Build a self-contained HomeGraph bundle: an official Node runtime + the
4
+ # compiled app + its production deps, so HomeGraph runs with NO system Node and
5
+ # NO native build — node:sqlite is built into the bundled Node. One archive per
6
+ # platform.
7
+ #
8
+ # Because dropping better-sqlite3 left zero native addons, the recipe is pure
9
+ # file-packaging (download the target's Node, copy the app, archive) — so any
10
+ # platform's bundle can be built on any OS. No cross-compile, no native runners.
11
+ #
12
+ # Usage:
13
+ # scripts/build-bundle.sh <target> [node-version]
14
+ # target: darwin-arm64 | darwin-x64 | linux-x64 | linux-arm64
15
+ # | win32-x64 | win32-arm64
16
+ # node-version: e.g. v24.16.0 (default below; pin for reproducible builds)
17
+ #
18
+ # Output:
19
+ # unix: release/homegraph-<target>.tar.gz (launcher: bin/homegraph)
20
+ # windows: release/homegraph-<target>.zip (launcher: bin/homegraph.cmd)
21
+ set -euo pipefail
22
+
23
+ TARGET="${1:?usage: build-bundle.sh <target> [node-version]}"
24
+ NODE_VERSION="${2:-v24.16.0}"
25
+
26
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
27
+ OUT="$ROOT/release"
28
+ WORK="$(mktemp -d)"
29
+ trap 'rm -rf "$WORK"' EXIT
30
+
31
+ ARCH="${TARGET##*-}" # x64 | arm64
32
+ OSFAM="${TARGET%-*}" # darwin | linux | win32
33
+
34
+ echo "[bundle] target=${TARGET} node=${NODE_VERSION}"
35
+
36
+ # 1. Download + extract the official Node runtime for the target platform.
37
+ if [ "$OSFAM" = "win32" ]; then
38
+ NODE_DIST="node-${NODE_VERSION}-win-${ARCH}"
39
+ NODE_URL="https://nodejs.org/dist/${NODE_VERSION}/${NODE_DIST}.zip"
40
+ echo "[bundle] downloading ${NODE_URL}"
41
+ curl -fsSL "$NODE_URL" -o "$WORK/node.zip"
42
+ if command -v unzip >/dev/null 2>&1; then
43
+ unzip -q "$WORK/node.zip" -d "$WORK"
44
+ else
45
+ tar -xf "$WORK/node.zip" -C "$WORK" # bsdtar can read zip
46
+ fi
47
+ NODE_BIN="$WORK/${NODE_DIST}/node.exe"
48
+ else
49
+ NODE_DIST="node-${NODE_VERSION}-${TARGET}"
50
+ NODE_URL="https://nodejs.org/dist/${NODE_VERSION}/${NODE_DIST}.tar.gz"
51
+ echo "[bundle] downloading ${NODE_URL}"
52
+ curl -fsSL "$NODE_URL" -o "$WORK/node.tar.gz"
53
+ tar -xzf "$WORK/node.tar.gz" -C "$WORK"
54
+ NODE_BIN="$WORK/${NODE_DIST}/bin/node"
55
+ fi
56
+ [ -f "$NODE_BIN" ] || { echo "[bundle] error: node binary not found ($NODE_BIN)" >&2; exit 1; }
57
+
58
+ # 2. Build the app (compiled JS + copied wasm/schema assets).
59
+ echo "[bundle] building app"
60
+ ( cd "$ROOT" && npm run build >/dev/null )
61
+
62
+ # 3. Stage: app + production-only deps (pure JS/wasm → portable across platforms).
63
+ STAGE="$WORK/homegraph-${TARGET}"
64
+ mkdir -p "$STAGE/lib" "$STAGE/bin"
65
+ cp -R "$ROOT/dist" "$STAGE/lib/dist"
66
+ cp "$ROOT/package.json" "$ROOT/package-lock.json" "$STAGE/lib/"
67
+ echo "[bundle] installing production dependencies"
68
+ ( cd "$STAGE/lib" && npm ci --omit=dev --ignore-scripts >/dev/null 2>&1 )
69
+ rm -f "$STAGE/lib/package-lock.json"
70
+
71
+ # 4. Vendored Node + launcher (the launcher uses the bundled Node by relative
72
+ # path, so no system Node is ever needed).
73
+ #
74
+ # `--liftoff-only`: keep tree-sitter's large WASM grammars on V8's Liftoff
75
+ # baseline compiler so they never reach the turboshaft optimizing tier, whose
76
+ # per-compilation Zone arena OOMs the whole process (`Fatal process out of
77
+ # memory: Zone`) on Node >= 22 — even with tens of GB free. The flag is read at
78
+ # V8 engine init so it must be on node's command line; the parse worker inherits
79
+ # it. See issues #293/#298 and src/extraction/wasm-runtime-flags.ts. (The CLI
80
+ # also self-relaunches with this flag when launched without it, so non-bundled
81
+ # runs are covered too; passing it here avoids that extra spawn.)
82
+ if [ "$OSFAM" = "win32" ]; then
83
+ cp "$NODE_BIN" "$STAGE/node.exe"
84
+ printf '@"%%~dp0..\\node.exe" --liftoff-only "%%~dp0..\\lib\\dist\\bin\\homegraph.js" %%*\r\n' \
85
+ > "$STAGE/bin/homegraph.cmd"
86
+ else
87
+ cp "$NODE_BIN" "$STAGE/node"
88
+ cat > "$STAGE/bin/homegraph" <<'LAUNCH'
89
+ #!/bin/sh
90
+ # Resolve symlinks (e.g. the ~/.local/bin/homegraph link install.sh creates) so
91
+ # we find the real bundle dir, not the symlink's location.
92
+ SELF="$0"
93
+ while [ -L "$SELF" ]; do
94
+ target="$(readlink "$SELF")"
95
+ case "$target" in
96
+ /*) SELF="$target" ;;
97
+ *) SELF="$(dirname "$SELF")/$target" ;;
98
+ esac
99
+ done
100
+ DIR="$(cd "$(dirname "$SELF")/.." && pwd)"
101
+ # --liftoff-only: avoid the V8 turboshaft WASM Zone OOM (issues #293/#298).
102
+ exec "$DIR/node" --liftoff-only "$DIR/lib/dist/bin/homegraph.js" "$@"
103
+ LAUNCH
104
+ chmod +x "$STAGE/bin/homegraph"
105
+ fi
106
+
107
+ # 5. Archive (.zip for Windows, .tar.gz otherwise).
108
+ mkdir -p "$OUT"
109
+ if [ "$OSFAM" = "win32" ]; then
110
+ ARCHIVE="$OUT/homegraph-${TARGET}.zip"
111
+ rm -f "$ARCHIVE"
112
+ ( cd "$WORK" && zip -rqX "$ARCHIVE" "homegraph-${TARGET}" )
113
+ else
114
+ ARCHIVE="$OUT/homegraph-${TARGET}.tar.gz"
115
+ # --no-xattrs: don't embed macOS xattrs that make GNU tar warn on Linux.
116
+ tar --no-xattrs -czf "$ARCHIVE" -C "$WORK" "homegraph-${TARGET}"
117
+ fi
118
+ echo "[bundle] wrote ${ARCHIVE} ($(du -h "$ARCHIVE" | cut -f1))"
@@ -0,0 +1,247 @@
1
+ # 边界评测(exp_boundary_eval)
2
+
3
+ 在 OpenHarmony **Photos** 仓库上,对比 Agent **不带 HomeGraph(baseline)** 与 **带 HomeGraph MCP(homegraph)** 的探索行为:档位切换、跨层穿透、幻觉/遗漏风险等。
4
+
5
+ 跑完实验后脚本会**自动生成**各组分析报告和 A/B 对比报告(Markdown),路径会在控制台打印。
6
+
7
+ ---
8
+
9
+ ## 快速开始
10
+
11
+ ```powershell
12
+ cd D:\code\homegraph
13
+ npm run build
14
+
15
+ cd D:\code\homegraph\scripts\exp_boundary_eval
16
+ # 一条命令:先 index/校验 → homegraph 组 → baseline 组 → 自动出报告
17
+ # 不要另开终端同时跑 node … index,会与 index 抢 .homegraph 锁
18
+ python run_all.py --both-arms --agent deveco --repo-path D:\code\homegraph\scripts\exp_boundary_eval\data\clone
19
+ ```
20
+
21
+ **前置条件**
22
+
23
+ | 项 | 说明 |
24
+ |----|------|
25
+ | Python | 3.8+(Windows 建议用本机 Python,不要用 WSL 跑 DevEco) |
26
+ | Agent CLI | `deveco` / `claude` 等已在 PATH;DevEco 可用 `DEVECO_BIN` 指定路径 |
27
+ | git | 用于 clone / 重置测试仓库 |
28
+ | homegraph 组 | 在仓库根目录先执行 `npm run build` |
29
+
30
+ **DevEco 模型**:无需在本脚本里配置;使用 DevEco Studio / CLI 里已配好的默认模型即可。
31
+
32
+ ---
33
+
34
+ ## 目录与文件说明
35
+
36
+ ```
37
+ scripts/exp_boundary_eval/
38
+ ├── README.md ← 本文件
39
+ ├── run_all.py ← 主入口:批量跑实验,跑完自动 analyze + 对比报告
40
+ ├── run_one.py ← 单个 one-shot 实验
41
+ ├── run_session.py ← 多轮会话实验(实验 5)
42
+ ├── analyze.py ← 分析脚本(也可单独对历史结果目录运行)
43
+ ├── setup.py ← 每次实验前:重置仓库、清 CLAUDE.md、生成 session
44
+ ├── _utils.py ← 公共工具:Agent 注册、输出解析、目录创建
45
+
46
+ ├── data/ ← 配置与共用 clone(clone/ 在 .gitignore)
47
+ │ ├── experiments.json ← 实验定义:id、标题、prompt、max_turns
48
+ │ ├── agents.json ← Agent CLI 定义:binary、flags、parser
49
+ │ └── clone/ ← A/B 共用 git clone(run_all --both-arms 自动维护)
50
+
51
+ ├── output/ ← 实验产物与报告(gitignore)
52
+ │ ├── baseline/{agent}/{时间戳}/ ← 无 HomeGraph 组
53
+ │ │ ├── run_manifest.json
54
+ │ │ ├── analysis_report.md ← 单组分析报告(跑完自动生成)
55
+ │ │ └── {实验ID}/
56
+ │ │ ├── prompt.txt ← 发给 Agent 的 prompt
57
+ │ │ ├── stream_output.jsonl ← Agent 原始 JSON 流
58
+ │ │ ├── raw_output.txt ← 解析出的文本回复
59
+ │ │ └── results.json ← 汇总指标(耗时、工具、Token…)
60
+ │ ├── homegraph/{agent}/{时间戳}/ ← 有 HomeGraph 组(结构同上)
61
+ │ └── compare/{agent}/{时间戳}/ ← A/B 对比报告(--both-arms 跑完自动生成)
62
+ │ ├── ab_compare_report.md
63
+ │ └── compare_manifest.json ← 指向两组原始目录与报告
64
+
65
+ └── log/ ← 运行日志与 state(gitignore)
66
+ └── {组别}/{agent}/{时间戳}/
67
+ ├── run.log
68
+ ├── run_manifest.json
69
+ └── {实验ID}/state.json
70
+ ```
71
+
72
+ ### 配置文件
73
+
74
+ **`data/experiments.json`** — 每个实验一条记录:
75
+
76
+ - `id`:如 `1-1`、`2`、`5`
77
+ - `type`:`oneshot`(默认)或 `session`(实验 5)
78
+ - `title` / `prompt`:任务描述
79
+ - `max_turns`:回合上限(DevEco 无此 flag 时脚本会忽略)
80
+
81
+ **`data/agents.json`** — 支持的 Agent:
82
+
83
+ - `deveco`、`claude`、`cursor`、`codex`、`opencode`、`generic`、`text`
84
+ - 字段 `binary`、`flags`、`parser`、`missing`(不支持的 CLI 参数)
85
+
86
+ ---
87
+
88
+ ## 常用命令
89
+
90
+ ### A/B 完整评测(推荐)
91
+
92
+ ```powershell
93
+ # 默认跑 1-1、1-2、1-3;自动 clone;跑完出 baseline 报告 + homegraph 报告 + 对比报告
94
+ python run_all.py --both-arms --agent deveco
95
+
96
+ # 使用本地已有 checkout(跳过 clone)
97
+ python run_all.py --both-arms --agent deveco --repo-path D:\path\to\applications_photos
98
+ ```
99
+
100
+ ### 只跑一组
101
+
102
+ ```powershell
103
+ python run_all.py --agent deveco --arm baseline
104
+ python run_all.py --agent deveco --arm homegraph
105
+ ```
106
+
107
+ ### 跑全部 11 项实验
108
+
109
+ ```powershell
110
+ python run_all.py --both-arms --agent deveco 1-1 1-2 1-3 2 3-1 3-2 3-3 4-1 4-2 4-3 5
111
+ ```
112
+
113
+ ### 单个实验(需先设仓库路径)
114
+
115
+ ```powershell
116
+ $env:REPO_PATH = "D:\code\homegraph\scripts\exp_boundary_eval\data\clone"
117
+ python run_one.py 1-1 --agent deveco
118
+ python run_session.py 5 --agent deveco
119
+ ```
120
+
121
+ ### 手动分析(补跑或只看历史结果)
122
+
123
+ ```powershell
124
+ python analyze.py output\baseline\deveco\20260627_110832
125
+ python analyze.py output\homegraph\deveco\20260627_111331
126
+ ```
127
+
128
+ 对比报告仅在 `run_all.py --both-arms` 跑完时自动生成;也可在 Python 里调用 `analyze.compare_runs(baseline_dir, homegraph_dir, ...)`。
129
+
130
+ ---
131
+
132
+ ## 跑完后的报告
133
+
134
+ `run_all.py` 结束时控制台会打印类似:
135
+
136
+ ```
137
+ ==== 报告已生成 ====
138
+ Baseline 报告: ...\output\baseline\deveco\...\analysis_report.md
139
+ HomeGraph 报告: ...\output\homegraph\deveco\...\analysis_report.md
140
+ A/B 对比报告 : ...\output\compare\deveco\...\ab_compare_report.md
141
+ ```
142
+
143
+ | 报告 | 内容 |
144
+ |------|------|
145
+ | `analysis_report.md` | 单组:各实验表格、7 维度评分、档位/幻觉/跨层等解读 |
146
+ | `ab_compare_report.md` | 两组:墙钟耗时、工具调用、Token、逐实验对比、评分对比 |
147
+
148
+ **对比指标**(来自 `results.json` / stream 解析):
149
+
150
+ | 指标 | 字段 |
151
+ |------|------|
152
+ | 单实验耗时 | `duration_s` |
153
+ | 工具调用 | `tool_calls` |
154
+ | Token | `input_tokens`、`output_tokens` |
155
+ | 读取/编辑文件 | `files_read`、`files_edited` |
156
+ | Grep/Glob | `tool_names` 中的 search 类工具 |
157
+
158
+ **内存**:当前未采集进程内存;对比报告中该列为「未采集」。需要时可自行加外部 profiling。
159
+
160
+ ---
161
+
162
+ ## 默认实验(1-1 / 1-2 / 1-3)
163
+
164
+ 档位切换边界探测:信息缺口从小到大,观察 Agent 是否从「快速检索」升级到「深度探索」。
165
+
166
+ ---
167
+
168
+ ## 常见问题
169
+
170
+ ### WSL 里 `deveco --version` 失败
171
+
172
+ DevEco Code **没有 Linux 版**。请在 **Windows** 或 **macOS** 上跑本评测。
173
+
174
+ ```powershell
175
+ npm install -g @deveco/deveco-code
176
+ deveco --version
177
+ cd D:\code\homegraph\scripts\exp_boundary_eval
178
+ python run_all.py --both-arms --agent deveco
179
+ ```
180
+
181
+ WSL 内路径仅作诊断,不能真正跑 DevEco:
182
+
183
+ ```bash
184
+ export DEVECO_BIN=/mnt/c/Users/.../AppData/Roaming/npm/deveco
185
+ ```
186
+
187
+ ### homegraph 组 indexing 失败
188
+
189
+ 在 homegraph 仓库根目录执行:
190
+
191
+ ```powershell
192
+ cd D:\code\homegraph
193
+ npm run build
194
+ ```
195
+
196
+ ### Python 3.8 on Windows 编码错误
197
+
198
+ 脚本已对 JSON 读写和终端输出做 UTF-8 处理;若仍乱码,可在 PowerShell 中先执行 `chcp 65001`。
199
+
200
+ ---
201
+
202
+ ## A/B 机制(真实对照)
203
+
204
+ 两组差异由 `deveco_arm.py` 写入测试仓库的 `.deveco/deveco.jsonc`:
205
+
206
+ | 组别 | MCP | Agent Prompt | homegraph 工具 |
207
+ |------|-----|--------------|----------------|
208
+ | **baseline** | 无 | 仅用 grep/read | `deny` |
209
+ | **homegraph** | `homegraph serve --mcp --path <repo>` | 优先 `homegraph_explore` | 启用 |
210
+
211
+ - 每次实验前 `setup.py` 会重置仓库并**重新写入**上述配置;`deveco run --dir <repo>` 读取项目级配置。
212
+ - homegraph 组的 `git clean` 保留 `.homegraph/` 索引,避免重复 `init -i`。
213
+ - 对比报告 **A/B 有效性** 一节检查:baseline 的 HomeGraph 工具调用应为 0,homegraph 组应 > 0。
214
+
215
+ ---
216
+
217
+ ## 与 HomeGraph 主仓库的关系
218
+
219
+ - **homegraph 组**索引策略(`deveco_arm.ensure_homegraph_index`):
220
+ - 无 `.homegraph/` → `homegraph init <repo>`(若仍不健康则继续 `homegraph index`)
221
+ - 已初始化 → **`homegraph index` 全量重建**(不用 `sync`)
222
+ - **`--both-arms`**:**一启动就先** index/校验 `.homegraph/`,再跑 **homegraph → baseline**(先看到 HG 是否生效)
223
+ - 单独 `--arm homegraph`:组开头同样阻塞 index
224
+ - 每个实验前的 `setup.py` **不再**重复 index
225
+ - **不要**在跑 `run_all.py` 的同时另开终端 `node … index`(会并发写 `.homegraph`)
226
+
227
+ ### 复用已有 `.homegraph/`(跳过 index)
228
+
229
+ **可以**:把整个 `.homegraph/` 目录复制到目标仓库根目录,只要:
230
+
231
+ 1. **相同代码** — 同一 git commit(DB 里存的是相对路径 + 文件 content hash,不绑定绝对路径)
232
+ 2. **索引完整** — 尤其 Photos 级仓库需含 ArkTS Scene(`homegraph status -j` 里 `struct`/`component` > 0、`languages` 含 `arkts`)
233
+ 3. **HomeGraph 版本** — 最好用**同一套** `dist/bin/homegraph.js` 构建;若 extraction 版本落后,`status` 会标 `reindexRecommended`,脚本会拒绝 `--skip-index`
234
+
235
+ 复制示例(Windows):
236
+
237
+ ```powershell
238
+ # 源:已在 Linux/Mac 上 index 成功的 checkout
239
+ Copy-Item -Recurse D:\backup\applications_photos\.homegraph D:\code\applications_photos\.homegraph
240
+
241
+ # 跑评测,不再 index
242
+ python run_all.py --both-arms --agent deveco --repo-path D:\code\applications_photos --skip-index
243
+ ```
244
+
245
+ 单独 homegraph 组同样支持:`python run_all.py --arm homegraph --skip-index --repo-path …`
246
+
247
+ 若仓库相对索引有文件变更,脚本会 **warn** 但仍继续(MCP 可能对改过的文件不准);严重不完整则 **abort** 并提示去掉 `--skip-index` 或 `homegraph sync`。
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env python3
2
+ """Quick stdio test for win_mcp_launcher chain."""
3
+ import json
4
+ import subprocess
5
+ import sys
6
+ import threading
7
+ import time
8
+ from pathlib import Path
9
+
10
+ LAUNCHER = Path(__file__).with_name("win_mcp_launcher.py")
11
+ HG = Path(__file__).resolve().parents[2] / "dist" / "bin" / "homegraph.js"
12
+ REPO = Path(r"D:\code\applications_photos")
13
+
14
+
15
+ def run_chain(python: str) -> None:
16
+ cmd = [
17
+ python,
18
+ str(LAUNCHER),
19
+ "--liftoff-only",
20
+ "--stack-size=32768",
21
+ str(HG),
22
+ "serve",
23
+ "--mcp",
24
+ "--path",
25
+ str(REPO),
26
+ ]
27
+ proc = subprocess.Popen(
28
+ cmd,
29
+ stdin=subprocess.PIPE,
30
+ stdout=subprocess.PIPE,
31
+ stderr=subprocess.PIPE,
32
+ )
33
+ req = {
34
+ "jsonrpc": "2.0",
35
+ "id": 1,
36
+ "method": "initialize",
37
+ "params": {
38
+ "protocolVersion": "2024-11-05",
39
+ "capabilities": {},
40
+ "clientInfo": {"name": "t", "version": "0"},
41
+ },
42
+ }
43
+ proc.stdin.write((json.dumps(req) + "\n").encode())
44
+ proc.stdin.flush()
45
+
46
+ chunks: list[bytes] = []
47
+
48
+ def read_stdout() -> None:
49
+ while True:
50
+ block = proc.stdout.read(4096)
51
+ if not block:
52
+ break
53
+ chunks.append(block)
54
+
55
+ threading.Thread(target=read_stdout, daemon=True).start()
56
+ time.sleep(20)
57
+ alive = proc.poll() is None
58
+ if alive:
59
+ proc.kill()
60
+ proc.wait(timeout=5)
61
+ out = b"".join(chunks)
62
+ err = proc.stderr.read()
63
+ print(
64
+ f"{Path(python).name}: alive={alive} rc={proc.returncode} "
65
+ f"out={len(out)} err={len(err)} result={'result' in out.decode('utf-8', 'replace')}"
66
+ )
67
+ if err:
68
+ print(" stderr:", err[:400].decode("utf-8", "replace"))
69
+ if out:
70
+ print(" stdout:", out[:200].decode("utf-8", "replace"))
71
+
72
+
73
+ if __name__ == "__main__":
74
+ py_dir = Path(sys.executable).parent
75
+ for name in ("python.exe", "pythonw.exe"):
76
+ candidate = py_dir / name
77
+ if candidate.is_file():
78
+ run_chain(str(candidate))
@@ -0,0 +1,8 @@
1
+ import subprocess
2
+ import sys
3
+
4
+ print("middle start", file=sys.stderr, flush=True)
5
+ rc = subprocess.call(
6
+ [sys.executable, "-c", "import sys; print('child got stdin', sys.stdin.read(10)); sys.exit(0)"],
7
+ )
8
+ print("middle rc", rc, file=sys.stderr, flush=True)