pub struct SkillManager { /* private fields */ }Expand description
Manages progressive disclosure of skills across three levels.
SkillManager wraps a SkillLoader and provides on-demand loading
of skill content. Level 0 (index) is always available; Level 1 (full body)
and Level 2 (reference files) are loaded as needed.
§Example
use talos_skill::{SkillLoader, SkillManager};
let loader = SkillLoader::new();
let mut manager = SkillManager::new(loader);
let index = manager.get_index();Implementations§
Source§impl SkillManager
impl SkillManager
Sourcepub fn new(loader: SkillLoader) -> Self
pub fn new(loader: SkillLoader) -> Self
Creates a new SkillManager wrapping the given SkillLoader.
The loader should already have discovered skills via SkillLoader::discover
before being passed to this constructor.
Sourcepub fn get_index(&mut self) -> &[SkillIndex]
pub fn get_index(&mut self) -> &[SkillIndex]
Returns the Level 0 index of all discovered skills.
The index is computed lazily on first call and cached. Subsequent calls return the cached index unless the underlying loader’s skills have changed.
Sourcepub fn get_index_tokens(&mut self) -> usize
pub fn get_index_tokens(&mut self) -> usize
Returns the total estimated token count for the Level 0 index.
Target: <3000 tokens for 20 skills (~150 tokens per skill).
Sourcepub fn load_skill(&mut self, name: &str) -> Result<&Skill>
pub fn load_skill(&mut self, name: &str) -> Result<&Skill>
Loads a full skill into active memory (Level 1 disclosure).
Searches the loader’s discovered skills by name. If found, clones the skill into the active set. Returns a reference to the loaded skill.
§Errors
Returns SkillError::FileNotFound if no skill with the given name
exists in the loader’s discovered skills.
Sourcepub fn load_reference(
&self,
skill_name: &str,
file_path: &str,
) -> Result<String>
pub fn load_reference( &self, skill_name: &str, file_path: &str, ) -> Result<String>
Loads a specific reference file from a skill (Level 2 disclosure).
Reads the file at file_path relative to the skill’s source directory.
The skill must already be loaded at Level 1 (via [load_skill]).
§Errors
Returns SkillError::FileNotFound if the skill is not loaded or
the reference file does not exist.
Sourcepub fn match_skill(&self, task_description: &str) -> Option<String>
pub fn match_skill(&self, task_description: &str) -> Option<String>
Matches a task description to a skill based on trigger keywords.
Returns the name of the first skill whose triggers match the task description (case-insensitive substring match). If multiple skills match, the first one in discovery order is returned.
Sourcepub fn unload_skill(&mut self, name: &str)
pub fn unload_skill(&mut self, name: &str)
Removes a skill from the active set.
This does not affect the Level 0 index or the loader’s discovered skills.
The skill can be reloaded via [load_skill].
Sourcepub fn get_active_skills(&self) -> Vec<&Skill>
pub fn get_active_skills(&self) -> Vec<&Skill>
Returns references to all currently active skills.