Dependenciesdoc/{zh,en}/design/plugins/dependencies.md

Plugin Dependencies and Prerequisites

Status: 2026-11-13. Built and tested as described here, except where section 5 says otherwise: pkg/plugin/prereq.go (declarations), internal/prereq (checks, plans, steps), internal

Status: 2026-11-13. Built and tested as described here, except where section 5 says otherwise: pkg/plugin/prereq.go (declarations), internal/prereq (checks, plans, steps), internal/manage/stage.go, install.go, prepare.go and doctor.go (the transaction, and instances added or enabled; 2026-11-20 with download steps in internal/prereq/download.go), the load check in internal/host/registry/checks.go. System packages run after one confirmation, as the owner decided (ADR 0001). Since 2026-11-20 a plugin's dependencies install with it at every load too, and system packages without asking when the policy allows it; a plugin also gives the shell its commands (decisions 8 and 9).

A plugin can need two kinds of things it does not contain: other plugins (a login plugin that drives the agent-browser plugin) and prerequisites outside Orquelo (Node.js for an MCP server, a browser binary, a macOS permission for computer use). Both are declared in plugin.yaml, resolved when the plugin is installed, and checked again whenever an instance loads, so a missing piece is reported with its fix instead of surfacing as an obscure failure later.

1. Declaration

yaml
1depends: [agent-browser@>=0.2]        # plugins, as before: name or name@range
2prerequisites:
3  - name: node                        # unique within the plugin
4    platforms: [darwin, linux, windows]   # optional; elsewhere the entry is ignored
5    check: {command: [node, --version], version: ">=18"}
6    install:
7      darwin:  {brew: node}
8      linux:   {apt: nodejs, dnf: nodejs}
9      windows: {winget: OpenJS.NodeJS.LTS}
10  - name: chromium
11    scope: plugin                     # installed into ${PLUGIN_DEPS}; no confirmation
12    check: {path: "${PLUGIN_DEPS}/browsers"}
13    install:
14      all: {command: [npx, playwright, install, chromium], env: {PLAYWRIGHT_BROWSERS_PATH: "${PLUGIN_DEPS}/browsers"}}
15  - name: tool
16    scope: plugin
17    check: {path: "${PLUGIN_DEPS}/tool"}
18    install:
19      darwin/arm64: {download: {url: "https://example.org/tool-darwin-arm64.gz", sha256: <64 hex>, unpack: gz, file: tool}}
20      windows/amd64: {download: {url: "https://example.org/tool-windows-amd64.zip", sha256: <64 hex>, unpack: zip, entry: tool-windows-amd64.exe, file: tool.exe}}
21  - name: accessibility
22    platforms: [darwin]
23    check: {command: [orquelo-ax-check]}
24    install:
25      darwin: {manual: "System Settings → Privacy & Security → Accessibility: allow the Orquelo process"}
FieldMeaning
nameIdentifier used in plans, reasons and logs
scopesystem (default): installed on the machine, needs confirmation. plugin: installed into the plugin's own dependency directory ${PLUGIN_DEPS}, runs without confirmation
platformsos or os/arch values; the entry applies only there
check.commandSatisfied when the command runs and exits 0. With check.version, the first x.y[.z] in its output must satisfy the range
check.pathSatisfied when the path exists
installKeyed by os/arch, os or all, most specific first. A step is exactly one of: brew, apt, dnf, winget (a package name), command (argv, with optional env), manual (text for a person), or download (below)

download (scope: plugin only) fetches one file over https: url, sha256 (of the downloaded bytes, lowercase hex, checked before anything is used), unpack (none, gz or zip), entry (the file taken from a zip, by base name; default file) and file (a plain name written into ${PLUGIN_DEPS} and made executable). A wrong checksum, a missing entry or any other failure writes nothing. Keys like darwin/arm64 pin one artifact per platform; the plugin finds the file in its Env.DepsDir.

${PLUGIN_DEPS} is <state_dir>/deps/<plugin name>, shared by every instance of the plugin and kept outside the plugin directory, so installing into it never changes the plugin's content digest. It is available in MCP server commands, arguments and environment, in command hooks, and as the environment variable PLUGIN_DEPS. Every check and install command runs without a shell.

