feat(channels): add mattermost adapter and wiring

This commit is contained in:
William Valentin
2026-02-16 12:09:44 -08:00
parent 813a0dc5c5
commit de0c1f41b3
16 changed files with 645 additions and 6 deletions
+39
View File
@@ -0,0 +1,39 @@
import { describe, expect, it, vi } from 'vitest';
import { configSchema } from '../config/schema.js';
import { ChannelRegistry } from '../channels/index.js';
import { HookEngine } from '../hooks/index.js';
import { registerChannels } from './channels.js';
describe('registerChannels', () => {
it('registers Mattermost adapter when configured', () => {
const config = configSchema.parse({
telegram: { bot_token: 'test-token', allowed_chat_ids: [1] },
models: { default: { provider: 'anthropic', model: 'claude-3' } },
mattermost: {
server_url: 'https://mattermost.example.com',
bot_token: 'mm-token',
allowed_channel_ids: ['chan-1'],
},
});
const channelRegistry = new ChannelRegistry();
const gateway = {
setWebhookHandler: vi.fn(),
setGmailHandler: vi.fn(),
setTeamsHandler: vi.fn(),
setGoogleChatHandler: vi.fn(),
setBlueBubblesHandler: vi.fn(),
};
registerChannels({
config,
channelRegistry,
hookEngine: new HookEngine(config.hooks),
gateway: gateway as unknown as Parameters<typeof registerChannels>[0]['gateway'],
});
const names = channelRegistry.list().map((adapter) => adapter.name);
expect(names).toContain('mattermost');
expect(names).toContain('webchat');
});
});