capo-agent 0.7.0

Coding-agent library built on motosan-agent-loop. Composable, embeddable.
Documentation
#![allow(clippy::expect_used, clippy::unwrap_used)]

use capo_agent::config::Config;

#[test]
fn from_env_returns_default_model_when_unset() {
    let cfg = Config::from_env_with(|_| None).expect("default config should build");
    assert_eq!(cfg.model.name, "claude-sonnet-4-6");
    assert_eq!(cfg.anthropic.api_key, None);
}

#[test]
fn from_env_picks_up_api_key() {
    let cfg = Config::from_env_with(|name| match name {
        "ANTHROPIC_API_KEY" => Some("sk-test-123".to_string()),
        _ => None,
    })
    .expect("should build");
    assert_eq!(cfg.anthropic.api_key.as_deref(), Some("sk-test-123"));
}

#[test]
fn from_env_model_override() {
    let cfg = Config::from_env_with(|name| match name {
        "CAPO_MODEL_NAME" => Some("claude-opus-4-7".to_string()),
        _ => None,
    })
    .expect("should build");
    assert_eq!(cfg.model.name, "claude-opus-4-7");
}

#[test]
fn from_env_trims_whitespace() {
    let cfg = Config::from_env_with(|name| match name {
        "CAPO_MODEL_MAX_TOKENS" => Some(" 4096 ".to_string()),
        _ => None,
    })
    .expect("should build");
    assert_eq!(cfg.model.max_tokens, 4096);
}