feat(automation): add daily briefing preset and cron backup scheduling
This commit is contained in:
@@ -60,6 +60,7 @@ describe('discoverServices', () => {
|
||||
expect.objectContaining({ name: 'feishu', status: 'not_configured' }),
|
||||
expect.objectContaining({ name: 'zalo', status: 'not_configured' }),
|
||||
expect.objectContaining({ name: 'cron', status: 'not_configured' }),
|
||||
expect.objectContaining({ name: 'daily_briefing', status: 'not_configured' }),
|
||||
expect.objectContaining({ name: 'mcp', status: 'not_configured' }),
|
||||
expect.objectContaining({ name: 'web_search', status: 'configured' }),
|
||||
expect.objectContaining({ name: 'audio_transcription', status: 'not_configured' }),
|
||||
@@ -99,13 +100,18 @@ describe('discoverServices', () => {
|
||||
cfg.automation.cron = [
|
||||
{ name: 'job', schedule: '0 0 * * *', message: 'hi', output: { channel: 'webchat', peer: 'x' }, enabled: true },
|
||||
] as CronJobConfig[];
|
||||
(cfg.automation as Record<string, unknown>).daily_briefing = {
|
||||
enabled: true,
|
||||
output: { channel: 'webchat', peer: 'x' },
|
||||
};
|
||||
cfg.mcp.servers = [{ name: 'srv', command: 'x', args: [] }];
|
||||
|
||||
const reg = new ChannelRegistry();
|
||||
const services = discoverServices(cfg, reg);
|
||||
|
||||
expect(services.find(s => s.name === 'cron')?.status).toBe('configured');
|
||||
expect(services.find(s => s.name === 'cron')?.itemCount).toBe(1);
|
||||
expect(services.find(s => s.name === 'cron')?.itemCount).toBe(2);
|
||||
expect(services.find(s => s.name === 'daily_briefing')?.status).toBe('configured');
|
||||
expect(services.find(s => s.name === 'mcp')?.metadata).toEqual({ serverCount: 1 });
|
||||
});
|
||||
|
||||
|
||||
@@ -122,9 +122,11 @@ export function discoverServices(
|
||||
});
|
||||
|
||||
const automation = config.automation;
|
||||
const dailyBriefingEnabled = Boolean(automation.daily_briefing?.enabled && automation.daily_briefing.output);
|
||||
const totalCronJobs = automation.cron.length + (dailyBriefingEnabled ? 1 : 0);
|
||||
|
||||
const automationConfigs: Array<{ enabled: boolean; name: string; description: string; itemCount?: number }> = [
|
||||
{ enabled: automation.cron.length > 0, name: 'cron', description: 'Cron scheduler', itemCount: automation.cron.length },
|
||||
{ enabled: totalCronJobs > 0, name: 'cron', description: 'Cron scheduler', itemCount: totalCronJobs },
|
||||
{ enabled: automation.webhooks.length > 0, name: 'webhooks', description: 'Webhook handler', itemCount: automation.webhooks.length },
|
||||
{ enabled: automation.gmail?.enabled ?? false, name: 'gmail', description: 'Gmail watcher' },
|
||||
{ enabled: automation.heartbeat?.enabled ?? false, name: 'heartbeat', description: 'Heartbeat monitor' },
|
||||
@@ -132,6 +134,7 @@ export function discoverServices(
|
||||
{ enabled: automation.gdocs?.enabled ?? false, name: 'gdocs', description: 'Google Docs' },
|
||||
{ enabled: automation.gdrive?.enabled ?? false, name: 'gdrive', description: 'Google Drive' },
|
||||
{ enabled: automation.gtasks?.enabled ?? false, name: 'gtasks', description: 'Google Tasks' },
|
||||
{ enabled: automation.daily_briefing?.enabled ?? false, name: 'daily_briefing', description: 'Daily briefing automation' },
|
||||
];
|
||||
|
||||
for (const auto of automationConfigs) {
|
||||
|
||||
Reference in New Issue
Block a user