pub struct SkillSubsystem { /* private fields */ }Expand description
High-level facade for wiring skills into an agent.
Callers should prefer this over manually instantiating the tools/plugins so:
- tool ids stay consistent
- plugin ordering is stable (discovery first, runtime second)
§Example
ⓘ
use tirea::extensions::skills::{
FsSkill, InMemorySkillRegistry, SkillSubsystem,
};
use std::sync::Arc;
// 1) Discover skills and build a registry.
let result = FsSkill::discover("skills").unwrap();
let registry = Arc::new(
InMemorySkillRegistry::from_skills(FsSkill::into_arc_skills(result.skills)),
);
// 2) Wire into subsystem.
let skills = SkillSubsystem::new(registry);
// 3) Register tools (skill activation + reference/script utilities).
let mut tools = std::collections::HashMap::new();
skills.extend_tools(&mut tools).unwrap();
// 4) Register the discovery plugin: injects skills catalog before inference.
let config = BaseAgent::new("gpt-4o-mini").with_plugin(Arc::new(skills.discovery_plugin()));Implementations§
Source§impl SkillSubsystem
impl SkillSubsystem
pub fn new(registry: Arc<dyn SkillRegistry>) -> SkillSubsystem
pub fn registry(&self) -> &Arc<dyn SkillRegistry>
Sourcepub fn discovery_plugin(&self) -> SkillDiscoveryPlugin
pub fn discovery_plugin(&self) -> SkillDiscoveryPlugin
Build the discovery plugin (injects skills catalog before inference).
Sourcepub fn tools(&self) -> HashMap<String, Arc<dyn Tool>>
pub fn tools(&self) -> HashMap<String, Arc<dyn Tool>>
Construct the skills tools map.
Tool ids:
SKILL_ACTIVATE_TOOL_IDSKILL_LOAD_RESOURCE_TOOL_IDSKILL_SCRIPT_TOOL_ID
Sourcepub fn extend_tools(
&self,
tools: &mut HashMap<String, Arc<dyn Tool>>,
) -> Result<(), SkillSubsystemError>
pub fn extend_tools( &self, tools: &mut HashMap<String, Arc<dyn Tool>>, ) -> Result<(), SkillSubsystemError>
Add skills tools to an existing tool map.
Returns an error if any tool id is already present.
Trait Implementations§
Source§impl Clone for SkillSubsystem
impl Clone for SkillSubsystem
Source§fn clone(&self) -> SkillSubsystem
fn clone(&self) -> SkillSubsystem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SkillSubsystem
impl !RefUnwindSafe for SkillSubsystem
impl Send for SkillSubsystem
impl Sync for SkillSubsystem
impl Unpin for SkillSubsystem
impl !UnwindSafe for SkillSubsystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more