withruntime 1.0.0 → 1.1.1
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/CHANGELOG.md +76 -0
- package/README.md +145 -0
- package/dist/generated/agentSessions.d.ts +218 -0
- package/dist/generated/agentSessions.js +154 -0
- package/dist/generated/agents.d.ts +193 -0
- package/dist/generated/agents.js +166 -0
- package/dist/generated/apps.d.ts +87 -28
- package/dist/generated/apps.js +153 -41
- package/dist/generated/audit.d.ts +2 -2
- package/dist/generated/audit.js +3 -3
- package/dist/generated/browsers.d.ts +87 -28
- package/dist/generated/browsers.js +153 -41
- package/dist/generated/builds.d.ts +87 -28
- package/dist/generated/builds.js +153 -41
- package/dist/generated/ci.d.ts +87 -28
- package/dist/generated/ci.js +153 -41
- package/dist/generated/containers.d.ts +87 -28
- package/dist/generated/containers.js +153 -41
- package/dist/generated/desktops.d.ts +89 -30
- package/dist/generated/desktops.js +155 -43
- package/dist/generated/domains.d.ts +52 -15
- package/dist/generated/domains.js +74 -14
- package/dist/generated/egressIps.d.ts +6 -6
- package/dist/generated/egressIps.js +4 -4
- package/dist/generated/events.d.ts +4 -2
- package/dist/generated/events.js +3 -3
- package/dist/generated/feedback.d.ts +1 -1
- package/dist/generated/feedback.js +3 -3
- package/dist/generated/functions.d.ts +87 -28
- package/dist/generated/functions.js +153 -41
- package/dist/generated/identities.d.ts +2 -2
- package/dist/generated/identities.js +5 -5
- package/dist/generated/images.d.ts +68 -14
- package/dist/generated/images.js +96 -15
- package/dist/generated/index.d.ts +9 -0
- package/dist/generated/index.js +12 -0
- package/dist/generated/jobRuns.d.ts +11 -4
- package/dist/generated/jobRuns.js +6 -6
- package/dist/generated/jobs.d.ts +58 -9
- package/dist/generated/jobs.js +98 -14
- package/dist/generated/keys.d.ts +8 -6
- package/dist/generated/keys.js +6 -6
- package/dist/generated/me.d.ts +2 -2
- package/dist/generated/me.js +3 -3
- package/dist/generated/messages.d.ts +67 -0
- package/dist/generated/messages.js +17 -0
- package/dist/generated/networks.d.ts +4 -4
- package/dist/generated/networks.js +4 -4
- package/dist/generated/notebooks.d.ts +87 -28
- package/dist/generated/notebooks.js +153 -41
- package/dist/generated/otel.d.ts +2 -2
- package/dist/generated/otel.js +5 -5
- package/dist/generated/ports.d.ts +11 -11
- package/dist/generated/ports.js +8 -8
- package/dist/generated/previews.d.ts +50 -15
- package/dist/generated/previews.js +70 -18
- package/dist/generated/projects.d.ts +30 -6
- package/dist/generated/projects.js +13 -9
- package/dist/generated/roles.d.ts +11 -2
- package/dist/generated/roles.js +9 -5
- package/dist/generated/routes.js +1 -1
- package/dist/generated/runtime.d.ts +15 -3
- package/dist/generated/runtime.js +31 -18
- package/dist/generated/sandboxes.d.ts +213 -66
- package/dist/generated/sandboxes.js +171 -43
- package/dist/generated/secrets.d.ts +45 -6
- package/dist/generated/secrets.js +69 -9
- package/dist/generated/sessions.d.ts +1 -1
- package/dist/generated/sessions.js +4 -4
- package/dist/generated/signing.js +3 -1
- package/dist/generated/sites.d.ts +87 -28
- package/dist/generated/sites.js +153 -41
- package/dist/generated/snapshots.d.ts +70 -5
- package/dist/generated/snapshots.js +107 -7
- package/dist/generated/tunnels.d.ts +8 -8
- package/dist/generated/tunnels.js +4 -4
- package/dist/generated/usage.d.ts +57 -6
- package/dist/generated/usage.js +4 -4
- package/dist/generated/volumes.d.ts +72 -7
- package/dist/generated/volumes.js +114 -10
- package/dist/generated/webhooks.d.ts +2 -2
- package/dist/generated/webhooks.js +5 -5
- package/dist/generated/workspaces.d.ts +87 -28
- package/dist/generated/workspaces.js +153 -41
- package/dist/v2/bin.d.ts +2 -0
- package/dist/v2/bin.js +15 -0
- package/dist/v2/cli.d.ts +15 -2
- package/dist/v2/cli.js +158 -53
- package/dist/v2/json.d.ts +9 -0
- package/dist/v2/json.js +5 -0
- package/dist/v2/mcp.js +14 -1
- package/dist/v2/openapi.json +7695 -4382
- package/dist/v2/shims/fly.js +49 -13
- package/dist/v2/shims/morph.js +1 -1
- package/dist/v2/table.d.ts +7 -4
- package/dist/v2/table.js +97 -34
- package/package.json +7 -5
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { RequestOptions,
|
|
2
|
-
import { Paginated, Stream } from "./runtime.js";
|
|
1
|
+
import type { RequestOptions, ClientOptions } from "./runtime.js";
|
|
2
|
+
import { Paginated, Transport, Stream } from "./runtime.js";
|
|
3
|
+
import { type Preview, type PreviewCreate, Previews } from "./previews.js";
|
|
3
4
|
/** A command a machine starts at every fresh boot. */
|
|
4
5
|
export interface MachineStart {
|
|
5
6
|
/** The command: text, run by `bash -lc`, or the program and its arguments as a list, run without a shell. */
|
|
@@ -22,7 +23,7 @@ export interface VolumeMount {
|
|
|
22
23
|
/** Where it is mounted, such as `/data`: an absolute path, not under `/proc`, `/sys`, `/dev`, `/etc`, `/usr`, `/bin`, `/sbin`, `/lib` or `/boot`. */
|
|
23
24
|
path: string;
|
|
24
25
|
}
|
|
25
|
-
/** A command a
|
|
26
|
+
/** A command a machine runs once it starts: when it ends, the machine stops. */
|
|
26
27
|
export interface SandboxRun {
|
|
27
28
|
/** The command: text, run by `bash -lc`, or the program and its arguments as a list, run without a shell. */
|
|
28
29
|
cmd: string | string[];
|
|
@@ -33,20 +34,20 @@ export interface SandboxRun {
|
|
|
33
34
|
/** Seconds it may run before it is stopped (`1.5` for 1,500 ms); no limit when omitted or 0. At least 0. */
|
|
34
35
|
timeoutSeconds?: number;
|
|
35
36
|
}
|
|
36
|
-
/** Where a
|
|
37
|
+
/** Where a machine may connect out, past the walls every machine has. */
|
|
37
38
|
export interface NetworkRules {
|
|
38
39
|
/** The only places it may reach, each a host, `*.` and a name for every name under it, an address or a CIDR (`[` and `]` around an IPv6 address), every port when it names none; `:port` for that port alone, on a host name for a port beyond 80 and 443, which go together. `*` is every public host. Every public host when omitted; nothing when empty. */
|
|
39
40
|
allowOutbound?: string[];
|
|
40
41
|
/** Places it may never reach, written as in allowOutbound with no port: a deny wins over every allow. */
|
|
41
42
|
denyOutbound?: string[];
|
|
42
43
|
}
|
|
43
|
-
/** A
|
|
44
|
+
/** A machine's settings: what a create sets on it. */
|
|
44
45
|
export interface SandboxSettings {
|
|
45
|
-
/** Its vCPUs. At least 1.
|
|
46
|
+
/** Its vCPUs; its product's default when omitted. At least 1. */
|
|
46
47
|
vcpu?: number;
|
|
47
|
-
/** Its memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`1.5`). At least 1.
|
|
48
|
+
/** Its memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`1.5`). Its product's default when omitted. At least 1. */
|
|
48
49
|
memoryGB?: number;
|
|
49
|
-
/** Its disk in GB (1 GB is 1,024 MiB), to the MiB. At least 1.
|
|
50
|
+
/** Its disk in GB (1 GB is 1,024 MiB), to the MiB. When omitted, its product's default or its image's size, whichever is larger. At least 1. */
|
|
50
51
|
diskGB?: number;
|
|
51
52
|
/** The image it boots, by name (its newest version), `name:version` or ID; Runtime's default image when omitted. */
|
|
52
53
|
image?: string;
|
|
@@ -57,28 +58,36 @@ export interface SandboxSettings {
|
|
|
57
58
|
/** Who every command, process, terminal and code run in it runs as when the call names no `user`: `runtime` (uid 1000, with passwordless sudo) or `root`. Its image's when omitted, else `runtime`. */
|
|
58
59
|
user?: "runtime" | "root" | (string & {});
|
|
59
60
|
}
|
|
60
|
-
/** A
|
|
61
|
+
/** A machine to create. */
|
|
61
62
|
export interface SandboxCreate extends SandboxSettings {
|
|
62
63
|
/** Volumes it attaches and mounts at its create, at most one; detached when it is deleted, to attach to another. */
|
|
63
64
|
volumes?: VolumeMount[];
|
|
64
|
-
/** A command it runs once it starts. When the command ends, the
|
|
65
|
+
/** A command it runs once it starts. When the command ends, the machine is `paused` with its disk kept (exitCode says how it ended) and a call starts it again. Needs the `exec` permission too. */
|
|
65
66
|
run?: SandboxRun;
|
|
66
67
|
/** Its name, unique in its project. */
|
|
67
68
|
name?: string;
|
|
68
69
|
/** Labels to find it by. */
|
|
69
70
|
labels?: Record<string, string>;
|
|
70
|
-
/** With a name: the
|
|
71
|
+
/** With a name: the machine of that name when there is one, else a new one. */
|
|
71
72
|
getOrCreate?: boolean;
|
|
72
73
|
/** The most it may cost in all, in US dollars (`"5.00"`): once it has cost that it pauses, and starts again only once its maxCost is raised (`update`); what a key's per-request and spend caps count. When omitted under a key with a per-request or spend cap, the most that key's caps leave. */
|
|
73
74
|
maxCost?: string;
|
|
74
|
-
/** Seconds with nothing happening before it pauses, 60 to 86400; 0 never;
|
|
75
|
+
/** Seconds with nothing happening before it pauses, 60 to 86400; 0 never; its product's default when omitted (300 for a sandbox). A fork keeps its source's, except 0: a copy never pauses only when its fork asks. At least 0. At most 86400. */
|
|
75
76
|
idlePauseSeconds?: number;
|
|
76
|
-
/**
|
|
77
|
+
/** What it starts as, by ID or name: a snapshot (a copy of it running, at its sizes, in its project, with its secrets) or an image (as `image` takes it). A name is a snapshot's when the project has one of that name, else an image's. Not with `image`. Running copies of a sandbox are `fork`'s. */
|
|
78
|
+
from?: string;
|
|
79
|
+
/** Deprecated: SDK 1.0.x's name for `from` with a snapshot, read as `from` ([`snapshot_is_from`]). Not with `from`. */
|
|
77
80
|
snapshot?: string;
|
|
78
81
|
/** Where it may connect out from its first start, as setNetwork takes it; the open internet behind every machine's walls when omitted. */
|
|
79
82
|
network?: NetworkRules;
|
|
80
83
|
/** Environment variables for every command and process in it and its start, at most 32 and 32768 bytes of names and values; values are never answered. A copy keeps them. */
|
|
81
84
|
env?: Record<string, string>;
|
|
85
|
+
/** Whether a call that reaches it paused (an exec, a file, a terminal, a preview's visitor) resumes it; true when omitted. false: such a call answers 409 sandbox_paused and it stays paused until its own `:resume`. A fork's copies keep it. */
|
|
86
|
+
autoWake?: boolean;
|
|
87
|
+
/** Seconds until Runtime deletes it, as its delete does: final at once, its memory and disk gone and no longer billed; it can't be undone. 0 or omitted: kept until deleted. Its owner renews it with update; a copy, snapshot or image made from it sets its own. At least 0. At most 315360000. */
|
|
88
|
+
deleteAfterSeconds?: number;
|
|
89
|
+
/** Whether its delete is refused (409 `delete_protected`) until an update turns this off; false when omitted. Not with `deleteAfterSeconds`. While true, its time limit pauses it instead of deleting it; only its organization's close deletes it. A copy, snapshot or image made from it sets its own. */
|
|
90
|
+
deleteProtection?: boolean;
|
|
82
91
|
}
|
|
83
92
|
/** How a create's wait for its start's ready check (`start.readyPort`, `start.readyCommand`) went. */
|
|
84
93
|
export interface MachineReady {
|
|
@@ -87,12 +96,12 @@ export interface MachineReady {
|
|
|
87
96
|
/** How long it waited, in milliseconds. */
|
|
88
97
|
waitedMs: number;
|
|
89
98
|
}
|
|
90
|
-
/** A
|
|
99
|
+
/** A machine. */
|
|
91
100
|
export interface SandboxInfo extends SandboxSettings {
|
|
92
101
|
/** Its ID. */
|
|
93
102
|
id: string;
|
|
94
|
-
/**
|
|
95
|
-
object: "sandbox" | "function" | "app" | "site" | "ci" | "browser" | "desktop" | "notebook" | "workspace" | "container" | "build" | (string & {});
|
|
103
|
+
/** Its product's kind: `sandbox` for a sandbox, `app` for an app, and so on. */
|
|
104
|
+
object: "sandbox" | "function" | "app" | "site" | "ci" | "browser" | "desktop" | "notebook" | "workspace" | "container" | "build" | "agent.session" | (string & {});
|
|
96
105
|
/** Its name, unique in its project. */
|
|
97
106
|
name?: string;
|
|
98
107
|
/** Where it is. */
|
|
@@ -109,12 +118,20 @@ export interface SandboxInfo extends SandboxSettings {
|
|
|
109
118
|
idlePauseSeconds?: number;
|
|
110
119
|
/** The most it may cost in all, in US dollars; none when it has no such cap. */
|
|
111
120
|
maxCost?: string;
|
|
121
|
+
/** Whether a call that reaches it paused resumes it; false: only its own resume does, and such a call answers 409 sandbox_paused. Default: true. */
|
|
122
|
+
autoWake?: boolean;
|
|
112
123
|
/** Its run's exit code, once its run ended; none for one a signal or its timeout ended. */
|
|
113
124
|
exitCode?: number;
|
|
114
125
|
/** When its run ended. */
|
|
115
126
|
endedAt?: string;
|
|
127
|
+
/** When its pause began (or its run ended), while it is paused. */
|
|
128
|
+
pausedAt?: string;
|
|
116
129
|
/** A create's answer alone, for a start with a ready check: how its wait went. */
|
|
117
130
|
ready?: MachineReady;
|
|
131
|
+
/** When Runtime deletes it (`deleteAfterSeconds`), finally: it can't be undone, as its delete can't; none: kept until deleted. */
|
|
132
|
+
deleteAt?: string;
|
|
133
|
+
/** Whether its delete is refused (409 `delete_protected`) until an update turns this off. */
|
|
134
|
+
deleteProtection?: boolean;
|
|
118
135
|
}
|
|
119
136
|
/** A terminal's size. */
|
|
120
137
|
export interface Terminal {
|
|
@@ -145,7 +162,7 @@ export interface ExecRequest {
|
|
|
145
162
|
outputEncoding?: "utf8" | "base64" | (string & {});
|
|
146
163
|
/** Run it on a terminal of this size: its input, output and controlling terminal; not with a wait for its end. */
|
|
147
164
|
pty?: Terminal;
|
|
148
|
-
/** Who it runs as: `runtime` (uid 1000, with passwordless sudo) or `root`; the
|
|
165
|
+
/** Who it runs as: `runtime` (uid 1000, with passwordless sudo) or `root`; the machine's `user` when omitted. */
|
|
149
166
|
user?: "runtime" | "root" | (string & {});
|
|
150
167
|
}
|
|
151
168
|
/** A process. */
|
|
@@ -191,6 +208,50 @@ export interface Process {
|
|
|
191
208
|
/** How long it ran, in seconds, to the millisecond, once it ended. */
|
|
192
209
|
durationSeconds?: number;
|
|
193
210
|
}
|
|
211
|
+
/** A failed read of an exec's events: the error the API would have answered, and where to follow on from. */
|
|
212
|
+
export interface ExecEventError {
|
|
213
|
+
/** The error's code. */
|
|
214
|
+
code: string;
|
|
215
|
+
/** What went wrong. */
|
|
216
|
+
message?: string;
|
|
217
|
+
/** The status the API answered. */
|
|
218
|
+
status?: number;
|
|
219
|
+
/** The process. */
|
|
220
|
+
processId?: string;
|
|
221
|
+
/** The cursor to follow its output on from (processes.output). */
|
|
222
|
+
cursor?: number;
|
|
223
|
+
}
|
|
224
|
+
/** One event of an exec asked for its events (`stream: true`, or `Accept: application/x-ndjson`), one JSON object a line: `start`, then `stdout` and `stderr` as the output comes, `truncated` when output was dropped before it was read, and `exit`; or `continue` (follow on with processes.output from `cursor`) or `error`. */
|
|
225
|
+
export interface ExecEvent {
|
|
226
|
+
/** `start`, `stdout`, `stderr`, `truncated`, `exit`, `continue` or `error`. */
|
|
227
|
+
type: "start" | "stdout" | "stderr" | "truncated" | "exit" | "continue" | "error" | (string & {});
|
|
228
|
+
/** The process: `start` and `continue`. */
|
|
229
|
+
processId?: string;
|
|
230
|
+
/** `start`: this Idempotency-Key ran it before, and these are that run's events again. */
|
|
231
|
+
replayed?: boolean;
|
|
232
|
+
/** `stdout` and `stderr`: the output, as text. */
|
|
233
|
+
data?: string;
|
|
234
|
+
/** `stdout` and `stderr`: the output's bytes, in base64, with outputEncoding `base64`. */
|
|
235
|
+
base64?: string;
|
|
236
|
+
/** `stdout` and `stderr`: where in the process's output these bytes start. */
|
|
237
|
+
offset?: number;
|
|
238
|
+
/** `truncated`: how many bytes were dropped. */
|
|
239
|
+
droppedBytes?: number;
|
|
240
|
+
/** `truncated`: where the output read on from. */
|
|
241
|
+
resumeAt?: number;
|
|
242
|
+
/** `exit`: its exit code. */
|
|
243
|
+
exitCode?: number;
|
|
244
|
+
/** `exit`: how it ended. */
|
|
245
|
+
state?: "running" | "exited" | "killed" | "timed_out" | (string & {});
|
|
246
|
+
/** `exit`: it was stopped at its timeout. */
|
|
247
|
+
timedOut?: boolean;
|
|
248
|
+
/** `exit`: how long it ran. */
|
|
249
|
+
durationSeconds?: number;
|
|
250
|
+
/** `continue`: the cursor to follow its output on from (processes.output). */
|
|
251
|
+
cursor?: number;
|
|
252
|
+
/** `error`: what failed. */
|
|
253
|
+
error?: ExecEventError;
|
|
254
|
+
}
|
|
194
255
|
/** A file written. */
|
|
195
256
|
export interface FileWritten {
|
|
196
257
|
/** Its path. */
|
|
@@ -266,7 +327,7 @@ export interface FileRemoved {
|
|
|
266
327
|
/** It was there and is removed; false when it was missing. */
|
|
267
328
|
removed: boolean;
|
|
268
329
|
}
|
|
269
|
-
/** A path in a
|
|
330
|
+
/** A path in a machine: what is there, if anything. */
|
|
270
331
|
export interface FileInfo {
|
|
271
332
|
/** Its path. */
|
|
272
333
|
path: string;
|
|
@@ -373,9 +434,9 @@ export interface FileRenamed {
|
|
|
373
434
|
/** Its SHA-256 in hex: given for a move checked by sha256. */
|
|
374
435
|
sha256?: string;
|
|
375
436
|
}
|
|
376
|
-
/** A file link to make: an expiring address for one file of a
|
|
437
|
+
/** A file link to make: an expiring address for one file of a machine (or, with `archive`, a folder) that anyone may open with no API key. */
|
|
377
438
|
export interface FileLinkCreate {
|
|
378
|
-
/** The file's absolute path in the
|
|
439
|
+
/** The file's absolute path in the machine. For GET it must exist when the link is made. */
|
|
379
440
|
path: string;
|
|
380
441
|
/** `GET` (default): a download link. `PUT`: an upload link; the request's body becomes the file. */
|
|
381
442
|
method?: "GET" | "PUT" | (string & {});
|
|
@@ -385,7 +446,7 @@ export interface FileLinkCreate {
|
|
|
385
446
|
filename?: string;
|
|
386
447
|
/** PUT only: the largest body the link takes, in bytes; 5 GiB by default and at most. At least 0. At most 5368709120. */
|
|
387
448
|
maxBytes?: number;
|
|
388
|
-
/** false: a paused
|
|
449
|
+
/** false: a paused machine is not woken for the link, which answers 409 `sandbox_paused`. Unset or true: it is woken. */
|
|
389
450
|
wake?: boolean;
|
|
390
451
|
/** GET only: `path` is a folder, downloaded as a `.tar.gz`. Default: false. */
|
|
391
452
|
archive?: boolean;
|
|
@@ -396,9 +457,9 @@ export interface FileLink {
|
|
|
396
457
|
url: string;
|
|
397
458
|
/** `GET` or `PUT`. */
|
|
398
459
|
method: "GET" | "PUT" | (string & {});
|
|
399
|
-
/** The file's path in the
|
|
460
|
+
/** The file's path in the machine. */
|
|
400
461
|
path: string;
|
|
401
|
-
/** The
|
|
462
|
+
/** The machine. */
|
|
402
463
|
sandboxId: string;
|
|
403
464
|
/** When it stops working. */
|
|
404
465
|
expiresAt: string;
|
|
@@ -409,16 +470,16 @@ export interface FileLink {
|
|
|
409
470
|
/** It downloads a folder as a `.tar.gz`. */
|
|
410
471
|
archive?: boolean;
|
|
411
472
|
}
|
|
412
|
-
/** A
|
|
473
|
+
/** A machine's file links ended. */
|
|
413
474
|
export interface FileLinksRevoked {
|
|
414
|
-
/** The
|
|
475
|
+
/** The machine. */
|
|
415
476
|
sandboxId: string;
|
|
416
477
|
/** When they ended: every link made before it. */
|
|
417
478
|
revokedAt: string;
|
|
418
479
|
}
|
|
419
|
-
/** Where a
|
|
480
|
+
/** Where a machine may connect out. */
|
|
420
481
|
export interface SandboxNetwork extends NetworkRules {
|
|
421
|
-
/** The
|
|
482
|
+
/** The machine's ID. */
|
|
422
483
|
id: string;
|
|
423
484
|
}
|
|
424
485
|
/** A machine's CPU and memory as its host measures them from the machine's own cgroup, never by a call into the machine, so reading them does not wake it or keep it awake. Either the current reading (over the host's last 5 seconds, with disk and pressure) or one step of a window (averaged over the time the machine ran in it). */
|
|
@@ -450,7 +511,7 @@ export interface MetricPoint {
|
|
|
450
511
|
/** Writes its disks completed a second. */
|
|
451
512
|
diskWriteOpsPerSecond?: number;
|
|
452
513
|
}
|
|
453
|
-
/** A
|
|
514
|
+
/** A machine's CPU and memory over a time window, in steps, and its current reading (with disk and pressure) while it runs. Steps are returned in every state, including paused and stopped. Ranges: `15m` and `1h` in 60-second steps, `6h` in 120-second steps, `24h` in 480-second steps, `7d` and `30d` in 1-hour steps. Defaults to `1h`. */
|
|
454
515
|
export interface MetricsBase {
|
|
455
516
|
/** Its state. */
|
|
456
517
|
state: "starting" | "running" | "paused" | "deleted" | "error" | (string & {});
|
|
@@ -470,15 +531,15 @@ export interface MetricsBase {
|
|
|
470
531
|
diskLimitBytes: number;
|
|
471
532
|
/** The reading taken now; none when it is not running or its host could not read it. */
|
|
472
533
|
latest?: MetricPoint;
|
|
473
|
-
/** The window's steps, oldest first, each averaged over the time the
|
|
534
|
+
/** The window's steps, oldest first, each averaged over the time the machine ran in it. Steps in which it did not run are omitted. A minute appears about a minute after it ends; `latest` holds the current reading. */
|
|
474
535
|
points: MetricPoint[];
|
|
475
536
|
}
|
|
476
|
-
/** A
|
|
537
|
+
/** A machine's metrics. */
|
|
477
538
|
export interface SandboxMetrics extends MetricsBase {
|
|
478
|
-
/** The
|
|
539
|
+
/** The machine's ID. */
|
|
479
540
|
id: string;
|
|
480
541
|
}
|
|
481
|
-
/** Copies of a
|
|
542
|
+
/** Copies of a machine to make, as it is now. */
|
|
482
543
|
export interface ForkRequest {
|
|
483
544
|
/** How many. At least 1. At most 100. Default: 1. */
|
|
484
545
|
count?: number;
|
|
@@ -492,13 +553,19 @@ export interface ForkRequest {
|
|
|
492
553
|
maxCost?: string;
|
|
493
554
|
/** Seconds with nothing happening before each copy pauses, 60 to 86400; 0 never. When omitted, its source's, unless its source never pauses (0): then its product's default, 300 for a sandbox. At least 0. At most 86400. */
|
|
494
555
|
idlePauseSeconds?: number;
|
|
556
|
+
/** The vCPUs each copy may use, at most its source's; its source's when omitted. A copy keeps its source's vCPUs online and is held to this many vCPUs of CPU time, which it is placed and billed by. Its memory is its source's. At least 1. */
|
|
557
|
+
vcpu?: number;
|
|
558
|
+
/** Seconds until Runtime deletes each copy, as its delete does: final, and it can't be undone. 0 or omitted: kept until deleted; a copy never takes its source's. At least 0. At most 315360000. */
|
|
559
|
+
deleteAfterSeconds?: number;
|
|
560
|
+
/** Whether each copy's delete is refused (409 `delete_protected`) until an update turns this off; false when omitted. Not with `deleteAfterSeconds`; a copy never takes its source's. */
|
|
561
|
+
deleteProtection?: boolean;
|
|
495
562
|
}
|
|
496
563
|
/** The copies a fork made, each running. */
|
|
497
564
|
export interface Forked {
|
|
498
565
|
/** The copies, in the order made. */
|
|
499
566
|
sandboxes: SandboxInfo[];
|
|
500
567
|
}
|
|
501
|
-
/** A snapshot of a
|
|
568
|
+
/** A snapshot of a machine to take. */
|
|
502
569
|
export interface SnapshotRequest {
|
|
503
570
|
/** Its name, unique among the project's snapshots. */
|
|
504
571
|
name?: string;
|
|
@@ -506,8 +573,12 @@ export interface SnapshotRequest {
|
|
|
506
573
|
labels?: Record<string, string>;
|
|
507
574
|
/** Keeps its disk alone, synced, as the next version of the image of this name (`name:1`, `name:2`, ...) in place of a snapshot: an image machines are created from, each booting fresh over a disk of its own. Its memory is not kept; name is ignored. */
|
|
508
575
|
image?: string;
|
|
509
|
-
/** With image: the command each machine created from the image starts at every fresh boot; the
|
|
576
|
+
/** With image: the command each machine created from the image starts at every fresh boot; the machine's own when omitted. */
|
|
510
577
|
start?: MachineStart;
|
|
578
|
+
/** Seconds until Runtime deletes the snapshot (or, with image, that image version), as its delete does: final, and it can't be undone. 0 or omitted: kept until deleted. At least 0. At most 315360000. */
|
|
579
|
+
deleteAfterSeconds?: number;
|
|
580
|
+
/** Whether the snapshot's (or, with image, that image version's) delete is refused (409 `delete_protected`) until an update turns this off; false when omitted. Not with `deleteAfterSeconds`. */
|
|
581
|
+
deleteProtection?: boolean;
|
|
511
582
|
}
|
|
512
583
|
/** Stored data: a snapshot, an image or a volume. */
|
|
513
584
|
export interface Stored {
|
|
@@ -525,7 +596,7 @@ export interface Stored {
|
|
|
525
596
|
sizeBytes: number;
|
|
526
597
|
/** What it holds now, in bytes. */
|
|
527
598
|
storedBytes: number;
|
|
528
|
-
/** What it was made from (a snapshot's
|
|
599
|
+
/** What it was made from (a snapshot's machine, an image's base), if anything. */
|
|
529
600
|
parentId?: string;
|
|
530
601
|
/** The machine it is attached to now, if any. */
|
|
531
602
|
attachedTo?: string;
|
|
@@ -539,6 +610,12 @@ export interface Stored {
|
|
|
539
610
|
error?: string;
|
|
540
611
|
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
541
612
|
deletedAt?: string;
|
|
613
|
+
/** When Runtime deletes it (`deleteAfterSeconds`), finally: it can't be undone, as its delete can't; none: kept until deleted. */
|
|
614
|
+
deleteAt?: string;
|
|
615
|
+
/** Once `deleteAt` has passed, what its delete waits for: the App that boots this image, or the machine this volume is attached to, by its ID. It is deleted as soon as that one no longer does. */
|
|
616
|
+
deleteWaitsFor?: string;
|
|
617
|
+
/** Whether its delete is refused (409 `delete_protected`) until an update turns this off. */
|
|
618
|
+
deleteProtection?: boolean;
|
|
542
619
|
}
|
|
543
620
|
/** A change to a machine's settings: each field left out stays as it is. */
|
|
544
621
|
export interface MachineUpdate {
|
|
@@ -546,11 +623,11 @@ export interface MachineUpdate {
|
|
|
546
623
|
name?: string;
|
|
547
624
|
/** Its labels, in place of its own; those under `runtime.` are kept. */
|
|
548
625
|
labels?: Record<string, string>;
|
|
549
|
-
/** Seconds with nothing happening before it pauses, 60 to 86400; 0 never. */
|
|
626
|
+
/** Seconds with nothing happening before it pauses, 60 to 86400; 0 never. Nothing happening means no call or command running, no traffic, almost no CPU, and no outbound connection it opened still open. */
|
|
550
627
|
idlePauseSeconds?: number;
|
|
551
|
-
/** Its vCPUs, grown while it runs; a running
|
|
628
|
+
/** Its vCPUs, grown while it runs; a running machine's vCPUs only grow. At least 1. */
|
|
552
629
|
vcpu?: number;
|
|
553
|
-
/** Its memory in GB (1 GB is 1,024 MiB), grown while it runs; a running
|
|
630
|
+
/** Its memory in GB (1 GB is 1,024 MiB), grown while it runs; a running machine's memory only grows. At least 1. */
|
|
554
631
|
memoryGB?: number;
|
|
555
632
|
/** Its disk in GB (1 GB is 1,024 MiB), grown while it runs, its file system with it; a disk only grows. At least 1. */
|
|
556
633
|
diskGB?: number;
|
|
@@ -562,6 +639,12 @@ export interface MachineUpdate {
|
|
|
562
639
|
removeEnv?: string[];
|
|
563
640
|
/** The most it may cost in all, in US dollars (`"5.00"`), in place of its own: one paused at its old maxCost wakes at its next call under a higher one. */
|
|
564
641
|
maxCost?: string;
|
|
642
|
+
/** Whether a call that reaches it paused (an exec, a file, a terminal, a preview's visitor) resumes it from now. false: such a call answers 409 sandbox_paused and it stays paused until its own `:resume`. */
|
|
643
|
+
autoWake?: boolean;
|
|
644
|
+
/** Seconds from now until Runtime deletes it, as its delete does: final, and it can't be undone. Sent again before then, it renews it; 0 takes its end off (kept until deleted). At least 0. At most 315360000. */
|
|
645
|
+
deleteAfterSeconds?: number;
|
|
646
|
+
/** true refuses its delete (409 `delete_protected`) until an update sends false; while true, its time limit pauses it instead of deleting it. Not while it has a `deleteAt`, unless the same update sends `deleteAfterSeconds` 0. */
|
|
647
|
+
deleteProtection?: boolean;
|
|
565
648
|
}
|
|
566
649
|
/** One step of an act: a mouse move, click, drag or scroll, typed text, a key chord, or a wait. */
|
|
567
650
|
export interface Action {
|
|
@@ -785,23 +868,23 @@ export declare class SandboxFiles {
|
|
|
785
868
|
#private;
|
|
786
869
|
constructor(client: Sandboxes, id: string);
|
|
787
870
|
/** Returns a file's bytes. */
|
|
788
|
-
read(path: string, query?: Omit<SandboxReadQuery, "path"
|
|
871
|
+
read(path: string, query?: Omit<SandboxReadQuery, "path"> & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
789
872
|
/** Writes the request's bytes to a file as they come, of any size (Content-Length required), its folders made: the file whole when they all came, or as it was. With offset, they are written into it in place. */
|
|
790
|
-
write(path: string, data: Uint8Array | string, query?: Omit<SandboxWriteQuery, "path"
|
|
873
|
+
write(path: string, data: Uint8Array | string, query?: Omit<SandboxWriteQuery, "path"> & RequestOptions, options?: RequestOptions): Promise<FileWritten>;
|
|
791
874
|
/** Removes a file, a link or a directory (recursive for one with contents). One missing is success, removed false. */
|
|
792
875
|
remove(path: string, input?: Omit<FileRemove, "path">, options?: RequestOptions): Promise<FileRemoved>;
|
|
793
876
|
/** Returns what is at a path: a file, a directory or a link, or nothing (exists false). With sha256=true, a file's SHA-256 too. */
|
|
794
|
-
stat(path: string, query?: Omit<SandboxStatQuery, "path"
|
|
877
|
+
stat(path: string, query?: Omit<SandboxStatQuery, "path"> & RequestOptions, options?: RequestOptions): Promise<FileInfo>;
|
|
795
878
|
/** Lists a directory's entries in path order, to a depth. */
|
|
796
|
-
list(query?: SandboxListFilesQuery, options?: RequestOptions): Promise<FileList>;
|
|
879
|
+
list(query?: SandboxListFilesQuery & RequestOptions, options?: RequestOptions): Promise<FileList>;
|
|
797
880
|
/** Returns a folder as a tar archive (`application/x-tar`, or `application/gzip` with gzip), packed by tar in the sandbox as it streams, of any size; its entries are relative to the folder (`./a.txt`). A folder that fails part way (a file it may not read, or one that changes as it is read) ends as an archive every tar reader refuses, never as a short one that reads whole. At most 4 at once in a sandbox. A paused sandbox is woken first. */
|
|
798
|
-
downloadFolder(path: string, query?: Omit<SandboxDownloadFolderQuery, "path"
|
|
881
|
+
downloadFolder(path: string, query?: Omit<SandboxDownloadFolderQuery, "path"> & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
799
882
|
/** Unpacks the request's tar archive (gzip-compressed or not, told by its first bytes) into a folder, made with its parents, by tar in the sandbox as the bytes arrive, of any size, nothing of it kept on disk but what tar writes; returns once tar has ended, or 400 `invalid_archive` with what tar said. A paused sandbox is woken first. */
|
|
800
|
-
uploadFolder(path: string, data: Uint8Array | string, query?: Omit<SandboxUploadFolderQuery, "path"
|
|
883
|
+
uploadFolder(path: string, data: Uint8Array | string, query?: Omit<SandboxUploadFolderQuery, "path"> & RequestOptions, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
801
884
|
/** Begins a folder's upload in parts: tar starts in the sandbox, unpacking into the folder each part as it arrives. Send the parts in order by offset (writeFolderUpload), then commitFolderUpload; an upload no call names for 10 minutes is ended. A paused sandbox is woken first. */
|
|
802
885
|
beginFolderUpload(path: string, input?: Omit<FolderUploadBegin, "path">, options?: RequestOptions): Promise<FolderUpload>;
|
|
803
886
|
/** Sends the request's bytes, a part of the archive at its offset, into tar's input as they arrive, of any size, and returns the bytes received in all once tar took them. A part past them is refused 409 `upload_incomplete`, naming them: send the parts in order. */
|
|
804
|
-
writeFolderUpload(upload: string, data: Uint8Array | string, query?: SandboxWriteFolderUploadQuery, options?: RequestOptions): Promise<FolderUploadReceived>;
|
|
887
|
+
writeFolderUpload(upload: string, data: Uint8Array | string, query?: SandboxWriteFolderUploadQuery & RequestOptions, options?: RequestOptions): Promise<FolderUploadReceived>;
|
|
805
888
|
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said. A front that restarts meanwhile returns 503 `run_goes_on`; sent again, it returns how tar ended. An upload no call has named for 10 minutes since its last part or commit is ended. */
|
|
806
889
|
commitFolderUpload(upload: string, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
807
890
|
/** Stops a folder upload's tar; what it unpacked so far stays. */
|
|
@@ -820,11 +903,13 @@ export declare class SandboxProcesses {
|
|
|
820
903
|
#private;
|
|
821
904
|
constructor(client: Sandboxes, id: string);
|
|
822
905
|
/** Returns a process's output after a cursor, and the cursor to read on from. The latest 1 MiB is kept; truncated says when the cursor fell behind. */
|
|
823
|
-
output(process: string, query?: SandboxProcessOutputQuery, options?: RequestOptions): Promise<ProcessOutput>;
|
|
906
|
+
output(process: string, query?: SandboxProcessOutputQuery & RequestOptions, options?: RequestOptions): Promise<ProcessOutput>;
|
|
824
907
|
/** Sends input to a process started with stdinOpen or a pty, and returns how much of its input it has taken. */
|
|
825
908
|
write(process: string, input?: ProcessInput, options?: RequestOptions): Promise<ProcessWritten>;
|
|
826
909
|
/** Sends a signal to a process and its group; a process that ended is not signalled, so a retry is safe. */
|
|
827
910
|
signal(process: string, input?: ProcessSignal, options?: RequestOptions): Promise<Process>;
|
|
911
|
+
/** Resizes the terminal of a process started with a pty (its window's columns and rows, which the process is told by SIGWINCH), and returns the process; refused 409 for a process without one. A process that ended is left as it is, so a retry is safe. */
|
|
912
|
+
resize(process: string, input: Terminal, options?: RequestOptions): Promise<Process>;
|
|
828
913
|
/** Lists a sandbox's processes, newest first: those running and those that ended lately. */
|
|
829
914
|
list(options?: RequestOptions): Promise<ProcessList>;
|
|
830
915
|
}
|
|
@@ -837,7 +922,14 @@ export declare class SandboxNetworkCalls {
|
|
|
837
922
|
/** Replaces where a sandbox may connect out, for its next connection and within a second for its open ones: those the new rules refuse are cut. */
|
|
838
923
|
set(input?: NetworkRules, options?: RequestOptions): Promise<SandboxNetwork>;
|
|
839
924
|
}
|
|
840
|
-
/**
|
|
925
|
+
/** A sandbox's previews. */
|
|
926
|
+
export declare class SandboxPreviews {
|
|
927
|
+
#private;
|
|
928
|
+
constructor(client: Previews, id: string);
|
|
929
|
+
/** Shares a port of a machine at an HTTPS address and returns its url and, for a private one, a token; or changes its visibility and sites when it is shared. Asked again, the same preview. */
|
|
930
|
+
create(port: number, input?: Omit<PreviewCreate, "port">, options?: RequestOptions): Promise<Preview>;
|
|
931
|
+
}
|
|
932
|
+
/** One of sandboxes: A Linux machine with its own kernel, made in milliseconds, paused with its memory kept when idle and resumed where it was. Its life: running, then idle, then paused, until you delete it. A paused sandbox is kept with its memory and disk until it is deleted: it has no time limit, no retention period and no expiry, and nothing deletes it for its age. Every 30 days a sandbox stays paused, counted from its `pausedAt`, a `sandbox.still_paused` event is written for its organization. */
|
|
841
933
|
export declare class Sandbox {
|
|
842
934
|
#private;
|
|
843
935
|
/** What it was when last read. */
|
|
@@ -845,11 +937,60 @@ export declare class Sandbox {
|
|
|
845
937
|
readonly files: SandboxFiles;
|
|
846
938
|
readonly processes: SandboxProcesses;
|
|
847
939
|
readonly network: SandboxNetworkCalls;
|
|
940
|
+
readonly previews: SandboxPreviews;
|
|
848
941
|
constructor(client: Sandboxes, info: SandboxInfo);
|
|
849
942
|
/** Its id. */
|
|
850
943
|
get id(): string;
|
|
944
|
+
/** Its vCPUs; its product's default when omitted. At least 1. */
|
|
945
|
+
get vcpu(): number | undefined;
|
|
946
|
+
/** Its memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`1.5`). Its product's default when omitted. At least 1. */
|
|
947
|
+
get memoryGB(): number | undefined;
|
|
948
|
+
/** Its disk in GB (1 GB is 1,024 MiB), to the MiB. When omitted, its product's default or its image's size, whichever is larger. At least 1. */
|
|
949
|
+
get diskGB(): number | undefined;
|
|
950
|
+
/** The image it boots, by name (its newest version), `name:version` or ID; Runtime's default image when omitted. */
|
|
951
|
+
get image(): string | undefined;
|
|
952
|
+
/** The secrets it may get, by name, at most 64: only those of them whose scope admits it; [] none; every one whose scope admits it when omitted. A name with no secret yet takes effect once that secret is created. Fixed for its life: a fork or a copy of a snapshot keeps it. At most 64 items. */
|
|
953
|
+
get secrets(): string[] | undefined;
|
|
954
|
+
/** The command it starts at every fresh boot and keeps running, as a service: a web server, a runner, a desktop. A wake with its memory kept does not start it again. Its image's when omitted. */
|
|
955
|
+
get start(): MachineStart | undefined;
|
|
956
|
+
/** Who every command, process, terminal and code run in it runs as when the call names no `user`: `runtime` (uid 1000, with passwordless sudo) or `root`. Its image's when omitted, else `runtime`. */
|
|
957
|
+
get user(): "runtime" | "root" | (string & {}) | undefined;
|
|
958
|
+
/** Its product's kind: `sandbox` for a sandbox, `app` for an app, and so on. */
|
|
959
|
+
get object(): "sandbox" | "function" | "app" | "site" | "ci" | "browser" | "desktop" | "notebook" | "workspace" | "container" | "build" | "agent.session" | (string & {});
|
|
960
|
+
/** Its name, unique in its project. */
|
|
961
|
+
get name(): string | undefined;
|
|
962
|
+
/** Where it is. */
|
|
963
|
+
get state(): "starting" | "running" | "paused" | "deleted" | "error" | (string & {});
|
|
964
|
+
/** Its labels. */
|
|
965
|
+
get labels(): Record<string, string>;
|
|
966
|
+
/** When it was created. */
|
|
967
|
+
get createdAt(): string | undefined;
|
|
968
|
+
/** When it was deleted: a delete's answer alone. */
|
|
969
|
+
get deletedAt(): string | undefined;
|
|
970
|
+
/** Its revision, changed by every change to it: what an update's If-Match names. */
|
|
971
|
+
get revision(): number | undefined;
|
|
972
|
+
/** Seconds with nothing happening before it pauses; 0 never. Default: 300. */
|
|
973
|
+
get idlePauseSeconds(): number | undefined;
|
|
974
|
+
/** The most it may cost in all, in US dollars; none when it has no such cap. */
|
|
975
|
+
get maxCost(): string | undefined;
|
|
976
|
+
/** Whether a call that reaches it paused resumes it; false: only its own resume does, and such a call answers 409 sandbox_paused. Default: true. */
|
|
977
|
+
get autoWake(): boolean | undefined;
|
|
978
|
+
/** Its run's exit code, once its run ended; none for one a signal or its timeout ended. */
|
|
979
|
+
get exitCode(): number | undefined;
|
|
980
|
+
/** When its run ended. */
|
|
981
|
+
get endedAt(): string | undefined;
|
|
982
|
+
/** When its pause began (or its run ended), while it is paused. */
|
|
983
|
+
get pausedAt(): string | undefined;
|
|
984
|
+
/** A create's answer alone, for a start with a ready check: how its wait went. */
|
|
985
|
+
get ready(): MachineReady | undefined;
|
|
986
|
+
/** When Runtime deletes it (`deleteAfterSeconds`), finally: it can't be undone, as its delete can't; none: kept until deleted. */
|
|
987
|
+
get deleteAt(): string | undefined;
|
|
988
|
+
/** Whether its delete is refused (409 `delete_protected`) until an update turns this off. */
|
|
989
|
+
get deleteProtection(): boolean | undefined;
|
|
990
|
+
/** Makes one and returns it, as `new Runtime().sandboxes.create()` does, with a client of its own: `RUNTIME_API_KEY`, or the key `options` names. */
|
|
991
|
+
static create(input?: SandboxCreate, options?: ClientOptions & RequestOptions): Promise<Sandbox>;
|
|
851
992
|
/** Returns a sandbox. */
|
|
852
|
-
refresh(query?: SandboxGetQuery, options?: RequestOptions): Promise<this>;
|
|
993
|
+
refresh(query?: SandboxGetQuery & RequestOptions, options?: RequestOptions): Promise<this>;
|
|
853
994
|
/** Deletes a sandbox, its memory and its disk. */
|
|
854
995
|
delete(options?: RequestOptions): Promise<SandboxInfo>;
|
|
855
996
|
/** Pauses a sandbox with its memory and disk kept. A call to it resumes it. */
|
|
@@ -859,32 +1000,36 @@ export declare class Sandbox {
|
|
|
859
1000
|
/** Runs a command as a process and returns it once it ended, with its output; with wait false, at once, while it runs. A paused sandbox is resumed first. Asked again with the same Idempotency-Key, it runs nothing more: it returns the first run's process, waiting for its end while it runs. */
|
|
860
1001
|
exec(cmd: string | string[], input?: Omit<ExecRequest, "cmd">, options?: RequestOptions): Promise<Process>;
|
|
861
1002
|
/** Returns a sandbox's CPU, memory, disks and pressure, as its host reads them from the sandbox's own cgroup over a fifth of a second: never a call into the sandbox, so it does not wake a paused one nor keep one from its idle pause. One that is not running has no reading. */
|
|
862
|
-
metrics(query?: SandboxMetricsQuery, options?: RequestOptions): Promise<SandboxMetrics>;
|
|
1003
|
+
metrics(query?: SandboxMetricsQuery & RequestOptions, options?: RequestOptions): Promise<SandboxMetrics>;
|
|
863
1004
|
/** Copies a sandbox as it is now, memory and disk, into `count` copies of its own, each running on its host. Asked again with the same Idempotency-Key, it returns the same copies. */
|
|
864
1005
|
fork(input?: ForkRequest, options?: RequestOptions): Promise<Forked>;
|
|
865
1006
|
/** Keeps a sandbox's memory and disk as they are now, a snapshot to start sandboxes from; with `image`, its disk alone as that image's next version. The sandbox runs on. Asked again with the same Idempotency-Key, it returns the same snapshot. */
|
|
866
1007
|
snapshot(input?: SnapshotRequest, options?: RequestOptions): Promise<Stored>;
|
|
867
|
-
/** Changes its name, labels, idle pause, maxCost, environment or sizes; each field left out stays as it is. A running one holds a changed environment before this answers (a paused one's at its wake): each process it starts after the answer has it, and its running processes keep the one they started with. Its vCPUs, memory and disk grow while it runs, its commands running on
|
|
1008
|
+
/** Changes its name, labels, idle pause, maxCost, autoWake, lifetime, delete protection, environment or sizes; each field left out stays as it is. A lifetime (`deleteAfterSeconds`) sent again before its end moves the end to that many seconds from now; 0 takes it off. A lifetime is refused (409 `delete_protected`) while `deleteProtection` is true. A running one holds a changed environment before this answers (a paused one's at its wake): each process it starts after the answer has it, and its running processes keep the one they started with. Its vCPUs, memory and disk grow while it runs, its commands running on. One paused or stopped is not woken for it: judged at once as a live resize is (past the vCPUs it was made with 409, over its organization's limits `quota_exceeded`), its new sizes are returned at once, and its next wake grows it to them before the call that woke it runs. A smaller size, or a machine starting or failed, is refused 409 naming why, and nothing is changed. With If-Match, made only while its revision is that one, else 412. Sent again with the same Idempotency-Key and body while it is the latest change, it returns the current state and changes nothing; the same key with a different body returns 409 idempotency_key_reused. */
|
|
868
1009
|
update(input?: MachineUpdate, options?: RequestOptions): Promise<this>;
|
|
869
1010
|
/** Returns what a sandbox's screen shows now, as `image/png` (or `image/jpeg`): its X display `:1`, whole. Refused 409 `display_not_running` when no display runs. A paused sandbox is resumed first. */
|
|
870
|
-
screenshot(query?: SandboxScreenshotQuery, options?: RequestOptions): Promise<Uint8Array>;
|
|
1011
|
+
screenshot(query?: SandboxScreenshotQuery & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
871
1012
|
/** Moves, clicks, drags and scrolls the mouse and types on the keyboard of a sandbox's screen (its X display `:1`), each step in turn as one command, and returns where the mouse is then. It stops at the first step that fails, refused 409 `act_failed` naming it; refused 409 `display_not_running` when no display runs. A paused sandbox is resumed first. */
|
|
872
1013
|
act(actions: Action[], input?: Omit<ActRequest, "actions">, options?: RequestOptions): Promise<Acted>;
|
|
873
1014
|
/** Runs a cell of Python in a sandbox as a notebook does, in a Jupyter kernel it keeps running for the cell's `context`: variables, imports and functions stay for the next cell. Returns what it printed, its values and displays (text, HTML, images such as charts), and its exception with its traceback. The context's kernel starts on its first cell. A cell past `timeoutSeconds` is interrupted and its context kept. Refused 409 `kernel_not_installed` when the image has no ipykernel. A paused sandbox is resumed first. */
|
|
874
1015
|
runCode(code: string, input?: Omit<RunCode, "code">, options?: RequestOptions): Promise<CodeRun>;
|
|
1016
|
+
/** Starts a command and returns its process at once, while the command runs on. Its output is read with `processes.output` and it is stopped with `processes.signal`. */
|
|
1017
|
+
spawn(cmd: string | string[], input?: Omit<ExecRequest, "cmd" | "wait">, options?: RequestOptions): Promise<Process>;
|
|
875
1018
|
/** Runs a command and yields its output as it is written, stdout and stderr in order; once it ends, wait() returns the process with its exit code. */
|
|
876
1019
|
execStream(cmd: string | string[], input?: Omit<ExecRequest, "cmd">, options?: RequestOptions): Stream<OutputChunk, Process>;
|
|
1020
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
1021
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
877
1022
|
}
|
|
878
|
-
/** A Linux machine with its own kernel, made in milliseconds, paused with its memory kept when idle and resumed where it was. Its life: running, then idle, then paused, until you delete it. A paused sandbox is kept with its memory and disk until it is deleted: it has no time limit, no retention period and no expiry, and nothing deletes it for its age. Every 30 days a sandbox stays paused
|
|
1023
|
+
/** A Linux machine with its own kernel, made in milliseconds, paused with its memory kept when idle and resumed where it was. Its life: running, then idle, then paused, until you delete it. A paused sandbox is kept with its memory and disk until it is deleted: it has no time limit, no retention period and no expiry, and nothing deletes it for its age. Every 30 days a sandbox stays paused, counted from its `pausedAt`, a `sandbox.still_paused` event is written for its organization. */
|
|
879
1024
|
export declare class Sandboxes {
|
|
880
|
-
|
|
1025
|
+
readonly transport: Transport;
|
|
881
1026
|
constructor(transport: Transport);
|
|
882
1027
|
/** Creates a sandbox. Asked again with the same Idempotency-Key, it returns the same sandbox. */
|
|
883
1028
|
create(input?: SandboxCreate, options?: RequestOptions): Promise<Sandbox>;
|
|
884
1029
|
/** Returns a sandbox. */
|
|
885
|
-
get(id: string, query?: SandboxGetQuery, options?: RequestOptions): Promise<Sandbox>;
|
|
1030
|
+
get(id: string, query?: SandboxGetQuery & RequestOptions, options?: RequestOptions): Promise<Sandbox>;
|
|
886
1031
|
/** Lists the project's sandboxes, newest first. */
|
|
887
|
-
list(query?: SandboxListQuery, options?: RequestOptions): Paginated<SandboxInfo>;
|
|
1032
|
+
list(query?: SandboxListQuery & RequestOptions, options?: RequestOptions): Paginated<SandboxInfo>;
|
|
888
1033
|
/** Deletes a sandbox, its memory and its disk. */
|
|
889
1034
|
delete(id: string, options?: RequestOptions): Promise<SandboxInfo>;
|
|
890
1035
|
/** Pauses a sandbox with its memory and disk kept. A call to it resumes it. */
|
|
@@ -894,31 +1039,33 @@ export declare class Sandboxes {
|
|
|
894
1039
|
/** Runs a command as a process and returns it once it ended, with its output; with wait false, at once, while it runs. A paused sandbox is resumed first. Asked again with the same Idempotency-Key, it runs nothing more: it returns the first run's process, waiting for its end while it runs. */
|
|
895
1040
|
exec(id: string, input: ExecRequest, options?: RequestOptions): Promise<Process>;
|
|
896
1041
|
/** Returns a file's bytes. */
|
|
897
|
-
read(id: string, query: SandboxReadQuery, options?: RequestOptions): Promise<Uint8Array>;
|
|
1042
|
+
read(id: string, query: SandboxReadQuery & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
898
1043
|
/** Writes the request's bytes to a file as they come, of any size (Content-Length required), its folders made: the file whole when they all came, or as it was. With offset, they are written into it in place. */
|
|
899
|
-
write(id: string, data: Uint8Array | string, query: SandboxWriteQuery, options?: RequestOptions): Promise<FileWritten>;
|
|
1044
|
+
write(id: string, data: Uint8Array | string, query: SandboxWriteQuery & RequestOptions, options?: RequestOptions): Promise<FileWritten>;
|
|
900
1045
|
/** Returns a process's output after a cursor, and the cursor to read on from. The latest 1 MiB is kept; truncated says when the cursor fell behind. */
|
|
901
|
-
processOutput(id: string, process: string, query?: SandboxProcessOutputQuery, options?: RequestOptions): Promise<ProcessOutput>;
|
|
1046
|
+
processOutput(id: string, process: string, query?: SandboxProcessOutputQuery & RequestOptions, options?: RequestOptions): Promise<ProcessOutput>;
|
|
902
1047
|
/** Sends input to a process started with stdinOpen or a pty, and returns how much of its input it has taken. */
|
|
903
1048
|
writeProcess(id: string, process: string, input?: ProcessInput, options?: RequestOptions): Promise<ProcessWritten>;
|
|
904
1049
|
/** Sends a signal to a process and its group; a process that ended is not signalled, so a retry is safe. */
|
|
905
1050
|
signalProcess(id: string, process: string, input?: ProcessSignal, options?: RequestOptions): Promise<Process>;
|
|
1051
|
+
/** Resizes the terminal of a process started with a pty (its window's columns and rows, which the process is told by SIGWINCH), and returns the process; refused 409 for a process without one. A process that ended is left as it is, so a retry is safe. */
|
|
1052
|
+
resizeProcess(id: string, process: string, input: Terminal, options?: RequestOptions): Promise<Process>;
|
|
906
1053
|
/** Lists a sandbox's processes, newest first: those running and those that ended lately. */
|
|
907
1054
|
listProcesses(id: string, options?: RequestOptions): Promise<ProcessList>;
|
|
908
1055
|
/** Removes a file, a link or a directory (recursive for one with contents). One missing is success, removed false. */
|
|
909
1056
|
remove(id: string, input: FileRemove, options?: RequestOptions): Promise<FileRemoved>;
|
|
910
1057
|
/** Returns what is at a path: a file, a directory or a link, or nothing (exists false). With sha256=true, a file's SHA-256 too. */
|
|
911
|
-
stat(id: string, query: SandboxStatQuery, options?: RequestOptions): Promise<FileInfo>;
|
|
1058
|
+
stat(id: string, query: SandboxStatQuery & RequestOptions, options?: RequestOptions): Promise<FileInfo>;
|
|
912
1059
|
/** Lists a directory's entries in path order, to a depth. */
|
|
913
|
-
listFiles(id: string, query?: SandboxListFilesQuery, options?: RequestOptions): Promise<FileList>;
|
|
1060
|
+
listFiles(id: string, query?: SandboxListFilesQuery & RequestOptions, options?: RequestOptions): Promise<FileList>;
|
|
914
1061
|
/** Returns a folder as a tar archive (`application/x-tar`, or `application/gzip` with gzip), packed by tar in the sandbox as it streams, of any size; its entries are relative to the folder (`./a.txt`). A folder that fails part way (a file it may not read, or one that changes as it is read) ends as an archive every tar reader refuses, never as a short one that reads whole. At most 4 at once in a sandbox. A paused sandbox is woken first. */
|
|
915
|
-
downloadFolder(id: string, query: SandboxDownloadFolderQuery, options?: RequestOptions): Promise<Uint8Array>;
|
|
1062
|
+
downloadFolder(id: string, query: SandboxDownloadFolderQuery & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
916
1063
|
/** Unpacks the request's tar archive (gzip-compressed or not, told by its first bytes) into a folder, made with its parents, by tar in the sandbox as the bytes arrive, of any size, nothing of it kept on disk but what tar writes; returns once tar has ended, or 400 `invalid_archive` with what tar said. A paused sandbox is woken first. */
|
|
917
|
-
uploadFolder(id: string, data: Uint8Array | string, query: SandboxUploadFolderQuery, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
1064
|
+
uploadFolder(id: string, data: Uint8Array | string, query: SandboxUploadFolderQuery & RequestOptions, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
918
1065
|
/** Begins a folder's upload in parts: tar starts in the sandbox, unpacking into the folder each part as it arrives. Send the parts in order by offset (writeFolderUpload), then commitFolderUpload; an upload no call names for 10 minutes is ended. A paused sandbox is woken first. */
|
|
919
1066
|
beginFolderUpload(id: string, input: FolderUploadBegin, options?: RequestOptions): Promise<FolderUpload>;
|
|
920
1067
|
/** Sends the request's bytes, a part of the archive at its offset, into tar's input as they arrive, of any size, and returns the bytes received in all once tar took them. A part past them is refused 409 `upload_incomplete`, naming them: send the parts in order. */
|
|
921
|
-
writeFolderUpload(id: string, upload: string, data: Uint8Array | string, query?: SandboxWriteFolderUploadQuery, options?: RequestOptions): Promise<FolderUploadReceived>;
|
|
1068
|
+
writeFolderUpload(id: string, upload: string, data: Uint8Array | string, query?: SandboxWriteFolderUploadQuery & RequestOptions, options?: RequestOptions): Promise<FolderUploadReceived>;
|
|
922
1069
|
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said. A front that restarts meanwhile returns 503 `run_goes_on`; sent again, it returns how tar ended. An upload no call has named for 10 minutes since its last part or commit is ended. */
|
|
923
1070
|
commitFolderUpload(id: string, upload: string, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
924
1071
|
/** Stops a folder upload's tar; what it unpacked so far stays. */
|
|
@@ -934,17 +1081,17 @@ export declare class Sandboxes {
|
|
|
934
1081
|
/** Returns where a sandbox may connect out. */
|
|
935
1082
|
getNetwork(id: string, options?: RequestOptions): Promise<SandboxNetwork>;
|
|
936
1083
|
/** Returns a sandbox's CPU, memory, disks and pressure, as its host reads them from the sandbox's own cgroup over a fifth of a second: never a call into the sandbox, so it does not wake a paused one nor keep one from its idle pause. One that is not running has no reading. */
|
|
937
|
-
metrics(id: string, query?: SandboxMetricsQuery, options?: RequestOptions): Promise<SandboxMetrics>;
|
|
1084
|
+
metrics(id: string, query?: SandboxMetricsQuery & RequestOptions, options?: RequestOptions): Promise<SandboxMetrics>;
|
|
938
1085
|
/** Replaces where a sandbox may connect out, for its next connection and within a second for its open ones: those the new rules refuse are cut. */
|
|
939
1086
|
setNetwork(id: string, input?: NetworkRules, options?: RequestOptions): Promise<SandboxNetwork>;
|
|
940
1087
|
/** Copies a sandbox as it is now, memory and disk, into `count` copies of its own, each running on its host. Asked again with the same Idempotency-Key, it returns the same copies. */
|
|
941
1088
|
fork(id: string, input?: ForkRequest, options?: RequestOptions): Promise<Forked>;
|
|
942
1089
|
/** Keeps a sandbox's memory and disk as they are now, a snapshot to start sandboxes from; with `image`, its disk alone as that image's next version. The sandbox runs on. Asked again with the same Idempotency-Key, it returns the same snapshot. */
|
|
943
1090
|
snapshot(id: string, input?: SnapshotRequest, options?: RequestOptions): Promise<Stored>;
|
|
944
|
-
/** Changes its name, labels, idle pause, maxCost, environment or sizes; each field left out stays as it is. A running one holds a changed environment before this answers (a paused one's at its wake): each process it starts after the answer has it, and its running processes keep the one they started with. Its vCPUs, memory and disk grow while it runs, its commands running on
|
|
1091
|
+
/** Changes its name, labels, idle pause, maxCost, autoWake, lifetime, delete protection, environment or sizes; each field left out stays as it is. A lifetime (`deleteAfterSeconds`) sent again before its end moves the end to that many seconds from now; 0 takes it off. A lifetime is refused (409 `delete_protected`) while `deleteProtection` is true. A running one holds a changed environment before this answers (a paused one's at its wake): each process it starts after the answer has it, and its running processes keep the one they started with. Its vCPUs, memory and disk grow while it runs, its commands running on. One paused or stopped is not woken for it: judged at once as a live resize is (past the vCPUs it was made with 409, over its organization's limits `quota_exceeded`), its new sizes are returned at once, and its next wake grows it to them before the call that woke it runs. A smaller size, or a machine starting or failed, is refused 409 naming why, and nothing is changed. With If-Match, made only while its revision is that one, else 412. Sent again with the same Idempotency-Key and body while it is the latest change, it returns the current state and changes nothing; the same key with a different body returns 409 idempotency_key_reused. */
|
|
945
1092
|
update(id: string, input?: MachineUpdate, options?: RequestOptions): Promise<SandboxInfo>;
|
|
946
1093
|
/** Returns what a sandbox's screen shows now, as `image/png` (or `image/jpeg`): its X display `:1`, whole. Refused 409 `display_not_running` when no display runs. A paused sandbox is resumed first. */
|
|
947
|
-
screenshot(id: string, query?: SandboxScreenshotQuery, options?: RequestOptions): Promise<Uint8Array>;
|
|
1094
|
+
screenshot(id: string, query?: SandboxScreenshotQuery & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
948
1095
|
/** Moves, clicks, drags and scrolls the mouse and types on the keyboard of a sandbox's screen (its X display `:1`), each step in turn as one command, and returns where the mouse is then. It stops at the first step that fails, refused 409 `act_failed` naming it; refused 409 `display_not_running` when no display runs. A paused sandbox is resumed first. */
|
|
949
1096
|
act(id: string, input: ActRequest, options?: RequestOptions): Promise<Acted>;
|
|
950
1097
|
/** Runs a cell of Python in a sandbox as a notebook does, in a Jupyter kernel it keeps running for the cell's `context`: variables, imports and functions stay for the next cell. Returns what it printed, its values and displays (text, HTML, images such as charts), and its exception with its traceback. The context's kernel starts on its first cell. A cell past `timeoutSeconds` is interrupted and its context kept. Refused 409 `kernel_not_installed` when the image has no ipykernel. A paused sandbox is resumed first. */
|