From 176353db3ec13a6b8d7af711f6824a333222d348 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 16 Jun 2026 00:45:48 +0100 Subject: [PATCH] Publish Nightwing Muninn health over RUDP --- crates/idunn-daemon/src/main.rs | 55 +++++++++++++++----- docs/idunn.md | 24 +++++---- docs/muninn.md | 7 +++ scripts/claim-nightwing-usb-moves.ps1 | 3 +- scripts/get-nightwing-move-state-sources.ps1 | 3 +- scripts/health-nightwing-muninn.ps1 | 8 ++- scripts/nightwing-move-state-sources.sh | 26 ++++++++- scripts/start-idunn-local.ps1 | 1 + 8 files changed, 99 insertions(+), 28 deletions(-) diff --git a/crates/idunn-daemon/src/main.rs b/crates/idunn-daemon/src/main.rs index 92ff438..260dc55 100644 --- a/crates/idunn-daemon/src/main.rs +++ b/crates/idunn-daemon/src/main.rs @@ -636,11 +636,9 @@ fn swarm_surgery_plan( targets: &[DaemonTarget], updated_at: &str, ) -> IdunnSwarmSurgeryPlanRecord { - let next_target = if targets - .iter() - .any(|target| target.daemon_id == "starfire-muninn") - { - "starfire-muninn" + let has_raven_muninn = targets.iter().any(|target| target.daemon_id == "muninn"); + let next_target = if has_raven_muninn { + "muninn" } else if let Some(target) = targets.iter().find(|target| target.enabled) { target.daemon_id.as_str() } else { @@ -672,11 +670,11 @@ fn swarm_surgery_plan( "5. Delete or demote compatibility probes once every target has daemon-owned publication and advertised lifecycle authority.".to_string(), ], current_phase: - "Phase 2: install daemon-published RUDP health in Muninn as the first Rust daemon cut." + "Phase 4: extend daemon-published RUDP health from Starfire and Nightwing Muninn to the Raven Muninn lane." .to_string(), next_target: next_target.to_string(), cut_line: - "The old command-probe path is cut per daemon only after fresh daemon-published RUDP health matches daemon_id, health_contract, publication_source, transport, and freshness window." + "Starfire and Nightwing Muninn now publish daemon-owned RUDP health. Raven Muninn still needs the same route before its SSH command probe can be demoted." .to_string(), verification_layer: "CultMesh keepalive store records plus live Idunn decision cycles, not process exit codes or chat summaries." @@ -1688,8 +1686,8 @@ mod tests { } #[test] - fn swarm_surgery_plan_names_current_cut_and_verification_layer() { - let muninn = DaemonTarget { + fn swarm_surgery_plan_names_raven_muninn_after_starfire_and_nightwing_cuts() { + let starfire_muninn = DaemonTarget { daemon_id: "starfire-muninn".to_string(), verse_id: "starfire.local".to_string(), name: "Starfire Muninn".to_string(), @@ -1703,6 +1701,34 @@ mod tests { enabled: true, interval_seconds: 30, }; + let nightwing_muninn = DaemonTarget { + daemon_id: "nightwing-muninn".to_string(), + verse_id: "nightwing.local".to_string(), + name: "Nightwing Muninn".to_string(), + health_contract: health_contract( + "muninn.cultnet-rudp-remote-telemetry-and-move-hid", + "failed", + ), + health_command: Some("health-nightwing-muninn.cmd".to_string()), + deploy_command: None, + restart_command: Some("restart-nightwing-muninn.cmd".to_string()), + enabled: true, + interval_seconds: 30, + }; + let raven_muninn = DaemonTarget { + daemon_id: "muninn".to_string(), + verse_id: "raven.local".to_string(), + name: "Raven Muninn".to_string(), + health_contract: health_contract( + "muninn.cultnet-rudp-remote-telemetry-health", + "failed", + ), + health_command: Some("health-muninn.cmd".to_string()), + deploy_command: None, + restart_command: Some("restart-muninn.cmd".to_string()), + enabled: true, + interval_seconds: 30, + }; let odin = DaemonTarget { daemon_id: "odin".to_string(), verse_id: "starfire.local".to_string(), @@ -1715,12 +1741,17 @@ mod tests { interval_seconds: 30, }; - let plan = swarm_surgery_plan("starfire-local", &[odin, muninn], "unix:100"); + let plan = swarm_surgery_plan( + "starfire-local", + &[odin, starfire_muninn, nightwing_muninn, raven_muninn], + "unix:100", + ); assert_eq!(plan.plan_id, "swarm-surgery:starfire-local"); assert_eq!(plan.status, "active-transport-migration"); - assert_eq!(plan.next_target, "starfire-muninn"); - assert!(plan.current_phase.contains("Muninn")); + assert_eq!(plan.next_target, "muninn"); + assert!(plan.current_phase.contains("Raven Muninn")); + assert!(plan.cut_line.contains("Raven Muninn")); assert!(plan.verification_layer.contains("CultMesh keepalive store")); assert!( plan.invariants diff --git a/docs/idunn.md b/docs/idunn.md index ecdfeb7..571a04e 100644 --- a/docs/idunn.md +++ b/docs/idunn.md @@ -144,8 +144,10 @@ idunn.rudp_health_ingress.v1 check sends a CultNet hello over loopback `cultnet.transport.rudp.v0` and records whether the acknowledgement path works in Idunn's own Rust runtime. This proves Idunn's local substrate, not fleet migration. -- Idunn also opens a local RUDP health ingress by default at - `127.0.0.1:17870` and publishes `idunn.rudp_health_ingress.v1`. That ingress +- Idunn also opens a RUDP health ingress and publishes + `idunn.rudp_health_ingress.v1`. The Starfire local supervisor binds + `0.0.0.0:17870` so host-local publishers can use `127.0.0.1:17870` and + WireGuard peers such as Nightwing can publish to `10.77.0.2:17870`. That ingress accepts only raw `idunn.daemon_health` CultNet document puts, decodes the typed MessagePack payload, and writes it into the keepalive store. It does not grant deploy/restart authority and it does not make compatibility probes @@ -253,16 +255,16 @@ The local swarm mode owns: Yggdrasil checks. Current plan surface: `idunn.swarm_surgery_plan.v1` for profile -`starfire-local` points at `starfire-muninn` as the first Rust daemon cut. -Muninn's `--health` mode now has an explicit Idunn RUDP publication path; the -Starfire health wrapper passes the `starfire-muninn` daemon id and -`muninn.cultnet-rudp-local-telemetry-and-quest-access` contract into that path. -The verification layer is the CultMesh keepalive store plus live Idunn decision -cycles, not command exit codes or chat summaries. +`starfire-local` treats Starfire Muninn and Nightwing Muninn as completed Rust +cuts. Muninn's `--health` mode publishes `idunn.daemon_health` over RUDP; +Starfire publishes to local Idunn, and Nightwing publishes over WireGuard to +`10.77.0.2:17870` using the `nightwing-muninn` daemon id and +`muninn.cultnet-rudp-remote-telemetry-and-move-hid` contract. Live Idunn cycles +accept both records before command-probe fallback. The plan's current phase now +points at the Raven `muninn` lane. -Next: prove Idunn consumes Starfire Muninn's live RUDP health record, then -continue runtime-by-runtime until compatibility probes can be deleted or -demoted. +Next: prove Idunn consumes Raven `muninn` daemon-published health, then continue +runtime-by-runtime until compatibility probes can be deleted or demoted. No ad hoc JSON manifest, HTTP endpoint, TCP socket, or WebSocket bridge may become the live state owner. Debug projections are fine when they name the diff --git a/docs/muninn.md b/docs/muninn.md index 0ac195c..71325ca 100644 --- a/docs/muninn.md +++ b/docs/muninn.md @@ -216,3 +216,10 @@ PID, and logs under With that Move state source attached, `serve` also publishes the `muninn:nightwing:move-evidence` CultMesh stream frame body that Mimir's native Move evidence reservoir consumes. +Nightwing source discovery must emit one Move source per controller id. The USB +pairing collection and Bluetooth joystick can expose the same controller as +separate `/dev/input/js*` paths; `nightwing-move-state-sources.sh` prefers the +Bluetooth `HID_ID=0005:0000054C:000003D5` path so Idunn health does not demand +fresh records from two faces of the same controller. The Nightwing health +actuator publishes `nightwing-muninn` health over RUDP to Starfire Idunn at +`10.77.0.2:17870`. diff --git a/scripts/claim-nightwing-usb-moves.ps1 b/scripts/claim-nightwing-usb-moves.ps1 index 7dfcd60..26f7929 100644 --- a/scripts/claim-nightwing-usb-moves.ps1 +++ b/scripts/claim-nightwing-usb-moves.ps1 @@ -6,12 +6,13 @@ param( $ErrorActionPreference = "Stop" $scriptPath = Join-Path $PSScriptRoot "nightwing-claim-usb-moves.sh" +$sshExe = Join-Path $env:SystemRoot "System32\OpenSSH\ssh.exe" $remoteArgs = "" if (-not [string]::IsNullOrWhiteSpace($HostAddress)) { $remoteArgs = " " + ($HostAddress -replace "'", "'\''") } -$command = 'ssh.exe -o BatchMode=yes -o ConnectTimeout=5 ' + +$command = '"' + $sshExe + '" -o BatchMode=yes -o ConnectTimeout=5 ' + $SshTarget + ' "sh -s' + $remoteArgs + diff --git a/scripts/get-nightwing-move-state-sources.ps1 b/scripts/get-nightwing-move-state-sources.ps1 index 3d7e05d..cfd4cb6 100644 --- a/scripts/get-nightwing-move-state-sources.ps1 +++ b/scripts/get-nightwing-move-state-sources.ps1 @@ -5,7 +5,8 @@ param( $ErrorActionPreference = "Stop" $scriptPath = Join-Path $PSScriptRoot "nightwing-move-state-sources.sh" -$command = 'ssh.exe -o BatchMode=yes -o ConnectTimeout=5 ' + +$sshExe = Join-Path $env:SystemRoot "System32\OpenSSH\ssh.exe" +$command = '"' + $sshExe + '" -o BatchMode=yes -o ConnectTimeout=5 ' + $SshTarget + ' "sh -s" < "' + $scriptPath + diff --git a/scripts/health-nightwing-muninn.ps1 b/scripts/health-nightwing-muninn.ps1 index fee2e90..eaa587b 100644 --- a/scripts/health-nightwing-muninn.ps1 +++ b/scripts/health-nightwing-muninn.ps1 @@ -4,7 +4,8 @@ param( [string] $StorePath = "/home/metacrat/.local/state/gamecult/muninn/muninn.telemetry.cc", [string] $PidPath = "/home/metacrat/.local/state/gamecult/muninn/muninn.pid", [string[]] $MoveState = @(), - [int] $IntervalSeconds = 15 + [int] $IntervalSeconds = 15, + [string] $IdunnRudpHealth = "10.77.0.2:17870" ) $ErrorActionPreference = "Stop" @@ -42,7 +43,10 @@ set -- --health \ --host nightwing $moveStateSetLines set -- "`$@" \ - --interval-seconds '$IntervalSeconds' + --interval-seconds '$IntervalSeconds' \ + --idunn-rudp-health '$IdunnRudpHealth' \ + --idunn-daemon 'nightwing-muninn' \ + --idunn-health-contract 'muninn.cultnet-rudp-remote-telemetry-and-move-hid' '$MuninnExe' "`$@" "@ diff --git a/scripts/nightwing-move-state-sources.sh b/scripts/nightwing-move-state-sources.sh index 4dca2a1..58e4984 100644 --- a/scripts/nightwing-move-state-sources.sh +++ b/scripts/nightwing-move-state-sources.sh @@ -42,6 +42,7 @@ hidraw_for_js() { return 1 } +emit_candidates() { for js in /dev/input/js*; do [ -e "$js" ] || continue props="$(udevadm info -q property -n "$js" 2>/dev/null || true)" @@ -75,5 +76,28 @@ $uevent_text" in id="move-$(basename "$js")" fi - printf '%s=%s\n' "$id" "$js" + score=1 + case "$uevent_text" in + *HID_ID=0005:0000054C:000003D5*) score=2 ;; + esac + + printf '%s %s %s\n' "$id" "$score" "$js" done +} + +emit_candidates | awk ' + { + id = $1 + score = $2 + 0 + path = $3 + if (!(id in best_score) || score >= best_score[id]) { + best_score[id] = score + best_path[id] = path + } + } + END { + for (id in best_path) { + print id "=" best_path[id] + } + } +' diff --git a/scripts/start-idunn-local.ps1 b/scripts/start-idunn-local.ps1 index dc5cb1a..4883208 100644 --- a/scripts/start-idunn-local.ps1 +++ b/scripts/start-idunn-local.ps1 @@ -80,6 +80,7 @@ $arguments = @( "--swarm-profile", "starfire-local", "--repo-root", $repoRoot, "--store", $storePath, + "--rudp-health-bind", "0.0.0.0:17870", "--command-timeout-seconds", "600", "--execute" )