@stupidloud/codegraph 0.8.1 → 0.9.9

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 (341) hide show
  1. package/README.md +319 -152
  2. package/dist/bin/codegraph.d.ts +4 -0
  3. package/dist/bin/codegraph.d.ts.map +1 -1
  4. package/dist/bin/codegraph.js +354 -90
  5. package/dist/bin/codegraph.js.map +1 -1
  6. package/dist/bin/node-version-check.d.ts +17 -0
  7. package/dist/bin/node-version-check.d.ts.map +1 -1
  8. package/dist/bin/node-version-check.js +37 -0
  9. package/dist/bin/node-version-check.js.map +1 -1
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/config.js +1 -11
  12. package/dist/config.js.map +1 -1
  13. package/dist/context/formatter.d.ts.map +1 -1
  14. package/dist/context/formatter.js +25 -6
  15. package/dist/context/formatter.js.map +1 -1
  16. package/dist/context/index.d.ts +22 -0
  17. package/dist/context/index.d.ts.map +1 -1
  18. package/dist/context/index.js +257 -6
  19. package/dist/context/index.js.map +1 -1
  20. package/dist/context/markers.d.ts +19 -0
  21. package/dist/context/markers.d.ts.map +1 -0
  22. package/dist/context/markers.js +22 -0
  23. package/dist/context/markers.js.map +1 -0
  24. package/dist/db/index.d.ts +30 -1
  25. package/dist/db/index.d.ts.map +1 -1
  26. package/dist/db/index.js +75 -25
  27. package/dist/db/index.js.map +1 -1
  28. package/dist/db/queries.d.ts +104 -0
  29. package/dist/db/queries.d.ts.map +1 -1
  30. package/dist/db/queries.js +328 -31
  31. package/dist/db/queries.js.map +1 -1
  32. package/dist/db/sqlite-adapter.d.ts +24 -23
  33. package/dist/db/sqlite-adapter.d.ts.map +1 -1
  34. package/dist/db/sqlite-adapter.js +54 -174
  35. package/dist/db/sqlite-adapter.js.map +1 -1
  36. package/dist/directory.d.ts.map +1 -1
  37. package/dist/directory.js +6 -20
  38. package/dist/directory.js.map +1 -1
  39. package/dist/extraction/generated-detection.d.ts +30 -0
  40. package/dist/extraction/generated-detection.d.ts.map +1 -0
  41. package/dist/extraction/generated-detection.js +80 -0
  42. package/dist/extraction/generated-detection.js.map +1 -0
  43. package/dist/extraction/grammars.d.ts +23 -1
  44. package/dist/extraction/grammars.d.ts.map +1 -1
  45. package/dist/extraction/grammars.js +107 -3
  46. package/dist/extraction/grammars.js.map +1 -1
  47. package/dist/extraction/index.d.ts +22 -14
  48. package/dist/extraction/index.d.ts.map +1 -1
  49. package/dist/extraction/index.js +272 -183
  50. package/dist/extraction/index.js.map +1 -1
  51. package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  52. package/dist/extraction/languages/c-cpp.js +45 -0
  53. package/dist/extraction/languages/c-cpp.js.map +1 -1
  54. package/dist/extraction/languages/csharp.d.ts.map +1 -1
  55. package/dist/extraction/languages/csharp.js +2 -1
  56. package/dist/extraction/languages/csharp.js.map +1 -1
  57. package/dist/extraction/languages/go.d.ts.map +1 -1
  58. package/dist/extraction/languages/go.js +18 -2
  59. package/dist/extraction/languages/go.js.map +1 -1
  60. package/dist/extraction/languages/index.d.ts.map +1 -1
  61. package/dist/extraction/languages/index.js +6 -0
  62. package/dist/extraction/languages/index.js.map +1 -1
  63. package/dist/extraction/languages/java.d.ts.map +1 -1
  64. package/dist/extraction/languages/java.js +6 -0
  65. package/dist/extraction/languages/java.js.map +1 -1
  66. package/dist/extraction/languages/kotlin.d.ts.map +1 -1
  67. package/dist/extraction/languages/kotlin.js +6 -0
  68. package/dist/extraction/languages/kotlin.js.map +1 -1
  69. package/dist/extraction/languages/lua.d.ts +3 -0
  70. package/dist/extraction/languages/lua.d.ts.map +1 -0
  71. package/dist/extraction/languages/lua.js +150 -0
  72. package/dist/extraction/languages/lua.js.map +1 -0
  73. package/dist/extraction/languages/luau.d.ts +3 -0
  74. package/dist/extraction/languages/luau.d.ts.map +1 -0
  75. package/dist/extraction/languages/luau.js +37 -0
  76. package/dist/extraction/languages/luau.js.map +1 -0
  77. package/dist/extraction/languages/objc.d.ts +3 -0
  78. package/dist/extraction/languages/objc.d.ts.map +1 -0
  79. package/dist/extraction/languages/objc.js +133 -0
  80. package/dist/extraction/languages/objc.js.map +1 -0
  81. package/dist/extraction/mybatis-extractor.d.ts +48 -0
  82. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  83. package/dist/extraction/mybatis-extractor.js +198 -0
  84. package/dist/extraction/mybatis-extractor.js.map +1 -0
  85. package/dist/extraction/tree-sitter-types.d.ts +14 -0
  86. package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  87. package/dist/extraction/tree-sitter.d.ts +84 -0
  88. package/dist/extraction/tree-sitter.d.ts.map +1 -1
  89. package/dist/extraction/tree-sitter.js +715 -16
  90. package/dist/extraction/tree-sitter.js.map +1 -1
  91. package/dist/extraction/vue-extractor.d.ts +15 -0
  92. package/dist/extraction/vue-extractor.d.ts.map +1 -1
  93. package/dist/extraction/vue-extractor.js +88 -0
  94. package/dist/extraction/vue-extractor.js.map +1 -1
  95. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  96. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  97. package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
  98. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  99. package/dist/extraction/wasm-runtime-flags.js +106 -0
  100. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  101. package/dist/graph/traversal.d.ts.map +1 -1
  102. package/dist/graph/traversal.js +76 -38
  103. package/dist/graph/traversal.js.map +1 -1
  104. package/dist/index.d.ts +77 -8
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +133 -19
  107. package/dist/index.js.map +1 -1
  108. package/dist/installer/config-writer.d.ts +7 -8
  109. package/dist/installer/config-writer.d.ts.map +1 -1
  110. package/dist/installer/config-writer.js +7 -27
  111. package/dist/installer/config-writer.js.map +1 -1
  112. package/dist/installer/index.d.ts +51 -16
  113. package/dist/installer/index.d.ts.map +1 -1
  114. package/dist/installer/index.js +120 -29
  115. package/dist/installer/index.js.map +1 -1
  116. package/dist/installer/instructions-template.d.ts +11 -21
  117. package/dist/installer/instructions-template.d.ts.map +1 -1
  118. package/dist/installer/instructions-template.js +12 -56
  119. package/dist/installer/instructions-template.js.map +1 -1
  120. package/dist/installer/targets/antigravity.d.ts +57 -0
  121. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  122. package/dist/installer/targets/antigravity.js +308 -0
  123. package/dist/installer/targets/antigravity.js.map +1 -0
  124. package/dist/installer/targets/claude.d.ts +26 -1
  125. package/dist/installer/targets/claude.d.ts.map +1 -1
  126. package/dist/installer/targets/claude.js +118 -40
  127. package/dist/installer/targets/claude.js.map +1 -1
  128. package/dist/installer/targets/codex.d.ts.map +1 -1
  129. package/dist/installer/targets/codex.js +15 -13
  130. package/dist/installer/targets/codex.js.map +1 -1
  131. package/dist/installer/targets/cursor.d.ts.map +1 -1
  132. package/dist/installer/targets/cursor.js +61 -36
  133. package/dist/installer/targets/cursor.js.map +1 -1
  134. package/dist/installer/targets/gemini.d.ts +26 -0
  135. package/dist/installer/targets/gemini.d.ts.map +1 -0
  136. package/dist/installer/targets/gemini.js +167 -0
  137. package/dist/installer/targets/gemini.js.map +1 -0
  138. package/dist/installer/targets/hermes.d.ts +18 -0
  139. package/dist/installer/targets/hermes.d.ts.map +1 -0
  140. package/dist/installer/targets/hermes.js +359 -0
  141. package/dist/installer/targets/hermes.js.map +1 -0
  142. package/dist/installer/targets/kiro.d.ts +27 -0
  143. package/dist/installer/targets/kiro.d.ts.map +1 -0
  144. package/dist/installer/targets/kiro.js +178 -0
  145. package/dist/installer/targets/kiro.js.map +1 -0
  146. package/dist/installer/targets/opencode.d.ts.map +1 -1
  147. package/dist/installer/targets/opencode.js +15 -13
  148. package/dist/installer/targets/opencode.js.map +1 -1
  149. package/dist/installer/targets/registry.d.ts.map +1 -1
  150. package/dist/installer/targets/registry.js +8 -0
  151. package/dist/installer/targets/registry.js.map +1 -1
  152. package/dist/installer/targets/shared.d.ts.map +1 -1
  153. package/dist/installer/targets/shared.js +3 -2
  154. package/dist/installer/targets/shared.js.map +1 -1
  155. package/dist/installer/targets/types.d.ts +1 -16
  156. package/dist/installer/targets/types.d.ts.map +1 -1
  157. package/dist/mcp/daemon-paths.d.ts +46 -0
  158. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  159. package/dist/mcp/daemon-paths.js +125 -0
  160. package/dist/mcp/daemon-paths.js.map +1 -0
  161. package/dist/mcp/daemon.d.ts +161 -0
  162. package/dist/mcp/daemon.d.ts.map +1 -0
  163. package/dist/mcp/daemon.js +403 -0
  164. package/dist/mcp/daemon.js.map +1 -0
  165. package/dist/mcp/engine.d.ts +105 -0
  166. package/dist/mcp/engine.d.ts.map +1 -0
  167. package/dist/mcp/engine.js +270 -0
  168. package/dist/mcp/engine.js.map +1 -0
  169. package/dist/mcp/index.d.ts +70 -52
  170. package/dist/mcp/index.d.ts.map +1 -1
  171. package/dist/mcp/index.js +355 -331
  172. package/dist/mcp/index.js.map +1 -1
  173. package/dist/mcp/proxy.d.ts +81 -0
  174. package/dist/mcp/proxy.d.ts.map +1 -0
  175. package/dist/mcp/proxy.js +510 -0
  176. package/dist/mcp/proxy.js.map +1 -0
  177. package/dist/mcp/server-instructions.d.ts +1 -1
  178. package/dist/mcp/server-instructions.d.ts.map +1 -1
  179. package/dist/mcp/server-instructions.js +21 -21
  180. package/dist/mcp/session.d.ts +77 -0
  181. package/dist/mcp/session.d.ts.map +1 -0
  182. package/dist/mcp/session.js +294 -0
  183. package/dist/mcp/session.js.map +1 -0
  184. package/dist/mcp/tools.d.ts +171 -15
  185. package/dist/mcp/tools.d.ts.map +1 -1
  186. package/dist/mcp/tools.js +1714 -298
  187. package/dist/mcp/tools.js.map +1 -1
  188. package/dist/mcp/transport.d.ts +111 -29
  189. package/dist/mcp/transport.d.ts.map +1 -1
  190. package/dist/mcp/transport.js +181 -71
  191. package/dist/mcp/transport.js.map +1 -1
  192. package/dist/mcp/version.d.ts +19 -0
  193. package/dist/mcp/version.d.ts.map +1 -0
  194. package/dist/mcp/version.js +71 -0
  195. package/dist/mcp/version.js.map +1 -0
  196. package/dist/resolution/callback-synthesizer.d.ts +10 -0
  197. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  198. package/dist/resolution/callback-synthesizer.js +1300 -0
  199. package/dist/resolution/callback-synthesizer.js.map +1 -0
  200. package/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  201. package/dist/resolution/frameworks/csharp.js +36 -8
  202. package/dist/resolution/frameworks/csharp.js.map +1 -1
  203. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  204. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  205. package/dist/resolution/frameworks/drupal.js +367 -0
  206. package/dist/resolution/frameworks/drupal.js.map +1 -0
  207. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  208. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  209. package/dist/resolution/frameworks/expo-modules.js +143 -0
  210. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  211. package/dist/resolution/frameworks/express.d.ts.map +1 -1
  212. package/dist/resolution/frameworks/express.js +102 -19
  213. package/dist/resolution/frameworks/express.js.map +1 -1
  214. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  215. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  216. package/dist/resolution/frameworks/fabric.js +354 -0
  217. package/dist/resolution/frameworks/fabric.js.map +1 -0
  218. package/dist/resolution/frameworks/go.d.ts.map +1 -1
  219. package/dist/resolution/frameworks/go.js +6 -3
  220. package/dist/resolution/frameworks/go.js.map +1 -1
  221. package/dist/resolution/frameworks/index.d.ts +6 -0
  222. package/dist/resolution/frameworks/index.d.ts.map +1 -1
  223. package/dist/resolution/frameworks/index.js +29 -1
  224. package/dist/resolution/frameworks/index.js.map +1 -1
  225. package/dist/resolution/frameworks/java.d.ts.map +1 -1
  226. package/dist/resolution/frameworks/java.js +339 -12
  227. package/dist/resolution/frameworks/java.js.map +1 -1
  228. package/dist/resolution/frameworks/laravel.d.ts.map +1 -1
  229. package/dist/resolution/frameworks/laravel.js +17 -8
  230. package/dist/resolution/frameworks/laravel.js.map +1 -1
  231. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
  232. package/dist/resolution/frameworks/nestjs.js +324 -0
  233. package/dist/resolution/frameworks/nestjs.js.map +1 -1
  234. package/dist/resolution/frameworks/play.d.ts +19 -0
  235. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  236. package/dist/resolution/frameworks/play.js +111 -0
  237. package/dist/resolution/frameworks/play.js.map +1 -0
  238. package/dist/resolution/frameworks/python.d.ts.map +1 -1
  239. package/dist/resolution/frameworks/python.js +134 -16
  240. package/dist/resolution/frameworks/python.js.map +1 -1
  241. package/dist/resolution/frameworks/react-native.d.ts +3 -0
  242. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  243. package/dist/resolution/frameworks/react-native.js +360 -0
  244. package/dist/resolution/frameworks/react-native.js.map +1 -0
  245. package/dist/resolution/frameworks/react.d.ts.map +1 -1
  246. package/dist/resolution/frameworks/react.js +96 -3
  247. package/dist/resolution/frameworks/react.js.map +1 -1
  248. package/dist/resolution/frameworks/ruby.d.ts.map +1 -1
  249. package/dist/resolution/frameworks/ruby.js +106 -2
  250. package/dist/resolution/frameworks/ruby.js.map +1 -1
  251. package/dist/resolution/frameworks/rust.d.ts.map +1 -1
  252. package/dist/resolution/frameworks/rust.js +102 -5
  253. package/dist/resolution/frameworks/rust.js.map +1 -1
  254. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  255. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  256. package/dist/resolution/frameworks/swift-objc.js +252 -0
  257. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  258. package/dist/resolution/frameworks/swift.d.ts.map +1 -1
  259. package/dist/resolution/frameworks/swift.js +30 -6
  260. package/dist/resolution/frameworks/swift.js.map +1 -1
  261. package/dist/resolution/go-module.d.ts +26 -0
  262. package/dist/resolution/go-module.d.ts.map +1 -0
  263. package/dist/resolution/go-module.js +78 -0
  264. package/dist/resolution/go-module.js.map +1 -0
  265. package/dist/resolution/import-resolver.d.ts +28 -0
  266. package/dist/resolution/import-resolver.d.ts.map +1 -1
  267. package/dist/resolution/import-resolver.js +617 -5
  268. package/dist/resolution/import-resolver.js.map +1 -1
  269. package/dist/resolution/index.d.ts +11 -0
  270. package/dist/resolution/index.d.ts.map +1 -1
  271. package/dist/resolution/index.js +196 -10
  272. package/dist/resolution/index.js.map +1 -1
  273. package/dist/resolution/lru-cache.d.ts +24 -0
  274. package/dist/resolution/lru-cache.d.ts.map +1 -0
  275. package/dist/resolution/lru-cache.js +62 -0
  276. package/dist/resolution/lru-cache.js.map +1 -0
  277. package/dist/resolution/name-matcher.d.ts.map +1 -1
  278. package/dist/resolution/name-matcher.js +212 -0
  279. package/dist/resolution/name-matcher.js.map +1 -1
  280. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  281. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  282. package/dist/resolution/swift-objc-bridge.js +256 -0
  283. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  284. package/dist/resolution/types.d.ts +44 -0
  285. package/dist/resolution/types.d.ts.map +1 -1
  286. package/dist/resolution/workspace-packages.d.ts +48 -0
  287. package/dist/resolution/workspace-packages.d.ts.map +1 -0
  288. package/dist/resolution/workspace-packages.js +208 -0
  289. package/dist/resolution/workspace-packages.js.map +1 -0
  290. package/dist/search/query-utils.d.ts +18 -0
  291. package/dist/search/query-utils.d.ts.map +1 -1
  292. package/dist/search/query-utils.js +30 -0
  293. package/dist/search/query-utils.js.map +1 -1
  294. package/dist/sync/git-hooks.d.ts.map +1 -1
  295. package/dist/sync/git-hooks.js +2 -0
  296. package/dist/sync/git-hooks.js.map +1 -1
  297. package/dist/sync/index.d.ts +3 -1
  298. package/dist/sync/index.d.ts.map +1 -1
  299. package/dist/sync/index.js +8 -1
  300. package/dist/sync/index.js.map +1 -1
  301. package/dist/sync/watcher.d.ts +214 -12
  302. package/dist/sync/watcher.d.ts.map +1 -1
  303. package/dist/sync/watcher.js +467 -55
  304. package/dist/sync/watcher.js.map +1 -1
  305. package/dist/sync/worktree.d.ts +54 -0
  306. package/dist/sync/worktree.d.ts.map +1 -0
  307. package/dist/sync/worktree.js +137 -0
  308. package/dist/sync/worktree.js.map +1 -0
  309. package/dist/types.d.ts +9 -1
  310. package/dist/types.d.ts.map +1 -1
  311. package/dist/types.js +14 -0
  312. package/dist/types.js.map +1 -1
  313. package/dist/utils.js +1 -1
  314. package/package.json +2 -2
  315. package/scripts/add-lang/bench.sh +60 -0
  316. package/scripts/add-lang/check-grammar.mjs +75 -0
  317. package/scripts/add-lang/dump-ast.mjs +103 -0
  318. package/scripts/add-lang/verify-extraction.mjs +70 -0
  319. package/scripts/agent-eval/arms-F.sh +21 -0
  320. package/scripts/agent-eval/arms-matrix.sh +37 -0
  321. package/scripts/agent-eval/bench-readme.sh +28 -0
  322. package/scripts/agent-eval/bench-why-repo.sh +22 -0
  323. package/scripts/agent-eval/block-read-hook.sh +19 -0
  324. package/scripts/agent-eval/hook-settings.json +15 -0
  325. package/scripts/agent-eval/itrun.sh +24 -11
  326. package/scripts/agent-eval/parse-arms.mjs +116 -0
  327. package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
  328. package/scripts/agent-eval/probe-context.mjs +21 -0
  329. package/scripts/agent-eval/probe-explore.mjs +40 -0
  330. package/scripts/agent-eval/probe-node.mjs +20 -0
  331. package/scripts/agent-eval/probe-sweep.mjs +119 -0
  332. package/scripts/agent-eval/probe-trace.mjs +20 -0
  333. package/scripts/agent-eval/run-arms.sh +56 -0
  334. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  335. package/scripts/build-bundle.sh +118 -0
  336. package/scripts/npm-sdk.js +75 -0
  337. package/scripts/npm-shim.js +246 -0
  338. package/scripts/pack-npm.sh +119 -0
  339. package/scripts/prepare-release.mjs +270 -0
  340. package/scripts/patch-tree-sitter-dart.js +0 -112
  341. package/scripts/release.sh +0 -68
