@colbymchenry/codegraph-darwin-x64 0.9.9 → 1.0.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 (296) hide show
  1. package/lib/dist/bin/codegraph.d.ts +1 -0
  2. package/lib/dist/bin/codegraph.d.ts.map +1 -1
  3. package/lib/dist/bin/codegraph.js +246 -3
  4. package/lib/dist/bin/codegraph.js.map +1 -1
  5. package/lib/dist/context/index.d.ts.map +1 -1
  6. package/lib/dist/context/index.js +7 -0
  7. package/lib/dist/context/index.js.map +1 -1
  8. package/lib/dist/db/index.d.ts.map +1 -1
  9. package/lib/dist/db/index.js +2 -1
  10. package/lib/dist/db/index.js.map +1 -1
  11. package/lib/dist/db/migrations.d.ts +1 -1
  12. package/lib/dist/db/migrations.d.ts.map +1 -1
  13. package/lib/dist/db/migrations.js +10 -1
  14. package/lib/dist/db/migrations.js.map +1 -1
  15. package/lib/dist/db/queries.d.ts +43 -0
  16. package/lib/dist/db/queries.d.ts.map +1 -1
  17. package/lib/dist/db/queries.js +103 -7
  18. package/lib/dist/db/queries.js.map +1 -1
  19. package/lib/dist/db/schema.sql +1 -0
  20. package/lib/dist/db/sqlite-adapter.d.ts +7 -0
  21. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  22. package/lib/dist/db/sqlite-adapter.js +3 -0
  23. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  24. package/lib/dist/directory.d.ts +34 -2
  25. package/lib/dist/directory.d.ts.map +1 -1
  26. package/lib/dist/directory.js +129 -35
  27. package/lib/dist/directory.js.map +1 -1
  28. package/lib/dist/extraction/astro-extractor.d.ts +79 -0
  29. package/lib/dist/extraction/astro-extractor.d.ts.map +1 -0
  30. package/lib/dist/extraction/astro-extractor.js +320 -0
  31. package/lib/dist/extraction/astro-extractor.js.map +1 -0
  32. package/lib/dist/extraction/extraction-version.d.ts +25 -0
  33. package/lib/dist/extraction/extraction-version.d.ts.map +1 -0
  34. package/lib/dist/extraction/extraction-version.js +28 -0
  35. package/lib/dist/extraction/extraction-version.js.map +1 -0
  36. package/lib/dist/extraction/function-ref.d.ts +118 -0
  37. package/lib/dist/extraction/function-ref.d.ts.map +1 -0
  38. package/lib/dist/extraction/function-ref.js +727 -0
  39. package/lib/dist/extraction/function-ref.js.map +1 -0
  40. package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
  41. package/lib/dist/extraction/generated-detection.js +3 -0
  42. package/lib/dist/extraction/generated-detection.js.map +1 -1
  43. package/lib/dist/extraction/grammars.d.ts +7 -1
  44. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  45. package/lib/dist/extraction/grammars.js +52 -4
  46. package/lib/dist/extraction/grammars.js.map +1 -1
  47. package/lib/dist/extraction/index.d.ts +34 -0
  48. package/lib/dist/extraction/index.d.ts.map +1 -1
  49. package/lib/dist/extraction/index.js +346 -62
  50. package/lib/dist/extraction/index.js.map +1 -1
  51. package/lib/dist/extraction/languages/c-cpp.d.ts +8 -0
  52. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  53. package/lib/dist/extraction/languages/c-cpp.js +87 -28
  54. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  55. package/lib/dist/extraction/languages/csharp.d.ts +22 -0
  56. package/lib/dist/extraction/languages/csharp.d.ts.map +1 -1
  57. package/lib/dist/extraction/languages/csharp.js +84 -2
  58. package/lib/dist/extraction/languages/csharp.js.map +1 -1
  59. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  60. package/lib/dist/extraction/languages/dart.js +161 -1
  61. package/lib/dist/extraction/languages/dart.js.map +1 -1
  62. package/lib/dist/extraction/languages/go.d.ts.map +1 -1
  63. package/lib/dist/extraction/languages/go.js +43 -2
  64. package/lib/dist/extraction/languages/go.js.map +1 -1
  65. package/lib/dist/extraction/languages/index.d.ts.map +1 -1
  66. package/lib/dist/extraction/languages/index.js +2 -0
  67. package/lib/dist/extraction/languages/index.js.map +1 -1
  68. package/lib/dist/extraction/languages/java.d.ts.map +1 -1
  69. package/lib/dist/extraction/languages/java.js +42 -1
  70. package/lib/dist/extraction/languages/java.js.map +1 -1
  71. package/lib/dist/extraction/languages/javascript.d.ts.map +1 -1
  72. package/lib/dist/extraction/languages/javascript.js +16 -0
  73. package/lib/dist/extraction/languages/javascript.js.map +1 -1
  74. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  75. package/lib/dist/extraction/languages/kotlin.js +69 -0
  76. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  77. package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
  78. package/lib/dist/extraction/languages/objc.js +42 -0
  79. package/lib/dist/extraction/languages/objc.js.map +1 -1
  80. package/lib/dist/extraction/languages/pascal.d.ts.map +1 -1
  81. package/lib/dist/extraction/languages/pascal.js +11 -0
  82. package/lib/dist/extraction/languages/pascal.js.map +1 -1
  83. package/lib/dist/extraction/languages/php.d.ts.map +1 -1
  84. package/lib/dist/extraction/languages/php.js +90 -1
  85. package/lib/dist/extraction/languages/php.js.map +1 -1
  86. package/lib/dist/extraction/languages/r.d.ts +3 -0
  87. package/lib/dist/extraction/languages/r.d.ts.map +1 -0
  88. package/lib/dist/extraction/languages/r.js +314 -0
  89. package/lib/dist/extraction/languages/r.js.map +1 -0
  90. package/lib/dist/extraction/languages/ruby.d.ts.map +1 -1
  91. package/lib/dist/extraction/languages/ruby.js +35 -0
  92. package/lib/dist/extraction/languages/ruby.js.map +1 -1
  93. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  94. package/lib/dist/extraction/languages/rust.js +35 -2
  95. package/lib/dist/extraction/languages/rust.js.map +1 -1
  96. package/lib/dist/extraction/languages/scala.d.ts.map +1 -1
  97. package/lib/dist/extraction/languages/scala.js +61 -1
  98. package/lib/dist/extraction/languages/scala.js.map +1 -1
  99. package/lib/dist/extraction/languages/swift.d.ts.map +1 -1
  100. package/lib/dist/extraction/languages/swift.js +61 -0
  101. package/lib/dist/extraction/languages/swift.js.map +1 -1
  102. package/lib/dist/extraction/languages/typescript.d.ts +13 -0
  103. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
  104. package/lib/dist/extraction/languages/typescript.js +38 -0
  105. package/lib/dist/extraction/languages/typescript.js.map +1 -1
  106. package/lib/dist/extraction/liquid-extractor.d.ts +7 -0
  107. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
  108. package/lib/dist/extraction/liquid-extractor.js +53 -9
  109. package/lib/dist/extraction/liquid-extractor.js.map +1 -1
  110. package/lib/dist/extraction/razor-extractor.d.ts +42 -0
  111. package/lib/dist/extraction/razor-extractor.d.ts.map +1 -0
  112. package/lib/dist/extraction/razor-extractor.js +285 -0
  113. package/lib/dist/extraction/razor-extractor.js.map +1 -0
  114. package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
  115. package/lib/dist/extraction/svelte-extractor.js +6 -3
  116. package/lib/dist/extraction/svelte-extractor.js.map +1 -1
  117. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  118. package/lib/dist/extraction/tree-sitter-helpers.js +59 -10
  119. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  120. package/lib/dist/extraction/tree-sitter-types.d.ts +33 -0
  121. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  122. package/lib/dist/extraction/tree-sitter.d.ts +211 -0
  123. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  124. package/lib/dist/extraction/tree-sitter.js +1681 -49
  125. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  126. package/lib/dist/extraction/vue-extractor.d.ts +15 -0
  127. package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
  128. package/lib/dist/extraction/vue-extractor.js +94 -3
  129. package/lib/dist/extraction/vue-extractor.js.map +1 -1
  130. package/lib/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  131. package/lib/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  132. package/lib/dist/graph/queries.d.ts.map +1 -1
  133. package/lib/dist/graph/queries.js +13 -40
  134. package/lib/dist/graph/queries.js.map +1 -1
  135. package/lib/dist/graph/traversal.d.ts.map +1 -1
  136. package/lib/dist/graph/traversal.js +16 -4
  137. package/lib/dist/graph/traversal.js.map +1 -1
  138. package/lib/dist/index.d.ts +34 -2
  139. package/lib/dist/index.d.ts.map +1 -1
  140. package/lib/dist/index.js +90 -8
  141. package/lib/dist/index.js.map +1 -1
  142. package/lib/dist/installer/index.d.ts.map +1 -1
  143. package/lib/dist/installer/index.js +52 -2
  144. package/lib/dist/installer/index.js.map +1 -1
  145. package/lib/dist/installer/instructions-template.d.ts +34 -11
  146. package/lib/dist/installer/instructions-template.d.ts.map +1 -1
  147. package/lib/dist/installer/instructions-template.js +44 -12
  148. package/lib/dist/installer/instructions-template.js.map +1 -1
  149. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  150. package/lib/dist/installer/targets/claude.js +6 -10
  151. package/lib/dist/installer/targets/claude.js.map +1 -1
  152. package/lib/dist/installer/targets/codex.js +4 -6
  153. package/lib/dist/installer/targets/codex.js.map +1 -1
  154. package/lib/dist/installer/targets/gemini.js +4 -6
  155. package/lib/dist/installer/targets/gemini.js.map +1 -1
  156. package/lib/dist/installer/targets/opencode.d.ts +9 -1
  157. package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
  158. package/lib/dist/installer/targets/opencode.js +91 -40
  159. package/lib/dist/installer/targets/opencode.js.map +1 -1
  160. package/lib/dist/installer/targets/shared.d.ts +14 -0
  161. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  162. package/lib/dist/installer/targets/shared.js +16 -0
  163. package/lib/dist/installer/targets/shared.js.map +1 -1
  164. package/lib/dist/mcp/daemon.d.ts +60 -1
  165. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  166. package/lib/dist/mcp/daemon.js +221 -8
  167. package/lib/dist/mcp/daemon.js.map +1 -1
  168. package/lib/dist/mcp/dynamic-boundaries.d.ts +41 -0
  169. package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  170. package/lib/dist/mcp/dynamic-boundaries.js +359 -0
  171. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -0
  172. package/lib/dist/mcp/index.d.ts.map +1 -1
  173. package/lib/dist/mcp/index.js +18 -9
  174. package/lib/dist/mcp/index.js.map +1 -1
  175. package/lib/dist/mcp/ppid-watchdog.d.ts +44 -0
  176. package/lib/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  177. package/lib/dist/mcp/ppid-watchdog.js +27 -0
  178. package/lib/dist/mcp/ppid-watchdog.js.map +1 -0
  179. package/lib/dist/mcp/proxy.d.ts +6 -0
  180. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  181. package/lib/dist/mcp/proxy.js +153 -24
  182. package/lib/dist/mcp/proxy.js.map +1 -1
  183. package/lib/dist/mcp/server-instructions.d.ts +12 -1
  184. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  185. package/lib/dist/mcp/server-instructions.js +43 -16
  186. package/lib/dist/mcp/server-instructions.js.map +1 -1
  187. package/lib/dist/mcp/session.d.ts +2 -0
  188. package/lib/dist/mcp/session.d.ts.map +1 -1
  189. package/lib/dist/mcp/session.js +49 -2
  190. package/lib/dist/mcp/session.js.map +1 -1
  191. package/lib/dist/mcp/stdin-teardown.d.ts +27 -0
  192. package/lib/dist/mcp/stdin-teardown.d.ts.map +1 -0
  193. package/lib/dist/mcp/stdin-teardown.js +49 -0
  194. package/lib/dist/mcp/stdin-teardown.js.map +1 -0
  195. package/lib/dist/mcp/tools.d.ts +71 -0
  196. package/lib/dist/mcp/tools.d.ts.map +1 -1
  197. package/lib/dist/mcp/tools.js +703 -85
  198. package/lib/dist/mcp/tools.js.map +1 -1
  199. package/lib/dist/mcp/transport.d.ts.map +1 -1
  200. package/lib/dist/mcp/transport.js +18 -2
  201. package/lib/dist/mcp/transport.js.map +1 -1
  202. package/lib/dist/resolution/callback-synthesizer.d.ts +3 -3
  203. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  204. package/lib/dist/resolution/callback-synthesizer.js +549 -21
  205. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  206. package/lib/dist/resolution/frameworks/astro.d.ts +9 -0
  207. package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -0
  208. package/lib/dist/resolution/frameworks/astro.js +169 -0
  209. package/lib/dist/resolution/frameworks/astro.js.map +1 -0
  210. package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
  211. package/lib/dist/resolution/frameworks/expo-modules.js +6 -1
  212. package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
  213. package/lib/dist/resolution/frameworks/index.d.ts +1 -0
  214. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  215. package/lib/dist/resolution/frameworks/index.js +5 -1
  216. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  217. package/lib/dist/resolution/frameworks/java.js +6 -1
  218. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  219. package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
  220. package/lib/dist/resolution/frameworks/python.js +7 -3
  221. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  222. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  223. package/lib/dist/resolution/frameworks/react-native.js +53 -3
  224. package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
  225. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  226. package/lib/dist/resolution/frameworks/react.js +15 -3
  227. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  228. package/lib/dist/resolution/frameworks/svelte.js +5 -1
  229. package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
  230. package/lib/dist/resolution/frameworks/vue.js +24 -27
  231. package/lib/dist/resolution/frameworks/vue.js.map +1 -1
  232. package/lib/dist/resolution/import-resolver.d.ts +10 -0
  233. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  234. package/lib/dist/resolution/import-resolver.js +564 -2
  235. package/lib/dist/resolution/import-resolver.js.map +1 -1
  236. package/lib/dist/resolution/index.d.ts +80 -0
  237. package/lib/dist/resolution/index.d.ts.map +1 -1
  238. package/lib/dist/resolution/index.js +457 -7
  239. package/lib/dist/resolution/index.js.map +1 -1
  240. package/lib/dist/resolution/name-matcher.d.ts +61 -0
  241. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  242. package/lib/dist/resolution/name-matcher.js +590 -14
  243. package/lib/dist/resolution/name-matcher.js.map +1 -1
  244. package/lib/dist/resolution/types.d.ts +27 -3
  245. package/lib/dist/resolution/types.d.ts.map +1 -1
  246. package/lib/dist/resolution/workspace-packages.d.ts +48 -0
  247. package/lib/dist/resolution/workspace-packages.d.ts.map +1 -0
  248. package/lib/dist/resolution/workspace-packages.js +208 -0
  249. package/lib/dist/resolution/workspace-packages.js.map +1 -0
  250. package/lib/dist/search/query-utils.d.ts +17 -1
  251. package/lib/dist/search/query-utils.d.ts.map +1 -1
  252. package/lib/dist/search/query-utils.js +79 -10
  253. package/lib/dist/search/query-utils.js.map +1 -1
  254. package/lib/dist/sync/watcher.d.ts +124 -32
  255. package/lib/dist/sync/watcher.d.ts.map +1 -1
  256. package/lib/dist/sync/watcher.js +326 -111
  257. package/lib/dist/sync/watcher.js.map +1 -1
  258. package/lib/dist/telemetry/index.d.ts +146 -0
  259. package/lib/dist/telemetry/index.d.ts.map +1 -0
  260. package/lib/dist/telemetry/index.js +544 -0
  261. package/lib/dist/telemetry/index.js.map +1 -0
  262. package/lib/dist/types.d.ts +17 -2
  263. package/lib/dist/types.d.ts.map +1 -1
  264. package/lib/dist/types.js +3 -0
  265. package/lib/dist/types.js.map +1 -1
  266. package/lib/dist/upgrade/index.d.ts +132 -0
  267. package/lib/dist/upgrade/index.d.ts.map +1 -0
  268. package/lib/dist/upgrade/index.js +462 -0
  269. package/lib/dist/upgrade/index.js.map +1 -0
  270. package/lib/dist/utils.d.ts +30 -24
  271. package/lib/dist/utils.d.ts.map +1 -1
  272. package/lib/dist/utils.js +64 -48
  273. package/lib/dist/utils.js.map +1 -1
  274. package/lib/node_modules/.package-lock.json +1 -29
  275. package/lib/package.json +1 -2
  276. package/package.json +1 -1
  277. package/lib/node_modules/chokidar/LICENSE +0 -21
  278. package/lib/node_modules/chokidar/README.md +0 -305
  279. package/lib/node_modules/chokidar/esm/handler.d.ts +0 -90
  280. package/lib/node_modules/chokidar/esm/handler.js +0 -629
  281. package/lib/node_modules/chokidar/esm/index.d.ts +0 -215
  282. package/lib/node_modules/chokidar/esm/index.js +0 -798
  283. package/lib/node_modules/chokidar/esm/package.json +0 -1
  284. package/lib/node_modules/chokidar/handler.d.ts +0 -90
  285. package/lib/node_modules/chokidar/handler.js +0 -635
  286. package/lib/node_modules/chokidar/index.d.ts +0 -215
  287. package/lib/node_modules/chokidar/index.js +0 -804
  288. package/lib/node_modules/chokidar/package.json +0 -69
  289. package/lib/node_modules/readdirp/LICENSE +0 -21
  290. package/lib/node_modules/readdirp/README.md +0 -120
  291. package/lib/node_modules/readdirp/esm/index.d.ts +0 -108
  292. package/lib/node_modules/readdirp/esm/index.js +0 -257
  293. package/lib/node_modules/readdirp/esm/package.json +0 -1
  294. package/lib/node_modules/readdirp/index.d.ts +0 -108
  295. package/lib/node_modules/readdirp/index.js +0 -263
  296. package/lib/node_modules/readdirp/package.json +0 -70
