hermes-agent/gateway/platforms
Teknium 51ca575994 feat(gateway): expose plugin slash commands natively on all platforms + decision-capable command hook
Plugin slash commands now surface as first-class commands in every gateway
enumerator — Discord native slash picker, Telegram BotCommand menu, Slack
/hermes subcommand map — without a separate per-platform plugin API.

The existing 'command:<name>' gateway hook gains a decision protocol via
HookRegistry.emit_collect(): handlers that return a dict with
{'decision': 'deny'|'handled'|'rewrite'|'allow'} can intercept slash
command dispatch before core handling runs, unifying what would otherwise
have been a parallel 'pre_gateway_command' hook surface.

Changes:

- gateway/hooks.py: add HookRegistry.emit_collect() that fires the same
  handler set as emit() but collects non-None return values. Backward
  compatible — fire-and-forget telemetry hooks still work via emit().
- hermes_cli/plugins.py: add optional 'args_hint' param to
  register_command() so plugins can opt into argument-aware native UI
  registration (Discord arg picker, future platforms).
- hermes_cli/commands.py: add _iter_plugin_command_entries() helper and
  merge plugin commands into telegram_bot_commands() and
  slack_subcommand_map(). New is_gateway_known_command() recognizes both
  built-in and plugin commands so the gateway hook fires for either.
- gateway/platforms/discord.py: extract _build_auto_slash_command helper
  from the COMMAND_REGISTRY auto-register loop and reuse it for
  plugin-registered commands. Built-in name conflicts are skipped.
- gateway/run.py: before normal slash dispatch, call emit_collect on
  command:<canonical> and honor deny/handled/rewrite/allow decisions.
  Hook now fires for plugin commands too.
- scripts/release.py: AUTHOR_MAP entry for @Magaav.
- Tests: emit_collect semantics, plugin command surfacing per platform,
  decision protocol (deny/handled/rewrite/allow + non-dict tolerance),
  Discord plugin auto-registration + conflict skipping, is_gateway_known_command.

Salvaged from #14131 (@Magaav). Original PR added a parallel
'pre_gateway_command' hook and a platform-keyed plugin command
registry; this re-implementation reuses the existing 'command:<name>'
hook and treats plugin commands as platform-agnostic so the same
capability reaches Telegram and Slack without new API surface.

Co-authored-by: Magaav <73175452+Magaav@users.noreply.github.com>
2026-04-22 16:23:21 -07:00
..
qqbot refactor(qqbot): migrate qr onboard flow to sync + consolidate into onboard.py 2026-04-22 05:50:21 -07:00
__init__.py feat(gateway): unify QQBot branding, add PLATFORM_HINTS, fix streaming, restore missing setup functions 2026-04-14 00:11:49 -07:00
ADDING_A_PLATFORM.md docs: finish cron terminology cleanup 2026-03-14 19:20:58 -07:00
api_server.py refactor: remove redundant local imports already available at module level 2026-04-21 00:50:58 -07:00
base.py feat(gateway): recognize .pdf in MEDIA: tag extraction (#13683) 2026-04-21 13:48:10 -07:00
bluebubbles.py refactor: remove remaining redundant local imports (comprehensive sweep) 2026-04-21 00:50:58 -07:00
dingtalk.py feat(dingtalk): AI Cards streaming, emoji reactions, and media handling 2026-04-17 19:26:53 -07:00
discord.py feat(gateway): expose plugin slash commands natively on all platforms + decision-capable command hook 2026-04-22 16:23:21 -07:00
email.py fix(gateway): validate Slack image downloads before caching 2026-04-10 03:53:09 -07:00
feishu.py feat(feishu): preserve @mention context on inbound messages 2026-04-22 14:44:07 -07:00
feishu_comment.py feat: add Feishu document comment intelligent reply with 3-tier access control 2026-04-17 19:04:11 -07:00
feishu_comment_rules.py fix(feishu-comment): use get_hermes_home(); drop dead asyncio wrapper; AUTHOR_MAP 2026-04-17 19:04:11 -07:00
helpers.py fix: enforce TTL in MessageDeduplicator + use yaml for gateway --config (#10306, #10216) (#10509) 2026-04-15 13:35:40 -07:00
homeassistant.py fix(gateway): add request timeouts to HA, Email, Mattermost, SMS adapters (#3258) 2026-03-26 14:36:07 -07:00
matrix.py fix(gateway): accept finalize kwarg in all platform edit_message overrides 2026-04-19 22:46:47 -07:00
mattermost.py refactor: remove redundant local imports already available at module level 2026-04-21 00:50:58 -07:00
signal.py fix(gateway): prevent scoped lock and resource leaks on connection failure 2026-04-20 01:44:36 -07:00
slack.py feat(gateway/slack): add SLACK_REACTIONS env toggle for reaction lifecycle 2026-04-22 08:49:24 -07:00
sms.py remove unused import and fix misleading log 2026-04-11 14:05:38 -07:00
telegram.py fix(telegram): require TELEGRAM_WEBHOOK_SECRET in webhook mode (#13527) 2026-04-21 06:23:09 -07:00
telegram_network.py feat(telegram): add dedicated TELEGRAM_PROXY env var and config.yaml proxy_url support 2026-04-15 22:13:11 -07:00
webhook.py fix(webhook): validate HMAC signature before rate limiting (#12544) 2026-04-19 22:45:08 -07:00
wecom.py fix(wecom): visible poll progress + clearer no-bot-info failure + docstring note 2026-04-22 05:15:32 -07:00
wecom_callback.py fix: activate WeCom callback message deduplication (#10305) (#10588) 2026-04-15 17:22:58 -07:00
wecom_crypto.py feat(gateway): add WeCom callback-mode adapter for self-built apps 2026-04-11 15:22:49 -07:00
weixin.py Fix Weixin media uploads and refresh lockfile 2026-04-17 06:50:36 -07:00
whatsapp.py refactor: remove remaining redundant local imports (comprehensive sweep) 2026-04-21 00:50:58 -07:00