feat(matrix): add Matrix channel adapter

This commit is contained in:
William Valentin
2026-02-15 18:02:14 -08:00
parent 5fdb9e5a83
commit bc8326cf4a
5 changed files with 766 additions and 1 deletions
+15 -1
View File
@@ -1,6 +1,6 @@
import type { Config } from '../config/index.js';
import type { HookEngine } from '../hooks/index.js';
import { ChannelRegistry, TelegramAdapter, WebChatAdapter, DiscordAdapter, SlackAdapter, WhatsAppAdapter, PairingManager } from '../channels/index.js';
import { ChannelRegistry, TelegramAdapter, WebChatAdapter, DiscordAdapter, SlackAdapter, WhatsAppAdapter, MatrixAdapter, PairingManager } from '../channels/index.js';
import { CronScheduler, WebhookHandler, GmailWatcher } from '../automation/index.js';
import type { GatewayServer } from '../gateway/index.js';
@@ -70,6 +70,20 @@ export function registerChannels(deps: ChannelsDeps): ChannelsResult {
channelRegistry.register(whatsappAdapter);
}
// Register Matrix adapter (if configured)
if (config.matrix) {
const matrixAdapter = new MatrixAdapter({
homeserverUrl: config.matrix.homeserver_url,
accessToken: config.matrix.access_token,
allowedRoomIds: config.matrix.allowed_room_ids.length > 0 ? config.matrix.allowed_room_ids : undefined,
requireMention: config.matrix.require_mention,
syncTimeoutMs: config.matrix.sync_timeout_ms,
displayName: config.matrix.display_name,
pairingManager,
});
channelRegistry.register(matrixAdapter);
}
// Register WebChat adapter (wraps the gateway)
const webChatAdapter = new WebChatAdapter({ gateway });
channelRegistry.register(webChatAdapter);