ErisPulse 2.7.0.dev5__tar.gz → 2.7.1__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.7.0.dev5 → erispulse-2.7.1}/PKG-INFO +2 -2
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/pyproject.toml +1 -1
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/create.py +46 -13
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/doctor.py +67 -10
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/list.py +3 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/run.py +12 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/i18n/locales/en.py +4 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/i18n/locales/ja.py +4 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/i18n/locales/ru.py +4 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/i18n/locales/zh_cn.py +4 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/i18n/locales/zh_tw.py +4 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/utils/display.py +4 -1
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/adapter.py +70 -55
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/config_schema.py +60 -9
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/converter.py +3 -1
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/errors.py +0 -5
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/i18n_schema.py +2 -2
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/kv_builder.py +9 -8
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/module.py +5 -6
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/send_builder.py +9 -4
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/send_rules.py +5 -5
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/storage.py +3 -1
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Event/base.py +13 -5
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Event/command.py +21 -13
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Event/session_type.py +6 -6
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Event/wrapper.py +124 -37
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/adapter.py +80 -72
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/client.py +1 -1
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/config.py +53 -14
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/constants.py +36 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/i18n/locales/en.py +155 -2
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/i18n/locales/ja.py +155 -2
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/i18n/locales/ru.py +155 -2
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/i18n/locales/zh_cn.py +155 -2
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/i18n/locales/zh_tw.py +155 -2
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/logger.py +181 -30
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/master.py +2 -1
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/module.py +44 -27
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/router.py +183 -230
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/storage.py +33 -68
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/finders/bases/finder.py +48 -11
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/loaders/adapter.py +8 -3
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/loaders/bases/loader.py +18 -6
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/loaders/module.py +110 -34
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/loaders/strict.py +32 -2
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/runtime/__init__.py +6 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/runtime/exceptions.py +59 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/runtime/frame_config.py +58 -5
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/runtime/memory.py +13 -4
- erispulse-2.7.1/src/ErisPulse/runtime/tasks.py +109 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/sdk.py +282 -39
- erispulse-2.7.0.dev5/src/ErisPulse/runtime/tasks.py +0 -63
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/.gitignore +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/LICENSE +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/README.pypi.md +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/base.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/cli.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/init.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/install.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/language.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/list_remote.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/self_update.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/types.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/uninstall.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/commands/upgrade.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/console.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/constants.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/hints.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/i18n/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/i18n/locales/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/registry.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/utils/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/utils/file_watcher.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/utils/package_manager.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/CLI/utils/scaffold_text.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/client.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/manager.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/router.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Bases/websocket.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Event/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Event/message.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Event/message_builder.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Event/meta.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Event/notice.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/Event/request.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/assets/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/assets/error.css +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/assets/error.html +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/assets/root.css +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/assets/root.html +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/i18n/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/i18n/constants.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/i18n/locales/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/Core/lifecycle.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/__main__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/finders/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/finders/adapter.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/finders/bases/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/finders/module.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/loaders/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/loaders/bases/__init__.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/loaders/strategy.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/py.typed +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/runtime/config_schema.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/runtime/context.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/runtime/diagnostics.py +0 -0
- {erispulse-2.7.0.dev5 → erispulse-2.7.1}/src/ErisPulse/runtime/hints.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: ErisPulse
|
|
3
|
-
Version: 2.7.
|
|
3
|
+
Version: 2.7.1
|
|
4
4
|
Summary: Event-driven modular async bot framework — write once, deploy to any platform | 事件驱动的模块化异步机器人框架,一次编写,多平台部署
|
|
5
5
|
Project-URL: Homepage, https://github.com/ErisPulse/ErisPulse
|
|
6
6
|
Project-URL: Documentation, https://www.erisdev.com#docs
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ErisPulse"
|
|
7
|
-
version = "2.7.
|
|
7
|
+
version = "2.7.1"
|
|
8
8
|
description = "Event-driven modular async bot framework — write once, deploy to any platform | 事件驱动的模块化异步机器人框架,一次编写,多平台部署"
|
|
9
9
|
readme = "README.pypi.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -462,33 +462,50 @@ class {converter_name}(BaseConverter):
|
|
|
462
462
|
return None
|
|
463
463
|
"""
|
|
464
464
|
|
|
465
|
-
_README_MODULE = """
|
|
465
|
+
_README_MODULE = """<div align="center">
|
|
466
466
|
|
|
467
|
-
{
|
|
467
|
+
<img src="https://raw.githubusercontent.com/ErisPulse/ErisPulse/main/.github/assets/ErisPulseLogo.png" width="180" alt="{name}" />
|
|
468
|
+
|
|
469
|
+
# {name}
|
|
470
|
+
|
|
471
|
+
**{description}**
|
|
472
|
+
|
|
473
|
+
<p>
|
|
474
|
+
<a href="https://pypi.org/project/ErisPulse-{name}/"><img src="https://img.shields.io/pypi/v/ErisPulse-{name}?style=for-the-badge&logo=pypi&logoColor=white" alt="PyPI"></a>
|
|
475
|
+
<a href="https://pypi.org/project/ErisPulse-{name}/"><img src="https://img.shields.io/badge/Python-3.10+-FFD43B?style=for-the-badge&logo=python&logoColor=blue" alt="Python"></a>
|
|
476
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue?style=for-the-badge" alt="License"></a>
|
|
477
|
+
<a href="https://github.com/ErisPulse/ErisPulse"><img src="https://img.shields.io/badge/Powered_by-ErisPulse-FF6B9D?style=for-the-badge&logo=bookstack&logoColor=white" alt="ErisPulse"></a>
|
|
478
|
+
</p>
|
|
479
|
+
|
|
480
|
+
</div>
|
|
481
|
+
|
|
482
|
+
---
|
|
468
483
|
|
|
469
484
|
## 安装
|
|
470
485
|
|
|
471
486
|
```bash
|
|
472
487
|
epsdk install ErisPulse-{name}
|
|
473
488
|
```
|
|
489
|
+
"""
|
|
474
490
|
|
|
475
|
-
|
|
491
|
+
_README_ADAPTER = """<div align="center">
|
|
476
492
|
|
|
477
|
-
|
|
493
|
+
<img src="https://raw.githubusercontent.com/ErisPulse/ErisPulse/main/.github/assets/ErisPulseLogo.png" width="180" alt="{name}" />
|
|
478
494
|
|
|
479
|
-
|
|
495
|
+
# {name}
|
|
480
496
|
|
|
481
|
-
|
|
497
|
+
**{description}**
|
|
482
498
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
"""
|
|
499
|
+
<p>
|
|
500
|
+
<a href="https://pypi.org/project/ErisPulse-{name}/"><img src="https://img.shields.io/pypi/v/ErisPulse-{name}?style=for-the-badge&logo=pypi&logoColor=white" alt="PyPI"></a>
|
|
501
|
+
<a href="https://pypi.org/project/ErisPulse-{name}/"><img src="https://img.shields.io/badge/Python-3.10+-FFD43B?style=for-the-badge&logo=python&logoColor=blue" alt="Python"></a>
|
|
502
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue?style=for-the-badge" alt="License"></a>
|
|
503
|
+
<a href="https://github.com/ErisPulse/ErisPulse"><img src="https://img.shields.io/badge/Powered_by-ErisPulse-FF6B9D?style=for-the-badge&logo=bookstack&logoColor=white" alt="ErisPulse"></a>
|
|
504
|
+
</p>
|
|
488
505
|
|
|
489
|
-
|
|
506
|
+
</div>
|
|
490
507
|
|
|
491
|
-
|
|
508
|
+
---
|
|
492
509
|
|
|
493
510
|
## 安装
|
|
494
511
|
|
|
@@ -561,6 +578,22 @@ def _validate_name(name: str) -> bool:
|
|
|
561
578
|
return all(c.isalnum() or c == "_" for c in name)
|
|
562
579
|
|
|
563
580
|
|
|
581
|
+
def _copy_erispulse_logo(project_dir: Path) -> None:
|
|
582
|
+
"""
|
|
583
|
+
将 ErisPulseLogo.png 拷贝到项目的 .github/assets/ 目录
|
|
584
|
+
|
|
585
|
+
:param project_dir: [Path] 项目根目录
|
|
586
|
+
"""
|
|
587
|
+
import shutil
|
|
588
|
+
|
|
589
|
+
logo_src = Path(__file__).parent.parent / "assets" / "ErisPulseLogo.png"
|
|
590
|
+
if not logo_src.exists():
|
|
591
|
+
return
|
|
592
|
+
dest = project_dir / ".github" / "assets" / "ErisPulseLogo.png"
|
|
593
|
+
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
594
|
+
shutil.copy2(logo_src, dest)
|
|
595
|
+
|
|
596
|
+
|
|
564
597
|
def _scaffold_text(name: str) -> dict:
|
|
565
598
|
"""
|
|
566
599
|
构建当前语言的脚手架文案映射,并预填充 {name} 占位符
|
|
@@ -43,13 +43,14 @@ class DoctorCommand(Command):
|
|
|
43
43
|
|
|
44
44
|
def execute(self, args):
|
|
45
45
|
pm = self.package_manager
|
|
46
|
-
rows: list[tuple[str, str]] = []
|
|
46
|
+
rows: list[tuple[str, str, str]] = []
|
|
47
47
|
failed = False
|
|
48
48
|
|
|
49
49
|
# 1. Python 解释器
|
|
50
50
|
py_ok = sys.version_info >= (3, 10)
|
|
51
51
|
rows.append(
|
|
52
52
|
(
|
|
53
|
+
self._status(py_ok),
|
|
53
54
|
i18n.t("cli.doctor.python"),
|
|
54
55
|
f"{platform.python_version()} ({sys.executable})",
|
|
55
56
|
)
|
|
@@ -60,27 +61,43 @@ class DoctorCommand(Command):
|
|
|
60
61
|
# 2. 安装后端(uv / pip)
|
|
61
62
|
uv_cmd = pm._get_uv_command()
|
|
62
63
|
if uv_cmd:
|
|
63
|
-
rows.append(
|
|
64
|
+
rows.append(
|
|
65
|
+
(self._status(True), i18n.t("cli.doctor.backend"), f"uv ({uv_cmd[0]})")
|
|
66
|
+
)
|
|
64
67
|
else:
|
|
65
|
-
rows.append(
|
|
68
|
+
rows.append(
|
|
69
|
+
(
|
|
70
|
+
self._status(True),
|
|
71
|
+
i18n.t("cli.doctor.backend"),
|
|
72
|
+
i18n.t("cli.doctor.backend_pip"),
|
|
73
|
+
)
|
|
74
|
+
)
|
|
66
75
|
|
|
67
76
|
# 3. 目标解释器(安装目标环境)
|
|
68
77
|
target_python = pm._get_target_python()
|
|
69
|
-
rows.append(
|
|
78
|
+
rows.append(
|
|
79
|
+
(self._status(True), i18n.t("cli.doctor.target_python"), target_python)
|
|
80
|
+
)
|
|
70
81
|
|
|
71
82
|
# 4. 配置文件
|
|
72
83
|
config_path = Path("config") / "config.toml"
|
|
73
84
|
if config_path.exists():
|
|
74
85
|
rows.append(
|
|
75
|
-
(
|
|
86
|
+
(
|
|
87
|
+
self._status(True),
|
|
88
|
+
i18n.t("cli.doctor.config"),
|
|
89
|
+
str(config_path.resolve()),
|
|
90
|
+
)
|
|
76
91
|
)
|
|
77
92
|
else:
|
|
78
93
|
rows.append(
|
|
79
94
|
(
|
|
95
|
+
self._status(False),
|
|
80
96
|
i18n.t("cli.doctor.config"),
|
|
81
97
|
f"{i18n.t('cli.doctor.config_missing')} ({config_path})",
|
|
82
98
|
)
|
|
83
99
|
)
|
|
100
|
+
failed = True
|
|
84
101
|
|
|
85
102
|
# 5. PyPI 连通性
|
|
86
103
|
try:
|
|
@@ -90,21 +107,40 @@ class DoctorCommand(Command):
|
|
|
90
107
|
)
|
|
91
108
|
rows.append(
|
|
92
109
|
(
|
|
110
|
+
self._status(True),
|
|
93
111
|
i18n.t("cli.doctor.pypi"),
|
|
94
112
|
i18n.t("cli.doctor.pypi_ok", count=pkg_count),
|
|
95
113
|
)
|
|
96
114
|
)
|
|
97
115
|
except Exception:
|
|
98
116
|
failed = True
|
|
99
|
-
rows.append(
|
|
117
|
+
rows.append(
|
|
118
|
+
(
|
|
119
|
+
self._status(False),
|
|
120
|
+
i18n.t("cli.doctor.pypi"),
|
|
121
|
+
i18n.t("cli.doctor.pypi_fail"),
|
|
122
|
+
)
|
|
123
|
+
)
|
|
100
124
|
|
|
101
125
|
# 6. 代理
|
|
102
126
|
proxy = pm._get_system_proxy()
|
|
103
127
|
if proxy:
|
|
104
128
|
https_proxy = proxy.get("https") or proxy.get("http", "")
|
|
105
|
-
rows.append(
|
|
129
|
+
rows.append(
|
|
130
|
+
(
|
|
131
|
+
self._status(True),
|
|
132
|
+
i18n.t("cli.doctor.proxy"),
|
|
133
|
+
https_proxy,
|
|
134
|
+
)
|
|
135
|
+
)
|
|
106
136
|
else:
|
|
107
|
-
rows.append(
|
|
137
|
+
rows.append(
|
|
138
|
+
(
|
|
139
|
+
self._status(True),
|
|
140
|
+
i18n.t("cli.doctor.proxy"),
|
|
141
|
+
i18n.t("cli.doctor.proxy_none"),
|
|
142
|
+
)
|
|
143
|
+
)
|
|
108
144
|
|
|
109
145
|
# 输出诊断报告
|
|
110
146
|
table = Table(
|
|
@@ -113,15 +149,36 @@ class DoctorCommand(Command):
|
|
|
113
149
|
pad_edge=False,
|
|
114
150
|
expand=True,
|
|
115
151
|
)
|
|
116
|
-
for label, detail in rows:
|
|
117
|
-
table.add_row(f"[info]{label}[/]", detail)
|
|
152
|
+
for status, label, detail in rows:
|
|
153
|
+
table.add_row(status, f"[info]{label}[/]", detail)
|
|
118
154
|
|
|
119
155
|
console.print(table)
|
|
120
156
|
|
|
121
157
|
if failed:
|
|
122
158
|
console.print(f"[error]{i18n.t('cli.doctor.failed')}[/]")
|
|
159
|
+
for status, label, _ in rows:
|
|
160
|
+
if status != self._status(True):
|
|
161
|
+
console.print(
|
|
162
|
+
f" [error]-[/] [info]{label}[/]"
|
|
163
|
+
)
|
|
123
164
|
else:
|
|
124
165
|
console.print(f"[success]{i18n.t('cli.doctor.all_ok')}[/]")
|
|
125
166
|
|
|
167
|
+
@staticmethod
|
|
168
|
+
def _status(ok: bool) -> str:
|
|
169
|
+
"""
|
|
170
|
+
生成诊断项的状态标记文本(OK / FAIL,不使用 emoji)
|
|
171
|
+
|
|
172
|
+
:param ok: bool 诊断项是否正常
|
|
173
|
+
:return: str 带样式的状态标记文本
|
|
174
|
+
"""
|
|
175
|
+
from ..i18n import i18n
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
f"[success]{i18n.t('cli.doctor.status_ok')}[/]"
|
|
179
|
+
if ok
|
|
180
|
+
else f"[error]{i18n.t('cli.doctor.status_fail')}[/]"
|
|
181
|
+
)
|
|
182
|
+
|
|
126
183
|
|
|
127
184
|
__all__ = ["DoctorCommand"]
|
|
@@ -121,6 +121,7 @@ class ListCommand(Command):
|
|
|
121
121
|
self._print_package_scripts(installed["modules"])
|
|
122
122
|
else:
|
|
123
123
|
console.print(f"[dim] {i18n.t('cli.list.no_modules')}[/]")
|
|
124
|
+
console.print(f"[dim] {i18n.t('cli.list.empty_hint')}[/]")
|
|
124
125
|
|
|
125
126
|
elif pkg_type == "adapters" and installed["adapters"]:
|
|
126
127
|
table = Table(
|
|
@@ -154,11 +155,13 @@ class ListCommand(Command):
|
|
|
154
155
|
)
|
|
155
156
|
else:
|
|
156
157
|
console.print(f"[dim] {i18n.t('cli.list.no_adapters')}[/]")
|
|
158
|
+
console.print(f"[dim] {i18n.t('cli.list.empty_hint')}[/]")
|
|
157
159
|
|
|
158
160
|
elif not installed.get(pkg_type, {}):
|
|
159
161
|
console.print(
|
|
160
162
|
f"[dim] {i18n.t('cli.list.no_packages', pkg_type=pkg_type)}[/]"
|
|
161
163
|
)
|
|
164
|
+
console.print(f"[dim] {i18n.t('cli.list.empty_hint')}[/]")
|
|
162
165
|
|
|
163
166
|
def _is_package_outdated(
|
|
164
167
|
self,
|
|
@@ -183,6 +183,7 @@ class RunCommand(Command):
|
|
|
183
183
|
]
|
|
184
184
|
|
|
185
185
|
crash_count = 0
|
|
186
|
+
process = None
|
|
186
187
|
try:
|
|
187
188
|
while True:
|
|
188
189
|
process = subprocess.Popen(cmd)
|
|
@@ -208,6 +209,17 @@ class RunCommand(Command):
|
|
|
208
209
|
# 继续循环,重新启动子进程
|
|
209
210
|
except KeyboardInterrupt:
|
|
210
211
|
pass
|
|
212
|
+
finally:
|
|
213
|
+
# 运行器退出(Ctrl+C 等)前必须终止子进程,否则孤儿进程会继续持有
|
|
214
|
+
# 端口等资源,导致下次启动时端口被占用(如监听 8000 的残留进程)。
|
|
215
|
+
if process is not None and process.poll() is None:
|
|
216
|
+
console.print(f"[info]{i18n.t('cli.run.terminating_child')}[/]")
|
|
217
|
+
process.terminate()
|
|
218
|
+
try:
|
|
219
|
+
process.wait(timeout=5)
|
|
220
|
+
except subprocess.TimeoutExpired:
|
|
221
|
+
process.kill()
|
|
222
|
+
process.wait()
|
|
211
223
|
|
|
212
224
|
def _run_script(self, script_path: str, reload_mode: bool):
|
|
213
225
|
"""
|
|
@@ -205,6 +205,7 @@ TRANSLATIONS = {
|
|
|
205
205
|
"cli.list.count_adapters": "{count} adapter(s)",
|
|
206
206
|
"cli.list.no_adapters": "No matching adapters",
|
|
207
207
|
"cli.list.no_packages": "No {pkg_type}",
|
|
208
|
+
"cli.list.empty_hint": "Run 'epsdk install' to browse and install components, or 'epsdk init' to create a project",
|
|
208
209
|
# ==================== list-remote command ====================
|
|
209
210
|
"cli.list_remote.description": "List remote available components",
|
|
210
211
|
"cli.list_remote.type_help": "List type (default: all)",
|
|
@@ -276,6 +277,7 @@ TRANSLATIONS = {
|
|
|
276
277
|
"cli.run.process_exited": "Process exited normally, waiting for file changes to restart",
|
|
277
278
|
"cli.run.process_crashed": "Process crashed (exit code {code}), fix and save to restart",
|
|
278
279
|
"cli.run.subprocess_crashed_retry": "Subprocess crashed, will auto-retry in {seconds}s...",
|
|
280
|
+
"cli.run.terminating_child": "Terminating the bot subprocess to release ports and resources...",
|
|
279
281
|
# ==================== uninstall command ====================
|
|
280
282
|
"cli.uninstall.description": "Uninstall module/adapter packages",
|
|
281
283
|
"cli.uninstall.package_help": "Package name(s) to uninstall (multiple allowed)",
|
|
@@ -416,6 +418,8 @@ TRANSLATIONS = {
|
|
|
416
418
|
"cli.doctor.proxy_none": "none detected",
|
|
417
419
|
"cli.doctor.failed": "[done] Issues found, see output above",
|
|
418
420
|
"cli.doctor.all_ok": "[done] Environment is healthy",
|
|
421
|
+
"cli.doctor.status_ok": "OK",
|
|
422
|
+
"cli.doctor.status_fail": "FAIL",
|
|
419
423
|
# ==================== types command ====================
|
|
420
424
|
"cli.types.description": "Generate type stub file to enable IDE completion",
|
|
421
425
|
"cli.types.output_help": "Output file path (default: ./_ep_types.py)",
|
|
@@ -205,6 +205,7 @@ TRANSLATIONS = {
|
|
|
205
205
|
"cli.list.count_adapters": "{count} 個のアダプター",
|
|
206
206
|
"cli.list.no_adapters": "該当するアダプターはありません",
|
|
207
207
|
"cli.list.no_packages": "{pkg_type} はありません",
|
|
208
|
+
"cli.list.empty_hint": "'epsdk install' でコンポーネントを閲覧・インストールするか、'epsdk init' でプロジェクトを作成できます",
|
|
208
209
|
# ==================== list-remote コマンド ====================
|
|
209
210
|
"cli.list_remote.description": "リモートで利用可能なコンポーネントを一覧表示",
|
|
210
211
|
"cli.list_remote.type_help": "一覧タイプ (デフォルト: all)",
|
|
@@ -276,6 +277,7 @@ TRANSLATIONS = {
|
|
|
276
277
|
"cli.run.process_exited": "プロセスが正常に終了しました。ファイルの変更を待機して再起動",
|
|
277
278
|
"cli.run.process_crashed": "プロセスが異常終了しました(終了コード {code})。修正して保存すると自動再起動",
|
|
278
279
|
"cli.run.subprocess_crashed_retry": "サブプロセスが異常終了しました。{seconds} 秒後に自動再試行します...",
|
|
280
|
+
"cli.run.terminating_child": "ポートなどのリソースを解放するため、ボットの子プロセスを終了しています...",
|
|
279
281
|
# ==================== uninstall コマンド ====================
|
|
280
282
|
"cli.uninstall.description": "モジュール/アダプターパッケージをアンインストール",
|
|
281
283
|
"cli.uninstall.package_help": "アンインストールするパッケージ名(複数指定可)",
|
|
@@ -416,6 +418,8 @@ TRANSLATIONS = {
|
|
|
416
418
|
"cli.doctor.proxy_none": "検出されません",
|
|
417
419
|
"cli.doctor.failed": "[完了] 対応が必要な問題があります。上記を確認してください",
|
|
418
420
|
"cli.doctor.all_ok": "[完了] 環境は正常です",
|
|
421
|
+
"cli.doctor.status_ok": "OK",
|
|
422
|
+
"cli.doctor.status_fail": "NG",
|
|
419
423
|
# ==================== types コマンド ====================
|
|
420
424
|
"cli.types.description": "型スタブファイルを生成して IDE 補完を有効化",
|
|
421
425
|
"cli.types.output_help": "出力ファイルパス(デフォルト: ./_ep_types.py)",
|
|
@@ -205,6 +205,7 @@ TRANSLATIONS = {
|
|
|
205
205
|
"cli.list.count_adapters": "{count} адаптера(ов)",
|
|
206
206
|
"cli.list.no_adapters": "Нет подходящих адаптеров",
|
|
207
207
|
"cli.list.no_packages": "Нет {pkg_type}",
|
|
208
|
+
"cli.list.empty_hint": "Выполните 'epsdk install' для просмотра и установки компонентов, или 'epsdk init' для создания проекта",
|
|
208
209
|
# ==================== команда list-remote ====================
|
|
209
210
|
"cli.list_remote.description": "Список удаленно доступных компонентов",
|
|
210
211
|
"cli.list_remote.type_help": "Тип списка (по умолчанию: all)",
|
|
@@ -276,6 +277,7 @@ TRANSLATIONS = {
|
|
|
276
277
|
"cli.run.process_exited": "Процесс завершен нормально, ожидание изменений файлов для перезапуска",
|
|
277
278
|
"cli.run.process_crashed": "Процесс аварийно завершен (код {code}), исправьте и сохраните для перезапуска",
|
|
278
279
|
"cli.run.subprocess_crashed_retry": "Подпроцесс аварийно завершен, автоматическая перезагрузка через {seconds}с...",
|
|
280
|
+
"cli.run.terminating_child": "Завершение дочернего процесса бота для освобождения портов и ресурсов...",
|
|
279
281
|
# ==================== команда uninstall ====================
|
|
280
282
|
"cli.uninstall.description": "Удалить пакеты модулей/адаптеров",
|
|
281
283
|
"cli.uninstall.package_help": "Имя(ена) пакета(ов) для удаления (можно указать несколько)",
|
|
@@ -416,6 +418,8 @@ TRANSLATIONS = {
|
|
|
416
418
|
"cli.doctor.proxy_none": "не обнаружен",
|
|
417
419
|
"cli.doctor.failed": "[готово] Есть проблемы, см. вывод выше",
|
|
418
420
|
"cli.doctor.all_ok": "[готово] Окружение в порядке",
|
|
421
|
+
"cli.doctor.status_ok": "OK",
|
|
422
|
+
"cli.doctor.status_fail": "FAIL",
|
|
419
423
|
# ==================== команда types ====================
|
|
420
424
|
"cli.types.description": "Сгенерировать файл заглушек типов для автодополнения IDE",
|
|
421
425
|
"cli.types.output_help": "Путь вывода (по умолчанию: ./_ep_types.py)",
|
|
@@ -205,6 +205,7 @@ TRANSLATIONS = {
|
|
|
205
205
|
"cli.list.count_adapters": "{count} 个适配器",
|
|
206
206
|
"cli.list.no_adapters": "没有符合条件的适配器",
|
|
207
207
|
"cli.list.no_packages": "没有{pkg_type}",
|
|
208
|
+
"cli.list.empty_hint": "可运行 'epsdk install' 浏览并安装组件,或运行 'epsdk init' 创建项目",
|
|
208
209
|
# ==================== list-remote 命令 ====================
|
|
209
210
|
"cli.list_remote.description": "列出远程可用的组件",
|
|
210
211
|
"cli.list_remote.type_help": "列出类型 (默认: all)",
|
|
@@ -276,6 +277,7 @@ TRANSLATIONS = {
|
|
|
276
277
|
"cli.run.process_exited": "进程已正常退出,等待文件变更后重启",
|
|
277
278
|
"cli.run.process_crashed": "进程异常退出(退出码 {code}),修复后保存文件将自动重启",
|
|
278
279
|
"cli.run.subprocess_crashed_retry": "子进程异常终止,将在 {seconds} 秒后自动重试...",
|
|
280
|
+
"cli.run.terminating_child": "正在终止机器人子进程,释放端口等资源...",
|
|
279
281
|
# ==================== uninstall 命令 ====================
|
|
280
282
|
"cli.uninstall.description": "卸载模块/适配器包",
|
|
281
283
|
"cli.uninstall.package_help": "要卸载的包名(可指定多个)",
|
|
@@ -416,6 +418,8 @@ TRANSLATIONS = {
|
|
|
416
418
|
"cli.doctor.proxy_none": "未检测到",
|
|
417
419
|
"cli.doctor.failed": "[诊断完成] 存在需要处理的问题,请参考上方输出",
|
|
418
420
|
"cli.doctor.all_ok": "[诊断完成] 环境正常",
|
|
421
|
+
"cli.doctor.status_ok": "正常",
|
|
422
|
+
"cli.doctor.status_fail": "异常",
|
|
419
423
|
# ==================== types 命令 ====================
|
|
420
424
|
"cli.types.description": "生成类型存根文件,启用 IDE 补全",
|
|
421
425
|
"cli.types.output_help": "输出文件路径(默认: ./_ep_types.py)",
|
|
@@ -205,6 +205,7 @@ TRANSLATIONS = {
|
|
|
205
205
|
"cli.list.count_adapters": "{count} 個適配器",
|
|
206
206
|
"cli.list.no_adapters": "沒有符合條件的適配器",
|
|
207
207
|
"cli.list.no_packages": "沒有{pkg_type}",
|
|
208
|
+
"cli.list.empty_hint": "可執行 'epsdk install' 瀏覽並安裝元件,或執行 'epsdk init' 建立專案",
|
|
208
209
|
# ==================== list-remote 命令 ====================
|
|
209
210
|
"cli.list_remote.description": "列出遠端可用的元件",
|
|
210
211
|
"cli.list_remote.type_help": "列出型別 (預設: all)",
|
|
@@ -276,6 +277,7 @@ TRANSLATIONS = {
|
|
|
276
277
|
"cli.run.process_exited": "程式已正常退出,等待檔案變更後重啟",
|
|
277
278
|
"cli.run.process_crashed": "程式異常退出(退出碼 {code}),修復後儲存檔案將自動重啟",
|
|
278
279
|
"cli.run.subprocess_crashed_retry": "子程序異常終止,將在 {seconds} 秒後自動重試...",
|
|
280
|
+
"cli.run.terminating_child": "正在終止機器人子程序,釋放連接埠等資源...",
|
|
279
281
|
# ==================== uninstall 命令 ====================
|
|
280
282
|
"cli.uninstall.description": "解除安裝模組/適配器包",
|
|
281
283
|
"cli.uninstall.package_help": "要解除安裝的包名(可指定多個)",
|
|
@@ -416,6 +418,8 @@ TRANSLATIONS = {
|
|
|
416
418
|
"cli.doctor.proxy_none": "未偵測到",
|
|
417
419
|
"cli.doctor.failed": "[診斷完成] 存在需要處理的問題,請參考上方輸出",
|
|
418
420
|
"cli.doctor.all_ok": "[診斷完成] 環境正常",
|
|
421
|
+
"cli.doctor.status_ok": "正常",
|
|
422
|
+
"cli.doctor.status_fail": "異常",
|
|
419
423
|
# ==================== types 命令 ====================
|
|
420
424
|
"cli.types.description": "生成類型存根檔案,啟用 IDE 補全",
|
|
421
425
|
"cli.types.output_help": "輸出檔案路徑(預設: ./_ep_types.py)",
|
|
@@ -9,6 +9,7 @@ from collections.abc import Callable
|
|
|
9
9
|
from typing import Any
|
|
10
10
|
|
|
11
11
|
from rich.box import SIMPLE
|
|
12
|
+
from rich.markup import escape
|
|
12
13
|
from rich.prompt import Prompt
|
|
13
14
|
from rich.table import Table
|
|
14
15
|
from rich.text import Text
|
|
@@ -45,7 +46,9 @@ def _input(prompt_label: str = ">") -> str:
|
|
|
45
46
|
:param prompt_label: [str] 提示标签 (默认: ">")
|
|
46
47
|
:return: [str] 用户输入内容(已去除首尾空白)
|
|
47
48
|
"""
|
|
48
|
-
|
|
49
|
+
# 转义富文本标记
|
|
50
|
+
escaped = escape(prompt_label)
|
|
51
|
+
console.print(f" [dim]{escaped}[/] ", end="")
|
|
49
52
|
try:
|
|
50
53
|
return input().strip()
|
|
51
54
|
except (EOFError, KeyboardInterrupt):
|