Negotiators at the Rio+20 sustainable development summit agree a deal to be ratified by world leaders later this week, the BBC understands.