From 1b2e6abf2bf64e872b3eb45a280ae61df233ffe8 Mon Sep 17 00:00:00 2001 From: Kord Campbell Date: Mon, 2 Nov 2026 11:04:09 -0800 Subject: [PATCH] fix(dashboard): re-seed the disk page on upgrade; fix(ci): nightly macOS + Linux sidecar builds (v0.21.12) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dashboard: /dashboard served ~/.hyperia/dashboard/index.html, seeded from the embedded page only when the file was missing — so the first-ever seed was served forever and no upgrade ever reached it (proto_viz broken on 0.21.11 because a months-old page was still being served). A `.seed` stamp now records which embedded page was last written; when the build's page changes, the disk copy is replaced (backed up to index.html.bak- first if hand-edited). Edits within a build still win. The version poll re-seeds too, so open tabs reload onto the new page. Nightly: port build.yml's fixes — install libasound2-dev on Linux (alsa-sys failed), and build the x86_64-apple-darwin sidecar with --no-default-features (ort has no prebuilt ONNX Runtime there). Only Windows had been building. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/nightly.yml | 10 +++++- app/package.json | 2 +- package.json | 2 +- sidecar/Cargo.lock | 2 +- sidecar/Cargo.toml | 2 +- sidecar/src/dashboard.rs | 63 +++++++++++++++++++++++++++++------ 6 files changed, 66 insertions(+), 15 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0ccafdd2304..deef6a18a8a 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -57,15 +57,23 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile --network-timeout 300000 + # Linux: the sidecar's TTS stack (rodio → cpal) compiles against ALSA — + # without libasound2-dev the cargo build fails at alsa-sys. Mirrors build.yml. + - name: Install Linux sidecar build deps (ALSA for rodio/cpal) + if: matrix.os == 'ubuntu-latest' + run: sudo apt-get update && sudo apt-get install -y libasound2-dev pkg-config + # Build sidecar — macOS uses --target so the binary lands where # bin/cp-sidecar.js reads from (target//release/). - name: Build sidecar (release, default target) if: matrix.os != 'macos-latest' run: cargo build --release --manifest-path sidecar/Cargo.toml + # Intel mac: --no-default-features drops the `tts` feature — ort ships no + # prebuilt ONNX Runtime for x86_64-apple-darwin. Mirrors build.yml. - name: Build sidecar x86_64 (macOS) if: matrix.os == 'macos-latest' - run: cargo build --release --manifest-path sidecar/Cargo.toml --target x86_64-apple-darwin + run: cargo build --release --manifest-path sidecar/Cargo.toml --target x86_64-apple-darwin --no-default-features - name: Build sidecar ARM64 (macOS) if: matrix.os == 'macos-latest' diff --git a/app/package.json b/app/package.json index a984c346304..75db50486cb 100644 --- a/app/package.json +++ b/app/package.json @@ -2,7 +2,7 @@ "name": "hyperia", "productName": "Hyperia", "description": "A modern agentic terminal.", - "version": "0.21.11", + "version": "0.21.12", "license": "BSD-2-Clause", "author": { "name": "Deep Blue Dynamics", diff --git a/package.json b/package.json index d0a9cbc5e11..8640920cb23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hyperia", - "version": "0.21.11", + "version": "0.21.12", "repository": "deepbluedynamics/hyperia", "scripts": { "start": "concurrently -n \"Webpack,TypeScript,App\" -c \"cyan.bold,blue.bold,green.bold\" \"webpack -w\" \"tsc --build -v --pretty --watch --preserveWatchOutput\" \"cross-env ELECTRONMON_LOGLEVEL=error electronmon target\" -k", diff --git a/sidecar/Cargo.lock b/sidecar/Cargo.lock index 5b9497952ae..00182154c9c 100644 --- a/sidecar/Cargo.lock +++ b/sidecar/Cargo.lock @@ -1300,7 +1300,7 @@ dependencies = [ [[package]] name = "hyperia-sidecar" -version = "0.21.11" +version = "0.21.12" dependencies = [ "aegis-edit", "ammonia", diff --git a/sidecar/Cargo.toml b/sidecar/Cargo.toml index 2e6b412add7..8ea1472f029 100644 --- a/sidecar/Cargo.toml +++ b/sidecar/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hyperia-sidecar" -version = "0.21.11" +version = "0.21.12" edition = "2021" description = "Rust sidecar for Hyperia: agent engine, MCP, signaling" diff --git a/sidecar/src/dashboard.rs b/sidecar/src/dashboard.rs index 842b6e6e8b1..8c99cb78718 100644 --- a/sidecar/src/dashboard.rs +++ b/sidecar/src/dashboard.rs @@ -152,7 +152,8 @@ impl DashboardState { // Route handlers // --------------------------------------------------------------------------- -/// Embedded seed page — written to disk on first serve, then DISK WINS. Editing +/// Embedded seed page — written to disk on first serve and on upgrade, otherwise +/// DISK WINS (see sync_dashboard_seed). Editing /// `~/.hyperia/dashboard/index.html` updates the live page (~1.5s reload poll) /// with no rebuild/reinstall (plan/dashboard-live.md). const DASHBOARD_SEED: &str = include_str!("../static/dashboard.html"); @@ -181,16 +182,54 @@ fn dashboard_disk_path() -> std::path::PathBuf { dirs_home().join(".hyperia").join("dashboard").join("index.html") } -/// GET /dashboard — disk-first: serve ~/.hyperia/dashboard/index.html when -/// present (seeding it from the embedded page on first run), embedded otherwise. -pub async fn get_dashboard(State(_state): State) -> Html { - let disk = dashboard_disk_path(); - if !disk.is_file() { - if let Some(dir) = disk.parent() { - let _ = std::fs::create_dir_all(dir); +/// FNV-1a 64 — stable across Rust versions (unlike DefaultHasher), so a stamp +/// written by one build is comparable by the next. +fn fnv1a64(bytes: &[u8]) -> String { + let mut h: u64 = 0xcbf2_9ce4_8422_2325; + for b in bytes { + h ^= *b as u64; + h = h.wrapping_mul(0x0000_0100_0000_01b3); + } + format!("{h:016x}") +} + +/// Keep the disk page in step with the build. Disk wins only WITHIN a build: +/// `.seed` records the hash of the seed last written. When the embedded seed +/// changes (an upgrade), the disk page is replaced — after backing it up to +/// `index.html.bak-` if it was hand-edited. Without this, the first-ever +/// seed was served forever and upgrades never reached the dashboard. +fn sync_dashboard_seed(disk: &std::path::Path) { + let Some(dir) = disk.parent() else { return }; + let stamp_path = dir.join(".seed"); + let seed_hash = fnv1a64(DASHBOARD_SEED.as_bytes()); + let stamp = std::fs::read_to_string(&stamp_path).ok().map(|s| s.trim().to_string()); + if disk.is_file() && stamp.as_deref() == Some(seed_hash.as_str()) { + return; // already on this build's seed; any edits since are the user's + } + let _ = std::fs::create_dir_all(dir); + if let Ok(cur) = std::fs::read(disk) { + let cur_hash = fnv1a64(&cur); + let pristine = cur_hash == seed_hash || stamp.as_deref() == Some(cur_hash.as_str()); + if !pristine { + let ms = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .map(|d| d.as_millis()) + .unwrap_or(0); + if std::fs::copy(disk, dir.join(format!("index.html.bak-{ms}"))).is_err() { + return; // never overwrite edits we couldn't back up + } } - let _ = std::fs::write(&disk, DASHBOARD_SEED); } + if std::fs::write(disk, DASHBOARD_SEED).is_ok() { + let _ = std::fs::write(&stamp_path, &seed_hash); + } +} + +/// GET /dashboard — disk-first: serve ~/.hyperia/dashboard/index.html, re-seeded +/// from the embedded page on first run and on upgrade (see sync_dashboard_seed). +pub async fn get_dashboard(State(_state): State) -> Html { + let disk = dashboard_disk_path(); + sync_dashboard_seed(&disk); match std::fs::read_to_string(&disk) { Ok(page) => Html(page), Err(_) => Html(DASHBOARD_SEED.to_string()), @@ -200,7 +239,11 @@ pub async fn get_dashboard(State(_state): State) -> Html /// GET /api/dashboard/version — mtime of the disk page; the page polls this and /// reloads itself when it changes (the live-edit loop). pub async fn get_dashboard_version() -> (StatusCode, String) { - let v = std::fs::metadata(dashboard_disk_path()) + // Re-seed here too, so a page left open across an upgrade sees the mtime + // change and reloads itself onto the new build's page. + let disk = dashboard_disk_path(); + sync_dashboard_seed(&disk); + let v = std::fs::metadata(&disk) .and_then(|m| m.modified()) .ok() .and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok())