Merge working Muninn transport changes onto main-sync branch
This commit is contained in:
commit
de98f406a9
20 changed files with 1406 additions and 265 deletions
|
|
@ -216,23 +216,6 @@ Get-CimInstance Win32_Process |
|
|||
New-Item -ItemType Directory -Force -Path "$LogRoot" | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path (Split-Path -Parent "$StorePath") | Out-Null
|
||||
|
||||
`$taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "//B //Nologo ""$activateVbsPath"""
|
||||
`$taskTrigger = New-ScheduledTaskTrigger -Once -At ([DateTime]::Today.AddHours(23).AddMinutes(59))
|
||||
`$taskPrincipal = New-ScheduledTaskPrincipal -UserId ([System.Security.Principal.WindowsIdentity]::GetCurrent().Name) -LogonType Interactive -RunLevel Limited
|
||||
`$taskSettings = New-ScheduledTaskSettingsSet -MultipleInstances IgnoreNew
|
||||
Register-ScheduledTask -TaskName "GameCult-Muninn-Activate" -Action `$taskAction -Trigger `$taskTrigger -Principal `$taskPrincipal -Settings `$taskSettings -Force | Out-Null
|
||||
|
||||
`$task = Get-ScheduledTask -TaskName "GameCult-Muninn-Activate" -ErrorAction Stop
|
||||
`$action = @(`$task.Actions)[0]
|
||||
if (`$action.Execute -notmatch '(^|\\)wscript\.exe$') {
|
||||
throw "GameCult-Muninn-Activate action executes `$(`$action.Execute), expected wscript.exe"
|
||||
}
|
||||
if (`$action.Arguments -notlike "*$activateVbsPath*") {
|
||||
throw "GameCult-Muninn-Activate action arguments `$(`$action.Arguments) do not reference $activateVbsPath"
|
||||
}
|
||||
if (`$action.Arguments -notlike "*//B*" -or `$action.Arguments -notlike "*//Nologo*") {
|
||||
throw "GameCult-Muninn-Activate action arguments `$(`$action.Arguments) do not force background WScript execution"
|
||||
}
|
||||
`$vbs = Get-Content -LiteralPath "$activateVbsPath" -Raw
|
||||
if (`$vbs -match 'cmdPath\s*=') {
|
||||
throw "GameCult-Muninn-Activate hidden launcher at $activateVbsPath still routes through a cmdPath trampoline"
|
||||
|
|
@ -240,8 +223,10 @@ if (`$vbs -match 'cmdPath\s*=') {
|
|||
if (`$vbs -notmatch '\.ps1') {
|
||||
throw "GameCult-Muninn-Activate hidden launcher at $activateVbsPath does not reference a PowerShell launcher"
|
||||
}
|
||||
|
||||
Start-ScheduledTask -TaskName "GameCult-Muninn-Activate"
|
||||
if (Get-ScheduledTask -TaskName "GameCult-Muninn-Activate" -ErrorAction SilentlyContinue) {
|
||||
Unregister-ScheduledTask -TaskName "GameCult-Muninn-Activate" -Confirm:`$false | Out-Null
|
||||
}
|
||||
Start-Process -FilePath "wscript.exe" -ArgumentList "//B //Nologo ""$activateVbsPath""" -WindowStyle Hidden | Out-Null
|
||||
"@
|
||||
|
||||
$uploadSpecs = @(
|
||||
|
|
|
|||
|
|
@ -294,12 +294,26 @@ try {
|
|||
}
|
||||
|
||||
if (-not $SkipRestart) {
|
||||
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "restart-muninn.ps1") `
|
||||
-RavenHost $RavenHost `
|
||||
-MuninnExe $MuninnExe `
|
||||
-ConnectTimeoutSeconds $ConnectTimeoutSeconds `
|
||||
-SshUser $SshUser `
|
||||
-IdentityFile $IdentityFile
|
||||
$restartArgs = @(
|
||||
"-NoProfile",
|
||||
"-ExecutionPolicy",
|
||||
"Bypass",
|
||||
"-File",
|
||||
(Join-Path $PSScriptRoot "restart-muninn.ps1"),
|
||||
"-RavenHost",
|
||||
$RavenHost,
|
||||
"-MuninnExe",
|
||||
$MuninnExe,
|
||||
"-ConnectTimeoutSeconds",
|
||||
$ConnectTimeoutSeconds.ToString()
|
||||
)
|
||||
if (-not [string]::IsNullOrWhiteSpace($SshUser)) {
|
||||
$restartArgs += @("-SshUser", $SshUser)
|
||||
}
|
||||
if (-not [string]::IsNullOrWhiteSpace($IdentityFile)) {
|
||||
$restartArgs += @("-IdentityFile", $IdentityFile)
|
||||
}
|
||||
& powershell.exe @restartArgs
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "restart-muninn.ps1 failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,66 +17,155 @@ function Fail-IdunnHealth {
|
|||
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."
|
||||
}
|
||||
|
||||
$healthJson = ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "curl -fsS http://127.0.0.1:8891/health"
|
||||
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($healthJson)) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference /health probe failed."
|
||||
}
|
||||
|
||||
$health = $healthJson | ConvertFrom-Json
|
||||
if (-not $health.ok) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference reported ok=false."
|
||||
}
|
||||
|
||||
if ($health.documentRoot -ne $ExpectedDocumentRoot) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference document root is '$($health.documentRoot)', expected '$ExpectedDocumentRoot'."
|
||||
}
|
||||
|
||||
if ($health.transport -ne "static-http-lowering") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference transport is '$($health.transport)', expected 'static-http-lowering'."
|
||||
}
|
||||
|
||||
if ($null -eq $health.cultCacheWitness) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference did not report cultCacheWitness status."
|
||||
}
|
||||
|
||||
if ($health.cultCacheWitness.status -ne "published") {
|
||||
$detail = $health.cultCacheWitness.error
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference has not published its daemon-owned CultCache witness. $detail"
|
||||
}
|
||||
|
||||
if ($health.cultCacheWitness.path -ne $RemoteCultCacheWitness) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference CultCache witness path is '$($health.cultCacheWitness.path)', expected '$RemoteCultCacheWitness'."
|
||||
}
|
||||
|
||||
$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 = @($health.cultCacheWitness.publishedSchemas)
|
||||
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 $health.idunnRudpHealth -or $health.idunnRudpHealth.status -ne "published") {
|
||||
$detail = if ($null -eq $health.idunnRudpHealth) { "missing idunnRudpHealth status" } else { $health.idunnRudpHealth.error }
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference has not published daemon-owned Idunn RUDP health. $detail"
|
||||
}
|
||||
|
||||
$cultCacheStat = ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "stat -c '%s %Y %U %G' '$RemoteCultCacheWitness' 2>/dev/null"
|
||||
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($cultCacheStat)) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve browser reference CultCache witness is missing at $RemoteCultCacheWitness."
|
||||
}
|
||||
$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) {
|
||||
|
|
@ -100,4 +189,147 @@ 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."
|
||||
}
|
||||
|
||||
Write-Host "Nightwing Eve browser reference is active, publishing its daemon-owned CultCache witness, and keeping Idunn RUDP health live."
|
||||
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 -notmatch "nightwing-eve-browser-reference\.service") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference lifecycle authority is '$($inspection.commandBoundary.lifecycleAuthority)', expected the systemd service to remain the compatibility lifecycle witness."
|
||||
}
|
||||
|
||||
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 "compatibility.http-static-lowering") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve browser reference input transport is '$($inspection.transportProfile.inputTransport)', expected 'compatibility.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."
|
||||
|
|
|
|||
|
|
@ -19,89 +19,208 @@ function Fail-IdunnHealth {
|
|||
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,
|
||||
[string] $Mode
|
||||
)
|
||||
|
||||
$nodeScript = @'
|
||||
const fs = require("fs");
|
||||
const { createRequire } = require("module");
|
||||
|
||||
const witnessCopyPath = process.argv[2];
|
||||
const inspectorPackageJson = process.argv[3];
|
||||
const mode = process.argv[4];
|
||||
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 allRecords(schemaName) {
|
||||
return inspection.records.filter((record) => record.schemaName === schemaName);
|
||||
}
|
||||
|
||||
function previewArray(record) {
|
||||
return Array.isArray(record && record.payloadPreview) ? record.payloadPreview : [];
|
||||
}
|
||||
|
||||
function normalizeDashboardState(record) {
|
||||
if (!record) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const preview = previewArray(record);
|
||||
const surface = Array.isArray(preview[7]) ? preview[7] : [];
|
||||
const root = Array.isArray(surface[3]) ? surface[3] : [];
|
||||
const children = Array.isArray(root[11]) ? root[11] : [];
|
||||
return {
|
||||
schemaName: record.schemaName,
|
||||
storedAt: record.storedAt,
|
||||
providerId: preview[0] ?? "",
|
||||
title: preview[1] ?? "",
|
||||
version: preview[2] ?? 0,
|
||||
updatedAtUtc: preview[3] ?? "",
|
||||
selectedNodeId: preview[4] ?? "",
|
||||
lutPreset: preview[5] ?? "",
|
||||
nodeCount: Array.isArray(preview[6]) ? preview[6].length : 0,
|
||||
surfaceSchema: surface[0] ?? "",
|
||||
surfaceId: surface[1] ?? "",
|
||||
surfaceTitle: surface[2] ?? "",
|
||||
surfaceRootKind: root[1] ?? "",
|
||||
surfaceChildCount: children.length,
|
||||
assetCount: Array.isArray(surface[4]) ? surface[4].length : 0,
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeManifest(record) {
|
||||
if (!record) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const preview = previewArray(record);
|
||||
return {
|
||||
schemaName: record.schemaName,
|
||||
storedAt: record.storedAt,
|
||||
providerId: preview[0] ?? "",
|
||||
title: preview[1] ?? "",
|
||||
description: preview[2] ?? "",
|
||||
version: preview[3] ?? "",
|
||||
endpoint: preview[4] ?? "",
|
||||
capabilityCount: Array.isArray(preview[5]) ? preview[5].length : 0,
|
||||
usesCultMesh: preview[6] === true,
|
||||
transport: preview[7] ?? "",
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeCommandBoundary(record) {
|
||||
if (!record) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const preview = previewArray(record);
|
||||
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] : [],
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeTransportProfile(record) {
|
||||
if (!record) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const preview = previewArray(record);
|
||||
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] ?? "",
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeDaemonHealth(record) {
|
||||
if (!record) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const preview = previewArray(record);
|
||||
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] ?? "",
|
||||
};
|
||||
}
|
||||
|
||||
let payload;
|
||||
switch (mode) {
|
||||
case "dashboard-state":
|
||||
payload = {
|
||||
format: inspection.format,
|
||||
schemaVersions: inspection.catalog.map((entry) => entry.schemaVersion),
|
||||
dashboardState: normalizeDashboardState(firstRecord("mimir.eve_dashboard_state")),
|
||||
};
|
||||
break;
|
||||
case "dashboard-boundary":
|
||||
payload = {
|
||||
format: inspection.format,
|
||||
schemaVersions: inspection.catalog.map((entry) => entry.schemaVersion),
|
||||
brokerManifest: normalizeManifest(allRecords("mimir.eve_dashboard_manifest").find((record) => record.key === "eve.dashboard.broker") ?? null),
|
||||
providerManifests: allRecords("mimir.eve_dashboard_manifest")
|
||||
.filter((record) => record.key !== "eve.dashboard.broker")
|
||||
.map(normalizeManifest),
|
||||
commandBoundary: normalizeCommandBoundary(firstRecord("mimir.eve_dashboard_command_boundary")),
|
||||
transportProfile: normalizeTransportProfile(firstRecord("mimir.eve_dashboard_transport_profile")),
|
||||
daemonHealthRecords: allRecords("idunn.daemon_health").map(normalizeDaemonHealth),
|
||||
};
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown inspection mode '${mode}'.`);
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(payload));
|
||||
'@
|
||||
|
||||
$inspectionJson = $nodeScript | node - $WitnessCopyPath $InspectorPackageJson $Mode
|
||||
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($inspectionJson)) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard witness inspection failed for mode '$Mode'."
|
||||
}
|
||||
|
||||
try {
|
||||
return $inspectionJson | ConvertFrom-Json
|
||||
} catch {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard witness inspection returned malformed JSON for mode '$Mode'."
|
||||
}
|
||||
}
|
||||
|
||||
ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "systemctl is-active --quiet nightwing-eve-dashboard.service"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Fail-IdunnHealth -State "failed" -Message "nightwing-eve-dashboard.service is not active on Nightwing."
|
||||
}
|
||||
|
||||
$healthJson = ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "curl -fsS http://127.0.0.1:8795/health"
|
||||
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($healthJson)) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard /health probe failed."
|
||||
}
|
||||
|
||||
$health = $healthJson | ConvertFrom-Json
|
||||
if (-not $health.ok) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard reported ok=false."
|
||||
}
|
||||
|
||||
if ($health.cultMeshDocument -ne "mimir.eve_dashboard_state") {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard reported unexpected CultMesh document '$($health.cultMeshDocument)'."
|
||||
}
|
||||
|
||||
if ($null -eq $health.cultMeshWitness) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard did not report cultMeshWitness status."
|
||||
}
|
||||
|
||||
if ($health.cultMeshWitness.status -ne "published") {
|
||||
$detail = $health.cultMeshWitness.error
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard has not published its CultMesh state witness. $detail"
|
||||
}
|
||||
|
||||
if ($health.cultMeshWitness.path -ne $RemoteCultMeshState) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard CultMesh state path is '$($health.cultMeshWitness.path)', expected '$RemoteCultMeshState'."
|
||||
}
|
||||
|
||||
if ($null -eq $health.cultCacheWitness) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard did not report cultCacheWitness status."
|
||||
}
|
||||
|
||||
if ($health.cultCacheWitness.status -ne "published") {
|
||||
$detail = $health.cultCacheWitness.error
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard has not published its daemon-owned CultCache witness. $detail"
|
||||
}
|
||||
|
||||
if ($health.cultCacheWitness.path -ne $RemoteCultCacheWitness) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard CultCache witness path is '$($health.cultCacheWitness.path)', expected '$RemoteCultCacheWitness'."
|
||||
}
|
||||
|
||||
$requiredCultMeshSchemas = @(
|
||||
"mimir.eve_dashboard_state.v1"
|
||||
)
|
||||
|
||||
$publishedCultMeshSchemas = @($health.cultMeshWitness.publishedSchemas)
|
||||
foreach ($schema in $requiredCultMeshSchemas) {
|
||||
if ($publishedCultMeshSchemas -notcontains $schema) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard CultMesh witness is missing schema '$schema'."
|
||||
}
|
||||
}
|
||||
|
||||
$requiredCultCacheSchemas = @(
|
||||
"mimir.eve_dashboard_manifest.v1",
|
||||
"mimir.eve_dashboard_command_boundary.v1",
|
||||
"mimir.eve_dashboard_transport_profile.v1",
|
||||
"idunn.daemon_health.v1"
|
||||
)
|
||||
|
||||
$publishedCultCacheSchemas = @($health.cultCacheWitness.publishedSchemas)
|
||||
foreach ($schema in $requiredCultCacheSchemas) {
|
||||
if ($publishedCultCacheSchemas -notcontains $schema) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard CultCache witness is missing schema '$schema'."
|
||||
}
|
||||
}
|
||||
|
||||
if ($null -eq $health.idunnRudpHealth -or $health.idunnRudpHealth.status -ne "published") {
|
||||
$detail = if ($null -eq $health.idunnRudpHealth) { "missing idunnRudpHealth status" } else { $health.idunnRudpHealth.error }
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard has not published daemon-owned Idunn RUDP health. $detail"
|
||||
}
|
||||
|
||||
if ([int]$health.providers -lt $MinProviders) {
|
||||
Fail-IdunnHealth -State "dependency-unavailable" -Message "Nightwing Eve dashboard reports too few providers: providers=$($health.providers), expected at least $MinProviders."
|
||||
}
|
||||
|
||||
$cultMeshStateStat = ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "stat -c '%s %Y' '$RemoteCultMeshState' 2>/dev/null"
|
||||
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($cultMeshStateStat)) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard CultMesh state witness is missing at $RemoteCultMeshState."
|
||||
}
|
||||
$cultMeshStateStat = Invoke-SshText `
|
||||
-Command "stat -c '%s %Y' '$RemoteCultMeshState' 2>/dev/null" `
|
||||
-FailureMessage "Nightwing Eve dashboard CultMesh state witness is missing at $RemoteCultMeshState."
|
||||
|
||||
$cultMeshStateParts = $cultMeshStateStat.Trim() -split '\s+'
|
||||
if ($cultMeshStateParts.Length -lt 2) {
|
||||
|
|
@ -119,10 +238,9 @@ if ($cultMeshStateAgeSeconds -gt $MaxWitnessAgeSeconds) {
|
|||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard CultMesh state witness is stale ($([math]::Round($cultMeshStateAgeSeconds))s old)."
|
||||
}
|
||||
|
||||
$cultCacheStat = ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "stat -c '%s %Y' '$RemoteCultCacheWitness' 2>/dev/null"
|
||||
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($cultCacheStat)) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard CultCache witness is missing at $RemoteCultCacheWitness."
|
||||
}
|
||||
$cultCacheStat = Invoke-SshText `
|
||||
-Command "stat -c '%s %Y' '$RemoteCultCacheWitness' 2>/dev/null" `
|
||||
-FailureMessage "Nightwing Eve dashboard CultCache witness is missing at $RemoteCultCacheWitness."
|
||||
|
||||
$cultCacheParts = $cultCacheStat.Trim() -split '\s+'
|
||||
if ($cultCacheParts.Length -lt 2) {
|
||||
|
|
@ -140,9 +258,174 @@ if ($cultCacheAgeSeconds -gt $MaxWitnessAgeSeconds) {
|
|||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard CultCache witness is stale ($([math]::Round($cultCacheAgeSeconds))s old)."
|
||||
}
|
||||
|
||||
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."
|
||||
}
|
||||
|
||||
$cultMeshWitnessCopy = Join-Path ([System.IO.Path]::GetTempPath()) ("nightwing-eve-dashboard-state-" + [Guid]::NewGuid().ToString("N") + ".ccmp")
|
||||
$cultCacheWitnessCopy = Join-Path ([System.IO.Path]::GetTempPath()) ("nightwing-eve-dashboard-boundary-" + [Guid]::NewGuid().ToString("N") + ".cc")
|
||||
try {
|
||||
$remoteCultMeshBase64 = Invoke-SshText `
|
||||
-Command "base64 -w0 '$RemoteCultMeshState' 2>/dev/null" `
|
||||
-FailureMessage "Nightwing Eve dashboard CultMesh witness could not be copied from Nightwing."
|
||||
[System.IO.File]::WriteAllBytes($cultMeshWitnessCopy, [Convert]::FromBase64String($remoteCultMeshBase64.Trim()))
|
||||
$cultMeshInspection = Get-CultCacheInspection -WitnessCopyPath $cultMeshWitnessCopy -InspectorPackageJson $cultCacheInspectorPackageJson -Mode "dashboard-state"
|
||||
|
||||
$remoteCultCacheBase64 = Invoke-SshText `
|
||||
-Command "base64 -w0 '$RemoteCultCacheWitness' 2>/dev/null" `
|
||||
-FailureMessage "Nightwing Eve dashboard CultCache witness could not be copied from Nightwing."
|
||||
[System.IO.File]::WriteAllBytes($cultCacheWitnessCopy, [Convert]::FromBase64String($remoteCultCacheBase64.Trim()))
|
||||
$cultCacheInspection = Get-CultCacheInspection -WitnessCopyPath $cultCacheWitnessCopy -InspectorPackageJson $cultCacheInspectorPackageJson -Mode "dashboard-boundary"
|
||||
} catch [FormatException] {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard witness copy was not valid base64."
|
||||
} finally {
|
||||
foreach ($temporaryWitness in @($cultMeshWitnessCopy, $cultCacheWitnessCopy)) {
|
||||
if (Test-Path $temporaryWitness) {
|
||||
Remove-Item $temporaryWitness -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($cultMeshInspection.format -ne "cultcache.store.v1") {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard CultMesh witness has unexpected format '$($cultMeshInspection.format)'."
|
||||
}
|
||||
|
||||
$requiredCultMeshSchemas = @(
|
||||
"mimir.eve_dashboard_state.v1"
|
||||
)
|
||||
|
||||
$publishedCultMeshSchemas = @($cultMeshInspection.schemaVersions)
|
||||
foreach ($schema in $requiredCultMeshSchemas) {
|
||||
if ($publishedCultMeshSchemas -notcontains $schema) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard CultMesh witness is missing schema '$schema'."
|
||||
}
|
||||
}
|
||||
|
||||
if ($null -eq $cultMeshInspection.dashboardState) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard CultMesh witness is missing its dashboard-state record."
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($cultMeshInspection.dashboardState.providerId)) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard CultMesh state is missing a providerId."
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($cultMeshInspection.dashboardState.selectedNodeId)) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard CultMesh state is missing a selectedNodeId."
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($cultMeshInspection.dashboardState.title)) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard CultMesh state is missing a title."
|
||||
}
|
||||
|
||||
if ([int]$cultMeshInspection.dashboardState.nodeCount -le 0) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard CultMesh state has no nodes."
|
||||
}
|
||||
|
||||
if ($cultCacheInspection.format -ne "cultcache.store.v1") {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard CultCache witness has unexpected format '$($cultCacheInspection.format)'."
|
||||
}
|
||||
|
||||
$requiredCultCacheSchemas = @(
|
||||
"mimir.eve_dashboard_manifest.v1",
|
||||
"mimir.eve_dashboard_command_boundary.v1",
|
||||
"mimir.eve_dashboard_transport_profile.v1",
|
||||
"idunn.daemon_health.v1"
|
||||
)
|
||||
|
||||
$publishedCultCacheSchemas = @($cultCacheInspection.schemaVersions)
|
||||
foreach ($schema in $requiredCultCacheSchemas) {
|
||||
if ($publishedCultCacheSchemas -notcontains $schema) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard CultCache witness is missing schema '$schema'."
|
||||
}
|
||||
}
|
||||
|
||||
if ($null -eq $cultCacheInspection.brokerManifest) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard CultCache witness is missing its broker manifest record."
|
||||
}
|
||||
|
||||
if ($cultCacheInspection.brokerManifest.providerId -ne "eve.dashboard.broker") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard broker manifest advertises provider '$($cultCacheInspection.brokerManifest.providerId)', expected 'eve.dashboard.broker'."
|
||||
}
|
||||
|
||||
if ([int]@($cultCacheInspection.providerManifests).Count -lt $MinProviders) {
|
||||
Fail-IdunnHealth -State "dependency-unavailable" -Message "Nightwing Eve dashboard has too few provider manifests in its daemon-owned witness: providers=$(@($cultCacheInspection.providerManifests).Count), expected at least $MinProviders."
|
||||
}
|
||||
|
||||
if ($null -eq $cultCacheInspection.commandBoundary) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard CultCache witness is missing its command boundary record."
|
||||
}
|
||||
|
||||
if ($cultCacheInspection.commandBoundary.mode -ne "operator-write-through-broker") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard command boundary mode is '$($cultCacheInspection.commandBoundary.mode)', expected 'operator-write-through-broker'."
|
||||
}
|
||||
|
||||
if (-not $cultCacheInspection.commandBoundary.writesAccepted) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard command boundary unexpectedly rejects writes."
|
||||
}
|
||||
|
||||
if ($cultCacheInspection.commandBoundary.lifecycleAuthority -notmatch "nightwing-eve-dashboard\.service") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard lifecycle authority is '$($cultCacheInspection.commandBoundary.lifecycleAuthority)', expected the systemd service to remain the compatibility lifecycle witness."
|
||||
}
|
||||
|
||||
if ($null -eq $cultCacheInspection.transportProfile) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard CultCache witness is missing its transport profile record."
|
||||
}
|
||||
|
||||
if ($cultCacheInspection.transportProfile.currentState -ne "partial-rudp-health-and-provider-store-live") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard transport profile state is '$($cultCacheInspection.transportProfile.currentState)', expected 'partial-rudp-health-and-provider-store-live'."
|
||||
}
|
||||
|
||||
if ($cultCacheInspection.transportProfile.inputTransport -ne "compatibility.http-websocket-client-lowering + compatibility.websocket-binary-command-lowering") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard input transport is '$($cultCacheInspection.transportProfile.inputTransport)', expected 'compatibility.http-websocket-client-lowering + compatibility.websocket-binary-command-lowering'."
|
||||
}
|
||||
|
||||
if ($cultCacheInspection.transportProfile.outputTransport -ne "daemon-owned-cultcache-provider-store + daemon-published-rudp-health") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard output transport is '$($cultCacheInspection.transportProfile.outputTransport)', expected 'daemon-owned-cultcache-provider-store + daemon-published-rudp-health'."
|
||||
}
|
||||
|
||||
if ($cultCacheInspection.transportProfile.idunnRudpHealth -ne "idunn.health-published-separately") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard transport profile Idunn health publication is '$($cultCacheInspection.transportProfile.idunnRudpHealth)', expected 'idunn.health-published-separately'."
|
||||
}
|
||||
|
||||
if ($cultCacheInspection.transportProfile.witnessPath -ne $RemoteCultCacheWitness) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard transport profile witness path is '$($cultCacheInspection.transportProfile.witnessPath)', expected '$RemoteCultCacheWitness'."
|
||||
}
|
||||
|
||||
$matchingHealthRecord = @($cultCacheInspection.daemonHealthRecords | Where-Object {
|
||||
$_.healthContract -eq $cultCacheInspection.transportProfile.healthContract
|
||||
}) | Select-Object -First 1
|
||||
if ($null -eq $matchingHealthRecord) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard has no daemon-health record matching contract '$($cultCacheInspection.transportProfile.healthContract)'."
|
||||
}
|
||||
|
||||
if ($matchingHealthRecord.state -ne "healthy") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard daemon-health state is '$($matchingHealthRecord.state)', expected 'healthy'."
|
||||
}
|
||||
|
||||
if ($matchingHealthRecord.publicationSource -ne "daemon-published") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard daemon-health publication source is '$($matchingHealthRecord.publicationSource)', expected 'daemon-published'."
|
||||
}
|
||||
|
||||
if ($matchingHealthRecord.transport -ne "cultnet.transport.rudp.v0") {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard daemon-health transport is '$($matchingHealthRecord.transport)', expected 'cultnet.transport.rudp.v0'."
|
||||
}
|
||||
|
||||
try {
|
||||
$matchingHealthObservedAtUtc = [DateTimeOffset]::Parse($matchingHealthRecord.observedAt)
|
||||
} catch {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard daemon-health observedAt is malformed: '$($matchingHealthRecord.observedAt)'."
|
||||
}
|
||||
|
||||
$matchingHealthAgeSeconds = ([DateTimeOffset]::UtcNow - $matchingHealthObservedAtUtc.ToUniversalTime()).TotalSeconds
|
||||
if ($matchingHealthAgeSeconds -gt $MaxWitnessAgeSeconds) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Eve dashboard daemon-health record is stale ($([math]::Round($matchingHealthAgeSeconds))s old)."
|
||||
}
|
||||
|
||||
$legacyWitnessStillExists = ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "test ! -e '$LegacyWindowsWitness'"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Eve dashboard still has the legacy Windows-shaped witness file at $LegacyWindowsWitness."
|
||||
}
|
||||
|
||||
Write-Host "Nightwing Eve dashboard is active, publishing daemon-owned CultMesh witness state, and advertising $($health.providers) providers."
|
||||
Write-Host "Nightwing Eve dashboard is active, its CultMesh and CultCache witnesses are fresh, and the daemon-owned boundary store advertises $(@($cultCacheInspection.providerManifests).Count) providers."
|
||||
|
|
|
|||
|
|
@ -67,6 +67,21 @@ else
|
|||
echo 'Muninn serve process is not running on Nightwing' >&2
|
||||
exit 1
|
||||
fi
|
||||
process_line="`$(pgrep -af '[m]uninn serve .*--host nightwing' | head -n1 || true)"
|
||||
if [ -z "`$process_line" ]; then
|
||||
echo 'Nightwing Muninn serve command line is unavailable' >&2
|
||||
exit 1
|
||||
fi
|
||||
for pattern in \
|
||||
'--idunn-rudp-health $IdunnRudpHealth' \
|
||||
'--idunn-daemon nightwing-muninn' \
|
||||
'--idunn-health-contract muninn.cultnet-rudp-remote-telemetry-and-move-hid'
|
||||
do
|
||||
if ! printf '%s\n' "`$process_line" | grep -F -- "`$pattern" >/dev/null 2>&1; then
|
||||
echo "Nightwing Muninn serve command line is missing `$pattern" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
if [ ! -f '$StorePath' ]; then
|
||||
echo 'Muninn telemetry store is missing on Nightwing' >&2
|
||||
exit 1
|
||||
|
|
@ -78,13 +93,18 @@ if [ "`$store_age" -gt '$MaxStoreAgeSeconds' ]; then
|
|||
echo "Muninn telemetry store is stale on Nightwing (`$store_age s old)" >&2
|
||||
exit 1
|
||||
fi
|
||||
identity_output="`$('$MuninnExe' move-identity-status --store '$StorePath' --host nightwing)"
|
||||
if printf '%s\n' "`$identity_output" | grep -Fq 'No Muninn Move identity records found'; then
|
||||
echo 'Muninn Move identity roster is empty on Nightwing' >&2
|
||||
exit 1
|
||||
if printf '%s\n' "`$process_line" | grep -F -- '--move-state' >/dev/null 2>&1 || \
|
||||
printf '%s\n' "`$process_line" | grep -F -- '--move-evidence-stream' >/dev/null 2>&1; then
|
||||
identity_output="`$('$MuninnExe' move-identity-status --store '$StorePath' --host nightwing)"
|
||||
if printf '%s\n' "`$identity_output" | grep -Fq 'No Muninn Move identity records found'; then
|
||||
echo 'Muninn Move identity roster is empty on Nightwing' >&2
|
||||
exit 1
|
||||
fi
|
||||
identity_count="`$(printf '%s\n' "`$identity_output" | grep -c 'move-identity move=')"
|
||||
echo "Muninn healthy: nightwing store_age=`${store_age}s move_runtime=explicit move_identities=`${identity_count}"
|
||||
else
|
||||
echo "Muninn healthy: nightwing store_age=`${store_age}s move_runtime=disabled"
|
||||
fi
|
||||
identity_count="`$(printf '%s\n' "`$identity_output" | grep -c 'move-identity move=')"
|
||||
echo "Muninn healthy: nightwing store_age=`${store_age}s move_identities=`${identity_count}"
|
||||
"@
|
||||
|
||||
Invoke-NightwingUploadedShell -SshTarget $SshTarget -RemoteScriptContent $remoteScript -TempPrefix "odin-nightwing-muninn-health"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
param(
|
||||
[string] $MuninnExe = "C:\Meta\Odin\Muninn\muninn.exe",
|
||||
[string] $StorePath = "C:\Meta\Odin\state\starfire.muninn.telemetry.cc",
|
||||
[string] $LogRoot = "C:\Meta\Odin\logs\starfire-muninn",
|
||||
[string[]] $MoveState = @(),
|
||||
[int] $IntervalSeconds = 15,
|
||||
[int] $MaxStoreAgeSeconds = 180,
|
||||
[string] $IdunnRudpHealth = "127.0.0.1:17870"
|
||||
)
|
||||
|
||||
|
|
@ -23,23 +24,23 @@ $process = Get-CimInstance Win32_Process |
|
|||
if ($null -eq $process) {
|
||||
throw "Starfire Muninn serve process is not running with Quest access enabled"
|
||||
}
|
||||
|
||||
$healthArgs = @(
|
||||
"--health",
|
||||
"--store", $StorePath,
|
||||
"--host", "starfire",
|
||||
"--interval-seconds", "$IntervalSeconds"
|
||||
)
|
||||
foreach ($source in $MoveState) {
|
||||
if (-not [string]::IsNullOrWhiteSpace($source)) {
|
||||
$healthArgs += @("--move-state", $source)
|
||||
foreach ($pattern in @(
|
||||
"--idunn-rudp-health $IdunnRudpHealth",
|
||||
"--idunn-daemon starfire-muninn",
|
||||
"--idunn-health-contract muninn.cultnet-rudp-local-telemetry-and-quest-access"
|
||||
)) {
|
||||
if ($process.CommandLine -notlike "*$pattern*") {
|
||||
throw "Starfire Muninn serve process is missing expected command-line segment ${pattern}: $($process.CommandLine)"
|
||||
}
|
||||
}
|
||||
|
||||
& $MuninnExe @healthArgs
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
if (-not (Test-Path -LiteralPath $StorePath)) {
|
||||
throw "Starfire Muninn telemetry store is missing at $StorePath"
|
||||
}
|
||||
$storeAgeSeconds = (([DateTime]::UtcNow) - (Get-Item -LiteralPath $StorePath).LastWriteTimeUtc).TotalSeconds
|
||||
if ($storeAgeSeconds -gt $MaxStoreAgeSeconds) {
|
||||
throw "Starfire Muninn telemetry store is stale ($([math]::Round($storeAgeSeconds))s old)"
|
||||
}
|
||||
$pidPath = Join-Path $LogRoot "muninn-serve.pid"
|
||||
if (-not (Test-Path -LiteralPath $pidPath)) {
|
||||
throw "Starfire Muninn serve PID file is missing at $pidPath"
|
||||
}
|
||||
|
||||
& $MuninnExe quest-access-status --store $StorePath
|
||||
exit $LASTEXITCODE
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ $IdunnDeploymentTargets = @(
|
|||
Host = "starfire"
|
||||
Service = "muninn serve --host starfire"
|
||||
Status = "runtime-enforced"
|
||||
Health = "$repoRoot\scripts\health-starfire-muninn.cmd"
|
||||
Health = "$repoRoot\scripts\health-starfire-muninn.ps1"
|
||||
Deploy = $null
|
||||
Restart = "$repoRoot\scripts\restart-starfire-muninn.cmd"
|
||||
Restart = "$repoRoot\scripts\restart-starfire-muninn.ps1"
|
||||
Reason = "Central Idunn keeps Starfire-local Muninn alive for Quest access and local telemetry surfaces."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
|
|
@ -20,9 +20,9 @@ $IdunnDeploymentTargets = @(
|
|||
Host = "nightwing"
|
||||
Service = "muninn serve --host nightwing"
|
||||
Status = "runtime-enforced"
|
||||
Health = "$repoRoot\scripts\health-nightwing-muninn.cmd"
|
||||
Health = "$repoRoot\scripts\health-nightwing-muninn.ps1"
|
||||
Deploy = $null
|
||||
Restart = "$repoRoot\scripts\restart-nightwing-muninn.cmd"
|
||||
Restart = "$repoRoot\scripts\restart-nightwing-muninn.ps1"
|
||||
Reason = "Central Idunn reaches Nightwing over SSH and keeps the host-local Muninn Move HID daemon alive."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
@echo off
|
||||
ssh.exe -o BatchMode=yes -o ConnectTimeout=5 nwroot systemctl restart nightwing-eve-browser-reference.service
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-nightwing-eve-browser-reference.ps1
|
||||
|
|
|
|||
13
scripts/restart-nightwing-eve-browser-reference.ps1
Normal file
13
scripts/restart-nightwing-eve-browser-reference.ps1
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
param(
|
||||
[string] $SshTarget = "nwroot",
|
||||
[string] $Service = "nightwing-eve-browser-reference.service"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
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."
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
@echo off
|
||||
ssh.exe -o BatchMode=yes -o ConnectTimeout=5 nwroot systemctl restart nightwing-eve-dashboard.service
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-nightwing-eve-dashboard.ps1
|
||||
|
|
|
|||
13
scripts/restart-nightwing-eve-dashboard.ps1
Normal file
13
scripts/restart-nightwing-eve-dashboard.ps1
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
param(
|
||||
[string] $SshTarget = "nwroot",
|
||||
[string] $Service = "nightwing-eve-dashboard.service"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
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."
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
@echo off
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-nightwing-muninn.ps1
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-nightwing-muninn.ps1 -DiscoverMoveState -ClaimUsbMoves
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ param(
|
|||
[string] $StorePath = "/home/metacrat/.local/state/gamecult/muninn/muninn.telemetry.cc",
|
||||
[string] $LogRoot = "/home/metacrat/.local/state/gamecult/muninn",
|
||||
[string[]] $MoveState = @(),
|
||||
[string] $MoveHost = "5C:93:A2:9C:A8:A8",
|
||||
[switch] $DiscoverMoveState,
|
||||
[switch] $ClaimUsbMoves,
|
||||
[string] $MoveEvidenceStream = "muninn:nightwing:move-evidence",
|
||||
[int] $IntervalSeconds = 15,
|
||||
[string] $IdunnRudpHealth = "10.77.0.2:17870",
|
||||
|
|
@ -59,22 +60,30 @@ function Invoke-UploadedShell {
|
|||
}
|
||||
|
||||
$moveStateSpecs = @($MoveState | Where-Object { -not [string]::IsNullOrWhiteSpace($_) })
|
||||
if ($moveStateSpecs.Count -eq 0) {
|
||||
if ($ClaimUsbMoves.IsPresent -and -not $DiscoverMoveState.IsPresent -and $moveStateSpecs.Count -eq 0) {
|
||||
throw "-ClaimUsbMoves requires -DiscoverMoveState or at least one explicit -MoveState value."
|
||||
}
|
||||
if ($DiscoverMoveState.IsPresent) {
|
||||
$claimScript = Join-Path $PSScriptRoot "claim-nightwing-usb-moves.ps1"
|
||||
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File $claimScript -SshTarget $SshTarget
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
if ($ClaimUsbMoves.IsPresent) {
|
||||
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File $claimScript -SshTarget $SshTarget
|
||||
}
|
||||
$sourceScript = Join-Path $PSScriptRoot "get-nightwing-move-state-sources.ps1"
|
||||
$moveStateSpecs = @(& powershell.exe -NoProfile -ExecutionPolicy Bypass -File $sourceScript -SshTarget $SshTarget)
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
if ($moveStateSpecs.Count -eq 0) {
|
||||
throw "Nightwing Move runtime was explicitly requested, but no live Move state sources were discovered."
|
||||
}
|
||||
}
|
||||
|
||||
$moveStateSetLines = ($moveStateSpecs | ForEach-Object {
|
||||
"set -- ""`$@"" --move-state $(Quote-ShSingle $_)"
|
||||
}) -join "`n"
|
||||
$moveRuntimeSetLines = @()
|
||||
if ($moveStateSpecs.Count -gt 0) {
|
||||
$moveRuntimeSetLines += $moveStateSetLines
|
||||
$moveRuntimeSetLines += "set -- ""`$@"" --move-evidence-stream $(Quote-ShSingle $MoveEvidenceStream)"
|
||||
}
|
||||
$moveRuntimeSetBlock = ($moveRuntimeSetLines -join "`n")
|
||||
|
||||
$remoteScript = @"
|
||||
set -eu
|
||||
|
|
@ -93,11 +102,9 @@ done
|
|||
set -- serve \
|
||||
--store '$StorePath' \
|
||||
--log-root '$LogRoot' \
|
||||
--host nightwing \
|
||||
--move-host '$MoveHost'
|
||||
$moveStateSetLines
|
||||
--host nightwing
|
||||
$moveRuntimeSetBlock
|
||||
set -- "`$@" \
|
||||
--move-evidence-stream '$MoveEvidenceStream' \
|
||||
--interval-seconds '$IntervalSeconds' \
|
||||
--idunn-rudp-health '$IdunnRudpHealth' \
|
||||
--idunn-daemon '$IdunnDaemon' \
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ param(
|
|||
[int]$Channels = 2,
|
||||
[ValidateSet("Render", "Capture")]
|
||||
[string]$DataFlow = "Render",
|
||||
[bool]$Loopback = $true,
|
||||
[switch]$Loopback,
|
||||
[ValidateSet("Console", "Multimedia", "Communications")]
|
||||
[string]$Role = "Console"
|
||||
)
|
||||
|
|
@ -238,11 +238,6 @@ namespace Mimir {
|
|||
uint packetFrames;
|
||||
Check(captureClient.GetNextPacketSize(out packetFrames), "GetNextPacketSize");
|
||||
if (packetFrames == 0) {
|
||||
if (silence.Length < idleBytes) {
|
||||
silence = new byte[idleBytes];
|
||||
}
|
||||
output.Write(silence, 0, idleBytes);
|
||||
output.Flush();
|
||||
Thread.Sleep(5);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue