unrealon 2.0.4__py3-none-any.whl → 2.0.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unrealon
3
- Version: 2.0.4
3
+ Version: 2.0.5
4
4
  Summary: Enterprise-grade web scraping platform with AI-powered automation and real-time orchestration capabilities
5
5
  Author-email: UnrealOn Team <team@unrealon.com>
6
6
  License: MIT
@@ -1,15 +1,15 @@
1
1
  unrealon_browser/README.md,sha256=9pP6RrfMGHtdT5uDLFAUB1e4nNGzZudXViEo1940gKw,396
2
2
  unrealon_browser/__init__.py,sha256=aYEmGQyhGEwcr-XPKqWJb21uQPB9XvqwZgKSSwkbb_I,1521
3
3
  unrealon_browser/cli/__init__.py,sha256=b3r88oeCYsqZF8EU8EZXP9v54Q8cIimN7UmxJsXcB84,264
4
- unrealon_browser/cli/browser_cli.py,sha256=dQ7p3Ml1touWbkbo-U4jkhknhRvAYT9mzbe2ZTLylZ0,8505
4
+ unrealon_browser/cli/browser_cli.py,sha256=KobEb9nhPEHDmB5K67LQNpMvuA_fDNrVfq9w9JWpgHI,8510
5
5
  unrealon_browser/cli/cookies_cli.py,sha256=yhZvGrg8bknlH4zlySdi8ue-25Ue-1rI_u1G06OIMg4,13304
6
- unrealon_browser/cli/interactive_mode.py,sha256=sXjiGZi-BK-Q5KhxYs8HJZ2EqkQK0Jx7MhtVnULRqLg,12120
6
+ unrealon_browser/cli/interactive_mode.py,sha256=gLn9bMH0h0tPX3dP4i4QQxQK4Htkyg5r4KcqdMBaP6Q,12125
7
7
  unrealon_browser/cli/main.py,sha256=XCYcTxJUqaz320KCU_JPKizYMk6bdljb8Boyok3uO-4,1353
8
8
  unrealon_browser/core/__init__.py,sha256=uVL_t4sZelUzflWPdgrwoXGnAkSV1WNQ98-eu0QB2eM,151
9
9
  unrealon_browser/core/browser_manager.py,sha256=9xxo0kqbUcssFBNpvIXavWBya2E3TmgHKplQQ2kkZeU,29598
10
10
  unrealon_browser/dto/__init__.py,sha256=bApqcLz-KanEi0_MCiFPrQmGBoX3VBijP7XtBUyIfjo,1636
11
11
  unrealon_browser/dto/bot_detection.py,sha256=qXfC0HghV7m4L6qA87t3STi-166jM-QgoP6OYbCb4o4,6884
12
- unrealon_browser/dto/models/config.py,sha256=krNAqzlEk0HnrmZRoTdfuKoDWnuXwv3pGl0mcFwr4zs,1747
12
+ unrealon_browser/dto/models/config.py,sha256=Why5H3rtFclmwbdczuDfhlgf-LDz72Aa8LhDX4_ayfw,1752
13
13
  unrealon_browser/dto/models/core.py,sha256=HvbwYG27rmmWtp401uws7lfalN_9QPad0M6ceCiN5iQ,2741
14
14
  unrealon_browser/dto/models/dataclasses.py,sha256=zqhJVyzp4CvtuTBsZwm6n6TodVWrZf9gkdDG-0_tgeA,2571
15
15
  unrealon_browser/dto/models/detection.py,sha256=ma9ZNIjPR7HnjqZaAj6ZoskiewPFiSn_FgFXSkgiQc8,2715
@@ -23,16 +23,16 @@ unrealon_browser/managers/page_wait_manager.py,sha256=UyZqiSfkjzahrxp9x1odXFIT_s
23
23
  unrealon_browser/managers/profile.py,sha256=HjddlSeUry_65WPtF8CMkT7cfJ6X3Jap9kJaaZpwtAA,18956
24
24
  unrealon_browser/stealth/__init__.py,sha256=zUfkPPafYlPANLVQIy-Se11R_UjcJakUb3krCxxUK5Q,842
25
25
  unrealon_browser/stealth/bypass_techniques.pyc,sha256=Tys_I4tnJmL9aQLB1k1mL-4OtzedhpYTmW4XPEIb3cI,25790
