PluginOperations
Managing plugins, expressed once as operations. Listing, enabling, installing and removing a plugin were CLI commands: to reach them from anywhere else — an admin panel, an MCP client, a catalog — someone had to write the same logic again behind a controller. As operations they are defined once and every surface projector materialises them, so the panel and the terminal cannot drift apart because there is only one of them. What a host gets depends on what it wired. With only a registry, the four read-and-toggle operations exist. With an installer too, the three that reach the network appear as well — a host that never wired one does not get an `install` button that fails when pressed. A host has plugins from two places and these operations report both: what it **declares in code** and what its **store** holds. A declared plugin has no record until somebody switches it off — that is what keeps a store from appearing in an app that never manages anything — so listing only records would show an empty panel to an app that is running plugins right now, and disabling one would fail with "not installed" for every plugin it has.
PluginOperations::__construct()
public function __construct(Milpa\Plugin\Contracts\PluginRegistryInterface $registry, ?Milpa\Interfaces\Plugin\PluginInstallerInterface $installer = null, array $declared = [], ?Milpa\Plugin\Contracts\ActivationSafetyInterface $safety = null, ?string $root = null, ?Milpa\Plugin\Contracts\StateBaselineInterface $baseline = null):La comprobación de seguridad al apagar es OPCIONAL y por contrato. Sólo el host sabe qué perfil de arquitectura tiene que satisfacer, así que este paquete no puede resolverlo por su cuenta sin adivinarlo. Si nadie la cablea, apagar se comporta como siempre: no saber no autoriza a inventar, ni a negar.
Parameters
| Name | Type | Description |
|---|---|---|
| $registry | Milpa\Plugin\Contracts\PluginRegistryInterface | |
| $installer | ?Milpa\Interfaces\Plugin\PluginInstallerInterface | |
| $declared | list<class-string> | The plugin classes the host declares in code. They have no registry record until somebody switches one off, so without them a freshly-installed app reports that it has no plugins while running two. |
| $safety | (ActivationSafetyInterface | null) | quien contesta si apagar dejaría el host sin arrancar; `null` deja el comportamiento previo |
| $root | (string | null) | la raíz de la app. Sin ella, las dos operaciones que tocan disco —verificar un manifiesto, regenerar `milpa.lock`— no se ofrecen: un paquete no adivina dónde vive quien lo instala, y una superficie no debería pintar un botón que truena al apretarlo |
| $baseline | ?Milpa\Plugin\Contracts\StateBaselineInterface |
PluginOperations::operations()
public function operations(): arrayEvery operation this host can offer, in the order a surface should present them: read first, then the toggles, then the three that reach out for code.