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,478 +0,0 @@
1
- """
2
- Auto-configuration system for UnrealOn Driver v3.0
3
-
4
- Intelligent configuration with zero setup required.
5
- Automatically detects environment and applies optimal settings.
6
- COMPLIANCE: 100% Pydantic v2 compliant, no Dict[str, Any] usage.
7
- """
8
-
9
- import os
10
- import sys
11
- from pathlib import Path
12
- from typing import Optional, Union
13
-
14
- from pydantic import BaseModel, Field, ConfigDict, computed_field
15
- from pydantic_settings import BaseSettings, SettingsConfigDict
16
-
17
- from unrealon_driver.src.core.exceptions import ConfigurationError
18
- from unrealon_driver.src.dto.services import (
19
- DriverBrowserConfig,
20
- LLMConfig,
21
- WebSocketConfig,
22
- LoggerConfig,
23
- MetricsConfig,
24
- SchedulerConfig,
25
- )
26
- from unrealon_driver.src.dto.execution import (
27
- ParserTestConfig,
28
- DaemonModeConfig,
29
- ScheduledModeConfig,
30
- InteractiveModeConfig,
31
- )
32
- from unrealon_driver.src.dto.config import LogLevel
33
-
34
-
35
- class AutoConfigBase(BaseModel):
36
- """Base configuration without environment variables."""
37
-
38
- model_config = ConfigDict(
39
- validate_assignment=True,
40
- extra="forbid",
41
- arbitrary_types_allowed=True,
42
- )
43
-
44
- # Base configuration
45
- parser_id: str = Field(default="auto_parser", description="Parser identifier")
46
-
47
- # Environment detection
48
- environment: str = Field(default_factory=lambda: AutoConfig._detect_environment())
49
- debug_mode: bool = Field(default_factory=lambda: AutoConfig._is_debug_mode())
50
-
51
- # Service configurations (type-safe)
52
- browser_config: Optional[DriverBrowserConfig] = Field(
53
- default=None, description="Browser service config"
54
- )
55
- llm_config: Optional[LLMConfig] = Field(
56
- default=None, description="LLM service config"
57
- )
58
- websocket_config: Optional[WebSocketConfig] = Field(
59
- default=None, description="WebSocket service config"
60
- )
61
- logger_config: Optional[LoggerConfig] = Field(
62
- default=None, description="Logger service config"
63
- )
64
- metrics_config: Optional[MetricsConfig] = Field(
65
- default=None, description="Metrics service config"
66
- )
67
- scheduler_config: Optional[SchedulerConfig] = Field(
68
- default=None, description="Scheduler service config"
69
- )
70
-
71
- # Execution mode configurations (type-safe)
72
- test_config: Optional[ParserTestConfig] = Field(
73
- default=None, description="Test mode config"
74
- )
75
- daemon_config: Optional[DaemonModeConfig] = Field(
76
- default=None, description="Daemon mode config"
77
- )
78
- scheduled_config: Optional[ScheduledModeConfig] = Field(
79
- default=None, description="Scheduled mode config"
80
- )
81
- interactive_config: Optional[InteractiveModeConfig] = Field(
82
- default=None, description="Interactive mode config"
83
- )
84
-
85
- # System paths
86
- project_root: Optional[Path] = Field(default=None, description="Project root path")
87
- system_dir: Optional[Path] = Field(
88
- default=None, description="System directory path"
89
- )
90
- logs_dir: Optional[Path] = Field(default=None, description="Logs directory path")
91
- data_dir: Optional[Path] = Field(default=None, description="Data directory path")
92
-
93
- def model_post_init(self, __context) -> None:
94
- """Initialize all configurations after model creation."""
95
- self._initialize_configs()
96
-
97
- def _initialize_configs(self) -> None:
98
- """Initialize all configurations. Can be called manually."""
99
- # Force reset all configs to None to ensure they're recreated
100
- self.browser_config = None
101
- self.llm_config = None
102
- self.websocket_config = None
103
- self.logger_config = None
104
- self.metrics_config = None
105
- self.scheduler_config = None
106
- self.test_config = None
107
- self.daemon_config = None
108
- self.scheduled_config = None
109
- self.interactive_config = None
110
-
111
- self._setup_directories()
112
- self._setup_service_configs()
113
- self._setup_execution_configs()
114
-
115
- def _setup_directories(self):
116
- """Setup system directories."""
117
- if not self.project_root:
118
- self.project_root = self._detect_project_root()
119
-
120
- if not self.system_dir:
121
- self.system_dir = self._get_system_dir()
122
-
123
- if not self.logs_dir:
124
- self.logs_dir = self._get_logs_dir()
125
-
126
- if not self.data_dir:
127
- self.data_dir = self._get_data_dir()
128
-
129
- # Ensure directories exist
130
- for dir_path in [self.system_dir, self.logs_dir, self.data_dir]:
131
- if dir_path:
132
- dir_path.mkdir(parents=True, exist_ok=True)
133
-
134
- def _setup_service_configs(self):
135
- """Setup all service configurations."""
136
- if not self.browser_config:
137
- self.browser_config = self._create_browser_config()
138
-
139
- if not self.llm_config:
140
- self.llm_config = self._create_llm_config()
141
-
142
- if not self.websocket_config:
143
- self.websocket_config = self._create_websocket_config()
144
-
145
- if not self.logger_config:
146
- self.logger_config = self._create_logger_config()
147
-
148
- if not self.metrics_config:
149
- self.metrics_config = self._create_metrics_config()
150
-
151
- if not self.scheduler_config:
152
- self.scheduler_config = self._create_scheduler_config()
153
-
154
- def _create_browser_config(self) -> DriverBrowserConfig:
155
- """Create browser configuration with STEALTH ALWAYS ENABLED."""
156
- return DriverBrowserConfig(
157
- headless=self.environment == "production", # Headless in production
158
- timeout=60 if self.environment == "production" else 30,
159
- user_data_dir=(
160
- str(self.system_dir / "browser_data") if self.system_dir else None
161
- ),
162
- parser_id=self.parser_id,
163
- # 🔥 STEALTH ALWAYS ON - NO CONFIG NEEDED!
164
- page_load_strategy="normal",
165
- wait_for_selector_timeout=10,
166
- network_idle_timeout=3,
167
- enable_javascript=True,
168
- enable_images=True,
169
- enable_css=True,
170
- debug_mode=self.debug_mode,
171
- save_screenshots=self.debug_mode, # Save screenshots in debug mode
172
- log_level=LogLevel.DEBUG if self.debug_mode else LogLevel.INFO,
173
- )
174
-
175
- def _setup_execution_configs(self):
176
- """Setup all execution mode configurations."""
177
- if not self.test_config:
178
- self.test_config = self._create_test_config()
179
-
180
- if not self.daemon_config:
181
- self.daemon_config = self._create_daemon_config()
182
-
183
- if not self.scheduled_config:
184
- self.scheduled_config = self._create_scheduled_config()
185
-
186
- if not self.interactive_config:
187
- self.interactive_config = self._create_interactive_config()
188
-
189
- def _create_llm_config(self) -> LLMConfig:
190
- """Create LLM configuration."""
191
- return LLMConfig(
192
- provider="openai",
193
- model="gpt-3.5-turbo",
194
- api_key=os.getenv("OPENAI_API_KEY"),
195
- max_tokens=2048 if self.environment == "development" else 4096,
196
- temperature=0.1,
197
- timeout=30 if self.environment == "development" else 60,
198
- max_retries=2 if self.environment == "development" else 3,
199
- enable_caching=True,
200
- enable_cost_tracking=True,
201
- log_level=LogLevel.DEBUG if self.debug_mode else LogLevel.INFO,
202
- )
203
-
204
- def _create_websocket_config(self) -> WebSocketConfig:
205
- """Create WebSocket configuration."""
206
- return WebSocketConfig(
207
- server_url=os.getenv("SERVER_URL"),
208
- api_key=os.getenv("API_KEY"),
209
- parser_name=self.parser_id,
210
- auto_reconnect=True,
211
- max_reconnect_attempts=10 if self.environment == "production" else 5,
212
- reconnect_delay=1.0,
213
- health_check_interval=30,
214
- heartbeat_interval=30,
215
- connection_timeout=10,
216
- )
217
-
218
- def _create_logger_config(self) -> LoggerConfig:
219
- """Create logger configuration."""
220
- return LoggerConfig(
221
- log_level=LogLevel.DEBUG if self.debug_mode else LogLevel.INFO,
222
- console_output=True,
223
- file_output=True,
224
- log_file=f"{self.parser_id}.log",
225
- log_dir=str(self.logs_dir) if self.logs_dir else None,
226
- )
227
-
228
- def _create_metrics_config(self) -> MetricsConfig:
229
- """Create metrics configuration."""
230
- return MetricsConfig(
231
- parser_id=self.parser_id,
232
- enable_metrics=True,
233
- collect_performance=True,
234
- collect_errors=True,
235
- collect_usage=True,
236
- retention_days=30 if self.environment == "production" else 7,
237
- export_format="json",
238
- batch_size=100,
239
- flush_interval=60,
240
- )
241
-
242
- def _create_scheduler_config(self) -> SchedulerConfig:
243
- """Create scheduler configuration."""
244
- return SchedulerConfig(
245
- parser_id=self.parser_id,
246
- max_concurrent_tasks=5 if self.environment == "development" else 10,
247
- enable_jitter=True,
248
- jitter_range=0.1,
249
- default_timeout=300,
250
- default_retries=3,
251
- cleanup_interval=3600,
252
- enable_task_monitoring=True,
253
- health_check_interval=60,
254
- )
255
-
256
- def _create_test_config(self) -> ParserTestConfig:
257
- """Create test mode configuration."""
258
- return ParserTestConfig(
259
- verbose=self.debug_mode,
260
- show_browser=self.debug_mode,
261
- save_screenshots=self.debug_mode,
262
- timeout_seconds=60 if self.environment == "development" else 120,
263
- )
264
-
265
- def _create_daemon_config(self) -> DaemonModeConfig:
266
- """Create daemon mode configuration."""
267
- return DaemonModeConfig(
268
- server_url=os.getenv("SERVER_URL"),
269
- api_key=os.getenv("API_KEY"),
270
- auto_reconnect=True,
271
- connection_timeout=30,
272
- heartbeat_interval=30,
273
- max_reconnect_attempts=10,
274
- health_check_interval=60,
275
- enable_metrics=True,
276
- )
277
-
278
- def _create_scheduled_config(self) -> ScheduledModeConfig:
279
- """Create scheduled mode configuration."""
280
- return ScheduledModeConfig(
281
- every="1h", # Default schedule
282
- timeout=600,
283
- retry_attempts=3,
284
- max_concurrent=1,
285
- jitter=True,
286
- jitter_range=0.1,
287
- error_handling="retry",
288
- )
289
-
290
- def _create_interactive_config(self) -> InteractiveModeConfig:
291
- """Create interactive mode configuration."""
292
- return InteractiveModeConfig(
293
- enable_debugger=True,
294
- show_browser=True,
295
- auto_reload=self.debug_mode,
296
- log_level=LogLevel.DEBUG,
297
- enable_profiling=self.debug_mode,
298
- save_session=True,
299
- )
300
-
301
- @staticmethod
302
- def _detect_environment() -> str:
303
- """Detect runtime environment."""
304
- if os.getenv("ENV") == "production":
305
- return "production"
306
- elif os.getenv("ENV") == "staging":
307
- return "staging"
308
- elif os.getenv("ENV") == "testing":
309
- return "testing"
310
- else:
311
- return "development"
312
-
313
- @staticmethod
314
- def _is_debug_mode() -> bool:
315
- """Check if debug mode is enabled."""
316
- return os.getenv("DEBUG", "false").lower() in ["true", "1", "yes"]
317
-
318
- def _detect_project_root(self) -> Path:
319
- """Detect project root directory."""
320
- current = Path.cwd()
321
-
322
- # Look for common project markers
323
- markers = ["pyproject.toml", "setup.py", "requirements.txt", ".git"]
324
-
325
- for parent in [current] + list(current.parents):
326
- if any((parent / marker).exists() for marker in markers):
327
- return parent
328
-
329
- return current
330
-
331
- def _get_system_dir(self) -> Path:
332
- """Get system directory for storing parser data."""
333
- # 🔥 If system_dir is already set (from Parser), use it
334
- if self.system_dir:
335
- return self.system_dir
336
-
337
- # Otherwise generate default path
338
- if self.project_root:
339
- return self.project_root / ".unrealon" / self.parser_id
340
- else:
341
- return Path.home() / ".unrealon" / self.parser_id
342
-
343
- def _get_logs_dir(self) -> Path:
344
- """Get logs directory."""
345
- return self.system_dir / "logs" if self.system_dir else Path.cwd() / "logs"
346
-
347
- def _get_data_dir(self) -> Path:
348
- """Get data directory."""
349
- return self.system_dir / "data" if self.system_dir else Path.cwd() / "data"
350
-
351
- # Type-safe configuration updates using Pydantic v2 model_copy
352
- def update_browser_config(self, **updates) -> None:
353
- """Update browser configuration with type safety."""
354
- if self.browser_config:
355
- self.browser_config = self.browser_config.model_copy(update=updates)
356
- else:
357
- raise ConfigurationError("Browser config not initialized")
358
-
359
- def update_llm_config(self, **updates) -> None:
360
- """Update LLM configuration with type safety."""
361
- if self.llm_config:
362
- self.llm_config = self.llm_config.model_copy(update=updates)
363
- else:
364
- raise ConfigurationError("LLM config not initialized")
365
-
366
- def update_websocket_config(self, **updates) -> None:
367
- """Update WebSocket configuration with type safety."""
368
- if self.websocket_config:
369
- self.websocket_config = self.websocket_config.model_copy(update=updates)
370
- else:
371
- raise ConfigurationError("WebSocket config not initialized")
372
-
373
-
374
- class AutoConfigWithEnv(BaseSettings, AutoConfigBase):
375
- """Configuration with .env file support."""
376
-
377
- model_config = SettingsConfigDict(
378
- validate_assignment=True,
379
- extra="forbid",
380
- arbitrary_types_allowed=True,
381
- env_file=".env",
382
- env_prefix="UNREALON_",
383
- case_sensitive=False,
384
- )
385
-
386
-
387
- # Smart configuration selection
388
- def _should_use_env_config() -> bool:
389
- """Determine if we should use .env configuration."""
390
- # Use env config if .env file exists or UNREALON_ vars are set
391
- env_file_exists = Path(".env").exists()
392
- has_unrealon_vars = any(key.startswith("UNREALON_") for key in os.environ)
393
- return env_file_exists or has_unrealon_vars
394
-
395
-
396
- # Dynamic class selection
397
- if _should_use_env_config():
398
- AutoConfig = AutoConfigWithEnv
399
- else:
400
- AutoConfig = AutoConfigBase
401
-
402
- # Add type hints
403
- AutoConfig.__doc__ = """
404
- 🎯 Zero-Configuration System with Smart .env Support
405
-
406
- Automatically configures all services with intelligent defaults.
407
- Environment-aware with seamless development-to-production transitions.
408
- Supports .env files with UNREALON_ prefix when available.
409
- COMPLIANCE: 100% Pydantic v2 compliant, no Dict[str, Any] usage.
410
- """
411
-
412
-
413
- # Add class methods to AutoConfigBase so they work for both variants
414
- def _add_class_methods_to_base():
415
- """Add class methods to AutoConfigBase."""
416
-
417
- @classmethod
418
- def create_minimal(
419
- cls, parser_id: str = "minimal_parser", config: AutoConfigBase = None
420
- ):
421
- """Create minimal configuration for testing."""
422
- # If config is provided, use it directly (for extended configs like AmazonAutoConfig)
423
- if config is not None:
424
- return config
425
-
426
- # Create instance with default values
427
- instance = cls()
428
- instance.parser_id = parser_id
429
- instance.environment = "testing"
430
- instance.debug_mode = False
431
- # Reinitialize configs with new parser_id
432
- instance._initialize_configs()
433
- return instance
434
-
435
- @classmethod
436
- def create_development(
437
- cls, parser_id: str = "dev_parser", config: AutoConfigBase = None
438
- ):
439
- """Create development configuration."""
440
- # If config is provided, use it directly (for extended configs like AmazonAutoConfig)
441
- if config is not None:
442
- return config
443
-
444
- # Create instance with default values
445
- instance = cls()
446
- instance.parser_id = parser_id
447
- instance.environment = "development"
448
- instance.debug_mode = True
449
- # Reinitialize configs with new parser_id
450
- instance._initialize_configs()
451
- return instance
452
-
453
- @classmethod
454
- def create_production(
455
- cls, parser_id: str = "prod_parser", config: AutoConfigBase = None
456
- ):
457
- """Create production configuration."""
458
- # If config is provided, use it directly (for extended configs like AmazonAutoConfig)
459
- if config is not None:
460
- return config
461
-
462
- # Create instance with default values
463
- instance = cls()
464
- instance.parser_id = parser_id
465
- instance.environment = "production"
466
- instance.debug_mode = False
467
- # Reinitialize configs with new parser_id
468
- instance._initialize_configs()
469
- return instance
470
-
471
- # Add methods to AutoConfigBase
472
- AutoConfigBase.create_minimal = create_minimal
473
- AutoConfigBase.create_development = create_development
474
- AutoConfigBase.create_production = create_production
475
-
476
-
477
- # Execute the method addition
478
- _add_class_methods_to_base()
@@ -1,18 +0,0 @@
1
- """
2
- Core module for UnrealOn Driver v3.0
3
-
4
- Contains the revolutionary Parser class and core functionality.
5
- """
6
-
7
- from .parser import Parser
8
- from .exceptions import *
9
-
10
- __all__ = [
11
- "Parser",
12
- "ParserError",
13
- "ConfigurationError",
14
- "BrowserError",
15
- "LLMError",
16
- "WebSocketError",
17
- "SchedulingError",
18
- ]