What do I need to do to safely reconnect an A/C-powered smoke detector?
I don't think you can.  I can't say for sure without seeing the part that the wires pulled out of, but I'd expect that originally those wires were soldered to a terminal block, then that terminal block was sealed inside the (probably sonically welded) plug.  Without opening the plug to re-solder those wires, you won't get a secure connection.

TL;DR: Don't mess with it; just replace it.  Smoke detectors are not that expensive and it's better to have a new one that you can rely on than one that's been broken and repaired.