Skip to main content

SkillRegistry

Struct SkillRegistry 

Source
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

Source

pub fn new() -> SkillRegistry

Source

pub fn register_descriptor(&mut self, descriptor: SkillDescriptor)

Register a discovered file-based skill descriptor.

Source

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.

Source

pub fn set_sandbox_manager(&mut self, manager: Arc<SandboxManager>)

Attach a sandbox manager used for inline command execution during activation.

Source

pub fn get_descriptor(&self, name: &str) -> Option<&SkillDescriptor>

Get a descriptor by name.

Source

pub fn list_descriptors(&self) -> Vec<&SkillDescriptor>

List all discovered file-based skill descriptors.

Source

pub fn descriptor_count(&self) -> usize

Number of discovered file-based skills.

Source

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

Source

pub fn available_names(&self) -> Vec<String>

List all available skill names (for activate_skill tool enum constraint).

Source

pub fn mark_activated(&mut self, name: &str) -> bool

Mark a skill as activated. Returns false if already activated (dedup).

Source

pub fn is_activated(&self, name: &str) -> bool

Check whether a skill has been activated in this session.

Source

pub fn activated_count(&self) -> usize

Number of activated skills.

Source

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.

Source

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:

  1. Reads the SKILL.md body
  2. Falls back to legacy frontmatter instructions if body is empty
  3. Substitutes variables (${SKILL_DIR}, ${SESSION_ID}, ${ARGUMENTS}, etc.)
  4. 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
  5. Enumerates bundled resources
Source

pub fn record_code_skill(&mut self, info: SkillInfo)

Record a code-based skill that was installed via add_skill.

Source

pub fn has_code_skill(&self, name: &str) -> bool

Check if a code-based skill is installed.

Source

pub fn get_code_skill(&self, name: &str) -> Option<&SkillInfo>

Get a code-based skill’s info.

Source

pub fn list_code_skills(&self) -> Vec<&SkillInfo>

List all installed code-based skills.

Source

pub fn is_installed(&self, name: &str) -> bool

Check if a skill (code-based or file-based) is installed/discovered.

Source

pub fn count(&self) -> usize

Total number of skills (code + file-based).

Source

pub fn list(&self) -> Vec<&SkillInfo>

List all installed skills as SkillInfo (unified view).

Source

pub fn get(&self, name: &str) -> Option<&SkillInfo>

Get a skill’s info by name (code-based only, for backward compat).

Trait Implementations§

Source§

impl Default for SkillRegistry

Source§

fn default() -> SkillRegistry

Returns the “default value” for a type. Read more

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> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more