Have you looked into http://tombaran.info/autotalent.html - it's written in C, but is the only open source autotune I am aware of. On a modern computer & browser with javascript JIT, or webassembly, it should work.
This is a big project, and people pay big money for autotune or similar software such as melodyne because the development costs are high.
Here is 'Autotalent', a real time pitch corrector with source code (GPL):
http://tombaran.info/autotalent.html
It has a minimum latency of 43ms, which is quite a lot though. I would imagine getting the latency really low here is quite difficult.