@run-cloud/sdk 0.5.1 → 0.6.0

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,49 @@
1
+ import { type CompatibilityClientOptions, type NativeSandbox } from "./common.js";
2
+ export interface DaytonaConfig extends CompatibilityClientOptions {
3
+ serverUrl?: string;
4
+ }
5
+ declare class Process {
6
+ private readonly native;
7
+ constructor(native: NativeSandbox);
8
+ exec(command: string, options?: {
9
+ cwd?: string;
10
+ timeout?: number;
11
+ }): Promise<{
12
+ exitCode: number;
13
+ result: string;
14
+ stdout: string;
15
+ stderr: string;
16
+ }>;
17
+ }
18
+ declare class FileSystem {
19
+ private readonly native;
20
+ constructor(native: NativeSandbox);
21
+ downloadFile(path: string): Promise<Uint8Array>;
22
+ downloadText(path: string): Promise<string>;
23
+ uploadFile(): never;
24
+ listFiles(): never;
25
+ deleteFile(): never;
26
+ createFolder(): never;
27
+ }
28
+ export declare class DaytonaSandbox {
29
+ readonly native: NativeSandbox;
30
+ readonly process: Process;
31
+ readonly fs: FileSystem;
32
+ constructor(native: NativeSandbox);
33
+ get id(): string;
34
+ getPreviewLink(): never;
35
+ delete(): Promise<void>;
36
+ }
37
+ export declare class Daytona {
38
+ private readonly options;
39
+ constructor(config?: DaytonaConfig);
40
+ create(params?: {
41
+ image?: string;
42
+ name?: string;
43
+ size?: string;
44
+ region?: string;
45
+ }): Promise<DaytonaSandbox>;
46
+ get(id: string): Promise<DaytonaSandbox>;
47
+ remove(sandbox: DaytonaSandbox): Promise<void>;
48
+ }
49
+ export {};
@@ -0,0 +1,87 @@
1
+ import { bytesToText, compatibilityClient, createNative, getNative, unsupported, } from "./common.js";
2
+ class Process {
3
+ native;
4
+ constructor(native) {
5
+ this.native = native;
6
+ }
7
+ async exec(command, options = {}) {
8
+ const result = await this.native.exec(command, {
9
+ cwd: options.cwd,
10
+ timeoutSeconds: options.timeout,
11
+ });
12
+ return {
13
+ exitCode: result.exitCode,
14
+ result: result.stdout,
15
+ stdout: result.stdout,
16
+ stderr: result.stderr,
17
+ };
18
+ }
19
+ }
20
+ class FileSystem {
21
+ native;
22
+ constructor(native) {
23
+ this.native = native;
24
+ }
25
+ async downloadFile(path) {
26
+ return await this.native.readFile(path);
27
+ }
28
+ async downloadText(path) {
29
+ return bytesToText(await this.native.readFile(path));
30
+ }
31
+ uploadFile() {
32
+ return unsupported("Daytona", "file uploads", "use an image or a command that writes the content");
33
+ }
34
+ listFiles() {
35
+ return unsupported("Daytona", "directory listing");
36
+ }
37
+ deleteFile() {
38
+ return unsupported("Daytona", "file deletion");
39
+ }
40
+ createFolder() {
41
+ return unsupported("Daytona", "directory creation");
42
+ }
43
+ }
44
+ export class DaytonaSandbox {
45
+ native;
46
+ process;
47
+ fs;
48
+ constructor(native) {
49
+ this.native = native;
50
+ this.process = new Process(native);
51
+ this.fs = new FileSystem(native);
52
+ }
53
+ get id() {
54
+ return this.native.id;
55
+ }
56
+ getPreviewLink() {
57
+ return unsupported("Daytona", "preview links", "run.cloud public port capabilities are not available in the SDK yet");
58
+ }
59
+ async delete() {
60
+ await this.native.destroy();
61
+ }
62
+ }
63
+ export class Daytona {
64
+ options;
65
+ constructor(config = {}) {
66
+ this.options = {
67
+ ...config,
68
+ apiUrl: config.apiUrl ?? config.serverUrl,
69
+ };
70
+ }
71
+ async create(params = {}) {
72
+ const client = compatibilityClient(this.options);
73
+ return new DaytonaSandbox(await createNative(client, {
74
+ image: params.image,
75
+ name: params.name,
76
+ region: params.region,
77
+ }));
78
+ }
79
+ async get(id) {
80
+ const client = compatibilityClient(this.options);
81
+ return new DaytonaSandbox(await getNative(client, id));
82
+ }
83
+ async remove(sandbox) {
84
+ await sandbox.delete();
85
+ }
86
+ }
87
+ //# sourceMappingURL=daytona.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daytona.js","sourceRoot":"","sources":["../../src/compat/daytona.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,mBAA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IACzD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAuB;QAClC,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,65 @@
1
+ import { type CompatibilityClientOptions, type NativeSandbox } from "./common.js";
2
+ export interface CommandResult {
3
+ stdout: string;
4
+ stderr: string;
5
+ exitCode: number;
6
+ }
7
+ export interface CreateOpts extends CompatibilityClientOptions {
8
+ template?: string;
9
+ timeoutMs?: number;
10
+ metadata?: Record<string, string>;
11
+ envs?: Record<string, string>;
12
+ }
13
+ declare class Commands {
14
+ private readonly sandbox;
15
+ constructor(sandbox: Sandbox);
16
+ run(command: string, options?: {
17
+ cwd?: string;
18
+ envs?: Record<string, string>;
19
+ timeoutMs?: number;
20
+ background?: boolean;
21
+ }): Promise<CommandResult>;
22
+ }
23
+ declare class Files {
24
+ private readonly native;
25
+ constructor(native: NativeSandbox);
26
+ read(path: string): Promise<string>;
27
+ readBytes(path: string): Promise<Uint8Array>;
28
+ write(): never;
29
+ list(): never;
30
+ remove(): never;
31
+ rename(): never;
32
+ makeDir(): never;
33
+ }
34
+ export declare class Sandbox {
35
+ readonly native: NativeSandbox;
36
+ private readonly client;
37
+ readonly environment: Record<string, string>;
38
+ private readonly metadata;
39
+ private readonly template?;
40
+ readonly commands: Commands;
41
+ readonly files: Files;
42
+ private constructor();
43
+ static create(options?: CreateOpts): Promise<Sandbox>;
44
+ static connect(sandboxId: string, options?: CompatibilityClientOptions): Promise<Sandbox>;
45
+ static list(options?: CompatibilityClientOptions): Promise<{
46
+ nextItems(): Promise<Array<{
47
+ sandboxId: string;
48
+ name: string;
49
+ metadata: Record<string, string>;
50
+ }>>;
51
+ }>;
52
+ get sandboxId(): string;
53
+ getInfo(): {
54
+ sandboxId: string;
55
+ name: string;
56
+ templateId: string | undefined;
57
+ metadata: {
58
+ [x: string]: string;
59
+ };
60
+ };
61
+ setTimeout(timeoutMs: number): Promise<void>;
62
+ getHost(): never;
63
+ kill(): Promise<boolean>;
64
+ }
65
+ export {};
@@ -0,0 +1,106 @@
1
+ import { bytesToText, compatibilityClient, createNative, getNative, listNative, unsupported, } from "./common.js";
2
+ class Commands {
3
+ sandbox;
4
+ constructor(sandbox) {
5
+ this.sandbox = sandbox;
6
+ }
7
+ async run(command, options = {}) {
8
+ if (options.background) {
9
+ unsupported("E2B", "background commands", "use Client.sandboxes.exec for synchronous execution");
10
+ }
11
+ const result = await this.sandbox.native.exec(command, {
12
+ cwd: options.cwd,
13
+ env: { ...this.sandbox.environment, ...(options.envs ?? {}) },
14
+ timeoutSeconds: options.timeoutMs ? Math.ceil(options.timeoutMs / 1000) : undefined,
15
+ });
16
+ return { stdout: result.stdout, stderr: result.stderr, exitCode: result.exitCode };
17
+ }
18
+ }
19
+ class Files {
20
+ native;
21
+ constructor(native) {
22
+ this.native = native;
23
+ }
24
+ async read(path) {
25
+ return bytesToText(await this.native.readFile(path));
26
+ }
27
+ async readBytes(path) {
28
+ return await this.native.readFile(path);
29
+ }
30
+ write() {
31
+ return unsupported("E2B", "file writes", "upload content in the sandbox command or use an image");
32
+ }
33
+ list() {
34
+ return unsupported("E2B", "directory listing");
35
+ }
36
+ remove() {
37
+ return unsupported("E2B", "file removal");
38
+ }
39
+ rename() {
40
+ return unsupported("E2B", "file rename");
41
+ }
42
+ makeDir() {
43
+ return unsupported("E2B", "directory creation");
44
+ }
45
+ }
46
+ export class Sandbox {
47
+ native;
48
+ client;
49
+ environment;
50
+ metadata;
51
+ template;
52
+ commands;
53
+ files;
54
+ constructor(native, client, environment, metadata, template) {
55
+ this.native = native;
56
+ this.client = client;
57
+ this.environment = environment;
58
+ this.metadata = metadata;
59
+ this.template = template;
60
+ this.commands = new Commands(this);
61
+ this.files = new Files(native);
62
+ }
63
+ static async create(options = {}) {
64
+ const client = compatibilityClient(options);
65
+ const native = await createNative(client, {
66
+ image: !options.template || options.template === "base" ? undefined : options.template,
67
+ timeoutSeconds: options.timeoutMs ? Math.ceil(options.timeoutMs / 1000) : undefined,
68
+ });
69
+ return new Sandbox(native, client, options.envs ?? {}, options.metadata ?? {}, options.template);
70
+ }
71
+ static async connect(sandboxId, options = {}) {
72
+ const client = compatibilityClient(options);
73
+ return new Sandbox(await getNative(client, sandboxId), client, {}, {}, undefined);
74
+ }
75
+ static async list(options = {}) {
76
+ const client = compatibilityClient(options);
77
+ const items = (await listNative(client)).map((sandbox) => ({
78
+ sandboxId: sandbox.id,
79
+ name: sandbox.name,
80
+ metadata: {},
81
+ }));
82
+ return { nextItems: async () => items };
83
+ }
84
+ get sandboxId() {
85
+ return this.native.id;
86
+ }
87
+ getInfo() {
88
+ return {
89
+ sandboxId: this.native.id,
90
+ name: this.native.name,
91
+ templateId: this.template,
92
+ metadata: { ...this.metadata },
93
+ };
94
+ }
95
+ async setTimeout(timeoutMs) {
96
+ await this.client.sandboxes.setTimeout(this.native.id, Math.ceil(timeoutMs / 1000));
97
+ }
98
+ getHost() {
99
+ return unsupported("E2B", "getHost", "run.cloud public port capabilities are not available in the SDK yet");
100
+ }
101
+ async kill() {
102
+ await this.native.destroy();
103
+ return true;
104
+ }
105
+ }
106
+ //# sourceMappingURL=e2b.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2b.js","sourceRoot":"","sources":["../../src/compat/e2b.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,UAAU,EAGV,WAAW,GACZ,MAAM,aAAa,CAAC;AAerB,MAAM,QAAQ;IACiB;IAA7B,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAEjD,KAAK,CAAC,GAAG,CACP,OAAe,EACf,UAAqG,EAAE;QAEvG,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,WAAW,CAAC,KAAK,EAAE,qBAAqB,EAAE,qDAAqD,CAAC,CAAC;QACnG,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAA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;QACR,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,28 @@
1
+ import { type CompatibilityClientOptions, type NativeSandbox } from "./common.js";
2
+ export declare class Machine {
3
+ readonly native: NativeSandbox;
4
+ constructor(native: NativeSandbox);
5
+ get id(): string;
6
+ get name(): string;
7
+ exec(command: string | string[]): Promise<import("../index.js").ExecResult>;
8
+ stop(): Promise<void>;
9
+ start(): Promise<void>;
10
+ destroy(): Promise<void>;
11
+ }
12
+ export declare class Machines {
13
+ private readonly options;
14
+ constructor(options?: CompatibilityClientOptions);
15
+ create(options?: {
16
+ name?: string;
17
+ image?: string;
18
+ region?: string;
19
+ guest?: {
20
+ cpus?: number;
21
+ memoryMb?: number;
22
+ };
23
+ }): Promise<Machine>;
24
+ get(id: string): Promise<Machine>;
25
+ list(): Promise<Machine[]>;
26
+ delete(id: string): Promise<void>;
27
+ volumes(): never;
28
+ }
@@ -0,0 +1,56 @@
1
+ import { compatibilityClient, createNative, getNative, listNative, unsupported, } from "./common.js";
2
+ export class Machine {
3
+ native;
4
+ constructor(native) {
5
+ this.native = native;
6
+ }
7
+ get id() {
8
+ return this.native.id;
9
+ }
10
+ get name() {
11
+ return this.native.name;
12
+ }
13
+ async exec(command) {
14
+ return await this.native.exec(command);
15
+ }
16
+ async stop() {
17
+ await this.native.pause();
18
+ }
19
+ async start() {
20
+ await this.native.resume();
21
+ }
22
+ async destroy() {
23
+ await this.native.destroy();
24
+ }
25
+ }
26
+ export class Machines {
27
+ options;
28
+ constructor(options = {}) {
29
+ this.options = options;
30
+ }
31
+ async create(options = {}) {
32
+ const client = compatibilityClient(this.options);
33
+ return new Machine(await createNative(client, {
34
+ name: options.name,
35
+ image: options.image,
36
+ region: options.region,
37
+ cpu: options.guest?.cpus,
38
+ memory: options.guest?.memoryMb,
39
+ }));
40
+ }
41
+ async get(id) {
42
+ const client = compatibilityClient(this.options);
43
+ return new Machine(await getNative(client, id));
44
+ }
45
+ async list() {
46
+ const client = compatibilityClient(this.options);
47
+ return (await listNative(client)).map((sandbox) => new Machine(sandbox));
48
+ }
49
+ async delete(id) {
50
+ await (await this.get(id)).destroy();
51
+ }
52
+ volumes() {
53
+ return unsupported("Fly Machines", "volumes");
54
+ }
55
+ }
56
+ //# sourceMappingURL=fly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fly.js","sourceRoot":"","sources":["../../src/compat/fly.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,UAAU,EAGV,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,MAAM,OAAO,OAAO;IACG;IAArB,YAAqB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE9C,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,OAAO,QAAQ;IACF,OAAO,CAA6B;IAErD,YAAY,UAAsC,EAAE;QAClD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,MAAM,CACV,UAKI,EAAE;QAEN,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,OAAO,IAAI,OAAO,CAChB,MAAM,YAAY,CAAC,MAAM,EAAE;YACzB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,GAAG,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI;YACxB,MAAM,EAAE,OAAO,CAAC,KAAK,EAAE,QAAQ;SAChC,CAAC,CACH,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,OAAO,IAAI,OAAO,CAAC,MAAM,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,OAAO,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACvC,CAAC;IAED,OAAO;QACL,OAAO,WAAW,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;CACF"}
@@ -0,0 +1,77 @@
1
+ import type { Client } from "../index.js";
2
+ import { type CompatibilityClientOptions, type NativeSandbox } from "./common.js";
3
+ export declare class Image {
4
+ readonly ref: string;
5
+ private constructor();
6
+ static fromRegistry(ref: string): Image;
7
+ static debianSlim(): Image;
8
+ aptInstall(): never;
9
+ pipInstall(): never;
10
+ runCommands(): never;
11
+ env(): never;
12
+ workdir(): never;
13
+ }
14
+ export declare class ContainerProcess {
15
+ private readonly result;
16
+ readonly stdout: {
17
+ read(): Promise<string>;
18
+ };
19
+ readonly stderr: {
20
+ read(): Promise<string>;
21
+ };
22
+ private returnCode;
23
+ constructor(result: Promise<{
24
+ stdout: string;
25
+ stderr: string;
26
+ exitCode: number;
27
+ }>);
28
+ wait(): Promise<number>;
29
+ poll(): number | null;
30
+ get returncode(): number | null;
31
+ }
32
+ export declare class App {
33
+ readonly name: string;
34
+ readonly client: Client;
35
+ constructor(name: string, client: Client);
36
+ static lookup(name: string, options?: CompatibilityClientOptions & {
37
+ createIfMissing?: boolean;
38
+ }): Promise<App>;
39
+ createSandbox(image?: string | Image, options?: Omit<CreateOptions, "app" | "image">): Promise<Sandbox>;
40
+ }
41
+ export interface CreateOptions {
42
+ app?: App;
43
+ image?: string | Image;
44
+ cpu?: number | [number, number];
45
+ memory?: number;
46
+ timeout?: number;
47
+ idleTimeout?: number;
48
+ name?: string;
49
+ region?: string;
50
+ command?: string[];
51
+ volumes?: unknown;
52
+ }
53
+ export declare class Sandbox {
54
+ readonly native: NativeSandbox;
55
+ private readonly app?;
56
+ private entrypoint?;
57
+ private constructor();
58
+ static create(options?: CreateOptions): Promise<Sandbox>;
59
+ static fromId(id: string, client?: Client): Promise<Sandbox>;
60
+ static fromName(app: App, name: string): Promise<Sandbox>;
61
+ static list(app?: App): Promise<Sandbox[]>;
62
+ get objectId(): string;
63
+ exec(command: string | string[], options?: {
64
+ workdir?: string;
65
+ env?: Record<string, string>;
66
+ timeout?: number;
67
+ }): ContainerProcess;
68
+ terminate(): Promise<number | null>;
69
+ detach(): void;
70
+ poll(): Promise<number | null>;
71
+ tunnels(): never;
72
+ setTags(): never;
73
+ }
74
+ export declare class Probe {
75
+ static withTcp(): never;
76
+ static withExec(): never;
77
+ }
@@ -0,0 +1,141 @@
1
+ import { compatibilityClient, createNative, getNative, listNative, unsupported, } from "./common.js";
2
+ export class Image {
3
+ ref;
4
+ constructor(ref) {
5
+ this.ref = ref;
6
+ }
7
+ static fromRegistry(ref) {
8
+ return new Image(ref);
9
+ }
10
+ static debianSlim() {
11
+ return new Image("debian:12-slim");
12
+ }
13
+ aptInstall() {
14
+ return unsupported("Modal", "Image.aptInstall", "register a prebuilt OCI image with run.cloud");
15
+ }
16
+ pipInstall() {
17
+ return unsupported("Modal", "Image.pipInstall", "register a prebuilt OCI image with run.cloud");
18
+ }
19
+ runCommands() {
20
+ return unsupported("Modal", "Image.runCommands", "register a prebuilt OCI image with run.cloud");
21
+ }
22
+ env() {
23
+ return unsupported("Modal", "Image.env", "register a prebuilt OCI image with run.cloud");
24
+ }
25
+ workdir() {
26
+ return unsupported("Modal", "Image.workdir", "register a prebuilt OCI image with run.cloud");
27
+ }
28
+ }
29
+ export class ContainerProcess {
30
+ result;
31
+ stdout;
32
+ stderr;
33
+ returnCode = null;
34
+ constructor(result) {
35
+ this.result = result;
36
+ this.stdout = { read: async () => (await this.result).stdout };
37
+ this.stderr = { read: async () => (await this.result).stderr };
38
+ }
39
+ async wait() {
40
+ this.returnCode = (await this.result).exitCode;
41
+ return this.returnCode;
42
+ }
43
+ poll() {
44
+ return this.returnCode;
45
+ }
46
+ get returncode() {
47
+ return this.returnCode;
48
+ }
49
+ }
50
+ export class App {
51
+ name;
52
+ client;
53
+ constructor(name, client) {
54
+ this.name = name;
55
+ this.client = client;
56
+ }
57
+ static async lookup(name, options = {}) {
58
+ return new App(name, compatibilityClient(options));
59
+ }
60
+ async createSandbox(image, options = {}) {
61
+ return await Sandbox.create({ ...options, app: this, image });
62
+ }
63
+ }
64
+ export class Sandbox {
65
+ native;
66
+ app;
67
+ entrypoint;
68
+ constructor(native, app) {
69
+ this.native = native;
70
+ this.app = app;
71
+ }
72
+ static async create(options = {}) {
73
+ if (options.volumes)
74
+ unsupported("Modal", "volumes");
75
+ if (Array.isArray(options.cpu)) {
76
+ unsupported("Modal", "CPU request/limit tuples", "pass a single CPU reservation");
77
+ }
78
+ const client = options.app?.client ?? compatibilityClient();
79
+ const native = await createNative(client, {
80
+ image: options.image instanceof Image ? options.image.ref : options.image,
81
+ cpu: options.cpu,
82
+ memory: options.memory,
83
+ timeoutSeconds: options.timeout,
84
+ idlePauseSeconds: options.idleTimeout,
85
+ name: options.name,
86
+ region: options.region,
87
+ });
88
+ const sandbox = new Sandbox(native, options.app);
89
+ if (options.command?.length)
90
+ sandbox.entrypoint = sandbox.exec(options.command);
91
+ return sandbox;
92
+ }
93
+ static async fromId(id, client) {
94
+ const actualClient = client ?? compatibilityClient();
95
+ return new Sandbox(await getNative(actualClient, id));
96
+ }
97
+ static async fromName(app, name) {
98
+ const match = (await listNative(app.client)).find((sandbox) => sandbox.name === name);
99
+ if (!match)
100
+ throw new Error(`no sandbox named ${name}`);
101
+ return new Sandbox(match, app);
102
+ }
103
+ static async list(app) {
104
+ const client = app?.client ?? compatibilityClient();
105
+ return (await listNative(client)).map((sandbox) => new Sandbox(sandbox, app));
106
+ }
107
+ get objectId() {
108
+ return this.native.id;
109
+ }
110
+ exec(command, options = {}) {
111
+ return new ContainerProcess(this.native.exec(command, {
112
+ cwd: options.workdir,
113
+ env: options.env,
114
+ timeoutSeconds: options.timeout,
115
+ }));
116
+ }
117
+ async terminate() {
118
+ await this.native.destroy();
119
+ return this.entrypoint?.returncode ?? null;
120
+ }
121
+ detach() { }
122
+ async poll() {
123
+ await this.native.refresh();
124
+ return ["running", "starting", "pending", "creating"].includes(this.native.state) ? null : 0;
125
+ }
126
+ tunnels() {
127
+ return unsupported("Modal", "tunnels", "run.cloud public port capabilities are not available in the SDK yet");
128
+ }
129
+ setTags() {
130
+ return unsupported("Modal", "server-side tags", "use the native sandbox name field");
131
+ }
132
+ }
133
+ export class Probe {
134
+ static withTcp() {
135
+ return unsupported("Modal", "TCP readiness probes");
136
+ }
137
+ static withExec() {
138
+ return unsupported("Modal", "exec readiness probes");
139
+ }
140
+ }
141
+ //# sourceMappingURL=modal.js.map
@@ -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,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/F,CAAC;IAED,OAAO;QACL,OAAO,WAAW,CAChB,OAAO,EACP,SAAS,EACT,qEAAqE,CACtE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,mCAAmC,CAAC,CAAC;IACvF,CAAC;CACF;AAED,MAAM,OAAO,KAAK;IAChB,MAAM,CAAC,OAAO;QACZ,OAAO,WAAW,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,CAAC,QAAQ;QACb,OAAO,WAAW,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;IACvD,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ import { type CompatibilityClientOptions, type NativeSandbox } from "./common.js";
2
+ export declare class Sprite {
3
+ readonly native: NativeSandbox;
4
+ readonly name: string;
5
+ constructor(native: NativeSandbox, name: string);
6
+ exec(command: string, args?: string[]): Promise<import("../index.js").ExecResult>;
7
+ run(command: string, args?: string[]): Promise<import("../index.js").ExecResult>;
8
+ filesystem(): never;
9
+ url(): never;
10
+ delete(): Promise<void>;
11
+ }
12
+ export declare class SpritesClient {
13
+ private readonly options;
14
+ constructor(options?: CompatibilityClientOptions);
15
+ private find;
16
+ createSprite(name: string, options?: {
17
+ image?: string;
18
+ region?: string;
19
+ }): Promise<Sprite>;
20
+ sprite(name: string): Promise<Sprite>;
21
+ getSprite(name: string): Promise<Sprite>;
22
+ listSprites(): Promise<Sprite[]>;
23
+ destroySprite(name: string): Promise<void>;
24
+ }