feat(extensibility): implement Plugin Architecture Framework with module:ClassName resolution #666

Merged
freemo merged 1 commits from feature/m6plus-plugin-architecture-framework into master 2026-03-10 14:58:30 +00:00
Owner

Summary

  • Implement plugin architecture framework with PluginLoader, PluginManager, types, and exception hierarchy in src/cleveragents/infrastructure/plugins/
  • Enable dynamic class loading via module:ClassName resolution with security prefix allowlist, entry point discovery via importlib.metadata, and @runtime_checkable Protocol validation
  • Add plugin lifecycle management (discover/activate/deactivate) with thread-safe RLock protection and config-driven registration

Key Changes

  • infrastructure/plugins/types.py: PluginState(StrEnum), ExtensionPoint(BaseModel), PluginDescriptor(BaseModel)
  • infrastructure/plugins/exceptions.py: PluginError, PluginLoadError, PluginNotFoundError, ProtocolMismatchError
  • infrastructure/plugins/loader.py: PluginLoader with load_class(), load_from_entry_points(), validate_protocol()
  • infrastructure/plugins/manager.py: PluginManager with lifecycle, config-driven registration, extension point catalog
  • application/container.py: Register PluginManager as Singleton in DI container
  • Tests: 48 Behave BDD scenarios, 10 Robot integration tests, ASV benchmarks
  • Coverage: 98.5% (threshold: 97%)

Testing

  • nox -s lint
  • nox -s typecheck (0 errors, 1 warning)
  • nox -s unit_tests (9776 scenarios passed)
  • Robot integration tests (10/10 passed)

ISSUES CLOSED: #585

## Summary - Implement plugin architecture framework with `PluginLoader`, `PluginManager`, types, and exception hierarchy in `src/cleveragents/infrastructure/plugins/` - Enable dynamic class loading via `module:ClassName` resolution with security prefix allowlist, entry point discovery via `importlib.metadata`, and `@runtime_checkable` Protocol validation - Add plugin lifecycle management (discover/activate/deactivate) with thread-safe `RLock` protection and config-driven registration ## Key Changes - **`infrastructure/plugins/types.py`**: `PluginState(StrEnum)`, `ExtensionPoint(BaseModel)`, `PluginDescriptor(BaseModel)` - **`infrastructure/plugins/exceptions.py`**: `PluginError`, `PluginLoadError`, `PluginNotFoundError`, `ProtocolMismatchError` - **`infrastructure/plugins/loader.py`**: `PluginLoader` with `load_class()`, `load_from_entry_points()`, `validate_protocol()` - **`infrastructure/plugins/manager.py`**: `PluginManager` with lifecycle, config-driven registration, extension point catalog - **`application/container.py`**: Register `PluginManager` as Singleton in DI container - **Tests**: 48 Behave BDD scenarios, 10 Robot integration tests, ASV benchmarks - **Coverage**: 98.5% (threshold: 97%) ## Testing - `nox -s lint` ✅ - `nox -s typecheck` ✅ (0 errors, 1 warning) - `nox -s unit_tests` ✅ (9776 scenarios passed) - Robot integration tests ✅ (10/10 passed) ISSUES CLOSED: #585
freemo added this to the v3.6.0 milestone 2026-03-10 03:07:24 +00:00
freemo force-pushed feature/m6plus-plugin-architecture-framework from 83fa4133f0 to 521a552e56 2026-03-10 14:51:41 +00:00 Compare
freemo scheduled this pull request to auto merge when all checks succeed 2026-03-10 14:52:09 +00:00
freemo merged commit 521a552e56 into master 2026-03-10 14:58:30 +00:00
freemo deleted branch feature/m6plus-plugin-architecture-framework 2026-03-10 14:58:30 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#666