26
- unrealon_browser/stealth/manager.pyc,sha256=JC9g-LWoKPo1QuY1LUIyMmFEDgZJjrFlLuA3KbctQ3U,21178
26
+ unrealon_browser/stealth/manager.pyc,sha256=prGC5fWE-T4ROGSVrc65CJ_qFpb8dScuN83FotZ1oj4,21183
27
27
  unrealon_browser/stealth/nodriver_stealth.pyc,sha256=SnDMdeG_W2LDK_3UfrjDeolMpqxTMDNjRbId_YC_cKA,15286
28
28
  unrealon_browser/stealth/playwright_stealth.pyc,sha256=Y-IiRTu136R6LIstGdKbns1j-CODX3sTGVT0IGx_MF4,6529
29
- unrealon_browser/stealth/scanner_tester.pyc,sha256=m5jUXySno0g9AScJt5dyjppkM0QXENX3Sh5W4fRR5ZA,21706
29
+ unrealon_browser/stealth/scanner_tester.pyc,sha256=ki_Lp7zBp12iWgj3LGPnXTwemwgaGG1UrWeM1IXB6Gs,21711
30
30
  unrealon_browser/stealth/undetected_chrome.pyc,sha256=HNp2_84zwp-JG-Y3jqQwCNldnG6P5bBnbf9dBV_pOuw,12765
31
- unrealon_core/__init__.py,sha256=bFKK6AOQVb34OLq3RlduDokLjf4cR0q1_sWAK5GQ2js,4954
31
+ unrealon_core/__init__.py,sha256=ZA2VNptlNYmeX9cyfGklKDnEMR_peu2lG24nBvAPbLU,5317
32
32
  unrealon_core/version.py,sha256=qZOlKA_Hsz7_KXsCLO_0l9Mf0u_iNTxvHZPV21DwCqs,5803
33
33
  unrealon_core/config/__init__.py,sha256=57-KZaTDya0oyfOCfZ3pU1xLLbnZPBgqwfP9VrfhcKE,395
34
- unrealon_core/config/environment.py,sha256=VNPse_SU-hFd1rT3WTxZl65CsTxeaXWxcQuAvWv1TJI,2774
35
- unrealon_core/config/urls.py,sha256=dlQCZSz5NasA5A4v3ff9beVqOkXL5aCa_rt1VDNIs9Q,2751
34
+ unrealon_core/config/environment.py,sha256=TACbyjr3lxrA9R_Ve0LLqyLnRk3FShm2imQjhiP9i98,4589
35
+ unrealon_core/config/urls.py,sha256=7ScpWEhSu1kewhMaKhuqgiMHIv_fyI1TyRiS-f2wrLo,2821
36
36
  unrealon_core/enums/__init__.py,sha256=C-fqNVSWofnaq2Ed6GbGtck8WkN8gpHYA_NiIlaEbTI,520
37
37
  unrealon_core/enums/status.py,sha256=DT6rth7Ve7chsYhJtccY6plsgQQ8jEMhfhcZTpK308c,6861
38
38
  unrealon_core/enums/types.py,sha256=hf1NkA2sBIfgtNHqdQPr7Uow_E2SeDGh1Jpxls0RFYg,8704
@@ -48,13 +48,12 @@ unrealon_core/exceptions/driver.py,sha256=YB3_oRgOMzD4cCSEhqpqpP5iD6ChbZmaOtnw4B
48
48
  unrealon_core/exceptions/proxy.py,sha256=oqy3gV8jha1a2JrOtbJU8zTpWq_XA8Ooou2cl4eHF0o,246
49
49
  unrealon_core/exceptions/task.py,sha256=uNSyJgZvBSHtimQ-ZLPjjDZrVzq6sXscJUQDkCmQ0No,285
50
50
  unrealon_core/exceptions/validation.py,sha256=f7nWbi5ag1nqo7kwN0QaXYNfRrIwHhYVNlKHGiyhuQ8,351
51
- unrealon_core/models/__init__.py,sha256=rSpjZ4PiOMgkQ1iocsr2zPA2ziSV9_7Fdg5XU6EXY1g,1699
51
+ unrealon_core/models/__init__.py,sha256=msWqpIVlqWb0mX3jAwX83i78hFIoqZj8XgE4TgL_uu4,1379
52
52
  unrealon_core/models/arq_context.py,sha256=9a6yJgdQ3ZifoCgEEiN90q5qRzQ9pk0ivHnowhzLF7c,8389
