A major diplomatic breakthrough appears to be taking shape as the United States and Iran move closer to a formal agreement aimed at ending hostilities and stabilising the region.