Per-keystroke hook logic, centralising what each shell template used to
re-implement in bash/zsh/pwsh/clink/nu. The goal is that shells provide a
thin “buffer + cursor in, eval-able string out” adapter and all the real
expansion logic — command-position detection, token extraction, cursor
placeholder handling, shell escaping — lives here in Rust.