As he assembles a plan to overhaul the nation’s surveillance programs, President Obama is trying to navigate what advisers call a middle course that will satisfy protesting national security agencies while tamping down criticism by civil liberties advocates.