In the past few years I worked on pyTermTk, an Open Source TUI Python library, it helps developing interacting Terminal applications with modern aesthetics and controls (mouse/keyboard/drag&drop) that you can run out of the box on a terminal on through an ssh/serial session.
It is cross compatible with Linux, MacOS, MS Windows, HTML5
One feedback on html output: can you avoid the terminal in that and render directly using html/css/js?
Congrats..