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::ReviewDigestlays out the full manifest (tools / execution summary / capabilities with concrete paths/hosts), and only after human confirmation doesinstall::commit_installwrite 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 + “runplugin addagain 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::ManifestError;pub use manifest::McpServerSpec;pub use manifest::McpToolSpec;pub use manifest::PluginManifest;pub use manifest::PluginToolSpec;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.
Structs§
- FsRead
Spec - Capability vocabulary — one set of types, owned by
phi-cap(sdk-assembly §4.1): declaration layerCapabilitySpec, pinned layerResolvedCapability, decision layerphi_cap::Capability, withclass_ofthe only translation between them. This module re-exports the same type names so existing plugin code is unchanged (the old “wasm form only” law is lifted: every shape that declares capabilities uses these). - NetHttp
Spec - Capability vocabulary — one set of types, owned by
phi-cap(sdk-assembly §4.1): declaration layerCapabilitySpec, pinned layerResolvedCapability, decision layerphi_cap::Capability, withclass_ofthe only translation between them. This module re-exports the same type names so existing plugin code is unchanged (the old “wasm form only” law is lifted: every shape that declares capabilities uses these).
Enums§
- Capability
Spec - Capability vocabulary — one set of types, owned by
phi-cap(sdk-assembly §4.1): declaration layerCapabilitySpec, pinned layerResolvedCapability, decision layerphi_cap::Capability, withclass_ofthe only translation between them. This module re-exports the same type names so existing plugin code is unchanged (the old “wasm form only” law is lifted: every shape that declares capabilities uses these). - Resolved
Capability - Capability vocabulary — one set of types, owned by
phi-cap(sdk-assembly §4.1): declaration layerCapabilitySpec, pinned layerResolvedCapability, decision layerphi_cap::Capability, withclass_ofthe only translation between them. This module re-exports the same type names so existing plugin code is unchanged (the old “wasm form only” law is lifted: every shape that declares capabilities uses these).