use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use super::agent::AgentType; use super::message::{MessageTurn, TurnUsage}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConversationSummary { pub id: String, pub agent_type: AgentType, pub folder_path: Option, pub folder_name: Option, pub title: Option, pub started_at: DateTime, pub ended_at: Option>, pub message_count: u32, pub model: Option, pub git_branch: Option, } #[derive(Debug, Clone, Serialize)] pub struct DbConversationSummary { pub id: i32, pub folder_id: i32, pub title: Option, pub agent_type: AgentType, pub status: String, pub model: Option, pub git_branch: Option, pub external_id: Option, pub message_count: u32, pub created_at: DateTime, pub updated_at: DateTime, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SessionStats { pub total_usage: Option, #[serde(skip_serializing_if = "Option::is_none")] pub total_tokens: Option, pub total_duration_ms: u64, #[serde(skip_serializing_if = "Option::is_none")] pub context_window_used_tokens: Option, #[serde(skip_serializing_if = "Option::is_none")] pub context_window_max_tokens: Option, #[serde(skip_serializing_if = "Option::is_none")] pub context_window_usage_percent: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConversationDetail { pub summary: ConversationSummary, pub turns: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub session_stats: Option, } #[derive(Debug, Clone, Serialize)] pub struct DbConversationDetail { pub summary: DbConversationSummary, pub turns: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub session_stats: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct FolderInfo { pub path: String, pub name: String, pub agent_types: Vec, pub conversation_count: u32, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AgentStats { pub total_conversations: u32, pub total_messages: u32, pub by_agent: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AgentConversationCount { pub agent_type: AgentType, pub conversation_count: u32, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SidebarData { pub folders: Vec, pub stats: AgentStats, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ImportResult { pub imported: u32, pub skipped: u32, }