zeph-scheduler 0.12.0

Cron-based periodic task scheduler with SQLite persistence for Zeph
Documentation

zeph-scheduler

Crates.io docs.rs License: MIT MSRV

Cron-based periodic task scheduler with SQLite persistence for Zeph.

Overview

Runs recurring tasks on cron schedules, persisting job state and last-run timestamps in SQLite. Ships with built-in tasks for memory cleanup, skill refresh, health checks, and automatic update detection. Feature-gated behind scheduler.

Key Modules

  • schedulerScheduler event loop managing job evaluation and dispatch
  • storeJobStore for SQLite-backed job persistence
  • taskScheduledTask, TaskHandler, TaskKind defining task types and execution
  • update_checkUpdateCheckHandler for GitHub releases version check
  • errorSchedulerError error types

Built-in Tasks

Kind String key Description
TaskKind::MemoryCleanup memory_cleanup Prune expired memory entries
TaskKind::SkillRefresh skill_refresh Hot-reload changed skill files
TaskKind::HealthCheck health_check Periodic self-diagnostics
TaskKind::UpdateCheck update_check Check GitHub releases for a newer version

UpdateCheckHandler

UpdateCheckHandler implements TaskHandler and queries the GitHub releases API to compare the running version against the latest published release. When a newer version is detected it sends a human-readable notification over an mpsc::Sender<String> channel.

use tokio::sync::mpsc;
use zeph_scheduler::{ScheduledTask, Scheduler, TaskKind, UpdateCheckHandler};

let (tx, rx) = mpsc::channel(4);
let handler = UpdateCheckHandler::new(env!("CARGO_PKG_VERSION"), tx);

let task = ScheduledTask::new(
    "update_check",
    "0 0 9 * * *",   // daily at 09:00
    TaskKind::UpdateCheck,
    serde_json::Value::Null,
)?;
scheduler.add_task(task);
scheduler.register_handler(&TaskKind::UpdateCheck, Box::new(handler));

Notification format sent via the channel:

New version available: v0.13.0 (current: v0.12.0).
Update: https://github.com/bug-ops/zeph/releases/tag/v0.12.0

Behaviour on error (network failure, non-2xx response, oversized body, parse error, invalid semver) — logs a warn message and returns Ok(()). The check is best-effort and never crashes the agent.

Installation

cargo add zeph-scheduler

Enabled via the scheduler feature flag on the root zeph crate.

License

MIT