Interface: SkillRuntime
Defined in: packages/core/src/skill.ts:277
The runtime a bot weaves in for a set of skills: the hoisted tools (every
skill's tools plus the shared load_skill/unload_skill loaders) and a
per-turn buildContext that emits the always-on skill index plus the full
instructions of any active (keyword-matched or explicitly loaded) skill.
Shape-compatible with the bot's systemPromptBuilder pipeline — the same
seam MemoryBankLike uses.
Properties
tools
tools:
Record<string,ZodToolDefinition>
Defined in: packages/core/src/skill.ts:279
Hoisted tools: each skill's tools (tagged) + the load_skill/unload_skill loaders.
Methods
buildActive()
buildActive(
input):Promise<string>
Defined in: packages/core/src/skill.ts:293
The instructions of every skill active for this input (keyword, host
request, or loaded earlier), as one block, or '' when none is. Records
what was applied (see getAppliedActivations). Changes as the active
set does, so it belongs after the cache breakpoint (Baleybot sends it as a
message just before the person's latest message).
Parameters
input
string
Returns
Promise<string>
buildContext()
buildContext(
input):Promise<string>
Defined in: packages/core/src/skill.ts:295
buildIndex followed by buildActive — for hosts that build one prompt fragment.
Parameters
input
string
Returns
Promise<string>
buildIndex()
buildIndex():
string
Defined in: packages/core/src/skill.ts:285
The skill index: one line per skill (name and description), and how to load one. Byte-stable — it never changes with which skills are active, so it belongs in the cached system prompt.
Returns
string
getActivations()
getActivations(
input):SkillActivation[]
Defined in: packages/core/src/skill.ts:304
The skills whose instructions would be injected for this input, with the
reason. Keyword match takes precedence as the reason (it's the immediate
trigger); otherwise the skill is active because of a prior load_skill
call. Pure — safe to call for observability without side effects. For what
was actually injected on the latest turn (excluding a skill whose
instructions threw), use getAppliedActivations.
Parameters
input
string
Returns
getActiveSkills()
getActiveSkills():
string[]
Defined in: packages/core/src/skill.ts:329
The skills active right now: loaded, requested this call, or keyword-matched on the latest input.
Returns
string[]
getAppliedActivations()
getAppliedActivations():
SkillActivation[]
Defined in: packages/core/src/skill.ts:312
The activations the most recent buildContext actually injected into
the prompt — the truthful basis for skill_activated events. Differs from
getActivations only when a skill's instructions threw: it is active
but its body was omitted, so it is not reported here. Returns [] before
the first buildContext call.
Returns
getState()
getState():
SkillState
Defined in: packages/core/src/skill.ts:337
The skills loaded via load_skill and not unloaded, in load order.
Returns
reset()
reset():
void
Defined in: packages/core/src/skill.ts:335
Forget every skill activated via load_skill. Keyword triggers are
stateless and unaffected. The bot calls this from clearHistory() so a
fresh conversation does not inherit skills loaded in a previous one.
Returns
void
restore()
restore(
state):void
Defined in: packages/core/src/skill.ts:343
Replace the loaded set with state.loaded (a saved getState).
Unknown names are dropped with one warning — a skill renamed or removed
since the state was saved must not break the conversation.
Parameters
state
SkillState | undefined
Returns
void
setActivationListener()
setActivationListener(
listener):void
Defined in: packages/core/src/skill.ts:320
Register a listener fired the instant a skill is newly activated by a
load_skill call mid-turn — so the bot can emit a same-turn
skill_activated event for the model's deliberate choice (the pre-turn
sweep can't see it, since load_skill runs during the tool loop). Replaces
any previous listener; pass undefined to clear.
Parameters
listener
((activation) => void) | undefined
Returns
void
setDeactivationListener()
setDeactivationListener(
listener):void
Defined in: packages/core/src/skill.ts:327
Register a listener fired the instant a skill stops being active mid-turn:
unload_skill (or a restore) dropped it and no keyword or host
request keeps it active. The bot uses it to return the skill's tools to
on-demand loading. Replaces any previous listener; undefined clears.
Parameters
listener
((skill) => void) | undefined
Returns
void
setRequested()
setRequested(
names):void
Defined in: packages/core/src/skill.ts:350
Activate these skills for the next turn(s) until called again (the host's
per-call pre-activation; reason requested). Not persisted in
getState. Pass undefined or [] to clear. Unknown names are
ignored with one warning.
Parameters
names
readonly string[] | undefined
Returns
void
skillToolNames()
skillToolNames():
string[]
Defined in: packages/core/src/skill.ts:354
Every tool name contributed by any skill (not the loaders).
Returns
string[]
toolsFor()
toolsFor(
skill):string[]
Defined in: packages/core/src/skill.ts:352
The tool names a skill brings (its own declaration), or [].
Parameters
skill
string
Returns
string[]