Skip to content

feat(xmpp): add XMPP channel support#48

Open
penso wants to merge 9 commits intomainfrom
xmpp
Open

feat(xmpp): add XMPP channel support#48
penso wants to merge 9 commits intomainfrom
xmpp

Conversation

@penso
Copy link
Copy Markdown
Collaborator

@penso penso commented Feb 5, 2026

Summary

  • Add full XMPP channel implementation (crates/xmpp/) using tokio-xmpp v5, with feature parity to the Telegram channel
  • Refactor the gateway from hardcoded Telegram to a multi-channel architecture via ChannelRegistry
  • Support 1:1 chat, MUC (group chat), reactions (XEP-0444), typing indicators (XEP-0085), media via OOB (XEP-0066), and HTTP file upload (XEP-0363)
  • Per-room MUC overrides: custom system prompts, skill sets, user allowlists, and mention mode

Gateway refactoring (Phase A)

  • GatewayServices outbound map → HashMap<String, Arc<dyn ChannelOutbound>>
  • LiveChannelService → uses ChannelRegistry instead of TelegramPlugin directly
  • deliver_channel_replies → dynamic outbound lookup by channel_type
  • Session labels use channel name dynamically instead of hardcoded "Telegram"
  • ChannelsConfig gains xmpp field alongside telegram

XMPP crate (Phase B)

  • plugin.rs: XmppPlugin implementing ChannelPlugin + ChannelStatus
  • outbound.rs: text chunking, chat/groupchat routing, typing, media via OOB
  • client.rs: tokio-xmpp event loop with auto-reconnect, MUC auto-join
  • handlers.rs: inbound stanza routing, self-echo filtering, slash commands
  • access.rs: DM/group policies, per-room config, domain wildcard matching
  • XEP modules: MUC (0045), Chat States (0085), OOB (0066), Reactions (0444), HTTP Upload (0363)

Per-room overrides (Phase C)

  • ChannelMessageMeta extended with room_system_prompt and room_skills

Test plan

  • cargo +nightly fmt --all — passes
  • cargo +nightly clippy --all-targets -- -D warnings — zero warnings
  • cargo test — all tests pass (61 new XMPP tests, 936+ total)
  • Manual test: configure XMPP account in moltis.toml, connect to ejabberd/Prosody, verify 1:1 and MUC messaging
  • Verify Telegram still works unchanged after gateway refactoring

🤖 Generated with Claude Code

penso and others added 9 commits February 5, 2026 12:33
Add a full XMPP channel implementation (crates/xmpp/) using tokio-xmpp v5,
with feature parity to the Telegram channel. Refactor the gateway to support
multiple channel types via ChannelRegistry instead of hardcoding Telegram.

Phase A — Gateway refactoring:
- GatewayServices: outbound map is now HashMap<String, Arc<dyn ChannelOutbound>>
- LiveChannelService: uses ChannelRegistry instead of TelegramPlugin directly
- deliver_channel_replies: dynamic outbound lookup by channel_type
- Session labels: use channel name instead of hardcoded "Telegram"
- ChannelsConfig: add xmpp field alongside telegram
- server.rs: create and wire both plugins via ChannelRegistry

Phase B — XMPP crate (crates/xmpp/):
- config.rs: XmppAccountConfig with DM/group policies, MUC rooms, per-room
  overrides (MucRoomConfig), mention modes, allowlists
- state.rs: AccountState with mpsc::Sender for outbound stanzas
- stanza.rs: helpers for building XMPP stanzas with minidom 0.18 NcName API
- plugin.rs: XmppPlugin implementing ChannelPlugin + ChannelStatus
- outbound.rs: XmppOutbound implementing ChannelOutbound (text chunking,
  chat vs groupchat routing, typing indicators, media via OOB)
- client.rs: tokio-xmpp event loop with auto-reconnect, MUC auto-join
- handlers.rs: inbound stanza routing (message/presence/iq), self-echo
  filtering, slash command interception, chat session dispatch
- access.rs: XMPP access control with per-room config, domain wildcards
- XEP modules: MUC (0045), Chat States (0085), OOB (0066),
  Reactions (0444), HTTP Upload (0363)

Phase C — Per-room overrides:
- ChannelMessageMeta extended with room_system_prompt and room_skills
- XMPP handler populates from MucRoomConfig

61 tests in the XMPP crate, all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	Cargo.lock
#	crates/gateway/Cargo.toml
Add docs/src/xmpp.md covering setup, configuration (access control,
per-room overrides, media limits), supported XEPs, and troubleshooting.
Update SUMMARY.md, configuration.md, and CHANGELOG.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	CHANGELOG.md
#	Cargo.lock
#	crates/gateway/Cargo.toml
#	crates/gateway/src/channel.rs
#	crates/gateway/src/chat.rs
#	crates/gateway/src/services.rs
#	crates/telegram/src/plugin.rs
- Fix clippy needless_update in prompt.rs test
- Biome reformat of biome.json

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	CHANGELOG.md
#	Cargo.lock
#	Cargo.toml
#	crates/gateway/Cargo.toml
#	crates/gateway/src/chat.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant