agentdb 1.6.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1098 -350
- package/dist/agentdb-advanced.js +2110 -0
- package/dist/agentdb-advanced.min.js +1 -0
- package/dist/agentdb.min.js +4 -4
- package/dist/backends/GraphBackend.d.ts +196 -0
- package/dist/backends/GraphBackend.d.ts.map +1 -0
- package/dist/backends/GraphBackend.js +33 -0
- package/dist/backends/GraphBackend.js.map +1 -0
- package/dist/backends/LearningBackend.d.ts +148 -0
- package/dist/backends/LearningBackend.d.ts.map +1 -0
- package/dist/backends/LearningBackend.js +27 -0
- package/dist/backends/LearningBackend.js.map +1 -0
- package/dist/backends/VectorBackend.d.ts +119 -0
- package/dist/backends/VectorBackend.d.ts.map +1 -0
- package/dist/backends/VectorBackend.js +14 -0
- package/dist/backends/VectorBackend.js.map +1 -0
- package/dist/backends/detector.d.ts +81 -0
- package/dist/backends/detector.d.ts.map +1 -0
- package/dist/backends/detector.js +192 -0
- package/dist/backends/detector.js.map +1 -0
- package/dist/backends/factory.d.ts +50 -0
- package/dist/backends/factory.d.ts.map +1 -0
- package/dist/backends/factory.js +161 -0
- package/dist/backends/factory.js.map +1 -0
- package/dist/backends/graph/GraphDatabaseAdapter.d.ts +139 -0
- package/dist/backends/graph/GraphDatabaseAdapter.d.ts.map +1 -0
- package/dist/backends/graph/GraphDatabaseAdapter.js +194 -0
- package/dist/backends/graph/GraphDatabaseAdapter.js.map +1 -0
- package/dist/backends/hnswlib/HNSWLibBackend.d.ts +92 -0
- package/dist/backends/hnswlib/HNSWLibBackend.d.ts.map +1 -0
- package/dist/backends/hnswlib/HNSWLibBackend.js +316 -0
- package/dist/backends/hnswlib/HNSWLibBackend.js.map +1 -0
- package/dist/backends/hnswlib/index.d.ts +7 -0
- package/dist/backends/hnswlib/index.d.ts.map +1 -0
- package/dist/backends/hnswlib/index.js +7 -0
- package/dist/backends/hnswlib/index.js.map +1 -0
- package/dist/backends/index.d.ts +14 -0
- package/dist/backends/index.d.ts.map +1 -0
- package/dist/backends/index.js +13 -0
- package/dist/backends/index.js.map +1 -0
- package/dist/backends/ruvector/RuVectorBackend.d.ts +75 -0
- package/dist/backends/ruvector/RuVectorBackend.d.ts.map +1 -0
- package/dist/backends/ruvector/RuVectorBackend.js +198 -0
- package/dist/backends/ruvector/RuVectorBackend.js.map +1 -0
- package/dist/backends/ruvector/RuVectorLearning.d.ts +104 -0
- package/dist/backends/ruvector/RuVectorLearning.d.ts.map +1 -0
- package/dist/backends/ruvector/RuVectorLearning.js +177 -0
- package/dist/backends/ruvector/RuVectorLearning.js.map +1 -0
- package/dist/backends/ruvector/index.d.ts +9 -0
- package/dist/backends/ruvector/index.d.ts.map +1 -0
- package/dist/backends/ruvector/index.js +8 -0
- package/dist/backends/ruvector/index.js.map +1 -0
- package/dist/browser/AdvancedFeatures.d.ts +144 -0
- package/dist/browser/AdvancedFeatures.d.ts.map +1 -0
- package/dist/browser/AdvancedFeatures.js +430 -0
- package/dist/browser/AdvancedFeatures.js.map +1 -0
- package/dist/browser/HNSWIndex.d.ts +117 -0
- package/dist/browser/HNSWIndex.d.ts.map +1 -0
- package/dist/browser/HNSWIndex.js +402 -0
- package/dist/browser/HNSWIndex.js.map +1 -0
- package/dist/browser/ProductQuantization.d.ts +107 -0
- package/dist/browser/ProductQuantization.d.ts.map +1 -0
- package/dist/browser/ProductQuantization.js +337 -0
- package/dist/browser/ProductQuantization.js.map +1 -0
- package/dist/browser/browser/AdvancedFeatures.d.ts +144 -0
- package/dist/browser/browser/AdvancedFeatures.d.ts.map +1 -0
- package/dist/browser/browser/AdvancedFeatures.js +427 -0
- package/dist/browser/browser/HNSWIndex.d.ts +117 -0
- package/dist/browser/browser/HNSWIndex.d.ts.map +1 -0
- package/dist/browser/browser/HNSWIndex.js +402 -0
- package/dist/browser/browser/ProductQuantization.d.ts +107 -0
- package/dist/browser/browser/ProductQuantization.d.ts.map +1 -0
- package/dist/browser/browser/ProductQuantization.js +348 -0
- package/dist/browser/browser/index.d.ts +223 -0
- package/dist/browser/browser/index.d.ts.map +1 -0
- package/dist/browser/browser/index.js +233 -0
- package/dist/browser/index.d.ts +223 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +225 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/cli/agentdb-cli.d.ts.map +1 -1
- package/dist/cli/agentdb-cli.js +130 -8
- package/dist/cli/agentdb-cli.js.map +1 -1
- package/dist/cli/agentdb.db +0 -0
- package/dist/cli/commands/init.d.ts +12 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +115 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/install-embeddings.d.ts +10 -0
- package/dist/cli/commands/install-embeddings.d.ts.map +1 -0
- package/dist/cli/commands/install-embeddings.js +68 -0
- package/dist/cli/commands/install-embeddings.js.map +1 -0
- package/dist/cli/commands/migrate.d.ts +15 -0
- package/dist/cli/commands/migrate.d.ts.map +1 -0
- package/dist/cli/commands/migrate.js +425 -0
- package/dist/cli/commands/migrate.js.map +1 -0
- package/dist/cli/commands/status.d.ts +10 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +129 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/controllers/CausalRecall.d.ts +3 -1
- package/dist/controllers/CausalRecall.d.ts.map +1 -1
- package/dist/controllers/CausalRecall.js +35 -4
- package/dist/controllers/CausalRecall.js.map +1 -1
- package/dist/controllers/ExplainableRecall.d.ts +24 -0
- package/dist/controllers/ExplainableRecall.d.ts.map +1 -1
- package/dist/controllers/ExplainableRecall.js +102 -5
- package/dist/controllers/ExplainableRecall.js.map +1 -1
- package/dist/controllers/HNSWIndex.d.ts +128 -0
- package/dist/controllers/HNSWIndex.d.ts.map +1 -0
- package/dist/controllers/HNSWIndex.js +361 -0
- package/dist/controllers/HNSWIndex.js.map +1 -0
- package/dist/controllers/NightlyLearner.d.ts.map +1 -1
- package/dist/controllers/NightlyLearner.js +7 -4
- package/dist/controllers/NightlyLearner.js.map +1 -1
- package/dist/controllers/ReasoningBank.d.ts +101 -2
- package/dist/controllers/ReasoningBank.d.ts.map +1 -1
- package/dist/controllers/ReasoningBank.js +196 -4
- package/dist/controllers/ReasoningBank.js.map +1 -1
- package/dist/controllers/ReflexionMemory.d.ts +41 -1
- package/dist/controllers/ReflexionMemory.d.ts.map +1 -1
- package/dist/controllers/ReflexionMemory.js +282 -5
- package/dist/controllers/ReflexionMemory.js.map +1 -1
- package/dist/controllers/SkillLibrary.d.ts +27 -9
- package/dist/controllers/SkillLibrary.d.ts.map +1 -1
- package/dist/controllers/SkillLibrary.js +136 -47
- package/dist/controllers/SkillLibrary.js.map +1 -1
- package/dist/controllers/index.d.ts +2 -0
- package/dist/controllers/index.d.ts.map +1 -1
- package/dist/controllers/index.js +1 -0
- package/dist/controllers/index.js.map +1 -1
- package/dist/db-fallback.d.ts.map +1 -1
- package/dist/db-fallback.js +100 -29
- package/dist/db-fallback.js.map +1 -1
- package/dist/db-test.d.ts +13 -0
- package/dist/db-test.d.ts.map +1 -0
- package/dist/db-test.js +55 -0
- package/dist/db-test.js.map +1 -0
- package/dist/db-unified.d.ts +76 -0
- package/dist/db-unified.d.ts.map +1 -0
- package/dist/db-unified.js +278 -0
- package/dist/db-unified.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/malp/core/ccc.d.ts +99 -0
- package/dist/malp/core/ccc.d.ts.map +1 -0
- package/dist/malp/core/ccc.js +181 -0
- package/dist/malp/core/ccc.js.map +1 -0
- package/dist/malp/core/index.d.ts +9 -0
- package/dist/malp/core/index.d.ts.map +1 -0
- package/dist/malp/core/index.js +9 -0
- package/dist/malp/core/index.js.map +1 -0
- package/dist/malp/core/linalg.d.ts +101 -0
- package/dist/malp/core/linalg.d.ts.map +1 -0
- package/dist/malp/core/linalg.js +278 -0
- package/dist/malp/core/linalg.js.map +1 -0
- package/dist/malp/core/optimizer.d.ts +68 -0
- package/dist/malp/core/optimizer.d.ts.map +1 -0
- package/dist/malp/core/optimizer.js +160 -0
- package/dist/malp/core/optimizer.js.map +1 -0
- package/dist/malp/index.d.ts +33 -0
- package/dist/malp/index.d.ts.map +1 -0
- package/dist/malp/index.js +37 -0
- package/dist/malp/index.js.map +1 -0
- package/dist/malp/metrics/agreement.d.ts +106 -0
- package/dist/malp/metrics/agreement.d.ts.map +1 -0
- package/dist/malp/metrics/agreement.js +199 -0
- package/dist/malp/metrics/agreement.js.map +1 -0
- package/dist/malp/metrics/comparison.d.ts +93 -0
- package/dist/malp/metrics/comparison.d.ts.map +1 -0
- package/dist/malp/metrics/comparison.js +256 -0
- package/dist/malp/metrics/comparison.js.map +1 -0
- package/dist/malp/metrics/index.d.ts +8 -0
- package/dist/malp/metrics/index.d.ts.map +1 -0
- package/dist/malp/metrics/index.js +8 -0
- package/dist/malp/metrics/index.js.map +1 -0
- package/dist/malp/metrics/performance.d.ts +61 -0
- package/dist/malp/metrics/performance.d.ts.map +1 -0
- package/dist/malp/metrics/performance.js +190 -0
- package/dist/malp/metrics/performance.js.map +1 -0
- package/dist/malp/models/index.d.ts +7 -0
- package/dist/malp/models/index.d.ts.map +1 -0
- package/dist/malp/models/index.js +7 -0
- package/dist/malp/models/index.js.map +1 -0
- package/dist/malp/models/malp.d.ts +116 -0
- package/dist/malp/models/malp.d.ts.map +1 -0
- package/dist/malp/models/malp.js +206 -0
- package/dist/malp/models/malp.js.map +1 -0
- package/dist/malp/models/regressor.d.ts +80 -0
- package/dist/malp/models/regressor.d.ts.map +1 -0
- package/dist/malp/models/regressor.js +229 -0
- package/dist/malp/models/regressor.js.map +1 -0
- package/dist/malp/reasoningbank_validator.d.ts +187 -0
- package/dist/malp/reasoningbank_validator.d.ts.map +1 -0
- package/dist/malp/reasoningbank_validator.js +246 -0
- package/dist/malp/reasoningbank_validator.js.map +1 -0
- package/dist/malp/wasm_bindings.d.ts +344 -0
- package/dist/malp/wasm_bindings.d.ts.map +1 -0
- package/dist/malp/wasm_bindings.js +9 -0
- package/dist/malp/wasm_bindings.js.map +1 -0
- package/dist/mcp/agentdb-mcp-server.js +512 -33
- package/dist/mcp/agentdb-mcp-server.js.map +1 -1
- package/dist/optimizations/BatchOperations.d.ts +42 -0
- package/dist/optimizations/BatchOperations.d.ts.map +1 -1
- package/dist/optimizations/BatchOperations.js +181 -0
- package/dist/optimizations/BatchOperations.js.map +1 -1
- package/dist/optimizations/ToolCache.d.ts +137 -0
- package/dist/optimizations/ToolCache.d.ts.map +1 -0
- package/dist/optimizations/ToolCache.js +281 -0
- package/dist/optimizations/ToolCache.js.map +1 -0
- package/dist/security/input-validation.d.ts +24 -0
- package/dist/security/input-validation.d.ts.map +1 -1
- package/dist/security/input-validation.js +106 -0
- package/dist/security/input-validation.js.map +1 -1
- package/dist/security/limits.d.ts +150 -0
- package/dist/security/limits.d.ts.map +1 -0
- package/dist/security/limits.js +288 -0
- package/dist/security/limits.js.map +1 -0
- package/dist/security/path-security.d.ts +100 -0
- package/dist/security/path-security.d.ts.map +1 -0
- package/dist/security/path-security.js +337 -0
- package/dist/security/path-security.js.map +1 -0
- package/dist/security/validation.d.ts +95 -0
- package/dist/security/validation.d.ts.map +1 -0
- package/dist/security/validation.js +315 -0
- package/dist/security/validation.js.map +1 -0
- package/dist/simulation/cli.d.ts +9 -0
- package/dist/simulation/cli.d.ts.map +1 -0
- package/dist/simulation/cli.js +68 -0
- package/dist/simulation/cli.js.map +1 -0
- package/dist/simulation/runner.d.ts +21 -0
- package/dist/simulation/runner.d.ts.map +1 -0
- package/dist/simulation/runner.js +241 -0
- package/dist/simulation/runner.js.map +1 -0
- package/dist/simulation/scenarios/aidefence-integration.d.ts +24 -0
- package/dist/simulation/scenarios/aidefence-integration.d.ts.map +1 -0
- package/dist/simulation/scenarios/aidefence-integration.js +124 -0
- package/dist/simulation/scenarios/aidefence-integration.js.map +1 -0
- package/dist/simulation/scenarios/bmssp-integration.d.ts +23 -0
- package/dist/simulation/scenarios/bmssp-integration.d.ts.map +1 -0
- package/dist/simulation/scenarios/bmssp-integration.js +104 -0
- package/dist/simulation/scenarios/bmssp-integration.js.map +1 -0
- package/dist/simulation/scenarios/causal-reasoning.d.ts +16 -0
- package/dist/simulation/scenarios/causal-reasoning.d.ts.map +1 -0
- package/dist/simulation/scenarios/causal-reasoning.js +108 -0
- package/dist/simulation/scenarios/causal-reasoning.js.map +1 -0
- package/dist/simulation/scenarios/consciousness-explorer.d.ts +25 -0
- package/dist/simulation/scenarios/consciousness-explorer.d.ts.map +1 -0
- package/dist/simulation/scenarios/consciousness-explorer.js +108 -0
- package/dist/simulation/scenarios/consciousness-explorer.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.d.ts +135 -0
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.js +158 -0
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/index.d.ts +14 -0
- package/dist/simulation/scenarios/domain-examples/index.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/index.js +14 -0
- package/dist/simulation/scenarios/domain-examples/index.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.d.ts +178 -0
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.js +218 -0
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/medical-imaging.d.ts +122 -0
- package/dist/simulation/scenarios/domain-examples/medical-imaging.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/medical-imaging.js +129 -0
- package/dist/simulation/scenarios/domain-examples/medical-imaging.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.d.ts +166 -0
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.js +161 -0
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/scientific-research.d.ts +151 -0
- package/dist/simulation/scenarios/domain-examples/scientific-research.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/scientific-research.js +187 -0
- package/dist/simulation/scenarios/domain-examples/scientific-research.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/trading-systems.d.ts +102 -0
- package/dist/simulation/scenarios/domain-examples/trading-systems.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/trading-systems.js +100 -0
- package/dist/simulation/scenarios/domain-examples/trading-systems.js.map +1 -0
- package/dist/simulation/scenarios/goalie-integration.d.ts +24 -0
- package/dist/simulation/scenarios/goalie-integration.d.ts.map +1 -0
- package/dist/simulation/scenarios/goalie-integration.js +121 -0
- package/dist/simulation/scenarios/goalie-integration.js.map +1 -0
- package/dist/simulation/scenarios/graph-traversal.d.ts +17 -0
- package/dist/simulation/scenarios/graph-traversal.d.ts.map +1 -0
- package/dist/simulation/scenarios/graph-traversal.js +101 -0
- package/dist/simulation/scenarios/graph-traversal.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/attention-analysis.d.ts +45 -0
- package/dist/simulation/scenarios/latent-space/attention-analysis.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/attention-analysis.js +435 -0
- package/dist/simulation/scenarios/latent-space/attention-analysis.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/clustering-analysis.d.ts +55 -0
- package/dist/simulation/scenarios/latent-space/clustering-analysis.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/clustering-analysis.js +606 -0
- package/dist/simulation/scenarios/latent-space/clustering-analysis.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.d.ts +74 -0
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.js +391 -0
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.d.ts +51 -0
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.js +536 -0
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/index.d.ts +35 -0
- package/dist/simulation/scenarios/latent-space/index.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/index.js +35 -0
- package/dist/simulation/scenarios/latent-space/index.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/neural-augmentation.d.ts +52 -0
- package/dist/simulation/scenarios/latent-space/neural-augmentation.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/neural-augmentation.js +472 -0
- package/dist/simulation/scenarios/latent-space/neural-augmentation.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.d.ts +53 -0
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.js +391 -0
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.d.ts +52 -0
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.js +514 -0
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/traversal-optimization.d.ts +53 -0
- package/dist/simulation/scenarios/latent-space/traversal-optimization.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/traversal-optimization.js +595 -0
- package/dist/simulation/scenarios/latent-space/traversal-optimization.js.map +1 -0
- package/dist/simulation/scenarios/lean-agentic-swarm.d.ts +18 -0
- package/dist/simulation/scenarios/lean-agentic-swarm.d.ts.map +1 -0
- package/dist/simulation/scenarios/lean-agentic-swarm.js +132 -0
- package/dist/simulation/scenarios/lean-agentic-swarm.js.map +1 -0
- package/dist/simulation/scenarios/multi-agent-swarm.d.ts +17 -0
- package/dist/simulation/scenarios/multi-agent-swarm.d.ts.map +1 -0
- package/dist/simulation/scenarios/multi-agent-swarm.js +111 -0
- package/dist/simulation/scenarios/multi-agent-swarm.js.map +1 -0
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.d.ts +23 -0
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.d.ts.map +1 -0
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.js +98 -0
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.js.map +1 -0
- package/dist/simulation/scenarios/reflexion-learning.d.ts +16 -0
- package/dist/simulation/scenarios/reflexion-learning.d.ts.map +1 -0
- package/dist/simulation/scenarios/reflexion-learning.js +98 -0
- package/dist/simulation/scenarios/reflexion-learning.js.map +1 -0
- package/dist/simulation/scenarios/research-swarm.d.ts +24 -0
- package/dist/simulation/scenarios/research-swarm.d.ts.map +1 -0
- package/dist/simulation/scenarios/research-swarm.js +146 -0
- package/dist/simulation/scenarios/research-swarm.js.map +1 -0
- package/dist/simulation/scenarios/skill-evolution.d.ts +16 -0
- package/dist/simulation/scenarios/skill-evolution.d.ts.map +1 -0
- package/dist/simulation/scenarios/skill-evolution.js +109 -0
- package/dist/simulation/scenarios/skill-evolution.js.map +1 -0
- package/dist/simulation/scenarios/stock-market-emergence.d.ts +33 -0
- package/dist/simulation/scenarios/stock-market-emergence.d.ts.map +1 -0
- package/dist/simulation/scenarios/stock-market-emergence.js +246 -0
- package/dist/simulation/scenarios/stock-market-emergence.js.map +1 -0
- package/dist/simulation/scenarios/strange-loops.d.ts +18 -0
- package/dist/simulation/scenarios/strange-loops.d.ts.map +1 -0
- package/dist/simulation/scenarios/strange-loops.js +133 -0
- package/dist/simulation/scenarios/strange-loops.js.map +1 -0
- package/dist/simulation/scenarios/sublinear-solver.d.ts +22 -0
- package/dist/simulation/scenarios/sublinear-solver.d.ts.map +1 -0
- package/dist/simulation/scenarios/sublinear-solver.js +82 -0
- package/dist/simulation/scenarios/sublinear-solver.js.map +1 -0
- package/dist/simulation/scenarios/temporal-lead-solver.d.ts +23 -0
- package/dist/simulation/scenarios/temporal-lead-solver.d.ts.map +1 -0
- package/dist/simulation/scenarios/temporal-lead-solver.js +90 -0
- package/dist/simulation/scenarios/temporal-lead-solver.js.map +1 -0
- package/dist/simulation/scenarios/voting-system-consensus.d.ts +27 -0
- package/dist/simulation/scenarios/voting-system-consensus.d.ts.map +1 -0
- package/dist/simulation/scenarios/voting-system-consensus.js +175 -0
- package/dist/simulation/scenarios/voting-system-consensus.js.map +1 -0
- package/dist/simulation/types.d.ts +162 -0
- package/dist/simulation/types.d.ts.map +1 -0
- package/dist/simulation/types.js +5 -0
- package/dist/simulation/types.js.map +1 -0
- package/dist/simulation/utils/PerformanceOptimizer.d.ts +115 -0
- package/dist/simulation/utils/PerformanceOptimizer.d.ts.map +1 -0
- package/dist/simulation/utils/PerformanceOptimizer.js +223 -0
- package/dist/simulation/utils/PerformanceOptimizer.js.map +1 -0
- package/dist/src/backends/GraphBackend.d.ts +196 -0
- package/dist/src/backends/GraphBackend.d.ts.map +1 -0
- package/dist/src/backends/GraphBackend.js +33 -0
- package/dist/src/backends/GraphBackend.js.map +1 -0
- package/dist/src/backends/LearningBackend.d.ts +148 -0
- package/dist/src/backends/LearningBackend.d.ts.map +1 -0
- package/dist/src/backends/LearningBackend.js +27 -0
- package/dist/src/backends/LearningBackend.js.map +1 -0
- package/dist/src/backends/VectorBackend.d.ts +119 -0
- package/dist/src/backends/VectorBackend.d.ts.map +1 -0
- package/dist/src/backends/VectorBackend.js +14 -0
- package/dist/src/backends/VectorBackend.js.map +1 -0
- package/dist/src/backends/detector.d.ts +81 -0
- package/dist/src/backends/detector.d.ts.map +1 -0
- package/dist/src/backends/detector.js +192 -0
- package/dist/src/backends/detector.js.map +1 -0
- package/dist/src/backends/factory.d.ts +50 -0
- package/dist/src/backends/factory.d.ts.map +1 -0
- package/dist/src/backends/factory.js +161 -0
- package/dist/src/backends/factory.js.map +1 -0
- package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts +151 -0
- package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts.map +1 -0
- package/dist/src/backends/graph/GraphDatabaseAdapter.js +224 -0
- package/dist/src/backends/graph/GraphDatabaseAdapter.js.map +1 -0
- package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts +92 -0
- package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts.map +1 -0
- package/dist/src/backends/hnswlib/HNSWLibBackend.js +316 -0
- package/dist/src/backends/hnswlib/HNSWLibBackend.js.map +1 -0
- package/dist/src/backends/hnswlib/index.d.ts +7 -0
- package/dist/src/backends/hnswlib/index.d.ts.map +1 -0
- package/dist/src/backends/hnswlib/index.js +7 -0
- package/dist/src/backends/hnswlib/index.js.map +1 -0
- package/dist/src/backends/index.d.ts +14 -0
- package/dist/src/backends/index.d.ts.map +1 -0
- package/dist/src/backends/index.js +13 -0
- package/dist/src/backends/index.js.map +1 -0
- package/dist/src/backends/ruvector/RuVectorBackend.d.ts +75 -0
- package/dist/src/backends/ruvector/RuVectorBackend.d.ts.map +1 -0
- package/dist/src/backends/ruvector/RuVectorBackend.js +198 -0
- package/dist/src/backends/ruvector/RuVectorBackend.js.map +1 -0
- package/dist/src/backends/ruvector/RuVectorLearning.d.ts +104 -0
- package/dist/src/backends/ruvector/RuVectorLearning.d.ts.map +1 -0
- package/dist/src/backends/ruvector/RuVectorLearning.js +177 -0
- package/dist/src/backends/ruvector/RuVectorLearning.js.map +1 -0
- package/dist/src/backends/ruvector/index.d.ts +9 -0
- package/dist/src/backends/ruvector/index.d.ts.map +1 -0
- package/dist/src/backends/ruvector/index.js +8 -0
- package/dist/src/backends/ruvector/index.js.map +1 -0
- package/dist/src/benchmarks/wasm-vector-benchmark.d.ts +10 -0
- package/dist/src/benchmarks/wasm-vector-benchmark.d.ts.map +1 -0
- package/dist/src/benchmarks/wasm-vector-benchmark.js +196 -0
- package/dist/src/benchmarks/wasm-vector-benchmark.js.map +1 -0
- package/dist/src/browser/AdvancedFeatures.d.ts +144 -0
- package/dist/src/browser/AdvancedFeatures.d.ts.map +1 -0
- package/dist/src/browser/AdvancedFeatures.js +430 -0
- package/dist/src/browser/AdvancedFeatures.js.map +1 -0
- package/dist/src/browser/HNSWIndex.d.ts +117 -0
- package/dist/src/browser/HNSWIndex.d.ts.map +1 -0
- package/dist/src/browser/HNSWIndex.js +402 -0
- package/dist/src/browser/HNSWIndex.js.map +1 -0
- package/dist/src/browser/ProductQuantization.d.ts +107 -0
- package/dist/src/browser/ProductQuantization.d.ts.map +1 -0
- package/dist/src/browser/ProductQuantization.js +337 -0
- package/dist/src/browser/ProductQuantization.js.map +1 -0
- package/dist/src/browser/index.d.ts +223 -0
- package/dist/src/browser/index.d.ts.map +1 -0
- package/dist/src/browser/index.js +225 -0
- package/dist/src/browser/index.js.map +1 -0
- package/dist/src/cli/agentdb-cli.d.ts +154 -0
- package/dist/src/cli/agentdb-cli.d.ts.map +1 -0
- package/dist/src/cli/agentdb-cli.js +2273 -0
- package/dist/src/cli/agentdb-cli.js.map +1 -0
- package/dist/src/cli/commands/init.d.ts +12 -0
- package/dist/src/cli/commands/init.d.ts.map +1 -0
- package/dist/src/cli/commands/init.js +115 -0
- package/dist/src/cli/commands/init.js.map +1 -0
- package/dist/src/cli/commands/install-embeddings.d.ts +10 -0
- package/dist/src/cli/commands/install-embeddings.d.ts.map +1 -0
- package/dist/src/cli/commands/install-embeddings.js +68 -0
- package/dist/src/cli/commands/install-embeddings.js.map +1 -0
- package/dist/src/cli/commands/migrate.d.ts +15 -0
- package/dist/src/cli/commands/migrate.d.ts.map +1 -0
- package/dist/src/cli/commands/migrate.js +425 -0
- package/dist/src/cli/commands/migrate.js.map +1 -0
- package/dist/src/cli/commands/simulate-custom.d.ts +26 -0
- package/dist/src/cli/commands/simulate-custom.d.ts.map +1 -0
- package/dist/src/cli/commands/simulate-custom.js +207 -0
- package/dist/src/cli/commands/simulate-custom.js.map +1 -0
- package/dist/src/cli/commands/simulate-report.d.ts +15 -0
- package/dist/src/cli/commands/simulate-report.d.ts.map +1 -0
- package/dist/src/cli/commands/simulate-report.js +136 -0
- package/dist/src/cli/commands/simulate-report.js.map +1 -0
- package/dist/src/cli/commands/simulate-wizard.d.ts +6 -0
- package/dist/src/cli/commands/simulate-wizard.d.ts.map +1 -0
- package/dist/src/cli/commands/simulate-wizard.js +352 -0
- package/dist/src/cli/commands/simulate-wizard.js.map +1 -0
- package/dist/src/cli/commands/simulate.d.ts +7 -0
- package/dist/src/cli/commands/simulate.d.ts.map +1 -0
- package/dist/src/cli/commands/simulate.js +100 -0
- package/dist/src/cli/commands/simulate.js.map +1 -0
- package/dist/src/cli/commands/status.d.ts +10 -0
- package/dist/src/cli/commands/status.d.ts.map +1 -0
- package/dist/src/cli/commands/status.js +129 -0
- package/dist/src/cli/commands/status.js.map +1 -0
- package/dist/src/cli/lib/config-manager.d.ts +110 -0
- package/dist/src/cli/lib/config-manager.d.ts.map +1 -0
- package/dist/src/cli/lib/config-manager.js +512 -0
- package/dist/src/cli/lib/config-manager.js.map +1 -0
- package/dist/src/cli/lib/config-validator.d.ts +43 -0
- package/dist/src/cli/lib/config-validator.d.ts.map +1 -0
- package/dist/src/cli/lib/config-validator.js +217 -0
- package/dist/src/cli/lib/config-validator.js.map +1 -0
- package/dist/src/cli/lib/health-monitor.d.ts +149 -0
- package/dist/src/cli/lib/health-monitor.d.ts.map +1 -0
- package/dist/src/cli/lib/health-monitor.js +380 -0
- package/dist/src/cli/lib/health-monitor.js.map +1 -0
- package/dist/src/cli/lib/help-formatter.d.ts +38 -0
- package/dist/src/cli/lib/help-formatter.d.ts.map +1 -0
- package/dist/src/cli/lib/help-formatter.js +357 -0
- package/dist/src/cli/lib/help-formatter.js.map +1 -0
- package/dist/src/cli/lib/history-tracker.d.ts +103 -0
- package/dist/src/cli/lib/history-tracker.d.ts.map +1 -0
- package/dist/src/cli/lib/history-tracker.js +346 -0
- package/dist/src/cli/lib/history-tracker.js.map +1 -0
- package/dist/src/cli/lib/report-generator.d.ts +24 -0
- package/dist/src/cli/lib/report-generator.d.ts.map +1 -0
- package/dist/src/cli/lib/report-generator.js +417 -0
- package/dist/src/cli/lib/report-generator.js.map +1 -0
- package/dist/src/cli/lib/report-store.d.ts +116 -0
- package/dist/src/cli/lib/report-store.d.ts.map +1 -0
- package/dist/src/cli/lib/report-store.js +464 -0
- package/dist/src/cli/lib/report-store.js.map +1 -0
- package/dist/src/cli/lib/simulation-registry.d.ts +165 -0
- package/dist/src/cli/lib/simulation-registry.d.ts.map +1 -0
- package/dist/src/cli/lib/simulation-registry.js +332 -0
- package/dist/src/cli/lib/simulation-registry.js.map +1 -0
- package/dist/src/cli/lib/simulation-runner.d.ts +90 -0
- package/dist/src/cli/lib/simulation-runner.d.ts.map +1 -0
- package/dist/src/cli/lib/simulation-runner.js +211 -0
- package/dist/src/cli/lib/simulation-runner.js.map +1 -0
- package/dist/src/controllers/CausalMemoryGraph.d.ts +127 -0
- package/dist/src/controllers/CausalMemoryGraph.d.ts.map +1 -0
- package/dist/src/controllers/CausalMemoryGraph.js +354 -0
- package/dist/src/controllers/CausalMemoryGraph.js.map +1 -0
- package/dist/src/controllers/CausalRecall.d.ts +139 -0
- package/dist/src/controllers/CausalRecall.d.ts.map +1 -0
- package/dist/src/controllers/CausalRecall.js +356 -0
- package/dist/src/controllers/CausalRecall.js.map +1 -0
- package/dist/src/controllers/ContextSynthesizer.d.ts +65 -0
- package/dist/src/controllers/ContextSynthesizer.d.ts.map +1 -0
- package/dist/src/controllers/ContextSynthesizer.js +208 -0
- package/dist/src/controllers/ContextSynthesizer.js.map +1 -0
- package/dist/src/controllers/EmbeddingService.d.ts +37 -0
- package/dist/src/controllers/EmbeddingService.d.ts.map +1 -0
- package/dist/src/controllers/EmbeddingService.js +136 -0
- package/dist/src/controllers/EmbeddingService.js.map +1 -0
- package/dist/src/controllers/EnhancedEmbeddingService.d.ts +50 -0
- package/dist/src/controllers/EnhancedEmbeddingService.d.ts.map +1 -0
- package/dist/src/controllers/EnhancedEmbeddingService.js +119 -0
- package/dist/src/controllers/EnhancedEmbeddingService.js.map +1 -0
- package/dist/src/controllers/ExplainableRecall.d.ts +163 -0
- package/dist/src/controllers/ExplainableRecall.d.ts.map +1 -0
- package/dist/src/controllers/ExplainableRecall.js +485 -0
- package/dist/src/controllers/ExplainableRecall.js.map +1 -0
- package/dist/src/controllers/HNSWIndex.d.ts +128 -0
- package/dist/src/controllers/HNSWIndex.d.ts.map +1 -0
- package/dist/src/controllers/HNSWIndex.js +361 -0
- package/dist/src/controllers/HNSWIndex.js.map +1 -0
- package/dist/src/controllers/LearningSystem.d.ts +195 -0
- package/dist/src/controllers/LearningSystem.d.ts.map +1 -0
- package/dist/src/controllers/LearningSystem.js +929 -0
- package/dist/src/controllers/LearningSystem.js.map +1 -0
- package/dist/src/controllers/MMRDiversityRanker.d.ts +50 -0
- package/dist/src/controllers/MMRDiversityRanker.d.ts.map +1 -0
- package/dist/src/controllers/MMRDiversityRanker.js +130 -0
- package/dist/src/controllers/MMRDiversityRanker.js.map +1 -0
- package/dist/src/controllers/MetadataFilter.d.ts +70 -0
- package/dist/src/controllers/MetadataFilter.d.ts.map +1 -0
- package/dist/src/controllers/MetadataFilter.js +243 -0
- package/dist/src/controllers/MetadataFilter.js.map +1 -0
- package/dist/src/controllers/NightlyLearner.d.ts +114 -0
- package/dist/src/controllers/NightlyLearner.d.ts.map +1 -0
- package/dist/src/controllers/NightlyLearner.js +394 -0
- package/dist/src/controllers/NightlyLearner.js.map +1 -0
- package/dist/src/controllers/QUICClient.d.ts +109 -0
- package/dist/src/controllers/QUICClient.d.ts.map +1 -0
- package/dist/src/controllers/QUICClient.js +299 -0
- package/dist/src/controllers/QUICClient.js.map +1 -0
- package/dist/src/controllers/QUICServer.d.ts +121 -0
- package/dist/src/controllers/QUICServer.d.ts.map +1 -0
- package/dist/src/controllers/QUICServer.js +383 -0
- package/dist/src/controllers/QUICServer.js.map +1 -0
- package/dist/src/controllers/ReasoningBank.d.ts +196 -0
- package/dist/src/controllers/ReasoningBank.d.ts.map +1 -0
- package/dist/src/controllers/ReasoningBank.js +494 -0
- package/dist/src/controllers/ReasoningBank.js.map +1 -0
- package/dist/src/controllers/ReflexionMemory.d.ts +125 -0
- package/dist/src/controllers/ReflexionMemory.d.ts.map +1 -0
- package/dist/src/controllers/ReflexionMemory.js +654 -0
- package/dist/src/controllers/ReflexionMemory.js.map +1 -0
- package/dist/src/controllers/SkillLibrary.d.ts +150 -0
- package/dist/src/controllers/SkillLibrary.d.ts.map +1 -0
- package/dist/src/controllers/SkillLibrary.js +608 -0
- package/dist/src/controllers/SkillLibrary.js.map +1 -0
- package/dist/src/controllers/SyncCoordinator.d.ts +120 -0
- package/dist/src/controllers/SyncCoordinator.d.ts.map +1 -0
- package/dist/src/controllers/SyncCoordinator.js +441 -0
- package/dist/src/controllers/SyncCoordinator.js.map +1 -0
- package/dist/src/controllers/WASMVectorSearch.d.ts +89 -0
- package/dist/src/controllers/WASMVectorSearch.d.ts.map +1 -0
- package/dist/src/controllers/WASMVectorSearch.js +234 -0
- package/dist/src/controllers/WASMVectorSearch.js.map +1 -0
- package/dist/src/controllers/frontier-index.d.ts +14 -0
- package/dist/src/controllers/frontier-index.d.ts.map +1 -0
- package/dist/src/controllers/frontier-index.js +10 -0
- package/dist/src/controllers/frontier-index.js.map +1 -0
- package/dist/src/controllers/index.d.ts +30 -0
- package/dist/src/controllers/index.d.ts.map +1 -0
- package/dist/src/controllers/index.js +18 -0
- package/dist/src/controllers/index.js.map +1 -0
- package/dist/src/db-fallback.d.ts +26 -0
- package/dist/src/db-fallback.d.ts.map +1 -0
- package/dist/src/db-fallback.js +264 -0
- package/dist/src/db-fallback.js.map +1 -0
- package/dist/src/db-test.d.ts +13 -0
- package/dist/src/db-test.d.ts.map +1 -0
- package/dist/src/db-test.js +55 -0
- package/dist/src/db-test.js.map +1 -0
- package/dist/src/db-unified.d.ts +76 -0
- package/dist/src/db-unified.d.ts.map +1 -0
- package/dist/src/db-unified.js +279 -0
- package/dist/src/db-unified.js.map +1 -0
- package/dist/src/examples/quic-sync-example.d.ts +9 -0
- package/dist/src/examples/quic-sync-example.d.ts.map +1 -0
- package/dist/src/examples/quic-sync-example.js +169 -0
- package/dist/src/examples/quic-sync-example.js.map +1 -0
- package/dist/src/examples/wasm-vector-usage.d.ts +12 -0
- package/dist/src/examples/wasm-vector-usage.d.ts.map +1 -0
- package/dist/src/examples/wasm-vector-usage.js +190 -0
- package/dist/src/examples/wasm-vector-usage.js.map +1 -0
- package/dist/src/index.d.ts +28 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +35 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/mcp/agentdb-mcp-server.d.ts +8 -0
- package/dist/src/mcp/agentdb-mcp-server.d.ts.map +1 -0
- package/dist/src/mcp/agentdb-mcp-server.js +2116 -0
- package/dist/src/mcp/agentdb-mcp-server.js.map +1 -0
- package/dist/src/mcp/learning-tools-handlers.d.ts +16 -0
- package/dist/src/mcp/learning-tools-handlers.d.ts.map +1 -0
- package/dist/src/mcp/learning-tools-handlers.js +105 -0
- package/dist/src/mcp/learning-tools-handlers.js.map +1 -0
- package/dist/src/optimizations/BatchOperations.d.ts +109 -0
- package/dist/src/optimizations/BatchOperations.d.ts.map +1 -0
- package/dist/src/optimizations/BatchOperations.js +407 -0
- package/dist/src/optimizations/BatchOperations.js.map +1 -0
- package/dist/src/optimizations/QueryOptimizer.d.ts +83 -0
- package/dist/src/optimizations/QueryOptimizer.d.ts.map +1 -0
- package/dist/src/optimizations/QueryOptimizer.js +228 -0
- package/dist/src/optimizations/QueryOptimizer.js.map +1 -0
- package/dist/src/optimizations/ToolCache.d.ts +137 -0
- package/dist/src/optimizations/ToolCache.d.ts.map +1 -0
- package/dist/src/optimizations/ToolCache.js +281 -0
- package/dist/src/optimizations/ToolCache.js.map +1 -0
- package/dist/src/optimizations/index.d.ts +10 -0
- package/dist/src/optimizations/index.d.ts.map +1 -0
- package/dist/src/optimizations/index.js +8 -0
- package/dist/src/optimizations/index.js.map +1 -0
- package/dist/src/security/input-validation.d.ts +109 -0
- package/dist/src/security/input-validation.d.ts.map +1 -0
- package/dist/src/security/input-validation.js +398 -0
- package/dist/src/security/input-validation.js.map +1 -0
- package/dist/src/security/limits.d.ts +150 -0
- package/dist/src/security/limits.d.ts.map +1 -0
- package/dist/src/security/limits.js +288 -0
- package/dist/src/security/limits.js.map +1 -0
- package/dist/src/security/path-security.d.ts +100 -0
- package/dist/src/security/path-security.d.ts.map +1 -0
- package/dist/src/security/path-security.js +337 -0
- package/dist/src/security/path-security.js.map +1 -0
- package/dist/src/security/validation.d.ts +95 -0
- package/dist/src/security/validation.d.ts.map +1 -0
- package/dist/src/security/validation.js +315 -0
- package/dist/src/security/validation.js.map +1 -0
- package/dist/src/services/LLMRouter.d.ts +84 -0
- package/dist/src/services/LLMRouter.d.ts.map +1 -0
- package/dist/src/services/LLMRouter.js +329 -0
- package/dist/src/services/LLMRouter.js.map +1 -0
- package/dist/src/types/quic.d.ts +518 -0
- package/dist/src/types/quic.d.ts.map +1 -0
- package/dist/src/types/quic.js +272 -0
- package/dist/src/types/quic.js.map +1 -0
- package/dist/src/utils/NodeIdMapper.d.ts +38 -0
- package/dist/src/utils/NodeIdMapper.d.ts.map +1 -0
- package/dist/src/utils/NodeIdMapper.js +57 -0
- package/dist/src/utils/NodeIdMapper.js.map +1 -0
- package/package.json +15 -3
- package/scripts/README.md +314 -0
- package/src/backends/GraphBackend.ts +290 -0
- package/src/backends/LearningBackend.ts +210 -0
- package/src/backends/README.md +389 -0
- package/src/backends/VectorBackend.ts +145 -0
- package/src/backends/detector.ts +283 -0
- package/src/backends/factory.ts +193 -0
- package/src/backends/graph/GraphDatabaseAdapter.ts +334 -0
- package/src/backends/hnswlib/HNSWLibBackend.ts +413 -0
- package/src/backends/hnswlib/index.ts +7 -0
- package/src/backends/index.ts +32 -0
- package/src/backends/ruvector/RuVectorBackend.ts +232 -0
- package/src/backends/ruvector/RuVectorLearning.ts +242 -0
- package/src/backends/ruvector/index.ts +9 -0
- package/src/backends/ruvector/types.d.ts +64 -0
- package/src/browser/AdvancedFeatures.ts +565 -0
- package/src/browser/HNSWIndex.ts +494 -0
- package/src/browser/ProductQuantization.ts +419 -0
- package/src/browser/index.ts +301 -0
- package/src/cli/agentdb-cli.ts +131 -8
- package/src/cli/commands/init.ts +148 -0
- package/src/cli/commands/install-embeddings.ts +81 -0
- package/src/cli/commands/migrate.ts +545 -0
- package/src/cli/commands/simulate-custom.ts +232 -0
- package/src/cli/commands/simulate-report.ts +171 -0
- package/src/cli/commands/simulate-wizard.ts +379 -0
- package/src/cli/commands/simulate.ts +115 -0
- package/src/cli/commands/status.ts +156 -0
- package/src/cli/lib/config-manager.ts +627 -0
- package/src/cli/lib/config-validator.ts +261 -0
- package/src/cli/lib/health-monitor.ts +513 -0
- package/src/cli/lib/help-formatter.ts +406 -0
- package/src/cli/lib/history-tracker.ts +497 -0
- package/src/cli/lib/report-generator.ts +455 -0
- package/src/cli/lib/report-store.ts +582 -0
- package/src/cli/lib/simulation-registry.ts +502 -0
- package/src/cli/lib/simulation-runner.ts +291 -0
- package/src/cli/tests/agentdb-cli.test.ts +58 -0
- package/src/controllers/CausalMemoryGraph.ts +42 -2
- package/src/controllers/CausalRecall.ts +41 -4
- package/src/controllers/ExplainableRecall.ts +123 -5
- package/src/controllers/HNSWIndex.ts +495 -0
- package/src/controllers/NightlyLearner.ts +8 -4
- package/src/controllers/ReasoningBank.ts +268 -5
- package/src/controllers/ReflexionMemory.ts +531 -6
- package/src/controllers/SkillLibrary.ts +234 -60
- package/src/controllers/index.ts +2 -0
- package/src/db-fallback.ts +103 -35
- package/src/db-test.ts +59 -0
- package/src/db-unified.ts +327 -0
- package/src/index.ts +2 -1
- package/src/mcp/agentdb-mcp-server.ts +544 -38
- package/src/optimizations/BatchOperations.ts +270 -0
- package/src/optimizations/ToolCache.ts +355 -0
- package/src/security/input-validation.ts +166 -0
- package/src/security/limits.ts +375 -0
- package/src/security/path-security.ts +436 -0
- package/src/security/validation.ts +556 -0
- package/src/services/LLMRouter.ts +406 -0
- package/src/types/xenova-transformers.d.ts +26 -0
- package/src/utils/NodeIdMapper.ts +64 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LearningBackend Interface - GNN self-learning capabilities (Optional)
|
|
3
|
+
*
|
|
4
|
+
* Provides Graph Neural Network (GNN) based learning for query enhancement
|
|
5
|
+
* and adaptive pattern recognition. Available when @ruvector/gnn is installed.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Query enhancement using attention mechanisms
|
|
9
|
+
* - Automatic learning from search patterns
|
|
10
|
+
* - Model persistence and versioning
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Learning backend configuration
|
|
15
|
+
*/
|
|
16
|
+
export interface LearningConfig {
|
|
17
|
+
/** Enable learning features */
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
|
|
20
|
+
/** Input dimension (must match vector dimension) */
|
|
21
|
+
inputDim: number;
|
|
22
|
+
|
|
23
|
+
/** Output dimension (defaults to inputDim) */
|
|
24
|
+
outputDim?: number;
|
|
25
|
+
|
|
26
|
+
/** Number of attention heads for GNN */
|
|
27
|
+
heads?: number;
|
|
28
|
+
|
|
29
|
+
/** Learning rate for training */
|
|
30
|
+
learningRate?: number;
|
|
31
|
+
|
|
32
|
+
/** Batch size for training */
|
|
33
|
+
batchSize?: number;
|
|
34
|
+
|
|
35
|
+
/** Path for model persistence */
|
|
36
|
+
modelPath?: string;
|
|
37
|
+
|
|
38
|
+
/** Auto-train interval in seconds (0 = disabled) */
|
|
39
|
+
autoTrainInterval?: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Training sample for supervised learning
|
|
44
|
+
*/
|
|
45
|
+
export interface TrainingSample {
|
|
46
|
+
/** Input embedding */
|
|
47
|
+
embedding: Float32Array;
|
|
48
|
+
|
|
49
|
+
/** Label or class (for classification) */
|
|
50
|
+
label: number;
|
|
51
|
+
|
|
52
|
+
/** Sample weight (importance) */
|
|
53
|
+
weight?: number;
|
|
54
|
+
|
|
55
|
+
/** Additional context for learning */
|
|
56
|
+
context?: Record<string, any>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Training result metrics
|
|
61
|
+
*/
|
|
62
|
+
export interface TrainingResult {
|
|
63
|
+
/** Number of training epochs completed */
|
|
64
|
+
epochs: number;
|
|
65
|
+
|
|
66
|
+
/** Final loss value */
|
|
67
|
+
finalLoss: number;
|
|
68
|
+
|
|
69
|
+
/** Improvement percentage from initial loss */
|
|
70
|
+
improvement: number;
|
|
71
|
+
|
|
72
|
+
/** Training duration in milliseconds */
|
|
73
|
+
duration: number;
|
|
74
|
+
|
|
75
|
+
/** Additional metrics */
|
|
76
|
+
metrics?: Record<string, number>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Learning backend statistics
|
|
81
|
+
*/
|
|
82
|
+
export interface LearningStats {
|
|
83
|
+
/** Whether learning is enabled */
|
|
84
|
+
enabled: boolean;
|
|
85
|
+
|
|
86
|
+
/** Number of samples collected */
|
|
87
|
+
samplesCollected: number;
|
|
88
|
+
|
|
89
|
+
/** Timestamp of last training (null if never trained) */
|
|
90
|
+
lastTrainingTime: number | null;
|
|
91
|
+
|
|
92
|
+
/** Current model version */
|
|
93
|
+
modelVersion: number;
|
|
94
|
+
|
|
95
|
+
/** Average training loss */
|
|
96
|
+
avgLoss?: number;
|
|
97
|
+
|
|
98
|
+
/** Model accuracy (if applicable) */
|
|
99
|
+
accuracy?: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* LearningBackend - Optional GNN-based learning interface
|
|
104
|
+
*
|
|
105
|
+
* Implementations:
|
|
106
|
+
* - RuVectorLearning: Native Rust GNN with @ruvector/gnn
|
|
107
|
+
* - MockLearningBackend: No-op implementation for testing
|
|
108
|
+
*/
|
|
109
|
+
export interface LearningBackend {
|
|
110
|
+
// ============================================================================
|
|
111
|
+
// GNN Operations
|
|
112
|
+
// ============================================================================
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Enhance query vector using GNN attention mechanism
|
|
116
|
+
*
|
|
117
|
+
* Takes a query vector and its k-nearest neighbors, applies graph attention,
|
|
118
|
+
* and returns an enhanced query vector with better semantic representation.
|
|
119
|
+
*
|
|
120
|
+
* @param query - Query vector to enhance
|
|
121
|
+
* @param neighbors - Neighbor vectors for context
|
|
122
|
+
* @param weights - Importance weights for each neighbor (0-1)
|
|
123
|
+
* @returns Enhanced query vector
|
|
124
|
+
*/
|
|
125
|
+
enhance(
|
|
126
|
+
query: Float32Array,
|
|
127
|
+
neighbors: Float32Array[],
|
|
128
|
+
weights: number[]
|
|
129
|
+
): Float32Array;
|
|
130
|
+
|
|
131
|
+
// ============================================================================
|
|
132
|
+
// Training
|
|
133
|
+
// ============================================================================
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Add a training sample for future learning
|
|
137
|
+
*
|
|
138
|
+
* Samples are accumulated and used during the next training cycle.
|
|
139
|
+
*
|
|
140
|
+
* @param sample - Training sample with embedding and label
|
|
141
|
+
*/
|
|
142
|
+
addSample(sample: TrainingSample): void;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Train the model on accumulated samples
|
|
146
|
+
*
|
|
147
|
+
* @param options - Training options (epochs, etc.)
|
|
148
|
+
* @returns Training result with metrics
|
|
149
|
+
*/
|
|
150
|
+
train(options?: { epochs?: number }): Promise<TrainingResult>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Clear accumulated training samples
|
|
154
|
+
*/
|
|
155
|
+
clearSamples(): void;
|
|
156
|
+
|
|
157
|
+
// ============================================================================
|
|
158
|
+
// Persistence
|
|
159
|
+
// ============================================================================
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Save trained model to disk
|
|
163
|
+
*
|
|
164
|
+
* @param path - File path to save the model
|
|
165
|
+
* @returns Promise that resolves when model is saved
|
|
166
|
+
*/
|
|
167
|
+
saveModel(path: string): Promise<void>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Load trained model from disk
|
|
171
|
+
*
|
|
172
|
+
* @param path - File path to load the model from
|
|
173
|
+
* @returns Promise that resolves when model is loaded
|
|
174
|
+
*/
|
|
175
|
+
loadModel(path: string): Promise<void>;
|
|
176
|
+
|
|
177
|
+
// ============================================================================
|
|
178
|
+
// Stats
|
|
179
|
+
// ============================================================================
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Get learning statistics and metadata
|
|
183
|
+
*
|
|
184
|
+
* @returns Current statistics of the learning backend
|
|
185
|
+
*/
|
|
186
|
+
getStats(): LearningStats;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Reset learning state (clear samples, reset model)
|
|
190
|
+
*/
|
|
191
|
+
reset(): void;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Type guard to check if an object implements LearningBackend
|
|
196
|
+
*/
|
|
197
|
+
export function isLearningBackend(obj: any): obj is LearningBackend {
|
|
198
|
+
return (
|
|
199
|
+
typeof obj === 'object' &&
|
|
200
|
+
obj !== null &&
|
|
201
|
+
typeof obj.enhance === 'function' &&
|
|
202
|
+
typeof obj.addSample === 'function' &&
|
|
203
|
+
typeof obj.train === 'function' &&
|
|
204
|
+
typeof obj.clearSamples === 'function' &&
|
|
205
|
+
typeof obj.saveModel === 'function' &&
|
|
206
|
+
typeof obj.loadModel === 'function' &&
|
|
207
|
+
typeof obj.getStats === 'function' &&
|
|
208
|
+
typeof obj.reset === 'function'
|
|
209
|
+
);
|
|
210
|
+
}
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
# AgentDB v2 Backend Abstraction Layer
|
|
2
|
+
|
|
3
|
+
**Version:** 2.0.0-alpha
|
|
4
|
+
**Status:** Implementation In Progress
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
This directory contains the backend abstraction layer for AgentDB v2, providing a unified interface for vector operations across multiple implementations (RuVector, HNSWLib).
|
|
9
|
+
|
|
10
|
+
## Directory Structure
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
backends/
|
|
14
|
+
├── README.md # This file
|
|
15
|
+
├── index.ts # Public exports
|
|
16
|
+
├── VectorBackend.ts # Core vector interface
|
|
17
|
+
├── LearningBackend.ts # GNN learning interface (optional)
|
|
18
|
+
├── GraphBackend.ts # Graph database interface (optional)
|
|
19
|
+
├── detector.ts # Backend auto-detection
|
|
20
|
+
├── factory.ts # Backend creation and initialization
|
|
21
|
+
├── ruvector/
|
|
22
|
+
│ ├── index.ts
|
|
23
|
+
│ ├── RuVectorBackend.ts # RuVector implementation
|
|
24
|
+
│ ├── RuVectorLearning.ts # GNN implementation
|
|
25
|
+
│ └── RuVectorGraph.ts # Graph implementation (planned)
|
|
26
|
+
└── hnswlib/
|
|
27
|
+
├── index.ts
|
|
28
|
+
└── HNSWLibBackend.ts # HNSWLib adapter
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Recommended: RuVector (150x faster)
|
|
37
|
+
npm install @ruvector/core
|
|
38
|
+
|
|
39
|
+
# Optional: GNN learning
|
|
40
|
+
npm install @ruvector/gnn
|
|
41
|
+
|
|
42
|
+
# Optional: Graph database
|
|
43
|
+
npm install @ruvector/graph-node
|
|
44
|
+
|
|
45
|
+
# Fallback: HNSWLib
|
|
46
|
+
npm install hnswlib-node
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Basic Usage
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { createBackend } from '@agentdb/backends';
|
|
53
|
+
|
|
54
|
+
// Auto-detect best available backend
|
|
55
|
+
const backend = await createBackend('auto', {
|
|
56
|
+
dimension: 384,
|
|
57
|
+
metric: 'cosine'
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Insert vectors
|
|
61
|
+
backend.insert('id1', embedding1, { source: 'pattern1' });
|
|
62
|
+
|
|
63
|
+
// Search
|
|
64
|
+
const results = backend.search(queryEmbedding, 10, {
|
|
65
|
+
threshold: 0.7
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Save/load
|
|
69
|
+
await backend.save('./agentdb/index');
|
|
70
|
+
await backend.load('./agentdb/index');
|
|
71
|
+
|
|
72
|
+
// Cleanup
|
|
73
|
+
backend.close();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Core Interfaces
|
|
77
|
+
|
|
78
|
+
### VectorBackend
|
|
79
|
+
|
|
80
|
+
All vector backends implement this interface:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
interface VectorBackend {
|
|
84
|
+
readonly name: 'ruvector' | 'hnswlib';
|
|
85
|
+
|
|
86
|
+
insert(id: string, embedding: Float32Array, metadata?: Record<string, any>): void;
|
|
87
|
+
insertBatch(items: Array<{id, embedding, metadata?}>): void;
|
|
88
|
+
search(query: Float32Array, k: number, options?: SearchOptions): SearchResult[];
|
|
89
|
+
remove(id: string): boolean;
|
|
90
|
+
|
|
91
|
+
save(path: string): Promise<void>;
|
|
92
|
+
load(path: string): Promise<void>;
|
|
93
|
+
|
|
94
|
+
getStats(): VectorStats;
|
|
95
|
+
close(): void;
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### LearningBackend (Optional)
|
|
100
|
+
|
|
101
|
+
GNN-based learning for query enhancement:
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
interface LearningBackend {
|
|
105
|
+
enhance(query: Float32Array, neighbors: Float32Array[], weights: number[]): Float32Array;
|
|
106
|
+
addSample(sample: TrainingSample): void;
|
|
107
|
+
train(options?: {epochs?: number}): Promise<TrainingResult>;
|
|
108
|
+
saveModel(path: string): Promise<void>;
|
|
109
|
+
loadModel(path: string): Promise<void>;
|
|
110
|
+
getStats(): LearningStats;
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### GraphBackend (Optional)
|
|
115
|
+
|
|
116
|
+
Property graph database with vector integration:
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
interface GraphBackend {
|
|
120
|
+
execute(cypher: string, params?: Record<string, any>): Promise<QueryResult>;
|
|
121
|
+
createNode(labels: string[], properties: Record<string, any>): Promise<string>;
|
|
122
|
+
createRelationship(from: string, to: string, type: string, properties?): Promise<string>;
|
|
123
|
+
traverse(startId: string, pattern: string, options?: TraversalOptions): Promise<GraphNode[]>;
|
|
124
|
+
vectorSearch(query: Float32Array, k: number, contextNodeId?: string): Promise<GraphNode[]>;
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Backend Implementations
|
|
129
|
+
|
|
130
|
+
### RuVector (Recommended)
|
|
131
|
+
|
|
132
|
+
**Package:** `@ruvector/core`
|
|
133
|
+
|
|
134
|
+
**Features:**
|
|
135
|
+
- ✅ Native Rust bindings (Linux, macOS, Windows)
|
|
136
|
+
- ✅ WASM fallback for unsupported platforms
|
|
137
|
+
- ✅ 150x faster search vs brute-force
|
|
138
|
+
- ✅ SIMD acceleration
|
|
139
|
+
- ✅ Tiered compression (4-32x memory reduction)
|
|
140
|
+
|
|
141
|
+
**Performance:**
|
|
142
|
+
- Search: 0.5-2ms per query (native), 5-10ms (WASM)
|
|
143
|
+
- Insert: 10-50ms for 1000 vectors (batch)
|
|
144
|
+
- Memory: ~4 bytes per dimension per vector (with compression)
|
|
145
|
+
|
|
146
|
+
### HNSWLib (Fallback)
|
|
147
|
+
|
|
148
|
+
**Package:** `hnswlib-node`
|
|
149
|
+
|
|
150
|
+
**Features:**
|
|
151
|
+
- ✅ Stable C++ implementation
|
|
152
|
+
- ✅ Proven HNSW algorithm
|
|
153
|
+
- ✅ Wide platform support
|
|
154
|
+
- ❌ No GNN support
|
|
155
|
+
- ❌ No Graph support
|
|
156
|
+
|
|
157
|
+
**Performance:**
|
|
158
|
+
- Search: 1-3ms per query
|
|
159
|
+
- Insert: 20-100ms for 1000 vectors (batch)
|
|
160
|
+
- Memory: ~12 bytes per dimension per vector
|
|
161
|
+
|
|
162
|
+
## Auto-Detection
|
|
163
|
+
|
|
164
|
+
The factory automatically detects available backends:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import { detectBackends } from '@agentdb/backends';
|
|
168
|
+
|
|
169
|
+
const detection = await detectBackends();
|
|
170
|
+
|
|
171
|
+
console.log(detection);
|
|
172
|
+
// {
|
|
173
|
+
// available: 'ruvector',
|
|
174
|
+
// ruvector: {
|
|
175
|
+
// core: true,
|
|
176
|
+
// gnn: true,
|
|
177
|
+
// graph: false,
|
|
178
|
+
// native: true
|
|
179
|
+
// },
|
|
180
|
+
// hnswlib: true
|
|
181
|
+
// }
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Priority:
|
|
185
|
+
1. Check for `@ruvector/core` (preferred)
|
|
186
|
+
2. Check for optional `@ruvector/gnn` and `@ruvector/graph-node`
|
|
187
|
+
3. Fallback to `hnswlib-node` if RuVector unavailable
|
|
188
|
+
4. Clear error messages if no backend available
|
|
189
|
+
|
|
190
|
+
## Configuration
|
|
191
|
+
|
|
192
|
+
### Default Configuration
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
{
|
|
196
|
+
dimension: 384, // Vector dimension
|
|
197
|
+
metric: 'cosine', // Distance metric: 'cosine', 'l2', 'ip'
|
|
198
|
+
maxElements: 100000, // Maximum vectors
|
|
199
|
+
M: 16, // HNSW connections per layer
|
|
200
|
+
efConstruction: 200, // Build quality
|
|
201
|
+
efSearch: 100 // Search quality
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Backend-Specific Tuning
|
|
206
|
+
|
|
207
|
+
**RuVector:**
|
|
208
|
+
```typescript
|
|
209
|
+
{
|
|
210
|
+
dimension: 384,
|
|
211
|
+
metric: 'cosine',
|
|
212
|
+
efConstruction: 200, // Higher = better quality, slower build
|
|
213
|
+
efSearch: 100, // Higher = better quality, slower search
|
|
214
|
+
// Compression enabled automatically
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**HNSWLib:**
|
|
219
|
+
```typescript
|
|
220
|
+
{
|
|
221
|
+
dimension: 384,
|
|
222
|
+
metric: 'cosine',
|
|
223
|
+
M: 16, // Higher = better quality, more memory
|
|
224
|
+
efConstruction: 200,
|
|
225
|
+
efSearch: 100
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Migration from HNSWIndex
|
|
230
|
+
|
|
231
|
+
### Before (v1)
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
import { HNSWIndex } from '@agentdb';
|
|
235
|
+
|
|
236
|
+
const index = new HNSWIndex(db, { dimension: 384, metric: 'cosine' });
|
|
237
|
+
await index.buildIndex('pattern_embeddings');
|
|
238
|
+
const results = await index.search(query, 10);
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### After (v2)
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
import { createBackend } from '@agentdb/backends';
|
|
245
|
+
|
|
246
|
+
const backend = await createBackend('auto', { dimension: 384, metric: 'cosine' });
|
|
247
|
+
const results = backend.search(query, 10);
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**Key Differences:**
|
|
251
|
+
1. String IDs instead of numeric IDs
|
|
252
|
+
2. Synchronous `search()` instead of async
|
|
253
|
+
3. Backend auto-detection
|
|
254
|
+
4. Consistent interface across implementations
|
|
255
|
+
|
|
256
|
+
## Advanced Features
|
|
257
|
+
|
|
258
|
+
### GNN Learning
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
import { RuVectorLearning } from '@agentdb/backends';
|
|
262
|
+
|
|
263
|
+
const learning = new RuVectorLearning({
|
|
264
|
+
enabled: true,
|
|
265
|
+
inputDim: 384,
|
|
266
|
+
heads: 4,
|
|
267
|
+
learningRate: 0.001
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// Enhance query with GNN attention
|
|
271
|
+
const enhanced = learning.enhance(query, neighbors, weights);
|
|
272
|
+
|
|
273
|
+
// Add training samples
|
|
274
|
+
learning.addSample({ embedding: query, label: 1, weight: 0.9 });
|
|
275
|
+
|
|
276
|
+
// Train model
|
|
277
|
+
const result = await learning.train({ epochs: 50 });
|
|
278
|
+
console.log(`Loss: ${result.finalLoss}, Improvement: ${result.improvement}%`);
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Graph Queries
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
import { RuVectorGraph } from '@agentdb/backends';
|
|
285
|
+
|
|
286
|
+
const graph = new RuVectorGraph();
|
|
287
|
+
|
|
288
|
+
// Create nodes
|
|
289
|
+
const node1 = await graph.createNode(['Memory'], { content: 'User likes dark mode' });
|
|
290
|
+
const node2 = await graph.createNode(['Memory'], { content: 'User works late' });
|
|
291
|
+
|
|
292
|
+
// Create relationship
|
|
293
|
+
await graph.createRelationship(node1, node2, 'RELATES_TO', { strength: 0.8 });
|
|
294
|
+
|
|
295
|
+
// Traverse
|
|
296
|
+
const related = await graph.traverse(node1, '()-[:RELATES_TO]->(:Memory)', { maxDepth: 2 });
|
|
297
|
+
|
|
298
|
+
// Hybrid search
|
|
299
|
+
const results = await graph.vectorSearch(queryEmbedding, 10, node1);
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Performance Benchmarking
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
import { createBackend } from '@agentdb/backends';
|
|
306
|
+
|
|
307
|
+
const backend = await createBackend('auto', { dimension: 384, metric: 'cosine' });
|
|
308
|
+
|
|
309
|
+
// Insert 10k vectors
|
|
310
|
+
const items = Array.from({ length: 10000 }, (_, i) => ({
|
|
311
|
+
id: `vec${i}`,
|
|
312
|
+
embedding: new Float32Array(384).map(() => Math.random())
|
|
313
|
+
}));
|
|
314
|
+
|
|
315
|
+
console.time('insertBatch');
|
|
316
|
+
backend.insertBatch(items);
|
|
317
|
+
console.timeEnd('insertBatch');
|
|
318
|
+
// RuVector: ~50ms, HNSWLib: ~200ms
|
|
319
|
+
|
|
320
|
+
// Search
|
|
321
|
+
console.time('search');
|
|
322
|
+
const results = backend.search(queryEmbedding, 10);
|
|
323
|
+
console.timeEnd('search');
|
|
324
|
+
// RuVector: ~1.5ms, HNSWLib: ~3ms
|
|
325
|
+
|
|
326
|
+
// Stats
|
|
327
|
+
const stats = backend.getStats();
|
|
328
|
+
console.log(`Backend: ${stats.backend}`);
|
|
329
|
+
console.log(`Vectors: ${stats.count}`);
|
|
330
|
+
console.log(`Memory: ${(stats.memoryUsage / 1024 / 1024).toFixed(2)} MB`);
|
|
331
|
+
// RuVector: ~15MB, HNSWLib: ~45MB
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## Testing
|
|
335
|
+
|
|
336
|
+
Run backend tests:
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
# Unit tests
|
|
340
|
+
npm test backends
|
|
341
|
+
|
|
342
|
+
# Integration tests
|
|
343
|
+
npm test backends:integration
|
|
344
|
+
|
|
345
|
+
# Benchmark tests
|
|
346
|
+
npm run benchmark:backends
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Related Documentation
|
|
350
|
+
|
|
351
|
+
- [Backend Architecture](/workspaces/agentic-flow/docs/agentdb-v2-backend-architecture.md)
|
|
352
|
+
- [Component Interactions](/workspaces/agentic-flow/docs/agentdb-v2-component-interactions.md)
|
|
353
|
+
- [ADR-001: Backend Abstraction](/workspaces/agentic-flow/plans/agentdb-v2/ADR-001-backend-abstraction.md)
|
|
354
|
+
- [Overall Architecture](/workspaces/agentic-flow/plans/agentdb-v2/ARCHITECTURE.md)
|
|
355
|
+
|
|
356
|
+
## Troubleshooting
|
|
357
|
+
|
|
358
|
+
### Backend Not Found
|
|
359
|
+
|
|
360
|
+
```
|
|
361
|
+
Error: No vector backend available.
|
|
362
|
+
Install one of:
|
|
363
|
+
- npm install @ruvector/core (recommended)
|
|
364
|
+
- npm install hnswlib-node (fallback)
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**Solution:** Install at least one backend package.
|
|
368
|
+
|
|
369
|
+
### Native Bindings Failed
|
|
370
|
+
|
|
371
|
+
```
|
|
372
|
+
Warning: Using WASM fallback. Performance may be degraded.
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
**Solution:** This is normal for unsupported platforms. WASM provides compatibility at reduced performance.
|
|
376
|
+
|
|
377
|
+
### GNN Not Available
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
Warning: GNN learning not available
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
**Solution:** Install `@ruvector/gnn` for learning features, or continue without GNN (optional).
|
|
384
|
+
|
|
385
|
+
## Support
|
|
386
|
+
|
|
387
|
+
- **Issues:** https://github.com/ruvnet/agentic-flow/issues
|
|
388
|
+
- **RuVector:** https://github.com/ruvnet/ruvector
|
|
389
|
+
- **HNSWLib:** https://github.com/nmslib/hnswlib
|