Make Gjallar the Nightwing compositor

This commit is contained in:
Meta Vens 2026-06-05 16:24:36 +01:00
commit d4e9af5678
14 changed files with 1898 additions and 762 deletions

12
Cargo.lock generated
View file

@ -356,18 +356,6 @@ dependencies = [
"polyval",
]
[[package]]
name = "gjallar-daemon"
version = "0.1.0"
dependencies = [
"anyhow",
"cultcache-rs",
"cultmesh-rs",
"odin-core",
"rmp-serde",
"serde_json",
]
[[package]]
name = "hashbrown"
version = "0.15.5"

View file

@ -1,6 +1,5 @@
[workspace]
members = [
"crates/gjallar-daemon",
"crates/idunn-daemon",
"crates/odin-core",
]

View file

@ -2,7 +2,7 @@
Odin is the GameCult all-seer: the central CultMesh node every Verse can use to discover the other Verses, inspect schema catalogs, and find translation paths between local realities.
It is not the renderer. It is not Eve. It is not a Starfire utility script wearing a bigger coat. Odin owns discovery, schema awareness, translation planning, and accepted operator surfaces. Eve and the Nightwing compact TUI lower Odin's published CultUI surface into whatever body they have.
It is not the renderer. It is not Eve. It is not a Starfire utility script wearing a bigger coat. Odin owns discovery, schema awareness, translation planning, and accepted operator surfaces. Eve clients and Gjallar lower Odin's published CultUI surface into whatever body they have.
Odin is also the compliance witness for the GameCult service architecture:
durable service state in CultCache `.cc`, local Verse visibility through
@ -18,22 +18,23 @@ CultNet document registries, and lower interface state through Eve/CultUI.
The first Rust core lives in `crates/odin-core` and already separates typed
documents, ingest ports, normalization, and repository persistence so unit tests
can use mocked inputs and pipeline smokes can prove typed handoff without
booting the whole daemon. Gjallar is part of that spine as the typed overview
composition lane: it reads Odin-owned sight and publishes the compact feed that
Nightwing lowers into terminal cells.
booting the whole daemon. Gjallar is not part of that Rust record spine: it is
the Nightwing-resident terminal compositor that consumes Odin's published
Eve/CultUI deck and renders the live display.
## Gjallar
Gjallar is Odin's herald display daemon: the package that turns Odin's gathered
sight into the overview Nightwing displays. Odin sees the Verses; Gjallar
decides how that sight is grouped, prioritized, and packed into a feed.
Nightwing stays a thin fast terminal lowerer.
Gjallar is the herald display daemon that runs on Nightwing. Odin sees the
Verses, accepts provider surfaces, and publishes the `odin.allseer` deck.
Gjallar talks to Odin, enumerates active providers, composes the multi-scale
tiled dashboard, owns the marquee and dense character-level update behavior,
and writes the visible framebuffer.
Local package surfaces:
- Organ contract: `docs/gjallar.md`
- Branding Persona state: `personas/gjallar.persona_state.cc`
- Rust CultMesh organ: `crates/gjallar-daemon`
- Runtime source: `src/Gjallar`
- Avatar asset: `assets/personas/gjallar-avatar.png`
- Pixel avatar: `assets/personas/gjallar-avatar-pixel-256.png`
@ -62,7 +63,7 @@ Local package surfaces:
- Owner: Odin owns the network-wide Verse registry, schema catalog index, translation map, and the accepted `odin.allseer` Eve surface.
- Inputs: CultMesh/CultNet peer announcements, schema catalog responses, local host probes, Docker/ADB host facts, SSH-reachable ops hosts, Mimir's normalized Eve observation ledger, and later direct Verse subscriptions.
- Outputs: CultCache-backed Odin state, CultMesh documents, CultNet schema/catalog messages, and an Eve-compatible `/eve/deck` surface for dashboards.
- Derived state: Nightwing's attached TUI, browser dashboards, and future Eve clients are projections of Odin state.
- Derived state: Gjallar's attached Nightwing display, browser dashboards, and future Eve clients are projections of Odin state and provider-owned Eve/CultUI surfaces.
- Forbidden writers: renderers do not probe the network or decide Verse truth; individual projects do not maintain private incompatible discovery ledgers once Odin can see them.
- Shared paths: human dashboards, worker schedulers, Verse bootstrap code, and compact TUI views consume the same registry and schema catalog.
- Deletion line: old per-host coordinator scripts should be deleted or reduced to deployment wrappers that start Odin.

View file

@ -1,18 +0,0 @@
[package]
name = "gjallar-daemon"
version = "0.1.0"
edition.workspace = true
license.workspace = true
publish.workspace = true
[[bin]]
name = "gjallar"
path = "src/main.rs"
[dependencies]
anyhow = "1"
cultcache-rs = { path = "E:/Projects/EpiphanyAgent/vendor/cultcache-rs" }
cultmesh-rs = { path = "E:/Projects/EpiphanyAgent/vendor/cultmesh-rs" }
odin-core = { path = "../odin-core" }
rmp-serde = "1"
serde_json = "1"

View file

