A couple years ago I wanted to tackle this problem for Oil, and there was some brainstorming here:
https://github.com/oilshell/oil/wiki/Shell-Autocompletion
https://github.com/oilshell/oil/wiki/Shellac-Protocol-Propos...
and on the oilshell Zulip in #shell-autocompletion.
The author of the Ion shell went pretty far with it, but it seems to be dormant now (or correct me if I'm wrong):
https://www.redox-os.org/news/rsoc-ion-ux-2/
https://www.redox-os.org/news/rsoc-ion-ux-3/
https://www.redox-os.org/news/rsoc-ion-ux-4-5/
To me a problem is that most shells like bash and even zsh are too impoverished to implement some kind of common protocol. For one, they don't work well with structured data.
I just looked at Fig, and it seems interesting as well. The approach of using Mac-specific APIs and doing it outside of the shell skirts that problem.
I did want to make Shellac correct and precise. Specifically it should have the invariant that if the tool suggests a completion, it should actually be a prefix to a valid command! And it was also supposed to separate the problem of completing the shell language from completing the argv language -- those are two different things. For example shells complete variables like $P -> $PATH, etc. And they complete their own builtins.