diff --git a/README.md b/README.md index 2153cd91..7ca1b7f7 100644 --- a/README.md +++ b/README.md @@ -58,12 +58,9 @@ These are the basics of how evertything is connected on my rovers, this is hard ### Software on your rover Roverd targets Debian-based systems with ARMv6, ARMv7, ARM64, or AMD64 binaries. For the existing AIY Voice HAT rover, use Raspberry Pi OS Bookworm; that hardware setup has not been verified on Trixie. -The standalone installer is still being implemented. For now: -1. Set up the OS and networking. -2. Install `git` and clone this repository. -3. From the repository, run `sudo rover/install_roverd.sh`. -4. Configure `/etc/roverd.json`, including the rover name, server address, physical audio devices, and enabled media profiles. Media and native Pi GPIO are disabled by default. -5. Run `sudo systemctl restart roverd`. +Download [rover/bootstrap.sh](rover/bootstrap.sh) onto the rover and run `sudo bash bootstrap.sh`. It asks only for the rover name and the full server WebSocket address, creates the managed checkout at `/opt/roverd`, installs the matching binary from the repository, and starts roverd. + +Configure audio devices, media profiles, and optional Pi GPIO through Fleet Management. Media and native Pi GPIO are disabled by default. Updates use the same installer and restart the service without rebooting the host. See [installation and updates](docs/roverd-installation.md). Roverd supervises the selected streamer commands itself. Disable/remove any previously installed streamer services before starting it. The AIY profiles may request a one-time reboot to activate their boot overlay. See [media profiles and audio routing](docs/rover-media-profiles.md) for configuration and deployment checks. diff --git a/dist/roverd-linux-amd64 b/dist/roverd-linux-amd64 index 43046859..32bda2f9 100755 Binary files a/dist/roverd-linux-amd64 and b/dist/roverd-linux-amd64 differ diff --git a/dist/roverd-linux-arm64 b/dist/roverd-linux-arm64 index d98ef7d0..2af682b2 100755 Binary files a/dist/roverd-linux-arm64 and b/dist/roverd-linux-arm64 differ diff --git a/dist/roverd-linux-armv6 b/dist/roverd-linux-armv6 index 109e16d2..c8c2faeb 100755 Binary files a/dist/roverd-linux-armv6 and b/dist/roverd-linux-armv6 differ diff --git a/dist/roverd-linux-armv7 b/dist/roverd-linux-armv7 index 0143cff2..bb179ee6 100755 Binary files a/dist/roverd-linux-armv7 and b/dist/roverd-linux-armv7 differ diff --git a/docs/rover-hardware-config.md b/docs/rover-hardware-config.md index 09b64fd8..1db79ef4 100644 --- a/docs/rover-hardware-config.md +++ b/docs/rover-hardware-config.md @@ -1,6 +1,6 @@ # Rover hardware configuration notes -This document records hardware-specific requirements while the roverd rework is in progress. Media profiles and shared audio routing are implemented. The standalone bootstrap remains unfinished; current installation uses a checkout. Configuration selections are recorded below. +This document records hardware-specific requirements while the roverd rework is in progress. Media profiles and shared audio routing are implemented. The standalone bootstrap creates the managed checkout and invokes the shared installer. Configuration selections are recorded below. ## Universal configuration requirements @@ -16,7 +16,7 @@ Roverd configuration selects one physical input device and one physical output d The microphone streamer uses the selected input. TTS, horn, and forwarded audio share the selected output while retaining simultaneous playback and separate volume controls. Profiles use the generated logical devices supplied through their environment; they do not each hardcode or independently select physical audio hardware. Use ALSA conversion where supported instead of requiring all devices to accept the existing HAT playback format. -AIY setup enables its hardware and uses this same routing system. The bootstrap still asks only for rover name and server address. Audio routing is implemented; the standalone bootstrap remains planned. +AIY setup enables its hardware and uses this same routing system. The bootstrap still asks only for rover name and server address. Audio routing and the standalone bootstrap are implemented; hardware verification remains pending. ## Historical AIY Voice HAT setup diff --git a/docs/roverd-installation.md b/docs/roverd-installation.md new file mode 100644 index 00000000..d1a86568 --- /dev/null +++ b/docs/roverd-installation.md @@ -0,0 +1,21 @@ +# Rover installation and updates + +Download `rover/bootstrap.sh` from the repository onto a Debian-based rover, then run `sudo bash bootstrap.sh`. No preexisting checkout is required. Enter the rover name and full server address, for example `ws://server:8080/rover` or `wss://example.org/rover`. + +Bootstrap installs prerequisites, clones into `/opt/roverd`, invokes `rover/install_roverd.sh`, and starts the root roverd service. The checkout is root-owned and dedicated to installation and updates; keep development changes elsewhere. Rerunning bootstrap preserves an existing configuration rather than replacing its identity with the prompt answers. + +The shared installer selects AMD64, ARM64, or ARMv6/ARMv7 for a 32-bit ARM OS. A Pi Zero 2 W uses ARM64 on a 64-bit OS and ARMv7 on a 32-bit OS. Binaries come from `dist/` in the repository; no release publishing or on-rover compilation is required. + +Fleet Management configures the remaining settings. Media and native GPIO start disabled. Profiles are already in the checkout; selecting one causes its inline setup to run on roverd startup. See [media profiles](rover-media-profiles.md) and [AIY hardware settings](rover-hardware-config.md). + +## Updates + +The management update action launches `roverd-self-update` as an independent transient systemd service. It fast-forwards the registered checkout, invokes the same installer, and restarts only roverd. A modified/diverged checkout can make Git refuse the update; it is not forcibly reset. + +The installer preserves `/etc/roverd.json`, `/etc/roverd/profiles/`, and `/var/lib/roverd/`. Replacing the installed executable and updater uses rename so running processes retain their existing executable/script. Update progress and the last result are atomically written to `/var/lib/roverd/update-status.json`, forwarded through management, and shown in Fleet Management after reconnecting. This reports completion of installation/service restart, not camera or audio health. + +For detailed command output use `journalctl -u roverd-self-update`; for daemon startup use `journalctl -u roverd`. Failed update jobs report failure and release the old daemon's pending management action if it is still running. There is no rollback system. If installation fails after changing files, fix the reported error and rerun the installer/update. + +## Deployment checks still required + +On a fresh rover, run bootstrap and confirm management connects with the supplied identity. Select the hardware profiles and verify their output. Trigger an update and confirm progress, reconnection, final status, and preservation of JSON/custom profiles. Confirm a failed update reports its error and allows another management action. These host/systemd/network flows have not been executed on the development machine. diff --git a/docs/roverd-management.md b/docs/roverd-management.md index 0bb7719e..f89905d7 100644 --- a/docs/roverd-management.md +++ b/docs/roverd-management.md @@ -72,7 +72,7 @@ Record acknowledgement errors, reconnect hello contents, relevant journal/server ## Pending stages -YAML media catalogs, child supervision, shared ALSA routing, and Fleet Management profile controls are implemented. Browser/live verification of configuration, operational state, media, and audio remains pending. Standalone bootstrap and the replacement update workflow are the next implementation stage. +YAML media catalogs, child supervision, shared ALSA routing, and Fleet Management profile controls are implemented. Browser/live verification of configuration, operational state, media, and audio remains pending. Standalone bootstrap and shared self-update are implemented; host verification remains pending. See [installation and updates](roverd-installation.md). Update status is included as `updateStatus` in hello and sent as `{type: "updateStatus", status: {state, message, timestamp}}` when it changes. Apply-field targets the currently management-connected fleet. It clones each rover’s own configuration, replaces an existing field, and sends the complete object for rover-side validation. Inspect individual results for failures. Missing fields and changed connections are reported; offline changes are not queued. Paths traverse object fields, not array elements. Array-valued fields can be replaced as a whole. diff --git a/docs/roverd-rework-plan.md b/docs/roverd-rework-plan.md index 1acab6bb..fe151a5c 100644 --- a/docs/roverd-rework-plan.md +++ b/docs/roverd-rework-plan.md @@ -1,6 +1,6 @@ # Roverd rework plan and implementation tracker -Status: implementation authorized on 2026-11-16; repository/build, internal GPIO, JSON/management, Fleet UI, rover state, media profiles/supervision, and shared audio routing implemented; deployment verification, standalone bootstrap, and update redesign remain pending. +Status: implementation authorized on 2026-11-16; repository/build, internal GPIO, JSON/management, Fleet UI, rover state, media profiles/supervision, and shared audio routing implemented; standalone bootstrap and shared self-update are also implemented; final cleanup/hardware audit and deployment verification remain pending. This is the persistent plan and progress record for the roverd rework. Update it as implementation proceeds, recording completed work, decisions, verification evidence, and remaining work. Keep unfinished work unchecked; distinguish implemented behavior from runtime-verified behavior. @@ -177,8 +177,8 @@ The order below is a working sequence, not a requirement to leave incompatible i - [x] Implement per-rover schema editor and complete-object saves (browser/live verification pending). - [x] Implement apply-one-field-to-all-connected-rovers with individual results (browser/live verification pending). - [x] Add profile editing/selection, media output/status, reboot, and update UI. (Live verification pending.) -- [ ] Implement standalone bootstrap with only name/address input and automatic OS architecture selection. -- [ ] Implement shared checkout installation and self-update with reconnect-visible results. +- [x] Implement standalone bootstrap with only name/address input and automatic OS architecture selection. (Host verification pending.) +- [x] Implement shared checkout installation and self-update with reconnect-visible results. (Host verification pending.) - [ ] Remove obsolete services, configuration files, scripts, build distinctions, and documentation. - [ ] Update user/contributor documentation, including profile variables, setup expectations, building, installation, and updates. - [ ] Perform focused available verification and record results below. @@ -285,3 +285,14 @@ Verification for this stage: - Added real CLI inspection for catalogs and generated ALSA configuration, without setup execution or hardware access. - Verification: all four architecture builds passed; six profiles loaded through the actual daemon and all setup/run commands passed Bash syntax checks; current sample config validation and ALSA config rendering passed; installer/TTS shell syntax and server JS syntax passed. Focused frontend lint passed including the final status-display changes. No camera/audio streaming, setup commands, host installation, or browser/server processes were run here. - Next: verify the remaining frontend check, then standalone bootstrap and update flow. Actual device formats, concurrent playback/gains, child cleanup and network recovery still require the documented rover-side checks. + + +### Standalone bootstrap and shared updates (2026-11-16) + +- Added `rover/bootstrap.sh`: prompts only for name/server WebSocket address, installs prerequisites, clones into `/opt/roverd`, invokes the shared installer, and starts roverd. Existing configuration is preserved on rerun. +- Installer selects committed architecture binaries from OS architecture (and ARM generation for 32-bit ARM), writes initial identity only on first installation, and preserves custom profiles/data. Running binary and updater replacement use atomic rename. +- Replaced rebooting updater with an independent systemd job using fast-forward Git pull and the same installer, followed by service restart. No releases, forced reset, migrations, or rollback machinery. +- Latest update progress/result is persisted atomically, sent over management, cached in server memory, and displayed in Fleet Management including after reconnect. Detailed command output stays in the systemd journal. +- Added `docs/roverd-installation.md` and updated README instructions. +- Verification: all four committed architecture binaries rebuilt successfully; shell syntax, server syntax, focused UI lint, and diff whitespace checks passed. No installation, apt operation, host reboot/restart, or live server/browser was run on the development machine. +- Required rover checks: fresh bootstrap identity/connectivity; successful update and reconnect-visible status; failure reporting and retry; preservation of settings/custom profiles/data. Hardware/audio checks and final universal-hardware audit remain open. diff --git a/rover/bin/roverd-self-update.sh b/rover/bin/roverd-self-update.sh index bc0fcef9..03e5de43 100755 --- a/rover/bin/roverd-self-update.sh +++ b/rover/bin/roverd-self-update.sh @@ -1,98 +1,32 @@ #!/usr/bin/env bash -# -# Fixed-purpose self-update helper for Raspberry Pi rover hosts. -# -# roverd itself runs as the unprivileged "roverd" service user, but updating the -# installed agent requires root because the installer writes to /usr/local/bin, -# /etc, /opt, /var/lib/roverd, and systemd unit locations. This helper is the -# narrow privilege boundary: sudoers allows roverd to run this exact file with no -# arguments, and this file decides the complete update sequence internally. - +# A separate systemd job survives replacement/restart of the roverd service. set -euo pipefail - -ENV_FILE="/etc/roverd-update.env" -LOCK_FILE="/var/lock/roverd-self-update.lock" -LOG_FILE="/var/log/roverd-self-update.log" - -log() { - # Log to stdout so systemd/journal captures the message when launched by - # roverd, and also append to a stable file so an admin can inspect the last - # update attempt after the roverd service restarts. - local message - message="[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" - echo "$message" - echo "$message" >> "$LOG_FILE" +[[ $EUID == 0 ]] || { echo 'Run as root' >&2; exit 1; } +if [[ ${ROVERD_UPDATE_JOB:-} != 1 ]]; then + exec systemd-run --unit=roverd-self-update --collect --wait \ + --property=Type=exec --setenv=ROVERD_UPDATE_JOB=1 "$0" +fi +exec 9>/var/lock/roverd-self-update.lock +flock -n 9 || exit 1 +install -d /var/lib/roverd +status() { + echo "$2" + python3 - "$1" "$2" <<'PY' +import json, os, sys, time +path = '/var/lib/roverd/update-status.json' +with open(path + '.tmp', 'w') as f: + json.dump(dict(state=sys.argv[1], message=sys.argv[2], timestamp=int(time.time()*1000)), f) +os.replace(path + '.tmp', path) +PY } - -if [[ "${EUID}" -ne 0 ]]; then - echo "roverd-self-update must run as root" >&2 - exit 1 -fi - -if [[ "${ROVERD_SELF_UPDATE_SYSTEMD:-}" != "1" ]] && command -v systemd-run >/dev/null 2>&1; then - exec systemd-run \ - --unit=roverd-self-update \ - --collect \ - --property=Type=exec \ - --setenv=ROVERD_SELF_UPDATE_SYSTEMD=1 \ - "$0" -fi - -if [[ ! -f "$ENV_FILE" ]]; then - echo "Missing $ENV_FILE; run rover/install_roverd.sh once to register the repository path" >&2 - exit 1 -fi - -# shellcheck disable=SC1090 -source "$ENV_FILE" - -if [[ -z "${ROVERD_REPO_DIR:-}" ]]; then - echo "ROVERD_REPO_DIR is not set in $ENV_FILE" >&2 - exit 1 -fi - -if [[ ! -d "$ROVERD_REPO_DIR/.git" ]]; then - echo "ROVERD_REPO_DIR does not point at a git checkout: $ROVERD_REPO_DIR" >&2 - exit 1 -fi - -if [[ ! -x "$ROVERD_REPO_DIR/rover/install_roverd.sh" ]]; then - echo "Installer is missing or not executable: $ROVERD_REPO_DIR/rover/install_roverd.sh" >&2 - exit 1 -fi - -mkdir -p "$(dirname "$LOCK_FILE")" "$(dirname "$LOG_FILE")" -touch "$LOG_FILE" -chmod 0644 "$LOG_FILE" - -exec 9>"$LOCK_FILE" -if ! flock -n 9; then - log "Another roverd self-update is already running; refusing to start a second one" - exit 1 -fi - +trap 'result=$?; if (( result != 0 )); then status failed "Update failed (exit $result). See journalctl -u roverd-self-update."; fi' EXIT +source /etc/roverd-update.env cd "$ROVERD_REPO_DIR" -log "Starting roverd self-update in $ROVERD_REPO_DIR" - -repo_uid="$(stat -c '%u' "$ROVERD_REPO_DIR")" - -# Fetch through the normal git remote instead of downloading just one artifact. -# That keeps the binary, installer, scripts, systemd units, and any other rover -# files from this repository on the same commit. -if [[ "$repo_uid" -eq 0 ]]; then - git pull --ff-only -else - # The helper runs as root only for installation privileges. The git checkout - # usually belongs to the human deploy user, so running the pull as that owner - # avoids Git's dubious-ownership protection and preserves whatever SSH/HTTPS - # credentials that user normally uses for this repository. - sudo -H -u "#${repo_uid}" git -C "$ROVERD_REPO_DIR" pull --ff-only -fi -log "Repository fast-forward pull complete" - -# The installer already owns the full desired rover host state. Reusing it here -# prevents this update helper from becoming a second, partial installer that can -# drift away from the normal manual install path. -"$ROVERD_REPO_DIR/rover/install_roverd.sh" -log "Installer completed successfully" -systemctl reboot +status running 'Updating repository' +# This is a dedicated root-owned checkout; local configuration lives outside it. +git pull --ff-only +status running 'Installing rover software' +bash rover/install_roverd.sh +status running 'Restarting roverd' +systemctl restart roverd +status succeeded 'Update installed and roverd service restarted' diff --git a/rover/bootstrap.sh b/rover/bootstrap.sh new file mode 100755 index 00000000..3e28b59c --- /dev/null +++ b/rover/bootstrap.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Download this file and run it with sudo; no existing checkout is needed. +set -euo pipefail +[[ $EUID == 0 ]] || { echo 'Run with sudo bash bootstrap.sh' >&2; exit 1; } +read -r -p 'Rover name: ' rover_name &2; exit 1; } +apt-get update +apt-get install -y git ca-certificates python3 +if [[ ! -e /opt/roverd ]]; then + git clone https://github.com/legop3/MultiRoombaRover.git /opt/roverd +fi +[[ -d /opt/roverd/.git ]] || { echo '/opt/roverd must be a repository checkout' >&2; exit 1; } +export ROVERD_INITIAL_NAME="$rover_name" ROVERD_INITIAL_SERVER="$server_address" +bash /opt/roverd/rover/install_roverd.sh +systemctl restart roverd diff --git a/rover/install/self_update.sh b/rover/install/self_update.sh index 0419a313..39379290 100644 --- a/rover/install/self_update.sh +++ b/rover/install/self_update.sh @@ -5,6 +5,8 @@ install_self_update_support() { printf -v quoted_repo_root '%q' "$REPO_ROOT" printf 'ROVERD_REPO_DIR=%s\n' "$quoted_repo_root" > /etc/roverd-update.env chmod 0600 /etc/roverd-update.env - install -D -o root -g root -m 0755 rover/bin/roverd-self-update.sh /usr/local/sbin/roverd-self-update + install -D -o root -g root -m 0755 rover/bin/roverd-self-update.sh /usr/local/sbin/roverd-self-update.new + # Keep the running updater on its original inode until it exits. + mv -f /usr/local/sbin/roverd-self-update.new /usr/local/sbin/roverd-self-update log "Registered update checkout at $REPO_ROOT" } diff --git a/rover/install_roverd.sh b/rover/install_roverd.sh index 718a5319..dd485ac9 100755 --- a/rover/install_roverd.sh +++ b/rover/install_roverd.sh @@ -1,18 +1,35 @@ #!/usr/bin/env bash -# Installs from an existing checkout. Standalone bootstrap is a later stage. +# Shared installation path for bootstrap and self-update. set -euo pipefail REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" cd "$REPO_ROOT" [[ $EUID == 0 ]] || { echo 'Run as root' >&2; exit 1; } case "$(dpkg --print-architecture)" in - amd64) arch=amd64 ;; arm64) arch=arm64 ;; armhf) arch=armv6 ;; + amd64) arch=amd64 ;; arm64) arch=arm64 ;; + armhf) case "$(uname -m)" in armv6*) arch=armv6 ;; *) arch=armv7 ;; esac ;; *) echo 'Unsupported OS architecture' >&2; exit 1 ;; esac -install -m 0755 "dist/roverd-linux-$arch" /usr/local/bin/roverd +# Rename avoids overwriting an executable that the running service has mapped. +install -m 0755 "dist/roverd-linux-$arch" /usr/local/bin/roverd.new +mv -f /usr/local/bin/roverd.new /usr/local/bin/roverd +apt-get update +apt-get install -y git ca-certificates python3 util-linux install -d /etc/roverd/profiles /var/lib/roverd if [[ ! -f /etc/roverd.json ]]; then - /usr/local/bin/roverd -print-default-config > /etc/roverd.json - chmod 600 /etc/roverd.json + /usr/local/bin/roverd -print-default-config > /etc/roverd.json.new + chmod 600 /etc/roverd.json.new + python3 - <<'PYCONFIG' +import json, os +path = '/etc/roverd.json.new' +with open(path) as f: + config = json.load(f) +config['name'] = os.environ.get('ROVERD_INITIAL_NAME', config['name']) +config['serverUrl'] = os.environ.get('ROVERD_INITIAL_SERVER', config['serverUrl']) +with open(path, 'w') as f: + json.dump(config, f, indent=2) +PYCONFIG + /usr/local/bin/roverd -config /etc/roverd.json.new -check-config + mv /etc/roverd.json.new /etc/roverd.json echo 'Set name, serverUrl, devices, and enabled profiles in /etc/roverd.json before starting roverd.' fi install -m 0644 rover/systemd/roverd.service /etc/systemd/system/roverd.service @@ -26,4 +43,4 @@ source rover/install/self_update.sh install_self_update_support systemctl daemon-reload systemctl enable roverd.service -echo 'Installed. Run systemctl restart roverd after configuring this rover.' +echo 'Installation complete; caller can now restart roverd.' diff --git a/rover/roverd/management.go b/rover/roverd/management.go index 42aa6890..3e815bd8 100644 --- a/rover/roverd/management.go +++ b/rover/roverd/management.go @@ -1,11 +1,13 @@ package roverd import ( + "bytes" "context" "encoding/json" "fmt" "log" "net/url" + "os" "os/exec" "sync" "time" @@ -81,7 +83,7 @@ func (m *ManagementClient) connect(parent context.Context) error { conn.SetReadLimit(1024 * 1024) if err := writeJSON(ctx, conn, map[string]any{ "type": "hello", "name": m.cfg.Name, "config": m.cfg, - "schema": ConfigurationSchema(), "profiles": m.profileCatalog(), "mediaStatus": m.mediaStatus(), + "schema": ConfigurationSchema(), "profiles": m.profileCatalog(), "mediaStatus": m.mediaStatus(), "updateStatus": readUpdateStatus(), }); err != nil { return err } @@ -102,6 +104,7 @@ func (m *ManagementClient) connect(parent context.Context) error { } }() go m.forwardHostStats(ctx, conn) + go m.forwardUpdateStatus(ctx, conn) select { case <-ctx.Done(): return ctx.Err() @@ -198,7 +201,7 @@ func (m *ManagementClient) execute(ctx context.Context, command managementComman return m.restart, nil } // The updater remains a fixed-purpose helper; browser input cannot select - // executable paths or shell arguments. Its implementation is a later stage. + // executable paths or shell arguments. The separate systemd job survives restart. path, args := "systemctl", []string{"reboot"} if command.Type == "update" { path, args = "/usr/local/sbin/roverd-self-update", nil @@ -304,3 +307,33 @@ func (m *ManagementClient) mediaStatus() map[string]string { } return m.media.Status() } + +// Persist only the latest update result, so reconnects do not depend on an +// in-memory event surviving the service restart. +func readUpdateStatus() json.RawMessage { + data, err := os.ReadFile("/var/lib/roverd/update-status.json") + if err != nil || !json.Valid(data) { + return nil + } + return data +} + +func (m *ManagementClient) forwardUpdateStatus(ctx context.Context, conn *websocket.Conn) { + ticker := time.NewTicker(time.Second) + defer ticker.Stop() + var previous json.RawMessage + for { + current := readUpdateStatus() + if current != nil && !bytes.Equal(current, previous) { + if err := writeJSON(ctx, conn, map[string]any{"type": "updateStatus", "status": current}); err != nil { + return + } + previous = current + } + select { + case <-ctx.Done(): + return + case <-ticker.C: + } + } +} diff --git a/server/src/services/roverManagementService/index.js b/server/src/services/roverManagementService/index.js index d2fd64b2..f7afdabe 100644 --- a/server/src/services/roverManagementService/index.js +++ b/server/src/services/roverManagementService/index.js @@ -18,6 +18,7 @@ function snapshot(record) { schema: record.schema, profiles: record.profiles, mediaStatus: record.mediaStatus, + updateStatus: record.updateStatus, hostStats: record.hostStats || null, notices: record.notices, }; @@ -83,7 +84,7 @@ managementWSS.on('connection', (ws) => { if (typeof msg.name !== 'string' || !msg.name || !msg.config || !msg.schema) throw new Error('Invalid management hello'); clearTimeout(helloTimeout); const previous = rovers.get(msg.name); - record = { roverId: msg.name, ws, config: msg.config, schema: msg.schema, profiles: msg.profiles, mediaStatus: msg.mediaStatus || {}, notices: [] }; + record = { roverId: msg.name, ws, config: msg.config, schema: msg.schema, profiles: msg.profiles, mediaStatus: msg.mediaStatus || {}, updateStatus: msg.updateStatus || null, notices: [] }; rovers.set(record.roverId, record); previous?.ws.close(1000, 'Replaced by new connection'); notifyAdmins('roverManagement:changed', snapshot(record)); @@ -93,6 +94,9 @@ managementWSS.on('connection', (ws) => { if (msg.type === 'ack') { if (pending.get(msg.id)?.ws !== ws) return; finish(msg.id, msg.status === 'ok' ? null : new Error(msg.error || 'Management action failed'), msg); + } else if (msg.type === 'updateStatus') { + record.updateStatus = msg.status; + notifyAdmins('roverManagement:updateStatus', { roverId: record.roverId, status: msg.status }); } else if (msg.type === 'hostStats') { record.hostStats = msg; require('../roverManager').handleHostStats(record.roverId, msg); diff --git a/webui/src/admin/components/RoverConfigurationEditor.jsx b/webui/src/admin/components/RoverConfigurationEditor.jsx index 250b32e2..2ce070cb 100644 --- a/webui/src/admin/components/RoverConfigurationEditor.jsx +++ b/webui/src/admin/components/RoverConfigurationEditor.jsx @@ -53,6 +53,7 @@ function RoverForm({ socket, record, online }) { } return
{online ? 'Management connected' : 'Management offline — edits are retained locally.'}
+ {record.updateStatus &&Update: {record.updateStatus.state} — {record.updateStatus.message}
}{message}
{results.length > 0 &&