@ -1,310 +0,0 @@
use anyhow::{Context, Result, anyhow};
use cultmesh_rs::{CultMesh, CultMeshNode, CultMeshNodeOptions};
use odin_core::{
EveSurfaceStateRecord, GjallarComposition, GjallarCompositionInput, GjallarOverviewRecord,
GjallarOverviewTileRecord, OdinDocuments, OdinInterfaceRecord, OdinObservationStreamRecord,
OdinServiceRecord, OdinSnapshotRecord, OdinTranslationRouteRecord, OdinVerseRecord,
compose_gjallar_overview,
};
use std::env;
use std::path::PathBuf;
use std::thread;
use std::time::Duration;
use std::time::{SystemTime, UNIX_EPOCH};
#[derive(Clone, Debug)]
struct Options {
odin_store_path: PathBuf,
gjallar_store_path: PathBuf,
overview_id: String,
surface_key: String,
target_columns: u32,
verse_keys: Vec<String>,
service_keys: Vec<String>,
interface_keys: Vec<String>,
observation_stream_keys: Vec<String>,
translation_route_keys: Vec<String>,
interval_seconds: Option<u64>,
}
fn main() -> Result<()> {
let options = Options::parse(env::args().skip(1))?;
if let Some(parent) = options.gjallar_store_path.parent() {
std::fs::create_dir_all(parent)
.with_context(|| format!("creating {}", parent.display()))?;
}
if let Some(interval_seconds) = options.interval_seconds {
loop {
run_cycle(&options)?;
thread::sleep(Duration::from_secs(interval_seconds));
}
}
run_cycle(&options)
}
fn run_cycle(options: &Options) -> Result<()> {
if !options.odin_store_path.exists() {
return Err(anyhow!(
"Odin CultMesh store not found: {}",
options.odin_store_path.display()
));
}
let odin = CultMesh::create_node(
&options.odin_store_path,
OdinDocuments,
CultMeshNodeOptions {
runtime_id: "gjallar-odin-reader".to_string(),
pull_on_start: true,
},
)?;
let mut gjallar = CultMesh::create_node(
&options.gjallar_store_path,
OdinDocuments,
CultMeshNodeOptions {
runtime_id: "gjallar-daemon".to_string(),
pull_on_start: true,
},
)?;
let composition = match odin.get::<OdinSnapshotRecord>("latest")? {
Some(snapshot) => compose_gjallar_overview(GjallarCompositionInput {
overview_id: options.overview_id.clone(),
composed_at: timestamp()?,
target_columns: options.target_columns,
snapshot,
verses: read_many::<OdinVerseRecord>(&odin, &options.verse_keys)?,
services: read_many::<OdinServiceRecord>(&odin, &options.service_keys)?,
interfaces: read_many::<OdinInterfaceRecord>(&odin, &options.interface_keys)?,
observation_streams: read_many::<OdinObservationStreamRecord>(
&odin,
&options.observation_stream_keys,
)?,
translation_routes: read_many::<OdinTranslationRouteRecord>(
&odin,
&options.translation_route_keys,
)?,
}),
None => compose_from_compat_surface(
&options.overview_id,
options.target_columns,
timestamp()?,
read_compat_surface(&odin, &options.surface_key)?,
),
};
gjallar.put(&composition.overview.overview_id, &composition.overview)?;
for tile in &composition.tiles {
gjallar.put(&tile.tile_id, tile)?;
}
println!(
"Gjallar composed {} tiles for {}",
composition.overview.tile_count, composition.overview.overview_id
);
println!("Odin source: {}", options.odin_store_path.display());
println!("Gjallar feed: {}", options.gjallar_store_path.display());
Ok(())
}
fn read_many<T>(node: &CultMeshNode, keys: &[String]) -> Result<Vec<T>>
where
T: cultcache_rs::DatabaseEntry,
{
let mut records = Vec::new();
for key in keys {
if let Some(record) = node.get::<T>(key)? {
records.push(record);
}
}
Ok(records)
}
fn read_compat_surface(node: &CultMeshNode, key: &str) -> Result<serde_json::Value> {
let envelope = node
.cache()
.get_required_envelope::<EveSurfaceStateRecord>(key)?;
rmp_serde::from_slice(&envelope.payload).with_context(|| {
format!("decoding CommonJS Odin surface payload at {key:?} as MessagePack map")
})
}
fn compose_from_compat_surface(
overview_id: &str,
target_columns: u32,
composed_at: String,
surface: serde_json::Value,
) -> GjallarComposition {
let provider_id = string_field(&surface, "providerId", "surface");
let detail = surface
.get("surface")
.and_then(|surface| surface.get("root"))
.or_else(|| surface.get("root"))
.and_then(|root| root.get("props"))
.and_then(|props| props.get("summary"))
.and_then(|summary| summary.as_str())
.unwrap_or("Odin CommonJS surface");
let title = string_field(&surface, "title", &provider_id);
let updated_at = string_field(&surface, "updatedAt", "unknown");
let tile = GjallarOverviewTileRecord {
tile_id: format!("{overview_id}:tile:0"),
overview_id: overview_id.to_string(),
source_record: format!("gamecult.eve.surface_state:{provider_id}"),
tile_kind: "compat-surface".to_string(),
title,
state: "active".to_string(),
detail: detail.to_string(),
priority: 0,
row_span: 1,
column_span: target_columns.max(1),
observed_at: updated_at.clone(),
};
GjallarComposition {
overview: GjallarOverviewRecord {
overview_id: overview_id.to_string(),
source_snapshot_id: provider_id,
title: "Gjallar".to_string(),
status: "active".to_string(),
summary: "1 drawable tile from Odin compatibility surface".to_string(),
tile_count: 1,
target_columns: target_columns.max(1),
target_rows: 1,
source_observed_at: updated_at,
composed_at,
},
tiles: vec![tile],
}
}
fn string_field(value: &serde_json::Value, key: &str, fallback: &str) -> String {
value
.get(key)
.and_then(|entry| entry.as_str())
.filter(|entry| !entry.trim().is_empty())
.unwrap_or(fallback)
.to_string()
}
impl Options {
fn parse(args: impl Iterator<Item = String>) -> Result<Self> {
let repo_root = find_repo_root(env::current_dir().context("reading current directory")?);
let mut options = Options {
odin_store_path: repo_root.join("scratch").join("odin").join("odin.ccmp"),
gjallar_store_path: repo_root
.join("scratch")
.join("gjallar")
.join("gjallar.overview.ccmp"),
overview_id: "gjallar.overview:nightwing".to_string(),
surface_key: "surface:gamecult.network.status".to_string(),
target_columns: 4,
verse_keys: split_keys(
"starfire.local,nightwing.local,periwinkle.local,yggdrasil.local",
),
service_keys: split_keys("odin,cultcache,interfaces,gpu"),
interface_keys: split_keys("odin.allseer"),
observation_stream_keys: split_keys("periwinkle:motion:sensor,periwinkle:camera:media"),
translation_route_keys: Vec::new(),
interval_seconds: None,
};
let mut args = args.peekable();
while let Some(arg) = args.next() {
match arg.as_str() {
"--odin-store" => {
options.odin_store_path = PathBuf::from(take_value(&mut args, "--odin-store")?)
}
"--store" | "--gjallar-store" => {
options.gjallar_store_path =
PathBuf::from(take_value(&mut args, "--gjallar-store")?)
}
"--overview" => options.overview_id = take_value(&mut args, "--overview")?,
"--surface-key" => options.surface_key = take_value(&mut args, "--surface-key")?,
"--columns" => {
options.target_columns = take_value(&mut args, "--columns")?
.parse()
.context("--columns must be a positive integer")?
}
"--verses" => options.verse_keys = split_keys(take_value(&mut args, "--verses")?),
"--services" => {
options.service_keys = split_keys(take_value(&mut args, "--services")?)
}
"--interfaces" => {
options.interface_keys = split_keys(take_value(&mut args, "--interfaces")?)
}
"--streams" => {
options.observation_stream_keys =
split_keys(take_value(&mut args, "--streams")?)
}
"--routes" => {
options.translation_route_keys = split_keys(take_value(&mut args, "--routes")?)
}
"--interval-seconds" => {
options.interval_seconds = Some(
take_value(&mut args, "--interval-seconds")?
.parse()
.context("--interval-seconds must be a positive integer")?,
)
}
"--help" | "-h" => return Err(anyhow!(help_text())),
other => {
return Err(anyhow!(
"unknown Gjallar argument: {other}\n\n{}",
help_text()
));
}
}
}
if options.overview_id.trim().is_empty() {
return Err(anyhow!("--overview must not be empty"));
}
if options.target_columns == 0 {
return Err(anyhow!("--columns must be greater than zero"));
}
if options.interval_seconds == Some(0) {
return Err(anyhow!("--interval-seconds must be greater than zero"));
}
Ok(options)
}
}
fn take_value(args: &mut impl Iterator<Item = String>, name: &str) -> Result<String> {
args.next()
.ok_or_else(|| anyhow!("{name} requires a value"))
}
fn split_keys(value: impl AsRef<str>) -> Vec<String> {
value
.as_ref()
.split(',')
.map(str::trim)
.filter(|entry| !entry.is_empty())
.map(ToString::to_string)
.collect()
}
fn find_repo_root(start: PathBuf) -> PathBuf {
for candidate in start.ancestors() {
if candidate.join("Cargo.toml").exists() && candidate.join("personas").is_dir() {
return candidate.to_path_buf();
}
}
start
}
fn timestamp() -> Result<String> {
let seconds = SystemTime::now()
.duration_since(UNIX_EPOCH)
.context("system clock is before Unix epoch")?
.as_secs();
Ok(format!("unix:{seconds}"))
}
fn help_text() -> &'static str {
"Usage: gjallar [--odin-store <path>] [--gjallar-store <path>] [--overview <id>] [--surface-key <key>] [--columns <n>] [--verses <keys>] [--services <keys>] [--interfaces <keys>] [--streams <keys>] [--routes <keys>] [--interval-seconds <seconds>]\n\nGjallar reads Odin-owned typed records and publishes a compact typed overview feed for Nightwing."
}

