Files
openidea/sdk/rust/openidea-plugin/wit/extensions.wit
T
ntbang0901 835a9c883c feat(plugins): let plugins depend on each other and declare extension points (API 1.5) (#2383)
Plugins could not rely on each other: nothing said "this plugin needs that one", and a plugin had no way to let others extend it. Plugin API 1.5 adds both.

- `[[depends]]` in `plugin.toml` (version range, `optional`). A plugin whose required dependency is missing, disabled, the wrong version, cyclic or unable to run is shown as Blocked with the reason and starts once the dependency can run again. Plugins start in dependency order; disabling a plugin others need asks first. Granting or revoking a dependency's permissions also settles its dependents.
- `[[extension-points]]` declares points with typed fields. Dependents contribute to them from `plugin.toml` (checked at install time); the owner reads them through the read-only `extensions` interface (`host::extension_contributions`) and hears changes through the `extensions-changed` event.

The plugin details page shows what a plugin requires, who requires it, and its extension points with their contributors. Covered by the `ext-owner` fixture and `plugin_dependencies.rs`.

Co-authored-by: ntbang0901 <121003585+ntbang0901@users.noreply.github.com>
2026-11-11 02:05:41 +08:00

22 lines
857 B
Plaintext

package openidea:plugin@1.5.0;
/// What other plugins contributed to the extension points this plugin declares
/// (`[[extension-points]]` in `plugin.toml`; the contributors list this plugin
/// in `[[depends]]`). A change is announced by the `extensions-changed` event.
interface extensions {
use types.{error};
record contribution {
/// The contributing plugin's id.
plugin: string,
/// Its `[[contributes."<point>"]]` table as JSON, checked by the host
/// against the fields the point declares.
data: string,
}
/// The contributions to `point`, in the order the plugins started. Only the
/// plugin that declares `point` may read it (`denied` otherwise); `not-found`
/// when no running plugin declares it.
contributions: func(point: string) -> result<list<contribution>, error>;
}