@monoes/monomindcli 2.8.4 → 2.9.1

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 (363) hide show
  1. package/.claude/helpers/auto-memory-hook.mjs +0 -0
  2. package/.claude/helpers/handlers/route-handler.cjs +12 -0
  3. package/.claude/helpers/handlers/session-restore-handler.cjs +28 -7
  4. package/.claude/helpers/hook-handler.cjs +0 -0
  5. package/.claude/helpers/utils/micro-agents.cjs +22 -0
  6. package/.claude/skills/monodesign/scripts/live/sveltekit-adapter.mjs +11 -6
  7. package/.claude/skills/monodesign/scripts/live-inject.mjs +20 -7
  8. package/.claude/skills/monodesign/scripts/live-server.mjs +38 -2
  9. package/LICENSE +191 -0
  10. package/README.md +8 -6
  11. package/dist/src/browser/dashboard/server.d.ts +5 -0
  12. package/dist/src/browser/dashboard/server.d.ts.map +1 -1
  13. package/dist/src/browser/dashboard/server.js +59 -4
  14. package/dist/src/browser/dashboard/server.js.map +1 -1
  15. package/dist/src/browser/dashboard/ui.html +18 -8
  16. package/dist/src/browser/workflow/store.d.ts.map +1 -1
  17. package/dist/src/browser/workflow/store.js +3 -2
  18. package/dist/src/browser/workflow/store.js.map +1 -1
  19. package/dist/src/capabilities/cap-documents.d.ts.map +1 -1
  20. package/dist/src/capabilities/cap-documents.js +14 -9
  21. package/dist/src/capabilities/cap-documents.js.map +1 -1
  22. package/dist/src/commands/doctor.d.ts.map +1 -1
  23. package/dist/src/commands/doctor.js +22 -18
  24. package/dist/src/commands/doctor.js.map +1 -1
  25. package/dist/src/commands/download-embeddings.d.ts +8 -0
  26. package/dist/src/commands/download-embeddings.d.ts.map +1 -0
  27. package/dist/src/commands/download-embeddings.js +34 -0
  28. package/dist/src/commands/download-embeddings.js.map +1 -0
  29. package/dist/src/commands/hooks.d.ts.map +1 -1
  30. package/dist/src/commands/hooks.js +14 -0
  31. package/dist/src/commands/hooks.js.map +1 -1
  32. package/dist/src/commands/index.d.ts.map +1 -1
  33. package/dist/src/commands/index.js +4 -0
  34. package/dist/src/commands/index.js.map +1 -1
  35. package/dist/src/commands/init-wizard.js +1 -1
  36. package/dist/src/commands/init-wizard.js.map +1 -1
  37. package/dist/src/commands/init.d.ts.map +1 -1
  38. package/dist/src/commands/init.js +48 -1
  39. package/dist/src/commands/init.js.map +1 -1
  40. package/dist/src/commands/monograph.d.ts.map +1 -1
  41. package/dist/src/commands/monograph.js +35 -1
  42. package/dist/src/commands/monograph.js.map +1 -1
  43. package/dist/src/commands/org-observe.d.ts +10 -0
  44. package/dist/src/commands/org-observe.d.ts.map +1 -1
  45. package/dist/src/commands/org-observe.js +195 -31
  46. package/dist/src/commands/org-observe.js.map +1 -1
  47. package/dist/src/commands/org.d.ts +1 -0
  48. package/dist/src/commands/org.d.ts.map +1 -1
  49. package/dist/src/commands/org.js +139 -3
  50. package/dist/src/commands/org.js.map +1 -1
  51. package/dist/src/commands/route.d.ts +1 -9
  52. package/dist/src/commands/route.d.ts.map +1 -1
  53. package/dist/src/commands/route.js +42 -65
  54. package/dist/src/commands/route.js.map +1 -1
  55. package/dist/src/commands/security-cve.d.ts.map +1 -1
  56. package/dist/src/commands/security-cve.js +2 -1
  57. package/dist/src/commands/security-cve.js.map +1 -1
  58. package/dist/src/index.d.ts +0 -10
  59. package/dist/src/index.d.ts.map +1 -1
  60. package/dist/src/index.js +4 -15
  61. package/dist/src/index.js.map +1 -1
  62. package/dist/src/init/copy-assets.d.ts +17 -0
  63. package/dist/src/init/copy-assets.d.ts.map +1 -0
  64. package/dist/src/init/copy-assets.js +271 -0
  65. package/dist/src/init/copy-assets.js.map +1 -0
  66. package/dist/src/init/executor.d.ts +2 -30
  67. package/dist/src/init/executor.d.ts.map +1 -1
  68. package/dist/src/init/executor.js +56 -2493
  69. package/dist/src/init/executor.js.map +1 -1
  70. package/dist/src/init/helpers-generator.d.ts.map +1 -1
  71. package/dist/src/init/helpers-generator.js +9 -0
  72. package/dist/src/init/helpers-generator.js.map +1 -1
  73. package/dist/src/init/settings-generator.d.ts.map +1 -1
  74. package/dist/src/init/settings-generator.js +0 -4
  75. package/dist/src/init/settings-generator.js.map +1 -1
  76. package/dist/src/init/shared.d.ts +112 -0
  77. package/dist/src/init/shared.d.ts.map +1 -0
  78. package/dist/src/init/shared.js +475 -0
  79. package/dist/src/init/shared.js.map +1 -0
  80. package/dist/src/init/statusline-generator.d.ts.map +1 -1
  81. package/dist/src/init/statusline-generator.js +37 -0
  82. package/dist/src/init/statusline-generator.js.map +1 -1
  83. package/dist/src/init/types.d.ts +1 -1
  84. package/dist/src/init/types.d.ts.map +1 -1
  85. package/dist/src/init/upgrade.d.ts +34 -0
  86. package/dist/src/init/upgrade.d.ts.map +1 -0
  87. package/dist/src/init/upgrade.js +477 -0
  88. package/dist/src/init/upgrade.js.map +1 -0
  89. package/dist/src/init/write-antigravity.d.ts +13 -0
  90. package/dist/src/init/write-antigravity.d.ts.map +1 -0
  91. package/dist/src/init/write-antigravity.js +117 -0
  92. package/dist/src/init/write-antigravity.js.map +1 -0
  93. package/dist/src/init/write-capabilities.d.ts +9 -0
  94. package/dist/src/init/write-capabilities.d.ts.map +1 -0
  95. package/dist/src/init/write-capabilities.js +392 -0
  96. package/dist/src/init/write-capabilities.js.map +1 -0
  97. package/dist/src/init/write-claude.d.ts +25 -0
  98. package/dist/src/init/write-claude.d.ts.map +1 -0
  99. package/dist/src/init/write-claude.js +279 -0
  100. package/dist/src/init/write-claude.js.map +1 -0
  101. package/dist/src/init/write-kimicode.d.ts +19 -0
  102. package/dist/src/init/write-kimicode.d.ts.map +1 -0
  103. package/dist/src/init/write-kimicode.js +223 -0
  104. package/dist/src/init/write-kimicode.js.map +1 -0
  105. package/dist/src/init/write-opencode.d.ts +14 -0
  106. package/dist/src/init/write-opencode.d.ts.map +1 -0
  107. package/dist/src/init/write-opencode.js +130 -0
  108. package/dist/src/init/write-opencode.js.map +1 -0
  109. package/dist/src/init/write-runtime-config.d.ts +14 -0
  110. package/dist/src/init/write-runtime-config.d.ts.map +1 -0
  111. package/dist/src/init/write-runtime-config.js +214 -0
  112. package/dist/src/init/write-runtime-config.js.map +1 -0
  113. package/dist/src/init/write-sample-org.d.ts +9 -0
  114. package/dist/src/init/write-sample-org.d.ts.map +1 -0
  115. package/dist/src/init/write-sample-org.js +39 -0
  116. package/dist/src/init/write-sample-org.js.map +1 -0
  117. package/dist/src/knowledge/eval/golden-set.js +1 -1
  118. package/dist/src/knowledge/eval/golden-set.js.map +1 -1
  119. package/dist/src/mcp-tools/analyze-tools.d.ts.map +1 -1
  120. package/dist/src/mcp-tools/analyze-tools.js +2 -25
  121. package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
  122. package/dist/src/mcp-tools/auto-install.d.ts.map +1 -1
  123. package/dist/src/mcp-tools/auto-install.js +2 -1
  124. package/dist/src/mcp-tools/auto-install.js.map +1 -1
  125. package/dist/src/mcp-tools/hooks-routing.d.ts.map +1 -1
  126. package/dist/src/mcp-tools/hooks-routing.js +26 -0
  127. package/dist/src/mcp-tools/hooks-routing.js.map +1 -1
  128. package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
  129. package/dist/src/mcp-tools/memory-tools.js +2 -37
  130. package/dist/src/mcp-tools/memory-tools.js.map +1 -1
  131. package/dist/src/mcp-tools/monograph/agent-history-tools.d.ts +5 -0
  132. package/dist/src/mcp-tools/monograph/agent-history-tools.d.ts.map +1 -0
  133. package/dist/src/mcp-tools/monograph/agent-history-tools.js +177 -0
  134. package/dist/src/mcp-tools/monograph/agent-history-tools.js.map +1 -0
  135. package/dist/src/mcp-tools/monograph/build-tools.d.ts +9 -0
  136. package/dist/src/mcp-tools/monograph/build-tools.d.ts.map +1 -0
  137. package/dist/src/mcp-tools/monograph/build-tools.js +299 -0
  138. package/dist/src/mcp-tools/monograph/build-tools.js.map +1 -0
  139. package/dist/src/mcp-tools/monograph/group-tools.d.ts +10 -0
  140. package/dist/src/mcp-tools/monograph/group-tools.d.ts.map +1 -0
  141. package/dist/src/mcp-tools/monograph/group-tools.js +225 -0
  142. package/dist/src/mcp-tools/monograph/group-tools.js.map +1 -0
  143. package/dist/src/mcp-tools/monograph/health-tools.d.ts +6 -0
  144. package/dist/src/mcp-tools/monograph/health-tools.d.ts.map +1 -0
  145. package/dist/src/mcp-tools/monograph/health-tools.js +113 -0
  146. package/dist/src/mcp-tools/monograph/health-tools.js.map +1 -0
  147. package/dist/src/mcp-tools/monograph/impact-tools.d.ts +9 -0
  148. package/dist/src/mcp-tools/monograph/impact-tools.d.ts.map +1 -0
  149. package/dist/src/mcp-tools/monograph/impact-tools.js +532 -0
  150. package/dist/src/mcp-tools/monograph/impact-tools.js.map +1 -0
  151. package/dist/src/mcp-tools/monograph/index.d.ts +10 -0
  152. package/dist/src/mcp-tools/monograph/index.d.ts.map +1 -0
  153. package/dist/src/mcp-tools/monograph/index.js +73 -0
  154. package/dist/src/mcp-tools/monograph/index.js.map +1 -0
  155. package/dist/src/mcp-tools/monograph/query-tools.d.ts +11 -0
  156. package/dist/src/mcp-tools/monograph/query-tools.d.ts.map +1 -0
  157. package/dist/src/mcp-tools/monograph/query-tools.js +500 -0
  158. package/dist/src/mcp-tools/monograph/query-tools.js.map +1 -0
  159. package/dist/src/mcp-tools/monograph/shared.d.ts +64 -0
  160. package/dist/src/mcp-tools/monograph/shared.d.ts.map +1 -0
  161. package/dist/src/mcp-tools/monograph/shared.js +215 -0
  162. package/dist/src/mcp-tools/monograph/shared.js.map +1 -0
  163. package/dist/src/mcp-tools/monograph/visualize-tools.d.ts +10 -0
  164. package/dist/src/mcp-tools/monograph/visualize-tools.d.ts.map +1 -0
  165. package/dist/src/mcp-tools/monograph/visualize-tools.js +382 -0
  166. package/dist/src/mcp-tools/monograph/visualize-tools.js.map +1 -0
  167. package/dist/src/mcp-tools/monograph-tools.d.ts +4 -23
  168. package/dist/src/mcp-tools/monograph-tools.d.ts.map +1 -1
  169. package/dist/src/mcp-tools/monograph-tools.js +4 -2439
  170. package/dist/src/mcp-tools/monograph-tools.js.map +1 -1
  171. package/dist/src/mcp-tools/monomind-tools.d.ts +8 -0
  172. package/dist/src/mcp-tools/monomind-tools.d.ts.map +1 -1
  173. package/dist/src/mcp-tools/monomind-tools.js +13 -1
  174. package/dist/src/mcp-tools/monomind-tools.js.map +1 -1
  175. package/dist/src/mcp-tools/quality/security-compliance/detect-secrets.d.ts.map +1 -1
  176. package/dist/src/mcp-tools/quality/security-compliance/detect-secrets.js +31 -2
  177. package/dist/src/mcp-tools/quality/security-compliance/detect-secrets.js.map +1 -1
  178. package/dist/src/mcp-tools/terminal-tools.d.ts.map +1 -1
  179. package/dist/src/mcp-tools/terminal-tools.js +31 -1
  180. package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
  181. package/dist/src/mcp-tools/types.d.ts +8 -27
  182. package/dist/src/mcp-tools/types.d.ts.map +1 -1
  183. package/dist/src/mcp-tools/types.js +9 -91
  184. package/dist/src/mcp-tools/types.js.map +1 -1
  185. package/dist/src/memory/file-permissions.d.ts +15 -0
  186. package/dist/src/memory/file-permissions.d.ts.map +1 -0
  187. package/dist/src/memory/file-permissions.js +25 -0
  188. package/dist/src/memory/file-permissions.js.map +1 -0
  189. package/dist/src/memory/memory-bridge.d.ts.map +1 -1
  190. package/dist/src/memory/memory-bridge.js +94 -34
  191. package/dist/src/memory/memory-bridge.js.map +1 -1
  192. package/dist/src/memory/memory-crud.d.ts.map +1 -1
  193. package/dist/src/memory/memory-crud.js +298 -275
  194. package/dist/src/memory/memory-crud.js.map +1 -1
  195. package/dist/src/memory/memory-initializer.d.ts +2 -4
  196. package/dist/src/memory/memory-initializer.d.ts.map +1 -1
  197. package/dist/src/memory/memory-initializer.js +53 -76
  198. package/dist/src/memory/memory-initializer.js.map +1 -1
  199. package/dist/src/memory/memory-migrations.d.ts +1 -14
  200. package/dist/src/memory/memory-migrations.d.ts.map +1 -1
  201. package/dist/src/memory/memory-migrations.js +52 -105
  202. package/dist/src/memory/memory-migrations.js.map +1 -1
  203. package/dist/src/memory/sona-optimizer.d.ts +1 -1
  204. package/dist/src/memory/sona-optimizer.js +1 -1
  205. package/dist/src/monovector/index.d.ts +16 -19
  206. package/dist/src/monovector/index.d.ts.map +1 -1
  207. package/dist/src/monovector/index.js +50 -8
  208. package/dist/src/monovector/index.js.map +1 -1
  209. package/dist/src/orgrt/approvals.d.ts +16 -0
  210. package/dist/src/orgrt/approvals.d.ts.map +1 -0
  211. package/dist/src/orgrt/approvals.js +72 -0
  212. package/dist/src/orgrt/approvals.js.map +1 -0
  213. package/dist/src/orgrt/bus.d.ts.map +1 -1
  214. package/dist/src/orgrt/bus.js +21 -0
  215. package/dist/src/orgrt/bus.js.map +1 -1
  216. package/dist/src/orgrt/checkpoint-ops.d.ts +19 -0
  217. package/dist/src/orgrt/checkpoint-ops.d.ts.map +1 -0
  218. package/dist/src/orgrt/checkpoint-ops.js +219 -0
  219. package/dist/src/orgrt/checkpoint-ops.js.map +1 -0
  220. package/dist/src/orgrt/checkpoint.d.ts +33 -1
  221. package/dist/src/orgrt/checkpoint.d.ts.map +1 -1
  222. package/dist/src/orgrt/checkpoint.js +50 -6
  223. package/dist/src/orgrt/checkpoint.js.map +1 -1
  224. package/dist/src/orgrt/cross-org.d.ts +32 -0
  225. package/dist/src/orgrt/cross-org.d.ts.map +1 -0
  226. package/dist/src/orgrt/cross-org.js +256 -0
  227. package/dist/src/orgrt/cross-org.js.map +1 -0
  228. package/dist/src/orgrt/daemon.d.ts +131 -157
  229. package/dist/src/orgrt/daemon.d.ts.map +1 -1
  230. package/dist/src/orgrt/daemon.js +356 -966
  231. package/dist/src/orgrt/daemon.js.map +1 -1
  232. package/dist/src/orgrt/decisions.d.ts +33 -0
  233. package/dist/src/orgrt/decisions.d.ts.map +1 -0
  234. package/dist/src/orgrt/decisions.js +169 -0
  235. package/dist/src/orgrt/decisions.js.map +1 -0
  236. package/dist/src/orgrt/kimicode-runner.d.ts.map +1 -1
  237. package/dist/src/orgrt/kimicode-runner.js +5 -1
  238. package/dist/src/orgrt/kimicode-runner.js.map +1 -1
  239. package/dist/src/orgrt/opencode-runner.d.ts.map +1 -1
  240. package/dist/src/orgrt/opencode-runner.js +10 -2
  241. package/dist/src/orgrt/opencode-runner.js.map +1 -1
  242. package/dist/src/orgrt/org-memory.d.ts +45 -0
  243. package/dist/src/orgrt/org-memory.d.ts.map +1 -0
  244. package/dist/src/orgrt/org-memory.js +220 -0
  245. package/dist/src/orgrt/org-memory.js.map +1 -0
  246. package/dist/src/orgrt/policy.d.ts +4 -0
  247. package/dist/src/orgrt/policy.d.ts.map +1 -1
  248. package/dist/src/orgrt/policy.js +13 -1
  249. package/dist/src/orgrt/policy.js.map +1 -1
  250. package/dist/src/orgrt/prechecks.d.ts +15 -0
  251. package/dist/src/orgrt/prechecks.d.ts.map +1 -0
  252. package/dist/src/orgrt/prechecks.js +21 -0
  253. package/dist/src/orgrt/prechecks.js.map +1 -0
  254. package/dist/src/orgrt/questions.d.ts +39 -0
  255. package/dist/src/orgrt/questions.d.ts.map +1 -0
  256. package/dist/src/orgrt/questions.js +135 -0
  257. package/dist/src/orgrt/questions.js.map +1 -0
  258. package/dist/src/orgrt/remote.d.ts +25 -0
  259. package/dist/src/orgrt/remote.d.ts.map +1 -0
  260. package/dist/src/orgrt/remote.js +73 -0
  261. package/dist/src/orgrt/remote.js.map +1 -0
  262. package/dist/src/orgrt/scheduler-integration.d.ts +19 -0
  263. package/dist/src/orgrt/scheduler-integration.d.ts.map +1 -0
  264. package/dist/src/orgrt/scheduler-integration.js +90 -0
  265. package/dist/src/orgrt/scheduler-integration.js.map +1 -0
  266. package/dist/src/orgrt/server.d.ts.map +1 -1
  267. package/dist/src/orgrt/server.js +70 -2
  268. package/dist/src/orgrt/server.js.map +1 -1
  269. package/dist/src/orgrt/session.d.ts +30 -1
  270. package/dist/src/orgrt/session.d.ts.map +1 -1
  271. package/dist/src/orgrt/session.js +184 -53
  272. package/dist/src/orgrt/session.js.map +1 -1
  273. package/dist/src/orgrt/state-detector.d.ts +19 -0
  274. package/dist/src/orgrt/state-detector.d.ts.map +1 -0
  275. package/dist/src/orgrt/state-detector.js +59 -0
  276. package/dist/src/orgrt/state-detector.js.map +1 -0
  277. package/dist/src/orgrt/task-dag.d.ts +27 -0
  278. package/dist/src/orgrt/task-dag.d.ts.map +1 -0
  279. package/dist/src/orgrt/task-dag.js +100 -0
  280. package/dist/src/orgrt/task-dag.js.map +1 -0
  281. package/dist/src/orgrt/tool-fence.d.ts +7 -4
  282. package/dist/src/orgrt/tool-fence.d.ts.map +1 -1
  283. package/dist/src/orgrt/tool-fence.js +47 -6
  284. package/dist/src/orgrt/tool-fence.js.map +1 -1
  285. package/dist/src/orgrt/types.d.ts +57 -2
  286. package/dist/src/orgrt/types.d.ts.map +1 -1
  287. package/dist/src/orgrt/types.js +34 -3
  288. package/dist/src/orgrt/types.js.map +1 -1
  289. package/dist/src/routing/model-download.d.ts +49 -0
  290. package/dist/src/routing/model-download.d.ts.map +1 -0
  291. package/dist/src/routing/model-download.js +106 -0
  292. package/dist/src/routing/model-download.js.map +1 -0
  293. package/dist/src/services/crash-reporter.d.ts +5 -0
  294. package/dist/src/services/crash-reporter.d.ts.map +1 -1
  295. package/dist/src/services/crash-reporter.js +49 -0
  296. package/dist/src/services/crash-reporter.js.map +1 -1
  297. package/dist/src/transfer/anonymization/index.d.ts +18 -15
  298. package/dist/src/transfer/anonymization/index.d.ts.map +1 -1
  299. package/dist/src/transfer/anonymization/index.js +7 -119
  300. package/dist/src/transfer/anonymization/index.js.map +1 -1
  301. package/dist/src/ui/dashboard.html +606 -7
  302. package/dist/src/ui/orgs.html +7 -1
  303. package/dist/src/ui/routes-monograph.mjs +6 -0
  304. package/dist/src/ui/server.mjs +327 -7
  305. package/dist/src/update/checker.d.ts.map +1 -1
  306. package/dist/src/update/checker.js +2 -1
  307. package/dist/src/update/checker.js.map +1 -1
  308. package/dist/src/update/executor.d.ts.map +1 -1
  309. package/dist/src/update/executor.js +7 -3
  310. package/dist/src/update/executor.js.map +1 -1
  311. package/dist/src/update/index.d.ts +0 -1
  312. package/dist/src/update/index.d.ts.map +1 -1
  313. package/dist/src/update/index.js +5 -24
  314. package/dist/src/update/index.js.map +1 -1
  315. package/dist/src/utils/db-mutex.d.ts +11 -0
  316. package/dist/src/utils/db-mutex.d.ts.map +1 -0
  317. package/dist/src/utils/db-mutex.js +23 -0
  318. package/dist/src/utils/db-mutex.js.map +1 -0
  319. package/dist/src/utils/input-guards.d.ts +23 -0
  320. package/dist/src/utils/input-guards.d.ts.map +1 -1
  321. package/dist/src/utils/input-guards.js +72 -0
  322. package/dist/src/utils/input-guards.js.map +1 -1
  323. package/dist/src/utils/npm-command.d.ts +10 -0
  324. package/dist/src/utils/npm-command.d.ts.map +1 -0
  325. package/dist/src/utils/npm-command.js +12 -0
  326. package/dist/src/utils/npm-command.js.map +1 -0
  327. package/dist/src/utils/paths.d.ts +28 -0
  328. package/dist/src/utils/paths.d.ts.map +1 -0
  329. package/dist/src/utils/paths.js +108 -0
  330. package/dist/src/utils/paths.js.map +1 -0
  331. package/dist/tsconfig.tsbuildinfo +1 -1
  332. package/package.json +17 -17
  333. package/scripts/download-embedding-model.mjs +97 -0
  334. package/scripts/publish.sh +0 -0
  335. package/scripts/sync-claude-assets.sh +0 -0
  336. package/dist/src/production/circuit-breaker.d.ts +0 -121
  337. package/dist/src/production/circuit-breaker.d.ts.map +0 -1
  338. package/dist/src/production/circuit-breaker.js +0 -262
  339. package/dist/src/production/circuit-breaker.js.map +0 -1
  340. package/dist/src/production/error-handler.d.ts +0 -119
  341. package/dist/src/production/error-handler.d.ts.map +0 -1
  342. package/dist/src/production/error-handler.js +0 -324
  343. package/dist/src/production/error-handler.js.map +0 -1
  344. package/dist/src/production/index.d.ts +0 -6
  345. package/dist/src/production/index.d.ts.map +0 -1
  346. package/dist/src/production/index.js +0 -6
  347. package/dist/src/production/index.js.map +0 -1
  348. package/dist/src/production/monitoring.d.ts +0 -181
  349. package/dist/src/production/monitoring.d.ts.map +0 -1
  350. package/dist/src/production/monitoring.js +0 -375
  351. package/dist/src/production/monitoring.js.map +0 -1
  352. package/dist/src/production/rate-limiter.d.ts +0 -125
  353. package/dist/src/production/rate-limiter.d.ts.map +0 -1
  354. package/dist/src/production/rate-limiter.js +0 -218
  355. package/dist/src/production/rate-limiter.js.map +0 -1
  356. package/dist/src/production/retry.d.ts +0 -48
  357. package/dist/src/production/retry.d.ts.map +0 -1
  358. package/dist/src/production/retry.js +0 -189
  359. package/dist/src/production/retry.js.map +0 -1
  360. package/dist/src/transfer/types.d.ts +0 -245
  361. package/dist/src/transfer/types.d.ts.map +0 -1
  362. package/dist/src/transfer/types.js +0 -6
  363. package/dist/src/transfer/types.js.map +0 -1
