Margaret Thatcher died with Northern Ireland on her heart, in regret at the Anglo Irish Agreement, her key advisor has said.