Merge X1: delete Odin's dead lifecycle residue (-7,037 lines)

odin-core idunn.rs and idunn.*/bifrost schemas, the retired JS
coordinator, dead deploy/restart/health scripts, lifecycle claims in
docs. Soul: nothing deleted is reached by the deployed odin-daemon, the
Hermodr container or any live store. Idunn map cut X1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
soul-probe 2026-09-30 00:48:07 +02:00
commit 68b666c2e5
64 changed files with 140 additions and 7177 deletions

1
Cargo.lock generated
View file

@ -591,7 +591,6 @@ dependencies = [
"cultmesh-rs",
"cultnet-rs",
"pretty_assertions",
"rmp-serde",
"serde",
"serde_json",
"tempfile",

101
README.md
View file

@ -70,75 +70,47 @@ Local package surfaces:
## Idunn
Idunn is Odin's keepalive organ: the daemon package that should keep the known
swarm alive after Odin has accepted where each daemon lives and what authority
path may touch it. Individual daemons publish health and command boundaries;
Idunn brings them up after reboots or crashes, watches health, and escalates
operator-needed failures through Bifrost's CultMesh bridge. VoidBot owner-DM
delivery is a demoted compatibility actuator, not the owner; the command belongs
in Bifrost's Verse. Odin sees the daemons; Idunn keeps the apples from rotting.
Agents do not deploy daemons directly. They configure Idunn's target catalog,
release targets, migration commands, and command boundaries so Idunn can run
the shared rollout primitive and leave typed witnesses behind.
Deployment consequence has one final owner: immediately before every migration,
deploy, or restart process spawn, Idunn re-opens the root-owned deployment-brake
CultCache and the dedicated operator public anchor. A released record must bind
the canonical runtime (`yggdrasil` for `yggdrasil-local`), exact source revision
(or `restart:<daemon>`), exact request id, operator, signature, and short expiry.
Missing, corrupt, engaged, expired, foreign, wrong-scope, substituted, or
badly-signed state fails closed. Planning and lifecycle-command publication do
not bypass or cache this decision. The store and its sibling `.lock` live in
`/var/lib/gamecult/idunn-authority`, a root-owned `root:idunn` `0750` directory;
both files are `root:idunn` `0640`, and the daemon's systemd sandbox exposes the
directory read-only. Idunn holds the lock shared from its final snapshot read
through process spawn, so an engage cannot be defeated by previously captured
released bytes. A release is not one-shot: its exact request/revision grant
covers each migration and deploy spawn in that rollout until its short expiry;
every spawn independently reopens and validates the same grant.
Idunn (`GameCult/Idunn`) owns deployment and daemon survival for every GameCult
target, Odin included: it builds from the target's recipe, activates and
restarts the admitted incarnation, and holds the deployment and lifecycle
brakes. Odin owns none of that. Odin does discovery, schema awareness,
rendezvous, and interface aggregation, and it reads Idunn's topology projection
to learn which incarnations exist. Agents do not deploy daemons directly: they
configure the target's recipe and binding and let Idunn run the transaction.
Local package surfaces:
- Organ contract: `docs/idunn.md`
- User README: `src/Idunn/README.md`
- Rust daemon crate: `crates/idunn-daemon`
- Rust lifecycle logic: `crates/odin-core/src/idunn.rs`
- Runtime store: `scratch/idunn/idunn.keepalive.cc`
- Hosted VoidBot release: upstream `main` -> Yggdrasil-local Idunn -> the
root-owned `/srv/odin/deploy-manifests/voidbot` actuator. Local checkouts are
development and diagnostics only; do not create a local deployment.
- Hosted Odin release: branch `codex/ygg-idunn-independent-bootstrap` plus the
exact CultLib commit in `deploy/cultlib.commit` -> one immutable
`/srv/odin/releases/<commit>` body -> `/srv/odin/current`. Odin signs its own
liveness to Idunn, while Idunn starts independently and owns later restart or
deployment actuation.
- Operator escalation: Bifrost-owned CultMesh crossing; current compatibility
delivery calls `scripts\notify-idunn-operator-alarm.ps1`, which asks Bifrost
to publish a typed `gamecult.operator_dm_request.v1` CultMesh command document
only after Idunn raises an alarm
- Deployment recipe: `deployment/idunn/recipe.toml`
- Operator binding: `/etc/gamecult/idunn/bindings/odin.toml` on the host, not in
this repository
- Live deployment and admission map: `state/map.yaml`
- Idunn's contract, brakes, and runbooks: the `GameCult/Idunn` repository
## Authority Map
- Owner: Odin owns the network-wide Verse registry, schema catalog index, translation map, and accepted provider catalog/proxy surfaces.
- Inputs: CultMesh/CultNet peer announcements, schema catalog responses, daemon
health/provider publications over `cultnet.transport.rudp.v0`, local
Docker/ADB debug facts, and provider-owned Eve/CultUI surfaces.
health/provider publications over `cultnet.transport.rudp.v0`, Idunn's
read-only topology projection, and provider-owned Eve/CultUI surfaces.
- Outputs: CultCache-backed Odin state, CultMesh documents, and CultNet
schema/catalog messages. Browser, GUI, TUI, and framebuffer renderers lower
those documents outside Odin instead of asking Odin to host web surfaces.
- Derived state: Gjallar's aggregate surface is derived from Odin/provider state; Eve clients derive pixels from that aggregate.
- 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.
- Not Odin's: process lifecycle, restart, deployment, and daemon survival belong to Idunn.
## Run Locally On Starfire
## Runtime Body
```powershell
.\scripts\start-odin.ps1 -IdunnRudpHealth $env:IDUNN_RUDP_HEALTH
```
Odin runs as `odin-daemon` under Idunn on Yggdrasil, built from
`deployment/idunn/recipe.toml`. There is no local start script. The daemon:
`-IdunnRudpHealth`, `ODIN_IDUNN_RUDP_HEALTH`, or `IDUNN_RUDP_HEALTH` must name
the Idunn RUDP health endpoint. Odin does not assume a localhost health target.
- reads Idunn's read-only projection to learn which incarnations of which
targets exist;
- admits provider presences over RUDP for those incarnations and persists them
through CultMesh/CultCache;
- publishes signed runtime-topology correlation records;
- answers CultNet/RUDP snapshot and document requests on its route.
Odin's native document catalog is addressed by CultMesh URI. Concrete RUDP
bootstrap is configured behind CultMesh URI resolution by the operator or by
@ -152,28 +124,9 @@ That URI accepts typed document publication and schema/catalog requests through
the shared CultMesh runtime. Consumers that need Odin's accepted surface can
still request the current CultNet snapshot after CultMesh resolves the transport.
Legacy browser/deck lowerers must consume Odin's CultMesh state through their
own lowering process. Odin no longer hosts browser-deck surfaces or publishes
deck URLs as discovery seed material.
State and logs live under ignored `scratch/odin/`.
## Current First Body
The first executable is deliberately narrow:
- publishes provider catalog `odin.providers`;
- persists the latest surface through local CultMesh/CultCache when `CultLib` packages are available at `E:\Projects\CultLib\packages`;
- writes `scratch/odin/latest-surface.json` only when `--write-debug-surface-json` or `ODIN_WRITE_DEBUG_SURFACE_JSON=1` is explicitly supplied;
- observes Starfire Docker and Periwinkle ADB as local debug/edge facts;
- derives remote Verse presence from provider-owned CultMesh/CultNet
advertisements and interface records, not TCP/SSH/systemd probes.
- publishes explicit `verse` and `service` nodes for compact Eve/CultUI lowerers.
- ingests provider-owned Eve/CultUI dashboards, including `mimir.live.stats` and `voidbot.swarm`, and embeds them as Odin `interface` nodes;
- accepts live `gamecult.eve.provider_advertisement.v1` announcements through Odin's CultMesh/RUDP rendezvous path so daemons can announce schemas, surfaces, commands, nested Verses, and style capabilities without Odin scraping private dashboards;
- accepts explicit local debug imports only when `--interfaceBindingStore` / `ODIN_INTERFACE_BINDING_STORES` entries are written as `cultmesh-store:file://...` URIs; raw filesystem paths are not discovery configuration;
- preserves provider semantic addresses such as `asgard.starfire.bifrost/eve/tui` and `asgard.starfire.bifrost/eve/gui`, with CultNet routes carried as transport metadata rather than identity;
- persists operator tiling intent as `odin.interface_layout.v1` in the Odin CultMesh store; ignored `scratch/odin/interface-layout.json` is migration input only.
Browser and deck lowerers consume Odin's CultMesh state through their own
lowering process. Odin does not host browser-deck surfaces or publish deck URLs
as discovery seed material.
Provider advertisements and CultNet/RUDP transport profiles are the discovery
path. External host probes, product health checks, port probes, and renderer

View file

@ -13,11 +13,10 @@ path = "src/lib.rs"
anyhow = "1"
cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "3bf1c0cea53e0092187fa2e59a75ba1571947ffe", package = "cultcache-rs" }
cultmesh-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "3bf1c0cea53e0092187fa2e59a75ba1571947ffe", package = "cultmesh-rs" }
serde_json = "1"
cultnet-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "3bf1c0cea53e0092187fa2e59a75ba1571947ffe", package = "cultnet-rs" }
serde_json = "1"
serde = { version = "1", features = ["derive"] }
[dev-dependencies]
rmp-serde = "1.3"
pretty_assertions = "1.4"
tempfile = "3"

File diff suppressed because it is too large Load diff

View file

