The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(setup): public names for the gateway setup-wizard helpers
Teknium952666501f79
diff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.pyindex 19b3f60f258..a7744a0a6c7 100644--- a/hermes_cli/gateway.py+++ b/hermes_cli/gateway.py@@ -4648,11 +4648,11 @@ from hermes_cli.gateway_setup_wizard import (_all_platforms,_platform_status,_set_platform_unauthorized_dm_behavior,- _print_setup_header,- _confirm_reconfigure,- _offer_home_channel,- _save_env_values,- _prompt_csv,+ print_setup_header,+ confirm_reconfigure,+ offer_home_channel,+ save_env_values,+ prompt_csv,_UNAUTHORIZED_ACCESS_CHOICES,_prompt_unauthorized_access,_telegram_auto_setup,diff --git a/hermes_cli/gateway_setup_wizard.py b/hermes_cli/gateway_setup_wizard.pyindex f8495f22a8a..b4940a98679 100644--- a/hermes_cli/gateway_setup_wizard.py+++ b/hermes_cli/gateway_setup_wizard.py@@ -108,12 +108,12 @@ def _set_platform_unauthorized_dm_behavior(platform_key: str, behavior: str) ->_gw().write_platform_config_field(platform_key, "unauthorized_dm_behavior", behavior, raw=True)-def _print_setup_header(title: str) -> None:+def print_setup_header(title: str) -> None:print()print(_gw().color(f" ─── {title} Setup ───", _gw().Colors.CYAN))-def _confirm_reconfigure(label: str, *env_vars: str) -> bool:+def confirm_reconfigure(label: str, *env_vars: str) -> bool:"""False when ``label`` is already configured (all ``env_vars`` set) and the user declines."""if all(_gw().get_env_value(v) for v in env_vars):print()@@ -122,19 +122,19 @@ def _confirm_reconfigure(label: str, *env_vars: str) -> bool:return True-def _offer_home_channel(home_var: str, user_id: str, what: str) -> None:+def offer_home_channel(home_var: str, user_id: str, what: str) -> None:"""Offer to persist ``user_id`` as ``home_var`` (e.g. "your Telegram user ID")."""if _gw().prompt_yes_no(f" Use {what} ({user_id}) as the home channel?", True):_gw().save_env_value(home_var, user_id)_gw().print_success(f" Home channel set to {user_id}")-def _save_env_values(**values: str) -> None:+def save_env_values(**values: str) -> None:for name, value in values.items():_gw().save_env_value(name, value)-def _prompt_csv(prompt_text: str, default: str) -> str:+def prompt_csv(prompt_text: str, default: str) -> str:"""Comma-separated ID prompt with whitespace stripped."""return _gw().prompt(prompt_text, default, password=False).replace(" ", "")@@ -256,14 +256,14 @@ def _setup_standard_platform(platform: dict):"""Interactive setup for Telegram, Discord, or Slack."""from hermes_cli.setup_hidden_env import is_setup_hidden_env as _is_setup_hidden_envemoji, label, token_var = platform["emoji"], platform["label"], platform["token_var"]- _print_setup_header(f"{emoji} {label}")+ print_setup_header(f"{emoji} {label}")instructions = platform.get("setup_instructions")if instructions:print()_gw()._print_info_lines(*(f" {line}" for line in instructions))- if not _confirm_reconfigure(label, token_var):+ if not confirm_reconfigure(label, token_var):returnauto_token_saved, auto_owner_user_id = False, None@@ -311,7 +311,7 @@ def _setup_standard_platform(platform: dict):if allowed_val_set and not home_val and label == "Telegram":first_id = allowed_val_set.split(",")[0].strip()if first_id:- _offer_home_channel(home_var, first_id, "your user ID")+ offer_home_channel(home_var, first_id, "your user ID")print()_gw().print_success(f"{emoji} {label} configured!")@@ -341,7 +341,7 @@ def _configure_platform(platform: dict) -> None:returnlabel = platform.get("label", platform["key"])- _print_setup_header(f"{platform.get('emoji', '🔌')} {label}")+ print_setup_header(f"{platform.get('emoji', '🔌')} {label}")required = entry.required_env if entry else []if required:_gw().print_info(f" Set these env vars in ~/.hermes/.env: {', '.join(required)}")diff --git a/plugins/platforms/qqbot/register.py b/plugins/platforms/qqbot/register.pyindex ba93d28c6f2..4a308eb6329 100644--- a/plugins/platforms/qqbot/register.py+++ b/plugins/platforms/qqbot/register.py@@ -37,12 +37,15 @@ async def standalone_send(pconfig, chat_id, message, *, thread_id=None, media_fidef setup_qqbot() -> None:"""Interactive setup: scan-to-configure or manual App ID / App Secret."""+ from hermes_cli.cli_output import print_info, print_success, print_warning+ from hermes_cli.config import save_env_valuefrom hermes_cli.gateway_setup_wizard import (- _confirm_reconfigure, _gw, _offer_home_channel, _print_setup_header, _prompt_csv, _save_env_values,+ confirm_reconfigure, offer_home_channel, print_setup_header, prompt_csv, save_env_values,)+ from hermes_cli.setup import prompt, prompt_choice, prompt_yes_no- _print_setup_header("🐧 QQ Bot")- if not _confirm_reconfigure("QQ Bot", "QQ_APP_ID", "QQ_CLIENT_SECRET"):+ print_setup_header("🐧 QQ Bot")+ if not confirm_reconfigure("QQ Bot", "QQ_APP_ID", "QQ_CLIENT_SECRET"):returnprint()@@ -51,36 +54,34 @@ def setup_qqbot() -> None:"Enter existing App ID and App Secret manually",]credentials = None- if _gw().prompt_choice(" How would you like to set up QQ Bot?", method_choices, 0) == 0:+ if prompt_choice(" How would you like to set up QQ Bot?", method_choices, 0) == 0:try:from .onboard import qr_registercredentials = qr_register()except KeyboardInterrupt:print()- _gw().print_warning(" QQ Bot setup cancelled.")+ print_warning(" QQ Bot setup cancelled.")returnif not credentials:- _gw().print_info(" QR setup did not complete. Continuing with manual input.")+ print_info(" QR setup did not complete. Continuing with manual input.")if not credentials:print()- _gw()._print_info_lines(- " Go to https://q.qq.com to register a QQ Bot application.",- " Note your App ID and App Secret from the application page.",- )+ print_info(" Go to https://q.qq.com to register a QQ Bot application.")+ print_info(" Note your App ID and App Secret from the application page.")print()- app_id = _gw().prompt(" App ID", password=False)+ app_id = prompt(" App ID", password=False)if not app_id:- _gw().print_warning(" Skipped — QQ Bot won't work without an App ID.")+ print_warning(" Skipped — QQ Bot won't work without an App ID.")return- app_secret = _gw().prompt(" App Secret", password=True)+ app_secret = prompt(" App Secret", password=True)if not app_secret:- _gw().print_warning(" Skipped — QQ Bot won't work without an App Secret.")+ print_warning(" Skipped — QQ Bot won't work without an App Secret.")returncredentials = {"app_id": app_id.strip(), "client_secret": app_secret.strip(), "user_openid": ""}- _gw().save_env_value("QQ_APP_ID", credentials["app_id"])- _gw().save_env_value("QQ_CLIENT_SECRET", credentials["client_secret"])+ save_env_value("QQ_APP_ID", credentials["app_id"])+ save_env_value("QQ_CLIENT_SECRET", credentials["client_secret"])user_openid = credentials.get("user_openid", "")print()@@ -89,38 +90,38 @@ def setup_qqbot() -> None:"Allow all direct messages","Only allow listed user OpenIDs",]- access_idx = _gw().prompt_choice(" How should direct messages be authorized?", access_choices, 0)+ access_idx = prompt_choice(" How should direct messages be authorized?", access_choices, 0)if access_idx == 0:- _gw().save_env_value("QQ_ALLOW_ALL_USERS", "false")+ save_env_value("QQ_ALLOW_ALL_USERS", "false")allowed = ""if user_openid:print()- if _gw().prompt_yes_no(f" Add yourself ({user_openid}) to the allow list?", True):+ if prompt_yes_no(f" Add yourself ({user_openid}) to the allow list?", True):allowed = user_openid- _gw().print_success(f" Allow list set to {user_openid}")- _gw().save_env_value("QQ_ALLOWED_USERS", allowed)- _gw().print_success(" DM pairing enabled.")- _gw().print_info(" Unknown users can request access; approve with `hermes pairing approve`.")+ print_success(f" Allow list set to {user_openid}")+ save_env_value("QQ_ALLOWED_USERS", allowed)+ print_success(" DM pairing enabled.")+ print_info(" Unknown users can request access; approve with `hermes pairing approve`.")elif access_idx == 1:- _save_env_values(QQ_ALLOW_ALL_USERS="true", QQ_ALLOWED_USERS="")- _gw().print_warning(" Open DM access enabled for QQ Bot.")+ save_env_values(QQ_ALLOW_ALL_USERS="true", QQ_ALLOWED_USERS="")+ print_warning(" Open DM access enabled for QQ Bot.")else:- allowlist = _prompt_csv(" Allowed user OpenIDs (comma-separated)", user_openid or "")- _save_env_values(QQ_ALLOW_ALL_USERS="false", QQ_ALLOWED_USERS=allowlist)- _gw().print_success(" Allowlist saved.")+ allowlist = prompt_csv(" Allowed user OpenIDs (comma-separated)", user_openid or "")+ save_env_values(QQ_ALLOW_ALL_USERS="false", QQ_ALLOWED_USERS=allowlist)+ print_success(" Allowlist saved.")print()if user_openid:- _offer_home_channel("QQBOT_HOME_CHANNEL", user_openid, "your QQ user ID")+ offer_home_channel("QQBOT_HOME_CHANNEL", user_openid, "your QQ user ID")else:- home_channel = _gw().prompt(" Home channel OpenID (for cron/notifications, or empty)", password=False)+ home_channel = prompt(" Home channel OpenID (for cron/notifications, or empty)", password=False)if home_channel:- _gw().save_env_value("QQBOT_HOME_CHANNEL", home_channel.strip())- _gw().print_success(f" Home channel set to {home_channel.strip()}")+ save_env_value("QQBOT_HOME_CHANNEL", home_channel.strip())+ print_success(f" Home channel set to {home_channel.strip()}")print()- _gw().print_success("🐧 QQ Bot configured!")- _gw().print_info(f" App ID: {credentials['app_id']}")+ print_success("🐧 QQ Bot configured!")+ print_info(f" App ID: {credentials['app_id']}")# System-prompt platform hint (PlatformEntry.platform_hint); cached-prompt bytes, keep stable.diff --git a/plugins/platforms/signal/setup.py b/plugins/platforms/signal/setup.pyindex 544fcb2017d..fba57705577 100644--- a/plugins/platforms/signal/setup.py+++ b/plugins/platforms/signal/setup.py@@ -21,11 +21,11 @@ def _signal_line_input(prompt_text: str) -> str | None:def interactive_setup() -> None:"""``hermes gateway setup`` flow for Signal (registered as the plugin's ``setup_fn``)."""- _gw()._print_setup_header("📡 Signal")+ _gw().print_setup_header("📡 Signal")existing_url = _gw().get_env_value("SIGNAL_HTTP_URL")existing_account = _gw().get_env_value("SIGNAL_ACCOUNT")- if not _gw()._confirm_reconfigure("Signal", "SIGNAL_HTTP_URL", "SIGNAL_ACCOUNT"):+ if not _gw().confirm_reconfigure("Signal", "SIGNAL_HTTP_URL", "SIGNAL_ACCOUNT"):returnprint()diff --git a/plugins/platforms/weixin/adapter.py b/plugins/platforms/weixin/adapter.pyindex 7cb0cba8b62..dc1623cc689 100644--- a/plugins/platforms/weixin/adapter.py+++ b/plugins/platforms/weixin/adapter.py@@ -1308,9 +1308,9 @@ def interactive_setup() -> None:wizard and the facade seams tests patch keep intercepting."""from hermes_cli import gateway as gwfrom hermes_cli.gateway_setup_wizard import (- _confirm_reconfigure, _offer_home_channel, _print_setup_header, _prompt_csv, _save_env_values)+ confirm_reconfigure, offer_home_channel, print_setup_header, prompt_csv, save_env_values)- _print_setup_header("💬 Weixin / WeChat")+ print_setup_header("💬 Weixin / WeChat")print()gw._print_info_lines(" 1. Hermes will open Tencent iLink QR login in this terminal.",@@ -1318,7 +1318,7 @@ def interactive_setup() -> None:" 3. Hermes will store the returned account_id/token in ~/.hermes/.env."," 4. This adapter supports native text, image, video, and document delivery.",)- if not _confirm_reconfigure("Weixin", "WEIXIN_ACCOUNT_ID", "WEIXIN_TOKEN"):+ if not confirm_reconfigure("Weixin", "WEIXIN_ACCOUNT_ID", "WEIXIN_TOKEN"):returnif not check_weixin_requirements():gw.print_error(" Missing dependencies: Weixin needs aiohttp and cryptography.")@@ -1356,12 +1356,12 @@ def interactive_setup() -> None:]access_idx = gw.prompt_choice(" How should direct messages be authorized?", access_choices, 0)if access_idx == 2:- allowlist = _prompt_csv(" Allowed Weixin user IDs (comma-separated)", user_id or "")- _save_env_values(WEIXIN_DM_POLICY="allowlist", WEIXIN_ALLOW_ALL_USERS="false", WEIXIN_ALLOWED_USERS=allowlist)+ allowlist = prompt_csv(" Allowed Weixin user IDs (comma-separated)", user_id or "")+ save_env_values(WEIXIN_DM_POLICY="allowlist", WEIXIN_ALLOW_ALL_USERS="false", WEIXIN_ALLOWED_USERS=allowlist)gw.print_success(" Weixin allowlist saved.")else:policy, allow_all, level, message = _WEIXIN_DM_POLICIES.get(access_idx, _WEIXIN_DM_POLICIES[3])- _save_env_values(WEIXIN_DM_POLICY=policy, WEIXIN_ALLOW_ALL_USERS=allow_all, WEIXIN_ALLOWED_USERS="")+ save_env_values(WEIXIN_DM_POLICY=policy, WEIXIN_ALLOW_ALL_USERS=allow_all, WEIXIN_ALLOWED_USERS="")(gw.print_success if level == "success" else gw.print_warning)(message)if access_idx == 0:gw.print_info(" Unknown DM users can request access and you approve them with `hermes pairing approve`.")@@ -1371,19 +1371,19 @@ def interactive_setup() -> None:group_choices = ["Disable group chats (recommended)", "Allow all group chats", "Only allow listed group chat IDs"]group_idx = gw.prompt_choice(" How should group chats be handled?", group_choices, 0)if group_idx == 0:- _save_env_values(WEIXIN_GROUP_POLICY="disabled", WEIXIN_GROUP_ALLOWED_USERS="")+ save_env_values(WEIXIN_GROUP_POLICY="disabled", WEIXIN_GROUP_ALLOWED_USERS="")gw.print_info(" Group chats disabled.")elif group_idx == 1:- _save_env_values(WEIXIN_GROUP_POLICY="open", WEIXIN_GROUP_ALLOWED_USERS="")+ save_env_values(WEIXIN_GROUP_POLICY="open", WEIXIN_GROUP_ALLOWED_USERS="")gw.print_warning(" All group chats enabled (only takes effect if iLink delivers group events).")else:- allow_groups = _prompt_csv(" Allowed group chat IDs (comma-separated, not member user IDs)", "")- _save_env_values(WEIXIN_GROUP_POLICY="allowlist", WEIXIN_GROUP_ALLOWED_USERS=allow_groups)+ allow_groups = prompt_csv(" Allowed group chat IDs (comma-separated, not member user IDs)", "")+ save_env_values(WEIXIN_GROUP_POLICY="allowlist", WEIXIN_GROUP_ALLOWED_USERS=allow_groups)gw.print_success(" Group allowlist saved (only takes effect if iLink delivers group events).")if user_id:print()- _offer_home_channel("WEIXIN_HOME_CHANNEL", user_id, "your Weixin user ID")+ offer_home_channel("WEIXIN_HOME_CHANNEL", user_id, "your Weixin user ID")print()gw.print_success("Weixin configured!")gw.print_info(f" Account ID: {account_id}")