UiPath spent much of the year as one of software’s biggest disappointments. Now the Romanian-founded automation firm is clawing back. Its first profit and an all-in bet on AI agents are the reason.