@@ -52,6 +52,7 @@ var __importStar = (this && this.__importStar) || (function () {
52
52
  };
53
53
  })();
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.logAttachedDaemon = logAttachedDaemon;
55
56
  exports.runProxy = runProxy;
56
57
  exports.connectWithHello = connectWithHello;
57
58
  exports.runLocalHandshakeProxy = runLocalHandshakeProxy;
@@ -59,12 +60,32 @@ const fs = __importStar(require("fs"));
59
60
  const net = __importStar(require("net"));
60
61
  const wasm_runtime_flags_1 = require("../extraction/wasm-runtime-flags");
61
62
  const daemon_1 = require("./daemon");
63
+ const ppid_watchdog_1 = require("./ppid-watchdog");
64
+ const stdin_teardown_1 = require("./stdin-teardown");
62
65
  const version_1 = require("./version");
63
66
  const session_1 = require("./session");
64
67
  const server_instructions_1 = require("./server-instructions");
65
68
  const tools_1 = require("./tools");
69
+ const telemetry_1 = require("../telemetry");
66
70
  /** Default poll cadence for the PPID watchdog (same as the direct server). */
67
71
  const DEFAULT_PPID_POLL_MS = 5000;
72
+ /**
73
+ * Env var that opts INTO the "attached to shared daemon" log line. Off by
74
+ * default: the line is benign INFO, but MCP hosts render any server stderr at
75
+ * error level (and append an `undefined` data field), so on every session start
76
+ * a healthy attach showed up as `[error] … undefined`. Set to `1` to surface it
77
+ * when debugging daemon attach. (#618; approach from #640 by @mturac)
78
+ */
79
+ const LOG_ATTACH_ENV = 'CODEGRAPH_MCP_LOG_ATTACH';
80
+ /**
81
+ * Log a successful daemon attach — gated behind {@link LOG_ATTACH_ENV} so it is
82
+ * silent by default (see #618). Exported for tests.
83
+ */
84
+ function logAttachedDaemon(socketPath, hello) {
85
+ if (process.env[LOG_ATTACH_ENV] !== '1')
86
+ return;
87
+ process.stderr.write(`[CodeGraph MCP] Attached to shared daemon on ${socketPath} (pid ${hello.pid}, v${hello.codegraph}).\n`);
88
+ }
68
89
  /**
69
90
  * Attempt to connect to the daemon at `socketPath` and pipe stdio through it.
70
91
  *
@@ -102,7 +123,8 @@ async function runProxy(socketPath, expectedVersion = version_1.CodeGraphPackage
102
123
  socket.destroy();
103
124
  return { outcome: 'fallback-needed', reason: 'version mismatch' };
104
125
  }
105
- process.stderr.write(`[CodeGraph MCP] Attached to shared daemon on ${socketPath} (pid ${hello.pid}, v${hello.codegraph}).\n`);
126
+ logAttachedDaemon(socketPath, hello);
127
+ sendClientHello(socket);
106
128
  startPpidWatchdog(socket);
107
129
  await pipeUntilClose(socket);
108
130
  // Host disconnected (or the daemon went away). The proxy's only job is the
@@ -134,9 +156,30 @@ async function connectWithHello(socketPath, expectedVersion = version_1.CodeGrap
134
156
  socket.destroy();
135
157
  return 'version-mismatch';
136
158
  }
137
- process.stderr.write(`[CodeGraph MCP] Attached to shared daemon on ${socketPath} (pid ${hello.pid}, v${hello.codegraph}).\n`);
159
+ logAttachedDaemon(socketPath, hello);
160
+ sendClientHello(socket);
138
161
  return socket;
139
162
  }
163
+ /**
164
+ * Tell the daemon our pids right after we verify its hello, so its liveness
165
+ * sweep can reap this client if our process dies without the socket ever
166
+ * signalling close (the Windows named-pipe hazard behind #692). Best-effort:
167
+ * sent before any piped bytes so it's always the daemon's first line from us,
168
+ * and a write failure here is harmless (the daemon just falls back to the
169
+ * socket-close lifecycle). `hostPid` mirrors the PPID watchdog: the threaded
170
+ * host pid if set, else our own parent (the host, on a no-relaunch bundle).
171
+ */
172
+ function sendClientHello(socket) {
173
+ const clientHello = {
174
+ codegraph_client: 1,
175
+ pid: process.pid,
176
+ hostPid: parseHostPpid(process.env[wasm_runtime_flags_1.HOST_PPID_ENV]) ?? process.ppid,
177
+ };
178
+ try {
179
+ socket.write(JSON.stringify(clientHello) + '\n');
180
+ }
181
+ catch { /* best-effort */ }
182
+ }
140
183
  /**
141
184
  * Local-handshake proxy (the cold-start fix).
142
185
  *
@@ -154,10 +197,28 @@ async function runLocalHandshakeProxy(deps) {
154
197
  let daemonStatus = 'connecting';
155
198
  let daemonSocket = null;
156
199
  let clientInitId = undefined; // suppress the daemon's reply to the forwarded initialize
200
+ // Telemetry attribution for the in-process fallback only — calls routed to
201
+ // the daemon are counted by the daemon's own session (which receives the
202
+ // forwarded initialize, clientInfo included), never double-counted here.
203
+ let telemetryClient;
157
204
  const pending = []; // client lines buffered until the daemon resolves
158
205
  let engine = null;
159
206
  let engineReady = null;
160
207
  let shuttingDown = false;
208
+ // Requests forwarded to the daemon and not yet answered, keyed by JSON-RPC id.
209
+ // If the daemon dies mid-session (#662 — e.g. an MCP host SIGTERM's it when a
210
+ // new session starts), these would otherwise hang forever; we re-serve them
211
+ // in-process so the host always gets a reply.
212
+ const inflight = new Map();
213
+ const trackInflight = (line) => {
214
+ try {
215
+ const m = JSON.parse(line);
216
+ if (m && m.id !== undefined && typeof m.method === 'string' && m.method !== 'initialize') {
217
+ inflight.set(m.id, line);
218
+ }
219
+ }
220
+ catch { /* unparseable — nothing we could re-serve anyway */ }
221
+ };
161
222
  const writeClient = (obj) => {
162
223
  try {
163
224
  process.stdout.write((typeof obj === 'string' ? obj : JSON.stringify(obj)) + '\n');
@@ -201,6 +262,7 @@ async function runLocalHandshakeProxy(deps) {
201
262
  const params = (msg.params || {});
202
263
  const result = await engine.getToolHandler().execute(params.name, params.arguments || {});
203
264
  writeClient({ jsonrpc: '2.0', id, result });
265
+ (0, telemetry_1.getTelemetry)().recordUsage('mcp_tool', params.name, !result.isError, telemetryClient);
204
266
  }
205
267
  catch (err) {
206
268
  writeClient({ jsonrpc: '2.0', id, error: { code: -32603, message: err instanceof Error ? err.message : String(err) } });
@@ -209,10 +271,16 @@ async function runLocalHandshakeProxy(deps) {
209
271
  else if (msg.method === 'ping' && id !== undefined) {
210
272
  writeClient({ jsonrpc: '2.0', id, result: {} });
211
273
  }
274
+ else if (id !== undefined && msg.method !== 'initialize') {
275
+ // A request we can't serve in-process (and the daemon is gone) — answer
276
+ // with an error rather than let the host hang on a reply that won't come.
277
+ writeClient({ jsonrpc: '2.0', id, error: { code: -32603, message: 'CodeGraph daemon unavailable' } });
278
+ }
212
279
  // initialize already answered locally; notifications (initialized) need no reply.
213
280
  };
214
281
  const routeToDaemon = (line) => {
215
282
  if (daemonStatus === 'ready' && daemonSocket) {
283
+ trackInflight(line);
216
284
  try {
217
285
  daemonSocket.write(line.endsWith('\n') ? line : line + '\n');
218
286
  }
@@ -246,19 +314,40 @@ async function runLocalHandshakeProxy(deps) {
246
314
  }
247
315
  if (msg.method === 'initialize') {
248
316
  clientInitId = msg.id;
317
+ const initParams = (msg.params ?? {});
318
+ if (initParams.clientInfo) {
319
+ telemetryClient = {
320
+ name: typeof initParams.clientInfo.name === 'string' ? initParams.clientInfo.name : undefined,
321
+ version: typeof initParams.clientInfo.version === 'string' ? initParams.clientInfo.version : undefined,
322
+ };
323
+ }
249
324
  writeClient({ jsonrpc: '2.0', id: msg.id, result: { protocolVersion: session_1.PROTOCOL_VERSION, capabilities: { tools: {} }, serverInfo: session_1.SERVER_INFO, instructions: server_instructions_1.SERVER_INSTRUCTIONS } });
250
325
  routeToDaemon(line); // prime the daemon so it resolves the project (its reply is suppressed below)
251
326
  }
252
327
  else if (msg.method === 'tools/list') {
253
328
  writeClient({ jsonrpc: '2.0', id: msg.id, result: { tools: (0, tools_1.getStaticTools)() } });
254
329
  }
330
+ else if (msg.method === 'resources/list') {
331
+ // No resources exposed — answer the probe locally so it never reaches
332
+ // the daemon as an unhandled method and logs `-32601`. (#621)
333
+ writeClient({ jsonrpc: '2.0', id: msg.id, result: { resources: [] } });
334
+ }
335
+ else if (msg.method === 'resources/templates/list') {
336
+ writeClient({ jsonrpc: '2.0', id: msg.id, result: { resourceTemplates: [] } });
337
+ }
338
+ else if (msg.method === 'prompts/list') {
339
+ writeClient({ jsonrpc: '2.0', id: msg.id, result: { prompts: [] } });
340
+ }
255
341
  else {
256
342
  routeToDaemon(line);
257
343
  }
258
344
  }
259
345
  });
260
- process.stdin.on('end', shutdown);
261
- process.stdin.on('close', shutdown);
346
+ // Shut down when stdin ends/closes — and also on a stdin `'error'`, which a
347
+ // socket-backed stdin (the VS Code stdio shape) can emit on client death
348
+ // instead of a clean close; destroying the stream stops a hung fd from
349
+ // busy-spinning the event loop (#799).
350
+ (0, stdin_teardown_1.treatStdinFailureAsShutdown)(shutdown);
262
351
  startPpidWatchdogNoSocket(shutdown);
263
352
  // ---- daemon connection (background) ----
264
353
  let socket = null;
@@ -281,20 +370,45 @@ async function runLocalHandshakeProxy(deps) {
281
370
  sockBuf = sockBuf.slice(idx + 1);
282
371
  if (!line.trim())
283
372
  continue;
284
- if (clientInitId !== undefined) {
285
- try {
286
- const m = JSON.parse(line);
287
- if (m.id === clientInitId && ('result' in m || 'error' in m))
288
- continue;
289
- }
290
- catch { /* relay */ }
373
+ let resp = null;
374
+ try {
375
+ resp = JSON.parse(line);
376
+ }
377
+ catch { /* not JSON — relay verbatim */ }
378
+ if (resp && resp.id !== undefined && ('result' in resp || 'error' in resp)) {
379
+ inflight.delete(resp.id); // answered no longer in flight
380
+ // Suppress the daemon's reply to the initialize we forwarded to prime it
381
+ // (the client already got the local handshake response).
382
+ if (clientInitId !== undefined && resp.id === clientInitId)
383
+ continue;
291
384
  }
292
385
  writeClient(line);
293
386
  }
294
387
  });
295
- socket.on('close', shutdown);
296
- socket.on('error', shutdown);
388
+ // The daemon going away does NOT end the session (#662). An MCP host can
389
+ // SIGTERM the shared daemon when another session starts; if we exited here,
390
+ // this host would silently lose CodeGraph and any in-flight request would
391
+ // hang. Instead, fall back to the in-process engine for the rest of the
392
+ // session and re-serve whatever the dead daemon never answered.
393
+ const onDaemonLost = () => {
394
+ if (shuttingDown || daemonStatus !== 'ready')
395
+ return; // host teardown, or already handled
396
+ daemonStatus = 'failed';
397
+ try {
398
+ daemonSocket?.destroy();
399
+ }
400
+ catch { /* ignore */ }
401
+ daemonSocket = null;
402
+ process.stderr.write(`[CodeGraph MCP] Shared daemon connection lost; serving this session in-process (degraded), re-serving ${inflight.size} in-flight request(s).\n`);
403
+ const orphaned = [...inflight.values()];
404
+ inflight.clear();
405
+ for (const line of orphaned)
406
+ void handleLocally(line);
407
+ };
408
+ socket.on('close', onDaemonLost);
409
+ socket.on('error', onDaemonLost);
297
410
  for (const line of pending) {
411
+ trackInflight(line);
298
412
  try {
299
413
  socket.write(line + '\n');
300
414
  }
@@ -321,8 +435,14 @@ function startPpidWatchdogNoSocket(onDeath) {
321
435
  const originalPpid = process.ppid;
322
436
  const hostPpid = parseHostPpid(process.env[wasm_runtime_flags_1.HOST_PPID_ENV]);
323
437
  const timer = setInterval(() => {
324
- if (process.ppid !== originalPpid || (hostPpid !== null && !isProcessAliveLocal(hostPpid))) {
325
- process.stderr.write('[CodeGraph MCP] Parent process exited; shutting down.\n');
438
+ const reason = (0, ppid_watchdog_1.supervisionLostReason)({
439
+ originalPpid,
440
+ currentPpid: process.ppid,
441
+ hostPpid,
442
+ isAlive: isProcessAliveLocal,
443
+ });
444
+ if (reason) {
445
+ process.stderr.write(`[CodeGraph MCP] Parent process exited (${reason}); shutting down.\n`);
326
446
  onDeath();
327
447
  }
328
448
  }, pollMs);
@@ -412,13 +532,22 @@ function pipeUntilClose(socket) {
412
532
  catch { /* ignore */ }
413
533
  done();
414
534
  });
415
- process.stdin.on('close', () => {
535
+ // 'close' and 'error' both tear down: a socket-backed stdin can fail with
536
+ // an 'error' (ECONNRESET/hangup) rather than a clean close; destroying it
537
+ // stops a hung fd from busy-spinning the event loop (#799).
538
+ const teardown = () => {
539
+ try {
540
+ process.stdin.destroy();
541
+ }
542
+ catch { /* ignore */ }
416
543
  try {
417
544
  socket.destroy();
418
545
  }
419
546
  catch { /* ignore */ }
420
547
  done();
421
- });
548
+ };
549
+ process.stdin.on('close', teardown);
550
+ process.stdin.on('error', teardown);
422
551
  socket.on('data', (chunk) => {
423
552
  try {
424
553
  process.stdout.write(chunk);
@@ -449,13 +578,13 @@ function startPpidWatchdog(socket) {
449
578
  const originalPpid = process.ppid;
450
579
  const hostPpid = parseHostPpid(process.env[wasm_runtime_flags_1.HOST_PPID_ENV]);
451
580
  const timer = setInterval(() => {
452
- const current = process.ppid;
453
- const ppidChanged = current !== originalPpid;
454
- const hostGone = hostPpid !== null && !isProcessAliveLocal(hostPpid);
455
- if (ppidChanged || hostGone) {
456
- const reason = ppidChanged
457
- ? `ppid ${originalPpid} -> ${current}`
458
- : `host pid ${hostPpid} exited`;
581
+ const reason = (0, ppid_watchdog_1.supervisionLostReason)({
582
+ originalPpid,
583
+ currentPpid: process.ppid,
584
+ hostPpid,
585
+ isAlive: isProcessAliveLocal,
586
+ });
587
+ if (reason) {
459
588
  process.stderr.write(`[CodeGraph MCP] Parent process exited (${reason}); shutting down.\n`);
460
589
  try {
461
590
  socket.destroy();
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/mcp/proxy.ts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,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,oBAAoB,CAAC;IAC1D,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,oBAAoB,CAAC;IAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,aAAa,CAAC,GAAuB;IAC5C,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW;IACtC,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,GAA4B,CAAC;QACvC,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -15,5 +15,16 @@
15
15
  * burn tokens. Reference only tools that exist on `main`; gate any
16
16
  * conditional tools behind feature checks if/when they ship.
17
17
  */
18
- export declare const SERVER_INSTRUCTIONS = "# Codegraph \u2014 code intelligence over an indexed knowledge graph\n\nCodegraph is a SQLite knowledge graph of every symbol, edge, and file\nin the workspace. Reads are sub-millisecond; the index lags writes by\nabout a second through the file watcher. Consult it BEFORE writing or\nediting code, not during.\n\n## Answer directly \u2014 don't delegate exploration\n\nFor \"how does X work\", architecture, trace, or where-is-X questions,\nanswer DIRECTLY \u2014 usually with ONE `codegraph_explore` call.\n`codegraph_explore` takes either a natural-language question or a bag of\nsymbol/file names and returns the verbatim source of the relevant symbols\ngrouped by file, so it is Read-equivalent and most often the ONLY\ncodegraph call you need. Codegraph IS the pre-built search index \u2014 so\ndelegating the lookup to a separate file-reading sub-task/agent, or\nrunning your own grep + read loop, repeats work codegraph already did and\ncosts more for the same answer. Reach for raw Read/Grep only to confirm a\nspecific detail codegraph didn't cover. A direct codegraph answer is\ntypically one to a few calls; a grep/read exploration is dozens.\n\n## Tool selection by intent\n\n- **Almost any question \u2014 \"how does X work\", architecture, a bug, \"what/where is X\", or surveying an area** \u2192 `codegraph_explore` (PRIMARY \u2014 call FIRST; ONE capped call returns the verbatim source of the relevant symbols grouped by file; most often the ONLY call you need)\n- **\"How does X reach/become Y? / the flow / the path from X to Y\"** \u2192 `codegraph_explore`, naming the symbols that span the flow (e.g. `mutateElement renderScene`) \u2014 it surfaces the call path among them, including dynamic-dispatch hops (callbacks, React re-render, JSX children) grep can't follow\n- **\"What is the symbol named X?\" (just its location)** \u2192 `codegraph_search`\n- **\"What calls this?\" / \"What does this call?\" / \"What would changing this break?\"** \u2192 `codegraph_callers` / `codegraph_callees` / `codegraph_impact`\n- **One specific symbol's full source (esp. a body `codegraph_explore` trimmed), or an OVERLOADED name** \u2192 `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\n- **\"What's in directory X?\"** \u2192 `codegraph_files`\n- **\"Is the index ready / what's its size?\"** \u2192 `codegraph_status`\n\n## Common chains\n\n- **Flow / \"how does X reach Y\"**: ONE `codegraph_explore` with the symbol names spanning the flow \u2014 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`.\n- **Onboarding / understanding any area**: ONE `codegraph_explore` is usually the whole answer. Only follow up \u2014 `codegraph_node` for a specific symbol \u2014 if something is still unclear.\n- **Refactor planning**: `codegraph_search` \u2192 `codegraph_callers` \u2192 `codegraph_impact`. The blast-radius answer comes from impact, not from walking callers manually.\n- **Debugging a regression**: `codegraph_callers` of the suspected symbol; widen with `codegraph_impact` if an unexpected call appears.\n\n## Anti-patterns\n\n- **Trust codegraph's results \u2014 don't re-verify them with grep.** They come from a full AST parse; re-checking with grep is slower, less accurate, and wastes context.\n- **Don't grep first** when looking up a symbol by name \u2014 `codegraph_search` is faster and returns kind + location + signature.\n- **Don't chain `codegraph_search` + `codegraph_node`** to understand an area \u2014 ONE `codegraph_explore` returns the relevant symbols' source together in a single round-trip.\n- **Don't loop `codegraph_node` over many symbols** \u2014 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.\n- **After editing, check the staleness banner.** When a tool response starts with \"\u26A0\uFE0F Some files referenced below were edited since the last index sync\u2026\", the listed files are pending re-index \u2014 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\".\n\n## Limitations\n\n- If a tool reports the project isn't initialized, `.codegraph/` doesn't exist yet \u2014 offer to run `codegraph init -i` to build the index.\n- Index lags file writes by ~1 second.\n- Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.\n- No live correctness validation \u2014 that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.\n";
18
+ export declare const SERVER_INSTRUCTIONS = "# Codegraph \u2014 code intelligence over an indexed knowledge graph\n\nCodegraph is a SQLite knowledge graph of every symbol, edge, and file in\nthe workspace \u2014 pre-computed structure you would otherwise re-derive by\nreading files (cached intelligence: thousands of parse/trace decisions you\ndon't pay to re-reason each run). Reads are sub-millisecond; the index lags\nwrites by ~1s through the file watcher. Reach for it BEFORE *and* while\nwriting or editing code \u2014 not just for questions: one call returns the\nverbatim source PLUS who calls it and what it affects, so you edit with the\nblast radius in view. More accurate context, in far fewer tokens and\nround-trips than reading files yourself.\n\n## Use codegraph instead of reading files \u2014 for questions AND edits\n\nWhether you're answering \"how does X work\" or implementing a change (fixing\na bug, adding a feature), reach for codegraph before you Read. For\nunderstanding, answer DIRECTLY \u2014 usually with ONE `codegraph_explore` call.\n`codegraph_explore` takes either a natural-language question or a bag of\nsymbol/file names and returns the verbatim source of the relevant symbols\ngrouped by file, so it is Read-equivalent and most often the ONLY\ncodegraph call you need. Codegraph IS the pre-built search index \u2014 so\ndelegating the lookup to a separate file-reading sub-task/agent, or\nrunning your own grep + read loop, repeats work codegraph already did and\ncosts more for the same answer. Reach for raw Read/Grep only to confirm a\nspecific detail codegraph didn't cover. A direct codegraph answer is\ntypically one to a few calls; a grep/read exploration is dozens.\n\n## Tool selection by intent\n\n- **Almost any question \u2014 \"how does X work\", architecture, a bug, \"what/where is X\", or surveying an area** \u2192 `codegraph_explore` (PRIMARY \u2014 call FIRST; ONE capped call returns the verbatim source of the relevant symbols grouped by file; most often the ONLY call you need)\n- **\"How does X reach/become Y? / the flow / the path from X to Y\"** \u2192 `codegraph_explore`, naming the symbols that span the flow (e.g. `mutateElement renderScene`) \u2014 it surfaces the call path among them, including dynamic-dispatch hops (callbacks, React re-render, JSX children) grep can't follow\n- **\"What is the symbol named X?\" (just its location)** \u2192 `codegraph_search`\n- **\"What calls this?\" / \"What would changing this break?\"** \u2192 `codegraph_callers` \u2014 EVERY call site with file:line, including where a function is **registered as a callback** (passed as an argument, assigned to a function pointer/field, listed in a handler table) \u2014 labeled \"via callback registration\" \u2014 so a function with no direct calls is NOT dead if it's wired up somewhere. When several UNRELATED symbols share a name (one `UserService` per monorepo app), it reports **one section per definition** (never a merged list) \u2014 pass `file` to focus the definition you mean. The wider blast radius arrives automatically on `codegraph_explore` (its \"Blast radius\" section) and `codegraph_node` (the dependents note)\n- **\"What does this call?\"** \u2192 `codegraph_node` with that symbol and `includeCode: true` \u2014 the body IS the callee list, and the caller/callee trail comes with it\n- **Reading a source FILE (any time you'd use the `Read` tool)** \u2192 `codegraph_node` with a `file` path and no `symbol`. It returns the file's **current source with line numbers \u2014 the same `<n>\\t<line>` shape `Read` gives you, safe to `Edit` from** \u2014 narrowable with `offset`/`limit` exactly like `Read`, PLUS a one-line note of which files depend on it. Same bytes as `Read`, faster (served from the index), with the blast radius attached. Use it **instead of `Read`** for indexed source files; fall back to `Read` only for what codegraph doesn't index (configs, docs). Pass `symbolsOnly: true` for just the file's structure.\n- **About to read or edit a symbol you can name** \u2192 `codegraph_node` with that `symbol` (SECONDARY \u2014 the after-explore depth tool): the verbatim source (`includeCode: true`) PLUS its caller/callee trail, so before changing it you see what calls it and what your edit would break. For an OVERLOADED name it returns EVERY matching definition's body in one call, so you never Read a file to find the right overload\n\n## Common chains\n\n- **Flow / \"how does X reach Y\"**: ONE `codegraph_explore` with the symbol names spanning the flow \u2014 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`.\n- **Onboarding / understanding any area**: ONE `codegraph_explore` is usually the whole answer. Only follow up \u2014 `codegraph_node` for a specific symbol \u2014 if something is still unclear.\n- **Refactor planning**: `codegraph_callers` for the complete call-site list to update; the wider blast radius is already attached to `codegraph_explore` / `codegraph_node` output.\n- **Debugging a regression**: `codegraph_callers` of the suspected symbol; `codegraph_node` on anything unexpected that appears.\n\n## Anti-patterns\n\n- **Trust codegraph's results \u2014 don't re-verify them with grep.** They come from a full AST parse; re-checking with grep is slower, less accurate, and wastes context.\n- **Don't grep first** when looking up a symbol by name \u2014 `codegraph_search` is faster and returns kind + location + signature.\n- **Don't chain `codegraph_search` + `codegraph_node`** to understand an area \u2014 ONE `codegraph_explore` returns the relevant symbols' source together in a single round-trip.\n- **Don't loop `codegraph_node` over many symbols** \u2014 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.\n- **Don't reach for the `Read` tool on an indexed source file** \u2014 `codegraph_node` with a `file` reads it for you (same `<n>\\t<line>` source, `offset`/`limit` like Read, faster, with its blast radius), and with a `symbol` it returns the source plus the caller/callee trail. Reach for raw `Read` only for what codegraph doesn't index (configs, docs) or when the staleness banner flags a file as pending re-index.\n- **After editing, check the staleness banner.** When a tool response starts with \"\u26A0\uFE0F Some files referenced below were edited since the last index sync\u2026\", the listed files are pending re-index \u2014 Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust codegraph.\n\n## Limitations\n\n- If a tool reports a project isn't indexed (no `.codegraph/`), stop calling codegraph tools for that project for the rest of the session and use your built-in tools there instead. Indexing is the user's decision \u2014 mention they can run `codegraph init` if it comes up, but don't run it yourself.\n- Index lags file writes by ~1 second.\n- Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.\n- No live correctness validation \u2014 that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.\n";
19
+ /**
20
+ * Instructions variant sent when the workspace has NO codegraph index.
21
+ *
22
+ * Sending the full playbook ("lean on codegraph for everything") into a
23
+ * session where every call would fail wastes the agent's calls and — worse —
24
+ * the failures teach it codegraph is broken. The unindexed variant is a
25
+ * short, unambiguous "inactive this session" note; `tools/list` is gated to
26
+ * empty in the same state, so the agent has nothing to mis-call. Indexing is
27
+ * deliberately left to the user: the agent is told NOT to run init itself.
28
+ */
29
+ export declare const SERVER_INSTRUCTIONS_UNINDEXED = "# Codegraph \u2014 inactive (workspace not indexed)\n\nThis workspace has no codegraph index (no `.codegraph/` directory), so no\ncodegraph tools are available this session. Work with your built-in tools as\nusual.\n\nIndexing is the user's decision \u2014 do not run it yourself. If the user asks\nabout codegraph, they can enable it by running `codegraph init` in the\nproject root and starting a new session.\n";
19
30
  //# sourceMappingURL=server-instructions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mBAAmB,0yJAoD/B,CAAC"}
1
+ {"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mBAAmB,wqOA2D/B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,6BAA6B,kaASzC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SERVER_INSTRUCTIONS = void 0;
3
+ exports.SERVER_INSTRUCTIONS_UNINDEXED = exports.SERVER_INSTRUCTIONS = void 0;
4
4
  /**
5
5
  * Server-level instructions emitted in the MCP `initialize` response.
6
6
  *
@@ -20,15 +20,21 @@ exports.SERVER_INSTRUCTIONS = void 0;
20
20
  */
21
21
  exports.SERVER_INSTRUCTIONS = `# Codegraph — code intelligence over an indexed knowledge graph
22
22
 
23
- Codegraph is a SQLite knowledge graph of every symbol, edge, and file
24
- in the workspace. Reads are sub-millisecond; the index lags writes by
25
- about a second through the file watcher. Consult it BEFORE writing or
26
- editing code, not during.
23
+ Codegraph is a SQLite knowledge graph of every symbol, edge, and file in
24
+ the workspace pre-computed structure you would otherwise re-derive by
25
+ reading files (cached intelligence: thousands of parse/trace decisions you
26
+ don't pay to re-reason each run). Reads are sub-millisecond; the index lags
27
+ writes by ~1s through the file watcher. Reach for it BEFORE *and* while
28
+ writing or editing code — not just for questions: one call returns the
29
+ verbatim source PLUS who calls it and what it affects, so you edit with the
30
+ blast radius in view. More accurate context, in far fewer tokens and
31
+ round-trips than reading files yourself.
27
32
 
28
- ## Answer directlydon't delegate exploration
33
+ ## Use codegraph instead of reading files for questions AND edits
29
34
 
30
- For "how does X work", architecture, trace, or where-is-X questions,
31
- answer DIRECTLY usually with ONE \`codegraph_explore\` call.
35
+ Whether you're answering "how does X work" or implementing a change (fixing
36
+ a bug, adding a feature), reach for codegraph before you Read. For
37
+ understanding, answer DIRECTLY — usually with ONE \`codegraph_explore\` call.
32
38
  \`codegraph_explore\` takes either a natural-language question or a bag of
33
39
  symbol/file names and returns the verbatim source of the relevant symbols
34
40
  grouped by file, so it is Read-equivalent and most often the ONLY
@@ -44,17 +50,17 @@ typically one to a few calls; a grep/read exploration is dozens.
44
50
  - **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
51
  - **"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
52
  - **"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
49
- - **"What's in directory X?"** → \`codegraph_files\`
50
- - **"Is the index ready / what's its size?"** \`codegraph_status\`
53
+ - **"What calls this?" / "What would changing this break?"** → \`codegraph_callers\` — EVERY call site with file:line, including where a function is **registered as a callback** (passed as an argument, assigned to a function pointer/field, listed in a handler table) — labeled "via callback registration" so a function with no direct calls is NOT dead if it's wired up somewhere. When several UNRELATED symbols share a name (one \`UserService\` per monorepo app), it reports **one section per definition** (never a merged list) — pass \`file\` to focus the definition you mean. The wider blast radius arrives automatically on \`codegraph_explore\` (its "Blast radius" section) and \`codegraph_node\` (the dependents note)
54
+ - **"What does this call?"** → \`codegraph_node\` with that symbol and \`includeCode: true\` the body IS the callee list, and the caller/callee trail comes with it
55
+ - **Reading a source FILE (any time you'd use the \`Read\` tool)** → \`codegraph_node\` with a \`file\` path and no \`symbol\`. It returns the file's **current source with line numbers — the same \`<n>\\t<line>\` shape \`Read\` gives you, safe to \`Edit\` from** — narrowable with \`offset\`/\`limit\` exactly like \`Read\`, PLUS a one-line note of which files depend on it. Same bytes as \`Read\`, faster (served from the index), with the blast radius attached. Use it **instead of \`Read\`** for indexed source files; fall back to \`Read\` only for what codegraph doesn't index (configs, docs). Pass \`symbolsOnly: true\` for just the file's structure.
56
+ - **About to read or edit a symbol you can name** → \`codegraph_node\` with that \`symbol\` (SECONDARY — the after-explore depth tool): the verbatim source (\`includeCode: true\`) PLUS its caller/callee trail, so before changing it you see what calls it and what your edit would break. For an OVERLOADED name it returns EVERY matching definition's body in one call, so you never Read a file to find the right overload
51
57
 
52
58
  ## Common chains
53
59
 
54
60
  - **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
61
  - **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
- - **Refactor planning**: \`codegraph_search\` \`codegraph_callers\` \`codegraph_impact\`. The blast-radius answer comes from impact, not from walking callers manually.
57
- - **Debugging a regression**: \`codegraph_callers\` of the suspected symbol; widen with \`codegraph_impact\` if an unexpected call appears.
62
+ - **Refactor planning**: \`codegraph_callers\` for the complete call-site list to update; the wider blast radius is already attached to \`codegraph_explore\` / \`codegraph_node\` output.
63
+ - **Debugging a regression**: \`codegraph_callers\` of the suspected symbol; \`codegraph_node\` on anything unexpected that appears.
58
64
 
59
65
  ## Anti-patterns
60
66
 
@@ -62,13 +68,34 @@ typically one to a few calls; a grep/read exploration is dozens.
62
68
  - **Don't grep first** when looking up a symbol by name — \`codegraph_search\` is faster and returns kind + location + signature.
63
69
  - **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.
64
70
  - **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.
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".
71
+ - **Don't reach for the \`Read\` tool on an indexed source file** — \`codegraph_node\` with a \`file\` reads it for you (same \`<n>\\t<line>\` source, \`offset\`/\`limit\` like Read, faster, with its blast radius), and with a \`symbol\` it returns the source plus the caller/callee trail. Reach for raw \`Read\` only for what codegraph doesn't index (configs, docs) or when the staleness banner flags a file as pending re-index.
72
+ - **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.
66
73
 
67
74
  ## Limitations
68
75
 
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.
76
+ - If a tool reports a project isn't indexed (no \`.codegraph/\`), stop calling codegraph tools for that project for the rest of the session and use your built-in tools there instead. Indexing is the user's decisionmention they can run \`codegraph init\` if it comes up, but don't run it yourself.
70
77
  - Index lags file writes by ~1 second.
71
78
  - Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.
72
79
  - 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.
73
80
  `;
81
+ /**
82
+ * Instructions variant sent when the workspace has NO codegraph index.
83
+ *
84
+ * Sending the full playbook ("lean on codegraph for everything") into a
85
+ * session where every call would fail wastes the agent's calls and — worse —
86
+ * the failures teach it codegraph is broken. The unindexed variant is a
87
+ * short, unambiguous "inactive this session" note; `tools/list` is gated to
88
+ * empty in the same state, so the agent has nothing to mis-call. Indexing is
89
+ * deliberately left to the user: the agent is told NOT to run init itself.
90
+ */
91
+ exports.SERVER_INSTRUCTIONS_UNINDEXED = `# Codegraph — inactive (workspace not indexed)
92
+
93
+ This workspace has no codegraph index (no \`.codegraph/\` directory), so no
94
+ codegraph tools are available this session. Work with your built-in tools as
95
+ usual.
96
+
97
+ Indexing is the user's decision — do not run it yourself. If the user asks
98
+ about codegraph, they can enable it by running \`codegraph init\` in the
99
+ project root and starting a new session.
100
+ `;
74
101
  //# sourceMappingURL=server-instructions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDlC,CAAC"}
1
+ {"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DlC,CAAC;AAEF;;;;;;;;;GASG;AACU,QAAA,6BAA6B,GAAG;;;;;;;;;CAS5C,CAAC"}
@@ -39,6 +39,8 @@ export declare class MCPSession {
39
39
  private transport;
40
40
  private engine;
41
41
  private clientSupportsRoots;
42
+ /** From the initialize handshake — attributes usage rollups to the agent host. */
43
+ private clientInfo;
42
44
  private rootsAttempted;
43
45
  private resolvePromise;
44
46
  private explicitProjectPath;
@@ -1 +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,UAA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