ai-agent 0.13.4

Idiomatic agent sdk inspired by the claude code source leak
Documentation
//! Session restore utilities.

/// Result of session restore operation
#[derive(Debug, Clone)]
pub struct SessionRestoreResult {
    pub session_id: String,
    pub message_count: usize,
    pub success: bool,
    pub error: Option<String>,
}

/// Attempt to restore a session from storage
pub fn restore_session(session_id: &str) -> SessionRestoreResult {
    // TODO: Implement actual restoration from storage
    // For now, return a placeholder

    // Check if session exists
    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()),
        };
    }

    // Load transcript
    let messages = super::session_storage::load_transcript(session_id);

    SessionRestoreResult {
        session_id: session_id.to_string(),
        message_count: messages.len(),
        success: true,
        error: None,
    }
}

/// Check if a session can be restored
pub fn can_restore_session(session_id: &str) -> bool {
    // Check if session data exists
    let path = super::session_storage::get_transcript_path(session_id);
    path.exists()
}