function round(value) {
    return Math.round(value * 1000) / 1000;
}
export function summarizeTelemetry(toolExecutions, turns) {
    const toolCalls = toolExecutions.length;
    const successfulToolCalls = toolExecutions.filter((record) => record.success).length;
    const repairFailures = toolExecutions.filter((record) => !record.success && record.repairAttempt > 0).length;
    const toolSuccessRate = toolCalls > 0 ? successfulToolCalls / toolCalls : 0;
    const averageContextRatioBefore = turns.length > 0 ? turns.reduce((sum, turn) => sum + turn.contextRatioBefore, 0) / turns.length : 0;
    const averageContextRatioAfter = turns.length > 0 ? turns.reduce((sum, turn) => sum + turn.contextRatioAfter, 0) / turns.length : 0;
    return {
        toolCalls,
        toolSuccessRate: round(toolSuccessRate),
        repairFailures,
        averageContextRatioBefore: round(averageContextRatioBefore),
        averageContextRatioAfter: round(averageContextRatioAfter),
    };
}
//# sourceMappingURL=telemetry.js.map