The United States trade deficit declined slightly in July as record exports of farm goods, autos and other products offset a big jump in foreign oil prices. The deficit with…