@hyperbrowser/sdk 0.45.0 → 0.47.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.
package/dist/client.d.ts CHANGED
@@ -8,6 +8,7 @@ import { ExtractService } from "./services/extract";
8
8
  import { BrowserUseService } from "./services/agents/browser-use";
9
9
  import { CuaService } from "./services/agents/cua";
10
10
  import { ClaudeComputerUseService } from "./services/agents/claude-computer-use";
11
+ import { HyperAgentService } from "./services/agents/hyper-agent";
11
12
  export declare class HyperbrowserError extends Error {
12
13
  statusCode?: number | undefined;
13
14
  constructor(message: string, statusCode?: number | undefined);
@@ -23,6 +24,7 @@ export declare class HyperbrowserClient {
23
24
  browserUse: BrowserUseService;
24
25
  claudeComputerUse: ClaudeComputerUseService;
25
26
  cua: CuaService;
27
+ hyperAgent: HyperAgentService;
26
28
  };
27
29
  constructor(config?: HyperbrowserConfig);
28
30
  }
package/dist/client.js CHANGED
@@ -10,6 +10,7 @@ const extract_1 = require("./services/extract");
10
10
  const browser_use_1 = require("./services/agents/browser-use");
11
11
  const cua_1 = require("./services/agents/cua");
12
12
  const claude_computer_use_1 = require("./services/agents/claude-computer-use");
13
+ const hyper_agent_1 = require("./services/agents/hyper-agent");
13
14
  class HyperbrowserError extends Error {
14
15
  constructor(message, statusCode) {
15
16
  super(`[Hyperbrowser]: ${message}`);
@@ -36,6 +37,7 @@ class HyperbrowserClient {
36
37
  browserUse: new browser_use_1.BrowserUseService(apiKey, baseUrl, timeout),
37
38
  claudeComputerUse: new claude_computer_use_1.ClaudeComputerUseService(apiKey, baseUrl, timeout),
38
39
  cua: new cua_1.CuaService(apiKey, baseUrl, timeout),
40
+ hyperAgent: new hyper_agent_1.HyperAgentService(apiKey, baseUrl, timeout),
39
41
  };
40
42
  }
41
43
  }
