//! Task scheduling and background execution for Common Agent Runtime.
//!
//! The scheduler manages persistent task definitions and executes them
//! based on triggers: once, interval, file watch, cron, or manual.
//!
//! ## Usage
//!
//! ```rust,ignore
//! use car_scheduler::{Task, TaskTrigger, TaskStore, Executor, spawn_task};
//! use car_multi::AgentRunner;
//! use std::sync::Arc;
//!
//! // Create a task
//! let task = Task::new("deploy_check", "Check if deployment is healthy")
//!     .with_trigger(TaskTrigger::Interval, "5m")
//!     .with_system_prompt("You are a deployment monitor.");
//!
//! // Persist it
//! let store = TaskStore::new(Path::new("/tmp/tasks"));
//! store.save(&task)?;
//!
//! // Run it in the background
//! let runner: Arc<dyn AgentRunner> = /* your model loop */;
//! let handle = spawn_task(task, runner, None);
//!
//! // Cancel later
//! handle.cancel();
//! ```

pub mod dream;
pub mod executor;
pub mod os_schedule;
pub mod task;

pub use dream::{ensure_dream_task, spawn_dream_loop, DreamConfig, DreamHandle};
pub use executor::{spawn_task, Executor, TaskHandle};
pub use os_schedule::{
    apply_crontab_edit, labels_to_remove, list_installed, reconcile, reconcile_with_tasks,
    schedulable_label, schedulable_labels, uninstall, InstalledSchedule, OsScheduleError,
    OsScheduleSpec, OsTrigger, ReconcileReport, LABEL_PREFIX,
};
pub use task::{parse_interval, Task, TaskExecution, TaskStatus, TaskStore, TaskTrigger};
