The man accused of being the mastermind behind the 9/11 attacks and his two co-defendants have agreed to plead guilty, say US officials.