- 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.
58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
/**
|
|
* Agent Spawner
|
|
* Spawn and manage swarm agents
|
|
*/
|
|
|
|
class AgentSpawner {
|
|
constructor(swarm) {
|
|
this.swarm = swarm;
|
|
this.activeAgents = new Map();
|
|
}
|
|
|
|
initializeSwarm(agentTypes) {
|
|
console.log('\n🚀 Initializing swarm agents...');
|
|
console.log(` Agent types: ${agentTypes.join(', ')}`);
|
|
for (const agentType of agentTypes) {
|
|
this.spawnAgent(agentType);
|
|
}
|
|
console.log(`\n✅ Swarm initialized with ${agentTypes.length} agent types`);
|
|
}
|
|
|
|
spawnAgent(agentType) {
|
|
console.log(`\n📦 Spawning agent: ${agentType}`);
|
|
const agent = {
|
|
id: `${agentType}-${Date.now()}`,
|
|
type: agentType,
|
|
status: 'idle',
|
|
createdAt: Date.now()
|
|
};
|
|
this.activeAgents.set(agent.id, agent);
|
|
this.swarm.log('success', `Agent ${agentType} spawned (ID: ${agent.id})`);
|
|
return agent;
|
|
}
|
|
|
|
getAgent(agentId) { return this.activeAgents.get(agentId); }
|
|
|
|
getAgentsByType(agentType) {
|
|
return Array.from(this.activeAgents.values()).filter(a => a.type === agentType);
|
|
}
|
|
|
|
getActiveAgents() { return Array.from(this.activeAgents.values()); }
|
|
|
|
updateAgentStatus(agentId, status) {
|
|
const agent = this.activeAgents.get(agentId);
|
|
if (agent) {
|
|
agent.status = status;
|
|
this.swarm.log('info', `Agent ${agentId} status → ${status}`);
|
|
}
|
|
}
|
|
|
|
shutdown() {
|
|
console.log('\n🛑 Shutting down swarm agents...');
|
|
this.activeAgents.clear();
|
|
console.log('✅ All agents stopped');
|
|
}
|
|
}
|
|
|
|
module.exports = AgentSpawner;
|