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.
Files changed (97) hide show
  1. ErisPulse/CLI/__init__.py +11 -0
  2. ErisPulse/CLI/__init__.pyi +13 -0
  3. ErisPulse/CLI/base.py +52 -0
  4. ErisPulse/CLI/base.pyi +50 -0
  5. ErisPulse/CLI/cli.py +224 -0
  6. ErisPulse/CLI/cli.pyi +80 -0
  7. ErisPulse/CLI/commands/__init__.py +6 -0
  8. ErisPulse/CLI/commands/__init__.pyi +12 -0
  9. ErisPulse/CLI/commands/init.py +395 -0
  10. ErisPulse/CLI/commands/init.pyi +70 -0
  11. ErisPulse/CLI/commands/install.py +302 -0
  12. ErisPulse/CLI/commands/install.pyi +58 -0
  13. ErisPulse/CLI/commands/list.py +160 -0
  14. ErisPulse/CLI/commands/list.pyi +44 -0
  15. ErisPulse/CLI/commands/list_remote.py +123 -0
  16. ErisPulse/CLI/commands/list_remote.pyi +35 -0
  17. ErisPulse/CLI/commands/run.py +108 -0
  18. ErisPulse/CLI/commands/run.pyi +39 -0
  19. ErisPulse/CLI/commands/self_update.py +232 -0
  20. ErisPulse/CLI/commands/self_update.pyi +47 -0
  21. ErisPulse/CLI/commands/uninstall.py +32 -0
  22. ErisPulse/CLI/commands/uninstall.pyi +24 -0
  23. ErisPulse/CLI/commands/upgrade.py +56 -0
  24. ErisPulse/CLI/commands/upgrade.pyi +25 -0
  25. ErisPulse/CLI/console.pyi +20 -0
  26. ErisPulse/CLI/registry.py +112 -0
  27. ErisPulse/CLI/registry.pyi +99 -0
  28. ErisPulse/{utils → CLI/utils}/__init__.py +2 -6
  29. ErisPulse/CLI/utils/__init__.pyi +14 -0
  30. ErisPulse/{utils → CLI/utils}/package_manager.py +146 -20
  31. ErisPulse/CLI/utils/package_manager.pyi +241 -0
  32. ErisPulse/{utils → CLI/utils}/reload_handler.py +7 -8
  33. ErisPulse/CLI/utils/reload_handler.pyi +64 -0
  34. ErisPulse/Core/Bases/__init__.pyi +14 -0
  35. ErisPulse/Core/Bases/adapter.py +13 -1
  36. ErisPulse/Core/Bases/adapter.pyi +140 -0
  37. ErisPulse/Core/Bases/manager.py +136 -0
  38. ErisPulse/Core/Bases/manager.pyi +108 -0
  39. ErisPulse/Core/Bases/module.py +53 -1
  40. ErisPulse/Core/Bases/module.pyi +95 -0
  41. ErisPulse/Core/Event/__init__.pyi +26 -0
  42. ErisPulse/Core/Event/base.pyi +62 -0
  43. ErisPulse/Core/Event/command.py +6 -1
  44. ErisPulse/Core/Event/command.pyi +113 -0
  45. ErisPulse/Core/Event/exceptions.pyi +43 -0
  46. ErisPulse/Core/Event/message.pyi +93 -0
  47. ErisPulse/Core/Event/meta.pyi +92 -0
  48. ErisPulse/Core/Event/notice.pyi +108 -0
  49. ErisPulse/Core/Event/request.pyi +76 -0
  50. ErisPulse/Core/Event/wrapper.py +2 -3
  51. ErisPulse/Core/Event/wrapper.pyi +403 -0
  52. ErisPulse/Core/__init__.py +16 -13
  53. ErisPulse/Core/__init__.pyi +16 -0
  54. ErisPulse/Core/_self_config.py +1 -1
  55. ErisPulse/Core/_self_config.pyi +72 -0
  56. ErisPulse/Core/adapter.py +70 -10
  57. ErisPulse/Core/adapter.pyi +246 -0
  58. ErisPulse/Core/config.pyi +70 -0
  59. ErisPulse/Core/exceptions.py +4 -2
  60. ErisPulse/Core/exceptions.pyi +60 -0
  61. ErisPulse/Core/lifecycle.py +15 -1
  62. ErisPulse/Core/lifecycle.pyi +92 -0
  63. ErisPulse/Core/logger.py +21 -15
  64. ErisPulse/Core/logger.pyi +169 -0
  65. ErisPulse/Core/module.py +57 -9
  66. ErisPulse/Core/module.pyi +189 -0
  67. ErisPulse/Core/router.py +13 -5
  68. ErisPulse/Core/router.pyi +120 -0
  69. ErisPulse/Core/storage.py +94 -256
  70. ErisPulse/Core/storage.pyi +220 -0
  71. ErisPulse/__init__.py +35 -1236
  72. ErisPulse/__init__.pyi +22 -0
  73. ErisPulse/__main__.py +1 -1
  74. ErisPulse/__main__.pyi +24 -0
  75. ErisPulse/loaders/__init__.py +22 -0
  76. ErisPulse/loaders/__init__.pyi +21 -0
  77. ErisPulse/loaders/adapter_loader.py +187 -0
  78. ErisPulse/loaders/adapter_loader.pyi +82 -0
  79. ErisPulse/loaders/base_loader.py +162 -0
  80. ErisPulse/loaders/base_loader.pyi +23 -0
  81. ErisPulse/loaders/initializer.py +150 -0
  82. ErisPulse/loaders/initializer.pyi +60 -0
  83. ErisPulse/loaders/module_loader.py +618 -0
  84. ErisPulse/loaders/module_loader.pyi +179 -0
  85. ErisPulse/loaders/strategy.py +129 -0
  86. ErisPulse/loaders/strategy.pyi +90 -0
  87. ErisPulse/sdk.py +435 -0
  88. ErisPulse/sdk.pyi +158 -0
  89. {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/METADATA +6 -20
  90. erispulse-2.3.4.dev2.dist-info/RECORD +103 -0
  91. {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/licenses/LICENSE +3 -3
  92. ErisPulse/Core/ux.py +0 -635
  93. ErisPulse/utils/cli.py +0 -1097
  94. erispulse-2.3.3.dev0.dist-info/RECORD +0 -35
  95. /ErisPulse/{utils → CLI}/console.py +0 -0
  96. {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/WHEEL +0 -0
  97. {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
+ ...