Something went wrong. Try again.
Personal fork of prime agent. Mirror of: https://mnemosyne.sigilzero.dev/sigilzero/prime-agent
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829//! Shared source resolution for settings-declared plugins. The session host and//! the session-free fact pass read the same explicit path; there is no ambient//! discovery and relative paths resolve against the agent directory.
use std::path::{Path, PathBuf};
use super::PluginError;
/// Read one explicitly declared plugin chunk. Returns the resolved path so a/// caller can key caches by the actual file and report failures precisely.pub(crate) fn read( name: &str, path: &Path, agent_dir: &Path,) -> Result<(PathBuf, String), PluginError> { let resolved = if path.is_absolute() { path.to_path_buf() } else { agent_dir.join(path) }; let source = std::fs::read_to_string(&resolved).map_err(|error| { PluginError::Invalid(format!( "plugin {name}: read {}: {error}", resolved.display() )) })?; Ok((resolved, source))}