Israeli and Hamas officials say they've agreed to exchange the bodies of dead hostages for hundreds of Palestinian prisoners, concluding the first phase of a fragile ceasefire.