From 3edceb7f3aa95f8e7adf658c9630b7da5bf9800f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 23 Jun 2026 02:57:29 +0100 Subject: [PATCH] Checkpoint working Muninn OBS discovery state --- crates/muninn-daemon/src/main.rs | 1 + docs/muninn-media-streaming.md | 86 ++++++++++++++++++++++++++++++++ scripts/health-muninn.ps1 | 7 ++- scripts/restart-muninn.ps1 | 45 +++++++++++++---- 4 files changed, 127 insertions(+), 12 deletions(-) diff --git a/crates/muninn-daemon/src/main.rs b/crates/muninn-daemon/src/main.rs index 0377385..24042a4 100644 --- a/crates/muninn-daemon/src/main.rs +++ b/crates/muninn-daemon/src/main.rs @@ -372,6 +372,7 @@ fn serve(options: Options) -> Result<()> { }; publish_surface(&mut node, &options, state, &active_stream_ids)?; publish_runtime_boundary_records(&mut node, &options, state, &active_stream_ids)?; + publish_obs_catalog_idle(&mut node, &options)?; } claim_move_host_if_due(&options, &mut last_move_host_claim_attempt_at); pickup_bluetooth_moves_if_due( diff --git a/docs/muninn-media-streaming.md b/docs/muninn-media-streaming.md index 71dee74..2a406df 100644 --- a/docs/muninn-media-streaming.md +++ b/docs/muninn-media-streaming.md @@ -126,6 +126,92 @@ but the ownership shape should not: frame/access-unit identity is load-bearing. MPEG-TS byte stream. Keep it only as a named compatibility lowering until the OBS receiver can consume typed media frames directly. +## Boring Stream Discovery Contract + +The desired operator experience is boring: OBS asks the Verse for Muninns, the +plugin shows live sources, and a selected source either activates or reports the +specific owner that refused it. No local plugin fallback may invent Raven +devices. A fake `display:0` or Realtek loopback row is worse than an empty list +because it makes stale state look selectable. + +Live ownership: + +- Owner: Muninn `serve` owns source inventory for the body where the devices + exist. It publishes video and audio source ids, labels, command boundary, + media profile, and current active sessions. +- Inputs: local display/audio enumeration, explicit configured source hints, + daemon health, and accepted stream commands. +- Outputs: `muninn.telemetry_surface.v1`, `gamecult.eve.provider_advertisement.v1`, + `muninn.command_boundary.v1`, `muninn.transport_profile.v1`, active + `muninn.capture_stream.v1` receipts, and the temporary + `muninn.obs_stream_catalog.v1` compatibility record. +- Derived state: the OBS dropdown is a lowering of discovered Muninn state. It + is not an inventory owner, activation owner, or health owner. +- Forbidden writers: OBS defaults, local hard-coded device names, synced stale + CultCache mirrors, scheduled-task launchers, and previous activation receipts + must not create selectable devices or active streams. +- Shared paths: initial OBS load, refresh button, periodic refresh, source + selection, reconnect, and OBS restart must all read the same live-discovered + source list and issue the same typed capture command when activation is + needed. +- Deletion line: the plugin may display `discovery missing`, but it must not + synthesize `Display 1` or `Realtek loopback` as if Raven advertised them. + Until Odin/Verse discovery is the direct plugin input, the OBS catalog remains + a compatibility projection of Muninn-owned live state, not its own truth. + Compatibility store fallback is allowed only as availability fallback: the + plugin must use the first current store that yields Muninn telemetry and must + not merge stale stores into a more attractive fake inventory. + A store older than the Muninn health freshness budget is not a discovery + source; it is an outage receipt. + +This contract also splits the media session truth: + +- Video session: selected video source id, encoder profile, bitrate, frame + timestamps, access-unit ids, keyframe policy, feedback pressure, and video + receiver queue. +- Audio session: selected audio source id, sample format, packet timestamps, + reorder budget, continuity/drop policy, and OBS audio output cadence. +- Combined OBS source: a convenience lowering that may request one video session + and one audio session together. It does not merge their clocks or transport + state into one opaque "A/V target". + +## Known-Good Checkpoint (2026-06-23) + +The current system is in a usable compatibility state worth preserving before +the next transport experiment. + +What is working: + +- Raven Muninn runs continuously as the capture owner and accepts stream + activation over CultNet RUDP. +- OBS on Starfire shows the live-discovered Muninn source inventory instead of + synthesizing fake devices from stale local defaults. +- Video and audio sessions activate separately through the combined OBS source + lowering and the stream comes up cleanly again after reconnect. +- The OBS plugin currently receives the temporary live + `muninn.obs_stream_catalog.v1` projection over UDP `17874` and uses it as the + live discovery source before any CultCache fallback. + +Current compatibility details: + +- Raven command ingress is currently bound to `0.0.0.0:17884`. +- Starfire OBS listens for the temporary live OBS catalog on UDP `17874`. +- The daemon `serve` loop must continue publishing the OBS catalog while idle; + otherwise OBS falls back to stale store state and reports `discovery-missing` + or shows dead inventory. +- The current OBS plugin is still a compatibility client. It does not yet host + the Rust CultMesh runtime directly and it is not yet consuming Odin/Verse + discovery as a first-class Verse client. + +Known debt that remains intentionally visible: + +- Idunn health publication can still time out independently of the media path. + That is operational debt, not proof that Muninn discovery or streaming is + down. +- The OBS catalog is still a temporary projection. The boring end state is live + Verse discovery with no plugin-owned catalog receiver and no stale store + merge behavior. + ## Codec Direction Use vendor hardware encode before inventing a codec. NVIDIA's practical answer diff --git a/scripts/health-muninn.ps1 b/scripts/health-muninn.ps1 index 697ada0..485b324 100644 --- a/scripts/health-muninn.ps1 +++ b/scripts/health-muninn.ps1 @@ -6,6 +6,7 @@ param( [string] $LogRoot = "C:\Meta\Odin\logs\muninn", [int] $MaxStoreAgeSeconds = 180, [string] $IdunnRudpHealth = "10.77.0.2:17870", + [string] $CaptureCommandRudpBind = "0.0.0.0:17883", [int] $ConnectTimeoutSeconds = 10, [string] $SshUser = "", [string] $IdentityFile = "" @@ -97,7 +98,6 @@ if (-not (Test-Path -LiteralPath "$MuninnExe")) { `$muninnDir = Split-Path -Parent "$MuninnExe" `$taskExpectations = @( @{ Name = "GameCult-Muninn"; Launcher = "powershell"; Vbs = Join-Path `$muninnDir "start-muninn-serve-hidden.vbs"; Ps = Join-Path `$muninnDir "start-muninn-serve.ps1" }, - @{ Name = "GameCult-Muninn-Activate"; Launcher = "wscript"; Vbs = Join-Path `$muninnDir "activate-raven-av-srt-hidden.vbs"; Ps = Join-Path `$muninnDir "activate-raven-av-srt.ps1" }, @{ Name = "GameCult-Muninn-VideoProof"; Launcher = "wscript"; Vbs = Join-Path `$muninnDir "muninn-raven-video-to-starfire-obs-hidden.vbs"; Ps = Join-Path `$muninnDir "muninn-raven-video-to-starfire-obs.ps1" } ) foreach (`$expectation in `$taskExpectations) { @@ -172,6 +172,9 @@ foreach (`$expectation in `$taskExpectations) { throw "`$(`$expectation.Vbs) does not reference a PowerShell launcher" } } +if (Get-ScheduledTask -TaskName "GameCult-Muninn-Activate" -ErrorAction SilentlyContinue) { + throw "Obsolete GameCult-Muninn-Activate task is still present on Raven" +} `$servePidPath = Join-Path "$LogRoot" "muninn-serve.pid" `$servePid = `$null if (Test-Path -LiteralPath `$servePidPath) { @@ -197,7 +200,7 @@ if (`$null -eq `$process) { foreach (`$pattern in @( "--host raven", "--activate-store $ActivateStorePath", - "--capture-command-rudp-bind 0.0.0.0:17883", + "--capture-command-rudp-bind $CaptureCommandRudpBind", "--idunn-rudp-health $IdunnRudpHealth", "--idunn-daemon muninn", "--idunn-health-contract muninn.cultnet-rudp-remote-telemetry-health" diff --git a/scripts/restart-muninn.ps1 b/scripts/restart-muninn.ps1 index cdd19d3..79ba4eb 100644 --- a/scripts/restart-muninn.ps1 +++ b/scripts/restart-muninn.ps1 @@ -801,6 +801,11 @@ foreach (`$path in @( } } +`$obsoleteActivateTask = Get-ScheduledTask -TaskName "GameCult-Muninn-Activate" -ErrorAction SilentlyContinue +if (`$null -ne `$obsoleteActivateTask) { + Unregister-ScheduledTask -TaskName "GameCult-Muninn-Activate" -Confirm:`$false | Out-Null +} + Get-CimInstance Win32_Process | Where-Object { `$_.Name -like "muninn*.exe" } | ForEach-Object { @@ -893,11 +898,9 @@ function Assert-HiddenPowerShellTask { } Register-HiddenPowerShellTask -TaskName "GameCult-Muninn" -PsPath "$servePsPath" -Register-HiddenVbsTask -TaskName "GameCult-Muninn-Activate" -VbsPath "$activateVbsPath" Register-HiddenVbsTask -TaskName "GameCult-Muninn-VideoProof" -VbsPath "$videoProofVbsPath" Assert-HiddenPowerShellTask -TaskName "GameCult-Muninn" -PsPath "$servePsPath" -Assert-HiddenVbsTask -TaskName "GameCult-Muninn-Activate" -VbsPath "$activateVbsPath" -PsPath "$activatePsPath" Assert-HiddenVbsTask -TaskName "GameCult-Muninn-VideoProof" -VbsPath "$videoProofVbsPath" -PsPath "$videoProofPsPath" Start-ScheduledTask -TaskName "GameCult-Muninn" @@ -949,13 +952,35 @@ $restartExit = $LASTEXITCODE if ($restartExit -eq 0) { Start-Sleep -Seconds 2 $healthScript = Join-Path $PSScriptRoot "health-muninn.ps1" - & powershell.exe -NoProfile -ExecutionPolicy Bypass -File $healthScript ` - -RavenHost $RavenHost ` - -MuninnExe $MuninnExe ` - -StorePath $StorePath ` - -ConnectTimeoutSeconds $ConnectTimeoutSeconds ` - -MaxStoreAgeSeconds ([Math]::Max(180, $ServeStartTimeoutSeconds + 60)) ` - -SshUser $SshUser ` - -IdentityFile $IdentityFile + $healthArgs = @( + "-NoProfile", + "-ExecutionPolicy", + "Bypass", + "-File", + $healthScript, + "-RavenHost", + $RavenHost, + "-MuninnExe", + $MuninnExe, + "-StorePath", + $StorePath, + "-ActivateStorePath", + $ActivateStorePath, + "-IdunnRudpHealth", + $IdunnRudpHealth, + "-CaptureCommandRudpBind", + $CaptureCommandRudpBind, + "-ConnectTimeoutSeconds", + $ConnectTimeoutSeconds.ToString(), + "-MaxStoreAgeSeconds", + ([Math]::Max(180, $ServeStartTimeoutSeconds + 60)).ToString() + ) + if (-not [string]::IsNullOrWhiteSpace($SshUser)) { + $healthArgs += @("-SshUser", $SshUser) + } + if (-not [string]::IsNullOrWhiteSpace($IdentityFile)) { + $healthArgs += @("-IdentityFile", $IdentityFile) + } + & powershell.exe @healthArgs } exit $restartExit