agentdb 1.6.0 → 2.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (734) hide show
  1. package/README.md +1098 -350
  2. package/dist/agentdb-advanced.js +2110 -0
  3. package/dist/agentdb-advanced.min.js +1 -0
  4. package/dist/agentdb.min.js +4 -4
  5. package/dist/backends/GraphBackend.d.ts +196 -0
  6. package/dist/backends/GraphBackend.d.ts.map +1 -0
  7. package/dist/backends/GraphBackend.js +33 -0
  8. package/dist/backends/GraphBackend.js.map +1 -0
  9. package/dist/backends/LearningBackend.d.ts +148 -0
  10. package/dist/backends/LearningBackend.d.ts.map +1 -0
  11. package/dist/backends/LearningBackend.js +27 -0
  12. package/dist/backends/LearningBackend.js.map +1 -0
  13. package/dist/backends/VectorBackend.d.ts +119 -0
  14. package/dist/backends/VectorBackend.d.ts.map +1 -0
  15. package/dist/backends/VectorBackend.js +14 -0
  16. package/dist/backends/VectorBackend.js.map +1 -0
  17. package/dist/backends/detector.d.ts +81 -0
  18. package/dist/backends/detector.d.ts.map +1 -0
  19. package/dist/backends/detector.js +192 -0
  20. package/dist/backends/detector.js.map +1 -0
  21. package/dist/backends/factory.d.ts +50 -0
  22. package/dist/backends/factory.d.ts.map +1 -0
  23. package/dist/backends/factory.js +161 -0
  24. package/dist/backends/factory.js.map +1 -0
  25. package/dist/backends/graph/GraphDatabaseAdapter.d.ts +139 -0
  26. package/dist/backends/graph/GraphDatabaseAdapter.d.ts.map +1 -0
  27. package/dist/backends/graph/GraphDatabaseAdapter.js +194 -0
  28. package/dist/backends/graph/GraphDatabaseAdapter.js.map +1 -0
  29. package/dist/backends/hnswlib/HNSWLibBackend.d.ts +92 -0
  30. package/dist/backends/hnswlib/HNSWLibBackend.d.ts.map +1 -0
  31. package/dist/backends/hnswlib/HNSWLibBackend.js +316 -0
  32. package/dist/backends/hnswlib/HNSWLibBackend.js.map +1 -0
  33. package/dist/backends/hnswlib/index.d.ts +7 -0
  34. package/dist/backends/hnswlib/index.d.ts.map +1 -0
  35. package/dist/backends/hnswlib/index.js +7 -0
  36. package/dist/backends/hnswlib/index.js.map +1 -0
  37. package/dist/backends/index.d.ts +14 -0
  38. package/dist/backends/index.d.ts.map +1 -0
  39. package/dist/backends/index.js +13 -0
  40. package/dist/backends/index.js.map +1 -0
  41. package/dist/backends/ruvector/RuVectorBackend.d.ts +75 -0
  42. package/dist/backends/ruvector/RuVectorBackend.d.ts.map +1 -0
  43. package/dist/backends/ruvector/RuVectorBackend.js +198 -0
  44. package/dist/backends/ruvector/RuVectorBackend.js.map +1 -0
  45. package/dist/backends/ruvector/RuVectorLearning.d.ts +104 -0
  46. package/dist/backends/ruvector/RuVectorLearning.d.ts.map +1 -0
  47. package/dist/backends/ruvector/RuVectorLearning.js +177 -0
  48. package/dist/backends/ruvector/RuVectorLearning.js.map +1 -0
  49. package/dist/backends/ruvector/index.d.ts +9 -0
  50. package/dist/backends/ruvector/index.d.ts.map +1 -0
  51. package/dist/backends/ruvector/index.js +8 -0
  52. package/dist/backends/ruvector/index.js.map +1 -0
  53. package/dist/browser/AdvancedFeatures.d.ts +144 -0
  54. package/dist/browser/AdvancedFeatures.d.ts.map +1 -0
  55. package/dist/browser/AdvancedFeatures.js +430 -0
  56. package/dist/browser/AdvancedFeatures.js.map +1 -0
  57. package/dist/browser/HNSWIndex.d.ts +117 -0
  58. package/dist/browser/HNSWIndex.d.ts.map +1 -0
  59. package/dist/browser/HNSWIndex.js +402 -0
  60. package/dist/browser/HNSWIndex.js.map +1 -0
  61. package/dist/browser/ProductQuantization.d.ts +107 -0
  62. package/dist/browser/ProductQuantization.d.ts.map +1 -0
  63. package/dist/browser/ProductQuantization.js +337 -0
  64. package/dist/browser/ProductQuantization.js.map +1 -0
  65. package/dist/browser/browser/AdvancedFeatures.d.ts +144 -0
  66. package/dist/browser/browser/AdvancedFeatures.d.ts.map +1 -0
  67. package/dist/browser/browser/AdvancedFeatures.js +427 -0
  68. package/dist/browser/browser/HNSWIndex.d.ts +117 -0
  69. package/dist/browser/browser/HNSWIndex.d.ts.map +1 -0
  70. package/dist/browser/browser/HNSWIndex.js +402 -0
  71. package/dist/browser/browser/ProductQuantization.d.ts +107 -0
  72. package/dist/browser/browser/ProductQuantization.d.ts.map +1 -0
  73. package/dist/browser/browser/ProductQuantization.js +348 -0
  74. package/dist/browser/browser/index.d.ts +223 -0
  75. package/dist/browser/browser/index.d.ts.map +1 -0
  76. package/dist/browser/browser/index.js +233 -0
  77. package/dist/browser/index.d.ts +223 -0
  78. package/dist/browser/index.d.ts.map +1 -0
  79. package/dist/browser/index.js +225 -0
  80. package/dist/browser/index.js.map +1 -0
  81. package/dist/cli/agentdb-cli.d.ts.map +1 -1
  82. package/dist/cli/agentdb-cli.js +130 -8
  83. package/dist/cli/agentdb-cli.js.map +1 -1
  84. package/dist/cli/agentdb.db +0 -0
  85. package/dist/cli/commands/init.d.ts +12 -0
  86. package/dist/cli/commands/init.d.ts.map +1 -0
  87. package/dist/cli/commands/init.js +115 -0
  88. package/dist/cli/commands/init.js.map +1 -0
  89. package/dist/cli/commands/install-embeddings.d.ts +10 -0
  90. package/dist/cli/commands/install-embeddings.d.ts.map +1 -0
  91. package/dist/cli/commands/install-embeddings.js +68 -0
  92. package/dist/cli/commands/install-embeddings.js.map +1 -0
  93. package/dist/cli/commands/migrate.d.ts +15 -0
  94. package/dist/cli/commands/migrate.d.ts.map +1 -0
  95. package/dist/cli/commands/migrate.js +425 -0
  96. package/dist/cli/commands/migrate.js.map +1 -0
  97. package/dist/cli/commands/status.d.ts +10 -0
  98. package/dist/cli/commands/status.d.ts.map +1 -0
  99. package/dist/cli/commands/status.js +129 -0
  100. package/dist/cli/commands/status.js.map +1 -0
  101. package/dist/controllers/CausalRecall.d.ts +3 -1
  102. package/dist/controllers/CausalRecall.d.ts.map +1 -1
  103. package/dist/controllers/CausalRecall.js +35 -4
  104. package/dist/controllers/CausalRecall.js.map +1 -1
  105. package/dist/controllers/ExplainableRecall.d.ts +24 -0
  106. package/dist/controllers/ExplainableRecall.d.ts.map +1 -1
  107. package/dist/controllers/ExplainableRecall.js +102 -5
  108. package/dist/controllers/ExplainableRecall.js.map +1 -1
  109. package/dist/controllers/HNSWIndex.d.ts +128 -0
  110. package/dist/controllers/HNSWIndex.d.ts.map +1 -0
  111. package/dist/controllers/HNSWIndex.js +361 -0
  112. package/dist/controllers/HNSWIndex.js.map +1 -0
  113. package/dist/controllers/NightlyLearner.d.ts.map +1 -1
  114. package/dist/controllers/NightlyLearner.js +7 -4
  115. package/dist/controllers/NightlyLearner.js.map +1 -1
  116. package/dist/controllers/ReasoningBank.d.ts +101 -2
  117. package/dist/controllers/ReasoningBank.d.ts.map +1 -1
  118. package/dist/controllers/ReasoningBank.js +196 -4
  119. package/dist/controllers/ReasoningBank.js.map +1 -1
  120. package/dist/controllers/ReflexionMemory.d.ts +41 -1
  121. package/dist/controllers/ReflexionMemory.d.ts.map +1 -1
  122. package/dist/controllers/ReflexionMemory.js +282 -5
  123. package/dist/controllers/ReflexionMemory.js.map +1 -1
  124. package/dist/controllers/SkillLibrary.d.ts +27 -9
  125. package/dist/controllers/SkillLibrary.d.ts.map +1 -1
  126. package/dist/controllers/SkillLibrary.js +136 -47
  127. package/dist/controllers/SkillLibrary.js.map +1 -1
  128. package/dist/controllers/index.d.ts +2 -0
  129. package/dist/controllers/index.d.ts.map +1 -1
  130. package/dist/controllers/index.js +1 -0
  131. package/dist/controllers/index.js.map +1 -1
  132. package/dist/db-fallback.d.ts.map +1 -1
  133. package/dist/db-fallback.js +100 -29
  134. package/dist/db-fallback.js.map +1 -1
  135. package/dist/db-test.d.ts +13 -0
  136. package/dist/db-test.d.ts.map +1 -0
  137. package/dist/db-test.js +55 -0
  138. package/dist/db-test.js.map +1 -0
  139. package/dist/db-unified.d.ts +76 -0
  140. package/dist/db-unified.d.ts.map +1 -0
  141. package/dist/db-unified.js +278 -0
  142. package/dist/db-unified.js.map +1 -0
  143. package/dist/index.d.ts +1 -0
  144. package/dist/index.d.ts.map +1 -1
  145. package/dist/index.js +2 -1
  146. package/dist/index.js.map +1 -1
  147. package/dist/malp/core/ccc.d.ts +99 -0
  148. package/dist/malp/core/ccc.d.ts.map +1 -0
  149. package/dist/malp/core/ccc.js +181 -0
  150. package/dist/malp/core/ccc.js.map +1 -0
  151. package/dist/malp/core/index.d.ts +9 -0
  152. package/dist/malp/core/index.d.ts.map +1 -0
  153. package/dist/malp/core/index.js +9 -0
  154. package/dist/malp/core/index.js.map +1 -0
  155. package/dist/malp/core/linalg.d.ts +101 -0
  156. package/dist/malp/core/linalg.d.ts.map +1 -0
  157. package/dist/malp/core/linalg.js +278 -0
  158. package/dist/malp/core/linalg.js.map +1 -0
  159. package/dist/malp/core/optimizer.d.ts +68 -0
  160. package/dist/malp/core/optimizer.d.ts.map +1 -0
  161. package/dist/malp/core/optimizer.js +160 -0
  162. package/dist/malp/core/optimizer.js.map +1 -0
  163. package/dist/malp/index.d.ts +33 -0
  164. package/dist/malp/index.d.ts.map +1 -0
  165. package/dist/malp/index.js +37 -0
  166. package/dist/malp/index.js.map +1 -0
  167. package/dist/malp/metrics/agreement.d.ts +106 -0
  168. package/dist/malp/metrics/agreement.d.ts.map +1 -0
  169. package/dist/malp/metrics/agreement.js +199 -0
  170. package/dist/malp/metrics/agreement.js.map +1 -0
  171. package/dist/malp/metrics/comparison.d.ts +93 -0
  172. package/dist/malp/metrics/comparison.d.ts.map +1 -0
  173. package/dist/malp/metrics/comparison.js +256 -0
  174. package/dist/malp/metrics/comparison.js.map +1 -0
  175. package/dist/malp/metrics/index.d.ts +8 -0
  176. package/dist/malp/metrics/index.d.ts.map +1 -0
  177. package/dist/malp/metrics/index.js +8 -0
  178. package/dist/malp/metrics/index.js.map +1 -0
  179. package/dist/malp/metrics/performance.d.ts +61 -0
  180. package/dist/malp/metrics/performance.d.ts.map +1 -0
  181. package/dist/malp/metrics/performance.js +190 -0
  182. package/dist/malp/metrics/performance.js.map +1 -0
  183. package/dist/malp/models/index.d.ts +7 -0
  184. package/dist/malp/models/index.d.ts.map +1 -0
  185. package/dist/malp/models/index.js +7 -0
  186. package/dist/malp/models/index.js.map +1 -0
  187. package/dist/malp/models/malp.d.ts +116 -0
  188. package/dist/malp/models/malp.d.ts.map +1 -0
  189. package/dist/malp/models/malp.js +206 -0
  190. package/dist/malp/models/malp.js.map +1 -0
  191. package/dist/malp/models/regressor.d.ts +80 -0
  192. package/dist/malp/models/regressor.d.ts.map +1 -0
  193. package/dist/malp/models/regressor.js +229 -0
  194. package/dist/malp/models/regressor.js.map +1 -0
  195. package/dist/malp/reasoningbank_validator.d.ts +187 -0
  196. package/dist/malp/reasoningbank_validator.d.ts.map +1 -0
  197. package/dist/malp/reasoningbank_validator.js +246 -0
  198. package/dist/malp/reasoningbank_validator.js.map +1 -0
  199. package/dist/malp/wasm_bindings.d.ts +344 -0
  200. package/dist/malp/wasm_bindings.d.ts.map +1 -0
  201. package/dist/malp/wasm_bindings.js +9 -0
  202. package/dist/malp/wasm_bindings.js.map +1 -0
  203. package/dist/mcp/agentdb-mcp-server.js +512 -33
  204. package/dist/mcp/agentdb-mcp-server.js.map +1 -1
  205. package/dist/optimizations/BatchOperations.d.ts +42 -0
  206. package/dist/optimizations/BatchOperations.d.ts.map +1 -1
  207. package/dist/optimizations/BatchOperations.js +181 -0
  208. package/dist/optimizations/BatchOperations.js.map +1 -1
  209. package/dist/optimizations/ToolCache.d.ts +137 -0
  210. package/dist/optimizations/ToolCache.d.ts.map +1 -0
  211. package/dist/optimizations/ToolCache.js +281 -0
  212. package/dist/optimizations/ToolCache.js.map +1 -0
  213. package/dist/security/input-validation.d.ts +24 -0
  214. package/dist/security/input-validation.d.ts.map +1 -1
  215. package/dist/security/input-validation.js +106 -0
  216. package/dist/security/input-validation.js.map +1 -1
  217. package/dist/security/limits.d.ts +150 -0
  218. package/dist/security/limits.d.ts.map +1 -0
  219. package/dist/security/limits.js +288 -0
  220. package/dist/security/limits.js.map +1 -0
  221. package/dist/security/path-security.d.ts +100 -0
  222. package/dist/security/path-security.d.ts.map +1 -0
  223. package/dist/security/path-security.js +337 -0
  224. package/dist/security/path-security.js.map +1 -0
  225. package/dist/security/validation.d.ts +95 -0
  226. package/dist/security/validation.d.ts.map +1 -0
  227. package/dist/security/validation.js +315 -0
  228. package/dist/security/validation.js.map +1 -0
  229. package/dist/simulation/cli.d.ts +9 -0
  230. package/dist/simulation/cli.d.ts.map +1 -0
  231. package/dist/simulation/cli.js +68 -0
  232. package/dist/simulation/cli.js.map +1 -0
  233. package/dist/simulation/runner.d.ts +21 -0
  234. package/dist/simulation/runner.d.ts.map +1 -0
  235. package/dist/simulation/runner.js +241 -0
  236. package/dist/simulation/runner.js.map +1 -0
  237. package/dist/simulation/scenarios/aidefence-integration.d.ts +24 -0
  238. package/dist/simulation/scenarios/aidefence-integration.d.ts.map +1 -0
  239. package/dist/simulation/scenarios/aidefence-integration.js +124 -0
  240. package/dist/simulation/scenarios/aidefence-integration.js.map +1 -0
  241. package/dist/simulation/scenarios/bmssp-integration.d.ts +23 -0
  242. package/dist/simulation/scenarios/bmssp-integration.d.ts.map +1 -0
  243. package/dist/simulation/scenarios/bmssp-integration.js +104 -0
  244. package/dist/simulation/scenarios/bmssp-integration.js.map +1 -0
  245. package/dist/simulation/scenarios/causal-reasoning.d.ts +16 -0
  246. package/dist/simulation/scenarios/causal-reasoning.d.ts.map +1 -0
  247. package/dist/simulation/scenarios/causal-reasoning.js +108 -0
  248. package/dist/simulation/scenarios/causal-reasoning.js.map +1 -0
  249. package/dist/simulation/scenarios/consciousness-explorer.d.ts +25 -0
  250. package/dist/simulation/scenarios/consciousness-explorer.d.ts.map +1 -0
  251. package/dist/simulation/scenarios/consciousness-explorer.js +108 -0
  252. package/dist/simulation/scenarios/consciousness-explorer.js.map +1 -0
  253. package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.d.ts +135 -0
  254. package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.d.ts.map +1 -0
  255. package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.js +158 -0
  256. package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.js.map +1 -0
  257. package/dist/simulation/scenarios/domain-examples/index.d.ts +14 -0
  258. package/dist/simulation/scenarios/domain-examples/index.d.ts.map +1 -0
  259. package/dist/simulation/scenarios/domain-examples/index.js +14 -0
  260. package/dist/simulation/scenarios/domain-examples/index.js.map +1 -0
  261. package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.d.ts +178 -0
  262. package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.d.ts.map +1 -0
  263. package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.js +218 -0
  264. package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.js.map +1 -0
  265. package/dist/simulation/scenarios/domain-examples/medical-imaging.d.ts +122 -0
  266. package/dist/simulation/scenarios/domain-examples/medical-imaging.d.ts.map +1 -0
  267. package/dist/simulation/scenarios/domain-examples/medical-imaging.js +129 -0
  268. package/dist/simulation/scenarios/domain-examples/medical-imaging.js.map +1 -0
  269. package/dist/simulation/scenarios/domain-examples/robotics-navigation.d.ts +166 -0
  270. package/dist/simulation/scenarios/domain-examples/robotics-navigation.d.ts.map +1 -0
  271. package/dist/simulation/scenarios/domain-examples/robotics-navigation.js +161 -0
  272. package/dist/simulation/scenarios/domain-examples/robotics-navigation.js.map +1 -0
  273. package/dist/simulation/scenarios/domain-examples/scientific-research.d.ts +151 -0
  274. package/dist/simulation/scenarios/domain-examples/scientific-research.d.ts.map +1 -0
  275. package/dist/simulation/scenarios/domain-examples/scientific-research.js +187 -0
  276. package/dist/simulation/scenarios/domain-examples/scientific-research.js.map +1 -0
  277. package/dist/simulation/scenarios/domain-examples/trading-systems.d.ts +102 -0
  278. package/dist/simulation/scenarios/domain-examples/trading-systems.d.ts.map +1 -0
  279. package/dist/simulation/scenarios/domain-examples/trading-systems.js +100 -0
  280. package/dist/simulation/scenarios/domain-examples/trading-systems.js.map +1 -0
  281. package/dist/simulation/scenarios/goalie-integration.d.ts +24 -0
  282. package/dist/simulation/scenarios/goalie-integration.d.ts.map +1 -0
  283. package/dist/simulation/scenarios/goalie-integration.js +121 -0
  284. package/dist/simulation/scenarios/goalie-integration.js.map +1 -0
  285. package/dist/simulation/scenarios/graph-traversal.d.ts +17 -0
  286. package/dist/simulation/scenarios/graph-traversal.d.ts.map +1 -0
  287. package/dist/simulation/scenarios/graph-traversal.js +101 -0
  288. package/dist/simulation/scenarios/graph-traversal.js.map +1 -0
  289. package/dist/simulation/scenarios/latent-space/attention-analysis.d.ts +45 -0
  290. package/dist/simulation/scenarios/latent-space/attention-analysis.d.ts.map +1 -0
  291. package/dist/simulation/scenarios/latent-space/attention-analysis.js +435 -0
  292. package/dist/simulation/scenarios/latent-space/attention-analysis.js.map +1 -0
  293. package/dist/simulation/scenarios/latent-space/clustering-analysis.d.ts +55 -0
  294. package/dist/simulation/scenarios/latent-space/clustering-analysis.d.ts.map +1 -0
  295. package/dist/simulation/scenarios/latent-space/clustering-analysis.js +606 -0
  296. package/dist/simulation/scenarios/latent-space/clustering-analysis.js.map +1 -0
  297. package/dist/simulation/scenarios/latent-space/hnsw-exploration.d.ts +74 -0
  298. package/dist/simulation/scenarios/latent-space/hnsw-exploration.d.ts.map +1 -0
  299. package/dist/simulation/scenarios/latent-space/hnsw-exploration.js +391 -0
  300. package/dist/simulation/scenarios/latent-space/hnsw-exploration.js.map +1 -0
  301. package/dist/simulation/scenarios/latent-space/hypergraph-exploration.d.ts +51 -0
  302. package/dist/simulation/scenarios/latent-space/hypergraph-exploration.d.ts.map +1 -0
  303. package/dist/simulation/scenarios/latent-space/hypergraph-exploration.js +536 -0
  304. package/dist/simulation/scenarios/latent-space/hypergraph-exploration.js.map +1 -0
  305. package/dist/simulation/scenarios/latent-space/index.d.ts +35 -0
  306. package/dist/simulation/scenarios/latent-space/index.d.ts.map +1 -0
  307. package/dist/simulation/scenarios/latent-space/index.js +35 -0
  308. package/dist/simulation/scenarios/latent-space/index.js.map +1 -0
  309. package/dist/simulation/scenarios/latent-space/neural-augmentation.d.ts +52 -0
  310. package/dist/simulation/scenarios/latent-space/neural-augmentation.d.ts.map +1 -0
  311. package/dist/simulation/scenarios/latent-space/neural-augmentation.js +472 -0
  312. package/dist/simulation/scenarios/latent-space/neural-augmentation.js.map +1 -0
  313. package/dist/simulation/scenarios/latent-space/quantum-hybrid.d.ts +53 -0
  314. package/dist/simulation/scenarios/latent-space/quantum-hybrid.d.ts.map +1 -0
  315. package/dist/simulation/scenarios/latent-space/quantum-hybrid.js +391 -0
  316. package/dist/simulation/scenarios/latent-space/quantum-hybrid.js.map +1 -0
  317. package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.d.ts +52 -0
  318. package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.d.ts.map +1 -0
  319. package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.js +514 -0
  320. package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.js.map +1 -0
  321. package/dist/simulation/scenarios/latent-space/traversal-optimization.d.ts +53 -0
  322. package/dist/simulation/scenarios/latent-space/traversal-optimization.d.ts.map +1 -0
  323. package/dist/simulation/scenarios/latent-space/traversal-optimization.js +595 -0
  324. package/dist/simulation/scenarios/latent-space/traversal-optimization.js.map +1 -0
  325. package/dist/simulation/scenarios/lean-agentic-swarm.d.ts +18 -0
  326. package/dist/simulation/scenarios/lean-agentic-swarm.d.ts.map +1 -0
  327. package/dist/simulation/scenarios/lean-agentic-swarm.js +132 -0
  328. package/dist/simulation/scenarios/lean-agentic-swarm.js.map +1 -0
  329. package/dist/simulation/scenarios/multi-agent-swarm.d.ts +17 -0
  330. package/dist/simulation/scenarios/multi-agent-swarm.d.ts.map +1 -0
  331. package/dist/simulation/scenarios/multi-agent-swarm.js +111 -0
  332. package/dist/simulation/scenarios/multi-agent-swarm.js.map +1 -0
  333. package/dist/simulation/scenarios/psycho-symbolic-reasoner.d.ts +23 -0
  334. package/dist/simulation/scenarios/psycho-symbolic-reasoner.d.ts.map +1 -0
  335. package/dist/simulation/scenarios/psycho-symbolic-reasoner.js +98 -0
  336. package/dist/simulation/scenarios/psycho-symbolic-reasoner.js.map +1 -0
  337. package/dist/simulation/scenarios/reflexion-learning.d.ts +16 -0
  338. package/dist/simulation/scenarios/reflexion-learning.d.ts.map +1 -0
  339. package/dist/simulation/scenarios/reflexion-learning.js +98 -0
  340. package/dist/simulation/scenarios/reflexion-learning.js.map +1 -0
  341. package/dist/simulation/scenarios/research-swarm.d.ts +24 -0
  342. package/dist/simulation/scenarios/research-swarm.d.ts.map +1 -0
  343. package/dist/simulation/scenarios/research-swarm.js +146 -0
  344. package/dist/simulation/scenarios/research-swarm.js.map +1 -0
  345. package/dist/simulation/scenarios/skill-evolution.d.ts +16 -0
  346. package/dist/simulation/scenarios/skill-evolution.d.ts.map +1 -0
  347. package/dist/simulation/scenarios/skill-evolution.js +109 -0
  348. package/dist/simulation/scenarios/skill-evolution.js.map +1 -0
  349. package/dist/simulation/scenarios/stock-market-emergence.d.ts +33 -0
  350. package/dist/simulation/scenarios/stock-market-emergence.d.ts.map +1 -0
  351. package/dist/simulation/scenarios/stock-market-emergence.js +246 -0
  352. package/dist/simulation/scenarios/stock-market-emergence.js.map +1 -0
  353. package/dist/simulation/scenarios/strange-loops.d.ts +18 -0
  354. package/dist/simulation/scenarios/strange-loops.d.ts.map +1 -0
  355. package/dist/simulation/scenarios/strange-loops.js +133 -0
  356. package/dist/simulation/scenarios/strange-loops.js.map +1 -0
  357. package/dist/simulation/scenarios/sublinear-solver.d.ts +22 -0
  358. package/dist/simulation/scenarios/sublinear-solver.d.ts.map +1 -0
  359. package/dist/simulation/scenarios/sublinear-solver.js +82 -0
  360. package/dist/simulation/scenarios/sublinear-solver.js.map +1 -0
  361. package/dist/simulation/scenarios/temporal-lead-solver.d.ts +23 -0
  362. package/dist/simulation/scenarios/temporal-lead-solver.d.ts.map +1 -0
  363. package/dist/simulation/scenarios/temporal-lead-solver.js +90 -0
  364. package/dist/simulation/scenarios/temporal-lead-solver.js.map +1 -0
  365. package/dist/simulation/scenarios/voting-system-consensus.d.ts +27 -0
  366. package/dist/simulation/scenarios/voting-system-consensus.d.ts.map +1 -0
  367. package/dist/simulation/scenarios/voting-system-consensus.js +175 -0
  368. package/dist/simulation/scenarios/voting-system-consensus.js.map +1 -0
  369. package/dist/simulation/types.d.ts +162 -0
  370. package/dist/simulation/types.d.ts.map +1 -0
  371. package/dist/simulation/types.js +5 -0
  372. package/dist/simulation/types.js.map +1 -0
  373. package/dist/simulation/utils/PerformanceOptimizer.d.ts +115 -0
  374. package/dist/simulation/utils/PerformanceOptimizer.d.ts.map +1 -0
  375. package/dist/simulation/utils/PerformanceOptimizer.js +223 -0
  376. package/dist/simulation/utils/PerformanceOptimizer.js.map +1 -0
  377. package/dist/src/backends/GraphBackend.d.ts +196 -0
  378. package/dist/src/backends/GraphBackend.d.ts.map +1 -0
  379. package/dist/src/backends/GraphBackend.js +33 -0
  380. package/dist/src/backends/GraphBackend.js.map +1 -0
  381. package/dist/src/backends/LearningBackend.d.ts +148 -0
  382. package/dist/src/backends/LearningBackend.d.ts.map +1 -0
  383. package/dist/src/backends/LearningBackend.js +27 -0
  384. package/dist/src/backends/LearningBackend.js.map +1 -0
  385. package/dist/src/backends/VectorBackend.d.ts +119 -0
  386. package/dist/src/backends/VectorBackend.d.ts.map +1 -0
  387. package/dist/src/backends/VectorBackend.js +14 -0
  388. package/dist/src/backends/VectorBackend.js.map +1 -0
  389. package/dist/src/backends/detector.d.ts +81 -0
  390. package/dist/src/backends/detector.d.ts.map +1 -0
  391. package/dist/src/backends/detector.js +192 -0
  392. package/dist/src/backends/detector.js.map +1 -0
  393. package/dist/src/backends/factory.d.ts +50 -0
  394. package/dist/src/backends/factory.d.ts.map +1 -0
  395. package/dist/src/backends/factory.js +161 -0
  396. package/dist/src/backends/factory.js.map +1 -0
  397. package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts +151 -0
  398. package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts.map +1 -0
  399. package/dist/src/backends/graph/GraphDatabaseAdapter.js +224 -0
  400. package/dist/src/backends/graph/GraphDatabaseAdapter.js.map +1 -0
  401. package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts +92 -0
  402. package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts.map +1 -0
  403. package/dist/src/backends/hnswlib/HNSWLibBackend.js +316 -0
  404. package/dist/src/backends/hnswlib/HNSWLibBackend.js.map +1 -0
  405. package/dist/src/backends/hnswlib/index.d.ts +7 -0
  406. package/dist/src/backends/hnswlib/index.d.ts.map +1 -0
  407. package/dist/src/backends/hnswlib/index.js +7 -0
  408. package/dist/src/backends/hnswlib/index.js.map +1 -0
  409. package/dist/src/backends/index.d.ts +14 -0
  410. package/dist/src/backends/index.d.ts.map +1 -0
  411. package/dist/src/backends/index.js +13 -0
  412. package/dist/src/backends/index.js.map +1 -0
  413. package/dist/src/backends/ruvector/RuVectorBackend.d.ts +75 -0
  414. package/dist/src/backends/ruvector/RuVectorBackend.d.ts.map +1 -0
  415. package/dist/src/backends/ruvector/RuVectorBackend.js +198 -0
  416. package/dist/src/backends/ruvector/RuVectorBackend.js.map +1 -0
  417. package/dist/src/backends/ruvector/RuVectorLearning.d.ts +104 -0
  418. package/dist/src/backends/ruvector/RuVectorLearning.d.ts.map +1 -0
  419. package/dist/src/backends/ruvector/RuVectorLearning.js +177 -0
  420. package/dist/src/backends/ruvector/RuVectorLearning.js.map +1 -0
  421. package/dist/src/backends/ruvector/index.d.ts +9 -0
  422. package/dist/src/backends/ruvector/index.d.ts.map +1 -0
  423. package/dist/src/backends/ruvector/index.js +8 -0
  424. package/dist/src/backends/ruvector/index.js.map +1 -0
  425. package/dist/src/benchmarks/wasm-vector-benchmark.d.ts +10 -0
  426. package/dist/src/benchmarks/wasm-vector-benchmark.d.ts.map +1 -0
  427. package/dist/src/benchmarks/wasm-vector-benchmark.js +196 -0
  428. package/dist/src/benchmarks/wasm-vector-benchmark.js.map +1 -0
  429. package/dist/src/browser/AdvancedFeatures.d.ts +144 -0
  430. package/dist/src/browser/AdvancedFeatures.d.ts.map +1 -0
  431. package/dist/src/browser/AdvancedFeatures.js +430 -0
  432. package/dist/src/browser/AdvancedFeatures.js.map +1 -0
  433. package/dist/src/browser/HNSWIndex.d.ts +117 -0
  434. package/dist/src/browser/HNSWIndex.d.ts.map +1 -0
  435. package/dist/src/browser/HNSWIndex.js +402 -0
  436. package/dist/src/browser/HNSWIndex.js.map +1 -0
  437. package/dist/src/browser/ProductQuantization.d.ts +107 -0
  438. package/dist/src/browser/ProductQuantization.d.ts.map +1 -0
  439. package/dist/src/browser/ProductQuantization.js +337 -0
  440. package/dist/src/browser/ProductQuantization.js.map +1 -0
  441. package/dist/src/browser/index.d.ts +223 -0
  442. package/dist/src/browser/index.d.ts.map +1 -0
  443. package/dist/src/browser/index.js +225 -0
  444. package/dist/src/browser/index.js.map +1 -0
  445. package/dist/src/cli/agentdb-cli.d.ts +154 -0
  446. package/dist/src/cli/agentdb-cli.d.ts.map +1 -0
  447. package/dist/src/cli/agentdb-cli.js +2273 -0
  448. package/dist/src/cli/agentdb-cli.js.map +1 -0
  449. package/dist/src/cli/commands/init.d.ts +12 -0
  450. package/dist/src/cli/commands/init.d.ts.map +1 -0
  451. package/dist/src/cli/commands/init.js +115 -0
  452. package/dist/src/cli/commands/init.js.map +1 -0
  453. package/dist/src/cli/commands/install-embeddings.d.ts +10 -0
  454. package/dist/src/cli/commands/install-embeddings.d.ts.map +1 -0
  455. package/dist/src/cli/commands/install-embeddings.js +68 -0
  456. package/dist/src/cli/commands/install-embeddings.js.map +1 -0
  457. package/dist/src/cli/commands/migrate.d.ts +15 -0
  458. package/dist/src/cli/commands/migrate.d.ts.map +1 -0
  459. package/dist/src/cli/commands/migrate.js +425 -0
  460. package/dist/src/cli/commands/migrate.js.map +1 -0
  461. package/dist/src/cli/commands/simulate-custom.d.ts +26 -0
  462. package/dist/src/cli/commands/simulate-custom.d.ts.map +1 -0
  463. package/dist/src/cli/commands/simulate-custom.js +207 -0
  464. package/dist/src/cli/commands/simulate-custom.js.map +1 -0
  465. package/dist/src/cli/commands/simulate-report.d.ts +15 -0
  466. package/dist/src/cli/commands/simulate-report.d.ts.map +1 -0
  467. package/dist/src/cli/commands/simulate-report.js +136 -0
  468. package/dist/src/cli/commands/simulate-report.js.map +1 -0
  469. package/dist/src/cli/commands/simulate-wizard.d.ts +6 -0
  470. package/dist/src/cli/commands/simulate-wizard.d.ts.map +1 -0
  471. package/dist/src/cli/commands/simulate-wizard.js +352 -0
  472. package/dist/src/cli/commands/simulate-wizard.js.map +1 -0
  473. package/dist/src/cli/commands/simulate.d.ts +7 -0
  474. package/dist/src/cli/commands/simulate.d.ts.map +1 -0
  475. package/dist/src/cli/commands/simulate.js +100 -0
  476. package/dist/src/cli/commands/simulate.js.map +1 -0
  477. package/dist/src/cli/commands/status.d.ts +10 -0
  478. package/dist/src/cli/commands/status.d.ts.map +1 -0
  479. package/dist/src/cli/commands/status.js +129 -0
  480. package/dist/src/cli/commands/status.js.map +1 -0
  481. package/dist/src/cli/lib/config-manager.d.ts +110 -0
  482. package/dist/src/cli/lib/config-manager.d.ts.map +1 -0
  483. package/dist/src/cli/lib/config-manager.js +512 -0
  484. package/dist/src/cli/lib/config-manager.js.map +1 -0
  485. package/dist/src/cli/lib/config-validator.d.ts +43 -0
  486. package/dist/src/cli/lib/config-validator.d.ts.map +1 -0
  487. package/dist/src/cli/lib/config-validator.js +217 -0
  488. package/dist/src/cli/lib/config-validator.js.map +1 -0
  489. package/dist/src/cli/lib/health-monitor.d.ts +149 -0
  490. package/dist/src/cli/lib/health-monitor.d.ts.map +1 -0
  491. package/dist/src/cli/lib/health-monitor.js +380 -0
  492. package/dist/src/cli/lib/health-monitor.js.map +1 -0
  493. package/dist/src/cli/lib/help-formatter.d.ts +38 -0
  494. package/dist/src/cli/lib/help-formatter.d.ts.map +1 -0
  495. package/dist/src/cli/lib/help-formatter.js +357 -0
  496. package/dist/src/cli/lib/help-formatter.js.map +1 -0
  497. package/dist/src/cli/lib/history-tracker.d.ts +103 -0
  498. package/dist/src/cli/lib/history-tracker.d.ts.map +1 -0
  499. package/dist/src/cli/lib/history-tracker.js +346 -0
  500. package/dist/src/cli/lib/history-tracker.js.map +1 -0
  501. package/dist/src/cli/lib/report-generator.d.ts +24 -0
  502. package/dist/src/cli/lib/report-generator.d.ts.map +1 -0
  503. package/dist/src/cli/lib/report-generator.js +417 -0
  504. package/dist/src/cli/lib/report-generator.js.map +1 -0
  505. package/dist/src/cli/lib/report-store.d.ts +116 -0
  506. package/dist/src/cli/lib/report-store.d.ts.map +1 -0
  507. package/dist/src/cli/lib/report-store.js +464 -0
  508. package/dist/src/cli/lib/report-store.js.map +1 -0
  509. package/dist/src/cli/lib/simulation-registry.d.ts +165 -0
  510. package/dist/src/cli/lib/simulation-registry.d.ts.map +1 -0
  511. package/dist/src/cli/lib/simulation-registry.js +332 -0
  512. package/dist/src/cli/lib/simulation-registry.js.map +1 -0
  513. package/dist/src/cli/lib/simulation-runner.d.ts +90 -0
  514. package/dist/src/cli/lib/simulation-runner.d.ts.map +1 -0
  515. package/dist/src/cli/lib/simulation-runner.js +211 -0
  516. package/dist/src/cli/lib/simulation-runner.js.map +1 -0
  517. package/dist/src/controllers/CausalMemoryGraph.d.ts +127 -0
  518. package/dist/src/controllers/CausalMemoryGraph.d.ts.map +1 -0
  519. package/dist/src/controllers/CausalMemoryGraph.js +354 -0
  520. package/dist/src/controllers/CausalMemoryGraph.js.map +1 -0
  521. package/dist/src/controllers/CausalRecall.d.ts +139 -0
  522. package/dist/src/controllers/CausalRecall.d.ts.map +1 -0
  523. package/dist/src/controllers/CausalRecall.js +356 -0
  524. package/dist/src/controllers/CausalRecall.js.map +1 -0
  525. package/dist/src/controllers/ContextSynthesizer.d.ts +65 -0
  526. package/dist/src/controllers/ContextSynthesizer.d.ts.map +1 -0
  527. package/dist/src/controllers/ContextSynthesizer.js +208 -0
  528. package/dist/src/controllers/ContextSynthesizer.js.map +1 -0
  529. package/dist/src/controllers/EmbeddingService.d.ts +37 -0
  530. package/dist/src/controllers/EmbeddingService.d.ts.map +1 -0
  531. package/dist/src/controllers/EmbeddingService.js +136 -0
  532. package/dist/src/controllers/EmbeddingService.js.map +1 -0
  533. package/dist/src/controllers/EnhancedEmbeddingService.d.ts +50 -0
  534. package/dist/src/controllers/EnhancedEmbeddingService.d.ts.map +1 -0
  535. package/dist/src/controllers/EnhancedEmbeddingService.js +119 -0
  536. package/dist/src/controllers/EnhancedEmbeddingService.js.map +1 -0
  537. package/dist/src/controllers/ExplainableRecall.d.ts +163 -0
  538. package/dist/src/controllers/ExplainableRecall.d.ts.map +1 -0
  539. package/dist/src/controllers/ExplainableRecall.js +485 -0
  540. package/dist/src/controllers/ExplainableRecall.js.map +1 -0
  541. package/dist/src/controllers/HNSWIndex.d.ts +128 -0
  542. package/dist/src/controllers/HNSWIndex.d.ts.map +1 -0
  543. package/dist/src/controllers/HNSWIndex.js +361 -0
  544. package/dist/src/controllers/HNSWIndex.js.map +1 -0
  545. package/dist/src/controllers/LearningSystem.d.ts +195 -0
  546. package/dist/src/controllers/LearningSystem.d.ts.map +1 -0
  547. package/dist/src/controllers/LearningSystem.js +929 -0
  548. package/dist/src/controllers/LearningSystem.js.map +1 -0
  549. package/dist/src/controllers/MMRDiversityRanker.d.ts +50 -0
  550. package/dist/src/controllers/MMRDiversityRanker.d.ts.map +1 -0
  551. package/dist/src/controllers/MMRDiversityRanker.js +130 -0
  552. package/dist/src/controllers/MMRDiversityRanker.js.map +1 -0
  553. package/dist/src/controllers/MetadataFilter.d.ts +70 -0
  554. package/dist/src/controllers/MetadataFilter.d.ts.map +1 -0
  555. package/dist/src/controllers/MetadataFilter.js +243 -0
  556. package/dist/src/controllers/MetadataFilter.js.map +1 -0
  557. package/dist/src/controllers/NightlyLearner.d.ts +114 -0
  558. package/dist/src/controllers/NightlyLearner.d.ts.map +1 -0
  559. package/dist/src/controllers/NightlyLearner.js +394 -0
  560. package/dist/src/controllers/NightlyLearner.js.map +1 -0
  561. package/dist/src/controllers/QUICClient.d.ts +109 -0
  562. package/dist/src/controllers/QUICClient.d.ts.map +1 -0
  563. package/dist/src/controllers/QUICClient.js +299 -0
  564. package/dist/src/controllers/QUICClient.js.map +1 -0
  565. package/dist/src/controllers/QUICServer.d.ts +121 -0
  566. package/dist/src/controllers/QUICServer.d.ts.map +1 -0
  567. package/dist/src/controllers/QUICServer.js +383 -0
  568. package/dist/src/controllers/QUICServer.js.map +1 -0
  569. package/dist/src/controllers/ReasoningBank.d.ts +196 -0
  570. package/dist/src/controllers/ReasoningBank.d.ts.map +1 -0
  571. package/dist/src/controllers/ReasoningBank.js +494 -0
  572. package/dist/src/controllers/ReasoningBank.js.map +1 -0
  573. package/dist/src/controllers/ReflexionMemory.d.ts +125 -0
  574. package/dist/src/controllers/ReflexionMemory.d.ts.map +1 -0
  575. package/dist/src/controllers/ReflexionMemory.js +654 -0
  576. package/dist/src/controllers/ReflexionMemory.js.map +1 -0
  577. package/dist/src/controllers/SkillLibrary.d.ts +150 -0
  578. package/dist/src/controllers/SkillLibrary.d.ts.map +1 -0
  579. package/dist/src/controllers/SkillLibrary.js +608 -0
  580. package/dist/src/controllers/SkillLibrary.js.map +1 -0
  581. package/dist/src/controllers/SyncCoordinator.d.ts +120 -0
  582. package/dist/src/controllers/SyncCoordinator.d.ts.map +1 -0
  583. package/dist/src/controllers/SyncCoordinator.js +441 -0
  584. package/dist/src/controllers/SyncCoordinator.js.map +1 -0
  585. package/dist/src/controllers/WASMVectorSearch.d.ts +89 -0
  586. package/dist/src/controllers/WASMVectorSearch.d.ts.map +1 -0
  587. package/dist/src/controllers/WASMVectorSearch.js +234 -0
  588. package/dist/src/controllers/WASMVectorSearch.js.map +1 -0
  589. package/dist/src/controllers/frontier-index.d.ts +14 -0
  590. package/dist/src/controllers/frontier-index.d.ts.map +1 -0
  591. package/dist/src/controllers/frontier-index.js +10 -0
  592. package/dist/src/controllers/frontier-index.js.map +1 -0
  593. package/dist/src/controllers/index.d.ts +30 -0
  594. package/dist/src/controllers/index.d.ts.map +1 -0
  595. package/dist/src/controllers/index.js +18 -0
  596. package/dist/src/controllers/index.js.map +1 -0
  597. package/dist/src/db-fallback.d.ts +26 -0
  598. package/dist/src/db-fallback.d.ts.map +1 -0
  599. package/dist/src/db-fallback.js +264 -0
  600. package/dist/src/db-fallback.js.map +1 -0
  601. package/dist/src/db-test.d.ts +13 -0
  602. package/dist/src/db-test.d.ts.map +1 -0
  603. package/dist/src/db-test.js +55 -0
  604. package/dist/src/db-test.js.map +1 -0
  605. package/dist/src/db-unified.d.ts +76 -0
  606. package/dist/src/db-unified.d.ts.map +1 -0
  607. package/dist/src/db-unified.js +279 -0
  608. package/dist/src/db-unified.js.map +1 -0
  609. package/dist/src/examples/quic-sync-example.d.ts +9 -0
  610. package/dist/src/examples/quic-sync-example.d.ts.map +1 -0
  611. package/dist/src/examples/quic-sync-example.js +169 -0
  612. package/dist/src/examples/quic-sync-example.js.map +1 -0
  613. package/dist/src/examples/wasm-vector-usage.d.ts +12 -0
  614. package/dist/src/examples/wasm-vector-usage.d.ts.map +1 -0
  615. package/dist/src/examples/wasm-vector-usage.js +190 -0
  616. package/dist/src/examples/wasm-vector-usage.js.map +1 -0
  617. package/dist/src/index.d.ts +28 -0
  618. package/dist/src/index.d.ts.map +1 -0
  619. package/dist/src/index.js +35 -0
  620. package/dist/src/index.js.map +1 -0
  621. package/dist/src/mcp/agentdb-mcp-server.d.ts +8 -0
  622. package/dist/src/mcp/agentdb-mcp-server.d.ts.map +1 -0
  623. package/dist/src/mcp/agentdb-mcp-server.js +2116 -0
  624. package/dist/src/mcp/agentdb-mcp-server.js.map +1 -0
  625. package/dist/src/mcp/learning-tools-handlers.d.ts +16 -0
  626. package/dist/src/mcp/learning-tools-handlers.d.ts.map +1 -0
  627. package/dist/src/mcp/learning-tools-handlers.js +105 -0
  628. package/dist/src/mcp/learning-tools-handlers.js.map +1 -0
  629. package/dist/src/optimizations/BatchOperations.d.ts +109 -0
  630. package/dist/src/optimizations/BatchOperations.d.ts.map +1 -0
  631. package/dist/src/optimizations/BatchOperations.js +407 -0
  632. package/dist/src/optimizations/BatchOperations.js.map +1 -0
  633. package/dist/src/optimizations/QueryOptimizer.d.ts +83 -0
  634. package/dist/src/optimizations/QueryOptimizer.d.ts.map +1 -0
  635. package/dist/src/optimizations/QueryOptimizer.js +228 -0
  636. package/dist/src/optimizations/QueryOptimizer.js.map +1 -0
  637. package/dist/src/optimizations/ToolCache.d.ts +137 -0
  638. package/dist/src/optimizations/ToolCache.d.ts.map +1 -0
  639. package/dist/src/optimizations/ToolCache.js +281 -0
  640. package/dist/src/optimizations/ToolCache.js.map +1 -0
  641. package/dist/src/optimizations/index.d.ts +10 -0
  642. package/dist/src/optimizations/index.d.ts.map +1 -0
  643. package/dist/src/optimizations/index.js +8 -0
  644. package/dist/src/optimizations/index.js.map +1 -0
  645. package/dist/src/security/input-validation.d.ts +109 -0
  646. package/dist/src/security/input-validation.d.ts.map +1 -0
  647. package/dist/src/security/input-validation.js +398 -0
  648. package/dist/src/security/input-validation.js.map +1 -0
  649. package/dist/src/security/limits.d.ts +150 -0
  650. package/dist/src/security/limits.d.ts.map +1 -0
  651. package/dist/src/security/limits.js +288 -0
  652. package/dist/src/security/limits.js.map +1 -0
  653. package/dist/src/security/path-security.d.ts +100 -0
  654. package/dist/src/security/path-security.d.ts.map +1 -0
  655. package/dist/src/security/path-security.js +337 -0
  656. package/dist/src/security/path-security.js.map +1 -0
  657. package/dist/src/security/validation.d.ts +95 -0
  658. package/dist/src/security/validation.d.ts.map +1 -0
  659. package/dist/src/security/validation.js +315 -0
  660. package/dist/src/security/validation.js.map +1 -0
  661. package/dist/src/services/LLMRouter.d.ts +84 -0
  662. package/dist/src/services/LLMRouter.d.ts.map +1 -0
  663. package/dist/src/services/LLMRouter.js +329 -0
  664. package/dist/src/services/LLMRouter.js.map +1 -0
  665. package/dist/src/types/quic.d.ts +518 -0
  666. package/dist/src/types/quic.d.ts.map +1 -0
  667. package/dist/src/types/quic.js +272 -0
  668. package/dist/src/types/quic.js.map +1 -0
  669. package/dist/src/utils/NodeIdMapper.d.ts +38 -0
  670. package/dist/src/utils/NodeIdMapper.d.ts.map +1 -0
  671. package/dist/src/utils/NodeIdMapper.js +57 -0
  672. package/dist/src/utils/NodeIdMapper.js.map +1 -0
  673. package/package.json +15 -3
  674. package/scripts/README.md +314 -0
  675. package/src/backends/GraphBackend.ts +290 -0
  676. package/src/backends/LearningBackend.ts +210 -0
  677. package/src/backends/README.md +389 -0
  678. package/src/backends/VectorBackend.ts +145 -0
  679. package/src/backends/detector.ts +283 -0
  680. package/src/backends/factory.ts +193 -0
  681. package/src/backends/graph/GraphDatabaseAdapter.ts +334 -0
  682. package/src/backends/hnswlib/HNSWLibBackend.ts +413 -0
  683. package/src/backends/hnswlib/index.ts +7 -0
  684. package/src/backends/index.ts +32 -0
  685. package/src/backends/ruvector/RuVectorBackend.ts +232 -0
  686. package/src/backends/ruvector/RuVectorLearning.ts +242 -0
  687. package/src/backends/ruvector/index.ts +9 -0
  688. package/src/backends/ruvector/types.d.ts +64 -0
  689. package/src/browser/AdvancedFeatures.ts +565 -0
  690. package/src/browser/HNSWIndex.ts +494 -0
  691. package/src/browser/ProductQuantization.ts +419 -0
  692. package/src/browser/index.ts +301 -0
  693. package/src/cli/agentdb-cli.ts +131 -8
  694. package/src/cli/commands/init.ts +148 -0
  695. package/src/cli/commands/install-embeddings.ts +81 -0
  696. package/src/cli/commands/migrate.ts +545 -0
  697. package/src/cli/commands/simulate-custom.ts +232 -0
  698. package/src/cli/commands/simulate-report.ts +171 -0
  699. package/src/cli/commands/simulate-wizard.ts +379 -0
  700. package/src/cli/commands/simulate.ts +115 -0
  701. package/src/cli/commands/status.ts +156 -0
  702. package/src/cli/lib/config-manager.ts +627 -0
  703. package/src/cli/lib/config-validator.ts +261 -0
  704. package/src/cli/lib/health-monitor.ts +513 -0
  705. package/src/cli/lib/help-formatter.ts +406 -0
  706. package/src/cli/lib/history-tracker.ts +497 -0
  707. package/src/cli/lib/report-generator.ts +455 -0
  708. package/src/cli/lib/report-store.ts +582 -0
  709. package/src/cli/lib/simulation-registry.ts +502 -0
  710. package/src/cli/lib/simulation-runner.ts +291 -0
  711. package/src/cli/tests/agentdb-cli.test.ts +58 -0
  712. package/src/controllers/CausalMemoryGraph.ts +42 -2
  713. package/src/controllers/CausalRecall.ts +41 -4
  714. package/src/controllers/ExplainableRecall.ts +123 -5
  715. package/src/controllers/HNSWIndex.ts +495 -0
  716. package/src/controllers/NightlyLearner.ts +8 -4
  717. package/src/controllers/ReasoningBank.ts +268 -5
  718. package/src/controllers/ReflexionMemory.ts +531 -6
  719. package/src/controllers/SkillLibrary.ts +234 -60
  720. package/src/controllers/index.ts +2 -0
  721. package/src/db-fallback.ts +103 -35
  722. package/src/db-test.ts +59 -0
  723. package/src/db-unified.ts +327 -0
  724. package/src/index.ts +2 -1
  725. package/src/mcp/agentdb-mcp-server.ts +544 -38
  726. package/src/optimizations/BatchOperations.ts +270 -0
  727. package/src/optimizations/ToolCache.ts +355 -0
  728. package/src/security/input-validation.ts +166 -0
  729. package/src/security/limits.ts +375 -0
  730. package/src/security/path-security.ts +436 -0
  731. package/src/security/validation.ts +556 -0
  732. package/src/services/LLMRouter.ts +406 -0
  733. package/src/types/xenova-transformers.d.ts +26 -0
  734. package/src/utils/NodeIdMapper.ts +64 -0
