I got a bit distracted trying to get my computer to be a little more thorough with dark mode. I was trying all sorts of web searches with the intent to change some of Firefox's color choices with a GTK theme, then I finally gave up and installed Stylish, to redo the coloration only of file:// URLs that look like directories. It's not fully baked yet, but it's a little less blinding.
Anyway, I'm just going to review where I was with the prototype code, and call it a night.
One of the key parts of mutable state in the prototype is a pair of mappings from Actions to trio.Events. These are always manipulated together, which implies to me that I should have a wrapper object around two trio.Events. I'll have to think this over more later, but it makes intuitive sense to me. It would mean that I'd potentially need to do some gnarly stuff with higher-order functions. (Basically, it looks to me like I'd need this new wrapper object to expose a method for handling the high-level dispatch, because part of the prototype logic is based around early returns. That means that the "core logic", which may or may not run from a given invocation, would need to be passed in as a nullary async function. (There are other possibilities, but I'm leaning towards nullary.)) Anyway, that's a brand-new idea to me, and I'm going to need to be better-rested to fully evaluate it, so I'd better get to bed.