@ -1,672 +0,0 @@
use crate::documents::{
IdunnDaemonHealthRecord, IdunnDeploymentRequestRecord, IdunnDesiredDaemonRecord,
IdunnKeepaliveDecisionRecord, IdunnOperatorAlarmRecord, IdunnRestartRequestRecord,
};
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct IdunnPlan {
pub decision: IdunnKeepaliveDecisionRecord,
pub deployment_request: Option<IdunnDeploymentRequestRecord>,
pub restart_request: Option<IdunnRestartRequestRecord>,
pub operator_alarm: Option<IdunnOperatorAlarmRecord>,
}
pub fn plan_keepalive(
desired: &IdunnDesiredDaemonRecord,
health: &IdunnDaemonHealthRecord,
now: impl Into<String>,
) -> IdunnPlan {
let now = now.into();
let decision_id = format!("{}:{}", desired.daemon_id, now);
if !desired.enabled {
return IdunnPlan {
decision: decision(&decision_id, desired, "noop", "daemon is disabled", &now),
deployment_request: None,
restart_request: None,
operator_alarm: None,
};
}
if is_healthy(&health.state) {
return IdunnPlan {
decision: decision(&decision_id, desired, "observe", "daemon is healthy", &now),
deployment_request: None,
restart_request: None,
operator_alarm: None,
};
}
if health.state == "warming" {
return IdunnPlan {
decision: decision(
&decision_id,
desired,
"observe",
"daemon is warming under provider-owned progress authority",
&now,
),
deployment_request: None,
restart_request: None,
operator_alarm: None,
};
}
if health.state == "degraded" || health.state == "dependency-unavailable" {
let alarm_id = format!("alarm:{}:{}", desired.daemon_id, now);
let reason = format!(
"health is {}; local restart/deploy is not the owner of this failure: {}",
health.state, health.detail
);
return IdunnPlan {
decision: decision(&decision_id, desired, "alarm", &reason, &now),
deployment_request: None,
restart_request: None,
operator_alarm: Some(IdunnOperatorAlarmRecord {
alarm_id,
daemon_id: desired.daemon_id.clone(),
severity: "operator-action-required".to_string(),
reason,
escalation_target: "bifrost.operator-notification".to_string(),
raised_at: now,
}),
};
}
if let Some(command) = desired.deploy_command.as_deref() {
if !command.trim().is_empty() && health.state == "stale-deployment" {
let request_id = format!("deploy:{}:{}", desired.daemon_id, now);
return IdunnPlan {
decision: decision(
&decision_id,
desired,
"deploy",
&format!(
"health is {}; deployment authority is available",
health.state
),
&now,
),
deployment_request: Some(IdunnDeploymentRequestRecord {
request_id,
daemon_id: desired.daemon_id.clone(),
command: command.to_string(),
authority: desired.authority.clone(),
requested_at: now,
repository_full_name: String::new(),
upstream_ref: String::new(),
source_revision: String::new(),
release_authority_id: String::new(),
release_authority_envelope_sha256: String::new(),
requires_bifrost_authority: false,
}),
restart_request: None,
operator_alarm: None,
};
}
}
if health.state == "stale-deployment" {
let alarm_id = format!("alarm:{}:{}", desired.daemon_id, now);
let reason = format!(
"health is stale-deployment under {}; no deploy command authority is available",
desired.health_contract
);
return IdunnPlan {
decision: decision(&decision_id, desired, "alarm", &reason, &now),
deployment_request: None,
restart_request: None,
operator_alarm: Some(IdunnOperatorAlarmRecord {
alarm_id,
daemon_id: desired.daemon_id.clone(),
severity: "operator-action-required".to_string(),
reason,
escalation_target: "bifrost.operator-notification".to_string(),
raised_at: now,
}),
};
}
match desired.restart_command.as_deref() {
Some(command) if !command.trim().is_empty() => {
let request_id = format!("restart:{}:{}", desired.daemon_id, now);
IdunnPlan {
decision: decision(
&decision_id,
desired,
"restart",
&format!("health is {}; restart authority is available", health.state),
&now,
),
restart_request: Some(IdunnRestartRequestRecord {
request_id,
daemon_id: desired.daemon_id.clone(),
command: command.to_string(),
authority: desired.authority.clone(),
requested_at: now,
}),
deployment_request: None,
operator_alarm: None,
}
}
_ => {
let alarm_id = format!("alarm:{}:{}", desired.daemon_id, now);
let reason = format!(
"health is {}; no restart command authority is available",
health.state
);
IdunnPlan {
decision: decision(&decision_id, desired, "alarm", &reason, &now),
deployment_request: None,
restart_request: None,
operator_alarm: Some(IdunnOperatorAlarmRecord {
alarm_id,
daemon_id: desired.daemon_id.clone(),
severity: "operator-action-required".to_string(),
reason,
escalation_target: "bifrost.operator-notification".to_string(),
raised_at: now,
}),
}
}
}
}
fn is_healthy(state: &str) -> bool {
matches!(state, "active" | "healthy" | "ok" | "running")
}
fn decision(
decision_id: &str,
desired: &IdunnDesiredDaemonRecord,
action: &str,
reason: &str,
decided_at: &str,
) -> IdunnKeepaliveDecisionRecord {
IdunnKeepaliveDecisionRecord {
decision_id: decision_id.to_string(),
daemon_id: desired.daemon_id.clone(),
action: action.to_string(),
reason: reason.to_string(),
authority: desired.authority.clone(),
decided_at: decided_at.to_string(),
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::documents::{
IDUNN_COMMAND_BOUNDARY_SCHEMA, IDUNN_DAEMON_SURGERY_PLAN_SCHEMA,
IDUNN_DAEMON_TRANSPORT_PROFILE_SCHEMA, IDUNN_DEPLOYMENT_ARTIFACT_SCHEMA,
IDUNN_DESIRED_DAEMON_SCHEMA, IDUNN_RELEASE_TARGET_SCHEMA, IDUNN_ROLLOUT_PLAN_SCHEMA,
IDUNN_STATE_MIGRATION_PLAN_SCHEMA, IDUNN_SWARM_SURGERY_PLAN_SCHEMA,
IdunnCommandBoundaryRecord, IdunnDaemonSurgeryPlanRecord,
IdunnDaemonTransportProfileRecord, IdunnDeploymentArtifactRecord, IdunnReleaseTargetRecord,
IdunnRolloutPlanRecord, IdunnRuntimeTransportCheckRecord, IdunnStateMigrationPlanRecord,
IdunnSwarmSurgeryPlanRecord, OdinDocuments,
};
use anyhow::Result;
use cultmesh_rs::{CultMesh, CultMeshNodeOptions};
fn desired(restart_command: Option<&str>) -> IdunnDesiredDaemonRecord {
IdunnDesiredDaemonRecord {
daemon_id: "voidbot".to_string(),
verse_id: "local".to_string(),
name: "VoidBot".to_string(),
enabled: true,
health_command: None,
restart_command: restart_command.map(ToString::to_string),
authority: "idunn-supervisor-command".to_string(),
max_silence_seconds: 60,
observed_at: "2026-06-04T00:00:00Z".to_string(),
deploy_command: None,
health_contract: "test.cultnet-rudp-health".to_string(),
transport_profile_id: "transport:voidbot".to_string(),
command_boundary_id: "command-boundary:voidbot".to_string(),
}
}
fn health(state: &str) -> IdunnDaemonHealthRecord {
IdunnDaemonHealthRecord {
daemon_id: "voidbot".to_string(),
state: state.to_string(),
detail: "unit daemon publication".to_string(),
observed_at: "2026-06-04T00:00:01Z".to_string(),
health_contract: "test.cultnet-rudp-health".to_string(),
publication_source: "debug-command".to_string(),
transport: "debug.local-command".to_string(),
}
}
#[test]
fn healthy_daemon_is_observed_without_restart() {
let plan = plan_keepalive(
&desired(Some("npm start")),
&health("active"),
"2026-06-04T00:00:02Z",
);
assert_eq!(plan.decision.action, "observe");
assert!(plan.deployment_request.is_none());
assert!(plan.restart_request.is_none());
assert!(plan.operator_alarm.is_none());
}
#[test]
fn warming_daemon_is_observed_without_actuation_or_promotion() {
let mut desired = desired(Some("systemctl restart epiphany"));
desired.deploy_command = Some("deploy epiphany".to_string());
let plan = plan_keepalive(&desired, &health("warming"), "2026-07-17T00:00:02Z");
assert_eq!(plan.decision.action, "observe");
assert!(plan.decision.reason.contains("provider-owned progress"));
assert!(plan.deployment_request.is_none());
assert!(plan.restart_request.is_none());
assert!(plan.operator_alarm.is_none());
}
#[test]
fn unhealthy_daemon_with_restart_authority_requests_restart() {
let plan = plan_keepalive(
&desired(Some("npm start")),
&health("failed"),
"2026-06-04T00:00:02Z",
);
assert_eq!(plan.decision.action, "restart");
assert!(plan.deployment_request.is_none());
assert_eq!(plan.restart_request.unwrap().command, "npm start");
assert!(plan.operator_alarm.is_none());
}
#[test]
fn unhealthy_daemon_with_deploy_authority_requests_deployment_before_restart() {
let mut desired = desired(Some("systemctl restart gjallar"));
desired.deploy_command = Some("deploy gjallar".to_string());
let plan = plan_keepalive(
&desired,
&health("stale-deployment"),
"2026-06-04T00:00:02Z",
);
assert_eq!(plan.decision.action, "deploy");
assert_eq!(plan.deployment_request.unwrap().command, "deploy gjallar");
assert!(plan.restart_request.is_none());
assert!(plan.operator_alarm.is_none());
}
#[test]
fn failed_daemon_with_deploy_and_restart_authority_restarts_instead_of_redeploying() {
let mut desired = desired(Some("systemctl restart gjallar"));
desired.deploy_command = Some("deploy gjallar".to_string());
let plan = plan_keepalive(&desired, &health("failed"), "2026-06-04T00:00:02Z");
assert_eq!(plan.decision.action, "restart");
assert!(plan.deployment_request.is_none());
assert_eq!(
plan.restart_request.unwrap().command,
"systemctl restart gjallar"
);
assert!(plan.operator_alarm.is_none());
}
#[test]
fn dependency_unavailable_raises_alarm_instead_of_redeploying_or_restarting() {
let mut desired = desired(Some("systemctl restart gjallar"));
desired.deploy_command = Some("deploy gjallar".to_string());
let plan = plan_keepalive(
&desired,
&health("dependency-unavailable"),
"2026-06-04T00:00:02Z",
);
assert_eq!(plan.decision.action, "alarm");
assert!(plan.deployment_request.is_none());
assert!(plan.restart_request.is_none());
assert!(plan.operator_alarm.is_some());
}
#[test]
fn stale_deployment_without_deploy_authority_raises_alarm_instead_of_restarting() {
let plan = plan_keepalive(
&desired(Some("systemctl restart old-app")),
&health("stale-deployment"),
"2026-06-04T00:00:02Z",
);
assert_eq!(plan.decision.action, "alarm");
assert!(plan.deployment_request.is_none());
assert!(plan.restart_request.is_none());
assert!(plan.operator_alarm.is_some());
}
#[test]
fn unhealthy_daemon_without_authority_raises_operator_alarm() {
let plan = plan_keepalive(&desired(None), &health("failed"), "2026-06-04T00:00:02Z");
assert_eq!(plan.decision.action, "alarm");
assert!(plan.deployment_request.is_none());
assert!(plan.restart_request.is_none());
assert_eq!(
plan.operator_alarm.unwrap().escalation_target,
"bifrost.operator-notification"
);
}
#[test]
fn idunn_records_round_trip_through_cultmesh() -> Result<()> {
let temp = tempfile::tempdir()?;
let store_path = temp.path().join("idunn.cc");
let desired = desired(Some("npm start"));
let health = health("failed");
let plan = plan_keepalive(&desired, &health, "2026-06-04T00:00:02Z");
let request = plan.restart_request.unwrap();
let mut node = CultMesh::create_node(
&store_path,
OdinDocuments,
CultMeshNodeOptions {
runtime_id: "idunn-test".to_string(),
pull_on_start: true,
},
)?;
node.put(&desired.daemon_id, &desired)?;
node.put(&health.daemon_id, &health)?;
node.put(&plan.decision.decision_id, &plan.decision)?;
node.put(&request.request_id, &request)?;
let surgery_plan = IdunnDaemonSurgeryPlanRecord {
plan_id: "surgery:voidbot".to_string(),
daemon_id: "voidbot".to_string(),
severity: "high".to_string(),
status: "transport-surgery-required".to_string(),
owner: "VoidBot internal provider stack".to_string(),
objective: "Publish VoidBot internal daemon health over CultNet/RUDP".to_string(),
current_mechanism: "daemon-published RUDP health".to_string(),
intended_authority: "daemon-owned CultNet/RUDP health record".to_string(),
cut_line: "daemon health must be published over CultNet/RUDP".to_string(),
steps: vec![
"update CultLib".to_string(),
"publish RUDP health".to_string(),
],
blockers: vec!["runtime CultLib update".to_string()],
updated_at: "2026-06-04T00:00:02Z".to_string(),
};
let swarm_surgery_plan = IdunnSwarmSurgeryPlanRecord {
plan_id: "swarm-surgery:starfire-local".to_string(),
profile: "starfire-local".to_string(),
status: "active-transport-migration".to_string(),
owner: "Idunn swarm supervisor".to_string(),
objective: "Move daemon awareness to CultNet/RUDP".to_string(),
current_mechanism: "daemon-published RUDP health required".to_string(),
invariants: vec!["daemon truth is typed RUDP state".to_string()],
phases: vec!["install Muninn RUDP health".to_string()],
current_phase: "Phase 2".to_string(),
next_target: "starfire-muninn".to_string(),
cut_line: "daemon health must be published over CultNet/RUDP".to_string(),
verification_layer: "CultMesh keepalive store".to_string(),
updated_at: "2026-06-04T00:00:02Z".to_string(),
};
node.put(&swarm_surgery_plan.plan_id, &swarm_surgery_plan)?;
node.put(&surgery_plan.plan_id, &surgery_plan)?;
let transport_profile = IdunnDaemonTransportProfileRecord {
profile_id: "transport:voidbot".to_string(),
daemon_id: "voidbot".to_string(),
target_transport: "cultnet.transport.rudp.v0".to_string(),
current_transport: "missing-daemon-published-rudp-health".to_string(),
state: "migration-required".to_string(),
health_contract: "test.cultnet-rudp-health".to_string(),
publication_schema: "idunn.daemon_health.v1".to_string(),
debug_mechanism: "none".to_string(),
cut_line: "daemon health must be published over CultNet/RUDP".to_string(),
observed_at: "2026-06-04T00:00:02Z".to_string(),
};
node.put(&transport_profile.profile_id, &transport_profile)?;
let command_boundary = IdunnCommandBoundaryRecord {
boundary_id: "command-boundary:voidbot".to_string(),
daemon_id: "voidbot".to_string(),
owner: "idunn-supervisor-command-boundary".to_string(),
restart_authority: "idunn-supervisor-command.restart".to_string(),
deploy_authority: "none".to_string(),
health_authority: "daemon-published-rudp-health".to_string(),
alarm_authority: "bifrost.operator-notification".to_string(),
command_lowerings: vec!["npm start".to_string()],
forbidden_authority: "debug probes do not own truth".to_string(),
observed_at: "2026-06-04T00:00:02Z".to_string(),
};
node.put(&command_boundary.boundary_id, &command_boundary)?;
let release_target = IdunnReleaseTargetRecord {
target_id: "release-target:voidbot".to_string(),
daemon_id: "voidbot".to_string(),
repo: "VoidBot".to_string(),
repo_path: "E:\\Projects\\VoidBot".to_string(),
upstream_remote: "origin".to_string(),
upstream_branch: "main".to_string(),
desired_revision: "abc123".to_string(),
deployed_revision: "old123".to_string(),
artifact_strategy: "source-archive-from-upstream-main".to_string(),
rollout_strategy: "restart-after-verified-build".to_string(),
state_migration_authority: "daemon-owned-command".to_string(),
zero_downtime_capability: "restart-required".to_string(),
status: "tracked".to_string(),
observed_at: "2026-06-04T00:00:02Z".to_string(),
repository_full_name: "GameCult/VoidBot".to_string(),
upstream_ref: "refs/heads/main".to_string(),
release_authority_id: "release:GameCult/VoidBot:refs/heads/main:abc123".to_string(),
release_authority_envelope_sha256: "authority-sha".to_string(),
release_authority_status: "authorized".to_string(),
requires_bifrost_authority: true,
observed_upstream_revision: "abc123".to_string(),
minimum_source_revision: None,
};
let artifact = IdunnDeploymentArtifactRecord {
artifact_id: "artifact:voidbot:main".to_string(),
daemon_id: "voidbot".to_string(),
source_revision: "abc123".to_string(),
source_branch: "main".to_string(),
source_remote: "origin".to_string(),
artifact_kind: "source-archive-from-upstream-main".to_string(),
artifact_uri: "built-by-deploy-command".to_string(),
sha256: "pending-deploy-command".to_string(),
built_at: "2026-06-04T00:00:02Z".to_string(),
release_authority_id: release_target.release_authority_id.clone(),
release_authority_envelope_sha256: release_target
.release_authority_envelope_sha256
.clone(),
};
let migration_plan = IdunnStateMigrationPlanRecord {
plan_id: "migration:voidbot:main".to_string(),
daemon_id: "voidbot".to_string(),
from_schema_version: "deployed-state".to_string(),
to_schema_version: "target-revision-state".to_string(),
authority: "daemon-owned-migrator".to_string(),
command: "voidbot migrate-state".to_string(),
strategy: "backup-then-daemon-migrator".to_string(),
backup_required: true,
zero_downtime_required: false,
status: "planned".to_string(),
planned_at: "2026-06-04T00:00:02Z".to_string(),
};
let rollout_plan = IdunnRolloutPlanRecord {
plan_id: "rollout:voidbot:main".to_string(),
daemon_id: "voidbot".to_string(),
desired_revision: "abc123".to_string(),
deployed_revision: "old123".to_string(),
strategy: "restart-after-verified-build".to_string(),
phases: vec![
"fetch upstream main".to_string(),
"verify health".to_string(),
],
migration_plan_id: migration_plan.plan_id.clone(),
artifact_id: artifact.artifact_id.clone(),
status: "planned".to_string(),
planned_at: "2026-06-04T00:00:02Z".to_string(),
};
let release_payload = rmp_serde::to_vec(&release_target)?;
assert_eq!(&release_payload[..3], &[0xdc, 0, 22]);
let mut pre_floor_payload = release_payload.clone();
assert_eq!(pre_floor_payload.pop(), Some(0xc0));
pre_floor_payload[2] = 21;
assert!(
rmp_serde::from_slice::<IdunnReleaseTargetRecord>(&pre_floor_payload).is_err(),
"release-target v3 must not decode a pre-floor positional body"
);
node.put(&release_target.target_id, &release_target)?;
node.put(&artifact.artifact_id, &artifact)?;
node.put(&migration_plan.plan_id, &migration_plan)?;
node.put(&rollout_plan.plan_id, &rollout_plan)?;
let runtime_check = IdunnRuntimeTransportCheckRecord {
check_id: "idunn-runtime-rudp-loopback".to_string(),
runtime_id: "idunn-daemon".to_string(),
transport: "cultnet.transport.rudp.v0".to_string(),
state: "available".to_string(),
detail: "loopback acknowledged".to_string(),
observed_at: "2026-06-04T00:00:02Z".to_string(),
};
node.put(&runtime_check.check_id, &runtime_check)?;
let reloaded = CultMesh::create_node(
&store_path,
OdinDocuments,
CultMeshNodeOptions {
runtime_id: "idunn-test-reloaded".to_string(),
pull_on_start: true,
},
)?;
assert_eq!(
reloaded
.documents()
.binding("idunn.desired_daemon")
.and_then(|binding| binding.payload_schema_version.clone())
.as_deref(),
Some(IDUNN_DESIRED_DAEMON_SCHEMA)
);
assert_eq!(
reloaded
.documents()
.binding("idunn.swarm_surgery_plan")
.and_then(|binding| binding.payload_schema_version.clone())
.as_deref(),
Some(IDUNN_SWARM_SURGERY_PLAN_SCHEMA)
);
assert_eq!(
reloaded
.documents()
.binding("idunn.daemon_surgery_plan")
.and_then(|binding| binding.payload_schema_version.clone())
.as_deref(),
Some(IDUNN_DAEMON_SURGERY_PLAN_SCHEMA)
);
assert_eq!(
reloaded
.documents()
.binding("idunn.daemon_transport_profile")
.and_then(|binding| binding.payload_schema_version.clone())
.as_deref(),
Some(IDUNN_DAEMON_TRANSPORT_PROFILE_SCHEMA)
);
assert_eq!(
reloaded
.documents()
.binding("idunn.command_boundary")
.and_then(|binding| binding.payload_schema_version.clone())
.as_deref(),
Some(IDUNN_COMMAND_BOUNDARY_SCHEMA)
);
assert_eq!(
reloaded
.documents()
.binding("idunn.release_target")
.and_then(|binding| binding.payload_schema_version.clone())
.as_deref(),
Some(IDUNN_RELEASE_TARGET_SCHEMA)
);
assert_eq!(
reloaded
.documents()
.binding("idunn.deployment_artifact")
.and_then(|binding| binding.payload_schema_version.clone())
.as_deref(),
Some(IDUNN_DEPLOYMENT_ARTIFACT_SCHEMA)
);
assert_eq!(
reloaded
.documents()
.binding("idunn.state_migration_plan")
.and_then(|binding| binding.payload_schema_version.clone())
.as_deref(),
Some(IDUNN_STATE_MIGRATION_PLAN_SCHEMA)
);
assert_eq!(
reloaded
.documents()
.binding("idunn.rollout_plan")
.and_then(|binding| binding.payload_schema_version.clone())
.as_deref(),
Some(IDUNN_ROLLOUT_PLAN_SCHEMA)
);
let reloaded_desired =
reloaded.get_required::<IdunnDesiredDaemonRecord>(&desired.daemon_id)?;
assert_eq!(reloaded_desired.transport_profile_id, "transport:voidbot");
assert_eq!(
reloaded_desired.command_boundary_id,
"command-boundary:voidbot"
);
assert_eq!(
reloaded
.get_required::<IdunnKeepaliveDecisionRecord>(&plan.decision.decision_id)?
.action,
"restart"
);
assert_eq!(
reloaded
.get_required::<IdunnSwarmSurgeryPlanRecord>(&swarm_surgery_plan.plan_id)?
.next_target,
"starfire-muninn"
);
assert_eq!(
reloaded
.get_required::<IdunnDaemonSurgeryPlanRecord>(&surgery_plan.plan_id)?
.cut_line,
"daemon health must be published over CultNet/RUDP"
);
assert_eq!(
reloaded
.get_required::<IdunnDaemonTransportProfileRecord>(&transport_profile.profile_id)?
.target_transport,
"cultnet.transport.rudp.v0"
);
assert_eq!(
reloaded
.get_required::<IdunnCommandBoundaryRecord>(&command_boundary.boundary_id)?
.health_authority,
"daemon-published-rudp-health"
);
assert_eq!(
reloaded
.get_required::<IdunnRuntimeTransportCheckRecord>(&runtime_check.check_id)?
.state,
"available"
);
assert_eq!(
reloaded
.get_required::<IdunnReleaseTargetRecord>(&release_target.target_id)?
.upstream_branch,
"main"
);
assert_eq!(
reloaded
.get_required::<IdunnRolloutPlanRecord>(&rollout_plan.plan_id)?
.migration_plan_id,
"migration:voidbot:main"
);
assert_eq!(
reloaded
.get_required::<IdunnRestartRequestRecord>(&request.request_id)?
.command,
"npm start"
);
Ok(())
}
}

View file

@ -1,13 +1,11 @@
pub mod discovery;
pub mod documents;
pub mod idunn;
pub mod pipeline;
pub mod ports;
pub mod repository;
pub use discovery::*;
pub use documents::*;
pub use idunn::*;
pub use pipeline::*;
pub use ports::*;
pub use repository::*;

View file

@ -46,35 +46,24 @@ The first Rust core lives in `crates/odin-core`:
- `repository.rs`: `OdinRepository` abstraction, in-memory mock repository, and
CultMesh-backed repository.
The Rust spine owns the future architecture. The CommonJS daemon remains the
legacy operational body until each organ crosses this typed boundary.
The deployed body is `crates/odin-daemon`, built and run by Idunn from
`deployment/idunn/recipe.toml`. `crates/odin-core` holds the typed record spine
that the rest of the machine grows into.
## Runtime Body
Odin's executable body is split by ownership:
- `crates/odin-core`: Rust target core. Owns typed Odin documents, ingest
ports, normalization, and CultMesh/CultCache repository boundaries. This is
the replacement spine; JavaScript remains legacy runtime scaffolding until
each organ has crossed the typed boundary.
- `src/odin-coordinator.cjs`: process lifecycle, serialized refresh loop,
persistence, health, and transport wiring. Refreshes must not overlap because
a refresh publishes Odin's daemon health.
- `src/odin/config.cjs`: runtime paths, refresh intervals, and CultLib module path setup.
- `src/odin/documents.cjs`: CultCache/CultMesh document definitions accepted by Odin.
- `src/odin/idunn-rudp.cjs`: daemon-owned Odin provider health publication to
Idunn over the canonical CultNet RUDP `schema` channel.
- `src/odin/probes.cjs`: local Docker/ADB debug lowerings for Starfire and
Android edge visibility. Remote Verse health is not probed here; it comes
from provider-owned CultMesh/CultNet records.
- `src/odin/interfaces.cjs`: provider advertisements, CultMesh interface
bindings, accepted interface projection, and renderer-lowering metadata.
Renderer routes are lowerings outside Odin, not Odin-hosted transport.
- `src/odin/layout.cjs`: `odin.interface_layout.v1` read/write and merge policy.
- `src/odin/marquee.cjs`: canonical marquee tape assembly from Stonks securities and ordered VoidBot poem lines.
- `src/odin/surface.cjs`: `gamecult.eve.surface.v1` tree projection.
- `src/odin/state.cjs`: one refresh's input records into Odin's provider catalog/proxy state.
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.
- `crates/odin-daemon`: the deployed process. Reads Idunn's read-only topology
projection, admits provider presences over RUDP for the incarnations Idunn
projects, persists them through CultMesh/CultCache, publishes signed
runtime-topology correlation records, and answers CultNet/RUDP snapshot and
document requests. Deployment, restart, and survival of this process are
Idunn's.
- `crates/odin-core`: typed Odin documents, ingest ports, normalization, and
CultMesh/CultCache repository boundaries.
If a new owner is needed, name the owner and its invariant before adding code.
The accepted document registry is also the persistence admission boundary.
Unknown schemas may be observed for diagnostics but are not silently persisted
@ -94,19 +83,15 @@ the typed `gjallar.overview` Eve surface. Eve clients own graphical, terminal,
and framebuffer lowering. Gjallar must not own the underlying registry, probe,
provider truth, client pixels, 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
Odin-owned service records and provider advertisements, then bring daemons up
after reboots or crashes, watch health, emit keepalive observations, restart
requests, denied-action records, and operator alarms. When human action is
needed, Idunn uses CultMesh to request a Bifrost-owned operator
notification crossing. VoidBot's `voidbot.operator-dm` command `owner.dm.send`
is a demoted compatibility delivery actuator, not the owner. The target command
lives in Bifrost's Verse; any still-VoidBot delivery path must be invoked by
Bifrost or documented as migration debt. Idunn must not own Verse discovery,
schema truth, provider dashboards, identity grants, Discord delivery, owner-DM
delivery, or renderer layout. Keepalive loops belong in Idunn, not Odin's
coordinator or individual daemons.
Idunn (`GameCult/Idunn`) owns deployment and daemon survival, including Odin's.
It builds from each target's recipe, activates and restarts the admitted
incarnation, and holds the deployment and lifecycle brakes. Odin publishes what
it can see and reads Idunn's topology projection; it does not start, restart,
deploy, or health-probe any daemon, and no Odin code path keeps a process alive.
When human action is needed, Idunn uses CultMesh to request a Bifrost-owned
operator notification crossing. Idunn must not own Verse discovery, schema
truth, provider dashboards, identity grants, Discord delivery, owner-DM
delivery, or renderer layout.
Muninn is the portable local telemetry Verse assembler. Its Rust body lives in
the `GameCult/Muninn` repository and publishes `muninn.telemetry_surface.v1`
@ -213,19 +198,10 @@ This is not a reporting nicety. It is how Odin prevents services from becoming
private little islands with separate websites, dashboards, state formats, and
separate command languages.
## Current Service Surface
## Service Surface
Odin currently publishes service squares for:
- Starfire: Odin, Docker, ADB, Odin CultCache, and running Docker containers.
- Nightwing: SSH, Eve broker, Eve browser reference, visible TUI, Docker unit state, and NVIDIA GPU state.
- EVE: SSH/native Eve reachability.
- Periwinkle: ADB reachability.
- Periwinkle: local ADB edge status plus any provider-owned surface or advertisement Odin receives through CultMesh/Odin discovery.
- Raven: SSH reachability.
- Yggdrasil: compatibility host reachability plus nginx,
StreamPixels, Heimdall, Repixelizer, and Bifrost systemd state until those
daemon surfaces publish health and command boundaries over CultNet RUDP.
Odin's service records come from provider-owned presences and advertisements
received through CultMesh/RUDP, not from host probes.
Gjallar consumes Odin's accepted CultMesh/Eve state and composes every visible
provider surface into one typed aggregate on Yggdrasil. EveCanvas, browser, and
@ -250,8 +226,8 @@ interactive language; they are not separate dashboard products. Huginn's `.cc`
inspection surface is the current clean example: Huginn inspects CultCache bytes
and emits Eve DSL, while Eve or any other runtime owns presentation.
Provider advertisements are the promotion path out of probing. Odin's CJS
document set already accepts `gamecult.eve.provider_advertisement.v1` alongside
Provider advertisements are the promotion path out of probing. Odin's document
registry already accepts `gamecult.eve.provider_advertisement.v1` alongside
`gamecult.eve.interface_binding.v1` and `gamecult.eve.surface_state.v1`.
Daemons should publish advertisements that name service id, Verse id, schema
catalog, `.cc` witnesses, Eve surface keys, command boundaries, nested Verses,
@ -290,18 +266,6 @@ identity.
The canonical contract lives in
`E:\Projects\Eve\docs\provider-advertisement-contract.md`.
Odin persists operator layout intent as `odin.interface_layout.v1` in the Odin CultMesh store under record key `odin.providers`. The ignored `scratch/odin/interface-layout.json` file is migration input only; Odin no longer writes layout truth back to that sidecar. Layout intents name the provider id and request focus, move, resize, or visibility changes; renderers are input devices for those intents, not local layout owners.
Odin now derives dense top-level layout intent from each provider's retained
`surface.root` tree: element count, leaf count, branch count, depth, text-cell
pressure, and list-like branches. Provider explicit preferred sizes are capped
at the Odin wrapper boundary unless the current intent is fullscreen, so stale
layout files cannot keep empty panels huge. The renderer should use
`props.tree`, `props.layout.signalWeight`, and `props.packing` to allocate space
to nested signal, then recursively lower provider children. Flattening a
provider surface into one log/list is a compatibility failure when the retained
tree has children.
## Observation Surface
Odin no longer tails Mimir JSONL artifacts for observation truth. Device and

View file

@ -7,12 +7,7 @@
"scripts": {
"gjallar:persona": "node scripts/write-gjallar-persona-cc.mjs inspect",
"gjallar:persona:write": "node scripts/write-gjallar-persona-cc.mjs write",
"muninn:build": "cargo build -p muninn-daemon",
"muninn:start": "cargo run -p muninn-daemon --",
"rust:test": "cargo test --workspace",
"check": "node scripts/check-syntax.cjs",
"test": "node --test test/*.test.cjs",
"start": "node src/odin-coordinator.cjs"
"rust:test": "cargo test --workspace"
},
"engines": {
"node": ">=20"

View file

@ -1,34 +0,0 @@
#!/usr/bin/env node
"use strict";
const fs = require("fs");
const path = require("path");
const { spawnSync } = require("child_process");
const repoRoot = path.resolve(__dirname, "..");
const files = [];
collect(path.join(repoRoot, "src"));
for (const file of files) {
const result = spawnSync(process.execPath, ["--check", file], {
cwd: repoRoot,
encoding: "utf8",
});
if (result.stdout) process.stdout.write(result.stdout);
if (result.stderr) process.stderr.write(result.stderr);
if (result.status !== 0) process.exit(result.status);
}
console.log(`Checked ${files.length} CommonJS files.`);
function collect(directory) {
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
const fullPath = path.join(directory, entry.name);
if (entry.isDirectory()) {
collect(fullPath);
} else if (entry.isFile() && entry.name.endsWith(".cjs")) {
files.push(fullPath);
}
}
}

View file

@ -1,10 +0,0 @@
@echo off
if not "%IDUNN_ACTUATOR%"=="1" (
echo This deployment wrapper is an Idunn actuator. Configure Idunn; do not deploy manually.
exit /b 1
)
if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
echo This deployment wrapper is an Idunn actuator. Configure Idunn; do not deploy manually.
exit /b 1
)
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0deploy-yggdrasil-heimdall.ps1

View file