@@ -17,7 +17,8 @@ import { LearningSystem } from '../controllers/LearningSystem.js';
17
17
  import { EmbeddingService } from '../controllers/EmbeddingService.js';
18
18
  import { BatchOperations } from '../optimizations/BatchOperations.js';
19
19
  import { ReasoningBank } from '../controllers/ReasoningBank.js';
20
- import { validateId, validateTimestamp, validateSessionId, ValidationError, handleSecurityError, } from '../security/input-validation.js';
20
+ import { MCPToolCaches } from '../optimizations/ToolCache.js';
21
+ import { validateId, validateTimestamp, validateSessionId, validateTaskString, validateNumericRange, validateArrayLength, validateBoolean, validateEnum, ValidationError, handleSecurityError, } from '../security/input-validation.js';
21
22
  import * as path from 'path';
22
23
  import * as fs from 'fs';
23
24
  import { fileURLToPath } from 'url';
@@ -230,6 +231,7 @@ const learner = new NightlyLearner(db, embeddingService);
230
231
  const learningSystem = new LearningSystem(db, embeddingService);
231
232
  const batchOps = new BatchOperations(db, embeddingService);
232
233
  const reasoningBank = new ReasoningBank(db, embeddingService);
234
+ const caches = new MCPToolCaches();
233
235
  // ============================================================================
