hyperbrowser 1.9.4__tar.gz → 1.10.0__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.
Files changed (123) hide show
  1. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/PKG-INFO +1 -1
  2. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/computer_action.py +39 -6
  3. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/computer_action.py +39 -6
  4. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/__init__.py +6 -0
  5. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/computer_action.py +39 -0
  6. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/__init__.py +4 -0
  7. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/computer_action.py +24 -0
  8. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/pyproject.toml +1 -1
  9. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/LICENSE +0 -0
  10. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/README.md +0 -0
  11. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/__init__.py +0 -0
  12. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/build_context.py +0 -0
  13. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/_request.py +0 -0
  14. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/async_client.py +0 -0
  15. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/base.py +0 -0
  16. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/agents/__init__.py +0 -0
  17. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/agents/browser_use.py +0 -0
  18. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/agents/claude_computer_use.py +0 -0
  19. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/agents/cua.py +0 -0
  20. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/agents/gemini_computer_use.py +0 -0
  21. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/agents/grok_computer_use.py +0 -0
  22. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/agents/hyper_agent.py +0 -0
  23. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/agents/jev_computer_use.py +0 -0
  24. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/agents/meta_computer_use.py +0 -0
  25. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/crawl.py +0 -0
  26. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/extension.py +0 -0
  27. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/extract.py +0 -0
  28. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/profile.py +0 -0
  29. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/sandbox.py +0 -0
  30. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/sandboxes/__init__.py +0 -0
  31. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/sandboxes/sandbox_files.py +0 -0
  32. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/sandboxes/sandbox_processes.py +0 -0
  33. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/sandboxes/sandbox_terminal.py +0 -0
  34. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/sandboxes/sandbox_transport.py +0 -0
  35. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/scrape.py +0 -0
  36. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/session.py +0 -0
  37. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/team.py +0 -0
  38. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/volume.py +0 -0
  39. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/web/__init__.py +0 -0
  40. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/web/batch_fetch.py +0 -0
  41. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/async_manager/web/crawl.py +0 -0
  42. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sandboxes/__init__.py +0 -0
  43. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sandboxes/dockerfile_analysis.py +0 -0
  44. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sandboxes/dockerignore.py +0 -0
  45. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sandboxes/image_build.py +0 -0
  46. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sandboxes/image_resolution.py +0 -0
  47. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sandboxes/process_output.py +0 -0
  48. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sandboxes/shared.py +0 -0
  49. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/agents/__init__.py +0 -0
  50. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/agents/browser_use.py +0 -0
  51. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/agents/claude_computer_use.py +0 -0
  52. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/agents/cua.py +0 -0
  53. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/agents/gemini_computer_use.py +0 -0
  54. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/agents/grok_computer_use.py +0 -0
  55. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/agents/hyper_agent.py +0 -0
  56. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/agents/jev_computer_use.py +0 -0
  57. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/agents/meta_computer_use.py +0 -0
  58. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/crawl.py +0 -0
  59. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/extension.py +0 -0
  60. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/extract.py +0 -0
  61. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/profile.py +0 -0
  62. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/sandbox.py +0 -0
  63. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/sandboxes/__init__.py +0 -0
  64. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/sandboxes/sandbox_files.py +0 -0
  65. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/sandboxes/sandbox_processes.py +0 -0
  66. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/sandboxes/sandbox_terminal.py +0 -0
  67. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/sandboxes/sandbox_transport.py +0 -0
  68. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/scrape.py +0 -0
  69. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/session.py +0 -0
  70. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/team.py +0 -0
  71. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/volume.py +0 -0
  72. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/web/__init__.py +0 -0
  73. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/web/batch_fetch.py +0 -0
  74. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/managers/sync_manager/web/crawl.py +0 -0
  75. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/client/sync.py +0 -0
  76. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/config.py +0 -0
  77. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/exceptions.py +0 -0
  78. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/image_builds.py +0 -0
  79. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/_parsers.py +0 -0
  80. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/agents/browser_use.py +0 -0
  81. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/agents/claude_computer_use.py +0 -0
  82. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/agents/cua.py +0 -0
  83. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/agents/gemini_computer_use.py +0 -0
  84. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/agents/grok_computer_use.py +0 -0
  85. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/agents/hyper_agent.py +0 -0
  86. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/agents/jev_computer_use.py +0 -0
  87. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/agents/meta_computer_use.py +0 -0
  88. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/consts.py +0 -0
  89. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/crawl.py +0 -0
  90. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/extension.py +0 -0
  91. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/extract.py +0 -0
  92. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/profile.py +0 -0
  93. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/sandbox.py +0 -0
  94. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/scrape.py +0 -0
  95. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/session.py +0 -0
  96. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/team.py +0 -0
  97. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/volume.py +0 -0
  98. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/web/batch_fetch.py +0 -0
  99. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/web/branding.py +0 -0
  100. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/web/common.py +0 -0
  101. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/web/crawl.py +0 -0
  102. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/web/fetch.py +0 -0
  103. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/models/web/search.py +0 -0
  104. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/py.typed +0 -0
  105. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/sandbox_common.py +0 -0
  106. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/tools/__init__.py +0 -0
  107. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/tools/anthropic.py +0 -0
  108. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/tools/openai.py +0 -0
  109. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/tools/schema.py +0 -0
  110. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/transport/async_transport.py +0 -0
  111. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/transport/base.py +0 -0
  112. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/transport/sync.py +0 -0
  113. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/_json.py +0 -0
  114. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/agents.py +0 -0
  115. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/crawl.py +0 -0
  116. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/extension.py +0 -0
  117. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/extract.py +0 -0
  118. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/profile.py +0 -0
  119. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/sandbox.py +0 -0
  120. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/scrape.py +0 -0
  121. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/session.py +0 -0
  122. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/volume.py +0 -0
  123. {hyperbrowser-1.9.4 → hyperbrowser-1.10.0}/hyperbrowser/types/web.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperbrowser
