Skip to content
mercury framework
GitHub

PluginRuntimeContext

PluginRuntimeContext = object

Defined in: types/plugin-types/index.ts:175

What a plugin’s build() receives — everything its runtime contributions may need that isn’t static data: the shared model (for a model-backed guard), the process env (for its own configuration), and a logger for anything it skips.

optional assistantName?: string

Defined in: types/plugin-types/index.ts:185

The assistant’s name (the app’s persona.name), for a text the plugin builds while running. Static texts (fragment, skill, tool descriptions) write {{assistant}} instead, and the core substitutes it. The core always sets it; optional so a plugin also builds against an older one.


optional dataDir?: string

Defined in: types/plugin-types/index.ts:195

A folder for this plugin alone, on the vault’s volume (so it survives a restart) and out of the wiki: <vault>/.mercury/plugins/<name>/, created by the core before build(). What goes inside is the plugin’s business; nothing in it reaches the model or the wiki. Two sessions may write at once, so write a temporary file in the folder and rename it over the old one. Absent with an older core, or when the folder couldn’t be made (the core logs why): the plugin does without.


env: Record<string, string | undefined>

Defined in: types/plugin-types/index.ts:177


log: (msg) => void

Defined in: types/plugin-types/index.ts:178

string

void


model: LanguageModel

Defined in: types/plugin-types/index.ts:176