(params: {
client: CodebuffClient
logsDir: string
agents: string[]
analyzerContext: {
agentDefinitions: any[]
agentTypeDefinition: string
testedAgentIds: string[]
}
})
| 144 | } |
| 145 | |
| 146 | export async function analyzeAllTasks(params: { |
| 147 | client: CodebuffClient |
| 148 | logsDir: string |
| 149 | agents: string[] |
| 150 | analyzerContext: { |
| 151 | agentDefinitions: any[] |
| 152 | agentTypeDefinition: string |
| 153 | testedAgentIds: string[] |
| 154 | } |
| 155 | }): Promise<MetaAnalysisResult> { |
| 156 | const { client, logsDir, agents, analyzerContext } = params |
| 157 | |
| 158 | try { |
| 159 | // Read all ANALYSIS files from logs directory |
| 160 | const files = fs.readdirSync(logsDir) |
| 161 | const analysisFiles = files.filter((f) => f.includes('ANALYSIS')) |
| 162 | |
| 163 | const allTaskAnalyses: TaskAnalysisData[] = [] |
| 164 | for (const file of analysisFiles) { |
| 165 | const filePath = path.join(logsDir, file) |
| 166 | const content = fs.readFileSync(filePath, 'utf-8') |
| 167 | const data: TaskAnalysisData = JSON.parse(content) |
| 168 | allTaskAnalyses.push(data) |
| 169 | } |
| 170 | |
| 171 | if (allTaskAnalyses.length === 0) { |
| 172 | console.warn('No analysis files found in logs directory') |
| 173 | return { |
| 174 | overallComparison: 'No analysis data available', |
| 175 | agentInsights: [], |
| 176 | keyFindings: [], |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | // Create a concise summary for each task (without full agent traces) |
| 181 | const taskSummaries = allTaskAnalyses.map((task) => ({ |
| 182 | prompt: task.prompt, |
| 183 | traceAnalysis: { |
| 184 | overallAnalysis: task.overallAnalysis, |
| 185 | agentFeedback: task.agentFeedback, |
| 186 | }, |
| 187 | judgeResults: task.results.map((r) => ({ |
| 188 | agentId: r.agentId, |
| 189 | overallScore: r.overallScore, |
| 190 | completionScore: r.completionScore, |
| 191 | codeQualityScore: r.codeQualityScore, |
| 192 | cost: r.cost, |
| 193 | durationMs: r.durationMs, |
| 194 | strengths: r.strengths, |
| 195 | weaknesses: r.weaknesses, |
| 196 | error: r.error, |
| 197 | })), |
| 198 | })) |
| 199 | |
| 200 | // Filter agent definitions to only include tested agents |
| 201 | const filteredAgentDefinitions = analyzerContext.agentDefinitions.filter( |
| 202 | (def) => analyzerContext.testedAgentIds.includes(def.id), |
| 203 | ) |
no test coverage detected