Brooke Mueller is to undergo a drugs test every week until her 23-month-old twins Bob and Max turn 18.
The estranged wife of troubled Charlie Sheen is said to have been "shaken" by recent events in her family life and is determined to stay sober for the sake of their children, despite a recent lapse during a holiday to the Bahamas.
A family source said: "She'll do anything that needs to be done to keep her kids."
The pair were due to go into court today (08.03.11) to discuss custody of their sons but according to gossip website TMZ, the hearing has been cancelled as lawyers are now close to reaching a deal, the terms of which have not been disclosed.
Brooke was recently granted a restraining order against Charlie - who is living with his two girlfriends in a Los Angeles mansion he has dubbed Sober Valley Lodge - after he allegedly threatened to decapitate her and send her head in a box to her mother.
The 45-year-old star was officially fired from TV show 'Two and a Half Men' yesterday (07.03.11), and he reacted by saying it was "good news" as he would no longer have to look at the show's creator Chuck Lorre - who he has previously branded a "turd" - and can sue for "bazillions" of dollars in compensation.
He claimed: "This is very good news. They continue to be in breach, like so many whales.
"It is a big day of gladness at the Sober Valley Lodge because now I can take all of the bazillions, never have to look at whatshisc**k again and I never have to put on those silly shirts for as long as this warlock exists in the terrestrial dimension."
After being fired Charlie was seen waving a machete around at the Live Nation office in Beverley Hills proclaiming himself to be "free".
He shouted: "Free at last! Free at last!"