unrealon 1.0.8__py3-none-any.whl → 1.1.0__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 (302) hide show
  1. unrealon/__init__.py +23 -21
  2. unrealon-1.1.0.dist-info/METADATA +164 -0
  3. unrealon-1.1.0.dist-info/RECORD +82 -0
  4. {unrealon-1.0.8.dist-info → unrealon-1.1.0.dist-info}/WHEEL +1 -1
  5. unrealon-1.1.0.dist-info/entry_points.txt +9 -0
  6. {unrealon-1.0.8.dist-info → unrealon-1.1.0.dist-info/licenses}/LICENSE +1 -1
  7. unrealon_bridge/__init__.py +114 -0
  8. unrealon_bridge/cli.py +316 -0
  9. unrealon_bridge/client/__init__.py +93 -0
  10. unrealon_bridge/client/base.py +78 -0
  11. unrealon_bridge/client/commands.py +89 -0
  12. unrealon_bridge/client/connection.py +90 -0
  13. unrealon_bridge/client/events.py +65 -0
  14. unrealon_bridge/client/health.py +38 -0
  15. unrealon_bridge/client/html_parser.py +146 -0
  16. unrealon_bridge/client/logging.py +139 -0
  17. unrealon_bridge/client/proxy.py +70 -0
  18. unrealon_bridge/client/scheduler.py +450 -0
  19. unrealon_bridge/client/session.py +70 -0
  20. unrealon_bridge/configs/__init__.py +14 -0
  21. unrealon_bridge/configs/bridge_config.py +212 -0
  22. unrealon_bridge/configs/bridge_config.yaml +39 -0
  23. unrealon_bridge/models/__init__.py +138 -0
  24. unrealon_bridge/models/base.py +28 -0
  25. unrealon_bridge/models/command.py +41 -0
  26. unrealon_bridge/models/events.py +40 -0
  27. unrealon_bridge/models/html_parser.py +79 -0
  28. unrealon_bridge/models/logging.py +55 -0
  29. unrealon_bridge/models/parser.py +63 -0
  30. unrealon_bridge/models/proxy.py +41 -0
  31. unrealon_bridge/models/requests.py +95 -0
  32. unrealon_bridge/models/responses.py +88 -0
  33. unrealon_bridge/models/scheduler.py +592 -0
  34. unrealon_bridge/models/session.py +28 -0
  35. unrealon_bridge/server/__init__.py +91 -0
  36. unrealon_bridge/server/base.py +171 -0
  37. unrealon_bridge/server/handlers/__init__.py +23 -0
  38. unrealon_bridge/server/handlers/command.py +110 -0
  39. unrealon_bridge/server/handlers/html_parser.py +139 -0
  40. unrealon_bridge/server/handlers/logging.py +95 -0
  41. unrealon_bridge/server/handlers/parser.py +95 -0
  42. unrealon_bridge/server/handlers/proxy.py +75 -0
  43. unrealon_bridge/server/handlers/scheduler.py +545 -0
  44. unrealon_bridge/server/handlers/session.py +66 -0
  45. unrealon_browser/__init__.py +61 -18
  46. unrealon_browser/{src/cli → cli}/browser_cli.py +6 -13
  47. unrealon_browser/{src/cli → cli}/cookies_cli.py +5 -1
  48. unrealon_browser/{src/core → core}/browser_manager.py +2 -2
  49. unrealon_browser/{src/managers → managers}/captcha.py +1 -1
  50. unrealon_browser/{src/managers → managers}/cookies.py +1 -1
  51. unrealon_browser/managers/logger_bridge.py +231 -0
  52. unrealon_browser/{src/managers → managers}/profile.py +1 -1
  53. unrealon_driver/__init__.py +73 -19
  54. unrealon_driver/browser/__init__.py +8 -0
  55. unrealon_driver/browser/config.py +74 -0
  56. unrealon_driver/browser/manager.py +416 -0
  57. unrealon_driver/exceptions.py +28 -0
  58. unrealon_driver/parser/__init__.py +55 -0
  59. unrealon_driver/parser/cli_manager.py +141 -0
  60. unrealon_driver/parser/daemon_manager.py +227 -0
  61. unrealon_driver/parser/managers/__init__.py +46 -0
  62. unrealon_driver/parser/managers/browser.py +51 -0
  63. unrealon_driver/parser/managers/config.py +281 -0
  64. unrealon_driver/parser/managers/error.py +412 -0
  65. unrealon_driver/parser/managers/html.py +732 -0
  66. unrealon_driver/parser/managers/logging.py +609 -0
  67. unrealon_driver/parser/managers/result.py +321 -0
  68. unrealon_driver/parser/parser_manager.py +628 -0
  69. unrealon/sdk_config.py +0 -88
  70. unrealon-1.0.8.dist-info/METADATA +0 -803
  71. unrealon-1.0.8.dist-info/RECORD +0 -246
  72. unrealon_browser/pyproject.toml +0 -182
  73. unrealon_browser/src/__init__.py +0 -62
  74. unrealon_browser/src/managers/logger_bridge.py +0 -395
  75. unrealon_driver/README.md +0 -204
  76. unrealon_driver/pyproject.toml +0 -187
  77. unrealon_driver/src/__init__.py +0 -90
  78. unrealon_driver/src/cli/__init__.py +0 -10
  79. unrealon_driver/src/cli/main.py +0 -66
  80. unrealon_driver/src/cli/simple.py +0 -510
  81. unrealon_driver/src/config/__init__.py +0 -11
  82. unrealon_driver/src/config/auto_config.py +0 -478
  83. unrealon_driver/src/core/__init__.py +0 -18
  84. unrealon_driver/src/core/exceptions.py +0 -289
  85. unrealon_driver/src/core/parser.py +0 -638
  86. unrealon_driver/src/dto/__init__.py +0 -66
  87. unrealon_driver/src/dto/cli.py +0 -119
  88. unrealon_driver/src/dto/config.py +0 -18
  89. unrealon_driver/src/dto/events.py +0 -237
  90. unrealon_driver/src/dto/execution.py +0 -313
  91. unrealon_driver/src/dto/services.py +0 -311
  92. unrealon_driver/src/execution/__init__.py +0 -23
  93. unrealon_driver/src/execution/daemon_mode.py +0 -317
  94. unrealon_driver/src/execution/interactive_mode.py +0 -88
  95. unrealon_driver/src/execution/modes.py +0 -45
  96. unrealon_driver/src/execution/scheduled_mode.py +0 -209
  97. unrealon_driver/src/execution/test_mode.py +0 -250
  98. unrealon_driver/src/logging/__init__.py +0 -24
  99. unrealon_driver/src/logging/driver_logger.py +0 -512
  100. unrealon_driver/src/services/__init__.py +0 -24
  101. unrealon_driver/src/services/browser_service.py +0 -726
  102. unrealon_driver/src/services/llm/__init__.py +0 -15
  103. unrealon_driver/src/services/llm/browser_llm_service.py +0 -363
  104. unrealon_driver/src/services/llm/llm.py +0 -195
  105. unrealon_driver/src/services/logger_service.py +0 -232
  106. unrealon_driver/src/services/metrics_service.py +0 -185
  107. unrealon_driver/src/services/scheduler_service.py +0 -489
  108. unrealon_driver/src/services/websocket_service.py +0 -362
  109. unrealon_driver/src/utils/__init__.py +0 -16
  110. unrealon_driver/src/utils/service_factory.py +0 -317
  111. unrealon_driver/src/utils/time_formatter.py +0 -338
  112. unrealon_llm/README.md +0 -44
  113. unrealon_llm/__init__.py +0 -26
  114. unrealon_llm/pyproject.toml +0 -154
  115. unrealon_llm/src/__init__.py +0 -228
  116. unrealon_llm/src/cli/__init__.py +0 -0
  117. unrealon_llm/src/core/__init__.py +0 -11
  118. unrealon_llm/src/core/smart_client.py +0 -438
  119. unrealon_llm/src/dto/__init__.py +0 -155
  120. unrealon_llm/src/dto/models/__init__.py +0 -0
  121. unrealon_llm/src/dto/models/config.py +0 -343
  122. unrealon_llm/src/dto/models/core.py +0 -328
  123. unrealon_llm/src/dto/models/enums.py +0 -123
  124. unrealon_llm/src/dto/models/html_analysis.py +0 -345
  125. unrealon_llm/src/dto/models/statistics.py +0 -473
  126. unrealon_llm/src/dto/models/translation.py +0 -383
  127. unrealon_llm/src/dto/models/type_conversion.py +0 -462
  128. unrealon_llm/src/dto/schemas/__init__.py +0 -0
  129. unrealon_llm/src/exceptions.py +0 -392
  130. unrealon_llm/src/llm_config/__init__.py +0 -20
  131. unrealon_llm/src/llm_config/logging_config.py +0 -178
  132. unrealon_llm/src/llm_logging/__init__.py +0 -42
  133. unrealon_llm/src/llm_logging/llm_events.py +0 -107
  134. unrealon_llm/src/llm_logging/llm_logger.py +0 -466
  135. unrealon_llm/src/managers/__init__.py +0 -15
  136. unrealon_llm/src/managers/cache_manager.py +0 -67
  137. unrealon_llm/src/managers/cost_manager.py +0 -107
  138. unrealon_llm/src/managers/request_manager.py +0 -298
  139. unrealon_llm/src/modules/__init__.py +0 -0
  140. unrealon_llm/src/modules/html_processor/__init__.py +0 -25
  141. unrealon_llm/src/modules/html_processor/base_processor.py +0 -415
  142. unrealon_llm/src/modules/html_processor/details_processor.py +0 -85
  143. unrealon_llm/src/modules/html_processor/listing_processor.py +0 -91
  144. unrealon_llm/src/modules/html_processor/models/__init__.py +0 -20
  145. unrealon_llm/src/modules/html_processor/models/processing_models.py +0 -40
  146. unrealon_llm/src/modules/html_processor/models/universal_model.py +0 -56
  147. unrealon_llm/src/modules/html_processor/processor.py +0 -102
  148. unrealon_llm/src/modules/llm/__init__.py +0 -0
  149. unrealon_llm/src/modules/translator/__init__.py +0 -0
  150. unrealon_llm/src/provider.py +0 -116
  151. unrealon_llm/src/utils/__init__.py +0 -95
  152. unrealon_llm/src/utils/common.py +0 -64
  153. unrealon_llm/src/utils/data_extractor.py +0 -188
  154. unrealon_llm/src/utils/html_cleaner.py +0 -767
  155. unrealon_llm/src/utils/language_detector.py +0 -308
  156. unrealon_llm/src/utils/models_cache.py +0 -592
  157. unrealon_llm/src/utils/smart_counter.py +0 -229
  158. unrealon_llm/src/utils/token_counter.py +0 -189
  159. unrealon_sdk/README.md +0 -25
  160. unrealon_sdk/__init__.py +0 -30
  161. unrealon_sdk/pyproject.toml +0 -231
  162. unrealon_sdk/src/__init__.py +0 -150
  163. unrealon_sdk/src/cli/__init__.py +0 -12
  164. unrealon_sdk/src/cli/commands/__init__.py +0 -22
  165. unrealon_sdk/src/cli/commands/benchmark.py +0 -42
  166. unrealon_sdk/src/cli/commands/diagnostics.py +0 -573
  167. unrealon_sdk/src/cli/commands/health.py +0 -46
  168. unrealon_sdk/src/cli/commands/integration.py +0 -498
  169. unrealon_sdk/src/cli/commands/reports.py +0 -43
  170. unrealon_sdk/src/cli/commands/security.py +0 -36
  171. unrealon_sdk/src/cli/commands/server.py +0 -483
  172. unrealon_sdk/src/cli/commands/servers.py +0 -56
  173. unrealon_sdk/src/cli/commands/tests.py +0 -55
  174. unrealon_sdk/src/cli/main.py +0 -126
  175. unrealon_sdk/src/cli/utils/reporter.py +0 -519
  176. unrealon_sdk/src/clients/openapi.yaml +0 -3347
  177. unrealon_sdk/src/clients/python_http/__init__.py +0 -3
  178. unrealon_sdk/src/clients/python_http/api_config.py +0 -228
  179. unrealon_sdk/src/clients/python_http/models/BaseModel.py +0 -12
  180. unrealon_sdk/src/clients/python_http/models/BroadcastDeliveryStats.py +0 -33
  181. unrealon_sdk/src/clients/python_http/models/BroadcastMessage.py +0 -17
  182. unrealon_sdk/src/clients/python_http/models/BroadcastMessageRequest.py +0 -35
  183. unrealon_sdk/src/clients/python_http/models/BroadcastPriority.py +0 -10
  184. unrealon_sdk/src/clients/python_http/models/BroadcastResponse.py +0 -21
  185. unrealon_sdk/src/clients/python_http/models/BroadcastResultResponse.py +0 -33
  186. unrealon_sdk/src/clients/python_http/models/BroadcastTarget.py +0 -11
  187. unrealon_sdk/src/clients/python_http/models/ConnectionStats.py +0 -27
  188. unrealon_sdk/src/clients/python_http/models/ConnectionsResponse.py +0 -21
  189. unrealon_sdk/src/clients/python_http/models/DeveloperMessageResponse.py +0 -23
  190. unrealon_sdk/src/clients/python_http/models/ErrorResponse.py +0 -25
  191. unrealon_sdk/src/clients/python_http/models/HTTPValidationError.py +0 -16
  192. unrealon_sdk/src/clients/python_http/models/HealthResponse.py +0 -23
  193. unrealon_sdk/src/clients/python_http/models/HealthStatus.py +0 -33
  194. unrealon_sdk/src/clients/python_http/models/LogLevel.py +0 -10
  195. unrealon_sdk/src/clients/python_http/models/LoggingRequest.py +0 -27
  196. unrealon_sdk/src/clients/python_http/models/LoggingResponse.py +0 -23
  197. unrealon_sdk/src/clients/python_http/models/MaintenanceMode.py +0 -9
  198. unrealon_sdk/src/clients/python_http/models/MaintenanceModeRequest.py +0 -33
  199. unrealon_sdk/src/clients/python_http/models/MaintenanceStatusResponse.py +0 -39
  200. unrealon_sdk/src/clients/python_http/models/ParserCommandRequest.py +0 -25
  201. unrealon_sdk/src/clients/python_http/models/ParserMessageResponse.py +0 -21
  202. unrealon_sdk/src/clients/python_http/models/ParserRegistrationRequest.py +0 -28
  203. unrealon_sdk/src/clients/python_http/models/ParserRegistrationResponse.py +0 -25
  204. unrealon_sdk/src/clients/python_http/models/ParserType.py +0 -10
  205. unrealon_sdk/src/clients/python_http/models/ProxyBlockRequest.py +0 -19
  206. unrealon_sdk/src/clients/python_http/models/ProxyEndpointResponse.py +0 -20
  207. unrealon_sdk/src/clients/python_http/models/ProxyListResponse.py +0 -19
  208. unrealon_sdk/src/clients/python_http/models/ProxyProvider.py +0 -10
  209. unrealon_sdk/src/clients/python_http/models/ProxyPurchaseRequest.py +0 -25
  210. unrealon_sdk/src/clients/python_http/models/ProxyResponse.py +0 -47
  211. unrealon_sdk/src/clients/python_http/models/ProxyRotationRequest.py +0 -23
  212. unrealon_sdk/src/clients/python_http/models/ProxyStatus.py +0 -10
  213. unrealon_sdk/src/clients/python_http/models/ProxyUsageRequest.py +0 -19
  214. unrealon_sdk/src/clients/python_http/models/ProxyUsageStatsResponse.py +0 -26
  215. unrealon_sdk/src/clients/python_http/models/ServiceRegistrationDto.py +0 -23
  216. unrealon_sdk/src/clients/python_http/models/ServiceStatsResponse.py +0 -31
  217. unrealon_sdk/src/clients/python_http/models/SessionStartRequest.py +0 -23
  218. unrealon_sdk/src/clients/python_http/models/SuccessResponse.py +0 -25
  219. unrealon_sdk/src/clients/python_http/models/SystemNotificationResponse.py +0 -23
  220. unrealon_sdk/src/clients/python_http/models/ValidationError.py +0 -18
  221. unrealon_sdk/src/clients/python_http/models/ValidationErrorResponse.py +0 -21
  222. unrealon_sdk/src/clients/python_http/models/WebSocketMetrics.py +0 -21
  223. unrealon_sdk/src/clients/python_http/models/__init__.py +0 -44
  224. unrealon_sdk/src/clients/python_http/services/None_service.py +0 -35
  225. unrealon_sdk/src/clients/python_http/services/ParserManagement_service.py +0 -190
  226. unrealon_sdk/src/clients/python_http/services/ProxyManagement_service.py +0 -289
  227. unrealon_sdk/src/clients/python_http/services/SocketLogging_service.py +0 -187
  228. unrealon_sdk/src/clients/python_http/services/SystemHealth_service.py +0 -119
  229. unrealon_sdk/src/clients/python_http/services/WebSocketAPI_service.py +0 -198
  230. unrealon_sdk/src/clients/python_http/services/__init__.py +0 -0
  231. unrealon_sdk/src/clients/python_http/services/admin_service.py +0 -125
  232. unrealon_sdk/src/clients/python_http/services/async_None_service.py +0 -35
  233. unrealon_sdk/src/clients/python_http/services/async_ParserManagement_service.py +0 -190
  234. unrealon_sdk/src/clients/python_http/services/async_ProxyManagement_service.py +0 -289
  235. unrealon_sdk/src/clients/python_http/services/async_SocketLogging_service.py +0 -189
  236. unrealon_sdk/src/clients/python_http/services/async_SystemHealth_service.py +0 -123
  237. unrealon_sdk/src/clients/python_http/services/async_WebSocketAPI_service.py +0 -200
  238. unrealon_sdk/src/clients/python_http/services/async_admin_service.py +0 -125
  239. unrealon_sdk/src/clients/python_websocket/__init__.py +0 -28
  240. unrealon_sdk/src/clients/python_websocket/client.py +0 -490
  241. unrealon_sdk/src/clients/python_websocket/events.py +0 -732
  242. unrealon_sdk/src/clients/python_websocket/example.py +0 -136
  243. unrealon_sdk/src/clients/python_websocket/types.py +0 -871
  244. unrealon_sdk/src/core/__init__.py +0 -64
  245. unrealon_sdk/src/core/client.py +0 -556
  246. unrealon_sdk/src/core/config.py +0 -465
  247. unrealon_sdk/src/core/exceptions.py +0 -239
  248. unrealon_sdk/src/core/metadata.py +0 -191
  249. unrealon_sdk/src/core/models.py +0 -142
  250. unrealon_sdk/src/core/types.py +0 -68
  251. unrealon_sdk/src/dto/__init__.py +0 -268
  252. unrealon_sdk/src/dto/authentication.py +0 -108
  253. unrealon_sdk/src/dto/cache.py +0 -208
  254. unrealon_sdk/src/dto/common.py +0 -19
  255. unrealon_sdk/src/dto/concurrency.py +0 -393
  256. unrealon_sdk/src/dto/events.py +0 -108
  257. unrealon_sdk/src/dto/health.py +0 -339
  258. unrealon_sdk/src/dto/load_balancing.py +0 -336
  259. unrealon_sdk/src/dto/logging.py +0 -230
  260. unrealon_sdk/src/dto/performance.py +0 -165
  261. unrealon_sdk/src/dto/rate_limiting.py +0 -295
  262. unrealon_sdk/src/dto/resource_pooling.py +0 -128
  263. unrealon_sdk/src/dto/structured_logging.py +0 -112
  264. unrealon_sdk/src/dto/task_scheduling.py +0 -121
  265. unrealon_sdk/src/dto/websocket.py +0 -55
  266. unrealon_sdk/src/enterprise/__init__.py +0 -59
  267. unrealon_sdk/src/enterprise/authentication.py +0 -401
  268. unrealon_sdk/src/enterprise/cache_manager.py +0 -578
  269. unrealon_sdk/src/enterprise/error_recovery.py +0 -494
  270. unrealon_sdk/src/enterprise/event_system.py +0 -549
  271. unrealon_sdk/src/enterprise/health_monitor.py +0 -747
  272. unrealon_sdk/src/enterprise/load_balancer.py +0 -964
  273. unrealon_sdk/src/enterprise/logging/__init__.py +0 -68
  274. unrealon_sdk/src/enterprise/logging/cleanup.py +0 -156
  275. unrealon_sdk/src/enterprise/logging/development.py +0 -744
  276. unrealon_sdk/src/enterprise/logging/service.py +0 -410
  277. unrealon_sdk/src/enterprise/multithreading_manager.py +0 -853
  278. unrealon_sdk/src/enterprise/performance_monitor.py +0 -539
  279. unrealon_sdk/src/enterprise/proxy_manager.py +0 -696
  280. unrealon_sdk/src/enterprise/rate_limiter.py +0 -652
  281. unrealon_sdk/src/enterprise/resource_pool.py +0 -763
  282. unrealon_sdk/src/enterprise/task_scheduler.py +0 -709
  283. unrealon_sdk/src/internal/__init__.py +0 -10
  284. unrealon_sdk/src/internal/command_router.py +0 -497
  285. unrealon_sdk/src/internal/connection_manager.py +0 -397
  286. unrealon_sdk/src/internal/http_client.py +0 -446
  287. unrealon_sdk/src/internal/websocket_client.py +0 -420
  288. unrealon_sdk/src/provider.py +0 -471
  289. unrealon_sdk/src/utils.py +0 -234
  290. /unrealon_browser/{src/cli → cli}/__init__.py +0 -0
  291. /unrealon_browser/{src/cli → cli}/interactive_mode.py +0 -0
  292. /unrealon_browser/{src/cli → cli}/main.py +0 -0
  293. /unrealon_browser/{src/core → core}/__init__.py +0 -0
  294. /unrealon_browser/{src/dto → dto}/__init__.py +0 -0
  295. /unrealon_browser/{src/dto → dto}/models/config.py +0 -0
  296. /unrealon_browser/{src/dto → dto}/models/core.py +0 -0
  297. /unrealon_browser/{src/dto → dto}/models/dataclasses.py +0 -0
  298. /unrealon_browser/{src/dto → dto}/models/detection.py +0 -0
  299. /unrealon_browser/{src/dto → dto}/models/enums.py +0 -0
  300. /unrealon_browser/{src/dto → dto}/models/statistics.py +0 -0
  301. /unrealon_browser/{src/managers → managers}/__init__.py +0 -0
  302. /unrealon_browser/{src/managers → managers}/stealth.py +0 -0
