feat(gateway): add Rocket.Chat platform adapter - #4637
Conversation
Adds a full Rocket.Chat gateway adapter using the RC REST API v1 and DDP WebSocket (stream-room-messages / __my_messages__). Key design decisions and non-obvious behaviour: - Auth supports username+password (session token via POST /login) and PAT fallback; session token is reused for DDP `resume` login. - Room type is resolved via rooms.info (works for all types) and cached per room_id, avoiding the need to heuristically infer DM from the eventName string (unreliable across RC versions). - Emoji reactions (👀/✅/❌) and thread replies (tmid) are suppressed for DM rooms unconditionally; reactions can also be disabled globally via ROCKETCHAT_REACTIONS=false. - Tilde characters are replaced with U+223C (TILDE OPERATOR) so that pairs like ~8.3°C … ~17.7°C are not rendered as strikethrough. - File-only upload messages are held in a per-room buffer (5 min TTL) and attached to the next text message from the same room, enabling "summarise the PDF I just sent" workflows.
4475284 to
31b49a9
Compare
Move gateway/platforms/rocketchat.py into the new plugins/platforms/rocketchat/ plugin directory, following the pattern established by the teams and IRC platform plugins. Adds register(ctx), validate_config(), is_connected(), and interactive_setup() as required by the plugin contract. Updates tests to use the _plugin_adapter_loader pattern. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 similar comment
I tested this PR locally and identified 2 bugs that prevent the Rocket.Chat plugin from working properly:Bug 1:
|
- Export register() from plugins/platforms/rocketchat/__init__.py so discover_plugins() can load the adapter (was empty, causing the plugin to be silently skipped) - Call discover_plugins() in hermes_cli/status.py before iterating platform_registry.plugin_entries() so IRC, Rocket.Chat, and Teams appear in 'hermes status' on a fresh shell
fc3f711 to
265a5ab
Compare
|
Hey @meron1122, thanks for your Rocket.Chat plugin work in this PR — your plugin-structure approach was a great reference. 🙏 @cyb0rgk1tty too — your PR #14869 with the core adapter code was the foundation we started from. We built a more complete version that includes fixes for both bugs reported here by @menardorama (empty init.py and discover_plugins()), plus several enhancements from live operation: Bugs fixed:
Extra features:
Our PR: #30463 Its a single-plugin addition with zero core Hermes changes. The feature set is more complete and ready for review/maintainer attention. Happy to collaborate -- let us know what you think! 🔥 |
|
Thanks for the substantial Rocket.Chat adapter work, including the plugin registration and test coverage. This automated hermes-sweeper review is closing this as
Please publish the adapter as a standalone plugin repository using the existing platform registry/plugin interface; it can then be shared through the Nous Research Discord Closed as not-planned per standing maintainer policy ( |
|
I published plugin powerup with amazing features from @HearthCore and a few more. Feel free to use and contribute |
What
Adds a full Rocket.Chat gateway adapter (
gateway/platforms/rocketchat.py) using the RC REST API v1 and DDP WebSocket (stream-room-messages/__my_messages__). No external Rocket.Chat library required — usesaiohttpwhich is already a Hermes dependency.Changes
gateway/platforms/rocketchat.py— new adaptergateway/config.py—Platform.ROCKETCHATenum + env-var config loadinggateway/run.py— adapter wiring, allowlist env varstoolsets.py—hermes-rocketchattoolset + added tohermes-gatewayhermes_cli/tools_config.py— platform entry for setup wizardtests/gateway/test_rocketchat.py— 37 tests (all passing)Key behaviour
Auth — username+password (recommended, session token via
POST /login) or PAT fallback. Session token is reused for DDPresumelogin so only one credential flow is needed.Room type detection — uses
GET /api/v1/rooms.info(works for channels, private groups, and DMs in a single request) with a per-room cache. Earlier heuristic of checkinguserId in eventNamewas unreliable across RC versions.DM behaviour — emoji reactions (👀/✅/❌) and thread replies (
tmid) are suppressed for DM rooms. Reactions can also be disabled globally withROCKETCHAT_REACTIONS=false.Markdown —
**bold**→*bold*(RC uses single asterisk), tilde replaced with U+223C TILDE OPERATOR so pairs like~8.3°C … ~17.7°Care not rendered as strikethrough by RC's parser.Deferred attachments — file-only upload messages are held in a per-room buffer (5 min TTL) and merged into the next text message from that room, enabling workflows like "here's a PDF [upload] → summarise it [text message]".
Environment variables
ROCKETCHAT_URLROCKETCHAT_USERNAMEROCKETCHAT_PASSWORDROCKETCHAT_TOKENROCKETCHAT_USER_IDROCKETCHAT_ALLOWED_USERSROCKETCHAT_ALLOW_ALL_USERStrueto allow all usersROCKETCHAT_HOME_CHANNELROCKETCHAT_REQUIRE_MENTIONtrue)ROCKETCHAT_FREE_RESPONSE_CHANNELSROCKETCHAT_REPLY_IN_THREADfalse)ROCKETCHAT_REACTIONStrue)How to test
Then DM the bot or @mention it in a channel. Upload a file without text, then send a follow-up message to verify deferred attachment works.
# Run tests pytest tests/gateway/test_rocketchat.py -vPlatform tested on