//! Smoke tests for the OpsRuntime builder pass-through.
//!
//! Confirms: a wrapped agent behaves identically to the inner agent when
//! no primitives are configured beyond the mandatory cross-cutting.

use async_trait::async_trait;
use klieo_core::{Agent, AgentContext, ToolDef};
use klieo_ops::{OpsRuntime, TenantResolver};
use std::sync::Arc;

struct EchoAgent;

#[async_trait]
impl Agent for EchoAgent {
    type Input = String;
    type Output = String;
    type Error = std::io::Error;

    fn name(&self) -> &str {
        "echo"
    }
    fn system_prompt(&self) -> &str {
        ""
    }
    fn tools(&self) -> &[ToolDef] {
        &[]
    }

    async fn run(
        &self,
        _ctx: AgentContext,
        input: Self::Input,
    ) -> Result<Self::Output, Self::Error> {
        Ok(input)
    }
}

struct NoTenantResolver;

#[async_trait]
impl TenantResolver for NoTenantResolver {
    async fn resolve(&self) -> Option<klieo_ops::TenantId> {
        None
    }
}

#[tokio::test]
async fn builder_wraps_agent_pass_through() {
    let agent = EchoAgent;
    let wrapped = OpsRuntime::builder()
        .tenant_resolver(Arc::new(NoTenantResolver))
        .spawn(agent)
        .expect("builder must succeed with minimal config");
    assert_eq!(wrapped.name(), "echo");
}
