diff --git a/plugins/memory/hindsight/__init__.py b/plugins/memory/hindsight/__init__.py index 40772f79d8a..1ca362e0089 100644 --- a/plugins/memory/hindsight/__init__.py +++ b/plugins/memory/hindsight/__init__.py @@ -629,13 +629,13 @@ class HindsightMemoryProvider(MemoryProvider): def post_setup(self, hermes_home: str, config: dict) -> None: """Custom setup wizard — installs only the deps needed for the selected mode.""" - import getpass import subprocess import shutil import sys from pathlib import Path from hermes_cli.config import save_config + from hermes_cli.secret_prompt import masked_secret_prompt from hermes_cli.memory_setup import _curses_select @@ -696,11 +696,11 @@ class HindsightMemoryProvider(MemoryProvider): masked = f"...{existing_key[-4:]}" if len(existing_key) > 4 else "set" sys.stdout.write(f" API key (current: {masked}, blank to keep): ") sys.stdout.flush() - api_key = getpass.getpass(prompt="") if sys.stdin.isatty() else sys.stdin.readline().strip() + api_key = masked_secret_prompt("") if sys.stdin.isatty() else sys.stdin.readline().strip() else: sys.stdout.write(" API key: ") sys.stdout.flush() - api_key = getpass.getpass(prompt="") if sys.stdin.isatty() else sys.stdin.readline().strip() + api_key = masked_secret_prompt("") if sys.stdin.isatty() else sys.stdin.readline().strip() if api_key: env_writes["HINDSIGHT_API_KEY"] = api_key @@ -714,7 +714,7 @@ class HindsightMemoryProvider(MemoryProvider): sys.stdout.write(" API key (optional, blank to skip): ") sys.stdout.flush() - api_key = getpass.getpass(prompt="") if sys.stdin.isatty() else sys.stdin.readline().strip() + api_key = masked_secret_prompt("") if sys.stdin.isatty() else sys.stdin.readline().strip() if api_key: env_writes["HINDSIGHT_API_KEY"] = api_key @@ -750,7 +750,7 @@ class HindsightMemoryProvider(MemoryProvider): sys.stdout.write(" LLM API key: ") sys.stdout.flush() - llm_key = getpass.getpass(prompt="") if sys.stdin.isatty() else sys.stdin.readline().strip() + llm_key = masked_secret_prompt("") if sys.stdin.isatty() else sys.stdin.readline().strip() if llm_key: env_writes["HINDSIGHT_LLM_API_KEY"] = llm_key else: diff --git a/plugins/memory/honcho/cli.py b/plugins/memory/honcho/cli.py index 28f213a1a66..a4432b0d4c7 100644 --- a/plugins/memory/honcho/cli.py +++ b/plugins/memory/honcho/cli.py @@ -314,8 +314,8 @@ def _prompt(label: str, default: str | None = None, secret: bool = False) -> str sys.stdout.flush() if secret: if sys.stdin.isatty(): - import getpass - val = getpass.getpass(prompt="") + from hermes_cli.secret_prompt import masked_secret_prompt + val = masked_secret_prompt("") else: # Non-TTY (piped input, test runners) — read plaintext val = sys.stdin.readline().strip() diff --git a/plugins/platforms/line/adapter.py b/plugins/platforms/line/adapter.py index 49931aa57ab..ee035ea2e1d 100644 --- a/plugins/platforms/line/adapter.py +++ b/plugins/platforms/line/adapter.py @@ -1585,8 +1585,8 @@ def interactive_setup() -> None: suffix = " [keep current]" if existing else "" try: if secret: - import getpass - value = getpass.getpass(f"{prompt}{suffix}: ") + from hermes_cli.secret_prompt import masked_secret_prompt + value = masked_secret_prompt(f"{prompt}{suffix}: ") else: value = input(f"{prompt}{suffix}: ").strip() except (EOFError, KeyboardInterrupt): diff --git a/plugins/platforms/simplex/adapter.py b/plugins/platforms/simplex/adapter.py index 264deb89608..9c3d22a429f 100644 --- a/plugins/platforms/simplex/adapter.py +++ b/plugins/platforms/simplex/adapter.py @@ -685,8 +685,8 @@ def interactive_setup() -> None: suffix = " [keep current]" if existing else "" try: if secret: - import getpass - value = getpass.getpass(f"{prompt}{suffix}: ") + from hermes_cli.secret_prompt import masked_secret_prompt + value = masked_secret_prompt(f"{prompt}{suffix}: ") else: value = input(f"{prompt}{suffix}: ").strip() except (EOFError, KeyboardInterrupt):