@@ -28,45 +28,45 @@ editing code, not during.
28
28
  ## Answer directly — don't delegate exploration
29
29
 
30
30
  For "how does X work", architecture, trace, or where-is-X questions,
31
- answer DIRECTLY using 2-3 codegraph calls: \`codegraph_context\` first,
32
- then ONE \`codegraph_explore\` for the source of the symbols it surfaces.
33
- Codegraph IS the pre-built search index so delegating the lookup to a
34
- separate file-reading sub-task/agent, or running your own grep + read
35
- loop, repeats work codegraph already did and costs more for the same
36
- answer. Reach for raw Read/Grep only to confirm a specific detail
37
- codegraph didn't cover. A direct codegraph answer is typically a handful
38
- of calls; a grep/read exploration is dozens.
31
+ answer DIRECTLY usually with ONE \`codegraph_explore\` call.
32
+ \`codegraph_explore\` takes either a natural-language question or a bag of
33
+ symbol/file names and returns the verbatim source of the relevant symbols
34
+ grouped by file, so it is Read-equivalent and most often the ONLY
35
+ codegraph call you need. Codegraph IS the pre-built search index so
36
+ delegating the lookup to a separate file-reading sub-task/agent, or
37
+ running your own grep + read loop, repeats work codegraph already did and
38
+ costs more for the same answer. Reach for raw Read/Grep only to confirm a
39
+ specific detail codegraph didn't cover. A direct codegraph answer is
40
+ typically one to a few calls; a grep/read exploration is dozens.
39
41
 
40
42
  ## Tool selection by intent
41
43
 
42
- - **"How does X work? / trace X end to end / explain the Y system / architecture?"** → \`codegraph_explore\` (PRIMARY for understanding seed it with the key symbol names, read its output, don't grep+Read your way there)
43
- - **"What is the symbol named X? / where is X defined?"** → \`codegraph_search\` (pinpoint lookups)
44
- - **"What's the deal with this task / feature / area?"** → \`codegraph_context\` (lighter composed view of search + node + callers + callees)
45
- - **"What calls this?"** → \`codegraph_callers\`
46
- - **"What does this call?"** → \`codegraph_callees\`
47
- - **"What would changing this break?"** → \`codegraph_impact\`
48
- - **"Show me this symbol's source / signature / docstring."** → \`codegraph_node\`
49
- - **"Show me several related symbols' source / survey an area."** → \`codegraph_explore\` (ONE capped call; prefer over many codegraph_node/Read)
44
+ - **Almost any question — "how does X work", architecture, a bug, "what/where is X", or surveying an area** → \`codegraph_explore\` (PRIMARY call FIRST; ONE capped call returns the verbatim source of the relevant symbols grouped by file; most often the ONLY call you need)
45
+ - **"How does X reach/become Y? / the flow / the path from X to Y"** → \`codegraph_explore\`, naming the symbols that span the flow (e.g. \`mutateElement renderScene\`) — it surfaces the call path among them, including dynamic-dispatch hops (callbacks, React re-render, JSX children) grep can't follow
46
+ - **"What is the symbol named X?" (just its location)** → \`codegraph_search\`
47
+ - **"What calls this?" / "What does this call?" / "What would changing this break?"** → \`codegraph_callers\` / \`codegraph_callees\` / \`codegraph_impact\`
48
+ - **One specific symbol's full source (esp. a body \`codegraph_explore\` trimmed), or an OVERLOADED name** → \`codegraph_node\` (with \`includeCode\`): for an ambiguous name it returns EVERY matching definition's body in one call, so you never Read a file to find the right overload
50
49
  - **"What's in directory X?"** → \`codegraph_files\`
51
50
  - **"Is the index ready / what's its size?"** → \`codegraph_status\`
52
51
 
53
52
  ## Common chains
54
53
 
55
- - **Understanding / onboarding**: feed \`codegraph_explore\` the key symbol/file names and read its output (line-numbered source from many files in one call). If the question names nothing concrete, do ONE quick \`codegraph_search\` / \`codegraph_context\` to surface the names, then explore with them. Fill remaining gaps with \`codegraph_node\` / Read — don't drop back to grep+Read for the whole topic.
54
+ - **Flow / "how does X reach Y"**: ONE \`codegraph_explore\` with the symbol names spanning the flow it surfaces the call path among them (riding dynamic-dispatch hops) AND returns their source. No need to reconstruct the path with \`codegraph_search\` + \`codegraph_callers\`.
55
+ - **Onboarding / understanding any area**: ONE \`codegraph_explore\` is usually the whole answer. Only follow up — \`codegraph_node\` for a specific symbol — if something is still unclear.
56
56
  - **Refactor planning**: \`codegraph_search\` → \`codegraph_callers\` → \`codegraph_impact\`. The blast-radius answer comes from impact, not from walking callers manually.
57
57
  - **Debugging a regression**: \`codegraph_callers\` of the suspected symbol; widen with \`codegraph_impact\` if an unexpected call appears.
58
58
 
59
59
  ## Anti-patterns
60
60
 
61
- - **Don't search-then-Read your way through an understanding question** feed the names you find into \`codegraph_explore\` instead of Reading the files one by one; it does that whole loop in one call and returns line numbers you can cite directly.
61
+ - **Trust codegraph's resultsdon't re-verify them with grep.** They come from a full AST parse; re-checking with grep is slower, less accurate, and wastes context.
62
62
  - **Don't grep first** when looking up a symbol by name — \`codegraph_search\` is faster and returns kind + location + signature.
63
- - **Don't reach for \`codegraph_explore\` on a pinpoint "where is X defined" lookup** \`codegraph_search\` is one cheap call.
64
- - **Don't chain \`codegraph_search\` + \`codegraph_node\`** when you just want context — \`codegraph_context\` is one round-trip.
63
+ - **Don't chain \`codegraph_search\` + \`codegraph_node\`** to understand an area ONE \`codegraph_explore\` returns the relevant symbols' source together in a single round-trip.
65
64
  - **Don't loop \`codegraph_node\` over many symbols** — one \`codegraph_explore\` call returns them all grouped by file, while each separate call re-reads the whole context and costs far more. Use \`codegraph_node\` for a single symbol.
66
- - **Don't query the index immediately after editing a file**the watcher needs ~500ms to debounce + sync. Wait for the next turn.
65
+ - **After editing, check the staleness banner.** When a tool response starts with "⚠️ Some files referenced below were edited since the last index sync…", the listed files are pending re-index Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust codegraph. \`codegraph_status\` also lists pending files under "Pending sync".
67
66
 
68
67
  ## Limitations
69
68
 
69
+ - If a tool reports the project isn't initialized, \`.codegraph/\` doesn't exist yet — offer to run \`codegraph init -i\` to build the index.
70
70
  - Index lags file writes by ~1 second.
71
71
  - Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.
72
72
  - No live correctness validation — that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.
@@ -0,0 +1,77 @@
1
+ /**
2
+ * MCP per-connection session — speaks the JSON-RPC protocol (initialize,
3
+ * tools/list, tools/call) over a single {@link JsonRpcTransport}. It owns
4
+ * per-client state only (which protocol version the client asked for, whether
5
+ * it advertised `roots`, the one-shot roots/list latch); the heavyweight
6
+ * resources (CodeGraph, watcher, ToolHandler) live in the shared
7
+ * {@link MCPEngine} so daemon mode can collapse N inotify sets / DB handles
8
+ * to one.
9
+ *
10
+ * The state-machine itself mirrors what `MCPServer` used to do inline before
11
+ * issue #411 split it out — the same regression tests in
12
+ * `__tests__/mcp-initialize.test.ts` still drive this code path.
13
+ */
14
+ import { JsonRpcTransport } from './transport';
15
+ import { MCPEngine } from './engine';
16
+ /**
17
+ * MCP Server Info — kept on the session because some clients log it. The
18
+ * version tracks the real package version (was a hard-coded '0.1.0').
19
+ */
20
+ export declare const SERVER_INFO: {
21
+ name: string;
22
+ version: string;
23
+ };
24
+ /** MCP Protocol Version (latest the server claims). */
25
+ export declare const PROTOCOL_VERSION = "2024-11-05";
26
+ export interface MCPSessionOptions {
27
+ /**
28
+ * Explicit project path from the `--path` CLI flag. When set, the session
29
+ * will not bother asking the client for `roots/list` — we already know
30
+ * where the project lives.
31
+ */
32
+ explicitProjectPath?: string | null;
33
+ }
34
+ /**
35
+ * One MCP client's view of the server. Created fresh per stdio launch
36
+ * (direct mode) or per socket connection (daemon mode).
37
+ */
38
+ export declare class MCPSession {
39
+ private transport;
40
+ private engine;
41
+ private clientSupportsRoots;
42
+ private rootsAttempted;
43
+ private resolvePromise;
44
+ private explicitProjectPath;
45
+ constructor(transport: JsonRpcTransport, engine: MCPEngine, opts?: MCPSessionOptions);
46
+ /**
47
+ * Start handling messages from the transport. Returns immediately — the
48
+ * session lives for as long as the transport is open.
49
+ */
50
+ start(): void;
51
+ /**
52
+ * Tear down the session. Does NOT touch the engine (the engine may serve
53
+ * other sessions) or call `process.exit` (the daemon decides when to exit).
54
+ */
55
+ stop(): void;
56
+ /** Underlying transport — exposed for daemon-side close hooks. */
57
+ getTransport(): JsonRpcTransport;
58
+ private handleMessage;
59
+ private handleInitialize;
60
+ private handleToolsList;
61
+ private handleToolsCall;
62
+ /**
63
+ * Lazy default-project resolution. Three layers:
64
+ * 1. await the in-flight init kicked off from `handleInitialize` (if any);
65
+ * 2. if still uninitialized and we never asked the client for its roots,
66
+ * do so now (one-shot); fall back to cwd if the client lacks roots;
67
+ * 3. last-resort: re-walk from the best candidate — picks up projects
68
+ * that were `codegraph init`'d *after* the server started.
69
+ */
70
+ private retryInitIfNeeded;
71
+ /**
72
+ * Ask the client for its workspace root via `roots/list` and open the
73
+ * first one. Falls back to `process.cwd()` on timeout or empty answer.
74
+ */
75
+ private initFromRoots;
76
+ }
77
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAuC,gBAAgB,EAAc,MAAM,aAAa,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAKrC;;;GAGG;AAGH,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAmC7C,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,qBAAa,UAAU;IAOnB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IAPhB,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,mBAAmB,CAAgB;gBAGjC,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,SAAS,EACzB,IAAI,GAAE,iBAAsB;IAK9B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;;OAGG;IACH,IAAI,IAAI,IAAI;IAIZ,kEAAkE;IAClE,YAAY,IAAI,gBAAgB;YAIlB,aAAa;YA0Cb,gBAAgB;YAsChB,eAAe;YAOf,eAAe;IA8B7B;;;;;;;OAOG;YACW,iBAAiB;IAyB/B;;;OAGG;YACW,aAAa;CAgB5B"}
@@ -0,0 +1,294 @@
1
+ "use strict";
2
+ /**
3
+ * MCP per-connection session — speaks the JSON-RPC protocol (initialize,
4
+ * tools/list, tools/call) over a single {@link JsonRpcTransport}. It owns
5
+ * per-client state only (which protocol version the client asked for, whether
6
+ * it advertised `roots`, the one-shot roots/list latch); the heavyweight
7
+ * resources (CodeGraph, watcher, ToolHandler) live in the shared
8
+ * {@link MCPEngine} so daemon mode can collapse N inotify sets / DB handles
9
+ * to one.
10
+ *
11
+ * The state-machine itself mirrors what `MCPServer` used to do inline before
12
+ * issue #411 split it out — the same regression tests in
13
+ * `__tests__/mcp-initialize.test.ts` still drive this code path.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.MCPSession = exports.PROTOCOL_VERSION = exports.SERVER_INFO = void 0;
50
+ const path = __importStar(require("path"));
51
+ const transport_1 = require("./transport");
52
+ const tools_1 = require("./tools");
53
+ const server_instructions_1 = require("./server-instructions");
54
+ const version_1 = require("./version");
55
+ /**
56
+ * MCP Server Info — kept on the session because some clients log it. The
57
+ * version tracks the real package version (was a hard-coded '0.1.0').
58
+ */
59
+ // Exported so the proxy can answer `initialize` locally with the IDENTICAL
60
+ // payload the daemon would send — no drift between the two handshake paths.
61
+ exports.SERVER_INFO = {
62
+ name: 'codegraph',
63
+ version: version_1.CodeGraphPackageVersion,
64
+ };
65
+ /** MCP Protocol Version (latest the server claims). */
66
+ exports.PROTOCOL_VERSION = '2024-11-05';
67
+ /**
68
+ * How long to wait for the client's `roots/list` response before giving up
69
+ * and falling back to the process cwd.
70
+ */
71
+ const ROOTS_LIST_TIMEOUT_MS = 5000;
72
+ /**
73
+ * Convert a file:// URI to a filesystem path. Handles URL encoding and
74
+ * Windows drive letter paths.
75
+ */
76
+ function fileUriToPath(uri) {
77
+ try {
78
+ const url = new URL(uri);
79
+ let filePath = decodeURIComponent(url.pathname);
80
+ if (process.platform === 'win32' && /^\/[a-zA-Z]:/.test(filePath)) {
81
+ filePath = filePath.slice(1);
82
+ }
83
+ return path.resolve(filePath);
84
+ }
85
+ catch {
86
+ return uri.replace(/^file:\/\/\/?/, '');
87
+ }
88
+ }
89
+ /** First usable filesystem path from a `roots/list` result, or null. */
90
+ function firstRootPath(result) {
91
+ if (!result || typeof result !== 'object')
92
+ return null;
93
+ const roots = result.roots;
94
+ if (!Array.isArray(roots) || roots.length === 0)
95
+ return null;
96
+ const first = roots[0];
97
+ if (typeof first?.uri !== 'string')
98
+ return null;
99
+ return fileUriToPath(first.uri);
100
+ }
101
+ /**
102
+ * One MCP client's view of the server. Created fresh per stdio launch
103
+ * (direct mode) or per socket connection (daemon mode).
104
+ */
105
+ class MCPSession {
106
+ transport;
107
+ engine;
108
+ clientSupportsRoots = false;
109
+ rootsAttempted = false;
110
+ resolvePromise = null;
111
+ explicitProjectPath;
112
+ constructor(transport, engine, opts = {}) {
113
+ this.transport = transport;
114
+ this.engine = engine;
115
+ this.explicitProjectPath = opts.explicitProjectPath ?? null;
116
+ }
117
+ /**
118
+ * Start handling messages from the transport. Returns immediately — the
119
+ * session lives for as long as the transport is open.
120
+ */
121
+ start() {
122
+ this.transport.start(this.handleMessage.bind(this));
123
+ }
124
+ /**
125
+ * Tear down the session. Does NOT touch the engine (the engine may serve
126
+ * other sessions) or call `process.exit` (the daemon decides when to exit).
127
+ */
128
+ stop() {
129
+ this.transport.stop();
130
+ }
131
+ /** Underlying transport — exposed for daemon-side close hooks. */
132
+ getTransport() {
133
+ return this.transport;
134
+ }
135
+ async handleMessage(message) {
136
+ const isRequest = 'id' in message;
137
+ switch (message.method) {
138
+ case 'initialize':
139
+ if (isRequest)
140
+ await this.handleInitialize(message);
141
+ break;
142
+ case 'initialized':
143
+ // Notification that client has finished initialization — no action needed.
144
+ break;
145
+ case 'tools/list':
146
+ if (isRequest)
147
+ await this.handleToolsList(message);
148
+ break;
149
+ case 'tools/call':
150
+ if (isRequest)
151
+ await this.handleToolsCall(message);
152
+ break;
153
+ case 'ping':
154
+ if (isRequest)
155
+ this.transport.sendResult(message.id, {});
156
+ break;
157
+ case 'resources/list':
158
+ // We expose no MCP resources, but some clients (opencode, Codex) probe
159
+ // for them on connect; reply with an empty list instead of a
160
+ // MethodNotFound error that surfaces as a scary `-32601` log line. (#621)
161
+ if (isRequest)
162
+ this.transport.sendResult(message.id, { resources: [] });
163
+ break;
164
+ case 'resources/templates/list':
165
+ if (isRequest)
166
+ this.transport.sendResult(message.id, { resourceTemplates: [] });
167
+ break;
168
+ case 'prompts/list':
169
+ // Likewise — no prompts exposed, but answer the probe cleanly. (#621)
170
+ if (isRequest)
171
+ this.transport.sendResult(message.id, { prompts: [] });
172
+ break;
173
+ default:
174
+ if (isRequest) {
175
+ this.transport.sendError(message.id, transport_1.ErrorCodes.MethodNotFound, `Method not found: ${message.method}`);
176
+ }
177
+ }
178
+ }
179
+ async handleInitialize(request) {
180
+ const params = request.params;
181
+ this.clientSupportsRoots = !!params?.capabilities?.roots;
182
+ // Explicit project signal, strongest first: client-provided rootUri /
183
+ // workspaceFolders (LSP-style), else the --path the server was launched
184
+ // with. cwd is NOT used here — we defer it so a roots/list answer can
185
+ // win over it. See issue #196.
186
+ let explicitPath = null;
187
+ if (params?.rootUri) {
188
+ explicitPath = fileUriToPath(params.rootUri);
189
+ }
190
+ else if (params?.workspaceFolders?.[0]?.uri) {
191
+ explicitPath = fileUriToPath(params.workspaceFolders[0].uri);
192
+ }
193
+ else if (this.explicitProjectPath) {
194
+ explicitPath = this.explicitProjectPath;
195
+ }
196
+ // Respond to the handshake BEFORE doing any heavy init — see issue #172.
197
+ this.transport.sendResult(request.id, {
198
+ protocolVersion: exports.PROTOCOL_VERSION,
199
+ capabilities: { tools: {} },
200
+ serverInfo: exports.SERVER_INFO,
201
+ instructions: server_instructions_1.SERVER_INSTRUCTIONS,
202
+ });
203
+ if (explicitPath) {
204
+ // Kick off engine init in the background. If another session in the
205
+ // same daemon already opened the project, `ensureInitialized` is a
206
+ // ~free no-op — N concurrent clients pay exactly one open.
207
+ this.resolvePromise = this.engine.ensureInitialized(explicitPath);
208
+ }
209
+ }
210
+ async handleToolsList(request) {
211
+ await this.retryInitIfNeeded();
212
+ this.transport.sendResult(request.id, {
213
+ tools: this.engine.getToolHandler().getTools(),
214
+ });
215
+ }
216
+ async handleToolsCall(request) {
217
+ const params = request.params;
218
+ if (!params || !params.name) {
219
+ this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, 'Missing tool name');
220
+ return;
221
+ }
222
+ const toolName = params.name;
223
+ const toolArgs = params.arguments || {};
224
+ const tool = tools_1.tools.find((t) => t.name === toolName);
225
+ if (!tool) {
226
+ this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, `Unknown tool: ${toolName}`);
227
+ return;
228
+ }
229
+ await this.retryInitIfNeeded();
230
+ const result = await this.engine.getToolHandler().execute(toolName, toolArgs);
231
+ this.transport.sendResult(request.id, result);
232
+ }
233
+ /**
234
+ * Lazy default-project resolution. Three layers:
235
+ * 1. await the in-flight init kicked off from `handleInitialize` (if any);
236
+ * 2. if still uninitialized and we never asked the client for its roots,
237
+ * do so now (one-shot); fall back to cwd if the client lacks roots;
238
+ * 3. last-resort: re-walk from the best candidate — picks up projects
239
+ * that were `codegraph init`'d *after* the server started.
240
+ */
241
+ async retryInitIfNeeded() {
242
+ if (this.resolvePromise) {
243
+ try {
244
+ await this.resolvePromise;
245
+ }
246
+ catch { /* fall through to retry */ }
247
+ this.resolvePromise = null;
248
+ }
249
+ if (this.engine.hasDefaultCodeGraph())
250
+ return;
251
+ const hint = this.explicitProjectPath ?? this.engine.getProjectPath();
252
+ if (!hint && !this.rootsAttempted) {
253
+ this.rootsAttempted = true;
254
+ this.resolvePromise = this.clientSupportsRoots
255
+ ? this.initFromRoots()
256
+ : this.engine.ensureInitialized(process.cwd());
257
+ try {
258
+ await this.resolvePromise;
259
+ }
260
+ catch { /* fall through */ }
261
+ this.resolvePromise = null;
262
+ if (this.engine.hasDefaultCodeGraph())
263
+ return;
264
+ }
265
+ // Last resort: walk from the best candidate (sync open). Picks up
266
+ // projects that appeared after the server started.
267
+ const candidate = hint ?? process.cwd();
268
+ this.engine.retryInitializeSync(candidate);
269
+ }
270
+ /**
271
+ * Ask the client for its workspace root via `roots/list` and open the
272
+ * first one. Falls back to `process.cwd()` on timeout or empty answer.
273
+ */
274
+ async initFromRoots() {
275
+ let target = process.cwd();
276
+ try {
277
+ const result = await this.transport.request('roots/list', undefined, ROOTS_LIST_TIMEOUT_MS);
278
+ const rootPath = firstRootPath(result);
279
+ if (rootPath) {
280
+ target = rootPath;
281
+ }
282
+ else {
283
+ process.stderr.write('[CodeGraph MCP] Client returned no workspace roots; falling back to process cwd.\n');
284
+ }
285
+ }
286
+ catch (err) {
287
+ const msg = err instanceof Error ? err.message : String(err);
288
+ process.stderr.write(`[CodeGraph MCP] roots/list request failed (${msg}); falling back to process cwd.\n`);
289
+ }
290
+ await this.engine.ensureInitialized(target);
291
+ }
292
+ }
293
+ exports.MCPSession = MCPSession;
294
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,2CAAgG;AAEhG,mCAAgC;AAChC,+DAA4D;AAC5D,uCAAoD;AAEpD;;;GAGG;AACH,2EAA2E;AAC3E,4EAA4E;AAC/D,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,iCAAuB;CACjC,CAAC;AAEF,uDAAuD;AAC1C,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAE7C;;;GAGG;AACH,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC;;;GAGG;AACH,SAAS,aAAa,CAAC,GAAW;IAChC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,QAAQ,GAAG,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClE,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,wEAAwE;AACxE,SAAS,aAAa,CAAC,MAAe;IACpC,IAAI,CAAC,M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