refactor: cpp native module rewrite (#2944)