234
236
  // MCP Server Setup
235
237
  // ============================================================================
@@ -711,6 +713,122 @@ const tools = [
711
713
  },
712
714
  },
713
715
  },
716
+ // ==========================================================================
717
+ // BATCH OPERATION TOOLS (v2.0 MCP Optimization - Phase 2)
718
+ // ==========================================================================
719
+ {
720
+ name: 'skill_create_batch',
721
+ description: 'Batch create multiple skills efficiently using transactions and parallel embedding generation. 3x faster than sequential skill_create calls (304 → 900 ops/sec). šŸ”„ PARALLEL-SAFE: Can be used alongside other batch operations.',
722
+ inputSchema: {
723
+ type: 'object',
724
+ properties: {
725
+ skills: {
726
+ type: 'array',
727
+ items: {
728
+ type: 'object',
729
+ properties: {
730
+ name: { type: 'string', description: 'Skill name (unique)' },
731
+ description: { type: 'string', description: 'What the skill does' },
732
+ signature: { type: 'object', description: 'Optional function signature' },
733
+ code: { type: 'string', description: 'Skill implementation code' },
734
+ success_rate: { type: 'number', description: 'Initial success rate (0-1)', default: 0.0 },
735
+ uses: { type: 'number', description: 'Initial use count', default: 0 },
736
+ avg_reward: { type: 'number', description: 'Average reward', default: 0.0 },
737
+ avg_latency_ms: { type: 'number', description: 'Average latency', default: 0.0 },
738
+ tags: { type: 'array', items: { type: 'string' }, description: 'Tags for categorization' },
739
+ metadata: { type: 'object', description: 'Additional metadata (JSON)' },
740
+ },
741
+ required: ['name', 'description'],
742
+ },
743
+ description: 'Array of skills to create',
744
+ minItems: 1,
745
+ maxItems: 100,
746
+ },
747
+ batch_size: { type: 'number', description: 'Batch size for processing (default: 32)', default: 32 },
748
+ format: {
749
+ type: 'string',
750
+ enum: ['concise', 'detailed', 'json'],
751
+ description: 'Response format (default: concise)',
752
+ default: 'concise',
753
+ },
754
+ },
755
+ required: ['skills'],
756
+ },
757
+ },
758
+ {
759
+ name: 'reflexion_store_batch',
760
+ description: 'Batch store multiple episodes efficiently using transactions and parallel embedding generation. 3.3x faster than sequential reflexion_store calls (152 → 500 ops/sec). šŸ”„ PARALLEL-SAFE: Can be used alongside other batch operations.',
761
+ inputSchema: {
762
+ type: 'object',
763
+ properties: {
764
+ episodes: {
765
+ type: 'array',
766
+ items: {
767
+ type: 'object',
768
+ properties: {
769
+ session_id: { type: 'string', description: 'Session identifier' },
770
+ task: { type: 'string', description: 'Task description' },
771
+ reward: { type: 'number', description: 'Task reward (0-1)' },
772
+ success: { type: 'boolean', description: 'Whether task succeeded' },
773
+ critique: { type: 'string', description: 'Self-critique reflection' },
774
+ input: { type: 'string', description: 'Task input' },
775
+ output: { type: 'string', description: 'Task output' },
776
+ latency_ms: { type: 'number', description: 'Execution latency' },
777
+ tokens: { type: 'number', description: 'Tokens used' },
778
+ tags: { type: 'array', items: { type: 'string' }, description: 'Tags' },
779
+ metadata: { type: 'object', description: 'Additional metadata' },
780
+ },
781
+ required: ['session_id', 'task', 'reward', 'success'],
782
+ },
783
+ description: 'Array of episodes to store',
784
+ minItems: 1,
785
+ maxItems: 1000,
786
+ },
787
+ batch_size: { type: 'number', description: 'Batch size for processing (default: 100)', default: 100 },
788
+ format: {
789
+ type: 'string',
790
+ enum: ['concise', 'detailed', 'json'],
791
+ description: 'Response format (default: concise)',
792
+ default: 'concise',
793
+ },
794
+ },
795
+ required: ['episodes'],
796
+ },
797
+ },
798
+ {
799
+ name: 'agentdb_pattern_store_batch',
800
+ description: 'Batch store multiple reasoning patterns efficiently using transactions and parallel embedding generation. 4x faster than sequential agentdb_pattern_store calls. šŸ”„ PARALLEL-SAFE: Can be used alongside other batch operations.',
801
+ inputSchema: {
802
+ type: 'object',
803
+ properties: {
804
+ patterns: {
805
+ type: 'array',
806
+ items: {
807
+ type: 'object',
808
+ properties: {
809
+ taskType: { type: 'string', description: 'Type of task (e.g., "code_review", "data_analysis")' },
810
+ approach: { type: 'string', description: 'Description of the reasoning approach' },
811
+ successRate: { type: 'number', description: 'Success rate (0-1)' },
812
+ tags: { type: 'array', items: { type: 'string' }, description: 'Optional tags' },
813
+ metadata: { type: 'object', description: 'Additional metadata' },
814
+ },
815
+ required: ['taskType', 'approach', 'successRate'],
816
+ },
817
+ description: 'Array of reasoning patterns to store',
818
+ minItems: 1,
819
+ maxItems: 500,
820
+ },
821
+ batch_size: { type: 'number', description: 'Batch size for processing (default: 50)', default: 50 },
822
+ format: {
823
+ type: 'string',
824
+ enum: ['concise', 'detailed', 'json'],
825
+ description: 'Response format (default: concise)',
826
+ default: 'concise',
827
+ },
828
+ },
829
+ required: ['patterns'],
830
+ },
831
+ },
714
832
  ];