A plugin whose commands the agent runs through the shell gives them to it with shell (decision 9): path lists directories under ${PLUGIN_ROOT} or ${PLUGIN_DEPS}, which come first on the PATH of localenv commands in runs whose runtime uses the plugin, and env sets variables, whose values may use ${PLUGIN_DATA}. For example, the agent-browser plugin declares shell: {path: ["${PLUGIN_DEPS}/node_modules/.bin"], env: {AGENT_BROWSER_SESSION: orquelo, AGENT_BROWSER_PROFILE: "${PLUGIN_DATA}/profile"}}. A path outside the plugin's own directories, or a reserved name such as PATH or HOME, is refused when the manifest loads. A plugin installed below the system level gives its shell only to the runs it applies to (its tenant, user or workspace), after the system plugins, so it never sets a variable or the first directory a system plugin gives (Feishu #253).

2. Installing

orquelo plugin install SOURCE (and the admin tool) is one transaction:

  1. Stage. Fetch the plugin into a staging directory and validate it. For each depends entry not already satisfied by a builtin or an installed plugin in range, find it by name in the configured catalogs, stage it, and recurse. A cycle, a name in no catalog, or an installed version out of range stops the install. Installed plugins are never upgraded implicitly.
  2. Plan. Check every prerequisite of every staged plugin for this platform. Each unmet one becomes a step: its install command, its scope, or a manual instruction. A prerequisite with no install entry for this platform is an error.
  3. Confirm. If the plan has a system step and the request did not allow system installs, nothing is changed: the plan is returned with the instruction to rerun with -yes. With the policy allow_system_installs: true the plan runs without -yes. The operator policy deny_system_installs: true refuses such plans even with -yes, and wins over allow_system_installs.
  4. Commit. Move the staged plugins into place, dependencies first, approve their digests and record them.
  5. Run. Execute the steps in order and check each prerequisite again afterwards. apt and dnf run through sudo when the Host is not root.
  6. Roll back on failure. If a step fails or its prerequisite is still unmet, the plugins committed in this transaction are removed and an upgraded plugin is restored. The error names the step, its command and its output. System packages already installed stay installed and are listed.

Manual steps never block the install; they are returned as notes, and the instance stays unavailable until its check passes.

The admin tool's install has an argument allow_system_installs; it is part of the approval the admin sees.

A plugin coming into use. Adding an instance (orquelo instance add ID PLUGIN [-yes], the admin tool's plugin_add) and enabling one (orquelo instance enable ID [-yes], plugin_enable) run steps 2, 3 and 5 for the instance's plugin, builtin plugins included: plugin-scope steps run, system steps need -yes or allow_system_installs and the policy's consent, manual steps are returned as notes and do not block. If a step fails, the configuration is not changed and the error names the step; what a plugin-scope step wrote before failing is removed by the step itself (downloads write nothing until verified). Met prerequisites run nothing. Disabling installs nothing.

3. Loading and Repair

When an instance loads, after depends is checked, each prerequisite for this platform is checked. An unmet one installs then, and is checked again, when its step is plugin-scoped, or system-scoped with allow_system_installs (decision 8). Otherwise, or when the install fails, the instance is unavailable with reason prerequisite_missing and a detail that names the prerequisite and the fix, for example prerequisite node: node --version: executable not found; fix: orquelo plugin doctor rail-12306 (brew install node); a failed install shows its step and output, and the next load tries again. serve --preflight reports missing prerequisites and what the start will do with them, and installs nothing.

orquelo plugin doctor NAME [-yes] checks the prerequisites of an installed or builtin plugin, prints their state, and runs the missing steps under the same rules as install (system steps need -yes or the policy allow_system_installs). A reload or restart then makes the instance available.

4. Logs

prereq.checked (debug), prereq.installing, prereq.installed, prereq.install_failed, and plugin.install_rolled_back, with plugin, name and dur_ms.

5. Not Covered

Uninstalling system packages; version pinning of system packages; checks that need native APIs (a macOS permission is checked through a command the plugin ships); a lock between two Hosts installing the same plugin's dependency at once.