mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-09 08:21:50 +00:00
fix(cli): skip lazy-dep prompt when prompt_toolkit owns terminal (#40490)
This commit is contained in:
parent
fe8920db18
commit
d47f919ef1
1 changed files with 17 additions and 1 deletions
|
|
@ -456,7 +456,23 @@ def ensure(feature: str, *, prompt: bool = True) -> None:
|
|||
"lazy installs disabled (security.allow_lazy_installs=false)"
|
||||
)
|
||||
|
||||
if prompt and sys.stdin.isatty() and sys.stdout.isatty():
|
||||
# Only show the interactive confirmation when we own a TTY and
|
||||
# prompt_toolkit isn't running. A bare input() deadlocks when a
|
||||
# prompt_toolkit app owns the terminal because keystrokes route to
|
||||
# its event loop rather than stdin, so the prompt blocks forever.
|
||||
# Under the TUI we skip the prompt and proceed — lazy installs are
|
||||
# gated by security.allow_lazy_installs, so reaching here is
|
||||
# already user opt-in.
|
||||
_pt_active = False
|
||||
if "prompt_toolkit.application.current" in sys.modules:
|
||||
try:
|
||||
from prompt_toolkit.application.current import get_app_or_none
|
||||
_app = get_app_or_none()
|
||||
_pt_active = _app is not None and getattr(_app, "is_running", False)
|
||||
except Exception:
|
||||
_pt_active = False
|
||||
|
||||
if prompt and not _pt_active and sys.stdin.isatty() and sys.stdout.isatty():
|
||||
spec_list = ", ".join(missing)
|
||||
try:
|
||||
answer = input(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue