collet 0.1.0

Relentless agentic coding orchestrator with zero-drop agent loops
Documentation
//! Core data types for the evolution system.
//!
//! Direct Rust port of A-Evolve's `types.py`.  All types derive
//! `Serialize`/`Deserialize` for JSONL persistence.

use std::collections::HashMap;

use serde::{Deserialize, Serialize};

/// A single evaluation task from a benchmark.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Task {
    pub id: String,
    pub input: String,
    #[serde(default)]
    pub metadata: HashMap<String, serde_json::Value>,
}

/// The agent's execution trace for a single task.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Trajectory {
    pub task_id: String,
    pub output: String,
    #[serde(default)]
    pub steps: Vec<serde_json::Value>,
    #[serde(default)]
    pub conversation: Vec<serde_json::Value>,
}

/// Benchmark evaluation result for a trajectory.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Feedback {
    pub success: bool,
    /// Score in `0.0..=1.0`.
    pub score: f64,
    /// Rich diagnostic text for the evolver.
    pub detail: String,
    #[serde(default)]
    pub raw: HashMap<String, serde_json::Value>,
}

/// A bundled (task, trajectory, feedback) triple collected by the observer.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Observation {
    pub task: Task,
    pub trajectory: Trajectory,
    pub feedback: Feedback,
}

/// Lightweight metadata for a skill (loaded from SKILL.md frontmatter).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EvoSkillMeta {
    pub name: String,
    pub description: String,
    /// Relative path within the workspace.
    pub path: String,
}

/// Return type for [`EvolutionEngine::step`].
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StepResult {
    pub mutated: bool,
    pub summary: String,
    #[serde(default)]
    pub metadata: HashMap<String, serde_json::Value>,
}

/// Record of a single evolution cycle.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CycleRecord {
    pub cycle: u32,
    pub score: f64,
    pub mutated: bool,
    #[serde(default)]
    pub engine_name: String,
    #[serde(default)]
    pub summary: String,
    #[serde(default)]
    pub observation_batch: String,
    #[serde(default)]
    pub metadata: HashMap<String, serde_json::Value>,
}

/// Summary returned after an evolution run completes.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct EvolutionResult {
    pub cycles_completed: u32,
    pub final_score: f64,
    #[serde(default)]
    pub score_history: Vec<f64>,
    #[serde(default)]
    pub converged: bool,
    #[serde(default)]
    pub details: HashMap<String, serde_json::Value>,
}