klieo-ops 0.2.0

Operational layer above klieo-core: supervisor, governor, gates, escalation, worklog, handoff.
Documentation
//! Helper for governed outbound HTTP from tools.

use super::trait_::Governor;
use crate::error::OpsError;
use reqwest::Client;
use std::sync::Arc;

/// Build a `reqwest::Client` for use by tools.
///
/// **WARNING — Phase A no-op**: egress is NOT governed. The `governor` and
/// `hosts` parameters reserve the API shape so Phase B can wire
/// `reqwest-middleware`-based per-request egress permits without breaking
/// tool authors. Tools that need governing TODAY must call
/// `governor.acquire_egress(host).await?` manually at the top of `invoke()`.
///
/// Will be wired with reqwest-middleware in Phase B.
#[allow(clippy::result_large_err)]
#[deprecated(
    since = "0.2.0",
    note = "Phase A only — egress is NOT governed. Call governor.acquire_egress(host) manually \
            in your tool's invoke(). Will be wired with reqwest-middleware in Phase B."
)]
pub fn governed_client(governor: Arc<dyn Governor>, hosts: &[&str]) -> Result<Client, OpsError> {
    _phase_a_vanilla_client(governor, hosts)
}

/// Internal Phase-A constructor used within this crate.
///
/// Returns a plain `reqwest::Client` without any egress governing.
/// Call sites must call `governor.acquire_egress(host).await?` separately.
pub(crate) fn _phase_a_vanilla_client(
    _governor: Arc<dyn Governor>,
    _hosts: &[&str],
) -> Result<Client, OpsError> {
    Client::builder()
        .build()
        .map_err(|_| OpsError::Unavailable {
            component: "reqwest_client".into(),
        })
}