Route daemon surface commands through Verse client

This commit is contained in:
Meta Vens 2026-06-22 14:27:52 +01:00
commit 96b74097c1
3 changed files with 43 additions and 5 deletions

View file

@ -2936,7 +2936,9 @@ static void RequireEveRuntimeBootstrap(string root)
"public static class AetheriaRuntimeDaemonSurfaceCommands",
"EveSurfaceCommandRequest request",
"request.ProviderId, \"aetheria.daemon\"",
"AetheriaRuntimeStateReader.TryReadObservedDaemonState(stateFilePath, out var observed)",
"AetheriaRuntimeVerseClient",
".OpenAsync(",
"GetObservedDaemonStateAsync()",
"new AetheriaRuntimeDaemonOperationClient(",
"AetheriaRuntimeDaemonSurfaceCommandCatalog.TrySubmitArgumentless(",
"AetheriaRuntimeDaemonSurfaceCommandCatalog.CommandPrefix"
@ -2951,6 +2953,12 @@ static void RequireEveRuntimeBootstrap(string root)
string.Join(", ", missingDaemonSurfaceCommandSymbols));
}
if (daemonSurfaceCommands.Contains("AetheriaRuntimeStateReader.TryReadObservedDaemonState", StringComparison.Ordinal))
{
throw new InvalidOperationException(
"Daemon Eve surface command routing still reads observed daemon state through the runtime file reader instead of the Verse client.");
}
var forbiddenDaemonSurfaceCommandSymbols = new[]
{
"request.Payload.TryGetValue",

View file

@ -1806,7 +1806,7 @@ public class DaemonRuntimeDocumentTests
}
});
AetheriaRuntimeDaemonFrameStore.PublishFrame(statePath, frame);
PublishLatestFrameThroughVerseClient(statePath, frame);
AetheriaRuntimeDaemonSoaViewStore.PublishView(statePath, soaView);
var read = AetheriaRuntimeStateReader.TryReadObservedDaemonState(statePath, out var observed);
@ -1939,7 +1939,7 @@ public class DaemonRuntimeDocumentTests
77,
1.5,
0.02);
AetheriaRuntimeDaemonFrameStore.PublishFrame(statePath, frame);
PublishLatestFrameThroughVerseClient(statePath, frame);
var request = new EveSurfaceCommandRequest(
"aetheria.daemon",
AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId,
@ -1976,7 +1976,7 @@ public class DaemonRuntimeDocumentTests
79,
1.5,
0.02);
AetheriaRuntimeDaemonFrameStore.PublishFrame(statePath, frame);
PublishLatestFrameThroughVerseClient(statePath, frame);
var request = new EveSurfaceCommandRequest(
"aetheria.daemon",
AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId,
@ -3803,6 +3803,23 @@ public class DaemonRuntimeDocumentTests
"state.cc.daemon.soa.cc");
}
private static void PublishLatestFrameThroughVerseClient(
string statePath,
AetheriaRuntimeDaemonFrameDocument frame)
{
using var client = AetheriaRuntimeVerseClient
.OpenAsync(statePath, "daemon-surface-command-test", startServer: false, pullOnOpen: true)
.GetAwaiter()
.GetResult();
client.LatestFrame()
.ReplaceAsync(frame)
.GetAwaiter()
.GetResult();
client.FlushAsync()
.GetAwaiter()
.GetResult();
}
private static AetheriaRuntimeCatalogItem CatalogItem(
string itemKey,
IReadOnlyList<AetheriaRuntimeBehaviorPayload> behaviorPayloads)

View file

@ -20,7 +20,20 @@ namespace GameCult.Aetheria.State.Verse
return false;
}
AetheriaRuntimeStateReader.TryReadObservedDaemonState(stateFilePath, out var observed);
using var verseClient = AetheriaRuntimeVerseClient
.OpenAsync(
stateFilePath,
string.IsNullOrWhiteSpace(request.ClientId)
? AetheriaRuntimeDaemonOperationClient.DefaultClientId
: request.ClientId,
startServer: false,
pullOnOpen: true)
.GetAwaiter()
.GetResult();
var observed = verseClient
.GetObservedDaemonStateAsync()
.GetAwaiter()
.GetResult();
var client = new AetheriaRuntimeDaemonOperationClient(
stateFilePath,
string.IsNullOrWhiteSpace(request.ClientId) ? AetheriaRuntimeDaemonOperationClient.DefaultClientId : request.ClientId,