CAPIR: Collaborative Action Planning with Intention Recognition