'use client' /** * SlotCard — ein Slot im Agent-Test mit Sections: * 1. Header (Slot-Name, duration, Vault-Link) * 2. Was wurde geprüft (MC-Coverage, collapsible) * 3. Speedometer * 4. Eskalationslog (wenn vorhanden) * 5. Findings (sortiert HIGH → LOW) * 6. Recommendations (gerollupt) */ import React, { useState } from 'react' import type { SlotOutput, Severity } from './_agentTypes' import { AgentFindingCard } from './AgentFindingCard' import { AgentMcCoverage } from './AgentMcCoverage' import { AgentRecommendationCard } from './AgentRecommendationCard' import { AgentSpeedometer } from './AgentSpeedometer' const SEV_ORDER: Record = { HIGH: 0, MEDIUM: 1, LOW: 2, INFO: 3, } export function AgentSlotCard({ slot, output, runId, }: { slot: string output: SlotOutput runId: string }) { const [showAll, setShowAll] = useState(false) const wasSkipped = output.mc_total > 0 && output.mc_ok === 0 && output.mc_na === 0 && output.mc_high === 0 && output.mc_medium === 0 && output.mc_low === 0 const allGreen = !wasSkipped && output.findings.length === 0 const sortedFindings = [...output.findings].sort( (a, b) => SEV_ORDER[a.severity] - SEV_ORDER[b.severity], ) const visible = showAll ? sortedFindings : sortedFindings.slice(0, 12) return (

Slot: {slot}

{output.duration_ms} ms · Konfidenz {(output.confidence * 100).toFixed(0)}% {wasSkipped && ( Dokument konnte nicht geladen werden )} {allGreen && ( Alle anwendbaren MCs erfüllt )} Artefakte ↗
{output.notes && (
Hinweis: {output.notes}
)} {output.escalation_log.length > 0 && (
LLM-Eskalation eingesetzt:
{output.escalation_log.map((e, i) => (
{e.stage} {e.model}{' '} · {e.duration_ms} ms{' '} {e.tokens_in ? `· ${e.tokens_in}→${e.tokens_out} tok` : ''}{' '} {e.success ? '✓' : `✗ ${e.error || ''}`}
))}
)} {sortedFindings.length > 0 && (
Findings ({sortedFindings.length}) — nach Schwere sortiert
{visible.map(f => ( ))}
{sortedFindings.length > 12 && ( )}
)} {output.recommendations.length > 0 && (
Maßnahmen-Plan ({output.recommendations.length} konsolidiert)
{output.recommendations.map(r => ( ))}
)}
) }