From 7fc3e81062963de6b61c72c399c24245efbb618e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Sun, 17 May 2026 11:46:37 +0200 Subject: [PATCH] hive-fr0nt: scaffold shared frontend-assets crate --- Cargo.toml | 3 ++- hive-fr0nt/Cargo.toml | 7 +++++++ hive-fr0nt/assets/base.css | 24 ++++++++++++++++++++++++ hive-fr0nt/src/lib.rs | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 hive-fr0nt/Cargo.toml create mode 100644 hive-fr0nt/assets/base.css create mode 100644 hive-fr0nt/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 2f4c26f..4c2bbbb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "3" -members = ["hive-ag3nt", "hive-c0re", "hive-sh4re"] +members = ["hive-ag3nt", "hive-c0re", "hive-fr0nt", "hive-sh4re"] [workspace.package] edition = "2024" @@ -18,6 +18,7 @@ must_use_candidate = "allow" anyhow = "1" axum = "0.8" clap = { version = "4", features = ["derive"] } +hive-fr0nt = { path = "hive-fr0nt" } hive-sh4re = { path = "hive-sh4re" } rmcp = { version = "1.7", default-features = false, features = [ "server", diff --git a/hive-fr0nt/Cargo.toml b/hive-fr0nt/Cargo.toml new file mode 100644 index 0000000..1bc5f00 --- /dev/null +++ b/hive-fr0nt/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "hive-fr0nt" +edition.workspace = true +version.workspace = true + +[lints] +workspace = true diff --git a/hive-fr0nt/assets/base.css b/hive-fr0nt/assets/base.css new file mode 100644 index 0000000..ee7b64e --- /dev/null +++ b/hive-fr0nt/assets/base.css @@ -0,0 +1,24 @@ +/* Base palette + typography shared by the hive-c0re dashboard and the + hive-ag3nt web UI. Catppuccin Mocha. Per-page stylesheets append on + top of this and must NOT redeclare the colour variables — the whole + point of pulling them out is one source of truth. */ +:root { + --bg: #1e1e2e; /* base */ + --bg-elev: #181825; /* mantle */ + --fg: #cdd6f4; /* text */ + --muted: #7f849c; /* overlay1 */ + --purple: #cba6f7; /* mauve */ + --purple-dim: #45475a;/* surface1 */ + --cyan: #89dceb; /* sky */ + --pink: #f5c2e7; /* pink */ + --amber: #fab387; /* peach */ + --green: #a6e3a1; /* green */ + --red: #f38ba8; /* red */ + --border: #313244; /* surface0 */ +} +body { + background: var(--bg); + color: var(--fg); + font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "Source Code Pro", monospace; + line-height: 1.6; +} diff --git a/hive-fr0nt/src/lib.rs b/hive-fr0nt/src/lib.rs new file mode 100644 index 0000000..0351345 --- /dev/null +++ b/hive-fr0nt/src/lib.rs @@ -0,0 +1,32 @@ +//! Shared frontend assets for the hive-c0re dashboard and the hive-ag3nt +//! per-container web UI. Both surfaces live in different binaries (and +//! different containers at runtime) but should feel like one product — +//! same colour tokens, same terminal-style live stream, same compose-box +//! ergonomics. Keeping the CSS + JS in one crate is the dumbest way to +//! make that true: both binaries `include_str!` from +//! `hive_fr0nt::assets::*` instead of growing their own copy. +//! +//! There is no Rust code beyond these `const` re-exports. The crate is a +//! container for text files and a place to write down the contract +//! between the two surfaces. +//! +//! Conventions for sharing: +//! - **CSS variables** live in [`BASE_CSS`] (colour palette, typography). +//! Page-specific stylesheets append to it; nothing else should declare +//! `--bg` / `--purple` / etc. +//! - **Terminal pane** (sticky-bottom log + `↓ N new` pill + fade-in +//! rows) lives in [`TERMINAL_CSS`] and [`TERMINAL_JS`]. Pages provide +//! a kind→renderer map; the JS owns the scroll + backfill + SSE plumbing. +//! - **Compose box** (textarea + slash-command palette + sticky +//! recipient + `@`-mention autocomplete) lives in [`COMPOSER_JS`]. +//! Pages pass a config flagging which features they want; the dashboard +//! ships `@`-mentions without slash commands, the agent page ships +//! slash commands without `@`-mentions. Both render through the same +//! component so the keystrokes, error flashes, and async-form +//! behaviour stay identical. +//! +//! Loading new shared assets: add the file under `assets/`, expose it as +//! a `pub const`, and `include_str!` it from whichever +//! `dashboard.rs` / `web_ui.rs` route needs it. + +pub const BASE_CSS: &str = include_str!("../assets/base.css");