Surface Mimir sync decode attempts

This commit is contained in:
Meta Vens 2026-05-31 17:39:48 +01:00
commit f6408d43e7
2 changed files with 65 additions and 3 deletions

View file

@ -830,7 +830,10 @@ internal sealed class MimirLiveStatsProvider : IDashboardProvider
{
var snapshot = MimirLiveStatsSnapshot.Load(telemetryLogPath, observationLogPath);
var confidence = snapshot.SyncStates.Count == 0
? snapshot.SyncReports.DefaultIfEmpty().Max(report => report?.Confidence ?? 0.0)
? snapshot.SyncReports.Select(static report => report.Confidence)
.Concat(snapshot.SyncDecodeAttempts.Select(static attempt => attempt.Confidence))
.DefaultIfEmpty(0.0)
.Max()
: snapshot.SyncStates.Average(static state => state.Confidence);
var rms = snapshot.Spectra.Count == 0 ? 0.0 : snapshot.Spectra.Max(static spectrum => spectrum.Rms);
var liveObservationCount = snapshot.ObservationStreams.Count(static stream => stream.State == "active");
@ -843,7 +846,7 @@ internal sealed class MimirLiveStatsProvider : IDashboardProvider
},
new("mimir-tracking-confidence", $"Tracking Confidence\n{confidence:0.000}", "confidence", -0.44, -0.12, 0.28, 0.16, ToneFor(confidence))
{
Detail = $"{snapshot.SyncStates.Count} sync states / {snapshot.SyncReports.Count} reports",
Detail = $"{snapshot.SyncStates.Count} sync states / {snapshot.SyncReports.Count} reports / {snapshot.SyncDecodeAttempts.Count} decode attempts",
},
new("mimir-audio-rms", $"Audio RMS\n{rms:0.000000}", "audio-rms", 0.0, -0.12, 0.28, 0.16, ToneFor(NormalizeRms(rms)))
{
@ -946,6 +949,14 @@ internal sealed class MimirLiveStatsProvider : IDashboardProvider
"caption"));
}
foreach (var attempt in snapshot.SyncDecodeAttempts.OrderByDescending(static attempt => attempt.Confidence).ThenBy(static attempt => attempt.SourceId, StringComparer.Ordinal).Take(8))
{
children.Add(UiElement.Text(
$"sync-decode-{StableId(attempt.ReferenceSourceId)}-{StableId(attempt.SourceId)}",
$"decode {attempt.Status} {attempt.ReferenceSourceId}->{attempt.SourceId} c={attempt.Confidence:0.000} ref={attempt.ReferenceEnergy:0.000} cand={attempt.CandidateEnergy:0.000} matched={attempt.Matched}",
"caption"));
}
if (children.Count == 0)
{
children.Add(UiElement.Text("mimir-sync-empty", "no sync state yet", "caption"));
@ -1073,11 +1084,12 @@ internal sealed class MimirLiveStatsSnapshot
public IReadOnlyList<MimirSpectrumStat> Spectra { get; init; } = [];
public IReadOnlyList<MimirSyncStateStat> SyncStates { get; init; } = [];
public IReadOnlyList<MimirSyncReportStat> SyncReports { get; init; } = [];
public IReadOnlyList<MimirSyncDecodeAttemptStat> SyncDecodeAttempts { get; init; } = [];
public IReadOnlyList<MimirVideoBufferStat> VideoBuffers { get; init; } = [];
public IReadOnlyList<MimirActuatorCommandStat> ActuatorCommands { get; init; } = [];
public IReadOnlyList<MimirObservationStreamStat> ObservationStreams { get; init; } = [];
public bool HasAnyData => Telemetry != null || Spectra.Count > 0 || SyncStates.Count > 0 || VideoBuffers.Count > 0 || ObservationStreams.Count > 0;
public string Summary => $"{Spectra.Count} audio lanes / {SyncStates.Count} sync states / {VideoBuffers.Count} video buffers / {ObservationStreams.Count} device streams";
public string Summary => $"{Spectra.Count} audio lanes / {SyncStates.Count} sync states / {SyncDecodeAttempts.Count} decode attempts / {VideoBuffers.Count} video buffers / {ObservationStreams.Count} device streams";
public static MimirLiveStatsSnapshot Load(string telemetryLogPath, string observationLogPath)
{
@ -1092,6 +1104,7 @@ internal sealed class MimirLiveStatsSnapshot
Spectra = LatestBySource(telemetryLines.Select(ParseSpectrum).Where(static value => value != null)!),
SyncStates = LatestBySource(telemetryLines.Select(ParseSyncState).Where(static value => value != null)!),
SyncReports = LatestBySource(telemetryLines.Select(ParseSyncReport).Where(static value => value != null)!),
SyncDecodeAttempts = LatestSyncDecodeAttempts(telemetryLines.Select(ParseSyncDecodeAttempt).Where(static value => value != null)!),
VideoBuffers = LatestBySource(telemetryLines.Select(ParseVideoBuffer).Where(static value => value != null)!),
ActuatorCommands = LatestBySource(telemetryLines.Select(ParseActuatorCommand).Where(static value => value != null)!),
ObservationStreams = LatestObservationStreams(observationLines),
@ -1150,6 +1163,25 @@ internal sealed class MimirLiveStatsSnapshot
return bySource.Values.OrderBy(static value => value.SourceId, StringComparer.Ordinal).ToArray();
}
private static IReadOnlyList<MimirSyncDecodeAttemptStat> LatestSyncDecodeAttempts(IEnumerable<MimirSyncDecodeAttemptStat?> values)
{
var byRoute = new Dictionary<string, MimirSyncDecodeAttemptStat>(StringComparer.Ordinal);
foreach (var value in values)
{
if (value == null)
{
continue;
}
byRoute[$"{value.ReferenceSourceId}->{value.SourceId}"] = value;
}
return byRoute.Values
.OrderByDescending(static value => value.Confidence)
.ThenBy(static value => value.SourceId, StringComparer.Ordinal)
.ToArray();
}
private static IReadOnlyList<MimirObservationStreamStat> LatestObservationStreams(IEnumerable<string> lines)
{
var byStream = new Dictionary<string, MimirObservationStreamStat>(StringComparer.Ordinal);
@ -1306,6 +1338,33 @@ internal sealed class MimirLiveStatsSnapshot
(int)Number(fields, "timelineEvents") + (int)Number(fields, "directHits"));
}
private static MimirSyncDecodeAttemptStat? ParseSyncDecodeAttempt(string line)
{
if (!line.StartsWith("mimir-sync-decode ", StringComparison.Ordinal))
{
return null;
}
var route = TokenAfterPrefix(line, "mimir-sync-decode ");
var parts = route.Split("->", 2, StringSplitOptions.TrimEntries);
if (parts.Length != 2)
{
return null;
}
var fields = Fields(line);
return new MimirSyncDecodeAttemptStat(
parts[1],
parts[0],
Text(fields, "status", "unknown"),
(int)Number(fields, "compared"),
(int)Number(fields, "rate"),
Number(fields, "refEnergy"),
Number(fields, "candEnergy"),
(int)Number(fields, "matched"),
Number(fields, "confidence"));
}
private static MimirVideoBufferStat? ParseVideoBuffer(string line)
{
if (!line.StartsWith("mimir-video-buffer ", StringComparison.Ordinal))
@ -1437,6 +1496,8 @@ internal sealed record MimirSyncStateStat(string SourceId, string ReferenceSourc
internal sealed record MimirSyncReportStat(string SourceId, string ReferenceSourceId, string Evidence, double DelayUs, double Confidence, int Events) : IMimirSourceStat;
internal sealed record MimirSyncDecodeAttemptStat(string SourceId, string ReferenceSourceId, string Status, int Compared, int SampleRate, double ReferenceEnergy, double CandidateEnergy, int Matched, double Confidence) : IMimirSourceStat;
internal sealed record MimirVideoBufferStat(string SourceId, int Count, string Latest) : IMimirSourceStat;
internal sealed record MimirActuatorCommandStat(string SourceId, double DelaySamples, double Ratio, double Confidence) : IMimirSourceStat;

View file

@ -265,3 +265,4 @@
{"ts": "2026-05-31T09:05:35+01:00", "type": "decision", "status": "ok", "note": "Eve dashboard state now treats flat nodes as a compatibility/data projection and adds a CultUI-shaped surface composition tree as the distributed UI authority; VoidBot swarm emits cockpit/ctb-rail/workspace/pane/card/avatar/text/metric elements, and Fensalir parses the surface for the future Direct2D compositor."}
{"ts": "2026-05-31T17:02:03+01:00", "type": "decision", "status": "ok", "note": "Eve dashboard now publishes mimir.live.stats as a read-only compact telemetry surface; Odin ingests it alongside VoidBot so GUI/TUI clients lower one accepted CultMesh surface instead of scraping renderers."}
{"ts": "2026-05-31T17:20:52+01:00", "type": "implementation", "status": "ok", "note": "Added a dependency-free Mimir.PsMoveProbe for Sony PS Move VID_054C/PID_03D5 over Windows HID. Live USB probe found three collections: generic desktop gamepad with 49-byte input/output/feature reports plus two vendor-defined feature-report collections. Safe read probing now uses overlapped ReadFile/CancelIoEx and times out cleanly at idle; PS Move should be treated as an active marker/IMU witness whose glowing sphere becomes camera calibration evidence, not as a depth owner."}
{"ts": "2026-05-31T17:39:26+01:00", "type": "verification", "status": "ok", "note": "Nightwing/Odin Mimir Live Stats now surfaces sync authority: accepted passive state asio-ch1->asio-ch0 plus decode attempts for rejected/silent routes; loopback ASIO channels remain silent, so dashboard must distinguish accepted sync from failed decode evidence."}