using System.Collections.Concurrent; namespace Agent.Core.Sessions; public sealed class SessionStore { private readonly ConcurrentDictionary _sessions = new(); public AgentSession Create() { while (true) { var session = new AgentSession(Guid.NewGuid()); if (_sessions.TryAdd(session.SessionId, session)) return session; } } public bool TryGet(Guid sessionId, out AgentSession? session) => _sessions.TryGetValue(sessionId, out session); }