What to do about a rotten top plate in the wall of old home addition?
It looks to me like the proper fix for this is going to end up being a lot more work that what you probably want to hear about. If I was the contractor recommending the repair scenario I would be saying to remove whole upper structure and replace it anew. 

Such a flat roof is always a recipe for a mess like this. It it was at all possible to rebuild the roof to add some rafters above to give some more slope it would be the right thing to do. 

Short of that, if you end up deciding that the rest of the roof structure is basically sound except in the area where these leaks have been then repair probably entails supporting the roof on temporary supports and then removing the window and the wall covering back to the corners. It may then be possible to fit in complete new plates and rafter / joists to completely replace the wet and rotted materials. Still a pretty sizable job. :^(