53
53
  unrealon_core/models/arq_responses.py,sha256=OYEIjLZ1iEoWEKAOqAuudYWT4I_ZVeftDFOOmWjgEaM,4471
54
54
  unrealon_core/models/base.py,sha256=5x5Ie77wH_qRrezd8kSQ23DgOffSmCmICmVqEeXX4Hc,8964
55
55
  unrealon_core/models/bridge_stats.py,sha256=trVoAQkFG5fc8TSzUmH133Xwf8htKYM5Xyl_3-5ApnE,1878
56
56
  unrealon_core/models/communication.py,sha256=YFdiR-J0ncjmvg4yudU1bTfR61BEmV6sQ1zCXWN_xR0,1152
57
- unrealon_core/models/config.py,sha256=VFOFyjAdDVqNMVUruIeqdbOvo-_FvXhCtt9LQvPOijE,1355
58
57
  unrealon_core/models/connection_stats.py,sha256=KngZoi78WXsLAvl9ZYq6xRoVUaTBUVmnI8hrxZ8y038,1522
59
58
  unrealon_core/models/driver.py,sha256=RVl69fPFWW-E9yINUi2yXEWcw3sycc-bgVOw00VfkdU,690
60
59
  unrealon_core/models/driver_details.py,sha256=0Bc1J16Zika7p1SflsqssiF4IjpQbwNFij17H1pQR44,3737
@@ -94,9 +93,9 @@ unrealon_driver/decorators/timing.py,sha256=Bmtsp2tWxY4EOq3onF1OTSk0rqf9lQNlX4RL
94
93
  unrealon_driver/driver/__init__.py,sha256=P_NJXcsigIjROwErqUXgS0VneUfGggFL4bWDbdB73iw,419
95
94
  unrealon_driver/driver/communication/__init__.py,sha256=SalrzX_55WXlkbS9P6nm6PhddoI8pquURqx3103Q708,205
96
95
  unrealon_driver/driver/communication/session.py,sha256=vRarQAUunmqltD1p2Z7Jms5xBK543XarfCUWAC_G8XQ,6936
97
- unrealon_driver/driver/communication/websocket_client.py,sha256=Msgu7n42tBMPBLhEHxlLxlHrDP1OFfhGReRSUPZKPsw,7163
96
+ unrealon_driver/driver/communication/websocket_client.py,sha256=h23aS5v0Tt6_BCA2fSlij9Vab7b4OH2UM7C6Z42YY2E,7412
98
97
  unrealon_driver/driver/core/__init__.py,sha256=ZvJQp1zO7pj6tBNYTJk2fj-0ZMiQTQEk-I9hXalNsfg,235
99
- unrealon_driver/driver/core/config.py,sha256=YYvTlo6jNlNz-FKJ730nkhahlN4OSl7yz1txauC-NQ4,2848
98
+ unrealon_driver/driver/core/config.py,sha256=jWJjRll19VlL4iM5Q-J3o9qwYeH89Iuj1_3KayM6fCk,5914
100
99
  unrealon_driver/driver/core/driver.py,sha256=NI-pdhnduRyHLsfFr8HmP2gp7pR1pWB4vBIJkMJ2cls,7886
101
100
  unrealon_driver/driver/factory/__init__.py,sha256=XrjBhOaLvC3MIG5PAFIYS_xYXFDz5JizpFvmQcwA7mU,189
102
101
  unrealon_driver/driver/factory/manager_factory.py,sha256=zJt63N8oWNJS0aNbLy7WjY4GCeUwLjvtWGdqdpucufU,4792
@@ -121,9 +120,9 @@ unrealon_driver/managers/threading.py,sha256=djw5cSC99dfBKmep3IJ_8IgxQceMXtNvCp5
121
120
  unrealon_driver/managers/update.py,sha256=-hohVxGXpj5bZ6ZTQN6NH1RK9Pd6GVzCMtu3GS2SdcQ,3582
122
121
  unrealon_driver/utils/__init__.py,sha256=qxXVoQJVdLJhaLBXk_LZV_062AhrvBrMPXWAKfEc3C4,104
