@hyperbrowser/sdk 0.87.2 → 0.88.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/README.md +74 -0
- package/dist/sandbox/files.js +23 -23
- package/dist/sandbox/terminal.d.ts +1 -1
- package/dist/sandbox/terminal.js +8 -2
- package/dist/services/sandboxes.d.ts +5 -2
- package/dist/services/sandboxes.js +43 -12
- package/dist/types/index.d.ts +1 -1
- package/dist/types/sandbox.d.ts +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -234,3 +234,77 @@ await sandbox.stop();
|
|
|
234
234
|
```
|
|
235
235
|
|
|
236
236
|
`connect()` refreshes runtime auth and throws if the sandbox is no longer running.
|
|
237
|
+
|
|
238
|
+
Create a sandbox with pre-exposed ports:
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
const sandbox = await client.sandboxes.create({
|
|
242
|
+
imageName: "node",
|
|
243
|
+
exposedPorts: [{ port: 3000, auth: true }],
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
console.log(sandbox.exposedPorts[0].browserUrl);
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
List sandboxes with time-range and search filters:
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
const sandboxes = await client.sandboxes.list({
|
|
253
|
+
status: "active",
|
|
254
|
+
start: Date.now() - 60 * 60 * 1000,
|
|
255
|
+
end: Date.now(),
|
|
256
|
+
search: "sbx_",
|
|
257
|
+
limit: 25,
|
|
258
|
+
});
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
List snapshots for a specific image:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
const snapshots = await client.sandboxes.listSnapshots({
|
|
265
|
+
imageName: "node",
|
|
266
|
+
status: "created",
|
|
267
|
+
limit: 10,
|
|
268
|
+
});
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Expose and unexpose ports:
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
const sandbox = await client.sandboxes.create({ imageName: "node" });
|
|
275
|
+
|
|
276
|
+
const exposure = await sandbox.expose({ port: 8080, auth: true });
|
|
277
|
+
console.log(exposure.url, exposure.browserUrl, exposure.browserUrlExpiresAt);
|
|
278
|
+
|
|
279
|
+
await sandbox.unexpose(8080);
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Write batch files with per-entry options:
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
await sandbox.files.write([
|
|
286
|
+
{
|
|
287
|
+
path: "/tmp/hello.txt",
|
|
288
|
+
data: "hello",
|
|
289
|
+
append: true,
|
|
290
|
+
mode: "600",
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
path: "/tmp/payload.bin",
|
|
294
|
+
data: Buffer.from([1, 2, 3]).toString("base64"),
|
|
295
|
+
encoding: "base64",
|
|
296
|
+
},
|
|
297
|
+
]);
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Resume a PTY attach from a cursor:
|
|
301
|
+
|
|
302
|
+
```typescript
|
|
303
|
+
const terminal = await sandbox.terminal.create({
|
|
304
|
+
command: "bash",
|
|
305
|
+
rows: 24,
|
|
306
|
+
cols: 80,
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
const connection = await terminal.attach(10);
|
|
310
|
+
```
|
package/dist/sandbox/files.js
CHANGED
|
@@ -86,42 +86,40 @@ const bufferFromReadableStream = async (stream) => {
|
|
|
86
86
|
}
|
|
87
87
|
return buffer_1.Buffer.concat(chunks);
|
|
88
88
|
};
|
|
89
|
-
const
|
|
89
|
+
const encodeBufferData = (buffer, encoding) => {
|
|
90
|
+
if (encoding === "utf8") {
|
|
91
|
+
return {
|
|
92
|
+
data: buffer.toString("utf8"),
|
|
93
|
+
encoding,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
data: buffer.toString("base64"),
|
|
98
|
+
encoding,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
const encodeWriteData = async (data, encoding) => {
|
|
90
102
|
if (typeof data === "string") {
|
|
103
|
+
const resolvedEncoding = encoding ?? "utf8";
|
|
91
104
|
return {
|
|
92
105
|
data,
|
|
93
|
-
encoding:
|
|
106
|
+
encoding: resolvedEncoding,
|
|
94
107
|
};
|
|
95
108
|
}
|
|
96
109
|
if (buffer_1.Buffer.isBuffer(data)) {
|
|
97
|
-
return
|
|
98
|
-
data: data.toString("base64"),
|
|
99
|
-
encoding: "base64",
|
|
100
|
-
};
|
|
110
|
+
return encodeBufferData(data, encoding ?? "base64");
|
|
101
111
|
}
|
|
102
112
|
if (data instanceof Uint8Array) {
|
|
103
|
-
return
|
|
104
|
-
data: buffer_1.Buffer.from(data).toString("base64"),
|
|
105
|
-
encoding: "base64",
|
|
106
|
-
};
|
|
113
|
+
return encodeBufferData(buffer_1.Buffer.from(data), encoding ?? "base64");
|
|
107
114
|
}
|
|
108
115
|
if (data instanceof ArrayBuffer) {
|
|
109
|
-
return
|
|
110
|
-
data: buffer_1.Buffer.from(data).toString("base64"),
|
|
111
|
-
encoding: "base64",
|
|
112
|
-
};
|
|
116
|
+
return encodeBufferData(buffer_1.Buffer.from(data), encoding ?? "base64");
|
|
113
117
|
}
|
|
114
118
|
if (data instanceof buffer_1.Blob) {
|
|
115
|
-
return
|
|
116
|
-
data: buffer_1.Buffer.from(await data.arrayBuffer()).toString("base64"),
|
|
117
|
-
encoding: "base64",
|
|
118
|
-
};
|
|
119
|
+
return encodeBufferData(buffer_1.Buffer.from(await data.arrayBuffer()), encoding ?? "base64");
|
|
119
120
|
}
|
|
120
121
|
if (isReadableStreamLike(data)) {
|
|
121
|
-
return
|
|
122
|
-
data: (await bufferFromReadableStream(data)).toString("base64"),
|
|
123
|
-
encoding: "base64",
|
|
124
|
-
};
|
|
122
|
+
return encodeBufferData(await bufferFromReadableStream(data), encoding ?? "base64");
|
|
125
123
|
}
|
|
126
124
|
throw new Error("Unsupported write data type");
|
|
127
125
|
};
|
|
@@ -327,7 +325,9 @@ class SandboxFilesApi {
|
|
|
327
325
|
}
|
|
328
326
|
return {
|
|
329
327
|
path: file.path,
|
|
330
|
-
...(await encodeWriteData(file.data)),
|
|
328
|
+
...(await encodeWriteData(file.data, file.encoding)),
|
|
329
|
+
append: file.append,
|
|
330
|
+
mode: file.mode,
|
|
331
331
|
};
|
|
332
332
|
}));
|
|
333
333
|
const response = await this.transport.requestJSON("/sandbox/files/write", {
|
|
@@ -32,7 +32,7 @@ export declare class SandboxTerminalHandle {
|
|
|
32
32
|
kill(signal: string): Promise<SandboxTerminalStatus>;
|
|
33
33
|
kill(params: SandboxTerminalKillParams): Promise<SandboxTerminalStatus>;
|
|
34
34
|
resize(rows: number, cols: number): Promise<SandboxTerminalStatus>;
|
|
35
|
-
attach(): Promise<SandboxTerminalConnection>;
|
|
35
|
+
attach(cursor?: number | string): Promise<SandboxTerminalConnection>;
|
|
36
36
|
}
|
|
37
37
|
export declare class SandboxTerminalApi {
|
|
38
38
|
private readonly transport;
|
package/dist/sandbox/terminal.js
CHANGED
|
@@ -179,9 +179,15 @@ class SandboxTerminalHandle {
|
|
|
179
179
|
this.status = normalizeTerminalStatus(response.pty);
|
|
180
180
|
return this.current;
|
|
181
181
|
}
|
|
182
|
-
async attach() {
|
|
182
|
+
async attach(cursor) {
|
|
183
183
|
const connectionInfo = await this.getConnectionInfo();
|
|
184
|
-
const
|
|
184
|
+
const query = new URLSearchParams({
|
|
185
|
+
sessionId: connectionInfo.sandboxId,
|
|
186
|
+
});
|
|
187
|
+
if (cursor !== undefined) {
|
|
188
|
+
query.set("cursor", String(cursor));
|
|
189
|
+
}
|
|
190
|
+
const target = (0, ws_2.toWebSocketUrl)(connectionInfo.baseUrl, `/sandbox/pty/${this.id}/ws?${query.toString()}`, this.runtimeProxyOverride);
|
|
185
191
|
const headers = {
|
|
186
192
|
Authorization: `Bearer ${connectionInfo.token}`,
|
|
187
193
|
};
|
|
@@ -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,
|
|
5
|
+
import { CreateSandboxParams, SandboxDetail, SandboxExposeParams, SandboxExposeResult, SandboxExecParams, 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;
|
|
@@ -20,6 +20,7 @@ export declare class SandboxHandle {
|
|
|
20
20
|
get runtime(): SandboxDetail["runtime"];
|
|
21
21
|
get tokenExpiresAt(): string | null;
|
|
22
22
|
get sessionUrl(): string;
|
|
23
|
+
get exposedPorts(): SandboxExposeResult[];
|
|
23
24
|
toJSON(): SandboxDetail;
|
|
24
25
|
info(): Promise<SandboxDetail>;
|
|
25
26
|
refresh(): Promise<SandboxHandle>;
|
|
@@ -27,6 +28,7 @@ export declare class SandboxHandle {
|
|
|
27
28
|
stop(): Promise<BasicResponse>;
|
|
28
29
|
createMemorySnapshot(params?: SandboxMemorySnapshotParams): Promise<SandboxMemorySnapshotResult>;
|
|
29
30
|
expose(params: SandboxExposeParams): Promise<SandboxExposeResult>;
|
|
31
|
+
unexpose(port: number): Promise<SandboxUnexposeResult>;
|
|
30
32
|
getExposedUrl(port: number): string;
|
|
31
33
|
exec(input: string | SandboxExecParams): Promise<SandboxProcessResult>;
|
|
32
34
|
getProcess(processId: string): Promise<SandboxProcessHandle>;
|
|
@@ -54,6 +56,7 @@ export declare class SandboxesService extends BaseService {
|
|
|
54
56
|
getDetail(id: string): Promise<SandboxDetail>;
|
|
55
57
|
attach(detail: SandboxDetail): SandboxHandle;
|
|
56
58
|
createMemorySnapshot(id: string, params?: SandboxMemorySnapshotParams): Promise<SandboxMemorySnapshotResult>;
|
|
57
|
-
expose(id: string, params: SandboxExposeParams
|
|
59
|
+
expose(id: string, params: SandboxExposeParams): Promise<SandboxExposeResult>;
|
|
60
|
+
unexpose(id: string, port: number): Promise<SandboxUnexposeResult>;
|
|
58
61
|
private createDetail;
|
|
59
62
|
}
|
|
@@ -9,10 +9,13 @@ const terminal_1 = require("../sandbox/terminal");
|
|
|
9
9
|
const base_2 = require("./base");
|
|
10
10
|
const RUNTIME_SESSION_REFRESH_BUFFER_MS = 60000;
|
|
11
11
|
const buildSandboxExposedUrl = (runtime, port) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const baseUrl = new URL(runtime.baseUrl);
|
|
13
|
+
const authority = baseUrl.port
|
|
14
|
+
? `${port}-${runtime.host}:${baseUrl.port}`
|
|
15
|
+
: `${port}-${runtime.host}`;
|
|
16
|
+
return new URL("/", `${baseUrl.protocol}//${authority}`).toString();
|
|
15
17
|
};
|
|
18
|
+
const upsertExposedPort = (exposedPorts, updated) => [...exposedPorts.filter((entry) => entry.port !== updated.port), updated].sort((left, right) => left.port - right.port);
|
|
16
19
|
class SandboxHandle {
|
|
17
20
|
constructor(service, detail) {
|
|
18
21
|
this.service = service;
|
|
@@ -42,6 +45,9 @@ class SandboxHandle {
|
|
|
42
45
|
get sessionUrl() {
|
|
43
46
|
return this.detail.sessionUrl;
|
|
44
47
|
}
|
|
48
|
+
get exposedPorts() {
|
|
49
|
+
return (this.detail.exposedPorts ?? []).map((entry) => ({ ...entry }));
|
|
50
|
+
}
|
|
45
51
|
toJSON() {
|
|
46
52
|
return { ...this.detail };
|
|
47
53
|
}
|
|
@@ -67,7 +73,20 @@ class SandboxHandle {
|
|
|
67
73
|
return this.service.createMemorySnapshot(this.id, params);
|
|
68
74
|
}
|
|
69
75
|
async expose(params) {
|
|
70
|
-
|
|
76
|
+
const exposure = await this.service.expose(this.id, params);
|
|
77
|
+
this.detail = {
|
|
78
|
+
...this.detail,
|
|
79
|
+
exposedPorts: upsertExposedPort(this.detail.exposedPorts ?? [], exposure),
|
|
80
|
+
};
|
|
81
|
+
return exposure;
|
|
82
|
+
}
|
|
83
|
+
async unexpose(port) {
|
|
84
|
+
const response = await this.service.unexpose(this.id, port);
|
|
85
|
+
this.detail = {
|
|
86
|
+
...this.detail,
|
|
87
|
+
exposedPorts: (this.detail.exposedPorts ?? []).filter((entry) => entry.port !== port),
|
|
88
|
+
};
|
|
89
|
+
return response;
|
|
71
90
|
}
|
|
72
91
|
getExposedUrl(port) {
|
|
73
92
|
return buildSandboxExposedUrl(this.runtime, port);
|
|
@@ -198,6 +217,9 @@ class SandboxesService extends base_2.BaseService {
|
|
|
198
217
|
try {
|
|
199
218
|
return await this.request("/sandboxes", undefined, {
|
|
200
219
|
status: params.status,
|
|
220
|
+
start: params.start,
|
|
221
|
+
end: params.end,
|
|
222
|
+
search: params.search,
|
|
201
223
|
page: params.page,
|
|
202
224
|
limit: params.limit,
|
|
203
225
|
});
|
|
@@ -224,6 +246,7 @@ class SandboxesService extends base_2.BaseService {
|
|
|
224
246
|
try {
|
|
225
247
|
return await this.request("/snapshots", undefined, {
|
|
226
248
|
status: params.status,
|
|
249
|
+
imageName: params.imageName,
|
|
227
250
|
limit: params.limit,
|
|
228
251
|
});
|
|
229
252
|
}
|
|
@@ -275,18 +298,12 @@ class SandboxesService extends base_2.BaseService {
|
|
|
275
298
|
throw new client_1.HyperbrowserError(`Failed to create memory snapshot for sandbox ${id}`, undefined);
|
|
276
299
|
}
|
|
277
300
|
}
|
|
278
|
-
async expose(id, params
|
|
301
|
+
async expose(id, params) {
|
|
279
302
|
try {
|
|
280
|
-
|
|
303
|
+
return await this.request(`/sandbox/${id}/expose`, {
|
|
281
304
|
method: "POST",
|
|
282
305
|
body: JSON.stringify(params),
|
|
283
306
|
});
|
|
284
|
-
const targetRuntime = runtime ?? (await this.getDetail(id)).runtime;
|
|
285
|
-
return {
|
|
286
|
-
port: response.port,
|
|
287
|
-
auth: response.auth,
|
|
288
|
-
url: buildSandboxExposedUrl(targetRuntime, response.port),
|
|
289
|
-
};
|
|
290
307
|
}
|
|
291
308
|
catch (error) {
|
|
292
309
|
if (error instanceof client_1.HyperbrowserError) {
|
|
@@ -295,6 +312,20 @@ class SandboxesService extends base_2.BaseService {
|
|
|
295
312
|
throw new client_1.HyperbrowserError(`Failed to expose port ${params.port} for sandbox ${id}`);
|
|
296
313
|
}
|
|
297
314
|
}
|
|
315
|
+
async unexpose(id, port) {
|
|
316
|
+
try {
|
|
317
|
+
return await this.request(`/sandbox/${id}/unexpose`, {
|
|
318
|
+
method: "POST",
|
|
319
|
+
body: JSON.stringify({ port }),
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
324
|
+
throw error;
|
|
325
|
+
}
|
|
326
|
+
throw new client_1.HyperbrowserError(`Failed to unexpose port ${port} for sandbox ${id}`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
298
329
|
async createDetail(params) {
|
|
299
330
|
try {
|
|
300
331
|
return await this.request("/sandbox", {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ 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, 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, 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";
|
|
12
12
|
export { CreateProfileParams, ProfileResponse, CreateProfileResponse, ProfileListParams, ProfileListResponse, } from "./profile";
|
|
13
13
|
export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
|
|
14
14
|
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";
|
package/dist/types/sandbox.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface Sandbox {
|
|
|
28
28
|
duration: number;
|
|
29
29
|
proxyBytesUsed: number;
|
|
30
30
|
runtime: SandboxRuntimeTarget;
|
|
31
|
+
exposedPorts: SandboxExposeResult[];
|
|
31
32
|
}
|
|
32
33
|
export interface SandboxDetail extends Sandbox {
|
|
33
34
|
token: string | null;
|
|
@@ -36,6 +37,7 @@ export interface SandboxDetail extends Sandbox {
|
|
|
36
37
|
interface SandboxCreateCommonParams {
|
|
37
38
|
region?: SessionRegion;
|
|
38
39
|
enableRecording?: boolean;
|
|
40
|
+
exposedPorts?: SandboxExposeParams[];
|
|
39
41
|
timeoutMinutes?: number;
|
|
40
42
|
}
|
|
41
43
|
export type CreateSandboxParams = (SandboxCreateCommonParams & {
|
|
@@ -51,6 +53,9 @@ export type CreateSandboxParams = (SandboxCreateCommonParams & {
|
|
|
51
53
|
});
|
|
52
54
|
export interface SandboxListParams {
|
|
53
55
|
status?: SandboxStatus;
|
|
56
|
+
start?: number;
|
|
57
|
+
end?: number;
|
|
58
|
+
search?: string;
|
|
54
59
|
page?: number;
|
|
55
60
|
limit?: number;
|
|
56
61
|
}
|
|
@@ -88,6 +93,7 @@ export interface SandboxSnapshotSummary {
|
|
|
88
93
|
}
|
|
89
94
|
export interface SandboxSnapshotListParams {
|
|
90
95
|
status?: SandboxSnapshotStatus;
|
|
96
|
+
imageName?: string;
|
|
91
97
|
limit?: number;
|
|
92
98
|
}
|
|
93
99
|
export interface SandboxSnapshotListResponse {
|
|
@@ -113,6 +119,12 @@ export interface SandboxExposeResult {
|
|
|
113
119
|
port: number;
|
|
114
120
|
auth: boolean;
|
|
115
121
|
url: string;
|
|
122
|
+
browserUrl?: string;
|
|
123
|
+
browserUrlExpiresAt?: string | null;
|
|
124
|
+
}
|
|
125
|
+
export interface SandboxUnexposeResult {
|
|
126
|
+
port: number;
|
|
127
|
+
exposed: boolean;
|
|
116
128
|
}
|
|
117
129
|
export type SandboxProcessStatus = "queued" | "running" | "exited" | "failed" | "killed" | "timed_out";
|
|
118
130
|
export interface SandboxExecParams {
|
|
@@ -206,6 +218,9 @@ export type SandboxFileWriteData = string | Uint8Array | Buffer | ArrayBuffer |
|
|
|
206
218
|
export interface SandboxFileWriteEntry {
|
|
207
219
|
path: string;
|
|
208
220
|
data: SandboxFileWriteData;
|
|
221
|
+
encoding?: "utf8" | "base64";
|
|
222
|
+
append?: boolean;
|
|
223
|
+
mode?: string;
|
|
209
224
|
}
|
|
210
225
|
export interface SandboxFileTextWriteOptions {
|
|
211
226
|
append?: boolean;
|