ErisPulse 2.2.0.dev0__py3-none-any.whl → 2.2.0.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ErisPulse/Core/Event/__init__.py +0 -1
- ErisPulse/Core/Event/base.py +0 -1
- ErisPulse/Core/Event/cmd.py +1 -3
- ErisPulse/Core/Event/manager.py +1 -2
- ErisPulse/Core/Event/message.py +0 -2
- ErisPulse/Core/Event/meta.py +0 -1
- ErisPulse/Core/Event/notice.py +0 -1
- ErisPulse/Core/Event/request.py +0 -1
- ErisPulse/Core/__init__.py +4 -3
- ErisPulse/Core/logger.py +2 -2
- ErisPulse/Core/module.py +150 -0
- ErisPulse/Core/{mods.py → module_registry.py} +41 -37
- ErisPulse/__init__.py +14 -9
- ErisPulse/__main__.py +5 -5
- {erispulse-2.2.0.dev0.dist-info → erispulse-2.2.0.dev1.dist-info}/METADATA +1 -1
- erispulse-2.2.0.dev1.dist-info/RECORD +27 -0
- erispulse-2.2.0.dev0.dist-info/RECORD +0 -26
- {erispulse-2.2.0.dev0.dist-info → erispulse-2.2.0.dev1.dist-info}/WHEEL +0 -0
- {erispulse-2.2.0.dev0.dist-info → erispulse-2.2.0.dev1.dist-info}/entry_points.txt +0 -0
- {erispulse-2.2.0.dev0.dist-info → erispulse-2.2.0.dev1.dist-info}/licenses/LICENSE +0 -0
ErisPulse/Core/Event/__init__.py
CHANGED
ErisPulse/Core/Event/base.py
CHANGED
ErisPulse/Core/Event/cmd.py
CHANGED
|
@@ -6,9 +6,8 @@ ErisPulse 命令处理模块
|
|
|
6
6
|
|
|
7
7
|
from .base import BaseEventHandler
|
|
8
8
|
from .manager import event_manager
|
|
9
|
-
from .. import
|
|
9
|
+
from .. import config, logger
|
|
10
10
|
from typing import Callable, Union, List, Dict, Any, Optional
|
|
11
|
-
import re
|
|
12
11
|
import asyncio
|
|
13
12
|
|
|
14
13
|
class CommandHandler:
|
|
@@ -208,5 +207,4 @@ class CommandHandler:
|
|
|
208
207
|
help_lines.append(f" {self.prefix}{cmd_name} - {help_text}")
|
|
209
208
|
return "\n".join(help_lines)
|
|
210
209
|
|
|
211
|
-
# 创建全局命令处理器实例
|
|
212
210
|
command = CommandHandler()
|
ErisPulse/Core/Event/manager.py
CHANGED
|
@@ -4,7 +4,7 @@ ErisPulse 事件管理器
|
|
|
4
4
|
提供全局事件管理功能,包括事件处理器创建、模块事件管理等
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
from .. import
|
|
7
|
+
from .. import logger
|
|
8
8
|
from .base import BaseEventHandler
|
|
9
9
|
from .exceptions import EventNotFoundException
|
|
10
10
|
from typing import Dict, List, Optional, Callable, Any
|
|
@@ -124,5 +124,4 @@ class EventManager:
|
|
|
124
124
|
]
|
|
125
125
|
del self.module_events[module_name]
|
|
126
126
|
|
|
127
|
-
# 全局事件管理器实例
|
|
128
127
|
event_manager = EventManager()
|
ErisPulse/Core/Event/message.py
CHANGED
|
@@ -6,7 +6,6 @@ ErisPulse 消息处理模块
|
|
|
6
6
|
|
|
7
7
|
from .base import BaseEventHandler
|
|
8
8
|
from .manager import event_manager
|
|
9
|
-
from .. import adapter
|
|
10
9
|
from typing import Callable, Dict, Any
|
|
11
10
|
import asyncio
|
|
12
11
|
|
|
@@ -87,5 +86,4 @@ class MessageHandler:
|
|
|
87
86
|
return func
|
|
88
87
|
return decorator
|
|
89
88
|
|
|
90
|
-
# 创建全局消息处理器实例
|
|
91
89
|
message = MessageHandler()
|
ErisPulse/Core/Event/meta.py
CHANGED
ErisPulse/Core/Event/notice.py
CHANGED
ErisPulse/Core/Event/request.py
CHANGED
ErisPulse/Core/__init__.py
CHANGED
|
@@ -2,7 +2,8 @@ from .adapter import AdapterFather, SendDSL, adapter
|
|
|
2
2
|
from .storage import storage
|
|
3
3
|
from .env import env
|
|
4
4
|
from .logger import logger
|
|
5
|
-
from .
|
|
5
|
+
from .module_registry import module_registry
|
|
6
|
+
from .module import module
|
|
6
7
|
from .router import router, adapter_server
|
|
7
8
|
from .config import config
|
|
8
9
|
from . import exceptions
|
|
@@ -13,15 +14,15 @@ BaseAdapter = AdapterFather
|
|
|
13
14
|
|
|
14
15
|
__all__ = [
|
|
15
16
|
'Event',
|
|
16
|
-
|
|
17
17
|
'BaseAdapter',
|
|
18
18
|
'AdapterFather',
|
|
19
19
|
'SendDSL',
|
|
20
20
|
'adapter',
|
|
21
|
+
'module',
|
|
21
22
|
'storage',
|
|
22
23
|
'env',
|
|
23
24
|
'logger',
|
|
24
|
-
'
|
|
25
|
+
'module_registry',
|
|
25
26
|
'exceptions',
|
|
26
27
|
'router',
|
|
27
28
|
'adapter_server',
|
ErisPulse/Core/logger.py
CHANGED
|
@@ -90,8 +90,8 @@ class Logger:
|
|
|
90
90
|
:param level: 日志级别(DEBUG/INFO/WARNING/ERROR/CRITICAL)
|
|
91
91
|
:return: bool 设置是否成功
|
|
92
92
|
"""
|
|
93
|
-
from .
|
|
94
|
-
if not
|
|
93
|
+
from .module_registry import module_registry
|
|
94
|
+
if not module_registry.get_module_status(module_name):
|
|
95
95
|
self._logger.warning(f"模块 {module_name} 未启用,无法设置日志等级。")
|
|
96
96
|
return False
|
|
97
97
|
level = level.upper()
|
ErisPulse/Core/module.py
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ErisPulse 模块管理模块
|
|
3
|
+
|
|
4
|
+
提供便捷的模块访问接口
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Any, Optional, Dict
|
|
8
|
+
from .module_registry import module_registry
|
|
9
|
+
from .logger import logger
|
|
10
|
+
|
|
11
|
+
class ModuleManager:
|
|
12
|
+
"""
|
|
13
|
+
模块管理器
|
|
14
|
+
|
|
15
|
+
提供便捷的模块访问接口,支持获取模块实例、检查模块状态等操作
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(self):
|
|
19
|
+
self._modules = {}
|
|
20
|
+
|
|
21
|
+
def get(self, module_name: str) -> Any:
|
|
22
|
+
"""
|
|
23
|
+
获取指定模块的实例
|
|
24
|
+
|
|
25
|
+
:param module_name: [str] 模块名称
|
|
26
|
+
:return: [Any] 模块实例或None
|
|
27
|
+
"""
|
|
28
|
+
# 是否已缓存
|
|
29
|
+
if module_name in self._modules:
|
|
30
|
+
return self._modules[module_name]
|
|
31
|
+
|
|
32
|
+
# 从模块注册表获取模块信息
|
|
33
|
+
module_info = module_registry.get_module(module_name)
|
|
34
|
+
if not module_info:
|
|
35
|
+
logger.warning(f"模块 {module_name} 未注册")
|
|
36
|
+
return None
|
|
37
|
+
|
|
38
|
+
# 模块是否启用
|
|
39
|
+
if not module_registry.get_module_status(module_name):
|
|
40
|
+
logger.warning(f"模块 {module_name} 已禁用")
|
|
41
|
+
return None
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
from .. import sdk
|
|
45
|
+
if hasattr(sdk, module_name):
|
|
46
|
+
module_instance = getattr(sdk, module_name)
|
|
47
|
+
self._modules[module_name] = module_instance
|
|
48
|
+
return module_instance
|
|
49
|
+
else:
|
|
50
|
+
logger.warning(f"模块 {module_name} 实例未找到")
|
|
51
|
+
return None
|
|
52
|
+
except Exception as e:
|
|
53
|
+
logger.error(f"获取模块 {module_name} 实例时出错: {e}")
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
def exists(self, module_name: str) -> bool:
|
|
57
|
+
"""
|
|
58
|
+
检查模块是否存在
|
|
59
|
+
|
|
60
|
+
:param module_name: [str] 模块名称
|
|
61
|
+
:return: [bool] 模块是否存在
|
|
62
|
+
"""
|
|
63
|
+
return module_registry.get_module(module_name) is not None
|
|
64
|
+
|
|
65
|
+
def is_enabled(self, module_name: str) -> bool:
|
|
66
|
+
"""
|
|
67
|
+
检查模块是否启用
|
|
68
|
+
|
|
69
|
+
:param module_name: [str] 模块名称
|
|
70
|
+
:return: [bool] 模块是否启用
|
|
71
|
+
"""
|
|
72
|
+
return module_registry.get_module_status(module_name)
|
|
73
|
+
|
|
74
|
+
def enable(self, module_name: str) -> bool:
|
|
75
|
+
"""
|
|
76
|
+
启用模块
|
|
77
|
+
|
|
78
|
+
:param module_name: [str] 模块名称
|
|
79
|
+
:return: [bool] 操作是否成功
|
|
80
|
+
"""
|
|
81
|
+
if not self.exists(module_name):
|
|
82
|
+
logger.error(f"模块 {module_name} 不存在")
|
|
83
|
+
return False
|
|
84
|
+
|
|
85
|
+
module_registry.set_module_status(module_name, True)
|
|
86
|
+
logger.info(f"模块 {module_name} 已启用")
|
|
87
|
+
return True
|
|
88
|
+
|
|
89
|
+
def disable(self, module_name: str) -> bool:
|
|
90
|
+
"""
|
|
91
|
+
禁用模块
|
|
92
|
+
|
|
93
|
+
:param module_name: [str] 模块名称
|
|
94
|
+
:return: [bool] 操作是否成功
|
|
95
|
+
"""
|
|
96
|
+
if not self.exists(module_name):
|
|
97
|
+
logger.error(f"模块 {module_name} 不存在")
|
|
98
|
+
return False
|
|
99
|
+
|
|
100
|
+
module_registry.set_module_status(module_name, False)
|
|
101
|
+
logger.info(f"模块 {module_name} 已禁用")
|
|
102
|
+
# 如果模块在缓存中,移除它
|
|
103
|
+
if module_name in self._modules:
|
|
104
|
+
del self._modules[module_name]
|
|
105
|
+
return True
|
|
106
|
+
|
|
107
|
+
def list_modules(self) -> Dict[str, Dict[str, Any]]:
|
|
108
|
+
"""
|
|
109
|
+
列出所有模块信息
|
|
110
|
+
|
|
111
|
+
:return: [Dict[str, Dict[str, Any]]] 模块信息字典
|
|
112
|
+
"""
|
|
113
|
+
return module_registry.get_all_modules()
|
|
114
|
+
|
|
115
|
+
def get_info(self, module_name: str) -> Optional[Dict[str, Any]]:
|
|
116
|
+
"""
|
|
117
|
+
获取模块详细信息
|
|
118
|
+
|
|
119
|
+
:param module_name: [str] 模块名称
|
|
120
|
+
:return: [Optional[Dict[str, Any]]] 模块信息字典
|
|
121
|
+
"""
|
|
122
|
+
return module_registry.get_module(module_name)
|
|
123
|
+
|
|
124
|
+
def __getattr__(self, module_name: str) -> Any:
|
|
125
|
+
"""
|
|
126
|
+
通过属性访问获取模块实例
|
|
127
|
+
|
|
128
|
+
:param module_name: [str] 模块名称
|
|
129
|
+
:return: [Any] 模块实例
|
|
130
|
+
:raises AttributeError: 当模块不存在或未启用时
|
|
131
|
+
"""
|
|
132
|
+
module_instance = self.get(module_name)
|
|
133
|
+
if module_instance is None:
|
|
134
|
+
raise AttributeError(f"模块 {module_name} 不存在或未启用")
|
|
135
|
+
return module_instance
|
|
136
|
+
|
|
137
|
+
def __contains__(self, module_name: str) -> bool:
|
|
138
|
+
"""
|
|
139
|
+
检查模块是否存在且处于启用状态
|
|
140
|
+
|
|
141
|
+
:param module_name: [str] 模块名称
|
|
142
|
+
:return: [bool] 模块是否存在且启用
|
|
143
|
+
"""
|
|
144
|
+
return self.exists(module_name) and self.is_enabled(module_name)
|
|
145
|
+
|
|
146
|
+
module = ModuleManager()
|
|
147
|
+
|
|
148
|
+
__all__ = [
|
|
149
|
+
"module"
|
|
150
|
+
]
|
|
@@ -10,19 +10,18 @@ ErisPulse 模块管理器
|
|
|
10
10
|
{!--< /tips >!--}
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
|
-
import json
|
|
14
13
|
from typing import Dict, Optional, Any, List, Set, Tuple, Union, Type, FrozenSet
|
|
15
14
|
|
|
16
|
-
class
|
|
15
|
+
class ModuleRegistry:
|
|
17
16
|
"""
|
|
18
|
-
|
|
17
|
+
ErisPulse 模块注册表
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
管理所有模块的注册信息和启用状态
|
|
21
20
|
|
|
22
21
|
{!--< tips >!--}
|
|
23
|
-
1.
|
|
24
|
-
2.
|
|
25
|
-
3.
|
|
22
|
+
1. 模块信息通过 set_module/get_module 管理
|
|
23
|
+
2. 模块状态通过 set_module_status/get_module_status 控制
|
|
24
|
+
3. 支持批量操作模块信息
|
|
26
25
|
{!--< /tips >!--}
|
|
27
26
|
"""
|
|
28
27
|
|
|
@@ -66,14 +65,14 @@ class ModuleManager:
|
|
|
66
65
|
"""
|
|
67
66
|
设置模块启用状态
|
|
68
67
|
|
|
69
|
-
:param module_name: 模块名称
|
|
70
|
-
:param status: 启用状态
|
|
68
|
+
:param module_name: [str] 模块名称
|
|
69
|
+
:param status: [bool] 启用状态 (True=启用, False=禁用)
|
|
71
70
|
|
|
72
71
|
:example:
|
|
73
72
|
>>> # 启用模块
|
|
74
|
-
>>>
|
|
73
|
+
>>> module_registry.set_module_status("MyModule", True)
|
|
75
74
|
>>> # 禁用模块
|
|
76
|
-
>>>
|
|
75
|
+
>>> module_registry.set_module_status("MyModule", False)
|
|
77
76
|
"""
|
|
78
77
|
from .logger import logger
|
|
79
78
|
self.storage.set(f"{self.status_prefix}{module_name}", bool(status))
|
|
@@ -83,11 +82,11 @@ class ModuleManager:
|
|
|
83
82
|
"""
|
|
84
83
|
获取模块启用状态
|
|
85
84
|
|
|
86
|
-
:param module_name: 模块名称
|
|
87
|
-
:return: 模块是否启用
|
|
85
|
+
:param module_name: [str] 模块名称
|
|
86
|
+
:return: [bool] 模块是否启用
|
|
88
87
|
|
|
89
88
|
:example:
|
|
90
|
-
>>> if
|
|
89
|
+
>>> if module_registry.get_module_status("MyModule"):
|
|
91
90
|
>>> print("模块已启用")
|
|
92
91
|
"""
|
|
93
92
|
status = self.storage.get(f"{self.status_prefix}{module_name}", True)
|
|
@@ -97,15 +96,19 @@ class ModuleManager:
|
|
|
97
96
|
|
|
98
97
|
def set_module(self, module_name: str, module_info: Dict[str, Any]) -> None:
|
|
99
98
|
"""
|
|
100
|
-
|
|
99
|
+
注册或更新模块信息
|
|
101
100
|
|
|
102
|
-
:param module_name: 模块名称
|
|
103
|
-
:param module_info: 模块信息字典
|
|
101
|
+
:param module_name: [str] 模块名称
|
|
102
|
+
:param module_info: [Dict[str, Any]] 模块信息字典
|
|
103
|
+
必须包含 version 和 description 字段
|
|
104
104
|
|
|
105
105
|
:example:
|
|
106
|
-
>>>
|
|
106
|
+
>>> module_registry.set_module("MyModule", {
|
|
107
107
|
>>> "version": "1.0.0",
|
|
108
108
|
>>> "description": "我的模块",
|
|
109
|
+
>>> "dependencies": [],
|
|
110
|
+
>>> "author": "开发者",
|
|
111
|
+
>>> "license": "MIT"
|
|
109
112
|
>>> })
|
|
110
113
|
"""
|
|
111
114
|
self.storage.set(f"{self.module_prefix}{module_name}", module_info)
|
|
@@ -114,11 +117,11 @@ class ModuleManager:
|
|
|
114
117
|
"""
|
|
115
118
|
获取模块信息
|
|
116
119
|
|
|
117
|
-
:param module_name: 模块名称
|
|
118
|
-
:return: 模块信息字典或None
|
|
120
|
+
:param module_name: [str] 模块名称
|
|
121
|
+
:return: [Optional[Dict[str, Any]]] 模块信息字典或None
|
|
119
122
|
|
|
120
123
|
:example:
|
|
121
|
-
>>> module_info =
|
|
124
|
+
>>> module_info = module_registry.get_module("MyModule")
|
|
122
125
|
>>> if module_info:
|
|
123
126
|
>>> print(f"模块版本: {module_info.get('version')}")
|
|
124
127
|
"""
|
|
@@ -126,12 +129,13 @@ class ModuleManager:
|
|
|
126
129
|
|
|
127
130
|
def set_all_modules(self, modules_info: Dict[str, Dict[str, Any]]) -> None:
|
|
128
131
|
"""
|
|
129
|
-
|
|
132
|
+
批量设置模块信息
|
|
130
133
|
|
|
131
|
-
:param modules_info: 模块信息字典
|
|
134
|
+
:param modules_info: [Dict[str, Dict[str, Any]]] 模块信息字典
|
|
135
|
+
格式: {模块名: 模块信息}
|
|
132
136
|
|
|
133
137
|
:example:
|
|
134
|
-
>>>
|
|
138
|
+
>>> module_registry.set_all_modules({
|
|
135
139
|
>>> "Module1": {"version": "1.0", "status": True},
|
|
136
140
|
>>> "Module2": {"version": "2.0", "status": False}
|
|
137
141
|
>>> })
|
|
@@ -141,12 +145,12 @@ class ModuleManager:
|
|
|
141
145
|
|
|
142
146
|
def get_all_modules(self) -> Dict[str, Dict[str, Any]]:
|
|
143
147
|
"""
|
|
144
|
-
|
|
148
|
+
获取所有已注册模块信息
|
|
145
149
|
|
|
146
|
-
:return:
|
|
150
|
+
:return: [Dict[str, Dict[str, Any]]] 所有模块信息字典
|
|
147
151
|
|
|
148
152
|
:example:
|
|
149
|
-
>>> all_modules =
|
|
153
|
+
>>> all_modules = module_registry.get_all_modules()
|
|
150
154
|
>>> for name, info in all_modules.items():
|
|
151
155
|
>>> print(f"{name}: {info.get('status')}")
|
|
152
156
|
"""
|
|
@@ -173,13 +177,13 @@ class ModuleManager:
|
|
|
173
177
|
|
|
174
178
|
def remove_module(self, module_name: str) -> bool:
|
|
175
179
|
"""
|
|
176
|
-
|
|
180
|
+
移除模块注册信息
|
|
177
181
|
|
|
178
|
-
:param module_name: 模块名称
|
|
179
|
-
:return: 是否成功移除
|
|
182
|
+
:param module_name: [str] 模块名称
|
|
183
|
+
:return: [bool] 是否成功移除
|
|
180
184
|
|
|
181
185
|
:example:
|
|
182
|
-
>>> if
|
|
186
|
+
>>> if module_registry.remove_module("OldModule"):
|
|
183
187
|
>>> print("模块已移除")
|
|
184
188
|
"""
|
|
185
189
|
module_key = f"{self.module_prefix}{module_name}"
|
|
@@ -193,14 +197,14 @@ class ModuleManager:
|
|
|
193
197
|
|
|
194
198
|
def update_prefixes(self, module_prefix: Optional[str] = None, status_prefix: Optional[str] = None) -> None:
|
|
195
199
|
"""
|
|
196
|
-
|
|
200
|
+
更新模块存储前缀配置
|
|
197
201
|
|
|
198
|
-
:param module_prefix:
|
|
199
|
-
:param status_prefix:
|
|
202
|
+
:param module_prefix: [Optional[str]] 模块数据前缀 (默认: "erispulse.data.modules.info:")
|
|
203
|
+
:param status_prefix: [Optional[str]] 模块状态前缀 (默认: "erispulse.data.modules.status:")
|
|
200
204
|
|
|
201
205
|
:example:
|
|
202
206
|
>>> # 更新模块前缀
|
|
203
|
-
>>>
|
|
207
|
+
>>> module_registry.update_prefixes(
|
|
204
208
|
>>> module_prefix="custom.module.data:",
|
|
205
209
|
>>> status_prefix="custom.module.status:"
|
|
206
210
|
>>> )
|
|
@@ -216,8 +220,8 @@ class ModuleManager:
|
|
|
216
220
|
self.storage.set("erispulse.system.status_prefix", status_prefix)
|
|
217
221
|
|
|
218
222
|
|
|
219
|
-
|
|
223
|
+
module_registry = ModuleRegistry()
|
|
220
224
|
|
|
221
225
|
__all__ = [
|
|
222
|
-
"
|
|
226
|
+
"module_registry",
|
|
223
227
|
]
|
ErisPulse/__init__.py
CHANGED
|
@@ -10,9 +10,6 @@ ErisPulse SDK 主模块
|
|
|
10
10
|
{!--< /tips >!--}
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
|
-
__version__ = "2.1.15-dev.4"
|
|
14
|
-
__author__ = "ErisPulse"
|
|
15
|
-
|
|
16
13
|
import os
|
|
17
14
|
import sys
|
|
18
15
|
import importlib
|
|
@@ -26,13 +23,20 @@ from pathlib import Path
|
|
|
26
23
|
from .Core import logger
|
|
27
24
|
from .Core import storage
|
|
28
25
|
from .Core import env
|
|
29
|
-
from .Core import
|
|
26
|
+
from .Core import module_registry
|
|
30
27
|
from .Core import adapter, AdapterFather, SendDSL
|
|
28
|
+
from .Core import module
|
|
31
29
|
from .Core import router, adapter_server
|
|
32
30
|
from .Core import exceptions
|
|
33
31
|
from .Core import config
|
|
34
32
|
from .Core import Event
|
|
35
33
|
|
|
34
|
+
try:
|
|
35
|
+
__version__ = importlib.metadata.version('ErisPulse')
|
|
36
|
+
except importlib.metadata.PackageNotFoundError:
|
|
37
|
+
logger.critical("未找到ErisPulse版本信息,请检查是否正确安装ErisPulse")
|
|
38
|
+
__author__ = "ErisPulse"
|
|
39
|
+
|
|
36
40
|
sdk = sys.modules[__name__]
|
|
37
41
|
|
|
38
42
|
BaseModules = {
|
|
@@ -42,8 +46,9 @@ BaseModules = {
|
|
|
42
46
|
"exceptions": exceptions,
|
|
43
47
|
"storage": storage,
|
|
44
48
|
"env": env,
|
|
45
|
-
"
|
|
49
|
+
"module_registry": module_registry,
|
|
46
50
|
"adapter": adapter,
|
|
51
|
+
"module": module,
|
|
47
52
|
"router": router,
|
|
48
53
|
"adapter_server": adapter_server,
|
|
49
54
|
"SendDSL": SendDSL,
|
|
@@ -256,7 +261,7 @@ class AdapterLoader:
|
|
|
256
261
|
:raises ImportError: 当适配器加载失败时抛出
|
|
257
262
|
"""
|
|
258
263
|
meta_name = entry_point.name
|
|
259
|
-
adapter_status =
|
|
264
|
+
adapter_status = module_registry.get_module_status(meta_name)
|
|
260
265
|
logger.debug(f"适配器 {meta_name} 状态: {adapter_status}")
|
|
261
266
|
|
|
262
267
|
if adapter_status is False:
|
|
@@ -287,7 +292,7 @@ class AdapterLoader:
|
|
|
287
292
|
adapter_obj.adapterInfo[meta_name] = adapter_info
|
|
288
293
|
|
|
289
294
|
# 存储适配器信息
|
|
290
|
-
|
|
295
|
+
module_registry.set_module(meta_name, adapter_info)
|
|
291
296
|
|
|
292
297
|
adapter_objs[meta_name] = adapter_obj
|
|
293
298
|
enabled_adapters.append(meta_name)
|
|
@@ -371,7 +376,7 @@ class ModuleLoader:
|
|
|
371
376
|
:raises ImportError: 当模块加载失败时抛出
|
|
372
377
|
"""
|
|
373
378
|
meta_name = entry_point.name
|
|
374
|
-
module_status =
|
|
379
|
+
module_status = module_registry.get_module_status(meta_name)
|
|
375
380
|
logger.debug(f"模块 {meta_name} 状态: {module_status}")
|
|
376
381
|
|
|
377
382
|
# 首先检查模块状态,如果明确为False则直接跳过
|
|
@@ -403,7 +408,7 @@ class ModuleLoader:
|
|
|
403
408
|
module_obj.moduleInfo = module_info
|
|
404
409
|
|
|
405
410
|
# 存储模块信息
|
|
406
|
-
|
|
411
|
+
module_registry.set_module(meta_name, module_info)
|
|
407
412
|
|
|
408
413
|
module_objs[meta_name] = module_obj
|
|
409
414
|
enabled_modules.append(meta_name)
|
ErisPulse/__main__.py
CHANGED
|
@@ -249,8 +249,8 @@ class PackageManager:
|
|
|
249
249
|
:raises ImportError: 核心模块不可用时抛出
|
|
250
250
|
"""
|
|
251
251
|
try:
|
|
252
|
-
from ErisPulse.Core import
|
|
253
|
-
return
|
|
252
|
+
from ErisPulse.Core import module_registry
|
|
253
|
+
return module_registry.get_module_status(module_name)
|
|
254
254
|
except ImportError:
|
|
255
255
|
return True
|
|
256
256
|
except Exception:
|
|
@@ -1718,21 +1718,21 @@ class CLI:
|
|
|
1718
1718
|
sys.exit(1)
|
|
1719
1719
|
|
|
1720
1720
|
elif args.command == "module":
|
|
1721
|
-
from ErisPulse.Core import
|
|
1721
|
+
from ErisPulse.Core import module_registry
|
|
1722
1722
|
installed = self.package_manager.get_installed_packages()
|
|
1723
1723
|
|
|
1724
1724
|
if args.module_command == "enable":
|
|
1725
1725
|
if args.module not in installed["modules"]:
|
|
1726
1726
|
console.print(f"[error]模块 [bold]{args.module}[/] 不存在或未安装[/]")
|
|
1727
1727
|
else:
|
|
1728
|
-
|
|
1728
|
+
module_registry.set_module_status(args.module, True)
|
|
1729
1729
|
console.print(f"[success]模块 [bold]{args.module}[/] 已启用[/]")
|
|
1730
1730
|
|
|
1731
1731
|
elif args.module_command == "disable":
|
|
1732
1732
|
if args.module not in installed["modules"]:
|
|
1733
1733
|
console.print(f"[error]模块 [bold]{args.module}[/] 不存在或未安装[/]")
|
|
1734
1734
|
else:
|
|
1735
|
-
|
|
1735
|
+
module_registry.set_module_status(args.module, False)
|
|
1736
1736
|
console.print(f"[warning]模块 [bold]{args.module}[/] 已禁用[/]")
|
|
1737
1737
|
else:
|
|
1738
1738
|
self.parser.parse_args(["module", "--help"])
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
ErisPulse/__init__.py,sha256=L-YLh-5qMYydReBiBO9weceeH7PVv2ONBo40o5ekr3Y,27133
|
|
2
|
+
ErisPulse/__main__.py,sha256=GUh_30fEkWmE0udDFe1Kkwf41hg2v4WgbRY1RswJ9Uc,76331
|
|
3
|
+
ErisPulse/Core/__init__.py,sha256=96QS7gD0QNt27wQkIprye7y_Nja_IH2XUqPstZ4uLsY,589
|
|
4
|
+
ErisPulse/Core/adapter.py,sha256=y75u_heNmpYLDjIBtVTfMzTHZFixWtYFv0JVskNI-2w,18300
|
|
5
|
+
ErisPulse/Core/config.py,sha256=y0ChfCuw-6jAqs9Ii2tPJg0e4A765qzQLRcK6O8zh4c,2425
|
|
6
|
+
ErisPulse/Core/env.py,sha256=IT_6Xks5Ka089O_4SVTvYNIC9Ly1IHX_Esb3SsleRj8,338
|
|
7
|
+
ErisPulse/Core/erispulse_config.py,sha256=QDx401hNX9JcSHqCSVK33X6VTubl6HI1znAK3T_J0K0,3034
|
|
8
|
+
ErisPulse/Core/exceptions.py,sha256=zuTREGczwGzbYT4Z6dACqHwgNRpiJeLFR8aCxFdOg7k,3667
|
|
9
|
+
ErisPulse/Core/logger.py,sha256=g8HgpzK3k-WpnuiU_UQKWdw4s7BLLHOS23uDFrO_7W8,11285
|
|
10
|
+
ErisPulse/Core/module.py,sha256=wCIFC3qHukeu7DSj8TuNMw8s_gzTwk7_coM4oflmieA,4680
|
|
11
|
+
ErisPulse/Core/module_registry.py,sha256=BeOQwh3Pwv2fceBLJEObF6Ek65td0VOFzv3L0aEudXY,7740
|
|
12
|
+
ErisPulse/Core/router.py,sha256=s2EBh2qpt3UXYhB06Ppc1XTFuZ3u0ZfXENJxwkgPoq8,8542
|
|
13
|
+
ErisPulse/Core/storage.py,sha256=oRum4eVaTc3yxcaafggoIvrk41LPbvApSCxkGM3YmzU,17904
|
|
14
|
+
ErisPulse/Core/Event/__init__.py,sha256=xndqrBPwIrvS8rspy8c_4We6sfrjNCFBJNmcBuMv0NU,1019
|
|
15
|
+
ErisPulse/Core/Event/base.py,sha256=cr7FEaSnxxpAKNMR9a4RkX6xX5BiqndsMwBZV_me4W8,3741
|
|
16
|
+
ErisPulse/Core/Event/cmd.py,sha256=iiKcvHFYYj_1ZnhmFJ0Ow4X96MjwSYIrGW_IWw0Z74w,6909
|
|
17
|
+
ErisPulse/Core/Event/exceptions.py,sha256=iGcuPaC7F4cZeujcvBdZb9bzQGnHBdb9CcPKoB760Bo,711
|
|
18
|
+
ErisPulse/Core/Event/manager.py,sha256=S__BVAyGbY41W4ocPiTQ00BDaPxH-kj0lWoLl2Q3MRw,4225
|
|
19
|
+
ErisPulse/Core/Event/message.py,sha256=TBDmeribhCRQrV6M0Df_815PgBwneap1-e0xc9IvT9k,2581
|
|
20
|
+
ErisPulse/Core/Event/meta.py,sha256=ThUrYhTDPjzy3XwlMEGTFTzQBOV7-irtIvbPEe76Mk4,2243
|
|
21
|
+
ErisPulse/Core/Event/notice.py,sha256=lnPJCTfAe5xviO-IkpCkcP8UhaAEJ3FvtBbNmoS9Ji4,2789
|
|
22
|
+
ErisPulse/Core/Event/request.py,sha256=Ri46OFYu7jkFeRqS4kHD_6j7KCpOdmDNjrxAki5YsWQ,1817
|
|
23
|
+
erispulse-2.2.0.dev1.dist-info/METADATA,sha256=9W2b-GP4uSM5IO4xV_owvZJcPUJmvT2EgsXrggvMjUY,7290
|
|
24
|
+
erispulse-2.2.0.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
25
|
+
erispulse-2.2.0.dev1.dist-info/entry_points.txt,sha256=Jss71M6nEha0TA-DyVZugPYdcL14s9QpiOeIlgWxzOc,182
|
|
26
|
+
erispulse-2.2.0.dev1.dist-info/licenses/LICENSE,sha256=b2XwzcfWuv_36Op3xGdjcuPHgfCz62yT3bXYjfStpxY,1852
|
|
27
|
+
erispulse-2.2.0.dev1.dist-info/RECORD,,
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
ErisPulse/__init__.py,sha256=c9pE-jRF89x4p5GF3QNU7wFxkli39tCOR_PyD_Tr8qQ,26834
|
|
2
|
-
ErisPulse/__main__.py,sha256=HTq7Y7446eukTCHDX2_O9Ie8i-A7KHUCEJCmxx_j5co,76276
|
|
3
|
-
ErisPulse/Core/__init__.py,sha256=gl-0UAI5_syGt1_23Lgy8P3vGjGxusWfYnTi281f5qI,520
|
|
4
|
-
ErisPulse/Core/adapter.py,sha256=y75u_heNmpYLDjIBtVTfMzTHZFixWtYFv0JVskNI-2w,18300
|
|
5
|
-
ErisPulse/Core/config.py,sha256=y0ChfCuw-6jAqs9Ii2tPJg0e4A765qzQLRcK6O8zh4c,2425
|
|
6
|
-
ErisPulse/Core/env.py,sha256=IT_6Xks5Ka089O_4SVTvYNIC9Ly1IHX_Esb3SsleRj8,338
|
|
7
|
-
ErisPulse/Core/erispulse_config.py,sha256=QDx401hNX9JcSHqCSVK33X6VTubl6HI1znAK3T_J0K0,3034
|
|
8
|
-
ErisPulse/Core/exceptions.py,sha256=zuTREGczwGzbYT4Z6dACqHwgNRpiJeLFR8aCxFdOg7k,3667
|
|
9
|
-
ErisPulse/Core/logger.py,sha256=6p53nQE7NFXSqs_lftW-HQB1BQcgruAYOpIYx25QLVA,11252
|
|
10
|
-
ErisPulse/Core/mods.py,sha256=vKLEDr2nQ4kUULHmUQYFbRL04ePIKlwLEOGB-ldMYS8,7130
|
|
11
|
-
ErisPulse/Core/router.py,sha256=s2EBh2qpt3UXYhB06Ppc1XTFuZ3u0ZfXENJxwkgPoq8,8542
|
|
12
|
-
ErisPulse/Core/storage.py,sha256=oRum4eVaTc3yxcaafggoIvrk41LPbvApSCxkGM3YmzU,17904
|
|
13
|
-
ErisPulse/Core/Event/__init__.py,sha256=fgK9bskLqVYau9ORfhGNBxSBJo7oZheeSYvwucigpEU,1042
|
|
14
|
-
ErisPulse/Core/Event/base.py,sha256=NQb9_mA7OwxCGbcpunOQD_aV9Zq3i7xLQ1AzKM-ebl8,3758
|
|
15
|
-
ErisPulse/Core/Event/cmd.py,sha256=B7c-PUaCn5qhubCqgI1pDSvvjofTLQHzmBaD0TuqJF4,6964
|
|
16
|
-
ErisPulse/Core/Event/exceptions.py,sha256=iGcuPaC7F4cZeujcvBdZb9bzQGnHBdb9CcPKoB760Bo,711
|
|
17
|
-
ErisPulse/Core/Event/manager.py,sha256=xIdK29jY2h-cCLFeq7JqPxuzYvuU7jAPdJMq2CPgwcQ,4270
|
|
18
|
-
ErisPulse/Core/Event/message.py,sha256=n5ObSaGmyU3z5QSM5-5VwOBr69FY7p4TdRoy6Xy0Nzg,2640
|
|
19
|
-
ErisPulse/Core/Event/meta.py,sha256=tr5aKoFtqCjybkpbUJ6JfuppZTk34eAipGvggPkGeSs,2282
|
|
20
|
-
ErisPulse/Core/Event/notice.py,sha256=YLe5OphsF4sf1nvOokQ9bgCpCRf6MuGKRa1QjWotiK8,2825
|
|
21
|
-
ErisPulse/Core/Event/request.py,sha256=FOkbW9WcUnc2uywkUWfUim4xJXXmlY1gYK6SD8Cd7So,1853
|
|
22
|
-
erispulse-2.2.0.dev0.dist-info/METADATA,sha256=38Qx-4vuxUcOKVRUHlxg9qV76NE6QQtUtgsS9txSU6k,7290
|
|
23
|
-
erispulse-2.2.0.dev0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
24
|
-
erispulse-2.2.0.dev0.dist-info/entry_points.txt,sha256=Jss71M6nEha0TA-DyVZugPYdcL14s9QpiOeIlgWxzOc,182
|
|
25
|
-
erispulse-2.2.0.dev0.dist-info/licenses/LICENSE,sha256=b2XwzcfWuv_36Op3xGdjcuPHgfCz62yT3bXYjfStpxY,1852
|
|
26
|
-
erispulse-2.2.0.dev0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|