intuned-runtime 1.3.5__tar.gz → 1.3.6__tar.gz

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.

Potentially problematic release.


This version of intuned-runtime might be problematic. Click here for more details.

Files changed (117) hide show
  1. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/PKG-INFO +1 -1
  2. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/pyproject.toml +1 -1
  3. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/browser/extensions/intuned_extension.py +9 -9
  4. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/browser/extensions/intuned_extension_server.py +3 -8
  5. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/browser/launch_chromium.py +3 -0
  6. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/helpers/extensions.py +7 -7
  7. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/types/settings_types.py +5 -2
  8. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/LICENSE +0 -0
  9. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/README.md +0 -0
  10. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/__init__.py +0 -0
  11. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/__init__.py +0 -0
  12. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/attempt_api_command.py +0 -0
  13. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/attempt_authsession_check_command.py +0 -0
  14. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/attempt_authsession_command.py +0 -0
  15. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/attempt_authsession_create_command.py +0 -0
  16. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/attempt_command.py +0 -0
  17. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/authsession_command.py +0 -0
  18. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/authsession_record_command.py +0 -0
  19. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/command.py +0 -0
  20. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/deploy_command.py +0 -0
  21. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/init_command.py +0 -0
  22. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/run_api_command.py +0 -0
  23. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/run_authsession_command.py +0 -0
  24. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/run_authsession_create_command.py +0 -0
  25. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/run_authsession_update_command.py +0 -0
  26. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/run_authsession_validate_command.py +0 -0
  27. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/run_command.py +0 -0
  28. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/commands/save_command.py +0 -0
  29. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/controller/__test__/__init__.py +0 -0
  30. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/controller/__test__/test_api.py +0 -0
  31. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/controller/__test__/test_authsession.py +0 -0
  32. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/controller/api.py +0 -0
  33. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/controller/authsession.py +0 -0
  34. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/controller/deploy.py +0 -0
  35. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/controller/save.py +0 -0
  36. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/types.py +0 -0
  37. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/__test__/test_browser.py +0 -0
  38. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/__test__/test_traces.py +0 -0
  39. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/api_helpers.py +0 -0
  40. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/auth_session_helpers.py +0 -0
  41. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/backend.py +0 -0
  42. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/browser.py +0 -0
  43. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/confirmation.py +0 -0
  44. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/console.py +0 -0
  45. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/error.py +0 -0
  46. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/exclusions.py +0 -0
  47. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/get_auth_parameters.py +0 -0
  48. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/help.py +0 -0
  49. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/import_function.py +0 -0
  50. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/timeout.py +0 -0
  51. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/traces.py +0 -0
  52. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_cli/utils/wrapper.py +0 -0
  53. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/__init__.py +0 -0
  54. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/__init__.py +0 -0
  55. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/browser/__init__.py +0 -0
  56. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/browser/save_state.py +0 -0
  57. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/project/__init__.py +0 -0
  58. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/project/auth_session/__init__.py +0 -0
  59. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/project/auth_session/check.py +0 -0
  60. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/project/auth_session/create.py +0 -0
  61. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/project/auth_session/load.py +0 -0
  62. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/project/project.py +0 -0
  63. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/project/run.py +0 -0
  64. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/project/run_interface.py +0 -0
  65. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/project/type_check.py +0 -0
  66. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/commands/root.py +0 -0
  67. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/logger.py +0 -0
  68. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/utils/ai_source_project.py +0 -0
  69. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/utils/code_tree.py +0 -0
  70. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/utils/run_apis.py +0 -0
  71. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/utils/setup_ide_functions_token.py +0 -0
  72. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/utils/unix_socket.py +0 -0
  73. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_internal_cli/utils/wrapper.py +0 -0
  74. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_runtime/__init__.py +0 -0
  75. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/intuned_runtime/captcha/__init__.py +0 -0
  76. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/__init__.py +0 -0
  77. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/backend_functions/__init__.py +0 -0
  78. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/backend_functions/_call_backend_function.py +0 -0
  79. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/backend_functions/get_auth_session_parameters.py +0 -0
  80. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/browser/__init__.py +0 -0
  81. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/browser/extensions/__init__.py +0 -0
  82. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/browser/extensions/helpers.py +0 -0
  83. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/browser/helpers.py +0 -0
  84. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/browser/launch_browser.py +0 -0
  85. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/browser/launch_camoufox.py +0 -0
  86. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/browser/storage_state.py +0 -0
  87. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/constants.py +0 -0
  88. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/context/__init__.py +0 -0
  89. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/context/context.py +0 -0
  90. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/env.py +0 -0
  91. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/errors/__init__.py +0 -0
  92. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/errors/auth_session_errors.py +0 -0
  93. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/errors/run_api_errors.py +0 -0
  94. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/errors/trace_errors.py +0 -0
  95. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/helpers/__init__.py +0 -0
  96. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/helpers/attempt_store.py +0 -0
  97. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/helpers/extend_payload.py +0 -0
  98. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/helpers/extend_timeout.py +0 -0
  99. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/helpers/get_auth_session_parameters.py +0 -0
  100. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/py.typed +0 -0
  101. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/run/__init__.py +0 -0
  102. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/run/intuned_settings.py +0 -0
  103. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/run/playwright_context.py +0 -0
  104. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/run/playwright_tracing.py +0 -0
  105. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/run/pydantic_encoder.py +0 -0
  106. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/run/run_api.py +0 -0
  107. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/run/setup_context_hook.py +0 -0
  108. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/run/traces.py +0 -0
  109. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/run/types.py +0 -0
  110. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/types/__init__.py +0 -0
  111. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/types/payload.py +0 -0
  112. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/types/run_types.py +0 -0
  113. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/utils/__init__.py +0 -0
  114. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/utils/anyio.py +0 -0
  115. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime/utils/config_loader.py +0 -0
  116. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime_helpers/__init__.py +0 -0
  117. {intuned_runtime-1.3.5 → intuned_runtime-1.3.6}/runtime_helpers/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: intuned-runtime
