Files
NebulaShell/oss/plugin/manager.py
Falck 76147bae94 初始提交 - FutureOSS v1.0 插件化运行时框架
一切皆为插件的开发者工具运行时框架

🧩 核心特性:
  - 插件热插拔 (importlib 动态加载)
  - 依赖自动解析 (拓扑排序 + 循环检测)
  - 企业级稳定 (熔断/降级/重试/隔离)
  - 事件驱动 (发布/订阅事件总线)
  - 完整配置 (YAML 配置 + 热重载)
2026-04-06 09:57:10 +08:00

34 lines
895 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""插件管理器 - 只加载 plugin-loader"""
from typing import Any, Optional
from oss.plugin.loader import PluginLoader
class PluginManager:
"""管理基础插件"""
def __init__(self):
self.loader = PluginLoader()
self.plugin_loader: Optional[Any] = None
def load(self):
"""加载基础插件"""
# 只加载 plugin-loader其他都是可选的
pl_info = self.loader.load_core_plugin("plugin-loader")
if pl_info:
self.plugin_loader = pl_info["instance"]
def start(self):
"""启动基础插件"""
if self.plugin_loader:
self.plugin_loader.init()
self.plugin_loader.start()
def stop(self):
"""停止基础插件"""
if self.plugin_loader:
try:
self.plugin_loader.stop()
except Exception:
pass