import type { AgentProfile } from '../types' export function behaviorScore(agent: AgentProfile): number { const successRate = Math.min(5, (agent.successfulRequests / Math.max(1, agent.totalRequests)) * 5) const now = Date.now() const last60s = agent.requestTimestamps.filter(t => now - t < 60_000).length const pacing = last60s > 15 ? 0 : last60s > 5 ? 2 : 5 const cleanDays = Math.min(5, agent.consecutiveCleanDays * 0.5) const concentration = agent.counterparties.length >= 5 ? 5 : agent.counterparties.length >= 2 ? 2 : 0 return Math.min(20, successRate + pacing + cleanDays + concentration) }