agentdb 1.0.12 → 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 -165
  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,600 +0,0 @@
1
- "use strict";
2
- /**
3
- * VectorQueryBuilder - Fluent API for building complex vector search queries
4
- * Provides type-safe filtering, sorting, and pagination with SQL injection protection
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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
43
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
44
- if (ar || !(i in from)) {
45
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
46
- ar[i] = from[i];
47
- }
48
- }
49
- return to.concat(ar || Array.prototype.slice.call(from));
50
- };
51
- Object.defineProperty(exports, "__esModule", { value: true });
52
- exports.VectorQueryBuilder = void 0;
53
- /**
54
- * VectorQueryBuilder - Fluent API for complex vector queries
55
- *
56
- * @template T - Type of metadata object
57
- *
58
- * @example
59
- * ```typescript
60
- * const results = await db.query()
61
- * .similarTo(queryVector)
62
- * .where('metadata.category', '=', 'tech')
63
- * .whereBetween('metadata.year', 2020, 2024)
64
- * .orderBySimilarity('asc')
65
- * .limit(10)
66
- * .execute();
67
- * ```
68
- */
69
- var VectorQueryBuilder = /** @class */ (function () {
70
- function VectorQueryBuilder(db) {
71
- this.k = 10;
72
- this.filters = [];
73
- this.orders = [];
74
- this.offsetValue = 0;
75
- this.metric = 'cosine';
76
- this.threshold = 0.0;
77
- this.db = db;
78
- }
79
- /**
80
- * Search for vectors similar to the given vector
81
- *
82
- * @param vector - Query vector
83
- * @param k - Number of results to retrieve (default: 10)
84
- * @returns this for chaining
85
- *
86
- * @example
87
- * ```typescript
88
- * db.query().similarTo([0.1, 0.2, 0.3], 5)
89
- * ```
90
- */
91
- VectorQueryBuilder.prototype.similarTo = function (vector, k) {
92
- this.queryVector = vector;
93
- if (k !== undefined) {
94
- this.k = k;
95
- }
96
- return this;
97
- };
98
- /**
99
- * Search for vectors similar to a vector already in the database
100
- *
101
- * @param id - ID of the reference vector
102
- * @param k - Number of results to retrieve (default: 10)
103
- * @returns this for chaining
104
- *
105
- * @example
106
- * ```typescript
107
- * db.query().similarToId('vector-123', 5)
108
- * ```
109
- */
110
- VectorQueryBuilder.prototype.similarToId = function (id, k) {
111
- this.queryId = id;
112
- if (k !== undefined) {
113
- this.k = k;
114
- }
115
- return this;
116
- };
117
- /**
118
- * Add a filter condition
119
- *
120
- * @param field - Field name (use 'metadata.field' for metadata)
121
- * @param op - Comparison operator
122
- * @param value - Value to compare against
123
- * @returns this for chaining
124
- *
125
- * @example
126
- * ```typescript
127
- * db.query()
128
- * .similarTo(vector)
129
- * .where('metadata.category', '=', 'tech')
130
- * .where('metadata.year', '>', 2020)
131
- * ```
132
- */
133
- VectorQueryBuilder.prototype.where = function (field, op, value) {
134
- var isMetadata = field.startsWith('metadata.');
135
- this.filters.push({
136
- field: isMetadata ? field.substring(9) : field, // Remove 'metadata.' prefix
137
- operator: op,
138
- value: value,
139
- isMetadata: isMetadata
140
- });
141
- return this;
142
- };
143
- /**
144
- * Filter where field is IN a set of values
145
- *
146
- * @param field - Field name
147
- * @param values - Array of values
148
- * @returns this for chaining
149
- *
150
- * @example
151
- * ```typescript
152
- * db.query()
153
- * .similarTo(vector)
154
- * .whereIn('metadata.tags', ['typescript', 'javascript'])
155
- * ```
156
- */
157
- VectorQueryBuilder.prototype.whereIn = function (field, values) {
158
- return this.where(field, 'IN', values);
159
- };
160
- /**
161
- * Filter where field is between min and max (inclusive)
162
- *
163
- * @param field - Field name
164
- * @param min - Minimum value
165
- * @param max - Maximum value
166
- * @returns this for chaining
167
- *
168
- * @example
169
- * ```typescript
170
- * db.query()
171
- * .similarTo(vector)
172
- * .whereBetween('metadata.year', 2020, 2024)
173
- * ```
174
- */
175
- VectorQueryBuilder.prototype.whereBetween = function (field, min, max) {
176
- this.where(field, '>=', min);
177
- this.where(field, '<=', max);
178
- return this;
179
- };
180
- /**
181
- * Filter metadata field (alias for where with 'metadata.' prefix)
182
- *
183
- * @param path - Metadata field path
184
- * @param op - Comparison operator
185
- * @param value - Value to compare against
186
- * @returns this for chaining
187
- *
188
- * @example
189
- * ```typescript
190
- * db.query()
191
- * .similarTo(vector)
192
- * .whereMetadata('author.verified', '=', true)
193
- * ```
194
- */
195
- VectorQueryBuilder.prototype.whereMetadata = function (path, op, value) {
196
- return this.where("metadata.".concat(path), op, value);
197
- };
198
- /**
199
- * Set similarity metric
200
- *
201
- * @param metric - Similarity metric ('cosine', 'euclidean', 'dot')
202
- * @returns this for chaining
203
- *
204
- * @example
205
- * ```typescript
206
- * db.query().similarTo(vector).useSimilarityMetric('euclidean')
207
- * ```
208
- */
209
- VectorQueryBuilder.prototype.useSimilarityMetric = function (metric) {
210
- this.metric = metric;
211
- return this;
212
- };
213
- /**
214
- * Set minimum similarity threshold
215
- *
216
- * @param threshold - Minimum score threshold
217
- * @returns this for chaining
218
- *
219
- * @example
220
- * ```typescript
221
- * db.query().similarTo(vector).withThreshold(0.7)
222
- * ```
223
- */
224
- VectorQueryBuilder.prototype.withThreshold = function (threshold) {
225
- this.threshold = threshold;
226
- return this;
227
- };
228
- /**
229
- * Order results by a field
230
- *
231
- * @param field - Field name
232
- * @param direction - Sort direction ('asc' or 'desc')
233
- * @returns this for chaining
234
- *
235
- * @example
236
- * ```typescript
237
- * db.query()
238
- * .similarTo(vector)
239
- * .orderBy('metadata.timestamp', 'desc')
240
- * ```
241
- */
242
- VectorQueryBuilder.prototype.orderBy = function (field, direction) {
243
- if (direction === void 0) { direction = 'asc'; }
244
- this.orders.push({
245
- field: field,
246
- direction: direction,
247
- bySimilarity: false
248
- });
249
- return this;
250
- };
251
- /**
252
- * Order results by similarity score
253
- *
254
- * @param direction - Sort direction ('asc' or 'desc', default: 'desc')
255
- * @returns this for chaining
256
- *
257
- * @example
258
- * ```typescript
259
- * db.query()
260
- * .similarTo(vector)
261
- * .orderBySimilarity('asc') // Least similar first
262
- * ```
263
- */
264
- VectorQueryBuilder.prototype.orderBySimilarity = function (direction) {
265
- if (direction === void 0) { direction = 'desc'; }
266
- this.orders.push({
267
- field: 'score',
268
- direction: direction,
269
- bySimilarity: true
270
- });
271
- return this;
272
- };
273
- /**
274
- * Limit number of results
275
- *
276
- * @param n - Maximum number of results
277
- * @returns this for chaining
278
- *
279
- * @example
280
- * ```typescript
281
- * db.query().similarTo(vector).limit(10)
282
- * ```
283
- */
284
- VectorQueryBuilder.prototype.limit = function (n) {
285
- if (n < 0) {
286
- throw new Error('Limit must be non-negative');
287
- }
288
- this.limitValue = n;
289
- return this;
290
- };
291
- /**
292
- * Skip first n results
293
- *
294
- * @param n - Number of results to skip
295
- * @returns this for chaining
296
- *
297
- * @example
298
- * ```typescript
299
- * db.query().similarTo(vector).offset(20).limit(10) // Get results 21-30
300
- * ```
301
- */
302
- VectorQueryBuilder.prototype.offset = function (n) {
303
- if (n < 0) {
304
- throw new Error('Offset must be non-negative');
305
- }
306
- this.offsetValue = n;
307
- return this;
308
- };
309
- /**
310
- * Alias for offset
311
- */
312
- VectorQueryBuilder.prototype.skip = function (n) {
313
- return this.offset(n);
314
- };
315
- /**
316
- * Alias for limit
317
- */
318
- VectorQueryBuilder.prototype.take = function (n) {
319
- return this.limit(n);
320
- };
321
- /**
322
- * Execute raw SQL query (advanced usage)
323
- *
324
- * @param sql - Raw SQL query
325
- * @param params - Query parameters
326
- * @returns this for chaining
327
- *
328
- * @example
329
- * ```typescript
330
- * db.query()
331
- * .raw('SELECT * FROM vectors WHERE metadata->>"$.category" = ?', ['tech'])
332
- * .execute()
333
- * ```
334
- */
335
- VectorQueryBuilder.prototype.raw = function (sql, params) {
336
- this.rawSQL = sql;
337
- this.rawParams = params;
338
- return this;
339
- };
340
- /**
341
- * Type-safe metadata wrapper
342
- *
343
- * @returns QueryBuilder with typed metadata
344
- *
345
- * @example
346
- * ```typescript
347
- * interface BlogPost {
348
- * title: string;
349
- * author: string;
350
- * }
351
- *
352
- * const posts = await db.query()
353
- * .withMetadata<BlogPost>()
354
- * .similarTo(vector)
355
- * .execute();
356
- *
357
- * // posts[0].metadata.title is typed as string
358
- * ```
359
- */
360
- VectorQueryBuilder.prototype.withMetadata = function () {
361
- return this;
362
- };
363
- /**
364
- * Execute the query and return all results
365
- *
366
- * @returns Promise resolving to array of search results
367
- *
368
- * @example
369
- * ```typescript
370
- * const results = await db.query()
371
- * .similarTo(vector)
372
- * .where('metadata.category', '=', 'tech')
373
- * .limit(10)
374
- * .execute();
375
- * ```
376
- */
377
- VectorQueryBuilder.prototype.execute = function () {
378
- return __awaiter(this, void 0, void 0, function () {
379
- var vector, refVector, results;
380
- return __generator(this, function (_a) {
381
- // If raw SQL is provided, use it (advanced usage)
382
- if (this.rawSQL) {
383
- return [2 /*return*/, this.executeRaw()];
384
- }
385
- vector = this.queryVector;
386
- if (this.queryId) {
387
- refVector = this.db.get(this.queryId);
388
- if (!refVector) {
389
- throw new Error("Vector with ID ".concat(this.queryId, " not found"));
390
- }
391
- vector = refVector.embedding;
392
- }
393
- if (!vector) {
394
- throw new Error('Must specify query vector using similarTo() or similarToId()');
395
- }
396
- results = this.db.search(vector, this.k, this.metric, this.threshold);
397
- // Apply filters
398
- results = this.applyFilters(results);
399
- // Apply sorting
400
- results = this.applySorting(results);
401
- // Apply pagination
402
- results = this.applyPagination(results);
403
- return [2 /*return*/, results];
404
- });
405
- });
406
- };
407
- /**
408
- * Execute query and return first result
409
- *
410
- * @returns Promise resolving to first result or null
411
- *
412
- * @example
413
- * ```typescript
414
- * const best = await db.query()
415
- * .similarTo(vector)
416
- * .first();
417
- * ```
418
- */
419
- VectorQueryBuilder.prototype.first = function () {
420
- return __awaiter(this, void 0, void 0, function () {
421
- var results;
422
- return __generator(this, function (_a) {
423
- switch (_a.label) {
424
- case 0: return [4 /*yield*/, this.limit(1).execute()];
425
- case 1:
426
- results = _a.sent();
427
- return [2 /*return*/, results.length > 0 ? results[0] : null];
428
- }
429
- });
430
- });
431
- };
432
- /**
433
- * Count results without retrieving them
434
- *
435
- * @returns Promise resolving to count
436
- *
437
- * @example
438
- * ```typescript
439
- * const count = await db.query()
440
- * .similarTo(vector)
441
- * .where('metadata.category', '=', 'tech')
442
- * .count();
443
- * ```
444
- */
445
- VectorQueryBuilder.prototype.count = function () {
446
- return __awaiter(this, void 0, void 0, function () {
447
- var results;
448
- return __generator(this, function (_a) {
449
- switch (_a.label) {
450
- case 0: return [4 /*yield*/, this.execute()];
451
- case 1:
452
- results = _a.sent();
453
- return [2 /*return*/, results.length];
454
- }
455
- });
456
- });
457
- };
458
- /**
459
- * Apply filters to results
460
- */
461
- VectorQueryBuilder.prototype.applyFilters = function (results) {
462
- var _this = this;
463
- if (this.filters.length === 0) {
464
- return results;
465
- }
466
- return results.filter(function (result) {
467
- return _this.filters.every(function (filter) {
468
- var value = filter.isMetadata
469
- ? _this.getNestedValue(result.metadata, filter.field)
470
- : result[filter.field];
471
- return _this.matchesCondition(value, filter.operator, filter.value);
472
- });
473
- });
474
- };
475
- /**
476
- * Get nested object value by path
477
- */
478
- VectorQueryBuilder.prototype.getNestedValue = function (obj, path) {
479
- if (!obj)
480
- return undefined;
481
- var parts = path.split('.');
482
- var current = obj;
483
- for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
484
- var part = parts_1[_i];
485
- if (current === undefined || current === null) {
486
- return undefined;
487
- }
488
- current = current[part];
489
- }
490
- return current;
491
- };
492
- /**
493
- * Check if value matches condition
494
- */
495
- VectorQueryBuilder.prototype.matchesCondition = function (value, operator, target) {
496
- if (value === undefined || value === null) {
497
- return operator === '!=' && target !== undefined && target !== null;
498
- }
499
- switch (operator) {
500
- case '=':
501
- return value === target;
502
- case '!=':
503
- return value !== target;
504
- case '>':
505
- return value > target;
506
- case '>=':
507
- return value >= target;
508
- case '<':
509
- return value < target;
510
- case '<=':
511
- return value <= target;
512
- case 'LIKE':
513
- if (typeof value !== 'string' || typeof target !== 'string') {
514
- return false;
515
- }
516
- var pattern = target.replace(/%/g, '.*').replace(/_/g, '.');
517
- return new RegExp("^".concat(pattern, "$"), 'i').test(value);
518
- case 'IN':
519
- if (!Array.isArray(target)) {
520
- throw new Error('IN operator requires array value');
521
- }
522
- return target.includes(value);
523
- default:
524
- return false;
525
- }
526
- };
527
- /**
528
- * Apply sorting to results
529
- */
530
- VectorQueryBuilder.prototype.applySorting = function (results) {
531
- var _this = this;
532
- if (this.orders.length === 0) {
533
- return results;
534
- }
535
- return __spreadArray([], results, true).sort(function (a, b) {
536
- for (var _i = 0, _a = _this.orders; _i < _a.length; _i++) {
537
- var order = _a[_i];
538
- var aVal = void 0;
539
- var bVal = void 0;
540
- if (order.bySimilarity) {
541
- aVal = a.score;
542
- bVal = b.score;
543
- }
544
- else if (order.field.startsWith('metadata.')) {
545
- var field = order.field.substring(9);
546
- aVal = _this.getNestedValue(a.metadata, field);
547
- bVal = _this.getNestedValue(b.metadata, field);
548
- }
549
- else {
550
- aVal = a[order.field];
551
- bVal = b[order.field];
552
- }
553
- // Handle null/undefined
554
- if (aVal === undefined || aVal === null) {
555
- return order.direction === 'asc' ? 1 : -1;
556
- }
557
- if (bVal === undefined || bVal === null) {
558
- return order.direction === 'asc' ? -1 : 1;
559
- }
560
- // Compare values
561
- var comparison = 0;
562
- if (aVal < bVal)
563
- comparison = -1;
564
- else if (aVal > bVal)
565
- comparison = 1;
566
- if (comparison !== 0) {
567
- return order.direction === 'asc' ? comparison : -comparison;
568
- }
569
- }
570
- return 0;
571
- });
572
- };
573
- /**
574
- * Apply pagination to results
575
- */
576
- VectorQueryBuilder.prototype.applyPagination = function (results) {
577
- var paginated = results;
578
- if (this.offsetValue > 0) {
579
- paginated = paginated.slice(this.offsetValue);
580
- }
581
- if (this.limitValue !== undefined) {
582
- paginated = paginated.slice(0, this.limitValue);
583
- }
584
- return paginated;
585
- };
586
- /**
587
- * Execute raw SQL query (advanced)
588
- */
589
- VectorQueryBuilder.prototype.executeRaw = function () {
590
- return __awaiter(this, void 0, void 0, function () {
591
- return __generator(this, function (_a) {
592
- // This would require direct database access
593
- // For now, throw an error - can be implemented later with backend support
594
- throw new Error('Raw SQL queries not yet implemented. Use standard query methods.');
595
- });
596
- });
597
- };
598
- return VectorQueryBuilder;
599
- }());
600
- exports.VectorQueryBuilder = VectorQueryBuilder;
@@ -1,14 +0,0 @@
1
- /**
2
- * Template library for common learning algorithms
3
- */
4
- export interface Template {
5
- name: string;
6
- description: string;
7
- algorithm: string;
8
- useCase: string;
9
- config: any;
10
- }
11
- export declare function getAvailableTemplates(): Promise<Template[]>;
12
- export declare function getTemplateConfig(name: string): Promise<any>;
13
- export declare function getTemplate(name: string): Promise<Template | undefined>;
14
- //# sourceMappingURL=templates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/cli/templates.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,GAAG,CAAC;CACb;AAmKD,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAEjE;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAMlE;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAE7E"}