Use CultMesh Eve surface documents
This commit is contained in:
parent
b6d0d5fb4c
commit
bc8bd95d4b
22 changed files with 222 additions and 603 deletions
|
|
@ -64,7 +64,7 @@ public static class AetheriaDocumentRegistry
|
|||
typeof(AetheriaRuntimeCommittedCommandFactDocument),
|
||||
typeof(AetheriaRuntimeEveCommandDocument),
|
||||
typeof(AetheriaRuntimeSurfaceDocument),
|
||||
typeof(EveSurfaceState),
|
||||
typeof(EveSurfaceDocument),
|
||||
typeof(EveProviderAdvertisementState)
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Aetheria.State.Documents;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Mesh;
|
||||
|
||||
namespace Aetheria.State;
|
||||
|
||||
|
|
@ -51,7 +52,7 @@ public static class AetheriaEveCommandBridge
|
|||
{
|
||||
case AetheriaRuntimeEveCommandKind.CatalogRefresh:
|
||||
var catalog = await node.RuntimeCatalog().LatestAsync().ConfigureAwait(false);
|
||||
await node.MutableDocument<EveSurfaceState>(AetheriaStateNode.CatalogSurfaceKey)
|
||||
await node.MutableDocument<EveSurfaceDocument>(AetheriaStateNode.CatalogSurfaceKey)
|
||||
.ReplaceAsync(AetheriaEveSurfaceDocuments.BuildCatalogSurface(catalog, command.IssuedAtUtc))
|
||||
.ConfigureAwait(false);
|
||||
report.AcceptedCatalogRefreshes++;
|
||||
|
|
@ -61,7 +62,7 @@ public static class AetheriaEveCommandBridge
|
|||
EmptyEveCommandAcceptanceStatus(node.StatePath, command.IssuedAtUtc);
|
||||
var verseHostSettings = await node.MutableDocument<AetheriaVerseHostSettings>(AetheriaStateNode.VerseHostSettingsKey).ReadAsync().ConfigureAwait(false);
|
||||
var runtimeSession = await node.MutableDocument<AetheriaRuntimeSession>(AetheriaStateNode.RuntimeSessionKey(eveStatus.RuntimeId)).ReadAsync().ConfigureAwait(false);
|
||||
await node.MutableDocument<EveSurfaceState>(AetheriaStateNode.OperationsSurfaceKey)
|
||||
await node.MutableDocument<EveSurfaceDocument>(AetheriaStateNode.OperationsSurfaceKey)
|
||||
.ReplaceAsync(AetheriaEveSurfaceDocuments.BuildOperationsSurface(
|
||||
eveStatus,
|
||||
verseHostSettings,
|
||||
|
|
@ -188,7 +189,7 @@ public static class AetheriaEveCommandBridge
|
|||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
await node.MutableDocument<EveSurfaceState>(AetheriaStateNode.PlayerSettingsSurfaceKey)
|
||||
await node.MutableDocument<EveSurfaceDocument>(AetheriaStateNode.PlayerSettingsSurfaceKey)
|
||||
.ReplaceAsync(AetheriaEveSurfaceDocuments.BuildPlayerSettingsSurface(settings, command.IssuedAtUtc))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
|
@ -282,7 +283,7 @@ public static class AetheriaEveCommandBridge
|
|||
EmptyEveCommandAcceptanceStatus(node.StatePath, command.IssuedAtUtc);
|
||||
var runtimeSession = await node.MutableDocument<AetheriaRuntimeSession>(AetheriaStateNode.RuntimeSessionKey(eveStatus.RuntimeId)).ReadAsync().ConfigureAwait(false);
|
||||
|
||||
await node.MutableDocument<EveSurfaceState>(AetheriaStateNode.OperationsSurfaceKey)
|
||||
await node.MutableDocument<EveSurfaceDocument>(AetheriaStateNode.OperationsSurfaceKey)
|
||||
.ReplaceAsync(AetheriaEveSurfaceDocuments.BuildOperationsSurface(
|
||||
eveStatus,
|
||||
normalized,
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@ using System.Linq;
|
|||
using Aetheria.State.Documents;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Mesh;
|
||||
using EveDocumentCommandTemplate = Aetheria.State.Documents.EveCommandTemplate;
|
||||
using EveDocumentStyleToken = Aetheria.State.Documents.EveStyleToken;
|
||||
using EveDocumentSurface = Aetheria.State.Documents.EveSurface;
|
||||
using EveDocumentSurfaceComponent = Aetheria.State.Documents.EveSurfaceComponent;
|
||||
using EveSurfaceComponent = GameCult.Mesh.EveSurfaceComponent;
|
||||
using EveSurfaceDocument = GameCult.Mesh.EveSurfaceDocument;
|
||||
using EveSurfaceTree = GameCult.Mesh.EveSurfaceTree;
|
||||
|
||||
namespace Aetheria.State;
|
||||
|
||||
|
|
@ -30,7 +29,7 @@ public static class AetheriaEveSurfaceDocuments
|
|||
private const string DaemonCommandBoundaryId = "aetheria.daemon.commands";
|
||||
private const string DaemonRecordTransport = "cultmesh-record";
|
||||
|
||||
public static EveSurfaceState BuildCatalogSurface(
|
||||
public static EveSurfaceDocument BuildCatalogSurface(
|
||||
AetheriaRuntimeCatalogSnapshot catalog,
|
||||
string updatedAtUtc,
|
||||
long version = 1)
|
||||
|
|
@ -60,17 +59,15 @@ public static class AetheriaEveSurfaceDocuments
|
|||
CultMeshLocalityKind.Automatic,
|
||||
"cultmesh")));
|
||||
|
||||
return new EveSurfaceState
|
||||
{
|
||||
ProviderId = ProviderId,
|
||||
ProviderKind = "game.runtime",
|
||||
Title = "Aetheria Catalog",
|
||||
Version = version,
|
||||
UpdatedAtUtc = updatedAtUtc,
|
||||
Surface = new EveDocumentSurface
|
||||
{
|
||||
Id = CatalogSurfaceId,
|
||||
Root = Node(
|
||||
return new EveSurfaceDocument(
|
||||
ProviderId,
|
||||
"game.runtime",
|
||||
"Aetheria Catalog",
|
||||
version,
|
||||
updatedAtUtc,
|
||||
new EveSurfaceTree(
|
||||
CatalogSurfaceId,
|
||||
Node(
|
||||
"aetheria.catalog.root",
|
||||
"surface",
|
||||
[],
|
||||
|
|
@ -93,24 +90,15 @@ public static class AetheriaEveSurfaceDocuments
|
|||
"aetheria.catalog.corporations",
|
||||
"card",
|
||||
[("title", "Corporations")],
|
||||
Node("aetheria.catalog.corporation.rows", "inspector.kv", [], corporations)))
|
||||
},
|
||||
Commands =
|
||||
[
|
||||
new EveDocumentCommandTemplate
|
||||
{
|
||||
Command = refreshCommand.OperationId,
|
||||
Label = refreshCommand.Label,
|
||||
Transport = refreshCommand.RouteDescription,
|
||||
SchemaId = refreshCommand.SchemaId,
|
||||
RouteKind = refreshCommand.RouteKind,
|
||||
RouteDescription = refreshCommand.RouteDescription
|
||||
}
|
||||
]
|
||||
};
|
||||
Node("aetheria.catalog.corporation.rows", "inspector.kv", [], corporations))),
|
||||
Array.Empty<EveSurfaceStyleToken>()),
|
||||
new[]
|
||||
{
|
||||
new EveSurfaceCommandTemplate(refreshCommand.ToBinding())
|
||||
});
|
||||
}
|
||||
|
||||
public static EveSurfaceState BuildOperationsSurface(
|
||||
public static EveSurfaceDocument BuildOperationsSurface(
|
||||
AetheriaEveCommandAcceptanceStatus? eveCommandStatus = null,
|
||||
AetheriaVerseHostSettings? verseHostSettings = null,
|
||||
AetheriaRuntimeSession? runtimeSession = null,
|
||||
|
|
@ -128,17 +116,15 @@ public static class AetheriaEveSurfaceDocuments
|
|||
routeHint: new CultMeshRouteHint(
|
||||
CultMeshLocalityKind.Automatic,
|
||||
"cultmesh")));
|
||||
return new EveSurfaceState
|
||||
{
|
||||
ProviderId = ProviderId,
|
||||
ProviderKind = "game.runtime",
|
||||
Title = "Aetheria Operations",
|
||||
Version = version,
|
||||
UpdatedAtUtc = updatedAtUtc,
|
||||
Surface = new EveDocumentSurface
|
||||
{
|
||||
Id = OperationsSurfaceId,
|
||||
Root = Node(
|
||||
return new EveSurfaceDocument(
|
||||
ProviderId,
|
||||
"game.runtime",
|
||||
"Aetheria Operations",
|
||||
version,
|
||||
updatedAtUtc,
|
||||
new EveSurfaceTree(
|
||||
OperationsSurfaceId,
|
||||
Node(
|
||||
"aetheria.operations.root",
|
||||
"surface",
|
||||
[],
|
||||
|
|
@ -188,24 +174,15 @@ public static class AetheriaEveSurfaceDocuments
|
|||
"runtimeSession.last",
|
||||
("runtime", runtimeSession?.RuntimeId ?? ""),
|
||||
("started", runtimeSession?.StartedAtUtc ?? ""),
|
||||
("lastSeen", runtimeSession?.LastSeenAtUtc ?? ""))))
|
||||
},
|
||||
Commands =
|
||||
[
|
||||
new EveDocumentCommandTemplate
|
||||
{
|
||||
Command = refreshCommand.OperationId,
|
||||
Label = refreshCommand.Label,
|
||||
Transport = refreshCommand.RouteDescription,
|
||||
SchemaId = refreshCommand.SchemaId,
|
||||
RouteKind = refreshCommand.RouteKind,
|
||||
RouteDescription = refreshCommand.RouteDescription
|
||||
}
|
||||
]
|
||||
};
|
||||
("lastSeen", runtimeSession?.LastSeenAtUtc ?? "")))),
|
||||
Array.Empty<EveSurfaceStyleToken>()),
|
||||
new[]
|
||||
{
|
||||
new EveSurfaceCommandTemplate(refreshCommand.ToBinding())
|
||||
});
|
||||
}
|
||||
|
||||
public static EveSurfaceState BuildPlayerSettingsSurface(
|
||||
public static EveSurfaceDocument BuildPlayerSettingsSurface(
|
||||
AetheriaPlayerSettings? settings,
|
||||
string updatedAtUtc,
|
||||
long version = 1)
|
||||
|
|
@ -228,41 +205,7 @@ public static class AetheriaEveSurfaceDocuments
|
|||
publishedAtUtc,
|
||||
version);
|
||||
|
||||
return new EveSurfaceState
|
||||
{
|
||||
ProviderId = surface.ProviderId,
|
||||
ProviderKind = surface.ProviderKind,
|
||||
Title = surface.Title,
|
||||
Version = surface.Version,
|
||||
UpdatedAtUtc = surface.UpdatedAtUtc,
|
||||
Surface = new EveDocumentSurface
|
||||
{
|
||||
Id = surface.Surface.Id,
|
||||
Root = ConvertComponent(surface.Surface.Root),
|
||||
Styles = surface.Surface.Styles
|
||||
.Select(style => new EveDocumentStyleToken
|
||||
{
|
||||
Name = style.Name,
|
||||
Value = style.Value
|
||||
})
|
||||
.ToArray()
|
||||
},
|
||||
Commands = surface.Commands
|
||||
.Select(command =>
|
||||
{
|
||||
var record = CultMesh.OperationBindingRecord(command.Operation);
|
||||
return new EveDocumentCommandTemplate
|
||||
{
|
||||
Command = record.OperationId,
|
||||
Label = record.Label,
|
||||
Transport = record.RouteDescription,
|
||||
SchemaId = record.SchemaId,
|
||||
RouteKind = record.RouteKind,
|
||||
RouteDescription = record.RouteDescription
|
||||
};
|
||||
})
|
||||
.ToArray()
|
||||
};
|
||||
return AetheriaRuntimeSurfaceDocuments.ToPortableSurface(surface);
|
||||
}
|
||||
|
||||
public static EveProviderAdvertisementState BuildProviderAdvertisement(
|
||||
|
|
@ -483,40 +426,27 @@ public static class AetheriaEveSurfaceDocuments
|
|||
return latest;
|
||||
}
|
||||
|
||||
private static EveDocumentSurfaceComponent Metric(string id, string label, string value)
|
||||
private static EveSurfaceComponent Metric(string id, string label, string value)
|
||||
{
|
||||
return Node(id, "metric", [("label", label), ("value", value)]);
|
||||
}
|
||||
|
||||
private static EveDocumentSurfaceComponent Row(string id, params (string Key, string Value)[] props)
|
||||
private static EveSurfaceComponent Row(string id, params (string Key, string Value)[] props)
|
||||
{
|
||||
return Node(id, "row", props);
|
||||
}
|
||||
|
||||
private static EveDocumentSurfaceComponent Node(
|
||||
private static EveSurfaceComponent Node(
|
||||
string id,
|
||||
string kind,
|
||||
(string Key, string Value)[] props,
|
||||
params EveDocumentSurfaceComponent[] children)
|
||||
params EveSurfaceComponent[] children)
|
||||
{
|
||||
return new EveDocumentSurfaceComponent
|
||||
{
|
||||
Id = id,
|
||||
Kind = kind,
|
||||
Props = props.ToDictionary(prop => prop.Key, prop => prop.Value),
|
||||
Children = children
|
||||
};
|
||||
}
|
||||
|
||||
private static EveDocumentSurfaceComponent ConvertComponent(AetheriaRuntimeSurfaceComponent component)
|
||||
{
|
||||
return new EveDocumentSurfaceComponent
|
||||
{
|
||||
Id = component.Id,
|
||||
Kind = component.Kind,
|
||||
Props = new Dictionary<string, string>(component.Props, StringComparer.Ordinal),
|
||||
Children = component.Children.Select(ConvertComponent).ToArray()
|
||||
};
|
||||
return new EveSurfaceComponent(
|
||||
id,
|
||||
kind,
|
||||
props.ToDictionary(prop => prop.Key, prop => prop.Value),
|
||||
children);
|
||||
}
|
||||
|
||||
private static string SafeId(string value)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public sealed class AetheriaStateNode : IAsyncDisposable, IDisposable
|
|||
{
|
||||
private readonly CultMeshNode _node;
|
||||
private CultMeshDocumentHandle<AetheriaRuntimeCatalogSnapshot>? _runtimeCatalog;
|
||||
private CultMeshDocumentHandle<EveSurfaceState>? _catalogSurface;
|
||||
private CultMeshDocumentHandle<EveSurfaceDocument>? _catalogSurface;
|
||||
|
||||
private AetheriaStateNode(string statePath, string runtimeId, CultMeshNode node)
|
||||
{
|
||||
|
|
@ -123,7 +123,7 @@ public sealed class AetheriaStateNode : IAsyncDisposable, IDisposable
|
|||
routeHint: new CultMeshRouteHint(CultMeshLocalityKind.SharedMemory, "Aetheria typed catalog state"));
|
||||
}
|
||||
|
||||
public CultMeshDocumentHandle<EveSurfaceState> CatalogSurface()
|
||||
public CultMeshDocumentHandle<EveSurfaceDocument> CatalogSurface()
|
||||
{
|
||||
var catalog = RuntimeCatalog();
|
||||
return _catalogSurface ??= CultMesh.Document(
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ First implementation footholds now exist in CultLib:
|
|||
- `E:/Projects/CultLib/src/GameCult.Mesh/CultMeshPrimitives.cs` also exposes fluent operation/query context builders, with `CultMesh.OperationContextFor(...)` and `CultMesh.QueryContextFor(...)` entrypoints. Application code should read like a typed Verse call, not like manual transport setup.
|
||||
- `E:/Projects/CultLib/src/GameCult.Geometry/CultGeometryPrimitives.cs` defines shared `CultVec2`, `CultVec3`, `CultRect`, `CultCircle`, and `CultSphere` values for query and physics contracts.
|
||||
- `E:/Projects/CultLib/packages/cultmesh-ts/src/index.ts` now exposes TS `CultMeshVec2`, `CultMeshRect`, `CultMeshViewportRequest`, `CultMeshQuerySurface`, `CultMeshQueryContext`, `CultMeshOperationHandle`, `CultMeshOperationContext`, `CultMeshOperationPayload`, `CultMeshDocumentHandle`, `CultMeshDocumentCatalog`, `CultMeshCollectionHandle`, `CultMeshStatePointer`, `CultMeshStateBindingDescriptor`, `CultMeshOperationBindingDescriptor`, `CultMeshOperationInvocationDescriptor`, native slice descriptors, authority claims, route hints, fluent context builders, and handle helpers like `CultMesh.rectFromBounds(...)`, `CultMesh.viewportRequest(...)`, `CultMesh.query(...)`, `CultMesh.querySource(...)`, `CultMesh.operation(...)`, `CultMesh.document(...)`, `CultMesh.documents(...)`, `CultMesh.collection(...)`, `CultMesh.operationPayload(...)`, `CultMesh.statePointer(...)`, `CultMesh.stateBinding(...)`, `CultMesh.operationBinding(...)`, `CultMesh.operationInvocation(...)`, `CultMesh.nativeSliceView(...)`, `CultMesh.operationContextFor(...)`, and `CultMesh.queryContextFor(...)`.
|
||||
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimePlayerSettingsSurfaceBuilder.cs` and `E:/Projects/Eve/packages/org.gamecult.eve.surface/Runtime/EveSurfaceDocument.cs` now expose component `StateBindings` as `IReadOnlyList<CultMeshStateBindingDescriptor>`. Eve no longer owns a parallel live binding DTO, and Aetheria no longer keeps one in its live runtime surface model. Aetheria only keeps a MessagePack DTO at the persisted document boundary and converts to the shared CultMesh primitive before handing surfaces to renderers.
|
||||
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimePlayerSettingsSurfaceBuilder.cs` and `GameCult.Mesh.EveSurfaceDocument` now expose component state bindings as CultMesh-owned portable binding records. Eve no longer owns a parallel live binding DTO, and Aetheria no longer owns a parallel persisted Eve surface state. Aetheria can build runtime surface source data, then publishes the shared CultMesh surface document before renderers lower it.
|
||||
- `E:/Projects/Eve/packages/org.gamecult.eve.surface/Runtime/EveSurfaceDocument.cs` also exposes component `EmbeddedDocuments` as first-class CultUI slots. Aetheria runtime surfaces mirror that shape with `AetheriaRuntimeEmbeddedDocumentSlot`, so daemon-owned UI can compose nested synced surfaces such as inventory dropdowns without a Unity-only model, facade, or projector.
|
||||
- Aetheria and Eve live command templates now carry `CultMeshOperationBindingDescriptor`. Eve command requests carry `CultMeshOperationInvocationDescriptor` plus `CultMeshOperationPayload`, so renderer click/change events preserve operation id, schema, route hint, idempotency, and scalar field reads as shared CultMesh metadata. Legacy `command`, `label`, `transport`, and string payload fields remain compatibility projections and persisted DTO fields, but the live API no longer exposes raw command-string/dictionary constructors; controls point at typed CultMesh operations and renderers build requests from shared CultMesh primitives.
|
||||
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonOperationsClient.cs` is now a typed operation handle surface that returns `CultMeshOperationReceipt` from semantic verbs such as `SetMoveVector`, `SetTarget`, `DockNearest`, and inventory transfers. The lower-level daemon command envelope remains an internal transport wrapper, but public client code should receive shared CultMesh receipts, not Aetheria-specific command envelopes.
|
||||
|
|
@ -193,7 +193,7 @@ Current leak:
|
|||
|
||||
```csharp
|
||||
using var client = await AetheriaClient.OpenAsync(statePath, runtimeId);
|
||||
var resolver = client.State.CreateEveSurfaceStateRefResolver();
|
||||
var resolver = client.State.CreateEveSurfaceCultMeshStateRefResolver();
|
||||
var selected = resolver(surface.StateRef);
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ Current Eve surface state-ref resolution:
|
|||
|
||||
```csharp
|
||||
using var client = await AetheriaClient.OpenAsync(statePath, runtimeId);
|
||||
var resolver = client.State.CreateEveSurfaceStateRefResolver();
|
||||
var resolver = client.State.CreateEveSurfaceCultMeshStateRefResolver();
|
||||
var label = resolver("aetheria.daemon/frame/currentEntity/name");
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue