memory-journal-mcp 9.0.0 → 9.1.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 (356) hide show
  1. package/README.md +165 -124
  2. package/dist/audit/interceptor.d.ts.map +1 -1
  3. package/dist/auth/authorization-server-discovery.d.ts.map +1 -1
  4. package/dist/auth/middleware.d.ts +11 -22
  5. package/dist/auth/middleware.d.ts.map +1 -1
  6. package/dist/auth/scope-map.d.ts.map +1 -1
  7. package/dist/auth/scopes.d.ts.map +1 -1
  8. package/dist/auth/token-validator.d.ts.map +1 -1
  9. package/dist/auth/transport-agnostic.d.ts +4 -0
  10. package/dist/auth/transport-agnostic.d.ts.map +1 -1
  11. package/dist/auth/validation.d.ts +1 -0
  12. package/dist/auth/validation.d.ts.map +1 -1
  13. package/dist/{chunk-6RCZ4IYV.js → chunk-4FZCHFB5.js} +28 -5
  14. package/dist/{chunk-AIWHVEOW.js → chunk-D2FY6XS5.js} +99 -7
  15. package/dist/chunk-FZLB6NAV.js +746 -0
  16. package/dist/{chunk-NVXCRDCO.js → chunk-LE6ZWUPK.js} +216 -138
  17. package/dist/chunk-SGJU2DHU.js +2102 -0
  18. package/dist/{chunk-2UIMA6JF.js → chunk-T7SROBBV.js} +32375 -29351
  19. package/dist/{chunk-IYZWMAA4.js → chunk-Y6MMKR2Z.js} +957 -1333
  20. package/dist/cli/commands/admin.d.ts +1 -1
  21. package/dist/cli/commands/admin.d.ts.map +1 -1
  22. package/dist/cli/commands/entry-payload.d.ts +38 -0
  23. package/dist/cli/commands/entry-payload.d.ts.map +1 -0
  24. package/dist/cli/commands/entry.d.ts +10 -0
  25. package/dist/cli/commands/entry.d.ts.map +1 -1
  26. package/dist/cli/commands/exec.d.ts.map +1 -1
  27. package/dist/cli/commands/io.d.ts +1 -0
  28. package/dist/cli/commands/io.d.ts.map +1 -1
  29. package/dist/cli/commands/visualize.d.ts.map +1 -1
  30. package/dist/cli/index.js +7 -10
  31. package/dist/cli/schemas.d.ts +14 -1
  32. package/dist/cli/schemas.d.ts.map +1 -1
  33. package/dist/cli/server-options-builder.d.ts.map +1 -1
  34. package/dist/cli.js +7 -10
  35. package/dist/codemode/api/journal-api.d.ts +5 -23
  36. package/dist/codemode/api/journal-api.d.ts.map +1 -1
  37. package/dist/codemode/api/key-normalizer.d.ts +8 -0
  38. package/dist/codemode/api/key-normalizer.d.ts.map +1 -0
  39. package/dist/codemode/api/param-normalizer.d.ts +2 -4
  40. package/dist/codemode/api/param-normalizer.d.ts.map +1 -1
  41. package/dist/codemode/api/project-registry-ops.d.ts +26 -0
  42. package/dist/codemode/api/project-registry-ops.d.ts.map +1 -0
  43. package/dist/codemode/api/sandbox-bindings.d.ts +25 -0
  44. package/dist/codemode/api/sandbox-bindings.d.ts.map +1 -0
  45. package/dist/codemode/api/types.d.ts.map +1 -1
  46. package/dist/codemode/api-constants.d.ts +3 -39
  47. package/dist/codemode/api-constants.d.ts.map +1 -1
  48. package/dist/codemode/constants/examples-and-params.d.ts +31 -0
  49. package/dist/codemode/constants/examples-and-params.d.ts.map +1 -0
  50. package/dist/codemode/constants/method-aliases.d.ts +8 -0
  51. package/dist/codemode/constants/method-aliases.d.ts.map +1 -0
  52. package/dist/codemode/normalizers/domain-tool-interceptions.d.ts +6 -0
  53. package/dist/codemode/normalizers/domain-tool-interceptions.d.ts.map +1 -0
  54. package/dist/codemode/normalizers/entry-and-search-interceptions.d.ts +6 -0
  55. package/dist/codemode/normalizers/entry-and-search-interceptions.d.ts.map +1 -0
  56. package/dist/codemode/normalizers/generic-interceptions.d.ts +6 -0
  57. package/dist/codemode/normalizers/generic-interceptions.d.ts.map +1 -0
  58. package/dist/codemode/normalizers/github-and-backup-interceptions.d.ts +6 -0
  59. package/dist/codemode/normalizers/github-and-backup-interceptions.d.ts.map +1 -0
  60. package/dist/codemode/normalizers/shared-utils.d.ts +31 -0
  61. package/dist/codemode/normalizers/shared-utils.d.ts.map +1 -0
  62. package/dist/codemode/param-normalizer.d.ts +5 -1
  63. package/dist/codemode/param-normalizer.d.ts.map +1 -1
  64. package/dist/codemode/proxy-helpers.d.ts +34 -0
  65. package/dist/codemode/proxy-helpers.d.ts.map +1 -0
  66. package/dist/codemode/proxy-namespaces.d.ts +30 -0
  67. package/dist/codemode/proxy-namespaces.d.ts.map +1 -0
  68. package/dist/codemode/security.d.ts +11 -0
  69. package/dist/codemode/security.d.ts.map +1 -1
  70. package/dist/codemode/type-generator.d.ts.map +1 -1
  71. package/dist/codemode/types.d.ts.map +1 -1
  72. package/dist/codemode/worker/mj-shim-domains.d.ts +15 -0
  73. package/dist/codemode/worker/mj-shim-domains.d.ts.map +1 -0
  74. package/dist/codemode/worker/mj-shim-proxy.d.ts +18 -0
  75. package/dist/codemode/worker/mj-shim-proxy.d.ts.map +1 -0
  76. package/dist/codemode/worker/namespace-shims.d.ts +32 -0
  77. package/dist/codemode/worker/namespace-shims.d.ts.map +1 -0
  78. package/dist/codemode/worker/node-shims.d.ts +65 -0
  79. package/dist/codemode/worker/node-shims.d.ts.map +1 -0
  80. package/dist/codemode/worker/prototype-hardening.d.ts +18 -0
  81. package/dist/codemode/worker/prototype-hardening.d.ts.map +1 -0
  82. package/dist/codemode/worker/result-compactor.d.ts +20 -0
  83. package/dist/codemode/worker/result-compactor.d.ts.map +1 -0
  84. package/dist/codemode/worker/sandbox-globals.d.ts +19 -0
  85. package/dist/codemode/worker/sandbox-globals.d.ts.map +1 -0
  86. package/dist/codemode/worker-api-proxy.d.ts +1 -6
  87. package/dist/codemode/worker-api-proxy.d.ts.map +1 -1
  88. package/dist/codemode/worker-result-proxy.d.ts.map +1 -1
  89. package/dist/codemode/worker-sandbox.d.ts.map +1 -1
  90. package/dist/constants/instructions/admin.d.ts +1 -1
  91. package/dist/constants/instructions/admin.d.ts.map +1 -1
  92. package/dist/constants/instructions/base.d.ts +2 -2
  93. package/dist/constants/instructions/base.d.ts.map +1 -1
  94. package/dist/constants/instructions/codemode.d.ts +1 -1
  95. package/dist/constants/instructions/codemode.d.ts.map +1 -1
  96. package/dist/constants/instructions/core.d.ts +1 -1
  97. package/dist/constants/instructions/core.d.ts.map +1 -1
  98. package/dist/constants/instructions/github.d.ts +1 -1
  99. package/dist/constants/instructions/github.d.ts.map +1 -1
  100. package/dist/constants/instructions/gotchas.d.ts +1 -1
  101. package/dist/constants/instructions/gotchas.d.ts.map +1 -1
  102. package/dist/constants/instructions/io.d.ts +1 -1
  103. package/dist/constants/instructions/io.d.ts.map +1 -1
  104. package/dist/constants/instructions/templates.d.ts +1 -1
  105. package/dist/constants/instructions/templates.d.ts.map +1 -1
  106. package/dist/constants/server-instructions.d.ts +2 -2
  107. package/dist/constants/server-instructions.d.ts.map +1 -1
  108. package/dist/database/core/interfaces.d.ts +6 -6
  109. package/dist/database/core/interfaces.d.ts.map +1 -1
  110. package/dist/database/sqlite-adapter/adapter-delegates.d.ts +161 -0
  111. package/dist/database/sqlite-adapter/adapter-delegates.d.ts.map +1 -0
  112. package/dist/database/sqlite-adapter/backup.d.ts.map +1 -1
  113. package/dist/database/sqlite-adapter/database-adapter.d.ts +17 -147
  114. package/dist/database/sqlite-adapter/database-adapter.d.ts.map +1 -1
  115. package/dist/database/sqlite-adapter/entries/crud-read.d.ts +16 -0
  116. package/dist/database/sqlite-adapter/entries/crud-read.d.ts.map +1 -0
  117. package/dist/database/sqlite-adapter/entries/crud-write.d.ts +62 -0
  118. package/dist/database/sqlite-adapter/entries/crud-write.d.ts.map +1 -0
  119. package/dist/database/sqlite-adapter/entries/crud.d.ts +3 -92
  120. package/dist/database/sqlite-adapter/entries/crud.d.ts.map +1 -1
  121. package/dist/database/sqlite-adapter/entries/importance.d.ts +7 -0
  122. package/dist/database/sqlite-adapter/entries/importance.d.ts.map +1 -1
  123. package/dist/database/sqlite-adapter/entries/index.d.ts +9 -4
  124. package/dist/database/sqlite-adapter/entries/index.d.ts.map +1 -1
  125. package/dist/database/sqlite-adapter/entries/revisions.d.ts +16 -0
  126. package/dist/database/sqlite-adapter/entries/revisions.d.ts.map +1 -0
  127. package/dist/database/sqlite-adapter/entries/search/date-and-pagination.d.ts +37 -0
  128. package/dist/database/sqlite-adapter/entries/search/date-and-pagination.d.ts.map +1 -0
  129. package/dist/database/sqlite-adapter/entries/search/entity-lookups.d.ts +31 -0
  130. package/dist/database/sqlite-adapter/entries/search/entity-lookups.d.ts.map +1 -0
  131. package/dist/database/sqlite-adapter/entries/search/fts-and-hybrid.d.ts +44 -0
  132. package/dist/database/sqlite-adapter/entries/search/fts-and-hybrid.d.ts.map +1 -0
  133. package/dist/database/sqlite-adapter/entries/search/index.d.ts +1 -1
  134. package/dist/database/sqlite-adapter/entries/search/index.d.ts.map +1 -1
  135. package/dist/database/sqlite-adapter/entries/search/query.d.ts +3 -82
  136. package/dist/database/sqlite-adapter/entries/search/query.d.ts.map +1 -1
  137. package/dist/database/sqlite-adapter/entries/statistics.d.ts.map +1 -1
  138. package/dist/database/sqlite-adapter/insights/cross-project.d.ts +42 -0
  139. package/dist/database/sqlite-adapter/insights/cross-project.d.ts.map +1 -0
  140. package/dist/database/sqlite-adapter/insights/entry-digest-queries.d.ts +17 -0
  141. package/dist/database/sqlite-adapter/insights/entry-digest-queries.d.ts.map +1 -0
  142. package/dist/database/sqlite-adapter/insights/team-collaboration.d.ts +29 -0
  143. package/dist/database/sqlite-adapter/insights/team-collaboration.d.ts.map +1 -0
  144. package/dist/database/sqlite-adapter/insights-operations.d.ts +11 -50
  145. package/dist/database/sqlite-adapter/insights-operations.d.ts.map +1 -1
  146. package/dist/database/sqlite-adapter/lifecycle-operations.d.ts.map +1 -1
  147. package/dist/database/sqlite-adapter/members.d.ts.map +1 -1
  148. package/dist/database/sqlite-adapter/native-connection.d.ts +5 -0
  149. package/dist/database/sqlite-adapter/native-connection.d.ts.map +1 -1
  150. package/dist/database/sqlite-adapter/relationships.d.ts +1 -2
  151. package/dist/database/sqlite-adapter/relationships.d.ts.map +1 -1
  152. package/dist/database/sqlite-adapter/tags.d.ts.map +1 -1
  153. package/dist/database/sqlite-adapter/vector-operations.d.ts.map +1 -1
  154. package/dist/filtering/tool-constants.d.ts +1 -1
  155. package/dist/{fts-T466O2JP.js → fts-YHUVPPYF.js} +2 -2
  156. package/dist/github/commit-references/enricher.d.ts.map +1 -1
  157. package/dist/github/github-integration/projects.d.ts.map +1 -1
  158. package/dist/handlers/prompts/adversarial-helpers.d.ts +75 -0
  159. package/dist/handlers/prompts/adversarial-helpers.d.ts.map +1 -0
  160. package/dist/handlers/prompts/adversarial.d.ts +3 -5
  161. package/dist/handlers/prompts/adversarial.d.ts.map +1 -1
  162. package/dist/handlers/prompts/cms-supervisor.d.ts +8 -0
  163. package/dist/handlers/prompts/cms-supervisor.d.ts.map +1 -0
  164. package/dist/handlers/prompts/index.d.ts.map +1 -1
  165. package/dist/handlers/prompts/optimizer.d.ts.map +1 -1
  166. package/dist/handlers/prompts/workflow.d.ts.map +1 -1
  167. package/dist/handlers/resources/core/briefing/context-section.d.ts.map +1 -1
  168. package/dist/handlers/resources/core/briefing/github-repo-and-kanban.d.ts +57 -0
  169. package/dist/handlers/resources/core/briefing/github-repo-and-kanban.d.ts.map +1 -0
  170. package/dist/handlers/resources/core/briefing/github-section.d.ts +23 -20
  171. package/dist/handlers/resources/core/briefing/github-section.d.ts.map +1 -1
  172. package/dist/handlers/resources/core/briefing/system-section.d.ts.map +1 -1
  173. package/dist/handlers/resources/core/briefing/user-message.d.ts.map +1 -1
  174. package/dist/handlers/resources/help.d.ts.map +1 -1
  175. package/dist/handlers/resources/index.d.ts.map +1 -1
  176. package/dist/handlers/resources/shared.d.ts +1 -0
  177. package/dist/handlers/resources/shared.d.ts.map +1 -1
  178. package/dist/handlers/resources/staleness.d.ts.map +1 -1
  179. package/dist/handlers/tools/admin/batch-tools.d.ts.map +1 -1
  180. package/dist/handlers/tools/admin/core-tools.d.ts.map +1 -1
  181. package/dist/handlers/tools/admin/index.d.ts.map +1 -1
  182. package/dist/handlers/tools/admin/lifecycle-tools.d.ts.map +1 -1
  183. package/dist/handlers/tools/admin/project-tools.d.ts +1 -1
  184. package/dist/handlers/tools/admin/project-tools.d.ts.map +1 -1
  185. package/dist/handlers/tools/admin/schemas/crud-batch-schemas.d.ts +609 -0
  186. package/dist/handlers/tools/admin/schemas/crud-batch-schemas.d.ts.map +1 -0
  187. package/dist/handlers/tools/admin/schemas/project-and-ops-schemas.d.ts +136 -0
  188. package/dist/handlers/tools/admin/schemas/project-and-ops-schemas.d.ts.map +1 -0
  189. package/dist/handlers/tools/admin/schemas.d.ts +2 -733
  190. package/dist/handlers/tools/admin/schemas.d.ts.map +1 -1
  191. package/dist/handlers/tools/admin/update_configuration.d.ts +14 -0
  192. package/dist/handlers/tools/admin/update_configuration.d.ts.map +1 -1
  193. package/dist/handlers/tools/admin/vector-tools.d.ts.map +1 -1
  194. package/dist/handlers/tools/analytics.d.ts.map +1 -1
  195. package/dist/handlers/tools/arg-interceptions.d.ts +51 -0
  196. package/dist/handlers/tools/arg-interceptions.d.ts.map +1 -0
  197. package/dist/handlers/tools/codemode/code-healer.d.ts +11 -0
  198. package/dist/handlers/tools/codemode/code-healer.d.ts.map +1 -0
  199. package/dist/handlers/tools/codemode/handler.d.ts +4 -23
  200. package/dist/handlers/tools/codemode/handler.d.ts.map +1 -1
  201. package/dist/handlers/tools/codemode/json-entry-recovery.d.ts +13 -0
  202. package/dist/handlers/tools/codemode/json-entry-recovery.d.ts.map +1 -0
  203. package/dist/handlers/tools/codemode/payload-synthesizer.d.ts +17 -0
  204. package/dist/handlers/tools/codemode/payload-synthesizer.d.ts.map +1 -0
  205. package/dist/handlers/tools/codemode/secure-dispatcher.d.ts +25 -0
  206. package/dist/handlers/tools/codemode/secure-dispatcher.d.ts.map +1 -0
  207. package/dist/handlers/tools/codemode/sql-recovery.d.ts +14 -0
  208. package/dist/handlers/tools/codemode/sql-recovery.d.ts.map +1 -0
  209. package/dist/handlers/tools/core/dummy-healing/alias-catalog.d.ts +21 -0
  210. package/dist/handlers/tools/core/dummy-healing/alias-catalog.d.ts.map +1 -0
  211. package/dist/handlers/tools/core/dummy-healing/entry-fallbacks.d.ts +4 -0
  212. package/dist/handlers/tools/core/dummy-healing/entry-fallbacks.d.ts.map +1 -0
  213. package/dist/handlers/tools/core/dummy-healing/fs-fallbacks.d.ts +19 -0
  214. package/dist/handlers/tools/core/dummy-healing/fs-fallbacks.d.ts.map +1 -0
  215. package/dist/handlers/tools/core/dummy-healing/index.d.ts +7 -0
  216. package/dist/handlers/tools/core/dummy-healing/index.d.ts.map +1 -0
  217. package/dist/handlers/tools/core/dummy-healing/mcp-fallbacks.d.ts +12 -0
  218. package/dist/handlers/tools/core/dummy-healing/mcp-fallbacks.d.ts.map +1 -0
  219. package/dist/handlers/tools/core/dummy-healing.d.ts +1 -29
  220. package/dist/handlers/tools/core/dummy-healing.d.ts.map +1 -1
  221. package/dist/handlers/tools/core/index.d.ts +1 -1
  222. package/dist/handlers/tools/core/index.d.ts.map +1 -1
  223. package/dist/handlers/tools/core/schemas.d.ts +33 -9
  224. package/dist/handlers/tools/core/schemas.d.ts.map +1 -1
  225. package/dist/handlers/tools/core/staleness-tools.d.ts +17 -0
  226. package/dist/handlers/tools/core/staleness-tools.d.ts.map +1 -1
  227. package/dist/handlers/tools/core/tools.d.ts.map +1 -1
  228. package/dist/handlers/tools/git.d.ts +5 -11
  229. package/dist/handlers/tools/git.d.ts.map +1 -1
  230. package/dist/handlers/tools/github/close-issue-tool.d.ts +6 -0
  231. package/dist/handlers/tools/github/close-issue-tool.d.ts.map +1 -0
  232. package/dist/handlers/tools/github/create-issue-tool.d.ts +6 -0
  233. package/dist/handlers/tools/github/create-issue-tool.d.ts.map +1 -0
  234. package/dist/handlers/tools/github/issue-tools.d.ts +3 -0
  235. package/dist/handlers/tools/github/issue-tools.d.ts.map +1 -1
  236. package/dist/handlers/tools/github/kanban-tools.d.ts.map +1 -1
  237. package/dist/handlers/tools/github/milestone-tools.d.ts.map +1 -1
  238. package/dist/handlers/tools/index.d.ts +2 -2
  239. package/dist/handlers/tools/index.d.ts.map +1 -1
  240. package/dist/handlers/tools/io/schemas.d.ts +5 -2
  241. package/dist/handlers/tools/io/schemas.d.ts.map +1 -1
  242. package/dist/handlers/tools/relationships.d.ts.map +1 -1
  243. package/dist/handlers/tools/schemas/constants-and-primitives.d.ts +53 -0
  244. package/dist/handlers/tools/schemas/constants-and-primitives.d.ts.map +1 -0
  245. package/dist/handlers/tools/schemas/hallucination-healer.d.ts +8 -0
  246. package/dist/handlers/tools/schemas/hallucination-healer.d.ts.map +1 -0
  247. package/dist/handlers/tools/schemas/output-schemas.d.ts +247 -0
  248. package/dist/handlers/tools/schemas/output-schemas.d.ts.map +1 -0
  249. package/dist/handlers/tools/schemas.d.ts +4 -306
  250. package/dist/handlers/tools/schemas.d.ts.map +1 -1
  251. package/dist/handlers/tools/search/cross-team.d.ts +14 -0
  252. package/dist/handlers/tools/search/cross-team.d.ts.map +1 -1
  253. package/dist/handlers/tools/search/helpers.d.ts.map +1 -1
  254. package/dist/handlers/tools/search/hybrid.d.ts.map +1 -1
  255. package/dist/handlers/tools/search/misc-tools.d.ts.map +1 -1
  256. package/dist/handlers/tools/search/schemas.d.ts +6 -3
  257. package/dist/handlers/tools/search/schemas.d.ts.map +1 -1
  258. package/dist/handlers/tools/search/search-entries.d.ts.map +1 -1
  259. package/dist/handlers/tools/search/semantic-search.d.ts.map +1 -1
  260. package/dist/handlers/tools/team/admin-tools/batch.d.ts.map +1 -1
  261. package/dist/handlers/tools/team/admin-tools/crud.d.ts.map +1 -1
  262. package/dist/handlers/tools/team/backup-tools.d.ts.map +1 -1
  263. package/dist/handlers/tools/team/core-tools.d.ts.map +1 -1
  264. package/dist/handlers/tools/team/helpers.d.ts.map +1 -1
  265. package/dist/handlers/tools/team/io-tools.d.ts.map +1 -1
  266. package/dist/handlers/tools/team/member-tools.d.ts.map +1 -1
  267. package/dist/handlers/tools/team/rbac.d.ts.map +1 -1
  268. package/dist/handlers/tools/team/relationship-tools.d.ts.map +1 -1
  269. package/dist/handlers/tools/team/schemas/admin-batch-schemas.d.ts +618 -0
  270. package/dist/handlers/tools/team/schemas/admin-batch-schemas.d.ts.map +1 -0
  271. package/dist/handlers/tools/team/schemas/analytics-vector-schemas.d.ts +464 -0
  272. package/dist/handlers/tools/team/schemas/analytics-vector-schemas.d.ts.map +1 -0
  273. package/dist/handlers/tools/team/schemas/core-search-schemas.d.ts +525 -0
  274. package/dist/handlers/tools/team/schemas/core-search-schemas.d.ts.map +1 -0
  275. package/dist/handlers/tools/team/schemas/io-backup-schemas.d.ts +419 -0
  276. package/dist/handlers/tools/team/schemas/io-backup-schemas.d.ts.map +1 -0
  277. package/dist/handlers/tools/team/schemas.d.ts +5 -2002
  278. package/dist/handlers/tools/team/schemas.d.ts.map +1 -1
  279. package/dist/handlers/tools/team/search-tools.d.ts.map +1 -1
  280. package/dist/handlers/tools/team/vector-tools.d.ts.map +1 -1
  281. package/dist/index.js +6 -9
  282. package/dist/markdown/exporter.d.ts.map +1 -1
  283. package/dist/markdown/importer.d.ts.map +1 -1
  284. package/dist/observability/latency-tracker.d.ts.map +1 -1
  285. package/dist/observability/metrics-server.d.ts +1 -1
  286. package/dist/observability/metrics-server.d.ts.map +1 -1
  287. package/dist/observability/token-estimator.d.ts.map +1 -1
  288. package/dist/{security-utils-HNTROJAG.js → security-utils-P4P6A2DG.js} +1 -1
  289. package/dist/server/digest-reporter.d.ts +1 -0
  290. package/dist/server/digest-reporter.d.ts.map +1 -1
  291. package/dist/server/mcp-server/core.d.ts.map +1 -1
  292. package/dist/server/mcp-server/tool-registration/call-interceptor.d.ts +6 -0
  293. package/dist/server/mcp-server/tool-registration/call-interceptor.d.ts.map +1 -0
  294. package/dist/server/mcp-server/tool-registration/index.d.ts +4 -0
  295. package/dist/server/mcp-server/tool-registration/index.d.ts.map +1 -0
  296. package/dist/server/mcp-server/tool-registration/list-interceptor.d.ts +4 -0
  297. package/dist/server/mcp-server/tool-registration/list-interceptor.d.ts.map +1 -0
  298. package/dist/server/mcp-server/tool-registration/register-tools.d.ts +18 -0
  299. package/dist/server/mcp-server/tool-registration/register-tools.d.ts.map +1 -0
  300. package/dist/server/mcp-server/tool-registration.d.ts +1 -17
  301. package/dist/server/mcp-server/tool-registration.d.ts.map +1 -1
  302. package/dist/server/registration.d.ts +2 -0
  303. package/dist/server/registration.d.ts.map +1 -1
  304. package/dist/server/scheduler.d.ts +1 -0
  305. package/dist/server/scheduler.d.ts.map +1 -1
  306. package/dist/server/subscription-manager.d.ts +2 -0
  307. package/dist/server/subscription-manager.d.ts.map +1 -1
  308. package/dist/tools-BOQV7QD3.js +6 -0
  309. package/dist/transports/http/security.d.ts.map +1 -1
  310. package/dist/transports/http/server/http-transport.d.ts +25 -0
  311. package/dist/transports/http/server/http-transport.d.ts.map +1 -0
  312. package/dist/transports/http/server/index.d.ts +3 -30
  313. package/dist/transports/http/server/index.d.ts.map +1 -1
  314. package/dist/transports/http/server/legacy-sse.d.ts.map +1 -1
  315. package/dist/transports/http/server/protocol-handlers.d.ts +9 -0
  316. package/dist/transports/http/server/protocol-handlers.d.ts.map +1 -0
  317. package/dist/types/entities.d.ts +41 -1
  318. package/dist/types/entities.d.ts.map +1 -1
  319. package/dist/types/index.d.ts +11 -4
  320. package/dist/types/index.d.ts.map +1 -1
  321. package/dist/utils/config-manager.d.ts +2 -0
  322. package/dist/utils/config-manager.d.ts.map +1 -1
  323. package/dist/utils/error-helpers.d.ts.map +1 -1
  324. package/dist/utils/issue-logger.d.ts.map +1 -1
  325. package/dist/utils/mcp-logger.d.ts +14 -2
  326. package/dist/utils/mcp-logger.d.ts.map +1 -1
  327. package/dist/utils/security-utils.d.ts.map +1 -1
  328. package/dist/utils/vector-index-helpers.d.ts +1 -1
  329. package/dist/utils/vector-index-helpers.d.ts.map +1 -1
  330. package/dist/utils/workspace-resolver.d.ts.map +1 -1
  331. package/dist/vector/vector-search-manager/manager.d.ts +2 -2
  332. package/dist/vector/vector-search-manager/manager.d.ts.map +1 -1
  333. package/dist/vector/vector-search-manager/rebuild.d.ts.map +1 -1
  334. package/dist/vendor/lib-agent-exec/interceptors/git-interceptor.d.ts.map +1 -1
  335. package/dist/vendor/lib-agent-exec/schema.d.ts +18 -18
  336. package/dist/vendor/lib-agent-exec/schema.d.ts.map +1 -1
  337. package/dist/vendor/lib-agent-exec/stream-manager.d.ts.map +1 -1
  338. package/dist/worker-script.js +2662 -2645
  339. package/package.json +3 -4
  340. package/skills/memory-journal-mcp/SKILL.md +8 -8
  341. package/dist/auth/context.d.ts +0 -7
  342. package/dist/auth/context.d.ts.map +0 -1
  343. package/dist/chunk-ELMJYRTT.js +0 -29
  344. package/dist/chunk-F6WSLZVN.js +0 -675
  345. package/dist/chunk-JVGY2GHK.js +0 -776
  346. package/dist/chunk-KWSBCSFM.js +0 -411
  347. package/dist/chunk-SP5D3XYY.js +0 -1550
  348. package/dist/chunk-XJMEPP36.js +0 -57
  349. package/dist/database/core/entry-columns.d.ts +0 -8
  350. package/dist/database/core/entry-columns.d.ts.map +0 -1
  351. package/dist/database/core/schema.d.ts +0 -69
  352. package/dist/database/core/schema.d.ts.map +0 -1
  353. package/dist/error-helpers-STR7IPUR.js +0 -2
  354. package/dist/git-runner-6OE7PVKA.js +0 -1
  355. package/dist/journal-api-UG43ZD7Y.js +0 -1289
  356. package/dist/tools-RBNFDWIE.js +0 -9
