@hyperbrowser/sdk 0.91.8 → 0.92.1
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/services/sandboxes.d.ts +15 -2
- package/dist/services/sandboxes.js +155 -15
- package/dist/services/volumes.d.ts +2 -2
- package/dist/services/volumes.js +6 -2
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/sandbox.d.ts +109 -2
- package/dist/types/session.d.ts +1 -1
- package/dist/types/volume.d.ts +8 -0
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@ import { SandboxFilesApi } from "../sandbox/files";
|
|
|
2
2
|
import { SandboxProcessHandle, SandboxProcessesApi } from "../sandbox/process";
|
|
3
3
|
import { SandboxTerminalApi } from "../sandbox/terminal";
|
|
4
4
|
import { BasicResponse } from "../types/session";
|
|
5
|
-
import { CreateSandboxParams, SandboxDetail, SandboxExposeParams, SandboxExposeResult, SandboxExecParams, SandboxExecOptions, SandboxImageListResponse, SandboxListParams, SandboxListResponse, SandboxMemorySnapshotParams, SandboxMemorySnapshotResult, SandboxProcessResult, SandboxSnapshotListParams, SandboxSnapshotListResponse, SandboxUnexposeResult } from "../types/sandbox";
|
|
5
|
+
import { CompleteSandboxImageBuildParams, CreateSandboxImageBuildParams, CreateSandboxParams, SandboxDetail, SandboxExposeParams, SandboxExposeResult, SandboxExecParams, SandboxExecOptions, SandboxImageBuild, SandboxImageBuildCreateResult, SandboxImageBuildListParams, SandboxImageBuildListResponse, SandboxImageListParams, SandboxImageListResponse, SandboxListParams, SandboxListResponse, SandboxMemorySnapshotParams, SandboxMemorySnapshotResult, SandboxNetworkPolicyPatch, SandboxNetworkUpdateResult, SandboxProcessResult, SandboxImageDeleteResult, SandboxSnapshotDeleteResult, SandboxSnapshotListParams, SandboxSnapshotListResponse, SandboxSnapshotSummary, SandboxUnexposeResult } from "../types/sandbox";
|
|
6
6
|
import { BaseService } from "./base";
|
|
7
7
|
export declare class SandboxHandle {
|
|
8
8
|
private readonly service;
|
|
@@ -23,6 +23,7 @@ export declare class SandboxHandle {
|
|
|
23
23
|
get cpu(): number | null | undefined;
|
|
24
24
|
get memoryMiB(): number | null | undefined;
|
|
25
25
|
get diskMiB(): number | null | undefined;
|
|
26
|
+
get timeoutMinutes(): number | null | undefined;
|
|
26
27
|
get exposedPorts(): SandboxExposeResult[];
|
|
27
28
|
toJSON(): SandboxDetail;
|
|
28
29
|
info(): Promise<SandboxDetail>;
|
|
@@ -33,6 +34,9 @@ export declare class SandboxHandle {
|
|
|
33
34
|
expose(params: SandboxExposeParams): Promise<SandboxExposeResult>;
|
|
34
35
|
unexpose(port: number): Promise<SandboxUnexposeResult>;
|
|
35
36
|
getExposedUrl(port: number): string;
|
|
37
|
+
get network(): SandboxDetail["network"];
|
|
38
|
+
updateNetwork(policy: SandboxNetworkPolicyPatch): Promise<SandboxNetworkUpdateResult>;
|
|
39
|
+
clearNetwork(): Promise<SandboxNetworkUpdateResult>;
|
|
36
40
|
exec(input: string, options?: SandboxExecOptions): Promise<SandboxProcessResult>;
|
|
37
41
|
exec(input: SandboxExecParams): Promise<SandboxProcessResult>;
|
|
38
42
|
getProcess(processId: string): Promise<SandboxProcessHandle>;
|
|
@@ -54,13 +58,22 @@ export declare class SandboxesService extends BaseService {
|
|
|
54
58
|
get(id: string): Promise<SandboxHandle>;
|
|
55
59
|
connect(id: string): Promise<SandboxHandle>;
|
|
56
60
|
list(params?: SandboxListParams): Promise<SandboxListResponse>;
|
|
57
|
-
|
|
61
|
+
deleteImage(image: string): Promise<SandboxImageDeleteResult>;
|
|
62
|
+
listImages(params?: SandboxImageListParams): Promise<SandboxImageListResponse>;
|
|
58
63
|
listSnapshots(params?: SandboxSnapshotListParams): Promise<SandboxSnapshotListResponse>;
|
|
59
64
|
stop(id: string): Promise<BasicResponse>;
|
|
60
65
|
getDetail(id: string): Promise<SandboxDetail>;
|
|
61
66
|
attach(detail: SandboxDetail): SandboxHandle;
|
|
62
67
|
createMemorySnapshot(id: string, params?: SandboxMemorySnapshotParams): Promise<SandboxMemorySnapshotResult>;
|
|
63
68
|
expose(id: string, params: SandboxExposeParams): Promise<SandboxExposeResult>;
|
|
69
|
+
getSnapshot(snapshot: string): Promise<SandboxSnapshotSummary>;
|
|
70
|
+
deleteSnapshot(snapshot: string): Promise<SandboxSnapshotDeleteResult>;
|
|
71
|
+
createImageBuild(params: CreateSandboxImageBuildParams): Promise<SandboxImageBuildCreateResult>;
|
|
72
|
+
getImageBuild(buildId: string): Promise<SandboxImageBuild>;
|
|
73
|
+
listImageBuilds(params?: SandboxImageBuildListParams): Promise<SandboxImageBuildListResponse>;
|
|
74
|
+
completeImageBuild(buildId: string, params: CompleteSandboxImageBuildParams): Promise<SandboxImageBuild>;
|
|
75
|
+
cancelImageBuild(buildId: string): Promise<SandboxImageBuild>;
|
|
76
|
+
updateNetwork(id: string, policy: SandboxNetworkPolicyPatch): Promise<SandboxNetworkUpdateResult>;
|
|
64
77
|
unexpose(id: string, port: number): Promise<SandboxUnexposeResult>;
|
|
65
78
|
private createDetail;
|
|
66
79
|
}
|
|
@@ -9,14 +9,6 @@ const process_1 = require("../sandbox/process");
|
|
|
9
9
|
const terminal_1 = require("../sandbox/terminal");
|
|
10
10
|
const base_2 = require("./base");
|
|
11
11
|
const RUNTIME_SESSION_REFRESH_BUFFER_MS = 60000;
|
|
12
|
-
const validateOptionalPositiveInteger = (value, fieldName) => {
|
|
13
|
-
if (value === undefined) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (!Number.isInteger(value) || value < 1) {
|
|
17
|
-
throw new client_1.HyperbrowserError(`${fieldName} must be a positive integer`, undefined);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
12
|
const normalizeSandbox = (sandbox) => {
|
|
21
13
|
const { vcpus, memMiB, diskSizeMiB, ...rest } = sandbox;
|
|
22
14
|
return {
|
|
@@ -39,10 +31,7 @@ const normalizeSandboxListResponse = (response) => ({
|
|
|
39
31
|
sandboxes: response.sandboxes.map(normalizeSandbox),
|
|
40
32
|
});
|
|
41
33
|
const serializeCreateSandboxParams = (params) => {
|
|
42
|
-
if (
|
|
43
|
-
validateOptionalPositiveInteger(params.cpu, "cpu");
|
|
44
|
-
validateOptionalPositiveInteger(params.memoryMiB, "memoryMiB");
|
|
45
|
-
validateOptionalPositiveInteger(params.diskMiB, "diskMiB");
|
|
34
|
+
if (typeof params.imageName === "string") {
|
|
46
35
|
return {
|
|
47
36
|
imageName: params.imageName,
|
|
48
37
|
imageId: params.imageId,
|
|
@@ -54,6 +43,9 @@ const serializeCreateSandboxParams = (params) => {
|
|
|
54
43
|
vcpus: params.cpu,
|
|
55
44
|
memMiB: params.memoryMiB,
|
|
56
45
|
diskSizeMiB: params.diskMiB,
|
|
46
|
+
allowInternetAccess: params.allowInternetAccess,
|
|
47
|
+
allowOut: params.allowOut,
|
|
48
|
+
denyOut: params.denyOut,
|
|
57
49
|
};
|
|
58
50
|
}
|
|
59
51
|
const snapshotParams = params;
|
|
@@ -70,6 +62,9 @@ const serializeCreateSandboxParams = (params) => {
|
|
|
70
62
|
exposedPorts: snapshotParams.exposedPorts,
|
|
71
63
|
mounts: snapshotParams.mounts,
|
|
72
64
|
timeoutMinutes: snapshotParams.timeoutMinutes,
|
|
65
|
+
allowInternetAccess: snapshotParams.allowInternetAccess,
|
|
66
|
+
allowOut: snapshotParams.allowOut,
|
|
67
|
+
denyOut: snapshotParams.denyOut,
|
|
73
68
|
};
|
|
74
69
|
};
|
|
75
70
|
const resolveSandboxRuntimeSessionHost = (runtime, baseUrl) => {
|
|
@@ -142,6 +137,9 @@ class SandboxHandle {
|
|
|
142
137
|
get diskMiB() {
|
|
143
138
|
return this.detail.diskMiB;
|
|
144
139
|
}
|
|
140
|
+
get timeoutMinutes() {
|
|
141
|
+
return this.detail.timeoutMinutes;
|
|
142
|
+
}
|
|
145
143
|
get exposedPorts() {
|
|
146
144
|
return (this.detail.exposedPorts ?? []).map((entry) => ({ ...entry }));
|
|
147
145
|
}
|
|
@@ -188,6 +186,24 @@ class SandboxHandle {
|
|
|
188
186
|
getExposedUrl(port) {
|
|
189
187
|
return buildSandboxExposedUrl(this.runtime, port);
|
|
190
188
|
}
|
|
189
|
+
get network() {
|
|
190
|
+
return this.detail.network;
|
|
191
|
+
}
|
|
192
|
+
async updateNetwork(policy) {
|
|
193
|
+
const result = await this.service.updateNetwork(this.id, policy);
|
|
194
|
+
this.detail = {
|
|
195
|
+
...this.detail,
|
|
196
|
+
network: result.network,
|
|
197
|
+
};
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
async clearNetwork() {
|
|
201
|
+
return this.updateNetwork({
|
|
202
|
+
allowInternetAccess: true,
|
|
203
|
+
allowOut: [],
|
|
204
|
+
denyOut: [],
|
|
205
|
+
});
|
|
206
|
+
}
|
|
191
207
|
async exec(input, options) {
|
|
192
208
|
if (typeof input === "string") {
|
|
193
209
|
return this.processes.exec(input, options);
|
|
@@ -265,7 +281,9 @@ class SandboxHandle {
|
|
|
265
281
|
};
|
|
266
282
|
}
|
|
267
283
|
assertRuntimeAvailable() {
|
|
268
|
-
if (this.detail.status === "closed" ||
|
|
284
|
+
if (this.detail.status === "closed" ||
|
|
285
|
+
this.detail.status === "close-error" ||
|
|
286
|
+
this.detail.status === "error") {
|
|
269
287
|
throw new client_1.HyperbrowserError(`Sandbox ${this.id} is not running`, {
|
|
270
288
|
statusCode: 409,
|
|
271
289
|
code: "sandbox_not_running",
|
|
@@ -327,9 +345,25 @@ class SandboxesService extends base_2.BaseService {
|
|
|
327
345
|
throw new client_1.HyperbrowserError("Failed to list sandboxes", undefined);
|
|
328
346
|
}
|
|
329
347
|
}
|
|
330
|
-
async
|
|
348
|
+
async deleteImage(image) {
|
|
331
349
|
try {
|
|
332
|
-
return await this.request(
|
|
350
|
+
return await this.request(`/images/${encodeURIComponent(image)}`, { method: "DELETE" });
|
|
351
|
+
}
|
|
352
|
+
catch (error) {
|
|
353
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
354
|
+
throw error;
|
|
355
|
+
}
|
|
356
|
+
throw new client_1.HyperbrowserError(`Failed to delete image ${image}`);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
async listImages(params = {}) {
|
|
360
|
+
try {
|
|
361
|
+
return await this.request("/images", undefined, {
|
|
362
|
+
source: params.source,
|
|
363
|
+
search: params.search,
|
|
364
|
+
page: params.page,
|
|
365
|
+
limit: params.limit,
|
|
366
|
+
});
|
|
333
367
|
}
|
|
334
368
|
catch (error) {
|
|
335
369
|
if (error instanceof client_1.HyperbrowserError) {
|
|
@@ -343,6 +377,8 @@ class SandboxesService extends base_2.BaseService {
|
|
|
343
377
|
return await this.request("/snapshots", undefined, {
|
|
344
378
|
status: params.status,
|
|
345
379
|
imageName: params.imageName,
|
|
380
|
+
search: params.search,
|
|
381
|
+
page: params.page,
|
|
346
382
|
limit: params.limit,
|
|
347
383
|
});
|
|
348
384
|
}
|
|
@@ -409,6 +445,110 @@ class SandboxesService extends base_2.BaseService {
|
|
|
409
445
|
throw new client_1.HyperbrowserError(`Failed to expose port ${params.port} for sandbox ${id}`);
|
|
410
446
|
}
|
|
411
447
|
}
|
|
448
|
+
async getSnapshot(snapshot) {
|
|
449
|
+
try {
|
|
450
|
+
const response = await this.request(`/snapshots/${encodeURIComponent(snapshot)}`);
|
|
451
|
+
return response.snapshot;
|
|
452
|
+
}
|
|
453
|
+
catch (error) {
|
|
454
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
455
|
+
throw error;
|
|
456
|
+
}
|
|
457
|
+
throw new client_1.HyperbrowserError(`Failed to get snapshot ${snapshot}`);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
async deleteSnapshot(snapshot) {
|
|
461
|
+
try {
|
|
462
|
+
return await this.request(`/snapshots/${encodeURIComponent(snapshot)}`, { method: "DELETE" });
|
|
463
|
+
}
|
|
464
|
+
catch (error) {
|
|
465
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
466
|
+
throw error;
|
|
467
|
+
}
|
|
468
|
+
throw new client_1.HyperbrowserError(`Failed to delete snapshot ${snapshot}`);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
async createImageBuild(params) {
|
|
472
|
+
try {
|
|
473
|
+
return await this.request("/images/builds", {
|
|
474
|
+
method: "POST",
|
|
475
|
+
body: JSON.stringify(params),
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
catch (error) {
|
|
479
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
480
|
+
throw error;
|
|
481
|
+
}
|
|
482
|
+
throw new client_1.HyperbrowserError("Failed to create image build");
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
async getImageBuild(buildId) {
|
|
486
|
+
try {
|
|
487
|
+
const response = await this.request(`/images/builds/${encodeURIComponent(buildId)}`);
|
|
488
|
+
return response.build;
|
|
489
|
+
}
|
|
490
|
+
catch (error) {
|
|
491
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
492
|
+
throw error;
|
|
493
|
+
}
|
|
494
|
+
throw new client_1.HyperbrowserError(`Failed to get image build ${buildId}`);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
async listImageBuilds(params = {}) {
|
|
498
|
+
try {
|
|
499
|
+
return await this.request("/images/builds", undefined, {
|
|
500
|
+
status: params.status,
|
|
501
|
+
limit: params.limit,
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
catch (error) {
|
|
505
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
506
|
+
throw error;
|
|
507
|
+
}
|
|
508
|
+
throw new client_1.HyperbrowserError("Failed to list image builds");
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
async completeImageBuild(buildId, params) {
|
|
512
|
+
try {
|
|
513
|
+
const response = await this.request(`/images/builds/${encodeURIComponent(buildId)}/complete`, {
|
|
514
|
+
method: "POST",
|
|
515
|
+
body: JSON.stringify(params),
|
|
516
|
+
});
|
|
517
|
+
return response.build;
|
|
518
|
+
}
|
|
519
|
+
catch (error) {
|
|
520
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
521
|
+
throw error;
|
|
522
|
+
}
|
|
523
|
+
throw new client_1.HyperbrowserError(`Failed to complete image build ${buildId}`);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
async cancelImageBuild(buildId) {
|
|
527
|
+
try {
|
|
528
|
+
const response = await this.request(`/images/builds/${encodeURIComponent(buildId)}/cancel`, { method: "POST" });
|
|
529
|
+
return response.build;
|
|
530
|
+
}
|
|
531
|
+
catch (error) {
|
|
532
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
533
|
+
throw error;
|
|
534
|
+
}
|
|
535
|
+
throw new client_1.HyperbrowserError(`Failed to cancel image build ${buildId}`);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
async updateNetwork(id, policy) {
|
|
539
|
+
try {
|
|
540
|
+
return await this.request(`/sandbox/${id}/network`, {
|
|
541
|
+
method: "PUT",
|
|
542
|
+
body: JSON.stringify(policy),
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
catch (error) {
|
|
546
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
547
|
+
throw error;
|
|
548
|
+
}
|
|
549
|
+
throw new client_1.HyperbrowserError(`Failed to update network policy for sandbox ${id}`);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
412
552
|
async unexpose(id, port) {
|
|
413
553
|
try {
|
|
414
554
|
return await this.request(`/sandbox/${id}/unexpose`, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateVolumeParams, Volume, VolumeListResponse } from "../types/volume";
|
|
1
|
+
import { CreateVolumeParams, Volume, VolumeListParams, VolumeListResponse } from "../types/volume";
|
|
2
2
|
import { BaseService } from "./base";
|
|
3
3
|
export declare class VolumesService extends BaseService {
|
|
4
4
|
/**
|
|
@@ -8,7 +8,7 @@ export declare class VolumesService extends BaseService {
|
|
|
8
8
|
/**
|
|
9
9
|
* List sandbox volumes for the current team.
|
|
10
10
|
*/
|
|
11
|
-
list(): Promise<VolumeListResponse>;
|
|
11
|
+
list(params?: VolumeListParams): Promise<VolumeListResponse>;
|
|
12
12
|
/**
|
|
13
13
|
* Get a single sandbox volume.
|
|
14
14
|
*/
|
package/dist/services/volumes.js
CHANGED
|
@@ -24,9 +24,13 @@ class VolumesService extends base_1.BaseService {
|
|
|
24
24
|
/**
|
|
25
25
|
* List sandbox volumes for the current team.
|
|
26
26
|
*/
|
|
27
|
-
async list() {
|
|
27
|
+
async list(params = {}) {
|
|
28
28
|
try {
|
|
29
|
-
return await this.request("/volume"
|
|
29
|
+
return await this.request("/volume", undefined, {
|
|
30
|
+
search: params.search,
|
|
31
|
+
page: params.page,
|
|
32
|
+
limit: params.limit,
|
|
33
|
+
});
|
|
30
34
|
}
|
|
31
35
|
catch (error) {
|
|
32
36
|
if (error instanceof client_1.HyperbrowserError) {
|
|
@@ -25,7 +25,7 @@ export type HyperAgentLlm = "gpt-5.6-luna" | "gpt-5.5" | "gpt-5.2" | "gpt-5.1" |
|
|
|
25
25
|
export type GeminiComputerUseLlm = "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";
|
|
26
26
|
export type GrokComputerUseLlm = "grok-4.5";
|
|
27
27
|
export type GrokReasoningEffort = "low" | "medium" | "high";
|
|
28
|
-
export type SessionRegion = "us-central" | "asia-south" | "us-dev" | "europe-west" | "us-west" | "us-east";
|
|
28
|
+
export type SessionRegion = "us" | "us-central" | "asia-south" | "us-dev" | "europe-west" | "us-west" | "us-east";
|
|
29
29
|
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";
|
|
30
30
|
export type OperatingSystem = "windows" | "android" | "macos" | "linux" | "ios";
|
|
31
31
|
export type Platform = "chrome" | "firefox" | "safari" | "edge";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export { StartHyperAgentTaskParams, StartHyperAgentTaskResponse, HyperAgentTaskS
|
|
|
9
9
|
export { StartGeminiComputerUseTaskParams, StartGeminiComputerUseTaskResponse, GeminiComputerUseTaskStatusResponse, GeminiComputerUseTaskResponse, GeminiComputerUseTaskData, GeminiComputerUseStepResponse, GeminiComputerUseApiKeys, GeminiComputerUseTaskMetadata, } from "./agents/gemini-computer-use";
|
|
10
10
|
export { StartGrokComputerUseTaskParams, StartGrokComputerUseTaskResponse, GrokComputerUseTaskStatusResponse, GrokComputerUseTaskResponse, GrokComputerUseTaskData, GrokComputerUseStepResponse, GrokComputerUseApiKeys, GrokComputerUseTaskMetadata, } from "./agents/grok-computer-use";
|
|
11
11
|
export { BasicResponse, BrowserMemorySize, SessionStatus, Session, SessionDetail, SessionGetParams, SessionListParams, SessionListResponse, ScreenConfig, CaptchaEvaluationPageResult, CaptchaEvaluationParams, CaptchaEvaluationResponse, CaptchaEvaluationTarget, CaptchaEvaluationType, CaptchaSolverType, CreateSessionParams, CreateSessionSnapshotResponse, GetSessionDownloadsUrlResponse, GetSessionVideoRecordingUrlResponse, GetSessionRecordingUrlResponse, ImageCaptchaParam, UploadFileResponse, UploadFileOptions, GetActiveSessionsCountResponse, SessionEventLogListParams, SessionEventLogListResponse, SessionEventLog, SessionProfile, SessionLaunchState, SessionCreditBreakdown, StartSessionFromSnapshotParams, UpdateSessionProfileParams, UpdateSessionProxyLocationParams, UpdateSessionProxyParams, UpdateSessionScreenParams, UpdateSessionSolveCaptchasParams, UpdateSessionSolveCaptchasResponse, } from "./session";
|
|
12
|
-
export { SandboxStatus, SandboxRuntimeTarget, Sandbox, SandboxDetail, SandboxVolumeMountType, SandboxVolumeMount, SandboxListParams, SandboxListResponse, SandboxImageSummary, SandboxImageListResponse, SandboxSnapshotStatus, SandboxSnapshotSummary, SandboxSnapshotListParams, SandboxSnapshotListResponse, CreateSandboxParams, SandboxMemorySnapshotParams, SandboxMemorySnapshotResult, SandboxExposeParams, SandboxExposeResult, SandboxUnexposeResult, SandboxProcessStatus, SandboxExecParams, SandboxExecOptions, SandboxProcessSummary, SandboxProcessResult, SandboxProcessListParams, SandboxProcessListResponse, SandboxProcessWaitParams, SandboxProcessSignal, SandboxProcessStdinParams, SandboxProcessStreamEvent, SandboxFileType, SandboxFileInfo, SandboxFileWriteInfo, SandboxFileListOptions, SandboxFileReadFormat, SandboxFileReadOptions, SandboxFileWriteData, SandboxFileWriteEntry, SandboxFileTextWriteOptions, SandboxFileBytesWriteOptions, SandboxFileMakeDirOptions, SandboxFileCopyParams, SandboxFileChmodParams, SandboxFileChownParams, SandboxFileTransferResult, SandboxFileSystemEventType, SandboxFileSystemEvent, SandboxWatchDirOptions, SandboxPresignFileParams, SandboxPresignedUrl, SandboxTerminalCreateParams, SandboxTerminalOutputChunk, SandboxTerminalStatus, SandboxTerminalWaitParams, SandboxTerminalKillParams, SandboxTerminalEvent, } from "./sandbox";
|
|
13
|
-
export { CreateVolumeParams, Volume, VolumeListResponse } from "./volume";
|
|
12
|
+
export { SandboxStatus, SandboxRuntimeTarget, SandboxNetworkPolicy, SandboxNetworkPolicyPatch, SandboxNetworkUpdateResult, Sandbox, SandboxDetail, SandboxVolumeMountType, SandboxVolumeMount, SandboxListParams, SandboxListResponse, SandboxImageSource, SandboxImageSummary, SandboxImageListParams, SandboxImageListResponse, SandboxSnapshotStatus, SandboxSnapshotSummary, SandboxSnapshotListParams, SandboxSnapshotListResponse, SandboxSnapshotDeleteResult, SandboxImageDeleteResult, SandboxImageBuildStatus, SandboxImageBuildUpload, SandboxImageBuild, CreateSandboxImageBuildParams, CompleteSandboxImageBuildParams, SandboxImageBuildCreateResult, SandboxImageBuildListParams, SandboxImageBuildListResponse, CreateSandboxParams, SandboxMemorySnapshotParams, SandboxMemorySnapshotResult, SandboxExposeParams, SandboxExposeResult, SandboxUnexposeResult, SandboxProcessStatus, SandboxExecParams, SandboxExecOptions, SandboxProcessSummary, SandboxProcessResult, SandboxProcessListParams, SandboxProcessListResponse, SandboxProcessWaitParams, SandboxProcessSignal, SandboxProcessStdinParams, SandboxProcessStreamEvent, SandboxFileType, SandboxFileInfo, SandboxFileWriteInfo, SandboxFileListOptions, SandboxFileReadFormat, SandboxFileReadOptions, SandboxFileWriteData, SandboxFileWriteEntry, SandboxFileTextWriteOptions, SandboxFileBytesWriteOptions, SandboxFileMakeDirOptions, SandboxFileCopyParams, SandboxFileChmodParams, SandboxFileChownParams, SandboxFileTransferResult, SandboxFileSystemEventType, SandboxFileSystemEvent, SandboxWatchDirOptions, SandboxPresignFileParams, SandboxPresignedUrl, SandboxTerminalCreateParams, SandboxTerminalOutputChunk, SandboxTerminalStatus, SandboxTerminalWaitParams, SandboxTerminalKillParams, SandboxTerminalEvent, } from "./sandbox";
|
|
13
|
+
export { CreateVolumeParams, Volume, VolumeListParams, VolumeListResponse } from "./volume";
|
|
14
14
|
export { CreateProfileParams, ForkProfileParams, ProfileResponse, CreateProfileResponse, ProfileListParams, ProfileListResponse, } from "./profile";
|
|
15
15
|
export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
|
|
16
16
|
export { ExtractJobStatus, BrowserUseTaskStatus, BrowserUseLlm, ClaudeComputerUseLlm, CuaLlm, GeminiComputerUseLlm, GrokComputerUseLlm, GrokReasoningEffort, ScrapeScreenshotFormat, ScrapeJobStatus, CrawlJobStatus, Country, State, ISO639_1, OperatingSystem, Platform, ScrapeFormat, ScrapeWaitUntil, ScrapePageStatus, CrawlPageStatus, RecordingStatus, DownloadsStatus, HyperAgentLlm, HyperAgentTaskStatus, ClaudeComputerUseTaskStatus, CuaTaskStatus, GeminiComputerUseTaskStatus, GrokComputerUseTaskStatus, SessionEventLogType, SessionRegion, BrowserUseVersion, HyperAgentVersion, } from "./constants";
|
package/dist/types/sandbox.d.ts
CHANGED
|
@@ -3,6 +3,19 @@ import type { ReadableStream } from "node:stream/web";
|
|
|
3
3
|
import { SessionRegion } from "./constants";
|
|
4
4
|
import { SessionLaunchState, SessionStatus } from "./session";
|
|
5
5
|
export type SandboxStatus = SessionStatus;
|
|
6
|
+
export interface SandboxNetworkPolicy {
|
|
7
|
+
allowInternetAccess: boolean;
|
|
8
|
+
allowOut: string[];
|
|
9
|
+
denyOut: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface SandboxNetworkPolicyPatch {
|
|
12
|
+
allowInternetAccess?: boolean;
|
|
13
|
+
allowOut?: string[];
|
|
14
|
+
denyOut?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface SandboxNetworkUpdateResult {
|
|
17
|
+
network: SandboxNetworkPolicy;
|
|
18
|
+
}
|
|
6
19
|
export interface SandboxRuntimeTarget {
|
|
7
20
|
transport: "regional_proxy";
|
|
8
21
|
host: string;
|
|
@@ -30,6 +43,8 @@ export interface Sandbox {
|
|
|
30
43
|
cpu?: number | null;
|
|
31
44
|
memoryMiB?: number | null;
|
|
32
45
|
diskMiB?: number | null;
|
|
46
|
+
timeoutMinutes?: number | null;
|
|
47
|
+
network?: SandboxNetworkPolicy;
|
|
33
48
|
runtime: SandboxRuntimeTarget;
|
|
34
49
|
exposedPorts: SandboxExposeResult[];
|
|
35
50
|
}
|
|
@@ -49,6 +64,9 @@ interface SandboxCreateCommonParams {
|
|
|
49
64
|
exposedPorts?: SandboxExposeParams[];
|
|
50
65
|
mounts?: Record<string, SandboxVolumeMount>;
|
|
51
66
|
timeoutMinutes?: number;
|
|
67
|
+
allowInternetAccess?: boolean;
|
|
68
|
+
allowOut?: string[];
|
|
69
|
+
denyOut?: string[];
|
|
52
70
|
}
|
|
53
71
|
export type CreateSandboxParams = (SandboxCreateCommonParams & {
|
|
54
72
|
snapshotName: string;
|
|
@@ -81,16 +99,28 @@ export interface SandboxListResponse {
|
|
|
81
99
|
page: number;
|
|
82
100
|
perPage: number;
|
|
83
101
|
}
|
|
102
|
+
export type SandboxImageSource = "public" | "team";
|
|
84
103
|
export interface SandboxImageSummary {
|
|
85
104
|
id: string;
|
|
86
105
|
imageName: string;
|
|
87
106
|
namespace: string;
|
|
107
|
+
source?: SandboxImageSource;
|
|
108
|
+
imageInit?: Record<string, unknown> | null;
|
|
88
109
|
uploaded: boolean;
|
|
89
110
|
createdAt: string;
|
|
90
111
|
updatedAt: string;
|
|
91
112
|
}
|
|
113
|
+
export interface SandboxImageListParams {
|
|
114
|
+
source?: SandboxImageSource | SandboxImageSource[];
|
|
115
|
+
search?: string;
|
|
116
|
+
page?: number;
|
|
117
|
+
limit?: number;
|
|
118
|
+
}
|
|
92
119
|
export interface SandboxImageListResponse {
|
|
93
120
|
images: SandboxImageSummary[];
|
|
121
|
+
totalCount?: number;
|
|
122
|
+
page?: number;
|
|
123
|
+
perPage?: number;
|
|
94
124
|
}
|
|
95
125
|
export type SandboxSnapshotStatus = "creating" | "created" | "failed";
|
|
96
126
|
export interface SandboxSnapshotSummary {
|
|
@@ -101,6 +131,9 @@ export interface SandboxSnapshotSummary {
|
|
|
101
131
|
imageName: string;
|
|
102
132
|
imageId: string;
|
|
103
133
|
status: SandboxSnapshotStatus;
|
|
134
|
+
vcpus?: number | null;
|
|
135
|
+
memMiB?: number | null;
|
|
136
|
+
diskSizeMiB?: number | null;
|
|
104
137
|
compatibilityTag: string;
|
|
105
138
|
metadata: Record<string, unknown>;
|
|
106
139
|
uploaded: boolean;
|
|
@@ -108,12 +141,86 @@ export interface SandboxSnapshotSummary {
|
|
|
108
141
|
updatedAt: string;
|
|
109
142
|
}
|
|
110
143
|
export interface SandboxSnapshotListParams {
|
|
111
|
-
status?: SandboxSnapshotStatus;
|
|
144
|
+
status?: SandboxSnapshotStatus | SandboxSnapshotStatus[];
|
|
112
145
|
imageName?: string;
|
|
146
|
+
search?: string;
|
|
147
|
+
page?: number;
|
|
113
148
|
limit?: number;
|
|
114
149
|
}
|
|
115
150
|
export interface SandboxSnapshotListResponse {
|
|
116
151
|
snapshots: SandboxSnapshotSummary[];
|
|
152
|
+
totalCount?: number;
|
|
153
|
+
page?: number;
|
|
154
|
+
perPage?: number;
|
|
155
|
+
}
|
|
156
|
+
export interface SandboxSnapshotDeleteResult {
|
|
157
|
+
deleted: boolean;
|
|
158
|
+
}
|
|
159
|
+
export interface SandboxImageDeleteResult {
|
|
160
|
+
deleted: boolean;
|
|
161
|
+
id?: string;
|
|
162
|
+
imageName?: string;
|
|
163
|
+
uploaded?: boolean;
|
|
164
|
+
}
|
|
165
|
+
export type SandboxImageBuildStatus = "awaiting_upload" | "upload_verified" | "dispatching" | "building" | "verifying" | "completed" | "failed" | "canceled";
|
|
166
|
+
export interface SandboxImageBuildUpload {
|
|
167
|
+
url: string;
|
|
168
|
+
method: string;
|
|
169
|
+
headers: Record<string, string>;
|
|
170
|
+
objectKey: string;
|
|
171
|
+
expiresInSeconds: number;
|
|
172
|
+
maxUploadBytes: number;
|
|
173
|
+
}
|
|
174
|
+
export interface SandboxImageBuild {
|
|
175
|
+
id: string;
|
|
176
|
+
teamId?: string | null;
|
|
177
|
+
userId?: string | null;
|
|
178
|
+
namespace?: string | null;
|
|
179
|
+
imageName: string;
|
|
180
|
+
imageId?: string | null;
|
|
181
|
+
status: SandboxImageBuildStatus;
|
|
182
|
+
inputBucket?: string | null;
|
|
183
|
+
inputKey?: string | null;
|
|
184
|
+
inputSha256?: string | null;
|
|
185
|
+
inputSizeBytes?: number | null;
|
|
186
|
+
outputBucket?: string | null;
|
|
187
|
+
outputKey?: string | null;
|
|
188
|
+
vmId?: string | null;
|
|
189
|
+
errorCode?: string | null;
|
|
190
|
+
errorMessage?: string | null;
|
|
191
|
+
metadata?: Record<string, unknown> | null;
|
|
192
|
+
completedAt?: string | null;
|
|
193
|
+
createdAt?: string | null;
|
|
194
|
+
updatedAt?: string | null;
|
|
195
|
+
}
|
|
196
|
+
export interface CreateSandboxImageBuildParams {
|
|
197
|
+
imageName: string;
|
|
198
|
+
inputSha256: string;
|
|
199
|
+
inputSizeBytes: number;
|
|
200
|
+
inputFormat?: "rootfs_export_tar_gz";
|
|
201
|
+
sourcePlatform?: "linux/amd64";
|
|
202
|
+
imageConfigUser?: string;
|
|
203
|
+
imageInit?: {
|
|
204
|
+
env?: Record<string, string>;
|
|
205
|
+
command?: string;
|
|
206
|
+
args?: string[];
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
export interface CompleteSandboxImageBuildParams {
|
|
210
|
+
inputSha256: string;
|
|
211
|
+
inputSizeBytes: number;
|
|
212
|
+
inputFormat?: "rootfs_export_tar_gz";
|
|
213
|
+
}
|
|
214
|
+
export interface SandboxImageBuildCreateResult {
|
|
215
|
+
build: SandboxImageBuild;
|
|
216
|
+
upload: SandboxImageBuildUpload;
|
|
217
|
+
}
|
|
218
|
+
export interface SandboxImageBuildListParams {
|
|
219
|
+
status?: SandboxImageBuildStatus;
|
|
220
|
+
limit?: number;
|
|
221
|
+
}
|
|
222
|
+
export interface SandboxImageBuildListResponse {
|
|
223
|
+
builds: SandboxImageBuild[];
|
|
117
224
|
}
|
|
118
225
|
export interface SandboxMemorySnapshotParams {
|
|
119
226
|
snapshotName?: string;
|
|
@@ -152,7 +259,7 @@ export interface SandboxExecParams {
|
|
|
152
259
|
timeoutMs?: number;
|
|
153
260
|
timeoutSec?: number;
|
|
154
261
|
runAs?: string;
|
|
155
|
-
/** @deprecated Ignored for process APIs.
|
|
262
|
+
/** @deprecated Ignored for process APIs. */
|
|
156
263
|
useShell?: boolean;
|
|
157
264
|
}
|
|
158
265
|
export type SandboxExecOptions = Omit<SandboxExecParams, "command">;
|
package/dist/types/session.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import { Country, DownloadsStatus, ISO639_1, OperatingSystem, Platform, RecordingStatus, SessionEventLogType, SessionRegion, State } from "./constants";
|
|
3
|
-
export type SessionStatus = "active" | "closed" | "error";
|
|
3
|
+
export type SessionStatus = "active" | "closed" | "close-error" | "error";
|
|
4
4
|
export type BrowserMemorySize = "small" | "medium" | "large";
|
|
5
5
|
export interface BasicResponse {
|
|
6
6
|
success: boolean;
|
package/dist/types/volume.d.ts
CHANGED
|
@@ -7,6 +7,14 @@ export interface Volume {
|
|
|
7
7
|
size?: number;
|
|
8
8
|
transferAmount?: number;
|
|
9
9
|
}
|
|
10
|
+
export interface VolumeListParams {
|
|
11
|
+
search?: string;
|
|
12
|
+
page?: number;
|
|
13
|
+
limit?: number;
|
|
14
|
+
}
|
|
10
15
|
export interface VolumeListResponse {
|
|
11
16
|
volumes: Volume[];
|
|
17
|
+
totalCount?: number;
|
|
18
|
+
page?: number;
|
|
19
|
+
perPage?: number;
|
|
12
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperbrowser/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.92.1",
|
|
4
4
|
"description": "Node SDK for Hyperbrowser API",
|
|
5
5
|
"author": "",
|
|
6
6
|
"repository": {
|
|
@@ -41,6 +41,9 @@
|
|
|
41
41
|
"ai"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
+
"@types/node": "^22.9.1",
|
|
45
|
+
"@types/node-fetch": "^2.6.4",
|
|
46
|
+
"@types/ws": "^8.18.1",
|
|
44
47
|
"form-data": "^4.0.1",
|
|
45
48
|
"node-fetch": "2.7.0",
|
|
46
49
|
"ws": "^8.19.0",
|
|
@@ -48,9 +51,6 @@
|
|
|
48
51
|
"zod-to-json-schema": "^3.25.0"
|
|
49
52
|
},
|
|
50
53
|
"devDependencies": {
|
|
51
|
-
"@types/node": "^22.9.1",
|
|
52
|
-
"@types/node-fetch": "^2.6.4",
|
|
53
|
-
"@types/ws": "^8.18.1",
|
|
54
54
|
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
|
55
55
|
"@typescript-eslint/parser": "^8.15.0",
|
|
56
56
|
"dotenv": "^17.3.1",
|