From dd68efd9cd977156f64eb89cee58a194f444075b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 28 Jun 2026 10:33:09 +0100 Subject: [PATCH] Use reactive daemon state for surface commands --- Aetheria.State.Verify/Program.cs | 10 ++++++++-- .../Runtime/AetheriaRuntimeDaemonSurfaceCommands.cs | 8 ++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 8bfdc9f0c..a8de0557f 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -3265,8 +3265,8 @@ static void RequireEveRuntimeBootstrap(string root) "EveSurfaceCommandRequest request", "request.ProviderId, \"aetheria.daemon\"", "AetheriaClient", - "AetheriaRuntimeObservedDaemonState", - ".ReadAsync(client.State)", + "client.State.ReactiveObservedDaemon()", + "observedState.TryCurrent(out var current)", "new AetheriaRuntimeDaemonOperationClient(", "AetheriaRuntimeDaemonSurfaceCommandCatalog.TrySubmitArgumentless(", "AetheriaRuntimeDaemonSurfaceCommandCatalog.CommandPrefix" @@ -3287,6 +3287,12 @@ static void RequireEveRuntimeBootstrap(string root) "Daemon Eve surface command routing still reads observed daemon state through the runtime file reader instead of the Verse client."); } + if (daemonSurfaceCommands.Contains(".ReadAsync(client.State)", StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "Daemon Eve surface command routing still samples observed daemon state through a one-shot compatibility helper instead of a managed reactive document."); + } + if (daemonSurfaceCommands.Contains("ObserveAsync()", StringComparison.Ordinal)) { throw new InvalidOperationException( diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSurfaceCommands.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSurfaceCommands.cs index 4d3a53b17..8ba2e1837 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSurfaceCommands.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSurfaceCommands.cs @@ -21,10 +21,10 @@ namespace GameCult.Aetheria.State.Verse return false; } - var observed = AetheriaRuntimeObservedDaemonState - .ReadAsync(client.State) - .GetAwaiter() - .GetResult(); + using var observedState = client.State.ReactiveObservedDaemon(); + var observed = observedState.TryCurrent(out var current) + ? current + : null; var operationClient = new AetheriaRuntimeDaemonOperationClient( client.StatePath, string.IsNullOrWhiteSpace(request.ClientId) ? AetheriaRuntimeDaemonOperationClient.DefaultClientId : request.ClientId,