"use client"; import { useState, useEffect } from "react"; import { Agent, AgentTeam, defaultTeams } from "@/lib/council/types"; import AgentModal from "./AgentModal"; const STORAGE_KEY = "horus:council"; export default function Council() { const [teams, setTeams] = useState(defaultTeams); const [selectedTeam, setSelectedTeam] = useState(null); const [selectedAgent, setSelectedAgent] = useState(null); const [runningTask, setRunningTask] = useState(""); const [agentOutputs, setAgentOutputs] = useState>({}); // Load from localStorage useEffect(() => { if (typeof window === "undefined") return; const saved = localStorage.getItem(STORAGE_KEY); if (saved) { try { setTeams(JSON.parse(saved)); } catch {} } }, []); // Save changes useEffect(() => { if (typeof window === "undefined") return; localStorage.setItem(STORAGE_KEY, JSON.stringify(teams)); }, [teams]); const getStatusColor = (status: Agent["status"]) => { switch (status) { case "working": return "text-yellow-400 bg-yellow-400/20"; case "completed": return "text-green-400 bg-green-400/20"; case "error": return "text-red-400 bg-red-400/20"; default: return "text-white/50 bg-white/10"; } }; const spawnAgent = async (agent: Agent, task: string) => { if (!task.trim()) return; // Update agent status setTeams(prev => prev.map(team => ({ ...team, agents: team.agents.map(a => a.id === agent.id ? { ...a, status: "working" as const, currentTask: task } : a) }))); setRunningTask(""); // Simulate agent work (in reality this would call actual agents) const output = `[šŸ¤– ${agent.name}] Starting task: "${task}"\n\n`; setAgentOutputs(prev => ({ ...prev, [agent.id]: output + "ā³ Processing...\n" })); // Simulate completion after delay setTimeout(() => { const result = output + `āœ… Task completed: ${task}\n\nšŸ’” Result: Task processed successfully.`; setAgentOutputs(prev => ({ ...prev, [agent.id]: result })); setTeams(prev => prev.map(team => ({ ...team, agents: team.agents.map(a => a.id === agent.id ? { ...a, status: "completed" as const, lastRun: new Date().toISOString(), currentTask: undefined } : a) }))); }, 3000 + Math.random() * 2000); }; const currentTeam = teams.find(t => t.id === selectedTeam); return (
{/* Header */}

šŸ›ļø Council

Manage AI agent teams for each project. I'm the boss — I delegate tasks and oversee execution.

{/* Team Grid */}
{teams.map((team) => ( ))}
{/* Selected Team Detail */} {currentTeam && (
{currentTeam.icon}

{currentTeam.name}

{currentTeam.description}

{/* Agents - Grid Layout */}
{currentTeam.agents.map((agent) => (
{agent.status.toUpperCase()} {agent.name}

{agent.role}

{/* Open Agent Command Center */}
))}
type="text" value={runningTask}
))}
)} {/* Horus Boss Note */}

šŸ‘ļø Note: I coordinate these agents. They run as sub-tasks within my sessions. In production, they'd be separate AI processes. Currently simulating — real agent spawning requires the OpenClaw sub-agent system to be configured.

{/* Agent Modal */} {selectedAgent && ( setSelectedAgent(null)} /> )} ); }