Israel and Hamas reached a ceasefire deal on almost entirely the same terms as a proposal that fell apart in the summer.