claude-flow-novice 1.3.6 → 1.5.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/analysis/code-analyzer.md +3 -20
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +1 -1
- package/.claude/agents/analyst.md +208 -550
- package/.claude/agents/architect.md +136 -469
- package/.claude/agents/architecture/system-architect.md +20 -1
- package/.claude/agents/architecture/system-design/arch-system-design.md +1 -1
- package/.claude/agents/base-template-generator.md +24 -1
- package/.claude/agents/coder.md +87 -303
- package/.claude/agents/consensus/byzantine-coordinator.md +4 -21
- package/.claude/agents/consensus/consensus-builder.md +3 -20
- package/.claude/agents/consensus/crdt-synchronizer.md +4 -21
- package/.claude/agents/consensus/gossip-coordinator.md +4 -21
- package/.claude/agents/consensus/performance-benchmarker.md +4 -21
- package/.claude/agents/consensus/quorum-manager.md +4 -21
- package/.claude/agents/consensus/raft-manager.md +4 -21
- package/.claude/agents/consensus/security-manager.md +4 -21
- package/.claude/agents/coordinator.md +22 -11
- package/.claude/agents/data/ml/data-ml-model.md +2 -2
- package/.claude/agents/development/backend/dev-backend-api.md +2 -2
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +2 -2
- package/.claude/agents/devops/devops-engineer.md +134 -402
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +2 -2
- package/.claude/agents/github/code-review-swarm.md +1 -1
- package/.claude/agents/github/github-specialist.md +856 -0
- package/.claude/agents/github/pr-manager.md +1 -1
- package/.claude/agents/github/release-manager.md +1 -1
- package/.claude/agents/neural/neural-pattern-agent.md +762 -0
- package/.claude/agents/optimization/benchmark-suite.md +1 -1
- package/.claude/agents/optimization/perf-analyzer.md +1 -1
- package/.claude/agents/optimization/performance-monitor.md +1 -1
- package/.claude/agents/planner.md +135 -0
- package/.claude/agents/researcher.md +22 -9
- package/.claude/agents/reviewer.md +291 -0
- package/.claude/agents/security/security-specialist.md +1 -1
- package/.claude/agents/sparc/architecture.md +1 -1
- package/.claude/agents/sparc/pseudocode.md +1 -1
- package/.claude/agents/sparc/refinement.md +1 -1
- package/.claude/agents/sparc/specification.md +1 -1
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +2 -2
- package/.claude/agents/tester.md +21 -11
- package/.claude/agents/testing/unit/tdd-london-swarm.md +1 -1
- package/.claude/agents/testing/validation/production-validator.md +1 -1
- package/.claude/commands/claude-soul.js +1 -1
- package/.claude/hooks.json +12 -15
- package/{.claude → .claude-flow-novice/.claude}/agents/MIGRATION_SUMMARY.md +1 -1
- package/.claude-flow-novice/.claude/agents/analysis/code-analyzer.md +192 -0
- package/.claude-flow-novice/.claude/agents/analysis/code-review/analyze-code-quality.md +180 -0
- package/.claude-flow-novice/.claude/agents/analyst.md +300 -0
- package/.claude-flow-novice/.claude/agents/architect.md +557 -0
- package/.claude-flow-novice/.claude/agents/architecture/system-architect.md +630 -0
- package/.claude-flow-novice/.claude/agents/architecture/system-design/arch-system-design.md +156 -0
- package/.claude-flow-novice/.claude/agents/base-template-generator.md +65 -0
- package/.claude-flow-novice/.claude/agents/coder.md +180 -0
- package/.claude-flow-novice/.claude/agents/consensus/byzantine-coordinator.md +46 -0
- package/.claude-flow-novice/.claude/agents/consensus/consensus-builder.md +225 -0
- package/.claude-flow-novice/.claude/agents/consensus/crdt-synchronizer.md +980 -0
- package/.claude-flow-novice/.claude/agents/consensus/gossip-coordinator.md +46 -0
- package/.claude-flow-novice/.claude/agents/consensus/performance-benchmarker.md +834 -0
- package/.claude-flow-novice/.claude/agents/consensus/quorum-manager.md +806 -0
- package/.claude-flow-novice/.claude/agents/consensus/raft-manager.md +46 -0
- package/.claude-flow-novice/.claude/agents/consensus/security-manager.md +605 -0
- package/.claude-flow-novice/.claude/agents/coordinator.md +842 -0
- package/.claude-flow-novice/.claude/agents/data/ml/data-ml-model.md +193 -0
- package/.claude-flow-novice/.claude/agents/development/backend/dev-backend-api.md +142 -0
- package/.claude-flow-novice/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
- package/.claude-flow-novice/.claude/agents/devops/devops-engineer.md +638 -0
- package/.claude-flow-novice/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
- package/.claude-flow-novice/.claude/agents/github/code-review-swarm.md +538 -0
- package/.claude-flow-novice/.claude/agents/github/github-modes.md +173 -0
- package/.claude-flow-novice/.claude/agents/github/github-specialist.md +856 -0
- package/.claude-flow-novice/.claude/agents/github/issue-tracker.md +319 -0
- package/.claude-flow-novice/.claude/agents/github/multi-repo-swarm.md +553 -0
- package/.claude-flow-novice/.claude/agents/github/pr-manager.md +191 -0
- package/.claude-flow-novice/.claude/agents/github/project-board-sync.md +509 -0
- package/.claude-flow-novice/.claude/agents/github/release-manager.md +367 -0
- package/.claude-flow-novice/.claude/agents/github/release-swarm.md +583 -0
- package/.claude-flow-novice/.claude/agents/github/repo-architect.md +398 -0
- package/.claude-flow-novice/.claude/agents/github/swarm-issue.md +573 -0
- package/.claude-flow-novice/.claude/agents/github/swarm-pr.md +428 -0
- package/.claude-flow-novice/.claude/agents/github/sync-coordinator.md +452 -0
- package/.claude-flow-novice/.claude/agents/github/workflow-automation.md +635 -0
- package/.claude-flow-novice/.claude/agents/goal/goal-planner.md +73 -0
- package/.claude-flow-novice/.claude/agents/neural/neural-pattern-agent.md +762 -0
- package/.claude-flow-novice/.claude/agents/neural/safla-neural.md +74 -0
- package/.claude-flow-novice/.claude/agents/optimization/benchmark-suite.md +665 -0
- package/.claude-flow-novice/.claude/agents/optimization/load-balancer.md +431 -0
- package/.claude-flow-novice/.claude/agents/optimization/perf-analyzer.md +725 -0
- package/.claude-flow-novice/.claude/agents/optimization/performance-monitor.md +672 -0
- package/.claude-flow-novice/.claude/agents/optimization/resource-allocator.md +674 -0
- package/.claude-flow-novice/.claude/agents/optimization/topology-optimizer.md +808 -0
- package/.claude-flow-novice/.claude/agents/planner.md +135 -0
- package/.claude-flow-novice/.claude/agents/researcher.md +185 -0
- package/.claude-flow-novice/.claude/agents/reviewer.md +291 -0
- package/.claude-flow-novice/.claude/agents/security/security-specialist.md +978 -0
- package/.claude-flow-novice/.claude/agents/sparc/architecture.md +472 -0
- package/.claude-flow-novice/.claude/agents/sparc/pseudocode.md +318 -0
- package/.claude-flow-novice/.claude/agents/sparc/refinement.md +525 -0
- package/.claude-flow-novice/.claude/agents/sparc/specification.md +276 -0
- package/.claude-flow-novice/.claude/agents/specialized/mobile/spec-mobile-react-native.md +226 -0
- package/.claude-flow-novice/.claude/agents/sublinear/consciousness-evolution-agent.md +499 -0
- package/.claude-flow-novice/.claude/agents/sublinear/matrix-solver-agent.md +113 -0
- package/.claude-flow-novice/.claude/agents/sublinear/nanosecond-scheduler-agent.md +644 -0
- package/.claude-flow-novice/.claude/agents/sublinear/pagerank-agent.md +699 -0
- package/.claude-flow-novice/.claude/agents/sublinear/phi-calculator-agent.md +749 -0
- package/.claude-flow-novice/.claude/agents/sublinear/psycho-symbolic-agent.md +543 -0
- package/.claude-flow-novice/.claude/agents/sublinear/sublinear.md +816 -0
- package/.claude-flow-novice/.claude/agents/sublinear/temporal-advantage-agent.md +360 -0
- package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator-enhanced.md +746 -0
- package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator.md +396 -0
- package/.claude-flow-novice/.claude/agents/swarm/hierarchical-coordinator.md +300 -0
- package/.claude-flow-novice/.claude/agents/swarm/mesh-coordinator.md +435 -0
- package/.claude-flow-novice/.claude/agents/templates/automation-smart-agent.md +205 -0
- package/.claude-flow-novice/.claude/agents/templates/coordinator-swarm-init.md +90 -0
- package/.claude-flow-novice/.claude/agents/templates/github-pr-manager.md +177 -0
- package/.claude-flow-novice/.claude/agents/templates/implementer-sparc-coder.md +259 -0
- package/.claude-flow-novice/.claude/agents/templates/memory-coordinator.md +187 -0
- package/.claude-flow-novice/.claude/agents/templates/migration-plan.md +746 -0
- package/.claude-flow-novice/.claude/agents/templates/orchestrator-task.md +139 -0
- package/.claude-flow-novice/.claude/agents/templates/performance-analyzer.md +199 -0
- package/.claude-flow-novice/.claude/agents/templates/sparc-coordinator.md +183 -0
- package/.claude-flow-novice/.claude/agents/tester.md +663 -0
- package/.claude-flow-novice/.claude/agents/testing/e2e/playwright-agent.md +249 -0
- package/.claude-flow-novice/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
- package/.claude-flow-novice/.claude/agents/testing/validation/production-validator.md +395 -0
- package/.claude-flow-novice/dist/index.js +12 -24
- package/.claude-flow-novice/dist/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/agents/agent-manager.js +123 -69
- package/.claude-flow-novice/dist/src/agents/agent-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js +7 -7
- package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js.map +1 -1
- package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js +485 -0
- package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js +630 -0
- package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/commands/agent.js +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/agent.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/config-integration.js +6 -6
- package/.claude-flow-novice/dist/src/cli/commands/enterprise.js +18 -18
- package/.claude-flow-novice/dist/src/cli/commands/enterprise.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/goal-init.js +4 -4
- package/.claude-flow-novice/dist/src/cli/commands/help-new.js +23 -23
- package/.claude-flow-novice/dist/src/cli/commands/help-new.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/help.js +74 -74
- package/.claude-flow-novice/dist/src/cli/commands/help.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js +2 -2
- package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/hive.js +4 -4
- package/.claude-flow-novice/dist/src/cli/commands/index.js +103 -132
- package/.claude-flow-novice/dist/src/cli/commands/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/mcp.js +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/migrate.js +4 -4
- package/.claude-flow-novice/dist/src/cli/commands/migrate.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/monitor.js +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/neural-init.js +4 -4
- package/.claude-flow-novice/dist/src/cli/commands/ruv-swarm.js +8 -8
- package/.claude-flow-novice/dist/src/cli/commands/sparc.js +12 -12
- package/.claude-flow-novice/dist/src/cli/commands/sparc.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/start/start-command.js +3 -3
- package/.claude-flow-novice/dist/src/cli/commands/status.js +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js +7 -7
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/verification.js +18 -18
- package/.claude-flow-novice/dist/src/cli/completion.js +54 -54
- package/.claude-flow-novice/dist/src/cli/completion.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js +11 -11
- package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/core/CommandHandlers.js +31 -31
- package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js +39 -39
- package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js +25 -25
- package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js +8 -8
- package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js +6 -6
- package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js +7 -7
- package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/index-remote.js +10 -10
- package/.claude-flow-novice/dist/src/cli/index.js +1 -1
- package/.claude-flow-novice/dist/src/cli/init/directory-structure.js +8 -8
- package/.claude-flow-novice/dist/src/cli/init/index.js +3 -3
- package/.claude-flow-novice/dist/src/cli/init/sparc-environment.js +67 -67
- package/.claude-flow-novice/dist/src/cli/init/swarm-commands.js +18 -18
- package/.claude-flow-novice/dist/src/cli/node-repl.js +2 -2
- package/.claude-flow-novice/dist/src/cli/repl.js +1 -1
- package/.claude-flow-novice/dist/src/cli/simple-cli.js +68 -68
- package/.claude-flow-novice/dist/src/cli/simple-cli.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/simple-commands/session-start-soul.js +271 -0
- package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js +7 -7
- package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/ui/fallback-handler.js +7 -7
- package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js +816 -0
- package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js +812 -0
- package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/optimized-serialization.js +369 -0
- package/.claude-flow-novice/dist/src/communication/optimized-serialization.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/performance-optimizations.js +526 -0
- package/.claude-flow-novice/dist/src/communication/performance-optimizations.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/performance-validator.js +532 -0
- package/.claude-flow-novice/dist/src/communication/performance-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/priority-message-queue.js +525 -0
- package/.claude-flow-novice/dist/src/communication/priority-message-queue.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js +218 -0
- package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js +521 -0
- package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js +563 -0
- package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/websocket-cluster.js +344 -0
- package/.claude-flow-novice/dist/src/communication/websocket-cluster.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js +369 -0
- package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js.map +1 -0
- package/.claude-flow-novice/dist/src/config/config-manager.js +1 -1
- package/.claude-flow-novice/dist/src/config/config-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/config/core/intelligent-configuration-manager.js +1 -1
- package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js +6 -6
- package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js.map +1 -1
- package/.claude-flow-novice/dist/src/config/migration/config-migration.js +1 -1
- package/.claude-flow-novice/dist/src/config/ruv-swarm-integration.js +1 -1
- package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js +1 -1
- package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js.map +1 -1
- package/.claude-flow-novice/dist/src/config/web-portal-config.js +0 -9
- package/.claude-flow-novice/dist/src/config/web-portal-config.js.map +1 -1
- package/.claude-flow-novice/dist/src/config/zero-config-setup.js +18 -18
- package/.claude-flow-novice/dist/src/config/zero-config-setup.js.map +1 -1
- package/.claude-flow-novice/dist/src/core/logger.js +33 -10
- package/.claude-flow-novice/dist/src/core/logger.js.map +1 -1
- package/.claude-flow-novice/dist/src/migration/index.js +1 -1
- package/.claude-flow-novice/dist/src/migration/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/migration/migration-runner.js +4 -4
- package/.claude-flow-novice/dist/src/migration/migration-runner.js.map +1 -1
- package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js +430 -0
- package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js.map +1 -0
- package/.claude-flow-novice/dist/src/slash-commands/claude-soul.js +248 -365
- package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/claude-code-interface.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/claude-flow-executor.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js +471 -0
- package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm/hive-mind-integration.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js +543 -0
- package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm/optimizations/connection-pool.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/optimizations/optimized-executor.js +1 -1
- package/.claude-flow-novice/dist/src/swarm/types.js.map +1 -1
- package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js +709 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js +612 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js +679 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js +654 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js +402 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js +459 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js +513 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js +19 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js +568 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js +418 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js +530 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js.map +1 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js +250 -0
- package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/task/index.js +7 -7
- package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js +420 -0
- package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/validation/production-validator.js +1435 -0
- package/.claude-flow-novice/dist/src/validation/production-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/cli-integration.js +3 -3
- package/.claude-flow-novice/dist/src/verification/hooks.js +1 -1
- package/CHANGELOG.md +13 -0
- package/CLAUDE.md +1029 -68
- package/README.md +0 -1
- package/config/build/babel.config.cjs +19 -11
- package/config/typescript/tsconfig.json +1 -1
- package/examples/claude-api-error-handling.ts +2 -2
- package/examples/frontend-testing-demo.ts +470 -0
- package/examples/litellm/config/config.yaml +1 -1
- package/package.json +13 -7
- package/scripts/build/unified-builder.sh +6 -6
- package/scripts/build/validate-agents.js +238 -0
- package/scripts/run-production-validation.ts +590 -0
- package/scripts/test/test-coordination-features.ts +2 -2
- package/scripts/validate-stage3-performance.ts +377 -0
- package/src/cli/simple-commands/hooks.js +1 -0
- package/src/cli/simple-commands/init/agent-copier.js +0 -2
- package/src/cli/simple-commands/init/index.js +5 -97
- package/src/cli/simple-commands/init/templates/CLAUDE.md +162 -1158
- package/src/cli/simple-commands/init/templates/claude-md.js +38 -157
- package/src/swarm-fullstack/integrations/communication-bridge.ts +931 -0
- package/src/swarm-fullstack/testing/api-contract-validator.ts +909 -0
- package/src/swarm-fullstack/testing/backend-test-orchestrator.ts +791 -0
- package/src/swarm-fullstack/testing/frontend-test-orchestrator.ts +853 -0
- package/src/swarm-fullstack/testing/visual-regression.ts +507 -0
- package/src/swarm-fullstack/workflows/convergence-detector.ts +736 -0
- package/src/swarm-fullstack/workflows/fix-coordinator.ts +677 -0
- package/src/swarm-fullstack/workflows/index.ts +75 -0
- package/src/swarm-fullstack/workflows/iterative-build-test.ts +829 -0
- package/src/swarm-fullstack/workflows/regression-test-manager.ts +590 -0
- package/src/swarm-fullstack/workflows/test-result-analyzer.ts +739 -0
- package/src/swarm-fullstack/workflows/workflow-metrics.ts +399 -0
- package/wiki/command-reference/README.md +1 -2
- package/wiki/command-reference/mcp-tools/README.md +1 -1
- package/wiki/getting-started/claude-code-mcp/README.md +1 -2
- package/wiki/getting-started/installation/README.md +2 -10
- package/.claude/commands/flow-nexus/app-store.md +0 -124
- package/.claude/commands/flow-nexus/challenges.md +0 -120
- package/.claude/commands/flow-nexus/login-registration.md +0 -65
- package/.claude/commands/flow-nexus/neural-network.md +0 -134
- package/.claude/commands/flow-nexus/payments.md +0 -116
- package/.claude/commands/flow-nexus/sandbox.md +0 -83
- package/.claude/commands/flow-nexus/swarm.md +0 -87
- package/.claude/commands/flow-nexus/user-tools.md +0 -152
- package/.claude/commands/flow-nexus/workflow.md +0 -115
- package/.claude-flow-novice/dist/cli/index.js +0 -45
- package/.claude-flow-novice/dist/core/index.js +0 -22
- package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +0 -595
- package/.claude-flow-novice/dist/mcp/mcp-server-sdk.js +0 -649
- package/.claude-flow-novice/dist/mcp/mcp-server-with-slash-commands.js +0 -776
- package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/claude-md.js +0 -1101
- package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +0 -265
- /package/{.claude → .claude-flow-novice/.claude}/agents/README.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/backend-dev.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/code-analyzer.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/coder.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/consensus/README.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/core/coder.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/core/planner.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/core/researcher.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/core/reviewer.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/core/tester.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/optimization/README.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/planner.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/researcher.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/reviewer.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/swarm/README.md +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/system-architect.json +0 -0
- /package/{.claude → .claude-flow-novice/.claude}/agents/tester.json +0 -0
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Event Bus with High-Performance Subscription Management
|
|
3
|
+
*
|
|
4
|
+
* Advanced event bus implementation with:
|
|
5
|
+
* - Pattern-based subscriptions with wildcards
|
|
6
|
+
* - Priority-based event delivery
|
|
7
|
+
* - Topic hierarchies and routing
|
|
8
|
+
* - Subscription filters and transforms
|
|
9
|
+
* - Dead letter handling for failed events
|
|
10
|
+
* - Sub-millisecond event delivery
|
|
11
|
+
*
|
|
12
|
+
* Performance Targets:
|
|
13
|
+
* - Event delivery: <100 microseconds
|
|
14
|
+
* - Subscription matching: <10 microseconds
|
|
15
|
+
* - Concurrent throughput: >5M events/second
|
|
16
|
+
*/ import { EventEmitter } from "node:events";
|
|
17
|
+
import { LockFreeHashTable, LockFreeRingBuffer } from "../memory/lock-free-structures.js";
|
|
18
|
+
export var EventPriority = /*#__PURE__*/ function(EventPriority) {
|
|
19
|
+
EventPriority[EventPriority["CRITICAL"] = 0] = "CRITICAL";
|
|
20
|
+
EventPriority[EventPriority["HIGH"] = 1] = "HIGH";
|
|
21
|
+
EventPriority[EventPriority["NORMAL"] = 2] = "NORMAL";
|
|
22
|
+
EventPriority[EventPriority["LOW"] = 3] = "LOW";
|
|
23
|
+
return EventPriority;
|
|
24
|
+
}({});
|
|
25
|
+
/**
|
|
26
|
+
* High-performance event bus with advanced subscription management
|
|
27
|
+
*/ export class EnhancedEventBus extends EventEmitter {
|
|
28
|
+
config;
|
|
29
|
+
logger;
|
|
30
|
+
// Core components
|
|
31
|
+
sharedBuffer;
|
|
32
|
+
subscriptions = new Map();
|
|
33
|
+
subscriptionGroups = new Map();
|
|
34
|
+
topicTree;
|
|
35
|
+
patternCache = new Map();
|
|
36
|
+
// Lock-free structures
|
|
37
|
+
subscriptionTable;
|
|
38
|
+
eventQueues = new Map();
|
|
39
|
+
deadLetterQueue;
|
|
40
|
+
// Performance monitoring
|
|
41
|
+
metrics;
|
|
42
|
+
metricsInterval;
|
|
43
|
+
// Event processing
|
|
44
|
+
processingWorkers = [];
|
|
45
|
+
isRunning = false;
|
|
46
|
+
constructor(config, logger){
|
|
47
|
+
super();
|
|
48
|
+
this.config = {
|
|
49
|
+
maxSubscriptions: 100000,
|
|
50
|
+
maxConcurrentEvents: 10000,
|
|
51
|
+
eventBufferSize: 64 * 1024 * 1024,
|
|
52
|
+
patternCacheSize: 10000,
|
|
53
|
+
enableWildcards: true,
|
|
54
|
+
enableFilters: true,
|
|
55
|
+
enableTransforms: true,
|
|
56
|
+
enablePriorities: true,
|
|
57
|
+
enableDeadLetterQueue: true,
|
|
58
|
+
maxRetryAttempts: 3,
|
|
59
|
+
eventTimeout: 5000000,
|
|
60
|
+
sharedBufferSize: 128 * 1024 * 1024,
|
|
61
|
+
subscriptionPoolSize: 32 * 1024 * 1024,
|
|
62
|
+
eventPoolSize: 64 * 1024 * 1024,
|
|
63
|
+
enableMetrics: true,
|
|
64
|
+
metricsInterval: 1000,
|
|
65
|
+
...config
|
|
66
|
+
};
|
|
67
|
+
this.logger = logger;
|
|
68
|
+
this.topicTree = this.createRootNode();
|
|
69
|
+
this.initializeComponents();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Initialize core components
|
|
73
|
+
*/ initializeComponents() {
|
|
74
|
+
// Initialize shared memory
|
|
75
|
+
this.sharedBuffer = new SharedArrayBuffer(this.config.sharedBufferSize);
|
|
76
|
+
// Initialize subscription table
|
|
77
|
+
this.subscriptionTable = new LockFreeHashTable(this.sharedBuffer, 16384, 4096);
|
|
78
|
+
// Initialize priority queues
|
|
79
|
+
for(let priority = 0; priority < 4; priority++){
|
|
80
|
+
const queueOffset = 4096 + 16384 * 32 + priority * 16 * 1024 * 1024;
|
|
81
|
+
this.eventQueues.set(priority, new LockFreeRingBuffer(this.sharedBuffer, queueOffset, 16 * 1024 * 1024));
|
|
82
|
+
}
|
|
83
|
+
// Initialize dead letter queue
|
|
84
|
+
const dlqOffset = 4096 + 16384 * 32 + 4 * 16 * 1024 * 1024;
|
|
85
|
+
this.deadLetterQueue = new LockFreeRingBuffer(this.sharedBuffer, dlqOffset, 8 * 1024 * 1024);
|
|
86
|
+
// Initialize metrics
|
|
87
|
+
this.metrics = new EventBusMetrics();
|
|
88
|
+
// Create event processors
|
|
89
|
+
for(let i = 0; i < 4; i++){
|
|
90
|
+
this.processingWorkers.push(new EventProcessor(i, this.eventQueues, this.subscriptions, this.topicTree, this.config, this.logger));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Start the event bus
|
|
95
|
+
*/ async start() {
|
|
96
|
+
this.logger.info("Starting Enhanced Event Bus", {
|
|
97
|
+
maxSubscriptions: this.config.maxSubscriptions,
|
|
98
|
+
bufferSize: `${this.config.sharedBufferSize / 1024 / 1024}MB`,
|
|
99
|
+
enableWildcards: this.config.enableWildcards
|
|
100
|
+
});
|
|
101
|
+
this.isRunning = true;
|
|
102
|
+
// Start event processors
|
|
103
|
+
for (const worker of this.processingWorkers){
|
|
104
|
+
worker.start();
|
|
105
|
+
}
|
|
106
|
+
// Start metrics collection
|
|
107
|
+
if (this.config.enableMetrics) {
|
|
108
|
+
this.startMetricsCollection();
|
|
109
|
+
}
|
|
110
|
+
this.emit("eventbus:started");
|
|
111
|
+
this.logger.info("Enhanced Event Bus started successfully");
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Subscribe to events with pattern matching
|
|
115
|
+
*/ async subscribe(subscriberId, pattern, options = {}) {
|
|
116
|
+
const subscriptionId = this.generateSubscriptionId();
|
|
117
|
+
const now = process.hrtime.bigint();
|
|
118
|
+
// Compile pattern for matching
|
|
119
|
+
let compiledPattern;
|
|
120
|
+
if (this.config.enableWildcards && this.isWildcardPattern(pattern)) {
|
|
121
|
+
compiledPattern = this.compilePattern(pattern);
|
|
122
|
+
}
|
|
123
|
+
const subscription = {
|
|
124
|
+
id: subscriptionId,
|
|
125
|
+
subscriberId,
|
|
126
|
+
pattern,
|
|
127
|
+
compiledPattern,
|
|
128
|
+
priority: options.priority || 2,
|
|
129
|
+
filter: options.filter,
|
|
130
|
+
transform: options.transform,
|
|
131
|
+
ackRequired: options.ackRequired || false,
|
|
132
|
+
createdAt: now,
|
|
133
|
+
lastMatch: BigInt(0),
|
|
134
|
+
matchCount: BigInt(0),
|
|
135
|
+
errorCount: BigInt(0)
|
|
136
|
+
};
|
|
137
|
+
// Validate subscription
|
|
138
|
+
this.validateSubscription(subscription);
|
|
139
|
+
// Store subscription
|
|
140
|
+
this.subscriptions.set(subscriptionId, subscription);
|
|
141
|
+
// Add to topic tree
|
|
142
|
+
this.addToTopicTree(pattern, subscriptionId);
|
|
143
|
+
// Add to subscription table for fast lookup
|
|
144
|
+
const patternHash = this.hashPattern(pattern);
|
|
145
|
+
// Store subscription ID in hash table
|
|
146
|
+
// Implementation would serialize subscription data
|
|
147
|
+
// Handle subscription groups
|
|
148
|
+
if (options.groupId) {
|
|
149
|
+
await this.addToSubscriptionGroup(options.groupId, subscriptionId);
|
|
150
|
+
}
|
|
151
|
+
this.metrics.recordSubscription(subscription);
|
|
152
|
+
this.logger.debug("Subscription created", {
|
|
153
|
+
subscriptionId,
|
|
154
|
+
subscriberId,
|
|
155
|
+
pattern,
|
|
156
|
+
priority: subscription.priority,
|
|
157
|
+
hasFilter: !!subscription.filter,
|
|
158
|
+
hasTransform: !!subscription.transform
|
|
159
|
+
});
|
|
160
|
+
this.emit("subscription:created", {
|
|
161
|
+
subscription
|
|
162
|
+
});
|
|
163
|
+
return subscriptionId;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Unsubscribe from events
|
|
167
|
+
*/ async unsubscribe(subscriptionId) {
|
|
168
|
+
const subscription = this.subscriptions.get(subscriptionId);
|
|
169
|
+
if (!subscription) {
|
|
170
|
+
this.logger.warn("Subscription not found for unsubscribe", {
|
|
171
|
+
subscriptionId
|
|
172
|
+
});
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
// Remove from topic tree
|
|
176
|
+
this.removeFromTopicTree(subscription.pattern, subscriptionId);
|
|
177
|
+
// Remove from subscription table
|
|
178
|
+
const patternHash = this.hashPattern(subscription.pattern);
|
|
179
|
+
// Remove from hash table implementation
|
|
180
|
+
// Remove from subscription groups
|
|
181
|
+
for (const group of this.subscriptionGroups.values()){
|
|
182
|
+
group.members.delete(subscriptionId);
|
|
183
|
+
}
|
|
184
|
+
// Remove subscription
|
|
185
|
+
this.subscriptions.delete(subscriptionId);
|
|
186
|
+
this.metrics.recordUnsubscription(subscription);
|
|
187
|
+
this.logger.debug("Subscription removed", {
|
|
188
|
+
subscriptionId,
|
|
189
|
+
subscriberId: subscription.subscriberId,
|
|
190
|
+
pattern: subscription.pattern
|
|
191
|
+
});
|
|
192
|
+
this.emit("subscription:removed", {
|
|
193
|
+
subscriptionId,
|
|
194
|
+
subscription
|
|
195
|
+
});
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Emit event with high-performance routing
|
|
200
|
+
*/ emit(event, data) {
|
|
201
|
+
const startTime = process.hrtime.bigint();
|
|
202
|
+
try {
|
|
203
|
+
// Create event envelope
|
|
204
|
+
const envelope = this.createEventEnvelope(event, data);
|
|
205
|
+
// Route to appropriate priority queue
|
|
206
|
+
const priorityQueue = this.eventQueues.get(envelope.priority);
|
|
207
|
+
if (!priorityQueue) {
|
|
208
|
+
throw new Error(`Priority queue not found: ${envelope.priority}`);
|
|
209
|
+
}
|
|
210
|
+
// Serialize event for queue
|
|
211
|
+
const serializedEvent = this.serializeEvent(envelope);
|
|
212
|
+
// Enqueue event
|
|
213
|
+
const enqueued = priorityQueue.enqueue(serializedEvent);
|
|
214
|
+
if (!enqueued) {
|
|
215
|
+
// Queue full - handle overflow
|
|
216
|
+
this.handleQueueOverflow(envelope);
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
// Record metrics
|
|
220
|
+
const enqueueDuration = process.hrtime.bigint() - startTime;
|
|
221
|
+
this.metrics.recordEventEmitted(envelope, Number(enqueueDuration));
|
|
222
|
+
return true;
|
|
223
|
+
} catch (error) {
|
|
224
|
+
this.logger.error("Event emission failed", {
|
|
225
|
+
event,
|
|
226
|
+
error
|
|
227
|
+
});
|
|
228
|
+
this.metrics.recordError("emit_failed", error);
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Register event handler
|
|
234
|
+
*/ on(event, handler) {
|
|
235
|
+
// Create internal subscription for compatibility
|
|
236
|
+
this.subscribe("internal", event, {
|
|
237
|
+
priority: 2
|
|
238
|
+
}).then((subscriptionId)=>{
|
|
239
|
+
// Store handler mapping
|
|
240
|
+
this.subscriptions.get(subscriptionId).transform = {
|
|
241
|
+
type: "map",
|
|
242
|
+
function: handler.toString(),
|
|
243
|
+
config: {}
|
|
244
|
+
};
|
|
245
|
+
});
|
|
246
|
+
super.on(event, handler);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Remove event handler
|
|
250
|
+
*/ off(event, handler) {
|
|
251
|
+
// Find and remove matching subscription
|
|
252
|
+
for (const [subscriptionId, subscription] of this.subscriptions){
|
|
253
|
+
if (subscription.pattern === event && subscription.subscriberId === "internal") {
|
|
254
|
+
this.unsubscribe(subscriptionId);
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
super.off(event, handler);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Register one-time event handler
|
|
262
|
+
*/ once(event, handler) {
|
|
263
|
+
const onceHandler = (data)=>{
|
|
264
|
+
handler(data);
|
|
265
|
+
this.off(event, onceHandler);
|
|
266
|
+
};
|
|
267
|
+
this.on(event, onceHandler);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Create subscription group for load balancing
|
|
271
|
+
*/ async createSubscriptionGroup(groupId, name, config = {}) {
|
|
272
|
+
const group = {
|
|
273
|
+
id: groupId,
|
|
274
|
+
name,
|
|
275
|
+
members: new Set(),
|
|
276
|
+
loadBalancing: config.loadBalancing || "round-robin",
|
|
277
|
+
deliveryMode: config.deliveryMode || "one-of"
|
|
278
|
+
};
|
|
279
|
+
this.subscriptionGroups.set(groupId, group);
|
|
280
|
+
this.logger.info("Subscription group created", {
|
|
281
|
+
groupId,
|
|
282
|
+
name,
|
|
283
|
+
loadBalancing: group.loadBalancing,
|
|
284
|
+
deliveryMode: group.deliveryMode
|
|
285
|
+
});
|
|
286
|
+
this.emit("group:created", {
|
|
287
|
+
group
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Add subscription to group
|
|
292
|
+
*/ async addToSubscriptionGroup(groupId, subscriptionId) {
|
|
293
|
+
const group = this.subscriptionGroups.get(groupId);
|
|
294
|
+
if (!group) {
|
|
295
|
+
throw new Error(`Subscription group not found: ${groupId}`);
|
|
296
|
+
}
|
|
297
|
+
group.members.add(subscriptionId);
|
|
298
|
+
this.logger.debug("Added subscription to group", {
|
|
299
|
+
groupId,
|
|
300
|
+
subscriptionId,
|
|
301
|
+
groupSize: group.members.size
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Create event envelope with metadata
|
|
306
|
+
*/ createEventEnvelope(event, data) {
|
|
307
|
+
const now = process.hrtime.bigint();
|
|
308
|
+
return {
|
|
309
|
+
id: this.generateEventId(),
|
|
310
|
+
type: event,
|
|
311
|
+
data,
|
|
312
|
+
metadata: {
|
|
313
|
+
source: "enhanced-event-bus",
|
|
314
|
+
version: "1.0",
|
|
315
|
+
contentType: "application/json",
|
|
316
|
+
encoding: "utf-8",
|
|
317
|
+
compressed: false,
|
|
318
|
+
size: this.calculateDataSize(data),
|
|
319
|
+
tags: [],
|
|
320
|
+
customFields: new Map()
|
|
321
|
+
},
|
|
322
|
+
priority: this.determineEventPriority(event),
|
|
323
|
+
timestamp: now,
|
|
324
|
+
retryCount: 0
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Determine event priority based on type
|
|
329
|
+
*/ determineEventPriority(event) {
|
|
330
|
+
// Critical system events
|
|
331
|
+
if (event.startsWith("system:") || event.includes("error") || event.includes("alert")) {
|
|
332
|
+
return 0;
|
|
333
|
+
}
|
|
334
|
+
// High priority agent events
|
|
335
|
+
if (event.startsWith("agent:") || event.includes("coordination")) {
|
|
336
|
+
return 1;
|
|
337
|
+
}
|
|
338
|
+
// Default to normal priority
|
|
339
|
+
return 2;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Add subscription to topic tree for fast matching
|
|
343
|
+
*/ addToTopicTree(pattern, subscriptionId) {
|
|
344
|
+
const segments = pattern.split(".");
|
|
345
|
+
let currentNode = this.topicTree;
|
|
346
|
+
for (const segment of segments){
|
|
347
|
+
if (!currentNode.children.has(segment)) {
|
|
348
|
+
currentNode.children.set(segment, {
|
|
349
|
+
segment,
|
|
350
|
+
children: new Map(),
|
|
351
|
+
subscriptions: new Set(),
|
|
352
|
+
wildcardSubscriptions: new Set(),
|
|
353
|
+
isWildcard: segment === "*" || segment === "**"
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
currentNode = currentNode.children.get(segment);
|
|
357
|
+
}
|
|
358
|
+
// Add subscription to leaf node
|
|
359
|
+
if (this.isWildcardPattern(pattern)) {
|
|
360
|
+
currentNode.wildcardSubscriptions.add(subscriptionId);
|
|
361
|
+
} else {
|
|
362
|
+
currentNode.subscriptions.add(subscriptionId);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Remove subscription from topic tree
|
|
367
|
+
*/ removeFromTopicTree(pattern, subscriptionId) {
|
|
368
|
+
const segments = pattern.split(".");
|
|
369
|
+
let currentNode = this.topicTree;
|
|
370
|
+
// Navigate to leaf node
|
|
371
|
+
for (const segment of segments){
|
|
372
|
+
const childNode = currentNode.children.get(segment);
|
|
373
|
+
if (!childNode) return;
|
|
374
|
+
currentNode = childNode;
|
|
375
|
+
}
|
|
376
|
+
// Remove subscription
|
|
377
|
+
currentNode.subscriptions.delete(subscriptionId);
|
|
378
|
+
currentNode.wildcardSubscriptions.delete(subscriptionId);
|
|
379
|
+
// Clean up empty nodes (optional optimization)
|
|
380
|
+
this.cleanupEmptyNodes(pattern);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Find matching subscriptions for event
|
|
384
|
+
*/ findMatchingSubscriptions(eventType) {
|
|
385
|
+
const matches = new Set();
|
|
386
|
+
const segments = eventType.split(".");
|
|
387
|
+
this.traverseTopicTree(this.topicTree, segments, 0, matches);
|
|
388
|
+
return matches;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Traverse topic tree to find matches
|
|
392
|
+
*/ traverseTopicTree(node, segments, segmentIndex, matches) {
|
|
393
|
+
// Exact match at leaf
|
|
394
|
+
if (segmentIndex === segments.length) {
|
|
395
|
+
for (const subscriptionId of node.subscriptions){
|
|
396
|
+
matches.add(subscriptionId);
|
|
397
|
+
}
|
|
398
|
+
for (const subscriptionId of node.wildcardSubscriptions){
|
|
399
|
+
matches.add(subscriptionId);
|
|
400
|
+
}
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
const currentSegment = segments[segmentIndex];
|
|
404
|
+
// Check exact segment match
|
|
405
|
+
const exactChild = node.children.get(currentSegment);
|
|
406
|
+
if (exactChild) {
|
|
407
|
+
this.traverseTopicTree(exactChild, segments, segmentIndex + 1, matches);
|
|
408
|
+
}
|
|
409
|
+
// Check single-level wildcard (*)
|
|
410
|
+
const singleWildcard = node.children.get("*");
|
|
411
|
+
if (singleWildcard) {
|
|
412
|
+
this.traverseTopicTree(singleWildcard, segments, segmentIndex + 1, matches);
|
|
413
|
+
}
|
|
414
|
+
// Check multi-level wildcard (**)
|
|
415
|
+
const multiWildcard = node.children.get("**");
|
|
416
|
+
if (multiWildcard) {
|
|
417
|
+
// Multi-level wildcard matches everything from here
|
|
418
|
+
for (const subscriptionId of multiWildcard.subscriptions){
|
|
419
|
+
matches.add(subscriptionId);
|
|
420
|
+
}
|
|
421
|
+
for (const subscriptionId of multiWildcard.wildcardSubscriptions){
|
|
422
|
+
matches.add(subscriptionId);
|
|
423
|
+
}
|
|
424
|
+
// Also continue matching at deeper levels
|
|
425
|
+
for(let i = segmentIndex; i <= segments.length; i++){
|
|
426
|
+
this.traverseTopicTree(multiWildcard, segments, i, matches);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Validate subscription
|
|
432
|
+
*/ validateSubscription(subscription) {
|
|
433
|
+
if (!subscription.pattern) {
|
|
434
|
+
throw new Error("Subscription pattern is required");
|
|
435
|
+
}
|
|
436
|
+
if (!subscription.subscriberId) {
|
|
437
|
+
throw new Error("Subscriber ID is required");
|
|
438
|
+
}
|
|
439
|
+
if (this.subscriptions.size >= this.config.maxSubscriptions) {
|
|
440
|
+
throw new Error(`Maximum subscriptions reached: ${this.config.maxSubscriptions}`);
|
|
441
|
+
}
|
|
442
|
+
// Validate filter
|
|
443
|
+
if (subscription.filter && !this.config.enableFilters) {
|
|
444
|
+
throw new Error("Filters are not enabled");
|
|
445
|
+
}
|
|
446
|
+
// Validate transform
|
|
447
|
+
if (subscription.transform && !this.config.enableTransforms) {
|
|
448
|
+
throw new Error("Transforms are not enabled");
|
|
449
|
+
}
|
|
450
|
+
// Validate pattern
|
|
451
|
+
if (this.isWildcardPattern(subscription.pattern) && !this.config.enableWildcards) {
|
|
452
|
+
throw new Error("Wildcards are not enabled");
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Check if pattern contains wildcards
|
|
457
|
+
*/ isWildcardPattern(pattern) {
|
|
458
|
+
return pattern.includes("*");
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Compile wildcard pattern to RegExp
|
|
462
|
+
*/ compilePattern(pattern) {
|
|
463
|
+
// Check cache first
|
|
464
|
+
if (this.patternCache.has(pattern)) {
|
|
465
|
+
return this.patternCache.get(pattern);
|
|
466
|
+
}
|
|
467
|
+
// Convert wildcard pattern to regex
|
|
468
|
+
let regexPattern = pattern.replace(/\./g, "\\.").replace(/\*\*/g, ".*").replace(/\*/g, "[^.]*");
|
|
469
|
+
regexPattern = `^${regexPattern}$`;
|
|
470
|
+
const regex = new RegExp(regexPattern);
|
|
471
|
+
// Cache compiled pattern
|
|
472
|
+
if (this.patternCache.size < this.config.patternCacheSize) {
|
|
473
|
+
this.patternCache.set(pattern, regex);
|
|
474
|
+
}
|
|
475
|
+
return regex;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Hash pattern for fast lookup
|
|
479
|
+
*/ hashPattern(pattern) {
|
|
480
|
+
let hash = 0;
|
|
481
|
+
for(let i = 0; i < pattern.length; i++){
|
|
482
|
+
const char = pattern.charCodeAt(i);
|
|
483
|
+
hash = (hash << 5) - hash + char;
|
|
484
|
+
hash = hash & hash; // Convert to 32-bit integer
|
|
485
|
+
}
|
|
486
|
+
return hash;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Serialize event for queue storage
|
|
490
|
+
*/ serializeEvent(envelope) {
|
|
491
|
+
// High-performance binary serialization
|
|
492
|
+
const jsonData = JSON.stringify({
|
|
493
|
+
id: envelope.id,
|
|
494
|
+
type: envelope.type,
|
|
495
|
+
data: envelope.data,
|
|
496
|
+
priority: envelope.priority,
|
|
497
|
+
timestamp: envelope.timestamp.toString(),
|
|
498
|
+
correlationId: envelope.correlationId,
|
|
499
|
+
retryCount: envelope.retryCount
|
|
500
|
+
});
|
|
501
|
+
return new TextEncoder().encode(jsonData);
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Deserialize event from queue data
|
|
505
|
+
*/ deserializeEvent(data) {
|
|
506
|
+
const jsonData = new TextDecoder().decode(data);
|
|
507
|
+
const parsed = JSON.parse(jsonData);
|
|
508
|
+
return {
|
|
509
|
+
id: parsed.id,
|
|
510
|
+
type: parsed.type,
|
|
511
|
+
data: parsed.data,
|
|
512
|
+
metadata: {
|
|
513
|
+
source: "enhanced-event-bus",
|
|
514
|
+
version: "1.0",
|
|
515
|
+
contentType: "application/json",
|
|
516
|
+
encoding: "utf-8",
|
|
517
|
+
compressed: false,
|
|
518
|
+
size: data.length,
|
|
519
|
+
tags: [],
|
|
520
|
+
customFields: new Map()
|
|
521
|
+
},
|
|
522
|
+
priority: parsed.priority,
|
|
523
|
+
timestamp: BigInt(parsed.timestamp),
|
|
524
|
+
correlationId: parsed.correlationId,
|
|
525
|
+
retryCount: parsed.retryCount || 0
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Handle queue overflow
|
|
530
|
+
*/ handleQueueOverflow(envelope) {
|
|
531
|
+
this.logger.warn("Event queue overflow", {
|
|
532
|
+
eventType: envelope.type,
|
|
533
|
+
priority: envelope.priority
|
|
534
|
+
});
|
|
535
|
+
// Try to add to dead letter queue
|
|
536
|
+
if (this.config.enableDeadLetterQueue) {
|
|
537
|
+
const dlqEntry = this.serializeEvent({
|
|
538
|
+
...envelope,
|
|
539
|
+
data: {
|
|
540
|
+
originalEvent: envelope,
|
|
541
|
+
reason: "queue_overflow"
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
if (!this.deadLetterQueue.enqueue(dlqEntry)) {
|
|
545
|
+
this.logger.error("Dead letter queue also full", {
|
|
546
|
+
eventType: envelope.type
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
this.metrics.recordError("queue_overflow", new Error("Queue overflow"));
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Calculate data size for metrics
|
|
554
|
+
*/ calculateDataSize(data) {
|
|
555
|
+
return JSON.stringify(data).length;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Create root node for topic tree
|
|
559
|
+
*/ createRootNode() {
|
|
560
|
+
return {
|
|
561
|
+
segment: "",
|
|
562
|
+
children: new Map(),
|
|
563
|
+
subscriptions: new Set(),
|
|
564
|
+
wildcardSubscriptions: new Set(),
|
|
565
|
+
isWildcard: false
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Clean up empty topic tree nodes
|
|
570
|
+
*/ cleanupEmptyNodes(pattern) {
|
|
571
|
+
// Implementation for cleaning up empty nodes
|
|
572
|
+
// This is an optimization to prevent memory leaks
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Start metrics collection
|
|
576
|
+
*/ startMetricsCollection() {
|
|
577
|
+
this.metricsInterval = setInterval(()=>{
|
|
578
|
+
this.updateMetrics();
|
|
579
|
+
this.emit("metrics:updated", this.getMetrics());
|
|
580
|
+
}, this.config.metricsInterval);
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Update metrics
|
|
584
|
+
*/ updateMetrics() {
|
|
585
|
+
this.metrics.updateSubscriptionStats(this.subscriptions);
|
|
586
|
+
this.metrics.updateQueueStats(this.eventQueues);
|
|
587
|
+
this.metrics.updateTopicTreeStats(this.topicTree);
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Generate unique subscription ID
|
|
591
|
+
*/ generateSubscriptionId() {
|
|
592
|
+
return `sub_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Generate unique event ID
|
|
596
|
+
*/ generateEventId() {
|
|
597
|
+
return `evt_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Get comprehensive metrics
|
|
601
|
+
*/ getMetrics() {
|
|
602
|
+
return {
|
|
603
|
+
subscriptions: {
|
|
604
|
+
total: this.subscriptions.size,
|
|
605
|
+
byPriority: this.getSubscriptionsByPriority(),
|
|
606
|
+
withFilters: this.getSubscriptionsWithFilters(),
|
|
607
|
+
withTransforms: this.getSubscriptionsWithTransforms()
|
|
608
|
+
},
|
|
609
|
+
queues: Object.fromEntries(Array.from(this.eventQueues.entries()).map(([priority, queue])=>[
|
|
610
|
+
priority,
|
|
611
|
+
queue.getStats()
|
|
612
|
+
])),
|
|
613
|
+
deadLetterQueue: this.deadLetterQueue.getStats(),
|
|
614
|
+
topicTree: this.getTopicTreeStats(),
|
|
615
|
+
performance: this.metrics.getPerformanceStats(),
|
|
616
|
+
groups: {
|
|
617
|
+
total: this.subscriptionGroups.size,
|
|
618
|
+
totalMembers: Array.from(this.subscriptionGroups.values()).reduce((sum, group)=>sum + group.members.size, 0)
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Get subscriptions by priority
|
|
624
|
+
*/ getSubscriptionsByPriority() {
|
|
625
|
+
const byPriority = {};
|
|
626
|
+
for (const priority of Object.values(EventPriority)){
|
|
627
|
+
if (typeof priority === "number") {
|
|
628
|
+
byPriority[EventPriority[priority]] = 0;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
for (const subscription of this.subscriptions.values()){
|
|
632
|
+
const priorityName = EventPriority[subscription.priority];
|
|
633
|
+
byPriority[priorityName]++;
|
|
634
|
+
}
|
|
635
|
+
return byPriority;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Count subscriptions with filters
|
|
639
|
+
*/ getSubscriptionsWithFilters() {
|
|
640
|
+
return Array.from(this.subscriptions.values()).filter((sub)=>!!sub.filter).length;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Count subscriptions with transforms
|
|
644
|
+
*/ getSubscriptionsWithTransforms() {
|
|
645
|
+
return Array.from(this.subscriptions.values()).filter((sub)=>!!sub.transform).length;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Get topic tree statistics
|
|
649
|
+
*/ getTopicTreeStats() {
|
|
650
|
+
const stats = {
|
|
651
|
+
totalNodes: 0,
|
|
652
|
+
maxDepth: 0,
|
|
653
|
+
subscriptionNodes: 0,
|
|
654
|
+
wildcardNodes: 0
|
|
655
|
+
};
|
|
656
|
+
this.calculateTopicTreeStats(this.topicTree, 0, stats);
|
|
657
|
+
return stats;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Calculate topic tree statistics recursively
|
|
661
|
+
*/ calculateTopicTreeStats(node, depth, stats) {
|
|
662
|
+
stats.totalNodes++;
|
|
663
|
+
stats.maxDepth = Math.max(stats.maxDepth, depth);
|
|
664
|
+
if (node.subscriptions.size > 0) {
|
|
665
|
+
stats.subscriptionNodes++;
|
|
666
|
+
}
|
|
667
|
+
if (node.isWildcard) {
|
|
668
|
+
stats.wildcardNodes++;
|
|
669
|
+
}
|
|
670
|
+
for (const child of node.children.values()){
|
|
671
|
+
this.calculateTopicTreeStats(child, depth + 1, stats);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Graceful shutdown
|
|
676
|
+
*/ async shutdown() {
|
|
677
|
+
this.logger.info("Shutting down Enhanced Event Bus");
|
|
678
|
+
this.isRunning = false;
|
|
679
|
+
// Stop metrics collection
|
|
680
|
+
if (this.metricsInterval) {
|
|
681
|
+
clearInterval(this.metricsInterval);
|
|
682
|
+
}
|
|
683
|
+
// Stop event processors
|
|
684
|
+
for (const worker of this.processingWorkers){
|
|
685
|
+
worker.stop();
|
|
686
|
+
}
|
|
687
|
+
// Clear subscriptions
|
|
688
|
+
this.subscriptions.clear();
|
|
689
|
+
this.subscriptionGroups.clear();
|
|
690
|
+
this.emit("eventbus:shutdown");
|
|
691
|
+
this.logger.info("Enhanced Event Bus shutdown complete");
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Event processor for high-performance event delivery
|
|
696
|
+
*/ let EventProcessor = class EventProcessor {
|
|
697
|
+
workerId;
|
|
698
|
+
eventQueues;
|
|
699
|
+
subscriptions;
|
|
700
|
+
topicTree;
|
|
701
|
+
config;
|
|
702
|
+
logger;
|
|
703
|
+
isRunning = false;
|
|
704
|
+
processingInterval;
|
|
705
|
+
constructor(workerId, eventQueues, subscriptions, topicTree, config, logger){
|
|
706
|
+
this.workerId = workerId;
|
|
707
|
+
this.eventQueues = eventQueues;
|
|
708
|
+
this.subscriptions = subscriptions;
|
|
709
|
+
this.topicTree = topicTree;
|
|
710
|
+
this.config = config;
|
|
711
|
+
this.logger = logger;
|
|
712
|
+
}
|
|
713
|
+
start() {
|
|
714
|
+
this.isRunning = true;
|
|
715
|
+
this.processingInterval = setInterval(()=>{
|
|
716
|
+
this.processEvents();
|
|
717
|
+
}, 1); // 1ms processing interval
|
|
718
|
+
}
|
|
719
|
+
stop() {
|
|
720
|
+
this.isRunning = false;
|
|
721
|
+
if (this.processingInterval) {
|
|
722
|
+
clearInterval(this.processingInterval);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
processEvents() {
|
|
726
|
+
if (!this.isRunning) return;
|
|
727
|
+
// Process events by priority (critical first) in batches
|
|
728
|
+
for(let priority = 0; priority < 4; priority++){
|
|
729
|
+
const queue = this.eventQueues.get(priority);
|
|
730
|
+
if (!queue) continue;
|
|
731
|
+
// Process multiple events per cycle for better throughput
|
|
732
|
+
const batchSize = 32;
|
|
733
|
+
for(let i = 0; i < batchSize; i++){
|
|
734
|
+
const eventData = queue.dequeue();
|
|
735
|
+
if (!eventData) break;
|
|
736
|
+
// Process asynchronously to avoid blocking
|
|
737
|
+
setImmediate(()=>this.processEvent(eventData));
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
processEvent(eventData) {
|
|
742
|
+
// Implementation for processing individual events
|
|
743
|
+
// This would include subscription matching, filtering, transformation, and delivery
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
/**
|
|
747
|
+
* Metrics collector for event bus performance
|
|
748
|
+
*/ let EventBusMetrics = class EventBusMetrics {
|
|
749
|
+
eventCounts = new Map();
|
|
750
|
+
latencySamples = [];
|
|
751
|
+
errorCounts = new Map();
|
|
752
|
+
recordSubscription(subscription) {
|
|
753
|
+
this.incrementCounter("subscriptions_created");
|
|
754
|
+
}
|
|
755
|
+
recordUnsubscription(subscription) {
|
|
756
|
+
this.incrementCounter("subscriptions_removed");
|
|
757
|
+
}
|
|
758
|
+
recordEventEmitted(envelope, latency) {
|
|
759
|
+
this.incrementCounter("events_emitted");
|
|
760
|
+
this.recordLatency(latency);
|
|
761
|
+
}
|
|
762
|
+
recordError(type, error) {
|
|
763
|
+
this.incrementCounter(`error_${type}`);
|
|
764
|
+
}
|
|
765
|
+
updateSubscriptionStats(subscriptions) {
|
|
766
|
+
// Update subscription-related metrics
|
|
767
|
+
}
|
|
768
|
+
updateQueueStats(queues) {
|
|
769
|
+
// Update queue-related metrics
|
|
770
|
+
}
|
|
771
|
+
updateTopicTreeStats(topicTree) {
|
|
772
|
+
// Update topic tree metrics
|
|
773
|
+
}
|
|
774
|
+
getPerformanceStats() {
|
|
775
|
+
return {
|
|
776
|
+
counters: Object.fromEntries(Array.from(this.eventCounts.entries()).map(([key, value])=>[
|
|
777
|
+
key,
|
|
778
|
+
Number(value)
|
|
779
|
+
])),
|
|
780
|
+
latency: this.getLatencyStats(),
|
|
781
|
+
errors: Object.fromEntries(Array.from(this.errorCounts.entries()).map(([key, value])=>[
|
|
782
|
+
key,
|
|
783
|
+
Number(value)
|
|
784
|
+
]))
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
incrementCounter(name) {
|
|
788
|
+
const current = this.eventCounts.get(name) || BigInt(0);
|
|
789
|
+
this.eventCounts.set(name, current + BigInt(1));
|
|
790
|
+
}
|
|
791
|
+
recordLatency(latency) {
|
|
792
|
+
this.latencySamples.push(latency);
|
|
793
|
+
if (this.latencySamples.length > 10000) {
|
|
794
|
+
this.latencySamples.shift();
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
getLatencyStats() {
|
|
798
|
+
if (this.latencySamples.length === 0) {
|
|
799
|
+
return {};
|
|
800
|
+
}
|
|
801
|
+
const sorted = [
|
|
802
|
+
...this.latencySamples
|
|
803
|
+
].sort((a, b)=>a - b);
|
|
804
|
+
return {
|
|
805
|
+
min: sorted[0],
|
|
806
|
+
max: sorted[sorted.length - 1],
|
|
807
|
+
median: sorted[Math.floor(sorted.length / 2)],
|
|
808
|
+
p95: sorted[Math.floor(sorted.length * 0.95)],
|
|
809
|
+
p99: sorted[Math.floor(sorted.length * 0.99)],
|
|
810
|
+
avg: sorted.reduce((a, b)=>a + b, 0) / sorted.length
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
};
|
|
814
|
+
export { EventBusMetrics, EventProcessor };
|
|
815
|
+
|
|
816
|
+
//# sourceMappingURL=enhanced-event-bus.js.map
|