Interface: SkillRegistry
Defined in: internal/skill-registry/SkillRegistry.ts:65
SkillRegistry -- the skills of a call, from the profile's and the call's lists to what the model gets
About
A profile and a call each bring skills; the gateway needs one list it can trust.
Skills are instructions the model loads when a task needs them (D124): ISkill {name, description, body}, attached to a
profile or to one call. This class owns everything the gateway does with them that is not a store's or the assembler's job:
resolvemerges the two lists and refuses duplicate or empty names, so the model never sees two skills of one name.renderSlotwrites the{skills}slot of CHAT_MAIN: the list the model loads from withdyna_aigw_load_skill, or the bodies inline.makeLoadSkillToolbuilds the per-call built-indyna_aigw_load_skill, whose input names only the skills of the call.
It sits between the stores and the call: AIProfileStore asks it when a profile is saved, the call preparation asks it
before the system prompt is rendered and the tools are resolved. It holds no state beyond its config.
Who needs it
AIProfileStore.upsertProfile (the profile alone) and the call preparation of ask(), run() and resume() (the profile
and the call's skills together).
Usage
When to use it
Whenever a list of skills enters the gateway: a profile is written, a call is prepared.
When shouldn't use it
To read a skill at run time: the model does that through the dyna_aigw_load_skill tool, which makeLoadSkillTool builds from the
resolved list.
Implements
Methods
makeLoadSkillTool()
makeLoadSkillTool(
__namedParameters):IToolDef<ILoadSkillInput,ILoadSkillResult>
Defined in: internal/skill-registry/SkillRegistry.ts:208
makeLoadSkillTool -- the built-in dyna_aigw_load_skill tool of one call
About
The model asks for a skill by name and gets its instructions; nothing else can be asked for.
The tool's name input is an enum of the given skills' names, so the model cannot load a skill the call does not have.
policy is ALLOW, it never ends the run and is visible on every step; maxOutputChars is sized to the longest
serialised {name, body}, so a long body is never cut by the registry's default. execute returns {name, body}.
Who needs it
The call preparation of a run() and of a resume(), with the list resolve returned, when that list is not empty.
An ask() never builds it: without tools the bodies are inlined.
Pitfalls
An empty list is a 400: the tool must not be offered when there is nothing to load.
Parameters
__namedParameters
skills
ISkill[]
The resolved skills of the call (resolve); at least one.
Returns
IToolDef<ILoadSkillInput, ILoadSkillResult>
Implementation of
ISkillRegistry.makeLoadSkillTool
renderSlot()
renderSlot(
__namedParameters):string
Defined in: internal/skill-registry/SkillRegistry.ts:164
renderSlot -- the text of the {skills} slot of CHAT_MAIN
About
Listed when the model can load them, written out when it cannot.
inline: false (a run(), the dyna_aigw_load_skill tool is offered): a header that tells the model to call dyna_aigw_load_skill and
one - name: description line per skill, so the bodies cost nothing until a task needs one. inline: true (an ask(),
no tools): the header "Skills — instructions for this call:" and every skill as a ## name section with its body.
No skills: an empty string, the slot renders to nothing.
Who needs it
ContextAssembler.build, with the resolved list of the call and whether dyna_aigw_load_skill is among the call's tools.
Parameters
__namedParameters
inline
boolean
true writes the bodies into the prompt; false lists name and description for dyna_aigw_load_skill.
skills
ISkill[]
The resolved skills of the call (resolve), in order.
Returns
string
Implementation of
ISkillRegistry.renderSlot
resolve()
resolve(
__namedParameters):ISkill[]
Defined in: internal/skill-registry/SkillRegistry.ts:86
resolve -- the skills of one call as one list
About
The profile's skills first, then the call's; unique names or nothing.
A name that is empty after a trim, or that appears twice among the given skills (within one list or across the two), is a
400 whose data names the duplicates and counts the emptyNames. More skills than maxSkills (default 50) is a 400
with data.maxSkills and data.count; a body longer than maxBodyChars (default 50 000) is a 400 with
data.maxBodyChars, data.skill and data.length. Nothing else is changed: the skills come back as given, in order.
Who needs it
AIProfileStore.upsertProfile with the profile alone, so a profile with a duplicate is never stored; the call preparation
of ask(), run() and resume() with the profile and the call's skills, before anything of the call is stored.
Parameters
__namedParameters
profile
The profile of the call; its skills come first.
skills?
ISkill[] = []
The call's skills (IGatewayAskInput.skills), appended after the profile's.
Returns
ISkill[]
Implementation of
ISkillRegistry.resolve