agentdb 3.0.0-alpha.2 → 3.0.0-alpha.4
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 +978 -2342
- package/dist/agentdb.browser.js +1492 -0
- package/dist/agentdb.browser.js.map +7 -0
- package/dist/agentdb.browser.min.js +3 -0
- package/dist/agentdb.browser.min.js.map +7 -0
- package/dist/agentdb.wasm-loader.js +207 -0
- package/dist/schemas/frontier-schema.sql +0 -7
- package/dist/schemas/schema.sql +0 -7
- 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 +8 -8
- package/dist/src/backends/GraphBackend.d.ts.map +1 -1
- package/dist/src/backends/GraphBackend.js +15 -16
- package/dist/src/backends/GraphBackend.js.map +1 -1
- package/dist/src/backends/LearningBackend.d.ts +2 -2
- package/dist/src/backends/LearningBackend.d.ts.map +1 -1
- package/dist/src/backends/LearningBackend.js +10 -11
- package/dist/src/backends/LearningBackend.js.map +1 -1
- package/dist/src/backends/VectorBackend.d.ts +6 -31
- package/dist/src/backends/VectorBackend.d.ts.map +1 -1
- package/dist/src/backends/detector.d.ts +3 -25
- package/dist/src/backends/detector.d.ts.map +1 -1
- package/dist/src/backends/detector.js +15 -119
- package/dist/src/backends/detector.js.map +1 -1
- package/dist/src/backends/factory.d.ts +32 -16
- package/dist/src/backends/factory.d.ts.map +1 -1
- package/dist/src/backends/factory.js +70 -133
- package/dist/src/backends/factory.js.map +1 -1
- package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts +1 -1
- package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts.map +1 -1
- package/dist/src/backends/graph/GraphDatabaseAdapter.js +1 -5
- package/dist/src/backends/graph/GraphDatabaseAdapter.js.map +1 -1
- package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts +2 -2
- package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts.map +1 -1
- package/dist/src/backends/hnswlib/HNSWLibBackend.js +13 -49
- package/dist/src/backends/hnswlib/HNSWLibBackend.js.map +1 -1
- package/dist/src/backends/index.d.ts +3 -25
- package/dist/src/backends/index.d.ts.map +1 -1
- package/dist/src/backends/index.js +1 -23
- package/dist/src/backends/index.js.map +1 -1
- package/dist/src/backends/ruvector/GuardedVectorBackend.d.ts +93 -0
- package/dist/src/backends/ruvector/GuardedVectorBackend.d.ts.map +1 -0
- package/dist/src/backends/ruvector/GuardedVectorBackend.js +182 -0
- package/dist/src/backends/ruvector/GuardedVectorBackend.js.map +1 -0
- package/dist/src/backends/ruvector/RuVectorBackend.d.ts +16 -187
- package/dist/src/backends/ruvector/RuVectorBackend.d.ts.map +1 -1
- package/dist/src/backends/ruvector/RuVectorBackend.js +94 -576
- package/dist/src/backends/ruvector/RuVectorBackend.js.map +1 -1
- package/dist/src/backends/ruvector/RuVectorLearning.d.ts +4 -0
- package/dist/src/backends/ruvector/RuVectorLearning.d.ts.map +1 -1
- package/dist/src/backends/ruvector/RuVectorLearning.js +11 -10
- package/dist/src/backends/ruvector/RuVectorLearning.js.map +1 -1
- 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.map +1 -1
- package/dist/src/browser/AdvancedFeatures.js +10 -3
- package/dist/src/browser/AdvancedFeatures.js.map +1 -1
- package/dist/src/browser/AttentionBrowser.d.ts.map +1 -1
- package/dist/src/browser/AttentionBrowser.js +12 -5
- package/dist/src/browser/AttentionBrowser.js.map +1 -1
- package/dist/src/browser/HNSWIndex.d.ts +1 -31
- package/dist/src/browser/HNSWIndex.d.ts.map +1 -1
- package/dist/src/browser/HNSWIndex.js +18 -136
- package/dist/src/browser/HNSWIndex.js.map +1 -1
- package/dist/src/browser/ProductQuantization.d.ts.map +1 -1
- package/dist/src/browser/ProductQuantization.js +1 -0
- package/dist/src/browser/ProductQuantization.js.map +1 -1
- package/dist/src/browser/index.d.ts +3 -3
- package/dist/src/browser/index.d.ts.map +1 -1
- package/dist/src/browser/index.js +1 -2
- package/dist/src/browser/index.js.map +1 -1
- package/dist/src/cli/agentdb-cli.d.ts +2 -16
- package/dist/src/cli/agentdb-cli.d.ts.map +1 -1
- package/dist/src/cli/agentdb-cli.js +216 -853
- package/dist/src/cli/agentdb-cli.js.map +1 -1
- package/dist/src/cli/commands/attention.js +3 -3
- package/dist/src/cli/commands/attention.js.map +1 -1
- package/dist/src/cli/commands/doctor.d.ts +0 -2
- package/dist/src/cli/commands/doctor.d.ts.map +1 -1
- package/dist/src/cli/commands/doctor.js +1 -106
- package/dist/src/cli/commands/doctor.js.map +1 -1
- package/dist/src/cli/commands/init.d.ts +1 -2
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +7 -30
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/install-embeddings.d.ts.map +1 -1
- package/dist/src/cli/commands/install-embeddings.js.map +1 -1
- package/dist/src/cli/commands/migrate.d.ts +0 -15
- package/dist/src/cli/commands/migrate.d.ts.map +1 -1
- package/dist/src/cli/commands/migrate.js +5 -164
- package/dist/src/cli/commands/migrate.js.map +1 -1
- package/dist/src/cli/commands/simulate-report.js.map +1 -1
- package/dist/src/cli/commands/simulate-wizard.js.map +1 -1
- 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.js +1 -5
- package/dist/src/cli/commands/status.js.map +1 -1
- package/dist/src/cli/lib/attention-config.d.ts +2 -2
- package/dist/src/cli/lib/attention-config.d.ts.map +1 -1
- package/dist/src/cli/lib/attention-config.js +1 -2
- package/dist/src/cli/lib/attention-config.js.map +1 -1
- 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 +1 -1
- package/dist/src/cli/lib/config-validator.d.ts.map +1 -1
- 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/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 +352 -0
- package/dist/src/cli/lib/history-tracker.js.map +1 -0
- package/dist/src/cli/lib/report-store.d.ts +1 -2
- package/dist/src/cli/lib/report-store.d.ts.map +1 -1
- package/dist/src/cli/lib/report-store.js +65 -87
- package/dist/src/cli/lib/report-store.js.map +1 -1
- package/dist/src/cli/lib/simulation-registry.d.ts +1 -1
- package/dist/src/cli/lib/simulation-registry.d.ts.map +1 -1
- package/dist/src/cli/lib/simulation-registry.js +0 -1
- package/dist/src/cli/lib/simulation-registry.js.map +1 -1
- package/dist/src/cli/lib/simulation-runner.d.ts +4 -41
- package/dist/src/cli/lib/simulation-runner.d.ts.map +1 -1
- package/dist/src/cli/lib/simulation-runner.js +6 -251
- package/dist/src/cli/lib/simulation-runner.js.map +1 -1
- package/dist/src/controllers/AttentionService.d.ts.map +1 -1
- package/dist/src/controllers/AttentionService.js +5 -3
- package/dist/src/controllers/AttentionService.js.map +1 -1
- package/dist/src/controllers/CausalMemoryGraph.d.ts +8 -33
- package/dist/src/controllers/CausalMemoryGraph.d.ts.map +1 -1
- package/dist/src/controllers/CausalMemoryGraph.js +16 -93
- package/dist/src/controllers/CausalMemoryGraph.js.map +1 -1
- package/dist/src/controllers/CausalRecall.d.ts +3 -6
- package/dist/src/controllers/CausalRecall.d.ts.map +1 -1
- package/dist/src/controllers/CausalRecall.js +8 -14
- package/dist/src/controllers/CausalRecall.js.map +1 -1
- package/dist/src/controllers/ContextSynthesizer.d.ts +1 -1
- package/dist/src/controllers/ContextSynthesizer.d.ts.map +1 -1
- package/dist/src/controllers/EmbeddingService.d.ts.map +1 -1
- package/dist/src/controllers/EmbeddingService.js +3 -10
- package/dist/src/controllers/EmbeddingService.js.map +1 -1
- package/dist/src/controllers/EnhancedEmbeddingService.d.ts +0 -4
- package/dist/src/controllers/EnhancedEmbeddingService.d.ts.map +1 -1
- package/dist/src/controllers/EnhancedEmbeddingService.js +3 -10
- package/dist/src/controllers/EnhancedEmbeddingService.js.map +1 -1
- package/dist/src/controllers/ExplainableRecall.d.ts +6 -5
- package/dist/src/controllers/ExplainableRecall.d.ts.map +1 -1
- package/dist/src/controllers/ExplainableRecall.js +13 -21
- package/dist/src/controllers/ExplainableRecall.js.map +1 -1
- package/dist/src/controllers/HNSWIndex.d.ts +7 -24
- package/dist/src/controllers/HNSWIndex.d.ts.map +1 -1
- package/dist/src/controllers/HNSWIndex.js +10 -89
- package/dist/src/controllers/HNSWIndex.js.map +1 -1
- package/dist/src/controllers/LearningSystem.d.ts +10 -106
- package/dist/src/controllers/LearningSystem.d.ts.map +1 -1
- package/dist/src/controllers/LearningSystem.js +14 -39
- package/dist/src/controllers/LearningSystem.js.map +1 -1
- package/dist/src/controllers/MMRDiversityRanker.d.ts +1 -1
- package/dist/src/controllers/MMRDiversityRanker.d.ts.map +1 -1
- package/dist/src/controllers/MetadataFilter.d.ts +3 -3
- package/dist/src/controllers/MetadataFilter.d.ts.map +1 -1
- package/dist/src/controllers/MetadataFilter.js +6 -9
- package/dist/src/controllers/MetadataFilter.js.map +1 -1
- package/dist/src/controllers/NightlyLearner.d.ts +4 -9
- package/dist/src/controllers/NightlyLearner.d.ts.map +1 -1
- package/dist/src/controllers/NightlyLearner.js +9 -28
- package/dist/src/controllers/NightlyLearner.js.map +1 -1
- package/dist/src/controllers/QUICClient.d.ts +2 -50
- package/dist/src/controllers/QUICClient.d.ts.map +1 -1
- package/dist/src/controllers/QUICClient.js +3 -193
- package/dist/src/controllers/QUICClient.js.map +1 -1
- package/dist/src/controllers/QUICServer.d.ts +4 -4
- package/dist/src/controllers/QUICServer.d.ts.map +1 -1
- package/dist/src/controllers/QUICServer.js +14 -22
- package/dist/src/controllers/QUICServer.js.map +1 -1
- package/dist/src/controllers/ReasoningBank.d.ts +4 -14
- package/dist/src/controllers/ReasoningBank.d.ts.map +1 -1
- package/dist/src/controllers/ReasoningBank.js +46 -59
- package/dist/src/controllers/ReasoningBank.js.map +1 -1
- package/dist/src/controllers/ReflexionMemory.d.ts +7 -80
- package/dist/src/controllers/ReflexionMemory.d.ts.map +1 -1
- package/dist/src/controllers/ReflexionMemory.js +214 -372
- package/dist/src/controllers/ReflexionMemory.js.map +1 -1
- package/dist/src/controllers/SkillLibrary.d.ts +7 -37
- package/dist/src/controllers/SkillLibrary.d.ts.map +1 -1
- package/dist/src/controllers/SkillLibrary.js +96 -212
- package/dist/src/controllers/SkillLibrary.js.map +1 -1
- package/dist/src/controllers/SyncCoordinator.d.ts +3 -2
- package/dist/src/controllers/SyncCoordinator.d.ts.map +1 -1
- package/dist/src/controllers/SyncCoordinator.js +5 -117
- package/dist/src/controllers/SyncCoordinator.js.map +1 -1
- package/dist/src/controllers/WASMVectorSearch.d.ts +9 -20
- package/dist/src/controllers/WASMVectorSearch.d.ts.map +1 -1
- package/dist/src/controllers/WASMVectorSearch.js +29 -154
- package/dist/src/controllers/WASMVectorSearch.js.map +1 -1
- 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 +17 -8
- package/dist/src/controllers/index.d.ts.map +1 -1
- package/dist/src/controllers/index.js +12 -6
- package/dist/src/controllers/index.js.map +1 -1
- package/dist/src/core/AgentDB.d.ts +25 -57
- package/dist/src/core/AgentDB.d.ts.map +1 -1
- package/dist/src/core/AgentDB.js +115 -137
- package/dist/src/core/AgentDB.js.map +1 -1
- package/dist/src/db-fallback.d.ts +1 -10
- package/dist/src/db-fallback.d.ts.map +1 -1
- package/dist/src/db-fallback.js +4 -171
- package/dist/src/db-fallback.js.map +1 -1
- 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 +12 -38
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -46
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/agentdb-mcp-server.js +63 -219
- package/dist/src/mcp/agentdb-mcp-server.js.map +1 -1
- 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 +5 -52
- package/dist/src/optimizations/BatchOperations.d.ts.map +1 -1
- package/dist/src/optimizations/BatchOperations.js +33 -186
- package/dist/src/optimizations/BatchOperations.js.map +1 -1
- package/dist/src/optimizations/QueryOptimizer.d.ts +4 -4
- package/dist/src/optimizations/QueryOptimizer.d.ts.map +1 -1
- package/dist/src/optimizations/QueryOptimizer.js +1 -3
- package/dist/src/optimizations/QueryOptimizer.js.map +1 -1
- package/dist/src/optimizations/ToolCache.d.ts +4 -4
- package/dist/src/optimizations/ToolCache.d.ts.map +1 -1
- package/dist/src/optimizations/ToolCache.js.map +1 -1
- package/dist/src/optimizations/index.d.ts +1 -1
- package/dist/src/optimizations/index.d.ts.map +1 -1
- package/dist/src/security/AttestationLog.d.ts +70 -0
- package/dist/src/security/AttestationLog.d.ts.map +1 -0
- package/dist/src/security/AttestationLog.js +174 -0
- package/dist/src/security/AttestationLog.js.map +1 -0
- package/dist/src/security/MutationGuard.d.ts +83 -0
- package/dist/src/security/MutationGuard.d.ts.map +1 -0
- package/dist/src/security/MutationGuard.js +379 -0
- package/dist/src/security/MutationGuard.js.map +1 -0
- package/dist/src/security/index.d.ts +15 -0
- package/dist/src/security/index.d.ts.map +1 -0
- package/dist/src/security/index.js +18 -0
- package/dist/src/security/index.js.map +1 -0
- package/dist/src/security/input-validation.d.ts +12 -12
- package/dist/src/security/input-validation.d.ts.map +1 -1
- package/dist/src/security/input-validation.js +0 -1
- package/dist/src/security/input-validation.js.map +1 -1
- 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/GraphTransformerService.d.ts +79 -0
- package/dist/src/services/GraphTransformerService.d.ts.map +1 -0
- package/dist/src/services/GraphTransformerService.js +331 -0
- package/dist/src/services/GraphTransformerService.js.map +1 -0
- package/dist/src/services/LLMRouter.d.ts +7 -61
- package/dist/src/services/LLMRouter.d.ts.map +1 -1
- package/dist/src/services/LLMRouter.js +25 -295
- package/dist/src/services/LLMRouter.js.map +1 -1
- package/dist/src/services/SemanticRouter.d.ts +78 -0
- package/dist/src/services/SemanticRouter.d.ts.map +1 -0
- package/dist/src/services/SemanticRouter.js +149 -0
- package/dist/src/services/SemanticRouter.js.map +1 -0
- package/dist/src/services/SonaTrajectoryService.d.ts +100 -0
- package/dist/src/services/SonaTrajectoryService.d.ts.map +1 -0
- package/dist/src/services/SonaTrajectoryService.js +231 -0
- package/dist/src/services/SonaTrajectoryService.js.map +1 -0
- package/dist/src/types/attention.d.ts +249 -0
- package/dist/src/types/attention.d.ts.map +1 -0
- package/dist/src/types/attention.js +43 -0
- package/dist/src/types/attention.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/LegacyAttentionAdapter.d.ts +93 -0
- package/dist/src/utils/LegacyAttentionAdapter.d.ts.map +1 -0
- package/dist/src/utils/LegacyAttentionAdapter.js +241 -0
- package/dist/src/utils/LegacyAttentionAdapter.js.map +1 -0
- package/dist/src/utils/attention-metrics.d.ts +76 -0
- package/dist/src/utils/attention-metrics.d.ts.map +1 -0
- package/dist/src/utils/attention-metrics.js +178 -0
- package/dist/src/utils/attention-metrics.js.map +1 -0
- package/dist/src/utils/vector-math.d.ts +29 -0
- package/dist/src/utils/vector-math.d.ts.map +1 -0
- package/dist/src/utils/vector-math.js +66 -0
- package/dist/src/utils/vector-math.js.map +1 -0
- package/examples/README.md +105 -0
- package/examples/browser/attention-demo.html +499 -0
- package/examples/browser/flash-consolidation.html +598 -0
- package/examples/browser/hyperbolic-hierarchy.html +497 -0
- package/examples/quickstart.js +43 -0
- package/package.json +53 -56
- package/simulation/.claude-flow/metrics/agent-metrics.json +1 -0
- package/simulation/.claude-flow/metrics/performance.json +87 -0
- package/simulation/.claude-flow/metrics/task-metrics.json +10 -0
- package/simulation/COMPLETION-STATUS.md +139 -0
- package/simulation/FINAL-RESULTS.md +414 -0
- package/simulation/FINAL-STATUS.md +281 -0
- package/simulation/INTEGRATION-COMPLETE.md +452 -0
- package/simulation/MIGRATION-STATUS.md +231 -0
- package/simulation/OPTIMIZATION-RESULTS.md +397 -0
- package/simulation/PHASE1-COMPLETE.md +163 -0
- package/simulation/README.md +848 -0
- package/simulation/SIMULATION-RESULTS.md +239 -0
- package/simulation/cli.ts +78 -0
- package/simulation/configs/default.json +37 -0
- package/simulation/data/advanced/aidefence.graph +0 -0
- package/simulation/data/advanced/bmssp.graph +0 -0
- package/simulation/data/advanced/consciousness.graph +0 -0
- package/simulation/data/advanced/goalie.graph +0 -0
- package/simulation/data/advanced/psycho-symbolic.graph +0 -0
- package/simulation/data/advanced/research-swarm.graph +0 -0
- package/simulation/data/advanced/sublinear.graph +0 -0
- package/simulation/data/advanced/temporal.graph +0 -0
- package/simulation/data/causal.graph +0 -0
- package/simulation/data/graph-traversal.graph +0 -0
- package/simulation/data/lean-agentic.graph +0 -0
- package/simulation/data/reflexion.graph +0 -0
- package/simulation/data/skills.graph +0 -0
- package/simulation/data/stock-market.graph +0 -0
- package/simulation/data/strange-loops.graph +0 -0
- package/simulation/data/swarm.graph +0 -0
- package/simulation/data/voting-consensus.graph +0 -0
- package/simulation/docs/CLI-INTEGRATION-PLAN.md +1038 -0
- package/simulation/docs/COMPREHENSIVE-LATENT-SPACE-COMPLETION.md +354 -0
- package/simulation/docs/DOCUMENTATION-INDEX.md +226 -0
- package/simulation/docs/IMPLEMENTATION-COMPLETE.md +521 -0
- package/simulation/docs/OPTIMIZATION-SUMMARY.md +279 -0
- package/simulation/docs/README.md +229 -0
- package/simulation/docs/SWARM-5-INTEGRATION-SUMMARY.md +528 -0
- package/simulation/docs/TESTING-SUMMARY.md +304 -0
- package/simulation/docs/architecture/EXTENSION-API.md +868 -0
- package/simulation/docs/architecture/INTEGRATION-ARCHITECTURE.md +1138 -0
- package/simulation/docs/architecture/OPTIMIZATION-STRATEGY.md +778 -0
- package/simulation/docs/architecture/SIMULATION-ARCHITECTURE.md +892 -0
- package/simulation/docs/guides/CLI-REFERENCE.md +896 -0
- package/simulation/docs/guides/CUSTOM-SIMULATIONS.md +931 -0
- package/simulation/docs/guides/DEPLOYMENT.md +832 -0
- package/simulation/docs/guides/IMPLEMENTATION-SUMMARY.md +544 -0
- package/simulation/docs/guides/MIGRATION-GUIDE.md +591 -0
- package/simulation/docs/guides/QUICK-START.md +361 -0
- package/simulation/docs/guides/README.md +736 -0
- package/simulation/docs/guides/TROUBLESHOOTING.md +817 -0
- package/simulation/docs/guides/WIZARD-GUIDE.md +869 -0
- package/simulation/docs/reports/latent-space/MASTER-SYNTHESIS.md +345 -0
- package/simulation/docs/reports/latent-space/README.md +132 -0
- package/simulation/docs/reports/latent-space/attention-analysis-RESULTS.md +238 -0
- package/simulation/docs/reports/latent-space/clustering-analysis-RESULTS.md +210 -0
- package/simulation/docs/reports/latent-space/hnsw-exploration-RESULTS.md +332 -0
- package/simulation/docs/reports/latent-space/hypergraph-exploration-RESULTS.md +37 -0
- package/simulation/docs/reports/latent-space/neural-augmentation-RESULTS.md +69 -0
- package/simulation/docs/reports/latent-space/quantum-hybrid-RESULTS.md +91 -0
- package/simulation/docs/reports/latent-space/self-organizing-hnsw-RESULTS.md +51 -0
- package/simulation/docs/reports/latent-space/traversal-optimization-RESULTS.md +238 -0
- package/simulation/reports/README.md +397 -0
- package/simulation/reports/advanced-simulations-performance.md +1241 -0
- package/simulation/reports/aidefence-integration-2025-11-30T01-36-53-486Z.json +30 -0
- package/simulation/reports/architecture-analysis.md +1396 -0
- package/simulation/reports/basic-scenarios-performance.md +1840 -0
- package/simulation/reports/bmssp-integration-2025-11-30T01-36-27-193Z.json +30 -0
- package/simulation/reports/bmssp-integration-2025-11-30T03-38-12-887Z.json +30 -0
- package/simulation/reports/causal-reasoning-2025-11-29T23-35-21-795Z.json +36 -0
- package/simulation/reports/causal-reasoning-2025-11-30T00-58-42-862Z.json +30 -0
- package/simulation/reports/causal-reasoning-2025-11-30T00-59-12-546Z.json +40 -0
- package/simulation/reports/consciousness-explorer-2025-11-30T01-36-51-269Z.json +31 -0
- package/simulation/reports/core-benchmarks.md +727 -0
- package/simulation/reports/goalie-integration-2025-11-30T01-36-52-377Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-29T23-35-35-279Z.json +78 -0
- package/simulation/reports/graph-traversal-2025-11-29T23-37-36-697Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-03-59-716Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-05-10-984Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-06-16-334Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-06-53-312Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-07-51-075Z.json +24 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-08-22-179Z.json +42 -0
- package/simulation/reports/lean-agentic-swarm-2025-11-29T23-37-23-804Z.json +148 -0
- package/simulation/reports/lean-agentic-swarm-2025-11-30T01-31-24-401Z.json +31 -0
- package/simulation/reports/lean-agentic-swarm-2025-11-30T03-38-01-470Z.json +31 -0
- package/simulation/reports/multi-agent-swarm-2025-11-29T23-35-28-093Z.json +78 -0
- package/simulation/reports/multi-agent-swarm-2025-11-30T01-03-54-062Z.json +42 -0
- package/simulation/reports/multi-agent-swarm-2025-11-30T01-05-06-092Z.json +42 -0
- package/simulation/reports/psycho-symbolic-reasoner-2025-11-30T01-36-50-180Z.json +30 -0
- package/simulation/reports/quality-metrics.md +727 -0
- package/simulation/reports/reflexion-learning-2025-11-29T23-35-09-774Z.json +48 -0
- package/simulation/reports/reflexion-learning-2025-11-29T23-37-16-934Z.json +36 -0
- package/simulation/reports/reflexion-learning-2025-11-30T00-07-49-259Z.json +30 -0
- package/simulation/reports/reflexion-learning-2025-11-30T00-09-29-319Z.json +51 -0
- package/simulation/reports/reflexion-learning-2025-11-30T00-28-37-659Z.json +51 -0
- package/simulation/reports/reflexion-learning-2025-11-30T01-31-30-690Z.json +29 -0
- package/simulation/reports/reflexion-learning-2025-11-30T03-38-06-937Z.json +29 -0
- package/simulation/reports/research-foundations.md +2004 -0
- package/simulation/reports/research-swarm-2025-11-30T01-36-54-647Z.json +30 -0
- package/simulation/reports/scalability-deployment.md +2404 -0
- package/simulation/reports/skill-evolution-2025-11-29T23-35-15-945Z.json +36 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-03-17-995Z.json +30 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-03-48-441Z.json +30 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-05-00-554Z.json +30 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-06-11-436Z.json +30 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-06-51-979Z.json +30 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-07-32-695Z.json +40 -0
- package/simulation/reports/stock-market-emergence-2025-11-30T00-11-43-865Z.json +56 -0
- package/simulation/reports/stock-market-emergence-2025-11-30T00-28-57-495Z.json +56 -0
- package/simulation/reports/strange-loops-2025-11-29T23-37-30-621Z.json +78 -0
- package/simulation/reports/strange-loops-2025-11-30T00-07-55-415Z.json +30 -0
- package/simulation/reports/strange-loops-2025-11-30T00-09-35-133Z.json +30 -0
- package/simulation/reports/strange-loops-2025-11-30T00-48-50-744Z.json +24 -0
- package/simulation/reports/strange-loops-2025-11-30T00-54-48-044Z.json +24 -0
- package/simulation/reports/strange-loops-2025-11-30T00-57-27-633Z.json +24 -0
- package/simulation/reports/strange-loops-2025-11-30T00-57-59-135Z.json +42 -0
- package/simulation/reports/sublinear-solver-2025-11-30T01-36-33-134Z.json +30 -0
- package/simulation/reports/temporal-lead-solver-2025-11-30T01-36-38-628Z.json +30 -0
- package/simulation/reports/use-cases-applications.md +2212 -0
- package/simulation/reports/voting-system-consensus-2025-11-30T00-11-37-199Z.json +58 -0
- package/simulation/reports/voting-system-consensus-2025-11-30T00-28-47-735Z.json +58 -0
- package/simulation/runner.ts +300 -0
- package/simulation/scenarios/README-advanced/aidefence-integration.md +63 -0
- package/simulation/scenarios/README-advanced/bmssp-integration.md +58 -0
- package/simulation/scenarios/README-advanced/consciousness-explorer.md +53 -0
- package/simulation/scenarios/README-advanced/goalie-integration.md +61 -0
- package/simulation/scenarios/README-advanced/psycho-symbolic-reasoner.md +55 -0
- package/simulation/scenarios/README-advanced/research-swarm.md +63 -0
- package/simulation/scenarios/README-advanced/sublinear-solver.md +58 -0
- package/simulation/scenarios/README-advanced/temporal-lead-solver.md +55 -0
- package/simulation/scenarios/README-basic/causal-reasoning.md +39 -0
- package/simulation/scenarios/README-basic/graph-traversal.md +41 -0
- package/simulation/scenarios/README-basic/lean-agentic-swarm.md +122 -0
- package/simulation/scenarios/README-basic/multi-agent-swarm.md +34 -0
- package/simulation/scenarios/README-basic/reflexion-learning.md +41 -0
- package/simulation/scenarios/README-basic/skill-evolution.md +38 -0
- package/simulation/scenarios/README-basic/stock-market-emergence.md +28 -0
- package/simulation/scenarios/README-basic/strange-loops.md +36 -0
- package/simulation/scenarios/README-basic/voting-system-consensus.md +28 -0
- package/simulation/scenarios/README.md +438 -0
- package/simulation/scenarios/aidefence-integration.ts +165 -0
- package/simulation/scenarios/bmssp-integration.ts +137 -0
- package/simulation/scenarios/causal-reasoning.ts +143 -0
- package/simulation/scenarios/consciousness-explorer.ts +139 -0
- package/simulation/scenarios/domain-examples/.claude-flow/metrics/agent-metrics.json +1 -0
- package/simulation/scenarios/domain-examples/.claude-flow/metrics/performance.json +87 -0
- package/simulation/scenarios/domain-examples/.claude-flow/metrics/task-metrics.json +10 -0
- package/simulation/scenarios/domain-examples/README.md +525 -0
- package/simulation/scenarios/domain-examples/e-commerce-recommendations.ts +220 -0
- package/simulation/scenarios/domain-examples/index.ts +81 -0
- package/simulation/scenarios/domain-examples/iot-sensor-networks.ts +290 -0
- package/simulation/scenarios/domain-examples/medical-imaging.ts +181 -0
- package/simulation/scenarios/domain-examples/robotics-navigation.ts +214 -0
- package/simulation/scenarios/domain-examples/scientific-research.ts +250 -0
- package/simulation/scenarios/domain-examples/trading-systems.ts +138 -0
- package/simulation/scenarios/goalie-integration.ts +161 -0
- package/simulation/scenarios/graph-traversal.ts +129 -0
- package/simulation/scenarios/latent-space/OPTIMIZATION-COMPLETE.md +287 -0
- package/simulation/scenarios/latent-space/README-attention-analysis.md +170 -0
- package/simulation/scenarios/latent-space/README-clustering-analysis.md +239 -0
- package/simulation/scenarios/latent-space/README-hnsw-exploration.md +199 -0
- package/simulation/scenarios/latent-space/README-hypergraph-exploration.md +279 -0
- package/simulation/scenarios/latent-space/README-neural-augmentation.md +267 -0
- package/simulation/scenarios/latent-space/README-quantum-hybrid.md +276 -0
- package/simulation/scenarios/latent-space/README-self-organizing-hnsw.md +244 -0
- package/simulation/scenarios/latent-space/README-traversal-optimization.md +212 -0
- package/simulation/scenarios/latent-space/attention-analysis.ts +598 -0
- package/simulation/scenarios/latent-space/clustering-analysis.ts +796 -0
- package/simulation/scenarios/latent-space/hnsw-exploration.ts +526 -0
- package/simulation/scenarios/latent-space/hypergraph-exploration.ts +706 -0
- package/simulation/scenarios/latent-space/index.ts +47 -0
- package/simulation/scenarios/latent-space/neural-augmentation.ts +604 -0
- package/simulation/scenarios/latent-space/quantum-hybrid.ts +508 -0
- package/simulation/scenarios/latent-space/self-organizing-hnsw.ts +680 -0
- package/simulation/scenarios/latent-space/traversal-optimization.ts +782 -0
- package/simulation/scenarios/lean-agentic-swarm.ts +182 -0
- package/simulation/scenarios/multi-agent-swarm.ts +146 -0
- package/simulation/scenarios/psycho-symbolic-reasoner.ts +136 -0
- package/simulation/scenarios/reflexion-learning.ts +132 -0
- package/simulation/scenarios/research-swarm.ts +187 -0
- package/simulation/scenarios/skill-evolution.ts +135 -0
- package/simulation/scenarios/stock-market-emergence.ts +323 -0
- package/simulation/scenarios/strange-loops.ts +175 -0
- package/simulation/scenarios/sublinear-solver.ts +108 -0
- package/simulation/scenarios/temporal-lead-solver.ts +121 -0
- package/simulation/scenarios/voting-system-consensus.ts +251 -0
- package/simulation/tests/latent-space/attention-analysis.test.ts +204 -0
- package/simulation/tests/latent-space/clustering-analysis.test.ts +281 -0
- package/simulation/tests/latent-space/hnsw-exploration.test.ts +253 -0
- package/simulation/tests/latent-space/hypergraph-exploration.test.ts +295 -0
- package/simulation/tests/latent-space/neural-augmentation.test.ts +326 -0
- package/simulation/tests/latent-space/quantum-hybrid.test.ts +307 -0
- package/simulation/tests/latent-space/self-organizing-hnsw.test.ts +291 -0
- package/simulation/tests/latent-space/traversal-optimization.test.ts +261 -0
- package/simulation/types.ts +177 -0
- package/simulation/utils/PerformanceOptimizer.ts +269 -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 +147 -0
- package/src/backends/detector.ts +283 -0
- package/src/backends/factory.ts +279 -0
- package/src/backends/graph/GraphDatabaseAdapter.ts +334 -0
- package/src/backends/hnswlib/HNSWLibBackend.ts +419 -0
- package/src/backends/hnswlib/index.ts +7 -0
- package/src/backends/index.ts +32 -0
- package/src/backends/ruvector/GuardedVectorBackend.ts +219 -0
- package/src/backends/ruvector/RuVectorBackend.ts +343 -0
- package/src/backends/ruvector/RuVectorLearning.ts +254 -0
- package/src/backends/ruvector/index.ts +9 -0
- package/src/benchmarks/wasm-vector-benchmark.ts +250 -0
- package/src/browser/AdvancedFeatures.ts +565 -0
- package/src/browser/AttentionBrowser.ts +387 -0
- package/src/browser/HNSWIndex.ts +494 -0
- package/src/browser/ProductQuantization.ts +419 -0
- package/src/browser/index.ts +317 -0
- package/src/cli/agentdb-cli.ts +2712 -0
- package/src/cli/attention-cli-integration.ts +91 -0
- package/src/cli/commands/attention.ts +656 -0
- package/src/cli/commands/doctor.ts +322 -0
- package/src/cli/commands/init.ts +176 -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/examples.sh +83 -0
- package/src/cli/lib/attention-config.ts +326 -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 +503 -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 +503 -0
- package/src/cli/lib/simulation-runner.ts +291 -0
- package/src/cli/tests/agentdb-cli.test.ts +58 -0
- package/src/cli/tests/attention-cli.test.ts +335 -0
- package/src/controllers/AttentionService.ts +770 -0
- package/src/controllers/CausalMemoryGraph.ts +773 -0
- package/src/controllers/CausalRecall.ts +484 -0
- package/src/controllers/ContextSynthesizer.ts +285 -0
- package/src/controllers/EmbeddingService.ts +161 -0
- package/src/controllers/EnhancedEmbeddingService.ts +143 -0
- package/src/controllers/ExplainableRecall.ts +746 -0
- package/src/controllers/HNSWIndex.ts +495 -0
- package/src/controllers/LearningSystem.ts +1270 -0
- package/src/controllers/MMRDiversityRanker.ts +187 -0
- package/src/controllers/MetadataFilter.ts +280 -0
- package/src/controllers/NightlyLearner.ts +647 -0
- package/src/controllers/QUICClient.ts +413 -0
- package/src/controllers/QUICServer.ts +498 -0
- package/src/controllers/ReasoningBank.ts +665 -0
- package/src/controllers/ReflexionMemory.ts +872 -0
- package/src/controllers/SkillLibrary.ts +795 -0
- package/src/controllers/SyncCoordinator.ts +597 -0
- package/src/controllers/WASMVectorSearch.ts +292 -0
- package/src/controllers/frontier-index.ts +35 -0
- package/src/controllers/index.ts +57 -0
- package/src/coordination/MultiDatabaseCoordinator.ts +1107 -0
- package/src/coordination/index.ts +24 -0
- package/src/core/AgentDB.ts +211 -0
- package/src/db-fallback.ts +296 -0
- package/src/db-test.ts +59 -0
- package/src/db-unified.ts +327 -0
- package/src/examples/quic-sync-example.ts +198 -0
- package/src/examples/wasm-vector-usage.ts +245 -0
- package/src/index.ts +69 -0
- package/src/mcp/agentdb-mcp-server.ts +2318 -0
- package/src/mcp/attention-mcp-integration.ts +145 -0
- package/src/mcp/attention-tools-handlers.ts +586 -0
- package/src/mcp/learning-tools-handlers.ts +106 -0
- package/src/optimizations/BatchOperations.ts +594 -0
- package/src/optimizations/QueryOptimizer.ts +297 -0
- package/src/optimizations/ToolCache.ts +355 -0
- package/src/optimizations/index.ts +11 -0
- package/src/schemas/frontier-schema.sql +378 -0
- package/src/schemas/schema.sql +382 -0
- package/src/security/AttestationLog.ts +252 -0
- package/src/security/MutationGuard.ts +420 -0
- package/src/security/index.ts +52 -0
- package/src/security/input-validation.ts +543 -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/GraphTransformerService.ts +389 -0
- package/src/services/LLMRouter.ts +380 -0
- package/src/services/SemanticRouter.ts +169 -0
- package/src/services/SonaTrajectoryService.ts +264 -0
- package/src/tests/attention-service.test.ts +492 -0
- package/src/tests/wasm-vector-search.test.ts +240 -0
- package/src/types/attention.ts +392 -0
- package/src/types/quic.ts +772 -0
- package/src/utils/LegacyAttentionAdapter.ts +393 -0
- package/src/utils/NodeIdMapper.ts +64 -0
- package/src/utils/attention-metrics.ts +253 -0
- package/src/utils/vector-math.ts +71 -0
- package/LICENSE +0 -21
- package/dist/src/backends/rvf/AdaptiveIndexTuner.d.ts +0 -175
- package/dist/src/backends/rvf/AdaptiveIndexTuner.d.ts.map +0 -1
- package/dist/src/backends/rvf/AdaptiveIndexTuner.js +0 -559
- package/dist/src/backends/rvf/AdaptiveIndexTuner.js.map +0 -1
- package/dist/src/backends/rvf/ContrastiveTrainer.d.ts +0 -148
- package/dist/src/backends/rvf/ContrastiveTrainer.d.ts.map +0 -1
- package/dist/src/backends/rvf/ContrastiveTrainer.js +0 -438
- package/dist/src/backends/rvf/ContrastiveTrainer.js.map +0 -1
- package/dist/src/backends/rvf/FederatedSessionManager.d.ts +0 -211
- package/dist/src/backends/rvf/FederatedSessionManager.d.ts.map +0 -1
- package/dist/src/backends/rvf/FederatedSessionManager.js +0 -389
- package/dist/src/backends/rvf/FederatedSessionManager.js.map +0 -1
- package/dist/src/backends/rvf/FilterBuilder.d.ts +0 -136
- package/dist/src/backends/rvf/FilterBuilder.d.ts.map +0 -1
- package/dist/src/backends/rvf/FilterBuilder.js +0 -157
- package/dist/src/backends/rvf/FilterBuilder.js.map +0 -1
- package/dist/src/backends/rvf/NativeAccelerator.d.ts +0 -140
- package/dist/src/backends/rvf/NativeAccelerator.d.ts.map +0 -1
- package/dist/src/backends/rvf/NativeAccelerator.js +0 -630
- package/dist/src/backends/rvf/NativeAccelerator.js.map +0 -1
- package/dist/src/backends/rvf/RvfBackend.d.ts +0 -194
- package/dist/src/backends/rvf/RvfBackend.d.ts.map +0 -1
- package/dist/src/backends/rvf/RvfBackend.js +0 -607
- package/dist/src/backends/rvf/RvfBackend.js.map +0 -1
- package/dist/src/backends/rvf/RvfSolver.d.ts +0 -175
- package/dist/src/backends/rvf/RvfSolver.d.ts.map +0 -1
- package/dist/src/backends/rvf/RvfSolver.js +0 -176
- package/dist/src/backends/rvf/RvfSolver.js.map +0 -1
- package/dist/src/backends/rvf/SelfLearningRvfBackend.d.ts +0 -143
- package/dist/src/backends/rvf/SelfLearningRvfBackend.d.ts.map +0 -1
- package/dist/src/backends/rvf/SelfLearningRvfBackend.js +0 -569
- package/dist/src/backends/rvf/SelfLearningRvfBackend.js.map +0 -1
- package/dist/src/backends/rvf/SemanticQueryRouter.d.ts +0 -128
- package/dist/src/backends/rvf/SemanticQueryRouter.d.ts.map +0 -1
- package/dist/src/backends/rvf/SemanticQueryRouter.js +0 -415
- package/dist/src/backends/rvf/SemanticQueryRouter.js.map +0 -1
- package/dist/src/backends/rvf/SimdFallbacks.d.ts +0 -25
- package/dist/src/backends/rvf/SimdFallbacks.d.ts.map +0 -1
- package/dist/src/backends/rvf/SimdFallbacks.js +0 -287
- package/dist/src/backends/rvf/SimdFallbacks.js.map +0 -1
- package/dist/src/backends/rvf/SolverBandit.d.ts +0 -100
- package/dist/src/backends/rvf/SolverBandit.d.ts.map +0 -1
- package/dist/src/backends/rvf/SolverBandit.js +0 -216
- package/dist/src/backends/rvf/SolverBandit.js.map +0 -1
- package/dist/src/backends/rvf/SonaLearningBackend.d.ts +0 -157
- package/dist/src/backends/rvf/SonaLearningBackend.d.ts.map +0 -1
- package/dist/src/backends/rvf/SonaLearningBackend.js +0 -283
- package/dist/src/backends/rvf/SonaLearningBackend.js.map +0 -1
- package/dist/src/backends/rvf/SqlJsRvfBackend.d.ts +0 -77
- package/dist/src/backends/rvf/SqlJsRvfBackend.d.ts.map +0 -1
- package/dist/src/backends/rvf/SqlJsRvfBackend.js +0 -382
- package/dist/src/backends/rvf/SqlJsRvfBackend.js.map +0 -1
- package/dist/src/backends/rvf/WasmStoreBridge.d.ts +0 -27
- package/dist/src/backends/rvf/WasmStoreBridge.d.ts.map +0 -1
- package/dist/src/backends/rvf/WasmStoreBridge.js +0 -87
- package/dist/src/backends/rvf/WasmStoreBridge.js.map +0 -1
- package/dist/src/backends/rvf/validation.d.ts +0 -20
- package/dist/src/backends/rvf/validation.d.ts.map +0 -1
- package/dist/src/backends/rvf/validation.js +0 -78
- package/dist/src/backends/rvf/validation.js.map +0 -1
- package/dist/src/benchmark/BenchmarkSuite.d.ts +0 -318
- package/dist/src/benchmark/BenchmarkSuite.d.ts.map +0 -1
- package/dist/src/benchmark/BenchmarkSuite.js +0 -986
- package/dist/src/benchmark/BenchmarkSuite.js.map +0 -1
- package/dist/src/benchmark/index.d.ts +0 -29
- package/dist/src/benchmark/index.d.ts.map +0 -1
- package/dist/src/benchmark/index.js +0 -39
- package/dist/src/benchmark/index.js.map +0 -1
- package/dist/src/cli/commands/hyperbolic.d.ts +0 -11
- package/dist/src/cli/commands/hyperbolic.d.ts.map +0 -1
- package/dist/src/cli/commands/hyperbolic.js +0 -428
- package/dist/src/cli/commands/hyperbolic.js.map +0 -1
- package/dist/src/cli/commands/learn.d.ts +0 -11
- package/dist/src/cli/commands/learn.d.ts.map +0 -1
- package/dist/src/cli/commands/learn.js +0 -404
- package/dist/src/cli/commands/learn.js.map +0 -1
- package/dist/src/cli/commands/route.d.ts +0 -11
- package/dist/src/cli/commands/route.d.ts.map +0 -1
- package/dist/src/cli/commands/route.js +0 -414
- package/dist/src/cli/commands/route.js.map +0 -1
- package/dist/src/cli/commands/rvf.d.ts +0 -21
- package/dist/src/cli/commands/rvf.d.ts.map +0 -1
- package/dist/src/cli/commands/rvf.js +0 -448
- package/dist/src/cli/commands/rvf.js.map +0 -1
- package/dist/src/cli/tests/agentdb-cli.test.d.ts +0 -8
- package/dist/src/cli/tests/agentdb-cli.test.d.ts.map +0 -1
- package/dist/src/cli/tests/agentdb-cli.test.js +0 -50
- package/dist/src/cli/tests/agentdb-cli.test.js.map +0 -1
- package/dist/src/cli/tests/attention-cli.test.d.ts +0 -5
- package/dist/src/cli/tests/attention-cli.test.d.ts.map +0 -1
- package/dist/src/cli/tests/attention-cli.test.js +0 -257
- package/dist/src/cli/tests/attention-cli.test.js.map +0 -1
- package/dist/src/compatibility/DeprecationWarnings.d.ts +0 -54
- package/dist/src/compatibility/DeprecationWarnings.d.ts.map +0 -1
- package/dist/src/compatibility/DeprecationWarnings.js +0 -131
- package/dist/src/compatibility/DeprecationWarnings.js.map +0 -1
- package/dist/src/compatibility/MigrationUtilities.d.ts +0 -30
- package/dist/src/compatibility/MigrationUtilities.d.ts.map +0 -1
- package/dist/src/compatibility/MigrationUtilities.js +0 -184
- package/dist/src/compatibility/MigrationUtilities.js.map +0 -1
- package/dist/src/compatibility/V1toV2Adapter.d.ts +0 -76
- package/dist/src/compatibility/V1toV2Adapter.d.ts.map +0 -1
- package/dist/src/compatibility/V1toV2Adapter.js +0 -198
- package/dist/src/compatibility/V1toV2Adapter.js.map +0 -1
- package/dist/src/compatibility/VersionDetector.d.ts +0 -32
- package/dist/src/compatibility/VersionDetector.d.ts.map +0 -1
- package/dist/src/compatibility/VersionDetector.js +0 -144
- package/dist/src/compatibility/VersionDetector.js.map +0 -1
- package/dist/src/compatibility/index.d.ts +0 -11
- package/dist/src/compatibility/index.d.ts.map +0 -1
- package/dist/src/compatibility/index.js +0 -10
- package/dist/src/compatibility/index.js.map +0 -1
- package/dist/src/compatibility/types.d.ts +0 -103
- package/dist/src/compatibility/types.d.ts.map +0 -1
- package/dist/src/compatibility/types.js +0 -5
- package/dist/src/compatibility/types.js.map +0 -1
- package/dist/src/controllers/MemoryController.d.ts +0 -161
- package/dist/src/controllers/MemoryController.d.ts.map +0 -1
- package/dist/src/controllers/MemoryController.js +0 -290
- package/dist/src/controllers/MemoryController.js.map +0 -1
- package/dist/src/controllers/attention/CrossAttentionController.d.ts +0 -141
- package/dist/src/controllers/attention/CrossAttentionController.d.ts.map +0 -1
- package/dist/src/controllers/attention/CrossAttentionController.js +0 -325
- package/dist/src/controllers/attention/CrossAttentionController.js.map +0 -1
- package/dist/src/controllers/attention/MultiHeadAttentionController.d.ts +0 -137
- package/dist/src/controllers/attention/MultiHeadAttentionController.d.ts.map +0 -1
- package/dist/src/controllers/attention/MultiHeadAttentionController.js +0 -339
- package/dist/src/controllers/attention/MultiHeadAttentionController.js.map +0 -1
- package/dist/src/controllers/attention/SelfAttentionController.d.ts +0 -117
- package/dist/src/controllers/attention/SelfAttentionController.d.ts.map +0 -1
- package/dist/src/controllers/attention/SelfAttentionController.js +0 -205
- package/dist/src/controllers/attention/SelfAttentionController.js.map +0 -1
- package/dist/src/controllers/attention/index.d.ts +0 -15
- package/dist/src/controllers/attention/index.d.ts.map +0 -1
- package/dist/src/controllers/attention/index.js +0 -12
- package/dist/src/controllers/attention/index.js.map +0 -1
- package/dist/src/core/QueryCache.d.ts +0 -138
- package/dist/src/core/QueryCache.d.ts.map +0 -1
- package/dist/src/core/QueryCache.js +0 -313
- package/dist/src/core/QueryCache.js.map +0 -1
- package/dist/src/observability/index.d.ts +0 -8
- package/dist/src/observability/index.d.ts.map +0 -1
- package/dist/src/observability/index.js +0 -8
- package/dist/src/observability/index.js.map +0 -1
- package/dist/src/observability/integration.d.ts +0 -32
- package/dist/src/observability/integration.d.ts.map +0 -1
- package/dist/src/observability/integration.js +0 -157
- package/dist/src/observability/integration.js.map +0 -1
- package/dist/src/observability/telemetry.d.ts +0 -137
- package/dist/src/observability/telemetry.d.ts.map +0 -1
- package/dist/src/observability/telemetry.js +0 -420
- package/dist/src/observability/telemetry.js.map +0 -1
- package/dist/src/quantization/index.d.ts +0 -7
- package/dist/src/quantization/index.d.ts.map +0 -1
- package/dist/src/quantization/index.js +0 -15
- package/dist/src/quantization/index.js.map +0 -1
- package/dist/src/quantization/vector-quantization.d.ts +0 -388
- package/dist/src/quantization/vector-quantization.d.ts.map +0 -1
- package/dist/src/quantization/vector-quantization.js +0 -1136
- package/dist/src/quantization/vector-quantization.js.map +0 -1
- package/dist/src/search/HybridSearch.d.ts +0 -311
- package/dist/src/search/HybridSearch.d.ts.map +0 -1
- package/dist/src/search/HybridSearch.js +0 -712
- package/dist/src/search/HybridSearch.js.map +0 -1
- package/dist/src/search/index.d.ts +0 -12
- package/dist/src/search/index.d.ts.map +0 -1
- package/dist/src/search/index.js +0 -16
- package/dist/src/search/index.js.map +0 -1
- package/dist/src/services/AttentionService.d.ts +0 -303
- package/dist/src/services/AttentionService.d.ts.map +0 -1
- package/dist/src/services/AttentionService.js +0 -1167
- package/dist/src/services/AttentionService.js.map +0 -1
- package/dist/src/simd/index.d.ts +0 -9
- package/dist/src/simd/index.d.ts.map +0 -1
- package/dist/src/simd/index.js +0 -27
- package/dist/src/simd/index.js.map +0 -1
- package/dist/src/simd/simd-vector-ops.d.ts +0 -332
- package/dist/src/simd/simd-vector-ops.d.ts.map +0 -1
- package/dist/src/simd/simd-vector-ops.js +0 -947
- package/dist/src/simd/simd-vector-ops.js.map +0 -1
- package/dist/src/tests/attention-service.test.d.ts +0 -7
- package/dist/src/tests/attention-service.test.d.ts.map +0 -1
- package/dist/src/tests/attention-service.test.js +0 -401
- package/dist/src/tests/attention-service.test.js.map +0 -1
- package/dist/src/tests/integration/compatibility/backwards-compat.integration.test.d.ts +0 -7
- package/dist/src/tests/integration/compatibility/backwards-compat.integration.test.d.ts.map +0 -1
- package/dist/src/tests/integration/compatibility/backwards-compat.integration.test.js +0 -283
- package/dist/src/tests/integration/compatibility/backwards-compat.integration.test.js.map +0 -1
- package/dist/src/tests/query-cache.test.d.ts +0 -7
- package/dist/src/tests/query-cache.test.d.ts.map +0 -1
- package/dist/src/tests/query-cache.test.js +0 -343
- package/dist/src/tests/query-cache.test.js.map +0 -1
- package/dist/src/tests/ruvector-integration.test.d.ts +0 -14
- package/dist/src/tests/ruvector-integration.test.d.ts.map +0 -1
- package/dist/src/tests/ruvector-integration.test.js +0 -1156
- package/dist/src/tests/ruvector-integration.test.js.map +0 -1
- package/dist/src/tests/unit/auth/crypto.utils.test.d.ts +0 -6
- package/dist/src/tests/unit/auth/crypto.utils.test.d.ts.map +0 -1
- package/dist/src/tests/unit/auth/crypto.utils.test.js +0 -310
- package/dist/src/tests/unit/auth/crypto.utils.test.js.map +0 -1
- package/dist/src/tests/unit/compatibility/deprecation-warnings.test.d.ts +0 -5
- package/dist/src/tests/unit/compatibility/deprecation-warnings.test.d.ts.map +0 -1
- package/dist/src/tests/unit/compatibility/deprecation-warnings.test.js +0 -207
- package/dist/src/tests/unit/compatibility/deprecation-warnings.test.js.map +0 -1
- package/dist/src/tests/unit/compatibility/migration-utils.test.d.ts +0 -5
- package/dist/src/tests/unit/compatibility/migration-utils.test.d.ts.map +0 -1
- package/dist/src/tests/unit/compatibility/migration-utils.test.js +0 -264
- package/dist/src/tests/unit/compatibility/migration-utils.test.js.map +0 -1
- package/dist/src/tests/unit/compatibility/v1-adapter.test.d.ts +0 -7
- package/dist/src/tests/unit/compatibility/v1-adapter.test.d.ts.map +0 -1
- package/dist/src/tests/unit/compatibility/v1-adapter.test.js +0 -228
- package/dist/src/tests/unit/compatibility/v1-adapter.test.js.map +0 -1
- package/dist/src/tests/unit/compatibility/version-detector.test.d.ts +0 -10
- package/dist/src/tests/unit/compatibility/version-detector.test.d.ts.map +0 -1
- package/dist/src/tests/unit/compatibility/version-detector.test.js +0 -162
- package/dist/src/tests/unit/compatibility/version-detector.test.js.map +0 -1
- package/dist/src/tests/vector-quantization.test.d.ts +0 -5
- package/dist/src/tests/vector-quantization.test.d.ts.map +0 -1
- package/dist/src/tests/vector-quantization.test.js +0 -338
- package/dist/src/tests/vector-quantization.test.js.map +0 -1
- package/dist/src/tests/wasm-vector-search.test.d.ts +0 -7
- package/dist/src/tests/wasm-vector-search.test.d.ts.map +0 -1
- package/dist/src/tests/wasm-vector-search.test.js +0 -193
- package/dist/src/tests/wasm-vector-search.test.js.map +0 -1
- package/dist/src/types/database.types.d.ts +0 -275
- package/dist/src/types/database.types.d.ts.map +0 -1
- package/dist/src/types/database.types.js +0 -57
- package/dist/src/types/database.types.js.map +0 -1
- package/dist/src/utils/chalk-fallback.d.ts +0 -3
- package/dist/src/utils/chalk-fallback.d.ts.map +0 -1
- package/dist/src/utils/chalk-fallback.js +0 -20
- package/dist/src/utils/chalk-fallback.js.map +0 -1
- package/dist/src/utils/crypto.utils.d.ts +0 -122
- package/dist/src/utils/crypto.utils.d.ts.map +0 -1
- package/dist/src/utils/crypto.utils.js +0 -296
- package/dist/src/utils/crypto.utils.js.map +0 -1
- package/dist/src/utils/similarity.d.ts +0 -11
- package/dist/src/utils/similarity.d.ts.map +0 -1
- package/dist/src/utils/similarity.js +0 -25
- package/dist/src/utils/similarity.js.map +0 -1
- package/dist/src/wasm-loader.d.ts +0 -67
- package/dist/src/wasm-loader.d.ts.map +0 -1
- package/dist/src/wasm-loader.js +0 -78
- package/dist/src/wasm-loader.js.map +0 -1
- package/dist/src/wrappers/agentdb-fast.d.ts +0 -139
- package/dist/src/wrappers/agentdb-fast.d.ts.map +0 -1
- package/dist/src/wrappers/agentdb-fast.js +0 -316
- package/dist/src/wrappers/agentdb-fast.js.map +0 -1
- package/dist/src/wrappers/attention-fallbacks.d.ts +0 -351
- package/dist/src/wrappers/attention-fallbacks.d.ts.map +0 -1
- package/dist/src/wrappers/attention-fallbacks.js +0 -1487
- package/dist/src/wrappers/attention-fallbacks.js.map +0 -1
- package/dist/src/wrappers/embedding-service.d.ts +0 -117
- package/dist/src/wrappers/embedding-service.d.ts.map +0 -1
- package/dist/src/wrappers/embedding-service.js +0 -376
- package/dist/src/wrappers/embedding-service.js.map +0 -1
- package/dist/src/wrappers/gnn-wrapper.d.ts +0 -71
- package/dist/src/wrappers/gnn-wrapper.d.ts.map +0 -1
- package/dist/src/wrappers/gnn-wrapper.js +0 -240
- package/dist/src/wrappers/gnn-wrapper.js.map +0 -1
- package/dist/src/wrappers/index.d.ts +0 -48
- package/dist/src/wrappers/index.d.ts.map +0 -1
- package/dist/src/wrappers/index.js +0 -83
- package/dist/src/wrappers/index.js.map +0 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Health Monitor
|
|
3
|
+
*
|
|
4
|
+
* System resource tracking, performance monitoring, and self-healing
|
|
5
|
+
* using MPC (Message Passing with Coordination) algorithm.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from 'events';
|
|
8
|
+
export interface HealthMetrics {
|
|
9
|
+
timestamp: Date;
|
|
10
|
+
cpu: {
|
|
11
|
+
usage: number;
|
|
12
|
+
loadAverage: number[];
|
|
13
|
+
cores: number;
|
|
14
|
+
};
|
|
15
|
+
memory: {
|
|
16
|
+
used: number;
|
|
17
|
+
available: number;
|
|
18
|
+
heapUsed: number;
|
|
19
|
+
heapTotal: number;
|
|
20
|
+
rss: number;
|
|
21
|
+
external: number;
|
|
22
|
+
};
|
|
23
|
+
disk?: {
|
|
24
|
+
readMBps: number;
|
|
25
|
+
writeMBps: number;
|
|
26
|
+
};
|
|
27
|
+
simulation?: {
|
|
28
|
+
iterationsCompleted: number;
|
|
29
|
+
itemsProcessed: number;
|
|
30
|
+
errorsEncountered: number;
|
|
31
|
+
progressPercent: number;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface Alert {
|
|
35
|
+
level: 'info' | 'warning' | 'critical';
|
|
36
|
+
metric: string;
|
|
37
|
+
threshold: number;
|
|
38
|
+
actual: number;
|
|
39
|
+
timestamp: Date;
|
|
40
|
+
action: 'log' | 'throttle' | 'abort' | 'heal';
|
|
41
|
+
message: string;
|
|
42
|
+
}
|
|
43
|
+
export interface AlertThresholds {
|
|
44
|
+
memoryMB: number;
|
|
45
|
+
latencyMs: number;
|
|
46
|
+
cpuPercent?: number;
|
|
47
|
+
errorRate?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface HealingAction {
|
|
50
|
+
type: 'reduce_batch_size' | 'pause_and_gc' | 'restart_component' | 'abort';
|
|
51
|
+
reason: string;
|
|
52
|
+
parameters?: Record<string, any>;
|
|
53
|
+
}
|
|
54
|
+
export declare class HealthMonitor extends EventEmitter {
|
|
55
|
+
private monitoringInterval;
|
|
56
|
+
private intervalMs;
|
|
57
|
+
private thresholds;
|
|
58
|
+
private baselineMetrics;
|
|
59
|
+
private metricsHistory;
|
|
60
|
+
private maxHistorySize;
|
|
61
|
+
constructor(thresholds: AlertThresholds);
|
|
62
|
+
/**
|
|
63
|
+
* Start monitoring system resources.
|
|
64
|
+
*/
|
|
65
|
+
startMonitoring(intervalMs?: number): void;
|
|
66
|
+
/**
|
|
67
|
+
* Stop monitoring.
|
|
68
|
+
*/
|
|
69
|
+
stopMonitoring(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Collect current system metrics.
|
|
72
|
+
*/
|
|
73
|
+
collectMetrics(): HealthMetrics;
|
|
74
|
+
/**
|
|
75
|
+
* Get CPU usage percentage.
|
|
76
|
+
*/
|
|
77
|
+
private getCPUUsage;
|
|
78
|
+
/**
|
|
79
|
+
* Check metrics against thresholds.
|
|
80
|
+
*/
|
|
81
|
+
private checkThresholds;
|
|
82
|
+
/**
|
|
83
|
+
* Detect memory leaks by analyzing growth trend.
|
|
84
|
+
*/
|
|
85
|
+
private detectMemoryLeak;
|
|
86
|
+
/**
|
|
87
|
+
* Check if memory is consistently growing.
|
|
88
|
+
*/
|
|
89
|
+
private isConsistentGrowth;
|
|
90
|
+
/**
|
|
91
|
+
* Trigger self-healing using MPC coordination.
|
|
92
|
+
*
|
|
93
|
+
* MPC (Message Passing with Coordination) achieved 97.9% recall in simulations.
|
|
94
|
+
* We use it here for automatic recovery by coordinating between components.
|
|
95
|
+
*/
|
|
96
|
+
private triggerSelfHealing;
|
|
97
|
+
/**
|
|
98
|
+
* Select healing strategy using MPC-inspired coordination.
|
|
99
|
+
*
|
|
100
|
+
* MPC coordinates between nodes to find stable state. Here, we coordinate
|
|
101
|
+
* between different recovery strategies based on alert severity and history.
|
|
102
|
+
*/
|
|
103
|
+
private selectHealingStrategy;
|
|
104
|
+
/**
|
|
105
|
+
* Check if garbage collection can recover memory.
|
|
106
|
+
*/
|
|
107
|
+
private canRecoverWithGC;
|
|
108
|
+
/**
|
|
109
|
+
* Get recent alerts (last 10 seconds).
|
|
110
|
+
*/
|
|
111
|
+
private getRecentAlerts;
|
|
112
|
+
/**
|
|
113
|
+
* Heal by forcing garbage collection.
|
|
114
|
+
*/
|
|
115
|
+
private healByGarbageCollection;
|
|
116
|
+
/**
|
|
117
|
+
* Heal by reducing workload.
|
|
118
|
+
*/
|
|
119
|
+
private healByReducingLoad;
|
|
120
|
+
/**
|
|
121
|
+
* Heal by restarting component.
|
|
122
|
+
*/
|
|
123
|
+
private healByRestartingComponent;
|
|
124
|
+
/**
|
|
125
|
+
* Heal by aborting (last resort).
|
|
126
|
+
*/
|
|
127
|
+
private healByAborting;
|
|
128
|
+
/**
|
|
129
|
+
* Get current health status.
|
|
130
|
+
*/
|
|
131
|
+
getStatus(): {
|
|
132
|
+
healthy: boolean;
|
|
133
|
+
metrics: HealthMetrics;
|
|
134
|
+
alerts: Alert[];
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Get metrics history.
|
|
138
|
+
*/
|
|
139
|
+
getHistory(): HealthMetrics[];
|
|
140
|
+
/**
|
|
141
|
+
* Generate health report.
|
|
142
|
+
*/
|
|
143
|
+
generateReport(): string;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Create health monitor instance.
|
|
147
|
+
*/
|
|
148
|
+
export declare function createHealthMonitor(thresholds: AlertThresholds): HealthMonitor;
|
|
149
|
+
//# sourceMappingURL=health-monitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-monitor.d.ts","sourceRoot":"","sources":["../../../../src/cli/lib/health-monitor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAQtC,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,IAAI,CAAC;IAChB,GAAG,EAAE;QACH,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,IAAI,CAAC,EAAE;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,UAAU,CAAC,EAAE;QACX,mBAAmB,EAAE,MAAM,CAAC;QAC5B,cAAc,EAAE,MAAM,CAAC;QACvB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,MA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kBAAkB;IAyB1B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IA8C7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;OAEG;IACH,OAAO,CAAC,eAAe;IAKvB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAW/B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAQ1B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAQjC;;OAEG;IACH,OAAO,CAAC,cAAc;IAWtB;;OAEG;IACH,SAAS,IAAI;QACX,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,aAAa,CAAC;QACvB,MAAM,EAAE,KAAK,EAAE,CAAC;KACjB;IAWD;;OAEG;IACH,UAAU,IAAI,aAAa,EAAE;IAI7B;;OAEG;IACH,cAAc,IAAI,MAAM;CAgCzB;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,eAAe,GAAG,aAAa,CAE9E"}
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Health Monitor
|
|
3
|
+
*
|
|
4
|
+
* System resource tracking, performance monitoring, and self-healing
|
|
5
|
+
* using MPC (Message Passing with Coordination) algorithm.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from 'events';
|
|
8
|
+
import * as os from 'os';
|
|
9
|
+
import * as v8 from 'v8';
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Health Monitor
|
|
12
|
+
// ============================================================================
|
|
13
|
+
export class HealthMonitor extends EventEmitter {
|
|
14
|
+
monitoringInterval = null;
|
|
15
|
+
intervalMs = 1000; // 1 second
|
|
16
|
+
thresholds;
|
|
17
|
+
baselineMetrics = null;
|
|
18
|
+
metricsHistory = [];
|
|
19
|
+
maxHistorySize = 100;
|
|
20
|
+
constructor(thresholds) {
|
|
21
|
+
super();
|
|
22
|
+
this.thresholds = thresholds;
|
|
23
|
+
}
|
|
24
|
+
// --------------------------------------------------------------------------
|
|
25
|
+
// Monitoring
|
|
26
|
+
// --------------------------------------------------------------------------
|
|
27
|
+
/**
|
|
28
|
+
* Start monitoring system resources.
|
|
29
|
+
*/
|
|
30
|
+
startMonitoring(intervalMs = 1000) {
|
|
31
|
+
this.intervalMs = intervalMs;
|
|
32
|
+
if (this.monitoringInterval) {
|
|
33
|
+
this.stopMonitoring();
|
|
34
|
+
}
|
|
35
|
+
// Collect baseline
|
|
36
|
+
this.baselineMetrics = this.collectMetrics();
|
|
37
|
+
this.monitoringInterval = setInterval(() => {
|
|
38
|
+
const metrics = this.collectMetrics();
|
|
39
|
+
// Store in history
|
|
40
|
+
this.metricsHistory.push(metrics);
|
|
41
|
+
if (this.metricsHistory.length > this.maxHistorySize) {
|
|
42
|
+
this.metricsHistory.shift();
|
|
43
|
+
}
|
|
44
|
+
// Check thresholds
|
|
45
|
+
const alerts = this.checkThresholds(metrics);
|
|
46
|
+
// Emit events
|
|
47
|
+
this.emit('metrics', metrics);
|
|
48
|
+
for (const alert of alerts) {
|
|
49
|
+
this.emit('alert', alert);
|
|
50
|
+
if (alert.action === 'heal') {
|
|
51
|
+
this.triggerSelfHealing(alert);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, intervalMs);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Stop monitoring.
|
|
58
|
+
*/
|
|
59
|
+
stopMonitoring() {
|
|
60
|
+
if (this.monitoringInterval) {
|
|
61
|
+
clearInterval(this.monitoringInterval);
|
|
62
|
+
this.monitoringInterval = null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Collect current system metrics.
|
|
67
|
+
*/
|
|
68
|
+
collectMetrics() {
|
|
69
|
+
const memUsage = process.memoryUsage();
|
|
70
|
+
const heapStats = v8.getHeapStatistics();
|
|
71
|
+
return {
|
|
72
|
+
timestamp: new Date(),
|
|
73
|
+
cpu: {
|
|
74
|
+
usage: this.getCPUUsage(),
|
|
75
|
+
loadAverage: os.loadavg(),
|
|
76
|
+
cores: os.cpus().length
|
|
77
|
+
},
|
|
78
|
+
memory: {
|
|
79
|
+
used: (os.totalmem() - os.freemem()) / 1024 / 1024,
|
|
80
|
+
available: os.freemem() / 1024 / 1024,
|
|
81
|
+
heapUsed: memUsage.heapUsed / 1024 / 1024,
|
|
82
|
+
heapTotal: memUsage.heapTotal / 1024 / 1024,
|
|
83
|
+
rss: memUsage.rss / 1024 / 1024,
|
|
84
|
+
external: memUsage.external / 1024 / 1024
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get CPU usage percentage.
|
|
90
|
+
*/
|
|
91
|
+
getCPUUsage() {
|
|
92
|
+
const cpus = os.cpus();
|
|
93
|
+
let totalIdle = 0;
|
|
94
|
+
let totalTick = 0;
|
|
95
|
+
for (const cpu of cpus) {
|
|
96
|
+
for (const type in cpu.times) {
|
|
97
|
+
totalTick += cpu.times[type];
|
|
98
|
+
}
|
|
99
|
+
totalIdle += cpu.times.idle;
|
|
100
|
+
}
|
|
101
|
+
const idle = totalIdle / cpus.length;
|
|
102
|
+
const total = totalTick / cpus.length;
|
|
103
|
+
const usage = 100 - ~~(100 * idle / total);
|
|
104
|
+
return usage;
|
|
105
|
+
}
|
|
106
|
+
// --------------------------------------------------------------------------
|
|
107
|
+
// Threshold Checking
|
|
108
|
+
// --------------------------------------------------------------------------
|
|
109
|
+
/**
|
|
110
|
+
* Check metrics against thresholds.
|
|
111
|
+
*/
|
|
112
|
+
checkThresholds(metrics) {
|
|
113
|
+
const alerts = [];
|
|
114
|
+
// Memory threshold
|
|
115
|
+
if (metrics.memory.heapUsed > this.thresholds.memoryMB) {
|
|
116
|
+
const level = metrics.memory.heapUsed > this.thresholds.memoryMB * 1.5 ? 'critical' :
|
|
117
|
+
metrics.memory.heapUsed > this.thresholds.memoryMB * 1.2 ? 'warning' : 'info';
|
|
118
|
+
const action = level === 'critical' ? 'heal' :
|
|
119
|
+
level === 'warning' ? 'throttle' : 'log';
|
|
120
|
+
alerts.push({
|
|
121
|
+
level,
|
|
122
|
+
metric: 'memory',
|
|
123
|
+
threshold: this.thresholds.memoryMB,
|
|
124
|
+
actual: metrics.memory.heapUsed,
|
|
125
|
+
timestamp: metrics.timestamp,
|
|
126
|
+
action,
|
|
127
|
+
message: `Memory usage (${metrics.memory.heapUsed.toFixed(0)}MB) exceeds threshold (${this.thresholds.memoryMB}MB)`
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// CPU threshold (if configured)
|
|
131
|
+
if (this.thresholds.cpuPercent && metrics.cpu.usage > this.thresholds.cpuPercent) {
|
|
132
|
+
alerts.push({
|
|
133
|
+
level: 'warning',
|
|
134
|
+
metric: 'cpu',
|
|
135
|
+
threshold: this.thresholds.cpuPercent,
|
|
136
|
+
actual: metrics.cpu.usage,
|
|
137
|
+
timestamp: metrics.timestamp,
|
|
138
|
+
action: 'throttle',
|
|
139
|
+
message: `CPU usage (${metrics.cpu.usage.toFixed(0)}%) exceeds threshold (${this.thresholds.cpuPercent}%)`
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
// Memory leak detection
|
|
143
|
+
if (this.detectMemoryLeak(metrics)) {
|
|
144
|
+
alerts.push({
|
|
145
|
+
level: 'critical',
|
|
146
|
+
metric: 'memory-leak',
|
|
147
|
+
threshold: 0,
|
|
148
|
+
actual: metrics.memory.heapUsed,
|
|
149
|
+
timestamp: metrics.timestamp,
|
|
150
|
+
action: 'heal',
|
|
151
|
+
message: 'Potential memory leak detected (steady growth over time)'
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return alerts;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Detect memory leaks by analyzing growth trend.
|
|
158
|
+
*/
|
|
159
|
+
detectMemoryLeak(currentMetrics) {
|
|
160
|
+
if (this.metricsHistory.length < 10) {
|
|
161
|
+
return false; // Need at least 10 samples
|
|
162
|
+
}
|
|
163
|
+
// Get last 10 samples
|
|
164
|
+
const recent = this.metricsHistory.slice(-10);
|
|
165
|
+
const memoryValues = recent.map(m => m.memory.heapUsed);
|
|
166
|
+
// Calculate trend (simple linear regression)
|
|
167
|
+
const n = memoryValues.length;
|
|
168
|
+
const x = Array.from({ length: n }, (_, i) => i);
|
|
169
|
+
const y = memoryValues;
|
|
170
|
+
const meanX = x.reduce((a, b) => a + b, 0) / n;
|
|
171
|
+
const meanY = y.reduce((a, b) => a + b, 0) / n;
|
|
172
|
+
const numerator = x.reduce((sum, xi, i) => sum + (xi - meanX) * (y[i] - meanY), 0);
|
|
173
|
+
const denominator = x.reduce((sum, xi) => sum + Math.pow(xi - meanX, 2), 0);
|
|
174
|
+
const slope = numerator / denominator;
|
|
175
|
+
// If slope > 10MB per sample and consistent growth
|
|
176
|
+
return slope > 10 && this.isConsistentGrowth(memoryValues);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Check if memory is consistently growing.
|
|
180
|
+
*/
|
|
181
|
+
isConsistentGrowth(values) {
|
|
182
|
+
let increases = 0;
|
|
183
|
+
for (let i = 1; i < values.length; i++) {
|
|
184
|
+
if (values[i] > values[i - 1]) {
|
|
185
|
+
increases++;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Consider consistent if >80% of samples are increasing
|
|
189
|
+
return increases / (values.length - 1) > 0.8;
|
|
190
|
+
}
|
|
191
|
+
// --------------------------------------------------------------------------
|
|
192
|
+
// Self-Healing (MPC Algorithm)
|
|
193
|
+
// --------------------------------------------------------------------------
|
|
194
|
+
/**
|
|
195
|
+
* Trigger self-healing using MPC coordination.
|
|
196
|
+
*
|
|
197
|
+
* MPC (Message Passing with Coordination) achieved 97.9% recall in simulations.
|
|
198
|
+
* We use it here for automatic recovery by coordinating between components.
|
|
199
|
+
*/
|
|
200
|
+
triggerSelfHealing(alert) {
|
|
201
|
+
console.log(`🔧 Self-healing triggered for ${alert.metric}`);
|
|
202
|
+
const healingAction = this.selectHealingStrategy(alert);
|
|
203
|
+
this.emit('healing', healingAction);
|
|
204
|
+
switch (healingAction.type) {
|
|
205
|
+
case 'pause_and_gc':
|
|
206
|
+
this.healByGarbageCollection();
|
|
207
|
+
break;
|
|
208
|
+
case 'reduce_batch_size':
|
|
209
|
+
this.healByReducingLoad(healingAction.parameters);
|
|
210
|
+
break;
|
|
211
|
+
case 'restart_component':
|
|
212
|
+
this.healByRestartingComponent(healingAction.parameters);
|
|
213
|
+
break;
|
|
214
|
+
case 'abort':
|
|
215
|
+
this.healByAborting(healingAction.reason);
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Select healing strategy using MPC-inspired coordination.
|
|
221
|
+
*
|
|
222
|
+
* MPC coordinates between nodes to find stable state. Here, we coordinate
|
|
223
|
+
* between different recovery strategies based on alert severity and history.
|
|
224
|
+
*/
|
|
225
|
+
selectHealingStrategy(alert) {
|
|
226
|
+
// Analyze recent alerts to determine best strategy
|
|
227
|
+
const recentAlerts = this.getRecentAlerts();
|
|
228
|
+
// If memory is the issue
|
|
229
|
+
if (alert.metric === 'memory' || alert.metric === 'memory-leak') {
|
|
230
|
+
// Check if GC helps (coordinate with GC subsystem)
|
|
231
|
+
if (this.canRecoverWithGC()) {
|
|
232
|
+
return {
|
|
233
|
+
type: 'pause_and_gc',
|
|
234
|
+
reason: 'Memory pressure can be relieved by garbage collection'
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
// Check if reducing load helps (coordinate with workload manager)
|
|
238
|
+
if (alert.actual < this.thresholds.memoryMB * 2) {
|
|
239
|
+
return {
|
|
240
|
+
type: 'reduce_batch_size',
|
|
241
|
+
reason: 'Reduce batch size to lower memory footprint',
|
|
242
|
+
parameters: { reductionFactor: 0.5 }
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
// Last resort: abort
|
|
246
|
+
return {
|
|
247
|
+
type: 'abort',
|
|
248
|
+
reason: 'Memory exhaustion - cannot recover safely'
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
// If CPU is the issue
|
|
252
|
+
if (alert.metric === 'cpu') {
|
|
253
|
+
return {
|
|
254
|
+
type: 'reduce_batch_size',
|
|
255
|
+
reason: 'Reduce CPU load by throttling workload',
|
|
256
|
+
parameters: { reductionFactor: 0.7 }
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
// Default: log and monitor
|
|
260
|
+
return {
|
|
261
|
+
type: 'pause_and_gc',
|
|
262
|
+
reason: 'Unknown issue - attempt recovery via GC'
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Check if garbage collection can recover memory.
|
|
267
|
+
*/
|
|
268
|
+
canRecoverWithGC() {
|
|
269
|
+
const heapStats = v8.getHeapStatistics();
|
|
270
|
+
const usedPercent = heapStats.used_heap_size / heapStats.heap_size_limit;
|
|
271
|
+
// If we're using < 90% of heap, GC should help
|
|
272
|
+
return usedPercent < 0.9;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Get recent alerts (last 10 seconds).
|
|
276
|
+
*/
|
|
277
|
+
getRecentAlerts() {
|
|
278
|
+
// This would be tracked in a real implementation
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Heal by forcing garbage collection.
|
|
283
|
+
*/
|
|
284
|
+
healByGarbageCollection() {
|
|
285
|
+
console.log('🧹 Running garbage collection...');
|
|
286
|
+
if (global.gc) {
|
|
287
|
+
global.gc();
|
|
288
|
+
console.log('✅ Garbage collection completed');
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
console.warn('⚠️ GC not available (run with --expose-gc)');
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Heal by reducing workload.
|
|
296
|
+
*/
|
|
297
|
+
healByReducingLoad(parameters) {
|
|
298
|
+
const factor = parameters?.reductionFactor || 0.5;
|
|
299
|
+
console.log(`📉 Reducing workload by ${((1 - factor) * 100).toFixed(0)}%...`);
|
|
300
|
+
// Emit event for simulation runner to reduce batch size
|
|
301
|
+
this.emit('reduce-load', { factor });
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Heal by restarting component.
|
|
305
|
+
*/
|
|
306
|
+
healByRestartingComponent(parameters) {
|
|
307
|
+
const component = parameters?.component || 'unknown';
|
|
308
|
+
console.log(`🔄 Restarting component: ${component}...`);
|
|
309
|
+
// Emit event for component restart
|
|
310
|
+
this.emit('restart-component', { component });
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Heal by aborting (last resort).
|
|
314
|
+
*/
|
|
315
|
+
healByAborting(reason) {
|
|
316
|
+
console.error(`🛑 Aborting simulation: ${reason}`);
|
|
317
|
+
// Emit abort event
|
|
318
|
+
this.emit('abort', { reason });
|
|
319
|
+
}
|
|
320
|
+
// --------------------------------------------------------------------------
|
|
321
|
+
// Reporting
|
|
322
|
+
// --------------------------------------------------------------------------
|
|
323
|
+
/**
|
|
324
|
+
* Get current health status.
|
|
325
|
+
*/
|
|
326
|
+
getStatus() {
|
|
327
|
+
const metrics = this.collectMetrics();
|
|
328
|
+
const alerts = this.checkThresholds(metrics);
|
|
329
|
+
return {
|
|
330
|
+
healthy: alerts.filter(a => a.level === 'critical').length === 0,
|
|
331
|
+
metrics,
|
|
332
|
+
alerts
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Get metrics history.
|
|
337
|
+
*/
|
|
338
|
+
getHistory() {
|
|
339
|
+
return [...this.metricsHistory];
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Generate health report.
|
|
343
|
+
*/
|
|
344
|
+
generateReport() {
|
|
345
|
+
const status = this.getStatus();
|
|
346
|
+
let report = '# System Health Report\n\n';
|
|
347
|
+
report += `**Generated**: ${new Date().toLocaleString()}\n`;
|
|
348
|
+
report += `**Status**: ${status.healthy ? '✅ Healthy' : '⚠️ Unhealthy'}\n\n`;
|
|
349
|
+
report += '## Current Metrics\n\n';
|
|
350
|
+
report += `- **CPU Usage**: ${status.metrics.cpu.usage.toFixed(1)}%\n`;
|
|
351
|
+
report += `- **Load Average**: ${status.metrics.cpu.loadAverage.map(l => l.toFixed(2)).join(', ')}\n`;
|
|
352
|
+
report += `- **Memory Used**: ${status.metrics.memory.used.toFixed(0)} MB\n`;
|
|
353
|
+
report += `- **Memory Available**: ${status.metrics.memory.available.toFixed(0)} MB\n`;
|
|
354
|
+
report += `- **Heap Used**: ${status.metrics.memory.heapUsed.toFixed(0)} MB\n`;
|
|
355
|
+
report += `- **Heap Total**: ${status.metrics.memory.heapTotal.toFixed(0)} MB\n\n`;
|
|
356
|
+
if (status.alerts.length > 0) {
|
|
357
|
+
report += '## Active Alerts\n\n';
|
|
358
|
+
for (const alert of status.alerts) {
|
|
359
|
+
const icon = alert.level === 'critical' ? '🔴' :
|
|
360
|
+
alert.level === 'warning' ? '🟠' : '🟡';
|
|
361
|
+
report += `${icon} **${alert.metric}** (${alert.level})\n`;
|
|
362
|
+
report += `- ${alert.message}\n`;
|
|
363
|
+
report += `- Threshold: ${alert.threshold}\n`;
|
|
364
|
+
report += `- Actual: ${alert.actual.toFixed(2)}\n`;
|
|
365
|
+
report += `- Action: ${alert.action}\n\n`;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return report;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
// ============================================================================
|
|
372
|
+
// Factory
|
|
373
|
+
// ============================================================================
|
|
374
|
+
/**
|
|
375
|
+
* Create health monitor instance.
|
|
376
|
+
*/
|
|
377
|
+
export function createHealthMonitor(thresholds) {
|
|
378
|
+
return new HealthMonitor(thresholds);
|
|
379
|
+
}
|
|
380
|
+
//# sourceMappingURL=health-monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-monitor.js","sourceRoot":"","sources":["../../../../src/cli/lib/health-monitor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QA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MAAM,IAAI,aAAa,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;gBACnD,MAAM,IAAI,aAAa,KAAK,CAAC,MAAM,MAAM,CAAC;YAC5C,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAA2B;IAC7D,OAAO,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* History Tracker
|
|
3
|
+
*
|
|
4
|
+
* Tracks performance trends, detects regressions, and prepares
|
|
5
|
+
* visualization data for simulation history.
|
|
6
|
+
*/
|
|
7
|
+
import { ReportStore } from './report-store';
|
|
8
|
+
export interface PerformanceTrend {
|
|
9
|
+
metric: string;
|
|
10
|
+
scenario: string;
|
|
11
|
+
dataPoints: Array<{
|
|
12
|
+
timestamp: Date;
|
|
13
|
+
value: number;
|
|
14
|
+
runId: number;
|
|
15
|
+
}>;
|
|
16
|
+
statistics: {
|
|
17
|
+
mean: number;
|
|
18
|
+
median: number;
|
|
19
|
+
min: number;
|
|
20
|
+
max: number;
|
|
21
|
+
stdDev: number;
|
|
22
|
+
};
|
|
23
|
+
trend: 'improving' | 'degrading' | 'stable';
|
|
24
|
+
slope?: number;
|
|
25
|
+
rSquared?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface VisualizationData {
|
|
28
|
+
type: 'line' | 'bar' | 'scatter';
|
|
29
|
+
labels: string[];
|
|
30
|
+
datasets: Array<{
|
|
31
|
+
label: string;
|
|
32
|
+
data: number[];
|
|
33
|
+
backgroundColor?: string;
|
|
34
|
+
borderColor?: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
export interface RegressionAlert {
|
|
38
|
+
severity: 'minor' | 'major' | 'critical';
|
|
39
|
+
metric: string;
|
|
40
|
+
scenario: string;
|
|
41
|
+
message: string;
|
|
42
|
+
degradation: number;
|
|
43
|
+
baseline: number;
|
|
44
|
+
current: number;
|
|
45
|
+
timestamp: Date;
|
|
46
|
+
}
|
|
47
|
+
export declare class HistoryTracker {
|
|
48
|
+
private store;
|
|
49
|
+
constructor(store: ReportStore);
|
|
50
|
+
/**
|
|
51
|
+
* Get performance trend for a specific metric and scenario.
|
|
52
|
+
*/
|
|
53
|
+
getPerformanceTrend(scenarioId: string, metric: string): Promise<PerformanceTrend>;
|
|
54
|
+
/**
|
|
55
|
+
* Get all performance trends for a scenario.
|
|
56
|
+
*/
|
|
57
|
+
getAllTrends(scenarioId: string): Promise<PerformanceTrend[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Calculate statistical measures.
|
|
60
|
+
*/
|
|
61
|
+
private calculateStatistics;
|
|
62
|
+
/**
|
|
63
|
+
* Calculate R-squared (coefficient of determination) for trend line.
|
|
64
|
+
*/
|
|
65
|
+
private calculateRSquared;
|
|
66
|
+
/**
|
|
67
|
+
* Detect regressions using moving average baseline.
|
|
68
|
+
*/
|
|
69
|
+
detectRegressions(scenarioId: string, windowSize?: number, threshold?: number): Promise<RegressionAlert[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Compare current run against baseline.
|
|
72
|
+
*/
|
|
73
|
+
compareToBaseline(scenarioId: string, currentRunId: number, baselineRunId?: number): Promise<{
|
|
74
|
+
metric: string;
|
|
75
|
+
baseline: number;
|
|
76
|
+
current: number;
|
|
77
|
+
change: number;
|
|
78
|
+
changePercent: number;
|
|
79
|
+
improved: boolean;
|
|
80
|
+
}[]>;
|
|
81
|
+
private getSeverity;
|
|
82
|
+
/**
|
|
83
|
+
* Prepare data for Chart.js line chart.
|
|
84
|
+
*/
|
|
85
|
+
prepareLineChart(scenarioId: string, metrics: string[]): Promise<VisualizationData>;
|
|
86
|
+
/**
|
|
87
|
+
* Prepare data for comparison bar chart.
|
|
88
|
+
*/
|
|
89
|
+
prepareComparisonChart(runIds: number[]): Promise<VisualizationData>;
|
|
90
|
+
/**
|
|
91
|
+
* Prepare scatter plot for correlation analysis.
|
|
92
|
+
*/
|
|
93
|
+
prepareScatterPlot(scenarioId: string, xMetric: string, yMetric: string): Promise<VisualizationData>;
|
|
94
|
+
/**
|
|
95
|
+
* Generate comprehensive trend report.
|
|
96
|
+
*/
|
|
97
|
+
generateTrendReport(scenarioId: string): Promise<string>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create history tracker instance.
|
|
101
|
+
*/
|
|
102
|
+
export declare function createHistoryTracker(store: ReportStore): HistoryTracker;
|
|
103
|
+
//# sourceMappingURL=history-tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-tracker.d.ts","sourceRoot":"","sources":["../../../../src/cli/lib/history-tracker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAOpE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC;QAChB,SAAS,EAAE,IAAI,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IACjC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