@hyperbrowser/sdk 0.89.1 → 0.89.2

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/README.md CHANGED
@@ -255,6 +255,27 @@ const sandbox = await client.sandboxes.create({
255
255
  console.log(sandbox.exposedPorts[0].browserUrl);
256
256
  ```
257
257
 
258
+ Manage volumes and mount them into a sandbox:
259
+
260
+ ```typescript
261
+ const volume = await client.volumes.create({ name: "project-cache" });
262
+ const volumes = await client.volumes.list();
263
+ const sameVolume = await client.volumes.get(volume.id);
264
+
265
+ const sandbox = await client.sandboxes.create({
266
+ imageName: "node",
267
+ mounts: {
268
+ "/workspace/cache": {
269
+ id: sameVolume.id,
270
+ type: "rw",
271
+ shared: true,
272
+ },
273
+ },
274
+ });
275
+
276
+ await sandbox.stop();
277
+ ```
278
+
258
279
  List sandboxes with time-range and search filters:
259
280
 
260
281
  ```typescript
package/dist/client.d.ts CHANGED
@@ -14,6 +14,7 @@ import { ComputerActionService } from "./services/computer-action";
14
14
  import { GeminiComputerUseService } from "./services/agents/gemini-computer-use";
15
15
  import { WebService } from "./services/web";
16
16
  import { SandboxesService } from "./services/sandboxes";
17
+ import { VolumesService } from "./services/volumes";
17
18
  export type HyperbrowserService = "control" | "runtime";
18
19
  export interface HyperbrowserErrorOptions {
19
20
  statusCode?: number;
@@ -52,5 +53,6 @@ export declare class HyperbrowserClient {
52
53
  readonly team: TeamService;
53
54
  readonly computerAction: ComputerActionService;
54
55
  readonly sandboxes: SandboxesService;
56
+ readonly volumes: VolumesService;
55
57
  constructor(config?: HyperbrowserConfig);
56
58
  }
package/dist/client.js CHANGED
@@ -16,6 +16,7 @@ const computer_action_1 = require("./services/computer-action");
16
16
  const gemini_computer_use_1 = require("./services/agents/gemini-computer-use");
17
17
  const web_1 = require("./services/web");
18
18
  const sandboxes_1 = require("./services/sandboxes");
19
+ const volumes_1 = require("./services/volumes");
19
20
  class HyperbrowserError extends Error {
20
21
  constructor(message, options = {}) {
21
22
  super(`[Hyperbrowser]: ${message}`);
@@ -50,6 +51,7 @@ class HyperbrowserClient {
50
51
  this.team = new team_1.TeamService(apiKey, baseUrl, timeout);
51
52
  this.computerAction = new computer_action_1.ComputerActionService(apiKey, baseUrl, timeout);
52
53
  this.sandboxes = new sandboxes_1.SandboxesService(apiKey, baseUrl, timeout, runtimeProxyOverride);
54
+ this.volumes = new volumes_1.VolumesService(apiKey, baseUrl, timeout);
53
55
  this.agents = {
54
56
  browserUse: new browser_use_1.BrowserUseService(apiKey, baseUrl, timeout),
55
57
  claudeComputerUse: new claude_computer_use_1.ClaudeComputerUseService(apiKey, baseUrl, timeout),
@@ -55,9 +55,7 @@ const quoteShellToken = (token) => {
55
55
  if (token.length === 0) {
56
56
  return "''";
57
57
  }
58
- return SHELL_SAFE_TOKEN_PATTERN.test(token)
59
- ? token
60
- : `'${token.replace(/'/g, `'\"'\"'`)}'`;
58
+ return SHELL_SAFE_TOKEN_PATTERN.test(token) ? token : `'${token.replace(/'/g, `'"'"'`)}'`;
61
59
  };
62
60
  const buildShellCommand = (command, args) => {
63
61
  if (!args || args.length === 0) {
@@ -48,6 +48,7 @@ const serializeCreateSandboxParams = (params) => {
48
48
  region: params.region,
49
49
  enableRecording: params.enableRecording,
50
50
  exposedPorts: params.exposedPorts,
51
+ mounts: params.mounts,
51
52
  timeoutMinutes: params.timeoutMinutes,
52
53
  vcpus: params.cpu,
53
54
  memMiB: params.memoryMiB,
@@ -66,6 +67,7 @@ const serializeCreateSandboxParams = (params) => {
66
67
  region: snapshotParams.region,
67
68
  enableRecording: snapshotParams.enableRecording,
68
69
  exposedPorts: snapshotParams.exposedPorts,
70
+ mounts: snapshotParams.mounts,
69
71
  timeoutMinutes: snapshotParams.timeoutMinutes,
70
72
  };
71
73
  };
@@ -0,0 +1,16 @@
1
+ import { CreateVolumeParams, Volume, VolumeListResponse } from "../types/volume";
2
+ import { BaseService } from "./base";
3
+ export declare class VolumesService extends BaseService {
4
+ /**
5
+ * Create a new sandbox volume.
6
+ */
7
+ create(params: CreateVolumeParams): Promise<Volume>;
8
+ /**
9
+ * List sandbox volumes for the current team.
10
+ */
11
+ list(): Promise<VolumeListResponse>;
12
+ /**
13
+ * Get a single sandbox volume.
14
+ */
15
+ get(id: string): Promise<Volume>;
16
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VolumesService = void 0;
4
+ const client_1 = require("../client");
5
+ const base_1 = require("./base");
6
+ class VolumesService extends base_1.BaseService {
7
+ /**
8
+ * Create a new sandbox volume.
9
+ */
10
+ async create(params) {
11
+ try {
12
+ return await this.request("/volume", {
13
+ method: "POST",
14
+ body: JSON.stringify(params),
15
+ });
16
+ }
17
+ catch (error) {
18
+ if (error instanceof client_1.HyperbrowserError) {
19
+ throw error;
20
+ }
21
+ throw new client_1.HyperbrowserError("Failed to create volume", undefined);
22
+ }
23
+ }
24
+ /**
25
+ * List sandbox volumes for the current team.
26
+ */
27
+ async list() {
28
+ try {
29
+ return await this.request("/volume");
30
+ }
31
+ catch (error) {
32
+ if (error instanceof client_1.HyperbrowserError) {
33
+ throw error;
34
+ }
35
+ throw new client_1.HyperbrowserError("Failed to list volumes", undefined);
36
+ }
37
+ }
38
+ /**
39
+ * Get a single sandbox volume.
40
+ */
41
+ async get(id) {
42
+ try {
43
+ return await this.request(`/volume/${id}`);
44
+ }
45
+ catch (error) {
46
+ if (error instanceof client_1.HyperbrowserError) {
47
+ throw error;
48
+ }
49
+ throw new client_1.HyperbrowserError(`Failed to get volume ${id}`, undefined);
50
+ }
51
+ }
52
+ }
53
+ exports.VolumesService = VolumesService;
@@ -8,7 +8,8 @@ export { StartCuaTaskParams, StartCuaTaskResponse, CuaTaskStatusResponse, CuaTas
8
8
  export { StartHyperAgentTaskParams, StartHyperAgentTaskResponse, HyperAgentTaskStatusResponse, HyperAgentTaskResponse, HyperAgentTaskData, HyperAgentStep, HyperAgentOutput, HyperAgentActionOutput, HyperAgentApiKeys, HyperAgentTaskMetadata, HyperAgentOutputV110, HyperAgentStepV110, } from "./agents/hyper-agent";
9
9
  export { StartGeminiComputerUseTaskParams, StartGeminiComputerUseTaskResponse, GeminiComputerUseTaskStatusResponse, GeminiComputerUseTaskResponse, GeminiComputerUseTaskData, GeminiComputerUseStepResponse, GeminiComputerUseApiKeys, GeminiComputerUseTaskMetadata, } from "./agents/gemini-computer-use";
10
10
  export { BasicResponse, SessionStatus, Session, SessionDetail, SessionGetParams, SessionListParams, SessionListResponse, ScreenConfig, CreateSessionParams, GetSessionDownloadsUrlResponse, GetSessionVideoRecordingUrlResponse, GetSessionRecordingUrlResponse, ImageCaptchaParam, UploadFileResponse, UploadFileOptions, GetActiveSessionsCountResponse, SessionEventLogListParams, SessionEventLogListResponse, SessionEventLog, SessionProfile, SessionLaunchState, SessionCreditBreakdown, UpdateSessionProfileParams, UpdateSessionProxyLocationParams, UpdateSessionProxyParams, } from "./session";
11
- export { SandboxStatus, SandboxRuntimeTarget, Sandbox, SandboxDetail, 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";
11
+ 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";
12
+ export { CreateVolumeParams, Volume, VolumeListResponse } from "./volume";
12
13
  export { CreateProfileParams, ProfileResponse, CreateProfileResponse, ProfileListParams, ProfileListResponse, } from "./profile";
13
14
  export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
14
15
  export { ExtractJobStatus, BrowserUseTaskStatus, BrowserUseLlm, ClaudeComputerUseLlm, CuaLlm, GeminiComputerUseLlm, ScrapeScreenshotFormat, ScrapeJobStatus, CrawlJobStatus, Country, State, ISO639_1, OperatingSystem, Platform, ScrapeFormat, ScrapeWaitUntil, ScrapePageStatus, CrawlPageStatus, RecordingStatus, DownloadsStatus, HyperAgentLlm, HyperAgentTaskStatus, ClaudeComputerUseTaskStatus, CuaTaskStatus, GeminiComputerUseTaskStatus, SessionEventLogType, SessionRegion, BrowserUseVersion, HyperAgentVersion, } from "./constants";
@@ -37,10 +37,17 @@ export interface SandboxDetail extends Sandbox {
37
37
  token: string | null;
38
38
  tokenExpiresAt: string | null;
39
39
  }
40
+ export type SandboxVolumeMountType = "rw" | "ro";
41
+ export interface SandboxVolumeMount {
42
+ id: string;
43
+ type?: SandboxVolumeMountType;
44
+ shared?: boolean;
45
+ }
40
46
  interface SandboxCreateCommonParams {
41
47
  region?: SessionRegion;
42
48
  enableRecording?: boolean;
43
49
  exposedPorts?: SandboxExposeParams[];
50
+ mounts?: Record<string, SandboxVolumeMount>;
44
51
  timeoutMinutes?: number;
45
52
  }
46
53
  export type CreateSandboxParams = (SandboxCreateCommonParams & {
@@ -0,0 +1,12 @@
1
+ export interface CreateVolumeParams {
2
+ name: string;
3
+ }
4
+ export interface Volume {
5
+ id: string;
6
+ name: string;
7
+ size?: number;
8
+ transferAmount?: number;
9
+ }
10
+ export interface VolumeListResponse {
11
+ volumes: Volume[];
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperbrowser/sdk",
3
- "version": "0.89.1",
3
+ "version": "0.89.2",
4
4
  "description": "Node SDK for Hyperbrowser API",
5
5
  "author": "",
6
6
  "repository": {