lha-core 1.0.2

Minimal agent SDK for LHA with session runtime, tools, skills, and optional MCP adapters.
Documentation
use std::future::Future;
use tokio_util::sync::CancellationToken;

#[derive(Debug, PartialEq, Eq)]
pub(crate) enum CancelErr {
    Cancelled,
}

pub(crate) async fn or_cancel<F>(
    future: F,
    token: &CancellationToken,
) -> Result<F::Output, CancelErr>
where
    F: Future,
{
    tokio::select! {
        _ = token.cancelled() => Err(CancelErr::Cancelled),
        res = future => Ok(res),
    }
}