How to determine whether my bm.select_history.active is a BMVert, BMFace or a BMEdge?
bm.select_history.active actually gives you the object of type of the selected element of the mesh. So actually, type(bm.select_history.active).__name__ will give you the strings 'BMEdge', 'BMVert', 'BMFace' etc. based on the type of selection. You can use this in the condition, which could be something like:

activElem = bm.select_history.active
if (activElem != None and type(activElem).__name__ == 'BMEdge'):
    #The logic to process the edge (activElem.index etc.)


There may be a better way to do this. So maybe, you can wait for a while for a better answer :)