ErisPulse 2.3.3__tar.gz → 2.3.4.dev0__tar.gz
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-2.3.3 → erispulse-2.3.4.dev0}/LICENSE +3 -3
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/PKG-INFO +6 -20
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/README.md +1 -16
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/pyproject.toml +2 -1
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/wrapper.py +2 -3
- {erispulse-2.3.3/stubs → erispulse-2.3.4.dev0/src}/ErisPulse/Core/Event/wrapper.pyi +2 -3
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/__init__.py +0 -5
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/__init__.pyi +0 -1
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/__init__.py +0 -4
- {erispulse-2.3.3/stubs → erispulse-2.3.4.dev0/src}/ErisPulse/__init__.pyi +0 -1
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/sdk_protocol.py +0 -7
- {erispulse-2.3.3/stubs → erispulse-2.3.4.dev0/src}/ErisPulse/sdk_protocol.pyi +0 -3
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/utils/__init__.py +1 -1
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/__init__.py +11 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/__init__.pyi +13 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/__main__.py +225 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/__main__.pyi +81 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/base.py +52 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/base.pyi +50 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/__init__.py +6 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/__init__.pyi +12 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/init.py +400 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/init.pyi +82 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/install.py +307 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/install.pyi +70 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/list.py +165 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/list.pyi +56 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/list_remote.py +128 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/list_remote.pyi +47 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/run.py +112 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/run.pyi +48 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/self_update.py +237 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/self_update.pyi +59 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/uninstall.py +37 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/uninstall.pyi +37 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/upgrade.py +62 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/commands/upgrade.pyi +38 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/registry.py +112 -0
- erispulse-2.3.4.dev0/src/ErisPulse/utils/cli/registry.pyi +99 -0
- erispulse-2.3.3/src/ErisPulse/Core/Event/wrapper.pyi +0 -404
- erispulse-2.3.3/src/ErisPulse/Core/ux.py +0 -635
- erispulse-2.3.3/src/ErisPulse/Core/ux.pyi +0 -94
- erispulse-2.3.3/src/ErisPulse/__init__.pyi +0 -310
- erispulse-2.3.3/src/ErisPulse/sdk_protocol.pyi +0 -100
- erispulse-2.3.3/src/ErisPulse/utils/cli.py +0 -1097
- erispulse-2.3.3/src/ErisPulse/utils/cli.pyi +0 -145
- erispulse-2.3.3/stubs/ErisPulse/Core/Bases/__init__.pyi +0 -14
- erispulse-2.3.3/stubs/ErisPulse/Core/Bases/adapter.pyi +0 -140
- erispulse-2.3.3/stubs/ErisPulse/Core/Bases/module.pyi +0 -52
- erispulse-2.3.3/stubs/ErisPulse/Core/Event/__init__.pyi +0 -26
- erispulse-2.3.3/stubs/ErisPulse/Core/Event/base.pyi +0 -62
- erispulse-2.3.3/stubs/ErisPulse/Core/Event/command.pyi +0 -113
- erispulse-2.3.3/stubs/ErisPulse/Core/Event/exceptions.pyi +0 -43
- erispulse-2.3.3/stubs/ErisPulse/Core/Event/message.pyi +0 -93
- erispulse-2.3.3/stubs/ErisPulse/Core/Event/meta.pyi +0 -92
- erispulse-2.3.3/stubs/ErisPulse/Core/Event/notice.pyi +0 -108
- erispulse-2.3.3/stubs/ErisPulse/Core/Event/request.pyi +0 -76
- erispulse-2.3.3/stubs/ErisPulse/Core/__init__.pyi +0 -17
- erispulse-2.3.3/stubs/ErisPulse/Core/_self_config.pyi +0 -72
- erispulse-2.3.3/stubs/ErisPulse/Core/adapter.pyi +0 -229
- erispulse-2.3.3/stubs/ErisPulse/Core/config.pyi +0 -70
- erispulse-2.3.3/stubs/ErisPulse/Core/exceptions.pyi +0 -60
- erispulse-2.3.3/stubs/ErisPulse/Core/lifecycle.pyi +0 -92
- erispulse-2.3.3/stubs/ErisPulse/Core/logger.pyi +0 -168
- erispulse-2.3.3/stubs/ErisPulse/Core/module.pyi +0 -178
- erispulse-2.3.3/stubs/ErisPulse/Core/router.pyi +0 -120
- erispulse-2.3.3/stubs/ErisPulse/Core/storage.pyi +0 -273
- erispulse-2.3.3/stubs/ErisPulse/Core/ux.pyi +0 -94
- erispulse-2.3.3/stubs/ErisPulse/__main__.pyi +0 -24
- erispulse-2.3.3/stubs/ErisPulse/utils/__init__.pyi +0 -16
- erispulse-2.3.3/stubs/ErisPulse/utils/cli.pyi +0 -145
- erispulse-2.3.3/stubs/ErisPulse/utils/console.pyi +0 -20
- erispulse-2.3.3/stubs/ErisPulse/utils/package_manager.pyi +0 -224
- erispulse-2.3.3/stubs/ErisPulse/utils/reload_handler.pyi +0 -64
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/.gitignore +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Bases/__init__.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Bases/__init__.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Bases/adapter.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Bases/adapter.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Bases/module.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Bases/module.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/__init__.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/__init__.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/base.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/base.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/command.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/command.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/exceptions.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/exceptions.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/message.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/message.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/meta.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/meta.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/notice.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/notice.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/request.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/Event/request.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/_self_config.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/_self_config.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/adapter.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/adapter.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/config.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/config.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/exceptions.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/exceptions.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/lifecycle.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/lifecycle.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/logger.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/logger.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/module.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/module.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/router.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/router.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/storage.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/Core/storage.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/__main__.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/__main__.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/utils/__init__.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/utils/console.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/utils/console.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/utils/package_manager.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/utils/package_manager.pyi +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/utils/reload_handler.py +0 -0
- {erispulse-2.3.3 → erispulse-2.3.4.dev0}/src/ErisPulse/utils/reload_handler.pyi +0 -0
|
@@ -30,8 +30,8 @@ This SDK's core adapter standardization layer strictly follows OneBot12 specific
|
|
|
30
30
|
|
|
31
31
|
This ensures consistent behavior and interoperability across all adapter implementations.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
We extend our gratitude to all developers and authors who contribute to the open-source community.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Please respect the efforts of every open-source author. By using, modifying, or distributing this software, you commit to strictly adhering to the relevant license terms and preserving all original copyright notices.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
The core of the open-source spirit lies in sharing, collaboration, and respect. Through this project, we hope to carry forward this spirit and contribute to the development of the open-source community.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ErisPulse
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4.dev0
|
|
4
4
|
Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
|
|
5
5
|
Author-email: "艾莉丝·格雷拉特(WSu2059)" <wsu2059@qq.com>
|
|
6
6
|
License: MIT License
|
|
@@ -35,11 +35,11 @@ License: MIT License
|
|
|
35
35
|
|
|
36
36
|
This ensures consistent behavior and interoperability across all adapter implementations.
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
We extend our gratitude to all developers and authors who contribute to the open-source community.
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Please respect the efforts of every open-source author. By using, modifying, or distributing this software, you commit to strictly adhering to the relevant license terms and preserving all original copyright notices.
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
The core of the open-source spirit lies in sharing, collaboration, and respect. Through this project, we hope to carry forward this spirit and contribute to the development of the open-source community.
|
|
43
43
|
License-File: LICENSE
|
|
44
44
|
Classifier: Development Status :: 5 - Production/Stable
|
|
45
45
|
Classifier: Intended Audience :: Developers
|
|
@@ -58,6 +58,7 @@ Requires-Dist: colorama
|
|
|
58
58
|
Requires-Dist: fastapi>=0.116.1
|
|
59
59
|
Requires-Dist: hypercorn>=0.14.0
|
|
60
60
|
Requires-Dist: packaging>=25.0
|
|
61
|
+
Requires-Dist: pip
|
|
61
62
|
Requires-Dist: pydantic>=2.10.6
|
|
62
63
|
Requires-Dist: python-multipart>=0.0.20
|
|
63
64
|
Requires-Dist: rich
|
|
@@ -146,21 +147,6 @@ uv pip install -e .
|
|
|
146
147
|
python -c "from ErisPulse import sdk; sdk.init()"
|
|
147
148
|
```
|
|
148
149
|
|
|
149
|
-
### 5. 运行测试
|
|
150
|
-
|
|
151
|
-
我们提供了一个交互式测试脚本,可以帮助您快速验证SDK功能:
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
uv run devs/test.py
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
测试功能包括:
|
|
158
|
-
- 日志系统测试
|
|
159
|
-
- 环境配置测试
|
|
160
|
-
- 错误管理测试
|
|
161
|
-
- 工具函数测试
|
|
162
|
-
- 适配器功能测试
|
|
163
|
-
|
|
164
150
|
## 项目结构
|
|
165
151
|
|
|
166
152
|
```
|
|
@@ -191,7 +177,7 @@ ErisPulse/
|
|
|
191
177
|
通过 [社区讨论](https://github.com/ErisPulse/ErisPulse/discussions) 提出新想法
|
|
192
178
|
|
|
193
179
|
3. 代码贡献
|
|
194
|
-
提交 Pull Request 前请阅读我们的 [代码风格](docs/
|
|
180
|
+
提交 Pull Request 前请阅读我们的 [代码风格](docs/styleguide/docstring_spec.md) 以及 [贡献指南](CONTRIBUTING.md)
|
|
195
181
|
|
|
196
182
|
4. 文档改进
|
|
197
183
|
帮助完善文档和示例代码
|
|
@@ -79,21 +79,6 @@ uv pip install -e .
|
|
|
79
79
|
python -c "from ErisPulse import sdk; sdk.init()"
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
### 5. 运行测试
|
|
83
|
-
|
|
84
|
-
我们提供了一个交互式测试脚本,可以帮助您快速验证SDK功能:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
uv run devs/test.py
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
测试功能包括:
|
|
91
|
-
- 日志系统测试
|
|
92
|
-
- 环境配置测试
|
|
93
|
-
- 错误管理测试
|
|
94
|
-
- 工具函数测试
|
|
95
|
-
- 适配器功能测试
|
|
96
|
-
|
|
97
82
|
## 项目结构
|
|
98
83
|
|
|
99
84
|
```
|
|
@@ -124,7 +109,7 @@ ErisPulse/
|
|
|
124
109
|
通过 [社区讨论](https://github.com/ErisPulse/ErisPulse/discussions) 提出新想法
|
|
125
110
|
|
|
126
111
|
3. 代码贡献
|
|
127
|
-
提交 Pull Request 前请阅读我们的 [代码风格](docs/
|
|
112
|
+
提交 Pull Request 前请阅读我们的 [代码风格](docs/styleguide/docstring_spec.md) 以及 [贡献指南](CONTRIBUTING.md)
|
|
128
113
|
|
|
129
114
|
4. 文档改进
|
|
130
115
|
帮助完善文档和示例代码
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ErisPulse"
|
|
7
|
-
version = "2.3.
|
|
7
|
+
version = "2.3.4-dev.0"
|
|
8
8
|
description = "ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -29,6 +29,7 @@ classifiers = [
|
|
|
29
29
|
]
|
|
30
30
|
|
|
31
31
|
dependencies = [
|
|
32
|
+
"pip", # 显式声明,防止部分情况下cli报错
|
|
32
33
|
"rich",
|
|
33
34
|
"colorama",
|
|
34
35
|
"aiohttp",
|
|
@@ -10,9 +10,8 @@ ErisPulse 事件包装类
|
|
|
10
10
|
{!--< /tips >!--}
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
|
-
from typing import Any, Dict, List, Optional, Callable, Awaitable
|
|
13
|
+
from typing import Any, Dict, List, Optional, Callable, Awaitable
|
|
14
14
|
from .. import adapter, logger
|
|
15
|
-
import asyncio
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
class Event(dict):
|
|
@@ -479,7 +478,7 @@ class Event(dict):
|
|
|
479
478
|
"""
|
|
480
479
|
获取原始事件数据
|
|
481
480
|
|
|
482
|
-
:return:
|
|
481
|
+
:return: 原始事件数据字典
|
|
483
482
|
"""
|
|
484
483
|
platform = self.get_platform()
|
|
485
484
|
raw_key = f"{platform}_raw" if platform else "raw"
|
|
@@ -16,9 +16,8 @@ ErisPulse 事件包装类
|
|
|
16
16
|
{!--< /tips >!--}
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
|
-
from typing import Any, Dict, List, Optional, Callable, Awaitable
|
|
19
|
+
from typing import Any, Dict, List, Optional, Callable, Awaitable
|
|
20
20
|
from .. import adapter, logger
|
|
21
|
-
import asyncio
|
|
22
21
|
|
|
23
22
|
class Event(dict):
|
|
24
23
|
"""
|
|
@@ -323,7 +322,7 @@ class Event(dict):
|
|
|
323
322
|
"""
|
|
324
323
|
获取原始事件数据
|
|
325
324
|
|
|
326
|
-
:return:
|
|
325
|
+
:return: 原始事件数据字典
|
|
327
326
|
"""
|
|
328
327
|
...
|
|
329
328
|
def get_raw_type(self: object) -> str:
|
|
@@ -6,7 +6,6 @@ from .logger import logger, Logger, LoggerChild
|
|
|
6
6
|
from .module import module, ModuleManager
|
|
7
7
|
from .router import router, RouterManager
|
|
8
8
|
from .config import config, ConfigManager
|
|
9
|
-
from .ux import ux, UXManager
|
|
10
9
|
from . import exceptions
|
|
11
10
|
from . import Event
|
|
12
11
|
|
|
@@ -43,10 +42,6 @@ __all__ = [
|
|
|
43
42
|
'RouterManager', # 路由管理器类
|
|
44
43
|
'adapter_server', # 路由管理器别名
|
|
45
44
|
|
|
46
|
-
# UX
|
|
47
|
-
'ux', # UX管理器实例
|
|
48
|
-
'UXManager', # UX管理器类
|
|
49
|
-
|
|
50
45
|
# 基础设施
|
|
51
46
|
'logger', # 日志管理器
|
|
52
47
|
'Logger', # 日志管理器类
|
|
@@ -12,6 +12,5 @@ from .logger import logger, Logger, LoggerChild
|
|
|
12
12
|
from .module import module, ModuleManager
|
|
13
13
|
from .router import router, RouterManager
|
|
14
14
|
from .config import config, ConfigManager
|
|
15
|
-
from .ux import ux, UXManager
|
|
16
15
|
from . import exceptions
|
|
17
16
|
from . import Event
|
|
@@ -37,8 +37,6 @@ from .Core import adapter, AdapterFather, BaseAdapter, SendDSL
|
|
|
37
37
|
from .Core import module
|
|
38
38
|
# 路由相关
|
|
39
39
|
from .Core import router, adapter_server
|
|
40
|
-
# 用户体验相关
|
|
41
|
-
from .Core import ux, UXManager
|
|
42
40
|
|
|
43
41
|
# SDK统一对外接口
|
|
44
42
|
sdk: 'SDKProtocol' = types.ModuleType('sdk') # type: ignore[assignment]
|
|
@@ -71,8 +69,6 @@ BaseModules = {
|
|
|
71
69
|
|
|
72
70
|
"router": router,
|
|
73
71
|
"adapter_server": adapter_server,
|
|
74
|
-
"ux": ux,
|
|
75
|
-
"UXManager": UXManager,
|
|
76
72
|
}
|
|
77
73
|
|
|
78
74
|
for module_name, moduleObj in BaseModules.items():
|
|
@@ -17,7 +17,6 @@ from .Core.config import ConfigManager
|
|
|
17
17
|
from .Core.adapter import AdapterManager
|
|
18
18
|
from .Core.module import ModuleManager
|
|
19
19
|
from .Core.router import RouterManager
|
|
20
|
-
from .Core.ux import UXManager
|
|
21
20
|
from .Core.Bases.adapter import BaseAdapter, SendDSL
|
|
22
21
|
|
|
23
22
|
P = ParamSpec('P')
|
|
@@ -76,12 +75,6 @@ class SDKProtocol(Protocol):
|
|
|
76
75
|
adapter_server: RouterManager
|
|
77
76
|
"""路由管理器别名"""
|
|
78
77
|
|
|
79
|
-
ux: UXManager
|
|
80
|
-
"""UX管理器实例"""
|
|
81
|
-
|
|
82
|
-
UXManager: type[UXManager]
|
|
83
|
-
"""UX管理器类"""
|
|
84
|
-
|
|
85
78
|
# ==================== 初始化方法 ====================
|
|
86
79
|
|
|
87
80
|
async def init(self) -> bool:
|
|
@@ -21,7 +21,6 @@ from .Core.config import ConfigManager
|
|
|
21
21
|
from .Core.adapter import AdapterManager
|
|
22
22
|
from .Core.module import ModuleManager
|
|
23
23
|
from .Core.router import RouterManager
|
|
24
|
-
from .Core.ux import UXManager
|
|
25
24
|
from .Core.Bases.adapter import BaseAdapter, SendDSL
|
|
26
25
|
|
|
27
26
|
class SDKProtocol(Protocol):
|
|
@@ -44,8 +43,6 @@ class SDKProtocol(Protocol):
|
|
|
44
43
|
module: ModuleManager
|
|
45
44
|
router: RouterManager
|
|
46
45
|
adapter_server: RouterManager
|
|
47
|
-
ux: UXManager
|
|
48
|
-
UXManager: type[UXManager]
|
|
49
46
|
async def init(self: object) -> bool:
|
|
50
47
|
"""
|
|
51
48
|
SDK初始化入口
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"""
|
|
2
|
+
主 CLI 类
|
|
3
|
+
|
|
4
|
+
ErisPulse 命令行接口主入口
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import importlib
|
|
9
|
+
import importlib.metadata
|
|
10
|
+
import asyncio
|
|
11
|
+
import traceback
|
|
12
|
+
import pkgutil
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from argparse import ArgumentParser, RawDescriptionHelpFormatter
|
|
15
|
+
|
|
16
|
+
from rich.panel import Panel
|
|
17
|
+
|
|
18
|
+
from ..console import console
|
|
19
|
+
from .registry import CommandRegistry
|
|
20
|
+
from .base import Command
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class CLI:
|
|
24
|
+
"""
|
|
25
|
+
ErisPulse 命令行接口主类
|
|
26
|
+
|
|
27
|
+
提供完整的命令行交互功能,支持动态加载第三方命令
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(self):
|
|
31
|
+
"""初始化 CLI"""
|
|
32
|
+
self.registry = CommandRegistry()
|
|
33
|
+
self.parser = self._create_parser()
|
|
34
|
+
self._register_builtin_commands()
|
|
35
|
+
self._load_external_commands()
|
|
36
|
+
|
|
37
|
+
def _create_parser(self) -> ArgumentParser:
|
|
38
|
+
"""
|
|
39
|
+
创建命令行参数解析器
|
|
40
|
+
|
|
41
|
+
:return: 配置好的 ArgumentParser 实例
|
|
42
|
+
"""
|
|
43
|
+
parser = ArgumentParser(
|
|
44
|
+
prog="epsdk",
|
|
45
|
+
formatter_class=RawDescriptionHelpFormatter,
|
|
46
|
+
description="ErisPulse SDK 命令行工具\n\n一个功能强大的模块化系统管理工具,用于管理ErisPulse生态系统中的模块、适配器和扩展。",
|
|
47
|
+
)
|
|
48
|
+
parser._positionals.title = "命令"
|
|
49
|
+
parser._optionals.title = "选项"
|
|
50
|
+
|
|
51
|
+
# 全局选项
|
|
52
|
+
parser.add_argument(
|
|
53
|
+
"--version", "-V",
|
|
54
|
+
action="store_true",
|
|
55
|
+
help="显示版本信息"
|
|
56
|
+
)
|
|
57
|
+
parser.add_argument(
|
|
58
|
+
"--verbose", "-v",
|
|
59
|
+
action="count",
|
|
60
|
+
default=0,
|
|
61
|
+
help="增加输出详细程度 (-v, -vv, -vvv)"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# 子命令
|
|
65
|
+
subparsers = parser.add_subparsers(
|
|
66
|
+
dest='command',
|
|
67
|
+
metavar="<命令>",
|
|
68
|
+
help="要执行的操作"
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
self.subparsers = subparsers
|
|
72
|
+
return parser
|
|
73
|
+
|
|
74
|
+
def _auto_discover_commands(self):
|
|
75
|
+
"""
|
|
76
|
+
自动发现并注册 commands 目录中的所有命令
|
|
77
|
+
|
|
78
|
+
动态扫描 commands 目录,查找所有继承自 Command 基类的命令类
|
|
79
|
+
并自动注册到命令注册表中。
|
|
80
|
+
"""
|
|
81
|
+
# 获取 commands 包的路径
|
|
82
|
+
commands_package = 'ErisPulse.utils.cli.commands'
|
|
83
|
+
|
|
84
|
+
try:
|
|
85
|
+
# 遍历 commands 包中的所有模块
|
|
86
|
+
for importer, module_name, ispkg in pkgutil.iter_modules(
|
|
87
|
+
importlib.import_module(commands_package).__path__,
|
|
88
|
+
prefix=f"{commands_package}."
|
|
89
|
+
):
|
|
90
|
+
# 跳过 __init__ 和 __pycache__ 目录
|
|
91
|
+
if module_name.endswith('.__init__') or '__pycache__' in module_name:
|
|
92
|
+
continue
|
|
93
|
+
|
|
94
|
+
try:
|
|
95
|
+
# 动态导入模块
|
|
96
|
+
module = importlib.import_module(module_name)
|
|
97
|
+
|
|
98
|
+
# 查找模块中所有继承自 Command 的类
|
|
99
|
+
for attr_name in dir(module):
|
|
100
|
+
attr = getattr(module, attr_name)
|
|
101
|
+
|
|
102
|
+
# 检查是否是 Command 的子类(排除 Command 基类本身)
|
|
103
|
+
if (isinstance(attr, type) and
|
|
104
|
+
issubclass(attr, Command) and
|
|
105
|
+
attr is not Command):
|
|
106
|
+
try:
|
|
107
|
+
# 实例化并注册命令
|
|
108
|
+
command_instance = attr()
|
|
109
|
+
self.registry.register(command_instance)
|
|
110
|
+
except Exception as e:
|
|
111
|
+
console.print(f"[warning]实例化命令 {attr_name} 失败: {e}[/]")
|
|
112
|
+
|
|
113
|
+
except Exception as e:
|
|
114
|
+
console.print(f"[warning]加载命令模块 {module_name} 失败: {e}[/]")
|
|
115
|
+
|
|
116
|
+
except ImportError as e:
|
|
117
|
+
console.print(f"[warning]无法导入 commands 包: {e}[/]")
|
|
118
|
+
|
|
119
|
+
def _register_builtin_commands(self):
|
|
120
|
+
"""注册所有内置命令(通过自动发现)"""
|
|
121
|
+
self._auto_discover_commands()
|
|
122
|
+
|
|
123
|
+
# 添加所有命令的参数
|
|
124
|
+
for command in self.registry.get_all():
|
|
125
|
+
parser = self.subparsers.add_parser(
|
|
126
|
+
command.name,
|
|
127
|
+
help=command.description
|
|
128
|
+
)
|
|
129
|
+
command.add_arguments(parser)
|
|
130
|
+
|
|
131
|
+
def _load_external_commands(self):
|
|
132
|
+
"""
|
|
133
|
+
加载第三方 CLI 命令
|
|
134
|
+
"""
|
|
135
|
+
try:
|
|
136
|
+
entry_points = importlib.metadata.entry_points()
|
|
137
|
+
if hasattr(entry_points, 'select'):
|
|
138
|
+
cli_entries = entry_points.select(group='erispulse.cli')
|
|
139
|
+
else:
|
|
140
|
+
cli_entries = entry_points.get('erispulse.cli', [])
|
|
141
|
+
|
|
142
|
+
for entry in cli_entries:
|
|
143
|
+
try:
|
|
144
|
+
cli_func = entry.load()
|
|
145
|
+
if callable(cli_func):
|
|
146
|
+
# 传入 subparsers 和 console,保持兼容性
|
|
147
|
+
cli_func(self.subparsers, console)
|
|
148
|
+
else:
|
|
149
|
+
console.print(f"[warning]模块 {entry.name} 的入口点不是可调用对象[/]")
|
|
150
|
+
except Exception as e:
|
|
151
|
+
console.print(f"[error]加载第三方命令 {entry.name} 失败: {e}[/]")
|
|
152
|
+
except Exception as e:
|
|
153
|
+
console.print(f"[warning]加载第三方CLI命令失败: {e}[/]")
|
|
154
|
+
|
|
155
|
+
def _print_version(self):
|
|
156
|
+
"""打印版本信息"""
|
|
157
|
+
from ErisPulse import __version__
|
|
158
|
+
console.print(Panel(
|
|
159
|
+
f"[title]ErisPulse SDK[/] 版本: [bold]{__version__}[/]",
|
|
160
|
+
subtitle=f"Python {sys.version.split()[0]}",
|
|
161
|
+
style="title"
|
|
162
|
+
))
|
|
163
|
+
|
|
164
|
+
def run(self):
|
|
165
|
+
"""
|
|
166
|
+
运行 CLI
|
|
167
|
+
|
|
168
|
+
:raises KeyboardInterrupt: 用户中断时抛出
|
|
169
|
+
:raises Exception: 命令执行失败时抛出
|
|
170
|
+
"""
|
|
171
|
+
args = self.parser.parse_args()
|
|
172
|
+
|
|
173
|
+
# 处理版本选项
|
|
174
|
+
if args.version:
|
|
175
|
+
self._print_version()
|
|
176
|
+
return
|
|
177
|
+
|
|
178
|
+
# 没有指定命令时显示帮助
|
|
179
|
+
if not args.command:
|
|
180
|
+
self.parser.print_help()
|
|
181
|
+
return
|
|
182
|
+
|
|
183
|
+
try:
|
|
184
|
+
# 执行命令
|
|
185
|
+
command = self.registry.get(args.command)
|
|
186
|
+
if command:
|
|
187
|
+
command.execute(args)
|
|
188
|
+
else:
|
|
189
|
+
# 第三方命令处理
|
|
190
|
+
self._execute_external_command(args)
|
|
191
|
+
|
|
192
|
+
except KeyboardInterrupt:
|
|
193
|
+
console.print("\n[warning]操作被用户中断[/]")
|
|
194
|
+
sys.exit(1)
|
|
195
|
+
except Exception as e:
|
|
196
|
+
console.print(f"[error]执行命令时出错: {e}[/]")
|
|
197
|
+
if args.verbose >= 1:
|
|
198
|
+
console.print(traceback.format_exc())
|
|
199
|
+
sys.exit(1)
|
|
200
|
+
|
|
201
|
+
def _execute_external_command(self, args):
|
|
202
|
+
"""
|
|
203
|
+
执行第三方命令
|
|
204
|
+
|
|
205
|
+
:param args: 解析后的参数
|
|
206
|
+
"""
|
|
207
|
+
try:
|
|
208
|
+
# 第三方命令在注册时已经通过 set_defaults(func=handle_command) 设置了处理函数
|
|
209
|
+
# 所以 args.func 就是处理函数
|
|
210
|
+
if hasattr(args, 'func') and args.func:
|
|
211
|
+
handler_func = args.func
|
|
212
|
+
if asyncio.iscoroutinefunction(handler_func):
|
|
213
|
+
# 异步函数:使用 asyncio.run() 运行
|
|
214
|
+
asyncio.run(handler_func(args))
|
|
215
|
+
else:
|
|
216
|
+
# 同步函数:直接调用
|
|
217
|
+
handler_func(args)
|
|
218
|
+
else:
|
|
219
|
+
console.print(f"[error]命令 {args.command} 没有处理函数[/]")
|
|
220
|
+
sys.exit(1)
|
|
221
|
+
except Exception as e:
|
|
222
|
+
console.print(f"[error]执行第三方命令失败: {e}[/]")
|
|
223
|
+
if args.verbose >= 1:
|
|
224
|
+
console.print(traceback.format_exc())
|
|
225
|
+
sys.exit(1)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# type: ignore
|
|
2
|
+
#
|
|
3
|
+
# Auto-generated type stub for __main__.py
|
|
4
|
+
# DO NOT EDIT MANUALLY - Generated by generate-type-stubs.py
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
主 CLI 类
|
|
9
|
+
|
|
10
|
+
ErisPulse 命令行接口主入口
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import sys
|
|
14
|
+
import importlib
|
|
15
|
+
import importlib.metadata
|
|
16
|
+
import asyncio
|
|
17
|
+
import traceback
|
|
18
|
+
import pkgutil
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from argparse import ArgumentParser, RawDescriptionHelpFormatter
|
|
21
|
+
from rich.panel import Panel
|
|
22
|
+
from ..console import console
|
|
23
|
+
from .registry import CommandRegistry
|
|
24
|
+
from .base import Command
|
|
25
|
+
|
|
26
|
+
class CLI:
|
|
27
|
+
"""
|
|
28
|
+
ErisPulse 命令行接口主类
|
|
29
|
+
|
|
30
|
+
提供完整的命令行交互功能,支持动态加载第三方命令
|
|
31
|
+
"""
|
|
32
|
+
def __init__(self: None) -> ...:
|
|
33
|
+
"""
|
|
34
|
+
初始化 CLI
|
|
35
|
+
"""
|
|
36
|
+
...
|
|
37
|
+
def _create_parser(self: object) -> ArgumentParser:
|
|
38
|
+
"""
|
|
39
|
+
创建命令行参数解析器
|
|
40
|
+
|
|
41
|
+
:return: 配置好的 ArgumentParser 实例
|
|
42
|
+
"""
|
|
43
|
+
...
|
|
44
|
+
def _auto_discover_commands(self: object) -> ...:
|
|
45
|
+
"""
|
|
46
|
+
自动发现并注册 commands 目录中的所有命令
|
|
47
|
+
|
|
48
|
+
动态扫描 commands 目录,查找所有继承自 Command 基类的命令类
|
|
49
|
+
并自动注册到命令注册表中。
|
|
50
|
+
"""
|
|
51
|
+
...
|
|
52
|
+
def _register_builtin_commands(self: object) -> ...:
|
|
53
|
+
"""
|
|
54
|
+
注册所有内置命令(通过自动发现)
|
|
55
|
+
"""
|
|
56
|
+
...
|
|
57
|
+
def _load_external_commands(self: object) -> ...:
|
|
58
|
+
"""
|
|
59
|
+
加载第三方 CLI 命令
|
|
60
|
+
"""
|
|
61
|
+
...
|
|
62
|
+
def _print_version(self: object) -> ...:
|
|
63
|
+
"""
|
|
64
|
+
打印版本信息
|
|
65
|
+
"""
|
|
66
|
+
...
|
|
67
|
+
def run(self: object) -> ...:
|
|
68
|
+
"""
|
|
69
|
+
运行 CLI
|
|
70
|
+
|
|
71
|
+
:raises KeyboardInterrupt: 用户中断时抛出
|
|
72
|
+
:raises Exception: 命令执行失败时抛出
|
|
73
|
+
"""
|
|
74
|
+
...
|
|
75
|
+
def _execute_external_command(self: object, args: ...) -> ...:
|
|
76
|
+
"""
|
|
77
|
+
执行第三方命令
|
|
78
|
+
|
|
79
|
+
:param args: 解析后的参数
|
|
80
|
+
"""
|
|
81
|
+
...
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CLI 命令基类
|
|
3
|
+
|
|
4
|
+
定义所有命令的统一接口
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from abc import ABC, abstractmethod
|
|
8
|
+
from argparse import ArgumentParser
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Command(ABC):
|
|
12
|
+
"""
|
|
13
|
+
命令基类
|
|
14
|
+
|
|
15
|
+
所有 CLI 命令都应继承此类并实现抽象方法
|
|
16
|
+
|
|
17
|
+
{!--< tips >!--}
|
|
18
|
+
1. 每个命令类必须实现 add_arguments 和 execute 方法
|
|
19
|
+
2. name 和 description 为类属性,必须在子类中定义
|
|
20
|
+
3. execute 方法接收解析后的 args 对象
|
|
21
|
+
{!--< /tips >!--}
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
name: str = "" # 命令名称
|
|
25
|
+
description: str = "" # 命令描述
|
|
26
|
+
|
|
27
|
+
@abstractmethod
|
|
28
|
+
def add_arguments(self, parser: ArgumentParser):
|
|
29
|
+
"""
|
|
30
|
+
添加命令参数
|
|
31
|
+
|
|
32
|
+
:param parser: ArgumentParser 实例
|
|
33
|
+
"""
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
@abstractmethod
|
|
37
|
+
def execute(self, args):
|
|
38
|
+
"""
|
|
39
|
+
执行命令
|
|
40
|
+
|
|
41
|
+
:param args: 解析后的参数对象
|
|
42
|
+
"""
|
|
43
|
+
pass
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def help(self) -> str:
|
|
47
|
+
"""
|
|
48
|
+
获取帮助信息
|
|
49
|
+
|
|
50
|
+
:return: 命令描述
|
|
51
|
+
"""
|
|
52
|
+
return self.description
|