@@ -0,0 +1,73 @@
1
+ // Re-export shared utilities that were previously exported from monograph-tools.ts
2
+ export { preferSymbolHits } from './shared.js';
3
+ // ── Tool imports ────────────────────────────────────────────────────────────
4
+ import { monographBuildTool, monographWatchTool, monographWatchStopTool, monographDetectChangesTool, monographInjectContextTool, monographSkillGenTool, monographInstallSkillsTool } from './build-tools.js';
5
+ import { monographQueryTool, monographSuggestTool, monographContextTool, monographNeighborsTool, monographGetNodeTool, monographGodNodesTool, monographAugmentTool, monographCypherTool, monographShortestPathTool } from './query-tools.js';
6
+ import { monographImpactTool, monographApiImpactTool, monographDeadCodeTool, monographRouteMapTool, monographShapeCheckTool, monographRenameTool, monographToolMapTool } from './impact-tools.js';
7
+ import { monographCommunityTool, monographSurprisesTool, monographGroupListTool, monographGroupQueryTool, monographGroupSyncTool, monographGroupContractsTool, monographGroupStatusTool, monographListReposTool } from './group-tools.js';
8
+ import { monographVisualizeTool, monographExportTool, monographSnapshotTool, monographDiffTool, monographReportTool, monographWikiTool, monographWikiBuildTool, monographServeTool } from './visualize-tools.js';
9
+ import { monographStatsTool, monographHealthTool, monographStalenessTool, monographDoctorTool } from './health-tools.js';
10
+ import { monographAgentHistoryTool, monographAgentPatternsTool, monographAgentRecordTool } from './agent-history-tools.js';
11
+ // ── Tool arrays ─────────────────────────────────────────────────────────────
12
+ // Advanced tools are only exposed over MCP when MONOGRAPH_MCP_ADVANCED=1.
13
+ const ADVANCED = process.env['MONOGRAPH_MCP_ADVANCED'] === '1';
14
+ /** Default-exposed core tools (19). */
15
+ const coreMonographTools = [
16
+ monographBuildTool,
17
+ monographQueryTool,
18
+ monographSuggestTool,
19
+ monographImpactTool,
20
+ monographContextTool,
21
+ monographNeighborsTool,
22
+ monographDeadCodeTool,
23
+ monographStatsTool,
24
+ monographHealthTool,
25
+ monographAugmentTool,
26
+ monographGodNodesTool,
27
+ monographDetectChangesTool,
28
+ monographGetNodeTool,
29
+ monographApiImpactTool,
30
+ monographRouteMapTool,
31
+ monographStalenessTool,
32
+ monographWatchTool,
33
+ monographWatchStopTool,
34
+ monographDoctorTool,
35
+ ];
36
+ /** Advanced tools — gated behind MONOGRAPH_MCP_ADVANCED=1. */
37
+ const advancedMonographTools = [
38
+ monographCypherTool,
39
+ monographShortestPathTool,
40
+ monographCommunityTool,
41
+ monographSurprisesTool,
42
+ monographShapeCheckTool,
43
+ monographRenameTool,
44
+ monographToolMapTool,
45
+ monographServeTool,
46
+ monographVisualizeTool,
47
+ monographSnapshotTool,
48
+ monographDiffTool,
49
+ monographReportTool,
50
+ monographExportTool,
51
+ monographWikiTool,
52
+ monographWikiBuildTool,
53
+ monographSkillGenTool,
54
+ monographInstallSkillsTool,
55
+ monographInjectContextTool,
56
+ monographGroupListTool,
57
+ monographGroupQueryTool,
58
+ monographGroupSyncTool,
59
+ monographGroupContractsTool,
60
+ monographGroupStatusTool,
61
+ monographListReposTool,
62
+ monographAgentHistoryTool,
63
+ monographAgentPatternsTool,
64
+ monographAgentRecordTool,
65
+ ];
66
+ /**
67
+ * Full tool list regardless of gating — used by the graphify compat shims,
68
+ * which must resolve targets (e.g. monograph_community) even when the
69
+ * advanced set is not exposed over MCP.
70
+ */
71
+ export const allMonographTools = [...coreMonographTools, ...advancedMonographTools];
72
+ export const monographTools = ADVANCED ? allMonographTools : coreMonographTools;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AAC,KAAK,GAAG,CAAC;AAE/D,uCAAuC;AACvC,MAAM,kBAAkB,GAAc;IACpC,kBAAkB;IAClB,kBAAkB;IAClB,oBAAoB;IACpB,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;IACtB,qBAAqB;IACrB,kBAAkB;IAClB,mBAAmB;IACnB,oBAAoB;IACpB,qBAAqB;IACrB,0BAA0B;IAC1B,oBAAoB;IACpB,sBAAsB;IACtB,qBAAqB;IACrB,sBAAsB;IACtB,kBAAkB;IAClB,sBAAsB;IACtB,mBAAmB;CACpB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,sBAAsB,GAAc;IACxC,mBAAmB;IACnB,yBAAyB;IACzB,sBAAsB;IACtB,sBAAsB;IACtB,uBAAuB;IACvB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,sBAAsB;IACtB,qBAAqB;IACrB,iBAAiB;IACjB,mBAAmB;IACnB,mBAAmB;IACnB,iBAAiB;IACjB,sBAAsB;IACtB,qBAAqB;IACrB,0BAA0B;IAC1B,0BAA0B;IAC1B,sBAAsB;IACtB,uBAAuB;IACvB,sBAAsB;IACtB,2BAA2B;IAC3B,wBAAwB;IACxB,sBAAsB;IACtB,yBAAyB;IACzB,0BAA0B;IAC1B,wBAAwB;CACzB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAc,CAAC,GAAG,kBAAkB,EAAE,GAAG,sBAAsB,CAAC,CAAC;AAE/F,MAAM,CAAC,MAAM,cAAc,GAAc,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,kBAAkB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { MCPTool } from '../types.js';
2
+ export declare const monographQueryTool: MCPTool;
3
+ export declare const monographSuggestTool: MCPTool;
4
+ export declare const monographContextTool: MCPTool;
5
+ export declare const monographNeighborsTool: MCPTool;
6
+ export declare const monographGetNodeTool: MCPTool;
7
+ export declare const monographGodNodesTool: MCPTool;
8
+ export declare const monographAugmentTool: MCPTool;
9
+ export declare const monographCypherTool: MCPTool;
10
+ export declare const monographShortestPathTool: MCPTool;
11
+ //# sourceMappingURL=query-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-tools.d.ts","sourceRoot":"","sources":["../../../../src/mcp-tools/monograph/query-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAO3C,eAAO,MAAM,kBAAkB,EAAE,OAwGhC,CAAC;AAIF,eAAO,MAAM,oBAAoB,EAAE,OA2FlC,CAAC;AAIF,eAAO,MAAM,oBAAoB,EAAE,OAgElC,CAAC;AAIF,eAAO,MAAM,sBAAsB,EAAE,OAuCpC,CAAC;AAIF,eAAO,MAAM,oBAAoB,EAAE,OAuBlC,CAAC;AAIF,eAAO,MAAM,qBAAqB,EAAE,OAyCnC,CAAC;AAIF,eAAO,MAAM,oBAAoB,EAAE,OAiClC,CAAC;AAIF,eAAO,MAAM,mBAAmB,EAAE,OAiCjC,CAAC;AAIF,eAAO,MAAM,yBAAyB,EAAE,OA4BvC,CAAC"}
@@ -0,0 +1,500 @@
1
+ import { getProjectCwd } from '../types.js';
2
+ import { getDbPath, _isValidDb, text, applyPprRerank, computeCommitsBehind, triggerBackgroundBuildIfNeeded, STALENESS_THRESHOLD, preferSymbolHits } from './shared.js';
3
+ // ── monograph_query ───────────────────────────────────────────────────────────
4
+ export const monographQueryTool = {
5
+ name: 'monograph_query',
6
+ description: 'BM25 keyword search across the code knowledge graph. When MONOGRAPH_EMBEDDINGS=true uses hybrid BM25+vector ranking (RRF). Returns nodes with file path and line number.',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ query: { type: 'string', description: 'Search terms' },
11
+ limit: { type: 'number', description: 'Max results (default 20)' },
12
+ label: { type: 'string', description: 'Filter by node type: Class, Function, Method, etc.' },
13
+ rerank: { type: 'boolean', description: 'Apply HippoRAG-style PPR graph reranking to boost neighbors of top hits (default: true)' },
14
+ damping: { type: 'number', description: 'PPR damping factor when rerank=true (0-1, default 0.5)' },
15
+ },
16
+ required: ['query'],
17
+ },
18
+ handler: async (input) => {
19
+ const dbPath = getDbPath();
20
+ if (!_isValidDb(dbPath))
21
+ return text('Monograph index not built yet. Run monograph_build first.');
22
+ const { openDb, closeDb, ftsSearch } = await import('@monoes/monograph');
23
+ const { hybridQuery } = await import('@monoes/monograph');
24
+ const db = openDb(dbPath);
25
+ try {
26
+ // Cap limit: passed directly to SQLite queries and hybridQuery; an
27
+ // unlimited value saturates memory with rows.
28
+ const MAX_QUERY_LIMIT = 1_000;
29
+ const rawLimit = input.limit ?? 20;
30
+ const limit = Number.isFinite(rawLimit) && rawLimit > 0
31
+ ? Math.min(Math.floor(rawLimit), MAX_QUERY_LIMIT)
32
+ : 20;
33
+ // Cap query: passed to FTS5 and hybridQuery; very long queries waste
34
+ // parse time and can stress the FTS tokenizer.
35
+ const MAX_MONOGRAPH_QUERY_LEN = 16 * 1024;
36
+ const rawQuery = input.query;
37
+ const query = typeof rawQuery === 'string' && rawQuery.length > MAX_MONOGRAPH_QUERY_LEN
38
+ ? rawQuery.slice(0, MAX_MONOGRAPH_QUERY_LEN)
39
+ : rawQuery;
40
+ const label = input.label;
41
+ const rerank = input.rerank ?? true;
42
+ const damping = input.damping ?? 0.5;
43
+ const zeroResultHint = /\s/.test(query) && !/[A-Z]/.test(query.replace(/\s+/g, '').slice(1))
44
+ ? ' Hint: monograph indexes identifiers and filenames — try camelCase/PascalCase (e.g. "AgentSpawn") or a filename instead of a phrase.'
45
+ : '';
46
+ // Lightweight staleness check — fire-and-forget background rebuild;
47
+ // append warning to results so the agent knows data may be outdated.
48
+ let stalenessNote = '';
49
+ const repoPath = getProjectCwd();
50
+ const staleness = await computeCommitsBehind(repoPath);
51
+ if (staleness && staleness.commitsBehind > 0) {
52
+ const triggered = triggerBackgroundBuildIfNeeded(repoPath, staleness.commitsBehind);
53
+ stalenessNote = `\n⚠ Index is ${staleness.commitsBehind} commit(s) behind HEAD${triggered ? ' — rebuild triggered' : ''}.`;
54
+ }
55
+ if (process.env['MONOGRAPH_EMBEDDINGS'] === 'true') {
56
+ const results = await hybridQuery(db, query, { limit: rerank ? limit * 2 : limit, label });
57
+ if (results.length === 0)
58
+ return text('No results found.' + zeroResultHint + stalenessNote);
59
+ if (rerank) {
60
+ const seeds = results.map(r => ({
61
+ id: r.id, name: r.name ?? r.id, label: r.label ?? '?',
62
+ filePath: r.filePath ?? '', startLine: r.startLine ?? null,
63
+ score: r.score,
64
+ }));
65
+ const reranked = applyPprRerank(db, seeds, damping, limit);
66
+ const lines = reranked.map(r => {
67
+ const loc = r.filePath ? (r.startLine != null ? `${r.filePath}:${r.startLine}` : r.filePath) : '';
68
+ const tag = r.boostedByNeighbors ? ' [PPR-boosted]' : '';
69
+ return `[${r.label}] ${r.name} ${loc} (score: ${r.score.toFixed(4)})${tag}`;
70
+ });
71
+ return text(lines.join('\n') + stalenessNote);
72
+ }
73
+ const lines = results.map(r => {
74
+ const loc = r.filePath ? (r.startLine != null ? `${r.filePath}:${r.startLine}` : r.filePath) : '';
75
+ return `[${r.label ?? '?'}] ${r.name ?? r.id} ${loc} (score: ${r.score.toFixed(4)})`;
76
+ });
77
+ return text(lines.join('\n') + stalenessNote);
78
+ }
79
+ const results = ftsSearch(db, query, rerank ? limit * 2 : limit, label);
80
+ if (results.length === 0)
81
+ return text('No results found.' + zeroResultHint + stalenessNote);
82
+ if (rerank) {
83
+ const seeds = results.map(r => ({
84
+ id: r.id, name: r.name, label: r.label,
85
+ filePath: r.filePath ?? '', startLine: r.startLine ?? null,
86
+ score: Math.abs(r.rank),
87
+ }));
88
+ const reranked = applyPprRerank(db, seeds, damping, limit);
89
+ const lines = reranked.map(r => {
90
+ const loc = r.filePath ? (r.startLine != null ? `${r.filePath}:${r.startLine}` : r.filePath) : '';
91
+ const tag = r.boostedByNeighbors ? ' [PPR-boosted]' : '';
92
+ return `[${r.label}] ${r.name} ${loc} (score: ${r.score.toFixed(3)})${tag}`;
93
+ });
94
+ return text(lines.join('\n') + stalenessNote);
95
+ }
96
+ const lines = results.map(r => {
97
+ const loc = r.filePath ? (r.startLine != null ? `${r.filePath}:${r.startLine}` : r.filePath) : '';
98
+ return `[${r.label}] ${r.name} ${loc} (score: ${r.rank.toFixed(3)})`;
99
+ });
100
+ return text(lines.join('\n') + stalenessNote);
101
+ }
102
+ finally {
103
+ closeDb(db);
104
+ }
105
+ },
106
+ };
107
+ // ── monograph_suggest ─────────────────────────────────────────────────────────
108
+ export const monographSuggestTool = {
109
+ name: 'monograph_suggest',
110
+ description: 'Get graph-topology-derived questions to explore the codebase. Pass task= to score by task relevance via BM25/FTS5.',
111
+ inputSchema: {
112
+ type: 'object',
113
+ properties: {
114
+ task: { type: 'string', description: 'Optional task description for task-relevance scoring' },
115
+ limit: { type: 'number', description: 'Max questions (default 10)' },
116
+ checkStaleness: { type: 'boolean', description: 'Check index staleness first and trigger a background rebuild when the index is behind HEAD. Appends a _staleness annotation to the result. (default true — pass false to skip the git check)' },
117
+ },
118
+ },
119
+ handler: async (input) => {
120
+ // Health-aware mode (formerly monograph_suggest_auto): check staleness and
121
+ // trigger a background rebuild if the index is behind HEAD. Defaults on
122
+ // (opt-out, not opt-in) — a caller that never checked was exactly how a
123
+ // stale graph kept serving results silently.
124
+ let stalenessAnnotation = '';
125
+ if (input.checkStaleness !== false) {
126
+ const repoPath = getProjectCwd();
127
+ const stalenessResult = await computeCommitsBehind(repoPath);
128
+ const commitsBehind = stalenessResult?.commitsBehind ?? 0;
129
+ const triggered = triggerBackgroundBuildIfNeeded(repoPath, commitsBehind, STALENESS_THRESHOLD + 1);
130
+ const status = triggered ? 'building' : commitsBehind === 0 ? 'fresh' : 'stale';
131
+ stalenessAnnotation = `\n_staleness: ${JSON.stringify({ commitsBehind, status, triggered })}`;
132
+ }
133
+ const dbPath = getDbPath();
134
+ if (!_isValidDb(dbPath))
135
+ return text('Monograph index not built yet. Run monograph_build first.' + stalenessAnnotation);
136
+ const { openDb, closeDb } = await import('@monoes/monograph');
137
+ const { hybridQuery } = await import('@monoes/monograph');
138
+ const db = openDb(dbPath);
139
+ try {
140
+ // Cap limit and task: limit is passed directly to SQL LIMIT clause;
141
+ // task is forwarded to hybridQuery (embedding path) or FTS.
142
+ const MAX_SUGGEST_LIMIT = 1_000;
143
+ const MAX_SUGGEST_TASK_LEN = 16 * 1024;
144
+ const rawSuggestLimit = input.limit ?? 10;
145
+ const limit = Number.isFinite(rawSuggestLimit) && rawSuggestLimit > 0
146
+ ? Math.min(Math.floor(rawSuggestLimit), MAX_SUGGEST_LIMIT)
147
+ : 10;
148
+ const rawTask = input.task ?? '';
149
+ const task = typeof rawTask === 'string' && rawTask.length > MAX_SUGGEST_TASK_LEN
150
+ ? rawTask.slice(0, MAX_SUGGEST_TASK_LEN)
151
+ : rawTask;
152
+ // Format a suggestion row as a navigable string for LLM consumption.
153
+ // Includes file:line references so the LLM can jump directly to the code.
154
+ const formatSuggestion = (r) => {
155
+ const srcLoc = r.src_file ? (r.src_line != null ? `${r.src_file}:${r.src_line}` : r.src_file) : '';
156
+ const tgtLoc = r.tgt_file ? (r.tgt_line != null ? `${r.tgt_file}:${r.tgt_line}` : r.tgt_file) : '';
157
+ const locHint = srcLoc ? ` [${srcLoc}${tgtLoc ? ` → ${tgtLoc}` : ''}]` : '';
158
+ return `Why does ${r.src} ${r.relation.toLowerCase()} ${r.tgt}? (${r.confidence})${locHint}`;
159
+ };
160
+ // When a task is provided, use BM25/FTS5 (via hybridQuery) to find
161
+ // relevant nodes and restrict the edge-level questions to them. This
162
+ // used to be gated behind MONOGRAPH_EMBEDDINGS=true, but hybridQuery
163
+ // is BM25-only now (the embeddings table stayed empty in practice —
164
+ // see hybrid-query.ts) so the env var gated nothing and just left this
165
+ // better-ranked path off unless a caller happened to know about it.
166
+ let hitIds = [];
167
+ if (task) {
168
+ const hits = await hybridQuery(db, task, { limit: 20 });
169
+ const { SYMBOL_NODE_LABELS } = await import('@monoes/monograph');
170
+ const relevantHits = preferSymbolHits(hits, SYMBOL_NODE_LABELS);
171
+ hitIds = [...new Set(relevantHits.map(h => h.id))];
172
+ if (hitIds.length === 0) {
173
+ return text('No suggestions for this task. Run monograph_build first or try a different query.' + stalenessAnnotation);
174
+ }
175
+ }
176
+ const taskFilter = hitIds.length
177
+ ? `AND (e.source_id IN (${hitIds.map(() => '?').join(',')}) OR e.target_id IN (${hitIds.map(() => '?').join(',')}))`
178
+ : '';
179
+ const rows = db.prepare(`
180
+ SELECT e.relation, e.confidence, n1.name as src, n2.name as tgt,
181
+ n1.file_path as src_file, n1.start_line as src_line,
182
+ n2.file_path as tgt_file, n2.start_line as tgt_line
183
+ FROM edges e
184
+ JOIN nodes n1 ON n1.id = e.source_id
185
+ JOIN nodes n2 ON n2.id = e.target_id
186
+ WHERE e.confidence IN ('AMBIGUOUS', 'INFERRED')
187
+ ${taskFilter}
188
+ LIMIT 100
189
+ `).all(...hitIds, ...hitIds);
190
+ const questions = rows.map(formatSuggestion);
191
+ const fallback = task ? 'No suggestions for this task. Run monograph_build first.' : 'No suggestions. Run monograph_build first.';
192
+ return text((questions.slice(0, limit).join('\n') || fallback) + stalenessAnnotation);
193
+ }
194
+ finally {
195
+ closeDb(db);
196
+ }
197
+ },
198
+ };
199
+ // ── monograph_context ─────────────────────────────────────────────────────────
200
+ export const monographContextTool = {
201
+ name: 'monograph_context',
202
+ description: '360° symbol view: callers, callees, imports, importedBy, community, and containing processes for a symbol.',
203
+ inputSchema: {
204
+ type: 'object',
205
+ properties: {
206
+ name: { type: 'string', description: 'Symbol name to look up' },
207
+ filePath: { type: 'string', description: 'Optional file path to disambiguate' },
208
+ },
209
+ required: ['name'],
210
+ },
211
+ handler: async (input) => {
212
+ const { openDb, closeDb } = await import('@monoes/monograph');
213
+ const { getMonographContext } = await import('@monoes/monograph');
214
+ const db = openDb(getDbPath());
215
+ try {
216
+ // Cap name and filePath: forwarded to parameterized SQL via getMonographContext.
217
+ // Very long strings waste memory before the query even executes.
218
+ const MAX_CTX_NAME_LEN = 512;
219
+ const MAX_CTX_PATH_LEN = 4 * 1024;
220
+ const rawCtxName = input.name;
221
+ const ctxName = typeof rawCtxName === 'string' && rawCtxName.length > MAX_CTX_NAME_LEN
222
+ ? rawCtxName.slice(0, MAX_CTX_NAME_LEN) : rawCtxName;
223
+ const rawCtxPath = input.filePath;
224
+ const ctxPath = typeof rawCtxPath === 'string' && rawCtxPath.length > MAX_CTX_PATH_LEN
225
+ ? rawCtxPath.slice(0, MAX_CTX_PATH_LEN) : rawCtxPath;
226
+ const result = getMonographContext(db, {
227
+ name: ctxName,
228
+ filePath: ctxPath,
229
+ });
230
+ if (!result || !result.node)
231
+ return text(`No symbol found: ${ctxName}`);
232
+ // Format context as structured text for direct LLM consumption
233
+ const n = result.node;
234
+ const loc = n.filePath ? (n.startLine != null ? `${n.filePath}:${n.startLine}` : n.filePath) : '';
235
+ const lines = [
236
+ `[${n.label ?? '?'}] ${n.name} ${loc}`,
237
+ '',
238
+ ];
239
+ const formatNodes = (nodes, label) => {
240
+ if (!Array.isArray(nodes) || nodes.length === 0)
241
+ return;
242
+ lines.push(`${label} (${nodes.length}):`);
243
+ for (const node of nodes.slice(0, 20)) {
244
+ const fp = node.filePath ?? node.file_path ?? '';
245
+ const ln = node.startLine ?? node.start_line;
246
+ const nodeLoc = fp ? (ln != null ? `${fp}:${ln}` : fp) : '';
247
+ lines.push(` [${node.label ?? '?'}] ${node.name ?? node.id} ${nodeLoc}`);
248
+ }
249
+ if (nodes.length > 20)
250
+ lines.push(` … ${nodes.length - 20} more`);
251
+ lines.push('');
252
+ };
253
+ formatNodes(result.callers, 'Callers');
254
+ formatNodes(result.callees, 'Callees');
255
+ formatNodes(result.imports, 'Imports');
256
+ formatNodes(result.importedBy, 'ImportedBy');
257
+ if (result.community != null)
258
+ lines.push(`Community: ${result.community}`);
259
+ if (result.communityName)
260
+ lines.push(`Community name: ${result.communityName}`);
261
+ return text(lines.join('\n').trim());
262
+ }
263
+ finally {
264
+ closeDb(db);
265
+ }
266
+ },
267
+ };
268
+ // ── monograph_neighbors ───────────────────────────────────────────────────────
269
+ export const monographNeighborsTool = {
270
+ name: 'monograph_neighbors',
271
+ description: 'Show all directly connected nodes for a given symbol — outbound and optionally inbound edges, with relation types.',
272
+ inputSchema: {
273
+ type: 'object',
274
+ properties: {
275
+ name: { type: 'string', description: 'Symbol name to look up' },
276
+ relationFilter: { type: 'string', description: 'Filter by relation type, e.g. IMPORTS, CALLS' },
277
+ includeInbound: { type: 'boolean', description: 'Include inbound edges (default: false)' },
278
+ },
279
+ required: ['name'],
280
+ },
281
+ handler: async (input) => {
282
+ const { openDb, closeDb, getMonographNeighbors } = await import('@monoes/monograph');
283
+ const db = openDb(getDbPath());
284
+ try {
285
+ const result = getMonographNeighbors(db, {
286
+ name: input.name,
287
+ relationFilter: input.relationFilter,
288
+ includeInbound: input.includeInbound ?? false,
289
+ });
290
+ if (!result.node)
291
+ return text(`No node found with name: ${input.name}`);
292
+ const nodeFilePath = result.node.filePath ?? '';
293
+ const nodeStartLine = result.node.startLine ?? result.node.start_line;
294
+ const nodeLoc = nodeFilePath ? (nodeStartLine != null ? `${nodeFilePath}:${nodeStartLine}` : nodeFilePath) : '';
295
+ const lines = [
296
+ `[${result.node.label}] ${result.node.name} ${nodeLoc}`,
297
+ `Neighbors: ${result.neighbors.length}`,
298
+ '',
299
+ ...result.neighbors.map(n => {
300
+ const fp = n.node.filePath ?? n.node.file_path ?? '';
301
+ const ln = n.node.startLine ?? n.node.start_line;
302
+ const loc = fp ? (ln != null ? `${fp}:${ln}` : fp) : '';
303
+ return ` ${n.direction === 'inbound' ? '←' : '→'} [${n.node.label}] ${n.node.name} (${n.relation}) ${loc}`;
304
+ }),
305
+ ];
306
+ return text(lines.join('\n'));
307
+ }
308
+ finally {
309
+ closeDb(db);
310
+ }
311
+ },
312
+ };
313
+ // ── monograph_get_node ────────────────────────────────────────────────────────
314
+ export const monographGetNodeTool = {
315
+ name: 'monograph_get_node',
316
+ description: 'Get a specific node by exact ID or name.',
317
+ inputSchema: {
318
+ type: 'object',
319
+ properties: {
320
+ id: { type: 'string', description: 'Node ID or name to look up' },
321
+ },
322
+ required: ['id'],
323
+ },
324
+ handler: async (input) => {
325
+ const { openDb, closeDb, getNode } = await import('@monoes/monograph');
326
+ const db = openDb(getDbPath());
327
+ try {
328
+ let node = getNode(db, input.id);
329
+ if (!node) {
330
+ const row = db.prepare('SELECT * FROM nodes WHERE name = ? LIMIT 1').get(input.id);
331
+ if (row)
332
+ node = row;
333
+ }
334
+ if (!node)
335
+ return text(`Node not found: ${input.id}`);
336
+ return text(JSON.stringify(node, null, 2));
337
+ }
338
+ finally {
339
+ closeDb(db);
340
+ }
341
+ },
342
+ };
343
+ // ── monograph_god_nodes ───────────────────────────────────────────────────────
344
+ export const monographGodNodesTool = {
345
+ name: 'monograph_god_nodes',
346
+ description: 'Return the top-N most connected real code entities (excludes File/Folder/Community nodes).',
347
+ inputSchema: {
348
+ type: 'object',
349
+ properties: { limit: { type: 'number', description: 'Max nodes to return (default 20)' } },
350
+ },
351
+ handler: async (input) => {
352
+ const dbPath = getDbPath();
353
+ if (!_isValidDb(dbPath))
354
+ return text('Monograph index not built yet. Run monograph_build first.');
355
+ const { openDb, closeDb } = await import('@monoes/monograph');
356
+ const db = openDb(dbPath);
357
+ try {
358
+ // Cap limit: passed directly to the SQL LIMIT clause.
359
+ const MAX_GOD_NODES_LIMIT = 1_000;
360
+ const rawGodLimit = input.limit ?? 20;
361
+ const limit = Number.isFinite(rawGodLimit) && rawGodLimit > 0
362
+ ? Math.min(Math.floor(rawGodLimit), MAX_GOD_NODES_LIMIT)
363
+ : 20;
364
+ const excluded = ['File', 'Folder', 'Community', 'Concept'];
365
+ const rows = db.prepare(`
366
+ SELECT n.id, n.label, n.name, n.file_path, n.start_line,
367
+ COUNT(DISTINCT e1.id) + COUNT(DISTINCT e2.id) AS degree,
368
+ COUNT(DISTINCT e2.id) AS in_degree,
369
+ COUNT(DISTINCT e1.id) AS out_degree
370
+ FROM nodes n
371
+ LEFT JOIN edges e1 ON e1.source_id = n.id
372
+ LEFT JOIN edges e2 ON e2.target_id = n.id
373
+ WHERE n.label NOT IN (${excluded.map(() => '?').join(',')})
374
+ GROUP BY n.id HAVING degree > 0
375
+ ORDER BY degree DESC LIMIT ?
376
+ `).all(...excluded, limit);
377
+ if (rows.length === 0)
378
+ return text('No god nodes found. Run monograph_build first.');
379
+ const lines = rows.map(r => {
380
+ const loc = r.file_path ? (r.start_line != null ? `${r.file_path}:${r.start_line}` : r.file_path) : '';
381
+ return `[${r.label}] ${r.name} degree=${r.degree} (↑${r.out_degree} ↓${r.in_degree}) ${loc}`;
382
+ });
383
+ return text(lines.join('\n'));
384
+ }
385
+ finally {
386
+ closeDb(db);
387
+ }
388
+ },
389
+ };
390
+ // ── monograph_augment ─────────────────────────────────────────────────────────
391
+ export const monographAugmentTool = {
392
+ name: 'monograph_augment',
393
+ description: 'Retrieve relevant code context for a query using graph-RAG. Returns formatted context block for injection into AI prompts.',
394
+ inputSchema: {
395
+ type: 'object',
396
+ properties: {
397
+ query: { type: 'string', description: 'The search query or task description' },
398
+ topK: { type: 'number', description: 'Number of results (default: 10)' },
399
+ format: { type: 'string', enum: ['markdown', 'json'], description: 'Output format (default: markdown)' },
400
+ },
401
+ required: ['query'],
402
+ },
403
+ handler: async (input) => {
404
+ const { augmentContext } = await import('@monoes/monograph');
405
+ const repoPath = getProjectCwd();
406
+ // Cap query (forwarded to FTS/embedding in augmentContext) and topK
407
+ // (controls how many context nodes are retrieved).
408
+ const MAX_AUGMENT_QUERY_LEN = 16 * 1024;
409
+ const MAX_AUGMENT_TOP_K = 100;
410
+ const rawAugmentQuery = input.query;
411
+ const augmentQuery = typeof rawAugmentQuery === 'string' && rawAugmentQuery.length > MAX_AUGMENT_QUERY_LEN
412
+ ? rawAugmentQuery.slice(0, MAX_AUGMENT_QUERY_LEN) : rawAugmentQuery;
413
+ const rawTopK = input.topK ?? 10;
414
+ const topK = Number.isFinite(rawTopK) && rawTopK > 0
415
+ ? Math.min(Math.floor(rawTopK), MAX_AUGMENT_TOP_K) : 10;
416
+ const result = await augmentContext({
417
+ query: augmentQuery,
418
+ repoPath,
419
+ topK,
420
+ format: input.format ?? 'markdown',
421
+ });
422
+ return text(result);
423
+ },
424
+ };
425
+ // ── monograph_cypher ──────────────────────────────────────────────────────────
426
+ export const monographCypherTool = {
427
+ name: 'monograph_cypher',
428
+ description: 'Execute a restricted read-only Cypher-style MATCH query against the Monograph knowledge graph. Supports node and relationship patterns. Write operations (CREATE, MERGE, SET, DELETE, REMOVE, DROP) are blocked.',
429
+ inputSchema: {
430
+ type: 'object',
431
+ properties: {
432
+ query: {
433
+ type: 'string',
434
+ description: 'Cypher MATCH query. Example: MATCH (a:Function)-[:CALLS]->(b:Function {name: "authenticate"}) RETURN a.name, a.filePath',
435
+ },
436
+ },
437
+ required: ['query'],
438
+ },
439
+ handler: async (input) => {
440
+ const { openDb, closeDb } = await import('@monoes/monograph');
441
+ const { getMonographCypher } = await import('@monoes/monograph');
442
+ const db = openDb(getDbPath());
443
+ try {
444
+ // Cap query: forwarded to the Cypher query engine; very long strings
445
+ // waste parse time and can stress the query compiler.
446
+ const MAX_CYPHER_QUERY_LEN = 16 * 1024;
447
+ const rawCypherQuery = input.query;
448
+ const cypherQuery = typeof rawCypherQuery === 'string' && rawCypherQuery.length > MAX_CYPHER_QUERY_LEN
449
+ ? rawCypherQuery.slice(0, MAX_CYPHER_QUERY_LEN)
450
+ : rawCypherQuery;
451
+ const result = getMonographCypher(db, cypherQuery);
452
+ if (result.error)
453
+ return text(`Error: ${result.error}`);
454
+ if (result.rows.length === 0)
455
+ return text('No results found.');
456
+ const header = Object.keys(result.rows[0]).join('\t');
457
+ const lines = result.rows.map(r => Object.values(r).join('\t'));
458
+ return text([header, ...lines, `\n(${result.rows.length} rows, ${result.queryTime}ms)`].join('\n'));
459
+ }
460
+ finally {
461
+ closeDb(db);
462
+ }
463
+ },
464
+ };
465
+ // ── monograph_shortest_path ───────────────────────────────────────────────────
466
+ export const monographShortestPathTool = {
467
+ name: 'monograph_shortest_path',
468
+ description: 'Find the shortest path between two nodes in the dependency graph.',
469
+ inputSchema: {
470
+ type: 'object',
471
+ properties: {
472
+ source: { type: 'string', description: 'Source node ID or name' },
473
+ target: { type: 'string', description: 'Target node ID or name' },
474
+ maxDepth: { type: 'number', description: 'Max path depth (default 6)' },
475
+ },
476
+ required: ['source', 'target'],
477
+ },
478
+ handler: async (input) => {
479
+ const { openDb, closeDb, getShortestPath } = await import('@monoes/monograph');
480
+ const db = openDb(getDbPath());
481
+ try {
482
+ const path = getShortestPath(db, input.source, input.target, input.maxDepth ?? 6);
483
+ if (!path)
484
+ return text(`No path found between ${input.source} and ${input.target}`);
485
+ // Enrich each node ID with file:line for direct LLM navigation
486
+ const enriched = path.map(nodeId => {
487
+ const row = db.prepare('SELECT label, name, file_path, start_line FROM nodes WHERE id = ? OR name = ? LIMIT 1').get(nodeId, nodeId);
488
+ if (!row)
489
+ return nodeId;
490
+ const loc = row.file_path ? (row.start_line != null ? `${row.file_path}:${row.start_line}` : row.file_path) : '';
491
+ return loc ? `${row.name ?? nodeId} [${loc}]` : (row.name ?? nodeId);
492
+ });
493
+ return text(`Path (${path.length - 1} hops):\n${enriched.join(' → ')}`);
494
+ }
495
+ finally {
496
+ closeDb(db);
497
+ }
498
+ },
499
+ };
500
+ //# sourceMappingURL=query-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-tools.js","sourceRoot":"","sources":["../../../../src/mcp-tools/monograph/query-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGvK,iFAAiF;AAEjF,MAAM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