3
- Version: 1.9.4
3
+ Version: 1.10.0
4
4
  Summary: Python SDK for hyperbrowser
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -12,6 +12,8 @@ from hyperbrowser.models import (
12
12
  PressKeysActionParams,
13
13
  MoveMouseActionParams,
14
14
  ScreenshotActionParams,
15
+ CursorPositionActionParams,
16
+ ScrollAtCursorActionParams,
15
17
  ScrollActionParams,
16
18
  TypeTextActionParams,
17
19
  Coordinate,
@@ -38,6 +40,7 @@ _ACTION_PARAM_MODELS = {
38
40
  ComputerAction.MOVE_MOUSE.value: MoveMouseActionParams,
39
41
  ComputerAction.PRESS_KEYS.value: PressKeysActionParams,
40
42
  ComputerAction.SCREENSHOT.value: ScreenshotActionParams,
43
+ ComputerAction.CURSOR_POSITION.value: CursorPositionActionParams,
41
44
  ComputerAction.SCROLL.value: ScrollActionParams,
42
45
  ComputerAction.TYPE_TEXT.value: TypeTextActionParams,
43
46
  ComputerAction.GET_CLIPBOARD_TEXT.value: GetClipboardTextActionParams,
@@ -47,6 +50,9 @@ _ACTION_PARAM_MODELS = {
47
50
 
48
51
 
49
52
  def _action_param_model(params):
53
+ if isinstance(params, ScrollAtCursorActionParams):
54
+ return ScrollAtCursorActionParams
55
+
50
56
  for model in _ACTION_PARAM_MODELS.values():
51
57
  if isinstance(params, model):
52
58
  return model
@@ -56,6 +62,8 @@ def _action_param_model(params):
56
62
  if isinstance(action, ComputerAction):
57
63
  action = action.value
58
64
  model = _ACTION_PARAM_MODELS.get(action)
65
+ if model is ScrollActionParams and "x" not in params and "y" not in params:
66
+ return ScrollAtCursorActionParams
59
67
  if model is not None:
60
68
  return model
61
69
 
@@ -71,18 +79,13 @@ class ComputerActionManager:
71
79
  session: Union[SessionDetail, str],
72
80
  params: Union[ComputerActionParamsDict, ComputerActionParams],
73
81
  ) -> ComputerActionResponse:
82
+ payload = dump_request(params, _action_param_model(params), name="params")
74
83
  if isinstance(session, str):
75
84
  session = await self._client.sessions.get(session)
76
85
 
77
86
  if not session.computer_action_endpoint:
78
87
  raise ValueError("Computer action endpoint not available for this session")
79
88
 
80
- payload = dump_request(
81
- params,
82
- _action_param_model(params),
83
- name="params",
84
- )
85
-
86
89
  response = await self._client.transport.post(
87
90
  session.computer_action_endpoint,
88
91
  data=payload,
@@ -97,12 +100,14 @@ class ComputerActionManager:
97
100
  button: ComputerActionMouseButton = "left",
98
101
  num_clicks: int = 1,
99
102
  return_screenshot: bool = False,
103
+ keys: Optional[List[str]] = None,
100
104
  ) -> ComputerActionResponse:
101
105
  params = ClickActionParams(
102
106
  x=x,
103
107
  y=y,
104
108
  button=button,
105
109
  num_clicks=num_clicks,
110
+ keys=keys,
106
111
  return_screenshot=return_screenshot,
107
112
  )
108
113
  return await self._execute_request(session, params)
@@ -123,6 +128,14 @@ class ComputerActionManager:
123
128
  params = ScreenshotActionParams()
124
129
  return await self._execute_request(session, params)
125
130
 
131
+ async def cursor_position(
132
+ self,
133
+ session: Union[SessionDetail, str],
134
+ return_screenshot: bool = False,
135
+ ) -> ComputerActionResponse:
136
+ params = CursorPositionActionParams(return_screenshot=return_screenshot)
137
+ return await self._execute_request(session, params)
138
+
126
139
  async def press_keys(
127
140
  self,
128
141
  session: Union[SessionDetail, str],
@@ -169,6 +182,7 @@ class ComputerActionManager:
169
182
  session: Union[SessionDetail, str],
170
183
  path: List[Union[CoordinateDict, Coordinate]],
171
184
  return_screenshot: bool = False,
185
+ keys: Optional[List[str]] = None,
172
186
  ) -> ComputerActionResponse:
173
187
  params = DragActionParams(
174
188
  path=[
@@ -176,6 +190,7 @@ class ComputerActionManager:
176
190
  for coordinate in path
177
191
  ],
178
192
  return_screenshot=return_screenshot,
193
+ keys=keys,
179
194
  )
180
195
  return await self._execute_request(session, params)
181
196
 
@@ -197,12 +212,30 @@ class ComputerActionManager:
197
212
  scroll_x: int,
198
213
  scroll_y: int,
199
214
  return_screenshot: bool = False,
215
+ keys: Optional[List[str]] = None,
200
216
  ) -> ComputerActionResponse:
201
217
  params = ScrollActionParams(
202
218
  x=x,
203
219
  y=y,
204
220
  scroll_x=scroll_x,
205
221
  scroll_y=scroll_y,
222
+ keys=keys,
223
+ return_screenshot=return_screenshot,
224
+ )
225
+ return await self._execute_request(session, params)
226
+
227
+ async def scroll_at_cursor(
228
+ self,
229
+ session: Union[SessionDetail, str],
230
+ scroll_x: int = 0,
231
+ scroll_y: int = 0,
232
+ return_screenshot: bool = False,
233
+ keys: Optional[List[str]] = None,
234
+ ) -> ComputerActionResponse:
235
+ params = ScrollAtCursorActionParams(
236
+ scroll_x=scroll_x,
237
+ scroll_y=scroll_y,
238
+ keys=keys,
206
239
  return_screenshot=return_screenshot,
207
240
  )
208
241
  return await self._execute_request(session, params)
@@ -12,6 +12,8 @@ from hyperbrowser.models import (
12
12
  PressKeysActionParams,
13
13
  MoveMouseActionParams,
14
14
  ScreenshotActionParams,
15
+ CursorPositionActionParams,
16
+ ScrollAtCursorActionParams,
15
17
  ScrollActionParams,
16
18
  TypeTextActionParams,
17
19
  Coordinate,
@@ -38,6 +40,7 @@ _ACTION_PARAM_MODELS = {
38
40
  ComputerAction.MOVE_MOUSE.value: MoveMouseActionParams,
39
41
  ComputerAction.PRESS_KEYS.value: PressKeysActionParams,
40
42
  ComputerAction.SCREENSHOT.value: ScreenshotActionParams,
43
+ ComputerAction.CURSOR_POSITION.value: CursorPositionActionParams,
41
44
  ComputerAction.SCROLL.value: ScrollActionParams,
42
45
  ComputerAction.TYPE_TEXT.value: TypeTextActionParams,
43
46
  ComputerAction.GET_CLIPBOARD_TEXT.value: GetClipboardTextActionParams,
@@ -47,6 +50,9 @@ _ACTION_PARAM_MODELS = {
47
50
 
48
51
 
49
52
  def _action_param_model(params):
53
+ if isinstance(params, ScrollAtCursorActionParams):
54
+ return ScrollAtCursorActionParams
55
+
50
56
  for model in _ACTION_PARAM_MODELS.values():
51
57
  if isinstance(params, model):
52
58
  return model
@@ -56,6 +62,8 @@ def _action_param_model(params):
56
62
  if isinstance(action, ComputerAction):
57
63
  action = action.value
58
64
  model = _ACTION_PARAM_MODELS.get(action)
65
+ if model is ScrollActionParams and "x" not in params and "y" not in params:
66
+ return ScrollAtCursorActionParams
59
67
  if model is not None:
60
68
  return model
61
69
 
@@ -71,18 +79,13 @@ class ComputerActionManager:
71
79
  session: Union[SessionDetail, str],
72
80
  params: Union[ComputerActionParamsDict, ComputerActionParams],
73
81
  ) -> ComputerActionResponse:
82
+ payload = dump_request(params, _action_param_model(params), name="params")
74
83
  if isinstance(session, str):
75
84
  session = self._client.sessions.get(session)
76
85
 
77
86
  if not session.computer_action_endpoint:
78
87
  raise ValueError("Computer action endpoint not available for this session")
79
88
 
80
- payload = dump_request(
81
- params,
82
- _action_param_model(params),
83
- name="params",
84
- )
85
-
86
89
  response = self._client.transport.post(
87
90
  session.computer_action_endpoint,
88
91
  data=payload,
@@ -97,12 +100,14 @@ class ComputerActionManager:
97
100
  button: ComputerActionMouseButton = "left",
98
101
  num_clicks: int = 1,
99
102
  return_screenshot: bool = False,
103
+ keys: Optional[List[str]] = None,
100
104
  ) -> ComputerActionResponse:
101
105
  params = ClickActionParams(
102
106
  x=x,
103
107
  y=y,
104
108
  button=button,
105
109
  num_clicks=num_clicks,
110
+ keys=keys,
106
111
  return_screenshot=return_screenshot,
107
112
  )
108
113
  return self._execute_request(session, params)
@@ -123,6 +128,14 @@ class ComputerActionManager:
123
128
  params = ScreenshotActionParams()
124
129
  return self._execute_request(session, params)
125
130
 
131
+ def cursor_position(
132
+ self,
133
+ session: Union[SessionDetail, str],
134
+ return_screenshot: bool = False,
135
+ ) -> ComputerActionResponse:
136
+ params = CursorPositionActionParams(return_screenshot=return_screenshot)
137
+ return self._execute_request(session, params)
138
+
126
139
  def press_keys(
127
140
  self,
128
141
  session: Union[SessionDetail, str],
@@ -169,6 +182,7 @@ class ComputerActionManager:
169
182
  session: Union[SessionDetail, str],
170
183
  path: List[Union[CoordinateDict, Coordinate]],
171
184
  return_screenshot: bool = False,
185
+ keys: Optional[List[str]] = None,
172
186
  ) -> ComputerActionResponse:
173
187
  params = DragActionParams(
174
188
  path=[
@@ -176,6 +190,7 @@ class ComputerActionManager:
176
190
  for coordinate in path
177
191
  ],
178
192
  return_screenshot=return_screenshot,
193
+ keys=keys,
179
194
  )
180
195
  return self._execute_request(session, params)
181
196
 
@@ -197,12 +212,30 @@ class ComputerActionManager:
197
212
  scroll_x: int,
198
213
  scroll_y: int,
199
214
  return_screenshot: bool = False,
215
+ keys: Optional[List[str]] = None,
200
216
  ) -> ComputerActionResponse:
201
217
  params = ScrollActionParams(
202
218
  x=x,
203
219
  y=y,
204
220
  scroll_x=scroll_x,
205
221
  scroll_y=scroll_y,
222
+ keys=keys,
223
+ return_screenshot=return_screenshot,
224
+ )
225
+ return self._execute_request(session, params)
226
+
227
+ def scroll_at_cursor(
228
+ self,
229
+ session: Union[SessionDetail, str],
230
+ scroll_x: int = 0,
231
+ scroll_y: int = 0,
232
+ return_screenshot: bool = False,
233
+ keys: Optional[List[str]] = None,
234
+ ) -> ComputerActionResponse:
235
+ params = ScrollAtCursorActionParams(
236
+ scroll_x=scroll_x,
237
+ scroll_y=scroll_y,
238
+ keys=keys,
206
239
  return_screenshot=return_screenshot,
207
240
  )
208
241
  return self._execute_request(session, params)
@@ -274,6 +274,8 @@ from .computer_action import (
274
274
  MoveMouseActionParams,
275
275
  PressKeysActionParams,
276
276
  ScreenshotActionParams,
277
+ CursorPositionActionParams,
278
+ ScrollAtCursorActionParams,
277
279
  ScrollActionParams,
278
280
  TypeTextActionParams,
279
281
  ComputerActionMouseButton,
@@ -283,6 +285,7 @@ from .computer_action import (
283
285
  ComputerActionWindow,
284
286
  ComputerActionResponseDataClipboardText,
285
287
  ComputerActionResponseDataListWindows,
288
+ ComputerActionResponseDataCursorPosition,
286
289
  ComputerActionResponseData,
287
290
  )
288
291
  from .session import (
@@ -779,6 +782,8 @@ __all__ = [
779
782
  "MoveMouseActionParams",
780
783
  "PressKeysActionParams",
781
784
  "ScreenshotActionParams",
785
+ "CursorPositionActionParams",
786
+ "ScrollAtCursorActionParams",
782
787
  "ScrollActionParams",
783
788
  "TypeTextActionParams",
784
789
  "ComputerActionMouseButton",
@@ -788,6 +793,7 @@ __all__ = [
788
793
  "ComputerActionWindow",
789
794
  "ComputerActionResponseDataClipboardText",
790
795
  "ComputerActionResponseDataListWindows",
796
+ "ComputerActionResponseDataCursorPosition",
791
797
  "ComputerActionResponseData",
792
798
  # web
793
799
  "StartBatchFetchJobParams",
@@ -14,6 +14,7 @@ class ComputerAction(str, Enum):
14
14
  MOVE_MOUSE = "move_mouse"
15
15
  PRESS_KEYS = "press_keys"
16
16
  SCREENSHOT = "screenshot"
17
+ CURSOR_POSITION = "cursor_position"
17
18
  SCROLL = "scroll"
18
19
  TYPE_TEXT = "type_text"
19
20
  GET_CLIPBOARD_TEXT = "get_clipboard_text"
@@ -43,6 +44,7 @@ class ClickActionParams(BaseModel):
43
44
  y: Optional[int] = Field(default=None)
44
45
  button: ComputerActionMouseButton = Field(default="left")
45
46
  num_clicks: int = Field(serialization_alias="numClicks", default=1)
47
+ keys: Optional[List[str]] = None
46
48
  return_screenshot: bool = Field(
47
49
  serialization_alias="returnScreenshot", default=False
48
50
  )
@@ -55,6 +57,7 @@ class DragActionParams(BaseModel):
55
57
 
56
58
  action: Literal[ComputerAction.DRAG] = ComputerAction.DRAG
57
59
  path: List[Coordinate]
60
+ keys: Optional[List[str]] = None
58
61
  return_screenshot: bool = Field(
59
62
  serialization_alias="returnScreenshot", default=False
60
63
  )
@@ -130,6 +133,17 @@ class ScreenshotActionParams(BaseModel):
130
133
  action: Literal[ComputerAction.SCREENSHOT] = ComputerAction.SCREENSHOT
131
134
 
132
135
 
136
+ class CursorPositionActionParams(BaseModel):
137
+ """Parameters for reading the desktop cursor position."""
138
+
139
+ model_config = ConfigDict(use_enum_values=True)
140
+
141
+ action: Literal[ComputerAction.CURSOR_POSITION] = ComputerAction.CURSOR_POSITION
142
+ return_screenshot: bool = Field(
143
+ serialization_alias="returnScreenshot", default=False
144
+ )
145
+
146
+
133
147
  class ScrollActionParams(BaseModel):
134
148
  """Parameters for scroll action."""
135
149
 
@@ -138,8 +152,23 @@ class ScrollActionParams(BaseModel):
138
152
  action: Literal[ComputerAction.SCROLL] = ComputerAction.SCROLL
139
153
  x: int
140
154
  y: int
155
+ keys: Optional[List[str]] = None
156
+ scroll_x: int = Field(serialization_alias="scrollX")
157
+ scroll_y: int = Field(serialization_alias="scrollY")
158
+ return_screenshot: bool = Field(
159
+ serialization_alias="returnScreenshot", default=False
160
+ )
161
+
162
+
163
+ class ScrollAtCursorActionParams(BaseModel):
164
+ """Parameters for scrolling without moving the desktop cursor."""
165
+
166
+ model_config = ConfigDict(use_enum_values=True)
167
+
168
+ action: Literal[ComputerAction.SCROLL] = ComputerAction.SCROLL
141
169
  scroll_x: int = Field(serialization_alias="scrollX")
142
170
  scroll_y: int = Field(serialization_alias="scrollY")
171
+ keys: Optional[List[str]] = None
143
172
  return_screenshot: bool = Field(
144
173
  serialization_alias="returnScreenshot", default=False
145
174
  )
@@ -201,7 +230,9 @@ ComputerActionParams = Union[
201
230
  PressKeysActionParams,
202
231
  MoveMouseActionParams,
203
232
  ScreenshotActionParams,
233
+ CursorPositionActionParams,
204
234
  ScrollActionParams,
235
+ ScrollAtCursorActionParams,
205
236
  TypeTextActionParams,
206
237
  HoldKeyActionParams,
207
238
  MouseDownActionParams,
@@ -237,7 +268,15 @@ class ComputerActionResponseDataListWindows(BaseModel):
237
268
  windows: List[ComputerActionWindow] = Field(default_factory=list)
238
269
 
239
270
 
271
+ class ComputerActionResponseDataCursorPosition(BaseModel):
272
+ """Desktop cursor coordinates in physical screen pixels."""
273
+
274
+ x: int
275
+ y: int
276
+
277
+
240
278
  ComputerActionResponseData = Union[
279
+ ComputerActionResponseDataCursorPosition,
241
280
  ComputerActionResponseDataListWindows,
242
281
  ComputerActionResponseDataClipboardText,
243
282
  ]
@@ -32,6 +32,8 @@ from .agents import (
32
32
  StartMetaComputerUseTaskParams,
33
33
  )
34
34
  from .computer_action import (
35
+ CursorPositionActionParams,
36
+ ScrollAtCursorActionParams,
35
37
  ClickActionParams,
36
38
  ComputerActionMouseButton,
37
39
  ComputerActionParams,
@@ -212,6 +214,8 @@ __all__ = [
212
214
  "PressKeysActionParams",
213
215
  "PutSelectionTextActionParams",
214
216
  "ScreenshotActionParams",
217
+ "CursorPositionActionParams",
218
+ "ScrollAtCursorActionParams",
215
219
  "ScrollActionParams",
216
220
  "TypeTextActionParams",
217
221
  "GetCrawlJobParams",
@@ -23,6 +23,7 @@ class ClickActionParams(TypedDict, total=False):
23
23
  y: Optional[int]
24
24
  button: ComputerActionMouseButton
25
25
  num_clicks: int
26
+ keys: List[str]
26
27
  return_screenshot: bool
27
28
 
28
29
 
@@ -31,6 +32,7 @@ class DragActionParams(TypedDict, total=False):
31
32
 
32
33
  action: Required[Literal["drag"]]
33
34
  path: Required[List[Coordinate]]
35
+ keys: List[str]
34
36
  return_screenshot: bool
35
37
 
36
38
 
@@ -82,14 +84,32 @@ class ScreenshotActionParams(TypedDict):
82
84
  action: Literal["screenshot"]
83
85
 
84
86
 
87
+ class CursorPositionActionParams(TypedDict, total=False):
88
+ """Parameters for reading the desktop cursor position."""
89
+
90
+ action: Required[Literal["cursor_position"]]
91
+ return_screenshot: bool
92
+
93
+
85
94
  class ScrollActionParams(TypedDict, total=False):
86
95
  """Parameters for scrolling at a screen coordinate."""
87
96
 
88
97
  action: Required[Literal["scroll"]]
89
98
  x: Required[int]
90
99
  y: Required[int]
100
+ keys: List[str]
101
+ scroll_x: Required[int]
102
+ scroll_y: Required[int]
103
+ return_screenshot: bool
104
+
105
+
106
+ class ScrollAtCursorActionParams(TypedDict, total=False):
107
+ """Parameters for scrolling without moving the desktop cursor."""
108
+
109
+ action: Required[Literal["scroll"]]
91
110
  scroll_x: Required[int]
92
111
  scroll_y: Required[int]
112
+ keys: List[str]
93
113
  return_screenshot: bool
94
114
 
95
115
 
@@ -129,7 +149,9 @@ ComputerActionParams: TypeAlias = Union[
129
149
  PressKeysActionParams,
130
150
  MoveMouseActionParams,
131
151
  ScreenshotActionParams,
152
+ CursorPositionActionParams,
132
153
  ScrollActionParams,
154
+ ScrollAtCursorActionParams,
133
155
  TypeTextActionParams,
134
156
  HoldKeyActionParams,
135
157
  MouseDownActionParams,
@@ -145,6 +167,7 @@ __all__ = [
145
167
  "ComputerActionMouseButton",
146
168
  "ComputerActionParams",
147
169
  "Coordinate",
170
+ "CursorPositionActionParams",
148
171
  "DragActionParams",
149
172
  "GetClipboardTextActionParams",
150
173
  "HoldKeyActionParams",
@@ -156,5 +179,6 @@ __all__ = [
156
179
  "PutSelectionTextActionParams",
157
180
  "ScreenshotActionParams",
158
181
  "ScrollActionParams",
182
+ "ScrollAtCursorActionParams",
159
183
  "TypeTextActionParams",
160
184
  ]
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "hyperbrowser"
3
- version = "1.9.4"
3
+ version = "1.10.0"
4
4
  description = "Python SDK for hyperbrowser"
5
5
  authors = ["Nikhil Shahi <nshahi1998@gmail.com>"]
6
6
  license = "MIT"
File without changes
File without changes