@sailresearch/sdk 0.2.14
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/LICENSE +201 -0
- package/README.md +126 -0
- package/dist/app.d.ts +23 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +40 -0
- package/dist/app.js.map +1 -0
- package/dist/client.d.ts +119 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +291 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +15 -0
- package/dist/config.js.map +1 -0
- package/dist/default-client.d.ts +13 -0
- package/dist/default-client.d.ts.map +1 -0
- package/dist/default-client.js +22 -0
- package/dist/default-client.js.map +1 -0
- package/dist/errors.d.ts +88 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +201 -0
- package/dist/errors.js.map +1 -0
- package/dist/exec-process.d.ts +56 -0
- package/dist/exec-process.d.ts.map +1 -0
- package/dist/exec-process.js +105 -0
- package/dist/exec-process.js.map +1 -0
- package/dist/exec-stream.d.ts +21 -0
- package/dist/exec-stream.d.ts.map +1 -0
- package/dist/exec-stream.js +47 -0
- package/dist/exec-stream.js.map +1 -0
- package/dist/file-stream.d.ts +41 -0
- package/dist/file-stream.d.ts.map +1 -0
- package/dist/file-stream.js +86 -0
- package/dist/file-stream.js.map +1 -0
- package/dist/image.d.ts +90 -0
- package/dist/image.d.ts.map +1 -0
- package/dist/image.js +193 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/native.d.ts +10 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +24 -0
- package/dist/native.js.map +1 -0
- package/dist/sailbox.d.ts +210 -0
- package/dist/sailbox.d.ts.map +1 -0
- package/dist/sailbox.js +339 -0
- package/dist/sailbox.js.map +1 -0
- package/dist/ssh.d.ts +16 -0
- package/dist/ssh.d.ts.map +1 -0
- package/dist/ssh.js +3 -0
- package/dist/ssh.js.map +1 -0
- package/dist/types/config.d.ts +21 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +4 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/exec.d.ts +41 -0
- package/dist/types/exec.d.ts.map +1 -0
- package/dist/types/exec.js +4 -0
- package/dist/types/exec.js.map +1 -0
- package/dist/types/image.d.ts +50 -0
- package/dist/types/image.d.ts.map +1 -0
- package/dist/types/image.js +12 -0
- package/dist/types/image.js.map +1 -0
- package/dist/types/listener.d.ts +38 -0
- package/dist/types/listener.d.ts.map +1 -0
- package/dist/types/listener.js +21 -0
- package/dist/types/listener.js.map +1 -0
- package/dist/types/sailbox.d.ts +62 -0
- package/dist/types/sailbox.d.ts.map +1 -0
- package/dist/types/sailbox.js +19 -0
- package/dist/types/sailbox.js.map +1 -0
- package/dist/util.d.ts +3 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +10 -0
- package/dist/util.js.map +1 -0
- package/dist/validate.d.ts +35 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +87 -0
- package/dist/validate.js.map +1 -0
- package/dist/volume.d.ts +42 -0
- package/dist/volume.d.ts.map +1 -0
- package/dist/volume.js +72 -0
- package/dist/volume.js.map +1 -0
- package/native/index.d.ts +733 -0
- package/native/index.js +601 -0
- package/package.json +77 -0
package/dist/image.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Client } from "./client.js";
|
|
2
|
+
import type { ImageArchitecture, ImageSpec } from "./types/image.js";
|
|
3
|
+
/** Target CPU architecture for a base image. */
|
|
4
|
+
/** Options for {@link Image.addLocalFile}. */
|
|
5
|
+
export interface AddLocalFileOptions {
|
|
6
|
+
/** Unix mode bits (low 9); omitted uses the builder default (0644). */
|
|
7
|
+
mode?: number;
|
|
8
|
+
}
|
|
9
|
+
/** Options for {@link Image.addLocalDir}. */
|
|
10
|
+
export interface AddLocalDirOptions {
|
|
11
|
+
/** Gitignore-style patterns to skip (e.g. `"*.pyc"`, `"__pycache__/"`). */
|
|
12
|
+
ignore?: string[];
|
|
13
|
+
/** A gitignore-style file whose patterns to skip (e.g. `.gitignore`). */
|
|
14
|
+
ignoreFile?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A custom image definition. Immutable and fluent: each method returns a new
|
|
18
|
+
* `Image`. Local files/dirs are recorded here and hashed + uploaded by the
|
|
19
|
+
* core when the image is resolved to a spec (at {@link Sailbox.create}, or via
|
|
20
|
+
* {@link toSpec}), so chaining stays synchronous.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const image = Image.debian("arm64")
|
|
25
|
+
* .aptInstall("git")
|
|
26
|
+
* .pipInstall("numpy")
|
|
27
|
+
* .addLocalDir("./app", "/app", { ignore: ["*.pyc", "__pycache__/"] })
|
|
28
|
+
* .runCommand("pip install -e /app");
|
|
29
|
+
* const box = await Sailbox.create({ app, name: "w", image });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class Image {
|
|
33
|
+
private readonly base;
|
|
34
|
+
private readonly architecture;
|
|
35
|
+
private readonly envVars;
|
|
36
|
+
private readonly steps;
|
|
37
|
+
private constructor();
|
|
38
|
+
/** A Debian base image (defaults to arm64). */
|
|
39
|
+
static debian(architecture?: ImageArchitecture): Image;
|
|
40
|
+
/** The devbox base image (defaults to arm64): a prebuilt Debian base with a
|
|
41
|
+
* baked development layer. Prebuilt-only, so it does not support build
|
|
42
|
+
* steps or env; start from {@link Image.debian} to customize. */
|
|
43
|
+
static devbox(architecture?: ImageArchitecture): Image;
|
|
44
|
+
/** Install system packages with apt. */
|
|
45
|
+
aptInstall(...packages: string[]): Image;
|
|
46
|
+
/** Install Python packages with pip. */
|
|
47
|
+
pipInstall(...packages: string[]): Image;
|
|
48
|
+
/** Run a shell command during the build. */
|
|
49
|
+
runCommand(command: string): Image;
|
|
50
|
+
/** Bake environment variables into the image (keys are trimmed). */
|
|
51
|
+
env(env: Record<string, string>): Image;
|
|
52
|
+
/** Bake one local file into the image at `path` (absolute POSIX path;
|
|
53
|
+
* a trailing `/` appends the source basename). Hashed + uploaded at resolve. */
|
|
54
|
+
addLocalFile(localPath: string, remotePath: string, options?: AddLocalFileOptions): Image;
|
|
55
|
+
/** Bake a local directory tree into the image at `path`. Each regular
|
|
56
|
+
* file is hashed + uploaded at resolve; symlinks are skipped and file modes
|
|
57
|
+
* preserved. `ignore` takes gitignore-style patterns. */
|
|
58
|
+
addLocalDir(localPath: string, remotePath: string, options?: AddLocalDirOptions): Image;
|
|
59
|
+
/**
|
|
60
|
+
* Resolve to an {@link ImageSpec}, hashing and uploading any local
|
|
61
|
+
* files/dirs via `client` (defaults to the env client). The walk, gitignore
|
|
62
|
+
* matching, hashing, and uploads all run in the core. {@link Sailbox.create}
|
|
63
|
+
* calls this for you; use it directly only if you need the raw spec.
|
|
64
|
+
*/
|
|
65
|
+
toSpec(client?: Client): Promise<ImageSpec>;
|
|
66
|
+
/**
|
|
67
|
+
* Upload any local files and build the image, waiting until it is ready.
|
|
68
|
+
* Returns the resolved {@link ImageSpec}. {@link Sailbox.create} calls this
|
|
69
|
+
* for a custom image before creating the sailbox (the backend serves the
|
|
70
|
+
* content-addressed built image); a bare base image skips the build.
|
|
71
|
+
*/
|
|
72
|
+
build(options?: {
|
|
73
|
+
client?: Client;
|
|
74
|
+
timeoutSeconds?: number;
|
|
75
|
+
}): Promise<ImageSpec>;
|
|
76
|
+
private definition;
|
|
77
|
+
private withStep;
|
|
78
|
+
/** The devbox base is prebuilt-only; the backend rejects it with any build
|
|
79
|
+
* steps or env, so fail at the builder call instead. */
|
|
80
|
+
private rejectDevboxCustomization;
|
|
81
|
+
}
|
|
82
|
+
export declare function isBuiltinBaseSpec(spec: ImageSpec, client?: Client): boolean;
|
|
83
|
+
/** Whether resolving this `image` option runs an image build (an {@link Image}
|
|
84
|
+
* may still skip it in the core when it is a bare builtin base). */
|
|
85
|
+
export declare function willBuild(image: ImageSpec | Image, client?: Client): boolean;
|
|
86
|
+
/** Resolve the `image` option of {@link Sailbox.create}: build an {@link Image}
|
|
87
|
+
* (the core skips the build for a bare builtin base), pass a builtin
|
|
88
|
+
* {@link ImageSpec} through, and build a custom spec to ready. */
|
|
89
|
+
export declare function resolveImageForCreate(client: Client, image: ImageSpec | Image, timeoutSeconds: number): Promise<ImageSpec>;
|
|
90
|
+
//# sourceMappingURL=image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAErE,gDAAgD;AAChD,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,KAAK;IAEd,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJxB,OAAO;IAOP,+CAA+C;IAC/C,MAAM,CAAC,MAAM,CAAC,YAAY,GAAE,iBAA2B,GAAG,KAAK;IAI/D;;qEAEiE;IACjE,MAAM,CAAC,MAAM,CAAC,YAAY,GAAE,iBAA2B,GAAG,KAAK;IAI/D,wCAAwC;IACxC,UAAU,CAAC,GAA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
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Image = void 0;
|
|
4
|
+
exports.isBuiltinBaseSpec = isBuiltinBaseSpec;
|
|
5
|
+
exports.willBuild = willBuild;
|
|
6
|
+
exports.resolveImageForCreate = resolveImageForCreate;
|
|
7
|
+
const default_client_js_1 = require("./default-client.js");
|
|
8
|
+
const errors_js_1 = require("./errors.js");
|
|
9
|
+
/**
|
|
10
|
+
* A custom image definition. Immutable and fluent: each method returns a new
|
|
11
|
+
* `Image`. Local files/dirs are recorded here and hashed + uploaded by the
|
|
12
|
+
* core when the image is resolved to a spec (at {@link Sailbox.create}, or via
|
|
13
|
+
* {@link toSpec}), so chaining stays synchronous.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const image = Image.debian("arm64")
|
|
18
|
+
* .aptInstall("git")
|
|
19
|
+
* .pipInstall("numpy")
|
|
20
|
+
* .addLocalDir("./app", "/app", { ignore: ["*.pyc", "__pycache__/"] })
|
|
21
|
+
* .runCommand("pip install -e /app");
|
|
22
|
+
* const box = await Sailbox.create({ app, name: "w", image });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
class Image {
|
|
26
|
+
base;
|
|
27
|
+
architecture;
|
|
28
|
+
envVars;
|
|
29
|
+
steps;
|
|
30
|
+
constructor(base, architecture, envVars, steps) {
|
|
31
|
+
this.base = base;
|
|
32
|
+
this.architecture = architecture;
|
|
33
|
+
this.envVars = envVars;
|
|
34
|
+
this.steps = steps;
|
|
35
|
+
}
|
|
36
|
+
/** A Debian base image (defaults to arm64). */
|
|
37
|
+
static debian(architecture = "arm64") {
|
|
38
|
+
return new Image("debian", checkedArchitecture(architecture), {}, []);
|
|
39
|
+
}
|
|
40
|
+
/** The devbox base image (defaults to arm64): a prebuilt Debian base with a
|
|
41
|
+
* baked development layer. Prebuilt-only, so it does not support build
|
|
42
|
+
* steps or env; start from {@link Image.debian} to customize. */
|
|
43
|
+
static devbox(architecture = "arm64") {
|
|
44
|
+
return new Image("devbox", checkedArchitecture(architecture), {}, []);
|
|
45
|
+
}
|
|
46
|
+
/** Install system packages with apt. */
|
|
47
|
+
aptInstall(...packages) {
|
|
48
|
+
return this.withStep({
|
|
49
|
+
aptInstall: cleanPackages(packages, "aptInstall"),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/** Install Python packages with pip. */
|
|
53
|
+
pipInstall(...packages) {
|
|
54
|
+
return this.withStep({
|
|
55
|
+
pipInstall: cleanPackages(packages, "pipInstall"),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/** Run a shell command during the build. */
|
|
59
|
+
runCommand(command) {
|
|
60
|
+
const cmd = command.trim();
|
|
61
|
+
if (!cmd) {
|
|
62
|
+
throw new errors_js_1.InvalidArgumentError("runCommand requires a non-empty command");
|
|
63
|
+
}
|
|
64
|
+
return this.withStep({ runCommand: cmd });
|
|
65
|
+
}
|
|
66
|
+
/** Bake environment variables into the image (keys are trimmed). */
|
|
67
|
+
env(env) {
|
|
68
|
+
this.rejectDevboxCustomization();
|
|
69
|
+
const entries = Object.entries(env);
|
|
70
|
+
if (entries.length === 0) {
|
|
71
|
+
throw new errors_js_1.InvalidArgumentError("env requires at least one key");
|
|
72
|
+
}
|
|
73
|
+
const cleaned = {};
|
|
74
|
+
for (const [key, value] of entries) {
|
|
75
|
+
const cleanKey = key.trim();
|
|
76
|
+
if (!cleanKey) {
|
|
77
|
+
throw new errors_js_1.InvalidArgumentError("env keys must be non-empty");
|
|
78
|
+
}
|
|
79
|
+
cleaned[cleanKey] = value;
|
|
80
|
+
}
|
|
81
|
+
return new Image(this.base, this.architecture, { ...this.envVars, ...cleaned }, this.steps);
|
|
82
|
+
}
|
|
83
|
+
/** Bake one local file into the image at `path` (absolute POSIX path;
|
|
84
|
+
* a trailing `/` appends the source basename). Hashed + uploaded at resolve. */
|
|
85
|
+
addLocalFile(localPath, remotePath, options = {}) {
|
|
86
|
+
// A fractional mode would truncate at the native u32 boundary and bake
|
|
87
|
+
// different permissions than the caller wrote.
|
|
88
|
+
if (options.mode !== undefined &&
|
|
89
|
+
(!Number.isInteger(options.mode) ||
|
|
90
|
+
options.mode < 0 ||
|
|
91
|
+
options.mode > 0o777)) {
|
|
92
|
+
throw new errors_js_1.InvalidArgumentError("mode must be between 0 and 0o777");
|
|
93
|
+
}
|
|
94
|
+
return this.withStep({
|
|
95
|
+
addLocalFile: { localPath, remotePath, mode: options.mode },
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** Bake a local directory tree into the image at `path`. Each regular
|
|
99
|
+
* file is hashed + uploaded at resolve; symlinks are skipped and file modes
|
|
100
|
+
* preserved. `ignore` takes gitignore-style patterns. */
|
|
101
|
+
addLocalDir(localPath, remotePath, options = {}) {
|
|
102
|
+
return this.withStep({
|
|
103
|
+
addLocalDir: {
|
|
104
|
+
localPath,
|
|
105
|
+
remotePath,
|
|
106
|
+
ignore: options.ignore,
|
|
107
|
+
ignoreFile: options.ignoreFile,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Resolve to an {@link ImageSpec}, hashing and uploading any local
|
|
113
|
+
* files/dirs via `client` (defaults to the env client). The walk, gitignore
|
|
114
|
+
* matching, hashing, and uploads all run in the core. {@link Sailbox.create}
|
|
115
|
+
* calls this for you; use it directly only if you need the raw spec.
|
|
116
|
+
*/
|
|
117
|
+
toSpec(client) {
|
|
118
|
+
return (client ?? (0, default_client_js_1.defaultClient)()).resolveImage(this.definition());
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Upload any local files and build the image, waiting until it is ready.
|
|
122
|
+
* Returns the resolved {@link ImageSpec}. {@link Sailbox.create} calls this
|
|
123
|
+
* for a custom image before creating the sailbox (the backend serves the
|
|
124
|
+
* content-addressed built image); a bare base image skips the build.
|
|
125
|
+
*/
|
|
126
|
+
build(options = {}) {
|
|
127
|
+
return (options.client ?? (0, default_client_js_1.defaultClient)()).buildImageDefinition(this.definition(), options.timeoutSeconds ?? 1800);
|
|
128
|
+
}
|
|
129
|
+
definition() {
|
|
130
|
+
return {
|
|
131
|
+
base: this.base,
|
|
132
|
+
architecture: this.architecture,
|
|
133
|
+
env: Object.keys(this.envVars).length ? { ...this.envVars } : undefined,
|
|
134
|
+
steps: this.steps.length ? [...this.steps] : undefined,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
withStep(step) {
|
|
138
|
+
this.rejectDevboxCustomization();
|
|
139
|
+
return new Image(this.base, this.architecture, this.envVars, [
|
|
140
|
+
...this.steps,
|
|
141
|
+
step,
|
|
142
|
+
]);
|
|
143
|
+
}
|
|
144
|
+
/** The devbox base is prebuilt-only; the backend rejects it with any build
|
|
145
|
+
* steps or env, so fail at the builder call instead. */
|
|
146
|
+
rejectDevboxCustomization() {
|
|
147
|
+
if (this.base === "devbox") {
|
|
148
|
+
throw new errors_js_1.InvalidArgumentError("the devbox base image does not support build steps or env; start " +
|
|
149
|
+
"from Image.debian() to customize");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.Image = Image;
|
|
154
|
+
function cleanPackages(packages, method) {
|
|
155
|
+
const cleaned = packages.map((pkg) => pkg.trim());
|
|
156
|
+
if (cleaned.length === 0) {
|
|
157
|
+
throw new errors_js_1.InvalidArgumentError(`${method} requires at least one package`);
|
|
158
|
+
}
|
|
159
|
+
if (cleaned.some((pkg) => !pkg)) {
|
|
160
|
+
throw new errors_js_1.InvalidArgumentError(`${method} packages must be non-empty`);
|
|
161
|
+
}
|
|
162
|
+
return cleaned;
|
|
163
|
+
}
|
|
164
|
+
/** A bare base image the backend already ships prebuilt (no build needed).
|
|
165
|
+
* The predicate lives in the core, shared by every SDK. */
|
|
166
|
+
/** Fail fast on an unknown architecture from untyped JS. */
|
|
167
|
+
function checkedArchitecture(architecture) {
|
|
168
|
+
if (architecture !== "amd64" && architecture !== "arm64") {
|
|
169
|
+
throw new errors_js_1.InvalidArgumentError(`unknown architecture ${JSON.stringify(architecture)}; use "amd64" or "arm64"`);
|
|
170
|
+
}
|
|
171
|
+
return architecture;
|
|
172
|
+
}
|
|
173
|
+
function isBuiltinBaseSpec(spec, client) {
|
|
174
|
+
return (client ?? (0, default_client_js_1.defaultClient)()).isBuiltinBaseSpec(spec);
|
|
175
|
+
}
|
|
176
|
+
/** Whether resolving this `image` option runs an image build (an {@link Image}
|
|
177
|
+
* may still skip it in the core when it is a bare builtin base). */
|
|
178
|
+
function willBuild(image, client) {
|
|
179
|
+
return image instanceof Image || !isBuiltinBaseSpec(image, client);
|
|
180
|
+
}
|
|
181
|
+
/** Resolve the `image` option of {@link Sailbox.create}: build an {@link Image}
|
|
182
|
+
* (the core skips the build for a bare builtin base), pass a builtin
|
|
183
|
+
* {@link ImageSpec} through, and build a custom spec to ready. */
|
|
184
|
+
async function resolveImageForCreate(client, image, timeoutSeconds) {
|
|
185
|
+
if (image instanceof Image) {
|
|
186
|
+
return image.build({ client, timeoutSeconds });
|
|
187
|
+
}
|
|
188
|
+
if (!isBuiltinBaseSpec(image, client)) {
|
|
189
|
+
await client.buildSpecToReady(image, timeoutSeconds);
|
|
190
|
+
}
|
|
191
|
+
return image;
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":";;;AA8NA,8CAEC;AAID,8BAEC;AAKD,sDAYC;AAtPD,2DAAoD;AACpD,2CAAmD;AAmBnD;;;;;;;;;;;;;;;GAeG;AACH,MAAa,KAAK;IAEG;IACA;IACA;IACA;IAJnB,YACmB,IAAY,EACZ,YAAoB,EACpB,OAAyC,EACzC,KAAqC;QAHrC,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAQ;QACp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AAqB,CACzC,MAAc,EACd,KAAwB,EACxB,cAAsB;IAEtB,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sailresearch/sdk — TypeScript SDK for Sail sandboxes (sailboxes), a thin wrapper over
|
|
3
|
+
* the canonical Rust core. Runs on Node 20+ and Bun.
|
|
4
|
+
*
|
|
5
|
+
* The object-model API ({@link Sailbox}, {@link App}, {@link Volume}) is the
|
|
6
|
+
* ergonomic entry point; {@link Client} is the lower-level surface underneath.
|
|
7
|
+
*/
|
|
8
|
+
export { Sailbox } from "./sailbox.js";
|
|
9
|
+
export { App } from "./app.js";
|
|
10
|
+
export { Volume } from "./volume.js";
|
|
11
|
+
/** Guest-side: headers that authenticate this sailbox as an ingress
|
|
12
|
+
* allowlist source (only available inside a sailbox guest). */
|
|
13
|
+
export { ingressAuthHeaders } from "./native.js";
|
|
14
|
+
export { Image } from "./image.js";
|
|
15
|
+
export { Client } from "./client.js";
|
|
16
|
+
export { defaultClient, setDefaultClient } from "./default-client.js";
|
|
17
|
+
export { ExecProcess } from "./exec-process.js";
|
|
18
|
+
export { ExecStream } from "./exec-stream.js";
|
|
19
|
+
export { FileStream, FileWriter } from "./file-stream.js";
|
|
20
|
+
export { resolveConfig } from "./config.js";
|
|
21
|
+
export { SailError, InvalidArgumentError, InternalError, NotFoundError, PermissionDeniedError, FileNotFoundError, BrokenPipeError, TimeoutError, TransportError, ApiError, SailboxCreationError, ImageBuildError, SailboxExecutionError, SailboxTerminatedError, SailboxExecRequestNotFoundError, SailboxWorkerLostError, } from "./errors.js";
|
|
22
|
+
export type { AddLocalDirOptions, AddLocalFileOptions } from "./image.js";
|
|
23
|
+
export type { CreateSailboxOptions, CheckpointOptions, FromCheckpointOptions, SailboxPage, WaitForListenerOptions, } from "./sailbox.js";
|
|
24
|
+
export type { EnableSshOptions, SshEndpoint } from "./ssh.js";
|
|
25
|
+
export type { AppInfo, ImageDefinition, ImageDefinitionStep, LocalDirInput, LocalFileInput, VolumeInfo, } from "./native.js";
|
|
26
|
+
export type { ClientConfig, ClientOptions, IngressScheme, ResolvedConfig, SailMode, } from "./types/config.js";
|
|
27
|
+
export type { CancelOptions, ExecOptions, ExecResult, ShellOptions, WriteOptions, } from "./types/exec.js";
|
|
28
|
+
export type { AddLocalDir, AddLocalDirFile, AddLocalFile, BaseImage, ImageArchitecture, ImageBuild, ImageBuildStatus, ImageBuildStep, ImageSpec, PackageInstall, RunCommand, } from "./types/image.js";
|
|
29
|
+
export type { HttpEndpoint, IngressProtocol, Listener, ListenerEndpoint, TcpEndpoint, ListenerRouteStatus, Protocol, } from "./types/listener.js";
|
|
30
|
+
export type { SailboxSize, CreateSailboxRequest, FromCheckpointRequest, IngressPortInput, ListSailboxesQuery, SailboxCheckpoint, SailboxHandle, SailboxInfo, SailboxInfoPage, SailboxStatus, SailboxStatusFilter, UpgradeResult, VolumeMountInput, } from "./types/sailbox.js";
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;+DAC+D;AAC/D,OAAO,EAAE,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ACT,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,cAAc,EACd,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GACjB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @sailresearch/sdk — TypeScript SDK for Sail sandboxes (sailboxes), a thin wrapper over
|
|
4
|
+
* the canonical Rust core. Runs on Node 20+ and Bun.
|
|
5
|
+
*
|
|
6
|
+
* The object-model API ({@link Sailbox}, {@link App}, {@link Volume}) is the
|
|
7
|
+
* ergonomic entry point; {@link Client} is the lower-level surface underneath.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SailboxWorkerLostError = exports.SailboxExecRequestNotFoundError = exports.SailboxTerminatedError = exports.SailboxExecutionError = exports.ImageBuildError = exports.SailboxCreationError = exports.ApiError = exports.TransportError = exports.TimeoutError = exports.BrokenPipeError = exports.FileNotFoundError = exports.PermissionDeniedError = exports.NotFoundError = exports.InternalError = exports.InvalidArgumentError = exports.SailError = exports.resolveConfig = exports.FileWriter = exports.FileStream = exports.ExecStream = exports.ExecProcess = exports.setDefaultClient = exports.defaultClient = exports.Client = exports.Image = exports.ingressAuthHeaders = exports.Volume = exports.App = exports.Sailbox = void 0;
|
|
11
|
+
var sailbox_js_1 = require("./sailbox.js");
|
|
12
|
+
Object.defineProperty(exports, "Sailbox", { enumerable: true, get: function () { return sailbox_js_1.Sailbox; } });
|
|
13
|
+
var app_js_1 = require("./app.js");
|
|
14
|
+
Object.defineProperty(exports, "App", { enumerable: true, get: function () { return app_js_1.App; } });
|
|
15
|
+
var volume_js_1 = require("./volume.js");
|
|
16
|
+
Object.defineProperty(exports, "Volume", { enumerable: true, get: function () { return volume_js_1.Volume; } });
|
|
17
|
+
/** Guest-side: headers that authenticate this sailbox as an ingress
|
|
18
|
+
* allowlist source (only available inside a sailbox guest). */
|
|
19
|
+
var native_js_1 = require("./native.js");
|
|
20
|
+
Object.defineProperty(exports, "ingressAuthHeaders", { enumerable: true, get: function () { return native_js_1.ingressAuthHeaders; } });
|
|
21
|
+
var image_js_1 = require("./image.js");
|
|
22
|
+
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return image_js_1.Image; } });
|
|
23
|
+
var client_js_1 = require("./client.js");
|
|
24
|
+
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_js_1.Client; } });
|
|
25
|
+
var default_client_js_1 = require("./default-client.js");
|
|
26
|
+
Object.defineProperty(exports, "defaultClient", { enumerable: true, get: function () { return default_client_js_1.defaultClient; } });
|
|
27
|
+
Object.defineProperty(exports, "setDefaultClient", { enumerable: true, get: function () { return default_client_js_1.setDefaultClient; } });
|
|
28
|
+
var exec_process_js_1 = require("./exec-process.js");
|
|
29
|
+
Object.defineProperty(exports, "ExecProcess", { enumerable: true, get: function () { return exec_process_js_1.ExecProcess; } });
|
|
30
|
+
var exec_stream_js_1 = require("./exec-stream.js");
|
|
31
|
+
Object.defineProperty(exports, "ExecStream", { enumerable: true, get: function () { return exec_stream_js_1.ExecStream; } });
|
|
32
|
+
var file_stream_js_1 = require("./file-stream.js");
|
|
33
|
+
Object.defineProperty(exports, "FileStream", { enumerable: true, get: function () { return file_stream_js_1.FileStream; } });
|
|
34
|
+
Object.defineProperty(exports, "FileWriter", { enumerable: true, get: function () { return file_stream_js_1.FileWriter; } });
|
|
35
|
+
var config_js_1 = require("./config.js");
|
|
36
|
+
Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return config_js_1.resolveConfig; } });
|
|
37
|
+
// Error taxonomy (the internal `rethrow` helper is deliberately not re-exported).
|
|
38
|
+
var errors_js_1 = require("./errors.js");
|
|
39
|
+
Object.defineProperty(exports, "SailError", { enumerable: true, get: function () { return errors_js_1.SailError; } });
|
|
40
|
+
Object.defineProperty(exports, "InvalidArgumentError", { enumerable: true, get: function () { return errors_js_1.InvalidArgumentError; } });
|
|
41
|
+
Object.defineProperty(exports, "InternalError", { enumerable: true, get: function () { return errors_js_1.InternalError; } });
|
|
42
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return errors_js_1.NotFoundError; } });
|
|
43
|
+
Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return errors_js_1.PermissionDeniedError; } });
|
|
44
|
+
Object.defineProperty(exports, "FileNotFoundError", { enumerable: true, get: function () { return errors_js_1.FileNotFoundError; } });
|
|
45
|
+
Object.defineProperty(exports, "BrokenPipeError", { enumerable: true, get: function () { return errors_js_1.BrokenPipeError; } });
|
|
46
|
+
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return errors_js_1.TimeoutError; } });
|
|
47
|
+
Object.defineProperty(exports, "TransportError", { enumerable: true, get: function () { return errors_js_1.TransportError; } });
|
|
48
|
+
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return errors_js_1.ApiError; } });
|
|
49
|
+
Object.defineProperty(exports, "SailboxCreationError", { enumerable: true, get: function () { return errors_js_1.SailboxCreationError; } });
|
|
50
|
+
Object.defineProperty(exports, "ImageBuildError", { enumerable: true, get: function () { return errors_js_1.ImageBuildError; } });
|
|
51
|
+
Object.defineProperty(exports, "SailboxExecutionError", { enumerable: true, get: function () { return errors_js_1.SailboxExecutionError; } });
|
|
52
|
+
Object.defineProperty(exports, "SailboxTerminatedError", { enumerable: true, get: function () { return errors_js_1.SailboxTerminatedError; } });
|
|
53
|
+
Object.defineProperty(exports, "SailboxExecRequestNotFoundError", { enumerable: true, get: function () { return errors_js_1.SailboxExecRequestNotFoundError; } });
|
|
54
|
+
Object.defineProperty(exports, "SailboxWorkerLostError", { enumerable: true, get: function () { return errors_js_1.SailboxWorkerLostError; } });
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2CAAuC;AAA9B,qGAAA,OAAO,OAAA;AAChB,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AACZ,yCAAqC;AAA5B,mGAAA,MAAM,OAAA;AAEf;+DAC+D;AAC/D,yCAAiD;AAAxC,+GAAA,kBAAkB,OAAA;AAC3B,uCAAmC;AAA1B,iGAAA,KAAK,OAAA;AACd,yCAAqC;AAA5B,mGAAA,MAAM,OAAA;AACf,yDAAsE;AAA7D,kHAAA,aAAa,OAAA;AAAE,qHAAA,gBAAgB,OAAA;AACxC,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,mDAA0D;AAAjD,4GAAA,UAAU,OAAA;AAAE,4GAAA,UAAU,OAAA;AAC/B,yCAA4C;AAAnC,0GAAA,aAAa,OAAA;AAEtB,kFAAkF;AAClF,yCAiBqB;AAhBnB,sGAAA,SAAS,OAAA;AACT,iHAAA,oBAAoB,OAAA;AACpB,0GAAA,aAAa,OAAA;AACb,0GAAA,aAAa,OAAA;AACb,kHAAA,qBAAqB,OAAA;AACrB,8GAAA,iBAAiB,OAAA;AACjB,4GAAA,eAAe,OAAA;AACf,yGAAA,YAAY,OAAA;AACZ,2GAAA,cAAc,OAAA;AACd,qGAAA,QAAQ,OAAA;AACR,iHAAA,oBAAoB,OAAA;AACpB,4GAAA,eAAe,OAAA;AACf,kHAAA,qBAAqB,OAAA;AACrB,mHAAA,sBAAsB,OAAA;AACtB,4HAAA,+BAA+B,OAAA;AAC/B,mHAAA,sBAAsB,OAAA"}
|
package/dist/native.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports the napi-rs generated native binding. The `native/` directory is
|
|
3
|
+
* produced by `pnpm build:native` (@napi-rs/cli) and is the only place the rest
|
|
4
|
+
* of the SDK touches the addon. The generated interfaces are the typed
|
|
5
|
+
* core⇄JS boundary; the modules under `types/` re-export them, narrowing
|
|
6
|
+
* server-controlled strings to open string-literal unions.
|
|
7
|
+
*/
|
|
8
|
+
export { CoreClient, ExecProcessHandle, AsyncStreamReaderHandle, FileReaderHandle, FileWriterHandle, resolvedConfig, validateAutosleepTimeout, validateSizeLimits, validateIngressPorts, validateVolumeMounts, ingressAuthHeaders, volumeFromMount, } from "../native/index.js";
|
|
9
|
+
export type { AddLocalDir, AddLocalDirFile, AddLocalFile, AppInfo, ClientConfig, CreateSailboxRequest, ExecResult, ExecStartOptions, FromCheckpointRequest, ImageBuild, ImageDefinition, ImageDefinitionStep, ImageSpec, LocalDirInput, LocalFileInput, IngressPortInput, Listener, ListSailboxesQuery, VolumeInfo, PackageInstall, ResolvedConfig, RunCommand, SailboxCheckpoint, SailboxHandle, SailboxInfo, SailboxInfoPage, SshEndpoint, UpgradeResult, VolumeMountInput, } from "../native/index.js";
|
|
10
|
+
//# sourceMappingURL=native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,eAAe,EACf,WAAW,EACX,aAAa,EACb,gBAAgB,GACjB,MAAM,oBAAoB,CAAC"}
|
package/dist/native.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.volumeFromMount = exports.ingressAuthHeaders = exports.validateVolumeMounts = exports.validateIngressPorts = exports.validateSizeLimits = exports.validateAutosleepTimeout = exports.resolvedConfig = exports.FileWriterHandle = exports.FileReaderHandle = exports.AsyncStreamReaderHandle = exports.ExecProcessHandle = exports.CoreClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Re-exports the napi-rs generated native binding. The `native/` directory is
|
|
6
|
+
* produced by `pnpm build:native` (@napi-rs/cli) and is the only place the rest
|
|
7
|
+
* of the SDK touches the addon. The generated interfaces are the typed
|
|
8
|
+
* core⇄JS boundary; the modules under `types/` re-export them, narrowing
|
|
9
|
+
* server-controlled strings to open string-literal unions.
|
|
10
|
+
*/
|
|
11
|
+
var index_js_1 = require("../native/index.js");
|
|
12
|
+
Object.defineProperty(exports, "CoreClient", { enumerable: true, get: function () { return index_js_1.CoreClient; } });
|
|
13
|
+
Object.defineProperty(exports, "ExecProcessHandle", { enumerable: true, get: function () { return index_js_1.ExecProcessHandle; } });
|
|
14
|
+
Object.defineProperty(exports, "AsyncStreamReaderHandle", { enumerable: true, get: function () { return index_js_1.AsyncStreamReaderHandle; } });
|
|
15
|
+
Object.defineProperty(exports, "FileReaderHandle", { enumerable: true, get: function () { return index_js_1.FileReaderHandle; } });
|
|
16
|
+
Object.defineProperty(exports, "FileWriterHandle", { enumerable: true, get: function () { return index_js_1.FileWriterHandle; } });
|
|
17
|
+
Object.defineProperty(exports, "resolvedConfig", { enumerable: true, get: function () { return index_js_1.resolvedConfig; } });
|
|
18
|
+
Object.defineProperty(exports, "validateAutosleepTimeout", { enumerable: true, get: function () { return index_js_1.validateAutosleepTimeout; } });
|
|
19
|
+
Object.defineProperty(exports, "validateSizeLimits", { enumerable: true, get: function () { return index_js_1.validateSizeLimits; } });
|
|
20
|
+
Object.defineProperty(exports, "validateIngressPorts", { enumerable: true, get: function () { return index_js_1.validateIngressPorts; } });
|
|
21
|
+
Object.defineProperty(exports, "validateVolumeMounts", { enumerable: true, get: function () { return index_js_1.validateVolumeMounts; } });
|
|
22
|
+
Object.defineProperty(exports, "ingressAuthHeaders", { enumerable: true, get: function () { return index_js_1.ingressAuthHeaders; } });
|
|
23
|
+
Object.defineProperty(exports, "volumeFromMount", { enumerable: true, get: function () { return index_js_1.volumeFromMount; } });
|
|
24
|
+
//# sourceMappingURL=native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,+CAa4B;AAZ1B,sGAAA,UAAU,OAAA;AACV,6GAAA,iBAAiB,OAAA;AACjB,mHAAA,uBAAuB,OAAA;AACvB,4GAAA,gBAAgB,OAAA;AAChB,4GAAA,gBAAgB,OAAA;AAChB,0GAAA,cAAc,OAAA;AACd,oHAAA,wBAAwB,OAAA;AACxB,8GAAA,kBAAkB,OAAA;AAClB,gHAAA,oBAAoB,OAAA;AACpB,gHAAA,oBAAoB,OAAA;AACpB,8GAAA,kBAAkB,OAAA;AAClB,2GAAA,eAAe,OAAA"}
|