@hyperbrowser/sdk 0.68.0 → 0.69.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.
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { SessionDetail } from "../types";
|
|
2
|
-
import { ComputerActionResponse, Coordinate } from "../types/computer-action";
|
|
2
|
+
import { ComputerActionResponse, Coordinate, ComputerActionMouseButton } from "../types/computer-action";
|
|
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?:
|
|
6
|
+
click(session: SessionDetail | string, x: number, y: number, button?: ComputerActionMouseButton, numClicks?: number, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
|
|
7
7
|
typeText(session: SessionDetail | string, text: string, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
|
|
8
8
|
screenshot(session: SessionDetail | string): Promise<ComputerActionResponse>;
|
|
9
9
|
pressKeys(session: SessionDetail | string, keys: string[], returnScreenshot?: boolean): Promise<ComputerActionResponse>;
|
|
10
10
|
drag(session: SessionDetail | string, path: Coordinate[], returnScreenshot?: boolean): Promise<ComputerActionResponse>;
|
|
11
11
|
moveMouse(session: SessionDetail | string, x: number, y: number, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
|
|
12
12
|
scroll(session: SessionDetail | string, x: number, y: number, scrollX: number, scrollY: number, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
|
|
13
|
+
holdKey(session: SessionDetail | string, key: string, duration: number, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
|
|
14
|
+
mouseDown(session: SessionDetail | string, button?: ComputerActionMouseButton, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
|
|
15
|
+
mouseUp(session: SessionDetail | string, button?: ComputerActionMouseButton, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
|
|
16
|
+
getClipboardText(session: SessionDetail | string, returnScreenshot?: boolean): Promise<ComputerActionResponse>;
|
|
13
17
|
}
|
|
@@ -83,5 +83,33 @@ class ComputerActionService extends base_1.BaseService {
|
|
|
83
83
|
returnScreenshot,
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
+
async holdKey(session, key, duration, returnScreenshot = false) {
|
|
87
|
+
return this.executeRequest(session, {
|
|
88
|
+
action: computer_action_1.ComputerAction.HOLD_KEY,
|
|
89
|
+
key,
|
|
90
|
+
duration,
|
|
91
|
+
returnScreenshot,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
async mouseDown(session, button = "left", returnScreenshot = false) {
|
|
95
|
+
return this.executeRequest(session, {
|
|
96
|
+
action: computer_action_1.ComputerAction.MOUSE_DOWN,
|
|
97
|
+
button,
|
|
98
|
+
returnScreenshot,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
async mouseUp(session, button = "left", returnScreenshot = false) {
|
|
102
|
+
return this.executeRequest(session, {
|
|
103
|
+
action: computer_action_1.ComputerAction.MOUSE_UP,
|
|
104
|
+
button,
|
|
105
|
+
returnScreenshot,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async getClipboardText(session, returnScreenshot = false) {
|
|
109
|
+
return this.executeRequest(session, {
|
|
110
|
+
action: computer_action_1.ComputerAction.GET_CLIPBOARD_TEXT,
|
|
111
|
+
returnScreenshot,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
86
114
|
}
|
|
87
115
|
exports.ComputerActionService = ComputerActionService;
|
|
@@ -4,12 +4,17 @@
|
|
|
4
4
|
export declare enum ComputerAction {
|
|
5
5
|
CLICK = "click",
|
|
6
6
|
DRAG = "drag",
|
|
7
|
+
HOLD_KEY = "hold_key",
|
|
8
|
+
MOUSE_DOWN = "mouse_down",
|
|
9
|
+
MOUSE_UP = "mouse_up",
|
|
7
10
|
PRESS_KEYS = "press_keys",
|
|
8
11
|
MOVE_MOUSE = "move_mouse",
|
|
9
12
|
SCREENSHOT = "screenshot",
|
|
10
13
|
SCROLL = "scroll",
|
|
11
|
-
TYPE_TEXT = "type_text"
|
|
14
|
+
TYPE_TEXT = "type_text",
|
|
15
|
+
GET_CLIPBOARD_TEXT = "get_clipboard_text"
|
|
12
16
|
}
|
|
17
|
+
export type ComputerActionMouseButton = "left" | "right" | "middle" | "back" | "forward" | "wheel";
|
|
13
18
|
/**
|
|
14
19
|
* Coordinate model for drag actions
|
|
15
20
|
*/
|
|
@@ -22,9 +27,9 @@ export interface Coordinate {
|
|
|
22
27
|
*/
|
|
23
28
|
export interface ClickActionParams {
|
|
24
29
|
action: ComputerAction.CLICK;
|
|
25
|
-
x
|
|
26
|
-
y
|
|
27
|
-
button?:
|
|
30
|
+
x?: number;
|
|
31
|
+
y?: number;
|
|
32
|
+
button?: ComputerActionMouseButton;
|
|
28
33
|
numClicks?: number;
|
|
29
34
|
returnScreenshot?: boolean;
|
|
30
35
|
}
|
|
@@ -78,16 +83,50 @@ export interface TypeTextActionParams {
|
|
|
78
83
|
text: string;
|
|
79
84
|
returnScreenshot?: boolean;
|
|
80
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Parameters for hold key action
|
|
88
|
+
*/
|
|
89
|
+
export interface HoldKeyActionParams {
|
|
90
|
+
action: ComputerAction.HOLD_KEY;
|
|
91
|
+
key: string;
|
|
92
|
+
duration: number;
|
|
93
|
+
returnScreenshot?: boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Parameters for mouse down action
|
|
97
|
+
*/
|
|
98
|
+
export interface MouseDownActionParams {
|
|
99
|
+
action: ComputerAction.MOUSE_DOWN;
|
|
100
|
+
button?: ComputerActionMouseButton;
|
|
101
|
+
returnScreenshot?: boolean;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Parameters for mouse up action
|
|
105
|
+
*/
|
|
106
|
+
export interface MouseUpActionParams {
|
|
107
|
+
action: ComputerAction.MOUSE_UP;
|
|
108
|
+
button?: ComputerActionMouseButton;
|
|
109
|
+
returnScreenshot?: boolean;
|
|
110
|
+
}
|
|
111
|
+
export interface GetClipboardTextActionParams {
|
|
112
|
+
action: ComputerAction.GET_CLIPBOARD_TEXT;
|
|
113
|
+
returnScreenshot?: boolean;
|
|
114
|
+
}
|
|
81
115
|
/**
|
|
82
116
|
* Union type for all computer action parameters
|
|
83
117
|
*/
|
|
84
|
-
export type ComputerActionParams = ClickActionParams | DragActionParams | PressKeysActionParams | MoveMouseActionParams | ScreenshotActionParams | ScrollActionParams | TypeTextActionParams;
|
|
118
|
+
export type ComputerActionParams = ClickActionParams | DragActionParams | PressKeysActionParams | MoveMouseActionParams | ScreenshotActionParams | ScrollActionParams | TypeTextActionParams | HoldKeyActionParams | MouseDownActionParams | MouseUpActionParams | GetClipboardTextActionParams;
|
|
119
|
+
export interface ComputerActionResponseDataClipboardText {
|
|
120
|
+
clipboardText?: string;
|
|
121
|
+
}
|
|
122
|
+
export type ComputerActionResponseData = ComputerActionResponseDataClipboardText;
|
|
85
123
|
/**
|
|
86
124
|
* Response from computer action API
|
|
87
125
|
*/
|
|
88
126
|
export interface ComputerActionResponse {
|
|
89
127
|
success: boolean;
|
|
90
128
|
screenshot?: string;
|
|
129
|
+
data?: ComputerActionResponseData;
|
|
91
130
|
error?: string;
|
|
92
131
|
message?: string;
|
|
93
132
|
}
|
|
@@ -8,9 +8,13 @@ var ComputerAction;
|
|
|
8
8
|
(function (ComputerAction) {
|
|
9
9
|
ComputerAction["CLICK"] = "click";
|
|
10
10
|
ComputerAction["DRAG"] = "drag";
|
|
11
|
+
ComputerAction["HOLD_KEY"] = "hold_key";
|
|
12
|
+
ComputerAction["MOUSE_DOWN"] = "mouse_down";
|
|
13
|
+
ComputerAction["MOUSE_UP"] = "mouse_up";
|
|
11
14
|
ComputerAction["PRESS_KEYS"] = "press_keys";
|
|
12
15
|
ComputerAction["MOVE_MOUSE"] = "move_mouse";
|
|
13
16
|
ComputerAction["SCREENSHOT"] = "screenshot";
|
|
14
17
|
ComputerAction["SCROLL"] = "scroll";
|
|
15
18
|
ComputerAction["TYPE_TEXT"] = "type_text";
|
|
19
|
+
ComputerAction["GET_CLIPBOARD_TEXT"] = "get_clipboard_text";
|
|
16
20
|
})(ComputerAction || (exports.ComputerAction = ComputerAction = {}));
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export { CreateProfileParams, ProfileResponse, CreateProfileResponse, ProfileLis
|
|
|
12
12
|
export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
|
|
13
13
|
export { ExtractJobStatus, BrowserUseTaskStatus, BrowserUseLlm, ClaudeComputerUseLlm, GeminiComputerUseLlm, ScrapeScreenshotFormat, ScrapeJobStatus, CrawlJobStatus, Country, State, ISO639_1, OperatingSystem, Platform, ScrapeFormat, ScrapeWaitUntil, ScrapePageStatus, CrawlPageStatus, RecordingStatus, DownloadsStatus, HyperAgentLlm, HyperAgentTaskStatus, ClaudeComputerUseTaskStatus, CuaTaskStatus, GeminiComputerUseTaskStatus, SessionEventLogType, SessionRegion, } from "./constants";
|
|
14
14
|
export { TeamCreditInfo } from "./team";
|
|
15
|
-
export { ComputerAction, Coordinate, ClickActionParams, DragActionParams, PressKeysActionParams, MoveMouseActionParams, ScreenshotActionParams, ScrollActionParams, TypeTextActionParams, ComputerActionParams, ComputerActionResponse, } from "./computer-action";
|
|
15
|
+
export { ComputerAction, Coordinate, ClickActionParams, DragActionParams, PressKeysActionParams, MoveMouseActionParams, ScreenshotActionParams, ScrollActionParams, TypeTextActionParams, ComputerActionParams, ComputerActionResponse, ComputerActionMouseButton, ComputerActionResponseData, HoldKeyActionParams, MouseDownActionParams, MouseUpActionParams, GetClipboardTextActionParams, ComputerActionResponseDataClipboardText, } from "./computer-action";
|