pub struct Catalog { /* private fields */ }Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn describe(&self, asked: &str) -> Result<String, AxError>
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
impl Catalog
pub fn new() -> Catalog
Sourcepub fn admit_tool(&mut self, meta: &ToolMeta) -> Result<(), AxError>
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.
Sourcepub fn admit_skill(&mut self, entry: CatalogEntry) -> Result<(), AxError>
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.
Sourcepub fn admit_carried_skill(
&mut self,
entry: CatalogEntry,
) -> Result<(), AxError>
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.
Sourcepub fn set_mode(&mut self, mode: Mode)
pub fn set_mode(&mut self, mode: Mode)
The run sits in exactly one mode; the catalog shows only it.
Sourcepub fn render(&self) -> String
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.
Sourcepub fn resolve_call(&self, call: &ToolCall) -> Result<ToolCall, AxError>
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.
Sourcepub fn tool_defs(&self) -> Vec<ToolDef>
pub fn tool_defs(&self) -> Vec<ToolDef>
The only source of ChatRequest.tools: the admitted tools in the
union of the modes’ cores, and no other.
Sourcepub fn skill_pins(&self) -> Vec<SkillPin>
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.
Sourcepub fn expand(&self, name: &str) -> Option<Expansion>
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.