Import shared Eve Unity packages from Eve repo

This commit is contained in:
Meta Vens 2026-06-16 20:16:57 +01:00
commit e10301f165
13 changed files with 95 additions and 522 deletions

View file

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Packages\org.gamecult.eve.surface\Runtime\EveSurfaceDocument.cs" Link="EveSurfaceDocument.cs" />
<Compile Include="..\..\Eve\packages\org.gamecult.eve.surface\Runtime\EveSurfaceDocument.cs" Link="EveSurfaceDocument.cs" />
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeCatalogSnapshot.cs" Link="AetheriaRuntimeCatalogSnapshot.cs" />
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeCatalogStore.cs" Link="AetheriaRuntimeCatalogStore.cs" />
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeBehaviorMetadata.cs" Link="AetheriaRuntimeBehaviorMetadata.cs" />

View file

@ -9,6 +9,7 @@ var statePath = args.Length > 1
RequireGameplaySourcePurity(root);
RequirePackageSerializerBoundary(root);
RequireSharedEvePackagesImportedFromEveRepo(root);
RequireTypedPendingCommitKeys(root);
RequireTypedRuntimeFactionKeys(root);
RequireTypedGalaxyFactionRelationships(root);
@ -484,6 +485,7 @@ Console.WriteLine($"Corporation allegiance edges: {corporationAllegianceEdges}")
Console.WriteLine($"Name files: {nameFiles.Length}");
Console.WriteLine("Live gameplay source purity: no serializer or legacy database symbols in Assets/Scripts");
Console.WriteLine("Package serializer boundary: MessagePack symbols remain in named CultCache transport files only");
Console.WriteLine("Shared Eve package ownership: generic Unity Eve packages import from the neighboring Eve repo instead of local staged copies");
Console.WriteLine("Eve runtime bootstrap: operations surface mounts through UI Toolkit presenter");
Console.WriteLine("Renderer-local console authority: deleted; UI commands flow through Eve command documents");
Console.WriteLine("Renderer-local debug panels: obsolete uGUI field tester authority is deleted");
@ -559,6 +561,81 @@ static void RequireGameplaySourcePurity(string root)
}
}
static void RequireSharedEvePackagesImportedFromEveRepo(string root)
{
var manifestPath = Path.Combine(root, "Packages", "manifest.json");
var lockPath = Path.Combine(root, "Packages", "packages-lock.json");
var unityFacadeProjectPath = Path.Combine(root, "Aetheria.State.Unity", "Aetheria.State.Unity.csproj");
var localSurfacePath = Path.Combine(root, "Packages", "org.gamecult.eve.surface");
var localUnityUiToolkitPath = Path.Combine(root, "Packages", "org.gamecult.eve.unity-uitoolkit");
var evePackagesRoot = Path.GetFullPath(Path.Combine(root, "..", "Eve", "packages"));
var upstreamSurfacePath = Path.Combine(evePackagesRoot, "org.gamecult.eve.surface", "package.json");
var upstreamUnityUiToolkitPath = Path.Combine(evePackagesRoot, "org.gamecult.eve.unity-uitoolkit", "package.json");
var manifest = File.Exists(manifestPath)
? File.ReadAllText(manifestPath)
: throw new InvalidOperationException("Cannot verify shared Eve package ownership; manifest.json is missing.");
var packageLock = File.Exists(lockPath)
? File.ReadAllText(lockPath)
: throw new InvalidOperationException("Cannot verify shared Eve package ownership; packages-lock.json is missing.");
var unityFacadeProject = File.Exists(unityFacadeProjectPath)
? File.ReadAllText(unityFacadeProjectPath)
: throw new InvalidOperationException("Cannot verify shared Eve package ownership; Aetheria.State.Unity.csproj is missing.");
var requiredManifestSymbols = new[]
{
"\"org.gamecult.eve.surface\": \"file:../../Eve/packages/org.gamecult.eve.surface\"",
"\"org.gamecult.eve.unity-uitoolkit\": \"file:../../Eve/packages/org.gamecult.eve.unity-uitoolkit\""
};
var missingManifestSymbols = requiredManifestSymbols
.Where(symbol => !manifest.Contains(symbol, StringComparison.Ordinal))
.ToArray();
if (missingManifestSymbols.Length > 0)
{
throw new InvalidOperationException(
"Aetheria manifest no longer imports the shared Eve Unity packages from the neighboring Eve repo: " +
string.Join(", ", missingManifestSymbols));
}
var requiredLockSymbols = new[]
{
"\"version\": \"file:../../Eve/packages/org.gamecult.eve.surface\"",
"\"version\": \"file:../../Eve/packages/org.gamecult.eve.unity-uitoolkit\"",
"\"source\": \"local\""
};
var missingLockSymbols = requiredLockSymbols
.Where(symbol => !packageLock.Contains(symbol, StringComparison.Ordinal))
.ToArray();
if (missingLockSymbols.Length > 0)
{
throw new InvalidOperationException(
"Unity lockfile no longer records the shared Eve packages as sibling-repo local imports: " +
string.Join(", ", missingLockSymbols));
}
if (Directory.Exists(localSurfacePath) || Directory.Exists(localUnityUiToolkitPath))
{
throw new InvalidOperationException(
"Aetheria should not keep local staged copies of the shared Eve Unity packages under Packages/.");
}
if (!File.Exists(upstreamSurfacePath) || !File.Exists(upstreamUnityUiToolkitPath))
{
throw new InvalidOperationException(
"The neighboring Eve repo is missing the shared Unity package roots Aetheria imports.");
}
if (!unityFacadeProject.Contains(@"..\..\Eve\packages\org.gamecult.eve.surface\Runtime\EveSurfaceDocument.cs", StringComparison.Ordinal))
{
throw new InvalidOperationException(
"Aetheria.State.Unity still points at the deleted local Eve surface package path.");
}
}
static void RequirePackageSerializerBoundary(string root)
{
var packageRuntimeRoot = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime");

View file

@ -2,8 +2,8 @@
"dependencies": {
"org.gamecult.aetheria.eve-runtime": "file:org.gamecult.aetheria.eve-runtime",
"org.gamecult.aetheria.state": "file:org.gamecult.aetheria.state",
"org.gamecult.eve.surface": "file:org.gamecult.eve.surface",
"org.gamecult.eve.unity-uitoolkit": "file:org.gamecult.eve.unity-uitoolkit",
"org.gamecult.eve.surface": "file:../../Eve/packages/org.gamecult.eve.surface",
"org.gamecult.eve.unity-uitoolkit": "file:../../Eve/packages/org.gamecult.eve.unity-uitoolkit",
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.ai.navigation": "2.0.8",

View file

@ -1,154 +0,0 @@
using System;
using System.Collections.Generic;
#nullable enable
namespace GameCult.Eve.Surface
{
public sealed class EveSurfaceDocument
{
public EveSurfaceDocument(
string type,
string schema,
string providerId,
string providerKind,
string title,
long version,
string updatedAtUtc,
EveSurfaceTree surface,
IReadOnlyList<EveCommandTemplate> commands)
{
Type = type;
Schema = schema;
ProviderId = providerId;
ProviderKind = providerKind;
Title = title;
Version = version;
UpdatedAtUtc = updatedAtUtc;
Surface = surface;
Commands = commands;
}
public string Type { get; }
public string Schema { get; }
public string ProviderId { get; }
public string ProviderKind { get; }
public string Title { get; }
public long Version { get; }
public string UpdatedAtUtc { get; }
public EveSurfaceTree Surface { get; }
public IReadOnlyList<EveCommandTemplate> Commands { get; }
}
public sealed class EveSurfaceTree
{
public EveSurfaceTree(string id, EveSurfaceComponent root, IReadOnlyList<EveStyleToken> styles)
{
Id = id;
Root = root;
Styles = styles;
}
public string Id { get; }
public EveSurfaceComponent Root { get; }
public IReadOnlyList<EveStyleToken> Styles { get; }
}
public sealed class EveSurfaceComponent
{
public EveSurfaceComponent(
string id,
string kind,
IReadOnlyDictionary<string, string> props,
IReadOnlyList<EveSurfaceComponent> children)
{
Id = id;
Kind = kind;
Props = props;
Children = children;
}
public string Id { get; }
public string Kind { get; }
public IReadOnlyDictionary<string, string> Props { get; }
public IReadOnlyList<EveSurfaceComponent> Children { get; }
public string GetProp(string key, string fallback = "")
{
return Props.TryGetValue(key, out var value) ? value : fallback;
}
}
public sealed class EveStyleToken
{
public EveStyleToken(string name, string value)
{
Name = name;
Value = value;
}
public string Name { get; }
public string Value { get; }
}
public sealed class EveCommandTemplate
{
public EveCommandTemplate(string command, string label, string transport)
{
Command = command;
Label = label;
Transport = transport;
}
public string Command { get; }
public string Label { get; }
public string Transport { get; }
}
public sealed class EveSurfaceCommandRequest
{
public EveSurfaceCommandRequest(
string providerId,
string surfaceId,
string command,
IReadOnlyDictionary<string, string> payload,
DateTimeOffset issuedAt,
string clientId)
{
ProviderId = providerId;
SurfaceId = surfaceId;
Command = command;
Payload = payload;
IssuedAt = issuedAt;
ClientId = clientId;
}
public string ProviderId { get; }
public string SurfaceId { get; }
public string Command { get; }
public IReadOnlyDictionary<string, string> Payload { get; }
public DateTimeOffset IssuedAt { get; }
public string ClientId { get; }
}
}

View file

@ -1,14 +0,0 @@
{
"name": "GameCult.Eve.Surface",
"rootNamespace": "GameCult.Eve.Surface",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": true
}

View file

@ -1,15 +0,0 @@
{
"name": "org.gamecult.eve.surface",
"displayName": "Eve Surface Contract",
"version": "0.1.0",
"unity": "2021.3",
"description": "Unity-compatible DTOs for gamecult.eve.surface.v1 documents.",
"keywords": [
"Eve",
"CultUI",
"CultMesh",
"Surface"
],
"license": "MPL-2.0",
"category": "Scripting"
}

View file

@ -1,12 +0,0 @@
# Eve UI Toolkit Lowering
This package lowers `gamecult.eve.surface.v1` retained surface documents into
Unity UI Toolkit `VisualElement` trees.
It owns native projection only. Providers still own truth, accepted state,
style token values, and command effects through CultMesh/CultNet. Unknown
component kinds degrade to inert containers instead of gaining local semantics.
This copy is staged in Aetheria because the neighboring Eve repository is dirty
on unrelated work. The intended upstream home is the Eve repository as an
importable Unity package.

View file

@ -1,269 +0,0 @@
using System;
using System.Collections.Generic;
using GameCult.Eve.Surface;
using UnityEngine;
using UnityEngine.UIElements;
#nullable enable
namespace GameCult.Eve.UnityUIToolkit
{
public sealed class EveUiToolkitSurfaceLowerer
{
private readonly EveUiToolkitSurfaceOptions _options;
public EveUiToolkitSurfaceLowerer(EveUiToolkitSurfaceOptions? options = null)
{
_options = options ?? EveUiToolkitSurfaceOptions.Default;
}
public VisualElement Lower(EveSurfaceDocument document, Action<EveSurfaceCommandRequest>? commandSink = null)
{
if (document == null) throw new ArgumentNullException(nameof(document));
var root = LowerComponent(document.Surface.Root, document, commandSink);
root.name = string.IsNullOrWhiteSpace(root.name) ? document.Surface.Id : root.name;
root.AddToClassList("eve-surface-root");
ApplyStyleTokens(root, document.Surface.Styles);
return root;
}
private VisualElement LowerComponent(
EveSurfaceComponent component,
EveSurfaceDocument document,
Action<EveSurfaceCommandRequest>? commandSink)
{
var element = CreateElement(component, document, commandSink);
element.name = SafeName(component.Id);
element.AddToClassList("eve-component");
element.AddToClassList($"eve-kind-{SafeClass(component.Kind)}");
element.userData = component;
foreach (var child in component.Children)
element.Add(LowerComponent(child, document, commandSink));
return element;
}
private VisualElement CreateElement(
EveSurfaceComponent component,
EveSurfaceDocument document,
Action<EveSurfaceCommandRequest>? commandSink)
{
switch (NormalizeKind(component.Kind))
{
case "surface":
{
var element = new VisualElement();
element.style.flexGrow = 1;
element.style.flexDirection = FlexDirection.Column;
return element;
}
case "grid":
{
var element = new VisualElement();
element.style.flexDirection = FlexDirection.Row;
element.style.flexWrap = Wrap.Wrap;
element.style.alignItems = Align.Stretch;
return element;
}
case "card":
{
var card = new VisualElement();
card.AddToClassList("eve-card");
card.style.flexDirection = FlexDirection.Column;
var title = component.GetProp("title");
if (!string.IsNullOrWhiteSpace(title))
card.Add(TitleLabel(title));
return card;
}
case "metric":
{
var metric = new VisualElement();
metric.AddToClassList("eve-metric");
metric.style.flexDirection = FlexDirection.Column;
metric.Add(MutedLabel(component.GetProp("label")));
metric.Add(ValueLabel(component.GetProp("value")));
return metric;
}
case "inspector.kv":
{
var inspector = new VisualElement();
inspector.AddToClassList("eve-inspector");
inspector.style.flexDirection = FlexDirection.Column;
return inspector;
}
case "row":
{
var row = new VisualElement();
row.AddToClassList("eve-row");
row.style.flexDirection = FlexDirection.Row;
row.style.flexWrap = Wrap.Wrap;
foreach (var prop in component.Props)
row.Add(FieldLabel(prop.Key, prop.Value));
return row;
}
case "text":
{
return BodyLabel(component.GetProp("text", component.GetProp("value", component.GetProp("title"))));
}
case "control.button":
{
var label = component.GetProp("label", component.GetProp("title", "Invoke"));
var command = component.GetProp("command", component.GetProp("action", "invoke"));
return new Button(() => EmitCommand(document, component, command, commandSink)) { text = label };
}
case "control.text":
{
var label = component.GetProp("label", component.GetProp("title", "Value"));
var command = component.GetProp("command", component.GetProp("action", "set"));
var value = component.GetProp("value");
var field = new TextField(label);
field.SetValueWithoutNotify(value);
field.RegisterValueChangedCallback(evt =>
{
if (string.Equals(evt.newValue, value, StringComparison.Ordinal))
return;
var payload = new Dictionary<string, string>(component.Props, StringComparer.Ordinal)
{
["value"] = evt.newValue ?? ""
};
EmitCommand(document, component, command, payload, commandSink);
});
return field;
}
default:
{
var element = new VisualElement();
element.AddToClassList("eve-unknown");
var title = component.GetProp("title", component.GetProp("label"));
if (!string.IsNullOrWhiteSpace(title))
element.Add(BodyLabel(title));
return element;
}
}
}
private static void EmitCommand(
EveSurfaceDocument document,
EveSurfaceComponent component,
string command,
Action<EveSurfaceCommandRequest>? commandSink)
{
EmitCommand(
document,
component,
command,
new Dictionary<string, string>(component.Props, StringComparer.Ordinal),
commandSink);
}
private static void EmitCommand(
EveSurfaceDocument document,
EveSurfaceComponent component,
string command,
IReadOnlyDictionary<string, string> payload,
Action<EveSurfaceCommandRequest>? commandSink)
{
if (commandSink == null || string.IsNullOrWhiteSpace(command))
return;
commandSink(new EveSurfaceCommandRequest(
document.ProviderId,
document.Surface.Id,
command,
payload,
DateTimeOffset.UtcNow,
"unity-uitoolkit"));
}
private static Label TitleLabel(string text)
{
var label = new Label(text);
label.AddToClassList("eve-title");
label.style.unityFontStyleAndWeight = FontStyle.Bold;
return label;
}
private static Label BodyLabel(string text)
{
var label = new Label(text);
label.AddToClassList("eve-text");
return label;
}
private static Label MutedLabel(string text)
{
var label = new Label(text);
label.AddToClassList("eve-muted");
return label;
}
private static Label ValueLabel(string text)
{
var label = new Label(text);
label.AddToClassList("eve-value");
label.style.unityFontStyleAndWeight = FontStyle.Bold;
return label;
}
private static VisualElement FieldLabel(string key, string value)
{
var field = new VisualElement();
field.AddToClassList("eve-field");
field.style.flexDirection = FlexDirection.Row;
field.Add(MutedLabel(key));
field.Add(BodyLabel(value));
return field;
}
private static void ApplyStyleTokens(VisualElement root, IReadOnlyList<EveStyleToken> tokens)
{
foreach (var token in tokens)
{
if (string.IsNullOrWhiteSpace(token.Name) || string.IsNullOrWhiteSpace(token.Value))
continue;
root.AddToClassList($"eve-style-token-{SafeClass(token.Name)}");
}
}
private static string NormalizeKind(string kind)
{
if (string.IsNullOrWhiteSpace(kind))
return "";
if (kind == "panel.dialogue")
return "panel";
if (kind.StartsWith("text.", StringComparison.Ordinal))
return "text";
if (kind.StartsWith("control.button.", StringComparison.Ordinal))
return "control.button";
if (kind.StartsWith("control.text.", StringComparison.Ordinal))
return "control.text";
return kind;
}
private static string SafeName(string value)
{
return string.IsNullOrWhiteSpace(value) ? "eve.component" : value;
}
private static string SafeClass(string value)
{
if (string.IsNullOrWhiteSpace(value))
return "unknown";
var characters = value.ToCharArray();
for (var index = 0; index < characters.Length; index++)
{
if (!char.IsLetterOrDigit(characters[index]))
characters[index] = '-';
}
return new string(characters).Trim('-').ToLowerInvariant();
}
}
}

View file

@ -1,9 +0,0 @@
#nullable enable
namespace GameCult.Eve.UnityUIToolkit
{
public sealed class EveUiToolkitSurfaceOptions
{
public static EveUiToolkitSurfaceOptions Default { get; } = new EveUiToolkitSurfaceOptions();
}
}

View file

@ -1,16 +0,0 @@
{
"name": "GameCult.Eve.UnityUIToolkit",
"rootNamespace": "GameCult.Eve.UnityUIToolkit",
"references": [
"GameCult.Eve.Surface"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View file

@ -1,18 +0,0 @@
{
"name": "org.gamecult.eve.unity-uitoolkit",
"displayName": "Eve UI Toolkit Lowering",
"version": "0.1.0",
"unity": "2021.3",
"description": "Unity UI Toolkit lowering for gamecult.eve.surface.v1 documents.",
"dependencies": {
"org.gamecult.eve.surface": "0.1.0"
},
"keywords": [
"Eve",
"CultUI",
"UI Toolkit",
"Unity"
],
"license": "MPL-2.0",
"category": "Scripting"
}

View file

@ -18,15 +18,15 @@
}
},
"org.gamecult.eve.surface": {
"version": "file:org.gamecult.eve.surface",
"version": "file:../../Eve/packages/org.gamecult.eve.surface",
"depth": 0,
"source": "embedded",
"source": "local",
"dependencies": {}
},
"org.gamecult.eve.unity-uitoolkit": {
"version": "file:org.gamecult.eve.unity-uitoolkit",
"version": "file:../../Eve/packages/org.gamecult.eve.unity-uitoolkit",
"depth": 0,
"source": "embedded",
"source": "local",
"dependencies": {
"org.gamecult.eve.surface": "0.1.0"
}

View file

@ -630,8 +630,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
documents, not text parsed by a Unity component or a test-scene uGUI panel and
invoked directly against gameplay objects.
- Aetheria already has Unity UIElements support available through
`com.unity.modules.uielements`. It now imports local staged
`org.gamecult.eve.surface` and `org.gamecult.eve.unity-uitoolkit` packages:
`com.unity.modules.uielements`. It now imports
`org.gamecult.eve.surface` and `org.gamecult.eve.unity-uitoolkit` from the
neighboring Eve repository:
the first carries no-engine `gamecult.eve.surface.v1` contract DTOs, and the
second lowers those retained trees into UI Toolkit `VisualElement` trees.
These packages are renderer boundaries, not UI truth owners.
@ -817,8 +818,8 @@ a bespoke Unity lowering. The existing CultLib Unity uGUI package remains useful
as prior art for resolver-backed controls and inspector generation, but it is
not the new portable UI authority.
Until the shared Eve package lands upstream, Aetheria carries a local staged
Unity package pair:
The shared Eve Unity package pair now lives upstream in the neighboring Eve
repository, and Aetheria imports it by sibling-repo file path:
- `org.gamecult.eve.surface`: no-engine DTOs for `gamecult.eve.surface.v1`.
- `org.gamecult.eve.unity-uitoolkit`: UI Toolkit lowering from those DTOs to
@ -1428,8 +1429,8 @@ First Aetheria surfaces to publish:
6. Eve UI
- Done: publish the typed catalog operator surface from `Aetheria.State`.
- Done: stage the Eve surface contract DTO package and UI Toolkit lowering
package as importable Unity packages in Aetheria while the neighboring Eve
repo is dirty on unrelated work.
package as importable Unity packages, then move their shared home into the
neighboring Eve repo once that worktree was clean.
- Done: teach the embedded Unity state package to read
`gamecult.eve.surface` records from the `.cc` store into that shared
contract.
@ -1527,8 +1528,10 @@ First Aetheria surfaces to publish:
a special-case text field; UI Toolkit lowers the shared Eve text control
and gameplay still owns the typed player-settings commit.
- Replace the next concrete uGUI screen with an Eve-owned surface.
- Move the staged packages into the Eve repo once its worktree is clean, then
import them back into Aetheria from Eve instead of carrying a local copy.
- Done: move the shared `org.gamecult.eve.surface` and
`org.gamecult.eve.unity-uitoolkit` packages into the Eve repo and retarget
Aetheria to import them from there instead of carrying local staged
copies.
- Replace the old IMGUI DB inspector first, because it is closest to state
authority.
- Then replace runtime HUD/menu/inventory/map screens.