@sandboxrouter/sdk 0.15.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +5 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.js +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/leaderboard.js +4 -2
- package/dist/move.d.ts +69 -0
- package/dist/move.js +123 -0
- package/dist/published.js +154 -31
- package/dist/router.d.ts +18 -0
- package/dist/router.js +20 -0
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -214,6 +214,11 @@ async function main() {
|
|
|
214
214
|
if (!command)
|
|
215
215
|
throw new RouterError('usage: sandboxrouter compare "<cmd>" [--setup "<cmd>"] [--runs 3] [--provider a,b]');
|
|
216
216
|
const ids = providers ?? router.registered().filter((id) => router.isConfigured(id));
|
|
217
|
+
// With no keys there is nothing to compare: say so instead of printing an empty table.
|
|
218
|
+
if (!ids.length) {
|
|
219
|
+
throw new RouterError("no provider keys found: set the API key for at least one provider (the README's Env table lists each provider's variables); " +
|
|
220
|
+
"`npx @sandboxrouter/sdk providers` shows which are set");
|
|
221
|
+
}
|
|
217
222
|
const rows = await compare({ router, providers: ids, command, setup: values.setup, runs: num(values.runs), timeoutSeconds: num(values.seconds), parallel: num(values.parallel), onProgress: (m) => console.error(m) });
|
|
218
223
|
if (values.json)
|
|
219
224
|
return console.log(JSON.stringify(rows, null, 2));
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Candidate, Quote, Size } from "./router.js";
|
|
2
|
+
import { type CopyOptions, type CopyResult, type FileBox, type MoveOptions } from "./move.js";
|
|
2
3
|
import type { Attempt, Capability, ExecOptions, ExecResult, RouteOptions, RouterErrorCode, SandboxProcess, SandboxSpec, StartOptions } from "./types.js";
|
|
3
4
|
/**
|
|
4
5
|
* Client for the sandboxrouter HTTP API: the hosted service (one key, prepaid credits) or your own
|
|
@@ -42,6 +43,15 @@ export declare class Client {
|
|
|
42
43
|
create(spec?: SandboxSpec, route?: RouteOptions, opts?: {
|
|
43
44
|
idempotencyKey?: string;
|
|
44
45
|
}): Promise<RemoteSandbox>;
|
|
46
|
+
/** Copy a folder from one sandbox to another, on any two providers. The files pass through this machine. */
|
|
47
|
+
copy(from: FileBox, to: FileBox, opts?: CopyOptions): Promise<CopyResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Move a sandbox's folder to a new sandbox and kill the old one: on another provider by default,
|
|
50
|
+
* or on the ones `provider` names. If the new one can't start or the copy fails, the old sandbox is left running.
|
|
51
|
+
*/
|
|
52
|
+
move(from: FileBox, opts?: MoveOptions): Promise<RemoteSandbox & {
|
|
53
|
+
moved: CopyResult;
|
|
54
|
+
}>;
|
|
45
55
|
/** A handle on a sandbox you created earlier. */
|
|
46
56
|
sandbox(id: string): RemoteSandbox;
|
|
47
57
|
}
|
package/dist/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { copyFiles, moveSandbox } from "./move.js";
|
|
1
2
|
/**
|
|
2
3
|
* Client for the sandboxrouter HTTP API: the hosted service (one key, prepaid credits) or your own
|
|
3
4
|
* `sandboxrouter serve`. Provider keys live on the server; this side only needs the one key.
|
|
@@ -66,6 +67,17 @@ export class Client {
|
|
|
66
67
|
const r = (await res.json());
|
|
67
68
|
return new RemoteSandbox(this, r.id, r.provider, { ...r, replayed: res.headers.get("idempotent-replayed") === "true" });
|
|
68
69
|
}
|
|
70
|
+
/** Copy a folder from one sandbox to another, on any two providers. The files pass through this machine. */
|
|
71
|
+
copy(from, to, opts = {}) {
|
|
72
|
+
return copyFiles(from, to, opts);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Move a sandbox's folder to a new sandbox and kill the old one: on another provider by default,
|
|
76
|
+
* or on the ones `provider` names. If the new one can't start or the copy fails, the old sandbox is left running.
|
|
77
|
+
*/
|
|
78
|
+
move(from, opts = {}) {
|
|
79
|
+
return moveSandbox({ candidates: (spec, route) => this.route(spec, route), create: (spec, route) => this.create(spec, route) }, from, opts);
|
|
80
|
+
}
|
|
69
81
|
/** A handle on a sandbox you created earlier. */
|
|
70
82
|
sandbox(id) {
|
|
71
83
|
return new RemoteSandbox(this, id, id.split(":")[0]);
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { validate, splitRequest, SPEC_KEYS, ROUTE_KEYS, STRATEGIES } from "./val
|
|
|
13
13
|
export { CATALOG, hourlyCost, unfit, info, billingRules, billedUsd, type ProviderInfo } from "./catalog.js";
|
|
14
14
|
export { createApp, HttpError, ERROR_STATUS, ORPHAN_GRACE_MS, type ServerHooks } from "./server.js";
|
|
15
15
|
export { Client, ClientError, RemoteSandbox, type CreateResponse } from "./client.js";
|
|
16
|
+
export { copyFiles, moveSandbox, DEFAULT_COPY_MAX_BYTES, type CopyOptions, type CopyResult, type FileBox, type MoveOptions, type Mover } from "./move.js";
|
|
16
17
|
export { RoutedComputer, createComputer, splitComputerRequest, DEFAULT_COMPUTER_TIMEOUT_S, DEFAULT_COMPUTER_DEADLINE_S, type ComputerRoute, planComputer, computerCatalog, computerHourly, COMPUTER_ENTRIES, type ComputerCatalogEntry, type ComputerCandidate, type ComputerProviderId, type ActionResult, type ComputerAction, type ComputerActionName, type ComputerInfo, type ComputerOs, type ComputerProvider, type ComputerSpec, type ProviderComputer, } from "./computers.js";
|
|
17
18
|
export { bench, benchMarkdown, type BenchRow } from "./bench.js";
|
|
18
19
|
export { aggregate, loadReports, makeReport, renderLeaderboard, type BenchReport, type LeaderRow } from "./leaderboard.js";
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { validate, splitRequest, SPEC_KEYS, ROUTE_KEYS, STRATEGIES } from "./val
|
|
|
13
13
|
export { CATALOG, hourlyCost, unfit, info, billingRules, billedUsd } from "./catalog.js";
|
|
14
14
|
export { createApp, HttpError, ERROR_STATUS, ORPHAN_GRACE_MS } from "./server.js";
|
|
15
15
|
export { Client, ClientError, RemoteSandbox } from "./client.js";
|
|
16
|
+
export { copyFiles, moveSandbox, DEFAULT_COPY_MAX_BYTES } from "./move.js";
|
|
16
17
|
export { RoutedComputer, createComputer, splitComputerRequest, DEFAULT_COMPUTER_TIMEOUT_S, DEFAULT_COMPUTER_DEADLINE_S, planComputer, computerCatalog, computerHourly, COMPUTER_ENTRIES, } from "./computers.js";
|
|
17
18
|
export { bench, benchMarkdown } from "./bench.js";
|
|
18
19
|
export { aggregate, loadReports, makeReport, renderLeaderboard } from "./leaderboard.js";
|
package/dist/leaderboard.js
CHANGED
|
@@ -177,6 +177,7 @@ export function taskTable(reports, version = TASK_VERSION, cohort = DEFAULT_SIZE
|
|
|
177
177
|
const maxCoreMs = cpuMs !== undefined && coreRead !== undefined && coreRead <= taskMillis * 1.1 ? coreRead : undefined;
|
|
178
178
|
const runs = rs.reduce((n, r) => n + r.runs, 0);
|
|
179
179
|
const ok = rs.reduce((n, r) => n + r.taskOk, 0);
|
|
180
|
+
const limited = rs.reduce((n, r) => n + (r.limited ?? 0), 0);
|
|
180
181
|
return [{
|
|
181
182
|
provider: id,
|
|
182
183
|
name: CATALOG.find((c) => c.id === id).name,
|
|
@@ -190,8 +191,9 @@ export function taskTable(reports, version = TASK_VERSION, cohort = DEFAULT_SIZE
|
|
|
190
191
|
reusedUsd: taskUsd(id, measured(size), createMs, taskMillis, cpuMs, ratio, true, maxCoreMs),
|
|
191
192
|
runs,
|
|
192
193
|
ok,
|
|
193
|
-
limited
|
|
194
|
-
|
|
194
|
+
limited,
|
|
195
|
+
// A request the provider refused for the benchmarking account's own limit isn't a failed job: it never ran.
|
|
196
|
+
successRate: runs - limited > 0 ? ok / (runs - limited) : 0,
|
|
195
197
|
...(cpuMs !== undefined ? { cpuMs } : {}),
|
|
196
198
|
activeCpu: cpuHourlyAtFull(id, measured(size)) > 0,
|
|
197
199
|
minimumSeconds: rules.minSeconds,
|
package/dist/move.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type ExecOptions, type ExecResult, type ProviderId, type RouteOptions, type SandboxSpec } from "./types.js";
|
|
2
|
+
/** What copy and move need from a sandbox: a `RoutedSandbox` and a `RemoteSandbox` both fit. */
|
|
3
|
+
export interface FileBox {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly provider: string;
|
|
6
|
+
readonly size?: {
|
|
7
|
+
vcpu: number;
|
|
8
|
+
memoryGb: number;
|
|
9
|
+
};
|
|
10
|
+
exec(cmd: string, opts?: ExecOptions): Promise<ExecResult>;
|
|
11
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
12
|
+
writeFile(path: string, content: string | Uint8Array): Promise<void>;
|
|
13
|
+
kill(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface CopyOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Folder to copy from the source. Default: the folder its commands run in. Copied whole like that,
|
|
18
|
+
* the destination keeps its own shell startup files (`.bashrc`, `.profile`, ...), since those belong to its image.
|
|
19
|
+
*/
|
|
20
|
+
path?: string;
|
|
21
|
+
/** Folder to copy into. Default: the same path, or the destination's own working folder when `path` isn't given. */
|
|
22
|
+
to?: string;
|
|
23
|
+
/** Names or patterns to leave behind, as `tar --exclude` reads them, e.g. `["node_modules", ".venv", "*.log"]`. */
|
|
24
|
+
exclude?: string[];
|
|
25
|
+
/** Refuse when the packed folder is bigger than this (default 1 GB), before anything is sent. */
|
|
26
|
+
maxBytes?: number;
|
|
27
|
+
/** Seconds each pack and unpack command may take (default 600). */
|
|
28
|
+
timeoutSeconds?: number;
|
|
29
|
+
/** Bytes sent per file transfer (default 4 MB). Providers cap how much one file call carries. */
|
|
30
|
+
chunkBytes?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface CopyResult {
|
|
33
|
+
/** The folder read on the source. */
|
|
34
|
+
from: string;
|
|
35
|
+
/** The folder written on the destination. */
|
|
36
|
+
to: string;
|
|
37
|
+
/** Size of the packed (gzip) folder that was sent. */
|
|
38
|
+
bytes: number;
|
|
39
|
+
ms: number;
|
|
40
|
+
}
|
|
41
|
+
export interface MoveOptions extends CopyOptions, RouteOptions {
|
|
42
|
+
/** The new sandbox's spec. Its size defaults to the old sandbox's. */
|
|
43
|
+
spec?: SandboxSpec;
|
|
44
|
+
/** Leave the old sandbox running (default: kill it once the files are across). */
|
|
45
|
+
keep?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare const DEFAULT_COPY_MAX_BYTES: number;
|
|
48
|
+
/**
|
|
49
|
+
* Copy a folder from one sandbox to another, on any two providers: packed with tar on the source,
|
|
50
|
+
* carried through this process in pieces, unpacked on the destination. Files, their modes and
|
|
51
|
+
* symlinks come across; running processes, memory and env vars don't. The source isn't changed.
|
|
52
|
+
* Both sandboxes need `tar` and `split` (every stock image has them).
|
|
53
|
+
*/
|
|
54
|
+
export declare function copyFiles(from: FileBox, to: FileBox, opts?: CopyOptions): Promise<CopyResult>;
|
|
55
|
+
/** What a move needs from a router: a `Router` and a hosted `Client` both fit. */
|
|
56
|
+
export interface Mover<B extends FileBox> {
|
|
57
|
+
candidates(spec: SandboxSpec, route: RouteOptions): Promise<{
|
|
58
|
+
provider: ProviderId;
|
|
59
|
+
skip?: string;
|
|
60
|
+
}[]>;
|
|
61
|
+
create(spec: SandboxSpec, route: RouteOptions): Promise<B>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Start a sandbox on another provider, copy the folder across, then kill the old one. If anything
|
|
65
|
+
* fails the new sandbox is killed and the old one is left as it was.
|
|
66
|
+
*/
|
|
67
|
+
export declare function moveSandbox<B extends FileBox>(mover: Mover<B>, from: FileBox, opts?: MoveOptions): Promise<B & {
|
|
68
|
+
moved: CopyResult;
|
|
69
|
+
}>;
|
package/dist/move.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { RouterError } from "./types.js";
|
|
3
|
+
import { shq } from "./util.js";
|
|
4
|
+
export const DEFAULT_COPY_MAX_BYTES = 1024 ** 3;
|
|
5
|
+
/** Shell startup files the destination keeps as its image made them when a working folder is copied whole (no `path`). */
|
|
6
|
+
const IMAGE_FILES = [".bashrc", ".bash_profile", ".bash_logout", ".profile", ".zshrc"];
|
|
7
|
+
const DEFAULT_CHUNK_BYTES = 4 * 1024 * 1024;
|
|
8
|
+
const DEFAULT_COPY_TIMEOUT_S = 600;
|
|
9
|
+
/**
|
|
10
|
+
* Copy a folder from one sandbox to another, on any two providers: packed with tar on the source,
|
|
11
|
+
* carried through this process in pieces, unpacked on the destination. Files, their modes and
|
|
12
|
+
* symlinks come across; running processes, memory and env vars don't. The source isn't changed.
|
|
13
|
+
* Both sandboxes need `tar` and `split` (every stock image has them).
|
|
14
|
+
*/
|
|
15
|
+
export async function copyFiles(from, to, opts = {}) {
|
|
16
|
+
const started = Date.now();
|
|
17
|
+
const timeoutSeconds = opts.timeoutSeconds ?? DEFAULT_COPY_TIMEOUT_S;
|
|
18
|
+
const chunk = Math.max(64 * 1024, Math.floor(opts.chunkBytes ?? DEFAULT_CHUNK_BYTES));
|
|
19
|
+
const maxBytes = opts.maxBytes ?? DEFAULT_COPY_MAX_BYTES;
|
|
20
|
+
const src = opts.path ?? (await workdir(from));
|
|
21
|
+
const dst = opts.to ?? opts.path ?? (await workdir(to));
|
|
22
|
+
for (const p of [src, dst]) {
|
|
23
|
+
if (!p.startsWith("/"))
|
|
24
|
+
throw new RouterError(`copy needs an absolute path, got "${p}"`, [], "bad_request");
|
|
25
|
+
if (p.replace(/\/+$/, "") === "")
|
|
26
|
+
throw new RouterError("copy won't take the whole filesystem (/): name a folder", [], "bad_request");
|
|
27
|
+
}
|
|
28
|
+
const tmp = `/tmp/sr-move-${randomUUID().slice(0, 8)}`;
|
|
29
|
+
const run = async (box, what, cmd) => {
|
|
30
|
+
const r = await box.exec(cmd, { timeoutSeconds });
|
|
31
|
+
if (r.exitCode !== 0) {
|
|
32
|
+
const detail = (r.stderr || r.stdout).trim().split("\n").slice(-3).join(" ");
|
|
33
|
+
throw new RouterError(`${what} failed on ${box.provider} (exit ${r.exitCode})${detail ? `: ${detail}` : ""}`, [], "all_failed");
|
|
34
|
+
}
|
|
35
|
+
return r.stdout;
|
|
36
|
+
};
|
|
37
|
+
const clean = (box) => box.exec(`rm -rf ${shq(tmp)}`, { timeoutSeconds: 60 }).catch(() => { });
|
|
38
|
+
try {
|
|
39
|
+
// The archive is written outside the folder where it can be, and excluded by name in case /tmp is inside it.
|
|
40
|
+
const excludes = ["sr-move-*", ...(opts.exclude ?? [])].map((e) => `--exclude=${shq(e)}`).join(" ");
|
|
41
|
+
const packed = await run(from, "packing the folder", [
|
|
42
|
+
`mkdir -p ${shq(tmp)}`,
|
|
43
|
+
`tar -czf ${shq(`${tmp}/a.tgz`)} ${excludes} -C ${shq(src)} .`,
|
|
44
|
+
`echo "size=$(wc -c < ${shq(`${tmp}/a.tgz`)} | tr -d ' ')"`,
|
|
45
|
+
].join(" && "));
|
|
46
|
+
const bytes = Number(/size=(\d+)/.exec(packed)?.[1] ?? NaN);
|
|
47
|
+
if (!Number.isFinite(bytes))
|
|
48
|
+
throw new RouterError(`couldn't read the packed size on ${from.provider}`, [], "all_failed");
|
|
49
|
+
if (bytes > maxBytes) {
|
|
50
|
+
throw new RouterError(`the folder packs to ${mb(bytes)}, over the ${mb(maxBytes)} limit: pass exclude (e.g. node_modules) or a higher maxBytes`, [], "bad_request");
|
|
51
|
+
}
|
|
52
|
+
const listed = await run(from, "splitting the archive", `cd ${shq(tmp)} && split -b ${chunk} -a 4 a.tgz p. && rm a.tgz && ls p.*`);
|
|
53
|
+
const parts = listed.split("\n").map((l) => l.trim()).filter((l) => /^p\.[a-z]{4}$/.test(l)).sort();
|
|
54
|
+
if (parts.length === 0)
|
|
55
|
+
throw new RouterError(`no archive pieces found on ${from.provider}`, [], "all_failed");
|
|
56
|
+
await run(to, "preparing the destination", `mkdir -p ${shq(tmp)} ${shq(dst)}`);
|
|
57
|
+
for (const part of parts)
|
|
58
|
+
await to.writeFile(`${tmp}/${part}`, await from.readFile(`${tmp}/${part}`));
|
|
59
|
+
// The size check catches a piece a provider cut short before tar unpacks half a folder.
|
|
60
|
+
const got = await run(to, "checking the archive", `cat ${shq(tmp)}/p.* | wc -c | tr -d ' '`);
|
|
61
|
+
if (Number(got.trim().split("\n").pop()) !== bytes) {
|
|
62
|
+
throw new RouterError(`the archive arrived as ${got.trim()} bytes on ${to.provider}, expected ${bytes}`, [], "all_failed");
|
|
63
|
+
}
|
|
64
|
+
// -o: the files belong to whoever runs the destination sandbox, not the source's user id.
|
|
65
|
+
// Copying a whole working folder would replace the destination image's shell startup files with
|
|
66
|
+
// the source image's (a different PATH, a different user): the destination's are put back after.
|
|
67
|
+
const keep = opts.path === undefined ? IMAGE_FILES.map(shq).join(" ") : "";
|
|
68
|
+
const save = keep ? `mkdir -p ${shq(`${tmp}/keep`)} && for f in ${keep}; do if [ -f ${shq(dst)}/"$f" ]; then cp -p ${shq(dst)}/"$f" ${shq(`${tmp}/keep`)}/; fi; done && ` : "";
|
|
69
|
+
const restore = keep ? ` && for f in ${keep}; do if [ -f ${shq(`${tmp}/keep`)}/"$f" ]; then cp -p ${shq(`${tmp}/keep`)}/"$f" ${shq(dst)}/; fi; done` : "";
|
|
70
|
+
await run(to, "unpacking the folder", `${save}cat ${shq(tmp)}/p.* | tar -xzo -f - -C ${shq(dst)}${restore}`);
|
|
71
|
+
return { from: src, to: dst, bytes, ms: Date.now() - started };
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
await Promise.all([clean(from), clean(to)]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Start a sandbox on another provider, copy the folder across, then kill the old one. If anything
|
|
79
|
+
* fails the new sandbox is killed and the old one is left as it was.
|
|
80
|
+
*/
|
|
81
|
+
export async function moveSandbox(mover, from, opts = {}) {
|
|
82
|
+
const { spec: given = {}, keep, path, to, exclude, maxBytes, timeoutSeconds, chunkBytes, ...route } = opts;
|
|
83
|
+
let spec = { ...given };
|
|
84
|
+
const elsewhere = async (s) => (await mover.candidates(s, route)).filter((c) => !c.skip && c.provider !== from.provider).map((c) => c.provider);
|
|
85
|
+
// The new sandbox keeps the old one's size. A provider's fixed default size (E2B's 2 vCPU / 0.5 GB)
|
|
86
|
+
// may be one nobody else sells, so when nothing else takes it the move goes ahead at the default size.
|
|
87
|
+
const sized = given.vcpu === undefined && given.memoryGb === undefined && from.size ? { ...given, vcpu: from.size.vcpu, memoryGb: from.size.memoryGb } : undefined;
|
|
88
|
+
if (route.provider !== undefined) {
|
|
89
|
+
if (sized && (await mover.candidates(sized, route)).some((c) => !c.skip))
|
|
90
|
+
spec = sized;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
// Without a named provider, "move" means somewhere else: the usual order, minus where it is now.
|
|
94
|
+
let list = sized ? await elsewhere(sized) : [];
|
|
95
|
+
if (list.length > 0)
|
|
96
|
+
spec = sized;
|
|
97
|
+
else
|
|
98
|
+
list = await elsewhere(spec);
|
|
99
|
+
if (list.length === 0)
|
|
100
|
+
throw new RouterError(`no other provider can take this sandbox (it is on ${from.provider})`, [], "no_provider");
|
|
101
|
+
route.provider = list;
|
|
102
|
+
}
|
|
103
|
+
const next = await mover.create(spec, route);
|
|
104
|
+
let moved;
|
|
105
|
+
try {
|
|
106
|
+
moved = await copyFiles(from, next, { path, to, exclude, maxBytes, timeoutSeconds, chunkBytes });
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
await next.kill().catch(() => { });
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
if (!keep)
|
|
113
|
+
await from.kill();
|
|
114
|
+
return Object.assign(next, { moved });
|
|
115
|
+
}
|
|
116
|
+
async function workdir(box) {
|
|
117
|
+
const r = await box.exec("pwd", { timeoutSeconds: 60 });
|
|
118
|
+
const dir = r.stdout.trim().split("\n").pop()?.trim() ?? "";
|
|
119
|
+
if (r.exitCode !== 0 || !dir.startsWith("/"))
|
|
120
|
+
throw new RouterError(`couldn't find the working folder on ${box.provider}: pass path`, [], "all_failed");
|
|
121
|
+
return dir;
|
|
122
|
+
}
|
|
123
|
+
const mb = (n) => `${(n / 1024 / 1024).toFixed(n < 10 * 1024 * 1024 ? 1 : 0)} MB`;
|
package/dist/published.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const PUBLISHED = {
|
|
2
2
|
"schema": 1,
|
|
3
|
-
"dataThrough": "2026-11-
|
|
3
|
+
"dataThrough": "2026-11-18T22:34:03.877Z",
|
|
4
4
|
"conditionalStartFees": {
|
|
5
5
|
"boat": {
|
|
6
6
|
"minUsd": 0.03,
|
|
@@ -64,29 +64,18 @@ export const PUBLISHED = {
|
|
|
64
64
|
"hourlyUsd": 0.16449999999999998,
|
|
65
65
|
"measuredAt": "2026-11-11T21:29:12.572Z"
|
|
66
66
|
},
|
|
67
|
-
"e2b": {
|
|
68
|
-
"name": "E2B",
|
|
69
|
-
"size": {
|
|
70
|
-
"vcpu": 2,
|
|
71
|
-
"memoryGb": 0.5
|
|
72
|
-
},
|
|
73
|
-
"medianCreateMs": 326,
|
|
74
|
-
"successRate": 1,
|
|
75
|
-
"runs": 105,
|
|
76
|
-
"hourlyUsd": 0.1089,
|
|
77
|
-
"measuredAt": "2026-11-17T16:19:15.367Z"
|
|
78
|
-
},
|
|
79
67
|
"openscale": {
|
|
80
68
|
"name": "OpenScale Sandboxes",
|
|
81
69
|
"size": {
|
|
82
70
|
"vcpu": 2,
|
|
83
|
-
"memoryGb":
|
|
71
|
+
"memoryGb": 4
|
|
84
72
|
},
|
|
85
|
-
"medianCreateMs":
|
|
73
|
+
"medianCreateMs": 323,
|
|
74
|
+
"medianReadyMs": 1290,
|
|
86
75
|
"successRate": 1,
|
|
87
|
-
"runs":
|
|
88
|
-
"hourlyUsd": 0.
|
|
89
|
-
"measuredAt": "2026-11-
|
|
76
|
+
"runs": 100,
|
|
77
|
+
"hourlyUsd": 0.017,
|
|
78
|
+
"measuredAt": "2026-11-18T22:34:03.877Z"
|
|
90
79
|
},
|
|
91
80
|
"vercel": {
|
|
92
81
|
"name": "Vercel Sandbox",
|
|
@@ -100,18 +89,6 @@ export const PUBLISHED = {
|
|
|
100
89
|
"hourlyUsd": 0.3408,
|
|
101
90
|
"measuredAt": "2026-11-17T16:19:15.367Z"
|
|
102
91
|
},
|
|
103
|
-
"daytona": {
|
|
104
|
-
"name": "Daytona",
|
|
105
|
-
"size": {
|
|
106
|
-
"vcpu": 1,
|
|
107
|
-
"memoryGb": 1
|
|
108
|
-
},
|
|
109
|
-
"medianCreateMs": 369,
|
|
110
|
-
"successRate": 1,
|
|
111
|
-
"runs": 105,
|
|
112
|
-
"hourlyUsd": 0.06659999999999999,
|
|
113
|
-
"measuredAt": "2026-11-17T16:19:15.367Z"
|
|
114
|
-
},
|
|
115
92
|
"cloudflare": {
|
|
116
93
|
"name": "Cloudflare Sandbox",
|
|
117
94
|
"size": {
|
|
@@ -136,6 +113,19 @@ export const PUBLISHED = {
|
|
|
136
113
|
"hourlyUsd": 0.23796,
|
|
137
114
|
"measuredAt": "2026-11-17T16:19:15.367Z"
|
|
138
115
|
},
|
|
116
|
+
"e2b": {
|
|
117
|
+
"name": "E2B",
|
|
118
|
+
"size": {
|
|
119
|
+
"vcpu": 2,
|
|
120
|
+
"memoryGb": 4
|
|
121
|
+
},
|
|
122
|
+
"medianCreateMs": 559,
|
|
123
|
+
"medianReadyMs": 953,
|
|
124
|
+
"successRate": 1,
|
|
125
|
+
"runs": 100,
|
|
126
|
+
"hourlyUsd": 0.1656,
|
|
127
|
+
"measuredAt": "2026-11-18T22:34:03.877Z"
|
|
128
|
+
},
|
|
139
129
|
"agent37": {
|
|
140
130
|
"name": "Agent37",
|
|
141
131
|
"size": {
|
|
@@ -172,6 +162,19 @@ export const PUBLISHED = {
|
|
|
172
162
|
"hourlyUsd": 0.022,
|
|
173
163
|
"measuredAt": "2026-11-17T16:19:15.367Z"
|
|
174
164
|
},
|
|
165
|
+
"daytona": {
|
|
166
|
+
"name": "Daytona",
|
|
167
|
+
"size": {
|
|
168
|
+
"vcpu": 2,
|
|
169
|
+
"memoryGb": 4
|
|
170
|
+
},
|
|
171
|
+
"medianCreateMs": 1200,
|
|
172
|
+
"medianReadyMs": 1619,
|
|
173
|
+
"successRate": 1,
|
|
174
|
+
"runs": 100,
|
|
175
|
+
"hourlyUsd": 0.1656,
|
|
176
|
+
"measuredAt": "2026-11-18T22:34:03.877Z"
|
|
177
|
+
},
|
|
175
178
|
"morph": {
|
|
176
179
|
"name": "Morph Cloud",
|
|
177
180
|
"size": {
|
|
@@ -284,7 +287,7 @@ export const PUBLISHED = {
|
|
|
284
287
|
"taskMs": 987,
|
|
285
288
|
"taskUsd": 0.000014999999999999999,
|
|
286
289
|
"reusedUsd": 0.000004934999999999999,
|
|
287
|
-
"successRate":
|
|
290
|
+
"successRate": 1,
|
|
288
291
|
"runs": 3,
|
|
289
292
|
"ok": 2,
|
|
290
293
|
"limited": 1,
|
|
@@ -1748,6 +1751,10 @@ export const PUBLISHED = {
|
|
|
1748
1751
|
"n": 10,
|
|
1749
1752
|
"ok": 10,
|
|
1750
1753
|
"limited": 0,
|
|
1754
|
+
"size": {
|
|
1755
|
+
"vcpu": 2,
|
|
1756
|
+
"memoryGb": 4
|
|
1757
|
+
},
|
|
1751
1758
|
"p50Ms": 993,
|
|
1752
1759
|
"p99Ms": 1372,
|
|
1753
1760
|
"wallMs": 1372,
|
|
@@ -1759,6 +1766,10 @@ export const PUBLISHED = {
|
|
|
1759
1766
|
"n": 10,
|
|
1760
1767
|
"ok": 10,
|
|
1761
1768
|
"limited": 0,
|
|
1769
|
+
"size": {
|
|
1770
|
+
"vcpu": 1,
|
|
1771
|
+
"memoryGb": 1
|
|
1772
|
+
},
|
|
1762
1773
|
"p50Ms": 1479,
|
|
1763
1774
|
"p99Ms": 1590,
|
|
1764
1775
|
"wallMs": 1590,
|
|
@@ -1770,6 +1781,10 @@ export const PUBLISHED = {
|
|
|
1770
1781
|
"n": 10,
|
|
1771
1782
|
"ok": 10,
|
|
1772
1783
|
"limited": 0,
|
|
1784
|
+
"size": {
|
|
1785
|
+
"vcpu": 2,
|
|
1786
|
+
"memoryGb": 4
|
|
1787
|
+
},
|
|
1773
1788
|
"p50Ms": 1482,
|
|
1774
1789
|
"p99Ms": 1666,
|
|
1775
1790
|
"wallMs": 1666,
|
|
@@ -1781,6 +1796,10 @@ export const PUBLISHED = {
|
|
|
1781
1796
|
"n": 10,
|
|
1782
1797
|
"ok": 10,
|
|
1783
1798
|
"limited": 0,
|
|
1799
|
+
"size": {
|
|
1800
|
+
"vcpu": 2,
|
|
1801
|
+
"memoryGb": 4
|
|
1802
|
+
},
|
|
1784
1803
|
"p50Ms": 1549,
|
|
1785
1804
|
"p99Ms": 2311,
|
|
1786
1805
|
"wallMs": 2311,
|
|
@@ -1792,6 +1811,10 @@ export const PUBLISHED = {
|
|
|
1792
1811
|
"n": 10,
|
|
1793
1812
|
"ok": 10,
|
|
1794
1813
|
"limited": 0,
|
|
1814
|
+
"size": {
|
|
1815
|
+
"vcpu": 2,
|
|
1816
|
+
"memoryGb": 4
|
|
1817
|
+
},
|
|
1795
1818
|
"p50Ms": 1655,
|
|
1796
1819
|
"p99Ms": 3157,
|
|
1797
1820
|
"wallMs": 3157,
|
|
@@ -1803,6 +1826,10 @@ export const PUBLISHED = {
|
|
|
1803
1826
|
"n": 10,
|
|
1804
1827
|
"ok": 10,
|
|
1805
1828
|
"limited": 0,
|
|
1829
|
+
"size": {
|
|
1830
|
+
"vcpu": 2,
|
|
1831
|
+
"memoryGb": 4
|
|
1832
|
+
},
|
|
1806
1833
|
"p50Ms": 1834,
|
|
1807
1834
|
"p99Ms": 3535,
|
|
1808
1835
|
"wallMs": 3535,
|
|
@@ -1814,6 +1841,10 @@ export const PUBLISHED = {
|
|
|
1814
1841
|
"n": 10,
|
|
1815
1842
|
"ok": 10,
|
|
1816
1843
|
"limited": 0,
|
|
1844
|
+
"size": {
|
|
1845
|
+
"vcpu": 2,
|
|
1846
|
+
"memoryGb": 4
|
|
1847
|
+
},
|
|
1817
1848
|
"p50Ms": 2073,
|
|
1818
1849
|
"p99Ms": 3086,
|
|
1819
1850
|
"wallMs": 3086,
|
|
@@ -1825,6 +1856,10 @@ export const PUBLISHED = {
|
|
|
1825
1856
|
"n": 10,
|
|
1826
1857
|
"ok": 10,
|
|
1827
1858
|
"limited": 0,
|
|
1859
|
+
"size": {
|
|
1860
|
+
"vcpu": 2,
|
|
1861
|
+
"memoryGb": 0.5
|
|
1862
|
+
},
|
|
1828
1863
|
"p50Ms": 2103,
|
|
1829
1864
|
"p99Ms": 2119,
|
|
1830
1865
|
"wallMs": 2119,
|
|
@@ -1836,6 +1871,10 @@ export const PUBLISHED = {
|
|
|
1836
1871
|
"n": 10,
|
|
1837
1872
|
"ok": 10,
|
|
1838
1873
|
"limited": 0,
|
|
1874
|
+
"size": {
|
|
1875
|
+
"vcpu": 2,
|
|
1876
|
+
"memoryGb": 4
|
|
1877
|
+
},
|
|
1839
1878
|
"p50Ms": 2265,
|
|
1840
1879
|
"p99Ms": 3639,
|
|
1841
1880
|
"wallMs": 3639,
|
|
@@ -1847,6 +1886,10 @@ export const PUBLISHED = {
|
|
|
1847
1886
|
"n": 10,
|
|
1848
1887
|
"ok": 10,
|
|
1849
1888
|
"limited": 0,
|
|
1889
|
+
"size": {
|
|
1890
|
+
"vcpu": 2,
|
|
1891
|
+
"memoryGb": 4
|
|
1892
|
+
},
|
|
1850
1893
|
"p50Ms": 2964,
|
|
1851
1894
|
"p99Ms": 3874,
|
|
1852
1895
|
"wallMs": 3874,
|
|
@@ -1858,6 +1901,10 @@ export const PUBLISHED = {
|
|
|
1858
1901
|
"n": 10,
|
|
1859
1902
|
"ok": 10,
|
|
1860
1903
|
"limited": 0,
|
|
1904
|
+
"size": {
|
|
1905
|
+
"vcpu": 2,
|
|
1906
|
+
"memoryGb": 4
|
|
1907
|
+
},
|
|
1861
1908
|
"p50Ms": 4036,
|
|
1862
1909
|
"p99Ms": 4332,
|
|
1863
1910
|
"wallMs": 4332,
|
|
@@ -1869,6 +1916,10 @@ export const PUBLISHED = {
|
|
|
1869
1916
|
"n": 10,
|
|
1870
1917
|
"ok": 10,
|
|
1871
1918
|
"limited": 0,
|
|
1919
|
+
"size": {
|
|
1920
|
+
"vcpu": 2,
|
|
1921
|
+
"memoryGb": 1
|
|
1922
|
+
},
|
|
1872
1923
|
"p50Ms": 18892,
|
|
1873
1924
|
"p99Ms": 19600,
|
|
1874
1925
|
"wallMs": 19600,
|
|
@@ -1880,6 +1931,10 @@ export const PUBLISHED = {
|
|
|
1880
1931
|
"n": 10,
|
|
1881
1932
|
"ok": 8,
|
|
1882
1933
|
"limited": 0,
|
|
1934
|
+
"size": {
|
|
1935
|
+
"vcpu": 2,
|
|
1936
|
+
"memoryGb": 4
|
|
1937
|
+
},
|
|
1883
1938
|
"p50Ms": 2669,
|
|
1884
1939
|
"p99Ms": 4339,
|
|
1885
1940
|
"wallMs": 12345,
|
|
@@ -1891,6 +1946,10 @@ export const PUBLISHED = {
|
|
|
1891
1946
|
"n": 10,
|
|
1892
1947
|
"ok": 2,
|
|
1893
1948
|
"limited": 8,
|
|
1949
|
+
"size": {
|
|
1950
|
+
"vcpu": 2,
|
|
1951
|
+
"memoryGb": 4
|
|
1952
|
+
},
|
|
1894
1953
|
"p50Ms": 3077,
|
|
1895
1954
|
"p99Ms": 4545,
|
|
1896
1955
|
"wallMs": 4545,
|
|
@@ -1902,6 +1961,10 @@ export const PUBLISHED = {
|
|
|
1902
1961
|
"n": 10,
|
|
1903
1962
|
"ok": 0,
|
|
1904
1963
|
"limited": 10,
|
|
1964
|
+
"size": {
|
|
1965
|
+
"vcpu": 2,
|
|
1966
|
+
"memoryGb": 4
|
|
1967
|
+
},
|
|
1905
1968
|
"wallMs": 1694,
|
|
1906
1969
|
"measuredAt": "2026-11-17T18:33:05.397Z"
|
|
1907
1970
|
},
|
|
@@ -1910,6 +1973,10 @@ export const PUBLISHED = {
|
|
|
1910
1973
|
"n": 10,
|
|
1911
1974
|
"ok": 0,
|
|
1912
1975
|
"limited": 10,
|
|
1976
|
+
"size": {
|
|
1977
|
+
"vcpu": 2,
|
|
1978
|
+
"memoryGb": 4
|
|
1979
|
+
},
|
|
1913
1980
|
"wallMs": 3573,
|
|
1914
1981
|
"measuredAt": "2026-11-17T18:33:05.397Z"
|
|
1915
1982
|
}
|
|
@@ -1949,6 +2016,10 @@ export const PUBLISHED = {
|
|
|
1949
2016
|
"n": 100,
|
|
1950
2017
|
"ok": 100,
|
|
1951
2018
|
"limited": 0,
|
|
2019
|
+
"size": {
|
|
2020
|
+
"vcpu": 2,
|
|
2021
|
+
"memoryGb": 4
|
|
2022
|
+
},
|
|
1952
2023
|
"p50Ms": 1053,
|
|
1953
2024
|
"p99Ms": 5563,
|
|
1954
2025
|
"wallMs": 5860,
|
|
@@ -1960,6 +2031,10 @@ export const PUBLISHED = {
|
|
|
1960
2031
|
"n": 100,
|
|
1961
2032
|
"ok": 100,
|
|
1962
2033
|
"limited": 0,
|
|
2034
|
+
"size": {
|
|
2035
|
+
"vcpu": 2,
|
|
2036
|
+
"memoryGb": 4
|
|
2037
|
+
},
|
|
1963
2038
|
"p50Ms": 1521,
|
|
1964
2039
|
"p99Ms": 2034,
|
|
1965
2040
|
"wallMs": 2094,
|
|
@@ -1971,6 +2046,10 @@ export const PUBLISHED = {
|
|
|
1971
2046
|
"n": 100,
|
|
1972
2047
|
"ok": 100,
|
|
1973
2048
|
"limited": 0,
|
|
2049
|
+
"size": {
|
|
2050
|
+
"vcpu": 2,
|
|
2051
|
+
"memoryGb": 4
|
|
2052
|
+
},
|
|
1974
2053
|
"p50Ms": 2079,
|
|
1975
2054
|
"p99Ms": 2671,
|
|
1976
2055
|
"wallMs": 2672,
|
|
@@ -1982,6 +2061,10 @@ export const PUBLISHED = {
|
|
|
1982
2061
|
"n": 100,
|
|
1983
2062
|
"ok": 100,
|
|
1984
2063
|
"limited": 0,
|
|
2064
|
+
"size": {
|
|
2065
|
+
"vcpu": 2,
|
|
2066
|
+
"memoryGb": 4
|
|
2067
|
+
},
|
|
1985
2068
|
"p50Ms": 2314,
|
|
1986
2069
|
"p99Ms": 2862,
|
|
1987
2070
|
"wallMs": 2890,
|
|
@@ -1993,6 +2076,10 @@ export const PUBLISHED = {
|
|
|
1993
2076
|
"n": 100,
|
|
1994
2077
|
"ok": 100,
|
|
1995
2078
|
"limited": 0,
|
|
2079
|
+
"size": {
|
|
2080
|
+
"vcpu": 2,
|
|
2081
|
+
"memoryGb": 4
|
|
2082
|
+
},
|
|
1996
2083
|
"p50Ms": 4349,
|
|
1997
2084
|
"p99Ms": 7210,
|
|
1998
2085
|
"wallMs": 7539,
|
|
@@ -2004,6 +2091,10 @@ export const PUBLISHED = {
|
|
|
2004
2091
|
"n": 100,
|
|
2005
2092
|
"ok": 100,
|
|
2006
2093
|
"limited": 0,
|
|
2094
|
+
"size": {
|
|
2095
|
+
"vcpu": 2,
|
|
2096
|
+
"memoryGb": 4
|
|
2097
|
+
},
|
|
2007
2098
|
"p50Ms": 4465,
|
|
2008
2099
|
"p99Ms": 4956,
|
|
2009
2100
|
"wallMs": 5168,
|
|
@@ -2015,6 +2106,10 @@ export const PUBLISHED = {
|
|
|
2015
2106
|
"n": 100,
|
|
2016
2107
|
"ok": 100,
|
|
2017
2108
|
"limited": 0,
|
|
2109
|
+
"size": {
|
|
2110
|
+
"vcpu": 2,
|
|
2111
|
+
"memoryGb": 1
|
|
2112
|
+
},
|
|
2018
2113
|
"p50Ms": 5615,
|
|
2019
2114
|
"p99Ms": 6504,
|
|
2020
2115
|
"wallMs": 6507,
|
|
@@ -2026,6 +2121,10 @@ export const PUBLISHED = {
|
|
|
2026
2121
|
"n": 100,
|
|
2027
2122
|
"ok": 83,
|
|
2028
2123
|
"limited": 17,
|
|
2124
|
+
"size": {
|
|
2125
|
+
"vcpu": 2,
|
|
2126
|
+
"memoryGb": 4
|
|
2127
|
+
},
|
|
2029
2128
|
"p50Ms": 1312,
|
|
2030
2129
|
"p99Ms": 6738,
|
|
2031
2130
|
"wallMs": 7050,
|
|
@@ -2037,6 +2136,10 @@ export const PUBLISHED = {
|
|
|
2037
2136
|
"n": 100,
|
|
2038
2137
|
"ok": 65,
|
|
2039
2138
|
"limited": 35,
|
|
2139
|
+
"size": {
|
|
2140
|
+
"vcpu": 2,
|
|
2141
|
+
"memoryGb": 4
|
|
2142
|
+
},
|
|
2040
2143
|
"p50Ms": 6417,
|
|
2041
2144
|
"p99Ms": 8834,
|
|
2042
2145
|
"wallMs": 10028,
|
|
@@ -2048,6 +2151,10 @@ export const PUBLISHED = {
|
|
|
2048
2151
|
"n": 100,
|
|
2049
2152
|
"ok": 52,
|
|
2050
2153
|
"limited": 48,
|
|
2154
|
+
"size": {
|
|
2155
|
+
"vcpu": 2,
|
|
2156
|
+
"memoryGb": 0.5
|
|
2157
|
+
},
|
|
2051
2158
|
"p50Ms": 1396,
|
|
2052
2159
|
"p99Ms": 2252,
|
|
2053
2160
|
"wallMs": 2252,
|
|
@@ -2059,6 +2166,10 @@ export const PUBLISHED = {
|
|
|
2059
2166
|
"n": 100,
|
|
2060
2167
|
"ok": 46,
|
|
2061
2168
|
"limited": 54,
|
|
2169
|
+
"size": {
|
|
2170
|
+
"vcpu": 2,
|
|
2171
|
+
"memoryGb": 4
|
|
2172
|
+
},
|
|
2062
2173
|
"p50Ms": 4436,
|
|
2063
2174
|
"p99Ms": 8357,
|
|
2064
2175
|
"wallMs": 8357,
|
|
@@ -2070,6 +2181,10 @@ export const PUBLISHED = {
|
|
|
2070
2181
|
"n": 100,
|
|
2071
2182
|
"ok": 34,
|
|
2072
2183
|
"limited": 66,
|
|
2184
|
+
"size": {
|
|
2185
|
+
"vcpu": 2,
|
|
2186
|
+
"memoryGb": 4
|
|
2187
|
+
},
|
|
2073
2188
|
"p50Ms": 2791,
|
|
2074
2189
|
"p99Ms": 7854,
|
|
2075
2190
|
"wallMs": 7854,
|
|
@@ -2081,6 +2196,10 @@ export const PUBLISHED = {
|
|
|
2081
2196
|
"n": 100,
|
|
2082
2197
|
"ok": 10,
|
|
2083
2198
|
"limited": 90,
|
|
2199
|
+
"size": {
|
|
2200
|
+
"vcpu": 1,
|
|
2201
|
+
"memoryGb": 1
|
|
2202
|
+
},
|
|
2084
2203
|
"p50Ms": 1374,
|
|
2085
2204
|
"p99Ms": 2002,
|
|
2086
2205
|
"wallMs": 2002,
|
|
@@ -2092,6 +2211,10 @@ export const PUBLISHED = {
|
|
|
2092
2211
|
"n": 100,
|
|
2093
2212
|
"ok": 2,
|
|
2094
2213
|
"limited": 98,
|
|
2214
|
+
"size": {
|
|
2215
|
+
"vcpu": 2,
|
|
2216
|
+
"memoryGb": 4
|
|
2217
|
+
},
|
|
2095
2218
|
"p50Ms": 3992,
|
|
2096
2219
|
"p99Ms": 4001,
|
|
2097
2220
|
"wallMs": 4001,
|
package/dist/router.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ProviderInfo } from "./catalog.js";
|
|
2
2
|
import { type ComputerRoute, RoutedComputer, type ComputerOs, type ComputerProvider, type ComputerProviderId, type ComputerSpec } from "./computers.js";
|
|
3
3
|
import { Ledger } from "./ledger.js";
|
|
4
|
+
import { type CopyOptions, type CopyResult, type FileBox, type MoveOptions } from "./move.js";
|
|
4
5
|
import { type Attempt, type ExecOptions, type ExecResult, type Provider, type ProviderId, type ProviderSandbox, type RouteOptions, type SandboxProcess, type SandboxSpec, type StartOptions } from "./types.js";
|
|
5
6
|
/** vCPUs and memory a sandbox gets. */
|
|
6
7
|
export interface Size {
|
|
@@ -227,6 +228,23 @@ export declare class Router {
|
|
|
227
228
|
/** Start a desktop or phone, routed like a sandbox (see createComputer). */
|
|
228
229
|
computer(spec?: ComputerSpec, route?: ComputerRoute): Promise<RoutedComputer>;
|
|
229
230
|
getComputer(id: string): Promise<RoutedComputer>;
|
|
231
|
+
/**
|
|
232
|
+
* Copy a folder from one sandbox to another, on any two providers. Files only: running processes,
|
|
233
|
+
* memory and env vars stay behind. See `CopyOptions`.
|
|
234
|
+
*/
|
|
235
|
+
copy(from: FileBox, to: FileBox, opts?: CopyOptions): Promise<CopyResult>;
|
|
236
|
+
/**
|
|
237
|
+
* Move a sandbox's folder to a new sandbox and kill the old one: on another provider by default,
|
|
238
|
+
* or on the ones `provider` names. The new sandbox keeps the old one's size where another provider
|
|
239
|
+
* sells it, else the default size. If the new one can't
|
|
240
|
+
* start or the copy fails, the old sandbox is left running and untouched.
|
|
241
|
+
*
|
|
242
|
+
* sbx = await router.move(sbx); // next-best provider
|
|
243
|
+
* sbx = await router.move(sbx, { provider: "e2b", path: "/workspace", exclude: ["node_modules"] });
|
|
244
|
+
*/
|
|
245
|
+
move(from: FileBox, opts?: MoveOptions): Promise<RoutedSandbox & {
|
|
246
|
+
moved: CopyResult;
|
|
247
|
+
}>;
|
|
230
248
|
/** Reattach to a sandbox by its routed id (`provider:nativeId`). */
|
|
231
249
|
get(id: string): Promise<RoutedSandbox>;
|
|
232
250
|
}
|
package/dist/router.js
CHANGED
|
@@ -5,6 +5,7 @@ import { loadBench, median } from "./bench-store.js";
|
|
|
5
5
|
import { PUBLISHED } from "./published.js";
|
|
6
6
|
import { Ledger, defaultLedgerFile } from "./ledger.js";
|
|
7
7
|
import { DEFAULT_EXEC_TIMEOUT_S, LIMIT_ERROR, SETUP_ERRORS, errorStatus, timeoutError, withDeadline } from "./util.js";
|
|
8
|
+
import { copyFiles, moveSandbox } from "./move.js";
|
|
8
9
|
import { BILLED_VS_LIST } from "./billing.js";
|
|
9
10
|
import { FAILING, VERIFIED } from "./verified.js";
|
|
10
11
|
import { isPort, validate, validateStart } from "./validate.js";
|
|
@@ -471,6 +472,25 @@ export class Router {
|
|
|
471
472
|
const e = this.ledger?.list().find((x) => x.id === id);
|
|
472
473
|
return new RoutedComputer(provider, await p.connectComputer(id.slice(i + 1)), [], e?.usdHour, this.ledger);
|
|
473
474
|
}
|
|
475
|
+
/**
|
|
476
|
+
* Copy a folder from one sandbox to another, on any two providers. Files only: running processes,
|
|
477
|
+
* memory and env vars stay behind. See `CopyOptions`.
|
|
478
|
+
*/
|
|
479
|
+
copy(from, to, opts = {}) {
|
|
480
|
+
return copyFiles(from, to, opts);
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Move a sandbox's folder to a new sandbox and kill the old one: on another provider by default,
|
|
484
|
+
* or on the ones `provider` names. The new sandbox keeps the old one's size where another provider
|
|
485
|
+
* sells it, else the default size. If the new one can't
|
|
486
|
+
* start or the copy fails, the old sandbox is left running and untouched.
|
|
487
|
+
*
|
|
488
|
+
* sbx = await router.move(sbx); // next-best provider
|
|
489
|
+
* sbx = await router.move(sbx, { provider: "e2b", path: "/workspace", exclude: ["node_modules"] });
|
|
490
|
+
*/
|
|
491
|
+
move(from, opts = {}) {
|
|
492
|
+
return moveSandbox({ candidates: async (spec, route) => this.plan(spec, route), create: (spec, route) => this.create(spec, route) }, from, opts);
|
|
493
|
+
}
|
|
474
494
|
/** Reattach to a sandbox by its routed id (`provider:nativeId`). */
|
|
475
495
|
async get(id) {
|
|
476
496
|
const { provider, nativeId } = parseId(id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sandboxrouter/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "One API for every sandbox provider: route AI agents' code by price, speed or capability, with automatic fallback. Free and open source.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -184,14 +184,14 @@
|
|
|
184
184
|
"@e2b/desktop": "^2.5.0",
|
|
185
185
|
"@fly/sprites": "^0.2.4",
|
|
186
186
|
"@hopx-ai/sdk": "^0.5.1",
|
|
187
|
-
"@limrun/api": "^0.
|
|
187
|
+
"@limrun/api": "^0.73.2",
|
|
188
188
|
"@mobilerun/sdk": "^6.1.0",
|
|
189
189
|
"@northflank/js-client": "^0.12.0",
|
|
190
190
|
"@runloop/api-client": "^3.0.0",
|
|
191
191
|
"@smithy/signature-v4": "^5.7.5",
|
|
192
192
|
"@tensorlakeai/tensorlake": "^0.5.161",
|
|
193
193
|
"@types/node": "^26.6.6",
|
|
194
|
-
"@vercel/sandbox": "^
|
|
194
|
+
"@vercel/sandbox": "^4.0.0",
|
|
195
195
|
"e2b": "^2.63.0",
|
|
196
196
|
"modal": "^0.11.1",
|
|
197
197
|
"morphcloud": "^0.0.20",
|