Seed program surface CultCache config

This commit is contained in:
Meta Vens 2026-06-01 00:19:15 +01:00
commit fe101a579a
6 changed files with 146 additions and 0 deletions

Binary file not shown.

View file

@ -59,6 +59,14 @@ Get-Content .\state\evidence.jsonl -Tail 8
`MimirSynchronizationHub.AudioSynchronizationStates`. Do not move sample
alignment, chirp response mapping, or ambient/noise neutralization authority
into the UI; the surface only controls and observes runtime audio state.
- Program surface placement is seeded from CultCache config
`config/mimir-program-surface.cc` unless `--cache`,
`AQUARIUM_CULTCACHE_PATH`, or `MIMIR_PROGRAM_SURFACE_CONFIG` points
elsewhere. The default `mimir.program.default` document puts
`raven-display` full-frame at layer 0 and `kiyo-pro-rgb` as a top-left
picture-in-picture at layer 1. `MimirSceneEditorState` applies matching
source placements once when those feeds appear, then inspector/drag edits own
subsequent placement.
- Live camera image buffers should use Fensalir-owned texture leases when they
are rendering inputs: Mimir asks the engine broker for a keyed D3D12
Texture2D/fence lease, writes decoded frames into that texture, commits the

View file

@ -43,6 +43,7 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
private readonly MimirAlignmentActuatorBank audioActuatorBank = new();
private readonly MimirPresentationControlState presentationControls = new();
private readonly MimirSceneEditorState sceneEditor = new();
private readonly MimirProgramSurfaceConfigDocument programSurfaceConfig;
private readonly MimirObsStemPublicationState obsStemPublication = new(MimirObsPublicationConfigurations.AlignmentActuatorStemBus);
private readonly MimirObsStemSharedMemoryPublisher? obsStemPublisher;
private readonly IReadOnlyList<MimirStreamSourceFactory> sourceFactories;
@ -127,6 +128,7 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
settings.BufferDuration.TotalSeconds));
spectrumAnalyzer = new MimirAudioSpectrumAnalyzer(ParseSpectrumFftSize(), ParseSpectrumBandCount());
this.sourceFactories = sourceFactories.ToArray();
programSurfaceConfig = MimirProgramSurfaceConfigStore.LoadDefault(options.CultCachePath);
audioSyncSettings = settings.Audio;
telemetryIntervalSeconds = ParseTelemetryIntervalSeconds();
audioSyncUpdateIntervalSeconds = ParseAudioSyncIntervalSeconds();
@ -813,6 +815,7 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
lastPollCount = synchronization.PollSources();
presentationControls.SyncFromBuffers(synchronization.Buffers.Buffers);
sceneEditor.SyncSensorFeeds(synchronization.Buffers.Buffers);
sceneEditor.ApplyProgramSurfaceConfig(programSurfaceConfig);
sceneEditor.UpdateInput(deltaSeconds, input);
ApplyPresentationPostprocess();
UpdateObsStemPublication();

View file

@ -0,0 +1,100 @@
using GameCult.Caching;
using GameCult.Caching.MessagePack;
using MessagePack;
namespace Mimir.Runtime.Synchronization;
[CultDocument("mimir.program_surface_config", "mimir.program_surface_config.v1")]
[MessagePackObject]
public sealed record MimirProgramSurfaceConfigDocument(
[property: Key(0)]
[property: CultName]
string SurfaceId,
[property: Key(1)] string UpdatedAtUtc,
[property: Key(2)] string Description,
[property: Key(3)] string SelectedSourceId,
[property: Key(4)] MimirProgramSurfaceLayerConfig[] Layers);
[MessagePackObject]
public sealed record MimirProgramSurfaceLayerConfig(
[property: Key(0)] string SourceId,
[property: Key(1)] string DisplayName,
[property: Key(2)] bool Visible,
[property: Key(3)] bool Locked,
[property: Key(4)] int Layer,
[property: Key(5)] float CenterX,
[property: Key(6)] float CenterY,
[property: Key(7)] float Width,
[property: Key(8)] float Height,
[property: Key(9)] float RotationRadians);
public static class MimirProgramSurfaceConfigStore
{
public const string DefaultSurfaceId = "mimir.program.default";
public const string DefaultConfigPath = "config/mimir-program-surface.cc";
public static MimirProgramSurfaceConfigDocument LoadDefault(string? configuredPath)
{
var path = ResolvePath(configuredPath);
if (!File.Exists(path))
{
return CreateDefault();
}
try
{
using var cache = CultCacheMessagePack.OpenAsync(path, new CultCacheOpenOptions
{
PullOnOpen = true
}).GetAwaiter().GetResult();
return cache.GetByName<MimirProgramSurfaceConfigDocument>(DefaultSurfaceId) ?? CreateDefault();
}
catch (Exception ex)
{
Console.WriteLine($"Mimir program surface config ignored: {path} could not be read ({ex.Message}).");
return CreateDefault();
}
}
public static MimirProgramSurfaceConfigDocument CreateDefault() =>
new(
DefaultSurfaceId,
"2026-06-01T00:00:00Z",
"Default Mimir program surface: Raven desktop full-frame with Kiyo Pro picture-in-picture.",
"kiyo-pro-rgb",
[
new MimirProgramSurfaceLayerConfig(
"raven-display",
"Raven Desktop",
Visible: true,
Locked: false,
Layer: 0,
CenterX: 0.5f,
CenterY: 0.5f,
Width: 1.0f,
Height: 1.0f,
RotationRadians: 0.0f),
new MimirProgramSurfaceLayerConfig(
"kiyo-pro-rgb",
"Kiyo Pro",
Visible: true,
Locked: false,
Layer: 1,
CenterX: 0.165f,
CenterY: 0.165f,
Width: 0.26f,
Height: 0.26f,
RotationRadians: 0.0f),
]);
public static string ResolvePath(string? configuredPath)
{
var path = !string.IsNullOrWhiteSpace(configuredPath)
? configuredPath
: Environment.GetEnvironmentVariable("MIMIR_PROGRAM_SURFACE_CONFIG");
path = string.IsNullOrWhiteSpace(path)
? DefaultConfigPath
: path;
return Path.GetFullPath(path);
}
}

