feat(channels): add signal-cli channel adapter
This commit is contained in:
@@ -319,6 +319,37 @@ describe('configSchema — matrix', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — signal', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
models: { default: { provider: 'anthropic', model: 'claude-3' } },
|
||||
};
|
||||
|
||||
it('accepts signal config and defaults polling fields', () => {
|
||||
const result = configSchema.parse({
|
||||
...minimalConfig,
|
||||
signal: {
|
||||
account: '+15551234567',
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.signal).toBeDefined();
|
||||
if (!result.signal) {
|
||||
throw new Error('Expected signal config');
|
||||
}
|
||||
expect(result.signal.account).toBe('+15551234567');
|
||||
expect(result.signal.signal_cli_path).toBe('signal-cli');
|
||||
expect(result.signal.poll_interval_ms).toBe(5000);
|
||||
expect(result.signal.send_timeout_ms).toBe(15000);
|
||||
expect(result.signal.require_mention).toBe(true);
|
||||
});
|
||||
|
||||
it('signal config is optional', () => {
|
||||
const result = configSchema.parse(minimalConfig);
|
||||
expect(result.signal).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — whatsapp', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
|
||||
@@ -400,6 +400,17 @@ const matrixSchema = z.object({
|
||||
display_name: z.string().optional(),
|
||||
}).optional();
|
||||
|
||||
const signalSchema = z.object({
|
||||
account: z.string().min(1, 'Signal account is required'),
|
||||
signal_cli_path: z.string().default('signal-cli'),
|
||||
allowed_numbers: z.array(z.string()).default([]),
|
||||
allowed_group_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(5000),
|
||||
send_timeout_ms: z.number().min(1000).max(60000).default(15000),
|
||||
}).optional();
|
||||
|
||||
const browserSchema = z.object({
|
||||
enabled: z.boolean().default(false),
|
||||
executable_path: z.string().optional(),
|
||||
@@ -566,6 +577,7 @@ export const configSchema = z.object({
|
||||
slack: slackSchema,
|
||||
whatsapp: whatsappSchema,
|
||||
matrix: matrixSchema,
|
||||
signal: signalSchema,
|
||||
server: serverSchema.default({}),
|
||||
models: modelsSchema,
|
||||
backends: backendsSchema.default({}),
|
||||
@@ -610,6 +622,7 @@ export type DiscordConfig = z.infer<typeof discordSchema>;
|
||||
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 RetryPolicyConfig = z.infer<typeof retrySchema>;
|
||||
export type ContextLevel = z.infer<typeof contextLevelSchema>;
|
||||
export type PromptConfig = z.infer<typeof promptSchema>;
|
||||
|
||||
Reference in New Issue
Block a user