tensorlake 0.4.40 → 0.4.42
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 +1222 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +57 -240
- package/dist/index.d.ts +57 -240
- package/dist/index.js +1206 -50
- 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 +2109 -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 +2069 -0
- package/dist/sandbox-image.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
declare enum SandboxStatus {
|
|
2
|
+
PENDING = "pending",
|
|
3
|
+
RUNNING = "running",
|
|
4
|
+
SNAPSHOTTING = "snapshotting",
|
|
5
|
+
SUSPENDING = "suspending",
|
|
6
|
+
SUSPENDED = "suspended",
|
|
7
|
+
TERMINATED = "terminated"
|
|
8
|
+
}
|
|
9
|
+
declare enum SnapshotStatus {
|
|
10
|
+
IN_PROGRESS = "in_progress",
|
|
11
|
+
COMPLETED = "completed",
|
|
12
|
+
FAILED = "failed"
|
|
13
|
+
}
|
|
14
|
+
declare enum ProcessStatus {
|
|
15
|
+
RUNNING = "running",
|
|
16
|
+
EXITED = "exited",
|
|
17
|
+
SIGNALED = "signaled"
|
|
18
|
+
}
|
|
19
|
+
declare enum StdinMode {
|
|
20
|
+
CLOSED = "closed",
|
|
21
|
+
PIPE = "pipe"
|
|
22
|
+
}
|
|
23
|
+
declare enum OutputMode {
|
|
24
|
+
CAPTURE = "capture",
|
|
25
|
+
DISCARD = "discard"
|
|
26
|
+
}
|
|
27
|
+
declare enum ContainerState {
|
|
28
|
+
IDLE = "Idle",
|
|
29
|
+
RUNNING = "Running"
|
|
30
|
+
}
|
|
31
|
+
interface ContainerResourcesInfo {
|
|
32
|
+
cpus: number;
|
|
33
|
+
memoryMb: number;
|
|
34
|
+
ephemeralDiskMb: number;
|
|
35
|
+
}
|
|
36
|
+
interface NetworkConfig {
|
|
37
|
+
allowInternetAccess: boolean;
|
|
38
|
+
allowOut: string[];
|
|
39
|
+
denyOut: string[];
|
|
40
|
+
}
|
|
41
|
+
interface CreateSandboxOptions {
|
|
42
|
+
/** Optional sandbox image name, such as `ubuntu-minimal` or a registered Sandbox Image. When omitted, Tensorlake uses the default managed environment. */
|
|
43
|
+
image?: string;
|
|
44
|
+
cpus?: number;
|
|
45
|
+
memoryMb?: number;
|
|
46
|
+
ephemeralDiskMb?: number;
|
|
47
|
+
secretNames?: string[];
|
|
48
|
+
timeoutSecs?: number;
|
|
49
|
+
entrypoint?: string[];
|
|
50
|
+
allowInternetAccess?: boolean;
|
|
51
|
+
allowOut?: string[];
|
|
52
|
+
denyOut?: string[];
|
|
53
|
+
snapshotId?: string;
|
|
54
|
+
/** Optional name for the sandbox. Named sandboxes support suspend/resume. When absent the sandbox is ephemeral. */
|
|
55
|
+
name?: string;
|
|
56
|
+
}
|
|
57
|
+
interface UpdateSandboxOptions {
|
|
58
|
+
/** New name for the sandbox. Naming an ephemeral sandbox enables suspend/resume. */
|
|
59
|
+
name?: string;
|
|
60
|
+
/** Whether exposed user ports should be reachable without TensorLake auth. */
|
|
61
|
+
allowUnauthenticatedAccess?: boolean;
|
|
62
|
+
/** User ports that should be routable through the sandbox proxy. Port 9501 is reserved. */
|
|
63
|
+
exposedPorts?: number[];
|
|
64
|
+
}
|
|
65
|
+
interface CreateSandboxResponse {
|
|
66
|
+
sandboxId: string;
|
|
67
|
+
status: SandboxStatus;
|
|
68
|
+
}
|
|
69
|
+
interface SandboxInfo {
|
|
70
|
+
sandboxId: string;
|
|
71
|
+
namespace: string;
|
|
72
|
+
status: SandboxStatus;
|
|
73
|
+
/** Resolved sandbox image name. */
|
|
74
|
+
image?: string;
|
|
75
|
+
resources: ContainerResourcesInfo;
|
|
76
|
+
secretNames: string[];
|
|
77
|
+
timeoutSecs?: number;
|
|
78
|
+
entrypoint?: string[];
|
|
79
|
+
network?: NetworkConfig;
|
|
80
|
+
poolId?: string;
|
|
81
|
+
outcome?: string;
|
|
82
|
+
createdAt?: Date;
|
|
83
|
+
terminatedAt?: Date;
|
|
84
|
+
name?: string;
|
|
85
|
+
allowUnauthenticatedAccess?: boolean;
|
|
86
|
+
exposedPorts?: number[];
|
|
87
|
+
sandboxUrl?: string;
|
|
88
|
+
}
|
|
89
|
+
interface SandboxPortAccess {
|
|
90
|
+
allowUnauthenticatedAccess: boolean;
|
|
91
|
+
exposedPorts: number[];
|
|
92
|
+
sandboxUrl?: string;
|
|
93
|
+
}
|
|
94
|
+
interface CreateSnapshotResponse {
|
|
95
|
+
snapshotId: string;
|
|
96
|
+
status: SnapshotStatus;
|
|
97
|
+
}
|
|
98
|
+
interface SnapshotInfo {
|
|
99
|
+
snapshotId: string;
|
|
100
|
+
namespace: string;
|
|
101
|
+
sandboxId: string;
|
|
102
|
+
baseImage: string;
|
|
103
|
+
status: SnapshotStatus;
|
|
104
|
+
error?: string;
|
|
105
|
+
snapshotUri?: string;
|
|
106
|
+
sizeBytes?: number;
|
|
107
|
+
createdAt?: Date;
|
|
108
|
+
}
|
|
109
|
+
interface SnapshotAndWaitOptions {
|
|
110
|
+
timeout?: number;
|
|
111
|
+
pollInterval?: number;
|
|
112
|
+
}
|
|
113
|
+
interface CreatePoolOptions {
|
|
114
|
+
/** Sandbox image name, such as `ubuntu-minimal` or a registered Sandbox Image. */
|
|
115
|
+
image: string;
|
|
116
|
+
cpus?: number;
|
|
117
|
+
memoryMb?: number;
|
|
118
|
+
ephemeralDiskMb?: number;
|
|
119
|
+
secretNames?: string[];
|
|
120
|
+
timeoutSecs?: number;
|
|
121
|
+
entrypoint?: string[];
|
|
122
|
+
maxContainers?: number;
|
|
123
|
+
warmContainers?: number;
|
|
124
|
+
}
|
|
125
|
+
interface UpdatePoolOptions {
|
|
126
|
+
/** Sandbox image name, such as `ubuntu-minimal` or a registered Sandbox Image. */
|
|
127
|
+
image: string;
|
|
128
|
+
cpus?: number;
|
|
129
|
+
memoryMb?: number;
|
|
130
|
+
ephemeralDiskMb?: number;
|
|
131
|
+
secretNames?: string[];
|
|
132
|
+
timeoutSecs?: number;
|
|
133
|
+
entrypoint?: string[];
|
|
134
|
+
maxContainers?: number;
|
|
135
|
+
warmContainers?: number;
|
|
136
|
+
}
|
|
137
|
+
interface CreateSandboxPoolResponse {
|
|
138
|
+
poolId: string;
|
|
139
|
+
namespace: string;
|
|
140
|
+
}
|
|
141
|
+
interface PoolContainerInfo {
|
|
142
|
+
id: string;
|
|
143
|
+
state: string;
|
|
144
|
+
sandboxId?: string;
|
|
145
|
+
executorId: string;
|
|
146
|
+
}
|
|
147
|
+
interface SandboxPoolInfo {
|
|
148
|
+
poolId: string;
|
|
149
|
+
namespace: string;
|
|
150
|
+
/** Sandbox image name backing the pool. */
|
|
151
|
+
image: string;
|
|
152
|
+
resources: ContainerResourcesInfo;
|
|
153
|
+
secretNames: string[];
|
|
154
|
+
timeoutSecs: number;
|
|
155
|
+
entrypoint?: string[];
|
|
156
|
+
maxContainers?: number;
|
|
157
|
+
warmContainers?: number;
|
|
158
|
+
containers?: PoolContainerInfo[];
|
|
159
|
+
createdAt?: Date;
|
|
160
|
+
updatedAt?: Date;
|
|
161
|
+
}
|
|
162
|
+
interface StartProcessOptions {
|
|
163
|
+
args?: string[];
|
|
164
|
+
env?: Record<string, string>;
|
|
165
|
+
workingDir?: string;
|
|
166
|
+
stdinMode?: StdinMode;
|
|
167
|
+
stdoutMode?: OutputMode;
|
|
168
|
+
stderrMode?: OutputMode;
|
|
169
|
+
}
|
|
170
|
+
interface ProcessInfo {
|
|
171
|
+
pid: number;
|
|
172
|
+
status: ProcessStatus;
|
|
173
|
+
exitCode?: number;
|
|
174
|
+
signal?: number;
|
|
175
|
+
stdinWritable: boolean;
|
|
176
|
+
command: string;
|
|
177
|
+
args: string[];
|
|
178
|
+
startedAt: Date;
|
|
179
|
+
endedAt?: Date;
|
|
180
|
+
}
|
|
181
|
+
interface SendSignalResponse {
|
|
182
|
+
success: boolean;
|
|
183
|
+
}
|
|
184
|
+
interface OutputResponse {
|
|
185
|
+
pid: number;
|
|
186
|
+
lines: string[];
|
|
187
|
+
lineCount: number;
|
|
188
|
+
}
|
|
189
|
+
interface OutputEvent {
|
|
190
|
+
line: string;
|
|
191
|
+
timestamp: Date;
|
|
192
|
+
stream?: string;
|
|
193
|
+
}
|
|
194
|
+
interface RunOptions {
|
|
195
|
+
args?: string[];
|
|
196
|
+
env?: Record<string, string>;
|
|
197
|
+
workingDir?: string;
|
|
198
|
+
timeout?: number;
|
|
199
|
+
}
|
|
200
|
+
interface CommandResult {
|
|
201
|
+
exitCode: number;
|
|
202
|
+
stdout: string;
|
|
203
|
+
stderr: string;
|
|
204
|
+
}
|
|
205
|
+
interface DirectoryEntry {
|
|
206
|
+
name: string;
|
|
207
|
+
isDir: boolean;
|
|
208
|
+
size?: number;
|
|
209
|
+
modifiedAt?: Date;
|
|
210
|
+
}
|
|
211
|
+
interface ListDirectoryResponse {
|
|
212
|
+
path: string;
|
|
213
|
+
entries: DirectoryEntry[];
|
|
214
|
+
}
|
|
215
|
+
interface CreatePtySessionOptions {
|
|
216
|
+
command: string;
|
|
217
|
+
args?: string[];
|
|
218
|
+
env?: Record<string, string>;
|
|
219
|
+
workingDir?: string;
|
|
220
|
+
rows?: number;
|
|
221
|
+
cols?: number;
|
|
222
|
+
}
|
|
223
|
+
interface PtySessionInfo {
|
|
224
|
+
sessionId: string;
|
|
225
|
+
token: string;
|
|
226
|
+
}
|
|
227
|
+
interface HealthResponse {
|
|
228
|
+
healthy: boolean;
|
|
229
|
+
}
|
|
230
|
+
interface DaemonInfo {
|
|
231
|
+
version: string;
|
|
232
|
+
uptimeSecs: number;
|
|
233
|
+
runningProcesses: number;
|
|
234
|
+
totalProcesses: number;
|
|
235
|
+
}
|
|
236
|
+
interface SandboxClientOptions {
|
|
237
|
+
apiUrl?: string;
|
|
238
|
+
apiKey?: string;
|
|
239
|
+
organizationId?: string;
|
|
240
|
+
projectId?: string;
|
|
241
|
+
namespace?: string;
|
|
242
|
+
maxRetries?: number;
|
|
243
|
+
retryBackoffMs?: number;
|
|
244
|
+
}
|
|
245
|
+
interface SandboxOptions {
|
|
246
|
+
sandboxId: string;
|
|
247
|
+
proxyUrl?: string;
|
|
248
|
+
apiKey?: string;
|
|
249
|
+
organizationId?: string;
|
|
250
|
+
projectId?: string;
|
|
251
|
+
}
|
|
252
|
+
interface CreateAndConnectOptions extends CreateSandboxOptions {
|
|
253
|
+
poolId?: string;
|
|
254
|
+
proxyUrl?: string;
|
|
255
|
+
startupTimeout?: number;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
declare const ImageBuildOperationType: {
|
|
259
|
+
readonly ADD: "ADD";
|
|
260
|
+
readonly COPY: "COPY";
|
|
261
|
+
readonly ENV: "ENV";
|
|
262
|
+
readonly RUN: "RUN";
|
|
263
|
+
readonly WORKDIR: "WORKDIR";
|
|
264
|
+
};
|
|
265
|
+
type ImageBuildOperationType = (typeof ImageBuildOperationType)[keyof typeof ImageBuildOperationType];
|
|
266
|
+
interface ImageBuildOperation {
|
|
267
|
+
type: ImageBuildOperationType;
|
|
268
|
+
args: string[];
|
|
269
|
+
options: Record<string, string>;
|
|
270
|
+
}
|
|
271
|
+
interface ImageOptions {
|
|
272
|
+
name?: string;
|
|
273
|
+
tag?: string;
|
|
274
|
+
baseImage?: string | null;
|
|
275
|
+
}
|
|
276
|
+
declare class Image {
|
|
277
|
+
readonly _id: string;
|
|
278
|
+
readonly _name: string;
|
|
279
|
+
readonly _tag: string;
|
|
280
|
+
readonly _baseImage: string | null;
|
|
281
|
+
readonly _buildOperations: ImageBuildOperation[];
|
|
282
|
+
constructor();
|
|
283
|
+
constructor(name: string, tag?: string, baseImage?: string | null);
|
|
284
|
+
constructor(options: ImageOptions);
|
|
285
|
+
get name(): string;
|
|
286
|
+
get tag(): string;
|
|
287
|
+
get baseImage(): string | null;
|
|
288
|
+
get buildOperations(): ImageBuildOperation[];
|
|
289
|
+
add(src: string, dest: string, options?: Record<string, string> | undefined): this;
|
|
290
|
+
copy(src: string, dest: string, options?: Record<string, string> | undefined): this;
|
|
291
|
+
env(key: string, value: string): this;
|
|
292
|
+
run(commands: string | string[], options?: Record<string, string> | undefined): this;
|
|
293
|
+
workdir(directory: string): this;
|
|
294
|
+
private _addOperation;
|
|
295
|
+
}
|
|
296
|
+
declare function dockerfileContent(image: Image): string;
|
|
297
|
+
|
|
298
|
+
interface DockerfileInstruction {
|
|
299
|
+
keyword: string;
|
|
300
|
+
value: string;
|
|
301
|
+
lineNumber: number;
|
|
302
|
+
}
|
|
303
|
+
interface DockerfileBuildPlan {
|
|
304
|
+
dockerfilePath: string;
|
|
305
|
+
contextDir: string;
|
|
306
|
+
registeredName: string;
|
|
307
|
+
dockerfileText: string;
|
|
308
|
+
baseImage?: string;
|
|
309
|
+
instructions: DockerfileInstruction[];
|
|
310
|
+
}
|
|
311
|
+
interface CreateSandboxImageOptions {
|
|
312
|
+
registeredName?: string;
|
|
313
|
+
cpus?: number;
|
|
314
|
+
memoryMb?: number;
|
|
315
|
+
isPublic?: boolean;
|
|
316
|
+
contextDir?: string;
|
|
317
|
+
}
|
|
318
|
+
type SandboxImageSource = string | Image;
|
|
319
|
+
interface BuildContext {
|
|
320
|
+
apiUrl: string;
|
|
321
|
+
apiKey?: string;
|
|
322
|
+
personalAccessToken?: string;
|
|
323
|
+
namespace: string;
|
|
324
|
+
organizationId?: string;
|
|
325
|
+
projectId?: string;
|
|
326
|
+
debug: boolean;
|
|
327
|
+
}
|
|
328
|
+
interface BuildSandbox {
|
|
329
|
+
sandboxId: string;
|
|
330
|
+
run(command: string, options?: {
|
|
331
|
+
args?: string[];
|
|
332
|
+
env?: Record<string, string>;
|
|
333
|
+
workingDir?: string;
|
|
334
|
+
timeout?: number;
|
|
335
|
+
}): Promise<CommandResult>;
|
|
336
|
+
startProcess(command: string, options?: {
|
|
337
|
+
args?: string[];
|
|
338
|
+
env?: Record<string, string>;
|
|
339
|
+
workingDir?: string;
|
|
340
|
+
}): Promise<ProcessInfo>;
|
|
341
|
+
getStdout(pid: number): Promise<OutputResponse>;
|
|
342
|
+
getStderr(pid: number): Promise<OutputResponse>;
|
|
343
|
+
getProcess(pid: number): Promise<ProcessInfo>;
|
|
344
|
+
writeFile(path: string, content: Uint8Array): Promise<void>;
|
|
345
|
+
terminate(): Promise<void>;
|
|
346
|
+
}
|
|
347
|
+
interface BuildClient {
|
|
348
|
+
createAndConnect(options: {
|
|
349
|
+
image?: string;
|
|
350
|
+
cpus?: number;
|
|
351
|
+
memoryMb?: number;
|
|
352
|
+
}): Promise<BuildSandbox>;
|
|
353
|
+
snapshotAndWait(sandboxId: string, options?: {
|
|
354
|
+
timeout?: number;
|
|
355
|
+
pollInterval?: number;
|
|
356
|
+
}): Promise<SnapshotInfo>;
|
|
357
|
+
close(): void;
|
|
358
|
+
}
|
|
359
|
+
interface CreateSandboxImageDeps {
|
|
360
|
+
emit?: (event: Record<string, unknown>) => void;
|
|
361
|
+
createClient?: (context: BuildContext) => BuildClient;
|
|
362
|
+
registerImage?: (context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotUri: string, isPublic: boolean) => Promise<Record<string, unknown>>;
|
|
363
|
+
sleep?: (ms: number) => Promise<void>;
|
|
364
|
+
}
|
|
365
|
+
declare function defaultRegisteredName(dockerfilePath: string): string;
|
|
366
|
+
declare function logicalDockerfileLines(dockerfileText: string): Array<{
|
|
367
|
+
lineNumber: number;
|
|
368
|
+
line: string;
|
|
369
|
+
}>;
|
|
370
|
+
declare function loadDockerfilePlan(dockerfilePath: string, registeredName?: string): Promise<DockerfileBuildPlan>;
|
|
371
|
+
declare function loadImagePlan(image: Image, options?: Pick<CreateSandboxImageOptions, "registeredName" | "contextDir">): DockerfileBuildPlan;
|
|
372
|
+
declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
|
|
373
|
+
declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
|
|
374
|
+
|
|
375
|
+
export { type ImageOptions as A, OutputMode as B, type CreatePtySessionOptions as C, type DaemonInfo as D, type PoolContainerInfo as E, ProcessStatus as F, type SandboxImageSource as G, type HealthResponse as H, Image as I, SandboxStatus as J, SnapshotStatus as K, type ListDirectoryResponse as L, StdinMode as M, type NetworkConfig as N, type OutputResponse as O, type ProcessInfo as P, createSandboxImage as Q, type RunOptions as R, type SandboxOptions as S, dockerfileContent as T, type UpdateSandboxOptions as U, defaultRegisteredName as V, loadDockerfilePlan as W, loadImagePlan as X, logicalDockerfileLines as Y, runCreateSandboxImageCli as Z, type CommandResult as a, type StartProcessOptions as b, type SendSignalResponse as c, type OutputEvent as d, type PtySessionInfo as e, type SandboxClientOptions as f, type CreateSandboxOptions as g, type CreateSandboxResponse as h, type SandboxInfo as i, type SandboxPortAccess as j, type CreateSnapshotResponse as k, type SnapshotInfo as l, type SnapshotAndWaitOptions as m, type CreatePoolOptions as n, type CreateSandboxPoolResponse as o, type SandboxPoolInfo as p, type UpdatePoolOptions as q, type CreateAndConnectOptions as r, type ContainerResourcesInfo as s, ContainerState as t, type CreateSandboxImageOptions as u, type DirectoryEntry as v, type DockerfileBuildPlan as w, type DockerfileInstruction as x, type ImageBuildOperation as y, ImageBuildOperationType as z };
|