worldbox-observer-mod/IdleSpectator/Narrative/NarrativeEventStore.cs
DazedAnon ff4b40d00e feat(narrative): enhance narrative probes and presentation coverage.
- Introduce new narrative probes for episode grammar, ensemble balance, and prose redundancy
- Implement narrative presentation coverage tracking for better event visibility
- Update harness scenarios to include new narrative ingestion and persistence tests
- Refactor event emission to include narrative development IDs and presentations
- Expand InterestCandidate to support narrative presentation models and roles
2026-07-23 14:12:23 -05:00

54 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
namespace IdleSpectator;
/// <summary>World-session immutable observation store. Persistence is added in Phase 5.</summary>
public static class NarrativeEventStore
{
private static readonly Dictionary<string, NarrativeEventRecord> Events =
new Dictionary<string, NarrativeEventRecord>(StringComparer.Ordinal);
public static int Count => Events.Count;
public static void Clear()
{
Events.Clear();
}
public static NarrativeEventRecord Get(string id)
{
if (string.IsNullOrEmpty(id))
{
return null;
}
Events.TryGetValue(id, out NarrativeEventRecord record);
return record;
}
public static bool Add(NarrativeEventRecord record)
{
if (record == null || string.IsNullOrEmpty(record.Id) || Events.ContainsKey(record.Id))
{
return false;
}
Events[record.Id] = record;
NarrativePersistence.MarkDirty();
return true;
}
public static IEnumerable<NarrativeEventRecord> All() => Events.Values;
internal static bool Import(NarrativeEventRecord record)
{
if (record == null || string.IsNullOrEmpty(record.Id) || Events.ContainsKey(record.Id))
{
return false;
}
Events[record.Id] = record;
return true;
}
}