Tighten CultMesh state access ergonomics contract

This commit is contained in:
Meta Vens 2026-06-27 13:28:21 +01:00
commit 9948d5eeca
2 changed files with 141 additions and 2 deletions

View file

@ -6,6 +6,14 @@ as Verse records. Unity, tools, test harnesses, and later non-Unity clients open
the same state store with the same runtime document registry and read/write typed
documents through CultNet.
The ergonomic contract is stricter than "typed records are available
somewhere." A client must be able to ask CultMesh for the domain state it wants
in one semantic call and receive a typed reactive document, collection, query
result, operation handle, or native view. The caller should not manually walk
through daemon frames, projected rows, record keys, schema slots, state refs,
renderer-local facade indexes, or transport route decisions to reconstruct one
gameplay value.
The shared entrypoint is `AetheriaRuntimeVerseClient` in the runtime state
package. It opens a local `CultMeshNode` with the runtime-only Aetheria contract
registry and exposes:
@ -20,7 +28,7 @@ registry and exposes:
- typed daemon and Eve command submission through the same command record keys
used by the daemon.
This is the intended shape for the Unity client:
This is the baseline local-record shape:
```csharp
using var client = await AetheriaRuntimeVerseClient.OpenAsync(
@ -39,12 +47,44 @@ using var frames = client.WatchLatestFrames().Subscribe(change =>
var soa = await client.GetLatestSoaViewAsync();
```
That baseline is not the desired presentation API for gameplay state. Unity
menus, HUDs, renderers, RTS panels, and tools should move toward semantic
handles:
```csharp
var aetheria = client.Aetheria();
using var inventory = aetheria.Current.Inventory.Watch(RenderInventory);
using var docking = aetheria.Current.Docking.Watch(RenderDocking);
using var dockingBay = aetheria.Current.DockingBay.Watch(RenderDockingBay);
var stationRefit = await aetheria.Station.Refit.LatestAsync();
var visibleObjects = await aetheria.Zone(currentZoneId)
.Objects
.VisibleToCurrentPlayer()
.Within(cameraRect)
.LatestAsync();
```
The implementation behind those handles may read a local CultCache record,
execute a derived query against the latest daemon frame, subscribe to a remote
Verse, bind an Eve state pointer, or expose a native slab view. That decision is
CultMesh infrastructure. The caller gets a typed domain value and diagnostics
when it asks for them.
Unity should treat the client as its Aetheria-facing runtime surface. It can
still use Burst, DOTS rendering, and native views for presentation, but the state
authority boundary is the typed CultMesh contract. No Unity-facing code should
reach for string command names, mutable payload dictionaries, local simulation
ticks, or daemon implementation classes.
No Unity-facing code should reconstruct state by joining `Current*Async()`,
`StationRefitAsync()`, raw frame projections, typed rows, record keys, and
`AetheriaUnityObservedFacadeIndex`. Renderer-local facades are temporary
presentation caches, not gameplay-state accessors. If the caller wants current
docking bay, target details, station stock, current inventory, or zone contacts,
the public API should expose that as a typed CultMesh handle directly.
## Embedded Host Option
Running an embeddable daemon core in Unity remains a deployment option, but it