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,4 +1,3 @@
|
|
|
1
|
-
import { getErrorMessage } from '../utils/error-handler.js';
|
|
2
1
|
/**
|
|
3
2
|
* Advanced Memory Management System with comprehensive capabilities
|
|
4
3
|
* Includes indexing, compression, cross-agent sharing, and intelligent cleanup
|
|
@@ -186,12 +185,12 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
186
185
|
private readonly indexPath: string;
|
|
187
186
|
private readonly backupPath: string;
|
|
188
187
|
private readonly archivePath: string;
|
|
189
|
-
|
|
188
|
+
|
|
190
189
|
private entries = new Map<string, MemoryEntry>();
|
|
191
190
|
private index: MemoryIndex;
|
|
192
191
|
private cache = new Map<string, { entry: MemoryEntry; expiry: number }>();
|
|
193
192
|
private retentionPolicies = new Map<string, RetentionPolicy>();
|
|
194
|
-
|
|
193
|
+
|
|
195
194
|
private logger: ILogger;
|
|
196
195
|
private config: {
|
|
197
196
|
maxMemorySize: number;
|
|
@@ -210,9 +209,12 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
210
209
|
private operationMetrics = new Map<string, { count: number; totalTime: number }>();
|
|
211
210
|
private cleanupInterval?: NodeJS.Timeout;
|
|
212
211
|
|
|
213
|
-
constructor(
|
|
212
|
+
constructor(
|
|
213
|
+
config: Partial<typeof AdvancedMemoryManager.prototype.config> = {},
|
|
214
|
+
logger: ILogger,
|
|
215
|
+
) {
|
|
214
216
|
super();
|
|
215
|
-
|
|
217
|
+
|
|
216
218
|
this.logger = logger;
|
|
217
219
|
this.config = {
|
|
218
220
|
maxMemorySize: 1024 * 1024 * 1024, // 1GB
|
|
@@ -225,7 +227,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
225
227
|
persistenceEnabled: true,
|
|
226
228
|
compressionThreshold: 1024, // 1KB
|
|
227
229
|
backupRetention: 7, // days
|
|
228
|
-
...config
|
|
230
|
+
...config,
|
|
229
231
|
};
|
|
230
232
|
|
|
231
233
|
// Setup file paths
|
|
@@ -249,7 +251,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
249
251
|
fs.mkdir(this.dataPath, { recursive: true }),
|
|
250
252
|
fs.mkdir(this.indexPath, { recursive: true }),
|
|
251
253
|
fs.mkdir(this.backupPath, { recursive: true }),
|
|
252
|
-
fs.mkdir(this.archivePath, { recursive: true })
|
|
254
|
+
fs.mkdir(this.archivePath, { recursive: true }),
|
|
253
255
|
]);
|
|
254
256
|
|
|
255
257
|
// Load persisted data
|
|
@@ -299,18 +301,18 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
299
301
|
accessLevel?: 'private' | 'shared' | 'public';
|
|
300
302
|
ttl?: number;
|
|
301
303
|
compress?: boolean;
|
|
302
|
-
} = {}
|
|
304
|
+
} = {},
|
|
303
305
|
): Promise<string> {
|
|
304
306
|
const startTime = Date.now();
|
|
305
|
-
|
|
307
|
+
|
|
306
308
|
try {
|
|
307
309
|
const entryId = generateId('entry');
|
|
308
310
|
const now = new Date();
|
|
309
|
-
|
|
311
|
+
|
|
310
312
|
// Process value (compression, serialization)
|
|
311
313
|
const processedValue = await this.processValue(value, options.compress);
|
|
312
314
|
const size = this.calculateSize(processedValue);
|
|
313
|
-
|
|
315
|
+
|
|
314
316
|
// Create entry
|
|
315
317
|
const entry: MemoryEntry = {
|
|
316
318
|
id: entryId,
|
|
@@ -331,29 +333,28 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
331
333
|
compressed: processedValue.compressed,
|
|
332
334
|
checksum: this.calculateChecksum(processedValue.value),
|
|
333
335
|
references: [],
|
|
334
|
-
dependencies: []
|
|
336
|
+
dependencies: [],
|
|
335
337
|
};
|
|
336
338
|
|
|
337
339
|
// Store entry
|
|
338
340
|
this.entries.set(entryId, entry);
|
|
339
|
-
|
|
341
|
+
|
|
340
342
|
// Update index
|
|
341
343
|
if (this.config.indexingEnabled) {
|
|
342
344
|
this.updateIndex(entry, 'create');
|
|
343
345
|
}
|
|
344
|
-
|
|
346
|
+
|
|
345
347
|
// Update cache
|
|
346
348
|
this.updateCache(key, entry);
|
|
347
|
-
|
|
349
|
+
|
|
348
350
|
// Apply retention policies
|
|
349
351
|
await this.applyRetentionPolicies(entry);
|
|
350
352
|
|
|
351
353
|
this.logger.debug('Memory entry stored', { entryId, key, namespace: entry.namespace });
|
|
352
354
|
this.emit('memory:entry-stored', { entry });
|
|
353
|
-
|
|
355
|
+
|
|
354
356
|
this.recordMetric('store', Date.now() - startTime);
|
|
355
357
|
return entryId;
|
|
356
|
-
|
|
357
358
|
} catch (error) {
|
|
358
359
|
this.recordMetric('store-error', Date.now() - startTime);
|
|
359
360
|
throw error;
|
|
@@ -365,10 +366,10 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
365
366
|
options: {
|
|
366
367
|
namespace?: string;
|
|
367
368
|
updateLastAccessed?: boolean;
|
|
368
|
-
} = {}
|
|
369
|
+
} = {},
|
|
369
370
|
): Promise<MemoryEntry | null> {
|
|
370
371
|
const startTime = Date.now();
|
|
371
|
-
|
|
372
|
+
|
|
372
373
|
try {
|
|
373
374
|
// Check cache first
|
|
374
375
|
const cached = this.cache.get(key);
|
|
@@ -406,7 +407,6 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
406
407
|
|
|
407
408
|
this.recordMetric('retrieve', Date.now() - startTime);
|
|
408
409
|
return entry;
|
|
409
|
-
|
|
410
410
|
} catch (error) {
|
|
411
411
|
this.recordMetric('retrieve-error', Date.now() - startTime);
|
|
412
412
|
throw error;
|
|
@@ -420,10 +420,10 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
420
420
|
namespace?: string;
|
|
421
421
|
merge?: boolean;
|
|
422
422
|
updateMetadata?: Record<string, any>;
|
|
423
|
-
} = {}
|
|
423
|
+
} = {},
|
|
424
424
|
): Promise<boolean> {
|
|
425
425
|
const startTime = Date.now();
|
|
426
|
-
|
|
426
|
+
|
|
427
427
|
try {
|
|
428
428
|
const entry = await this.retrieve(key, { namespace: options.namespace });
|
|
429
429
|
if (!entry) {
|
|
@@ -433,20 +433,20 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
433
433
|
|
|
434
434
|
// Process new value
|
|
435
435
|
const processedValue = await this.processValue(value, entry.compressed);
|
|
436
|
-
|
|
436
|
+
|
|
437
437
|
// Update entry
|
|
438
438
|
if (options.merge && typeof entry.value === 'object' && typeof value === 'object') {
|
|
439
439
|
entry.value = { ...entry.value, ...processedValue.value };
|
|
440
440
|
} else {
|
|
441
441
|
entry.value = processedValue.value;
|
|
442
442
|
}
|
|
443
|
-
|
|
443
|
+
|
|
444
444
|
entry.updatedAt = new Date();
|
|
445
445
|
entry.lastAccessedAt = new Date();
|
|
446
446
|
entry.version++;
|
|
447
447
|
entry.size = this.calculateSize(entry.value);
|
|
448
448
|
entry.checksum = this.calculateChecksum(entry.value);
|
|
449
|
-
|
|
449
|
+
|
|
450
450
|
if (options.updateMetadata) {
|
|
451
451
|
entry.metadata = { ...entry.metadata, ...options.updateMetadata };
|
|
452
452
|
}
|
|
@@ -461,10 +461,9 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
461
461
|
|
|
462
462
|
this.logger.debug('Memory entry updated', { entryId: entry.id, key });
|
|
463
463
|
this.emit('memory:entry-updated', { entry });
|
|
464
|
-
|
|
464
|
+
|
|
465
465
|
this.recordMetric('update', Date.now() - startTime);
|
|
466
466
|
return true;
|
|
467
|
-
|
|
468
467
|
} catch (error) {
|
|
469
468
|
this.recordMetric('update-error', Date.now() - startTime);
|
|
470
469
|
throw error;
|
|
@@ -473,7 +472,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
473
472
|
|
|
474
473
|
async deleteEntry(entryId: string): Promise<boolean> {
|
|
475
474
|
const startTime = Date.now();
|
|
476
|
-
|
|
475
|
+
|
|
477
476
|
try {
|
|
478
477
|
const entry = this.entries.get(entryId);
|
|
479
478
|
if (!entry) {
|
|
@@ -483,21 +482,20 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
483
482
|
|
|
484
483
|
// Remove from storage
|
|
485
484
|
this.entries.delete(entryId);
|
|
486
|
-
|
|
485
|
+
|
|
487
486
|
// Update index
|
|
488
487
|
if (this.config.indexingEnabled) {
|
|
489
488
|
this.updateIndex(entry, 'delete');
|
|
490
489
|
}
|
|
491
|
-
|
|
490
|
+
|
|
492
491
|
// Remove from cache
|
|
493
492
|
this.cache.delete(entry.key);
|
|
494
493
|
|
|
495
494
|
this.logger.debug('Memory entry deleted', { entryId, key: entry.key });
|
|
496
495
|
this.emit('memory:entry-deleted', { entryId });
|
|
497
|
-
|
|
496
|
+
|
|
498
497
|
this.recordMetric('delete', Date.now() - startTime);
|
|
499
498
|
return true;
|
|
500
|
-
|
|
501
499
|
} catch (error) {
|
|
502
500
|
this.recordMetric('delete-error', Date.now() - startTime);
|
|
503
501
|
throw error;
|
|
@@ -512,7 +510,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
512
510
|
aggregations?: Record<string, any>;
|
|
513
511
|
}> {
|
|
514
512
|
const startTime = Date.now();
|
|
515
|
-
|
|
513
|
+
|
|
516
514
|
try {
|
|
517
515
|
let candidateEntries: MemoryEntry[] = [];
|
|
518
516
|
|
|
@@ -524,13 +522,13 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
524
522
|
}
|
|
525
523
|
|
|
526
524
|
// Apply filters
|
|
527
|
-
let filteredEntries = candidateEntries.filter(entry => {
|
|
525
|
+
let filteredEntries = candidateEntries.filter((entry) => {
|
|
528
526
|
return this.matchesQuery(entry, options);
|
|
529
527
|
});
|
|
530
528
|
|
|
531
529
|
// Remove expired entries
|
|
532
530
|
if (!options.includeExpired) {
|
|
533
|
-
filteredEntries = filteredEntries.filter(entry => {
|
|
531
|
+
filteredEntries = filteredEntries.filter((entry) => {
|
|
534
532
|
if (entry.expiresAt && entry.expiresAt < new Date()) {
|
|
535
533
|
// Schedule for deletion
|
|
536
534
|
setTimeout(() => this.deleteEntry(entry.id), 0);
|
|
@@ -548,7 +546,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
548
546
|
const aVal = this.getPropertyValue(a, options.sortBy!);
|
|
549
547
|
const bVal = this.getPropertyValue(b, options.sortBy!);
|
|
550
548
|
const multiplier = options.sortOrder === 'desc' ? -1 : 1;
|
|
551
|
-
|
|
549
|
+
|
|
552
550
|
if (aVal < bVal) return -1 * multiplier;
|
|
553
551
|
if (aVal > bVal) return 1 * multiplier;
|
|
554
552
|
return 0;
|
|
@@ -561,7 +559,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
561
559
|
const paginatedEntries = filteredEntries.slice(offset, offset + limit);
|
|
562
560
|
|
|
563
561
|
// Update last accessed times
|
|
564
|
-
paginatedEntries.forEach(entry => {
|
|
562
|
+
paginatedEntries.forEach((entry) => {
|
|
565
563
|
entry.lastAccessedAt = new Date();
|
|
566
564
|
});
|
|
567
565
|
|
|
@@ -572,13 +570,12 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
572
570
|
}
|
|
573
571
|
|
|
574
572
|
this.recordMetric('query', Date.now() - startTime);
|
|
575
|
-
|
|
573
|
+
|
|
576
574
|
return {
|
|
577
575
|
entries: paginatedEntries,
|
|
578
576
|
total,
|
|
579
|
-
aggregations
|
|
577
|
+
aggregations,
|
|
580
578
|
};
|
|
581
|
-
|
|
582
579
|
} catch (error) {
|
|
583
580
|
this.recordMetric('query-error', Date.now() - startTime);
|
|
584
581
|
throw error;
|
|
@@ -587,13 +584,16 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
587
584
|
|
|
588
585
|
// === EXPORT OPERATIONS ===
|
|
589
586
|
|
|
590
|
-
async export(
|
|
587
|
+
async export(
|
|
588
|
+
filePath: string,
|
|
589
|
+
options: ExportOptions,
|
|
590
|
+
): Promise<{
|
|
591
591
|
entriesExported: number;
|
|
592
592
|
fileSize: number;
|
|
593
593
|
checksum: string;
|
|
594
594
|
}> {
|
|
595
595
|
const startTime = Date.now();
|
|
596
|
-
|
|
596
|
+
|
|
597
597
|
try {
|
|
598
598
|
this.logger.info('Starting memory export', { filePath, format: options.format });
|
|
599
599
|
|
|
@@ -607,7 +607,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
607
607
|
|
|
608
608
|
// Prepare export data
|
|
609
609
|
let exportData: any;
|
|
610
|
-
|
|
610
|
+
|
|
611
611
|
switch (options.format) {
|
|
612
612
|
case 'json':
|
|
613
613
|
exportData = this.prepareJsonExport(entries, options);
|
|
@@ -643,16 +643,16 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
643
643
|
const stats = await fs.stat(filePath);
|
|
644
644
|
const checksum = this.calculateChecksum(exportData);
|
|
645
645
|
|
|
646
|
-
this.logger.info('Memory export completed', {
|
|
646
|
+
this.logger.info('Memory export completed', {
|
|
647
647
|
entriesExported: entries.length,
|
|
648
648
|
fileSize: stats.size,
|
|
649
|
-
checksum
|
|
649
|
+
checksum,
|
|
650
650
|
});
|
|
651
651
|
|
|
652
|
-
this.emit('memory:exported', {
|
|
653
|
-
filePath,
|
|
654
|
-
entriesExported: entries.length,
|
|
655
|
-
fileSize: stats.size
|
|
652
|
+
this.emit('memory:exported', {
|
|
653
|
+
filePath,
|
|
654
|
+
entriesExported: entries.length,
|
|
655
|
+
fileSize: stats.size,
|
|
656
656
|
});
|
|
657
657
|
|
|
658
658
|
this.recordMetric('export', Date.now() - startTime);
|
|
@@ -660,9 +660,8 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
660
660
|
return {
|
|
661
661
|
entriesExported: entries.length,
|
|
662
662
|
fileSize: stats.size,
|
|
663
|
-
checksum
|
|
663
|
+
checksum,
|
|
664
664
|
};
|
|
665
|
-
|
|
666
665
|
} catch (error) {
|
|
667
666
|
this.recordMetric('export-error', Date.now() - startTime);
|
|
668
667
|
throw error;
|
|
@@ -671,14 +670,17 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
671
670
|
|
|
672
671
|
// === IMPORT OPERATIONS ===
|
|
673
672
|
|
|
674
|
-
async import(
|
|
673
|
+
async import(
|
|
674
|
+
filePath: string,
|
|
675
|
+
options: ImportOptions,
|
|
676
|
+
): Promise<{
|
|
675
677
|
entriesImported: number;
|
|
676
678
|
entriesSkipped: number;
|
|
677
679
|
entriesUpdated: number;
|
|
678
680
|
conflicts: string[];
|
|
679
681
|
}> {
|
|
680
682
|
const startTime = Date.now();
|
|
681
|
-
|
|
683
|
+
|
|
682
684
|
try {
|
|
683
685
|
this.logger.info('Starting memory import', { filePath, format: options.format });
|
|
684
686
|
|
|
@@ -718,7 +720,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
718
720
|
entriesImported: 0,
|
|
719
721
|
entriesSkipped: 0,
|
|
720
722
|
entriesUpdated: 0,
|
|
721
|
-
conflicts: [] as string[]
|
|
723
|
+
conflicts: [] as string[],
|
|
722
724
|
};
|
|
723
725
|
|
|
724
726
|
for (const item of importData) {
|
|
@@ -726,14 +728,16 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
726
728
|
// Dry run - just check for conflicts
|
|
727
729
|
const existing = this.findEntryByKey(item.key, item.namespace);
|
|
728
730
|
if (existing) {
|
|
729
|
-
results.conflicts.push(
|
|
731
|
+
results.conflicts.push(
|
|
732
|
+
`Key '${item.key}' already exists in namespace '${item.namespace}'`,
|
|
733
|
+
);
|
|
730
734
|
}
|
|
731
735
|
continue;
|
|
732
736
|
}
|
|
733
737
|
|
|
734
738
|
try {
|
|
735
739
|
const result = await this.importSingleEntry(item, options);
|
|
736
|
-
|
|
740
|
+
|
|
737
741
|
switch (result.action) {
|
|
738
742
|
case 'imported':
|
|
739
743
|
results.entriesImported++;
|
|
@@ -749,16 +753,17 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
749
753
|
break;
|
|
750
754
|
}
|
|
751
755
|
} catch (error) {
|
|
752
|
-
results.conflicts.push(
|
|
756
|
+
results.conflicts.push(
|
|
757
|
+
`Error importing '${item.key}': ${error instanceof Error ? error.message : String(error)}`,
|
|
758
|
+
);
|
|
753
759
|
}
|
|
754
760
|
}
|
|
755
761
|
|
|
756
762
|
this.logger.info('Memory import completed', results);
|
|
757
763
|
this.emit('memory:imported', results);
|
|
758
|
-
|
|
764
|
+
|
|
759
765
|
this.recordMetric('import', Date.now() - startTime);
|
|
760
766
|
return results;
|
|
761
|
-
|
|
762
767
|
} catch (error) {
|
|
763
768
|
this.recordMetric('import-error', Date.now() - startTime);
|
|
764
769
|
throw error;
|
|
@@ -769,7 +774,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
769
774
|
|
|
770
775
|
async getStatistics(): Promise<MemoryStatistics> {
|
|
771
776
|
const startTime = Date.now();
|
|
772
|
-
|
|
777
|
+
|
|
773
778
|
try {
|
|
774
779
|
const stats = this.calculateStatistics();
|
|
775
780
|
this.recordMetric('stats', Date.now() - startTime);
|
|
@@ -790,7 +795,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
790
795
|
actions: string[];
|
|
791
796
|
}> {
|
|
792
797
|
const startTime = Date.now();
|
|
793
|
-
|
|
798
|
+
|
|
794
799
|
try {
|
|
795
800
|
this.logger.info('Starting memory cleanup', options);
|
|
796
801
|
|
|
@@ -799,7 +804,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
799
804
|
entriesArchived: 0,
|
|
800
805
|
entriesCompressed: 0,
|
|
801
806
|
spaceSaved: 0,
|
|
802
|
-
actions: [] as string[]
|
|
807
|
+
actions: [] as string[],
|
|
803
808
|
};
|
|
804
809
|
|
|
805
810
|
// Get all entries for processing
|
|
@@ -808,10 +813,10 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
808
813
|
|
|
809
814
|
// Phase 1: Remove expired entries
|
|
810
815
|
if (options.removeExpired !== false) {
|
|
811
|
-
const expiredEntries = allEntries.filter(
|
|
812
|
-
entry.expiresAt && entry.expiresAt < now
|
|
816
|
+
const expiredEntries = allEntries.filter(
|
|
817
|
+
(entry) => entry.expiresAt && entry.expiresAt < now,
|
|
813
818
|
);
|
|
814
|
-
|
|
819
|
+
|
|
815
820
|
for (const entry of expiredEntries) {
|
|
816
821
|
if (!options.dryRun) {
|
|
817
822
|
await this.deleteEntry(entry.id);
|
|
@@ -819,7 +824,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
819
824
|
results.entriesRemoved++;
|
|
820
825
|
results.spaceSaved += entry.size;
|
|
821
826
|
}
|
|
822
|
-
|
|
827
|
+
|
|
823
828
|
if (expiredEntries.length > 0) {
|
|
824
829
|
results.actions.push(`Removed ${expiredEntries.length} expired entries`);
|
|
825
830
|
}
|
|
@@ -827,9 +832,9 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
827
832
|
|
|
828
833
|
// Phase 2: Remove old entries
|
|
829
834
|
if (options.removeOlderThan) {
|
|
830
|
-
const cutoffDate = new Date(now.getTime() -
|
|
831
|
-
const oldEntries = allEntries.filter(entry => entry.createdAt < cutoffDate);
|
|
832
|
-
|
|
835
|
+
const cutoffDate = new Date(now.getTime() - options.removeOlderThan * 24 * 60 * 60 * 1000);
|
|
836
|
+
const oldEntries = allEntries.filter((entry) => entry.createdAt < cutoffDate);
|
|
837
|
+
|
|
833
838
|
for (const entry of oldEntries) {
|
|
834
839
|
if (!options.dryRun) {
|
|
835
840
|
await this.deleteEntry(entry.id);
|
|
@@ -837,17 +842,19 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
837
842
|
results.entriesRemoved++;
|
|
838
843
|
results.spaceSaved += entry.size;
|
|
839
844
|
}
|
|
840
|
-
|
|
845
|
+
|
|
841
846
|
if (oldEntries.length > 0) {
|
|
842
|
-
results.actions.push(
|
|
847
|
+
results.actions.push(
|
|
848
|
+
`Removed ${oldEntries.length} entries older than ${options.removeOlderThan} days`,
|
|
849
|
+
);
|
|
843
850
|
}
|
|
844
851
|
}
|
|
845
852
|
|
|
846
853
|
// Phase 3: Remove unaccessed entries
|
|
847
854
|
if (options.removeUnaccessed) {
|
|
848
|
-
const cutoffDate = new Date(now.getTime() -
|
|
849
|
-
const unaccessedEntries = allEntries.filter(entry => entry.lastAccessedAt < cutoffDate);
|
|
850
|
-
|
|
855
|
+
const cutoffDate = new Date(now.getTime() - options.removeUnaccessed * 24 * 60 * 60 * 1000);
|
|
856
|
+
const unaccessedEntries = allEntries.filter((entry) => entry.lastAccessedAt < cutoffDate);
|
|
857
|
+
|
|
851
858
|
for (const entry of unaccessedEntries) {
|
|
852
859
|
if (!options.dryRun) {
|
|
853
860
|
await this.deleteEntry(entry.id);
|
|
@@ -855,24 +862,27 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
855
862
|
results.entriesRemoved++;
|
|
856
863
|
results.spaceSaved += entry.size;
|
|
857
864
|
}
|
|
858
|
-
|
|
865
|
+
|
|
859
866
|
if (unaccessedEntries.length > 0) {
|
|
860
|
-
results.actions.push(
|
|
867
|
+
results.actions.push(
|
|
868
|
+
`Removed ${unaccessedEntries.length} entries not accessed in ${options.removeUnaccessed} days`,
|
|
869
|
+
);
|
|
861
870
|
}
|
|
862
871
|
}
|
|
863
872
|
|
|
864
873
|
// Phase 4: Archive old entries
|
|
865
874
|
if (options.archiveOld?.enabled) {
|
|
866
|
-
const cutoffDate = new Date(
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
875
|
+
const cutoffDate = new Date(
|
|
876
|
+
now.getTime() - options.archiveOld.olderThan * 24 * 60 * 60 * 1000,
|
|
877
|
+
);
|
|
878
|
+
const archiveEntries = allEntries.filter(
|
|
879
|
+
(entry) => entry.createdAt < cutoffDate && !entry.expiresAt, // Don't archive entries that will expire
|
|
870
880
|
);
|
|
871
|
-
|
|
881
|
+
|
|
872
882
|
if (archiveEntries.length > 0 && !options.dryRun) {
|
|
873
883
|
await this.archiveEntries(archiveEntries, options.archiveOld.archivePath);
|
|
874
884
|
}
|
|
875
|
-
|
|
885
|
+
|
|
876
886
|
results.entriesArchived = archiveEntries.length;
|
|
877
887
|
if (archiveEntries.length > 0) {
|
|
878
888
|
results.actions.push(`Archived ${archiveEntries.length} old entries`);
|
|
@@ -881,10 +891,10 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
881
891
|
|
|
882
892
|
// Phase 5: Compress eligible entries
|
|
883
893
|
if (options.compressEligible !== false && this.config.autoCompress) {
|
|
884
|
-
const uncompressedEntries = allEntries.filter(
|
|
885
|
-
!entry.compressed && entry.size > this.config.compressionThreshold
|
|
894
|
+
const uncompressedEntries = allEntries.filter(
|
|
895
|
+
(entry) => !entry.compressed && entry.size > this.config.compressionThreshold,
|
|
886
896
|
);
|
|
887
|
-
|
|
897
|
+
|
|
888
898
|
for (const entry of uncompressedEntries) {
|
|
889
899
|
if (!options.dryRun) {
|
|
890
900
|
const originalSize = entry.size;
|
|
@@ -896,7 +906,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
896
906
|
}
|
|
897
907
|
results.entriesCompressed++;
|
|
898
908
|
}
|
|
899
|
-
|
|
909
|
+
|
|
900
910
|
if (uncompressedEntries.length > 0) {
|
|
901
911
|
results.actions.push(`Compressed ${uncompressedEntries.length} entries`);
|
|
902
912
|
}
|
|
@@ -909,7 +919,9 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
909
919
|
results.entriesRemoved += policyResults.removed;
|
|
910
920
|
results.spaceSaved += policyResults.spaceSaved;
|
|
911
921
|
if (policyResults.removed > 0) {
|
|
912
|
-
results.actions.push(
|
|
922
|
+
results.actions.push(
|
|
923
|
+
`Retention policy '${policy.namespace}': removed ${policyResults.removed} entries`,
|
|
924
|
+
);
|
|
913
925
|
}
|
|
914
926
|
}
|
|
915
927
|
}
|
|
@@ -933,17 +945,16 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
933
945
|
}
|
|
934
946
|
|
|
935
947
|
// Rebuild index if significant changes
|
|
936
|
-
if (
|
|
948
|
+
if (results.entriesRemoved + results.entriesArchived > 100 && !options.dryRun) {
|
|
937
949
|
await this.rebuildIndex();
|
|
938
950
|
results.actions.push('Rebuilt search index');
|
|
939
951
|
}
|
|
940
952
|
|
|
941
953
|
this.logger.info('Memory cleanup completed', results);
|
|
942
954
|
this.emit('memory:cleanup-completed', results);
|
|
943
|
-
|
|
955
|
+
|
|
944
956
|
this.recordMetric('cleanup', Date.now() - startTime);
|
|
945
957
|
return results;
|
|
946
|
-
|
|
947
958
|
} catch (error) {
|
|
948
959
|
this.recordMetric('cleanup-error', Date.now() - startTime);
|
|
949
960
|
throw error;
|
|
@@ -959,16 +970,22 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
959
970
|
types: new Map(),
|
|
960
971
|
namespaces: new Map(),
|
|
961
972
|
owners: new Map(),
|
|
962
|
-
fullText: new Map()
|
|
973
|
+
fullText: new Map(),
|
|
963
974
|
};
|
|
964
975
|
}
|
|
965
976
|
|
|
966
|
-
private async processValue(
|
|
977
|
+
private async processValue(
|
|
978
|
+
value: any,
|
|
979
|
+
compress?: boolean,
|
|
980
|
+
): Promise<{ value: any; compressed: boolean }> {
|
|
967
981
|
let processedValue = value;
|
|
968
982
|
let isCompressed = false;
|
|
969
983
|
|
|
970
984
|
// Auto-compress if enabled and value is large enough
|
|
971
|
-
if (
|
|
985
|
+
if (
|
|
986
|
+
(compress || this.config.autoCompress) &&
|
|
987
|
+
this.calculateSize(value) > this.config.compressionThreshold
|
|
988
|
+
) {
|
|
972
989
|
processedValue = await this.compressValue(value);
|
|
973
990
|
isCompressed = true;
|
|
974
991
|
}
|
|
@@ -1022,25 +1039,25 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1022
1039
|
if (operation === 'delete') {
|
|
1023
1040
|
// Remove from all indices
|
|
1024
1041
|
this.removeFromIndex(this.index.keys, key, id);
|
|
1025
|
-
tags.forEach(tag => this.removeFromIndex(this.index.tags, tag, id));
|
|
1042
|
+
tags.forEach((tag) => this.removeFromIndex(this.index.tags, tag, id));
|
|
1026
1043
|
this.removeFromIndex(this.index.types, type, id);
|
|
1027
1044
|
this.removeFromIndex(this.index.namespaces, namespace, id);
|
|
1028
1045
|
this.removeFromIndex(this.index.owners, owner, id);
|
|
1029
|
-
|
|
1046
|
+
|
|
1030
1047
|
// Remove from full-text index
|
|
1031
1048
|
const words = this.extractWords(value);
|
|
1032
|
-
words.forEach(word => this.removeFromIndex(this.index.fullText, word, id));
|
|
1049
|
+
words.forEach((word) => this.removeFromIndex(this.index.fullText, word, id));
|
|
1033
1050
|
} else {
|
|
1034
1051
|
// Add to indices
|
|
1035
1052
|
this.addToIndex(this.index.keys, key, id);
|
|
1036
|
-
tags.forEach(tag => this.addToIndex(this.index.tags, tag, id));
|
|
1053
|
+
tags.forEach((tag) => this.addToIndex(this.index.tags, tag, id));
|
|
1037
1054
|
this.addToIndex(this.index.types, type, id);
|
|
1038
1055
|
this.addToIndex(this.index.namespaces, namespace, id);
|
|
1039
1056
|
this.addToIndex(this.index.owners, owner, id);
|
|
1040
|
-
|
|
1057
|
+
|
|
1041
1058
|
// Add to full-text index
|
|
1042
1059
|
const words = this.extractWords(value);
|
|
1043
|
-
words.forEach(word => this.addToIndex(this.index.fullText, word, id));
|
|
1060
|
+
words.forEach((word) => this.addToIndex(this.index.fullText, word, id));
|
|
1044
1061
|
}
|
|
1045
1062
|
}
|
|
1046
1063
|
|
|
@@ -1069,27 +1086,28 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1069
1086
|
|
|
1070
1087
|
private extractWords(value: any): string[] {
|
|
1071
1088
|
const text = typeof value === 'string' ? value : JSON.stringify(value);
|
|
1072
|
-
return text
|
|
1089
|
+
return text
|
|
1090
|
+
.toLowerCase()
|
|
1073
1091
|
.replace(/[^\w\s]/g, ' ')
|
|
1074
1092
|
.split(/\s+/)
|
|
1075
|
-
.filter(word => word.length > 2);
|
|
1093
|
+
.filter((word) => word.length > 2);
|
|
1076
1094
|
}
|
|
1077
1095
|
|
|
1078
1096
|
private updateCache(key: string, entry: MemoryEntry): void {
|
|
1079
1097
|
if (this.cache.size >= this.config.cacheSize) {
|
|
1080
1098
|
this.evictCache();
|
|
1081
1099
|
}
|
|
1082
|
-
|
|
1100
|
+
|
|
1083
1101
|
this.cache.set(key, {
|
|
1084
1102
|
entry: { ...entry },
|
|
1085
|
-
expiry: Date.now() + this.config.cacheTtl
|
|
1103
|
+
expiry: Date.now() + this.config.cacheTtl,
|
|
1086
1104
|
});
|
|
1087
1105
|
}
|
|
1088
1106
|
|
|
1089
1107
|
private evictCache(): void {
|
|
1090
1108
|
const entries = Array.from(this.cache.entries());
|
|
1091
1109
|
entries.sort((a, b) => a[1].expiry - b[1].expiry);
|
|
1092
|
-
|
|
1110
|
+
|
|
1093
1111
|
const toRemove = entries.slice(0, Math.floor(this.config.cacheSize * 0.1));
|
|
1094
1112
|
toRemove.forEach(([key]) => this.cache.delete(key));
|
|
1095
1113
|
}
|
|
@@ -1110,41 +1128,41 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1110
1128
|
compressionRatio: 0,
|
|
1111
1129
|
indexSize: 0,
|
|
1112
1130
|
memoryUsage: 0,
|
|
1113
|
-
diskUsage: 0
|
|
1131
|
+
diskUsage: 0,
|
|
1114
1132
|
},
|
|
1115
1133
|
distribution: {
|
|
1116
1134
|
byNamespace: {},
|
|
1117
1135
|
byType: {},
|
|
1118
1136
|
byOwner: {},
|
|
1119
|
-
byAccessLevel: {}
|
|
1137
|
+
byAccessLevel: {},
|
|
1120
1138
|
},
|
|
1121
1139
|
temporal: {
|
|
1122
1140
|
entriesCreatedLast24h: 0,
|
|
1123
1141
|
entriesUpdatedLast24h: 0,
|
|
1124
|
-
entriesAccessedLast24h: 0
|
|
1142
|
+
entriesAccessedLast24h: 0,
|
|
1125
1143
|
},
|
|
1126
1144
|
performance: {
|
|
1127
1145
|
averageQueryTime: 0,
|
|
1128
1146
|
averageWriteTime: 0,
|
|
1129
1147
|
cacheHitRatio: 0,
|
|
1130
|
-
indexEfficiency: 0
|
|
1148
|
+
indexEfficiency: 0,
|
|
1131
1149
|
},
|
|
1132
1150
|
health: {
|
|
1133
1151
|
expiredEntries: 0,
|
|
1134
1152
|
orphanedReferences: 0,
|
|
1135
1153
|
duplicateKeys: 0,
|
|
1136
1154
|
corruptedEntries: 0,
|
|
1137
|
-
recommendedCleanup: false
|
|
1155
|
+
recommendedCleanup: false,
|
|
1138
1156
|
},
|
|
1139
1157
|
optimization: {
|
|
1140
1158
|
suggestions: [],
|
|
1141
1159
|
potentialSavings: {
|
|
1142
1160
|
compression: 0,
|
|
1143
1161
|
cleanup: 0,
|
|
1144
|
-
deduplication: 0
|
|
1162
|
+
deduplication: 0,
|
|
1145
1163
|
},
|
|
1146
|
-
indexOptimization: []
|
|
1147
|
-
}
|
|
1164
|
+
indexOptimization: [],
|
|
1165
|
+
},
|
|
1148
1166
|
};
|
|
1149
1167
|
}
|
|
1150
1168
|
|
|
@@ -1162,50 +1180,57 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1162
1180
|
if (options.type && entry.type !== options.type) return false;
|
|
1163
1181
|
if (options.owner && entry.owner !== options.owner) return false;
|
|
1164
1182
|
if (options.accessLevel && entry.accessLevel !== options.accessLevel) return false;
|
|
1165
|
-
|
|
1183
|
+
|
|
1166
1184
|
if (options.tags && options.tags.length > 0) {
|
|
1167
|
-
const hasAllTags = options.tags.every(tag => entry.tags.includes(tag));
|
|
1185
|
+
const hasAllTags = options.tags.every((tag) => entry.tags.includes(tag));
|
|
1168
1186
|
if (!hasAllTags) return false;
|
|
1169
1187
|
}
|
|
1170
|
-
|
|
1188
|
+
|
|
1171
1189
|
if (options.keyPattern) {
|
|
1172
1190
|
const regex = new RegExp(options.keyPattern, 'i');
|
|
1173
1191
|
if (!regex.test(entry.key)) return false;
|
|
1174
1192
|
}
|
|
1175
|
-
|
|
1193
|
+
|
|
1176
1194
|
if (options.valueSearch) {
|
|
1177
1195
|
const valueStr = JSON.stringify(entry.value).toLowerCase();
|
|
1178
1196
|
if (!valueStr.includes(options.valueSearch.toLowerCase())) return false;
|
|
1179
1197
|
}
|
|
1180
|
-
|
|
1198
|
+
|
|
1181
1199
|
// Date range checks
|
|
1182
1200
|
if (options.createdAfter && entry.createdAt < options.createdAfter) return false;
|
|
1183
1201
|
if (options.createdBefore && entry.createdAt > options.createdBefore) return false;
|
|
1184
1202
|
if (options.updatedAfter && entry.updatedAt < options.updatedAfter) return false;
|
|
1185
1203
|
if (options.updatedBefore && entry.updatedAt > options.updatedBefore) return false;
|
|
1186
|
-
|
|
1204
|
+
|
|
1187
1205
|
// Size checks
|
|
1188
1206
|
if (options.sizeGreaterThan && entry.size <= options.sizeGreaterThan) return false;
|
|
1189
1207
|
if (options.sizeLessThan && entry.size >= options.sizeLessThan) return false;
|
|
1190
|
-
|
|
1208
|
+
|
|
1191
1209
|
return true;
|
|
1192
1210
|
}
|
|
1193
1211
|
|
|
1194
1212
|
private getPropertyValue(entry: MemoryEntry, property: string): any {
|
|
1195
1213
|
switch (property) {
|
|
1196
|
-
case 'key':
|
|
1197
|
-
|
|
1198
|
-
case '
|
|
1199
|
-
|
|
1200
|
-
case '
|
|
1201
|
-
|
|
1202
|
-
|
|
1214
|
+
case 'key':
|
|
1215
|
+
return entry.key;
|
|
1216
|
+
case 'createdAt':
|
|
1217
|
+
return entry.createdAt.getTime();
|
|
1218
|
+
case 'updatedAt':
|
|
1219
|
+
return entry.updatedAt.getTime();
|
|
1220
|
+
case 'lastAccessedAt':
|
|
1221
|
+
return entry.lastAccessedAt.getTime();
|
|
1222
|
+
case 'size':
|
|
1223
|
+
return entry.size;
|
|
1224
|
+
case 'type':
|
|
1225
|
+
return entry.type;
|
|
1226
|
+
default:
|
|
1227
|
+
return entry.key;
|
|
1203
1228
|
}
|
|
1204
1229
|
}
|
|
1205
1230
|
|
|
1206
1231
|
private generateAggregations(entries: MemoryEntry[], aggregateBy: string): Record<string, any> {
|
|
1207
1232
|
const aggregations: Record<string, any> = {};
|
|
1208
|
-
|
|
1233
|
+
|
|
1209
1234
|
switch (aggregateBy) {
|
|
1210
1235
|
case 'namespace':
|
|
1211
1236
|
aggregations.namespaces = this.aggregateByProperty(entries, 'namespace');
|
|
@@ -1220,13 +1245,16 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1220
1245
|
aggregations.tags = this.aggregateByTags(entries);
|
|
1221
1246
|
break;
|
|
1222
1247
|
}
|
|
1223
|
-
|
|
1248
|
+
|
|
1224
1249
|
return aggregations;
|
|
1225
1250
|
}
|
|
1226
1251
|
|
|
1227
|
-
private aggregateByProperty(
|
|
1252
|
+
private aggregateByProperty(
|
|
1253
|
+
entries: MemoryEntry[],
|
|
1254
|
+
property: keyof MemoryEntry,
|
|
1255
|
+
): Record<string, { count: number; totalSize: number }> {
|
|
1228
1256
|
const result: Record<string, { count: number; totalSize: number }> = {};
|
|
1229
|
-
|
|
1257
|
+
|
|
1230
1258
|
for (const entry of entries) {
|
|
1231
1259
|
const value = String(entry[property]);
|
|
1232
1260
|
if (!result[value]) {
|
|
@@ -1235,13 +1263,15 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1235
1263
|
result[value].count++;
|
|
1236
1264
|
result[value].totalSize += entry.size;
|
|
1237
1265
|
}
|
|
1238
|
-
|
|
1266
|
+
|
|
1239
1267
|
return result;
|
|
1240
1268
|
}
|
|
1241
1269
|
|
|
1242
|
-
private aggregateByTags(
|
|
1270
|
+
private aggregateByTags(
|
|
1271
|
+
entries: MemoryEntry[],
|
|
1272
|
+
): Record<string, { count: number; totalSize: number }> {
|
|
1243
1273
|
const result: Record<string, { count: number; totalSize: number }> = {};
|
|
1244
|
-
|
|
1274
|
+
|
|
1245
1275
|
for (const entry of entries) {
|
|
1246
1276
|
for (const tag of entry.tags) {
|
|
1247
1277
|
if (!result[tag]) {
|
|
@@ -1251,7 +1281,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1251
1281
|
result[tag].totalSize += entry.size;
|
|
1252
1282
|
}
|
|
1253
1283
|
}
|
|
1254
|
-
|
|
1284
|
+
|
|
1255
1285
|
return result;
|
|
1256
1286
|
}
|
|
1257
1287
|
|
|
@@ -1263,40 +1293,40 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1263
1293
|
exportedAt: new Date().toISOString(),
|
|
1264
1294
|
version: '1.0',
|
|
1265
1295
|
totalEntries: entries.length,
|
|
1266
|
-
format: 'json'
|
|
1296
|
+
format: 'json',
|
|
1267
1297
|
},
|
|
1268
|
-
entries: options.includeMetadata
|
|
1269
|
-
? entries
|
|
1270
|
-
: entries.map(entry => ({
|
|
1298
|
+
entries: options.includeMetadata
|
|
1299
|
+
? entries
|
|
1300
|
+
: entries.map((entry) => ({
|
|
1271
1301
|
key: entry.key,
|
|
1272
1302
|
value: entry.value,
|
|
1273
1303
|
type: entry.type,
|
|
1274
1304
|
namespace: entry.namespace,
|
|
1275
|
-
tags: entry.tags
|
|
1276
|
-
}))
|
|
1305
|
+
tags: entry.tags,
|
|
1306
|
+
})),
|
|
1277
1307
|
};
|
|
1278
|
-
|
|
1308
|
+
|
|
1279
1309
|
return JSON.stringify(exportData, null, 2);
|
|
1280
1310
|
}
|
|
1281
1311
|
|
|
1282
1312
|
private prepareCsvExport(entries: MemoryEntry[], options: ExportOptions): string {
|
|
1283
1313
|
// CSV export implementation
|
|
1284
1314
|
const headers = ['key', 'value', 'type', 'namespace', 'tags'];
|
|
1285
|
-
const rows = entries.map(entry => [
|
|
1315
|
+
const rows = entries.map((entry) => [
|
|
1286
1316
|
entry.key,
|
|
1287
1317
|
JSON.stringify(entry.value),
|
|
1288
1318
|
entry.type,
|
|
1289
1319
|
entry.namespace,
|
|
1290
|
-
entry.tags.join(';')
|
|
1320
|
+
entry.tags.join(';'),
|
|
1291
1321
|
]);
|
|
1292
|
-
|
|
1293
|
-
return [headers, ...rows].map(row => row.join(',')).join('\n');
|
|
1322
|
+
|
|
1323
|
+
return [headers, ...rows].map((row) => row.join(',')).join('\n');
|
|
1294
1324
|
}
|
|
1295
1325
|
|
|
1296
1326
|
private prepareXmlExport(entries: MemoryEntry[], options: ExportOptions): string {
|
|
1297
1327
|
// XML export implementation
|
|
1298
1328
|
let xml = '<?xml version="1.0" encoding="UTF-8"?>\n<memory>\n';
|
|
1299
|
-
|
|
1329
|
+
|
|
1300
1330
|
for (const entry of entries) {
|
|
1301
1331
|
xml += ` <entry>\n`;
|
|
1302
1332
|
xml += ` <key>${this.escapeXml(entry.key)}</key>\n`;
|
|
@@ -1306,7 +1336,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1306
1336
|
xml += ` <tags>${this.escapeXml(entry.tags.join(','))}</tags>\n`;
|
|
1307
1337
|
xml += ` </entry>\n`;
|
|
1308
1338
|
}
|
|
1309
|
-
|
|
1339
|
+
|
|
1310
1340
|
xml += '</memory>';
|
|
1311
1341
|
return xml;
|
|
1312
1342
|
}
|
|
@@ -1314,15 +1344,15 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1314
1344
|
private prepareYamlExport(entries: MemoryEntry[], options: ExportOptions): string {
|
|
1315
1345
|
// YAML export implementation - simplified
|
|
1316
1346
|
let yaml = 'memory:\n';
|
|
1317
|
-
|
|
1347
|
+
|
|
1318
1348
|
for (const entry of entries) {
|
|
1319
1349
|
yaml += ` - key: "${entry.key}"\n`;
|
|
1320
1350
|
yaml += ` value: ${JSON.stringify(entry.value)}\n`;
|
|
1321
1351
|
yaml += ` type: "${entry.type}"\n`;
|
|
1322
1352
|
yaml += ` namespace: "${entry.namespace}"\n`;
|
|
1323
|
-
yaml += ` tags: [${entry.tags.map(t => `"${t}"`).join(', ')}]\n`;
|
|
1353
|
+
yaml += ` tags: [${entry.tags.map((t) => `"${t}"`).join(', ')}]\n`;
|
|
1324
1354
|
}
|
|
1325
|
-
|
|
1355
|
+
|
|
1326
1356
|
return yaml;
|
|
1327
1357
|
}
|
|
1328
1358
|
|
|
@@ -1345,18 +1375,18 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1345
1375
|
const lines = content.split('\n');
|
|
1346
1376
|
const headers = lines[0].split(',');
|
|
1347
1377
|
const entries = [];
|
|
1348
|
-
|
|
1378
|
+
|
|
1349
1379
|
for (let i = 1; i < lines.length; i++) {
|
|
1350
1380
|
const values = lines[i].split(',');
|
|
1351
1381
|
const entry: any = {};
|
|
1352
|
-
|
|
1382
|
+
|
|
1353
1383
|
for (let j = 0; j < headers.length; j++) {
|
|
1354
1384
|
entry[headers[j]] = values[j];
|
|
1355
1385
|
}
|
|
1356
|
-
|
|
1386
|
+
|
|
1357
1387
|
entries.push(entry);
|
|
1358
1388
|
}
|
|
1359
|
-
|
|
1389
|
+
|
|
1360
1390
|
return entries;
|
|
1361
1391
|
}
|
|
1362
1392
|
|
|
@@ -1371,15 +1401,18 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1371
1401
|
}
|
|
1372
1402
|
|
|
1373
1403
|
private validateImportData(data: any[]): any[] {
|
|
1374
|
-
return data.filter(item => {
|
|
1404
|
+
return data.filter((item) => {
|
|
1375
1405
|
return item.key && item.value !== undefined;
|
|
1376
1406
|
});
|
|
1377
1407
|
}
|
|
1378
1408
|
|
|
1379
|
-
private transformImportData(
|
|
1380
|
-
|
|
1409
|
+
private transformImportData(
|
|
1410
|
+
data: any[],
|
|
1411
|
+
transformation: NonNullable<ImportOptions['transformation']>,
|
|
1412
|
+
): any[] {
|
|
1413
|
+
return data.map((item) => {
|
|
1381
1414
|
const transformed = { ...item };
|
|
1382
|
-
|
|
1415
|
+
|
|
1383
1416
|
// Apply key mapping
|
|
1384
1417
|
if (transformation.keyMapping) {
|
|
1385
1418
|
for (const [oldKey, newKey] of Object.entries(transformation.keyMapping)) {
|
|
@@ -1389,27 +1422,30 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1389
1422
|
}
|
|
1390
1423
|
}
|
|
1391
1424
|
}
|
|
1392
|
-
|
|
1425
|
+
|
|
1393
1426
|
// Apply value transformation
|
|
1394
1427
|
if (transformation.valueTransformation) {
|
|
1395
1428
|
transformed.value = transformation.valueTransformation(transformed.value);
|
|
1396
1429
|
}
|
|
1397
|
-
|
|
1430
|
+
|
|
1398
1431
|
// Extract metadata
|
|
1399
1432
|
if (transformation.metadataExtraction) {
|
|
1400
1433
|
transformed.metadata = transformation.metadataExtraction(transformed);
|
|
1401
1434
|
}
|
|
1402
|
-
|
|
1435
|
+
|
|
1403
1436
|
return transformed;
|
|
1404
1437
|
});
|
|
1405
1438
|
}
|
|
1406
1439
|
|
|
1407
|
-
private async importSingleEntry(
|
|
1440
|
+
private async importSingleEntry(
|
|
1441
|
+
item: any,
|
|
1442
|
+
options: ImportOptions,
|
|
1443
|
+
): Promise<{
|
|
1408
1444
|
action: 'imported' | 'updated' | 'skipped' | 'conflict';
|
|
1409
1445
|
message?: string;
|
|
1410
1446
|
}> {
|
|
1411
1447
|
const existing = this.findEntryByKey(item.key, item.namespace || options.namespace);
|
|
1412
|
-
|
|
1448
|
+
|
|
1413
1449
|
if (existing) {
|
|
1414
1450
|
switch (options.conflictResolution) {
|
|
1415
1451
|
case 'skip':
|
|
@@ -1418,9 +1454,9 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1418
1454
|
await this.update(item.key, item.value, { namespace: item.namespace });
|
|
1419
1455
|
return { action: 'updated' };
|
|
1420
1456
|
case 'merge':
|
|
1421
|
-
await this.update(item.key, item.value, {
|
|
1422
|
-
namespace: item.namespace,
|
|
1423
|
-
merge: true
|
|
1457
|
+
await this.update(item.key, item.value, {
|
|
1458
|
+
namespace: item.namespace,
|
|
1459
|
+
merge: true,
|
|
1424
1460
|
});
|
|
1425
1461
|
return { action: 'updated' };
|
|
1426
1462
|
case 'rename':
|
|
@@ -1429,13 +1465,13 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1429
1465
|
namespace: item.namespace,
|
|
1430
1466
|
type: item.type,
|
|
1431
1467
|
tags: item.tags,
|
|
1432
|
-
metadata: item.metadata
|
|
1468
|
+
metadata: item.metadata,
|
|
1433
1469
|
});
|
|
1434
1470
|
return { action: 'imported' };
|
|
1435
1471
|
default:
|
|
1436
|
-
return {
|
|
1437
|
-
action: 'conflict',
|
|
1438
|
-
message: `Key '${item.key}' already exists
|
|
1472
|
+
return {
|
|
1473
|
+
action: 'conflict',
|
|
1474
|
+
message: `Key '${item.key}' already exists`,
|
|
1439
1475
|
};
|
|
1440
1476
|
}
|
|
1441
1477
|
} else {
|
|
@@ -1443,7 +1479,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1443
1479
|
namespace: item.namespace || options.namespace,
|
|
1444
1480
|
type: item.type,
|
|
1445
1481
|
tags: item.tags,
|
|
1446
|
-
metadata: item.metadata
|
|
1482
|
+
metadata: item.metadata,
|
|
1447
1483
|
});
|
|
1448
1484
|
return { action: 'imported' };
|
|
1449
1485
|
}
|
|
@@ -1454,54 +1490,63 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1454
1490
|
private calculateStatistics(): MemoryStatistics {
|
|
1455
1491
|
const entries = Array.from(this.entries.values());
|
|
1456
1492
|
const now = new Date();
|
|
1457
|
-
const last24h = new Date(now.getTime() -
|
|
1493
|
+
const last24h = new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
|
1458
1494
|
|
|
1459
1495
|
const stats: MemoryStatistics = {
|
|
1460
1496
|
overview: {
|
|
1461
1497
|
totalEntries: entries.length,
|
|
1462
1498
|
totalSize: entries.reduce((sum, entry) => sum + entry.size, 0),
|
|
1463
|
-
compressedEntries: entries.filter(entry => entry.compressed).length,
|
|
1499
|
+
compressedEntries: entries.filter((entry) => entry.compressed).length,
|
|
1464
1500
|
compressionRatio: 0,
|
|
1465
1501
|
indexSize: this.calculateIndexSize(),
|
|
1466
1502
|
memoryUsage: process.memoryUsage().heapUsed,
|
|
1467
|
-
diskUsage: 0 // Would be calculated from actual file system
|
|
1503
|
+
diskUsage: 0, // Would be calculated from actual file system
|
|
1468
1504
|
},
|
|
1469
1505
|
distribution: {
|
|
1470
1506
|
byNamespace: this.calculateDistribution(entries, 'namespace'),
|
|
1471
1507
|
byType: this.calculateDistribution(entries, 'type'),
|
|
1472
1508
|
byOwner: this.calculateDistribution(entries, 'owner'),
|
|
1473
|
-
byAccessLevel: this.calculateDistribution(entries, 'accessLevel')
|
|
1509
|
+
byAccessLevel: this.calculateDistribution(entries, 'accessLevel'),
|
|
1474
1510
|
},
|
|
1475
1511
|
temporal: {
|
|
1476
|
-
entriesCreatedLast24h: entries.filter(e => e.createdAt >= last24h).length,
|
|
1477
|
-
entriesUpdatedLast24h: entries.filter(e => e.updatedAt >= last24h).length,
|
|
1478
|
-
entriesAccessedLast24h: entries.filter(e => e.lastAccessedAt >= last24h).length,
|
|
1479
|
-
oldestEntry:
|
|
1480
|
-
entries.
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1512
|
+
entriesCreatedLast24h: entries.filter((e) => e.createdAt >= last24h).length,
|
|
1513
|
+
entriesUpdatedLast24h: entries.filter((e) => e.updatedAt >= last24h).length,
|
|
1514
|
+
entriesAccessedLast24h: entries.filter((e) => e.lastAccessedAt >= last24h).length,
|
|
1515
|
+
oldestEntry:
|
|
1516
|
+
entries.length > 0
|
|
1517
|
+
? entries.reduce((oldest, entry) =>
|
|
1518
|
+
entry.createdAt < oldest.createdAt ? entry : oldest,
|
|
1519
|
+
).createdAt
|
|
1520
|
+
: undefined,
|
|
1521
|
+
newestEntry:
|
|
1522
|
+
entries.length > 0
|
|
1523
|
+
? entries.reduce((newest, entry) =>
|
|
1524
|
+
entry.createdAt > newest.createdAt ? entry : newest,
|
|
1525
|
+
).createdAt
|
|
1526
|
+
: undefined,
|
|
1487
1527
|
},
|
|
1488
1528
|
performance: this.calculatePerformanceMetrics(),
|
|
1489
1529
|
health: this.calculateHealthMetrics(entries, now),
|
|
1490
|
-
optimization: this.generateOptimizationSuggestions(entries)
|
|
1530
|
+
optimization: this.generateOptimizationSuggestions(entries),
|
|
1491
1531
|
};
|
|
1492
1532
|
|
|
1493
1533
|
// Calculate compression ratio
|
|
1494
|
-
const uncompressedSize = entries
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1534
|
+
const uncompressedSize = entries
|
|
1535
|
+
.filter((e) => !e.compressed)
|
|
1536
|
+
.reduce((sum, e) => sum + e.size, 0);
|
|
1537
|
+
const compressedSize = entries.filter((e) => e.compressed).reduce((sum, e) => sum + e.size, 0);
|
|
1538
|
+
stats.overview.compressionRatio =
|
|
1539
|
+
uncompressedSize > 0 ? (uncompressedSize - compressedSize) / uncompressedSize : 0;
|
|
1498
1540
|
|
|
1499
1541
|
return stats;
|
|
1500
1542
|
}
|
|
1501
1543
|
|
|
1502
|
-
private calculateDistribution(
|
|
1544
|
+
private calculateDistribution(
|
|
1545
|
+
entries: MemoryEntry[],
|
|
1546
|
+
property: keyof MemoryEntry,
|
|
1547
|
+
): Record<string, { count: number; size: number }> {
|
|
1503
1548
|
const distribution: Record<string, { count: number; size: number }> = {};
|
|
1504
|
-
|
|
1549
|
+
|
|
1505
1550
|
for (const entry of entries) {
|
|
1506
1551
|
const value = String(entry[property]);
|
|
1507
1552
|
if (!distribution[value]) {
|
|
@@ -1510,7 +1555,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1510
1555
|
distribution[value].count++;
|
|
1511
1556
|
distribution[value].size += entry.size;
|
|
1512
1557
|
}
|
|
1513
|
-
|
|
1558
|
+
|
|
1514
1559
|
return distribution;
|
|
1515
1560
|
}
|
|
1516
1561
|
|
|
@@ -1526,73 +1571,79 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1526
1571
|
const queryMetrics = this.operationMetrics.get('query') || { count: 0, totalTime: 0 };
|
|
1527
1572
|
const writeMetrics = this.operationMetrics.get('store') || { count: 0, totalTime: 0 };
|
|
1528
1573
|
const cacheMetrics = this.operationMetrics.get('retrieve-cache') || { count: 0, totalTime: 0 };
|
|
1529
|
-
const totalRetrieves =
|
|
1574
|
+
const totalRetrieves =
|
|
1575
|
+
(this.operationMetrics.get('retrieve') || { count: 0 }).count + cacheMetrics.count;
|
|
1530
1576
|
|
|
1531
1577
|
return {
|
|
1532
1578
|
averageQueryTime: queryMetrics.count > 0 ? queryMetrics.totalTime / queryMetrics.count : 0,
|
|
1533
1579
|
averageWriteTime: writeMetrics.count > 0 ? writeMetrics.totalTime / writeMetrics.count : 0,
|
|
1534
1580
|
cacheHitRatio: totalRetrieves > 0 ? cacheMetrics.count / totalRetrieves : 0,
|
|
1535
|
-
indexEfficiency: this.config.indexingEnabled ? 0.95 : 0 // Placeholder
|
|
1581
|
+
indexEfficiency: this.config.indexingEnabled ? 0.95 : 0, // Placeholder
|
|
1536
1582
|
};
|
|
1537
1583
|
}
|
|
1538
1584
|
|
|
1539
1585
|
private calculateHealthMetrics(entries: MemoryEntry[], now: Date): MemoryStatistics['health'] {
|
|
1540
|
-
const expiredEntries = entries.filter(e => e.expiresAt && e.expiresAt < now).length;
|
|
1586
|
+
const expiredEntries = entries.filter((e) => e.expiresAt && e.expiresAt < now).length;
|
|
1541
1587
|
const duplicateKeys = this.findDuplicateKeys(entries);
|
|
1542
|
-
|
|
1588
|
+
|
|
1543
1589
|
return {
|
|
1544
1590
|
expiredEntries,
|
|
1545
1591
|
orphanedReferences: 0, // Would be calculated by checking references
|
|
1546
1592
|
duplicateKeys: duplicateKeys.length,
|
|
1547
1593
|
corruptedEntries: 0, // Would be calculated by validating checksums
|
|
1548
|
-
recommendedCleanup: expiredEntries > 10 || duplicateKeys.length > 5
|
|
1594
|
+
recommendedCleanup: expiredEntries > 10 || duplicateKeys.length > 5,
|
|
1549
1595
|
};
|
|
1550
1596
|
}
|
|
1551
1597
|
|
|
1552
|
-
private generateOptimizationSuggestions(
|
|
1598
|
+
private generateOptimizationSuggestions(
|
|
1599
|
+
entries: MemoryEntry[],
|
|
1600
|
+
): MemoryStatistics['optimization'] {
|
|
1553
1601
|
const suggestions: string[] = [];
|
|
1554
1602
|
const potentialSavings = { compression: 0, cleanup: 0, deduplication: 0 };
|
|
1555
|
-
|
|
1603
|
+
|
|
1556
1604
|
// Compression suggestions
|
|
1557
|
-
const uncompressedLarge = entries.filter(
|
|
1558
|
-
!e.compressed && e.size > this.config.compressionThreshold
|
|
1605
|
+
const uncompressedLarge = entries.filter(
|
|
1606
|
+
(e) => !e.compressed && e.size > this.config.compressionThreshold,
|
|
1559
1607
|
);
|
|
1560
1608
|
if (uncompressedLarge.length > 0) {
|
|
1561
1609
|
suggestions.push(`${uncompressedLarge.length} entries could benefit from compression`);
|
|
1562
1610
|
potentialSavings.compression = uncompressedLarge.reduce((sum, e) => sum + e.size * 0.6, 0);
|
|
1563
1611
|
}
|
|
1564
|
-
|
|
1612
|
+
|
|
1565
1613
|
// Cleanup suggestions
|
|
1566
1614
|
const now = new Date();
|
|
1567
|
-
const oldEntries = entries.filter(
|
|
1568
|
-
now.getTime() - e.lastAccessedAt.getTime() >
|
|
1615
|
+
const oldEntries = entries.filter(
|
|
1616
|
+
(e) => now.getTime() - e.lastAccessedAt.getTime() > 30 * 24 * 60 * 60 * 1000,
|
|
1569
1617
|
);
|
|
1570
1618
|
if (oldEntries.length > 0) {
|
|
1571
1619
|
suggestions.push(`${oldEntries.length} entries haven't been accessed in 30+ days`);
|
|
1572
1620
|
potentialSavings.cleanup = oldEntries.reduce((sum, e) => sum + e.size, 0);
|
|
1573
1621
|
}
|
|
1574
|
-
|
|
1622
|
+
|
|
1575
1623
|
// Deduplication suggestions
|
|
1576
1624
|
const duplicates = this.findDuplicateKeys(entries);
|
|
1577
1625
|
if (duplicates.length > 0) {
|
|
1578
1626
|
suggestions.push(`${duplicates.length} duplicate keys found`);
|
|
1579
|
-
potentialSavings.deduplication = duplicates.reduce(
|
|
1580
|
-
sum + group.entries.slice(1).reduce((s, e) => s + e.size, 0),
|
|
1627
|
+
potentialSavings.deduplication = duplicates.reduce(
|
|
1628
|
+
(sum, group) => sum + group.entries.slice(1).reduce((s, e) => s + e.size, 0),
|
|
1629
|
+
0,
|
|
1581
1630
|
);
|
|
1582
1631
|
}
|
|
1583
|
-
|
|
1632
|
+
|
|
1584
1633
|
return {
|
|
1585
1634
|
suggestions,
|
|
1586
1635
|
potentialSavings,
|
|
1587
|
-
indexOptimization: this.config.indexingEnabled
|
|
1588
|
-
['Consider periodic index rebuilding for optimal performance']
|
|
1589
|
-
['Enable indexing for better query performance']
|
|
1636
|
+
indexOptimization: this.config.indexingEnabled
|
|
1637
|
+
? ['Consider periodic index rebuilding for optimal performance']
|
|
1638
|
+
: ['Enable indexing for better query performance'],
|
|
1590
1639
|
};
|
|
1591
1640
|
}
|
|
1592
1641
|
|
|
1593
|
-
private findDuplicateKeys(
|
|
1642
|
+
private findDuplicateKeys(
|
|
1643
|
+
entries: MemoryEntry[],
|
|
1644
|
+
): Array<{ key: string; namespace: string; entries: MemoryEntry[] }> {
|
|
1594
1645
|
const keyMap = new Map<string, MemoryEntry[]>();
|
|
1595
|
-
|
|
1646
|
+
|
|
1596
1647
|
for (const entry of entries) {
|
|
1597
1648
|
const compositeKey = `${entry.namespace}:${entry.key}`;
|
|
1598
1649
|
if (!keyMap.has(compositeKey)) {
|
|
@@ -1600,7 +1651,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1600
1651
|
}
|
|
1601
1652
|
keyMap.get(compositeKey)!.push(entry);
|
|
1602
1653
|
}
|
|
1603
|
-
|
|
1654
|
+
|
|
1604
1655
|
const duplicates: Array<{ key: string; namespace: string; entries: MemoryEntry[] }> = [];
|
|
1605
1656
|
for (const [compositeKey, entryList] of keyMap) {
|
|
1606
1657
|
if (entryList.length > 1) {
|
|
@@ -1608,7 +1659,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1608
1659
|
duplicates.push({ key, namespace, entries: entryList });
|
|
1609
1660
|
}
|
|
1610
1661
|
}
|
|
1611
|
-
|
|
1662
|
+
|
|
1612
1663
|
return duplicates;
|
|
1613
1664
|
}
|
|
1614
1665
|
|
|
@@ -1626,13 +1677,13 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1626
1677
|
private policyMatches(policy: RetentionPolicy, entry: MemoryEntry): boolean {
|
|
1627
1678
|
if (policy.namespace && entry.namespace !== policy.namespace) return false;
|
|
1628
1679
|
if (policy.type && entry.type !== policy.type) return false;
|
|
1629
|
-
if (policy.tags && !policy.tags.every(tag => entry.tags.includes(tag))) return false;
|
|
1680
|
+
if (policy.tags && !policy.tags.every((tag) => entry.tags.includes(tag))) return false;
|
|
1630
1681
|
return true;
|
|
1631
1682
|
}
|
|
1632
1683
|
|
|
1633
1684
|
private async enforceRetentionPolicy(policy: RetentionPolicy, entry: MemoryEntry): Promise<void> {
|
|
1634
1685
|
const now = new Date();
|
|
1635
|
-
|
|
1686
|
+
|
|
1636
1687
|
// Check age limit
|
|
1637
1688
|
if (policy.maxAge) {
|
|
1638
1689
|
const ageInDays = (now.getTime() - entry.createdAt.getTime()) / (24 * 60 * 60 * 1000);
|
|
@@ -1641,40 +1692,45 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1641
1692
|
return;
|
|
1642
1693
|
}
|
|
1643
1694
|
}
|
|
1644
|
-
|
|
1695
|
+
|
|
1645
1696
|
// Count and size limits would require more complex logic
|
|
1646
1697
|
// This is a simplified implementation
|
|
1647
1698
|
}
|
|
1648
1699
|
|
|
1649
|
-
private async applyRetentionPolicy(
|
|
1650
|
-
|
|
1700
|
+
private async applyRetentionPolicy(
|
|
1701
|
+
policy: CleanupOptions['retentionPolicies'][0],
|
|
1702
|
+
dryRun?: boolean,
|
|
1703
|
+
): Promise<{ removed: number; spaceSaved: number }> {
|
|
1704
|
+
const matchingEntries = Array.from(this.entries.values()).filter((entry) => {
|
|
1651
1705
|
if (policy.namespace && entry.namespace !== policy.namespace) return false;
|
|
1652
1706
|
return true;
|
|
1653
1707
|
});
|
|
1654
|
-
|
|
1708
|
+
|
|
1655
1709
|
let toRemove: MemoryEntry[] = [];
|
|
1656
1710
|
const now = new Date();
|
|
1657
|
-
|
|
1711
|
+
|
|
1658
1712
|
// Apply age limit
|
|
1659
1713
|
if (policy.maxAge) {
|
|
1660
|
-
const cutoffDate = new Date(now.getTime() -
|
|
1661
|
-
toRemove = matchingEntries.filter(entry => entry.createdAt < cutoffDate);
|
|
1714
|
+
const cutoffDate = new Date(now.getTime() - policy.maxAge * 24 * 60 * 60 * 1000);
|
|
1715
|
+
toRemove = matchingEntries.filter((entry) => entry.createdAt < cutoffDate);
|
|
1662
1716
|
}
|
|
1663
|
-
|
|
1717
|
+
|
|
1664
1718
|
// Apply count limit
|
|
1665
1719
|
if (policy.maxCount && matchingEntries.length > policy.maxCount) {
|
|
1666
1720
|
const sorted = matchingEntries.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
|
|
1667
1721
|
toRemove = sorted.slice(0, matchingEntries.length - policy.maxCount);
|
|
1668
1722
|
}
|
|
1669
|
-
|
|
1723
|
+
|
|
1670
1724
|
// Apply size limit
|
|
1671
1725
|
if (policy.sizeLimit) {
|
|
1672
1726
|
const totalSize = matchingEntries.reduce((sum, entry) => sum + entry.size, 0);
|
|
1673
1727
|
if (totalSize > policy.sizeLimit) {
|
|
1674
|
-
const sorted = matchingEntries.sort(
|
|
1728
|
+
const sorted = matchingEntries.sort(
|
|
1729
|
+
(a, b) => a.lastAccessedAt.getTime() - b.lastAccessedAt.getTime(),
|
|
1730
|
+
);
|
|
1675
1731
|
let currentSize = totalSize;
|
|
1676
1732
|
toRemove = [];
|
|
1677
|
-
|
|
1733
|
+
|
|
1678
1734
|
for (const entry of sorted) {
|
|
1679
1735
|
if (currentSize <= policy.sizeLimit) break;
|
|
1680
1736
|
toRemove.push(entry);
|
|
@@ -1682,15 +1738,15 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1682
1738
|
}
|
|
1683
1739
|
}
|
|
1684
1740
|
}
|
|
1685
|
-
|
|
1741
|
+
|
|
1686
1742
|
const spaceSaved = toRemove.reduce((sum, entry) => sum + entry.size, 0);
|
|
1687
|
-
|
|
1743
|
+
|
|
1688
1744
|
if (!dryRun) {
|
|
1689
1745
|
for (const entry of toRemove) {
|
|
1690
1746
|
await this.deleteEntry(entry.id);
|
|
1691
1747
|
}
|
|
1692
1748
|
}
|
|
1693
|
-
|
|
1749
|
+
|
|
1694
1750
|
return { removed: toRemove.length, spaceSaved };
|
|
1695
1751
|
}
|
|
1696
1752
|
|
|
@@ -1699,39 +1755,43 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1699
1755
|
return 0;
|
|
1700
1756
|
}
|
|
1701
1757
|
|
|
1702
|
-
private async removeDuplicateEntries(
|
|
1758
|
+
private async removeDuplicateEntries(
|
|
1759
|
+
dryRun?: boolean,
|
|
1760
|
+
): Promise<{ removed: number; spaceSaved: number }> {
|
|
1703
1761
|
const duplicates = this.findDuplicateKeys(Array.from(this.entries.values()));
|
|
1704
1762
|
let removed = 0;
|
|
1705
1763
|
let spaceSaved = 0;
|
|
1706
|
-
|
|
1764
|
+
|
|
1707
1765
|
for (const duplicate of duplicates) {
|
|
1708
1766
|
// Keep the newest entry, remove others
|
|
1709
|
-
const sorted = duplicate.entries.sort(
|
|
1767
|
+
const sorted = duplicate.entries.sort(
|
|
1768
|
+
(a, b) => b.updatedAt.getTime() - a.updatedAt.getTime(),
|
|
1769
|
+
);
|
|
1710
1770
|
const toRemove = sorted.slice(1);
|
|
1711
|
-
|
|
1771
|
+
|
|
1712
1772
|
for (const entry of toRemove) {
|
|
1713
1773
|
spaceSaved += entry.size;
|
|
1714
1774
|
removed++;
|
|
1715
|
-
|
|
1775
|
+
|
|
1716
1776
|
if (!dryRun) {
|
|
1717
1777
|
await this.deleteEntry(entry.id);
|
|
1718
1778
|
}
|
|
1719
1779
|
}
|
|
1720
1780
|
}
|
|
1721
|
-
|
|
1781
|
+
|
|
1722
1782
|
return { removed, spaceSaved };
|
|
1723
1783
|
}
|
|
1724
1784
|
|
|
1725
1785
|
private async archiveEntries(entries: MemoryEntry[], archivePath: string): Promise<void> {
|
|
1726
1786
|
const archiveData = {
|
|
1727
1787
|
archivedAt: new Date().toISOString(),
|
|
1728
|
-
entries: entries
|
|
1788
|
+
entries: entries,
|
|
1729
1789
|
};
|
|
1730
|
-
|
|
1790
|
+
|
|
1731
1791
|
const archiveFile = join(archivePath, `archive-${Date.now()}.json`);
|
|
1732
1792
|
await fs.mkdir(dirname(archiveFile), { recursive: true });
|
|
1733
1793
|
await fs.writeFile(archiveFile, JSON.stringify(archiveData, null, 2));
|
|
1734
|
-
|
|
1794
|
+
|
|
1735
1795
|
// Remove archived entries from active memory
|
|
1736
1796
|
for (const entry of entries) {
|
|
1737
1797
|
await this.deleteEntry(entry.id);
|
|
@@ -1740,13 +1800,13 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1740
1800
|
|
|
1741
1801
|
private async rebuildIndex(): Promise<void> {
|
|
1742
1802
|
this.logger.info('Rebuilding memory index');
|
|
1743
|
-
|
|
1803
|
+
|
|
1744
1804
|
this.index = this.createEmptyIndex();
|
|
1745
|
-
|
|
1805
|
+
|
|
1746
1806
|
for (const entry of this.entries.values()) {
|
|
1747
1807
|
this.updateIndex(entry, 'create');
|
|
1748
1808
|
}
|
|
1749
|
-
|
|
1809
|
+
|
|
1750
1810
|
this.logger.info('Memory index rebuilt successfully');
|
|
1751
1811
|
}
|
|
1752
1812
|
|
|
@@ -1756,7 +1816,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1756
1816
|
await this.cleanup({
|
|
1757
1817
|
removeExpired: true,
|
|
1758
1818
|
removeUnaccessed: 7, // Remove entries not accessed in 7 days
|
|
1759
|
-
compressEligible: true
|
|
1819
|
+
compressEligible: true,
|
|
1760
1820
|
});
|
|
1761
1821
|
} catch (error) {
|
|
1762
1822
|
this.logger.error('Auto cleanup failed', error);
|
|
@@ -1770,12 +1830,12 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1770
1830
|
try {
|
|
1771
1831
|
const dataFile = join(this.dataPath, 'entries.json');
|
|
1772
1832
|
const indexFile = join(this.indexPath, 'index.json');
|
|
1773
|
-
|
|
1833
|
+
|
|
1774
1834
|
// Load entries
|
|
1775
1835
|
try {
|
|
1776
1836
|
const entriesData = await fs.readFile(dataFile, 'utf-8');
|
|
1777
1837
|
const entriesArray = JSON.parse(entriesData);
|
|
1778
|
-
|
|
1838
|
+
|
|
1779
1839
|
for (const entryData of entriesArray) {
|
|
1780
1840
|
// Convert date strings back to Date objects
|
|
1781
1841
|
entryData.createdAt = new Date(entryData.createdAt);
|
|
@@ -1784,21 +1844,20 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1784
1844
|
if (entryData.expiresAt) {
|
|
1785
1845
|
entryData.expiresAt = new Date(entryData.expiresAt);
|
|
1786
1846
|
}
|
|
1787
|
-
|
|
1847
|
+
|
|
1788
1848
|
this.entries.set(entryData.id, entryData);
|
|
1789
1849
|
}
|
|
1790
|
-
|
|
1850
|
+
|
|
1791
1851
|
this.logger.info(`Loaded ${entriesArray.length} entries from persistence`);
|
|
1792
1852
|
} catch (error) {
|
|
1793
1853
|
// File doesn't exist or is corrupted
|
|
1794
1854
|
this.logger.info('No persisted entries found, starting fresh');
|
|
1795
1855
|
}
|
|
1796
|
-
|
|
1856
|
+
|
|
1797
1857
|
// Rebuild index
|
|
1798
1858
|
if (this.config.indexingEnabled) {
|
|
1799
1859
|
await this.rebuildIndex();
|
|
1800
1860
|
}
|
|
1801
|
-
|
|
1802
1861
|
} catch (error) {
|
|
1803
1862
|
this.logger.error('Failed to load persisted data', error);
|
|
1804
1863
|
}
|
|
@@ -1808,10 +1867,9 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1808
1867
|
try {
|
|
1809
1868
|
const dataFile = join(this.dataPath, 'entries.json');
|
|
1810
1869
|
const entriesArray = Array.from(this.entries.values());
|
|
1811
|
-
|
|
1870
|
+
|
|
1812
1871
|
await fs.writeFile(dataFile, JSON.stringify(entriesArray, null, 2));
|
|
1813
1872
|
this.logger.info(`Persisted ${entriesArray.length} entries`);
|
|
1814
|
-
|
|
1815
1873
|
} catch (error) {
|
|
1816
1874
|
this.logger.error('Failed to persist data', error);
|
|
1817
1875
|
}
|
|
@@ -1821,20 +1879,19 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1821
1879
|
try {
|
|
1822
1880
|
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
1823
1881
|
const backupFile = join(this.backupPath, `backup-${timestamp}.json`);
|
|
1824
|
-
|
|
1882
|
+
|
|
1825
1883
|
const backup = {
|
|
1826
1884
|
timestamp: new Date().toISOString(),
|
|
1827
1885
|
version: '1.0',
|
|
1828
1886
|
entries: Array.from(this.entries.values()),
|
|
1829
|
-
statistics: await this.getStatistics()
|
|
1887
|
+
statistics: await this.getStatistics(),
|
|
1830
1888
|
};
|
|
1831
|
-
|
|
1889
|
+
|
|
1832
1890
|
await fs.writeFile(backupFile, JSON.stringify(backup, null, 2));
|
|
1833
1891
|
this.logger.info(`Created backup: ${backupFile}`);
|
|
1834
|
-
|
|
1892
|
+
|
|
1835
1893
|
// Clean old backups
|
|
1836
1894
|
await this.cleanOldBackups();
|
|
1837
|
-
|
|
1838
1895
|
} catch (error) {
|
|
1839
1896
|
this.logger.error('Failed to create backup', error);
|
|
1840
1897
|
}
|
|
@@ -1843,29 +1900,28 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1843
1900
|
private async cleanOldBackups(): Promise<void> {
|
|
1844
1901
|
try {
|
|
1845
1902
|
const files = await fs.readdir(this.backupPath);
|
|
1846
|
-
const backupFiles = files.filter(f => f.startsWith('backup-') && f.endsWith('.json'));
|
|
1847
|
-
|
|
1903
|
+
const backupFiles = files.filter((f) => f.startsWith('backup-') && f.endsWith('.json'));
|
|
1904
|
+
|
|
1848
1905
|
if (backupFiles.length <= this.config.backupRetention) {
|
|
1849
1906
|
return;
|
|
1850
1907
|
}
|
|
1851
|
-
|
|
1908
|
+
|
|
1852
1909
|
// Sort by creation time and remove oldest
|
|
1853
1910
|
const fileStats = await Promise.all(
|
|
1854
|
-
backupFiles.map(async file => ({
|
|
1911
|
+
backupFiles.map(async (file) => ({
|
|
1855
1912
|
file,
|
|
1856
|
-
stat: await fs.stat(join(this.backupPath, file))
|
|
1857
|
-
}))
|
|
1913
|
+
stat: await fs.stat(join(this.backupPath, file)),
|
|
1914
|
+
})),
|
|
1858
1915
|
);
|
|
1859
|
-
|
|
1916
|
+
|
|
1860
1917
|
fileStats.sort((a, b) => a.stat.mtime.getTime() - b.stat.mtime.getTime());
|
|
1861
|
-
|
|
1918
|
+
|
|
1862
1919
|
const toDelete = fileStats.slice(0, fileStats.length - this.config.backupRetention);
|
|
1863
|
-
|
|
1920
|
+
|
|
1864
1921
|
for (const { file } of toDelete) {
|
|
1865
1922
|
await fs.unlink(join(this.backupPath, file));
|
|
1866
1923
|
this.logger.debug(`Deleted old backup: ${file}`);
|
|
1867
1924
|
}
|
|
1868
|
-
|
|
1869
1925
|
} catch (error) {
|
|
1870
1926
|
this.logger.error('Failed to clean old backups', error);
|
|
1871
1927
|
}
|
|
@@ -1878,7 +1934,10 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1878
1934
|
return data;
|
|
1879
1935
|
}
|
|
1880
1936
|
|
|
1881
|
-
private async encryptData(
|
|
1937
|
+
private async encryptData(
|
|
1938
|
+
data: string,
|
|
1939
|
+
encryption: NonNullable<ExportOptions['encryption']>,
|
|
1940
|
+
): Promise<string> {
|
|
1882
1941
|
// In a real implementation, you would use a proper encryption library
|
|
1883
1942
|
return data;
|
|
1884
1943
|
}
|
|
@@ -1904,7 +1963,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1904
1963
|
async listTags(): Promise<string[]> {
|
|
1905
1964
|
const tags = new Set<string>();
|
|
1906
1965
|
for (const entry of this.entries.values()) {
|
|
1907
|
-
entry.tags.forEach(tag => tags.add(tag));
|
|
1966
|
+
entry.tags.forEach((tag) => tags.add(tag));
|
|
1908
1967
|
}
|
|
1909
1968
|
return Array.from(tags).sort();
|
|
1910
1969
|
}
|
|
@@ -1924,14 +1983,12 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1924
1983
|
|
|
1925
1984
|
async clear(namespace?: string): Promise<number> {
|
|
1926
1985
|
const entries = Array.from(this.entries.values());
|
|
1927
|
-
const toDelete = namespace
|
|
1928
|
-
|
|
1929
|
-
: entries;
|
|
1930
|
-
|
|
1986
|
+
const toDelete = namespace ? entries.filter((entry) => entry.namespace === namespace) : entries;
|
|
1987
|
+
|
|
1931
1988
|
for (const entry of toDelete) {
|
|
1932
1989
|
await this.deleteEntry(entry.id);
|
|
1933
1990
|
}
|
|
1934
|
-
|
|
1991
|
+
|
|
1935
1992
|
return toDelete.length;
|
|
1936
1993
|
}
|
|
1937
1994
|
|
|
@@ -1941,7 +1998,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1941
1998
|
|
|
1942
1999
|
async updateConfiguration(updates: Partial<typeof this.config>): Promise<void> {
|
|
1943
2000
|
this.config = { ...this.config, ...updates };
|
|
1944
|
-
|
|
2001
|
+
|
|
1945
2002
|
// Apply configuration changes
|
|
1946
2003
|
if (updates.autoCleanup !== undefined) {
|
|
1947
2004
|
if (updates.autoCleanup && !this.cleanupInterval) {
|
|
@@ -1951,7 +2008,7 @@ export class AdvancedMemoryManager extends EventEmitter {
|
|
|
1951
2008
|
this.cleanupInterval = undefined;
|
|
1952
2009
|
}
|
|
1953
2010
|
}
|
|
1954
|
-
|
|
2011
|
+
|
|
1955
2012
|
this.emit('memory:configuration-updated', { config: this.config });
|
|
1956
2013
|
}
|
|
1957
|
-
}
|
|
2014
|
+
}
|