You used to be able to lock them away in a medical facility for their own well being and that of society as a whole.
My solution is criminal justice with small mental health facilities.
Pass laws making things crimes that are not crimes. If a judge overrules impeach the judge. it takes time and patience to change the system,. If you do A 3 times or an A offense and two Bs, you’re in jail. 6 times prison. You need mental health facilities then we put you there. You don’t leave till you have a job or a place to stay in the community where people supervise you taking your meds.
Repeat offenders double down on the time. It may take ten years too have the beds and the laws in place. But if one city starts the people will move to a freer city and then their citizens will make the locals pass the same laws.
I live near SD downtown. We always consider the area paradise. Now it’;s just a crapper like every place else. We have homeless in oceanside and the cops are pretty good about knowing who’s here, but in the early morning some places are not so pretty.