123
122
  unrealon_driver/utils/time.py,sha256=Oxk1eicKeZl8ZWbf7gu1Ll716k6CpXmVj67FHSnPIsA,184
124
- unrealon-2.0.4.dist-info/LICENSE,sha256=eEH8mWZW49YMpl4Sh5MtKqkZ8aVTzKQXiNPEnvL14ns,1070
125
- unrealon-2.0.4.dist-info/METADATA,sha256=n8q2NabepEQ9LHwNHYyTsWWQ2njvdlWHC5Ry6mz9x9g,15688
126
- unrealon-2.0.4.dist-info/WHEEL,sha256=pL8R0wFFS65tNSRnaOVrsw9EOkOqxLrlUPenUYnJKNo,91
127
- unrealon-2.0.4.dist-info/entry_points.txt,sha256=k0qM-eotpajkKUq-almJmxj9afhXprZ6IkvQkSdcKhI,104
128
- unrealon-2.0.4.dist-info/top_level.txt,sha256=Gu8IeIfIVfUxdi-h-F0nKMQxo15pjhHZ0aTadXTpRE8,47
129
- unrealon-2.0.4.dist-info/RECORD,,
123
+ unrealon-2.0.5.dist-info/LICENSE,sha256=eEH8mWZW49YMpl4Sh5MtKqkZ8aVTzKQXiNPEnvL14ns,1070
124
+ unrealon-2.0.5.dist-info/METADATA,sha256=LvQG4LPi81KyP5XKqPdEg1ZspdFc2inV9XP0SM6qqW8,15688
125
+ unrealon-2.0.5.dist-info/WHEEL,sha256=pL8R0wFFS65tNSRnaOVrsw9EOkOqxLrlUPenUYnJKNo,91
126
+ unrealon-2.0.5.dist-info/entry_points.txt,sha256=k0qM-eotpajkKUq-almJmxj9afhXprZ6IkvQkSdcKhI,104
127
+ unrealon-2.0.5.dist-info/top_level.txt,sha256=Gu8IeIfIVfUxdi-h-F0nKMQxo15pjhHZ0aTadXTpRE8,47
128
+ unrealon-2.0.5.dist-info/RECORD,,
@@ -16,7 +16,7 @@ from rich.table import Table
16
16
  from unrealon_browser.core.browser_manager import BrowserManager
17
17
  from unrealon_browser.dto.models.config import BrowserConfig, BrowserType, BrowserMode
18
18
 
19
- from unrealon_core.config import get_url_config
19
+ from unrealon_core.config.urls import get_url_config
20
20
 
21
21
  console = Console()
22
22
 
@@ -11,7 +11,7 @@ from rich.panel import Panel
11
11
  from rich.table import Table
12
12
  from typing import Dict, Any
13
13
 
14
- from unrealon_core.config import get_url_config
14
+ from unrealon_core.config.urls import get_url_config
15
15
 
16
16
  console = Console()
17
17
 
@@ -8,7 +8,7 @@ from typing import Optional
8
8
  from pydantic import BaseModel, Field, ConfigDict
9
9
  from .enums import BrowserType, BrowserMode
10
10
 
11
- from unrealon_core.config import get_url_config
11
+ from unrealon_core.config.urls import get_url_config
12
12
 
13
13
 
14
14
  def _get_default_stealth_url() -> str:
Binary file
Binary file
unrealon_core/__init__.py CHANGED
@@ -76,9 +76,19 @@ from .monitoring import (
76
76
  )
77
77
 
78
78
  # Configuration system