@ -1,156 +0,0 @@
param(
[string] $SshTarget = "yggdrasil",
[string] $RepoRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "Heimdall"),
[string] $CultLibRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "CultLib"),
[string] $AppUser = "heimdall",
[string] $RemoteAppHome = "/srv/heimdall",
[string] $RemoteTarballName = "heimdall-source.tar",
[string] $RemoteCultLibTarballName = "heimdall-cultlib.tar",
[string] $DeployScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\deploy-heimdall.sh"),
[string] $CheckScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\check-heimdall.sh"),
[string] $UpstreamRemote = "origin",
[string] $UpstreamBranch = "main",
[string] $CultLibUpstreamRemote = "origin",
[string] $CultLibUpstreamBranch = "main"
)
$ErrorActionPreference = "Stop"
if ($env:IDUNN_ACTUATOR -ne "1" -or $env:IDUNN_COMMAND_AUTHORITY -ne "idunn-daemon") {
throw "This deployment script is an Idunn actuator. Agents must configure Idunn release targets and let Idunn run deployment; do not invoke deploy scripts manually."
}
foreach ($path in @($RepoRoot, $CultLibRoot, $DeployScript, $CheckScript)) {
if (-not (Test-Path -LiteralPath $path)) {
throw "Required path not found: $path"
}
}
$sourceRef = "$UpstreamRemote/$UpstreamBranch"
$cultLibSourceRef = "$CultLibUpstreamRemote/$CultLibUpstreamBranch"
git -C $RepoRoot fetch --prune $UpstreamRemote $UpstreamBranch
if ($LASTEXITCODE -ne 0) { throw "git fetch failed for $RepoRoot $sourceRef" }
git -C $CultLibRoot fetch --prune $CultLibUpstreamRemote $CultLibUpstreamBranch
if ($LASTEXITCODE -ne 0) { throw "git fetch failed for $CultLibRoot $cultLibSourceRef" }
$heimdallCommit = (git -C $RepoRoot rev-parse $sourceRef).Trim()
if ([string]::IsNullOrWhiteSpace($heimdallCommit)) {
throw "Could not determine Heimdall git revision."
}
$cultLibCommit = (git -C $CultLibRoot rev-parse $cultLibSourceRef).Trim()
if ([string]::IsNullOrWhiteSpace($cultLibCommit)) {
throw "Could not determine CultLib git revision."
}
$scratch = Join-Path (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\idunn-deploy") "yggdrasil-heimdall"
$sourceTarPath = Join-Path $scratch $RemoteTarballName
$cultLibTarPath = Join-Path $scratch $RemoteCultLibTarballName
$manifestPath = Join-Path $scratch "deployment-manifest.txt"
New-Item -ItemType Directory -Force -Path $scratch | Out-Null
git -C $RepoRoot archive --format=tar --output=$sourceTarPath $sourceRef
if ($LASTEXITCODE -ne 0) {
throw "git archive failed for $RepoRoot $sourceRef"
}
if (Test-Path -LiteralPath $cultLibTarPath) {
Remove-Item -LiteralPath $cultLibTarPath -Force
}
git -C $CultLibRoot archive --format=tar --output=$cultLibTarPath $cultLibSourceRef packages/cultnet-ts packages/cultcache-ts
if ($LASTEXITCODE -ne 0) {
throw "CultLib tar build failed for $CultLibRoot $cultLibSourceRef"
}
$sourceHash = (Get-FileHash $sourceTarPath -Algorithm SHA256).Hash.ToLowerInvariant()
$cultLibHash = (Get-FileHash $cultLibTarPath -Algorithm SHA256).Hash.ToLowerInvariant()
$deployedAt = [DateTimeOffset]::UtcNow.ToString("O")
@(
"schema=gamecult.idunn.deployment_manifest.v1"
"appId=yggdrasil-heimdall"
"repoRoot=$RepoRoot"
"upstreamRemote=$UpstreamRemote"
"upstreamBranch=$UpstreamBranch"
"sourceRef=$sourceRef"
"gitCommit=$heimdallCommit"
"artifact=$RemoteTarballName"
"sha256=$sourceHash"
"cultLibRepoRoot=$CultLibRoot"
"cultLibUpstreamRemote=$CultLibUpstreamRemote"
"cultLibUpstreamBranch=$CultLibUpstreamBranch"
"cultLibSourceRef=$cultLibSourceRef"
"cultLibGitCommit=$cultLibCommit"
"cultLibArtifact=$RemoteCultLibTarballName"
"cultLibSha256=$cultLibHash"
"deployedAtUtc=$deployedAt"
) | Set-Content -Encoding ASCII -LiteralPath $manifestPath
$remoteDeploy = "/home/gamecultadmin/$([IO.Path]::GetFileName($DeployScript))"
$remoteCheck = "/home/gamecultadmin/$([IO.Path]::GetFileName($CheckScript))"
$remoteSourceTarball = "/home/gamecultadmin/$RemoteTarballName"
$remoteCultLibTarball = "/home/gamecultadmin/$RemoteCultLibTarballName"
$remoteManifest = "/home/gamecultadmin/yggdrasil-heimdall-deployment-manifest.txt"
$remoteRunner = "/home/gamecultadmin/run-yggdrasil-heimdall-deploy.sh"
$targetSourceTarball = "$RemoteAppHome/$RemoteTarballName"
$targetCultLibTarball = "$RemoteAppHome/$RemoteCultLibTarballName"
$targetManifest = "$RemoteAppHome/deployment-manifest.txt"
$sftpBatchPath = Join-Path $scratch "yggdrasil-heimdall-upload.sftp"
$runnerPath = Join-Path $scratch "run-yggdrasil-heimdall-deploy.sh"
$runnerScript = @"
#!/usr/bin/env bash
set -euo pipefail
sudo -n install -d -o '$AppUser' -g '$AppUser' '$RemoteAppHome'
sudo -n install -o '$AppUser' -g '$AppUser' -m 600 '$remoteSourceTarball' '$targetSourceTarball'
sudo -n install -o '$AppUser' -g '$AppUser' -m 600 '$remoteCultLibTarball' '$targetCultLibTarball'
sudo -n install -m 644 '$remoteManifest' '$targetManifest'
chmod +x '$remoteDeploy' '$remoteCheck'
sudo -n env GAMECULT_IDUNN_REMOTE_ACTUATOR=1 IDUNN_COMMAND_AUTHORITY=idunn-daemon bash '$remoteDeploy'
check_ok=0
for i in `$(seq 1 30); do
if sudo -n bash '$remoteCheck'; then
check_ok=1
break
fi
sleep 2
done
if [ "`$check_ok" -ne 1 ]; then
sudo -n bash '$remoteCheck'
exit 1
fi
"@.Replace("`r`n", "`n")
[System.IO.File]::WriteAllText($runnerPath, $runnerScript, [System.Text.Encoding]::ASCII)
@(
"put ""$sourceTarPath"" ""$remoteSourceTarball"""
"put ""$cultLibTarPath"" ""$remoteCultLibTarball"""
"put ""$DeployScript"" ""$remoteDeploy"""
"put ""$CheckScript"" ""$remoteCheck"""
"put ""$manifestPath"" ""$remoteManifest"""
"put ""$runnerPath"" ""$remoteRunner"""
) | Set-Content -Encoding ASCII -LiteralPath $sftpBatchPath
try {
& sftp.exe -b $sftpBatchPath $SshTarget
if ($LASTEXITCODE -ne 0) {
throw "sftp upload failed for yggdrasil-heimdall"
}
& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $SshTarget "chmod +x '$remoteRunner' && bash '$remoteRunner'"
$remoteExit = $LASTEXITCODE
& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $SshTarget "rm -f '$remoteRunner'"
if ($remoteExit -ne 0) {
throw "remote deploy/check failed for yggdrasil-heimdall"
}
}
finally {
Remove-Item -LiteralPath $runnerPath -Force -ErrorAction SilentlyContinue
Remove-Item -LiteralPath $sftpBatchPath -Force -ErrorAction SilentlyContinue
}
Write-Host "yggdrasil-heimdall deployed with CultLib snapshot."
Write-Host " heimdallCommit=$heimdallCommit"
Write-Host " cultLibCommit=$cultLibCommit"
Write-Host " artifactSha256=$sourceHash"
Write-Host " cultLibSha256=$cultLibHash"

View file

@ -1,10 +0,0 @@
@echo off
if not "%IDUNN_ACTUATOR%"=="1" (
echo This deployment wrapper is an Idunn actuator. Configure Idunn; do not deploy manually.
exit /b 1
)
if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
echo This deployment wrapper is an Idunn actuator. Configure Idunn; do not deploy manually.
exit /b 1
)
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0deploy-yggdrasil-repixelizer.ps1

View file

@ -1,161 +0,0 @@
param(
[string] $SshTarget = "yggdrasil",
[string] $RepoRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "repixelizer"),
[string] $CultLibRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "CultLib"),
[string] $AppUser = "repixelizer",
[string] $RemoteAppHome = "/srv/repixelizer",
[string] $RemoteTarballName = "repixelizer-source.tar",
[string] $RemoteCultLibTarballName = "repixelizer-cultlib.tar",
[string] $DeployScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\deploy-repixelizer-gui.sh"),
[string] $CheckScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\check-repixelizer-gui.sh"),
[string] $UpstreamRemote = "origin",
[string] $UpstreamBranch = "main",
[string] $CultLibUpstreamRemote = "origin",
[string] $CultLibUpstreamBranch = "main"
)
$ErrorActionPreference = "Stop"
if ($env:IDUNN_ACTUATOR -ne "1" -or $env:IDUNN_COMMAND_AUTHORITY -ne "idunn-daemon") {
throw "This deployment script is an Idunn actuator. Agents must configure Idunn release targets and let Idunn run deployment; do not invoke deploy scripts manually."
}
foreach ($path in @($RepoRoot, $CultLibRoot, $DeployScript, $CheckScript)) {
if (-not (Test-Path -LiteralPath $path)) {
throw "Required path not found: $path"
}
}
$sourceRef = "$UpstreamRemote/$UpstreamBranch"
$cultLibSourceRef = "$CultLibUpstreamRemote/$CultLibUpstreamBranch"
git -C $RepoRoot fetch --prune $UpstreamRemote $UpstreamBranch
if ($LASTEXITCODE -ne 0) { throw "git fetch failed for $RepoRoot $sourceRef" }
git -C $CultLibRoot fetch --prune $CultLibUpstreamRemote $CultLibUpstreamBranch
if ($LASTEXITCODE -ne 0) { throw "git fetch failed for $CultLibRoot $cultLibSourceRef" }
$repixelizerCommit = (git -C $RepoRoot rev-parse $sourceRef).Trim()
if ([string]::IsNullOrWhiteSpace($repixelizerCommit)) {
throw "Could not determine Repixelizer git revision."
}
$cultLibCommit = (git -C $CultLibRoot rev-parse $cultLibSourceRef).Trim()
if ([string]::IsNullOrWhiteSpace($cultLibCommit)) {
throw "Could not determine CultLib git revision."
}
$scratch = Join-Path (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\idunn-deploy") "yggdrasil-repixelizer"
$sourceTarPath = Join-Path $scratch $RemoteTarballName
$cultLibTarPath = Join-Path $scratch $RemoteCultLibTarballName
$manifestPath = Join-Path $scratch "deployment-manifest.txt"
New-Item -ItemType Directory -Force -Path $scratch | Out-Null
git -C $RepoRoot archive --format=tar --output=$sourceTarPath $sourceRef
if ($LASTEXITCODE -ne 0) {
throw "git archive failed for $RepoRoot $sourceRef"
}
if (Test-Path -LiteralPath $cultLibTarPath) {
Remove-Item -LiteralPath $cultLibTarPath -Force
}
# All three Python packages. CultLib split packages/cultcache-py into
# cultcache-py / cultnet-py / cultmesh-py; module names did not change, so
# archiving only the first still succeeds and ships an incomplete library
# that fails later as an ImportError, far from this line.
git -C $CultLibRoot archive --format=tar --output=$cultLibTarPath $cultLibSourceRef packages/cultcache-py packages/cultnet-py packages/cultmesh-py
if ($LASTEXITCODE -ne 0) {
throw "CultLib tar build failed for $CultLibRoot $cultLibSourceRef"
}
$sourceHash = (Get-FileHash $sourceTarPath -Algorithm SHA256).Hash.ToLowerInvariant()
$cultLibHash = (Get-FileHash $cultLibTarPath -Algorithm SHA256).Hash.ToLowerInvariant()
$deployedAt = [DateTimeOffset]::UtcNow.ToString("O")
@(
"schema=gamecult.idunn.deployment_manifest.v1"
"appId=yggdrasil-repixelizer"
"repoRoot=$RepoRoot"
"upstreamRemote=$UpstreamRemote"
"upstreamBranch=$UpstreamBranch"
"sourceRef=$sourceRef"
"gitCommit=$repixelizerCommit"
"artifact=$RemoteTarballName"
"sha256=$sourceHash"
"cultLibRepoRoot=$CultLibRoot"
"cultLibUpstreamRemote=$CultLibUpstreamRemote"
"cultLibUpstreamBranch=$CultLibUpstreamBranch"
"cultLibSourceRef=$cultLibSourceRef"
"cultLibGitCommit=$cultLibCommit"
"cultLibArtifact=$RemoteCultLibTarballName"
"cultLibSha256=$cultLibHash"
"deployedAtUtc=$deployedAt"
) | Set-Content -Encoding ASCII -LiteralPath $manifestPath
$remoteDeploy = "/home/gamecultadmin/$([IO.Path]::GetFileName($DeployScript))"
$remoteCheck = "/home/gamecultadmin/$([IO.Path]::GetFileName($CheckScript))"
$remoteSourceTarball = "/home/gamecultadmin/$RemoteTarballName"
$remoteCultLibTarball = "/home/gamecultadmin/$RemoteCultLibTarballName"
$remoteManifest = "/home/gamecultadmin/yggdrasil-repixelizer-deployment-manifest.txt"
$remoteRunner = "/home/gamecultadmin/run-yggdrasil-repixelizer-deploy.sh"
$targetSourceTarball = "$RemoteAppHome/$RemoteTarballName"
$targetCultLibTarball = "$RemoteAppHome/$RemoteCultLibTarballName"
$targetManifest = "$RemoteAppHome/deployment-manifest.txt"
$sftpBatchPath = Join-Path $scratch "yggdrasil-repixelizer-upload.sftp"
$runnerPath = Join-Path $scratch "run-yggdrasil-repixelizer-deploy.sh"
$runnerScript = @"
#!/usr/bin/env bash
set -euo pipefail
sudo -n install -d -o '$AppUser' -g '$AppUser' '$RemoteAppHome'
sudo -n install -o '$AppUser' -g '$AppUser' -m 600 '$remoteSourceTarball' '$targetSourceTarball'
sudo -n install -o '$AppUser' -g '$AppUser' -m 600 '$remoteCultLibTarball' '$targetCultLibTarball'
sudo -n install -m 644 '$remoteManifest' '$targetManifest'
chmod +x '$remoteDeploy' '$remoteCheck'
sudo -n env GAMECULT_IDUNN_REMOTE_ACTUATOR=1 IDUNN_COMMAND_AUTHORITY=idunn-daemon bash '$remoteDeploy'
check_ok=0
for i in `$(seq 1 30); do
if sudo -n bash '$remoteCheck'; then
check_ok=1
break
fi
sleep 2
done
if [ "`$check_ok" -ne 1 ]; then
sudo -n bash '$remoteCheck'
exit 1
fi
"@.Replace("`r`n", "`n")
[System.IO.File]::WriteAllText($runnerPath, $runnerScript, [System.Text.Encoding]::ASCII)
@(
"put ""$sourceTarPath"" ""$remoteSourceTarball"""
"put ""$cultLibTarPath"" ""$remoteCultLibTarball"""
"put ""$DeployScript"" ""$remoteDeploy"""
"put ""$CheckScript"" ""$remoteCheck"""
"put ""$manifestPath"" ""$remoteManifest"""
"put ""$runnerPath"" ""$remoteRunner"""
) | Set-Content -Encoding ASCII -LiteralPath $sftpBatchPath
try {
& sftp.exe -b $sftpBatchPath $SshTarget
if ($LASTEXITCODE -ne 0) {
throw "sftp upload failed for yggdrasil-repixelizer"
}
& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $SshTarget "chmod +x '$remoteRunner' && bash '$remoteRunner'"
$remoteExit = $LASTEXITCODE
& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $SshTarget "rm -f '$remoteRunner'"
if ($remoteExit -ne 0) {
throw "remote deploy/check failed for yggdrasil-repixelizer"
}
}
finally {
Remove-Item -LiteralPath $runnerPath -Force -ErrorAction SilentlyContinue
Remove-Item -LiteralPath $sftpBatchPath -Force -ErrorAction SilentlyContinue
}
Write-Host "yggdrasil-repixelizer deployed with CultLib snapshot."
Write-Host " repixelizerCommit=$repixelizerCommit"
Write-Host " cultLibCommit=$cultLibCommit"
Write-Host " artifactSha256=$sourceHash"
Write-Host " cultLibSha256=$cultLibHash"

View file

@ -1,137 +0,0 @@
param(
[Parameter(Mandatory = $true)] [string] $AppId,
[Parameter(Mandatory = $true)] [string] $RepoRoot,
[Parameter(Mandatory = $true)] [string] $AppUser,
[Parameter(Mandatory = $true)] [string] $RemoteAppHome,
[Parameter(Mandatory = $true)] [string] $RemoteTarballName,
[Parameter(Mandatory = $true)] [string] $DeployScript,
[Parameter(Mandatory = $true)] [string] $CheckScript,
[string] $SshTarget = "yggdrasil",
[string] $UpstreamRemote = "origin",
[string] $UpstreamBranch = "main",
[string] $StateMigrationScript = ""
)
$ErrorActionPreference = "Stop"
if ($env:IDUNN_ACTUATOR -ne "1") {
throw "This deployment script is an Idunn actuator. Agents must configure Idunn release targets and let Idunn run deployment; do not invoke deploy scripts manually."
}
if (-not (Test-Path -LiteralPath $RepoRoot)) {
throw "Repo root not found: $RepoRoot"
}
if (-not (Test-Path -LiteralPath $DeployScript)) {
throw "Deploy script not found: $DeployScript"
}
if (-not (Test-Path -LiteralPath $CheckScript)) {
throw "Check script not found: $CheckScript"
}
if (-not [string]::IsNullOrWhiteSpace($StateMigrationScript) -and -not (Test-Path -LiteralPath $StateMigrationScript)) {
throw "State migration script not found: $StateMigrationScript"
}
git -C $RepoRoot fetch --prune $UpstreamRemote $UpstreamBranch
if ($LASTEXITCODE -ne 0) {
throw "git fetch failed for $RepoRoot $UpstreamRemote/$UpstreamBranch"
}
$sourceRef = "$UpstreamRemote/$UpstreamBranch"
$commit = (git -C $RepoRoot rev-parse $sourceRef).Trim()
if ([string]::IsNullOrWhiteSpace($commit)) {
throw "Could not determine git revision for $RepoRoot $sourceRef"
}
$scratch = Join-Path (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\idunn-deploy") $AppId
$tarPath = Join-Path $scratch $RemoteTarballName
$manifestPath = Join-Path $scratch "deployment-manifest.txt"
New-Item -ItemType Directory -Force -Path $scratch | Out-Null
git -C $RepoRoot archive --format=tar --output=$tarPath $sourceRef
if ($LASTEXITCODE -ne 0) {
throw "git archive failed for $RepoRoot $sourceRef"
}
$hash = (Get-FileHash $tarPath -Algorithm SHA256).Hash.ToLowerInvariant()
$deployedAt = [DateTimeOffset]::UtcNow.ToString("O")
@(
"schema=gamecult.idunn.deployment_manifest.v1"
"appId=$AppId"
"repoRoot=$RepoRoot"
"upstreamRemote=$UpstreamRemote"
"upstreamBranch=$UpstreamBranch"
"sourceRef=$sourceRef"
"gitCommit=$commit"
"artifact=$RemoteTarballName"
"sha256=$hash"
"deployedAtUtc=$deployedAt"
) | Set-Content -Encoding ASCII -LiteralPath $manifestPath
$remoteDeploy = "/home/gamecultadmin/$([IO.Path]::GetFileName($DeployScript))"
$remoteCheck = "/home/gamecultadmin/$([IO.Path]::GetFileName($CheckScript))"
$remoteMigration = if ([string]::IsNullOrWhiteSpace($StateMigrationScript)) { "" } else { "/home/gamecultadmin/$([IO.Path]::GetFileName($StateMigrationScript))" }
$remoteTarball = "/home/gamecultadmin/$RemoteTarballName"
$remoteManifest = "/home/gamecultadmin/$AppId-deployment-manifest.txt"
$remoteRunner = "/home/gamecultadmin/run-$AppId-deploy.sh"
$targetTarball = "$RemoteAppHome/$RemoteTarballName"
$targetManifest = "$RemoteAppHome/deployment-manifest.txt"
$sshArgs = @("-o", "BatchMode=yes", "-o", "ConnectTimeout=10", $SshTarget)
$scpArgs = @("-o", "BatchMode=yes", "-o", "ConnectTimeout=10")
$runnerPath = Join-Path $scratch "run-$AppId-deploy.sh"
$runnerScript = @"
#!/usr/bin/env bash
set -euo pipefail
sudo -n install -d -o '$AppUser' -g '$AppUser' '$RemoteAppHome'
sudo -n install -o '$AppUser' -g '$AppUser' -m 600 '$remoteTarball' '$targetTarball'
sudo -n install -m 644 '$remoteManifest' '$targetManifest'
chmod +x '$remoteDeploy' '$remoteCheck'
if [ -n '$remoteMigration' ]; then
chmod +x '$remoteMigration'
sudo -n bash '$remoteMigration'
fi
sudo -n bash '$remoteDeploy'
check_ok=0
for i in `$(seq 1 30); do
if sudo -n bash '$remoteCheck'; then
check_ok=1
break
fi
sleep 2
done
if [ "`$check_ok" -ne 1 ]; then
sudo -n bash '$remoteCheck'
exit 1
fi
"@.Replace("`r`n", "`n")
[System.IO.File]::WriteAllText($runnerPath, $runnerScript, [System.Text.Encoding]::ASCII)
scp.exe @scpArgs $tarPath "${SshTarget}:$remoteTarball"
if ($LASTEXITCODE -ne 0) { throw "scp source tarball failed for $AppId" }
scp.exe @scpArgs $DeployScript "${SshTarget}:$remoteDeploy"
if ($LASTEXITCODE -ne 0) { throw "scp deploy script failed for $AppId" }
scp.exe @scpArgs $CheckScript "${SshTarget}:$remoteCheck"
if ($LASTEXITCODE -ne 0) { throw "scp check script failed for $AppId" }
if (-not [string]::IsNullOrWhiteSpace($StateMigrationScript)) {
scp.exe @scpArgs $StateMigrationScript "${SshTarget}:$remoteMigration"
if ($LASTEXITCODE -ne 0) { throw "scp state migration script failed for $AppId" }
}
scp.exe @scpArgs $manifestPath "${SshTarget}:$remoteManifest"
if ($LASTEXITCODE -ne 0) { throw "scp manifest failed for $AppId" }
scp.exe @scpArgs $runnerPath "${SshTarget}:$remoteRunner"
if ($LASTEXITCODE -ne 0) { throw "scp runner script failed for $AppId" }
ssh.exe @sshArgs "chmod +x '$remoteRunner' && bash '$remoteRunner'"
$remoteExit = $LASTEXITCODE
ssh.exe @sshArgs "rm -f '$remoteRunner'"
if ($remoteExit -ne 0) {
throw "remote deploy/check failed for $AppId"
}
Remove-Item -LiteralPath $runnerPath -Force -ErrorAction SilentlyContinue
Write-Host "$AppId deployed to Yggdrasil from $sourceRef at $commit."
Write-Host " artifactSha256=$hash"

View file

@ -1,10 +0,0 @@
@echo off
if not "%IDUNN_ACTUATOR%"=="1" (
echo This deployment wrapper is an Idunn actuator. Configure Idunn; do not deploy manually.
exit /b 1
)
if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
echo This deployment wrapper is an Idunn actuator. Configure Idunn; do not deploy manually.
exit /b 1
)
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0deploy-yggdrasil-streampixels.ps1

View file

@ -1,156 +0,0 @@
param(
[string] $SshTarget = "yggdrasil",
[string] $RepoRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "StreamPixels"),
[string] $CultLibRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "CultLib"),
[string] $AppUser = "streampixels",
[string] $RemoteAppHome = "/srv/streampixels",
[string] $RemoteTarballName = "streampixels-source.tar",
[string] $RemoteCultLibTarballName = "streampixels-cultlib.tar",
[string] $DeployScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\deploy-streampixels-preview.sh"),
[string] $CheckScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\check-streampixels-preview.sh"),
[string] $UpstreamRemote = "origin",
[string] $UpstreamBranch = "main",
[string] $CultLibUpstreamRemote = "origin",
[string] $CultLibUpstreamBranch = "main"
)
$ErrorActionPreference = "Stop"
if ($env:IDUNN_ACTUATOR -ne "1" -or $env:IDUNN_COMMAND_AUTHORITY -ne "idunn-daemon") {
throw "This deployment script is an Idunn actuator. Agents must configure Idunn release targets and let Idunn run deployment; do not invoke deploy scripts manually."
}
foreach ($path in @($RepoRoot, $CultLibRoot, $DeployScript, $CheckScript)) {
if (-not (Test-Path -LiteralPath $path)) {
throw "Required path not found: $path"
}
}
$sourceRef = "$UpstreamRemote/$UpstreamBranch"
$cultLibSourceRef = "$CultLibUpstreamRemote/$CultLibUpstreamBranch"
git -C $RepoRoot fetch --prune $UpstreamRemote $UpstreamBranch
if ($LASTEXITCODE -ne 0) { throw "git fetch failed for $RepoRoot $sourceRef" }
git -C $CultLibRoot fetch --prune $CultLibUpstreamRemote $CultLibUpstreamBranch
if ($LASTEXITCODE -ne 0) { throw "git fetch failed for $CultLibRoot $cultLibSourceRef" }
$streamPixelsCommit = (git -C $RepoRoot rev-parse $sourceRef).Trim()
if ([string]::IsNullOrWhiteSpace($streamPixelsCommit)) {
throw "Could not determine StreamPixels git revision."
}
$cultLibCommit = (git -C $CultLibRoot rev-parse $cultLibSourceRef).Trim()
if ([string]::IsNullOrWhiteSpace($cultLibCommit)) {
throw "Could not determine CultLib git revision."
}
$scratch = Join-Path (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\idunn-deploy") "yggdrasil-streampixels"
$sourceTarPath = Join-Path $scratch $RemoteTarballName
$cultLibTarPath = Join-Path $scratch $RemoteCultLibTarballName
$manifestPath = Join-Path $scratch "deployment-manifest.txt"
New-Item -ItemType Directory -Force -Path $scratch | Out-Null
git -C $RepoRoot archive --format=tar --output=$sourceTarPath $sourceRef
if ($LASTEXITCODE -ne 0) {
throw "git archive failed for $RepoRoot $sourceRef"
}
if (Test-Path -LiteralPath $cultLibTarPath) {
Remove-Item -LiteralPath $cultLibTarPath -Force
}
git -C $CultLibRoot archive --format=tar --output=$cultLibTarPath $cultLibSourceRef package.json package-lock.json scripts/run-typescript-workspaces.mjs contracts/cultnet packages/cultcache-ts packages/cultnet-ts packages/cultmesh-ts packages/cultmesh-browser
if ($LASTEXITCODE -ne 0) {
throw "CultLib tar build failed for $CultLibRoot $cultLibSourceRef"
}
$sourceHash = (Get-FileHash $sourceTarPath -Algorithm SHA256).Hash.ToLowerInvariant()
$cultLibHash = (Get-FileHash $cultLibTarPath -Algorithm SHA256).Hash.ToLowerInvariant()
$deployedAt = [DateTimeOffset]::UtcNow.ToString("O")
@(
"schema=gamecult.idunn.deployment_manifest.v1"
"appId=yggdrasil-streampixels"
"repoRoot=$RepoRoot"
"upstreamRemote=$UpstreamRemote"
"upstreamBranch=$UpstreamBranch"
"sourceRef=$sourceRef"
"gitCommit=$streamPixelsCommit"
"artifact=$RemoteTarballName"
"sha256=$sourceHash"
"cultLibRepoRoot=$CultLibRoot"
"cultLibUpstreamRemote=$CultLibUpstreamRemote"
"cultLibUpstreamBranch=$CultLibUpstreamBranch"
"cultLibSourceRef=$cultLibSourceRef"
"cultLibGitCommit=$cultLibCommit"
"cultLibArtifact=$RemoteCultLibTarballName"
"cultLibSha256=$cultLibHash"
"deployedAtUtc=$deployedAt"
) | Set-Content -Encoding ASCII -LiteralPath $manifestPath
$remoteDeploy = "/home/gamecultadmin/$([IO.Path]::GetFileName($DeployScript))"
$remoteCheck = "/home/gamecultadmin/$([IO.Path]::GetFileName($CheckScript))"
$remoteSourceTarball = "/home/gamecultadmin/$RemoteTarballName"
$remoteCultLibTarball = "/home/gamecultadmin/$RemoteCultLibTarballName"
$remoteManifest = "/home/gamecultadmin/yggdrasil-streampixels-deployment-manifest.txt"
$remoteRunner = "/home/gamecultadmin/run-yggdrasil-streampixels-deploy.sh"
$targetSourceTarball = "$RemoteAppHome/$RemoteTarballName"
$targetCultLibTarball = "$RemoteAppHome/$RemoteCultLibTarballName"
$targetManifest = "$RemoteAppHome/deployment-manifest.txt"
$sftpBatchPath = Join-Path $scratch "yggdrasil-streampixels-upload.sftp"
$runnerPath = Join-Path $scratch "run-yggdrasil-streampixels-deploy.sh"
$runnerScript = @"
#!/usr/bin/env bash
set -euo pipefail
sudo -n install -d -o '$AppUser' -g '$AppUser' '$RemoteAppHome'
sudo -n install -o '$AppUser' -g '$AppUser' -m 600 '$remoteSourceTarball' '$targetSourceTarball'
sudo -n install -o '$AppUser' -g '$AppUser' -m 600 '$remoteCultLibTarball' '$targetCultLibTarball'
sudo -n install -m 644 '$remoteManifest' '$targetManifest'
chmod +x '$remoteDeploy' '$remoteCheck'
sudo -n env GAMECULT_IDUNN_REMOTE_ACTUATOR=1 IDUNN_COMMAND_AUTHORITY=idunn-daemon bash '$remoteDeploy'
check_ok=0
for i in `$(seq 1 30); do
if sudo -n bash '$remoteCheck'; then
check_ok=1
break
fi
sleep 2
done
if [ "`$check_ok" -ne 1 ]; then
sudo -n bash '$remoteCheck'
exit 1
fi
"@.Replace("`r`n", "`n")
[System.IO.File]::WriteAllText($runnerPath, $runnerScript, [System.Text.Encoding]::ASCII)
@(
"put ""$sourceTarPath"" ""$remoteSourceTarball"""
"put ""$cultLibTarPath"" ""$remoteCultLibTarball"""
"put ""$DeployScript"" ""$remoteDeploy"""
"put ""$CheckScript"" ""$remoteCheck"""
"put ""$manifestPath"" ""$remoteManifest"""
"put ""$runnerPath"" ""$remoteRunner"""
) | Set-Content -Encoding ASCII -LiteralPath $sftpBatchPath
try {
& sftp.exe -b $sftpBatchPath $SshTarget
if ($LASTEXITCODE -ne 0) {
throw "sftp upload failed for yggdrasil-streampixels"
}
& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $SshTarget "chmod +x '$remoteRunner' && bash '$remoteRunner'"
$remoteExit = $LASTEXITCODE
& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $SshTarget "rm -f '$remoteRunner'"
if ($remoteExit -ne 0) {
throw "remote deploy/check failed for yggdrasil-streampixels"
}
}
finally {
Remove-Item -LiteralPath $runnerPath -Force -ErrorAction SilentlyContinue
Remove-Item -LiteralPath $sftpBatchPath -Force -ErrorAction SilentlyContinue
}
Write-Host "yggdrasil-streampixels deployed with CultLib snapshot."
Write-Host " streamPixelsCommit=$streamPixelsCommit"
Write-Host " cultLibCommit=$cultLibCommit"
Write-Host " artifactSha256=$sourceHash"
Write-Host " cultLibSha256=$cultLibHash"

View file

@ -1,3 +0,0 @@
@echo off
echo health-mimir-eve-dashboard.cmd archived: Mimir Eve dashboard health is daemon-published over CultNet/RUDP as mimir.cultnet-rudp-provider-health. Do not probe localhost HTTP for daemon health. 1>&2
exit /b 2

View file

@ -1,3 +0,0 @@
@echo off
echo health-nightwing-eve-browser-reference.cmd archived: Nightwing Eve browser reference health is daemon-published over CultNet/RUDP as nightwing.cultnet-rudp-browser-reference-health. Use health-nightwing-eve-browser-reference.ps1 only as an explicit witness inspection, not Idunn health truth.
exit /b 2

View file

@ -1,335 +0,0 @@
param(
[string] $SshTarget = "nightwing",
[string] $ExpectedDocumentRoot = "/opt/gamecult/eve-browser-reference",
[string] $RemoteCultCacheWitness = "/var/lib/gamecult/eve-browser-reference/cultcache/eve-browser-reference.service.cc",
[int] $MaxWitnessAgeSeconds = 120
)
$ErrorActionPreference = "Stop"
function Fail-IdunnHealth {
param(
[string] $State,
[string] $Message
)
Write-Output "idunn.health.state=$State"
throw $Message
}
function Invoke-SshText {
param(
[string] $Command,
[string] $FailureMessage,
[string] $FailureState = "failed"
)
$output = ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget $Command
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($output)) {
Fail-IdunnHealth -State $FailureState -Message $FailureMessage
}
return $output
}
function Get-CultCacheInspection {
param(
[string] $WitnessCopyPath,
[string] $InspectorPackageJson
)
$nodeScript = @'
const fs = require("fs");
const { createRequire } = require("module");
const witnessCopyPath = process.argv[2];
const inspectorPackageJson = process.argv[3];
const requireCultCacheInspection = createRequire(inspectorPackageJson);
const { inspectCultCacheBytes } = requireCultCacheInspection("cultcache-ts");
const inspection = inspectCultCacheBytes(witnessCopyPath, fs.readFileSync(witnessCopyPath));
function firstRecord(schemaName) {
return inspection.records.find((record) => record.schemaName === schemaName) ?? null;
}
function previewArray(record) {
return Array.isArray(record?.payloadPreview) ? record.payloadPreview : [];
}
function normalizeRecord(schemaName) {
const record = firstRecord(schemaName);
if (!record) {
return null;
}
const preview = previewArray(record);
switch (schemaName) {
case "mimir.eve_browser_reference_manifest":
return {
schemaName: record.schemaName,
storedAt: record.storedAt,
daemonId: preview[0] ?? "",
siteTitle: preview[1] ?? "",
documentRoot: preview[2] ?? "",
entryPoint: preview[3] ?? "",
port: preview[4] ?? 0,
assetCount: Array.isArray(preview[5]) ? preview[5].length : 0,
surfaceTransport: preview[6] ?? "",
};
case "mimir.eve_browser_reference_static_surface":
return {
schemaName: record.schemaName,
storedAt: record.storedAt,
daemonId: preview[0] ?? "",
updatedAtUtc: preview[1] ?? "",
documentRoot: preview[2] ?? "",
entryPoint: preview[3] ?? "",
assetCount: Array.isArray(preview[4]) ? preview[4].length : 0,
fixtureCount: Array.isArray(preview[5]) ? preview[5].length : 0,
currentCutLine: preview[6] ?? "",
};
case "mimir.eve_browser_reference_command_boundary":
return {
schemaName: record.schemaName,
storedAt: record.storedAt,
daemonId: preview[0] ?? "",
updatedAtUtc: preview[1] ?? "",
mode: preview[2] ?? "",
writesAccepted: preview[3] === true,
operatorInputAuthority: preview[4] ?? "",
lifecycleAuthority: preview[5] ?? "",
acceptedCommands: Array.isArray(preview[6]) ? preview[6] : [],
rejectedCommands: Array.isArray(preview[7]) ? preview[7] : [],
};
case "mimir.eve_browser_reference_transport_profile":
return {
schemaName: record.schemaName,
storedAt: record.storedAt,
daemonId: preview[0] ?? "",
updatedAtUtc: preview[1] ?? "",
currentState: preview[2] ?? "",
inputTransport: preview[3] ?? "",
outputTransport: preview[4] ?? "",
healthContract: preview[5] ?? "",
idunnRudpHealth: preview[6] ?? "",
witnessPath: preview[7] ?? "",
currentCutLine: preview[8] ?? "",
};
case "idunn.daemon_health":
return {
schemaName: record.schemaName,
storedAt: record.storedAt,
daemonId: preview[0] ?? "",
state: preview[1] ?? "",
detail: preview[2] ?? "",
observedAt: preview[3] ?? "",
healthContract: preview[4] ?? "",
publicationSource: preview[5] ?? "",
transport: preview[6] ?? "",
};
default:
return {
schemaName: record.schemaName,
storedAt: record.storedAt,
};
}
}
console.log(JSON.stringify({
format: inspection.format,
catalogSchemaVersions: inspection.catalog.map((entry) => entry.schemaVersion),
manifest: normalizeRecord("mimir.eve_browser_reference_manifest"),
staticSurface: normalizeRecord("mimir.eve_browser_reference_static_surface"),
commandBoundary: normalizeRecord("mimir.eve_browser_reference_command_boundary"),
transportProfile: normalizeRecord("mimir.eve_browser_reference_transport_profile"),
daemonHealth: normalizeRecord("idunn.daemon_health"),
}));
'@
$inspectionJson = $nodeScript | node - $WitnessCopyPath $InspectorPackageJson
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($inspectionJson)) {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness inspection failed."
}
try {
return $inspectionJson | ConvertFrom-Json
} catch {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache inspection returned malformed JSON."
}
}
ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "systemctl is-active --quiet nightwing-eve-browser-reference.service"
if ($LASTEXITCODE -ne 0) {
Fail-IdunnHealth -State "failed" -Message "nightwing-eve-browser-reference.service is not active on Nightwing."
}
$cultCacheStat = Invoke-SshText `
-Command "stat -c '%s %Y %U %G' '$RemoteCultCacheWitness' 2>/dev/null" `
-FailureMessage "Nightwing Eve browser reference CultCache witness is missing at $RemoteCultCacheWitness."
$cultCacheParts = $cultCacheStat.Trim() -split '\s+'
if ($cultCacheParts.Length -lt 4) {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness stat output was malformed: $cultCacheStat"
}
$cultCacheSize = [int64]$cultCacheParts[0]
$cultCacheModifiedUtc = [DateTimeOffset]::FromUnixTimeSeconds([int64]$cultCacheParts[1])
$cultCacheOwner = $cultCacheParts[2]
$cultCacheGroup = $cultCacheParts[3]
$cultCacheAgeSeconds = ([DateTimeOffset]::UtcNow - $cultCacheModifiedUtc).TotalSeconds
if ($cultCacheSize -le 0) {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness at $RemoteCultCacheWitness is empty."
}
if ($cultCacheAgeSeconds -gt $MaxWitnessAgeSeconds) {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness is stale ($([math]::Round($cultCacheAgeSeconds))s old)."
}
if ($cultCacheOwner -ne "metacrat" -or $cultCacheGroup -ne "metacrat") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference CultCache witness owner is ${cultCacheOwner}:$cultCacheGroup, expected metacrat:metacrat."
}
try {
$cultCacheInspectorPackageJson = (Resolve-Path (Join-Path $PSScriptRoot "..\..\CultLib\packages\cultcache-ts\package.json")).Path
} catch {
Fail-IdunnHealth -State "failed" -Message "CultCache inspector package is missing from the local Odin body."
}
$cultCacheWitnessCopy = Join-Path ([System.IO.Path]::GetTempPath()) ("nightwing-eve-browser-reference-" + [Guid]::NewGuid().ToString("N") + ".cc")
try {
$remoteCultCacheBase64 = Invoke-SshText `
-Command "base64 -w0 '$RemoteCultCacheWitness' 2>/dev/null" `
-FailureMessage "Nightwing Eve browser reference CultCache witness could not be copied from Nightwing."
[System.IO.File]::WriteAllBytes($cultCacheWitnessCopy, [Convert]::FromBase64String($remoteCultCacheBase64.Trim()))
$inspection = Get-CultCacheInspection -WitnessCopyPath $cultCacheWitnessCopy -InspectorPackageJson $cultCacheInspectorPackageJson
} catch [FormatException] {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness copy was not valid base64."
} finally {
if (Test-Path $cultCacheWitnessCopy) {
Remove-Item $cultCacheWitnessCopy -Force -ErrorAction SilentlyContinue
}
}
if ($inspection.format -ne "cultcache.store.v1") {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness has unexpected format '$($inspection.format)'."
}
$requiredCultCacheSchemas = @(
"mimir.eve_browser_reference_manifest.v1",
"mimir.eve_browser_reference_static_surface.v1",
"mimir.eve_browser_reference_command_boundary.v1",
"mimir.eve_browser_reference_transport_profile.v1",
"idunn.daemon_health.v1"
)
$publishedCultCacheSchemas = @($inspection.catalogSchemaVersions)
foreach ($schema in $requiredCultCacheSchemas) {
if ($publishedCultCacheSchemas -notcontains $schema) {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference CultCache witness is missing schema '$schema'."
}
}
if ($null -eq $inspection.manifest) {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness is missing its manifest record."
}
if ($inspection.manifest.documentRoot -ne $ExpectedDocumentRoot) {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference manifest document root is '$($inspection.manifest.documentRoot)', expected '$ExpectedDocumentRoot'."
}
if ($inspection.manifest.entryPoint -ne "index.html") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference manifest entry point is '$($inspection.manifest.entryPoint)', expected 'index.html'."
}
if ($inspection.manifest.surfaceTransport -ne "static-http-lowering") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference manifest transport is '$($inspection.manifest.surfaceTransport)', expected 'static-http-lowering'."
}
if ($null -eq $inspection.staticSurface) {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness is missing its static-surface record."
}
if ($inspection.staticSurface.documentRoot -ne $ExpectedDocumentRoot) {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference static-surface document root is '$($inspection.staticSurface.documentRoot)', expected '$ExpectedDocumentRoot'."
}
if ($null -eq $inspection.commandBoundary) {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness is missing its command boundary record."
}
if ($inspection.commandBoundary.mode -ne "static-read-only-lowering") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference command boundary mode is '$($inspection.commandBoundary.mode)', expected 'static-read-only-lowering'."
}
if ($inspection.commandBoundary.writesAccepted) {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference command boundary unexpectedly accepts writes."
}
if ($inspection.commandBoundary.lifecycleAuthority -ne "idunn-supervisor-command.restart") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference lifecycle authority is '$($inspection.commandBoundary.lifecycleAuthority)', expected 'idunn-supervisor-command.restart'."
}
if ($null -eq $inspection.transportProfile) {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness is missing its transport profile record."
}
if ($inspection.transportProfile.currentState -ne "partial-rudp-health-and-provider-store-live") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference transport profile state is '$($inspection.transportProfile.currentState)', expected 'partial-rudp-health-and-provider-store-live'."
}
if ($inspection.transportProfile.inputTransport -ne "http-static-lowering") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference input transport is '$($inspection.transportProfile.inputTransport)', expected 'http-static-lowering'."
}
if ($inspection.transportProfile.outputTransport -ne "daemon-owned-cultcache-boundary-store + daemon-published-rudp-health") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference output transport is '$($inspection.transportProfile.outputTransport)', expected 'daemon-owned-cultcache-boundary-store + daemon-published-rudp-health'."
}
if ($inspection.transportProfile.healthContract -ne "nightwing.cultnet-rudp-browser-reference-health") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference health contract is '$($inspection.transportProfile.healthContract)', expected 'nightwing.cultnet-rudp-browser-reference-health'."
}
if ($inspection.transportProfile.idunnRudpHealth -ne "idunn.health-published-separately") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference transport profile Idunn health publication is '$($inspection.transportProfile.idunnRudpHealth)', expected 'idunn.health-published-separately'."
}
if ($inspection.transportProfile.witnessPath -ne $RemoteCultCacheWitness) {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference transport profile witness path is '$($inspection.transportProfile.witnessPath)', expected '$RemoteCultCacheWitness'."
}
if ($null -eq $inspection.daemonHealth) {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness is missing its daemon-health record."
}
if ($inspection.daemonHealth.daemonId -ne "nightwing-eve-browser-reference") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference daemon-health record advertises daemon '$($inspection.daemonHealth.daemonId)', expected 'nightwing-eve-browser-reference'."
}
if ($inspection.daemonHealth.state -ne "healthy") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference daemon-health state is '$($inspection.daemonHealth.state)', expected 'healthy'."
}
if ($inspection.daemonHealth.healthContract -ne "nightwing.cultnet-rudp-browser-reference-health") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference daemon-health contract is '$($inspection.daemonHealth.healthContract)', expected 'nightwing.cultnet-rudp-browser-reference-health'."
}
if ($inspection.daemonHealth.publicationSource -ne "daemon-published") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference daemon-health publication source is '$($inspection.daemonHealth.publicationSource)', expected 'daemon-published'."
}
if ($inspection.daemonHealth.transport -ne "cultnet.transport.rudp.v0") {
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference daemon-health transport is '$($inspection.daemonHealth.transport)', expected 'cultnet.transport.rudp.v0'."
}
try {
$daemonHealthObservedAtUtc = [DateTimeOffset]::Parse($inspection.daemonHealth.observedAt)
} catch {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference daemon-health observedAt is malformed: '$($inspection.daemonHealth.observedAt)'."
}
$daemonHealthAgeSeconds = ([DateTimeOffset]::UtcNow - $daemonHealthObservedAtUtc.ToUniversalTime()).TotalSeconds
if ($daemonHealthAgeSeconds -gt $MaxWitnessAgeSeconds) {
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference daemon-health record is stale ($([math]::Round($daemonHealthAgeSeconds))s old)."
}
Write-Host "Nightwing Eve browser reference is active, and its daemon-owned CultCache witness now certifies manifest, boundary, and daemon-health truth directly."

View file

@ -1,3 +0,0 @@
@echo off
echo health-nightwing-eve-dashboard.cmd archived: Nightwing Eve dashboard broker health is not daemon truth. Rebuild typed CultMesh/Odin dashboard state before restoring a health check. 1>&2
exit /b 2

View file

@ -1 +0,0 @@
throw "health-nightwing-eve-dashboard.ps1 archived: Nightwing Eve dashboard broker health is not daemon truth. Inspect typed CultMesh/Odin dashboard state after the publisher is rebuilt."

View file

@ -1,3 +0,0 @@
@echo off
echo health-odin.cmd archived: Odin health is daemon-published over CultNet/RUDP as odin.cultnet-rudp-provider-health. Use health-odin.ps1 only as an explicit daemon witness inspection, not Idunn health truth.
exit /b 2

View file

@ -1,68 +0,0 @@
param(
[string] $StateDir = (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\odin"),
[int] $MaxSilenceSeconds = 120,
[string] $CultNetRudpBind = "0.0.0.0:17871"
)
$ErrorActionPreference = "Stop"
$pidPath = Join-Path $StateDir "odin.pid"
$outLog = Join-Path $StateDir "odin.out.log"
$errLog = Join-Path $StateDir "odin.err.log"
$cachePath = Join-Path $StateDir "odin.ccmp"
if (-not (Test-Path -LiteralPath $pidPath)) {
throw "Odin PID file is missing at $pidPath"
}
$pidText = (Get-Content -LiteralPath $pidPath -Raw).Trim()
if ($pidText -notmatch '^\d+$') {
throw "Odin PID file is invalid at ${pidPath}: '$pidText'"
}
$process = Get-CimInstance Win32_Process -Filter "ProcessId = $pidText" -ErrorAction SilentlyContinue
if ($null -eq $process) {
throw "Odin process $pidText is not running"
}
foreach ($pattern in @(
'node.exe',
'src\odin-coordinator.cjs',
"--stateDir $StateDir",
"--cultnet-rudp-bind $CultNetRudpBind",
'--idunn-daemon odin',
'--idunn-health-contract odin.cultnet-rudp-provider-health'
)) {
if ($process.CommandLine -notlike "*$pattern*") {
throw "Odin process command line is missing expected segment ${pattern}: $($process.CommandLine)"
}
}
foreach ($logPath in @($outLog, $errLog)) {
if (-not (Test-Path -LiteralPath $logPath)) {
throw "Odin log is missing at $logPath"
}
}
$newestLogWriteUtc = @($outLog, $errLog) |
ForEach-Object { (Get-Item -LiteralPath $_).LastWriteTimeUtc } |
Sort-Object -Descending |
Select-Object -First 1
$logAgeSeconds = ([DateTime]::UtcNow - $newestLogWriteUtc).TotalSeconds
if ($logAgeSeconds -gt $MaxSilenceSeconds) {
throw "Odin logs have been silent for $([math]::Round($logAgeSeconds))s, exceeding $MaxSilenceSeconds seconds"
}
if (-not (Test-Path -LiteralPath $cachePath)) {
throw "Odin CultMesh store is missing at $cachePath"
}
$rudpPort = [int](($CultNetRudpBind -split ':')[-1])
$udpListener = Get-NetUDPEndpoint -LocalPort $rudpPort -ErrorAction SilentlyContinue |
Where-Object { $_.OwningProcess -eq [int]$pidText } |
Select-Object -First 1
if ($null -eq $udpListener) {
throw "Odin is not listening on UDP port $rudpPort as process $pidText"
}
Write-Host "Odin healthy: pid=$pidText cultmesh_rudp_udp=$rudpPort store=$cachePath log_age=$([math]::Round($logAgeSeconds))s"

View file

@ -1,3 +0,0 @@
@echo off
echo health-raven-capture-mux.cmd archived: Raven capture mux no longer owns Muninn daemon health; Muninn publishes muninn.cultnet-rudp-remote-telemetry-health over CultNet/RUDP.
exit /b 2

View file

@ -1,2 +0,0 @@
Write-Error "health-raven-capture-mux.ps1 archived: Raven capture mux no longer owns Muninn daemon health; Muninn publishes muninn.cultnet-rudp-remote-telemetry-health over CultNet/RUDP."
exit 2

View file

@ -1,3 +0,0 @@
@echo off
echo health-stonks.cmd archived: Stonks health is daemon-published over CultNet/RUDP as stonks.cultnet-rudp-market-health. Do not probe localhost HTTP for daemon health. 1>&2
exit /b 2

View file

@ -1,3 +0,0 @@
@echo off
echo health-vili.cmd archived: Vili health is daemon-published over CultNet/RUDP as vili.cultnet-rudp-animation-health. Do not probe HTTP for daemon health. 1>&2
exit /b 2

View file

@ -1,3 +0,0 @@
@echo off
echo health-voidbot.cmd archived: VoidBot health is daemon-published over CultNet/RUDP as voidbot.cultnet-rudp-stack-health. Use health-voidbot.ps1 only as an explicit witness inspection, not Idunn health truth. 1>&2
exit /b 2

View file

@ -1,181 +0,0 @@
param(
[string] $VoidBotRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "VoidBot"),
[int] $MaxOrchestratorAgeSeconds = 180,
[int] $MaxCultMeshStoreAgeSeconds = 180
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
function Fail-IdunnHealth {
param(
[string] $State,
[string] $Message
)
Write-Output "idunn.health.state=$State"
throw $Message
}
function Read-JsonFile {
param([Parameter(Mandatory = $true)][string] $Path)
if (-not (Test-Path -LiteralPath $Path)) {
return $null
}
$raw = Get-Content -LiteralPath $Path -Raw -Encoding UTF8
if ([string]::IsNullOrWhiteSpace($raw)) {
return $null
}
return $raw | ConvertFrom-Json
}
function Get-JsonPropertyValue {
param(
[Parameter(Mandatory = $false)] $Object,
[Parameter(Mandatory = $true)][string] $Name,
[Parameter(Mandatory = $false)] $Default = $null
)
if ($null -eq $Object) {
return $Default
}
$property = $Object.PSObject.Properties[$Name]
if ($null -eq $property) {
return $Default
}
return $property.Value
}
function Get-ProcessOrFail {
param(
[Parameter(Mandatory = $true)][string] $Role,
[Parameter(Mandatory = $true)][int] $ProcessId
)
$process = Get-Process -Id $ProcessId -ErrorAction SilentlyContinue
if ($null -eq $process) {
Fail-IdunnHealth -State "failed" -Message "VoidBot $Role process PID $ProcessId is not running."
}
return $process
}
function Assert-StoreContains {
param(
[Parameter(Mandatory = $true)][string] $StorePath,
[Parameter(Mandatory = $true)][string[]] $Tokens
)
$rg = (Get-Command rg.exe -ErrorAction SilentlyContinue).Source
if ([string]::IsNullOrWhiteSpace($rg)) {
Fail-IdunnHealth -State "degraded" -Message "ripgrep is required to inspect the VoidBot CultMesh witness store."
}
foreach ($token in $Tokens) {
& $rg -a -q --fixed-strings -- $token $StorePath
if ($LASTEXITCODE -ne 0) {
Fail-IdunnHealth -State "degraded" -Message "VoidBot CultMesh witness store is missing '$token'."
}
}
}
$runtimePath = Join-Path $VoidBotRoot ".voidbot\status\runtime-stack.json"
$orchestratorPath = Join-Path $VoidBotRoot ".voidbot\status\gamecult-orchestrator.json"
$cultMeshStorePath = Join-Path $VoidBotRoot ".voidbot\status\cultmesh\voidbot-swarm-state.cc"
$runtime = Read-JsonFile -Path $runtimePath
if ($null -eq $runtime) {
Fail-IdunnHealth -State "failed" -Message "VoidBot runtime state is missing at $runtimePath."
}
if (-not [bool](Get-JsonPropertyValue -Object $runtime -Name "ready" -Default $false)) {
Fail-IdunnHealth -State "failed" -Message "VoidBot runtime stack reports ready=false."
}
$runtimeStage = [string](Get-JsonPropertyValue -Object $runtime -Name "stage" -Default "unknown")
if ($runtimeStage -ne "ready") {
Fail-IdunnHealth -State "failed" -Message "VoidBot runtime stack stage is '$runtimeStage', expected 'ready'."
}
$bot = Get-JsonPropertyValue -Object $runtime -Name "bot"
$worker = Get-JsonPropertyValue -Object $runtime -Name "worker"
$botPid = if ($null -ne $bot) { [int](Get-JsonPropertyValue -Object $bot -Name "pid" -Default 0) } else { 0 }
$workerPid = if ($null -ne $worker) { [int](Get-JsonPropertyValue -Object $worker -Name "pid" -Default 0) } else { 0 }
if ($botPid -le 0) {
Fail-IdunnHealth -State "failed" -Message "VoidBot runtime state does not contain a live bot PID."
}
if ($workerPid -le 0) {
Fail-IdunnHealth -State "failed" -Message "VoidBot runtime state does not contain a live worker PID."
}
$botProcess = Get-ProcessOrFail -Role "bot" -ProcessId $botPid
$workerProcess = Get-ProcessOrFail -Role "worker" -ProcessId $workerPid
$orchestrator = Read-JsonFile -Path $orchestratorPath
if ($null -eq $orchestrator -or $null -eq $orchestrator.organs) {
Fail-IdunnHealth -State "failed" -Message "VoidBot orchestrator state is missing at $orchestratorPath."
}
$surfaceState = $orchestrator.organs.PSObject.Properties["voidbot-swarm-surface"]
if ($null -eq $surfaceState) {
Fail-IdunnHealth -State "failed" -Message "VoidBot orchestrator does not report the voidbot-swarm-surface organ."
}
$surfaceState = $surfaceState.Value
if ($surfaceState.lastStatus -ne "ok") {
Fail-IdunnHealth -State "degraded" -Message "VoidBot swarm surface organ lastStatus is '$($surfaceState.lastStatus)', expected 'ok'."
}
if ([string]::IsNullOrWhiteSpace($surfaceState.lastFinishedAt)) {
Fail-IdunnHealth -State "failed" -Message "VoidBot swarm surface organ has no lastFinishedAt timestamp."
}
$surfaceFinishedAt = [DateTimeOffset]::Parse($surfaceState.lastFinishedAt).ToUniversalTime()
$surfaceAgeSeconds = ([DateTimeOffset]::UtcNow - $surfaceFinishedAt).TotalSeconds
if ($surfaceAgeSeconds -gt $MaxOrchestratorAgeSeconds) {
Fail-IdunnHealth -State "failed" -Message "VoidBot swarm surface organ is stale ($([math]::Round($surfaceAgeSeconds))s old)."
}
$orchestratorFile = Get-Item -LiteralPath $orchestratorPath -ErrorAction SilentlyContinue
if ($null -eq $orchestratorFile) {
Fail-IdunnHealth -State "failed" -Message "VoidBot orchestrator state file is missing at $orchestratorPath."
}
$orchestratorAgeSeconds = ([DateTimeOffset]::UtcNow - [DateTimeOffset]$orchestratorFile.LastWriteTimeUtc).TotalSeconds
if ($orchestratorAgeSeconds -gt $MaxOrchestratorAgeSeconds) {
Fail-IdunnHealth -State "failed" -Message "VoidBot orchestrator state file is stale ($([math]::Round($orchestratorAgeSeconds))s old)."
}
$cultMeshStore = Get-Item -LiteralPath $cultMeshStorePath -ErrorAction SilentlyContinue
if ($null -eq $cultMeshStore) {
Fail-IdunnHealth -State "failed" -Message "VoidBot CultMesh witness store is missing at $cultMeshStorePath."
}
if ($cultMeshStore.Length -le 0) {
Fail-IdunnHealth -State "failed" -Message "VoidBot CultMesh witness store at $cultMeshStorePath is empty."
}
$cultMeshStoreAgeSeconds = ([DateTimeOffset]::UtcNow - [DateTimeOffset]$cultMeshStore.LastWriteTimeUtc).TotalSeconds
if ($cultMeshStoreAgeSeconds -gt $MaxCultMeshStoreAgeSeconds) {
Fail-IdunnHealth -State "failed" -Message "VoidBot CultMesh witness store is stale ($([math]::Round($cultMeshStoreAgeSeconds))s old)."
}
Assert-StoreContains -StorePath $cultMeshStorePath -Tokens @(
"voidbot.provider_advertisement_catalog.v0",
"idunn.command_boundary.v1",
"idunn.daemon_transport_profile.v1",
"voidbot.providers",
"voidbot.discord",
"voidbot.reddit",
"voidbot.archive",
"voidbot.source",
"voidbot.repo_face",
"voidbot.swarm",
"command-boundary:voidbot",
"transport:voidbot"
)
Write-Host "VoidBot runtime is ready, bot PID $($botProcess.Id) and worker PID $($workerProcess.Id) are live, and the daemon-owned CultMesh witness store is fresh."

View file

@ -1,3 +0,0 @@
@echo off
echo health-weksa.cmd archived: Weksa health is daemon-published over CultNet/RUDP as weksa.cultnet-rudp-provider-health. Do not run local command health for daemon truth. 1>&2
exit /b 2

View file

@ -1,3 +0,0 @@
@echo off
echo health-yggdrasil-heimdall.cmd archived: Heimdall health is daemon-published over CultNet/RUDP as heimdall.cultnet-rudp-provider-health. Use health-yggdrasil-source-app.ps1 only as an explicit deployment witness, not Idunn health truth.
exit /b 2

View file

@ -1,3 +0,0 @@
@echo off
echo health-yggdrasil-repixelizer.cmd archived: Repixelizer health is daemon-published over CultNet/RUDP as repixelizer.cultnet-rudp-service-health. Use health-yggdrasil-source-app.ps1 only as an explicit deployment witness, not Idunn health truth.
exit /b 2

View file

@ -1,43 +0,0 @@
param(
[Parameter(Mandatory = $true)] [string] $AppId,
[Parameter(Mandatory = $true)] [string] $RepoRoot,
[Parameter(Mandatory = $true)] [string] $RemoteAppHome,
[Parameter(Mandatory = $true)] [string] $CheckScript,
[string] $SshTarget = "yggdrasil"
)
$ErrorActionPreference = "Stop"
$localCommit = (git -C $RepoRoot rev-parse HEAD).Trim()
if ([string]::IsNullOrWhiteSpace($localCommit)) {
throw "Could not determine git revision for $RepoRoot"
}
$remoteCheck = "/home/gamecultadmin/$([IO.Path]::GetFileName($CheckScript))"
$scpArgs = @("-o", "BatchMode=yes", "-o", "ConnectTimeout=10")
$sshArgs = @("-o", "BatchMode=yes", "-o", "ConnectTimeout=10", $SshTarget)
scp.exe @scpArgs $CheckScript "${SshTarget}:$remoteCheck" | Out-Null
if ($LASTEXITCODE -ne 0) { throw "scp check script failed for $AppId" }
$manifest = ssh.exe @sshArgs "cat '$RemoteAppHome/deployment-manifest.txt' 2>/dev/null"
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($manifest)) {
throw "$AppId deploy manifest is missing on Yggdrasil."
}
$remoteCommit = ""
foreach ($line in $manifest) {
if ($line -like "gitCommit=*") {
$remoteCommit = $line.Substring("gitCommit=".Length).Trim()
}
}
if ($remoteCommit -ne $localCommit) {
throw "$AppId deploy is stale. remote=$remoteCommit local=$localCommit"
}
ssh.exe @sshArgs "chmod +x '$remoteCheck' && sudo -n bash '$remoteCheck'"
if ($LASTEXITCODE -ne 0) {
throw "$AppId remote health check failed."
}
Write-Host "$AppId is active and deployed at $localCommit."

View file

@ -1,3 +0,0 @@
@echo off
echo health-yggdrasil-streampixels.cmd archived: StreamPixels health is daemon-published over CultNet/RUDP as streampixels.cultnet-rudp-service-health. Use health-yggdrasil-source-app.ps1 only as an explicit deployment witness, not Idunn health truth.
exit /b 2

View file

@ -1,77 +0,0 @@
#!/bin/sh
set -eu
if [ "$(id -u)" -ne 0 ]; then
echo "deploy-yggdrasil-heimdall must run as root through Idunn" >&2
exit 1
fi
source_tar=/srv/heimdall/heimdall-source.tar
cultlib_tar=/srv/heimdall/heimdall-cultlib.tar
releases=/srv/heimdall/app/releases
current=/srv/heimdall/app/current
shared_cultlib="$releases/CultLib"
compose=/srv/compose/yggdrasil-apps.yaml
for required in "$source_tar" "$cultlib_tar" "$compose"; do
if [ ! -f "$required" ]; then
echo "missing audited Heimdall deployment input: $required" >&2
exit 1
fi
done
artifact_sha=$(sha256sum "$source_tar" | awk '{print $1}')
release="$releases/sha-${artifact_sha}"
previous=$(readlink -f "$current" 2>/dev/null || true)
if [ ! -f "$release/.idunn-build-complete" ]; then
staging="$release.staging.$$"
rm -rf "$staging"
install -d -o heimdall -g heimdall "$staging" "$shared_cultlib"
tar -xf "$source_tar" -C "$staging"
rm -rf "$shared_cultlib/packages/cultcache-ts" "$shared_cultlib/packages/cultnet-ts"
tar -xf "$cultlib_tar" -C "$shared_cultlib"
docker run --rm \
-v /srv/heimdall:/srv/heimdall \
-w "$staging" \
node:24.14.1-bookworm-slim@sha256:b506e7321f176aae77317f99d67a24b272c1f09f1d10f1761f2773447d8da26c \
sh -c 'corepack enable && pnpm install --frozen-lockfile && pnpm typecheck && pnpm test && pnpm build && pnpm prune --prod'
printf '%s\n' "$artifact_sha" > "$staging/.idunn-build-complete"
chown -R heimdall:heimdall "$staging" "$shared_cultlib"
mv "$staging" "$release"
fi
ln -sfn "$release" "$current"
chown -h heimdall:heimdall "$current"
if ! docker compose -f "$compose" up -d --force-recreate heimdall; then
if [ -n "$previous" ] && [ -d "$previous" ]; then
ln -sfn "$previous" "$current"
chown -h heimdall:heimdall "$current"
docker compose -f "$compose" up -d --force-recreate heimdall || true
fi
exit 1
fi
healthy=0
for _ in $(seq 1 30); do
if curl -fsS http://127.0.0.1:4100/healthz >/dev/null; then
healthy=1
break
fi
sleep 2
done
if [ "$healthy" -ne 1 ]; then
echo "Heimdall failed health verification after deploying $artifact_sha" >&2
if [ -n "$previous" ] && [ -d "$previous" ]; then
ln -sfn "$previous" "$current"
chown -h heimdall:heimdall "$current"
docker compose -f "$compose" up -d --force-recreate heimdall || true
fi
exit 1
fi
echo "Heimdall deployed audited source artifact $artifact_sha"

View file

@ -1,10 +0,0 @@
@echo off
if not "%IDUNN_ACTUATOR%"=="1" (
echo restart-nightwing-eve-browser-reference.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
exit /b 1
)
if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
echo restart-nightwing-eve-browser-reference.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
exit /b 1
)
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0restart-nightwing-eve-browser-reference.ps1

View file

@ -1,17 +0,0 @@
param(
[string] $SshTarget = "nwroot",
[string] $Service = "nightwing-eve-browser-reference.service"
)
$ErrorActionPreference = "Stop"
if ($env:IDUNN_ACTUATOR -ne "1" -or $env:IDUNN_COMMAND_AUTHORITY -ne "idunn-daemon") {
throw "restart-nightwing-eve-browser-reference.ps1 is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path."
}
ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "systemctl restart $Service && systemctl is-active --quiet $Service"
if ($LASTEXITCODE -ne 0) {
throw "Remote restart failed for $Service on $SshTarget with exit code $LASTEXITCODE"
}
Write-Host "Restarted $Service on $SshTarget."

View file

@ -1,3 +0,0 @@
@echo off
echo restart-nightwing-eve-dashboard.cmd archived: Mimir.EveDashboard's HTTP/WebSocket broker is cut. Rebuild a typed CultMesh/Odin dashboard publisher before restoring Idunn lifecycle authority. 1>&2
exit /b 2

View file

@ -1 +0,0 @@
throw "restart-nightwing-eve-dashboard.ps1 archived: Mimir.EveDashboard's HTTP/WebSocket broker is cut. Rebuild a typed CultMesh/Odin dashboard publisher before restoring Idunn lifecycle authority."

View file

@ -1,10 +0,0 @@
@echo off
if not "%IDUNN_ACTUATOR%"=="1" (
echo restart-odin.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
exit /b 1
)
if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
echo restart-odin.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
exit /b 1
)
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -File %~dp0restart-odin.ps1

View file

@ -1,46 +0,0 @@
param(
[string] $StateDir = (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\odin"),
[string] $CultNetRudpBind = "0.0.0.0:17871",
[string] $IdunnRudpHealth = $(if ($env:ODIN_IDUNN_RUDP_HEALTH) { $env:ODIN_IDUNN_RUDP_HEALTH } else { $env:IDUNN_RUDP_HEALTH }),
[string] $IdunnDaemon = "odin",
[string] $IdunnHealthContract = "odin.cultnet-rudp-provider-health"
)
$ErrorActionPreference = "Stop"
if ($env:IDUNN_ACTUATOR -ne "1" -or $env:IDUNN_COMMAND_AUTHORITY -ne "idunn-daemon") {
throw "restart-odin.ps1 is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path."
}
$repoRoot = Split-Path -Parent $PSScriptRoot
$stopScript = Join-Path $PSScriptRoot "stop-odin.ps1"
$startScript = Join-Path $PSScriptRoot "start-odin.ps1"
$powerShellExe = Join-Path $env:WINDIR "System32\WindowsPowerShell\v1.0\powershell.exe"
if (-not (Test-Path -LiteralPath $powerShellExe)) {
throw "PowerShell executable is missing at $powerShellExe"
}
$startArgs = @(
"-NoProfile",
"-ExecutionPolicy", "Bypass",
"-File", $startScript,
"-StateDir", $StateDir,
"-CultNetRudpBind", $CultNetRudpBind,
"-IdunnDaemon", $IdunnDaemon,
"-IdunnHealthContract", $IdunnHealthContract
)
if (-not [string]::IsNullOrWhiteSpace($IdunnRudpHealth)) {
$startArgs += @("-IdunnRudpHealth", $IdunnRudpHealth)
}
& $powerShellExe -NoProfile -ExecutionPolicy Bypass -File $stopScript -StateDir $StateDir
if ($LASTEXITCODE -ne 0) {
throw "stop-odin.ps1 failed with exit code $LASTEXITCODE"
}
& $powerShellExe @startArgs
if ($LASTEXITCODE -ne 0) {
throw "start-odin.ps1 failed with exit code $LASTEXITCODE"
}

View file

@ -1,10 +0,0 @@
@echo off
if not "%IDUNN_ACTUATOR%"=="1" (
echo restart-stonks.cmd is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
exit /b 1
)
if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
echo restart-stonks.cmd is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
exit /b 1
)
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0restart-stonks.ps1

View file

@ -1,21 +0,0 @@
$ErrorActionPreference = "Stop"
$stonksRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "Stonks")
$stateDir = Join-Path $stonksRoot "scratch\stonks"
$pidPath = Join-Path $stateDir "stonks.pid"
$startScript = Join-Path $stonksRoot "scripts\start-stonks.ps1"
if (Test-Path -LiteralPath $pidPath) {
$pidText = (Get-Content -LiteralPath $pidPath -Raw).Trim()
if ($pidText -match "^\d+$") {
$process = Get-Process -Id ([int] $pidText) -ErrorAction SilentlyContinue
if ($null -ne $process) {
Stop-Process -Id $process.Id -Force
Start-Sleep -Milliseconds 500
}
}
Remove-Item -LiteralPath $pidPath -Force -ErrorAction SilentlyContinue
}
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File $startScript
exit $LASTEXITCODE

View file

@ -1,10 +0,0 @@
@echo off
if not "%IDUNN_ACTUATOR%"=="1" (
echo restart-vili.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
exit /b 1
)
if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
echo restart-vili.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
exit /b 1
)
powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%~dp0restart-vili.ps1" %*

View file

@ -1,287 +0,0 @@
param(
[string] $RavenHost = "raven",
[string] $LocalViliRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "Vili"),
[string] $LocalCultLibRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "CultLib"),
[string] $RemoteViliRoot = "E:\Projects\Vili",
[int] $Port = 8824,
[string] $HostName = "0.0.0.0",
[string] $StateRoot = "E:\Projects\Vili\.vili",
[string] $IdunnRudpHealth = $(if ($env:VILI_IDUNN_RUDP_HEALTH) { $env:VILI_IDUNN_RUDP_HEALTH } else { $env:IDUNN_RUDP_HEALTH }),
[string] $IdunnDaemon = "vili",
[string] $IdunnHealthContract = "vili.cultnet-rudp-animation-health",
[int] $IdunnHealthIntervalSeconds = 15
)
$ErrorActionPreference = "Stop"
if ($env:IDUNN_ACTUATOR -ne "1" -or $env:IDUNN_COMMAND_AUTHORITY -ne "idunn-daemon") {
throw "restart-vili.ps1 is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path."
}
if ([string]::IsNullOrWhiteSpace($IdunnRudpHealth)) {
throw "Idunn RUDP health endpoint must be supplied by VILI_IDUNN_RUDP_HEALTH, IDUNN_RUDP_HEALTH, or -IdunnRudpHealth; no WireGuard endpoint default is allowed."
}
$localFiles = @(
(Join-Path $LocalViliRoot "package.json"),
(Join-Path $LocalViliRoot "package-lock.json"),
(Join-Path $LocalViliRoot "scripts\idunn-rudp.cjs"),
(Join-Path $LocalViliRoot "scripts\install-vili-task.ps1"),
(Join-Path $LocalViliRoot "scripts\restart-vili-daemon.cmd"),
(Join-Path $LocalViliRoot "scripts\restart-vili-daemon.ps1"),
(Join-Path $LocalViliRoot "scripts\run-hidden-powershell.vbs"),
(Join-Path $LocalViliRoot "scripts\run-vili-daemon.ps1"),
(Join-Path $LocalViliRoot "scripts\start-vili-daemon.ps1"),
(Join-Path $LocalViliRoot "scripts\vili-daemon.mjs"),
(Join-Path $LocalCultLibRoot "packages\cultnet-ts"),
(Join-Path $LocalCultLibRoot "packages\cultcache-ts"),
(Join-Path $LocalCultLibRoot "node_modules\ajv"),
(Join-Path $LocalCultLibRoot "node_modules\fast-deep-equal"),
(Join-Path $LocalCultLibRoot "node_modules\fast-uri"),
(Join-Path $LocalCultLibRoot "node_modules\json-schema-traverse"),
(Join-Path $LocalCultLibRoot "node_modules\require-from-string"),
(Join-Path $LocalViliRoot "node_modules\@msgpack")
)
foreach ($path in $localFiles) {
if (-not (Test-Path -LiteralPath $path)) {
throw "Required Vili runtime path not found: $path"
}
}
$syncId = [guid]::NewGuid().ToString("N")
$remoteSyncRootPs = "$RemoteViliRoot\.odin-vili-sync-$syncId"
$remoteSyncRootSftp = ($remoteSyncRootPs -replace "\\", "/")
$remoteTempPs = "C:\Windows\Temp\odin-raven-vili-restart-$syncId.ps1"
$remoteTempSftp = ($remoteTempPs -replace "\\", "/")
$remoteBundlePs = "C:\Windows\Temp\odin-raven-vili-bundle-$syncId.zip"
$remoteBundleSftp = ($remoteBundlePs -replace "\\", "/")
$localRemoteScript = Join-Path $env:TEMP "odin-raven-vili-restart-$syncId.ps1"
$localSftpBatch = Join-Path $env:TEMP "odin-raven-vili-restart-$syncId.sftp"
$localBundleRoot = Join-Path $env:TEMP "odin-raven-vili-bundle-$syncId"
$localBundleScripts = Join-Path $localBundleRoot "scripts"
$localBundleNodeModules = Join-Path $localBundleRoot "node_modules"
$localBundleZip = Join-Path $env:TEMP "odin-raven-vili-bundle-$syncId.zip"
$remoteScript = @"
`$ErrorActionPreference = "Stop"
`$ProgressPreference = "SilentlyContinue"
`$remoteRoot = "$RemoteViliRoot"
`$syncRoot = "$remoteSyncRootPs"
`$scriptsRoot = Join-Path `$remoteRoot "scripts"
`$stateRoot = "$StateRoot"
`$nodeModulesRoot = Join-Path `$remoteRoot "node_modules"
`$pidPath = Join-Path `$stateRoot "vili-daemon.pid"
try {
Expand-Archive -LiteralPath "$remoteBundlePs" -DestinationPath `$syncRoot -Force
if (-not (Test-Path -LiteralPath `$syncRoot)) {
throw "Uploaded sync root not found at `$syncRoot"
}
if (Test-Path -LiteralPath `$pidPath) {
`$existingPid = (Get-Content -LiteralPath `$pidPath -Raw -ErrorAction SilentlyContinue).Trim()
if (`$existingPid -match '^\d+$') {
`$process = Get-Process -Id ([int] `$existingPid) -ErrorAction SilentlyContinue
if (`$null -ne `$process) {
Stop-Process -Id `$process.Id -Force
Start-Sleep -Seconds 1
}
}
Remove-Item -LiteralPath `$pidPath -Force -ErrorAction SilentlyContinue
}
New-Item -ItemType Directory -Force -Path `$scriptsRoot | Out-Null
New-Item -ItemType Directory -Force -Path `$stateRoot | Out-Null
Copy-Item -LiteralPath (Join-Path `$syncRoot "package.json") -Destination (Join-Path `$remoteRoot "package.json") -Force
Copy-Item -LiteralPath (Join-Path `$syncRoot "package-lock.json") -Destination (Join-Path `$remoteRoot "package-lock.json") -Force
`$scriptFiles = @(
"idunn-rudp.cjs",
"install-vili-task.ps1",
"restart-vili-daemon.cmd",
"restart-vili-daemon.ps1",
"run-hidden-powershell.vbs",
"run-vili-daemon.ps1",
"start-vili-daemon.ps1",
"vili-daemon.mjs"
)
foreach (`$name in `$scriptFiles) {
Copy-Item -LiteralPath (Join-Path `$syncRoot "scripts\`$name") -Destination (Join-Path `$scriptsRoot `$name) -Force
}
if (Test-Path -LiteralPath `$nodeModulesRoot) {
Remove-Item -LiteralPath `$nodeModulesRoot -Recurse -Force
}
Move-Item -LiteralPath (Join-Path `$syncRoot "node_modules") -Destination `$nodeModulesRoot -Force
& powershell.exe @(
"-NoProfile",
"-NonInteractive",
"-ExecutionPolicy", "Bypass",
"-File", (Join-Path `$scriptsRoot "install-vili-task.ps1"),
"-TaskName", "GameCult\Vili",
"-Port", "$Port",
"-HostName", "$HostName",
"-StateRoot", "$StateRoot",
"-IdunnRudpHealth", "$IdunnRudpHealth",
"-IdunnDaemon", "$IdunnDaemon",
"-IdunnHealthContract", "$IdunnHealthContract",
"-IdunnHealthIntervalSeconds", "$IdunnHealthIntervalSeconds"
)
& powershell.exe @(
"-NoProfile",
"-NonInteractive",
"-ExecutionPolicy", "Bypass",
"-File", (Join-Path `$scriptsRoot "restart-vili-daemon.ps1"),
"-Port", "$Port",
"-HostName", "$HostName",
"-StateRoot", "$StateRoot",
"-IdunnRudpHealth", "$IdunnRudpHealth",
"-IdunnDaemon", "$IdunnDaemon",
"-IdunnHealthContract", "$IdunnHealthContract",
"-IdunnHealthIntervalSeconds", "$IdunnHealthIntervalSeconds"
)
`$task = Get-ScheduledTask -TaskName "Vili" -TaskPath "\GameCult\" -ErrorAction Stop
`$action = @(`$task.Actions)[0]
if (`$action.Execute -notmatch '(^|\\)wscript\.exe$') {
throw "GameCult\Vili action executes `$(`$action.Execute), expected wscript.exe"
}
if (`$action.Arguments -notlike "*run-hidden-powershell.vbs*") {
throw "GameCult\Vili action arguments do not reference run-hidden-powershell.vbs"
}
`$taskHealthChecks = @(
(`$action.Arguments -like "*-IdunnRudpHealth*"),
(`$action.Arguments -like "*$IdunnRudpHealth*"),
(`$action.Arguments -like "*-IdunnDaemon*"),
(`$action.Arguments -like "*$IdunnDaemon*"),
(`$action.Arguments -like "*-IdunnHealthContract*"),
(`$action.Arguments -like "*$IdunnHealthContract*")
)
if (`$taskHealthChecks -contains `$false) {
throw "GameCult\Vili action arguments do not carry the Idunn RUDP health contract."
}
`$process = Get-CimInstance Win32_Process |
Where-Object { `$_.CommandLine -like '*vili-daemon.mjs*' } |
Select-Object -First 1
if (`$null -eq `$process) {
throw "Vili process is not running after restart."
}
`$processHealthChecks = @(
(`$process.CommandLine -like "*--idunn-rudp-health*"),
(`$process.CommandLine -like "*$IdunnRudpHealth*"),
(`$process.CommandLine -like "*--idunn-daemon*"),
(`$process.CommandLine -like "*$IdunnDaemon*"),
(`$process.CommandLine -like "*--idunn-health-contract*"),
(`$process.CommandLine -like "*$IdunnHealthContract*")
)
if (`$processHealthChecks -contains `$false) {
throw "Vili process command line does not include the Idunn RUDP health arguments."
}
`$operatorStatePath = Join-Path `$stateRoot "operator-state.json"
`$deadline = (Get-Date).AddSeconds(30)
`$state = `$null
while ((Get-Date) -lt `$deadline) {
if (Test-Path -LiteralPath `$operatorStatePath) {
try {
`$state = Get-Content -LiteralPath `$operatorStatePath -Raw | ConvertFrom-Json
if (`$null -ne `$state.idunnRudpHealth -and `$state.idunnRudpHealth.status -eq "published") {
break
}
} catch {
}
}
Start-Sleep -Seconds 1
}
if (`$null -eq `$state -or `$null -eq `$state.idunnRudpHealth) {
throw "Vili daemon state file did not report idunnRudpHealth after restart."
}
if (`$state.idunnRudpHealth.status -ne "published") {
throw "Vili idunnRudpHealth status is `$(`$state.idunnRudpHealth.status): `$(`$state.idunnRudpHealth.error)"
}
Write-Host "Vili Raven runtime repaired and restarted with Idunn RUDP health."
Write-Host "ProcessId=`$(`$process.ProcessId)"
Write-Host "TaskArguments=`$(`$action.Arguments)"
Write-Host "HealthStatus=`$(`$state.idunnRudpHealth.status)"
Write-Host "HealthContract=`$(`$state.idunnRudpHealth.contract)"
} finally {
Remove-Item -LiteralPath `$syncRoot -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -LiteralPath "$remoteBundlePs" -Force -ErrorAction SilentlyContinue
}
"@
$batchLines = @(
"put ""$localBundleZip"" ""$remoteBundleSftp""",
"put ""$localRemoteScript"" ""$remoteTempSftp"""
)
try {
$moduleCopies = @(
@{ Source = (Join-Path $LocalCultLibRoot "packages\cultnet-ts"); Destination = (Join-Path $localBundleNodeModules "cultnet-ts") },
@{ Source = (Join-Path $LocalCultLibRoot "packages\cultcache-ts"); Destination = (Join-Path $localBundleNodeModules "cultcache-ts") },
@{ Source = (Join-Path $LocalCultLibRoot "node_modules\ajv"); Destination = (Join-Path $localBundleNodeModules "ajv") },
@{ Source = (Join-Path $LocalCultLibRoot "node_modules\fast-deep-equal"); Destination = (Join-Path $localBundleNodeModules "fast-deep-equal") },
@{ Source = (Join-Path $LocalCultLibRoot "node_modules\fast-uri"); Destination = (Join-Path $localBundleNodeModules "fast-uri") },
@{ Source = (Join-Path $LocalCultLibRoot "node_modules\json-schema-traverse"); Destination = (Join-Path $localBundleNodeModules "json-schema-traverse") },
@{ Source = (Join-Path $LocalCultLibRoot "node_modules\require-from-string"); Destination = (Join-Path $localBundleNodeModules "require-from-string") },
@{ Source = (Join-Path $LocalViliRoot "node_modules\@msgpack"); Destination = (Join-Path $localBundleNodeModules "@msgpack") }
)
New-Item -ItemType Directory -Force -Path $localBundleScripts, $localBundleNodeModules | Out-Null
Copy-Item -LiteralPath (Join-Path $LocalViliRoot "package.json") -Destination (Join-Path $localBundleRoot "package.json") -Force
Copy-Item -LiteralPath (Join-Path $LocalViliRoot "package-lock.json") -Destination (Join-Path $localBundleRoot "package-lock.json") -Force
$scriptCopies = @(
"idunn-rudp.cjs",
"install-vili-task.ps1",
"restart-vili-daemon.cmd",
"restart-vili-daemon.ps1",
"run-hidden-powershell.vbs",
"run-vili-daemon.ps1",
"start-vili-daemon.ps1",
"vili-daemon.mjs"
)
foreach ($scriptName in $scriptCopies) {
Copy-Item -LiteralPath (Join-Path $LocalViliRoot "scripts\$scriptName") -Destination (Join-Path $localBundleScripts $scriptName) -Force
}
foreach ($copy in $moduleCopies) {
New-Item -ItemType Directory -Force -Path (Split-Path -Parent $copy.Destination) | Out-Null
Copy-Item -LiteralPath $copy.Source -Destination $copy.Destination -Recurse -Force
}
if (Test-Path -LiteralPath $localBundleZip) {
Remove-Item -LiteralPath $localBundleZip -Force
}
Compress-Archive -Path (Join-Path $localBundleRoot "*") -DestinationPath $localBundleZip -CompressionLevel Optimal
Set-Content -LiteralPath $localRemoteScript -Encoding ASCII -Value $remoteScript
Set-Content -LiteralPath $localSftpBatch -Encoding ASCII -Value ($batchLines -join "`r`n")
& sftp.exe -b $localSftpBatch $RavenHost
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$remoteRunner = @"
`$ErrorActionPreference = "Stop"
try {
& "$remoteTempPs"
`$code = `$LASTEXITCODE
} finally {
Remove-Item -LiteralPath "$remoteTempPs" -Force -ErrorAction SilentlyContinue
}
exit `$code
"@
$encodedRunner = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($remoteRunner))
& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $RavenHost "powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -EncodedCommand $encodedRunner"
} finally {
Remove-Item -LiteralPath $localRemoteScript, $localSftpBatch -Force -ErrorAction SilentlyContinue
Remove-Item -LiteralPath $localBundleZip -Force -ErrorAction SilentlyContinue
Remove-Item -LiteralPath $localBundleRoot -Recurse -Force -ErrorAction SilentlyContinue
}
$restartExit = $LASTEXITCODE
exit $restartExit

View file

@ -1,10 +0,0 @@
@echo off
if not "%IDUNN_ACTUATOR%"=="1" (
echo restart-weksa.cmd is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
exit /b 1
)
if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
echo restart-weksa.cmd is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
exit /b 1
)
call %~dp0..\..\weksa\scripts\restart-weksa-daemon.cmd

View file

@ -1,68 +0,0 @@
param(
[string] $StateDir = (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\odin"),
[string] $CultNetRudpBind = "0.0.0.0:17871",
[string] $IdunnRudpHealth = $(if ($env:ODIN_IDUNN_RUDP_HEALTH) { $env:ODIN_IDUNN_RUDP_HEALTH } else { $env:IDUNN_RUDP_HEALTH }),
[string] $IdunnDaemon = "odin",
[string] $IdunnHealthContract = "odin.cultnet-rudp-provider-health",
[switch] $Foreground
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$scriptPath = Join-Path $repoRoot "src\odin-coordinator.cjs"
$pidPath = Join-Path $StateDir "odin.pid"
$outLog = Join-Path $StateDir "odin.out.log"
$errLog = Join-Path $StateDir "odin.err.log"
$nodeExe = (Get-Command node.exe -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty Source)
if (-not $nodeExe) {
$nodeExe = "C:\Program Files\nodejs\node.exe"
}
if (-not (Test-Path -LiteralPath $nodeExe)) {
throw "Node.js executable is missing; checked PATH and $nodeExe"
}
if ([string]::IsNullOrWhiteSpace($IdunnRudpHealth)) {
throw "Odin Idunn health publication requires -IdunnRudpHealth, ODIN_IDUNN_RUDP_HEALTH, or IDUNN_RUDP_HEALTH; no localhost default is assumed."
}
New-Item -ItemType Directory -Force -Path $StateDir | Out-Null
if (Test-Path $pidPath) {
$oldPid = (Get-Content -Raw $pidPath).Trim()
if ($oldPid -match "^\d+$") {
$old = Get-Process -Id ([int] $oldPid) -ErrorAction SilentlyContinue
if ($old) {
throw "Odin already appears to be running as PID $oldPid."
}
}
Remove-Item -LiteralPath $pidPath -Force
}
$env:NODE_PATH = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "CultLib\packages")
$args = @(
$scriptPath,
"--stateDir", $StateDir,
"--cultnet-rudp-bind", $CultNetRudpBind,
"--idunn-rudp-health", $IdunnRudpHealth,
"--idunn-daemon", $IdunnDaemon,
"--idunn-health-contract", $IdunnHealthContract
)
if ($Foreground) {
& $nodeExe @args
exit $LASTEXITCODE
}
$proc = Start-Process -FilePath $nodeExe -ArgumentList $args -WorkingDirectory $repoRoot -WindowStyle Hidden -PassThru -RedirectStandardOutput $outLog -RedirectStandardError $errLog
$proc.Id | Set-Content -Encoding ASCII -LiteralPath $pidPath
Start-Sleep -Seconds 1
if ($proc.HasExited) {
$detail = ""
if (Test-Path $outLog) { $detail += Get-Content -Raw $outLog }
if (Test-Path $errLog) { $detail += Get-Content -Raw $errLog }
throw "Odin exited immediately with code $($proc.ExitCode).`n$detail"
}
Write-Host "Odin started as PID $($proc.Id)."
Write-Host "CultMesh/RUDP document catalog: $CultNetRudpBind"

View file

@ -1,22 +0,0 @@
param(
[string] $StateDir = (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\odin")
)
$ErrorActionPreference = "Stop"
$pidPath = Join-Path $StateDir "odin.pid"
if (-not (Test-Path $pidPath)) {
Write-Host "No Odin PID file found at $pidPath."
exit 0
}
$odinPid = (Get-Content -Raw $pidPath).Trim()
if ($odinPid -match "^\d+$") {
$process = Get-Process -Id ([int] $odinPid) -ErrorAction SilentlyContinue
if ($process) {
Stop-Process -Id $process.Id
Write-Host "Stopped Odin PID $odinPid."
}
}
Remove-Item -LiteralPath $pidPath -Force

View file

@ -1,212 +0,0 @@
#!/usr/bin/env node
"use strict";
const fs = require("fs");
const path = require("path");
const { buildConfig, loadCultRuntime } = require("./odin/config.cjs");
const { createCultMeshRudpDocumentServer } = require("./odin/cultnet-rudp.cjs");
const { defineOdinDocuments } = require("./odin/documents.cjs");
const { createInterfaceDiscovery } = require("./odin/interfaces.cjs");
const { createIdunnRudpHealthPublisher, publishIdunnRudpHealth } = require("./odin/idunn-rudp.cjs");
const { createLayoutStore } = require("./odin/layout.cjs");
const { createLiveProviderRegistry } = require("./odin/provider-ingress.cjs");
const { createStateBuilder } = require("./odin/state.cjs");
const config = buildConfig(process.argv.slice(2));
fs.mkdirSync(config.stateDir, { recursive: true });
const idunnRudpHealthPublisher = createIdunnRudpHealthPublisher(config.idunnRudpHealth);
const cultRuntime = loadCultRuntime();
if (cultRuntime.error) {
console.error("CultMesh runtime unavailable; durable mesh catalog disabled:", cultRuntime.error.message);
}
const documents = defineOdinDocuments(cultRuntime.defineDocumentType);
const allDocumentDefinitions = Object.values(documents).filter(Boolean);
const layoutStore = createLayoutStore({
definition: documents.interfaceLayoutDefinition,
getNode: async () => meshNodePromise ? await meshNodePromise : null,
layoutPath: config.layoutPath,
});
const liveProviderRegistry = createLiveProviderRegistry();
const interfaceDiscovery = createInterfaceDiscovery({
CultMesh: cultRuntime.CultMesh,
documents,
interfaceBindingStores: config.interfaceBindingStores,
liveProviderRegistry,
});
const stateBuilder = createStateBuilder({
cachePath: config.cachePath,
gamecultTextDocumentStorePath: config.gamecultTextDocumentStorePath,
interfaceDiscovery,
layoutStore,
stonksBurstSize: config.stonksBurstSize,
});
let meshNodePromise = null;
let cultMeshRudpDocumentServer = null;
let currentState = stateBuilder.buildPendingState("Coordinator starting");
let lastRefresh = {
completedAt: null,
durationMs: null,
error: null,
startedAt: null,
};
let lastIdunnRudpHealthPublishedAt = null;
let observedRudpDocuments = 0;
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
async function main() {
if (cultRuntime.CultMesh && documents.surfaceDefinition) {
meshNodePromise = createDurableSurfaceNode();
}
if (config.cultnetRudpBind) {
cultMeshRudpDocumentServer = createCultMeshRudpDocumentServer({
CultMesh: cultRuntime.CultMesh,
bind: config.cultnetRudpBind,
documents,
getCache: async () => {
if (!meshNodePromise) {
throw new Error("CultMesh runtime is unavailable; Odin cannot serve a CultMesh/RUDP document catalog.");
}
return (await meshNodePromise).cache;
},
onDocumentPutRaw: async (document) => {
if (observedRudpDocuments < 40) {
observedRudpDocuments += 1;
console.error(
`Odin RUDP document #${observedRudpDocuments} schema=${document.schemaId} key=${document.recordKey} source=${document.sourceRuntimeId || "unknown"} remote=${document.remote?.address}:${document.remote?.port}`,
);
}
liveProviderRegistry.ingestDocument(document, document.remote);
await persistRudpDocumentPut(document);
},
});
await cultMeshRudpDocumentServer.start();
console.log(`CultMesh/RUDP document catalog: ${config.cultnetRudpBind}`);
}
console.log(`Durable surface cache: ${config.cachePath}`);
await refresh();
scheduleRefresh();
}
async function persistRudpDocumentPut(document) {
if (!meshNodePromise || !document?.schemaId || !document?.recordKey) return;
const definition = documentDefinitionForSchema(document.schemaId);
if (!definition) return;
const node = await meshNodePromise;
await node.put(definition, document.recordKey, normalizeRudpPayload(document.payload));
}
function documentDefinitionForSchema(schemaId) {
return allDocumentDefinitions.find((definition) =>
definition?.schemaId === schemaId
|| definition?.schemaVersion === schemaId
|| definition?.schemaName === schemaId
|| definition?.type === schemaId
);
}
function normalizeRudpPayload(payload) {
if (Array.isArray(payload) && payload.length === 1 && payload[0] && typeof payload[0] === "object" && !Array.isArray(payload[0])) {
return payload[0];
}
return payload;
}
function scheduleRefresh() {
setTimeout(() => {
refresh()
.catch((error) => console.error("refresh failed:", error))
.finally(() => scheduleRefresh());
}, config.intervalMs);
}
async function createDurableSurfaceNode() {
try {
return await cultRuntime.CultMesh.createNode(config.cachePath, { documents: allDocumentDefinitions });
} catch (error) {
if (!fs.existsSync(config.cachePath)) {
throw error;
}
const corruptPath = `${config.cachePath}.corrupt-${new Date().toISOString().replace(/[:.]/g, "-")}`;
fs.renameSync(config.cachePath, corruptPath);
console.error(`CultMesh surface cache was unreadable and has been quarantined: ${corruptPath}`);
console.error(`CultMesh surface cache read error: ${error.message}`);
return cultRuntime.CultMesh.createNode(config.cachePath, { documents: allDocumentDefinitions });
}
}
async function refresh() {
const started = Date.now();
lastRefresh = {
completedAt: null,
durationMs: null,
error: null,
startedAt: new Date(started).toISOString(),
};
try {
currentState = await stateBuilder.buildState();
await persistState(currentState);
lastRefresh = {
completedAt: new Date().toISOString(),
durationMs: Date.now() - started,
error: null,
startedAt: new Date(started).toISOString(),
};
await publishOdinHealth("active", `Odin provider catalog refreshed in ${lastRefresh.durationMs}ms`);
} catch (error) {
lastRefresh = {
completedAt: new Date().toISOString(),
durationMs: Date.now() - started,
error: error.message,
startedAt: new Date(started).toISOString(),
};
await publishOdinHealth("failed", `Odin provider refresh failed: ${error.message}`);
throw error;
}
}
async function publishOdinHealth(state, detail) {
if (!idunnRudpHealthPublisher) return;
try {
await publishIdunnRudpHealth(idunnRudpHealthPublisher, {
state,
detail,
observedAt: new Date().toISOString(),
});
lastIdunnRudpHealthPublishedAt = Date.now();
} catch (error) {
const lastPublishedAgeMs = lastIdunnRudpHealthPublishedAt === null
? Number.POSITIVE_INFINITY
: Date.now() - lastIdunnRudpHealthPublishedAt;
if (lastPublishedAgeMs > Math.max(60_000, config.intervalMs * 4)) {
console.error("Idunn RUDP health publish failed:", error.message);
}
}
}
async function persistState(state) {
if (config.writeDebugSurfaceJson) {
fs.writeFileSync(path.join(config.stateDir, "latest-surface.json"), JSON.stringify(state, null, 2), "utf8");
}
if (!meshNodePromise || !documents.surfaceDefinition) {
return;
}
try {
const node = await meshNodePromise;
await node.put(documents.surfaceDefinition, config.surfaceKey, state);
await node.flush?.(true);
} catch (error) {
console.error("CultMesh snapshot write failed:", error.message);
}
}

View file

@ -1,73 +0,0 @@
"use strict";
const Module = require("module");
const path = require("path");
const { parseArgs } = require("./utils.cjs");
const repoRoot = path.resolve(__dirname, "..", "..");
process.env.NODE_PATH = [
path.resolve(repoRoot, "..", "CultLib", "packages"),
process.env.NODE_PATH || "",
].filter(Boolean).join(path.delimiter);
Module._initPaths();
function buildConfig(argv) {
const args = parseArgs(argv);
const cultnetRudpBind = args["cultnet-rudp-bind"] ? String(args["cultnet-rudp-bind"]) : "";
const intervalMs = Number(args.intervalMs || 5000);
const stateDir = args.stateDir || path.join(repoRoot, "scratch", "odin");
const cachePath = args.cachePath || path.join(stateDir, "odin.ccmp");
const layoutPath = args.layoutPath || path.join(stateDir, "interface-layout.json");
const writeDebugSurfaceJson = Boolean(args.writeDebugSurfaceJson || args["write-debug-surface-json"] || process.env.ODIN_WRITE_DEBUG_SURFACE_JSON === "1");
if (args.observationLogPath || args.observationFreshSeconds) {
throw new Error("Odin no longer tails Mimir observation logs. Publish observation records through CultMesh/Odin provider discovery instead.");
}
const gamecultTextDocumentStorePath = args.gamecultTextDocumentStorePath || path.join(repoRoot, "..", "VoidBot", ".voidbot", "private", "gamecult-text-documents.cc");
const stonksBurstSize = Math.max(1, Number(args.stonksBurstSize || 8));
const idunnRudpHealth = args["idunn-rudp-health"] ? {
endpoint: String(args["idunn-rudp-health"]),
daemonId: String(args["idunn-daemon"] || "odin"),
healthContract: String(args["idunn-health-contract"] || "odin.cultnet-rudp-provider-health"),
privateKeyPath: args["idunn-health-private-key"]
? String(args["idunn-health-private-key"])
: "",
sourceRuntimeId: String(args["idunn-source-runtime"] || "odin-coordinator"),
} : null;
const interfaceBindingStores = String(
args.interfaceBindingStore ||
process.env.ODIN_INTERFACE_BINDING_STORES ||
"",
)
.split(",")
.map((entry) => entry.trim())
.filter(Boolean);
return {
args,
cachePath,
cultnetRudpBind,
gamecultTextDocumentStorePath,
interfaceBindingStores,
idunnRudpHealth,
intervalMs,
layoutPath,
repoRoot,
stateDir,
stonksBurstSize,
surfaceKey: "surface:gamecult.network.status",
writeDebugSurfaceJson,
};
}
function loadCultRuntime() {
try {
const { CultMesh } = require("cultmesh-ts");
const { defineDocumentType } = require("cultcache-ts");
return { CultMesh, defineDocumentType, error: null };
} catch (error) {
return { CultMesh: null, defineDocumentType: null, error };
}
}
module.exports = { buildConfig, loadCultRuntime, repoRoot };

View file

@ -1,115 +0,0 @@
"use strict";
const path = require("path");
const { createRequire } = require("module");
const { createSocket } = require("dgram");
const requireCultNet = createRequire(path.resolve(
__dirname,
"..",
"..",
"..",
"CultLib",
"packages",
"cultnet-ts",
"package.json",
));
const {
CultNetDocumentRegistry,
decodeRudpPacket,
defineCultNetDocumentBinding,
} = requireCultNet("./dist/index.js");
const ODIN_RUDP_CONNECTION_ID = 0x0d1d0002;
function createCultMeshRudpDocumentServer(options) {
if (!options?.bind) return null;
if (!options.CultMesh?.createRudpDocumentServer) {
throw new Error("Odin requires a CultMesh runtime with createRudpDocumentServer.");
}
if (!options.documents?.surfaceDefinition) {
throw new Error("Odin CultMesh/RUDP document server requires a surface document definition.");
}
if (typeof options.getCache !== "function") {
throw new Error("Odin CultMesh/RUDP document server requires an async getCache function.");
}
const bind = parseEndpoint(options.bind);
const socket = createSocket(bind.host.includes(":") ? "udp6" : "udp4");
let observedPackets = 0;
socket.on("message", (wire, remote) => {
if (observedPackets >= 20) return;
observedPackets += 1;
try {
const packet = decodeRudpPacket(wire);
console.error(
`Odin RUDP observed packet #${observedPackets} ${packet.packetType} connection=${packet.connectionId.toString(16)} channel=${packet.channelId} from ${remote.address}:${remote.port} bytes=${wire.length}`,
);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
console.error(
`Odin RUDP observed undecodable packet #${observedPackets} from ${remote.address}:${remote.port} bytes=${wire.length}: ${message}`,
);
}
});
const registry = new CultNetDocumentRegistry(
Object.values(options.documents)
.filter(Boolean)
.map((definition) => defineCultNetDocumentBinding({ definition })),
);
const server = options.CultMesh.createRudpDocumentServer(
"odin-cultmesh-catalog",
ODIN_RUDP_CONNECTION_ID,
{
bindHost: bind.host,
bindPort: bind.port,
documents: registry,
socket,
getCache: options.getCache,
onError: (error) => {
const message = error instanceof Error ? error.message : String(error);
if (typeof options.logError === "function") {
options.logError(`CultMesh/RUDP document server error: ${message}`);
return;
}
console.error(`CultMesh/RUDP document server error: ${message}`);
},
onDocumentPutRaw: (document) => {
if (typeof options.onDocumentPutRaw === "function") {
return options.onDocumentPutRaw(document);
}
return undefined;
},
},
);
return {
bind,
start: () => server.start(),
close: () => server.close(),
};
}
function parseEndpoint(value) {
const text = String(value || "").trim();
const ipv6 = text.match(/^\[([^\]]+)\]:(\d+)$/);
if (ipv6) return { host: ipv6[1], port: parsePort(ipv6[2]) };
const index = text.lastIndexOf(":");
if (index <= 0) {
throw new Error(`CultMesh/RUDP bind must be host:port, got "${value}".`);
}
return { host: text.slice(0, index), port: parsePort(text.slice(index + 1)) };
}
function parsePort(value) {
const port = Number(value);
if (!Number.isInteger(port) || port <= 0 || port > 65535) {
throw new Error(`CultMesh/RUDP port is invalid: ${value}`);
}
return port;
}
module.exports = {
createCultMeshRudpDocumentServer,
};

View file

@ -1,26 +0,0 @@
"use strict";
// The swarm document-type catalog, as Odin consumes it.
//
// The 45 definitions used to live here. Almost none of them are Odin's: they
// describe documents that cross service boundaries, and every service that
// decodes another's documents needs the same ones. They lived here because Odin
// was written first. They now live in CultLib as cultcache-ts's
// defineSwarmDocuments, beside the defineDocumentType that builds them, so
// Hermodr can leave without forking a second definition of one wire format.
const path = require("path");
const { createRequire } = require("module");
const cultLibRoot = process.env.CULTLIB_ROOT
? path.resolve(process.env.CULTLIB_ROOT)
: path.resolve(__dirname, "..", "..", "..", "CultLib");
const requireCultCache = createRequire(path.resolve(cultLibRoot, "packages", "cultcache-ts", "package.json"));
const { defineSwarmDocuments } = requireCultCache("./dist/index.js");
// Odin's consumers know this name. The catalog is not Odin's, but the call is.
const defineOdinDocuments = defineSwarmDocuments;
module.exports = { defineOdinDocuments, defineSwarmDocuments };

View file

@ -1,65 +0,0 @@
"use strict";
// Idunn health publication, as Odin consumes it.
//
// The transport used to live here: 300-odd lines of socket handling, RUDP
// handshaking, Ed25519 signing, and packet receipt, of which almost nothing was
// about Idunn. That is generic CultNet client work and now lives in CultLib as
// cultnet-ts's signed-daemon-health module.
//
// What remains is what Odin actually needs to know: Idunn's wire contract, and
// the shape of the calls its consumers already make. The constants are defined
// by Idunn in docs/signed-daemon-health-authority.md. They are declared here,
// not decided here; if they change, that document changes first.
const path = require("path");
const { createRequire } = require("module");
const cultLibRoot = process.env.CULTLIB_ROOT
? path.resolve(process.env.CULTLIB_ROOT)
: path.resolve(__dirname, "..", "..", "..", "CultLib");
const requireCultNet = createRequire(path.resolve(cultLibRoot, "packages", "cultnet-ts", "package.json"));
const {
CULTNET_RUDP_PROTOCOL_ID,
createSignedDaemonHealthPublisher,
publishSignedDaemonHealth,
signedDaemonHealthPayload,
signedDaemonHealthSigningMessage,
} = requireCultNet("./dist/index.js");
// Idunn's contract. Owner: GameCult/Idunn, docs/signed-daemon-health-authority.md.
const IDUNN_HEALTH_CONTRACT = Object.freeze({
connectionId: 0x1d0d0001,
signedSchemaId: "idunn.signed_daemon_health.v1",
unsignedSchemaId: "idunn.daemon_health",
messageIdPrefix: "odin-health",
});
function createIdunnRudpHealthPublisher(options) {
if (!options) return null;
return createSignedDaemonHealthPublisher({
sourceRuntimeId: "odin-coordinator",
...options,
contract: IDUNN_HEALTH_CONTRACT,
});
}
const publishIdunnRudpHealth = publishSignedDaemonHealth;
const signedHealthPayload = signedDaemonHealthPayload;
// The signing purpose is Idunn's signed schema id, so a statement signed for
// Idunn cannot verify as another service's health.
function signingMessage(payload) {
return signedDaemonHealthSigningMessage(IDUNN_HEALTH_CONTRACT.signedSchemaId, payload);
}
module.exports = {
CULTNET_RUDP_PROTOCOL_ID,
IDUNN_HEALTH_CONTRACT,
createIdunnRudpHealthPublisher,
publishIdunnRudpHealth,
signedHealthPayload,
signingMessage,
};

File diff suppressed because it is too large Load diff

View file

@ -1,279 +0,0 @@
"use strict";
const fs = require("fs");
const { clampNumber, positiveNumber, stableId } = require("./utils.cjs");
const DEFAULT_LAYOUT_ID = "odin.providers";
function createLayoutStore({ definition, getNode, layoutPath } = {}) {
let cachedLayout = null;
let attemptedMigration = false;
return {
async readLayout() {
const meshLayout = await readCultMeshLayout();
if (meshLayout) return meshLayout;
if (!attemptedMigration) {
attemptedMigration = true;
const migrated = readJsonMigrationLayout(layoutPath);
if (migrated) {
cachedLayout = migrated;
await this.writeLayout(migrated).catch(() => undefined);
return normalizeLayout(migrated);
}
}
return cachedLayout || defaultLayout();
},
async writeLayout(layout) {
const normalized = normalizeLayout(layout);
cachedLayout = normalized;
const node = await layoutNode();
if (!node || !definition) {
throw new Error("Odin CultMesh layout store unavailable; refusing to write layout sidecar fallback.");
}
await node.put(definition, DEFAULT_LAYOUT_ID, normalized);
await node.flush?.(true);
},
async applyClientCommand(command) {
if (!command || command.type !== "odin-layout-intent" || !command.providerId) return;
const layout = await this.readLayout();
layout.updatedAt = new Date().toISOString();
layout.tiles ||= {};
const current = layout.tiles[command.providerId] || defaultLayoutFor({ providerId: command.providerId }, []);
const next = { ...current };
if (command.action === "focus") {
Object.assign(next, fullscreenLayoutIntent(command.providerId, -100));
} else if (command.action === "resize") {
next.w = clampNumber((next.w || 1) + Number(command.dw || 0), 1, 4);
next.h = clampNumber((next.h || 1) + Number(command.dh || 0), 1, 4);
} else if (command.action === "move") {
next.x = clampNumber((next.x || 0) + Number(command.dx || 0), 0, 12);
next.y = clampNumber((next.y || 0) + Number(command.dy || 0), 0, 12);
} else if (command.action === "toggle") {
next.visible = !next.visible;
} else {
return;
}
layout.tiles[command.providerId] = next;
await this.writeLayout(layout);
},
};
async function readCultMeshLayout() {
const node = await layoutNode();
if (!node || !definition) return null;
const record = await node.get(definition, DEFAULT_LAYOUT_ID);
const normalized = record ? normalizeLayout(record) : null;
if (normalized) cachedLayout = normalized;
return normalized;
}
async function layoutNode() {
return typeof getNode === "function" ? await getNode() : null;
}
}
function defaultLayout() {
return { schema: "odin.interface_layout.v1", layoutId: DEFAULT_LAYOUT_ID, tiles: {} };
}
function normalizeLayout(layout) {
return {
...defaultLayout(),
...(layout && typeof layout === "object" ? layout : {}),
schema: "odin.interface_layout.v1",
layoutId: DEFAULT_LAYOUT_ID,
tiles: layout && typeof layout.tiles === "object" && layout.tiles ? layout.tiles : {},
};
}
function readJsonMigrationLayout(layoutPath) {
if (!layoutPath) return null;
try {
return normalizeLayout(JSON.parse(fs.readFileSync(layoutPath, "utf8")));
} catch {
return null;
}
}
function defaultLayoutFor(entry, interfaces) {
const index = Math.max(0, interfaces.findIndex((candidate) => candidate.providerId === entry.providerId));
const intent = surfaceLayoutIntent(entry);
const preferredHeight = positiveNumber(intent.preferredHeight, entry.providerId === "voidbot.swarm" ? 18 : 12);
const minHeight = positiveNumber(intent.minHeight, 6);
const preferredWidth = positiveNumber(intent.preferredWidth, 72);
const minWidth = positiveNumber(intent.minWidth, 36);
const priority = Number.isFinite(intent.priority) ? intent.priority : index;
return {
tileId: stableId(entry.providerId || "interface"),
visible: true,
priority,
x: index % 2,
y: Math.floor(index / 2),
w: 1,
h: Math.max(1, Math.ceil(preferredHeight / 12)),
minWidth,
minHeight,
preferredWidth,
preferredHeight,
density: intent.density || "dense",
viewportMode: intent.viewportMode || "nested-scroll",
signalWeight: intent.signalWeight || 1,
tree: intent.tree || null,
};
}
function fullscreenLayoutIntent(tileId, priority = -100) {
return {
tileId: stableId(tileId || "fullscreen"),
visible: true,
priority,
x: 0,
y: 0,
w: 4,
h: 4,
minWidth: 96,
minHeight: 36,
preferredWidth: 192,
preferredHeight: 48,
density: "comfortable",
viewportMode: "fullscreen",
};
}
function mergeLayoutIntent(existing, entry, interfaces) {
const base = existing && typeof existing === "object"
? { ...existing }
: defaultLayoutFor(entry, interfaces);
const intent = surfaceLayoutIntent(entry);
const fallback = defaultLayoutFor(entry, interfaces);
const denseTree = isDenseLayoutStrategy(intent.layoutStrategy);
const minWidth = positiveNumber(intent.minWidth, positiveNumber(base.minWidth, fallback.minWidth));
const minHeight = positiveNumber(intent.minHeight, positiveNumber(base.minHeight, fallback.minHeight));
const preferredWidth = positiveNumber(intent.preferredWidth, positiveNumber(base.preferredWidth, fallback.preferredWidth));
const preferredHeight = positiveNumber(intent.preferredHeight, positiveNumber(base.preferredHeight, fallback.preferredHeight));
const desiredW = Math.max(1, Math.min(4, Math.ceil(preferredWidth / 72)));
const desiredH = Math.max(1, Math.min(4, Math.ceil(preferredHeight / 12)));
return {
...base,
minWidth,
minHeight,
preferredWidth,
preferredHeight,
h: denseTree && intent.viewportMode !== "fullscreen" ? desiredH : Math.max(positiveNumber(base.h, fallback.h), desiredH),
w: denseTree && intent.viewportMode !== "fullscreen" ? desiredW : Math.max(positiveNumber(base.w, fallback.w), desiredW),
priority: Number.isFinite(intent.priority) ? Math.min(Number(base.priority ?? intent.priority), intent.priority) : base.priority,
density: intent.density || base.density || fallback.density,
viewportMode: intent.viewportMode || base.viewportMode || fallback.viewportMode,
layoutStrategy: intent.layoutStrategy || base.layoutStrategy || fallback.layoutStrategy,
signalWeight: intent.signalWeight || base.signalWeight || fallback.signalWeight || 1,
tree: intent.tree || base.tree || fallback.tree || null,
};
}
function surfaceLayoutIntent(entry) {
const root = entry?.surface?.root;
if (!root || typeof root !== "object") return {};
const layout = root.layout && typeof root.layout === "object" ? root.layout : {};
const props = root.props && typeof root.props === "object" ? root.props : {};
const propLayout = props.layout && typeof props.layout === "object" ? props.layout : {};
const tree = analyzeElementTree(root);
const derived = denseTreeLayoutIntent(tree);
return normalizeDenseSurfaceIntent({ ...derived, ...propLayout, ...layout, tree }, derived);
}
function analyzeElementTree(root) {
const stats = {
elementCount: 0,
leafCount: 0,
branchCount: 0,
maxDepth: 0,
textCells: 0,
listLikeBranchCount: 0,
kindCounts: {},
};
visit(root, 1);
stats.signalWeight = Math.max(1, stats.branchCount * 2 + stats.leafCount + Math.ceil(stats.textCells / 48));
return stats;
function visit(element, depth) {
if (!element || typeof element !== "object") return;
stats.elementCount += 1;
stats.maxDepth = Math.max(stats.maxDepth, depth);
const kind = String(element.kind || "unknown");
stats.kindCounts[kind] = (stats.kindCounts[kind] || 0) + 1;
const text = textValue(element);
stats.textCells += text.length + Math.max(0, text.split(/\r?\n/).length - 1) * 8;
const children = Array.isArray(element.children) ? element.children.filter((child) => child && typeof child === "object") : [];
if (!children.length) {
stats.leafCount += 1;
return;
}
stats.branchCount += 1;
if (children.length >= 4 && children.every((child) => String(child.kind || "") === "text" && !(Array.isArray(child.children) && child.children.length))) {
stats.listLikeBranchCount += 1;
}
for (const child of children) visit(child, depth + 1);
}
}
function denseTreeLayoutIntent(tree) {
const signal = Math.max(1, tree.signalWeight || 1);
const depthPressure = Math.max(0, tree.maxDepth - 2);
const textPressure = Math.sqrt(Math.max(1, tree.textCells) / 18);
const branchPressure = Math.sqrt(Math.max(1, tree.branchCount));
return {
minWidth: Math.min(72, 28 + depthPressure * 7),
minHeight: Math.min(18, 5 + depthPressure * 2),
preferredWidth: Math.min(144, 44 + Math.sqrt(signal) * 7 + depthPressure * 5),
preferredHeight: Math.min(36, 8 + textPressure + branchPressure * 3 + tree.listLikeBranchCount * 2),
density: "dense",
viewportMode: "nested-scroll",
layoutStrategy: "dense-tree",
signalWeight: signal,
};
}
function normalizeDenseSurfaceIntent(intent, derived) {
const viewportMode = intent.viewportMode || derived.viewportMode;
if (viewportMode === "fullscreen") {
return intent;
}
return {
...intent,
minWidth: Math.min(72, positiveNumber(intent.minWidth, derived.minWidth)),
minHeight: Math.min(18, positiveNumber(intent.minHeight, derived.minHeight)),
preferredWidth: Math.min(144, positiveNumber(intent.preferredWidth, derived.preferredWidth)),
preferredHeight: Math.min(36, positiveNumber(intent.preferredHeight, derived.preferredHeight)),
density: intent.density || derived.density || "dense",
viewportMode,
layoutStrategy: intent.layoutStrategy || derived.layoutStrategy || "dense-tree",
signalWeight: intent.signalWeight || derived.signalWeight || 1,
};
}
function isDenseLayoutStrategy(strategy) {
const value = String(strategy || "");
return value === "dense-tree" || value.startsWith("dense-");
}
function textValue(element) {
if (typeof element.text === "string") return element.text;
const props = element.props && typeof element.props === "object" ? element.props : {};
if (typeof props.text === "string") return props.text;
if (typeof props.title === "string") return props.title;
return "";
}
module.exports = {
analyzeElementTree,
createLayoutStore,
defaultLayoutFor,
denseTreeLayoutIntent,
fullscreenLayoutIntent,
mergeLayoutIntent,
surfaceLayoutIntent,
};

View file

@ -1,111 +0,0 @@
"use strict";
const fs = require("fs");
const {
CultCache,
SingleFileMessagePackBackingStore,
defineDocumentRegistry,
defineDocumentType,
} = require("cultcache-ts");
const textDocumentSetDefinition = defineDocumentType({
type: "gamecult.text_document_set",
global: true,
schema: {
parse(value) {
if (!value || typeof value !== "object") {
throw new Error("gamecult.text_document_set must be an object");
}
return value;
},
},
});
async function buildMarqueeText({ interfaces, textDocumentStorePath, stonksBurstSize = 8 }) {
const [securities, stanzas] = await Promise.all([
Promise.resolve(stonksSegments({ interfaces })),
poetryStanzas(textDocumentStorePath),
]);
return stanzaBurstTape(stanzas, securities, stonksBurstSize).join(" / ");
}
function stonksSegments({ interfaces }) {
return stonksSegmentsFromInterfaces(interfaces);
}
function stonksSegmentsFromInterfaces(interfaces) {
const stonks = interfaces.find((entry) => String(entry.providerId || "").toLowerCase() === "stonks.market");
const explicit = String(stonks?.surface?.root?.props?.marqueeText || "").trim();
return splitSegments(explicit).slice(0, 16);
}
async function poetryStanzas(textDocumentStorePath) {
if (!textDocumentStorePath || !fs.existsSync(textDocumentStorePath)) return [];
try {
const cache = CultCache.builder()
.withRegistry(defineDocumentRegistry(textDocumentSetDefinition))
.withGenericStore(new SingleFileMessagePackBackingStore(textDocumentStorePath))
.build();
await cache.pullAllBackingStores();
const documentSet = cache.getGlobal(textDocumentSetDefinition);
return array(documentSet?.documents).flatMap(documentStanzas);
} catch {
return [];
}
}
function documentStanzas(document) {
const stanzas = [];
let stanza = [];
for (const line of array(document?.lines)) {
if (isStanzaMarker(line)) {
pushStanza(stanzas, stanza);
stanza = [];
continue;
}
const text = array(line).join(" / ").replace(/\s+/g, " ").trim();
if (text) stanza.push(text);
}
pushStanza(stanzas, stanza);
return stanzas;
}
function pushStanza(stanzas, stanza) {
if (stanza.length) stanzas.push(stanza.join(" / "));
}
function stanzaBurstTape(stanzas, securities, burstSize) {
const output = [];
const stonkBurstSize = Math.max(1, Number(burstSize) || 8);
const stanzaList = stanzas.length ? stanzas : [];
const securityList = securities.length ? securities : [];
const cycles = Math.max(stanzaList.length, securityList.length ? Math.ceil(securityList.length / stonkBurstSize) : 0);
for (let index = 0; index < cycles; index += 1) {
if (stanzaList.length) output.push(stanzaList[index % stanzaList.length]);
for (let offset = 0; offset < stonkBurstSize && securityList.length; offset += 1) {
output.push(securityList[(index * stonkBurstSize + offset) % securityList.length]);
}
}
return output;
}
function splitSegments(text) {
return String(text || "")
.split(/\s+\/\s+/)
.map((segment) => segment.replace(/\s+/g, " ").trim())
.filter(Boolean);
}
function isStanzaMarker(line) {
const parts = array(line);
return parts.length === 1 && String(parts[0]).trim().toLowerCase() === "[stanza]";
}
function array(value) {
return Array.isArray(value) ? value : [];
}
module.exports = {
buildMarqueeText,
};

View file

@ -1,48 +0,0 @@
"use strict";
const fs = require("fs");
const path = require("path");
const { execFile } = require("child_process");
const { promisify } = require("util");
const execFileAsync = promisify(execFile);
async function dockerSnapshot() {
try {
const { stdout } = await execFileAsync("docker", ["ps", "--format", "{{json .}}"], { timeout: 3000 });
const containers = stdout.split(/\r?\n/)
.filter(Boolean)
.map((line) => JSON.parse(line))
.map((item) => ({
name: item.Names,
image: item.Image,
status: item.Status,
ports: item.Ports,
}));
return { state: "ok", containers, error: "" };
} catch (error) {
return { state: "error", containers: [], error: error.message };
}
}
async function adbSnapshot() {
const adb = path.join(process.env.LOCALAPPDATA || "", "Android", "Sdk", "platform-tools", "adb.exe");
if (!fs.existsSync(adb)) {
return { state: "missing", devices: [], error: `missing ${adb}` };
}
try {
const { stdout } = await execFileAsync(adb, ["devices"], { timeout: 3000 });
const devices = stdout.split(/\r?\n/)
.map((line) => line.match(/^(\S+)\s+(device|offline|unauthorized)$/))
.filter(Boolean)
.map((match) => ({ serial: match[1], state: match[2] }));
return { state: "ok", devices, error: "" };
} catch (error) {
return { state: "error", devices: [], error: error.message };
}
}
module.exports = {
adbSnapshot,
dockerSnapshot,
};

View file

@ -1,278 +0,0 @@
"use strict";
function createLiveProviderRegistry(options = {}) {
const maxAgeMs = Math.max(1_000, Number(options.maxAgeMs || 120_000));
const records = new Map();
function ingestDocument(document, source = {}) {
if (!document?.schemaId || !document?.recordKey) {
return;
}
const now = Date.now();
records.set(`${document.schemaId}:${document.recordKey}`, {
...document,
receivedAtMs: now,
source,
});
prune(now);
}
function snapshot() {
const now = Date.now();
prune(now);
const advertisements = new Map();
const surfaces = new Map();
const commandBoundaries = new Map();
const transportProfiles = new Map();
for (const record of records.values()) {
const payload = normalizeDocumentPayload(record);
switch (record.schemaId) {
case "gamecult.eve.provider_advertisement":
case "gamecult.eve.provider_advertisement.v1":
if (payload?.providerId) {
advertisements.set(String(payload.providerId), { ...record, payload });
}
break;
case "gamecult.eve.surface_state":
case "gamecult.eve.surface_state.v0":
case "gamecult.eve.surface_state.v1":
if (surfaceProviderId(payload)) {
surfaces.set(String(surfaceProviderId(payload)), { ...record, payload });
}
break;
default: {
const providerId = payload.provider_id || payload.providerId;
if (!providerId) break;
if (String(record.schemaId).endsWith(".command_boundary")) {
commandBoundaries.set(String(providerId), payload);
} else if (String(record.schemaId).endsWith(".transport_profile")) {
transportProfiles.set(String(providerId), payload);
}
break;
}
}
}
const providerAdvertisements = [...advertisements.values()]
.map((record) => normalizeProviderAdvertisementRecord(record, commandBoundaries, transportProfiles))
.filter(Boolean)
.sort((left, right) => String(left.id).localeCompare(String(right.id)));
const interfaces = providerAdvertisements
.map((provider) => {
const surfaceRecord = surfaces.get(String(provider.id));
if (!surfaceRecord?.payload?.surface?.root) {
return null;
}
return liveProviderInterface(provider, surfaceRecord.payload, surfaceRecord.source);
})
.filter(Boolean)
.sort((left, right) => String(left.providerId).localeCompare(String(right.providerId)));
return { interfaces, providerAdvertisements };
}
function prune(now = Date.now()) {
for (const [key, record] of records) {
if (now - record.receivedAtMs > maxAgeMs) {
records.delete(key);
}
}
}
return {
ingestDocument,
snapshot,
};
}
function normalizeDocumentPayload(record) {
const payload = record?.payload;
switch (record?.schemaId) {
case "gamecult.eve.surface_state":
case "gamecult.eve.surface_state.v0":
case "gamecult.eve.surface_state.v1":
if (Array.isArray(payload) && payload.length >= 5) {
return {
provider_id: payload[0],
title: payload[1],
version: payload[2],
updated_at: payload[3],
surface: payload[4],
};
}
break;
default:
break;
}
let normalized = payload;
for (let depth = 0; depth < 4; depth += 1) {
if (Array.isArray(normalized) && normalized.length === 1 && normalized[0] && typeof normalized[0] === "object") {
normalized = normalized[0];
continue;
}
if (normalized?.value && typeof normalized.value === "object" && !Array.isArray(normalized.value)) {
normalized = normalized.value;
continue;
}
break;
}
return normalized || {};
}
function surfaceProviderId(surfaceState) {
return surfaceState?.providerId || surfaceState?.provider_id || null;
}
function surfaceTitle(surfaceState) {
return surfaceState?.title || surfaceState?.Title || null;
}
function surfaceVersion(surfaceState) {
return surfaceState?.version || surfaceState?.Version || 0;
}
function surfaceUpdatedAt(surfaceState) {
return surfaceState?.updatedAt || surfaceState?.updated_at || surfaceState?.UpdatedAt || null;
}
function normalizeProviderAdvertisementRecord(record, commandBoundaries, transportProfiles) {
const advertisement = record.payload;
const providerId = advertisement?.providerId || advertisement?.provider?.id || advertisement?.id;
if (!providerId) {
return null;
}
const endpoints = sanitizeProviderEndpoints(advertisement.endpoints);
const routes = sanitizeProviderEndpoints(advertisement.routes);
const providerEndpoint = advertisement.cultMeshAddress
|| providerTypedEndpoint(routes)
|| providerTypedEndpoint(endpoints)
|| typedProviderEndpoint(advertisement.provider?.endpoint)
|| `cultmesh:live:${providerId}`;
return {
id: providerId,
title: advertisement.title || advertisement.provider?.title || providerId,
description: advertisement.description || "Provider-owned CultNet/RUDP advertisement.",
version: String(advertisement.version || 0),
endpoint: providerEndpoint,
canonicalService: advertisement.canonicalService || null,
locatedService: advertisement.locatedService || null,
cultMeshAddress: advertisement.cultMeshAddress || null,
endpoints,
routes,
inputStreams: Array.isArray(advertisement.inputStreams) ? advertisement.inputStreams : [],
activeStreams: Array.isArray(advertisement.activeStreams) ? advertisement.activeStreams : [],
availableSources: Array.isArray(advertisement.availableSources) ? advertisement.availableSources : [],
transportEndpoint: providerTypedEndpoint(routes)
|| typedProviderEndpoint(advertisement.provider?.endpoint)
|| providerEndpoint,
capabilities: advertisement.provider?.capabilities || advertisement.capabilities || [],
operatorState: null,
commandBoundary: commandBoundaries.get(String(providerId)) || null,
transportProfile: transportProfiles.get(String(providerId)) || null,
usesCultMesh: false,
transport: "CultNet/RUDP provider advertisement",
status: advertisement.status || "unknown",
updatedAt: advertisement.updatedAt || record.storedAt || new Date(record.receivedAtMs).toISOString(),
source: sourceLabel(record.source),
commandSurface: advertisement.commandSurface || null,
};
}
function typedProviderEndpoint(endpoint) {
const value = typeof endpoint === "string" ? endpoint.trim() : "";
if (!value) {
return null;
}
return value.startsWith("cultmesh:") ? value : null;
}
function normalizeProviderEndpoints(endpoints) {
if (!Array.isArray(endpoints)) {
return [];
}
return endpoints.map((entry) => {
if (entry && typeof entry === "object" && !Array.isArray(entry)) {
return entry;
}
return {
transport: "witness",
address: String(entry || ""),
};
});
}
function sanitizeProviderEndpoints(endpoints) {
return normalizeProviderEndpoints(endpoints).filter((entry) => {
const transport = String(entry?.transport || "").toLowerCase();
const address = String(entry?.address || "").trim();
if (address.startsWith("cultmesh:")) {
return true;
}
if (transport.includes("cultmesh") || transport.includes("cultcache")) {
return true;
}
return false;
});
}
function providerTypedEndpoint(endpoints) {
return sanitizeProviderEndpoints(endpoints).find((entry) =>
String(entry?.address || "").startsWith("cultmesh:")
)?.address || null;
}
function liveProviderInterface(provider, surfaceState, source) {
const surface = surfaceState.surface || null;
return {
providerId: provider.id,
title: surfaceTitle(surfaceState) || provider.title || provider.id,
state: "active",
detail: `${surface?.root?.kind || surface?.root?.type || "surface"} ${countSurfaceNodes(surface, surfaceState)} nodes via live CultNet/RUDP announcement`,
version: surfaceVersion(surfaceState),
updatedAt: surfaceUpdatedAt(surfaceState) || provider.updatedAt || new Date().toISOString(),
source: sourceLabel(source),
manifest: provider,
canonicalService: provider.canonicalService || null,
locatedService: provider.locatedService || null,
cultMeshAddress: provider.cultMeshAddress || null,
endpoints: sanitizeProviderEndpoints(provider.endpoints),
routes: sanitizeProviderEndpoints(provider.routes),
commandBoundary: provider.commandBoundary || null,
transportProfile: provider.transportProfile || null,
surface,
};
}
function countSurfaceNodes(surface, state = null) {
if (Array.isArray(state?.nodes)) {
return state.nodes.length;
}
if (!surface?.root) {
return 0;
}
let count = 0;
const stack = [surface.root];
while (stack.length > 0) {
const node = stack.pop();
if (!node || typeof node !== "object") continue;
count += 1;
if (Array.isArray(node.children)) {
for (const child of node.children) stack.push(child);
}
}
return count;
}
function sourceLabel(source) {
if (!source?.address) {
return "cultnet-rudp:unknown";
}
return `cultnet-rudp://${source.address}:${source.port}`;
}
module.exports = {
createLiveProviderRegistry,
};

View file

@ -1,216 +0,0 @@
"use strict";
const fs = require("fs");
const { dashboardUnavailable } = require("./interfaces.cjs");
const {
adbSnapshot,
dockerSnapshot,
} = require("./probes.cjs");
const { buildMarqueeText } = require("./marquee.cjs");
const { buildPendingSurface, buildSurface } = require("./surface.cjs");
const { stableId } = require("./utils.cjs");
function createStateBuilder({ cachePath, gamecultTextDocumentStorePath, interfaceDiscovery, layoutStore, stonksBurstSize }) {
let version = 0;
function buildPendingState(message) {
return {
type: "dashboard-state",
schema: "mimir.eve_dashboard_state.v1",
providerId: "odin.providers",
title: "Odin Provider Catalog",
version,
updatedAt: new Date().toISOString(),
selectedNodeId: "coordinator-starting",
lutPreset: "terminal",
nodes: [],
providerCatalog: [],
surface: buildPendingSurface(message),
};
}
async function buildState() {
version += 1;
const observedAt = new Date().toISOString();
const [
docker,
adb,
discovery,
] = await Promise.all([
dockerSnapshot(),
adbSnapshot(),
interfaceDiscovery.discoverAll(),
]);
const discoveredInterfaces = discovery.interfaces;
const providerAdvertisements = discovery.providerAdvertisements;
const interfaceById = new Map(discoveredInterfaces.map((entry) => [entry.providerId, entry]));
const interfaces = [...interfaceById.values()];
const marqueeText = await buildMarqueeText({ interfaces, textDocumentStorePath: gamecultTextDocumentStorePath, stonksBurstSize });
const interfaceSummary = interfaces.map((entry) => `${entry.providerId}:${entry.state}`).join(", ");
const layout = await layoutStore.readLayout();
const verseEvidence = [...providerAdvertisements, ...interfaces];
const voidBotDashboard = interfaceById.get("voidbot.swarm") || dashboardUnavailable("voidbot.swarm", "discovery", "not discovered");
const mimirLiveStats = interfaceById.get("mimir.live.stats") || dashboardUnavailable("mimir.live.stats", "discovery", "not discovered");
const periwinkleServices = [
...adbFaultServices(adb),
];
const verses = [
verse("starfire.local", "Starfire", "coordinator", "active", ["docker", "adb", "eve-provider"], [
service("odin", "Odin all-seer", "active", "asgard.starfire.odin/eve/tui"),
service("docker", "Docker", docker.state === "ok" ? "active" : "warn", `${docker.containers.length} running`),
service("adb", "ADB transport", adbState(adb), adbDetail(adb)),
service("cultcache", "Odin CultCache", fs.existsSync(cachePath) ? "active" : "waiting", require("path").basename(cachePath)),
service("interfaces", "Eve interfaces", interfaces.some((entry) => entry.surface?.root) ? "active" : "waiting", interfaceSummary || "no provider surfaces"),
service("voidbot-swarm", "VoidBot Swarm", voidBotDashboard.state, voidBotDashboard.detail),
service("mimir-live-stats", "Mimir Live Stats", mimirLiveStats.state, mimirLiveStats.detail),
...docker.containers.map((container) => service(`docker-${container.name}`, container.name, "active", container.image)),
]),
verse("nightwing.local", "Nightwing", "dashboard-renderer", bodyStatus(verseEvidence, "nightwing"), ["eve-tui", "gpu-worker"], bodyServices(verseEvidence, "nightwing")),
verse("eve.ipad", "EVE", "ios-client", bodyStatus(verseEvidence, "eve"), ["native-eve"], bodyServices(verseEvidence, "eve")),
periwinkleServices.length ? verse("periwinkle.android", "Periwinkle", "android-client", periwinkleStatus(periwinkleServices), ["sensor-edge", "adb-transport"], periwinkleServices) : null,
verse("raven.local", "Raven", "local-peer", bodyStatus(verseEvidence, "raven"), ["cultmesh-provider"], bodyServices(verseEvidence, "raven")),
verse("yggdrasil.ops", "Yggdrasil", "ops-host", bodyStatus(verseEvidence, "yggdrasil"), ["cultmesh-provider"], bodyServices(verseEvidence, "yggdrasil")),
].filter(Boolean);
return {
type: "dashboard-state",
schema: "mimir.eve_dashboard_state.v1",
providerId: "odin.providers",
title: "Odin Provider Catalog",
version,
updatedAt: observedAt,
selectedNodeId: "verse-starfire.local",
lutPreset: "terminal",
nodes: verses.map((entry, index) => ({
id: `verse-${entry.verseId}`,
label: `${entry.name}\n${entry.role}`,
kind: "cultmesh-verse",
visible: true,
x: -0.8 + (index % 3) * 0.8,
y: -0.45 + Math.floor(index / 3) * 0.55,
z: 0,
rotation: 0,
scale: 1,
width: 0.42,
height: 0.2,
health: entry.status,
detail: entry.capabilities.join(", "),
})),
providerCatalog: providerAdvertisements,
surface: buildSurface({ observedAt, docker, adb, verses, interfaces, layout, marqueeText }),
};
}
return { buildPendingState, buildState };
}
function verse(verseId, name, role, status, capabilities, services = []) {
return { verseId, name, role, status, capabilities, services };
}
function service(id, name, state, detail = "") {
return { id: stableId(id), name, state, detail: String(detail || "") };
}
function bodyStatus(entries, body) {
const matches = bodyEntries(entries, body);
if (!matches.length) return "waiting";
if (matches.some((entry) => providerState(entry) === "active")) return "active";
if (matches.some((entry) => providerState(entry) === "warn")) return "warn";
return "waiting";
}
function bodyServices(entries, body) {
const matches = bodyEntries(entries, body);
if (!matches.length) {
return [service(`${body}-cultmesh-witnesses`, `${titleCase(body)} CultMesh witnesses`, "waiting", "no provider advertisement or interface discovered")];
}
return matches
.slice(0, 8)
.map((entry) => service(
`${body}-${entry.providerId || entry.id || entry.title || "provider"}`,
entry.title || entry.providerId || entry.id || `${titleCase(body)} provider`,
providerState(entry),
providerDetail(entry),
));
}
function bodyEntries(entries, body) {
const token = String(body).toLowerCase();
return entries.filter((entry) => providerBodyText(entry).includes(token));
}
function providerBodyText(entry) {
return [
entry.providerId,
entry.id,
entry.title,
entry.canonicalService,
entry.locatedService,
entry.cultMeshAddress,
entry.verseId,
entry.source,
].filter(Boolean).join(" ").toLowerCase();
}
function providerState(entry) {
const state = String(entry.state || entry.status || "").toLowerCase();
if (["active", "ok", "ready", "running", "published"].includes(state)) return "active";
if (["warn", "warning", "degraded"].includes(state)) return "warn";
if (["failed", "error", "offline"].includes(state)) return "warn";
return entry.surface?.root ? "active" : "waiting";
}
function providerDetail(entry) {
return [
entry.detail,
entry.cultMeshAddress,
entry.locatedService,
entry.source,
].filter(Boolean).join(" / ") || "provider-owned CultMesh discovery";
}
function titleCase(value) {
const text = String(value || "");
return text ? text[0].toUpperCase() + text.slice(1) : "";
}
function adbState(adb) {
if (adb.state !== "ok") return adb.state;
return adbFaultDevices(adb).length ? "warn" : "ok";
}
function adbDetail(adb) {
if (adb.error) return adb.error;
if (adb.devices.length === 0) return "no devices";
return adb.devices.map((device) => `${device.serial}:${device.state}`).join(", ");
}
function adbFaultDevices(adb) {
return adb.devices.filter((device) => device.state !== "device");
}
function adbFaultServices(adb) {
if (adb.state !== "ok") {
return [service("adb-transport", "ADB transport", adb.state, adbDetail(adb))];
}
return adbFaultDevices(adb).map((device) =>
service(`adb-${device.serial}`, "ADB device fault", device.state, `${device.serial}:${device.state}`),
);
}
function periwinkleStatus(services) {
if (services.some((entry) => entry.state === "active")) return "active";
if (services.some((entry) => entry.state === "stale")) return "stale";
if (services.some((entry) => entry.state === "offline" || entry.state === "unauthorized" || entry.state === "error" || entry.state === "missing")) return "warn";
return "waiting";
}
module.exports = {
createStateBuilder,
service,
verse,
};

View file

@ -1,212 +0,0 @@
"use strict";
const { analyzeElementTree, fullscreenLayoutIntent, mergeLayoutIntent } = require("./layout.cjs");
const { stableId } = require("./utils.cjs");
function buildSurface({ observedAt, docker, adb, verses, interfaces, layout, marqueeText = "" }) {
const activeInterfaces = interfaces.filter((entry) => entry?.surface?.root);
return {
schema: "gamecult.eve.surface.v1",
id: "gamecult.network.status.surface",
title: "Odin",
root: {
id: "network-root",
kind: "dashboard",
props: {
title: "Odin Provider Catalog",
observedAt,
summary: `${activeInterfaces.length} Eve surfaces`,
marqueeText,
layout: fullscreenLayoutIntent("odin.providers", -100),
presentation: {
theme: "bifrost-pride",
frame: "animated-rainbow",
dividerMotion: "bifrost-rainbow-dance",
intent: "Odin preserves provider-owned surfaces for catalog/proxy access; Gjallar owns Nightwing overview composition and lowering.",
},
},
children: [
...activeInterfaces.map((entry) => {
const tree = analyzeElementTree(entry.surface.root);
return {
id: `interface-${stableId(entry.providerId)}`,
kind: "interface",
props: {
title: entry.title || entry.providerId,
verseUri: verseUri(entry),
canonicalService: entry.canonicalService || "",
locatedService: entry.locatedService || "",
cultMeshAddress: entry.cultMeshAddress || "",
endpoints: entry.endpoints || [],
routes: entry.routes || [],
providerId: entry.providerId,
source: entry.source,
status: entry.state,
detail: entry.detail,
overviewSignal: hasOverviewSignal(entry),
version: entry.version,
updatedAt: entry.updatedAt,
layout: mergeLayoutIntent(layout.tiles?.[entry.providerId], entry, interfaces),
tree,
packing: {
strategy: "nested-dense-signal",
flattening: "forbidden-when-surface-root-has-children",
listPolicy: "group-or-tree; never render provider signal as a single log/list blob",
},
},
children: [entry.surface.root],
};
}),
],
},
assets: [],
};
}
function hasOverviewSignal(entry) {
const root = entry?.surface?.root;
if (!root) return false;
const providerId = String(entry.providerId || "").toLowerCase();
const explicit = root.props?.overview || entry.manifest?.overview;
if (explicit?.visible === false) return false;
if (explicit?.visible === true || explicit?.signal === "live-ops") return true;
const text = surfaceText(root);
if (providerId.includes("voidbot.swarm")) return /\bctb\b|\bs[0-9.]+\s+h[0-9.]+/i.test(text);
if (providerId.includes("stonks.market")) return stonksHasOverviewSignal(root, text);
if (providerId.includes("mimir.stream.layout")) return false;
if (providerId.includes("spotiverse")) return spotiverseHasOverviewSignal(root, text);
if (providerId.includes("streampixels")) return streamPixelsHasOverviewSignal(root, text);
if (providerId.includes("mimir.live.stats")) return mimirHasOverviewSignal(root, text);
if (/\b(rate limit|playing:\s*none|queue:\s*empty|unavailable|not discovered)\b/i.test(text)) return false;
return hasMetricElement(root) || /\b(users?|viewers?|events?|traffic|ingest|throughput|latency|dropout|queue|pressure|saturation|error|fault|warning)\b/i.test(text);
}
function stonksHasOverviewSignal(root, text) {
if (root.props?.overview?.visible === true) return true;
return /\b(Market pulse|BITCOIN|ETHEREUM|SOLANA|DOGECOIN|equities|crypto|vol|request traffic|source health)\b/i.test(text);
}
function spotiverseHasOverviewSignal(root, text) {
const status = String(root.props?.status || "").toLowerCase();
if (status === "warn" && /\brate limit\b/i.test(text)) return false;
if (/\bplaying:\s*none\b/i.test(text)) return false;
if (/\bqueue:\s*empty|queue:\s*empty or unavailable\b/i.test(text)) return false;
return /\bplaying:\s*(?!none\b).+|\bqueue:\s*(?!empty\b|0\b).+|\brequests?:\s*[1-9]|\bvolume:\s*[1-9]/i.test(text);
}
function streamPixelsHasOverviewSignal(root, text) {
return [
/\b(live\s*)?(users?|viewers?)\s*[:=]?\s*[1-9]/i,
/\bevents?(\s*traffic|\s*\/\s*s|\s*per\s*sec)?\s*[:=]?\s*[1-9]/i,
/\bingest\b.*\b(saturation|pressure|traffic|throughput|[1-9][0-9]*(\.[0-9]+)?)\b/i,
/\b(queue|backlog|pressure)\s*[:=]?\s*[1-9]/i,
/\b(errors?|dropped|5xx)\s*[:=]?\s*[1-9]/i,
/\bthroughput\s*[:=]?\s*[1-9]/i,
].some((pattern) => pattern.test(text));
}
function mimirHasOverviewSignal(root, text) {
return [
/\bdropout\b.*\b[1-9]/i,
/\bstale\s+streams?\s*[:=]?\s*[1-9]/i,
/\blatency\b.*\b([2-9][0-9]{2,}|[1-9]\d+\.\d+ms)\b/i,
/\bconfidence\b.*\b0\.[0-4]/i,
].some((pattern) => pattern.test(text));
}
function surfaceText(root) {
const parts = [];
visitSurface(root, (node) => {
const props = node.props || {};
for (const key of ["title", "label", "text", "status", "detail", "summary", "value"]) {
if (props[key] !== undefined && props[key] !== null) parts.push(String(props[key]));
}
});
return parts.join("\n");
}
function hasMetricElement(root) {
let found = false;
visitSurface(root, (node) => {
if (node.kind === "metric") found = true;
});
return found;
}
function visitSurface(node, visitor) {
if (!node || typeof node !== "object") return;
visitor(node);
for (const child of Array.isArray(node.children) ? node.children : []) {
visitSurface(child, visitor);
}
}
function buildPendingSurface(message) {
return {
schema: "gamecult.eve.surface.v1",
id: "gamecult.network.status.surface",
title: "Odin",
root: stack("root", [pane("Coordinator", [text("status", message)])]),
assets: [],
};
}
function stack(id, children) {
return { id, kind: "stack", props: {}, children };
}
function pane(title, children) {
return { id: stableId(`pane-${title}`), kind: "pane", props: { title }, children };
}
function card(id, children, tone = "default") {
return { id, kind: "card", props: { title: id }, style: { tone }, children };
}
function text(id, value) {
return { id, kind: "text", props: { text: value }, children: [] };
}
function metric(id, label, value, tone) {
return { id, kind: "metric", props: { label, text: `${label}: ${value}`, value, tone }, children: [] };
}
function verseUri(entry) {
if (entry.cultMeshAddress) return String(entry.cultMeshAddress);
if (entry.locatedService) return String(entry.locatedService);
const providerId = String(entry.providerId || "").trim();
if (hasBodyPrefix(providerId)) return providerId;
const body = sourceBody(entry.source);
if (!body || providerId.startsWith(`${body}.`)) return providerId;
return `${body}.${providerId}`;
}
function hasBodyPrefix(providerId) {
return ["starfire", "yggdrasil", "nightwing", "eve", "periwinkle", "raven"].some((body) => providerId.startsWith(`${body}.`));
}
function sourceBody(source) {
const value = String(source || "");
if (value.startsWith("cultmesh:")) return "starfire";
return "";
}
function adbTone(adb) {
if (adb.state !== "ok") return "warn";
return adb.devices.some((device) => device.state !== "device") ? "warn" : "ok";
}
module.exports = {
buildPendingSurface,
buildSurface,
card,
hasOverviewSignal,
metric,
pane,
stack,
text,
};

View file

@ -1,21 +0,0 @@
"use strict";
const assert = require("node:assert/strict");
const test = require("node:test");
const { defineOdinDocuments } = require("../src/odin/documents.cjs");
test("Odin persists Ghostlight's public schema catalog envelope", () => {
const documents = defineOdinDocuments((definition) => definition);
const catalog = documents.ghostlightSchemaCatalogDefinition;
assert.equal(catalog.type, "ghostlight.schema_catalog");
assert.equal(catalog.schemaId, "ghostlight.schema_catalog.v1");
assert.equal(catalog.schemaVersion, "ghostlight.schema_catalog.v1");
assert.equal(catalog.name({ providerId: "gamecult.ghostlight.dungeon" }), "gamecult.ghostlight.dungeon");
});
test("Odin's unavailable-runtime projection includes the Ghostlight catalog slot", () => {
const documents = defineOdinDocuments(null);
assert.equal(documents.ghostlightSchemaCatalogDefinition, null);
});

View file

@ -1,23 +0,0 @@
"use strict";
const assert = require("node:assert/strict");
const test = require("node:test");
const { defineOdinDocuments } = require("../src/odin/documents.cjs");
test("Odin registers the typed Heimdall access discovery documents", () => {
const documents = defineOdinDocuments((definition) => definition);
assert.equal(
documents.evePluginAdvertisementDefinition.schemaId,
"gamecult.eve.plugin_advertisement.v1",
);
assert.equal(
documents.heimdallCommandBoundaryDefinition.schemaId,
"heimdall.command_boundary.v1",
);
assert.equal(
documents.heimdallTransportProfileDefinition.schemaId,
"heimdall.transport_profile.v1",
);
});

View file

@ -1,67 +0,0 @@
"use strict";
const assert = require("node:assert/strict");
const crypto = require("node:crypto");
const test = require("node:test");
const {
IDUNN_HEALTH_CONTRACT,
signedHealthPayload,
signingMessage,
} = require("../src/odin/idunn-rudp.cjs");
test("Odin signs the complete canonical provider-health statement", () => {
const { privateKey, publicKey } = crypto.generateKeyPairSync("ed25519");
const publicDer = publicKey.export({ type: "spki", format: "der" });
const rawPublicKey = Buffer.from(publicDer.subarray(publicDer.length - 32));
const signerIdentityId = crypto
.createHash("sha256")
.update(Buffer.from("gamecult.provider-health.identity.v1\0"))
.update(rawPublicKey)
.digest("hex");
const publisher = {
daemonId: "yggdrasil-odin",
healthContract: "odin.cultnet-rudp-provider-health",
privateKey,
publisherIncarnationId: "24e0dc7f-6a92-4aa8-9f56-fb513d265e13",
publisherSequence: 0,
signerIdentityId,
sourceRuntimeId: "odin-yggdrasil",
contract: IDUNN_HEALTH_CONTRACT,
};
const signed = signedHealthPayload(
publisher,
{ state: "active", detail: "catalog current" },
"2026-08-21T12:34:56.789Z",
);
assert.equal(signed.statement[0], "idunn.signed_daemon_health.v1");
assert.equal(signed.statement[1], "yggdrasil-odin");
assert.equal(signed.statement[2], "odin.cultnet-rudp-provider-health");
assert.equal(signed.statement[3], "odin-yggdrasil");
assert.equal(signed.statement[8], 1);
assert.equal(signed.statement[9], 1787315696789);
assert.equal(signed.statement[15].byteLength, 64);
assert.equal(
crypto.verify(
null,
signingMessage(signed.unsignedPayload),
publicKey,
Buffer.from(signed.statement[15]),
),
true,
);
const tampered = Buffer.from(signed.unsignedPayload);
tampered[tampered.length - 1] ^= 1;
assert.equal(
crypto.verify(
null,
signingMessage(tampered),
publicKey,
Buffer.from(signed.statement[15]),
),
false,
);
});

View file

@ -1,29 +0,0 @@
"use strict";
const assert = require("node:assert/strict");
const test = require("node:test");
const { createLiveProviderRegistry } = require("../src/odin/provider-ingress.cjs");
test("live provider registry unwraps Rust compatibility records", () => {
const registry = createLiveProviderRegistry();
registry.ingestDocument({
schemaId: "gamecult.eve.provider_advertisement.v1",
recordKey: "muninn.telemetry.nightwing",
payload: [{
value: {
providerId: "muninn.telemetry.nightwing",
title: "Muninn Nightwing Telemetry",
status: "active",
cultMeshAddress: "asgard.nightwing.muninn/telemetry",
capabilities: ["muninn.move_evidence_stream"],
},
}],
}, { address: "10.77.0.3", port: 40000 });
const snapshot = registry.snapshot();
assert.equal(snapshot.providerAdvertisements.length, 1);
assert.equal(snapshot.providerAdvertisements[0].id, "muninn.telemetry.nightwing");
assert.deepEqual(snapshot.providerAdvertisements[0].capabilities, ["muninn.move_evidence_stream"]);
assert.equal(snapshot.providerAdvertisements[0].source, "cultnet-rudp://10.77.0.3:40000");
});