modal 0.3.21 → 0.3.23
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/dist/index.cjs +487 -171
- package/dist/index.d.cts +58 -2
- package/dist/index.d.ts +58 -2
- package/dist/index.js +487 -171
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
|
|
2
2
|
|
|
3
|
+
declare enum GPUType {
|
|
4
|
+
/**
|
|
5
|
+
* GPU_TYPE_UNSPECIFIED - Note: this enum is no longer used by current clients - don't add new types
|
|
6
|
+
* Old clients still send it, so we use it server-side for compatibility
|
|
7
|
+
*/
|
|
8
|
+
GPU_TYPE_UNSPECIFIED = 0,
|
|
9
|
+
GPU_TYPE_T4 = 1,
|
|
10
|
+
GPU_TYPE_A100 = 2,
|
|
11
|
+
GPU_TYPE_A10G = 3,
|
|
12
|
+
GPU_TYPE_ANY = 4,
|
|
13
|
+
GPU_TYPE_A100_80GB = 8,
|
|
14
|
+
GPU_TYPE_L4 = 9,
|
|
15
|
+
GPU_TYPE_H100 = 10,
|
|
16
|
+
GPU_TYPE_L40S = 11,
|
|
17
|
+
GPU_TYPE_H200 = 12,
|
|
18
|
+
UNRECOGNIZED = -1
|
|
19
|
+
}
|
|
3
20
|
declare enum ParameterType {
|
|
4
21
|
PARAM_TYPE_UNSPECIFIED = 0,
|
|
5
22
|
PARAM_TYPE_STRING = 1,
|
|
@@ -40,6 +57,13 @@ interface ClassParameterSpec {
|
|
|
40
57
|
fullType: GenericPayloadType | undefined;
|
|
41
58
|
}
|
|
42
59
|
declare const ClassParameterSpec: MessageFns<ClassParameterSpec>;
|
|
60
|
+
interface GPUConfig {
|
|
61
|
+
/** Deprecated, at some point */
|
|
62
|
+
type: GPUType;
|
|
63
|
+
count: number;
|
|
64
|
+
gpuType: string;
|
|
65
|
+
}
|
|
66
|
+
declare const GPUConfig: MessageFns<GPUConfig>;
|
|
43
67
|
interface GenericPayloadType {
|
|
44
68
|
baseType: ParameterType;
|
|
45
69
|
/** sub-type for generic types like lists */
|
|
@@ -85,11 +109,27 @@ declare class Secret {
|
|
|
85
109
|
|
|
86
110
|
/** Options for deleting an Image. */
|
|
87
111
|
type ImageDeleteOptions = Record<never, never>;
|
|
112
|
+
/** Options for Image.dockerfileCommands(). */
|
|
113
|
+
type ImageDockerfileCommandsOptions = {
|
|
114
|
+
/** Secrets that will be made available to this layer's build environment. */
|
|
115
|
+
secrets?: Secret[];
|
|
116
|
+
/** GPU reservation for this layer's build environment (e.g. "A100", "T4:2", "A100-80GB:4"). */
|
|
117
|
+
gpu?: string;
|
|
118
|
+
/** Ignore cached builds for this layer, similar to 'docker build --no-cache'. */
|
|
119
|
+
forceBuild?: boolean;
|
|
120
|
+
};
|
|
121
|
+
/** Represents a single image layer with its build configuration. */
|
|
122
|
+
type Layer = {
|
|
123
|
+
commands: string[];
|
|
124
|
+
secrets?: Secret[];
|
|
125
|
+
gpuConfig?: GPUConfig;
|
|
126
|
+
forceBuild?: boolean;
|
|
127
|
+
};
|
|
88
128
|
/** A container image, used for starting Sandboxes. */
|
|
89
129
|
declare class Image {
|
|
90
130
|
#private;
|
|
91
131
|
/** @ignore */
|
|
92
|
-
constructor(imageId: string, tag: string, imageRegistryConfig?: ImageRegistryConfig);
|
|
132
|
+
constructor(imageId: string, tag: string, imageRegistryConfig?: ImageRegistryConfig, layers?: Layer[]);
|
|
93
133
|
get imageId(): string;
|
|
94
134
|
/**
|
|
95
135
|
* Creates an Image from an Image ID
|
|
@@ -118,6 +158,18 @@ declare class Image {
|
|
|
118
158
|
* @param secret - A Secret containing credentials for registry authentication.
|
|
119
159
|
*/
|
|
120
160
|
static fromGcpArtifactRegistry(tag: string, secret: Secret): Image;
|
|
161
|
+
private static validateDockerfileCommands;
|
|
162
|
+
/**
|
|
163
|
+
* Extend an image with arbitrary Dockerfile-like commands.
|
|
164
|
+
*
|
|
165
|
+
* Each call creates a new Image layer that will be built sequentially.
|
|
166
|
+
* The provided options apply only to this layer.
|
|
167
|
+
*
|
|
168
|
+
* @param commands - Array of Dockerfile commands as strings
|
|
169
|
+
* @param options - Optional configuration for this layer's build
|
|
170
|
+
* @returns A new Image instance
|
|
171
|
+
*/
|
|
172
|
+
dockerfileCommands(commands: string[], options?: ImageDockerfileCommandsOptions): Image;
|
|
121
173
|
/**
|
|
122
174
|
* Eagerly builds an Image on Modal.
|
|
123
175
|
*
|
|
@@ -231,6 +283,8 @@ type ExecOptions = {
|
|
|
231
283
|
timeout?: number;
|
|
232
284
|
/** Secrets with environment variables for the command. */
|
|
233
285
|
secrets?: Secret[];
|
|
286
|
+
/** Enable a PTY for the command. */
|
|
287
|
+
pty?: boolean;
|
|
234
288
|
};
|
|
235
289
|
/** A port forwarded from within a running Modal Sandbox. */
|
|
236
290
|
declare class Tunnel {
|
|
@@ -433,6 +487,8 @@ type SandboxCreateOptions = {
|
|
|
433
487
|
volumes?: Record<string, Volume>;
|
|
434
488
|
/** Mount points for cloud buckets. */
|
|
435
489
|
cloudBucketMounts?: Record<string, CloudBucketMount>;
|
|
490
|
+
/** Enable a PTY for the Sandbox. */
|
|
491
|
+
pty?: boolean;
|
|
436
492
|
/** List of ports to tunnel into the Sandbox. Encrypted ports are tunneled with TLS. */
|
|
437
493
|
encryptedPorts?: number[];
|
|
438
494
|
/** List of encrypted ports to tunnel into the Sandbox, using HTTP/2. */
|
|
@@ -747,4 +803,4 @@ declare class Queue {
|
|
|
747
803
|
iterate(options?: QueueIterateOptions): AsyncGenerator<any, void, unknown>;
|
|
748
804
|
}
|
|
749
805
|
|
|
750
|
-
export { AlreadyExistsError, App, type ClientOptions, CloudBucketMount, Cls, type ClsBatchingOptions, type ClsConcurrencyOptions, ClsInstance, type ClsOptions, ContainerProcess, type DeleteOptions, type EphemeralOptions, type ExecOptions, FunctionCall, type FunctionCallCancelOptions, type FunctionCallGetOptions, type FunctionStats, FunctionTimeoutError, Function_, Image, type ImageDeleteOptions, InternalFailure, InvalidError, type LookupOptions, type ModalReadStream, type ModalWriteStream, NotFoundError, Proxy, type ProxyFromNameOptions, Queue, type QueueClearOptions, QueueEmptyError, QueueFullError, type QueueGetOptions, type QueueIterateOptions, type QueueLenOptions, type QueuePutOptions, RemoteError, Retries, Sandbox, type SandboxCreateOptions, SandboxFile, type SandboxFileMode, type SandboxListOptions, SandboxTimeoutError, Secret, type SecretFromNameOptions, type StdioBehavior, type StreamMode, Tunnel, type UpdateAutoscalerOptions, Volume, type VolumeFromNameOptions, initializeClient };
|
|
806
|
+
export { AlreadyExistsError, App, type ClientOptions, CloudBucketMount, Cls, type ClsBatchingOptions, type ClsConcurrencyOptions, ClsInstance, type ClsOptions, ContainerProcess, type DeleteOptions, type EphemeralOptions, type ExecOptions, FunctionCall, type FunctionCallCancelOptions, type FunctionCallGetOptions, type FunctionStats, FunctionTimeoutError, Function_, Image, type ImageDeleteOptions, type ImageDockerfileCommandsOptions, InternalFailure, InvalidError, type LookupOptions, type ModalReadStream, type ModalWriteStream, NotFoundError, Proxy, type ProxyFromNameOptions, Queue, type QueueClearOptions, QueueEmptyError, QueueFullError, type QueueGetOptions, type QueueIterateOptions, type QueueLenOptions, type QueuePutOptions, RemoteError, Retries, Sandbox, type SandboxCreateOptions, SandboxFile, type SandboxFileMode, type SandboxListOptions, SandboxTimeoutError, Secret, type SecretFromNameOptions, type StdioBehavior, type StreamMode, Tunnel, type UpdateAutoscalerOptions, Volume, type VolumeFromNameOptions, initializeClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
|
|
2
2
|
|
|
3
|
+
declare enum GPUType {
|
|
4
|
+
/**
|
|
5
|
+
* GPU_TYPE_UNSPECIFIED - Note: this enum is no longer used by current clients - don't add new types
|
|
6
|
+
* Old clients still send it, so we use it server-side for compatibility
|
|
7
|
+
*/
|
|
8
|
+
GPU_TYPE_UNSPECIFIED = 0,
|
|
9
|
+
GPU_TYPE_T4 = 1,
|
|
10
|
+
GPU_TYPE_A100 = 2,
|
|
11
|
+
GPU_TYPE_A10G = 3,
|
|
12
|
+
GPU_TYPE_ANY = 4,
|
|
13
|
+
GPU_TYPE_A100_80GB = 8,
|
|
14
|
+
GPU_TYPE_L4 = 9,
|
|
15
|
+
GPU_TYPE_H100 = 10,
|
|
16
|
+
GPU_TYPE_L40S = 11,
|
|
17
|
+
GPU_TYPE_H200 = 12,
|
|
18
|
+
UNRECOGNIZED = -1
|
|
19
|
+
}
|
|
3
20
|
declare enum ParameterType {
|
|
4
21
|
PARAM_TYPE_UNSPECIFIED = 0,
|
|
5
22
|
PARAM_TYPE_STRING = 1,
|
|
@@ -40,6 +57,13 @@ interface ClassParameterSpec {
|
|
|
40
57
|
fullType: GenericPayloadType | undefined;
|
|
41
58
|
}
|
|
42
59
|
declare const ClassParameterSpec: MessageFns<ClassParameterSpec>;
|
|
60
|
+
interface GPUConfig {
|
|
61
|
+
/** Deprecated, at some point */
|
|
62
|
+
type: GPUType;
|
|
63
|
+
count: number;
|
|
64
|
+
gpuType: string;
|
|
65
|
+
}
|
|
66
|
+
declare const GPUConfig: MessageFns<GPUConfig>;
|
|
43
67
|
interface GenericPayloadType {
|
|
44
68
|
baseType: ParameterType;
|
|
45
69
|
/** sub-type for generic types like lists */
|
|
@@ -85,11 +109,27 @@ declare class Secret {
|
|
|
85
109
|
|
|
86
110
|
/** Options for deleting an Image. */
|
|
87
111
|
type ImageDeleteOptions = Record<never, never>;
|
|
112
|
+
/** Options for Image.dockerfileCommands(). */
|
|
113
|
+
type ImageDockerfileCommandsOptions = {
|
|
114
|
+
/** Secrets that will be made available to this layer's build environment. */
|
|
115
|
+
secrets?: Secret[];
|
|
116
|
+
/** GPU reservation for this layer's build environment (e.g. "A100", "T4:2", "A100-80GB:4"). */
|
|
117
|
+
gpu?: string;
|
|
118
|
+
/** Ignore cached builds for this layer, similar to 'docker build --no-cache'. */
|
|
119
|
+
forceBuild?: boolean;
|
|
120
|
+
};
|
|
121
|
+
/** Represents a single image layer with its build configuration. */
|
|
122
|
+
type Layer = {
|
|
123
|
+
commands: string[];
|
|
124
|
+
secrets?: Secret[];
|
|
125
|
+
gpuConfig?: GPUConfig;
|
|
126
|
+
forceBuild?: boolean;
|
|
127
|
+
};
|
|
88
128
|
/** A container image, used for starting Sandboxes. */
|
|
89
129
|
declare class Image {
|
|
90
130
|
#private;
|
|
91
131
|
/** @ignore */
|
|
92
|
-
constructor(imageId: string, tag: string, imageRegistryConfig?: ImageRegistryConfig);
|
|
132
|
+
constructor(imageId: string, tag: string, imageRegistryConfig?: ImageRegistryConfig, layers?: Layer[]);
|
|
93
133
|
get imageId(): string;
|
|
94
134
|
/**
|
|
95
135
|
* Creates an Image from an Image ID
|
|
@@ -118,6 +158,18 @@ declare class Image {
|
|
|
118
158
|
* @param secret - A Secret containing credentials for registry authentication.
|
|
119
159
|
*/
|
|
120
160
|
static fromGcpArtifactRegistry(tag: string, secret: Secret): Image;
|
|
161
|
+
private static validateDockerfileCommands;
|
|
162
|
+
/**
|
|
163
|
+
* Extend an image with arbitrary Dockerfile-like commands.
|
|
164
|
+
*
|
|
165
|
+
* Each call creates a new Image layer that will be built sequentially.
|
|
166
|
+
* The provided options apply only to this layer.
|
|
167
|
+
*
|
|
168
|
+
* @param commands - Array of Dockerfile commands as strings
|
|
169
|
+
* @param options - Optional configuration for this layer's build
|
|
170
|
+
* @returns A new Image instance
|
|
171
|
+
*/
|
|
172
|
+
dockerfileCommands(commands: string[], options?: ImageDockerfileCommandsOptions): Image;
|
|
121
173
|
/**
|
|
122
174
|
* Eagerly builds an Image on Modal.
|
|
123
175
|
*
|
|
@@ -231,6 +283,8 @@ type ExecOptions = {
|
|
|
231
283
|
timeout?: number;
|
|
232
284
|
/** Secrets with environment variables for the command. */
|
|
233
285
|
secrets?: Secret[];
|
|
286
|
+
/** Enable a PTY for the command. */
|
|
287
|
+
pty?: boolean;
|
|
234
288
|
};
|
|
235
289
|
/** A port forwarded from within a running Modal Sandbox. */
|
|
236
290
|
declare class Tunnel {
|
|
@@ -433,6 +487,8 @@ type SandboxCreateOptions = {
|
|
|
433
487
|
volumes?: Record<string, Volume>;
|
|
434
488
|
/** Mount points for cloud buckets. */
|
|
435
489
|
cloudBucketMounts?: Record<string, CloudBucketMount>;
|
|
490
|
+
/** Enable a PTY for the Sandbox. */
|
|
491
|
+
pty?: boolean;
|
|
436
492
|
/** List of ports to tunnel into the Sandbox. Encrypted ports are tunneled with TLS. */
|
|
437
493
|
encryptedPorts?: number[];
|
|
438
494
|
/** List of encrypted ports to tunnel into the Sandbox, using HTTP/2. */
|
|
@@ -747,4 +803,4 @@ declare class Queue {
|
|
|
747
803
|
iterate(options?: QueueIterateOptions): AsyncGenerator<any, void, unknown>;
|
|
748
804
|
}
|
|
749
805
|
|
|
750
|
-
export { AlreadyExistsError, App, type ClientOptions, CloudBucketMount, Cls, type ClsBatchingOptions, type ClsConcurrencyOptions, ClsInstance, type ClsOptions, ContainerProcess, type DeleteOptions, type EphemeralOptions, type ExecOptions, FunctionCall, type FunctionCallCancelOptions, type FunctionCallGetOptions, type FunctionStats, FunctionTimeoutError, Function_, Image, type ImageDeleteOptions, InternalFailure, InvalidError, type LookupOptions, type ModalReadStream, type ModalWriteStream, NotFoundError, Proxy, type ProxyFromNameOptions, Queue, type QueueClearOptions, QueueEmptyError, QueueFullError, type QueueGetOptions, type QueueIterateOptions, type QueueLenOptions, type QueuePutOptions, RemoteError, Retries, Sandbox, type SandboxCreateOptions, SandboxFile, type SandboxFileMode, type SandboxListOptions, SandboxTimeoutError, Secret, type SecretFromNameOptions, type StdioBehavior, type StreamMode, Tunnel, type UpdateAutoscalerOptions, Volume, type VolumeFromNameOptions, initializeClient };
|
|
806
|
+
export { AlreadyExistsError, App, type ClientOptions, CloudBucketMount, Cls, type ClsBatchingOptions, type ClsConcurrencyOptions, ClsInstance, type ClsOptions, ContainerProcess, type DeleteOptions, type EphemeralOptions, type ExecOptions, FunctionCall, type FunctionCallCancelOptions, type FunctionCallGetOptions, type FunctionStats, FunctionTimeoutError, Function_, Image, type ImageDeleteOptions, type ImageDockerfileCommandsOptions, InternalFailure, InvalidError, type LookupOptions, type ModalReadStream, type ModalWriteStream, NotFoundError, Proxy, type ProxyFromNameOptions, Queue, type QueueClearOptions, QueueEmptyError, QueueFullError, type QueueGetOptions, type QueueIterateOptions, type QueueLenOptions, type QueuePutOptions, RemoteError, Retries, Sandbox, type SandboxCreateOptions, SandboxFile, type SandboxFileMode, type SandboxListOptions, SandboxTimeoutError, Secret, type SecretFromNameOptions, type StdioBehavior, type StreamMode, Tunnel, type UpdateAutoscalerOptions, Volume, type VolumeFromNameOptions, initializeClient };
|