diff --git a/Cargo.toml b/Cargo.toml index 29955fd5c..f2e90ead5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ features = ["database"] [features] # ===== DEFAULT FEATURE SET ===== -default = ["console", "chat", "automation", "tasks", "drive", "llm", "redis-cache", "progress-bars", "directory"] +default = ["console", "chat", "automation", "tasks", "drive", "llm", "cache", "progress-bars", "directory"] # ===== UI FEATURES ===== console = ["dep:crossterm", "dep:ratatui", "monitoring"] @@ -76,7 +76,7 @@ weba = [] timeseries = [] # ===== OPTIONAL INFRASTRUCTURE ===== -redis-cache = ["dep:redis"] +cache = ["dep:redis"] monitoring = ["dep:sysinfo"] automation = ["dep:rhai"] grpc = ["dep:tonic"] @@ -89,11 +89,11 @@ full = [ "email", "whatsapp", "instagram", "msteams", "chat", "drive", "tasks", "calendar", "meet", "mail", "compliance", "attendance", "directory", "weba", - "redis-cache", "monitoring", "automation", "grpc", "progress-bars" + "cache", "monitoring", "automation", "grpc", "progress-bars" ] -communications = ["email", "whatsapp", "instagram", "msteams", "chat", "redis-cache"] -productivity = ["chat", "drive", "tasks", "calendar", "meet", "mail", "redis-cache"] +communications = ["email", "whatsapp", "instagram", "msteams", "chat", "cache"] +productivity = ["chat", "drive", "tasks", "calendar", "meet", "mail", "cache"] enterprise = ["compliance", "attendance", "directory", "llm", "vectordb", "monitoring", "timeseries"] minimal = ["chat"] lightweight = ["chat", "drive", "tasks"] @@ -204,7 +204,7 @@ rust_xlsxwriter = "0.79" # Error handling thiserror = "2.0" -# Caching/Sessions (redis-cache feature) +# Caching/Sessions (cache feature) redis = { version = "0.27", features = ["tokio-comp"], optional = true } # System Monitoring (monitoring feature) diff --git a/src/attendance/drive.rs b/src/attendance/drive.rs index 4bed9b3f8..24dc8b478 100644 --- a/src/attendance/drive.rs +++ b/src/attendance/drive.rs @@ -4,6 +4,7 @@ use anyhow::{anyhow, Result}; use aws_sdk_s3::primitives::ByteStream; use aws_sdk_s3::Client; +use chrono::TimeZone; use serde::{Deserialize, Serialize}; use std::path::PathBuf; use tokio::fs; diff --git a/src/attendance/mod.rs b/src/attendance/mod.rs index bd48107d3..47526166b 100644 --- a/src/attendance/mod.rs +++ b/src/attendance/mod.rs @@ -1,12 +1,69 @@ -//! REST API Module +//! Attendance Module //! -//! Provides HTTP endpoints for cloud-based functionality. -//! Supports web, desktop, and mobile clients. +//! Provides attendance tracking and human handoff queue functionality. //! -//! Note: Local operations require native access and are handled separately: -//! - Screen capture: Tauri commands (desktop) or WebRTC (web/mobile) -//! - File sync: Tauri commands with local rclone process (desktop only) +//! ## Features +//! +//! - **Queue System**: Human handoff for conversations that need human attention +//! - **Keyword Services**: Check-in/out, break/resume tracking via keywords +//! - **Drive Integration**: S3 storage for attendance records +//! +//! ## Usage +//! +//! Enable with the `attendance` feature flag in Cargo.toml: +//! ```toml +//! [features] +//! default = ["attendance"] +//! ``` -// pub mod drive; -// pub mod keyword_services; +pub mod drive; +pub mod keyword_services; pub mod queue; + +// Re-export main types for convenience +pub use drive::{AttendanceDriveConfig, AttendanceDriveService, RecordMetadata, SyncResult}; +pub use keyword_services::{ + AttendanceCommand, AttendanceRecord, AttendanceResponse, AttendanceService, KeywordConfig, + KeywordParser, ParsedCommand, +}; +pub use queue::{ + AssignRequest, AttendantStats, AttendantStatus, QueueFilters, QueueItem, QueueStatus, + TransferRequest, +}; + +use crate::shared::state::AppState; +use axum::{ + routing::{get, post}, + Router, +}; +use std::sync::Arc; + +/// Configure attendance routes +pub fn configure_attendance_routes() -> Router> { + Router::new() + // Queue management endpoints + .route("/api/attendance/queue", get(queue::list_queue)) + .route("/api/attendance/attendants", get(queue::list_attendants)) + .route("/api/attendance/assign", post(queue::assign_conversation)) + .route( + "/api/attendance/transfer", + post(queue::transfer_conversation), + ) + .route( + "/api/attendance/resolve/:session_id", + post(queue::resolve_conversation), + ) + .route("/api/attendance/insights", get(queue::get_insights)) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_module_exports() { + // Test that types are properly exported + let _config = KeywordConfig::default(); + let _parser = KeywordParser::new(); + } +} diff --git a/src/core/shared/state.rs b/src/core/shared/state.rs index f45a70d42..7320cd499 100644 --- a/src/core/shared/state.rs +++ b/src/core/shared/state.rs @@ -12,7 +12,7 @@ use crate::shared::utils::DbPool; use crate::tasks::{TaskEngine, TaskScheduler}; #[cfg(feature = "drive")] use aws_sdk_s3::Client as S3Client; -#[cfg(feature = "redis-cache")] +#[cfg(feature = "cache")] use redis::Client as RedisClient; use std::any::{Any, TypeId}; use std::collections::HashMap; @@ -85,7 +85,7 @@ pub struct AppState { #[cfg(feature = "drive")] pub drive: Option, pub s3_client: Option, - #[cfg(feature = "redis-cache")] + #[cfg(feature = "cache")] pub cache: Option>, pub bucket_name: String, pub config: Option, @@ -117,7 +117,7 @@ impl Clone for AppState { config: self.config.clone(), conn: self.conn.clone(), database_url: self.database_url.clone(), - #[cfg(feature = "redis-cache")] + #[cfg(feature = "cache")] cache: self.cache.clone(), session_manager: Arc::clone(&self.session_manager), metrics_collector: self.metrics_collector.clone(), @@ -146,7 +146,7 @@ impl std::fmt::Debug for AppState { debug.field("s3_client", &self.s3_client.is_some()); - #[cfg(feature = "redis-cache")] + #[cfg(feature = "cache")] debug.field("cache", &self.cache.is_some()); debug