San Francisco agency agrees to legalize mid-Maket units slated for eviction