@hyperbrowser/sdk 0.92.7 → 1.0.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 +190 -0
- package/dist/client.d.ts +4 -20
- package/dist/client.js +7 -17
- package/dist/error.d.ts +27 -0
- package/dist/error.js +32 -0
- package/dist/image-builds.d.ts +6 -0
- package/dist/image-builds.js +12 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +12 -1
- package/dist/retry.d.ts +14 -0
- package/dist/retry.js +49 -0
- package/dist/sandbox/base.d.ts +27 -0
- package/dist/sandbox/base.js +298 -99
- package/dist/sandbox/files.d.ts +24 -25
- package/dist/sandbox/files.js +146 -37
- package/dist/sandbox/image-build/artifacts.d.ts +16 -0
- package/dist/sandbox/image-build/artifacts.js +16 -0
- package/dist/sandbox/image-build/blake2b.d.ts +2 -0
- package/dist/sandbox/image-build/blake2b.js +89 -0
- package/dist/sandbox/image-build/common.d.ts +19 -0
- package/dist/sandbox/image-build/common.js +109 -0
- package/dist/sandbox/image-build/context.d.ts +43 -0
- package/dist/sandbox/image-build/context.js +599 -0
- package/dist/sandbox/image-build/docker-image.d.ts +34 -0
- package/dist/sandbox/image-build/docker-image.js +472 -0
- package/dist/sandbox/image-build/dockerfile-analysis.d.ts +17 -0
- package/dist/sandbox/image-build/dockerfile-analysis.js +409 -0
- package/dist/sandbox/image-build/dockerignore.d.ts +18 -0
- package/dist/sandbox/image-build/dockerignore.js +275 -0
- package/dist/sandbox/image-build/gzip.d.ts +11 -0
- package/dist/sandbox/image-build/gzip.js +91 -0
- package/dist/sandbox/image-build/image-init.d.ts +5 -0
- package/dist/sandbox/image-build/image-init.js +97 -0
- package/dist/sandbox/image-build/index.d.ts +13 -0
- package/dist/sandbox/image-build/index.js +36 -0
- package/dist/sandbox/image-build/local-docker.d.ts +11 -0
- package/dist/sandbox/image-build/local-docker.js +72 -0
- package/dist/sandbox/image-build/resolution.d.ts +27 -0
- package/dist/sandbox/image-build/resolution.js +137 -0
- package/dist/sandbox/image-build/tar.d.ts +41 -0
- package/dist/sandbox/image-build/tar.js +378 -0
- package/dist/sandbox/image-build/upload.d.ts +10 -0
- package/dist/sandbox/image-build/upload.js +143 -0
- package/dist/sandbox/index.d.ts +2 -1
- package/dist/sandbox/index.js +4 -1
- package/dist/sandbox/process-output.d.ts +36 -0
- package/dist/sandbox/process-output.js +117 -0
- package/dist/sandbox/process.d.ts +25 -1
- package/dist/sandbox/process.js +197 -29
- package/dist/sandbox/terminal.js +9 -5
- package/dist/sandbox/ws.d.ts +4 -1
- package/dist/sandbox/ws.js +33 -7
- package/dist/services/agents/jev-computer-use.d.ts +30 -0
- package/dist/services/agents/jev-computer-use.js +103 -0
- package/dist/services/base.d.ts +2 -0
- package/dist/services/base.js +46 -30
- package/dist/services/normalize.d.ts +3 -0
- package/dist/services/normalize.js +21 -0
- package/dist/services/sandboxes.d.ts +40 -3
- package/dist/services/sandboxes.js +569 -53
- package/dist/services/volumes.js +29 -14
- package/dist/types/agents/jev-computer-use.d.ts +43 -0
- package/dist/types/agents/jev-computer-use.js +2 -0
- package/dist/types/constants.d.ts +5 -2
- package/dist/types/index.d.ts +4 -2
- package/dist/types/sandbox.d.ts +246 -30
- package/dist/types/volume.d.ts +7 -7
- package/package.json +24 -5
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JevComputerUseService = void 0;
|
|
4
|
+
const client_1 = require("../../client");
|
|
5
|
+
const constants_1 = require("../../types/constants");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const base_1 = require("../base");
|
|
8
|
+
class JevComputerUseService extends base_1.BaseService {
|
|
9
|
+
/**
|
|
10
|
+
* Start a new Jev Computer Use task job
|
|
11
|
+
* @param params The parameters for the task job
|
|
12
|
+
*/
|
|
13
|
+
async start(params) {
|
|
14
|
+
try {
|
|
15
|
+
return await this.request("/task/jev", {
|
|
16
|
+
method: "POST",
|
|
17
|
+
body: JSON.stringify(params),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
throw new client_1.HyperbrowserError("Failed to start Jev Computer Use task job", undefined);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the status of a Jev Computer Use task job
|
|
29
|
+
* @param id The ID of the task job to get
|
|
30
|
+
*/
|
|
31
|
+
async getStatus(id) {
|
|
32
|
+
try {
|
|
33
|
+
return await this.request(`/task/jev/${id}/status`);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
throw new client_1.HyperbrowserError(`Failed to get Jev Computer Use task job ${id} status`, undefined);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get the result of a Jev Computer Use task job
|
|
44
|
+
* @param id The ID of the task job to get
|
|
45
|
+
*/
|
|
46
|
+
async get(id) {
|
|
47
|
+
try {
|
|
48
|
+
return await this.request(`/task/jev/${id}`);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
throw new client_1.HyperbrowserError(`Failed to get Jev Computer Use task job ${id}`, undefined);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Stop a Jev Computer Use task job
|
|
59
|
+
* @param id The ID of the task job to stop
|
|
60
|
+
*/
|
|
61
|
+
async stop(id) {
|
|
62
|
+
try {
|
|
63
|
+
return await this.request(`/task/jev/${id}/stop`, {
|
|
64
|
+
method: "PUT",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
throw new client_1.HyperbrowserError(`Failed to stop Jev Computer Use task job ${id}`, undefined);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Start a Jev Computer Use task job and wait for it to complete
|
|
76
|
+
* @param params The parameters for the task job
|
|
77
|
+
*/
|
|
78
|
+
async startAndWait(params) {
|
|
79
|
+
const job = await this.start(params);
|
|
80
|
+
const jobId = job.jobId;
|
|
81
|
+
if (!jobId) {
|
|
82
|
+
throw new client_1.HyperbrowserError("Failed to start Jev Computer Use task job, could not get job ID");
|
|
83
|
+
}
|
|
84
|
+
let failures = 0;
|
|
85
|
+
while (true) {
|
|
86
|
+
try {
|
|
87
|
+
const { status } = await this.getStatus(jobId);
|
|
88
|
+
if (status === "completed" || status === "failed" || status === "stopped") {
|
|
89
|
+
return await this.get(jobId);
|
|
90
|
+
}
|
|
91
|
+
failures = 0;
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
failures++;
|
|
95
|
+
if (failures >= constants_1.POLLING_ATTEMPTS) {
|
|
96
|
+
throw new client_1.HyperbrowserError(`Failed to poll Jev Computer Use task job ${jobId} after ${constants_1.POLLING_ATTEMPTS} attempts: ${error}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
await (0, utils_1.sleep)(2000);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.JevComputerUseService = JevComputerUseService;
|
package/dist/services/base.d.ts
CHANGED
|
@@ -4,5 +4,7 @@ export declare class BaseService {
|
|
|
4
4
|
protected readonly baseUrl: string;
|
|
5
5
|
protected readonly timeout: number;
|
|
6
6
|
constructor(apiKey: string, baseUrl: string, timeout?: number);
|
|
7
|
+
/** Transient GET failures (429/502/503/504, network errors) retry up to three attempts. */
|
|
7
8
|
protected request<T>(path: string, init?: RequestInit, params?: Record<string, string | number | string[] | undefined>, fullUrl?: boolean): Promise<T>;
|
|
9
|
+
private requestOnce;
|
|
8
10
|
}
|
package/dist/services/base.js
CHANGED
|
@@ -5,34 +5,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BaseService = void 0;
|
|
7
7
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const RETRYABLE_NETWORK_CODES = new Set([
|
|
11
|
-
"ECONNRESET",
|
|
12
|
-
"ECONNREFUSED",
|
|
13
|
-
"EAI_AGAIN",
|
|
14
|
-
"ETIMEDOUT",
|
|
15
|
-
"ESOCKETTIMEDOUT",
|
|
16
|
-
]);
|
|
8
|
+
const error_1 = require("../error");
|
|
9
|
+
const retry_1 = require("../retry");
|
|
17
10
|
const getRequestId = (response) => {
|
|
18
11
|
return response.headers.get("x-request-id") || response.headers.get("request-id") || undefined;
|
|
19
12
|
};
|
|
20
|
-
const isRetryableNetworkError = (error) => {
|
|
21
|
-
if (!(error instanceof Error)) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
const networkError = error;
|
|
25
|
-
return (networkError.name === "AbortError" ||
|
|
26
|
-
networkError.type === "request-timeout" ||
|
|
27
|
-
(networkError.code ? RETRYABLE_NETWORK_CODES.has(networkError.code) : false));
|
|
28
|
-
};
|
|
29
13
|
class BaseService {
|
|
30
14
|
constructor(apiKey, baseUrl, timeout = 30000) {
|
|
31
15
|
this.apiKey = apiKey;
|
|
32
16
|
this.baseUrl = baseUrl;
|
|
33
17
|
this.timeout = timeout;
|
|
34
18
|
}
|
|
19
|
+
/** Transient GET failures (429/502/503/504, network errors) retry up to three attempts. */
|
|
35
20
|
async request(path, init, params, fullUrl = false) {
|
|
21
|
+
const method = (init?.method ?? "GET").toUpperCase();
|
|
22
|
+
let failedAttempt = 1;
|
|
23
|
+
for (;;) {
|
|
24
|
+
try {
|
|
25
|
+
return await this.requestOnce(path, init, params, fullUrl);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (init?.signal?.aborted ||
|
|
29
|
+
!(error instanceof error_1.HyperbrowserError) ||
|
|
30
|
+
!(0, retry_1.shouldRetryGet)(method, error, failedAttempt)) {
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
await (0, retry_1.retryDelay)((0, retry_1.getRetryDelayMs)(failedAttempt), init?.signal ?? undefined);
|
|
34
|
+
failedAttempt += 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async requestOnce(path, init, params, fullUrl = false) {
|
|
39
|
+
let response;
|
|
36
40
|
try {
|
|
37
41
|
const url = new URL(fullUrl ? path : `${this.baseUrl}/api${path}`);
|
|
38
42
|
if (params) {
|
|
@@ -52,7 +56,7 @@ class BaseService {
|
|
|
52
56
|
const headerKeys = Object.keys(init?.headers || {});
|
|
53
57
|
const contentTypeKey = headerKeys.find((key) => key.toLowerCase() === "content-type");
|
|
54
58
|
const requestTimeout = init?.timeout ?? this.timeout;
|
|
55
|
-
|
|
59
|
+
response = await (0, node_fetch_1.default)(url.toString(), {
|
|
56
60
|
...init,
|
|
57
61
|
timeout: requestTimeout,
|
|
58
62
|
headers: {
|
|
@@ -74,41 +78,53 @@ class BaseService {
|
|
|
74
78
|
errorMessage =
|
|
75
79
|
errorData.message || errorData.error || `HTTP error! status: ${response.status}`;
|
|
76
80
|
}
|
|
77
|
-
catch {
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (init?.signal?.aborted)
|
|
83
|
+
throw error;
|
|
78
84
|
errorMessage = `HTTP error! status: ${response.status}`;
|
|
79
85
|
}
|
|
80
|
-
throw new
|
|
86
|
+
throw new error_1.HyperbrowserError(errorMessage, {
|
|
81
87
|
statusCode: response.status,
|
|
82
88
|
code: errorCode,
|
|
83
89
|
requestId: getRequestId(response),
|
|
84
|
-
retryable: RETRYABLE_STATUS_CODES.has(response.status),
|
|
90
|
+
retryable: retry_1.RETRYABLE_STATUS_CODES.has(response.status),
|
|
85
91
|
service: "control",
|
|
86
92
|
details: errorDetails,
|
|
93
|
+
method: init?.method ?? "GET",
|
|
94
|
+
path: (0, error_1.errorRequestPath)(path),
|
|
87
95
|
});
|
|
88
96
|
}
|
|
89
|
-
|
|
97
|
+
const text = await response.text();
|
|
98
|
+
if (!text)
|
|
90
99
|
return {};
|
|
91
|
-
}
|
|
92
100
|
try {
|
|
93
|
-
return
|
|
101
|
+
return JSON.parse(text);
|
|
94
102
|
}
|
|
95
|
-
catch {
|
|
96
|
-
throw new
|
|
103
|
+
catch (cause) {
|
|
104
|
+
throw new error_1.HyperbrowserError("Failed to parse JSON response", {
|
|
97
105
|
statusCode: response.status,
|
|
98
106
|
requestId: getRequestId(response),
|
|
99
107
|
retryable: false,
|
|
100
108
|
service: "control",
|
|
109
|
+
cause,
|
|
110
|
+
method: init?.method ?? "GET",
|
|
111
|
+
path: (0, error_1.errorRequestPath)(path),
|
|
101
112
|
});
|
|
102
113
|
}
|
|
103
114
|
}
|
|
104
115
|
catch (error) {
|
|
105
|
-
if (error instanceof
|
|
116
|
+
if (error instanceof error_1.HyperbrowserError) {
|
|
106
117
|
throw error;
|
|
107
118
|
}
|
|
108
|
-
throw new
|
|
109
|
-
|
|
119
|
+
throw new error_1.HyperbrowserError((0, error_1.networkErrorMessage)(error, "Unknown error occurred"), {
|
|
120
|
+
code: init?.signal?.aborted ? "request_aborted" : undefined,
|
|
121
|
+
retryable: !init?.signal?.aborted && (0, retry_1.isRetryableNetworkError)(error),
|
|
122
|
+
method: init?.method ?? "GET",
|
|
123
|
+
path: (0, error_1.errorRequestPath)(path),
|
|
110
124
|
service: "control",
|
|
111
125
|
cause: error,
|
|
126
|
+
statusCode: response?.status,
|
|
127
|
+
requestId: response ? getRequestId(response) : undefined,
|
|
112
128
|
});
|
|
113
129
|
}
|
|
114
130
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optionalInteger = exports.optionalNumber = void 0;
|
|
4
|
+
const error_1 = require("../error");
|
|
5
|
+
/** Nullable numeric wire values used by sandbox and volume endpoints. */
|
|
6
|
+
const optionalNumber = (value, integer = false) => {
|
|
7
|
+
if (value === undefined || value === null)
|
|
8
|
+
return value;
|
|
9
|
+
if (typeof value === "string" && value.trim() === "")
|
|
10
|
+
return null;
|
|
11
|
+
const parsed = typeof value === "string" ? Number(value) : value;
|
|
12
|
+
if (typeof parsed !== "number" ||
|
|
13
|
+
!Number.isFinite(parsed) ||
|
|
14
|
+
(integer && !Number.isSafeInteger(parsed))) {
|
|
15
|
+
throw new error_1.HyperbrowserError("Invalid numeric value in API response", { service: "control" });
|
|
16
|
+
}
|
|
17
|
+
return parsed;
|
|
18
|
+
};
|
|
19
|
+
exports.optionalNumber = optionalNumber;
|
|
20
|
+
const optionalInteger = (value) => (0, exports.optionalNumber)(value, true);
|
|
21
|
+
exports.optionalInteger = optionalInteger;
|
|
@@ -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 { 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";
|
|
5
|
+
import { BuildSandboxImageFromDockerImageOptions, BuildSandboxImageFromDockerfileOptions, CompleteSandboxImageBuildParams, CreateSandboxImageBuildParams, CreateSandboxParams, StartSandboxFromSnapshotParams, SandboxRuntimeSession, SandboxRuntimeTarget, GetOrBuildSandboxImageOptions, ReuseSandboxDockerImageParams, SandboxDockerImageReuseResult, SandboxImageBuildResolution, SandboxImageBuildWaitOptions, SandboxImageSummary, 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;
|
|
@@ -44,6 +44,9 @@ export declare class SandboxHandle {
|
|
|
44
44
|
private resolveRuntimeConnection;
|
|
45
45
|
private resolveRuntimeSocketConnectionInfo;
|
|
46
46
|
private isRuntimeSessionExpiring;
|
|
47
|
+
createRuntimeSession(options?: {
|
|
48
|
+
forceRefresh?: boolean;
|
|
49
|
+
}): Promise<SandboxRuntimeSession>;
|
|
47
50
|
private ensureRuntimeSession;
|
|
48
51
|
private applyRuntimeSession;
|
|
49
52
|
private clearRuntimeSession;
|
|
@@ -55,6 +58,8 @@ export declare class SandboxesService extends BaseService {
|
|
|
55
58
|
readonly runtimeProxyOverride?: string;
|
|
56
59
|
constructor(apiKey: string, baseUrl: string, timeout: number, runtimeProxyOverride?: string);
|
|
57
60
|
create(params: CreateSandboxParams): Promise<SandboxHandle>;
|
|
61
|
+
startFromSnapshot(params: StartSandboxFromSnapshotParams): Promise<SandboxHandle>;
|
|
62
|
+
getRuntimeSession(id: string): Promise<SandboxRuntimeSession>;
|
|
58
63
|
get(id: string): Promise<SandboxHandle>;
|
|
59
64
|
connect(id: string): Promise<SandboxHandle>;
|
|
60
65
|
list(params?: SandboxListParams): Promise<SandboxListResponse>;
|
|
@@ -65,14 +70,46 @@ export declare class SandboxesService extends BaseService {
|
|
|
65
70
|
getDetail(id: string): Promise<SandboxDetail>;
|
|
66
71
|
attach(detail: SandboxDetail): SandboxHandle;
|
|
67
72
|
createMemorySnapshot(id: string, params?: SandboxMemorySnapshotParams): Promise<SandboxMemorySnapshotResult>;
|
|
68
|
-
expose(id: string, params: SandboxExposeParams): Promise<SandboxExposeResult>;
|
|
73
|
+
expose(id: string, params: SandboxExposeParams, runtime?: SandboxRuntimeTarget): Promise<SandboxExposeResult>;
|
|
69
74
|
getSnapshot(snapshot: string): Promise<SandboxSnapshotSummary>;
|
|
70
75
|
deleteSnapshot(snapshot: string): Promise<SandboxSnapshotDeleteResult>;
|
|
71
76
|
createImageBuild(params: CreateSandboxImageBuildParams): Promise<SandboxImageBuildCreateResult>;
|
|
72
|
-
getImageBuild(buildId: string
|
|
77
|
+
getImageBuild(buildId: string, options?: {
|
|
78
|
+
signal?: AbortSignal;
|
|
79
|
+
}): Promise<SandboxImageBuild>;
|
|
73
80
|
listImageBuilds(params?: SandboxImageBuildListParams): Promise<SandboxImageBuildListResponse>;
|
|
74
81
|
completeImageBuild(buildId: string, params: CompleteSandboxImageBuildParams): Promise<SandboxImageBuild>;
|
|
75
82
|
cancelImageBuild(buildId: string): Promise<SandboxImageBuild>;
|
|
83
|
+
reuseDockerImage(params: ReuseSandboxDockerImageParams): Promise<SandboxDockerImageReuseResult>;
|
|
84
|
+
/** Find an exact ready team image, including revisions awaiting backup. */
|
|
85
|
+
findReadyImage(imageName: string): Promise<SandboxImageSummary | null>;
|
|
86
|
+
/** Poll an image build until it completes, rejecting on failure or timeout. */
|
|
87
|
+
waitForImageBuild(buildId: string, options?: SandboxImageBuildWaitOptions): Promise<SandboxImageBuild>;
|
|
88
|
+
/** Import a local Docker image as reusable layers, reusing exact cached imports. */
|
|
89
|
+
buildImageFromDockerImage(options: BuildSandboxImageFromDockerImageOptions): Promise<SandboxImageBuild>;
|
|
90
|
+
/**
|
|
91
|
+
* Build a Dockerfile into a sandbox image.
|
|
92
|
+
*
|
|
93
|
+
* Remote builds (default) upload only the effective build context and build
|
|
94
|
+
* on Hyperbrowser. `remote: false` builds with local Docker and imports the
|
|
95
|
+
* resulting image instead.
|
|
96
|
+
*/
|
|
97
|
+
buildImageFromDockerfile(options: BuildSandboxImageFromDockerfileOptions): Promise<SandboxImageBuild>;
|
|
98
|
+
/**
|
|
99
|
+
* Reuse, join, or build content-derived remote Dockerfile/image inputs.
|
|
100
|
+
*
|
|
101
|
+
* Supply exactly one of `contextPath` or `dockerImage`. Names include source
|
|
102
|
+
* contents, platform and image initialization overrides. `forceBuild` skips
|
|
103
|
+
* ready-image lookup, but joins matching active builds and retains builder
|
|
104
|
+
* layer/artifact caches. Canceling polling never cancels the backend build.
|
|
105
|
+
* `waitTimeout` applies to this caller's polling, independently of uploads.
|
|
106
|
+
* This composes existing APIs; lookup plus creation is not server-atomic.
|
|
107
|
+
*/
|
|
108
|
+
getOrBuildImage(options: GetOrBuildSandboxImageOptions): Promise<SandboxImageBuildResolution>;
|
|
109
|
+
private buildImageFromRemoteDockerfile;
|
|
110
|
+
/** Create a build, upload requested artifacts, complete it, and optionally wait. */
|
|
111
|
+
private submitImageBuild;
|
|
112
|
+
private completeImageBuildResilient;
|
|
76
113
|
updateNetwork(id: string, policy: SandboxNetworkPolicyPatch): Promise<SandboxNetworkUpdateResult>;
|
|
77
114
|
unexpose(id: string, port: number): Promise<SandboxUnexposeResult>;
|
|
78
115
|
private createDetail;
|