@hyperbrowser/sdk 1.0.2 → 1.1.0

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.
@@ -3,13 +3,16 @@ import { ComputerActionResponse, Coordinate, ComputerActionMouseButton } from ".
3
3
  import { BaseService } from "./base";
4
4
  export declare class ComputerActionService extends BaseService {
5
5
  private executeRequest;
6
- click(session: SessionDetail | string, x: number, y: number, button?: ComputerActionMouseButton, numClicks?: number, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
6
+ click(session: SessionDetail | string, x: number, y: number, button?: ComputerActionMouseButton, numClicks?: number, returnScreenshot?: boolean, keys?: string[]): Promise<ComputerActionResponse>;
7
+ clickAtCursor(session: SessionDetail | string, button?: ComputerActionMouseButton, numClicks?: number, returnScreenshot?: boolean, keys?: string[]): Promise<ComputerActionResponse>;
7
8
  typeText(session: SessionDetail | string, text: string, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
8
9
  screenshot(session: SessionDetail | string): Promise<ComputerActionResponse>;
10
+ cursorPosition(session: SessionDetail | string, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
9
11
  pressKeys(session: SessionDetail | string, keys: string[], returnScreenshot?: boolean): Promise<ComputerActionResponse>;
10
- drag(session: SessionDetail | string, path: Coordinate[], returnScreenshot?: boolean): Promise<ComputerActionResponse>;
12
+ drag(session: SessionDetail | string, path: Coordinate[], returnScreenshot?: boolean, keys?: string[]): Promise<ComputerActionResponse>;
11
13
  moveMouse(session: SessionDetail | string, x: number, y: number, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
12
- scroll(session: SessionDetail | string, x: number, y: number, scrollX: number, scrollY: number, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
14
+ scroll(session: SessionDetail | string, x: number, y: number, scrollX: number, scrollY: number, returnScreenshot?: boolean, keys?: string[]): Promise<ComputerActionResponse>;
15
+ scrollAtCursor(session: SessionDetail | string, scrollX?: number, scrollY?: number, returnScreenshot?: boolean, keys?: string[]): Promise<ComputerActionResponse>;
13
16
  holdKey(session: SessionDetail | string, key: string, duration: number, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
14
17
  mouseDown(session: SessionDetail | string, button?: ComputerActionMouseButton, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
15
18
  mouseUp(session: SessionDetail | string, button?: ComputerActionMouseButton, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
@@ -29,14 +29,24 @@ class ComputerActionService extends base_1.BaseService {
29
29
  throw new client_1.HyperbrowserError("Failed to execute computer action", undefined);
30
30
  }
31
31
  }
32
- async click(session, x, y, button = "left", numClicks = 1, returnScreenshot = false) {
32
+ async click(session, x, y, button = "left", numClicks = 1, returnScreenshot = false, keys) {
33
33
  return this.executeRequest(session, {
34
34
  action: computer_action_1.ComputerAction.CLICK,
35
35
  x,
36
36
  y,
37
37
  button,
38
38
  numClicks,
39
+ keys,
40
+ returnScreenshot,
41
+ });
42
+ }
43
+ async clickAtCursor(session, button = "left", numClicks = 1, returnScreenshot = false, keys) {
44
+ return this.executeRequest(session, {
45
+ action: computer_action_1.ComputerAction.CLICK,
46
+ button,
47
+ numClicks,
39
48
  returnScreenshot,
49
+ keys,
40
50
  });
41
51
  }
42
52
  async typeText(session, text, returnScreenshot = false) {
@@ -51,6 +61,12 @@ class ComputerActionService extends base_1.BaseService {
51
61
  action: computer_action_1.ComputerAction.SCREENSHOT,
52
62
  });
53
63
  }
64
+ async cursorPosition(session, returnScreenshot = false) {
65
+ return this.executeRequest(session, {
66
+ action: computer_action_1.ComputerAction.CURSOR_POSITION,
67
+ returnScreenshot,
68
+ });
69
+ }
54
70
  async pressKeys(session, keys, returnScreenshot = false) {
55
71
  return this.executeRequest(session, {
56
72
  action: computer_action_1.ComputerAction.PRESS_KEYS,
@@ -58,10 +74,11 @@ class ComputerActionService extends base_1.BaseService {
58
74
  returnScreenshot,
59
75
  });
60
76
  }
61
- async drag(session, path, returnScreenshot = false) {
77
+ async drag(session, path, returnScreenshot = false, keys) {
62
78
  return this.executeRequest(session, {
63
79
  action: computer_action_1.ComputerAction.DRAG,
64
80
  path,
81
+ keys,
65
82
  returnScreenshot,
66
83
  });
67
84
  }
@@ -73,16 +90,26 @@ class ComputerActionService extends base_1.BaseService {
73
90
  returnScreenshot,
74
91
  });
75
92
  }
76
- async scroll(session, x, y, scrollX, scrollY, returnScreenshot = false) {
93
+ async scroll(session, x, y, scrollX, scrollY, returnScreenshot = false, keys) {
77
94
  return this.executeRequest(session, {
78
95
  action: computer_action_1.ComputerAction.SCROLL,
79
96
  x,
80
97
  y,
81
98
  scrollX,
82
99
  scrollY,
100
+ keys,
83
101
  returnScreenshot,
84
102
  });
85
103
  }
104
+ async scrollAtCursor(session, scrollX = 0, scrollY = 0, returnScreenshot = false, keys) {
105
+ return this.executeRequest(session, {
106
+ action: computer_action_1.ComputerAction.SCROLL,
107
+ scrollX,
108
+ scrollY,
109
+ returnScreenshot,
110
+ keys,
111
+ });
112
+ }
86
113
  async holdKey(session, key, duration, returnScreenshot = false) {
87
114
  return this.executeRequest(session, {
88
115
  action: computer_action_1.ComputerAction.HOLD_KEY,
@@ -10,6 +10,7 @@ export declare enum ComputerAction {
10
10
  PRESS_KEYS = "press_keys",
11
11
  MOVE_MOUSE = "move_mouse",
12
12
  SCREENSHOT = "screenshot",
13
+ CURSOR_POSITION = "cursor_position",
13
14
  SCROLL = "scroll",
14
15
  TYPE_TEXT = "type_text",
15
16
  GET_CLIPBOARD_TEXT = "get_clipboard_text",
@@ -33,6 +34,7 @@ export interface ClickActionParams {
33
34
  y?: number;
34
35
  button?: ComputerActionMouseButton;
35
36
  numClicks?: number;
37
+ keys?: string[];
36
38
  returnScreenshot?: boolean;
37
39
  }
38
40
  /**
@@ -41,6 +43,7 @@ export interface ClickActionParams {
41
43
  export interface DragActionParams {
42
44
  action: ComputerAction.DRAG;
43
45
  path: Coordinate[];
46
+ keys?: string[];
44
47
  returnScreenshot?: boolean;
45
48
  }
46
49
  /**
@@ -66,6 +69,11 @@ export interface MoveMouseActionParams {
66
69
  export interface ScreenshotActionParams {
67
70
  action: ComputerAction.SCREENSHOT;
68
71
  }
72
+ /** Parameters for reading the desktop cursor position. */
73
+ export interface CursorPositionActionParams {
74
+ action: ComputerAction.CURSOR_POSITION;
75
+ returnScreenshot?: boolean;
76
+ }
69
77
  /**
70
78
  * Parameters for scroll action
71
79
  */
@@ -73,10 +81,13 @@ export interface ScrollActionParams {
73
81
  action: ComputerAction.SCROLL;
74
82
  x: number;
75
83
  y: number;
84
+ keys?: string[];
76
85
  scrollX: number;
77
86
  scrollY: number;
78
87
  returnScreenshot?: boolean;
79
88
  }
89
+ /** Parameters for scrolling without moving the desktop cursor. */
90
+ export type ScrollAtCursorActionParams = Omit<ScrollActionParams, "x" | "y">;
80
91
  /**
81
92
  * Parameters for type text action
82
93
  */
@@ -129,7 +140,7 @@ export interface ListWindowsActionParams {
129
140
  /**
130
141
  * Union type for all computer action parameters
131
142
  */
132
- export type ComputerActionParams = ClickActionParams | DragActionParams | PressKeysActionParams | MoveMouseActionParams | ScreenshotActionParams | ScrollActionParams | TypeTextActionParams | HoldKeyActionParams | MouseDownActionParams | MouseUpActionParams | GetClipboardTextActionParams | PutSelectionTextActionParams | ListWindowsActionParams;
143
+ export type ComputerActionParams = ClickActionParams | DragActionParams | PressKeysActionParams | MoveMouseActionParams | ScreenshotActionParams | CursorPositionActionParams | ScrollActionParams | ScrollAtCursorActionParams | TypeTextActionParams | HoldKeyActionParams | MouseDownActionParams | MouseUpActionParams | GetClipboardTextActionParams | PutSelectionTextActionParams | ListWindowsActionParams;
133
144
  export interface ComputerActionResponseDataClipboardText {
134
145
  clipboardText?: string;
135
146
  }
@@ -148,7 +159,12 @@ export interface ComputerActionResponseDataListWindows {
148
159
  activeWindowId: string;
149
160
  windows: ComputerActionWindow[];
150
161
  }
151
- export type ComputerActionResponseData = ComputerActionResponseDataClipboardText | ComputerActionResponseDataListWindows;
162
+ /** Desktop cursor coordinates in physical screen pixels. */
163
+ export interface ComputerActionResponseDataCursorPosition {
164
+ x: number;
165
+ y: number;
166
+ }
167
+ export type ComputerActionResponseData = ComputerActionResponseDataCursorPosition | ComputerActionResponseDataClipboardText | ComputerActionResponseDataListWindows;
152
168
  /**
153
169
  * Response from computer action API
154
170
  */
@@ -14,6 +14,7 @@ var ComputerAction;
14
14
  ComputerAction["PRESS_KEYS"] = "press_keys";
15
15
  ComputerAction["MOVE_MOUSE"] = "move_mouse";
16
16
  ComputerAction["SCREENSHOT"] = "screenshot";
17
+ ComputerAction["CURSOR_POSITION"] = "cursor_position";
17
18
  ComputerAction["SCROLL"] = "scroll";
18
19
  ComputerAction["TYPE_TEXT"] = "type_text";
19
20
  ComputerAction["GET_CLIPBOARD_TEXT"] = "get_clipboard_text";
@@ -19,13 +19,13 @@ export type RecordingStatus = "not_enabled" | "pending" | "in_progress" | "compl
19
19
  export type DownloadsStatus = "not_enabled" | "pending" | "in_progress" | "completed" | "failed";
20
20
  export declare const POLLING_ATTEMPTS = 5;
21
21
  export type BrowserUseVersion = "0.1.40" | "0.7.10" | "latest";
22
- export type BrowserUseLlm = "gpt-4o" | "gpt-4o-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-5" | "gpt-5-mini" | "claude-sonnet-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-4-20250514" | "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-20241022" | "claude-3-5-haiku-20241022" | "gemini-2.0-flash" | "gemini-2.5-flash" | "gemini-3.8-flash";
23
- export type ClaudeComputerUseLlm = "claude-opus-5-5" | "claude-fable-5-1" | "claude-opus-5" | "claude-opus-4-5" | "claude-opus-4-6" | "claude-opus-4-7" | "claude-opus-4-8" | "claude-haiku-4-5-20251001" | "claude-sonnet-5-5" | "claude-sonnet-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-4-20250514" | "claude-3-7-sonnet-20250219";
22
+ export type BrowserUseLlm = "gpt-4o" | "gpt-4o-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-5" | "gpt-5-mini" | "claude-sonnet-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-haiku-5-5" | "claude-sonnet-4-20250514" | "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-20241022" | "claude-3-5-haiku-20241022" | "gemini-2.0-flash" | "gemini-2.5-flash" | "gemini-3.8-flash";
23
+ export type ClaudeComputerUseLlm = "claude-opus-5-5" | "claude-fable-5-1" | "claude-opus-5" | "claude-opus-4-5" | "claude-opus-4-6" | "claude-opus-4-7" | "claude-opus-4-8" | "claude-haiku-5-5" | "claude-haiku-4-5-20251001" | "claude-sonnet-5-5" | "claude-sonnet-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-4-20250514" | "claude-3-7-sonnet-20250219";
24
24
  export type ClaudeComputerUseReasoningEffort = "low" | "medium" | "high" | "xhigh" | "max";
25
25
  export type CuaLlm = "computer-use-preview" | "gpt-6-astra" | "gpt-6.1-sol" | "gpt-6-sol" | "gpt-6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-5.6-luna" | "gpt-5.5" | "gpt-5.4" | "gpt-5.4-mini";
26
26
  export type CuaReasoningEffort = "none" | "low" | "medium" | "high" | "xhigh" | "max";
27
27
  export type HyperAgentVersion = "0.8.0" | "1.1.0";
28
- export type HyperAgentLlm = "gpt-5.6-luna" | "gpt-5.5" | "gpt-5.2" | "gpt-5.1" | "gpt-5" | "gpt-5-mini" | "gpt-4o" | "gpt-4o-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "claude-sonnet-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "gemini-2.5-flash" | "gemini-3.8-flash" | "gemini-3.7-flash" | "gemini-3-flash-preview";
28
+ export type HyperAgentLlm = "gpt-5.6-luna" | "gpt-5.5" | "gpt-5.2" | "gpt-5.1" | "gpt-5" | "gpt-5-mini" | "gpt-4o" | "gpt-4o-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "claude-sonnet-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-haiku-5-5" | "gemini-2.5-flash" | "gemini-3.8-flash" | "gemini-3.7-flash" | "gemini-3-flash-preview";
29
29
  export type GeminiComputerUseLlm = "gemini-3.8-flash" | "gemini-3.7-flash" | "gemini-3.6-flash" | "gemini-3.5-flash" | "gemini-3.5-flash-lite" | "gemini-3-flash-preview" | "gemini-2.5-computer-use-preview-10-2025";
30
30
  export type GrokComputerUseLlm = "grok-4.7" | "grok-4.6" | "grok-4.5";
31
31
  export type GrokReasoningEffort = "low" | "medium" | "high";
@@ -17,7 +17,7 @@ export { CreateProfileParams, ForkProfileParams, ProfileResponse, CreateProfileR
17
17
  export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
18
18
  export { ExtractJobStatus, BrowserUseTaskStatus, BrowserUseLlm, ClaudeComputerUseLlm, ClaudeComputerUseReasoningEffort, CuaLlm, CuaReasoningEffort, GeminiComputerUseLlm, GrokComputerUseLlm, GrokReasoningEffort, MetaComputerUseLlm, MetaReasoningEffort, JevComputerUseLlm, JevTextLlm, ScrapeScreenshotFormat, ScrapeJobStatus, CrawlJobStatus, Country, State, ISO639_1, OperatingSystem, Platform, ScrapeFormat, ScrapeWaitUntil, ScrapePageStatus, CrawlPageStatus, RecordingStatus, DownloadsStatus, HyperAgentLlm, HyperAgentTaskStatus, ClaudeComputerUseTaskStatus, CuaTaskStatus, GeminiComputerUseTaskStatus, GrokComputerUseTaskStatus, MetaComputerUseTaskStatus, JevComputerUseTaskStatus, SessionEventLogType, SessionRegion, BrowserUseVersion, HyperAgentVersion, } from "./constants";
19
19
  export { TeamCreditInfo } from "./team";
20
- export { ComputerAction, Coordinate, ClickActionParams, DragActionParams, PressKeysActionParams, MoveMouseActionParams, ScreenshotActionParams, ScrollActionParams, TypeTextActionParams, ComputerActionParams, ComputerActionResponse, ComputerActionMouseButton, ComputerActionResponseData, HoldKeyActionParams, MouseDownActionParams, MouseUpActionParams, GetClipboardTextActionParams, PutSelectionTextActionParams, ComputerActionResponseDataClipboardText, ListWindowsActionParams, ComputerActionWindow, ComputerActionResponseDataListWindows, } from "./computer-action";
20
+ export { ComputerAction, Coordinate, ClickActionParams, DragActionParams, PressKeysActionParams, MoveMouseActionParams, ScreenshotActionParams, CursorPositionActionParams, ScrollAtCursorActionParams, ScrollActionParams, TypeTextActionParams, ComputerActionParams, ComputerActionResponse, ComputerActionMouseButton, ComputerActionResponseData, HoldKeyActionParams, MouseDownActionParams, MouseUpActionParams, GetClipboardTextActionParams, PutSelectionTextActionParams, ComputerActionResponseDataClipboardText, ListWindowsActionParams, ComputerActionWindow, ComputerActionResponseDataListWindows, ComputerActionResponseDataCursorPosition, } from "./computer-action";
21
21
  export { FetchParams, FetchResponse, FetchResponseData, FetchStatus } from "./web/fetch";
22
22
  export { StartBatchFetchJobParams, GetBatchFetchJobParams, StartBatchFetchJobResponse, BatchFetchJobStatusResponse, BatchFetchJobResponse, BatchFetchJobStatus, } from "./web/batch-fetch";
23
23
  export { WebSearchParams, WebSearchResponse, WebSearchResponseData, WebSearchResultItem, WebSearchFilters, WebSearchLocation, WebSearchFiletype, WebSearchStatus, } from "./web/search";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperbrowser/sdk",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Node SDK for Hyperbrowser API",
5
5
  "author": "",
6
6
  "repository": {