Thank you for your question. The peace treaty brought the battle to an end as Muawiya's tactics had caused confusion in the army of Imam al-Hasan (as) making the continuation of armed struggle unwise. The Imam was unable to continue fighting because of discord in his army and so agreed to the treaty.
The meaning of vicegerency is that he is charged with acting on God's behalf and has the merit to do that. This is due to his complete servitude and spiritual station. There is no dichotomy between the decision of God and the decision of the Imam.
May you always be successful