Skip to main content

Module loader

Module loader 

Source
Expand description

Plugin loading (the P2 load surface) — re-verification gate → build tools per form → disable per tool → three places cleaned on unload.

Criteria (notes/tool-socket-design.md, “Plugin package mechanism” acceptance):

  • Post-install tampering is refused: re-verification [PackageStatus::Tampered] ⇒ all tools of that plugin are disabled, reason = “…run plugin add again to re-review” (VerifyReport::user_message);
  • Corruption does not skip the whole package: missing .wasm (registry reports Broken) or compile failure at load time ⇒ that tool is disabled, the rest of the same package work as usual;
  • Unload cleans three places: the tool table (LoadedPlugin::identity_keys handed back to the caller for unregistering) / the ledger (crate::approval_ledger::ApprovalLedger::remove_prefix) / the registry (super::install::remove_plugin) — each has its own test;
  • The mcp form belongs to the plugin: server pins live in PluginMcpServer (connections are made by the product layer, nothing written to connections.json); key assignment disambiguates collisions with numeric suffixes (assign_mcp_tool_keys).

The load surface does not touch the network and does not spawn: MCP only registers pins, scripts only register argv pins — the execution surfaces hang separately (crate::script_tool::ScriptTool / [super::wasm::WasmTool]).

Structs§

DisabledTool
A disabled tool (post-install tampering / missing file / compile failure / not compiled in), with a reason the panel can report directly.
LoadedPlugin
A loaded plugin package: usable tools + disabled list + re-verification report + own server pins.
McpKeyAssignment
Result of assign_mcp_tool_keys.
PluginLoader
Plugin loader: shares one wasm runtime across plugins (feature wasm).
PluginMcpServer
Pin for a plugin-owned MCP server (nothing written to connections.json — it belongs to the plugin).

Functions§

assign_mcp_tool_keys
MCP server tool name list → plugin.{plugin}.{segment} key assignment.