How do autopilots maintain/adapt the wind crab angle while flying a certain course? With ailerons or rudder, or both?
Assuming you mean wind correction angle, that’s simple: they don’t.
When in NAV mode, the autopilot‘s sole task is keeping the needle centered, and it will turn the plane (using ailerons, plus yaw damper if equipped) as needed to make that happen. It neither knows nor cares what the resulting heading is, much less complicated stuff like wind correction angles.
When in HDG mode, its sole task is keeping the heading bug centered, as if it were a NAV needle. And it still doesn’t know or care about the actual heading selected, or what the winds are doing.
As a general rule, it would be ailerons. If I’m hand-flying and need to make a few degrees of course heading change to follow a course, I’m going to to do this coordinated, with aileron and rudder pressures that will often be imperceptible to an observer. Making heading changes in cruise, even small ones, with a rudder skid alone doesn’t work well, so it will always be a tiny bit of aileron and an even tinier bit of rudder.
Also, most GA autopilots are two-axis autopilots that have no rudder servo and know nothing of the rudder. Some autopilots provide a yaw-damper. That’s a servo that automatically adds whatever rudder pressures are required so that the rudder is coordinated properly with the ailerons. But again, a rudder skid is not a desired flight maneuver and not something an autopilot engineer would design into the system. The autopilot would do the same thing a pilot would do, input a tiny aileron deflection and a simultaneous even tinier rudder pressure to keep the ball centered.
This isn't intended to be a complete answer, but rather to support other existing answers simply by pointing out that there's no difference in the techniques that would be used to maintain an appropriate heading in the presence of a crosswind (when a crab angle is required to maintain the desired ground track), and in the absence of a crosswind (when no crab angle is required.) "Crabbing" is nothing more than selecting and maintaining a heading that is appropriately offset from the desired ground track, so that the actual ground track will match the desired ground track even in though there is a crosswind. "Crabbing" does not create a sideways flow in the relative wind over the aircraft, and so the control inputs required to maintain straight and level flight are no different when the aircraft is "crabbing" than when it is flying directly upwind or downwind, or when the aircraft is flying in still air.
It's not clear from the original question whether the asker may have some confusion around this point.
Thought experiment: an airplane is circling an untethered hot air balloon (at a safe distance), on a windy day, over a cloud deck, keeping a constant radius from the balloon, flying at a constant airspeed. The airplane's flight path through the airmass is simply a circle, while the airplane's ground track cannot be. Therefore at most points in the circle, the airplane's heading and ground track are different, which means the aircraft is crabbed. Does the pilot have any way to tell at which points in the circle the plane is most crabbed and at which points the crab angle is zero? Are different control inputs required at various points in the circle? The answers are "no" and "no".
From the standpoint of the pilot, or the automated navigation system, the main consequence of a crosswind is that it creates a need to select a heading that is different than the desired ground track, and then evaluate whether or not the chosen heading is actually the correct one, and make further corrections as needed. In the GPS era, that's a trivial task, and likewise for a VFR pilot simply following a road or railroad at low altitude. On the other hand, when flying blind or above a cloud deck or far above the ground, without using modern aids such as GPS, the problem is far from trivial. At any rate, such issues are completely different from the issue of what control surfaces are used to hold the desired course.