it was definitely in place before you took the gun apart and it's amazingly common for people to lose them. use a magnet or a vacuum with cloth over the nozzle to suck around the area you took the gun apart. You'll probably find it.
There are two ways to install the detent and safety, first have sear cage out, right side safety off, and install the detent into its position, you should be able to see it visible through the hole in the frame from the right side, looks like a tab sticking out. Then place finger over detent to hold in place, and rotate safety up 90 degrees (look at the shape of the part of the safety you're inserting and look for the flat spot, line that up with the hole, insert, then rotate down to normal position. You can also do this with the sear cage holding the detent in place, but it's usually easier with fingers. The other way is, sear cage out, install safety and then fiddle around installing the detent into position. Use a little grease to keep them all together once installed if you're going to be messing around with the frame after, otherwise it will just all out again.