From 3156512736076e40b1f067ed65af8ce7fb3249d0 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 17 Jun 2026 09:51:49 +0100 Subject: [PATCH] Project daemon verse identity into the main menu --- Aetheria.State.Verify/Program.cs | 100 +++++++++++++++++- Assets/Scripts/UI/MainMenu.cs | 40 ++++++- .../Runtime/AetheriaRuntimeCatalogSnapshot.cs | 35 ++++++ .../Runtime/AetheriaRuntimeCatalogStore.cs | 49 +++++++++ .../Runtime/AetheriaRuntimeStateReader.cs | 5 + 5 files changed, 224 insertions(+), 5 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 63447bf65..8efa98364 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -50,6 +50,7 @@ RequireInventoryDropdownUseEveSurface(root); RequireNoDeadPopupShells(root); RequirePlayerSettingsEveSurface(root); RequireVerseHostSettingsAuthority(root); +RequireMainMenuVerseHostProjection(root); RequireMainMenuContinueRunState(root); RequireDeadPropertiesPanelShellDeleted(root); RequireTypedBehaviorMetadataCoverage(root); @@ -535,6 +536,7 @@ Console.WriteLine("Typed behavior metadata authority: live heat/mining/thermotog Console.WriteLine("NameTools editor shell: the remaining name helper window lowers through UI Toolkit instead of IMGUI"); Console.WriteLine("Runtime state reader authority: Unity gameplay/UI read typed state through a shared runtime reader instead of direct store spelunking"); Console.WriteLine("Verse host authority: daemon-owned typed verse host settings now drive provider advertisement and operations telemetry"); +Console.WriteLine("Main-menu Verse projection: the Unity Eve shell lowers daemon-owned verse identity instead of ad-libbing local menu copy"); Console.WriteLine("Runtime simulation tuning authority: UI writes flow through gameplay checkpoint commits"); Console.WriteLine("Hull conductivity authority: inventory UI toggles flow through gameplay checkpoint commits"); Console.WriteLine("Inventory entity rename authority: UI rename flows through gameplay checkpoint commits"); @@ -2523,7 +2525,7 @@ static void RequireMainMenuRootUsesEveSurface(string root) "QuitCommand", "BuildMainSurfaceDefinition(", "HandleMainSurfaceCommand(", - "RenderMenuSurface(BuildMainSurfaceDefinition(LatestContinueRun(), InGame), HandleMainSurfaceCommand);", + "RenderMenuSurface(BuildMainSurfaceDefinition(LatestContinueRun(), LatestVerseHostSettings(), InGame), HandleMainSurfaceCommand);", "HideMenuSurface();" }; @@ -3811,6 +3813,98 @@ static void RequireVerseHostSettingsAuthority(string root) } } +static void RequireMainMenuVerseHostProjection(string root) +{ + var packageSnapshotPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogSnapshot.cs"); + var packageStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogStore.cs"); + var runtimeStateReaderPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateReader.cs"); + var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs"); + + var requiredFiles = new[] + { + packageSnapshotPath, + packageStorePath, + runtimeStateReaderPath, + mainMenuPath + }; + + var missingFiles = requiredFiles + .Where(path => !File.Exists(path)) + .Select(path => Path.GetRelativePath(root, path)) + .ToArray(); + if (missingFiles.Length > 0) + { + throw new InvalidOperationException( + "Main-menu Verse projection cannot be verified because required files are missing: " + + string.Join(", ", missingFiles)); + } + + var packageSnapshot = File.ReadAllText(packageSnapshotPath); + var packageStore = File.ReadAllText(packageStorePath); + var runtimeStateReader = File.ReadAllText(runtimeStateReaderPath); + var mainMenu = File.ReadAllText(mainMenuPath); + + var requiredSnapshotSymbols = new[] + { + "public sealed class AetheriaRuntimeVerseHostSettingsSnapshot", + "public string VerseId", + "public string CultMeshAddress", + "public string Visibility" + }; + var missingSnapshotSymbols = requiredSnapshotSymbols + .Where(symbol => !packageSnapshot.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + if (missingSnapshotSymbols.Length > 0) + { + throw new InvalidOperationException( + "Unity runtime snapshot does not expose typed verse-host settings: " + + string.Join(", ", missingSnapshotSymbols)); + } + + var requiredStoreSymbols = new[] + { + "VerseHostSettingsSchema = \"aetheria.verse_host_settings\"", + "VerseHostSettingsKey = \"global:aetheria.verse_host_settings.v1\"", + "ReadVerseHostSettings(string stateFilePath)", + "ReadVerseHostSettingsPayload", + "AetheriaRuntimeVerseHostSettingsSnapshot" + }; + var missingStoreSymbols = requiredStoreSymbols + .Where(symbol => !packageStore.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + if (missingStoreSymbols.Length > 0) + { + throw new InvalidOperationException( + "Unity runtime store does not preserve typed verse-host read authority: " + + string.Join(", ", missingStoreSymbols)); + } + + if (!runtimeStateReader.Contains("ReadVerseHostSettings", StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "Shared runtime state reader no longer exposes typed verse-host settings."); + } + + var requiredMainMenuSymbols = new[] + { + "LatestVerseHostSettings()", + "AetheriaRuntimeStateReader.ReadVerseHostSettings(ActionGameManager.RuntimeStateFilePath)", + "\"Verse\"", + "\"Visibility\"", + "\"CultMesh\"", + "Verse state and game truth belong to the daemon serving" + }; + var missingMainMenuSymbols = requiredMainMenuSymbols + .Where(symbol => !mainMenu.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + if (missingMainMenuSymbols.Length > 0) + { + throw new InvalidOperationException( + "MainMenu no longer lowers daemon-owned Verse identity through its Eve shell: " + + string.Join(", ", missingMainMenuSymbols)); + } +} + static void RequireMainMenuContinueRunState(string root) { var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs"); @@ -4239,6 +4333,7 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) "public static class AetheriaRuntimeStateReader", "OpenRuntimeCatalog", "ReadPlayerSettings", + "ReadVerseHostSettings", "ReadLoadoutTemplates", "ReadRunStates", "ReadZoneStates", @@ -4308,7 +4403,8 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) }, [mainMenuPath] = new[] { - "AetheriaRuntimeCatalogStore.ReadRunStates" + "AetheriaRuntimeCatalogStore.ReadRunStates", + "AetheriaRuntimeCatalogStore.ReadVerseHostSettings" }, [eveSurfacePresenterPath] = new[] { diff --git a/Assets/Scripts/UI/MainMenu.cs b/Assets/Scripts/UI/MainMenu.cs index fdf4b6156..ceda248f8 100644 --- a/Assets/Scripts/UI/MainMenu.cs +++ b/Assets/Scripts/UI/MainMenu.cs @@ -52,7 +52,7 @@ public class MainMenu : MonoBehaviour private void ShowMain() { - RenderMenuSurface(BuildMainSurfaceDefinition(LatestContinueRun(), InGame), HandleMainSurfaceCommand); + RenderMenuSurface(BuildMainSurfaceDefinition(LatestContinueRun(), LatestVerseHostSettings(), InGame), HandleMainSurfaceCommand); } private void HandleMainSurfaceCommand(EveSurfaceCommandRequest request) @@ -174,6 +174,19 @@ public class MainMenu : MonoBehaviour } } + private static AetheriaRuntimeVerseHostSettingsSnapshot LatestVerseHostSettings() + { + try + { + return AetheriaRuntimeStateReader.ReadVerseHostSettings(ActionGameManager.RuntimeStateFilePath); + } + catch (Exception ex) + { + Debug.LogError($"Failed to read typed Aetheria Verse host settings for the main menu: {ex}"); + return null; + } + } + private void ContinueGame(AetheriaRuntimeRunStateSnapshot run) { if (run == null) @@ -374,11 +387,19 @@ public class MainMenu : MonoBehaviour private static EveSurfaceDocument BuildMainSurfaceDefinition( AetheriaRuntimeRunStateSnapshot continueRun, + AetheriaRuntimeVerseHostSettingsSnapshot verseHost, bool inGame) { var commands = new List(); var actionButtons = new List(); var cardChildren = new List(); + var verseTitle = string.IsNullOrWhiteSpace(verseHost?.Title) ? "Unknown Verse" : verseHost.Title; + var verseId = string.IsNullOrWhiteSpace(verseHost?.VerseId) ? "unknown" : verseHost.VerseId; + var verseVisibility = string.IsNullOrWhiteSpace(verseHost?.Visibility) ? "unknown" : verseHost.Visibility; + var verseMeshAddress = string.IsNullOrWhiteSpace(verseHost?.CultMeshAddress) ? "unpublished" : verseHost.CultMeshAddress; + var verseLabel = string.Equals(verseTitle, verseId, StringComparison.Ordinal) + ? verseTitle + : $"{verseTitle} ({verseId})"; if (!inGame) { @@ -386,7 +407,7 @@ public class MainMenu : MonoBehaviour { cardChildren.Add(Text( $"{MainSurfaceId}.continue.note", - "No typed run state is available yet. Start a new galaxy or connect to a Verse that already has one.")); + $"No typed run state is available in {verseLabel} yet. Start a new galaxy or connect to a Verse that already has one.")); } else { @@ -399,6 +420,19 @@ public class MainMenu : MonoBehaviour } } + cardChildren.Add(Metric( + $"{MainSurfaceId}.verse.title", + "Verse", + verseLabel)); + cardChildren.Add(Metric( + $"{MainSurfaceId}.verse.visibility", + "Visibility", + verseVisibility)); + cardChildren.Add(Metric( + $"{MainSurfaceId}.verse.mesh", + "CultMesh", + verseMeshAddress)); + commands.Add(new EveCommandTemplate(NewGameCommand, "New Game", "unity-uitoolkit")); commands.Add(new EveCommandTemplate(ShowSettingsCommand, "Settings", "unity-uitoolkit")); commands.Add(new EveCommandTemplate(QuitCommand, "Quit", "unity-uitoolkit")); @@ -409,7 +443,7 @@ public class MainMenu : MonoBehaviour cardChildren.Add(Text( $"{MainSurfaceId}.note", - "The client lowers this shell through Eve. Verse state and game truth belong to the daemon.")); + $"The client lowers this shell through Eve. Verse state and game truth belong to the daemon serving {verseLabel}.")); cardChildren.Add(ButtonColumn($"{MainSurfaceId}.actions", actionButtons.ToArray())); return BuildMenuSurfaceDocument( diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs index d9f24c5ee..d411ca25f 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs @@ -545,6 +545,41 @@ namespace GameCult.Aetheria.State.Unity public IReadOnlyList ActionBarInputs { get; } } + public sealed class AetheriaRuntimeVerseHostSettingsSnapshot + { + public AetheriaRuntimeVerseHostSettingsSnapshot( + string serviceId, + string verseId, + string rootVerse, + string canonicalService, + string locatedService, + string cultMeshAddress, + string title, + string visibility, + string lastUpdatedAtUtc) + { + ServiceId = serviceId; + VerseId = verseId; + RootVerse = rootVerse; + CanonicalService = canonicalService; + LocatedService = locatedService; + CultMeshAddress = cultMeshAddress; + Title = title; + Visibility = visibility; + LastUpdatedAtUtc = lastUpdatedAtUtc; + } + + public string ServiceId { get; } + public string VerseId { get; } + public string RootVerse { get; } + public string CanonicalService { get; } + public string LocatedService { get; } + public string CultMeshAddress { get; } + public string Title { get; } + public string Visibility { get; } + public string LastUpdatedAtUtc { get; } + } + public sealed class AetheriaRuntimeStoryFileHash { public AetheriaRuntimeStoryFileHash(string storyPath, string hash) diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs index 9ec079692..8525da039 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs @@ -17,11 +17,13 @@ namespace GameCult.Aetheria.State.Unity private const string NameFileSchema = "aetheria.name_file"; private const string EveSurfaceSchema = "gamecult.eve.surface"; private const string PlayerSettingsSchema = "aetheria.player_settings"; + private const string VerseHostSettingsSchema = "aetheria.verse_host_settings"; private const string LoadoutTemplateSchema = "aetheria.loadout_template"; private const string RunStateSchema = "aetheria.run_state"; private const string ZoneStateSchema = "aetheria.zone_state"; private const string EntitySnapshotSchema = "aetheria.entity_snapshot"; private const string PlayerSettingsKey = "global:aetheria.player_settings.v1"; + private const string VerseHostSettingsKey = "global:aetheria.verse_host_settings.v1"; public static AetheriaRuntimeCatalogSnapshot OpenReadOnly(string stateFilePath) { @@ -90,6 +92,26 @@ namespace GameCult.Aetheria.State.Unity return settings; } + public static AetheriaRuntimeVerseHostSettingsSnapshot? ReadVerseHostSettings(string stateFilePath) + { + if (string.IsNullOrWhiteSpace(stateFilePath)) + throw new ArgumentException("State file path must be non-empty.", nameof(stateFilePath)); + + var catalog = ReadSchemaCatalog(stateFilePath); + AetheriaRuntimeVerseHostSettingsSnapshot? settings = null; + foreach (var record in ReadRecords(stateFilePath)) + { + if (record.Key != VerseHostSettingsKey || + !catalog.TryGetValue(record.SchemaId, out var schemaName) || + schemaName != VerseHostSettingsSchema) + continue; + + settings = ReadVerseHostSettingsPayload(record.Payload); + } + + return settings; + } + public static IReadOnlyList ReadLoadoutTemplates(string stateFilePath) { if (string.IsNullOrWhiteSpace(stateFilePath)) @@ -429,6 +451,33 @@ namespace GameCult.Aetheria.State.Unity input.ActionBarInputs); } + private static AetheriaRuntimeVerseHostSettingsSnapshot ReadVerseHostSettingsPayload(byte[] payload) + { + var reader = new MessagePackReader(payload); + var fields = reader.ReadArrayHeader(); + SkipFields(ref reader, fields, 0, 1); + var serviceId = ReadFieldString(ref reader, fields, 1); + var verseId = ReadFieldString(ref reader, fields, 2); + var rootVerse = ReadFieldString(ref reader, fields, 3); + var canonicalService = ReadFieldString(ref reader, fields, 4); + var locatedService = ReadFieldString(ref reader, fields, 5); + var cultMeshAddress = ReadFieldString(ref reader, fields, 6); + var title = ReadFieldString(ref reader, fields, 7); + var visibility = ReadFieldString(ref reader, fields, 8); + var lastUpdatedAtUtc = ReadFieldString(ref reader, fields, 9); + SkipRemaining(ref reader, fields, 10); + return new AetheriaRuntimeVerseHostSettingsSnapshot( + serviceId, + verseId, + rootVerse, + canonicalService, + locatedService, + cultMeshAddress, + title, + visibility, + lastUpdatedAtUtc); + } + private static AetheriaRuntimeLoadoutTemplateSnapshot ReadLoadoutTemplatePayload(byte[] payload) { var reader = new MessagePackReader(payload); diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateReader.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateReader.cs index 8dd693027..1ca7672df 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateReader.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateReader.cs @@ -20,6 +20,11 @@ namespace GameCult.Aetheria.State.Unity return AetheriaRuntimeCatalogStore.ReadPlayerSettings(stateFilePath); } + public static AetheriaRuntimeVerseHostSettingsSnapshot? ReadVerseHostSettings(string stateFilePath) + { + return AetheriaRuntimeCatalogStore.ReadVerseHostSettings(stateFilePath); + } + public static IReadOnlyList ReadLoadoutTemplates(string stateFilePath) { return AetheriaRuntimeCatalogStore.ReadLoadoutTemplates(stateFilePath);