poe2-agent 0.5.0

AI agent for Path of Exile 2 build analysis
Documentation
//! Build reasoning and decomposition logic

use anyhow::Result;

/// A sub-problem in the build generation process
#[derive(Debug, Clone)]
pub struct SubProblem {
    pub category: SubProblemCategory,
    pub description: String,
    pub status: SubProblemStatus,
    pub result: Option<String>,
}

#[derive(Debug, Clone, PartialEq)]
pub enum SubProblemCategory {
    MainSkill,
    SupportGems,
    PassiveTree,
    Gear,
    Defenses,
    ResourceSustain,
}

#[derive(Debug, Clone, PartialEq)]
pub enum SubProblemStatus {
    Pending,
    InProgress,
    NeedsValidation,
    Validated,
    Conflict,
}

/// Intermediate build state that can be inspected
#[derive(Debug)]
pub struct BuildState {
    pub sub_problems: Vec<SubProblem>,
    pub pob_code: Option<String>,
    pub conflicts: Vec<String>,
    pub iteration: u32,
}

impl BuildState {
    pub fn new() -> Self {
        Self {
            sub_problems: Vec::new(),
            pob_code: None,
            conflicts: Vec::new(),
            iteration: 0,
        }
    }

    /// Check if all sub-problems are resolved
    pub fn is_complete(&self) -> bool {
        self.sub_problems
            .iter()
            .all(|sp| sp.status == SubProblemStatus::Validated)
            && self.conflicts.is_empty()
    }
}

/// Generate a build from a prompt
pub async fn generate_build(_prompt: &str, _step_through: bool) -> Result<BuildState> {
    // TODO: Implement reasoning loop
    // 1. Use LLM to decompose prompt into sub-problems
    // 2. For each sub-problem, generate candidates
    // 3. Validate combinations with PoB
    // 4. Resolve conflicts
    // 5. If step_through, pause for user input at each iteration

    Ok(BuildState::new())
}