agentdb 1.0.11 → 1.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 (503) hide show
  1. package/README.md +196 -838
  2. package/dist/benchmarks/comprehensive-benchmark.js +664 -0
  3. package/dist/benchmarks/frontier-benchmark.js +419 -0
  4. package/dist/benchmarks/reflexion-benchmark.js +370 -0
  5. package/dist/cli/agentdb-cli.d.ts +117 -0
  6. package/dist/cli/agentdb-cli.d.ts.map +1 -0
  7. package/dist/cli/agentdb-cli.js +718 -0
  8. package/dist/cli/agentdb-cli.js.map +1 -0
  9. package/dist/controllers/CausalMemoryGraph.d.ts +125 -0
  10. package/dist/controllers/CausalMemoryGraph.d.ts.map +1 -0
  11. package/dist/controllers/CausalMemoryGraph.js +323 -0
  12. package/dist/controllers/CausalMemoryGraph.js.map +1 -0
  13. package/dist/controllers/CausalRecall.d.ts +111 -0
  14. package/dist/controllers/CausalRecall.d.ts.map +1 -0
  15. package/dist/controllers/CausalRecall.js +282 -0
  16. package/dist/controllers/CausalRecall.js.map +1 -0
  17. package/dist/controllers/EmbeddingService.d.ts +37 -0
  18. package/dist/controllers/EmbeddingService.d.ts.map +1 -0
  19. package/dist/controllers/EmbeddingService.js +119 -0
  20. package/dist/controllers/EmbeddingService.js.map +1 -0
  21. package/dist/controllers/ExplainableRecall.d.ts +138 -0
  22. package/dist/controllers/ExplainableRecall.d.ts.map +1 -0
  23. package/dist/controllers/ExplainableRecall.js +388 -0
  24. package/dist/controllers/ExplainableRecall.js.map +1 -0
  25. package/dist/controllers/NightlyLearner.d.ts +113 -0
  26. package/dist/controllers/NightlyLearner.d.ts.map +1 -0
  27. package/dist/controllers/NightlyLearner.js +383 -0
  28. package/dist/controllers/NightlyLearner.js.map +1 -0
  29. package/dist/controllers/ReflexionMemory.d.ts +84 -0
  30. package/dist/controllers/ReflexionMemory.d.ts.map +1 -0
  31. package/dist/controllers/ReflexionMemory.js +240 -0
  32. package/dist/controllers/ReflexionMemory.js.map +1 -0
  33. package/dist/controllers/SkillLibrary.d.ts +96 -0
  34. package/dist/controllers/SkillLibrary.d.ts.map +1 -0
  35. package/dist/controllers/SkillLibrary.js +277 -0
  36. package/dist/controllers/SkillLibrary.js.map +1 -0
  37. package/dist/controllers/frontier-index.d.ts +14 -0
  38. package/dist/controllers/frontier-index.d.ts.map +1 -0
  39. package/dist/controllers/frontier-index.js +10 -0
  40. package/dist/controllers/frontier-index.js.map +1 -0
  41. package/dist/controllers/index.d.ts +12 -0
  42. package/dist/controllers/index.d.ts.map +1 -0
  43. package/dist/controllers/index.js +9 -0
  44. package/dist/controllers/index.js.map +1 -0
  45. package/dist/optimizations/BatchOperations.d.ts +61 -0
  46. package/dist/optimizations/BatchOperations.d.ts.map +1 -0
  47. package/dist/optimizations/BatchOperations.js +199 -0
  48. package/dist/optimizations/BatchOperations.js.map +1 -0
  49. package/dist/optimizations/QueryOptimizer.d.ts +82 -0
  50. package/dist/optimizations/QueryOptimizer.d.ts.map +1 -0
  51. package/dist/optimizations/QueryOptimizer.js +226 -0
  52. package/dist/optimizations/QueryOptimizer.js.map +1 -0
  53. package/dist/optimizations/index.d.ts +10 -0
  54. package/dist/optimizations/index.d.ts.map +1 -0
  55. package/dist/optimizations/index.js +8 -0
  56. package/dist/optimizations/index.js.map +1 -0
  57. package/dist/schemas/frontier-schema.sql +341 -0
  58. package/dist/schemas/schema.sql +382 -0
  59. package/dist/tests/frontier-features.test.js +665 -0
  60. package/package.json +54 -117
  61. package/src/cli/agentdb-cli.ts +861 -0
  62. package/src/cli/examples.sh +83 -0
  63. package/src/controllers/CausalMemoryGraph.ts +504 -0
  64. package/src/controllers/CausalRecall.ts +395 -0
  65. package/src/controllers/EmbeddingService.ts +141 -0
  66. package/src/controllers/ExplainableRecall.ts +577 -0
  67. package/src/controllers/NightlyLearner.ts +475 -0
  68. package/src/controllers/ReflexionMemory.ts +349 -0
  69. package/src/controllers/SkillLibrary.ts +391 -0
  70. package/src/controllers/frontier-index.ts +35 -0
  71. package/src/controllers/index.ts +13 -0
  72. package/src/optimizations/BatchOperations.ts +292 -0
  73. package/src/optimizations/QueryOptimizer.ts +294 -0
  74. package/src/optimizations/index.ts +11 -0
  75. package/src/schemas/frontier-schema.sql +341 -0
  76. package/src/schemas/schema.sql +382 -0
  77. package/CHANGELOG.md +0 -166
  78. package/LICENSE +0 -38
  79. package/LICENSE-APACHE +0 -190
  80. package/LICENSE-MIT +0 -21
  81. package/bin/agentdb.js +0 -733
  82. package/bin/benchmark.js +0 -162
  83. package/bin/plugin-cli-wrapper.mjs +0 -21
  84. package/dist/agentdb.js +0 -5352
  85. package/dist/agentdb.js.map +0 -7
  86. package/dist/agentdb.min.js +0 -143
  87. package/dist/agentdb.min.js.map +0 -7
  88. package/dist/cache/query-cache.d.ts +0 -105
  89. package/dist/cache/query-cache.d.ts.map +0 -1
  90. package/dist/cache/query-cache.js +0 -224
  91. package/dist/cache/query-cache.js.map +0 -1
  92. package/dist/cache/query-cache.mjs +0 -219
  93. package/dist/cli/cache/query-cache.d.ts +0 -104
  94. package/dist/cli/cache/query-cache.js +0 -244
  95. package/dist/cli/cli/db-commands.d.ts +0 -48
  96. package/dist/cli/cli/db-commands.js +0 -613
  97. package/dist/cli/commands.d.ts +0 -7
  98. package/dist/cli/commands.d.ts.map +0 -1
  99. package/dist/cli/commands.js +0 -113
  100. package/dist/cli/commands.js.map +0 -1
  101. package/dist/cli/commands.mjs +0 -104
  102. package/dist/cli/core/backend-interface.d.ts +0 -70
  103. package/dist/cli/core/backend-interface.js +0 -15
  104. package/dist/cli/core/native-backend.d.ts +0 -140
  105. package/dist/cli/core/native-backend.js +0 -432
  106. package/dist/cli/core/vector-db.d.ts +0 -126
  107. package/dist/cli/core/vector-db.js +0 -338
  108. package/dist/cli/core/wasm-backend.d.ts +0 -95
  109. package/dist/cli/core/wasm-backend.js +0 -418
  110. package/dist/cli/db-commands.d.ts +0 -49
  111. package/dist/cli/db-commands.d.ts.map +0 -1
  112. package/dist/cli/db-commands.js +0 -533
  113. package/dist/cli/db-commands.js.map +0 -1
  114. package/dist/cli/db-commands.mjs +0 -522
  115. package/dist/cli/generator.d.ts +0 -11
  116. package/dist/cli/generator.d.ts.map +0 -1
  117. package/dist/cli/generator.js +0 -567
  118. package/dist/cli/generator.js.map +0 -1
  119. package/dist/cli/generator.mjs +0 -527
  120. package/dist/cli/help.d.ts +0 -18
  121. package/dist/cli/help.d.ts.map +0 -1
  122. package/dist/cli/help.js +0 -676
  123. package/dist/cli/help.js.map +0 -1
  124. package/dist/cli/help.mjs +0 -667
  125. package/dist/cli/index/hnsw.d.ts +0 -164
  126. package/dist/cli/index/hnsw.js +0 -558
  127. package/dist/cli/plugin-cli.d.ts +0 -7
  128. package/dist/cli/plugin-cli.d.ts.map +0 -1
  129. package/dist/cli/plugin-cli.js +0 -295
  130. package/dist/cli/plugin-cli.js.map +0 -1
  131. package/dist/cli/plugin-cli.mjs +0 -289
  132. package/dist/cli/quantization/product-quantization.d.ts +0 -108
  133. package/dist/cli/quantization/product-quantization.js +0 -350
  134. package/dist/cli/query/query-builder.d.ts +0 -322
  135. package/dist/cli/query/query-builder.js +0 -600
  136. package/dist/cli/templates.d.ts +0 -14
  137. package/dist/cli/templates.d.ts.map +0 -1
  138. package/dist/cli/templates.js +0 -182
  139. package/dist/cli/templates.js.map +0 -1
  140. package/dist/cli/templates.mjs +0 -176
  141. package/dist/cli/types/index.d.ts +0 -116
  142. package/dist/cli/types/index.js +0 -5
  143. package/dist/cli/types.d.ts +0 -91
  144. package/dist/cli/types.d.ts.map +0 -1
  145. package/dist/cli/types.js +0 -6
  146. package/dist/cli/types.js.map +0 -1
  147. package/dist/cli/types.mjs +0 -4
  148. package/dist/cli/wizard/index.d.ts +0 -6
  149. package/dist/cli/wizard/index.d.ts.map +0 -1
  150. package/dist/cli/wizard/index.js +0 -138
  151. package/dist/cli/wizard/index.js.map +0 -1
  152. package/dist/cli/wizard/index.mjs +0 -131
  153. package/dist/cli/wizard/prompts.d.ts +0 -11
  154. package/dist/cli/wizard/prompts.d.ts.map +0 -1
  155. package/dist/cli/wizard/prompts.js +0 -482
  156. package/dist/cli/wizard/prompts.js.map +0 -1
  157. package/dist/cli/wizard/prompts.mjs +0 -470
  158. package/dist/cli/wizard/validator.d.ts +0 -13
  159. package/dist/cli/wizard/validator.d.ts.map +0 -1
  160. package/dist/cli/wizard/validator.js +0 -234
  161. package/dist/cli/wizard/validator.js.map +0 -1
  162. package/dist/cli/wizard/validator.mjs +0 -224
  163. package/dist/core/backend-interface.d.ts +0 -71
  164. package/dist/core/backend-interface.d.ts.map +0 -1
  165. package/dist/core/backend-interface.js +0 -16
  166. package/dist/core/backend-interface.js.map +0 -1
  167. package/dist/core/backend-interface.mjs +0 -12
  168. package/dist/core/native-backend.d.ts +0 -141
  169. package/dist/core/native-backend.d.ts.map +0 -1
  170. package/dist/core/native-backend.js +0 -457
  171. package/dist/core/native-backend.js.map +0 -1
  172. package/dist/core/native-backend.mjs +0 -449
  173. package/dist/core/vector-db.d.ts +0 -127
  174. package/dist/core/vector-db.d.ts.map +0 -1
  175. package/dist/core/vector-db.js +0 -270
  176. package/dist/core/vector-db.js.map +0 -1
  177. package/dist/core/vector-db.mjs +0 -265
  178. package/dist/core/wasm-backend.d.ts +0 -96
  179. package/dist/core/wasm-backend.d.ts.map +0 -1
  180. package/dist/core/wasm-backend.js +0 -393
  181. package/dist/core/wasm-backend.js.map +0 -1
  182. package/dist/core/wasm-backend.mjs +0 -385
  183. package/dist/index/hnsw-optimized.d.ts +0 -75
  184. package/dist/index/hnsw-optimized.d.ts.map +0 -1
  185. package/dist/index/hnsw-optimized.js +0 -412
  186. package/dist/index/hnsw-optimized.js.map +0 -1
  187. package/dist/index/hnsw-optimized.mjs +0 -407
  188. package/dist/index/hnsw.d.ts +0 -165
  189. package/dist/index/hnsw.d.ts.map +0 -1
  190. package/dist/index/hnsw.js +0 -521
  191. package/dist/index/hnsw.js.map +0 -1
  192. package/dist/index/hnsw.mjs +0 -516
  193. package/dist/index.browser.d.ts +0 -47
  194. package/dist/index.browser.d.ts.map +0 -1
  195. package/dist/index.browser.js +0 -72
  196. package/dist/index.browser.js.map +0 -1
  197. package/dist/index.browser.mjs +0 -54
  198. package/dist/index.d.ts +0 -59
  199. package/dist/index.d.ts.map +0 -1
  200. package/dist/index.js +0 -84
  201. package/dist/index.js.map +0 -1
  202. package/dist/index.mjs +0 -65
  203. package/dist/mcp/learning/core/experience-buffer.d.ts +0 -61
  204. package/dist/mcp/learning/core/experience-buffer.d.ts.map +0 -1
  205. package/dist/mcp/learning/core/experience-buffer.js +0 -175
  206. package/dist/mcp/learning/core/experience-buffer.js.map +0 -1
  207. package/dist/mcp/learning/core/experience-buffer.mjs +0 -170
  208. package/dist/mcp/learning/core/experience-recorder.d.ts +0 -40
  209. package/dist/mcp/learning/core/experience-recorder.d.ts.map +0 -1
  210. package/dist/mcp/learning/core/experience-recorder.js +0 -200
  211. package/dist/mcp/learning/core/experience-recorder.js.map +0 -1
  212. package/dist/mcp/learning/core/experience-recorder.mjs +0 -195
  213. package/dist/mcp/learning/core/learning-manager.d.ts +0 -66
  214. package/dist/mcp/learning/core/learning-manager.d.ts.map +0 -1
  215. package/dist/mcp/learning/core/learning-manager.js +0 -252
  216. package/dist/mcp/learning/core/learning-manager.js.map +0 -1
  217. package/dist/mcp/learning/core/learning-manager.mjs +0 -247
  218. package/dist/mcp/learning/core/policy-optimizer.d.ts +0 -53
  219. package/dist/mcp/learning/core/policy-optimizer.d.ts.map +0 -1
  220. package/dist/mcp/learning/core/policy-optimizer.js +0 -251
  221. package/dist/mcp/learning/core/policy-optimizer.js.map +0 -1
  222. package/dist/mcp/learning/core/policy-optimizer.mjs +0 -246
  223. package/dist/mcp/learning/core/reward-estimator.d.ts +0 -44
  224. package/dist/mcp/learning/core/reward-estimator.d.ts.map +0 -1
  225. package/dist/mcp/learning/core/reward-estimator.js +0 -158
  226. package/dist/mcp/learning/core/reward-estimator.js.map +0 -1
  227. package/dist/mcp/learning/core/reward-estimator.mjs +0 -153
  228. package/dist/mcp/learning/core/session-manager.d.ts +0 -63
  229. package/dist/mcp/learning/core/session-manager.d.ts.map +0 -1
  230. package/dist/mcp/learning/core/session-manager.js +0 -202
  231. package/dist/mcp/learning/core/session-manager.js.map +0 -1
  232. package/dist/mcp/learning/core/session-manager.mjs +0 -197
  233. package/dist/mcp/learning/index.d.ts +0 -19
  234. package/dist/mcp/learning/index.d.ts.map +0 -1
  235. package/dist/mcp/learning/index.js +0 -30
  236. package/dist/mcp/learning/index.js.map +0 -1
  237. package/dist/mcp/learning/index.mjs +0 -19
  238. package/dist/mcp/learning/tools/mcp-learning-tools.d.ts +0 -369
  239. package/dist/mcp/learning/tools/mcp-learning-tools.d.ts.map +0 -1
  240. package/dist/mcp/learning/tools/mcp-learning-tools.js +0 -361
  241. package/dist/mcp/learning/tools/mcp-learning-tools.js.map +0 -1
  242. package/dist/mcp/learning/tools/mcp-learning-tools.mjs +0 -356
  243. package/dist/mcp/learning/types/index.d.ts +0 -138
  244. package/dist/mcp/learning/types/index.d.ts.map +0 -1
  245. package/dist/mcp/learning/types/index.js +0 -6
  246. package/dist/mcp/learning/types/index.js.map +0 -1
  247. package/dist/mcp/learning/types/index.mjs +0 -4
  248. package/dist/mcp-server.d.ts +0 -29
  249. package/dist/mcp-server.d.ts.map +0 -1
  250. package/dist/mcp-server.js +0 -862
  251. package/dist/mcp-server.js.map +0 -1
  252. package/dist/mcp-server.mjs +0 -857
  253. package/dist/plugins/base-plugin.d.ts +0 -114
  254. package/dist/plugins/base-plugin.d.ts.map +0 -1
  255. package/dist/plugins/base-plugin.js +0 -313
  256. package/dist/plugins/base-plugin.js.map +0 -1
  257. package/dist/plugins/base-plugin.mjs +0 -275
  258. package/dist/plugins/implementations/active-learning.d.ts +0 -135
  259. package/dist/plugins/implementations/active-learning.d.ts.map +0 -1
  260. package/dist/plugins/implementations/active-learning.js +0 -372
  261. package/dist/plugins/implementations/active-learning.js.map +0 -1
  262. package/dist/plugins/implementations/active-learning.mjs +0 -367
  263. package/dist/plugins/implementations/actor-critic.d.ts +0 -64
  264. package/dist/plugins/implementations/actor-critic.d.ts.map +0 -1
  265. package/dist/plugins/implementations/actor-critic.js +0 -363
  266. package/dist/plugins/implementations/actor-critic.js.map +0 -1
  267. package/dist/plugins/implementations/actor-critic.mjs +0 -358
  268. package/dist/plugins/implementations/adversarial-training.d.ts +0 -133
  269. package/dist/plugins/implementations/adversarial-training.d.ts.map +0 -1
  270. package/dist/plugins/implementations/adversarial-training.js +0 -409
  271. package/dist/plugins/implementations/adversarial-training.js.map +0 -1
  272. package/dist/plugins/implementations/adversarial-training.mjs +0 -404
  273. package/dist/plugins/implementations/curriculum-learning.d.ts +0 -132
  274. package/dist/plugins/implementations/curriculum-learning.d.ts.map +0 -1
  275. package/dist/plugins/implementations/curriculum-learning.js +0 -354
  276. package/dist/plugins/implementations/curriculum-learning.js.map +0 -1
  277. package/dist/plugins/implementations/curriculum-learning.mjs +0 -349
  278. package/dist/plugins/implementations/decision-transformer.d.ts +0 -77
  279. package/dist/plugins/implementations/decision-transformer.d.ts.map +0 -1
  280. package/dist/plugins/implementations/decision-transformer.js +0 -422
  281. package/dist/plugins/implementations/decision-transformer.js.map +0 -1
  282. package/dist/plugins/implementations/decision-transformer.mjs +0 -417
  283. package/dist/plugins/implementations/federated-learning.d.ts +0 -126
  284. package/dist/plugins/implementations/federated-learning.d.ts.map +0 -1
  285. package/dist/plugins/implementations/federated-learning.js +0 -436
  286. package/dist/plugins/implementations/federated-learning.js.map +0 -1
  287. package/dist/plugins/implementations/federated-learning.mjs +0 -431
  288. package/dist/plugins/implementations/index.d.ts +0 -30
  289. package/dist/plugins/implementations/index.d.ts.map +0 -1
  290. package/dist/plugins/implementations/index.js +0 -45
  291. package/dist/plugins/implementations/index.js.map +0 -1
  292. package/dist/plugins/implementations/index.mjs +0 -31
  293. package/dist/plugins/implementations/multi-task-learning.d.ts +0 -115
  294. package/dist/plugins/implementations/multi-task-learning.d.ts.map +0 -1
  295. package/dist/plugins/implementations/multi-task-learning.js +0 -369
  296. package/dist/plugins/implementations/multi-task-learning.js.map +0 -1
  297. package/dist/plugins/implementations/multi-task-learning.mjs +0 -364
  298. package/dist/plugins/implementations/neural-architecture-search.d.ts +0 -148
  299. package/dist/plugins/implementations/neural-architecture-search.d.ts.map +0 -1
  300. package/dist/plugins/implementations/neural-architecture-search.js +0 -379
  301. package/dist/plugins/implementations/neural-architecture-search.js.map +0 -1
  302. package/dist/plugins/implementations/neural-architecture-search.mjs +0 -374
  303. package/dist/plugins/implementations/q-learning.d.ts +0 -98
  304. package/dist/plugins/implementations/q-learning.d.ts.map +0 -1
  305. package/dist/plugins/implementations/q-learning.js +0 -435
  306. package/dist/plugins/implementations/q-learning.js.map +0 -1
  307. package/dist/plugins/implementations/q-learning.mjs +0 -430
  308. package/dist/plugins/implementations/sarsa.d.ts +0 -103
  309. package/dist/plugins/implementations/sarsa.d.ts.map +0 -1
  310. package/dist/plugins/implementations/sarsa.js +0 -347
  311. package/dist/plugins/implementations/sarsa.js.map +0 -1
  312. package/dist/plugins/implementations/sarsa.mjs +0 -342
  313. package/dist/plugins/index.d.ts +0 -107
  314. package/dist/plugins/index.d.ts.map +0 -1
  315. package/dist/plugins/index.js +0 -179
  316. package/dist/plugins/index.js.map +0 -1
  317. package/dist/plugins/index.mjs +0 -168
  318. package/dist/plugins/interface.d.ts +0 -439
  319. package/dist/plugins/interface.d.ts.map +0 -1
  320. package/dist/plugins/interface.js +0 -12
  321. package/dist/plugins/interface.js.map +0 -1
  322. package/dist/plugins/interface.mjs +0 -10
  323. package/dist/plugins/learning-plugin.interface.d.ts +0 -257
  324. package/dist/plugins/learning-plugin.interface.d.ts.map +0 -1
  325. package/dist/plugins/learning-plugin.interface.js +0 -7
  326. package/dist/plugins/learning-plugin.interface.js.map +0 -1
  327. package/dist/plugins/learning-plugin.interface.mjs +0 -5
  328. package/dist/plugins/plugin-exports.d.ts +0 -71
  329. package/dist/plugins/plugin-exports.d.ts.map +0 -1
  330. package/dist/plugins/plugin-exports.js +0 -78
  331. package/dist/plugins/plugin-exports.js.map +0 -1
  332. package/dist/plugins/plugin-exports.mjs +0 -69
  333. package/dist/plugins/registry.d.ts +0 -206
  334. package/dist/plugins/registry.d.ts.map +0 -1
  335. package/dist/plugins/registry.js +0 -365
  336. package/dist/plugins/registry.js.map +0 -1
  337. package/dist/plugins/registry.mjs +0 -356
  338. package/dist/plugins/validator.d.ts +0 -63
  339. package/dist/plugins/validator.d.ts.map +0 -1
  340. package/dist/plugins/validator.js +0 -464
  341. package/dist/plugins/validator.js.map +0 -1
  342. package/dist/plugins/validator.mjs +0 -458
  343. package/dist/presets.d.ts +0 -65
  344. package/dist/presets.d.ts.map +0 -1
  345. package/dist/presets.js +0 -145
  346. package/dist/presets.js.map +0 -1
  347. package/dist/presets.mjs +0 -140
  348. package/dist/quantization/binary-quantization.d.ts +0 -104
  349. package/dist/quantization/binary-quantization.d.ts.map +0 -1
  350. package/dist/quantization/binary-quantization.js +0 -246
  351. package/dist/quantization/binary-quantization.js.map +0 -1
  352. package/dist/quantization/binary-quantization.mjs +0 -240
  353. package/dist/quantization/optimized-pq.d.ts +0 -138
  354. package/dist/quantization/optimized-pq.d.ts.map +0 -1
  355. package/dist/quantization/optimized-pq.js +0 -320
  356. package/dist/quantization/optimized-pq.js.map +0 -1
  357. package/dist/quantization/optimized-pq.mjs +0 -313
  358. package/dist/quantization/product-quantization.d.ts +0 -109
  359. package/dist/quantization/product-quantization.d.ts.map +0 -1
  360. package/dist/quantization/product-quantization.js +0 -287
  361. package/dist/quantization/product-quantization.js.map +0 -1
  362. package/dist/quantization/product-quantization.mjs +0 -282
  363. package/dist/quantization/scalar-quantization.d.ts +0 -100
  364. package/dist/quantization/scalar-quantization.d.ts.map +0 -1
  365. package/dist/quantization/scalar-quantization.js +0 -324
  366. package/dist/quantization/scalar-quantization.js.map +0 -1
  367. package/dist/quantization/scalar-quantization.mjs +0 -319
  368. package/dist/query/index.d.ts +0 -6
  369. package/dist/query/index.d.ts.map +0 -1
  370. package/dist/query/index.js +0 -9
  371. package/dist/query/index.js.map +0 -1
  372. package/dist/query/index.mjs +0 -4
  373. package/dist/query/query-builder.d.ts +0 -323
  374. package/dist/query/query-builder.d.ts.map +0 -1
  375. package/dist/query/query-builder.js +0 -524
  376. package/dist/query/query-builder.js.map +0 -1
  377. package/dist/query/query-builder.mjs +0 -519
  378. package/dist/reasoning/context-synthesizer.d.ts +0 -57
  379. package/dist/reasoning/context-synthesizer.d.ts.map +0 -1
  380. package/dist/reasoning/context-synthesizer.js +0 -224
  381. package/dist/reasoning/context-synthesizer.js.map +0 -1
  382. package/dist/reasoning/context-synthesizer.mjs +0 -219
  383. package/dist/reasoning/experience-curator.d.ts +0 -66
  384. package/dist/reasoning/experience-curator.d.ts.map +0 -1
  385. package/dist/reasoning/experience-curator.js +0 -288
  386. package/dist/reasoning/experience-curator.js.map +0 -1
  387. package/dist/reasoning/experience-curator.mjs +0 -283
  388. package/dist/reasoning/memory-optimizer.d.ts +0 -69
  389. package/dist/reasoning/memory-optimizer.d.ts.map +0 -1
  390. package/dist/reasoning/memory-optimizer.js +0 -331
  391. package/dist/reasoning/memory-optimizer.js.map +0 -1
  392. package/dist/reasoning/memory-optimizer.mjs +0 -326
  393. package/dist/reasoning/pattern-matcher.d.ts +0 -59
  394. package/dist/reasoning/pattern-matcher.d.ts.map +0 -1
  395. package/dist/reasoning/pattern-matcher.js +0 -229
  396. package/dist/reasoning/pattern-matcher.js.map +0 -1
  397. package/dist/reasoning/pattern-matcher.mjs +0 -224
  398. package/dist/reasoningbank/adapter/agentdb-adapter.d.ts +0 -118
  399. package/dist/reasoningbank/adapter/agentdb-adapter.d.ts.map +0 -1
  400. package/dist/reasoningbank/adapter/agentdb-adapter.js +0 -477
  401. package/dist/reasoningbank/adapter/agentdb-adapter.js.map +0 -1
  402. package/dist/reasoningbank/adapter/types.d.ts +0 -113
  403. package/dist/reasoningbank/adapter/types.d.ts.map +0 -1
  404. package/dist/reasoningbank/adapter/types.js +0 -9
  405. package/dist/reasoningbank/adapter/types.js.map +0 -1
  406. package/dist/reasoningbank/cli/commands.d.ts +0 -16
  407. package/dist/reasoningbank/cli/commands.d.ts.map +0 -1
  408. package/dist/reasoningbank/cli/commands.js +0 -272
  409. package/dist/reasoningbank/cli/commands.js.map +0 -1
  410. package/dist/reasoningbank/mcp/agentdb-tools.d.ts +0 -319
  411. package/dist/reasoningbank/mcp/agentdb-tools.d.ts.map +0 -1
  412. package/dist/reasoningbank/mcp/agentdb-tools.js +0 -301
  413. package/dist/reasoningbank/mcp/agentdb-tools.js.map +0 -1
  414. package/dist/reasoningbank/migration/migrate.d.ts +0 -25
  415. package/dist/reasoningbank/migration/migrate.d.ts.map +0 -1
  416. package/dist/reasoningbank/migration/migrate.js +0 -178
  417. package/dist/reasoningbank/migration/migrate.js.map +0 -1
  418. package/dist/reasoningbank/reasoning/context-synthesizer.d.ts +0 -37
  419. package/dist/reasoningbank/reasoning/context-synthesizer.d.ts.map +0 -1
  420. package/dist/reasoningbank/reasoning/context-synthesizer.js +0 -114
  421. package/dist/reasoningbank/reasoning/context-synthesizer.js.map +0 -1
  422. package/dist/reasoningbank/reasoning/experience-curator.d.ts +0 -39
  423. package/dist/reasoningbank/reasoning/experience-curator.d.ts.map +0 -1
  424. package/dist/reasoningbank/reasoning/experience-curator.js +0 -98
  425. package/dist/reasoningbank/reasoning/experience-curator.js.map +0 -1
  426. package/dist/reasoningbank/reasoning/memory-optimizer.d.ts +0 -44
  427. package/dist/reasoningbank/reasoning/memory-optimizer.d.ts.map +0 -1
  428. package/dist/reasoningbank/reasoning/memory-optimizer.js +0 -184
  429. package/dist/reasoningbank/reasoning/memory-optimizer.js.map +0 -1
  430. package/dist/reasoningbank/reasoning/pattern-matcher.d.ts +0 -40
  431. package/dist/reasoningbank/reasoning/pattern-matcher.d.ts.map +0 -1
  432. package/dist/reasoningbank/reasoning/pattern-matcher.js +0 -87
  433. package/dist/reasoningbank/reasoning/pattern-matcher.js.map +0 -1
  434. package/dist/reasoningbank/sync/quic-sync.d.ts +0 -77
  435. package/dist/reasoningbank/sync/quic-sync.d.ts.map +0 -1
  436. package/dist/reasoningbank/sync/quic-sync.js +0 -165
  437. package/dist/reasoningbank/sync/quic-sync.js.map +0 -1
  438. package/dist/sync/conflict.d.ts +0 -78
  439. package/dist/sync/conflict.d.ts.map +0 -1
  440. package/dist/sync/conflict.js +0 -202
  441. package/dist/sync/conflict.js.map +0 -1
  442. package/dist/sync/conflict.mjs +0 -196
  443. package/dist/sync/coordinator.d.ts +0 -111
  444. package/dist/sync/coordinator.d.ts.map +0 -1
  445. package/dist/sync/coordinator.js +0 -256
  446. package/dist/sync/coordinator.js.map +0 -1
  447. package/dist/sync/coordinator.mjs +0 -250
  448. package/dist/sync/delta.d.ts +0 -81
  449. package/dist/sync/delta.d.ts.map +0 -1
  450. package/dist/sync/delta.js +0 -245
  451. package/dist/sync/delta.js.map +0 -1
  452. package/dist/sync/delta.mjs +0 -238
  453. package/dist/sync/index.d.ts +0 -11
  454. package/dist/sync/index.d.ts.map +0 -1
  455. package/dist/sync/index.js +0 -22
  456. package/dist/sync/index.js.map +0 -1
  457. package/dist/sync/index.mjs +0 -9
  458. package/dist/sync/quic-sync.d.ts +0 -81
  459. package/dist/sync/quic-sync.d.ts.map +0 -1
  460. package/dist/sync/quic-sync.js +0 -329
  461. package/dist/sync/quic-sync.js.map +0 -1
  462. package/dist/sync/quic-sync.mjs +0 -323
  463. package/dist/sync/types.d.ts +0 -168
  464. package/dist/sync/types.d.ts.map +0 -1
  465. package/dist/sync/types.js +0 -8
  466. package/dist/sync/types.js.map +0 -1
  467. package/dist/sync/types.mjs +0 -6
  468. package/dist/types/index.d.ts +0 -117
  469. package/dist/types/index.d.ts.map +0 -1
  470. package/dist/types/index.js +0 -6
  471. package/dist/types/index.js.map +0 -1
  472. package/dist/types/index.mjs +0 -4
  473. package/dist/wasm/sql-wasm-debug.js +0 -6989
  474. package/dist/wasm/sql-wasm-debug.wasm +0 -0
  475. package/dist/wasm/sql-wasm.js +0 -188
  476. package/dist/wasm/sql-wasm.wasm +0 -0
  477. package/dist/wasm-loader.d.ts +0 -32
  478. package/dist/wasm-loader.d.ts.map +0 -1
  479. package/dist/wasm-loader.js +0 -78
  480. package/dist/wasm-loader.js.map +0 -1
  481. package/dist/wasm-loader.mjs +0 -67
  482. package/examples/adaptive-learning.ts +0 -284
  483. package/examples/browser/README.md +0 -732
  484. package/examples/browser/adaptive-recommendations/index.html +0 -427
  485. package/examples/browser/collaborative-filtering/index.html +0 -310
  486. package/examples/browser/continual-learning/index.html +0 -736
  487. package/examples/browser/experience-replay/index.html +0 -616
  488. package/examples/browser/index.html +0 -369
  489. package/examples/browser/meta-learning/index.html +0 -789
  490. package/examples/browser/neuro-symbolic/index.html +0 -692
  491. package/examples/browser/pattern-learning/index.html +0 -620
  492. package/examples/browser/quantum-inspired/index.html +0 -728
  493. package/examples/browser/rag/index.html +0 -624
  494. package/examples/browser/swarm-intelligence/index.html +0 -811
  495. package/examples/browser-basic.html +0 -170
  496. package/examples/browser-wasm-real.html +0 -231
  497. package/examples/hnsw-example.ts +0 -148
  498. package/examples/mcp-learning-example.ts +0 -220
  499. package/examples/node-basic.js +0 -70
  500. package/examples/quic-sync-example.ts +0 -310
  501. package/examples/quick-start.js +0 -68
  502. package/examples/test-v1.0.7-cdn.html +0 -190
  503. package/examples/wasm-example.ts +0 -222
