cmd/cli).
Status: contract agreed 2026-11-20. Routes are being built in lanes and are not compiled yet. A route marked “planned (step N)” has no code yet (N is the step in the build plan). Migrations 153, 154 and 155 are named here; the SQL files do not exist yet.
Decisions (D1 to D10)
Node routes (loopback /v1/host/*)
Served by the shared host_probe::http router (feature http). Shipped in allternit-api (step 1.8) and on the ao shim (step 1.8b): the shim (127.0.0.1:8014, used by paired servers through ao fabric / allternit-factory pane fabric) merges the same router with the same logic. It takes its credentials from the ao identity file (~/.allternit/factory/fabric/identity.json): relay key = sha256_hex(deviceToken), owner = the paired user id, runtime id = runtimeId. An unpaired or expired identity refuses every relayed call and every action, exactly as an unpaired allternit-api does. Read routes need no approval. The one write route is POST /v1/host/actions.
Who may call. A call that came over the relay (
x-allternit-relayed) must carry the cloud’s relay signature (x-allternit-runtime-sig, -ts, x-allternit-owner, keyed by the runtime’s relay key, path without query). The cloud adds it only after its caller check and the pairing’s runtime:execute check, so an unsigned or badly signed relayed call gets 401 relay_unauthorized, and an unpaired runtime 503 not_paired. A local call (the Desktop UI on loopback) passes the same auth as every other protected local route. The forward socket is the exception: the relay opens it with no headers, and the cloud’s single-use ticket is its gate.
Findings cache. The updates read alone takes 45 to 60 s on dnf and Windows, so findings are never computed inside a request. The node serves its cached report with generatedAt (ISO time of the scan) and ageSec, and starts a background rescan when the report is older than 10 minutes or an action ran (refreshing: true). Before the first scan finishes the answer is 202 with findings: [] and generatedAt: null. Clients show that as “checking”, never as “no problems”.
HostSnapshot
HostService
{ name: string, unit: string, state: 'running' | 'stopped' | 'failed' | 'unknown', enabled: boolean, description?: string, pid?: number, memoryBytes?: number }
Linux uses systemd units, macOS uses launchd jobs, Windows uses services.
HostPort
{ port: number, protocol: 'tcp' | 'udp', address: string, process?: string, pid?: number, exposure: 'loopback' | 'lan' | 'public' }
HostUpdate
{ id: string, name: string, current?: string, available: string, security: boolean, kind: 'package' | 'os' }
HostFinding
{ id: string, severity: 'info' | 'warning' | 'critical', category: 'disk' | 'security' | 'service' | 'update' | 'config', title: string, detail: string, suggestedAction?: HostAction, reclaimBytes?: number }
reclaimBytes is set on space.clean findings (disk-full:<mount> and space-clean:<item>): the estimated bytes the suggested clean-up frees. It is only sent when there is an estimate.
LogLine
{ ts: string, unit: string, level: 'debug' | 'info' | 'warn' | 'error', message: string }
Logs are masked at the node (tokens, keys, passwords, and email local parts are replaced before the line leaves the machine). Retention is off by default: the cloud never stores log lines unless the user turns retention on for that computer.
Actions
POST /v1/host/actions body: { type, target, approval_id }. Response: { changeId: string, undo?: { type: string, target: string, label: string }, note?: string }. note is a short plain message for the user, for example when nothing needed to change.
The action list is fixed:
An unknown
type returns 400. A missing or unapproved approval_id returns 403 { error: "not_approved" } and changes nothing. The node accepts only the cloud’s ap1.<jti>.<exp>.<utag>.<sig> ids: it recomputes the HMAC with its relay key, its runtime id and the request’s type and target, rejects an expired id, and claims the id once in its change store, so a replay is 403. An unpaired node refuses every action. An action that needs admin rights the node does not have returns 403 { error: "needs_elevation" } (set up admin access with /v1/host/elevation/setup).
The runtime presence heartbeat (every 60 s) and the paired report carry the /v1/host/snapshot body as hostSample.
Cloud routes (allternit-cloud-api)
Rules:
- An asleep cloud computer answers the relay with 409
{ error: 'asleep', lastSample }. The console never wakes a computer to read it. - The relay allow-list on the cloud side is
is_allowed_runtime_pathincmd/allternit-cloud-api/src/routes/runtime_relay.rs:1686-1709. The prefix/v1is already allowed, so/v1/host/*needs no new entry. The capability strings atrelay.rs:42-47in the node are capability names, not paths. - Offline, CPU and disk alert rules push to the phone and Desktop.
Console list (GET /api/v1/computers/console)
Response: { "computers": [ConsoleComputer, ...] }. Web, CLI and iOS accept this shape.
Status values:
Group names, in this order:
Allternit Cloud, On your desk, Your servers, Shared with you.
Provider labels (#2757): Allternit Cloud for cloud computers (logo key allternit; Orgo is never shown), Paired for paired computers, Allternit Desktop for Desktop runtimes. Clients show the label the cloud sends and do not guess one.
Needs attention (one rule for every client)
A computer needs attention when any of these is true. Every client uses this rule and no other.
Findings (
/host/findings) show in the detail card’s Health tab; they are not part of this list rule.
asleep, stopped and suspended never need attention on their own: the user chose that state.
Metrics (GET /api/v1/computers/:id/metrics?window=24h)
Response: { "series": MetricSeries[] }. Each series is { metric, unit, points: [{ t, v }] } with t an ISO 8601 string.
Windows:
1h, 24h, 7d, 30d. Retention: 48 hours of raw 60 second samples, then 5 minute rollups kept for 30 days. Each node sends a hostSample (the /v1/host/snapshot body) in its 60 second presence heartbeat, and paired computers send it in their report. Without it a series stays empty.
Approval flow (two steps, no shortcut)
The action route never mints an approval. Minting does not touch the computer, so an asleep computer can be approved.
target is 1 to 256 characters with no control characters.
Approval id format: ap1.<jti>.<exp>.<utag>.<sig>, at most 129 characters, all [a-z0-9.].
The key is the per-runtime relay key (
runtime_devices.credential_hash, lowercase sha256_hex(device_token), used as ASCII bytes). The node already holds it. The node splits on ., recomputes sig with its own runtime id and the request type and target, compares in constant time, rejects an expired exp, then claims the whole id once. Full detail is in PR #2772.
Errors:
Port forward
POST /api/v1/computers/:id/forward with { remotePort } returns { url, ticket, expiresInSeconds } (30 seconds). Connect to url?ticket=. The ticket is single use. One WebSocket carries one raw TCP stream: binary frames both ways, no ready text frame. Mint one ticket per TCP connection. The node side is /v1/host/forward?port=N (1 to 65535): it dials 127.0.0.1:N, replies socket_ready (or socket_close code 1011), then pumps bytes as base64 socket_data. The relay connection is the authentication and no approval is needed.
Further console routes
Snippet runs reuse the approval mint above, one approval per computer (type
snippet.run, target = the snippet id). The command travels inside the approved action: the cloud sends POST /v1/host/actions with { type, target, approval_id, snippet: { id, name, script, elevated, timeoutSec } }, the node never fetches it and saves nothing, and snippet.id must equal target. Without snippet the node still reads <store>/snippets/<id>.json. The approval binds the snippet id; the cloud is the authority on the text.
For the routes above that act on cloud computers (restart, move, rebuild, backups, SSH keys), :id must be one of the caller’s own cloud rows. A paired or desktop id is 404 { error: "not_a_cloud_computer" }, and a computer on a host that cannot do the action is 501 { error: "not_supported", action }. Every error body also carries a plain message that clients can show as it is.
Location and template are picked on create: POST /api/v1/provisioned-instances takes optional location (nyc, chi, lon or syd) and template (an id from GET /api/v1/computers/templates). A location outside those four is 400 { error: "invalid_location", locations }, and a template not on the list is 400 { error: "invalid_template" }. A location asked of a computer that is not routed to Orgo is 400 { error: "location_not_available" }. A full city is 503 { error: "region_unavailable", location }, and no computer or row is left behind. The location is stored in provisioned_instances.location and shown as the console row’s region.
Alert push
Offline, CPU and disk rules push to the phone and Desktop. iOS uses APNs categoryCOMPUTER_ALERT. Android uses FCM with the same data keys.
Rule thresholds live in
computer_alert_rules (migrations 154 and 157). Built in step 2.8: the cloud checks every rule once a minute, sends one alert per incident, and sends nothing more until the computer is back under the threshold. The push also carries category: "COMPUTER_ALERT", event: "computer.alert", level: "needs_you", a title and body in plain words, and the link /computers/<id>. It goes out through Web Push (browsers and the Desktop app), APNs and FCM, follows the computer.alert notification switch and quiet hours, and is also put on the user event feed as computer.alert.
Thresholds:
offline is minutes (1 to 1440, default 10), cpu and disk are percent (1 to 100, default 90). CPU must stay over for durationMinutes (1 to 120, default 5). A computer that is asleep, stopped or starting is not offline. Errors carry { error, message }.
Agent-browser push
When a browser run needs the person, allternit-api forwards one of three pushes toPOST /push/notify/:runtime_id on the cloud (runtime relay signature, the owner is the paired user). The cloud rebuilds the data from an allowlist, so a credential value never reaches a device. It goes out through Web Push, APNs and FCM, follows quiet hours at the needs_you level, and opens /computers/COMPUTER_ID?run=RUN_ID.
Every push also carries
kind, category, actions ([{id, auth, destructive}]), event: "aci.attention" and level: "needs_you". Web Push and FCM read the action ids from actions. The contract is in cmd/allternit-cloud-api/openapi/device-tokens.yaml.
Approval, change record and undo
- The user approves one concrete action in the console. The cloud issues an
approval_idbound to that action, that computer and that user. - The node writes a change record first (runtime home, not the platform database), then runs the action, then logs to audit.
change_idpoints at the record. If the action can be reversed, the response carriesundo, which is itself an action that needs its own approval.
Restore point rule
- Cloud computer: the latest Orgo daily backup is recorded with the change record. If no backup is newer than 24 hours the console says so before the user approves.
- Paired computer: the change record only.
- On-demand Orgo disk snapshots are unsupported and show a plain message.
Privileged helper model
The probe never runs as root and no password is stored. Changes that need elevation use a one-time setup that the user approves:
Bundling (built in step 1.8b). The helper binary is
allternit-host-helper (built from platform/host-probe/src/bin/). The runtime looks for it next to its own executable (elevation::bundled_helper()), so it ships beside allternit-api on every OS, in the Desktop app and in every runtime update (runtime-package.cjs lists it with the other binaries):
Until the helper sits there,
GET /v1/host/elevation/plan and POST /v1/host/elevation/setup answer 503 helper_missing.
Port forward close code. GET /v1/host/forward answers 502 when its TCP dial fails. Every relay client then sends socket_close with code 1011 (local failure): the Desktop relay client, the agent daemon and the ao relay. A local socket that ends without a close frame also sends 1011.
SSH key model
Each computer has its own list of public keys incomputer_ssh_keys (migration 156): people’s keys, and short-lived agent keys that expire. Only public keys are stored. A pasted private key is refused with a plain message before anything is written. Keys are owner-only, like the other cloud settings routes.
- Cloud computers (built, step 2.7) use Orgo’s Direct SSH (Linux only). Orgo replaces the whole key set on each
POST /computers/{id}/ssh(one key per line, 16 KB at most) andDELETE /computers/{id}/sshturns SSH off. So every add or remove sends the full current set, under a lock on the computer’s row, and the row is written only after Orgo takes it. When Orgo answersrequires_restart: true, the console says to restart once; the old keys keep working until then. Connect on the port fromconnect, never 22 (port 22 on that host is Orgo’s server). - Agent keys expire after
expiresInMinutes. A sweep every 5 minutes sends the set without the expired keys, then deletes them. An expired key stays listed (with its pastexpiresAt) until the computer has dropped it, so the list never hides a key that still works. - Rebuild and move make a fresh disk with no keys, so the list is cleared.
- Standby (Incus) and free computers answer 501
{ error: "not_supported", action: "ssh_keys" }. - Paired and desktop computers are not built yet. They answer 404
not_a_cloud_computer. The plan: the probe writes a markedauthorized_keysblock and edits only inside the markers. They are reached over their mesh IP (the meshautogroup:selfrule is untouched). Mesh stays off for cloud computers. This needs a node action for keys (the action list above has none), approved through the approval flow. - Orgo does not report SSH logins, so there is no last-used time.
Cloud computer settings (Orgo)
CloudComputerSettings: { location, sizeId, diskGb, sleepAfterMin, wakePolicy, image }.
- Location is chosen on create:
nyc,chi,lonorsyd. Restart, rebuild and move are built. Resize, grow disk and clone come in step 2.5. - Move (Eoj, 2026-11-21): Orgo keeps a computer in the city it was created in, and its backups restore only there, so moving makes a fresh computer in the new city and erases the old one’s files. Clients show a hold-to-confirm sheet that says so in plain words (“Its files are erased and it starts fresh in London”). The new computer is created before the old one is deleted. It gets the Orgo name
<base>-<city>on the same row id, and pairs on first boot. There is no backup gate, because a backup cannot follow it. - Rebuild is delete, create and first boot in the same location, size and template. It is held until an Orgo daily backup newer than 48 hours exists, because it destroys the only disk copy. The row id stays the same. The old runtime device is revoked, and the new computer pairs on first boot.
- Daily backups are on. Orgo backs up running computers daily and keeps each backup 7 days. The console lists them and restores one in place. It never restores as a new computer: that would make a second, billed computer with no row of ours.
- Backup restore is off until
ALLTERNIT_ORGO_BACKUP_RESTORE=1is set on the cloud API. Orgo does not publish the restore request body, so the cloud sends{ backup_id, in_place: true }. It accepts only an answer that is an operation on the same computer (action: "restore", itsdesktop_id, or apoll_urlunder it). Any other answer is a 503 and is logged for an operator to check for a stray copy. Turn restores on only after one real in-place restore has been checked. - The backup list shape also comes from the docs, because no real answer has been read yet. The cloud reads
backups,dataoritems(or a bare array). Each item needs anidand an RFC 3339 or unix time, and counts only when it has no status or a finished one. An answer it can’t read is an error, never “no backups”. So both rebuild and restore stop withbackup_check_failedand change nothing. - The older restore points in Settings › Computers (
/api/v1/provisioned-instances/:id/snapshots) are Incus snapshots. On Orgo computers they still answer 501. Clients show the console Backups tab for Orgo daily backups. - Image is Ubuntu only (
image: 'ubuntu'). Starter templates ship only if theirsetup.shpasses. - Public URLs are out of scope.
- Resize, grow, clone and region prices are read from one real request before the UI ships (Eoj gate G3).
Whole-disk files
Step 2.11. A per-computer setting, off by default. Off, the console Files tab shows only the Files drive folder (~/Allternit and the other Files drive roots), as before. On, the owner can browse the whole disk of a server they own: a paired machine or an Allternit Cloud computer. Shared rows and Desktop rows never get it (Desktop already reaches its own files locally).
wholeDisk on a console row and on GET|PATCH /api/v1/computers/:id/file-roots:
The setting is stored per machine (migration 160,
computer_whole_disk, keyed by the 2.10 machine key) together with the machine’s runtime ids at the moment it was turned on. A runtime paired later, or a re-pair, starts off until the owner turns it on again.
Enforcement, fail closed. Every relayed request to a file route (/api/v1/files/*, /api/v1/files/v2/*, /api/v1/computers/:id/files/*) that names a path outside the Files drive is refused with 403 { error: "whole_disk_off", message } unless the setting is on for that runtime. “Outside” means: an absolute path that is not under a user folder (/home/<u>, /Users/<u>, /root, /var/home/<u>, X:\Users\<u>), ~other, a UNC path, any .. step, or a v2 POST /roots body with kind: "disk". Paths are read from the query (path, paths, local_path, src, dest, from, to, source, destination, dir, directory, target) and from small JSON bodies (64 KiB at most; file content is never read). A missing table or a database error counts as off.
The owner’s browser proxy (POST /api/v1/runtime-devices/:id/proxy) also sends the trusted header x-allternit-whole-disk: on on file routes while the setting is on. No client can send it (the relay header allow-list drops it), and guest (files-gateway) and server-side relays never send it. Nothing in this step wakes a computer: the routes read only the database.
What the runtime must do (lane A follow-up). Today files_scope keeps every relayed caller inside the home folder, so turning the setting on changes nothing on the computer yet. The runtime must: accept a kind: "disk" root (and paths outside home) from a relayed caller only when x-allternit-whole-disk: on is present, keep the secrets deny-list and the O_NOFOLLOW checks for those paths, hide disk roots from GET /roots and answer whole_disk_off (403) for them when the header is absent, never share a disk root or hand it to an agent, and keep its change records for writes there.
What clients must do. iOS, Android, web (+ phone layout and PWA) and the CLI show a roots switcher in the Files tab only when wholeDisk.enabled is true (the Files drive stays the first entry). Settings shows a switch only when wholeDisk.available is true; turning it on is a hold-to-confirm sheet that says plainly the agent and you can open, change and delete any file on the computer, then sends confirm: true. Show message on 403 whole_disk_off with a link to that switch.
Browser computers (kind: "browser")
A browser computer is a Linux computer that lives in one browser profile: the VM and its disk run in the tab, with no server row. The runtime API (cmd/allternit-api) knows the kind so every client and the database agree on the string, but it never creates one.
-
Kind string.
"browser"(ComputerKind::Browserincmd/allternit-api/src/computer_routes.rs). The runtime parses it next tolocal,byo_vps,managed,byocandcloud_desktop. Client label:Browser computer. -
Create is refused.
POST /api/v1/computerswithkind: "browser"returns 400 before any template lookup, and nothing is stored:Clients showmessageas is and start the computer in the browser instead. There is no other route for this kind. -
Where the record lives. In IndexedDB on the box origin (
box.allternit.com, databaseallternit-box, storecomputers), next to its disk. The app reads it over the frame’s RPC (computers.list). It is not inGET /api/v1/computersor in the console list above. -
No migration. The runtime database never stores a browser computer, so
computers.kindkeeps the CHECK from V99 (it does not listbrowser). The cloud-api schema has no kind CHECK.
Migrations
Take the next free number above origin/main and open PRs when the files are written. Production applies migrations through the cloud-api deploy, not sqlx (see the cloud-api deploy notes).
Whole-disk files: runtime side
Step 2.11b, the runtime half of Whole-disk files (cloud side: step 2.11). Where this differs from the cloud section’s “What the runtime must do”, this section is what the runtime does. The grant.allternit-api grants whole-disk access to one request only when all of these hold: it carries x-allternit-whole-disk: on, it is relayed (x-allternit-relayed), and its cloud relay signature (x-allternit-runtime-sig, -ts, x-allternit-owner, the scheme in relay_auth) is valid for this runtime and its paired owner. The middleware files_scope::whole_disk_gate checks this on /api/v1/files/* and /api/v1/files/v2/*. A local caller, an unsigned request, a wrong owner or a body over 8 MiB gets no extra access; the request goes on with the old scope. The cloud must therefore sign the owner proxy request whenever it adds the header (relay_signed_request_to_runtime_with, not the unsigned variant), or the runtime grants nothing.
With the grant (Caller::WholeDisk): the home folder and every path outside it, for list, read, raw, exists, mkdir, write and delete. Still refused (403 path_not_allowed, reason protected): the home secrets deny-list at any depth (/root/.ssh, /home/other/.aws), its file_patterns (*.pem, .env, id_rsa* …), the runtime identity folder .config/allternit, the Allternit data folders, and the system stores /etc/{shadow,gshadow,sudoers,sudoers.d,ssh,master.passwd,allternit}, /var/lib/allternit, /var/db/{dslocal,sudo}, C:\Windows\System32\config. .. is refused, symlinks are resolved before the check, and files open with O_NOFOLLOW and are checked again on the open file. The disk root itself (/, C:\) can’t be written or deleted (disk_root_itself).
Without the grant, a relayed path outside home answers 403 { error: "whole_disk_off", message }, the cloud’s body word for word.
Files drive v2. The whole disk (disk:/, C:\) is browsed through the path routes above, not as a drive root: the drive indexes every root it adds. POST /roots with kind: "disk" (or a folder outside home) adds a disk root: one folder outside home that holds neither the home folder nor a system secret store, so /, a drive, /home, /Users and /etc are refused (scope_violation). It needs the grant (whole_disk_off otherwise; a local caller gets the old scope refusal). A disk root is always shareable: false and agent_process: false, and PATCH can’t turn either on from any device. Without the grant it is left out of GET /roots, and every route on it answers whole_disk_off. Guests never reach it, and it is left out of the sleep snapshot. Writes in a disk root keep the drive’s versions and trash, as in any root; the legacy path routes keep no change records, as before.