Files
NebulaShell/oss/plugin/manager.py
qwen.ai[bot] 97ced1b5e6 Title: Implement minimal core framework with PL injection and update build config
Key features implemented:
- Updated package metadata and dependencies in PKG-INFO, setup files
- Added main.py entry point for backward compatibility with README launch method
- Enhanced CLI with config options, system info command, and proper signal handling
- Implemented minimal PluginManager loading only plugin-loader core plugin
- Refactored PluginLoader to follow minimal core design, removed sandbox/isolation complexity
- Updated auto-dependency plugin with safer PL injection mechanism and disabled pl_injection
- Removed legacy plugin files (firewall, frp_proxy, ftp_server, multi_lang_deploy, ops_toolbox, security_gateway) as functionality moved to core plugin system
- Improved gitignore with comprehensive ignore patterns

The changes implement a minimal core framework design where only the plugin-loader is directly loaded by the core, with all other plugins managed through the PL injection mechanism, significantly simplifying the architecture.
2026-04-25 10:47:26 +00:00

53 lines
1.9 KiB
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其他所有插件由 plugin-loader 插件自行管理"""
from typing import Any, Optional
from oss.plugin.loader import PluginLoader
class PluginManager:
"""极简插件管理器
遵循「最小化核心框架」设计哲学:
- 核心框架只负责加载 plugin-loader 插件
- 所有其他插件HTTP、WebSocket、Dashboard 等)都由 plugin-loader 插件扫描和加载
- store/@{FutureOSS}/ 是唯一的插件来源
"""
def __init__(self):
self.loader = PluginLoader()
self.plugin_loader: Optional[Any] = None
def load(self):
"""仅加载 plugin-loader 核心插件
plugin-loader 插件会负责:
1. 扫描 store/@{FutureOSS}/ 目录
2. 加载所有启用的插件
3. 处理依赖关系
4. 执行 PL 注入机制
"""
# 只加载 plugin-loader其他所有插件都由它来管理
pl_info = self.loader.load_core_plugin("plugin-loader")
if pl_info:
self.plugin_loader = pl_info["instance"]
def start(self):
"""启动 plugin-loader它会初始化并启动所有其他插件"""
if self.plugin_loader:
# plugin-loader.init() 会扫描并加载 store/ 中的所有插件
self.plugin_loader.init()
# plugin-loader.start() 会按依赖顺序启动所有插件
self.plugin_loader.start()
def stop(self):
"""停止所有插件(由 plugin-loader 统一管理)"""
if self.plugin_loader:
try:
self.plugin_loader.stop()
except KeyboardInterrupt:
print("[PluginManager] 用户中断停止过程")
except Exception as e:
import traceback
print(f"[PluginManager] 停止插件时出错:{type(e).__name__}: {e}")
traceback.print_exc()