Files
zCode-CLI-X/.zcode/agents/dashboard/index.cjs
admin 68cfeb5cba feat: add zCode Swarm — multi-agent orchestration system
- 6 agent skills: code-review, performance, security, architecture, test, git
- 4 coordinator modes: hierarchical, mesh, gossip, consensus
- Federated memory system (6 namespaces)
- Neural network agent recommendation
- Agent marketplace (plugin discovery/install)
- Real-time dashboard + performance metrics
- CRDT-based sync for decentralized modes
- 22 files, ~1400 lines total

Inspired by ruflo distributed multi-agent patterns.
2026-05-06 07:59:19 +00:00

69 lines
3.4 KiB
JavaScript

/**
* Real-Time Dashboard
* Terminal-based swarm monitoring dashboard
*/
class RealTimeDashboard {
constructor(swarm) {
this.swarm = swarm;
this.interval = null;
this.updateIntervalMs = 5000;
}
start() {
this.render();
this.interval = setInterval(() => this.render(), this.updateIntervalMs);
this.swarm.log('success', 'Dashboard started (5s refresh)');
}
stop() {
if (this.interval) {
clearInterval(this.interval);
this.interval = null;
}
}
render() {
const report = this.swarm.getPerformanceReport?.() || {};
const memStats = this.swarm.memory?.stats?.() || {};
console.clear();
console.log('╔══════════════════════════════════════════════╗');
console.log('║ 🐝 zCode Swarm Dashboard ║');
console.log('╠══════════════════════════════════════════════╣');
console.log(`║ Time: ${new Date().toISOString()} `);
console.log('╠══════════════════════════════════════════════╣');
console.log('║ 🤖 Agents ║');
console.log(`║ Total: ${String(report.agents?.total || 0).padEnd(30)}`);
console.log(`║ Active: ${String(report.agents?.active || 0).padEnd(30)}`);
console.log(`║ Idle: ${String(report.agents?.idle || 0).padEnd(30)}`);
console.log('╠══════════════════════════════════════════════╣');
console.log('║ 💾 Memory ║');
for (const [ns, count] of Object.entries(memStats)) {
console.log(`${ns.padEnd(15)} ${String(count).padEnd(14)} entries ║`);
}
console.log('╠══════════════════════════════════════════════╣');
console.log('║ 📊 System ║');
console.log(`║ Memory: ${String(report.memory?.usage || 'N/A').padEnd(30)}`);
console.log(`║ CPU: ${String(report.cpu?.usage || 'N/A').padEnd(30)}`);
console.log(`║ Mode: ${String(report.coordination?.mode || 'N/A').padEnd(30)}`);
console.log('╠══════════════════════════════════════════════╣');
console.log('║ 🧠 Intelligence ║');
console.log('║ Neural Net: Active ║');
console.log('║ CRDT Sync: Active ║');
console.log('║ Federated: Active ║');
console.log('╚══════════════════════════════════════════════╝');
}
exportReport() {
return {
timestamp: Date.now(),
agents: this.swarm.getPerformanceReport?.() || {},
memory: this.swarm.memory?.stats?.() || {},
mode: this.swarm.config?.coordination?.mode || 'hierarchical'
};
}
}
module.exports = RealTimeDashboard;