agentdb 3.0.0-alpha.9 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +248 -269
- package/dist/schemas/frontier-schema.sql +7 -0
- package/dist/schemas/schema.sql +7 -0
- package/dist/src/backends/ExactSearch.d.ts +22 -0
- package/dist/src/backends/ExactSearch.d.ts.map +1 -0
- package/dist/src/backends/ExactSearch.js +36 -0
- package/dist/src/backends/ExactSearch.js.map +1 -0
- package/dist/src/backends/VectorBackend.d.ts +80 -6
- package/dist/src/backends/VectorBackend.d.ts.map +1 -1
- package/dist/src/backends/VectorBackend.js +67 -1
- package/dist/src/backends/VectorBackend.js.map +1 -1
- package/dist/src/backends/detector.js.map +1 -1
- package/dist/src/backends/factory.d.ts +16 -33
- package/dist/src/backends/factory.d.ts.map +1 -1
- package/dist/src/backends/factory.js +140 -110
- package/dist/src/backends/factory.js.map +1 -1
- package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts +54 -6
- package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts.map +1 -1
- package/dist/src/backends/graph/GraphDatabaseAdapter.js +143 -6
- package/dist/src/backends/graph/GraphDatabaseAdapter.js.map +1 -1
- package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts.map +1 -1
- package/dist/src/backends/hnswlib/HNSWLibBackend.js +35 -8
- package/dist/src/backends/hnswlib/HNSWLibBackend.js.map +1 -1
- package/dist/src/backends/index.d.ts +2 -1
- package/dist/src/backends/index.d.ts.map +1 -1
- package/dist/src/backends/index.js +2 -0
- package/dist/src/backends/index.js.map +1 -1
- package/dist/src/backends/ruvector/RuVectorBackend.d.ts +256 -45
- package/dist/src/backends/ruvector/RuVectorBackend.d.ts.map +1 -1
- package/dist/src/backends/ruvector/RuVectorBackend.js +764 -290
- package/dist/src/backends/ruvector/RuVectorBackend.js.map +1 -1
- package/dist/src/backends/ruvector/RuVectorLearning.d.ts +0 -4
- package/dist/src/backends/ruvector/RuVectorLearning.d.ts.map +1 -1
- package/dist/src/backends/ruvector/RuVectorLearning.js +0 -6
- package/dist/src/backends/ruvector/RuVectorLearning.js.map +1 -1
- package/dist/src/backends/rvf/AdaptiveIndexTuner.d.ts +175 -0
- package/dist/src/backends/rvf/AdaptiveIndexTuner.d.ts.map +1 -0
- package/dist/src/backends/rvf/AdaptiveIndexTuner.js +567 -0
- package/dist/src/backends/rvf/AdaptiveIndexTuner.js.map +1 -0
- package/dist/src/backends/rvf/ContrastiveTrainer.d.ts +148 -0
- package/dist/src/backends/rvf/ContrastiveTrainer.d.ts.map +1 -0
- package/dist/src/backends/rvf/ContrastiveTrainer.js +438 -0
- package/dist/src/backends/rvf/ContrastiveTrainer.js.map +1 -0
- package/dist/src/backends/rvf/FederatedSessionManager.d.ts +212 -0
- package/dist/src/backends/rvf/FederatedSessionManager.d.ts.map +1 -0
- package/dist/src/backends/rvf/FederatedSessionManager.js +397 -0
- package/dist/src/backends/rvf/FederatedSessionManager.js.map +1 -0
- package/dist/src/backends/rvf/FilterBuilder.d.ts +136 -0
- package/dist/src/backends/rvf/FilterBuilder.d.ts.map +1 -0
- package/dist/src/backends/rvf/FilterBuilder.js +157 -0
- package/dist/src/backends/rvf/FilterBuilder.js.map +1 -0
- package/dist/src/backends/rvf/NativeAccelerator.d.ts +158 -0
- package/dist/src/backends/rvf/NativeAccelerator.d.ts.map +1 -0
- package/dist/src/backends/rvf/NativeAccelerator.js +702 -0
- package/dist/src/backends/rvf/NativeAccelerator.js.map +1 -0
- package/dist/src/backends/rvf/RvfBackend.d.ts +207 -0
- package/dist/src/backends/rvf/RvfBackend.d.ts.map +1 -0
- package/dist/src/backends/rvf/RvfBackend.js +651 -0
- package/dist/src/backends/rvf/RvfBackend.js.map +1 -0
- package/dist/src/backends/rvf/RvfSolver.d.ts +175 -0
- package/dist/src/backends/rvf/RvfSolver.d.ts.map +1 -0
- package/dist/src/backends/rvf/RvfSolver.js +176 -0
- package/dist/src/backends/rvf/RvfSolver.js.map +1 -0
- package/dist/src/backends/rvf/SelfLearningRvfBackend.d.ts +143 -0
- package/dist/src/backends/rvf/SelfLearningRvfBackend.d.ts.map +1 -0
- package/dist/src/backends/rvf/SelfLearningRvfBackend.js +612 -0
- package/dist/src/backends/rvf/SelfLearningRvfBackend.js.map +1 -0
- package/dist/src/backends/rvf/SemanticQueryRouter.d.ts +128 -0
- package/dist/src/backends/rvf/SemanticQueryRouter.d.ts.map +1 -0
- package/dist/src/backends/rvf/SemanticQueryRouter.js +415 -0
- package/dist/src/backends/rvf/SemanticQueryRouter.js.map +1 -0
- package/dist/src/backends/rvf/SimdFallbacks.d.ts +25 -0
- package/dist/src/backends/rvf/SimdFallbacks.d.ts.map +1 -0
- package/dist/src/backends/rvf/SimdFallbacks.js +287 -0
- package/dist/src/backends/rvf/SimdFallbacks.js.map +1 -0
- package/dist/src/backends/rvf/SolverBandit.d.ts +100 -0
- package/dist/src/backends/rvf/SolverBandit.d.ts.map +1 -0
- package/dist/src/backends/rvf/SolverBandit.js +216 -0
- package/dist/src/backends/rvf/SolverBandit.js.map +1 -0
- package/dist/src/backends/rvf/SonaLearningBackend.d.ts +157 -0
- package/dist/src/backends/rvf/SonaLearningBackend.d.ts.map +1 -0
- package/dist/src/backends/rvf/SonaLearningBackend.js +283 -0
- package/dist/src/backends/rvf/SonaLearningBackend.js.map +1 -0
- package/dist/src/backends/rvf/SqlJsRvfBackend.d.ts +104 -0
- package/dist/src/backends/rvf/SqlJsRvfBackend.d.ts.map +1 -0
- package/dist/src/backends/rvf/SqlJsRvfBackend.js +474 -0
- package/dist/src/backends/rvf/SqlJsRvfBackend.js.map +1 -0
- package/dist/src/backends/rvf/WasmStoreBridge.d.ts +27 -0
- package/dist/src/backends/rvf/WasmStoreBridge.d.ts.map +1 -0
- package/dist/src/backends/rvf/WasmStoreBridge.js +87 -0
- package/dist/src/backends/rvf/WasmStoreBridge.js.map +1 -0
- package/dist/src/backends/rvf/validation.d.ts +20 -0
- package/dist/src/backends/rvf/validation.d.ts.map +1 -0
- package/dist/src/backends/rvf/validation.js +78 -0
- package/dist/src/backends/rvf/validation.js.map +1 -0
- package/dist/src/benchmark/BenchmarkSuite.d.ts +318 -0
- package/dist/src/benchmark/BenchmarkSuite.d.ts.map +1 -0
- package/dist/src/benchmark/BenchmarkSuite.js +984 -0
- package/dist/src/benchmark/BenchmarkSuite.js.map +1 -0
- package/dist/src/benchmark/index.d.ts +29 -0
- package/dist/src/benchmark/index.d.ts.map +1 -0
- package/dist/src/benchmark/index.js +39 -0
- package/dist/src/benchmark/index.js.map +1 -0
- package/dist/src/browser/AttentionBrowser.d.ts.map +1 -1
- package/dist/src/browser/AttentionBrowser.js +1 -0
- package/dist/src/browser/AttentionBrowser.js.map +1 -1
- package/dist/src/cli/agentdb-cli.d.ts +14 -0
- package/dist/src/cli/agentdb-cli.d.ts.map +1 -1
- package/dist/src/cli/agentdb-cli.js +839 -143
- package/dist/src/cli/agentdb-cli.js.map +1 -1
- package/dist/src/cli/commands/attention.js +12 -2
- package/dist/src/cli/commands/attention.js.map +1 -1
- package/dist/src/cli/commands/doctor.js +5 -5
- package/dist/src/cli/commands/doctor.js.map +1 -1
- package/dist/src/cli/commands/hyperbolic.d.ts +11 -0
- package/dist/src/cli/commands/hyperbolic.d.ts.map +1 -0
- package/dist/src/cli/commands/hyperbolic.js +440 -0
- package/dist/src/cli/commands/hyperbolic.js.map +1 -0
- package/dist/src/cli/commands/install-embeddings.d.ts +1 -1
- package/dist/src/cli/commands/install-embeddings.d.ts.map +1 -1
- package/dist/src/cli/commands/install-embeddings.js +17 -11
- package/dist/src/cli/commands/install-embeddings.js.map +1 -1
- package/dist/src/cli/commands/learn.d.ts +11 -0
- package/dist/src/cli/commands/learn.d.ts.map +1 -0
- package/dist/src/cli/commands/learn.js +410 -0
- package/dist/src/cli/commands/learn.js.map +1 -0
- package/dist/src/cli/commands/migrate.d.ts +15 -0
- package/dist/src/cli/commands/migrate.d.ts.map +1 -1
- package/dist/src/cli/commands/migrate.js +190 -10
- package/dist/src/cli/commands/migrate.js.map +1 -1
- package/dist/src/cli/commands/route.d.ts +11 -0
- package/dist/src/cli/commands/route.d.ts.map +1 -0
- package/dist/src/cli/commands/route.js +419 -0
- package/dist/src/cli/commands/route.js.map +1 -0
- package/dist/src/cli/commands/rvf.d.ts +21 -0
- package/dist/src/cli/commands/rvf.d.ts.map +1 -0
- package/dist/src/cli/commands/rvf.js +448 -0
- package/dist/src/cli/commands/rvf.js.map +1 -0
- package/dist/src/cli/commands/simulate-report.js +14 -2
- package/dist/src/cli/commands/simulate-report.js.map +1 -1
- package/dist/src/cli/lib/report-store.d.ts +2 -1
- package/dist/src/cli/lib/report-store.d.ts.map +1 -1
- package/dist/src/cli/lib/report-store.js +85 -65
- package/dist/src/cli/lib/report-store.js.map +1 -1
- package/dist/src/cli/lib/simulation-runner.d.ts +40 -3
- package/dist/src/cli/lib/simulation-runner.d.ts.map +1 -1
- package/dist/src/cli/lib/simulation-runner.js +248 -6
- package/dist/src/cli/lib/simulation-runner.js.map +1 -1
- package/dist/src/compatibility/DeprecationWarnings.d.ts +54 -0
- package/dist/src/compatibility/DeprecationWarnings.d.ts.map +1 -0
- package/dist/src/compatibility/DeprecationWarnings.js +131 -0
- package/dist/src/compatibility/DeprecationWarnings.js.map +1 -0
- package/dist/src/compatibility/MigrationUtilities.d.ts +30 -0
- package/dist/src/compatibility/MigrationUtilities.d.ts.map +1 -0
- package/dist/src/compatibility/MigrationUtilities.js +184 -0
- package/dist/src/compatibility/MigrationUtilities.js.map +1 -0
- package/dist/src/compatibility/V1toV2Adapter.d.ts +76 -0
- package/dist/src/compatibility/V1toV2Adapter.d.ts.map +1 -0
- package/dist/src/compatibility/V1toV2Adapter.js +185 -0
- package/dist/src/compatibility/V1toV2Adapter.js.map +1 -0
- package/dist/src/compatibility/VersionDetector.d.ts +32 -0
- package/dist/src/compatibility/VersionDetector.d.ts.map +1 -0
- package/dist/src/compatibility/VersionDetector.js +144 -0
- package/dist/src/compatibility/VersionDetector.js.map +1 -0
- package/dist/src/compatibility/index.d.ts +14 -0
- package/dist/src/compatibility/index.d.ts.map +1 -0
- package/dist/src/compatibility/index.js +21 -0
- package/dist/src/compatibility/index.js.map +1 -0
- package/dist/src/compatibility/types.d.ts +103 -0
- package/dist/src/compatibility/types.d.ts.map +1 -0
- package/dist/src/compatibility/types.js +5 -0
- package/dist/src/compatibility/types.js.map +1 -0
- package/dist/src/controllers/AttentionService.d.ts +99 -202
- package/dist/src/controllers/AttentionService.d.ts.map +1 -1
- package/dist/src/controllers/AttentionService.js +450 -558
- package/dist/src/controllers/AttentionService.js.map +1 -1
- package/dist/src/controllers/CausalMemoryGraph.d.ts +30 -5
- package/dist/src/controllers/CausalMemoryGraph.d.ts.map +1 -1
- package/dist/src/controllers/CausalMemoryGraph.js +92 -15
- package/dist/src/controllers/CausalMemoryGraph.js.map +1 -1
- package/dist/src/controllers/CausalRecall.d.ts +4 -0
- package/dist/src/controllers/CausalRecall.d.ts.map +1 -1
- package/dist/src/controllers/CausalRecall.js +23 -5
- package/dist/src/controllers/CausalRecall.js.map +1 -1
- package/dist/src/controllers/EmbeddingService.d.ts +39 -0
- package/dist/src/controllers/EmbeddingService.d.ts.map +1 -1
- package/dist/src/controllers/EmbeddingService.js +166 -32
- package/dist/src/controllers/EmbeddingService.js.map +1 -1
- package/dist/src/controllers/EnhancedEmbeddingService.d.ts +4 -0
- package/dist/src/controllers/EnhancedEmbeddingService.d.ts.map +1 -1
- package/dist/src/controllers/EnhancedEmbeddingService.js +21 -7
- package/dist/src/controllers/EnhancedEmbeddingService.js.map +1 -1
- package/dist/src/controllers/ExplainableRecall.d.ts +1 -1
- package/dist/src/controllers/ExplainableRecall.d.ts.map +1 -1
- package/dist/src/controllers/ExplainableRecall.js +1 -1
- package/dist/src/controllers/ExplainableRecall.js.map +1 -1
- package/dist/src/controllers/HNSWIndex.d.ts +20 -2
- package/dist/src/controllers/HNSWIndex.d.ts.map +1 -1
- package/dist/src/controllers/HNSWIndex.js +114 -39
- package/dist/src/controllers/HNSWIndex.js.map +1 -1
- package/dist/src/controllers/LearningSystem.d.ts +6 -17
- package/dist/src/controllers/LearningSystem.d.ts.map +1 -1
- package/dist/src/controllers/LearningSystem.js +66 -155
- package/dist/src/controllers/LearningSystem.js.map +1 -1
- package/dist/src/controllers/MemoryController.d.ts +174 -0
- package/dist/src/controllers/MemoryController.d.ts.map +1 -0
- package/dist/src/controllers/MemoryController.js +320 -0
- package/dist/src/controllers/MemoryController.js.map +1 -0
- package/dist/src/controllers/MetadataFilter.d.ts.map +1 -1
- package/dist/src/controllers/MetadataFilter.js +38 -26
- package/dist/src/controllers/MetadataFilter.js.map +1 -1
- package/dist/src/controllers/MincutService.d.ts +92 -0
- package/dist/src/controllers/MincutService.d.ts.map +1 -0
- package/dist/src/controllers/MincutService.js +336 -0
- package/dist/src/controllers/MincutService.js.map +1 -0
- package/dist/src/controllers/NightlyLearner.d.ts +5 -1
- package/dist/src/controllers/NightlyLearner.d.ts.map +1 -1
- package/dist/src/controllers/NightlyLearner.js +45 -31
- package/dist/src/controllers/NightlyLearner.js.map +1 -1
- package/dist/src/controllers/QUICClient.d.ts +45 -0
- package/dist/src/controllers/QUICClient.d.ts.map +1 -1
- package/dist/src/controllers/QUICClient.js +211 -21
- package/dist/src/controllers/QUICClient.js.map +1 -1
- package/dist/src/controllers/QUICServer.d.ts.map +1 -1
- package/dist/src/controllers/QUICServer.js +36 -27
- package/dist/src/controllers/QUICServer.js.map +1 -1
- package/dist/src/controllers/ReasoningBank.d.ts +44 -5
- package/dist/src/controllers/ReasoningBank.d.ts.map +1 -1
- package/dist/src/controllers/ReasoningBank.js +187 -99
- package/dist/src/controllers/ReasoningBank.js.map +1 -1
- package/dist/src/controllers/ReflexionMemory.d.ts +129 -6
- package/dist/src/controllers/ReflexionMemory.d.ts.map +1 -1
- package/dist/src/controllers/ReflexionMemory.js +687 -220
- package/dist/src/controllers/ReflexionMemory.js.map +1 -1
- package/dist/src/controllers/SkillLibrary.d.ts +41 -3
- package/dist/src/controllers/SkillLibrary.d.ts.map +1 -1
- package/dist/src/controllers/SkillLibrary.js +291 -116
- package/dist/src/controllers/SkillLibrary.js.map +1 -1
- package/dist/src/controllers/SparsificationService.d.ts +151 -0
- package/dist/src/controllers/SparsificationService.d.ts.map +1 -0
- package/dist/src/controllers/SparsificationService.js +375 -0
- package/dist/src/controllers/SparsificationService.js.map +1 -0
- package/dist/src/controllers/SyncCoordinator.d.ts.map +1 -1
- package/dist/src/controllers/SyncCoordinator.js +126 -12
- package/dist/src/controllers/SyncCoordinator.js.map +1 -1
- package/dist/src/controllers/WASMVectorSearch.d.ts +12 -30
- package/dist/src/controllers/WASMVectorSearch.d.ts.map +1 -1
- package/dist/src/controllers/WASMVectorSearch.js +209 -119
- package/dist/src/controllers/WASMVectorSearch.js.map +1 -1
- package/dist/src/controllers/attention/AttentionCache.d.ts +38 -0
- package/dist/src/controllers/attention/AttentionCache.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionCache.js +80 -0
- package/dist/src/controllers/attention/AttentionCache.js.map +1 -0
- package/dist/src/controllers/attention/AttentionConfig.d.ts +127 -0
- package/dist/src/controllers/attention/AttentionConfig.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionConfig.js +124 -0
- package/dist/src/controllers/attention/AttentionConfig.js.map +1 -0
- package/dist/src/controllers/attention/AttentionCore.d.ts +89 -0
- package/dist/src/controllers/attention/AttentionCore.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionCore.js +289 -0
- package/dist/src/controllers/attention/AttentionCore.js.map +1 -0
- package/dist/src/controllers/attention/AttentionHelpers.d.ts +55 -0
- package/dist/src/controllers/attention/AttentionHelpers.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionHelpers.js +148 -0
- package/dist/src/controllers/attention/AttentionHelpers.js.map +1 -0
- package/dist/src/controllers/attention/AttentionMetrics.d.ts +55 -0
- package/dist/src/controllers/attention/AttentionMetrics.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionMetrics.js +72 -0
- package/dist/src/controllers/attention/AttentionMetrics.js.map +1 -0
- package/dist/src/controllers/attention/AttentionWASM.d.ts +98 -0
- package/dist/src/controllers/attention/AttentionWASM.d.ts.map +1 -0
- package/dist/src/controllers/attention/AttentionWASM.js +147 -0
- package/dist/src/controllers/attention/AttentionWASM.js.map +1 -0
- package/dist/src/controllers/attention/CrossAttentionController.d.ts +141 -0
- package/dist/src/controllers/attention/CrossAttentionController.d.ts.map +1 -0
- package/dist/src/controllers/attention/CrossAttentionController.js +325 -0
- package/dist/src/controllers/attention/CrossAttentionController.js.map +1 -0
- package/dist/src/controllers/attention/MultiHeadAttentionController.d.ts +137 -0
- package/dist/src/controllers/attention/MultiHeadAttentionController.d.ts.map +1 -0
- package/dist/src/controllers/attention/MultiHeadAttentionController.js +336 -0
- package/dist/src/controllers/attention/MultiHeadAttentionController.js.map +1 -0
- package/dist/src/controllers/attention/SelfAttentionController.d.ts +117 -0
- package/dist/src/controllers/attention/SelfAttentionController.d.ts.map +1 -0
- package/dist/src/controllers/attention/SelfAttentionController.js +205 -0
- package/dist/src/controllers/attention/SelfAttentionController.js.map +1 -0
- package/dist/src/controllers/attention/index.d.ts +24 -0
- package/dist/src/controllers/attention/index.d.ts.map +1 -0
- package/dist/src/controllers/attention/index.js +20 -0
- package/dist/src/controllers/attention/index.js.map +1 -0
- package/dist/src/controllers/index.d.ts +15 -28
- package/dist/src/controllers/index.d.ts.map +1 -1
- package/dist/src/controllers/index.js +11 -19
- package/dist/src/controllers/index.js.map +1 -1
- package/dist/src/controllers/prerequisites.d.ts +76 -0
- package/dist/src/controllers/prerequisites.d.ts.map +1 -0
- package/dist/src/controllers/prerequisites.js +235 -0
- package/dist/src/controllers/prerequisites.js.map +1 -0
- package/dist/src/core/AgentDB.d.ts +33 -19
- package/dist/src/core/AgentDB.d.ts.map +1 -1
- package/dist/src/core/AgentDB.js +87 -127
- package/dist/src/core/AgentDB.js.map +1 -1
- package/dist/src/core/QueryCache.d.ts +138 -0
- package/dist/src/core/QueryCache.d.ts.map +1 -0
- package/dist/src/core/QueryCache.js +309 -0
- package/dist/src/core/QueryCache.js.map +1 -0
- package/dist/src/db-fallback.d.ts +52 -4
- package/dist/src/db-fallback.d.ts.map +1 -1
- package/dist/src/db-fallback.js +521 -71
- package/dist/src/db-fallback.js.map +1 -1
- package/dist/src/db-unified.d.ts.map +1 -1
- package/dist/src/db-unified.js +32 -30
- package/dist/src/db-unified.js.map +1 -1
- package/dist/src/embedding/EmbeddingSpaceIdentity.d.ts +58 -0
- package/dist/src/embedding/EmbeddingSpaceIdentity.d.ts.map +1 -0
- package/dist/src/embedding/EmbeddingSpaceIdentity.js +137 -0
- package/dist/src/embedding/EmbeddingSpaceIdentity.js.map +1 -0
- package/dist/src/embedding/index.d.ts +3 -0
- package/dist/src/embedding/index.d.ts.map +1 -0
- package/dist/src/embedding/index.js +2 -0
- package/dist/src/embedding/index.js.map +1 -0
- package/dist/src/examples/quic-sync-example.js +2 -2
- package/dist/src/examples/quic-sync-example.js.map +1 -1
- package/dist/src/governance/MetaHarnessGateway.d.ts +55 -0
- package/dist/src/governance/MetaHarnessGateway.d.ts.map +1 -0
- package/dist/src/governance/MetaHarnessGateway.js +65 -0
- package/dist/src/governance/MetaHarnessGateway.js.map +1 -0
- package/dist/src/governance/RvfExperimentBranch.d.ts +65 -0
- package/dist/src/governance/RvfExperimentBranch.d.ts.map +1 -0
- package/dist/src/governance/RvfExperimentBranch.js +115 -0
- package/dist/src/governance/RvfExperimentBranch.js.map +1 -0
- package/dist/src/index.d.ts +20 -16
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +44 -12
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/agentdb-mcp-server.js +318 -16
- package/dist/src/mcp/agentdb-mcp-server.js.map +1 -1
- package/dist/src/mcp/reset-database.d.ts +15 -0
- package/dist/src/mcp/reset-database.d.ts.map +1 -0
- package/dist/src/mcp/reset-database.js +45 -0
- package/dist/src/mcp/reset-database.js.map +1 -0
- package/dist/src/model/ModelCacheLoader.d.ts +31 -0
- package/dist/src/model/ModelCacheLoader.d.ts.map +1 -0
- package/dist/src/model/ModelCacheLoader.js +209 -0
- package/dist/src/model/ModelCacheLoader.js.map +1 -0
- package/dist/src/observability/index.d.ts +8 -0
- package/dist/src/observability/index.d.ts.map +1 -0
- package/dist/src/observability/index.js +8 -0
- package/dist/src/observability/index.js.map +1 -0
- package/dist/src/observability/integration.d.ts +32 -0
- package/dist/src/observability/integration.d.ts.map +1 -0
- package/dist/src/observability/integration.js +159 -0
- package/dist/src/observability/integration.js.map +1 -0
- package/dist/src/observability/telemetry.d.ts +137 -0
- package/dist/src/observability/telemetry.d.ts.map +1 -0
- package/dist/src/observability/telemetry.js +424 -0
- package/dist/src/observability/telemetry.js.map +1 -0
- package/dist/src/optimizations/BatchOperations.d.ts +47 -0
- package/dist/src/optimizations/BatchOperations.d.ts.map +1 -1
- package/dist/src/optimizations/BatchOperations.js +189 -35
- package/dist/src/optimizations/BatchOperations.js.map +1 -1
- package/dist/src/optimizations/Quantization.d.ts +330 -0
- package/dist/src/optimizations/Quantization.d.ts.map +1 -0
- package/dist/src/optimizations/Quantization.js +793 -0
- package/dist/src/optimizations/Quantization.js.map +1 -0
- package/dist/src/optimizations/index.d.ts +1 -3
- package/dist/src/optimizations/index.d.ts.map +1 -1
- package/dist/src/optimizations/index.js +0 -1
- package/dist/src/optimizations/index.js.map +1 -1
- package/dist/src/quantization/index.d.ts +7 -0
- package/dist/src/quantization/index.d.ts.map +1 -0
- package/dist/src/quantization/index.js +15 -0
- package/dist/src/quantization/index.js.map +1 -0
- package/dist/src/quantization/vector-quantization.d.ts +388 -0
- package/dist/src/quantization/vector-quantization.d.ts.map +1 -0
- package/dist/src/quantization/vector-quantization.js +1132 -0
- package/dist/src/quantization/vector-quantization.js.map +1 -0
- package/dist/src/schemas/inline.d.ts +3 -0
- package/dist/src/schemas/inline.d.ts.map +1 -0
- package/dist/src/schemas/inline.js +10 -0
- package/dist/src/schemas/inline.js.map +1 -0
- package/dist/src/search/HybridSearch.d.ts +311 -0
- package/dist/src/search/HybridSearch.d.ts.map +1 -0
- package/dist/src/search/HybridSearch.js +713 -0
- package/dist/src/search/HybridSearch.js.map +1 -0
- package/dist/src/search/index.d.ts +12 -0
- package/dist/src/search/index.d.ts.map +1 -0
- package/dist/src/search/index.js +16 -0
- package/dist/src/search/index.js.map +1 -0
- package/dist/src/security/input-validation.d.ts +30 -0
- package/dist/src/security/input-validation.d.ts.map +1 -1
- package/dist/src/security/input-validation.js +77 -3
- package/dist/src/security/input-validation.js.map +1 -1
- package/dist/src/security/limits.d.ts.map +1 -1
- package/dist/src/security/limits.js +12 -3
- package/dist/src/security/limits.js.map +1 -1
- package/dist/src/security/mcp-policy.d.ts +17 -0
- package/dist/src/security/mcp-policy.d.ts.map +1 -0
- package/dist/src/security/mcp-policy.js +94 -0
- package/dist/src/security/mcp-policy.js.map +1 -0
- package/dist/src/security/path-security.d.ts.map +1 -1
- package/dist/src/security/path-security.js +3 -1
- package/dist/src/security/path-security.js.map +1 -1
- package/dist/src/security/validation.js +3 -3
- package/dist/src/security/validation.js.map +1 -1
- package/dist/src/services/AttentionService.d.ts +303 -0
- package/dist/src/services/AttentionService.d.ts.map +1 -0
- package/dist/src/services/AttentionService.js +1165 -0
- package/dist/src/services/AttentionService.js.map +1 -0
- package/dist/src/services/LLMRouter.d.ts +70 -8
- package/dist/src/services/LLMRouter.d.ts.map +1 -1
- package/dist/src/services/LLMRouter.js +279 -28
- package/dist/src/services/LLMRouter.js.map +1 -1
- package/dist/src/services/audit-logger.service.d.ts +168 -0
- package/dist/src/services/audit-logger.service.d.ts.map +1 -0
- package/dist/src/services/audit-logger.service.js +331 -0
- package/dist/src/services/audit-logger.service.js.map +1 -0
- package/dist/src/services/enhanced-embeddings.d.ts +271 -0
- package/dist/src/services/enhanced-embeddings.d.ts.map +1 -0
- package/dist/src/services/enhanced-embeddings.js +1036 -0
- package/dist/src/services/enhanced-embeddings.js.map +1 -0
- package/dist/src/services/federated-learning.d.ts +172 -0
- package/dist/src/services/federated-learning.d.ts.map +1 -0
- package/dist/src/services/federated-learning.js +344 -0
- package/dist/src/services/federated-learning.js.map +1 -0
- package/dist/src/simd/index.d.ts +9 -0
- package/dist/src/simd/index.d.ts.map +1 -0
- package/dist/src/simd/index.js +27 -0
- package/dist/src/simd/index.js.map +1 -0
- package/dist/src/simd/simd-vector-ops.d.ts +343 -0
- package/dist/src/simd/simd-vector-ops.d.ts.map +1 -0
- package/dist/src/simd/simd-vector-ops.js +1012 -0
- package/dist/src/simd/simd-vector-ops.js.map +1 -0
- package/dist/src/types/database.types.d.ts +275 -0
- package/dist/src/types/database.types.d.ts.map +1 -0
- package/dist/src/types/database.types.js +55 -0
- package/dist/src/types/database.types.js.map +1 -0
- package/dist/src/types/graph.d.ts +29 -0
- package/dist/src/types/graph.d.ts.map +1 -0
- package/dist/src/types/graph.js +8 -0
- package/dist/src/types/graph.js.map +1 -0
- package/dist/src/utils/chalk-fallback.d.ts +3 -0
- package/dist/src/utils/chalk-fallback.d.ts.map +1 -0
- package/dist/src/utils/chalk-fallback.js +20 -0
- package/dist/src/utils/chalk-fallback.js.map +1 -0
- package/dist/src/utils/similarity.d.ts +11 -0
- package/dist/src/utils/similarity.d.ts.map +1 -0
- package/dist/src/utils/similarity.js +25 -0
- package/dist/src/utils/similarity.js.map +1 -0
- package/dist/src/utils/top-k.d.ts +44 -0
- package/dist/src/utils/top-k.d.ts.map +1 -0
- package/dist/src/utils/top-k.js +111 -0
- package/dist/src/utils/top-k.js.map +1 -0
- package/dist/src/wasm-loader.d.ts +66 -0
- package/dist/src/wasm-loader.d.ts.map +1 -0
- package/dist/src/wasm-loader.js +76 -0
- package/dist/src/wasm-loader.js.map +1 -0
- package/dist/src/wrappers/agentdb-fast.d.ts +140 -0
- package/dist/src/wrappers/agentdb-fast.d.ts.map +1 -0
- package/dist/src/wrappers/agentdb-fast.js +309 -0
- package/dist/src/wrappers/agentdb-fast.js.map +1 -0
- package/dist/src/wrappers/attention-fallbacks.d.ts +343 -0
- package/dist/src/wrappers/attention-fallbacks.d.ts.map +1 -0
- package/dist/src/wrappers/attention-fallbacks.js +1484 -0
- package/dist/src/wrappers/attention-fallbacks.js.map +1 -0
- package/dist/src/wrappers/attention-native.d.ts +111 -0
- package/dist/src/wrappers/attention-native.d.ts.map +1 -0
- package/dist/src/wrappers/attention-native.js +273 -0
- package/dist/src/wrappers/attention-native.js.map +1 -0
- package/dist/src/wrappers/embedding-service.d.ts +117 -0
- package/dist/src/wrappers/embedding-service.d.ts.map +1 -0
- package/dist/src/wrappers/embedding-service.js +370 -0
- package/dist/src/wrappers/embedding-service.js.map +1 -0
- package/dist/src/wrappers/gnn-wrapper.d.ts +71 -0
- package/dist/src/wrappers/gnn-wrapper.d.ts.map +1 -0
- package/dist/src/wrappers/gnn-wrapper.js +236 -0
- package/dist/src/wrappers/gnn-wrapper.js.map +1 -0
- package/dist/src/wrappers/index.d.ts +48 -0
- package/dist/src/wrappers/index.d.ts.map +1 -0
- package/dist/src/wrappers/index.js +83 -0
- package/dist/src/wrappers/index.js.map +1 -0
- package/package.json +130 -80
- package/scripts/postinstall.cjs +13 -144
- package/dist/agentdb.browser.js +0 -1685
- package/dist/agentdb.browser.js.map +0 -7
- package/dist/agentdb.browser.min.js +0 -3
- package/dist/agentdb.browser.min.js.map +0 -7
- package/dist/agentdb.wasm-loader.js +0 -207
- package/dist/backends/VectorBackend.d.ts +0 -120
- package/dist/backends/VectorBackend.js +0 -14
- package/dist/backends/VectorBackend.js.map +0 -1
- package/dist/optimizations/RVFOptimizer.d.ts +0 -225
- package/dist/optimizations/RVFOptimizer.js +0 -541
- package/dist/optimizations/RVFOptimizer.js.map +0 -1
- package/dist/simulation/cli.d.ts +0 -9
- package/dist/simulation/cli.d.ts.map +0 -1
- package/dist/simulation/cli.js +0 -68
- package/dist/simulation/cli.js.map +0 -1
- package/dist/simulation/runner.d.ts +0 -21
- package/dist/simulation/runner.d.ts.map +0 -1
- package/dist/simulation/runner.js +0 -241
- package/dist/simulation/runner.js.map +0 -1
- package/dist/simulation/scenarios/aidefence-integration.d.ts +0 -24
- package/dist/simulation/scenarios/aidefence-integration.d.ts.map +0 -1
- package/dist/simulation/scenarios/aidefence-integration.js +0 -124
- package/dist/simulation/scenarios/aidefence-integration.js.map +0 -1
- package/dist/simulation/scenarios/bmssp-integration.d.ts +0 -23
- package/dist/simulation/scenarios/bmssp-integration.d.ts.map +0 -1
- package/dist/simulation/scenarios/bmssp-integration.js +0 -104
- package/dist/simulation/scenarios/bmssp-integration.js.map +0 -1
- package/dist/simulation/scenarios/causal-reasoning.d.ts +0 -16
- package/dist/simulation/scenarios/causal-reasoning.d.ts.map +0 -1
- package/dist/simulation/scenarios/causal-reasoning.js +0 -108
- package/dist/simulation/scenarios/causal-reasoning.js.map +0 -1
- package/dist/simulation/scenarios/consciousness-explorer.d.ts +0 -25
- package/dist/simulation/scenarios/consciousness-explorer.d.ts.map +0 -1
- package/dist/simulation/scenarios/consciousness-explorer.js +0 -108
- package/dist/simulation/scenarios/consciousness-explorer.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.d.ts +0 -135
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.js +0 -158
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/index.d.ts +0 -14
- package/dist/simulation/scenarios/domain-examples/index.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/index.js +0 -14
- package/dist/simulation/scenarios/domain-examples/index.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.d.ts +0 -178
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.js +0 -218
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/medical-imaging.d.ts +0 -122
- package/dist/simulation/scenarios/domain-examples/medical-imaging.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/medical-imaging.js +0 -129
- package/dist/simulation/scenarios/domain-examples/medical-imaging.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.d.ts +0 -166
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.js +0 -161
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/scientific-research.d.ts +0 -151
- package/dist/simulation/scenarios/domain-examples/scientific-research.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/scientific-research.js +0 -187
- package/dist/simulation/scenarios/domain-examples/scientific-research.js.map +0 -1
- package/dist/simulation/scenarios/domain-examples/trading-systems.d.ts +0 -102
- package/dist/simulation/scenarios/domain-examples/trading-systems.d.ts.map +0 -1
- package/dist/simulation/scenarios/domain-examples/trading-systems.js +0 -100
- package/dist/simulation/scenarios/domain-examples/trading-systems.js.map +0 -1
- package/dist/simulation/scenarios/goalie-integration.d.ts +0 -24
- package/dist/simulation/scenarios/goalie-integration.d.ts.map +0 -1
- package/dist/simulation/scenarios/goalie-integration.js +0 -121
- package/dist/simulation/scenarios/goalie-integration.js.map +0 -1
- package/dist/simulation/scenarios/graph-traversal.d.ts +0 -17
- package/dist/simulation/scenarios/graph-traversal.d.ts.map +0 -1
- package/dist/simulation/scenarios/graph-traversal.js +0 -101
- package/dist/simulation/scenarios/graph-traversal.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/attention-analysis.d.ts +0 -45
- package/dist/simulation/scenarios/latent-space/attention-analysis.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/attention-analysis.js +0 -435
- package/dist/simulation/scenarios/latent-space/attention-analysis.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/clustering-analysis.d.ts +0 -55
- package/dist/simulation/scenarios/latent-space/clustering-analysis.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/clustering-analysis.js +0 -606
- package/dist/simulation/scenarios/latent-space/clustering-analysis.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.d.ts +0 -74
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.js +0 -391
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.d.ts +0 -51
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.js +0 -536
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/index.d.ts +0 -35
- package/dist/simulation/scenarios/latent-space/index.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/index.js +0 -35
- package/dist/simulation/scenarios/latent-space/index.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/neural-augmentation.d.ts +0 -52
- package/dist/simulation/scenarios/latent-space/neural-augmentation.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/neural-augmentation.js +0 -472
- package/dist/simulation/scenarios/latent-space/neural-augmentation.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.d.ts +0 -53
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.js +0 -391
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.d.ts +0 -52
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.js +0 -514
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.js.map +0 -1
- package/dist/simulation/scenarios/latent-space/traversal-optimization.d.ts +0 -53
- package/dist/simulation/scenarios/latent-space/traversal-optimization.d.ts.map +0 -1
- package/dist/simulation/scenarios/latent-space/traversal-optimization.js +0 -595
- package/dist/simulation/scenarios/latent-space/traversal-optimization.js.map +0 -1
- package/dist/simulation/scenarios/lean-agentic-swarm.d.ts +0 -18
- package/dist/simulation/scenarios/lean-agentic-swarm.d.ts.map +0 -1
- package/dist/simulation/scenarios/lean-agentic-swarm.js +0 -132
- package/dist/simulation/scenarios/lean-agentic-swarm.js.map +0 -1
- package/dist/simulation/scenarios/multi-agent-swarm.d.ts +0 -17
- package/dist/simulation/scenarios/multi-agent-swarm.d.ts.map +0 -1
- package/dist/simulation/scenarios/multi-agent-swarm.js +0 -111
- package/dist/simulation/scenarios/multi-agent-swarm.js.map +0 -1
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.d.ts +0 -23
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.d.ts.map +0 -1
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.js +0 -98
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.js.map +0 -1
- package/dist/simulation/scenarios/reflexion-learning.d.ts +0 -16
- package/dist/simulation/scenarios/reflexion-learning.d.ts.map +0 -1
- package/dist/simulation/scenarios/reflexion-learning.js +0 -98
- package/dist/simulation/scenarios/reflexion-learning.js.map +0 -1
- package/dist/simulation/scenarios/research-swarm.d.ts +0 -24
- package/dist/simulation/scenarios/research-swarm.d.ts.map +0 -1
- package/dist/simulation/scenarios/research-swarm.js +0 -146
- package/dist/simulation/scenarios/research-swarm.js.map +0 -1
- package/dist/simulation/scenarios/skill-evolution.d.ts +0 -16
- package/dist/simulation/scenarios/skill-evolution.d.ts.map +0 -1
- package/dist/simulation/scenarios/skill-evolution.js +0 -109
- package/dist/simulation/scenarios/skill-evolution.js.map +0 -1
- package/dist/simulation/scenarios/stock-market-emergence.d.ts +0 -33
- package/dist/simulation/scenarios/stock-market-emergence.d.ts.map +0 -1
- package/dist/simulation/scenarios/stock-market-emergence.js +0 -246
- package/dist/simulation/scenarios/stock-market-emergence.js.map +0 -1
- package/dist/simulation/scenarios/strange-loops.d.ts +0 -18
- package/dist/simulation/scenarios/strange-loops.d.ts.map +0 -1
- package/dist/simulation/scenarios/strange-loops.js +0 -133
- package/dist/simulation/scenarios/strange-loops.js.map +0 -1
- package/dist/simulation/scenarios/sublinear-solver.d.ts +0 -22
- package/dist/simulation/scenarios/sublinear-solver.d.ts.map +0 -1
- package/dist/simulation/scenarios/sublinear-solver.js +0 -82
- package/dist/simulation/scenarios/sublinear-solver.js.map +0 -1
- package/dist/simulation/scenarios/temporal-lead-solver.d.ts +0 -23
- package/dist/simulation/scenarios/temporal-lead-solver.d.ts.map +0 -1
- package/dist/simulation/scenarios/temporal-lead-solver.js +0 -90
- package/dist/simulation/scenarios/temporal-lead-solver.js.map +0 -1
- package/dist/simulation/scenarios/voting-system-consensus.d.ts +0 -27
- package/dist/simulation/scenarios/voting-system-consensus.d.ts.map +0 -1
- package/dist/simulation/scenarios/voting-system-consensus.js +0 -175
- package/dist/simulation/scenarios/voting-system-consensus.js.map +0 -1
- package/dist/simulation/types.d.ts +0 -162
- package/dist/simulation/types.d.ts.map +0 -1
- package/dist/simulation/types.js +0 -5
- package/dist/simulation/types.js.map +0 -1
- package/dist/simulation/utils/PerformanceOptimizer.d.ts +0 -115
- package/dist/simulation/utils/PerformanceOptimizer.d.ts.map +0 -1
- package/dist/simulation/utils/PerformanceOptimizer.js +0 -223
- package/dist/simulation/utils/PerformanceOptimizer.js.map +0 -1
- package/dist/src/backends/index.cjs +0 -6
- package/dist/src/backends/ruvector/GuardedVectorBackend.d.ts +0 -93
- package/dist/src/backends/ruvector/GuardedVectorBackend.d.ts.map +0 -1
- package/dist/src/backends/ruvector/GuardedVectorBackend.js +0 -182
- package/dist/src/backends/ruvector/GuardedVectorBackend.js.map +0 -1
- package/dist/src/consensus/RaftConsensus.d.ts +0 -220
- package/dist/src/consensus/RaftConsensus.d.ts.map +0 -1
- package/dist/src/consensus/RaftConsensus.js +0 -762
- package/dist/src/consensus/RaftConsensus.js.map +0 -1
- package/dist/src/controllers/HierarchicalMemory.d.ts +0 -197
- package/dist/src/controllers/HierarchicalMemory.d.ts.map +0 -1
- package/dist/src/controllers/HierarchicalMemory.js +0 -519
- package/dist/src/controllers/HierarchicalMemory.js.map +0 -1
- package/dist/src/controllers/MemoryConsolidation.d.ts +0 -142
- package/dist/src/controllers/MemoryConsolidation.d.ts.map +0 -1
- package/dist/src/controllers/MemoryConsolidation.js +0 -479
- package/dist/src/controllers/MemoryConsolidation.js.map +0 -1
- package/dist/src/controllers/QUICConnection.d.ts +0 -122
- package/dist/src/controllers/QUICConnection.d.ts.map +0 -1
- package/dist/src/controllers/QUICConnection.js +0 -329
- package/dist/src/controllers/QUICConnection.js.map +0 -1
- package/dist/src/controllers/QUICConnectionPool.d.ts +0 -83
- package/dist/src/controllers/QUICConnectionPool.d.ts.map +0 -1
- package/dist/src/controllers/QUICConnectionPool.js +0 -256
- package/dist/src/controllers/QUICConnectionPool.js.map +0 -1
- package/dist/src/controllers/QUICStreamManager.d.ts +0 -114
- package/dist/src/controllers/QUICStreamManager.d.ts.map +0 -1
- package/dist/src/controllers/QUICStreamManager.js +0 -267
- package/dist/src/controllers/QUICStreamManager.js.map +0 -1
- package/dist/src/controllers/StreamingEmbeddingService.d.ts +0 -82
- package/dist/src/controllers/StreamingEmbeddingService.d.ts.map +0 -1
- package/dist/src/controllers/StreamingEmbeddingService.js +0 -243
- package/dist/src/controllers/StreamingEmbeddingService.js.map +0 -1
- package/dist/src/controllers/index.cjs +0 -6
- package/dist/src/coordination/MultiDatabaseCoordinator.d.ts +0 -348
- package/dist/src/coordination/MultiDatabaseCoordinator.d.ts.map +0 -1
- package/dist/src/coordination/MultiDatabaseCoordinator.js +0 -803
- package/dist/src/coordination/MultiDatabaseCoordinator.js.map +0 -1
- package/dist/src/coordination/index.d.ts +0 -10
- package/dist/src/coordination/index.d.ts.map +0 -1
- package/dist/src/coordination/index.js +0 -10
- package/dist/src/coordination/index.js.map +0 -1
- package/dist/src/index.cjs +0 -6
- package/dist/src/optimizations/RVFOptimizer.d.ts +0 -226
- package/dist/src/optimizations/RVFOptimizer.d.ts.map +0 -1
- package/dist/src/optimizations/RVFOptimizer.js +0 -541
- package/dist/src/optimizations/RVFOptimizer.js.map +0 -1
- package/dist/src/security/AttestationLog.d.ts +0 -70
- package/dist/src/security/AttestationLog.d.ts.map +0 -1
- package/dist/src/security/AttestationLog.js +0 -174
- package/dist/src/security/AttestationLog.js.map +0 -1
- package/dist/src/security/MutationGuard.d.ts +0 -83
- package/dist/src/security/MutationGuard.d.ts.map +0 -1
- package/dist/src/security/MutationGuard.js +0 -364
- package/dist/src/security/MutationGuard.js.map +0 -1
- package/dist/src/security/index.cjs +0 -6
- package/dist/src/security/index.d.ts +0 -15
- package/dist/src/security/index.d.ts.map +0 -1
- package/dist/src/security/index.js +0 -18
- package/dist/src/security/index.js.map +0 -1
- package/dist/src/services/GNNService.d.ts +0 -172
- package/dist/src/services/GNNService.d.ts.map +0 -1
- package/dist/src/services/GNNService.js +0 -612
- package/dist/src/services/GNNService.js.map +0 -1
- package/dist/src/services/GraphTransformerService.d.ts +0 -80
- package/dist/src/services/GraphTransformerService.d.ts.map +0 -1
- package/dist/src/services/GraphTransformerService.js +0 -369
- package/dist/src/services/GraphTransformerService.js.map +0 -1
- package/dist/src/services/SemanticRouter.d.ts +0 -83
- package/dist/src/services/SemanticRouter.d.ts.map +0 -1
- package/dist/src/services/SemanticRouter.js +0 -160
- package/dist/src/services/SemanticRouter.js.map +0 -1
- package/dist/src/services/SonaTrajectoryService.d.ts +0 -224
- package/dist/src/services/SonaTrajectoryService.d.ts.map +0 -1
- package/dist/src/services/SonaTrajectoryService.js +0 -539
- package/dist/src/services/SonaTrajectoryService.js.map +0 -1
- package/dist/src/utils/LegacyAttentionAdapter.d.ts +0 -93
- package/dist/src/utils/LegacyAttentionAdapter.d.ts.map +0 -1
- package/dist/src/utils/LegacyAttentionAdapter.js +0 -241
- package/dist/src/utils/LegacyAttentionAdapter.js.map +0 -1
- package/dist/src/utils/vector-math.d.ts +0 -29
- package/dist/src/utils/vector-math.d.ts.map +0 -1
- package/dist/src/utils/vector-math.js +0 -66
- package/dist/src/utils/vector-math.js.map +0 -1
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
8
8
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
9
9
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
10
|
-
import { createDatabase } from '../db-fallback.js';
|
|
10
|
+
import { createDatabase, getDatabaseInfo } from '../db-fallback.js';
|
|
11
|
+
import { NativeAccelerator } from '../backends/rvf/NativeAccelerator.js';
|
|
12
|
+
import { detectBackends } from '../backends/factory.js';
|
|
13
|
+
import { DEFAULT_EXACT_SEARCH_THRESHOLD } from '../backends/VectorBackend.js';
|
|
14
|
+
import { DEFAULT_RERANK_WEIGHTS } from '../controllers/ReasoningBank.js';
|
|
11
15
|
import { CausalMemoryGraph } from '../controllers/CausalMemoryGraph.js';
|
|
12
16
|
import { CausalRecall } from '../controllers/CausalRecall.js';
|
|
13
17
|
import { ReflexionMemory } from '../controllers/ReflexionMemory.js';
|
|
@@ -23,9 +27,34 @@ import * as path from 'path';
|
|
|
23
27
|
import * as fs from 'fs';
|
|
24
28
|
import { fileURLToPath } from 'url';
|
|
25
29
|
import { dirname } from 'path';
|
|
30
|
+
import { buildMcpToolPolicy, filterMcpTools, isMcpToolAllowed, } from '../security/mcp-policy.js';
|
|
31
|
+
import { resetDatabaseTables } from './reset-database.js';
|
|
26
32
|
// ES module equivalent of __dirname
|
|
27
33
|
const __filename = fileURLToPath(import.meta.url);
|
|
28
34
|
const __dirname = dirname(__filename);
|
|
35
|
+
const toolPolicy = buildMcpToolPolicy();
|
|
36
|
+
// Request-size limits at the MCP boundary
|
|
37
|
+
const MAX_INSERT_BATCH_ITEMS = 1000;
|
|
38
|
+
const MAX_SEARCH_K = 100;
|
|
39
|
+
const MAX_FEEDBACK_LATENCY_MS = 24 * 60 * 60 * 1000;
|
|
40
|
+
/**
|
|
41
|
+
* Outcome feedback at the MCP boundary (ADR-015): a boolean success, a reward
|
|
42
|
+
* in [0, 1], or both. A reward alone counts as a success when >= 0.5.
|
|
43
|
+
*/
|
|
44
|
+
function validateFeedback(args) {
|
|
45
|
+
const hasReward = args?.reward !== undefined && args?.reward !== null;
|
|
46
|
+
const hasSuccess = args?.success !== undefined && args?.success !== null;
|
|
47
|
+
if (!hasReward && !hasSuccess) {
|
|
48
|
+
throw new ValidationError('success or reward is required', 'MISSING_REQUIRED_FIELD', 'success');
|
|
49
|
+
}
|
|
50
|
+
const reward = hasReward ? validateNumericRange(args.reward, 'reward', 0, 1) : undefined;
|
|
51
|
+
const success = hasSuccess ? validateBoolean(args.success, 'success') : reward >= 0.5;
|
|
52
|
+
return { success, reward };
|
|
53
|
+
}
|
|
54
|
+
// stdout belongs exclusively to JSON-RPC when running over stdio. Route every
|
|
55
|
+
// transitive diagnostic (including legacy controller console.log calls) to
|
|
56
|
+
// stderr before database and embedding initialization begins.
|
|
57
|
+
console.log = (...args) => console.error(...args);
|
|
29
58
|
// ============================================================================
|
|
30
59
|
// Helper Functions for Core Vector DB Operations
|
|
31
60
|
// ============================================================================
|
|
@@ -232,6 +261,40 @@ const learningSystem = new LearningSystem(db, embeddingService);
|
|
|
232
261
|
const batchOps = new BatchOperations(db, embeddingService);
|
|
233
262
|
const reasoningBank = new ReasoningBank(db, embeddingService);
|
|
234
263
|
const caches = new MCPToolCaches();
|
|
264
|
+
// agentdb_capabilities: native probing is done once, on first request
|
|
265
|
+
let acceleratorProbe = null;
|
|
266
|
+
async function describeCapabilities() {
|
|
267
|
+
acceleratorProbe ??= (async () => {
|
|
268
|
+
const accelerator = new NativeAccelerator();
|
|
269
|
+
await accelerator.initialize();
|
|
270
|
+
return accelerator;
|
|
271
|
+
})();
|
|
272
|
+
const [accelerator, detected] = await Promise.all([acceleratorProbe, detectBackends()]);
|
|
273
|
+
const exactThreshold = Number(process.env.AGENTDB_EXACT_SEARCH_THRESHOLD);
|
|
274
|
+
return {
|
|
275
|
+
nativeAccelerator: accelerator.capabilities(),
|
|
276
|
+
vectorBackend: {
|
|
277
|
+
// This server's controllers are built without a vector index: every
|
|
278
|
+
// search here is an exact cosine scan over the SQL embedding tables.
|
|
279
|
+
inUse: 'sql-exact-scan',
|
|
280
|
+
available: detected.available,
|
|
281
|
+
ruvector: detected.ruvector,
|
|
282
|
+
rvf: detected.rvf,
|
|
283
|
+
hnswlib: detected.hnswlib,
|
|
284
|
+
sqljsRvf: detected.sqljsRvf,
|
|
285
|
+
ruvectorBackendEnv: process.env.RUVECTOR_BACKEND ?? null,
|
|
286
|
+
},
|
|
287
|
+
sqlDriver: getDatabaseInfo(),
|
|
288
|
+
embedding: embeddingService.getRuntimeInfo(),
|
|
289
|
+
retrieval: {
|
|
290
|
+
exactSearchThreshold: Number.isFinite(exactThreshold) && exactThreshold >= 0
|
|
291
|
+
? exactThreshold
|
|
292
|
+
: DEFAULT_EXACT_SEARCH_THRESHOLD,
|
|
293
|
+
patternRerankWeights: DEFAULT_RERANK_WEIGHTS,
|
|
294
|
+
},
|
|
295
|
+
mcpProfile: toolPolicy.profile,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
235
298
|
// ============================================================================
|
|
236
299
|
// MCP Server Setup
|
|
237
300
|
// ============================================================================
|
|
@@ -256,8 +319,7 @@ const tools = [
|
|
|
256
319
|
inputSchema: {
|
|
257
320
|
type: 'object',
|
|
258
321
|
properties: {
|
|
259
|
-
|
|
260
|
-
reset: { type: 'boolean', description: 'Reset database (delete existing)', default: false },
|
|
322
|
+
reset: { type: 'boolean', description: 'Reset the open database (drop all tables, then recreate the schema)', default: false },
|
|
261
323
|
},
|
|
262
324
|
},
|
|
263
325
|
},
|
|
@@ -283,6 +345,7 @@ const tools = [
|
|
|
283
345
|
properties: {
|
|
284
346
|
items: {
|
|
285
347
|
type: 'array',
|
|
348
|
+
maxItems: 1000,
|
|
286
349
|
items: {
|
|
287
350
|
type: 'object',
|
|
288
351
|
properties: {
|
|
@@ -307,7 +370,7 @@ const tools = [
|
|
|
307
370
|
type: 'object',
|
|
308
371
|
properties: {
|
|
309
372
|
query: { type: 'string', description: 'Search query text' },
|
|
310
|
-
k: { type: 'number', description: 'Number of results to return', default: 10 },
|
|
373
|
+
k: { type: 'number', description: 'Number of results to return (max 100)', default: 10, minimum: 1, maximum: 100 },
|
|
311
374
|
min_similarity: { type: 'number', description: 'Minimum similarity threshold (0-1)', default: 0.0 },
|
|
312
375
|
filters: {
|
|
313
376
|
type: 'object',
|
|
@@ -369,7 +432,7 @@ const tools = [
|
|
|
369
432
|
type: 'object',
|
|
370
433
|
properties: {
|
|
371
434
|
task: { type: 'string', description: 'Task to find similar episodes for' },
|
|
372
|
-
k: { type: 'number', description: 'Number of episodes to retrieve', default: 5 },
|
|
435
|
+
k: { type: 'number', description: 'Number of episodes to retrieve (max 100)', default: 5, minimum: 1, maximum: 100 },
|
|
373
436
|
only_failures: { type: 'boolean', description: 'Only retrieve failures' },
|
|
374
437
|
only_successes: { type: 'boolean', description: 'Only retrieve successes' },
|
|
375
438
|
min_reward: { type: 'number', description: 'Minimum reward threshold' },
|
|
@@ -698,6 +761,41 @@ const tools = [
|
|
|
698
761
|
properties: {},
|
|
699
762
|
},
|
|
700
763
|
},
|
|
764
|
+
{
|
|
765
|
+
name: 'agentdb_pattern_feedback',
|
|
766
|
+
description: 'Record the outcome of using a reasoning pattern. Updates its success rate and average reward, which agentdb_pattern_search ranks by (0.7 similarity + 0.2 success rate + 0.1 reward). Give success, reward, or both.',
|
|
767
|
+
inputSchema: {
|
|
768
|
+
type: 'object',
|
|
769
|
+
properties: {
|
|
770
|
+
pattern_id: { type: 'integer', minimum: 0, description: 'Pattern ID from agentdb_pattern_store or agentdb_pattern_search' },
|
|
771
|
+
success: { type: 'boolean', description: 'Whether applying the pattern succeeded' },
|
|
772
|
+
reward: { type: 'number', minimum: 0, maximum: 1, description: 'Reward in [0, 1]; defaults to 1 for success, 0 for failure. A reward alone counts as success when >= 0.5' },
|
|
773
|
+
},
|
|
774
|
+
required: ['pattern_id'],
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
name: 'agentdb_skill_feedback',
|
|
779
|
+
description: 'Record the outcome of using a skill. Updates its uses, success rate, average reward and (optionally) latency, which skill_search ranks by. Give success, reward, or both.',
|
|
780
|
+
inputSchema: {
|
|
781
|
+
type: 'object',
|
|
782
|
+
properties: {
|
|
783
|
+
skill_id: { type: 'integer', minimum: 0, description: 'Skill ID from skill_create or skill_search' },
|
|
784
|
+
success: { type: 'boolean', description: 'Whether the skill succeeded' },
|
|
785
|
+
reward: { type: 'number', minimum: 0, maximum: 1, description: 'Reward in [0, 1]; defaults to 1 for success, 0 for failure. A reward alone counts as success when >= 0.5' },
|
|
786
|
+
latency_ms: { type: 'number', minimum: 0, description: 'Observed latency in milliseconds (optional)' },
|
|
787
|
+
},
|
|
788
|
+
required: ['skill_id'],
|
|
789
|
+
},
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
name: 'agentdb_capabilities',
|
|
793
|
+
description: 'Report what this AgentDB server is running on: native accelerator features that loaded, the vector backend in use and the ones available, the SQL driver, the embedding model and dimension (and whether it is the hash fallback), and the ranking defaults. Read-only.',
|
|
794
|
+
inputSchema: {
|
|
795
|
+
type: 'object',
|
|
796
|
+
properties: {},
|
|
797
|
+
},
|
|
798
|
+
},
|
|
701
799
|
{
|
|
702
800
|
name: 'agentdb_clear_cache',
|
|
703
801
|
description: 'Clear query cache to refresh statistics and search results',
|
|
@@ -829,24 +927,65 @@ const tools = [
|
|
|
829
927
|
required: ['patterns'],
|
|
830
928
|
},
|
|
831
929
|
},
|
|
930
|
+
// ==========================================================================
|
|
931
|
+
// ADR-073 — SOTA roadmap additions (causal traversal · batch delete · on-demand consolidation)
|
|
932
|
+
// ==========================================================================
|
|
933
|
+
{
|
|
934
|
+
name: 'causal_traverse',
|
|
935
|
+
description: 'Walk the causal graph between two memories. Returns the chain of causal links (with confidence and uplift) up to max_depth hops. Use this to answer "WHY does this memory matter?" / "what chain of causes led here?" — the primary explainability surface beyond a single recall. Wraps CausalMemoryGraph.getCausalChain().',
|
|
936
|
+
inputSchema: {
|
|
937
|
+
type: 'object',
|
|
938
|
+
properties: {
|
|
939
|
+
from_memory_id: { type: 'number', description: 'Starting memory id (the cause / earlier node)' },
|
|
940
|
+
to_memory_id: { type: 'number', description: 'Ending memory id (the effect / target node)' },
|
|
941
|
+
max_depth: { type: 'number', description: 'Maximum hops along the causal chain', default: 5, minimum: 1, maximum: 20 },
|
|
942
|
+
},
|
|
943
|
+
required: ['from_memory_id', 'to_memory_id'],
|
|
944
|
+
},
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
name: 'agentdb_delete_batch',
|
|
948
|
+
description: 'Delete many episode/pattern rows by ID list in a single transaction. Faster and safer than looping `agentdb_delete` (one transaction, validated IDs, atomic). Use for bulk cleanup of old sessions / failed experiments.',
|
|
949
|
+
inputSchema: {
|
|
950
|
+
type: 'object',
|
|
951
|
+
properties: {
|
|
952
|
+
ids: { type: 'array', items: { type: 'number' }, description: 'Episode IDs to delete (1–1000 per call)', minItems: 1, maxItems: 1000 },
|
|
953
|
+
table: { type: 'string', enum: ['episodes', 'reasoning_patterns'], default: 'episodes', description: 'Target table (whitelist-validated)' },
|
|
954
|
+
},
|
|
955
|
+
required: ['ids'],
|
|
956
|
+
},
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
name: 'consolidate_now',
|
|
960
|
+
description: 'Run the NightlyLearner consolidation pass on demand — discovers new causal edges, prunes low-confidence edges, and promotes high-reward episodes into skills. Use after a batch of new episodes or when you want consolidated memories available immediately (instead of waiting for a scheduled run). Returns a summary report.',
|
|
961
|
+
inputSchema: {
|
|
962
|
+
type: 'object',
|
|
963
|
+
properties: {
|
|
964
|
+
session_id: { type: 'string', description: 'Optional: limit consolidation to this session' },
|
|
965
|
+
},
|
|
966
|
+
},
|
|
967
|
+
},
|
|
832
968
|
];
|
|
833
969
|
// ============================================================================
|
|
834
970
|
// Tool Handlers
|
|
835
971
|
// ============================================================================
|
|
836
972
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
837
|
-
return { tools };
|
|
973
|
+
return { tools: filterMcpTools(tools, toolPolicy) };
|
|
838
974
|
});
|
|
839
975
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
840
976
|
const { name, arguments: args } = request.params;
|
|
841
977
|
try {
|
|
978
|
+
if (!isMcpToolAllowed(name, toolPolicy)) {
|
|
979
|
+
throw new Error(`MCP tool "${name}" is not permitted by the active AgentDB capability policy`);
|
|
980
|
+
}
|
|
842
981
|
switch (name) {
|
|
843
982
|
// ======================================================================
|
|
844
983
|
// CORE VECTOR DB OPERATIONS
|
|
845
984
|
// ======================================================================
|
|
846
985
|
case 'agentdb_init': {
|
|
847
|
-
|
|
848
|
-
if (args?.reset
|
|
849
|
-
|
|
986
|
+
// Only ever the open database: a caller-supplied path is never touched
|
|
987
|
+
if (args?.reset === true) {
|
|
988
|
+
resetDatabaseTables(db);
|
|
850
989
|
}
|
|
851
990
|
// Initialize schema
|
|
852
991
|
initializeSchema(db);
|
|
@@ -856,7 +995,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
856
995
|
{
|
|
857
996
|
type: 'text',
|
|
858
997
|
text: `✅ AgentDB initialized successfully!\n` +
|
|
859
|
-
`📍 Database: ${
|
|
998
|
+
`📍 Database: ${dbPath}\n` +
|
|
860
999
|
`📊 Tables created: ${stats.count}\n` +
|
|
861
1000
|
`⚙️ Optimizations: WAL mode, cache_size=64MB\n` +
|
|
862
1001
|
`🧠 Embedding service: ${embeddingService.constructor.name} ready`,
|
|
@@ -896,7 +1035,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
896
1035
|
};
|
|
897
1036
|
}
|
|
898
1037
|
case 'agentdb_insert_batch': {
|
|
899
|
-
const items = args?.items
|
|
1038
|
+
const items = validateArrayLength(args?.items ?? [], 'items', 0, MAX_INSERT_BATCH_ITEMS);
|
|
900
1039
|
const batchSize = args?.batch_size || 100;
|
|
901
1040
|
const episodes = items.map((item) => ({
|
|
902
1041
|
sessionId: item.session_id || 'default',
|
|
@@ -931,7 +1070,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
931
1070
|
}
|
|
932
1071
|
case 'agentdb_search': {
|
|
933
1072
|
const queryText = args?.query;
|
|
934
|
-
const k = args?.k
|
|
1073
|
+
const k = Math.floor(validateNumericRange(args?.k ?? 10, 'k', 1, MAX_SEARCH_K));
|
|
935
1074
|
const minSimilarity = args?.min_similarity || 0.0;
|
|
936
1075
|
const filters = args?.filters;
|
|
937
1076
|
const query = {
|
|
@@ -1055,7 +1194,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1055
1194
|
case 'reflexion_retrieve': {
|
|
1056
1195
|
const episodes = await reflexion.retrieveRelevant({
|
|
1057
1196
|
task: args?.task,
|
|
1058
|
-
k: args?.k
|
|
1197
|
+
k: Math.floor(validateNumericRange(args?.k ?? 5, 'k', 1, MAX_SEARCH_K)),
|
|
1059
1198
|
onlyFailures: args?.only_failures,
|
|
1060
1199
|
onlySuccesses: args?.only_successes,
|
|
1061
1200
|
minReward: args?.min_reward,
|
|
@@ -1352,6 +1491,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1352
1491
|
`Top Results:\n` +
|
|
1353
1492
|
patterns.slice(0, 5).map((p, i) => `${i + 1}. [ID: ${p.id}] ${p.taskType}\n` +
|
|
1354
1493
|
` Similarity: ${(p.similarity || 0).toFixed(3)}\n` +
|
|
1494
|
+
(p.score !== undefined ? ` Rank score: ${p.score.toFixed(3)} (similarity + outcome)\n` : '') +
|
|
1355
1495
|
` Success Rate: ${(p.successRate * 100).toFixed(1)}%\n` +
|
|
1356
1496
|
` Approach: ${p.approach.substring(0, 80)}${p.approach.length > 80 ? '...' : ''}\n` +
|
|
1357
1497
|
` Uses: ${p.uses || 0}`).join('\n\n') +
|
|
@@ -1396,6 +1536,56 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1396
1536
|
],
|
|
1397
1537
|
};
|
|
1398
1538
|
}
|
|
1539
|
+
case 'agentdb_pattern_feedback': {
|
|
1540
|
+
const patternId = validateId(args?.pattern_id, 'pattern_id');
|
|
1541
|
+
const { success, reward } = validateFeedback(args);
|
|
1542
|
+
if (!(await reasoningBank.recordOutcome(patternId, success, reward))) {
|
|
1543
|
+
throw new ValidationError(`Pattern ${patternId} not found`, 'NOT_FOUND', 'pattern_id');
|
|
1544
|
+
}
|
|
1545
|
+
caches.stats.clear();
|
|
1546
|
+
const pattern = reasoningBank.getPattern(patternId);
|
|
1547
|
+
return {
|
|
1548
|
+
content: [{
|
|
1549
|
+
type: 'text',
|
|
1550
|
+
text: JSON.stringify({
|
|
1551
|
+
patternId,
|
|
1552
|
+
recorded: { success, reward: reward ?? (success ? 1 : 0) },
|
|
1553
|
+
uses: pattern.uses,
|
|
1554
|
+
successRate: pattern.successRate,
|
|
1555
|
+
avgReward: pattern.avgReward,
|
|
1556
|
+
}, null, 2),
|
|
1557
|
+
}],
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
case 'agentdb_skill_feedback': {
|
|
1561
|
+
const skillId = validateId(args?.skill_id, 'skill_id');
|
|
1562
|
+
const { success, reward } = validateFeedback(args);
|
|
1563
|
+
const latencyMs = args?.latency_ms === undefined || args?.latency_ms === null
|
|
1564
|
+
? undefined
|
|
1565
|
+
: validateNumericRange(args.latency_ms, 'latency_ms', 0, MAX_FEEDBACK_LATENCY_MS);
|
|
1566
|
+
if (!skills.recordOutcome(skillId, success, reward, latencyMs)) {
|
|
1567
|
+
throw new ValidationError(`Skill ${skillId} not found`, 'NOT_FOUND', 'skill_id');
|
|
1568
|
+
}
|
|
1569
|
+
const row = db.prepare('SELECT uses, success_rate, avg_reward, avg_latency_ms FROM skills WHERE id = ?').get(skillId);
|
|
1570
|
+
return {
|
|
1571
|
+
content: [{
|
|
1572
|
+
type: 'text',
|
|
1573
|
+
text: JSON.stringify({
|
|
1574
|
+
skillId,
|
|
1575
|
+
recorded: { success, reward: reward ?? (success ? 1 : 0), latencyMs },
|
|
1576
|
+
uses: row.uses,
|
|
1577
|
+
successRate: row.success_rate,
|
|
1578
|
+
avgReward: row.avg_reward,
|
|
1579
|
+
avgLatencyMs: row.avg_latency_ms,
|
|
1580
|
+
}, null, 2),
|
|
1581
|
+
}],
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
case 'agentdb_capabilities': {
|
|
1585
|
+
return {
|
|
1586
|
+
content: [{ type: 'text', text: JSON.stringify(await describeCapabilities(), null, 2) }],
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
1399
1589
|
case 'agentdb_clear_cache': {
|
|
1400
1590
|
const cacheType = args?.cache_type || 'all';
|
|
1401
1591
|
let cleared = 0;
|
|
@@ -2064,6 +2254,68 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
2064
2254
|
],
|
|
2065
2255
|
};
|
|
2066
2256
|
}
|
|
2257
|
+
// ======================================================================
|
|
2258
|
+
// ADR-073 — SOTA roadmap handlers
|
|
2259
|
+
// ======================================================================
|
|
2260
|
+
case 'causal_traverse': {
|
|
2261
|
+
const fromId = args?.from_memory_id;
|
|
2262
|
+
const toId = args?.to_memory_id;
|
|
2263
|
+
const maxDepth = args?.max_depth || 5;
|
|
2264
|
+
const chain = await causalGraph.getCausalChain(fromId, toId, maxDepth);
|
|
2265
|
+
const found = chain && Array.isArray(chain.edges) ? chain.edges.length > 0 : false;
|
|
2266
|
+
return {
|
|
2267
|
+
content: [{
|
|
2268
|
+
type: 'text',
|
|
2269
|
+
text: found
|
|
2270
|
+
? `🔗 Causal chain ${fromId} → ${toId} (max ${maxDepth} hops):\n${JSON.stringify(chain, null, 2)}`
|
|
2271
|
+
: `❌ No causal chain found between memory #${fromId} and #${toId} within ${maxDepth} hops.`,
|
|
2272
|
+
}],
|
|
2273
|
+
};
|
|
2274
|
+
}
|
|
2275
|
+
case 'agentdb_delete_batch': {
|
|
2276
|
+
const ids = args?.ids || [];
|
|
2277
|
+
const requestedTable = args?.table || 'episodes';
|
|
2278
|
+
const allowedTables = new Set(['episodes', 'reasoning_patterns']);
|
|
2279
|
+
if (!allowedTables.has(requestedTable)) {
|
|
2280
|
+
throw new Error(`Invalid table: ${requestedTable}`);
|
|
2281
|
+
}
|
|
2282
|
+
if (ids.length === 0) {
|
|
2283
|
+
return { content: [{ type: 'text', text: '⚠️ No IDs supplied — nothing to delete.' }] };
|
|
2284
|
+
}
|
|
2285
|
+
// Validate each id is a positive integer (defense in depth)
|
|
2286
|
+
const safeIds = ids.map((raw) => {
|
|
2287
|
+
const n = Number(raw);
|
|
2288
|
+
if (!Number.isInteger(n) || n <= 0)
|
|
2289
|
+
throw new Error(`Invalid id: ${raw}`);
|
|
2290
|
+
return n;
|
|
2291
|
+
});
|
|
2292
|
+
const placeholders = safeIds.map(() => '?').join(',');
|
|
2293
|
+
// requestedTable is whitelist-checked above; parameterising values via ?.
|
|
2294
|
+
const stmt = db.prepare(`DELETE FROM ${requestedTable} WHERE id IN (${placeholders})`);
|
|
2295
|
+
const result = stmt.run(...safeIds);
|
|
2296
|
+
return {
|
|
2297
|
+
content: [{
|
|
2298
|
+
type: 'text',
|
|
2299
|
+
text: `🗑️ Batch delete from \`${requestedTable}\`: ${result.changes}/${safeIds.length} rows removed (atomic).`,
|
|
2300
|
+
}],
|
|
2301
|
+
};
|
|
2302
|
+
}
|
|
2303
|
+
case 'consolidate_now': {
|
|
2304
|
+
const sessionId = args?.session_id;
|
|
2305
|
+
const t0 = Date.now();
|
|
2306
|
+
// Prefer the session-scoped path when sessionId is given.
|
|
2307
|
+
const report = sessionId
|
|
2308
|
+
? await learner.consolidateEpisodes(sessionId)
|
|
2309
|
+
: await learner.run();
|
|
2310
|
+
const ms = Date.now() - t0;
|
|
2311
|
+
return {
|
|
2312
|
+
content: [{
|
|
2313
|
+
type: 'text',
|
|
2314
|
+
text: `🌙 Consolidation complete${sessionId ? ` (session=${sessionId})` : ''} in ${ms}ms\n` +
|
|
2315
|
+
JSON.stringify(report, null, 2),
|
|
2316
|
+
}],
|
|
2317
|
+
};
|
|
2318
|
+
}
|
|
2067
2319
|
default:
|
|
2068
2320
|
throw new Error(`Unknown tool: ${name}`);
|
|
2069
2321
|
}
|
|
@@ -2099,13 +2351,63 @@ async function main() {
|
|
|
2099
2351
|
const keepAlive = setInterval(() => {
|
|
2100
2352
|
// Empty interval just to keep event loop alive
|
|
2101
2353
|
}, 1000 * 60 * 60); // Every hour (basically forever)
|
|
2102
|
-
//
|
|
2103
|
-
const
|
|
2354
|
+
// Periodic auto-save: Save database every 5 minutes to prevent data loss
|
|
2355
|
+
const autoSaveInterval = setInterval(() => {
|
|
2356
|
+
try {
|
|
2357
|
+
if (db && typeof db.save === 'function') {
|
|
2358
|
+
db.save();
|
|
2359
|
+
console.error('💾 Auto-saved database to', dbPath);
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
catch (error) {
|
|
2363
|
+
console.error('❌ Auto-save failed:', error.message);
|
|
2364
|
+
}
|
|
2365
|
+
}, 5 * 60 * 1000); // 5 minutes
|
|
2366
|
+
// Handle graceful shutdown with database persistence
|
|
2367
|
+
const shutdown = async () => {
|
|
2368
|
+
console.error('🔄 Shutting down AgentDB MCP Server...');
|
|
2369
|
+
// Clear intervals
|
|
2104
2370
|
clearInterval(keepAlive);
|
|
2105
|
-
|
|
2371
|
+
clearInterval(autoSaveInterval);
|
|
2372
|
+
let persistenceFailed = false;
|
|
2373
|
+
// Save database before exit
|
|
2374
|
+
try {
|
|
2375
|
+
if (db && typeof db.save === 'function') {
|
|
2376
|
+
console.error('💾 Saving database to', dbPath);
|
|
2377
|
+
await db.save();
|
|
2378
|
+
console.error('✅ Database saved successfully');
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
catch (error) {
|
|
2382
|
+
persistenceFailed = true;
|
|
2383
|
+
console.error('❌ Error saving database:', error.message);
|
|
2384
|
+
}
|
|
2385
|
+
// Close database connection. close() persists sql.js itself, so only call
|
|
2386
|
+
// it after save when save succeeded; a failed optimistic save must not be
|
|
2387
|
+
// retried against the same stale snapshot.
|
|
2388
|
+
try {
|
|
2389
|
+
if (!persistenceFailed && db && typeof db.close === 'function') {
|
|
2390
|
+
db.close();
|
|
2391
|
+
console.error('✅ Database connection closed');
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
catch (error) {
|
|
2395
|
+
persistenceFailed = true;
|
|
2396
|
+
console.error('❌ Error closing database:', error.message);
|
|
2397
|
+
}
|
|
2398
|
+
process.exit(persistenceFailed ? 1 : 0);
|
|
2106
2399
|
};
|
|
2107
2400
|
process.on('SIGINT', shutdown);
|
|
2108
2401
|
process.on('SIGTERM', shutdown);
|
|
2402
|
+
// Handle unexpected exits
|
|
2403
|
+
process.on('uncaughtException', (error) => {
|
|
2404
|
+
console.error('❌ Uncaught exception:', error);
|
|
2405
|
+
shutdown();
|
|
2406
|
+
});
|
|
2407
|
+
process.on('unhandledRejection', (error) => {
|
|
2408
|
+
console.error('❌ Unhandled rejection:', error);
|
|
2409
|
+
shutdown();
|
|
2410
|
+
});
|
|
2109
2411
|
// Return a never-resolving promise
|
|
2110
2412
|
return new Promise(() => {
|
|
2111
2413
|
// The setInterval above keeps the event loop alive
|