Make daemon verse host settings typed state
This commit is contained in:
parent
6de0141b33
commit
1bb80638f2
14 changed files with 466 additions and 24 deletions
|
|
@ -17,6 +17,7 @@ var evePendingBefore = CountPendingEveCommands(statePath);
|
|||
var now = DateTimeOffset.UtcNow.ToString("O");
|
||||
|
||||
await using var node = await AetheriaStateNode.OpenAsync(statePath, runtimeId);
|
||||
var verseHostSettings = await EnsureVerseHostSettingsAsync(node, now);
|
||||
await node.PutRuntimeSessionAsync(new AetheriaRuntimeSession
|
||||
{
|
||||
RuntimeId = runtimeId,
|
||||
|
|
@ -67,9 +68,15 @@ var completedSession = new AetheriaRuntimeSession
|
|||
Status = "completed"
|
||||
};
|
||||
await node.PutRuntimeSessionAsync(completedSession);
|
||||
await node.PutOperationsSurfaceAsync(AetheriaOperationsSurfaceProjector.Build(commitStatus, eveStatus, completedSession));
|
||||
await node.PutOperationsSurfaceAsync(
|
||||
AetheriaOperationsSurfaceProjector.Build(
|
||||
commitStatus,
|
||||
eveStatus,
|
||||
verseHostSettings,
|
||||
completedSession));
|
||||
await PublishPlayerSettingsSurfaceAsync(node, now);
|
||||
await node.PutProviderAdvertisementAsync(AetheriaProviderAdvertisementProjector.Build(statePath, now));
|
||||
await node.PutProviderAdvertisementAsync(
|
||||
AetheriaProviderAdvertisementProjector.Build(verseHostSettings, statePath, now));
|
||||
await node.FlushAsync();
|
||||
|
||||
Console.WriteLine($"Applied pending Aetheria runtime commits: {statePath}");
|
||||
|
|
@ -110,3 +117,16 @@ static async Task PublishPlayerSettingsSurfaceAsync(AetheriaStateNode node, stri
|
|||
await node.PutPlayerSettingsSurfaceAsync(
|
||||
AetheriaPlayerSettingsSurfaceProjector.Build(settings, publishedAtUtc)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
static async Task<AetheriaVerseHostSettings> EnsureVerseHostSettingsAsync(AetheriaStateNode node, string now)
|
||||
{
|
||||
var existing = await node.GetVerseHostSettingsAsync().ConfigureAwait(false);
|
||||
var normalized = AetheriaVerseHostSettingsNormalizer.Normalize(existing);
|
||||
if (existing == null || string.IsNullOrWhiteSpace(existing.LastUpdatedAtUtc))
|
||||
{
|
||||
normalized.LastUpdatedAtUtc = now;
|
||||
await node.PutVerseHostSettingsAsync(normalized).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,8 +105,15 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s
|
|||
Status = "ok"
|
||||
};
|
||||
await node.PutRuntimeCommitDrainStatusAsync(drainStatus);
|
||||
await node.PutOperationsSurfaceAsync(AetheriaOperationsSurfaceProjector.Build(drainStatus));
|
||||
await node.PutProviderAdvertisementAsync(AetheriaProviderAdvertisementProjector.Build(statePath, now));
|
||||
var verseHostSettings = AetheriaVerseHostSettingsNormalizer.Normalize(new AetheriaVerseHostSettings
|
||||
{
|
||||
LastUpdatedAtUtc = now
|
||||
});
|
||||
await node.PutVerseHostSettingsAsync(verseHostSettings);
|
||||
await node.PutOperationsSurfaceAsync(
|
||||
AetheriaOperationsSurfaceProjector.Build(drainStatus, verseHostSettings: verseHostSettings));
|
||||
await node.PutProviderAdvertisementAsync(
|
||||
AetheriaProviderAdvertisementProjector.Build(verseHostSettings, statePath, now));
|
||||
await node.PutRuntimeSessionAsync(new AetheriaRuntimeSession
|
||||
{
|
||||
RuntimeId = "smoke-runtime",
|
||||
|
|
@ -117,6 +124,7 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s
|
|||
});
|
||||
await node.PutOperationsSurfaceAsync(AetheriaOperationsSurfaceProjector.Build(
|
||||
drainStatus,
|
||||
verseHostSettings: verseHostSettings,
|
||||
runtimeSession: await node.GetRuntimeSessionAsync("smoke-runtime")));
|
||||
|
||||
await node.PutLoadoutTemplateAsync(loadoutKey, new AetheriaLoadoutTemplate
|
||||
|
|
@ -537,7 +545,8 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s
|
|||
await node.PutOperationsSurfaceAsync(AetheriaOperationsSurfaceProjector.Build(
|
||||
drainStatus,
|
||||
eveCommandStatus,
|
||||
await node.GetRuntimeSessionAsync("smoke-runtime")));
|
||||
verseHostSettings: await node.GetVerseHostSettingsAsync(),
|
||||
runtimeSession: await node.GetRuntimeSessionAsync("smoke-runtime")));
|
||||
|
||||
await node.FlushAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ RequireTradeItemDetailsUseEveSurface(root);
|
|||
RequireInventoryDropdownUseEveSurface(root);
|
||||
RequireNoDeadPopupShells(root);
|
||||
RequirePlayerSettingsEveSurface(root);
|
||||
RequireVerseHostSettingsAuthority(root);
|
||||
RequireMainMenuContinueRunState(root);
|
||||
RequireDeadPropertiesPanelShellDeleted(root);
|
||||
RequireTypedBehaviorMetadataCoverage(root);
|
||||
|
|
@ -529,6 +530,7 @@ Console.WriteLine("Main-menu Continue authority: Continue selects typed run stat
|
|||
Console.WriteLine("Generic popup inspector shell: PropertiesPanel, PropertiesList, and DropdownMenu are deleted from source and serialized assets");
|
||||
Console.WriteLine("Typed behavior metadata authority: live heat/mining/thermotoggle payload kinds stay owned by package metadata");
|
||||
Console.WriteLine("NameTools editor shell: the remaining name helper window lowers through UI Toolkit instead of IMGUI");
|
||||
Console.WriteLine("Verse host authority: daemon-owned typed verse host settings now drive provider advertisement and operations telemetry");
|
||||
Console.WriteLine("Runtime simulation tuning authority: UI writes flow through gameplay checkpoint commits");
|
||||
Console.WriteLine("Hull conductivity authority: inventory UI toggles flow through gameplay checkpoint commits");
|
||||
Console.WriteLine("Inventory entity rename authority: UI rename flows through gameplay checkpoint commits");
|
||||
|
|
@ -3532,6 +3534,169 @@ static void RequirePlayerSettingsEveSurface(string root)
|
|||
}
|
||||
}
|
||||
|
||||
static void RequireVerseHostSettingsAuthority(string root)
|
||||
{
|
||||
var settingsPath = Path.Combine(root, "Aetheria.State", "Documents", "AetheriaVerseHostSettings.cs");
|
||||
var normalizerPath = Path.Combine(root, "Aetheria.State", "AetheriaVerseHostSettingsNormalizer.cs");
|
||||
var registryPath = Path.Combine(root, "Aetheria.State", "AetheriaDocumentRegistry.cs");
|
||||
var nodePath = Path.Combine(root, "Aetheria.State", "AetheriaStateNode.cs");
|
||||
var providerPath = Path.Combine(root, "Aetheria.State", "AetheriaProviderAdvertisementProjector.cs");
|
||||
var operationsPath = Path.Combine(root, "Aetheria.State", "AetheriaOperationsSurfaceProjector.cs");
|
||||
var serverPath = Path.Combine(root, "Economy.Server", "Program.cs");
|
||||
var serverSettingsPath = Path.Combine(root, "Economy.Server", "appsettings.json");
|
||||
var applyPendingPath = Path.Combine(root, "Aetheria.State.ApplyPending", "Program.cs");
|
||||
|
||||
var requiredFiles = new[]
|
||||
{
|
||||
settingsPath,
|
||||
normalizerPath,
|
||||
registryPath,
|
||||
nodePath,
|
||||
providerPath,
|
||||
operationsPath,
|
||||
serverPath,
|
||||
serverSettingsPath,
|
||||
applyPendingPath
|
||||
};
|
||||
|
||||
var missingFiles = requiredFiles
|
||||
.Where(path => !File.Exists(path))
|
||||
.Select(path => Path.GetRelativePath(root, path))
|
||||
.ToArray();
|
||||
if (missingFiles.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Verse host authority cut is incomplete; missing files: " + string.Join(", ", missingFiles));
|
||||
}
|
||||
|
||||
var settings = File.ReadAllText(settingsPath);
|
||||
var normalizer = File.ReadAllText(normalizerPath);
|
||||
var registry = File.ReadAllText(registryPath);
|
||||
var node = File.ReadAllText(nodePath);
|
||||
var provider = File.ReadAllText(providerPath);
|
||||
var operations = File.ReadAllText(operationsPath);
|
||||
var server = File.ReadAllText(serverPath);
|
||||
var serverSettings = File.ReadAllText(serverSettingsPath);
|
||||
var applyPending = File.ReadAllText(applyPendingPath);
|
||||
|
||||
var requiredSettingsSymbols = new[]
|
||||
{
|
||||
"[CultDocument(\"aetheria.verse_host_settings\", \"aetheria.verse_host_settings.v1\")]",
|
||||
"public sealed class AetheriaVerseHostSettings",
|
||||
"public string VerseId",
|
||||
"public string CultMeshAddress",
|
||||
"public string Visibility"
|
||||
};
|
||||
var missingSettingsSymbols = requiredSettingsSymbols
|
||||
.Where(symbol => !settings.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (missingSettingsSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Typed verse-host settings document is missing required authority fields: " +
|
||||
string.Join(", ", missingSettingsSymbols));
|
||||
}
|
||||
|
||||
if (!normalizer.Contains("public static AetheriaVerseHostSettings Normalize", StringComparison.Ordinal) ||
|
||||
!normalizer.Contains("public static bool Equivalent", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Verse-host settings normalizer is missing normalize/equivalence ownership.");
|
||||
}
|
||||
|
||||
if (!registry.Contains("CultNetDocumentBinding.ForDocument<AetheriaVerseHostSettings>", StringComparison.Ordinal) ||
|
||||
!registry.Contains("typeof(AetheriaVerseHostSettings)", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Aetheria document registry does not register typed verse-host settings.");
|
||||
}
|
||||
|
||||
if (!node.Contains("PutVerseHostSettingsAsync", StringComparison.Ordinal) ||
|
||||
!node.Contains("GetVerseHostSettingsAsync", StringComparison.Ordinal) ||
|
||||
!node.Contains("global:aetheria.verse_host_settings.v1", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Aetheria state node does not expose typed verse-host settings get/put ports.");
|
||||
}
|
||||
|
||||
var forbiddenHardcodedProviderSymbols = new[]
|
||||
{
|
||||
"VerseId = \"aetheria.local\"",
|
||||
"RootVerse = \"asgard\"",
|
||||
"CanonicalService = \"asgard.aetheria\"",
|
||||
"LocatedService = \"asgard.local.aetheria\"",
|
||||
"CultMeshAddress = \"asgard.local.aetheria/eve\""
|
||||
};
|
||||
var survivingHardcodedProviderSymbols = forbiddenHardcodedProviderSymbols
|
||||
.Where(symbol => provider.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (survivingHardcodedProviderSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Provider advertisement still hardcodes daemon verse identity: " +
|
||||
string.Join(", ", survivingHardcodedProviderSymbols));
|
||||
}
|
||||
|
||||
if (!provider.Contains("AetheriaVerseHostSettings settings", StringComparison.Ordinal) ||
|
||||
!provider.Contains("AetheriaVerseHostSettingsNormalizer.Normalize(settings)", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Provider advertisement no longer derives Verse identity from typed daemon settings.");
|
||||
}
|
||||
|
||||
if (!operations.Contains("AetheriaVerseHostSettings? verseHostSettings = null", StringComparison.Ordinal) ||
|
||||
!operations.Contains("AetheriaVerseHostSettingsNormalizer.Normalize(verseHostSettings)", StringComparison.Ordinal) ||
|
||||
!operations.Contains("\"aetheria.operations.verseHost\"", StringComparison.Ordinal) ||
|
||||
!operations.Contains("Metric(\"verseHost.visibility\"", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Operations surface does not expose the typed daemon Verse-host telemetry card.");
|
||||
}
|
||||
|
||||
var requiredServerSymbols = new[]
|
||||
{
|
||||
"EnsureVerseHostSettingsAsync",
|
||||
"LoadVerseHostOverrides",
|
||||
"GetVerseHostSettingsAsync",
|
||||
"PutVerseHostSettingsAsync",
|
||||
"AetheriaProviderAdvertisementProjector.Build(verseHostSettings, node.StatePath, updatedAtUtc)"
|
||||
};
|
||||
var missingServerSymbols = requiredServerSymbols
|
||||
.Where(symbol => !server.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (missingServerSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Economy.Server is missing typed verse-host startup authority: " +
|
||||
string.Join(", ", missingServerSymbols));
|
||||
}
|
||||
|
||||
var requiredServerSettingsSymbols = new[]
|
||||
{
|
||||
"\"Aetheria\"",
|
||||
"\"VerseHost\"",
|
||||
"\"VerseId\"",
|
||||
"\"CultMeshAddress\"",
|
||||
"\"Visibility\""
|
||||
};
|
||||
var missingServerSettingsSymbols = requiredServerSettingsSymbols
|
||||
.Where(symbol => !serverSettings.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (missingServerSettingsSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Economy.Server appsettings are missing the daemon Verse-host section: " +
|
||||
string.Join(", ", missingServerSettingsSymbols));
|
||||
}
|
||||
|
||||
if (!applyPending.Contains("EnsureVerseHostSettingsAsync", StringComparison.Ordinal) ||
|
||||
!applyPending.Contains("AetheriaProviderAdvertisementProjector.Build(verseHostSettings, statePath, now)", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Aetheria.State.ApplyPending does not preserve typed verse-host projection authority.");
|
||||
}
|
||||
}
|
||||
|
||||
static void RequireMainMenuContinueRunState(string root)
|
||||
{
|
||||
var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs");
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public static class AetheriaDocumentRegistry
|
|||
CultNetDocumentBinding.ForDocument<AetheriaRunState>(registry),
|
||||
CultNetDocumentBinding.ForDocument<AetheriaZoneState>(registry),
|
||||
CultNetDocumentBinding.ForDocument<AetheriaEntitySnapshot>(registry),
|
||||
CultNetDocumentBinding.ForDocument<AetheriaVerseHostSettings>(registry),
|
||||
CultNetDocumentBinding.ForDocument<AetheriaRuntimeCommitDrainStatus>(registry),
|
||||
CultNetDocumentBinding.ForDocument<AetheriaEveCommandDrainStatus>(registry),
|
||||
CultNetDocumentBinding.ForDocument<EveSurfaceState>(registry),
|
||||
|
|
@ -59,6 +60,7 @@ public static class AetheriaDocumentRegistry
|
|||
typeof(AetheriaRunState),
|
||||
typeof(AetheriaZoneState),
|
||||
typeof(AetheriaEntitySnapshot),
|
||||
typeof(AetheriaVerseHostSettings),
|
||||
typeof(AetheriaRuntimeCommitDrainStatus),
|
||||
typeof(AetheriaEveCommandDrainStatus),
|
||||
typeof(EveSurfaceState),
|
||||
|
|
|
|||
|
|
@ -63,8 +63,16 @@ public static class AetheriaEveCommandBridge
|
|||
EmptyCommitDrainStatus(node.StatePath, command.IssuedAtUtc);
|
||||
var eveStatus = await node.GetEveCommandDrainStatusAsync().ConfigureAwait(false) ??
|
||||
EmptyEveCommandDrainStatus(node.StatePath, command.IssuedAtUtc);
|
||||
var verseHostSettings = await node.GetVerseHostSettingsAsync().ConfigureAwait(false);
|
||||
var runtimeSession = string.IsNullOrWhiteSpace(commitStatus.RuntimeId)
|
||||
? null
|
||||
: await node.GetRuntimeSessionAsync(commitStatus.RuntimeId).ConfigureAwait(false);
|
||||
await node.PutOperationsSurfaceAsync(
|
||||
AetheriaOperationsSurfaceProjector.Build(commitStatus, eveStatus)).ConfigureAwait(false);
|
||||
AetheriaOperationsSurfaceProjector.Build(
|
||||
commitStatus,
|
||||
eveStatus,
|
||||
verseHostSettings,
|
||||
runtimeSession)).ConfigureAwait(false);
|
||||
report.AppliedOperationsRefreshes++;
|
||||
break;
|
||||
case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.Refresh:
|
||||
|
|
|
|||
|
|
@ -10,12 +10,15 @@ public static class AetheriaOperationsSurfaceProjector
|
|||
public static EveSurfaceState Build(
|
||||
AetheriaRuntimeCommitDrainStatus drainStatus,
|
||||
AetheriaEveCommandDrainStatus? eveCommandStatus = null,
|
||||
AetheriaVerseHostSettings? verseHostSettings = null,
|
||||
AetheriaRuntimeSession? runtimeSession = null,
|
||||
long version = 1)
|
||||
{
|
||||
var normalizedVerseHost = AetheriaVerseHostSettingsNormalizer.Normalize(verseHostSettings);
|
||||
var updatedAtUtc = LatestTimestamp(
|
||||
drainStatus.LastPollAtUtc,
|
||||
eveCommandStatus?.LastPollAtUtc,
|
||||
normalizedVerseHost.LastUpdatedAtUtc,
|
||||
runtimeSession?.LastSeenAtUtc);
|
||||
return new EveSurfaceState
|
||||
{
|
||||
|
|
@ -68,6 +71,19 @@ public static class AetheriaOperationsSurfaceProjector
|
|||
("lastRejected", eveCommandStatus?.LastRejectedCommand ?? ""),
|
||||
("rejectedReason", eveCommandStatus?.LastRejectedReason ?? ""),
|
||||
("error", eveCommandStatus?.LastError ?? ""))),
|
||||
Node(
|
||||
"aetheria.operations.verseHost",
|
||||
"card",
|
||||
[("title", "Verse Host")],
|
||||
Metric("verseHost.visibility", "Visibility", normalizedVerseHost.Visibility),
|
||||
Metric("verseHost.service", "Service", normalizedVerseHost.ServiceId),
|
||||
Metric("verseHost.verse", "Verse", normalizedVerseHost.VerseId),
|
||||
Row(
|
||||
"verseHost.identity",
|
||||
("rootVerse", normalizedVerseHost.RootVerse),
|
||||
("canonicalService", normalizedVerseHost.CanonicalService),
|
||||
("locatedService", normalizedVerseHost.LocatedService),
|
||||
("cultMeshAddress", normalizedVerseHost.CultMeshAddress))),
|
||||
Node(
|
||||
"aetheria.operations.runtimeSession",
|
||||
"card",
|
||||
|
|
|
|||
|
|
@ -7,18 +7,22 @@ public static class AetheriaProviderAdvertisementProjector
|
|||
public const string AdvertisementKey = "eve:provider:aetheria";
|
||||
public const string ProviderId = "aetheria";
|
||||
|
||||
public static EveProviderAdvertisementState Build(string statePath, string updatedAtUtc)
|
||||
public static EveProviderAdvertisementState Build(
|
||||
AetheriaVerseHostSettings settings,
|
||||
string statePath,
|
||||
string updatedAtUtc)
|
||||
{
|
||||
var normalized = AetheriaVerseHostSettingsNormalizer.Normalize(settings);
|
||||
return new EveProviderAdvertisementState
|
||||
{
|
||||
ProviderId = ProviderId,
|
||||
ServiceId = "aetheria.runtime",
|
||||
VerseId = "aetheria.local",
|
||||
RootVerse = "asgard",
|
||||
CanonicalService = "asgard.aetheria",
|
||||
LocatedService = "asgard.local.aetheria",
|
||||
CultMeshAddress = "asgard.local.aetheria/eve",
|
||||
Title = "Aetheria",
|
||||
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
|
||||
|
|
@ -38,6 +42,7 @@ public static class AetheriaProviderAdvertisementProjector
|
|||
"aetheria.run_state.v1",
|
||||
"aetheria.zone_state.v1",
|
||||
"aetheria.entity_snapshot.v1",
|
||||
"aetheria.verse_host_settings.v1",
|
||||
"aetheria.runtime_session.v1",
|
||||
"aetheria.runtime_commit_drain_status.v1",
|
||||
"aetheria.eve_command_drain_status.v1",
|
||||
|
|
|
|||
|
|
@ -270,6 +270,18 @@ public sealed class AetheriaStateNode : IAsyncDisposable, IDisposable
|
|||
return Database.GetAsync<AetheriaEntitySnapshot>(key);
|
||||
}
|
||||
|
||||
public Task<CultRecordHandle<AetheriaVerseHostSettings>> PutVerseHostSettingsAsync(
|
||||
AetheriaVerseHostSettings settings)
|
||||
{
|
||||
return Database.PutAsync(new CultRecordKey("global:aetheria.verse_host_settings.v1"), settings);
|
||||
}
|
||||
|
||||
public Task<AetheriaVerseHostSettings?> GetVerseHostSettingsAsync()
|
||||
{
|
||||
return Database.GetAsync<AetheriaVerseHostSettings>(
|
||||
new CultRecordKey("global:aetheria.verse_host_settings.v1"));
|
||||
}
|
||||
|
||||
public Task<CultRecordHandle<AetheriaRuntimeCommitDrainStatus>> PutRuntimeCommitDrainStatusAsync(
|
||||
AetheriaRuntimeCommitDrainStatus status)
|
||||
{
|
||||
|
|
|
|||
44
Aetheria.State/AetheriaVerseHostSettingsNormalizer.cs
Normal file
44
Aetheria.State/AetheriaVerseHostSettingsNormalizer.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using Aetheria.State.Documents;
|
||||
|
||||
namespace Aetheria.State;
|
||||
|
||||
public static class AetheriaVerseHostSettingsNormalizer
|
||||
{
|
||||
public static AetheriaVerseHostSettings Normalize(AetheriaVerseHostSettings? settings)
|
||||
{
|
||||
return new AetheriaVerseHostSettings
|
||||
{
|
||||
Schema = NormalizeOrDefault(settings?.Schema, "aetheria.verse_host_settings.v1"),
|
||||
ServiceId = NormalizeOrDefault(settings?.ServiceId, "aetheria.runtime"),
|
||||
VerseId = NormalizeOrDefault(settings?.VerseId, "aetheria.local"),
|
||||
RootVerse = NormalizeOrDefault(settings?.RootVerse, "asgard"),
|
||||
CanonicalService = NormalizeOrDefault(settings?.CanonicalService, "asgard.aetheria"),
|
||||
LocatedService = NormalizeOrDefault(settings?.LocatedService, "asgard.local.aetheria"),
|
||||
CultMeshAddress = NormalizeOrDefault(settings?.CultMeshAddress, "asgard.local.aetheria/eve"),
|
||||
Title = NormalizeOrDefault(settings?.Title, "Aetheria"),
|
||||
Visibility = NormalizeOrDefault(settings?.Visibility, "private"),
|
||||
LastUpdatedAtUtc = settings?.LastUpdatedAtUtc?.Trim() ?? ""
|
||||
};
|
||||
}
|
||||
|
||||
public static bool Equivalent(AetheriaVerseHostSettings? left, AetheriaVerseHostSettings? right)
|
||||
{
|
||||
var normalizedLeft = Normalize(left);
|
||||
var normalizedRight = Normalize(right);
|
||||
return string.Equals(normalizedLeft.Schema, normalizedRight.Schema, StringComparison.Ordinal) &&
|
||||
string.Equals(normalizedLeft.ServiceId, normalizedRight.ServiceId, StringComparison.Ordinal) &&
|
||||
string.Equals(normalizedLeft.VerseId, normalizedRight.VerseId, StringComparison.Ordinal) &&
|
||||
string.Equals(normalizedLeft.RootVerse, normalizedRight.RootVerse, StringComparison.Ordinal) &&
|
||||
string.Equals(normalizedLeft.CanonicalService, normalizedRight.CanonicalService, StringComparison.Ordinal) &&
|
||||
string.Equals(normalizedLeft.LocatedService, normalizedRight.LocatedService, StringComparison.Ordinal) &&
|
||||
string.Equals(normalizedLeft.CultMeshAddress, normalizedRight.CultMeshAddress, StringComparison.Ordinal) &&
|
||||
string.Equals(normalizedLeft.Title, normalizedRight.Title, StringComparison.Ordinal) &&
|
||||
string.Equals(normalizedLeft.Visibility, normalizedRight.Visibility, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private static string NormalizeOrDefault(string? value, string fallback)
|
||||
{
|
||||
var trimmed = value?.Trim();
|
||||
return string.IsNullOrWhiteSpace(trimmed) ? fallback : trimmed;
|
||||
}
|
||||
}
|
||||
21
Aetheria.State/Documents/AetheriaVerseHostSettings.cs
Normal file
21
Aetheria.State/Documents/AetheriaVerseHostSettings.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using GameCult.Caching;
|
||||
using MessagePack;
|
||||
|
||||
namespace Aetheria.State.Documents;
|
||||
|
||||
[CultDocument("aetheria.verse_host_settings", "aetheria.verse_host_settings.v1")]
|
||||
[CultGlobal]
|
||||
[MessagePackObject]
|
||||
public sealed class AetheriaVerseHostSettings
|
||||
{
|
||||
[Key(0)] public string Schema { get; set; } = "aetheria.verse_host_settings.v1";
|
||||
[Key(1)] public string ServiceId { get; set; } = "aetheria.runtime";
|
||||
[Key(2)] public string VerseId { get; set; } = "aetheria.local";
|
||||
[Key(3)] public string RootVerse { get; set; } = "asgard";
|
||||
[Key(4)] public string CanonicalService { get; set; } = "asgard.aetheria";
|
||||
[Key(5)] public string LocatedService { get; set; } = "asgard.local.aetheria";
|
||||
[Key(6)] public string CultMeshAddress { get; set; } = "asgard.local.aetheria/eve";
|
||||
[Key(7)] public string Title { get; set; } = "Aetheria";
|
||||
[Key(8)] public string Visibility { get; set; } = "private";
|
||||
[Key(9)] public string LastUpdatedAtUtc { get; set; } = "";
|
||||
}
|
||||
|
|
@ -389,15 +389,19 @@ The server publishes `AetheriaRuntimeCommitDrainStatus`,
|
|||
typed `aetheria.player_settings` Eve surface after drain attempts, so pending
|
||||
depth, accepted/applied/rejected counts, failures, timestamps, and player
|
||||
settings controls are typed state rather than console-only status. It also
|
||||
publishes `gamecult.eve.provider_advertisement.v1` for the `aetheria` provider,
|
||||
advertising the catalog, operations, and player-settings surfaces plus the
|
||||
typed schemas witnessed by the local `.cc` state file.
|
||||
persists daemon-owned `aetheria.verse_host_settings.v1`, with boot-time
|
||||
defaults or overrides for service id, Verse id, visibility, and CultMesh
|
||||
address. The operations surface and provider advertisement project from that
|
||||
typed host document instead of hardcoded daemon identity strings. The provider
|
||||
advertisement still publishes `gamecult.eve.provider_advertisement.v1` for the
|
||||
`aetheria` provider, advertising the catalog, operations, and player-settings
|
||||
surfaces plus the typed schemas witnessed by the local `.cc` state file.
|
||||
|
||||
`Aetheria.State.ApplyPending` is the smaller local operator applicator for
|
||||
queued Unity runtime commits and Eve commands when the server host is not being
|
||||
used. It also republishes the typed drain status, operations surface,
|
||||
player-settings surface, and provider advertisement after applying pending
|
||||
files:
|
||||
player-settings surface, typed `aetheria.verse_host_settings.v1`, and provider
|
||||
advertisement after applying pending files:
|
||||
|
||||
```powershell
|
||||
dotnet run --project .\Aetheria.State.ApplyPending\Aetheria.State.ApplyPending.csproj -- .
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System.Text.Json;
|
||||
using Aetheria.State;
|
||||
using Aetheria.State.Documents;
|
||||
|
||||
|
|
@ -17,6 +18,7 @@ internal static class Program
|
|||
runtimeId: RuntimeId,
|
||||
startServer: true).ConfigureAwait(false);
|
||||
|
||||
await EnsureVerseHostSettingsAsync(node).ConfigureAwait(false);
|
||||
var startedAtUtc = DateTimeOffset.UtcNow.ToString("O");
|
||||
await PublishRuntimeSessionAsync(node, startedAtUtc, "starting").ConfigureAwait(false);
|
||||
await EnsureWorldDocumentAsync(node).ConfigureAwait(false);
|
||||
|
|
@ -218,12 +220,20 @@ internal static class Program
|
|||
Status = "idle"
|
||||
};
|
||||
var eveStatus = await node.GetEveCommandDrainStatusAsync().ConfigureAwait(false);
|
||||
var verseHostSettings = await node.GetVerseHostSettingsAsync().ConfigureAwait(false) ??
|
||||
new AetheriaVerseHostSettings();
|
||||
var runtimeSession = await node.GetRuntimeSessionAsync(RuntimeId).ConfigureAwait(false);
|
||||
await node.PutOperationsSurfaceAsync(AetheriaOperationsSurfaceProjector.Build(commitStatus, eveStatus, runtimeSession))
|
||||
await node.PutOperationsSurfaceAsync(
|
||||
AetheriaOperationsSurfaceProjector.Build(
|
||||
commitStatus,
|
||||
eveStatus,
|
||||
verseHostSettings,
|
||||
runtimeSession))
|
||||
.ConfigureAwait(false);
|
||||
await PublishPlayerSettingsSurfaceAsync(node, updatedAtUtc).ConfigureAwait(false);
|
||||
await node.PutProviderAdvertisementAsync(
|
||||
AetheriaProviderAdvertisementProjector.Build(node.StatePath, updatedAtUtc)).ConfigureAwait(false);
|
||||
AetheriaProviderAdvertisementProjector.Build(verseHostSettings, node.StatePath, updatedAtUtc))
|
||||
.ConfigureAwait(false);
|
||||
await node.FlushAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
|
@ -316,4 +326,109 @@ internal static class Program
|
|||
{
|
||||
return args.Any(arg => string.Equals(arg, flag, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
private static async Task EnsureVerseHostSettingsAsync(AetheriaStateNode node)
|
||||
{
|
||||
var existing = await node.GetVerseHostSettingsAsync().ConfigureAwait(false);
|
||||
var candidate = AetheriaVerseHostSettingsNormalizer.Normalize(existing);
|
||||
ApplyVerseHostOverrides(candidate, LoadVerseHostOverrides());
|
||||
|
||||
if (existing == null ||
|
||||
string.IsNullOrWhiteSpace(existing.LastUpdatedAtUtc) ||
|
||||
!AetheriaVerseHostSettingsNormalizer.Equivalent(existing, candidate))
|
||||
{
|
||||
candidate.LastUpdatedAtUtc = DateTimeOffset.UtcNow.ToString("O");
|
||||
await node.PutVerseHostSettingsAsync(candidate).ConfigureAwait(false);
|
||||
await node.FlushAsync().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static VerseHostOverrides LoadVerseHostOverrides()
|
||||
{
|
||||
var candidatePaths = new[]
|
||||
{
|
||||
Path.Combine(AppContext.BaseDirectory, "appsettings.json"),
|
||||
Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "Economy.Server", "appsettings.json"))
|
||||
};
|
||||
|
||||
var settingsPath = candidatePaths.FirstOrDefault(File.Exists);
|
||||
if (string.IsNullOrWhiteSpace(settingsPath))
|
||||
{
|
||||
return new VerseHostOverrides();
|
||||
}
|
||||
|
||||
using var document = JsonDocument.Parse(File.ReadAllText(settingsPath));
|
||||
if (!TryGetPropertyIgnoreCase(document.RootElement, "Aetheria", out var aetheriaSection) ||
|
||||
!TryGetPropertyIgnoreCase(aetheriaSection, "VerseHost", out var verseHostSection))
|
||||
{
|
||||
return new VerseHostOverrides();
|
||||
}
|
||||
|
||||
return new VerseHostOverrides
|
||||
{
|
||||
ServiceId = ReadOptionalString(verseHostSection, "ServiceId"),
|
||||
VerseId = ReadOptionalString(verseHostSection, "VerseId"),
|
||||
RootVerse = ReadOptionalString(verseHostSection, "RootVerse"),
|
||||
CanonicalService = ReadOptionalString(verseHostSection, "CanonicalService"),
|
||||
LocatedService = ReadOptionalString(verseHostSection, "LocatedService"),
|
||||
CultMeshAddress = ReadOptionalString(verseHostSection, "CultMeshAddress"),
|
||||
Title = ReadOptionalString(verseHostSection, "Title"),
|
||||
Visibility = ReadOptionalString(verseHostSection, "Visibility")
|
||||
};
|
||||
}
|
||||
|
||||
private static void ApplyVerseHostOverrides(AetheriaVerseHostSettings settings, VerseHostOverrides overrides)
|
||||
{
|
||||
settings.ServiceId = ChooseOverride(overrides.ServiceId, settings.ServiceId);
|
||||
settings.VerseId = ChooseOverride(overrides.VerseId, settings.VerseId);
|
||||
settings.RootVerse = ChooseOverride(overrides.RootVerse, settings.RootVerse);
|
||||
settings.CanonicalService = ChooseOverride(overrides.CanonicalService, settings.CanonicalService);
|
||||
settings.LocatedService = ChooseOverride(overrides.LocatedService, settings.LocatedService);
|
||||
settings.CultMeshAddress = ChooseOverride(overrides.CultMeshAddress, settings.CultMeshAddress);
|
||||
settings.Title = ChooseOverride(overrides.Title, settings.Title);
|
||||
settings.Visibility = ChooseOverride(overrides.Visibility, settings.Visibility);
|
||||
}
|
||||
|
||||
private static string ChooseOverride(string? candidate, string fallback)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(candidate) ? fallback : candidate.Trim();
|
||||
}
|
||||
|
||||
private static string ReadOptionalString(JsonElement element, string propertyName)
|
||||
{
|
||||
if (!TryGetPropertyIgnoreCase(element, propertyName, out var value) ||
|
||||
value.ValueKind != JsonValueKind.String)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return value.GetString()?.Trim() ?? "";
|
||||
}
|
||||
|
||||
private static bool TryGetPropertyIgnoreCase(JsonElement element, string propertyName, out JsonElement value)
|
||||
{
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (string.Equals(property.Name, propertyName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
value = property.Value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
value = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
private sealed class VerseHostOverrides
|
||||
{
|
||||
public string ServiceId { get; init; } = "";
|
||||
public string VerseId { get; init; } = "";
|
||||
public string RootVerse { get; init; } = "";
|
||||
public string CanonicalService { get; init; } = "";
|
||||
public string LocatedService { get; init; } = "";
|
||||
public string CultMeshAddress { get; init; } = "";
|
||||
public string Title { get; init; } = "";
|
||||
public string Visibility { get; init; } = "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,16 @@
|
|||
{
|
||||
"Aetheria": {
|
||||
"VerseHost": {
|
||||
"ServiceId": "aetheria.runtime",
|
||||
"VerseId": "aetheria.local",
|
||||
"RootVerse": "asgard",
|
||||
"CanonicalService": "asgard.aetheria",
|
||||
"LocatedService": "asgard.local.aetheria",
|
||||
"CultMeshAddress": "asgard.local.aetheria/eve",
|
||||
"Title": "Aetheria",
|
||||
"Visibility": "private"
|
||||
}
|
||||
},
|
||||
"MagicOnion": {
|
||||
"ServerPorts": [
|
||||
{
|
||||
|
|
@ -15,4 +27,4 @@
|
|||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -516,6 +516,11 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
- `AetheriaRuntimeCommitDrainStatus` and the `aetheria.operations` Eve surface
|
||||
publish pending-drain health, pending depth, applied counts, failures, and
|
||||
timestamps as typed state. Console logs are notification-only.
|
||||
- Daemon Verse/service identity now lives in typed
|
||||
`aetheria.verse_host_settings.v1`, owned by the Aetheria daemon. Provider
|
||||
advertisement and operations telemetry project from that document, so public
|
||||
or private Verse exposure and seed-galaxy Verse routing no longer hide in
|
||||
hardcoded projector strings.
|
||||
- `AetheriaPlayerSettingsSurfaceProjector` now emits a provider-owned
|
||||
`aetheria.player_settings` Eve surface from canonical `AetheriaPlayerSettings`
|
||||
state. Gameplay and graphics settings are exposed as typed read models plus
|
||||
|
|
@ -523,8 +528,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
- `AetheriaProviderAdvertisementProjector` publishes
|
||||
`gamecult.eve.provider_advertisement.v1` for the `aetheria` provider,
|
||||
advertising the catalog, operations, and player-settings surfaces, command
|
||||
boundaries, schemas, and `.cc` witness path. This is the discovery map for
|
||||
Odin/Eve, not a health page.
|
||||
boundaries, schemas, and `.cc` witness path. Its Verse/service identity now
|
||||
comes from typed daemon host settings instead of hardcoded projector fields.
|
||||
This is the discovery map for Odin/Eve, not a health page.
|
||||
- `AetheriaCatalogSurfaceProjector` now emits the first provider-owned Eve
|
||||
surface from typed catalog state. The importer materializes a
|
||||
`gamecult.eve.surface.v1` catalog operator document at
|
||||
|
|
@ -1660,6 +1666,9 @@ First Aetheria surfaces to publish:
|
|||
operations surface.
|
||||
- Done: publish Eve command-drain health as typed CultCache state and include
|
||||
it in the operations surface.
|
||||
- Done: move daemon Verse/service identity into typed
|
||||
`aetheria.verse_host_settings.v1`, with provider advertisement and
|
||||
operations telemetry deriving from that daemon-owned host document.
|
||||
- Done: publish provider-owned player-settings controls as a typed Eve
|
||||
surface and advertise their command boundary through the provider ad.
|
||||
- Done: publish an Eve provider advertisement so Odin/Eve can discover
|
||||
|
|
|
|||
Loading…
Reference in a new issue