The interactive VS background script concept is nice - although it raise the further problem of do you allow at least one of each to be running at the same time (could cause memory issues with Lua).
An alternative is to default to something like the current behavior (script gets all key presses except abort and/or alt mode) and allow scripts to specify which keys "pass through".
You can still only run one script at a time, but a script that sets all or almost all to "pass through" to the canon firmware. Or even just "forward" them by generating the corresponding press and release calls, but that would probably be fairly fragile. We could make the second option somewhat better by exposing the key state in a more sophisticated way to lua, the current functions are built around the limitations of ubasic.
You could do the reverse where the default was pass-through, but that seems like a needless change from the current behavior, and probably more confusing to newbies trying to write their first script.
As an aside, being able to run more than one script at once would be nice for PTP where you want to be able to say, read a value when something else is going on. But it opens up several cans of worms...
I think there is also a use case for allowing access to the CHDK and Canon menus while an interactive script is running; but I'm struggling to see how this could be done cleanly.
Like a "macro" kind of thing where you do something with the script and it does something with the canon (or chdk) menus?
Related to this topic and the discussion in
http://chdk.setepontos.com/index.php?topic=10580.40 what if pressing the "alt" key while a script was running brought up a special menu? This is sort of what you suggested earlier, but the script would still run as it does now in alt mode (the ability to "pass through" could still be implemented). The menu could have things like
"Kill script"
"Pause script" (or maybe it's just implicitly paused?)
"alt mode"
"exit alt"
This would essentially solve the problem of wanting to re-map the shutter button, because you'd always have the alt key. It would also make accidentally leaving alt more obvious, since the menu would pop up.