Expand description
dvm.run’s REST API: what it takes and returns. dvm.run’s controller serves it, and the SDKs and its panel call it; the controller, the panel and the Rust SDK check a sandbox’s spec with the same code.
A type that holds an invariant (a checked spec, an image reference) keeps its fields private; a plain record of what the controller answers has them public.
Structs§
- ApiError
- What the controller answers instead, when it refuses a request: the body of every response that isn’t a success.
- ApiKey
- One of a user’s API keys, as they list them: never the key itself, of
which the controller keeps only the SHA-256. A request that bears it
(
Authorization: Bearer <key>) acts as its user. - Byte
Chunk - Bytes as a program wrote them, or as it’s given them (its stdin, a file written into its sandbox): base64 in JSON, since they needn’t be UTF-8.
- Capacity
- CPUs and memory: what a runner hands out, and what a run takes of it
(
SandboxSpec::footprint). - CliLogin
- A login from a terminal, as its page shows it to the user who may approve it.
- Collect
CliLogin - What a terminal asks for its key with:
POST /api/cli-logins/key. - Command
Number - A command’s number in its sandbox’s execution, the controller’s: 1, 2, … in the order the commands were sent. A replay’s commands have their recording’s numbers.
- Command
Signal - A signal for a command’s process,
POST …/commands/{n}/signal’s body: 15 for SIGTERM, 9 for SIGKILL. It goes to the command’s process alone, not what that started, and to none once it exited. - Created
ApiKey - A key just made, and the key itself: shown this once.
- Environment
Variable - An environment variable the program is given.
- Execution
- A sandbox’s execution,
GET /api/executions/{id}: what it ran, one log from its start to its end, under its sandbox’s id. Its spec, its seed among it; its run, how and when it ended, and its log’s size; each command it was sent, as it ran; and its replays. - File
Mode - A file’s mode, as a file written into a sandbox is made with: its
permission bits, at most
0o7777;0o644unless given. - Image
Reference - A Docker image reference, as
docker runtakes it:alpine,alpine:3.20,ghcr.io/owner/name:tag,name@sha256:<hex>. - Invalid
Image Reference - Why a text isn’t an image reference.
- Invalid
RunAction - An action the run’s state doesn’t allow.
- Machine
State - What dvm’s kernel holds at a replay’s stop: its processes, as dvm describes them.
- Me
- The user signed in:
GET /api/me. - Memory
Region - A region of a process’s memory, as
/proc/<pid>/mapslists it: its addresses in hex, its protection (r-x), and what it maps, if named. - NewApi
Key - A key to make:
POST /api/keys. - NewCli
Login - A login to start from a terminal:
POST /api/cli-logins, with no session or key. - NewCommand
- A command to run in a sandbox,
POST /api/sandboxes/{id}/commands’ body. - NewReplay
- How to start a replay,
POST /api/executions/{id}/replays’ body, which may be left out: played to its end, watching the eventswatchasks for, if any (WatchedEvents); or held at its start, waiting for a seek, which watches nothing. - Open
File - An open file of a process: its descriptor, where it leads, as
/proc/<pid>/fd/<n>says (a path,pipe:[n],socket:[n]), and its offset. - Process
State - A process at a stop: its id and its parent’s (0 for the first’s), its name, the program it runs, its directory, its threads, its open files, and its memory’s regions.
- Replay
Stop - A replay held at a moment, and the machine there: what a seek answers. Seeking back starts the replay again, and goes forward to the moment.
- Run
- A sandbox’s run, of its spec, recorded; or a replay of its recording.
- RunId
- A run’s id, the controller’s.
- RunOutput
- What a run’s program has written so far, as text: bytes that aren’t UTF-8 are replaced.
- Sandbox
- A sandbox: one run of its spec, recorded, started as it’s made, and the replays of its recording. Its id is its run’s.
- Sandbox
Command - A command sent to a sandbox, or one its replay ran again.
- Sandbox
Draft - A sandbox’s spec as a person writes it, unchecked: what the panel’s form
holds, and what the controller takes to create a sandbox. Each field but
the image may be left out, for
dvm run’s defaults. - Sandbox
Id - A sandbox’s id: its run’s, as its runner and its output know it.
- Sandbox
Path - A file’s path in a sandbox, checked: absolute, or from its image’s
working directory.
PUTandGET /api/sandboxes/{id}/files?path=name a file by it. - Sandbox
Spec - What a sandbox runs, checked: each value is one
dvm runmay be given as it is. Only aSandboxDraftthat passes becomes one, deserialized too. - Sandboxes
Page - A page of the sandboxes a user sees,
GET /api/sandboxes?before=: the newest before the sandboxbefore, if given, newest first. - Seek
- Where to take a replay,
POST /api/replays/{id}/seek’s body. - Spec
Error - Why a draft isn’t a spec: the first field that’s wrong, and how.
- Started
CliLogin - A login started: the panel’s page that approves it, the code that page shows, and the token the terminal collects its key with, which only the terminal holds.
- Stopped
Thread - A thread at its stop: the operation it stops before, and what that does,
in dvm’s words (
syscall 263,a wait's end, by time). - Thread
State - A thread at a stop: its id, its name, its state (
Running,Ready,Waiting, as dvm’s kernel names them), and the syscall it waits in, or last waited in, which its state tells apart. - Thread
Wait - A syscall a thread waits in: its name and number, and its first argument (a futex’s address, a file’s descriptor), in hex.
- Timestamp
- A point in time: milliseconds since the Unix epoch, UTC.
- User
Limits - What a user who isn’t an admin may use.
- Watch
Kinds - The kinds of events a replay watches. Read and written as a list of
kinds; as text, as dvm’s
--watchtakes them, comma-separated, empty for none. - Watched
Event - An event a replay watched.
- Watched
Events - What a replay watched, and what it saw: its events, in the order the
replay made them, of a kind with more than
MOST_OF_A_KINDa sample spread over the run (its first in each thousandth of the run, and every so many beside, about the most); and how many of each kind there were, all of them.
Enums§
- Command
Line - What a command runs: its argv, as it is, its program found in the
sandbox’s
PATH; or a script, which the sandbox’s shell runs,/bin/bash -lcif its image has bash, else/bin/sh -c(dvm chooses once, as the sandbox starts). In JSON, an array of strings, or a string. - Command
Output Event - What
GET /api/sandboxes/{id}/commands/{n}/output?follow=truesends, each event’s data: a command’s output as it’s written, from the offsets asked for, and the command each time it changes. The stream ends once the command ended, after all it wrote. - Command
State - Where a command is:
- Command
Stdin - A command’s stdin.
- Event
Position - Where an event is among its thread’s operations (dvm’s positions).
- Moment
- Where a replay stops, as dvm names it (its
docs/05-replay.md, A moment): before one thread’s operation exactly, or at a time of the recorded run. - Output
Stream - One of a program’s output streams.
- Replay
Verdict - Whether a replay was the run it replayed, as far as can be seen from
outside: its exit code, and its output, byte for byte; a sandbox’s that
took commands, each command’s, in their order. A replay that isn’t the
run, where dvm sees it, fails instead (
RunState::Failed, dvm’s reason). - RunAction
- What an owner may do to a sandbox’s run, besides starting it, as it’s
made: the last segment of its path,
POST /api/sandboxes/{id}/{action}; a replay may be stopped,POST /api/replays/{id}/stop. - RunState
- Where a run is:
- Spec
Field - A field of a
SandboxDraft. - Watch
Kind - A kind of event a replay may watch: syscalls of a kind, or page faults.