Spaces:
Sleeping
Sleeping
Download plugins/plugin_manager.py from Dws321/spark_colony: direct link, hf CLI and curl.
- Browser
- Download file 565 Bytes
-
https://huggingface.co/spaces/Dws321/spark_colony/resolve/main/plugins/plugin_manager.py
- Command line
-
hf download hf://spaces/Dws321/spark_colony/plugins/plugin_manager.py
-
curl -L -o plugin_manager.py https://huggingface.co/spaces/Dws321/spark_colony/resolve/main/plugins/plugin_manager.py
565 Bytes
| from typing import Any, Dict, List | |
| from database.db import DatabaseManager | |
| from schemas.models import RegisterPluginRequest | |
| class PluginManager: | |
| """Dynamic Plugin Registry for Colony Extensions.""" | |
| def __init__(self, db: DatabaseManager): | |
| self.db = db | |
| async def register_plugin(self, req: RegisterPluginRequest) -> str: | |
| return await self.db.save_plugin(req.name, req.version, req.description, req.entry_point, req.permissions) | |
| async def list_plugins(self) -> List[Dict[str, Any]]: | |
| return await self.db.get_all_plugins() | |