refactor(runtime): expose canonical gameplay state

Move character options and movement skills into the Runtime-owned character graph, expose borrowed inventory, character, and social views, and route retained UI state commands through generation-gated typed Runtime contracts. Preserve the existing synchronous wire path while deleting the App-owned option and skill mirrors and extending normalized parity checkpoints.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-26 09:12:30 +02:00
parent 9d0d9b07e0
commit dcb61efb5a
34 changed files with 2076 additions and 103 deletions

View file

@ -5,12 +5,29 @@ public sealed class FriendsState
{
private readonly object _gate = new();
private readonly List<FriendEntry> _entries = new();
private long _revision;
public int Count
{
get { lock (_gate) return _entries.Count; }
}
public long Revision => Interlocked.Read(ref _revision);
public IReadOnlyList<FriendEntry> Snapshot()
{
lock (_gate) return _entries.ToArray();
}
public bool TryGet(uint characterId, out FriendEntry? friend)
{
lock (_gate)
{
friend = _entries.Find(candidate => candidate.Id == characterId);
return friend is not null;
}
}
public void Apply(FriendsUpdate update)
{
ArgumentNullException.ThrowIfNull(update);
@ -43,12 +60,17 @@ public sealed class FriendsState
}
break;
}
Interlocked.Increment(ref _revision);
}
}
public void Clear()
{
lock (_gate) _entries.Clear();
lock (_gate)
{
_entries.Clear();
Interlocked.Increment(ref _revision);
}
}
}

View file

@ -5,6 +5,9 @@ public sealed class SquelchState
{
private readonly object _gate = new();
private SquelchDatabase _database = SquelchDatabase.Empty;
private long _revision;
public long Revision => Interlocked.Read(ref _revision);
public SquelchDatabase Snapshot()
{
@ -14,7 +17,11 @@ public sealed class SquelchState
public void Replace(SquelchDatabase database)
{
ArgumentNullException.ThrowIfNull(database);
lock (_gate) _database = database;
lock (_gate)
{
_database = database;
Interlocked.Increment(ref _revision);
}
}
/// <summary>
@ -25,7 +32,11 @@ public sealed class SquelchState
/// </summary>
public void Clear()
{
lock (_gate) _database = SquelchDatabase.Empty;
lock (_gate)
{
_database = SquelchDatabase.Empty;
Interlocked.Increment(ref _revision);
}
}
}