Ambassadors are of two types: career FSOs given the rank of ambassador
and political/presidential appointees. Both are regarded, however, as
direct representatives of the president and, therefore, would
presumably report to the president, with a dotted line relationship to
the State Dept. Is this true in practice?
If US ambassadors are indeed the senior US reps in the countries to
which they are posted, do they have unilateral authority over American
military commanders also posted there, and, if not, why not?
No. The President is Commander in Chief, in a military sense, but Ambassadors are not commanders in any military sense.
Technically, even the Secretary of Defense and the various service secretaries are not in a direct chain of command.
The unified and combat command commanders report to the President when it comes to direct, non-autonomous military action or operations.