tensorlake 0.5.17 → 0.5.19

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.
@@ -1,477 +0,0 @@
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
- LOCAL_READY = "local_ready",
12
- COMPLETED = "completed",
13
- FAILED = "failed"
14
- }
15
- /**
16
- * Snapshot type for sandbox snapshot creation.
17
- *
18
- * - `"memory"`: Capture VM memory + filesystem state. Sandboxes restored
19
- * from this snapshot warm-restore VM memory.
20
- * - `"filesystem"`: Capture filesystem state only. Sandboxes restored from
21
- * this snapshot cold-boot from the snapshot tarball instead of warm-
22
- * restoring VM state. Use this for sandbox image builds so that the
23
- * restored sandbox bypasses Firecracker's overlay-path constraints.
24
- */
25
- type SnapshotType = "memory" | "filesystem";
26
- /**
27
- * Checkpoint type for {@link Sandbox.checkpoint}.
28
- *
29
- * - `"memory"`: Capture VM memory + filesystem state. Sandboxes restored
30
- * from this checkpoint warm-restore VM memory and running processes.
31
- * - `"filesystem"`: Capture filesystem state only. Sandboxes restored from
32
- * this checkpoint cold-boot from the snapshot tarball.
33
- */
34
- type CheckpointType = "memory" | "filesystem";
35
- type SnapshotWaitCondition = "local_ready" | "completed";
36
- declare enum ProcessStatus {
37
- RUNNING = "running",
38
- EXITED = "exited",
39
- SIGNALED = "signaled"
40
- }
41
- declare enum StdinMode {
42
- CLOSED = "closed",
43
- PIPE = "pipe"
44
- }
45
- declare enum OutputMode {
46
- CAPTURE = "capture",
47
- DISCARD = "discard"
48
- }
49
- declare enum ContainerState {
50
- IDLE = "Idle",
51
- RUNNING = "Running"
52
- }
53
- interface ContainerResourcesInfo {
54
- cpus: number;
55
- memoryMb: number;
56
- ephemeralDiskMb: number;
57
- }
58
- interface NetworkConfig {
59
- allowInternetAccess: boolean;
60
- allowOut: string[];
61
- denyOut: string[];
62
- }
63
- interface CreateSandboxOptions {
64
- /** Optional sandbox image name, such as `tensorlake/ubuntu-minimal` or a registered Sandbox Image. When omitted, Tensorlake uses the default managed environment. */
65
- image?: string;
66
- cpus?: number;
67
- memoryMb?: number;
68
- /** Root disk size in megabytes. When omitted, the server uses its default disk size. */
69
- diskMb?: number;
70
- secretNames?: string[];
71
- timeoutSecs?: number;
72
- entrypoint?: string[];
73
- allowInternetAccess?: boolean;
74
- allowOut?: string[];
75
- denyOut?: string[];
76
- snapshotId?: string;
77
- /** Optional name for the sandbox. Named sandboxes support suspend/resume. When absent the sandbox is ephemeral. */
78
- name?: string;
79
- }
80
- interface UpdateSandboxOptions {
81
- /** New name for the sandbox. Naming an ephemeral sandbox enables suspend/resume. */
82
- name?: string;
83
- /** Whether exposed user ports should be reachable without TensorLake auth. */
84
- allowUnauthenticatedAccess?: boolean;
85
- /** User ports that should be routable through the sandbox proxy. Port 9501 is reserved. */
86
- exposedPorts?: number[];
87
- }
88
- interface CreateSandboxResponse {
89
- sandboxId: string;
90
- status: SandboxStatus;
91
- routingHint?: string;
92
- name?: string | null;
93
- terminationReason?: string;
94
- errorDetails?: unknown;
95
- }
96
- interface SandboxInfo {
97
- sandboxId: string;
98
- namespace: string;
99
- status: SandboxStatus;
100
- /** Resolved sandbox image name. */
101
- image?: string;
102
- resources: ContainerResourcesInfo;
103
- secretNames: string[];
104
- timeoutSecs?: number;
105
- entrypoint?: string[];
106
- network?: NetworkConfig;
107
- poolId?: string;
108
- outcome?: string;
109
- terminationReason?: string;
110
- errorDetails?: unknown;
111
- createdAt?: Date;
112
- terminatedAt?: Date;
113
- name?: string;
114
- allowUnauthenticatedAccess?: boolean;
115
- exposedPorts?: number[];
116
- sandboxUrl?: string;
117
- routingHint?: string;
118
- }
119
- interface SandboxPortAccess {
120
- allowUnauthenticatedAccess: boolean;
121
- exposedPorts: number[];
122
- sandboxUrl?: string;
123
- }
124
- /** Sandbox information plus the archival timestamp. */
125
- interface ArchivedSandboxInfo extends SandboxInfo {
126
- archivedAt: Date;
127
- }
128
- /** Pagination params for `listArchivedSandboxes`. */
129
- interface ListArchivedSandboxesOptions {
130
- limit?: number;
131
- /** Base64-encoded pagination cursor returned by a prior call. */
132
- cursor?: string;
133
- /** Pagination direction. */
134
- direction?: "forward" | "backward";
135
- }
136
- interface ListArchivedSandboxesResponse {
137
- sandboxes: ArchivedSandboxInfo[];
138
- prevCursor?: string;
139
- nextCursor?: string;
140
- }
141
- interface CreateSnapshotResponse {
142
- snapshotId: string;
143
- status: SnapshotStatus;
144
- }
145
- interface SnapshotInfo {
146
- snapshotId: string;
147
- namespace: string;
148
- sandboxId: string;
149
- baseImage: string;
150
- status: SnapshotStatus;
151
- snapshotType?: SnapshotType;
152
- error?: string;
153
- snapshotUri?: string;
154
- snapshotFormatVersion?: string;
155
- sizeBytes?: number;
156
- rootfsDiskBytes?: number;
157
- createdAt?: Date;
158
- }
159
- interface SnapshotOptions {
160
- /**
161
- * Optional snapshot type. When omitted the server picks its default. Use
162
- * `"filesystem"` for snapshots intended for sandbox image builds so that
163
- * restored sandboxes cold-boot.
164
- */
165
- snapshotType?: SnapshotType;
166
- }
167
- interface SnapshotAndWaitOptions extends SnapshotOptions {
168
- timeout?: number;
169
- pollInterval?: number;
170
- /** Defaults to `"local_ready"`, which is enough to resume from a snapshot. */
171
- waitUntil?: SnapshotWaitCondition;
172
- }
173
- interface CreatePoolOptions {
174
- /** Sandbox image name, such as `tensorlake/ubuntu-minimal` or a registered Sandbox Image. */
175
- image: string;
176
- cpus?: number;
177
- memoryMb?: number;
178
- ephemeralDiskMb?: number;
179
- secretNames?: string[];
180
- timeoutSecs?: number;
181
- entrypoint?: string[];
182
- maxContainers?: number;
183
- warmContainers?: number;
184
- }
185
- interface UpdatePoolOptions {
186
- /** Sandbox image name, such as `tensorlake/ubuntu-minimal` or a registered Sandbox Image. */
187
- image: string;
188
- cpus?: number;
189
- memoryMb?: number;
190
- ephemeralDiskMb?: number;
191
- secretNames?: string[];
192
- timeoutSecs?: number;
193
- entrypoint?: string[];
194
- maxContainers?: number;
195
- warmContainers?: number;
196
- }
197
- interface CreateSandboxPoolResponse {
198
- poolId: string;
199
- namespace: string;
200
- }
201
- interface PoolContainerInfo {
202
- id: string;
203
- state: string;
204
- sandboxId?: string;
205
- executorId: string;
206
- }
207
- interface SandboxPoolInfo {
208
- poolId: string;
209
- namespace: string;
210
- /** Sandbox image name backing the pool. */
211
- image: string;
212
- resources: ContainerResourcesInfo;
213
- secretNames: string[];
214
- timeoutSecs: number;
215
- entrypoint?: string[];
216
- maxContainers?: number;
217
- warmContainers?: number;
218
- containers?: PoolContainerInfo[];
219
- createdAt?: Date;
220
- updatedAt?: Date;
221
- }
222
- interface ProcessUserSpec {
223
- name?: string;
224
- uid?: number;
225
- gid?: number;
226
- }
227
- type ProcessUser = string | ProcessUserSpec;
228
- interface StartProcessOptions {
229
- args?: string[];
230
- env?: Record<string, string>;
231
- workingDir?: string;
232
- stdinMode?: StdinMode;
233
- stdoutMode?: OutputMode;
234
- stderrMode?: OutputMode;
235
- user?: ProcessUser;
236
- }
237
- interface ProcessInfo {
238
- pid: number;
239
- status: ProcessStatus;
240
- exitCode?: number;
241
- signal?: number;
242
- stdinWritable: boolean;
243
- command: string;
244
- args: string[];
245
- startedAt: Date;
246
- endedAt?: Date;
247
- }
248
- interface SendSignalResponse {
249
- success: boolean;
250
- }
251
- interface OutputResponse {
252
- pid: number;
253
- lines: string[];
254
- lineCount: number;
255
- }
256
- interface OutputEvent {
257
- line: string;
258
- timestamp: Date;
259
- stream?: string;
260
- }
261
- interface RunOptions {
262
- args?: string[];
263
- env?: Record<string, string>;
264
- workingDir?: string;
265
- timeout?: number;
266
- user?: ProcessUser;
267
- }
268
- interface CommandResult {
269
- exitCode: number;
270
- stdout: string;
271
- stderr: string;
272
- }
273
- interface DirectoryEntry {
274
- name: string;
275
- isDir: boolean;
276
- size?: number;
277
- modifiedAt?: Date;
278
- }
279
- interface ListDirectoryResponse {
280
- path: string;
281
- entries: DirectoryEntry[];
282
- }
283
- interface CreatePtySessionOptions {
284
- command: string;
285
- args?: string[];
286
- env?: Record<string, string>;
287
- workingDir?: string;
288
- rows?: number;
289
- cols?: number;
290
- }
291
- interface PtySessionInfo {
292
- sessionId: string;
293
- token: string;
294
- }
295
- interface HealthResponse {
296
- healthy: boolean;
297
- }
298
- interface DaemonInfo {
299
- version: string;
300
- uptimeSecs: number;
301
- runningProcesses: number;
302
- totalProcesses: number;
303
- }
304
- interface SandboxClientOptions {
305
- apiUrl?: string;
306
- apiKey?: string;
307
- organizationId?: string;
308
- projectId?: string;
309
- namespace?: string;
310
- maxRetries?: number;
311
- retryBackoffMs?: number;
312
- }
313
- interface SandboxOptions {
314
- sandboxId: string;
315
- proxyUrl?: string;
316
- apiKey?: string;
317
- organizationId?: string;
318
- projectId?: string;
319
- routingHint?: string;
320
- }
321
- interface CreateAndConnectOptions extends CreateSandboxOptions {
322
- poolId?: string;
323
- proxyUrl?: string;
324
- startupTimeout?: number;
325
- }
326
- interface SuspendResumeOptions {
327
- /** If false, fire-and-return without waiting for completion. Default: true. */
328
- wait?: boolean;
329
- /** Max seconds to wait when wait=true. Default: 300. */
330
- timeout?: number;
331
- /** Seconds between status polls when wait=true. Default: 1. */
332
- pollInterval?: number;
333
- }
334
- interface CheckpointOptions extends SuspendResumeOptions {
335
- checkpointType?: CheckpointType;
336
- /** Defaults to `"local_ready"`, which is enough to resume from a checkpoint. */
337
- waitUntil?: SnapshotWaitCondition;
338
- }
339
- interface ConnectOptions {
340
- sandboxId: string;
341
- proxyUrl?: string;
342
- routingHint?: string;
343
- }
344
-
345
- declare const ImageBuildOperationType: {
346
- readonly ADD: "ADD";
347
- readonly COPY: "COPY";
348
- readonly ENV: "ENV";
349
- readonly RUN: "RUN";
350
- readonly WORKDIR: "WORKDIR";
351
- };
352
- type ImageBuildOperationType = (typeof ImageBuildOperationType)[keyof typeof ImageBuildOperationType];
353
- interface ImageBuildOperation {
354
- type: ImageBuildOperationType;
355
- args: string[];
356
- options: Record<string, string>;
357
- }
358
- interface ImageOptions {
359
- name?: string;
360
- tag?: string;
361
- baseImage?: string | null;
362
- }
363
- declare class Image {
364
- readonly _id: string;
365
- readonly _name: string;
366
- readonly _tag: string;
367
- readonly _baseImage: string | null;
368
- readonly _buildOperations: ImageBuildOperation[];
369
- constructor();
370
- constructor(name: string, tag?: string, baseImage?: string | null);
371
- constructor(options: ImageOptions);
372
- get name(): string;
373
- get tag(): string;
374
- get baseImage(): string | null;
375
- get buildOperations(): ImageBuildOperation[];
376
- add(src: string, dest: string, options?: Record<string, string> | undefined): this;
377
- copy(src: string, dest: string, options?: Record<string, string> | undefined): this;
378
- env(key: string, value: string): this;
379
- run(commands: string | string[], options?: Record<string, string> | undefined): this;
380
- workdir(directory: string): this;
381
- /**
382
- * Build this image as a sandbox template and register it.
383
- *
384
- * Materializes the image in a build sandbox, snapshots the filesystem,
385
- * and registers the snapshot as a named sandbox template.
386
- */
387
- build(options?: CreateSandboxImageOptions): Promise<Record<string, unknown>>;
388
- private _addOperation;
389
- }
390
- declare function dockerfileContent(image: Image): string;
391
-
392
- interface DockerfileInstruction {
393
- keyword: string;
394
- value: string;
395
- lineNumber: number;
396
- }
397
- interface DockerfileBuildPlan {
398
- dockerfilePath: string;
399
- contextDir: string;
400
- registeredName: string;
401
- dockerfileText: string;
402
- baseImage?: string;
403
- instructions: DockerfileInstruction[];
404
- }
405
- interface CreateSandboxImageOptions {
406
- registeredName?: string;
407
- cpus?: number;
408
- memoryMb?: number;
409
- diskMb?: number;
410
- builderDiskMb?: number;
411
- isPublic?: boolean;
412
- contextDir?: string;
413
- /**
414
- * Print build progress to stderr. Ignored when an explicit `emit` is passed
415
- * via `deps`. Defaults to false — `createSandboxImage` is silent by default
416
- * when invoked programmatically (e.g. `Image.build()`).
417
- */
418
- verbose?: boolean;
419
- }
420
- type SandboxImageSource = string | Image;
421
- interface BuildContext {
422
- apiUrl: string;
423
- apiKey?: string;
424
- personalAccessToken?: string;
425
- namespace: string;
426
- organizationId?: string;
427
- projectId?: string;
428
- debug: boolean;
429
- }
430
- interface BuildSandbox {
431
- sandboxId: string;
432
- run(command: string, options?: {
433
- args?: string[];
434
- env?: Record<string, string>;
435
- workingDir?: string;
436
- timeout?: number;
437
- user?: ProcessUser;
438
- }): Promise<CommandResult>;
439
- startProcess(command: string, options?: {
440
- args?: string[];
441
- env?: Record<string, string>;
442
- workingDir?: string;
443
- user?: ProcessUser;
444
- }): Promise<ProcessInfo>;
445
- getStdout(pid: number): Promise<OutputResponse>;
446
- getStderr(pid: number): Promise<OutputResponse>;
447
- getProcess(pid: number): Promise<ProcessInfo>;
448
- writeFile(path: string, content: Uint8Array): Promise<void>;
449
- readFile(path: string): Promise<Uint8Array>;
450
- terminate(): Promise<void>;
451
- }
452
- interface BuildClient {
453
- createAndConnect(options: {
454
- image?: string;
455
- cpus?: number;
456
- memoryMb?: number;
457
- diskMb?: number;
458
- }): Promise<BuildSandbox>;
459
- close(): void;
460
- }
461
- interface CreateSandboxImageDeps {
462
- emit?: (event: Record<string, unknown>) => void;
463
- createClient?: (context: BuildContext) => BuildClient;
464
- sleep?: (ms: number) => Promise<void>;
465
- }
466
- declare function defaultRegisteredName(dockerfilePath: string): string;
467
- declare function logicalDockerfileLines(dockerfileText: string): Array<{
468
- lineNumber: number;
469
- line: string;
470
- }>;
471
- declare function loadDockerfilePlan(dockerfilePath: string, registeredName?: string): Promise<DockerfileBuildPlan>;
472
- declare function loadImagePlan(image: Image, options?: Pick<CreateSandboxImageOptions, "registeredName" | "contextDir">): DockerfileBuildPlan;
473
- declare function registerImage(context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotSandboxId: string, snapshotUri: string, snapshotSizeBytes: number, rootfsDiskBytes: number, isPublic: boolean, snapshotFormatVersion?: string): Promise<Record<string, unknown>>;
474
- declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
475
- declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
476
-
477
- export { SnapshotStatus as $, type ArchivedSandboxInfo as A, type ContainerResourcesInfo as B, type CreatePtySessionOptions as C, type DaemonInfo as D, ContainerState as E, type CreateSandboxImageOptions as F, type DirectoryEntry as G, type HealthResponse as H, type DockerfileBuildPlan as I, type DockerfileInstruction as J, Image as K, type ListDirectoryResponse as L, type ImageBuildOperation as M, ImageBuildOperationType as N, type OutputResponse as O, type ProcessInfo as P, type ImageOptions as Q, type RunOptions as R, type SandboxOptions as S, type NetworkConfig as T, type UpdateSandboxOptions as U, OutputMode as V, type PoolContainerInfo as W, ProcessStatus as X, type ProcessUser as Y, type ProcessUserSpec as Z, type SandboxImageSource as _, type CreateAndConnectOptions as a, type SnapshotType as a0, type SnapshotWaitCondition as a1, StdinMode as a2, createSandboxImage as a3, dockerfileContent as a4, type BuildContext as a5, defaultRegisteredName as a6, loadDockerfilePlan as a7, loadImagePlan as a8, logicalDockerfileLines as a9, registerImage as aa, runCreateSandboxImageCli as ab, type SandboxClientOptions as b, type ConnectOptions as c, type SnapshotInfo as d, type SandboxInfo as e, SandboxStatus as f, type SuspendResumeOptions as g, type CheckpointOptions as h, type CommandResult as i, type StartProcessOptions as j, type SendSignalResponse as k, type OutputEvent as l, type PtySessionInfo as m, type CreateSandboxOptions as n, type CreateSandboxResponse as o, type ListArchivedSandboxesOptions as p, type ListArchivedSandboxesResponse as q, type SandboxPortAccess as r, type SnapshotOptions as s, type CreateSnapshotResponse as t, type SnapshotAndWaitOptions as u, type CreatePoolOptions as v, type CreateSandboxPoolResponse as w, type SandboxPoolInfo as x, type UpdatePoolOptions as y, type CheckpointType as z };