From c2bda39adcad1d7612f0098ec42ce28bb42eff7c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 28 Jun 2026 10:54:14 +0100 Subject: [PATCH] Expose reactive Starbridge state accessors --- Aetheria.State.Verify/Program.cs | 28 +++++++++- .../Tests/DaemonRuntimeDocumentTests.cs | 6 +++ .../StarbridgePlayerSeatDocumentTests.cs | 3 +- .../Runtime/AetheriaClientState.cs | 53 ++++++++++++++++++- 4 files changed, 85 insertions(+), 5 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 110bf0e74..c6ef9ae4e 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -7620,9 +7620,13 @@ static void RequireAetheriaManagedStateAccessorsCoverDomainDocuments(string root "public AetheriaRuntimeGravityViewportDocument LatestGravity(AetheriaRuntimeRtsViewportBounds viewport)", "public AetheriaRuntimeSelectedObjectDocument LatestSelectedObject(int entityIndex)", "public AetheriaRuntimeStarbridgeScenarioDocument LatestScenario()", + "public CultMeshReactiveDocument ReactiveScenario(", "public AetheriaRuntimeStarbridgeSessionDocument LatestSession()", + "public CultMeshReactiveDocument ReactiveSession(", "public AetheriaRuntimeStarbridgeSessionSummaryDocument LatestSummary()", - "public AetheriaRuntimeStarbridgePlayerSeatDocument LatestPlayerSeat(string seatId)" + "public CultMeshReactiveDocument ReactiveSummary(", + "public AetheriaRuntimeStarbridgePlayerSeatDocument LatestPlayerSeat(string seatId)", + "public CultMeshReactiveDocument ReactivePlayerSeat(" }; var missingClientSymbols = requiredClientSymbols .Where(symbol => !clientState.Contains(symbol, StringComparison.Ordinal)) @@ -7700,7 +7704,27 @@ static void RequireAetheriaManagedStateAccessorsCoverDomainDocuments(string root string.Join(", ", offenders)); } - Console.WriteLine("Domain document accessors: managed Aetheria state exposes named latest reads for daemon, viewport, detail, and Starbridge documents"); + if (!clientState.Contains("Starbridge.Summary", StringComparison.Ordinal) || + !checkedSources["DaemonRuntimeDocumentTests.cs"].Contains( + "client.State.Document()", + StringComparison.Ordinal) || + !checkedSources["DaemonRuntimeDocumentTests.cs"].Contains( + "client.State.DocumentBySchema(AetheriaRuntimeDaemonSchemas.StarbridgeSessionSummary)", + StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "Starbridge summary must be registered in the managed Aetheria document catalog for typed and schema lookups."); + } + + if (!checkedSources["StarbridgePlayerSeatDocumentTests.cs"].Contains( + ".ReactivePlayerSeat(seat.SeatId)", + StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "Starbridge player-seat examples must use the named managed reactive accessor instead of fetching the raw document handle."); + } + + Console.WriteLine("Domain document accessors: managed Aetheria state exposes named latest/reactive reads for daemon, viewport, detail, and Starbridge documents"); } static void RequireVerseHostSettingsAuthority(string root) diff --git a/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs index bbdda6267..4d78f35d2 100644 --- a/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs +++ b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs @@ -221,6 +221,12 @@ public class DaemonRuntimeDocumentTests Assert.AreSame(client.State.Current.Entity, client.State.Document()); Assert.AreSame(client.State.Catalog, client.State.Document()); Assert.AreSame(client.State.ZoneRender, client.State.Document()); + Assert.AreSame( + client.State.Starbridge.Summary, + client.State.Document()); + Assert.AreSame( + client.State.Starbridge.Summary, + client.State.DocumentBySchema(AetheriaRuntimeDaemonSchemas.StarbridgeSessionSummary)); Assert.AreSame(client.State.LatestFrame, client.State.Document()); Assert.AreSame(client.State.Daemon.LatestFrame, client.State.LatestFrame); Assert.AreSame(client.State.Daemon.LatestSoaView, client.State.LatestSoaView); diff --git a/Assets/Scripts/Tests/StarbridgePlayerSeatDocumentTests.cs b/Assets/Scripts/Tests/StarbridgePlayerSeatDocumentTests.cs index eec1fe8ba..475e95a01 100644 --- a/Assets/Scripts/Tests/StarbridgePlayerSeatDocumentTests.cs +++ b/Assets/Scripts/Tests/StarbridgePlayerSeatDocumentTests.cs @@ -81,9 +81,8 @@ public class StarbridgePlayerSeatDocumentTests var aetheriaStarbridge = client .Aetheria() .Starbridge; - var aetheriaSeat = aetheriaStarbridge.PlayerSeat(seat.SeatId); using var reactive = handle.Reactive(); - using var aetheriaReactive = aetheriaSeat.Reactive(); + using var aetheriaReactive = aetheriaStarbridge.ReactivePlayerSeat(seat.SeatId); Assert.AreEqual("seat-support", handle.Latest().SeatId); Assert.AreEqual("seat-support", client.Aetheria().Starbridge.LatestPlayerSeat(seat.SeatId).SeatId); diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs index b397d1052..c62fd7bed 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs @@ -105,7 +105,8 @@ namespace GameCult.Aetheria.State.Verse SectorMap, ZoneRender, Starbridge.Scenario, - Starbridge.Session); + Starbridge.Session, + Starbridge.Summary); } public AetheriaClientDaemonState Daemon { get; } @@ -1187,6 +1188,18 @@ namespace GameCult.Aetheria.State.Verse return LatestScenarioAsync().ConfigureAwait(false).GetAwaiter().GetResult(); } + public Task> ReactiveScenarioAsync( + CultMeshReactiveDocumentOptions? options = null) + { + return Scenario.ReactiveAsync(options); + } + + public CultMeshReactiveDocument ReactiveScenario( + CultMeshReactiveDocumentOptions? options = null) + { + return Scenario.Reactive(options); + } + public Task LatestSessionAsync() { return Session.LatestAsync(); @@ -1197,6 +1210,18 @@ namespace GameCult.Aetheria.State.Verse return LatestSessionAsync().ConfigureAwait(false).GetAwaiter().GetResult(); } + public Task> ReactiveSessionAsync( + CultMeshReactiveDocumentOptions? options = null) + { + return Session.ReactiveAsync(options); + } + + public CultMeshReactiveDocument ReactiveSession( + CultMeshReactiveDocumentOptions? options = null) + { + return Session.Reactive(options); + } + public Task LatestSummaryAsync() { return Summary.LatestAsync(); @@ -1207,6 +1232,18 @@ namespace GameCult.Aetheria.State.Verse return LatestSummaryAsync().ConfigureAwait(false).GetAwaiter().GetResult(); } + public Task> ReactiveSummaryAsync( + CultMeshReactiveDocumentOptions? options = null) + { + return Summary.ReactiveAsync(options); + } + + public CultMeshReactiveDocument ReactiveSummary( + CultMeshReactiveDocumentOptions? options = null) + { + return Summary.Reactive(options); + } + public Task LatestPlayerSeatAsync(string seatId) { return PlayerSeat(seatId).LatestAsync(); @@ -1216,5 +1253,19 @@ namespace GameCult.Aetheria.State.Verse { return LatestPlayerSeatAsync(seatId).ConfigureAwait(false).GetAwaiter().GetResult(); } + + public Task> ReactivePlayerSeatAsync( + string seatId, + CultMeshReactiveDocumentOptions? options = null) + { + return PlayerSeat(seatId).ReactiveAsync(options); + } + + public CultMeshReactiveDocument ReactivePlayerSeat( + string seatId, + CultMeshReactiveDocumentOptions? options = null) + { + return PlayerSeat(seatId).Reactive(options); + } } }