Figma has a blog post about the algorithm they use for their collaborative editing features but no open source code as far as I can tell.
https://www.figma.com/blog/realtime-editing-of-ordered-seque...
https://www.figma.com/blog/realtime-editing-of-ordered-seque...