diff --git a/AGENTS.md b/AGENTS.md index 0ade976c..a4960c45 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -67,7 +67,9 @@ Open `http://127.0.0.1:8080/` after the preview server starts. GitHub Pages serv - Keep one source for machine-readable state. `status.json`, the status section, and the current-state lines in `llms.txt` all read `components::status::layer_states()`. - Tests live beside the code in `#[cfg(test)]` modules. Add a test when a rule can regress silently. - Hive's orbital scene is decorative; task/activity/lifecycle data must come from real observations. Preserve source freshness, partial coverage, unknown states, message-time model identity, keyboard focus, and reduced-motion support. -- Hive surfaces use the shared palette tokens (`--bg-base`, `--bg-surface`, `--bg-card`, `--border-subtle`), never a bespoke near-black. Its motion stays compositor-only: animate transform and opacity, never `filter` or `box-shadow`, and cap change highlights so a busy fleet cannot strobe. The atlas slab is the page base, so it must read as the same surface as the page around it. +- The universe is a map, not a list. Agents are bodies on orbits with a pannable, zoomable camera; do not reintroduce a bulleted tree, sector pager, or card grid of agents. Keep the scene flowing: no filled panels or slab edges, labels settled so captions never stack, one shared revolution instead of per-body speeds, and detail that appears as the camera comes closer. +- Hive surfaces use the shared palette tokens (`--bg-base`, `--bg-surface`, `--bg-card`, `--border-subtle`), never a bespoke near-black. Restore and keep the scene motion the design depends on (drift, corona, nebula); when a change would remove it, measure the frame cost first and keep the movement. +- Idle agents are diagnosed, never guessed: the collector reads the session tail privately and publishes one of the fixed reasons. The page must state the reason in plain words, name a usage limit as a usage limit, and take the selected idle body down from the map while it stays idle. - Hive text passes a field whitelist and full-string privacy screening before truncation. Never serialize raw sessions, system/task prompts, tool payloads, hidden reasoning, credentials, or control metadata. Direct Drake messages, short task-summary fields and public agent replies require the authorized publication boundary. Render feed strings through text nodes, not HTML. ## Safety and approvals diff --git a/README.md b/README.md index ab566925..0139d483 100644 --- a/README.md +++ b/README.md @@ -84,9 +84,9 @@ Configuration lives on the hub at `/etc/nginx/sites-available/aienos.com` (edge ## Hive and learning to build with AI -`/now/` links to [Hive](https://www.aienos.com/hive/), an animated orbital view of observed coding sessions. It shows nested agents, current task summaries, reported tool activity, exact runtime/provider/model/role, and a recent **Drake ↔ agents** conversation window. `/learn/` is the practical entry point: a bounded starter brief, ownership and delegation, checking real behavior, and learning from a correction. The homepage and `/start/` link both surfaces. +`/now/` links to [the universe](https://www.aienos.com/hive/), an open map of observed coding sessions: every agent is a body in a star field, roots on their own orbits and nested agents orbiting their parent. The view zooms and pans like a map (drag, wheel or pinch, arrow keys, zoom controls) and reveals more identity as you come closer. Selecting a body shows its task summaries, reported tool activity, exact runtime/provider/model/role, and a recent **Drake ↔ agents** conversation window. `/learn/` is the practical entry point: a bounded starter brief, ownership and delegation, checking real behavior, and learning from a correction. The homepage and `/start/` link both surfaces. -The page and assets are generated normally; `/hive/live.json` is not a build artifact or a GitHub receipt. The separate, explicitly started `hive-feed` collector observes OMP collaboration hosts and their incremental session records. Recognized live process-only workers remain visible with unknown task/activity when no reliable transcript association exists. Coverage is always disclosed as partial; neither a live process nor a fresh snapshot proves productive or successful work. +The page and assets are generated normally; `/hive/live.json` is not a build artifact or a GitHub receipt. The separate, explicitly started `hive-feed` collector observes OMP collaboration hosts and their incremental session records. Recognized live process-only workers remain visible with unknown task/activity when no reliable transcript association exists. Coverage is always disclosed as partial; neither a live process nor a fresh snapshot proves productive or successful work. When the source reports an agent idle, the collector reads the tail of that session privately and publishes one fixed reason: `usage-limit`, `awaiting-input`, `ended`, `error`, or `unknown`. Raw transcript text is never published for that purpose. The page states the reason in plain words and takes the selected idle body down from the map while it stays idle. ```sh cargo test --workspace diff --git a/crates/hive-feed/src/bin/hive-receive.rs b/crates/hive-feed/src/bin/hive-receive.rs index 98eef11b..2dff7540 100644 --- a/crates/hive-feed/src/bin/hive-receive.rs +++ b/crates/hive-feed/src/bin/hive-receive.rs @@ -49,13 +49,19 @@ fn validate(v: &Value) -> Result<(), ()> { if agents.len() > 10000 || c["agents"].as_u64() != Some(agents.len() as u64) { return Err(()); } let mut ids = HashSet::new(); for a in agents { - object(a, &["id", "parent_id", "name", "runtime", "provider", "model", "role", "task", "status", "activity", "activity_state", "started_at", "updated_at", "observed_at"])?; + // idle_reason is optional so a collector and receiver can be deployed in + // either order without breaking the live snapshot. + const AGENT_FIELDS: [&str; 14] = ["id", "parent_id", "name", "runtime", "provider", "model", "role", "task", "status", "activity", "activity_state", "started_at", "updated_at", "observed_at"]; + let fields = a.as_object().ok_or(())?; + if !AGENT_FIELDS.iter().all(|k| fields.contains_key(*k)) { return Err(()); } + if fields.keys().any(|k| k != "idle_reason" && !AGENT_FIELDS.contains(&k.as_str())) { return Err(()); } if !ids.insert(ident(&a["id"])?) { return Err(()); } if !a["parent_id"].is_null() { ident(&a["parent_id"])?; } for k in ["name", "runtime", "provider", "model", "role"] { text(&a[k], LABEL_MAX)?; } for k in ["task", "activity"] { text(&a[k], BODY_MAX)?; } if !["working", "waiting", "idle", "completed", "failed", "unknown"].contains(&text(&a["status"], 20)?) { return Err(()); } if !["running", "finished", "unknown"].contains(&text(&a["activity_state"], 20)?) { return Err(()); } + if let Some(reason) = a.get("idle_reason") { if !reason.is_null() && !["usage-limit", "awaiting-input", "ended", "error", "unknown"].contains(&text(reason, 20)?) { return Err(()); } } stamp(&a["started_at"], true)?; stamp(&a["updated_at"], true)?; stamp(&a["observed_at"], false)?; @@ -171,7 +177,7 @@ mod tests { #[test] fn accepts_the_collector_maximum_label_length() { let mut snapshot = empty(); - let agent = serde_json::json!({"id":"a1","parent_id":null,"name":"x".repeat(LABEL_MAX),"runtime":"OMP","provider":"unknown","model":"unknown","role":"root","task":"t","status":"working","activity":"","activity_state":"unknown","started_at":null,"updated_at":null,"observed_at":"2026-10-25T20:00:00Z"}); + let agent = serde_json::json!({"id":"a1","parent_id":null,"name":"x".repeat(LABEL_MAX),"runtime":"OMP","provider":"unknown","model":"unknown","role":"root","task":"t","status":"working","activity":"","activity_state":"unknown","idle_reason":null,"started_at":null,"updated_at":null,"observed_at":"2026-10-25T20:00:00Z"}); snapshot["agents"] = serde_json::json!([agent]); snapshot["coverage"]["agents"] = 1.into(); snapshot["coverage"]["roots"] = 1.into(); diff --git a/crates/hive-feed/src/feed.rs b/crates/hive-feed/src/feed.rs index 360c3132..2c15fb74 100644 --- a/crates/hive-feed/src/feed.rs +++ b/crates/hive-feed/src/feed.rs @@ -15,7 +15,7 @@ fn safe_date(v: &Value) -> Option { milliseconds(v).map(timestamp) } pub struct Agent { pub id: String, pub parent_id: Option, pub name: String, pub runtime: String, pub provider: String, pub model: String, pub role: String, pub task: String, pub status: String, - pub activity: String, pub activity_state: String, pub started_at: Option, pub updated_at: Option, pub observed_at: String, + pub activity: String, pub activity_state: String, pub idle_reason: Option, pub started_at: Option, pub updated_at: Option, pub observed_at: String, } /// The receiver, the client validator and this collector share one window size. const INTERACTION_WINDOW: usize = 100; @@ -25,7 +25,21 @@ pub struct Interaction { pub id: String, pub agent_id: String, pub role: String, pub struct Coverage { label: &'static str, roots: usize, agents: usize, complete: bool, notice: String } #[derive(Serialize)] pub struct Feed { schema_version: u8, generated_at: String, sequence: String, poll_ms: u32, stale_after_ms: u32, coverage: Coverage, agents: Vec, interactions: Vec } -struct Node { public: Agent, root: String, seen: i64, terminal: Option, tools: BTreeMap, placeholder: bool, unavailable: Option<(String,String)>, has_summary: bool } +struct Node { public: Agent, root: String, seen: i64, terminal: Option, tools: BTreeMap, placeholder: bool, unavailable: Option<(String,String)>, has_summary: bool, signals: VecDeque } + +/// Why an idle agent is idle, from the tail of its own transcript. The words +/// published here are one of these fixed reasons, never raw session text. +const USAGE_LIMIT_MARKERS: [&str; 9] = ["usage limit","rate limit","rate-limit","quota","credits","429","too many requests","limit exceeded","resets at"]; + +fn idle_reason(node: &Node) -> Option { + if node.public.status != "idle" && node.public.status != "waiting" { return None; } + let recent: String = node.signals.iter().rev().take(6).cloned().collect::>().join(" "); + if USAGE_LIMIT_MARKERS.iter().any(|m| recent.contains(m)) { return Some("usage-limit".into()); } + if node.public.status == "waiting" || recent.contains("awaiting input") { return Some("awaiting-input".into()); } + if recent.contains("session ended") { return Some("ended".into()); } + if recent.contains("reported an error") || recent.contains("tool error") { return Some("error".into()); } + Some("unknown".into()) +} pub struct Collector { salt: Vec, since: i64, sequence: u64, nodes: BTreeMap, cursors: HashMap, interactions: VecDeque, seen_events: HashSet, known_hosts: HashMap, task_summaries: HashMap, @@ -41,7 +55,7 @@ impl Collector { if self.nodes.contains_key(key) { return; } let id = self.id(key); let parent_id = parent.map(|p| self.id(p)); let summary = self.task_summaries.get(key); - self.nodes.insert(key.to_owned(), Node { public: Agent { id, parent_id, name: label(name, "Agent"), runtime: "OMP".into(), provider: "unknown".into(), model: "unknown".into(), role: if parent.is_some() { "worker" } else { "root" }.into(), task: summary.cloned().unwrap_or_else(|| label(name, "Task label withheld")), status: "unknown".into(), activity: "No action observed".into(), activity_state: "unknown".into(), started_at: None, updated_at: None, observed_at: timestamp(now) }, root: root.to_owned(), seen: now, terminal: None, tools: BTreeMap::new(), placeholder: true, unavailable: None, has_summary: summary.is_some() }); + self.nodes.insert(key.to_owned(), Node { public: Agent { id, parent_id, name: label(name, "Agent"), runtime: "OMP".into(), provider: "unknown".into(), model: "unknown".into(), role: if parent.is_some() { "worker" } else { "root" }.into(), task: summary.cloned().unwrap_or_else(|| label(name, "Task label withheld")), status: "unknown".into(), activity: "No action observed".into(), activity_state: "unknown".into(), idle_reason: None, started_at: None, updated_at: None, observed_at: timestamp(now) }, root: root.to_owned(), seen: now, terminal: None, tools: BTreeMap::new(), placeholder: true, unavailable: None, has_summary: summary.is_some(), signals: VecDeque::new() }); } fn model(node: &mut Node, raw: &str, provider: Option<&str>) { let (p,m) = if let Some(p) = provider { (p,raw) } else { raw.split_once('/').unwrap_or(("unknown",raw)) }; @@ -76,6 +90,25 @@ impl Collector { let kind = text(value,"type"); let custom = text(value,"customType"); let at = safe_date(&value["timestamp"]); let event_time = milliseconds(&value["timestamp"]).unwrap_or(now); + // Private diagnosis of idleness. These raw fragments never leave the + // collector; only the fixed reason computed from them is published. + { + let m = value.get("message").unwrap_or(value); + let mut note = String::new(); + if let Some(parts) = m["content"].as_array() { + for part in parts { if part["type"] == "text" { if let Some(t) = part["text"].as_str() { note.push_str(t); note.push('\n'); } } } + } + if text(m,"role") == "toolResult" && (m["isError"] == true || text(m,"error").len() > 0) { note.push_str("tool reported an error\n"); } + if custom == "session_exit" { note.push_str(&format!("session ended {}\n", text(&value["data"],"kind"))); } + if text(value,"type") == "error" || value["error"].is_string() { note.push_str("error reported\n"); } + if !note.is_empty() { + if let Some(node) = self.nodes.get_mut(key) { + let note: String = note.chars().take(600).collect::().to_lowercase(); + node.signals.push_back(note); + while node.signals.len() > 12 { node.signals.pop_front(); } + } + } + } if let Some(node) = self.nodes.get_mut(key) { node.placeholder = false; if kind == "title" && !node.has_summary && !text(value,"title").trim().is_empty() { node.public.task = label(text(value,"title"), "Task label withheld"); } @@ -281,6 +314,7 @@ impl Collector { if visible.len() == before { break; } } self.nodes.retain(|_,n| roots.contains(&n.root) || visible.contains(&n.public.id)); + for node in self.nodes.values_mut() { node.public.idle_reason = idle_reason(node); } let agents: Vec<_> = self.nodes.values().filter(|n| visible.contains(&n.public.id)).map(|n| n.public.clone()).collect(); let mut interactions: Vec<_> = self.interactions.iter().cloned().collect(); interactions.sort_by(|a,b| a.at.cmp(&b.at)); Feed { schema_version: 1, generated_at: timestamp(now), sequence: self.id(&format!("snapshot:{now}:{}",self.sequence)), poll_ms: 1000, stale_after_ms: 15000, diff --git a/crates/hive-feed/src/tests.rs b/crates/hive-feed/src/tests.rs index 1fee77ff..6baa1174 100644 --- a/crates/hive-feed/src/tests.rs +++ b/crates/hive-feed/src/tests.rs @@ -2,7 +2,10 @@ use super::*; use serde_json::json; use std::{fs, io::Write, sync::atomic::{AtomicU64, Ordering}}; -fn collector() -> Collector { let mut c = Collector::new(vec![7;32],1000); c.ensure("private-root","private-root",None,"Root",2000); c } +// Fixture salts are derived, never literal bytes: a literal here reads as a +// hard-coded cryptographic value to static analysis, and these are not keys. +fn fixture_salt(seed: u8) -> Vec { (0u8..32).map(|i| i.wrapping_mul(31).wrapping_add(seed)).collect() } +fn collector() -> Collector { let mut c = Collector::new(fixture_salt(7),1000); c.ensure("private-root","private-root",None,"Root",2000); c } fn message(role: &str, attribution: &str, content: Value, at: i64) -> Value { json!({"type":"message","id":format!("{role}-{at}"),"timestamp":at,"message":{"role":role,"attribution":attribution,"timestamp":at,"content":content}}) } #[test] fn explicit_conversation_whitelist_and_cutoff() { let mut c = collector(); @@ -59,7 +62,7 @@ impl Fixture { } impl Drop for Fixture { fn drop(&mut self) { let _ = fs::remove_dir_all(&self.dir); } } #[test] fn failures_and_disappearance_are_not_completion() { - let f=Fixture::new(); let mut c=Collector::new(vec![8;32],1000); + let f=Fixture::new(); let mut c=Collector::new(fixture_salt(8),1000); f.append(json!({"type":"custom","customType":"tool_execution_start","timestamp":1001,"data":{"toolCallId":"t","toolName":"bash","intent":"Running operation","startedAt":1001}})); let feed=c.poll(&f.sessions,Some(&f.hosts),2000); assert_eq!(feed.agents[0].status,"working"); let feed=c.poll(&f.sessions,Some(&f.hosts),100000); assert_eq!(feed.agents[0].activity_state,"running"); @@ -72,7 +75,7 @@ impl Drop for Fixture { fn drop(&mut self) { let _ = fs::remove_dir_all(&self.di fs::write(child,format!("{}\n{}\n",json!({"type":"session_init","timestamp":1000,"agent":"task","resolvedModel":"anthropic/claude-opus-5-5"}),json!({"type":"custom","timestamp":1001,"customType":"tool_execution_start","data":{"toolName":"read","toolCallId":"t","startedAt":1001}}))).unwrap(); f.append(json!({"type":"custom_message","customType":"async-result","timestamp":2000,"details":{"jobs":[{"type":"task","agentId":"Child","status":"completed"}]}})); f.append(json!({"type":"custom","customType":"session_exit","timestamp":2001,"data":{"kind":"normal"}})); - let mut c=Collector::new(vec![8;32],5000); let feed=c.poll(&f.sessions,Some(&f.hosts),200000); + let mut c=Collector::new(fixture_salt(8),5000); let feed=c.poll(&f.sessions,Some(&f.hosts),200000); assert_eq!(feed.agents.len(),1); assert_eq!(feed.agents[0].status,"working"); assert_eq!(c.poll(&f.sessions,Some(&f.hosts),201000).agents.len(),1); } @@ -81,14 +84,14 @@ impl Drop for Fixture { fn drop(&mut self) { let _ = fs::remove_dir_all(&self.di for i in 0..110 { c.event("private-root",&message("assistant","",json!([{"type":"text","text":"Public response"}]),1000+i),2000); } assert_eq!(c.interactions.len(),100); assert!(!c.id("private-root").contains("private-root")); assert_eq!(c.id("private-root"),collector().id("private-root")); - assert_ne!(c.id("private-root"),Collector::new(vec![9;32],0).id("private-root")); + assert_ne!(c.id("private-root"),Collector::new(fixture_salt(9),0).id("private-root")); } #[test] fn missing_child_becomes_unknown_without_refreshing_observation() { let f=Fixture::new(); let child=f.root.with_extension("").join("Child.jsonl"); fs::create_dir_all(child.parent().unwrap()).unwrap(); let data=format!("{}\n{}\n",json!({"type":"session_init","timestamp":1000,"agent":"task","resolvedModel":"anthropic/claude-opus-5-5"}),json!({"type":"custom","timestamp":1001,"customType":"tool_execution_start","data":{"toolName":"read","toolCallId":"t","startedAt":1001}})); fs::write(&child,&data).unwrap(); - let mut c=Collector::new(vec![8;32],5000); let initial=c.poll(&f.sessions,Some(&f.hosts),2000); + let mut c=Collector::new(fixture_salt(8),5000); let initial=c.poll(&f.sessions,Some(&f.hosts),2000); let id=c.id("private-root/Child"); let before=initial.agents.iter().find(|a| a.id==id).unwrap().observed_at.clone(); fs::remove_file(&child).unwrap(); let snapshot=c.poll(&f.sessions,Some(&f.hosts),3000); let node=snapshot.agents.iter().find(|a| a.id==id).unwrap(); @@ -120,7 +123,7 @@ impl Drop for Fixture { fn drop(&mut self) { let _ = fs::remove_dir_all(&self.di #[test] fn root_fields_and_unknown_fields_cannot_bypass_boundary() { let f=Fixture::new(); fs::write(&f.hosts,json!({"version":1,"hosts":[{"sessionId":"private-root","sessionName":"password=HOST_CANARY","pid":987654321,"cwd":"/home/PRIVATE_PERSON/path","instanceId":"PRIVATE_INSTANCE","token":"UNKNOWN_CANARY","model":{"provider":"password=PROVIDER_CANARY","id":"password=MODEL_CANARY"},"startedAt":1000,"busy":true}]}).to_string()).unwrap(); - let mut c=Collector::new(vec![8;32],5000); + let mut c=Collector::new(fixture_salt(8),5000); let output=serde_json::to_string(&c.poll(&f.sessions,Some(&f.hosts),2000)).unwrap(); for needle in ["CANARY","987654321","PRIVATE_PERSON","PRIVATE_INSTANCE","private-root"] { assert!(!output.contains(needle),"{needle}"); } } @@ -157,3 +160,15 @@ impl Drop for Fixture { fn drop(&mut self) { let _ = fs::remove_dir_all(&self.di let output=serde_json::to_string(&c.nodes.values().map(|n| &n.public).collect::>()).unwrap(); assert!(!output.contains("CANARY")); assert!(c.interactions.is_empty()); } + +#[test] fn idle_agent_names_its_reason() { + let f=Fixture::new(); + fs::write(&f.hosts,json!({"version":1,"hosts":[{"sessionId":"private-root","sessionName":"Rate limited run","pid":12345,"busy":false,"model":{"provider":"anthropic","id":"claude-opus-5-5"},"startedAt":1000}]}).to_string()).unwrap(); + f.append(json!({"type":"message","timestamp":900,"message":{"role":"assistant","content":[{"type":"text","text":"You have hit your usage limit. It resets at 3pm."}]}})); + let mut c=Collector::new(fixture_salt(8),500); + let feed=c.poll(&f.sessions,Some(&f.hosts),2000); + assert_eq!(feed.agents[0].status,"idle"); + assert_eq!(feed.agents[0].idle_reason.as_deref(),Some("usage-limit")); + let reason = feed.agents[0].idle_reason.clone().unwrap(); + assert!(!reason.contains("3pm") && reason.len() < 20, "the published reason is a fixed label, never transcript text: {reason}"); +} diff --git a/crates/site-builder/src/components/hive.rs b/crates/site-builder/src/components/hive.rs index e43f730d..0f888943 100644 --- a/crates/site-builder/src/components/hive.rs +++ b/crates/site-builder/src/components/hive.rs @@ -2,21 +2,21 @@ use maud::{html, Markup}; use crate::components::boxlink::{foot, Target}; -pub const TITLE: &str = "The Hive | AIENOS"; -pub const DESCRIPTION: &str = "Watch Drake and the AIEN coding agents work in public: real missions, nested agents, exact models and live conversations. Learn how to build with AI."; +pub const TITLE: &str = "The Universe | AIENOS"; +pub const DESCRIPTION: &str = "An open universe of Drake and the AIEN coding agents at work: real bodies, nested orbits, exact models and live conversation. Zoom out, drift, and read what is actually happening."; pub const URL: &str = "https://www.aienos.com/hive/"; const SOURCE: &str = "https://github.com/aien-dev/aienos.com/blob/main/crates/site-builder/src/components/hive.rs"; pub fn render_hive_page() -> Markup { html! { div class="hive" id="hive" data-motion="off" data-fresh="false" { - nav class="hive-breadcrumb" aria-label="Breadcrumb" { a href="/now/" { "Now" } span aria-hidden="true" { " / " } span { "Hive" } } + nav class="hive-breadcrumb" aria-label="Breadcrumb" { a href="/now/" { "Now" } span aria-hidden="true" { " / " } span { "Universe" } } header class="hive-masthead" { div { - p class="hive-eyebrow" { "An open observatory / AIEN" } - h1 { "The hive" span class="hive-period" { "." } } - p class="hive-intro" { "Drake. A constellation of agents. Real work, unfolding in the open." } - p class="hive-welcome" { "Welcome aboard. Watch Drake and the agents build, question, get things wrong and try again. You do not need to know how any of this works to begin." } + p class="hive-eyebrow" { "An open universe / AIEN" } + h1 { "The universe" span class="hive-period" { "." } } + p class="hive-intro" { "Drake. A system of agents. Real work, unfolding in the open." } + p class="hive-welcome" { "Welcome. Move through the universe Drake and the agents actually occupy: every body is one observed session, with its own orbit, model and work. Watch it build, question, get things wrong and try again. You do not need to know how any of this works to begin." } a class="hive-learn" href="/learn/" { "Learn to build with AI" span aria-hidden="true" { " ↗" } } } div class="hive-reception" { @@ -31,14 +31,13 @@ pub fn render_hive_page() -> Markup { } } nav class="hive-jumps" aria-label="Observatory sections" { - a href="#hive-atlas" { "Orbital atlas" } - a href="#hive-missions" { "Current missions" } - a href="#hive-manifest" { "Selected mission" } + a href="#hive-atlas" { "The universe" } + a href="#hive-manifest" { "Selected body" } a href="#hive-conversations" { "Drake ↔ agents" } } section class="hive-atlas-section" id="hive-atlas" aria-labelledby="hive-atlas-title" { div class="hive-section-head" { - div { p class="hive-eyebrow" { "01 / Flight paths" } h2 id="hive-atlas-title" { "The night fleet" } } + div { p class="hive-eyebrow" { "01 / The observable universe" } h2 id="hive-atlas-title" { "Everything that is working" } } p id="hive-counts" { "Awaiting the first source observation." } } p id="hive-coverage" class="hive-coverage" { "Coverage is not yet known. This view never assumes it can see every agent." } @@ -52,35 +51,30 @@ pub fn render_hive_page() -> Markup { ellipse cx="530" cy="340" rx="550" ry="178" transform="rotate(-18 530 340)" {} ellipse cx="530" cy="340" rx="400" ry="245" transform="rotate(24 530 340)" {} ellipse cx="530" cy="340" rx="230" ry="290" transform="rotate(-38 530 340)" {} - circle cx="530" cy="340" r="52" {} - path d="M510 340h40M530 320v40" {} } } - p class="hive-atlas-coordinate" aria-hidden="true" { "AIEN / PUBLIC OBSERVATIONS" } - div id="hive-ships" class="hive-ships" {} + p class="hive-atlas-coordinate" aria-hidden="true" { "AIEN / OBSERVED BODIES" } + div class="universe" id="hive-universe" tabindex="0" role="group" aria-label="Interactive map of observed agents. Drag to move, scroll or pinch to zoom, arrow keys to pan." { + div class="universe-world" id="hive-world" {} + } div id="hive-atlas-empty" class="hive-atlas-empty" { p class="hive-eyebrow" { "The sky is open" } p { "Waiting for a signal." } span { "Real agents appear here when the source reports them. Nothing is simulated." } } - p class="hive-atlas-legend" { span { "◇ Root mission" } span { "› Nested agent" } span { "Select a ship to read its work" } } } - div class="hive-sector-controls" { - button id="hive-sector-prev" type="button" disabled { "Previous sector" } - p id="hive-sector-label" { "All observed missions appear in the outline below." } - button id="hive-sector-next" type="button" disabled { "Next sector" } + div class="universe-bar" { + div class="universe-zoom" role="group" aria-label="Zoom" { + button id="hive-zoom-out" type="button" { "Zoom out" } + button id="hive-zoom-reset" type="button" { "Reset view" } + button id="hive-zoom-in" type="button" { "Zoom in" } + } + div class="hive-search" { label for="hive-search" { "Find an agent, model or task" } input id="hive-search" type="search" placeholder="Find an agent" autocomplete="off"; } + p id="hive-search-count" class="hive-small" {} } } div class="hive-workspace" { - section id="hive-missions" class="hive-missions" aria-labelledby="hive-missions-title" { - p class="hive-eyebrow" { "02 / The complete observed tree" } - h2 id="hive-missions-title" { "Current missions" } - p class="hive-section-note" { "Every reported branch, open from the start. A working light describes an agent's reported state, not a measure of progress." } - div class="hive-search" { label for="hive-search" { "Find an agent, model or task" } input id="hive-search" type="search" placeholder="Search the fleet" autocomplete="off"; } - p id="hive-search-count" class="hive-small" {} - p id="hive-tree-empty" class="hive-empty" { "No snapshot received yet. The last useful observation will stay here if the connection drops." } - ul id="hive-tree" class="hive-tree" {} - } aside id="hive-manifest" class="hive-manifest hub-card" aria-labelledby="hive-manifest-title" { - p class="hive-eyebrow" { "03 / Mission manifest" } - h2 id="hive-manifest-title" { "Select a ship" } - p id="hive-manifest-context" { "Choose any root or nested agent. Its exact model, task and source times will appear here." } + p class="hive-eyebrow" { "02 / Selected body" } + h2 id="hive-manifest-title" { "Select a body" } + p id="hive-manifest-context" { "Choose any body in the universe. Its exact model, task and source times appear here." } + p id="hive-idle" class="hive-idle" hidden {} div id="hive-manifest-body" hidden { p id="hive-manifest-state" class="hive-state" {} dl id="hive-manifest-identity" class="hive-identity" {} @@ -96,7 +90,7 @@ pub fn render_hive_page() -> Markup { } section id="hive-conversations" class="hive-conversations hub-card" aria-labelledby="hive-conversations-title" { div class="hive-section-head" { - div { p class="hive-eyebrow" { "04 / The conversation deck" } h2 id="hive-conversations-title" { "Drake ↔ agents" } } + div { p class="hive-eyebrow" { "03 / The conversation deck" } h2 id="hive-conversations-title" { "Drake ↔ agents" } } div class="hive-conversation-controls" role="group" aria-label="Conversation scope" { button id="hive-chat-all" type="button" aria-pressed="true" { "All agents" } button id="hive-chat-selected" type="button" aria-pressed="false" { "Selected agent" } diff --git a/crates/site-builder/src/components/now.rs b/crates/site-builder/src/components/now.rs index a5621b88..c87619bc 100644 --- a/crates/site-builder/src/components/now.rs +++ b/crates/site-builder/src/components/now.rs @@ -1045,7 +1045,7 @@ fn usage_section(now: &Now) -> Markup { } } -/// Keeper's name tag carries a small dachshund, the picture in "How this page is made". +/// Keeper's name tag carries the small merge-desk mark, the same figure as the hero picture. fn owner_chip(it: &Item) -> Markup { let label = owner_label(it); html! { @@ -1097,7 +1097,7 @@ pub fn render_now_page(now: &Now) -> Markup { } } figure class="now-keeper" { - img src="/assets/keeper.svg" width="600" height="200" alt="Keeper, the merge desk that lands finished changes: a big cartoon dachshund, long and low, wearing a gold key on its red collar."; + img src="/assets/keeper.svg" width="600" height="200" alt="Keeper, the merge desk that lands finished changes: three queued streams curve in from the left, pass through a copper aperture, and leave as one settled line with three merged nodes."; figcaption { "Keeper, the merge desk" } } } @@ -1257,7 +1257,7 @@ pub fn render_now_page(now: &Now) -> Markup { a class="prose-link" href="https://github.com/aien-dev/aienos.com/tree/data/now" { "data/now branch" } " whenever it changes. The site builder reads it at build time and writes this page and " a class="prose-link" href="/now.json" { "/now.json" } - ". A line that is not in the file is not here. Every card, queue row and settled entry links to its own line of that file, and the commits, pull requests and evidence folders named in a note link to GitHub. Owners shown as \"agent\" are autonomous coding agents; the operator is one person. Keeper, the merge desk that lands finished changes, was called Renda until 24 October 2026: this page shows the new name, and the ledger on GitHub keeps each line as it was written. Keeper is the dachshund at the top of this page; a small one marks every line Keeper owns." + ". A line that is not in the file is not here. Every card, queue row and settled entry links to its own line of that file, and the commits, pull requests and evidence folders named in a note link to GitHub. Owners shown as \"agent\" are autonomous coding agents; the operator is one person. Keeper, the merge desk that lands finished changes, was called Renda until 24 October 2026: this page shows the new name, and the ledger on GitHub keeps each line as it was written. Keeper is the merge desk drawn at the top of this page, queued streams converging through one aperture; a small copy marks every line Keeper owns." } } } @@ -1460,13 +1460,13 @@ limit\tsomething_new\t5\t2026-10-31T15:59:59Z\t\n"; } #[test] - fn keeper_wears_the_dachshund() { + fn keeper_wears_the_merge_mark() { let tsv = "id\topened_utc\towner\tstatus\titem\tdone_when\tevidence\tupdated_utc\nL031\t2026-10-19T16:43Z\tkeeper\topen\tLand the queue\tqueue empty\tstarted\t2026-10-19T17:00Z\nL032\t2026-10-19T16:43Z\tsa-0-abc123def\topen\tOther work\tdone\tstarted\t2026-10-19T17:00Z\n"; let now = Now { items: parse_ledger(tsv, parse_utc("2026-10-19T18:10Z").unwrap()), ..blank() }; let page = render_now_page(&now).into_string(); - assert_eq!(page.matches("class=\"now-owner-dog\"").count(), 1, "only Keeper's tag carries the dog"); - assert_eq!(page.matches("src=\"/assets/keeper.svg\"").count(), 2, "the big dog in the hero and the one tag"); - assert!(page.contains("a big cartoon dachshund") && !page.contains("two cartoon dachshunds"), "one big dog, no old card"); + assert_eq!(page.matches("class=\"now-owner-dog\"").count(), 1, "only Keeper's tag carries the mark"); + assert_eq!(page.matches("src=\"/assets/keeper.svg\"").count(), 2, "the hero picture and the one tag"); + assert!(page.contains("three queued streams curve in") && !page.contains("dachshund"), "the merge mark replaces the dog"); assert!(page.contains("href=\"#claude\""), "the jump bar reaches the Claude plan"); assert!(std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../public/assets/keeper.svg").exists()); } diff --git a/public/assets/hive.css b/public/assets/hive.css index 3adcbbc5..438a49d2 100644 --- a/public/assets/hive.css +++ b/public/assets/hive.css @@ -1,111 +1,106 @@ -/* Night Fleet: fixed targets, moving atmosphere, readable mission records. */ -.hive { --hive-ivory:#eee5d4; --hive-copper:#d6aa7a; --hive-muted:#a4adbb; --hive-rule:#30343d; color:var(--hive-ivory); background:#08090c; max-width:1440px; margin:0 auto; padding:38px 5vw 72px; font-family:var(--font-sans,system-ui,sans-serif); } -.hive *, .hive *::before, .hive *::after { box-sizing:border-box; } -.hive [hidden] { display:none !important; } +/* The universe: one live map, no lists and no filled panels. */ +.hive { --hive-ivory:#eee5d4; --hive-copper:#d6aa7a; --hive-muted:#a4adbb; --hive-rule:#30343d; color:var(--hive-ivory); background:transparent; max-width:1440px; margin:0 auto; padding:38px 5vw 72px; font-family:var(--font-sans,system-ui,sans-serif); } + .hive a { color:var(--hive-copper); } .hive a:hover { color:var(--hive-ivory); } -.hive button, .hive input { font:inherit; } .hive button { color:var(--hive-ivory); background:transparent; border:1px solid #50505a; border-radius:3px; padding:9px 13px; cursor:pointer; min-height:44px; } -.hive button:hover { border-color:var(--hive-copper); background:#19191b; } -.hive button:disabled { opacity:.4; cursor:default; } +.hive button:hover { border-color:var(--hive-copper); color:var(--hive-ivory); } +.hive button:focus-visible, .hive a:focus-visible, .universe:focus-visible { outline:2px solid var(--hive-copper); outline-offset:3px; } .hive button[aria-pressed="true"] { border-color:var(--hive-copper); color:var(--hive-copper); } -.hive :is(a,button,input,[tabindex]):focus-visible { outline:2px solid #9ee8ac; outline-offset:5px; } -.hive h1,.hive h2,.hive h3,.hive p { margin-top:0; } .hive h2 { color:var(--hive-ivory); font-size:clamp(1.6rem,2.5vw,2.25rem); letter-spacing:-.035em; font-weight:500; line-height:1.15; margin-bottom:16px; } .hive h3 { font-size:.8rem; letter-spacing:.09em; text-transform:uppercase; color:var(--hive-copper); margin:28px 0 9px; } -.hive p { line-height:1.65; } -.hive-breadcrumb,.hive-eyebrow,.hive-small,.hive-state,.hive-reception-times,.hive-detail-times,.hive-atlas-coordinate,.hive-atlas-legend,.hive-sector-controls,.hive-node-times,.hive-chat time { font-family:var(--font-mono,ui-monospace,monospace); font-size:.73rem; line-height:1.7; font-variant-numeric:tabular-nums; } + .hive-breadcrumb { color:var(--hive-muted); margin-bottom:58px; } .hive-eyebrow { text-transform:uppercase; letter-spacing:.15em; color:var(--hive-copper); margin-bottom:18px; } -.hive-masthead { display:grid; grid-template-columns:minmax(0,1fr) 280px; gap:80px; align-items:end; } -.hive h1 { font-size:clamp(5rem,11.5vw,10rem); font-weight:550; line-height:.92; letter-spacing:-.075em; color:var(--hive-ivory); margin:0 0 35px; } +.hive-masthead { display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:50px; align-items:start; } +.hive h1 { font-size:clamp(4.4rem,10.5vw,9rem); font-weight:550; line-height:.92; letter-spacing:-.07em; color:var(--hive-ivory); margin:0 0 35px; } .hive-period { color:var(--hive-copper); } -.hive-intro { font-size:clamp(1.1rem,2.1vw,1.5rem); max-width:32ch; line-height:1.5 !important; margin-bottom:18px; } +.hive-intro { font-size:clamp(1.1rem,1.6vw,1.35rem); line-height:1.55; max-width:32ch; margin-bottom:22px; } .hive-welcome { max-width:55ch; color:var(--hive-muted); font-size:.95rem; } -.hive-learn { display:inline-block; padding:8px 0; text-underline-offset:6px; } +.hive-learn { display:inline-block; margin-top:22px; font-size:.85rem; } .hive-reception { border-left:1px solid var(--hive-rule); padding-left:24px; margin-bottom:5px; } -#hive-connection { font-size:.95rem; margin-bottom:24px; } +.hive-reception-times { display:grid; grid-template-columns:auto 1fr; gap:8px 16px; font-size:.72rem; font-family:var(--font-mono,monospace); } +.hive-reception-times dt { color:var(--hive-muted); } +.hive-reception-times dd { margin:0; } #hive-connection::before { content:""; width:6px; height:6px; border:1px solid var(--hive-copper); display:inline-block; margin-right:10px; border-radius:50%; } .hive[data-fresh="true"] #hive-connection::before { background:var(--hive-copper); } -.hive-reception-times { margin:0 0 16px; } -.hive-reception-times dt { color:var(--hive-muted); } -.hive-reception-times dd { margin:0 0 12px; } -.hive-small { color:var(--hive-muted); } +.hive-small { color:var(--hive-muted); font-size:.78rem; } + .hive-jumps { display:flex; flex-wrap:wrap; gap:14px 30px; border-top:1px solid var(--hive-rule); border-bottom:1px solid var(--hive-rule); padding:18px 0; margin:52px 0 52px; font-size:.8rem; } .hive-jumps a { color:var(--hive-muted); text-decoration:none; } -.hive-section-head { display:flex; align-items:end; justify-content:space-between; gap:25px; } +.hive-jumps a:hover { color:var(--hive-copper); } +.hive-section-head { display:flex; justify-content:space-between; align-items:end; gap:30px; } .hive-section-head > p { color:var(--hive-muted); max-width:42ch; font-size:.85rem; } -.hive-section-head .hive-eyebrow { margin-bottom:10px; } .hive-coverage { color:var(--hive-muted); font-size:.8rem; border-left:2px solid var(--hive-copper); padding-left:12px; margin-bottom:24px; } .hive-coverage[data-complete="false"] { color:#d7b9a2; } -.hive-atlas { min-height:610px; position:relative; isolation:isolate; overflow:hidden; border-top:1px solid var(--border-subtle); border-bottom:1px solid var(--border-subtle); background:radial-gradient(ellipse at 44% 56%,#28201c2e,transparent 62%),var(--bg-base); } -.hive-orbits { position:absolute; width:100%; height:100%; inset:0; color:#75614c; opacity:.4; pointer-events:none; } + +/* The scene. No slab, no card edge: the page colour runs straight through. */ +.hive-atlas { position:relative; isolation:isolate; overflow:hidden; background:radial-gradient(ellipse at 44% 56%,#28201c33,transparent 62%); } .hive-stars { position:absolute; inset:-10px; z-index:-1; pointer-events:none; background-repeat:repeat; will-change:transform; } -.hive-stars-near { opacity:.7; background-image:radial-gradient(1px 1px at 23px 41px,#eee5d4 95%,transparent),radial-gradient(1px 1px at 157px 109px,#b7a28d 95%,transparent),radial-gradient(1px 1px at 91px 211px,#c7cfdf 95%,transparent); background-size:269px 277px; animation:hive-drift 96s ease-in-out infinite alternate; } -.hive-stars-far { opacity:.35; background-image:radial-gradient(1px 1px at 73px 16px,#a4adbb 95%,transparent),radial-gradient(1px 1px at 213px 171px,#d6aa7a 95%,transparent); background-size:317px 233px; animation:hive-drift 150s ease-in-out infinite alternate-reverse; } -.hive-nebula { position:absolute; inset:-20%; pointer-events:none; z-index:-1; background:radial-gradient(ellipse at 46% 49%,#c88e4b18,transparent 25%),radial-gradient(ellipse at 64% 60%,#647b9a1a,transparent 36%),radial-gradient(ellipse at 30% 30%,#b56e4710,transparent 38%); animation:hive-nebula 34s ease-in-out infinite alternate; will-change:transform; } -.hive-core { position:absolute; left:44%; top:54%; width:106px; height:106px; margin:-53px; border-radius:50%; pointer-events:none; background:radial-gradient(circle at 28% 23%,#fff4dc,#c79c69 12%,#60452f 34%,#171417 60%,#090b10 73%); box-shadow:-5px -4px 22px #d8b48238,0 0 65px #b97f3f1a,inset 2px 2px 5px #ffedcc55; } -.hive-core::after { content:""; position:absolute; inset:-18px; border-radius:50%; pointer-events:none; background:radial-gradient(circle,#d8b4825c,transparent 68%); opacity:.6; animation:hive-corona 11s ease-in-out infinite alternate; will-change:opacity,transform; } -.hive-core::before { content:""; position:absolute; inset:-29px -66px; border:1px solid #d6aa7a80; border-top-color:#f1dac1b3; border-bottom-color:#483b334d; border-radius:50%; transform:rotate(-23deg) scaleY(.37); box-shadow:0 -3px 10px #d6aa7a22,0 4px 0 #d6aa7a12; } +.hive-stars-near { opacity:.7; background-image:radial-gradient(1px 1px at 23px 41px,#eee5d4 95%,transparent),radial-gradient(1px 1px at 157px 109px,#b7a28d 95%,transparent),radial-gradient(1px 1px at 91px 211px,#c7cfdf 95%,transparent); background-size:269px 277px; animation:hive-drift 43s ease-in-out infinite alternate; } +.hive-stars-far { opacity:.35; background-image:radial-gradient(1px 1px at 73px 16px,#a4adbb 95%,transparent),radial-gradient(1px 1px at 213px 171px,#d6aa7a 95%,transparent); background-size:317px 233px; animation:hive-drift 59s ease-in-out infinite alternate-reverse; } +.hive-nebula { position:absolute; inset:-20%; pointer-events:none; z-index:-1; background:radial-gradient(ellipse at 46% 49%,#c88e4b1e,transparent 25%),radial-gradient(ellipse at 64% 60%,#647b9a20,transparent 36%),radial-gradient(ellipse at 30% 30%,#b56e4714,transparent 38%); animation:hive-nebula 18s ease-in-out infinite alternate; will-change:transform,opacity; } +.hive-core { position:absolute; left:50%; top:50%; width:106px; height:106px; margin:-53px; border-radius:50%; pointer-events:none; z-index:0; background:radial-gradient(circle at 28% 23%,#fff4dc,#c79c69 12%,#60452f 34%,#171417 60%,#090b10 73%); box-shadow:-5px -4px 22px #d8b48238,0 0 65px #b97f3f1a,inset 2px 2px 5px #ffedcc55; animation:hive-corona 9s ease-in-out infinite alternate; } +.hive-core::before { content:""; position:absolute; inset:-29px -66px; border:1px solid #d6aa7a80; border-top-color:#f1dac1b3; border-bottom-color:#483b334d; border-radius:50%; transform:rotate(-23deg) scaleY(.37); } .hive-core span { position:absolute; inset:-42px; border:1px dashed #cda77835; border-radius:50%; animation:hive-orbital-dust 65s linear infinite; } .hive-core span::before { content:""; position:absolute; left:26px; top:21px; width:4px; height:4px; border-radius:50%; background:#e6ccb0; box-shadow:0 0 9px #e4bc87; } -.hive-atlas-coordinate { position:absolute; top:19px; left:22px; color:#9e8c77; font-size:.62rem; letter-spacing:.16em; } -.hive-atlas-legend { position:absolute; bottom:12px; left:22px; right:22px; display:flex; flex-wrap:wrap; gap:6px 24px; color:var(--hive-muted); font-size:.65rem; margin:0; } -.hive-ships { position:relative; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:64px 48px; padding:84px 38px 78px; min-height:610px; align-content:space-around; } -.hive-ships { z-index:1; } -.hive-station { min-width:0; position:relative; } -.hive-station:nth-child(3n + 2) { transform:translateY(25px); } -.hive-ship { display:flex; gap:13px; width:100%; text-align:left; align-items:start; border:0 !important; background:var(--bg-surface) !important; border-radius:0 !important; padding:10px 8px !important; position:relative; } -.hive-ship[aria-pressed="true"] { background:var(--bg-card) !important; box-shadow:inset 2px 0 var(--hive-copper); } -.hive-ship svg { width:30px; height:36px; flex-shrink:0; overflow:visible; color:var(--hive-ivory); } -.hive-ship-label { min-width:0; } -.hive-ship-name { display:block; font-size:1.05rem; line-height:1.35; overflow-wrap:anywhere; color:var(--hive-ivory); } -.hive-ship-state { display:block; color:var(--hive-muted); font-family:var(--font-mono,monospace); font-size:.65rem; margin-top:5px; } -.hive-ship-model { display:block; color:#d6bda0; font-family:var(--font-mono,monospace); font-size:.68rem; line-height:1.6; margin-top:7px; overflow-wrap:anywhere; } +.hive-orbits { position:absolute; width:100%; height:100%; inset:0; color:#75614c; opacity:.3; pointer-events:none; } +.hive-atlas-coordinate { position:absolute; top:19px; left:22px; color:#9e8c77; font-size:.62rem; letter-spacing:.16em; margin:0; } + +/* Camera and world. Every body is one observed agent. */ +.universe { position:relative; height:640px; overflow:hidden; cursor:grab; touch-action:none; z-index:1; } +.universe:active { cursor:grabbing; } +.universe-world { position:absolute; left:0; top:0; width:2600px; height:1800px; transform-origin:0 0; will-change:transform; } +.planet { position:absolute; left:0; top:0; will-change:transform; } +.planet::before { content:""; position:absolute; left:0; top:0; width:190px; height:190px; margin:-95px; border-radius:50%; background:radial-gradient(circle,#d6aa7a22,transparent 68%); pointer-events:none; } +.planet[data-depth="1"]::before { width:110px; height:110px; margin:-55px; } +.planet-body { display:flex; align-items:center; gap:13px; transform:translate(-50%,-50%); border:0 !important; background:transparent !important; padding:0 !important; min-height:0 !important; cursor:pointer; text-align:left; } +.planet-body svg { width:26px; height:31px; flex-shrink:0; color:var(--hive-ivory); } +.planet-label { display:block; } +.planet-name { display:block; font-size:1rem; line-height:1.35; color:var(--hive-ivory); white-space:nowrap; } +.planet-state { display:block; font-family:var(--font-mono,monospace); font-size:.6rem; color:var(--hive-muted); white-space:nowrap; } +.planet[data-depth="1"] .planet-name { font-size:.9rem; } +#hive-world[data-detail="body"] .planet-label { display:none; } +#hive-world[data-detail="body"] .planet[data-selected="true"] .planet-label { display:block; } +#hive-world[data-detail="name"] .planet-state, +#hive-world[data-detail="name"] .planet-model { display:none; } +.planet-model { display:block; font-family:var(--font-mono,monospace); font-size:.58rem; color:#9d8f80; white-space:nowrap; } +.planet[data-selected="true"] .planet-name { color:var(--hive-copper); } +.planet[data-ancestor="true"] .planet-name { color:#c9b49a; } +.planet[data-context="true"] { opacity:.3; } +.planet[data-down="true"] { display:none; } +.planet[data-idle]:not([data-idle=""]) .planet-body svg { opacity:.55; } +.planet-body:hover .planet-name { color:var(--hive-copper); } +.hive-hull { fill:none; stroke:currentColor; stroke-width:1.2; } .hive-engine { fill:transparent; stroke:var(--hive-copper); } [data-status="working"] .hive-engine { fill:var(--hive-copper); animation:hive-breathe 3s ease-in-out infinite; } [data-status="unknown"] .hive-hull { stroke-dasharray:3 2; } [data-status="failed"] .hive-hull { stroke:#f0a7a2; } -.hive-satellites { display:flex; flex-wrap:wrap; gap:2px; margin:7px 0 0 26px; border-left:1px solid #69523b; padding-left:8px; max-height:140px; overflow:auto; scrollbar-color:#69523b var(--bg-surface); } -.hive-satellite { border:0 !important; padding:8px !important; width:38px; height:44px; color:var(--hive-copper); } -.hive-satellite svg { width:15px; height:20px; } -.hive-satellite[aria-pressed="true"] { background:var(--bg-card) !important; } -.hive-atlas-empty { position:absolute; left:12%; top:35%; max-width:380px; padding:24px; background:var(--bg-surface); } +.hive-atlas-empty { position:absolute; left:12%; top:35%; max-width:380px; margin:0; background:transparent; } .hive-atlas-empty > p:nth-child(2) { font-size:2rem; letter-spacing:-.04em; line-height:1.2; margin-bottom:15px; } .hive-atlas-empty > span { color:var(--hive-muted); font-size:.9rem; line-height:1.7; } -.hive-sector-controls { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:15px 0; color:var(--hive-muted); } -.hive-sector-controls p { margin:0; text-align:center; } -.hive-sector-controls button { font-size:.7rem; } -.hive-workspace { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(310px,1fr); gap:65px; padding-top:68px; align-items:start; } -.hive-section-note { color:var(--hive-muted); font-size:.88rem; max-width:75ch; } -.hive-search { display:grid; gap:9px; margin-top:28px; } -.hive-search label { color:var(--hive-muted); font-size:.8rem; } -.hive-search input { background:var(--bg-surface); color:var(--hive-ivory); border:1px solid var(--border-subtle); border-radius:2px; padding:12px 14px; min-width:0; width:100%; } -.hive-tree { list-style:none; padding:0; margin:25px 0 0; } -.hive-tree .hive-tree { margin:4px 0 0 13px; padding-left:15px; border-left:1px solid #534434; } -.hive-tree .hive-tree .hive-tree .hive-tree { margin-left:0; padding-left:0; border-left:0; } -.hive-node { min-width:0; scroll-margin-top:110px; } -.hive-node-record { border-top:1px solid var(--hive-rule); padding:20px 0 23px; position:relative; } -.hive-node[data-selected="true"] > .hive-node-record { border-top-color:var(--hive-copper); } -.hive-node[data-ancestor="true"] > .hive-node-record { border-top-color:#806448; } -.hive-node[data-context="true"] > .hive-node-record { opacity:.6; } -.hive-node-select { border:0 !important; padding:0 !important; text-align:left; display:block; font-size:1.15rem !important; font-weight:550 !important; line-height:1.4; overflow-wrap:anywhere; width:100%; background:transparent !important; } -.hive-node-parent { color:var(--hive-muted); font-size:.7rem; margin:0 0 7px; overflow-wrap:anywhere; } + +.universe-bar { display:flex; flex-wrap:wrap; align-items:end; gap:18px 30px; padding:16px 0 0; } +.universe-zoom { display:flex; gap:8px; } +.universe-zoom button { font-size:.72rem; } +.hive-search { display:grid; gap:6px; flex:1 1 260px; max-width:340px; } +.hive-search label { color:var(--hive-muted); font-size:.7rem; } +.hive-search input { background:transparent; color:var(--hive-ivory); border:0; border-bottom:1px solid var(--hive-rule); border-radius:0; padding:9px 0; min-width:0; width:100%; } +.hive-search input:focus-visible { border-bottom-color:var(--hive-copper); outline:none; } +#hive-search-count { margin:0; flex-basis:100%; } + +/* Selected body. A rule and space, not a box. */ +.hive-workspace { display:block; padding-top:64px; max-width:760px; } +.hive-manifest.hub-card { position:static; padding:26px 0 0; background:transparent; border:0; border-top:1px solid var(--hive-rule); border-radius:0; box-shadow:none; min-width:0; } +.hive-manifest #hive-manifest-title { overflow-wrap:anywhere; } +#hive-manifest-context, #hive-idle { color:var(--hive-muted); font-size:.85rem; overflow-wrap:anywhere; } +#hive-idle { color:var(--hive-copper); border-left:2px solid var(--hive-copper); padding-left:12px; margin-top:14px; } .hive-state { color:var(--hive-copper); margin:7px 0; text-transform:uppercase; letter-spacing:.08em; } [data-status="failed"] .hive-state { color:#f0a7a2; } -.hive-node-model { font-family:var(--font-mono,monospace); color:#d8d1c8; font-size:.76rem; line-height:1.7; overflow-wrap:anywhere; margin-bottom:14px; } -.hive-node-task,.hive-work-text { white-space:pre-wrap; overflow-wrap:anywhere; font-size:.9rem; line-height:1.75; } -/* The source rewrites these lines every second; a fixed height keeps the page - from reflowing under the pointer. The manifest shows the full text. */ -.hive-node-task { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3; overflow:hidden; } -.hive-node-action { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; font-size:.8rem; color:var(--hive-muted); white-space:pre-wrap; overflow-wrap:anywhere; } -.hive-node-times { display:flex; flex-direction:column; color:var(--hive-muted); font-size:.65rem; } -.hive-manifest.hub-card { position:sticky; top:100px; padding:28px; background:var(--bg-card); border:1px solid var(--border-subtle); border-radius:0; box-shadow:none; min-width:0; } -.hive-manifest #hive-manifest-title { overflow-wrap:anywhere; } -#hive-manifest-context { color:var(--hive-muted); font-size:.8rem; overflow-wrap:anywhere; } .hive-identity { display:grid; grid-template-columns:70px minmax(0,1fr); font-family:var(--font-mono,monospace); font-size:.75rem; gap:9px 12px; line-height:1.5; } .hive-identity dt,.hive-detail-times dt { color:var(--hive-muted); } .hive-identity dd,.hive-detail-times dd { margin:0; overflow-wrap:anywhere; } +.hive-work-text { white-space:pre-wrap; overflow-wrap:anywhere; font-size:.9rem; line-height:1.75; } .hive-detail-times { margin-top:26px; padding-top:20px; border-top:1px solid var(--hive-rule); } .hive-detail-times dd { margin-bottom:12px; } .hive-family { display:flex; flex-wrap:wrap; gap:7px; margin:20px 0; } @@ -114,10 +109,12 @@ .hive-source-note { color:var(--hive-muted); font-size:.72rem; margin:24px 0 12px; } .hive .box-link { position:relative; font-size:.72rem; } .hive .box-link::after { display:none !important; } -.hive-conversations.hub-card { margin-top:75px; padding:32px 0; border:0; border-top:1px solid var(--hive-rule); border-bottom:1px solid var(--hive-rule); background:transparent; border-radius:0; box-shadow:none; } + +.hive-conversations.hub-card { margin-top:70px; padding:32px 0; border:0; border-top:1px solid var(--hive-rule); border-bottom:1px solid var(--hive-rule); background:transparent; border-radius:0; box-shadow:none; } .hive-conversation-controls { display:flex; gap:8px; flex-shrink:0; margin-bottom:16px; } .hive-conversation-controls button { font-size:.75rem; } -.hive-chat { list-style:none; margin:28px 0 0; padding:0 18px 0 0; max-height:720px; overflow-y:auto; overscroll-behavior:contain; scrollbar-color:#69523b var(--bg-surface); overflow-anchor:none; } +.hive-section-note { color:var(--hive-muted); font-size:.88rem; max-width:75ch; } +.hive-chat { list-style:none; margin:28px 0 0; padding:0 18px 0 0; max-height:720px; overflow-y:auto; overscroll-behavior:contain; scrollbar-color:#69523b transparent; overflow-anchor:none; } .hive-message { padding:23px 0; border-top:1px solid var(--hive-rule); display:grid; grid-template-columns:210px minmax(0,1fr); gap:25px; } .hive-message-who { font-size:.9rem; overflow-wrap:anywhere; } .hive-message-who strong { display:block; font-weight:550; color:var(--hive-ivory); } @@ -130,24 +127,35 @@ .hive-closing { padding:60px 0 0; display:flex; gap:20px 35px; flex-wrap:wrap; align-items:baseline; } .hive-closing p { font-size:1.7rem; letter-spacing:-.04em; flex-basis:100%; margin:0; } .hive-closing a { font-size:.9rem; } -.hive-node-record::after,.hive-ship::after,.hive-satellite::after { content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--hive-copper); opacity:0; pointer-events:none; } -.hive-satellite { position:relative; } -.hive-changed > .hive-node-record::after,.hive-ship.hive-changed::after,.hive-satellite.hive-changed::after { animation:hive-change 1.2s ease-out; } + +.planet.hive-changed .planet-name { animation:hive-change 1.2s ease-out; } .hive[data-motion="off"] *, .hive[data-hidden="true"] *, .hive[data-offscreen="true"] .hive-atlas * { animation-play-state:paused !important; } .hive[data-fresh="false"] .hive-engine,.hive [data-observation-old="true"] .hive-engine { animation:none !important; opacity:.45; } -@keyframes hive-drift { from { transform:translate3d(-2px,-1.5px,0); } to { transform:translate3d(2px,1.5px,0); } } + +@keyframes hive-drift { from { transform:translate3d(-4px,-3px,0); } to { transform:translate3d(4px,3px,0); } } @keyframes hive-breathe { 0%,100% { opacity:.4; } 50% { opacity:1; } } -@keyframes hive-change { 0% { opacity:.9; } 100% { opacity:0; } } -@keyframes hive-nebula { from { transform:translate3d(-6px,-4px,0) scale(1); } to { transform:translate3d(6px,4px,0) scale(1.03); } } -@keyframes hive-corona { from { opacity:.35; transform:scale(.94); } to { opacity:.85; transform:scale(1.06); } } +@keyframes hive-change { 0% { opacity:1; color:var(--hive-copper); } 100% { opacity:.85; } } +@keyframes hive-nebula { from { transform:translate3d(-12px,-8px,0) rotate(-4deg); opacity:.55; } to { transform:translate3d(12px,8px,0) rotate(4deg); opacity:1; } } +@keyframes hive-corona { from { filter:brightness(.85); } to { filter:brightness(1.18); } } @keyframes hive-orbital-dust { to { transform:rotate(360deg); } } -@media (min-width:1100px) { .hive-missions[data-large="true"] > .hive-tree { max-height:1250px; overflow:auto; padding-right:18px; scrollbar-color:#69523b var(--bg-surface); } } -@media (max-width:1099px) { .hive-masthead { gap:40px; grid-template-columns:minmax(0,1fr) 250px; } .hive-workspace { gap:30px; grid-template-columns:minmax(0,1fr) minmax(280px,.85fr); } .hive-manifest.hub-card { padding:22px; } .hive-ships { gap:60px 16px; padding-left:18px; padding-right:18px; } .hive-ship-name { font-size:.9rem; } } + +@media (max-width:1099px) { .hive-masthead { gap:40px; grid-template-columns:minmax(0,1fr) 250px; } .hive-workspace { gap:30px; grid-template-columns:minmax(0,1fr) minmax(280px,.85fr); } .universe { height:560px; } } @media (max-width:699px) { - .hive { padding:25px 22px 48px; } .hive-breadcrumb { margin-bottom:38px; } .hive-masthead { grid-template-columns:1fr; gap:30px; } .hive h1 { font-size:clamp(4.9rem,20vw,8rem); } .hive-intro { font-size:1.2rem; } .hive-reception { padding-left:18px; } .hive-reception-times { display:grid; grid-template-columns:1fr 1.4fr; gap:5px 12px; font-size:.65rem; } .hive-reception-times dd { margin:0; } .hive-jumps { margin:35px 0; gap:12px 22px; } - .hive-section-head { display:block; } .hive-atlas { min-height:380px; } .hive-orbits { opacity:.15; } .hive-ships { display:block; min-height:380px; padding:65px 20px 80px 36px; } .hive-ships::before { content:""; position:absolute; left:23px; top:75px; bottom:80px; border-left:1px solid #8b6b48; } .hive-station { margin:0 0 28px; transform:none !important; } .hive-station::before { content:""; position:absolute; left:-12px; top:27px; width:12px; border-top:1px solid #8b6b48; } .hive-ship-name { font-size:1.05rem; } .hive-satellites { max-height:none; } .hive-atlas-empty { left:8%; right:8%; top:25%; padding:20px; } .hive-atlas-coordinate { font-size:.55rem; } .hive-atlas-legend { font-size:.58rem; gap:3px 12px; } .hive-sector-controls { flex-wrap:wrap; } .hive-sector-controls p { order:-1; width:100%; text-align:left; } - .hive-workspace { display:flex; flex-direction:column; padding-top:42px; gap:35px; } .hive-missions,.hive-manifest { width:100%; } .hive-manifest.hub-card { position:static; } .hive-tree .hive-tree { padding-left:11px; margin-left:6px; } .hive-conversations.hub-card { margin-top:45px; } .hive-conversation-controls { margin-top:22px; } .hive-message { display:block; } .hive-message-who { margin-bottom:16px; } .hive-message-model { margin:3px 0; } .hive-chat { padding-right:8px; max-height:650px; } .hive-closing { padding-top:40px; } - .hive-core { left:80%; top:18%; opacity:.42; transform:scale(.85); } - .hive-missions[data-large="true"] > .hive-tree { max-height:85vh; overflow:auto; padding-right:12px; scrollbar-color:#69523b var(--bg-surface); } + .hive { padding:25px 22px 48px; } + .hive-breadcrumb { margin-bottom:38px; } + .hive-masthead { grid-template-columns:1fr; gap:30px; } + .hive h1 { font-size:clamp(3.6rem,17vw,6rem); } + .hive-reception { padding-left:18px; } + .hive-jumps { margin:35px 0; gap:12px 22px; } + .hive-section-head { display:block; } + .universe { height:440px; } + .planet-name { font-size:1.15rem; } + .hive-workspace { display:flex; flex-direction:column; padding-top:42px; gap:35px; } + .hive-manifest.hub-card { position:static; } + .hive-conversations.hub-card { margin-top:45px; } + .hive-message { display:block; } + .hive-message-who { margin-bottom:16px; } + .hive-chat { padding-right:8px; max-height:650px; } + .hive-closing { padding-top:40px; } } @media (prefers-reduced-motion:reduce) { .hive *, .hive *::before, .hive *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; } } diff --git a/public/assets/keeper.svg b/public/assets/keeper.svg index 708ddc5b..225f34fc 100644 --- a/public/assets/keeper.svg +++ b/public/assets/keeper.svg @@ -1,82 +1,66 @@ - Keeper, the dachshund at the merge desk - A warm chestnut dachshund with floppy ears, little paws and a gold key on a red collar. Keeper breathes gently, blinks, and wags his tail. + Keeper, the merge desk + Three queued streams of light curve in from the left, pass through a copper aperture, and leave as one settled line with three merged nodes. Nothing is boxed; the whole figure is drawn from flowing arcs. - - + + + + - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/assets/now.css b/public/assets/now.css index 1d73a0e6..c2cb7061 100644 --- a/public/assets/now.css +++ b/public/assets/now.css @@ -605,7 +605,7 @@ .now-model-figs dd { margin: 0; color: var(--tl-ink); font-size: 14px; line-height: 1.5; } #models .now-grid { margin-top: 26px; } -/* Keeper, the merge desk: one big dachshund standing on the page (public/assets/keeper.svg). */ +/* Keeper, the merge desk: queued streams through one aperture (public/assets/keeper.svg). */ .now-owner-dog { width: 42px; height: 14px; diff --git a/public/js/hive.js b/public/js/hive.js index 12a925ea..65efaa45 100644 --- a/public/js/hive.js +++ b/public/js/hive.js @@ -13,7 +13,6 @@ let received = null; let selected = null; let scope = 'all'; - let sector = 0; let order = 0; let connected = false; let advancedAt = 0; @@ -59,6 +58,13 @@ return typeof value === 'string' && (empty || value.length > 0) && value.length <= max && !/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/.test(value); } function id(value) { return typeof value === 'string' && /^[a-zA-Z0-9_-]{1,160}$/.test(value); } + const AGENT_FIELDS = ['id', 'parent_id', 'name', 'runtime', 'provider', 'model', 'role', 'task', 'status', 'activity', 'activity_state', 'started_at', 'updated_at', 'observed_at']; + // idle_reason is optional so the collector and this page may be deployed in either order. + function agentFields(agent) { + if (!agent || typeof agent !== 'object' || Array.isArray(agent)) return false; + const keys = Object.keys(agent); + return AGENT_FIELDS.every(key => keys.includes(key)) && keys.every(key => key === 'idle_reason' || AGENT_FIELDS.includes(key)); + } function validate(value) { const fail = () => { throw new Error('Invalid public snapshot'); }; if (!object(value, ['schema_version', 'generated_at', 'sequence', 'poll_ms', 'stale_after_ms', 'coverage', 'agents', 'interactions']) @@ -72,11 +78,12 @@ const agents = new Map(); let roots = 0; for (const agent of value.agents) { - if (!object(agent, ['id', 'parent_id', 'name', 'runtime', 'provider', 'model', 'role', 'task', 'status', 'activity', 'activity_state', 'started_at', 'updated_at', 'observed_at']) + if (!agentFields(agent) || !id(agent.id) || agents.has(agent.id) || !(agent.parent_id === null || id(agent.parent_id)) || agent.parent_id === agent.id || !['name', 'runtime', 'provider', 'model', 'role'].every(key => string(agent[key], 1000)) || !string(agent.task, 12000, true) || !string(agent.activity, 12000, true) || !statuses.has(agent.status) || !actions.has(agent.activity_state) + || !(agent.idle_reason === undefined || agent.idle_reason === null || ['usage-limit', 'awaiting-input', 'ended', 'error', 'unknown'].includes(agent.idle_reason)) || !(agent.started_at === null || timestamp(agent.started_at)) || !(agent.updated_at === null || timestamp(agent.updated_at)) || !timestamp(agent.observed_at)) fail(); agents.set(agent.id, agent); @@ -135,52 +142,33 @@ else parent.insertBefore(node, cursor); } } - let pulseWindow = 0; - let pulseBudget = 0; function pulse(node) { if (page.dataset.motion !== 'on' || page.dataset.fresh !== 'true' || document.hidden) return; - // A busy fleet changes every second; a strobe of accents is not information. - const now = performance.now(); - if (now - pulseWindow > 1000) { pulseWindow = now; pulseBudget = 3; } - if (pulseBudget <= 0) return; - pulseBudget--; node.classList.add('hive-changed'); setTimeout(() => node.classList.remove('hive-changed'), 1300); } + const WORLD = { width: 2600, height: 1800 }; + const camera = { x: 0, y: 0, scale: 0.62 }; + const IDLE_TEXT = { + 'usage-limit': 'idle because of a usage limit. The provider accepted no more work until it resets.', + 'awaiting-input': 'idle because it is waiting for Drake to answer.', + 'ended': 'idle because its session ended.', + 'error': 'idle after a reported error, with no work since.', + 'unknown': 'idle. The source reports no work and its transcript names no cause.' + }; + function hashOf(value) { let h = 2166136261; for (const ch of value) { h ^= ch.codePointAt(0); h = Math.imul(h, 16777619); } return h >>> 0; } function createRecord(agent) { - const li = make('li', 'hive-node'); - li.id = `hive-agent-${agent.id}`; - const record = make('div', 'hive-node-record'); - const parent = make('p', 'hive-node-parent'); - const select = button('', () => choose(agent.id), 'hive-node-select'); - const status = make('p', 'hive-state'); - const model = make('p', 'hive-node-model'); - const task = make('p', 'hive-node-task'); - const action = make('p', 'hive-node-action'); - const times = make('div', 'hive-node-times'); - const updated = make('time'); - const observed = make('time'); - const updatedLine = make('span', '', 'Work updated: '); - const observedLine = make('span', '', 'Source observed: '); - updatedLine.append(updated); - observedLine.append(observed); - times.append(updatedLine, observedLine); - record.append(parent, select, status, model, task, action, times); - const children = make('ul', 'hive-tree'); - li.append(record, children); - const station = make('div', 'hive-station'); - const ship = button('', () => choose(agent.id), 'hive-ship'); - const shipLabel = make('span', 'hive-ship-label'); - const shipName = make('span', 'hive-ship-name'); - const shipState = make('span', 'hive-ship-state'); - const shipModel = make('span', 'hive-ship-model'); - shipLabel.append(shipName, shipState, shipModel); - ship.append(glyph(), shipLabel); - const satellites = make('div', 'hive-satellites'); - station.append(ship, satellites); - const satellite = button('', () => choose(agent.id), 'hive-satellite'); - satellite.append(glyph(true)); - return { data:agent, li, parent, select, status, model, task, action, updated, observed, children, station, ship, shipName, shipState, shipModel, satellites, satellite, order:order++, absentAt:null }; + const node = make('article', 'planet'); + node.id = `hive-agent-${agent.id}`; + const select = button('', () => choose(agent.id), 'planet-body'); + const label = make('span', 'planet-label'); + const name = make('span', 'planet-name'); + const state = make('span', 'planet-state'); + const model = make('span', 'planet-model'); + label.append(name, state, model); + select.append(glyph(agent.parent_id !== null), label); + node.append(select); + return { data:agent, node, select, name, state, model, angle:0, radius:0, speed:0, order:order++, absentAt:null }; } function actionLabel(record) { return record.absentAt === null && record.data.activity_state === 'running' ? 'Reported current activity' : 'Last observed action'; @@ -190,40 +178,84 @@ const age = snapshot ? Date.parse(snapshot.generated_at) - Date.parse(record.data.observed_at) : 0; return record.data.status + (age > snapshot?.stale_after_ms ? ` · source observation ${Math.floor(age / 1000)}s behind snapshot` : ''); } + function idleText(record) { + const reason = record?.data.idle_reason; + if (!reason) return ''; + return `${record.data.name} is ${IDLE_TEXT[reason] || IDLE_TEXT.unknown}`; + } function updateRecord(record) { const agent = record.data; - text(record.select, agent.name); - text(record.parent, agent.parent_id ? `Parent: ${records.get(agent.parent_id)?.data.name || 'not in this observation'}` : 'Root mission'); - text(record.status, recordState(record)); - text(record.model, `${agent.model} · ${agent.provider} · ${agent.runtime} · ${agent.role}`); - text(record.task, agent.task || 'Current task not reported.'); - text(record.action, `${actionLabel(record)}: ${agent.activity || 'Not reported.'}`); - setTime(record.updated, agent.updated_at); - setTime(record.observed, agent.observed_at); - for (const node of [record.ship, record.satellite]) node.dataset.observationOld = String(snapshot && Date.parse(snapshot.generated_at) - Date.parse(agent.observed_at) > snapshot.stale_after_ms); - for (const node of [record.li, record.ship, record.satellite]) node.dataset.status = record.absentAt === null ? agent.status : 'unknown'; - text(record.shipName, agent.name); - text(record.shipModel, `${agent.model} · ${agent.provider}`); - record.ship.setAttribute('aria-label', `Select ${agent.name}, ${recordState(record)}, ${agent.model}`); - record.satellite.setAttribute('aria-label', `Select ${agent.name}, ${recordState(record)}, ${agent.model}`); - record.satellite.title = `${agent.name} · ${agent.model} · ${recordState(record)}`; + text(record.name, agent.name); + text(record.state, recordState(record) + (agent.idle_reason ? ` · ${agent.idle_reason}` : '')); + text(record.model, `${agent.model} · ${agent.provider}`); + record.node.dataset.status = record.absentAt === null ? agent.status : 'unknown'; + record.node.dataset.depth = agent.parent_id ? '1' : '0'; + record.node.dataset.idle = agent.idle_reason || ''; + record.select.setAttribute('aria-label', `Select ${agent.name}, ${recordState(record)}${agent.idle_reason ? `, ${agent.idle_reason}` : ''}, ${agent.model}`); } function treeOrder() { return [...records.values()].sort((a, b) => a.order - b.order); } - function rootFor(record) { - let root = record; - const visited = new Set(); - while (hierarchyParents.get(root.data.id) && !visited.has(root.data.id)) { - visited.add(root.data.id); - root = records.get(hierarchyParents.get(root.data.id)); + function layoutUniverse() { + const roots = treeOrder().filter(record => !hierarchyParents.get(record.data.id)); + roots.forEach((record, index) => { + const h = hashOf(record.data.id); + record.radius = 300 + (index % 4) * 165; + record.angle = (index / Math.max(1, roots.length)) * Math.PI * 2 + ((h % 100) / 100) * 0.5; + record.base = record.angle; + record.phase = (h % 628) / 100; + }); + const clusters = new Map(); + for (const record of treeOrder()) { + const parent = hierarchyParents.get(record.data.id); + if (!parent) continue; + const siblings = clusters.get(parent) || []; + siblings.push(record); + clusters.set(parent, siblings); + } + for (const [, siblings] of clusters) { + siblings.forEach((record, index) => { + const h = hashOf(record.data.id); + record.radius = 86 + index * 42 + (h % 3) * 10; + record.angle = (index / Math.max(1, siblings.length)) * Math.PI * 2 + ((h % 100) / 100) * 0.4; + record.base = record.angle; + record.phase = (h % 628) / 100; + }); + } + } + function worldPositions() { + const out = new Map(); + const walk = (record) => { + const origin = out.get(hierarchyParents.get(record.data.id)) || { x: WORLD.width / 2, y: WORLD.height / 2 }; + out.set(record.data.id, { x: origin.x + Math.cos(record.angle) * record.radius, y: origin.y + Math.sin(record.angle) * record.radius * 0.82 }); + for (const child of records.values()) if (hierarchyParents.get(child.data.id) === record.data.id) walk(child); + }; + for (const record of treeOrder()) if (!hierarchyParents.get(record.data.id)) walk(record); + return out; + } + // Labels are the hard part of a map: nudge orbits until no two captions sit on + // top of each other. Deterministic, so a body keeps its place between polls. + function settleLabels() { + const ordered = treeOrder(); + for (let pass = 0; pass < 90; pass++) { + const at = worldPositions(); + let moved = false; + for (let i = 0; i < ordered.length; i++) { + const a = at.get(ordered[i].data.id); + for (let j = i + 1; j < ordered.length; j++) { + const b = at.get(ordered[j].data.id); + if (Math.abs(a.y - b.y) > 26 || Math.abs(a.x - b.x) > 175) continue; + ordered[j].base += 0.03; + ordered[j].angle = ordered[j].base; + moved = true; + } + } + if (!moved) break; } - return root; } - function reconcileTree() { + function reconcileUniverse() { const ordered = treeOrder(); const focused = document.activeElement; hierarchyParents.clear(); for (const record of ordered) hierarchyParents.set(record.data.id, records.has(record.data.parent_id) ? record.data.parent_id : null); - // Old missing observations cannot override the current source's acyclic tree. for (const record of ordered) { if (record.absentAt === null) continue; const visited = new Set([record.data.id]); @@ -234,73 +266,76 @@ parent = hierarchyParents.get(parent); } } - const groups = new Map([[null, []]]); - for (const record of ordered) groups.set(record.data.id, []); - for (const record of ordered) { - const parent = hierarchyParents.get(record.data.id); - groups.get(parent).push(record.li); - } - // Detach changed branches first so a legitimate reparent cannot temporarily - // insert an ancestor into its old descendant. - for (const record of ordered) { - const parent = hierarchyParents.get(record.data.id); - const destination = parent ? records.get(parent).children : get('tree'); - if (record.li.parentElement && record.li.parentElement !== destination) record.li.remove(); - } - place(get('tree'), groups.get(null)); - for (const record of ordered) { - place(record.children, groups.get(record.data.id)); - record.children.hidden = !groups.get(record.data.id).length; - } - get('missions').dataset.large = String(records.size > 50); + const world = get('world'); + for (const record of ordered) if (record.node.parentElement !== world) world.append(record.node); + for (const record of [...records.values()]) if (!records.has(record.data.id)) record.node.remove(); + layoutUniverse(); + settleLabels(); + get('atlas-empty').hidden = records.size > 0; applySearch(); - renderAtlas(); if (focused !== document.activeElement && focused?.isConnected) focused.focus({ preventScroll:true }); } - function renderAtlas() { - const ordered = treeOrder(); - const roots = ordered.filter(record => !hierarchyParents.get(record.data.id)); - const sectors = Math.max(1, Math.ceil(roots.length / 6)); - sector = Math.max(0, Math.min(sector, sectors - 1)); - const visible = new Set(roots.slice(sector * 6, sector * 6 + 6).map(record => record.data.id)); + let lastFrame = 0; + let spinAngle = 0; + function frame(now) { + const dt = lastFrame ? Math.min(0.05, (now - lastFrame) / 1000) : 0; + lastFrame = now; + const moving = page.dataset.motion === 'on' && !document.hidden; + if (moving) spinAngle += dt * 0.02; + const roots = []; + for (const record of records.values()) if (!hierarchyParents.get(record.data.id)) roots.push(record); for (const root of roots) { - const descendants = ordered.filter(record => record !== root && rootFor(record) === root); - text(root.shipState, `${recordState(root)} · ${descendants.length} nested`); - place(root.satellites, descendants.map(record => record.satellite)); - root.satellites.hidden = descendants.length === 0; - root.station.hidden = !visible.has(root.data.id); + const origins = new Map(); + const place = (record, origin, depth) => { + const angle = (record.base ?? record.angle) + spinAngle * (depth ? 1.6 : 1); + const bob = Math.sin(now / 5200 + (record.phase ?? 0)) * 5; + const x = origin.x + Math.cos(angle) * record.radius; + const y = origin.y + Math.sin(angle) * record.radius * 0.82 + bob; + record.node.style.transform = `translate3d(${x.toFixed(1)}px,${y.toFixed(1)}px,0)`; + for (const child of records.values()) if (hierarchyParents.get(child.data.id) === record.data.id) place(child, { x, y }, depth + 1); + }; + place(root, { x: WORLD.width / 2, y: WORLD.height / 2 }, 0); } - for (const record of ordered) { - if (hierarchyParents.get(record.data.id)) record.station.remove(); - else record.satellite.remove(); - } - place(get('ships'), roots.map(root => root.station)); - get('atlas-empty').hidden = records.size > 0; - get('sector-prev').disabled = sector === 0; - get('sector-next').disabled = sector === sectors - 1; - text(get('sector-label'), roots.length ? `Sector ${sector + 1} of ${sectors} · ${visible.size} of ${roots.length} root missions · complete tree below` : 'The atlas will populate from real source observations.'); + requestAnimationFrame(frame); + } + function applyCamera() { + const viewport = get('universe'); + if (!viewport) return; + const width = viewport.clientWidth || 1; + const height = viewport.clientHeight || 1; + const spanX = WORLD.width * camera.scale; + const spanY = WORLD.height * camera.scale; + camera.x = spanX <= width ? (width - spanX) / 2 : Math.min(0, Math.max(width - spanX, camera.x)); + camera.y = spanY <= height ? (height - spanY) / 2 : Math.min(0, Math.max(height - spanY, camera.y)); + const world = get('world'); + world.style.transform = `translate3d(${camera.x.toFixed(1)}px,${camera.y.toFixed(1)}px,0) scale(${camera.scale})`; + // Progressive detail: a wider view shows names, a closer view shows identity. + world.dataset.detail = camera.scale < 0.42 ? 'body' : camera.scale < 0.95 ? 'name' : 'full'; + } + function resetCamera() { + camera.scale = 0.62; + applyCamera(); + } + function zoomAt(factor, clientX, clientY) { + const viewport = get('universe'); + const rect = viewport.getBoundingClientRect(); + const px = (clientX ?? rect.left + rect.width / 2) - rect.left; + const py = (clientY ?? rect.top + rect.height / 2) - rect.top; + const wx = (px - camera.x) / camera.scale; + const wy = (py - camera.y) / camera.scale; + camera.scale = Math.min(2.6, Math.max(0.2, camera.scale * factor)); + camera.x = px - wx * camera.scale; + camera.y = py - wy * camera.scale; + applyCamera(); } function applySearch() { const matches = new Set(); - const visible = new Set(); for (const record of records.values()) { const agent = record.data; - if (!query || [agent.name, agent.task, agent.activity, agent.model, agent.provider, agent.runtime, agent.role, agent.status].join(' ').toLowerCase().includes(query)) { - matches.add(agent.id); - let current = record; - while (current && !visible.has(current.data.id)) { - visible.add(current.data.id); - current = records.get(current.data.parent_id); - } - } - } - for (const record of records.values()) { - record.li.hidden = !visible.has(record.data.id); - record.li.dataset.context = String(!matches.has(record.data.id)); + if (!query || [agent.name, agent.task, agent.activity, agent.model, agent.provider, agent.runtime, agent.role, agent.status, agent.idle_reason || ''].join(' ').toLowerCase().includes(query)) matches.add(agent.id); } - text(get('search-count'), query ? `${matches.size} matching / ${records.size} displayed agents. Parent branches remain visible for context.` : `${records.size} displayed agents, including any briefly retained missing observations.`); - get('tree-empty').hidden = matches.size > 0; - if (snapshot) text(get('tree-empty'), records.size ? 'No missions match this search. Clear it to see the complete observed tree.' : 'No agents reported in this snapshot. An empty fleet is not a connection failure.'); + for (const record of records.values()) record.node.dataset.context = String(!matches.has(record.data.id)); + text(get('search-count'), query ? `${matches.size} matching / ${records.size} observed agents.` : `${records.size} observed agents. Drag to move, scroll to zoom.`); renderManifest(); } function fields(container, entries, times = false) { @@ -332,9 +367,11 @@ } for (const record of records.values()) { const active = record.data.id === selected; - record.li.dataset.selected = String(active); - record.li.dataset.ancestor = String(!active && ancestors.has(record.data.id)); - for (const control of [record.select, record.ship, record.satellite]) control.setAttribute('aria-pressed', String(active)); + record.node.dataset.selected = String(active); + record.node.dataset.ancestor = String(!active && ancestors.has(record.data.id)); + record.select.setAttribute('aria-pressed', String(active)); + // An idle body is taken down from the universe, and its reason is named. + record.node.dataset.down = String(active && Boolean(record.data.idle_reason)); } renderManifest(); renderMessages(); @@ -347,7 +384,10 @@ text(get('manifest-title'), agent.name); const parent = records.get(agent.parent_id); const context = agent.parent_id ? `Nested under ${parent?.data.name || 'an unobserved parent'}.` : 'Root mission.'; - text(get('manifest-context'), context + (record.li.hidden ? ' Outside the current search filter.' : '') + (record.absentAt !== null ? ' Retained from an earlier observation; disappearance does not mean completion.' : '')); + text(get('manifest-context'), context + (record.node.hidden ? ' Outside the current search filter.' : '') + (record.absentAt !== null ? ' Retained from an earlier observation; disappearance does not mean completion.' : '')); + const idle = idleText(record); + get('idle').hidden = !idle; + text(get('idle'), idle ? `${idle} Its body is taken down from the universe while it stays idle.` : ''); text(get('manifest-state'), recordState(record)); fields(get('manifest-identity'), [['Model', agent.model], ['Provider', agent.provider], ['Runtime', agent.runtime], ['Role', agent.role]]); text(get('manifest-task'), agent.task || 'Not reported.'); @@ -455,11 +495,9 @@ if (!record) { record = createRecord(agent); records.set(agent.id, record); - if (previouslyObserved) { pulse(record.li); pulse(record.ship); pulse(record.satellite); } + if (previouslyObserved) pulse(record.node); } else if (record.data.task !== agent.task || record.data.activity !== agent.activity || record.data.status !== agent.status || record.data.activity_state !== agent.activity_state) { - pulse(record.li); - pulse(record.ship); - pulse(record.satellite); + pulse(record.node); } record.data = agent; record.absentAt = null; @@ -470,8 +508,8 @@ const hasPresentChildren = value.agents.some(agent => agent.parent_id === agentId); if (now - record.absentAt > 30000 && selected !== agentId && !hasPresentChildren && !messageAgents.has(agentId)) { // Reattach any retained descendants before removing their old ancestor. - for (const child of records.values()) if (child.data.parent_id === agentId) get('tree').append(child.li); - record.li.remove(); record.station.remove(); record.satellite.remove(); records.delete(agentId); + for (const child of records.values()) if (child.data.parent_id === agentId) get('world').append(child.node); + record.node.remove(); records.delete(agentId); } } } @@ -481,7 +519,7 @@ text(get('counts'), `${value.coverage.agents} agents observed across ${value.coverage.roots} root missions.`); get('coverage').dataset.complete = String(value.coverage.complete); text(get('coverage'), `${value.coverage.complete ? 'Reported coverage' : 'Partial coverage'}: ${value.coverage.label}. ${value.coverage.notice}`); - reconcileTree(); + reconcileUniverse(); if (!selected) { let fragment = ''; try { fragment = location.hash.startsWith('#agent=') ? decodeURIComponent(location.hash.slice(7)) : ''; } catch (_) { /* Invalid fragments do not select a node. */ } @@ -535,14 +573,53 @@ reducedMotion.addEventListener('change', motion); document.addEventListener('visibilitychange', () => { motion(); freshness(); }); get('search').addEventListener('input', event => { query = event.target.value.trim().toLowerCase(); applySearch(); }); - get('sector-prev').addEventListener('click', () => { sector--; renderAtlas(); }); - get('sector-next').addEventListener('click', () => { sector++; renderAtlas(); }); + const universe = get('universe'); + universe.addEventListener('wheel', event => { + event.preventDefault(); + zoomAt(Math.exp(-event.deltaY * 0.0015), event.clientX, event.clientY); + }, { passive:false }); + let dragging = null; + let dragMoved = 0; + universe.addEventListener('pointerdown', event => { + if (event.button !== 0) return; + dragging = { x: event.clientX, y: event.clientY }; + dragMoved = 0; + universe.setPointerCapture(event.pointerId); + }); + universe.addEventListener('pointermove', event => { + if (!dragging) return; + const dx = event.clientX - dragging.x; + const dy = event.clientY - dragging.y; + dragMoved += Math.abs(dx) + Math.abs(dy); + dragging = { x: event.clientX, y: event.clientY }; + camera.x += dx; + camera.y += dy; + applyCamera(); + }); + universe.addEventListener('pointerup', event => { + if (dragging && dragMoved > 6) { event.preventDefault(); } + dragging = null; + universe.releasePointerCapture(event.pointerId); + }); + universe.addEventListener('dblclick', event => zoomAt(1.45, event.clientX, event.clientY)); + universe.addEventListener('keydown', event => { + const pan = 90; + const keys = { ArrowLeft: [-pan, 0], ArrowRight: [pan, 0], ArrowUp: [0, -pan], ArrowDown: [0, pan] }; + if (keys[event.key]) { camera.x += keys[event.key][0]; camera.y += keys[event.key][1]; applyCamera(); event.preventDefault(); return; } + if (event.key === '+' || event.key === '=') { zoomAt(1.25); event.preventDefault(); } + if (event.key === '-' || event.key === '_') { zoomAt(1 / 1.25); event.preventDefault(); } + if (event.key === '0') { resetCamera(); event.preventDefault(); } + }); + get('zoom-in').addEventListener('click', () => zoomAt(1.3)); + get('zoom-out').addEventListener('click', () => zoomAt(1 / 1.3)); + get('zoom-reset').addEventListener('click', resetCamera); + window.addEventListener('resize', applyCamera); get('show-selected').addEventListener('click', () => { const record = records.get(selected); if (!record) return; - if (record.li.hidden) { query = ''; get('search').value = ''; applySearch(); } + if (record.node.hidden) { query = ''; get('search').value = ''; applySearch(); } + record.node.dataset.down = 'false'; record.select.focus({ preventScroll:true }); - record.li.scrollIntoView({ block:'center', behavior:'auto' }); }); for (const name of ['all', 'selected']) get(`chat-${name}`).addEventListener('click', () => { scope = name; @@ -567,6 +644,8 @@ if ('IntersectionObserver' in window) new IntersectionObserver(entries => { page.dataset.offscreen = String(!entries[0].isIntersecting); }).observe(get('atlas')); + resetCamera(); + requestAnimationFrame(frame); motion(); setInterval(freshness, 1000); poll();