agentdb 3.0.0-alpha.9 → 3.0.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/VectorBackend.d.ts +48 -6
- package/dist/src/backends/VectorBackend.d.ts.map +1 -1
- package/dist/src/backends/VectorBackend.js +13 -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 +464 -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 +29 -0
- package/dist/src/controllers/EmbeddingService.d.ts.map +1 -1
- package/dist/src/controllers/EmbeddingService.js +154 -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 +6 -3
- package/dist/src/controllers/ReasoningBank.d.ts.map +1 -1
- package/dist/src/controllers/ReasoningBank.js +77 -56
- 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 +678 -220
- package/dist/src/controllers/ReflexionMemory.js.map +1 -1
- package/dist/src/controllers/SkillLibrary.d.ts +32 -3
- package/dist/src/controllers/SkillLibrary.d.ts.map +1 -1
- package/dist/src/controllers/SkillLibrary.js +239 -104
- 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 +161 -102
- 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 +178 -15
- 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 +90 -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 +332 -0
- package/dist/src/simd/simd-vector-ops.d.ts.map +1 -0
- package/dist/src/simd/simd-vector-ops.js +945 -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/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
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* - Database management
|
|
10
10
|
*/
|
|
11
11
|
import { createDatabase } from '../db-fallback.js';
|
|
12
|
+
import { randomBytes } from 'crypto';
|
|
13
|
+
import { parseJsonStrict } from '../security/input-validation.js';
|
|
12
14
|
import { CausalMemoryGraph } from '../controllers/CausalMemoryGraph.js';
|
|
13
15
|
import { CausalRecall } from '../controllers/CausalRecall.js';
|
|
14
16
|
import { ExplainableRecall } from '../controllers/ExplainableRecall.js';
|
|
@@ -19,11 +21,18 @@ import { EmbeddingService } from '../controllers/EmbeddingService.js';
|
|
|
19
21
|
import { MMRDiversityRanker } from '../controllers/MMRDiversityRanker.js';
|
|
20
22
|
import { ContextSynthesizer } from '../controllers/ContextSynthesizer.js';
|
|
21
23
|
import { MetadataFilter } from '../controllers/MetadataFilter.js';
|
|
24
|
+
import { QUICServer } from '../controllers/QUICServer.js';
|
|
25
|
+
import { QUICClient } from '../controllers/QUICClient.js';
|
|
26
|
+
import { SyncCoordinator } from '../controllers/SyncCoordinator.js';
|
|
22
27
|
import { initCommand } from './commands/init.js';
|
|
23
28
|
import { statusCommand } from './commands/status.js';
|
|
24
29
|
import { installEmbeddingsCommand } from './commands/install-embeddings.js';
|
|
25
30
|
import { migrateCommand } from './commands/migrate.js';
|
|
26
31
|
import { doctorCommand } from './commands/doctor.js';
|
|
32
|
+
import { attentionCommand } from './commands/attention.js';
|
|
33
|
+
import { learnCommand } from './commands/learn.js';
|
|
34
|
+
import { routeCommand } from './commands/route.js';
|
|
35
|
+
import { hyperbolicCommand } from './commands/hyperbolic.js';
|
|
27
36
|
import * as fs from 'fs';
|
|
28
37
|
import * as path from 'path';
|
|
29
38
|
import * as zlib from 'zlib';
|
|
@@ -48,6 +57,63 @@ const log = {
|
|
|
48
57
|
warning: (msg) => console.log(`${colors.yellow}⚠ ${msg}${colors.reset}`),
|
|
49
58
|
header: (msg) => console.log(`${colors.bright}${colors.cyan}${msg}${colors.reset}`)
|
|
50
59
|
};
|
|
60
|
+
// Spinner utility for progress indication
|
|
61
|
+
class Spinner {
|
|
62
|
+
frames = ['|', '/', '-', '\\'];
|
|
63
|
+
current = 0;
|
|
64
|
+
interval = null;
|
|
65
|
+
message = '';
|
|
66
|
+
start(message) {
|
|
67
|
+
this.message = message;
|
|
68
|
+
this.current = 0;
|
|
69
|
+
process.stdout.write(`\r${this.frames[0]} ${message}`);
|
|
70
|
+
this.interval = setInterval(() => {
|
|
71
|
+
this.current = (this.current + 1) % this.frames.length;
|
|
72
|
+
process.stdout.write(`\r${this.frames[this.current]} ${this.message}`);
|
|
73
|
+
}, 100);
|
|
74
|
+
}
|
|
75
|
+
update(message) {
|
|
76
|
+
this.message = message;
|
|
77
|
+
process.stdout.write(`\r${this.frames[this.current]} ${this.message}`);
|
|
78
|
+
}
|
|
79
|
+
succeed(message) {
|
|
80
|
+
this.stop();
|
|
81
|
+
console.log(`\r${colors.green}v${colors.reset} ${message}`);
|
|
82
|
+
}
|
|
83
|
+
fail(message) {
|
|
84
|
+
this.stop();
|
|
85
|
+
console.log(`\r${colors.red}x${colors.reset} ${message}`);
|
|
86
|
+
}
|
|
87
|
+
stop() {
|
|
88
|
+
if (this.interval) {
|
|
89
|
+
clearInterval(this.interval);
|
|
90
|
+
this.interval = null;
|
|
91
|
+
}
|
|
92
|
+
process.stdout.write('\r' + ' '.repeat(this.message.length + 10) + '\r');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Progress bar utility
|
|
96
|
+
class ProgressBar {
|
|
97
|
+
width = 40;
|
|
98
|
+
current = 0;
|
|
99
|
+
total = 100;
|
|
100
|
+
message = '';
|
|
101
|
+
update(current, total, message) {
|
|
102
|
+
this.current = current;
|
|
103
|
+
this.total = total;
|
|
104
|
+
if (message)
|
|
105
|
+
this.message = message;
|
|
106
|
+
const percent = Math.round((current / total) * 100);
|
|
107
|
+
const filled = Math.round((current / total) * this.width);
|
|
108
|
+
const empty = this.width - filled;
|
|
109
|
+
const bar = `${colors.green}${'='.repeat(filled)}${colors.reset}${'-'.repeat(empty)}`;
|
|
110
|
+
process.stdout.write(`\r[${bar}] ${percent}% ${this.message}`);
|
|
111
|
+
}
|
|
112
|
+
complete(message) {
|
|
113
|
+
const bar = `${colors.green}${'='.repeat(this.width)}${colors.reset}`;
|
|
114
|
+
console.log(`\r[${bar}] 100% ${message}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
51
117
|
class AgentDBCLI {
|
|
52
118
|
db; // Database instance from createDatabase (public for init command)
|
|
53
119
|
causalGraph;
|
|
@@ -57,6 +123,10 @@ class AgentDBCLI {
|
|
|
57
123
|
reflexion;
|
|
58
124
|
skills;
|
|
59
125
|
embedder;
|
|
126
|
+
// QUIC sync controllers
|
|
127
|
+
quicServer;
|
|
128
|
+
quicClient;
|
|
129
|
+
syncCoordinator;
|
|
60
130
|
async initialize(dbPath = './agentdb.db') {
|
|
61
131
|
// Initialize database
|
|
62
132
|
this.db = await createDatabase(dbPath);
|
|
@@ -64,46 +134,14 @@ class AgentDBCLI {
|
|
|
64
134
|
this.db.pragma('journal_mode = WAL');
|
|
65
135
|
this.db.pragma('synchronous = NORMAL');
|
|
66
136
|
this.db.pragma('cache_size = -64000');
|
|
67
|
-
// Load both schemas
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
path.join(process.cwd(), 'node_modules/agentdb/dist/schemas') // installed package
|
|
76
|
-
];
|
|
77
|
-
let schemasLoaded = 0;
|
|
78
|
-
for (const basePath of basePaths) {
|
|
79
|
-
if (fs.existsSync(basePath)) {
|
|
80
|
-
for (const schemaFile of schemaFiles) {
|
|
81
|
-
const schemaPath = path.join(basePath, schemaFile);
|
|
82
|
-
if (fs.existsSync(schemaPath)) {
|
|
83
|
-
try {
|
|
84
|
-
const schema = fs.readFileSync(schemaPath, 'utf-8');
|
|
85
|
-
this.db.exec(schema);
|
|
86
|
-
schemasLoaded++;
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
log.error(`Failed to load schema from ${schemaPath}: ${error.message}`);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
// If we found at least one schema in this path, we're done
|
|
94
|
-
if (schemasLoaded > 0)
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (schemasLoaded === 0) {
|
|
99
|
-
log.warning('Schema files not found, database may not be initialized properly');
|
|
100
|
-
log.info('__dirname: ' + __dirname);
|
|
101
|
-
log.info('process.cwd(): ' + process.cwd());
|
|
102
|
-
log.info('Tried base paths:');
|
|
103
|
-
basePaths.forEach(p => {
|
|
104
|
-
log.info(` - ${p} (exists: ${fs.existsSync(p)})`);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
137
|
+
// Load both schemas from the inlined constants — bundled into the package,
|
|
138
|
+
// so globally-installed CLIs and weird __dirname resolutions just work.
|
|
139
|
+
// (Was a long __dirname/cwd dance that failed for `npm install -g`. #1)
|
|
140
|
+
const { SCHEMA_SQL, FRONTIER_SCHEMA_SQL } = await import('../schemas/inline.js');
|
|
141
|
+
if (SCHEMA_SQL)
|
|
142
|
+
this.db.exec(SCHEMA_SQL);
|
|
143
|
+
if (FRONTIER_SCHEMA_SQL)
|
|
144
|
+
this.db.exec(FRONTIER_SCHEMA_SQL);
|
|
107
145
|
// Initialize embedding service
|
|
108
146
|
this.embedder = new EmbeddingService({
|
|
109
147
|
model: 'Xenova/all-MiniLM-L6-v2',
|
|
@@ -194,7 +232,12 @@ class AgentDBCLI {
|
|
|
194
232
|
isTreatment: params.isTreatment,
|
|
195
233
|
outcomeValue: params.outcome,
|
|
196
234
|
outcomeType: 'reward',
|
|
197
|
-
|
|
235
|
+
// #6 §C.1 — strict parse so a crafted/malformed `--context` JSON
|
|
236
|
+
// surfaces as a ValidationError, not an unhandled SyntaxError leaking
|
|
237
|
+
// a stack trace.
|
|
238
|
+
context: params.context && params.context.trim()
|
|
239
|
+
? parseJsonStrict(params.context, 'context')
|
|
240
|
+
: undefined
|
|
198
241
|
});
|
|
199
242
|
// Save database to persist changes
|
|
200
243
|
this.db.save();
|
|
@@ -565,132 +608,664 @@ class AgentDBCLI {
|
|
|
565
608
|
// QUIC Synchronization Commands
|
|
566
609
|
// ============================================================================
|
|
567
610
|
async quicStartServer(params) {
|
|
568
|
-
|
|
611
|
+
if (!this.db)
|
|
612
|
+
throw new Error('Not initialized');
|
|
613
|
+
log.header('\n[QUIC] Starting QUIC Sync Server');
|
|
614
|
+
const spinner = new Spinner();
|
|
615
|
+
const host = params.host || '127.0.0.1';
|
|
569
616
|
const port = params.port || 4433;
|
|
570
|
-
const authToken = params.authToken || this.generateAuthToken();
|
|
571
|
-
|
|
572
|
-
log
|
|
617
|
+
const authToken = params.authToken || process.env.AGENTDB_QUIC_AUTH_TOKEN || this.generateAuthToken();
|
|
618
|
+
const tokenGenerated = !params.authToken && !process.env.AGENTDB_QUIC_AUTH_TOKEN;
|
|
619
|
+
console.log('\n' + '='.repeat(80));
|
|
620
|
+
console.log(`${colors.bright}Server Configuration${colors.reset}`);
|
|
621
|
+
console.log('='.repeat(80));
|
|
622
|
+
console.log(` Host: ${colors.cyan}${host}${colors.reset}`);
|
|
623
|
+
console.log(` Port: ${colors.cyan}${port}${colors.reset}`);
|
|
624
|
+
console.log(` Auth Token: ${colors.cyan}${tokenGenerated ? 'generated (not shown)' : 'configured'}${colors.reset}`);
|
|
625
|
+
console.log(` Max Connections: ${colors.cyan}${params.maxConnections || 100}${colors.reset}`);
|
|
573
626
|
if (params.cert && params.key) {
|
|
574
|
-
log
|
|
575
|
-
log
|
|
627
|
+
console.log(` TLS Certificate: ${colors.green}${params.cert}${colors.reset}`);
|
|
628
|
+
console.log(` TLS Key: ${colors.green}${params.key}${colors.reset}`);
|
|
576
629
|
}
|
|
577
630
|
else {
|
|
578
|
-
log
|
|
631
|
+
console.log(` TLS: ${colors.yellow}Self-signed (development mode)${colors.reset}`);
|
|
632
|
+
}
|
|
633
|
+
console.log('='.repeat(80));
|
|
634
|
+
try {
|
|
635
|
+
spinner.start('Initializing QUIC server...');
|
|
636
|
+
// Create QUIC server configuration
|
|
637
|
+
const serverConfig = {
|
|
638
|
+
host,
|
|
639
|
+
port,
|
|
640
|
+
maxConnections: params.maxConnections || 100,
|
|
641
|
+
authToken,
|
|
642
|
+
tlsConfig: {
|
|
643
|
+
cert: params.cert,
|
|
644
|
+
key: params.key,
|
|
645
|
+
},
|
|
646
|
+
rateLimit: {
|
|
647
|
+
maxRequestsPerMinute: 60,
|
|
648
|
+
maxBytesPerMinute: 10 * 1024 * 1024, // 10MB
|
|
649
|
+
},
|
|
650
|
+
};
|
|
651
|
+
// Initialize the QUIC server with database
|
|
652
|
+
this.quicServer = new QUICServer(this.db, serverConfig);
|
|
653
|
+
spinner.update('Starting server...');
|
|
654
|
+
await this.quicServer.start();
|
|
655
|
+
spinner.succeed('QUIC server started successfully');
|
|
656
|
+
console.log('\n' + '-'.repeat(80));
|
|
657
|
+
console.log(`${colors.bright}Server Status${colors.reset}`);
|
|
658
|
+
console.log('-'.repeat(80));
|
|
659
|
+
const status = this.quicServer.getStatus();
|
|
660
|
+
console.log(` Status: ${colors.green}Running${colors.reset}`);
|
|
661
|
+
console.log(` Active Connections: ${colors.cyan}${status.activeConnections}${colors.reset}`);
|
|
662
|
+
console.log(` Rate Limit: ${colors.cyan}${status.config.rateLimit?.maxRequestsPerMinute} req/min${colors.reset}`);
|
|
663
|
+
console.log('-'.repeat(80));
|
|
664
|
+
log.info('\nServer is ready to accept connections.');
|
|
665
|
+
// Never print the token: it would end up in terminal scrollback and logs
|
|
666
|
+
log.info(`Clients can connect using: agentdb sync connect <host> ${port} --auth-token <token>`);
|
|
667
|
+
if (tokenGenerated) {
|
|
668
|
+
log.warning('No --auth-token or AGENTDB_QUIC_AUTH_TOKEN was given; a random token was generated and is not displayed. Set one to share it with clients.');
|
|
669
|
+
}
|
|
670
|
+
log.info('\nPress Ctrl+C to stop the server');
|
|
671
|
+
// Handle graceful shutdown
|
|
672
|
+
const shutdown = async () => {
|
|
673
|
+
console.log('\n');
|
|
674
|
+
log.info('Shutting down server...');
|
|
675
|
+
const shutdownSpinner = new Spinner();
|
|
676
|
+
shutdownSpinner.start('Closing connections...');
|
|
677
|
+
try {
|
|
678
|
+
if (this.quicServer) {
|
|
679
|
+
await this.quicServer.stop();
|
|
680
|
+
}
|
|
681
|
+
shutdownSpinner.succeed('Server stopped gracefully');
|
|
682
|
+
}
|
|
683
|
+
catch (error) {
|
|
684
|
+
shutdownSpinner.fail(`Error during shutdown: ${error.message}`);
|
|
685
|
+
}
|
|
686
|
+
process.exit(0);
|
|
687
|
+
};
|
|
688
|
+
process.on('SIGINT', shutdown);
|
|
689
|
+
process.on('SIGTERM', shutdown);
|
|
690
|
+
// Monitor server status periodically
|
|
691
|
+
const monitorInterval = setInterval(() => {
|
|
692
|
+
if (this.quicServer) {
|
|
693
|
+
const currentStatus = this.quicServer.getStatus();
|
|
694
|
+
if (currentStatus.activeConnections > 0) {
|
|
695
|
+
process.stdout.write(`\r${colors.cyan}[${new Date().toLocaleTimeString()}]${colors.reset} Active connections: ${currentStatus.activeConnections} | Total requests: ${currentStatus.totalRequests} `);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}, 5000);
|
|
699
|
+
// Keep process alive
|
|
700
|
+
await new Promise((resolve) => {
|
|
701
|
+
process.on('SIGINT', () => {
|
|
702
|
+
clearInterval(monitorInterval);
|
|
703
|
+
resolve();
|
|
704
|
+
});
|
|
705
|
+
process.on('SIGTERM', () => {
|
|
706
|
+
clearInterval(monitorInterval);
|
|
707
|
+
resolve();
|
|
708
|
+
});
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
catch (error) {
|
|
712
|
+
spinner.fail(`Failed to start server: ${error.message}`);
|
|
713
|
+
throw error;
|
|
579
714
|
}
|
|
580
|
-
// TODO: Implement QUIC server using existing QUICSync controller
|
|
581
|
-
log.info('\nServer started. Waiting for connections...');
|
|
582
|
-
log.info('Press Ctrl+C to stop');
|
|
583
|
-
// Keep process alive
|
|
584
|
-
await new Promise(() => { });
|
|
585
715
|
}
|
|
586
716
|
async quicConnect(params) {
|
|
587
|
-
log.header('\n
|
|
588
|
-
|
|
589
|
-
log
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
717
|
+
log.header('\n[QUIC] Connecting to QUIC Sync Server');
|
|
718
|
+
const spinner = new Spinner();
|
|
719
|
+
console.log('\n' + '='.repeat(80));
|
|
720
|
+
console.log(`${colors.bright}Connection Details${colors.reset}`);
|
|
721
|
+
console.log('='.repeat(80));
|
|
722
|
+
console.log(` Server: ${colors.cyan}${params.host}:${params.port}${colors.reset}`);
|
|
723
|
+
console.log(` Authentication: ${params.authToken ? colors.green + 'Enabled' : colors.yellow + 'Disabled'}${colors.reset}`);
|
|
724
|
+
console.log(` Timeout: ${colors.cyan}${params.timeout || 30000}ms${colors.reset}`);
|
|
593
725
|
if (params.cert) {
|
|
594
|
-
log
|
|
726
|
+
console.log(` TLS Certificate: ${colors.green}${params.cert}${colors.reset}`);
|
|
595
727
|
}
|
|
596
728
|
else {
|
|
597
|
-
log.
|
|
729
|
+
console.log(` TLS: ${colors.yellow}Insecure (no certificate provided)${colors.reset}`);
|
|
730
|
+
}
|
|
731
|
+
console.log('='.repeat(80));
|
|
732
|
+
try {
|
|
733
|
+
spinner.start('Initializing QUIC client...');
|
|
734
|
+
// Create QUIC client configuration
|
|
735
|
+
const clientConfig = {
|
|
736
|
+
serverHost: params.host,
|
|
737
|
+
serverPort: params.port,
|
|
738
|
+
authToken: params.authToken,
|
|
739
|
+
maxRetries: 3,
|
|
740
|
+
retryDelayMs: 1000,
|
|
741
|
+
timeoutMs: params.timeout || 30000,
|
|
742
|
+
poolSize: 5,
|
|
743
|
+
tlsConfig: {
|
|
744
|
+
cert: params.cert,
|
|
745
|
+
rejectUnauthorized: !!params.cert,
|
|
746
|
+
},
|
|
747
|
+
};
|
|
748
|
+
// Initialize the QUIC client
|
|
749
|
+
this.quicClient = new QUICClient(clientConfig);
|
|
750
|
+
spinner.update('Establishing connection...');
|
|
751
|
+
await this.quicClient.connect();
|
|
752
|
+
spinner.update('Testing connection (ping)...');
|
|
753
|
+
const pingResult = await this.quicClient.ping();
|
|
754
|
+
if (!pingResult.success) {
|
|
755
|
+
throw new Error(pingResult.error || 'Ping failed');
|
|
756
|
+
}
|
|
757
|
+
spinner.succeed('Connected to remote server successfully');
|
|
758
|
+
console.log('\n' + '-'.repeat(80));
|
|
759
|
+
console.log(`${colors.bright}Connection Status${colors.reset}`);
|
|
760
|
+
console.log('-'.repeat(80));
|
|
761
|
+
const status = this.quicClient.getStatus();
|
|
762
|
+
console.log(` Status: ${colors.green}Connected${colors.reset}`);
|
|
763
|
+
console.log(` Latency: ${colors.cyan}${pingResult.latencyMs}ms${colors.reset}`);
|
|
764
|
+
console.log(` Pool Size: ${colors.cyan}${status.poolSize}${colors.reset}`);
|
|
765
|
+
console.log(` Active Connections: ${colors.cyan}${status.activeConnections}${colors.reset}`);
|
|
766
|
+
console.log('-'.repeat(80));
|
|
767
|
+
// Initialize the SyncCoordinator for subsequent push/pull operations
|
|
768
|
+
if (this.db) {
|
|
769
|
+
this.syncCoordinator = new SyncCoordinator({
|
|
770
|
+
db: this.db,
|
|
771
|
+
client: this.quicClient,
|
|
772
|
+
});
|
|
773
|
+
log.info('\nSync coordinator initialized. Ready for push/pull operations.');
|
|
774
|
+
}
|
|
775
|
+
log.success('\nConnection established.');
|
|
776
|
+
log.info('Use "agentdb sync push" or "agentdb sync pull" to sync data.');
|
|
777
|
+
}
|
|
778
|
+
catch (error) {
|
|
779
|
+
spinner.fail(`Connection failed: ${error.message}`);
|
|
780
|
+
console.log('\n' + '-'.repeat(80));
|
|
781
|
+
console.log(`${colors.bright}Troubleshooting${colors.reset}`);
|
|
782
|
+
console.log('-'.repeat(80));
|
|
783
|
+
console.log(' 1. Verify the server is running and accessible');
|
|
784
|
+
console.log(' 2. Check firewall settings allow traffic on the specified port');
|
|
785
|
+
console.log(' 3. Ensure the auth token matches the server configuration');
|
|
786
|
+
console.log(' 4. For TLS connections, verify the certificate is valid');
|
|
787
|
+
console.log('-'.repeat(80));
|
|
788
|
+
throw error;
|
|
598
789
|
}
|
|
599
|
-
// TODO: Implement QUIC client connection
|
|
600
|
-
log.success('Connected to remote server');
|
|
601
|
-
log.info('Server info: AgentDB QUIC Sync v1.0');
|
|
602
790
|
}
|
|
603
791
|
async quicPush(params) {
|
|
604
792
|
if (!this.db)
|
|
605
793
|
throw new Error('Not initialized');
|
|
606
|
-
log.header('\n
|
|
607
|
-
|
|
608
|
-
|
|
794
|
+
log.header('\n[QUIC] Pushing Changes to Remote');
|
|
795
|
+
const spinner = new Spinner();
|
|
796
|
+
const progressBar = new ProgressBar();
|
|
797
|
+
// Parse server address
|
|
798
|
+
const [host, portStr] = params.server.split(':');
|
|
799
|
+
const port = parseInt(portStr) || 4433;
|
|
800
|
+
console.log('\n' + '='.repeat(80));
|
|
801
|
+
console.log(`${colors.bright}Push Configuration${colors.reset}`);
|
|
802
|
+
console.log('='.repeat(80));
|
|
803
|
+
console.log(` Server: ${colors.cyan}${host}:${port}${colors.reset}`);
|
|
804
|
+
console.log(` Mode: ${colors.cyan}${params.incremental ? 'Incremental' : 'Full Sync'}${colors.reset}`);
|
|
805
|
+
console.log(` Batch Size: ${colors.cyan}${params.batchSize || 100}${colors.reset}`);
|
|
609
806
|
if (params.filter) {
|
|
610
|
-
log
|
|
807
|
+
console.log(` Filter: ${colors.cyan}${params.filter}${colors.reset}`);
|
|
808
|
+
}
|
|
809
|
+
console.log('='.repeat(80));
|
|
810
|
+
try {
|
|
811
|
+
// Step 1: Analyze pending changes
|
|
812
|
+
spinner.start('Analyzing local changes...');
|
|
813
|
+
const pendingChanges = this.getPendingChangesDetailed(params.incremental, params.filter);
|
|
814
|
+
spinner.succeed(`Found ${pendingChanges.totalItems} items to push`);
|
|
815
|
+
console.log('\n' + '-'.repeat(80));
|
|
816
|
+
console.log(`${colors.bright}Pending Changes${colors.reset}`);
|
|
817
|
+
console.log('-'.repeat(80));
|
|
818
|
+
console.log(` Episodes: ${colors.cyan}${pendingChanges.episodes.length}${colors.reset}`);
|
|
819
|
+
console.log(` Skills: ${colors.cyan}${pendingChanges.skills.length}${colors.reset}`);
|
|
820
|
+
console.log(` Edges: ${colors.cyan}${pendingChanges.edges.length}${colors.reset}`);
|
|
821
|
+
console.log(` Total Size: ${colors.cyan}${(pendingChanges.totalSize / 1024).toFixed(2)} KB${colors.reset}`);
|
|
822
|
+
console.log('-'.repeat(80));
|
|
823
|
+
if (pendingChanges.totalItems === 0) {
|
|
824
|
+
log.info('\nNo changes to push. Database is up to date.');
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
// Step 2: Establish connection if not already connected
|
|
828
|
+
spinner.start('Connecting to server...');
|
|
829
|
+
if (!this.quicClient) {
|
|
830
|
+
const clientConfig = {
|
|
831
|
+
serverHost: host,
|
|
832
|
+
serverPort: port,
|
|
833
|
+
authToken: params.authToken,
|
|
834
|
+
maxRetries: 3,
|
|
835
|
+
retryDelayMs: 1000,
|
|
836
|
+
timeoutMs: 30000,
|
|
837
|
+
poolSize: 5,
|
|
838
|
+
};
|
|
839
|
+
this.quicClient = new QUICClient(clientConfig);
|
|
840
|
+
await this.quicClient.connect();
|
|
841
|
+
}
|
|
842
|
+
spinner.succeed('Connected to server');
|
|
843
|
+
// Step 3: Initialize sync coordinator if not exists
|
|
844
|
+
if (!this.syncCoordinator) {
|
|
845
|
+
this.syncCoordinator = new SyncCoordinator({
|
|
846
|
+
db: this.db,
|
|
847
|
+
client: this.quicClient,
|
|
848
|
+
batchSize: params.batchSize || 100,
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
// Step 4: Push changes with progress tracking
|
|
852
|
+
console.log('\n' + '-'.repeat(80));
|
|
853
|
+
console.log(`${colors.bright}Push Progress${colors.reset}`);
|
|
854
|
+
console.log('-'.repeat(80));
|
|
855
|
+
let pushedItems = 0;
|
|
856
|
+
const startTime = Date.now();
|
|
857
|
+
// Perform sync with progress callback
|
|
858
|
+
const syncReport = await this.syncCoordinator.sync((progress) => {
|
|
859
|
+
if (progress.phase === 'pushing') {
|
|
860
|
+
pushedItems = progress.current;
|
|
861
|
+
progressBar.update(progress.current, progress.total, progress.itemType || 'items');
|
|
862
|
+
}
|
|
863
|
+
else if (progress.phase === 'completed') {
|
|
864
|
+
progressBar.complete('Push completed');
|
|
865
|
+
}
|
|
866
|
+
else if (progress.phase === 'error') {
|
|
867
|
+
console.log(`\n${colors.red}Error: ${progress.error}${colors.reset}`);
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
const duration = Date.now() - startTime;
|
|
871
|
+
console.log('\n' + '='.repeat(80));
|
|
872
|
+
console.log(`${colors.bright}Push Summary${colors.reset}`);
|
|
873
|
+
console.log('='.repeat(80));
|
|
874
|
+
console.log(` Status: ${syncReport.success ? colors.green + 'Success' : colors.red + 'Failed'}${colors.reset}`);
|
|
875
|
+
console.log(` Items Pushed: ${colors.cyan}${syncReport.itemsPushed}${colors.reset}`);
|
|
876
|
+
console.log(` Bytes Transferred: ${colors.cyan}${(syncReport.bytesTransferred / 1024).toFixed(2)} KB${colors.reset}`);
|
|
877
|
+
console.log(` Duration: ${colors.cyan}${duration}ms${colors.reset}`);
|
|
878
|
+
console.log(` Throughput: ${colors.cyan}${((syncReport.bytesTransferred / 1024) / (duration / 1000)).toFixed(2)} KB/s${colors.reset}`);
|
|
879
|
+
if (syncReport.errors.length > 0) {
|
|
880
|
+
console.log(` Errors: ${colors.red}${syncReport.errors.length}${colors.reset}`);
|
|
881
|
+
syncReport.errors.forEach((err, i) => {
|
|
882
|
+
console.log(` ${i + 1}. ${err}`);
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
console.log('='.repeat(80));
|
|
886
|
+
if (syncReport.success) {
|
|
887
|
+
log.success('\nChanges pushed successfully');
|
|
888
|
+
}
|
|
889
|
+
else {
|
|
890
|
+
log.error('\nPush completed with errors');
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
catch (error) {
|
|
894
|
+
spinner.fail(`Push failed: ${error.message}`);
|
|
895
|
+
throw error;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
// Helper to get detailed pending changes with actual data
|
|
899
|
+
getPendingChangesDetailed(incremental, filter) {
|
|
900
|
+
if (!this.db) {
|
|
901
|
+
return { episodes: [], skills: [], edges: [], totalItems: 0, totalSize: 0 };
|
|
902
|
+
}
|
|
903
|
+
try {
|
|
904
|
+
// Get last sync time
|
|
905
|
+
let lastSyncTime = 0;
|
|
906
|
+
if (incremental) {
|
|
907
|
+
try {
|
|
908
|
+
const syncState = this.db.prepare('SELECT last_sync_at FROM sync_state WHERE id = 1').get();
|
|
909
|
+
if (syncState) {
|
|
910
|
+
lastSyncTime = syncState.last_sync_at || 0;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
catch {
|
|
914
|
+
// Table might not exist
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
// Query episodes
|
|
918
|
+
let episodesQuery = 'SELECT * FROM episodes WHERE 1=1';
|
|
919
|
+
const episodeParams = [];
|
|
920
|
+
if (incremental && lastSyncTime > 0) {
|
|
921
|
+
episodesQuery += ' AND ts > ?';
|
|
922
|
+
episodeParams.push(lastSyncTime);
|
|
923
|
+
}
|
|
924
|
+
const episodes = this.db.prepare(episodesQuery).all(...episodeParams) || [];
|
|
925
|
+
// Query skills
|
|
926
|
+
let skillsQuery = 'SELECT * FROM skills WHERE 1=1';
|
|
927
|
+
const skillParams = [];
|
|
928
|
+
if (incremental && lastSyncTime > 0) {
|
|
929
|
+
skillsQuery += ' AND ts > ?';
|
|
930
|
+
skillParams.push(lastSyncTime);
|
|
931
|
+
}
|
|
932
|
+
let skills = [];
|
|
933
|
+
try {
|
|
934
|
+
skills = this.db.prepare(skillsQuery).all(...skillParams) || [];
|
|
935
|
+
}
|
|
936
|
+
catch {
|
|
937
|
+
// Skills table might not exist
|
|
938
|
+
}
|
|
939
|
+
// Query edges
|
|
940
|
+
let edgesQuery = 'SELECT * FROM skill_edges WHERE 1=1';
|
|
941
|
+
const edgeParams = [];
|
|
942
|
+
if (incremental && lastSyncTime > 0) {
|
|
943
|
+
edgesQuery += ' AND ts > ?';
|
|
944
|
+
edgeParams.push(lastSyncTime);
|
|
945
|
+
}
|
|
946
|
+
let edges = [];
|
|
947
|
+
try {
|
|
948
|
+
edges = this.db.prepare(edgesQuery).all(...edgeParams) || [];
|
|
949
|
+
}
|
|
950
|
+
catch {
|
|
951
|
+
// Edges table might not exist
|
|
952
|
+
}
|
|
953
|
+
// Calculate total size
|
|
954
|
+
const totalSize = JSON.stringify(episodes).length +
|
|
955
|
+
JSON.stringify(skills).length +
|
|
956
|
+
JSON.stringify(edges).length;
|
|
957
|
+
return {
|
|
958
|
+
episodes,
|
|
959
|
+
skills,
|
|
960
|
+
edges,
|
|
961
|
+
totalItems: episodes.length + skills.length + edges.length,
|
|
962
|
+
totalSize,
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
catch (error) {
|
|
966
|
+
log.warning(`Error analyzing changes: ${error.message}`);
|
|
967
|
+
return { episodes: [], skills: [], edges: [], totalItems: 0, totalSize: 0 };
|
|
611
968
|
}
|
|
612
|
-
// Get pending changes
|
|
613
|
-
const changes = this.getPendingChanges(params.incremental, params.filter);
|
|
614
|
-
console.log('\n' + '═'.repeat(80));
|
|
615
|
-
console.log(`${colors.bright}Pending Changes${colors.reset}`);
|
|
616
|
-
console.log('═'.repeat(80));
|
|
617
|
-
console.log(` Episodes: ${changes.episodes}`);
|
|
618
|
-
console.log(` Skills: ${changes.skills}`);
|
|
619
|
-
console.log(` Causal Edges: ${changes.causalEdges}`);
|
|
620
|
-
console.log(` Total Size: ${(changes.totalSize / 1024).toFixed(2)} KB`);
|
|
621
|
-
console.log('═'.repeat(80));
|
|
622
|
-
// TODO: Implement QUIC push
|
|
623
|
-
log.success('Changes pushed successfully');
|
|
624
|
-
log.info(`Transferred: ${(changes.totalSize / 1024).toFixed(2)} KB`);
|
|
625
969
|
}
|
|
626
970
|
async quicPull(params) {
|
|
627
971
|
if (!this.db)
|
|
628
972
|
throw new Error('Not initialized');
|
|
629
|
-
log.header('\n
|
|
630
|
-
|
|
631
|
-
|
|
973
|
+
log.header('\n[QUIC] Pulling Changes from Remote');
|
|
974
|
+
const spinner = new Spinner();
|
|
975
|
+
const progressBar = new ProgressBar();
|
|
976
|
+
// Parse server address
|
|
977
|
+
const [host, portStr] = params.server.split(':');
|
|
978
|
+
const port = parseInt(portStr) || 4433;
|
|
979
|
+
console.log('\n' + '='.repeat(80));
|
|
980
|
+
console.log(`${colors.bright}Pull Configuration${colors.reset}`);
|
|
981
|
+
console.log('='.repeat(80));
|
|
982
|
+
console.log(` Server: ${colors.cyan}${host}:${port}${colors.reset}`);
|
|
983
|
+
console.log(` Mode: ${colors.cyan}${params.incremental ? 'Incremental' : 'Full Sync'}${colors.reset}`);
|
|
984
|
+
console.log(` Conflict Strategy: ${colors.cyan}${params.conflictStrategy || 'latest-wins'}${colors.reset}`);
|
|
985
|
+
console.log(` Batch Size: ${colors.cyan}${params.batchSize || 100}${colors.reset}`);
|
|
632
986
|
if (params.filter) {
|
|
633
|
-
log
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
987
|
+
console.log(` Filter: ${colors.cyan}${params.filter}${colors.reset}`);
|
|
988
|
+
}
|
|
989
|
+
console.log('='.repeat(80));
|
|
990
|
+
try {
|
|
991
|
+
// Step 1: Establish connection if not already connected
|
|
992
|
+
spinner.start('Connecting to server...');
|
|
993
|
+
if (!this.quicClient) {
|
|
994
|
+
const clientConfig = {
|
|
995
|
+
serverHost: host,
|
|
996
|
+
serverPort: port,
|
|
997
|
+
authToken: params.authToken,
|
|
998
|
+
maxRetries: 3,
|
|
999
|
+
retryDelayMs: 1000,
|
|
1000
|
+
timeoutMs: 30000,
|
|
1001
|
+
poolSize: 5,
|
|
1002
|
+
};
|
|
1003
|
+
this.quicClient = new QUICClient(clientConfig);
|
|
1004
|
+
await this.quicClient.connect();
|
|
1005
|
+
}
|
|
1006
|
+
spinner.succeed('Connected to server');
|
|
1007
|
+
// Step 2: Initialize sync coordinator if not exists
|
|
1008
|
+
if (!this.syncCoordinator) {
|
|
1009
|
+
this.syncCoordinator = new SyncCoordinator({
|
|
1010
|
+
db: this.db,
|
|
1011
|
+
client: this.quicClient,
|
|
1012
|
+
batchSize: params.batchSize || 100,
|
|
1013
|
+
conflictStrategy: params.conflictStrategy || 'latest-wins',
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
// Step 3: Pull changes with progress tracking
|
|
1017
|
+
console.log('\n' + '-'.repeat(80));
|
|
1018
|
+
console.log(`${colors.bright}Pull Progress${colors.reset}`);
|
|
1019
|
+
console.log('-'.repeat(80));
|
|
1020
|
+
const startTime = Date.now();
|
|
1021
|
+
let currentPhase = '';
|
|
1022
|
+
let episodesReceived = 0;
|
|
1023
|
+
let skillsReceived = 0;
|
|
1024
|
+
let edgesReceived = 0;
|
|
1025
|
+
// Perform sync with progress callback
|
|
1026
|
+
const syncReport = await this.syncCoordinator.sync((progress) => {
|
|
1027
|
+
if (progress.phase === 'pulling') {
|
|
1028
|
+
currentPhase = progress.itemType || 'items';
|
|
1029
|
+
progressBar.update(progress.current, progress.total, `Pulling ${currentPhase}...`);
|
|
1030
|
+
// Track received items
|
|
1031
|
+
if (progress.itemType === 'episodes')
|
|
1032
|
+
episodesReceived = progress.current;
|
|
1033
|
+
if (progress.itemType === 'skills')
|
|
1034
|
+
skillsReceived = progress.current;
|
|
1035
|
+
if (progress.itemType === 'edges')
|
|
1036
|
+
edgesReceived = progress.current;
|
|
1037
|
+
}
|
|
1038
|
+
else if (progress.phase === 'resolving') {
|
|
1039
|
+
progressBar.update(progress.current, progress.total, 'Resolving conflicts...');
|
|
1040
|
+
}
|
|
1041
|
+
else if (progress.phase === 'applying') {
|
|
1042
|
+
progressBar.update(progress.current, progress.total, 'Applying changes...');
|
|
1043
|
+
}
|
|
1044
|
+
else if (progress.phase === 'completed') {
|
|
1045
|
+
progressBar.complete('Pull completed');
|
|
1046
|
+
}
|
|
1047
|
+
else if (progress.phase === 'error') {
|
|
1048
|
+
console.log(`\n${colors.red}Error: ${progress.error}${colors.reset}`);
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
const duration = Date.now() - startTime;
|
|
1052
|
+
console.log('\n' + '='.repeat(80));
|
|
1053
|
+
console.log(`${colors.bright}Pull Summary${colors.reset}`);
|
|
1054
|
+
console.log('='.repeat(80));
|
|
1055
|
+
console.log(` Status: ${syncReport.success ? colors.green + 'Success' : colors.red + 'Failed'}${colors.reset}`);
|
|
1056
|
+
console.log(` Items Pulled: ${colors.cyan}${syncReport.itemsPulled}${colors.reset}`);
|
|
1057
|
+
console.log(` Conflicts Resolved: ${colors.cyan}${syncReport.conflictsResolved}${colors.reset}`);
|
|
1058
|
+
console.log(` Bytes Transferred: ${colors.cyan}${(syncReport.bytesTransferred / 1024).toFixed(2)} KB${colors.reset}`);
|
|
1059
|
+
console.log(` Duration: ${colors.cyan}${duration}ms${colors.reset}`);
|
|
1060
|
+
console.log(` Throughput: ${colors.cyan}${((syncReport.bytesTransferred / 1024) / (duration / 1000)).toFixed(2)} KB/s${colors.reset}`);
|
|
1061
|
+
console.log('\n' + '-'.repeat(80));
|
|
1062
|
+
console.log(`${colors.bright}Received Data${colors.reset}`);
|
|
1063
|
+
console.log('-'.repeat(80));
|
|
1064
|
+
console.log(` Episodes: ${colors.cyan}${episodesReceived}${colors.reset}`);
|
|
1065
|
+
console.log(` Skills: ${colors.cyan}${skillsReceived}${colors.reset}`);
|
|
1066
|
+
console.log(` Edges: ${colors.cyan}${edgesReceived}${colors.reset}`);
|
|
1067
|
+
console.log('-'.repeat(80));
|
|
1068
|
+
if (syncReport.errors.length > 0) {
|
|
1069
|
+
console.log(`\n${colors.bright}Errors${colors.reset}`);
|
|
1070
|
+
console.log('-'.repeat(80));
|
|
1071
|
+
syncReport.errors.forEach((err, i) => {
|
|
1072
|
+
console.log(` ${colors.red}${i + 1}. ${err}${colors.reset}`);
|
|
1073
|
+
});
|
|
1074
|
+
console.log('-'.repeat(80));
|
|
1075
|
+
}
|
|
1076
|
+
console.log('='.repeat(80));
|
|
1077
|
+
if (syncReport.success) {
|
|
1078
|
+
log.success('\nChanges pulled and merged successfully');
|
|
1079
|
+
}
|
|
1080
|
+
else {
|
|
1081
|
+
log.error('\nPull completed with errors');
|
|
1082
|
+
}
|
|
1083
|
+
// Display local database status after pull
|
|
1084
|
+
spinner.start('Verifying local database...');
|
|
1085
|
+
const localStatus = this.getLocalDatabaseStatus();
|
|
1086
|
+
spinner.succeed('Local database verified');
|
|
1087
|
+
console.log('\n' + '-'.repeat(80));
|
|
1088
|
+
console.log(`${colors.bright}Local Database Status${colors.reset}`);
|
|
1089
|
+
console.log('-'.repeat(80));
|
|
1090
|
+
console.log(` Total Episodes: ${colors.cyan}${localStatus.episodes}${colors.reset}`);
|
|
1091
|
+
console.log(` Total Skills: ${colors.cyan}${localStatus.skills}${colors.reset}`);
|
|
1092
|
+
console.log(` Total Edges: ${colors.cyan}${localStatus.edges}${colors.reset}`);
|
|
1093
|
+
console.log('-'.repeat(80));
|
|
1094
|
+
}
|
|
1095
|
+
catch (error) {
|
|
1096
|
+
spinner.fail(`Pull failed: ${error.message}`);
|
|
1097
|
+
throw error;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
// Helper to get local database status
|
|
1101
|
+
getLocalDatabaseStatus() {
|
|
1102
|
+
if (!this.db) {
|
|
1103
|
+
return { episodes: 0, skills: 0, edges: 0 };
|
|
1104
|
+
}
|
|
1105
|
+
let episodes = 0;
|
|
1106
|
+
let skills = 0;
|
|
1107
|
+
let edges = 0;
|
|
1108
|
+
try {
|
|
1109
|
+
const episodeCount = this.db.prepare('SELECT COUNT(*) as count FROM episodes').get();
|
|
1110
|
+
episodes = episodeCount?.count || 0;
|
|
1111
|
+
}
|
|
1112
|
+
catch {
|
|
1113
|
+
// Table might not exist
|
|
1114
|
+
}
|
|
1115
|
+
try {
|
|
1116
|
+
const skillCount = this.db.prepare('SELECT COUNT(*) as count FROM skills').get();
|
|
1117
|
+
skills = skillCount?.count || 0;
|
|
1118
|
+
}
|
|
1119
|
+
catch {
|
|
1120
|
+
// Table might not exist
|
|
1121
|
+
}
|
|
1122
|
+
try {
|
|
1123
|
+
const edgeCount = this.db.prepare('SELECT COUNT(*) as count FROM skill_edges').get();
|
|
1124
|
+
edges = edgeCount?.count || 0;
|
|
1125
|
+
}
|
|
1126
|
+
catch {
|
|
1127
|
+
// Table might not exist
|
|
1128
|
+
}
|
|
1129
|
+
return { episodes, skills, edges };
|
|
652
1130
|
}
|
|
653
1131
|
async quicStatus() {
|
|
654
1132
|
if (!this.db)
|
|
655
1133
|
throw new Error('Not initialized');
|
|
656
|
-
log.header('\n
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
1134
|
+
log.header('\n[QUIC] Sync Status');
|
|
1135
|
+
const spinner = new Spinner();
|
|
1136
|
+
spinner.start('Loading sync status...');
|
|
1137
|
+
// Get sync metadata from database
|
|
1138
|
+
const syncMeta = this.getSyncMetadataFromDb();
|
|
1139
|
+
// Get pending changes
|
|
1140
|
+
const pendingChanges = this.getPendingChangesDetailed(true);
|
|
1141
|
+
spinner.succeed('Status loaded');
|
|
1142
|
+
console.log('\n' + '='.repeat(80));
|
|
1143
|
+
console.log(`${colors.bright}Sync Overview${colors.reset}`);
|
|
1144
|
+
console.log('='.repeat(80));
|
|
1145
|
+
// Last sync information
|
|
1146
|
+
if (syncMeta.lastSyncAt > 0) {
|
|
1147
|
+
const lastSync = new Date(syncMeta.lastSyncAt);
|
|
664
1148
|
console.log(` Last Sync: ${colors.cyan}${lastSync.toLocaleString()}${colors.reset}`);
|
|
665
|
-
console.log(` Time Ago: ${this.timeAgo(syncMeta.
|
|
1149
|
+
console.log(` Time Ago: ${colors.cyan}${this.timeAgo(Math.floor(syncMeta.lastSyncAt / 1000))}${colors.reset}`);
|
|
666
1150
|
}
|
|
667
1151
|
else {
|
|
668
1152
|
console.log(` Last Sync: ${colors.yellow}Never${colors.reset}`);
|
|
669
1153
|
}
|
|
670
|
-
console.log(
|
|
671
|
-
console.log(
|
|
672
|
-
console.log(
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
console.log('\n' + '
|
|
677
|
-
console.log(`${colors.bright}
|
|
678
|
-
console.log('
|
|
679
|
-
|
|
680
|
-
|
|
1154
|
+
console.log(` Total Syncs: ${colors.cyan}${syncMeta.syncCount}${colors.reset}`);
|
|
1155
|
+
console.log(` Total Items Synced: ${colors.cyan}${syncMeta.totalItemsSynced}${colors.reset}`);
|
|
1156
|
+
console.log(` Total Data Synced: ${colors.cyan}${(syncMeta.totalBytesSynced / 1024).toFixed(2)} KB${colors.reset}`);
|
|
1157
|
+
if (syncMeta.lastError) {
|
|
1158
|
+
console.log(` Last Error: ${colors.red}${syncMeta.lastError}${colors.reset}`);
|
|
1159
|
+
}
|
|
1160
|
+
console.log('\n' + '-'.repeat(80));
|
|
1161
|
+
console.log(`${colors.bright}Pending Changes (Unsynced)${colors.reset}`);
|
|
1162
|
+
console.log('-'.repeat(80));
|
|
1163
|
+
console.log(` Episodes: ${colors.cyan}${pendingChanges.episodes.length}${colors.reset}`);
|
|
1164
|
+
console.log(` Skills: ${colors.cyan}${pendingChanges.skills.length}${colors.reset}`);
|
|
1165
|
+
console.log(` Edges: ${colors.cyan}${pendingChanges.edges.length}${colors.reset}`);
|
|
1166
|
+
console.log(` Total Size: ${colors.cyan}${(pendingChanges.totalSize / 1024).toFixed(2)} KB${colors.reset}`);
|
|
1167
|
+
console.log('\n' + '-'.repeat(80));
|
|
1168
|
+
console.log(`${colors.bright}Local Database${colors.reset}`);
|
|
1169
|
+
console.log('-'.repeat(80));
|
|
1170
|
+
const localStatus = this.getLocalDatabaseStatus();
|
|
1171
|
+
console.log(` Episodes: ${colors.cyan}${localStatus.episodes}${colors.reset}`);
|
|
1172
|
+
console.log(` Skills: ${colors.cyan}${localStatus.skills}${colors.reset}`);
|
|
1173
|
+
console.log(` Edges: ${colors.cyan}${localStatus.edges}${colors.reset}`);
|
|
1174
|
+
console.log('\n' + '-'.repeat(80));
|
|
1175
|
+
console.log(`${colors.bright}Controller Status${colors.reset}`);
|
|
1176
|
+
console.log('-'.repeat(80));
|
|
1177
|
+
// Server status
|
|
1178
|
+
if (this.quicServer) {
|
|
1179
|
+
const serverStatus = this.quicServer.getStatus();
|
|
1180
|
+
console.log(` QUIC Server: ${serverStatus.isRunning ? colors.green + 'Running' : colors.yellow + 'Stopped'}${colors.reset}`);
|
|
1181
|
+
if (serverStatus.isRunning) {
|
|
1182
|
+
console.log(` Active Connections: ${colors.cyan}${serverStatus.activeConnections}${colors.reset}`);
|
|
1183
|
+
console.log(` Total Requests: ${colors.cyan}${serverStatus.totalRequests}${colors.reset}`);
|
|
1184
|
+
}
|
|
681
1185
|
}
|
|
682
1186
|
else {
|
|
683
|
-
|
|
684
|
-
console.log(` ${colors.cyan}${server.host}:${server.port}${colors.reset}`);
|
|
685
|
-
console.log(` Status: ${server.connected ? colors.green + 'Connected' : colors.red + 'Disconnected'}${colors.reset}`);
|
|
686
|
-
console.log(` Last Seen: ${new Date(server.lastSeen * 1000).toLocaleString()}`);
|
|
687
|
-
});
|
|
1187
|
+
console.log(` QUIC Server: ${colors.yellow}Not initialized${colors.reset}`);
|
|
688
1188
|
}
|
|
689
|
-
|
|
1189
|
+
// Client status
|
|
1190
|
+
if (this.quicClient) {
|
|
1191
|
+
const clientStatus = this.quicClient.getStatus();
|
|
1192
|
+
console.log(` QUIC Client: ${clientStatus.isConnected ? colors.green + 'Connected' : colors.yellow + 'Disconnected'}${colors.reset}`);
|
|
1193
|
+
if (clientStatus.isConnected) {
|
|
1194
|
+
console.log(` Server: ${colors.cyan}${clientStatus.config.serverHost}:${clientStatus.config.serverPort}${colors.reset}`);
|
|
1195
|
+
console.log(` Pool Size: ${colors.cyan}${clientStatus.poolSize}${colors.reset}`);
|
|
1196
|
+
console.log(` Total Requests: ${colors.cyan}${clientStatus.totalRequests}${colors.reset}`);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
else {
|
|
1200
|
+
console.log(` QUIC Client: ${colors.yellow}Not initialized${colors.reset}`);
|
|
1201
|
+
}
|
|
1202
|
+
// Sync coordinator status
|
|
1203
|
+
if (this.syncCoordinator) {
|
|
1204
|
+
const coordStatus = this.syncCoordinator.getStatus();
|
|
1205
|
+
console.log(` Sync Coordinator: ${colors.green}Ready${colors.reset}`);
|
|
1206
|
+
console.log(` Auto-Sync: ${coordStatus.autoSyncEnabled ? colors.green + 'Enabled' : colors.yellow + 'Disabled'}${colors.reset}`);
|
|
1207
|
+
console.log(` Currently Syncing: ${coordStatus.isSyncing ? colors.yellow + 'Yes' : colors.cyan + 'No'}${colors.reset}`);
|
|
1208
|
+
}
|
|
1209
|
+
else {
|
|
1210
|
+
console.log(` Sync Coordinator: ${colors.yellow}Not initialized${colors.reset}`);
|
|
1211
|
+
}
|
|
1212
|
+
console.log('='.repeat(80));
|
|
1213
|
+
// Recommendations
|
|
1214
|
+
if (pendingChanges.totalItems > 0) {
|
|
1215
|
+
log.info(`\nTip: You have ${pendingChanges.totalItems} unsynced items. Use "agentdb sync push" to sync them.`);
|
|
1216
|
+
}
|
|
1217
|
+
if (!this.quicClient && !this.quicServer) {
|
|
1218
|
+
log.info('\nTo start syncing:');
|
|
1219
|
+
log.info(' - Start a server: agentdb sync start-server --port 4433');
|
|
1220
|
+
log.info(' - Or connect to one: agentdb sync connect <host> <port>');
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
// Get sync metadata from database
|
|
1224
|
+
getSyncMetadataFromDb() {
|
|
1225
|
+
if (!this.db) {
|
|
1226
|
+
return {
|
|
1227
|
+
lastSyncAt: 0,
|
|
1228
|
+
lastEpisodeSync: 0,
|
|
1229
|
+
lastSkillSync: 0,
|
|
1230
|
+
lastEdgeSync: 0,
|
|
1231
|
+
totalItemsSynced: 0,
|
|
1232
|
+
totalBytesSynced: 0,
|
|
1233
|
+
syncCount: 0,
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
try {
|
|
1237
|
+
const row = this.db
|
|
1238
|
+
.prepare('SELECT * FROM sync_state WHERE id = 1')
|
|
1239
|
+
.get();
|
|
1240
|
+
if (row) {
|
|
1241
|
+
return {
|
|
1242
|
+
lastSyncAt: row.last_sync_at || 0,
|
|
1243
|
+
lastEpisodeSync: row.last_episode_sync || 0,
|
|
1244
|
+
lastSkillSync: row.last_skill_sync || 0,
|
|
1245
|
+
lastEdgeSync: row.last_edge_sync || 0,
|
|
1246
|
+
totalItemsSynced: row.total_items_synced || 0,
|
|
1247
|
+
totalBytesSynced: row.total_bytes_synced || 0,
|
|
1248
|
+
syncCount: row.sync_count || 0,
|
|
1249
|
+
lastError: row.last_error || undefined,
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
catch {
|
|
1254
|
+
// Table might not exist
|
|
1255
|
+
}
|
|
1256
|
+
return {
|
|
1257
|
+
lastSyncAt: 0,
|
|
1258
|
+
lastEpisodeSync: 0,
|
|
1259
|
+
lastSkillSync: 0,
|
|
1260
|
+
lastEdgeSync: 0,
|
|
1261
|
+
totalItemsSynced: 0,
|
|
1262
|
+
totalBytesSynced: 0,
|
|
1263
|
+
syncCount: 0,
|
|
1264
|
+
};
|
|
690
1265
|
}
|
|
691
1266
|
generateAuthToken() {
|
|
692
|
-
//
|
|
693
|
-
return
|
|
1267
|
+
// 256 bits from the CSPRNG (Math.random is predictable)
|
|
1268
|
+
return randomBytes(32).toString('hex');
|
|
694
1269
|
}
|
|
695
1270
|
getPendingChanges(incremental, filter) {
|
|
696
1271
|
// Mock implementation - would query sync metadata table
|
|
@@ -747,6 +1322,14 @@ class AgentDBCLI {
|
|
|
747
1322
|
// ============================================================================
|
|
748
1323
|
// CLI Entry Point
|
|
749
1324
|
// ============================================================================
|
|
1325
|
+
/**
|
|
1326
|
+
* Helper function to execute Commander-based commands
|
|
1327
|
+
*/
|
|
1328
|
+
async function handleCommanderCommand(command, args) {
|
|
1329
|
+
// Parse directly using the command instance without wrapping in a parent program
|
|
1330
|
+
// This avoids issues with subcommand routing
|
|
1331
|
+
await command.parseAsync(['node', command.name(), ...args], { from: 'user' });
|
|
1332
|
+
}
|
|
750
1333
|
async function main() {
|
|
751
1334
|
const args = process.argv.slice(2);
|
|
752
1335
|
// Handle version flag
|
|
@@ -917,6 +1500,23 @@ async function main() {
|
|
|
917
1500
|
await handleStatsCommand(args.slice(1));
|
|
918
1501
|
return;
|
|
919
1502
|
}
|
|
1503
|
+
// Handle advanced neural commands (WASM-accelerated when available)
|
|
1504
|
+
if (command === 'attention') {
|
|
1505
|
+
await handleCommanderCommand(attentionCommand, args.slice(1));
|
|
1506
|
+
return;
|
|
1507
|
+
}
|
|
1508
|
+
if (command === 'learn') {
|
|
1509
|
+
await handleCommanderCommand(learnCommand, args.slice(1));
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
if (command === 'route') {
|
|
1513
|
+
await handleCommanderCommand(routeCommand, args.slice(1));
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
if (command === 'hyperbolic') {
|
|
1517
|
+
await handleCommanderCommand(hyperbolicCommand, args.slice(1));
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
920
1520
|
// Handle simulate command - run simulation CLI
|
|
921
1521
|
if (command === 'simulate') {
|
|
922
1522
|
// Use pathToFileURL for proper ESM module resolution
|
|
@@ -1152,7 +1752,7 @@ async function handleInitCommand(args) {
|
|
|
1152
1752
|
async function handleMcpCommand(args) {
|
|
1153
1753
|
const subcommand = args[0];
|
|
1154
1754
|
if (subcommand === 'start' || !subcommand) {
|
|
1155
|
-
|
|
1755
|
+
console.error('Starting AgentDB MCP Server...');
|
|
1156
1756
|
// Spawn the MCP server as a child process (like agentic-flow does)
|
|
1157
1757
|
// This ensures the server stays running with proper stdio inheritance
|
|
1158
1758
|
const mcpServerPath = path.join(__dirname, '../mcp/agentdb-mcp-server.js');
|
|
@@ -1404,12 +2004,17 @@ async function handleDbCommands(cli, subcommand, args) {
|
|
|
1404
2004
|
async function handleSyncCommands(cli, subcommand, args) {
|
|
1405
2005
|
if (subcommand === 'start-server') {
|
|
1406
2006
|
// Parse options
|
|
2007
|
+
let host;
|
|
1407
2008
|
let port;
|
|
1408
2009
|
let cert;
|
|
1409
2010
|
let key;
|
|
1410
2011
|
let authToken;
|
|
2012
|
+
let maxConnections;
|
|
1411
2013
|
for (let i = 0; i < args.length; i++) {
|
|
1412
|
-
if (args[i] === '--
|
|
2014
|
+
if (args[i] === '--host' && i + 1 < args.length) {
|
|
2015
|
+
host = args[++i];
|
|
2016
|
+
}
|
|
2017
|
+
else if (args[i] === '--port' && i + 1 < args.length) {
|
|
1413
2018
|
port = parseInt(args[++i]);
|
|
1414
2019
|
}
|
|
1415
2020
|
else if (args[i] === '--cert' && i + 1 < args.length) {
|
|
@@ -1421,8 +2026,11 @@ async function handleSyncCommands(cli, subcommand, args) {
|
|
|
1421
2026
|
else if (args[i] === '--auth-token' && i + 1 < args.length) {
|
|
1422
2027
|
authToken = args[++i];
|
|
1423
2028
|
}
|
|
2029
|
+
else if (args[i] === '--max-connections' && i + 1 < args.length) {
|
|
2030
|
+
maxConnections = parseInt(args[++i]);
|
|
2031
|
+
}
|
|
1424
2032
|
}
|
|
1425
|
-
await cli.quicStartServer({ port, cert, key, authToken });
|
|
2033
|
+
await cli.quicStartServer({ host, port, cert, key, authToken, maxConnections });
|
|
1426
2034
|
}
|
|
1427
2035
|
else if (subcommand === 'connect') {
|
|
1428
2036
|
// Parse host and port
|
|
@@ -1430,11 +2038,12 @@ async function handleSyncCommands(cli, subcommand, args) {
|
|
|
1430
2038
|
const port = parseInt(args[1]);
|
|
1431
2039
|
if (!host || !port) {
|
|
1432
2040
|
log.error('Missing required arguments: host and port');
|
|
1433
|
-
log.info('Usage: agentdb sync connect <host> <port> [--auth-token <token>] [--cert <path>]');
|
|
2041
|
+
log.info('Usage: agentdb sync connect <host> <port> [--auth-token <token>] [--cert <path>] [--timeout <ms>]');
|
|
1434
2042
|
process.exit(1);
|
|
1435
2043
|
}
|
|
1436
2044
|
let authToken;
|
|
1437
2045
|
let cert;
|
|
2046
|
+
let timeout;
|
|
1438
2047
|
for (let i = 2; i < args.length; i++) {
|
|
1439
2048
|
if (args[i] === '--auth-token' && i + 1 < args.length) {
|
|
1440
2049
|
authToken = args[++i];
|
|
@@ -1442,14 +2051,19 @@ async function handleSyncCommands(cli, subcommand, args) {
|
|
|
1442
2051
|
else if (args[i] === '--cert' && i + 1 < args.length) {
|
|
1443
2052
|
cert = args[++i];
|
|
1444
2053
|
}
|
|
2054
|
+
else if (args[i] === '--timeout' && i + 1 < args.length) {
|
|
2055
|
+
timeout = parseInt(args[++i]);
|
|
2056
|
+
}
|
|
1445
2057
|
}
|
|
1446
|
-
await cli.quicConnect({ host, port, authToken, cert });
|
|
2058
|
+
await cli.quicConnect({ host, port, authToken, cert, timeout });
|
|
1447
2059
|
}
|
|
1448
2060
|
else if (subcommand === 'push') {
|
|
1449
2061
|
// Parse options
|
|
1450
2062
|
let server;
|
|
1451
2063
|
let incremental = false;
|
|
1452
2064
|
let filter;
|
|
2065
|
+
let authToken;
|
|
2066
|
+
let batchSize;
|
|
1453
2067
|
for (let i = 0; i < args.length; i++) {
|
|
1454
2068
|
if (args[i] === '--server' && i + 1 < args.length) {
|
|
1455
2069
|
server = args[++i];
|
|
@@ -1460,22 +2074,31 @@ async function handleSyncCommands(cli, subcommand, args) {
|
|
|
1460
2074
|
else if (args[i] === '--filter' && i + 1 < args.length) {
|
|
1461
2075
|
filter = args[++i];
|
|
1462
2076
|
}
|
|
2077
|
+
else if (args[i] === '--auth-token' && i + 1 < args.length) {
|
|
2078
|
+
authToken = args[++i];
|
|
2079
|
+
}
|
|
2080
|
+
else if (args[i] === '--batch-size' && i + 1 < args.length) {
|
|
2081
|
+
batchSize = parseInt(args[++i]);
|
|
2082
|
+
}
|
|
1463
2083
|
else if (!args[i].startsWith('--') && !server) {
|
|
1464
2084
|
server = args[i];
|
|
1465
2085
|
}
|
|
1466
2086
|
}
|
|
1467
2087
|
if (!server) {
|
|
1468
2088
|
log.error('Missing required --server parameter');
|
|
1469
|
-
log.info('Usage: agentdb sync push --server <host:port> [--incremental] [--filter <pattern>]');
|
|
2089
|
+
log.info('Usage: agentdb sync push --server <host:port> [--incremental] [--filter <pattern>] [--auth-token <token>] [--batch-size <n>]');
|
|
1470
2090
|
process.exit(1);
|
|
1471
2091
|
}
|
|
1472
|
-
await cli.quicPush({ server, incremental, filter });
|
|
2092
|
+
await cli.quicPush({ server, incremental, filter, authToken, batchSize });
|
|
1473
2093
|
}
|
|
1474
2094
|
else if (subcommand === 'pull') {
|
|
1475
2095
|
// Parse options
|
|
1476
2096
|
let server;
|
|
1477
2097
|
let incremental = false;
|
|
1478
2098
|
let filter;
|
|
2099
|
+
let authToken;
|
|
2100
|
+
let batchSize;
|
|
2101
|
+
let conflictStrategy;
|
|
1479
2102
|
for (let i = 0; i < args.length; i++) {
|
|
1480
2103
|
if (args[i] === '--server' && i + 1 < args.length) {
|
|
1481
2104
|
server = args[++i];
|
|
@@ -1486,16 +2109,31 @@ async function handleSyncCommands(cli, subcommand, args) {
|
|
|
1486
2109
|
else if (args[i] === '--filter' && i + 1 < args.length) {
|
|
1487
2110
|
filter = args[++i];
|
|
1488
2111
|
}
|
|
2112
|
+
else if (args[i] === '--auth-token' && i + 1 < args.length) {
|
|
2113
|
+
authToken = args[++i];
|
|
2114
|
+
}
|
|
2115
|
+
else if (args[i] === '--batch-size' && i + 1 < args.length) {
|
|
2116
|
+
batchSize = parseInt(args[++i]);
|
|
2117
|
+
}
|
|
2118
|
+
else if (args[i] === '--conflict-strategy' && i + 1 < args.length) {
|
|
2119
|
+
const strategy = args[++i];
|
|
2120
|
+
if (strategy === 'local-wins' || strategy === 'remote-wins' || strategy === 'latest-wins') {
|
|
2121
|
+
conflictStrategy = strategy;
|
|
2122
|
+
}
|
|
2123
|
+
else {
|
|
2124
|
+
log.warning(`Unknown conflict strategy: ${strategy}. Using default: latest-wins`);
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
1489
2127
|
else if (!args[i].startsWith('--') && !server) {
|
|
1490
2128
|
server = args[i];
|
|
1491
2129
|
}
|
|
1492
2130
|
}
|
|
1493
2131
|
if (!server) {
|
|
1494
2132
|
log.error('Missing required --server parameter');
|
|
1495
|
-
log.info('Usage: agentdb sync pull --server <host:port> [--incremental] [--filter <pattern>]');
|
|
2133
|
+
log.info('Usage: agentdb sync pull --server <host:port> [--incremental] [--filter <pattern>] [--auth-token <token>] [--batch-size <n>] [--conflict-strategy <local-wins|remote-wins|latest-wins>]');
|
|
1496
2134
|
process.exit(1);
|
|
1497
2135
|
}
|
|
1498
|
-
await cli.quicPull({ server, incremental, filter });
|
|
2136
|
+
await cli.quicPull({ server, incremental, filter, authToken, batchSize, conflictStrategy });
|
|
1499
2137
|
}
|
|
1500
2138
|
else if (subcommand === 'status') {
|
|
1501
2139
|
await cli.quicStatus();
|
|
@@ -1503,6 +2141,13 @@ async function handleSyncCommands(cli, subcommand, args) {
|
|
|
1503
2141
|
else {
|
|
1504
2142
|
log.error(`Unknown sync subcommand: ${subcommand}`);
|
|
1505
2143
|
log.info('Available subcommands: start-server, connect, push, pull, status');
|
|
2144
|
+
log.info('');
|
|
2145
|
+
log.info('Examples:');
|
|
2146
|
+
log.info(' agentdb sync start-server --port 4433 --auth-token secret123');
|
|
2147
|
+
log.info(' agentdb sync connect localhost 4433 --auth-token secret123');
|
|
2148
|
+
log.info(' agentdb sync push --server localhost:4433 --incremental');
|
|
2149
|
+
log.info(' agentdb sync pull --server localhost:4433 --conflict-strategy latest-wins');
|
|
2150
|
+
log.info(' agentdb sync status');
|
|
1506
2151
|
printHelp();
|
|
1507
2152
|
}
|
|
1508
2153
|
}
|
|
@@ -2145,7 +2790,7 @@ ${colors.bright}SETUP COMMANDS:${colors.reset}
|
|
|
2145
2790
|
--in-memory Use temporary in-memory database (:memory:)
|
|
2146
2791
|
|
|
2147
2792
|
agentdb install-embeddings [--global]
|
|
2148
|
-
Install optional embedding dependencies (@
|
|
2793
|
+
Install optional embedding dependencies (@huggingface/transformers)
|
|
2149
2794
|
By default uses mock embeddings - run this for real ML-powered embeddings
|
|
2150
2795
|
Options:
|
|
2151
2796
|
--global, -g Install globally instead of locally
|
|
@@ -2202,13 +2847,15 @@ ${colors.bright}MCP COMMANDS:${colors.reset}
|
|
|
2202
2847
|
Start the MCP server for Claude Desktop integration
|
|
2203
2848
|
|
|
2204
2849
|
${colors.bright}QUIC SYNC COMMANDS:${colors.reset}
|
|
2205
|
-
agentdb sync start-server [--port 4433] [--cert <path>] [--key <path>] [--auth-token <token>]
|
|
2850
|
+
agentdb sync start-server [--host 127.0.0.1] [--port 4433] [--cert <path>] [--key <path>] [--auth-token <token>]
|
|
2206
2851
|
Start a QUIC synchronization server for multi-agent coordination
|
|
2207
2852
|
Options:
|
|
2853
|
+
--host <addr> Bind address (default: 127.0.0.1; use 0.0.0.0 to expose)
|
|
2208
2854
|
--port <n> Server port (default: 4433)
|
|
2209
2855
|
--cert <path> TLS certificate file path
|
|
2210
2856
|
--key <path> TLS key file path
|
|
2211
|
-
--auth-token <token> Authentication token (
|
|
2857
|
+
--auth-token <token> Authentication token (or AGENTDB_QUIC_AUTH_TOKEN; a random,
|
|
2858
|
+
undisplayed token is generated if neither is set)
|
|
2212
2859
|
Example: agentdb sync start-server --port 4433 --cert ./cert.pem --key ./key.pem
|
|
2213
2860
|
|
|
2214
2861
|
agentdb sync connect <host> <port> [--auth-token <token>] [--cert <path>]
|
|
@@ -2243,6 +2890,55 @@ ${colors.bright}QUIC SYNC COMMANDS:${colors.reset}
|
|
|
2243
2890
|
Show synchronization status, pending changes, and connected servers
|
|
2244
2891
|
Example: agentdb sync status
|
|
2245
2892
|
|
|
2893
|
+
${colors.bright}ADVANCED NEURAL COMMANDS (WASM-ACCELERATED):${colors.reset}
|
|
2894
|
+
agentdb attention <subcommand> [options]
|
|
2895
|
+
Attention mechanism operations: flash, hyperbolic, sparse, MoE
|
|
2896
|
+
Subcommands:
|
|
2897
|
+
init --mechanism <type> Initialize attention configuration
|
|
2898
|
+
compute --query <text> Compute attention for query-key-value
|
|
2899
|
+
benchmark --all Benchmark all mechanisms
|
|
2900
|
+
optimize --mechanism <type> Optimize parameters
|
|
2901
|
+
Example: agentdb attention benchmark --all --iterations 100
|
|
2902
|
+
|
|
2903
|
+
agentdb learn --mode <type> --data <file> [options]
|
|
2904
|
+
Advanced learning: curriculum, contrastive loss, hard negative mining
|
|
2905
|
+
Modes:
|
|
2906
|
+
curriculum Progressive difficulty training with cosine/linear schedules
|
|
2907
|
+
contrastive InfoNCE and local contrastive loss training
|
|
2908
|
+
hard-negatives Hard negative mining for contrastive learning
|
|
2909
|
+
Options:
|
|
2910
|
+
--schedule <type> Difficulty schedule: linear|cosine|exponential
|
|
2911
|
+
--temperature <n> InfoNCE temperature (default: 0.07)
|
|
2912
|
+
--strategy <type> Mining strategy: hard|semi-hard|distance-based
|
|
2913
|
+
Example: agentdb learn --mode curriculum --data train.json --schedule cosine
|
|
2914
|
+
Example: agentdb learn --mode contrastive --data pairs.json --epochs 15
|
|
2915
|
+
|
|
2916
|
+
agentdb route --prompt <text> [options]
|
|
2917
|
+
LLM routing with FastGRNN model selection (haiku/sonnet/opus)
|
|
2918
|
+
Options:
|
|
2919
|
+
--prompt <text> Prompt to route
|
|
2920
|
+
--prompt-file <path> File containing prompt
|
|
2921
|
+
--context <json> Conversation context (JSON)
|
|
2922
|
+
--explain Explain routing decision
|
|
2923
|
+
Subcommands:
|
|
2924
|
+
feedback --model <type> --outcome <result> Record feedback for learning
|
|
2925
|
+
stats View routing statistics
|
|
2926
|
+
Example: agentdb route --prompt "Explain quantum computing" --explain
|
|
2927
|
+
Example: agentdb route feedback --model sonnet --outcome success
|
|
2928
|
+
|
|
2929
|
+
agentdb hyperbolic --op <type> [options]
|
|
2930
|
+
Hyperbolic space operations: Poincaré ball geometry
|
|
2931
|
+
Operations:
|
|
2932
|
+
expmap Exponential map (tangent -> manifold)
|
|
2933
|
+
logmap Logarithmic map (manifold -> tangent)
|
|
2934
|
+
mobius-add Möbius addition (hyperbolic addition)
|
|
2935
|
+
distance Poincaré distance between points
|
|
2936
|
+
project Project point to Poincaré ball
|
|
2937
|
+
centroid Compute hyperbolic centroid
|
|
2938
|
+
dual-search Hybrid Euclidean + Hyperbolic search
|
|
2939
|
+
Example: agentdb hyperbolic --op distance --point-a "[0.3,0.4]" --point-b "[0.6,0.2]"
|
|
2940
|
+
Example: agentdb hyperbolic --op dual-search --query "[0.5,0.5]" --points vectors.json
|
|
2941
|
+
|
|
2246
2942
|
${colors.bright}CAUSAL COMMANDS:${colors.reset}
|
|
2247
2943
|
agentdb causal add-edge <cause> <effect> <uplift> [confidence] [sample-size]
|
|
2248
2944
|
Add a causal edge manually
|