Islamabad is trying to navigate anger on its western border, with Iran saying an attack that killed 27 Revolutionary Guards last week was planned from inside Pakistan.