Skip to main content

Catalogue

Struct Catalogue 

Source
pub struct Catalogue {
    pub prefix: String,
    pub errors: BTreeMap<String, String>,
    /* private fields */
}
Expand description

The catalogue + body cache.

Fields§

§prefix: String§errors: BTreeMap<String, String>

Discovery errors per server (surfaced in status, never fatal).

Implementations§

Source§

impl Catalogue

Source

pub fn new(prefix: &str, max_bytes: usize) -> Catalogue

Source

pub fn discover( &mut self, server: &dyn SkillServer, mode: Discover, filter: Option<&str>, ) -> Vec<String>

(Re)discover the skills of one server. Later sources do not override an existing name (first source wins; a collision is logged by the caller). Returns the names discovered on this server.

Source

pub fn forget_server(&mut self, server: &str)

Forget every skill of server (before a re-discovery).

Source

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

Source

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

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn list_value(&self) -> Value

skills.list output.

Source

pub fn render_catalogue(&self) -> Option<String>

The catalogue block for a prompt (names + descriptions), or None when empty.

Source

pub fn load( &mut self, name: &str, arguments: Option<Value>, servers: &dyn Fn(&str) -> Option<Arc<dyn SkillServer>>, ) -> Result<SkillBody, String>

Fetch (or serve from cache) a skill body. servers resolves the source server by name.

Source

pub fn add_inline(&mut self, skills: &[InlineSkill]) -> Vec<String>

A cached body by hash. Register the instruction’s :::skill definitions. Inline skills win a name collision with discovered ones — the operator wrote them CLOSER to this agent than any server did.

Source

pub fn add_dir(&mut self, dir: &Path) -> (Vec<String>, Vec<String>)

Register a LOCAL folder of skill files.

Two layouts, because both are in the wild: <dir>/<name>.md, and the Agent Skill directory form <dir>/<name>/SKILL.md. Either may carry YAML frontmatter (name, description); without it the file stem is the name and the first paragraph is the description, so a plain markdown file is a usable skill with no ceremony.

Registered as SkillSourceKind::Inline with the body already read: a skill is prose, so there is nothing to fetch later and nothing that can fail at load time. Like :::skill, a local file WINS a name collision with a discovered one — the operator put it closer to this agent than any server did.

Source

pub fn body(&self, hash: &str) -> Option<&SkillBody>

Source

pub fn evict_except(&mut self, keep: &[String])

Drop cached bodies whose hash is not in keep.

Source

pub fn references(&self, text: &str) -> Vec<String>

The @skill:<name> references in a text (deduplicated, in order).

Trait Implementations§

Source§

impl Debug for Catalogue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Catalogue

Source§

fn default() -> Catalogue

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> 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, 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, <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<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