Israel and Hamas have agreed to the initial phase of President Donald Trump's peace plan, which includes the release of hostages and a military withdrawal from Gaza.