@computesdk/orble 0.0.0-stage → 1.0.2

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 computesdk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,79 @@
1
- # Temporary Holding Version
1
+ # @computesdk/orble
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Orble provider for ComputeSDK: Linux VMs ("boxes") with root and Docker inside. Idle boxes suspend with
4
+ their memory and wake on the next command.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ npm install @computesdk/orble
10
+ ```
11
+
12
+ ## Setup
13
+
14
+ 1. Create an API key at [orble.tech/settings](https://orble.tech/settings?tab=api)
15
+ 2. Set the environment variable:
16
+
17
+ ```bash
18
+ export ORBLE_API_KEY=orble_your_api_key
19
+ ```
20
+
21
+ ## Quick Start
22
+
23
+ ```typescript
24
+ import { orble } from '@computesdk/orble';
25
+
26
+ const compute = orble({});
27
+ const box = await compute.instances.create({ sizeClass: 'xl' }); // 8 vCPU / 16 GiB
28
+
29
+ const result = await box.runCommand('uname -a');
30
+ console.log(result.stdout);
31
+
32
+ await compute.instances.destroy(box.instanceId);
33
+ ```
34
+
35
+ ## Sizes
36
+
37
+ | sizeClass | Orble size | vCPU / RAM |
38
+ |---|---|---|
39
+ | `xs` | `micro` | 1 / 2 GiB |
40
+ | `sm` | `micro` | 1 / 2 GiB |
41
+ | `md` | `s` | 2 / 4 GiB |
42
+ | `lg` | `m` | 4 / 8 GiB |
43
+ | `xl` | `l` | 8 / 16 GiB |
44
+
45
+ Every size has a 64 GiB disk. Pass Orble's own `size` (`'micro'`, `'s'`, `'m'` or `'l'`) instead of `sizeClass` if you
46
+ prefer.
47
+
48
+ ## Options
49
+
50
+ - `templateId` or `snapshotId`: an Orble snapshot to start the box from, one of yours or Orble's
51
+ (`orble snapshots` lists them). The box is at least the snapshot's size.
52
+ - `name`: the box's name.
53
+
54
+ Commands and file operations run as `root`, from `/root`, by default. Set `user: 'agent'` (or `ORBLE_USER=agent`) to
55
+ run them as the box's own user, from `/home/agent`, where SSH logins and agents work; a command's own `user` option,
56
+ `'root'` or `'agent'`, overrides it. A command may run for up to 10 minutes; each output stream comes back as its last
57
+ 64 KiB. `readFile` and `writeFile` stream the whole file in one request, up to 4 GiB.
58
+
59
+ ## Snapshots and pause
60
+
61
+ ```typescript
62
+ const snap = await compute.snapshot.create(box.instanceId); // disk, memory and running programs
63
+ const copy = await compute.instances.create({ snapshotId: snap.id });
64
+
65
+ await box.pause(); // suspends with its memory
66
+ await box.resume(); // any command also wakes it
67
+ ```
68
+
69
+ A running box pauses briefly for a snapshot and keeps running. A box started from a snapshot at the snapshot's size
70
+ resumes with its memory and programs; at a larger size it boots from the snapshot's disk. `template.list()` returns
71
+ your snapshots and Orble's; there are no template builds, so `template.create()` throws.
72
+
73
+ ## Configuration
74
+
75
+ | Option | Environment variable | Default |
76
+ |---|---|---|
77
+ | `apiKey` | `ORBLE_API_KEY` | |
78
+ | `baseUrl` | `ORBLE_API_URL` | `https://orble.tech` |
79
+ | `user` | `ORBLE_USER` | `root` (or `agent`) |
@@ -0,0 +1,58 @@
1
+ import * as computesdk from 'computesdk';
2
+ import { InstanceInfo } from '@computesdk/provider';
3
+
4
+ interface OrbleConfig {
5
+ /** Orble API key - if not provided, will fallback to ORBLE_API_KEY environment variable */
6
+ apiKey?: string;
7
+ /** API base URL - if not provided, will fallback to ORBLE_API_URL, then https://orble.tech */
8
+ baseUrl?: string;
9
+ /**
10
+ * Who commands and file operations run as: `root` (the default, as on Daytona and Modal; relative paths start at
11
+ * /root) or `agent`, the box's own user (relative paths start at /home/agent, where SSH logins and agents work).
12
+ * Falls back to ORBLE_USER. A command's own `user` option overrides it.
13
+ */
14
+ user?: OrbleUser;
15
+ }
16
+ type OrbleUser = 'agent' | 'root';
17
+ /** A box as Orble's API returns it. */
18
+ interface OrbleBoxData {
19
+ name: string;
20
+ hostname: string;
21
+ state: string;
22
+ vcpus: number;
23
+ mem_mib: number;
24
+ disk_gib: number;
25
+ created_at?: string;
26
+ [key: string]: unknown;
27
+ }
28
+ interface OrbleSandbox {
29
+ id: string;
30
+ data: OrbleBoxData;
31
+ apiKey: string;
32
+ baseUrl: string;
33
+ user?: OrbleUser;
34
+ }
35
+ /** A snapshot as Orble's API returns it. `gallery` marks one of Orble's own, which every account can start boxes from. */
36
+ interface OrbleSnapshotData {
37
+ name: string;
38
+ alias?: string;
39
+ box?: string;
40
+ state: string;
41
+ vcpus: number;
42
+ mem_mib: number;
43
+ disk_bytes?: number;
44
+ created_at: string;
45
+ gallery?: boolean;
46
+ about?: string;
47
+ }
48
+ declare const ORBLE_SIZES: Readonly<Record<string, {
49
+ size: 'micro' | 's' | 'm' | 'l';
50
+ vcpus: number;
51
+ memoryMiB: number;
52
+ }>>;
53
+ declare function infoStatus(state: string): InstanceInfo['status'];
54
+ declare const orble: (config: OrbleConfig & computesdk.ProcessRuntimeOptions) => computesdk.Provider<OrbleSandbox, any, any, computesdk.Volume> & {
55
+ readonly sizes: computesdk.InstanceSizeManager;
56
+ };
57
+
58
+ export { ORBLE_SIZES, type OrbleBoxData, type OrbleConfig, type OrbleSandbox, type OrbleSnapshotData, type OrbleUser, orble as default, infoStatus, orble };
@@ -0,0 +1,58 @@
1
+ import * as computesdk from 'computesdk';
2
+ import { InstanceInfo } from '@computesdk/provider';
3
+
4
+ interface OrbleConfig {
5
+ /** Orble API key - if not provided, will fallback to ORBLE_API_KEY environment variable */
6
+ apiKey?: string;
7
+ /** API base URL - if not provided, will fallback to ORBLE_API_URL, then https://orble.tech */
8
+ baseUrl?: string;
9
+ /**
10
+ * Who commands and file operations run as: `root` (the default, as on Daytona and Modal; relative paths start at
11
+ * /root) or `agent`, the box's own user (relative paths start at /home/agent, where SSH logins and agents work).
12
+ * Falls back to ORBLE_USER. A command's own `user` option overrides it.
13
+ */
14
+ user?: OrbleUser;
15
+ }
16
+ type OrbleUser = 'agent' | 'root';
17
+ /** A box as Orble's API returns it. */
18
+ interface OrbleBoxData {
19
+ name: string;
20
+ hostname: string;
21
+ state: string;
22
+ vcpus: number;
23
+ mem_mib: number;
24
+ disk_gib: number;
25
+ created_at?: string;
26
+ [key: string]: unknown;
27
+ }
28
+ interface OrbleSandbox {
29
+ id: string;
30
+ data: OrbleBoxData;
31
+ apiKey: string;
32
+ baseUrl: string;
33
+ user?: OrbleUser;
34
+ }
35
+ /** A snapshot as Orble's API returns it. `gallery` marks one of Orble's own, which every account can start boxes from. */
36
+ interface OrbleSnapshotData {
37
+ name: string;
38
+ alias?: string;
39
+ box?: string;
40
+ state: string;
41
+ vcpus: number;
42
+ mem_mib: number;
43
+ disk_bytes?: number;
44
+ created_at: string;
45
+ gallery?: boolean;
46
+ about?: string;
47
+ }
48
+ declare const ORBLE_SIZES: Readonly<Record<string, {
49
+ size: 'micro' | 's' | 'm' | 'l';
50
+ vcpus: number;
51
+ memoryMiB: number;
52
+ }>>;
53
+ declare function infoStatus(state: string): InstanceInfo['status'];
54
+ declare const orble: (config: OrbleConfig & computesdk.ProcessRuntimeOptions) => computesdk.Provider<OrbleSandbox, any, any, computesdk.Volume> & {
55
+ readonly sizes: computesdk.InstanceSizeManager;
56
+ };
57
+
58
+ export { ORBLE_SIZES, type OrbleBoxData, type OrbleConfig, type OrbleSandbox, type OrbleSnapshotData, type OrbleUser, orble as default, infoStatus, orble };
package/dist/index.js ADDED
@@ -0,0 +1,327 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ ORBLE_SIZES: () => ORBLE_SIZES,
34
+ default: () => index_default,
35
+ infoStatus: () => infoStatus,
36
+ orble: () => orble
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+ var import_provider = require("@computesdk/provider");
40
+ var ORBLE_DISK_MIB = 65536;
41
+ var ORBLE_SIZES = Object.freeze({
42
+ xs: { size: "micro", vcpus: 1, memoryMiB: 2048 },
43
+ // memory is a floor, so the 1 vCPU / 2 GiB shape is also an xs
44
+ sm: { size: "micro", vcpus: 1, memoryMiB: 2048 },
45
+ md: { size: "s", vcpus: 2, memoryMiB: 4096 },
46
+ lg: { size: "m", vcpus: 4, memoryMiB: 8192 },
47
+ xl: { size: "l", vcpus: 8, memoryMiB: 16384 }
48
+ });
49
+ var EXEC_MAX_TIMEOUT_S = 600;
50
+ function resolveConfig(config) {
51
+ const env = typeof process !== "undefined" ? process.env : void 0;
52
+ const apiKey = config.apiKey || env?.ORBLE_API_KEY || "";
53
+ if (!apiKey) {
54
+ throw new Error(
55
+ `Missing Orble API key. Provide 'apiKey' in config or set ORBLE_API_KEY environment variable. Create one at https://orble.tech/settings?tab=api`
56
+ );
57
+ }
58
+ const baseUrl = (config.baseUrl || env?.ORBLE_API_URL || "https://orble.tech").replace(/\/+$/, "");
59
+ const user = config.user ?? (env?.ORBLE_USER || void 0);
60
+ if (user !== void 0 && user !== "agent" && user !== "root") {
61
+ throw new Error(`Orble user must be 'agent' or 'root', not '${user}'`);
62
+ }
63
+ return { apiKey, baseUrl, ...user ? { user } : {} };
64
+ }
65
+ function userFor(sandbox, options) {
66
+ const asked = options?.user;
67
+ return asked === "root" || asked === "agent" ? asked : sandbox.user ?? "root";
68
+ }
69
+ async function request(auth, method, path, body, raw) {
70
+ const headers = { Authorization: `Bearer ${auth.apiKey}`, "User-Agent": "computesdk-orble" };
71
+ let payload;
72
+ if (raw) {
73
+ payload = raw;
74
+ headers["Content-Type"] = "application/octet-stream";
75
+ } else if (body !== void 0) {
76
+ payload = JSON.stringify(body);
77
+ headers["Content-Type"] = "application/json";
78
+ }
79
+ const res = await fetch(`${auth.baseUrl}${path}`, { method, headers, body: payload });
80
+ if (res.status === 404) return null;
81
+ const text = await res.text();
82
+ if (!res.ok) {
83
+ let message = text.trim() || res.statusText;
84
+ try {
85
+ message = JSON.parse(text).error || message;
86
+ } catch {
87
+ }
88
+ throw new Error(`Orble API error (${res.status}) on ${method} ${path}: ${message}`);
89
+ }
90
+ return text ? JSON.parse(text) : null;
91
+ }
92
+ async function rawTransfer(sandbox, method, path, body) {
93
+ const user = (sandbox.user ?? "root") === "root" ? "&user=root" : "";
94
+ const url = `${sandbox.baseUrl}${boxPath(sandbox.id, `/files?path=${encodeURIComponent(path)}${method === "GET" ? "&raw=1" : ""}${user}`)}`;
95
+ const headers = { Authorization: `Bearer ${sandbox.apiKey}`, "User-Agent": "computesdk-orble" };
96
+ if (body) {
97
+ headers["Content-Type"] = "application/octet-stream";
98
+ headers["Content-Length"] = String(body.length);
99
+ }
100
+ const fail = (status, text) => {
101
+ let message = text.trim() || String(status);
102
+ try {
103
+ message = JSON.parse(text).error || message;
104
+ } catch {
105
+ }
106
+ throw new Error(`Orble API error (${status}) on ${method} ${path}: ${message}`);
107
+ };
108
+ const https = typeof process !== "undefined" && process.versions?.node ? await import("https").catch(() => null) : null;
109
+ if (https && url.startsWith("https:")) {
110
+ const { status, data } = await new Promise((resolve, reject) => {
111
+ const req = https.request(url, { method, headers }, (res2) => {
112
+ const parts = [];
113
+ res2.on("data", (c) => parts.push(c));
114
+ res2.on("end", () => resolve({ status: res2.statusCode ?? 0, data: Buffer.concat(parts) }));
115
+ res2.on("error", reject);
116
+ });
117
+ req.on("error", reject);
118
+ req.end(body);
119
+ });
120
+ if (status === 404) return null;
121
+ if (status < 200 || status >= 300) fail(status, data.toString("utf8"));
122
+ return data;
123
+ }
124
+ const res = await fetch(url, { method, headers, body });
125
+ if (res.status === 404) return null;
126
+ if (!res.ok) fail(res.status, await res.text());
127
+ return Buffer.from(await res.arrayBuffer());
128
+ }
129
+ function toSandbox(auth, data) {
130
+ return { id: data.name, data, ...auth };
131
+ }
132
+ var boxPath = (name, sub = "") => `/v1/boxes/${encodeURIComponent(name)}${sub}`;
133
+ function createBody(options = {}) {
134
+ const body = {};
135
+ if (typeof options.size === "string") body.size = options.size;
136
+ const from = options.snapshotId ?? options.templateId;
137
+ if (from) body.from = from;
138
+ if (options.name) body.name = options.name;
139
+ return body;
140
+ }
141
+ function wrapCommand(command, options) {
142
+ return options?.background ? `nohup sh -c "${(0, import_provider.escapeShellArg)(command)}" >/dev/null 2>&1 &` : command;
143
+ }
144
+ function shellPath(path) {
145
+ return `"${(0, import_provider.escapeShellArg)(path.startsWith("-") ? `./${path}` : path)}"`;
146
+ }
147
+ async function exec(sandbox, command, options) {
148
+ const body = { command };
149
+ if (options?.timeout) body.timeout_s = Math.min(EXEC_MAX_TIMEOUT_S, Math.ceil(options.timeout / 1e3));
150
+ if (options?.env && Object.keys(options.env).length > 0) body.env = options.env;
151
+ if (options?.cwd) body.cwd = options.cwd;
152
+ if (userFor(sandbox, options) === "root") body.user = "root";
153
+ let data = await request(sandbox, "POST", boxPath(sandbox.id, "/exec"), body);
154
+ while (data?.running) data = await request(sandbox, "POST", boxPath(sandbox.id, "/exec"), { job: data.job });
155
+ if (!data) throw new Error(`Orble box ${sandbox.id} not found`);
156
+ return data;
157
+ }
158
+ function infoStatus(state) {
159
+ if (state === "running") return "running";
160
+ if (state === "error") return "error";
161
+ return "stopped";
162
+ }
163
+ function toSnapshot(data) {
164
+ return {
165
+ id: data.name,
166
+ provider: "orble",
167
+ createdAt: new Date(data.created_at),
168
+ metadata: {
169
+ state: data.state,
170
+ box: data.box,
171
+ vcpus: data.vcpus,
172
+ memMiB: data.mem_mib,
173
+ diskBytes: data.disk_bytes,
174
+ ...data.alias && { alias: data.alias },
175
+ ...data.gallery && { gallery: true, about: data.about }
176
+ }
177
+ };
178
+ }
179
+ async function listSnapshots(config) {
180
+ return await request(resolveConfig(config), "GET", "/v1/snapshots") ?? [];
181
+ }
182
+ async function deleteSnapshot(config, name) {
183
+ await request(resolveConfig(config), "DELETE", `/v1/snapshots/${encodeURIComponent(name)}`);
184
+ }
185
+ async function mustSucceed(run, sandbox, command, what) {
186
+ const result = await run(sandbox, command);
187
+ if (result.exitCode !== 0) throw new Error(`Failed to ${what}: ${result.stderr.trim() || `exit code ${result.exitCode}`}`);
188
+ return result;
189
+ }
190
+ var orble = (0, import_provider.defineProvider)({
191
+ name: "orble",
192
+ sizes: (_config, profile, options) => {
193
+ if (options?.size !== void 0) throw new import_provider.InstanceSizeError("conflict", "cannot combine sizeClass with the native Orble size field");
194
+ const shape = ORBLE_SIZES[profile.sizeClass];
195
+ if (!shape) {
196
+ return { status: "unsupported", reason: `Orble has no ${profile.sizeClass} shape; it offers 1/2, 2/4, 4/8 and 8/16 (vCPU / GiB).` };
197
+ }
198
+ return { status: "supported", nativeOptions: { size: shape.size }, resolved: { vcpus: shape.vcpus, memoryMiB: shape.memoryMiB, diskMiB: ORBLE_DISK_MIB } };
199
+ },
200
+ methods: {
201
+ instances: {
202
+ create: async (config, options) => {
203
+ const auth = resolveConfig(config);
204
+ const data = await request(auth, "POST", "/v1/boxes", createBody(options));
205
+ if (!data) throw new Error("Orble API returned no box on create");
206
+ return { instance: toSandbox(auth, data), instanceId: data.name };
207
+ },
208
+ getById: async (config, instanceId) => {
209
+ const auth = resolveConfig(config);
210
+ const data = await request(auth, "GET", boxPath(instanceId));
211
+ return data ? { instance: toSandbox(auth, data), instanceId: data.name } : null;
212
+ },
213
+ list: async (config) => {
214
+ const auth = resolveConfig(config);
215
+ const data = await request(auth, "GET", "/v1/boxes");
216
+ return (data ?? []).map((row) => ({ instance: toSandbox(auth, row), instanceId: row.name }));
217
+ },
218
+ destroy: async (config, instanceId) => {
219
+ const auth = resolveConfig(config);
220
+ await request(auth, "DELETE", boxPath(instanceId));
221
+ },
222
+ runCommand: async (sandbox, command, options) => {
223
+ const start = Date.now();
224
+ const data = await exec(sandbox, wrapCommand(command, options), options);
225
+ return { stdout: data.stdout ?? "", stderr: data.stderr ?? "", exitCode: data.exit_code, durationMs: Date.now() - start };
226
+ },
227
+ getInfo: async (sandbox) => {
228
+ const data = await request(sandbox, "GET", boxPath(sandbox.id));
229
+ const current = data ?? { ...sandbox.data, state: "deleted" };
230
+ return {
231
+ id: sandbox.id,
232
+ provider: "orble",
233
+ status: infoStatus(current.state),
234
+ createdAt: current.created_at ? new Date(current.created_at) : /* @__PURE__ */ new Date(),
235
+ timeout: 0,
236
+ metadata: { state: current.state, hostname: current.hostname, vcpus: current.vcpus, memMiB: current.mem_mib, diskGiB: current.disk_gib }
237
+ };
238
+ },
239
+ // Shares the port at its own https address: private (Orble sign-in) by default, public with `public: true`.
240
+ getUrl: async (sandbox, options) => {
241
+ const data = await request(sandbox, "PUT", boxPath(sandbox.id, `/ports/${options.port}`), {
242
+ access: options.public ? "public" : "private"
243
+ });
244
+ if (!data?.url) throw new Error(`Orble box ${sandbox.id} not found`);
245
+ return options.protocol === "ws" || options.protocol === "wss" ? data.url.replace(/^https/, "wss") : data.url;
246
+ },
247
+ // Suspend keeps the box's memory and running programs; resume (or any command) wakes it where it was.
248
+ pause: async (sandbox) => {
249
+ if (!await request(sandbox, "POST", boxPath(sandbox.id, "/suspend"))) throw new Error(`Orble box ${sandbox.id} not found`);
250
+ },
251
+ resume: async (sandbox) => {
252
+ const data = await request(sandbox, "POST", boxPath(sandbox.id, "/resume"));
253
+ if (!data) throw new Error(`Orble box ${sandbox.id} not found`);
254
+ return toSandbox(sandbox, data);
255
+ },
256
+ pauseCapabilities: { memory: true },
257
+ getInstance: (sandbox) => sandbox,
258
+ filesystem: {
259
+ // The whole file in one streamed response (raw=1), at any size up to the API's limit.
260
+ readFile: async (sandbox, path) => {
261
+ const data = await rawTransfer(sandbox, "GET", path);
262
+ if (!data) throw new Error(`Failed to read ${path}: not found`);
263
+ return data.toString("utf8");
264
+ },
265
+ // The raw body is streamed to the file, so large files go in one request.
266
+ writeFile: async (sandbox, path, content) => {
267
+ if (!await rawTransfer(sandbox, "PUT", path, Buffer.from(content, "utf8"))) throw new Error(`Failed to write ${path}: box not found`);
268
+ },
269
+ mkdir: async (sandbox, path, run) => {
270
+ await mustSucceed(run, sandbox, `mkdir -p ${shellPath(path)}`, `create ${path}`);
271
+ },
272
+ readdir: async (sandbox, path, run) => {
273
+ const result = await mustSucceed(run, sandbox, `find ${shellPath(path)} -mindepth 1 -maxdepth 1 -printf '%y\\t%s\\t%T@\\t%f\\n'`, `list ${path}`);
274
+ return result.stdout.split("\n").filter(Boolean).map((line) => {
275
+ const [kind, size, modified, ...name] = line.split(" ");
276
+ return { name: name.join(" "), type: kind === "d" ? "directory" : "file", size: Number(size), modified: new Date(Number(modified) * 1e3) };
277
+ });
278
+ },
279
+ exists: async (sandbox, path, run) => {
280
+ const result = await run(sandbox, `test -e ${shellPath(path)}`);
281
+ return result.exitCode === 0;
282
+ },
283
+ remove: async (sandbox, path, run) => {
284
+ await mustSucceed(run, sandbox, `rm -rf ${shellPath(path)}`, `remove ${path}`);
285
+ }
286
+ }
287
+ },
288
+ snapshot: {
289
+ // A snapshot keeps the box's disk, memory and running programs. A running box pauses briefly while it is taken,
290
+ // then keeps running. A box started from it at the snapshot's size resumes where the snapshot was taken; at a
291
+ // larger size it boots from the snapshot's disk. The API answers once the snapshot is ready.
292
+ capabilities: { scope: "rootfs", memory: true, destroysSource: false, source: "kept", fork: true },
293
+ create: async (config, instanceId, options) => {
294
+ const auth = resolveConfig(config);
295
+ const data = await request(auth, "POST", boxPath(instanceId, "/snapshot"), options?.name ? { name: options.name } : {});
296
+ if (!data) throw new Error(`Orble box ${instanceId} not found`);
297
+ return toSnapshot(data);
298
+ },
299
+ // The account's own snapshots; Orble's gallery snapshots are listed as templates.
300
+ list: async (config, options) => {
301
+ const box = options?.instanceId ?? options?.sandboxId;
302
+ const rows = (await listSnapshots(config)).filter((s) => !s.gallery && (!box || s.box === box));
303
+ return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);
304
+ },
305
+ delete: deleteSnapshot
306
+ },
307
+ // Orble starts boxes from snapshots, its own (the gallery) or the account's, so templates are snapshots.
308
+ template: {
309
+ create: async () => {
310
+ throw new Error("Orble has no template builds; make a template with snapshot.create() from a box you have set up.");
311
+ },
312
+ list: async (config, options) => {
313
+ const rows = await listSnapshots(config);
314
+ return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);
315
+ },
316
+ delete: deleteSnapshot
317
+ }
318
+ }
319
+ });
320
+ var index_default = orble;
321
+ // Annotate the CommonJS export names for ESM import in node:
322
+ 0 && (module.exports = {
323
+ ORBLE_SIZES,
324
+ infoStatus,
325
+ orble
326
+ });
327
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Orble Provider - Factory-based Implementation\n *\n * Linux VMs (\"boxes\") on Orble (https://orble.tech), with root through passwordless sudo and Docker inside. Orble's\n * REST API is a small JSON surface, so this package talks to it with `fetch` and has no SDK dependency.\n *\n * Commands run as the box's user, `agent`, from /home/agent. Files are read and written through the API's files\n * endpoint; mkdir, readdir, exists and remove run as shell commands.\n */\n\nimport { defineProvider, escapeShellArg, InstanceSizeError } from '@computesdk/provider';\n\nimport type {\n CommandResult,\n CreateInstanceOptions,\n CreateSnapshotOptions,\n FileEntry,\n InstanceInfo,\n ListSnapshotsOptions,\n ListTemplatesOptions,\n RunCommandOptions,\n} from '@computesdk/provider';\nimport type { Snapshot } from 'computesdk';\n\nexport interface OrbleConfig {\n /** Orble API key - if not provided, will fallback to ORBLE_API_KEY environment variable */\n apiKey?: string;\n /** API base URL - if not provided, will fallback to ORBLE_API_URL, then https://orble.tech */\n baseUrl?: string;\n /**\n * Who commands and file operations run as: `root` (the default, as on Daytona and Modal; relative paths start at\n * /root) or `agent`, the box's own user (relative paths start at /home/agent, where SSH logins and agents work).\n * Falls back to ORBLE_USER. A command's own `user` option overrides it.\n */\n user?: OrbleUser;\n}\n\nexport type OrbleUser = 'agent' | 'root';\n\n/** A box as Orble's API returns it. */\nexport interface OrbleBoxData {\n name: string;\n hostname: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_gib: number;\n created_at?: string;\n [key: string]: unknown;\n}\n\nexport interface OrbleSandbox {\n id: string;\n data: OrbleBoxData;\n apiKey: string;\n baseUrl: string;\n user?: OrbleUser;\n}\n\n/** A snapshot as Orble's API returns it. `gallery` marks one of Orble's own, which every account can start boxes from. */\nexport interface OrbleSnapshotData {\n name: string;\n alias?: string;\n box?: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_bytes?: number;\n created_at: string;\n gallery?: boolean;\n about?: string;\n}\n\ninterface ExecResponse {\n running?: boolean;\n job?: string;\n exit_code: number;\n stdout?: string;\n stderr?: string;\n}\n\ntype FsRunCommand = (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions) => Promise<CommandResult>;\n\n// Orble's box sizes (vCPU / MiB): micro 1/2048, s 2/4096, m 4/8192, l 8/16384, each with a 64 GiB disk.\n// https://orble.tech/pricing\nconst ORBLE_DISK_MIB = 65536;\n\nexport const ORBLE_SIZES: Readonly<Record<string, { size: 'micro' | 's' | 'm' | 'l'; vcpus: number; memoryMiB: number }>> = Object.freeze({\n xs: { size: 'micro', vcpus: 1, memoryMiB: 2048 }, // memory is a floor, so the 1 vCPU / 2 GiB shape is also an xs\n sm: { size: 'micro', vcpus: 1, memoryMiB: 2048 },\n md: { size: 's', vcpus: 2, memoryMiB: 4096 },\n lg: { size: 'm', vcpus: 4, memoryMiB: 8192 },\n xl: { size: 'l', vcpus: 8, memoryMiB: 16384 },\n});\n\n// Orble stops a command after at most 600 s. Exec answers within about 50 s; a command still running then comes back\n// as a job, which exec() polls until it ends.\nconst EXEC_MAX_TIMEOUT_S = 600;\n\nfunction resolveConfig(config: OrbleConfig) {\n const env = typeof process !== 'undefined' ? process.env : undefined;\n const apiKey = config.apiKey || env?.ORBLE_API_KEY || '';\n if (!apiKey) {\n throw new Error(\n `Missing Orble API key. Provide 'apiKey' in config or set ORBLE_API_KEY environment variable. ` +\n `Create one at https://orble.tech/settings?tab=api`,\n );\n }\n const baseUrl = (config.baseUrl || env?.ORBLE_API_URL || 'https://orble.tech').replace(/\\/+$/, '');\n const user = config.user ?? ((env?.ORBLE_USER || undefined) as OrbleUser | undefined); // empty is unset\n if (user !== undefined && user !== 'agent' && user !== 'root') {\n throw new Error(`Orble user must be 'agent' or 'root', not '${user}'`);\n }\n return { apiKey, baseUrl, ...(user ? { user } : {}) };\n}\n\n/** The user one call runs as: the command's own `user` option, else the provider's. */\nfunction userFor(sandbox: OrbleSandbox, options?: RunCommandOptions): OrbleUser {\n const asked = (options as { user?: string } | undefined)?.user;\n return asked === 'root' || asked === 'agent' ? asked : sandbox.user ?? 'root';\n}\n\n// Calls the API. A 404 (a box that doesn't exist, or isn't the caller's) comes back as null; other errors throw.\nasync function request<T>(\n auth: { apiKey: string; baseUrl: string },\n method: string,\n path: string,\n body?: unknown,\n raw?: Uint8Array,\n): Promise<T | null> {\n const headers: Record<string, string> = { Authorization: `Bearer ${auth.apiKey}`, 'User-Agent': 'computesdk-orble' };\n let payload: BodyInit | undefined;\n if (raw) {\n payload = raw as BodyInit;\n headers['Content-Type'] = 'application/octet-stream';\n } else if (body !== undefined) {\n payload = JSON.stringify(body);\n headers['Content-Type'] = 'application/json';\n }\n const res = await fetch(`${auth.baseUrl}${path}`, { method, headers, body: payload });\n if (res.status === 404) return null;\n const text = await res.text();\n if (!res.ok) {\n let message = text.trim() || res.statusText;\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${res.status}) on ${method} ${path}: ${message}`);\n }\n return (text ? JSON.parse(text) : null) as T | null;\n}\n\n/**\n * One raw file transfer: GET .../files?raw=1 for a whole file, or PUT with the raw body. Node's built-in fetch moves\n * these at about 6 MB/s from a workstation where node:https and curl move 40-48 MB/s (2026-11-23, 64 MiB), so in\n * Node this uses node:https; elsewhere it falls back to fetch. Returns the body, or null on 404.\n */\nasync function rawTransfer(sandbox: OrbleSandbox, method: 'GET' | 'PUT', path: string, body?: Buffer): Promise<Buffer | null> {\n const user = (sandbox.user ?? 'root') === 'root' ? '&user=root' : '';\n const url = `${sandbox.baseUrl}${boxPath(sandbox.id, `/files?path=${encodeURIComponent(path)}${method === 'GET' ? '&raw=1' : ''}${user}`)}`;\n const headers: Record<string, string> = { Authorization: `Bearer ${sandbox.apiKey}`, 'User-Agent': 'computesdk-orble' };\n if (body) {\n headers['Content-Type'] = 'application/octet-stream';\n headers['Content-Length'] = String(body.length);\n }\n const fail = (status: number, text: string): never => {\n let message = text.trim() || String(status);\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${status}) on ${method} ${path}: ${message}`);\n };\n const https = typeof process !== 'undefined' && process.versions?.node ? await import('node:https').catch(() => null) : null;\n if (https && url.startsWith('https:')) {\n const { status, data } = await new Promise<{ status: number; data: Buffer }>((resolve, reject) => {\n const req = https.request(url, { method, headers }, (res) => {\n const parts: Buffer[] = [];\n res.on('data', (c: Buffer) => parts.push(c));\n res.on('end', () => resolve({ status: res.statusCode ?? 0, data: Buffer.concat(parts) }));\n res.on('error', reject);\n });\n req.on('error', reject);\n req.end(body);\n });\n if (status === 404) return null;\n if (status < 200 || status >= 300) fail(status, data.toString('utf8'));\n return data;\n }\n const res = await fetch(url, { method, headers, body: body as BodyInit | undefined });\n if (res.status === 404) return null;\n if (!res.ok) fail(res.status, await res.text());\n return Buffer.from(await res.arrayBuffer());\n}\n\nfunction toSandbox(auth: { apiKey: string; baseUrl: string; user?: OrbleUser }, data: OrbleBoxData): OrbleSandbox {\n return { id: data.name, data, ...auth };\n}\n\nconst boxPath = (name: string, sub = '') => `/v1/boxes/${encodeURIComponent(name)}${sub}`;\n\n/** Maps ComputeSDK's create options onto the body of POST /v1/boxes. */\nfunction createBody(options: CreateInstanceOptions = {}): Record<string, unknown> {\n const body: Record<string, unknown> = {};\n if (typeof options.size === 'string') body.size = options.size;\n const from = options.snapshotId ?? options.templateId;\n if (from) body.from = from;\n if (options.name) body.name = options.name;\n return body;\n}\n\nfunction wrapCommand(command: string, options?: RunCommandOptions): string {\n return options?.background ? `nohup sh -c \"${escapeShellArg(command)}\" >/dev/null 2>&1 &` : command;\n}\n\n// A leading dash would be read as an option by find, mkdir and rm.\nfunction shellPath(path: string): string {\n return `\"${escapeShellArg(path.startsWith('-') ? `./${path}` : path)}\"`;\n}\n\nasync function exec(sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<ExecResponse> {\n const body: Record<string, unknown> = { command };\n if (options?.timeout) body.timeout_s = Math.min(EXEC_MAX_TIMEOUT_S, Math.ceil(options.timeout / 1000));\n if (options?.env && Object.keys(options.env).length > 0) body.env = options.env;\n if (options?.cwd) body.cwd = options.cwd;\n if (userFor(sandbox, options) === 'root') body.user = 'root';\n let data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), body);\n while (data?.running) data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), { job: data.job });\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return data;\n}\n\n// Orble's states are creating, running, suspended, stopped, error, deleting and deleted. A suspended box wakes on the\n// next command, but it is not running until then.\nexport function infoStatus(state: string): InstanceInfo['status'] {\n if (state === 'running') return 'running';\n if (state === 'error') return 'error';\n return 'stopped';\n}\n\nfunction toSnapshot(data: OrbleSnapshotData): Snapshot {\n return {\n id: data.name,\n provider: 'orble',\n createdAt: new Date(data.created_at),\n metadata: {\n state: data.state,\n box: data.box,\n vcpus: data.vcpus,\n memMiB: data.mem_mib,\n diskBytes: data.disk_bytes,\n ...(data.alias && { alias: data.alias }),\n ...(data.gallery && { gallery: true, about: data.about }),\n },\n };\n}\n\nasync function listSnapshots(config: OrbleConfig): Promise<OrbleSnapshotData[]> {\n return (await request<OrbleSnapshotData[]>(resolveConfig(config), 'GET', '/v1/snapshots')) ?? [];\n}\n\n// Deleting a snapshot that doesn't exist (a 404) leaves nothing to do.\nasync function deleteSnapshot(config: OrbleConfig, name: string): Promise<void> {\n await request(resolveConfig(config), 'DELETE', `/v1/snapshots/${encodeURIComponent(name)}`);\n}\n\nasync function mustSucceed(run: FsRunCommand, sandbox: OrbleSandbox, command: string, what: string): Promise<CommandResult> {\n const result = await run(sandbox, command);\n if (result.exitCode !== 0) throw new Error(`Failed to ${what}: ${result.stderr.trim() || `exit code ${result.exitCode}`}`);\n return result;\n}\n\nexport const orble = defineProvider<OrbleSandbox, OrbleConfig>({\n name: 'orble',\n sizes: (_config, profile, options) => {\n if (options?.size !== undefined) throw new InstanceSizeError('conflict', 'cannot combine sizeClass with the native Orble size field');\n const shape = ORBLE_SIZES[profile.sizeClass];\n if (!shape) {\n return { status: 'unsupported', reason: `Orble has no ${profile.sizeClass} shape; it offers 1/2, 2/4, 4/8 and 8/16 (vCPU / GiB).` };\n }\n return { status: 'supported', nativeOptions: { size: shape.size }, resolved: { vcpus: shape.vcpus, memoryMiB: shape.memoryMiB, diskMiB: ORBLE_DISK_MIB } };\n },\n methods: {\n instances: {\n create: async (config: OrbleConfig, options?: CreateInstanceOptions) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'POST', '/v1/boxes', createBody(options));\n if (!data) throw new Error('Orble API returned no box on create');\n return { instance: toSandbox(auth, data), instanceId: data.name };\n },\n\n getById: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'GET', boxPath(instanceId));\n return data ? { instance: toSandbox(auth, data), instanceId: data.name } : null;\n },\n\n list: async (config: OrbleConfig) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData[]>(auth, 'GET', '/v1/boxes');\n return (data ?? []).map((row) => ({ instance: toSandbox(auth, row), instanceId: row.name }));\n },\n\n destroy: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n await request(auth, 'DELETE', boxPath(instanceId));\n },\n\n runCommand: async (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<CommandResult> => {\n const start = Date.now();\n const data = await exec(sandbox, wrapCommand(command, options), options);\n return { stdout: data.stdout ?? '', stderr: data.stderr ?? '', exitCode: data.exit_code, durationMs: Date.now() - start };\n },\n\n getInfo: async (sandbox: OrbleSandbox): Promise<InstanceInfo> => {\n const data = await request<OrbleBoxData>(sandbox, 'GET', boxPath(sandbox.id));\n const current = data ?? { ...sandbox.data, state: 'deleted' };\n return {\n id: sandbox.id,\n provider: 'orble',\n status: infoStatus(current.state),\n createdAt: current.created_at ? new Date(current.created_at) : new Date(),\n timeout: 0,\n metadata: { state: current.state, hostname: current.hostname, vcpus: current.vcpus, memMiB: current.mem_mib, diskGiB: current.disk_gib },\n };\n },\n\n // Shares the port at its own https address: private (Orble sign-in) by default, public with `public: true`.\n getUrl: async (sandbox: OrbleSandbox, options: { port: number; protocol?: string; public?: boolean }): Promise<string> => {\n const data = await request<{ url: string }>(sandbox, 'PUT', boxPath(sandbox.id, `/ports/${options.port}`), {\n access: options.public ? 'public' : 'private',\n });\n if (!data?.url) throw new Error(`Orble box ${sandbox.id} not found`);\n return options.protocol === 'ws' || options.protocol === 'wss' ? data.url.replace(/^https/, 'wss') : data.url;\n },\n\n // Suspend keeps the box's memory and running programs; resume (or any command) wakes it where it was.\n pause: async (sandbox: OrbleSandbox): Promise<void> => {\n if (!(await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/suspend')))) throw new Error(`Orble box ${sandbox.id} not found`);\n },\n resume: async (sandbox: OrbleSandbox): Promise<OrbleSandbox> => {\n const data = await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/resume'));\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return toSandbox(sandbox, data);\n },\n pauseCapabilities: { memory: true },\n\n getInstance: (sandbox: OrbleSandbox): OrbleSandbox => sandbox,\n\n filesystem: {\n // The whole file in one streamed response (raw=1), at any size up to the API's limit.\n readFile: async (sandbox: OrbleSandbox, path: string): Promise<string> => {\n const data = await rawTransfer(sandbox, 'GET', path);\n if (!data) throw new Error(`Failed to read ${path}: not found`);\n return data.toString('utf8');\n },\n // The raw body is streamed to the file, so large files go in one request.\n writeFile: async (sandbox: OrbleSandbox, path: string, content: string): Promise<void> => {\n if (!(await rawTransfer(sandbox, 'PUT', path, Buffer.from(content, 'utf8')))) throw new Error(`Failed to write ${path}: box not found`);\n },\n mkdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `mkdir -p ${shellPath(path)}`, `create ${path}`);\n },\n readdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<FileEntry[]> => {\n const result = await mustSucceed(run, sandbox, `find ${shellPath(path)} -mindepth 1 -maxdepth 1 -printf '%y\\\\t%s\\\\t%T@\\\\t%f\\\\n'`, `list ${path}`);\n return result.stdout\n .split('\\n')\n .filter(Boolean)\n .map((line) => {\n const [kind, size, modified, ...name] = line.split('\\t');\n return { name: name.join('\\t'), type: kind === 'd' ? ('directory' as const) : ('file' as const), size: Number(size), modified: new Date(Number(modified) * 1000) };\n });\n },\n exists: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<boolean> => {\n const result = await run(sandbox, `test -e ${shellPath(path)}`);\n return result.exitCode === 0;\n },\n remove: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `rm -rf ${shellPath(path)}`, `remove ${path}`);\n },\n },\n },\n\n snapshot: {\n // A snapshot keeps the box's disk, memory and running programs. A running box pauses briefly while it is taken,\n // then keeps running. A box started from it at the snapshot's size resumes where the snapshot was taken; at a\n // larger size it boots from the snapshot's disk. The API answers once the snapshot is ready.\n capabilities: { scope: 'rootfs', memory: true, destroysSource: false, source: 'kept', fork: true },\n create: async (config: OrbleConfig, instanceId: string, options?: CreateSnapshotOptions): Promise<Snapshot> => {\n const auth = resolveConfig(config);\n const data = await request<OrbleSnapshotData>(auth, 'POST', boxPath(instanceId, '/snapshot'), options?.name ? { name: options.name } : {});\n if (!data) throw new Error(`Orble box ${instanceId} not found`);\n return toSnapshot(data);\n },\n // The account's own snapshots; Orble's gallery snapshots are listed as templates.\n list: async (config: OrbleConfig, options?: ListSnapshotsOptions): Promise<Snapshot[]> => {\n const box = options?.instanceId ?? options?.sandboxId;\n const rows = (await listSnapshots(config)).filter((s) => !s.gallery && (!box || s.box === box));\n return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);\n },\n delete: deleteSnapshot,\n },\n\n // Orble starts boxes from snapshots, its own (the gallery) or the account's, so templates are snapshots.\n template: {\n create: async (): Promise<Snapshot> => {\n throw new Error('Orble has no template builds; make a template with snapshot.create() from a box you have set up.');\n },\n list: async (config: OrbleConfig, options?: ListTemplatesOptions): Promise<Snapshot[]> => {\n const rows = await listSnapshots(config);\n return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);\n },\n delete: deleteSnapshot,\n },\n },\n});\n\nexport default orble;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,sBAAkE;AA2ElE,IAAM,iBAAiB;AAEhB,IAAM,cAA+G,OAAO,OAAO;AAAA,EACxI,IAAI,EAAE,MAAM,SAAS,OAAO,GAAG,WAAW,KAAK;AAAA;AAAA,EAC/C,IAAI,EAAE,MAAM,SAAS,OAAO,GAAG,WAAW,KAAK;AAAA,EAC/C,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW,KAAK;AAAA,EAC3C,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW,KAAK;AAAA,EAC3C,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW,MAAM;AAC9C,CAAC;AAID,IAAM,qBAAqB;AAE3B,SAAS,cAAc,QAAqB;AAC1C,QAAM,MAAM,OAAO,YAAY,c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I,CAAC,KAAM,OAAM,IAAI,MAAM,aAAa,UAAU,YAAY;AAC9D,eAAO,WAAW,IAAI;AAAA,MACxB;AAAA;AAAA,MAEA,MAAM,OAAO,QAAqB,YAAwD;AACxF,cAAM,MAAM,SAAS,cAAc,SAAS;AAC5C,cAAM,QAAQ,MAAM,cAAc,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,OAAO,EAAE,QAAQ,IAAI;AAC9F,eAAO,KAAK,MAAM,GAAG,SAAS,SAAS,KAAK,MAAM,EAAE,IAAI,UAAU;AAAA,MACpE;AAAA,MACA,QAAQ;AAAA,IACV;AAAA;AAAA,IAGA,UAAU;AAAA,MACR,QAAQ,YAA+B;AACrC,cAAM,IAAI,MAAM,kGAAkG;AAAA,MACpH;AAAA,MACA,MAAM,OAAO,QAAqB,YAAwD;AACxF,cAAM,OAAO,MAAM,cAAc,MAAM;AACvC,eAAO,KAAK,MAAM,GAAG,SAAS,SAAS,KAAK,MAAM,EAAE,IAAI,UAAU;AAAA,MACpE;AAAA,MACA,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;AAED,IAAO,gBAAQ;","names":["res"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,290 @@
1
+ // src/index.ts
2
+ import { defineProvider, escapeShellArg, InstanceSizeError } from "@computesdk/provider";
3
+ var ORBLE_DISK_MIB = 65536;
4
+ var ORBLE_SIZES = Object.freeze({
5
+ xs: { size: "micro", vcpus: 1, memoryMiB: 2048 },
6
+ // memory is a floor, so the 1 vCPU / 2 GiB shape is also an xs
7
+ sm: { size: "micro", vcpus: 1, memoryMiB: 2048 },
8
+ md: { size: "s", vcpus: 2, memoryMiB: 4096 },
9
+ lg: { size: "m", vcpus: 4, memoryMiB: 8192 },
10
+ xl: { size: "l", vcpus: 8, memoryMiB: 16384 }
11
+ });
12
+ var EXEC_MAX_TIMEOUT_S = 600;
13
+ function resolveConfig(config) {
14
+ const env = typeof process !== "undefined" ? process.env : void 0;
15
+ const apiKey = config.apiKey || env?.ORBLE_API_KEY || "";
16
+ if (!apiKey) {
17
+ throw new Error(
18
+ `Missing Orble API key. Provide 'apiKey' in config or set ORBLE_API_KEY environment variable. Create one at https://orble.tech/settings?tab=api`
19
+ );
20
+ }
21
+ const baseUrl = (config.baseUrl || env?.ORBLE_API_URL || "https://orble.tech").replace(/\/+$/, "");
22
+ const user = config.user ?? (env?.ORBLE_USER || void 0);
23
+ if (user !== void 0 && user !== "agent" && user !== "root") {
24
+ throw new Error(`Orble user must be 'agent' or 'root', not '${user}'`);
25
+ }
26
+ return { apiKey, baseUrl, ...user ? { user } : {} };
27
+ }
28
+ function userFor(sandbox, options) {
29
+ const asked = options?.user;
30
+ return asked === "root" || asked === "agent" ? asked : sandbox.user ?? "root";
31
+ }
32
+ async function request(auth, method, path, body, raw) {
33
+ const headers = { Authorization: `Bearer ${auth.apiKey}`, "User-Agent": "computesdk-orble" };
34
+ let payload;
35
+ if (raw) {
36
+ payload = raw;
37
+ headers["Content-Type"] = "application/octet-stream";
38
+ } else if (body !== void 0) {
39
+ payload = JSON.stringify(body);
40
+ headers["Content-Type"] = "application/json";
41
+ }
42
+ const res = await fetch(`${auth.baseUrl}${path}`, { method, headers, body: payload });
43
+ if (res.status === 404) return null;
44
+ const text = await res.text();
45
+ if (!res.ok) {
46
+ let message = text.trim() || res.statusText;
47
+ try {
48
+ message = JSON.parse(text).error || message;
49
+ } catch {
50
+ }
51
+ throw new Error(`Orble API error (${res.status}) on ${method} ${path}: ${message}`);
52
+ }
53
+ return text ? JSON.parse(text) : null;
54
+ }
55
+ async function rawTransfer(sandbox, method, path, body) {
56
+ const user = (sandbox.user ?? "root") === "root" ? "&user=root" : "";
57
+ const url = `${sandbox.baseUrl}${boxPath(sandbox.id, `/files?path=${encodeURIComponent(path)}${method === "GET" ? "&raw=1" : ""}${user}`)}`;
58
+ const headers = { Authorization: `Bearer ${sandbox.apiKey}`, "User-Agent": "computesdk-orble" };
59
+ if (body) {
60
+ headers["Content-Type"] = "application/octet-stream";
61
+ headers["Content-Length"] = String(body.length);
62
+ }
63
+ const fail = (status, text) => {
64
+ let message = text.trim() || String(status);
65
+ try {
66
+ message = JSON.parse(text).error || message;
67
+ } catch {
68
+ }
69
+ throw new Error(`Orble API error (${status}) on ${method} ${path}: ${message}`);
70
+ };
71
+ const https = typeof process !== "undefined" && process.versions?.node ? await import("https").catch(() => null) : null;
72
+ if (https && url.startsWith("https:")) {
73
+ const { status, data } = await new Promise((resolve, reject) => {
74
+ const req = https.request(url, { method, headers }, (res2) => {
75
+ const parts = [];
76
+ res2.on("data", (c) => parts.push(c));
77
+ res2.on("end", () => resolve({ status: res2.statusCode ?? 0, data: Buffer.concat(parts) }));
78
+ res2.on("error", reject);
79
+ });
80
+ req.on("error", reject);
81
+ req.end(body);
82
+ });
83
+ if (status === 404) return null;
84
+ if (status < 200 || status >= 300) fail(status, data.toString("utf8"));
85
+ return data;
86
+ }
87
+ const res = await fetch(url, { method, headers, body });
88
+ if (res.status === 404) return null;
89
+ if (!res.ok) fail(res.status, await res.text());
90
+ return Buffer.from(await res.arrayBuffer());
91
+ }
92
+ function toSandbox(auth, data) {
93
+ return { id: data.name, data, ...auth };
94
+ }
95
+ var boxPath = (name, sub = "") => `/v1/boxes/${encodeURIComponent(name)}${sub}`;
96
+ function createBody(options = {}) {
97
+ const body = {};
98
+ if (typeof options.size === "string") body.size = options.size;
99
+ const from = options.snapshotId ?? options.templateId;
100
+ if (from) body.from = from;
101
+ if (options.name) body.name = options.name;
102
+ return body;
103
+ }
104
+ function wrapCommand(command, options) {
105
+ return options?.background ? `nohup sh -c "${escapeShellArg(command)}" >/dev/null 2>&1 &` : command;
106
+ }
107
+ function shellPath(path) {
108
+ return `"${escapeShellArg(path.startsWith("-") ? `./${path}` : path)}"`;
109
+ }
110
+ async function exec(sandbox, command, options) {
111
+ const body = { command };
112
+ if (options?.timeout) body.timeout_s = Math.min(EXEC_MAX_TIMEOUT_S, Math.ceil(options.timeout / 1e3));
113
+ if (options?.env && Object.keys(options.env).length > 0) body.env = options.env;
114
+ if (options?.cwd) body.cwd = options.cwd;
115
+ if (userFor(sandbox, options) === "root") body.user = "root";
116
+ let data = await request(sandbox, "POST", boxPath(sandbox.id, "/exec"), body);
117
+ while (data?.running) data = await request(sandbox, "POST", boxPath(sandbox.id, "/exec"), { job: data.job });
118
+ if (!data) throw new Error(`Orble box ${sandbox.id} not found`);
119
+ return data;
120
+ }
121
+ function infoStatus(state) {
122
+ if (state === "running") return "running";
123
+ if (state === "error") return "error";
124
+ return "stopped";
125
+ }
126
+ function toSnapshot(data) {
127
+ return {
128
+ id: data.name,
129
+ provider: "orble",
130
+ createdAt: new Date(data.created_at),
131
+ metadata: {
132
+ state: data.state,
133
+ box: data.box,
134
+ vcpus: data.vcpus,
135
+ memMiB: data.mem_mib,
136
+ diskBytes: data.disk_bytes,
137
+ ...data.alias && { alias: data.alias },
138
+ ...data.gallery && { gallery: true, about: data.about }
139
+ }
140
+ };
141
+ }
142
+ async function listSnapshots(config) {
143
+ return await request(resolveConfig(config), "GET", "/v1/snapshots") ?? [];
144
+ }
145
+ async function deleteSnapshot(config, name) {
146
+ await request(resolveConfig(config), "DELETE", `/v1/snapshots/${encodeURIComponent(name)}`);
147
+ }
148
+ async function mustSucceed(run, sandbox, command, what) {
149
+ const result = await run(sandbox, command);
150
+ if (result.exitCode !== 0) throw new Error(`Failed to ${what}: ${result.stderr.trim() || `exit code ${result.exitCode}`}`);
151
+ return result;
152
+ }
153
+ var orble = defineProvider({
154
+ name: "orble",
155
+ sizes: (_config, profile, options) => {
156
+ if (options?.size !== void 0) throw new InstanceSizeError("conflict", "cannot combine sizeClass with the native Orble size field");
157
+ const shape = ORBLE_SIZES[profile.sizeClass];
158
+ if (!shape) {
159
+ return { status: "unsupported", reason: `Orble has no ${profile.sizeClass} shape; it offers 1/2, 2/4, 4/8 and 8/16 (vCPU / GiB).` };
160
+ }
161
+ return { status: "supported", nativeOptions: { size: shape.size }, resolved: { vcpus: shape.vcpus, memoryMiB: shape.memoryMiB, diskMiB: ORBLE_DISK_MIB } };
162
+ },
163
+ methods: {
164
+ instances: {
165
+ create: async (config, options) => {
166
+ const auth = resolveConfig(config);
167
+ const data = await request(auth, "POST", "/v1/boxes", createBody(options));
168
+ if (!data) throw new Error("Orble API returned no box on create");
169
+ return { instance: toSandbox(auth, data), instanceId: data.name };
170
+ },
171
+ getById: async (config, instanceId) => {
172
+ const auth = resolveConfig(config);
173
+ const data = await request(auth, "GET", boxPath(instanceId));
174
+ return data ? { instance: toSandbox(auth, data), instanceId: data.name } : null;
175
+ },
176
+ list: async (config) => {
177
+ const auth = resolveConfig(config);
178
+ const data = await request(auth, "GET", "/v1/boxes");
179
+ return (data ?? []).map((row) => ({ instance: toSandbox(auth, row), instanceId: row.name }));
180
+ },
181
+ destroy: async (config, instanceId) => {
182
+ const auth = resolveConfig(config);
183
+ await request(auth, "DELETE", boxPath(instanceId));
184
+ },
185
+ runCommand: async (sandbox, command, options) => {
186
+ const start = Date.now();
187
+ const data = await exec(sandbox, wrapCommand(command, options), options);
188
+ return { stdout: data.stdout ?? "", stderr: data.stderr ?? "", exitCode: data.exit_code, durationMs: Date.now() - start };
189
+ },
190
+ getInfo: async (sandbox) => {
191
+ const data = await request(sandbox, "GET", boxPath(sandbox.id));
192
+ const current = data ?? { ...sandbox.data, state: "deleted" };
193
+ return {
194
+ id: sandbox.id,
195
+ provider: "orble",
196
+ status: infoStatus(current.state),
197
+ createdAt: current.created_at ? new Date(current.created_at) : /* @__PURE__ */ new Date(),
198
+ timeout: 0,
199
+ metadata: { state: current.state, hostname: current.hostname, vcpus: current.vcpus, memMiB: current.mem_mib, diskGiB: current.disk_gib }
200
+ };
201
+ },
202
+ // Shares the port at its own https address: private (Orble sign-in) by default, public with `public: true`.
203
+ getUrl: async (sandbox, options) => {
204
+ const data = await request(sandbox, "PUT", boxPath(sandbox.id, `/ports/${options.port}`), {
205
+ access: options.public ? "public" : "private"
206
+ });
207
+ if (!data?.url) throw new Error(`Orble box ${sandbox.id} not found`);
208
+ return options.protocol === "ws" || options.protocol === "wss" ? data.url.replace(/^https/, "wss") : data.url;
209
+ },
210
+ // Suspend keeps the box's memory and running programs; resume (or any command) wakes it where it was.
211
+ pause: async (sandbox) => {
212
+ if (!await request(sandbox, "POST", boxPath(sandbox.id, "/suspend"))) throw new Error(`Orble box ${sandbox.id} not found`);
213
+ },
214
+ resume: async (sandbox) => {
215
+ const data = await request(sandbox, "POST", boxPath(sandbox.id, "/resume"));
216
+ if (!data) throw new Error(`Orble box ${sandbox.id} not found`);
217
+ return toSandbox(sandbox, data);
218
+ },
219
+ pauseCapabilities: { memory: true },
220
+ getInstance: (sandbox) => sandbox,
221
+ filesystem: {
222
+ // The whole file in one streamed response (raw=1), at any size up to the API's limit.
223
+ readFile: async (sandbox, path) => {
224
+ const data = await rawTransfer(sandbox, "GET", path);
225
+ if (!data) throw new Error(`Failed to read ${path}: not found`);
226
+ return data.toString("utf8");
227
+ },
228
+ // The raw body is streamed to the file, so large files go in one request.
229
+ writeFile: async (sandbox, path, content) => {
230
+ if (!await rawTransfer(sandbox, "PUT", path, Buffer.from(content, "utf8"))) throw new Error(`Failed to write ${path}: box not found`);
231
+ },
232
+ mkdir: async (sandbox, path, run) => {
233
+ await mustSucceed(run, sandbox, `mkdir -p ${shellPath(path)}`, `create ${path}`);
234
+ },
235
+ readdir: async (sandbox, path, run) => {
236
+ const result = await mustSucceed(run, sandbox, `find ${shellPath(path)} -mindepth 1 -maxdepth 1 -printf '%y\\t%s\\t%T@\\t%f\\n'`, `list ${path}`);
237
+ return result.stdout.split("\n").filter(Boolean).map((line) => {
238
+ const [kind, size, modified, ...name] = line.split(" ");
239
+ return { name: name.join(" "), type: kind === "d" ? "directory" : "file", size: Number(size), modified: new Date(Number(modified) * 1e3) };
240
+ });
241
+ },
242
+ exists: async (sandbox, path, run) => {
243
+ const result = await run(sandbox, `test -e ${shellPath(path)}`);
244
+ return result.exitCode === 0;
245
+ },
246
+ remove: async (sandbox, path, run) => {
247
+ await mustSucceed(run, sandbox, `rm -rf ${shellPath(path)}`, `remove ${path}`);
248
+ }
249
+ }
250
+ },
251
+ snapshot: {
252
+ // A snapshot keeps the box's disk, memory and running programs. A running box pauses briefly while it is taken,
253
+ // then keeps running. A box started from it at the snapshot's size resumes where the snapshot was taken; at a
254
+ // larger size it boots from the snapshot's disk. The API answers once the snapshot is ready.
255
+ capabilities: { scope: "rootfs", memory: true, destroysSource: false, source: "kept", fork: true },
256
+ create: async (config, instanceId, options) => {
257
+ const auth = resolveConfig(config);
258
+ const data = await request(auth, "POST", boxPath(instanceId, "/snapshot"), options?.name ? { name: options.name } : {});
259
+ if (!data) throw new Error(`Orble box ${instanceId} not found`);
260
+ return toSnapshot(data);
261
+ },
262
+ // The account's own snapshots; Orble's gallery snapshots are listed as templates.
263
+ list: async (config, options) => {
264
+ const box = options?.instanceId ?? options?.sandboxId;
265
+ const rows = (await listSnapshots(config)).filter((s) => !s.gallery && (!box || s.box === box));
266
+ return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);
267
+ },
268
+ delete: deleteSnapshot
269
+ },
270
+ // Orble starts boxes from snapshots, its own (the gallery) or the account's, so templates are snapshots.
271
+ template: {
272
+ create: async () => {
273
+ throw new Error("Orble has no template builds; make a template with snapshot.create() from a box you have set up.");
274
+ },
275
+ list: async (config, options) => {
276
+ const rows = await listSnapshots(config);
277
+ return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);
278
+ },
279
+ delete: deleteSnapshot
280
+ }
281
+ }
282
+ });
283
+ var index_default = orble;
284
+ export {
285
+ ORBLE_SIZES,
286
+ index_default as default,
287
+ infoStatus,
288
+ orble
289
+ };
290
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Orble Provider - Factory-based Implementation\n *\n * Linux VMs (\"boxes\") on Orble (https://orble.tech), with root through passwordless sudo and Docker inside. Orble's\n * REST API is a small JSON surface, so this package talks to it with `fetch` and has no SDK dependency.\n *\n * Commands run as the box's user, `agent`, from /home/agent. Files are read and written through the API's files\n * endpoint; mkdir, readdir, exists and remove run as shell commands.\n */\n\nimport { defineProvider, escapeShellArg, InstanceSizeError } from '@computesdk/provider';\n\nimport type {\n CommandResult,\n CreateInstanceOptions,\n CreateSnapshotOptions,\n FileEntry,\n InstanceInfo,\n ListSnapshotsOptions,\n ListTemplatesOptions,\n RunCommandOptions,\n} from '@computesdk/provider';\nimport type { Snapshot } from 'computesdk';\n\nexport interface OrbleConfig {\n /** Orble API key - if not provided, will fallback to ORBLE_API_KEY environment variable */\n apiKey?: string;\n /** API base URL - if not provided, will fallback to ORBLE_API_URL, then https://orble.tech */\n baseUrl?: string;\n /**\n * Who commands and file operations run as: `root` (the default, as on Daytona and Modal; relative paths start at\n * /root) or `agent`, the box's own user (relative paths start at /home/agent, where SSH logins and agents work).\n * Falls back to ORBLE_USER. A command's own `user` option overrides it.\n */\n user?: OrbleUser;\n}\n\nexport type OrbleUser = 'agent' | 'root';\n\n/** A box as Orble's API returns it. */\nexport interface OrbleBoxData {\n name: string;\n hostname: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_gib: number;\n created_at?: string;\n [key: string]: unknown;\n}\n\nexport interface OrbleSandbox {\n id: string;\n data: OrbleBoxData;\n apiKey: string;\n baseUrl: string;\n user?: OrbleUser;\n}\n\n/** A snapshot as Orble's API returns it. `gallery` marks one of Orble's own, which every account can start boxes from. */\nexport interface OrbleSnapshotData {\n name: string;\n alias?: string;\n box?: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_bytes?: number;\n created_at: string;\n gallery?: boolean;\n about?: string;\n}\n\ninterface ExecResponse {\n running?: boolean;\n job?: string;\n exit_code: number;\n stdout?: string;\n stderr?: string;\n}\n\ntype FsRunCommand = (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions) => Promise<CommandResult>;\n\n// Orble's box sizes (vCPU / MiB): micro 1/2048, s 2/4096, m 4/8192, l 8/16384, each with a 64 GiB disk.\n// https://orble.tech/pricing\nconst ORBLE_DISK_MIB = 65536;\n\nexport const ORBLE_SIZES: Readonly<Record<string, { size: 'micro' | 's' | 'm' | 'l'; vcpus: number; memoryMiB: number }>> = Object.freeze({\n xs: { size: 'micro', vcpus: 1, memoryMiB: 2048 }, // memory is a floor, so the 1 vCPU / 2 GiB shape is also an xs\n sm: { size: 'micro', vcpus: 1, memoryMiB: 2048 },\n md: { size: 's', vcpus: 2, memoryMiB: 4096 },\n lg: { size: 'm', vcpus: 4, memoryMiB: 8192 },\n xl: { size: 'l', vcpus: 8, memoryMiB: 16384 },\n});\n\n// Orble stops a command after at most 600 s. Exec answers within about 50 s; a command still running then comes back\n// as a job, which exec() polls until it ends.\nconst EXEC_MAX_TIMEOUT_S = 600;\n\nfunction resolveConfig(config: OrbleConfig) {\n const env = typeof process !== 'undefined' ? process.env : undefined;\n const apiKey = config.apiKey || env?.ORBLE_API_KEY || '';\n if (!apiKey) {\n throw new Error(\n `Missing Orble API key. Provide 'apiKey' in config or set ORBLE_API_KEY environment variable. ` +\n `Create one at https://orble.tech/settings?tab=api`,\n );\n }\n const baseUrl = (config.baseUrl || env?.ORBLE_API_URL || 'https://orble.tech').replace(/\\/+$/, '');\n const user = config.user ?? ((env?.ORBLE_USER || undefined) as OrbleUser | undefined); // empty is unset\n if (user !== undefined && user !== 'agent' && user !== 'root') {\n throw new Error(`Orble user must be 'agent' or 'root', not '${user}'`);\n }\n return { apiKey, baseUrl, ...(user ? { user } : {}) };\n}\n\n/** The user one call runs as: the command's own `user` option, else the provider's. */\nfunction userFor(sandbox: OrbleSandbox, options?: RunCommandOptions): OrbleUser {\n const asked = (options as { user?: string } | undefined)?.user;\n return asked === 'root' || asked === 'agent' ? asked : sandbox.user ?? 'root';\n}\n\n// Calls the API. A 404 (a box that doesn't exist, or isn't the caller's) comes back as null; other errors throw.\nasync function request<T>(\n auth: { apiKey: string; baseUrl: string },\n method: string,\n path: string,\n body?: unknown,\n raw?: Uint8Array,\n): Promise<T | null> {\n const headers: Record<string, string> = { Authorization: `Bearer ${auth.apiKey}`, 'User-Agent': 'computesdk-orble' };\n let payload: BodyInit | undefined;\n if (raw) {\n payload = raw as BodyInit;\n headers['Content-Type'] = 'application/octet-stream';\n } else if (body !== undefined) {\n payload = JSON.stringify(body);\n headers['Content-Type'] = 'application/json';\n }\n const res = await fetch(`${auth.baseUrl}${path}`, { method, headers, body: payload });\n if (res.status === 404) return null;\n const text = await res.text();\n if (!res.ok) {\n let message = text.trim() || res.statusText;\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${res.status}) on ${method} ${path}: ${message}`);\n }\n return (text ? JSON.parse(text) : null) as T | null;\n}\n\n/**\n * One raw file transfer: GET .../files?raw=1 for a whole file, or PUT with the raw body. Node's built-in fetch moves\n * these at about 6 MB/s from a workstation where node:https and curl move 40-48 MB/s (2026-11-23, 64 MiB), so in\n * Node this uses node:https; elsewhere it falls back to fetch. Returns the body, or null on 404.\n */\nasync function rawTransfer(sandbox: OrbleSandbox, method: 'GET' | 'PUT', path: string, body?: Buffer): Promise<Buffer | null> {\n const user = (sandbox.user ?? 'root') === 'root' ? '&user=root' : '';\n const url = `${sandbox.baseUrl}${boxPath(sandbox.id, `/files?path=${encodeURIComponent(path)}${method === 'GET' ? '&raw=1' : ''}${user}`)}`;\n const headers: Record<string, string> = { Authorization: `Bearer ${sandbox.apiKey}`, 'User-Agent': 'computesdk-orble' };\n if (body) {\n headers['Content-Type'] = 'application/octet-stream';\n headers['Content-Length'] = String(body.length);\n }\n const fail = (status: number, text: string): never => {\n let message = text.trim() || String(status);\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${status}) on ${method} ${path}: ${message}`);\n };\n const https = typeof process !== 'undefined' && process.versions?.node ? await import('node:https').catch(() => null) : null;\n if (https && url.startsWith('https:')) {\n const { status, data } = await new Promise<{ status: number; data: Buffer }>((resolve, reject) => {\n const req = https.request(url, { method, headers }, (res) => {\n const parts: Buffer[] = [];\n res.on('data', (c: Buffer) => parts.push(c));\n res.on('end', () => resolve({ status: res.statusCode ?? 0, data: Buffer.concat(parts) }));\n res.on('error', reject);\n });\n req.on('error', reject);\n req.end(body);\n });\n if (status === 404) return null;\n if (status < 200 || status >= 300) fail(status, data.toString('utf8'));\n return data;\n }\n const res = await fetch(url, { method, headers, body: body as BodyInit | undefined });\n if (res.status === 404) return null;\n if (!res.ok) fail(res.status, await res.text());\n return Buffer.from(await res.arrayBuffer());\n}\n\nfunction toSandbox(auth: { apiKey: string; baseUrl: string; user?: OrbleUser }, data: OrbleBoxData): OrbleSandbox {\n return { id: data.name, data, ...auth };\n}\n\nconst boxPath = (name: string, sub = '') => `/v1/boxes/${encodeURIComponent(name)}${sub}`;\n\n/** Maps ComputeSDK's create options onto the body of POST /v1/boxes. */\nfunction createBody(options: CreateInstanceOptions = {}): Record<string, unknown> {\n const body: Record<string, unknown> = {};\n if (typeof options.size === 'string') body.size = options.size;\n const from = options.snapshotId ?? options.templateId;\n if (from) body.from = from;\n if (options.name) body.name = options.name;\n return body;\n}\n\nfunction wrapCommand(command: string, options?: RunCommandOptions): string {\n return options?.background ? `nohup sh -c \"${escapeShellArg(command)}\" >/dev/null 2>&1 &` : command;\n}\n\n// A leading dash would be read as an option by find, mkdir and rm.\nfunction shellPath(path: string): string {\n return `\"${escapeShellArg(path.startsWith('-') ? `./${path}` : path)}\"`;\n}\n\nasync function exec(sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<ExecResponse> {\n const body: Record<string, unknown> = { command };\n if (options?.timeout) body.timeout_s = Math.min(EXEC_MAX_TIMEOUT_S, Math.ceil(options.timeout / 1000));\n if (options?.env && Object.keys(options.env).length > 0) body.env = options.env;\n if (options?.cwd) body.cwd = options.cwd;\n if (userFor(sandbox, options) === 'root') body.user = 'root';\n let data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), body);\n while (data?.running) data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), { job: data.job });\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return data;\n}\n\n// Orble's states are creating, running, suspended, stopped, error, deleting and deleted. A suspended box wakes on the\n// next command, but it is not running until then.\nexport function infoStatus(state: string): InstanceInfo['status'] {\n if (state === 'running') return 'running';\n if (state === 'error') return 'error';\n return 'stopped';\n}\n\nfunction toSnapshot(data: OrbleSnapshotData): Snapshot {\n return {\n id: data.name,\n provider: 'orble',\n createdAt: new Date(data.created_at),\n metadata: {\n state: data.state,\n box: data.box,\n vcpus: data.vcpus,\n memMiB: data.mem_mib,\n diskBytes: data.disk_bytes,\n ...(data.alias && { alias: data.alias }),\n ...(data.gallery && { gallery: true, about: data.about }),\n },\n };\n}\n\nasync function listSnapshots(config: OrbleConfig): Promise<OrbleSnapshotData[]> {\n return (await request<OrbleSnapshotData[]>(resolveConfig(config), 'GET', '/v1/snapshots')) ?? [];\n}\n\n// Deleting a snapshot that doesn't exist (a 404) leaves nothing to do.\nasync function deleteSnapshot(config: OrbleConfig, name: string): Promise<void> {\n await request(resolveConfig(config), 'DELETE', `/v1/snapshots/${encodeURIComponent(name)}`);\n}\n\nasync function mustSucceed(run: FsRunCommand, sandbox: OrbleSandbox, command: string, what: string): Promise<CommandResult> {\n const result = await run(sandbox, command);\n if (result.exitCode !== 0) throw new Error(`Failed to ${what}: ${result.stderr.trim() || `exit code ${result.exitCode}`}`);\n return result;\n}\n\nexport const orble = defineProvider<OrbleSandbox, OrbleConfig>({\n name: 'orble',\n sizes: (_config, profile, options) => {\n if (options?.size !== undefined) throw new InstanceSizeError('conflict', 'cannot combine sizeClass with the native Orble size field');\n const shape = ORBLE_SIZES[profile.sizeClass];\n if (!shape) {\n return { status: 'unsupported', reason: `Orble has no ${profile.sizeClass} shape; it offers 1/2, 2/4, 4/8 and 8/16 (vCPU / GiB).` };\n }\n return { status: 'supported', nativeOptions: { size: shape.size }, resolved: { vcpus: shape.vcpus, memoryMiB: shape.memoryMiB, diskMiB: ORBLE_DISK_MIB } };\n },\n methods: {\n instances: {\n create: async (config: OrbleConfig, options?: CreateInstanceOptions) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'POST', '/v1/boxes', createBody(options));\n if (!data) throw new Error('Orble API returned no box on create');\n return { instance: toSandbox(auth, data), instanceId: data.name };\n },\n\n getById: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'GET', boxPath(instanceId));\n return data ? { instance: toSandbox(auth, data), instanceId: data.name } : null;\n },\n\n list: async (config: OrbleConfig) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData[]>(auth, 'GET', '/v1/boxes');\n return (data ?? []).map((row) => ({ instance: toSandbox(auth, row), instanceId: row.name }));\n },\n\n destroy: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n await request(auth, 'DELETE', boxPath(instanceId));\n },\n\n runCommand: async (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<CommandResult> => {\n const start = Date.now();\n const data = await exec(sandbox, wrapCommand(command, options), options);\n return { stdout: data.stdout ?? '', stderr: data.stderr ?? '', exitCode: data.exit_code, durationMs: Date.now() - start };\n },\n\n getInfo: async (sandbox: OrbleSandbox): Promise<InstanceInfo> => {\n const data = await request<OrbleBoxData>(sandbox, 'GET', boxPath(sandbox.id));\n const current = data ?? { ...sandbox.data, state: 'deleted' };\n return {\n id: sandbox.id,\n provider: 'orble',\n status: infoStatus(current.state),\n createdAt: current.created_at ? new Date(current.created_at) : new Date(),\n timeout: 0,\n metadata: { state: current.state, hostname: current.hostname, vcpus: current.vcpus, memMiB: current.mem_mib, diskGiB: current.disk_gib },\n };\n },\n\n // Shares the port at its own https address: private (Orble sign-in) by default, public with `public: true`.\n getUrl: async (sandbox: OrbleSandbox, options: { port: number; protocol?: string; public?: boolean }): Promise<string> => {\n const data = await request<{ url: string }>(sandbox, 'PUT', boxPath(sandbox.id, `/ports/${options.port}`), {\n access: options.public ? 'public' : 'private',\n });\n if (!data?.url) throw new Error(`Orble box ${sandbox.id} not found`);\n return options.protocol === 'ws' || options.protocol === 'wss' ? data.url.replace(/^https/, 'wss') : data.url;\n },\n\n // Suspend keeps the box's memory and running programs; resume (or any command) wakes it where it was.\n pause: async (sandbox: OrbleSandbox): Promise<void> => {\n if (!(await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/suspend')))) throw new Error(`Orble box ${sandbox.id} not found`);\n },\n resume: async (sandbox: OrbleSandbox): Promise<OrbleSandbox> => {\n const data = await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/resume'));\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return toSandbox(sandbox, data);\n },\n pauseCapabilities: { memory: true },\n\n getInstance: (sandbox: OrbleSandbox): OrbleSandbox => sandbox,\n\n filesystem: {\n // The whole file in one streamed response (raw=1), at any size up to the API's limit.\n readFile: async (sandbox: OrbleSandbox, path: string): Promise<string> => {\n const data = await rawTransfer(sandbox, 'GET', path);\n if (!data) throw new Error(`Failed to read ${path}: not found`);\n return data.toString('utf8');\n },\n // The raw body is streamed to the file, so large files go in one request.\n writeFile: async (sandbox: OrbleSandbox, path: string, content: string): Promise<void> => {\n if (!(await rawTransfer(sandbox, 'PUT', path, Buffer.from(content, 'utf8')))) throw new Error(`Failed to write ${path}: box not found`);\n },\n mkdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `mkdir -p ${shellPath(path)}`, `create ${path}`);\n },\n readdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<FileEntry[]> => {\n const result = await mustSucceed(run, sandbox, `find ${shellPath(path)} -mindepth 1 -maxdepth 1 -printf '%y\\\\t%s\\\\t%T@\\\\t%f\\\\n'`, `list ${path}`);\n return result.stdout\n .split('\\n')\n .filter(Boolean)\n .map((line) => {\n const [kind, size, modified, ...name] = line.split('\\t');\n return { name: name.join('\\t'), type: kind === 'd' ? ('directory' as const) : ('file' as const), size: Number(size), modified: new Date(Number(modified) * 1000) };\n });\n },\n exists: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<boolean> => {\n const result = await run(sandbox, `test -e ${shellPath(path)}`);\n return result.exitCode === 0;\n },\n remove: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `rm -rf ${shellPath(path)}`, `remove ${path}`);\n },\n },\n },\n\n snapshot: {\n // A snapshot keeps the box's disk, memory and running programs. A running box pauses briefly while it is taken,\n // then keeps running. A box started from it at the snapshot's size resumes where the snapshot was taken; at a\n // larger size it boots from the snapshot's disk. The API answers once the snapshot is ready.\n capabilities: { scope: 'rootfs', memory: true, destroysSource: false, source: 'kept', fork: true },\n create: async (config: OrbleConfig, instanceId: string, options?: CreateSnapshotOptions): Promise<Snapshot> => {\n const auth = resolveConfig(config);\n const data = await request<OrbleSnapshotData>(auth, 'POST', boxPath(instanceId, '/snapshot'), options?.name ? { name: options.name } : {});\n if (!data) throw new Error(`Orble box ${instanceId} not found`);\n return toSnapshot(data);\n },\n // The account's own snapshots; Orble's gallery snapshots are listed as templates.\n list: async (config: OrbleConfig, options?: ListSnapshotsOptions): Promise<Snapshot[]> => {\n const box = options?.instanceId ?? options?.sandboxId;\n const rows = (await listSnapshots(config)).filter((s) => !s.gallery && (!box || s.box === box));\n return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);\n },\n delete: deleteSnapshot,\n },\n\n // Orble starts boxes from snapshots, its own (the gallery) or the account's, so templates are snapshots.\n template: {\n create: async (): Promise<Snapshot> => {\n throw new Error('Orble has no template builds; make a template with snapshot.create() from a box you have set up.');\n },\n list: async (config: OrbleConfig, options?: ListTemplatesOptions): Promise<Snapshot[]> => {\n const rows = await listSnapshots(config);\n return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);\n },\n delete: deleteSnapshot,\n },\n },\n});\n\nexport default orble;\n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.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "@computesdk/orble",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.2",
4
+ "description": "Orble provider for ComputeSDK - Linux VMs with sudo and Docker, memory snapshots, pause/resume, and port URLs",
5
+ "author": "Orble",
6
+ "license": "MIT",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.mjs",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.mjs",
14
+ "require": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "keywords": [
21
+ "computesdk",
22
+ "provider",
23
+ "sandbox",
24
+ "code-execution",
25
+ "cloud",
26
+ "compute",
27
+ "orble"
28
+ ],
29
+ "dependencies": {
30
+ "@computesdk/provider": "2.1.31",
31
+ "computesdk": "4.1.25"
32
+ },
33
+ "devDependencies": {
34
+ "@types/node": "^20.0.0",
35
+ "@vitest/coverage-v8": "^1.0.0",
36
+ "eslint": "^8.37.0",
37
+ "rimraf": "^5.0.0",
38
+ "tsup": "^8.0.0",
39
+ "typescript": "^5.0.0",
40
+ "vitest": "^1.0.0",
41
+ "@computesdk/test-utils": "2.0.7"
42
+ },
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "https://github.com/computesdk/computesdk.git",
46
+ "directory": "packages/orble"
47
+ },
48
+ "homepage": "https://orble.tech",
49
+ "bugs": {
50
+ "url": "https://github.com/computesdk/computesdk/issues"
51
+ },
52
+ "scripts": {
53
+ "build": "tsup",
54
+ "clean": "rimraf dist",
55
+ "dev": "tsup --watch",
56
+ "test": "vitest run",
57
+ "test:watch": "vitest watch",
58
+ "test:coverage": "vitest run --coverage",
59
+ "typecheck": "tsc --noEmit",
60
+ "lint": "eslint"
61
+ }
6
62
  }