- Replace legacy @PURPOSE with @BRIEF across 241 files - Add missing [C:N] complexity tiers to function contracts in core modules - Fix tombstone contracts: add @STATUS DEPRECATED to 5 deprecated anchors - Resolve 7 unresolved @RELATION edges in executor.py (DictionaryManager, TranslationPreview, etc.) - Fix flat hierarchical IDs in 4 test files (22 test functions) - Fix invalid tags/relations in logger.py (@ADR, @CONSEQUENCES, DISABLED_BY) - Rebuild semantic index: 9,576 contracts, 4,742 edges, 0 parse warnings
38 lines
2.1 KiB
Markdown
38 lines
2.1 KiB
Markdown
# [DEF:Doc.Adr.ADR0016:ADR]
|
|
# @STATUS ACCEPTED
|
|
# @BRIEF Define the implemented plugin discovery and execution boundary.
|
|
# @RELATION SUPERSEDES -> [Doc.Adr.ADR0004:ADR]
|
|
# @RELATION BINDS_TO -> [backend/src/core/plugin_loader.py]
|
|
# @RELATION BINDS_TO -> [backend/src/core/plugin_base.py]
|
|
# @RATIONALE The repository already contains first-party plugins that share the application runtime, configuration, database access patterns, and async Task Manager. The executable contract is `PluginBase`, not an unimplemented manifest or subprocess protocol.
|
|
# @REJECTED `plugin.toml` manifests and a mandatory subprocess executor — rejected as the current architecture because neither is the runtime contract implemented by the repository.
|
|
# @REJECTED Treating dynamic discovery as a sandbox — rejected because imported plugin code runs in the backend process and has the same process privileges.
|
|
|
|
## Decision
|
|
|
|
First-party plugins live in `backend/src/plugins/`. `PluginLoader` discovers Python
|
|
modules and package `__init__.py` files in that directory, imports them under the
|
|
`src.plugins` package, instantiates subclasses of `PluginBase`, and exposes their
|
|
validated `PluginConfig` metadata.
|
|
|
|
Every discoverable plugin must implement the abstract `PluginBase` contract:
|
|
|
|
- stable `id`, `name`, `description`, and `version` properties;
|
|
- `get_schema()` returning an input schema;
|
|
- asynchronous `execute(params)`;
|
|
- optional `ui_route` and a permission derived from `required_permission`.
|
|
|
|
Plugins are trusted, versioned source in this repository. They are not third-party
|
|
sandboxed extensions. A future marketplace or untrusted-plugin feature requires a
|
|
new ADR that specifies its isolation, permission, resource, and failure model.
|
|
|
|
## Consequences
|
|
|
|
- Plugin failures during discovery are logged and do not stop discovery of other
|
|
modules, but execution remains subject to normal backend failure handling.
|
|
- Plugin dependencies must be compatible with the backend runtime.
|
|
- Adding a plugin requires tests for discovery and its public execution contract;
|
|
it does not require a `plugin.toml` manifest.
|
|
|
|
# [/DEF:Doc.Adr.ADR0016:ADR]
|