tensorlake 0.4.40 → 0.4.41
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/bin/tensorlake-create-sandbox-image.cjs +6 -5
- package/dist/bin/darwin-arm64/tensorlake +0 -0
- package/dist/bin/darwin-arm64/tl +0 -0
- package/dist/bin/linux-x64/tensorlake +0 -0
- package/dist/bin/linux-x64/tl +0 -0
- package/dist/bin/win32-x64/tensorlake.exe +0 -0
- package/dist/bin/win32-x64/tl.exe +0 -0
- package/dist/index.cjs +1204 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -239
- package/dist/index.d.ts +56 -239
- package/dist/index.js +1188 -36
- package/dist/index.js.map +1 -1
- package/dist/sandbox-image-DKPhc4Lv.d.cts +375 -0
- package/dist/sandbox-image-DKPhc4Lv.d.ts +375 -0
- package/dist/sandbox-image.cjs +2105 -0
- package/dist/sandbox-image.cjs.map +1 -0
- package/dist/sandbox-image.d.cts +1 -0
- package/dist/sandbox-image.d.ts +1 -0
- package/dist/sandbox-image.js +2065 -0
- package/dist/sandbox-image.js.map +1 -0
- package/package.json +5 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,242 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
RUNNING = "running",
|
|
4
|
-
SNAPSHOTTING = "snapshotting",
|
|
5
|
-
SUSPENDED = "suspended",
|
|
6
|
-
TERMINATED = "terminated"
|
|
7
|
-
}
|
|
8
|
-
declare enum SnapshotStatus {
|
|
9
|
-
IN_PROGRESS = "in_progress",
|
|
10
|
-
COMPLETED = "completed",
|
|
11
|
-
FAILED = "failed"
|
|
12
|
-
}
|
|
13
|
-
declare enum ProcessStatus {
|
|
14
|
-
RUNNING = "running",
|
|
15
|
-
EXITED = "exited",
|
|
16
|
-
SIGNALED = "signaled"
|
|
17
|
-
}
|
|
18
|
-
declare enum StdinMode {
|
|
19
|
-
CLOSED = "closed",
|
|
20
|
-
PIPE = "pipe"
|
|
21
|
-
}
|
|
22
|
-
declare enum OutputMode {
|
|
23
|
-
CAPTURE = "capture",
|
|
24
|
-
DISCARD = "discard"
|
|
25
|
-
}
|
|
26
|
-
declare enum ContainerState {
|
|
27
|
-
IDLE = "Idle",
|
|
28
|
-
RUNNING = "Running"
|
|
29
|
-
}
|
|
30
|
-
interface ContainerResourcesInfo {
|
|
31
|
-
cpus: number;
|
|
32
|
-
memoryMb: number;
|
|
33
|
-
ephemeralDiskMb: number;
|
|
34
|
-
}
|
|
35
|
-
interface NetworkConfig {
|
|
36
|
-
allowInternetAccess: boolean;
|
|
37
|
-
allowOut: string[];
|
|
38
|
-
denyOut: string[];
|
|
39
|
-
}
|
|
40
|
-
interface CreateSandboxOptions {
|
|
41
|
-
image?: string;
|
|
42
|
-
cpus?: number;
|
|
43
|
-
memoryMb?: number;
|
|
44
|
-
ephemeralDiskMb?: number;
|
|
45
|
-
secretNames?: string[];
|
|
46
|
-
timeoutSecs?: number;
|
|
47
|
-
entrypoint?: string[];
|
|
48
|
-
allowInternetAccess?: boolean;
|
|
49
|
-
allowOut?: string[];
|
|
50
|
-
denyOut?: string[];
|
|
51
|
-
snapshotId?: string;
|
|
52
|
-
/** Optional name for the sandbox. Named sandboxes support suspend/resume. When absent the sandbox is ephemeral. */
|
|
53
|
-
name?: string;
|
|
54
|
-
}
|
|
55
|
-
interface UpdateSandboxOptions {
|
|
56
|
-
/** New name for the sandbox. Naming an ephemeral sandbox enables suspend/resume. */
|
|
57
|
-
name?: string;
|
|
58
|
-
}
|
|
59
|
-
interface CreateSandboxResponse {
|
|
60
|
-
sandboxId: string;
|
|
61
|
-
status: SandboxStatus;
|
|
62
|
-
}
|
|
63
|
-
interface SandboxInfo {
|
|
64
|
-
sandboxId: string;
|
|
65
|
-
namespace: string;
|
|
66
|
-
status: SandboxStatus;
|
|
67
|
-
image?: string;
|
|
68
|
-
resources: ContainerResourcesInfo;
|
|
69
|
-
secretNames: string[];
|
|
70
|
-
timeoutSecs?: number;
|
|
71
|
-
entrypoint?: string[];
|
|
72
|
-
network?: NetworkConfig;
|
|
73
|
-
poolId?: string;
|
|
74
|
-
outcome?: string;
|
|
75
|
-
createdAt?: Date;
|
|
76
|
-
terminatedAt?: Date;
|
|
77
|
-
name?: string;
|
|
78
|
-
}
|
|
79
|
-
interface CreateSnapshotResponse {
|
|
80
|
-
snapshotId: string;
|
|
81
|
-
status: SnapshotStatus;
|
|
82
|
-
}
|
|
83
|
-
interface SnapshotInfo {
|
|
84
|
-
snapshotId: string;
|
|
85
|
-
namespace: string;
|
|
86
|
-
sandboxId: string;
|
|
87
|
-
baseImage: string;
|
|
88
|
-
status: SnapshotStatus;
|
|
89
|
-
error?: string;
|
|
90
|
-
snapshotUri?: string;
|
|
91
|
-
sizeBytes?: number;
|
|
92
|
-
createdAt?: Date;
|
|
93
|
-
}
|
|
94
|
-
interface SnapshotAndWaitOptions {
|
|
95
|
-
timeout?: number;
|
|
96
|
-
pollInterval?: number;
|
|
97
|
-
}
|
|
98
|
-
interface CreatePoolOptions {
|
|
99
|
-
image: string;
|
|
100
|
-
cpus?: number;
|
|
101
|
-
memoryMb?: number;
|
|
102
|
-
ephemeralDiskMb?: number;
|
|
103
|
-
secretNames?: string[];
|
|
104
|
-
timeoutSecs?: number;
|
|
105
|
-
entrypoint?: string[];
|
|
106
|
-
maxContainers?: number;
|
|
107
|
-
warmContainers?: number;
|
|
108
|
-
}
|
|
109
|
-
interface UpdatePoolOptions {
|
|
110
|
-
image: string;
|
|
111
|
-
cpus?: number;
|
|
112
|
-
memoryMb?: number;
|
|
113
|
-
ephemeralDiskMb?: number;
|
|
114
|
-
secretNames?: string[];
|
|
115
|
-
timeoutSecs?: number;
|
|
116
|
-
entrypoint?: string[];
|
|
117
|
-
maxContainers?: number;
|
|
118
|
-
warmContainers?: number;
|
|
119
|
-
}
|
|
120
|
-
interface CreateSandboxPoolResponse {
|
|
121
|
-
poolId: string;
|
|
122
|
-
namespace: string;
|
|
123
|
-
}
|
|
124
|
-
interface PoolContainerInfo {
|
|
125
|
-
id: string;
|
|
126
|
-
state: string;
|
|
127
|
-
sandboxId?: string;
|
|
128
|
-
executorId: string;
|
|
129
|
-
}
|
|
130
|
-
interface SandboxPoolInfo {
|
|
131
|
-
poolId: string;
|
|
132
|
-
namespace: string;
|
|
133
|
-
image: string;
|
|
134
|
-
resources: ContainerResourcesInfo;
|
|
135
|
-
secretNames: string[];
|
|
136
|
-
timeoutSecs: number;
|
|
137
|
-
entrypoint?: string[];
|
|
138
|
-
maxContainers?: number;
|
|
139
|
-
warmContainers?: number;
|
|
140
|
-
containers?: PoolContainerInfo[];
|
|
141
|
-
createdAt?: Date;
|
|
142
|
-
updatedAt?: Date;
|
|
143
|
-
}
|
|
144
|
-
interface StartProcessOptions {
|
|
145
|
-
args?: string[];
|
|
146
|
-
env?: Record<string, string>;
|
|
147
|
-
workingDir?: string;
|
|
148
|
-
stdinMode?: StdinMode;
|
|
149
|
-
stdoutMode?: OutputMode;
|
|
150
|
-
stderrMode?: OutputMode;
|
|
151
|
-
}
|
|
152
|
-
interface ProcessInfo {
|
|
153
|
-
pid: number;
|
|
154
|
-
status: ProcessStatus;
|
|
155
|
-
exitCode?: number;
|
|
156
|
-
signal?: number;
|
|
157
|
-
stdinWritable: boolean;
|
|
158
|
-
command: string;
|
|
159
|
-
args: string[];
|
|
160
|
-
startedAt: Date;
|
|
161
|
-
endedAt?: Date;
|
|
162
|
-
}
|
|
163
|
-
interface SendSignalResponse {
|
|
164
|
-
success: boolean;
|
|
165
|
-
}
|
|
166
|
-
interface OutputResponse {
|
|
167
|
-
pid: number;
|
|
168
|
-
lines: string[];
|
|
169
|
-
lineCount: number;
|
|
170
|
-
}
|
|
171
|
-
interface OutputEvent {
|
|
172
|
-
line: string;
|
|
173
|
-
timestamp: Date;
|
|
174
|
-
stream?: string;
|
|
175
|
-
}
|
|
176
|
-
interface RunOptions {
|
|
177
|
-
args?: string[];
|
|
178
|
-
env?: Record<string, string>;
|
|
179
|
-
workingDir?: string;
|
|
180
|
-
timeout?: number;
|
|
181
|
-
}
|
|
182
|
-
interface CommandResult {
|
|
183
|
-
exitCode: number;
|
|
184
|
-
stdout: string;
|
|
185
|
-
stderr: string;
|
|
186
|
-
}
|
|
187
|
-
interface DirectoryEntry {
|
|
188
|
-
name: string;
|
|
189
|
-
isDir: boolean;
|
|
190
|
-
size?: number;
|
|
191
|
-
modifiedAt?: Date;
|
|
192
|
-
}
|
|
193
|
-
interface ListDirectoryResponse {
|
|
194
|
-
path: string;
|
|
195
|
-
entries: DirectoryEntry[];
|
|
196
|
-
}
|
|
197
|
-
interface CreatePtySessionOptions {
|
|
198
|
-
command: string;
|
|
199
|
-
args?: string[];
|
|
200
|
-
env?: Record<string, string>;
|
|
201
|
-
workingDir?: string;
|
|
202
|
-
rows?: number;
|
|
203
|
-
cols?: number;
|
|
204
|
-
}
|
|
205
|
-
interface PtySessionInfo {
|
|
206
|
-
sessionId: string;
|
|
207
|
-
token: string;
|
|
208
|
-
}
|
|
209
|
-
interface HealthResponse {
|
|
210
|
-
healthy: boolean;
|
|
211
|
-
}
|
|
212
|
-
interface DaemonInfo {
|
|
213
|
-
version: string;
|
|
214
|
-
uptimeSecs: number;
|
|
215
|
-
runningProcesses: number;
|
|
216
|
-
totalProcesses: number;
|
|
217
|
-
}
|
|
218
|
-
interface SandboxClientOptions {
|
|
219
|
-
apiUrl?: string;
|
|
220
|
-
apiKey?: string;
|
|
221
|
-
organizationId?: string;
|
|
222
|
-
projectId?: string;
|
|
223
|
-
namespace?: string;
|
|
224
|
-
maxRetries?: number;
|
|
225
|
-
retryBackoffMs?: number;
|
|
226
|
-
}
|
|
227
|
-
interface SandboxOptions {
|
|
228
|
-
sandboxId: string;
|
|
229
|
-
proxyUrl?: string;
|
|
230
|
-
apiKey?: string;
|
|
231
|
-
organizationId?: string;
|
|
232
|
-
projectId?: string;
|
|
233
|
-
}
|
|
234
|
-
interface CreateAndConnectOptions extends CreateSandboxOptions {
|
|
235
|
-
poolId?: string;
|
|
236
|
-
proxyUrl?: string;
|
|
237
|
-
startupTimeout?: number;
|
|
238
|
-
}
|
|
1
|
+
import { C as CreatePtySessionOptions, S as SandboxOptions, R as RunOptions, a as CommandResult, b as StartProcessOptions, P as ProcessInfo, c as SendSignalResponse, O as OutputResponse, d as OutputEvent, L as ListDirectoryResponse, e as PtySessionInfo, H as HealthResponse, D as DaemonInfo, f as SandboxClientOptions, g as CreateSandboxOptions, h as CreateSandboxResponse, i as SandboxInfo, U as UpdateSandboxOptions, j as SandboxPortAccess, k as CreateSnapshotResponse, l as SnapshotInfo, m as SnapshotAndWaitOptions, n as CreatePoolOptions, o as CreateSandboxPoolResponse, p as SandboxPoolInfo, q as UpdatePoolOptions, r as CreateAndConnectOptions } from './sandbox-image-DKPhc4Lv.cjs';
|
|
2
|
+
export { s as ContainerResourcesInfo, t as ContainerState, u as CreateSandboxImageOptions, v as DirectoryEntry, w as DockerfileBuildPlan, x as DockerfileInstruction, I as Image, y as ImageBuildOperation, z as ImageBuildOperationType, z as ImageBuildOperationTypeValue, A as ImageOptions, N as NetworkConfig, B as OutputMode, E as PoolContainerInfo, F as ProcessStatus, G as SandboxImageSource, J as SandboxStatus, K as SnapshotStatus, M as StdinMode, Q as createSandboxImage, T as dockerfileContent } from './sandbox-image-DKPhc4Lv.cjs';
|
|
239
3
|
|
|
4
|
+
type PtyDataHandler = (data: Uint8Array) => void;
|
|
5
|
+
type PtyExitHandler = (exitCode: number) => void;
|
|
6
|
+
interface PtyConnectionOptions {
|
|
7
|
+
onData?: PtyDataHandler;
|
|
8
|
+
onExit?: PtyExitHandler;
|
|
9
|
+
}
|
|
10
|
+
interface CreatePtyOptions extends CreatePtySessionOptions, PtyConnectionOptions {
|
|
11
|
+
}
|
|
12
|
+
declare class Pty {
|
|
13
|
+
readonly sessionId: string;
|
|
14
|
+
readonly token: string;
|
|
15
|
+
private readonly wsUrl;
|
|
16
|
+
private readonly wsHeaders;
|
|
17
|
+
private readonly killSession;
|
|
18
|
+
private socket;
|
|
19
|
+
private connectPromise;
|
|
20
|
+
private intentionalDisconnect;
|
|
21
|
+
private exitCode;
|
|
22
|
+
private waitSettled;
|
|
23
|
+
private readonly dataHandlers;
|
|
24
|
+
private readonly exitHandlers;
|
|
25
|
+
private readonly waitPromise;
|
|
26
|
+
private resolveWait;
|
|
27
|
+
private rejectWait;
|
|
28
|
+
constructor(options: {
|
|
29
|
+
sessionId: string;
|
|
30
|
+
token: string;
|
|
31
|
+
wsUrl: string;
|
|
32
|
+
wsHeaders: Record<string, string>;
|
|
33
|
+
killSession: () => Promise<void>;
|
|
34
|
+
});
|
|
35
|
+
onData(handler: PtyDataHandler): () => void;
|
|
36
|
+
onExit(handler: PtyExitHandler): () => void;
|
|
37
|
+
connect(): Promise<this>;
|
|
38
|
+
sendInput(input: string | Uint8Array): Promise<void>;
|
|
39
|
+
resize(cols: number, rows: number): Promise<void>;
|
|
40
|
+
disconnect(code?: number, reason?: string): void;
|
|
41
|
+
wait(): Promise<number>;
|
|
42
|
+
kill(): Promise<void>;
|
|
43
|
+
private requireOpenSocket;
|
|
44
|
+
private finishWait;
|
|
45
|
+
private failWait;
|
|
46
|
+
}
|
|
240
47
|
/**
|
|
241
48
|
* Client for interacting with a running sandbox.
|
|
242
49
|
*
|
|
@@ -247,6 +54,7 @@ declare class Sandbox {
|
|
|
247
54
|
readonly sandboxId: string;
|
|
248
55
|
private readonly http;
|
|
249
56
|
private readonly baseUrl;
|
|
57
|
+
private readonly wsHeaders;
|
|
250
58
|
private ownsSandbox;
|
|
251
59
|
private lifecycleClient;
|
|
252
60
|
constructor(options: SandboxOptions);
|
|
@@ -279,6 +87,8 @@ declare class Sandbox {
|
|
|
279
87
|
deleteFile(path: string): Promise<void>;
|
|
280
88
|
listDirectory(path: string): Promise<ListDirectoryResponse>;
|
|
281
89
|
createPtySession(options: CreatePtySessionOptions): Promise<PtySessionInfo>;
|
|
90
|
+
createPty(options: CreatePtyOptions): Promise<Pty>;
|
|
91
|
+
connectPty(sessionId: string, token: string, options?: PtyConnectionOptions): Promise<Pty>;
|
|
282
92
|
ptyWsUrl(sessionId: string, token: string): string;
|
|
283
93
|
health(): Promise<HealthResponse>;
|
|
284
94
|
info(): Promise<DaemonInfo>;
|
|
@@ -317,7 +127,14 @@ declare class SandboxClient {
|
|
|
317
127
|
get(sandboxId: string): Promise<SandboxInfo>;
|
|
318
128
|
list(): Promise<SandboxInfo[]>;
|
|
319
129
|
update(sandboxId: string, options: UpdateSandboxOptions): Promise<SandboxInfo>;
|
|
130
|
+
getPortAccess(sandboxId: string): Promise<SandboxPortAccess>;
|
|
131
|
+
exposePorts(sandboxId: string, ports: number[], options?: {
|
|
132
|
+
allowUnauthenticatedAccess?: boolean;
|
|
133
|
+
}): Promise<SandboxInfo>;
|
|
134
|
+
unexposePorts(sandboxId: string, ports: number[]): Promise<SandboxInfo>;
|
|
320
135
|
delete(sandboxId: string): Promise<void>;
|
|
136
|
+
suspend(sandboxId: string): Promise<void>;
|
|
137
|
+
resume(sandboxId: string): Promise<void>;
|
|
321
138
|
claim(poolId: string): Promise<CreateSandboxResponse>;
|
|
322
139
|
snapshot(sandboxId: string): Promise<CreateSnapshotResponse>;
|
|
323
140
|
getSnapshot(snapshotId: string): Promise<SnapshotInfo>;
|
|
@@ -578,4 +395,4 @@ declare class RequestExecutionError extends Error {
|
|
|
578
395
|
constructor(message: string, functionName?: string);
|
|
579
396
|
}
|
|
580
397
|
|
|
581
|
-
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CloudClient, type CloudClientOptions,
|
|
398
|
+
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CloudClient, type CloudClientOptions, CommandResult, CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type CreateApplicationBuildRequest, CreatePoolOptions, type CreatePtyOptions, CreatePtySessionOptions, CreateSandboxOptions, CreateSandboxPoolResponse, CreateSandboxResponse, CreateSnapshotResponse, DaemonInfo, HealthResponse, ListDirectoryResponse, type NewSecret, OutputEvent, OutputResponse, PoolInUseError, PoolNotFoundError, ProcessInfo, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, RunOptions, Sandbox, SandboxClient, SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, SandboxInfo, SandboxNotFoundError, SandboxOptions, SandboxPoolInfo, SandboxPortAccess, type Secret, type SecretsList, type SecretsPagination, SendSignalResponse, SnapshotAndWaitOptions, SnapshotInfo, type StartImageBuildRequest, StartProcessOptions, UpdatePoolOptions, type UpsertSecretResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,242 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
RUNNING = "running",
|
|
4
|
-
SNAPSHOTTING = "snapshotting",
|
|
5
|
-
SUSPENDED = "suspended",
|
|
6
|
-
TERMINATED = "terminated"
|
|
7
|
-
}
|
|
8
|
-
declare enum SnapshotStatus {
|
|
9
|
-
IN_PROGRESS = "in_progress",
|
|
10
|
-
COMPLETED = "completed",
|
|
11
|
-
FAILED = "failed"
|
|
12
|
-
}
|
|
13
|
-
declare enum ProcessStatus {
|
|
14
|
-
RUNNING = "running",
|
|
15
|
-
EXITED = "exited",
|
|
16
|
-
SIGNALED = "signaled"
|
|
17
|
-
}
|
|
18
|
-
declare enum StdinMode {
|
|
19
|
-
CLOSED = "closed",
|
|
20
|
-
PIPE = "pipe"
|
|
21
|
-
}
|
|
22
|
-
declare enum OutputMode {
|
|
23
|
-
CAPTURE = "capture",
|
|
24
|
-
DISCARD = "discard"
|
|
25
|
-
}
|
|
26
|
-
declare enum ContainerState {
|
|
27
|
-
IDLE = "Idle",
|
|
28
|
-
RUNNING = "Running"
|
|
29
|
-
}
|
|
30
|
-
interface ContainerResourcesInfo {
|
|
31
|
-
cpus: number;
|
|
32
|
-
memoryMb: number;
|
|
33
|
-
ephemeralDiskMb: number;
|
|
34
|
-
}
|
|
35
|
-
interface NetworkConfig {
|
|
36
|
-
allowInternetAccess: boolean;
|
|
37
|
-
allowOut: string[];
|
|
38
|
-
denyOut: string[];
|
|
39
|
-
}
|
|
40
|
-
interface CreateSandboxOptions {
|
|
41
|
-
image?: string;
|
|
42
|
-
cpus?: number;
|
|
43
|
-
memoryMb?: number;
|
|
44
|
-
ephemeralDiskMb?: number;
|
|
45
|
-
secretNames?: string[];
|
|
46
|
-
timeoutSecs?: number;
|
|
47
|
-
entrypoint?: string[];
|
|
48
|
-
allowInternetAccess?: boolean;
|
|
49
|
-
allowOut?: string[];
|
|
50
|
-
denyOut?: string[];
|
|
51
|
-
snapshotId?: string;
|
|
52
|
-
/** Optional name for the sandbox. Named sandboxes support suspend/resume. When absent the sandbox is ephemeral. */
|
|
53
|
-
name?: string;
|
|
54
|
-
}
|
|
55
|
-
interface UpdateSandboxOptions {
|
|
56
|
-
/** New name for the sandbox. Naming an ephemeral sandbox enables suspend/resume. */
|
|
57
|
-
name?: string;
|
|
58
|
-
}
|
|
59
|
-
interface CreateSandboxResponse {
|
|
60
|
-
sandboxId: string;
|
|
61
|
-
status: SandboxStatus;
|
|
62
|
-
}
|
|
63
|
-
interface SandboxInfo {
|
|
64
|
-
sandboxId: string;
|
|
65
|
-
namespace: string;
|
|
66
|
-
status: SandboxStatus;
|
|
67
|
-
image?: string;
|
|
68
|
-
resources: ContainerResourcesInfo;
|
|
69
|
-
secretNames: string[];
|
|
70
|
-
timeoutSecs?: number;
|
|
71
|
-
entrypoint?: string[];
|
|
72
|
-
network?: NetworkConfig;
|
|
73
|
-
poolId?: string;
|
|
74
|
-
outcome?: string;
|
|
75
|
-
createdAt?: Date;
|
|
76
|
-
terminatedAt?: Date;
|
|
77
|
-
name?: string;
|
|
78
|
-
}
|
|
79
|
-
interface CreateSnapshotResponse {
|
|
80
|
-
snapshotId: string;
|
|
81
|
-
status: SnapshotStatus;
|
|
82
|
-
}
|
|
83
|
-
interface SnapshotInfo {
|
|
84
|
-
snapshotId: string;
|
|
85
|
-
namespace: string;
|
|
86
|
-
sandboxId: string;
|
|
87
|
-
baseImage: string;
|
|
88
|
-
status: SnapshotStatus;
|
|
89
|
-
error?: string;
|
|
90
|
-
snapshotUri?: string;
|
|
91
|
-
sizeBytes?: number;
|
|
92
|
-
createdAt?: Date;
|
|
93
|
-
}
|
|
94
|
-
interface SnapshotAndWaitOptions {
|
|
95
|
-
timeout?: number;
|
|
96
|
-
pollInterval?: number;
|
|
97
|
-
}
|
|
98
|
-
interface CreatePoolOptions {
|
|
99
|
-
image: string;
|
|
100
|
-
cpus?: number;
|
|
101
|
-
memoryMb?: number;
|
|
102
|
-
ephemeralDiskMb?: number;
|
|
103
|
-
secretNames?: string[];
|
|
104
|
-
timeoutSecs?: number;
|
|
105
|
-
entrypoint?: string[];
|
|
106
|
-
maxContainers?: number;
|
|
107
|
-
warmContainers?: number;
|
|
108
|
-
}
|
|
109
|
-
interface UpdatePoolOptions {
|
|
110
|
-
image: string;
|
|
111
|
-
cpus?: number;
|
|
112
|
-
memoryMb?: number;
|
|
113
|
-
ephemeralDiskMb?: number;
|
|
114
|
-
secretNames?: string[];
|
|
115
|
-
timeoutSecs?: number;
|
|
116
|
-
entrypoint?: string[];
|
|
117
|
-
maxContainers?: number;
|
|
118
|
-
warmContainers?: number;
|
|
119
|
-
}
|
|
120
|
-
interface CreateSandboxPoolResponse {
|
|
121
|
-
poolId: string;
|
|
122
|
-
namespace: string;
|
|
123
|
-
}
|
|
124
|
-
interface PoolContainerInfo {
|
|
125
|
-
id: string;
|
|
126
|
-
state: string;
|
|
127
|
-
sandboxId?: string;
|
|
128
|
-
executorId: string;
|
|
129
|
-
}
|
|
130
|
-
interface SandboxPoolInfo {
|
|
131
|
-
poolId: string;
|
|
132
|
-
namespace: string;
|
|
133
|
-
image: string;
|
|
134
|
-
resources: ContainerResourcesInfo;
|
|
135
|
-
secretNames: string[];
|
|
136
|
-
timeoutSecs: number;
|
|
137
|
-
entrypoint?: string[];
|
|
138
|
-
maxContainers?: number;
|
|
139
|
-
warmContainers?: number;
|
|
140
|
-
containers?: PoolContainerInfo[];
|
|
141
|
-
createdAt?: Date;
|
|
142
|
-
updatedAt?: Date;
|
|
143
|
-
}
|
|
144
|
-
interface StartProcessOptions {
|
|
145
|
-
args?: string[];
|
|
146
|
-
env?: Record<string, string>;
|
|
147
|
-
workingDir?: string;
|
|
148
|
-
stdinMode?: StdinMode;
|
|
149
|
-
stdoutMode?: OutputMode;
|
|
150
|
-
stderrMode?: OutputMode;
|
|
151
|
-
}
|
|
152
|
-
interface ProcessInfo {
|
|
153
|
-
pid: number;
|
|
154
|
-
status: ProcessStatus;
|
|
155
|
-
exitCode?: number;
|
|
156
|
-
signal?: number;
|
|
157
|
-
stdinWritable: boolean;
|
|
158
|
-
command: string;
|
|
159
|
-
args: string[];
|
|
160
|
-
startedAt: Date;
|
|
161
|
-
endedAt?: Date;
|
|
162
|
-
}
|
|
163
|
-
interface SendSignalResponse {
|
|
164
|
-
success: boolean;
|
|
165
|
-
}
|
|
166
|
-
interface OutputResponse {
|
|
167
|
-
pid: number;
|
|
168
|
-
lines: string[];
|
|
169
|
-
lineCount: number;
|
|
170
|
-
}
|
|
171
|
-
interface OutputEvent {
|
|
172
|
-
line: string;
|
|
173
|
-
timestamp: Date;
|
|
174
|
-
stream?: string;
|
|
175
|
-
}
|
|
176
|
-
interface RunOptions {
|
|
177
|
-
args?: string[];
|
|
178
|
-
env?: Record<string, string>;
|
|
179
|
-
workingDir?: string;
|
|
180
|
-
timeout?: number;
|
|
181
|
-
}
|
|
182
|
-
interface CommandResult {
|
|
183
|
-
exitCode: number;
|
|
184
|
-
stdout: string;
|
|
185
|
-
stderr: string;
|
|
186
|
-
}
|
|
187
|
-
interface DirectoryEntry {
|
|
188
|
-
name: string;
|
|
189
|
-
isDir: boolean;
|
|
190
|
-
size?: number;
|
|
191
|
-
modifiedAt?: Date;
|
|
192
|
-
}
|
|
193
|
-
interface ListDirectoryResponse {
|
|
194
|
-
path: string;
|
|
195
|
-
entries: DirectoryEntry[];
|
|
196
|
-
}
|
|
197
|
-
interface CreatePtySessionOptions {
|
|
198
|
-
command: string;
|
|
199
|
-
args?: string[];
|
|
200
|
-
env?: Record<string, string>;
|
|
201
|
-
workingDir?: string;
|
|
202
|
-
rows?: number;
|
|
203
|
-
cols?: number;
|
|
204
|
-
}
|
|
205
|
-
interface PtySessionInfo {
|
|
206
|
-
sessionId: string;
|
|
207
|
-
token: string;
|
|
208
|
-
}
|
|
209
|
-
interface HealthResponse {
|
|
210
|
-
healthy: boolean;
|
|
211
|
-
}
|
|
212
|
-
interface DaemonInfo {
|
|
213
|
-
version: string;
|
|
214
|
-
uptimeSecs: number;
|
|
215
|
-
runningProcesses: number;
|
|
216
|
-
totalProcesses: number;
|
|
217
|
-
}
|
|
218
|
-
interface SandboxClientOptions {
|
|
219
|
-
apiUrl?: string;
|
|
220
|
-
apiKey?: string;
|
|
221
|
-
organizationId?: string;
|
|
222
|
-
projectId?: string;
|
|
223
|
-
namespace?: string;
|
|
224
|
-
maxRetries?: number;
|
|
225
|
-
retryBackoffMs?: number;
|
|
226
|
-
}
|
|
227
|
-
interface SandboxOptions {
|
|
228
|
-
sandboxId: string;
|
|
229
|
-
proxyUrl?: string;
|
|
230
|
-
apiKey?: string;
|
|
231
|
-
organizationId?: string;
|
|
232
|
-
projectId?: string;
|
|
233
|
-
}
|
|
234
|
-
interface CreateAndConnectOptions extends CreateSandboxOptions {
|
|
235
|
-
poolId?: string;
|
|
236
|
-
proxyUrl?: string;
|
|
237
|
-
startupTimeout?: number;
|
|
238
|
-
}
|
|
1
|
+
import { C as CreatePtySessionOptions, S as SandboxOptions, R as RunOptions, a as CommandResult, b as StartProcessOptions, P as ProcessInfo, c as SendSignalResponse, O as OutputResponse, d as OutputEvent, L as ListDirectoryResponse, e as PtySessionInfo, H as HealthResponse, D as DaemonInfo, f as SandboxClientOptions, g as CreateSandboxOptions, h as CreateSandboxResponse, i as SandboxInfo, U as UpdateSandboxOptions, j as SandboxPortAccess, k as CreateSnapshotResponse, l as SnapshotInfo, m as SnapshotAndWaitOptions, n as CreatePoolOptions, o as CreateSandboxPoolResponse, p as SandboxPoolInfo, q as UpdatePoolOptions, r as CreateAndConnectOptions } from './sandbox-image-DKPhc4Lv.js';
|
|
2
|
+
export { s as ContainerResourcesInfo, t as ContainerState, u as CreateSandboxImageOptions, v as DirectoryEntry, w as DockerfileBuildPlan, x as DockerfileInstruction, I as Image, y as ImageBuildOperation, z as ImageBuildOperationType, z as ImageBuildOperationTypeValue, A as ImageOptions, N as NetworkConfig, B as OutputMode, E as PoolContainerInfo, F as ProcessStatus, G as SandboxImageSource, J as SandboxStatus, K as SnapshotStatus, M as StdinMode, Q as createSandboxImage, T as dockerfileContent } from './sandbox-image-DKPhc4Lv.js';
|
|
239
3
|
|
|
4
|
+
type PtyDataHandler = (data: Uint8Array) => void;
|
|
5
|
+
type PtyExitHandler = (exitCode: number) => void;
|
|
6
|
+
interface PtyConnectionOptions {
|
|
7
|
+
onData?: PtyDataHandler;
|
|
8
|
+
onExit?: PtyExitHandler;
|
|
9
|
+
}
|
|
10
|
+
interface CreatePtyOptions extends CreatePtySessionOptions, PtyConnectionOptions {
|
|
11
|
+
}
|
|
12
|
+
declare class Pty {
|
|
13
|
+
readonly sessionId: string;
|
|
14
|
+
readonly token: string;
|
|
15
|
+
private readonly wsUrl;
|
|
16
|
+
private readonly wsHeaders;
|
|
17
|
+
private readonly killSession;
|
|
18
|
+
private socket;
|
|
19
|
+
private connectPromise;
|
|
20
|
+
private intentionalDisconnect;
|
|
21
|
+
private exitCode;
|
|
22
|
+
private waitSettled;
|
|
23
|
+
private readonly dataHandlers;
|
|
24
|
+
private readonly exitHandlers;
|
|
25
|
+
private readonly waitPromise;
|
|
26
|
+
private resolveWait;
|
|
27
|
+
private rejectWait;
|
|
28
|
+
constructor(options: {
|
|
29
|
+
sessionId: string;
|
|
30
|
+
token: string;
|
|
31
|
+
wsUrl: string;
|
|
32
|
+
wsHeaders: Record<string, string>;
|
|
33
|
+
killSession: () => Promise<void>;
|
|
34
|
+
});
|
|
35
|
+
onData(handler: PtyDataHandler): () => void;
|
|
36
|
+
onExit(handler: PtyExitHandler): () => void;
|
|
37
|
+
connect(): Promise<this>;
|
|
38
|
+
sendInput(input: string | Uint8Array): Promise<void>;
|
|
39
|
+
resize(cols: number, rows: number): Promise<void>;
|
|
40
|
+
disconnect(code?: number, reason?: string): void;
|
|
41
|
+
wait(): Promise<number>;
|
|
42
|
+
kill(): Promise<void>;
|
|
43
|
+
private requireOpenSocket;
|
|
44
|
+
private finishWait;
|
|
45
|
+
private failWait;
|
|
46
|
+
}
|
|
240
47
|
/**
|
|
241
48
|
* Client for interacting with a running sandbox.
|
|
242
49
|
*
|
|
@@ -247,6 +54,7 @@ declare class Sandbox {
|
|
|
247
54
|
readonly sandboxId: string;
|
|
248
55
|
private readonly http;
|
|
249
56
|
private readonly baseUrl;
|
|
57
|
+
private readonly wsHeaders;
|
|
250
58
|
private ownsSandbox;
|
|
251
59
|
private lifecycleClient;
|
|
252
60
|
constructor(options: SandboxOptions);
|
|
@@ -279,6 +87,8 @@ declare class Sandbox {
|
|
|
279
87
|
deleteFile(path: string): Promise<void>;
|
|
280
88
|
listDirectory(path: string): Promise<ListDirectoryResponse>;
|
|
281
89
|
createPtySession(options: CreatePtySessionOptions): Promise<PtySessionInfo>;
|
|
90
|
+
createPty(options: CreatePtyOptions): Promise<Pty>;
|
|
91
|
+
connectPty(sessionId: string, token: string, options?: PtyConnectionOptions): Promise<Pty>;
|
|
282
92
|
ptyWsUrl(sessionId: string, token: string): string;
|
|
283
93
|
health(): Promise<HealthResponse>;
|
|
284
94
|
info(): Promise<DaemonInfo>;
|
|
@@ -317,7 +127,14 @@ declare class SandboxClient {
|
|
|
317
127
|
get(sandboxId: string): Promise<SandboxInfo>;
|
|
318
128
|
list(): Promise<SandboxInfo[]>;
|
|
319
129
|
update(sandboxId: string, options: UpdateSandboxOptions): Promise<SandboxInfo>;
|
|
130
|
+
getPortAccess(sandboxId: string): Promise<SandboxPortAccess>;
|
|
131
|
+
exposePorts(sandboxId: string, ports: number[], options?: {
|
|
132
|
+
allowUnauthenticatedAccess?: boolean;
|
|
133
|
+
}): Promise<SandboxInfo>;
|
|
134
|
+
unexposePorts(sandboxId: string, ports: number[]): Promise<SandboxInfo>;
|
|
320
135
|
delete(sandboxId: string): Promise<void>;
|
|
136
|
+
suspend(sandboxId: string): Promise<void>;
|
|
137
|
+
resume(sandboxId: string): Promise<void>;
|
|
321
138
|
claim(poolId: string): Promise<CreateSandboxResponse>;
|
|
322
139
|
snapshot(sandboxId: string): Promise<CreateSnapshotResponse>;
|
|
323
140
|
getSnapshot(snapshotId: string): Promise<SnapshotInfo>;
|
|
@@ -578,4 +395,4 @@ declare class RequestExecutionError extends Error {
|
|
|
578
395
|
constructor(message: string, functionName?: string);
|
|
579
396
|
}
|
|
580
397
|
|
|
581
|
-
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CloudClient, type CloudClientOptions,
|
|
398
|
+
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CloudClient, type CloudClientOptions, CommandResult, CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type CreateApplicationBuildRequest, CreatePoolOptions, type CreatePtyOptions, CreatePtySessionOptions, CreateSandboxOptions, CreateSandboxPoolResponse, CreateSandboxResponse, CreateSnapshotResponse, DaemonInfo, HealthResponse, ListDirectoryResponse, type NewSecret, OutputEvent, OutputResponse, PoolInUseError, PoolNotFoundError, ProcessInfo, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, RunOptions, Sandbox, SandboxClient, SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, SandboxInfo, SandboxNotFoundError, SandboxOptions, SandboxPoolInfo, SandboxPortAccess, type Secret, type SecretsList, type SecretsPagination, SendSignalResponse, SnapshotAndWaitOptions, SnapshotInfo, type StartImageBuildRequest, StartProcessOptions, UpdatePoolOptions, type UpsertSecretResponse };
|