The world's two bigest economies have agreed in principle a framework for de-escalating trade tensions.