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,627 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Manager
|
|
3
|
+
*
|
|
4
|
+
* Centralized configuration management with profiles, validation,
|
|
5
|
+
* and environment variable support.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
import Ajv from 'ajv';
|
|
11
|
+
import type { JSONSchemaType } from 'ajv';
|
|
12
|
+
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Types
|
|
15
|
+
// ============================================================================
|
|
16
|
+
|
|
17
|
+
export interface AgentDBConfig {
|
|
18
|
+
profile: 'production' | 'memory' | 'latency' | 'recall' | 'custom';
|
|
19
|
+
hnsw: {
|
|
20
|
+
M: number;
|
|
21
|
+
efConstruction: number;
|
|
22
|
+
efSearch: number;
|
|
23
|
+
};
|
|
24
|
+
attention: {
|
|
25
|
+
heads: number;
|
|
26
|
+
dimension: number;
|
|
27
|
+
};
|
|
28
|
+
traversal: {
|
|
29
|
+
beamWidth: number;
|
|
30
|
+
strategy: 'greedy' | 'beam' | 'dynamic';
|
|
31
|
+
};
|
|
32
|
+
clustering: {
|
|
33
|
+
algorithm: 'louvain' | 'leiden' | 'spectral';
|
|
34
|
+
resolution: number;
|
|
35
|
+
};
|
|
36
|
+
neural: {
|
|
37
|
+
mode: 'none' | 'gnn-only' | 'full';
|
|
38
|
+
reinforcementLearning: boolean;
|
|
39
|
+
};
|
|
40
|
+
hypergraph: {
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
maxEdgeSize: number;
|
|
43
|
+
};
|
|
44
|
+
storage: {
|
|
45
|
+
reportPath: string;
|
|
46
|
+
autoBackup: boolean;
|
|
47
|
+
};
|
|
48
|
+
monitoring: {
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
alertThresholds: {
|
|
51
|
+
memoryMB: number;
|
|
52
|
+
latencyMs: number;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
logging?: {
|
|
56
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
57
|
+
file?: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ValidationResult {
|
|
62
|
+
valid: boolean;
|
|
63
|
+
errors?: string[];
|
|
64
|
+
warnings?: string[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ============================================================================
|
|
68
|
+
// Configuration Schema
|
|
69
|
+
// ============================================================================
|
|
70
|
+
|
|
71
|
+
const configSchema: JSONSchemaType<AgentDBConfig> = {
|
|
72
|
+
type: 'object',
|
|
73
|
+
properties: {
|
|
74
|
+
profile: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
enum: ['production', 'memory', 'latency', 'recall', 'custom']
|
|
77
|
+
},
|
|
78
|
+
hnsw: {
|
|
79
|
+
type: 'object',
|
|
80
|
+
properties: {
|
|
81
|
+
M: { type: 'number', minimum: 4, maximum: 128 },
|
|
82
|
+
efConstruction: { type: 'number', minimum: 50, maximum: 1000 },
|
|
83
|
+
efSearch: { type: 'number', minimum: 10, maximum: 500 }
|
|
84
|
+
},
|
|
85
|
+
required: ['M', 'efConstruction', 'efSearch']
|
|
86
|
+
},
|
|
87
|
+
attention: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
properties: {
|
|
90
|
+
heads: { type: 'number', minimum: 1, maximum: 32 },
|
|
91
|
+
dimension: { type: 'number', minimum: 16, maximum: 512 }
|
|
92
|
+
},
|
|
93
|
+
required: ['heads', 'dimension']
|
|
94
|
+
},
|
|
95
|
+
traversal: {
|
|
96
|
+
type: 'object',
|
|
97
|
+
properties: {
|
|
98
|
+
beamWidth: { type: 'number', minimum: 1, maximum: 20 },
|
|
99
|
+
strategy: { type: 'string', enum: ['greedy', 'beam', 'dynamic'] }
|
|
100
|
+
},
|
|
101
|
+
required: ['beamWidth', 'strategy']
|
|
102
|
+
},
|
|
103
|
+
clustering: {
|
|
104
|
+
type: 'object',
|
|
105
|
+
properties: {
|
|
106
|
+
algorithm: { type: 'string', enum: ['louvain', 'leiden', 'spectral'] },
|
|
107
|
+
resolution: { type: 'number', minimum: 0.1, maximum: 10.0 }
|
|
108
|
+
},
|
|
109
|
+
required: ['algorithm', 'resolution']
|
|
110
|
+
},
|
|
111
|
+
neural: {
|
|
112
|
+
type: 'object',
|
|
113
|
+
properties: {
|
|
114
|
+
mode: { type: 'string', enum: ['none', 'gnn-only', 'full'] },
|
|
115
|
+
reinforcementLearning: { type: 'boolean' }
|
|
116
|
+
},
|
|
117
|
+
required: ['mode', 'reinforcementLearning']
|
|
118
|
+
},
|
|
119
|
+
hypergraph: {
|
|
120
|
+
type: 'object',
|
|
121
|
+
properties: {
|
|
122
|
+
enabled: { type: 'boolean' },
|
|
123
|
+
maxEdgeSize: { type: 'number', minimum: 2, maximum: 100 }
|
|
124
|
+
},
|
|
125
|
+
required: ['enabled', 'maxEdgeSize']
|
|
126
|
+
},
|
|
127
|
+
storage: {
|
|
128
|
+
type: 'object',
|
|
129
|
+
properties: {
|
|
130
|
+
reportPath: { type: 'string' },
|
|
131
|
+
autoBackup: { type: 'boolean' }
|
|
132
|
+
},
|
|
133
|
+
required: ['reportPath', 'autoBackup']
|
|
134
|
+
},
|
|
135
|
+
monitoring: {
|
|
136
|
+
type: 'object',
|
|
137
|
+
properties: {
|
|
138
|
+
enabled: { type: 'boolean' },
|
|
139
|
+
alertThresholds: {
|
|
140
|
+
type: 'object',
|
|
141
|
+
properties: {
|
|
142
|
+
memoryMB: { type: 'number', minimum: 0 },
|
|
143
|
+
latencyMs: { type: 'number', minimum: 0 }
|
|
144
|
+
},
|
|
145
|
+
required: ['memoryMB', 'latencyMs']
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
required: ['enabled', 'alertThresholds']
|
|
149
|
+
},
|
|
150
|
+
logging: {
|
|
151
|
+
type: 'object',
|
|
152
|
+
properties: {
|
|
153
|
+
level: { type: 'string', enum: ['debug', 'info', 'warn', 'error'] },
|
|
154
|
+
file: { type: 'string', nullable: true }
|
|
155
|
+
},
|
|
156
|
+
required: ['level'],
|
|
157
|
+
nullable: true
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
required: [
|
|
161
|
+
'profile',
|
|
162
|
+
'hnsw',
|
|
163
|
+
'attention',
|
|
164
|
+
'traversal',
|
|
165
|
+
'clustering',
|
|
166
|
+
'neural',
|
|
167
|
+
'hypergraph',
|
|
168
|
+
'storage',
|
|
169
|
+
'monitoring'
|
|
170
|
+
]
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// ============================================================================
|
|
174
|
+
// Preset Profiles
|
|
175
|
+
// ============================================================================
|
|
176
|
+
|
|
177
|
+
export const PRESET_PROFILES: Record<string, Omit<AgentDBConfig, 'profile'>> = {
|
|
178
|
+
production: {
|
|
179
|
+
// Optimal settings from simulation discoveries
|
|
180
|
+
hnsw: {
|
|
181
|
+
M: 32, // 8.2x speedup from HNSW exploration
|
|
182
|
+
efConstruction: 200,
|
|
183
|
+
efSearch: 100
|
|
184
|
+
},
|
|
185
|
+
attention: {
|
|
186
|
+
heads: 8, // 12.4% accuracy boost from attention analysis
|
|
187
|
+
dimension: 64
|
|
188
|
+
},
|
|
189
|
+
traversal: {
|
|
190
|
+
beamWidth: 5, // 96.8% recall from traversal optimization
|
|
191
|
+
strategy: 'beam'
|
|
192
|
+
},
|
|
193
|
+
clustering: {
|
|
194
|
+
algorithm: 'louvain', // Q=0.758 from clustering analysis
|
|
195
|
+
resolution: 1.0
|
|
196
|
+
},
|
|
197
|
+
neural: {
|
|
198
|
+
mode: 'full', // 29.4% gain from neural augmentation
|
|
199
|
+
reinforcementLearning: true
|
|
200
|
+
},
|
|
201
|
+
hypergraph: {
|
|
202
|
+
enabled: true, // 3.7x speedup from hypergraph exploration
|
|
203
|
+
maxEdgeSize: 10
|
|
204
|
+
},
|
|
205
|
+
storage: {
|
|
206
|
+
reportPath: path.join(process.cwd(), '.agentdb', 'reports.db'),
|
|
207
|
+
autoBackup: true
|
|
208
|
+
},
|
|
209
|
+
monitoring: {
|
|
210
|
+
enabled: true,
|
|
211
|
+
alertThresholds: {
|
|
212
|
+
memoryMB: 8192,
|
|
213
|
+
latencyMs: 500
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
logging: {
|
|
217
|
+
level: 'info'
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
memory: {
|
|
222
|
+
// Memory-constrained settings
|
|
223
|
+
hnsw: {
|
|
224
|
+
M: 16, // Reduced memory footprint
|
|
225
|
+
efConstruction: 100,
|
|
226
|
+
efSearch: 50
|
|
227
|
+
},
|
|
228
|
+
attention: {
|
|
229
|
+
heads: 4, // Fewer heads = less memory
|
|
230
|
+
dimension: 32
|
|
231
|
+
},
|
|
232
|
+
traversal: {
|
|
233
|
+
beamWidth: 3, // Smaller beam = less memory
|
|
234
|
+
strategy: 'greedy'
|
|
235
|
+
},
|
|
236
|
+
clustering: {
|
|
237
|
+
algorithm: 'louvain',
|
|
238
|
+
resolution: 1.0
|
|
239
|
+
},
|
|
240
|
+
neural: {
|
|
241
|
+
mode: 'gnn-only', // GNN edges only, no full neural
|
|
242
|
+
reinforcementLearning: false
|
|
243
|
+
},
|
|
244
|
+
hypergraph: {
|
|
245
|
+
enabled: false, // Disabled to save memory
|
|
246
|
+
maxEdgeSize: 5
|
|
247
|
+
},
|
|
248
|
+
storage: {
|
|
249
|
+
reportPath: path.join(process.cwd(), '.agentdb', 'reports.db'),
|
|
250
|
+
autoBackup: false
|
|
251
|
+
},
|
|
252
|
+
monitoring: {
|
|
253
|
+
enabled: true,
|
|
254
|
+
alertThresholds: {
|
|
255
|
+
memoryMB: 2048, // Lower threshold
|
|
256
|
+
latencyMs: 1000
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
logging: {
|
|
260
|
+
level: 'warn'
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
latency: {
|
|
265
|
+
// Latency-critical settings
|
|
266
|
+
hnsw: {
|
|
267
|
+
M: 32, // Fast search
|
|
268
|
+
efConstruction: 150,
|
|
269
|
+
efSearch: 75
|
|
270
|
+
},
|
|
271
|
+
attention: {
|
|
272
|
+
heads: 4, // Fewer heads for speed
|
|
273
|
+
dimension: 32
|
|
274
|
+
},
|
|
275
|
+
traversal: {
|
|
276
|
+
beamWidth: 3, // Speed vs. recall tradeoff
|
|
277
|
+
strategy: 'dynamic' // RL-based navigation
|
|
278
|
+
},
|
|
279
|
+
clustering: {
|
|
280
|
+
algorithm: 'louvain', // Faster than Leiden
|
|
281
|
+
resolution: 1.0
|
|
282
|
+
},
|
|
283
|
+
neural: {
|
|
284
|
+
mode: 'gnn-only', // GNN only for speed
|
|
285
|
+
reinforcementLearning: true
|
|
286
|
+
},
|
|
287
|
+
hypergraph: {
|
|
288
|
+
enabled: false,
|
|
289
|
+
maxEdgeSize: 5
|
|
290
|
+
},
|
|
291
|
+
storage: {
|
|
292
|
+
reportPath: path.join(process.cwd(), '.agentdb', 'reports.db'),
|
|
293
|
+
autoBackup: false
|
|
294
|
+
},
|
|
295
|
+
monitoring: {
|
|
296
|
+
enabled: true,
|
|
297
|
+
alertThresholds: {
|
|
298
|
+
memoryMB: 4096,
|
|
299
|
+
latencyMs: 200 // Strict latency requirement
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
logging: {
|
|
303
|
+
level: 'error' // Minimal logging overhead
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
recall: {
|
|
308
|
+
// High-recall settings
|
|
309
|
+
hnsw: {
|
|
310
|
+
M: 64, // Maximum connectivity
|
|
311
|
+
efConstruction: 400,
|
|
312
|
+
efSearch: 200 // Exhaustive search
|
|
313
|
+
},
|
|
314
|
+
attention: {
|
|
315
|
+
heads: 16, // More heads for better accuracy
|
|
316
|
+
dimension: 128
|
|
317
|
+
},
|
|
318
|
+
traversal: {
|
|
319
|
+
beamWidth: 10, // Wide beam for exhaustive search
|
|
320
|
+
strategy: 'beam'
|
|
321
|
+
},
|
|
322
|
+
clustering: {
|
|
323
|
+
algorithm: 'leiden', // Better quality than Louvain
|
|
324
|
+
resolution: 0.8
|
|
325
|
+
},
|
|
326
|
+
neural: {
|
|
327
|
+
mode: 'full', // Full neural augmentation
|
|
328
|
+
reinforcementLearning: true
|
|
329
|
+
},
|
|
330
|
+
hypergraph: {
|
|
331
|
+
enabled: true,
|
|
332
|
+
maxEdgeSize: 20
|
|
333
|
+
},
|
|
334
|
+
storage: {
|
|
335
|
+
reportPath: path.join(process.cwd(), '.agentdb', 'reports.db'),
|
|
336
|
+
autoBackup: true
|
|
337
|
+
},
|
|
338
|
+
monitoring: {
|
|
339
|
+
enabled: true,
|
|
340
|
+
alertThresholds: {
|
|
341
|
+
memoryMB: 16384, // High memory allowed
|
|
342
|
+
latencyMs: 2000 // Relaxed latency
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
logging: {
|
|
346
|
+
level: 'debug'
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
// ============================================================================
|
|
352
|
+
// Configuration Manager
|
|
353
|
+
// ============================================================================
|
|
354
|
+
|
|
355
|
+
export class ConfigManager {
|
|
356
|
+
private ajv: any;
|
|
357
|
+
private validator: any;
|
|
358
|
+
|
|
359
|
+
constructor() {
|
|
360
|
+
this.ajv = new Ajv({ allErrors: true });
|
|
361
|
+
this.validator = this.ajv.compile(configSchema);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// --------------------------------------------------------------------------
|
|
365
|
+
// Loading
|
|
366
|
+
// --------------------------------------------------------------------------
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Load configuration from file.
|
|
370
|
+
*/
|
|
371
|
+
loadFromFile(filePath: string): AgentDBConfig {
|
|
372
|
+
if (!fs.existsSync(filePath)) {
|
|
373
|
+
throw new Error(`Configuration file not found: ${filePath}`);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
377
|
+
const config = JSON.parse(content);
|
|
378
|
+
|
|
379
|
+
return this.validate(config);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Load configuration from preset profile.
|
|
384
|
+
*/
|
|
385
|
+
loadProfile(profile: keyof typeof PRESET_PROFILES): AgentDBConfig {
|
|
386
|
+
const preset = PRESET_PROFILES[profile];
|
|
387
|
+
|
|
388
|
+
if (!preset) {
|
|
389
|
+
throw new Error(`Unknown profile: ${profile}`);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return { ...preset, profile } as AgentDBConfig;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Load configuration with environment variable overrides.
|
|
397
|
+
*/
|
|
398
|
+
loadWithEnv(baseConfig: AgentDBConfig): AgentDBConfig {
|
|
399
|
+
const config = { ...baseConfig };
|
|
400
|
+
|
|
401
|
+
// HNSW overrides
|
|
402
|
+
if (process.env.AGENTDB_HNSW_M) {
|
|
403
|
+
config.hnsw.M = parseInt(process.env.AGENTDB_HNSW_M, 10);
|
|
404
|
+
}
|
|
405
|
+
if (process.env.AGENTDB_HNSW_EF_CONSTRUCTION) {
|
|
406
|
+
config.hnsw.efConstruction = parseInt(process.env.AGENTDB_HNSW_EF_CONSTRUCTION, 10);
|
|
407
|
+
}
|
|
408
|
+
if (process.env.AGENTDB_HNSW_EF_SEARCH) {
|
|
409
|
+
config.hnsw.efSearch = parseInt(process.env.AGENTDB_HNSW_EF_SEARCH, 10);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// Attention overrides
|
|
413
|
+
if (process.env.AGENTDB_ATTENTION_HEADS) {
|
|
414
|
+
config.attention.heads = parseInt(process.env.AGENTDB_ATTENTION_HEADS, 10);
|
|
415
|
+
}
|
|
416
|
+
if (process.env.AGENTDB_ATTENTION_DIM) {
|
|
417
|
+
config.attention.dimension = parseInt(process.env.AGENTDB_ATTENTION_DIM, 10);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// Traversal overrides
|
|
421
|
+
if (process.env.AGENTDB_BEAM_WIDTH) {
|
|
422
|
+
config.traversal.beamWidth = parseInt(process.env.AGENTDB_BEAM_WIDTH, 10);
|
|
423
|
+
}
|
|
424
|
+
if (process.env.AGENTDB_TRAVERSAL_STRATEGY) {
|
|
425
|
+
config.traversal.strategy = process.env.AGENTDB_TRAVERSAL_STRATEGY as any;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// Storage overrides
|
|
429
|
+
if (process.env.AGENTDB_REPORT_PATH) {
|
|
430
|
+
config.storage.reportPath = process.env.AGENTDB_REPORT_PATH;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// Monitoring overrides
|
|
434
|
+
if (process.env.AGENTDB_MEMORY_THRESHOLD) {
|
|
435
|
+
config.monitoring.alertThresholds.memoryMB =
|
|
436
|
+
parseInt(process.env.AGENTDB_MEMORY_THRESHOLD, 10);
|
|
437
|
+
}
|
|
438
|
+
if (process.env.AGENTDB_LATENCY_THRESHOLD) {
|
|
439
|
+
config.monitoring.alertThresholds.latencyMs =
|
|
440
|
+
parseInt(process.env.AGENTDB_LATENCY_THRESHOLD, 10);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
return this.validate(config);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Load configuration from default locations.
|
|
448
|
+
* Priority: CLI args > .agentdb.json > ~/.agentdb/config.json > defaults
|
|
449
|
+
*/
|
|
450
|
+
loadDefault(profile: string = 'production'): AgentDBConfig {
|
|
451
|
+
// 1. Check for project-level config
|
|
452
|
+
const projectConfig = path.join(process.cwd(), '.agentdb.json');
|
|
453
|
+
if (fs.existsSync(projectConfig)) {
|
|
454
|
+
return this.loadWithEnv(this.loadFromFile(projectConfig));
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// 2. Check for user-level config
|
|
458
|
+
const userConfig = path.join(
|
|
459
|
+
process.env.HOME || '',
|
|
460
|
+
'.agentdb',
|
|
461
|
+
'config.json'
|
|
462
|
+
);
|
|
463
|
+
if (fs.existsSync(userConfig)) {
|
|
464
|
+
return this.loadWithEnv(this.loadFromFile(userConfig));
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// 3. Use preset profile
|
|
468
|
+
return this.loadWithEnv(this.loadProfile(profile as any));
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// --------------------------------------------------------------------------
|
|
472
|
+
// Saving
|
|
473
|
+
// --------------------------------------------------------------------------
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Save configuration to file.
|
|
477
|
+
*/
|
|
478
|
+
save(config: AgentDBConfig, filePath: string): void {
|
|
479
|
+
// Validate before saving
|
|
480
|
+
this.validate(config);
|
|
481
|
+
|
|
482
|
+
// Ensure directory exists
|
|
483
|
+
const dir = path.dirname(filePath);
|
|
484
|
+
if (!fs.existsSync(dir)) {
|
|
485
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// Write file
|
|
489
|
+
fs.writeFileSync(
|
|
490
|
+
filePath,
|
|
491
|
+
JSON.stringify(config, null, 2),
|
|
492
|
+
'utf-8'
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// --------------------------------------------------------------------------
|
|
497
|
+
// Validation
|
|
498
|
+
// --------------------------------------------------------------------------
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Validate configuration against schema.
|
|
502
|
+
*/
|
|
503
|
+
validate(config: any): AgentDBConfig {
|
|
504
|
+
const valid = this.validator(config);
|
|
505
|
+
|
|
506
|
+
if (!valid) {
|
|
507
|
+
const errors = this.validator.errors?.map((e: any) =>
|
|
508
|
+
`${e.instancePath} ${e.message}`
|
|
509
|
+
).join(', ');
|
|
510
|
+
|
|
511
|
+
throw new Error(`Invalid configuration: ${errors}`);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
return config as AgentDBConfig;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Validate with warnings (non-throwing).
|
|
519
|
+
*/
|
|
520
|
+
validateWithWarnings(config: any): ValidationResult {
|
|
521
|
+
const errors: string[] = [];
|
|
522
|
+
const warnings: string[] = [];
|
|
523
|
+
|
|
524
|
+
try {
|
|
525
|
+
this.validate(config);
|
|
526
|
+
} catch (error: any) {
|
|
527
|
+
errors.push(error.message);
|
|
528
|
+
return { valid: false, errors };
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Additional validation checks
|
|
532
|
+
if (config.hnsw.M < 16) {
|
|
533
|
+
warnings.push('HNSW M < 16 may result in poor recall');
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
if (config.traversal.beamWidth < 3) {
|
|
537
|
+
warnings.push('Beam width < 3 may miss optimal paths');
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (config.neural.mode === 'full' && !config.monitoring.enabled) {
|
|
541
|
+
warnings.push('Full neural mode recommended with monitoring enabled');
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if (config.hypergraph.enabled && config.neural.mode === 'none') {
|
|
545
|
+
warnings.push('Hypergraph works best with neural augmentation');
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
return {
|
|
549
|
+
valid: true,
|
|
550
|
+
warnings: warnings.length > 0 ? warnings : undefined
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// --------------------------------------------------------------------------
|
|
555
|
+
// Utilities
|
|
556
|
+
// --------------------------------------------------------------------------
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Merge configurations (deep merge).
|
|
560
|
+
*/
|
|
561
|
+
merge(base: AgentDBConfig, override: Partial<AgentDBConfig>): AgentDBConfig {
|
|
562
|
+
const merged = {
|
|
563
|
+
...base,
|
|
564
|
+
...override,
|
|
565
|
+
hnsw: { ...base.hnsw, ...override.hnsw },
|
|
566
|
+
attention: { ...base.attention, ...override.attention },
|
|
567
|
+
traversal: { ...base.traversal, ...override.traversal },
|
|
568
|
+
clustering: { ...base.clustering, ...override.clustering },
|
|
569
|
+
neural: { ...base.neural, ...override.neural },
|
|
570
|
+
hypergraph: { ...base.hypergraph, ...override.hypergraph },
|
|
571
|
+
storage: { ...base.storage, ...override.storage },
|
|
572
|
+
monitoring: {
|
|
573
|
+
...base.monitoring,
|
|
574
|
+
...override.monitoring,
|
|
575
|
+
alertThresholds: {
|
|
576
|
+
...base.monitoring.alertThresholds,
|
|
577
|
+
...override.monitoring?.alertThresholds
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
logging: { ...base.logging, ...override.logging }
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
return this.validate(merged);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Get configuration summary.
|
|
588
|
+
*/
|
|
589
|
+
getSummary(config: AgentDBConfig): string {
|
|
590
|
+
return `
|
|
591
|
+
Profile: ${config.profile}
|
|
592
|
+
HNSW: M=${config.hnsw.M}, efConstruction=${config.hnsw.efConstruction}, efSearch=${config.hnsw.efSearch}
|
|
593
|
+
Attention: heads=${config.attention.heads}, dim=${config.attention.dimension}
|
|
594
|
+
Traversal: beam=${config.traversal.beamWidth}, strategy=${config.traversal.strategy}
|
|
595
|
+
Clustering: ${config.clustering.algorithm}, resolution=${config.clustering.resolution}
|
|
596
|
+
Neural: ${config.neural.mode}, RL=${config.neural.reinforcementLearning}
|
|
597
|
+
Hypergraph: enabled=${config.hypergraph.enabled}
|
|
598
|
+
Monitoring: enabled=${config.monitoring.enabled}
|
|
599
|
+
`.trim();
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Export configuration as JSON string.
|
|
604
|
+
*/
|
|
605
|
+
export(config: AgentDBConfig): string {
|
|
606
|
+
return JSON.stringify(config, null, 2);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Import configuration from JSON string.
|
|
611
|
+
*/
|
|
612
|
+
import(json: string): AgentDBConfig {
|
|
613
|
+
const config = JSON.parse(json);
|
|
614
|
+
return this.validate(config);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// ============================================================================
|
|
619
|
+
// Factory
|
|
620
|
+
// ============================================================================
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Create configuration manager instance.
|
|
624
|
+
*/
|
|
625
|
+
export function createConfigManager(): ConfigManager {
|
|
626
|
+
return new ConfigManager();
|
|
627
|
+
}
|