ADR 0001doc/{zh,en}/adr/0001-plugin-prerequisites.md

ADR 0001: Plugin Prerequisites and Dependency Installation

Status: accepted, 2026-11-13; amended 2026-11-20 by items 6 to 9. Items 8 and 9, the owner's decisions that a plugin's dependencies install with it with no manual step, amend items

Status: accepted, 2026-11-13; amended 2026-11-20 by items 6 to 9. Items 8 and 9, the owner's decisions that a plugin's dependencies install with it with no manual step, amend items 3 and 4.

Context

Plugins need things they do not contain: other plugins, and software or permissions outside Orquelo, often different per platform (computer use on macOS, a browser for login, Node.js for an MCP server). The manifest could only name other plugins (depends), which were checked at load and never installed. Everything else was undeclared, so it failed late: an MCP server whose command is missing became an unavailable component, a hook that cannot run denied tool calls, and the operator had to investigate.

Decision

  1. The manifest gains prerequisites: each with a check (a command, optionally with a version range, or a path), an install recipe per platform (a package for brew, apt, dnf or winget, a command, or a manual instruction), and a scope: system or plugin.
  2. Installation becomes a transaction: stage the plugin and its depends from the configured catalogs, plan the unmet prerequisites, commit, run, and roll back the committed plugins on failure.
  3. plugin-scope steps install into <state_dir>/deps/<plugin> (${PLUGIN_DEPS}) without confirmation. system steps run only after one confirmation (-yes, or the admin tool's approved argument), and the policy deny_system_installs can refuse them.
  4. Loading checks prerequisites; an unmet one is the unavailability reason prerequisite_missing with its fix. orquelo plugin doctor repairs.
  5. plugin.Env gains DepsDir, and Manager.Install takes InstallOptions (Upgrade, AllowSystem).
  6. A plugin coming into use installs its prerequisites too: adding or enabling an instance runs the plan, confirmation and steps of item 2 for its plugin, builtin plugins included; a failure leaves the configuration unchanged. Manager.Add and Manager.SetEnabled take InstallOptions and return an InstallResult.
  7. A download step (scope: plugin only) fetches one file over https, checks its SHA-256 before using it, unpacks gz or zip, and writes it executable into ${PLUGIN_DEPS}, so a plugin can pin a binary per platform without a system install.
  8. A plugin's dependencies install with it: an unmet plugin-scope prerequisite also installs whenever an instance of the plugin loads (serve, reload, or any command that loads the plugins), so an instance written into the configuration by hand gets it too; serve --preflight only reports it. system steps run without -yes, at install and at load, when the policy sets allow_system_installs: true; deny_system_installs still refuses them and wins, and the refusal names the command. A failed install leaves the instance unavailable with the step and its output, and the next load tries again.
  9. A plugin gives the shell its commands: the manifest's shell section names directories under ${PLUGIN_ROOT} or ${PLUGIN_DEPS}, which come first on the PATH of localenv commands, and variables, whose values may use ${PLUGIN_DATA}. The Host puts what the instances a runtime uses declare into CallContext.Shell, from manifests only. A path outside the plugin's own directories, or a reserved variable name, is refused when the manifest loads.

Consequences

  • ◆This changes the Host contract after M6: the manifest schema, plugin.Env, plugin.Manager, the registry's load checks and the installer. Plugins that declare nothing are unaffected.
  • ◆Orquelo can run package managers on the operator's machine. This is bounded by confirmation, policy, trust on change (install recipes are plugin content), no shell, and logs.
  • ◆System packages are not uninstalled with a plugin, and their versions are not pinned.
  • ◆Checks run at every load; each has a timeout so a hanging command cannot stall the Host.
  • ◆A plugin's first load may take as long as its install, bounded by the install timeout.
  • ◆In runs that use a plugin, its command shadows a system command of the same name: the owner chose that its pinned version wins. Installed plugins are trusted as before (trust on change).

Design: Plugin dependencies and prerequisites.