agentic-qe 1.0.5 → 1.2.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/.claude/agents/qe-coverage-analyzer.md +8 -0
- package/.claude/agents/qe-flaky-test-hunter.md +9 -1
- package/.claude/agents/qe-quality-analyzer.md +405 -0
- package/.claude/agents/qe-test-generator.md +7 -0
- package/.claude/agents/reasoning/agent.md +816 -0
- package/.claude/agents/reasoning/goal-planner.md +73 -0
- package/.claude/settings.json +21 -20
- package/.claude/skills/README.md +124 -0
- package/.claude/skills/agentdb-advanced/SKILL.md +550 -0
- package/.claude/skills/agentdb-learning/SKILL.md +545 -0
- package/.claude/skills/agentdb-memory-patterns/SKILL.md +339 -0
- package/.claude/skills/agentdb-optimization/SKILL.md +509 -0
- package/.claude/skills/agentdb-vector-search/SKILL.md +339 -0
- package/.claude/skills/agentic-quality-engineering/SKILL.md +604 -0
- package/.claude/skills/api-testing-patterns/SKILL.md +686 -0
- package/.claude/skills/bug-reporting-excellence/SKILL.md +632 -0
- package/.claude/skills/code-review-quality/SKILL.md +683 -0
- package/.claude/skills/consultancy-practices/SKILL.md +540 -0
- package/.claude/skills/context-driven-testing/SKILL.md +466 -0
- package/.claude/skills/exploratory-testing-advanced/SKILL.md +676 -0
- package/.claude/skills/flow-nexus-neural/SKILL.md +738 -0
- package/.claude/skills/flow-nexus-platform/SKILL.md +1157 -0
- package/.claude/skills/flow-nexus-swarm/SKILL.md +610 -0
- package/.claude/skills/github-code-review/SKILL.md +1140 -0
- package/.claude/skills/github-multi-repo/SKILL.md +874 -0
- package/.claude/skills/github-project-management/SKILL.md +1277 -0
- package/.claude/skills/github-release-management/SKILL.md +1081 -0
- package/.claude/skills/github-workflow-automation/SKILL.md +1065 -0
- package/.claude/skills/hive-mind-advanced/SKILL.md +712 -0
- package/.claude/skills/holistic-testing-pact/SKILL.md +225 -0
- package/.claude/skills/hooks-automation/SKILL.md +1201 -0
- package/.claude/skills/pair-programming/SKILL.md +1202 -0
- package/.claude/skills/performance-analysis/SKILL.md +563 -0
- package/.claude/skills/performance-testing/SKILL.md +662 -0
- package/.claude/skills/quality-metrics/SKILL.md +592 -0
- package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -0
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
- package/.claude/skills/refactoring-patterns/SKILL.md +778 -0
- package/.claude/skills/risk-based-testing/SKILL.md +721 -0
- package/.claude/skills/security-testing/SKILL.md +651 -0
- package/.claude/skills/skill-builder/SKILL.md +910 -0
- package/.claude/skills/sparc-methodology/SKILL.md +1115 -0
- package/.claude/skills/stream-chain/SKILL.md +563 -0
- package/.claude/skills/swarm-advanced/SKILL.md +973 -0
- package/.claude/skills/swarm-orchestration/SKILL.md +179 -0
- package/.claude/skills/tdd-london-chicago/SKILL.md +567 -0
- package/.claude/skills/technical-writing/SKILL.md +235 -0
- package/.claude/skills/test-automation-strategy/SKILL.md +842 -0
- package/.claude/skills/verification-quality/SKILL.md +649 -0
- package/.claude/skills/xp-practices/SKILL.md +671 -0
- package/.claude/statusline-command.sh +176 -0
- package/CHANGELOG.md +645 -1
- package/CONTRIBUTING.md +51 -0
- package/README.md +758 -162
- package/bin/aqe +90 -938
- package/config/improvement-loop.config.ts +323 -0
- package/config/neural-agent.config.ts +197 -0
- package/dist/adapters/MemoryStoreAdapter.d.ts +16 -16
- package/dist/adapters/MemoryStoreAdapter.d.ts.map +1 -1
- package/dist/adapters/MemoryStoreAdapter.js +22 -16
- package/dist/adapters/MemoryStoreAdapter.js.map +1 -1
- package/dist/agents/BaseAgent.d.ts +69 -0
- package/dist/agents/BaseAgent.d.ts.map +1 -1
- package/dist/agents/BaseAgent.js +382 -1
- package/dist/agents/BaseAgent.js.map +1 -1
- package/dist/agents/CoverageAnalyzerAgent.d.ts +69 -3
- package/dist/agents/CoverageAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/CoverageAnalyzerAgent.js +418 -51
- package/dist/agents/CoverageAnalyzerAgent.js.map +1 -1
- package/dist/agents/DeploymentReadinessAgent.d.ts.map +1 -1
- package/dist/agents/DeploymentReadinessAgent.js +13 -13
- package/dist/agents/DeploymentReadinessAgent.js.map +1 -1
- package/dist/agents/FlakyTestHunterAgent.d.ts +76 -4
- package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -1
- package/dist/agents/FlakyTestHunterAgent.js +375 -13
- package/dist/agents/FlakyTestHunterAgent.js.map +1 -1
- package/dist/agents/FleetCommanderAgent.d.ts.map +1 -1
- package/dist/agents/FleetCommanderAgent.js +2 -2
- package/dist/agents/FleetCommanderAgent.js.map +1 -1
- package/dist/agents/LearningAgent.d.ts +84 -0
- package/dist/agents/LearningAgent.d.ts.map +1 -0
- package/dist/agents/LearningAgent.js +197 -0
- package/dist/agents/LearningAgent.js.map +1 -0
- package/dist/agents/NeuralAgentExtension.d.ts +117 -0
- package/dist/agents/NeuralAgentExtension.d.ts.map +1 -0
- package/dist/agents/NeuralAgentExtension.js +288 -0
- package/dist/agents/NeuralAgentExtension.js.map +1 -0
- package/dist/agents/PerformanceTesterAgent.d.ts.map +1 -1
- package/dist/agents/PerformanceTesterAgent.js +4 -3
- package/dist/agents/PerformanceTesterAgent.js.map +1 -1
- package/dist/agents/ProductionIntelligenceAgent.js +7 -7
- package/dist/agents/ProductionIntelligenceAgent.js.map +1 -1
- package/dist/agents/QualityAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/QualityAnalyzerAgent.js +2 -2
- package/dist/agents/QualityAnalyzerAgent.js.map +1 -1
- package/dist/agents/QualityGateAgent.js +5 -5
- package/dist/agents/QualityGateAgent.js.map +1 -1
- package/dist/agents/RegressionRiskAnalyzerAgent.js +7 -7
- package/dist/agents/RegressionRiskAnalyzerAgent.js.map +1 -1
- package/dist/agents/RequirementsValidatorAgent.d.ts.map +1 -1
- package/dist/agents/RequirementsValidatorAgent.js +1 -1
- package/dist/agents/RequirementsValidatorAgent.js.map +1 -1
- package/dist/agents/SecurityScannerAgent.js +6 -6
- package/dist/agents/SecurityScannerAgent.js.map +1 -1
- package/dist/agents/TestExecutorAgent.d.ts.map +1 -1
- package/dist/agents/TestExecutorAgent.js +1 -3
- package/dist/agents/TestExecutorAgent.js.map +1 -1
- package/dist/agents/TestGeneratorAgent.d.ts +53 -2
- package/dist/agents/TestGeneratorAgent.d.ts.map +1 -1
- package/dist/agents/TestGeneratorAgent.js +372 -31
- package/dist/agents/TestGeneratorAgent.js.map +1 -1
- package/dist/agents/mixins/NeuralCapableMixin.d.ts +130 -0
- package/dist/agents/mixins/NeuralCapableMixin.d.ts.map +1 -0
- package/dist/agents/mixins/NeuralCapableMixin.js +358 -0
- package/dist/agents/mixins/NeuralCapableMixin.js.map +1 -0
- package/dist/agents/mixins/QUICCapableMixin.d.ts +34 -0
- package/dist/agents/mixins/QUICCapableMixin.d.ts.map +1 -0
- package/dist/agents/mixins/QUICCapableMixin.js +346 -0
- package/dist/agents/mixins/QUICCapableMixin.js.map +1 -0
- package/dist/cli/commands/agent/index.d.ts +5 -0
- package/dist/cli/commands/agent/index.d.ts.map +1 -1
- package/dist/cli/commands/agent/index.js +11 -6
- package/dist/cli/commands/agent/index.js.map +1 -1
- package/dist/cli/commands/agent/kill.d.ts +13 -0
- package/dist/cli/commands/agent/kill.d.ts.map +1 -0
- package/dist/cli/commands/agent/kill.js +65 -0
- package/dist/cli/commands/agent/kill.js.map +1 -0
- package/dist/cli/commands/agent/list.d.ts +19 -0
- package/dist/cli/commands/agent/list.d.ts.map +1 -0
- package/dist/cli/commands/agent/list.js +92 -0
- package/dist/cli/commands/agent/list.js.map +1 -0
- package/dist/cli/commands/agent/logs.d.ts +14 -0
- package/dist/cli/commands/agent/logs.d.ts.map +1 -0
- package/dist/cli/commands/agent/logs.js +77 -0
- package/dist/cli/commands/agent/logs.js.map +1 -0
- package/dist/cli/commands/agent/metrics.d.ts +21 -0
- package/dist/cli/commands/agent/metrics.d.ts.map +1 -0
- package/dist/cli/commands/agent/metrics.js +87 -0
- package/dist/cli/commands/agent/metrics.js.map +1 -0
- package/dist/cli/commands/agent/spawn.d.ts +28 -0
- package/dist/cli/commands/agent/spawn.d.ts.map +1 -0
- package/dist/cli/commands/agent/spawn.js +83 -0
- package/dist/cli/commands/agent/spawn.js.map +1 -0
- package/dist/cli/commands/improve/index.d.ts +70 -0
- package/dist/cli/commands/improve/index.d.ts.map +1 -0
- package/dist/cli/commands/improve/index.js +530 -0
- package/dist/cli/commands/improve/index.js.map +1 -0
- package/dist/cli/commands/init.d.ts +57 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +1127 -42
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/learn/index.d.ts +68 -0
- package/dist/cli/commands/learn/index.d.ts.map +1 -0
- package/dist/cli/commands/learn/index.js +431 -0
- package/dist/cli/commands/learn/index.js.map +1 -0
- package/dist/cli/commands/patterns/index.d.ts +75 -0
- package/dist/cli/commands/patterns/index.d.ts.map +1 -0
- package/dist/cli/commands/patterns/index.js +502 -0
- package/dist/cli/commands/patterns/index.js.map +1 -0
- package/dist/cli/commands/skills/index.d.ts +51 -0
- package/dist/cli/commands/skills/index.d.ts.map +1 -0
- package/dist/cli/commands/skills/index.js +364 -0
- package/dist/cli/commands/skills/index.js.map +1 -0
- package/dist/cli/index.js +458 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/core/EventBus.d.ts +38 -0
- package/dist/core/EventBus.d.ts.map +1 -1
- package/dist/core/EventBus.js +176 -31
- package/dist/core/EventBus.js.map +1 -1
- package/dist/core/FleetManager.d.ts +35 -1
- package/dist/core/FleetManager.d.ts.map +1 -1
- package/dist/core/FleetManager.js +121 -45
- package/dist/core/FleetManager.js.map +1 -1
- package/dist/core/MemoryManager.d.ts +19 -1
- package/dist/core/MemoryManager.d.ts.map +1 -1
- package/dist/core/MemoryManager.js +25 -1
- package/dist/core/MemoryManager.js.map +1 -1
- package/dist/core/embeddings/EmbeddingCache.d.ts +134 -0
- package/dist/core/embeddings/EmbeddingCache.d.ts.map +1 -0
- package/dist/core/embeddings/EmbeddingCache.js +239 -0
- package/dist/core/embeddings/EmbeddingCache.js.map +1 -0
- package/dist/core/embeddings/EmbeddingGenerator.d.ts +224 -0
- package/dist/core/embeddings/EmbeddingGenerator.d.ts.map +1 -0
- package/dist/core/embeddings/EmbeddingGenerator.js +459 -0
- package/dist/core/embeddings/EmbeddingGenerator.js.map +1 -0
- package/dist/core/embeddings/index.d.ts +15 -0
- package/dist/core/embeddings/index.d.ts.map +1 -0
- package/dist/core/embeddings/index.js +22 -0
- package/dist/core/embeddings/index.js.map +1 -0
- package/dist/core/memory/AgentDBIntegration.d.ts +35 -0
- package/dist/core/memory/AgentDBIntegration.d.ts.map +1 -0
- package/dist/core/memory/AgentDBIntegration.js +75 -0
- package/dist/core/memory/AgentDBIntegration.js.map +1 -0
- package/dist/core/memory/AgentDBManager.d.ts +200 -0
- package/dist/core/memory/AgentDBManager.d.ts.map +1 -0
- package/dist/core/memory/AgentDBManager.js +263 -0
- package/dist/core/memory/AgentDBManager.js.map +1 -0
- package/dist/core/memory/AgentDBService.d.ts +160 -0
- package/dist/core/memory/AgentDBService.d.ts.map +1 -0
- package/dist/core/memory/AgentDBService.js +450 -0
- package/dist/core/memory/AgentDBService.js.map +1 -0
- package/dist/core/memory/RealAgentDBAdapter.d.ts +51 -0
- package/dist/core/memory/RealAgentDBAdapter.d.ts.map +1 -0
- package/dist/core/memory/RealAgentDBAdapter.js +230 -0
- package/dist/core/memory/RealAgentDBAdapter.js.map +1 -0
- package/dist/core/memory/ReasoningBankAdapter.d.ts +58 -0
- package/dist/core/memory/ReasoningBankAdapter.d.ts.map +1 -0
- package/dist/core/memory/ReasoningBankAdapter.js +80 -0
- package/dist/core/memory/ReasoningBankAdapter.js.map +1 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts +79 -2
- package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.js +243 -52
- package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
- package/dist/core/memory/index.d.ts +4 -0
- package/dist/core/memory/index.d.ts.map +1 -1
- package/dist/core/memory/index.js +9 -1
- package/dist/core/memory/index.js.map +1 -1
- package/dist/core/neural/NeuralTrainer.d.ts +137 -0
- package/dist/core/neural/NeuralTrainer.d.ts.map +1 -0
- package/dist/core/neural/NeuralTrainer.js +543 -0
- package/dist/core/neural/NeuralTrainer.js.map +1 -0
- package/dist/core/neural/index.d.ts +8 -0
- package/dist/core/neural/index.d.ts.map +1 -0
- package/dist/core/neural/index.js +24 -0
- package/dist/core/neural/index.js.map +1 -0
- package/dist/core/neural/types.d.ts +216 -0
- package/dist/core/neural/types.d.ts.map +1 -0
- package/dist/core/neural/types.js +8 -0
- package/dist/core/neural/types.js.map +1 -0
- package/dist/core/security/CertificateValidator.d.ts +130 -0
- package/dist/core/security/CertificateValidator.d.ts.map +1 -0
- package/dist/core/security/CertificateValidator.js +376 -0
- package/dist/core/security/CertificateValidator.js.map +1 -0
- package/dist/core/transport/QUICTransport.d.ts +62 -0
- package/dist/core/transport/QUICTransport.d.ts.map +1 -0
- package/dist/core/transport/QUICTransport.js +381 -0
- package/dist/core/transport/QUICTransport.js.map +1 -0
- package/dist/core/transport/SecureQUICTransport.d.ts +71 -0
- package/dist/core/transport/SecureQUICTransport.d.ts.map +1 -0
- package/dist/core/transport/SecureQUICTransport.js +253 -0
- package/dist/core/transport/SecureQUICTransport.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/learning/AdvancedFeatureExtractor.d.ts +123 -0
- package/dist/learning/AdvancedFeatureExtractor.d.ts.map +1 -0
- package/dist/learning/AdvancedFeatureExtractor.js +423 -0
- package/dist/learning/AdvancedFeatureExtractor.js.map +1 -0
- package/dist/learning/FlakyFixRecommendations.d.ts +40 -0
- package/dist/learning/FlakyFixRecommendations.d.ts.map +1 -0
- package/dist/learning/FlakyFixRecommendations.js +247 -0
- package/dist/learning/FlakyFixRecommendations.js.map +1 -0
- package/dist/learning/FlakyPredictionModel.d.ts +67 -0
- package/dist/learning/FlakyPredictionModel.d.ts.map +1 -0
- package/dist/learning/FlakyPredictionModel.js +336 -0
- package/dist/learning/FlakyPredictionModel.js.map +1 -0
- package/dist/learning/FlakyTestDetector.d.ts +55 -0
- package/dist/learning/FlakyTestDetector.d.ts.map +1 -0
- package/dist/learning/FlakyTestDetector.js +237 -0
- package/dist/learning/FlakyTestDetector.js.map +1 -0
- package/dist/learning/ImprovementLoop.d.ts +133 -0
- package/dist/learning/ImprovementLoop.d.ts.map +1 -0
- package/dist/learning/ImprovementLoop.js +412 -0
- package/dist/learning/ImprovementLoop.js.map +1 -0
- package/dist/learning/ImprovementWorker.d.ts +83 -0
- package/dist/learning/ImprovementWorker.d.ts.map +1 -0
- package/dist/learning/ImprovementWorker.js +164 -0
- package/dist/learning/ImprovementWorker.js.map +1 -0
- package/dist/learning/LearningEngine.d.ts +144 -0
- package/dist/learning/LearningEngine.d.ts.map +1 -0
- package/dist/learning/LearningEngine.js +531 -0
- package/dist/learning/LearningEngine.js.map +1 -0
- package/dist/learning/NeuralPatternMatcher.d.ts +184 -0
- package/dist/learning/NeuralPatternMatcher.d.ts.map +1 -0
- package/dist/learning/NeuralPatternMatcher.js +702 -0
- package/dist/learning/NeuralPatternMatcher.js.map +1 -0
- package/dist/learning/NeuralTrainer.d.ts +209 -0
- package/dist/learning/NeuralTrainer.d.ts.map +1 -0
- package/dist/learning/NeuralTrainer.js +478 -0
- package/dist/learning/NeuralTrainer.js.map +1 -0
- package/dist/learning/PerformanceTracker.d.ts +118 -0
- package/dist/learning/PerformanceTracker.d.ts.map +1 -0
- package/dist/learning/PerformanceTracker.js +376 -0
- package/dist/learning/PerformanceTracker.js.map +1 -0
- package/dist/learning/StatisticalAnalysis.d.ts +47 -0
- package/dist/learning/StatisticalAnalysis.d.ts.map +1 -0
- package/dist/learning/StatisticalAnalysis.js +170 -0
- package/dist/learning/StatisticalAnalysis.js.map +1 -0
- package/dist/learning/SwarmIntegration.d.ts +107 -0
- package/dist/learning/SwarmIntegration.d.ts.map +1 -0
- package/dist/learning/SwarmIntegration.js +191 -0
- package/dist/learning/SwarmIntegration.js.map +1 -0
- package/dist/learning/index.d.ts +16 -0
- package/dist/learning/index.d.ts.map +1 -0
- package/dist/learning/index.js +32 -0
- package/dist/learning/index.js.map +1 -0
- package/dist/learning/types.d.ts +289 -0
- package/dist/learning/types.d.ts.map +1 -0
- package/dist/learning/types.js +25 -0
- package/dist/learning/types.js.map +1 -0
- package/dist/mcp/MCPToolRegistry.d.ts +34 -0
- package/dist/mcp/MCPToolRegistry.d.ts.map +1 -0
- package/dist/mcp/MCPToolRegistry.js +48 -0
- package/dist/mcp/MCPToolRegistry.js.map +1 -0
- package/dist/mcp/handlers/phase2/Phase2Tools.d.ts +175 -0
- package/dist/mcp/handlers/phase2/Phase2Tools.d.ts.map +1 -0
- package/dist/mcp/handlers/phase2/Phase2Tools.js +693 -0
- package/dist/mcp/handlers/phase2/Phase2Tools.js.map +1 -0
- package/dist/mcp/server.d.ts +4 -4
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +94 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/services/AgentRegistry.d.ts.map +1 -1
- package/dist/mcp/services/AgentRegistry.js +7 -1
- package/dist/mcp/services/AgentRegistry.js.map +1 -1
- package/dist/mcp/tools.d.ts +15 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +17 -1
- package/dist/mcp/tools.js.map +1 -1
- package/dist/reasoning/CodeSignatureGenerator.d.ts +98 -0
- package/dist/reasoning/CodeSignatureGenerator.d.ts.map +1 -0
- package/dist/reasoning/CodeSignatureGenerator.js +427 -0
- package/dist/reasoning/CodeSignatureGenerator.js.map +1 -0
- package/dist/reasoning/PatternClassifier.d.ts +98 -0
- package/dist/reasoning/PatternClassifier.d.ts.map +1 -0
- package/dist/reasoning/PatternClassifier.js +345 -0
- package/dist/reasoning/PatternClassifier.js.map +1 -0
- package/dist/reasoning/PatternExtractor.d.ts +131 -0
- package/dist/reasoning/PatternExtractor.d.ts.map +1 -0
- package/dist/reasoning/PatternExtractor.js +539 -0
- package/dist/reasoning/PatternExtractor.js.map +1 -0
- package/dist/reasoning/PatternMemoryIntegration.d.ts +102 -0
- package/dist/reasoning/PatternMemoryIntegration.d.ts.map +1 -0
- package/dist/reasoning/PatternMemoryIntegration.js +336 -0
- package/dist/reasoning/PatternMemoryIntegration.js.map +1 -0
- package/dist/reasoning/QEReasoningBank.d.ts +121 -0
- package/dist/reasoning/QEReasoningBank.d.ts.map +1 -0
- package/dist/reasoning/QEReasoningBank.js +235 -0
- package/dist/reasoning/QEReasoningBank.js.map +1 -0
- package/dist/reasoning/TestTemplateCreator.d.ts +95 -0
- package/dist/reasoning/TestTemplateCreator.d.ts.map +1 -0
- package/dist/reasoning/TestTemplateCreator.js +535 -0
- package/dist/reasoning/TestTemplateCreator.js.map +1 -0
- package/dist/reasoning/index.d.ts +10 -0
- package/dist/reasoning/index.d.ts.map +1 -0
- package/dist/reasoning/index.js +31 -0
- package/dist/reasoning/index.js.map +1 -0
- package/dist/reasoning/types.d.ts +717 -0
- package/dist/reasoning/types.d.ts.map +1 -0
- package/dist/reasoning/types.js +57 -0
- package/dist/reasoning/types.js.map +1 -0
- package/dist/transport/QUICTransport.d.ts +340 -0
- package/dist/transport/QUICTransport.d.ts.map +1 -0
- package/dist/transport/QUICTransport.js +814 -0
- package/dist/transport/QUICTransport.js.map +1 -0
- package/dist/transport/UDPTransport.d.ts +348 -0
- package/dist/transport/UDPTransport.d.ts.map +1 -0
- package/dist/transport/UDPTransport.js +820 -0
- package/dist/transport/UDPTransport.js.map +1 -0
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/index.d.ts +41 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/pattern.types.d.ts +364 -0
- package/dist/types/pattern.types.d.ts.map +1 -0
- package/dist/types/pattern.types.js +60 -0
- package/dist/types/pattern.types.js.map +1 -0
- package/dist/types/quic.d.ts +339 -0
- package/dist/types/quic.d.ts.map +1 -0
- package/dist/types/quic.js +48 -0
- package/dist/types/quic.js.map +1 -0
- package/dist/utils/Config.js +1 -1
- package/dist/utils/Config.js.map +1 -1
- package/dist/utils/Database.d.ts +14 -0
- package/dist/utils/Database.d.ts.map +1 -1
- package/dist/utils/Database.js +51 -4
- package/dist/utils/Database.js.map +1 -1
- package/dist/utils/Logger.d.ts.map +1 -1
- package/dist/utils/Logger.js +111 -26
- package/dist/utils/Logger.js.map +1 -1
- package/package.json +54 -9
|
@@ -41,6 +41,7 @@ const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
|
|
|
41
41
|
const path = __importStar(require("path"));
|
|
42
42
|
const fs = __importStar(require("fs-extra"));
|
|
43
43
|
const AccessControl_1 = require("./AccessControl");
|
|
44
|
+
const AgentDBManager_1 = require("./AgentDBManager");
|
|
44
45
|
/**
|
|
45
46
|
* SwarmMemoryManager - Manages persistent memory for agent swarm coordination
|
|
46
47
|
*
|
|
@@ -65,6 +66,7 @@ class SwarmMemoryManager {
|
|
|
65
66
|
constructor(dbPath = ':memory:') {
|
|
66
67
|
this.db = null;
|
|
67
68
|
this.initialized = false;
|
|
69
|
+
this.agentDBManager = null;
|
|
68
70
|
// TTL policy constants (in seconds)
|
|
69
71
|
this.TTL_POLICY = {
|
|
70
72
|
artifacts: 0, // Never expire
|
|
@@ -77,6 +79,7 @@ class SwarmMemoryManager {
|
|
|
77
79
|
this.dbPath = dbPath;
|
|
78
80
|
this.accessControl = new AccessControl_1.AccessControl();
|
|
79
81
|
this.aclCache = new Map();
|
|
82
|
+
this.lastModifiedTimestamps = new Map();
|
|
80
83
|
}
|
|
81
84
|
run(sql, params = []) {
|
|
82
85
|
if (!this.db) {
|
|
@@ -84,13 +87,13 @@ class SwarmMemoryManager {
|
|
|
84
87
|
}
|
|
85
88
|
this.db.prepare(sql).run(...params);
|
|
86
89
|
}
|
|
87
|
-
|
|
90
|
+
queryOne(sql, params = []) {
|
|
88
91
|
if (!this.db) {
|
|
89
92
|
throw new Error('Database not initialized');
|
|
90
93
|
}
|
|
91
94
|
return this.db.prepare(sql).get(...params);
|
|
92
95
|
}
|
|
93
|
-
|
|
96
|
+
queryAll(sql, params = []) {
|
|
94
97
|
if (!this.db) {
|
|
95
98
|
throw new Error('Database not initialized');
|
|
96
99
|
}
|
|
@@ -100,11 +103,16 @@ class SwarmMemoryManager {
|
|
|
100
103
|
if (this.initialized) {
|
|
101
104
|
return;
|
|
102
105
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
try {
|
|
107
|
+
// Ensure directory exists for file-based DB
|
|
108
|
+
if (this.dbPath !== ':memory:') {
|
|
109
|
+
await fs.ensureDir(path.dirname(this.dbPath));
|
|
110
|
+
}
|
|
111
|
+
this.db = new better_sqlite3_1.default(this.dbPath);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
throw new Error(`Failed to create database connection: ${error}`);
|
|
106
115
|
}
|
|
107
|
-
this.db = new better_sqlite3_1.default(this.dbPath);
|
|
108
116
|
// Create memory entries table with access control fields
|
|
109
117
|
await this.run(`
|
|
110
118
|
CREATE TABLE IF NOT EXISTS memory_entries (
|
|
@@ -312,8 +320,12 @@ class SwarmMemoryManager {
|
|
|
312
320
|
this.initialized = true;
|
|
313
321
|
}
|
|
314
322
|
async store(key, value, options = {}) {
|
|
323
|
+
// Auto-initialize if not initialized
|
|
324
|
+
if (!this.initialized) {
|
|
325
|
+
await this.initialize();
|
|
326
|
+
}
|
|
315
327
|
if (!this.db) {
|
|
316
|
-
throw new Error('Memory manager not initialized');
|
|
328
|
+
throw new Error('Memory manager not initialized. Call initialize() first.');
|
|
317
329
|
}
|
|
318
330
|
const partition = options.partition || 'default';
|
|
319
331
|
const owner = options.owner || 'system';
|
|
@@ -322,7 +334,7 @@ class SwarmMemoryManager {
|
|
|
322
334
|
const expiresAt = options.ttl ? createdAt + (options.ttl * 1000) : null;
|
|
323
335
|
const metadata = options.metadata ? JSON.stringify(options.metadata) : null;
|
|
324
336
|
// Check write permission if updating existing entry
|
|
325
|
-
const existing = await this.
|
|
337
|
+
const existing = await this.queryOne(`SELECT owner, access_level, team_id, swarm_id FROM memory_entries WHERE key = ? AND partition = ?`, [key, partition]);
|
|
326
338
|
if (existing && options.owner) {
|
|
327
339
|
// Verify write permission
|
|
328
340
|
const permCheck = this.accessControl.checkPermission({
|
|
@@ -353,10 +365,39 @@ class SwarmMemoryManager {
|
|
|
353
365
|
options.teamId || null,
|
|
354
366
|
options.swarmId || null
|
|
355
367
|
]);
|
|
368
|
+
// Track modification for QUIC sync
|
|
369
|
+
const entryKey = `${partition}:${key}`;
|
|
370
|
+
this.lastModifiedTimestamps.set(entryKey, createdAt);
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Alias for store() method to maintain compatibility with MemoryStore interface
|
|
374
|
+
* Used by VerificationHookManager and other components
|
|
375
|
+
*/
|
|
376
|
+
async set(key, value, options = {}) {
|
|
377
|
+
// Handle legacy API: set(key, value, partition)
|
|
378
|
+
if (typeof options === 'string') {
|
|
379
|
+
return this.store(key, value, { partition: options });
|
|
380
|
+
}
|
|
381
|
+
return this.store(key, value, options);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Alias for retrieve() method to maintain compatibility
|
|
385
|
+
* Supports both options object and partition string
|
|
386
|
+
*/
|
|
387
|
+
async get(key, options = {}) {
|
|
388
|
+
// Handle legacy API: get(key, partition)
|
|
389
|
+
if (typeof options === 'string') {
|
|
390
|
+
return this.retrieve(key, { partition: options });
|
|
391
|
+
}
|
|
392
|
+
return this.retrieve(key, options);
|
|
356
393
|
}
|
|
357
394
|
async retrieve(key, options = {}) {
|
|
395
|
+
// Auto-initialize if not initialized
|
|
396
|
+
if (!this.initialized) {
|
|
397
|
+
await this.initialize();
|
|
398
|
+
}
|
|
358
399
|
if (!this.db) {
|
|
359
|
-
throw new Error('Memory manager not initialized');
|
|
400
|
+
throw new Error('Memory manager not initialized. Call initialize() first.');
|
|
360
401
|
}
|
|
361
402
|
const partition = options.partition || 'default';
|
|
362
403
|
const now = Date.now();
|
|
@@ -367,7 +408,7 @@ class SwarmMemoryManager {
|
|
|
367
408
|
query += ` AND (expires_at IS NULL OR expires_at > ?)`;
|
|
368
409
|
params.push(now);
|
|
369
410
|
}
|
|
370
|
-
const row = await this.
|
|
411
|
+
const row = await this.queryOne(query, params);
|
|
371
412
|
if (!row) {
|
|
372
413
|
return null;
|
|
373
414
|
}
|
|
@@ -404,7 +445,7 @@ class SwarmMemoryManager {
|
|
|
404
445
|
query += ` AND (expires_at IS NULL OR expires_at > ?)`;
|
|
405
446
|
params.push(now);
|
|
406
447
|
}
|
|
407
|
-
const rows = await this.
|
|
448
|
+
const rows = await this.queryAll(query, params);
|
|
408
449
|
// Filter by access control if agentId provided
|
|
409
450
|
const filteredRows = options.agentId
|
|
410
451
|
? rows.filter((row) => {
|
|
@@ -440,7 +481,7 @@ class SwarmMemoryManager {
|
|
|
440
481
|
}
|
|
441
482
|
// Check delete permission if agentId provided
|
|
442
483
|
if (options.agentId) {
|
|
443
|
-
const row = await this.
|
|
484
|
+
const row = await this.queryOne(`SELECT owner, access_level, team_id, swarm_id FROM memory_entries WHERE key = ? AND partition = ?`, [key, partition]);
|
|
444
485
|
if (row) {
|
|
445
486
|
const permCheck = this.accessControl.checkPermission({
|
|
446
487
|
agentId: options.agentId,
|
|
@@ -483,7 +524,7 @@ class SwarmMemoryManager {
|
|
|
483
524
|
throw new Error('Memory manager not initialized');
|
|
484
525
|
}
|
|
485
526
|
const now = Date.now();
|
|
486
|
-
const rows = await this.
|
|
527
|
+
const rows = await this.queryAll(`SELECT key, value, created_at, expires_at
|
|
487
528
|
FROM hints
|
|
488
529
|
WHERE key LIKE ? AND (expires_at IS NULL OR expires_at > ?)
|
|
489
530
|
ORDER BY created_at DESC`, [pattern, now]);
|
|
@@ -522,22 +563,22 @@ class SwarmMemoryManager {
|
|
|
522
563
|
if (!this.db) {
|
|
523
564
|
throw new Error('Memory manager not initialized');
|
|
524
565
|
}
|
|
525
|
-
const entriesCount = await this.
|
|
526
|
-
const hintsCount = await this.
|
|
527
|
-
const eventsCount = await this.
|
|
528
|
-
const workflowsCount = await this.
|
|
529
|
-
const patternsCount = await this.
|
|
530
|
-
const consensusCount = await this.
|
|
531
|
-
const metricsCount = await this.
|
|
532
|
-
const artifactsCount = await this.
|
|
533
|
-
const sessionsCount = await this.
|
|
534
|
-
const agentsCount = await this.
|
|
535
|
-
const goapGoalsCount = await this.
|
|
536
|
-
const goapActionsCount = await this.
|
|
537
|
-
const goapPlansCount = await this.
|
|
538
|
-
const oodaCyclesCount = await this.
|
|
539
|
-
const partitionsResult = await this.
|
|
540
|
-
const accessLevelsResult = await this.
|
|
566
|
+
const entriesCount = await this.queryOne(`SELECT COUNT(*) as count FROM memory_entries`);
|
|
567
|
+
const hintsCount = await this.queryOne(`SELECT COUNT(*) as count FROM hints`);
|
|
568
|
+
const eventsCount = await this.queryOne(`SELECT COUNT(*) as count FROM events`);
|
|
569
|
+
const workflowsCount = await this.queryOne(`SELECT COUNT(*) as count FROM workflow_state`);
|
|
570
|
+
const patternsCount = await this.queryOne(`SELECT COUNT(*) as count FROM patterns`);
|
|
571
|
+
const consensusCount = await this.queryOne(`SELECT COUNT(*) as count FROM consensus_state`);
|
|
572
|
+
const metricsCount = await this.queryOne(`SELECT COUNT(*) as count FROM performance_metrics`);
|
|
573
|
+
const artifactsCount = await this.queryOne(`SELECT COUNT(*) as count FROM artifacts`);
|
|
574
|
+
const sessionsCount = await this.queryOne(`SELECT COUNT(*) as count FROM sessions`);
|
|
575
|
+
const agentsCount = await this.queryOne(`SELECT COUNT(*) as count FROM agent_registry`);
|
|
576
|
+
const goapGoalsCount = await this.queryOne(`SELECT COUNT(*) as count FROM goap_goals`);
|
|
577
|
+
const goapActionsCount = await this.queryOne(`SELECT COUNT(*) as count FROM goap_actions`);
|
|
578
|
+
const goapPlansCount = await this.queryOne(`SELECT COUNT(*) as count FROM goap_plans`);
|
|
579
|
+
const oodaCyclesCount = await this.queryOne(`SELECT COUNT(*) as count FROM ooda_cycles`);
|
|
580
|
+
const partitionsResult = await this.queryAll(`SELECT DISTINCT partition FROM memory_entries`);
|
|
581
|
+
const accessLevelsResult = await this.queryAll(`SELECT access_level, COUNT(*) as count FROM memory_entries GROUP BY access_level`);
|
|
541
582
|
const accessLevels = {};
|
|
542
583
|
accessLevelsResult.forEach(row => {
|
|
543
584
|
accessLevels[row.access_level] = row.count;
|
|
@@ -581,7 +622,7 @@ class SwarmMemoryManager {
|
|
|
581
622
|
throw new Error('Memory manager not initialized');
|
|
582
623
|
}
|
|
583
624
|
const now = Date.now();
|
|
584
|
-
const rows = await this.
|
|
625
|
+
const rows = await this.queryAll(`SELECT id, type, payload, timestamp, source, ttl
|
|
585
626
|
FROM events
|
|
586
627
|
WHERE type = ? AND (expires_at IS NULL OR expires_at > ?)
|
|
587
628
|
ORDER BY timestamp DESC`, [type, now]);
|
|
@@ -599,7 +640,7 @@ class SwarmMemoryManager {
|
|
|
599
640
|
throw new Error('Memory manager not initialized');
|
|
600
641
|
}
|
|
601
642
|
const now = Date.now();
|
|
602
|
-
const rows = await this.
|
|
643
|
+
const rows = await this.queryAll(`SELECT id, type, payload, timestamp, source, ttl
|
|
603
644
|
FROM events
|
|
604
645
|
WHERE source = ? AND (expires_at IS NULL OR expires_at > ?)
|
|
605
646
|
ORDER BY timestamp DESC`, [source, now]);
|
|
@@ -628,7 +669,7 @@ class SwarmMemoryManager {
|
|
|
628
669
|
if (!this.db) {
|
|
629
670
|
throw new Error('Memory manager not initialized');
|
|
630
671
|
}
|
|
631
|
-
const row = await this.
|
|
672
|
+
const row = await this.queryOne(`SELECT id, step, status, checkpoint, sha, ttl, created_at, updated_at
|
|
632
673
|
FROM workflow_state
|
|
633
674
|
WHERE id = ?`, [id]);
|
|
634
675
|
if (!row) {
|
|
@@ -666,7 +707,7 @@ class SwarmMemoryManager {
|
|
|
666
707
|
if (!this.db) {
|
|
667
708
|
throw new Error('Memory manager not initialized');
|
|
668
709
|
}
|
|
669
|
-
const rows = await this.
|
|
710
|
+
const rows = await this.queryAll(`SELECT id, step, status, checkpoint, sha, ttl, created_at, updated_at
|
|
670
711
|
FROM workflow_state
|
|
671
712
|
WHERE status = ?`, [status]);
|
|
672
713
|
return rows.map((row) => ({
|
|
@@ -709,7 +750,7 @@ class SwarmMemoryManager {
|
|
|
709
750
|
throw new Error('Memory manager not initialized');
|
|
710
751
|
}
|
|
711
752
|
const now = Date.now();
|
|
712
|
-
const row = await this.
|
|
753
|
+
const row = await this.queryOne(`SELECT id, pattern, confidence, usage_count, metadata, ttl, created_at
|
|
713
754
|
FROM patterns
|
|
714
755
|
WHERE pattern = ? AND (expires_at IS NULL OR expires_at > ?)`, [patternName, now]);
|
|
715
756
|
if (!row) {
|
|
@@ -738,7 +779,7 @@ class SwarmMemoryManager {
|
|
|
738
779
|
throw new Error('Memory manager not initialized');
|
|
739
780
|
}
|
|
740
781
|
const now = Date.now();
|
|
741
|
-
const rows = await this.
|
|
782
|
+
const rows = await this.queryAll(`SELECT id, pattern, confidence, usage_count, metadata, ttl, created_at
|
|
742
783
|
FROM patterns
|
|
743
784
|
WHERE confidence >= ? AND (expires_at IS NULL OR expires_at > ?)
|
|
744
785
|
ORDER BY confidence DESC`, [threshold, now]);
|
|
@@ -781,7 +822,7 @@ class SwarmMemoryManager {
|
|
|
781
822
|
throw new Error('Memory manager not initialized');
|
|
782
823
|
}
|
|
783
824
|
const now = Date.now();
|
|
784
|
-
const row = await this.
|
|
825
|
+
const row = await this.queryOne(`SELECT id, decision, proposer, votes, quorum, status, version, ttl, created_at
|
|
785
826
|
FROM consensus_state
|
|
786
827
|
WHERE id = ? AND (expires_at IS NULL OR expires_at > ?)`, [id, now]);
|
|
787
828
|
if (!row) {
|
|
@@ -821,7 +862,7 @@ class SwarmMemoryManager {
|
|
|
821
862
|
throw new Error('Memory manager not initialized');
|
|
822
863
|
}
|
|
823
864
|
const now = Date.now();
|
|
824
|
-
const rows = await this.
|
|
865
|
+
const rows = await this.queryAll(`SELECT id, decision, proposer, votes, quorum, status, version, ttl, created_at
|
|
825
866
|
FROM consensus_state
|
|
826
867
|
WHERE status = ? AND (expires_at IS NULL OR expires_at > ?)`, [status, now]);
|
|
827
868
|
return rows.map((row) => ({
|
|
@@ -853,7 +894,7 @@ class SwarmMemoryManager {
|
|
|
853
894
|
if (!this.db) {
|
|
854
895
|
throw new Error('Memory manager not initialized');
|
|
855
896
|
}
|
|
856
|
-
const rows = await this.
|
|
897
|
+
const rows = await this.queryAll(`SELECT id, metric, value, unit, timestamp, agent_id
|
|
857
898
|
FROM performance_metrics
|
|
858
899
|
WHERE metric = ?
|
|
859
900
|
ORDER BY timestamp DESC`, [metricName]);
|
|
@@ -870,7 +911,7 @@ class SwarmMemoryManager {
|
|
|
870
911
|
if (!this.db) {
|
|
871
912
|
throw new Error('Memory manager not initialized');
|
|
872
913
|
}
|
|
873
|
-
const rows = await this.
|
|
914
|
+
const rows = await this.queryAll(`SELECT id, metric, value, unit, timestamp, agent_id
|
|
874
915
|
FROM performance_metrics
|
|
875
916
|
WHERE agent_id = ?
|
|
876
917
|
ORDER BY timestamp DESC`, [agentId]);
|
|
@@ -887,7 +928,7 @@ class SwarmMemoryManager {
|
|
|
887
928
|
if (!this.db) {
|
|
888
929
|
throw new Error('Memory manager not initialized');
|
|
889
930
|
}
|
|
890
|
-
const row = await this.
|
|
931
|
+
const row = await this.queryOne(`SELECT AVG(value) as avg FROM performance_metrics WHERE metric = ?`, [metricName]);
|
|
891
932
|
return row?.avg || 0;
|
|
892
933
|
}
|
|
893
934
|
// ============================================================================
|
|
@@ -915,7 +956,7 @@ class SwarmMemoryManager {
|
|
|
915
956
|
if (!this.db) {
|
|
916
957
|
throw new Error('Memory manager not initialized');
|
|
917
958
|
}
|
|
918
|
-
const row = await this.
|
|
959
|
+
const row = await this.queryOne(`SELECT id, kind, path, sha256, tags, metadata, ttl, created_at
|
|
919
960
|
FROM artifacts
|
|
920
961
|
WHERE id = ?`, [id]);
|
|
921
962
|
if (!row) {
|
|
@@ -936,7 +977,7 @@ class SwarmMemoryManager {
|
|
|
936
977
|
if (!this.db) {
|
|
937
978
|
throw new Error('Memory manager not initialized');
|
|
938
979
|
}
|
|
939
|
-
const rows = await this.
|
|
980
|
+
const rows = await this.queryAll(`SELECT id, kind, path, sha256, tags, metadata, ttl, created_at
|
|
940
981
|
FROM artifacts
|
|
941
982
|
WHERE kind = ?`, [kind]);
|
|
942
983
|
return rows.map((row) => ({
|
|
@@ -954,7 +995,7 @@ class SwarmMemoryManager {
|
|
|
954
995
|
if (!this.db) {
|
|
955
996
|
throw new Error('Memory manager not initialized');
|
|
956
997
|
}
|
|
957
|
-
const rows = await this.
|
|
998
|
+
const rows = await this.queryAll(`SELECT id, kind, path, sha256, tags, metadata, ttl, created_at
|
|
958
999
|
FROM artifacts
|
|
959
1000
|
WHERE tags LIKE ?`, [`%"${tag}"%`]);
|
|
960
1001
|
return rows.map((row) => ({
|
|
@@ -990,7 +1031,7 @@ class SwarmMemoryManager {
|
|
|
990
1031
|
if (!this.db) {
|
|
991
1032
|
throw new Error('Memory manager not initialized');
|
|
992
1033
|
}
|
|
993
|
-
const row = await this.
|
|
1034
|
+
const row = await this.queryOne(`SELECT id, mode, state, checkpoints, created_at, last_resumed
|
|
994
1035
|
FROM sessions
|
|
995
1036
|
WHERE id = ?`, [id]);
|
|
996
1037
|
if (!row) {
|
|
@@ -1053,7 +1094,7 @@ class SwarmMemoryManager {
|
|
|
1053
1094
|
if (!this.db) {
|
|
1054
1095
|
throw new Error('Memory manager not initialized');
|
|
1055
1096
|
}
|
|
1056
|
-
const row = await this.
|
|
1097
|
+
const row = await this.queryOne(`SELECT id, type, capabilities, status, performance, created_at, updated_at
|
|
1057
1098
|
FROM agent_registry
|
|
1058
1099
|
WHERE id = ?`, [id]);
|
|
1059
1100
|
if (!row) {
|
|
@@ -1082,7 +1123,7 @@ class SwarmMemoryManager {
|
|
|
1082
1123
|
if (!this.db) {
|
|
1083
1124
|
throw new Error('Memory manager not initialized');
|
|
1084
1125
|
}
|
|
1085
|
-
const rows = await this.
|
|
1126
|
+
const rows = await this.queryAll(`SELECT id, type, capabilities, status, performance, created_at, updated_at
|
|
1086
1127
|
FROM agent_registry
|
|
1087
1128
|
WHERE status = ?`, [status]);
|
|
1088
1129
|
return rows.map((row) => ({
|
|
@@ -1119,7 +1160,7 @@ class SwarmMemoryManager {
|
|
|
1119
1160
|
if (!this.db) {
|
|
1120
1161
|
throw new Error('Memory manager not initialized');
|
|
1121
1162
|
}
|
|
1122
|
-
const row = await this.
|
|
1163
|
+
const row = await this.queryOne(`SELECT id, conditions, cost, priority, created_at
|
|
1123
1164
|
FROM goap_goals
|
|
1124
1165
|
WHERE id = ?`, [id]);
|
|
1125
1166
|
if (!row) {
|
|
@@ -1152,7 +1193,7 @@ class SwarmMemoryManager {
|
|
|
1152
1193
|
if (!this.db) {
|
|
1153
1194
|
throw new Error('Memory manager not initialized');
|
|
1154
1195
|
}
|
|
1155
|
-
const row = await this.
|
|
1196
|
+
const row = await this.queryOne(`SELECT id, preconditions, effects, cost, agent_type, created_at
|
|
1156
1197
|
FROM goap_actions
|
|
1157
1198
|
WHERE id = ?`, [id]);
|
|
1158
1199
|
if (!row) {
|
|
@@ -1179,7 +1220,7 @@ class SwarmMemoryManager {
|
|
|
1179
1220
|
if (!this.db) {
|
|
1180
1221
|
throw new Error('Memory manager not initialized');
|
|
1181
1222
|
}
|
|
1182
|
-
const row = await this.
|
|
1223
|
+
const row = await this.queryOne(`SELECT id, goal_id, sequence, total_cost, created_at
|
|
1183
1224
|
FROM goap_plans
|
|
1184
1225
|
WHERE id = ?`, [id]);
|
|
1185
1226
|
if (!row) {
|
|
@@ -1217,7 +1258,7 @@ class SwarmMemoryManager {
|
|
|
1217
1258
|
if (!this.db) {
|
|
1218
1259
|
throw new Error('Memory manager not initialized');
|
|
1219
1260
|
}
|
|
1220
|
-
const row = await this.
|
|
1261
|
+
const row = await this.queryOne(`SELECT id, phase, observations, orientation, decision, action, timestamp, completed, result
|
|
1221
1262
|
FROM ooda_cycles
|
|
1222
1263
|
WHERE id = ?`, [id]);
|
|
1223
1264
|
if (!row) {
|
|
@@ -1262,7 +1303,7 @@ class SwarmMemoryManager {
|
|
|
1262
1303
|
if (!this.db) {
|
|
1263
1304
|
throw new Error('Memory manager not initialized');
|
|
1264
1305
|
}
|
|
1265
|
-
const rows = await this.
|
|
1306
|
+
const rows = await this.queryAll(`SELECT id, phase, observations, orientation, decision, action, timestamp, completed, result
|
|
1266
1307
|
FROM ooda_cycles
|
|
1267
1308
|
WHERE phase = ?`, [phase]);
|
|
1268
1309
|
return rows.map((row) => ({
|
|
@@ -1313,7 +1354,7 @@ class SwarmMemoryManager {
|
|
|
1313
1354
|
if (this.aclCache.has(resourceId)) {
|
|
1314
1355
|
return this.aclCache.get(resourceId);
|
|
1315
1356
|
}
|
|
1316
|
-
const row = await this.
|
|
1357
|
+
const row = await this.queryOne(`SELECT * FROM memory_acl WHERE resource_id = ?`, [resourceId]);
|
|
1317
1358
|
if (!row) {
|
|
1318
1359
|
return null;
|
|
1319
1360
|
}
|
|
@@ -1392,6 +1433,156 @@ class SwarmMemoryManager {
|
|
|
1392
1433
|
getAccessControl() {
|
|
1393
1434
|
return this.accessControl;
|
|
1394
1435
|
}
|
|
1436
|
+
// ============================================================================
|
|
1437
|
+
// QUIC Integration (Optional, opt-in feature)
|
|
1438
|
+
// ============================================================================
|
|
1439
|
+
/**
|
|
1440
|
+
* Enable AgentDB for distributed memory synchronization
|
|
1441
|
+
*
|
|
1442
|
+
* @param config - AgentDB configuration (optional, uses defaults if not provided)
|
|
1443
|
+
*/
|
|
1444
|
+
async enableAgentDB(config) {
|
|
1445
|
+
if (this.agentDBManager) {
|
|
1446
|
+
throw new Error('AgentDB already enabled');
|
|
1447
|
+
}
|
|
1448
|
+
const fullConfig = {
|
|
1449
|
+
dbPath: config?.dbPath || './data/agentdb',
|
|
1450
|
+
enableQUICSync: config?.enableQUICSync !== false,
|
|
1451
|
+
syncPort: config?.syncPort || 4433,
|
|
1452
|
+
syncPeers: config?.syncPeers || [],
|
|
1453
|
+
enableLearning: config?.enableLearning !== false,
|
|
1454
|
+
enableReasoning: config?.enableReasoning !== false,
|
|
1455
|
+
cacheSize: config?.cacheSize || 1000,
|
|
1456
|
+
quantizationType: config?.quantizationType || 'scalar'
|
|
1457
|
+
};
|
|
1458
|
+
this.agentDBManager = await (0, AgentDBManager_1.createAgentDBManager)(fullConfig);
|
|
1459
|
+
}
|
|
1460
|
+
/**
|
|
1461
|
+
* Disable AgentDB
|
|
1462
|
+
*/
|
|
1463
|
+
async disableAgentDB() {
|
|
1464
|
+
if (!this.agentDBManager) {
|
|
1465
|
+
return;
|
|
1466
|
+
}
|
|
1467
|
+
try {
|
|
1468
|
+
await this.agentDBManager.close();
|
|
1469
|
+
}
|
|
1470
|
+
finally {
|
|
1471
|
+
this.agentDBManager = null;
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
/**
|
|
1475
|
+
* Add peer for QUIC synchronization via AgentDB
|
|
1476
|
+
*
|
|
1477
|
+
* @param address - Peer IP address
|
|
1478
|
+
* @param port - Peer port number
|
|
1479
|
+
* @returns Peer ID
|
|
1480
|
+
*/
|
|
1481
|
+
async addQUICPeer(address, port) {
|
|
1482
|
+
if (!this.agentDBManager) {
|
|
1483
|
+
throw new Error('AgentDB not enabled. Call enableAgentDB() first.');
|
|
1484
|
+
}
|
|
1485
|
+
// AgentDB handles peer management internally via QUIC sync
|
|
1486
|
+
const peerId = `${address}:${port}`;
|
|
1487
|
+
return peerId;
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Remove peer from QUIC synchronization
|
|
1491
|
+
*
|
|
1492
|
+
* @param peerId - Peer ID to remove
|
|
1493
|
+
*/
|
|
1494
|
+
async removeQUICPeer(peerId) {
|
|
1495
|
+
if (!this.agentDBManager) {
|
|
1496
|
+
throw new Error('AgentDB not enabled');
|
|
1497
|
+
}
|
|
1498
|
+
// AgentDB handles peer management internally
|
|
1499
|
+
}
|
|
1500
|
+
/**
|
|
1501
|
+
* Get QUIC performance metrics
|
|
1502
|
+
*
|
|
1503
|
+
* @returns Performance metrics or null if not enabled
|
|
1504
|
+
*/
|
|
1505
|
+
getQUICMetrics() {
|
|
1506
|
+
if (!this.agentDBManager) {
|
|
1507
|
+
return null;
|
|
1508
|
+
}
|
|
1509
|
+
// AgentDB provides metrics through different API
|
|
1510
|
+
return null;
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* Get list of connected QUIC peers
|
|
1514
|
+
*
|
|
1515
|
+
* @returns Array of peer information or empty array if not enabled
|
|
1516
|
+
*/
|
|
1517
|
+
getQUICPeers() {
|
|
1518
|
+
if (!this.agentDBManager) {
|
|
1519
|
+
return [];
|
|
1520
|
+
}
|
|
1521
|
+
// AgentDB handles peer discovery internally
|
|
1522
|
+
return [];
|
|
1523
|
+
}
|
|
1524
|
+
/**
|
|
1525
|
+
* Check if QUIC integration is enabled
|
|
1526
|
+
*
|
|
1527
|
+
* @returns True if AgentDB is enabled with QUIC sync
|
|
1528
|
+
*/
|
|
1529
|
+
isQUICEnabled() {
|
|
1530
|
+
return this.agentDBManager !== null;
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Get memory entries modified since timestamp (for QUIC sync)
|
|
1534
|
+
*
|
|
1535
|
+
* @param since - Timestamp to get entries modified after
|
|
1536
|
+
* @param partition - Optional partition filter
|
|
1537
|
+
* @returns Array of modified entries with metadata
|
|
1538
|
+
*/
|
|
1539
|
+
async getModifiedEntries(since, partition) {
|
|
1540
|
+
if (!this.db) {
|
|
1541
|
+
throw new Error('Memory manager not initialized');
|
|
1542
|
+
}
|
|
1543
|
+
let query = `
|
|
1544
|
+
SELECT key, value, partition, created_at, expires_at, owner, access_level, team_id, swarm_id
|
|
1545
|
+
FROM memory_entries
|
|
1546
|
+
WHERE created_at > ?
|
|
1547
|
+
`;
|
|
1548
|
+
const params = [since];
|
|
1549
|
+
if (partition) {
|
|
1550
|
+
query += ` AND partition = ?`;
|
|
1551
|
+
params.push(partition);
|
|
1552
|
+
}
|
|
1553
|
+
query += ` ORDER BY created_at ASC`;
|
|
1554
|
+
const rows = await this.queryAll(query, params);
|
|
1555
|
+
return rows.map((row) => ({
|
|
1556
|
+
key: row.key,
|
|
1557
|
+
value: JSON.parse(row.value),
|
|
1558
|
+
partition: row.partition,
|
|
1559
|
+
createdAt: row.created_at,
|
|
1560
|
+
expiresAt: row.expires_at,
|
|
1561
|
+
owner: row.owner,
|
|
1562
|
+
accessLevel: row.access_level,
|
|
1563
|
+
teamId: row.team_id,
|
|
1564
|
+
swarmId: row.swarm_id
|
|
1565
|
+
}));
|
|
1566
|
+
}
|
|
1567
|
+
/**
|
|
1568
|
+
* Get last modification timestamp for an entry
|
|
1569
|
+
*
|
|
1570
|
+
* @param key - Entry key
|
|
1571
|
+
* @param partition - Entry partition
|
|
1572
|
+
* @returns Timestamp or undefined if not tracked
|
|
1573
|
+
*/
|
|
1574
|
+
getLastModified(key, partition = 'default') {
|
|
1575
|
+
const entryKey = `${partition}:${key}`;
|
|
1576
|
+
return this.lastModifiedTimestamps.get(entryKey);
|
|
1577
|
+
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Get AgentDB manager instance (for advanced usage)
|
|
1580
|
+
*
|
|
1581
|
+
* @returns AgentDBManager instance or null if not enabled
|
|
1582
|
+
*/
|
|
1583
|
+
getAgentDBManager() {
|
|
1584
|
+
return this.agentDBManager;
|
|
1585
|
+
}
|
|
1395
1586
|
}
|
|
1396
1587
|
exports.SwarmMemoryManager = SwarmMemoryManager;
|
|
1397
1588
|
//# sourceMappingURL=SwarmMemoryManager.js.map
|