mesh-llm-native-runtime 0.75.0

Native runtime manifest, selection, and cache policy for Mesh LLM
Documentation
use crate::InstalledNativeRuntime;
use anyhow::{Result, bail};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct NativeRuntimeLoadPlan {
    pub mesh_version: String,
    pub native_runtime_id: String,
    pub root: PathBuf,
    pub libraries: Vec<PathBuf>,
}

impl InstalledNativeRuntime {
    pub fn load_plan(&self) -> Result<NativeRuntimeLoadPlan> {
        let libraries = self
            .manifest
            .runtime
            .libraries
            .iter()
            .map(|path| self.path.join(path))
            .collect::<Vec<_>>();
        if libraries.is_empty() {
            bail!(
                "native runtime {} does not declare loadable libraries",
                self.native_runtime_id
            );
        }
        for library in &libraries {
            if !library.is_file() {
                bail!("native runtime library is missing: {}", library.display());
            }
        }
        Ok(NativeRuntimeLoadPlan {
            mesh_version: self.mesh_version.clone(),
            native_runtime_id: self.native_runtime_id.clone(),
            root: self.path.clone(),
            libraries,
        })
    }
}