withruntime 0.33.3 → 0.35.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/E2B.md +7 -0
- package/dist/agents-cli.d.ts +1 -1
- package/dist/agents-cli.js +171 -7
- package/dist/agents-deploy.d.ts +13 -3
- package/dist/agents-deploy.js +68 -9
- package/dist/apps-cli.d.ts +1 -1
- package/dist/apps-cli.js +41 -9
- package/dist/browsers/index.d.ts +9 -0
- package/dist/browsers/index.js +10 -0
- package/dist/browsers-cli.d.ts +13 -0
- package/dist/browsers-cli.js +160 -0
- package/dist/ci-cli.d.ts +1 -1
- package/dist/ci-cli.js +16 -3
- package/dist/cli-words.js +1 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.js +103 -12
- package/dist/desktops/index.d.ts +9 -0
- package/dist/desktops/index.js +10 -0
- package/dist/e2b/code-interpreter.d.ts +3 -12
- package/dist/e2b/code-interpreter.js +3 -6
- package/dist/e2b/index.d.ts +7 -1
- package/dist/e2b/index.js +9 -2
- package/dist/functions/index.d.ts +10 -0
- package/dist/functions/index.js +11 -0
- package/dist/index.d.ts +5 -3
- package/dist/products/agents.d.ts +162 -8
- package/dist/products/agents.js +108 -3
- package/dist/products/apps.d.ts +46 -5
- package/dist/products/browsers.d.ts +26 -0
- package/dist/products/browsers.js +11 -0
- package/dist/products/ci.d.ts +10 -4
- package/dist/products/ci.js +8 -0
- package/dist/products/desktops.d.ts +71 -0
- package/dist/products/desktops.js +27 -0
- package/dist/products/functions.d.ts +2 -0
- package/dist/products/functions.js +5 -0
- package/dist/products/index.d.ts +6 -0
- package/dist/products/index.js +8 -0
- package/dist/products/network.d.ts +4 -2
- package/dist/products/secrets.d.ts +10 -2
- package/dist/products/secrets.js +27 -7
- package/dist/products/uptime.d.ts +97 -0
- package/dist/products/uptime.js +42 -0
- package/dist/products/volumes.d.ts +41 -9
- package/dist/products/volumes.js +5 -2
- package/dist/transport.d.ts +4 -1
- package/dist/transport.js +2 -2
- package/dist/types.d.ts +15 -3
- package/package.json +17 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { enc, resource } from "./resources.js";
|
|
2
|
+
/** A wait ends at its target or at one of these, with the desktop's error. */
|
|
3
|
+
const SETTLED = ["failed", "deleted"];
|
|
4
|
+
export function desktops(t) {
|
|
5
|
+
return {
|
|
6
|
+
...resource(t, "desktops", SETTLED),
|
|
7
|
+
/** The screen as PNG (or JPEG) bytes. A write: it runs in the desktop's
|
|
8
|
+
* sandbox and wakes a paused one, so a read-only key is refused it. */
|
|
9
|
+
screenshot(id, shot = {}, options) {
|
|
10
|
+
return t.bytes({
|
|
11
|
+
method: "POST",
|
|
12
|
+
path: `/v1/desktops/${enc(id)}:screenshot`,
|
|
13
|
+
body: shot,
|
|
14
|
+
...options,
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
/** Move, click, drag, scroll, type, press keys, open a URL or launch a program. */
|
|
18
|
+
act(id, step, options) {
|
|
19
|
+
return t.json({
|
|
20
|
+
method: "POST",
|
|
21
|
+
path: `/v1/desktops/${enc(id)}:act`,
|
|
22
|
+
body: step,
|
|
23
|
+
...options,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* runtime.functions: Apps whose copies all sleep when idle, on the same
|
|
2
|
+
* calls under /v1/functions (apps.ts holds both kinds). A private beta
|
|
3
|
+
* (PRODUCT_BETAS): an account outside it is refused with product_in_beta
|
|
4
|
+
* until Functions launches. */
|
|
5
|
+
export { functions } from "./apps.js";
|
package/dist/products/index.d.ts
CHANGED
|
@@ -27,7 +27,10 @@ import { agents } from "./agents.js";
|
|
|
27
27
|
import { builds } from "./builds.js";
|
|
28
28
|
import { ci } from "./ci.js";
|
|
29
29
|
import { containers } from "./containers.js";
|
|
30
|
+
import { browsers } from "./browsers.js";
|
|
31
|
+
import { desktops } from "./desktops.js";
|
|
30
32
|
import { apps } from "./apps.js";
|
|
33
|
+
import { functions } from "./functions.js";
|
|
31
34
|
export declare const clientExtensions: {
|
|
32
35
|
images: typeof images;
|
|
33
36
|
volumes: typeof volumes;
|
|
@@ -54,7 +57,10 @@ export declare const clientExtensions: {
|
|
|
54
57
|
builds: typeof builds;
|
|
55
58
|
ci: typeof ci;
|
|
56
59
|
containers: typeof containers;
|
|
60
|
+
browsers: typeof browsers;
|
|
61
|
+
desktops: typeof desktops;
|
|
57
62
|
apps: typeof apps;
|
|
63
|
+
functions: typeof functions;
|
|
58
64
|
};
|
|
59
65
|
export declare const sandboxExtensions: {
|
|
60
66
|
interpreter: typeof sandboxInterpreter;
|
package/dist/products/index.js
CHANGED
|
@@ -25,11 +25,14 @@ import { agents } from "./agents.js";
|
|
|
25
25
|
import { builds } from "./builds.js";
|
|
26
26
|
import { ci } from "./ci.js";
|
|
27
27
|
import { containers } from "./containers.js";
|
|
28
|
+
import { browsers } from "./browsers.js";
|
|
29
|
+
import { desktops } from "./desktops.js";
|
|
28
30
|
// The hub loads this file, so it loads apps.ts and resources.ts too: request
|
|
29
31
|
// builders over Transport whose top level holds only types, functions and
|
|
30
32
|
// imports of files the hub loads, so importing them runs nothing in the hub
|
|
31
33
|
// (agents/hub-sdk-products.test.ts parses every product file the hub loads).
|
|
32
34
|
import { apps } from "./apps.js";
|
|
35
|
+
import { functions } from "./functions.js";
|
|
33
36
|
/* HOW A LANE ADDS A PRODUCT TO THE SDK
|
|
34
37
|
*
|
|
35
38
|
* 1. Write src/products/<name>.ts exporting a factory:
|
|
@@ -73,9 +76,14 @@ export const clientExtensions = {
|
|
|
73
76
|
// CI/CD (beta): the API answers product_in_beta outside its list.
|
|
74
77
|
ci,
|
|
75
78
|
containers,
|
|
79
|
+
// Browsers and Desktops (beta): the API answers product_in_beta outside its list.
|
|
80
|
+
browsers,
|
|
81
|
+
desktops,
|
|
76
82
|
// A private beta (PRODUCT_BETAS): an account outside it is refused with
|
|
77
83
|
// product_in_beta until Apps launches.
|
|
78
84
|
apps,
|
|
85
|
+
// The same until Functions launches.
|
|
86
|
+
functions,
|
|
79
87
|
};
|
|
80
88
|
export const sandboxExtensions = {
|
|
81
89
|
interpreter: sandboxInterpreter,
|
|
@@ -2,9 +2,11 @@ import type { Sandbox } from "../sandbox.js";
|
|
|
2
2
|
import type { RequestOptions, Transport } from "../transport.js";
|
|
3
3
|
/** A sandbox's own network rules. */
|
|
4
4
|
export type NetworkRules = {
|
|
5
|
-
/** false refuses every outbound connection
|
|
5
|
+
/** false refuses every outbound connection; with `allow`, everything but the
|
|
6
|
+
* list (allow-list only, stored as `internet: true` with that list). */
|
|
6
7
|
internet: boolean;
|
|
7
|
-
/** When not empty, only these web destinations are reachable
|
|
8
|
+
/** When not empty, only these web destinations are reachable, the internet on
|
|
9
|
+
* or off: `example.com`,
|
|
8
10
|
* `*.example.com` (subdomains, not the apex), an address or a CIDR range. */
|
|
9
11
|
allow?: string[];
|
|
10
12
|
/** Never reachable. Wins over everything. */
|
|
@@ -171,6 +171,13 @@ export type JobSecret = {
|
|
|
171
171
|
/** One secret by name, and where its value may go: to sandboxes through the
|
|
172
172
|
* egress proxy (`sandboxes`), into scheduled jobs' environments (`jobs`), or
|
|
173
173
|
* both. */
|
|
174
|
+
/** A page of `secrets.list`: at most `limit` (1 to 100, default 50) secrets,
|
|
175
|
+
* by name, those named after `after`. The next page's `after` is the last
|
|
176
|
+
* name of this one; a page shorter than `limit` is the last. */
|
|
177
|
+
export type ListSecrets = {
|
|
178
|
+
limit?: number;
|
|
179
|
+
after?: string;
|
|
180
|
+
};
|
|
174
181
|
export type SecretUse = {
|
|
175
182
|
name: string;
|
|
176
183
|
sandboxes: Secret | null;
|
|
@@ -219,8 +226,9 @@ export declare function secrets(t: Transport): {
|
|
|
219
226
|
enforced: boolean;
|
|
220
227
|
}>;
|
|
221
228
|
/** The sandboxes' secrets: names, hosts and placeholders. Never values.
|
|
222
|
-
* `
|
|
223
|
-
|
|
229
|
+
* `list({ limit, after })` gives one page, by name; `all()` includes
|
|
230
|
+
* the jobs copies. */
|
|
231
|
+
list: (query?: ListSecrets & RequestOptions) => Promise<Secret[]>;
|
|
224
232
|
/** Every secret by name, with where its value may go. */
|
|
225
233
|
all: (options?: RequestOptions) => Promise<SecretUse[]>;
|
|
226
234
|
/** One secret by name, with where its value may go. */
|
package/dist/products/secrets.js
CHANGED
|
@@ -30,11 +30,29 @@ export function secrets(t) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
const liveCopy = async (name, options) => (await jobCopies(options)).find((s) => s.name === name && s.deletedAt === null);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
/** One page with `limit` or `after`; every secret, page after page, without. */
|
|
34
|
+
async function list(query = {}) {
|
|
35
|
+
const { limit, after, ...options } = query;
|
|
36
|
+
const paged = limit !== undefined || after !== undefined;
|
|
37
|
+
const all = [];
|
|
38
|
+
let from = after;
|
|
39
|
+
for (;;) {
|
|
40
|
+
const params = {
|
|
41
|
+
...(limit === undefined ? {} : { limit }),
|
|
42
|
+
...(from === undefined ? {} : { after: from }),
|
|
43
|
+
};
|
|
44
|
+
const page = await t.json({
|
|
45
|
+
method: "GET",
|
|
46
|
+
path: "/v1/egress-secrets",
|
|
47
|
+
...(Object.keys(params).length ? { query: params } : {}),
|
|
48
|
+
...options,
|
|
49
|
+
});
|
|
50
|
+
all.push(...page.secrets);
|
|
51
|
+
if (paged || !page.next)
|
|
52
|
+
return all;
|
|
53
|
+
from = page.next;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
38
56
|
const key = (options, part) => options?.idempotencyKey
|
|
39
57
|
? { ...options, idempotencyKey: `${options.idempotencyKey}:${part}`.slice(0, 128) }
|
|
40
58
|
: options;
|
|
@@ -111,7 +129,8 @@ export function secrets(t) {
|
|
|
111
129
|
sandboxes: byName.get(j.name)?.sandboxes ?? null,
|
|
112
130
|
jobs: j,
|
|
113
131
|
});
|
|
114
|
-
|
|
132
|
+
// By code point, as the API pages them (`after` compares names so).
|
|
133
|
+
return [...byName.values()].sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
115
134
|
}
|
|
116
135
|
async function set(name, input, options) {
|
|
117
136
|
const { jobs, value, ...egress } = input;
|
|
@@ -178,7 +197,8 @@ export function secrets(t) {
|
|
|
178
197
|
...options,
|
|
179
198
|
}),
|
|
180
199
|
/** The sandboxes' secrets: names, hosts and placeholders. Never values.
|
|
181
|
-
* `
|
|
200
|
+
* `list({ limit, after })` gives one page, by name; `all()` includes
|
|
201
|
+
* the jobs copies. */
|
|
182
202
|
list,
|
|
183
203
|
/** Every secret by name, with where its value may go. */
|
|
184
204
|
all,
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Page } from "../page.js";
|
|
2
|
+
import type { RequestOptions, Transport } from "../transport.js";
|
|
3
|
+
export type UptimeRegion = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "oc" | "afr" | "me";
|
|
4
|
+
export type UptimeState = "applying" | "active" | "deleted";
|
|
5
|
+
export type UptimeHealth = "unknown" | "up" | "down";
|
|
6
|
+
export type StatusRange = {
|
|
7
|
+
low: number;
|
|
8
|
+
high: number;
|
|
9
|
+
};
|
|
10
|
+
export type UptimeCheck = {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string | null;
|
|
13
|
+
labels: Record<string, string>;
|
|
14
|
+
/** applying until the probes have it, within a minute; then active. */
|
|
15
|
+
state: UptimeState;
|
|
16
|
+
createdAt: number;
|
|
17
|
+
updatedAt: number;
|
|
18
|
+
deletedAt: number | null;
|
|
19
|
+
/** `target_refused` while the newest knock found the target on a private
|
|
20
|
+
* or Runtime address. */
|
|
21
|
+
error: {
|
|
22
|
+
code: string;
|
|
23
|
+
message: string;
|
|
24
|
+
} | null;
|
|
25
|
+
url: string;
|
|
26
|
+
method: "GET" | "HEAD";
|
|
27
|
+
intervalSeconds: number;
|
|
28
|
+
timeoutMs: number;
|
|
29
|
+
regions: UptimeRegion[];
|
|
30
|
+
confirm: number;
|
|
31
|
+
statuses: StatusRange[];
|
|
32
|
+
bodyContains?: string;
|
|
33
|
+
health: UptimeHealth;
|
|
34
|
+
healthSince: number | null;
|
|
35
|
+
};
|
|
36
|
+
export type CreateUptimeCheck = {
|
|
37
|
+
/** https://, http:// or tcp://host:port; its host must resolve to public
|
|
38
|
+
* addresses (a Runtime App's hostname on 80 or 443 is allowed). */
|
|
39
|
+
url: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
labels?: Record<string, string>;
|
|
42
|
+
/** Defaults to GET. */
|
|
43
|
+
method?: "GET" | "HEAD";
|
|
44
|
+
/** 30 to 3,600 per region; defaults to 60. Regions knock in turn. */
|
|
45
|
+
intervalSeconds?: number;
|
|
46
|
+
/** 1 to 30,000; defaults to 10,000. */
|
|
47
|
+
timeoutMs?: number;
|
|
48
|
+
/** Defaults to enam, wnam, weur, eeur, apac. */
|
|
49
|
+
regions?: UptimeRegion[];
|
|
50
|
+
/** Regions that must fail to call it down; defaults to 2 (1 with one region). */
|
|
51
|
+
confirm?: number;
|
|
52
|
+
/** Ranges that pass; defaults to 200 to 399. */
|
|
53
|
+
statuses?: StatusRange[];
|
|
54
|
+
/** Text the body must contain; GET only. */
|
|
55
|
+
bodyContains?: string;
|
|
56
|
+
};
|
|
57
|
+
export type UptimeResult = {
|
|
58
|
+
region: UptimeRegion;
|
|
59
|
+
scheduledAt: number;
|
|
60
|
+
at: number;
|
|
61
|
+
ms: number;
|
|
62
|
+
up: boolean;
|
|
63
|
+
status: number | null;
|
|
64
|
+
reason: string | null;
|
|
65
|
+
timing: Record<string, unknown>;
|
|
66
|
+
};
|
|
67
|
+
export type UptimeListQuery = {
|
|
68
|
+
limit?: number;
|
|
69
|
+
cursor?: string;
|
|
70
|
+
name?: string;
|
|
71
|
+
label?: string[];
|
|
72
|
+
state?: UptimeState[];
|
|
73
|
+
};
|
|
74
|
+
export type UptimeResultsQuery = {
|
|
75
|
+
before?: number;
|
|
76
|
+
limit?: number;
|
|
77
|
+
region?: UptimeRegion;
|
|
78
|
+
};
|
|
79
|
+
export declare function uptime(t: Transport): {
|
|
80
|
+
create: (input: CreateUptimeCheck, options?: RequestOptions) => Promise<UptimeCheck>;
|
|
81
|
+
/** waitFor follows a state for up to 60 seconds; the answer says where it got. */
|
|
82
|
+
get: (id: string, options?: RequestOptions & {
|
|
83
|
+
waitFor?: UptimeState;
|
|
84
|
+
timeoutSeconds?: number;
|
|
85
|
+
}) => Promise<UptimeCheck>;
|
|
86
|
+
list: (query?: UptimeListQuery, options?: RequestOptions) => Promise<Page<UptimeCheck>>;
|
|
87
|
+
update: (id: string, input: {
|
|
88
|
+
name?: string | null;
|
|
89
|
+
labels?: Record<string, string>;
|
|
90
|
+
}, options?: RequestOptions) => Promise<UptimeCheck>;
|
|
91
|
+
delete: (id: string, options?: RequestOptions) => Promise<UptimeCheck>;
|
|
92
|
+
/** Knocks, newest first, kept 7 days; pass nextBefore as before for older ones. */
|
|
93
|
+
results: (id: string, query?: UptimeResultsQuery, options?: RequestOptions) => Promise<{
|
|
94
|
+
data: UptimeResult[];
|
|
95
|
+
nextBefore: number | null;
|
|
96
|
+
}>;
|
|
97
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Page } from "../page.js";
|
|
2
|
+
const enc = encodeURIComponent;
|
|
3
|
+
export function uptime(t) {
|
|
4
|
+
const base = "/v1/uptime";
|
|
5
|
+
const list = async (query = {}, options) => {
|
|
6
|
+
const page = await t.json({
|
|
7
|
+
method: "GET",
|
|
8
|
+
path: base,
|
|
9
|
+
query,
|
|
10
|
+
...options,
|
|
11
|
+
});
|
|
12
|
+
return new Page(page.data, page.nextCursor, (cursor) => list({ ...query, cursor }, options));
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
create: (input, options) => t.json({ method: "POST", path: base, body: input, ...options }),
|
|
16
|
+
/** waitFor follows a state for up to 60 seconds; the answer says where it got. */
|
|
17
|
+
get: (id, options = {}) => {
|
|
18
|
+
const { waitFor, timeoutSeconds, ...request } = options;
|
|
19
|
+
return t.json({
|
|
20
|
+
method: "GET",
|
|
21
|
+
path: `${base}/${enc(id)}`,
|
|
22
|
+
query: { waitFor, timeoutSeconds },
|
|
23
|
+
...request,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
list,
|
|
27
|
+
update: (id, input, options) => t.json({
|
|
28
|
+
method: "POST",
|
|
29
|
+
path: `${base}/${enc(id)}:update`,
|
|
30
|
+
body: input,
|
|
31
|
+
...options,
|
|
32
|
+
}),
|
|
33
|
+
delete: (id, options) => t.json({ method: "DELETE", path: `${base}/${enc(id)}`, ...options }),
|
|
34
|
+
/** Knocks, newest first, kept 7 days; pass nextBefore as before for older ones. */
|
|
35
|
+
results: (id, query = {}, options) => t.json({
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: `${base}/${enc(id)}/results`,
|
|
38
|
+
query,
|
|
39
|
+
...options,
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -25,10 +25,14 @@ export type Volume = {
|
|
|
25
25
|
measuredAt: string | null;
|
|
26
26
|
/** True once a backup of it has been copied off its host and checked. */
|
|
27
27
|
backedUp: boolean;
|
|
28
|
-
/**
|
|
28
|
+
/** Automatic backups: daily, kept `retentionDays`, or on the volume's own
|
|
29
|
+
* `schedule` with `keep` counts; `nextAt` is the schedule's next backup. */
|
|
29
30
|
backups: {
|
|
30
31
|
daily: boolean;
|
|
31
32
|
retentionDays: number;
|
|
33
|
+
schedule?: VolumeBackupSchedule | null;
|
|
34
|
+
keep?: Required<VolumeBackupKeep> | null;
|
|
35
|
+
nextAt?: string | null;
|
|
32
36
|
lastReadyAt: string | null;
|
|
33
37
|
};
|
|
34
38
|
/** The backup this volume was restored from, if any. */
|
|
@@ -69,6 +73,24 @@ export type VolumeAttachment = {
|
|
|
69
73
|
changedAt: string;
|
|
70
74
|
};
|
|
71
75
|
export type VolumeBackupState = "pending" | "ready" | "failed" | "deleting" | "deleted";
|
|
76
|
+
/** Back up every N minutes (15 or more, from 1970-01-01 UTC), or on a
|
|
77
|
+
* five-field cron in UTC such as `"30 2 * * 1-5"` (02:30 on weekdays). */
|
|
78
|
+
export type VolumeBackupSchedule = {
|
|
79
|
+
everyMinutes: number;
|
|
80
|
+
} | {
|
|
81
|
+
cron: string;
|
|
82
|
+
};
|
|
83
|
+
/** Which scheduled backups stay: the last N, and the newest in each of the
|
|
84
|
+
* newest N hours, days, weeks (from Monday), months and years. Any backup a
|
|
85
|
+
* count keeps is kept; the newest ready backup always is. Missing counts are 0. */
|
|
86
|
+
export type VolumeBackupKeep = {
|
|
87
|
+
last?: number;
|
|
88
|
+
hourly?: number;
|
|
89
|
+
daily?: number;
|
|
90
|
+
weekly?: number;
|
|
91
|
+
monthly?: number;
|
|
92
|
+
yearly?: number;
|
|
93
|
+
};
|
|
72
94
|
/** A point-in-time copy of a volume, kept off its host. */
|
|
73
95
|
export type VolumeBackup = {
|
|
74
96
|
id: string;
|
|
@@ -80,25 +102,30 @@ export type VolumeBackup = {
|
|
|
80
102
|
region: string;
|
|
81
103
|
volumeId: string;
|
|
82
104
|
sizeMiB: number;
|
|
83
|
-
|
|
84
|
-
|
|
105
|
+
/** `scheduled`: made on the volume's schedule and kept by its keep counts. */
|
|
106
|
+
trigger: "manual" | "daily" | "scheduled";
|
|
107
|
+
/** Null while the volume's keep counts decide. */
|
|
108
|
+
retentionDays: number | null;
|
|
85
109
|
logicalBytes: number | null;
|
|
86
110
|
storedBytes: number | null;
|
|
87
111
|
meteredBytes: number | null;
|
|
88
112
|
error: string | null;
|
|
89
113
|
/** Why it failed, when a code says it: `backup_stalled` when its copy off
|
|
90
|
-
* the
|
|
114
|
+
* the volume's server had not begun 15 minutes after `createdAt`; back it
|
|
115
|
+
* up again. */
|
|
91
116
|
errorCode?: string | null;
|
|
92
117
|
createdAt: string;
|
|
93
|
-
/** When its copy off the volume's server began; null while it waits
|
|
94
|
-
*
|
|
118
|
+
/** When its copy off the volume's server began; null while it waits,
|
|
119
|
+
* behind other backups there only (never Runtime's own copies). */
|
|
95
120
|
copyStartedAt?: string | null;
|
|
96
121
|
readyAt: string | null;
|
|
97
|
-
|
|
122
|
+
/** Null while the volume's keep counts decide. */
|
|
123
|
+
expiresAt: string | null;
|
|
98
124
|
};
|
|
99
125
|
/** Persistent disks: create once, attach when creating a sandbox with
|
|
100
126
|
* `volumes: [{ volumeId: v.id, path: "/data" }]`. Backed up off their host
|
|
101
|
-
* daily unless that is turned off; restore
|
|
127
|
+
* daily, or on a schedule of their own, unless that is turned off; restore
|
|
128
|
+
* one with `create({ fromBackup })`. */
|
|
102
129
|
export declare function volumes(t: Transport): {
|
|
103
130
|
/** Create and wait (up to 10 s) until it is ready. With `fromBackup`, a
|
|
104
131
|
* restore; it is ready once the backup is downloaded and checked. */
|
|
@@ -136,10 +163,15 @@ export declare function volumes(t: Transport): {
|
|
|
136
163
|
}, options?: RequestOptions & {
|
|
137
164
|
wait?: number;
|
|
138
165
|
}) => Promise<VolumeBackup>;
|
|
139
|
-
/**
|
|
166
|
+
/** Automatic backups on or off, days a daily one is kept, or a schedule
|
|
167
|
+
* of the volume's own with keep counts:
|
|
168
|
+
* `setBackupPolicy(id, { schedule: { everyMinutes: 60 }, keep: { hourly: 24, daily: 7 } })`. */
|
|
140
169
|
setBackupPolicy: (id: string, input: {
|
|
141
170
|
daily?: boolean;
|
|
142
171
|
retentionDays?: number;
|
|
172
|
+
/** Null goes back to daily backups kept `retentionDays`. */
|
|
173
|
+
schedule?: VolumeBackupSchedule | null;
|
|
174
|
+
keep?: VolumeBackupKeep;
|
|
143
175
|
}, options?: RequestOptions) => Promise<Volume>;
|
|
144
176
|
/** Backups, newest first; `{ volumeId }` for one volume's. */
|
|
145
177
|
backups: (query?: {
|
package/dist/products/volumes.js
CHANGED
|
@@ -2,7 +2,8 @@ import { Page } from "../page.js";
|
|
|
2
2
|
const enc = encodeURIComponent;
|
|
3
3
|
/** Persistent disks: create once, attach when creating a sandbox with
|
|
4
4
|
* `volumes: [{ volumeId: v.id, path: "/data" }]`. Backed up off their host
|
|
5
|
-
* daily unless that is turned off; restore
|
|
5
|
+
* daily, or on a schedule of their own, unless that is turned off; restore
|
|
6
|
+
* one with `create({ fromBackup })`. */
|
|
6
7
|
export function volumes(t) {
|
|
7
8
|
const get = (id, options) => t.json({ method: "GET", path: `/v1/volumes/${enc(id)}`, ...options });
|
|
8
9
|
const list = async (query = {}, options) => {
|
|
@@ -83,7 +84,9 @@ export function volumes(t) {
|
|
|
83
84
|
...rest,
|
|
84
85
|
});
|
|
85
86
|
},
|
|
86
|
-
/**
|
|
87
|
+
/** Automatic backups on or off, days a daily one is kept, or a schedule
|
|
88
|
+
* of the volume's own with keep counts:
|
|
89
|
+
* `setBackupPolicy(id, { schedule: { everyMinutes: 60 }, keep: { hourly: 24, daily: 7 } })`. */
|
|
87
90
|
setBackupPolicy: (id, input, options) => t.json({
|
|
88
91
|
method: "POST",
|
|
89
92
|
path: `/v1/volumes/${enc(id)}:backup-policy`,
|
package/dist/transport.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RuntimeError } from "./errors.js";
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.35.0";
|
|
3
3
|
export declare const DEFAULT_BASE_URL = "https://api.withruntime.com";
|
|
4
4
|
/** Runtime's API as code inside a Runtime sandbox reaches it: the sandbox's
|
|
5
5
|
* own host sends each request on to DEFAULT_BASE_URL over HTTPS. The API runs
|
|
@@ -47,6 +47,9 @@ export type Call = RequestOptions & {
|
|
|
47
47
|
/** Seconds the server may hold the answer for a long-running result. */
|
|
48
48
|
wait?: number;
|
|
49
49
|
accept?: string;
|
|
50
|
+
/** Sent as the Bearer token instead of the client's API key: a webhook
|
|
51
|
+
* trigger's secret, which is all its calls carry. */
|
|
52
|
+
bearer?: string;
|
|
50
53
|
/** Whether retrying after an unknown outcome is safe. Default: true for
|
|
51
54
|
* reads and for writes (the key makes them safe); false only for calls
|
|
52
55
|
* the server cannot deduplicate. */
|
package/dist/transport.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConnectionError, DELIBERATE, errorFor, NOTHING_RAN, RuntimeError, WAITS_FOR_ROOM, } from "./errors.js";
|
|
2
2
|
import { describeRoute, envFetch, openWebSocket, untrustedCertificate } from "./proxy.js";
|
|
3
3
|
import { warningText } from "./product-renames.js";
|
|
4
|
-
export const VERSION = "0.
|
|
4
|
+
export const VERSION = "0.35.0";
|
|
5
5
|
export const DEFAULT_BASE_URL = "https://api.withruntime.com";
|
|
6
6
|
/** Runtime's API as code inside a Runtime sandbox reaches it: the sandbox's
|
|
7
7
|
* own host sends each request on to DEFAULT_BASE_URL over HTTPS. The API runs
|
|
@@ -374,7 +374,7 @@ export class Transport {
|
|
|
374
374
|
let apiKey;
|
|
375
375
|
try {
|
|
376
376
|
call.signal?.throwIfAborted();
|
|
377
|
-
apiKey = await untilAborted(this.#key(), call.signal);
|
|
377
|
+
apiKey = call.bearer ?? (await untilAborted(this.#key(), call.signal));
|
|
378
378
|
}
|
|
379
379
|
catch (cause) {
|
|
380
380
|
if (call.signal?.aborted)
|
package/dist/types.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ export type SandboxInfo = {
|
|
|
28
28
|
idlePauseUnusedOnly?: boolean;
|
|
29
29
|
/** A request (exec, files, terminal, a visit to a shared port) wakes it when paused. */
|
|
30
30
|
autoWake?: boolean;
|
|
31
|
+
/** Who its commands, processes and terminals run as when one names no
|
|
32
|
+
* user: "sandbox" (uid 1000) or "root". Absent from APIs before 25 October 2026. */
|
|
33
|
+
user?: "sandbox" | "root";
|
|
31
34
|
/** Runs until stopped while credit lasts, never paused for idleness or a
|
|
32
35
|
* time limit, and its disk is kept after a stop. */
|
|
33
36
|
persistent?: boolean;
|
|
@@ -139,6 +142,11 @@ export type CreateSandbox = {
|
|
|
139
142
|
idlePauseSeconds?: number;
|
|
140
143
|
/** A request to a paused sandbox wakes it. Default true. */
|
|
141
144
|
autoWake?: boolean;
|
|
145
|
+
/** "root": its commands, processes and terminals run as root, through the
|
|
146
|
+
* sandbox's passwordless sudo, unless one says `user: "sandbox"`. Default
|
|
147
|
+
* "sandbox"; a sandbox made from a snapshot runs as its source did. Files
|
|
148
|
+
* written through `files` stay the sandbox user's. */
|
|
149
|
+
user?: "sandbox" | "root";
|
|
142
150
|
/** Keep it running until you stop it, while credit lasts, with no idle
|
|
143
151
|
* pause unless idlePauseSeconds asks for one. Its disk is billed as any
|
|
144
152
|
* sandbox's, and kept after a stop, for restart(), as any sandbox's is.
|
|
@@ -224,9 +232,10 @@ export type CommandResult = {
|
|
|
224
232
|
};
|
|
225
233
|
export type ExecOptions = {
|
|
226
234
|
cwd?: string;
|
|
227
|
-
/** Who runs it: "sandbox" (
|
|
228
|
-
*
|
|
229
|
-
*
|
|
235
|
+
/** Who runs it: "sandbox" (uid 1000, HOME=/workspace) or "root", through
|
|
236
|
+
* the sandbox's passwordless sudo with the same environment and PATH and
|
|
237
|
+
* HOME=/root: no need to prefix it with sudo. Default: the sandbox's own
|
|
238
|
+
* `user`, the sandbox user unless it was made with "root". */
|
|
230
239
|
user?: "sandbox" | "root";
|
|
231
240
|
/** Merged over the sandbox's environment. Put secrets here, never in the command. */
|
|
232
241
|
env?: Record<string, string>;
|
|
@@ -487,6 +496,9 @@ export type SandboxSettings = {
|
|
|
487
496
|
env?: Record<string, string | null>;
|
|
488
497
|
/** A request to a paused sandbox wakes it. */
|
|
489
498
|
autoWake?: boolean;
|
|
499
|
+
/** Who later commands, processes and terminals run as when one names no
|
|
500
|
+
* user; running ones keep theirs. */
|
|
501
|
+
user?: "sandbox" | "root";
|
|
490
502
|
/** Pause after this many seconds with no activity, counted from now; 0
|
|
491
503
|
* never, otherwise 60 to 86400 (a shorter time is raised to 60). */
|
|
492
504
|
idlePauseSeconds?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "withruntime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"mcpName": "com.withruntime/runtime",
|
|
6
6
|
"type": "module",
|
|
@@ -66,6 +66,16 @@
|
|
|
66
66
|
"import": "./dist/containers/index.js",
|
|
67
67
|
"default": "./dist/containers/index.js"
|
|
68
68
|
},
|
|
69
|
+
"./browsers": {
|
|
70
|
+
"types": "./dist/browsers/index.d.ts",
|
|
71
|
+
"import": "./dist/browsers/index.js",
|
|
72
|
+
"default": "./dist/browsers/index.js"
|
|
73
|
+
},
|
|
74
|
+
"./desktops": {
|
|
75
|
+
"types": "./dist/desktops/index.d.ts",
|
|
76
|
+
"import": "./dist/desktops/index.js",
|
|
77
|
+
"default": "./dist/desktops/index.js"
|
|
78
|
+
},
|
|
69
79
|
"./builds": {
|
|
70
80
|
"types": "./dist/builds/index.d.ts",
|
|
71
81
|
"import": "./dist/builds/index.js",
|
|
@@ -81,6 +91,11 @@
|
|
|
81
91
|
"import": "./dist/apps/index.js",
|
|
82
92
|
"default": "./dist/apps/index.js"
|
|
83
93
|
},
|
|
94
|
+
"./functions": {
|
|
95
|
+
"types": "./dist/functions/index.d.ts",
|
|
96
|
+
"import": "./dist/functions/index.js",
|
|
97
|
+
"default": "./dist/functions/index.js"
|
|
98
|
+
},
|
|
84
99
|
"./e2b": {
|
|
85
100
|
"types": "./dist/e2b/index.d.ts",
|
|
86
101
|
"import": "./dist/e2b/index.js",
|
|
@@ -220,6 +235,7 @@
|
|
|
220
235
|
"ai": "7.0.87",
|
|
221
236
|
"groq-sdk": "1.6.0",
|
|
222
237
|
"openai": "7.23.0",
|
|
238
|
+
"playwright": "1.63.0",
|
|
223
239
|
"together-ai": "0.55.0",
|
|
224
240
|
"typescript": "^5",
|
|
225
241
|
"zod": "^4.1.8"
|