# Runway — Plugin Development Guide > **Audience:** plugin authors (first-party and third-party). > **What this is:** how to write, package, install, and test a Runway plugin — the descriptor, > the contribution seams, settings, permissions, and the rules that keep plugins compatible. > **Doc status.** The plugin contract is **SPI `1.0.0`, frozen** (Runway `1.0.0`): from here it changes only > additively within `1.x` (SPI `1.1.0` added `PluginSettings.appSecret`, `1.2.0` `PluginSettings.savedApp`) — the commitment and the full type list are in [SPI-STABILITY.md](SPI-STABILITY.md); the > `plugin.yml` keys and their tolerance rules are covered by > [CONFIGURATION-AND-DATA-STABILITY.md](CONFIGURATION-AND-DATA-STABILITY.md) §4. A plugin is built against > `runway-spi` **only**; the kernel refuses one that links its internal classes (§3, *The 1.0 contract at a > glance*). The reference plugin to read is `runway-demo` under `plugins/demo/`, which exercises every > service; the protection module in §12 is the kernel's own **essential** plugin — documented here because it ships > with Runway, and explicitly **not** an example to copy (it is the one plugin allowed to link kernel classes). --- ## 1. What a plugin is A plugin is a **folder** installed under the platform's external plugins directory: ``` external/plugins// ├── plugin.yml # the declarative descriptor (required) ├── .jar # the thin jar of plugin code (omit for a code-less provider — §9) ├── lib/ # optional: bundled third-party jars ├── static/ # optional: assets served at /__plugin//static/** ├── templates/ # optional: Thymeleaf templates, referenced as __plugin__// └── i18n/ # optional: message bundles, appended to the host sources at load — see §8 ``` The folder **name is the plugin id**, and the id in `plugin.yml` **must match it** — a mismatch is logged and the plugin is skipped. The id is validated as a safe directory name (no traversal, no separator characters), so it can be used verbatim in URL and cache-key namespaces. Four principles are baked into the loader; internalize them before writing any code: - **Resources live in the folder, not inside the jar.** The descriptor, `static/`, `templates/`, `lib/`, and `i18n/` are all on disk so an operator can inspect and edit them without a rebuild. The jar carries only compiled classes. - **Restart to install.** Installing, upgrading, disabling, or removing a plugin is a change to the folder followed by a **restart** — there is no hot reload. The Spring context, security chains, template resolvers, and MVC mappings are built **once** at boot; rebuilding them live is the fragile path Runway deliberately avoids (§10). - **Degrade, don't crash.** A malformed, disabled, blocked, or throwing plugin is logged as one line and skipped — the platform always boots. Your plugin's failure never takes the server down (the one exception is a *security-floor* plugin, which fails **closed** on purpose — §10). - **Trusted code with a narrow contract, not a sandbox.** A loaded plugin runs in the host JVM with a classloader whose parent is the application classloader, and its beans wire into the kernel context as first-class peers. What it may *use* of the host is the SPI alone — the kernel refuses at startup a plugin that links an internal class (§3) — but that is a compatibility contract, **not** a security boundary. Only install plugins you trust as you would the application itself. --- ## 2. The plugin descriptor (`plugin.yml`) `plugin.yml` is the single declarative descriptor the kernel reads **without loading any plugin code** — so it works for disabled, blocked, or broken plugins too. It is parsed with unknown keys **ignored in both directions** (a newer file read by an older kernel, or vice-versa, never blows up), so the descriptor evolves additively. Realm values (`application` / `tenant`) are accepted case-insensitively. ### Fields | Key | Type | Meaning | |---|---|---| | `id` | string | **Required.** Stable id = the install-dir name. A path-safe identifier (no traversal / separators). | | `name` | string | Display name shown in the operator console. | | `version` | string | **Plain `MAJOR.MINOR.PATCH`** (e.g. `1.0.0`). A pre-release/qualifier segment (`1.0-RC1`, `1.0.x`, `v1`) is a hard descriptor error. | | `mainClass` | string | The `@Configuration` class to register, fully qualified. **Omit** it for a code-less library/asset provider (§9). | | `enabled` | boolean | `false` parks the plugin (stays on disk, never loads). **Absent = enabled.** | | `essential` | boolean | Advisory only. Honored (drives fail-closed mode) **only** if the id is on the kernel's security-floor allowlist; otherwise ignored with a warning (§10). | | `requires` | list of strings | Hard dependency gates: `id`, `id >= v`, or `id == v` (§10). | | `conflicts` | list of strings | Rival ids the declarer steps aside for (§10). | | `requiresSpi` | string | The **minimum** kernel SPI level, written `">=X.Y.Z"`. A kernel below it **blocks** the plugin at startup rather than letting it crash mid-request (§10). **Required for a plugin with a `mainClass`** from SPI `1.0.0`, and at least `>=0.4.0` — a missing or older floor marks a plugin built for the pre-1.0 contract, which is blocked (library-only plugins are exempt). Only a minimum — a `<=` ceiling is refused. | | `permissions` | list | Declared grantable permissions (§6). | | `settings` | list | App-level settings schema (§5). | | `siteSettings` | list | Per-tenant settings schema (§5). | | `widgetSettings` | map | Per-instance content-widget schema, keyed by a widget's `key()` (§5); each value is a settings schema. | | `settingGroups` | list | Optional titled sections of the settings forms, `{ id, label, help, helpAnchor }`, in display order (§5, *Laying out the form*). | | `helpUrl` | string | Optional help page (a path such as `/__plugin//static/help.html`, or an http(s) URL) that `helpAnchor` links into (§5). | | `menu` | list | Admin-menu contributions (§4). | | `dashboardCards` | list | Dashboard-card contributions (§4). | | `siteData` | map | `personal:` — the paths of your per-site subtree that hold **personal data**; a transfer copy of a site leaves them out (§3, *Personal data*). Understood from SPI `0.5.0`. | ### Descriptor rules (enforced at discovery, each a skip-and-log) - `id` present and a safe directory name. - `version` parses as plain `MAJOR.MINOR.PATCH`. - every `requires` entry parses as exactly `id`, `id >= v`, or `id == v` (single-spaced). - `requiresSpi`, if present, parses as exactly `>=X.Y.Z` — anything else (another operator, a `<=` ceiling, an unparsable version) makes the plugin **Malformed** rather than silently unprotected: a floor that fails open is worse than none, because it reads as protection that is not there. - every `permissions` entry has a non-blank, safe `id` **and** a `realm`. - every `menu` and `dashboardCards` entry has a `realm`. - every `siteData.personal` entry is a relative path with `/` separators and no empty, `.` or `..` segment (a declaration that cannot be honoured would let personal data travel, so it makes the plugin **Malformed**). - descriptor `id` equals the folder name. Any violation logs a precise, operator-readable reason and the plugin is skipped — the platform still boots. > **Which floor to declare.** The lowest SPI version whose additions you use — the evolution log on > `RunwaySpi.VERSION` lists them per version. `>=0.4.0`, `>=0.5.0` and `>=0.6.0` are all **1.x floors** (the service > tier those versions introduced is the 1.0 contract), so a plugin built against them loads on every `1.x` kernel; > declare `>=1.0.0` only if you use `HeadContext.origin()`, `>=1.1.0` if you call `PluginSettings.appSecret`, and `>=1.2.0` if you call `PluginSettings.savedApp`. The floor is an **SPI level** — the value of > `RunwaySpi.VERSION` — not the version of the `runway-spi` artifact you compile against, which is the kernel's > release version (kernel `1.0.0` carries SPI `1.0.0`; §3). ### Minimal descriptor ```yaml id: hello name: Hello Widget version: 1.0.0 requiresSpi: ">=1.0.0" mainClass: com.example.hello.HelloConfig ``` **Verify:** place the folder under `external/plugins/hello/`, restart, and confirm the row shows **Loaded** on the operator console **Plugins** screen (`/__app/plugins`). A bad descriptor shows **Malformed** with the reason (ADMINISTRATION §11). --- ## 3. Building against `runway-spi` `runway-spi` is the **dependency-free** extension API — interfaces, immutable model records and the host services, JDK-only, depending on nothing in the host. Compile against it and its test kit; **never** against the application: ```xml 1.0.0 mx.quest runway-spi ${runway.version} provided mx.quest runway-spi-testkit ${runway.version} test ``` Spring Framework, Spring Boot, Spring Security, Thymeleaf and Jackson are **platform libraries**: compile against them `provided` (the kernel's MAJOR line pins their MAJOR lines — SPI-STABILITY rule 7). `runway-app` is not a dependency in any scope of your default build: a class that imports from it cannot load. (The first-party plugins keep a few host-integration tests in a separate `host-it` Maven profile, the only place `runway-app` appears, test-scoped.) ### Licensing your plugin Runway is licensed under the GNU AGPL version 3 with an **additional permission for plugins** (the kernel's `LICENSE-EXCEPTION`). A plugin that interacts with Runway only through the published SPI may carry **any license you choose**, proprietary included. The published SPI is `runway-spi`, plus any `spi` package a Runway plugin publishes for other plugins, such as `mx.quest.search.spi`. Compiling your tests against `runway-spi-testkit` does not change that. What the permission does not cover: a plugin that copies or modifies kernel code, or links `runway-app` classes, which the loader refuses anyway. The reference plugin `runway-demo` is licensed under Apache-2.0, so you can start a plugin from a copy of it under any terms. ### Getting the jars — the kernel release's assets No public Maven repository serves `runway-spi` or `runway-spi-testkit`. **Every kernel release carries them as release assets** on the releases page (), listed in that release's `SHA256SUMS`: | Asset (for kernel release ``) | What it is | |---|---| | `runway-spi-.jar` | the contract you compile against (`provided`) | | `runway-spi--sources.jar` | its sources — the Javadoc is the contract, so attach it in your IDE | | `runway-spi-.pom` | its pom: no dependencies | | `runway-spi-testkit-.jar` | the in-memory fakes for your unit tests (`test`) | | `runway-spi-testkit--sources.jar` | their sources | | `runway-spi-testkit-.pom` | its pom: depends on `runway-spi` at the same `` | Install them into your local Maven repository once per kernel version you build against: ```sh V=1.0.0 # Download the six runway-spi* files and SHA256SUMS from the v$V release page. If the release host requires # sign-in, download with a token or from a logged-in browser. sha256sum -c --ignore-missing SHA256SUMS # each of the six must print OK; fails if none was verified mvn install:install-file -Dfile=runway-spi-$V.jar -DpomFile=runway-spi-$V.pom \ -Dsources=runway-spi-$V-sources.jar mvn install:install-file -Dfile=runway-spi-testkit-$V.jar -DpomFile=runway-spi-testkit-$V.pom \ -Dsources=runway-spi-testkit-$V-sources.jar ``` Then depend on `mx.quest:runway-spi:` (`provided`) and `mx.quest:runway-spi-testkit:` (`test`) as above. - **Verify, do not skip it.** A release host that requires sign-in may answer an asset URL requested without valid credentials with **HTTP 200 and its HTML sign-in page**, which `curl -f` accepts; `install:install-file` would then install a "jar" that is a web page. The checksum is what catches it (the same trap as the installer — ADMINISTRATION §3). - **Install with the pom, not `-DgroupId/-DartifactId`.** The poms are standalone consumer poms (no parent, versions resolved), generated for the release; installing them is what tells Maven that the testkit needs `runway-spi`. - **The artifact version is the kernel's release version; the SPI level is `RunwaySpi.VERSION`.** They are different numbers on purpose: `1.0.0` carries SPI `1.0.0`, and later kernel releases (`1.0.1`, …) may carry the same SPI level or a higher `1.x`. `requiresSpi:` (§2) names the **SPI level** — the lowest one whose additions you use — and your plugin then loads on every `1.x` kernel at or above it, whichever kernel release you compiled against. - **Pin a RELEASED kernel version, never a `-SNAPSHOT`.** Your jar embeds your pom (which names `runway.version`), and `javac` inlines compile-time constants such as `RunwaySpi.VERSION` into your classes, so the bytes of your plugin zip depend on which SPI jar the build saw. A released kernel version is immutable: rebuilding your tag a year later gives the same zip, byte for byte. A snapshot moves with every kernel build — the same tag rebuilt after it moved is a **different** zip (measured on `runway-demo` 2.0.0, rebuilt against a moved kernel snapshot), and on a machine without the kernel's source it does not resolve at all. So a plugin release is built against a published kernel release, and moving the pin to a newer kernel is a new plugin version — never republish an existing version from a tree whose pin has moved. ### The 1.0 contract at a glance | You need | Use | Never | |---|---|---| | your per-site settings and secrets (app-level ones: `@ConfigurationProperties("runway.plugin.")`; an app-level secret in clear: `PluginSettings.appSecret`, SPI 1.1.0; an app-level setting as saved, before the restart applies it: `PluginSettings.savedApp`, SPI 1.2.0) | `PluginSettings` (+ `SettingsView`) | `SitePluginConfigService`, `SecretCipher`, `@Value("${runway.plugin…}")` on a per-site key | | your per-site files | `PluginSiteFiles`; declare personal data in `siteData.personal` | `SiteFileStore`, `StorageLayout`, a path you build | | the site, the request's site, a permission check, a message | `Sites`, `RequestContext`, `AccessCheck` (`@authz`), `Messages` | `SiteResolver`, `AuthzExpressions`, `SiteAwareMessageSource` | | a starter page | `SitePages.install` → `InstallResult` | `PageWriteService`, writing templates | | the site's content and its URLs | `ContentCatalogView` (`CatalogEntry.pathFor`, `LocalizedUrl`) | `ContentCatalog`, `ContentUrls`, `LocaleUrls`, building a URL yourself | | to say your content changed | `ContentChanges.changed` | publishing `ContentChangedEvent` | | to react to a change | `SiteEventListener` (phase, `previousUrls`/`currentUrls`, `local`) | `@EventListener` on a kernel event | | a start/stop hook | `PluginLifecycle` | `RunwayPlugin`/`PluginContext` (removed at `1.0.0`) | | a console screen | `@ConsoleScreen` on a `@Controller` under `/__admin/` or `/__app/` | your own `@ControllerAdvice` calling `OperatorShellModel` | | an HTTP route on the site | `EndpointContributor` (`Route`, `Route.anonymousPost` for a public form) | a `@Controller` outside the console prefixes, a servlet `Filter` | | tables in PostgreSQL or MariaDB | the `database` plugin's own SPI (`Databases`, `DatabaseConsumer`, migrations shipped in your jar; `requires: [ "database >= 1.0.0" ]`): `plugins/docs/PLUGIN-AUTHORING-GUIDE.md` §7.14, example `plugins/runway-demo-database/` | a JDBC driver or pool of your own, a connection string in your settings | | an absolute URL in head markup | `HeadContext.origin()` (1.0.0) | the `Host` header | **How the kernel enforces it** — each is a **Blocked** plugin with the reason in its row on the **Plugins** screen, never a boot failure: a `mainClass` without `requiresSpi` (or below `>=0.4.0`); a reference in your own jars to a `mx.quest.runway` class outside `mx.quest.runway.spi` (read from the class files' constant pool) or a class of yours under `mx.quest.runway`; a bean name or Spring surface that breaks the rules in *Bean names start with your id* below. The full table is in SPI-STABILITY.md, *How the kernel enforces it*. **State-changing actions are `POST`s with the console's CSRF token.** A `GET` — a link, an ``, a prefetch — must never change anything: a cross-site page can make a signed-in operator's browser send one. Every action of your console screens (install a page, rebuild an index, send a test mail) is a `
` carrying `_csrf` (the console model provides it; `RouteRequest` endpoints accept it as the `_csrf` field or the `X-CSRF-TOKEN` header) and is gated by `@authz.may(…)`. The one exception is a public visitor form, which is an **anonymous route** (below) — never an operator action. ### The SPI surface Most of the dependency-free interfaces (package `mx.quest.runway.spi`) carry a stable `key()`, one lifecycle method taking an immutable host-built **view** and returning a plain value, and a `default Capabilities capabilities()`. The last two rows are shaped differently — they are *platform-armed* seams with a single implementation, so they have no `key()`: | Interface | Method | Purpose | |---|---|---| | `HeadContributor` | `render(HeadContext) → String` | `` markup, injected at the response edge (§4). `headInputs(String siteId)` names the site files whose change must move a page's `ETag` — see below. | | `ContentWidget` | `render(WidgetView) → RenderFragment` | body content at a `data-widget` anchor; return `RenderFragment.empty()` to soft-degrade. | | `PageQualityCheck` | `inspect(PageView) → List` | content/SEO checks; never mutates. Advisory by default; an `ERROR` blocks publishing on a site set to *Enforced*/*Reviewed* (see below). | | `EndpointContributor` | `routes() → List` + `handle(RouteRequest) → RouteResponse` | server routes (`robots.txt`, `sitemap.xml`, …). | | `BackupParticipant` | `export(BackupWriter, SiteRef)` / `importInto(BackupReader, SiteRef)` | a site's plugin-generated data in the site backup; import is idempotent. | | `ContentSource` | `enumerate(SiteView) → List` + `body(SiteView, id, Locale) → ContentBody` | routable content that is not a kernel page (blog entries, product pages). `enumerate` is metadata-only — it runs on anonymous public requests (the sitemap), so reading bodies there turns `/sitemap.xml` into a full-corpus read; `resolve(...)` answers a routing miss after real pages lose, `indexableText(...)` feeds search. | | `CaptchaService` | `widgetForSite(String) → CaptchaWidget` + `verify(siteId, token, clientIp) → boolean` | a challenge for a site form and its server-side check. The kernel default is permissive (no challenge, verification accepts), so a form works with no provider installed; the `protection` plugin supplies the real one as `@Primary`. | | `SiteLoginProtectionControl` | `captchaEnabled(String)` / `disableCaptcha(String)` | app-realm rescue for a site whose own misconfigured login CAPTCHA has locked its manager out. Kernel default is a no-op; `protection` arms it as `@Primary`. | The model package (`mx.quest.runway.spi.model`) holds the immutable boundary types the host materializes and hands you: `HeadContext`, `WidgetView`, `PageView`, `RouteRequest`, `RouteResponse`, `Route`, `RenderFragment`, `Finding`, `Severity`, `SurfacePosture`, `SiteView`, `PageMeta`, `Alternate`, `Provenance`, `SeoTags`, `IconHints`, `ContentRef`, `ContentBody`, `CaptchaWidget`, `Realm`, `Capabilities`, `BackupReader`/`BackupWriter`, `SiteRef`, (from `0.4.0`) `SettingsView` and `PluginInfo`, (from `0.5.0`) `FileEntry`, `StarterPage` and `InstallResult`, and (from `0.6.0`) `CatalogEntry`, `LocalizedUrl`, `SiteLifecycleEvent`, `SettingsChange` and `CatalogChange`. `HeadContext` gained `origin()` in `1.0.0`: the trusted `scheme://host[:port]` to make a URL absolute with — the site's base URL, or, on a host-less site, the request's origin as the trusted-proxy gate left it. (`Permission` left the SPI in `0.4.0`: no plugin constructed one — plugins declare permissions in `plugin.yml` and check them by key string.) **An implementation is a pure function of its inputs** — it reads no request, no store, no other tenant, and returns plain values, so it is trivially unit-testable with no Spring and no I/O. Implementations must be **stateless and thread-safe**: one instance serves many concurrent requests. **`headInputs` and the `ETag`.** Head markup is spliced in at the response edge, *after* a page's strong validator has been computed and possibly answered `304` — so any file a contributor reads that the host cannot see is invisible to that validator. A site manager edits it, sees the change on a fresh fetch, and every client and CDN holding the old validator keeps the previous head indefinitely. Return the **site-relative** paths of **your own** files that you read (`"myplugin/feed.yml"`, a folder you list — a folder folds its listing, a file its content), and read them from disk when you render (or keep a cache that follows the file), because the host folds their bytes on every request; they are read on **every** conditional request for every page of the site, so list only what genuinely shapes the markup. Anything already derived from the `HeadContext` is folded by the host and must not be listed, which is why the default is empty and every contributor written before the method existed keeps working. **Your settings move the `ETag` without you doing anything.** The kernel folds, into every public page's ETag, every running plugin's **app-level** settings (whatever binds under `runway.plugin..*` — the settings form's `external/plugin-settings/.yml`, `application.yml`, environment variables — as the running application bound them, so a value saved on the form moves the ETag at the restart that applies it) and, if your `plugin.yml` declares `siteSettings:`, your **per-site** settings for that site (as `PluginSettings` returns them, so a save or a site reload moves the ETag together with what you render). This covers widgets and `ContentSource` pages as well as head contributors. Do not declare `plugins/.yml` (or the kernel's `seo.yml`, `manifest.yml`, `icons`): a declared kernel-loaded file is ignored in favour of its loaded state — folding its bytes would move the ETag on a hand edit that your `PluginSettings` reads only after the reload, putting the old page under the new ETag. **What the ETag cannot see: your widget's own data.** A `ContentWidget` that renders from data you keep elsewhere (an index, a feed, a store of your own) is in the page ETag only if that data lives in your per-site settings or in files a head contributor of yours declares (`headInputs`). The one case the kernel handles for you is the **query**: a request with a query string on a page whose page or master template anchors any widget is rendered fresh every time — no `ETag`, never a `304`, `Cache-Control: private, no-cache` — because `WidgetView.query()` is how a widget answers from data that moves on its own (search results). So `?q=` results are always current; the same page without a query is cached and revalidated like any other. **Scripts and the CSP nonce.** On public pages the kernel sends `script-src 'nonce-' 'strict-dynamic' …` and, at the response edge, adds `nonce=""` to every executable `