Skip to content

The engine's protocol

TL;DR. The app talks to overpressure's engine in JSON lines. overpressure install --json (and upgrade, restore) writes one event per line on stdout and takes answers on stdin; overpressure serve --json is one long-lived server for the app, with requests and answers, which runs the installer and other jobs and passes their events on. This page lists the events, the progress lines a task's program prints, the asks and the server's requests. How the engine runs a plan: the installer's engine.

Events

With --json every line on stdout is one JSON object, each with its time (seconds since the epoch); whatever a child program prints arrives in a log event. Texts are plain words for the owner; stack traces go to the task's log file.

Event Fields When
plan headset {codename, name}, workflow, stages [{id, title, summary, tasks [{id, title, estimate, seconds (the estimate's upper end, or null), writes, parts [{title, estimate, share}]}]}] first, once
task stage, task, status: pending, running, done, skipped (its output was there) or failed each change; a task done in an earlier run shows done when the run reaches it
progress task, fraction (0 to 1, or null when unknown; a task of parts: across them, never going back), text, and for a task of parts part (from 0) and part_fraction while a task runs: ctx.progress, or a progress line of its program (progress part N: begins a part)
log task, line a line of a child program, or of the task itself: the details view
note task, level (info or warning), text something the owner should know
ask id, kind, title, text, fields [{name, label, secret, optional, setting}], accept, decline, consent the engine waits for the answer; not for a question answered before the start (--early)
instruct id, task, title, text; then the same id with done: true the owner does something with the headset (ctx.instruct_until: a replug, a reset); the engine goes on by itself once the headset shows it, no answer
finished status (done, failed, stopped), task (null when done), error, where; offer when the failure offers more than Retry (import-backup: the app shows Import backup…) last, once

Progress lines

A program a task runs reports how far it is with lines of its own on stdout (overpressure.progress):

Line Means
progress 42%: writing super 42 % done
progress 3/8: package pico4-monado three of eight done
progress: reading aop how far is unknown
progress part N: text part N (from 1) of a task of parts begins

The engine turns them into progress events and writes them to the task's log file, not to the details. progress.Meter prints them for a byte count, progress.feed counts what a child reads from a pipe, progress.estimate_seconds reads an estimate ("about 20 min", "1 to 3 h": its upper end).

Asks and answers

ask kinds:

Kind What the owner does
confirm accepts or declines
action does something, such as plugging in; accept is "Done"
form fills in fields; secret ones masked

The answer is one line on stdin: {"answer": ID, "accepted": true, "values": {NAME: VALUE}}. A declined ask or a closed stdin stops the run; an empty required field is asked again with a note. {"stop": true} on stdin stops the run. After a failure or a stop, where says the headset's state and what to do next.

The plan without a run

--plan --json prints the plan event, a task event with each task's recorded status and, for a workflow that changes the headset after a run of it, earlier (its "last": status done, failed, stopped or running (cut off), at, and task, error, where, offer once it ended), and runs nothing. In a terminal the plan prints as stage headings and task lines, with asks through input() and getpass().

The app's server

overpressure serve --json [--demo | --demo-fresh] is the engine for the app: one long-lived process, JSON lines both ways.

  • Requests. A request is {"id": N, "request": NAME, ...} on stdin and gets one answer on stdout, {"id": N, "result": {...}} or {"id": N, "error": TEXT}; an answer that takes time (the network, the checks, the plan) comes later, and the other requests are answered meanwhile.
  • Runs. A run's events follow its answer, each with "run", then {"event": "exited", "run": ID, "code": N}; a line of the engine that is no event arrives as output.
  • Jobs. A job (a download, the backup's export or import, the logs, a carry-over, a step) sends job-line {line}, job-progress {fraction, text} and last job-ended {kind, code, error}, each with "job".
  • One thing at a time. A run or a job refuses the next until it has ended.
  • The end of stdin stops a run or a step under way and ends the server.

--demo runs nothing (the demo engine).

Request Fields Answer
hello protocol (major.minor; an app refuses a newer major), version, platform, demo, first_setup (the first setup follows the disclaimer), disclaimer {title, text, accept, due, accepted}
settings, set_settings appearance: system, light or dark; disclaimer_every_start; ssh_public_key (a public key file, or empty; anything else is refused); ssh_public_key_line (a pasted key, kept as out/owner-key.pub); ssh_private_key (where the owner's private key file is, or empty; a .pub file or none is refused; the file is never read); wifi_ssid; wifi_password (kept protected, "" forgets it) the settings, kept in settings.json, with wifi_saved (never the password), disclaimer_seen (out/app.json) and folder (the data folder)
open_folder {}; the data folder in the system's file manager (the demo: nothing)
accept_disclaimer every_start the settings; the disclaimer is accepted for the server and every program it starts. Unticked, it is due again with a new overpressure
headsets headsets [{codename, name, soc, year, repository, development (no release yet), downloaded, checkout, channel, branch (a preview's), pinned, refused, has_steps, assesses (it looks at itself on USB), workflows [{key, title, summary, erases, changes, problem (why it cannot run now, or empty)}]}]: the catalogue's, those in development and those in devices/
assess codename, first (the page has just opened) later: what a look at the headset on USB found without changing it (Headset.assess): state (absent, maker, overpressure, bootloader, recovery, edl, unknown), system, version, facts [[label, value]], workflows (those that fit, the recommended one first; none when nothing fits as it is), note (what to do then, or why); assesses false for a headset that cannot look. Refused while something runs
releases codename later: releases [{version, prerelease, problem}] (none for a headset in development), development, branches (its repository's, main first; main alone offline), record (what its download recorded, a preview's branch too)
download codename, channel, version, branch job: the release, or the branch's newest commit (a preview of it), into devices/ (headset add), then imported anew: the server runs the headset now on disk (a look it gained included); refused for a checkout, a name that is no branch, and for a headset in development but a branch
updates later: updates
plan codename, workflow later: stages, each task with the status an earlier run left, earlier, how and when the last run ended, or null (install --plan), and questions: what the workflow asks before it starts, each field with what the owner keeps for it (value; a secret only saved); an action the latest look (assess, a minute at most) shows done is left out (Headset.questions with the look), and the start answers it for the engine
start codename, workflow, restart (a stage), answers {ASK_ID: {accepted, values}} (a value null: what the owner keeps for it) run; the answers go to the engine on its stdin (install --early); refused without the disclaimer, while something runs, or when the workflow cannot run now
answer run, answer (the ask's id), accepted, values {}
stop run {}; the run stops at once, or after a write under way
finished_page codename, workflow title, text, actions [{label, workflow, step}]: the headset's own, those it can offer
backup codename supported, present, folder (the way back's); backups: each name, size (bytes), made (seconds), ours (of this computer's headset), active (the way back), the newest first
backup_export, backup_import, save_logs codename, path; an export's name (another backup than the way back) job (backup export, backup import, support-bundle)
backup_use codename, name job (backup use: checked whole, then the way back)
backup_delete codename, name {}; deleted for good (the app asks first); the way back and the only backup are refused
steps codename groups [{group, steps [{key, title, checks (the dependency checks), help, writes, linux_root, params [{name, label, kind, choices, help, value, browse}]}]}]
command codename, step, values command (as typed in a terminal), problem; the values stay for the step
run_step codename, step, values job, whose first line is the command
stop_job job {}; a step ends, a download or backup job finishes by itself
checks codename later: checks [{name, needed_for, status, detail, fix}]
carry_over later: from (the earlier folder found, or empty), question, ask (a fresh app data folder: ask after the portable folder even when none was found)
carry_check from from, question; refused, in the owner's words, for a folder that is no earlier overpressure or holds nothing to bring over
carry from job (carry): how far by bytes (a move on the same disk is a rename, done at once; to another disk a copy), then a brought: WHAT line for each thing that came; refused for a folder carry_check refuses
decline_carry_over from {}
app_update later: update (a newer overpressure with the app: version, semver, words, manifest, page, notes; null for none or offline), installs (the installed app replaces itself; overpressure from a folder shows the release's page)