Skip to main content

Module plugin

Module plugin 

Source
Expand description

Plugin package machinery (P2) — manifest / registry integrity / install lifecycle / loading.

From the user’s point of view, in one sentence: “install a plugin”. After the install, a few more tools show up in the tool table; the user doesn’t need to know which one is wasm and which one is python. For the mechanism’s main text, see phimint/notes/tool-socket-design.md, sections “Shape of a plugin package / Plugin install”:

  • Three forms, one key scheme: tools in the wasm / script / mcp forms share the unified identity plugin.{plugin}.{tool} (crate::tool_provider);
  • Human review before install: manifest::ReviewDigest lays out the full manifest (tools / execution summary / capabilities with concrete paths/hosts), and only after human confirmation does install::commit_install write to disk; a plugin requested for install on an agent’s behalf is never allowed through by default (guaranteed at the product layer);
  • Install integrity is pinned outside the plugin directory: registry::PluginRegistry (<plugins_root>/registry.json) stores the manifest hash + the hash of every .wasm + pinned resolved capabilities/absolute paths. No authoritative copy is kept inside the plugin directory — anchor and anchored object in the same cave = self-deception. Re-verified on every load; tampering = all of that plugin’s tools are disabled + “run plugin add again to re-review”;
  • Capability tightening reads the pinned values in the registry, never the plugin’s own manifest;
  • Corruption does not skip the whole package: if plugin.json lists a tool but the .wasm is missing/corrupt → that tool is disabled + an error is reported, while the other tools work as usual;
  • Uninstall cleans three places: the tool table (the provider no longer lists it) / the ledger (plugin.{name}.*) / the registry entry.

Transport notes (explicitly documented, phased discipline): git URLs depend on the git executable (must be on PATH on Windows; gix could be embedded later); archive extraction performs a zip-slip path check (a member path that escapes the target directory is rejected).

Re-exports§

pub use install::ArchiveFormat;
pub use install::InstallError;
pub use install::InstallPlan;
pub use install::InstalledPlugin;
pub use install::PluginSource;
pub use install::RemovalReport;
pub use install::StagingLayout;
pub use install::commit_install;
pub use install::plan_install;
pub use install::remove_plugin;
pub use loader::DisabledTool;
pub use loader::LoadedPlugin;
pub use loader::McpKeyAssignment;
pub use loader::PluginLoader;
pub use loader::PluginMcpServer;
pub use loader::assign_mcp_tool_keys;
pub use manifest::CapabilitySpec;
pub use manifest::FsReadSpec;
pub use manifest::ManifestError;
pub use manifest::McpServerSpec;
pub use manifest::McpToolSpec;
pub use manifest::NetHttpSpec;
pub use manifest::PluginManifest;
pub use manifest::PluginToolSpec;
pub use manifest::ResolvedCapability;
pub use manifest::ReviewDigest;
pub use manifest::ReviewTool;
pub use manifest::ScriptToolSpec;
pub use manifest::WasmToolSpec;
pub use manifest::resolve_capabilities;
pub use registry::PackageStatus;
pub use registry::PluginPin;
pub use registry::PluginRegistry;
pub use registry::RegistryError;
pub use registry::ToolPin;
pub use registry::ToolStatus;
pub use registry::VerifyIssue;
pub use registry::VerifyReport;

Modules§

install
Plugin install lifecycle: plugin add / plugin remove (human review before install → write to disk → pin → uninstall).
loader
Plugin loading (the P2 load surface) — re-verification gate → build tools per form → disable per tool → three places cleaned on unload.
manifest
plugin.json manifest (schemaVersion 1) — parsing, fail-closed validation, pre-install human review digest.
registry
Install integrity registry (<plugins_root>/registry.json) — the pins live outside the directory they protect.