agentic-qe 1.1.0 → 1.3.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-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 +64 -25
- package/.claude/skills/README.md +124 -0
- package/.claude/skills/accessibility-testing/SKILL.md +777 -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/chaos-engineering-resilience/SKILL.md +109 -0
- package/.claude/skills/code-review-quality/SKILL.md +683 -0
- package/.claude/skills/compatibility-testing/SKILL.md +101 -0
- package/.claude/skills/compliance-testing/SKILL.md +162 -0
- package/.claude/skills/consultancy-practices/SKILL.md +540 -0
- package/.claude/skills/context-driven-testing/SKILL.md +466 -0
- package/.claude/skills/contract-testing/SKILL.md +193 -0
- package/.claude/skills/database-testing/SKILL.md +243 -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/localization-testing/SKILL.md +115 -0
- package/.claude/skills/mobile-testing/SKILL.md +548 -0
- package/.claude/skills/mutation-testing/SKILL.md +129 -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/regression-testing/SKILL.md +1045 -0
- package/.claude/skills/risk-based-testing/SKILL.md +721 -0
- package/.claude/skills/security-testing/SKILL.md +651 -0
- package/.claude/skills/shift-left-testing/SKILL.md +535 -0
- package/.claude/skills/shift-right-testing/SKILL.md +591 -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/test-data-management/SKILL.md +1067 -0
- package/.claude/skills/test-design-techniques/SKILL.md +160 -0
- package/.claude/skills/test-environment-management/SKILL.md +204 -0
- package/.claude/skills/test-reporting-analytics/SKILL.md +143 -0
- package/.claude/skills/verification-quality/SKILL.md +649 -0
- package/.claude/skills/visual-testing-advanced/SKILL.md +148 -0
- package/.claude/skills/xp-practices/SKILL.md +671 -0
- package/.claude/statusline-command.sh +176 -0
- package/CHANGELOG.md +623 -6
- package/README.md +101 -5
- 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 +16 -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 +387 -5
- package/dist/agents/BaseAgent.js.map +1 -1
- package/dist/agents/CoverageAnalyzerAgent.d.ts +13 -2
- package/dist/agents/CoverageAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/CoverageAnalyzerAgent.js +112 -12
- 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 +28 -0
- package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -1
- package/dist/agents/FlakyTestHunterAgent.js +160 -4
- package/dist/agents/FlakyTestHunterAgent.js.map +1 -1
- package/dist/agents/FleetCommanderAgent.d.ts.map +1 -1
- package/dist/agents/FleetCommanderAgent.js +4 -3
- package/dist/agents/FleetCommanderAgent.js.map +1 -1
- package/dist/agents/LearningAgent.d.ts +14 -5
- package/dist/agents/LearningAgent.d.ts.map +1 -1
- package/dist/agents/LearningAgent.js +36 -16
- package/dist/agents/LearningAgent.js.map +1 -1
- 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 +11 -9
- package/dist/agents/PerformanceTesterAgent.js.map +1 -1
- package/dist/agents/ProductionIntelligenceAgent.d.ts.map +1 -1
- package/dist/agents/ProductionIntelligenceAgent.js +14 -13
- package/dist/agents/ProductionIntelligenceAgent.js.map +1 -1
- package/dist/agents/QualityAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/QualityAnalyzerAgent.js +39 -38
- package/dist/agents/QualityAnalyzerAgent.js.map +1 -1
- package/dist/agents/QualityGateAgent.d.ts.map +1 -1
- package/dist/agents/QualityGateAgent.js +7 -6
- package/dist/agents/QualityGateAgent.js.map +1 -1
- package/dist/agents/RegressionRiskAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/RegressionRiskAnalyzerAgent.js +22 -21
- 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.d.ts.map +1 -1
- package/dist/agents/SecurityScannerAgent.js +8 -7
- package/dist/agents/SecurityScannerAgent.js.map +1 -1
- package/dist/agents/TestDataArchitectAgent.d.ts.map +1 -1
- package/dist/agents/TestDataArchitectAgent.js +12 -11
- package/dist/agents/TestDataArchitectAgent.js.map +1 -1
- package/dist/agents/TestExecutorAgent.d.ts.map +1 -1
- package/dist/agents/TestExecutorAgent.js +18 -19
- package/dist/agents/TestExecutorAgent.js.map +1 -1
- package/dist/agents/TestGeneratorAgent.d.ts +15 -4
- package/dist/agents/TestGeneratorAgent.d.ts.map +1 -1
- package/dist/agents/TestGeneratorAgent.js +172 -49
- package/dist/agents/TestGeneratorAgent.js.map +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -1
- package/dist/agents/index.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/benchmark.d.ts.map +1 -1
- package/dist/cli/commands/agent/benchmark.js +2 -1
- package/dist/cli/commands/agent/benchmark.js.map +1 -1
- 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 +84 -0
- package/dist/cli/commands/agent/spawn.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -1
- package/dist/cli/commands/analyze.js +2 -1
- package/dist/cli/commands/analyze.js.map +1 -1
- package/dist/cli/commands/config/list.d.ts.map +1 -1
- package/dist/cli/commands/config/list.js +2 -1
- package/dist/cli/commands/config/list.js.map +1 -1
- package/dist/cli/commands/config/set.d.ts +7 -0
- package/dist/cli/commands/config/set.d.ts.map +1 -1
- package/dist/cli/commands/config/set.js +35 -4
- package/dist/cli/commands/config/set.js.map +1 -1
- package/dist/cli/commands/fleet/logs.d.ts.map +1 -1
- package/dist/cli/commands/fleet/logs.js +2 -1
- package/dist/cli/commands/fleet/logs.js.map +1 -1
- package/dist/cli/commands/fleet/metrics.d.ts.map +1 -1
- package/dist/cli/commands/fleet/metrics.js +2 -1
- package/dist/cli/commands/fleet/metrics.js.map +1 -1
- package/dist/cli/commands/fleet/monitor.d.ts.map +1 -1
- package/dist/cli/commands/fleet/monitor.js +7 -5
- package/dist/cli/commands/fleet/monitor.js.map +1 -1
- package/dist/cli/commands/fleet.d.ts.map +1 -1
- package/dist/cli/commands/fleet.js +2 -1
- package/dist/cli/commands/fleet.js.map +1 -1
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +2 -1
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/improve/index.d.ts.map +1 -1
- package/dist/cli/commands/improve/index.js +12 -11
- package/dist/cli/commands/improve/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +24 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +503 -11
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/learn/index.d.ts.map +1 -1
- package/dist/cli/commands/learn/index.js +13 -12
- package/dist/cli/commands/learn/index.js.map +1 -1
- package/dist/cli/commands/monitor/alerts.d.ts.map +1 -1
- package/dist/cli/commands/monitor/alerts.js +2 -1
- package/dist/cli/commands/monitor/alerts.js.map +1 -1
- package/dist/cli/commands/patterns/index.d.ts.map +1 -1
- package/dist/cli/commands/patterns/index.js +20 -19
- package/dist/cli/commands/patterns/index.js.map +1 -1
- package/dist/cli/commands/quality/decision.d.ts.map +1 -1
- package/dist/cli/commands/quality/decision.js +9 -7
- package/dist/cli/commands/quality/decision.js.map +1 -1
- package/dist/cli/commands/quality/gate.d.ts.map +1 -1
- package/dist/cli/commands/quality/gate.js +10 -8
- package/dist/cli/commands/quality/gate.js.map +1 -1
- package/dist/cli/commands/quality/policy.d.ts.map +1 -1
- package/dist/cli/commands/quality/policy.js +10 -8
- package/dist/cli/commands/quality/policy.js.map +1 -1
- package/dist/cli/commands/quality/risk.d.ts.map +1 -1
- package/dist/cli/commands/quality/risk.js +5 -3
- package/dist/cli/commands/quality/risk.js.map +1 -1
- package/dist/cli/commands/quality/validate.d.ts.map +1 -1
- package/dist/cli/commands/quality/validate.js +10 -8
- package/dist/cli/commands/quality/validate.js.map +1 -1
- package/dist/cli/commands/quantization.d.ts +6 -0
- package/dist/cli/commands/quantization.d.ts.map +1 -0
- package/dist/cli/commands/quantization.js +188 -0
- package/dist/cli/commands/quantization.js.map +1 -0
- package/dist/cli/commands/routing/index.d.ts +0 -6
- package/dist/cli/commands/routing/index.d.ts.map +1 -1
- package/dist/cli/commands/routing/index.js +17 -16
- package/dist/cli/commands/routing/index.js.map +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +2 -1
- package/dist/cli/commands/run.js.map +1 -1
- 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 +365 -0
- package/dist/cli/commands/skills/index.js.map +1 -0
- package/dist/cli/commands/test/debug.d.ts.map +1 -1
- package/dist/cli/commands/test/debug.js +2 -1
- package/dist/cli/commands/test/debug.js.map +1 -1
- package/dist/cli/commands/test/mutate.d.ts.map +1 -1
- package/dist/cli/commands/test/mutate.js +2 -1
- package/dist/cli/commands/test/mutate.js.map +1 -1
- package/dist/cli/commands/test/parallel.d.ts.map +1 -1
- package/dist/cli/commands/test/parallel.js +6 -4
- package/dist/cli/commands/test/parallel.js.map +1 -1
- package/dist/cli/commands/test/profile.d.ts.map +1 -1
- package/dist/cli/commands/test/profile.js +3 -2
- package/dist/cli/commands/test/profile.js.map +1 -1
- package/dist/cli/commands/test/queue.d.ts.map +1 -1
- package/dist/cli/commands/test/queue.js +2 -1
- package/dist/cli/commands/test/queue.js.map +1 -1
- package/dist/cli/commands/test/retry.d.ts.map +1 -1
- package/dist/cli/commands/test/retry.js +6 -4
- package/dist/cli/commands/test/retry.js.map +1 -1
- package/dist/cli/commands/test/trace.d.ts.map +1 -1
- package/dist/cli/commands/test/trace.js +2 -1
- package/dist/cli/commands/test/trace.js.map +1 -1
- package/dist/cli/commands/test/watch.d.ts.map +1 -1
- package/dist/cli/commands/test/watch.js +3 -2
- package/dist/cli/commands/test/watch.js.map +1 -1
- package/dist/cli/commands/workflow/cancel.d.ts.map +1 -1
- package/dist/cli/commands/workflow/cancel.js +2 -1
- package/dist/cli/commands/workflow/cancel.js.map +1 -1
- package/dist/cli/index-working.js +9 -8
- package/dist/cli/index-working.js.map +1 -1
- package/dist/cli/index.js +97 -1
- 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/coordination/OODACoordination.d.ts.map +1 -1
- package/dist/core/coordination/OODACoordination.js +2 -1
- package/dist/core/coordination/OODACoordination.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 +246 -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 +231 -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 +77 -0
- package/dist/core/memory/ReasoningBankAdapter.js.map +1 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts +75 -3
- package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.js +240 -55
- 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 +544 -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/quantization/QuantizationManager.d.ts +83 -0
- package/dist/core/quantization/QuantizationManager.d.ts.map +1 -0
- package/dist/core/quantization/QuantizationManager.js +264 -0
- package/dist/core/quantization/QuantizationManager.js.map +1 -0
- package/dist/core/quantization/index.d.ts +5 -0
- package/dist/core/quantization/index.d.ts.map +1 -0
- package/dist/core/quantization/index.js +9 -0
- package/dist/core/quantization/index.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/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/FlakyPredictionModel.d.ts +11 -1
- package/dist/learning/FlakyPredictionModel.d.ts.map +1 -1
- package/dist/learning/FlakyPredictionModel.js +82 -35
- package/dist/learning/FlakyPredictionModel.js.map +1 -1
- package/dist/learning/FlakyTestDetector.d.ts +9 -0
- package/dist/learning/FlakyTestDetector.d.ts.map +1 -1
- package/dist/learning/FlakyTestDetector.js +28 -6
- package/dist/learning/FlakyTestDetector.js.map +1 -1
- package/dist/learning/ImprovementLoop.d.ts +16 -2
- package/dist/learning/ImprovementLoop.d.ts.map +1 -1
- package/dist/learning/ImprovementLoop.js +67 -8
- package/dist/learning/ImprovementLoop.js.map +1 -1
- 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/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/index.d.ts +13 -7
- package/dist/learning/index.d.ts.map +1 -1
- package/dist/learning/index.js +27 -11
- package/dist/learning/index.js.map +1 -1
- package/dist/learning/types.d.ts +1 -0
- package/dist/learning/types.d.ts.map +1 -1
- package/dist/learning/types.js +16 -0
- package/dist/learning/types.js.map +1 -1
- 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/advanced/mutation-test-execute.d.ts +3 -3
- package/dist/mcp/handlers/advanced/mutation-test-execute.d.ts.map +1 -1
- package/dist/mcp/handlers/advanced/mutation-test-execute.js +5 -4
- package/dist/mcp/handlers/advanced/mutation-test-execute.js.map +1 -1
- package/dist/mcp/handlers/agent-spawn.d.ts.map +1 -1
- package/dist/mcp/handlers/agent-spawn.js +2 -1
- package/dist/mcp/handlers/agent-spawn.js.map +1 -1
- package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.js +9 -8
- package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.js.map +1 -1
- package/dist/mcp/handlers/analysis/coverageGapsDetect.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/coverageGapsDetect.js +6 -5
- package/dist/mcp/handlers/analysis/coverageGapsDetect.js.map +1 -1
- package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js +5 -4
- package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js.map +1 -1
- package/dist/mcp/handlers/analysis/performanceBenchmarkRun.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/performanceBenchmarkRun.js +8 -7
- package/dist/mcp/handlers/analysis/performanceBenchmarkRun.js.map +1 -1
- package/dist/mcp/handlers/analysis/performanceMonitorRealtime.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/performanceMonitorRealtime.js +7 -6
- package/dist/mcp/handlers/analysis/performanceMonitorRealtime.js.map +1 -1
- package/dist/mcp/handlers/analysis/securityScanComprehensive.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/securityScanComprehensive.js +18 -21
- package/dist/mcp/handlers/analysis/securityScanComprehensive.js.map +1 -1
- package/dist/mcp/handlers/base-handler.d.ts.map +1 -1
- package/dist/mcp/handlers/base-handler.js +2 -9
- package/dist/mcp/handlers/base-handler.js.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-failure.d.ts.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-failure.js +4 -3
- package/dist/mcp/handlers/chaos/chaos-inject-failure.js.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-latency.d.ts.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-latency.js +6 -5
- package/dist/mcp/handlers/chaos/chaos-inject-latency.js.map +1 -1
- package/dist/mcp/handlers/coordination/event-emit.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/event-emit.js +2 -1
- package/dist/mcp/handlers/coordination/event-emit.js.map +1 -1
- package/dist/mcp/handlers/coordination/event-subscribe.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/event-subscribe.js +2 -1
- package/dist/mcp/handlers/coordination/event-subscribe.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-checkpoint.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-checkpoint.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-checkpoint.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-create.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-create.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-create.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-execute.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-execute.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-execute.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-resume.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-resume.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-resume.js.map +1 -1
- package/dist/mcp/handlers/fleet-init.d.ts.map +1 -1
- package/dist/mcp/handlers/fleet-init.js +2 -1
- package/dist/mcp/handlers/fleet-init.js.map +1 -1
- package/dist/mcp/handlers/fleet-status.d.ts.map +1 -1
- package/dist/mcp/handlers/fleet-status.js +31 -30
- package/dist/mcp/handlers/fleet-status.js.map +1 -1
- package/dist/mcp/handlers/integration/dependency-check.d.ts.map +1 -1
- package/dist/mcp/handlers/integration/dependency-check.js +3 -2
- package/dist/mcp/handlers/integration/dependency-check.js.map +1 -1
- package/dist/mcp/handlers/integration/integration-test-orchestrate.d.ts.map +1 -1
- package/dist/mcp/handlers/integration/integration-test-orchestrate.js +2 -1
- package/dist/mcp/handlers/integration/integration-test-orchestrate.js.map +1 -1
- package/dist/mcp/handlers/optimize-tests.d.ts.map +1 -1
- package/dist/mcp/handlers/optimize-tests.js +33 -32
- package/dist/mcp/handlers/optimize-tests.js.map +1 -1
- package/dist/mcp/handlers/predict-defects.d.ts.map +1 -1
- package/dist/mcp/handlers/predict-defects.js +46 -45
- package/dist/mcp/handlers/predict-defects.js.map +1 -1
- package/dist/mcp/handlers/prediction/deployment-readiness-check.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/deployment-readiness-check.js +24 -23
- package/dist/mcp/handlers/prediction/deployment-readiness-check.js.map +1 -1
- package/dist/mcp/handlers/prediction/predict-defects-ai.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/predict-defects-ai.js +10 -9
- package/dist/mcp/handlers/prediction/predict-defects-ai.js.map +1 -1
- package/dist/mcp/handlers/prediction/regression-risk-analyze.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/regression-risk-analyze.js +10 -9
- package/dist/mcp/handlers/prediction/regression-risk-analyze.js.map +1 -1
- package/dist/mcp/handlers/prediction/visual-test-regression.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/visual-test-regression.js +7 -6
- package/dist/mcp/handlers/prediction/visual-test-regression.js.map +1 -1
- package/dist/mcp/handlers/quality-analyze.d.ts.map +1 -1
- package/dist/mcp/handlers/quality-analyze.js +53 -52
- package/dist/mcp/handlers/quality-analyze.js.map +1 -1
- package/dist/mcp/handlers/task-orchestrate.d.ts.map +1 -1
- package/dist/mcp/handlers/task-orchestrate.js +19 -18
- package/dist/mcp/handlers/task-orchestrate.js.map +1 -1
- package/dist/mcp/handlers/test/test-execute-parallel.d.ts.map +1 -1
- package/dist/mcp/handlers/test/test-execute-parallel.js +7 -6
- package/dist/mcp/handlers/test/test-execute-parallel.js.map +1 -1
- package/dist/mcp/handlers/test/test-generate-enhanced.d.ts.map +1 -1
- package/dist/mcp/handlers/test/test-generate-enhanced.js +2 -1
- package/dist/mcp/handlers/test/test-generate-enhanced.js.map +1 -1
- package/dist/mcp/handlers/test/test-optimize-sublinear.d.ts.map +1 -1
- package/dist/mcp/handlers/test/test-optimize-sublinear.js +3 -2
- package/dist/mcp/handlers/test/test-optimize-sublinear.js.map +1 -1
- package/dist/mcp/handlers/test-execute.d.ts.map +1 -1
- package/dist/mcp/handlers/test-execute.js +11 -10
- package/dist/mcp/handlers/test-execute.js.map +1 -1
- package/dist/mcp/handlers/test-generate.d.ts.map +1 -1
- package/dist/mcp/handlers/test-generate.js +4 -3
- package/dist/mcp/handlers/test-generate.js.map +1 -1
- package/dist/mcp/server.d.ts +4 -4
- package/dist/mcp/services/AgentRegistry.d.ts.map +1 -1
- package/dist/mcp/services/AgentRegistry.js +9 -2
- package/dist/mcp/services/AgentRegistry.js.map +1 -1
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.d.ts.map +1 -1
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js +10 -9
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js.map +1 -1
- package/dist/mcp/streaming/StreamingMCPTool.d.ts.map +1 -1
- package/dist/mcp/streaming/StreamingMCPTool.js +2 -1
- package/dist/mcp/streaming/StreamingMCPTool.js.map +1 -1
- package/dist/mcp/streaming/TestExecuteStreamHandler.d.ts.map +1 -1
- package/dist/mcp/streaming/TestExecuteStreamHandler.js +6 -5
- package/dist/mcp/streaming/TestExecuteStreamHandler.js.map +1 -1
- package/dist/reasoning/TestTemplateCreator.d.ts +10 -2
- package/dist/reasoning/TestTemplateCreator.d.ts.map +1 -1
- package/dist/reasoning/TestTemplateCreator.js +81 -21
- package/dist/reasoning/TestTemplateCreator.js.map +1 -1
- 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 +37 -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 +39 -3
- package/dist/types/pattern.types.d.ts.map +1 -1
- 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 +3 -3
- 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/dist/utils/ProcessExit.d.ts +23 -0
- package/dist/utils/ProcessExit.d.ts.map +1 -0
- package/dist/utils/ProcessExit.js +40 -0
- package/dist/utils/ProcessExit.js.map +1 -0
- package/dist/utils/SecureRandom.d.ts +171 -0
- package/dist/utils/SecureRandom.d.ts.map +1 -0
- package/dist/utils/SecureRandom.js +229 -0
- package/dist/utils/SecureRandom.js.map +1 -0
- package/dist/utils/SecureUrlValidator.d.ts +167 -0
- package/dist/utils/SecureUrlValidator.d.ts.map +1 -0
- package/dist/utils/SecureUrlValidator.js +306 -0
- package/dist/utils/SecureUrlValidator.js.map +1 -0
- package/dist/utils/SecureValidation.d.ts +131 -0
- package/dist/utils/SecureValidation.d.ts.map +1 -0
- package/dist/utils/SecureValidation.js +265 -0
- package/dist/utils/SecureValidation.js.map +1 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +5 -4
- package/dist/utils/validation.js.map +1 -1
- package/package.json +31 -8
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secure Random Utility
|
|
3
|
+
*
|
|
4
|
+
* Provides cryptographically secure random number generation.
|
|
5
|
+
* Replaces insecure SecureRandom.randomFloat() with crypto.randomBytes() and crypto.randomInt().
|
|
6
|
+
*
|
|
7
|
+
* Security: Uses Node.js crypto module for CSPRNG (Cryptographically Secure
|
|
8
|
+
* Pseudo-Random Number Generator)
|
|
9
|
+
*
|
|
10
|
+
* @module utils/SecureRandom
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Secure random number generator
|
|
14
|
+
*
|
|
15
|
+
* Security Fixes (Alerts #1-13): Replaces SecureRandom.randomFloat() with crypto module
|
|
16
|
+
* Previous vulnerability: SecureRandom.randomFloat() is predictable and unsuitable for security
|
|
17
|
+
* New approach: Uses crypto.randomBytes() and crypto.randomInt() for CSPRNG
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Generate secure random ID
|
|
22
|
+
* const id = SecureRandom.generateId(); // "a3f2b91c4d5e6f78..."
|
|
23
|
+
*
|
|
24
|
+
* // Generate random integer
|
|
25
|
+
* const roll = SecureRandom.randomInt(1, 7); // 1-6 (dice roll)
|
|
26
|
+
*
|
|
27
|
+
* // Generate random float
|
|
28
|
+
* const probability = SecureRandom.randomFloat(); // 0.0-1.0
|
|
29
|
+
*
|
|
30
|
+
* // Generate UUID
|
|
31
|
+
* const uuid = SecureRandom.uuid(); // "550e8400-e29b-41d4-a716-446655440000"
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class SecureRandom {
|
|
35
|
+
/**
|
|
36
|
+
* Generate cryptographically secure random ID (hex string)
|
|
37
|
+
*
|
|
38
|
+
* @param length Byte length (default: 16 bytes = 32 hex characters)
|
|
39
|
+
* @returns Hex-encoded random string
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const id = SecureRandom.generateId(); // "a3f2b91c4d5e6f7890abcdef12345678"
|
|
44
|
+
* const shortId = SecureRandom.generateId(8); // "a3f2b91c4d5e6f78"
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
static generateId(length?: number): string;
|
|
48
|
+
/**
|
|
49
|
+
* Generate cryptographically secure random integer
|
|
50
|
+
*
|
|
51
|
+
* @param min Minimum value (inclusive)
|
|
52
|
+
* @param max Maximum value (exclusive)
|
|
53
|
+
* @returns Random integer in range [min, max)
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const diceRoll = SecureRandom.randomInt(1, 7); // 1-6
|
|
58
|
+
* const randomPercent = SecureRandom.randomInt(0, 101); // 0-100
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
static randomInt(min: number, max: number): number;
|
|
62
|
+
/**
|
|
63
|
+
* Generate cryptographically secure random float between 0 and 1
|
|
64
|
+
*
|
|
65
|
+
* @param precision Decimal precision (default: 6)
|
|
66
|
+
* @returns Random float in range [0.0, 1.0)
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const probability = SecureRandom.randomFloat(); // 0.543210
|
|
71
|
+
* const highPrecision = SecureRandom.randomFloat(10); // 0.5432109876
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
static randomFloat(precision?: number): number;
|
|
75
|
+
/**
|
|
76
|
+
* Generate RFC4122 v4 UUID
|
|
77
|
+
*
|
|
78
|
+
* @returns UUID string
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const id = SecureRandom.uuid(); // "550e8400-e29b-41d4-a716-446655440000"
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
static uuid(): string;
|
|
86
|
+
/**
|
|
87
|
+
* Generate random string with custom alphabet
|
|
88
|
+
*
|
|
89
|
+
* @param length String length
|
|
90
|
+
* @param alphabet Character set (default: alphanumeric)
|
|
91
|
+
* @returns Random string
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* // Alphanumeric
|
|
96
|
+
* const code = SecureRandom.randomString(8); // "a3F2b91C"
|
|
97
|
+
*
|
|
98
|
+
* // Custom alphabet
|
|
99
|
+
* const hexCode = SecureRandom.randomString(8, '0123456789ABCDEF'); // "A3F2B91C"
|
|
100
|
+
* const pin = SecureRandom.randomString(4, '0123456789'); // "5432"
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
static randomString(length: number, alphabet?: string): string;
|
|
104
|
+
/**
|
|
105
|
+
* Generate random boolean with optional bias
|
|
106
|
+
*
|
|
107
|
+
* @param trueProbability Probability of true (0.0-1.0, default: 0.5)
|
|
108
|
+
* @returns Random boolean
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const coinFlip = SecureRandom.randomBoolean(); // 50/50
|
|
113
|
+
* const biasedCoin = SecureRandom.randomBoolean(0.7); // 70% true, 30% false
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
static randomBoolean(trueProbability?: number): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Shuffle array using Fisher-Yates algorithm with secure randomness
|
|
119
|
+
*
|
|
120
|
+
* @param array Array to shuffle (in-place)
|
|
121
|
+
* @returns Shuffled array
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* const deck = [1, 2, 3, 4, 5];
|
|
126
|
+
* SecureRandom.shuffle(deck); // [3, 1, 5, 2, 4]
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
static shuffle<T>(array: T[]): T[];
|
|
130
|
+
/**
|
|
131
|
+
* Select random element from array
|
|
132
|
+
*
|
|
133
|
+
* @param array Array to select from
|
|
134
|
+
* @returns Random element
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const colors = ['red', 'green', 'blue'];
|
|
139
|
+
* const color = SecureRandom.choice(colors); // "green"
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
static choice<T>(array: T[]): T;
|
|
143
|
+
/**
|
|
144
|
+
* Select multiple random elements from array (without replacement)
|
|
145
|
+
*
|
|
146
|
+
* @param array Array to select from
|
|
147
|
+
* @param count Number of elements to select
|
|
148
|
+
* @returns Array of random elements
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
153
|
+
* const lottery = SecureRandom.sample(numbers, 3); // [7, 2, 9]
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
static sample<T>(array: T[], count: number): T[];
|
|
157
|
+
/**
|
|
158
|
+
* Generate random bytes as Buffer
|
|
159
|
+
*
|
|
160
|
+
* @param size Number of bytes
|
|
161
|
+
* @returns Buffer containing random bytes
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* const key = SecureRandom.bytes(32); // 256-bit key
|
|
166
|
+
* const iv = SecureRandom.bytes(16); // 128-bit IV
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
static bytes(size: number): Buffer;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=SecureRandom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecureRandom.d.ts","sourceRoot":"","sources":["../../src/utils/SecureRandom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,YAAY;IACvB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM;IAI9C;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAOlD;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,WAAW,CAAC,SAAS,GAAE,MAAU,GAAG,MAAM;IAMjD;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,IAAI,MAAM;IAIrB;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,YAAY,CACjB,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAyE,GAClF,MAAM;IAWT;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,aAAa,CAAC,eAAe,GAAE,MAAY,GAAG,OAAO;IAO5D;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE;IAQlC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC;IAO/B;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE;IAoBhD;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGnC"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Secure Random Utility
|
|
4
|
+
*
|
|
5
|
+
* Provides cryptographically secure random number generation.
|
|
6
|
+
* Replaces insecure SecureRandom.randomFloat() with crypto.randomBytes() and crypto.randomInt().
|
|
7
|
+
*
|
|
8
|
+
* Security: Uses Node.js crypto module for CSPRNG (Cryptographically Secure
|
|
9
|
+
* Pseudo-Random Number Generator)
|
|
10
|
+
*
|
|
11
|
+
* @module utils/SecureRandom
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.SecureRandom = void 0;
|
|
15
|
+
const crypto_1 = require("crypto");
|
|
16
|
+
/**
|
|
17
|
+
* Secure random number generator
|
|
18
|
+
*
|
|
19
|
+
* Security Fixes (Alerts #1-13): Replaces SecureRandom.randomFloat() with crypto module
|
|
20
|
+
* Previous vulnerability: SecureRandom.randomFloat() is predictable and unsuitable for security
|
|
21
|
+
* New approach: Uses crypto.randomBytes() and crypto.randomInt() for CSPRNG
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Generate secure random ID
|
|
26
|
+
* const id = SecureRandom.generateId(); // "a3f2b91c4d5e6f78..."
|
|
27
|
+
*
|
|
28
|
+
* // Generate random integer
|
|
29
|
+
* const roll = SecureRandom.randomInt(1, 7); // 1-6 (dice roll)
|
|
30
|
+
*
|
|
31
|
+
* // Generate random float
|
|
32
|
+
* const probability = SecureRandom.randomFloat(); // 0.0-1.0
|
|
33
|
+
*
|
|
34
|
+
* // Generate UUID
|
|
35
|
+
* const uuid = SecureRandom.uuid(); // "550e8400-e29b-41d4-a716-446655440000"
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
class SecureRandom {
|
|
39
|
+
/**
|
|
40
|
+
* Generate cryptographically secure random ID (hex string)
|
|
41
|
+
*
|
|
42
|
+
* @param length Byte length (default: 16 bytes = 32 hex characters)
|
|
43
|
+
* @returns Hex-encoded random string
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const id = SecureRandom.generateId(); // "a3f2b91c4d5e6f7890abcdef12345678"
|
|
48
|
+
* const shortId = SecureRandom.generateId(8); // "a3f2b91c4d5e6f78"
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
static generateId(length = 16) {
|
|
52
|
+
return (0, crypto_1.randomBytes)(length).toString('hex');
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Generate cryptographically secure random integer
|
|
56
|
+
*
|
|
57
|
+
* @param min Minimum value (inclusive)
|
|
58
|
+
* @param max Maximum value (exclusive)
|
|
59
|
+
* @returns Random integer in range [min, max)
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const diceRoll = SecureRandom.randomInt(1, 7); // 1-6
|
|
64
|
+
* const randomPercent = SecureRandom.randomInt(0, 101); // 0-100
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
static randomInt(min, max) {
|
|
68
|
+
if (min >= max) {
|
|
69
|
+
throw new Error(`Invalid range: min (${min}) must be less than max (${max})`);
|
|
70
|
+
}
|
|
71
|
+
return (0, crypto_1.randomInt)(min, max);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Generate cryptographically secure random float between 0 and 1
|
|
75
|
+
*
|
|
76
|
+
* @param precision Decimal precision (default: 6)
|
|
77
|
+
* @returns Random float in range [0.0, 1.0)
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const probability = SecureRandom.randomFloat(); // 0.543210
|
|
82
|
+
* const highPrecision = SecureRandom.randomFloat(10); // 0.5432109876
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
static randomFloat(precision = 6) {
|
|
86
|
+
const max = Math.pow(10, precision);
|
|
87
|
+
const randomValue = (0, crypto_1.randomInt)(0, max);
|
|
88
|
+
return randomValue / max;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Generate RFC4122 v4 UUID
|
|
92
|
+
*
|
|
93
|
+
* @returns UUID string
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const id = SecureRandom.uuid(); // "550e8400-e29b-41d4-a716-446655440000"
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
static uuid() {
|
|
101
|
+
return (0, crypto_1.randomUUID)();
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Generate random string with custom alphabet
|
|
105
|
+
*
|
|
106
|
+
* @param length String length
|
|
107
|
+
* @param alphabet Character set (default: alphanumeric)
|
|
108
|
+
* @returns Random string
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* // Alphanumeric
|
|
113
|
+
* const code = SecureRandom.randomString(8); // "a3F2b91C"
|
|
114
|
+
*
|
|
115
|
+
* // Custom alphabet
|
|
116
|
+
* const hexCode = SecureRandom.randomString(8, '0123456789ABCDEF'); // "A3F2B91C"
|
|
117
|
+
* const pin = SecureRandom.randomString(4, '0123456789'); // "5432"
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
static randomString(length, alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') {
|
|
121
|
+
const bytes = (0, crypto_1.randomBytes)(length);
|
|
122
|
+
let result = '';
|
|
123
|
+
for (let i = 0; i < length; i++) {
|
|
124
|
+
result += alphabet[bytes[i] % alphabet.length];
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Generate random boolean with optional bias
|
|
130
|
+
*
|
|
131
|
+
* @param trueProbability Probability of true (0.0-1.0, default: 0.5)
|
|
132
|
+
* @returns Random boolean
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* const coinFlip = SecureRandom.randomBoolean(); // 50/50
|
|
137
|
+
* const biasedCoin = SecureRandom.randomBoolean(0.7); // 70% true, 30% false
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
static randomBoolean(trueProbability = 0.5) {
|
|
141
|
+
if (trueProbability < 0 || trueProbability > 1) {
|
|
142
|
+
throw new Error('Probability must be between 0 and 1');
|
|
143
|
+
}
|
|
144
|
+
return this.randomFloat() < trueProbability;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Shuffle array using Fisher-Yates algorithm with secure randomness
|
|
148
|
+
*
|
|
149
|
+
* @param array Array to shuffle (in-place)
|
|
150
|
+
* @returns Shuffled array
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* const deck = [1, 2, 3, 4, 5];
|
|
155
|
+
* SecureRandom.shuffle(deck); // [3, 1, 5, 2, 4]
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
static shuffle(array) {
|
|
159
|
+
for (let i = array.length - 1; i > 0; i--) {
|
|
160
|
+
const j = this.randomInt(0, i + 1);
|
|
161
|
+
[array[i], array[j]] = [array[j], array[i]];
|
|
162
|
+
}
|
|
163
|
+
return array;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Select random element from array
|
|
167
|
+
*
|
|
168
|
+
* @param array Array to select from
|
|
169
|
+
* @returns Random element
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* const colors = ['red', 'green', 'blue'];
|
|
174
|
+
* const color = SecureRandom.choice(colors); // "green"
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
static choice(array) {
|
|
178
|
+
if (array.length === 0) {
|
|
179
|
+
throw new Error('Cannot choose from empty array');
|
|
180
|
+
}
|
|
181
|
+
return array[this.randomInt(0, array.length)];
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Select multiple random elements from array (without replacement)
|
|
185
|
+
*
|
|
186
|
+
* @param array Array to select from
|
|
187
|
+
* @param count Number of elements to select
|
|
188
|
+
* @returns Array of random elements
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
193
|
+
* const lottery = SecureRandom.sample(numbers, 3); // [7, 2, 9]
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
static sample(array, count) {
|
|
197
|
+
if (count > array.length) {
|
|
198
|
+
throw new Error('Sample size cannot exceed array length');
|
|
199
|
+
}
|
|
200
|
+
if (count < 0) {
|
|
201
|
+
throw new Error('Sample size must be non-negative');
|
|
202
|
+
}
|
|
203
|
+
const copy = [...array];
|
|
204
|
+
const result = [];
|
|
205
|
+
for (let i = 0; i < count; i++) {
|
|
206
|
+
const index = this.randomInt(0, copy.length);
|
|
207
|
+
result.push(copy[index]);
|
|
208
|
+
copy.splice(index, 1);
|
|
209
|
+
}
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Generate random bytes as Buffer
|
|
214
|
+
*
|
|
215
|
+
* @param size Number of bytes
|
|
216
|
+
* @returns Buffer containing random bytes
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* const key = SecureRandom.bytes(32); // 256-bit key
|
|
221
|
+
* const iv = SecureRandom.bytes(16); // 128-bit IV
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
static bytes(size) {
|
|
225
|
+
return (0, crypto_1.randomBytes)(size);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
exports.SecureRandom = SecureRandom;
|
|
229
|
+
//# sourceMappingURL=SecureRandom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecureRandom.js","sourceRoot":"","sources":["../../src/utils/SecureRandom.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secure URL Validator - Native TypeScript Implementation
|
|
3
|
+
*
|
|
4
|
+
* A secure, zero-dependency URL validation utility using the WHATWG URL API
|
|
5
|
+
* to replace validator.js isURL() and avoid CVE-2025-56200.
|
|
6
|
+
*
|
|
7
|
+
* @module SecureUrlValidator
|
|
8
|
+
* @see CVE-2025-56200 - validator.js URL validation bypass vulnerability
|
|
9
|
+
*/
|
|
10
|
+
export interface UrlValidationOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Allowed URL protocols (e.g., ['http:', 'https:'])
|
|
13
|
+
* Default: ['http:', 'https:']
|
|
14
|
+
*/
|
|
15
|
+
allowedProtocols?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Whether to allow URLs with authentication (username:password@host)
|
|
18
|
+
* Default: false (for security)
|
|
19
|
+
*/
|
|
20
|
+
allowAuthentication?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to require a valid TLD (top-level domain)
|
|
23
|
+
* Default: true
|
|
24
|
+
*/
|
|
25
|
+
requireTld?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to allow localhost URLs
|
|
28
|
+
* Default: false (for production safety)
|
|
29
|
+
*/
|
|
30
|
+
allowLocalhost?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to allow IP addresses (IPv4/IPv6)
|
|
33
|
+
* Default: true
|
|
34
|
+
*/
|
|
35
|
+
allowIpAddress?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum URL length
|
|
38
|
+
* Default: 2048 (browser limit)
|
|
39
|
+
*/
|
|
40
|
+
maxLength?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Custom domain allowlist (if provided, only these domains are allowed)
|
|
43
|
+
*/
|
|
44
|
+
allowedDomains?: string[];
|
|
45
|
+
/**
|
|
46
|
+
* Custom domain blocklist (if provided, these domains are rejected)
|
|
47
|
+
*/
|
|
48
|
+
blockedDomains?: string[];
|
|
49
|
+
}
|
|
50
|
+
export interface UrlValidationResult {
|
|
51
|
+
/**
|
|
52
|
+
* Whether the URL is valid
|
|
53
|
+
*/
|
|
54
|
+
valid: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Error message if invalid
|
|
57
|
+
*/
|
|
58
|
+
error?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Parsed URL object if valid
|
|
61
|
+
*/
|
|
62
|
+
url?: URL;
|
|
63
|
+
/**
|
|
64
|
+
* Security warnings (non-fatal)
|
|
65
|
+
*/
|
|
66
|
+
warnings?: string[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Validates a URL string using the WHATWG URL API
|
|
70
|
+
*
|
|
71
|
+
* This is the secure replacement for validator.js isURL() function.
|
|
72
|
+
* It uses the native URL constructor which properly handles all edge cases
|
|
73
|
+
* and prevents the CVE-2025-56200 vulnerability.
|
|
74
|
+
*
|
|
75
|
+
* @param urlString - The URL string to validate
|
|
76
|
+
* @param options - Validation options
|
|
77
|
+
* @returns Validation result with details
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* // Basic validation
|
|
82
|
+
* const result = validateUrl('https://example.com');
|
|
83
|
+
* if (result.valid) {
|
|
84
|
+
* console.log('Valid URL:', result.url?.href);
|
|
85
|
+
* }
|
|
86
|
+
*
|
|
87
|
+
* // Strict validation for user input
|
|
88
|
+
* const strictResult = validateUrl(userInput, {
|
|
89
|
+
* allowedProtocols: ['https:'],
|
|
90
|
+
* requireTld: true,
|
|
91
|
+
* allowLocalhost: false,
|
|
92
|
+
* allowAuthentication: false,
|
|
93
|
+
* });
|
|
94
|
+
*
|
|
95
|
+
* // Custom domain allowlist
|
|
96
|
+
* const allowlistResult = validateUrl(url, {
|
|
97
|
+
* allowedDomains: ['example.com', 'trusted-site.org'],
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function validateUrl(urlString: string, options?: UrlValidationOptions): UrlValidationResult;
|
|
102
|
+
/**
|
|
103
|
+
* Simple boolean validation (for drop-in replacement of validator.isURL)
|
|
104
|
+
*
|
|
105
|
+
* @param urlString - The URL string to validate
|
|
106
|
+
* @param options - Validation options
|
|
107
|
+
* @returns true if valid, false otherwise
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* if (isValidUrl('https://example.com')) {
|
|
112
|
+
* // URL is valid
|
|
113
|
+
* }
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function isValidUrl(urlString: string, options?: UrlValidationOptions): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Sanitize URL by parsing and reconstructing it
|
|
119
|
+
* This ensures the URL is properly formatted and safe
|
|
120
|
+
*
|
|
121
|
+
* @param urlString - The URL string to sanitize
|
|
122
|
+
* @param options - Validation options
|
|
123
|
+
* @returns Sanitized URL string or null if invalid
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const clean = sanitizeUrl('HTTP://EXAMPLE.COM/path');
|
|
128
|
+
* // Returns: 'http://example.com/path'
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export declare function sanitizeUrl(urlString: string, options?: UrlValidationOptions): string | null;
|
|
132
|
+
/**
|
|
133
|
+
* Extract and validate hostname from URL
|
|
134
|
+
*
|
|
135
|
+
* @param urlString - The URL string
|
|
136
|
+
* @returns Hostname or null if invalid
|
|
137
|
+
*/
|
|
138
|
+
export declare function extractHostname(urlString: string): string | null;
|
|
139
|
+
/**
|
|
140
|
+
* Check if URL is HTTPS
|
|
141
|
+
*
|
|
142
|
+
* @param urlString - The URL string
|
|
143
|
+
* @returns true if HTTPS, false otherwise
|
|
144
|
+
*/
|
|
145
|
+
export declare function isHttps(urlString: string): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Preset validation configurations for common use cases
|
|
148
|
+
*/
|
|
149
|
+
export declare const UrlValidationPresets: {
|
|
150
|
+
/**
|
|
151
|
+
* Strict validation for production user input
|
|
152
|
+
*/
|
|
153
|
+
STRICT: UrlValidationOptions;
|
|
154
|
+
/**
|
|
155
|
+
* Standard web URLs (HTTP/HTTPS)
|
|
156
|
+
*/
|
|
157
|
+
WEB: UrlValidationOptions;
|
|
158
|
+
/**
|
|
159
|
+
* Development mode (allows localhost)
|
|
160
|
+
*/
|
|
161
|
+
DEVELOPMENT: UrlValidationOptions;
|
|
162
|
+
/**
|
|
163
|
+
* API endpoints (allows authentication)
|
|
164
|
+
*/
|
|
165
|
+
API: UrlValidationOptions;
|
|
166
|
+
};
|
|
167
|
+
//# sourceMappingURL=SecureUrlValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecureUrlValidator.d.ts","sourceRoot":"","sources":["../../src/utils/SecureUrlValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE5B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;IAEV;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AA0CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,CAwIrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAET;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,oBAAyB,GACjC,MAAM,GAAG,IAAI,CAGf;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhE;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAGlD;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;OAEG;YAOE,oBAAoB;IAEzB;;OAEG;SAOE,oBAAoB;IAEzB;;OAEG;iBAOE,oBAAoB;IAEzB;;OAEG;SAOE,oBAAoB;CAC1B,CAAC"}
|