mirror of
https://github.com/NCBM/plyngent.git
synced 2026-11-07 07:17:54 +08:00
557300ff4f
A prompt that blocks on the human now announces itself through one process-wide hook: `prompt_wait(kind, title, detail)` wraps `ask`, `ask_secret`, `choose` and `confirm` and yields the answer source the host offers. `kind` names the prompt family (`ask`, `secret`, `choose`, `confirm`, and the CLI's own `policy` / `access` / `skills` / `limit`) so a host can pick a surface, while `title` stays short enough to show anywhere and `detail` carries one line the caller has already redacted. No hook installed means no behaviour change, which keeps library hosts and the test suite exactly as they were. The read side of the seam is `read_line_with_timeout`: an optional `source` ends the read with the host's answer (echoed on the prompt line like a typed one) and a `None` timeout now means "wait until a line or an answer arrives" instead of giving up. Stdin keeps priority, so a human typing at the terminal is never raced by a notification answer that shows up at the same moment. `reset_prompting` clears the hook along with the output hook and the pause factory.