//! # car-reason
//!
//! CAR-native code reasoning engine. Adaptive, graph-driven, learning.
//!
//! Instead of a hardcoded pipeline, reasoning actions are **skills in the memgine
//! graph**. The graph's spreading activation and success/failure tracking determine
//! which actions to run, in what order, routed to which models.
//!
//! ## Usage
//!
//! ```rust,no_run
//! use std::sync::{Arc, Mutex};
//! use car_reason::ReasoningSession;
//!
//! # async fn example() {
//! let inference = Arc::new(car_inference::InferenceEngine::new(Default::default()));
//! let mut memgine = car_memgine::MemgineEngine::new(None);
//!
//! // Seed default reasoning skills
//! car_reason::skills::seed_defaults(&mut memgine);
//!
//! let memgine = Arc::new(Mutex::new(memgine));
//! let session = ReasoningSession::new(memgine, inference);
//! let result = session.reason("fix the off-by-one error in parse_header").await.unwrap();
//!
//! println!("Diagnosis: {}", result.diagnosis);
//! for s in &result.suggestions {
//!     println!("Fix: {}", s.suggested);
//! }
//! println!("Explanation: {}", result.explanation);
//! # }
//! ```

pub mod classifier;
pub mod executor;
pub mod handle;
pub mod selector;
pub mod session;
pub mod skills;
pub mod types;
pub mod verifier;

pub use handle::{ReasoningInferenceHandle, SharedReasoningHandle};
pub use session::{ReasoningEvent, ReasoningSession};
pub use types::*;

use thiserror::Error;

#[derive(Error, Debug)]
pub enum ReasonError {
    #[error("classification failed: {0}")]
    ClassificationFailed(String),

    #[error("inference failed: {0}")]
    InferenceFailed(String),

    #[error("no actions selected for problem class")]
    NoActions,

    #[error("session error: {0}")]
    SessionError(String),
}
