From 29c0bc287bf1493f3a39c231ea5fe6fc3a538b9a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 13 Jul 2026 17:21:26 +0100 Subject: [PATCH] Publish canonical Eve provider advertisements --- Aetheria.State.Daemon/Program.cs | 85 +++--- Aetheria.State.Verify/Program.cs | 35 ++- Aetheria.State/AetheriaDocumentRegistry.cs | 3 +- Aetheria.State/AetheriaEveCommandBridge.cs | 3 +- Aetheria.State/AetheriaEveSurfaceDocuments.cs | 274 +++++++----------- .../EveProviderAdvertisementState.cs | 118 -------- 6 files changed, 178 insertions(+), 340 deletions(-) delete mode 100644 Aetheria.State/Documents/EveProviderAdvertisementState.cs diff --git a/Aetheria.State.Daemon/Program.cs b/Aetheria.State.Daemon/Program.cs index 0e09d8444..76bd3ac8a 100644 --- a/Aetheria.State.Daemon/Program.cs +++ b/Aetheria.State.Daemon/Program.cs @@ -2011,7 +2011,7 @@ static async Task PublishStateSurfacesAsync( await node.MutableDocument(AetheriaStateNode.PlayerSettingsSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildPlayerSettingsSurface(playerSettings, playerSettingsUpdatedAt)) .ConfigureAwait(false); - await node.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey) + await node.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildProviderAdvertisement(verseHost, node.StatePath, updatedAtUtc)) .ConfigureAwait(false); await node.FlushAsync().ConfigureAwait(false); @@ -2045,6 +2045,9 @@ static async Task PublishOdinSurfaceAnnouncementsAsync( }; var documents = new List(); + var providerAdvertisement = await node.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey) + .ReadAsync() + .ConfigureAwait(false); var assetManifest = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonAssetManifest) .ReadAsync() .ConfigureAwait(false); @@ -2063,10 +2066,13 @@ static async Task PublishOdinSurfaceAnnouncementsAsync( if (surface?.Surface?.Root == null) continue; - documents.Add(CreateOdinRawPut( - "gamecult.eve.provider_advertisement.v1", - providerId, - BuildOdinProviderAdvertisement(providerId, title, options, updatedAtUtc))); + if (providerAdvertisement != null) + { + documents.Add(CreateOdinRawPut( + EveProviderAdvertisementDocument.SchemaId, + providerId, + BuildOdinProviderAdvertisement(providerId, title, providerAdvertisement, updatedAtUtc))); + } documents.Add(CreateOdinRawPut( "gamecult.eve.surface_state.v1", providerId, @@ -2174,10 +2180,10 @@ static CultMeshCdnArtifact PackAssetBundle(string path, string platform) }); } -static CultNetDocumentPutRawMessage CreateOdinRawPut( +static CultNetDocumentPutRawMessage CreateOdinRawPut( string schemaId, string recordKey, - object payload) + T payload) { var now = DateTimeOffset.UtcNow.ToString("O"); return new CultNetDocumentPutRawMessage @@ -2197,53 +2203,32 @@ static CultNetDocumentPutRawMessage CreateOdinRawPut( }; } -static Dictionary BuildOdinProviderAdvertisement( +static EveProviderAdvertisementDocument BuildOdinProviderAdvertisement( string providerId, string title, - AetheriaDaemonHostOptions options, + EveProviderAdvertisementDocument canonical, string updatedAtUtc) { - return new Dictionary(StringComparer.Ordinal) - { - ["schema"] = "gamecult.eve.provider_advertisement.v1", - ["providerId"] = providerId, - ["serviceId"] = options.DaemonId, - ["verseId"] = options.VerseId, - ["rootVerse"] = "asgard", - ["canonicalService"] = "aetheria", - ["locatedService"] = options.DaemonId, - ["cultMeshAddress"] = options.CultMeshAddress, - ["title"] = title, - ["kind"] = "game.runtime", - ["status"] = "active", - ["updatedAt"] = string.IsNullOrWhiteSpace(updatedAtUtc) ? DateTimeOffset.UtcNow.ToString("O") : updatedAtUtc, - ["capabilities"] = new[] { "cultui-surface", "eve-surface", "cultmesh-cdn-assets", "aetheria-game-surface" }, - ["routes"] = new[] - { - new Dictionary(StringComparer.Ordinal) - { - ["transport"] = "cultmesh", - ["address"] = options.OdinCultMeshUri, - ["resolver"] = "odin-cultmesh", - ["role"] = "odin-provider-announcement" - }, - new Dictionary(StringComparer.Ordinal) - { - ["transport"] = "cultmesh-rudp", - ["address"] = $"rudp://{options.ClientCultMeshAdvertiseHost}:{options.ClientCultMeshPort}", - ["resolver"] = "provider-cultmesh-rudp", - ["role"] = "cultmesh-snapshot" - }, - new Dictionary(StringComparer.Ordinal) - { - ["transport"] = "cultmesh-rudp", - ["address"] = $"rudp://{options.ClientCultMeshAdvertiseHost}:{options.ClientCultMeshPort}", - ["schemaId"] = AetheriaRuntimeDaemonSchemas.CultMeshCdnAssetBlob, - ["resolver"] = "provider-cultmesh-rudp", - ["role"] = "cultmesh-cdn" - } - } - }; + var surfaces = canonical.Surfaces + .Where(surface => string.Equals(surface.SurfaceId, providerId, StringComparison.Ordinal)) + .ToArray(); + var commands = canonical.Commands + .Where(command => string.IsNullOrWhiteSpace(command.SurfaceId) || + string.Equals(command.SurfaceId, providerId, StringComparison.Ordinal)) + .ToArray(); + return new EveProviderAdvertisementDocument( + providerId, + canonical.ServiceId, + canonical.VerseId, + title, + canonical.Kind, + canonical.CultMeshAddress, + string.IsNullOrWhiteSpace(updatedAtUtc) ? canonical.UpdatedAtUtc : updatedAtUtc, + canonical.Freshness, + canonical.Schemas, + canonical.Witnesses, + surfaces, + commands); } static object[] BuildOdinSurfaceState( diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 2f281cb57..b7320476b 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -10742,7 +10742,7 @@ static void RequireVerseSettingsShellAndBridge(string root) "ExecuteVerseHostCommandAsync", "node.MutableDocument(AetheriaStateNode.VerseHostSettingsKey)", ".ReplaceAsync(normalized)", - "node.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey)", + "node.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey)", "AetheriaEveSurfaceDocuments.BuildOperationsSurface(", "switch (command.Kind)" }; @@ -11515,6 +11515,7 @@ static void RequireDaemonVersePublication(string root) var stateNodePath = Path.Combine(root, "Aetheria.State", "AetheriaStateNode.cs"); var runtimeSurfaceDocumentsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeSurfaceDocuments.cs"); var providerAdvertisementPath = Path.Combine(root, "Aetheria.State", "AetheriaEveSurfaceDocuments.cs"); + var legacyProviderAdvertisementPath = Path.Combine(root, "Aetheria.State", "Documents", "EveProviderAdvertisementState.cs"); var documentStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCultCacheDocumentStore.cs"); var boundaryPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateBoundary.cs"); var testsPath = Path.Combine(root, "Assets", "Scripts", "Tests", "DaemonRuntimeDocumentTests.cs"); @@ -11681,6 +11682,12 @@ static void RequireDaemonVersePublication(string root) "Daemon SoA frame publisher no longer turns authoritative frames into observer-readable direct-memory slabs: " + string.Join(", ", missingSoaFramePublisherSymbols)); } + if (File.Exists(legacyProviderAdvertisementPath)) + { + throw new InvalidOperationException( + "The deleted Aetheria-specific EveProviderAdvertisementState writer has returned: " + + Path.GetRelativePath(root, legacyProviderAdvertisementPath)); + } if (assetDocuments.Contains("UnityAddressable", StringComparison.Ordinal) || assetDocuments.Contains("unity_addressable", StringComparison.Ordinal) || @@ -12138,8 +12145,13 @@ static void RequireDaemonVersePublication(string root) "node.MutableDocument(AetheriaStateNode.PlayerSettingsKey).ReadAsync()", "node.MutableDocument(AetheriaStateNode.OperationsSurfaceKey)", "node.MutableDocument(AetheriaStateNode.PlayerSettingsSurfaceKey)", - "node.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey)", + "node.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey)", "AetheriaEveSurfaceDocuments.BuildProviderAdvertisement(verseHost, node.StatePath, updatedAtUtc)", + "static EveProviderAdvertisementDocument BuildOdinProviderAdvertisement(", + "static CultNetDocumentPutRawMessage CreateOdinRawPut(", + "EveProviderAdvertisementDocument.SchemaId", + "EveProviderAdvertisementDocument canonical", + "MessagePackSerializer.Serialize(payload)", "AetheriaEveSurfaceDocuments.BuildOperationsSurface(eveStatus, verseHost, runtimeSession)", "AetheriaEveSurfaceDocuments.BuildPlayerSettingsSurface(playerSettings, playerSettingsUpdatedAt)", "Role = \"verse-daemon\"", @@ -12190,6 +12202,25 @@ static void RequireDaemonVersePublication(string root) "Remote committed fact import must pass the managed runtime catalog document into the tick importer instead of reopening catalog storage."); } + var forbiddenEveProviderAdvertisementWriters = new[] + { + "EveProviderAdvertisementState", + "static Dictionary BuildOdinProviderAdvertisement(", + "[\"rootVerse\"]", + "[\"canonicalService\"]", + "[\"locatedService\"]", + "[\"routes\"]" + }; + var survivingEveProviderAdvertisementWriters = forbiddenEveProviderAdvertisementWriters + .Where(symbol => daemonHostProgram.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + if (survivingEveProviderAdvertisementWriters.Length > 0) + { + throw new InvalidOperationException( + "Daemon Odin publication still writes the deleted Aetheria-specific Eve provider advertisement shape: " + + string.Join(", ", survivingEveProviderAdvertisementWriters)); + } + if (committedFactImporter.Contains("AetheriaRuntimeCatalogStore.OpenReadOnly", StringComparison.Ordinal)) { throw new InvalidOperationException( diff --git a/Aetheria.State/AetheriaDocumentRegistry.cs b/Aetheria.State/AetheriaDocumentRegistry.cs index 0417fc0c4..e224af8cb 100644 --- a/Aetheria.State/AetheriaDocumentRegistry.cs +++ b/Aetheria.State/AetheriaDocumentRegistry.cs @@ -72,7 +72,6 @@ public static class AetheriaDocumentRegistry typeof(EveSurfaceDocument), typeof(EveSurfaceCommandRequest), typeof(EveCommandReceiptDocument), - typeof(EveAssetCatalogDocument), - typeof(EveProviderAdvertisementState) + typeof(EveAssetCatalogDocument) ]; } diff --git a/Aetheria.State/AetheriaEveCommandBridge.cs b/Aetheria.State/AetheriaEveCommandBridge.cs index 79d5df404..ba879a3b6 100644 --- a/Aetheria.State/AetheriaEveCommandBridge.cs +++ b/Aetheria.State/AetheriaEveCommandBridge.cs @@ -1,6 +1,7 @@ using Aetheria.State.Documents; using GameCult.Aetheria.State.Verse; using GameCult.Mesh; +using EveProviderAdvertisementDocument = GameCult.Eve.Surface.EveProviderAdvertisementDocument; using EveSurfaceDocument = GameCult.Eve.Surface.EveSurfaceDocument; namespace Aetheria.State; @@ -304,7 +305,7 @@ public static class AetheriaEveCommandBridge normalized, runtimeSession)) .ConfigureAwait(false); - await node.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey) + await node.MutableDocument(AetheriaStateNode.ProviderAdvertisementSurfaceKey) .ReplaceAsync(AetheriaEveSurfaceDocuments.BuildProviderAdvertisement(normalized, node.StatePath, command.IssuedAtUtc)) .ConfigureAwait(false); } diff --git a/Aetheria.State/AetheriaEveSurfaceDocuments.cs b/Aetheria.State/AetheriaEveSurfaceDocuments.cs index 4a9e42f8f..73d6e8274 100644 --- a/Aetheria.State/AetheriaEveSurfaceDocuments.cs +++ b/Aetheria.State/AetheriaEveSurfaceDocuments.cs @@ -5,10 +5,16 @@ using Aetheria.State.Documents; using GameCult.Aetheria.State.Verse; using GameCult.Mesh; using EveCommandTemplate = GameCult.Eve.Surface.EveCommandTemplate; +using EveAdvertisedCommand = GameCult.Eve.Surface.EveAdvertisedCommand; +using EveAdvertisedSurface = GameCult.Eve.Surface.EveAdvertisedSurface; +using EveProviderAdvertisementDocument = GameCult.Eve.Surface.EveProviderAdvertisementDocument; +using EveProviderFreshness = GameCult.Eve.Surface.EveProviderFreshness; +using EveProviderWitness = GameCult.Eve.Surface.EveProviderWitness; using EveStyleToken = GameCult.Eve.Surface.EveStyleToken; using EveSurfaceComponent = GameCult.Eve.Surface.EveSurfaceComponent; using EveSurfaceDocument = GameCult.Eve.Surface.EveSurfaceDocument; using EveSurfaceTree = GameCult.Eve.Surface.EveSurfaceTree; +using EveWorldInteractionAdvertisement = GameCult.Eve.Surface.EveWorldInteractionAdvertisement; namespace Aetheria.State; @@ -210,185 +216,119 @@ public static class AetheriaEveSurfaceDocuments return AetheriaRuntimeSurfaceDocuments.ToPortableSurface(surface); } - public static EveProviderAdvertisementState BuildProviderAdvertisement( + public static EveProviderAdvertisementDocument BuildProviderAdvertisement( AetheriaVerseHostSettings settings, string statePath, string updatedAtUtc) { var normalized = AetheriaVerseHostSettingsNormalizer.Normalize(settings); - return new EveProviderAdvertisementState + var schemas = new[] { - ProviderId = ProviderId, - ServiceId = normalized.ServiceId, - VerseId = normalized.VerseId, - RootVerse = normalized.RootVerse, - CanonicalService = normalized.CanonicalService, - LocatedService = normalized.LocatedService, - CultMeshAddress = normalized.CultMeshAddress, - Title = normalized.Title, - Kind = "game.runtime", - UpdatedAtUtc = updatedAtUtc, - Freshness = new EveProviderFreshness - { - State = "fresh", - LastSeenAtUtc = updatedAtUtc, - MaxAgeMs = 15000 - }, - Schemas = - [ - "aetheria.world_state.v1", - "aetheria.item_definition.v1", - "aetheria.corporation.v2", - "aetheria.name_file.v2", - "aetheria.trade_value_policy.v1", - "aetheria.player_settings.v1", - "aetheria.loadout_template.v1", - "aetheria.run_state.v1", - "aetheria.zone_state.v1", - "aetheria.entity_snapshot.v1", - "aetheria.verse_host_settings.v1", - "aetheria.runtime_session.v1", - "aetheria.eve_command_acceptance_status.v1", - "gamecult.eve.surface.v1", - "gamecult.eve.command.v1", - AetheriaRuntimeDaemonSchemas.ProviderAdvertisement, - AetheriaRuntimeDaemonSchemas.Frame, - AetheriaRuntimeDaemonSchemas.SoaView, - AetheriaRuntimeDaemonSchemas.Health, - AetheriaRuntimeDaemonSchemas.CommandBoundary, - AetheriaRuntimeDaemonSchemas.GameSurface, - AetheriaRuntimeDaemonSchemas.EditorSurface, - AetheriaRuntimeDaemonSchemas.Command - ], - Witnesses = - [ - new EveProviderWitness - { - Kind = "cultcache", - Ref = statePath, - Summary = "Aetheria typed CultCache state file" - }, - new EveProviderWitness - { - Kind = DaemonRecordTransport, - Ref = AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement.ToString(), - Summary = "Aetheria daemon-owned provider advertisement record" - }, - new EveProviderWitness - { - Kind = DaemonRecordTransport, - Ref = AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest.ToString(), - Summary = "Aetheria daemon latest simulation frame record" - }, - new EveProviderWitness - { - Kind = DaemonRecordTransport, - Ref = AetheriaRuntimeVerseRecordKeys.DaemonSoaViewLatest.ToString(), - Summary = "Aetheria daemon latest SoA view record for thin clients" - }, - new EveProviderWitness - { - Kind = DaemonRecordTransport, - Ref = AetheriaRuntimeVerseRecordKeys.DaemonHealth.ToString(), - Summary = "Aetheria daemon health record" - }, - new EveProviderWitness - { - Kind = DaemonRecordTransport, - Ref = AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary.ToString(), - Summary = "Aetheria daemon typed command boundary record" - }, - new EveProviderWitness - { - Kind = DaemonRecordTransport, - Ref = AetheriaRuntimeVerseRecordKeys.DaemonGameSurface.ToString(), - Summary = "Aetheria daemon game Eve GUI surface record" - }, - new EveProviderWitness - { - Kind = DaemonRecordTransport, - Ref = AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface.ToString(), - Summary = "Aetheria daemon game Eve TUI surface record" - }, - new EveProviderWitness - { - Kind = DaemonRecordTransport, - Ref = AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface.ToString(), - Summary = "Aetheria daemon editor Eve GUI surface record" - }, - new EveProviderWitness - { - Kind = DaemonRecordTransport, - Ref = AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface.ToString(), - Summary = "Aetheria daemon editor Eve TUI surface record" - } - ], - Surfaces = AetheriaRuntimeEveSurfaceCatalog.All - .Select(ToProviderSurfaceRef) - .ToArray(), - Commands = - [ - new EveProviderCommandRef - { - Command = DaemonCommandBoundaryId, - Transport = "cultmesh", - Summary = "Aetheria daemon typed command boundary" - }, - new EveProviderCommandRef - { - Command = AetheriaRuntimeCatalogCommands.Refresh, - Summary = "Refresh catalog state" - }, - new EveProviderCommandRef - { - Command = AetheriaRuntimeOperationsCommands.Refresh, - Summary = "Refresh operations state" - }, - new EveProviderCommandRef - { - Command = AetheriaRuntimePlayerSettingsCommands.Refresh, - Summary = "Refresh player settings state" - }, - new EveProviderCommandRef - { - Command = AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit, - Summary = "Cycle the typed player temperature unit" - }, - new EveProviderCommandRef - { - Command = AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits, - Summary = "Decrease typed player significant digits" - }, - new EveProviderCommandRef - { - Command = AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits, - Summary = "Increase typed player significant digits" - }, - new EveProviderCommandRef - { - Command = AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality, - Summary = "Cycle typed player nebula quality" - }, - new EveProviderCommandRef - { - Command = AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap, - Summary = "Toggle typed player minimap asteroid visibility" - } - ] + "aetheria.world_state.v1", + "aetheria.item_definition.v1", + "aetheria.corporation.v2", + "aetheria.name_file.v2", + "aetheria.trade_value_policy.v1", + "aetheria.player_settings.v1", + "aetheria.loadout_template.v1", + "aetheria.run_state.v1", + "aetheria.zone_state.v1", + "aetheria.entity_snapshot.v1", + "aetheria.verse_host_settings.v1", + "aetheria.runtime_session.v1", + "aetheria.eve_command_acceptance_status.v1", + EveSurfaceDocument.SchemaId, + AetheriaRuntimeEveCommandDocument.SchemaId, + AetheriaRuntimeDaemonSchemas.ProviderAdvertisement, + AetheriaRuntimeDaemonSchemas.Frame, + AetheriaRuntimeDaemonSchemas.SoaView, + AetheriaRuntimeDaemonSchemas.Health, + AetheriaRuntimeDaemonSchemas.CommandBoundary, + AetheriaRuntimeDaemonSchemas.GameSurface, + AetheriaRuntimeDaemonSchemas.EditorSurface, + AetheriaRuntimeDaemonSchemas.Command }; + var witnesses = new[] + { + Witness("cultcache", statePath, "Aetheria typed CultCache state file"), + Witness(DaemonRecordTransport, AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement.ToString(), + "Aetheria daemon-owned provider advertisement record"), + Witness(DaemonRecordTransport, AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest.ToString(), + "Aetheria daemon latest simulation frame record"), + Witness(DaemonRecordTransport, AetheriaRuntimeVerseRecordKeys.DaemonSoaViewLatest.ToString(), + "Aetheria daemon latest SoA view record for thin clients"), + Witness(DaemonRecordTransport, AetheriaRuntimeVerseRecordKeys.DaemonHealth.ToString(), + "Aetheria daemon health record"), + Witness(DaemonRecordTransport, AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary.ToString(), + "Aetheria daemon typed command boundary record"), + Witness(DaemonRecordTransport, AetheriaRuntimeVerseRecordKeys.DaemonGameSurface.ToString(), + "Aetheria daemon game Eve GUI surface record"), + Witness(DaemonRecordTransport, AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface.ToString(), + "Aetheria daemon game Eve TUI surface record"), + Witness(DaemonRecordTransport, AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface.ToString(), + "Aetheria daemon editor Eve GUI surface record"), + Witness(DaemonRecordTransport, AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface.ToString(), + "Aetheria daemon editor Eve TUI surface record") + }; + var commands = new[] + { + Command(DaemonCommandBoundaryId, "", "Aetheria daemon typed command boundary"), + Command(AetheriaRuntimeCatalogCommands.Refresh, AetheriaRuntimeCatalogCommands.SurfaceId, "Refresh catalog state"), + Command(AetheriaRuntimeOperationsCommands.Refresh, AetheriaRuntimeOperationsCommands.SurfaceId, "Refresh operations state"), + Command(AetheriaRuntimePlayerSettingsCommands.Refresh, AetheriaRuntimePlayerSettingsCommands.SurfaceId, "Refresh player settings state"), + Command(AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit, AetheriaRuntimePlayerSettingsCommands.SurfaceId, "Cycle the typed player temperature unit"), + Command(AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits, AetheriaRuntimePlayerSettingsCommands.SurfaceId, "Decrease typed player significant digits"), + Command(AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits, AetheriaRuntimePlayerSettingsCommands.SurfaceId, "Increase typed player significant digits"), + Command(AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality, AetheriaRuntimePlayerSettingsCommands.SurfaceId, "Cycle typed player nebula quality"), + Command(AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap, AetheriaRuntimePlayerSettingsCommands.SurfaceId, "Toggle typed player minimap asteroid visibility") + }; + + return new EveProviderAdvertisementDocument( + ProviderId, + normalized.ServiceId, + normalized.VerseId, + normalized.Title, + "game.runtime", + normalized.CultMeshAddress, + updatedAtUtc, + new EveProviderFreshness("fresh", updatedAtUtc, 15000), + schemas, + witnesses, + AetheriaRuntimeEveSurfaceCatalog.All.Select(ToProviderSurface).ToArray(), + commands); } - private static EveProviderSurfaceRef ToProviderSurfaceRef(AetheriaRuntimeEveSurfaceAdvertisement surface) + private static EveProviderWitness Witness(string kind, string reference, string summary) => + new(kind, reference, summary); + + private static EveAdvertisedCommand Command(string command, string surfaceId, string summary) => + new(command, surfaceId, "cultmesh", summary); + + private static EveAdvertisedSurface ToProviderSurface(AetheriaRuntimeEveSurfaceAdvertisement surface) { - return new EveProviderSurfaceRef - { - SurfaceId = surface.SurfaceId, - Key = surface.RecordRef, - Transport = surface.Transport, - Status = surface.Status - }; + var interaction = surface.WorldInteraction == null + ? null + : new EveWorldInteractionAdvertisement( + surface.WorldInteraction.ProjectionKind, + surface.WorldInteraction.StateSchemas, + surface.WorldInteraction.CommandBoundary, + AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary.ToString(), + surface.WorldInteraction.ReceiptSchema, + "", + "", + surface.WorldInteraction.LoweringTargets, + surface.WorldInteraction.Ownership); + return new EveAdvertisedSurface( + surface.SurfaceId, + EveSurfaceDocument.SchemaId, + surface.RecordRef, + surface.Transport, + surface.Status, + surface.SurfaceKind, + interaction); } + private static string LatestTimestamp(params string?[] timestamps) { var latest = ""; diff --git a/Aetheria.State/Documents/EveProviderAdvertisementState.cs b/Aetheria.State/Documents/EveProviderAdvertisementState.cs deleted file mode 100644 index f42cd1d1f..000000000 --- a/Aetheria.State/Documents/EveProviderAdvertisementState.cs +++ /dev/null @@ -1,118 +0,0 @@ -using GameCult.Caching; -using MessagePack; - -namespace Aetheria.State.Documents; - -[CultDocument("gamecult.eve.provider_advertisement", "gamecult.eve.provider_advertisement.v1")] -[CultGlobal] -[MessagePackObject] -public sealed class EveProviderAdvertisementState -{ - [Key(0)] - [CultIndex("schema")] - public string Schema { get; set; } = "gamecult.eve.provider_advertisement.v1"; - - [Key(1)] - [CultName] - public string ProviderId { get; set; } = ""; - - [Key(2)] - public string ServiceId { get; set; } = ""; - - [Key(3)] - public string VerseId { get; set; } = ""; - - [Key(4)] - public string RootVerse { get; set; } = "asgard"; - - [Key(5)] - public string CanonicalService { get; set; } = ""; - - [Key(6)] - public string LocatedService { get; set; } = ""; - - [Key(7)] - public string CultMeshAddress { get; set; } = ""; - - [Key(8)] - public string Title { get; set; } = ""; - - [Key(9)] - public string Kind { get; set; } = "game.runtime"; - - [Key(10)] - public string UpdatedAtUtc { get; set; } = ""; - - [Key(11)] - public EveProviderFreshness Freshness { get; set; } = new(); - - [Key(12)] - public string[] Schemas { get; set; } = []; - - [Key(13)] - public EveProviderWitness[] Witnesses { get; set; } = []; - - [Key(14)] - public EveProviderSurfaceRef[] Surfaces { get; set; } = []; - - [Key(15)] - public EveProviderCommandRef[] Commands { get; set; } = []; -} - -[MessagePackObject] -public sealed class EveProviderFreshness -{ - [Key(0)] - public string State { get; set; } = "fresh"; - - [Key(1)] - public string LastSeenAtUtc { get; set; } = ""; - - [Key(2)] - public int MaxAgeMs { get; set; } = 15000; -} - -[MessagePackObject] -public sealed class EveProviderWitness -{ - [Key(0)] - public string Kind { get; set; } = ""; - - [Key(1)] - public string Ref { get; set; } = ""; - - [Key(2)] - public string Summary { get; set; } = ""; -} - -[MessagePackObject] -public sealed class EveProviderSurfaceRef -{ - [Key(0)] - public string Schema { get; set; } = "gamecult.eve.surface.v1"; - - [Key(1)] - public string SurfaceId { get; set; } = ""; - - [Key(2)] - public string Key { get; set; } = ""; - - [Key(3)] - public string Transport { get; set; } = "cultmesh"; - - [Key(4)] - public string Status { get; set; } = "available"; -} - -[MessagePackObject] -public sealed class EveProviderCommandRef -{ - [Key(0)] - public string Command { get; set; } = ""; - - [Key(1)] - public string Transport { get; set; } = "cultmesh"; - - [Key(2)] - public string Summary { get; set; } = ""; -}