It looks like an electric trailer brake controller. The line on the left would have been connected to the brake line near the master cylinder and the wires would be connected to a source of power and then back to the plug near the trailer hitch.
Stepping on the brakes causes the lever to move and current to flow to the brakes on the trailer and apply them. You could also use just the lever to apply trailer brakes separately from the truck brakes.