View file

@ -7,8 +7,6 @@ pub const ODIN_SERVICE_SCHEMA: &str = "odin.service.v1";
pub const ODIN_INTERFACE_SCHEMA: &str = "odin.interface.v1";
pub const ODIN_OBSERVATION_STREAM_SCHEMA: &str = "odin.observation_stream.v1";
pub const ODIN_TRANSLATION_ROUTE_SCHEMA: &str = "odin.translation_route.v1";
pub const GJALLAR_OVERVIEW_SCHEMA: &str = "gjallar.overview.v1";
pub const GJALLAR_OVERVIEW_TILE_SCHEMA: &str = "gjallar.overview_tile.v1";
pub const EVE_SURFACE_STATE_SCHEMA: &str = "gamecult.eve.surface_state.v1";
pub const EVE_INTERFACE_BINDING_SCHEMA: &str = "gamecult.eve.interface_binding.v1";
pub const EVE_PROVIDER_ADVERTISEMENT_SCHEMA: &str = "gamecult.eve.provider_advertisement.v1";
@ -137,58 +135,6 @@ pub struct OdinTranslationRouteRecord {
pub notes: String,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(type = "gjallar.overview", schema = "gjallar.overview.v1")]
pub struct GjallarOverviewRecord {
#[cultcache(key = 0)]
pub overview_id: String,
#[cultcache(key = 1)]
pub source_snapshot_id: String,
#[cultcache(key = 2)]
pub title: String,
#[cultcache(key = 3)]
pub status: String,
#[cultcache(key = 4)]
pub summary: String,
#[cultcache(key = 5)]
pub tile_count: u32,
#[cultcache(key = 6)]
pub target_columns: u32,
#[cultcache(key = 7)]
pub target_rows: u32,
#[cultcache(key = 8)]
pub source_observed_at: String,
#[cultcache(key = 9)]
pub composed_at: String,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(type = "gjallar.overview_tile", schema = "gjallar.overview_tile.v1")]
pub struct GjallarOverviewTileRecord {
#[cultcache(key = 0)]
pub tile_id: String,
#[cultcache(key = 1)]
pub overview_id: String,
#[cultcache(key = 2)]
pub source_record: String,
#[cultcache(key = 3)]
pub tile_kind: String,
#[cultcache(key = 4)]
pub title: String,
#[cultcache(key = 5)]
pub state: String,
#[cultcache(key = 6)]
pub detail: String,
#[cultcache(key = 7)]
pub priority: i32,
#[cultcache(key = 8)]
pub row_span: u32,
#[cultcache(key = 9)]
pub column_span: u32,
#[cultcache(key = 10)]
pub observed_at: String,
}
#[derive(Clone, Debug, PartialEq, DatabaseEntry)]
#[cultcache(
type = "gamecult.eve.surface_state",
@ -349,8 +295,6 @@ cultmesh_rs::cultmesh_documents!(OdinDocuments {
OdinInterfaceRecord => ODIN_INTERFACE_SCHEMA,
OdinObservationStreamRecord => ODIN_OBSERVATION_STREAM_SCHEMA,
OdinTranslationRouteRecord => ODIN_TRANSLATION_ROUTE_SCHEMA,
GjallarOverviewRecord => GJALLAR_OVERVIEW_SCHEMA,
GjallarOverviewTileRecord => GJALLAR_OVERVIEW_TILE_SCHEMA,
EveSurfaceStateRecord => EVE_SURFACE_STATE_SCHEMA,
EveInterfaceBindingCompatRecord => EVE_INTERFACE_BINDING_SCHEMA,
EveProviderAdvertisementCompatRecord => EVE_PROVIDER_ADVERTISEMENT_SCHEMA,

View file

@ -1,245 +0,0 @@
use crate::documents::{
GjallarOverviewRecord, GjallarOverviewTileRecord, OdinInterfaceRecord,
OdinObservationStreamRecord, OdinServiceRecord, OdinSnapshotRecord, OdinTranslationRouteRecord,
OdinVerseRecord,
};
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct GjallarCompositionInput {
pub overview_id: String,
pub composed_at: String,
pub target_columns: u32,
pub snapshot: OdinSnapshotRecord,
pub verses: Vec<OdinVerseRecord>,
pub services: Vec<OdinServiceRecord>,
pub interfaces: Vec<OdinInterfaceRecord>,
pub observation_streams: Vec<OdinObservationStreamRecord>,
pub translation_routes: Vec<OdinTranslationRouteRecord>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct GjallarComposition {
pub overview: GjallarOverviewRecord,
pub tiles: Vec<GjallarOverviewTileRecord>,
}
pub fn compose_gjallar_overview(input: GjallarCompositionInput) -> GjallarComposition {
let mut tiles = Vec::new();
let overview_id = input.overview_id;
let target_columns = input.target_columns.max(1);
tiles.push(tile(
&overview_id,
0,
"odin.snapshot:latest",
"summary",
"Odin",
snapshot_status(&input.snapshot),
format!(
"{} verses / {} services / {} interfaces / {} streams",
input.snapshot.verse_count,
input.snapshot.service_count,
input.snapshot.interface_count,
input.snapshot.observation_stream_count
),
input.snapshot.observed_at.clone(),
));
for (index, interface) in input.interfaces.iter().enumerate() {
tiles.push(tile(
&overview_id,
100 + index as i32,
format!("odin.interface:{}", interface.provider_id),
"interface",
interface.title.clone(),
interface.state.clone(),
interface.source.clone(),
interface.observed_at.clone(),
));
}
for (index, stream) in input.observation_streams.iter().enumerate() {
tiles.push(tile(
&overview_id,
300 + index as i32,
format!("odin.observation_stream:{}", stream.stream_key),
"observation-stream",
format!("{} {}", stream.device_id, stream.stream_id),
stream.state.clone(),
stream.detail.clone(),
stream.observed_at.clone(),
));
}
for (index, service) in input.services.iter().enumerate() {
tiles.push(tile(
&overview_id,
500 + index as i32,
format!("odin.service:{}", service.service_id),
"service",
service.name.clone(),
service.state.clone(),
service.detail.clone(),
service.observed_at.clone(),
));
}
for (index, verse) in input.verses.iter().enumerate() {
tiles.push(tile(
&overview_id,
700 + index as i32,
format!("odin.verse:{}", verse.verse_id),
"verse",
verse.name.clone(),
verse.status.clone(),
verse.role.clone(),
verse.observed_at.clone(),
));
}
for (index, route) in input.translation_routes.iter().enumerate() {
tiles.push(tile(
&overview_id,
900 + index as i32,
format!("odin.translation_route:{}", route.route_id),
"translation-route",
route.target_schema.clone(),
route.translation_kind.clone(),
route.owner.clone(),
input.snapshot.observed_at.clone(),
));
}
tiles.sort_by(|left, right| left.priority.cmp(&right.priority));
let target_rows = (tiles.len() as u32).div_ceil(target_columns).max(1);
let status = if tiles.iter().any(|entry| entry.state == "failed") {
"degraded"
} else {
"active"
};
let overview = GjallarOverviewRecord {
overview_id: overview_id.clone(),
source_snapshot_id: input.snapshot.snapshot_id,
title: "Gjallar".to_string(),
status: status.to_string(),
summary: format!("{} drawable tiles from Odin sight", tiles.len()),
tile_count: tiles.len() as u32,
target_columns,
target_rows,
source_observed_at: input.snapshot.observed_at,
composed_at: input.composed_at,
};
GjallarComposition { overview, tiles }
}
fn tile(
overview_id: &str,
priority: i32,
source_record: impl Into<String>,
tile_kind: impl Into<String>,
title: impl Into<String>,
state: impl Into<String>,
detail: impl Into<String>,
observed_at: impl Into<String>,
) -> GjallarOverviewTileRecord {
GjallarOverviewTileRecord {
tile_id: format!("{}:tile:{priority}", overview_id),
overview_id: overview_id.to_string(),
source_record: source_record.into(),
tile_kind: tile_kind.into(),
title: title.into(),
state: state.into(),
detail: detail.into(),
priority,
row_span: 1,
column_span: 1,
observed_at: observed_at.into(),
}
}
fn snapshot_status(snapshot: &OdinSnapshotRecord) -> String {
if snapshot.service_count == 0 && snapshot.interface_count == 0 {
"waiting".to_string()
} else {
"active".to_string()
}
}
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
#[test]
fn compose_overview_orders_dashboard_tiles_for_nightwing() {
let composition = compose_gjallar_overview(GjallarCompositionInput {
overview_id: "gjallar.overview:nightwing".to_string(),
composed_at: "2026-06-05T00:00:00Z".to_string(),
target_columns: 2,
snapshot: OdinSnapshotRecord {
snapshot_id: "latest".to_string(),
observed_at: "2026-06-05T00:00:00Z".to_string(),
verse_count: 1,
service_count: 1,
interface_count: 1,
observation_stream_count: 1,
source: "unit-test".to_string(),
},
verses: vec![OdinVerseRecord {
verse_id: "nightwing.local".to_string(),
name: "Nightwing".to_string(),
role: "terminal-lowerer".to_string(),
status: "active".to_string(),
capabilities: vec!["tui".to_string()],
observed_at: "2026-06-05T00:00:00Z".to_string(),
}],
services: vec![OdinServiceRecord {
service_id: "odin".to_string(),
verse_id: "starfire.local".to_string(),
name: "Odin".to_string(),
state: "active".to_string(),
detail: "all-seer".to_string(),
authority: "odin".to_string(),
observed_at: "2026-06-05T00:00:00Z".to_string(),
}],
interfaces: vec![OdinInterfaceRecord {
provider_id: "odin.allseer".to_string(),
title: "Odin All-Seer".to_string(),
state: "active".to_string(),
source: "cultmesh".to_string(),
version: Some("v1".to_string()),
updated_at: None,
observed_at: "2026-06-05T00:00:00Z".to_string(),
}],
observation_streams: vec![OdinObservationStreamRecord {
stream_key: "periwinkle:motion:sensor".to_string(),
device_id: "periwinkle".to_string(),
stream_id: "motion".to_string(),
kind: "sensor".to_string(),
state: "active".to_string(),
detail: "fresh".to_string(),
owner: "mimir".to_string(),
observed_at: "2026-06-05T00:00:00Z".to_string(),
}],
translation_routes: vec![OdinTranslationRouteRecord {
route_id: "source=>target".to_string(),
source_schema: "source".to_string(),
target_schema: "target".to_string(),
translation_kind: "projection".to_string(),
owner: "odin".to_string(),
version: "v1".to_string(),
notes: "test".to_string(),
}],
});
assert_eq!(composition.overview.tile_count, 6);
assert_eq!(composition.overview.target_rows, 3);
assert_eq!(composition.tiles[0].tile_kind, "summary");
assert_eq!(
composition.tiles[1].source_record,
"odin.interface:odin.allseer"
);
}
}

View file

@ -1,12 +1,10 @@
pub mod documents;
pub mod gjallar;
pub mod idunn;
pub mod pipeline;
pub mod ports;
pub mod repository;
pub use documents::*;
pub use gjallar::*;
pub use idunn::*;
pub use pipeline::*;
pub use ports::*;

View file

@ -1,6 +1,5 @@
use crate::documents::{
GjallarOverviewRecord, GjallarOverviewTileRecord, OdinDocuments, OdinRecords,
OdinServiceRecord, OdinSnapshotRecord, OdinVerseRecord,
OdinDocuments, OdinRecords, OdinServiceRecord, OdinSnapshotRecord, OdinVerseRecord,
};
use anyhow::Result;
use cultmesh_rs::{CultMesh, CultMeshNode, CultMeshNodeOptions};
@ -39,14 +38,6 @@ impl CultMeshOdinRepository {
self.node.get::<OdinVerseRecord>(verse_id)
}
pub fn get_gjallar_overview(&self, overview_id: &str) -> Result<Option<GjallarOverviewRecord>> {
self.node.get::<GjallarOverviewRecord>(overview_id)
}
pub fn get_gjallar_tile(&self, tile_id: &str) -> Result<Option<GjallarOverviewTileRecord>> {
self.node.get::<GjallarOverviewTileRecord>(tile_id)
}
pub fn document_binding_version(&self, document_type: &str) -> Option<String> {
self.node
.documents()

View file

@ -35,9 +35,9 @@ Verse / host / device / provider inputs
-> CultMesh node
-> CultCache .cc persistence
-> CultNet/CultMesh document registry
-> Gjallar overview composition
-> Nightwing terminal lowering
-> Eve/CultUI projection and compact display feeds
-> Odin Eve/CultUI deck projection
-> Gjallar Nightwing composition and framebuffer lowering
-> compact display feeds
```
The first Rust core lives in `crates/odin-core`:
@ -48,8 +48,6 @@ The first Rust core lives in `crates/odin-core`:
Odin records.
- `repository.rs`: `OdinRepository` abstraction, in-memory mock repository, and
CultMesh-backed repository.
- `gjallar.rs`: pure overview composition from Odin records to typed Gjallar
overview/tile records.
The Rust spine owns the future architecture. The CommonJS daemon remains the
legacy operational body until each organ crosses this typed boundary.
@ -59,10 +57,9 @@ legacy operational body until each organ crosses this typed boundary.
Odin's executable body is split by ownership:
- `crates/odin-core`: Rust target core. Owns typed Odin documents, ingest
ports, Gjallar overview records, normalization, composition, and
CultMesh/CultCache repository boundaries. This is the replacement spine;
JavaScript remains legacy runtime/probe scaffolding until each organ has
crossed the typed boundary.
ports, normalization, and CultMesh/CultCache repository boundaries. This is
the replacement spine; JavaScript remains legacy runtime/probe scaffolding
until each organ has crossed the typed boundary.
- `src/odin-coordinator.cjs`: process lifecycle, refresh loop, persistence, health, and transport wiring.
- `src/odin/config.cjs`: runtime paths, seed deck URLs, intervals, and CultLib module path setup.
- `src/odin/documents.cjs`: CultCache/CultMesh document definitions accepted by Odin.
@ -76,16 +73,12 @@ Odin's executable body is split by ownership:
The entrypoint is not allowed to grow new probe, surface, provider, layout, or renderer policy. If a new owner is needed, name the owner and its invariant before adding code.
Gjallar is the named overview composition daemon for what Nightwing displays.
In the Rust spine, Gjallar has typed `gjallar.overview.v1` and
`gjallar.overview_tile.v1` records. Its package lives in
`crates/gjallar-daemon` and `docs/gjallar.md`. It runs as its own Rust CultMesh
entrypoint rather than being folded into Odin's coordinator or Nightwing's TUI.
Gjallar may read Odin-owned state and emit a packed overview feed. During the
CommonJS-to-Rust migration it may also read Odin's existing
`gamecult.eve.surface_state.v1` compatibility record and wrap it as a Gjallar
tile. It must not own the underlying registry, probe, provider truth, terminal
glyph rendering, or translation decisions.
Gjallar is the Nightwing-resident terminal compositor for what Odin can show.
Its runtime lives in `src/Gjallar` and consumes Odin's Eve deck directly.
Gjallar owns provider enumeration for display, panel packing, marquee behavior,
glyph/color/framebuffer lowering, frame stats, and the multi-scale terminal
product. It must not own the underlying registry, probe, provider truth, or
translation decisions.
Idunn is the named keepalive organ for daemon continuity. Its current Rust
body lives in `crates/idunn-daemon` and `crates/odin-core/src/idunn.rs`. Idunn may read
@ -145,8 +138,6 @@ Current Rust verification:
- `pipeline_collects_from_injected_ports`: proves ingest ports and clock injection.
- `memory_repository_supports_fast_unit_tests`: proves repository consumers can test without CultMesh.
- `compose_overview_orders_dashboard_tiles_for_nightwing`: proves Gjallar can
turn Odin records into an ordered overview feed without daemon boot.
- `cultmesh_repository_round_trips_typed_records`: proves typed Odin records
persist through CultMesh/CultCache and reload from `.cc`.
@ -188,11 +179,12 @@ Odin currently publishes service squares for:
- Raven: SSH reachability.
- Yggdrasil: SSH/HTTP/HTTPS reachability plus nginx, StreamPixels, Heimdall, Repixelizer, and Bifrost systemd state.
Gjallar composes these into the compact overview feed. The Nightwing TUI lowers
that feed into dense cells and fills surplus screen space according to
Gjallar's tile ordering, spans, and density hints. If Nightwing starts deriving
dashboard composition directly from Odin service records, the composition owner
has leaked out of Gjallar.
Gjallar consumes Odin's deck and composes these surfaces into the Nightwing
display. Nightwing is the host/body; Gjallar is the terminal product running
there. If Odin starts deciding framebuffer composition, the renderer owner has
leaked upward. If individual providers start tuning themselves for Nightwing
instead of emitting clean Eve/CultUI surfaces, provider truth has leaked
downward.
## Current Interface Surface

View file

@ -1,92 +1,79 @@
# Gjallar
Gjallar is the overview composition daemon for Odin.
Gjallar is the Nightwing-resident terminal compositor for Odin's domain.
Odin is the all-seer: it accepts Verse discovery, schema catalogs, translation
routes, provider surfaces, and observation projections. Gjallar reads that
Odin-owned state and composes the dense overview feed that Nightwing displays.
Nightwing should not run a bespoke dashboard brain; it should ask Gjallar what
to draw and then lower that feed into fast terminal cells.
routes, provider surfaces, and observation projections. Gjallar talks to Odin,
enumerates the active provider surfaces Odin can show, and composes those
surfaces into the live multi-scale dashboard running on Nightwing.
Gjallar exists so Odin does not need to care how a pile of dashboards fits on
one screen, and Nightwing does not need to know how Odin's world model is built.
Gjallar exists so Odin does not need to care how a pile of provider-owned TUIs
fits on one fast display, and provider daemons do not need to know the terminal
body they are being lowered into.
## Authority Map
- Owner: Gjallar owns overview composition for Odin sight.
- Inputs: Odin's accepted snapshot, Verse records, service records, interface
records, observation stream records, translation route records, and explicit
operator/Nightwing display constraints.
- Outputs: typed `gjallar.overview.v1` and `gjallar.overview_tile.v1` records:
overview metadata, tile ordering, density hints, source pointers, status,
labels, and compact detail text for Nightwing.
- Derived state: tile priority, grouping, target rows/columns, row/column spans,
visual emphasis hints, and compact summaries are derived from Odin state.
- Owner: Gjallar owns Nightwing dashboard composition, tiling, marquee, visual
density, framebuffer presentation, and character-level refresh behavior.
- Inputs: Odin's Eve/CultUI deck endpoint, provider ids, provider-owned surface
graphs, display constraints, font choices, and operator runtime flags.
- Outputs: the visible Nightwing framebuffer and compact Gjallar frame/status
telemetry.
- Derived state: panel packing, visual weight, tile position, gutter cells,
marquee tape, glyph size, and frame timing are derived from Odin/provider
surfaces plus display constraints.
- Forbidden writers: Gjallar does not probe hosts, accept Verse truth, mutate
provider-owned dashboards, own terminal glyph rendering, or invent schema
translation routes.
- Shared paths: Nightwing TUI, browser previews, future compact overlays, and
agent summaries consume the same Gjallar overview feed when they want the
"everything Odin sees" view.
- Deletion line: any Nightwing path that independently composes Odin dashboards
should move into Gjallar; any Gjallar path that decides discovery truth should
move back into Odin.
provider-owned dashboards, invent schema translation routes, or replace Odin's
provider registry.
- Shared paths: Nightwing's physical display, local frame dumps, future compact
overlays, and agent-facing TUI captures should all lower the same Gjallar
composition behavior when they want the "everything Odin can show" view.
- Deletion line: the old Rust `gjallar.overview` feed is not a runtime
authority. Any path that wants Nightwing composition belongs in `src/Gjallar`;
any path that decides discovery truth belongs in Odin.
## Body
- `crates/gjallar-daemon` is Gjallar's Rust CultMesh daemon.
- `crates/odin-core/src/gjallar.rs` owns the pure composition function so unit
tests can exercise packing decisions without booting a daemon.
- `gjallar.overview.v1` describes the feed Nightwing asks for.
- `gjallar.overview_tile.v1` describes each drawable tile and names its Odin
source record.
- `src/Gjallar` is Gjallar's executable C# runtime.
- `Gjallar.csproj` builds the Nightwing framebuffer compositor.
- Gjallar consumes Odin's deck over WebSocket, defaulting to
`ws://192.168.1.66:8797/eve/deck` and provider `odin.allseer`.
- The old Rust `crates/gjallar-daemon` and `gjallar.overview` records were cut
because they created an intermediate composition owner that did nothing Odin
and Gjallar's live renderer could not explain directly.
- `assets/personas/gjallar-avatar.png` and
`assets/personas/gjallar-avatar-pixel-256.png` remain branding assets for the
view/persona surface.
Run one composition pass from the repo root:
Build from the repo root:
```powershell
cargo run -p gjallar-daemon --
dotnet build .\src\Gjallar\Gjallar.csproj
```
By default, Gjallar reads Odin's local CultMesh store at
`scratch/odin/odin.ccmp` and writes its feed to
`scratch/gjallar/gjallar.overview.ccmp`.
Publish for Nightwing:
```powershell
dotnet publish .\src\Gjallar\Gjallar.csproj -c Release -r linux-x64 --self-contained true -o .\scratch\publish\gjallar
```
## Runtime Contract
```text
Odin typed state
-> Gjallar overview composition
-> gjallar.overview / gjallar.overview_tile CultMesh records
-> Nightwing terminal lowerer
provider-owned Eve/CultUI surfaces
-> Odin discovery and allseer deck
-> Gjallar provider enumeration, packing, marquee, and framebuffer lowering
-> Nightwing visible display
```
Nightwing owns terminal speed, key handling, glyph selection, color lowering,
and screen refresh. Gjallar owns what should be on the overview and how densely
it should be packed. Odin owns the facts being summarized.
## Current Cut
The current Rust daemon has two input paths:
- Preferred: read Rust typed Odin records such as `odin.snapshot.v1`,
`odin.service.v1`, and `odin.interface.v1` from an Odin CultMesh store.
- Compatibility: read Odin's current CommonJS
`gamecult.eve.surface_state.v1` record as a raw MessagePack map, then wrap it
as a typed Gjallar overview tile.
The compatibility path exists so Gjallar can talk to today's Odin without
pretending the migration is complete. The next improvement is for Odin to
publish a typed index/catalog document that Gjallar can read instead of carrying
configured key lists.
Nightwing is the host/body. Gjallar is the product that runs there. Odin owns
the accepted discovery/provider view. Each daemon owns its own surface truth.
## Invariants
- Odin remains the accepted owner of all-seer state.
- Gjallar owns overview composition, not discovery truth.
- Nightwing owns terminal lowering, not dashboard composition.
- Every tile names the Odin source record behind it.
- Missing Odin records disappear from the feed rather than becoming invented
truth.
- Odin remains the accepted owner of all-seer discovery and provider indexing.
- Gjallar owns display composition, not discovery truth.
- Provider surfaces are lowered, not rewritten into status summaries.
- Missing or invalid provider surfaces disappear or render as unavailable; they
do not become invented truth.
- Frame/status telemetry observes Gjallar's rendering behavior only.

View file

@ -205,12 +205,12 @@ function buildPersonaState() {
}),
],
incubation: [
thought("csharp-cultmesh-body", "Promote Gjallar from doc/persona package into an executable C# CultMesh daemon after Odin's runtime state read path and affordance packet schema are clear.", {
thought("csharp-cultmesh-body", "Gjallar now has an executable C# Nightwing body that consumes Odin's Eve deck and renders the live multi-scale terminal dashboard.", {
status: "active",
question: "Which CultMesh document should carry Gjallar's first affordance packet?",
actionImplication: "Build the C# daemon around CultMesh node startup and typed Persona state, not a JSON sidecar.",
question: "Which native CultMesh subscription should replace the current Odin WebSocket deck bridge when the protocol is ready?",
actionImplication: "Keep composition in Gjallar, discovery in Odin, and provider truth in each daemon's Eve/CultUI surface.",
intensity: 0.76,
tags: ["csharp", "cultmesh", "runtime"],
tags: ["csharp", "nightwing", "runtime"],
}),
],
},
@ -233,19 +233,19 @@ function buildPersonaState() {
candidateActions: {
actions: [
{
id: "build-csharp-gjallar-daemon",
id: "promote-gjallar-native-cultmesh",
status: "draft",
actionType: "propose",
readiness: "waiting",
riskLevel: "medium",
target: target("runtime", "gjallar-csharp-daemon", "Gjallar C# CultMesh daemon"),
summary: "Implement Gjallar as its own C# CultMesh runtime once the packet schema and Odin state read path are named.",
rationale: "The Persona state is now a typed `.cc` record; the daemon body should use the same substrate instead of JSON.",
target: target("runtime", "gjallar-native-cultmesh", "Gjallar native CultMesh input path"),
summary: "Promote Gjallar's Odin input from the current WebSocket deck bridge to a native CultMesh subscription when the deck contract is ready.",
rationale: "Gjallar's C# Nightwing body exists; the remaining migration debt is the input transport, not the ownership model.",
urgency: 0.62,
confidence: 0.74,
constraints: [
"Do not fold Gjallar into Odin's CommonJS coordinator.",
"Do not let Gjallar own discovery, probing, rendering, or schema truth.",
"Do not let Gjallar own discovery, probing, provider truth, or schema truth.",
"Use CultMesh/CultCache typed state as the runtime substrate.",
],
createdAt: updatedAt,

View file

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>Gjallar</AssemblyName>
<RootNamespace>Gjallar</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\CultMath\src\CultMath\CultMath.csproj" />
</ItemGroup>
</Project>

1795
src/Gjallar/Program.cs Normal file

File diff suppressed because it is too large Load diff