ErisPulse 2.3.3.dev0__py3-none-any.whl → 2.3.4.dev2__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/CLI/__init__.py +11 -0
- ErisPulse/CLI/__init__.pyi +13 -0
- ErisPulse/CLI/base.py +52 -0
- ErisPulse/CLI/base.pyi +50 -0
- ErisPulse/CLI/cli.py +224 -0
- ErisPulse/CLI/cli.pyi +80 -0
- ErisPulse/CLI/commands/__init__.py +6 -0
- ErisPulse/CLI/commands/__init__.pyi +12 -0
- ErisPulse/CLI/commands/init.py +395 -0
- ErisPulse/CLI/commands/init.pyi +70 -0
- ErisPulse/CLI/commands/install.py +302 -0
- ErisPulse/CLI/commands/install.pyi +58 -0
- ErisPulse/CLI/commands/list.py +160 -0
- ErisPulse/CLI/commands/list.pyi +44 -0
- ErisPulse/CLI/commands/list_remote.py +123 -0
- ErisPulse/CLI/commands/list_remote.pyi +35 -0
- ErisPulse/CLI/commands/run.py +108 -0
- ErisPulse/CLI/commands/run.pyi +39 -0
- ErisPulse/CLI/commands/self_update.py +232 -0
- ErisPulse/CLI/commands/self_update.pyi +47 -0
- ErisPulse/CLI/commands/uninstall.py +32 -0
- ErisPulse/CLI/commands/uninstall.pyi +24 -0
- ErisPulse/CLI/commands/upgrade.py +56 -0
- ErisPulse/CLI/commands/upgrade.pyi +25 -0
- ErisPulse/CLI/console.pyi +20 -0
- ErisPulse/CLI/registry.py +112 -0
- ErisPulse/CLI/registry.pyi +99 -0
- ErisPulse/{utils → CLI/utils}/__init__.py +2 -6
- ErisPulse/CLI/utils/__init__.pyi +14 -0
- ErisPulse/{utils → CLI/utils}/package_manager.py +146 -20
- ErisPulse/CLI/utils/package_manager.pyi +241 -0
- ErisPulse/{utils → CLI/utils}/reload_handler.py +7 -8
- ErisPulse/CLI/utils/reload_handler.pyi +64 -0
- ErisPulse/Core/Bases/__init__.pyi +14 -0
- ErisPulse/Core/Bases/adapter.py +13 -1
- ErisPulse/Core/Bases/adapter.pyi +140 -0
- ErisPulse/Core/Bases/manager.py +136 -0
- ErisPulse/Core/Bases/manager.pyi +108 -0
- ErisPulse/Core/Bases/module.py +53 -1
- ErisPulse/Core/Bases/module.pyi +95 -0
- ErisPulse/Core/Event/__init__.pyi +26 -0
- ErisPulse/Core/Event/base.pyi +62 -0
- ErisPulse/Core/Event/command.py +6 -1
- ErisPulse/Core/Event/command.pyi +113 -0
- ErisPulse/Core/Event/exceptions.pyi +43 -0
- ErisPulse/Core/Event/message.pyi +93 -0
- ErisPulse/Core/Event/meta.pyi +92 -0
- ErisPulse/Core/Event/notice.pyi +108 -0
- ErisPulse/Core/Event/request.pyi +76 -0
- ErisPulse/Core/Event/wrapper.py +2 -3
- ErisPulse/Core/Event/wrapper.pyi +403 -0
- ErisPulse/Core/__init__.py +16 -13
- ErisPulse/Core/__init__.pyi +16 -0
- ErisPulse/Core/_self_config.py +1 -1
- ErisPulse/Core/_self_config.pyi +72 -0
- ErisPulse/Core/adapter.py +70 -10
- ErisPulse/Core/adapter.pyi +246 -0
- ErisPulse/Core/config.pyi +70 -0
- ErisPulse/Core/exceptions.py +4 -2
- ErisPulse/Core/exceptions.pyi +60 -0
- ErisPulse/Core/lifecycle.py +15 -1
- ErisPulse/Core/lifecycle.pyi +92 -0
- ErisPulse/Core/logger.py +21 -15
- ErisPulse/Core/logger.pyi +169 -0
- ErisPulse/Core/module.py +57 -9
- ErisPulse/Core/module.pyi +189 -0
- ErisPulse/Core/router.py +13 -5
- ErisPulse/Core/router.pyi +120 -0
- ErisPulse/Core/storage.py +94 -256
- ErisPulse/Core/storage.pyi +220 -0
- ErisPulse/__init__.py +35 -1236
- ErisPulse/__init__.pyi +22 -0
- ErisPulse/__main__.py +1 -1
- ErisPulse/__main__.pyi +24 -0
- ErisPulse/loaders/__init__.py +22 -0
- ErisPulse/loaders/__init__.pyi +21 -0
- ErisPulse/loaders/adapter_loader.py +187 -0
- ErisPulse/loaders/adapter_loader.pyi +82 -0
- ErisPulse/loaders/base_loader.py +162 -0
- ErisPulse/loaders/base_loader.pyi +23 -0
- ErisPulse/loaders/initializer.py +150 -0
- ErisPulse/loaders/initializer.pyi +60 -0
- ErisPulse/loaders/module_loader.py +618 -0
- ErisPulse/loaders/module_loader.pyi +179 -0
- ErisPulse/loaders/strategy.py +129 -0
- ErisPulse/loaders/strategy.pyi +90 -0
- ErisPulse/sdk.py +435 -0
- ErisPulse/sdk.pyi +158 -0
- {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/METADATA +6 -20
- erispulse-2.3.4.dev2.dist-info/RECORD +103 -0
- {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/licenses/LICENSE +3 -3
- ErisPulse/Core/ux.py +0 -635
- ErisPulse/utils/cli.py +0 -1097
- erispulse-2.3.3.dev0.dist-info/RECORD +0 -35
- /ErisPulse/{utils → CLI}/console.py +0 -0
- {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/WHEEL +0 -0
- {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ErisPulse 初始化协调器
|
|
3
|
+
|
|
4
|
+
负责协调适配器和模块的加载流程
|
|
5
|
+
|
|
6
|
+
{!--< tips >!--}
|
|
7
|
+
1. 初始化顺序:适配器 → 模块
|
|
8
|
+
2. 支持并行加载优化
|
|
9
|
+
3. 统一的错误处理和事件提交
|
|
10
|
+
{!--< /tips >!--}
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import asyncio
|
|
14
|
+
from typing import List, Dict, Any, Optional
|
|
15
|
+
from .adapter_loader import AdapterLoader
|
|
16
|
+
from .module_loader import ModuleLoader
|
|
17
|
+
from ..Core.logger import logger
|
|
18
|
+
from ..Core.lifecycle import lifecycle
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Initializer:
|
|
22
|
+
"""
|
|
23
|
+
初始化协调器
|
|
24
|
+
|
|
25
|
+
协调适配器和模块的加载流程,提供统一的初始化接口
|
|
26
|
+
|
|
27
|
+
{!--< tips >!--}
|
|
28
|
+
使用方式:
|
|
29
|
+
>>> initializer = Initializer(sdk_instance)
|
|
30
|
+
>>> success = await initializer.init()
|
|
31
|
+
{!--< /tips >!--}
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
def __init__(self, sdk_instance: Any):
|
|
35
|
+
"""
|
|
36
|
+
初始化协调器
|
|
37
|
+
|
|
38
|
+
:param sdk_instance: SDK 实例
|
|
39
|
+
"""
|
|
40
|
+
self._sdk = sdk_instance
|
|
41
|
+
self._adapter_loader = AdapterLoader()
|
|
42
|
+
self._module_loader = ModuleLoader()
|
|
43
|
+
|
|
44
|
+
async def init(self) -> bool:
|
|
45
|
+
"""
|
|
46
|
+
初始化所有模块和适配器
|
|
47
|
+
|
|
48
|
+
执行步骤:
|
|
49
|
+
1. 从 PyPI 包加载适配器
|
|
50
|
+
2. 从 PyPI 包加载模块
|
|
51
|
+
3. 注册适配器
|
|
52
|
+
4. 注册模块
|
|
53
|
+
5. 初始化模块
|
|
54
|
+
|
|
55
|
+
:return: bool 初始化是否成功
|
|
56
|
+
|
|
57
|
+
:raises ImportError: 当加载失败时抛出
|
|
58
|
+
"""
|
|
59
|
+
logger.info("[Init] SDK 正在初始化...")
|
|
60
|
+
lifecycle.start_timer("core.init")
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
# 1. 并行加载适配器和模块
|
|
64
|
+
adapter_manager = self._sdk.adapter
|
|
65
|
+
module_manager = self._sdk.module
|
|
66
|
+
|
|
67
|
+
(adapter_result, module_result) = await asyncio.gather(
|
|
68
|
+
self._adapter_loader.load(adapter_manager),
|
|
69
|
+
self._module_loader.load(module_manager),
|
|
70
|
+
return_exceptions=True
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# 检查是否有异常
|
|
74
|
+
if isinstance(adapter_result, Exception):
|
|
75
|
+
logger.error(f"[Init] 适配器加载失败: {adapter_result}")
|
|
76
|
+
return False
|
|
77
|
+
|
|
78
|
+
if isinstance(module_result, Exception):
|
|
79
|
+
logger.error(f"[Init] 模块加载失败: {module_result}")
|
|
80
|
+
return False
|
|
81
|
+
|
|
82
|
+
# 解包结果
|
|
83
|
+
adapter_objs, enabled_adapters, disabled_adapters = adapter_result # type: ignore
|
|
84
|
+
module_objs, enabled_modules, disabled_modules = module_result # type: ignore
|
|
85
|
+
|
|
86
|
+
logger.info(f"[Init] 加载了 {len(enabled_adapters)} 个适配器, {len(disabled_adapters)} 个适配器被禁用")
|
|
87
|
+
logger.info(f"[Init] 加载了 {len(enabled_modules)} 个模块, {len(disabled_modules)} 个模块被禁用")
|
|
88
|
+
|
|
89
|
+
# 2. 注册适配器
|
|
90
|
+
logger.debug("[Init] 正在注册适配器...")
|
|
91
|
+
if not await self._adapter_loader.register_to_manager(
|
|
92
|
+
enabled_adapters, adapter_objs, adapter_manager
|
|
93
|
+
):
|
|
94
|
+
return False
|
|
95
|
+
|
|
96
|
+
# 3. 注册模块
|
|
97
|
+
logger.debug("[Init] 正在注册模块...")
|
|
98
|
+
if not await self._module_loader.register_to_manager(
|
|
99
|
+
enabled_modules, module_objs, module_manager
|
|
100
|
+
):
|
|
101
|
+
return False
|
|
102
|
+
|
|
103
|
+
# 4. 初始化模块(创建实例并挂载到 SDK)
|
|
104
|
+
logger.debug("[Init] 正在初始化模块...")
|
|
105
|
+
success = await self._module_loader.initialize_modules(
|
|
106
|
+
enabled_modules, module_objs, module_manager, self._sdk
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
if success:
|
|
110
|
+
logger.info("[Init] SDK初始化成功")
|
|
111
|
+
else:
|
|
112
|
+
logger.error("[Init] SDK初始化失败")
|
|
113
|
+
|
|
114
|
+
load_duration = lifecycle.stop_timer("core.init")
|
|
115
|
+
await lifecycle.submit_event(
|
|
116
|
+
"core.init.complete",
|
|
117
|
+
msg="模块初始化完成" if success else "模块初始化失败",
|
|
118
|
+
data={
|
|
119
|
+
"duration": load_duration,
|
|
120
|
+
"success": success,
|
|
121
|
+
"adapters": {
|
|
122
|
+
"enabled": enabled_adapters,
|
|
123
|
+
"disabled": disabled_adapters
|
|
124
|
+
},
|
|
125
|
+
"modules": {
|
|
126
|
+
"enabled": enabled_modules,
|
|
127
|
+
"disabled": disabled_modules
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
return success
|
|
132
|
+
|
|
133
|
+
except Exception as e:
|
|
134
|
+
load_duration = lifecycle.stop_timer("core.init")
|
|
135
|
+
await lifecycle.submit_event(
|
|
136
|
+
"core.init.complete",
|
|
137
|
+
msg="模块初始化失败",
|
|
138
|
+
data={
|
|
139
|
+
"duration": load_duration,
|
|
140
|
+
"success": False,
|
|
141
|
+
"error": str(e)
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
logger.critical(f"SDK初始化严重错误: {e}")
|
|
145
|
+
return False
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
__all__ = [
|
|
149
|
+
"Initializer"
|
|
150
|
+
]
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# type: ignore
|
|
2
|
+
#
|
|
3
|
+
# Auto-generated type stub for initializer.py
|
|
4
|
+
# DO NOT EDIT MANUALLY - Generated by generate-type-stubs.py
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
ErisPulse 初始化协调器
|
|
9
|
+
|
|
10
|
+
负责协调适配器和模块的加载流程
|
|
11
|
+
|
|
12
|
+
{!--< tips >!--}
|
|
13
|
+
1. 初始化顺序:适配器 → 模块
|
|
14
|
+
2. 支持并行加载优化
|
|
15
|
+
3. 统一的错误处理和事件提交
|
|
16
|
+
{!--< /tips >!--}
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import asyncio
|
|
20
|
+
from typing import List, Dict, Any, Optional
|
|
21
|
+
from .adapter_loader import AdapterLoader
|
|
22
|
+
from .module_loader import ModuleLoader
|
|
23
|
+
from ..Core.logger import logger
|
|
24
|
+
from ..Core.lifecycle import lifecycle
|
|
25
|
+
|
|
26
|
+
class Initializer:
|
|
27
|
+
"""
|
|
28
|
+
初始化协调器
|
|
29
|
+
|
|
30
|
+
协调适配器和模块的加载流程,提供统一的初始化接口
|
|
31
|
+
|
|
32
|
+
{!--< tips >!--}
|
|
33
|
+
使用方式:
|
|
34
|
+
>>> initializer = Initializer(sdk_instance)
|
|
35
|
+
>>> success = await initializer.init()
|
|
36
|
+
{!--< /tips >!--}
|
|
37
|
+
"""
|
|
38
|
+
def __init__(self: None, sdk_instance: Any) -> ...:
|
|
39
|
+
"""
|
|
40
|
+
初始化协调器
|
|
41
|
+
|
|
42
|
+
:param sdk_instance: SDK 实例
|
|
43
|
+
"""
|
|
44
|
+
...
|
|
45
|
+
async def init(self: object) -> bool:
|
|
46
|
+
"""
|
|
47
|
+
初始化所有模块和适配器
|
|
48
|
+
|
|
49
|
+
执行步骤:
|
|
50
|
+
1. 从 PyPI 包加载适配器
|
|
51
|
+
2. 从 PyPI 包加载模块
|
|
52
|
+
3. 注册适配器
|
|
53
|
+
4. 注册模块
|
|
54
|
+
5. 初始化模块
|
|
55
|
+
|
|
56
|
+
:return: bool 初始化是否成功
|
|
57
|
+
|
|
58
|
+
:raises ImportError: 当加载失败时抛出
|
|
59
|
+
"""
|
|
60
|
+
...
|