diff --git a/Aetheria.State.Daemon/Program.cs b/Aetheria.State.Daemon/Program.cs index 57603eeab..a72f10ca2 100644 --- a/Aetheria.State.Daemon/Program.cs +++ b/Aetheria.State.Daemon/Program.cs @@ -611,7 +611,7 @@ static async Task InjectEveSurfaceSnapshotAsync( var surfacePut = node.Database.Documents.CreateRawDocumentPutMessage( response.MessageId, - new CultRecordHandle(new CultRecordKey(recordKey)), + new CultRecordHandle(new CultRecordKey(recordKey)), surfaceState, new CultNetDocumentMessageOptions { @@ -625,14 +625,14 @@ static async Task InjectEveSurfaceSnapshotAsync( .ToArray(); } -static Task ReadEveSurfacePublicationAsync(AetheriaStateNode node, string surfaceKind) +static Task ReadEveSurfacePublicationAsync(AetheriaStateNode node, string surfaceKind) { return surfaceKind switch { - "game" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface).ReadAsync(), - "game-tui" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface).ReadAsync(), - "editor" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface).ReadAsync(), - "editor-tui" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface).ReadAsync(), + "game" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface).ReadAsync(), + "game-tui" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface).ReadAsync(), + "editor" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface).ReadAsync(), + "editor-tui" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface).ReadAsync(), _ => throw new ArgumentOutOfRangeException(nameof(surfaceKind), surfaceKind, "Unknown Eve surface publication.") }; } @@ -779,20 +779,20 @@ static async Task PublishDaemonApiDocumentsAsync( .ReplaceAsync(result.StarbridgeSessionSummary) .ConfigureAwait(false); if (result.GameSurface != null) - await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface) - .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToEveSurfaceState(result.GameSurface)) + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface) + .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToPortableSurface(result.GameSurface)) .ConfigureAwait(false); if (result.GameTuiSurface != null) - await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface) - .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToEveSurfaceState(result.GameTuiSurface)) + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface) + .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToPortableSurface(result.GameTuiSurface)) .ConfigureAwait(false); if (result.EditorSurface != null) - await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface) - .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToEveSurfaceState(result.EditorSurface)) + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface) + .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToPortableSurface(result.EditorSurface)) .ConfigureAwait(false); if (result.EditorTuiSurface != null) - await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface) - .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToEveSurfaceState(result.EditorTuiSurface)) + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface) + .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToPortableSurface(result.EditorTuiSurface)) .ConfigureAwait(false); } @@ -865,10 +865,10 @@ static async Task PublishStateSurfacesAsync( ? updatedAtUtc : playerSettings.LastUpdatedAtUtc; - await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey) + await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildOperationsSurface(eveStatus, verseHost, runtimeSession)) .ConfigureAwait(false); - await node.MutableDocument(AetheriaStateNode.PlayerSettingsSurfaceKey) + await node.MutableDocument(AetheriaStateNode.PlayerSettingsSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildPlayerSettingsSurface(playerSettings, playerSettingsUpdatedAt)) .ConfigureAwait(false); await node.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey) diff --git a/Aetheria.State.Smoke/Program.cs b/Aetheria.State.Smoke/Program.cs index 6e8326b4b..8eb34eed1 100644 --- a/Aetheria.State.Smoke/Program.cs +++ b/Aetheria.State.Smoke/Program.cs @@ -3,6 +3,7 @@ using Aetheria.State.Documents; using Aetheria.State.Migration; using GameCult.Caching; using GameCult.Aetheria.State.Verse; +using GameCult.Mesh; var root = args.Length > 0 ? args[0] : Directory.GetCurrentDirectory(); var stateDirectory = Path.Combine(Path.GetTempPath(), "aetheria-state-smoke", Guid.NewGuid().ToString("N")); @@ -94,7 +95,7 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s await node.FlushAsync(); var runtimeCatalog = await node.RuntimeCatalog().LatestAsync().ConfigureAwait(false); - await node.MutableDocument(AetheriaStateNode.CatalogSurfaceKey) + await node.MutableDocument(AetheriaStateNode.CatalogSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildCatalogSurface(runtimeCatalog, now)); var verseHostSettings = AetheriaVerseHostSettingsNormalizer.Normalize(new AetheriaVerseHostSettings @@ -102,7 +103,7 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s LastUpdatedAtUtc = now }); await node.MutableDocument(AetheriaStateNode.VerseHostSettingsKey).ReplaceAsync(verseHostSettings); - await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey) + await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildOperationsSurface(verseHostSettings: verseHostSettings)); await node.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildProviderAdvertisement(verseHostSettings, statePath, now)); @@ -172,8 +173,8 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s throw new InvalidOperationException("AetheriaClient control submission did not appear as a typed daemon state record."); } } - await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface) - .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToEveSurfaceState(daemonGameSurface)); + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface) + .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToPortableSurface(daemonGameSurface)); await node.MutableDocument(AetheriaStateNode.RuntimeSessionKey("smoke-runtime")).ReplaceAsync(new AetheriaRuntimeSession { RuntimeId = "smoke-runtime", @@ -182,7 +183,7 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s LastSeenAtUtc = now, Status = "running" }); - await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey).ReplaceAsync(AetheriaEveSurfaceDocuments.BuildOperationsSurface( + await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey).ReplaceAsync(AetheriaEveSurfaceDocuments.BuildOperationsSurface( verseHostSettings: verseHostSettings, runtimeSession: await node.MutableDocument(AetheriaStateNode.RuntimeSessionKey("smoke-runtime")).ReadAsync())); @@ -534,7 +535,7 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s ActionBarInputs = ["/1", "/leftButton"] } }); - await node.MutableDocument(AetheriaStateNode.PlayerSettingsSurfaceKey) + await node.MutableDocument(AetheriaStateNode.PlayerSettingsSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildPlayerSettingsSurface( await node.MutableDocument(AetheriaStateNode.PlayerSettingsKey).ReadAsync(), now)); @@ -616,7 +617,7 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s Status = eveCommandReport.RejectedCommands > 0 ? "rejected" : "ok" }; await node.MutableDocument(AetheriaStateNode.EveCommandAcceptanceStatusKey).ReplaceAsync(eveCommandStatus); - await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey).ReplaceAsync(AetheriaEveSurfaceDocuments.BuildOperationsSurface( + await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey).ReplaceAsync(AetheriaEveSurfaceDocuments.BuildOperationsSurface( eveCommandStatus, verseHostSettings: await node.MutableDocument(AetheriaStateNode.VerseHostSettingsKey).ReadAsync(), runtimeSession: await node.MutableDocument(AetheriaStateNode.RuntimeSessionKey("smoke-runtime")).ReadAsync())); @@ -630,10 +631,10 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether var faction = await reopened.MutableDocument(AetheriaCatalogKeys.CorporationFromLegacyId(factionLegacyId)).ReadAsync(); var nameFile = await reopened.MutableDocument(AetheriaCatalogKeys.NameFileFromLegacyId(nameFileLegacyId)).ReadAsync(); var quarantine = await reopened.MutableDocument(AetheriaStateNode.LegacyCatalogQuarantineKey).ReadAsync(); - var catalogSurface = await reopened.MutableDocument(AetheriaStateNode.CatalogSurfaceKey).ReadAsync(); + var catalogSurface = await reopened.MutableDocument(AetheriaStateNode.CatalogSurfaceKey).ReadAsync(); var eveCommandStatus = await reopened.MutableDocument(AetheriaStateNode.EveCommandAcceptanceStatusKey).ReadAsync(); - var operationsSurface = await reopened.MutableDocument(AetheriaStateNode.OperationsSurfaceKey).ReadAsync(); - var playerSettingsSurface = await reopened.MutableDocument(AetheriaStateNode.PlayerSettingsSurfaceKey).ReadAsync(); + var operationsSurface = await reopened.MutableDocument(AetheriaStateNode.OperationsSurfaceKey).ReadAsync(); + var playerSettingsSurface = await reopened.MutableDocument(AetheriaStateNode.PlayerSettingsSurfaceKey).ReadAsync(); var advertisement = await reopened.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey).ReadAsync(); var daemonProvider = await reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement) .ReadAsync(); @@ -643,7 +644,7 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether .ReadAsync(); var daemonFrame = await reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest) .ReadAsync(); - var daemonGameSurface = await reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface) + var daemonGameSurface = await reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface) .ReadAsync(); var runtimeSession = await reopened.MutableDocument(AetheriaStateNode.RuntimeSessionKey("smoke-runtime")).ReadAsync(); var playerSettings = await reopened.MutableDocument(AetheriaStateNode.PlayerSettingsKey).ReadAsync(); @@ -677,7 +678,7 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether throw new InvalidOperationException("Legacy catalog quarantine did not survive flush/reopen."); } - if (catalogSurface?.Schema != "gamecult.eve.surface.v1" || + if (catalogSurface == null || catalogSurface.Surface.Id != AetheriaEveSurfaceDocuments.CatalogSurfaceId) { throw new InvalidOperationException("Eve catalog surface did not survive flush/reopen."); diff --git a/Aetheria.State.Unity/AetheriaRuntimeCatalogClient.cs b/Aetheria.State.Unity/AetheriaRuntimeCatalogClient.cs index 899dd3d08..a214fc89b 100644 --- a/Aetheria.State.Unity/AetheriaRuntimeCatalogClient.cs +++ b/Aetheria.State.Unity/AetheriaRuntimeCatalogClient.cs @@ -1,4 +1,3 @@ -using Aetheria.State.Documents; using GameCult.Aetheria.State.Verse; using GameCult.Mesh; @@ -26,7 +25,7 @@ public sealed class AetheriaRuntimeCatalogClient : IAsyncDisposable, IDisposable return _node.RuntimeCatalog().Latest(); } - public EveSurfaceState? ReadCatalogSurface() + public EveSurfaceDocument? ReadCatalogSurface() { return _node.CatalogSurface().Latest(); } diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index ee54545b3..3f348e154 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -516,15 +516,13 @@ if (string.IsNullOrWhiteSpace(corporationWithNames.GeonameFileKey) || $"Typed catalog name-file-key lookup failed for corporation {corporationWithNames.Name}."); } -if (surface.Schema != "gamecult.eve.surface.v1" || - surface.Surface.Root.Kind != "surface" || - surface.Surface.Root.Children.Length == 0) +if (surface.Surface.Root.Kind != "surface" || + surface.Surface.Root.Children.Count == 0) { throw new InvalidOperationException("Aetheria catalog Eve surface projection is not renderable."); } -if (publishedSurface.Schema != surface.Schema || - publishedSurface.Surface.Id != AetheriaEveSurfaceDocuments.CatalogSurfaceId || +if (publishedSurface.Surface.Id != AetheriaEveSurfaceDocuments.CatalogSurfaceId || publishedSurface.Surface.Root.Kind != "surface") { throw new InvalidOperationException("Published Aetheria catalog Eve surface is not the expected typed surface."); @@ -567,7 +565,7 @@ Console.WriteLine($"Thermal range/curve items: {importedThermalRangeItems}/{impo Console.WriteLine($"Action-bar icon items: {actionBarIconItems}"); Console.WriteLine($"Docking bay max-size items: {dockingBayMaxSizeItems}/{dockingBayItems}"); Console.WriteLine($"Typed catalog trade items: {tradeItems.Length}"); -Console.WriteLine($"Eve catalog surface: {surface.Surface.Id} ({surface.Surface.Root.Children.Length} root children)"); +Console.WriteLine($"Eve catalog surface: {surface.Surface.Id} ({surface.Surface.Root.Children.Count} root children)"); Console.WriteLine($"Corporations: {corporations.Length}"); Console.WriteLine($"Described/geoname-linked corporations: {describedCorporations}/{corporationNameLinks}"); Console.WriteLine($"Corporation allegiance edges: {corporationAllegianceEdges}"); @@ -929,14 +927,14 @@ static void RequireSharedEvePackagesImportedFromEveRepo(string root) !runtimeCultCacheDocumentStore.Contains("routeDescription).ToBinding()", StringComparison.Ordinal) || !runtimeSurfaceDocuments.Contains("CultMesh.OperationBindingRecord(", StringComparison.Ordinal) || !runtimeSurfaceDocuments.Contains("command.SchemaId", StringComparison.Ordinal) || - !runtimeSurfaceDocuments.Contains("public static EveSurfaceState ToEveSurfaceState(AetheriaRuntimeSurfaceDocument document)", StringComparison.Ordinal) || - !runtimeSurfaceDocuments.Contains("global::Aetheria.State.Documents.EveSurfaceComponent ToEveSurfaceState(", StringComparison.Ordinal) || + !runtimeSurfaceDocuments.Contains("public static GameCult.Mesh.EveSurfaceDocument ToPortableSurface(AetheriaRuntimeSurfaceDocument document)", StringComparison.Ordinal) || + !runtimeSurfaceDocuments.Contains("new GameCult.Mesh.EveSurfaceCommandTemplate(command.Operation)", StringComparison.Ordinal) || !surfaceCommandDocuments.Contains("CultMesh.OperationBindingRecord(", StringComparison.Ordinal) || runtimeCultCacheDocumentStore.Contains("new CultMeshOperationBindingDescriptor(", StringComparison.Ordinal) || runtimeSurfaceDocuments.Contains("new CultMeshOperationBindingDescriptor(", StringComparison.Ordinal)) { throw new InvalidOperationException( - "Aetheria runtime surfaces reintroduced local operation binding flattening; surface command persistence belongs to CultMesh.OperationBindingRecord."); + "Aetheria runtime surfaces reintroduced local operation binding flattening; portable surface command persistence belongs to CultMesh Eve documents."); } } @@ -3372,7 +3370,7 @@ static void RequireEveRuntimeBootstrap(string root) ".RuntimeState(stateBoot, \"unity-eve-surface-presenter\")", ".EveSurfaceDocument(surfaceId)", "?.Reactive()", - "AetheriaUnityRuntimeClientProvider.EveSurfaceStateRefResolver(", + "AetheriaUnityRuntimeClientProvider.EveSurfaceCultMeshStateRefResolver(", "CultMeshReactiveDocument", "ResolveReactiveDaemonSurfaceState(", "DisposeReactiveSurfaceState()", @@ -5516,7 +5514,7 @@ static void RequireInventoryCargoItemDetailsUseEveSurface(string root) !eveUnitySurfaceHost.Contains("prop.Key.EndsWith(\"Ref\", StringComparison.Ordinal)", StringComparison.Ordinal) || !eveUnitySurfaceHost.Contains("CreateDefaultStateRefResolver()", StringComparison.Ordinal) || !eveUnitySurfaceHost.Contains("AetheriaUnityRuntimeClientProvider", StringComparison.Ordinal) || - !eveUnitySurfaceHost.Contains("AetheriaUnityRuntimeClientProvider.EveSurfaceStateRefResolver(", StringComparison.Ordinal) || + !eveUnitySurfaceHost.Contains("AetheriaUnityRuntimeClientProvider.EveSurfaceCultMeshStateRefResolver(", StringComparison.Ordinal) || !runtimeSurfaceDocuments.Contains("public static EveSurfaceDocument ResolveStateRefs(", StringComparison.Ordinal) || !runtimeSurfaceDocuments.Contains("ResolvePropRefs(props, resolveStateRef)", StringComparison.Ordinal) || !runtimeSurfaceDocuments.Contains("ResolvePropRef(props, AetheriaRuntimeSurfaceStateRefs.Source, \"value\", resolveStateRef)", StringComparison.Ordinal) || @@ -11526,10 +11524,10 @@ static void RequireDaemonVersePublication(string root) "public CultMeshMutableStatePointer StarbridgeScenario()", "public CultMeshMutableStatePointer StarbridgeSession()", "public CultMeshMutableStatePointer StarbridgeSessionSummary()", - "public CultMeshMutableStatePointer DaemonGameSurface()", - "public CultMeshMutableStatePointer DaemonGameTuiSurface()", - "public CultMeshMutableStatePointer DaemonEditorSurface()", - "public CultMeshMutableStatePointer DaemonEditorTuiSurface()" + "public CultMeshMutableStatePointer DaemonGameSurface()", + "public CultMeshMutableStatePointer DaemonGameTuiSurface()", + "public CultMeshMutableStatePointer DaemonEditorSurface()", + "public CultMeshMutableStatePointer DaemonEditorTuiSurface()" }; var survivingDaemonNodeSymbols = forbiddenDaemonNodeSymbols .Where(symbol => stateNode.Contains(symbol, StringComparison.Ordinal)) @@ -11548,11 +11546,11 @@ static void RequireDaemonVersePublication(string root) "Daemon Eve surface state lowering still lives in Aetheria.State projector chaff instead of the runtime surface documents."); } - if (!runtimeSurfaceDocuments.Contains("public static EveSurfaceState ToEveSurfaceState(AetheriaRuntimeSurfaceDocument document)", StringComparison.Ordinal) || - !runtimeSurfaceDocuments.Contains("EveCommandTemplate", StringComparison.Ordinal) || - !runtimeSurfaceDocuments.Contains("global::Aetheria.State.Documents.EveSurfaceComponent", StringComparison.Ordinal)) + if (!runtimeSurfaceDocuments.Contains("public static GameCult.Mesh.EveSurfaceDocument ToPortableSurface(AetheriaRuntimeSurfaceDocument document)", StringComparison.Ordinal) || + !runtimeSurfaceDocuments.Contains("GameCult.Mesh.EveSurfaceCommandTemplate", StringComparison.Ordinal) || + !runtimeSurfaceDocuments.Contains("GameCult.Mesh.EveSurfaceComponent", StringComparison.Ordinal)) { - throw new InvalidOperationException("Runtime surface documents no longer lowers daemon surfaces into registered Eve surface state."); + throw new InvalidOperationException("Runtime surface documents no longer lower daemon surfaces into portable CultMesh Eve surface documents."); } if (!daemonDocuments.Contains("AetheriaRuntimeDaemonCommandKinds", StringComparison.Ordinal)) @@ -12501,7 +12499,7 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) var stateRefResolverPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateRefResolver.cs"); var docPath = Path.Combine(root, "docs", "aetheria-verse-client-contract.md"); - var requiredFiles = new[] { clientPath, clientStatePath, surfaceStatePath, stateRefResolverPath, docPath }; + var requiredFiles = new[] { clientPath, clientStatePath, stateRefResolverPath, docPath }; var missingFiles = requiredFiles .Where(path => !File.Exists(path)) .Select(path => Path.GetRelativePath(root, path)) @@ -12515,14 +12513,19 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) var client = File.ReadAllText(clientPath); var clientState = File.ReadAllText(clientStatePath); - var surfaceState = File.ReadAllText(surfaceStatePath); var stateRefResolver = File.ReadAllText(stateRefResolverPath); 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."); + "Aetheria-local EveSurfaceState must not own UI surface state; clients watch the shared CultMesh EveSurfaceDocument."); + } + + if (File.Exists(surfaceStatePath)) + { + throw new InvalidOperationException( + "AetheriaRuntimeEveSurfaceState.cs is legacy surface-state cruft; daemon UI surfaces must publish GameCult.Mesh.EveSurfaceDocument."); } var requiredClientSymbols = new[] @@ -12545,7 +12548,7 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) "public static CultRecordKey StarbridgeSessionSummary", "new CultRecordKey(\"daemon:aetheria.starbridge.session.latest.v1\")", "Document(", - "typeof(EveSurfaceState)", + "typeof(MeshEveSurfaceDocument)", "private AetheriaClientState? _aetheriaState", "private CultMeshReactiveDocument? _managedDaemonFrame", "private CultMeshReactiveDocument? _managedCatalog", @@ -12918,10 +12921,10 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) "public async Task PutStarbridgeScenarioAsync(", "public async Task PutStarbridgeSessionAsync(", "public async Task PutStarbridgePlayerSeatAsync(", - "public async Task GetDaemonGameSurfaceAsync()", - "public async Task GetDaemonGameTuiSurfaceAsync()", - "public async Task GetDaemonEditorSurfaceAsync()", - "public async Task GetDaemonEditorTuiSurfaceAsync()", + "public async Task GetDaemonGameSurfaceAsync()", + "public async Task GetDaemonGameTuiSurfaceAsync()", + "public async Task GetDaemonEditorSurfaceAsync()", + "public async Task GetDaemonEditorTuiSurfaceAsync()", "public AetheriaRuntimeCatalogSnapshot OpenRuntimeCatalog()", "public async Task GetPlayerSettingsAsync()", "public async Task GetVerseHostSettingsAsync()", @@ -12941,10 +12944,10 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) "return Database.GetAsync", "return Database.GetAsync", "return Database.GetAsync", - "return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface);", - "return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface);", - "return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface);", - "return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface);" + "return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface);", + "return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface);", + "return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface);", + "return Database.GetAsync(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface);" }; var clientCompatibilityStoreBypassHits = forbiddenClientCompatibilityStoreBypasses .Where(symbol => client.Contains(symbol, StringComparison.Ordinal)) @@ -12969,27 +12972,6 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) "AetheriaRuntimeVerseClient reintroduced a private document handle; use shared CultMeshMutableStatePointer instead."); } - 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 EveSurfaceStateBinding", - "public EveSurfaceStateBinding[] StateBindings", - "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)); - } - var deletedCommandPortPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCommandPort.cs"); if (File.Exists(deletedCommandPortPath)) { @@ -13004,7 +12986,7 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) "MutableDocument(CultRecordKey)", "Unity", "Verse records", - "EveSurfaceState", + "EveSurfaceDocument", "same typed records" }; var missingDocSymbols = requiredDocSymbols @@ -16681,7 +16663,7 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) runtimeCatalogStore.Contains("ReadFieldEveSurface", StringComparison.Ordinal)) { throw new InvalidOperationException( - "Runtime catalog store still exposes Eve-surface parsing/projection helpers; surface access must flow through managed EveSurfaceState documents."); + "Runtime catalog store still exposes Eve-surface parsing/projection helpers; surface access must flow through managed CultMesh EveSurfaceDocument handles."); } if (!unityPackageProject.Contains("AetheriaRuntimeStateRefResolver.cs", StringComparison.Ordinal) || @@ -16896,8 +16878,8 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) "public static AetheriaControl Control(string runtimeId = \"\")", "public static AetheriaUi Ui(string runtimeId = \"\")", "public static AetheriaUi Ui(", - "public static CultMeshStateRefResolver EveSurfaceStateRefResolver(string runtimeId = \"\")", - "public static CultMeshStateRefResolver EveSurfaceStateRefResolver(", + "public static CultMeshStateRefResolver EveSurfaceCultMeshStateRefResolver(string runtimeId = \"\")", + "public static CultMeshStateRefResolver EveSurfaceCultMeshStateRefResolver(", "private static readonly Dictionary RuntimeClients", "RuntimeClients.TryGetValue(cacheKey, out var runtimeClient)", "RuntimeClients[cacheKey] = runtimeClient", @@ -17540,8 +17522,8 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) "Aetheria Eve surface presenter must grab the provider RuntimeState and read the daemon surface through AetheriaClientState reactive typed documents."); } - if (!eveSurfacePresenter.Contains("AetheriaUnityRuntimeClientProvider.EveSurfaceStateRefResolver(", StringComparison.Ordinal) || - !eveUnitySurfaceHost.Contains("AetheriaUnityRuntimeClientProvider.EveSurfaceStateRefResolver(", StringComparison.Ordinal)) + if (!eveSurfacePresenter.Contains("AetheriaUnityRuntimeClientProvider.EveSurfaceCultMeshStateRefResolver(", StringComparison.Ordinal) || + !eveUnitySurfaceHost.Contains("AetheriaUnityRuntimeClientProvider.EveSurfaceCultMeshStateRefResolver(", StringComparison.Ordinal)) { throw new InvalidOperationException( "Unity Eve surface lowering must resolve provider state refs through provider-native managed AetheriaClientState documents."); diff --git a/Aetheria.State/AetheriaDocumentRegistry.cs b/Aetheria.State/AetheriaDocumentRegistry.cs index c685726f7..47f9a9a60 100644 --- a/Aetheria.State/AetheriaDocumentRegistry.cs +++ b/Aetheria.State/AetheriaDocumentRegistry.cs @@ -64,7 +64,7 @@ public static class AetheriaDocumentRegistry typeof(AetheriaRuntimeCommittedCommandFactDocument), typeof(AetheriaRuntimeEveCommandDocument), typeof(AetheriaRuntimeSurfaceDocument), - typeof(EveSurfaceState), + typeof(EveSurfaceDocument), typeof(EveProviderAdvertisementState) ]; } diff --git a/Aetheria.State/AetheriaEveCommandBridge.cs b/Aetheria.State/AetheriaEveCommandBridge.cs index 1032b47d0..4bb546d97 100644 --- a/Aetheria.State/AetheriaEveCommandBridge.cs +++ b/Aetheria.State/AetheriaEveCommandBridge.cs @@ -1,5 +1,6 @@ using Aetheria.State.Documents; using GameCult.Aetheria.State.Verse; +using GameCult.Mesh; namespace Aetheria.State; @@ -51,7 +52,7 @@ public static class AetheriaEveCommandBridge { case AetheriaRuntimeEveCommandKind.CatalogRefresh: var catalog = await node.RuntimeCatalog().LatestAsync().ConfigureAwait(false); - await node.MutableDocument(AetheriaStateNode.CatalogSurfaceKey) + await node.MutableDocument(AetheriaStateNode.CatalogSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildCatalogSurface(catalog, command.IssuedAtUtc)) .ConfigureAwait(false); report.AcceptedCatalogRefreshes++; @@ -61,7 +62,7 @@ public static class AetheriaEveCommandBridge EmptyEveCommandAcceptanceStatus(node.StatePath, command.IssuedAtUtc); var verseHostSettings = await node.MutableDocument(AetheriaStateNode.VerseHostSettingsKey).ReadAsync().ConfigureAwait(false); var runtimeSession = await node.MutableDocument(AetheriaStateNode.RuntimeSessionKey(eveStatus.RuntimeId)).ReadAsync().ConfigureAwait(false); - await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey) + await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildOperationsSurface( eveStatus, verseHostSettings, @@ -188,7 +189,7 @@ public static class AetheriaEveCommandBridge .ConfigureAwait(false); } - await node.MutableDocument(AetheriaStateNode.PlayerSettingsSurfaceKey) + await node.MutableDocument(AetheriaStateNode.PlayerSettingsSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildPlayerSettingsSurface(settings, command.IssuedAtUtc)) .ConfigureAwait(false); } @@ -282,7 +283,7 @@ public static class AetheriaEveCommandBridge EmptyEveCommandAcceptanceStatus(node.StatePath, command.IssuedAtUtc); var runtimeSession = await node.MutableDocument(AetheriaStateNode.RuntimeSessionKey(eveStatus.RuntimeId)).ReadAsync().ConfigureAwait(false); - await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey) + await node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildOperationsSurface( eveStatus, normalized, diff --git a/Aetheria.State/AetheriaEveSurfaceDocuments.cs b/Aetheria.State/AetheriaEveSurfaceDocuments.cs index 7f2ee11f8..2016f6517 100644 --- a/Aetheria.State/AetheriaEveSurfaceDocuments.cs +++ b/Aetheria.State/AetheriaEveSurfaceDocuments.cs @@ -4,10 +4,9 @@ using System.Linq; using Aetheria.State.Documents; using GameCult.Aetheria.State.Verse; using GameCult.Mesh; -using EveDocumentCommandTemplate = Aetheria.State.Documents.EveCommandTemplate; -using EveDocumentStyleToken = Aetheria.State.Documents.EveStyleToken; -using EveDocumentSurface = Aetheria.State.Documents.EveSurface; -using EveDocumentSurfaceComponent = Aetheria.State.Documents.EveSurfaceComponent; +using EveSurfaceComponent = GameCult.Mesh.EveSurfaceComponent; +using EveSurfaceDocument = GameCult.Mesh.EveSurfaceDocument; +using EveSurfaceTree = GameCult.Mesh.EveSurfaceTree; namespace Aetheria.State; @@ -30,7 +29,7 @@ public static class AetheriaEveSurfaceDocuments private const string DaemonCommandBoundaryId = "aetheria.daemon.commands"; private const string DaemonRecordTransport = "cultmesh-record"; - public static EveSurfaceState BuildCatalogSurface( + public static EveSurfaceDocument BuildCatalogSurface( AetheriaRuntimeCatalogSnapshot catalog, string updatedAtUtc, long version = 1) @@ -60,17 +59,15 @@ public static class AetheriaEveSurfaceDocuments CultMeshLocalityKind.Automatic, "cultmesh"))); - return new EveSurfaceState - { - ProviderId = ProviderId, - ProviderKind = "game.runtime", - Title = "Aetheria Catalog", - Version = version, - UpdatedAtUtc = updatedAtUtc, - Surface = new EveDocumentSurface - { - Id = CatalogSurfaceId, - Root = Node( + return new EveSurfaceDocument( + ProviderId, + "game.runtime", + "Aetheria Catalog", + version, + updatedAtUtc, + new EveSurfaceTree( + CatalogSurfaceId, + Node( "aetheria.catalog.root", "surface", [], @@ -93,24 +90,15 @@ public static class AetheriaEveSurfaceDocuments "aetheria.catalog.corporations", "card", [("title", "Corporations")], - Node("aetheria.catalog.corporation.rows", "inspector.kv", [], corporations))) - }, - Commands = - [ - new EveDocumentCommandTemplate - { - Command = refreshCommand.OperationId, - Label = refreshCommand.Label, - Transport = refreshCommand.RouteDescription, - SchemaId = refreshCommand.SchemaId, - RouteKind = refreshCommand.RouteKind, - RouteDescription = refreshCommand.RouteDescription - } - ] - }; + Node("aetheria.catalog.corporation.rows", "inspector.kv", [], corporations))), + Array.Empty()), + new[] + { + new EveSurfaceCommandTemplate(refreshCommand.ToBinding()) + }); } - public static EveSurfaceState BuildOperationsSurface( + public static EveSurfaceDocument BuildOperationsSurface( AetheriaEveCommandAcceptanceStatus? eveCommandStatus = null, AetheriaVerseHostSettings? verseHostSettings = null, AetheriaRuntimeSession? runtimeSession = null, @@ -128,17 +116,15 @@ public static class AetheriaEveSurfaceDocuments routeHint: new CultMeshRouteHint( CultMeshLocalityKind.Automatic, "cultmesh"))); - return new EveSurfaceState - { - ProviderId = ProviderId, - ProviderKind = "game.runtime", - Title = "Aetheria Operations", - Version = version, - UpdatedAtUtc = updatedAtUtc, - Surface = new EveDocumentSurface - { - Id = OperationsSurfaceId, - Root = Node( + return new EveSurfaceDocument( + ProviderId, + "game.runtime", + "Aetheria Operations", + version, + updatedAtUtc, + new EveSurfaceTree( + OperationsSurfaceId, + Node( "aetheria.operations.root", "surface", [], @@ -188,24 +174,15 @@ public static class AetheriaEveSurfaceDocuments "runtimeSession.last", ("runtime", runtimeSession?.RuntimeId ?? ""), ("started", runtimeSession?.StartedAtUtc ?? ""), - ("lastSeen", runtimeSession?.LastSeenAtUtc ?? "")))) - }, - Commands = - [ - new EveDocumentCommandTemplate - { - Command = refreshCommand.OperationId, - Label = refreshCommand.Label, - Transport = refreshCommand.RouteDescription, - SchemaId = refreshCommand.SchemaId, - RouteKind = refreshCommand.RouteKind, - RouteDescription = refreshCommand.RouteDescription - } - ] - }; + ("lastSeen", runtimeSession?.LastSeenAtUtc ?? "")))), + Array.Empty()), + new[] + { + new EveSurfaceCommandTemplate(refreshCommand.ToBinding()) + }); } - public static EveSurfaceState BuildPlayerSettingsSurface( + public static EveSurfaceDocument BuildPlayerSettingsSurface( AetheriaPlayerSettings? settings, string updatedAtUtc, long version = 1) @@ -228,41 +205,7 @@ public static class AetheriaEveSurfaceDocuments publishedAtUtc, version); - return new EveSurfaceState - { - ProviderId = surface.ProviderId, - ProviderKind = surface.ProviderKind, - Title = surface.Title, - Version = surface.Version, - UpdatedAtUtc = surface.UpdatedAtUtc, - Surface = new EveDocumentSurface - { - Id = surface.Surface.Id, - Root = ConvertComponent(surface.Surface.Root), - Styles = surface.Surface.Styles - .Select(style => new EveDocumentStyleToken - { - Name = style.Name, - Value = style.Value - }) - .ToArray() - }, - Commands = surface.Commands - .Select(command => - { - var record = CultMesh.OperationBindingRecord(command.Operation); - return new EveDocumentCommandTemplate - { - Command = record.OperationId, - Label = record.Label, - Transport = record.RouteDescription, - SchemaId = record.SchemaId, - RouteKind = record.RouteKind, - RouteDescription = record.RouteDescription - }; - }) - .ToArray() - }; + return AetheriaRuntimeSurfaceDocuments.ToPortableSurface(surface); } public static EveProviderAdvertisementState BuildProviderAdvertisement( @@ -483,40 +426,27 @@ public static class AetheriaEveSurfaceDocuments return latest; } - private static EveDocumentSurfaceComponent Metric(string id, string label, string value) + private static EveSurfaceComponent Metric(string id, string label, string value) { return Node(id, "metric", [("label", label), ("value", value)]); } - private static EveDocumentSurfaceComponent Row(string id, params (string Key, string Value)[] props) + private static EveSurfaceComponent Row(string id, params (string Key, string Value)[] props) { return Node(id, "row", props); } - private static EveDocumentSurfaceComponent Node( + private static EveSurfaceComponent Node( string id, string kind, (string Key, string Value)[] props, - params EveDocumentSurfaceComponent[] children) + params EveSurfaceComponent[] children) { - return new EveDocumentSurfaceComponent - { - Id = id, - Kind = kind, - Props = props.ToDictionary(prop => prop.Key, prop => prop.Value), - Children = children - }; - } - - private static EveDocumentSurfaceComponent ConvertComponent(AetheriaRuntimeSurfaceComponent component) - { - return new EveDocumentSurfaceComponent - { - Id = component.Id, - Kind = component.Kind, - Props = new Dictionary(component.Props, StringComparer.Ordinal), - Children = component.Children.Select(ConvertComponent).ToArray() - }; + return new EveSurfaceComponent( + id, + kind, + props.ToDictionary(prop => prop.Key, prop => prop.Value), + children); } private static string SafeId(string value) diff --git a/Aetheria.State/AetheriaStateNode.cs b/Aetheria.State/AetheriaStateNode.cs index 6a56152fa..a2f1be800 100644 --- a/Aetheria.State/AetheriaStateNode.cs +++ b/Aetheria.State/AetheriaStateNode.cs @@ -15,7 +15,7 @@ public sealed class AetheriaStateNode : IAsyncDisposable, IDisposable { private readonly CultMeshNode _node; private CultMeshDocumentHandle? _runtimeCatalog; - private CultMeshDocumentHandle? _catalogSurface; + private CultMeshDocumentHandle? _catalogSurface; private AetheriaStateNode(string statePath, string runtimeId, CultMeshNode node) { @@ -123,7 +123,7 @@ public sealed class AetheriaStateNode : IAsyncDisposable, IDisposable routeHint: new CultMeshRouteHint(CultMeshLocalityKind.SharedMemory, "Aetheria typed catalog state")); } - public CultMeshDocumentHandle CatalogSurface() + public CultMeshDocumentHandle CatalogSurface() { var catalog = RuntimeCatalog(); return _catalogSurface ??= CultMesh.Document( diff --git a/Aetheria.State/docs/cultmesh-cross-runtime-primitives.md b/Aetheria.State/docs/cultmesh-cross-runtime-primitives.md index 5231fea03..584e59567 100644 --- a/Aetheria.State/docs/cultmesh-cross-runtime-primitives.md +++ b/Aetheria.State/docs/cultmesh-cross-runtime-primitives.md @@ -75,7 +75,7 @@ First implementation footholds now exist in CultLib: - `E:/Projects/CultLib/src/GameCult.Mesh/CultMeshPrimitives.cs` also exposes fluent operation/query context builders, with `CultMesh.OperationContextFor(...)` and `CultMesh.QueryContextFor(...)` entrypoints. Application code should read like a typed Verse call, not like manual transport setup. - `E:/Projects/CultLib/src/GameCult.Geometry/CultGeometryPrimitives.cs` defines shared `CultVec2`, `CultVec3`, `CultRect`, `CultCircle`, and `CultSphere` values for query and physics contracts. - `E:/Projects/CultLib/packages/cultmesh-ts/src/index.ts` now exposes TS `CultMeshVec2`, `CultMeshRect`, `CultMeshViewportRequest`, `CultMeshQuerySurface`, `CultMeshQueryContext`, `CultMeshOperationHandle`, `CultMeshOperationContext`, `CultMeshOperationPayload`, `CultMeshDocumentHandle`, `CultMeshDocumentCatalog`, `CultMeshCollectionHandle`, `CultMeshStatePointer`, `CultMeshStateBindingDescriptor`, `CultMeshOperationBindingDescriptor`, `CultMeshOperationInvocationDescriptor`, native slice descriptors, authority claims, route hints, fluent context builders, and handle helpers like `CultMesh.rectFromBounds(...)`, `CultMesh.viewportRequest(...)`, `CultMesh.query(...)`, `CultMesh.querySource(...)`, `CultMesh.operation(...)`, `CultMesh.document(...)`, `CultMesh.documents(...)`, `CultMesh.collection(...)`, `CultMesh.operationPayload(...)`, `CultMesh.statePointer(...)`, `CultMesh.stateBinding(...)`, `CultMesh.operationBinding(...)`, `CultMesh.operationInvocation(...)`, `CultMesh.nativeSliceView(...)`, `CultMesh.operationContextFor(...)`, and `CultMesh.queryContextFor(...)`. -- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimePlayerSettingsSurfaceBuilder.cs` and `E:/Projects/Eve/packages/org.gamecult.eve.surface/Runtime/EveSurfaceDocument.cs` now expose component `StateBindings` as `IReadOnlyList`. Eve no longer owns a parallel live binding DTO, and Aetheria no longer keeps one in its live runtime surface model. Aetheria only keeps a MessagePack DTO at the persisted document boundary and converts to the shared CultMesh primitive before handing surfaces to renderers. +- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimePlayerSettingsSurfaceBuilder.cs` and `GameCult.Mesh.EveSurfaceDocument` now expose component state bindings as CultMesh-owned portable binding records. Eve no longer owns a parallel live binding DTO, and Aetheria no longer owns a parallel persisted Eve surface state. Aetheria can build runtime surface source data, then publishes the shared CultMesh surface document before renderers lower it. - `E:/Projects/Eve/packages/org.gamecult.eve.surface/Runtime/EveSurfaceDocument.cs` also exposes component `EmbeddedDocuments` as first-class CultUI slots. Aetheria runtime surfaces mirror that shape with `AetheriaRuntimeEmbeddedDocumentSlot`, so daemon-owned UI can compose nested synced surfaces such as inventory dropdowns without a Unity-only model, facade, or projector. - Aetheria and Eve live command templates now carry `CultMeshOperationBindingDescriptor`. Eve command requests carry `CultMeshOperationInvocationDescriptor` plus `CultMeshOperationPayload`, so renderer click/change events preserve operation id, schema, route hint, idempotency, and scalar field reads as shared CultMesh metadata. Legacy `command`, `label`, `transport`, and string payload fields remain compatibility projections and persisted DTO fields, but the live API no longer exposes raw command-string/dictionary constructors; controls point at typed CultMesh operations and renderers build requests from shared CultMesh primitives. - `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonOperationsClient.cs` is now a typed operation handle surface that returns `CultMeshOperationReceipt` from semantic verbs such as `SetMoveVector`, `SetTarget`, `DockNearest`, and inventory transfers. The lower-level daemon command envelope remains an internal transport wrapper, but public client code should receive shared CultMesh receipts, not Aetheria-specific command envelopes. @@ -193,7 +193,7 @@ Current leak: ```csharp using var client = await AetheriaClient.OpenAsync(statePath, runtimeId); -var resolver = client.State.CreateEveSurfaceStateRefResolver(); +var resolver = client.State.CreateEveSurfaceCultMeshStateRefResolver(); var selected = resolver(surface.StateRef); ``` diff --git a/Aetheria.State/docs/daemon-code-map-for-rust-port.md b/Aetheria.State/docs/daemon-code-map-for-rust-port.md index 91f990d28..9be457b19 100644 --- a/Aetheria.State/docs/daemon-code-map-for-rust-port.md +++ b/Aetheria.State/docs/daemon-code-map-for-rust-port.md @@ -388,7 +388,7 @@ Current Eve surface state-ref resolution: ```csharp using var client = await AetheriaClient.OpenAsync(statePath, runtimeId); -var resolver = client.State.CreateEveSurfaceStateRefResolver(); +var resolver = client.State.CreateEveSurfaceCultMeshStateRefResolver(); var label = resolver("aetheria.daemon/frame/currentEntity/name"); ``` diff --git a/Assets/Scripts/Gameplay/AetheriaUnityEveRuntimeHooks.cs b/Assets/Scripts/Gameplay/AetheriaUnityEveRuntimeHooks.cs index ba95baa32..88f20d525 100644 --- a/Assets/Scripts/Gameplay/AetheriaUnityEveRuntimeHooks.cs +++ b/Assets/Scripts/Gameplay/AetheriaUnityEveRuntimeHooks.cs @@ -18,6 +18,6 @@ public static class AetheriaUnityEveRuntimeHooks AetheriaEveRuntimeUnityHooks.Ui = (stateBoot, runtimeId) => AetheriaUnityRuntimeClientProvider.Ui(stateBoot, runtimeId); AetheriaEveRuntimeUnityHooks.StateRefResolver = - (stateBoot, runtimeId) => AetheriaUnityRuntimeClientProvider.EveSurfaceStateRefResolver(stateBoot, runtimeId); + (stateBoot, runtimeId) => AetheriaUnityRuntimeClientProvider.EveSurfaceCultMeshStateRefResolver(stateBoot, runtimeId); } } diff --git a/Assets/Scripts/Gameplay/AetheriaUnityRuntimeClientProvider.cs b/Assets/Scripts/Gameplay/AetheriaUnityRuntimeClientProvider.cs index 19264fea3..176fb8be0 100644 --- a/Assets/Scripts/Gameplay/AetheriaUnityRuntimeClientProvider.cs +++ b/Assets/Scripts/Gameplay/AetheriaUnityRuntimeClientProvider.cs @@ -129,12 +129,12 @@ public static class AetheriaUnityRuntimeClientProvider return RuntimeClient(stateBoot, runtimeId).Ui; } - public static CultMeshStateRefResolver EveSurfaceStateRefResolver(string runtimeId = "") + public static CultMeshStateRefResolver EveSurfaceCultMeshStateRefResolver(string runtimeId = "") { return RuntimeState(runtimeId).CreateEveSurfaceCultMeshStateRefResolver(); } - public static CultMeshStateRefResolver EveSurfaceStateRefResolver( + public static CultMeshStateRefResolver EveSurfaceCultMeshStateRefResolver( AetheriaRuntimeStateBootReport stateBoot, string runtimeId = "") { diff --git a/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs index 9731c0a2e..0a0f9a763 100644 --- a/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs +++ b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs @@ -13,6 +13,7 @@ using EveSurfaceCommandRequest = GameCult.Eve.Surface.EveSurfaceCommandRequest; using EveSurfaceComponent = GameCult.Eve.Surface.EveSurfaceComponent; using EveSurfaceDocument = GameCult.Eve.Surface.EveSurfaceDocument; using EveSurfaceTree = GameCult.Eve.Surface.EveSurfaceTree; +using MeshEveSurfaceDocument = GameCult.Mesh.EveSurfaceDocument; public class DaemonRuntimeDocumentTests { @@ -4350,27 +4351,27 @@ public class DaemonRuntimeDocumentTests .GetAwaiter() .GetResult(); client - .MutableDocument( + .MutableDocument( AetheriaRuntimeVerseRecordKeys.DaemonGameSurface) - .ReplaceAsync(ToEveSurfaceState(result.GameSurface)) + .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToPortableSurface(result.GameSurface)) .GetAwaiter() .GetResult(); client - .MutableDocument( + .MutableDocument( AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface) - .ReplaceAsync(ToEveSurfaceState(result.GameTuiSurface)) + .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToPortableSurface(result.GameTuiSurface)) .GetAwaiter() .GetResult(); client - .MutableDocument( + .MutableDocument( AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface) - .ReplaceAsync(ToEveSurfaceState(result.EditorSurface)) + .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToPortableSurface(result.EditorSurface)) .GetAwaiter() .GetResult(); client - .MutableDocument( + .MutableDocument( AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface) - .ReplaceAsync(ToEveSurfaceState(result.EditorTuiSurface)) + .ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToPortableSurface(result.EditorTuiSurface)) .GetAwaiter() .GetResult(); client.FlushAsync() @@ -4378,81 +4379,6 @@ public class DaemonRuntimeDocumentTests .GetResult(); } - private static Aetheria.State.Documents.EveSurfaceState ToEveSurfaceState( - AetheriaRuntimeSurfaceDocument document) - { - return new Aetheria.State.Documents.EveSurfaceState - { - ProviderId = document.ProviderId, - ProviderKind = document.ProviderKind, - Title = document.Title, - Version = document.Version, - UpdatedAtUtc = document.UpdatedAtUtc, - Surface = ToEveSurface(document.Surface), - Commands = document.Commands - .Select(command => - { - var record = CultMesh.OperationBindingRecord(command.Operation); - return new Aetheria.State.Documents.EveCommandTemplate - { - Command = record.OperationId, - Label = record.Label, - Transport = record.RouteDescription, - SchemaId = record.SchemaId, - RouteKind = record.RouteKind, - RouteDescription = record.RouteDescription - }; - }) - .ToArray() - }; - } - - private static Aetheria.State.Documents.EveSurface ToEveSurface(AetheriaRuntimeSurfaceTree surface) - { - return new Aetheria.State.Documents.EveSurface - { - Id = surface.Id, - Root = ToEveSurfaceComponent(surface.Root), - Styles = surface.Styles - .Select(style => new Aetheria.State.Documents.EveStyleToken - { - Name = style.Name, - Value = style.Value - }) - .ToArray() - }; - } - - private static Aetheria.State.Documents.EveSurfaceComponent ToEveSurfaceComponent( - AetheriaRuntimeSurfaceComponent component) - { - var props = new Dictionary(component.Props, StringComparer.Ordinal); - AetheriaRuntimeSurfaceStateBindings.AddPointerProps(props, component.StateBindings); - - return new Aetheria.State.Documents.EveSurfaceComponent - { - Id = component.Id, - Kind = component.Kind, - Props = props, - Children = component.Children.Select(ToEveSurfaceComponent).ToArray(), - StateBindings = component.StateBindings - .Select(binding => - { - var record = CultMesh.StateBindingRecord(binding); - return new Aetheria.State.Documents.EveSurfaceStateBinding - { - TargetProp = record.TargetProp, - PointerId = record.PointerId, - SourceId = record.SourceId, - SchemaId = record.SchemaId, - RouteKind = record.RouteKind, - RouteDescription = record.RouteDescription - }; - }) - .ToArray() - }; - } - private static void PublishVerseAuthorityPolicyThroughVerseClient( string statePath, AetheriaRuntimeVerseAuthorityPolicyDocument policy) diff --git a/GameCult.Aetheria.State.Unity.csproj b/GameCult.Aetheria.State.Unity.csproj index 143da1e2b..9703cba7e 100644 --- a/GameCult.Aetheria.State.Unity.csproj +++ b/GameCult.Aetheria.State.Unity.csproj @@ -93,7 +93,6 @@ - diff --git a/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs b/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs index a67814bfe..7f594cc60 100644 --- a/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs +++ b/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs @@ -5,6 +5,7 @@ using GameCult.Eve.Surface; using GameCult.Mesh; using UnityEngine; using UnityEngine.UIElements; +using MeshEveSurfaceDocument = GameCult.Mesh.EveSurfaceDocument; #nullable enable @@ -35,7 +36,7 @@ namespace GameCult.Aetheria.EveRuntime private string _mountedSurfaceId = ""; private long _mountedSurfaceVersion = -1; private string _mountedSurfaceUpdatedAtUtc = ""; - private CultMeshReactiveDocument? _reactiveSurfaceState; + private CultMeshReactiveDocument? _reactiveSurfaceState; private string _reactiveSurfaceStatePath = ""; private string _reactiveSurfaceId = ""; private static readonly AetheriaEveUnitySurfaceChrome RootOnlyChrome = new AetheriaEveUnitySurfaceChrome @@ -140,14 +141,14 @@ namespace GameCult.Aetheria.EveRuntime "unity-eve-surface-presenter")); } - private global::Aetheria.State.Documents.EveSurfaceState? ReadDaemonSurfaceState( + private MeshEveSurfaceDocument? ReadDaemonSurfaceState( AetheriaRuntimeStateBootReport stateBoot) { var reactive = ResolveReactiveDaemonSurfaceState(stateBoot); return reactive?.Current; } - private CultMeshReactiveDocument? ResolveReactiveDaemonSurfaceState( + private CultMeshReactiveDocument? ResolveReactiveDaemonSurfaceState( AetheriaRuntimeStateBootReport stateBoot) { if (_reactiveSurfaceState != null && @@ -168,7 +169,7 @@ namespace GameCult.Aetheria.EveRuntime return _reactiveSurfaceState; } - private CultMeshReactiveDocument? CreateReactiveDaemonSurfaceState( + private CultMeshReactiveDocument? CreateReactiveDaemonSurfaceState( AetheriaRuntimeStateBootReport stateBoot) { try diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs index b387bed6a..c7e7969d3 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using GameCult.Mesh; using MessagePack; +using MeshEveSurfaceDocument = GameCult.Mesh.EveSurfaceDocument; #nullable enable @@ -41,10 +42,10 @@ namespace GameCult.Aetheria.State.Verse CultMeshDocumentHandle authorityPolicy, CultMeshDocumentHandle daemonFrame, CultMeshDocumentHandle daemonSoaView, - CultMeshDocumentHandle gameSurface, - CultMeshDocumentHandle gameTuiSurface, - CultMeshDocumentHandle editorSurface, - CultMeshDocumentHandle editorTuiSurface, + CultMeshDocumentHandle gameSurface, + CultMeshDocumentHandle gameTuiSurface, + CultMeshDocumentHandle editorSurface, + CultMeshDocumentHandle editorTuiSurface, CultMeshDocumentHandle catalog, CultMeshDocumentHandle loadoutTemplates, CultMeshDocumentHandle playerSettings, @@ -126,13 +127,13 @@ namespace GameCult.Aetheria.State.Verse public CultMeshDocumentHandle LoadoutTemplates { get; } - public CultMeshDocumentHandle GameSurface { get; } + public CultMeshDocumentHandle GameSurface { get; } - public CultMeshDocumentHandle GameTuiSurface { get; } + public CultMeshDocumentHandle GameTuiSurface { get; } - public CultMeshDocumentHandle EditorSurface { get; } + public CultMeshDocumentHandle EditorSurface { get; } - public CultMeshDocumentHandle EditorTuiSurface { get; } + public CultMeshDocumentHandle EditorTuiSurface { get; } public CultMeshDocumentHandle PlayerSettings { get; } @@ -190,7 +191,7 @@ namespace GameCult.Aetheria.State.Verse return false; } - public CultMeshDocumentHandle? EveSurfaceDocument( + public CultMeshDocumentHandle? EveSurfaceDocument( string? surfaceId) { if (!TryResolveEveSurface(surfaceId, out var surface)) diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs deleted file mode 100644 index 9aade4f7d..000000000 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.Collections.Generic; -using GameCult.Caching; -using MessagePack; - -namespace Aetheria.State.Documents; - -[CultDocument("gamecult.eve.surface", "gamecult.eve.surface.v1")] -[MessagePackObject] -public sealed class EveSurfaceState -{ - [Key(0)] - public string Type { get; set; } = "surface-state"; - - [Key(1)] - [CultIndex("schema")] - public string Schema { get; set; } = "gamecult.eve.surface.v1"; - - [Key(2)] - [CultIndex("providerId")] - public string ProviderId { get; set; } = ""; - - [Key(3)] - [CultIndex("providerKind")] - public string ProviderKind { get; set; } = ""; - - [Key(4)] - [CultName] - public string Title { get; set; } = ""; - - [Key(5)] - public long Version { get; set; } - - [Key(6)] - public string UpdatedAtUtc { get; set; } = ""; - - [Key(7)] - public EveSurface Surface { get; set; } = new(); - - [Key(8)] - public EveCommandTemplate[] Commands { get; set; } = Array.Empty(); -} - -[MessagePackObject] -public sealed class EveSurface -{ - [Key(0)] - public string Id { get; set; } = ""; - - [Key(1)] - public EveSurfaceComponent Root { get; set; } = new(); - - [Key(2)] - public EveStyleToken[] Styles { get; set; } = Array.Empty(); -} - -[MessagePackObject] -public sealed class EveSurfaceComponent -{ - [Key(0)] - public string Id { get; set; } = ""; - - [Key(1)] - public string Kind { get; set; } = ""; - - [Key(2)] - public Dictionary Props { get; set; } = new(); - - [Key(3)] - public EveSurfaceComponent[] Children { get; set; } = Array.Empty(); - - [Key(4)] - public EveSurfaceStateBinding[] StateBindings { get; set; } = Array.Empty(); -} - -[MessagePackObject] -public sealed class EveSurfaceStateBinding -{ - [Key(0)] - public string TargetProp { get; set; } = "value"; - - [Key(1)] - public string PointerId { get; set; } = ""; - - [Key(2)] - public string SourceId { get; set; } = ""; - - [Key(3)] - public string SchemaId { get; set; } = ""; - - [Key(4)] - public string RouteKind { get; set; } = ""; - - [Key(5)] - public string RouteDescription { get; set; } = ""; -} - -[MessagePackObject] -public sealed class EveStyleToken -{ - [Key(0)] - public string Name { get; set; } = ""; - - [Key(1)] - public string Value { get; set; } = ""; -} - -[MessagePackObject] -public sealed class EveCommandTemplate -{ - [Key(0)] - public string Command { get; set; } = ""; - - [Key(1)] - public string Label { get; set; } = ""; - - [Key(2)] - public string Transport { get; set; } = "cultmesh"; - - [Key(3)] - public string SchemaId { get; set; } = ""; - - [Key(4)] - public string RouteKind { get; set; } = ""; - - [Key(5)] - public string RouteDescription { get; set; } = ""; -} diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs.meta b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs.meta deleted file mode 100644 index b6fbe946a..000000000 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: d01c44e962c7c114aa065999ab666f92 \ No newline at end of file diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeSurfaceDocuments.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeSurfaceDocuments.cs index c2ddb501d..8b9b5d473 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeSurfaceDocuments.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeSurfaceDocuments.cs @@ -4,7 +4,6 @@ using System.Linq; using GameCult.Caching; using GameCult.Mesh; using MessagePack; -using EveSurfaceState = global::Aetheria.State.Documents.EveSurfaceState; using EveUiCommandTemplate = GameCult.Eve.Surface.EveCommandTemplate; using EveUiEmbeddedDocumentSlot = GameCult.Eve.Surface.EveEmbeddedDocumentSlot; using EveUiStyleToken = GameCult.Eve.Surface.EveStyleToken; @@ -239,34 +238,25 @@ namespace GameCult.Aetheria.State.Verse public static class AetheriaRuntimeSurfaceDocuments { - public static EveSurfaceState ToEveSurfaceState(AetheriaRuntimeSurfaceDocument document) + public static GameCult.Mesh.EveSurfaceDocument ToPortableSurface(AetheriaRuntimeSurfaceDocument document) { if (document == null) throw new ArgumentNullException(nameof(document)); - return new EveSurfaceState - { - ProviderId = document.ProviderId, - ProviderKind = document.ProviderKind, - Title = document.Title, - Version = document.Version, - UpdatedAtUtc = document.UpdatedAtUtc, - Surface = ToEveSurfaceState(document.Surface), - Commands = document.Commands - .Select(command => - { - var record = CultMesh.OperationBindingRecord(command.Operation); - return new global::Aetheria.State.Documents.EveCommandTemplate - { - Command = record.OperationId, - Label = record.Label, - Transport = record.RouteDescription, - SchemaId = record.SchemaId, - RouteKind = record.RouteKind, - RouteDescription = record.RouteDescription - }; - }) - .ToArray() - }; + return new GameCult.Mesh.EveSurfaceDocument( + document.ProviderId, + document.ProviderKind, + document.Title, + document.Version, + document.UpdatedAtUtc, + new GameCult.Mesh.EveSurfaceTree( + document.Surface.Id, + ToPortableComponent(document.Surface.Root), + document.Surface.Styles + .Select(style => new GameCult.Mesh.EveSurfaceStyleToken(style.Name, style.Value)) + .ToArray()), + document.Commands + .Select(command => new GameCult.Mesh.EveSurfaceCommandTemplate(command.Operation)) + .ToArray()); } public static AetheriaRuntimeSurfaceDocument FromPortableSurface(GameCult.Mesh.EveSurfaceDocument document) @@ -296,37 +286,18 @@ namespace GameCult.Aetheria.State.Verse return ToEveSurfaceDocument(document, null); } - public static EveUiSurfaceDocument ToEveSurfaceDocument(EveSurfaceState state) + public static EveUiSurfaceDocument ToEveSurfaceDocument(GameCult.Mesh.EveSurfaceDocument document) { - return ToEveSurfaceDocument(state, null); + return ToEveSurfaceDocument(document, null); } public static EveUiSurfaceDocument ToEveSurfaceDocument( - EveSurfaceState state, + GameCult.Mesh.EveSurfaceDocument document, CultMeshStateRefResolver? stateRefResolver) { - if (state == null) throw new ArgumentNullException(nameof(state)); + if (document == null) throw new ArgumentNullException(nameof(document)); - var surface = new EveUiSurfaceDocument( - state.Type, - state.Schema, - state.ProviderId, - state.ProviderKind, - state.Title, - state.Version, - state.UpdatedAtUtc, - new EveUiSurfaceTree( - state.Surface.Id, - ToEveSurfaceComponent(state.Surface.Root), - state.Surface.Styles - .Select(style => new EveUiStyleToken(style.Name, style.Value)) - .ToArray()), - state.Commands - .Select(command => new EveUiCommandTemplate( - ToCultMeshOperationBinding(command))) - .ToArray()); - - return ResolveStateRefs(surface, stateRefResolver); + return ToEveSurfaceDocument(FromPortableSurface(document), stateRefResolver); } public static EveUiSurfaceDocument ToEveSurfaceDocument( @@ -415,70 +386,6 @@ namespace GameCult.Aetheria.State.Verse component.EmbeddedDocuments.Select(ToEveEmbeddedDocumentSlot).ToArray()); } - private static global::Aetheria.State.Documents.EveSurface ToEveSurfaceState( - AetheriaRuntimeSurfaceTree surface) - { - return new global::Aetheria.State.Documents.EveSurface - { - Id = surface.Id, - Root = ToEveSurfaceState(surface.Root), - Styles = surface.Styles - .Select(style => new global::Aetheria.State.Documents.EveStyleToken - { - Name = style.Name, - Value = style.Value - }) - .ToArray() - }; - } - - private static global::Aetheria.State.Documents.EveSurfaceComponent ToEveSurfaceState( - AetheriaRuntimeSurfaceComponent component) - { - var props = new Dictionary(component.Props, StringComparer.Ordinal); - AetheriaRuntimeSurfaceStateBindings.AddPointerProps(props, component.StateBindings); - - return new global::Aetheria.State.Documents.EveSurfaceComponent - { - Id = component.Id, - Kind = component.Kind, - Props = props, - Children = component.Children.Select(ToEveSurfaceState).ToArray(), - StateBindings = component.StateBindings - .Select(binding => - { - var record = CultMesh.StateBindingRecord(binding); - return new global::Aetheria.State.Documents.EveSurfaceStateBinding - { - TargetProp = record.TargetProp, - PointerId = record.PointerId, - SourceId = record.SourceId, - SchemaId = record.SchemaId, - RouteKind = record.RouteKind, - RouteDescription = record.RouteDescription - }; - }) - .ToArray() - }; - } - - private static EveUiSurfaceComponent ToEveSurfaceComponent(global::Aetheria.State.Documents.EveSurfaceComponent component) - { - var props = new Dictionary(component.Props, StringComparer.Ordinal); - var stateBindings = (component.StateBindings ?? Array.Empty()) - .Select(ToRuntimeStateBinding) - .ToArray(); - AetheriaRuntimeSurfaceStateBindings.AddPointerProps( - props, - stateBindings); - return new EveUiSurfaceComponent( - component.Id, - component.Kind, - props, - component.Children.Select(ToEveSurfaceComponent).ToArray(), - stateBindings.Select(ToCultMeshStateBinding).ToArray()); - } - private static EveUiEmbeddedDocumentSlot ToEveEmbeddedDocumentSlot(AetheriaRuntimeEmbeddedDocumentSlot slot) { return new EveUiEmbeddedDocumentSlot( @@ -495,35 +402,6 @@ namespace GameCult.Aetheria.State.Verse return binding; } - private static CultMeshStateBindingDescriptor ToRuntimeStateBinding( - global::Aetheria.State.Documents.EveSurfaceStateBinding binding) - { - return CultMesh.StateBindingRecord( - binding.TargetProp, - binding.PointerId, - binding.SourceId, - binding.SchemaId, - binding.RouteKind, - binding.RouteDescription).ToBinding(); - } - - private static CultMeshOperationBindingDescriptor ToCultMeshOperationBinding( - global::Aetheria.State.Documents.EveCommandTemplate command) - { - var routeKind = string.IsNullOrWhiteSpace(command.RouteKind) - ? nameof(CultMeshLocalityKind.Automatic) - : command.RouteKind; - var routeDescription = string.IsNullOrWhiteSpace(command.RouteDescription) - ? command.Transport - : command.RouteDescription; - return CultMesh.OperationBindingRecord( - command.Command, - command.Label, - command.SchemaId, - routeKind, - routeDescription).ToBinding(); - } - private static EveUiSurfaceComponent ResolveStateRefs( EveUiSurfaceComponent component, Func resolveStateRef) @@ -603,6 +481,35 @@ namespace GameCult.Aetheria.State.Verse return new CultMeshRouteRecord(route.Kind, route.Description).ToRoute(CultMeshRouteHint.Automatic); } + private static GameCult.Mesh.EveSurfaceComponent ToPortableComponent(AetheriaRuntimeSurfaceComponent component) + { + var props = new Dictionary(component.Props, StringComparer.Ordinal); + AetheriaRuntimeSurfaceStateBindings.AddPointerProps(props, component.StateBindings); + + return new GameCult.Mesh.EveSurfaceComponent( + component.Id, + component.Kind, + props, + component.Children.Select(ToPortableComponent).ToArray(), + component.StateBindings + .Select(GameCult.Mesh.EveSurfaceStateBinding.FromDescriptor) + .ToArray(), + component.EmbeddedDocuments + .Select(ToPortableEmbeddedDocumentSlot) + .ToArray()); + } + + private static GameCult.Mesh.EveEmbeddedDocumentSlot ToPortableEmbeddedDocumentSlot( + AetheriaRuntimeEmbeddedDocumentSlot slot) + { + return new GameCult.Mesh.EveEmbeddedDocumentSlot( + slot.SlotId, + slot.DocumentId, + slot.SchemaId, + slot.PresentationKind, + GameCult.Mesh.EveSurfaceRouteHint.FromRoute(slot.RouteHint)); + } + private static void ResolvePropRefs( Dictionary props, Func resolveStateRef) diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs index 412b4c9a1..df691df8c 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs @@ -4,13 +4,13 @@ using System.Globalization; using System.IO; using System.Linq; using System.Threading.Tasks; -using Aetheria.State.Documents; using GameCult.Caching; using GameCult.Caching.MessagePack; -using GameCult.Eve.Surface; using GameCult.Mesh; using GameCult.Networking; using R3; +using EveUiCommandRequest = GameCult.Eve.Surface.EveSurfaceCommandRequest; +using MeshEveSurfaceDocument = GameCult.Mesh.EveSurfaceDocument; #nullable enable @@ -122,9 +122,9 @@ namespace GameCult.Aetheria.State.Verse typeof(AetheriaRuntimePlayerSettingsDocument), typeof(AetheriaRuntimeVerseHostSettingsDocument), typeof(AetheriaRuntimeSurfaceDocument), + typeof(MeshEveSurfaceDocument), typeof(AetheriaRuntimeDaemonCommandDocument), - typeof(AetheriaRuntimeEveCommandDocument), - typeof(EveSurfaceState) + typeof(AetheriaRuntimeEveCommandDocument) }; public static CultDocumentRegistry CreateCultCacheRegistry() @@ -324,7 +324,7 @@ namespace GameCult.Aetheria.State.Verse } internal Task SubmitKnownSurfaceCommandAsync( - EveSurfaceCommandRequest request, + EveUiCommandRequest request, string clientId, bool flush = true) { @@ -421,13 +421,13 @@ namespace GameCult.Aetheria.State.Verse latestFrameDocument, Document( AetheriaRuntimeVerseRecordKeys.DaemonSoaViewLatest), - Document( + Document( AetheriaRuntimeVerseRecordKeys.DaemonGameSurface), - Document( + Document( AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface), - Document( + Document( AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface), - Document( + Document( AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface), catalogDocument, loadoutTemplatesDocument, diff --git a/docs/aetheria-verse-client-contract.md b/docs/aetheria-verse-client-contract.md index c99d23cf8..397daf295 100644 --- a/docs/aetheria-verse-client-contract.md +++ b/docs/aetheria-verse-client-contract.md @@ -134,9 +134,11 @@ The daemon already publishes game and editor Eve surface records at these keys: `AetheriaRuntimeVerseRecordKeys` exposes those keys and `AetheriaRuntimeVerseClient` exposes typed reads, mutable state pointers, and -`WatchRecord(CultRecordKey)` 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. +`WatchRecord(CultRecordKey)` subscriptions for +all four. The Eve surface document contract lives in CultMesh because Eve is the +UI projection language, not an Aetheria persisted-state owner. A Unity client, +terminal client, daemon inspector, or later non-C# runtime binding lowers the +same published `GameCult.Mesh.EveSurfaceDocument`. 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. diff --git a/docs/developer-navigation.md b/docs/developer-navigation.md index ffa2d5267..c058dc378 100644 --- a/docs/developer-navigation.md +++ b/docs/developer-navigation.md @@ -314,7 +314,7 @@ Work on Unity thin-client migration: Work on Eve/CultUI surfaces: -- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs` +- `GameCult.Mesh.EveSurfaceDocument` for daemon-published CultUI/Eve surfaces - `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeSurfaceDocuments.cs` - `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveCommandClient.cs` - `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntime*SurfaceBuilder.cs`