@hyperbrowser/sdk 0.35.0 → 0.37.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 +2 -0
- package/dist/client.js +2 -0
- package/dist/services/agents/cua.d.ts +30 -0
- package/dist/services/agents/cua.js +101 -0
- package/dist/tools/anthropic.d.ts +1 -0
- package/dist/tools/anthropic.js +6 -1
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.js +10 -1
- package/dist/tools/openai.d.ts +1 -0
- package/dist/tools/openai.js +10 -1
- package/dist/tools/schema.d.ts +51 -16
- package/dist/tools/schema.js +45 -23
- package/dist/types/agents/cua.d.ts +49 -0
- package/dist/types/agents/cua.js +2 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { ProfilesService } from "./services/profiles";
|
|
|
6
6
|
import { ExtensionService } from "./services/extensions";
|
|
7
7
|
import { ExtractService } from "./services/extract";
|
|
8
8
|
import { BrowserUseService } from "./services/agents/browser-use";
|
|
9
|
+
import { CuaService } from "./services/agents/cua";
|
|
9
10
|
export declare class HyperbrowserError extends Error {
|
|
10
11
|
statusCode?: number | undefined;
|
|
11
12
|
constructor(message: string, statusCode?: number | undefined);
|
|
@@ -19,6 +20,7 @@ export declare class HyperbrowserClient {
|
|
|
19
20
|
readonly extensions: ExtensionService;
|
|
20
21
|
readonly agents: {
|
|
21
22
|
browserUse: BrowserUseService;
|
|
23
|
+
cua: CuaService;
|
|
22
24
|
};
|
|
23
25
|
constructor(config: HyperbrowserConfig);
|
|
24
26
|
}
|
package/dist/client.js
CHANGED
|
@@ -8,6 +8,7 @@ const profiles_1 = require("./services/profiles");
|
|
|
8
8
|
const extensions_1 = require("./services/extensions");
|
|
9
9
|
const extract_1 = require("./services/extract");
|
|
10
10
|
const browser_use_1 = require("./services/agents/browser-use");
|
|
11
|
+
const cua_1 = require("./services/agents/cua");
|
|
11
12
|
class HyperbrowserError extends Error {
|
|
12
13
|
constructor(message, statusCode) {
|
|
13
14
|
super(`[Hyperbrowser]: ${message}`);
|
|
@@ -32,6 +33,7 @@ class HyperbrowserClient {
|
|
|
32
33
|
this.extensions = new extensions_1.ExtensionService(apiKey, baseUrl, timeout);
|
|
33
34
|
this.agents = {
|
|
34
35
|
browserUse: new browser_use_1.BrowserUseService(apiKey, baseUrl, timeout),
|
|
36
|
+
cua: new cua_1.CuaService(apiKey, baseUrl, timeout),
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BasicResponse } from "../../types";
|
|
2
|
+
import { BaseService } from "../base";
|
|
3
|
+
import { CuaTaskResponse, CuaTaskStatusResponse, StartCuaTaskParams, StartCuaTaskResponse } from "../../types/agents/cua";
|
|
4
|
+
export declare class CuaService extends BaseService {
|
|
5
|
+
/**
|
|
6
|
+
* Start a new CUA task job
|
|
7
|
+
* @param params The parameters for the task job
|
|
8
|
+
*/
|
|
9
|
+
start(params: StartCuaTaskParams): Promise<StartCuaTaskResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* Get the status of a CUA task job
|
|
12
|
+
* @param id The ID of the task job to get
|
|
13
|
+
*/
|
|
14
|
+
getStatus(id: string): Promise<CuaTaskStatusResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Get the result of a CUA task job
|
|
17
|
+
* @param id The ID of the task job to get
|
|
18
|
+
*/
|
|
19
|
+
get(id: string): Promise<CuaTaskResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Stop a CUA task job
|
|
22
|
+
* @param id The ID of the task job to stop
|
|
23
|
+
*/
|
|
24
|
+
stop(id: string): Promise<BasicResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Start a CUA task job and wait for it to complete
|
|
27
|
+
* @param params The parameters for the task job
|
|
28
|
+
*/
|
|
29
|
+
startAndWait(params: StartCuaTaskParams): Promise<CuaTaskResponse>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CuaService = 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 CuaService extends base_1.BaseService {
|
|
9
|
+
/**
|
|
10
|
+
* Start a new CUA task job
|
|
11
|
+
* @param params The parameters for the task job
|
|
12
|
+
*/
|
|
13
|
+
async start(params) {
|
|
14
|
+
try {
|
|
15
|
+
return await this.request("/task/cua", {
|
|
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 CUA task job", undefined);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the status of a CUA 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/cua/${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 CUA task job ${id} status`, undefined);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get the result of a CUA 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/cua/${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 CUA task job ${id}`, undefined);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Stop a CUA 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/cua/${id}/stop`, { method: "PUT" });
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
throw new client_1.HyperbrowserError(`Failed to stop CUA task job ${id}`, undefined);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Start a CUA task job and wait for it to complete
|
|
74
|
+
* @param params The parameters for the task job
|
|
75
|
+
*/
|
|
76
|
+
async startAndWait(params) {
|
|
77
|
+
const job = await this.start(params);
|
|
78
|
+
const jobId = job.jobId;
|
|
79
|
+
if (!jobId) {
|
|
80
|
+
throw new client_1.HyperbrowserError("Failed to start CUA task job, could not get job ID");
|
|
81
|
+
}
|
|
82
|
+
let failures = 0;
|
|
83
|
+
while (true) {
|
|
84
|
+
try {
|
|
85
|
+
const { status } = await this.getStatus(jobId);
|
|
86
|
+
if (status === "completed" || status === "failed" || status === "stopped") {
|
|
87
|
+
return await this.get(jobId);
|
|
88
|
+
}
|
|
89
|
+
failures = 0;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
failures++;
|
|
93
|
+
if (failures >= constants_1.POLLING_ATTEMPTS) {
|
|
94
|
+
throw new client_1.HyperbrowserError(`Failed to poll CUA task job ${jobId} after ${constants_1.POLLING_ATTEMPTS} attempts: ${error}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
await (0, utils_1.sleep)(2000);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.CuaService = CuaService;
|
|
@@ -32,6 +32,7 @@ export interface Tool {
|
|
|
32
32
|
description?: string;
|
|
33
33
|
}
|
|
34
34
|
export declare const SCRAPE_TOOL_ANTHROPIC: Tool;
|
|
35
|
+
export declare const SCREENSHOT_TOOL_ANTHROPIC: Tool;
|
|
35
36
|
export declare const CRAWL_TOOL_ANTHROPIC: Tool;
|
|
36
37
|
export declare const EXTRACT_TOOL_ANTHROPIC: Tool;
|
|
37
38
|
export declare const BROWSER_USE_TOOL_ANTHROPIC: Tool;
|
package/dist/tools/anthropic.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BROWSER_USE_TOOL_ANTHROPIC = exports.EXTRACT_TOOL_ANTHROPIC = exports.CRAWL_TOOL_ANTHROPIC = exports.SCRAPE_TOOL_ANTHROPIC = void 0;
|
|
3
|
+
exports.BROWSER_USE_TOOL_ANTHROPIC = exports.EXTRACT_TOOL_ANTHROPIC = exports.CRAWL_TOOL_ANTHROPIC = exports.SCREENSHOT_TOOL_ANTHROPIC = exports.SCRAPE_TOOL_ANTHROPIC = void 0;
|
|
4
4
|
const schema_1 = require("./schema");
|
|
5
5
|
exports.SCRAPE_TOOL_ANTHROPIC = {
|
|
6
6
|
input_schema: schema_1.SCRAPE_SCHEMA,
|
|
7
7
|
name: "scrape_webpage",
|
|
8
8
|
description: "Scrape content from a webpage and return the content in markdown format",
|
|
9
9
|
};
|
|
10
|
+
exports.SCREENSHOT_TOOL_ANTHROPIC = {
|
|
11
|
+
name: "screenshot_webpage",
|
|
12
|
+
description: "Take a screenshot of a webpage and return the screenshot in screenshot format as a url",
|
|
13
|
+
input_schema: schema_1.SCREENSHOT_SCHEMA,
|
|
14
|
+
};
|
|
10
15
|
exports.CRAWL_TOOL_ANTHROPIC = {
|
|
11
16
|
input_schema: schema_1.CRAWL_SCHEMA,
|
|
12
17
|
name: "crawl_website",
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export declare class WebsiteScrapeTool {
|
|
|
6
6
|
static anthropicToolDefinition: import("./anthropic").Tool;
|
|
7
7
|
static runnable(hb: HyperbrowserClient, params: StartScrapeJobParams): Promise<string>;
|
|
8
8
|
}
|
|
9
|
+
export declare class WebsiteScreenshotTool {
|
|
10
|
+
static openaiToolDefinition: import("./openai").ChatCompletionTool;
|
|
11
|
+
static anthropicToolDefinition: import("./anthropic").Tool;
|
|
12
|
+
static runnable(hb: HyperbrowserClient, params: StartScrapeJobParams): Promise<string>;
|
|
13
|
+
}
|
|
9
14
|
export declare class WebsiteCrawlTool {
|
|
10
15
|
static openaiToolDefinition: import("./openai").ChatCompletionTool;
|
|
11
16
|
static anthropicToolDefinition: import("./anthropic").Tool;
|
package/dist/tools/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BrowserUseTool = exports.WebsiteExtractTool = exports.WebsiteCrawlTool = exports.WebsiteScrapeTool = void 0;
|
|
3
|
+
exports.BrowserUseTool = exports.WebsiteExtractTool = exports.WebsiteCrawlTool = exports.WebsiteScreenshotTool = exports.WebsiteScrapeTool = void 0;
|
|
4
4
|
const openai_1 = require("./openai");
|
|
5
5
|
const anthropic_1 = require("./anthropic");
|
|
6
6
|
class WebsiteScrapeTool {
|
|
@@ -12,6 +12,15 @@ class WebsiteScrapeTool {
|
|
|
12
12
|
exports.WebsiteScrapeTool = WebsiteScrapeTool;
|
|
13
13
|
WebsiteScrapeTool.openaiToolDefinition = openai_1.SCRAPE_TOOL_OPENAI;
|
|
14
14
|
WebsiteScrapeTool.anthropicToolDefinition = anthropic_1.SCRAPE_TOOL_ANTHROPIC;
|
|
15
|
+
class WebsiteScreenshotTool {
|
|
16
|
+
static async runnable(hb, params) {
|
|
17
|
+
const resp = await hb.scrape.startAndWait(params);
|
|
18
|
+
return resp.data?.screenshot || "";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.WebsiteScreenshotTool = WebsiteScreenshotTool;
|
|
22
|
+
WebsiteScreenshotTool.openaiToolDefinition = openai_1.SCREENSHOT_TOOL_OPENAI;
|
|
23
|
+
WebsiteScreenshotTool.anthropicToolDefinition = anthropic_1.SCREENSHOT_TOOL_ANTHROPIC;
|
|
15
24
|
class WebsiteCrawlTool {
|
|
16
25
|
static async runnable(hb, params) {
|
|
17
26
|
const resp = await hb.crawl.startAndWait(params);
|
package/dist/tools/openai.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export interface ChatCompletionTool {
|
|
|
37
37
|
type: "function";
|
|
38
38
|
}
|
|
39
39
|
export declare const SCRAPE_TOOL_OPENAI: ChatCompletionTool;
|
|
40
|
+
export declare const SCREENSHOT_TOOL_OPENAI: ChatCompletionTool;
|
|
40
41
|
export declare const CRAWL_TOOL_OPENAI: ChatCompletionTool;
|
|
41
42
|
export declare const EXTRACT_TOOL_OPENAI: ChatCompletionTool;
|
|
42
43
|
export declare const BROWSER_USE_TOOL_OPENAI: ChatCompletionTool;
|
package/dist/tools/openai.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BROWSER_USE_TOOL_OPENAI = exports.EXTRACT_TOOL_OPENAI = exports.CRAWL_TOOL_OPENAI = exports.SCRAPE_TOOL_OPENAI = void 0;
|
|
3
|
+
exports.BROWSER_USE_TOOL_OPENAI = exports.EXTRACT_TOOL_OPENAI = exports.CRAWL_TOOL_OPENAI = exports.SCREENSHOT_TOOL_OPENAI = exports.SCRAPE_TOOL_OPENAI = void 0;
|
|
4
4
|
const schema_1 = require("./schema");
|
|
5
5
|
exports.SCRAPE_TOOL_OPENAI = {
|
|
6
6
|
type: "function",
|
|
@@ -11,6 +11,15 @@ exports.SCRAPE_TOOL_OPENAI = {
|
|
|
11
11
|
strict: true,
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
|
+
exports.SCREENSHOT_TOOL_OPENAI = {
|
|
15
|
+
type: "function",
|
|
16
|
+
function: {
|
|
17
|
+
name: "screenshot_webpage",
|
|
18
|
+
description: "Take a screenshot of a webpage and return the screenshot in screenshot format as a url",
|
|
19
|
+
parameters: schema_1.SCREENSHOT_SCHEMA,
|
|
20
|
+
strict: true,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
14
23
|
exports.CRAWL_TOOL_OPENAI = {
|
|
15
24
|
type: "function",
|
|
16
25
|
function: {
|
package/dist/tools/schema.d.ts
CHANGED
|
@@ -1,30 +1,49 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
type:
|
|
3
|
-
description: string;
|
|
1
|
+
export declare const SCRAPE_SCHEMA: {
|
|
2
|
+
type: "object";
|
|
4
3
|
properties: {
|
|
5
|
-
|
|
6
|
-
type: string;
|
|
7
|
-
items: {
|
|
8
|
-
type: string;
|
|
9
|
-
};
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
excludeTags: {
|
|
4
|
+
url: {
|
|
13
5
|
type: string;
|
|
14
|
-
items: {
|
|
15
|
-
type: string;
|
|
16
|
-
};
|
|
17
6
|
description: string;
|
|
18
7
|
};
|
|
19
|
-
|
|
8
|
+
scrapeOptions: {
|
|
20
9
|
type: string;
|
|
21
10
|
description: string;
|
|
11
|
+
properties: {
|
|
12
|
+
formats: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
items: {
|
|
16
|
+
type: string;
|
|
17
|
+
enum: ("markdown" | "screenshot")[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
includeTags: {
|
|
21
|
+
type: string;
|
|
22
|
+
items: {
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
excludeTags: {
|
|
28
|
+
type: string;
|
|
29
|
+
items: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
onlyMainContent: {
|
|
35
|
+
type: string;
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
required: string[];
|
|
40
|
+
additionalProperties: boolean;
|
|
22
41
|
};
|
|
23
42
|
};
|
|
24
43
|
required: string[];
|
|
25
44
|
additionalProperties: boolean;
|
|
26
45
|
};
|
|
27
|
-
export declare const
|
|
46
|
+
export declare const SCREENSHOT_SCHEMA: {
|
|
28
47
|
type: "object";
|
|
29
48
|
properties: {
|
|
30
49
|
url: {
|
|
@@ -35,6 +54,14 @@ export declare const SCRAPE_SCHEMA: {
|
|
|
35
54
|
type: string;
|
|
36
55
|
description: string;
|
|
37
56
|
properties: {
|
|
57
|
+
formats: {
|
|
58
|
+
type: string;
|
|
59
|
+
description: string;
|
|
60
|
+
items: {
|
|
61
|
+
type: string;
|
|
62
|
+
enum: ("markdown" | "screenshot")[];
|
|
63
|
+
};
|
|
64
|
+
};
|
|
38
65
|
includeTags: {
|
|
39
66
|
type: string;
|
|
40
67
|
items: {
|
|
@@ -98,6 +125,14 @@ export declare const CRAWL_SCHEMA: {
|
|
|
98
125
|
type: string;
|
|
99
126
|
description: string;
|
|
100
127
|
properties: {
|
|
128
|
+
formats: {
|
|
129
|
+
type: string;
|
|
130
|
+
description: string;
|
|
131
|
+
items: {
|
|
132
|
+
type: string;
|
|
133
|
+
enum: ("markdown" | "screenshot")[];
|
|
134
|
+
};
|
|
135
|
+
};
|
|
101
136
|
includeTags: {
|
|
102
137
|
type: string;
|
|
103
138
|
items: {
|
package/dist/tools/schema.js
CHANGED
|
@@ -1,40 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BROWSER_USE_SCHEMA = exports.EXTRACT_SCHEMA = exports.CRAWL_SCHEMA = exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
exports.BROWSER_USE_SCHEMA = exports.EXTRACT_SCHEMA = exports.CRAWL_SCHEMA = exports.SCREENSHOT_SCHEMA = exports.SCRAPE_SCHEMA = void 0;
|
|
4
|
+
function getScrapeOptions(formats = ["markdown"]) {
|
|
5
|
+
return {
|
|
6
|
+
type: "object",
|
|
7
|
+
description: "The options for the scrape",
|
|
8
|
+
properties: {
|
|
9
|
+
formats: {
|
|
10
|
+
type: "array",
|
|
11
|
+
description: "The format of the content to scrape",
|
|
12
|
+
items: {
|
|
13
|
+
type: "string",
|
|
14
|
+
enum: formats,
|
|
15
|
+
},
|
|
12
16
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
includeTags: {
|
|
18
|
+
type: "array",
|
|
19
|
+
items: {
|
|
20
|
+
type: "string",
|
|
21
|
+
},
|
|
22
|
+
description: "An array of HTML tags, classes, or IDs to include in the scraped content. Only elements matching these selectors will be returned.",
|
|
23
|
+
},
|
|
24
|
+
excludeTags: {
|
|
25
|
+
type: "array",
|
|
26
|
+
items: {
|
|
27
|
+
type: "string",
|
|
28
|
+
},
|
|
29
|
+
description: "An array of HTML tags, classes, or IDs to exclude from the scraped content. Elements matching these selectors will be omitted from the response.",
|
|
30
|
+
},
|
|
31
|
+
onlyMainContent: {
|
|
32
|
+
type: "boolean",
|
|
33
|
+
description: "Whether to only return the main content of the page. If true, only the main content of the page will be returned, excluding any headers, navigation menus,footers, or other non-main content.",
|
|
19
34
|
},
|
|
20
|
-
description: "An array of HTML tags, classes, or IDs to exclude from the scraped content. Elements matching these selectors will be omitted from the response.",
|
|
21
35
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
36
|
+
required: ["includeTags", "excludeTags", "onlyMainContent", "formats"],
|
|
37
|
+
additionalProperties: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
exports.SCRAPE_SCHEMA = {
|
|
41
|
+
type: "object",
|
|
42
|
+
properties: {
|
|
43
|
+
url: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "The URL of the website to scrape",
|
|
25
46
|
},
|
|
47
|
+
scrapeOptions: getScrapeOptions(),
|
|
26
48
|
},
|
|
27
|
-
required: ["
|
|
49
|
+
required: ["url", "scrapeOptions"],
|
|
28
50
|
additionalProperties: false,
|
|
29
51
|
};
|
|
30
|
-
exports.
|
|
52
|
+
exports.SCREENSHOT_SCHEMA = {
|
|
31
53
|
type: "object",
|
|
32
54
|
properties: {
|
|
33
55
|
url: {
|
|
34
56
|
type: "string",
|
|
35
57
|
description: "The URL of the website to scrape",
|
|
36
58
|
},
|
|
37
|
-
scrapeOptions:
|
|
59
|
+
scrapeOptions: getScrapeOptions(["screenshot"]),
|
|
38
60
|
},
|
|
39
61
|
required: ["url", "scrapeOptions"],
|
|
40
62
|
additionalProperties: false,
|
|
@@ -72,7 +94,7 @@ exports.CRAWL_SCHEMA = {
|
|
|
72
94
|
},
|
|
73
95
|
description: "An array of regular expressions or wildcard patterns specifying which URLs should be included in the crawl. Only pages whose URLs' path match one of these path patterns will be visited. Example: ['/admin', '/careers/*']",
|
|
74
96
|
},
|
|
75
|
-
scrapeOptions:
|
|
97
|
+
scrapeOptions: getScrapeOptions(),
|
|
76
98
|
},
|
|
77
99
|
required: [
|
|
78
100
|
"url",
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CuaTaskStatus } from "../constants";
|
|
2
|
+
import { CreateSessionParams } from "../session";
|
|
3
|
+
export interface StartCuaTaskParams {
|
|
4
|
+
task: string;
|
|
5
|
+
sessionId?: string;
|
|
6
|
+
maxFailures?: number;
|
|
7
|
+
maxSteps?: number;
|
|
8
|
+
keepBrowserOpen?: boolean;
|
|
9
|
+
sessionOptions?: CreateSessionParams;
|
|
10
|
+
}
|
|
11
|
+
export interface StartCuaTaskResponse {
|
|
12
|
+
jobId: string;
|
|
13
|
+
liveUrl: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface CuaTaskStatusResponse {
|
|
16
|
+
status: CuaTaskStatus;
|
|
17
|
+
}
|
|
18
|
+
export interface CuaStepResponseError {
|
|
19
|
+
code: string;
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
export interface CuaStepIncompleteDetails {
|
|
23
|
+
reason?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CuaStepReasoning {
|
|
26
|
+
effort: string | null;
|
|
27
|
+
generate_summary?: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface CuaStepResponse {
|
|
30
|
+
created_at: number;
|
|
31
|
+
output_text: string;
|
|
32
|
+
error: CuaStepResponseError | null;
|
|
33
|
+
incomplete_details: CuaStepIncompleteDetails | null;
|
|
34
|
+
model: string;
|
|
35
|
+
output: Array<any>;
|
|
36
|
+
reasoning?: CuaStepReasoning | null;
|
|
37
|
+
status?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface CuaTaskData {
|
|
40
|
+
steps: CuaStepResponse[];
|
|
41
|
+
finalResult: string | null;
|
|
42
|
+
}
|
|
43
|
+
export interface CuaTaskResponse {
|
|
44
|
+
jobId: string;
|
|
45
|
+
status: CuaTaskStatus;
|
|
46
|
+
data?: CuaTaskData | null;
|
|
47
|
+
error?: string | null;
|
|
48
|
+
liveUrl: string | null;
|
|
49
|
+
}
|
|
@@ -3,6 +3,7 @@ export type ScrapeJobStatus = "pending" | "running" | "completed" | "failed";
|
|
|
3
3
|
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
|
+
export type CuaTaskStatus = "pending" | "running" | "completed" | "failed" | "stopped";
|
|
6
7
|
export type ScrapePageStatus = "completed" | "failed" | "pending" | "running";
|
|
7
8
|
export type CrawlPageStatus = "completed" | "failed";
|
|
8
9
|
export type ScrapeWaitUntil = "load" | "domcontentloaded" | "networkidle";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { StartCrawlJobParams, StartCrawlJobResponse, CrawledPage, CrawlJobRespon
|
|
|
3
3
|
export { StartScrapeJobParams, StartScrapeJobResponse, ScrapeJobData, ScrapeJobResponse, ScrapeOptions, ScrapeJobStatusResponse, BatchScrapeJobStatusResponse, } from "./scrape";
|
|
4
4
|
export { StartExtractJobParams, StartExtractJobResponse, ExtractJobResponse, ExtractJobStatusResponse, } from "./extract";
|
|
5
5
|
export { StartBrowserUseTaskParams, StartBrowserUseTaskResponse, BrowserUseTaskStatusResponse, BrowserUseTaskResponse, BrowserUseTaskData, } from "./agents/browser-use";
|
|
6
|
+
export { StartCuaTaskParams, StartCuaTaskResponse, CuaTaskStatusResponse, CuaTaskResponse, CuaTaskData, CuaStepResponse, } from "./agents/cua";
|
|
6
7
|
export { BasicResponse, SessionStatus, Session, SessionDetail, SessionListParams, SessionListResponse, ScreenConfig, CreateSessionParams, } from "./session";
|
|
7
8
|
export { ProfileResponse, CreateProfileResponse, ProfileListParams, ProfileListResponse, } from "./profile";
|
|
8
9
|
export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
|