Skip to main content

SkillManager

Struct SkillManager 

Source
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

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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].

Source

pub fn get_active_skills(&self) -> Vec<&Skill>

Returns references to all currently active skills.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.