It's never quite been as easy/convenient as it should be, but services which offer a non-console but other machine-to-machine interface could suffice. Which if any of these listed examples offer HTTP or DBus interfaces for control? (Not a lot, alas, but perhaps some?) If you do want to build an application, these are good ways to make it externally controllable. I'm not aware of any dbus nor http tooling that makes interfacing with these protocols super slick & easy & friendly from the command line, but there's at least ways to do both, and we probably ought refine our script-foo in both realms.
Another thought is that the libraries/frameworks could help a lot. Ultimately frameworks like Bubbletea are ways to display stuff & script actions. Why don't we make those actions first class citizens and have the library natively expose actions in a command line format? I dont a lot of console apps do this, but a pattern I love is being able to feed a command sequence into a console program. This example is terrible, I need to think of something more purposeful, but for imagineering sake, perhaps:
my-tui-music-player --enqueue album:40-oz-to-freedom --enqueue album:steal-your-face --randomize --play 10 --wait 20s --volume 0.8 --clear-playlist --enqueue never-gonna-give-you-up --play --wait 20s --pause
Both have their place. Often you'll see TUI apps being built on top of their cli counterparts, in other cases both interfaces are built on top of a common library.
What you describe in your music player example is a cli interface and imho shouldn't be in the TUI binary.
I'm not sure why you need HTTP or dbus for control. Just use stdin and stdout. For example:
cat << EOF | my-cli-music-player
enqueue album:40-oz-to-freedom
enqueue album:steal-your-face
randomize
play 10
wait 20s
...
EOF
This works with other CLI programs. For example (make sure you have dc and espeak): cat << EOF | dc | espeak
100 k 22 7 / p
EOFTools like espeak and dc that you cite fall into the conventional cli-tools camp. By compare mamy of the TUI tools we see here have their own autocomplete systems embedded in the program, multiple screens, full terminal layouts, multiple on-screen focus-able areas.
Or is this expectation more for TUIs?
I was young & barely knew it, but KDE's DCOP seemed like a very adequate way to script & control any app- that was awesome. Today on FreeDesktop, some apps do a good job of exposing themselves via DBus; music/media players in particular have very widespread support for the mpris interface, for example, but all sorts of apps expose control this way. The programming language Vala[1] in Gnome world has excellent DBus integration built in, so one can take some of their application models & expose them to the world, very much easing making m2m interfaces.
[1] https://wiki.gnome.org/Projects/Vala/DBusServerSample#Type_T...
This feels like such a dangerous new cargo cult to me: ooh terminal good, hackers are here! Let's build applications for this! Ok, so... you may be in the console. But unless your program can be easily controlled & ran by other command line processes, unless it has machine-readable output, imo, you've simply imported the bad/ill/damaged/corrupt into a world that historically was usually much better.
Building little isolated insular worlds is what apps do. On the terminal, I expect systems to compose & interoperate well. I have yet to see a TUI toolkit/library that demonstrates any form of commitment to first-principles of the shell world. That was my comment 26 days ago, seeing Bubbletea[1], a leading Go based library. This all feels so icky, so wronghearted to me. It could be done responsibly- yes- but it's not. This feels so wildly to be missing the point of the terminal, the shell: to be a complex, interwoven system, where anything- not just some basic pre-determined rote functionality- is possible.
[1] https://news.ycombinator.com/item?id=30391605