pub struct SkillRegistry { /* private fields */ }Expand description
Central skill lifecycle manager.
Tracks both code-based skills (registered via Skill trait)
and file-based skills (discovered from SKILL.md files). Provides:
- Catalog generation for system-prompt injection (Tier 1)
- Activation tracking with deduplication (Tier 2)
- Resource access from activated skill directories (Tier 3)
Implementations§
Source§impl SkillRegistry
impl SkillRegistry
pub fn new() -> SkillRegistry
Sourcepub fn register_descriptor(&mut self, descriptor: SkillDescriptor)
pub fn register_descriptor(&mut self, descriptor: SkillDescriptor)
Register a discovered file-based skill descriptor.
Sourcepub fn register_descriptor_with_legacy(
&mut self,
descriptor: SkillDescriptor,
legacy_instructions: Option<String>,
)
pub fn register_descriptor_with_legacy( &mut self, descriptor: SkillDescriptor, legacy_instructions: Option<String>, )
Register a discovered file-based skill descriptor and its legacy instructions.
Sourcepub fn set_sandbox_manager(&mut self, manager: Arc<SandboxManager>)
pub fn set_sandbox_manager(&mut self, manager: Arc<SandboxManager>)
Attach a sandbox manager used for inline command execution during activation.
Sourcepub fn get_descriptor(&self, name: &str) -> Option<&SkillDescriptor>
pub fn get_descriptor(&self, name: &str) -> Option<&SkillDescriptor>
Get a descriptor by name.
Sourcepub fn list_descriptors(&self) -> Vec<&SkillDescriptor>
pub fn list_descriptors(&self) -> Vec<&SkillDescriptor>
List all discovered file-based skill descriptors.
Sourcepub fn descriptor_count(&self) -> usize
pub fn descriptor_count(&self) -> usize
Number of discovered file-based skills.
Sourcepub fn catalog_prompt(&self) -> Option<String>
pub fn catalog_prompt(&self) -> Option<String>
Generate the skill catalog text for system-prompt injection.
Returns None if no file-based skills are available (caller should
omit the catalog section entirely per spec).
Sourcepub fn available_names(&self) -> Vec<String>
pub fn available_names(&self) -> Vec<String>
List all available skill names (for activate_skill tool enum constraint).
Sourcepub fn mark_activated(&mut self, name: &str) -> bool
pub fn mark_activated(&mut self, name: &str) -> bool
Mark a skill as activated. Returns false if already activated (dedup).
Sourcepub fn is_activated(&self, name: &str) -> bool
pub fn is_activated(&self, name: &str) -> bool
Check whether a skill has been activated in this session.
Sourcepub fn activated_count(&self) -> usize
pub fn activated_count(&self) -> usize
Number of activated skills.
Sourcepub async fn activate(&mut self, name: &str) -> Result<SkillContent, ReactError>
pub async fn activate(&mut self, name: &str) -> Result<SkillContent, ReactError>
Activate a skill: read its full content from disk, execute inline commands, and substitute variables.
Returns the structured SkillContent or an error.
Automatically marks the skill as activated.
Sourcepub async fn activate_with_args(
&mut self,
name: &str,
args: &[String],
source: SkillSource,
) -> Result<SkillContent, ReactError>
pub async fn activate_with_args( &mut self, name: &str, args: &[String], source: SkillSource, ) -> Result<SkillContent, ReactError>
Activate a skill with user-provided arguments and source context.
This is the full activation path that:
- Reads the
SKILL.mdbody - Falls back to legacy frontmatter
instructionsif body is empty - Substitutes variables (
${SKILL_DIR},${SESSION_ID},${ARGUMENTS}, etc.) - Executes inline commands (
!`cmd`and```! cmd ```), using the configured sandbox path when available, or the direct fallback with minimal env + best-effort timeout termination otherwise - Enumerates bundled resources
Sourcepub fn record_code_skill(&mut self, info: SkillInfo)
pub fn record_code_skill(&mut self, info: SkillInfo)
Record a code-based skill that was installed via add_skill.
Sourcepub fn has_code_skill(&self, name: &str) -> bool
pub fn has_code_skill(&self, name: &str) -> bool
Check if a code-based skill is installed.
Sourcepub fn get_code_skill(&self, name: &str) -> Option<&SkillInfo>
pub fn get_code_skill(&self, name: &str) -> Option<&SkillInfo>
Get a code-based skill’s info.
Sourcepub fn list_code_skills(&self) -> Vec<&SkillInfo>
pub fn list_code_skills(&self) -> Vec<&SkillInfo>
List all installed code-based skills.
Sourcepub fn is_installed(&self, name: &str) -> bool
pub fn is_installed(&self, name: &str) -> bool
Check if a skill (code-based or file-based) is installed/discovered.
Trait Implementations§
Source§impl Default for SkillRegistry
impl Default for SkillRegistry
Source§fn default() -> SkillRegistry
fn default() -> SkillRegistry
Auto Trait Implementations§
impl Freeze for SkillRegistry
impl RefUnwindSafe for SkillRegistry
impl Send for SkillRegistry
impl Sync for SkillRegistry
impl Unpin for SkillRegistry
impl UnsafeUnpin for SkillRegistry
impl UnwindSafe for SkillRegistry
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request