feat(B-PLUGIN-MINIAPP-WIRE): MiniApp Registry als Singleton — gemeinsame Registry für alle Plugins
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
B-PLUGIN-MINIAPP-WIRE: MiniAppRegistry Singleton-Pattern - get_miniapp_registry() / reset_miniapp_registry() in miniapp_registry.py - Alle 6 MiniAppRegistry() Instanziierungen durch get_miniapp_registry() ersetzt - automation/plugin.py (on_activate/on_deactivate), automation/routes.py (3x), kommunikation/plugin.py - contracts.py: get_miniapp_registry + reset_miniapp_registry exportiert - 0 verbleibende MiniAppRegistry() Instanziierungen außerhalb miniapp_registry.py Tests: 12 Tests in test_miniapp_registry.py — alle grün - Singleton, Register/List, UnregisterPlugin, Plugin-Lifecycle-Integration
This commit is contained in:
@@ -71,3 +71,22 @@ class MiniAppRegistry:
|
||||
def get_app(self, app_id: str) -> MiniAppDef | None:
|
||||
"""Get a specific mini-app definition."""
|
||||
return self._apps.get(app_id)
|
||||
|
||||
|
||||
# ─── Singleton helpers ───
|
||||
|
||||
_registry: MiniAppRegistry | None = None
|
||||
|
||||
|
||||
def get_miniapp_registry() -> MiniAppRegistry:
|
||||
"""Return the shared singleton MiniAppRegistry instance."""
|
||||
global _registry
|
||||
if _registry is None:
|
||||
_registry = MiniAppRegistry()
|
||||
return _registry
|
||||
|
||||
|
||||
def reset_miniapp_registry() -> None:
|
||||
"""Reset the singleton instance (useful for tests)."""
|
||||
global _registry
|
||||
_registry = None
|
||||
|
||||
Reference in New Issue
Block a user