feat: implement agent scheduled execution with cron and time picker
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m9s

- Add scheduledTime, scheduledDay, timezone fields to Agent schema
- Create calculateNextRun() helper with timezone-aware scheduling
- Add POST /api/cron/agents endpoint for external scheduler
- Calculate nextRun on agent create, update, and after execution
- Add time/day picker in agent form (daily/weekly/monthly)
- Show "Next run" countdown in agent card
- Add i18n keys for schedule UI (FR + EN)

External scheduler (N8N, Vercel Cron) should call /api/cron/agents
every 5-15 min. Requires `prisma db push` to apply schema changes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 10:45:48 +02:00
parent dc18dc3de4
commit 73de1cd26d
10 changed files with 439 additions and 1 deletions

View File

@@ -1250,6 +1250,21 @@
"weekly": "Hebdomadaire",
"monthly": "Mensuel"
},
"schedule": {
"nextRun": "Prochaine exécution",
"time": "Heure",
"dayOfWeek": "Jour de la semaine",
"dayOfMonth": "Jour du mois",
"days": {
"mon": "Lundi",
"tue": "Mardi",
"wed": "Mercredi",
"thu": "Jeudi",
"fri": "Vendredi",
"sat": "Samedi",
"sun": "Dimanche"
}
},
"status": {
"success": "Réussi",
"failure": "Échoué",