@@ -1,1550 +0,0 @@
1
- import { resolveProjectContext } from './chunk-AIWHVEOW.js';
2
-
3
- // src/codemode/api/git-api.ts
4
- function applyGitInterceptions(methodName, args) {
5
- const gitMethods = [
6
- "get_commit_history",
7
- "getCommitHistory",
8
- "search_commits",
9
- "searchCommits",
10
- "get_release_info",
11
- "getReleaseInfo",
12
- "get_unreleased_commits",
13
- "getUnreleasedCommits",
14
- "analyze_commit_patterns",
15
- "analyzeCommitPatterns"
16
- ];
17
- if (gitMethods.includes(methodName) && args.length === 1 && typeof args[0] === "object" && args[0] !== null) {
18
- const obj = args[0];
19
- for (const key of ["text", "message", "description", "q", "search"]) {
20
- if (obj[key] !== void 0 && obj["query"] === void 0 && (methodName.includes("search_commits") || methodName.includes("searchCommits"))) {
21
- obj["query"] = obj[key];
22
- Reflect.deleteProperty(obj, key);
23
- }
24
- }
25
- if (obj["keep"] !== void 0 && obj["maxCount"] === void 0 && obj["max_count"] === void 0) {
26
- obj["maxCount"] = obj["keep"];
27
- delete obj["keep"];
28
- }
29
- if (obj["limit"] !== void 0 && obj["maxCount"] === void 0 && obj["max_count"] === void 0) {
30
- obj["maxCount"] = obj["limit"];
31
- delete obj["limit"];
32
- }
33
- if (!methodName.includes("search") && (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["search"] !== void 0)) {
34
- return { error: {
35
- success: false,
36
- error: `${methodName} does not support search queries (q/query/search). It only retrieves history or analysis.`,
37
- code: "VALIDATION_ERROR",
38
- category: "validation",
39
- suggestion: "Remove the query parameter, or use search_commits for text search.",
40
- recoverable: true
41
- } };
42
- }
43
- return { args: [obj] };
44
- }
45
- return null;
46
- }
47
-
48
- // src/codemode/param-normalizer.ts
49
- function isRecord(val) {
50
- return typeof val === "object" && val !== null && !Array.isArray(val);
51
- }
52
- function safeString(val) {
53
- if (typeof val === "string") return val;
54
- if (typeof val === "number" || typeof val === "boolean") return String(val);
55
- if (typeof val === "object" && val !== null) {
56
- try {
57
- return JSON.stringify(val, null, 2);
58
- } catch {
59
- return "";
60
- }
61
- }
62
- return "";
63
- }
64
- function applyArgInterceptions(methodName, args) {
65
- const gitIntercept = applyGitInterceptions(methodName, args);
66
- if (gitIntercept) return gitIntercept;
67
- if ((methodName === "execute" || methodName === "execute_code" || methodName === "executeCode" || methodName === "mj_execute_code" || methodName === "mjExecuteCode" || methodName === "mysql_execute_code" || methodName === "mysqlExecuteCode") && args.length === 1 && typeof args[0] === "string") {
68
- args = [{ code: args[0] }];
69
- }
70
- if ((methodName === "create_entry" || methodName === "createEntry" || methodName === "team_create_entry" || methodName === "teamCreateEntry") && args.length === 1 && typeof args[0] === "string") {
71
- args = [{ content: args[0] }];
72
- }
73
- if (args.length === 2 && typeof args[0] === "string" && isRecord(args[1])) {
74
- const firstStr = args[0].trim();
75
- const mergedObj = { ...args[1] };
76
- if (mergedObj["workspace_id"] === void 0 && mergedObj["workspaceId"] === void 0) {
77
- mergedObj["workspace_id"] = firstStr;
78
- } else if (mergedObj["title"] === void 0 && mergedObj["content"] === void 0) {
79
- mergedObj["title"] = firstStr;
80
- }
81
- args = [mergedObj];
82
- }
83
- if (args.length === 1 && isRecord(args[0])) {
84
- const obj = { ...args[0] };
85
- args[0] = obj;
86
- if (obj["_u_r_i"] !== void 0) {
87
- if (obj["uri"] === void 0 && obj["Uri"] === void 0) obj["uri"] = obj["_u_r_i"];
88
- delete obj["_u_r_i"];
89
- }
90
- if (obj["_uri"] !== void 0) {
91
- if (obj["uri"] === void 0 && obj["Uri"] === void 0) obj["uri"] = obj["_uri"];
92
- delete obj["_uri"];
93
- }
94
- if (obj["_url"] !== void 0) {
95
- if (obj["url"] === void 0 && obj["Url"] === void 0) obj["url"] = obj["_url"];
96
- delete obj["_url"];
97
- }
98
- delete obj["_server_name"];
99
- delete obj["_tool_name"];
100
- delete obj["_meta"];
101
- for (const key of Object.keys(obj)) {
102
- if (key.startsWith("_") && key !== "_journal") {
103
- const strippedKey = key.replace(/^_+/, "");
104
- if (strippedKey.length > 0 && obj[strippedKey] === void 0) {
105
- obj[strippedKey] = obj[key];
106
- }
107
- Reflect.deleteProperty(obj, key);
108
- }
109
- }
110
- const isSearchOrGrep = methodName.toLowerCase().includes("search") || methodName.toLowerCase().includes("grep") || methodName.toLowerCase().includes("find");
111
- if (isSearchOrGrep) {
112
- if (obj["search_path"] === void 0) {
113
- const p = obj["searchPath"] ?? obj["SearchPath"] ?? obj["path"] ?? obj["Path"] ?? obj["dir"] ?? obj["directory"] ?? obj["cwd"];
114
- if (typeof p === "string") obj["search_path"] = p;
115
- }
116
- if (obj["query"] === void 0) {
117
- const q = obj["Query"] ?? obj["pattern"] ?? obj["text"] ?? obj["search"] ?? obj["q"];
118
- if (typeof q === "string") obj["query"] = q;
119
- }
120
- if (obj["file_pattern"] === void 0) {
121
- const fp = obj["filePattern"] ?? obj["FilePattern"] ?? obj["include"];
122
- if (typeof fp === "string") obj["file_pattern"] = fp;
123
- }
124
- if (obj["case_insensitive"] === void 0) {
125
- const ci = obj["caseInsensitive"] ?? obj["CaseInsensitive"] ?? obj["ignore_case"] ?? obj["ignoreCase"];
126
- if (typeof ci === "boolean") obj["case_insensitive"] = ci;
127
- }
128
- if (obj["is_regex"] === void 0) {
129
- const ir = obj["isRegex"] ?? obj["IsRegex"] ?? obj["regex"];
130
- if (typeof ir === "boolean") obj["is_regex"] = ir;
131
- }
132
- if (obj["match_per_line"] === void 0) {
133
- const mpl = obj["matchPerLine"] ?? obj["MatchPerLine"];
134
- if (typeof mpl === "boolean") obj["match_per_line"] = mpl;
135
- }
136
- }
137
- const metaObj = isRecord(obj["metadata"]) ? obj["metadata"] : isRecord(obj["context"]) ? obj["context"] : void 0;
138
- if (metaObj) {
139
- if (obj["project_number"] === void 0 && metaObj["project_number"] !== void 0) obj["project_number"] = metaObj["project_number"];
140
- if (obj["project_number"] === void 0 && metaObj["projectNumber"] !== void 0) obj["project_number"] = metaObj["projectNumber"];
141
- if (obj["session_id"] === void 0 && metaObj["session_id"] !== void 0) obj["session_id"] = metaObj["session_id"];
142
- if (obj["session_id"] === void 0 && metaObj["sessionId"] !== void 0) obj["session_id"] = metaObj["sessionId"];
143
- if (obj["type"] === void 0 && metaObj["type"] !== void 0) obj["type"] = metaObj["type"];
144
- if (obj["type"] === void 0 && metaObj["entry_type"] !== void 0) obj["type"] = metaObj["entry_type"];
145
- if (obj["type"] === void 0 && metaObj["category"] !== void 0) obj["type"] = metaObj["category"];
146
- if (obj["tags"] === void 0 && metaObj["tags"] !== void 0) obj["tags"] = metaObj["tags"];
147
- if (obj["workspace_id"] === void 0 && metaObj["workspace_id"] !== void 0) obj["workspace_id"] = metaObj["workspace_id"];
148
- if (obj["workspace_id"] === void 0 && metaObj["workspaceId"] !== void 0) obj["workspace_id"] = metaObj["workspaceId"];
149
- }
150
- for (const key of ["entry_id", "entryId", "id", "from_entry_id", "fromEntryId", "to_entry_id", "toEntryId", "project_number", "projectNumber", "issue_number", "issueNumber", "pr_number", "prNumber", "milestone_number", "milestoneNumber", "offset", "limit"]) {
151
- const val = obj[key];
152
- if (typeof val === "string") {
153
- const strVal = val.trim();
154
- if (/^-?\d+$/.test(strVal)) {
155
- const parsed = parseInt(strVal, 10);
156
- if (!isNaN(parsed)) obj[key] = parsed;
157
- } else if ((key === "project_number" || key === "projectNumber") && /^p-?\d+$/i.test(strVal)) {
158
- const parsed = parseInt(strVal.replace(/^p-?/i, ""), 10);
159
- if (!isNaN(parsed)) obj[key] = parsed;
160
- } else if (key === "project_number" || key === "projectNumber") {
161
- Reflect.deleteProperty(obj, key);
162
- }
163
- }
164
- }
165
- if (obj["user"] !== void 0 && obj["target_user"] === void 0) {
166
- obj["target_user"] = obj["user"];
167
- delete obj["user"];
168
- }
169
- if (obj["severity"] !== void 0 && obj["flag_type"] === void 0) {
170
- obj["flag_type"] = obj["severity"];
171
- delete obj["severity"];
172
- }
173
- if (obj["msg"] !== void 0 && obj["message"] === void 0) {
174
- obj["message"] = obj["msg"];
175
- delete obj["message"];
176
- }
177
- if (obj["sort"] !== void 0 && obj["sort_by"] === void 0) {
178
- obj["sort_by"] = obj["sort"];
179
- delete obj["sort"];
180
- }
181
- if (obj["sortBy"] !== void 0 && obj["sort_by"] === void 0) {
182
- obj["sort_by"] = obj["sortBy"];
183
- delete obj["sortBy"];
184
- }
185
- if (obj["orderBy"] !== void 0 && obj["sort_by"] === void 0) {
186
- obj["sort_by"] = obj["orderBy"];
187
- delete obj["orderBy"];
188
- }
189
- if (obj["order_by"] !== void 0 && obj["sort_by"] === void 0) {
190
- obj["sort_by"] = obj["order_by"];
191
- delete obj["order_by"];
192
- }
193
- if (obj["confidence"] !== void 0) {
194
- if (obj["trust_score"] === void 0) obj["trust_score"] = typeof obj["confidence"] === "string" ? Number(obj["confidence"]) : obj["confidence"];
195
- delete obj["confidence"];
196
- }
197
- if (obj["trust"] !== void 0) {
198
- if (obj["trust_score"] === void 0) obj["trust_score"] = typeof obj["trust"] === "string" ? Number(obj["trust"]) : obj["trust"];
199
- delete obj["trust"];
200
- }
201
- if (obj["trustScore"] !== void 0) {
202
- if (obj["trust_score"] === void 0) obj["trust_score"] = typeof obj["trustScore"] === "string" ? Number(obj["trustScore"]) : obj["trustScore"];
203
- delete obj["trustScore"];
204
- }
205
- if (obj["impact"] !== void 0) {
206
- if (obj["impact_score"] === void 0) obj["impact_score"] = typeof obj["impact"] === "string" ? Number(obj["impact"]) : obj["impact"];
207
- delete obj["impact"];
208
- }
209
- if (obj["impactScore"] !== void 0) {
210
- if (obj["impact_score"] === void 0) obj["impact_score"] = typeof obj["impactScore"] === "string" ? Number(obj["impactScore"]) : obj["impactScore"];
211
- delete obj["impactScore"];
212
- }
213
- if (obj["validation"] !== void 0) {
214
- if (obj["validation_status"] === void 0) obj["validation_status"] = obj["validation"];
215
- delete obj["validation"];
216
- }
217
- if (obj["validationStatus"] !== void 0) {
218
- if (obj["validation_status"] === void 0) obj["validation_status"] = obj["validationStatus"];
219
- delete obj["validationStatus"];
220
- }
221
- if (obj["validation_status"] !== void 0 && obj["validation_status"] !== null) {
222
- const vs = typeof obj["validation_status"] === "string" ? obj["validation_status"].trim().toLowerCase() : obj["validation_status"];
223
- if (vs === true || vs === "pass" || vs === "success" || vs === "ok" || vs === "passed" || vs === "validated" || vs === "valid" || vs === "verified" || vs === "true" || vs === "1") {
224
- obj["validation_status"] = "passed";
225
- } else if (vs === false || vs === "fail" || vs === "failed" || vs === "error" || vs === "failing" || vs === "false" || vs === "0") {
226
- obj["validation_status"] = "failed";
227
- } else if (vs === "none" || vs === "null" || vs === "undefined" || vs === "skip" || vs === "skipped" || vs === "unknown" || vs === "pending") {
228
- obj["validation_status"] = "none";
229
- } else if (typeof vs === "string" && !["passed", "none", "failed"].includes(vs)) {
230
- obj["validation_status"] = "none";
231
- }
232
- }
233
- if (obj["project_name"] !== void 0) {
234
- if (obj["project_number"] === void 0) {
235
- const num = Number(obj["project_name"]);
236
- const strVal = typeof obj["project_name"] === "string" || typeof obj["project_name"] === "number" ? String(obj["project_name"]) : "";
237
- if (!Number.isNaN(num) && strVal.trim() !== "") {
238
- obj["project_number"] = num;
239
- }
240
- }
241
- delete obj["project_name"];
242
- }
243
- if (obj["projectName"] !== void 0) {
244
- if (obj["project_number"] === void 0) {
245
- const num = Number(obj["projectName"]);
246
- const strVal = typeof obj["projectName"] === "string" || typeof obj["projectName"] === "number" ? String(obj["projectName"]) : "";
247
- if (!Number.isNaN(num) && strVal.trim() !== "") {
248
- obj["project_number"] = num;
249
- }
250
- }
251
- delete obj["projectName"];
252
- }
253
- if (obj["project"] !== void 0) {
254
- if (obj["project_number"] === void 0) {
255
- const num = Number(obj["project"]);
256
- const strVal = typeof obj["project"] === "string" || typeof obj["project"] === "number" ? String(obj["project"]) : "";
257
- if (!Number.isNaN(num) && strVal.trim() !== "") {
258
- obj["project_number"] = num;
259
- } else if (typeof obj["project"] === "string" && obj["project"].trim() !== "") {
260
- const projStr = obj["project"].trim();
261
- const existingTags = Array.isArray(obj["tags"]) ? obj["tags"].filter((t) => typeof t === "string") : [];
262
- obj["tags"] = [...existingTags, projStr];
263
- }
264
- }
265
- delete obj["project"];
266
- }
267
- if (methodName === "create_entry" || methodName === "createEntry" || methodName === "team_create_entry" || methodName === "teamCreateEntry") {
268
- let projNum = typeof obj["project_number"] === "number" ? obj["project_number"] : void 0;
269
- if (typeof obj["project_number"] === "string") {
270
- const cleaned = obj["project_number"].trim();
271
- let parsedNum = Number(cleaned);
272
- if (Number.isNaN(parsedNum) && /^p-?\d+$/i.test(cleaned)) {
273
- parsedNum = Number(cleaned.replace(/^p-?/i, ""));
274
- }
275
- if (!Number.isNaN(parsedNum) && cleaned !== "") {
276
- projNum = parsedNum;
277
- obj["project_number"] = parsedNum;
278
- } else {
279
- if (obj["workspace_id"] === void 0 || obj["workspace_id"] === null || obj["workspace_id"] === "" || obj["workspace_id"] === "default") {
280
- obj["workspace_id"] = cleaned;
281
- }
282
- delete obj["project_number"];
283
- }
284
- }
285
- const content = typeof obj["content"] === "string" ? obj["content"] : void 0;
286
- const tags = Array.isArray(obj["tags"]) ? obj["tags"].filter((t) => typeof t === "string") : void 0;
287
- const resolved = resolveProjectContext({
288
- workspace_id: typeof obj["workspace_id"] === "string" ? obj["workspace_id"] : void 0,
289
- project_number: projNum,
290
- content,
291
- tags
292
- });
293
- if (resolved.workspaceId && (obj["workspace_id"] === void 0 || obj["workspace_id"] === null || obj["workspace_id"] === "" || obj["workspace_id"] === "default")) {
294
- if (resolved.workspaceId !== "default") {
295
- obj["workspace_id"] = resolved.workspaceId;
296
- } else if (process.env["MCP_WORKSPACE_ID"]) {
297
- obj["workspace_id"] = process.env["MCP_WORKSPACE_ID"];
298
- } else {
299
- obj["workspace_id"] = "default";
300
- }
301
- }
302
- if (obj["project_number"] === void 0 && resolved.projectNumber !== void 0) {
303
- obj["project_number"] = resolved.projectNumber;
304
- }
305
- }
306
- if (typeof obj["sort_by"] === "string") {
307
- const lowerSort = obj["sort_by"].toLowerCase();
308
- if (lowerSort.endsWith("_asc")) {
309
- obj["sort_by"] = obj["sort_by"].replace(/_asc$/i, "");
310
- if (obj["sort_order"] === void 0) obj["sort_order"] = "asc";
311
- } else if (lowerSort.endsWith("_desc")) {
312
- obj["sort_by"] = obj["sort_by"].replace(/_desc$/i, "");
313
- if (obj["sort_order"] === void 0) obj["sort_order"] = "desc";
314
- }
315
- }
316
- if (methodName === "execute" || methodName === "execute_code" || methodName === "executeCode" || methodName === "mj_execute_code" || methodName === "mjExecuteCode" || methodName === "mysql_execute_code" || methodName === "mysqlExecuteCode") {
317
- if (obj["repo_name"] !== void 0 && obj["repo"] === void 0) {
318
- obj["repo"] = obj["repo_name"];
319
- delete obj["repo_name"];
320
- }
321
- if (obj["code"] === void 0) {
322
- const codeAlias = obj["script"] ?? obj["js"] ?? obj["javascript"] ?? obj["query"] ?? obj["command"] ?? obj["content"] ?? obj["eval"] ?? obj["source"] ?? obj["body"] ?? obj["expression"] ?? obj["fn"] ?? obj["exec"] ?? obj["code_snippet"] ?? obj["raw_code"] ?? obj["statement"] ?? obj["statements"] ?? obj["codeBlock"] ?? obj["code_block"] ?? obj["script_content"] ?? obj["js_code"] ?? obj["code_string"] ?? obj["action"] ?? obj["task"] ?? obj["instruction"] ?? obj["instructions"] ?? obj["input"] ?? obj["payload"] ?? obj["text"];
323
- if (typeof codeAlias === "string") {
324
- obj["code"] = codeAlias;
325
- } else if (isRecord(obj["payload"])) {
326
- obj["code"] = JSON.stringify(obj["payload"]);
327
- } else if (isRecord(obj["entry"])) {
328
- obj["code"] = JSON.stringify(obj["entry"]);
329
- } else if (isRecord(obj["input"])) {
330
- obj["code"] = JSON.stringify(obj["input"]);
331
- } else if (obj["action"] !== void 0 || obj["task"] !== void 0 || obj["notes"] !== void 0 || obj["changes"] !== void 0) {
332
- obj["code"] = JSON.stringify(obj);
333
- } else {
334
- for (const [k, v] of Object.entries(obj)) {
335
- if (typeof v === "string" && v.trim().length > 0 && !["repo", "workspace_id", "expected_version", "auto_version", "project_number"].includes(k)) {
336
- obj["code"] = v;
337
- break;
338
- }
339
- }
340
- }
341
- }
342
- } else {
343
- if (obj["repo"] !== void 0 && obj["repo_name"] === void 0) {
344
- obj["repo_name"] = obj["repo"];
345
- delete obj["repo"];
346
- }
347
- }
348
- if (obj["item_type"] !== void 0 && obj["type"] === void 0) {
349
- obj["type"] = obj["item_type"];
350
- delete obj["item_type"];
351
- }
352
- if (obj["category"] !== void 0 && obj["type"] === void 0) {
353
- obj["type"] = obj["category"];
354
- delete obj["category"];
355
- }
356
- if (obj["metadata"] !== void 0 && obj["context"] === void 0) {
357
- obj["context"] = obj["metadata"];
358
- delete obj["metadata"];
359
- }
360
- if (methodName === "update_configuration" || methodName === "updateConfiguration") {
361
- if (obj["update_notes"] !== void 0 || obj["notes"] !== void 0 || obj["text"] !== void 0 && obj["tool_filter"] === void 0 && obj["briefing"] === void 0) {
362
- return { error: {
363
- success: false,
364
- error: "update_configuration is for changing server configuration (tool_filter, briefing). To create journal entries or update notes, use mj.core.createEntry({ ... }).",
365
- code: "VALIDATION_ERROR",
366
- category: "validation",
367
- suggestion: "Use mj.core.createEntry({ content: '...', project_number: 1 }) instead.",
368
- recoverable: true
369
- } };
370
- }
371
- }
372
- const isEntryMutation = methodName === "create_entry" || methodName === "createEntry" || methodName === "update_entry" || methodName === "updateEntry" || methodName === "team_create_entry" || methodName === "teamCreateEntry";
373
- if (isEntryMutation) {
374
- if (obj["type"] !== void 0 && obj["entry_type"] === void 0) {
375
- obj["entry_type"] = obj["type"];
376
- delete obj["type"];
377
- }
378
- if (typeof obj["entry_type"] === "string") {
379
- const etLower = obj["entry_type"].toLowerCase().trim();
380
- if (["bug", "bugfix", "bug_fix", "bug-fix", "hotfix", "defect"].includes(etLower)) {
381
- obj["entry_type"] = "bug_fix";
382
- } else if (["progress", "status", "development"].includes(etLower)) {
383
- obj["entry_type"] = "development_note";
384
- } else if (etLower === "feature") {
385
- obj["entry_type"] = "feature_implementation";
386
- } else if (etLower === "meeting") {
387
- obj["entry_type"] = "meeting_notes";
388
- } else if (["task", "chore", "refactor", "fix", "update", "technical", "note", "documentation", "code", "coding"].includes(etLower)) {
389
- obj["entry_type"] = "technical_note";
390
- } else if (["session-summary", "session_summary", "team-session-summary", "team_session_summary", "team session summary"].includes(etLower)) {
391
- obj["entry_type"] = "retrospective";
392
- }
393
- }
394
- const contentParts = [];
395
- const title = obj["title"] ?? obj["heading"] ?? obj["subject"] ?? obj["name"];
396
- if (title !== void 0) {
397
- const titleStr = safeString(title);
398
- if (titleStr !== "") contentParts.push(`# ${titleStr}`);
399
- delete obj["title"];
400
- delete obj["heading"];
401
- delete obj["subject"];
402
- delete obj["name"];
403
- }
404
- const desc = obj["description"] ?? obj["details"] ?? obj["summary"] ?? obj["notes"] ?? obj["text"] ?? obj["message"];
405
- if (desc !== void 0) {
406
- const descStr = safeString(desc);
407
- if (descStr !== "") contentParts.push(descStr);
408
- delete obj["description"];
409
- delete obj["details"];
410
- delete obj["summary"];
411
- delete obj["notes"];
412
- delete obj["text"];
413
- delete obj["message"];
414
- }
415
- if (obj["context"] !== void 0) {
416
- const ctxStr = safeString(obj["context"]);
417
- if (ctxStr !== "") contentParts.push(`**Context:** ${ctxStr}`);
418
- delete obj["context"];
419
- }
420
- const focus = obj["focus"] ?? obj["goal"] ?? obj["objective"];
421
- if (focus !== void 0) {
422
- const focusStr = safeString(focus);
423
- if (focusStr !== "") contentParts.push(`**Focus:** ${focusStr}`);
424
- delete obj["focus"];
425
- delete obj["goal"];
426
- delete obj["objective"];
427
- }
428
- const resolution = obj["resolution"] ?? obj["fix"] ?? obj["solution"] ?? obj["result"];
429
- if (resolution !== void 0) {
430
- const resStr = safeString(resolution);
431
- if (resStr !== "") contentParts.push(`**Resolution:** ${resStr}`);
432
- delete obj["resolution"];
433
- delete obj["fix"];
434
- delete obj["solution"];
435
- delete obj["result"];
436
- }
437
- const artifacts = obj["artifacts"] ?? obj["files"] ?? obj["changes"] ?? obj["modified_files"];
438
- if (artifacts !== void 0) {
439
- const artStr = Array.isArray(artifacts) ? artifacts.map(safeString).join(", ") : safeString(artifacts);
440
- if (artStr !== "") contentParts.push(`**Artifacts:** ${artStr}`);
441
- delete obj["artifacts"];
442
- delete obj["files"];
443
- delete obj["changes"];
444
- delete obj["modified_files"];
445
- }
446
- const findings = obj["findings"] ?? obj["results"] ?? obj["key_findings"] ?? obj["discoveries"];
447
- if (findings !== void 0) {
448
- const findingsStr = Array.isArray(findings) ? findings.map((f) => `- ${safeString(f)}`).join("\n") : safeString(findings);
449
- if (findingsStr !== "") contentParts.push(`**Findings:**
450
- ${findingsStr}`);
451
- delete obj["findings"];
452
- delete obj["results"];
453
- delete obj["key_findings"];
454
- delete obj["discoveries"];
455
- }
456
- if (obj["content"] !== void 0) {
457
- const existing = safeString(obj["content"]);
458
- if (contentParts.length > 0) {
459
- obj["content"] = existing !== "" ? `${existing}
460
-
461
- ${contentParts.join("\n\n")}` : contentParts.join("\n\n");
462
- }
463
- } else if (contentParts.length > 0) {
464
- obj["content"] = contentParts.join("\n\n");
465
- }
466
- if (typeof obj["content"] === "string") {
467
- obj["content"] = obj["content"].replace(/\\+'/g, "'").replace(/\\+"/g, '"');
468
- }
469
- }
470
- if (obj["search"] !== void 0 && obj["query"] === void 0) {
471
- obj["query"] = obj["search"];
472
- delete obj["search"];
473
- }
474
- if ((methodName === "import_external" || methodName === "importExternal" || methodName === "team_import_external" || methodName === "teamImportExternal") && obj["source_dir"] === void 0) {
475
- if (obj["filename"] !== void 0) {
476
- obj["source_dir"] = obj["filename"];
477
- delete obj["filename"];
478
- }
479
- }
480
- }
481
- if ((methodName === "search_entries" || methodName === "searchEntries" || methodName === "team_search" || methodName === "teamSearch" || methodName === "search_by_date_range" || methodName === "searchByDateRange" || methodName === "team_search_by_date_range" || methodName === "teamSearchByDateRange" || methodName === "semantic_search" || methodName === "semanticSearch" || methodName === "team_semantic_search" || methodName === "teamSemanticSearch" || methodName === "cross_team_search" || methodName === "crossTeamSearch") && args.length === 1 && isRecord(args[0])) {
482
- const obj = { ...args[0] };
483
- args[0] = obj;
484
- if (methodName === "search_by_date_range" || methodName === "searchByDateRange" || methodName === "team_search_by_date_range" || methodName === "teamSearchByDateRange") {
485
- if (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["text"] !== void 0 || obj["message"] !== void 0 || obj["description"] !== void 0 || obj["keep"] !== void 0 || obj["path"] !== void 0) {
486
- return { error: {
487
- success: false,
488
- error: `${methodName} does not support search queries. It only searches by date.`,
489
- code: "VALIDATION_ERROR",
490
- category: "validation",
491
- suggestion: "Use team_search (or search_entries) if you want to search by text, or remove the text/query parameters.",
492
- recoverable: true
493
- } };
494
- }
495
- }
496
- if (obj["q"] !== void 0 && obj["query"] === void 0) {
497
- obj["query"] = obj["q"];
498
- delete obj["q"];
499
- }
500
- if (obj["text"] !== void 0 && obj["query"] === void 0) {
501
- obj["query"] = obj["text"];
502
- delete obj["text"];
503
- }
504
- if (obj["message"] !== void 0 && obj["query"] === void 0) {
505
- obj["query"] = obj["message"];
506
- delete obj["message"];
507
- }
508
- if (obj["description"] !== void 0 && obj["query"] === void 0) {
509
- obj["query"] = obj["description"];
510
- delete obj["description"];
511
- }
512
- if (obj["path"] !== void 0 && obj["query"] === void 0) {
513
- obj["query"] = obj["path"];
514
- delete obj["path"];
515
- }
516
- if (obj["keep"] !== void 0 && obj["query"] === void 0) {
517
- obj["query"] = obj["keep"];
518
- delete obj["keep"];
519
- }
520
- if (obj["start"] !== void 0 && obj["start_date"] === void 0) {
521
- obj["start_date"] = obj["start"];
522
- delete obj["start"];
523
- }
524
- if (obj["end"] !== void 0 && obj["end_date"] === void 0) {
525
- obj["end_date"] = obj["end"];
526
- delete obj["end"];
527
- }
528
- if (typeof obj["limit"] === "string") {
529
- const parsed = parseInt(obj["limit"], 10);
530
- if (!isNaN(parsed)) obj["limit"] = parsed;
531
- }
532
- if (methodName !== "search_entries" && methodName !== "searchEntries" && methodName !== "team_search" && methodName !== "teamSearch") {
533
- if (obj["mode"] !== void 0) {
534
- return { error: {
535
- success: false,
536
- error: `${methodName} does not support the 'mode' parameter.`,
537
- code: "VALIDATION_ERROR",
538
- category: "validation",
539
- suggestion: "Remove the mode parameter or use search_entries instead.",
540
- recoverable: true
541
- } };
542
- }
543
- }
544
- }
545
- if ((methodName === "search_entries" || methodName === "searchEntries" || methodName === "team_search" || methodName === "teamSearch" || methodName === "search_by_date_range" || methodName === "searchByDateRange" || methodName === "team_search_by_date_range" || methodName === "teamSearchByDateRange" || methodName === "cross_team_search" || methodName === "crossTeamSearch") && args.length === 1 && isRecord(args[0])) {
546
- const obj = { ...args[0] };
547
- args[0] = obj;
548
- if ("exact_match" in obj) {
549
- const isFuzzy = obj["exact_match"] === false;
550
- obj["fuzzy_match"] = isFuzzy;
551
- if (methodName !== "cross_team_search" && methodName !== "crossTeamSearch") {
552
- obj["auto_correct"] = isFuzzy;
553
- }
554
- delete obj["exact_match"];
555
- } else if (obj["fuzzy_match"] === true && !("auto_correct" in obj)) {
556
- if (methodName !== "cross_team_search" && methodName !== "crossTeamSearch") {
557
- obj["auto_correct"] = true;
558
- }
559
- }
560
- if (typeof obj["start_date"] === "string" && (obj["end_date"] === void 0 || obj["end_date"] === null || obj["end_date"] === "")) {
561
- obj["end_date"] = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
562
- }
563
- if ((methodName === "team_search" || methodName === "teamSearch") && obj["project_number"] == null) {
564
- const tags = obj["tags"];
565
- const entryType = obj["entry_type"];
566
- const isFlagSearch = Boolean(tags && tags.length > 0 && tags.every((t) => typeof t === "string" && t.startsWith("flag:"))) || entryType === "flag";
567
- if (!isFlagSearch) {
568
- return { error: {
569
- success: false,
570
- error: 'Cross-project team searches are only permitted for flags. Provide a project_number or filter by entry_type="flag" or flag:* tags.',
571
- code: "VALIDATION_ERROR",
572
- category: "validation",
573
- suggestion: 'Provide a project_number, or use tags starting with "flag:" or entry_type="flag"',
574
- recoverable: true
575
- } };
576
- }
577
- }
578
- if ((methodName === "team_search_by_date_range" || methodName === "teamSearchByDateRange") && obj["project_number"] == null) {
579
- const tags = obj["tags"];
580
- const entryType = obj["entry_type"];
581
- const isFlagSearch = Boolean(tags && tags.length > 0 && tags.every((t) => typeof t === "string" && t.startsWith("flag:"))) || entryType === "flag";
582
- if (!isFlagSearch) {
583
- return { error: {
584
- success: false,
585
- error: 'Cross-project team date range searches are only permitted for flags. Provide a project_number or filter by entry_type="flag" or flag:* tags.',
586
- code: "VALIDATION_ERROR",
587
- category: "validation",
588
- suggestion: 'Provide a project_number, or use tags starting with "flag:" or entry_type="flag"',
589
- recoverable: true
590
- } };
591
- }
592
- }
593
- }
594
- const ioMethods = ["export_entries", "exportEntries", "team_export_entries", "teamExportEntries", "export_markdown", "exportMarkdown", "team_export_markdown", "teamExportMarkdown", "import_markdown", "importMarkdown", "team_import_markdown", "teamImportMarkdown", "import_external", "importExternal", "team_import_external", "teamImportExternal"];
595
- if (ioMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
596
- const obj = { ...args[0] };
597
- args[0] = obj;
598
- if (obj["keep"] !== void 0 && obj["limit"] === void 0) {
599
- obj["limit"] = obj["keep"];
600
- delete obj["keep"];
601
- }
602
- if (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["text"] !== void 0 || obj["search"] !== void 0 || obj["message"] !== void 0 || obj["description"] !== void 0) {
603
- return { error: {
604
- success: false,
605
- error: `${methodName} does not support text search or content parameters. It only exports/imports data.`,
606
- code: "VALIDATION_ERROR",
607
- category: "validation",
608
- suggestion: "To search for specific text, use search_entries (or team_search). Otherwise, remove the search/content parameters.",
609
- recoverable: true
610
- } };
611
- }
612
- if (obj["mode"] !== void 0) {
613
- return { error: {
614
- success: false,
615
- error: `${methodName} does not support the 'mode' parameter.`,
616
- code: "VALIDATION_ERROR",
617
- category: "validation",
618
- suggestion: "Remove the mode parameter.",
619
- recoverable: true
620
- } };
621
- }
622
- if (methodName === "export_entries" || methodName === "exportEntries" || methodName === "team_export_entries" || methodName === "teamExportEntries") {
623
- if (obj["path"] !== void 0 || obj["output_dir"] !== void 0 || obj["file"] !== void 0) {
624
- return { error: {
625
- success: false,
626
- error: `export_entries returns the exported data directly and does not write to disk.`,
627
- code: "VALIDATION_ERROR",
628
- category: "validation",
629
- suggestion: "Use export_markdown if you want to save files to a directory, or remove path/output_dir.",
630
- recoverable: true
631
- } };
632
- }
633
- }
634
- for (const key of ["path", "file", "filepath", "dir", "folder", "target", "source"]) {
635
- if (obj[key] !== void 0) {
636
- let didMap = false;
637
- if (methodName.includes("export_markdown") || methodName.includes("exportMarkdown") || methodName.includes("teamExportMarkdown") || methodName.includes("team_export_markdown")) {
638
- if (obj["output_dir"] === void 0) obj["output_dir"] = obj[key];
639
- didMap = true;
640
- } else if (methodName.toLowerCase().includes("import")) {
641
- if (key === "source" && (methodName.includes("import_external") || methodName.includes("importExternal") || methodName.includes("teamImportExternal") || methodName.includes("team_import_external"))) ; else {
642
- if (obj["source_dir"] === void 0) obj["source_dir"] = obj[key];
643
- didMap = true;
644
- }
645
- }
646
- if (didMap) {
647
- if (key === "path") delete obj["path"];
648
- else if (key === "file") delete obj["file"];
649
- else if (key === "filepath") delete obj["filepath"];
650
- else if (key === "dir") delete obj["dir"];
651
- else if (key === "folder") delete obj["folder"];
652
- else if (key === "target") delete obj["target"];
653
- else if (key === "source") delete obj["source"];
654
- }
655
- }
656
- }
657
- if (methodName.includes("import_external") || methodName.includes("importExternal") || methodName.includes("teamImportExternal") || methodName.includes("team_import_external")) {
658
- if (obj["url"] !== void 0 || obj["link"] !== void 0) {
659
- return { error: {
660
- success: false,
661
- error: `import_external does not download from URLs. It imports from a local directory (source_dir).`,
662
- code: "VALIDATION_ERROR",
663
- category: "validation",
664
- suggestion: "Provide a local directory path in source_dir.",
665
- recoverable: true
666
- } };
667
- }
668
- if (obj["format"] !== void 0 && obj["source_format"] === void 0) {
669
- obj["source_format"] = obj["format"];
670
- delete obj["format"];
671
- }
672
- if (obj["source"] !== void 0 && obj["source_format"] === void 0) {
673
- obj["source_format"] = obj["source"];
674
- delete obj["source"];
675
- }
676
- }
677
- }
678
- if ((methodName === "team_get_vector_index_stats" || methodName === "teamGetVectorIndexStats" || methodName === "get_vector_index_stats" || methodName === "getVectorIndexStats") && args.length === 1 && isRecord(args[0])) {
679
- const obj = { ...args[0] };
680
- args[0] = obj;
681
- if (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["search"] !== void 0 || obj["text"] !== void 0 || obj["message"] !== void 0 || obj["description"] !== void 0 || obj["path"] !== void 0) {
682
- return { error: {
683
- success: false,
684
- error: `${methodName} does not support search queries. It returns overall index statistics.`,
685
- code: "VALIDATION_ERROR",
686
- category: "validation",
687
- suggestion: "Remove the search query parameter.",
688
- recoverable: true
689
- } };
690
- }
691
- }
692
- const parameterlessMethods = ["rebuild_vector_index", "rebuildVectorIndex", "team_rebuild_vector_index", "teamRebuildVectorIndex"];
693
- if (parameterlessMethods.includes(methodName) && args.length === 1 && (typeof args[0] === "boolean" || typeof args[0] === "string" || typeof args[0] === "number")) {
694
- args[0] = {};
695
- }
696
- const listDeletedMethods = ["list_deleted_entries", "listDeletedEntries", "team_list_deleted_entries", "teamListDeletedEntries"];
697
- if (listDeletedMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
698
- const obj = { ...args[0] };
699
- args[0] = obj;
700
- if (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["search"] !== void 0 || obj["text"] !== void 0 || obj["message"] !== void 0 || obj["description"] !== void 0 || obj["path"] !== void 0 || obj["mode"] !== void 0) {
701
- return { error: {
702
- success: false,
703
- error: `${methodName} does not support search queries, path, or mode. It returns all deleted entries.`,
704
- code: "VALIDATION_ERROR",
705
- category: "validation",
706
- suggestion: "Remove these parameters.",
707
- recoverable: true
708
- } };
709
- }
710
- if (obj["keep"] !== void 0 && obj["limit"] === void 0) {
711
- obj["limit"] = obj["keep"];
712
- delete obj["keep"];
713
- }
714
- if ((methodName === "list_deleted_entries" || methodName === "listDeletedEntries") && obj["project_number"] !== void 0) {
715
- delete obj["project_number"];
716
- }
717
- if (obj["project_id"] !== void 0) {
718
- delete obj["project_id"];
719
- }
720
- }
721
- const analyticsMethods = ["get_statistics", "getStatistics", "get_cross_project_insights", "getCrossProjectInsights", "team_get_statistics", "teamGetStatistics", "team_get_cross_project_insights", "teamGetCrossProjectInsights", "get_collaboration_matrix", "getCollaborationMatrix", "team_get_collaboration_matrix", "teamGetCollaborationMatrix"];
722
- if (analyticsMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
723
- const obj = { ...args[0] };
724
- args[0] = obj;
725
- if (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["search"] !== void 0 || obj["text"] !== void 0 || obj["message"] !== void 0 || obj["description"] !== void 0 || obj["path"] !== void 0 || obj["keep"] !== void 0 || obj["mode"] !== void 0) {
726
- return { error: {
727
- success: false,
728
- error: `${methodName} does not support search queries, content parameters, or modes. It returns analytical data.`,
729
- code: "VALIDATION_ERROR",
730
- category: "validation",
731
- suggestion: "Remove these parameters. Use search_entries or team_search if you want to find specific content.",
732
- recoverable: true
733
- } };
734
- }
735
- if (methodName.includes("get_statistics") || methodName.includes("getStatistics")) {
736
- const timeVal = obj["time"] ?? obj["timeframe"] ?? obj["period"];
737
- if (timeVal !== void 0) {
738
- if (obj["group_by"] === void 0 && typeof timeVal === "string") {
739
- const validGroupBy = ["day", "week", "month"].includes(timeVal.toLowerCase()) ? timeVal.toLowerCase() : "month";
740
- obj["group_by"] = validGroupBy;
741
- }
742
- delete obj["time"];
743
- delete obj["timeframe"];
744
- delete obj["period"];
745
- }
746
- }
747
- if (methodName.includes("get_cross_project_insights") || methodName.includes("getCrossProjectInsights")) {
748
- if (obj["limit"] !== void 0) {
749
- return { error: {
750
- success: false,
751
- error: `get_cross_project_insights does not accept a limit parameter. It analyzes all projects.`,
752
- code: "VALIDATION_ERROR",
753
- category: "validation",
754
- suggestion: "Remove the limit parameter.",
755
- recoverable: true
756
- } };
757
- }
758
- }
759
- }
760
- const githubMethods = [
761
- "get_github_issues",
762
- "getGithubIssues",
763
- "get_github_prs",
764
- "getGithubPrs",
765
- "get_github_issue",
766
- "getGithubIssue",
767
- "get_github_pr",
768
- "getGithubPr",
769
- "get_github_context",
770
- "getGithubContext",
771
- "get_kanban_board",
772
- "getKanbanBoard",
773
- "move_kanban_item",
774
- "moveKanbanItem",
775
- "add_kanban_item",
776
- "addKanbanItem",
777
- "delete_kanban_item",
778
- "deleteKanbanItem",
779
- "create_github_issue_with_entry",
780
- "createGithubIssueWithEntry",
781
- "close_github_issue_with_entry",
782
- "closeGithubIssueWithEntry",
783
- "get_github_milestones",
784
- "getGithubMilestones",
785
- "get_github_milestone",
786
- "getGithubMilestone",
787
- "create_github_milestone",
788
- "createGithubMilestone",
789
- "update_github_milestone",
790
- "updateGithubMilestone",
791
- "delete_github_milestone",
792
- "deleteGithubMilestone",
793
- "get_repo_insights",
794
- "getRepoInsights",
795
- "get_copilot_reviews",
796
- "getCopilotReviews"
797
- ];
798
- if (githubMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
799
- const obj = { ...args[0] };
800
- args[0] = obj;
801
- for (const key of ["text", "message", "description"]) {
802
- if (obj[key] !== void 0) {
803
- if (methodName.includes("create_github_issue") || methodName.includes("createGithubIssue")) {
804
- if (obj["body"] === void 0) {
805
- obj["body"] = obj[key];
806
- if (key === "text") delete obj["text"];
807
- else if (key === "message") delete obj["message"];
808
- else if (key === "description") delete obj["description"];
809
- }
810
- } else if (methodName.includes("create_github_milestone") || methodName.includes("createGithubMilestone") || methodName.includes("update_github_milestone") || methodName.includes("updateGithubMilestone")) {
811
- if (obj["title"] === void 0 && (key === "text" || key === "message" || key === "description")) {
812
- obj["title"] = obj[key];
813
- if (key === "text") delete obj["text"];
814
- else if (key === "message") delete obj["message"];
815
- else if (key === "description") delete obj["description"];
816
- }
817
- } else if (methodName.includes("close_github_issue") || methodName.includes("closeGithubIssue")) {
818
- if (obj["comment"] === void 0 && key !== "description") {
819
- obj["comment"] = obj[key];
820
- if (key === "text") delete obj["text"];
821
- else if (key === "message") delete obj["message"];
822
- } else if (obj["resolution_notes"] === void 0 && key === "description") {
823
- obj["resolution_notes"] = obj[key];
824
- delete obj["description"];
825
- }
826
- }
827
- }
828
- }
829
- const hasStateParam = methodName.includes("get_github_issues") || methodName.includes("getGithubIssues") || methodName.includes("get_github_prs") || methodName.includes("getGithubPrs") || methodName.includes("get_github_milestones") || methodName.includes("getGithubMilestones");
830
- if (hasStateParam && obj["keep"] !== void 0 && obj["state"] === void 0) {
831
- if (obj["keep"] === true) {
832
- obj["state"] = "open";
833
- } else if (obj["keep"] === false) {
834
- obj["state"] = "closed";
835
- } else if (typeof obj["keep"] === "string") {
836
- obj["state"] = obj["keep"];
837
- }
838
- delete obj["keep"];
839
- }
840
- if (methodName.includes("get_kanban_board") || methodName.includes("getKanbanBoard")) {
841
- if (obj["keep"] !== void 0 && obj["project_number"] === void 0) {
842
- obj["project_number"] = obj["keep"];
843
- delete obj["keep"];
844
- }
845
- if (obj["path"] !== void 0 && obj["project_number"] === void 0) {
846
- obj["project_number"] = obj["path"];
847
- delete obj["path"];
848
- }
849
- }
850
- if (methodName.includes("move_kanban_item") || methodName.includes("moveKanbanItem")) {
851
- if (obj["keep"] !== void 0 && obj["item_id"] === void 0) {
852
- obj["item_id"] = obj["keep"];
853
- delete obj["keep"];
854
- }
855
- if (obj["path"] !== void 0 && obj["target_status"] === void 0) {
856
- obj["target_status"] = obj["path"];
857
- delete obj["path"];
858
- }
859
- }
860
- if (methodName.includes("add_kanban_item") || methodName.includes("addKanbanItem")) {
861
- if (obj["keep"] !== void 0 && obj["issue_number"] === void 0) {
862
- obj["issue_number"] = obj["keep"];
863
- delete obj["keep"];
864
- }
865
- }
866
- if (methodName.includes("delete_kanban_item") || methodName.includes("deleteKanbanItem")) {
867
- if (obj["keep"] !== void 0 && obj["item_id"] === void 0) {
868
- obj["item_id"] = obj["keep"];
869
- delete obj["keep"];
870
- }
871
- }
872
- if (methodName.includes("get_github_milestone") || methodName.includes("getGithubMilestone") || methodName.includes("update_github_milestone") || methodName.includes("updateGithubMilestone") || methodName.includes("delete_github_milestone") || methodName.includes("deleteGithubMilestone")) {
873
- if (obj["keep"] !== void 0 && obj["milestone_number"] === void 0) {
874
- obj["milestone_number"] = obj["keep"];
875
- delete obj["keep"];
876
- }
877
- }
878
- if (obj["mode"] !== void 0 && obj["summary_only"] === void 0) {
879
- obj["summary_only"] = obj["mode"] === "summary";
880
- delete obj["mode"];
881
- }
882
- if ((methodName.includes("get_github_issues") || methodName.includes("getGithubIssues") || methodName.includes("get_github_prs") || methodName.includes("getGithubPrs") || methodName.includes("get_github_milestones") || methodName.includes("getGithubMilestones")) && (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["search"] !== void 0)) {
883
- return { error: {
884
- success: false,
885
- error: `${methodName} does not support search queries (q/query/search). It only supports listing by state (open/closed).`,
886
- code: "VALIDATION_ERROR",
887
- category: "validation",
888
- suggestion: "Remove the query parameter to list items, or use GitHub directly for complex searches.",
889
- recoverable: true
890
- } };
891
- }
892
- if ((methodName.includes("get_github_context") || methodName.includes("getGithubContext")) && obj["path"] !== void 0) {
893
- return { error: {
894
- success: false,
895
- error: `get_github_context does not take a 'path' parameter. It returns repository-wide context.`,
896
- code: "VALIDATION_ERROR",
897
- category: "validation",
898
- suggestion: "Remove the path parameter.",
899
- recoverable: true
900
- } };
901
- }
902
- }
903
- const backupMethods = ["backup_journal", "backupJournal", "team_backup", "teamBackup", "list_backups", "listBackups", "team_list_backups", "teamListBackups", "restore_backup", "restoreBackup", "cleanup_backups", "cleanupBackups"];
904
- if (backupMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
905
- const obj = { ...args[0] };
906
- args[0] = obj;
907
- if (methodName.includes("backup_journal") || methodName.includes("backupJournal") || methodName.includes("team_backup") || methodName.includes("teamBackup")) {
908
- if (obj["name"] === void 0) {
909
- if (obj["description"] !== void 0) obj["name"] = obj["description"];
910
- else if (obj["message"] !== void 0) obj["name"] = obj["message"];
911
- else if (obj["text"] !== void 0) obj["name"] = obj["text"];
912
- else if (obj["path"] !== void 0) obj["name"] = obj["path"];
913
- else if (obj["q"] !== void 0) obj["name"] = obj["q"];
914
- else if (obj["keep"] !== void 0) obj["name"] = obj["keep"];
915
- else if (obj["mode"] !== void 0) obj["name"] = obj["mode"];
916
- delete obj["description"];
917
- delete obj["message"];
918
- delete obj["text"];
919
- delete obj["path"];
920
- delete obj["q"];
921
- delete obj["keep"];
922
- delete obj["mode"];
923
- }
924
- }
925
- if (methodName.includes("list_backups") || methodName.includes("listBackups") || methodName.includes("team_list_backups") || methodName.includes("teamListBackups")) {
926
- if (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["search"] !== void 0 || obj["text"] !== void 0 || obj["message"] !== void 0 || obj["description"] !== void 0 || obj["path"] !== void 0 || obj["keep"] !== void 0 || obj["mode"] !== void 0) {
927
- return { error: {
928
- success: false,
929
- error: `list_backups does not support search queries or other parameters. It lists all available backups.`,
930
- code: "VALIDATION_ERROR",
931
- category: "validation",
932
- suggestion: "Remove these parameters.",
933
- recoverable: true
934
- } };
935
- }
936
- if (obj["limit"] !== void 0) {
937
- return { error: {
938
- success: false,
939
- error: `list_backups does not support a limit parameter.`,
940
- code: "VALIDATION_ERROR",
941
- category: "validation",
942
- suggestion: "Remove the limit parameter.",
943
- recoverable: true
944
- } };
945
- }
946
- }
947
- if (methodName.includes("restore_backup") || methodName.includes("restoreBackup")) {
948
- if (obj["filename"] === void 0) {
949
- if (obj["path"] !== void 0) obj["filename"] = obj["path"];
950
- else if (obj["file"] !== void 0) obj["filename"] = obj["file"];
951
- else if (obj["text"] !== void 0) obj["filename"] = obj["text"];
952
- else if (obj["message"] !== void 0) obj["filename"] = obj["message"];
953
- else if (obj["description"] !== void 0) obj["filename"] = obj["description"];
954
- else if (obj["q"] !== void 0) obj["filename"] = obj["q"];
955
- else if (obj["keep"] !== void 0) obj["filename"] = obj["keep"];
956
- else if (obj["mode"] !== void 0) obj["filename"] = obj["mode"];
957
- delete obj["path"];
958
- delete obj["file"];
959
- delete obj["text"];
960
- delete obj["message"];
961
- delete obj["description"];
962
- delete obj["q"];
963
- delete obj["keep"];
964
- delete obj["mode"];
965
- }
966
- }
967
- if (methodName.includes("cleanup_backups") || methodName.includes("cleanupBackups")) {
968
- if (obj["keep_count"] === void 0) {
969
- if (obj["keep"] !== void 0) obj["keep_count"] = obj["keep"];
970
- else if (obj["limit"] !== void 0) obj["keep_count"] = obj["limit"];
971
- else if (obj["q"] !== void 0) obj["keep_count"] = obj["q"];
972
- else if (obj["mode"] !== void 0) obj["keep_count"] = obj["mode"];
973
- else if (obj["text"] !== void 0) obj["keep_count"] = obj["text"];
974
- else if (obj["message"] !== void 0) obj["keep_count"] = obj["message"];
975
- else if (obj["description"] !== void 0) obj["keep_count"] = obj["description"];
976
- else if (obj["path"] !== void 0) obj["keep_count"] = obj["path"];
977
- delete obj["keep"];
978
- delete obj["limit"];
979
- delete obj["q"];
980
- delete obj["mode"];
981
- delete obj["text"];
982
- delete obj["message"];
983
- delete obj["description"];
984
- delete obj["path"];
985
- }
986
- }
987
- }
988
- const singleIdMethods = ["delete_entry", "deleteEntry", "restore_entry", "restoreEntry", "get_entry_by_id", "getEntryById", "team_get_entry_by_id", "teamGetEntryById", "get_entry_history", "getEntryHistory", "add_to_vector_index", "addToVectorIndex", "team_add_to_vector_index", "teamAddToVectorIndex", "add_to_index", "addToIndex", "update_entry", "updateEntry", "team_update_entry", "teamUpdateEntry", "edit", "update", "team_delete_entry", "teamDeleteEntry", "delete", "team_restore_entry", "teamRestoreEntry", "restore", "team_restore", "teamRestore"];
989
- if (singleIdMethods.includes(methodName)) {
990
- if (args.length === 0) {
991
- return { error: {
992
- success: false,
993
- error: `${methodName} requires an 'entry_id' parameter.`,
994
- code: "VALIDATION_ERROR",
995
- category: "validation",
996
- suggestion: `Provide { entry_id: number } as the argument`,
997
- recoverable: true
998
- } };
999
- } else if (args.length === 1) {
1000
- if (Array.isArray(args[0])) {
1001
- return { error: {
1002
- success: false,
1003
- error: `${methodName} only accepts a single entry. To process multiple entries, use the batch equivalent (e.g., batch_delete_entries).`,
1004
- code: "VALIDATION_ERROR",
1005
- category: "validation",
1006
- suggestion: `Use a batch method or pass a single object like { entry_id: number }`,
1007
- recoverable: true
1008
- } };
1009
- } else if (isRecord(args[0])) {
1010
- const obj = { ...args[0] };
1011
- args[0] = obj;
1012
- if (Array.isArray(obj["ids"]) || Array.isArray(obj["entry_ids"]) || Array.isArray(obj["entry_id"]) || Array.isArray(obj["id"])) {
1013
- return { error: {
1014
- success: false,
1015
- error: `${methodName} only accepts a single entry_id. To process multiple entries, use the batch equivalent.`,
1016
- code: "VALIDATION_ERROR",
1017
- category: "validation",
1018
- suggestion: `Use a batch method (e.g. batch_delete_entries) or pass { entry_id: number }`,
1019
- recoverable: true
1020
- } };
1021
- }
1022
- if (obj["entry_id"] === void 0 && obj["id"] === void 0 && obj["entryId"] === void 0 && obj["path"] === void 0 && obj["keep"] === void 0) {
1023
- return { error: {
1024
- success: false,
1025
- error: `${methodName} requires an 'entry_id' parameter.`,
1026
- code: "VALIDATION_ERROR",
1027
- category: "validation",
1028
- suggestion: `Provide { entry_id: number, ... } as the argument`,
1029
- recoverable: true
1030
- } };
1031
- }
1032
- const idVal = obj["entry_id"] !== void 0 ? obj["entry_id"] : obj["entryId"] !== void 0 ? obj["entryId"] : obj["id"] !== void 0 ? obj["id"] : obj["path"] !== void 0 ? obj["path"] : obj["keep"];
1033
- if (obj["path"] !== void 0 && obj["entry_id"] === void 0) {
1034
- obj["entry_id"] = obj["path"];
1035
- delete obj["path"];
1036
- }
1037
- if (obj["keep"] !== void 0 && obj["entry_id"] === void 0) {
1038
- obj["entry_id"] = obj["keep"];
1039
- delete obj["keep"];
1040
- }
1041
- if (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["mode"] !== void 0 || obj["search"] !== void 0) {
1042
- if (methodName !== "update_entry" && methodName !== "updateEntry" && methodName !== "team_update_entry" && methodName !== "teamUpdateEntry") {
1043
- return { error: {
1044
- success: false,
1045
- error: `${methodName} does not support q, query, search, or mode parameters. It operates on a single entry by entry_id.`,
1046
- code: "VALIDATION_ERROR",
1047
- category: "validation",
1048
- suggestion: "Remove these parameters. Provide only the entry_id.",
1049
- recoverable: true
1050
- } };
1051
- }
1052
- }
1053
- if (typeof idVal === "string" && isNaN(parseInt(idVal, 10))) {
1054
- return { error: {
1055
- success: false,
1056
- error: `${methodName} requires a numeric entry_id, but received a non-numeric string ('${idVal}'). Journal entries use auto-incrementing integer IDs.`,
1057
- code: "VALIDATION_ERROR",
1058
- category: "validation",
1059
- suggestion: "Provide a numeric ID.",
1060
- recoverable: true
1061
- } };
1062
- }
1063
- } else if (typeof args[0] === "number" || typeof args[0] === "string") {
1064
- const asNum = typeof args[0] === "string" ? parseInt(args[0], 10) : args[0];
1065
- if (!isNaN(asNum)) {
1066
- args[0] = { entry_id: asNum };
1067
- } else {
1068
- return { error: {
1069
- success: false,
1070
- error: `${methodName} requires a numeric entry_id, but received a non-numeric string ('${args[0]}'). Journal entries use auto-incrementing integer IDs.`,
1071
- code: "VALIDATION_ERROR",
1072
- category: "validation",
1073
- suggestion: "Provide a numeric ID.",
1074
- recoverable: true
1075
- } };
1076
- }
1077
- }
1078
- }
1079
- }
1080
- if ((methodName === "update_entry" || methodName === "updateEntry") && args.length === 2 && (typeof args[0] === "number" || typeof args[0] === "string") && typeof args[1] === "object" && args[1] !== null) {
1081
- const asNum = typeof args[0] === "string" ? parseInt(args[0], 10) : args[0];
1082
- if (!isNaN(asNum)) {
1083
- args = [{ entry_id: asNum, ...args[1] }];
1084
- }
1085
- }
1086
- if ((methodName === "batch_create_entries" || methodName === "batchCreateEntries" || methodName === "team_batch_create_entries" || methodName === "teamBatchCreateEntries") && args.length === 1) {
1087
- if (Array.isArray(args[0])) {
1088
- args[0] = { entries: args[0] };
1089
- } else if (isRecord(args[0]) && !("entries" in args[0])) {
1090
- return { error: {
1091
- success: false,
1092
- error: `${methodName} requires an 'entries' array.`,
1093
- code: "VALIDATION_ERROR",
1094
- category: "validation",
1095
- suggestion: `Provide { entries: [...] } as the argument`,
1096
- recoverable: true
1097
- } };
1098
- }
1099
- }
1100
- if ((methodName === "batch_update_entries" || methodName === "batchUpdateEntries" || methodName === "team_batch_update_entries" || methodName === "teamBatchUpdateEntries") && args.length === 1) {
1101
- if (Array.isArray(args[0])) {
1102
- args[0] = { updates: args[0] };
1103
- } else if (isRecord(args[0]) && !("updates" in args[0])) {
1104
- return { error: {
1105
- success: false,
1106
- error: `${methodName} requires an 'updates' array.`,
1107
- code: "VALIDATION_ERROR",
1108
- category: "validation",
1109
- suggestion: `Provide { updates: [...] } as the argument`,
1110
- recoverable: true
1111
- } };
1112
- }
1113
- }
1114
- if (methodName === "batch_delete_entries" || methodName === "batchDeleteEntries" || methodName === "team_batch_delete_entries" || methodName === "teamBatchDeleteEntries") {
1115
- if (args.length === 1 && typeof args[0] === "string") {
1116
- const ids = args[0].split(",").map((s) => parseInt(s.trim(), 10)).filter((n) => !isNaN(n));
1117
- args[0] = { entry_ids: ids };
1118
- } else if (args.length === 1 && Array.isArray(args[0])) {
1119
- const hasStrings = args[0].some((id) => typeof id === "string");
1120
- if (hasStrings) {
1121
- return { error: {
1122
- success: false,
1123
- error: `batch_delete_entries expects an array of numeric IDs, but received an array containing strings.`,
1124
- code: "VALIDATION_ERROR",
1125
- category: "validation",
1126
- suggestion: "Ensure all IDs in the array are numbers. Use parseInt() if necessary.",
1127
- recoverable: true
1128
- } };
1129
- }
1130
- args[0] = { entry_ids: args[0] };
1131
- } else if (args.length > 1 && args.every((a) => typeof a === "number")) {
1132
- args = [{ entry_ids: args }];
1133
- } else if (args.length === 1 && isRecord(args[0]) && !Array.isArray(args[0]) && !("entry_ids" in args[0])) {
1134
- return { error: {
1135
- success: false,
1136
- error: `${methodName} requires an 'entry_ids' array.`,
1137
- code: "VALIDATION_ERROR",
1138
- category: "validation",
1139
- suggestion: `Provide { entry_ids: [...] } as the argument`,
1140
- recoverable: true
1141
- } };
1142
- }
1143
- }
1144
- if (methodName === "link_entries" || methodName === "linkEntries" || methodName === "team_link_entries" || methodName === "teamLinkEntries") {
1145
- if (args.length === 1 && isRecord(args[0])) {
1146
- const obj = { ...args[0] };
1147
- args[0] = obj;
1148
- if (obj["source"] !== void 0 && obj["from_entry_id"] === void 0) {
1149
- obj["from_entry_id"] = obj["source"];
1150
- delete obj["source"];
1151
- }
1152
- if (obj["from"] !== void 0 && obj["from_entry_id"] === void 0) {
1153
- obj["from_entry_id"] = obj["from"];
1154
- delete obj["from"];
1155
- }
1156
- if (obj["source_id"] !== void 0 && obj["from_entry_id"] === void 0) {
1157
- obj["from_entry_id"] = obj["source_id"];
1158
- delete obj["source_id"];
1159
- }
1160
- if (obj["from_id"] !== void 0 && obj["from_entry_id"] === void 0) {
1161
- obj["from_entry_id"] = obj["from_id"];
1162
- delete obj["from_id"];
1163
- }
1164
- if (obj["target"] !== void 0 && obj["to_entry_id"] === void 0) {
1165
- obj["to_entry_id"] = obj["target"];
1166
- delete obj["target"];
1167
- }
1168
- if (obj["to"] !== void 0 && obj["to_entry_id"] === void 0) {
1169
- obj["to_entry_id"] = obj["to"];
1170
- delete obj["to"];
1171
- }
1172
- if (obj["target_id"] !== void 0 && obj["to_entry_id"] === void 0) {
1173
- obj["to_entry_id"] = obj["target_id"];
1174
- delete obj["target_id"];
1175
- }
1176
- if (obj["to_id"] !== void 0 && obj["to_entry_id"] === void 0) {
1177
- obj["to_entry_id"] = obj["to_id"];
1178
- delete obj["to_id"];
1179
- }
1180
- if (obj["dest"] !== void 0 && obj["to_entry_id"] === void 0) {
1181
- obj["to_entry_id"] = obj["dest"];
1182
- delete obj["dest"];
1183
- }
1184
- if (obj["type"] !== void 0 && obj["relationship_type"] === void 0) {
1185
- obj["relationship_type"] = obj["type"];
1186
- delete obj["type"];
1187
- }
1188
- if (obj["rel"] !== void 0 && obj["relationship_type"] === void 0) {
1189
- obj["relationship_type"] = obj["rel"];
1190
- delete obj["rel"];
1191
- }
1192
- if (obj["notes"] !== void 0 && obj["description"] === void 0) {
1193
- obj["description"] = obj["notes"];
1194
- delete obj["notes"];
1195
- }
1196
- if (obj["message"] !== void 0 && obj["description"] === void 0) {
1197
- obj["description"] = obj["message"];
1198
- delete obj["message"];
1199
- }
1200
- if (obj["text"] !== void 0 && obj["description"] === void 0) {
1201
- obj["description"] = obj["text"];
1202
- delete obj["text"];
1203
- }
1204
- }
1205
- }
1206
- if (methodName === "update_configuration" || methodName === "updateConfiguration" || methodName === "config" || methodName === "configure") {
1207
- if (args.length === 1 && typeof args[0] === "string") ; else if (args.length === 1 && isRecord(args[0])) {
1208
- const obj = { ...args[0] };
1209
- if (typeof obj["config"] === "object" && obj["config"] !== null) {
1210
- args[0] = { ...obj, ...obj["config"] };
1211
- delete args[0]["config"];
1212
- }
1213
- if (obj["maxTokens"] !== void 0 || obj["max_tokens"] !== void 0 || obj["temperature"] !== void 0 || obj["model"] !== void 0 || obj["top_p"] !== void 0) {
1214
- return { error: {
1215
- success: false,
1216
- error: `update_configuration is for configuring the memory-journal-mcp server. It does not configure the LLM context (like maxTokens or temperature).`,
1217
- code: "VALIDATION_ERROR",
1218
- category: "validation",
1219
- suggestion: "Remove LLM parameters. Server configuration does not accept LLM generation parameters.",
1220
- recoverable: true
1221
- } };
1222
- }
1223
- }
1224
- }
1225
- if (methodName === "update_entry" || methodName === "updateEntry" || methodName === "team_update_entry" || methodName === "teamUpdateEntry") {
1226
- if (args.length === 1 && isRecord(args[0])) {
1227
- const obj = { ...args[0] };
1228
- args[0] = obj;
1229
- if (obj["keep"] !== void 0 && obj["is_archived"] === void 0) {
1230
- obj["is_archived"] = !obj["keep"];
1231
- delete obj["keep"];
1232
- }
1233
- if (obj["text"] !== void 0 && obj["content"] === void 0) {
1234
- obj["content"] = obj["text"];
1235
- delete obj["text"];
1236
- }
1237
- if (obj["message"] !== void 0 && obj["content"] === void 0) {
1238
- obj["content"] = obj["message"];
1239
- delete obj["message"];
1240
- }
1241
- if (obj["description"] !== void 0 && obj["content"] === void 0) {
1242
- obj["content"] = obj["description"];
1243
- delete obj["description"];
1244
- }
1245
- if (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["path"] !== void 0 || obj["mode"] !== void 0 || obj["search"] !== void 0) {
1246
- return { error: {
1247
- success: false,
1248
- error: `${methodName} does not support q, query, search, path, or mode parameters.`,
1249
- code: "VALIDATION_ERROR",
1250
- category: "validation",
1251
- suggestion: "Remove these parameters. Use entry_id and content to update the entry.",
1252
- recoverable: true
1253
- } };
1254
- }
1255
- }
1256
- }
1257
- const deleteMethods = ["delete_entry", "deleteEntry", "team_delete_entry", "teamDeleteEntry"];
1258
- if (deleteMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
1259
- const obj = { ...args[0] };
1260
- args[0] = obj;
1261
- if (obj["version"] !== void 0 && obj["expected_version"] === void 0) {
1262
- obj["expected_version"] = obj["version"];
1263
- delete obj["version"];
1264
- }
1265
- if ((methodName === "delete_entry" || methodName === "deleteEntry") && obj["project_number"] !== void 0) {
1266
- delete obj["project_number"];
1267
- }
1268
- }
1269
- const recentMethods = ["get_recent_entries", "getRecentEntries", "team_get_recent", "teamGetRecent"];
1270
- if (recentMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
1271
- const obj = { ...args[0] };
1272
- args[0] = obj;
1273
- if (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["search"] !== void 0) {
1274
- return { error: {
1275
- success: false,
1276
- error: `${methodName} does not support search queries. It only returns the most recent entries.`,
1277
- code: "VALIDATION_ERROR",
1278
- category: "validation",
1279
- suggestion: "To search for specific text, use team_search (or search_entries) instead.",
1280
- recoverable: true
1281
- } };
1282
- }
1283
- if (obj["keep"] !== void 0 && obj["limit"] === void 0) {
1284
- obj["limit"] = obj["keep"];
1285
- delete obj["keep"];
1286
- }
1287
- }
1288
- const listTagsMethods = ["list_tags", "listTags", "team_list_tags", "teamListTags"];
1289
- if (listTagsMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
1290
- const obj = { ...args[0] };
1291
- args[0] = obj;
1292
- if (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["search"] !== void 0 || obj["path"] !== void 0 || obj["mode"] !== void 0 || obj["keep"] !== void 0) {
1293
- return { error: {
1294
- success: false,
1295
- error: `${methodName} does not support search queries, path, mode, or keep. It returns all tags.`,
1296
- code: "VALIDATION_ERROR",
1297
- category: "validation",
1298
- suggestion: "Remove these parameters.",
1299
- recoverable: true
1300
- } };
1301
- }
1302
- }
1303
- const createMethods = [
1304
- "create_entry",
1305
- "createEntry",
1306
- "team_create_entry",
1307
- "teamCreateEntry",
1308
- "add_entry",
1309
- "addEntry",
1310
- "mj_add_entry",
1311
- "mjAddEntry",
1312
- "create_journal_entry",
1313
- "createJournalEntry",
1314
- "insert_entry",
1315
- "insertEntry"
1316
- ];
1317
- if (createMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
1318
- const obj = { ...args[0] };
1319
- args[0] = obj;
1320
- if (typeof obj["entry"] === "object" && obj["entry"] !== null && !Array.isArray(obj["entry"])) {
1321
- const nested = obj["entry"];
1322
- delete obj["entry"];
1323
- for (const [k, v] of Object.entries(nested)) {
1324
- if (obj[k] === void 0 && v !== void 0) {
1325
- obj[k] = v;
1326
- }
1327
- }
1328
- }
1329
- for (const aliasKey of ["entry", "text", "message", "description", "body", "instructions", "details", "notes", "summary", "markdown", "post", "journal_entry", "journalEntry", "entry_text", "entryText"]) {
1330
- if (obj[aliasKey] !== void 0) {
1331
- if (obj["content"] === void 0 && typeof obj[aliasKey] === "string") {
1332
- obj["content"] = obj[aliasKey];
1333
- }
1334
- Reflect.deleteProperty(obj, aliasKey);
1335
- }
1336
- }
1337
- if (obj["auto_context"] !== void 0) {
1338
- if (typeof obj["auto_context"] === "object" && obj["auto_context"] !== null) {
1339
- try {
1340
- obj["auto_context"] = JSON.stringify(obj["auto_context"]);
1341
- } catch {
1342
- return { error: {
1343
- success: false,
1344
- error: `${methodName}: auto_context could not be serialized to JSON. Ensure it is a plain object (e.g. { commits: ['<sha>'] }) or a valid JSON string.`,
1345
- code: "VALIDATION_ERROR",
1346
- category: "validation",
1347
- suggestion: "Pass auto_context as either a JSON string (e.g. JSON.stringify({ commits: [sha] })) or a plain serializable object.",
1348
- recoverable: true
1349
- } };
1350
- }
1351
- } else if (typeof obj["auto_context"] !== "string") {
1352
- return { error: {
1353
- success: false,
1354
- error: `${methodName}: auto_context must be a JSON string or plain object (received ${typeof obj["auto_context"]}).`,
1355
- code: "VALIDATION_ERROR",
1356
- category: "validation",
1357
- suggestion: 'Pass auto_context as a JSON string, e.g. JSON.stringify({ commits: ["<sha>"] }), or as a plain object like { commits: ["<sha>"] }.',
1358
- recoverable: true
1359
- } };
1360
- }
1361
- }
1362
- if (obj["q"] !== void 0 || obj["query"] !== void 0 || obj["path"] !== void 0 || obj["mode"] !== void 0 || obj["keep"] !== void 0 || obj["search"] !== void 0) {
1363
- return { error: {
1364
- success: false,
1365
- error: `${methodName} does not support q, query, search, path, mode, or keep parameters. It creates a new journal entry.`,
1366
- code: "VALIDATION_ERROR",
1367
- category: "validation",
1368
- suggestion: 'Remove these parameters. Ensure you are providing the "content" of the entry.',
1369
- recoverable: true
1370
- } };
1371
- }
1372
- }
1373
- if ((methodName === "test_simple" || methodName === "testSimple" || methodName === "test_error_handling" || methodName === "testErrorHandling") && args.length === 1 && isRecord(args[0])) {
1374
- const obj = { ...args[0] };
1375
- args[0] = obj;
1376
- if (obj["text"] !== void 0 && obj["message"] === void 0) {
1377
- obj["message"] = obj["text"];
1378
- delete obj["text"];
1379
- }
1380
- if (obj["description"] !== void 0 && obj["message"] === void 0) {
1381
- obj["message"] = obj["description"];
1382
- delete obj["description"];
1383
- }
1384
- if (obj["type"] !== void 0 && obj["error_type"] === void 0 && (methodName === "test_error_handling" || methodName === "testErrorHandling")) {
1385
- obj["error_type"] = obj["type"];
1386
- delete obj["type"];
1387
- }
1388
- }
1389
- if (methodName === "merge_tags" || methodName === "mergeTags" || methodName === "team_merge_tags" || methodName === "teamMergeTags") {
1390
- if (args.length === 1 && isRecord(args[0])) {
1391
- const obj = { ...args[0] };
1392
- args[0] = obj;
1393
- if (obj["source_tags"] !== void 0 && obj["source_tag"] === void 0) {
1394
- obj["source_tag"] = Array.isArray(obj["source_tags"]) ? obj["source_tags"][0] : obj["source_tags"];
1395
- delete obj["source_tags"];
1396
- }
1397
- if (obj["old_tag"] !== void 0 && obj["source_tag"] === void 0) {
1398
- obj["source_tag"] = obj["old_tag"];
1399
- delete obj["old_tag"];
1400
- }
1401
- if (obj["new_tag"] !== void 0 && obj["target_tag"] === void 0) {
1402
- obj["target_tag"] = obj["new_tag"];
1403
- delete obj["new_tag"];
1404
- }
1405
- if (obj["from"] !== void 0 && obj["source_tag"] === void 0) {
1406
- obj["source_tag"] = obj["from"];
1407
- delete obj["from"];
1408
- }
1409
- if (obj["to"] !== void 0 && obj["target_tag"] === void 0) {
1410
- obj["target_tag"] = obj["to"];
1411
- delete obj["to"];
1412
- }
1413
- if (typeof obj["source_tag"] === "string" && obj["source_tag"].includes(",")) {
1414
- return { error: {
1415
- success: false,
1416
- error: `merge_tags only accepts a single source_tag string, not a comma-separated list.`,
1417
- code: "VALIDATION_ERROR",
1418
- category: "validation",
1419
- suggestion: "Provide a single tag string for source_tag. To merge multiple tags, call this tool multiple times.",
1420
- recoverable: true
1421
- } };
1422
- }
1423
- }
1424
- }
1425
- if (methodName === "search_audit_log" || methodName === "searchAuditLog") {
1426
- if (args.length === 1 && isRecord(args[0])) {
1427
- const obj = { ...args[0] };
1428
- args[0] = obj;
1429
- if (obj["keep"] !== void 0 && obj["limit"] === void 0) {
1430
- obj["limit"] = obj["keep"];
1431
- delete obj["keep"];
1432
- }
1433
- if (typeof obj["limit"] === "string") {
1434
- const parsed = parseInt(obj["limit"], 10);
1435
- if (!isNaN(parsed)) obj["limit"] = parsed;
1436
- }
1437
- }
1438
- }
1439
- if (methodName === "rebuild_vector_index" || methodName === "rebuildVectorIndex" || methodName === "team_rebuild_vector_index" || methodName === "teamRebuildVectorIndex") {
1440
- if (args.length === 1 && (typeof args[0] === "boolean" || typeof args[0] === "string")) {
1441
- args[0] = {};
1442
- }
1443
- }
1444
- const memberMethods = ["team_add_member", "teamAddMember", "team_update_member_role", "teamUpdateMemberRole", "team_remove_member", "teamRemoveMember", "team_get_member", "teamGetMember"];
1445
- if (memberMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
1446
- const obj = { ...args[0] };
1447
- args[0] = obj;
1448
- for (const key of ["path", "target", "user", "name", "account", "username", "member"]) {
1449
- if (obj[key] !== void 0 && obj["author"] === void 0) {
1450
- obj["author"] = obj[key];
1451
- Reflect.deleteProperty(obj, key);
1452
- }
1453
- }
1454
- for (const key of ["keep", "mode", "type", "level", "permission"]) {
1455
- if (obj[key] !== void 0 && obj["role"] === void 0) {
1456
- obj["role"] = obj[key];
1457
- Reflect.deleteProperty(obj, key);
1458
- }
1459
- }
1460
- }
1461
- const aliasMethods = ["team_add_author_alias", "teamAddAuthorAlias", "team_remove_author_alias", "teamRemoveAuthorAlias", "team_list_author_aliases", "teamListAuthorAliases", "team_resolve_author", "teamResolveAuthor", "team_consolidate_authors", "teamConsolidateAuthors"];
1462
- if (aliasMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
1463
- const obj = { ...args[0] };
1464
- args[0] = obj;
1465
- for (const key of ["q", "query", "search"]) {
1466
- if (obj[key] !== void 0) {
1467
- if (obj["canonical_author"] === void 0 && obj["author"] === void 0 && obj["alias"] === void 0) {
1468
- obj["canonical_author"] = obj[key];
1469
- obj["author"] = obj[key];
1470
- obj["alias"] = obj[key];
1471
- }
1472
- Reflect.deleteProperty(obj, key);
1473
- }
1474
- }
1475
- for (const key of ["text", "message", "description", "name", "from", "source"]) {
1476
- if (obj[key] !== void 0 && obj["alias"] === void 0) {
1477
- obj["alias"] = obj[key];
1478
- Reflect.deleteProperty(obj, key);
1479
- }
1480
- }
1481
- for (const key of ["target", "to", "canonical", "dest"]) {
1482
- if (obj[key] !== void 0 && obj["canonical_author"] === void 0) {
1483
- obj["canonical_author"] = obj[key];
1484
- Reflect.deleteProperty(obj, key);
1485
- }
1486
- }
1487
- if (obj["author"] !== void 0 && obj["canonical_author"] === void 0 && obj["alias"] === void 0) {
1488
- obj["canonical_author"] = obj["author"];
1489
- }
1490
- }
1491
- if (methodName === "update_configuration" || methodName === "updateConfiguration") {
1492
- if (args.length === 1 && isRecord(args[0])) {
1493
- const obj = { ...args[0] };
1494
- args[0] = obj;
1495
- const hasContextParam = ["maxTokens", "max_tokens", "temperature", "top_p", "topP"].find((k) => k in obj);
1496
- if (hasContextParam) {
1497
- return {
1498
- error: {
1499
- success: false,
1500
- error: `Unrecognized key: "${hasContextParam}". update_configuration does not support changing LLM context parameters.`,
1501
- code: "VALIDATION_ERROR",
1502
- category: "validation",
1503
- suggestion: `Remove '${hasContextParam}' from the payload. Only tool_filter and briefing preferences are supported.`,
1504
- recoverable: false
1505
- }
1506
- };
1507
- }
1508
- }
1509
- }
1510
- const sessionSummaryMethods = ["create_entry", "createEntry", "team_create_entry", "teamCreateEntry", "update_entry", "updateEntry", "team_update_entry", "teamUpdateEntry"];
1511
- if (sessionSummaryMethods.includes(methodName) && args.length === 1 && isRecord(args[0])) {
1512
- const obj = { ...args[0] };
1513
- args[0] = obj;
1514
- const tags = obj["tags"];
1515
- const entryType = obj["entry_type"];
1516
- if (typeof obj["content"] === "string" && (tags?.includes("session-summary") || entryType === "retrospective")) {
1517
- let content = obj["content"];
1518
- content = content.replace(/^#+\s+(?:Accomplishments|Completed|Done|What I did|What we did)\s*$/gim, "## Accomplished");
1519
- content = content.replace(/^#+\s+(?:Blockers|Unfinished|Unfinished\/?Blocked|Blocked)\s*$/gim, "## Unfinished / Blocked");
1520
- content = content.replace(/^#+\s+(?:Next Session|Context|Next steps)\s*$/gim, "## Context for Next Session");
1521
- content = content.replace(/(?:^#+\s+Accomplished\s*\n-\s*(?:None\.?|)\s*){2,}/gim, "## Accomplished\n- None.\n");
1522
- content = content.replace(/(?:^#+\s+Unfinished \/ Blocked\s*\n-\s*(?:None\.?|)\s*){2,}/gim, "## Unfinished / Blocked\n- None.\n");
1523
- content = content.replace(/(?:^#+\s+Context for Next Session\s*\n-\s*(?:None\.?|)\s*){2,}/gim, "## Context for Next Session\n- None.\n");
1524
- content = content.replace(/(?:^#+\s+Commits\s*\n-\s*(?:None\.?|)\s*){2,}/gim, "## Commits\n- None.\n");
1525
- const deduplicate = (str, headerRegexStr) => {
1526
- let count = 0;
1527
- return str.replace(new RegExp(headerRegexStr, "gim"), (match) => {
1528
- count++;
1529
- return count === 1 ? match : "";
1530
- });
1531
- };
1532
- content = deduplicate(content, "^#+\\s+Accomplished");
1533
- content = deduplicate(content, "^#+\\s+Unfinished \\/ Blocked");
1534
- content = deduplicate(content, "^#+\\s+Context for Next Session");
1535
- content = deduplicate(content, "^#+\\s+Commits");
1536
- const hasAccomplished = /#+\s+Accomplished/i.test(content);
1537
- const hasUnfinished = /#+\s+Unfinished \/ Blocked/i.test(content);
1538
- const hasContext = /#+\s+Context for Next Session/i.test(content);
1539
- const hasCommits = /#+\s+Commits/i.test(content);
1540
- if (!hasAccomplished) content += "\n\n## Accomplished\n- \n";
1541
- if (!hasUnfinished) content += "\n\n## Unfinished / Blocked\n- None\n";
1542
- if (!hasContext) content += "\n\n## Context for Next Session\n- \n";
1543
- if (!hasCommits) content += "\n\n## Commits\n- None\n";
1544
- obj["content"] = content.trim();
1545
- }
1546
- }
1547
- return { args };
1548
- }
1549
-
1550
- export { applyArgInterceptions };