The U.S. and China have agreed on a "framework" to resolve some disputes that threatened to derail fragile talks between the two countries.