@hyperbrowser/sdk 0.89.0 → 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
@@ -192,9 +192,11 @@ const main = async () => {
192
192
  await sandbox.files.writeText("/tmp/watch-demo.txt", "watch me");
193
193
  await watch.stop();
194
194
 
195
- const proc = await sandbox.processes.start({
196
- command: "bash",
197
- args: ["-lc", "echo process-started && sleep 1 && echo process-finished"],
195
+ const proc = await sandbox.processes.start(
196
+ "echo process-started && sleep 1 && echo process-finished",
197
+ {
198
+ runAs: "root",
199
+ }
198
200
  });
199
201
 
200
202
  for await (const event of proc.stream()) {
@@ -253,6 +255,27 @@ const sandbox = await client.sandboxes.create({
253
255
  console.log(sandbox.exposedPorts[0].browserUrl);
254
256
  ```
255
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
+
256
279
  List sandboxes with time-range and search filters:
257
280
 
258
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),
@@ -51,7 +51,9 @@ export declare class SandboxFilesApi {
51
51
  private readonly transport;
52
52
  private readonly getConnectionInfo;
53
53
  private readonly runtimeProxyOverride?;
54
- constructor(transport: RuntimeTransport, getConnectionInfo: () => Promise<RuntimeConnectionInfo>, runtimeProxyOverride?: string | undefined);
54
+ private readonly defaultRunAs?;
55
+ constructor(transport: RuntimeTransport, getConnectionInfo: () => Promise<RuntimeConnectionInfo>, runtimeProxyOverride?: string | undefined, defaultRunAs?: string | undefined);
56
+ withRunAs(runAs?: string): SandboxFilesApi;
55
57
  exists(path: string): Promise<boolean>;
56
58
  getInfo(path: string): Promise<SandboxFileInfo>;
57
59
  list(path: string, options?: SandboxFileListOptions): Promise<SandboxFileInfo[]>;
@@ -88,5 +90,7 @@ export declare class SandboxFilesApi {
88
90
  downloadUrl(path: string, options?: Omit<SandboxPresignFileParams, "path">): Promise<SandboxPresignedUrl>;
89
91
  private readWire;
90
92
  private writeSingle;
93
+ private withRunAsQuery;
94
+ private withRunAsBody;
91
95
  }
92
96
  export {};
@@ -248,10 +248,15 @@ class SandboxWatchDirHandle {
248
248
  }
249
249
  exports.SandboxWatchDirHandle = SandboxWatchDirHandle;
250
250
  class SandboxFilesApi {
251
- constructor(transport, getConnectionInfo, runtimeProxyOverride) {
251
+ constructor(transport, getConnectionInfo, runtimeProxyOverride, defaultRunAs) {
252
252
  this.transport = transport;
253
253
  this.getConnectionInfo = getConnectionInfo;
254
254
  this.runtimeProxyOverride = runtimeProxyOverride;
255
+ this.defaultRunAs = defaultRunAs;
256
+ }
257
+ withRunAs(runAs) {
258
+ const normalized = runAs?.trim();
259
+ return new SandboxFilesApi(this.transport, this.getConnectionInfo, this.runtimeProxyOverride, normalized ? normalized : undefined);
255
260
  }
256
261
  async exists(path) {
257
262
  try {
@@ -269,17 +274,17 @@ class SandboxFilesApi {
269
274
  }
270
275
  }
271
276
  async getInfo(path) {
272
- const response = await this.transport.requestJSON("/sandbox/files/stat", undefined, { path });
277
+ const response = await this.transport.requestJSON("/sandbox/files/stat", undefined, this.withRunAsQuery({ path }));
273
278
  return normalizeFileInfo(response.file);
274
279
  }
275
280
  async list(path, options = {}) {
276
281
  if (options.depth !== undefined && options.depth < 1) {
277
282
  throw new Error("depth should be at least one");
278
283
  }
279
- const response = await this.transport.requestJSON("/sandbox/files", undefined, {
284
+ const response = await this.transport.requestJSON("/sandbox/files", undefined, this.withRunAsQuery({
280
285
  path,
281
286
  depth: options.depth ?? 1,
282
- });
287
+ }));
283
288
  return response.entries.map(normalizeFileInfo);
284
289
  }
285
290
  async read(path, options = {}) {
@@ -332,7 +337,7 @@ class SandboxFilesApi {
332
337
  }));
333
338
  const response = await this.transport.requestJSON("/sandbox/files/write", {
334
339
  method: "POST",
335
- body: JSON.stringify({ files: encodedFiles }),
340
+ body: this.withRunAsBody({ files: encodedFiles }),
336
341
  headers: {
337
342
  "content-type": "application/json",
338
343
  },
@@ -351,7 +356,7 @@ class SandboxFilesApi {
351
356
  const response = await this.transport.requestJSON("/sandbox/files/upload", {
352
357
  method: "PUT",
353
358
  body,
354
- }, { path });
359
+ }, this.withRunAsQuery({ path }));
355
360
  return {
356
361
  path: response.path,
357
362
  bytesWritten: response.bytesWritten,
@@ -359,13 +364,13 @@ class SandboxFilesApi {
359
364
  }
360
365
  async download(path) {
361
366
  return this.transport.requestBuffer("/sandbox/files/download", undefined, {
362
- path,
367
+ ...this.withRunAsQuery({ path }),
363
368
  });
364
369
  }
365
370
  async makeDir(path, options = {}) {
366
371
  const response = await this.transport.requestJSON("/sandbox/files/mkdir", {
367
372
  method: "POST",
368
- body: JSON.stringify({
373
+ body: this.withRunAsBody({
369
374
  path,
370
375
  parents: options.parents,
371
376
  mode: options.mode,
@@ -379,7 +384,7 @@ class SandboxFilesApi {
379
384
  async rename(oldPath, newPath) {
380
385
  const response = await this.transport.requestJSON("/sandbox/files/move", {
381
386
  method: "POST",
382
- body: JSON.stringify({
387
+ body: this.withRunAsBody({
383
388
  from: oldPath,
384
389
  to: newPath,
385
390
  }),
@@ -392,7 +397,7 @@ class SandboxFilesApi {
392
397
  async remove(path, options = {}) {
393
398
  await this.transport.requestJSON("/sandbox/files/delete", {
394
399
  method: "POST",
395
- body: JSON.stringify({
400
+ body: this.withRunAsBody({
396
401
  path,
397
402
  recursive: options.recursive,
398
403
  }),
@@ -404,7 +409,7 @@ class SandboxFilesApi {
404
409
  async copy(params) {
405
410
  const response = await this.transport.requestJSON("/sandbox/files/copy", {
406
411
  method: "POST",
407
- body: JSON.stringify({
412
+ body: this.withRunAsBody({
408
413
  from: params.source,
409
414
  to: params.destination,
410
415
  recursive: params.recursive,
@@ -419,7 +424,7 @@ class SandboxFilesApi {
419
424
  async chmod(params) {
420
425
  await this.transport.requestJSON("/sandbox/files/chmod", {
421
426
  method: "POST",
422
- body: JSON.stringify(params),
427
+ body: this.withRunAsBody(params),
423
428
  headers: {
424
429
  "content-type": "application/json",
425
430
  },
@@ -428,7 +433,7 @@ class SandboxFilesApi {
428
433
  async chown(params) {
429
434
  await this.transport.requestJSON("/sandbox/files/chown", {
430
435
  method: "POST",
431
- body: JSON.stringify(params),
436
+ body: this.withRunAsBody(params),
432
437
  headers: {
433
438
  "content-type": "application/json",
434
439
  },
@@ -437,7 +442,7 @@ class SandboxFilesApi {
437
442
  async watchDir(path, onEvent, options = {}) {
438
443
  const response = await this.transport.requestJSON("/sandbox/files/watch", {
439
444
  method: "POST",
440
- body: JSON.stringify({
445
+ body: this.withRunAsBody({
441
446
  path,
442
447
  recursive: options.recursive,
443
448
  }),
@@ -451,7 +456,7 @@ class SandboxFilesApi {
451
456
  async uploadUrl(path, options = {}) {
452
457
  return this.transport.requestJSON("/sandbox/files/presign-upload", {
453
458
  method: "POST",
454
- body: JSON.stringify({
459
+ body: this.withRunAsBody({
455
460
  path,
456
461
  expiresInSeconds: options.expiresInSeconds,
457
462
  oneTime: options.oneTime,
@@ -464,7 +469,7 @@ class SandboxFilesApi {
464
469
  async downloadUrl(path, options = {}) {
465
470
  return this.transport.requestJSON("/sandbox/files/presign-download", {
466
471
  method: "POST",
467
- body: JSON.stringify({
472
+ body: this.withRunAsBody({
468
473
  path,
469
474
  expiresInSeconds: options.expiresInSeconds,
470
475
  oneTime: options.oneTime,
@@ -477,7 +482,7 @@ class SandboxFilesApi {
477
482
  async readWire(path, options, encoding) {
478
483
  return this.transport.requestJSON("/sandbox/files/read", {
479
484
  method: "POST",
480
- body: JSON.stringify({
485
+ body: this.withRunAsBody({
481
486
  path,
482
487
  offset: options.offset,
483
488
  length: options.length,
@@ -491,7 +496,7 @@ class SandboxFilesApi {
491
496
  async writeSingle(path, data, encoding, options) {
492
497
  const response = await this.transport.requestJSON("/sandbox/files/write", {
493
498
  method: "POST",
494
- body: JSON.stringify({
499
+ body: this.withRunAsBody({
495
500
  path,
496
501
  data,
497
502
  encoding,
@@ -504,5 +509,23 @@ class SandboxFilesApi {
504
509
  });
505
510
  return normalizeWriteInfo(response.files[0]);
506
511
  }
512
+ withRunAsQuery(params) {
513
+ if (!this.defaultRunAs) {
514
+ return params;
515
+ }
516
+ return {
517
+ ...params,
518
+ runAs: this.defaultRunAs,
519
+ };
520
+ }
521
+ withRunAsBody(body) {
522
+ if (!this.defaultRunAs) {
523
+ return JSON.stringify(body);
524
+ }
525
+ return JSON.stringify({
526
+ ...body,
527
+ runAs: this.defaultRunAs,
528
+ });
529
+ }
507
530
  }
508
531
  exports.SandboxFilesApi = SandboxFilesApi;
@@ -1,5 +1,5 @@
1
1
  import { RuntimeTransport } from "./base";
2
- import { SandboxExecParams, SandboxProcessListParams, SandboxProcessListResponse, SandboxProcessResult, SandboxProcessSignal, SandboxProcessStdinParams, SandboxProcessStreamEvent, SandboxProcessSummary, SandboxProcessWaitParams } from "../types/sandbox";
2
+ import { SandboxExecParams, SandboxExecOptions, SandboxProcessListParams, SandboxProcessListResponse, SandboxProcessResult, SandboxProcessSignal, SandboxProcessStdinParams, SandboxProcessStreamEvent, SandboxProcessSummary, SandboxProcessWaitParams } from "../types/sandbox";
3
3
  export declare class SandboxProcessHandle {
4
4
  private readonly transport;
5
5
  private summary;
@@ -18,7 +18,9 @@ export declare class SandboxProcessHandle {
18
18
  export declare class SandboxProcessesApi {
19
19
  private readonly transport;
20
20
  constructor(transport: RuntimeTransport);
21
+ exec(command: string, options?: SandboxExecOptions): Promise<SandboxProcessResult>;
21
22
  exec(input: SandboxExecParams): Promise<SandboxProcessResult>;
23
+ start(command: string, options?: SandboxExecOptions): Promise<SandboxProcessHandle>;
22
24
  start(input: SandboxExecParams): Promise<SandboxProcessHandle>;
23
25
  get(processId: string): Promise<SandboxProcessHandle>;
24
26
  list(params?: SandboxProcessListParams): Promise<SandboxProcessListResponse>;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SandboxProcessesApi = exports.SandboxProcessHandle = void 0;
4
4
  const DEFAULT_PROCESS_KILL_WAIT_MS = 5000;
5
+ const SHELL_SAFE_TOKEN_PATTERN = /^[A-Za-z0-9_@%+=:,./-]+$/;
5
6
  const normalizeProcessSummary = (process) => ({
6
7
  id: process.id,
7
8
  status: process.status,
@@ -50,15 +51,38 @@ const normalizeStreamEvent = (event) => {
50
51
  }
51
52
  return null;
52
53
  };
54
+ const quoteShellToken = (token) => {
55
+ if (token.length === 0) {
56
+ return "''";
57
+ }
58
+ return SHELL_SAFE_TOKEN_PATTERN.test(token) ? token : `'${token.replace(/'/g, `'"'"'`)}'`;
59
+ };
60
+ const buildShellCommand = (command, args) => {
61
+ if (!args || args.length === 0) {
62
+ return command;
63
+ }
64
+ return [command, ...args].map((token) => quoteShellToken(token)).join(" ");
65
+ };
66
+ const normalizeLegacyProcessParams = (input) => ({
67
+ ...input,
68
+ command: buildShellCommand(input.command, input.args),
69
+ args: undefined,
70
+ useShell: undefined,
71
+ });
53
72
  const buildProcessPayload = (input) => ({
54
73
  command: input.command,
55
- args: input.args,
56
74
  cwd: input.cwd,
57
75
  env: input.env,
58
76
  timeoutMs: input.timeoutMs,
59
77
  timeout_sec: input.timeoutSec,
60
- useShell: input.useShell,
78
+ runAs: input.runAs,
61
79
  });
80
+ const normalizeExecParams = (input, options) => typeof input === "string"
81
+ ? normalizeLegacyProcessParams({
82
+ command: input,
83
+ ...options,
84
+ })
85
+ : normalizeLegacyProcessParams(input);
62
86
  const encodeStdinPayload = (input) => {
63
87
  if (input.data === undefined) {
64
88
  return {
@@ -184,20 +208,22 @@ class SandboxProcessesApi {
184
208
  constructor(transport) {
185
209
  this.transport = transport;
186
210
  }
187
- async exec(input) {
211
+ async exec(input, options) {
212
+ const params = normalizeExecParams(input, options);
188
213
  const response = await this.transport.requestJSON("/sandbox/exec", {
189
214
  method: "POST",
190
- body: JSON.stringify(buildProcessPayload(input)),
215
+ body: JSON.stringify(buildProcessPayload(params)),
191
216
  headers: {
192
217
  "content-type": "application/json",
193
218
  },
194
219
  });
195
220
  return normalizeProcessResult(response.result);
196
221
  }
197
- async start(input) {
222
+ async start(input, options) {
223
+ const params = normalizeExecParams(input, options);
198
224
  const response = await this.transport.requestJSON("/sandbox/processes", {
199
225
  method: "POST",
200
- body: JSON.stringify(buildProcessPayload(input)),
226
+ body: JSON.stringify(buildProcessPayload(params)),
201
227
  headers: {
202
228
  "content-type": "application/json",
203
229
  },
@@ -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, SandboxImageListResponse, SandboxListParams, SandboxListResponse, SandboxMemorySnapshotParams, SandboxMemorySnapshotResult, SandboxProcessResult, SandboxSnapshotListParams, SandboxSnapshotListResponse, SandboxUnexposeResult } from "../types/sandbox";
5
+ import { CreateSandboxParams, SandboxDetail, SandboxExposeParams, SandboxExposeResult, SandboxExecParams, SandboxExecOptions, SandboxImageListResponse, SandboxListParams, SandboxListResponse, SandboxMemorySnapshotParams, SandboxMemorySnapshotResult, SandboxProcessResult, SandboxSnapshotListParams, SandboxSnapshotListResponse, SandboxUnexposeResult } from "../types/sandbox";
6
6
  import { BaseService } from "./base";
7
7
  export declare class SandboxHandle {
8
8
  private readonly service;
@@ -33,7 +33,8 @@ export declare class SandboxHandle {
33
33
  expose(params: SandboxExposeParams): Promise<SandboxExposeResult>;
34
34
  unexpose(port: number): Promise<SandboxUnexposeResult>;
35
35
  getExposedUrl(port: number): string;
36
- exec(input: string | SandboxExecParams): Promise<SandboxProcessResult>;
36
+ exec(input: string, options?: SandboxExecOptions): Promise<SandboxProcessResult>;
37
+ exec(input: SandboxExecParams): Promise<SandboxProcessResult>;
37
38
  getProcess(processId: string): Promise<SandboxProcessHandle>;
38
39
  private hydrate;
39
40
  private resolveRuntimeConnection;
@@ -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
  };
@@ -161,13 +163,11 @@ class SandboxHandle {
161
163
  getExposedUrl(port) {
162
164
  return buildSandboxExposedUrl(this.runtime, port);
163
165
  }
164
- async exec(input) {
165
- const params = typeof input === "string"
166
- ? {
167
- command: input,
168
- }
169
- : input;
170
- return this.processes.exec(params);
166
+ async exec(input, options) {
167
+ if (typeof input === "string") {
168
+ return this.processes.exec(input, options);
169
+ }
170
+ return this.processes.exec(input);
171
171
  }
172
172
  async getProcess(processId) {
173
173
  return this.processes.get(processId);
@@ -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, 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 & {
@@ -138,13 +145,17 @@ export interface SandboxUnexposeResult {
138
145
  export type SandboxProcessStatus = "queued" | "running" | "exited" | "failed" | "killed" | "timed_out";
139
146
  export interface SandboxExecParams {
140
147
  command: string;
148
+ /** @deprecated Legacy compatibility only. Converted into a single shell command string. */
141
149
  args?: string[];
142
150
  cwd?: string;
143
151
  env?: Record<string, string>;
144
152
  timeoutMs?: number;
145
153
  timeoutSec?: number;
154
+ runAs?: string;
155
+ /** @deprecated Ignored for process APIs. Commands always execute via `/bin/sh -lc` server-side. */
146
156
  useShell?: boolean;
147
157
  }
158
+ export type SandboxExecOptions = Omit<SandboxExecParams, "command">;
148
159
  export interface SandboxProcessSummary {
149
160
  id: string;
150
161
  status: SandboxProcessStatus;
@@ -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.0",
3
+ "version": "0.89.2",
4
4
  "description": "Node SDK for Hyperbrowser API",
5
5
  "author": "",
6
6
  "repository": {