feat: add automation reactions event-trigger layer
This commit is contained in:
@@ -1082,6 +1082,7 @@ describe('configSchema automation', () => {
|
||||
const result = configSchema.parse(baseConfig);
|
||||
expect(result.automation).toBeDefined();
|
||||
expect(result.automation.delivery_mode).toBe('shared_session');
|
||||
expect(result.automation.reactions).toEqual([]);
|
||||
expect(result.automation.cron).toEqual([]);
|
||||
expect(result.automation.daily_briefing.enabled).toBe(false);
|
||||
expect(result.automation.daily_briefing.schedule).toBe('0 8 * * *');
|
||||
@@ -1129,6 +1130,36 @@ describe('configSchema automation', () => {
|
||||
expect(result.automation.cron[0].enabled).toBe(true); // default
|
||||
});
|
||||
|
||||
it('accepts reactions config with filters', () => {
|
||||
const result = configSchema.parse({
|
||||
...baseConfig,
|
||||
automation: {
|
||||
reactions: [{
|
||||
name: 'boss-email',
|
||||
on: ['gmail'],
|
||||
filter: {
|
||||
contains: 'boss@company.com',
|
||||
regex: 'urgent|asap',
|
||||
metadata: { from: 'boss@company.com' },
|
||||
},
|
||||
run: 'Summarize and propose next actions:\n\n{{text}}',
|
||||
}],
|
||||
},
|
||||
});
|
||||
expect(result.automation.reactions).toHaveLength(1);
|
||||
expect(result.automation.reactions[0]).toMatchObject({
|
||||
name: 'boss-email',
|
||||
enabled: true,
|
||||
on: ['gmail'],
|
||||
run: 'Summarize and propose next actions:\n\n{{text}}',
|
||||
});
|
||||
expect(result.automation.reactions[0].filter).toMatchObject({
|
||||
contains: 'boss@company.com',
|
||||
regex: 'urgent|asap',
|
||||
metadata: { from: 'boss@company.com' },
|
||||
});
|
||||
});
|
||||
|
||||
it('rejects cron job with empty name', () => {
|
||||
expect(() => configSchema.parse({
|
||||
...baseConfig,
|
||||
|
||||
Reference in New Issue
Block a user