A Sinn Fein source said there has been progress "around parades, identity, institutional reform, criminality and the continued existence of armed and active paramilitary groups - it has been constructive".

However, the source warned that money and the legacy of the past were still sticking points for republicans.

Sinn Fein is particularly annoyed by provisions for dealing with the past which allows the Secretary of State to refuse to disclose information on the grounds of national security.

"It has become a catch-all term. She has tried to prevent documents being revealed, even though they had already appeared in inquests and other proceedings," a party source said.

A DUP source also appeared optimistic. "I think we have a deal there. My expectation is that there will be a few days' more talks this week. Theresa Villiers, the Secretary of State, has indicated she wanted an agreement with as many parties as possible."

Taoiseach Enda Kenny said he had hopes that the talks would be concluded by the weekend, "though obviously we will have to wait and see what the actual outcome will be."

Mr Kenny met the Prime Minister at 10 Downing Street yesterday, where Mr Cameron briefed him on his private meeting with Peter Robinson and Martin McGuinness on Friday morning.

The First and Deputy First Ministers had entered by a back door, but the news leaked out anyway.

Mr Kenny returned to Belfast last night to meet Mr Robinson and Mr McGuinness.

The parties have a formidable mess to untangle.

Last year they agreed to accept welfare reforms in return for more spending and borrowing powers.

But Sinn Fein pulled out when they heard that more cuts were proposed.

Some of these will be announced on November 25 and that could cause further friction.

IRA activity has also been a major theme.

After the murder of Kevin McGuigan in August, the PSNI said members of the IRA had been involved.

Later, the PSNI arrested Bobby Storey, Sinn Fein's Belfast chairman, and the DUP pulled its ministers out of government.

However, they later returned after Mr Storey was released and a report was produced on paramilitary activity.

Part of the deal will now include a cross-border clampdown on paramilitarism and organised crime, which will be monitored by a reporting body. This appears to have been accepted by Sinn Fein.

Before his meeting with the First and Deputy First Ministers last night, Mr Kenny said that "the issue of supporting cross-border activities is part and parcel of what we have done. That continues."

He added that he has committed funding in respect of the A5, a major road dualling project that was put on ice after the Irish government withdrew £400m in project funding in 2011. This is a major Sinn Fein demand, as the dual carriageway would link Londonderry to Monaghan through Sinn Fein constituencies in Northern Ireland.

In Assembly question time, Mr McGuinness said reaching an overall deal would send a strong message to the men of violence.

"I do think making politics work, I do think coming to agreements like the agreement we are trying to forge at the moment, can send a very powerful message to those in society who believe violence represents the best way forward - that's the road to no town," he said.