Oh yes, I'm sure overthrowing the government was exactly what that same government had in mind when they agreed it. Are you actually joking?
Pretty sure what they had in mind was the presence of Soviet troops, which is what they got.
I also note that purging and assassinating rivals is being used as justification for someone else purging and assassinating rivals.
One rival. Who did that to great excess.
Translated: it's okay when they do it.
You haven't referred to a single thing that would indicate that the Parcham faction in general or Karmal in particular were kleptocratic. You've just called them that because clearly they have to be as bad in every way as the US puppet regime.
....And then Canada purged the American politicians who had espoused non-alignment,
Karmal would be Nancy Pelosi in this scenario (truly the darkest timeline), not Canada. Also, it's weird that you keep mentioning "espousing non-alignment" as the reason for purges when Karmal's faction had been terrorized and murdered by the people they were purging.
and then occupied the US for 10 years, characterised by the military use of torture, rape, and civilian abduction and massacre
Not exactly an exceptional description of a military presence which, I'll remind, was requested by the Afghan government. Unlike the US military presence, which had soldiers randomly shooting people for no reason among other things.
I contend that the appropriate response to a repressive foreign government is not to overthrow it, purge the party of ideological opponents, and then occupy the country for 10 years.
Karmal is not the Soviet Union.
The Soviets continued the "death solves all problems; no man, no problem" style of leadership. This is exactly the behaviour you're defending. So don't act for a second as if they acted to put a stop to brutal, unstable governance.
When he came to power, Karmal promised an end to executions; when his government set up revolutionary troikas to do the opposite of that, the Soviets protested. And then what happened? They didn't kill him. Imagine that.
What would satisfy me is just the tiniest bit of consistency in the standards you apply to different world powers.
The fact that you can't seem to recognize clear differences in character between what the Soviets did in Afghanistan and what the USA did in Afghanistan suggests that you have no standards whatsoever beyond cynicism toward every target of western imperial ire. The Soviets were invited by the government of Afghanistan into a messy situation in which they ended up getting their hands very dirty. That situation was made a lot more challenging because of the meddling of the CIA. The USA, on the other hand, invaded a country that wanted nothing whatsoever to do with them. They then ignored a peace offer that would have delivered the supposed target of the war, Osama Bin-Laden, and occupied the country for twenty years profiting from the opium trade (itself a result of CIA meddling during the Soviet intervention in Afghanistan) and transferring fortunes to military contractors and weapons companies (their own ruling class). The Soviets suffered for their intervention in Afghanistan, were reluctant to go in the first place; the USA made any excuse to stay, lied to its people about the situation on the ground, and its ruling class suffered apparently so little that two decades later their media arms are still enthusiastically making the case for war. For feminism! Oh, and rare minerals!