// Agent card cover page — ported from AgentCardCover.tsx import { Page, View, Text, Image } from '@react-pdf/renderer'; import { styles, colors, logoPath } from '../styles.js'; import { getScoreHexColor } from '../scoring.js'; import type { LifecycleStage, V1Owner } from './types.js'; export interface AgentCardCoverProps { agentName: string; description?: string; channels: string[]; generatedDate: string; lifecycle?: LifecycleStage; owner?: V1Owner; evaluationSummary?: { criteriaRate: number | null; rubricRate: number | null; criteriaPassed: number; criteriaTotal: number; rubricRulesPassed: number; rubricRulesTotal: number; totalRuns: number; }; } const lifecycleColors: Record = { prototype: { bg: '#e5e7eb', text: '#4b5563' }, beta: { bg: '#fef3c7', text: '#92400e' }, published: { bg: '#d1fae5', text: '#065f46' }, }; export function AgentCardCover({ agentName, description, channels, generatedDate, lifecycle, owner, evaluationSummary, }: AgentCardCoverProps) { const lc = lifecycle ? lifecycleColors[lifecycle] || lifecycleColors.prototype : null; const ownerName = owner ? [owner.firstname, owner.lastname].filter(Boolean).join(' ') || owner.email || null : null; return ( {/* Logo */} {/* Badges row: V1 Agent + Lifecycle */} V1 Agent {lc && ( {lifecycle!.charAt(0).toUpperCase() + lifecycle!.slice(1)} )} {/* Title */} {agentName} {description && ( {description} )} {/* Owner */} {ownerName && ( Owner: {ownerName} )} {/* Channels */} {channels.length > 0 && ( {channels.map((channel) => ( {channel} ))} )} {/* Evaluation Summary — Dual Scores */} {evaluationSummary && evaluationSummary.totalRuns > 0 ? ( {/* Dual score row */} {/* Criteria score */} Criteria {evaluationSummary.criteriaRate !== null ? ( <> {Math.round(evaluationSummary.criteriaRate * 100)}% {evaluationSummary.criteriaPassed}/{evaluationSummary.criteriaTotal} checks ) : ( - )} {/* Divider */} {/* Rubric score */} Rubric {evaluationSummary.rubricRate !== null ? ( <> {Math.round(evaluationSummary.rubricRate * 100)}% {evaluationSummary.rubricRulesPassed}/{evaluationSummary.rubricRulesTotal} rules ) : ( - )} {/* Run count */} across {evaluationSummary.totalRuns} evaluation run{evaluationSummary.totalRuns !== 1 ? 's' : ''} ) : ( Not yet evaluated )} {/* Footer */} Generated {generatedDate} Page 1 ); }