|
| 1 | +# BUILD_PR_PLUGIN_SYSTEM |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Build a docs-only, implementation-ready plugin system bundle from `PLAN_PR_PLUGIN_SYSTEM`. |
| 5 | + |
| 6 | +## Workflow |
| 7 | +PLAN_PR -> BUILD_PR -> APPLY_PR |
| 8 | + |
| 9 | +## Build Scope |
| 10 | +- define plugin contracts |
| 11 | +- define plugin registration APIs |
| 12 | +- define extension hooks |
| 13 | +- define isolation and capability boundaries |
| 14 | +- define loading and activation strategy |
| 15 | + |
| 16 | +## Constraints |
| 17 | +- docs-only |
| 18 | +- no runtime code changes |
| 19 | +- no engine refactor |
| 20 | +- no breaking API changes in this build slice |
| 21 | + |
| 22 | +## Plugin Contracts (authoritative) |
| 23 | +1. `PluginRegistry` |
| 24 | +- register/unregister plugin descriptors |
| 25 | +- enumerate plugin metadata and status |
| 26 | +- enforce lifecycle order and duplicate protection |
| 27 | + |
| 28 | +2. `PluginContext` |
| 29 | +- approved public APIs only |
| 30 | +- read-only access to engine/debug snapshots |
| 31 | +- bounded command/panel/provider registration helpers |
| 32 | + |
| 33 | +3. `CapabilityDescriptor` |
| 34 | +- capability id and version |
| 35 | +- required vs optional capability flags |
| 36 | +- compatibility metadata |
| 37 | + |
| 38 | +## Lifecycle Contract |
| 39 | +Ordered hooks: |
| 40 | +1. `init(context)` |
| 41 | +2. `activate(context)` |
| 42 | +3. `deactivate(context)` |
| 43 | +4. `dispose(context)` |
| 44 | + |
| 45 | +Rules: |
| 46 | +- hooks are optional but order is strict |
| 47 | +- failures are isolated per plugin |
| 48 | +- deactivation/dispose must be idempotent |
| 49 | + |
| 50 | +## Isolation Rules |
| 51 | +- no direct runtime mutation from plugins |
| 52 | +- plugins use approved public seams only |
| 53 | +- no cross-plugin direct coupling |
| 54 | +- capability checks required before activation |
| 55 | + |
| 56 | +## Loading Model |
| 57 | +- optional loading by config/feature flag |
| 58 | +- lazy activation on demand |
| 59 | +- explicit unload path for teardown testing |
| 60 | + |
| 61 | +## Registration APIs (docs contract) |
| 62 | +- `registerPlugin(descriptor)` |
| 63 | +- `unregisterPlugin(pluginId)` |
| 64 | +- `listPlugins()` |
| 65 | +- `activatePlugin(pluginId)` |
| 66 | +- `deactivatePlugin(pluginId)` |
| 67 | + |
| 68 | +## Extension Hook Targets |
| 69 | +- command pack extension hook |
| 70 | +- panel extension hook |
| 71 | +- provider extension hook |
| 72 | + |
| 73 | +## Validation Targets |
| 74 | +- lifecycle ordering and idempotence are documented |
| 75 | +- isolation boundaries are explicit |
| 76 | +- loading model is optional/lazy and bounded |
| 77 | +- registration APIs are stable and deterministic |
| 78 | +- no runtime code changes in this BUILD bundle |
| 79 | + |
| 80 | +## Apply Handoff |
| 81 | +`APPLY_PR_PLUGIN_SYSTEM` should implement only approved contracts and keep scope constrained to plugin lifecycle and registration seams. |
0 commit comments