3
- Version: 1.3.5
3
+ Version: 1.3.6
4
4
  Summary: Runtime SDK that powers browser automation projects running on Intuned
5
5
  License: Elastic-2.0
6
6
  License-File: LICENSE
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "intuned-runtime"
7
- version = "1.3.5"
7
+ version = "1.3.6"
8
8
  description = "Runtime SDK that powers browser automation projects running on Intuned"
9
9
  authors = [ "Intuned Developers <engineering@intunedhq.com>",]
10
10
  readme = "README.md"
@@ -51,13 +51,7 @@ async def get_intuned_worker(context: BrowserContext):
51
51
  return None
52
52
 
53
53
 
54
- async def get_intuned_extension_settings() -> dict[str, Any]:
55
- intuned_json = await load_intuned_json()
56
- captcha_settings: CaptchaSolverSettings = (
57
- intuned_json.captcha_solver
58
- if intuned_json and intuned_json.captcha_solver is not None
59
- else CaptchaSolverSettings()
60
- )
54
+ async def get_intuned_extension_settings(captcha_settings: CaptchaSolverSettings) -> dict[str, Any]:
61
55
  context = IntunedContext.current()
62
56
  return {
63
57
  **captcha_settings.model_dump(mode="json"),
@@ -71,14 +65,20 @@ async def get_intuned_extension_settings() -> dict[str, Any]:
71
65
  async def setup_intuned_extension():
72
66
  if not is_intuned_extension_enabled():
73
67
  return
74
- await setup_intuned_extension_server()
68
+ intuned_json = await load_intuned_json()
69
+ captcha_settings: CaptchaSolverSettings = (
70
+ intuned_json.captcha_solver
71
+ if intuned_json and intuned_json.captcha_solver is not None
72
+ else CaptchaSolverSettings()
73
+ )
74
+ await setup_intuned_extension_server(captcha_settings)
75
75
  intuned_extension_path = get_intuned_extension_path()
76
76
  if intuned_extension_path is None:
77
77
  logger.warning("Intuned extension path not found, intuned extension might not work properly")
78
78
  return
79
79
 
80
80
  settings_path = intuned_extension_path / "intunedSettings.json"
81
- settings_data = await get_intuned_extension_settings()
81
+ settings_data = await get_intuned_extension_settings(captcha_settings)
82
82
 
83
83
  try:
84
84
  with open(settings_path, "w") as f:
@@ -17,7 +17,6 @@ from waitress.server import create_server
17
17
  from waitress.server import MultiSocketServer
18
18
 
19
19
  from runtime.types import CaptchaSolverSettings
20
- from runtime.utils.config_loader import load_intuned_json
21
20
 
22
21
  logging.basicConfig(level=logging.INFO)
23
22
  logger = logging.getLogger(__name__)
@@ -158,14 +157,10 @@ event_emitter: Optional[AsyncIOEventEmitter] = None
158
157
  extension_server: Optional[ExtensionServer] = None
159
158
 
160
159
 
161
- async def setup_intuned_extension_server():
160
+ async def setup_intuned_extension_server(captcha_settings: Optional[CaptchaSolverSettings] = None):
162
161
  global event_emitter, extension_server
163
- intuned_json = await load_intuned_json()
164
- captcha_settings: CaptchaSolverSettings = (
165
- intuned_json.captcha_solver
166
- if intuned_json and intuned_json.captcha_solver is not None
167
- else CaptchaSolverSettings()
168
- )
162
+ if captcha_settings is None:
163
+ captcha_settings = CaptchaSolverSettings()
169
164
  extension_server = ExtensionServer()
170
165
  event_emitter = AsyncIOEventEmitter()
171
166
  await extension_server.start(port=captcha_settings.port)
@@ -13,6 +13,7 @@ from runtime.browser.extensions.intuned_extension import get_intuned_worker
13
13
  from runtime.browser.extensions.intuned_extension import is_intuned_extension_enabled
14
14
  from runtime.browser.extensions.intuned_extension import setup_intuned_extension
15
15
  from runtime.browser.extensions.intuned_extension_server import clean_intuned_extension_server
16
+ from runtime.browser.extensions.intuned_extension_server import setup_intuned_extension_server
16
17
 
17
18
  from .helpers import get_local_cdp_address
18
19
  from .helpers import get_proxy_env
@@ -68,6 +69,8 @@ async def launch_chromium(
68
69
  extra_args: list[str] = []
69
70
  async with async_playwright() as playwright:
70
71
  if cdp_address is not None:
72
+ if is_intuned_extension_enabled():
73
+ await setup_intuned_extension_server()
71
74
  browser: Browser = await playwright.chromium.connect_over_cdp(cdp_address)
72
75
  context = browser.contexts[0]
73
76
  user_preferences_dir = None
@@ -202,25 +202,25 @@ async def _wait_for_captcha_solve_core(
202
202
 
203
203
  logger.debug(f"Page object: {page}")
204
204
 
205
- # Execute function if provided
206
205
  result = None
207
206
  if func is not None:
208
207
  result = await func()
209
208
 
210
- # Wait for network to settle if requested
211
209
  if wait_for_network_settled:
212
210
  try:
213
211
  await page.wait_for_load_state("networkidle", timeout=timeout)
214
212
  except Exception as e:
215
213
  logger.debug(f"Network idle wait failed: {e}")
216
214
 
217
- # Check for captcha detection
218
215
  detection_event: EventRequest
219
216
  try:
220
217
  detection_event = await wait_for_captcha_event("CAPTCHA_DETECTED", timeout=timeout)
221
- except:
222
- logger.debug("CAPTCHA Not detected, skipping...")
218
+ except asyncio.TimeoutError:
219
+ logger.info("CAPTCHA Detection timed out")
223
220
  return result
221
+ except Exception as e:
222
+ logger.error(f"Error while waiting for captcha: {e}")
223
+ raise e
224
224
 
225
225
  logger.info("CAPTCHA Detected, awaiting result...")
226
226
  if detection_event.session_id is None:
@@ -263,9 +263,9 @@ async def _wait_for_captcha_solve_core(
263
263
 
264
264
  logger.info("CAPTCHA solved successfully")
265
265
 
266
- except asyncio.TimeoutError:
266
+ except asyncio.TimeoutError as e:
267
267
  logger.error("CAPTCHA Result timeout")
268
- raise
268
+ raise RuntimeError("CAPTCHA Solving timeout") from e
269
269
  except Exception as e:
270
270
  logger.error(f"CAPTCHA solve error: {e}")
271
271
  raise
@@ -1,3 +1,4 @@
1
+ import os
1
2
  import socket
2
3
  from typing import List
3
4
  from typing import Literal
@@ -6,7 +7,9 @@ from pydantic import BaseModel
6
7
  from pydantic import Field
7
8
 
8
9
 
9
- def get_random_port():
10
+ def get_intuned_captcha_extension_port():
11
+ if "INTUNED_CAPTCHA_EXTENSION_PORT" in os.environ:
12
+ return int(os.environ["INTUNED_CAPTCHA_EXTENSION_PORT"])
10
13
  with socket.socket() as s:
11
14
  s.bind(("", 0))
12
15
  return s.getsockname()[1]
@@ -54,7 +57,7 @@ class CaptchaSolverSettings(BaseModel):
54
57
  }
55
58
 
56
59
  enabled: bool = Field(default=False)
57
- port: int = Field(default_factory=get_random_port)
60
+ port: int = Field(default_factory=get_intuned_captcha_extension_port)
58
61
  cloudflare: CaptchaSettings = Field(default_factory=CaptchaSettings)
59
62
  google_recaptcha_v2: CaptchaSettings = Field(alias="googleRecaptchaV2", default_factory=CaptchaSettings)
60
63
  google_recaptcha_v3: CaptchaSettings = Field(alias="googleRecaptchaV3", default_factory=CaptchaSettings)
File without changes