@@ -0,0 +1,30 @@
1
+ import { BasicResponse } from "../../types";
2
+ import { BaseService } from "../base";
3
+ import { HyperAgentTaskResponse, HyperAgentTaskStatusResponse, StartHyperAgentTaskParams, StartHyperAgentTaskResponse } from "../../types/agents/hyper-agent";
4
+ export declare class HyperAgentService extends BaseService {
5
+ /**
6
+ * Start a new HyperAgent task job
7
+ * @param params The parameters for the task job
8
+ */
9
+ start(params: StartHyperAgentTaskParams): Promise<StartHyperAgentTaskResponse>;
10
+ /**
11
+ * Get the status of a HyperAgent task job
12
+ * @param id The ID of the task job to get
13
+ */
14
+ getStatus(id: string): Promise<HyperAgentTaskStatusResponse>;
15
+ /**
16
+ * Get the result of a HyperAgent task job
17
+ * @param id The ID of the task job to get
18
+ */
19
+ get(id: string): Promise<HyperAgentTaskResponse>;
20
+ /**
21
+ * Stop a HyperAgent task job
22
+ * @param id The ID of the task job to stop
23
+ */
24
+ stop(id: string): Promise<BasicResponse>;
25
+ /**
26
+ * Start a HyperAgent task job and wait for it to complete
27
+ * @param params The parameters for the task job
28
+ */
29
+ startAndWait(params: StartHyperAgentTaskParams): Promise<HyperAgentTaskResponse>;
30
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HyperAgentService = void 0;
4
+ const client_1 = require("../../client");
5
+ const constants_1 = require("../../types/constants");
6
+ const utils_1 = require("../../utils");
7
+ const base_1 = require("../base");
8
+ class HyperAgentService extends base_1.BaseService {
9
+ /**
10
+ * Start a new HyperAgent task job
11
+ * @param params The parameters for the task job
12
+ */
13
+ async start(params) {
14
+ try {
15
+ return await this.request("/task/hyper-agent", {
16
+ method: "POST",
17
+ body: JSON.stringify(params),
18
+ });
19
+ }
20
+ catch (error) {
21
+ if (error instanceof client_1.HyperbrowserError) {
22
+ throw error;
23
+ }
24
+ throw new client_1.HyperbrowserError("Failed to start HyperAgent task job", undefined);
25
+ }
26
+ }
27
+ /**
28
+ * Get the status of a HyperAgent task job
29
+ * @param id The ID of the task job to get
30
+ */
31
+ async getStatus(id) {
32
+ try {
33
+ return await this.request(`/task/hyper-agent/${id}/status`);
34
+ }
35
+ catch (error) {
36
+ if (error instanceof client_1.HyperbrowserError) {
37
+ throw error;
38
+ }
39
+ throw new client_1.HyperbrowserError(`Failed to get HyperAgent task job ${id} status`, undefined);
40
+ }
41
+ }
42
+ /**
43
+ * Get the result of a HyperAgent task job
44
+ * @param id The ID of the task job to get
45
+ */
46
+ async get(id) {
47
+ try {
48
+ return await this.request(`/task/hyper-agent/${id}`);
49
+ }
50
+ catch (error) {
51
+ if (error instanceof client_1.HyperbrowserError) {
52
+ throw error;
53
+ }
54
+ throw new client_1.HyperbrowserError(`Failed to get HyperAgent task job ${id}`, undefined);
55
+ }
56
+ }
57
+ /**
58
+ * Stop a HyperAgent task job
59
+ * @param id The ID of the task job to stop
60
+ */
61
+ async stop(id) {
62
+ try {
63
+ return await this.request(`/task/hyper-agent/${id}/stop`, {
64
+ method: "PUT",
65
+ });
66
+ }
67
+ catch (error) {
68
+ if (error instanceof client_1.HyperbrowserError) {
69
+ throw error;
70
+ }
71
+ throw new client_1.HyperbrowserError(`Failed to stop HyperAgent task job ${id}`, undefined);
72
+ }
73
+ }
74
+ /**
75
+ * Start a HyperAgent task job and wait for it to complete
76
+ * @param params The parameters for the task job
77
+ */
78
+ async startAndWait(params) {
79
+ const job = await this.start(params);
80
+ const jobId = job.jobId;
81
+ if (!jobId) {
82
+ throw new client_1.HyperbrowserError("Failed to start HyperAgent task job, could not get job ID");
83
+ }
84
+ let failures = 0;
85
+ while (true) {
86
+ try {
87
+ const { status } = await this.getStatus(jobId);
88
+ if (status === "completed" || status === "failed" || status === "stopped") {
89
+ return await this.get(jobId);
90
+ }
91
+ failures = 0;
92
+ }
93
+ catch (error) {
94
+ failures++;
95
+ if (failures >= constants_1.POLLING_ATTEMPTS) {
96
+ throw new client_1.HyperbrowserError(`Failed to poll HyperAgent task job ${jobId} after ${constants_1.POLLING_ATTEMPTS} attempts: ${error}`);
97
+ }
98
+ }
99
+ await (0, utils_1.sleep)(2000);
100
+ }
101
+ }
102
+ }
103
+ exports.HyperAgentService = HyperAgentService;
@@ -13,6 +13,8 @@ export interface StartBrowserUseTaskParams {
13
13
  pageExtractionLlm?: BrowserUseLlm;
14
14
  plannerInterval?: number;
15
15
  maxSteps?: number;
16
+ maxFailures?: number;
17
+ initialActions?: Array<Record<string, Record<string, any>>>;
16
18
  keepBrowserOpen?: boolean;
17
19
  sessionOptions?: CreateSessionParams;
18
20
  }
@@ -0,0 +1,46 @@
1
+ import { HyperAgentLlm, HyperAgentTaskStatus } from "../constants";
2
+ import { CreateSessionParams } from "../session";
3
+ export interface StartHyperAgentTaskParams {
4
+ task: string;
5
+ llm?: HyperAgentLlm;
6
+ sessionId?: string;
7
+ maxSteps?: number;
8
+ keepBrowserOpen?: boolean;
9
+ sessionOptions?: CreateSessionParams;
10
+ }
11
+ export interface StartHyperAgentTaskResponse {
12
+ jobId: string;
13
+ liveUrl: string | null;
14
+ }
15
+ export interface HyperAgentTaskStatusResponse {
16
+ status: HyperAgentTaskStatus;
17
+ }
18
+ export interface HyperAgentActionOutput {
19
+ success: boolean;
20
+ message: string;
21
+ extract?: object;
22
+ }
23
+ export interface HyperAgentOutput {
24
+ thoughts: string;
25
+ memory: string;
26
+ nextGoal: string;
27
+ actions: {
28
+ [x: string]: any;
29
+ }[];
30
+ }
31
+ export interface HyperAgentStep {
32
+ idx: number;
33
+ agentOutput: HyperAgentOutput;
34
+ actionOutputs: HyperAgentActionOutput[];
35
+ }
36
+ export interface HyperAgentTaskData {
37
+ steps: HyperAgentStep[];
38
+ finalResult: string | null;
39
+ }
40
+ export interface HyperAgentTaskResponse {
41
+ jobId: string;
42
+ status: HyperAgentTaskStatus;
43
+ data?: HyperAgentTaskData | null;
44
+ error?: string | null;
45
+ liveUrl: string | null;
46
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,6 +4,7 @@ export type ExtractJobStatus = "pending" | "running" | "completed" | "failed";
4
4
  export type CrawlJobStatus = "pending" | "running" | "completed" | "failed";
5
5
  export type BrowserUseTaskStatus = "pending" | "running" | "completed" | "failed" | "stopped";
6
6
  export type CuaTaskStatus = "pending" | "running" | "completed" | "failed" | "stopped";
7
+ export type HyperAgentTaskStatus = "pending" | "running" | "completed" | "failed" | "stopped";
7
8
  export type ClaudeComputerUseTaskStatus = "pending" | "running" | "completed" | "failed" | "stopped";
8
9
  export type ScrapePageStatus = "completed" | "failed" | "pending" | "running";
9
10
  export type CrawlPageStatus = "completed" | "failed";
@@ -13,6 +14,7 @@ export type RecordingStatus = "not_enabled" | "pending" | "in_progress" | "compl
13
14
  export type DownloadsStatus = "not_enabled" | "pending" | "in_progress" | "completed" | "failed";
14
15
  export declare const POLLING_ATTEMPTS = 5;
15
16
  export type BrowserUseLlm = "gpt-4o" | "gpt-4o-mini" | "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-20241022" | "claude-3-5-haiku-20241022" | "gemini-2.0-flash";
17
+ export type HyperAgentLlm = "gpt-4o" | "gpt-4o-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano";
16
18
  export type Country = "AD" | "AE" | "AF" | "AL" | "AM" | "AO" | "AR" | "AT" | "AU" | "AW" | "AZ" | "BA" | "BD" | "BE" | "BG" | "BH" | "BJ" | "BO" | "BR" | "BS" | "BT" | "BY" | "BZ" | "CA" | "CF" | "CH" | "CI" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "EC" | "EE" | "EG" | "ES" | "ET" | "EU" | "FI" | "FJ" | "FR" | "GB" | "GE" | "GH" | "GM" | "GR" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IN" | "IQ" | "IR" | "IS" | "IT" | "JM" | "JO" | "JP" | "KE" | "KH" | "KR" | "KW" | "KZ" | "LB" | "LI" | "LR" | "LT" | "LU" | "LV" | "MA" | "MC" | "MD" | "ME" | "MG" | "MK" | "ML" | "MM" | "MN" | "MR" | "MT" | "MU" | "MV" | "MX" | "MY" | "MZ" | "NG" | "NL" | "NO" | "NZ" | "OM" | "PA" | "PE" | "PH" | "PK" | "PL" | "PR" | "PT" | "PY" | "QA" | "RANDOM_COUNTRY" | "RO" | "RS" | "RU" | "SA" | "SC" | "SD" | "SE" | "SG" | "SI" | "SK" | "SN" | "SS" | "TD" | "TG" | "TH" | "TM" | "TN" | "TR" | "TT" | "TW" | "UA" | "UG" | "US" | "UY" | "UZ" | "VE" | "VG" | "VN" | "YE" | "ZA" | "ZM" | "ZW" | "ad" | "ae" | "af" | "al" | "am" | "ao" | "ar" | "at" | "au" | "aw" | "az" | "ba" | "bd" | "be" | "bg" | "bh" | "bj" | "bo" | "br" | "bs" | "bt" | "by" | "bz" | "ca" | "cf" | "ch" | "ci" | "cl" | "cm" | "cn" | "co" | "cr" | "cu" | "cy" | "cz" | "de" | "dj" | "dk" | "dm" | "ec" | "ee" | "eg" | "es" | "et" | "eu" | "fi" | "fj" | "fr" | "gb" | "ge" | "gh" | "gm" | "gr" | "hk" | "hn" | "hr" | "ht" | "hu" | "id" | "ie" | "il" | "in" | "iq" | "ir" | "is" | "it" | "jm" | "jo" | "jp" | "ke" | "kh" | "kr" | "kw" | "kz" | "lb" | "li" | "lr" | "lt" | "lu" | "lv" | "ma" | "mc" | "md" | "me" | "mg" | "mk" | "ml" | "mm" | "mn" | "mr" | "mt" | "mu" | "mv" | "mx" | "my" | "mz" | "ng" | "nl" | "no" | "nz" | "om" | "pa" | "pe" | "ph" | "pk" | "pl" | "pr" | "pt" | "py" | "qa" | "ro" | "rs" | "ru" | "sa" | "sc" | "sd" | "se" | "sg" | "si" | "sk" | "sn" | "ss" | "td" | "tg" | "th" | "tm" | "tn" | "tr" | "tt" | "tw" | "ua" | "ug" | "us" | "uy" | "uz" | "ve" | "vg" | "vn" | "ye" | "za" | "zm" | "zw";
17
19
  export type OperatingSystem = "windows" | "android" | "macos" | "linux" | "ios";
18
20
  export type Platform = "chrome" | "firefox" | "safari" | "edge";
@@ -5,7 +5,8 @@ export { StartExtractJobParams, StartExtractJobResponse, ExtractJobResponse, Ext
5
5
  export { StartBrowserUseTaskParams, StartBrowserUseTaskResponse, BrowserUseTaskStatusResponse, BrowserUseTaskResponse, BrowserUseTaskData, } from "./agents/browser-use";
6
6
  export { StartClaudeComputerUseTaskParams, StartClaudeComputerUseTaskResponse, ClaudeComputerUseTaskStatusResponse, ClaudeComputerUseTaskResponse, ClaudeComputerUseTaskData, ClaudeComputerUseStepResponse, } from "./agents/claude-computer-use";
7
7
  export { StartCuaTaskParams, StartCuaTaskResponse, CuaTaskStatusResponse, CuaTaskResponse, CuaTaskData, CuaStepResponse, } from "./agents/cua";
8
+ export { StartHyperAgentTaskParams, StartHyperAgentTaskResponse, HyperAgentTaskStatusResponse, HyperAgentTaskResponse, HyperAgentTaskData, HyperAgentStep, HyperAgentOutput, HyperAgentActionOutput, } from "./agents/hyper-agent";
8
9
  export { BasicResponse, SessionStatus, Session, SessionDetail, SessionListParams, SessionListResponse, ScreenConfig, CreateSessionParams, GetSessionDownloadsUrlResponse, GetSessionRecordingUrlResponse, ImageCaptchaParam, } from "./session";
9
10
  export { CreateProfileParams, ProfileResponse, CreateProfileResponse, ProfileListParams, ProfileListResponse, } from "./profile";
10
11
  export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
11
- export { ExtractJobStatus, BrowserUseTaskStatus, BrowserUseLlm, ScrapeScreenshotFormat, ScrapeJobStatus, CrawlJobStatus, Country, State, ISO639_1, OperatingSystem, Platform, ScrapeFormat, ScrapeWaitUntil, ScrapePageStatus, CrawlPageStatus, RecordingStatus, DownloadsStatus, } from "./constants";
12
+ export { ExtractJobStatus, BrowserUseTaskStatus, BrowserUseLlm, ScrapeScreenshotFormat, ScrapeJobStatus, CrawlJobStatus, Country, State, ISO639_1, OperatingSystem, Platform, ScrapeFormat, ScrapeWaitUntil, ScrapePageStatus, CrawlPageStatus, RecordingStatus, DownloadsStatus, HyperAgentLlm, HyperAgentTaskStatus, ClaudeComputerUseTaskStatus, CuaTaskStatus, } from "./constants";
@@ -68,6 +68,7 @@ export interface CreateSessionParams {
68
68
  browserArgs?: string[];
69
69
  saveDownloads?: boolean;
70
70
  imageCaptchaParams?: Array<ImageCaptchaParam>;
71
+ timeoutMinutes?: number;
71
72
  }
72
73
  export interface SessionRecording {
73
74
  type: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperbrowser/sdk",
3
- "version": "0.45.0",
3
+ "version": "0.47.0",
4
4
  "description": "Node SDK for Hyperbrowser API",
5
5
  "author": "",
6
6
  "main": "dist/index.js",