From 33fb6515bd29b58c590bf619c4dbc74241a037d9 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 16 Jun 2026 01:27:45 +0100 Subject: [PATCH] Publish Raven Muninn health without visible task popups --- docs/muninn.md | 8 ++++++-- scripts/health-muninn.ps1 | 25 ++++++++++++------------- scripts/restart-muninn.ps1 | 22 ++++++++++++++++------ 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/docs/muninn.md b/docs/muninn.md index 71325ca..b9fcb5d 100644 --- a/docs/muninn.md +++ b/docs/muninn.md @@ -198,9 +198,13 @@ missing or the Quest is unavailable, Muninn publishes `muninn.quest_access` as Raven runs Muninn from `C:\Meta\Odin\Muninn`. `scripts/restart-muninn.ps1` recreates the `GameCult-Muninn` scheduled task and writes `start-muninn-serve.cmd` as a short trampoline into -`start-muninn-serve.ps1`; the PowerShell launcher starts `muninn.exe` with +`start-muninn-serve-hidden.vbs`, which launches `start-muninn-serve.ps1` with +`wscript.exe //B //Nologo`. The PowerShell launcher starts `muninn.exe` with `-WindowStyle Hidden` and redirects logs under `C:\Meta\Odin\logs\muninn`. -The `.cmd` file must not be the long-lived foreground process. +Raven is an operator-consented host: Muninn operations on Raven must be +background-only and must not create visible terminal windows. The `.cmd` file +must not be the long-lived foreground process, and no restart/health path may +flash an interactive console on Raven. Nightwing Muninn is kept alive by the single Idunn supervisor through the `nightwing-muninn` daemon target. Idunn learns that target through Odin's typed diff --git a/scripts/health-muninn.ps1 b/scripts/health-muninn.ps1 index bcf5121..b83ff74 100644 --- a/scripts/health-muninn.ps1 +++ b/scripts/health-muninn.ps1 @@ -2,13 +2,14 @@ param( [string] $RavenHost = "raven", [string] $MuninnExe = "C:\Meta\Odin\Muninn\muninn.exe", [string] $StorePath = "C:\Meta\Odin\state\muninn.telemetry.cc", - [string] $LocalStorePath = "C:\Meta\Odin\state\muninn.telemetry.cc" + [string] $IdunnRudpHealth = "10.77.0.2:17870" ) $ErrorActionPreference = "Stop" $remoteScript = @" `$ErrorActionPreference = "Stop" +`$ProgressPreference = "SilentlyContinue" if (-not (Test-Path -LiteralPath "$MuninnExe")) { throw "Muninn executable not found at $MuninnExe" } @@ -18,18 +19,16 @@ if (-not (Test-Path -LiteralPath "$MuninnExe")) { if (`$null -eq `$process) { throw "Muninn serve process is not running" } -& "$MuninnExe" --health --store "$StorePath" +`$healthArgs = @( + "--health", + "--store", "$StorePath", + "--idunn-rudp-health", "$IdunnRudpHealth", + "--idunn-daemon", "muninn", + "--idunn-health-contract", "muninn.cultnet-rudp-remote-telemetry-health" +) +& "$MuninnExe" @healthArgs "@ $encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($remoteScript)) -& ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $RavenHost "powershell.exe -NoProfile -EncodedCommand $encoded" -$healthExit = $LASTEXITCODE -if ($healthExit -eq 0) { - $localParent = Split-Path -Parent $LocalStorePath - if (-not [string]::IsNullOrWhiteSpace($localParent)) { - New-Item -ItemType Directory -Force -Path $localParent | Out-Null - } - $remoteStore = "$RavenHost`:$StorePath" - & scp.exe $remoteStore "$LocalStorePath" | Out-Null -} -exit $healthExit +& ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $RavenHost "powershell.exe -NoProfile -NonInteractive -EncodedCommand $encoded" +exit $LASTEXITCODE diff --git a/scripts/restart-muninn.ps1 b/scripts/restart-muninn.ps1 index 4890524..e111725 100644 --- a/scripts/restart-muninn.ps1 +++ b/scripts/restart-muninn.ps1 @@ -2,14 +2,14 @@ param( [string] $RavenHost = "raven", [string] $MuninnExe = "C:\Meta\Odin\Muninn\muninn.exe", [string] $StorePath = "C:\Meta\Odin\state\muninn.telemetry.cc", - [string] $LogRoot = "C:\Meta\Odin\logs\muninn", - [string] $LocalStorePath = "C:\Meta\Odin\state\muninn.telemetry.cc" + [string] $LogRoot = "C:\Meta\Odin\logs\muninn" ) $ErrorActionPreference = "Stop" $remoteScript = @" `$ErrorActionPreference = "Stop" +`$ProgressPreference = "SilentlyContinue" if (-not (Test-Path -LiteralPath "$MuninnExe")) { throw "Muninn executable not found at $MuninnExe" } @@ -23,30 +23,40 @@ New-Item -ItemType Directory -Force -Path (Split-Path -Parent "$StorePath") | Ou `$muninnDir = Split-Path -Parent "$MuninnExe" `$launcher = Join-Path `$muninnDir "start-muninn-serve.cmd" `$psLauncher = Join-Path `$muninnDir "start-muninn-serve.ps1" +`$vbsLauncher = Join-Path `$muninnDir "start-muninn-serve-hidden.vbs" `$pidPath = Join-Path "$LogRoot" "muninn-serve.pid" `$psLines = @( '`$ErrorActionPreference = "Stop"', + '`$ProgressPreference = "SilentlyContinue"', '`$process = Start-Process -FilePath "$MuninnExe" -ArgumentList @("serve", "--store", "$StorePath", "--log-root", "$LogRoot", "--host", "raven", "--interval-seconds", "15") -WindowStyle Hidden -PassThru -RedirectStandardOutput "$LogRoot\muninn-serve.out.log" -RedirectStandardError "$LogRoot\muninn-serve.err.log"', '`$process.Id | Set-Content -Encoding ASCII -LiteralPath "$LogRoot\muninn-serve.pid"' ) Set-Content -LiteralPath `$psLauncher -Value `$psLines -Encoding ASCII +`$vbsLines = @( + 'Set fso = CreateObject("Scripting.FileSystemObject")', + 'scriptDir = fso.GetParentFolderName(WScript.ScriptFullName)', + 'psLauncher = fso.BuildPath(scriptDir, "start-muninn-serve.ps1")', + 'Set shell = CreateObject("WScript.Shell")', + 'shell.Run "powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -WindowStyle Hidden -File """ & psLauncher & """", 0, False' +) +Set-Content -LiteralPath `$vbsLauncher -Value `$vbsLines -Encoding ASCII `$lines = @( "@echo off", "cd /d ""`$muninnDir""", - "powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File ""`$psLauncher""" + "wscript.exe //B //Nologo ""`$vbsLauncher""" ) Set-Content -LiteralPath `$launcher -Value `$lines -Encoding ASCII cmd /c "schtasks /Delete /TN GameCult-Muninn /F 2>NUL" -cmd /c schtasks /Create /TN GameCult-Muninn /SC ONCE /ST 23:59 /TR `$launcher /RL HIGHEST /F +cmd /c schtasks /Create /TN GameCult-Muninn /SC ONCE /ST 23:59 /TR `$launcher /RL LIMITED /F cmd /c schtasks /Run /TN GameCult-Muninn "@ $encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($remoteScript)) -& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $RavenHost "powershell.exe -NoProfile -EncodedCommand $encoded" +& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $RavenHost "powershell.exe -NoProfile -NonInteractive -EncodedCommand $encoded" $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 -LocalStorePath $LocalStorePath + & powershell.exe -NoProfile -ExecutionPolicy Bypass -File $healthScript -RavenHost $RavenHost -MuninnExe $MuninnExe -StorePath $StorePath } exit $restartExit