| 155 | } |
| 156 | |
| 157 | export function formatTraceAnalysis(params: { |
| 158 | commit: EvalCommitV2 |
| 159 | overallAnalysis: string |
| 160 | agentFeedback: Array<{ |
| 161 | agentId: string |
| 162 | strengths: string[] |
| 163 | weaknesses: string[] |
| 164 | recommendations: string[] |
| 165 | }> |
| 166 | }): string { |
| 167 | const { overallAnalysis, agentFeedback } = params |
| 168 | |
| 169 | const lines: string[] = [] |
| 170 | const separator = '='.repeat(80) |
| 171 | const minorSeparator = '-'.repeat(80) |
| 172 | |
| 173 | lines.push('') |
| 174 | lines.push(separator) |
| 175 | lines.push(`TRACE ANALYSIS`) |
| 176 | lines.push(separator) |
| 177 | lines.push('') |
| 178 | |
| 179 | lines.push('OVERALL ANALYSIS:') |
| 180 | lines.push(minorSeparator) |
| 181 | lines.push(overallAnalysis) |
| 182 | lines.push('') |
| 183 | |
| 184 | if (agentFeedback.length > 0) { |
| 185 | lines.push('AGENT-SPECIFIC FEEDBACK:') |
| 186 | lines.push(minorSeparator) |
| 187 | |
| 188 | agentFeedback.forEach((feedback, index) => { |
| 189 | if (index > 0) lines.push('') |
| 190 | |
| 191 | lines.push(`[${feedback.agentId}]`) |
| 192 | |
| 193 | if (feedback.strengths.length > 0) { |
| 194 | lines.push(' Strengths:') |
| 195 | feedback.strengths.forEach((s) => lines.push(` • ${s}`)) |
| 196 | } |
| 197 | |
| 198 | if (feedback.weaknesses.length > 0) { |
| 199 | lines.push(' Weaknesses:') |
| 200 | feedback.weaknesses.forEach((w) => lines.push(` • ${w}`)) |
| 201 | } |
| 202 | |
| 203 | if (feedback.recommendations.length > 0) { |
| 204 | lines.push(' Recommendations:') |
| 205 | feedback.recommendations.forEach((r) => lines.push(` • ${r}`)) |
| 206 | } |
| 207 | }) |
| 208 | |
| 209 | lines.push('') |
| 210 | } |
| 211 | |
| 212 | lines.push(separator) |
| 213 | lines.push('') |
| 214 | |