Expand description
WebAssembly Component Model plugin runtime for grain.
Loads .wasm files compiled against the grain:plugin WIT world,
instantiates them via wasmtime, and wraps each plugin-declared
tool as a grain_agent_core::AgentTool implementation.
§Architecture
.grain/plugins/my-tool/
+-- plugin.toml # manifest (extended with [wasm])
+-- plugin.wasm # compiled Component Model moduleThe host provides logging, env-var access, and HTTP primitives.
Each host function is gated by the plugin’s declared capabilities
in plugin.toml — calls into a denied capability return an error
to the guest.
Re-exports§
Modules§
Structs§
- Call
Tool Result - Owned result from a tool call (mirrors the WIT
tool-result). - Capabilities
- Per-plugin capabilities the host enforces.
- Grain
Plugin - Auto-generated bindings for an instance a component which
implements the world
grain-plugin. - Grain
Plugin Indices - Auto-generated bindings for index of the exports of
grain-plugin. - Grain
Plugin Pre - Auto-generated bindings for a pre-instantiated version of a
component which implements the world
grain-plugin. - HookDef
- One hook subscription declared by a v2 plugin.
- Loaded
Plugin - A successfully loaded WASM plugin.
- Orchestration
Def - Optional orchestration metadata exported by v2 plugins.
- Plugin
Info - Plugin metadata (mirrors the WIT
plugin-inforecord but is owned / cloneable for storage outside the store). - Plugin
State - State stored in the wasmtime
Store<T>. - RoleDef
- One model-role slot declared by a v2 plugin.
- ToolDef
- Tool definition (mirrors the WIT
tool-defrecord, owned). - UiHeader
- Optional UI header override requested by a v2 plugin.
- Wasm
Plugin Runtime - Owns the wasmtime engine and can load + call plugins.
- Wasm
Tool - One tool exported by a WASM plugin, presented as an
AgentTool.
Enums§
- Hook
Point - Lifecycle point names supported by the v2 orchestration surface.
- Host
Action - Host action requested by a v2 plugin hook.
- Wasm
Plugin Error
Type Aliases§
- LogSink
- Host log callback. Called for every
loghost import the guest invokes (after thelogcapability gate). Arguments: severity tag ("debug" | "info" | "warn" | "error"), plugin name, message.