715
833
  // ============================================================================
716
834
  // Tool Handlers
@@ -1103,6 +1221,19 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1103
1221
  // ======================================================================
1104
1222
  case 'agentdb_stats': {
1105
1223
  const detailed = args?.detailed || false;
1224
+ // Check cache first (60s TTL)
1225
+ const cacheKey = `stats:${detailed ? 'detailed' : 'summary'}`;
1226
+ const cached = caches.stats.get(cacheKey);
1227
+ if (cached) {
1228
+ return {
1229
+ content: [
1230
+ {
1231
+ type: 'text',
1232
+ text: `${cached}\n\n⚔ (cached)`,
1233
+ },
1234
+ ],
1235
+ };
1236
+ }
1106
1237
  // Helper to safely query table count
1107
1238
  const safeCount = (tableName) => {
1108
1239
  try {
@@ -1154,6 +1285,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1154
1285
  ` Database Size: ${totalMB} MB\n` +
1155
1286
  ` Recent Activity (7d): ${recentActivity.count} episodes\n`;
1156
1287
  }
1288
+ // Cache the result (60s TTL)
1289
+ caches.stats.set(cacheKey, output);
1157
1290
  return {
1158
1291
  content: [
1159
1292
  {
@@ -1228,32 +1361,57 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1228
1361
  };
1229
1362
  }
1230
1363
  case 'agentdb_pattern_stats': {
1364
+ // Check cache first (60s TTL)
1365
+ const cacheKey = 'pattern_stats';
1366
+ const cached = caches.stats.get(cacheKey);
1367
+ if (cached) {
1368
+ return {
1369
+ content: [
1370
+ {
1371
+ type: 'text',
1372
+ text: `${cached}\n\n⚔ (cached)`,
1373
+ },
1374
+ ],
1375
+ };
1376
+ }
1231
1377
  const stats = reasoningBank.getPatternStats();
1378
+ const output = `šŸ“Š Reasoning Pattern Statistics\n\n` +
1379
+ `šŸ“ˆ Overview:\n` +
1380
+ ` Total Patterns: ${stats.totalPatterns}\n` +
1381
+ ` Avg Success Rate: ${(stats.avgSuccessRate * 100).toFixed(1)}%\n` +
1382
+ ` Avg Uses per Pattern: ${stats.avgUses.toFixed(1)}\n` +
1383
+ ` High Performing (≄80%): ${stats.highPerformingPatterns}\n` +
1384
+ ` Recent (7 days): ${stats.recentPatterns}\n\n` +
1385
+ `šŸ† Top Task Types:\n` +
1386
+ stats.topTaskTypes.slice(0, 10).map((tt, i) => ` ${i + 1}. ${tt.taskType}: ${tt.count} patterns`).join('\n') +
1387
+ (stats.topTaskTypes.length === 0 ? ' No patterns stored yet' : '');
1388
+ // Cache the result (60s TTL)
1389
+ caches.stats.set(cacheKey, output);
1232
1390
  return {
1233
1391
  content: [
1234
1392
  {
1235
1393
  type: 'text',
1236
- text: `šŸ“Š Reasoning Pattern Statistics\n\n` +
1237
- `šŸ“ˆ Overview:\n` +
1238
- ` Total Patterns: ${stats.totalPatterns}\n` +
1239
- ` Avg Success Rate: ${(stats.avgSuccessRate * 100).toFixed(1)}%\n` +
1240
- ` Avg Uses per Pattern: ${stats.avgUses.toFixed(1)}\n` +
1241
- ` High Performing (≄80%): ${stats.highPerformingPatterns}\n` +
1242
- ` Recent (7 days): ${stats.recentPatterns}\n\n` +
1243
- `šŸ† Top Task Types:\n` +
1244
- stats.topTaskTypes.slice(0, 10).map((tt, i) => ` ${i + 1}. ${tt.taskType}: ${tt.count} patterns`).join('\n') +
1245
- (stats.topTaskTypes.length === 0 ? ' No patterns stored yet' : ''),
1394
+ text: output,
1246
1395
  },
1247
1396
  ],
1248
1397
  };
1249
1398
  }
1250
1399
  case 'agentdb_clear_cache': {
1251
1400
  const cacheType = args?.cache_type || 'all';
1401
+ let cleared = 0;
1252
1402
  switch (cacheType) {
1253
1403
  case 'patterns':
1404
+ cleared += caches.patterns.clear();
1405
+ reasoningBank.clearCache();
1406
+ break;
1254
1407
  case 'stats':
1408
+ cleared += caches.stats.clear();
1409
+ cleared += caches.metrics.clear();
1410
+ break;
1255
1411
  case 'all':
1412
+ caches.clearAll();
1256
1413
  reasoningBank.clearCache();
1414
+ cleared = -1; // All cleared
1257
1415
  break;
1258
1416
  }
1259
1417
  return {
@@ -1262,12 +1420,317 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1262
1420
  type: 'text',
1263
1421
  text: `āœ… Cache cleared successfully!\n\n` +
1264
1422
  `🧹 Cache Type: ${cacheType}\n` +
1265
- `ā™»ļø Statistics and search results will be refreshed on next query`,
1423
+ `ā™»ļø ${cleared === -1 ? 'All caches' : `${cleared} cache entries`} cleared\n` +
1424
+ `šŸ“Š Statistics and search results will be refreshed on next query`,
1266
1425
  },
1267
1426
  ],
1268
1427
  };
1269
1428
  }
1270
1429
  // ======================================================================
1430
+ // BATCH OPERATION TOOLS (v2.0 MCP Optimization - Phase 2)
1431
+ // ======================================================================
1432
+ case 'skill_create_batch': {
1433
+ try {
1434
+ // Validate inputs
1435
+ const skillsArray = validateArrayLength(args?.skills, 'skills', 1, 100);
1436
+ const batchSize = args?.batch_size ? validateNumericRange(args.batch_size, 'batch_size', 1, 100) : 32;
1437
+ const format = args?.format ? validateEnum(args.format, 'format', ['concise', 'detailed', 'json']) : 'concise';
1438
+ // Validate each skill
1439
+ const validatedSkills = skillsArray.map((skill, index) => {
1440
+ const name = validateTaskString(skill.name, `skills[${index}].name`);
1441
+ const description = validateTaskString(skill.description, `skills[${index}].description`);
1442
+ const successRate = skill.success_rate !== undefined
1443
+ ? validateNumericRange(skill.success_rate, `skills[${index}].success_rate`, 0, 1)
1444
+ : 0.0;
1445
+ return {
1446
+ name,
1447
+ description,
1448
+ signature: skill.signature || { inputs: {}, outputs: {} },
1449
+ code: skill.code || '',
1450
+ successRate,
1451
+ uses: skill.uses || 0,
1452
+ avgReward: skill.avg_reward || 0.0,
1453
+ avgLatencyMs: skill.avg_latency_ms || 0.0,
1454
+ tags: skill.tags || [],
1455
+ metadata: skill.metadata || {},
1456
+ };
1457
+ });
1458
+ // Use BatchOperations for efficient insertion
1459
+ const startTime = Date.now();
1460
+ const batchOpsConfig = new BatchOperations(db, embeddingService, {
1461
+ batchSize,
1462
+ parallelism: 4,
1463
+ });
1464
+ const skillIds = await batchOpsConfig.insertSkills(validatedSkills);
1465
+ const duration = Date.now() - startTime;
1466
+ // Format response
1467
+ if (format === 'json') {
1468
+ return {
1469
+ content: [
1470
+ {
1471
+ type: 'text',
1472
+ text: JSON.stringify({
1473
+ success: true,
1474
+ inserted: skillIds.length,
1475
+ skill_ids: skillIds,
1476
+ duration_ms: duration,
1477
+ batch_size: batchSize,
1478
+ }, null, 2),
1479
+ },
1480
+ ],
1481
+ };
1482
+ }
1483
+ else if (format === 'detailed') {
1484
+ return {
1485
+ content: [
1486
+ {
1487
+ type: 'text',
1488
+ text: `āœ… Batch skill creation completed!\n\n` +
1489
+ `šŸ“Š Performance:\n` +
1490
+ ` • Skills Created: ${skillIds.length}\n` +
1491
+ ` • Duration: ${duration}ms\n` +
1492
+ ` • Throughput: ${(skillIds.length / (duration / 1000)).toFixed(1)} skills/sec\n` +
1493
+ ` • Batch Size: ${batchSize}\n` +
1494
+ ` • Parallelism: 4 workers\n\n` +
1495
+ `šŸ†” Created Skill IDs:\n` +
1496
+ skillIds.slice(0, 10).map((id, i) => ` ${i + 1}. Skill #${id}: ${validatedSkills[i].name}`).join('\n') +
1497
+ (skillIds.length > 10 ? `\n ... and ${skillIds.length - 10} more skills` : '') +
1498
+ `\n\n🧠 All embeddings generated in parallel\n` +
1499
+ `šŸ’¾ Transaction committed successfully`,
1500
+ },
1501
+ ],
1502
+ };
1503
+ }
1504
+ else {
1505
+ // Concise format (default)
1506
+ return {
1507
+ content: [
1508
+ {
1509
+ type: 'text',
1510
+ text: `āœ… Created ${skillIds.length} skills in ${duration}ms (${(skillIds.length / (duration / 1000)).toFixed(1)} skills/sec)`,
1511
+ },
1512
+ ],
1513
+ };
1514
+ }
1515
+ }
1516
+ catch (error) {
1517
+ const safeMessage = handleSecurityError(error);
1518
+ return {
1519
+ content: [
1520
+ {
1521
+ type: 'text',
1522
+ text: `āŒ Batch skill creation failed: ${safeMessage}\n\n` +
1523
+ `šŸ’” Troubleshooting:\n` +
1524
+ ` • Ensure all skills have unique names\n` +
1525
+ ` • Verify success_rate is between 0 and 1\n` +
1526
+ ` • Check that skills array has 1-100 items\n` +
1527
+ ` • Ensure descriptions are not empty`,
1528
+ },
1529
+ ],
1530
+ isError: true,
1531
+ };
1532
+ }
1533
+ }
1534
+ case 'reflexion_store_batch': {
1535
+ try {
1536
+ // Validate inputs
1537
+ const episodesArray = validateArrayLength(args?.episodes, 'episodes', 1, 1000);
1538
+ const batchSize = args?.batch_size ? validateNumericRange(args.batch_size, 'batch_size', 1, 1000) : 100;
1539
+ const format = args?.format ? validateEnum(args.format, 'format', ['concise', 'detailed', 'json']) : 'concise';
1540
+ // Validate each episode
1541
+ const validatedEpisodes = episodesArray.map((ep, index) => {
1542
+ const sessionId = validateSessionId(ep.session_id);
1543
+ const task = validateTaskString(ep.task, `episodes[${index}].task`);
1544
+ const reward = validateNumericRange(ep.reward, `episodes[${index}].reward`, 0, 1);
1545
+ const success = validateBoolean(ep.success, `episodes[${index}].success`);
1546
+ return {
1547
+ sessionId,
1548
+ task,
1549
+ reward,
1550
+ success,
1551
+ critique: ep.critique || '',
1552
+ input: ep.input || '',
1553
+ output: ep.output || '',
1554
+ latencyMs: ep.latency_ms || 0,
1555
+ tokensUsed: ep.tokens || 0,
1556
+ tags: ep.tags || [],
1557
+ metadata: ep.metadata || {},
1558
+ };
1559
+ });
1560
+ // Use BatchOperations for efficient insertion
1561
+ const startTime = Date.now();
1562
+ const batchOpsConfig = new BatchOperations(db, embeddingService, {
1563
+ batchSize,
1564
+ parallelism: 4,
1565
+ });
1566
+ const insertedCount = await batchOpsConfig.insertEpisodes(validatedEpisodes);
1567
+ const duration = Date.now() - startTime;
1568
+ // Format response
1569
+ if (format === 'json') {
1570
+ return {
1571
+ content: [
1572
+ {
1573
+ type: 'text',
1574
+ text: JSON.stringify({
1575
+ success: true,
1576
+ inserted: insertedCount,
1577
+ duration_ms: duration,
1578
+ batch_size: batchSize,
1579
+ }, null, 2),
1580
+ },
1581
+ ],
1582
+ };
1583
+ }
1584
+ else if (format === 'detailed') {
1585
+ return {
1586
+ content: [
1587
+ {
1588
+ type: 'text',
1589
+ text: `āœ… Batch episode storage completed!\n\n` +
1590
+ `šŸ“Š Performance:\n` +
1591
+ ` • Episodes Stored: ${insertedCount}\n` +
1592
+ ` • Duration: ${duration}ms\n` +
1593
+ ` • Throughput: ${(insertedCount / (duration / 1000)).toFixed(1)} episodes/sec\n` +
1594
+ ` • Batch Size: ${batchSize}\n` +
1595
+ ` • Parallelism: 4 workers\n\n` +
1596
+ `šŸ“ˆ Statistics:\n` +
1597
+ ` • Sessions: ${new Set(validatedEpisodes.map(e => e.sessionId)).size}\n` +
1598
+ ` • Success Rate: ${(validatedEpisodes.filter(e => e.success).length / validatedEpisodes.length * 100).toFixed(1)}%\n` +
1599
+ ` • Avg Reward: ${(validatedEpisodes.reduce((sum, e) => sum + e.reward, 0) / validatedEpisodes.length).toFixed(3)}\n\n` +
1600
+ `🧠 All embeddings generated in parallel\n` +
1601
+ `šŸ’¾ Transaction committed successfully`,
1602
+ },
1603
+ ],
1604
+ };
1605
+ }
1606
+ else {
1607
+ // Concise format (default)
1608
+ return {
1609
+ content: [
1610
+ {
1611
+ type: 'text',
1612
+ text: `āœ… Stored ${insertedCount} episodes in ${duration}ms (${(insertedCount / (duration / 1000)).toFixed(1)} episodes/sec)`,
1613
+ },
1614
+ ],
1615
+ };
1616
+ }
1617
+ }
1618
+ catch (error) {
1619
+ const safeMessage = handleSecurityError(error);
1620
+ return {
1621
+ content: [
1622
+ {
1623
+ type: 'text',
1624
+ text: `āŒ Batch episode storage failed: ${safeMessage}\n\n` +
1625
+ `šŸ’” Troubleshooting:\n` +
1626
+ ` • Ensure all session_ids are valid (alphanumeric, hyphens, underscores)\n` +
1627
+ ` • Verify rewards are between 0 and 1\n` +
1628
+ ` • Check that episodes array has 1-1000 items\n` +
1629
+ ` • Ensure tasks are not empty or excessively long`,
1630
+ },
1631
+ ],
1632
+ isError: true,
1633
+ };
1634
+ }
1635
+ }
1636
+ case 'agentdb_pattern_store_batch': {
1637
+ try {
1638
+ // Validate inputs
1639
+ const patternsArray = validateArrayLength(args?.patterns, 'patterns', 1, 500);
1640
+ const batchSize = args?.batch_size ? validateNumericRange(args.batch_size, 'batch_size', 1, 500) : 50;
1641
+ const format = args?.format ? validateEnum(args.format, 'format', ['concise', 'detailed', 'json']) : 'concise';
1642
+ // Validate each pattern
1643
+ const validatedPatterns = patternsArray.map((pattern, index) => {
1644
+ const taskType = validateTaskString(pattern.taskType, `patterns[${index}].taskType`);
1645
+ const approach = validateTaskString(pattern.approach, `patterns[${index}].approach`);
1646
+ const successRate = validateNumericRange(pattern.successRate, `patterns[${index}].successRate`, 0, 1);
1647
+ return {
1648
+ taskType,
1649
+ approach,
1650
+ successRate,
1651
+ tags: pattern.tags || [],
1652
+ metadata: pattern.metadata || {},
1653
+ };
1654
+ });
1655
+ // Use BatchOperations for efficient insertion
1656
+ const startTime = Date.now();
1657
+ const batchOpsConfig = new BatchOperations(db, embeddingService, {
1658
+ batchSize,
1659
+ parallelism: 4,
1660
+ });
1661
+ const patternIds = await batchOpsConfig.insertPatterns(validatedPatterns);
1662
+ const duration = Date.now() - startTime;
1663
+ // Format response
1664
+ if (format === 'json') {
1665
+ return {
1666
+ content: [
1667
+ {
1668
+ type: 'text',
1669
+ text: JSON.stringify({
1670
+ success: true,
1671
+ inserted: patternIds.length,
1672
+ pattern_ids: patternIds,
1673
+ duration_ms: duration,
1674
+ batch_size: batchSize,
1675
+ }, null, 2),
1676
+ },
1677
+ ],
1678
+ };
1679
+ }
1680
+ else if (format === 'detailed') {
1681
+ return {
1682
+ content: [
1683
+ {
1684
+ type: 'text',
1685
+ text: `āœ… Batch pattern storage completed!\n\n` +
1686
+ `šŸ“Š Performance:\n` +
1687
+ ` • Patterns Stored: ${patternIds.length}\n` +
1688
+ ` • Duration: ${duration}ms\n` +
1689
+ ` • Throughput: ${(patternIds.length / (duration / 1000)).toFixed(1)} patterns/sec\n` +
1690
+ ` • Batch Size: ${batchSize}\n` +
1691
+ ` • Parallelism: 4 workers\n\n` +
1692
+ `šŸ“ˆ Statistics:\n` +
1693
+ ` • Task Types: ${new Set(validatedPatterns.map(p => p.taskType)).size}\n` +
1694
+ ` • Avg Success Rate: ${(validatedPatterns.reduce((sum, p) => sum + p.successRate, 0) / validatedPatterns.length * 100).toFixed(1)}%\n` +
1695
+ ` • High Performing (≄80%): ${validatedPatterns.filter(p => p.successRate >= 0.8).length}\n\n` +
1696
+ `šŸ†” Sample Pattern IDs: ${patternIds.slice(0, 5).join(', ')}${patternIds.length > 5 ? '...' : ''}\n` +
1697
+ `🧠 All embeddings generated in parallel\n` +
1698
+ `šŸ’¾ Transaction committed successfully`,
1699
+ },
1700
+ ],
1701
+ };
1702
+ }
1703
+ else {
1704
+ // Concise format (default)
1705
+ return {
1706
+ content: [
1707
+ {
1708
+ type: 'text',
1709
+ text: `āœ… Stored ${patternIds.length} patterns in ${duration}ms (${(patternIds.length / (duration / 1000)).toFixed(1)} patterns/sec)`,
1710
+ },
1711
+ ],
1712
+ };
1713
+ }
1714
+ }
1715
+ catch (error) {
1716
+ const safeMessage = handleSecurityError(error);
1717
+ return {
1718
+ content: [
1719
+ {
1720
+ type: 'text',
1721
+ text: `āŒ Batch pattern storage failed: ${safeMessage}\n\n` +
1722
+ `šŸ’” Troubleshooting:\n` +
1723
+ ` • Ensure taskType and approach are not empty\n` +
1724
+ ` • Verify successRate is between 0 and 1\n` +
1725
+ ` • Check that patterns array has 1-500 items\n` +
1726
+ ` • Avoid excessively long task types or approaches`,
1727
+ },
1728
+ ],
1729
+ isError: true,
1730
+ };
1731
+ }
1732
+ }
1733
+ // ======================================================================
1271
1734
  // LEARNING SYSTEM TOOLS (Tools 1-5)
1272
1735
  // ======================================================================
1273
1736
  case 'learning_start_session': {
@@ -1397,33 +1860,49 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1397
1860
  const timeWindowDays = args?.time_window_days || 7;
1398
1861
  const includeTrends = args?.include_trends !== false;
1399
1862
  const groupBy = args?.group_by || 'task';
1863
+ // Check cache first (120s TTL for expensive computations)
1864
+ const cacheKey = `metrics:${sessionId || 'all'}:${timeWindowDays}:${groupBy}:${includeTrends}`;
1865
+ const cached = caches.metrics.get(cacheKey);
1866
+ if (cached) {
1867
+ return {
1868
+ content: [
1869
+ {
1870
+ type: 'text',
1871
+ text: `${cached}\n\n⚔ (cached)`,
1872
+ },
1873
+ ],
1874
+ };
1875
+ }
1400
1876
  const metrics = await learningSystem.getMetrics({
1401
1877
  sessionId,
1402
1878
  timeWindowDays,
1403
1879
  includeTrends,
1404
1880
  groupBy,
1405
1881
  });
1882
+ const output = `šŸ“Š Learning Performance Metrics\n\n` +
1883
+ `ā±ļø Time Window: ${timeWindowDays} days\n\n` +
1884
+ `šŸ“ˆ Overall Performance:\n` +
1885
+ ` • Total Episodes: ${metrics.overall.totalEpisodes}\n` +
1886
+ ` • Success Rate: ${(metrics.overall.successRate * 100).toFixed(1)}%\n` +
1887
+ ` • Avg Reward: ${metrics.overall.avgReward.toFixed(3)}\n` +
1888
+ ` • Reward Range: [${metrics.overall.minReward.toFixed(2)}, ${metrics.overall.maxReward.toFixed(2)}]\n` +
1889
+ ` • Avg Latency: ${metrics.overall.avgLatencyMs.toFixed(0)}ms\n\n` +
1890
+ `šŸŽÆ Top ${groupBy.charAt(0).toUpperCase() + groupBy.slice(1)}s:\n` +
1891
+ metrics.groupedMetrics.slice(0, 5).map((g, i) => ` ${i + 1}. ${g.key.substring(0, 40)}${g.key.length > 40 ? '...' : ''}\n` +
1892
+ ` Count: ${g.count}, Success: ${(g.successRate * 100).toFixed(1)}%, Reward: ${g.avgReward.toFixed(2)}`).join('\n') +
1893
+ (metrics.groupedMetrics.length === 0 ? ' No data available' : '') +
1894
+ (includeTrends && metrics.trends.length > 0 ? `\n\nšŸ“‰ Recent Trends (last ${Math.min(7, metrics.trends.length)} days):\n` +
1895
+ metrics.trends.slice(-7).map((t) => ` ${t.date}: ${t.count} episodes, ${(t.successRate * 100).toFixed(1)}% success`).join('\n') : '') +
1896
+ (metrics.policyImprovement.versions > 0 ? `\n\n🧠 Policy Improvement:\n` +
1897
+ ` • Versions: ${metrics.policyImprovement.versions}\n` +
1898
+ ` • Q-Value Improvement: ${metrics.policyImprovement.qValueImprovement >= 0 ? '+' : ''}${metrics.policyImprovement.qValueImprovement.toFixed(3)}` : '');
1899
+ // Cache the result (120s TTL)
1900
+ caches.metrics.set(cacheKey, output);
1406
1901
  return {
1407
1902
  content: [
1408
1903
  {
1409
1904
  type: 'text',
1410
- text: `šŸ“Š Learning Performance Metrics\n\n` +
1411
- `ā±ļø Time Window: ${timeWindowDays} days\n\n` +
1412
- `šŸ“ˆ Overall Performance:\n` +
1413
- ` • Total Episodes: ${metrics.overall.totalEpisodes}\n` +
1414
- ` • Success Rate: ${(metrics.overall.successRate * 100).toFixed(1)}%\n` +
1415
- ` • Avg Reward: ${metrics.overall.avgReward.toFixed(3)}\n` +
1416
- ` • Reward Range: [${metrics.overall.minReward.toFixed(2)}, ${metrics.overall.maxReward.toFixed(2)}]\n` +
1417
- ` • Avg Latency: ${metrics.overall.avgLatencyMs.toFixed(0)}ms\n\n` +
1418
- `šŸŽÆ Top ${groupBy.charAt(0).toUpperCase() + groupBy.slice(1)}s:\n` +
1419
- metrics.groupedMetrics.slice(0, 5).map((g, i) => ` ${i + 1}. ${g.key.substring(0, 40)}${g.key.length > 40 ? '...' : ''}\n` +
1420
- ` Count: ${g.count}, Success: ${(g.successRate * 100).toFixed(1)}%, Reward: ${g.avgReward.toFixed(2)}`).join('\n') +
1421
- (metrics.groupedMetrics.length === 0 ? ' No data available' : '') +
1422
- (includeTrends && metrics.trends.length > 0 ? `\n\nšŸ“‰ Recent Trends (last ${Math.min(7, metrics.trends.length)} days):\n` +
1423
- metrics.trends.slice(-7).map((t) => ` ${t.date}: ${t.count} episodes, ${(t.successRate * 100).toFixed(1)}% success`).join('\n') : '') +
1424
- (metrics.policyImprovement.versions > 0 ? `\n\n🧠 Policy Improvement:\n` +
1425
- ` • Versions: ${metrics.policyImprovement.versions}\n` +
1426
- ` • Q-Value Improvement: ${metrics.policyImprovement.qValueImprovement >= 0 ? '+' : ''}${metrics.policyImprovement.qValueImprovement.toFixed(3)}` : ''),
1905
+ text: output,
1427
1906
  },
1428
1907
  ],
1429
1908
  };
@@ -1607,12 +2086,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1607
2086
  async function main() {
1608
2087
  const transport = new StdioServerTransport();
1609
2088
  await server.connect(transport);
1610
- console.error('šŸš€ AgentDB MCP Server v1.3.0 running on stdio');
1611
- console.error('šŸ“¦ 29 tools available (5 core vector DB + 9 frontier + 10 learning + 5 AgentDB tools)');
2089
+ console.error('šŸš€ AgentDB MCP Server v2.0.0 running on stdio');
2090
+ console.error('šŸ“¦ 32 tools available (5 core + 9 frontier + 10 learning + 5 AgentDB + 3 batch ops)');
1612
2091
  console.error('🧠 Embedding service initialized');
1613
2092
  console.error('šŸŽ“ Learning system ready (9 RL algorithms)');
1614
- console.error('✨ New learning tools: metrics, transfer, explain, experience_record, reward_signal');
1615
- console.error('šŸ”¬ Extended features: transfer learning, XAI explanations, reward shaping');
2093
+ console.error('⚔ NEW v2.0: Batch operations (3-4x faster), format parameters, enhanced validation');
2094
+ console.error('šŸ”¬ Features: transfer learning, XAI explanations, reward shaping, intelligent caching');
1616
2095
  // Keep the process alive - the StdioServerTransport handles stdin/stdout
1617
2096
  // but we need to ensure Node.js doesn't exit when main() completes
1618
2097
  // Use setInterval to keep event loop alive (like many MCP servers do)