@@ -1,418 +0,0 @@
1
- "use strict";
2
- /**
3
- * WASM backend implementation using sql.js
4
- * Provides browser-compatible vector database operations
5
- */
6
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8
- return new (P || (P = Promise))(function (resolve, reject) {
9
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12
- step((generator = generator.apply(thisArg, _arguments || [])).next());
13
- });
14
- };
15
- var __generator = (this && this.__generator) || function (thisArg, body) {
16
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
17
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
18
- function verb(n) { return function (v) { return step([n, v]); }; }
19
- function step(op) {
20
- if (f) throw new TypeError("Generator is already executing.");
21
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
22
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
23
- if (y = 0, t) op = [op[0] & 2, t.value];
24
- switch (op[0]) {
25
- case 0: case 1: t = op; break;
26
- case 4: _.label++; return { value: op[1], done: false };
27
- case 5: _.label++; y = op[1]; op = [0]; continue;
28
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
29
- default:
30
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
31
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
32
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
33
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
34
- if (t[2]) _.ops.pop();
35
- _.trys.pop(); continue;
36
- }
37
- op = body.call(thisArg, _);
38
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
39
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
40
- }
41
- };
42
- var __importDefault = (this && this.__importDefault) || function (mod) {
43
- return (mod && mod.__esModule) ? mod : { "default": mod };
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.WasmBackend = void 0;
47
- var sql_js_1 = __importDefault(require("sql.js"));
48
- /**
49
- * WASM backend using sql.js
50
- * Runs in both Node.js and browser environments
51
- */
52
- var WasmBackend = /** @class */ (function () {
53
- function WasmBackend() {
54
- this.SQL = null;
55
- this.db = null;
56
- this.initialized = false;
57
- }
58
- /**
59
- * Initialize the WASM backend
60
- */
61
- WasmBackend.prototype.initializeAsync = function () {
62
- return __awaiter(this, arguments, void 0, function (config) {
63
- var _a;
64
- if (config === void 0) { config = {}; }
65
- return __generator(this, function (_b) {
66
- switch (_b.label) {
67
- case 0:
68
- if (this.initialized) {
69
- return [2 /*return*/];
70
- }
71
- // Load sql.js WASM module
72
- _a = this;
73
- return [4 /*yield*/, (0, sql_js_1.default)({
74
- // Use CDN for WASM binary in browser, local file in Node.js
75
- locateFile: function (file) {
76
- if (typeof window !== 'undefined') {
77
- return "https://sql.js.org/dist/".concat(file);
78
- }
79
- return "node_modules/sql.js/dist/".concat(file);
80
- }
81
- })];
82
- case 1:
83
- // Load sql.js WASM module
84
- _a.SQL = _b.sent();
85
- // Create database
86
- this.db = new this.SQL.Database();
87
- // Initialize schema and functions
88
- this.initializeSchema(config);
89
- this.registerCustomFunctions();
90
- this.initialized = true;
91
- return [2 /*return*/];
92
- }
93
- });
94
- });
95
- };
96
- /**
97
- * Synchronous initialization (throws if not already initialized)
98
- */
99
- WasmBackend.prototype.initialize = function (config) {
100
- if (config === void 0) { config = {}; }
101
- if (!this.initialized) {
102
- throw new Error('WASM backend must be initialized asynchronously. Call initializeAsync() first.');
103
- }
104
- };
105
- /**
106
- * Initialize database schema
107
- */
108
- WasmBackend.prototype.initializeSchema = function (config) {
109
- if (!this.db)
110
- throw new Error('Database not initialized');
111
- var _a = config.cacheSize, cacheSize = _a === void 0 ? 100 * 1024 : _a, _b = config.walMode, walMode = _b === void 0 ? false : _b, // WAL not supported in sql.js
112
- _c = config.mmapSize, // WAL not supported in sql.js
113
- mmapSize = _c === void 0 ? 256 * 1024 * 1024 : _c;
114
- // Configure SQLite (limited options in sql.js)
115
- this.db.run('PRAGMA journal_mode = MEMORY');
116
- this.db.run('PRAGMA synchronous = OFF'); // Safe for in-memory
117
- this.db.run("PRAGMA cache_size = -".concat(cacheSize));
118
- this.db.run('PRAGMA temp_store = MEMORY');
119
- this.db.run('PRAGMA page_size = 4096');
120
- // Create vectors table
121
- this.db.run("\n CREATE TABLE IF NOT EXISTS vectors (\n id TEXT PRIMARY KEY,\n embedding BLOB NOT NULL,\n norm REAL NOT NULL,\n metadata TEXT,\n timestamp INTEGER NOT NULL\n )\n ");
122
- // Create indexes
123
- this.db.run('CREATE INDEX IF NOT EXISTS idx_vectors_norm ON vectors(norm)');
124
- this.db.run('CREATE INDEX IF NOT EXISTS idx_vectors_timestamp ON vectors(timestamp)');
125
- };
126
- /**
127
- * Register custom SQL functions for similarity calculations
128
- */
129
- WasmBackend.prototype.registerCustomFunctions = function () {
130
- if (!this.db)
131
- throw new Error('Database not initialized');
132
- // Cosine similarity function
133
- this.db.create_function('cosine_similarity', function (embeddingA, embeddingB, normA, normB) {
134
- var arrA = new Float32Array(embeddingA.buffer, embeddingA.byteOffset, embeddingA.byteLength / 4);
135
- var arrB = new Float32Array(embeddingB.buffer, embeddingB.byteOffset, embeddingB.byteLength / 4);
136
- var dotProduct = 0;
137
- var len = Math.min(arrA.length, arrB.length);
138
- for (var i = 0; i < len; i++) {
139
- dotProduct += arrA[i] * arrB[i];
140
- }
141
- return dotProduct / (normA * normB);
142
- });
143
- // Euclidean distance function
144
- this.db.create_function('euclidean_distance', function (embeddingA, embeddingB) {
145
- var arrA = new Float32Array(embeddingA.buffer, embeddingA.byteOffset, embeddingA.byteLength / 4);
146
- var arrB = new Float32Array(embeddingB.buffer, embeddingB.byteOffset, embeddingB.byteLength / 4);
147
- var sum = 0;
148
- var len = Math.min(arrA.length, arrB.length);
149
- for (var i = 0; i < len; i++) {
150
- var diff = arrA[i] - arrB[i];
151
- sum += diff * diff;
152
- }
153
- return Math.sqrt(sum);
154
- });
155
- // Dot product function
156
- this.db.create_function('dot_product', function (embeddingA, embeddingB) {
157
- var arrA = new Float32Array(embeddingA.buffer, embeddingA.byteOffset, embeddingA.byteLength / 4);
158
- var arrB = new Float32Array(embeddingB.buffer, embeddingB.byteOffset, embeddingB.byteLength / 4);
159
- var dotProduct = 0;
160
- var len = Math.min(arrA.length, arrB.length);
161
- for (var i = 0; i < len; i++) {
162
- dotProduct += arrA[i] * arrB[i];
163
- }
164
- return dotProduct;
165
- });
166
- };
167
- /**
168
- * Calculate L2 norm of a vector
169
- */
170
- WasmBackend.prototype.calculateNorm = function (embedding) {
171
- var sum = 0;
172
- for (var _i = 0, embedding_1 = embedding; _i < embedding_1.length; _i++) {
173
- var val = embedding_1[_i];
174
- sum += val * val;
175
- }
176
- return Math.sqrt(sum);
177
- };
178
- /**
179
- * Serialize embedding to Uint8Array (binary format)
180
- */
181
- WasmBackend.prototype.serializeEmbedding = function (embedding) {
182
- var buffer = new ArrayBuffer(embedding.length * 4);
183
- var view = new Float32Array(buffer);
184
- view.set(embedding);
185
- return new Uint8Array(buffer);
186
- };
187
- /**
188
- * Deserialize embedding from Uint8Array
189
- */
190
- WasmBackend.prototype.deserializeEmbedding = function (buffer) {
191
- var view = new Float32Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 4);
192
- return Array.from(view);
193
- };
194
- /**
195
- * Generate unique ID
196
- */
197
- WasmBackend.prototype.generateId = function () {
198
- return "vec_".concat(Date.now(), "_").concat(Math.random().toString(36).substr(2, 9));
199
- };
200
- /**
201
- * Insert a single vector
202
- */
203
- WasmBackend.prototype.insert = function (vector) {
204
- if (!this.db)
205
- throw new Error('Database not initialized');
206
- var id = vector.id || this.generateId();
207
- var norm = this.calculateNorm(vector.embedding);
208
- var embedding = this.serializeEmbedding(vector.embedding);
209
- var metadata = vector.metadata ? JSON.stringify(vector.metadata) : null;
210
- var timestamp = vector.timestamp || Date.now();
211
- this.db.run('INSERT OR REPLACE INTO vectors (id, embedding, norm, metadata, timestamp) VALUES (?, ?, ?, ?, ?)', [id, embedding, norm, metadata, timestamp]);
212
- return id;
213
- };
214
- /**
215
- * Insert multiple vectors in a transaction with optimized batch processing
216
- * Performance improvements:
217
- * - Single transaction for all inserts
218
- * - Prepared statement created once and reused
219
- * - No wrapper function overhead
220
- * - Chunked processing for large batches
221
- */
222
- WasmBackend.prototype.insertBatch = function (vectors) {
223
- var _this = this;
224
- if (!this.db)
225
- throw new Error('Database not initialized');
226
- var ids = [];
227
- var CHUNK_SIZE = 5000; // Process in chunks to avoid memory spikes
228
- // Helper function to process a chunk of vectors
229
- var processChunk = function (chunk) {
230
- var chunkIds = [];
231
- _this.db.run('BEGIN TRANSACTION');
232
- try {
233
- // Prepare statement once for all inserts in this chunk
234
- var stmt = _this.db.prepare('INSERT OR REPLACE INTO vectors (id, embedding, norm, metadata, timestamp) VALUES (?, ?, ?, ?, ?)');
235
- try {
236
- // Reuse the prepared statement for all inserts
237
- for (var _i = 0, chunk_1 = chunk; _i < chunk_1.length; _i++) {
238
- var vector = chunk_1[_i];
239
- var id = vector.id || _this.generateId();
240
- var norm = _this.calculateNorm(vector.embedding);
241
- var embedding = _this.serializeEmbedding(vector.embedding);
242
- var metadata = vector.metadata ? JSON.stringify(vector.metadata) : null;
243
- var timestamp = vector.timestamp || Date.now();
244
- stmt.bind([id, embedding, norm, metadata, timestamp]);
245
- stmt.step();
246
- stmt.reset();
247
- chunkIds.push(id);
248
- }
249
- }
250
- finally {
251
- stmt.free();
252
- }
253
- _this.db.run('COMMIT');
254
- }
255
- catch (error) {
256
- _this.db.run('ROLLBACK');
257
- throw error;
258
- }
259
- return chunkIds;
260
- };
261
- // Process vectors in chunks
262
- if (vectors.length <= CHUNK_SIZE) {
263
- // Small batch - process directly
264
- ids.push.apply(ids, processChunk(vectors));
265
- }
266
- else {
267
- // Large batch - process in chunks to manage memory
268
- for (var i = 0; i < vectors.length; i += CHUNK_SIZE) {
269
- var chunk = vectors.slice(i, i + CHUNK_SIZE);
270
- ids.push.apply(ids, processChunk(chunk));
271
- }
272
- }
273
- return ids;
274
- };
275
- /**
276
- * Search for k-nearest neighbors
277
- */
278
- WasmBackend.prototype.search = function (queryEmbedding, k, metric, threshold) {
279
- if (k === void 0) { k = 5; }
280
- if (metric === void 0) { metric = 'cosine'; }
281
- if (threshold === void 0) { threshold = 0.0; }
282
- if (!this.db)
283
- throw new Error('Database not initialized');
284
- var queryBuffer = this.serializeEmbedding(queryEmbedding);
285
- var queryNorm = this.calculateNorm(queryEmbedding);
286
- var sql;
287
- var params;
288
- switch (metric) {
289
- case 'cosine':
290
- sql = "\n SELECT\n id,\n embedding,\n metadata,\n cosine_similarity(embedding, ?, norm, ?) as score\n FROM vectors\n WHERE cosine_similarity(embedding, ?, norm, ?) >= ?\n ORDER BY score DESC\n LIMIT ?\n ";
291
- params = [queryBuffer, queryNorm, queryBuffer, queryNorm, threshold, k];
292
- break;
293
- case 'euclidean':
294
- sql = "\n SELECT\n id,\n embedding,\n metadata,\n euclidean_distance(embedding, ?) as score\n FROM vectors\n WHERE euclidean_distance(embedding, ?) <= ? OR ? = 0\n ORDER BY score ASC\n LIMIT ?\n ";
295
- params = [queryBuffer, queryBuffer, threshold, threshold, k];
296
- break;
297
- case 'dot':
298
- sql = "\n SELECT\n id,\n embedding,\n metadata,\n dot_product(embedding, ?) as score\n FROM vectors\n WHERE dot_product(embedding, ?) >= ?\n ORDER BY score DESC\n LIMIT ?\n ";
299
- params = [queryBuffer, queryBuffer, threshold, k];
300
- break;
301
- default:
302
- throw new Error("Unsupported similarity metric: ".concat(metric));
303
- }
304
- var stmt = this.db.prepare(sql);
305
- stmt.bind(params);
306
- var results = [];
307
- while (stmt.step()) {
308
- var row = stmt.getAsObject();
309
- results.push({
310
- id: row.id,
311
- score: row.score,
312
- embedding: this.deserializeEmbedding(row.embedding),
313
- metadata: row.metadata ? JSON.parse(row.metadata) : undefined
314
- });
315
- }
316
- stmt.free();
317
- return results;
318
- };
319
- /**
320
- * Get vector by ID
321
- */
322
- WasmBackend.prototype.get = function (id) {
323
- if (!this.db)
324
- throw new Error('Database not initialized');
325
- var stmt = this.db.prepare('SELECT * FROM vectors WHERE id = ?');
326
- stmt.bind([id]);
327
- if (!stmt.step()) {
328
- stmt.free();
329
- return null;
330
- }
331
- var row = stmt.getAsObject();
332
- stmt.free();
333
- return {
334
- id: row.id,
335
- embedding: this.deserializeEmbedding(row.embedding),
336
- metadata: row.metadata ? JSON.parse(row.metadata) : undefined,
337
- norm: row.norm,
338
- timestamp: row.timestamp
339
- };
340
- };
341
- /**
342
- * Delete vector by ID
343
- */
344
- WasmBackend.prototype.delete = function (id) {
345
- if (!this.db)
346
- throw new Error('Database not initialized');
347
- var stmt = this.db.prepare('DELETE FROM vectors WHERE id = ?');
348
- stmt.bind([id]);
349
- stmt.step();
350
- var changes = this.db.getRowsModified();
351
- stmt.free();
352
- return changes > 0;
353
- };
354
- /**
355
- * Get database statistics
356
- */
357
- WasmBackend.prototype.stats = function () {
358
- if (!this.db)
359
- throw new Error('Database not initialized');
360
- // Get count
361
- var countStmt = this.db.prepare('SELECT COUNT(*) as count FROM vectors');
362
- countStmt.step();
363
- var countRow = countStmt.getAsObject();
364
- var count = countRow.count;
365
- countStmt.free();
366
- // Get size (approximate from exported binary)
367
- var exported = this.db.export();
368
- var size = exported.byteLength;
369
- return { count: count, size: size };
370
- };
371
- /**
372
- * Export database to binary format (for persistence)
373
- */
374
- WasmBackend.prototype.export = function () {
375
- if (!this.db)
376
- throw new Error('Database not initialized');
377
- return this.db.export();
378
- };
379
- /**
380
- * Import database from binary format
381
- */
382
- WasmBackend.prototype.importAsync = function (data) {
383
- return __awaiter(this, void 0, void 0, function () {
384
- return __generator(this, function (_a) {
385
- if (!this.SQL) {
386
- throw new Error('SQL.js not initialized');
387
- }
388
- // Close existing database
389
- if (this.db) {
390
- this.db.close();
391
- }
392
- // Load from binary data
393
- this.db = new this.SQL.Database(data);
394
- this.registerCustomFunctions();
395
- this.initialized = true;
396
- return [2 /*return*/];
397
- });
398
- });
399
- };
400
- /**
401
- * Close database and cleanup resources
402
- */
403
- WasmBackend.prototype.close = function () {
404
- if (this.db) {
405
- this.db.close();
406
- this.db = null;
407
- }
408
- this.initialized = false;
409
- };
410
- /**
411
- * Check if backend is initialized
412
- */
413
- WasmBackend.prototype.isInitialized = function () {
414
- return this.initialized;
415
- };
416
- return WasmBackend;
417
- }());
418
- exports.WasmBackend = WasmBackend;
@@ -1,49 +0,0 @@
1
- /**
2
- * Database CLI Commands
3
- * Full-featured CLI commands for database operations
4
- */
5
- import { Command } from 'commander';
6
- /**
7
- * Format options for import/export
8
- */
9
- type FileFormat = 'json' | 'csv';
10
- /**
11
- * Import vectors from file
12
- */
13
- export declare function importVectors(dbPath: string, filePath: string, options?: {
14
- format?: FileFormat;
15
- batchSize?: number;
16
- verbose?: boolean;
17
- }): Promise<void>;
18
- /**
19
- * Export vectors to file
20
- */
21
- export declare function exportVectors(dbPath: string, filePath: string, options?: {
22
- format?: FileFormat;
23
- limit?: number;
24
- where?: string;
25
- verbose?: boolean;
26
- }): Promise<void>;
27
- /**
28
- * Query database with vector
29
- */
30
- export declare function queryVectors(dbPath: string, embeddingInput: string, options?: {
31
- k?: number;
32
- metric?: 'cosine' | 'euclidean' | 'dot';
33
- threshold?: number;
34
- format?: 'table' | 'json';
35
- verbose?: boolean;
36
- }): Promise<void>;
37
- /**
38
- * Show database statistics
39
- */
40
- export declare function showStats(dbPath: string, options?: {
41
- detailed?: boolean;
42
- format?: 'table' | 'json';
43
- }): Promise<void>;
44
- /**
45
- * Setup database CLI commands
46
- */
47
- export declare function setupDatabaseCommands(program: Command): void;
48
- export {};
49
- //# sourceMappingURL=db-commands.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"db-commands.d.ts","sourceRoot":"","sources":["../../src/cli/db-commands.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC;;GAEG;AACH,KAAK,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;AAiFjC;;GAEG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GACL,OAAO,CAAC,IAAI,CAAC,CA6Jf;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GACL,OAAO,CAAC,IAAI,CAAC,CAsFf;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE;IACP,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GACL,OAAO,CAAC,IAAI,CAAC,CAuFf;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACtB,GACL,OAAO,CAAC,IAAI,CAAC,CA4Ff;AAeD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgE5D"}