import { useState } from 'react'; import { useParams, useNavigate } from 'react-router-dom'; import { useAgentDashboard } from './hooks/useAgentDashboard'; import { VisibilityCard } from './components/VisibilityCard'; import { AgentChatWidget } from './components/AgentChatWidget'; import { MicroDaoWizard } from './components/MicroDaoWizard'; export function AgentCabinet() { const { agentId } = useParams<{ agentId: string }>(); const navigate = useNavigate(); const { dashboard, loading, error, refetch } = useAgentDashboard(agentId!); const [isWizardOpen, setIsWizardOpen] = useState(false); if (loading) { return (
Loading Agent Cabinet...
); } if (error || !dashboard) { return (

Agent Not Found

); } const { profile, node, primary_city_room, system_prompts, public_profile, microdao_memberships } = dashboard; return (
{/* Header */}
{profile.avatar_url ? ( {profile.display_name} ) : ( profile.display_name.charAt(0).toUpperCase() )}

{profile.display_name}

{profile.status} {profile.is_public && ( Public Citizen )}
🤖 {profile.kind}
{node && (
🖥️ {node.name} ({node.status})
)} {profile.primary_microdao_name && (
🏢 {profile.primary_microdao_name}
)}
{/* Main Content Grid */}
{/* Left Column: Identity & System */}
{/* DAIS / System Prompts Block */}

🧠 System Prompts (DAIS)

{['core', 'safety', 'governance', 'tools'].map((kind) => { const prompt = system_prompts[kind as keyof typeof system_prompts]; return (
{kind} Prompt {prompt && ( v{prompt.version} • {new Date(prompt.created_at).toLocaleDateString()} )}
{prompt?.content || No prompt defined}
); })}
{/* Agent Chat Block */}

💬 Agent Chat

{primary_city_room ? ( ) : (
No Primary Chat Room

This agent is not assigned to a primary city room.

)}
{/* Right Column: Visibility & Roles */}
{/* Visibility Card */} {/* MicroDAO Memberships */}

🏢 MicroDAO Memberships

{microdao_memberships.length > 0 ? (
{microdao_memberships.map((m) => (
{m.logo_url ? ( {m.microdao_name} ) : (
{m.microdao_name?.charAt(0).toUpperCase()}
)}
{m.microdao_name || 'Unknown DAO'}
/{m.microdao_slug}
{m.role || 'member'}
{m.is_core &&
Core Member
}
))}
) : (
Not a member of any MicroDAO
)}
{/* Node Info */} {node && (

🖥️ Runtime Node

Node Name {node.name}
ID {node.node_id}
Environment {node.environment || 'N/A'}
{node.guardian_agent && (
Guardian Agent {node.guardian_agent.name}
)}
)}
setIsWizardOpen(false)} agentId={profile.agent_id} onSuccess={refetch} />
); }