feat: enhance global config handling and component resolution in plugin runtime

This commit is contained in:
DrSmoothl
2026-03-23 23:05:05 +08:00
parent 1f02171a63
commit a61b124c93
4 changed files with 75 additions and 30 deletions

View File

@@ -53,6 +53,7 @@ class PluginMeta:
self.version = manifest.version
self.capabilities_required = list(manifest.capabilities)
self.dependencies: List[str] = list(manifest.plugin_dependency_ids)
self.component_handlers: Dict[str, str] = {}
class PluginLoader:
@@ -421,7 +422,11 @@ class PluginLoader:
# 动态导入插件模块
module_name = self._build_safe_module_name(plugin_id)
spec = importlib.util.spec_from_file_location(module_name, str(plugin_path))
spec = importlib.util.spec_from_file_location(
module_name,
str(plugin_path),
submodule_search_locations=[str(plugin_dir)],
)
if spec is None or spec.loader is None:
logger.error(f"无法创建模块 spec: {plugin_path}")
return None