#[derive(Debug, Clone)]
pub struct SessionRestoreResult {
pub session_id: String,
pub message_count: usize,
pub success: bool,
pub error: Option<String>,
}
pub fn restore_session(session_id: &str) -> SessionRestoreResult {
if !super::session_storage::session_exists(session_id) {
return SessionRestoreResult {
session_id: session_id.to_string(),
message_count: 0,
success: false,
error: Some("Session not found".to_string()),
};
}
let messages = super::session_storage::load_transcript(session_id);
SessionRestoreResult {
session_id: session_id.to_string(),
message_count: messages.len(),
success: true,
error: None,
}
}
pub fn can_restore_session(session_id: &str) -> bool {
let path = super::session_storage::get_transcript_path(session_id);
path.exists()
}