@@ -1,573 +0,0 @@
1
- """
2
- System Diagnostics CLI Commands
3
-
4
- Health checks, troubleshooting, and system analysis.
5
- """
6
-
7
- import click
8
- import questionary
9
- import subprocess
10
- import json
11
- import psutil
12
- import platform
13
- import sys
14
- from pathlib import Path
15
- from rich.console import Console
16
- from rich.table import Table
17
- from rich.panel import Panel
18
- from rich.progress import Progress, SpinnerColumn, TextColumn
19
- from typing import Dict, List, Any, Optional
20
-
21
- console = Console()
22
-
23
-
24
- @click.group()
25
- def diagnostics_cli():
26
- """🩺 System diagnostics and health checks."""
27
- pass
28
-
29
-
30
- @diagnostics_cli.command()
31
- @click.option('--verbose', '-v', is_flag=True, help='Verbose output')
32
- @click.option('--output', '-o', help='Save report to file')
33
- def health(verbose, output):
34
- """🩺 Comprehensive system health check."""
35
- console.print("[bold blue]🩺 Running System Health Check[/bold blue]")
36
-
37
- health_report = run_health_check(verbose)
38
- display_health_report(health_report)
39
-
40
- if output:
41
- save_health_report(health_report, output)
42
-
43
- # Exit code based on health status
44
- if health_report['overall_status'] == 'healthy':
45
- console.print("[green]✅ System is healthy[/green]")
46
- exit(0)
47
- elif health_report['overall_status'] == 'warning':
48
- console.print("[yellow]⚠️ System has warnings[/yellow]")
49
- exit(0)
50
- else:
51
- console.print("[red]❌ System has critical issues[/red]")
52
- exit(1)
53
-
54
-
55
- @diagnostics_cli.command()
56
- @click.option('--module', help='Specific module to diagnose')
57
- @click.option('--fix', is_flag=True, help='Attempt to fix issues automatically')
58
- def troubleshoot(module, fix):
59
- """🔧 Troubleshoot common issues."""
60
- console.print("[bold blue]🔧 Running Troubleshooting Analysis[/bold blue]")
61
-
62
- issues = diagnose_issues(module)
63
- display_troubleshooting_results(issues)
64
-
65
- if fix and issues['fixable_issues']:
66
- console.print("[yellow]🔧 Attempting to fix issues...[/yellow]")
67
- fix_results = auto_fix_issues(issues['fixable_issues'])
68
- display_fix_results(fix_results)
69
-
70
-
71
- @diagnostics_cli.command()
72
- @click.option('--include-system', is_flag=True, help='Include system information')
73
- @click.option('--include-network', is_flag=True, help='Include network diagnostics')
74
- def info(include_system, include_network):
75
- """📋 Show detailed system information."""
76
- console.print("[bold blue]📋 System Information[/bold blue]")
77
-
78
- info_data = collect_system_info(include_system, include_network)
79
- display_system_info(info_data)
80
-
81
-
82
- @diagnostics_cli.command()
83
- @click.option('--test-type', default='all',
84
- type=click.Choice(['all', 'connectivity', 'performance', 'security']),
85
- help='Type of connectivity test')
86
- def connectivity(test_type):
87
- """🌐 Test network connectivity and services."""
88
- console.print(f"[bold blue]🌐 Testing Connectivity - {test_type.upper()}[/bold blue]")
89
-
90
- connectivity_results = test_connectivity(test_type)
91
- display_connectivity_results(connectivity_results)
92
-
93
-
94
- @diagnostics_cli.command()
95
- def interactive():
96
- """🎯 Interactive diagnostics workflow."""
97
- console.print("[bold blue]🩺 Interactive System Diagnostics[/bold blue]")
98
-
99
- diagnostic_type = questionary.select(
100
- "What type of diagnostic would you like to run?",
101
- choices=[
102
- "🩺 Full health check (comprehensive analysis)",
103
- "🔧 Troubleshoot specific issue",
104
- "📋 System information report",
105
- "🌐 Network connectivity test",
106
- "⚡ Performance analysis",
107
- "🔒 Security configuration check"
108
- ]
109
- ).ask()
110
-
111
- if "Full health check" in diagnostic_type:
112
- run_interactive_health_check()
113
- elif "Troubleshoot specific" in diagnostic_type:
114
- run_interactive_troubleshooting()
115
- elif "System information" in diagnostic_type:
116
- run_interactive_system_info()
117
- elif "Network connectivity" in diagnostic_type:
118
- run_interactive_connectivity_test()
119
- elif "Performance analysis" in diagnostic_type:
120
- run_interactive_performance_analysis()
121
- elif "Security configuration" in diagnostic_type:
122
- run_interactive_security_check()
123
-
124
-
125
- def run_health_check(verbose: bool = False) -> Dict[str, Any]:
126
- """Run comprehensive health check."""
127
- health_checks = {
128
- 'python_environment': check_python_environment(),
129
- 'dependencies': check_dependencies(),
130
- 'sdk_installation': check_sdk_installation(),
131
- 'configuration': check_configuration(),
132
- 'file_permissions': check_file_permissions(),
133
- 'system_resources': check_system_resources(),
134
- 'network_access': check_network_access()
135
- }
136
-
137
- # Calculate overall status
138
- statuses = [check['status'] for check in health_checks.values()]
139
- if any(status == 'critical' for status in statuses):
140
- overall_status = 'critical'
141
- elif any(status == 'warning' for status in statuses):
142
- overall_status = 'warning'
143
- else:
144
- overall_status = 'healthy'
145
-
146
- return {
147
- 'overall_status': overall_status,
148
- 'checks': health_checks,
149
- 'summary': generate_health_summary(health_checks),
150
- 'timestamp': get_timestamp()
151
- }
152
-
153
-
154
- def check_python_environment() -> Dict[str, Any]:
155
- """Check Python environment health."""
156
- issues = []
157
-
158
- # Check Python version
159
- if sys.version_info < (3, 9):
160
- issues.append(f"Python {sys.version} is below minimum requirement (3.9+)")
161
-
162
- # Check virtual environment
163
- in_venv = hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix)
164
- if not in_venv:
165
- issues.append("Not running in virtual environment (recommended)")
166
-
167
- # Check pip version
168
- try:
169
- pip_version = subprocess.run([sys.executable, '-m', 'pip', '--version'],
170
- capture_output=True, text=True)
171
- if pip_version.returncode != 0:
172
- issues.append("pip is not accessible")
173
- except Exception:
174
- issues.append("pip check failed")
175
-
176
- return {
177
- 'status': 'critical' if any('minimum requirement' in issue for issue in issues) else 'warning' if issues else 'healthy',
178
- 'issues': issues,
179
- 'python_version': sys.version,
180
- 'virtual_env': in_venv
181
- }
182
-
183
-
184
- def check_dependencies() -> Dict[str, Any]:
185
- """Check project dependencies."""
186
- issues = []
187
- missing_deps = []
188
-
189
- # Check core dependencies
190
- required_deps = [
191
- 'pydantic', 'aiohttp', 'python-socketio', 'click', 'questionary', 'rich'
192
- ]
193
-
194
- for dep in required_deps:
195
- try:
196
- __import__(dep.replace('-', '_'))
197
- except ImportError:
198
- missing_deps.append(dep)
199
-
200
- if missing_deps:
201
- issues.append(f"Missing dependencies: {', '.join(missing_deps)}")
202
-
203
- # Check for outdated packages
204
- try:
205
- result = subprocess.run([sys.executable, '-m', 'pip', 'list', '--outdated'],
206
- capture_output=True, text=True)
207
- if result.stdout and len(result.stdout.split('\n')) > 2:
208
- issues.append("Some packages may be outdated")
209
- except Exception:
210
- pass
211
-
212
- return {
213
- 'status': 'critical' if missing_deps else 'warning' if issues else 'healthy',
214
- 'issues': issues,
215
- 'missing_dependencies': missing_deps
216
- }
217
-
218
-
219
- def check_sdk_installation() -> Dict[str, Any]:
220
- """Check SDK installation."""
221
- issues = []
222
-
223
- # Check if unrealon_sdk module is importable
224
- try:
225
- import unrealon_sdk
226
- sdk_path = Path(unrealon_sdk.__file__).parent
227
- except ImportError:
228
- issues.append("UnrealOn SDK is not properly installed")
229
- return {'status': 'critical', 'issues': issues}
230
-
231
- # Check core modules
232
- core_modules = ['core', 'internal', 'enterprise', 'dto']
233
- for module in core_modules:
234
- module_path = sdk_path / module
235
- if not module_path.exists():
236
- issues.append(f"Missing core module: {module}")
237
-
238
- # Check test directory
239
- test_path = sdk_path / 'tests'
240
- if not test_path.exists():
241
- issues.append("Test directory not found")
242
-
243
- return {
244
- 'status': 'critical' if any('Missing core module' in issue for issue in issues) else 'warning' if issues else 'healthy',
245
- 'issues': issues,
246
- 'sdk_path': str(sdk_path)
247
- }
248
-
249
-
250
- def check_configuration() -> Dict[str, Any]:
251
- """Check configuration validity."""
252
- issues = []
253
-
254
- try:
255
- from unrealon_sdk.src.core.config import AdapterConfig
256
-
257
- # Test config creation
258
- test_config = AdapterConfig(
259
- api_key="test_key_validation",
260
- server_url="ws://localhost:8080",
261
- parser_id="test_parser",
262
- parser_name="Test Parser"
263
- )
264
-
265
- except Exception as e:
266
- issues.append(f"Configuration validation failed: {str(e)}")
267
-
268
- return {
269
- 'status': 'critical' if issues else 'healthy',
270
- 'issues': issues
271
- }
272
-
273
-
274
- def check_file_permissions() -> Dict[str, Any]:
275
- """Check file permissions."""
276
- issues = []
277
-
278
- # Check write permissions in current directory
279
- current_dir = Path.cwd()
280
- if not current_dir.is_dir() or not os.access(current_dir, os.W_OK):
281
- issues.append("No write permission in current directory")
282
-
283
- # Check SDK directory permissions
284
- try:
285
- import unrealon_sdk
286
- sdk_path = Path(unrealon_sdk.__file__).parent
287
- if not os.access(sdk_path, os.R_OK):
288
- issues.append("No read permission for SDK directory")
289
- except Exception:
290
- pass
291
-
292
- return {
293
- 'status': 'warning' if issues else 'healthy',
294
- 'issues': issues
295
- }
296
-
297
-
298
- def check_system_resources() -> Dict[str, Any]:
299
- """Check system resources."""
300
- issues = []
301
-
302
- # Check memory
303
- memory = psutil.virtual_memory()
304
- if memory.percent > 90:
305
- issues.append(f"High memory usage: {memory.percent:.1f}%")
306
-
307
- # Check disk space
308
- disk = psutil.disk_usage('/')
309
- if disk.percent > 90:
310
- issues.append(f"Low disk space: {disk.percent:.1f}% used")
311
-
312
- # Check CPU
313
- cpu_percent = psutil.cpu_percent(interval=1)
314
- if cpu_percent > 90:
315
- issues.append(f"High CPU usage: {cpu_percent:.1f}%")
316
-
317
- return {
318
- 'status': 'warning' if issues else 'healthy',
319
- 'issues': issues,
320
- 'memory_percent': memory.percent,
321
- 'disk_percent': disk.percent,
322
- 'cpu_percent': cpu_percent
323
- }
324
-
325
-
326
- def check_network_access() -> Dict[str, Any]:
327
- """Check network access."""
328
- issues = []
329
-
330
- # Test DNS resolution
331
- try:
332
- import socket
333
- socket.gethostbyname('google.com')
334
- except Exception:
335
- issues.append("DNS resolution failed")
336
-
337
- # Test HTTP connectivity
338
- try:
339
- import requests
340
- response = requests.get('https://httpbin.org/get', timeout=10)
341
- if response.status_code != 200:
342
- issues.append("HTTP connectivity issues")
343
- except Exception:
344
- issues.append("HTTP connectivity failed")
345
-
346
- return {
347
- 'status': 'warning' if issues else 'healthy',
348
- 'issues': issues
349
- }
350
-
351
-
352
- def generate_health_summary(checks: Dict[str, Any]) -> Dict[str, Any]:
353
- """Generate health check summary."""
354
- total_checks = len(checks)
355
- healthy_checks = sum(1 for check in checks.values() if check['status'] == 'healthy')
356
- warning_checks = sum(1 for check in checks.values() if check['status'] == 'warning')
357
- critical_checks = sum(1 for check in checks.values() if check['status'] == 'critical')
358
-
359
- return {
360
- 'total_checks': total_checks,
361
- 'healthy': healthy_checks,
362
- 'warnings': warning_checks,
363
- 'critical': critical_checks,
364
- 'health_score': (healthy_checks / total_checks) * 100
365
- }
366
-
367
-
368
- def display_health_report(report: Dict[str, Any]):
369
- """Display health check report."""
370
- summary = report['summary']
371
-
372
- # Health score panel
373
- health_score = summary['health_score']
374
- if health_score >= 90:
375
- score_color = "green"
376
- score_emoji = "💚"
377
- elif health_score >= 70:
378
- score_color = "yellow"
379
- score_emoji = "💛"
380
- else:
381
- score_color = "red"
382
- score_emoji = "❤️"
383
-
384
- summary_text = f"""
385
- [bold]System Health Report[/bold]
386
-
387
- {score_emoji} Health Score: {health_score:.1f}%
388
- ✅ Healthy: {summary['healthy']}/{summary['total_checks']}
389
- ⚠️ Warnings: {summary['warnings']}
390
- ❌ Critical: {summary['critical']}
391
-
392
- [bold]Overall Status: {report['overall_status'].upper()}[/bold]
393
- """
394
-
395
- console.print(Panel(summary_text, title="Health Check Summary", border_style=score_color))
396
-
397
- # Detailed checks table
398
- table = Table(title="Detailed Health Checks")
399
- table.add_column("Component", style="cyan")
400
- table.add_column("Status", style="magenta")
401
- table.add_column("Issues", style="yellow")
402
-
403
- for check_name, check_data in report['checks'].items():
404
- status_emoji = {"healthy": "✅", "warning": "⚠️", "critical": "❌"}
405
- status_display = f"{status_emoji.get(check_data['status'], '❓')} {check_data['status']}"
406
- issues_display = "; ".join(check_data['issues']) if check_data['issues'] else "None"
407
-
408
- table.add_row(
409
- check_name.replace('_', ' ').title(),
410
- status_display,
411
- issues_display[:100] + "..." if len(issues_display) > 100 else issues_display
412
- )
413
-
414
- console.print(table)
415
-
416
-
417
- def diagnose_issues(module: Optional[str]) -> Dict[str, Any]:
418
- """Diagnose common issues."""
419
- # Implementation for issue diagnosis
420
- return {
421
- 'issues_found': [],
422
- 'fixable_issues': [],
423
- 'recommendations': []
424
- }
425
-
426
-
427
- def display_troubleshooting_results(issues: Dict[str, Any]):
428
- """Display troubleshooting results."""
429
- # Implementation for displaying troubleshooting results
430
- pass
431
-
432
-
433
- def auto_fix_issues(fixable_issues: List[Dict]) -> Dict[str, Any]:
434
- """Automatically fix issues."""
435
- # Implementation for auto-fixing issues
436
- return {'fixed': [], 'failed': []}
437
-
438
-
439
- def display_fix_results(results: Dict[str, Any]):
440
- """Display fix results."""
441
- # Implementation for displaying fix results
442
- pass
443
-
444
-
445
- def collect_system_info(include_system: bool, include_network: bool) -> Dict[str, Any]:
446
- """Collect comprehensive system information."""
447
- info = {
448
- 'python': {
449
- 'version': sys.version,
450
- 'executable': sys.executable,
451
- 'platform': platform.platform()
452
- },
453
- 'sdk': get_sdk_info()
454
- }
455
-
456
- if include_system:
457
- info['system'] = get_system_info()
458
-
459
- if include_network:
460
- info['network'] = get_network_info()
461
-
462
- return info
463
-
464
-
465
- def get_sdk_info() -> Dict[str, Any]:
466
- """Get SDK information."""
467
- try:
468
- import unrealon_sdk
469
- return {
470
- 'version': getattr(unrealon_sdk, '__version__', 'unknown'),
471
- 'path': str(Path(unrealon_sdk.__file__).parent)
472
- }
473
- except ImportError:
474
- return {'error': 'SDK not installed'}
475
-
476
-
477
- def get_system_info() -> Dict[str, Any]:
478
- """Get system information."""
479
- return {
480
- 'cpu_count': psutil.cpu_count(),
481
- 'memory_gb': psutil.virtual_memory().total / (1024**3),
482
- 'disk_gb': psutil.disk_usage('/').total / (1024**3),
483
- 'platform': platform.platform(),
484
- 'python_version': platform.python_version()
485
- }
486
-
487
-
488
- def get_network_info() -> Dict[str, Any]:
489
- """Get network information."""
490
- return {
491
- 'hostname': platform.node(),
492
- 'network_interfaces': len(psutil.net_if_addrs())
493
- }
494
-
495
-
496
- def display_system_info(info: Dict[str, Any]):
497
- """Display system information."""
498
- # Create info panels
499
- for category, data in info.items():
500
- if isinstance(data, dict):
501
- info_text = "\n".join([f"{k}: {v}" for k, v in data.items()])
502
- console.print(Panel(info_text, title=category.title()))
503
-
504
-
505
- def test_connectivity(test_type: str) -> Dict[str, Any]:
506
- """Test network connectivity."""
507
- # Implementation for connectivity testing
508
- return {'status': 'healthy', 'tests': []}
509
-
510
-
511
- def display_connectivity_results(results: Dict[str, Any]):
512
- """Display connectivity test results."""
513
- # Implementation for displaying connectivity results
514
- pass
515
-
516
-
517
- def get_timestamp() -> str:
518
- """Get current timestamp."""
519
- from datetime import datetime
520
- return datetime.now().isoformat()
521
-
522
-
523
- def save_health_report(report: Dict[str, Any], output: str):
524
- """Save health report to file."""
525
- with open(output, 'w') as f:
526
- json.dump(report, f, indent=2)
527
- console.print(f"[green]Health report saved to {output}[/green]")
528
-
529
-
530
- def run_interactive_health_check():
531
- """Run interactive health check."""
532
- verbose = questionary.confirm("Enable verbose output?").ask()
533
- console.print("[yellow]🩺 Running comprehensive health check...[/yellow]")
534
-
535
-
536
- def run_interactive_troubleshooting():
537
- """Run interactive troubleshooting."""
538
- module = questionary.text("Module to diagnose (optional):").ask()
539
- console.print(f"[yellow]🔧 Troubleshooting {module or 'all modules'}...[/yellow]")
540
-
541
-
542
- def run_interactive_system_info():
543
- """Run interactive system info."""
544
- include_system = questionary.confirm("Include system information?").ask()
545
- include_network = questionary.confirm("Include network information?").ask()
546
- console.print("[yellow]📋 Collecting system information...[/yellow]")
547
-
548
-
549
- def run_interactive_connectivity_test():
550
- """Run interactive connectivity test."""
551
- test_type = questionary.select(
552
- "Connectivity test type:",
553
- choices=["all", "connectivity", "performance", "security"]
554
- ).ask()
555
- console.print(f"[yellow]🌐 Testing {test_type} connectivity...[/yellow]")
556
-
557
-
558
- def run_interactive_performance_analysis():
559
- """Run interactive performance analysis."""
560
- console.print("[yellow]⚡ Running performance analysis...[/yellow]")
561
-
562
-
563
- def run_interactive_security_check():
564
- """Run interactive security check."""
565
- console.print("[yellow]🔒 Checking security configuration...[/yellow]")
566
-
567
-
568
- # Import os for file permissions check
569
- import os
570
-
571
-
572
- if __name__ == '__main__':
573
- diagnostics_cli()
@@ -1,46 +0,0 @@
1
- """
2
- Health Check Commands
3
-
4
- System health diagnostics for UnrealOn SDK.
5
- """
6
-
7
- import sys
8
- from rich.console import Console
9
- from typing import Dict, List, Any
10
-
11
- console = Console()
12
-
13
-
14
- def run_health_check() -> Dict[str, Any]:
15
- """System health check."""
16
- console.print("[bold blue]🩺 System diagnostics...[/bold blue]")
17
-
18
- issues = []
19
-
20
- # Check Python version
21
- if sys.version_info < (3, 9):
22
- issues.append("Python version below 3.9")
23
-
24
- # Check SDK
25
- try:
26
- import unrealon_sdk
27
- console.print("[green]✅ SDK installed[/green]")
28
- except ImportError:
29
- issues.append("SDK not installed")
30
-
31
- # Check dependencies
32
- deps = ['pydantic', 'aiohttp', 'click', 'rich']
33
- for dep in deps:
34
- try:
35
- __import__(dep)
36
- except ImportError:
37
- issues.append(f"Missing: {dep}")
38
-
39
- if not issues:
40
- console.print("[green]✅ System is healthy![/green]")
41
- return {'status': 'healthy', 'issues': []}
42
- else:
43
- console.print("[yellow]⚠️ Issues found:[/yellow]")
44
- for issue in issues:
45
- console.print(f"[red]• {issue}[/red]")
46
- return {'status': 'issues', 'issues': issues}