I don't think "cockpit" had been formally defined, but I consider it stem, bars, brake levers, everything clamped onto the stem and grips/bar tape. Like everything in front of a pilot's seat. Yes, the aircraft and race car folk consider the cockpit to be the full enclosure between the firewall behind and the windshield, but hey, we're cyclists and what do they know?
I have a bike with two cockpits. All of that including the brake cables and housings. (It's a fix gear so no shift cables.) I can loosen a couple of nuts and swap cockpits in 5 minutes, turning it into an entirely different bike.
Cockpit is a relatively new term in bicycling. I had to travel to an airport or the race track in Limerock, Conn. to find a cockpit in my racing days. (Formula race cars. An uncle of mine used to race them.)