diff --git a/cli-config.yaml.example b/cli-config.yaml.example index 1d87255f48d..55ae05b4b70 100644 --- a/cli-config.yaml.example +++ b/cli-config.yaml.example @@ -742,10 +742,10 @@ platform_toolsets: # disable_link_previews: false # Set true to suppress Telegram URL previews in bot messages # rich_messages: false # Bot API 10.1 rich messages (tables/task lists/details/math); default false for copyable legacy MarkdownV2, set true to opt in # command_menu: -# # Telegram allows up to 100 BotCommands; Hermes defaults to 30 to -# # stay under Telegram's payload-size limits while keeping common -# # commands visible. Values are clamped to 1..100. -# max_commands: 30 +# # Telegram allows up to 100 BotCommands; Hermes defaults to 60 so +# # all built-in commands plus common skill commands stay visible +# # while remaining under Telegram's payload-size limit. Clamped 1..100. +# max_commands: 60 # # prepend = user priority first, then Hermes defaults # # append = Hermes defaults first, then user priority # # replace = only the list below defines priority diff --git a/hermes_cli/commands.py b/hermes_cli/commands.py index 18cbaaf6860..c7ce5566e40 100644 --- a/hermes_cli/commands.py +++ b/hermes_cli/commands.py @@ -534,7 +534,11 @@ def telegram_bot_commands() -> list[tuple[str, str]]: return result -_DEFAULT_TELEGRAM_MENU_MAX_COMMANDS = 30 +# Telegram allows up to 100 BotCommands. Hermes ships ~50 built-in commands; +# a 60-slot default keeps every built-in plus common skill commands visible in +# the `/` menu while staying comfortably under Telegram's ~4KB payload limit. +# Users can tune this via platforms.telegram.extra.command_menu.max_commands. +_DEFAULT_TELEGRAM_MENU_MAX_COMMANDS = 60 _TELEGRAM_BOT_API_MAX_COMMANDS = 100 _TELEGRAM_PRIORITY_MODES = {"prepend", "append", "replace"} diff --git a/plugins/platforms/telegram/adapter.py b/plugins/platforms/telegram/adapter.py index 34cd6f2c7e3..b1f31e5b13a 100644 --- a/plugins/platforms/telegram/adapter.py +++ b/plugins/platforms/telegram/adapter.py @@ -2427,9 +2427,10 @@ class TelegramAdapter(BasePlatformAdapter): ) from hermes_cli.commands import telegram_menu_commands, telegram_menu_max_commands # Telegram allows up to 100 commands but has an undocumented - # payload size limit (~4KB total). Hermes defaults to 30 to - # stay well under the threshold while covering all categories; - # users can tune the cap via platforms.telegram.extra.command_menu. + # payload size limit (~4KB total). Hermes defaults to 60 to + # keep built-ins plus common skill commands visible while + # staying under the threshold; users can tune the cap via + # platforms.telegram.extra.command_menu. max_commands = telegram_menu_max_commands() menu_commands, hidden_count = telegram_menu_commands(max_commands=max_commands) bot_commands = [BotCommand(name, desc) for name, desc in menu_commands] diff --git a/tests/hermes_cli/test_commands.py b/tests/hermes_cli/test_commands.py index bd99e3b125d..d357a7c89a6 100644 --- a/tests/hermes_cli/test_commands.py +++ b/tests/hermes_cli/test_commands.py @@ -1245,7 +1245,7 @@ class TestTelegramMenuCommands: def test_telegram_menu_max_commands_uses_config_with_safe_bounds(self, tmp_path, monkeypatch): monkeypatch.setenv("HERMES_HOME", str(tmp_path)) - assert telegram_menu_max_commands() == 30 + assert telegram_menu_max_commands() == 60 (tmp_path / "config.yaml").write_text( "platforms:\n" @@ -1281,7 +1281,7 @@ class TestTelegramMenuCommands: " command_menu:\n" " max_commands: nope\n" ) - assert telegram_menu_max_commands() == 30 + assert telegram_menu_max_commands() == 60 def test_telegram_menu_ignores_undocumented_command_menu_paths(self, tmp_path, monkeypatch): monkeypatch.setenv("HERMES_HOME", str(tmp_path)) @@ -1296,7 +1296,7 @@ class TestTelegramMenuCommands: " max_commands: 9\n" ) - assert telegram_menu_max_commands() == 30 + assert telegram_menu_max_commands() == 60 def test_includes_plugin_commands_via_lazy_discovery(self, tmp_path, monkeypatch): """Telegram menu generation should discover plugin slash commands on first access.""" diff --git a/website/docs/user-guide/messaging/telegram.md b/website/docs/user-guide/messaging/telegram.md index 13b754a4578..1e5eea92efd 100644 --- a/website/docs/user-guide/messaging/telegram.md +++ b/website/docs/user-guide/messaging/telegram.md @@ -81,7 +81,7 @@ Notes: ### Command menu priority and cap (Optional) -Hermes registers its command menu automatically when the Telegram gateway starts. The menu is built from the central slash-command registry plus eligible plugin/skill commands, then capped to a safe default of 30 commands so Telegram accepts the payload reliably. +Hermes registers its command menu automatically when the Telegram gateway starts. The menu is built from the central slash-command registry plus eligible plugin/skill commands, then capped so Telegram accepts the payload reliably. The default cap is 60 commands — enough to keep all built-in commands plus common skill commands visible. If you have local or plugin commands that should stay visible in Telegram's `/` picker, prioritize them in `~/.hermes/config.yaml`: @@ -90,7 +90,7 @@ platforms: telegram: extra: command_menu: - max_commands: 30 + max_commands: 60 priority_mode: prepend # prepend | append | replace priority: - my_plugin_command @@ -102,7 +102,7 @@ platforms: - `append`: keep Hermes defaults first, then your commands - `replace`: use only your list for priority ordering -Telegram allows up to 100 BotCommands, but large command payloads can fail. Hermes defaults to 30 for reliability and clamps configured values to `1..100`; use `/commands` for the full command list. +Telegram allows up to 100 BotCommands, but large command payloads can fail. Hermes defaults to 60 for reliability and clamps configured values to `1..100`; use `/commands` for the full command list. ## Step 3: Privacy Mode (Critical for Groups)