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.
@@ -0,0 +1,117 @@
1
+ declare const ImageBuildOperationType: {
2
+ readonly ADD: "ADD";
3
+ readonly COPY: "COPY";
4
+ readonly ENV: "ENV";
5
+ readonly RUN: "RUN";
6
+ readonly WORKDIR: "WORKDIR";
7
+ };
8
+ type ImageBuildOperationType = (typeof ImageBuildOperationType)[keyof typeof ImageBuildOperationType];
9
+ interface ImageBuildOperation {
10
+ type: ImageBuildOperationType;
11
+ args: string[];
12
+ options: Record<string, string>;
13
+ }
14
+ interface ImageOptions {
15
+ name?: string;
16
+ tag?: string;
17
+ baseImage?: string | null;
18
+ }
19
+ declare class Image {
20
+ readonly _id: string;
21
+ readonly _name: string;
22
+ readonly _tag: string;
23
+ readonly _baseImage: string | null;
24
+ readonly _buildOperations: ImageBuildOperation[];
25
+ constructor();
26
+ constructor(name: string, tag?: string, baseImage?: string | null);
27
+ constructor(options: ImageOptions);
28
+ get name(): string;
29
+ get tag(): string;
30
+ get baseImage(): string | null;
31
+ get buildOperations(): ImageBuildOperation[];
32
+ add(src: string, dest: string, options?: Record<string, string> | undefined): this;
33
+ copy(src: string, dest: string, options?: Record<string, string> | undefined): this;
34
+ env(key: string, value: string): this;
35
+ run(commands: string | string[], options?: Record<string, string> | undefined): this;
36
+ workdir(directory: string): this;
37
+ /**
38
+ * Build this image as a sandbox template and register it.
39
+ *
40
+ * Materializes the image in a build sandbox, snapshots the filesystem,
41
+ * and registers the snapshot as a named sandbox template.
42
+ */
43
+ build(options?: CreateSandboxImageOptions): Promise<Record<string, unknown>>;
44
+ private _addOperation;
45
+ }
46
+ declare function dockerfileContent(image: Image): string;
47
+
48
+ /**
49
+ * Sandbox-image build engine.
50
+ *
51
+ * Renders the source to a Dockerfile (for `Image` inputs) and hands the
52
+ * Dockerfile path/text + context to the Rust core via `@tensorlake/native`,
53
+ * which parses, validates, materializes, and registers the image. The Rust
54
+ * core owns parsing, the Dockerfile-instruction allowlist
55
+ * (`ARG`/`ONBUILD`/`SHELL`/`USER` are rejected) and ignored-set warnings
56
+ * (`CMD`/`ENTRYPOINT`/`EXPOSE`/`HEALTHCHECK`/`LABEL`/`STOPSIGNAL`/`VOLUME`).
57
+ */
58
+ interface CreateSandboxImageOptions {
59
+ registeredName?: string;
60
+ cpus?: number;
61
+ memoryMb?: number;
62
+ diskMb?: number;
63
+ builderDiskMb?: number;
64
+ isPublic?: boolean;
65
+ contextDir?: string;
66
+ /**
67
+ * Print build progress to stderr. Ignored when an explicit `emit` is
68
+ * passed via `deps`. Defaults to false — `createSandboxImage` is silent
69
+ * by default when invoked programmatically (e.g. `Image.build()`).
70
+ */
71
+ verbose?: boolean;
72
+ }
73
+ type SandboxImageSource = string | Image;
74
+ interface CreateSandboxImageDeps {
75
+ emit?: (event: Record<string, unknown>) => void;
76
+ }
77
+ interface NativeBindingOptions {
78
+ apiUrl: string;
79
+ bearerToken: string;
80
+ dockerfilePath: string;
81
+ registeredName?: string | undefined | null;
82
+ diskMb?: number | undefined | null;
83
+ builderDiskMb?: number | undefined | null;
84
+ cpus?: number | undefined | null;
85
+ memoryMb?: number | undefined | null;
86
+ isPublic?: boolean | undefined | null;
87
+ organizationId?: string | undefined | null;
88
+ projectId?: string | undefined | null;
89
+ namespace?: string | undefined | null;
90
+ useScopeHeaders?: boolean | undefined | null;
91
+ userAgent?: string | undefined | null;
92
+ dockerfileText?: string | undefined | null;
93
+ contextDir?: string | undefined | null;
94
+ }
95
+ interface NativeBindingEvent {
96
+ eventType: string;
97
+ stream?: string | undefined | null;
98
+ message: string;
99
+ }
100
+ interface NativeBinding {
101
+ buildSandboxImage(options: NativeBindingOptions, emit?: ((event: NativeBindingEvent) => void) | null | undefined): Promise<string>;
102
+ }
103
+ /** Test seam: replace the native binding with a stub. */
104
+ declare function __setNativeBindingForTest(binding: NativeBinding | undefined): void;
105
+ interface BuildContext {
106
+ apiUrl: string;
107
+ apiKey?: string;
108
+ personalAccessToken?: string;
109
+ namespace: string;
110
+ organizationId?: string;
111
+ projectId?: string;
112
+ debug: boolean;
113
+ }
114
+ declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
115
+ declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
116
+
117
+ export { type BuildContext as B, type CreateSandboxImageOptions as C, Image as I, type SandboxImageSource as S, __setNativeBindingForTest as _, type ImageBuildOperation as a, ImageBuildOperationType as b, type ImageOptions as c, createSandboxImage as d, dockerfileContent as e, type CreateSandboxImageDeps as f, runCreateSandboxImageCli as r };
@@ -0,0 +1,117 @@
1
+ declare const ImageBuildOperationType: {
2
+ readonly ADD: "ADD";
3
+ readonly COPY: "COPY";
4
+ readonly ENV: "ENV";
5
+ readonly RUN: "RUN";
6
+ readonly WORKDIR: "WORKDIR";
7
+ };
8
+ type ImageBuildOperationType = (typeof ImageBuildOperationType)[keyof typeof ImageBuildOperationType];
9
+ interface ImageBuildOperation {
10
+ type: ImageBuildOperationType;
11
+ args: string[];
12
+ options: Record<string, string>;
13
+ }
14
+ interface ImageOptions {
15
+ name?: string;
16
+ tag?: string;
17
+ baseImage?: string | null;
18
+ }
19
+ declare class Image {
20
+ readonly _id: string;
21
+ readonly _name: string;
22
+ readonly _tag: string;
23
+ readonly _baseImage: string | null;
24
+ readonly _buildOperations: ImageBuildOperation[];
25
+ constructor();
26
+ constructor(name: string, tag?: string, baseImage?: string | null);
27
+ constructor(options: ImageOptions);
28
+ get name(): string;
29
+ get tag(): string;
30
+ get baseImage(): string | null;
31
+ get buildOperations(): ImageBuildOperation[];
32
+ add(src: string, dest: string, options?: Record<string, string> | undefined): this;
33
+ copy(src: string, dest: string, options?: Record<string, string> | undefined): this;
34
+ env(key: string, value: string): this;
35
+ run(commands: string | string[], options?: Record<string, string> | undefined): this;
36
+ workdir(directory: string): this;
37
+ /**
38
+ * Build this image as a sandbox template and register it.
39
+ *
40
+ * Materializes the image in a build sandbox, snapshots the filesystem,
41
+ * and registers the snapshot as a named sandbox template.
42
+ */
43
+ build(options?: CreateSandboxImageOptions): Promise<Record<string, unknown>>;
44
+ private _addOperation;
45
+ }
46
+ declare function dockerfileContent(image: Image): string;
47
+
48
+ /**
49
+ * Sandbox-image build engine.
50
+ *
51
+ * Renders the source to a Dockerfile (for `Image` inputs) and hands the
52
+ * Dockerfile path/text + context to the Rust core via `@tensorlake/native`,
53
+ * which parses, validates, materializes, and registers the image. The Rust
54
+ * core owns parsing, the Dockerfile-instruction allowlist
55
+ * (`ARG`/`ONBUILD`/`SHELL`/`USER` are rejected) and ignored-set warnings
56
+ * (`CMD`/`ENTRYPOINT`/`EXPOSE`/`HEALTHCHECK`/`LABEL`/`STOPSIGNAL`/`VOLUME`).
57
+ */
58
+ interface CreateSandboxImageOptions {
59
+ registeredName?: string;
60
+ cpus?: number;
61
+ memoryMb?: number;
62
+ diskMb?: number;
63
+ builderDiskMb?: number;
64
+ isPublic?: boolean;
65
+ contextDir?: string;
66
+ /**
67
+ * Print build progress to stderr. Ignored when an explicit `emit` is
68
+ * passed via `deps`. Defaults to false — `createSandboxImage` is silent
69
+ * by default when invoked programmatically (e.g. `Image.build()`).
70
+ */
71
+ verbose?: boolean;
72
+ }
73
+ type SandboxImageSource = string | Image;
74
+ interface CreateSandboxImageDeps {
75
+ emit?: (event: Record<string, unknown>) => void;
76
+ }
77
+ interface NativeBindingOptions {
78
+ apiUrl: string;
79
+ bearerToken: string;
80
+ dockerfilePath: string;
81
+ registeredName?: string | undefined | null;
82
+ diskMb?: number | undefined | null;
83
+ builderDiskMb?: number | undefined | null;
84
+ cpus?: number | undefined | null;
85
+ memoryMb?: number | undefined | null;
86
+ isPublic?: boolean | undefined | null;
87
+ organizationId?: string | undefined | null;
88
+ projectId?: string | undefined | null;
89
+ namespace?: string | undefined | null;
90
+ useScopeHeaders?: boolean | undefined | null;
91
+ userAgent?: string | undefined | null;
92
+ dockerfileText?: string | undefined | null;
93
+ contextDir?: string | undefined | null;
94
+ }
95
+ interface NativeBindingEvent {
96
+ eventType: string;
97
+ stream?: string | undefined | null;
98
+ message: string;
99
+ }
100
+ interface NativeBinding {
101
+ buildSandboxImage(options: NativeBindingOptions, emit?: ((event: NativeBindingEvent) => void) | null | undefined): Promise<string>;
102
+ }
103
+ /** Test seam: replace the native binding with a stub. */
104
+ declare function __setNativeBindingForTest(binding: NativeBinding | undefined): void;
105
+ interface BuildContext {
106
+ apiUrl: string;
107
+ apiKey?: string;
108
+ personalAccessToken?: string;
109
+ namespace: string;
110
+ organizationId?: string;
111
+ projectId?: string;
112
+ debug: boolean;
113
+ }
114
+ declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
115
+ declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
116
+
117
+ export { type BuildContext as B, type CreateSandboxImageOptions as C, Image as I, type SandboxImageSource as S, __setNativeBindingForTest as _, type ImageBuildOperation as a, ImageBuildOperationType as b, type ImageOptions as c, createSandboxImage as d, dockerfileContent as e, type CreateSandboxImageDeps as f, runCreateSandboxImageCli as r };