Skip to content

The agent that grows with you

fix(cli): give every wizard free-text prompt arrow-key and Ctrl+A/E editing

Tekniumd0132b58214d
diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py
index a8e2cf12864..427dd8614a1 100644
--- a/hermes_cli/auth.py
+++ b/hermes_cli/auth.py
@@ -3383,8 +3383,10 @@ def _spotify_interactive_setup(redirect_uri_hint: str) -> str:
except Exception:
pass
+ from hermes_cli.cli_output import line_input
+
try:
- raw = input("Spotify Client ID: ").strip()
+ raw = line_input("Spotify Client ID: ").strip()
except (EOFError, KeyboardInterrupt):
print()
raise SystemExit("Spotify setup cancelled.")
diff --git a/hermes_cli/auth_commands.py b/hermes_cli/auth_commands.py
index a5b3e7210b8..a23c0f2a9cb 100644
--- a/hermes_cli/auth_commands.py
+++ b/hermes_cli/auth_commands.py
@@ -1,6 +1,7 @@
"""Credential-pool auth subcommands."""
from __future__ import annotations
+from hermes_cli.cli_output import line_input
import math
import sys
@@ -204,7 +205,7 @@ def auth_add_command(args) -> None:
label = (getattr(args, "label", None) or "").strip()
if not label:
if sys.stdin.isatty():
- label = input(f"Label (optional, default: {default_label}): ").strip() or default_label
+ label = line_input(f"Label (optional, default: {default_label}): ").strip() or default_label
else:
label = default_label
entry = PooledCredential(
@@ -663,7 +664,7 @@ def _pick_provider(prompt: str = "Provider") -> str:
else:
print(f"\nKnown providers: {', '.join(known)}")
try:
- raw = input(f"{prompt}: ").strip()
+ raw = line_input(f"{prompt}: ").strip()
except (EOFError, KeyboardInterrupt):
raise SystemExit()
return _normalize_provider(raw)
@@ -692,7 +693,7 @@ def _interactive_add() -> None:
label = None
try:
- typed_label = input("Label / account name (optional): ").strip()
+ typed_label = line_input("Label / account name (optional): ").strip()
except (EOFError, KeyboardInterrupt):
return
if typed_label:
@@ -718,7 +719,7 @@ def _interactive_remove() -> None:
print(f" #{i} {e.label:25s} {e.auth_type:10s} {e.source}{exhausted} [id:{e.id}]")
try:
- raw = input("Remove #, id, or label (blank to cancel): ").strip()
+ raw = line_input("Remove #, id, or label (blank to cancel): ").strip()
except (EOFError, KeyboardInterrupt):
return
if not raw:
diff --git a/hermes_cli/bundles.py b/hermes_cli/bundles.py
index 80f0794c9de..a9d84690492 100644
--- a/hermes_cli/bundles.py
+++ b/hermes_cli/bundles.py
@@ -13,6 +13,7 @@ Subcommands:
"""
from __future__ import annotations
+from hermes_cli.cli_output import line_input
import sys
from typing import List
@@ -100,7 +101,7 @@ def _cmd_create(args) -> None:
)
try:
while True:
- line = input("skill> ").strip()
+ line = line_input("skill> ").strip()
if not line:
break
skills.append(line)
diff --git a/hermes_cli/cli_output.py b/hermes_cli/cli_output.py
index 32fd89c2336..165de84b8f8 100644
--- a/hermes_cli/cli_output.py
+++ b/hermes_cli/cli_output.py
@@ -82,7 +82,7 @@ def prompt(
if password:
value = masked_secret_prompt(display)
else:
- value = input(display)
+ value = line_input(display)
value = value.strip()
return value if value else (default or "")
except (KeyboardInterrupt, EOFError):
diff --git a/hermes_cli/config.py b/hermes_cli/config.py
index c8c6e6e1053..591604bedcd 100644
--- a/hermes_cli/config.py
+++ b/hermes_cli/config.py
@@ -15,6 +15,7 @@ This module provides:
"""
import copy
+from hermes_cli.cli_output import line_input
import json
import logging
import os
@@ -2433,7 +2434,7 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A
if var.get("password"):
value = masked_secret_prompt(f" {var['prompt']}: ")
else:
- value = input(f" {var['prompt']}: ").strip()
+ value = line_input(f" {var['prompt']}: ").strip()
if value:
save_env_value(var["name"], value)
@@ -2486,7 +2487,7 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A
f" {info.get('prompt', name)} (Enter to skip): "
)
else:
- value = input(f" {info.get('prompt', name)} (Enter to skip): ").strip()
+ value = line_input(f" {info.get('prompt', name)} (Enter to skip): ").strip()
if value:
save_env_value(name, value)
results["env_added"].append(name)
@@ -2537,7 +2538,7 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A
for var in missing_skill_config:
default = var.get("default", "")
default_hint = f" (default: {default})" if default else ""
- value = input(f" {var['prompt']}{default_hint}: ").strip()
+ value = line_input(f" {var['prompt']}{default_hint}: ").strip()
if not value and default:
value = str(default)
if value:
diff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.py
index b1871b15aec..1181b55da9f 100644
--- a/hermes_cli/gateway.py
+++ b/hermes_cli/gateway.py
@@ -5,6 +5,7 @@ Handles: hermes gateway [run|start|stop|restart|status|install|uninstall|setup]
"""
import asyncio
+from hermes_cli.cli_output import line_input
import json
import logging
import os
@@ -6812,7 +6813,7 @@ def _setup_signal():
print_info(" Enter the URL where signal-cli HTTP daemon is running.")
default_url = existing_url or "http://127.0.0.1:8080"
try:
- url = input(f" HTTP URL [{default_url}]: ").strip() or default_url
+ url = line_input(f" HTTP URL [{default_url}]: ").strip() or default_url
except (EOFError, KeyboardInterrupt):
print("\n Setup cancelled.")
return
@@ -6844,7 +6845,7 @@ def _setup_signal():
print_info(" Example: +15551234567")
default_account = existing_account or ""
try:
- account = input(
+ account = line_input(
f" Account number{f' [{default_account}]' if default_account else ''}: "
).strip()
if not account:
@@ -6867,7 +6868,7 @@ def _setup_signal():
default_allowed = existing_allowed or account
try:
allowed = (
- input(f" Allowed users [{default_allowed}]: ").strip() or default_allowed
+ line_input(f" Allowed users [{default_allowed}]: ").strip() or default_allowed
)
except (EOFError, KeyboardInterrupt):
print("\n Setup cancelled.")
@@ -6885,7 +6886,7 @@ def _setup_signal():
existing_groups = get_env_value("SIGNAL_GROUP_ALLOWED_USERS") or ""
try:
groups = (
- input(f" Group IDs [{existing_groups or '*'}]: ").strip()
+ line_input(f" Group IDs [{existing_groups or '*'}]: ").strip()
or existing_groups
or "*"
)
diff --git a/hermes_cli/main.py b/hermes_cli/main.py
index b061c4e3525..a1fa5c1fa2b 100644
--- a/hermes_cli/main.py
+++ b/hermes_cli/main.py
@@ -67,6 +67,7 @@ except ModuleNotFoundError:
# visible console when this process is windowless (pythonw gateway + every
# kanban worker). No-op on POSIX; never raises.
from hermes_cli._subprocess_compat import suppress_platform_ver_console
+from hermes_cli.cli_output import line_input
suppress_platform_ver_console()
@@ -3338,11 +3339,11 @@ def cmd_whatsapp(args):
response = "n"
if response.lower() in {"y", "yes"}:
if wa_mode == "bot":
- phone = input(
+ phone = line_input(
" Phone numbers that can message the bot (comma-separated): "
).strip()
else:
- phone = input(" Your phone number (e.g. 15551234567): ").strip()
+ phone = line_input(" Your phone number (e.g. 15551234567): ").strip()
if phone:
save_env_value("WHATSAPP_ALLOWED_USERS", phone.replace(" ", ""))
print(f" ✓ Updated to: {phone}")
@@ -3350,11 +3351,11 @@ def cmd_whatsapp(args):
print()
if wa_mode == "bot":
print(" Who should be allowed to message the bot?")
- phone = input(
+ phone = line_input(
" Phone numbers (comma-separated, or * for anyone): "
).strip()
else:
- phone = input(" Your phone number (e.g. 15551234567): ").strip()
+ phone = line_input(" Your phone number (e.g. 15551234567): ").strip()
if phone:
save_env_value("WHATSAPP_ALLOWED_USERS", phone.replace(" ", ""))
print(f" ✓ Allowed users set: {phone}")
@@ -4408,7 +4409,7 @@ def _aux_flow_provider_model(
print(f"No curated model list for {provider_slug}.")
print("Enter a model slug manually (blank = use provider default):")
try:
- val = input("Model: ").strip()
+ val = line_input("Model: ").strip()
except (KeyboardInterrupt, EOFError):
print()
return
@@ -4449,7 +4450,7 @@ def _aux_flow_custom_endpoint(task: str, task_cfg: dict) -> None:
url_prompt = (
f"Base URL [{current_base_url}]: " if current_base_url else "Base URL: "
)
- url = input(url_prompt).strip()
+ url = line_input(url_prompt).strip()
except (KeyboardInterrupt, EOFError):
print()
return
@@ -4463,7 +4464,7 @@ def _aux_flow_custom_endpoint(task: str, task_cfg: dict) -> None:
if current_model
else "Model slug (optional): "
)
- model = input(model_prompt).strip()
+ model = line_input(model_prompt).strip()
except (KeyboardInterrupt, EOFError):
print()
return
@@ -11016,7 +11017,7 @@ def _maybe_setup_dashboard_auth_interactively(args) -> None:
print()
try:
- username = input(" Username [admin]: ").strip() or "admin"
+ username = line_input(" Username [admin]: ").strip() or "admin"
password = getpass.getpass(" Password: ")
confirm = getpass.getpass(" Confirm password: ")
except (EOFError, KeyboardInterrupt):
diff --git a/hermes_cli/model_setup_flows.py b/hermes_cli/model_setup_flows.py
index 6e54ac7472f..84969c5e01d 100644
--- a/hermes_cli/model_setup_flows.py
+++ b/hermes_cli/model_setup_flows.py
@@ -19,6 +19,7 @@ call time, when main.py is fully loaded) so this module never imports
"""
from __future__ import annotations
+from hermes_cli.cli_output import line_input
import argparse
import os
@@ -919,7 +920,7 @@ def _model_flow_custom(config):
print()
try:
- base_url = input(
+ base_url = line_input(
f"API base URL [{current_url or 'e.g. https://api.example.com/v1'}]: "
).strip()
api_key = masked_secret_prompt(
@@ -1020,7 +1021,7 @@ def _model_flow_custom(config):
if confirm in {"", "y", "yes"}:
model_name = detected_models[0]
else:
- model_name = input("Model name (e.g. gpt-4, llama-3-70b): ").strip()
+ model_name = line_input("Model name (e.g. gpt-4, llama-3-70b): ").strip()
elif len(detected_models) > 1:
print(" Available models:")
for i, m in enumerate(detected_models, 1):
@@ -1033,15 +1034,15 @@ def _model_flow_custom(config):
elif pick:
model_name = pick
else:
- model_name = input("Model name (e.g. gpt-4, llama-3-70b): ").strip()
+ model_name = line_input("Model name (e.g. gpt-4, llama-3-70b): ").strip()
- context_length_str = input(
+ context_length_str = line_input(
"Context length in tokens [leave blank for auto-detect]: "
).strip()
# Prompt for a display name — shown in the provider menu on future runs
default_name = _auto_provider_name(effective_url)
- display_name = input(f"Display name [{default_name}]: ").strip() or default_name
+ display_name = line_input(f"Display name [{default_name}]: ").strip() or default_name
except (KeyboardInterrupt, EOFError):
print("\nCancelled.")
return
@@ -1224,7 +1225,7 @@ def _model_flow_azure_foundry(config, current_model=""):
or "e.g. https://<resource>.openai.azure.com/openai/v1 "
"or https://<resource>.services.ai.azure.com/anthropic"
)
- base_url = input(
+ base_url = line_input(
f"API endpoint URL [{_placeholder}]: "
).strip()
except (KeyboardInterrupt, EOFError):
@@ -1421,7 +1422,7 @@ def _model_flow_azure_foundry(config, current_model=""):
effective_model = pick
else:
try:
- model_name = input(
+ model_name = line_input(
f"Model / deployment name [{current_model or 'e.g. gpt-5.4, claude-sonnet-4-6'}]: "
).strip()
except (KeyboardInterrupt, EOFError):
@@ -1715,14 +1716,14 @@ def _model_flow_named_custom(config, provider_info):
elif saved_model and not native_catalog_empty:
print("Could not fetch models from endpoint.")
try:
- model_name = input(f"Model name [{saved_model}]: ").strip() or saved_model
+ model_name = line_input(f"Model name [{saved_model}]: ").strip() or saved_model
except (KeyboardInterrupt, EOFError):
print("\nCancelled.")
return
else:
print("Could not fetch models from endpoint. Enter model name manually.")
try:
- model_name = input("Model name: ").strip()
+ model_name = line_input("Model name: ").strip()
except (KeyboardInterrupt, EOFError):
print("\nCancelled.")
return
@@ -1939,7 +1940,7 @@ def _model_flow_copilot(config, current_model=""):
)
else:
try:
- selected = input("Model name: ").strip()
+ selected = line_input("Model name: ").strip()
except (KeyboardInterrupt, EOFError):
selected = None
@@ -2080,7 +2081,7 @@ def _model_flow_copilot_acp(config, current_model=""):
)
else:
try:
- selected = input("Model name: ").strip()
+ selected = line_input("Model name: ").strip()
except (KeyboardInterrupt, EOFError):
selected = None
@@ -2178,7 +2179,7 @@ def _model_flow_kimi(config, current_model=""):
)
else:
try:
- selected = input("Enter model name: ").strip()
+ selected = line_input("Enter model name: ").strip()
except (KeyboardInterrupt, EOFError):
selected = None
@@ -2291,7 +2292,7 @@ def _model_flow_stepfun(config, current_model=""):
)
else:
try:
- selected = input("Model name: ").strip()
+ selected = line_input("Model name: ").strip()
except (KeyboardInterrupt, EOFError):
selected = None
@@ -2384,7 +2385,7 @@ def _model_flow_bedrock_api_key(config, region, current_model=""):
)
else:
try:
- selected = input(" Model ID: ").strip()
+ selected = line_input(" Model ID: ").strip()
except (KeyboardInterrupt, EOFError):
selected = None
@@ -2476,7 +2477,7 @@ def _model_flow_bedrock(config, current_model=""):
# 2. Region selection
current_region = resolve_bedrock_region()
try:
- region_input = input(f" AWS Region [{current_region}]: ").strip()
+ region_input = line_input(f" AWS Region [{current_region}]: ").strip()
except (KeyboardInterrupt, EOFError):
print()
return
@@ -2607,7 +2608,7 @@ def _model_flow_bedrock(config, current_model=""):
)
else:
try:
- selected = input(" Model ID: ").strip()
+ selected = line_input(" Model ID: ").strip()
except (KeyboardInterrupt, EOFError):
selected = None
@@ -2677,7 +2678,7 @@ def _model_flow_vertex(config, current_model=""):
# 2. Project ID (optional — falls back to the project embedded in creds).
current_project = str(vertex_cfg.get("project_id") or "").strip()
try:
- project_input = input(
+ project_input = line_input(
f" GCP project ID [{current_project or 'from credentials'}]: "
).strip()
except (KeyboardInterrupt, EOFError):
@@ -2688,7 +2689,7 @@ def _model_flow_vertex(config, current_model=""):
# 3. Region (default global — required for the Gemini 3.x previews).
current_region = str(vertex_cfg.get("region") or "global").strip() or "global"
try:
- region_input = input(f" Vertex region [{current_region}]: ").strip()
+ region_input = line_input(f" Vertex region [{current_region}]: ").strip()
except (KeyboardInterrupt, EOFError):
print()
return
@@ -2785,7 +2786,7 @@ def _select_zai_endpoint(current_base: str) -> str:
if selected == len(options):
# Custom proxy URL
try:
- override = input(f"Custom base URL [{current_base}]: ").strip()
+ override = line_input(f"Custom base URL [{current_base}]: ").strip()
except (KeyboardInterrupt, EOFError):
print()
return current_base
@@ -2923,7 +2924,7 @@ def _model_flow_api_key_provider(config, provider_id, current_model=""):
effective_base = chosen_base
else:
try:
- override = input(f"Base URL [{effective_base}]: ").strip()
+ override = line_input(f"Base URL [{effective_base}]: ").strip()
except (KeyboardInterrupt, EOFError):
print()
override = ""
@@ -3082,7 +3083,7 @@ def _model_flow_api_key_provider(config, provider_id, current_model=""):
)
else:
try:
- selected = input("Model name: ").strip()
+ selected = line_input("Model name: ").strip()
except (KeyboardInterrupt, EOFError):
selected = None
@@ -3237,7 +3238,7 @@ def _model_flow_anthropic(config, current_model=""):
)
else:
try:
- selected = input("Model name (e.g., claude-sonnet-4-20250514): ").strip()
+ selected = line_input("Model name (e.g., claude-sonnet-4-20250514): ").strip()
except (KeyboardInterrupt, EOFError):
selected = None
diff --git a/hermes_cli/plugins_cmd.py b/hermes_cli/plugins_cmd.py
index aec327cd378..912d93208d2 100644
--- a/hermes_cli/plugins_cmd.py
+++ b/hermes_cli/plugins_cmd.py
@@ -8,6 +8,7 @@ rendered with Rich Markdown. Otherwise a default confirmation is shown.
"""
from __future__ import annotations
+from hermes_cli.cli_output import line_input
import functools
import importlib.metadata
@@ -484,7 +485,7 @@ def _prompt_plugin_env_vars(manifest: dict, console) -> None:
if secret:
value = masked_secret_prompt(f" {name}: ").strip()
else:
- value = input(f" {name}: ").strip()
+ value = line_input(f" {name}: ").strip()
except (EOFError, KeyboardInterrupt):
console.print(f"\n[dim] Skipped (you can set these later in {display_hermes_home()}/.env)[/dim]")
return
diff --git a/hermes_cli/setup.py b/hermes_cli/setup.py
index 3c65981cbb0..eb7e7f331fe 100644
--- a/hermes_cli/setup.py
+++ b/hermes_cli/setup.py
@@ -210,7 +210,9 @@ def prompt(question: str, default: str = None, password: bool = False) -> str:
if password:
value = masked_secret_prompt(color(display, Colors.YELLOW))
else:
- value = input(color(display, Colors.YELLOW))
+ from hermes_cli.cli_output import line_input
+
+ value = line_input(color(display, Colors.YELLOW))
cleaned = _sanitize_pasted_input(value)
return cleaned.strip() or default or ""
diff --git a/hermes_cli/setup_whatsapp_cloud.py b/hermes_cli/setup_whatsapp_cloud.py
index af979c05d56..c61fa618bc5 100644
--- a/hermes_cli/setup_whatsapp_cloud.py
+++ b/hermes_cli/setup_whatsapp_cloud.py
@@ -33,6 +33,7 @@ to verify the loop end-to-end once everything's running.
"""
from __future__ import annotations
+from hermes_cli.cli_output import line_input
import re
import secrets
@@ -180,7 +181,7 @@ def _prompt(message: str, default: Optional[str] = None, secret: bool = False) -
raw = getpass.getpass(f"{message}{suffix} (input hidden): ").strip()
else:
- raw = input(f"{message}{suffix}: ").strip()
+ raw = line_input(f"{message}{suffix}: ").strip()
except (EOFError, KeyboardInterrupt):
print()
return ""
@@ -444,7 +445,7 @@ def run_whatsapp_cloud_setup() -> int:
current_allow = get_env_value("WHATSAPP_CLOUD_ALLOWED_USERS") or None
allow_default = current_allow if current_allow else None
try:
- allowed = input(
+ allowed = line_input(
f" → Allowed users{' [' + allow_default + ']' if allow_default else ''}: "
).strip() or (allow_default or "")
except (EOFError, KeyboardInterrupt):
diff --git a/hermes_cli/skills_hub.py b/hermes_cli/skills_hub.py
index 28fbf5d81f5..7cca4335d7c 100644
--- a/hermes_cli/skills_hub.py
+++ b/hermes_cli/skills_hub.py
@@ -252,8 +252,10 @@ def _prompt_for_skill_name(c: Console, url: str, default: str = "") -> Optional[
f"[bold]Enter a skill name{default_hint}:[/] "
f"[dim](lowercase letters, digits, hyphens, underscores; starts with a letter)[/]"
)
+ from hermes_cli.cli_output import line_input
+
try:
- answer = input("Name: ").strip()
+ answer = line_input("Name: ").strip()
except (EOFError, KeyboardInterrupt):
return None
if not answer and default:
@@ -277,8 +279,10 @@ def _prompt_for_category(c: Console, existing: List[str]) -> str:
c.print(
"[bold]Category[/] [dim](optional — press Enter to install flat at ~/.hermes/skills/<name>/)[/]"
)
+ from hermes_cli.cli_output import line_input
+
try:
- answer = input("Category: ").strip()
+ answer = line_input("Category: ").strip()
except (EOFError, KeyboardInterrupt):
return ""
if not answer: