Palantir posts record Q2 earnings as U.S. contracts fuel growth