From 54aea11b5b93cb52b77af9239d54315eff7794ac Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 22 Jun 2026 14:00:25 +0100 Subject: [PATCH] Share Eve surface contract through Verse client --- Aetheria.State.Verify/Program.cs | 37 ++++++++- GameCult.Aetheria.State.Unity.csproj | 1 + .../Runtime/AetheriaRuntimeEveSurfaceState.cs | 1 + .../Runtime/AetheriaRuntimeVerseClient.cs | 79 ++++++++++++++++++- docs/aetheria-verse-client-contract.md | 17 ++-- 5 files changed, 125 insertions(+), 10 deletions(-) rename Aetheria.State/Documents/EveSurfaceState.cs => Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs (98%) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 27c4ba930..2ffd6e293 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -803,6 +803,7 @@ static void RequirePackageSerializerBoundary(string root) "AetheriaRuntimeVerseClient.cs", "AetheriaRuntimeSnapshotDocuments.cs", "AetheriaRuntimeEveCommandDocument.cs", + "AetheriaRuntimeEveSurfaceState.cs", "AetheriaRuntimeDaemonDocuments.cs", "AetheriaRuntimeDaemonSoaDocuments.cs" }; @@ -8048,10 +8049,12 @@ static void RequireDaemonVersePublication(string root) static void RequireAetheriaRuntimeVerseClientContract(string root) { var clientPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeVerseClient.cs"); + var surfaceStatePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeEveSurfaceState.cs"); + var oldSurfaceStatePath = Path.Combine(root, "Aetheria.State", "Documents", "EveSurfaceState.cs"); var commandPortPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCommandPort.cs"); var docPath = Path.Combine(root, "docs", "aetheria-verse-client-contract.md"); - var requiredFiles = new[] { clientPath, commandPortPath, docPath }; + var requiredFiles = new[] { clientPath, surfaceStatePath, commandPortPath, docPath }; var missingFiles = requiredFiles .Where(path => !File.Exists(path)) .Select(path => Path.GetRelativePath(root, path)) @@ -8064,9 +8067,16 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) } var client = File.ReadAllText(clientPath); + var surfaceState = File.ReadAllText(surfaceStatePath); var commandPort = File.ReadAllText(commandPortPath); var doc = File.ReadAllText(docPath); + if (File.Exists(oldSurfaceStatePath)) + { + throw new InvalidOperationException( + "EveSurfaceState must live in the shared runtime package so every CultMesh client can watch daemon UI surfaces."); + } + var requiredClientSymbols = new[] { "public sealed class AetheriaRuntimeVerseClient", @@ -8079,6 +8089,12 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) "WatchRecord", "WatchRecord", "AetheriaRuntimeVerseDocument", + "CultNetDocumentBinding.ForDocument(registry)", + "GetDaemonGameTuiSurfaceAsync()", + "GetDaemonEditorTuiSurfaceAsync()", + "WatchDaemonGameTuiSurfaces()", + "WatchDaemonEditorTuiSurfaces()", + "AetheriaRuntimeVerseDocument", "SubmitDaemonCommandAsync(", "AetheriaRuntimeVerseRecordKeys.DaemonCommand(command.CommandId)", "DaemonGameTuiSurface { get; }", @@ -8094,6 +8110,25 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) string.Join(", ", missingClientSymbols)); } + var requiredSurfaceSymbols = new[] + { + "namespace Aetheria.State.Documents", + "[CultDocument(\"gamecult.eve.surface\", \"gamecult.eve.surface.v1\")]", + "public sealed class EveSurfaceState", + "public sealed class EveSurface", + "public sealed class EveSurfaceComponent", + "public sealed class EveCommandTemplate" + }; + var missingSurfaceSymbols = requiredSurfaceSymbols + .Where(symbol => !surfaceState.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + if (missingSurfaceSymbols.Length > 0) + { + throw new InvalidOperationException( + "Shared runtime Eve surface document contract is incomplete: " + + string.Join(", ", missingSurfaceSymbols)); + } + if (!commandPort.Contains("AetheriaRuntimeVerseContractRegistry.CreateCultCacheRegistry()", StringComparison.Ordinal) || !commandPort.Contains("AetheriaRuntimeVerseContractRegistry.CreateCultNetRegistry(registry)", StringComparison.Ordinal) || !commandPort.Contains("AetheriaRuntimeVerseRecordKeys.DaemonCommand(commandId)", StringComparison.Ordinal) || diff --git a/GameCult.Aetheria.State.Unity.csproj b/GameCult.Aetheria.State.Unity.csproj index 8c5cebfa0..19c1f1f17 100644 --- a/GameCult.Aetheria.State.Unity.csproj +++ b/GameCult.Aetheria.State.Unity.csproj @@ -102,6 +102,7 @@ + diff --git a/Aetheria.State/Documents/EveSurfaceState.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs similarity index 98% rename from Aetheria.State/Documents/EveSurfaceState.cs rename to Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs index f8181adc6..85e84248d 100644 --- a/Aetheria.State/Documents/EveSurfaceState.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using GameCult.Caching; using MessagePack; diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs index a541eec63..5d19e8d39 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs @@ -2,6 +2,7 @@ using System; using System.IO; using System.Linq; using System.Threading.Tasks; +using Aetheria.State.Documents; using GameCult.Caching; using GameCult.Caching.MessagePack; using GameCult.Mesh; @@ -76,7 +77,8 @@ namespace GameCult.Aetheria.State.Verse typeof(AetheriaRuntimeDaemonFrameDocument), typeof(AetheriaRuntimeDaemonSoaViewDocument), typeof(AetheriaRuntimeDaemonCommandDocument), - typeof(AetheriaRuntimeEveCommandDocument) + typeof(AetheriaRuntimeEveCommandDocument), + typeof(EveSurfaceState) }; public static CultDocumentRegistry CreateCultCacheRegistry() @@ -103,7 +105,8 @@ namespace GameCult.Aetheria.State.Verse CultNetDocumentBinding.ForDocument(registry), CultNetDocumentBinding.ForDocument(registry), CultNetDocumentBinding.ForDocument(registry), - CultNetDocumentBinding.ForDocument(registry) + CultNetDocumentBinding.ForDocument(registry), + CultNetDocumentBinding.ForDocument(registry) }); } } @@ -240,6 +243,30 @@ namespace GameCult.Aetheria.State.Verse AetheriaRuntimeVerseRecordKeys.DaemonSoaViewLatest); } + public Task GetDaemonGameSurfaceAsync() + { + ThrowIfDisposed(); + return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface); + } + + public Task GetDaemonGameTuiSurfaceAsync() + { + ThrowIfDisposed(); + return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface); + } + + public Task GetDaemonEditorSurfaceAsync() + { + ThrowIfDisposed(); + return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface); + } + + public Task GetDaemonEditorTuiSurfaceAsync() + { + ThrowIfDisposed(); + return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface); + } + public AetheriaRuntimeVerseDocument ProviderAdvertisement() { ThrowIfDisposed(); @@ -275,6 +302,30 @@ namespace GameCult.Aetheria.State.Verse AetheriaRuntimeVerseRecordKeys.DaemonSoaViewLatest); } + public AetheriaRuntimeVerseDocument DaemonGameSurface() + { + ThrowIfDisposed(); + return Document(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface); + } + + public AetheriaRuntimeVerseDocument DaemonGameTuiSurface() + { + ThrowIfDisposed(); + return Document(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface); + } + + public AetheriaRuntimeVerseDocument DaemonEditorSurface() + { + ThrowIfDisposed(); + return Document(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface); + } + + public AetheriaRuntimeVerseDocument DaemonEditorTuiSurface() + { + ThrowIfDisposed(); + return Document(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface); + } + public Observable> WatchProviderAdvertisements() { @@ -312,6 +363,30 @@ namespace GameCult.Aetheria.State.Verse AetheriaRuntimeVerseRecordKeys.DaemonSoaViewLatest); } + public Observable> WatchDaemonGameSurfaces() + { + ThrowIfDisposed(); + return Database.WatchRecord(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface); + } + + public Observable> WatchDaemonGameTuiSurfaces() + { + ThrowIfDisposed(); + return Database.WatchRecord(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface); + } + + public Observable> WatchDaemonEditorSurfaces() + { + ThrowIfDisposed(); + return Database.WatchRecord(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface); + } + + public Observable> WatchDaemonEditorTuiSurfaces() + { + ThrowIfDisposed(); + return Database.WatchRecord(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface); + } + public async Task SubmitDaemonCommandAsync( AetheriaRuntimeDaemonCommandDocument command, bool flush = true) diff --git a/docs/aetheria-verse-client-contract.md b/docs/aetheria-verse-client-contract.md index eda19e8eb..a485cf9a0 100644 --- a/docs/aetheria-verse-client-contract.md +++ b/docs/aetheria-verse-client-contract.md @@ -11,9 +11,9 @@ package. It opens a local `CultMeshNode` with the runtime-only Aetheria contract registry and exposes: - current typed reads for provider advertisement, health, command boundary, - latest daemon frame, and latest SoA view; + latest daemon frame, latest SoA view, and daemon game/editor Eve surfaces; - reactive watches via `WatchRecord()`, including `WatchLatestFrames()` and - `WatchLatestSoaViews()`; + `WatchLatestSoaViews()`, plus daemon GUI/TUI surface watches; - `AetheriaRuntimeVerseDocument` handles for transparent reactive POCO presentation; - typed daemon and Eve command submission through the same command record keys @@ -68,8 +68,11 @@ The daemon already publishes game and editor Eve surface records at these keys: - `eve:surface:aetheria.daemon.editor` - `eve:surface:aetheria.daemon.editor.tui` -`AetheriaRuntimeVerseRecordKeys` exposes those keys now. The remaining cleanup is -to move the `EveSurfaceState` document contract into the shared runtime package -so `AetheriaRuntimeVerseClient` can expose typed surface watches too. Until then, -surface resolution stays in the existing Eve Unity runtime host, which already -resolves Aetheria state refs automatically. +`AetheriaRuntimeVerseRecordKeys` exposes those keys and +`AetheriaRuntimeVerseClient` exposes typed reads, document handles, and +`WatchRecord()` subscriptions for all four. The +`EveSurfaceState` document contract lives in the shared runtime package so a +Unity client, terminal client, daemon inspector, or later non-C# runtime binding +can lower the same published UI surface. The existing Eve Unity runtime host can +keep resolving Aetheria state refs automatically; it should consume those refs as +part of lowering the shared surface, not as a separate authority path.