feat(#29,#115,#116): Implement cron job configuration #117

Closed
jason.woltje wants to merge 0 commits from feature/29-cron-config into develop
Owner

Implements cron job scheduling for Mosaic Stack with REST API, scheduler worker, and WebSocket notifications.

Features

CronSchedule Model

  • Workspace-scoped cron schedules
  • Standard cron expression support (e.g., 0 9 * * * for 9am daily)
  • Enable/disable schedules
  • Tracks lastRun/nextRun timing

REST API Endpoints

Method Endpoint Description
POST /api/cron Create schedule
GET /api/cron List schedules
GET /api/cron/:id Get schedule
PATCH /api/cron/:id Update schedule
DELETE /api/cron/:id Delete schedule

Scheduler Worker

  • Polls CronSchedule table every 60 seconds
  • Executes commands when schedules fire
  • Updates lastRun/nextRun after execution
  • Manual trigger support for testing

WebSocket Notifications

  • cron:executed event emitted to workspace room
  • Payload: { scheduleId, command, executedAt }
  • Follows existing event pattern (task:created, etc.)

MoltBot Plugin

  • plugins/mosaic-plugin-cron/SKILL.md
  • Triggers: "schedule a reminder", "list my schedules", etc.

Issues Addressed

  • #29: Cron job configuration (p1 plugin)
  • #115: Cron scheduler worker
  • #116: Cron WebSocket notifications

Tests

  • 18 passing tests
  • cron.service.spec.ts: 9 tests
  • cron.scheduler.spec.ts: 9 tests
Implements cron job scheduling for Mosaic Stack with REST API, scheduler worker, and WebSocket notifications. ## Features ### CronSchedule Model - Workspace-scoped cron schedules - Standard cron expression support (e.g., `0 9 * * *` for 9am daily) - Enable/disable schedules - Tracks lastRun/nextRun timing ### REST API Endpoints | Method | Endpoint | Description | |--------|----------|-------------| | POST | /api/cron | Create schedule | | GET | /api/cron | List schedules | | GET | /api/cron/:id | Get schedule | | PATCH | /api/cron/:id | Update schedule | | DELETE | /api/cron/:id | Delete schedule | ### Scheduler Worker - Polls CronSchedule table every 60 seconds - Executes commands when schedules fire - Updates lastRun/nextRun after execution - Manual trigger support for testing ### WebSocket Notifications - cron:executed event emitted to workspace room - Payload: { scheduleId, command, executedAt } - Follows existing event pattern (task:created, etc.) ### MoltBot Plugin - plugins/mosaic-plugin-cron/SKILL.md - Triggers: "schedule a reminder", "list my schedules", etc. ## Issues Addressed - #29: Cron job configuration (p1 plugin) - #115: Cron scheduler worker - #116: Cron WebSocket notifications ## Tests - 18 passing tests - cron.service.spec.ts: 9 tests - cron.scheduler.spec.ts: 9 tests
jason.woltje closed this pull request 2026-01-30 05:11:26 +00:00

Pull request closed

Sign in to join this conversation.