> Manning did commit a crime.
Not actually. Manning was required by law to refuse and report illegal orders. And not just make a show of reporting it and then back to business as usual.
> didn't it also do things like give away the positions of some undercover agents?
No, but that'd be our fault anyways, for mixing legal and illegal.
> And harm US diplomatic relations with other countries?
The truth didn't harm relations, doing the things that the allies found out about in the first place was the problem.
> Look at it from the POV of the government: How could they not punish Manning?
Um, admitting fault and correcting it. But yeah, we know that'd never happen so what could they do but shoot the messenger?
> It would do a lot to encourage others to indiscriminately leak classified info.
Doubtful. The motivator in Manning's case wasn't the ease or difficulty of leaking, but the crimes that needed exposing.