Skip to main content

Catalog

Struct Catalog 

Source
pub struct Catalog { /* private fields */ }

Implementations§

Source§

impl Catalog

Source

pub fn describe(&self, asked: &str) -> Result<String, AxError>

What describe answers for asked: the guide of the capability it names, or the closest names to its words.

A tool’s guide is its description and input schema as registered, unshortened, with how to run it; a skill’s is its line and the name read opens it by, because read is the one door that opens a shelf; the mode and developer entries answer their own text.

§Errors

A tool schema that does not print as JSON, which its registration already printed once.

Source§

impl Catalog

Source

pub fn new() -> Catalog

Source

pub fn admit_tool(&mut self, meta: &ToolMeta) -> Result<(), AxError>

Registers an L2 tool (or an L0 tool for wire schema purposes). Eight-field completeness is the type’s business; what is checked here is catalog hygiene: non-empty disclosure, no duplicate name.

Source

pub fn admit_skill(&mut self, entry: CatalogEntry) -> Result<(), AxError>

Registers one reading-room-admitted SKILL entry kept inside the city: expansion is the address a run opens it at.

§Errors

An empty name or disclosure, and a name already admitted by either door, are E_INVALID_ARGS.

Source

pub fn admit_carried_skill( &mut self, entry: CatalogEntry, ) -> Result<(), AxError>

Registers one reading-room-admitted SKILL entry from a shelf outside the city: expansion is the document’s text, which a read by name hands back as it stands (crates/runtime/spec/Tools/Read.lean §8-29-6).

§Errors

The same refusals as Catalog::admit_skill.

Source

pub fn set_mode(&mut self, mode: Mode)

The run sits in exactly one mode; the catalog shows only it.

Source

pub fn render(&self) -> String

The Resident-segment text: the header line, the mode this run sits in, the developer entry, then the dormant index. BTreeMap order makes the bytes a pure function of the content.

The core tools are not among them. Their name, disclosure and schema travel in ChatRequest.tools on every turn, and writing them here as well put every tool’s sentence into the prompt twice. Every other admitted tool and every admitted skill is one line of the dormant index, which stays under DORMANT_INDEX_CEILING however much the building admits.

Source

pub fn resolve_call(&self, call: &ToolCall) -> Result<ToolCall, AxError>

The call a call stands for, with the id the model gave it, so its result pairs with the call in the conversation and its tool passes its own doors (crates/runtime/Spec.lean §8-61).

§Errors

E_INVALID_ARGS when the arguments name no tool or carry no object, when they name call itself, when the name is not a tool this run was admitted, and when the arguments do not fit the tool’s input schema; the last carries the schema.

Source

pub fn tool_defs(&self) -> Vec<ToolDef>

The only source of ChatRequest.tools: the admitted tools in the core of this run’s mode, and no other.

Source

pub fn skill_pins(&self) -> Vec<SkillPin>

What this run was given, and what each one hashed to.

Taken from the catalog rather than from a second scan of the shelves: the catalog is already the authority on what a run can reach, and a second reading would be a second answer to that question taken at a different instant.

Source

pub fn expand(&self, name: &str) -> Option<Expansion>

Second-level disclosure. Tools expand to their schema via tool_defs (the wire always carries it); skills and the mode expand through here.

The two answers are different kinds of thing — a place to open and a text already in the prompt — so they are different variants. Collapsing both into one string made the caller guess which it had by trying to parse it as an address, and a mode whose text happened to parse would have been opened as a file.

Trait Implementations§

Source§

impl Debug for Catalog

Source§

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

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

impl Default for Catalog

Source§

fn default() -> Self

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