haematite-cli 0.21.5

The haematite command: serve a store, its door and Studio, answer MCP, query with jq, and host the store's assistant seat
Documentation
use tokio::io::BufReader;
#[path = "input_protocol.rs"]
mod protocol;

pub(super) async fn eof(bound: usize) -> anyhow::Result<()> {
    let input = protocol::FileIo::open("/dev/stdin", false)?;
    let output = protocol::FileIo::open("/dev/stdout", true)?;
    let session = match std::env::var("LYS_SESSION") {
        Ok(session) if !session.is_empty() && session.len() <= 128 => session,
        Err(std::env::VarError::NotPresent) => super::permission::operation()?,
        Ok(_) | Err(std::env::VarError::NotUnicode(_)) => {
            anyhow::bail!("lys_session_identity_invalid")
        }
    };
    protocol::serve(BufReader::new(input), output, bound, session).await
}
fn read_once(file: &impl std::os::fd::AsFd, buffer: &mut [u8]) -> std::io::Result<usize> {
    rustix::io::read(file, buffer).map_err(std::io::Error::from)
}
#[cfg(test)]
#[path = "input_tests.rs"]
mod tests;