feat(channels): add mattermost adapter and wiring
This commit is contained in:
@@ -438,6 +438,38 @@ describe('configSchema — audio talk mode', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — mattermost', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
models: { default: { provider: 'anthropic', model: 'claude-3' } },
|
||||
};
|
||||
|
||||
it('accepts mattermost config and defaults optional fields', () => {
|
||||
const result = configSchema.parse({
|
||||
...minimalConfig,
|
||||
mattermost: {
|
||||
server_url: 'https://mattermost.example.com',
|
||||
bot_token: 'mm-token',
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.mattermost).toBeDefined();
|
||||
if (!result.mattermost) {
|
||||
throw new Error('Expected mattermost config');
|
||||
}
|
||||
expect(result.mattermost.server_url).toBe('https://mattermost.example.com');
|
||||
expect(result.mattermost.allowed_channel_ids).toEqual([]);
|
||||
expect(result.mattermost.require_mention).toBe(true);
|
||||
expect(result.mattermost.mention_name).toBe('flynn');
|
||||
expect(result.mattermost.poll_interval_ms).toBe(3000);
|
||||
});
|
||||
|
||||
it('mattermost config is optional', () => {
|
||||
const result = configSchema.parse(minimalConfig);
|
||||
expect(result.mattermost).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — teams', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
|
||||
@@ -449,6 +449,15 @@ const signalSchema = z.object({
|
||||
send_timeout_ms: z.number().min(1000).max(60000).default(15000),
|
||||
}).optional();
|
||||
|
||||
const mattermostSchema = z.object({
|
||||
server_url: z.string().url('Mattermost server_url must be a valid URL'),
|
||||
bot_token: z.string().min(1, 'Mattermost bot_token is required'),
|
||||
allowed_channel_ids: z.array(z.string()).default([]),
|
||||
require_mention: z.boolean().default(true),
|
||||
mention_name: z.string().default('flynn'),
|
||||
poll_interval_ms: z.number().min(1000).max(60000).default(3000),
|
||||
}).optional();
|
||||
|
||||
const teamsSchema = z.object({
|
||||
app_id: z.string().min(1, 'Teams app_id is required'),
|
||||
app_password: z.string().min(1, 'Teams app_password is required'),
|
||||
@@ -648,6 +657,7 @@ export const configSchema = z.object({
|
||||
whatsapp: whatsappSchema,
|
||||
matrix: matrixSchema,
|
||||
signal: signalSchema,
|
||||
mattermost: mattermostSchema,
|
||||
teams: teamsSchema,
|
||||
google_chat: googleChatSchema,
|
||||
bluebubbles: bluebubblesSchema,
|
||||
@@ -696,6 +706,7 @@ export type SlackConfig = z.infer<typeof slackSchema>;
|
||||
export type WhatsAppConfig = z.infer<typeof whatsappSchema>;
|
||||
export type MatrixConfig = z.infer<typeof matrixSchema>;
|
||||
export type SignalConfig = z.infer<typeof signalSchema>;
|
||||
export type MattermostConfig = z.infer<typeof mattermostSchema>;
|
||||
export type TeamsConfig = z.infer<typeof teamsSchema>;
|
||||
export type GoogleChatConfig = z.infer<typeof googleChatSchema>;
|
||||
export type BlueBubblesConfig = z.infer<typeof bluebubblesSchema>;
|
||||
|
||||
Reference in New Issue
Block a user