View file

@ -11,6 +11,8 @@ public sealed class MimirSceneEditorState
private const float ProgramWorldWidth = 12.8f;
private const float ProgramWorldHeight = 7.2f;
private readonly List<MimirSceneEditorNode> nodes = [];
private readonly HashSet<string> configuredProgramSources = new(StringComparer.Ordinal);
private bool selectedConfiguredSource;
private Vector2? previousMousePosition;
public MimirSceneEditorState()
@ -105,6 +107,38 @@ public sealed class MimirSceneEditorState
}
}
public void ApplyProgramSurfaceConfig(MimirProgramSurfaceConfigDocument config)
{
foreach (var layer in config.Layers.OrderBy(static layer => layer.Layer))
{
if (configuredProgramSources.Contains(layer.SourceId) ||
NodeForSource(layer.SourceId) is not { } node)
{
continue;
}
node.Visible = layer.Visible;
node.Layer = Math.Max(0, layer.Layer);
SetNodeProgramPlacement(node, new MimirCompositorPlacement(
Math.Clamp(layer.CenterX, 0.0f, 1.0f),
Math.Clamp(layer.CenterY, 0.0f, 1.0f),
Math.Clamp(layer.Width, 0.01f, 1.0f),
Math.Clamp(layer.Height, 0.01f, 1.0f),
layer.RotationRadians,
Math.Max(0, layer.Layer)));
node.Locked = layer.Locked;
configuredProgramSources.Add(layer.SourceId);
}
if (!selectedConfiguredSource &&
!string.IsNullOrWhiteSpace(config.SelectedSourceId) &&
NodeForSource(config.SelectedSourceId) is { } selected)
{
SelectedNodeId = selected.Id;
selectedConfiguredSource = true;
}
}
public void UpdateInput(float deltaSeconds, InputState input)
{
if (!Enabled)

View file

@ -291,6 +291,7 @@
{"ts": "2026-05-31T22:46:40+01:00", "type": "implementation", "status": "ok", "note": "Added the first Starfire-owned camera frustum solve. MimirCameraFrustumCalibrationSolver consumes stable LED/marker correspondences, scene-space marker points, and seed frustums, then emits position, rotation, horizontal/vertical tangent half-FOV, correspondence count, clipspace reprojection residual, and confidence. BufferSmoke --frustum-calibration-smoke solves five synthetic frustums for ps3-eye-0, ps3-eye-1, kiyo-pro-rgb, leap-stereo-ir, and eve-camera with mean clip error 0.000000; room calibration lock still passes. Eve is now modeled like Nightwing as eve-local-sensor-witness/eve-local-sensors: it owns local camera/mic flash and chirp solves and ships typed hints, not raw placement authority."}
{"ts":"2026-05-31T23:05:00+01:00","type":"implementation","status":"ok","note":"Corrected the Mimir editor layout ownership after the flat-canvas pass: the center remains a chrome-free program compositor canvas, Audio Mixer is docked underneath that center canvas, and the right rail is again a Unity-style Inspector for the selected video layer's properties. Video Sources on the left now selects and navigates sources rather than carrying the property surface.","files":["src/Mimir.Runtime/MimirRuntime.cs","notes/fresh-workspace-handoff.md"],"source":"dotnet build src/Mimir.App/Mimir.App.csproj; dotnet run --no-build --project src/Mimir.BufferSmoke/Mimir.BufferSmoke.csproj -- --scene-editor-smoke; Mimir.App --headless --headless-width 1280 --headless-height 720 --capture-frame artifacts/runtime/mimir-editor-unity-inspector-audio-bottom-headless.png"}
{"ts":"2026-05-31T23:09:31+01:00","type":"implementation","status":"ok","note":"Audio Mixer is now authored as a horizontal CultUI channel-strip bank beneath the compositor preview instead of a selected-stem inspector form. Each strip reads a live presentation audio feed slot, owns M/S/gain controls for that feed, and displays compact sync/chirp response status from MimirSynchronizationHub while the right rail remains the selected video-layer Inspector. The compositor preview is weighted ahead of the mixer dock. This is UI/control-surface wiring; DSP neutralization and sample-perfect alignment remain runtime/audio authority, not inspector-owned truth.","files":["src/Mimir.Runtime/MimirRuntime.cs"],"source":"dotnet build src/Mimir.App/Mimir.App.csproj --no-restore; dotnet run --no-build --project src/Mimir.BufferSmoke/Mimir.BufferSmoke.csproj -- --presentation-control-smoke; dotnet run --no-build --project src/Mimir.BufferSmoke/Mimir.BufferSmoke.csproj -- --scene-editor-smoke; dotnet run --no-build --project src/Mimir.App/Mimir.App.csproj -- --headless --headless-width 1280 --headless-height 720 --capture-frame artifacts/runtime/mimir-editor-horizontal-audio-dock-current-headless.png"}
{"ts":"2026-06-01T00:17:29+01:00","type":"implementation","status":"ok","note":"Mimir program surface placement now has a persistent CultCache config at config/mimir-program-surface.cc. The default mimir.program.default document seeds raven-display as the full-frame layer and kiyo-pro-rgb as a tasteful top-left picture-in-picture layer. MimirRuntime loads the configured CultCache path or the default file, and MimirSceneEditorState applies each matching source placement once when feeds appear so the config seeds the compositor without fighting later user edits.","files":["config/mimir-program-surface.cc","src/Mimir.Runtime/Synchronization/MimirProgramSurfaceConfig.cs","src/Mimir.Runtime/Synchronization/MimirSceneEditorState.cs","src/Mimir.Runtime/MimirRuntime.cs"],"source":"dotnet build src/Mimir.App/Mimir.App.csproj --no-restore; temp CultCache readback reported raven=0.5,0.5,1,1 layer=0 and kiyo=0.165,0.165,0.26,0.26 layer=1 selected=kiyo-pro-rgb"}
{"ts": "2026-05-31T22:52:47+01:00", "type": "implementation", "status": "ok", "note": "Extended MimirCameraFrustumCalibrationSolver beyond LED strips: it now also consumes MimirFeatureTrackFieldCandidate plus scene-space TrackId anchors, so PS Move sphere histories, sparse Eye tracks, and Eve-local marker tracks enter the same Starfire-owned frustum authority. BufferSmoke --frustum-calibration-smoke now proves five LED-spline frustums and five feature-track frustums for ps3-eye-0, ps3-eye-1, kiyo-pro-rgb, leap-stereo-ir, and eve-camera with mean clip error 0.000000."}
{"ts": "2026-05-31T22:55:38+01:00", "type": "implementation", "status": "ok", "note": "Added mimir.local_frustum_hint_state.v1 as the CultMesh document for local witness frustum solves. It carries producer node, calibration id, candidate key, marker set id, per-camera pose/frustum snapshots, residuals, point counts, and confidence, so Eve/Nightwing can publish compact solved hints while Starfire remains canonical global placement authority."}
{"ts": "2026-05-31T23:14:03+01:00", "type": "implementation", "status": "ok", "note": "Changed music_keyed_move_chirp_sync.py visual pulses from square on/off flashes into sampled Move visual words. The default mimir.move_visual_contour_word.v1 uses identity color bias, attack/release envelope, symbol-dependent hue glide, tremolo articulation, emphasized Move lane, and an explicit visual_gesture_hz rate knob. Synthetic dry smoke wrote contour samples; a short non-dry Nightwing HID test at 80 Hz completed without writer failure. The camera-decodable rate still needs offline recovery scoring from captured frames."}