import React from 'react'; import { useApi } from '../hooks/useApi'; import { getMeshDelegations, type MeshDelegation } from '../api/delegations'; export default function DelegationLog() { const query = useApi(() => getMeshDelegations({ limit: 50 }), []); const delegations = query.data?.delegations ?? []; const statusColor = (status: string) => { if (status === 'success') return '#16a34a'; if (status === 'error') return '#dc2626'; return '#d97706'; }; return (

📋 Delegation Log

{query.loading &&

Loading...

} {query.error &&

Error: {query.error}

} {!query.loading && delegations.length === 0 && (

No delegations recorded yet. Delegations appear here when agents delegate tasks to each other via the mesh.

)} {delegations.map((d) => (
{d.source_agent} → {d.target_agent}
{d.status.toUpperCase()}

{d.task}

{d.error &&

Error: {d.error}

}
{d.latency_ms != null && Latency: {d.latency_ms}ms} {new Date(d.created_at).toLocaleString()}
))}
); } const cardStyle: React.CSSProperties = { padding: '16px', border: '1px solid #e2e8f0', borderRadius: '8px', marginBottom: '12px', }; const btnStyle: React.CSSProperties = { padding: '8px 16px', background: '#3b82f6', color: 'white', border: 'none', borderRadius: '6px', cursor: 'pointer', fontSize: '14px', };