claude-flow 2.0.0-alpha.60 → 2.0.0-alpha.62
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/commands/sparc/analyzer.md +24 -77
- package/.claude/commands/sparc/architect.md +25 -76
- package/.claude/commands/sparc/batch-executor.md +28 -78
- package/.claude/commands/sparc/coder.md +28 -79
- package/.claude/commands/sparc/debugger.md +26 -76
- package/.claude/commands/sparc/designer.md +25 -75
- package/.claude/commands/sparc/documenter.md +26 -75
- package/.claude/commands/sparc/innovator.md +26 -76
- package/.claude/commands/sparc/memory-manager.md +28 -77
- package/.claude/commands/sparc/optimizer.md +26 -76
- package/.claude/commands/sparc/orchestrator.md +23 -74
- package/.claude/commands/sparc/researcher.md +26 -77
- package/.claude/commands/sparc/reviewer.md +26 -76
- package/.claude/commands/sparc/sparc-modes.md +38 -358
- package/.claude/commands/sparc/swarm-coordinator.md +28 -77
- package/.claude/commands/sparc/tdd.md +28 -78
- package/.claude/commands/sparc/tester.md +26 -76
- package/.claude/commands/sparc/workflow-manager.md +28 -77
- package/.claude/commands/swarm/analysis.md +14 -17
- package/.claude/commands/swarm/development.md +14 -16
- package/.claude/commands/swarm/examples.md +20 -53
- package/.claude/commands/swarm/maintenance.md +14 -17
- package/.claude/commands/swarm/optimization.md +15 -17
- package/.claude/commands/swarm/research.md +14 -17
- package/.claude/commands/swarm/testing.md +15 -17
- package/.claude/config.json +32 -11
- package/CHANGELOG.md +113 -0
- package/bin/claude-flow +1 -1
- package/dist/adapters/cliffy-node.d.ts.map +1 -1
- package/dist/adapters/cliffy-node.js +13 -7
- package/dist/adapters/cliffy-node.js.map +1 -1
- package/dist/agents/agent-manager.d.ts.map +1 -1
- package/dist/agents/agent-manager.js +77 -65
- package/dist/agents/agent-manager.js.map +1 -1
- package/dist/agents/agent-registry.d.ts.map +1 -1
- package/dist/agents/agent-registry.js +38 -30
- package/dist/agents/agent-registry.js.map +1 -1
- package/dist/api/claude-client.d.ts.map +1 -1
- package/dist/api/claude-client.js +22 -16
- package/dist/api/claude-client.js.map +1 -1
- package/dist/cli/agents/analyst.d.ts.map +1 -1
- package/dist/cli/agents/analyst.js +94 -114
- package/dist/cli/agents/analyst.js.map +1 -1
- package/dist/cli/agents/architect.d.ts.map +1 -1
- package/dist/cli/agents/architect.js +100 -114
- package/dist/cli/agents/architect.js.map +1 -1
- package/dist/cli/agents/base-agent.d.ts.map +1 -1
- package/dist/cli/agents/base-agent.js +27 -27
- package/dist/cli/agents/base-agent.js.map +1 -1
- package/dist/cli/agents/capabilities.d.ts.map +1 -1
- package/dist/cli/agents/capabilities.js +49 -51
- package/dist/cli/agents/capabilities.js.map +1 -1
- package/dist/cli/agents/coder.d.ts.map +1 -1
- package/dist/cli/agents/coder.js +92 -98
- package/dist/cli/agents/coder.js.map +1 -1
- package/dist/cli/agents/coordinator.d.ts.map +1 -1
- package/dist/cli/agents/coordinator.js +59 -64
- package/dist/cli/agents/coordinator.js.map +1 -1
- package/dist/cli/agents/hive-agents.d.ts.map +1 -1
- package/dist/cli/agents/hive-agents.js +22 -24
- package/dist/cli/agents/hive-agents.js.map +1 -1
- package/dist/cli/agents/index.d.ts.map +1 -1
- package/dist/cli/agents/index.js +17 -17
- package/dist/cli/agents/index.js.map +1 -1
- package/dist/cli/agents/researcher.d.ts.map +1 -1
- package/dist/cli/agents/researcher.js +41 -61
- package/dist/cli/agents/researcher.js.map +1 -1
- package/dist/cli/agents/tester.d.ts.map +1 -1
- package/dist/cli/agents/tester.js +78 -90
- package/dist/cli/agents/tester.js.map +1 -1
- package/dist/cli/cli-core.d.ts +4 -1
- package/dist/cli/cli-core.d.ts.map +1 -1
- package/dist/cli/cli-core.js +40 -39
- package/dist/cli/cli-core.js.map +1 -1
- package/dist/cli/command-registry.d.ts.map +1 -1
- package/dist/cli/command-registry.js +99 -74
- package/dist/cli/command-registry.js.map +1 -1
- package/dist/cli/commands/advanced-memory-commands.d.ts.map +1 -1
- package/dist/cli/commands/advanced-memory-commands.js +49 -40
- package/dist/cli/commands/advanced-memory-commands.js.map +1 -1
- package/dist/cli/commands/agent-simple.d.ts +3 -0
- package/dist/cli/commands/agent-simple.d.ts.map +1 -1
- package/dist/cli/commands/agent-simple.js +30 -27
- package/dist/cli/commands/agent-simple.js.map +1 -1
- package/dist/cli/commands/agent.d.ts.map +1 -1
- package/dist/cli/commands/agent.js +53 -40
- package/dist/cli/commands/agent.js.map +1 -1
- package/dist/cli/commands/claude-api.js +4 -4
- package/dist/cli/commands/claude-api.js.map +1 -1
- package/dist/cli/commands/claude.d.ts.map +1 -1
- package/dist/cli/commands/claude.js +2 -2
- package/dist/cli/commands/claude.js.map +1 -1
- package/dist/cli/commands/config-integration.d.ts +7 -1
- package/dist/cli/commands/config-integration.d.ts.map +1 -1
- package/dist/cli/commands/config-integration.js +18 -9
- package/dist/cli/commands/config-integration.js.map +1 -1
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/config.js +2 -3
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/enterprise.d.ts.map +1 -1
- package/dist/cli/commands/enterprise.js +115 -95
- package/dist/cli/commands/enterprise.js.map +1 -1
- package/dist/cli/commands/help-new.d.ts +7 -0
- package/dist/cli/commands/help-new.d.ts.map +1 -0
- package/dist/cli/commands/help-new.js +236 -0
- package/dist/cli/commands/help-new.js.map +1 -0
- package/dist/cli/commands/help.d.ts +2 -1
- package/dist/cli/commands/help.d.ts.map +1 -1
- package/dist/cli/commands/help.js +283 -133
- package/dist/cli/commands/help.js.map +1 -1
- package/dist/cli/commands/hive-mind/index.d.ts +1 -1
- package/dist/cli/commands/hive-mind/index.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/index.js +1 -1
- package/dist/cli/commands/hive-mind/index.js.map +1 -1
- package/dist/cli/commands/hive-mind/init.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/init.js.map +1 -1
- package/dist/cli/commands/hive-mind/optimize-memory.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/optimize-memory.js +35 -26
- package/dist/cli/commands/hive-mind/optimize-memory.js.map +1 -1
- package/dist/cli/commands/hive-mind/pause.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/pause.js +8 -6
- package/dist/cli/commands/hive-mind/pause.js.map +1 -1
- package/dist/cli/commands/hive-mind/ps.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/ps.js +17 -12
- package/dist/cli/commands/hive-mind/ps.js.map +1 -1
- package/dist/cli/commands/hive-mind/resume.js +12 -10
- package/dist/cli/commands/hive-mind/resume.js.map +1 -1
- package/dist/cli/commands/hive-mind/spawn.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/spawn.js +20 -11
- package/dist/cli/commands/hive-mind/spawn.js.map +1 -1
- package/dist/cli/commands/hive-mind/status.js +17 -22
- package/dist/cli/commands/hive-mind/status.js.map +1 -1
- package/dist/cli/commands/hive-mind/stop.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/stop.js +23 -15
- package/dist/cli/commands/hive-mind/stop.js.map +1 -1
- package/dist/cli/commands/hive-mind/task.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/task.js +25 -19
- package/dist/cli/commands/hive-mind/task.js.map +1 -1
- package/dist/cli/commands/hive-mind/wizard.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/wizard.js +86 -68
- package/dist/cli/commands/hive-mind/wizard.js.map +1 -1
- package/dist/cli/commands/hive.js +73 -38
- package/dist/cli/commands/hive.js.map +1 -1
- package/dist/cli/commands/hook-validator.d.ts.map +1 -1
- package/dist/cli/commands/hook-validator.js +4 -2
- package/dist/cli/commands/hook-validator.js.map +1 -1
- package/dist/cli/commands/hook.d.ts.map +1 -1
- package/dist/cli/commands/hook.js +8 -8
- package/dist/cli/commands/hook.js.map +1 -1
- package/dist/cli/commands/index.d.ts +1 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +850 -784
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/mcp.d.ts.map +1 -1
- package/dist/cli/commands/mcp.js +8 -16
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/memory.d.ts.map +1 -1
- package/dist/cli/commands/memory.js +8 -8
- package/dist/cli/commands/memory.js.map +1 -1
- package/dist/cli/commands/migrate.d.ts.map +1 -1
- package/dist/cli/commands/migrate.js +3 -3
- package/dist/cli/commands/migrate.js.map +1 -1
- package/dist/cli/commands/monitor.d.ts.map +1 -1
- package/dist/cli/commands/monitor.js +50 -34
- package/dist/cli/commands/monitor.js.map +1 -1
- package/dist/cli/commands/ruv-swarm.d.ts +7 -1
- package/dist/cli/commands/ruv-swarm.d.ts.map +1 -1
- package/dist/cli/commands/ruv-swarm.js +6 -6
- package/dist/cli/commands/ruv-swarm.js.map +1 -1
- package/dist/cli/commands/session.d.ts.map +1 -1
- package/dist/cli/commands/session.js +22 -17
- package/dist/cli/commands/session.js.map +1 -1
- package/dist/cli/commands/sparc.d.ts +1 -1
- package/dist/cli/commands/sparc.d.ts.map +1 -1
- package/dist/cli/commands/sparc.js +146 -126
- package/dist/cli/commands/sparc.js.map +1 -1
- package/dist/cli/commands/start/event-emitter.js +1 -1
- package/dist/cli/commands/start/event-emitter.js.map +1 -1
- package/dist/cli/commands/start/process-manager.d.ts.map +1 -1
- package/dist/cli/commands/start/process-manager.js +20 -18
- package/dist/cli/commands/start/process-manager.js.map +1 -1
- package/dist/cli/commands/start/process-ui-simple.d.ts +4 -0
- package/dist/cli/commands/start/process-ui-simple.d.ts.map +1 -1
- package/dist/cli/commands/start/process-ui-simple.js +2 -2
- package/dist/cli/commands/start/process-ui-simple.js.map +1 -1
- package/dist/cli/commands/start/start-command.d.ts.map +1 -1
- package/dist/cli/commands/start/start-command.js +27 -15
- package/dist/cli/commands/start/start-command.js.map +1 -1
- package/dist/cli/commands/start/system-monitor.d.ts +3 -0
- package/dist/cli/commands/start/system-monitor.d.ts.map +1 -1
- package/dist/cli/commands/start/system-monitor.js +16 -18
- package/dist/cli/commands/start/system-monitor.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +28 -33
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/swarm-spawn.d.ts.map +1 -1
- package/dist/cli/commands/swarm-spawn.js +1 -1
- package/dist/cli/commands/swarm-spawn.js.map +1 -1
- package/dist/cli/commands/swarm.d.ts +4 -1
- package/dist/cli/commands/swarm.d.ts.map +1 -1
- package/dist/cli/commands/swarm.js +23 -18
- package/dist/cli/commands/swarm.js.map +1 -1
- package/dist/cli/commands/task.d.ts.map +1 -1
- package/dist/cli/commands/task.js.map +1 -1
- package/dist/cli/commands/workflow.d.ts.map +1 -1
- package/dist/cli/commands/workflow.js +49 -45
- package/dist/cli/commands/workflow.js.map +1 -1
- package/dist/cli/completion.d.ts +3 -0
- package/dist/cli/completion.d.ts.map +1 -1
- package/dist/cli/completion.js +15 -5
- package/dist/cli/completion.js.map +1 -1
- package/dist/cli/formatter.d.ts +3 -0
- package/dist/cli/formatter.d.ts.map +1 -1
- package/dist/cli/formatter.js +3 -3
- package/dist/cli/formatter.js.map +1 -1
- package/dist/cli/help-formatter.d.ts +49 -0
- package/dist/cli/help-formatter.d.ts.map +1 -0
- package/dist/cli/help-formatter.js +108 -0
- package/dist/cli/help-formatter.js.map +1 -0
- package/dist/cli/index-remote.d.ts +4 -0
- package/dist/cli/index-remote.d.ts.map +1 -1
- package/dist/cli/index-remote.js +1 -1
- package/dist/cli/index-remote.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +32 -34
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/batch-tools.d.ts.map +1 -1
- package/dist/cli/init/batch-tools.js.map +1 -1
- package/dist/cli/init/claude-config.d.ts.map +1 -1
- package/dist/cli/init/claude-config.js +111 -106
- package/dist/cli/init/claude-config.js.map +1 -1
- package/dist/cli/init/directory-structure.d.ts.map +1 -1
- package/dist/cli/init/directory-structure.js +3 -3
- package/dist/cli/init/directory-structure.js.map +1 -1
- package/dist/cli/init/index.d.ts.map +1 -1
- package/dist/cli/init/index.js +1 -1
- package/dist/cli/init/index.js.map +1 -1
- package/dist/cli/init/sparc-environment.d.ts.map +1 -1
- package/dist/cli/init/sparc-environment.js +69 -69
- package/dist/cli/init/sparc-environment.js.map +1 -1
- package/dist/cli/init/swarm-commands.d.ts.map +1 -1
- package/dist/cli/init/swarm-commands.js +1 -1
- package/dist/cli/init/swarm-commands.js.map +1 -1
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +6 -6
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/node-compat.d.ts.map +1 -1
- package/dist/cli/node-compat.js +24 -18
- package/dist/cli/node-compat.js.map +1 -1
- package/dist/cli/node-repl.d.ts +4 -0
- package/dist/cli/node-repl.d.ts.map +1 -1
- package/dist/cli/node-repl.js +24 -30
- package/dist/cli/node-repl.js.map +1 -1
- package/dist/cli/repl.d.ts.map +1 -1
- package/dist/cli/repl.js +81 -70
- package/dist/cli/repl.js.map +1 -1
- package/dist/cli/runtime-detector.d.ts.map +1 -1
- package/dist/cli/runtime-detector.js +11 -7
- package/dist/cli/runtime-detector.js.map +1 -1
- package/dist/cli/simple-cli.d.ts +4 -0
- package/dist/cli/simple-cli.d.ts.map +1 -1
- package/dist/cli/simple-cli.js +109 -95
- package/dist/cli/simple-cli.js.map +1 -1
- package/dist/cli/simple-commands/analysis.d.ts.map +1 -1
- package/dist/cli/simple-commands/analysis.js +18 -11
- package/dist/cli/simple-commands/analysis.js.map +1 -1
- package/dist/cli/simple-commands/automation.js +32 -17
- package/dist/cli/simple-commands/automation.js.map +1 -1
- package/dist/cli/simple-commands/batch-manager.js +44 -39
- package/dist/cli/simple-commands/batch-manager.js.map +1 -1
- package/dist/cli/simple-commands/config.d.ts.map +1 -1
- package/dist/cli/simple-commands/config.js +22 -21
- package/dist/cli/simple-commands/config.js.map +1 -1
- package/dist/cli/simple-commands/coordination.d.ts.map +1 -1
- package/dist/cli/simple-commands/coordination.js +12 -12
- package/dist/cli/simple-commands/coordination.js.map +1 -1
- package/dist/cli/simple-commands/fix-hook-variables.d.ts.map +1 -1
- package/dist/cli/simple-commands/fix-hook-variables.js +36 -30
- package/dist/cli/simple-commands/fix-hook-variables.js.map +1 -1
- package/dist/cli/simple-commands/github.d.ts.map +1 -1
- package/dist/cli/simple-commands/github.js +15 -15
- package/dist/cli/simple-commands/github.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/auto-save-middleware.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/auto-save-middleware.js +12 -10
- package/dist/cli/simple-commands/hive-mind/auto-save-middleware.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/communication.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/communication.js +42 -45
- package/dist/cli/simple-commands/hive-mind/communication.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/core.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/core.js +97 -89
- package/dist/cli/simple-commands/hive-mind/core.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/db-optimizer.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/db-optimizer.js +114 -59
- package/dist/cli/simple-commands/hive-mind/db-optimizer.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/mcp-wrapper.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/mcp-wrapper.js +182 -103
- package/dist/cli/simple-commands/hive-mind/mcp-wrapper.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/memory.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/memory.js +105 -75
- package/dist/cli/simple-commands/hive-mind/memory.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/performance-optimizer.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/performance-optimizer.js +45 -43
- package/dist/cli/simple-commands/hive-mind/performance-optimizer.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/queen.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/queen.js +101 -88
- package/dist/cli/simple-commands/hive-mind/queen.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/session-manager.js +75 -53
- package/dist/cli/simple-commands/hive-mind/session-manager.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind-optimize.js +18 -18
- package/dist/cli/simple-commands/hive-mind-optimize.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind.js +207 -144
- package/dist/cli/simple-commands/hive-mind.js.map +1 -1
- package/dist/cli/simple-commands/hook-safety.d.ts.map +1 -1
- package/dist/cli/simple-commands/hook-safety.js +19 -19
- package/dist/cli/simple-commands/hook-safety.js.map +1 -1
- package/dist/cli/simple-commands/hooks.d.ts.map +1 -1
- package/dist/cli/simple-commands/hooks.js +85 -71
- package/dist/cli/simple-commands/hooks.js.map +1 -1
- package/dist/cli/simple-commands/init/batch-init.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/batch-init.js +62 -55
- package/dist/cli/simple-commands/init/batch-init.js.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/optimized-slash-commands.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +2 -2
- package/dist/cli/simple-commands/init/claude-commands/optimized-slash-commands.js.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/optimized-sparc-commands.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +58 -50
- package/dist/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/slash-commands.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/slash-commands.js.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/sparc-commands.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/sparc-commands.js +34 -28
- package/dist/cli/simple-commands/init/claude-commands/sparc-commands.js.map +1 -1
- package/dist/cli/simple-commands/init/executable-wrapper.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/executable-wrapper.js +7 -4
- package/dist/cli/simple-commands/init/executable-wrapper.js.map +1 -1
- package/dist/cli/simple-commands/init/gitignore-updater.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/gitignore-updater.js +10 -9
- package/dist/cli/simple-commands/init/gitignore-updater.js.map +1 -1
- package/dist/cli/simple-commands/init/help.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/help.js.map +1 -1
- package/dist/cli/simple-commands/init/index.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/index.js +159 -103
- package/dist/cli/simple-commands/init/index.js.map +1 -1
- package/dist/cli/simple-commands/init/performance-monitor.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/performance-monitor.js +17 -18
- package/dist/cli/simple-commands/init/performance-monitor.js.map +1 -1
- package/dist/cli/simple-commands/init/rollback/backup-manager.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/rollback/backup-manager.js +19 -25
- package/dist/cli/simple-commands/init/rollback/backup-manager.js.map +1 -1
- package/dist/cli/simple-commands/init/rollback/index.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/rollback/index.js +18 -15
- package/dist/cli/simple-commands/init/rollback/index.js.map +1 -1
- package/dist/cli/simple-commands/init/rollback/recovery-manager.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/rollback/recovery-manager.js +49 -68
- package/dist/cli/simple-commands/init/rollback/recovery-manager.js.map +1 -1
- package/dist/cli/simple-commands/init/rollback/rollback-executor.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/rollback/rollback-executor.js +16 -24
- package/dist/cli/simple-commands/init/rollback/rollback-executor.js.map +1 -1
- package/dist/cli/simple-commands/init/rollback/state-tracker.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/rollback/state-tracker.js +25 -25
- package/dist/cli/simple-commands/init/rollback/state-tracker.js.map +1 -1
- package/dist/cli/simple-commands/init/sparc/roomodes-config.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/sparc/roomodes-config.js +57 -57
- package/dist/cli/simple-commands/init/sparc/roomodes-config.js.map +1 -1
- package/dist/cli/simple-commands/init/sparc/workflows.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/sparc/workflows.js +21 -21
- package/dist/cli/simple-commands/init/sparc/workflows.js.map +1 -1
- package/dist/cli/simple-commands/init/sparc-structure.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/sparc-structure.js +1 -1
- package/dist/cli/simple-commands/init/sparc-structure.js.map +1 -1
- package/dist/cli/simple-commands/init/templates/enhanced-templates.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/templates/enhanced-templates.js +69 -78
- package/dist/cli/simple-commands/init/templates/enhanced-templates.js.map +1 -1
- package/dist/cli/simple-commands/init/templates/sparc-modes.js +2 -2
- package/dist/cli/simple-commands/init/validation/config-validator.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/config-validator.js +12 -16
- package/dist/cli/simple-commands/init/validation/config-validator.js.map +1 -1
- package/dist/cli/simple-commands/init/validation/health-checker.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/health-checker.js +39 -41
- package/dist/cli/simple-commands/init/validation/health-checker.js.map +1 -1
- package/dist/cli/simple-commands/init/validation/index.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/index.js +8 -8
- package/dist/cli/simple-commands/init/validation/index.js.map +1 -1
- package/dist/cli/simple-commands/init/validation/mode-validator.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/mode-validator.js +12 -12
- package/dist/cli/simple-commands/init/validation/mode-validator.js.map +1 -1
- package/dist/cli/simple-commands/init/validation/post-init-validator.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/post-init-validator.js +13 -13
- package/dist/cli/simple-commands/init/validation/post-init-validator.js.map +1 -1
- package/dist/cli/simple-commands/init/validation/pre-init-validator.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/pre-init-validator.js +19 -24
- package/dist/cli/simple-commands/init/validation/pre-init-validator.js.map +1 -1
- package/dist/cli/simple-commands/mcp.js +2 -2
- package/dist/cli/simple-commands/mcp.js.map +1 -1
- package/dist/cli/simple-commands/memory.js +4 -4
- package/dist/cli/simple-commands/memory.js.map +1 -1
- package/dist/cli/simple-commands/migrate-hooks.d.ts.map +1 -1
- package/dist/cli/simple-commands/migrate-hooks.js +3 -3
- package/dist/cli/simple-commands/migrate-hooks.js.map +1 -1
- package/dist/cli/simple-commands/monitor.d.ts.map +1 -1
- package/dist/cli/simple-commands/monitor.js +34 -26
- package/dist/cli/simple-commands/monitor.js.map +1 -1
- package/dist/cli/simple-commands/process-ui-enhanced.d.ts.map +1 -1
- package/dist/cli/simple-commands/process-ui-enhanced.js +53 -39
- package/dist/cli/simple-commands/process-ui-enhanced.js.map +1 -1
- package/dist/cli/simple-commands/sparc-modes/index.js +11 -11
- package/dist/cli/simple-commands/sparc-modes/index.js.map +1 -1
- package/dist/cli/simple-commands/sparc-modes/swarm.js +50 -50
- package/dist/cli/simple-commands/sparc.d.ts.map +1 -1
- package/dist/cli/simple-commands/sparc.js +21 -11
- package/dist/cli/simple-commands/sparc.js.map +1 -1
- package/dist/cli/simple-commands/start-ui.d.ts.map +1 -1
- package/dist/cli/simple-commands/start-ui.js +5 -3
- package/dist/cli/simple-commands/start-ui.js.map +1 -1
- package/dist/cli/simple-commands/start-wrapper.d.ts.map +1 -1
- package/dist/cli/simple-commands/start-wrapper.js +1 -1
- package/dist/cli/simple-commands/start-wrapper.js.map +1 -1
- package/dist/cli/simple-commands/status.js +14 -14
- package/dist/cli/simple-commands/status.js.map +1 -1
- package/dist/cli/simple-commands/swarm-executor.d.ts.map +1 -1
- package/dist/cli/simple-commands/swarm-executor.js +19 -19
- package/dist/cli/simple-commands/swarm-executor.js.map +1 -1
- package/dist/cli/simple-commands/swarm-metrics-integration.d.ts.map +1 -1
- package/dist/cli/simple-commands/swarm-metrics-integration.js +30 -21
- package/dist/cli/simple-commands/swarm-metrics-integration.js.map +1 -1
- package/dist/cli/simple-commands/swarm-webui-integration.d.ts.map +1 -1
- package/dist/cli/simple-commands/swarm-webui-integration.js +30 -18
- package/dist/cli/simple-commands/swarm-webui-integration.js.map +1 -1
- package/dist/cli/simple-commands/swarm.d.ts +1 -1
- package/dist/cli/simple-commands/swarm.d.ts.map +1 -1
- package/dist/cli/simple-commands/swarm.js +81 -76
- package/dist/cli/simple-commands/swarm.js.map +1 -1
- package/dist/cli/simple-commands/training.d.ts.map +1 -1
- package/dist/cli/simple-commands/training.js +7 -7
- package/dist/cli/simple-commands/training.js.map +1 -1
- package/dist/cli/simple-commands/web-server.d.ts.map +1 -1
- package/dist/cli/simple-commands/web-server.js +68 -66
- package/dist/cli/simple-commands/web-server.js.map +1 -1
- package/dist/cli/simple-mcp.d.ts.map +1 -1
- package/dist/cli/simple-mcp.js +2 -4
- package/dist/cli/simple-mcp.js.map +1 -1
- package/dist/cli/simple-orchestrator.d.ts +3 -0
- package/dist/cli/simple-orchestrator.d.ts.map +1 -1
- package/dist/cli/simple-orchestrator.js +36 -35
- package/dist/cli/simple-orchestrator.js.map +1 -1
- package/dist/cli/ui/compatible-ui.d.ts +4 -0
- package/dist/cli/ui/compatible-ui.d.ts.map +1 -1
- package/dist/cli/ui/compatible-ui.js +9 -8
- package/dist/cli/ui/compatible-ui.js.map +1 -1
- package/dist/cli/ui/fallback-handler.d.ts.map +1 -1
- package/dist/cli/ui/fallback-handler.js +4 -4
- package/dist/cli/ui/fallback-handler.js.map +1 -1
- package/dist/cli/ui/index.d.ts +2 -2
- package/dist/cli/ui/index.d.ts.map +1 -1
- package/dist/cli/ui/index.js +3 -3
- package/dist/cli/ui/index.js.map +1 -1
- package/dist/cli/utils/environment-detector.d.ts.map +1 -1
- package/dist/cli/utils/environment-detector.js +13 -11
- package/dist/cli/utils/environment-detector.js.map +1 -1
- package/dist/cli/utils/interactive-detector.d.ts.map +1 -1
- package/dist/cli/utils/interactive-detector.js +1 -1
- package/dist/cli/utils/interactive-detector.js.map +1 -1
- package/dist/cli/utils/prompt-defaults.d.ts.map +1 -1
- package/dist/cli/utils/prompt-defaults.js +6 -7
- package/dist/cli/utils/prompt-defaults.js.map +1 -1
- package/dist/cli/utils/safe-interactive.d.ts.map +1 -1
- package/dist/cli/utils/safe-interactive.js +7 -6
- package/dist/cli/utils/safe-interactive.js.map +1 -1
- package/dist/cli/utils.d.ts.map +1 -1
- package/dist/cli/utils.js +58 -50
- package/dist/cli/utils.js.map +1 -1
- package/dist/cli/validation-helper.d.ts +27 -0
- package/dist/cli/validation-helper.d.ts.map +1 -0
- package/dist/cli/validation-helper.js +72 -0
- package/dist/cli/validation-helper.js.map +1 -0
- package/dist/communication/message-bus.d.ts.map +1 -1
- package/dist/communication/message-bus.js +80 -74
- package/dist/communication/message-bus.js.map +1 -1
- package/dist/config/config-manager.d.ts +3 -0
- package/dist/config/config-manager.d.ts.map +1 -1
- package/dist/config/config-manager.js +23 -6
- package/dist/config/config-manager.js.map +1 -1
- package/dist/config/ruv-swarm-config.d.ts +6 -0
- package/dist/config/ruv-swarm-config.d.ts.map +1 -1
- package/dist/config/ruv-swarm-config.js +37 -22
- package/dist/config/ruv-swarm-config.js.map +1 -1
- package/dist/config/ruv-swarm-integration.d.ts.map +1 -1
- package/dist/config/ruv-swarm-integration.js +21 -21
- package/dist/config/ruv-swarm-integration.js.map +1 -1
- package/dist/constants/agent-types.d.ts +4 -4
- package/dist/constants/agent-types.d.ts.map +1 -1
- package/dist/constants/agent-types.js +4 -4
- package/dist/constants/agent-types.js.map +1 -1
- package/dist/coordination/advanced-scheduler.d.ts.map +1 -1
- package/dist/coordination/advanced-scheduler.js +6 -10
- package/dist/coordination/advanced-scheduler.js.map +1 -1
- package/dist/coordination/advanced-task-executor.d.ts.map +1 -1
- package/dist/coordination/advanced-task-executor.js +33 -33
- package/dist/coordination/advanced-task-executor.js.map +1 -1
- package/dist/coordination/background-executor.d.ts.map +1 -1
- package/dist/coordination/background-executor.js +17 -16
- package/dist/coordination/background-executor.js.map +1 -1
- package/dist/coordination/circuit-breaker.d.ts.map +1 -1
- package/dist/coordination/circuit-breaker.js +3 -0
- package/dist/coordination/circuit-breaker.js.map +1 -1
- package/dist/coordination/conflict-resolution.d.ts.map +1 -1
- package/dist/coordination/conflict-resolution.js +10 -8
- package/dist/coordination/conflict-resolution.js.map +1 -1
- package/dist/coordination/dependency-graph.d.ts.map +1 -1
- package/dist/coordination/dependency-graph.js +4 -3
- package/dist/coordination/dependency-graph.js.map +1 -1
- package/dist/coordination/hive-orchestrator.d.ts.map +1 -1
- package/dist/coordination/hive-orchestrator.js +29 -25
- package/dist/coordination/hive-orchestrator.js.map +1 -1
- package/dist/coordination/hive-protocol.d.ts.map +1 -1
- package/dist/coordination/hive-protocol.js +22 -23
- package/dist/coordination/hive-protocol.js.map +1 -1
- package/dist/coordination/index.d.ts +1 -1
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +1 -1
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/load-balancer.d.ts.map +1 -1
- package/dist/coordination/load-balancer.js +55 -56
- package/dist/coordination/load-balancer.js.map +1 -1
- package/dist/coordination/manager.d.ts.map +1 -1
- package/dist/coordination/manager.js +2 -8
- package/dist/coordination/manager.js.map +1 -1
- package/dist/coordination/messaging.d.ts.map +1 -1
- package/dist/coordination/messaging.js +4 -4
- package/dist/coordination/messaging.js.map +1 -1
- package/dist/coordination/metrics.d.ts.map +1 -1
- package/dist/coordination/metrics.js +11 -9
- package/dist/coordination/metrics.js.map +1 -1
- package/dist/coordination/resources.d.ts.map +1 -1
- package/dist/coordination/resources.js +10 -6
- package/dist/coordination/resources.js.map +1 -1
- package/dist/coordination/scheduler.d.ts.map +1 -1
- package/dist/coordination/scheduler.js +4 -4
- package/dist/coordination/scheduler.js.map +1 -1
- package/dist/coordination/swarm-coordinator.d.ts.map +1 -1
- package/dist/coordination/swarm-coordinator.js +32 -34
- package/dist/coordination/swarm-coordinator.js.map +1 -1
- package/dist/coordination/swarm-monitor.d.ts.map +1 -1
- package/dist/coordination/swarm-monitor.js +17 -17
- package/dist/coordination/swarm-monitor.js.map +1 -1
- package/dist/coordination/work-stealing.d.ts.map +1 -1
- package/dist/coordination/work-stealing.js +3 -0
- package/dist/coordination/work-stealing.js.map +1 -1
- package/dist/core/config.d.ts +4 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +28 -31
- package/dist/core/config.js.map +1 -1
- package/dist/core/event-bus.d.ts +3 -0
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/json-persistence.d.ts +3 -0
- package/dist/core/json-persistence.d.ts.map +1 -1
- package/dist/core/json-persistence.js +19 -23
- package/dist/core/json-persistence.js.map +1 -1
- package/dist/core/logger.d.ts +3 -0
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +2 -6
- package/dist/core/logger.js.map +1 -1
- package/dist/core/orchestrator-fixed.d.ts.map +1 -1
- package/dist/core/orchestrator-fixed.js +4 -1
- package/dist/core/orchestrator-fixed.js.map +1 -1
- package/dist/core/orchestrator.d.ts.map +1 -1
- package/dist/core/orchestrator.js +66 -33
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/core/persistence.d.ts +3 -0
- package/dist/core/persistence.d.ts.map +1 -1
- package/dist/core/persistence.js +25 -19
- package/dist/core/persistence.js.map +1 -1
- package/dist/enterprise/analytics-manager.d.ts.map +1 -1
- package/dist/enterprise/analytics-manager.js +141 -134
- package/dist/enterprise/analytics-manager.js.map +1 -1
- package/dist/enterprise/audit-manager.d.ts.map +1 -1
- package/dist/enterprise/audit-manager.js +144 -122
- package/dist/enterprise/audit-manager.js.map +1 -1
- package/dist/enterprise/cloud-manager.d.ts.map +1 -1
- package/dist/enterprise/cloud-manager.js +104 -99
- package/dist/enterprise/cloud-manager.js.map +1 -1
- package/dist/enterprise/deployment-manager.d.ts.map +1 -1
- package/dist/enterprise/deployment-manager.js +104 -97
- package/dist/enterprise/deployment-manager.js.map +1 -1
- package/dist/enterprise/index.d.ts +6 -6
- package/dist/enterprise/index.d.ts.map +1 -1
- package/dist/enterprise/project-manager.d.ts.map +1 -1
- package/dist/enterprise/project-manager.js +74 -66
- package/dist/enterprise/project-manager.js.map +1 -1
- package/dist/enterprise/security-manager.d.ts.map +1 -1
- package/dist/enterprise/security-manager.js +137 -129
- package/dist/enterprise/security-manager.js.map +1 -1
- package/dist/hive-mind/core/Agent.d.ts.map +1 -1
- package/dist/hive-mind/core/Agent.js +36 -36
- package/dist/hive-mind/core/Agent.js.map +1 -1
- package/dist/hive-mind/core/Communication.d.ts.map +1 -1
- package/dist/hive-mind/core/Communication.js +17 -17
- package/dist/hive-mind/core/Communication.js.map +1 -1
- package/dist/hive-mind/core/DatabaseManager.d.ts.map +1 -1
- package/dist/hive-mind/core/DatabaseManager.js +104 -58
- package/dist/hive-mind/core/DatabaseManager.js.map +1 -1
- package/dist/hive-mind/core/HiveMind.d.ts.map +1 -1
- package/dist/hive-mind/core/HiveMind.js +35 -35
- package/dist/hive-mind/core/HiveMind.js.map +1 -1
- package/dist/hive-mind/core/Memory.d.ts.map +1 -1
- package/dist/hive-mind/core/Memory.js +78 -71
- package/dist/hive-mind/core/Memory.js.map +1 -1
- package/dist/hive-mind/core/MemoryMonitor.d.ts.map +1 -1
- package/dist/hive-mind/core/MemoryMonitor.js +38 -38
- package/dist/hive-mind/core/MemoryMonitor.js.map +1 -1
- package/dist/hive-mind/core/Queen.d.ts.map +1 -1
- package/dist/hive-mind/core/Queen.js +110 -47
- package/dist/hive-mind/core/Queen.js.map +1 -1
- package/dist/hive-mind/integration/ConsensusEngine.d.ts.map +1 -1
- package/dist/hive-mind/integration/ConsensusEngine.js +25 -23
- package/dist/hive-mind/integration/ConsensusEngine.js.map +1 -1
- package/dist/hive-mind/integration/MCPToolWrapper.d.ts.map +1 -1
- package/dist/hive-mind/integration/MCPToolWrapper.js.map +1 -1
- package/dist/hive-mind/integration/SwarmOrchestrator.d.ts.map +1 -1
- package/dist/hive-mind/integration/SwarmOrchestrator.js +60 -58
- package/dist/hive-mind/integration/SwarmOrchestrator.js.map +1 -1
- package/dist/hive-mind/types.d.ts.map +1 -1
- package/dist/integration/mock-components.d.ts.map +1 -1
- package/dist/integration/mock-components.js +21 -21
- package/dist/integration/mock-components.js.map +1 -1
- package/dist/integration/system-integration.d.ts.map +1 -1
- package/dist/integration/system-integration.js +29 -12
- package/dist/integration/system-integration.js.map +1 -1
- package/dist/mcp/auth.d.ts +1 -1
- package/dist/mcp/auth.d.ts.map +1 -1
- package/dist/mcp/auth.js +8 -1
- package/dist/mcp/auth.js.map +1 -1
- package/dist/mcp/claude-code-wrapper.d.ts.map +1 -1
- package/dist/mcp/claude-code-wrapper.js +169 -68
- package/dist/mcp/claude-code-wrapper.js.map +1 -1
- package/dist/mcp/claude-flow-tools.d.ts.map +1 -1
- package/dist/mcp/claude-flow-tools.js +42 -3
- package/dist/mcp/claude-flow-tools.js.map +1 -1
- package/dist/mcp/client.d.ts.map +1 -1
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/index.d.ts +6 -6
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +9 -9
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/integrate-wrapper.d.ts.map +1 -1
- package/dist/mcp/integrate-wrapper.js +5 -7
- package/dist/mcp/integrate-wrapper.js.map +1 -1
- package/dist/mcp/lifecycle-manager.d.ts.map +1 -1
- package/dist/mcp/lifecycle-manager.js +8 -7
- package/dist/mcp/lifecycle-manager.js.map +1 -1
- package/dist/mcp/load-balancer.d.ts.map +1 -1
- package/dist/mcp/load-balancer.js +5 -1
- package/dist/mcp/load-balancer.js.map +1 -1
- package/dist/mcp/orchestration-integration.d.ts.map +1 -1
- package/dist/mcp/orchestration-integration.js +22 -9
- package/dist/mcp/orchestration-integration.js.map +1 -1
- package/dist/mcp/performance-monitor.d.ts.map +1 -1
- package/dist/mcp/performance-monitor.js +22 -19
- package/dist/mcp/performance-monitor.js.map +1 -1
- package/dist/mcp/protocol-manager.d.ts.map +1 -1
- package/dist/mcp/protocol-manager.js +8 -19
- package/dist/mcp/protocol-manager.js.map +1 -1
- package/dist/mcp/recovery/connection-health-monitor.d.ts.map +1 -1
- package/dist/mcp/recovery/connection-health-monitor.js +5 -5
- package/dist/mcp/recovery/connection-health-monitor.js.map +1 -1
- package/dist/mcp/recovery/connection-state-manager.d.ts +4 -0
- package/dist/mcp/recovery/connection-state-manager.d.ts.map +1 -1
- package/dist/mcp/recovery/connection-state-manager.js +13 -13
- package/dist/mcp/recovery/connection-state-manager.js.map +1 -1
- package/dist/mcp/recovery/fallback-coordinator.d.ts.map +1 -1
- package/dist/mcp/recovery/fallback-coordinator.js +5 -5
- package/dist/mcp/recovery/fallback-coordinator.js.map +1 -1
- package/dist/mcp/recovery/index.d.ts +4 -4
- package/dist/mcp/recovery/index.d.ts.map +1 -1
- package/dist/mcp/recovery/index.js +4 -4
- package/dist/mcp/recovery/index.js.map +1 -1
- package/dist/mcp/recovery/reconnection-manager.d.ts.map +1 -1
- package/dist/mcp/recovery/reconnection-manager.js +1 -1
- package/dist/mcp/recovery/reconnection-manager.js.map +1 -1
- package/dist/mcp/recovery/recovery-manager.d.ts.map +1 -1
- package/dist/mcp/recovery/recovery-manager.js +2 -4
- package/dist/mcp/recovery/recovery-manager.js.map +1 -1
- package/dist/mcp/router.d.ts.map +1 -1
- package/dist/mcp/router.js +3 -0
- package/dist/mcp/router.js.map +1 -1
- package/dist/mcp/ruv-swarm-tools.d.ts.map +1 -1
- package/dist/mcp/ruv-swarm-tools.js +132 -102
- package/dist/mcp/ruv-swarm-tools.js.map +1 -1
- package/dist/mcp/server-with-wrapper.d.ts +3 -0
- package/dist/mcp/server-with-wrapper.d.ts.map +1 -1
- package/dist/mcp/server-with-wrapper.js +2 -3
- package/dist/mcp/server-with-wrapper.js.map +1 -1
- package/dist/mcp/server-wrapper-mode.d.ts +5 -0
- package/dist/mcp/server-wrapper-mode.d.ts.map +1 -1
- package/dist/mcp/server-wrapper-mode.js +2 -3
- package/dist/mcp/server-wrapper-mode.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +12 -7
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session-manager.d.ts.map +1 -1
- package/dist/mcp/session-manager.js +4 -3
- package/dist/mcp/session-manager.js.map +1 -1
- package/dist/mcp/sparc-modes.d.ts.map +1 -1
- package/dist/mcp/sparc-modes.js +15 -15
- package/dist/mcp/sparc-modes.js.map +1 -1
- package/dist/mcp/swarm-tools.d.ts.map +1 -1
- package/dist/mcp/swarm-tools.js +100 -80
- package/dist/mcp/swarm-tools.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +28 -12
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/transports/base.d.ts.map +1 -1
- package/dist/mcp/transports/base.js +3 -0
- package/dist/mcp/transports/base.js.map +1 -1
- package/dist/mcp/transports/http.d.ts +3 -0
- package/dist/mcp/transports/http.d.ts.map +1 -1
- package/dist/mcp/transports/http.js +3 -3
- package/dist/mcp/transports/http.js.map +1 -1
- package/dist/mcp/transports/stdio.d.ts +3 -0
- package/dist/mcp/transports/stdio.d.ts.map +1 -1
- package/dist/mcp/transports/stdio.js +3 -0
- package/dist/mcp/transports/stdio.js.map +1 -1
- package/dist/memory/advanced-memory-manager.d.ts.map +1 -1
- package/dist/memory/advanced-memory-manager.js +109 -100
- package/dist/memory/advanced-memory-manager.js.map +1 -1
- package/dist/memory/backends/base.d.ts.map +1 -1
- package/dist/memory/backends/base.js +3 -0
- package/dist/memory/backends/base.js.map +1 -1
- package/dist/memory/backends/markdown.d.ts +3 -0
- package/dist/memory/backends/markdown.d.ts.map +1 -1
- package/dist/memory/backends/markdown.js +8 -8
- package/dist/memory/backends/markdown.js.map +1 -1
- package/dist/memory/backends/sqlite.d.ts +3 -0
- package/dist/memory/backends/sqlite.d.ts.map +1 -1
- package/dist/memory/backends/sqlite.js +6 -2
- package/dist/memory/backends/sqlite.js.map +1 -1
- package/dist/memory/cache.d.ts.map +1 -1
- package/dist/memory/cache.js +5 -3
- package/dist/memory/cache.js.map +1 -1
- package/dist/memory/distributed-memory.d.ts.map +1 -1
- package/dist/memory/distributed-memory.js +27 -28
- package/dist/memory/distributed-memory.js.map +1 -1
- package/dist/memory/fallback-store.d.ts.map +1 -1
- package/dist/memory/fallback-store.js.map +1 -1
- package/dist/memory/in-memory-store.d.ts.map +1 -1
- package/dist/memory/in-memory-store.js +8 -8
- package/dist/memory/in-memory-store.js.map +1 -1
- package/dist/memory/indexer.d.ts.map +1 -1
- package/dist/memory/indexer.js +4 -1
- package/dist/memory/indexer.js.map +1 -1
- package/dist/memory/manager.d.ts.map +1 -1
- package/dist/memory/manager.js +17 -20
- package/dist/memory/manager.js.map +1 -1
- package/dist/memory/sqlite-store.js +12 -8
- package/dist/memory/sqlite-store.js.map +1 -1
- package/dist/memory/swarm-memory.d.ts.map +1 -1
- package/dist/memory/swarm-memory.js +37 -44
- package/dist/memory/swarm-memory.js.map +1 -1
- package/dist/migration/index.d.ts +4 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +8 -8
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/logger.d.ts.map +1 -1
- package/dist/migration/logger.js +5 -5
- package/dist/migration/logger.js.map +1 -1
- package/dist/migration/migration-analyzer.d.ts +3 -0
- package/dist/migration/migration-analyzer.d.ts.map +1 -1
- package/dist/migration/migration-analyzer.js +25 -20
- package/dist/migration/migration-analyzer.js.map +1 -1
- package/dist/migration/migration-runner.d.ts.map +1 -1
- package/dist/migration/migration-runner.js +35 -29
- package/dist/migration/migration-runner.js.map +1 -1
- package/dist/migration/migration-validator.d.ts +3 -0
- package/dist/migration/migration-validator.d.ts.map +1 -1
- package/dist/migration/migration-validator.js +22 -26
- package/dist/migration/migration-validator.js.map +1 -1
- package/dist/migration/progress-reporter.d.ts +3 -0
- package/dist/migration/progress-reporter.d.ts.map +1 -1
- package/dist/migration/progress-reporter.js +8 -8
- package/dist/migration/progress-reporter.js.map +1 -1
- package/dist/migration/rollback-manager.d.ts +3 -0
- package/dist/migration/rollback-manager.d.ts.map +1 -1
- package/dist/migration/rollback-manager.js +29 -26
- package/dist/migration/rollback-manager.js.map +1 -1
- package/dist/monitoring/diagnostics.d.ts.map +1 -1
- package/dist/monitoring/diagnostics.js +49 -37
- package/dist/monitoring/diagnostics.js.map +1 -1
- package/dist/monitoring/health-check.d.ts.map +1 -1
- package/dist/monitoring/health-check.js +24 -25
- package/dist/monitoring/health-check.js.map +1 -1
- package/dist/monitoring/real-time-monitor.d.ts.map +1 -1
- package/dist/monitoring/real-time-monitor.js +71 -58
- package/dist/monitoring/real-time-monitor.js.map +1 -1
- package/dist/resources/resource-manager.d.ts.map +1 -1
- package/dist/resources/resource-manager.js +96 -83
- package/dist/resources/resource-manager.js.map +1 -1
- package/dist/swarm/claude-flow-executor.d.ts.map +1 -1
- package/dist/swarm/claude-flow-executor.js +37 -31
- package/dist/swarm/claude-flow-executor.js.map +1 -1
- package/dist/swarm/coordinator.d.ts.map +1 -1
- package/dist/swarm/coordinator.js +330 -280
- package/dist/swarm/coordinator.js.map +1 -1
- package/dist/swarm/direct-executor.d.ts.map +1 -1
- package/dist/swarm/direct-executor.js +44 -37
- package/dist/swarm/direct-executor.js.map +1 -1
- package/dist/swarm/executor-v2.d.ts.map +1 -1
- package/dist/swarm/executor-v2.js +28 -27
- package/dist/swarm/executor-v2.js.map +1 -1
- package/dist/swarm/executor.d.ts +3 -0
- package/dist/swarm/executor.d.ts.map +1 -1
- package/dist/swarm/executor.js +58 -52
- package/dist/swarm/executor.js.map +1 -1
- package/dist/swarm/index.d.ts.map +1 -1
- package/dist/swarm/index.js +2 -2
- package/dist/swarm/index.js.map +1 -1
- package/dist/swarm/json-output-aggregator.d.ts.map +1 -1
- package/dist/swarm/json-output-aggregator.js +20 -19
- package/dist/swarm/json-output-aggregator.js.map +1 -1
- package/dist/swarm/memory.d.ts.map +1 -1
- package/dist/swarm/memory.js +67 -67
- package/dist/swarm/memory.js.map +1 -1
- package/dist/swarm/optimizations/async-file-manager.d.ts +4 -0
- package/dist/swarm/optimizations/async-file-manager.d.ts.map +1 -1
- package/dist/swarm/optimizations/async-file-manager.js +19 -23
- package/dist/swarm/optimizations/async-file-manager.js.map +1 -1
- package/dist/swarm/optimizations/circular-buffer.d.ts.map +1 -1
- package/dist/swarm/optimizations/circular-buffer.js +2 -4
- package/dist/swarm/optimizations/circular-buffer.js.map +1 -1
- package/dist/swarm/optimizations/connection-pool.d.ts.map +1 -1
- package/dist/swarm/optimizations/connection-pool.js +12 -13
- package/dist/swarm/optimizations/connection-pool.js.map +1 -1
- package/dist/swarm/optimizations/index.js +2 -2
- package/dist/swarm/optimizations/optimized-executor.d.ts.map +1 -1
- package/dist/swarm/optimizations/optimized-executor.js +23 -29
- package/dist/swarm/optimizations/optimized-executor.js.map +1 -1
- package/dist/swarm/optimizations/ttl-map.d.ts.map +1 -1
- package/dist/swarm/optimizations/ttl-map.js +4 -4
- package/dist/swarm/optimizations/ttl-map.js.map +1 -1
- package/dist/swarm/prompt-cli.d.ts.map +1 -1
- package/dist/swarm/prompt-cli.js +18 -13
- package/dist/swarm/prompt-cli.js.map +1 -1
- package/dist/swarm/prompt-copier-enhanced.d.ts.map +1 -1
- package/dist/swarm/prompt-copier-enhanced.js +12 -12
- package/dist/swarm/prompt-copier-enhanced.js.map +1 -1
- package/dist/swarm/prompt-copier.d.ts.map +1 -1
- package/dist/swarm/prompt-copier.js +15 -18
- package/dist/swarm/prompt-copier.js.map +1 -1
- package/dist/swarm/prompt-manager.d.ts.map +1 -1
- package/dist/swarm/prompt-manager.js +27 -21
- package/dist/swarm/prompt-manager.js.map +1 -1
- package/dist/swarm/prompt-utils.d.ts.map +1 -1
- package/dist/swarm/prompt-utils.js +34 -32
- package/dist/swarm/prompt-utils.js.map +1 -1
- package/dist/swarm/sparc-executor.d.ts.map +1 -1
- package/dist/swarm/sparc-executor.js +189 -123
- package/dist/swarm/sparc-executor.js.map +1 -1
- package/dist/swarm/strategies/auto.d.ts.map +1 -1
- package/dist/swarm/strategies/auto.js +105 -86
- package/dist/swarm/strategies/auto.js.map +1 -1
- package/dist/swarm/strategies/base.d.ts.map +1 -1
- package/dist/swarm/strategies/base.js +14 -11
- package/dist/swarm/strategies/base.js.map +1 -1
- package/dist/swarm/strategies/research.d.ts.map +1 -1
- package/dist/swarm/strategies/research.js +76 -71
- package/dist/swarm/strategies/research.js.map +1 -1
- package/dist/swarm/types.d.ts.map +1 -1
- package/dist/swarm/types.js +3 -0
- package/dist/swarm/types.js.map +1 -1
- package/dist/swarm/workers/copy-worker.js +4 -4
- package/dist/swarm/workers/copy-worker.js.map +1 -1
- package/dist/task/commands.d.ts.map +1 -1
- package/dist/task/commands.js +11 -7
- package/dist/task/commands.js.map +1 -1
- package/dist/task/coordination.d.ts.map +1 -1
- package/dist/task/coordination.js +75 -70
- package/dist/task/coordination.js.map +1 -1
- package/dist/task/engine.d.ts.map +1 -1
- package/dist/task/engine.js +34 -32
- package/dist/task/engine.js.map +1 -1
- package/dist/task/index.d.ts +3 -3
- package/dist/task/index.d.ts.map +1 -1
- package/dist/task/index.js +11 -11
- package/dist/task/index.js.map +1 -1
- package/dist/terminal/adapters/native.d.ts.map +1 -1
- package/dist/terminal/adapters/native.js +6 -6
- package/dist/terminal/adapters/native.js.map +1 -1
- package/dist/terminal/adapters/vscode.d.ts +3 -0
- package/dist/terminal/adapters/vscode.d.ts.map +1 -1
- package/dist/terminal/adapters/vscode.js +6 -4
- package/dist/terminal/adapters/vscode.js.map +1 -1
- package/dist/terminal/manager.d.ts.map +1 -1
- package/dist/terminal/manager.js +6 -8
- package/dist/terminal/manager.js.map +1 -1
- package/dist/terminal/pool.d.ts.map +1 -1
- package/dist/terminal/pool.js +3 -0
- package/dist/terminal/pool.js.map +1 -1
- package/dist/terminal/session.d.ts.map +1 -1
- package/dist/terminal/session.js +6 -2
- package/dist/terminal/session.js.map +1 -1
- package/dist/ui/hive-dashboard.d.ts.map +1 -1
- package/dist/ui/hive-dashboard.js +52 -33
- package/dist/ui/hive-dashboard.js.map +1 -1
- package/dist/utils/error-handler.d.ts.map +1 -1
- package/dist/utils/error-handler.js +1 -1
- package/dist/utils/error-handler.js.map +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/helpers.d.ts +3 -0
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/utils/helpers.js +5 -8
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/npx-isolated-cache.js +3 -3
- package/dist/utils/npx-isolated-cache.js.map +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +8 -4
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/type-guards.d.ts +1 -1
- package/dist/utils/type-guards.d.ts.map +1 -1
- package/dist/utils/type-guards.js +11 -10
- package/dist/utils/type-guards.js.map +1 -1
- package/package.json +7 -6
- package/src/adapters/cliffy-node.ts +27 -22
- package/src/agents/agent-manager.ts +145 -121
- package/src/agents/agent-registry.ts +77 -70
- package/src/api/claude-client.ts +59 -38
- package/src/api/routes/analysis.js +750 -735
- package/src/cli/__tests__/command-registry.test.js +42 -32
- package/src/cli/__tests__/simple-cli.test.js +42 -37
- package/src/cli/__tests__/utils.test.js +9 -9
- package/src/cli/agents/README.md +30 -4
- package/src/cli/agents/analyst.ts +161 -163
- package/src/cli/agents/architect.ts +126 -131
- package/src/cli/agents/base-agent.ts +48 -47
- package/src/cli/agents/capabilities.ts +87 -85
- package/src/cli/agents/coder.ts +127 -120
- package/src/cli/agents/coordinator.ts +72 -72
- package/src/cli/agents/hive-agents.ts +96 -70
- package/src/cli/agents/index.ts +70 -55
- package/src/cli/agents/researcher.ts +63 -74
- package/src/cli/agents/tester.ts +91 -98
- package/src/cli/cli-core.ts +56 -47
- package/src/cli/command-registry.js +125 -83
- package/src/cli/commands/advanced-memory-commands.ts +210 -142
- package/src/cli/commands/agent-simple.ts +146 -114
- package/src/cli/commands/agent.ts +119 -95
- package/src/cli/commands/claude-api.ts +19 -15
- package/src/cli/commands/claude.ts +96 -88
- package/src/cli/commands/config-integration.ts +120 -101
- package/src/cli/commands/config.ts +10 -8
- package/src/cli/commands/enterprise.ts +323 -187
- package/src/cli/commands/help-new.ts +246 -0
- package/src/cli/commands/help.ts +326 -183
- package/src/cli/commands/hive-mind/index.ts +3 -3
- package/src/cli/commands/hive-mind/init.ts +19 -12
- package/src/cli/commands/hive-mind/optimize-memory.ts +83 -53
- package/src/cli/commands/hive-mind/pause.ts +27 -25
- package/src/cli/commands/hive-mind/ps.ts +43 -37
- package/src/cli/commands/hive-mind/resume.ts +26 -26
- package/src/cli/commands/hive-mind/spawn.ts +37 -29
- package/src/cli/commands/hive-mind/status.ts +51 -51
- package/src/cli/commands/hive-mind/stop.ts +56 -51
- package/src/cli/commands/hive-mind/task.ts +65 -54
- package/src/cli/commands/hive-mind/wizard.ts +181 -167
- package/src/cli/commands/hive.ts +136 -96
- package/src/cli/commands/hook-types.ts +2 -2
- package/src/cli/commands/hook-validator.ts +8 -4
- package/src/cli/commands/hook.ts +44 -42
- package/src/cli/commands/index.ts +1162 -1031
- package/src/cli/commands/mcp.ts +105 -94
- package/src/cli/commands/memory.ts +24 -21
- package/src/cli/commands/migrate.ts +24 -24
- package/src/cli/commands/monitor.ts +123 -93
- package/src/cli/commands/ruv-swarm.ts +131 -122
- package/src/cli/commands/session.ts +60 -45
- package/src/cli/commands/sparc.ts +170 -139
- package/src/cli/commands/start/event-emitter.ts +2 -2
- package/src/cli/commands/start/index.ts +1 -1
- package/src/cli/commands/start/process-manager.ts +30 -47
- package/src/cli/commands/start/process-ui-simple.ts +60 -49
- package/src/cli/commands/start/process-ui.ts +1 -1
- package/src/cli/commands/start/start-command.ts +104 -75
- package/src/cli/commands/start/system-monitor.ts +35 -41
- package/src/cli/commands/start/types.ts +3 -3
- package/src/cli/commands/start.ts +1 -1
- package/src/cli/commands/status.ts +67 -67
- package/src/cli/commands/swarm-spawn.ts +21 -12
- package/src/cli/commands/swarm.ts +221 -150
- package/src/cli/commands/task.ts +55 -55
- package/src/cli/commands/workflow.ts +174 -157
- package/src/cli/completion.ts +34 -19
- package/src/cli/create-enhanced-task.js +49 -17
- package/src/cli/formatter.ts +38 -37
- package/src/cli/help-formatter.js +145 -0
- package/src/cli/help-formatter.ts +173 -0
- package/src/cli/help-text.js +273 -6
- package/src/cli/index-remote.ts +12 -9
- package/src/cli/index.ts +77 -67
- package/src/cli/init/batch-tools.ts +4 -5
- package/src/cli/init/claude-config.ts +125 -118
- package/src/cli/init/directory-structure.ts +10 -11
- package/src/cli/init/index.ts +13 -13
- package/src/cli/init/sparc-environment.ts +90 -74
- package/src/cli/init/swarm-commands.ts +5 -6
- package/src/cli/init/utils.ts +1 -1
- package/src/cli/main.ts +9 -10
- package/src/cli/node-compat.js +26 -19
- package/src/cli/node-repl.ts +104 -87
- package/src/cli/repl.ts +190 -158
- package/src/cli/runtime-detector.js +24 -19
- package/src/cli/simple-cli.js +479 -394
- package/src/cli/simple-cli.ts +426 -366
- package/src/cli/simple-commands/__tests__/agent.test.js +49 -55
- package/src/cli/simple-commands/__tests__/memory.test.js +4 -401
- package/src/cli/simple-commands/__tests__/swarm.test.js +49 -55
- package/src/cli/simple-commands/__tests__/task.test.js +4 -478
- package/src/cli/simple-commands/agent.js +27 -27
- package/src/cli/simple-commands/analysis.js +179 -161
- package/src/cli/simple-commands/automation.js +226 -205
- package/src/cli/simple-commands/batch-manager.js +98 -88
- package/src/cli/simple-commands/config.js +65 -60
- package/src/cli/simple-commands/coordination.js +197 -185
- package/src/cli/simple-commands/enhanced-ui-views.js +142 -115
- package/src/cli/simple-commands/enhanced-webui-complete.js +267 -167
- package/src/cli/simple-commands/fix-hook-variables.js +73 -67
- package/src/cli/simple-commands/github/gh-coordinator.js +63 -53
- package/src/cli/simple-commands/github/github-api.js +45 -47
- package/src/cli/simple-commands/github.js +33 -34
- package/src/cli/simple-commands/hive-mind/auto-save-middleware.js +44 -40
- package/src/cli/simple-commands/hive-mind/communication.js +198 -185
- package/src/cli/simple-commands/hive-mind/core.js +289 -304
- package/src/cli/simple-commands/hive-mind/db-optimizer.js +278 -168
- package/src/cli/simple-commands/hive-mind/mcp-wrapper.js +352 -258
- package/src/cli/simple-commands/hive-mind/memory.js +356 -287
- package/src/cli/simple-commands/hive-mind/performance-optimizer.js +88 -79
- package/src/cli/simple-commands/hive-mind/performance-test.js +61 -49
- package/src/cli/simple-commands/hive-mind/queen.js +223 -213
- package/src/cli/simple-commands/hive-mind/session-manager.js +217 -157
- package/src/cli/simple-commands/hive-mind-optimize.js +69 -65
- package/src/cli/simple-commands/hive-mind-wizard.js +213 -211
- package/src/cli/simple-commands/hive-mind.js +602 -435
- package/src/cli/simple-commands/hive.js +12 -12
- package/src/cli/simple-commands/hook-safety.js +114 -111
- package/src/cli/simple-commands/hooks.js +1077 -1017
- package/src/cli/simple-commands/init/README.md +8 -1
- package/src/cli/simple-commands/init/VALIDATION_ROLLBACK.md +27 -1
- package/src/cli/simple-commands/init/batch-init.js +105 -100
- package/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +6 -6
- package/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +6 -6
- package/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +20 -18
- package/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +85 -71
- package/src/cli/simple-commands/init/claude-commands/slash-commands.js +6 -7
- package/src/cli/simple-commands/init/claude-commands/sparc-commands.js +42 -33
- package/src/cli/simple-commands/init/executable-wrapper.js +13 -10
- package/src/cli/simple-commands/init/gitignore-updater.js +22 -22
- package/src/cli/simple-commands/init/help.js +4 -2
- package/src/cli/simple-commands/init/index.js +405 -303
- package/src/cli/simple-commands/init/performance-monitor.js +71 -64
- package/src/cli/simple-commands/init/rollback/backup-manager.js +44 -64
- package/src/cli/simple-commands/init/rollback/index.js +31 -39
- package/src/cli/simple-commands/init/rollback/recovery-manager.js +71 -101
- package/src/cli/simple-commands/init/rollback/rollback-executor.js +34 -53
- package/src/cli/simple-commands/init/rollback/state-tracker.js +38 -49
- package/src/cli/simple-commands/init/sparc/roo-readme.js +1 -1
- package/src/cli/simple-commands/init/sparc/roomodes-config.js +99 -77
- package/src/cli/simple-commands/init/sparc/workflows.js +37 -33
- package/src/cli/simple-commands/init/sparc-structure.js +9 -10
- package/src/cli/simple-commands/init/templates/CLAUDE.md +94 -26
- package/src/cli/simple-commands/init/templates/claude-flow-universal +9 -7
- package/src/cli/simple-commands/init/templates/claude-md.js +1 -1
- package/src/cli/simple-commands/init/templates/commands/analysis/bottleneck-detect.md +15 -3
- package/src/cli/simple-commands/init/templates/commands/automation/auto-agent.md +12 -2
- package/src/cli/simple-commands/init/templates/commands/coordination/swarm-init.md +10 -1
- package/src/cli/simple-commands/init/templates/commands/github/github-swarm.md +18 -5
- package/src/cli/simple-commands/init/templates/commands/hooks/notification.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/post-command.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/post-edit.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/post-task.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-command.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-edit.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-search.md +13 -6
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-task.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/session-end.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/session-restore.md +13 -5
- package/src/cli/simple-commands/init/templates/commands/hooks/session-start.md +12 -1
- package/src/cli/simple-commands/init/templates/coordination-md.js +1 -1
- package/src/cli/simple-commands/init/templates/enhanced-templates.js +116 -113
- package/src/cli/simple-commands/init/templates/memory-bank-md.js +1 -1
- package/src/cli/simple-commands/init/templates/readme-files.js +1 -1
- package/src/cli/simple-commands/init/templates/safe-hook-patterns.js +176 -127
- package/src/cli/simple-commands/init/templates/settings.json +2 -5
- package/src/cli/simple-commands/init/templates/sparc-modes.js +3 -3
- package/src/cli/simple-commands/init/validation/config-validator.js +17 -28
- package/src/cli/simple-commands/init/validation/health-checker.js +54 -62
- package/src/cli/simple-commands/init/validation/index.js +18 -23
- package/src/cli/simple-commands/init/validation/mode-validator.js +22 -32
- package/src/cli/simple-commands/init/validation/post-init-validator.js +25 -26
- package/src/cli/simple-commands/init/validation/pre-init-validator.js +32 -36
- package/src/cli/simple-commands/init/validation/test-runner.js +55 -63
- package/src/cli/simple-commands/init.js +1 -1
- package/src/cli/simple-commands/mcp-integration-layer.js +179 -110
- package/src/cli/simple-commands/mcp.js +55 -48
- package/src/cli/simple-commands/memory.js +62 -56
- package/src/cli/simple-commands/migrate-hooks.js +9 -10
- package/src/cli/simple-commands/monitor.js +87 -67
- package/src/cli/simple-commands/process-ui-enhanced.js +207 -155
- package/src/cli/simple-commands/process-ui.js +65 -56
- package/src/cli/simple-commands/realtime-update-system.js +136 -129
- package/src/cli/simple-commands/sparc/architecture.js +352 -251
- package/src/cli/simple-commands/sparc/commands.js +122 -94
- package/src/cli/simple-commands/sparc/completion.js +274 -199
- package/src/cli/simple-commands/sparc/coordinator.js +217 -169
- package/src/cli/simple-commands/sparc/index.js +40 -36
- package/src/cli/simple-commands/sparc/phase-base.js +72 -58
- package/src/cli/simple-commands/sparc/pseudocode.js +275 -159
- package/src/cli/simple-commands/sparc/refinement.js +306 -212
- package/src/cli/simple-commands/sparc/specification.js +164 -94
- package/src/cli/simple-commands/sparc-modes/architect.js +1 -1
- package/src/cli/simple-commands/sparc-modes/ask.js +1 -1
- package/src/cli/simple-commands/sparc-modes/code.js +1 -1
- package/src/cli/simple-commands/sparc-modes/debug.js +1 -1
- package/src/cli/simple-commands/sparc-modes/devops.js +1 -1
- package/src/cli/simple-commands/sparc-modes/docs-writer.js +1 -1
- package/src/cli/simple-commands/sparc-modes/generic.js +1 -1
- package/src/cli/simple-commands/sparc-modes/index.js +15 -15
- package/src/cli/simple-commands/sparc-modes/integration.js +1 -1
- package/src/cli/simple-commands/sparc-modes/mcp.js +1 -1
- package/src/cli/simple-commands/sparc-modes/monitoring.js +1 -1
- package/src/cli/simple-commands/sparc-modes/optimization.js +1 -1
- package/src/cli/simple-commands/sparc-modes/security-review.js +1 -1
- package/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +1 -1
- package/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +1 -1
- package/src/cli/simple-commands/sparc-modes/supabase-admin.js +1 -1
- package/src/cli/simple-commands/sparc-modes/swarm.js +52 -52
- package/src/cli/simple-commands/sparc-modes/tdd.js +1 -1
- package/src/cli/simple-commands/sparc-modes/tutorial.js +1 -1
- package/src/cli/simple-commands/sparc.js +87 -69
- package/src/cli/simple-commands/start-ui.js +21 -20
- package/src/cli/simple-commands/start-wrapper.js +29 -31
- package/src/cli/simple-commands/start.js +1 -1
- package/src/cli/simple-commands/status.js +53 -47
- package/src/cli/simple-commands/swarm-executor.js +47 -57
- package/src/cli/simple-commands/swarm-metrics-integration.js +119 -79
- package/src/cli/simple-commands/swarm-ui.js +120 -118
- package/src/cli/simple-commands/swarm-webui-integration.js +48 -27
- package/src/cli/simple-commands/swarm.js +216 -181
- package/src/cli/simple-commands/task.js +29 -29
- package/src/cli/simple-commands/timestamp-fix.js +28 -25
- package/src/cli/simple-commands/tool-execution-framework.js +115 -118
- package/src/cli/simple-commands/training.js +219 -194
- package/src/cli/simple-commands/web-server.js +118 -117
- package/src/cli/simple-commands/webui-validator.js +4 -3
- package/src/cli/simple-mcp.ts +14 -17
- package/src/cli/simple-orchestrator.ts +113 -101
- package/src/cli/swarm-standalone.js +20 -21
- package/src/cli/ui/compatible-ui.ts +55 -44
- package/src/cli/ui/fallback-handler.ts +19 -16
- package/src/cli/ui/index.ts +14 -15
- package/src/cli/utils/environment-detector.ts +75 -67
- package/src/cli/utils/interactive-detector.js +17 -11
- package/src/cli/utils/prompt-defaults.ts +32 -28
- package/src/cli/utils/safe-interactive.js +21 -20
- package/src/cli/utils.js +127 -110
- package/src/cli/validation-helper.js +113 -0
- package/src/cli/validation-helper.ts +128 -0
- package/src/communication/message-bus.ts +137 -124
- package/src/config/config-manager.ts +62 -30
- package/src/config/ruv-swarm-config.ts +105 -86
- package/src/config/ruv-swarm-integration.ts +38 -38
- package/src/constants/agent-types.ts +9 -8
- package/src/coordination/README.md +54 -31
- package/src/coordination/advanced-scheduler.ts +23 -26
- package/src/coordination/advanced-task-executor.ts +74 -68
- package/src/coordination/background-executor.ts +33 -30
- package/src/coordination/circuit-breaker.ts +26 -27
- package/src/coordination/conflict-resolution.ts +18 -27
- package/src/coordination/dependency-graph.ts +15 -18
- package/src/coordination/hive-orchestrator.ts +111 -81
- package/src/coordination/hive-protocol.ts +68 -77
- package/src/coordination/index.ts +3 -7
- package/src/coordination/load-balancer.ts +115 -105
- package/src/coordination/manager.ts +38 -51
- package/src/coordination/messaging.ts +19 -29
- package/src/coordination/metrics.ts +57 -60
- package/src/coordination/resources.ts +32 -37
- package/src/coordination/scheduler.ts +29 -30
- package/src/coordination/swarm-coordinator.ts +81 -70
- package/src/coordination/swarm-monitor.ts +90 -69
- package/src/coordination/work-stealing.ts +6 -13
- package/src/core/config.ts +148 -143
- package/src/core/event-bus.ts +5 -6
- package/src/core/json-persistence.ts +27 -34
- package/src/core/logger.ts +13 -16
- package/src/core/orchestrator-fixed.ts +33 -32
- package/src/core/orchestrator.ts +166 -159
- package/src/core/persistence.ts +47 -36
- package/src/enterprise/analytics-manager.ts +242 -233
- package/src/enterprise/audit-manager.ts +238 -184
- package/src/enterprise/cloud-manager.ts +167 -151
- package/src/enterprise/deployment-manager.ts +223 -180
- package/src/enterprise/index.ts +7 -7
- package/src/enterprise/project-manager.ts +151 -133
- package/src/enterprise/security-manager.ts +278 -223
- package/src/hive-mind/core/Agent.ts +112 -109
- package/src/hive-mind/core/Communication.ts +67 -69
- package/src/hive-mind/core/DatabaseManager.ts +299 -166
- package/src/hive-mind/core/HiveMind.ts +100 -96
- package/src/hive-mind/core/Memory.ts +304 -295
- package/src/hive-mind/core/MemoryMonitor.ts +46 -47
- package/src/hive-mind/core/Queen.ts +187 -114
- package/src/hive-mind/index.ts +2 -2
- package/src/hive-mind/integration/ConsensusEngine.ts +88 -92
- package/src/hive-mind/integration/MCPToolWrapper.ts +20 -72
- package/src/hive-mind/integration/SwarmOrchestrator.ts +173 -165
- package/src/hive-mind/types.ts +24 -12
- package/src/integration/mock-components.ts +42 -30
- package/src/integration/system-integration.ts +93 -69
- package/src/integration/types.ts +7 -7
- package/src/mcp/README.md +23 -4
- package/src/mcp/auth.ts +25 -18
- package/src/mcp/claude-code-wrapper.ts +257 -150
- package/src/mcp/claude-flow-tools.ts +52 -13
- package/src/mcp/client.ts +15 -13
- package/src/mcp/index.ts +22 -27
- package/src/mcp/integrate-wrapper.ts +18 -18
- package/src/mcp/lifecycle-manager.ts +30 -27
- package/src/mcp/load-balancer.ts +10 -11
- package/src/mcp/mcp-server.js +755 -370
- package/src/mcp/orchestration-integration.ts +32 -17
- package/src/mcp/performance-monitor.ts +65 -51
- package/src/mcp/protocol-manager.ts +36 -52
- package/src/mcp/recovery/connection-health-monitor.ts +40 -35
- package/src/mcp/recovery/connection-state-manager.ts +52 -50
- package/src/mcp/recovery/fallback-coordinator.ts +24 -24
- package/src/mcp/recovery/index.ts +23 -4
- package/src/mcp/recovery/reconnection-manager.ts +14 -15
- package/src/mcp/recovery/recovery-manager.ts +52 -68
- package/src/mcp/router.ts +1 -2
- package/src/mcp/ruv-swarm-tools.ts +167 -138
- package/src/mcp/ruv-swarm-wrapper.js +31 -23
- package/src/mcp/server-with-wrapper.ts +4 -5
- package/src/mcp/server-wrapper-mode.ts +5 -6
- package/src/mcp/server.ts +45 -40
- package/src/mcp/session-manager.ts +8 -11
- package/src/mcp/sparc-modes.ts +29 -28
- package/src/mcp/swarm-tools.ts +131 -114
- package/src/mcp/tests/mcp-integration.test.ts +49 -55
- package/src/mcp/tools.ts +53 -38
- package/src/mcp/transports/base.ts +4 -5
- package/src/mcp/transports/http.ts +45 -42
- package/src/mcp/transports/stdio.ts +9 -12
- package/src/memory/README.md +37 -27
- package/src/memory/advanced-memory-manager.ts +336 -279
- package/src/memory/backends/base.ts +4 -5
- package/src/memory/backends/markdown.ts +16 -22
- package/src/memory/backends/sqlite.ts +19 -15
- package/src/memory/cache.ts +18 -18
- package/src/memory/distributed-memory.ts +84 -92
- package/src/memory/enhanced-examples.js +68 -59
- package/src/memory/enhanced-memory.js +99 -80
- package/src/memory/fallback-store.js +16 -7
- package/src/memory/in-memory-store.js +31 -27
- package/src/memory/index.js +4 -4
- package/src/memory/indexer.ts +6 -10
- package/src/memory/manager.ts +45 -59
- package/src/memory/migration.js +107 -90
- package/src/memory/shared-memory.js +155 -157
- package/src/memory/sqlite-store.js +76 -59
- package/src/memory/swarm-memory.js +138 -131
- package/src/memory/swarm-memory.ts +74 -75
- package/src/memory/test-example.js +28 -30
- package/src/migration/README.md +25 -9
- package/src/migration/index.ts +13 -14
- package/src/migration/logger.ts +9 -7
- package/src/migration/migration-analyzer.ts +66 -52
- package/src/migration/migration-manifest.json +2 -6
- package/src/migration/migration-runner.ts +86 -63
- package/src/migration/migration-validator.ts +93 -68
- package/src/migration/package.json +1 -1
- package/src/migration/progress-reporter.ts +25 -21
- package/src/migration/rollback-manager.ts +79 -63
- package/src/migration/tests/migration-system.test.ts +4 -491
- package/src/migration/tsconfig.json +3 -10
- package/src/migration/types.ts +1 -1
- package/src/monitoring/diagnostics.ts +123 -97
- package/src/monitoring/health-check.ts +45 -51
- package/src/monitoring/real-time-monitor.ts +105 -92
- package/src/resources/resource-manager.ts +205 -159
- package/src/swarm/__tests__/integration.test.ts +59 -65
- package/src/swarm/__tests__/prompt-copier.test.ts +27 -27
- package/src/swarm/claude-flow-executor.ts +50 -49
- package/src/swarm/coordinator.ts +727 -635
- package/src/swarm/direct-executor.ts +80 -86
- package/src/swarm/executor-v2.ts +81 -66
- package/src/swarm/executor.ts +124 -124
- package/src/swarm/index.ts +7 -8
- package/src/swarm/json-output-aggregator.ts +56 -40
- package/src/swarm/memory.ts +152 -147
- package/src/swarm/optimizations/README.md +20 -12
- package/src/swarm/optimizations/__tests__/optimization.test.ts +84 -87
- package/src/swarm/optimizations/async-file-manager.ts +70 -80
- package/src/swarm/optimizations/circular-buffer.ts +37 -37
- package/src/swarm/optimizations/connection-pool.ts +64 -64
- package/src/swarm/optimizations/index.ts +4 -4
- package/src/swarm/optimizations/migration-guide.md +27 -16
- package/src/swarm/optimizations/optimized-executor.ts +104 -114
- package/src/swarm/optimizations/ttl-map.ts +66 -63
- package/src/swarm/prompt-cli.ts +48 -42
- package/src/swarm/prompt-copier-enhanced.ts +54 -55
- package/src/swarm/prompt-copier.ts +59 -65
- package/src/swarm/prompt-copying-README.md +49 -33
- package/src/swarm/prompt-manager.ts +69 -63
- package/src/swarm/prompt-utils.ts +71 -66
- package/src/swarm/sparc-executor.ts +298 -225
- package/src/swarm/strategies/auto.ts +367 -252
- package/src/swarm/strategies/base.ts +24 -20
- package/src/swarm/strategies/research.ts +144 -124
- package/src/swarm/types.ts +340 -309
- package/src/swarm/workers/copy-worker.ts +12 -13
- package/src/task/README.md +99 -70
- package/src/task/commands.ts +16 -8
- package/src/task/coordination.ts +209 -162
- package/src/task/engine.ts +81 -65
- package/src/task/index.ts +28 -31
- package/src/templates/claude-optimized/.claude/BATCHTOOLS_BEST_PRACTICES.md +479 -481
- package/src/templates/claude-optimized/.claude/BATCHTOOLS_GUIDE.md +210 -188
- package/src/templates/claude-optimized/.claude/MIGRATION_GUIDE.md +151 -105
- package/src/templates/claude-optimized/.claude/PERFORMANCE_BENCHMARKS.md +102 -87
- package/src/templates/claude-optimized/.claude/commands/claude-flow-help.md +18 -1
- package/src/templates/claude-optimized/.claude/commands/claude-flow-memory.md +17 -1
- package/src/templates/claude-optimized/.claude/commands/claude-flow-swarm.md +21 -1
- package/src/templates/claude-optimized/.claude/commands/sparc/architect.md +11 -4
- package/src/templates/claude-optimized/.claude/commands/sparc/ask.md +16 -10
- package/src/templates/claude-optimized/.claude/commands/sparc/code.md +26 -7
- package/src/templates/claude-optimized/.claude/commands/sparc/debug.md +14 -4
- package/src/templates/claude-optimized/.claude/commands/sparc/devops.md +23 -10
- package/src/templates/claude-optimized/.claude/commands/sparc/docs-writer.md +8 -4
- package/src/templates/claude-optimized/.claude/commands/sparc/integration.md +43 -27
- package/src/templates/claude-optimized/.claude/commands/sparc/mcp.md +15 -1
- package/src/templates/claude-optimized/.claude/commands/sparc/post-deployment-monitoring-mode.md +45 -30
- package/src/templates/claude-optimized/.claude/commands/sparc/refinement-optimization-mode.md +23 -13
- package/src/templates/claude-optimized/.claude/commands/sparc/security-review.md +31 -17
- package/src/templates/claude-optimized/.claude/commands/sparc/sparc.md +54 -47
- package/src/templates/claude-optimized/.claude/commands/sparc/spec-pseudocode.md +27 -17
- package/src/templates/claude-optimized/.claude/commands/sparc/supabase-admin.md +18 -4
- package/src/templates/claude-optimized/.claude/commands/sparc/tdd.md +23 -9
- package/src/templates/claude-optimized/.claude/commands/sparc/tutorial.md +22 -16
- package/src/templates/claude-optimized/.claude/commands/sparc.md +20 -1
- package/src/templates/claude-optimized/README.md +10 -1
- package/src/templates/claude-optimized/SUMMARY.md +23 -1
- package/src/templates/claude-optimized/deploy-to-project.js +22 -10
- package/src/templates/claude-optimized/install-template.js +14 -10
- package/src/templates/claude-optimized/manifest.json +1 -1
- package/src/templates/claude-optimized/package.json +1 -1
- package/src/templates/claude-optimized/template-manager.js +8 -8
- package/src/templates/claude-optimized/validate-template.js +33 -23
- package/src/terminal/adapters/base.ts +1 -1
- package/src/terminal/adapters/native.ts +47 -47
- package/src/terminal/adapters/vscode.ts +21 -28
- package/src/terminal/manager.ts +27 -22
- package/src/terminal/pool.ts +24 -27
- package/src/terminal/session.ts +18 -18
- package/src/terminal/vscode-bridge.ts +21 -21
- package/src/tests/validation-consistency.test.ts +4 -4
- package/src/types/cliffy.d.ts +11 -14
- package/src/types/global.d.ts +1 -2
- package/src/types/index.ts +2 -2
- package/src/types/mcp.d.ts +11 -17
- package/src/types/vscode.d.ts +18 -5
- package/src/ui/console/README-analysis-tools.md +52 -2
- package/src/ui/console/README.md +33 -1
- package/src/ui/console/WORKFLOW_DESIGNER_README.md +81 -22
- package/src/ui/console/analysis-tools.html +282 -261
- package/src/ui/console/analytics.html +329 -326
- package/src/ui/console/index.html +221 -209
- package/src/ui/console/js/analysis-tools.js +815 -754
- package/src/ui/console/js/command-handler.js +226 -196
- package/src/ui/console/js/console.js +117 -119
- package/src/ui/console/js/daa-tools.js +797 -787
- package/src/ui/console/js/memory-interface.js +676 -638
- package/src/ui/console/js/memory-test.js +49 -46
- package/src/ui/console/js/memory-tools.js +181 -159
- package/src/ui/console/js/settings.js +124 -103
- package/src/ui/console/js/terminal-emulator.js +147 -130
- package/src/ui/console/js/websocket-client.js +71 -71
- package/src/ui/console/js/workflow-designer.js +1126 -1110
- package/src/ui/console/neural-networks-demo.md +45 -16
- package/src/ui/console/styles/analysis-tools.css +571 -561
- package/src/ui/console/styles/console.css +16 -12
- package/src/ui/console/styles/daa-tools.css +322 -319
- package/src/ui/console/styles/responsive.css +71 -70
- package/src/ui/console/styles/settings.css +12 -12
- package/src/ui/console/styles/workflow-designer.css +628 -584
- package/src/ui/console/test-neural-networks.js +59 -54
- package/src/ui/console/test-neural.html +194 -196
- package/src/ui/console/workflow-designer-demo.html +433 -424
- package/src/ui/hive-dashboard.ts +74 -52
- package/src/ui/web-ui/EnhancedProcessUI.js +570 -424
- package/src/ui/web-ui/EnhancedWebUI.js +65 -65
- package/src/ui/web-ui/README.md +16 -16
- package/src/ui/web-ui/components/ComponentLibrary.js +173 -124
- package/src/ui/web-ui/core/EventBus.js +27 -25
- package/src/ui/web-ui/core/MCPIntegrationLayer.js +294 -108
- package/src/ui/web-ui/core/StateManager.js +43 -46
- package/src/ui/web-ui/core/UIManager.js +120 -70
- package/src/ui/web-ui/core/ViewManager.js +16 -19
- package/src/ui/web-ui/index.js +101 -48
- package/src/ui/web-ui/neural-panel-test.js +109 -108
- package/src/ui/web-ui/test-github-view.js +11 -12
- package/src/ui/web-ui/test-neural-panel.html +219 -205
- package/src/ui/web-ui/views/DAAView.js +88 -85
- package/src/ui/web-ui/views/GitHubIntegrationTest.js +42 -42
- package/src/ui/web-ui/views/GitHubIntegrationView.js +59 -53
- package/src/ui/web-ui/views/NeuralNetworkView.js +20 -21
- package/src/ui/web-ui/views/WorkflowAutomationView.js +31 -32
- package/src/utils/error-handler.js +1 -1
- package/src/utils/error-handler.ts +9 -5
- package/src/utils/errors.ts +20 -18
- package/src/utils/formatters.ts +6 -6
- package/src/utils/helpers.ts +53 -55
- package/src/utils/npx-isolated-cache.js +16 -16
- package/src/utils/paths.ts +9 -6
- package/src/utils/timezone-utils.js +16 -16
- package/src/utils/type-guards.ts +37 -26
- package/src/utils/types.ts +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Memory Class
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Manages collective memory for the Hive Mind swarm,
|
|
5
5
|
* providing persistent storage, retrieval, and learning capabilities.
|
|
6
6
|
*/
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
MemoryNamespace,
|
|
15
15
|
MemoryStats,
|
|
16
16
|
MemorySearchOptions,
|
|
17
|
-
MemoryPattern
|
|
17
|
+
MemoryPattern,
|
|
18
18
|
} from '../types.js';
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -49,7 +49,7 @@ class HighPerformanceCache<T> {
|
|
|
49
49
|
|
|
50
50
|
set(key: string, data: T): void {
|
|
51
51
|
const size = this.estimateSize(data);
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
// Handle memory pressure
|
|
54
54
|
while (this.currentMemory + size > this.maxMemory && this.cache.size > 0) {
|
|
55
55
|
this.evictLRU();
|
|
@@ -89,7 +89,7 @@ class HighPerformanceCache<T> {
|
|
|
89
89
|
memoryUsage: this.currentMemory,
|
|
90
90
|
hitRate: total > 0 ? (this.hits / total) * 100 : 0,
|
|
91
91
|
evictions: this.evictions,
|
|
92
|
-
utilizationPercent: (this.currentMemory / this.maxMemory) * 100
|
|
92
|
+
utilizationPercent: (this.currentMemory / this.maxMemory) * 100,
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -153,7 +153,7 @@ class ObjectPool<T> {
|
|
|
153
153
|
poolSize: this.pool.length,
|
|
154
154
|
allocated: this.allocated,
|
|
155
155
|
reused: this.reused,
|
|
156
|
-
reuseRate: this.allocated > 0 ? (this.reused / (this.allocated + this.reused)) * 100 : 0
|
|
156
|
+
reuseRate: this.allocated > 0 ? (this.reused / (this.allocated + this.reused)) * 100 : 0,
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -172,37 +172,37 @@ export class Memory extends EventEmitter {
|
|
|
172
172
|
private compressionThreshold = 10000; // 10KB
|
|
173
173
|
private batchSize = 100;
|
|
174
174
|
|
|
175
|
-
constructor(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
175
|
+
constructor(
|
|
176
|
+
swarmId: string,
|
|
177
|
+
options: {
|
|
178
|
+
cacheSize?: number;
|
|
179
|
+
cacheMemoryMB?: number;
|
|
180
|
+
enablePooling?: boolean;
|
|
181
|
+
compressionThreshold?: number;
|
|
182
|
+
batchSize?: number;
|
|
183
|
+
} = {},
|
|
184
|
+
) {
|
|
182
185
|
super();
|
|
183
186
|
this.swarmId = swarmId;
|
|
184
|
-
|
|
187
|
+
|
|
185
188
|
// Initialize high-performance cache
|
|
186
|
-
this.cache = new HighPerformanceCache(
|
|
187
|
-
|
|
188
|
-
options.cacheMemoryMB || 100
|
|
189
|
-
);
|
|
190
|
-
|
|
189
|
+
this.cache = new HighPerformanceCache(options.cacheSize || 10000, options.cacheMemoryMB || 100);
|
|
190
|
+
|
|
191
191
|
this.namespaces = new Map();
|
|
192
192
|
this.accessPatterns = new Map();
|
|
193
193
|
this.performanceMetrics = new Map();
|
|
194
194
|
this.objectPools = new Map();
|
|
195
|
-
|
|
195
|
+
|
|
196
196
|
if (options.compressionThreshold) {
|
|
197
197
|
this.compressionThreshold = options.compressionThreshold;
|
|
198
198
|
}
|
|
199
|
-
|
|
199
|
+
|
|
200
200
|
if (options.batchSize) {
|
|
201
201
|
this.batchSize = options.batchSize;
|
|
202
202
|
}
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
this.initializeNamespaces();
|
|
205
|
-
|
|
205
|
+
|
|
206
206
|
if (options.enablePooling !== false) {
|
|
207
207
|
this.initializeObjectPools();
|
|
208
208
|
}
|
|
@@ -213,28 +213,28 @@ export class Memory extends EventEmitter {
|
|
|
213
213
|
*/
|
|
214
214
|
async initialize(): Promise<void> {
|
|
215
215
|
const startTime = performance.now();
|
|
216
|
-
|
|
216
|
+
|
|
217
217
|
this.db = await DatabaseManager.getInstance();
|
|
218
218
|
this.mcpWrapper = new MCPToolWrapper();
|
|
219
|
-
|
|
219
|
+
|
|
220
220
|
// Optimize database connection
|
|
221
221
|
await this.optimizeDatabaseSettings();
|
|
222
|
-
|
|
222
|
+
|
|
223
223
|
// Load existing memory entries with pagination
|
|
224
224
|
await this.loadMemoryFromDatabase();
|
|
225
|
-
|
|
225
|
+
|
|
226
226
|
// Start optimized memory management loops
|
|
227
227
|
this.startOptimizedManagers();
|
|
228
|
-
|
|
228
|
+
|
|
229
229
|
this.isActive = true;
|
|
230
|
-
|
|
230
|
+
|
|
231
231
|
const duration = performance.now() - startTime;
|
|
232
232
|
this.recordPerformance('initialize', duration);
|
|
233
|
-
|
|
233
|
+
|
|
234
234
|
this.emit('initialized', {
|
|
235
235
|
duration,
|
|
236
236
|
cacheSize: this.cache.getStats().size,
|
|
237
|
-
poolsInitialized: this.objectPools.size
|
|
237
|
+
poolsInitialized: this.objectPools.size,
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -243,25 +243,40 @@ export class Memory extends EventEmitter {
|
|
|
243
243
|
*/
|
|
244
244
|
private initializeObjectPools(): void {
|
|
245
245
|
// Pool for memory entries
|
|
246
|
-
this.objectPools.set(
|
|
247
|
-
|
|
248
|
-
(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
246
|
+
this.objectPools.set(
|
|
247
|
+
'memoryEntry',
|
|
248
|
+
new ObjectPool(
|
|
249
|
+
() =>
|
|
250
|
+
({
|
|
251
|
+
key: '',
|
|
252
|
+
namespace: '',
|
|
253
|
+
value: '',
|
|
254
|
+
ttl: 0,
|
|
255
|
+
createdAt: new Date(),
|
|
256
|
+
accessCount: 0,
|
|
257
|
+
lastAccessedAt: new Date(),
|
|
258
|
+
}) as MemoryEntry,
|
|
259
|
+
(obj) => {
|
|
260
|
+
obj.key = '';
|
|
261
|
+
obj.namespace = '';
|
|
262
|
+
obj.value = '';
|
|
263
|
+
obj.ttl = 0;
|
|
264
|
+
obj.accessCount = 0;
|
|
265
|
+
},
|
|
266
|
+
),
|
|
267
|
+
);
|
|
268
|
+
|
|
257
269
|
// Pool for search results
|
|
258
|
-
this.objectPools.set(
|
|
259
|
-
|
|
260
|
-
(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
270
|
+
this.objectPools.set(
|
|
271
|
+
'searchResult',
|
|
272
|
+
new ObjectPool(
|
|
273
|
+
() => ({ results: [], metadata: {} }),
|
|
274
|
+
(obj) => {
|
|
275
|
+
obj.results.length = 0;
|
|
276
|
+
Object.keys(obj.metadata).forEach((k) => delete obj.metadata[k]);
|
|
277
|
+
},
|
|
278
|
+
),
|
|
279
|
+
);
|
|
265
280
|
}
|
|
266
281
|
|
|
267
282
|
/**
|
|
@@ -282,28 +297,28 @@ export class Memory extends EventEmitter {
|
|
|
282
297
|
*/
|
|
283
298
|
async store(key: string, value: any, namespace: string = 'default', ttl?: number): Promise<void> {
|
|
284
299
|
const startTime = performance.now();
|
|
285
|
-
|
|
300
|
+
|
|
286
301
|
// Use object pool if available
|
|
287
302
|
const entryPool = this.objectPools.get('memoryEntry');
|
|
288
|
-
const entry = entryPool ? entryPool.acquire() : {} as MemoryEntry;
|
|
289
|
-
|
|
303
|
+
const entry = entryPool ? entryPool.acquire() : ({} as MemoryEntry);
|
|
304
|
+
|
|
290
305
|
try {
|
|
291
306
|
// Smart serialization with compression detection
|
|
292
307
|
let serializedValue: string;
|
|
293
308
|
let compressed = false;
|
|
294
|
-
|
|
309
|
+
|
|
295
310
|
if (typeof value === 'string') {
|
|
296
311
|
serializedValue = value;
|
|
297
312
|
} else {
|
|
298
313
|
serializedValue = JSON.stringify(value);
|
|
299
314
|
}
|
|
300
|
-
|
|
315
|
+
|
|
301
316
|
// Intelligent compression decision
|
|
302
317
|
if (serializedValue.length > this.compressionThreshold) {
|
|
303
318
|
serializedValue = await this.compressData(serializedValue);
|
|
304
319
|
compressed = true;
|
|
305
320
|
}
|
|
306
|
-
|
|
321
|
+
|
|
307
322
|
// Populate entry
|
|
308
323
|
entry.key = key;
|
|
309
324
|
entry.namespace = namespace;
|
|
@@ -312,49 +327,50 @@ export class Memory extends EventEmitter {
|
|
|
312
327
|
entry.createdAt = new Date();
|
|
313
328
|
entry.accessCount = 0;
|
|
314
329
|
entry.lastAccessedAt = new Date();
|
|
315
|
-
|
|
330
|
+
|
|
316
331
|
// Store in database with transaction for consistency
|
|
317
332
|
await this.db.storeMemory({
|
|
318
333
|
key,
|
|
319
334
|
namespace,
|
|
320
335
|
value: serializedValue,
|
|
321
336
|
ttl,
|
|
322
|
-
metadata: JSON.stringify({
|
|
323
|
-
swarmId: this.swarmId,
|
|
337
|
+
metadata: JSON.stringify({
|
|
338
|
+
swarmId: this.swarmId,
|
|
324
339
|
compressed,
|
|
325
|
-
originalSize: serializedValue.length
|
|
326
|
-
})
|
|
340
|
+
originalSize: serializedValue.length,
|
|
341
|
+
}),
|
|
327
342
|
});
|
|
328
|
-
|
|
343
|
+
|
|
329
344
|
// Async MCP storage (non-blocking)
|
|
330
|
-
this.mcpWrapper
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
345
|
+
this.mcpWrapper
|
|
346
|
+
.storeMemory({
|
|
347
|
+
action: 'store',
|
|
348
|
+
key: `${this.swarmId}/${namespace}/${key}`,
|
|
349
|
+
value: serializedValue,
|
|
350
|
+
namespace: 'hive-mind',
|
|
351
|
+
ttl,
|
|
352
|
+
})
|
|
353
|
+
.catch((error) => this.emit('mcpError', error));
|
|
354
|
+
|
|
338
355
|
// Update high-performance cache
|
|
339
356
|
this.cache.set(this.getCacheKey(key, namespace), value);
|
|
340
|
-
|
|
357
|
+
|
|
341
358
|
// Track access patterns
|
|
342
359
|
this.updateAccessPattern(key, 'write');
|
|
343
|
-
|
|
360
|
+
|
|
344
361
|
// Update namespace stats asynchronously
|
|
345
362
|
setImmediate(() => this.updateNamespaceStats(namespace, 'store'));
|
|
346
|
-
|
|
363
|
+
|
|
347
364
|
const duration = performance.now() - startTime;
|
|
348
365
|
this.recordPerformance('store', duration);
|
|
349
|
-
|
|
350
|
-
this.emit('memoryStored', {
|
|
351
|
-
key,
|
|
352
|
-
namespace,
|
|
353
|
-
compressed,
|
|
366
|
+
|
|
367
|
+
this.emit('memoryStored', {
|
|
368
|
+
key,
|
|
369
|
+
namespace,
|
|
370
|
+
compressed,
|
|
354
371
|
size: serializedValue.length,
|
|
355
|
-
duration
|
|
372
|
+
duration,
|
|
356
373
|
});
|
|
357
|
-
|
|
358
374
|
} finally {
|
|
359
375
|
// Return object to pool
|
|
360
376
|
if (entryPool) {
|
|
@@ -366,30 +382,32 @@ export class Memory extends EventEmitter {
|
|
|
366
382
|
/**
|
|
367
383
|
* Batch store operation for high-throughput scenarios
|
|
368
384
|
*/
|
|
369
|
-
async storeBatch(
|
|
385
|
+
async storeBatch(
|
|
386
|
+
entries: Array<{ key: string; value: any; namespace?: string; ttl?: number }>,
|
|
387
|
+
): Promise<void> {
|
|
370
388
|
const startTime = performance.now();
|
|
371
389
|
const batchResults = [];
|
|
372
|
-
|
|
390
|
+
|
|
373
391
|
// Process in chunks to avoid memory pressure
|
|
374
392
|
for (let i = 0; i < entries.length; i += this.batchSize) {
|
|
375
393
|
const chunk = entries.slice(i, i + this.batchSize);
|
|
376
|
-
|
|
394
|
+
|
|
377
395
|
const chunkPromises = chunk.map(async ({ key, value, namespace = 'default', ttl }) => {
|
|
378
396
|
await this.store(key, value, namespace, ttl);
|
|
379
397
|
return { key, namespace, success: true };
|
|
380
398
|
});
|
|
381
|
-
|
|
399
|
+
|
|
382
400
|
const chunkResults = await Promise.allSettled(chunkPromises);
|
|
383
401
|
batchResults.push(...chunkResults);
|
|
384
402
|
}
|
|
385
|
-
|
|
403
|
+
|
|
386
404
|
const duration = performance.now() - startTime;
|
|
387
|
-
const successful = batchResults.filter(r => r.status === 'fulfilled').length;
|
|
388
|
-
|
|
405
|
+
const successful = batchResults.filter((r) => r.status === 'fulfilled').length;
|
|
406
|
+
|
|
389
407
|
this.emit('batchStored', {
|
|
390
408
|
total: entries.length,
|
|
391
409
|
successful,
|
|
392
|
-
duration
|
|
410
|
+
duration,
|
|
393
411
|
});
|
|
394
412
|
}
|
|
395
413
|
|
|
@@ -399,7 +417,7 @@ export class Memory extends EventEmitter {
|
|
|
399
417
|
async retrieve(key: string, namespace: string = 'default'): Promise<any> {
|
|
400
418
|
const startTime = performance.now();
|
|
401
419
|
const cacheKey = this.getCacheKey(key, namespace);
|
|
402
|
-
|
|
420
|
+
|
|
403
421
|
try {
|
|
404
422
|
// Check high-performance cache first
|
|
405
423
|
const cached = this.cache.get(cacheKey);
|
|
@@ -408,48 +426,50 @@ export class Memory extends EventEmitter {
|
|
|
408
426
|
this.recordPerformance('retrieve_cache', performance.now() - startTime);
|
|
409
427
|
return cached;
|
|
410
428
|
}
|
|
411
|
-
|
|
429
|
+
|
|
412
430
|
// Database lookup with prepared statements
|
|
413
431
|
const dbEntry = await this.db.getMemory(key, namespace);
|
|
414
432
|
if (dbEntry) {
|
|
415
433
|
let value = dbEntry.value;
|
|
416
|
-
|
|
434
|
+
|
|
417
435
|
// Handle compressed data
|
|
418
436
|
const metadata = JSON.parse(dbEntry.metadata || '{}');
|
|
419
437
|
if (metadata.compressed) {
|
|
420
438
|
value = await this.decompressData(value);
|
|
421
439
|
}
|
|
422
|
-
|
|
440
|
+
|
|
423
441
|
const parsedValue = this.parseValue(value);
|
|
424
|
-
|
|
442
|
+
|
|
425
443
|
// Update cache asynchronously
|
|
426
444
|
this.cache.set(cacheKey, parsedValue);
|
|
427
|
-
|
|
445
|
+
|
|
428
446
|
// Update access stats in background
|
|
429
447
|
setImmediate(() => {
|
|
430
448
|
this.updateAccessPattern(key, 'db_hit');
|
|
431
|
-
this.db.updateMemoryAccess(key, namespace).catch(err => this.emit('error', err));
|
|
449
|
+
this.db.updateMemoryAccess(key, namespace).catch((err) => this.emit('error', err));
|
|
432
450
|
});
|
|
433
|
-
|
|
451
|
+
|
|
434
452
|
this.recordPerformance('retrieve_db', performance.now() - startTime);
|
|
435
453
|
return parsedValue;
|
|
436
454
|
}
|
|
437
|
-
|
|
455
|
+
|
|
438
456
|
// Fallback to MCP memory (async, non-blocking)
|
|
439
|
-
this.mcpWrapper
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
457
|
+
this.mcpWrapper
|
|
458
|
+
.retrieveMemory({
|
|
459
|
+
action: 'retrieve',
|
|
460
|
+
key: `${this.swarmId}/${namespace}/${key}`,
|
|
461
|
+
namespace: 'hive-mind',
|
|
462
|
+
})
|
|
463
|
+
.then((mcpValue) => {
|
|
464
|
+
if (mcpValue) {
|
|
465
|
+
this.store(key, mcpValue, namespace).catch((err) => this.emit('error', err));
|
|
466
|
+
}
|
|
467
|
+
})
|
|
468
|
+
.catch((err) => this.emit('mcpError', err));
|
|
469
|
+
|
|
449
470
|
this.updateAccessPattern(key, 'miss');
|
|
450
471
|
this.recordPerformance('retrieve_miss', performance.now() - startTime);
|
|
451
472
|
return null;
|
|
452
|
-
|
|
453
473
|
} catch (error) {
|
|
454
474
|
this.emit('error', error);
|
|
455
475
|
return null;
|
|
@@ -464,7 +484,7 @@ export class Memory extends EventEmitter {
|
|
|
464
484
|
const results = new Map<string, any>();
|
|
465
485
|
const cacheHits: string[] = [];
|
|
466
486
|
const cacheMisses: string[] = [];
|
|
467
|
-
|
|
487
|
+
|
|
468
488
|
// Check cache for all keys first
|
|
469
489
|
for (const key of keys) {
|
|
470
490
|
const cacheKey = this.getCacheKey(key, namespace);
|
|
@@ -476,7 +496,7 @@ export class Memory extends EventEmitter {
|
|
|
476
496
|
cacheMisses.push(key);
|
|
477
497
|
}
|
|
478
498
|
}
|
|
479
|
-
|
|
499
|
+
|
|
480
500
|
// Batch query for cache misses
|
|
481
501
|
if (cacheMisses.length > 0) {
|
|
482
502
|
try {
|
|
@@ -491,15 +511,15 @@ export class Memory extends EventEmitter {
|
|
|
491
511
|
this.emit('error', error);
|
|
492
512
|
}
|
|
493
513
|
}
|
|
494
|
-
|
|
514
|
+
|
|
495
515
|
const duration = performance.now() - startTime;
|
|
496
516
|
this.emit('batchRetrieved', {
|
|
497
517
|
total: keys.length,
|
|
498
518
|
cacheHits: cacheHits.length,
|
|
499
519
|
found: results.size,
|
|
500
|
-
duration
|
|
520
|
+
duration,
|
|
501
521
|
});
|
|
502
|
-
|
|
522
|
+
|
|
503
523
|
return results;
|
|
504
524
|
}
|
|
505
525
|
|
|
@@ -509,23 +529,23 @@ export class Memory extends EventEmitter {
|
|
|
509
529
|
async search(options: MemorySearchOptions): Promise<MemoryEntry[]> {
|
|
510
530
|
const startTime = performance.now();
|
|
511
531
|
const searchKey = this.generateSearchKey(options);
|
|
512
|
-
|
|
532
|
+
|
|
513
533
|
// Check if we have cached search results
|
|
514
534
|
const cachedResults = this.cache.get(`search:${searchKey}`);
|
|
515
535
|
if (cachedResults) {
|
|
516
536
|
this.recordPerformance('search_cache', performance.now() - startTime);
|
|
517
537
|
return cachedResults;
|
|
518
538
|
}
|
|
519
|
-
|
|
539
|
+
|
|
520
540
|
const results: MemoryEntry[] = [];
|
|
521
|
-
|
|
541
|
+
|
|
522
542
|
// Search in cache first for immediate results
|
|
523
543
|
this.searchInCache(options, results);
|
|
524
|
-
|
|
544
|
+
|
|
525
545
|
// If not enough results, search database with optimized query
|
|
526
546
|
if (results.length < (options.limit || 10)) {
|
|
527
547
|
const dbResults = await this.db.searchMemory(options);
|
|
528
|
-
|
|
548
|
+
|
|
529
549
|
for (const dbEntry of dbResults) {
|
|
530
550
|
const entry: MemoryEntry = {
|
|
531
551
|
key: dbEntry.key,
|
|
@@ -534,30 +554,30 @@ export class Memory extends EventEmitter {
|
|
|
534
554
|
ttl: dbEntry.ttl,
|
|
535
555
|
createdAt: new Date(dbEntry.created_at),
|
|
536
556
|
accessCount: dbEntry.access_count,
|
|
537
|
-
lastAccessedAt: new Date(dbEntry.last_accessed_at)
|
|
557
|
+
lastAccessedAt: new Date(dbEntry.last_accessed_at),
|
|
538
558
|
};
|
|
539
|
-
|
|
540
|
-
if (!results.find(r => r.key === entry.key && r.namespace === entry.namespace)) {
|
|
559
|
+
|
|
560
|
+
if (!results.find((r) => r.key === entry.key && r.namespace === entry.namespace)) {
|
|
541
561
|
results.push(entry);
|
|
542
562
|
}
|
|
543
563
|
}
|
|
544
564
|
}
|
|
545
|
-
|
|
565
|
+
|
|
546
566
|
// Sort by relevance with advanced scoring
|
|
547
567
|
const sortedResults = this.sortByRelevance(results, options);
|
|
548
|
-
|
|
568
|
+
|
|
549
569
|
// Cache search results for future use (with shorter TTL)
|
|
550
570
|
this.cache.set(`search:${searchKey}`, sortedResults);
|
|
551
|
-
|
|
571
|
+
|
|
552
572
|
const duration = performance.now() - startTime;
|
|
553
573
|
this.recordPerformance('search_db', duration);
|
|
554
|
-
|
|
574
|
+
|
|
555
575
|
this.emit('searchCompleted', {
|
|
556
576
|
pattern: options.pattern,
|
|
557
577
|
results: sortedResults.length,
|
|
558
|
-
duration
|
|
578
|
+
duration,
|
|
559
579
|
});
|
|
560
|
-
|
|
580
|
+
|
|
561
581
|
return sortedResults;
|
|
562
582
|
}
|
|
563
583
|
|
|
@@ -569,7 +589,7 @@ export class Memory extends EventEmitter {
|
|
|
569
589
|
pattern: options.pattern,
|
|
570
590
|
namespace: options.namespace,
|
|
571
591
|
limit: options.limit,
|
|
572
|
-
sortBy: options.sortBy
|
|
592
|
+
sortBy: options.sortBy,
|
|
573
593
|
});
|
|
574
594
|
}
|
|
575
595
|
|
|
@@ -586,20 +606,20 @@ export class Memory extends EventEmitter {
|
|
|
586
606
|
*/
|
|
587
607
|
async delete(key: string, namespace: string = 'default'): Promise<void> {
|
|
588
608
|
const cacheKey = this.getCacheKey(key, namespace);
|
|
589
|
-
|
|
609
|
+
|
|
590
610
|
// Remove from cache
|
|
591
611
|
this.cache.delete(cacheKey);
|
|
592
|
-
|
|
612
|
+
|
|
593
613
|
// Remove from database
|
|
594
614
|
await this.db.deleteMemory(key, namespace);
|
|
595
|
-
|
|
615
|
+
|
|
596
616
|
// Remove from MCP memory
|
|
597
617
|
await this.mcpWrapper.deleteMemory({
|
|
598
618
|
action: 'delete',
|
|
599
619
|
key: `${this.swarmId}/${namespace}/${key}`,
|
|
600
|
-
namespace: 'hive-mind'
|
|
620
|
+
namespace: 'hive-mind',
|
|
601
621
|
});
|
|
602
|
-
|
|
622
|
+
|
|
603
623
|
this.emit('memoryDeleted', { key, namespace });
|
|
604
624
|
}
|
|
605
625
|
|
|
@@ -608,15 +628,15 @@ export class Memory extends EventEmitter {
|
|
|
608
628
|
*/
|
|
609
629
|
async list(namespace: string = 'default', limit: number = 100): Promise<MemoryEntry[]> {
|
|
610
630
|
const entries = await this.db.listMemory(namespace, limit);
|
|
611
|
-
|
|
612
|
-
return entries.map(dbEntry => ({
|
|
631
|
+
|
|
632
|
+
return entries.map((dbEntry) => ({
|
|
613
633
|
key: dbEntry.key,
|
|
614
634
|
namespace: dbEntry.namespace,
|
|
615
635
|
value: dbEntry.value,
|
|
616
636
|
ttl: dbEntry.ttl,
|
|
617
637
|
createdAt: new Date(dbEntry.created_at),
|
|
618
638
|
accessCount: dbEntry.access_count,
|
|
619
|
-
lastAccessedAt: new Date(dbEntry.last_accessed_at)
|
|
639
|
+
lastAccessedAt: new Date(dbEntry.last_accessed_at),
|
|
620
640
|
}));
|
|
621
641
|
}
|
|
622
642
|
|
|
@@ -625,20 +645,20 @@ export class Memory extends EventEmitter {
|
|
|
625
645
|
*/
|
|
626
646
|
async getStats(): Promise<MemoryStats> {
|
|
627
647
|
const stats = await this.db.getMemoryStats();
|
|
628
|
-
|
|
648
|
+
|
|
629
649
|
const byNamespace: Record<string, any> = {};
|
|
630
650
|
for (const ns of this.namespaces.values()) {
|
|
631
651
|
const nsStats = await this.db.getNamespaceStats(ns.name);
|
|
632
652
|
byNamespace[ns.name] = nsStats;
|
|
633
653
|
}
|
|
634
|
-
|
|
654
|
+
|
|
635
655
|
return {
|
|
636
656
|
totalEntries: stats.totalEntries,
|
|
637
657
|
totalSize: stats.totalSize,
|
|
638
658
|
byNamespace,
|
|
639
659
|
cacheHitRate: this.calculateCacheHitRate(),
|
|
640
660
|
avgAccessTime: this.calculateAvgAccessTime(),
|
|
641
|
-
hotKeys: await this.getHotKeys()
|
|
661
|
+
hotKeys: await this.getHotKeys(),
|
|
642
662
|
};
|
|
643
663
|
}
|
|
644
664
|
|
|
@@ -647,37 +667,37 @@ export class Memory extends EventEmitter {
|
|
|
647
667
|
*/
|
|
648
668
|
async learnPatterns(): Promise<MemoryPattern[]> {
|
|
649
669
|
const patterns: MemoryPattern[] = [];
|
|
650
|
-
|
|
670
|
+
|
|
651
671
|
// Analyze access patterns
|
|
652
672
|
const accessData = Array.from(this.accessPatterns.entries())
|
|
653
673
|
.sort((a, b) => b[1] - a[1])
|
|
654
674
|
.slice(0, 20); // Top 20 accessed keys
|
|
655
|
-
|
|
675
|
+
|
|
656
676
|
// Identify co-access patterns
|
|
657
677
|
const coAccessPatterns = await this.identifyCoAccessPatterns(accessData);
|
|
658
|
-
|
|
678
|
+
|
|
659
679
|
// Train neural patterns
|
|
660
680
|
if (coAccessPatterns.length > 0) {
|
|
661
681
|
await this.mcpWrapper.trainNeural({
|
|
662
682
|
pattern_type: 'prediction',
|
|
663
683
|
training_data: JSON.stringify({
|
|
664
684
|
accessPatterns: accessData,
|
|
665
|
-
coAccessPatterns
|
|
685
|
+
coAccessPatterns,
|
|
666
686
|
}),
|
|
667
|
-
epochs: 20
|
|
687
|
+
epochs: 20,
|
|
668
688
|
});
|
|
669
689
|
}
|
|
670
|
-
|
|
690
|
+
|
|
671
691
|
// Create pattern objects
|
|
672
692
|
for (const pattern of coAccessPatterns) {
|
|
673
693
|
patterns.push({
|
|
674
694
|
type: 'co-access',
|
|
675
695
|
keys: pattern.keys,
|
|
676
696
|
confidence: pattern.confidence,
|
|
677
|
-
frequency: pattern.frequency
|
|
697
|
+
frequency: pattern.frequency,
|
|
678
698
|
});
|
|
679
699
|
}
|
|
680
|
-
|
|
700
|
+
|
|
681
701
|
return patterns;
|
|
682
702
|
}
|
|
683
703
|
|
|
@@ -687,9 +707,9 @@ export class Memory extends EventEmitter {
|
|
|
687
707
|
async predictNextAccess(currentKey: string): Promise<string[]> {
|
|
688
708
|
const prediction = await this.mcpWrapper.predict({
|
|
689
709
|
modelId: 'memory-access-predictor',
|
|
690
|
-
input: currentKey
|
|
710
|
+
input: currentKey,
|
|
691
711
|
});
|
|
692
|
-
|
|
712
|
+
|
|
693
713
|
return prediction.predictions || [];
|
|
694
714
|
}
|
|
695
715
|
|
|
@@ -697,22 +717,15 @@ export class Memory extends EventEmitter {
|
|
|
697
717
|
* Compress memory entries
|
|
698
718
|
*/
|
|
699
719
|
async compress(namespace?: string): Promise<void> {
|
|
700
|
-
const entries = namespace
|
|
701
|
-
|
|
702
|
-
: await this.db.getAllMemoryEntries();
|
|
703
|
-
|
|
720
|
+
const entries = namespace ? await this.list(namespace) : await this.db.getAllMemoryEntries();
|
|
721
|
+
|
|
704
722
|
for (const entry of entries) {
|
|
705
723
|
if (this.shouldCompress(entry)) {
|
|
706
724
|
const compressed = await this.compressEntry(entry);
|
|
707
|
-
await this.store(
|
|
708
|
-
entry.key,
|
|
709
|
-
compressed,
|
|
710
|
-
entry.namespace,
|
|
711
|
-
entry.ttl
|
|
712
|
-
);
|
|
725
|
+
await this.store(entry.key, compressed, entry.namespace, entry.ttl);
|
|
713
726
|
}
|
|
714
727
|
}
|
|
715
|
-
|
|
728
|
+
|
|
716
729
|
this.emit('memoryCompressed', { namespace });
|
|
717
730
|
}
|
|
718
731
|
|
|
@@ -721,23 +734,23 @@ export class Memory extends EventEmitter {
|
|
|
721
734
|
*/
|
|
722
735
|
async backup(path: string): Promise<void> {
|
|
723
736
|
const allEntries = await this.db.getAllMemoryEntries();
|
|
724
|
-
|
|
737
|
+
|
|
725
738
|
const backup = {
|
|
726
739
|
swarmId: this.swarmId,
|
|
727
740
|
timestamp: new Date(),
|
|
728
741
|
entries: allEntries,
|
|
729
742
|
namespaces: Array.from(this.namespaces.values()),
|
|
730
|
-
patterns: await this.learnPatterns()
|
|
743
|
+
patterns: await this.learnPatterns(),
|
|
731
744
|
};
|
|
732
|
-
|
|
745
|
+
|
|
733
746
|
// Store backup using MCP
|
|
734
747
|
await this.mcpWrapper.storeMemory({
|
|
735
748
|
action: 'store',
|
|
736
749
|
key: `backup/${this.swarmId}/${Date.now()}`,
|
|
737
750
|
value: JSON.stringify(backup),
|
|
738
|
-
namespace: 'hive-mind-backups'
|
|
751
|
+
namespace: 'hive-mind-backups',
|
|
739
752
|
});
|
|
740
|
-
|
|
753
|
+
|
|
741
754
|
this.emit('memoryBackedUp', { path, entryCount: allEntries.length });
|
|
742
755
|
}
|
|
743
756
|
|
|
@@ -748,29 +761,24 @@ export class Memory extends EventEmitter {
|
|
|
748
761
|
const backupData = await this.mcpWrapper.retrieveMemory({
|
|
749
762
|
action: 'retrieve',
|
|
750
763
|
key: backupId,
|
|
751
|
-
namespace: 'hive-mind-backups'
|
|
764
|
+
namespace: 'hive-mind-backups',
|
|
752
765
|
});
|
|
753
|
-
|
|
766
|
+
|
|
754
767
|
if (!backupData) {
|
|
755
768
|
throw new Error('Backup not found');
|
|
756
769
|
}
|
|
757
|
-
|
|
770
|
+
|
|
758
771
|
const backup = JSON.parse(backupData);
|
|
759
|
-
|
|
772
|
+
|
|
760
773
|
// Clear existing memory
|
|
761
774
|
await this.db.clearMemory(this.swarmId);
|
|
762
775
|
this.cache.clear();
|
|
763
|
-
|
|
776
|
+
|
|
764
777
|
// Restore entries
|
|
765
778
|
for (const entry of backup.entries) {
|
|
766
|
-
await this.store(
|
|
767
|
-
entry.key,
|
|
768
|
-
entry.value,
|
|
769
|
-
entry.namespace,
|
|
770
|
-
entry.ttl
|
|
771
|
-
);
|
|
779
|
+
await this.store(entry.key, entry.value, entry.namespace, entry.ttl);
|
|
772
780
|
}
|
|
773
|
-
|
|
781
|
+
|
|
774
782
|
this.emit('memoryRestored', { backupId, entryCount: backup.entries.length });
|
|
775
783
|
}
|
|
776
784
|
|
|
@@ -783,40 +791,40 @@ export class Memory extends EventEmitter {
|
|
|
783
791
|
name: 'default',
|
|
784
792
|
description: 'Default memory namespace',
|
|
785
793
|
retentionPolicy: 'persistent',
|
|
786
|
-
maxEntries: 10000
|
|
794
|
+
maxEntries: 10000,
|
|
787
795
|
},
|
|
788
796
|
{
|
|
789
797
|
name: 'task-results',
|
|
790
798
|
description: 'Task execution results',
|
|
791
799
|
retentionPolicy: 'time-based',
|
|
792
|
-
ttl: 86400 * 7 // 7 days
|
|
800
|
+
ttl: 86400 * 7, // 7 days
|
|
793
801
|
},
|
|
794
802
|
{
|
|
795
803
|
name: 'agent-state',
|
|
796
804
|
description: 'Agent state and context',
|
|
797
805
|
retentionPolicy: 'time-based',
|
|
798
|
-
ttl: 86400 // 1 day
|
|
806
|
+
ttl: 86400, // 1 day
|
|
799
807
|
},
|
|
800
808
|
{
|
|
801
809
|
name: 'learning-data',
|
|
802
810
|
description: 'Machine learning training data',
|
|
803
811
|
retentionPolicy: 'persistent',
|
|
804
|
-
maxEntries: 50000
|
|
812
|
+
maxEntries: 50000,
|
|
805
813
|
},
|
|
806
814
|
{
|
|
807
815
|
name: 'performance-metrics',
|
|
808
816
|
description: 'Performance and optimization data',
|
|
809
817
|
retentionPolicy: 'time-based',
|
|
810
|
-
ttl: 86400 * 30 // 30 days
|
|
818
|
+
ttl: 86400 * 30, // 30 days
|
|
811
819
|
},
|
|
812
820
|
{
|
|
813
821
|
name: 'decisions',
|
|
814
822
|
description: 'Strategic decisions and rationale',
|
|
815
823
|
retentionPolicy: 'persistent',
|
|
816
|
-
maxEntries: 10000
|
|
817
|
-
}
|
|
824
|
+
maxEntries: 10000,
|
|
825
|
+
},
|
|
818
826
|
];
|
|
819
|
-
|
|
827
|
+
|
|
820
828
|
for (const ns of defaultNamespaces) {
|
|
821
829
|
this.namespaces.set(ns.name, ns);
|
|
822
830
|
}
|
|
@@ -827,7 +835,7 @@ export class Memory extends EventEmitter {
|
|
|
827
835
|
*/
|
|
828
836
|
private async loadMemoryFromDatabase(): Promise<void> {
|
|
829
837
|
const recentEntries = await this.db.getRecentMemoryEntries(100);
|
|
830
|
-
|
|
838
|
+
|
|
831
839
|
for (const dbEntry of recentEntries) {
|
|
832
840
|
const entry: MemoryEntry = {
|
|
833
841
|
key: dbEntry.key,
|
|
@@ -836,9 +844,9 @@ export class Memory extends EventEmitter {
|
|
|
836
844
|
ttl: dbEntry.ttl,
|
|
837
845
|
createdAt: new Date(dbEntry.created_at),
|
|
838
846
|
accessCount: dbEntry.access_count,
|
|
839
|
-
lastAccessedAt: new Date(dbEntry.last_accessed_at)
|
|
847
|
+
lastAccessedAt: new Date(dbEntry.last_accessed_at),
|
|
840
848
|
};
|
|
841
|
-
|
|
849
|
+
|
|
842
850
|
const cacheKey = this.getCacheKey(entry.key, entry.namespace);
|
|
843
851
|
this.cache.set(cacheKey, entry);
|
|
844
852
|
}
|
|
@@ -853,25 +861,25 @@ export class Memory extends EventEmitter {
|
|
|
853
861
|
if (!this.isActive) return;
|
|
854
862
|
await this.optimizeCache();
|
|
855
863
|
}, 30000);
|
|
856
|
-
|
|
864
|
+
|
|
857
865
|
// Performance monitoring (every 10 seconds)
|
|
858
866
|
const metricsTimer = setInterval(() => {
|
|
859
867
|
if (!this.isActive) return;
|
|
860
868
|
this.updatePerformanceMetrics();
|
|
861
869
|
}, 10000);
|
|
862
|
-
|
|
870
|
+
|
|
863
871
|
// Memory cleanup (every 5 minutes)
|
|
864
872
|
const cleanupTimer = setInterval(async () => {
|
|
865
873
|
if (!this.isActive) return;
|
|
866
874
|
await this.performMemoryCleanup();
|
|
867
875
|
}, 300000);
|
|
868
|
-
|
|
876
|
+
|
|
869
877
|
// Pattern analysis (every 2 minutes)
|
|
870
878
|
const patternTimer = setInterval(async () => {
|
|
871
879
|
if (!this.isActive) return;
|
|
872
880
|
await this.analyzeAccessPatterns();
|
|
873
881
|
}, 120000);
|
|
874
|
-
|
|
882
|
+
|
|
875
883
|
this.optimizationTimers.push(cacheTimer, metricsTimer, cleanupTimer, patternTimer);
|
|
876
884
|
}
|
|
877
885
|
|
|
@@ -880,13 +888,13 @@ export class Memory extends EventEmitter {
|
|
|
880
888
|
*/
|
|
881
889
|
private async optimizeCache(): Promise<void> {
|
|
882
890
|
const stats = this.cache.getStats();
|
|
883
|
-
|
|
891
|
+
|
|
884
892
|
// If hit rate is low, we might need to adjust caching strategy
|
|
885
893
|
if (stats.hitRate < 50 && stats.size > 1000) {
|
|
886
894
|
// Emit warning for potential cache optimization
|
|
887
895
|
this.emit('cacheOptimizationNeeded', stats);
|
|
888
896
|
}
|
|
889
|
-
|
|
897
|
+
|
|
890
898
|
this.emit('cacheOptimized', stats);
|
|
891
899
|
}
|
|
892
900
|
|
|
@@ -895,16 +903,16 @@ export class Memory extends EventEmitter {
|
|
|
895
903
|
*/
|
|
896
904
|
private async performMemoryCleanup(): Promise<void> {
|
|
897
905
|
const startTime = performance.now();
|
|
898
|
-
|
|
906
|
+
|
|
899
907
|
// Clean expired entries from database
|
|
900
908
|
await this.evictExpiredEntries();
|
|
901
|
-
|
|
909
|
+
|
|
902
910
|
// Optimize object pools
|
|
903
911
|
this.optimizeObjectPools();
|
|
904
|
-
|
|
912
|
+
|
|
905
913
|
// Clean up old access patterns
|
|
906
914
|
this.cleanupAccessPatterns();
|
|
907
|
-
|
|
915
|
+
|
|
908
916
|
const duration = performance.now() - startTime;
|
|
909
917
|
this.emit('memoryCleanupCompleted', { duration });
|
|
910
918
|
}
|
|
@@ -914,17 +922,17 @@ export class Memory extends EventEmitter {
|
|
|
914
922
|
*/
|
|
915
923
|
private async analyzeAccessPatterns(): Promise<void> {
|
|
916
924
|
const patterns = await this.learnPatterns();
|
|
917
|
-
|
|
925
|
+
|
|
918
926
|
if (patterns.length > 0) {
|
|
919
927
|
// Store learned patterns for future optimization
|
|
920
928
|
await this.store(
|
|
921
929
|
'learned-patterns',
|
|
922
930
|
patterns,
|
|
923
931
|
'performance-metrics',
|
|
924
|
-
3600 // 1 hour TTL
|
|
932
|
+
3600, // 1 hour TTL
|
|
925
933
|
);
|
|
926
934
|
}
|
|
927
|
-
|
|
935
|
+
|
|
928
936
|
this.emit('patternsAnalyzed', { count: patterns.length });
|
|
929
937
|
}
|
|
930
938
|
|
|
@@ -934,20 +942,19 @@ export class Memory extends EventEmitter {
|
|
|
934
942
|
private startPatternAnalyzer(): void {
|
|
935
943
|
setInterval(async () => {
|
|
936
944
|
if (!this.isActive) return;
|
|
937
|
-
|
|
945
|
+
|
|
938
946
|
// Learn access patterns
|
|
939
947
|
const patterns = await this.learnPatterns();
|
|
940
|
-
|
|
948
|
+
|
|
941
949
|
// Store patterns for future use
|
|
942
950
|
if (patterns.length > 0) {
|
|
943
951
|
await this.store(
|
|
944
952
|
'access-patterns',
|
|
945
953
|
patterns,
|
|
946
954
|
'learning-data',
|
|
947
|
-
86400 // 1 day
|
|
955
|
+
86400, // 1 day
|
|
948
956
|
);
|
|
949
957
|
}
|
|
950
|
-
|
|
951
958
|
}, 300000); // Every 5 minutes
|
|
952
959
|
}
|
|
953
960
|
|
|
@@ -957,20 +964,19 @@ export class Memory extends EventEmitter {
|
|
|
957
964
|
private startMemoryOptimizer(): void {
|
|
958
965
|
setInterval(async () => {
|
|
959
966
|
if (!this.isActive) return;
|
|
960
|
-
|
|
967
|
+
|
|
961
968
|
// Compress old entries
|
|
962
969
|
await this.compressOldEntries();
|
|
963
|
-
|
|
970
|
+
|
|
964
971
|
// Optimize namespaces
|
|
965
972
|
await this.optimizeNamespaces();
|
|
966
|
-
|
|
967
973
|
}, 3600000); // Every hour
|
|
968
974
|
}
|
|
969
975
|
|
|
970
976
|
/**
|
|
971
977
|
* Enhanced helper methods with performance optimizations
|
|
972
978
|
*/
|
|
973
|
-
|
|
979
|
+
|
|
974
980
|
private getCacheKey(key: string, namespace: string): string {
|
|
975
981
|
return `${namespace}:${key}`;
|
|
976
982
|
}
|
|
@@ -985,7 +991,7 @@ export class Memory extends EventEmitter {
|
|
|
985
991
|
const compressed = {
|
|
986
992
|
_compressed: true,
|
|
987
993
|
_originalSize: data.length,
|
|
988
|
-
data: data.substring(0, Math.floor(data.length * 0.7)) // Simulate 30% compression
|
|
994
|
+
data: data.substring(0, Math.floor(data.length * 0.7)), // Simulate 30% compression
|
|
989
995
|
};
|
|
990
996
|
return JSON.stringify(compressed);
|
|
991
997
|
} catch {
|
|
@@ -1015,10 +1021,10 @@ export class Memory extends EventEmitter {
|
|
|
1015
1021
|
if (!this.performanceMetrics.has(operation)) {
|
|
1016
1022
|
this.performanceMetrics.set(operation, []);
|
|
1017
1023
|
}
|
|
1018
|
-
|
|
1024
|
+
|
|
1019
1025
|
const metrics = this.performanceMetrics.get(operation)!;
|
|
1020
1026
|
metrics.push(duration);
|
|
1021
|
-
|
|
1027
|
+
|
|
1022
1028
|
// Keep only last 100 measurements
|
|
1023
1029
|
if (metrics.length > 100) {
|
|
1024
1030
|
metrics.shift();
|
|
@@ -1030,24 +1036,32 @@ export class Memory extends EventEmitter {
|
|
|
1030
1036
|
*/
|
|
1031
1037
|
private updateAccessPattern(key: string, operation: string): void {
|
|
1032
1038
|
const pattern = this.accessPatterns.get(key) || 0;
|
|
1033
|
-
|
|
1039
|
+
|
|
1034
1040
|
// Weight different operations differently
|
|
1035
1041
|
let weight = 1;
|
|
1036
1042
|
switch (operation) {
|
|
1037
|
-
case 'cache_hit':
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
case '
|
|
1043
|
+
case 'cache_hit':
|
|
1044
|
+
weight = 0.5;
|
|
1045
|
+
break;
|
|
1046
|
+
case 'db_hit':
|
|
1047
|
+
weight = 1;
|
|
1048
|
+
break;
|
|
1049
|
+
case 'write':
|
|
1050
|
+
weight = 2;
|
|
1051
|
+
break;
|
|
1052
|
+
case 'miss':
|
|
1053
|
+
weight = 0.1;
|
|
1054
|
+
break;
|
|
1041
1055
|
}
|
|
1042
|
-
|
|
1056
|
+
|
|
1043
1057
|
this.accessPatterns.set(key, pattern + weight);
|
|
1044
|
-
|
|
1058
|
+
|
|
1045
1059
|
// Limit access patterns size
|
|
1046
1060
|
if (this.accessPatterns.size > 10000) {
|
|
1047
1061
|
const entries = Array.from(this.accessPatterns.entries())
|
|
1048
1062
|
.sort((a, b) => a[1] - b[1])
|
|
1049
1063
|
.slice(0, 1000); // Remove least accessed
|
|
1050
|
-
|
|
1064
|
+
|
|
1051
1065
|
this.accessPatterns.clear();
|
|
1052
1066
|
entries.forEach(([k, v]) => this.accessPatterns.set(k, v));
|
|
1053
1067
|
}
|
|
@@ -1058,7 +1072,7 @@ export class Memory extends EventEmitter {
|
|
|
1058
1072
|
*/
|
|
1059
1073
|
private updatePerformanceMetrics(): void {
|
|
1060
1074
|
const metrics: any = {};
|
|
1061
|
-
|
|
1075
|
+
|
|
1062
1076
|
// Calculate averages for each operation
|
|
1063
1077
|
for (const [operation, durations] of this.performanceMetrics) {
|
|
1064
1078
|
if (durations.length > 0) {
|
|
@@ -1068,11 +1082,11 @@ export class Memory extends EventEmitter {
|
|
|
1068
1082
|
metrics[`${operation}_min`] = Math.min(...durations);
|
|
1069
1083
|
}
|
|
1070
1084
|
}
|
|
1071
|
-
|
|
1085
|
+
|
|
1072
1086
|
// Add cache statistics
|
|
1073
1087
|
const cacheStats = this.cache.getStats();
|
|
1074
1088
|
metrics.cache = cacheStats;
|
|
1075
|
-
|
|
1089
|
+
|
|
1076
1090
|
// Add pool statistics
|
|
1077
1091
|
if (this.objectPools.size > 0) {
|
|
1078
1092
|
metrics.pools = {};
|
|
@@ -1080,7 +1094,7 @@ export class Memory extends EventEmitter {
|
|
|
1080
1094
|
metrics.pools[name] = pool.getStats();
|
|
1081
1095
|
}
|
|
1082
1096
|
}
|
|
1083
|
-
|
|
1097
|
+
|
|
1084
1098
|
this.emit('performanceUpdate', metrics);
|
|
1085
1099
|
}
|
|
1086
1100
|
|
|
@@ -1090,7 +1104,7 @@ export class Memory extends EventEmitter {
|
|
|
1090
1104
|
private optimizeObjectPools(): void {
|
|
1091
1105
|
for (const [name, pool] of this.objectPools) {
|
|
1092
1106
|
const stats = pool.getStats();
|
|
1093
|
-
|
|
1107
|
+
|
|
1094
1108
|
// If reuse rate is low, the pool might be too small
|
|
1095
1109
|
if (stats.reuseRate < 30 && stats.poolSize < 500) {
|
|
1096
1110
|
this.emit('poolOptimizationSuggested', { name, stats });
|
|
@@ -1105,15 +1119,15 @@ export class Memory extends EventEmitter {
|
|
|
1105
1119
|
// Remove patterns with very low access counts
|
|
1106
1120
|
const threshold = 0.5;
|
|
1107
1121
|
const toRemove: string[] = [];
|
|
1108
|
-
|
|
1122
|
+
|
|
1109
1123
|
for (const [key, count] of this.accessPatterns) {
|
|
1110
1124
|
if (count < threshold) {
|
|
1111
1125
|
toRemove.push(key);
|
|
1112
1126
|
}
|
|
1113
1127
|
}
|
|
1114
|
-
|
|
1115
|
-
toRemove.forEach(key => this.accessPatterns.delete(key));
|
|
1116
|
-
|
|
1128
|
+
|
|
1129
|
+
toRemove.forEach((key) => this.accessPatterns.delete(key));
|
|
1130
|
+
|
|
1117
1131
|
if (toRemove.length > 0) {
|
|
1118
1132
|
this.emit('accessPatternsCleanedUp', { removed: toRemove.length });
|
|
1119
1133
|
}
|
|
@@ -1130,12 +1144,12 @@ export class Memory extends EventEmitter {
|
|
|
1130
1144
|
private updateAccessStats(entry: MemoryEntry): void {
|
|
1131
1145
|
entry.accessCount++;
|
|
1132
1146
|
entry.lastAccessedAt = new Date();
|
|
1133
|
-
|
|
1147
|
+
|
|
1134
1148
|
const cacheKey = this.getCacheKey(entry.key, entry.namespace);
|
|
1135
1149
|
this.updateAccessPattern(cacheKey, 'read');
|
|
1136
|
-
|
|
1150
|
+
|
|
1137
1151
|
// Update in database asynchronously
|
|
1138
|
-
this.db.updateMemoryAccess(entry.key, entry.namespace).catch(err => {
|
|
1152
|
+
this.db.updateMemoryAccess(entry.key, entry.namespace).catch((err) => {
|
|
1139
1153
|
this.emit('error', err);
|
|
1140
1154
|
});
|
|
1141
1155
|
}
|
|
@@ -1152,45 +1166,47 @@ export class Memory extends EventEmitter {
|
|
|
1152
1166
|
if (options.namespace && entry.namespace !== options.namespace) {
|
|
1153
1167
|
return false;
|
|
1154
1168
|
}
|
|
1155
|
-
|
|
1169
|
+
|
|
1156
1170
|
if (options.pattern) {
|
|
1157
1171
|
const regex = new RegExp(options.pattern, 'i');
|
|
1158
1172
|
return regex.test(entry.key) || regex.test(entry.value);
|
|
1159
1173
|
}
|
|
1160
|
-
|
|
1174
|
+
|
|
1161
1175
|
if (options.keyPrefix && !entry.key.startsWith(options.keyPrefix)) {
|
|
1162
1176
|
return false;
|
|
1163
1177
|
}
|
|
1164
|
-
|
|
1178
|
+
|
|
1165
1179
|
if (options.minAccessCount && entry.accessCount < options.minAccessCount) {
|
|
1166
1180
|
return false;
|
|
1167
1181
|
}
|
|
1168
|
-
|
|
1182
|
+
|
|
1169
1183
|
return true;
|
|
1170
1184
|
}
|
|
1171
1185
|
|
|
1172
1186
|
private sortByRelevance(entries: MemoryEntry[], options: MemorySearchOptions): MemoryEntry[] {
|
|
1173
|
-
return entries
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
+
return entries
|
|
1188
|
+
.sort((a, b) => {
|
|
1189
|
+
// Sort by access count (most accessed first)
|
|
1190
|
+
if (options.sortBy === 'access') {
|
|
1191
|
+
return b.accessCount - a.accessCount;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
// Sort by recency (most recent first)
|
|
1195
|
+
if (options.sortBy === 'recent') {
|
|
1196
|
+
return b.lastAccessedAt.getTime() - a.lastAccessedAt.getTime();
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
// Default: sort by creation time
|
|
1200
|
+
return b.createdAt.getTime() - a.createdAt.getTime();
|
|
1201
|
+
})
|
|
1202
|
+
.slice(0, options.limit || 10);
|
|
1187
1203
|
}
|
|
1188
1204
|
|
|
1189
1205
|
private calculateCacheHitRate(): number {
|
|
1190
1206
|
// Simple calculation - would need more sophisticated tracking in production
|
|
1191
1207
|
const totalAccesses = Array.from(this.accessPatterns.values()).reduce((a, b) => a + b, 0);
|
|
1192
1208
|
const cacheHits = this.cache.size;
|
|
1193
|
-
|
|
1209
|
+
|
|
1194
1210
|
return totalAccesses > 0 ? (cacheHits / totalAccesses) * 100 : 0;
|
|
1195
1211
|
}
|
|
1196
1212
|
|
|
@@ -1209,19 +1225,19 @@ export class Memory extends EventEmitter {
|
|
|
1209
1225
|
private async identifyCoAccessPatterns(accessData: [string, number][]): Promise<any[]> {
|
|
1210
1226
|
// Simplified co-access pattern detection
|
|
1211
1227
|
const patterns: any[] = [];
|
|
1212
|
-
|
|
1228
|
+
|
|
1213
1229
|
for (let i = 0; i < accessData.length - 1; i++) {
|
|
1214
1230
|
for (let j = i + 1; j < Math.min(i + 5, accessData.length); j++) {
|
|
1215
1231
|
if (Math.abs(accessData[i][1] - accessData[j][1]) < 10) {
|
|
1216
1232
|
patterns.push({
|
|
1217
1233
|
keys: [accessData[i][0], accessData[j][0]],
|
|
1218
1234
|
confidence: 0.8,
|
|
1219
|
-
frequency: Math.min(accessData[i][1], accessData[j][1])
|
|
1235
|
+
frequency: Math.min(accessData[i][1], accessData[j][1]),
|
|
1220
1236
|
});
|
|
1221
1237
|
}
|
|
1222
1238
|
}
|
|
1223
1239
|
}
|
|
1224
|
-
|
|
1240
|
+
|
|
1225
1241
|
return patterns;
|
|
1226
1242
|
}
|
|
1227
1243
|
|
|
@@ -1231,7 +1247,7 @@ export class Memory extends EventEmitter {
|
|
|
1231
1247
|
const isOld = ageInDays > 7;
|
|
1232
1248
|
const isLarge = entry.value.length > 10000;
|
|
1233
1249
|
const isRarelyAccessed = entry.accessCount < 5;
|
|
1234
|
-
|
|
1250
|
+
|
|
1235
1251
|
return isOld && isLarge && isRarelyAccessed;
|
|
1236
1252
|
}
|
|
1237
1253
|
|
|
@@ -1240,22 +1256,22 @@ export class Memory extends EventEmitter {
|
|
|
1240
1256
|
const compressed = {
|
|
1241
1257
|
_compressed: true,
|
|
1242
1258
|
_original_length: entry.value.length,
|
|
1243
|
-
data: entry.value // Would actually compress here
|
|
1259
|
+
data: entry.value, // Would actually compress here
|
|
1244
1260
|
};
|
|
1245
|
-
|
|
1261
|
+
|
|
1246
1262
|
return JSON.stringify(compressed);
|
|
1247
1263
|
}
|
|
1248
1264
|
|
|
1249
1265
|
private async evictExpiredEntries(): Promise<void> {
|
|
1250
1266
|
const now = Date.now();
|
|
1251
1267
|
const toEvict: string[] = [];
|
|
1252
|
-
|
|
1268
|
+
|
|
1253
1269
|
for (const [cacheKey, entry] of this.cache) {
|
|
1254
|
-
if (entry.ttl && entry.createdAt.getTime() +
|
|
1270
|
+
if (entry.ttl && entry.createdAt.getTime() + entry.ttl * 1000 < now) {
|
|
1255
1271
|
toEvict.push(cacheKey);
|
|
1256
1272
|
}
|
|
1257
1273
|
}
|
|
1258
|
-
|
|
1274
|
+
|
|
1259
1275
|
for (const key of toEvict) {
|
|
1260
1276
|
const entry = this.cache.get(key)!;
|
|
1261
1277
|
await this.delete(entry.key, entry.namespace);
|
|
@@ -1264,14 +1280,15 @@ export class Memory extends EventEmitter {
|
|
|
1264
1280
|
|
|
1265
1281
|
private async manageCacheSize(): Promise<void> {
|
|
1266
1282
|
const maxCacheSize = 1000;
|
|
1267
|
-
|
|
1283
|
+
|
|
1268
1284
|
if (this.cache.size > maxCacheSize) {
|
|
1269
1285
|
// Evict least recently used entries
|
|
1270
|
-
const entries = Array.from(this.cache.entries())
|
|
1271
|
-
|
|
1272
|
-
|
|
1286
|
+
const entries = Array.from(this.cache.entries()).sort(
|
|
1287
|
+
(a, b) => a[1].lastAccessedAt.getTime() - b[1].lastAccessedAt.getTime(),
|
|
1288
|
+
);
|
|
1289
|
+
|
|
1273
1290
|
const toEvict = entries.slice(0, entries.length - maxCacheSize);
|
|
1274
|
-
|
|
1291
|
+
|
|
1275
1292
|
for (const [cacheKey] of toEvict) {
|
|
1276
1293
|
this.cache.delete(cacheKey);
|
|
1277
1294
|
}
|
|
@@ -1280,16 +1297,11 @@ export class Memory extends EventEmitter {
|
|
|
1280
1297
|
|
|
1281
1298
|
private async compressOldEntries(): Promise<void> {
|
|
1282
1299
|
const oldEntries = await this.db.getOldMemoryEntries(30); // 30 days old
|
|
1283
|
-
|
|
1300
|
+
|
|
1284
1301
|
for (const entry of oldEntries) {
|
|
1285
1302
|
if (this.shouldCompress(entry)) {
|
|
1286
1303
|
const compressed = await this.compressEntry(entry);
|
|
1287
|
-
await this.store(
|
|
1288
|
-
entry.key,
|
|
1289
|
-
compressed,
|
|
1290
|
-
entry.namespace,
|
|
1291
|
-
entry.ttl
|
|
1292
|
-
);
|
|
1304
|
+
await this.store(entry.key, compressed, entry.namespace, entry.ttl);
|
|
1293
1305
|
}
|
|
1294
1306
|
}
|
|
1295
1307
|
}
|
|
@@ -1297,12 +1309,12 @@ export class Memory extends EventEmitter {
|
|
|
1297
1309
|
private async optimizeNamespaces(): Promise<void> {
|
|
1298
1310
|
for (const namespace of this.namespaces.values()) {
|
|
1299
1311
|
const stats = await this.db.getNamespaceStats(namespace.name);
|
|
1300
|
-
|
|
1312
|
+
|
|
1301
1313
|
// Apply retention policies
|
|
1302
1314
|
if (namespace.retentionPolicy === 'time-based' && namespace.ttl) {
|
|
1303
1315
|
await this.db.deleteOldEntries(namespace.name, namespace.ttl);
|
|
1304
1316
|
}
|
|
1305
|
-
|
|
1317
|
+
|
|
1306
1318
|
if (namespace.retentionPolicy === 'size-based' && namespace.maxEntries) {
|
|
1307
1319
|
if (stats.entries > namespace.maxEntries) {
|
|
1308
1320
|
await this.db.trimNamespace(namespace.name, namespace.maxEntries);
|
|
@@ -1316,25 +1328,25 @@ export class Memory extends EventEmitter {
|
|
|
1316
1328
|
*/
|
|
1317
1329
|
async shutdown(): Promise<void> {
|
|
1318
1330
|
this.isActive = false;
|
|
1319
|
-
|
|
1331
|
+
|
|
1320
1332
|
// Clear all optimization timers
|
|
1321
|
-
this.optimizationTimers.forEach(timer => clearInterval(timer));
|
|
1333
|
+
this.optimizationTimers.forEach((timer) => clearInterval(timer));
|
|
1322
1334
|
this.optimizationTimers.length = 0;
|
|
1323
|
-
|
|
1335
|
+
|
|
1324
1336
|
// Final performance snapshot
|
|
1325
1337
|
const finalMetrics = {
|
|
1326
1338
|
cache: this.cache.getStats(),
|
|
1327
1339
|
accessPatterns: this.accessPatterns.size,
|
|
1328
|
-
performance: Object.fromEntries(this.performanceMetrics)
|
|
1340
|
+
performance: Object.fromEntries(this.performanceMetrics),
|
|
1329
1341
|
};
|
|
1330
|
-
|
|
1342
|
+
|
|
1331
1343
|
// Clear cache and pools
|
|
1332
1344
|
this.cache.clear();
|
|
1333
1345
|
for (const pool of this.objectPools.values()) {
|
|
1334
1346
|
// Pools will be garbage collected
|
|
1335
1347
|
}
|
|
1336
1348
|
this.objectPools.clear();
|
|
1337
|
-
|
|
1349
|
+
|
|
1338
1350
|
this.emit('shutdown', finalMetrics);
|
|
1339
1351
|
}
|
|
1340
1352
|
|
|
@@ -1352,23 +1364,20 @@ export class Memory extends EventEmitter {
|
|
|
1352
1364
|
avg: durations.reduce((a, b) => a + b, 0) / durations.length,
|
|
1353
1365
|
count: durations.length,
|
|
1354
1366
|
max: Math.max(...durations),
|
|
1355
|
-
min: Math.min(...durations)
|
|
1356
|
-
}
|
|
1357
|
-
])
|
|
1367
|
+
min: Math.min(...durations),
|
|
1368
|
+
},
|
|
1369
|
+
]),
|
|
1358
1370
|
),
|
|
1359
1371
|
pools: Object.fromEntries(
|
|
1360
|
-
Array.from(this.objectPools.entries()).map(([name, pool]) => [
|
|
1361
|
-
name,
|
|
1362
|
-
pool.getStats()
|
|
1363
|
-
])
|
|
1372
|
+
Array.from(this.objectPools.entries()).map(([name, pool]) => [name, pool.getStats()]),
|
|
1364
1373
|
),
|
|
1365
1374
|
accessPatterns: {
|
|
1366
1375
|
total: this.accessPatterns.size,
|
|
1367
1376
|
hotKeys: Array.from(this.accessPatterns.entries())
|
|
1368
1377
|
.sort((a, b) => b[1] - a[1])
|
|
1369
1378
|
.slice(0, 10)
|
|
1370
|
-
.map(([key, count]) => ({ key, count }))
|
|
1371
|
-
}
|
|
1379
|
+
.map(([key, count]) => ({ key, count })),
|
|
1380
|
+
},
|
|
1372
1381
|
};
|
|
1373
1382
|
}
|
|
1374
1383
|
|
|
@@ -1381,16 +1390,16 @@ export class Memory extends EventEmitter {
|
|
|
1381
1390
|
status: 'healthy' as 'healthy' | 'warning' | 'critical',
|
|
1382
1391
|
score: 100,
|
|
1383
1392
|
issues: [] as string[],
|
|
1384
|
-
recommendations: [] as string[]
|
|
1393
|
+
recommendations: [] as string[],
|
|
1385
1394
|
};
|
|
1386
|
-
|
|
1395
|
+
|
|
1387
1396
|
// Check cache performance
|
|
1388
1397
|
if (analytics.cache.hitRate < 50) {
|
|
1389
1398
|
health.score -= 20;
|
|
1390
1399
|
health.issues.push('Low cache hit rate');
|
|
1391
1400
|
health.recommendations.push('Consider increasing cache size or reviewing access patterns');
|
|
1392
1401
|
}
|
|
1393
|
-
|
|
1402
|
+
|
|
1394
1403
|
// Check memory utilization
|
|
1395
1404
|
if (analytics.cache.utilizationPercent > 90) {
|
|
1396
1405
|
health.score -= 30;
|
|
@@ -1398,7 +1407,7 @@ export class Memory extends EventEmitter {
|
|
|
1398
1407
|
health.issues.push('High cache memory utilization');
|
|
1399
1408
|
health.recommendations.push('Increase cache memory limit or optimize data storage');
|
|
1400
1409
|
}
|
|
1401
|
-
|
|
1410
|
+
|
|
1402
1411
|
// Check performance metrics
|
|
1403
1412
|
const avgRetrieveTime = analytics.performance.retrieve_db?.avg || 0;
|
|
1404
1413
|
if (avgRetrieveTime > 100) {
|
|
@@ -1406,7 +1415,7 @@ export class Memory extends EventEmitter {
|
|
|
1406
1415
|
health.issues.push('Slow database retrieval performance');
|
|
1407
1416
|
health.recommendations.push('Consider database optimization or indexing improvements');
|
|
1408
1417
|
}
|
|
1409
|
-
|
|
1418
|
+
|
|
1410
1419
|
// Check pool efficiency
|
|
1411
1420
|
for (const [name, stats] of Object.entries(analytics.pools)) {
|
|
1412
1421
|
if (stats.reuseRate < 30) {
|
|
@@ -1415,14 +1424,14 @@ export class Memory extends EventEmitter {
|
|
|
1415
1424
|
health.recommendations.push(`Increase ${name} pool size or review object lifecycle`);
|
|
1416
1425
|
}
|
|
1417
1426
|
}
|
|
1418
|
-
|
|
1427
|
+
|
|
1419
1428
|
// Determine final status
|
|
1420
1429
|
if (health.score < 60) {
|
|
1421
1430
|
health.status = 'critical';
|
|
1422
1431
|
} else if (health.score < 80) {
|
|
1423
1432
|
health.status = 'warning';
|
|
1424
1433
|
}
|
|
1425
|
-
|
|
1434
|
+
|
|
1426
1435
|
return health;
|
|
1427
1436
|
}
|
|
1428
|
-
}
|
|
1437
|
+
}
|