'use client' import { useState } from 'react' import { useTranslation } from 'react-i18next' import Link from 'next/link' import { RefreshCw } from 'lucide-react' import { getSystemWorkspaceSnapshot, type SystemWorkspaceSnapshot as Snapshot, } from '@/lib/workspaces-api' export function SystemWorkspaceSnapshot() { const { t, i18n } = useTranslation() const [snapshot, setSnapshot] = useState(null) const [busy, setBusy] = useState(false) const [error, setError] = useState('') async function refresh() { setBusy(true) setError('') try { setSnapshot(await getSystemWorkspaceSnapshot()) } catch (err) { setError(err instanceof Error ? err.message : String(err)) } finally { setBusy(false) } } return (
{t('Skills')} {t('MCP')}
{error && (

{error}

)} {snapshot && (

{t('Snapshot updated {{time}}', { time: new Date(snapshot.generated_at).toLocaleString(i18n.language) })}

{Object.entries(snapshot.models).map(([service, settings]) => (

{service}

{settings.profiles.flatMap(profile => profile.models.map(model => (
{model.name || model.model} {model.id === settings.active_model_id && profile.id === settings.active_profile_id ? ` · ${t('Active')}` : ''} {profile.name || profile.binding}
)) )} {settings.profiles.every(profile => !profile.models.length) && ( {t('No models configured')} )}
))} {snapshot.mcp.length > 0 && (

{t('MCP')}

{snapshot.mcp.map((server, index) => (

{server.name} · {server.transport} ·{' '} {server.enabled ? t('Enabled') : t('Disabled')}

))}
)} {!Object.keys(snapshot.models).length && !snapshot.mcp.length && (

{t('No models or MCP servers configured yet.')}

)}
)}
) }