unrealon 1.0.9__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.9.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.9.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.9.dist-info/METADATA +0 -810
  71. unrealon-1.0.9.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,732 +0,0 @@
1
- """
2
- UnrealServer WebSocket Events and Types
3
-
4
- Auto-generated from server models - DO NOT EDIT MANUALLY
5
- """
6
-
7
- from datetime import datetime
8
- from enum import Enum
9
- from typing import Any, Dict, List, Optional, Union
10
-
11
- from pydantic import BaseModel, Field, ConfigDict
12
-
13
-
14
- class SocketEvent(str, Enum):
15
- """Socket.IO event names for WebSocket communication."""
16
-
17
- CONNECT = "connect"
18
- DISCONNECT = "disconnect"
19
- PING = "ping"
20
- PONG = "pong"
21
- PARSER_REGISTER = "parser_register"
22
- PARSER_COMMAND = "parser_command"
23
- PARSER_STATUS = "parser_status"
24
- PARSER_REGISTERED = "parser_registered"
25
- PARSER_DISCONNECTED = "parser_disconnected"
26
- COMMAND_REQUEST = "command_request"
27
- COMMAND_RESPONSE = "command_response"
28
- COMMAND_STATUS = "command_status"
29
- HEALTH_STATUS = "health_status"
30
- HEALTH_CHECK = "health_check"
31
- ADMIN_SUBSCRIBE = "admin_subscribe"
32
- ADMIN_UNSUBSCRIBE = "admin_unsubscribe"
33
- ADMIN_BROADCAST = "admin_broadcast"
34
- ADMIN_NOTIFICATION = "admin_notification"
35
- SYSTEM_NOTIFICATION = "system_notification"
36
- SYSTEM_EVENT = "system_event"
37
- MAINTENANCE_NOTIFICATION = "maintenance_notification"
38
- DEVELOPER_MESSAGE = "developer_message"
39
- LOG_ENTRY = "log_entry"
40
- ERROR = "error"
41
-
42
- def __str__(self) -> str:
43
- """String representation of the event."""
44
- return self.value
45
-
46
-
47
- class EventType(str, Enum):
48
- """System event types."""
49
-
50
- START_PARSING = "start_parsing"
51
- STOP_PARSING = "stop_parsing"
52
- PAUSE_PARSING = "pause_parsing"
53
- RESUME_PARSING = "resume_parsing"
54
- GET_STATUS = "get_status"
55
- UPDATE_CONFIG = "update_config"
56
- HEALTH_CHECK = "health_check"
57
-
58
- def __str__(self) -> str:
59
- """String representation of the event type."""
60
- return self.value
61
-
62
-
63
- class AdminWebSocketChannel(str, Enum):
64
- """Admin WebSocket channel types."""
65
-
66
- ADMIN_EVENTS = "admin_events"
67
- SYSTEM_METRICS = "admin_system_metrics"
68
- OPERATIONS = "admin_operations"
69
- ALERTS = "admin_alerts"
70
- CRITICAL_ALERTS = "admin_critical_alerts"
71
- WARNINGS = "admin_warnings"
72
- USER_ACTIVITY = "admin_user_activity"
73
- PROXY_STATUS = "admin_proxy_status"
74
- PARSER_STATUS = "admin_parser_status"
75
- REAL_TIME_ANALYTICS = "admin_real_time_analytics"
76
-
77
- def __str__(self) -> str:
78
- """String representation of the admin channel."""
79
- return self.value
80
-
81
-
82
- class SubscriptionType(str, Enum):
83
- """WebSocket subscription types."""
84
-
85
- REAL_TIME_METRICS = "real_time_metrics"
86
- SYSTEM_ALERTS = "system_alerts"
87
- OPERATION_PROGRESS = "operation_progress"
88
- USER_ACTIVITIES = "user_activities"
89
- PROXY_UPDATES = "proxy_updates"
90
- PARSER_UPDATES = "parser_updates"
91
- CUSTOM_ANALYTICS = "custom_analytics"
92
-
93
- def __str__(self) -> str:
94
- """String representation of the subscription type."""
95
- return self.value
96
-
97
-
98
- # ===============================================
99
- # WebSocket Message Models
100
- # ===============================================
101
-
102
- class ConnectionInfo(BaseModel):
103
- """
104
- Pydantic model for WebSocket connection information.
105
-
106
- Auto-generated from server Pydantic model.
107
- """
108
-
109
- # Model fields will be defined based on server Pydantic model
110
- pass
111
-
112
- model_config = ConfigDict(
113
- json_encoders={
114
- datetime: lambda v: v.isoformat() if v else None
115
- },
116
- title="ConnectionInfo",
117
- description="Pydantic model for WebSocket connection information."
118
- )
119
-
120
- class ConnectionStats(BaseModel):
121
- """
122
- Pydantic model for WebSocket connection statistics.
123
-
124
- Auto-generated from server Pydantic model.
125
- """
126
-
127
- # Model fields will be defined based on server Pydantic model
128
- pass
129
-
130
- model_config = ConfigDict(
131
- json_encoders={
132
- datetime: lambda v: v.isoformat() if v else None
133
- },
134
- title="ConnectionStats",
135
- description="Pydantic model for WebSocket connection statistics."
136
- )
137
-
138
- class HealthStatus(BaseModel):
139
- """
140
- Pydantic model for WebSocket service health status.
141
-
142
- Auto-generated from server Pydantic model.
143
- """
144
-
145
- # Model fields will be defined based on server Pydantic model
146
- pass
147
-
148
- model_config = ConfigDict(
149
- json_encoders={
150
- datetime: lambda v: v.isoformat() if v else None
151
- },
152
- title="HealthStatus",
153
- description="Pydantic model for WebSocket service health status."
154
- )
155
-
156
- class WebSocketMetrics(BaseModel):
157
- """
158
- Pydantic model for WebSocket performance metrics.
159
-
160
- Auto-generated from server Pydantic model.
161
- """
162
-
163
- # Model fields will be defined based on server Pydantic model
164
- pass
165
-
166
- model_config = ConfigDict(
167
- json_encoders={
168
- datetime: lambda v: v.isoformat() if v else None
169
- },
170
- title="WebSocketMetrics",
171
- description="Pydantic model for WebSocket performance metrics."
172
- )
173
-
174
- class LogEntryMessage(BaseModel):
175
- """
176
- WebSocket message for log entry broadcast.
177
-
178
- Auto-generated from server Pydantic model.
179
- """
180
-
181
- # Model fields will be defined based on server Pydantic model
182
- pass
183
-
184
- model_config = ConfigDict(
185
- json_encoders={
186
- datetime: lambda v: v.isoformat() if v else None
187
- },
188
- title="LogEntryMessage",
189
- description="WebSocket message for log entry broadcast."
190
- )
191
-
192
- class CommandMessage(BaseModel):
193
- """
194
- WebSocket message for command routing.
195
-
196
- Auto-generated from server Pydantic model.
197
- """
198
-
199
- # Model fields will be defined based on server Pydantic model
200
- pass
201
-
202
- model_config = ConfigDict(
203
- json_encoders={
204
- datetime: lambda v: v.isoformat() if v else None
205
- },
206
- title="CommandMessage",
207
- description="WebSocket message for command routing."
208
- )
209
-
210
- class CommandCompletionMessage(BaseModel):
211
- """
212
- WebSocket message for command completion notification.
213
-
214
- Auto-generated from server Pydantic model.
215
- """
216
-
217
- # Model fields will be defined based on server Pydantic model
218
- pass
219
-
220
- model_config = ConfigDict(
221
- json_encoders={
222
- datetime: lambda v: v.isoformat() if v else None
223
- },
224
- title="CommandCompletionMessage",
225
- description="WebSocket message for command completion notification."
226
- )
227
-
228
- class AdminBroadcastMessage(BaseModel):
229
- """
230
- WebSocket message for admin broadcast.
231
-
232
- Auto-generated from server Pydantic model.
233
- """
234
-
235
- # Model fields will be defined based on server Pydantic model
236
- pass
237
-
238
- model_config = ConfigDict(
239
- json_encoders={
240
- datetime: lambda v: v.isoformat() if v else None
241
- },
242
- title="AdminBroadcastMessage",
243
- description="WebSocket message for admin broadcast."
244
- )
245
-
246
- class MaintenanceNotificationMessage(BaseModel):
247
- """
248
- WebSocket message for maintenance notifications.
249
-
250
- Auto-generated from server Pydantic model.
251
- """
252
-
253
- # Model fields will be defined based on server Pydantic model
254
- pass
255
-
256
- model_config = ConfigDict(
257
- json_encoders={
258
- datetime: lambda v: v.isoformat() if v else None
259
- },
260
- title="MaintenanceNotificationMessage",
261
- description="WebSocket message for maintenance notifications."
262
- )
263
-
264
- class BroadcastResponse(BaseModel):
265
- """
266
- Response model for broadcast operations.
267
-
268
- Auto-generated from server Pydantic model.
269
- """
270
-
271
- # Model fields will be defined based on server Pydantic model
272
- pass
273
-
274
- model_config = ConfigDict(
275
- json_encoders={
276
- datetime: lambda v: v.isoformat() if v else None
277
- },
278
- title="BroadcastResponse",
279
- description="Response model for broadcast operations."
280
- )
281
-
282
- class ParserMessageResponse(BaseModel):
283
- """
284
- Response model for parser message operations.
285
-
286
- Auto-generated from server Pydantic model.
287
- """
288
-
289
- # Model fields will be defined based on server Pydantic model
290
- pass
291
-
292
- model_config = ConfigDict(
293
- json_encoders={
294
- datetime: lambda v: v.isoformat() if v else None
295
- },
296
- title="ParserMessageResponse",
297
- description="Response model for parser message operations."
298
- )
299
-
300
- class DeveloperMessageResponse(BaseModel):
301
- """
302
- Response model for developer message operations.
303
-
304
- Auto-generated from server Pydantic model.
305
- """
306
-
307
- # Model fields will be defined based on server Pydantic model
308
- pass
309
-
310
- model_config = ConfigDict(
311
- json_encoders={
312
- datetime: lambda v: v.isoformat() if v else None
313
- },
314
- title="DeveloperMessageResponse",
315
- description="Response model for developer message operations."
316
- )
317
-
318
- class ConnectionsResponse(BaseModel):
319
- """
320
- Response model for connections information.
321
-
322
- Auto-generated from server Pydantic model.
323
- """
324
-
325
- # Model fields will be defined based on server Pydantic model
326
- pass
327
-
328
- model_config = ConfigDict(
329
- json_encoders={
330
- datetime: lambda v: v.isoformat() if v else None
331
- },
332
- title="ConnectionsResponse",
333
- description="Response model for connections information."
334
- )
335
-
336
- class SystemNotificationResponse(BaseModel):
337
- """
338
- Response model for system notification broadcast.
339
-
340
- Auto-generated from server Pydantic model.
341
- """
342
-
343
- # Model fields will be defined based on server Pydantic model
344
- pass
345
-
346
- model_config = ConfigDict(
347
- json_encoders={
348
- datetime: lambda v: v.isoformat() if v else None
349
- },
350
- title="SystemNotificationResponse",
351
- description="Response model for system notification broadcast."
352
- )
353
-
354
- class WebSocketEventBase(BaseModel):
355
- """
356
- Base model for all WebSocket events.
357
-
358
- Auto-generated from server Pydantic model.
359
- """
360
-
361
- # Model fields will be defined based on server Pydantic model
362
- pass
363
-
364
- model_config = ConfigDict(
365
- json_encoders={
366
- datetime: lambda v: v.isoformat() if v else None
367
- },
368
- title="WebSocketEventBase",
369
- description="Base model for all WebSocket events."
370
- )
371
-
372
- class ConnectionEvent(BaseModel):
373
- """
374
- WebSocket connection established event.
375
-
376
- Auto-generated from server Pydantic model.
377
- """
378
-
379
- # Model fields will be defined based on server Pydantic model
380
- pass
381
-
382
- model_config = ConfigDict(
383
- json_encoders={
384
- datetime: lambda v: v.isoformat() if v else None
385
- },
386
- title="ConnectionEvent",
387
- description="WebSocket connection established event."
388
- )
389
-
390
- class PongEvent(BaseModel):
391
- """
392
- WebSocket pong response event.
393
-
394
- Auto-generated from server Pydantic model.
395
- """
396
-
397
- # Model fields will be defined based on server Pydantic model
398
- pass
399
-
400
- model_config = ConfigDict(
401
- json_encoders={
402
- datetime: lambda v: v.isoformat() if v else None
403
- },
404
- title="PongEvent",
405
- description="WebSocket pong response event."
406
- )
407
-
408
- class ErrorEvent(BaseModel):
409
- """
410
- WebSocket error event.
411
-
412
- Auto-generated from server Pydantic model.
413
- """
414
-
415
- # Model fields will be defined based on server Pydantic model
416
- pass
417
-
418
- model_config = ConfigDict(
419
- json_encoders={
420
- datetime: lambda v: v.isoformat() if v else None
421
- },
422
- title="ErrorEvent",
423
- description="WebSocket error event."
424
- )
425
-
426
- class ParserWebSocketRegistrationRequest(BaseModel):
427
- """
428
- Parser WebSocket session registration request - simple data model.
429
-
430
- Auto-generated from server Pydantic model.
431
- """
432
-
433
- # Model fields will be defined based on server Pydantic model
434
- pass
435
-
436
- model_config = ConfigDict(
437
- json_encoders={
438
- datetime: lambda v: v.isoformat() if v else None
439
- },
440
- title="ParserWebSocketRegistrationRequest",
441
- description="Parser WebSocket session registration request - simple data model."
442
- )
443
-
444
- class ParserRegisteredEvent(BaseModel):
445
- """
446
- Parser registration success event.
447
-
448
- Auto-generated from server Pydantic model.
449
- """
450
-
451
- # Model fields will be defined based on server Pydantic model
452
- pass
453
-
454
- model_config = ConfigDict(
455
- json_encoders={
456
- datetime: lambda v: v.isoformat() if v else None
457
- },
458
- title="ParserRegisteredEvent",
459
- description="Parser registration success event."
460
- )
461
-
462
- class ParserCommandEvent(BaseModel):
463
- """
464
- Parser command execution event.
465
-
466
- Auto-generated from server Pydantic model.
467
- """
468
-
469
- # Model fields will be defined based on server Pydantic model
470
- pass
471
-
472
- model_config = ConfigDict(
473
- json_encoders={
474
- datetime: lambda v: v.isoformat() if v else None
475
- },
476
- title="ParserCommandEvent",
477
- description="Parser command execution event."
478
- )
479
-
480
- class ParserStatusEvent(BaseModel):
481
- """
482
- Parser status update event.
483
-
484
- Auto-generated from server Pydantic model.
485
- """
486
-
487
- # Model fields will be defined based on server Pydantic model
488
- pass
489
-
490
- model_config = ConfigDict(
491
- json_encoders={
492
- datetime: lambda v: v.isoformat() if v else None
493
- },
494
- title="ParserStatusEvent",
495
- description="Parser status update event."
496
- )
497
-
498
- class NotificationEvent(BaseModel):
499
- """
500
- General notification event.
501
-
502
- Auto-generated from server Pydantic model.
503
- """
504
-
505
- # Model fields will be defined based on server Pydantic model
506
- pass
507
-
508
- model_config = ConfigDict(
509
- json_encoders={
510
- datetime: lambda v: v.isoformat() if v else None
511
- },
512
- title="NotificationEvent",
513
- description="General notification event."
514
- )
515
-
516
- class SystemEvent(BaseModel):
517
- """
518
- System-wide event.
519
-
520
- Auto-generated from server Pydantic model.
521
- """
522
-
523
- # Model fields will be defined based on server Pydantic model
524
- pass
525
-
526
- model_config = ConfigDict(
527
- json_encoders={
528
- datetime: lambda v: v.isoformat() if v else None
529
- },
530
- title="SystemEvent",
531
- description="System-wide event."
532
- )
533
-
534
-
535
- # ===============================================
536
- # Utility Functions
537
- # ===============================================
538
-
539
- def get_event_by_name(name: str) -> Optional[SocketEvent]:
540
- """
541
- Get SocketEvent by name.
542
-
543
- Args:
544
- name: Event name
545
-
546
- Returns:
547
- SocketEvent if found, None otherwise
548
- """
549
- try:
550
- return SocketEvent(name)
551
- except ValueError:
552
- return None
553
-
554
-
555
- def get_event_type_by_name(name: str) -> Optional[EventType]:
556
- """
557
- Get EventType by name.
558
-
559
- Args:
560
- name: Event type name
561
-
562
- Returns:
563
- EventType if found, None otherwise
564
- """
565
- try:
566
- return EventType(name)
567
- except ValueError:
568
- return None
569
-
570
-
571
- def get_admin_channel_by_name(name: str) -> Optional[AdminWebSocketChannel]:
572
- """
573
- Get AdminWebSocketChannel by name.
574
-
575
- Args:
576
- name: Channel name
577
-
578
- Returns:
579
- AdminWebSocketChannel if found, None otherwise
580
- """
581
- try:
582
- return AdminWebSocketChannel(name)
583
- except ValueError:
584
- return None
585
-
586
-
587
- def get_subscription_type_by_name(name: str) -> Optional[SubscriptionType]:
588
- """
589
- Get SubscriptionType by name.
590
-
591
- Args:
592
- name: Subscription type name
593
-
594
- Returns:
595
- SubscriptionType if found, None otherwise
596
- """
597
- try:
598
- return SubscriptionType(name)
599
- except ValueError:
600
- return None
601
-
602
-
603
- def serialize_message(data: Any) -> Dict[str, Any]:
604
- """
605
- Serialize message data for WebSocket transmission.
606
-
607
- Args:
608
- data: Data to serialize
609
-
610
- Returns:
611
- Dict representation of the data
612
- """
613
- if isinstance(data, BaseModel):
614
- return data.model_dump()
615
- elif isinstance(data, dict):
616
- return data
617
- elif hasattr(data, '__dict__'):
618
- return data.__dict__
619
- else:
620
- return {"data": data}
621
-
622
-
623
- def deserialize_message(data: Dict[str, Any], model_class: type) -> BaseModel:
624
- """
625
- Deserialize message data from WebSocket.
626
-
627
- Args:
628
- data: Raw message data
629
- model_class: Pydantic model class to deserialize to
630
-
631
- Returns:
632
- Deserialized model instance
633
-
634
- Raises:
635
- ValidationError: If data doesn't match model schema
636
- """
637
- if issubclass(model_class, BaseModel):
638
- return model_class.model_validate(data)
639
- else:
640
- raise ValueError(f"Model class {model_class} is not a Pydantic model")
641
-
642
-
643
- # ===============================================
644
- # Event Mapping
645
- # ===============================================
646
-
647
- # Map events to their typical message models (if applicable)
648
- EVENT_MODEL_MAPPING = {
649
- SocketEvent.CONNECT: None, # TODO: Map to appropriate model
650
- SocketEvent.DISCONNECT: None, # TODO: Map to appropriate model
651
- SocketEvent.PING: None, # TODO: Map to appropriate model
652
- SocketEvent.PONG: None, # TODO: Map to appropriate model
653
- SocketEvent.PARSER_REGISTER: None, # TODO: Map to appropriate model
654
- SocketEvent.PARSER_COMMAND: None, # TODO: Map to appropriate model
655
- SocketEvent.PARSER_STATUS: None, # TODO: Map to appropriate model
656
- SocketEvent.PARSER_REGISTERED: None, # TODO: Map to appropriate model
657
- SocketEvent.PARSER_DISCONNECTED: None, # TODO: Map to appropriate model
658
- SocketEvent.COMMAND_REQUEST: None, # TODO: Map to appropriate model
659
- SocketEvent.COMMAND_RESPONSE: None, # TODO: Map to appropriate model
660
- SocketEvent.COMMAND_STATUS: None, # TODO: Map to appropriate model
661
- SocketEvent.HEALTH_STATUS: None, # TODO: Map to appropriate model
662
- SocketEvent.HEALTH_CHECK: None, # TODO: Map to appropriate model
663
- SocketEvent.ADMIN_SUBSCRIBE: None, # TODO: Map to appropriate model
664
- SocketEvent.ADMIN_UNSUBSCRIBE: None, # TODO: Map to appropriate model
665
- SocketEvent.ADMIN_BROADCAST: None, # TODO: Map to appropriate model
666
- SocketEvent.ADMIN_NOTIFICATION: None, # TODO: Map to appropriate model
667
- SocketEvent.SYSTEM_NOTIFICATION: None, # TODO: Map to appropriate model
668
- SocketEvent.SYSTEM_EVENT: None, # TODO: Map to appropriate model
669
- SocketEvent.MAINTENANCE_NOTIFICATION: None, # TODO: Map to appropriate model
670
- SocketEvent.DEVELOPER_MESSAGE: None, # TODO: Map to appropriate model
671
- SocketEvent.LOG_ENTRY: None, # TODO: Map to appropriate model
672
- SocketEvent.ERROR: None, # TODO: Map to appropriate model
673
- }
674
-
675
-
676
- # All available events as a list
677
- ALL_EVENTS = list(SocketEvent)
678
-
679
- # All available event types as a list
680
- ALL_EVENT_TYPES = list(EventType)
681
-
682
- # All available admin channels as a list
683
- ALL_ADMIN_CHANNELS = list(AdminWebSocketChannel)
684
-
685
- # All available subscription types as a list
686
- ALL_SUBSCRIPTION_TYPES = list(SubscriptionType)
687
-
688
-
689
- # ===============================================
690
- # Admin WebSocket Utilities
691
- # ===============================================
692
-
693
- def create_admin_subscription_request(
694
- channel: AdminWebSocketChannel,
695
- subscription_type: SubscriptionType,
696
- filters: Optional[Dict[str, Any]] = None
697
- ) -> Dict[str, Any]:
698
- """
699
- Create admin subscription request.
700
-
701
- Args:
702
- channel: Admin channel to subscribe to
703
- subscription_type: Type of subscription
704
- filters: Optional filters for subscription
705
-
706
- Returns:
707
- Dict containing subscription request data
708
- """
709
- return {
710
- "channel": channel.value,
711
- "subscription_type": subscription_type.value,
712
- "filters": filters or {},
713
- "timestamp": datetime.utcnow().isoformat(),
714
- }
715
-
716
-
717
- def create_admin_unsubscribe_request(
718
- channel: AdminWebSocketChannel
719
- ) -> Dict[str, Any]:
720
- """
721
- Create admin unsubscribe request.
722
-
723
- Args:
724
- channel: Admin channel to unsubscribe from
725
-
726
- Returns:
727
- Dict containing unsubscribe request data
728
- """
729
- return {
730
- "channel": channel.value,
731
- "timestamp": datetime.utcnow().isoformat(),
732
- }