Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/<triple>/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'
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion sidecar/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sidecar/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
63 changes: 53 additions & 10 deletions sidecar/src/dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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<DashboardState>) -> Html<String> {
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-<ms>` 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<DashboardState>) -> Html<String> {
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()),
Expand All @@ -200,7 +239,11 @@ pub async fn get_dashboard(State(_state): State<DashboardState>) -> Html<String>
/// 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())
Expand Down
Loading