StateAct: State Tracking and Reasoning for Acting and Planning with Large Language Models