79
- from .config import (
80
- EnvironmentConfig, URLConfig,
81
- get_environment_config, get_url_config
79
+ from .config.environment import (
80
+ EnvironmentConfig, Environment,
81
+ get_environment_config, set_environment_config
82
+ )
83
+ from .config.urls import (
84
+ URLConfig,
85
+ get_url_config
86
+ )
87
+ from .models.websocket.config import (
88
+ DriverConfiguration,
89
+ LoggingConfiguration,
90
+ TaskConfiguration,
91
+ ProxyConfiguration
82
92
  )
83
93
 
84
94
  __all__ = [
@@ -155,6 +165,8 @@ __all__ = [
155
165
  "MonitoringDashboard", "get_system_overview",
156
166
 
157
167
  # Configuration system
158
- "EnvironmentConfig", "URLConfig",
159
- "get_environment_config", "get_url_config",
168
+ "EnvironmentConfig", "Environment", "URLConfig",
169
+ "get_environment_config", "set_environment_config", "get_url_config",
170
+ "DriverConfiguration", "LoggingConfiguration",
171
+ "TaskConfiguration", "ProxyConfiguration",
160
172
  ]
@@ -18,7 +18,7 @@ class Environment(str, Enum):
18
18
 
19
19
 
20
20
  class EnvironmentConfig(BaseModel):
21
- """Environment configuration settings."""
21
+ """Environment configuration settings with all system URLs and settings."""
22
22
 
23
23
  model_config = ConfigDict(
24
24
  # Add any specific config here if needed
@@ -39,6 +39,17 @@ class EnvironmentConfig(BaseModel):
39
39
  description="Logging level"
40
40
  )
41
41
 
42
+ # System URLs - environment-aware
43
+ redis_url: str = Field(
44
+ default_factory=lambda: os.getenv("REDIS_URL", "redis://localhost:6379/0"),
45
+ description="Redis connection URL"
46
+ )
47
+
48
+ max_workers: int = Field(
49
+ default_factory=lambda: int(os.getenv("MAX_WORKERS", "10")),
50
+ description="Maximum number of workers"
51
+ )
52
+
42
53
  @classmethod
43
54
  def from_env(cls) -> "EnvironmentConfig":
44
55
  """Create config from environment variables."""
@@ -76,6 +87,48 @@ class EnvironmentConfig(BaseModel):
76
87
  def is_testing(self) -> bool:
77
88
  """Check if running in testing mode."""
78
89
  return self.environment == Environment.TESTING
90
+
91
+ @property
92
+ def websocket_url(self) -> str:
93
+ """Get WebSocket URL based on environment."""
94
+ # Check explicit env var first
95
+ if ws_url := os.getenv("WEBSOCKET_URL"):
96
+ return ws_url
97
+
98
+ if self.is_production:
99
+ return "wss://ws.unrealon.com/ws"
100
+ elif self.is_development:
101
+ return "ws://localhost:8001/ws" # RPC server port
102
+ else: # testing
103
+ return "ws://localhost:8001/ws"
104
+
105
+ @property
106
+ def api_url(self) -> str:
107
+ """Get API URL based on environment."""
108
+ # Check explicit env var first
109
+ if api_url := os.getenv("API_URL"):
110
+ return api_url
111
+
112
+ if self.is_production:
113
+ return "https://api-m.unrealon.com"
114
+ elif self.is_development:
115
+ return "http://localhost:8002" # Backend server port
116
+ else: # testing
117
+ return "http://localhost:8002"
118
+
119
+ @property
120
+ def django_api_url(self) -> str:
121
+ """Get Django API URL based on environment."""
122
+ # Check explicit env var first
123
+ if api_url := os.getenv("DJANGO_API_URL"):
124
+ return api_url
125
+
126
+ if self.is_production:
127
+ return "https://api.unrealon.com"
128
+ elif self.is_development:
129
+ return "http://localhost:8000" # Django server port
130
+ else: # testing
131
+ return "http://localhost:8000"
79
132
 
80
133
 
81
134
  # Global config instance
@@ -18,6 +18,7 @@ class URLConfig(BaseModel):
18
18
 
19
19
  # Scanner/Detection URLs
20
20
  scanner_url: str = Field(
21
+ default="https://cloud.unrealon.com/scanner",
21
22
  description="URL for browser detection and stealth testing"
22
23
  )
23
24
 
@@ -39,19 +40,19 @@ class URLConfig(BaseModel):
39
40
 
40
41
  if environment == Environment.PRODUCTION:
41
42
  return cls(
42
- scanner_url="https://cloud.unrealon.com/scanner",
43
+ # scanner_url="https://cloud.unrealon.com/scanner",
43
44
  cloud_base_url="https://cloud.unrealon.com",
44
45
  api_base_url="https://api.unrealon.com"
45
46
  )
46
- elif environment == Environment.TESTING:
47
- return cls(
48
- scanner_url="https://staging.unrealon.com/scanner",
49
- cloud_base_url="https://staging.unrealon.com",
50
- api_base_url="https://api-staging.unrealon.com"
51
- )
47
+ # elif environment == Environment.TESTING:
48
+ # return cls(
49
+ # scanner_url="https://staging.unrealon.com/scanner",
50
+ # cloud_base_url="https://staging.unrealon.com",
51
+ # api_base_url="https://api-staging.unrealon.com"
52
+ # )
52
53
  else: # Development
53
54
  return cls(
54
- scanner_url="http://localhost:3000/scanner",
55
+ # scanner_url="http://localhost:3000/scanner",
55
56
  cloud_base_url="http://localhost:3000",
56
57
  api_base_url="http://localhost:8000"
57
58
  )
@@ -46,16 +46,6 @@ from .logging import (
46
46
  LogMetrics
47
47
  )
48
48
 
49
- from .config import (
50
- SystemConfig,
51
- HttpConfig,
52
- ProxyConfig,
53
- BrowserConfig,
54
- LoggingConfig,
55
- CacheConfig,
56
- ThreadConfig
57
- )
58
-
59
49
  __all__ = [
60
50
  # Base models
61
51
  "UnrealOnBaseModel",
@@ -86,13 +76,4 @@ __all__ = [
86
76
  "LogEntry",
87
77
  "LogQuery",
88
78
  "LogMetrics",
89
-
90
- # Configuration models
91
- "SystemConfig",
92
- "HttpConfig",
93
- "ProxyConfig",
94
- "BrowserConfig",
95
- "LoggingConfig",
96
- "CacheConfig",
97
- "ThreadConfig",
98
79
  ]
@@ -9,7 +9,15 @@ from typing import Optional, Callable, List
9
9
  from collections import deque
10
10
 
11
11
  import websockets
12
- from websockets.asyncio.client import ClientConnection
12
+ try:
13
+ from websockets.asyncio.client import ClientConnection
14
+ except ImportError:
15
+ # Fallback for older websockets versions
16
+ try:
17
+ from websockets.client import WebSocketClientProtocol as ClientConnection
18
+ except ImportError:
19
+ # Ultimate fallback
20
+ ClientConnection = None
13
21
 
14
22
  from unrealon_core.models.websocket import (
15
23
  DriverRegistrationMessage,
@@ -7,6 +7,12 @@ from enum import Enum
7
7
  from typing import Optional
8
8
  from pydantic import BaseModel, Field, computed_field
9
9
 
10
+ try:
11
+ from unrealon_core.config.environment import get_environment_config
12
+ UNREALON_CORE_AVAILABLE = True
13
+ except ImportError:
14
+ UNREALON_CORE_AVAILABLE = False
15
+
10
16
 
11
17
  class DriverMode(str, Enum):
12
18
  """Driver operation modes."""
@@ -36,9 +42,9 @@ class DriverConfig(BaseModel):
36
42
 
37
43
  Priority:
38
44
  1. Explicit websocket_url field
39
- 2. Environment variable UNREALON_WEBSOCKET_URL
40
- 3. Environment variable UNREALON_WS_URL
41
- 4. Default localhost for development
45
+ 2. Environment variables (UNREALON_WEBSOCKET_URL, UNREALON_WS_URL, WS_URL)
46
+ 3. UnrealOn core environment config (if available)
47
+ 4. No default - return None if nothing configured
42
48
  """
43
49
  # 1. Explicit override
44
50
  if self.websocket_url:
@@ -53,7 +59,15 @@ class DriverConfig(BaseModel):
53
59
  if env_url:
54
60
  return env_url
55
61
 
56
- # 3. No default - return None if nothing is configured
62
+ # 3. Try unrealon_core environment config
63
+ if UNREALON_CORE_AVAILABLE:
64
+ try:
65
+ env_config = get_environment_config()
66
+ return env_config.websocket_url
67
+ except Exception:
68
+ pass # Fallback gracefully if core config fails
69
+
70
+ # 4. No default - return None if nothing is configured
57
71
  return None
58
72
 
59
73
  # Logging
@@ -83,3 +97,79 @@ class DriverConfig(BaseModel):
83
97
  batch_size: int = Field(default=10, description="Batch processing size")
84
98
 
85
99
  model_config = {"extra": "forbid"}
100
+
101
+ @classmethod
102
+ def for_development(cls, name: str, **kwargs) -> "DriverConfig":
103
+ """
104
+ Create development configuration with sensible defaults.
105
+
106
+ Args:
107
+ name: Driver name
108
+ **kwargs: Additional configuration overrides
109
+ """
110
+ defaults = {
111
+ "name": name,
112
+ "mode": DriverMode.STANDALONE,
113
+ "log_level": "DEBUG",
114
+ "browser_headless": False,
115
+ "proxy_enabled": False,
116
+ "cache_enabled": True,
117
+ "max_workers": 2,
118
+ }
119
+ defaults.update(kwargs)
120
+ return cls(**defaults)
121
+
122
+ @classmethod
123
+ def for_production(cls, name: str, **kwargs) -> "DriverConfig":
124
+ """
125
+ Create production configuration with performance and reliability defaults.
126
+
127
+ Args:
128
+ name: Driver name
129
+ **kwargs: Additional configuration overrides
130
+ """
131
+ defaults = {
132
+ "name": name,
133
+ "mode": DriverMode.DAEMON,
134
+ "log_level": "INFO",
135
+ "browser_headless": True,
136
+ "proxy_enabled": True,
137
+ "cache_enabled": True,
138
+ "max_workers": 4,
139
+ "max_retries": 5,
140
+ "http_timeout": 60,
141
+ "browser_timeout": 60,
142
+ }
143
+ defaults.update(kwargs)
144
+ return cls(**defaults)
145
+
146
+ @classmethod
147
+ def auto_detect(cls, name: str, **kwargs) -> "DriverConfig":
148
+ """
149
+ Auto-detect environment and create appropriate configuration.
150
+
151
+ Uses UNREALON_ENV environment variable or unrealon_core config to determine environment.
152
+
153
+ Args:
154
+ name: Driver name
155
+ **kwargs: Additional configuration overrides
156
+ """
157
+ # Try to detect environment
158
+ env_name = os.getenv("UNREALON_ENV", "development").lower()
159
+
160
+ # Try unrealon_core if available
161
+ if UNREALON_CORE_AVAILABLE:
162
+ try:
163
+ env_config = get_environment_config()
164
+ if env_config.is_production:
165
+ return cls.for_production(name, **kwargs)
166
+ elif env_config.is_development:
167
+ return cls.for_development(name, **kwargs)
168
+ except Exception:
169
+ pass # Fallback to env variable
170
+
171
+ # Fallback to environment variable
172
+ if env_name in ("prod", "production"):
173
+ return cls.for_production(name, **kwargs)
174
+ else:
175
+ return cls.for_development(name, **kwargs)
@@ -1,47 +0,0 @@
1
- """
2
- Config models - Phase 2 update.
3
-
4
- Import from strictly typed websocket models to avoid duplication.
5
- Following critical requirements - no raw Dict[str, Any].
6
- """
7
-
8
- # Import strictly typed models from websocket package
9
- from .websocket.config import (
10
- DriverConfiguration,
11
- LoggingConfiguration,
12
- TaskConfiguration,
13
- ProxyConfiguration
14
- )
15
- from .base import ConfigBaseModel
16
-
17
- # System config that doesn't exist in websocket models yet
18
- class SystemConfig(ConfigBaseModel):
19
- """System-wide configuration."""
20
-
21
- redis_url: str = "redis://localhost:6379/0"
22
- websocket_url: str = "ws://localhost:8000/ws"
23
- max_workers: int = 10
24
- debug: bool = False
25
-
26
- # Legacy compatibility - map to new typed models
27
- HttpConfig = TaskConfiguration # HTTP settings are part of task config
28
- ProxyConfig = ProxyConfiguration
29
- LoggingConfig = LoggingConfiguration
30
- BrowserConfig = TaskConfiguration # Browser settings are part of task config
31
- CacheConfig = SystemConfig # Cache settings are system-wide
32
- ThreadConfig = TaskConfiguration # Thread settings are part of task config
33
-
34
- __all__ = [
35
- 'DriverConfiguration',
36
- 'LoggingConfiguration',
37
- 'TaskConfiguration',
38
- 'ProxyConfiguration',
39
- 'SystemConfig',
40
- # Legacy names
41
- 'HttpConfig',
42
- 'ProxyConfig',
43
- 'LoggingConfig',
44
- 'BrowserConfig',
45
- 'CacheConfig',
46
- 'ThreadConfig'
47
- ]