//! Agent task service — unified task/sub-agent execution framework.
//!
//! A task (`agent_task` record) can be:
//! - A **root task**: initiated by a user or system event.
//!   The parent/Supervisor agent spawns sub-tasks and coordinates their results.
//! - A **sub-task**: a unit of work executed by a sub-agent.
//!
//! Execution flow:
//! 1. Create task record (status = pending)
//! 2. Notify listeners (WebSocket: task_started)
//! 3. Spawn execution (tokio::spawn or via room queue)
//! 4. Update progress (status = running, progress = "step 2/5: ...")
//! 5. On completion: update output + status = done / error + status = failed
//! 6. Notify listeners (WebSocket: task_done)
//! 7. If root task: notify parent/Supervisor to aggregate results
//!
//! This module is intentionally kept simple and synchronous with the DB.
//! Long-running execution is delegated to the caller (tokio::spawn).

pub mod service;

pub use service::TaskService;
